mirror of https://github.com/garrytan/gstack.git
Connects the persistence module to the daemon:
- browser-manager.ts: getContext() accessor, and launch() seeds the fresh
context via newContext({ storageState }) from the persisted cookies BEFORE
the first tab — a restart transparently restores the device cookie.
recreateContext() is untouched (it restores in-memory state itself), so
there is no double-restore.
- server.ts: acquire the per-workspace lock once at daemon start (a live peer
holding it disables persistence for this daemon, loudly, instead of racing).
Three save triggers — a debounced checkpoint after mutating commands, a
periodic safety-net checkpoint, and a final flush in shutdown() right before
the context closes (the graceful path all intentional shutdowns funnel
through). The crash path (emergencyCleanup) deliberately never saves, to
avoid serializing a dying context. Lock is released on shutdown.
All triggers are no-ops unless BROWSE_AUTO_COOKIE_PERSIST is set, so default
behavior is byte-for-byte unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| bin | ||
| scripts | ||
| src | ||
| test | ||
| PLAN-snapshot-dropdown-interactive.md | ||
| SKILL.md | ||
| SKILL.md.tmpl | ||