mirror of
https://github.com/stablyai/orca.git
synced 2026-10-26 08:02:44 +00:00
Step 1 of the agent-launch unification, on main. - The dispatcher stamps every request's caller from what its connection proved (runtime socket: the local CLI; the desktop's IPC: the desktop; a paired socket: its device). Params never set it. - The launch record is written twice: once when the tab exists (what creation settled: on the launch command, a draft, or a submit still `unconfirmed`), and again once the prompt's fate is known. A restart in between finds the running agent instead of answering "unknown". - A replay re-derives its terminal handle from the pane key in the running host, and shows `unconfirmed` only to callers that advertise agent.launch.prompt-unconfirmed.v1. - The record store opens in its own slot, without building the chat host; the chat host is built on that same store. Rebuilt from this PR's own commits (b9adf88da0,0d7d9b5b30,c83f44dd72,39d15d52c0) onto main, without #24080/#24081. Conflicts: the delivery doc table (main's "line fits" row plus the `unconfirmed` row), and main's journal-database open in install(), which now goes through the record-store slot.
44 lines
2.4 KiB
TypeScript
44 lines
2.4 KiB
TypeScript
// Split out of protocol-version.ts, which spreads the list below into RUNTIME_CAPABILITIES in this
|
|
// order. Import these names from here: the mobile recording loader cannot follow `export *`.
|
|
|
|
/**
|
|
* `agent.launch` exists: one host-side method that decides structured-vs-terminal and creates the
|
|
* surface, instead of each client routing for itself.
|
|
*
|
|
* Negotiated rather than assumed because a client that cannot see it must keep using
|
|
* `worktree.create` + `startupAgent`, which stays supported verbatim. The reverse skew is the
|
|
* dangerous one: `worktree.create` returns `agentTerminalHandle` only when a startup agent was
|
|
* requested, so a host that quietly routed that call to a structured session would hand an old
|
|
* client a response with no handle and no error.
|
|
*
|
|
* Advertising it is a statement that the client understands EITHER outcome, since the host is what
|
|
* picks: a structured session it can open, or a terminal agent. A client that renders only one of
|
|
* the two keeps using the surface-specific methods.
|
|
*/
|
|
// v2 makes prompt delivery an outcome union and top-level warnings the only supported shape.
|
|
export const AGENT_LAUNCH_RUNTIME_CAPABILITY = 'agent.launch.v2' as const
|
|
|
|
// Optional identity support on agent.launch; mobile replay across replacement hosts requires the new method.
|
|
export const AGENT_LAUNCH_REPLAY_RUNTIME_CAPABILITY = 'agent.launch.replay.v1' as const
|
|
|
|
// A host that sends a launch prompt its typed startup line cannot carry to a paste after
|
|
// readiness; an older host folds any prompt into that line, so clients gate prompted launches on it.
|
|
export const AGENT_LAUNCH_PROMPT_CARRY_RUNTIME_CAPABILITY = 'agent.launch.prompt-carry.v1' as const
|
|
|
|
// agent.launchReplay requires the ledger; older replacement hosts must reject the method.
|
|
export const AGENT_LAUNCH_REPLAY_REQUIRED_RUNTIME_CAPABILITY =
|
|
'agent.launch.replay-required.v1' as const
|
|
|
|
// A client that reads `prompt.outcome: 'unconfirmed'` on a replayed launch. Without it, a launch
|
|
// whose host stopped mid-delivery replays as `agent_session_operation_unknown`, as it always has.
|
|
export const AGENT_LAUNCH_PROMPT_UNCONFIRMED_RUNTIME_CAPABILITY =
|
|
'agent.launch.prompt-unconfirmed.v1' as const
|
|
|
|
export const AGENT_LAUNCH_RUNTIME_CAPABILITIES = [
|
|
AGENT_LAUNCH_RUNTIME_CAPABILITY,
|
|
AGENT_LAUNCH_REPLAY_RUNTIME_CAPABILITY,
|
|
AGENT_LAUNCH_REPLAY_REQUIRED_RUNTIME_CAPABILITY,
|
|
AGENT_LAUNCH_PROMPT_CARRY_RUNTIME_CAPABILITY,
|
|
AGENT_LAUNCH_PROMPT_UNCONFIRMED_RUNTIME_CAPABILITY
|
|
] as const
|