mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-06-12 19:55:19 +02:00
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> |
||
|---|---|---|
| .. | ||
| src | ||
| .gitignore | ||
| package.json | ||
| tsconfig.build.json | ||
| tsconfig.json | ||
| vitest.config.ts | ||