rowboat/apps/x
Ramnique Singh 8a5427e841 Add sessions layer above the agent loop
A session is a grouping label (id, agentId, title) over an ordered chain
of self-contained turns; the loop itself never learns sessions exist.

- sendMessage builds each turn's input by copying the previous turn's
  full transcript forward (copy-forward history) and only ever chains on
  TERMINAL turns: anything running, waiting, or crashed-idle must be
  resolved or stopped first. Terminal turns are immutable, so the copied
  snapshot can never go stale or be re-activated.
- stopTurn now persists the stop as a terminal turn error (code
  "stopped") instead of leaving the turn idle/resumable; resumeTurn,
  setToolResult, and respondToPermission all reject terminal turns.
  Unresolved tool calls on a stopped turn are closed out with synthetic
  ToolMessages when history is copied forward — never re-executed.
- Turn rows gain sessionId/sessionSeq (opaque to the reducer) with a
  UNIQUE(session_id, session_seq) index as a fork tripwire; createTurn
  is now async and persists the row before returning so a claimed seq is
  visible the moment the caller holds the handle.
- New sessions/ module: Session types, SessionStore (in-memory +
  SQLite), SessionsImpl facade with a per-session KeyedMutex (extracted
  from the loop's TurnMutex). getHistory returns the same closed-out
  transcript the next turn will actually send.
- Migration 2026-06-12_0003_sessions: sessions table + additive turn
  columns. Provider/model/permissionMode deliberately flow per
  sendMessage call and land on the turn row, not the session.
- 21 new vitest tests (79 total): copy-forward, supersede-after-stop,
  crashed-turn blocking, terminal-mutation guards, concurrent-send
  serialization, SQLite round-trips and unique-seq enforcement.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 19:26:18 +05:30
..
apps Add SQLite storage foundation 2026-06-12 18:22:36 +05:30
packages Add sessions layer above the agent loop 2026-06-12 19:26:18 +05:30
patches feat: run code mode on an in-app ACP client with live approvals (#593) 2026-06-05 14:45:08 +05:30
.gitignore chore: ignore test-fixtures dir 2026-05-08 17:04:25 +05:30
ANALYTICS.md Add app version to analytics events 2026-05-29 17:02:01 +05:30
eslint.config.mts ignore renderer eslint 2026-01-16 12:05:33 +05:30
LIVE_NOTE.md Refactor builtin file tools beyond workspace scope 2026-05-25 16:21:51 +05:30
package.json integrate electron forge 2026-01-17 10:28:44 +05:30
pnpm-lock.yaml Add SQLite storage foundation 2026-06-12 18:22:36 +05:30
pnpm-workspace.yaml Add SQLite storage foundation 2026-06-12 18:22:36 +05:30
tsconfig.base.json bootstrap new electron app 2026-01-16 12:05:33 +05:30