rowboat/apps/x/packages/core/src
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
..
account use rowboat model gateway when logged in 2026-03-12 23:29:42 +05:30
agent-loop Add sessions layer above the agent loop 2026-06-12 19:26:18 +05:30
agent-schedule add posthog analytics for llm usage and auth events 2026-04-28 19:53:40 +05:30
agents feat: add user-configurable notification settings (#601) 2026-06-11 19:43:26 +05:30
analytics Add app version to analytics events 2026-05-29 17:02:01 +05:30
application feat: add user-configurable notification settings (#601) 2026-06-11 19:43:26 +05:30
auth Fix spurious "Reconnect Google" on cold start 2026-05-27 02:25:03 +05:30
background-tasks feat: render background-task HTML output and open its links externally (#615) 2026-06-11 01:45:10 +05:30
billing Show split monthly and daily credits 2026-05-24 12:48:23 +05:30
code-mode feat: run code mode on an in-app ACP client with live approvals (#593) 2026-06-05 14:45:08 +05:30
composio feat: native google sign-in for signed-in users 2026-05-05 14:29:13 +05:30
config feat: add user-configurable notification settings (#601) 2026-06-11 19:43:26 +05:30
di feat: run code mode on an in-app ACP client with live approvals (#593) 2026-06-05 14:45:08 +05:30
events send LLM use-case metadata through Rowboat gateway 2026-05-20 07:11:06 +05:30
filesystem Refactor builtin file tools beyond workspace scope 2026-05-25 16:21:51 +05:30
knowledge feat: add user-configurable notification settings (#601) 2026-06-11 19:43:26 +05:30
local-sites Iframe (#502) 2026-04-18 12:10:40 +05:30
mcp remove default exa server 2026-03-19 18:46:08 +05:30
migrations feat: native google sign-in for signed-in users 2026-05-05 14:29:13 +05:30
models Add run-level auto permission mode 2026-06-03 07:58:04 +05:30
pre_built Refactor builtin file tools beyond workspace scope 2026-05-25 16:21:51 +05:30
runs Add run-level auto permission mode 2026-06-03 07:58:04 +05:30
schedule feat: background tasks 2026-05-12 17:43:25 +05:30
search Add global search across knowledge and chats 2026-02-18 18:08:24 +05:30
security Add run-level auto permission mode 2026-06-03 07:58:04 +05:30
services code clean up 2026-02-06 23:17:32 +05:30
sessions Add sessions layer above the agent loop 2026-06-12 19:26:18 +05:30
slack Slack2 (#410) 2026-03-10 16:26:51 +05:30
storage Add sessions layer above the agent loop 2026-06-12 19:26:18 +05:30
voice fix workdir everywhere (#475) 2026-04-10 10:40:46 +05:30
workspace Add SQLite storage foundation 2026-06-12 18:22:36 +05:30
index.ts Add SQLite storage foundation 2026-06-12 18:22:36 +05:30