Commit a196b84
authored
Durable stateful backend: cold re-attach, remove pi-mirroring, auto-mirror fan-out (#26)
* feat(server): durable stateful backend — cold re-attach, drop mirroring, auto-mirror fan-out
Make the makit server a durable, multi-device WS backend where any
device sees every session's activity live, and sessions survive a
server restart.
## Cold-session re-attach (resume the live agent after a restart)
- Persist `resumeSessionPath` alongside session metadata (new nullable
SQLite column + `SessionMeta` field; back-compat ALTER for old rows).
- `SessionManager.reattachSession(id)`: find the cold (rehydrated)
session, rebuild the real adapter (pi resumes from its on-disk
transcript via `--session`), swap it in with `replaceAdapter`, and
start it. Non-pi / no-resume-path sessions stay history-only and keep
emitting the clear `session.error`.
- The durable `seq` space is preserved: new events continue after the
persisted max (the store assigns the next seq), so mobile↔desktop
handoff survives a restart end-to-end.
- Wired via the `session.attach` cmd: `{sessionId}` re-attaches a cold
session; legacy `{projectId, piSessionId}` still attaches an on-disk
transcript (wire back-compat).
## Remove pi-mirroring (redundant now that makit owns/re-attaches pi)
- Delete World B (file-tailing MirrorAdapter, `makit mirror`,
`makit attach --pane`) and World D (`makit-mirror` extension, host
sessions, IngestAdapter), plus the `pane/` + `mux/` infra and the
standalone slash-palette fetcher (`commands.ts`).
- `spawnSession` now always uses the headless PiAdapter; host token /
`~/.makit/host.json` / auto-install wiring removed.
## Auto-mirror fan-out (every device sees every session)
- `SubscriptionHub.fanout` delivers each session event to ALL authed
clients, no explicit `sub` required. The `subscribed` set now only
governs history replay-on-`sub` (with fromSeq cursor) and
AskUserQuestion/ReverseRpc prompt routing.
## Tests
- reattach: persist a pi-backed session + events → new manager on same
store → reattachSession rebuilds a live adapter → next event gets
seq = max+1 (continuity), history intact.
- auto-mirror unit + a two-client integration test against a live
startWsServer proving an event from one client reaches another that
never subscribed.
pnpm typecheck clean; pnpm test 228 pass / 0 fail.
* ci: gate expensive macOS e2e to workflow_dispatch only
macOS runners cost far more than the Linux gates, and the cheap Linux
checks (server-ci unit tests + typecheck, protocol-contract, and the
headless real-pi-pinned smoke) already cover regressions on every PR.
- integration-ci.yml (stub-e2e, macos-latest): drop the pull_request /
push triggers — the workflow is now workflow_dispatch only. (A manual
dispatch already ran both stub-e2e and stub-e2e-coverage, so dispatch
behaviour is unchanged; only the per-PR/push runs go away.)
- real-pi-e2e.yml (real-pi-app, macos-15): gate to
`if: github.event_name == 'workflow_dispatch'`. The Linux real-pi-pinned
(PR/push blocking gate) and real-pi-canary (weekly schedule) are untouched.
Run them on demand from the Actions tab (or `gh workflow run`) when a
change warrants a full-stack check.
* chore: re-trigger CI after CLA fix (empty; drops on squash-merge)1 parent d6c4b02 commit a196b84
45 files changed
Lines changed: 868 additions & 3378 deletions
File tree
- .github/workflows
- server
- extensions
- src
- adapters
- cli
- mux
- pairing
- pane
- storage
- ws
- test
- ws
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | 12 | | |
24 | 13 | | |
25 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
84 | | - | |
| 85 | + | |
85 | 86 | | |
86 | | - | |
| 87 | + | |
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| |||
This file was deleted.
This file was deleted.
0 commit comments