feat(web): choose the agent preset on the new-session screen

The composer seat spent nearly all its life disabled: a session's
composition is fixed once a turn has run. Move the choice to the
new-session screen beside the workspace picker, where it still works,
and let the session header report what a running session runs.

The hero pick is staged rather than applied — that screen precedes the
session it belongs to. It lands when a session becomes current and is
still blank, which covers both the session a workspace connect creates
and the blank one it reuses; riding `sessions.create` would miss the
second. It is spent on first use, matching the workspace picker.

Fix the durability the header field claimed but never had: `agentPreset`
was declared on `SessionHeader` and dropped by the JSONL header line, the
SQLite sessions row, the derived query index, and the cold list
projection, so every resumed session came back composed from nothing.

Add the web e2e lane that would have caught it — the one lane that mounts
the shipped roster, which needed `cordis:group` in the scaffold's Loader
builtins, as `mountRootInclude` already registers.
This commit is contained in:
Yichen Jiang
2026-08-07 00:41:50 +08:00
parent 4bb9836abe
commit 2b8a0a8cff
52 files changed
+1238 -399

No files matched your search

@@ -372,8 +372,8 @@ export class SessionPersistenceSqlite extends SessionPersistence implements Pers
private writeRow(meta: SessionHeader): void {
this.db.prepare(`
INSERT INTO sessions
(id, version, created_at, cwd, parent_session, seed_length, origin, delegation_depth, incarnation, revision)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 0)
(id, version, created_at, cwd, parent_session, seed_length, origin, delegation_depth, agent_preset, incarnation, revision)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0)
ON CONFLICT(id) DO UPDATE SET
version = excluded.version,
created_at = excluded.created_at,
@@ -381,7 +381,8 @@ export class SessionPersistenceSqlite extends SessionPersistence implements Pers
parent_session = excluded.parent_session,
seed_length = excluded.seed_length,
origin = excluded.origin,
delegation_depth = excluded.delegation_depth
delegation_depth = excluded.delegation_depth,
agent_preset = excluded.agent_preset
`).run(
meta.id,
meta.version,
@@ -391,6 +392,7 @@ export class SessionPersistenceSqlite extends SessionPersistence implements Pers
meta.seedLength ?? null,
meta.origin ?? null,
meta.delegationDepth ?? null,
meta.agentPreset ?? null,
randomUUID(),
)
}
@@ -17,7 +17,7 @@ import type { SessionEvent, SessionId, SessionHeader, SurfaceOp } from '@deepsee
* layout; orthogonal to a session's own `version` (which versions the EVENT
* vocabulary, stored per session in the `sessions` row).
*/
export const SCHEMA_VERSION = 13
export const SCHEMA_VERSION = 14
/** SQLite application id protecting unrelated databases from persistence writes. */
export const SESSION_PERSISTENCE_SQLITE_APPLICATION_ID = 0x44534850
@@ -42,6 +42,7 @@ export interface SessionRow {
/** Monotonic log-change token incremented in each mutating transaction. */
revision: number
delegation_depth: number | null
agent_preset: string | null
}
/** An `events` table row: one `SessionEvent` mapped 1:1 (`data` is JSON text). */
@@ -125,6 +126,7 @@ function configureDatabase(db: DatabaseSync, path: string, journalMode: JournalM
seed_length INTEGER,
origin TEXT,
delegation_depth INTEGER,
agent_preset TEXT,
incarnation TEXT NOT NULL,
revision INTEGER NOT NULL
) STRICT;
@@ -184,6 +186,7 @@ export function rowToMeta(row: SessionRow): SessionHeader {
...row.seed_length !== null ? { seedLength: row.seed_length } : {},
...row.origin !== null ? { origin: row.origin } : {},
...row.delegation_depth !== null ? { delegationDepth: row.delegation_depth } : {},
...row.agent_preset !== null ? { agentPreset: row.agent_preset } : {},
}
}