zidane 8.2.1 → 8.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acp-cli.js +8 -8
- package/dist/{acp-D7Pr8NGt.js → acp-oYRjlh71.js} +6 -6
- package/dist/{acp-D7Pr8NGt.js.map → acp-oYRjlh71.js.map} +1 -1
- package/dist/acp.d.ts +2 -2
- package/dist/acp.js +1 -1
- package/dist/{agent-DecDtKA_.js → agent-CBQglXtH.js} +9 -379
- package/dist/agent-CBQglXtH.js.map +1 -0
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +1 -1
- package/dist/{builtin-artifact-kinds-B_OEgf8b.js → builtin-artifact-kinds-BmorPkgz.js} +36 -9
- package/dist/builtin-artifact-kinds-BmorPkgz.js.map +1 -0
- package/dist/chat/pure.d.ts +4 -4
- package/dist/chat/pure.js +6 -6
- package/dist/chat.d.ts +4 -4
- package/dist/chat.js +15 -15
- package/dist/{cli-shared-Dx4vmif6.js → cli-shared-E5m_pI8A.js} +2 -2
- package/dist/{cli-shared-Dx4vmif6.js.map → cli-shared-E5m_pI8A.js.map} +1 -1
- package/dist/{client-core-imHuBWV3.d.ts → client-core-EEEX_u6D.d.ts} +24 -5
- package/dist/{client-core-imHuBWV3.d.ts.map → client-core-EEEX_u6D.d.ts.map} +1 -1
- package/dist/{connection-loop-CdHt3iQi.d.ts → connection-loop-CpgfUmuw.d.ts} +3 -3
- package/dist/{connection-loop-CdHt3iQi.d.ts.map → connection-loop-CpgfUmuw.d.ts.map} +1 -1
- package/dist/contexts/daytona.d.ts +1 -1
- package/dist/contexts/e2b.d.ts +1 -1
- package/dist/{credentials-Dti61yoi.js → credentials-B9DfBJP9.js} +11 -7
- package/dist/credentials-B9DfBJP9.js.map +1 -0
- package/dist/daemon-cli.js +2 -2
- package/dist/{dispatcher-vy3J6JMA.js → dispatcher-Bv9-c6I2.js} +28 -14
- package/dist/dispatcher-Bv9-c6I2.js.map +1 -0
- package/dist/{engine-BN6PjWAW.js → engine-XmoPPB6U.js} +5 -5
- package/dist/{engine-BN6PjWAW.js.map → engine-XmoPPB6U.js.map} +1 -1
- package/dist/{eval-BaJtxLCW.js → eval-CfQlBR81.js} +2 -2
- package/dist/{eval-BaJtxLCW.js.map → eval-CfQlBR81.js.map} +1 -1
- package/dist/eval.d.ts +1 -1
- package/dist/eval.js +1 -1
- package/dist/{executor-CT4oUkg6.js → executor-BhthPE1q.js} +3 -3
- package/dist/{executor-CT4oUkg6.js.map → executor-BhthPE1q.js.map} +1 -1
- package/dist/{extensions-BKt7lxxv.js → extensions-BgBwogRW.js} +114 -113
- package/dist/extensions-BgBwogRW.js.map +1 -0
- package/dist/extensions.d.ts +1 -1
- package/dist/extensions.js +2 -2
- package/dist/{fold-rules-BYedvsH7.d.ts → fold-rules-DSypi36k.d.ts} +2 -2
- package/dist/{fold-rules-BYedvsH7.d.ts.map → fold-rules-DSypi36k.d.ts.map} +1 -1
- package/dist/google-O6pRnddf.js +881 -0
- package/dist/google-O6pRnddf.js.map +1 -0
- package/dist/{headless-Ebd1ZEzC.js → headless-R4pbpTkm.js} +3 -3
- package/dist/{headless-Ebd1ZEzC.js.map → headless-R4pbpTkm.js.map} +1 -1
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +1 -1
- package/dist/{host-scoped-settings-Cy_zbmB_.js → host-scoped-settings-C-Nmb6vr.js} +2 -2
- package/dist/{host-scoped-settings-Cy_zbmB_.js.map → host-scoped-settings-C-Nmb6vr.js.map} +1 -1
- package/dist/{host-signals-Cx2IAbHh.js → host-signals-BFudPyCT.js} +5 -5
- package/dist/{host-signals-Cx2IAbHh.js.map → host-signals-BFudPyCT.js.map} +1 -1
- package/dist/{index-pc71ADi6.d.ts → index-AqRZ3gEz.d.ts} +71 -4
- package/dist/index-AqRZ3gEz.d.ts.map +1 -0
- package/dist/{index-Bt_G2Z_2.d.ts → index-CDS7YdUC.d.ts} +5 -5
- package/dist/{index-Bt_G2Z_2.d.ts.map → index-CDS7YdUC.d.ts.map} +1 -1
- package/dist/{index-CidMTcxS.d.ts → index-DyQyDLX1.d.ts} +167 -10
- package/dist/index-DyQyDLX1.d.ts.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +15 -15
- package/dist/ipc/remote.d.ts +5 -5
- package/dist/ipc/remote.js +3 -3
- package/dist/ipc.d.ts +5 -5
- package/dist/ipc.js +7 -7
- package/dist/{links-DSZ4uQ5w.js → links-rFaWqS2Y.js} +10 -10
- package/dist/{links-DSZ4uQ5w.js.map → links-rFaWqS2Y.js.map} +1 -1
- package/dist/{mcp-allowlist-BQ5MvhHi.js → mcp-allowlist-CLXweyxk.js} +14 -3
- package/dist/mcp-allowlist-CLXweyxk.js.map +1 -0
- package/dist/mcp.d.ts +1 -1
- package/dist/{oauth-BSqXgads.js → oauth-7_48zR7n.js} +226 -40
- package/dist/oauth-7_48zR7n.js.map +1 -0
- package/dist/{openai-dTmPxM6T.js → openai-Rh6u5NXF.js} +121 -2
- package/dist/openai-Rh6u5NXF.js.map +1 -0
- package/dist/{openrouter-CtZbQDa0.js → openrouter-Dg0yaI-o.js} +91 -2
- package/dist/openrouter-Dg0yaI-o.js.map +1 -0
- package/dist/output/stream-json.d.ts +1 -1
- package/dist/output/terminal.d.ts +1 -1
- package/dist/plugins.d.ts +1 -1
- package/dist/{presets-EzlHyFSi.js → presets-DXeHsd24.js} +3 -3
- package/dist/{presets-EzlHyFSi.js.map → presets-DXeHsd24.js.map} +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/presets.js +1 -1
- package/dist/{prompts-D2lPHLOV.d.ts → prompts-DmY13jvF.d.ts} +2 -1
- package/dist/prompts-DmY13jvF.d.ts.map +1 -0
- package/dist/protocol-BIv1Yuvl.js.map +1 -1
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/arcee.d.ts +1 -1
- package/dist/providers/baseten.d.ts +1 -1
- package/dist/providers/cerebras.d.ts +1 -1
- package/dist/providers/google.d.ts +1 -1
- package/dist/providers/google.js +1 -784
- package/dist/providers/local.d.ts +1 -1
- package/dist/providers/neuralwatt.d.ts +1 -1
- package/dist/providers/openai-compat.d.ts +1 -1
- package/dist/providers/openai.d.ts +1 -1
- package/dist/providers/openai.js +1 -1
- package/dist/providers/openrouter.d.ts +1 -1
- package/dist/providers/openrouter.js +1 -1
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers/xai.js +1 -101
- package/dist/providers.d.ts +2 -2
- package/dist/providers.js +6 -5
- package/dist/{registry-BBaEgTsX.js → registry-eourRLY2.js} +3 -3
- package/dist/{registry-BBaEgTsX.js.map → registry-eourRLY2.js.map} +1 -1
- package/dist/{remote-hosts-bO7wOt44.js → remote-hosts-DY2J07ut.js} +4 -4
- package/dist/{remote-hosts-bO7wOt44.js.map → remote-hosts-DY2J07ut.js.map} +1 -1
- package/dist/restate.d.ts +1 -1
- package/dist/{secret-shapes-Cda65uDH.js → secret-shapes-BjW4l6U0.js} +17 -3
- package/dist/secret-shapes-BjW4l6U0.js.map +1 -0
- package/dist/session/sqlite.d.ts +1 -1
- package/dist/{session-factory-BazyVdzj.js → session-factory-CMwIXE-7.js} +5 -5
- package/dist/{session-factory-BazyVdzj.js.map → session-factory-CMwIXE-7.js.map} +1 -1
- package/dist/session.d.ts +1 -1
- package/dist/{settings-keys-zYaer8DY.js → settings-keys-CPdmkTz7.js} +3 -3
- package/dist/{settings-keys-zYaer8DY.js.map → settings-keys-CPdmkTz7.js.map} +1 -1
- package/dist/{shell-path-od9XHRPt.js → shell-path-B8b3EOtK.js} +3 -3
- package/dist/{shell-path-od9XHRPt.js.map → shell-path-B8b3EOtK.js.map} +1 -1
- package/dist/{skills-use-D68a1gyZ.js → skills-use-CssTEaIj.js} +375 -2
- package/dist/skills-use-CssTEaIj.js.map +1 -0
- package/dist/skills.d.ts +1 -1
- package/dist/store-L01W0gGI.js.map +1 -1
- package/dist/{system-freeze-DXvJpveP.js → system-freeze-Um9ZJiPo.js} +24 -9
- package/dist/system-freeze-Um9ZJiPo.js.map +1 -0
- package/dist/{todo-edits-CmqNFvLJ.js → todo-edits-BERpCRPj.js} +3 -3
- package/dist/{todo-edits-CmqNFvLJ.js.map → todo-edits-BERpCRPj.js.map} +1 -1
- package/dist/tools/fetch-url.d.ts +1 -1
- package/dist/tools/prompts.d.ts +1 -1
- package/dist/tools/prompts.js +7 -0
- package/dist/tools/prompts.js.map +1 -1
- package/dist/tools/web-search.d.ts +1 -1
- package/dist/{tools-9Dpm8F-f.js → tools-pZVFIJ_K.js} +273 -2
- package/dist/tools-pZVFIJ_K.js.map +1 -0
- package/dist/tools.d.ts +3 -3
- package/dist/tools.js +4 -4
- package/dist/{transcript-anchors-B3TFJqr_.js → transcript-anchors-jHrg-r-H.js} +10 -10
- package/dist/{transcript-anchors-B3TFJqr_.js.map → transcript-anchors-jHrg-r-H.js.map} +1 -1
- package/dist/{transcript-reconcile-BC2DbTmp.js → transcript-reconcile-CPdrNbbR.js} +19 -2
- package/dist/{transcript-reconcile-BC2DbTmp.js.map → transcript-reconcile-CPdrNbbR.js.map} +1 -1
- package/dist/tui.d.ts +7 -7
- package/dist/tui.js +25 -23
- package/dist/tui.js.map +1 -1
- package/dist/{turn-operations-CIFoOebZ.d.ts → turn-operations-DuGtKuc_.d.ts} +10 -3
- package/dist/turn-operations-DuGtKuc_.d.ts.map +1 -0
- package/dist/{types-iFLlZKd0.d.ts → types-C0PJmBaO.d.ts} +2 -2
- package/dist/{types-iFLlZKd0.d.ts.map → types-C0PJmBaO.d.ts.map} +1 -1
- package/dist/types-JzccL5GE.js +24 -0
- package/dist/types-JzccL5GE.js.map +1 -0
- package/dist/types.d.ts +2 -2
- package/dist/{url-BTH-HE9Y.js → url-D8KZ7Edw.js} +2 -2
- package/dist/{url-BTH-HE9Y.js.map → url-D8KZ7Edw.js.map} +1 -1
- package/dist/{version-4T82xRxQ.js → version-bd3DQJkc.js} +2 -2
- package/dist/{version-4T82xRxQ.js.map → version-bd3DQJkc.js.map} +1 -1
- package/dist/wire-DH77Z-rr.js +80 -0
- package/dist/wire-DH77Z-rr.js.map +1 -0
- package/dist/{workspace-exec-stream-By8na6vz.js → workspace-exec-stream-CyfYgqAh.js} +4 -4
- package/dist/{workspace-exec-stream-By8na6vz.js.map → workspace-exec-stream-CyfYgqAh.js.map} +1 -1
- package/dist/{write-file-B4vi3SvQ.js → write-file-QYrcDdl3.js} +3 -3
- package/dist/{write-file-B4vi3SvQ.js.map → write-file-QYrcDdl3.js.map} +1 -1
- package/dist/{ws-CS312Jpx.js → ws-CURQ2igk.js} +5 -5
- package/dist/{ws-CS312Jpx.js.map → ws-CURQ2igk.js.map} +1 -1
- package/dist/{ws-client-wWka-Jku.js → ws-client-BVljYbdb.js} +3 -3
- package/dist/{ws-client-wWka-Jku.js.map → ws-client-BVljYbdb.js.map} +1 -1
- package/dist/xai-CStTwCV2.js +182 -0
- package/dist/xai-CStTwCV2.js.map +1 -0
- package/docs/ARCHITECTURE.md +1 -0
- package/docs/ARTIFACTS.md +1 -1
- package/docs/EXTENSIONS.md +9 -5
- package/package.json +2 -2
- package/dist/agent-DecDtKA_.js.map +0 -1
- package/dist/builtin-artifact-kinds-B_OEgf8b.js.map +0 -1
- package/dist/credentials-Dti61yoi.js.map +0 -1
- package/dist/dispatcher-vy3J6JMA.js.map +0 -1
- package/dist/extensions-BKt7lxxv.js.map +0 -1
- package/dist/index-CidMTcxS.d.ts.map +0 -1
- package/dist/index-pc71ADi6.d.ts.map +0 -1
- package/dist/mcp-allowlist-BQ5MvhHi.js.map +0 -1
- package/dist/oauth-BSqXgads.js.map +0 -1
- package/dist/openai-dTmPxM6T.js.map +0 -1
- package/dist/openrouter-CtZbQDa0.js.map +0 -1
- package/dist/prompts-D2lPHLOV.d.ts.map +0 -1
- package/dist/providers/google.js.map +0 -1
- package/dist/providers/xai.js.map +0 -1
- package/dist/secret-shapes-Cda65uDH.js.map +0 -1
- package/dist/skills-use-D68a1gyZ.js.map +0 -1
- package/dist/system-freeze-DXvJpveP.js.map +0 -1
- package/dist/tools-9Dpm8F-f.js.map +0 -1
- package/dist/turn-operations-CIFoOebZ.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol-BIv1Yuvl.js","names":[],"sources":["../src/ipc/protocol.ts"],"sourcesContent":["/**\n * zidane/ipc wire protocol — the transport-agnostic contract between a chat\n * host (the process that owns live `Agent` instances) and its clients (GUI\n * renderer, TUI window, `zidane attach`, …).\n *\n * The host-domain shapes (the `HostSignal` push union and everything it\n * carries) live in `src/chat/host/signals.ts` — the host must not depend on\n * `src/ipc/**`. This module re-exports them unchanged and adds the\n * transport-only contract: the typed JSON-RPC method map, session rows, and\n * the daemon handshake.\n *\n * Everything in this file is JSON-serializable: it must survive Electron's\n * structured clone AND a JSON-RPC socket hop unchanged. Canonical agent\n * types (`StreamEvent`, `InteractionRequest`, …) are re-used where they are\n * already wire-safe; host-only shapes (live `resolve` callbacks, `Map`s)\n * never appear here.\n *\n * Versioning: bump `IPC_PROTOCOL_VERSION` on any breaking change to the\n * signal union or the method map. The daemon handshake refuses mismatched\n * peers so a stale daemon never talks to an upgraded client (see\n * `daemon/lifecycle.ts`).\n */\nimport type { BrowserResponse } from '../chat/browser/protocol'\nimport type { CommandOutputBlock } from '../chat/commands'\nimport type { EnvironmentActionResult, EnvironmentActionSummary, EnvironmentRequest, EnvironmentTeardownResult, EnvironmentVerifyResult } from '../chat/environment'\nimport type { EnvironmentDescriptor, EnvironmentSettingsChange } from '../chat/environment-settings'\nimport type { CompactionReport } from '../chat/host/compaction'\nimport type { CacheImpact, CacheImpactChange, CacheReport, ContextSegmentsReport, WorkspaceListFilesOptions } from '../chat/host/engine'\nimport type { SessionLaunchOverrides } from '../chat/host/launch-overrides'\nimport type {\n CreateWorkerParams as OrchestrationCreateWorkerParams,\n WorkerRow as OrchestrationWorkerRow,\n WorkerSummary as OrchestrationWorkerSummary,\n} from '../chat/host/orchestration'\nimport type {\n CommandArgSuggestionSummary,\n CommandSummary,\n HostSettings,\n HostSignal,\n PendingInteraction,\n PromptAttachment,\n QueuedItem,\n RunningWorkItem,\n SendOptions,\n SessionPresence,\n TodosSnapshot,\n WireApprovalRequest,\n} from '../chat/host/signals'\nimport type {\n ApprovalDecision,\n ContextBreakdown,\n InteractionResponse,\n ProviderKey,\n SearchTurnResult,\n SessionEnvironmentSummary,\n SessionHeader,\n SessionHistoryMatch,\n SessionMeta,\n StreamEvent,\n SystemMdFile,\n TodoItem,\n} from '../chat/index'\nimport type { MachineInfo, MachineLinksStatus, MachineRegisterParams } from '../chat/machine-protocol'\nimport type { SyncCategory, SyncClaimResult, SyncPayload, SyncPushResult, SyncStatus } from '../chat/sync/types'\nimport type { TerminalAdoptResult, TerminalAttachResult, TerminalInfo, TerminalOpenInput, TerminalProjectOpenInput, TerminalProjectState, TerminalProjectStateInput, TerminalSessionState } from '../chat/terminal/protocol'\nimport type { ExecResult, ListFilesEntry } from '../contexts/types'\nimport type { SessionArtifact } from '../session/artifacts'\nimport type { SessionData } from '../session/index'\nimport type { JsonValue, McpServerConfig, SessionTurn, ThinkingLevel } from '../types'\nimport { isMethodNotFound } from '../chat/hosts/connection'\n\nexport type {\n ApprovalOriginator,\n CommandArgSuggestionSummary,\n CommandSummary,\n HostSettings,\n HostSignal,\n PendingInteraction,\n PromptAttachment,\n QueuedItem,\n RunningWorkItem,\n SendOptions,\n SerializedPreview,\n SessionPresence,\n TodosSnapshot,\n WireApprovalRequest,\n} from '../chat/host/signals'\n\n/** The machine protocol (`docs/MACHINES.md`), versioned on its own (`MACHINE_PROTOCOL_VERSION`). */\nexport {\n isValidMachineName,\n MACHINE_HOST_METHODS,\n MACHINE_IDEMPOTENT_METHODS,\n MACHINE_PROTOCOL_VERSION,\n MachineErrorCode,\n machineKind,\n parseMachineKind,\n} from '../chat/machine-protocol'\nexport type {\n MachineCapabilities,\n MachineHandleRef,\n MachineInfo,\n MachineMethodName,\n MachineMethods,\n MachineNotifications,\n MachineParams,\n MachineRegisterParams,\n MachineRegisterResult,\n MachineResult,\n MachineRoot,\n MachineStatusChange,\n} from '../chat/machine-protocol'\n\n/**\n * Changes since v5. Entries marked additive, or \"no version bump\", did\n * not raise the version. The current version is `IPC_PROTOCOL_VERSION`.\n *\n * - `event` signals carry an optional `echo` flag marking host-generated\n * SEND/STEER echoes of the user's own message.\n * - `chat.pushQueued` result gained the `'queued'` delivered variant.\n * - `sessions.setModel` now honors `fallbacks`: it persists the canonical\n * `metadata.modelChain` and CLEARS a previously persisted chain when\n * omitted/empty. It also accepts `effort` / `modelOptions` and resets\n * both when omitted (a pick is atomic — no stale per-model knobs).\n * - additive: `extension.emit` notification + `extension:signal` fan-out\n * (the permission-gated per-extension cross-window bus, `ctx.bus`).\n * Older daemons ignore the unknown notification; older clients drop the\n * unknown signal kind — no version bump needed.\n * - additive: `extension.emit` / `extension:signal` carry an optional\n * `nonce` (the emitter's per-process random id) so receivers dedupe on\n * `(extensionId, nonce, seq)` instead of the collision-prone\n * `(extensionId, seq)`. Older peers omit it and fall back to the\n * seq-only key — no version bump needed.\n * - `SessionRow.modelFallbacks` is now populated from the session's\n * persisted `metadata.modelChain`.\n * - Default socket path moved from `<stateDir>/daemon.sock` to the\n * dedicated `<stateDir>/daemon/daemon.sock` (dir chmod'd 0700) so the\n * daemon can harden its socket dir without touching shared state files.\n * - ADDITIVE (no version bump — older daemons answer \"method not\n * found\", clients degrade to local compute): `suggest.resolve` RPC\n * resolves inline ghost-text autocomplete daemon-side, and the\n * `suggest:changed` signal fans the result out to every OTHER peer\n * on the session so mirroring windows paint the same ghost without\n * recomputing.\n * - ADDITIVE (no version bump — optional field, older daemons simply\n * omit it and clients fall back to the single `suggestion`):\n * `suggest.resolve` results and `suggest:changed` signals carry the\n * resolver's full ordered `candidates` list so daemon mode keeps\n * ↑/↓ candidate rotation instead of degrading to one suggestion.\n * - ADDITIVE (no version bump — `optional()` swallows \"method not\n * found\" on an older daemon, which then simply keeps its stale\n * registries as before): `runtime.reload` RPC drops the daemon's\n * cached extension registries and retires live agents after a window\n * reloaded its extensions.\n * - ADDITIVE (no version bump): `terminal.registerViewer` /\n * `terminal.unregisterViewer`. The desktop app registers as a client that\n * can show terminals; agents only get terminal tools while one is\n * attached. An older daemon answers \"method not found\" (and keeps giving\n * every agent the tools, as before); an older desktop app on a newer\n * daemon never registers, so its agents run without terminal tools.\n * - ADDITIVE (no version bump): project / draft terminals\n * (docs/PROJECT-SCOPE-AUDIT.md): `terminal.projectState`,\n * `terminal.openInProject`, `terminal.adopt`, `terminal.releaseDraft`,\n * the `terminal:project-changed` signal, and `HelloResult.projectTerminals`.\n * An older daemon answers \"method not found\" and omits the flag; clients\n * then offer terminals only in sessions.\n * - ADDITIVE (no version bump): `queue.attachments` returns a queued\n * entry's attachments with their bytes, and `queue.update` accepts\n * `attachments` to replace them. An older daemon answers \"method not\n * found\" / ignores the field: the entry's attachments stay as queued.\n * - ADDITIVE (no version bump): `chat.steer` / `chat.followUp` resolve to\n * whether the message reached a live run. Older daemons resolve `null`,\n * which clients treat as delivered (the pre-existing behavior).\n * - ADDITIVE (no version bump): `sessions.fork`, `sessions.deleteTurn`,\n * `sessions.editTurnText`, `sessions.setFolder`, `sessions.appendTurns`,\n * `sessions.rewind`.\n * History and folder edits run in the host instead of being written to\n * the store by the client (then `sessions.touch` + `chat.rebuildAgent`).\n * Older clients keep the old path, which still works on a shared disk.\n * A newer client only meets an older daemon while it retires (the\n * release fence drains it otherwise), and then gets \"method not found\".\n * - ADDITIVE (no version bump): `sessions.listMeta`, `sessions.getMeta`,\n * `sessions.get`, `sessions.setExtensionState` serve a client the\n * session data it used to read and write in its own store, so a window\n * on another machine sees the host's sessions. `sessions.create` accepts `effort`, `modelOptions` and\n * `pinnedSkills`; `todos.set` accepts `persistIdle`. An older host answers\n * \"method not found\" / ignores the fields: a window falls back to the\n * store it shares with a local daemon, and refuses a remote host.\n * - ADDITIVE (no version bump): `daemon.info` reports `activeWork` (a run,\n * compaction, `/` command or background task in flight). An older host\n * omits it; `zidane server wait-idle` then says it can't tell.\n * - ADDITIVE (no version bump): `sessions.loadEvents` paging accepts\n * `beforeTurnId` (the page ends right before that turn, winning over\n * `before`; an unknown turn is invalid params) and the page echoes it.\n * An older host ignores the param and omits the echo, which is how a\n * client tells.\n * - ADDITIVE (no version bump): `sessions.cacheImpact` and\n * `sessions.cacheReport`. An older host answers \"method not found\":\n * pickers show no cache estimate and session details no Cache section.\n */\nexport const IPC_PROTOCOL_VERSION = 13\n\n/**\n * JSON-RPC error codes specific to the zidane daemon. Lives here (not in\n * `daemon/server.ts`) so clients can import the codes without pulling the\n * server's module graph.\n */\nexport const IpcErrorCode = {\n VersionMismatch: -32010,\n NotHandshaken: -32011,\n /** A network transport's per-connection request budget is spent; retry later. */\n RateLimited: -32012,\n /**\n * The reply would exceed the transport's message size: nothing was sent\n * but this error (the connection stays). Ask for less (a transcript: a\n * smaller page, see {@link loadAllEvents}).\n */\n ResponseTooLarge: -32013,\n /**\n * The handler threw: the host refused or failed the call (`message` says\n * why). Hosts before it answered -32000, which ACP uses for\n * `AuthenticationRequired`; clients treat both as a plain remote error.\n */\n HandlerFailed: -32014,\n} as const\n\n/**\n * Client heartbeat request (`{}` → `{}`), outside the method table: every\n * host answers it, before the handshake too. A host predating it answers\n * \"method not found\", which still proves it alive.\n */\nexport const PING_METHOD = '$/ping'\n\n/**\n * Session-scoped signals fanned out to every peer carry their number in\n * their session as this extra field on the `ipc.signal` params (clients\n * predating it ignore it; `IpcClient` strips it and hands it to listeners as\n * {@link SignalMeta}). Per session, from 1, gap-free within one host process.\n */\nexport const SIGNAL_SEQ_FIELD = '$seq'\n\n/** What a signal listener gets beside the signal: its number in its session, when it has one. */\nexport interface SignalMeta {\n /** Position of the signal in its session. Starts at 1 and has no gaps within one host process. */\n seq: number\n}\n\n/** A session signal with its position in the session, as kept in the host's replay log. */\nexport interface SequencedSignal {\n /** Position of the signal in its session. */\n seq: number\n /** The signal itself. */\n signal: HostSignal\n}\n\n/** Result of `sessions.resume`. On success, the signals the client missed after its last position. Otherwise the reason it must reload instead. */\nexport type SessionResumeResult\n = | { ok: true, signals: SequencedSignal[] }\n /** `epoch`: another host process numbered them. `gap`: the log no longer covers the position. */\n | { ok: false, reason: 'epoch' | 'gap' }\n\n/* -------------------------------------------------------------------------\n * Request/response methods (client → host)\n * ---------------------------------------------------------------------- */\n\n/**\n * Typed method map for the daemon transport. Keys are JSON-RPC method\n * names; each entry pins params/result so both the daemon dispatch table\n * and the client proxy are checked against the same contract.\n *\n * Scope: the chat core every client needs. Host-UI-specific surfaces\n * (folder pickers, themes, keybindings) intentionally stay client-local.\n */\nexport interface IpcMethods {\n /** `wake` is host-internal (see `SendOptions.wake`) — not accepted over the wire. */\n 'chat.send': { params: Omit<SendOptions, 'wake'>, result: { runId: string } }\n /** Aborts the session's live run. Does nothing when no run is live. */\n 'chat.interrupt': { params: { sessionId: string }, result: void }\n /** `true` when the message reached a live run; `false` when nothing was running (it was not delivered). */\n 'chat.steer': { params: { sessionId: string, message: string }, result: boolean }\n /** Adds a follow-up message to the live run. Resolves `true` when a run was live to take it, `false` when nothing was running and the message was dropped, not queued. */\n 'chat.followUp': { params: { sessionId: string, message: string }, result: boolean }\n /** Delivers a queued message. Steers a live run, otherwise starts a run or runs it as a command. `delivered` says which path it took. `keepDraft` keeps the shared composer draft instead of clearing it on the other clients. */\n 'chat.pushQueued': {\n params: { sessionId: string, message: string, activatedSkills?: string[], keepDraft?: boolean }\n result: { delivered: 'steer' | 'send' | 'command' | 'queued' }\n }\n /** Resolves `true` while the session has a live run. */\n 'chat.isRunning': { params: { sessionId: string }, result: boolean }\n /**\n * Retire the session's live agent so the next run rebuilds against\n * fresh config/credentials (MCP login, extension reload). Run-end\n * deferred when a run is in flight; HITL/queue state survives.\n */\n 'chat.rebuildAgent': { params: { sessionId: string }, result: void }\n /**\n * `zidane run --system / --mcp` for a host-backed window: launch overrides\n * for the session's agent (`ChatHost.setLaunchOverrides`), owned by the\n * calling client and dropped when it disconnects. A call with neither field clears them.\n */\n 'sessions.setLaunchOverrides': { params: { sessionId: string } & SessionLaunchOverrides, result: void }\n /**\n * Drop the daemon's cached runtime configs (extension registries, per\n * cwd) and retire every live agent so the next command or run rebuilds\n * against what is on disk now. Sent by a window after it reloaded its\n * own extensions (install, update, remove, `/reload`): extension `/`\n * commands execute daemon-side, so without this the daemon keeps\n * running the code it loaded at boot. Busy sessions rebuild at run end.\n */\n 'runtime.reload': { params: Record<string, never>, result: void }\n /**\n * Lists the tool calls and background tasks the session's live run tracks\n * and can cancel. Empty when no run is live. `children: true` adds the\n * subagents' running calls (`childId` set), for their starts: a\n * transcript read from disk times them too. Older hosts ignore it.\n */\n 'chat.listWork': { params: { sessionId: string, children?: boolean }, result: RunningWorkItem[] }\n /** Cancels one tracked work item by `id`, or every visible item with `\"all\"`. Resolves `true` when something was cancelled. `reason` is passed to a cancelled tool call. */\n 'chat.cancelWork': { params: { sessionId: string, id: string | 'all', reason?: string }, result: boolean }\n\n /** Lists session rows. `projectRoot` filters by project, `archive` picks active, archived or all sessions. */\n 'sessions.list': { params: { projectRoot?: string | null, archive?: 'active' | 'archived' | 'all' }, result: SessionRow[] }\n /**\n * The session list as a window renders it (`SessionMeta`: title, turn /\n * message / run counts, project, cwd, environment, artifact count, the\n * orchestration main flag), newest first. `projectRoot`: omitted = every\n * project, `null` = untagged sessions.\n */\n 'sessions.listMeta': { params: { projectRoot?: string | null }, result: SessionMeta[] }\n /** One `SessionMeta` by id (rows a filtered list can't return, e.g. the main); `null` when unknown. */\n 'sessions.getMeta': { params: { sessionId: string }, result: SessionMeta | null }\n /**\n * The whole session document as the host holds it: the live copy when an\n * agent is live (turns persisted mid-run, todos kept in memory), else the\n * stored one, a stale `running` marker demoted. `null` when unknown.\n */\n 'sessions.get': { params: { sessionId: string, turns?: boolean }, result: SessionDocumentHead | null }\n /**\n * A slice of a session's turns, `[from, from + limit)` (default from 0,\n * {@link SESSION_TURNS_PAGE} turns, at most {@link SESSION_TURNS_MAX_PAGE}),\n * from the same copy `sessions.get` reads, and how many turns it has: a\n * client reads a long session's document a page at a time\n * ({@link loadSessionDocument}) instead of in one reply. With\n * `sessions.get` `turns: false` (the document without its turns), what an\n * export needs. Pages and that head come from one snapshot of the\n * document per content version (read once, not per page), and name it\n * (`version`): a client that sees it change mid-load starts over rather\n * than mix two versions ({@link loadSessionDocument}). `null` when\n * unknown. Additive: an older host answers \"method not found\", ignores\n * `turns: false`, and names no version.\n */\n 'sessions.getTurns': { params: { sessionId: string, from?: number, limit?: number }, result: { turns: SessionTurn[], total: number, version?: string } | null }\n /**\n * The full text of one tool result (`callId`; `turnId`, when known, the\n * turn that holds it): what a clipped tool row shows on expand, without\n * the session crossing the wire. `null` when no such result. Additive.\n */\n 'sessions.getToolResult': { params: { sessionId: string, callId: string, turnId?: string }, result: string | null }\n /**\n * One session's header: its list row plus metadata, profile and status,\n * without turns or runs (the live copy when an agent holds it). What a\n * window re-reads on `sessions:changed`. Additive. `usage: true` adds the\n * footer's numbers, computed host-side from the turns and runs\n * (`contextTokens`, `costUsd`, and while the host runs the session\n * `runStartedAt` / `runOutputTokens`): a client needs no document for its\n * context gauge, cost pill or run readout. Older hosts ignore it.\n */\n 'sessions.getHeader': { params: { sessionId: string, usage?: boolean }, result: SessionHeader | null }\n /**\n * One key of an extension's per-session state (`metadata.extensions`, the\n * bag `ctx.session` and renderer `useSessionState` share), written by the\n * host into its copy of the session. `value` omitted deletes the key.\n */\n 'sessions.setExtensionState': { params: { sessionId: string, extension: string, key: string, value?: JsonValue }, result: void }\n /** Creates a session and resolves with its row. */\n 'sessions.create': { params: CreateSessionParams, result: SessionRow }\n /** Resolves with what happened to the session's environment (a provider may keep it). */\n 'sessions.delete': { params: { sessionId: string }, result: { environment?: EnvironmentTeardownResult } }\n /** Provision a failed (or restart-stranded) environment again. */\n 'sessions.retryEnvironment': { params: { sessionId: string }, result: void }\n /** The per-session commands the session's environment offers right now (push, open PR, …). */\n 'sessions.environmentActions': { params: { sessionId: string }, result: EnvironmentActionSummary[] }\n /** Run one of them in the session's environment (resumed when suspended). */\n 'sessions.runEnvironmentAction': { params: { sessionId: string, actionId: string }, result: EnvironmentActionResult }\n /**\n * The session's workspace (`ChatHost.workspace*`): its execution context,\n * rooted inside the environment when the files live there, else at the\n * session's cwd. Paths and exec `cwd` resolve against the root as the\n * execution context resolves them; containment is the context's own.\n * `cwd` / `env` on exec and the list / size methods are additive: an\n * older daemon ignores the former and answers \"method not found\" to the\n * latter (active clients are build-fenced, so this is a transient case).\n */\n 'sessions.workspaceExec': { params: { sessionId: string, command: string, cwd?: string, env?: Record<string, string>, timeoutSeconds?: number }, result: ExecResult }\n /**\n * The same command, streamed (`!` on a remote host): the reply names the\n * exec, its output follows as `workspace:exec:data` signals and ends with\n * one `workspace:exec:exit`, all to this connection only (signals may\n * precede the reply). Bounded per connection (concurrent commands, chunk\n * size, total output: past it the process is stopped and the exit says\n * `truncated`). A dropped connection kills what it started. Additive: an\n * older host answers \"method not found\" and clients use `workspaceExec`.\n */\n 'sessions.workspaceExecStream': { params: { sessionId: string, command: string, cwd?: string }, result: { execId: string } }\n /** Kill a streamed command's process group (this connection's only; `cancelled: false` otherwise or when it already ended). */\n 'sessions.workspaceExecCancel': { params: { execId: string }, result: { cancelled: boolean } }\n /** Reads a text file from the session's workspace. */\n 'sessions.workspaceReadFile': { params: { sessionId: string, path: string }, result: string }\n /** Writes a text file in the session's workspace. */\n 'sessions.workspaceWriteFile': { params: { sessionId: string, path: string, content: string }, result: void }\n /** Lists the entries under `path` in the session's workspace. */\n 'sessions.workspaceListFiles': { params: { sessionId: string, path: string, options?: WorkspaceListFilesOptions }, result: ListFilesEntry[] }\n /** Size in bytes of a file in the session's workspace, or `null` when it does not exist. */\n 'sessions.workspaceFileSize': { params: { sessionId: string, path: string }, result: number | null }\n /**\n * Every environment kind the host can create, described for a new session\n * in `cwd` (availability, default, branch suggestion, options — secrets\n * only as \"configured\"). What pickers and the Environments settings render.\n * `kind`: a machine kind (`local@laptop`) says `cwd` is that machine's\n * folder, checked against its roots instead of this host's\n * (`docs/MACHINES.md` § Folders); the same on `commands.*`, `catalog.*`\n * and `models.list`. Additive.\n */\n 'environments.list': { params: { cwd?: string, kind?: string }, result: EnvironmentDescriptor[] }\n /**\n * Apply one Environments-settings edit (enable, default, options,\n * secrets), validated against the kind's schema. Settings changes fan out\n * as `settings:changed`; secrets are stored host-side and never returned.\n */\n 'environments.update': { params: EnvironmentSettingsChange, result: void }\n /** \"Test connection\" for a kind with its current options. */\n 'environments.verify': { params: { kind: string }, result: EnvironmentVerifyResult }\n /** Renames a session. */\n 'sessions.setTitle': { params: { sessionId: string, title: string }, result: void }\n /**\n * Title the session ON the host: its providers and credentials (a server\n * session's transcript never goes to the window's provider), the same\n * generator (`generateSessionTitle`), written as `sessions.setTitle` does.\n * `providerKey` / `model`: the window's pick, used when the host has that\n * provider; otherwise the session's own provider and model. The Main\n * session is refused (it keeps its name). Additive: an older host answers\n * \"method not found\".\n */\n 'sessions.generateTitle': { params: { sessionId: string, providerKey?: string, model?: string }, result: { title: string } }\n /** Archives or restores a session. */\n 'sessions.setArchived': { params: { sessionId: string, archived: boolean }, result: void }\n /** Keep the session at the top of lists (`metadata.favorite`). Not activity: no recency bump. Additive. */\n 'sessions.setFavorite': { params: { sessionId: string, favorite: boolean }, result: void }\n /** Move the session to a space (`metadata.spaceId`); the Default space id clears it. See `chat/spaces`. */\n 'sessions.setSpace': { params: { sessionId: string, spaceId: string }, result: void }\n /** Switches the agent the session runs as. */\n 'sessions.setAgentId': { params: { sessionId: string, agentId: string }, result: void }\n /** Sets the thinking effort of the session. */\n 'sessions.setEffort': { params: { sessionId: string, effort: ThinkingLevel }, result: void }\n /**\n * The one model-swap contract (`ChatHost.setSessionModel`). A pick is a\n * whole: `fallbacks` (ordered, primary excluded) REPLACES the persisted\n * `metadata.modelChain` (omitted/empty clears it); `effort` and\n * `modelOptions` are reset to the supplied values (omitted clears them —\n * per-model knobs never leak onto the new model). The live agent is\n * retired so the next run rebuilds on the new pick (run-end deferred\n * while a run is in flight).\n */\n 'sessions.setModel': {\n params: {\n sessionId: string\n providerKey: ProviderKey\n modelId: string\n /** The stored account of the provider to run on (credential id); omitted = its active account. Additive. */\n account?: string\n fallbacks?: ModelFallbackRef[]\n effort?: ThinkingLevel\n modelOptions?: Record<string, boolean>\n }\n result: void\n }\n /** Replaces the model-specific boolean options of the session. */\n 'sessions.setModelOptions': { params: { sessionId: string, options: Record<string, boolean> }, result: void }\n /**\n * The session's transcript as canonical events. Without `before` / `limit`:\n * every turn, as a plain array (the shape every client predating paging\n * reads). With either: one page, `{ events, cursor? }`, the last `limit`\n * turns (default {@link LOAD_EVENTS_PAGE_TURNS}, at most\n * {@link LOAD_EVENTS_MAX_PAGE_TURNS}) before turn position `before`\n * (default: the end), its start moved back to an exchange boundary when one\n * is near so a tool call is never cut from its result. `cursor`: the\n * `before` of the previous page, absent at the first turn. Typed here as\n * the unpaged call every client makes; a paged call goes through\n * {@link loadEventsPage}. Paging is additive: an older host ignores the\n * fields and answers the whole array.\n */\n 'sessions.loadEvents': { params: { sessionId: string }, result: StreamEvent[] }\n /**\n * Reattach without a reload: the session's signals numbered after\n * `afterSeq` (see {@link SIGNAL_SEQ_FIELD}), in order, as long as this host\n * process (`epoch`, from `HelloResult.signalEpoch`) still holds them all.\n * Otherwise refused, and the client reloads with `sessions.loadEvents`.\n * Additive: an older host answers \"method not found\", same fallback.\n */\n 'sessions.resume': { params: { sessionId: string, epoch: string, afterSeq: number }, result: SessionResumeResult }\n /** One turn of a session by id, or `null` when unknown. */\n 'sessions.getTurn': { params: { sessionId: string, turnId: string }, result: SessionTurn | null }\n /** The session's context usage broken down by category, or `null` when unknown. */\n 'sessions.contextBreakdown': { params: { sessionId: string }, result: ContextBreakdown | null }\n /**\n * Artifacts one session recorded (PRs, branches, commits, files,\n * extension kinds — see `session/artifacts.ts`), newest first. Empty on\n * stores without artifact support. Additive; pre-artifact daemons\n * reject the method and clients treat that as empty.\n */\n 'sessions.artifacts': { params: { sessionId: string, kind?: string, limit?: number }, result: SessionArtifact[] }\n /**\n * Artifacts across sessions, filtered by project root (`null` = untagged\n * sessions, omitted = every project) and/or kind/uri (reverse lookup).\n */\n 'artifacts.list': { params: { projectRoot?: string | null, kind?: string, uri?: string, since?: number, limit?: number }, result: SessionArtifact[] }\n /** Remove one artifact. `false` when the store has no artifact support. Fans out `artifact:changed`. */\n 'artifacts.delete': { params: { sessionId: string, artifactId: string }, result: boolean }\n /**\n * Upsert an artifact — the lazy `resolve()` write-back (refreshed\n * `label` / `meta`). Same merge semantics as `SessionStore.upsertArtifact`;\n * `null` when the session is unknown or the store lacks support.\n */\n 'artifacts.upsert': { params: { artifact: SessionArtifact }, result: SessionArtifact | null }\n /**\n * Transcript search over ONE session, daemon-side. The daemon owns the\n * authoritative turns (live wrapper when an agent is active — fresh\n * mid-run, which a window's load-time snapshot is not) and an LRU index\n * cache shared by every window, so repeat queries pay match cost only.\n * Results come back in TURN ORDER (search is a transcript filter).\n */\n 'history.searchSession': {\n params: { sessionId: string, query: string, limit?: number }\n result: SearchTurnResult[]\n }\n /**\n * Cross-session content search, daemon-side. One RPC replaces a\n * window's per-session index/build/search round-trips — indexes are\n * built once in the daemon and shared by every window.\n */\n 'history.searchAll': {\n params: { query: string, sessionIds: string[], excerptLimit?: number }\n result: Record<string, SessionHistoryMatch>\n }\n /**\n * A window appended transcript content OUT-OF-BAND (local `/` command\n * output, `!` shell turns — written straight to the shared store, not\n * through a host run). The daemon fans out `sessions:changed` so every\n * window (issuer included) re-converges on the canonical replay NOW\n * instead of at the next run end. Sent as a notification.\n */\n 'sessions.touch': { params: { sessionId: string }, result: void }\n /** Fork at `turnId` into a new session (`ChatHost.forkSession`); announced as a `sessions:changed` create. */\n 'sessions.fork': { params: { sessionId: string, turnId: string, title?: string }, result: { id: string } }\n /** History edits (`ChatHost.deleteTurn` / `editTurnText`): refused while the session runs. */\n 'sessions.deleteTurn': { params: { sessionId: string, turnId: string }, result: void }\n /** Replaces the text of one turn. Refused while the session runs. */\n 'sessions.editTurnText': { params: { sessionId: string, turnId: string, text: string }, result: void }\n /** Cut the history at `turnId` in place (`ChatHost.rewindSession`); `inclusive` keeps the turn. Refused while the session runs. */\n 'sessions.rewind': { params: { sessionId: string, turnId: string, inclusive: boolean }, result: void }\n /** Bind to a folder, or back to a plain chat with `cwd: ''` (`ChatHost.setSessionFolder`). */\n 'sessions.setFolder': { params: { sessionId: string, cwd: string }, result: void }\n /** Turns written outside a run, e.g. `!` shell output (`ChatHost.appendTurns`). */\n 'sessions.appendTurns': { params: { sessionId: string, turns: SessionTurn[] }, result: void }\n /**\n * `ctx.appendNote` outside a run: a display-only note, rendered live and\n * persisted (`ChatHost.appendNote`). False for an unknown session or no blocks.\n */\n 'sessions.appendNote': { params: { sessionId: string, blocks: CommandOutputBlock[] }, result: boolean }\n /** Compact now (`ChatHost.compactSessionNow`): what was done, `null` when nothing was. Older daemons resolve `null`. */\n 'sessions.compact': { params: { sessionId: string }, result: CompactionReport | null }\n\n /** The session's todo list, or `null` when it has none. */\n 'todos.get': { params: { sessionId: string }, result: TodosSnapshot | null }\n /**\n * Apply a user todo edit (add / edit / remove / cycle / clear) to the\n * session the MODEL reads.\n *\n * Required because todos live in `session.metadata` and `todowrite` reads\n * them off the daemon agent's in-memory `Session`. A window writing its own\n * `Session` instance persisted an edit that the daemon never observed, so the\n * model's next `todowrite` silently overwrote it.\n *\n * Sends the whole list rather than a delta: the mutators in\n * `chat/todo-edits.ts` are already whole-list transforms, and a delta would\n * need conflict rules against a list the model rewrites concurrently.\n *\n * `null` = no live agent (or no run owns a todo slot), and the caller should\n * apply its own store-level write — race-free, since nothing is appending.\n *\n * `persistIdle`: with no live agent, the host applies the edit to the stored\n * session itself (the run the list belongs to must exist) instead of\n * answering `null`. Older hosts ignore it.\n */\n 'todos.set': { params: { sessionId: string, items: readonly TodoItem[], persistIdle?: boolean }, result: TodosSnapshot | null }\n\n /*\n * Orchestration — a pinned \"main\" session that drives other sessions\n * (\"workers\"). Feature-gated by `Settings.orchestration`; every method below\n * resolves to `null` / rejects when it is off — the main SURVIVES the toggle\n * as a persisted session, so the gate has to live on the verbs, not just on\n * discovery.\n *\n * `mainId` is load-bearing, not decorative: the host refuses any verb whose\n * `mainId` is not itself a main session. Targets are NOT limited to the\n * workers that main created — the main observes and drives the whole store —\n * but it may never target itself or another main (the depth cap).\n */\n /** The main session id, creating it (directory-less) when the setting is on and none exists. */\n 'orchestration.main': { params: Record<string, never>, result: string | null }\n /** Creates a worker session under a main session and resolves with its session id. */\n 'orchestration.createWorker': { params: { mainId: string } & OrchestrationCreateWorkerParams, result: string }\n /** Lists sessions with their live status, newest first, up to `limit`. The list can be partial. */\n 'orchestration.list': { params: { mainId: string, limit?: number }, result: OrchestrationWorkerRow[] }\n /** Summary of one session, or `null` when unknown. */\n 'orchestration.read': { params: { mainId: string, sessionId: string }, result: OrchestrationWorkerSummary | null }\n /** `wake` (default true): whether that run finishing wakes the main. */\n 'orchestration.send': { params: { mainId: string, sessionId: string, prompt: string, wake?: boolean }, result: void }\n /** Sends a steering message to a worker's live run. */\n 'orchestration.steer': { params: { mainId: string, sessionId: string, message: string }, result: void }\n /** Cancels a worker's run. */\n 'orchestration.cancel': { params: { mainId: string, sessionId: string }, result: void }\n /** The last `limit` turns of a session as plain text. */\n 'orchestration.transcript': { params: { mainId: string, sessionId: string, limit?: number }, result: string }\n\n /** Extension-contributed `/` commands discovered for `cwd`. */\n 'commands.list': { params: { cwd: string, kind?: string }, result: CommandSummary[] }\n /** Argument suggestions for `/name <prefix>` — best-effort, empty on failure. */\n 'commands.completeArgs': { params: { cwd: string, name: string, argsPrefix: string, kind?: string }, result: CommandArgSuggestionSummary[] }\n\n /** Lists pending interactions (questions and prompts the agent asked the user), optionally for one session. */\n 'interactions.list': { params: { sessionId?: string }, result: PendingInteraction[] }\n /** Answers a pending interaction. */\n 'interactions.respond': { params: { requestId: string, response: InteractionResponse }, result: { ok: boolean } }\n /** Cancels a pending interaction. `reason` is passed back to the agent. */\n 'interactions.cancel': { params: { requestId: string, reason?: string }, result: { ok: boolean } }\n /** Re-sends the session's pending interactions, for a client that connected after they were raised. */\n 'interactions.rehydrate': { params: { sessionId: string }, result: PendingInteraction[] }\n /**\n * Dev browser: a window offers to host the pages the agent's `browser_*`\n * tools drive (the GUI's main process). Released when the connection\n * drops. It then answers each `browser:request` signal addressed to it.\n */\n 'browser.registerHost': { params: { hostId: string }, result: { ok: boolean } }\n /** Withdraws a window as dev browser host. */\n 'browser.unregisterHost': { params: { hostId: string }, result: { ok: boolean } }\n /** Answers a `browser:request` signal with the host's result. */\n 'browser.respond': { params: { requestId: string, response: BrowserResponse }, result: { ok: boolean } }\n /**\n * Terminals, run by the host in the session's environment. `clientId`\n * names one view (a window's drawer or panel); views attached through a\n * connection are detached when it drops. Output arrives as\n * `terminal:output` signals; `ack` what was written to keep it flowing.\n */\n 'terminal.state': { params: { sessionId: string }, result: TerminalSessionState }\n /** Opens a terminal in a session's environment. */\n 'terminal.open': { params: TerminalOpenInput, result: TerminalInfo }\n /** Attaches a view (`clientId`) to a terminal and resolves with the output it can replay. */\n /** `maxLines` caps the history snapshot to the last lines a view can show (0 or absent: no cap). */\n 'terminal.attach': { params: { terminalId: string, clientId: string, maxLines?: number }, result: TerminalAttachResult }\n /** Detaches a view from a terminal. */\n 'terminal.detach': { params: { terminalId: string, clientId: string }, result: void }\n /** `clientId` + `response`: bytes the view's emulator generated (DSR/DA replies), dropped unless that view owns the size. */\n 'terminal.write': { params: { terminalId: string, data: string, clientId?: string, response?: boolean }, result: void }\n /** Resizes the terminal to a view's size. `claim` makes this view own the size. */\n 'terminal.resize': { params: { terminalId: string, clientId: string, cols: number, rows: number, claim?: boolean }, result: void }\n /** Acknowledges terminal output up to `offset`, so the host keeps it flowing. */\n 'terminal.ack': { params: { terminalId: string, clientId: string, offset: number }, result: void }\n /** Restarts a terminal's process and resolves with its info. */\n 'terminal.restart': { params: { terminalId: string }, result: TerminalInfo }\n /** Closes a terminal. */\n 'terminal.close': { params: { terminalId: string }, result: void }\n /** Hides a terminal from the agent, or shows it again. */\n 'terminal.setHidden': { params: { terminalId: string, hidden: boolean }, result: void }\n /**\n * This connection can show terminals (the desktop app). While at least one\n * viewer is attached, agents get the terminal tools; the registration is\n * dropped with the connection.\n */\n 'terminal.registerViewer': { params: { viewerId: string }, result: { ok: boolean } }\n /** Withdraws a viewer registered with `terminal.registerViewer`. */\n 'terminal.unregisterViewer': { params: { viewerId: string }, result: { ok: boolean } }\n /**\n * Terminals without a session: a shell on the host's machine in a\n * project's folder, or in a new-chat draft's (`draftId`). Agents never see\n * them. `terminal:project-changed` carries a scope's full list.\n */\n 'terminal.projectState': { params: TerminalProjectStateInput, result: TerminalProjectState }\n /** Opens a terminal bound to a project rather than a session. */\n 'terminal.openInProject': { params: TerminalProjectOpenInput, result: TerminalInfo }\n /** The draft became `sessionId`: its terminals move there in one pass (over the cap: back to the project). */\n 'terminal.adopt': { params: { draftId: string, sessionId: string }, result: TerminalAdoptResult }\n /** The draft was discarded (or became a server session): its terminals go back to the project. */\n 'terminal.releaseDraft': { params: { draftId: string }, result: void }\n\n /** Answers a pending approval request with a decision. */\n 'approvals.resolve': { params: { requestId: string, decision: ApprovalDecision }, result: void }\n /** Denies every pending approval, or only those of `sessionId` when given. */\n 'approvals.denyAll': { params: { sessionId?: string }, result: void }\n /** Lists the approval requests waiting for an answer. */\n 'approvals.listPending': { params: Record<string, never>, result: WireApprovalRequest[] }\n\n /**\n * Type-ahead queue, host-owned so every window sees and can manipulate\n * the same list. `queue.add` queues when a run is in flight and sends\n * immediately otherwise; the host auto-drains the queue FIFO at run end.\n */\n 'queue.list': { params: { sessionId: string }, result: QueuedItem[] }\n\n /**\n * Which `SYSTEM.md` override composes this session's prompt, for windows\n * attaching to an already-warm agent.\n *\n * The `system-md` signal fires once per agent BUILD and the daemon caches\n * agents, so the normal multi-window case (daemon already running, open a\n * second terminal or the GUI) would otherwise never learn that the built-in\n * safety and git doctrine has been replaced. `null` = no live agent yet, in\n * which case the next build broadcasts it.\n */\n 'sessions.systemMd': {\n params: { sessionId: string }\n result: { file: SystemMdFile | null, shadowed: readonly SystemMdFile[] } | null\n }\n /**\n * Every chunk of the session's system prompt with provenance — the\n * Instructions tab. Built from the live agent's assembly, so it reflects\n * MCP instructions, extension fragments and the resolved `SYSTEM.md`.\n */\n 'sessions.contextSegments': { params: { sessionId: string }, result: ContextSegmentsReport | null }\n /**\n * What a switch would cost the session's prompt cache, as the host applies\n * it (`ChatHost.cacheImpact`): what pickers show next to each option.\n * `null` without a live agent or for an empty change. Additive: an older\n * host answers \"method not found\", and clients show no estimate.\n */\n 'sessions.cacheImpact': { params: { sessionId: string, change: CacheImpactChange }, result: CacheImpact | null }\n /**\n * The session's last requests and what the cache did for each\n * (`ChatHost.cacheReport`): what `/cache` prints, for the GUI's session\n * details. `null` for an unknown session. Additive: an older host answers\n * \"method not found\".\n */\n 'sessions.cacheReport': { params: { sessionId: string, limit?: number }, result: CacheReport | null }\n /** Seed a user-scope `SYSTEM.md` from the session's doctrine; throws when an override could not apply. */\n 'sessions.createSystemOverride': { params: { sessionId: string }, result: { path: string, created: boolean } }\n /** Adds a message to the session's queue. `delivered` tells whether it was queued, sent right away, or used to steer a live run. */\n 'queue.add': {\n /**\n * `asCommand`: see `SendOptions.asCommand` — the host refuses when it cannot resolve it.\n * `keepDraft`: see `SendOptions.keepDraft` — a prompt from outside the composer.\n */\n params: { sessionId: string, text: string, activatedSkills?: string[], attachments?: PromptAttachment[], asCommand?: string, keepDraft?: boolean }\n result: { delivered: 'queued' | 'sent' | 'steer' }\n }\n /** Removes a queued entry by id. Resolves `true` when it was removed. */\n 'queue.remove': { params: { sessionId: string, id: string }, result: boolean }\n /**\n * Edit a queued entry in place; order is kept. `attachments` replaces the\n * entry's list when given. `false` when already sent / dropped.\n */\n 'queue.update': { params: { sessionId: string, id: string, text: string, attachments?: PromptAttachment[] }, result: boolean }\n /** A queued entry's attachments with their bytes; `null` when already sent / dropped. */\n 'queue.attachments': { params: { sessionId: string, id: string }, result: PromptAttachment[] | null }\n /** Steer a queued entry into the live run now (falls back to send when idle). */\n 'queue.pushNow': { params: { sessionId: string, id: string }, result: { delivered: 'steer' | 'send' | 'queued' | 'missing' } }\n\n /** Current shared draft for a session — backfill on window attach. */\n 'drafts.get': { params: { sessionId: string }, result: { text: string, shell?: boolean, attachments?: PromptAttachment[], search?: { active: boolean, query: string } } }\n /**\n * Replace the session's shared draft. Fans out `draft:changed` to every\n * OTHER peer. Ephemeral daemon state — drafts don't survive a daemon\n * restart and are cleared when any window submits the prompt.\n *\n * `shell` carries the prompt's shell mode OUT OF BAND — never encoded\n * into the text, so a literal leading `!` in a normal draft can't flip\n * other windows into shell-execution semantics.\n */\n 'drafts.set': { params: { sessionId: string, text: string, shell?: boolean }, result: void }\n /** Replace the shared draft's composing attachments (notification). */\n 'drafts.setAttachments': { params: { sessionId: string, attachments: PromptAttachment[] }, result: void }\n /** Replace the shared transcript-search state (notification, per keystroke). */\n 'search.set': { params: { sessionId: string, active: boolean, query: string }, result: void }\n /**\n * Extension bus emit from a wire client whose extensions run CLIENT-side\n * (TUI daemon mode — the extension has no host to broadcast through).\n * Sent as a notification. The daemon validates the extension id against\n * the session cwd's registry (boot registry when no `sessionId`) and the\n * `'ipc'` permission, re-validates the 64 KiB payload cap, delivers to\n * its own subscribers, and fans out `extension:signal` to every OTHER\n * peer (origin excluded — the emitter already delivered locally).\n */\n 'extension.emit': { params: { extensionId: string, sessionId?: string, payload: JsonValue, seq: number, nonce?: string }, result: void }\n /**\n * Resolve inline ghost-text autocomplete daemon-side (the typing\n * window's request IS the single computation): canonical resolver\n * against the session cwd's extension registry. Latest-wins per\n * session — a `seq` older than the newest seen returns\n * `{ suggestion: null }` without computing, and a newer request\n * aborts an in-flight compute. The result additionally fans out as\n * `suggest:changed` to every OTHER peer.\n */\n 'suggest.resolve': { params: { sessionId: string, text: string, caret: number, seq: number }, result: { suggestion: string | null, seq: number, candidates?: string[] } }\n\n /** Reads the host settings. */\n 'settings.get': { params: Record<string, never>, result: HostSettings }\n /** Applies a partial settings patch and resolves with the full settings after it. */\n 'settings.set': { params: { patch: Partial<HostSettings> }, result: HostSettings }\n\n /** Current presence snapshot — backfill for a freshly opened session list. */\n 'presence.list': { params: Record<string, never>, result: SessionPresence[] }\n /**\n * Tag the calling peer as watching a session (one per connection; the\n * TUI opens one connection per activated session). Sent as a\n * notification right after the handshake. Detach is implicit — the\n * daemon recomputes presence when the socket drops.\n */\n 'presence.watch': { params: { sessionId: string }, result: void }\n\n /**\n * Where this host lets a session's folder be: a server's workspace roots\n * (`confined`: `sessions.create` / `setFolder` refuse anything outside),\n * or the user's home on a local host (unconfined). Additive.\n */\n 'fs.roots': { params: Record<string, never>, result: FsRoots }\n /**\n * The folders in `path` (default: the first root), for a folder picker on\n * the host's machine. Only inside the roots (real paths: `..` and\n * symlinks out are refused), no dotfiles. Additive.\n */\n 'fs.listDirs': { params: { path?: string }, result: FsDirListing }\n\n /**\n * The host's provider credentials, as the host's agents use them (its\n * data dir's `credentials.json` and environment): per provider, whether\n * something is configured, its stored API key / OAuth accounts (labels,\n * which is active) and an env var it reads. Never a secret. Additive.\n */\n 'auth.status': { params: Record<string, never>, result: { providers: HostProviderAuth[] } }\n /**\n * Store an API key for one of the host's providers as its active\n * credential, apply it to the host's environment, and rebuild agents\n * (idle now, busy ones at run end). Returns the provider's new status.\n * OAuth sign-in goes through `auth.oauth.*`. Additive.\n */\n 'auth.setApiKey': { params: { provider: string, key: string }, result: HostProviderAuth }\n /**\n * Remove one stored credential (`account`: its key from `auth.status`) or,\n * without one, every stored credential of the provider; then as\n * `auth.setApiKey`. A key the host only has from its own environment is\n * left alone. Additive.\n */\n 'auth.remove': { params: { provider: string, account?: string }, result: { removed: boolean, provider: HostProviderAuth } }\n /**\n * OAuth sign-in with the browser on the CLIENT and the tokens on the host:\n * the host starts a provider's login (`provider`) or an MCP server's\n * (`mcpServer`, found in `cwd`'s catalog, as `catalog.mcps`), keeping the\n * PKCE verifier and `state`, and answers with the authorization URL.\n * `mode: 'loopback'`: the client listens at `redirectUri` (a provider's\n * fixed port; for an MCP server the loopback URI the client passed) and\n * forwards the code; `'browser'`: the client opens `url` (pasting a code if\n * the page shows one); `'device'`: shows `userCode`. The flow belongs to\n * this connection, is single-use and expires (`expiresAt`). Additive.\n */\n 'auth.oauth.begin': { params: { provider?: string, mcpServer?: string, cwd?: string, kind?: string, redirectUri?: string }, result: HostOAuthBegin }\n /**\n * Deliver the code (`code` + `state` from the loopback, or `input`: what\n * the user pasted) once, then wait for the host's token exchange; without\n * either, just wait (device and polling flows). A wrong `state` or another\n * connection's flow is refused. Tokens stay on the host: the result says\n * what changed, never a secret.\n */\n 'auth.oauth.complete': { params: { flowId: string, code?: string, state?: string, input?: string }, result: HostOAuthComplete }\n /**\n * Answer the step a flow is waiting on (`HostOAuthBegin.step` before its\n * URL, `HostOAuthComplete.step` after): a select's option id (none:\n * cancel), a prompt's text. Answers with where the flow is now: its URL, or\n * the next step. Then `complete` as before. Additive.\n */\n 'auth.oauth.respond': { params: { flowId: string, stepId: string, value?: string }, result: HostOAuthBegin }\n /** Abandon a flow of this connection. */\n 'auth.oauth.cancel': { params: { flowId: string }, result: { cancelled: boolean } }\n\n /**\n * What the host discovered for the settings tabs, each entry with whether\n * the host's settings enable it (an unset allowlist enables everything).\n * `cwd` adds the project scope of that folder (inside the workspace roots\n * on a server); without it, the user scope (the host user's home). The\n * enabled lists are written with `settings.set`. Installing, removing and\n * MCP sign-in stay on the host's machine. Additive.\n */\n 'catalog.skills': { params: { cwd?: string, kind?: string }, result: { skills: HostCatalogSkill[] } }\n /** MCP servers: `env` and `headers` values, URL credentials and query values are redacted. */\n 'catalog.mcps': { params: { cwd?: string, kind?: string }, result: { servers: HostCatalogMcp[], errors: HostCatalogError[] } }\n /** Extensions installed for `cwd`. */\n 'catalog.extensions': { params: { cwd?: string, kind?: string }, result: { extensions: HostCatalogExtension[] } }\n /** Plugins installed for `cwd`, with what each contributes. */\n 'catalog.plugins': { params: { cwd?: string, kind?: string }, result: { plugins: HostCatalogPlugin[] } }\n /**\n * Install a skill or an extension on the host, in its user's scope only\n * (`scope` may only be `'user'`): a GitHub (`owner/repo[#ref][:dir]`, a\n * GitHub URL, a skills.sh URL) or npm spec; paths are refused. `skills` /\n * `all` pick from a multi-skill source (the `multiple-candidates` error\n * lists them), `extension` from a multi-extension one. Runs the host's\n * package managers and fetches code there: a zidane-server's\n * `allowRemoteInstalls` gates it, every attempt is audited. Bounded in\n * time; the progress lines come back with the result. Every window gets\n * `catalog:changed`. Additive (`remoteInstalls` on `ipc.hello`).\n */\n 'catalog.install': { params: { kind: HostInstallKind, spec: string, scope?: 'user', skills?: string[], all?: boolean, extension?: string, overwrite?: boolean }, result: { installed: string[], message: string, progress: string[] } }\n /** Remove a user-scope skill or extension of the host by name (its directory). As `catalog.install`. */\n 'catalog.remove': { params: { kind: HostInstallKind, name: string }, result: { removed: string, message: string } }\n /** Update a user-scope extension installed from a source. As `catalog.install`. */\n 'catalog.update': { params: { kind: HostInstallKind, name: string }, result: { updated: string, upToDate: boolean, message: string } }\n /**\n * Add or replace an MCP server in the host user's `mcps.json`. Its `env` /\n * `headers` values are stored there and never come back (`catalog.mcps`\n * redacts them, the reply names the server only). As `catalog.install`.\n */\n 'mcp.upsert': { params: { config: McpServerConfig }, result: { name: string, created: boolean } }\n /** Remove an MCP server from the host user's `mcps.json`; `removed: false` when it has none. As `catalog.install`. */\n 'mcp.remove': { params: { name: string }, result: { removed: boolean } }\n /**\n * The host's credentialed providers (what its agents can run) and their\n * models, for a model picker of a session on that host. `cwd` adds the\n * providers its extensions contribute there. Additive.\n */\n 'models.list': { params: { cwd?: string, kind?: string }, result: { providers: HostModelProvider[] } }\n /**\n * Send one tiny decision with this host's credentials, to check a decision\n * model works. `model` is `\"providerKey/modelId\"`, tested exactly; omitted =\n * the host's `Settings.decisionModel` (or the first available). Never\n * fails: a broken model comes back as `ok: false` with a reason. Additive.\n */\n 'decisions.test': { params: { cwd?: string, kind?: string, model?: string }, result: HostDecisionTestResult }\n /**\n * Send one tiny prompt with this host's credentials, to check a chat model\n * answers. `model` is `\"providerKey[@account]/modelId\"`, tested exactly.\n * Never fails: a broken model comes back as `ok: false` with a reason.\n * Additive.\n */\n 'models.test': { params: { cwd?: string, kind?: string, model: string }, result: HostModelTestResult }\n\n /**\n * The machines this host knows (`docs/MACHINES.md`), online or not, and\n * forgetting one (it disconnects; its `local@` / `worktree@` kinds stop\n * resolving). Additive.\n */\n 'machines.list': { params: Record<string, never>, result: MachineInfo[] }\n /** Forgets a machine. It disconnects and its kinds stop resolving. */\n 'machines.forget': { params: { machineId: string }, result: { forgotten: boolean } }\n /**\n * Folders of a machine, for a client's folder picker: the host proxies a\n * listing to the machine (`fs.list`, confined to its roots there): the\n * folders in `path` (absent: its first root), and every root. Additive.\n */\n 'machines.listDirs': { params: { machineId: string, path?: string }, result: { path: string, dirs: string[], roots: string[] } }\n /**\n * A local host's machine links (`docs/MACHINES.md` § Client UI), behind\n * remote hosts: share this computer with a saved server (the machine agent\n * runs in this host's process, with the machine token `token` or the one\n * already stored for that server), stop sharing, use a saved server as a\n * machine (reverse direction), and read their state. Refused while remote\n * hosts are off. Additive.\n */\n 'machines.share.start': { params: { hostId: string, name: string, roots: string[], token?: string }, result: MachineLinksStatus }\n /** Stops sharing this computer with a server. */\n 'machines.share.stop': { params: { hostId: string }, result: MachineLinksStatus }\n /** Turns on or off using a server as this computer's linked server. */\n 'machines.useServer': { params: { hostId: string, enabled: boolean }, result: MachineLinksStatus }\n /** State of this host's machine links: the shares it offers and the servers it uses. */\n 'machines.links.status': { params: Record<string, never>, result: MachineLinksStatus }\n /**\n * Reverse direction (`docs/MACHINES.md` § Reverse direction): a client asks\n * this server to lend itself as a machine over this very connection\n * (`allowAsMachine` on, else refused). `hostId` names the asking host, so\n * a reconnect finds its tasks and terminals again. Then `machine.call`\n * carries each host→machine request (`MachineMethods`), answered by the\n * server's confined executor; machine notifications come back as\n * `machine:notification` signals on this connection only.\n */\n 'machine.attach': { params: { hostId: string }, result: MachineRegisterParams }\n /** Runs one machine-protocol method on this server's executor and resolves with its JSON result. Refused when the server does not lend itself as a machine. */\n 'machine.call': { params: { method: string, params?: JsonValue }, result: JsonValue }\n /** Ends this connection's machine attachment. `detached` is `false` when it had none. */\n 'machine.detach': { params: Record<string, never>, result: { detached: boolean } }\n /**\n * Mint a `machine`-scoped token on this server (a zidane-server only), so\n * a window can share its computer in one step. Any client may: in the\n * single-user model a client token is already an admin's. Audited.\n */\n 'tokens.createMachineToken': { params: { name: string }, result: { id: string, name: string, token: string } }\n\n /**\n * Settings sync, a client's computer → this server (`docs/SERVER.md`\n * § Settings sync). A zidane-server only; other hosts refuse. One source\n * device per server: `sync.claim` makes the caller it (or says who is,\n * unless `takeover`), `sync.push` applies one category's snapshot through\n * the host's own setters, skipping fields edited here since (overrides),\n * `sync.reset` drops an override, `sync.release` stops the source. Every\n * call is audited with its token. Additive.\n */\n 'sync.status': { params: Record<string, never>, result: SyncStatus }\n /** Makes the caller the settings source device. When another device is the source, the result says which, unless `takeover` is set. `categories` and `keys` narrow what it syncs. */\n 'sync.claim': { params: { deviceId: string, deviceName: string, takeover?: boolean, categories?: SyncCategory[], keys?: string[] }, result: SyncClaimResult }\n /** Applies one category's snapshot from the source device. */\n 'sync.push': { params: { deviceId: string, category: SyncCategory, payload: SyncPayload }, result: SyncPushResult }\n /** Drops the local override of one field so sync applies to it again. */\n 'sync.reset': { params: { field: string }, result: { reset: boolean } }\n /** Stops the source device's sync. */\n 'sync.release': { params: { deviceId: string }, result: { released: boolean } }\n\n /** Daemon identity and version: `protocolVersion`, `appVersion`, `pid`, `startedAt` and the host identity fields of the `hello` result. */\n 'daemon.info': { params: Record<string, never>, result: HelloResult }\n /**\n * Graceful drain: deny pending approvals, abort live runs, close the\n * socket. Used by clients that detect a protocol-version mismatch and\n * need the stale daemon gone before respawning.\n *\n * `whenIdle` (version-skew retirement): a daemon with active work does\n * NOT abort it. It answers `{ deferred: true }` and exits once idle.\n * Explicit stops (`zidane daemon stop`) omit it and drain immediately.\n * Daemons predating the flag ignore it and drain immediately.\n */\n 'daemon.shutdown': { params: { whenIdle?: boolean }, result: { deferred?: boolean } | void }\n}\n\n/**\n * The host's identity from a hello (or `daemon.info`) reply; `null` from a host that predates it.\n * @param hello - The `hello` or `daemon.info` result.\n * @returns The host reference, or `null` when the reply carries no host id or kind.\n */\nexport function hostRefOf(hello: HelloResult): HostRef | null {\n if (typeof hello.hostId !== 'string' || !hello.hostKind)\n return null\n return { id: hello.hostId, kind: hello.hostKind, name: hello.hostName ?? hello.hostId }\n}\n\n/** Name of any method in {@link IpcMethods}. */\nexport type IpcMethodName = keyof IpcMethods\n/** Params type of the method `M` in {@link IpcMethods}. */\nexport type IpcParams<M extends IpcMethodName> = IpcMethods[M]['params']\n/** Result type of the method `M` in {@link IpcMethods}. */\nexport type IpcResult<M extends IpcMethodName> = IpcMethods[M]['result']\n\n/** Turns per `sessions.loadEvents` page when only `before` is given. */\nexport const LOAD_EVENTS_PAGE_TURNS = 200\n/** Largest `limit` a host honors. */\nexport const LOAD_EVENTS_MAX_PAGE_TURNS = 1000\n\n/** Paging options of `sessions.loadEvents`. */\nexport interface LoadEventsPaging {\n /** Turn position (exclusive) the page ends at: a previous page's `cursor`. */\n before?: number\n /** Turns in the page. */\n limit?: number\n /**\n * The page ends right before the turn with this id (same alignment as\n * `before` at its position); wins over `before`. A turn the stored\n * transcript doesn't hold fails the request (invalid params, the message\n * names `beforeTurnId`). An older host ignores it: see\n * {@link SessionEventsPage.beforeTurnId}.\n */\n beforeTurnId?: string\n}\n\n/** One page of a session's stream events, as `sessions.loadEvents` answers it. */\nexport interface SessionEventsPage {\n /** Stream events of the page. */\n events: StreamEvent[]\n /** Pass as `before` for the page before this one; absent once the first turn is in. */\n cursor?: number\n /**\n * The events are this page's slice of the whole replay, so pages\n * concatenate to exactly one whole `loadEvents`. Absent from an older\n * host, whose pages replay on their own ({@link loadAllEvents} restores\n * the exchange separator at their joins).\n */\n exact?: true\n /**\n * With `exact`: how many events of the whole replay come before this\n * page. Lets a client open on the tail of a long transcript and still\n * say how much it left out ({@link loadEventsTail}). Absent from an\n * older host.\n */\n start?: number\n /**\n * The request's `beforeTurnId`, echoed: absent when the host ignored\n * the anchor (an older host, which then paged by `before` / from the end).\n */\n beforeTurnId?: string\n}\n\n/**\n * One page of `sessions.loadEvents` (see its paging). An older host answers\n * the whole transcript: it comes back as one page with no cursor.\n * @param request - Sends `sessions.loadEvents` to the host.\n * @param params - Session id and paging.\n * @returns The page, normalized from either host reply shape.\n */\nexport async function loadEventsPage(\n request: (method: 'sessions.loadEvents', params: { sessionId: string }) => Promise<StreamEvent[]>,\n params: { sessionId: string } & LoadEventsPaging,\n): Promise<SessionEventsPage> {\n const result = await request('sessions.loadEvents', params) as StreamEvent[] | SessionEventsPage\n return Array.isArray(result) ? { events: result } : result\n}\n\nfunction isResponseTooLarge(err: unknown): boolean {\n return typeof err === 'object' && err !== null && (err as { code?: unknown }).code === IpcErrorCode.ResponseTooLarge\n}\n\n/**\n * A session's whole transcript, loaded a page at a time from the end so no\n * single reply carries it all (a long session with images can outgrow a\n * transport's message size). A page refused as too large is asked again at\n * half the turns, down to one; a single turn that still doesn't fit fails\n * the load. An older host answers the whole transcript to the first call.\n * @param request - Sends `sessions.loadEvents` to the host.\n * @param sessionId - Session to load.\n * @param options - Paging options.\n * @param options.pageTurns - Turns per page to start with.\n * @returns Every stream event of the session.\n */\nexport async function loadAllEvents(\n request: (method: 'sessions.loadEvents', params: { sessionId: string }) => Promise<StreamEvent[]>,\n sessionId: string,\n options: { pageTurns?: number } = {},\n): Promise<StreamEvent[]> {\n return (await loadEventsFromEnd(request, sessionId, options.pageTurns ?? LOAD_EVENTS_PAGE_TURNS)).events\n}\n\n/**\n * The end of a session's transcript: pages from the end until `enough`\n * holds for what was loaded (or the first turn is in), and how many events\n * of the whole replay come before it (`earlier`). Only exact pages can stop\n * early, since only they say where they start: an older host's transcript\n * loads whole, with `earlier` 0.\n */\nexport async function loadEventsTail(\n request: (method: 'sessions.loadEvents', params: { sessionId: string }) => Promise<StreamEvent[]>,\n sessionId: string,\n enough: (events: readonly StreamEvent[]) => boolean,\n options: { pageTurns?: number } = {},\n): Promise<{ events: StreamEvent[], earlier: number }> {\n return loadEventsFromEnd(request, sessionId, options.pageTurns ?? LOAD_EVENTS_PAGE_TURNS, enough)\n}\n\nasync function loadEventsFromEnd(\n request: (method: 'sessions.loadEvents', params: { sessionId: string }) => Promise<StreamEvent[]>,\n sessionId: string,\n pageTurns: number,\n enough?: (events: readonly StreamEvent[]) => boolean,\n): Promise<{ events: StreamEvent[], earlier: number }> {\n let limit = pageTurns\n const pages: StreamEvent[][] = []\n let newerExact = false\n let allExact = true\n let before: number | undefined\n for (;;) {\n let page: SessionEventsPage\n try {\n page = await loadEventsPage(request, { sessionId, limit, ...(before !== undefined ? { before } : {}) })\n }\n catch (err) {\n if (isResponseTooLarge(err) && limit > 1) {\n limit = Math.max(1, Math.floor(limit / 2))\n continue\n }\n throw err\n }\n /*\n * An exact page is a slice of the whole replay: nothing to restore. An\n * older host's pages replay on their own, so the exchange separator a\n * whole replay puts before a prompt that follows an exchange is missing\n * where the newer page starts (its pages start at a prompt when they\n * can): put it back.\n */\n const newer = pages[0]\n if (newer && !newerExact && newer[0]?.kind === 'user-prompt' && page.events.length > 0)\n newer.unshift({ kind: 'separator', text: '' })\n newerExact = page.exact === true\n allExact &&= newerExact && page.start !== undefined\n pages.unshift(page.events)\n // Done at the first turn; a cursor that doesn't move back would loop.\n if (page.cursor === undefined || page.cursor <= 0 || (before !== undefined && page.cursor >= before))\n break\n if (enough && allExact) {\n const events = pages.flat()\n if (enough(events))\n return { events, earlier: page.start! }\n }\n before = page.cursor\n }\n return { events: pages.flat(), earlier: 0 }\n}\n\n/** Turns per `sessions.getTurns` page by default. */\nexport const SESSION_TURNS_PAGE = 200\n/** Largest `limit` a host honors for `sessions.getTurns`. */\nexport const SESSION_TURNS_MAX_PAGE = 1000\n\ntype SessionDocumentRequest = <M extends 'sessions.get' | 'sessions.getTurns'>(method: M, params: IpcParams<M>) => Promise<IpcResult<M>>\n\n/**\n * What `sessions.get` answers: the document; with `turns: false`, the\n * version of the snapshot it was cut from, the one `sessions.getTurns`\n * pages carry.\n */\nexport type SessionDocumentHead = SessionData & { version?: string }\n\n/** How many times a paged read starts over because the session changed under it, before it asks for the whole document in one reply. */\nconst SESSION_DOCUMENT_RESTARTS = 3\n\n/**\n * A session's whole document, read a page of turns at a time so no reply\n * carries it all (`sessions.getTurns` pages, then the `sessions.get`\n * `turns: false` head; a page refused as too large is asked again at half\n * the turns). Every page and the head name the snapshot they come from: a\n * version change mid-read (a turn appended, a compaction) starts the read\n * over, so the result is one version, never pages of two. After\n * {@link SESSION_DOCUMENT_RESTARTS} restarts (a session busier than the\n * read), the whole document comes in one reply. A host that predates\n * `sessions.getTurns` sends it that way too; one that names no version is\n * read as before. `null` when the host doesn't know the session.\n * @param request - Sends `sessions.get` and `sessions.getTurns` to the host.\n * @param sessionId - Session to read.\n * @param options - Paging options.\n * @param options.pageTurns - Turns per page to start with.\n * @returns The session document, or `null` when unknown.\n */\nexport async function loadSessionDocument(\n request: SessionDocumentRequest,\n sessionId: string,\n options: { pageTurns?: number } = {},\n): Promise<SessionData | null> {\n const paging = { limit: options.pageTurns ?? SESSION_TURNS_PAGE }\n for (let attempt = 0; attempt <= SESSION_DOCUMENT_RESTARTS; attempt++) {\n const read = await readSessionDocumentOnce(request, sessionId, paging)\n if (read !== 'changed')\n return read\n }\n return withoutVersion(await request('sessions.get', { sessionId }))\n}\n\nfunction withoutVersion(head: SessionDocumentHead | null): SessionData | null {\n if (!head)\n return null\n const { version: _version, ...data } = head\n return data\n}\n\n/** One paged read; `'changed'`: the version moved between two of its replies. */\nasync function readSessionDocumentOnce(request: SessionDocumentRequest, sessionId: string, paging: { limit: number }): Promise<SessionData | null | 'changed'> {\n const turns: SessionTurn[] = []\n let total = Infinity\n let version: { of?: string } | null = null\n while (turns.length < total) {\n let page: IpcResult<'sessions.getTurns'>\n try {\n page = await request('sessions.getTurns', { sessionId, from: turns.length, limit: paging.limit })\n }\n catch (err) {\n if (turns.length === 0 && isMethodNotFound(err))\n return withoutVersion(await request('sessions.get', { sessionId }))\n if (isResponseTooLarge(err) && paging.limit > 1) {\n paging.limit = Math.max(1, Math.floor(paging.limit / 2))\n continue\n }\n throw err\n }\n if (!page)\n return null\n if (version === null)\n version = { ...(page.version !== undefined ? { of: page.version } : {}) }\n else if (page.version !== version.of)\n return 'changed'\n total = page.total\n // A session that shrank meanwhile on a host that names no version ends the read where it is.\n if (page.turns.length === 0)\n break\n turns.push(...page.turns)\n }\n const head = await request('sessions.get', { sessionId, turns: false })\n if (!head)\n return null\n if (version !== null && head.version !== version.of)\n return 'changed'\n return { ...withoutVersion(head)!, turns }\n}\n\n/** A catalog entry's on/off state as the host's settings decide it. */\ninterface HostCatalogToggle {\n name: string\n /** The host's settings enable it (always `false` for an entry that cannot load). */\n enabled: boolean\n /**\n * Its own allowlist governs it (`enabledSkills`, …). `false`: contributed\n * by a plugin or extension (their toggle governs it), or broken.\n */\n toggleable: boolean\n}\n\n/** A skill in the host's catalog. */\nexport interface HostCatalogSkill extends HostCatalogToggle {\n /** What the skill is for. */\n description: string\n /** Where the skill was found. */\n source?: 'project' | 'user' | 'inline' | 'builtin'\n /** `SKILL.md` on the host's machine. */\n location?: string\n /** `disk`: a scan path; else the plugin or extension that contributes it (`contributedBy`). */\n origin: 'disk' | 'plugin' | 'extension'\n /** Name of the plugin or extension that contributes the skill, when `origin` is not `disk`. */\n contributedBy?: string\n}\n\n/** Every secret-bearing value of a catalog entry is replaced by this. */\nexport const REDACTED = '<redacted>'\n\n/** An MCP server in the host's catalog. Secret values are redacted. */\nexport interface HostCatalogMcp extends HostCatalogToggle {\n /** How the server is reached. */\n transport: 'stdio' | 'sse' | 'streamable-http'\n /** Whether the config is the project's or the user's. */\n source: 'project' | 'user'\n /** The config file on the host's machine. */\n path: string\n /** Command that starts a `stdio` server. */\n command?: string\n /** Arguments of the command. */\n args?: string[]\n /** Credentials and query values redacted. */\n url?: string\n /** Working directory of the command. */\n cwd?: string\n /** `context` runs the server in the agent's execution context. `host` runs it on the host. */\n scope?: 'host' | 'context'\n /** `oauth` when the server signs in with OAuth. */\n auth?: 'oauth'\n /** Names only: every value is {@link REDACTED}. */\n env?: Record<string, string>\n /** Header names. Every value is {@link REDACTED}. */\n headers?: Record<string, string>\n}\n\n/** A config file that failed to parse (or an informational skip). */\nexport interface HostCatalogError {\n /** Path of the config file. */\n path: string\n /** Whether the file is the project's or the user's. */\n source: 'project' | 'user'\n /** Why it failed or was skipped. */\n message: string\n /** `true` when the entry is a skip notice, not a failure. */\n informational?: boolean\n}\n\n/** An extension in the host's catalog. */\nexport interface HostCatalogExtension extends HostCatalogToggle {\n /** Where the extension was found. */\n source: 'user' | 'project' | 'inline' | 'builtin'\n /** Version from the extension manifest. */\n version?: string\n /** What the extension does. */\n description?: string\n /** Directory of the extension on the host's machine. */\n dir?: string\n /** Why it did not load. */\n error?: string\n /** What it contributes: `tools`, `skills`, `mcps`, `commands`, … */\n capabilities?: string[]\n}\n\n/** A plugin in the host's catalog. */\nexport interface HostCatalogPlugin extends HostCatalogToggle {\n /** Where the plugin comes from: a directory on disk, or an extension. */\n origin: { kind: 'disk', scope: 'project' | 'user', dir: string } | { kind: 'extension', extensionName: string, dir: string }\n /** `false`: the manifest was rejected (`error` says why). */\n ok: boolean\n /** Version from the plugin manifest. */\n version?: string\n /** What the plugin does. */\n description?: string\n /** Names of the skills the plugin contributes. */\n skills: string[]\n /** Names of the MCP servers the plugin contributes. */\n mcpServers: string[]\n /** Why the manifest was rejected, when `ok` is `false`. */\n error?: string\n}\n\n/** One provider a host can run, with its models (`models.list`). */\nexport interface HostModelProvider {\n /** Provider key. */\n key: string\n /** Display name. */\n label: string\n /** Models the provider offers on this host. */\n models: HostModelInfo[]\n /**\n * The host's stored accounts of the provider a session can be pinned to\n * (`ProviderAuth.accounts`), when it has several. Ids are the host's own:\n * a pick on a server names one of its accounts. Additive.\n */\n accounts?: Array<{ id: string, label: string, active: boolean }>\n /**\n * Decision models of the provider's Decisions endpoint, with whether this\n * host's credentials can use them. Absent on providers without one, and\n * from hosts that predate decisions. Additive.\n */\n decisionModels?: HostDecisionModel[]\n}\n\n/** `decisions.test`: how the probe decision went. */\nexport interface HostDecisionTestResult {\n ok: boolean\n provider?: string\n model?: string\n durationMs: number\n reason?: string\n message?: string\n}\n\n/** `models.test`: how the probe prompt went, in the fields of `decisions.test`. */\nexport type HostModelTestResult = HostDecisionTestResult\n\n/** One decision model a host's provider serves (`models.list`). */\nexport interface HostDecisionModel {\n id: string\n available: boolean\n reason?: string\n}\n\n/** `ModelInfo` as it crosses the wire. */\nexport interface HostModelInfo {\n /** Model id. */\n id: string\n /** Display name. */\n name?: string\n /** Context window in tokens. */\n contextWindow: number\n /** Maximum output tokens. */\n maxTokens?: number\n /** Whether the model supports reasoning. */\n reasoning?: boolean\n /** Input kinds the model accepts. */\n input?: ('text' | 'image')[]\n /** Price per million tokens, by token kind. */\n cost?: { input: number, output: number, cacheRead?: number, cacheWrite?: number }\n /** Provider that serves the model. */\n provider?: string\n /** Model-specific boolean options, with an optional cost multiplier per token kind. */\n options?: { id: string, label: string, description?: string, costMultiplier?: { input?: number, output?: number, cacheRead?: number, cacheWrite?: number } }[]\n}\n\n/** One credential source of a host's provider (`auth.status`); no secret. */\nexport interface HostAuthMethod {\n /** Where the credential comes from: a stored API key, an OAuth login, or an environment variable. */\n source: 'apikey' | 'oauth' | 'env'\n /** A stored credential the provider resolves (`env` never is). */\n active: boolean\n /** Credentials-file key of a stored credential: the `account` of `auth.remove`. */\n key?: string\n /** OAuth account name. */\n label?: string\n /** Display detail: `credentials.json`, an OAuth account and its expiry, an env var name. */\n detail: string\n}\n\n/**\n * A question the provider's sign-in asks before (or after) its URL: a choice\n * between flows, or a free text. The client shows it and answers with\n * `auth.oauth.respond`; the host never picks for the user.\n */\nexport type HostOAuthStep\n = | { id: string, kind: 'select', message: string, options: Array<{ id: string, label: string }> }\n | { id: string, kind: 'prompt', message: string, placeholder?: string, allowEmpty?: boolean }\n\n/** Result of `auth.oauth.begin`. */\nexport interface HostOAuthBegin {\n /** Random, single-use, bound to the connection that began it. */\n flowId: string\n /** The authorization URL (a device flow: its verification URL); `''` while a `step` comes first. */\n url: string\n /** How the client gets the code back. `step`: answer `step` (`auth.oauth.respond`) before the URL exists. */\n mode: 'loopback' | 'browser' | 'device' | 'step'\n /** A question to answer before the URL exists. Set when `mode` is `step`. */\n step?: HostOAuthStep\n /** `loopback`: where the browser is sent back, on the client's machine. */\n redirectUri?: string\n /** `device`: the code to enter at `url`. */\n userCode?: string\n /** Text to show the user while they sign in. */\n instructions?: string\n /** Epoch ms: the host forgets the flow after it. */\n expiresAt: number\n}\n\n/** `auth.oauth.complete`: the outcome, never a token. */\nexport interface HostOAuthComplete {\n /** A provider sign-in: its new status. */\n provider?: HostProviderAuth\n /** An MCP server sign-in: its name. */\n mcpServer?: string\n /** Not finished: the sign-in asks this. Answer it (`auth.oauth.respond`), then `complete` again. */\n step?: HostOAuthStep\n}\n\n/** Sign-in state of one provider on a host, from `auth.status`. Holds no secret. */\nexport interface HostProviderAuth {\n /** Provider key. */\n key: string\n /** Display name. */\n label: string\n /** Some credential source is present. */\n configured: boolean\n /** The provider signs in with OAuth (on the host's machine only). */\n oauth: boolean\n /** The env var it reads, when it declares one. */\n envKey?: string\n /** Credential sources of the provider. */\n methods: HostAuthMethod[]\n}\n\n/** Folders a host lets clients browse, from `fs.roots`. */\nexport interface FsRoots {\n /** Real paths, the default first. */\n roots: string[]\n /** Session folders must be inside `roots` (a server). */\n confined: boolean\n}\n\n/** One folder in an {@link FsDirListing}. */\nexport interface FsDirEntry {\n /** Folder name. */\n name: string\n /** Real path (a symlink resolved). */\n path: string\n /** Holds a `.git`. */\n isGitRepo: boolean\n}\n\n/** A folder listing from `fs.listDirs`. */\nexport interface FsDirListing {\n /** Real paths of the browsable roots. */\n roots: string[]\n /** The listed folder, as a real path. */\n path: string\n /** The folder above, or `null` at a root. */\n parent: string | null\n /** Sorted by name. */\n entries: FsDirEntry[]\n /** More folders than the listing returns. */\n truncated?: boolean\n}\n\n/** One ordered model-fallback target (primary excluded). */\nexport interface ModelFallbackRef {\n /** Provider of the fallback model. */\n providerKey: ProviderKey\n /** Id of the fallback model. */\n modelId: string\n /** The stored account of the provider (credential id); omitted = its active account. Additive. */\n account?: string\n}\n\n/** One row of a cross-window session list. */\nexport interface SessionRow {\n /** Session id. */\n id: string\n /** Session title. */\n title: string\n /** Project the session belongs to, or `null` when it has none. */\n projectRoot: string | null\n /** Working directory of the session. */\n cwd: string\n /** Id of the agent the session runs as. */\n agentId?: string\n /** Run state of the session. */\n status: 'idle' | 'running' | 'completed' | 'error'\n /** Creation time, epoch ms. */\n createdAt: number\n /** Time of the last change, epoch ms. */\n updatedAt: number\n /** Whether the session is archived. */\n archived: boolean\n /** Listed first (`metadata.favorite`). Additive. */\n favorite?: boolean\n /** Orchestration main session — see `SessionMeta.isMain`. Additive. */\n isMain?: boolean\n /** The session's space when not Default — see `SessionMeta.spaceId`. Additive. */\n spaceId?: string\n /** Provider the session runs on. */\n providerKey?: ProviderKey\n /** Model the session runs on. */\n modelId?: string\n /** The pinned account of `providerKey` (credential id), when one is. Additive. */\n account?: string\n /** Thinking effort of the session. */\n effort?: ThinkingLevel\n /** Model-specific boolean options of the session. */\n modelOptions?: Record<string, boolean>\n /** Validated (head-matched) fallback chain tail, for pickers/badges. */\n modelFallbacks?: ModelFallbackRef[]\n /** Non-local environment summary (kind, state, branch, error). */\n environment?: SessionEnvironmentSummary\n /** The host serving this row (`HelloResult.hostId`). Additive: absent from older hosts. */\n hostId?: string\n /**\n * While `status` is `running`: when the run in progress began, epoch ms on\n * the host's clock, so a client that missed its `run:start` still shows how\n * long it has been going. Additive: absent from older hosts.\n */\n runStartedAt?: number\n}\n\n/** Params of `sessions.create`. */\nexport interface CreateSessionParams {\n /** Tool-execution directory — `projectRoot` is derived from it host-side. */\n cwd: string\n /** Title of the session. Omitted: the host picks one. */\n title?: string\n /** Id of the agent the session runs as. */\n agentId?: string\n /** Provider the session runs on. */\n providerKey?: ProviderKey\n /** Model the session runs on. */\n modelId?: string\n /** The stored account of `providerKey` to run on (credential id). Additive: older hosts ignore it. */\n account?: string\n /** Seed an ordered fallback chain alongside the model pick. */\n fallbacks?: ModelFallbackRef[]\n /** The model pick's reasoning effort and options, stamped with it. */\n effort?: ThinkingLevel\n /** Model-specific boolean options, stamped with the model pick. */\n modelOptions?: Record<string, boolean>\n /** Skills pinned from the first turn (an authoring session's docs skill). */\n pinnedSkills?: string[]\n /** Mark as an extension-authoring session (auto-activates the docs skill). */\n extensionEdit?: boolean\n /** Mark as a skill-authoring session for the named skill (dir = `cwd`). */\n skillEdit?: { name: string }\n /** Where the session's work happens. Omitted → local. */\n environment?: EnvironmentRequest\n /** The space the session belongs to. Omitted → Default. Additive: older hosts ignore it. */\n spaceId?: string\n /** Create it as a hidden `/side` session of this parent. Additive: older hosts ignore it. */\n sideOf?: string\n}\n\n/* -------------------------------------------------------------------------\n * Daemon handshake\n * ---------------------------------------------------------------------- */\n\n/** Params of the `hello` handshake. */\nexport interface HelloParams {\n /** Protocol version the client speaks. */\n protocolVersion: number\n /** Client's zidane version — surfaced in daemon diagnostics. */\n appVersion: string\n /** Process id of the client. */\n pid: number\n /**\n * Build fingerprint (module mtime; `'unknown'` in compiled binaries).\n * When BOTH sides report a real id and they differ, the daemon rejects\n * the handshake like a protocol-version mismatch — the client drains it\n * and respawns. Closes same-version code drift during development.\n */\n buildId?: string\n /**\n * Version of the zidane code the client runs (`ZIDANE_VERSION`, inlined at\n * build). Unlike `buildId` this survives compiled binaries, so it closes\n * the gap released builds had: same protocol version, older code. A\n * client STRICTLY NEWER than the daemon is rejected like a build mismatch\n * and the stale daemon is drained; an older client is accepted and\n * degrades via `optional()`.\n */\n codeVersion?: string\n}\n\n/**\n * What a host process is: a window's own (`in-process`), the local shared\n * daemon (`daemon`), or a remote `zidane-server` (`server`).\n */\nexport type HostKind = 'in-process' | 'daemon' | 'server'\n\n/** Which host a client is talking to, as clients keep it (from `hostRefOf`). */\nexport interface HostRef {\n /** Stable across restarts: persisted in the host's data dir. */\n id: string\n /** What kind of host it is. */\n kind: HostKind\n /** Display name: the machine's hostname by default. */\n name: string\n}\n\n/** Result of the `hello` handshake and of `daemon.info`. */\nexport interface HelloResult {\n /** Protocol version the host speaks. */\n protocolVersion: number\n /** zidane version of the host. */\n appVersion: string\n /** Process id of the host. */\n pid: number\n /** Start time of the host process, epoch ms. */\n startedAt: number\n /** Build fingerprint of the host code. `'unknown'` in compiled binaries. */\n buildId?: string\n /** Version of the zidane code the host runs. */\n codeVersion?: string\n /**\n * Host identity (additive). `hostId` is a UUID persisted once in the host's\n * data dir, so it survives restarts; the in-process host and the local\n * daemon share the data dir, and so the id: they are the same computer.\n */\n hostId?: string\n /** What kind of host this is. */\n hostKind?: HostKind\n /** Display name of the host. */\n hostName?: string\n /**\n * The daemon is older than a client that attached while it had active\n * work: it accepted the handshake instead of draining (which would abort\n * those runs) and exits once idle. Clients attach normally; their\n * reconnect path lands on a fresh daemon after the exit.\n */\n retiring?: boolean\n /**\n * Names this host process's signal numbering ({@link SIGNAL_SEQ_FIELD}):\n * a position from another epoch cannot be resumed. Additive.\n */\n signalEpoch?: string\n /**\n * This server lends itself as a machine to the hosts of its clients\n * (`machine.attach`, `allowAsMachine` on). Absent: it doesn't. Additive.\n */\n machineServe?: boolean\n /**\n * This server takes installs and removals from its clients (`catalog.install`\n * / `remove` / `update`, `mcp.upsert` / `remove`; `allowRemoteInstalls` on).\n * Absent: it doesn't (or predates them). Additive.\n */\n remoteInstalls?: boolean\n /** This server takes settings sync from a client's computer (`sync.*`). Absent: it doesn't. Additive. */\n sync?: boolean\n /**\n * This host runs terminals without a session (`terminal.openInProject` and\n * the other project / draft terminal methods). Absent: sessions only. Additive.\n */\n projectTerminals?: true\n /**\n * `daemon.info` only: a run, compaction, `/` command or background task is\n * in flight on this host (open terminals do not count). `zidane server\n * wait-idle` waits for `false` before a restart. Additive.\n */\n activeWork?: boolean\n}\n\n/** `catalog.install` / `remove` / `update`: what is installed from a client, in the host user's scope. */\nexport type HostInstallKind = 'skill' | 'extension'\n\n/** Which catalog a `catalog:changed` signal says to re-read. */\nexport type HostCatalogName = 'skills' | 'mcps' | 'extensions' | 'plugins'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwMA,MAAa,uBAAuB;;;;;;AAOpC,MAAa,eAAe;CAC1B,iBAAiB;CACjB,eAAe;;CAEf,aAAa;;;;;;CAMb,kBAAkB;;;;;;CAMlB,eAAe;AACjB;;;;;;AAOA,MAAa,cAAc;;;;;;;AAQ3B,MAAa,mBAAmB;;;;;;AAwxBhC,SAAgB,UAAU,OAAoC;CAC5D,IAAI,OAAO,MAAM,WAAW,YAAY,CAAC,MAAM,UAC7C,OAAO;CACT,OAAO;EAAE,IAAI,MAAM;EAAQ,MAAM,MAAM;EAAU,MAAM,MAAM,YAAY,MAAM;CAAO;AACxF;;AAUA,MAAa,yBAAyB;;AAEtC,MAAa,6BAA6B;;;;;;;;AAoD1C,eAAsB,eACpB,SACA,QAC4B;CAC5B,MAAM,SAAS,MAAM,QAAQ,uBAAuB,MAAM;CAC1D,OAAO,MAAM,QAAQ,MAAM,IAAI,EAAE,QAAQ,OAAO,IAAI;AACtD;AAEA,SAAS,mBAAmB,KAAuB;CACjD,OAAO,OAAO,QAAQ,YAAY,QAAQ,QAAS,IAA2B,SAAS,aAAa;AACtG;;;;;;;;;;;;;AAcA,eAAsB,cACpB,SACA,WACA,UAAkC,CAAC,GACX;CACxB,QAAQ,MAAM,kBAAkB,SAAS,WAAW,QAAQ,aAAA,GAAmC,EAAA,CAAG;AACpG;;;;;;;;AASA,eAAsB,eACpB,SACA,WACA,QACA,UAAkC,CAAC,GACkB;CACrD,OAAO,kBAAkB,SAAS,WAAW,QAAQ,aAAA,KAAqC,MAAM;AAClG;AAEA,eAAe,kBACb,SACA,WACA,WACA,QACqD;CACrD,IAAI,QAAQ;CACZ,MAAM,QAAyB,CAAC;CAChC,IAAI,aAAa;CACjB,IAAI,WAAW;CACf,IAAI;CACJ,SAAS;EACP,IAAI;EACJ,IAAI;GACF,OAAO,MAAM,eAAe,SAAS;IAAE;IAAW;IAAO,GAAI,WAAW,KAAA,IAAY,EAAE,OAAO,IAAI,CAAC;GAAG,CAAC;EACxG,SACO,KAAK;GACV,IAAI,mBAAmB,GAAG,KAAK,QAAQ,GAAG;IACxC,QAAQ,KAAK,IAAI,GAAG,KAAK,MAAM,QAAQ,CAAC,CAAC;IACzC;GACF;GACA,MAAM;EACR;EAQA,MAAM,QAAQ,MAAM;EACpB,IAAI,SAAS,CAAC,cAAc,MAAM,EAAE,EAAE,SAAS,iBAAiB,KAAK,OAAO,SAAS,GACnF,MAAM,QAAQ;GAAE,MAAM;GAAa,MAAM;EAAG,CAAC;EAC/C,aAAa,KAAK,UAAU;EAC5B,aAAa,cAAc,KAAK,UAAU,KAAA;EAC1C,MAAM,QAAQ,KAAK,MAAM;EAEzB,IAAI,KAAK,WAAW,KAAA,KAAa,KAAK,UAAU,KAAM,WAAW,KAAA,KAAa,KAAK,UAAU,QAC3F;EACF,IAAI,UAAU,UAAU;GACtB,MAAM,SAAS,MAAM,KAAK;GAC1B,IAAI,OAAO,MAAM,GACf,OAAO;IAAE;IAAQ,SAAS,KAAK;GAAO;EAC1C;EACA,SAAS,KAAK;CAChB;CACA,OAAO;EAAE,QAAQ,MAAM,KAAK;EAAG,SAAS;CAAE;AAC5C;;AAGA,MAAa,qBAAqB;;AAElC,MAAa,yBAAyB;;AAYtC,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;AAmBlC,eAAsB,oBACpB,SACA,WACA,UAAkC,CAAC,GACN;CAC7B,MAAM,SAAS,EAAE,OAAO,QAAQ,aAAA,IAAgC;CAChE,KAAK,IAAI,UAAU,GAAG,WAAW,2BAA2B,WAAW;EACrE,MAAM,OAAO,MAAM,wBAAwB,SAAS,WAAW,MAAM;EACrE,IAAI,SAAS,WACX,OAAO;CACX;CACA,OAAO,eAAe,MAAM,QAAQ,gBAAgB,EAAE,UAAU,CAAC,CAAC;AACpE;AAEA,SAAS,eAAe,MAAsD;CAC5E,IAAI,CAAC,MACH,OAAO;CACT,MAAM,EAAE,SAAS,UAAU,GAAG,SAAS;CACvC,OAAO;AACT;;AAGA,eAAe,wBAAwB,SAAiC,WAAmB,QAAoE;CAC7J,MAAM,QAAuB,CAAC;CAC9B,IAAI,QAAQ;CACZ,IAAI,UAAkC;CACtC,OAAO,MAAM,SAAS,OAAO;EAC3B,IAAI;EACJ,IAAI;GACF,OAAO,MAAM,QAAQ,qBAAqB;IAAE;IAAW,MAAM,MAAM;IAAQ,OAAO,OAAO;GAAM,CAAC;EAClG,SACO,KAAK;GACV,IAAI,MAAM,WAAW,KAAK,iBAAiB,GAAG,GAC5C,OAAO,eAAe,MAAM,QAAQ,gBAAgB,EAAE,UAAU,CAAC,CAAC;GACpE,IAAI,mBAAmB,GAAG,KAAK,OAAO,QAAQ,GAAG;IAC/C,OAAO,QAAQ,KAAK,IAAI,GAAG,KAAK,MAAM,OAAO,QAAQ,CAAC,CAAC;IACvD;GACF;GACA,MAAM;EACR;EACA,IAAI,CAAC,MACH,OAAO;EACT,IAAI,YAAY,MACd,UAAU,EAAE,GAAI,KAAK,YAAY,KAAA,IAAY,EAAE,IAAI,KAAK,QAAQ,IAAI,CAAC,EAAG;OACrE,IAAI,KAAK,YAAY,QAAQ,IAChC,OAAO;EACT,QAAQ,KAAK;EAEb,IAAI,KAAK,MAAM,WAAW,GACxB;EACF,MAAM,KAAK,GAAG,KAAK,KAAK;CAC1B;CACA,MAAM,OAAO,MAAM,QAAQ,gBAAgB;EAAE;EAAW,OAAO;CAAM,CAAC;CACtE,IAAI,CAAC,MACH,OAAO;CACT,IAAI,YAAY,QAAQ,KAAK,YAAY,QAAQ,IAC/C,OAAO;CACT,OAAO;EAAE,GAAG,eAAe,IAAI;EAAI;CAAM;AAC3C;;AA6BA,MAAa,WAAW"}
|
|
1
|
+
{"version":3,"file":"protocol-BIv1Yuvl.js","names":[],"sources":["../src/ipc/protocol.ts"],"sourcesContent":["/**\n * zidane/ipc wire protocol — the transport-agnostic contract between a chat\n * host (the process that owns live `Agent` instances) and its clients (GUI\n * renderer, TUI window, `zidane attach`, …).\n *\n * The host-domain shapes (the `HostSignal` push union and everything it\n * carries) live in `src/chat/host/signals.ts` — the host must not depend on\n * `src/ipc/**`. This module re-exports them unchanged and adds the\n * transport-only contract: the typed JSON-RPC method map, session rows, and\n * the daemon handshake.\n *\n * Everything in this file is JSON-serializable: it must survive Electron's\n * structured clone AND a JSON-RPC socket hop unchanged. Canonical agent\n * types (`StreamEvent`, `InteractionRequest`, …) are re-used where they are\n * already wire-safe; host-only shapes (live `resolve` callbacks, `Map`s)\n * never appear here.\n *\n * Versioning: bump `IPC_PROTOCOL_VERSION` on any breaking change to the\n * signal union or the method map. The daemon handshake refuses mismatched\n * peers so a stale daemon never talks to an upgraded client (see\n * `daemon/lifecycle.ts`).\n */\nimport type { BrowserResponse } from '../chat/browser/protocol'\nimport type { CommandOutputBlock } from '../chat/commands'\nimport type { EnvironmentActionResult, EnvironmentActionSummary, EnvironmentRequest, EnvironmentTeardownResult, EnvironmentVerifyResult } from '../chat/environment'\nimport type { EnvironmentDescriptor, EnvironmentSettingsChange } from '../chat/environment-settings'\nimport type { CompactionReport } from '../chat/host/compaction'\nimport type { CacheImpact, CacheImpactChange, CacheReport, ContextSegmentsReport, WorkspaceListFilesOptions } from '../chat/host/engine'\nimport type { SessionLaunchOverrides } from '../chat/host/launch-overrides'\nimport type {\n CreateWorkerParams as OrchestrationCreateWorkerParams,\n WorkerRow as OrchestrationWorkerRow,\n WorkerSummary as OrchestrationWorkerSummary,\n} from '../chat/host/orchestration'\nimport type {\n CommandArgSuggestionSummary,\n CommandSummary,\n HostSettings,\n HostSignal,\n PendingInteraction,\n PromptAttachment,\n QueuedItem,\n RunningWorkItem,\n SendOptions,\n SessionPresence,\n TodosSnapshot,\n WireApprovalRequest,\n} from '../chat/host/signals'\nimport type {\n ApprovalDecision,\n ContextBreakdown,\n InteractionResponse,\n ProviderKey,\n SearchTurnResult,\n SessionEnvironmentSummary,\n SessionHeader,\n SessionHistoryMatch,\n SessionMeta,\n StreamEvent,\n SystemMdFile,\n TodoItem,\n} from '../chat/index'\nimport type { MachineInfo, MachineLinksStatus, MachineRegisterParams } from '../chat/machine-protocol'\nimport type { SyncCategory, SyncClaimResult, SyncPayload, SyncPushResult, SyncStatus } from '../chat/sync/types'\nimport type { TerminalAdoptResult, TerminalAttachResult, TerminalInfo, TerminalOpenInput, TerminalProjectOpenInput, TerminalProjectState, TerminalProjectStateInput, TerminalSessionState } from '../chat/terminal/protocol'\nimport type { ExecResult, ListFilesEntry } from '../contexts/types'\nimport type { SessionArtifact } from '../session/artifacts'\nimport type { SessionData } from '../session/index'\nimport type { JsonValue, McpServerConfig, SessionTurn, ThinkingLevel } from '../types'\nimport { isMethodNotFound } from '../chat/hosts/connection'\n\nexport type {\n ApprovalOriginator,\n CommandArgSuggestionSummary,\n CommandSummary,\n HostSettings,\n HostSignal,\n PendingInteraction,\n PromptAttachment,\n QueuedItem,\n RunningWorkItem,\n SendOptions,\n SerializedPreview,\n SessionPresence,\n TodosSnapshot,\n WireApprovalRequest,\n} from '../chat/host/signals'\n\n/** The machine protocol (`docs/MACHINES.md`), versioned on its own (`MACHINE_PROTOCOL_VERSION`). */\nexport {\n isValidMachineName,\n MACHINE_HOST_METHODS,\n MACHINE_IDEMPOTENT_METHODS,\n MACHINE_PROTOCOL_VERSION,\n MachineErrorCode,\n machineKind,\n parseMachineKind,\n} from '../chat/machine-protocol'\nexport type {\n MachineCapabilities,\n MachineHandleRef,\n MachineInfo,\n MachineMethodName,\n MachineMethods,\n MachineNotifications,\n MachineParams,\n MachineRegisterParams,\n MachineRegisterResult,\n MachineResult,\n MachineRoot,\n MachineStatusChange,\n} from '../chat/machine-protocol'\n\n/**\n * Changes since v5. Entries marked additive, or \"no version bump\", did\n * not raise the version. The current version is `IPC_PROTOCOL_VERSION`.\n *\n * - `event` signals carry an optional `echo` flag marking host-generated\n * SEND/STEER echoes of the user's own message.\n * - `chat.pushQueued` result gained the `'queued'` delivered variant.\n * - `sessions.setModel` now honors `fallbacks`: it persists the canonical\n * `metadata.modelChain` and CLEARS a previously persisted chain when\n * omitted/empty. It also accepts `effort` / `modelOptions` and resets\n * both when omitted (a pick is atomic — no stale per-model knobs).\n * - additive: `extension.emit` notification + `extension:signal` fan-out\n * (the permission-gated per-extension cross-window bus, `ctx.bus`).\n * Older daemons ignore the unknown notification; older clients drop the\n * unknown signal kind — no version bump needed.\n * - additive: `extension.emit` / `extension:signal` carry an optional\n * `nonce` (the emitter's per-process random id) so receivers dedupe on\n * `(extensionId, nonce, seq)` instead of the collision-prone\n * `(extensionId, seq)`. Older peers omit it and fall back to the\n * seq-only key — no version bump needed.\n * - `SessionRow.modelFallbacks` is now populated from the session's\n * persisted `metadata.modelChain`.\n * - Default socket path moved from `<stateDir>/daemon.sock` to the\n * dedicated `<stateDir>/daemon/daemon.sock` (dir chmod'd 0700) so the\n * daemon can harden its socket dir without touching shared state files.\n * - ADDITIVE (no version bump — older daemons answer \"method not\n * found\", clients degrade to local compute): `suggest.resolve` RPC\n * resolves inline ghost-text autocomplete daemon-side, and the\n * `suggest:changed` signal fans the result out to every OTHER peer\n * on the session so mirroring windows paint the same ghost without\n * recomputing.\n * - ADDITIVE (no version bump — optional field, older daemons simply\n * omit it and clients fall back to the single `suggestion`):\n * `suggest.resolve` results and `suggest:changed` signals carry the\n * resolver's full ordered `candidates` list so daemon mode keeps\n * ↑/↓ candidate rotation instead of degrading to one suggestion.\n * - ADDITIVE (no version bump — `optional()` swallows \"method not\n * found\" on an older daemon, which then simply keeps its stale\n * registries as before): `runtime.reload` RPC drops the daemon's\n * cached extension registries and retires live agents after a window\n * reloaded its extensions.\n * - ADDITIVE (no version bump): `terminal.registerViewer` /\n * `terminal.unregisterViewer`. The desktop app registers as a client that\n * can show terminals; agents only get terminal tools while one is\n * attached. An older daemon answers \"method not found\" (and keeps giving\n * every agent the tools, as before); an older desktop app on a newer\n * daemon never registers, so its agents run without terminal tools.\n * - ADDITIVE (no version bump): project / draft terminals\n * (docs/PROJECT-SCOPE-AUDIT.md): `terminal.projectState`,\n * `terminal.openInProject`, `terminal.adopt`, `terminal.releaseDraft`,\n * the `terminal:project-changed` signal, and `HelloResult.projectTerminals`.\n * An older daemon answers \"method not found\" and omits the flag; clients\n * then offer terminals only in sessions.\n * - ADDITIVE (no version bump): `queue.attachments` returns a queued\n * entry's attachments with their bytes, and `queue.update` accepts\n * `attachments` to replace them. An older daemon answers \"method not\n * found\" / ignores the field: the entry's attachments stay as queued.\n * - ADDITIVE (no version bump): `chat.steer` / `chat.followUp` resolve to\n * whether the message reached a live run. Older daemons resolve `null`,\n * which clients treat as delivered (the pre-existing behavior).\n * - ADDITIVE (no version bump): `sessions.fork`, `sessions.deleteTurn`,\n * `sessions.editTurnText`, `sessions.setFolder`, `sessions.appendTurns`,\n * `sessions.rewind`.\n * History and folder edits run in the host instead of being written to\n * the store by the client (then `sessions.touch` + `chat.rebuildAgent`).\n * Older clients keep the old path, which still works on a shared disk.\n * A newer client only meets an older daemon while it retires (the\n * release fence drains it otherwise), and then gets \"method not found\".\n * - ADDITIVE (no version bump): `sessions.listMeta`, `sessions.getMeta`,\n * `sessions.get`, `sessions.setExtensionState` serve a client the\n * session data it used to read and write in its own store, so a window\n * on another machine sees the host's sessions. `sessions.create` accepts `effort`, `modelOptions` and\n * `pinnedSkills`; `todos.set` accepts `persistIdle`. An older host answers\n * \"method not found\" / ignores the fields: a window falls back to the\n * store it shares with a local daemon, and refuses a remote host.\n * - ADDITIVE (no version bump): `daemon.info` reports `activeWork` (a run,\n * compaction, `/` command or background task in flight). An older host\n * omits it; `zidane server wait-idle` then says it can't tell.\n * - ADDITIVE (no version bump): `sessions.loadEvents` paging accepts\n * `beforeTurnId` (the page ends right before that turn, winning over\n * `before`; an unknown turn is invalid params) and the page echoes it.\n * An older host ignores the param and omits the echo, which is how a\n * client tells.\n * - ADDITIVE (no version bump): `sessions.cacheImpact` and\n * `sessions.cacheReport`. An older host answers \"method not found\":\n * pickers show no cache estimate and session details no Cache section.\n */\nexport const IPC_PROTOCOL_VERSION = 13\n\n/**\n * JSON-RPC error codes specific to the zidane daemon. Lives here (not in\n * `daemon/server.ts`) so clients can import the codes without pulling the\n * server's module graph.\n */\nexport const IpcErrorCode = {\n VersionMismatch: -32010,\n NotHandshaken: -32011,\n /** A network transport's per-connection request budget is spent; retry later. */\n RateLimited: -32012,\n /**\n * The reply would exceed the transport's message size: nothing was sent\n * but this error (the connection stays). Ask for less (a transcript: a\n * smaller page, see {@link loadAllEvents}).\n */\n ResponseTooLarge: -32013,\n /**\n * The handler threw: the host refused or failed the call (`message` says\n * why). Hosts before it answered -32000, which ACP uses for\n * `AuthenticationRequired`; clients treat both as a plain remote error.\n */\n HandlerFailed: -32014,\n} as const\n\n/**\n * Client heartbeat request (`{}` → `{}`), outside the method table: every\n * host answers it, before the handshake too. A host predating it answers\n * \"method not found\", which still proves it alive.\n */\nexport const PING_METHOD = '$/ping'\n\n/**\n * Session-scoped signals fanned out to every peer carry their number in\n * their session as this extra field on the `ipc.signal` params (clients\n * predating it ignore it; `IpcClient` strips it and hands it to listeners as\n * {@link SignalMeta}). Per session, from 1, gap-free within one host process.\n */\nexport const SIGNAL_SEQ_FIELD = '$seq'\n\n/** What a signal listener gets beside the signal: its number in its session, when it has one. */\nexport interface SignalMeta {\n /** Position of the signal in its session. Starts at 1 and has no gaps within one host process. */\n seq: number\n}\n\n/** A session signal with its position in the session, as kept in the host's replay log. */\nexport interface SequencedSignal {\n /** Position of the signal in its session. */\n seq: number\n /** The signal itself. */\n signal: HostSignal\n}\n\n/** Result of `sessions.resume`. On success, the signals the client missed after its last position. Otherwise the reason it must reload instead. */\nexport type SessionResumeResult\n = | { ok: true, signals: SequencedSignal[] }\n /** `epoch`: another host process numbered them. `gap`: the log no longer covers the position. */\n | { ok: false, reason: 'epoch' | 'gap' }\n\n/* -------------------------------------------------------------------------\n * Request/response methods (client → host)\n * ---------------------------------------------------------------------- */\n\n/**\n * Typed method map for the daemon transport. Keys are JSON-RPC method\n * names; each entry pins params/result so both the daemon dispatch table\n * and the client proxy are checked against the same contract.\n *\n * Scope: the chat core every client needs. Host-UI-specific surfaces\n * (folder pickers, themes, keybindings) intentionally stay client-local.\n */\nexport interface IpcMethods {\n /** `wake` is host-internal (see `SendOptions.wake`) — not accepted over the wire. */\n 'chat.send': { params: Omit<SendOptions, 'wake'>, result: { runId: string } }\n /** Aborts the session's live run. Does nothing when no run is live. */\n 'chat.interrupt': { params: { sessionId: string }, result: void }\n /** `true` when the message reached a live run; `false` when nothing was running (it was not delivered). */\n 'chat.steer': { params: { sessionId: string, message: string }, result: boolean }\n /** Adds a follow-up message to the live run. Resolves `true` when a run was live to take it, `false` when nothing was running and the message was dropped, not queued. */\n 'chat.followUp': { params: { sessionId: string, message: string }, result: boolean }\n /** Delivers a queued message. Steers a live run, otherwise starts a run or runs it as a command. `delivered` says which path it took. `keepDraft` keeps the shared composer draft instead of clearing it on the other clients. */\n 'chat.pushQueued': {\n params: { sessionId: string, message: string, activatedSkills?: string[], keepDraft?: boolean }\n result: { delivered: 'steer' | 'send' | 'command' | 'queued' }\n }\n /** Resolves `true` while the session has a live run. */\n 'chat.isRunning': { params: { sessionId: string }, result: boolean }\n /**\n * Retire the session's live agent so the next run rebuilds against\n * fresh config/credentials (MCP login, extension reload). Run-end\n * deferred when a run is in flight; HITL/queue state survives.\n */\n 'chat.rebuildAgent': { params: { sessionId: string }, result: void }\n /**\n * `zidane run --system / --mcp` for a host-backed window: launch overrides\n * for the session's agent (`ChatHost.setLaunchOverrides`), owned by the\n * calling client and dropped when it disconnects. A call with neither field clears them.\n */\n 'sessions.setLaunchOverrides': { params: { sessionId: string } & SessionLaunchOverrides, result: void }\n /**\n * Drop the daemon's cached runtime configs (extension registries, per\n * cwd) and retire every live agent so the next command or run rebuilds\n * against what is on disk now. Sent by a window after it reloaded its\n * own extensions (install, update, remove, `/reload`): extension `/`\n * commands execute daemon-side, so without this the daemon keeps\n * running the code it loaded at boot. Busy sessions rebuild at run end.\n */\n 'runtime.reload': { params: Record<string, never>, result: void }\n /**\n * Lists the tool calls and background tasks the session's live run tracks\n * and can cancel. Empty when no run is live. `children: true` adds the\n * subagents' running calls (`childId` set), for their starts: a\n * transcript read from disk times them too. Older hosts ignore it.\n */\n 'chat.listWork': { params: { sessionId: string, children?: boolean }, result: RunningWorkItem[] }\n /** Cancels one tracked work item by `id`, or every visible item with `\"all\"`. Resolves `true` when something was cancelled. `reason` is passed to a cancelled tool call. */\n 'chat.cancelWork': { params: { sessionId: string, id: string | 'all', reason?: string }, result: boolean }\n\n /** Lists session rows. `projectRoot` filters by project, `archive` picks active, archived or all sessions. */\n 'sessions.list': { params: { projectRoot?: string | null, archive?: 'active' | 'archived' | 'all' }, result: SessionRow[] }\n /**\n * The session list as a window renders it (`SessionMeta`: title, turn /\n * message / run counts, project, cwd, environment, artifact count, the\n * orchestration main flag), newest first. `projectRoot`: omitted = every\n * project, `null` = untagged sessions.\n */\n 'sessions.listMeta': { params: { projectRoot?: string | null }, result: SessionMeta[] }\n /** One `SessionMeta` by id (rows a filtered list can't return, e.g. the main); `null` when unknown. */\n 'sessions.getMeta': { params: { sessionId: string }, result: SessionMeta | null }\n /**\n * The whole session document as the host holds it: the live copy when an\n * agent is live (turns persisted mid-run, todos kept in memory), else the\n * stored one, a stale `running` marker demoted. `null` when unknown.\n */\n 'sessions.get': { params: { sessionId: string, turns?: boolean }, result: SessionDocumentHead | null }\n /**\n * A slice of a session's turns, `[from, from + limit)` (default from 0,\n * {@link SESSION_TURNS_PAGE} turns, at most {@link SESSION_TURNS_MAX_PAGE}),\n * from the same copy `sessions.get` reads, and how many turns it has: a\n * client reads a long session's document a page at a time\n * ({@link loadSessionDocument}) instead of in one reply. With\n * `sessions.get` `turns: false` (the document without its turns), what an\n * export needs. Pages and that head come from one snapshot of the\n * document per content version (read once, not per page), and name it\n * (`version`): a client that sees it change mid-load starts over rather\n * than mix two versions ({@link loadSessionDocument}). `null` when\n * unknown. Additive: an older host answers \"method not found\", ignores\n * `turns: false`, and names no version.\n */\n 'sessions.getTurns': { params: { sessionId: string, from?: number, limit?: number }, result: { turns: SessionTurn[], total: number, version?: string } | null }\n /**\n * The full text of one tool result (`callId`; `turnId`, when known, the\n * turn that holds it): what a clipped tool row shows on expand, without\n * the session crossing the wire. `null` when no such result. Additive.\n */\n 'sessions.getToolResult': { params: { sessionId: string, callId: string, turnId?: string }, result: string | null }\n /**\n * One session's header: its list row plus metadata, profile and status,\n * without turns or runs (the live copy when an agent holds it). What a\n * window re-reads on `sessions:changed`. Additive. `usage: true` adds the\n * footer's numbers, computed host-side from the turns and runs\n * (`contextTokens`, `costUsd`, and while the host runs the session\n * `runStartedAt` / `runOutputTokens`): a client needs no document for its\n * context gauge, cost pill or run readout. Older hosts ignore it.\n */\n 'sessions.getHeader': { params: { sessionId: string, usage?: boolean }, result: SessionHeader | null }\n /**\n * One key of an extension's per-session state (`metadata.extensions`, the\n * bag `ctx.session` and renderer `useSessionState` share), written by the\n * host into its copy of the session. `value` omitted deletes the key.\n */\n 'sessions.setExtensionState': { params: { sessionId: string, extension: string, key: string, value?: JsonValue }, result: void }\n /** Creates a session and resolves with its row. */\n 'sessions.create': { params: CreateSessionParams, result: SessionRow }\n /** Resolves with what happened to the session's environment (a provider may keep it). */\n 'sessions.delete': { params: { sessionId: string }, result: { environment?: EnvironmentTeardownResult } }\n /** Provision a failed (or restart-stranded) environment again. */\n 'sessions.retryEnvironment': { params: { sessionId: string }, result: void }\n /** The per-session commands the session's environment offers right now (push, open PR, …). */\n 'sessions.environmentActions': { params: { sessionId: string }, result: EnvironmentActionSummary[] }\n /** Run one of them in the session's environment (resumed when suspended). */\n 'sessions.runEnvironmentAction': { params: { sessionId: string, actionId: string }, result: EnvironmentActionResult }\n /**\n * The session's workspace (`ChatHost.workspace*`): its execution context,\n * rooted inside the environment when the files live there, else at the\n * session's cwd. Paths and exec `cwd` resolve against the root as the\n * execution context resolves them; containment is the context's own.\n * `cwd` / `env` on exec and the list / size methods are additive: an\n * older daemon ignores the former and answers \"method not found\" to the\n * latter (active clients are build-fenced, so this is a transient case).\n */\n 'sessions.workspaceExec': { params: { sessionId: string, command: string, cwd?: string, env?: Record<string, string>, timeoutSeconds?: number }, result: ExecResult }\n /**\n * The same command, streamed (`!` on a remote host): the reply names the\n * exec, its output follows as `workspace:exec:data` signals and ends with\n * one `workspace:exec:exit`, all to this connection only (signals may\n * precede the reply). Bounded per connection (concurrent commands, chunk\n * size, total output: past it the process is stopped and the exit says\n * `truncated`). A dropped connection kills what it started. Additive: an\n * older host answers \"method not found\" and clients use `workspaceExec`.\n */\n 'sessions.workspaceExecStream': { params: { sessionId: string, command: string, cwd?: string }, result: { execId: string } }\n /** Kill a streamed command's process group (this connection's only; `cancelled: false` otherwise or when it already ended). */\n 'sessions.workspaceExecCancel': { params: { execId: string }, result: { cancelled: boolean } }\n /** Reads a text file from the session's workspace. */\n 'sessions.workspaceReadFile': { params: { sessionId: string, path: string }, result: string }\n /** Writes a text file in the session's workspace. */\n 'sessions.workspaceWriteFile': { params: { sessionId: string, path: string, content: string }, result: void }\n /** Lists the entries under `path` in the session's workspace. */\n 'sessions.workspaceListFiles': { params: { sessionId: string, path: string, options?: WorkspaceListFilesOptions }, result: ListFilesEntry[] }\n /** Size in bytes of a file in the session's workspace, or `null` when it does not exist. */\n 'sessions.workspaceFileSize': { params: { sessionId: string, path: string }, result: number | null }\n /**\n * Every environment kind the host can create, described for a new session\n * in `cwd` (availability, default, branch suggestion, options — secrets\n * only as \"configured\"). What pickers and the Environments settings render.\n * `kind`: a machine kind (`local@laptop`) says `cwd` is that machine's\n * folder, checked against its roots instead of this host's\n * (`docs/MACHINES.md` § Folders); the same on `commands.*`, `catalog.*`\n * and `models.list`. Additive.\n */\n 'environments.list': { params: { cwd?: string, kind?: string }, result: EnvironmentDescriptor[] }\n /**\n * Apply one Environments-settings edit (enable, default, options,\n * secrets), validated against the kind's schema. Settings changes fan out\n * as `settings:changed`; secrets are stored host-side and never returned.\n */\n 'environments.update': { params: EnvironmentSettingsChange, result: void }\n /** \"Test connection\" for a kind with its current options. */\n 'environments.verify': { params: { kind: string }, result: EnvironmentVerifyResult }\n /** Renames a session. */\n 'sessions.setTitle': { params: { sessionId: string, title: string }, result: void }\n /**\n * Title the session ON the host: its providers and credentials (a server\n * session's transcript never goes to the window's provider), the same\n * generator (`generateSessionTitle`), written as `sessions.setTitle` does.\n * `providerKey` / `model`: the window's pick, used when the host has that\n * provider; otherwise the session's own provider and model. The Main\n * session is refused (it keeps its name). Additive: an older host answers\n * \"method not found\".\n */\n 'sessions.generateTitle': { params: { sessionId: string, providerKey?: string, model?: string }, result: { title: string } }\n /** Archives or restores a session. */\n 'sessions.setArchived': { params: { sessionId: string, archived: boolean }, result: void }\n /** Keep the session at the top of lists (`metadata.favorite`). Not activity: no recency bump. Additive. */\n 'sessions.setFavorite': { params: { sessionId: string, favorite: boolean }, result: void }\n /** Move the session to a space (`metadata.spaceId`); the Default space id clears it. See `chat/spaces`. */\n 'sessions.setSpace': { params: { sessionId: string, spaceId: string }, result: void }\n /** Switches the agent the session runs as. */\n 'sessions.setAgentId': { params: { sessionId: string, agentId: string }, result: void }\n /** Sets the thinking effort of the session. */\n 'sessions.setEffort': { params: { sessionId: string, effort: ThinkingLevel }, result: void }\n /**\n * The one model-swap contract (`ChatHost.setSessionModel`). A pick is a\n * whole: `fallbacks` (ordered, primary excluded) REPLACES the persisted\n * `metadata.modelChain` (omitted/empty clears it); `effort` and\n * `modelOptions` are reset to the supplied values (omitted clears them —\n * per-model knobs never leak onto the new model). The live agent is\n * retired so the next run rebuilds on the new pick (run-end deferred\n * while a run is in flight).\n */\n 'sessions.setModel': {\n params: {\n sessionId: string\n providerKey: ProviderKey\n modelId: string\n /** The stored account of the provider to run on (credential id); omitted = its active account. Additive. */\n account?: string\n fallbacks?: ModelFallbackRef[]\n effort?: ThinkingLevel\n modelOptions?: Record<string, boolean>\n }\n result: void\n }\n /** Replaces the model-specific boolean options of the session. */\n 'sessions.setModelOptions': { params: { sessionId: string, options: Record<string, boolean> }, result: void }\n /**\n * The session's transcript as canonical events. Without `before` / `limit`:\n * every turn, as a plain array (the shape every client predating paging\n * reads). With either: one page, `{ events, cursor? }`, the last `limit`\n * turns (default {@link LOAD_EVENTS_PAGE_TURNS}, at most\n * {@link LOAD_EVENTS_MAX_PAGE_TURNS}) before turn position `before`\n * (default: the end), its start moved back to an exchange boundary when one\n * is near so a tool call is never cut from its result. `cursor`: the\n * `before` of the previous page, absent at the first turn. Typed here as\n * the unpaged call every client makes; a paged call goes through\n * {@link loadEventsPage}. Paging is additive: an older host ignores the\n * fields and answers the whole array.\n */\n 'sessions.loadEvents': { params: { sessionId: string }, result: StreamEvent[] }\n /**\n * Reattach without a reload: the session's signals numbered after\n * `afterSeq` (see {@link SIGNAL_SEQ_FIELD}), in order, as long as this host\n * process (`epoch`, from `HelloResult.signalEpoch`) still holds them all.\n * Otherwise refused, and the client reloads with `sessions.loadEvents`.\n * Additive: an older host answers \"method not found\", same fallback.\n */\n 'sessions.resume': { params: { sessionId: string, epoch: string, afterSeq: number }, result: SessionResumeResult }\n /** One turn of a session by id, or `null` when unknown. */\n 'sessions.getTurn': { params: { sessionId: string, turnId: string }, result: SessionTurn | null }\n /** The session's context usage broken down by category, or `null` when unknown. */\n 'sessions.contextBreakdown': { params: { sessionId: string }, result: ContextBreakdown | null }\n /**\n * Artifacts one session recorded (PRs, branches, commits, files,\n * extension kinds — see `session/artifacts.ts`), newest first. Empty on\n * stores without artifact support. Additive; pre-artifact daemons\n * reject the method and clients treat that as empty.\n */\n 'sessions.artifacts': { params: { sessionId: string, kind?: string, limit?: number }, result: SessionArtifact[] }\n /**\n * Artifacts across sessions, filtered by project root (`null` = untagged\n * sessions, omitted = every project) and/or kind/uri (reverse lookup).\n */\n 'artifacts.list': { params: { projectRoot?: string | null, kind?: string, uri?: string, since?: number, limit?: number }, result: SessionArtifact[] }\n /** Remove one artifact. `false` when the store has no artifact support. Fans out `artifact:changed`. */\n 'artifacts.delete': { params: { sessionId: string, artifactId: string }, result: boolean }\n /**\n * Upsert an artifact — the lazy `resolve()` write-back (refreshed\n * `label` / `meta`). Same merge semantics as `SessionStore.upsertArtifact`;\n * `null` when the session is unknown or the store lacks support.\n */\n 'artifacts.upsert': { params: { artifact: SessionArtifact }, result: SessionArtifact | null }\n /**\n * Transcript search over ONE session, daemon-side. The daemon owns the\n * authoritative turns (live wrapper when an agent is active — fresh\n * mid-run, which a window's load-time snapshot is not) and an LRU index\n * cache shared by every window, so repeat queries pay match cost only.\n * Results come back in TURN ORDER (search is a transcript filter).\n */\n 'history.searchSession': {\n params: { sessionId: string, query: string, limit?: number }\n result: SearchTurnResult[]\n }\n /**\n * Cross-session content search, daemon-side. One RPC replaces a\n * window's per-session index/build/search round-trips — indexes are\n * built once in the daemon and shared by every window.\n */\n 'history.searchAll': {\n params: { query: string, sessionIds: string[], excerptLimit?: number }\n result: Record<string, SessionHistoryMatch>\n }\n /**\n * A window appended transcript content OUT-OF-BAND (local `/` command\n * output, `!` shell turns — written straight to the shared store, not\n * through a host run). The daemon fans out `sessions:changed` so every\n * window (issuer included) re-converges on the canonical replay NOW\n * instead of at the next run end. Sent as a notification.\n */\n 'sessions.touch': { params: { sessionId: string }, result: void }\n /** Fork at `turnId` into a new session (`ChatHost.forkSession`); announced as a `sessions:changed` create. */\n 'sessions.fork': { params: { sessionId: string, turnId: string, title?: string }, result: { id: string } }\n /** History edits (`ChatHost.deleteTurn` / `editTurnText`): refused while the session runs. */\n 'sessions.deleteTurn': { params: { sessionId: string, turnId: string }, result: void }\n /** Replaces the text of one turn. Refused while the session runs. */\n 'sessions.editTurnText': { params: { sessionId: string, turnId: string, text: string }, result: void }\n /** Cut the history at `turnId` in place (`ChatHost.rewindSession`); `inclusive` keeps the turn. Refused while the session runs. */\n 'sessions.rewind': { params: { sessionId: string, turnId: string, inclusive: boolean }, result: void }\n /** Bind to a folder, or back to a plain chat with `cwd: ''` (`ChatHost.setSessionFolder`). */\n 'sessions.setFolder': { params: { sessionId: string, cwd: string }, result: void }\n /** Turns written outside a run, e.g. `!` shell output (`ChatHost.appendTurns`). */\n 'sessions.appendTurns': { params: { sessionId: string, turns: SessionTurn[] }, result: void }\n /**\n * `ctx.appendNote` outside a run: a display-only note, rendered live and\n * persisted (`ChatHost.appendNote`). False for an unknown session or no blocks.\n */\n 'sessions.appendNote': { params: { sessionId: string, blocks: CommandOutputBlock[] }, result: boolean }\n /** Compact now (`ChatHost.compactSessionNow`): what was done, `null` when nothing was. Older daemons resolve `null`. */\n 'sessions.compact': { params: { sessionId: string }, result: CompactionReport | null }\n\n /** The session's todo list, or `null` when it has none. */\n 'todos.get': { params: { sessionId: string }, result: TodosSnapshot | null }\n /**\n * Apply a user todo edit (add / edit / remove / cycle / clear) to the\n * session the MODEL reads.\n *\n * Required because todos live in `session.metadata` and `todowrite` reads\n * them off the daemon agent's in-memory `Session`. A window writing its own\n * `Session` instance persisted an edit that the daemon never observed, so the\n * model's next `todowrite` silently overwrote it.\n *\n * Sends the whole list rather than a delta: the mutators in\n * `chat/todo-edits.ts` are already whole-list transforms, and a delta would\n * need conflict rules against a list the model rewrites concurrently.\n *\n * `null` = no live agent (or no run owns a todo slot), and the caller should\n * apply its own store-level write — race-free, since nothing is appending.\n *\n * `persistIdle`: with no live agent, the host applies the edit to the stored\n * session itself (the run the list belongs to must exist) instead of\n * answering `null`. Older hosts ignore it.\n */\n 'todos.set': { params: { sessionId: string, items: readonly TodoItem[], persistIdle?: boolean }, result: TodosSnapshot | null }\n\n /*\n * Orchestration — a pinned \"main\" session that drives other sessions\n * (\"workers\"). Feature-gated by `Settings.orchestration`; every method below\n * resolves to `null` / rejects when it is off — the main SURVIVES the toggle\n * as a persisted session, so the gate has to live on the verbs, not just on\n * discovery.\n *\n * `mainId` is load-bearing, not decorative: the host refuses any verb whose\n * `mainId` is not itself a main session. Targets are NOT limited to the\n * workers that main created — the main observes and drives the whole store —\n * but it may never target itself or another main (the depth cap).\n */\n /** The main session id, creating it (directory-less) when the setting is on and none exists. */\n 'orchestration.main': { params: Record<string, never>, result: string | null }\n /** Creates a worker session under a main session and resolves with its session id. */\n 'orchestration.createWorker': { params: { mainId: string } & OrchestrationCreateWorkerParams, result: string }\n /** Lists sessions with their live status, newest first, up to `limit`. The list can be partial. */\n 'orchestration.list': { params: { mainId: string, limit?: number }, result: OrchestrationWorkerRow[] }\n /** Summary of one session, or `null` when unknown. */\n 'orchestration.read': { params: { mainId: string, sessionId: string }, result: OrchestrationWorkerSummary | null }\n /** `wake` (default true): whether that run finishing wakes the main. */\n 'orchestration.send': { params: { mainId: string, sessionId: string, prompt: string, wake?: boolean }, result: void }\n /** Sends a steering message to a worker's live run. */\n 'orchestration.steer': { params: { mainId: string, sessionId: string, message: string }, result: void }\n /** Cancels a worker's run. */\n 'orchestration.cancel': { params: { mainId: string, sessionId: string }, result: void }\n /** The last `limit` turns of a session as plain text. */\n 'orchestration.transcript': { params: { mainId: string, sessionId: string, limit?: number }, result: string }\n\n /** Extension-contributed `/` commands discovered for `cwd`. */\n 'commands.list': { params: { cwd: string, kind?: string }, result: CommandSummary[] }\n /** Argument suggestions for `/name <prefix>` — best-effort, empty on failure. */\n 'commands.completeArgs': { params: { cwd: string, name: string, argsPrefix: string, kind?: string }, result: CommandArgSuggestionSummary[] }\n\n /** Lists pending interactions (questions and prompts the agent asked the user), optionally for one session. */\n 'interactions.list': { params: { sessionId?: string }, result: PendingInteraction[] }\n /** Answers a pending interaction. */\n 'interactions.respond': { params: { requestId: string, response: InteractionResponse }, result: { ok: boolean } }\n /** Cancels a pending interaction. `reason` is passed back to the agent. */\n 'interactions.cancel': { params: { requestId: string, reason?: string }, result: { ok: boolean } }\n /** Re-sends the session's pending interactions, for a client that connected after they were raised. */\n 'interactions.rehydrate': { params: { sessionId: string }, result: PendingInteraction[] }\n /**\n * Dev browser: a window offers to host the pages the agent's `browser_*`\n * tools drive (the GUI's main process). Released when the connection\n * drops. It then answers each `browser:request` signal addressed to it.\n */\n 'browser.registerHost': { params: { hostId: string }, result: { ok: boolean } }\n /** Withdraws a window as dev browser host. */\n 'browser.unregisterHost': { params: { hostId: string }, result: { ok: boolean } }\n /** Answers a `browser:request` signal with the host's result. */\n 'browser.respond': { params: { requestId: string, response: BrowserResponse }, result: { ok: boolean } }\n /**\n * Terminals, run by the host in the session's environment. `clientId`\n * names one view (a window's drawer or panel); views attached through a\n * connection are detached when it drops. Output arrives as\n * `terminal:output` signals; `ack` what was written to keep it flowing.\n */\n 'terminal.state': { params: { sessionId: string }, result: TerminalSessionState }\n /** Opens a terminal in a session's environment. */\n 'terminal.open': { params: TerminalOpenInput, result: TerminalInfo }\n /** Attaches a view (`clientId`) to a terminal and resolves with the output it can replay. */\n /** `maxLines` caps the history snapshot to the last lines a view can show (0 or absent: no cap). */\n 'terminal.attach': { params: { terminalId: string, clientId: string, maxLines?: number }, result: TerminalAttachResult }\n /** Detaches a view from a terminal. */\n 'terminal.detach': { params: { terminalId: string, clientId: string }, result: void }\n /** `clientId` + `response`: bytes the view's emulator generated (DSR/DA replies), dropped unless that view owns the size. */\n 'terminal.write': { params: { terminalId: string, data: string, clientId?: string, response?: boolean }, result: void }\n /** Resizes the terminal to a view's size. `claim` makes this view own the size. */\n 'terminal.resize': { params: { terminalId: string, clientId: string, cols: number, rows: number, claim?: boolean }, result: void }\n /** Acknowledges terminal output up to `offset`, so the host keeps it flowing. */\n 'terminal.ack': { params: { terminalId: string, clientId: string, offset: number }, result: void }\n /** Restarts a terminal's process and resolves with its info. */\n 'terminal.restart': { params: { terminalId: string }, result: TerminalInfo }\n /** Closes a terminal. */\n 'terminal.close': { params: { terminalId: string }, result: void }\n /** Hides a terminal from the agent, or shows it again. */\n 'terminal.setHidden': { params: { terminalId: string, hidden: boolean }, result: void }\n /**\n * This connection can show terminals (the desktop app). While at least one\n * viewer is attached, agents get the terminal tools; the registration is\n * dropped with the connection.\n */\n 'terminal.registerViewer': { params: { viewerId: string }, result: { ok: boolean } }\n /** Withdraws a viewer registered with `terminal.registerViewer`. */\n 'terminal.unregisterViewer': { params: { viewerId: string }, result: { ok: boolean } }\n /**\n * Terminals without a session: a shell on the host's machine in a\n * project's folder, or in a new-chat draft's (`draftId`). Agents never see\n * them. `terminal:project-changed` carries a scope's full list.\n */\n 'terminal.projectState': { params: TerminalProjectStateInput, result: TerminalProjectState }\n /** Opens a terminal bound to a project rather than a session. */\n 'terminal.openInProject': { params: TerminalProjectOpenInput, result: TerminalInfo }\n /** The draft became `sessionId`: its terminals move there in one pass (over the cap: back to the project). */\n 'terminal.adopt': { params: { draftId: string, sessionId: string }, result: TerminalAdoptResult }\n /** The draft was discarded (or became a server session): its terminals go back to the project. */\n 'terminal.releaseDraft': { params: { draftId: string }, result: void }\n\n /** Answers a pending approval request with a decision. */\n 'approvals.resolve': { params: { requestId: string, decision: ApprovalDecision }, result: void }\n /** Denies every pending approval, or only those of `sessionId` when given. */\n 'approvals.denyAll': { params: { sessionId?: string }, result: void }\n /** Lists the approval requests waiting for an answer. */\n 'approvals.listPending': { params: Record<string, never>, result: WireApprovalRequest[] }\n\n /**\n * Type-ahead queue, host-owned so every window sees and can manipulate\n * the same list. `queue.add` queues when a run is in flight and sends\n * immediately otherwise; the host auto-drains the queue FIFO at run end.\n */\n 'queue.list': { params: { sessionId: string }, result: QueuedItem[] }\n\n /**\n * Which `SYSTEM.md` override composes this session's prompt, for windows\n * attaching to an already-warm agent.\n *\n * The `system-md` signal fires once per agent BUILD and the daemon caches\n * agents, so the normal multi-window case (daemon already running, open a\n * second terminal or the GUI) would otherwise never learn that the built-in\n * safety and git doctrine has been replaced. `null` = no live agent yet, in\n * which case the next build broadcasts it.\n */\n 'sessions.systemMd': {\n params: { sessionId: string }\n result: { file: SystemMdFile | null, shadowed: readonly SystemMdFile[] } | null\n }\n /**\n * Every chunk of the session's system prompt with provenance — the\n * Instructions tab. Built from the live agent's assembly, so it reflects\n * MCP instructions, extension fragments and the resolved `SYSTEM.md`.\n */\n 'sessions.contextSegments': { params: { sessionId: string }, result: ContextSegmentsReport | null }\n /**\n * What a switch would cost the session's prompt cache, as the host applies\n * it (`ChatHost.cacheImpact`): what pickers show next to each option.\n * `null` without a live agent or for an empty change. Additive: an older\n * host answers \"method not found\", and clients show no estimate.\n */\n 'sessions.cacheImpact': { params: { sessionId: string, change: CacheImpactChange }, result: CacheImpact | null }\n /**\n * The session's last requests and what the cache did for each\n * (`ChatHost.cacheReport`): what `/cache` prints, for the GUI's session\n * details. `null` for an unknown session. Additive: an older host answers\n * \"method not found\".\n */\n 'sessions.cacheReport': { params: { sessionId: string, limit?: number }, result: CacheReport | null }\n /** Seed a user-scope `SYSTEM.md` from the session's doctrine; throws when an override could not apply. */\n 'sessions.createSystemOverride': { params: { sessionId: string }, result: { path: string, created: boolean } }\n /** Adds a message to the session's queue. `delivered` tells whether it was queued, sent right away, or used to steer a live run. */\n 'queue.add': {\n /**\n * `asCommand`: see `SendOptions.asCommand` — the host refuses when it cannot resolve it.\n * `keepDraft`: see `SendOptions.keepDraft` — a prompt from outside the composer.\n */\n params: { sessionId: string, text: string, activatedSkills?: string[], attachments?: PromptAttachment[], asCommand?: string, keepDraft?: boolean }\n result: { delivered: 'queued' | 'sent' | 'steer' }\n }\n /** Removes a queued entry by id. Resolves `true` when it was removed. */\n 'queue.remove': { params: { sessionId: string, id: string }, result: boolean }\n /**\n * Edit a queued entry in place; order is kept. `attachments` replaces the\n * entry's list when given. `false` when already sent / dropped.\n */\n 'queue.update': { params: { sessionId: string, id: string, text: string, attachments?: PromptAttachment[] }, result: boolean }\n /** A queued entry's attachments with their bytes; `null` when already sent / dropped. */\n 'queue.attachments': { params: { sessionId: string, id: string }, result: PromptAttachment[] | null }\n /** Steer a queued entry into the live run now (falls back to send when idle). */\n 'queue.pushNow': { params: { sessionId: string, id: string }, result: { delivered: 'steer' | 'send' | 'queued' | 'missing' } }\n\n /** Current shared draft for a session — backfill on window attach. */\n 'drafts.get': { params: { sessionId: string }, result: { text: string, shell?: boolean, attachments?: PromptAttachment[], search?: { active: boolean, query: string } } }\n /**\n * Replace the session's shared draft. Fans out `draft:changed` to every\n * OTHER peer. Ephemeral daemon state — drafts don't survive a daemon\n * restart and are cleared when any window submits the prompt.\n *\n * `shell` carries the prompt's shell mode OUT OF BAND — never encoded\n * into the text, so a literal leading `!` in a normal draft can't flip\n * other windows into shell-execution semantics.\n */\n 'drafts.set': { params: { sessionId: string, text: string, shell?: boolean }, result: void }\n /** Replace the shared draft's composing attachments (notification). */\n 'drafts.setAttachments': { params: { sessionId: string, attachments: PromptAttachment[] }, result: void }\n /** Replace the shared transcript-search state (notification, per keystroke). */\n 'search.set': { params: { sessionId: string, active: boolean, query: string }, result: void }\n /**\n * Extension bus emit from a wire client whose extensions run CLIENT-side\n * (TUI daemon mode — the extension has no host to broadcast through).\n * Sent as a notification. The daemon validates the extension id against\n * the session cwd's registry (boot registry when no `sessionId`) and the\n * `'ipc'` permission, re-validates the 64 KiB payload cap, delivers to\n * its own subscribers, and fans out `extension:signal` to every OTHER\n * peer (origin excluded — the emitter already delivered locally).\n */\n 'extension.emit': { params: { extensionId: string, sessionId?: string, payload: JsonValue, seq: number, nonce?: string }, result: void }\n /**\n * Resolve inline ghost-text autocomplete daemon-side (the typing\n * window's request IS the single computation): canonical resolver\n * against the session cwd's extension registry. Latest-wins per\n * session — a `seq` older than the newest seen returns\n * `{ suggestion: null }` without computing, and a newer request\n * aborts an in-flight compute. The result additionally fans out as\n * `suggest:changed` to every OTHER peer.\n */\n 'suggest.resolve': { params: { sessionId: string, text: string, caret: number, seq: number }, result: { suggestion: string | null, seq: number, candidates?: string[] } }\n\n /** Reads the host settings. */\n 'settings.get': { params: Record<string, never>, result: HostSettings }\n /** Applies a partial settings patch and resolves with the full settings after it. */\n 'settings.set': { params: { patch: Partial<HostSettings> }, result: HostSettings }\n\n /** Current presence snapshot — backfill for a freshly opened session list. */\n 'presence.list': { params: Record<string, never>, result: SessionPresence[] }\n /**\n * Tag the calling peer as watching a session (one per connection; the\n * TUI opens one connection per activated session). Sent as a\n * notification right after the handshake. Detach is implicit — the\n * daemon recomputes presence when the socket drops.\n */\n 'presence.watch': { params: { sessionId: string }, result: void }\n\n /**\n * Where this host lets a session's folder be: a server's workspace roots\n * (`confined`: `sessions.create` / `setFolder` refuse anything outside),\n * or the user's home on a local host (unconfined). Additive.\n */\n 'fs.roots': { params: Record<string, never>, result: FsRoots }\n /**\n * The folders in `path` (default: the first root), for a folder picker on\n * the host's machine. Only inside the roots (real paths: `..` and\n * symlinks out are refused), no dotfiles. Additive.\n */\n 'fs.listDirs': { params: { path?: string }, result: FsDirListing }\n\n /**\n * The host's provider credentials, as the host's agents use them (its\n * data dir's `credentials.json` and environment): per provider, whether\n * something is configured, its stored API key / OAuth accounts (labels,\n * which is active) and an env var it reads. Never a secret. Additive.\n */\n 'auth.status': { params: Record<string, never>, result: { providers: HostProviderAuth[] } }\n /**\n * Store an API key for one of the host's providers as its active\n * credential, apply it to the host's environment, and rebuild agents\n * (idle now, busy ones at run end). Returns the provider's new status.\n * OAuth sign-in goes through `auth.oauth.*`. Additive.\n */\n 'auth.setApiKey': { params: { provider: string, key: string }, result: HostProviderAuth }\n /**\n * Remove one stored credential (`account`: its key from `auth.status`) or,\n * without one, every stored credential of the provider; then as\n * `auth.setApiKey`. A key the host only has from its own environment is\n * left alone. Additive.\n */\n 'auth.remove': { params: { provider: string, account?: string }, result: { removed: boolean, provider: HostProviderAuth } }\n /**\n * OAuth sign-in with the browser on the CLIENT and the tokens on the host:\n * the host starts a provider's login (`provider`) or an MCP server's\n * (`mcpServer`, found in `cwd`'s catalog, as `catalog.mcps`), keeping the\n * PKCE verifier and `state`, and answers with the authorization URL.\n * `mode: 'loopback'`: the client listens at `redirectUri` (a provider's\n * fixed port; for an MCP server the loopback URI the client passed) and\n * forwards the code; `'browser'`: the client opens `url` (pasting a code if\n * the page shows one); `'device'`: shows `userCode`. The flow belongs to\n * this connection, is single-use and expires (`expiresAt`). Additive.\n */\n 'auth.oauth.begin': { params: { provider?: string, mcpServer?: string, cwd?: string, kind?: string, redirectUri?: string }, result: HostOAuthBegin }\n /**\n * Deliver the code (`code` + `state` from the loopback, or `input`: what\n * the user pasted) once, then wait for the host's token exchange; without\n * either, just wait (device and polling flows). A wrong `state` or another\n * connection's flow is refused. Tokens stay on the host: the result says\n * what changed, never a secret.\n */\n 'auth.oauth.complete': { params: { flowId: string, code?: string, state?: string, input?: string }, result: HostOAuthComplete }\n /**\n * Answer the step a flow is waiting on (`HostOAuthBegin.step` before its\n * URL, `HostOAuthComplete.step` after): a select's option id (none:\n * cancel), a prompt's text. Answers with where the flow is now: its URL, or\n * the next step. Then `complete` as before. Additive.\n */\n 'auth.oauth.respond': { params: { flowId: string, stepId: string, value?: string }, result: HostOAuthBegin }\n /** Abandon a flow of this connection. */\n 'auth.oauth.cancel': { params: { flowId: string }, result: { cancelled: boolean } }\n\n /**\n * What the host discovered for the settings tabs, each entry with whether\n * the host's settings enable it (an unset allowlist enables everything).\n * `cwd` adds the project scope of that folder (inside the workspace roots\n * on a server); without it, the user scope (the host user's home). The\n * enabled lists are written with `settings.set`. Installing, removing and\n * MCP sign-in stay on the host's machine. Additive.\n */\n 'catalog.skills': { params: { cwd?: string, kind?: string }, result: { skills: HostCatalogSkill[] } }\n /** MCP servers: `env` and `headers` values, URL credentials and query values are redacted. */\n 'catalog.mcps': { params: { cwd?: string, kind?: string }, result: { servers: HostCatalogMcp[], errors: HostCatalogError[] } }\n /** Extensions installed for `cwd`. */\n 'catalog.extensions': { params: { cwd?: string, kind?: string }, result: { extensions: HostCatalogExtension[] } }\n /** Plugins installed for `cwd`, with what each contributes. */\n 'catalog.plugins': { params: { cwd?: string, kind?: string }, result: { plugins: HostCatalogPlugin[] } }\n /**\n * Install a skill or an extension on the host, in its user's scope only\n * (`scope` may only be `'user'`): a GitHub (`owner/repo[#ref][:dir]`, a\n * GitHub URL, a skills.sh URL) or npm spec; paths are refused. `skills` /\n * `all` pick from a multi-skill source (the `multiple-candidates` error\n * lists them), `extension` from a multi-extension one. Runs the host's\n * package managers and fetches code there: a zidane-server's\n * `allowRemoteInstalls` gates it, every attempt is audited. Bounded in\n * time; the progress lines come back with the result. Every window gets\n * `catalog:changed`. Additive (`remoteInstalls` on `ipc.hello`).\n */\n 'catalog.install': { params: { kind: HostInstallKind, spec: string, scope?: 'user', skills?: string[], all?: boolean, extension?: string, overwrite?: boolean }, result: { installed: string[], message: string, progress: string[] } }\n /** Remove a user-scope skill or extension of the host by name (its directory). As `catalog.install`. */\n 'catalog.remove': { params: { kind: HostInstallKind, name: string }, result: { removed: string, message: string } }\n /** Update a user-scope extension installed from a source. As `catalog.install`. */\n 'catalog.update': { params: { kind: HostInstallKind, name: string }, result: { updated: string, upToDate: boolean, message: string } }\n /**\n * Add or replace an MCP server in the host user's `mcps.json`. Its `env` /\n * `headers` values are stored there and never come back (`catalog.mcps`\n * redacts them, the reply names the server only). As `catalog.install`.\n */\n 'mcp.upsert': { params: { config: McpServerConfig }, result: { name: string, created: boolean } }\n /** Remove an MCP server from the host user's `mcps.json`; `removed: false` when it has none. As `catalog.install`. */\n 'mcp.remove': { params: { name: string }, result: { removed: boolean } }\n /**\n * The host's credentialed providers (what its agents can run) and their\n * models, for a model picker of a session on that host. `cwd` adds the\n * providers its extensions contribute there. Additive.\n */\n 'models.list': { params: { cwd?: string, kind?: string }, result: { providers: HostModelProvider[] } }\n /**\n * Send one tiny decision with this host's credentials, to check a decision\n * model works. `model` is `\"providerKey/modelId\"`, tested exactly; omitted =\n * the host's `Settings.decisionModel` (or the first available). Never\n * fails: a broken model comes back as `ok: false` with a reason. Additive.\n */\n 'decisions.test': { params: { cwd?: string, kind?: string, model?: string }, result: HostDecisionTestResult }\n /**\n * Send one tiny prompt with this host's credentials, to check a chat model\n * answers. `model` is `\"providerKey[@account]/modelId\"`, tested exactly.\n * Never fails: a broken model comes back as `ok: false` with a reason.\n * Additive.\n */\n 'models.test': { params: { cwd?: string, kind?: string, model: string }, result: HostModelTestResult }\n\n /**\n * The machines this host knows (`docs/MACHINES.md`), online or not, and\n * forgetting one (it disconnects; its `local@` / `worktree@` kinds stop\n * resolving). Additive.\n */\n 'machines.list': { params: Record<string, never>, result: MachineInfo[] }\n /** Forgets a machine. It disconnects and its kinds stop resolving. */\n 'machines.forget': { params: { machineId: string }, result: { forgotten: boolean } }\n /**\n * Folders of a machine, for a client's folder picker: the host proxies a\n * listing to the machine (`fs.list`, confined to its roots there): the\n * folders in `path` (absent: its first root), and every root. Additive.\n */\n 'machines.listDirs': { params: { machineId: string, path?: string }, result: { path: string, dirs: string[], roots: string[] } }\n /**\n * A local host's machine links (`docs/MACHINES.md` § Client UI), behind\n * remote hosts: share this computer with a saved server (the machine agent\n * runs in this host's process, with the machine token `token` or the one\n * already stored for that server), stop sharing, use a saved server as a\n * machine (reverse direction), and read their state. Refused while remote\n * hosts are off. Additive.\n */\n 'machines.share.start': { params: { hostId: string, name: string, roots: string[], token?: string }, result: MachineLinksStatus }\n /** Stops sharing this computer with a server. */\n 'machines.share.stop': { params: { hostId: string }, result: MachineLinksStatus }\n /** Turns on or off using a server as this computer's linked server. */\n 'machines.useServer': { params: { hostId: string, enabled: boolean }, result: MachineLinksStatus }\n /** State of this host's machine links: the shares it offers and the servers it uses. */\n 'machines.links.status': { params: Record<string, never>, result: MachineLinksStatus }\n /**\n * Reverse direction (`docs/MACHINES.md` § Reverse direction): a client asks\n * this server to lend itself as a machine over this very connection\n * (`allowAsMachine` on, else refused). `hostId` names the asking host, so\n * a reconnect finds its tasks and terminals again. Then `machine.call`\n * carries each host→machine request (`MachineMethods`), answered by the\n * server's confined executor; machine notifications come back as\n * `machine:notification` signals on this connection only.\n */\n 'machine.attach': { params: { hostId: string }, result: MachineRegisterParams }\n /** Runs one machine-protocol method on this server's executor and resolves with its JSON result. Refused when the server does not lend itself as a machine. */\n 'machine.call': { params: { method: string, params?: JsonValue }, result: JsonValue }\n /** Ends this connection's machine attachment. `detached` is `false` when it had none. */\n 'machine.detach': { params: Record<string, never>, result: { detached: boolean } }\n /**\n * Mint a `machine`-scoped token on this server (a zidane-server only), so\n * a window can share its computer in one step. Any client may: in the\n * single-user model a client token is already an admin's. Audited.\n */\n 'tokens.createMachineToken': { params: { name: string }, result: { id: string, name: string, token: string } }\n\n /**\n * Settings sync, a client's computer → this server (`docs/SERVER.md`\n * § Settings sync). A zidane-server only; other hosts refuse. One source\n * device per server: `sync.claim` makes the caller it (or says who is,\n * unless `takeover`), `sync.push` applies one category's snapshot through\n * the host's own setters, skipping fields edited here since (overrides),\n * `sync.reset` drops an override, `sync.release` stops the source. Every\n * call is audited with its token. Additive.\n */\n 'sync.status': { params: Record<string, never>, result: SyncStatus }\n /** Makes the caller the settings source device. When another device is the source, the result says which, unless `takeover` is set. `categories` and `keys` narrow what it syncs. */\n 'sync.claim': { params: { deviceId: string, deviceName: string, takeover?: boolean, categories?: SyncCategory[], keys?: string[] }, result: SyncClaimResult }\n /** Applies one category's snapshot from the source device. */\n 'sync.push': { params: { deviceId: string, category: SyncCategory, payload: SyncPayload }, result: SyncPushResult }\n /** Drops the local override of one field so sync applies to it again. */\n 'sync.reset': { params: { field: string }, result: { reset: boolean } }\n /** Stops the source device's sync. */\n 'sync.release': { params: { deviceId: string }, result: { released: boolean } }\n\n /** Daemon identity and version: `protocolVersion`, `appVersion`, `pid`, `startedAt` and the host identity fields of the `hello` result. */\n 'daemon.info': { params: Record<string, never>, result: HelloResult }\n /**\n * Graceful drain: deny pending approvals, abort live runs, close the\n * socket. Used by clients that detect a protocol-version mismatch and\n * need the stale daemon gone before respawning.\n *\n * `whenIdle` (version-skew retirement): a daemon with active work does\n * NOT abort it. It answers `{ deferred: true }` and exits once idle.\n * Explicit stops (`zidane daemon stop`) omit it and drain immediately.\n * Daemons predating the flag ignore it and drain immediately.\n */\n 'daemon.shutdown': { params: { whenIdle?: boolean }, result: { deferred?: boolean } | void }\n}\n\n/**\n * The host's identity from a hello (or `daemon.info`) reply; `null` from a host that predates it.\n * @param hello - The `hello` or `daemon.info` result.\n * @returns The host reference, or `null` when the reply carries no host id or kind.\n */\nexport function hostRefOf(hello: HelloResult): HostRef | null {\n if (typeof hello.hostId !== 'string' || !hello.hostKind)\n return null\n return { id: hello.hostId, kind: hello.hostKind, name: hello.hostName ?? hello.hostId }\n}\n\n/** Name of any method in {@link IpcMethods}. */\nexport type IpcMethodName = keyof IpcMethods\n/** Params type of the method `M` in {@link IpcMethods}. */\nexport type IpcParams<M extends IpcMethodName> = IpcMethods[M]['params']\n/** Result type of the method `M` in {@link IpcMethods}. */\nexport type IpcResult<M extends IpcMethodName> = IpcMethods[M]['result']\n\n/** Turns per `sessions.loadEvents` page when only `before` is given. */\nexport const LOAD_EVENTS_PAGE_TURNS = 200\n/** Largest `limit` a host honors. */\nexport const LOAD_EVENTS_MAX_PAGE_TURNS = 1000\n\n/** Paging options of `sessions.loadEvents`. */\nexport interface LoadEventsPaging {\n /** Turn position (exclusive) the page ends at: a previous page's `cursor`. */\n before?: number\n /** Turns in the page. */\n limit?: number\n /**\n * The page ends right before the turn with this id (same alignment as\n * `before` at its position); wins over `before`. A turn the stored\n * transcript doesn't hold fails the request (invalid params, the message\n * names `beforeTurnId`). An older host ignores it: see\n * {@link SessionEventsPage.beforeTurnId}.\n */\n beforeTurnId?: string\n}\n\n/** One page of a session's stream events, as `sessions.loadEvents` answers it. */\nexport interface SessionEventsPage {\n /** Stream events of the page. */\n events: StreamEvent[]\n /** Pass as `before` for the page before this one; absent once the first turn is in. */\n cursor?: number\n /**\n * The events are this page's slice of the whole replay, so pages\n * concatenate to exactly one whole `loadEvents`. Absent from an older\n * host, whose pages replay on their own ({@link loadAllEvents} restores\n * the exchange separator at their joins).\n */\n exact?: true\n /**\n * With `exact`: how many events of the whole replay come before this\n * page. Lets a client open on the tail of a long transcript and still\n * say how much it left out ({@link loadEventsTail}). Absent from an\n * older host.\n */\n start?: number\n /**\n * The request's `beforeTurnId`, echoed: absent when the host ignored\n * the anchor (an older host, which then paged by `before` / from the end).\n */\n beforeTurnId?: string\n}\n\n/**\n * One page of `sessions.loadEvents` (see its paging). An older host answers\n * the whole transcript: it comes back as one page with no cursor.\n * @param request - Sends `sessions.loadEvents` to the host.\n * @param params - Session id and paging.\n * @returns The page, normalized from either host reply shape.\n */\nexport async function loadEventsPage(\n request: (method: 'sessions.loadEvents', params: { sessionId: string }) => Promise<StreamEvent[]>,\n params: { sessionId: string } & LoadEventsPaging,\n): Promise<SessionEventsPage> {\n const result = await request('sessions.loadEvents', params) as StreamEvent[] | SessionEventsPage\n return Array.isArray(result) ? { events: result } : result\n}\n\nfunction isResponseTooLarge(err: unknown): boolean {\n return typeof err === 'object' && err !== null && (err as { code?: unknown }).code === IpcErrorCode.ResponseTooLarge\n}\n\n/**\n * A session's whole transcript, loaded a page at a time from the end so no\n * single reply carries it all (a long session with images can outgrow a\n * transport's message size). A page refused as too large is asked again at\n * half the turns, down to one; a single turn that still doesn't fit fails\n * the load. An older host answers the whole transcript to the first call.\n * @param request - Sends `sessions.loadEvents` to the host.\n * @param sessionId - Session to load.\n * @param options - Paging options.\n * @param options.pageTurns - Turns per page to start with.\n * @returns Every stream event of the session.\n */\nexport async function loadAllEvents(\n request: (method: 'sessions.loadEvents', params: { sessionId: string }) => Promise<StreamEvent[]>,\n sessionId: string,\n options: { pageTurns?: number } = {},\n): Promise<StreamEvent[]> {\n return (await loadEventsFromEnd(request, sessionId, options.pageTurns ?? LOAD_EVENTS_PAGE_TURNS)).events\n}\n\n/**\n * The end of a session's transcript: pages from the end until `enough`\n * holds for what was loaded (or the first turn is in), and how many events\n * of the whole replay come before it (`earlier`). Only exact pages can stop\n * early, since only they say where they start: an older host's transcript\n * loads whole, with `earlier` 0.\n */\nexport async function loadEventsTail(\n request: (method: 'sessions.loadEvents', params: { sessionId: string }) => Promise<StreamEvent[]>,\n sessionId: string,\n enough: (events: readonly StreamEvent[]) => boolean,\n options: { pageTurns?: number } = {},\n): Promise<{ events: StreamEvent[], earlier: number }> {\n return loadEventsFromEnd(request, sessionId, options.pageTurns ?? LOAD_EVENTS_PAGE_TURNS, enough)\n}\n\nasync function loadEventsFromEnd(\n request: (method: 'sessions.loadEvents', params: { sessionId: string }) => Promise<StreamEvent[]>,\n sessionId: string,\n pageTurns: number,\n enough?: (events: readonly StreamEvent[]) => boolean,\n): Promise<{ events: StreamEvent[], earlier: number }> {\n let limit = pageTurns\n const pages: StreamEvent[][] = []\n let newerExact = false\n let allExact = true\n let before: number | undefined\n for (;;) {\n let page: SessionEventsPage\n try {\n page = await loadEventsPage(request, { sessionId, limit, ...(before !== undefined ? { before } : {}) })\n }\n catch (err) {\n if (isResponseTooLarge(err) && limit > 1) {\n limit = Math.max(1, Math.floor(limit / 2))\n continue\n }\n throw err\n }\n /*\n * An exact page is a slice of the whole replay: nothing to restore. An\n * older host's pages replay on their own, so the exchange separator a\n * whole replay puts before a prompt that follows an exchange is missing\n * where the newer page starts (its pages start at a prompt when they\n * can): put it back.\n */\n const newer = pages[0]\n if (newer && !newerExact && newer[0]?.kind === 'user-prompt' && page.events.length > 0)\n newer.unshift({ kind: 'separator', text: '' })\n newerExact = page.exact === true\n allExact &&= newerExact && page.start !== undefined\n pages.unshift(page.events)\n // Done at the first turn; a cursor that doesn't move back would loop.\n if (page.cursor === undefined || page.cursor <= 0 || (before !== undefined && page.cursor >= before))\n break\n if (enough && allExact) {\n const events = pages.flat()\n if (enough(events))\n return { events, earlier: page.start! }\n }\n before = page.cursor\n }\n return { events: pages.flat(), earlier: 0 }\n}\n\n/** Turns per `sessions.getTurns` page by default. */\nexport const SESSION_TURNS_PAGE = 200\n/** Largest `limit` a host honors for `sessions.getTurns`. */\nexport const SESSION_TURNS_MAX_PAGE = 1000\n\ntype SessionDocumentRequest = <M extends 'sessions.get' | 'sessions.getTurns'>(method: M, params: IpcParams<M>) => Promise<IpcResult<M>>\n\n/**\n * What `sessions.get` answers: the document; with `turns: false`, the\n * version of the snapshot it was cut from, the one `sessions.getTurns`\n * pages carry.\n */\nexport type SessionDocumentHead = SessionData & { version?: string }\n\n/** How many times a paged read starts over because the session changed under it, before it asks for the whole document in one reply. */\nconst SESSION_DOCUMENT_RESTARTS = 3\n\n/**\n * A session's whole document, read a page of turns at a time so no reply\n * carries it all (`sessions.getTurns` pages, then the `sessions.get`\n * `turns: false` head; a page refused as too large is asked again at half\n * the turns). Every page and the head name the snapshot they come from: a\n * version change mid-read (a turn appended, a compaction) starts the read\n * over, so the result is one version, never pages of two. After\n * {@link SESSION_DOCUMENT_RESTARTS} restarts (a session busier than the\n * read), the whole document comes in one reply. A host that predates\n * `sessions.getTurns` sends it that way too; one that names no version is\n * read as before. `null` when the host doesn't know the session.\n * @param request - Sends `sessions.get` and `sessions.getTurns` to the host.\n * @param sessionId - Session to read.\n * @param options - Paging options.\n * @param options.pageTurns - Turns per page to start with.\n * @returns The session document, or `null` when unknown.\n */\nexport async function loadSessionDocument(\n request: SessionDocumentRequest,\n sessionId: string,\n options: { pageTurns?: number } = {},\n): Promise<SessionData | null> {\n const paging = { limit: options.pageTurns ?? SESSION_TURNS_PAGE }\n for (let attempt = 0; attempt <= SESSION_DOCUMENT_RESTARTS; attempt++) {\n const read = await readSessionDocumentOnce(request, sessionId, paging)\n if (read !== 'changed')\n return read\n }\n return withoutVersion(await request('sessions.get', { sessionId }))\n}\n\nfunction withoutVersion(head: SessionDocumentHead | null): SessionData | null {\n if (!head)\n return null\n const { version: _version, ...data } = head\n return data\n}\n\n/** One paged read; `'changed'`: the version moved between two of its replies. */\nasync function readSessionDocumentOnce(request: SessionDocumentRequest, sessionId: string, paging: { limit: number }): Promise<SessionData | null | 'changed'> {\n const turns: SessionTurn[] = []\n let total = Infinity\n let version: { of?: string } | null = null\n while (turns.length < total) {\n let page: IpcResult<'sessions.getTurns'>\n try {\n page = await request('sessions.getTurns', { sessionId, from: turns.length, limit: paging.limit })\n }\n catch (err) {\n if (turns.length === 0 && isMethodNotFound(err))\n return withoutVersion(await request('sessions.get', { sessionId }))\n if (isResponseTooLarge(err) && paging.limit > 1) {\n paging.limit = Math.max(1, Math.floor(paging.limit / 2))\n continue\n }\n throw err\n }\n if (!page)\n return null\n if (version === null)\n version = { ...(page.version !== undefined ? { of: page.version } : {}) }\n else if (page.version !== version.of)\n return 'changed'\n total = page.total\n // A session that shrank meanwhile on a host that names no version ends the read where it is.\n if (page.turns.length === 0)\n break\n turns.push(...page.turns)\n }\n const head = await request('sessions.get', { sessionId, turns: false })\n if (!head)\n return null\n if (version !== null && head.version !== version.of)\n return 'changed'\n return { ...withoutVersion(head)!, turns }\n}\n\n/** A catalog entry's on/off state as the host's settings decide it. */\ninterface HostCatalogToggle {\n name: string\n /** The host's settings enable it (always `false` for an entry that cannot load). */\n enabled: boolean\n /**\n * Its own allowlist governs it (`enabledSkills`, …). `false`: contributed\n * by a plugin or extension (their toggle governs it), or broken.\n */\n toggleable: boolean\n}\n\n/** A skill in the host's catalog. */\nexport interface HostCatalogSkill extends HostCatalogToggle {\n /** What the skill is for. */\n description: string\n /** Where the skill was found. */\n source?: 'project' | 'user' | 'inline' | 'builtin'\n /** `SKILL.md` on the host's machine. */\n location?: string\n /** `disk`: a scan path; else the plugin or extension that contributes it (`contributedBy`). */\n origin: 'disk' | 'plugin' | 'extension'\n /** Name of the plugin or extension that contributes the skill, when `origin` is not `disk`. */\n contributedBy?: string\n}\n\n/** Every secret-bearing value of a catalog entry is replaced by this. */\nexport const REDACTED = '<redacted>'\n\n/** An MCP server in the host's catalog. Secret values are redacted. */\nexport interface HostCatalogMcp extends HostCatalogToggle {\n /** How the server is reached. */\n transport: 'stdio' | 'sse' | 'streamable-http'\n /** Whether the config is the project's or the user's. */\n source: 'project' | 'user'\n /** The config file on the host's machine. */\n path: string\n /** Command that starts a `stdio` server. */\n command?: string\n /** Arguments of the command. */\n args?: string[]\n /** Credentials and query values redacted. */\n url?: string\n /** Working directory of the command. */\n cwd?: string\n /** `context` runs the server in the agent's execution context. `host` runs it on the host. */\n scope?: 'host' | 'context'\n /** `oauth` when the server signs in with OAuth. */\n auth?: 'oauth'\n /** Names only: every value is {@link REDACTED}. */\n env?: Record<string, string>\n /** Header names. Every value is {@link REDACTED}. */\n headers?: Record<string, string>\n}\n\n/** A config file that failed to parse (or an informational skip). */\nexport interface HostCatalogError {\n /** Path of the config file. */\n path: string\n /** Whether the file is the project's or the user's. */\n source: 'project' | 'user'\n /** Why it failed or was skipped. */\n message: string\n /** `true` when the entry is a skip notice, not a failure. */\n informational?: boolean\n}\n\n/** An extension in the host's catalog. */\nexport interface HostCatalogExtension extends HostCatalogToggle {\n /** Where the extension was found. */\n source: 'user' | 'project' | 'inline' | 'builtin'\n /** Version from the extension manifest. */\n version?: string\n /** What the extension does. */\n description?: string\n /** Directory of the extension on the host's machine. */\n dir?: string\n /** Why it did not load. */\n error?: string\n /** What it contributes: `tools`, `skills`, `mcps`, `commands`, … */\n capabilities?: string[]\n}\n\n/** A plugin in the host's catalog. */\nexport interface HostCatalogPlugin extends HostCatalogToggle {\n /** Where the plugin comes from: a directory on disk, or an extension. */\n origin: { kind: 'disk', scope: 'project' | 'user', dir: string } | { kind: 'extension', extensionName: string, dir: string }\n /** `false`: the manifest was rejected (`error` says why). */\n ok: boolean\n /** Version from the plugin manifest. */\n version?: string\n /** What the plugin does. */\n description?: string\n /** Names of the skills the plugin contributes. */\n skills: string[]\n /** Names of the MCP servers the plugin contributes. */\n mcpServers: string[]\n /** Why the manifest was rejected, when `ok` is `false`. */\n error?: string\n}\n\n/** One provider a host can run, with its models (`models.list`). */\nexport interface HostModelProvider {\n /** Provider key. */\n key: string\n /** Display name. */\n label: string\n /** Models the provider offers on this host. */\n models: HostModelInfo[]\n /**\n * The host's stored accounts of the provider a session can be pinned to\n * (`ProviderAuth.accounts`), when it has several. Ids are the host's own:\n * a pick on a server names one of its accounts. Additive.\n */\n accounts?: Array<{ id: string, label: string, active: boolean }>\n /**\n * Decision models of the provider's Decisions endpoint, with whether this\n * host's credentials can use them. Absent on providers without one, and\n * from hosts that predate decisions. Additive.\n */\n decisionModels?: HostDecisionModel[]\n /**\n * Image models of the provider's image endpoint, with whether this host's\n * credentials can use them. Absent on providers without one, and from\n * hosts that predate image generation. Additive.\n */\n imageModels?: HostImageModel[]\n}\n\n/** One image model a host's provider serves (`HostModelProvider.imageModels`). */\nexport interface HostImageModel {\n id: string\n name: string\n /** The model takes reference images. */\n references: boolean\n /** The model can return a transparent background. */\n transparency: boolean\n available: boolean\n reason?: string\n /** The model `generate_image` uses while no image model is picked. Additive. */\n isDefault?: boolean\n}\n\n/** `decisions.test`: how the probe decision went. */\nexport interface HostDecisionTestResult {\n ok: boolean\n provider?: string\n model?: string\n durationMs: number\n reason?: string\n message?: string\n}\n\n/** `models.test`: how the probe prompt went, in the fields of `decisions.test`. */\nexport type HostModelTestResult = HostDecisionTestResult\n\n/** One decision model a host's provider serves (`models.list`). */\nexport interface HostDecisionModel {\n id: string\n available: boolean\n reason?: string\n}\n\n/** `ModelInfo` as it crosses the wire. */\nexport interface HostModelInfo {\n /** Model id. */\n id: string\n /** Display name. */\n name?: string\n /** Context window in tokens. */\n contextWindow: number\n /** Maximum output tokens. */\n maxTokens?: number\n /** Whether the model supports reasoning. */\n reasoning?: boolean\n /** Input kinds the model accepts. */\n input?: ('text' | 'image')[]\n /** Price per million tokens, by token kind. */\n cost?: { input: number, output: number, cacheRead?: number, cacheWrite?: number }\n /** Provider that serves the model. */\n provider?: string\n /** Model-specific boolean options, with an optional cost multiplier per token kind. */\n options?: { id: string, label: string, description?: string, costMultiplier?: { input?: number, output?: number, cacheRead?: number, cacheWrite?: number } }[]\n}\n\n/** One credential source of a host's provider (`auth.status`); no secret. */\nexport interface HostAuthMethod {\n /** Where the credential comes from: a stored API key, an OAuth login, or an environment variable. */\n source: 'apikey' | 'oauth' | 'env'\n /** A stored credential the provider resolves (`env` never is). */\n active: boolean\n /** Credentials-file key of a stored credential: the `account` of `auth.remove`. */\n key?: string\n /** OAuth account name. */\n label?: string\n /** Display detail: `credentials.json`, an OAuth account and its expiry, an env var name. */\n detail: string\n}\n\n/**\n * A question the provider's sign-in asks before (or after) its URL: a choice\n * between flows, or a free text. The client shows it and answers with\n * `auth.oauth.respond`; the host never picks for the user.\n */\nexport type HostOAuthStep\n = | { id: string, kind: 'select', message: string, options: Array<{ id: string, label: string }> }\n | { id: string, kind: 'prompt', message: string, placeholder?: string, allowEmpty?: boolean }\n\n/** Result of `auth.oauth.begin`. */\nexport interface HostOAuthBegin {\n /** Random, single-use, bound to the connection that began it. */\n flowId: string\n /** The authorization URL (a device flow: its verification URL); `''` while a `step` comes first. */\n url: string\n /** How the client gets the code back. `step`: answer `step` (`auth.oauth.respond`) before the URL exists. */\n mode: 'loopback' | 'browser' | 'device' | 'step'\n /** A question to answer before the URL exists. Set when `mode` is `step`. */\n step?: HostOAuthStep\n /** `loopback`: where the browser is sent back, on the client's machine. */\n redirectUri?: string\n /** `device`: the code to enter at `url`. */\n userCode?: string\n /** Text to show the user while they sign in. */\n instructions?: string\n /** Epoch ms: the host forgets the flow after it. */\n expiresAt: number\n}\n\n/** `auth.oauth.complete`: the outcome, never a token. */\nexport interface HostOAuthComplete {\n /** A provider sign-in: its new status. */\n provider?: HostProviderAuth\n /** An MCP server sign-in: its name. */\n mcpServer?: string\n /** Not finished: the sign-in asks this. Answer it (`auth.oauth.respond`), then `complete` again. */\n step?: HostOAuthStep\n}\n\n/** Sign-in state of one provider on a host, from `auth.status`. Holds no secret. */\nexport interface HostProviderAuth {\n /** Provider key. */\n key: string\n /** Display name. */\n label: string\n /** Some credential source is present. */\n configured: boolean\n /** The provider signs in with OAuth (on the host's machine only). */\n oauth: boolean\n /** The env var it reads, when it declares one. */\n envKey?: string\n /** Credential sources of the provider. */\n methods: HostAuthMethod[]\n}\n\n/** Folders a host lets clients browse, from `fs.roots`. */\nexport interface FsRoots {\n /** Real paths, the default first. */\n roots: string[]\n /** Session folders must be inside `roots` (a server). */\n confined: boolean\n}\n\n/** One folder in an {@link FsDirListing}. */\nexport interface FsDirEntry {\n /** Folder name. */\n name: string\n /** Real path (a symlink resolved). */\n path: string\n /** Holds a `.git`. */\n isGitRepo: boolean\n}\n\n/** A folder listing from `fs.listDirs`. */\nexport interface FsDirListing {\n /** Real paths of the browsable roots. */\n roots: string[]\n /** The listed folder, as a real path. */\n path: string\n /** The folder above, or `null` at a root. */\n parent: string | null\n /** Sorted by name. */\n entries: FsDirEntry[]\n /** More folders than the listing returns. */\n truncated?: boolean\n}\n\n/** One ordered model-fallback target (primary excluded). */\nexport interface ModelFallbackRef {\n /** Provider of the fallback model. */\n providerKey: ProviderKey\n /** Id of the fallback model. */\n modelId: string\n /** The stored account of the provider (credential id); omitted = its active account. Additive. */\n account?: string\n}\n\n/** One row of a cross-window session list. */\nexport interface SessionRow {\n /** Session id. */\n id: string\n /** Session title. */\n title: string\n /** Project the session belongs to, or `null` when it has none. */\n projectRoot: string | null\n /** Working directory of the session. */\n cwd: string\n /** Id of the agent the session runs as. */\n agentId?: string\n /** Run state of the session. */\n status: 'idle' | 'running' | 'completed' | 'error'\n /** Creation time, epoch ms. */\n createdAt: number\n /** Time of the last change, epoch ms. */\n updatedAt: number\n /** Whether the session is archived. */\n archived: boolean\n /** Listed first (`metadata.favorite`). Additive. */\n favorite?: boolean\n /** Orchestration main session — see `SessionMeta.isMain`. Additive. */\n isMain?: boolean\n /** The session's space when not Default — see `SessionMeta.spaceId`. Additive. */\n spaceId?: string\n /** Provider the session runs on. */\n providerKey?: ProviderKey\n /** Model the session runs on. */\n modelId?: string\n /** The pinned account of `providerKey` (credential id), when one is. Additive. */\n account?: string\n /** Thinking effort of the session. */\n effort?: ThinkingLevel\n /** Model-specific boolean options of the session. */\n modelOptions?: Record<string, boolean>\n /** Validated (head-matched) fallback chain tail, for pickers/badges. */\n modelFallbacks?: ModelFallbackRef[]\n /** Non-local environment summary (kind, state, branch, error). */\n environment?: SessionEnvironmentSummary\n /** The host serving this row (`HelloResult.hostId`). Additive: absent from older hosts. */\n hostId?: string\n /**\n * While `status` is `running`: when the run in progress began, epoch ms on\n * the host's clock, so a client that missed its `run:start` still shows how\n * long it has been going. Additive: absent from older hosts.\n */\n runStartedAt?: number\n}\n\n/** Params of `sessions.create`. */\nexport interface CreateSessionParams {\n /** Tool-execution directory — `projectRoot` is derived from it host-side. */\n cwd: string\n /** Title of the session. Omitted: the host picks one. */\n title?: string\n /** Id of the agent the session runs as. */\n agentId?: string\n /** Provider the session runs on. */\n providerKey?: ProviderKey\n /** Model the session runs on. */\n modelId?: string\n /** The stored account of `providerKey` to run on (credential id). Additive: older hosts ignore it. */\n account?: string\n /** Seed an ordered fallback chain alongside the model pick. */\n fallbacks?: ModelFallbackRef[]\n /** The model pick's reasoning effort and options, stamped with it. */\n effort?: ThinkingLevel\n /** Model-specific boolean options, stamped with the model pick. */\n modelOptions?: Record<string, boolean>\n /** Skills pinned from the first turn (an authoring session's docs skill). */\n pinnedSkills?: string[]\n /** Mark as an extension-authoring session (auto-activates the docs skill). */\n extensionEdit?: boolean\n /** Mark as a skill-authoring session for the named skill (dir = `cwd`). */\n skillEdit?: { name: string }\n /** Where the session's work happens. Omitted → local. */\n environment?: EnvironmentRequest\n /** The space the session belongs to. Omitted → Default. Additive: older hosts ignore it. */\n spaceId?: string\n /** Create it as a hidden `/side` session of this parent. Additive: older hosts ignore it. */\n sideOf?: string\n}\n\n/* -------------------------------------------------------------------------\n * Daemon handshake\n * ---------------------------------------------------------------------- */\n\n/** Params of the `hello` handshake. */\nexport interface HelloParams {\n /** Protocol version the client speaks. */\n protocolVersion: number\n /** Client's zidane version — surfaced in daemon diagnostics. */\n appVersion: string\n /** Process id of the client. */\n pid: number\n /**\n * Build fingerprint (module mtime; `'unknown'` in compiled binaries).\n * When BOTH sides report a real id and they differ, the daemon rejects\n * the handshake like a protocol-version mismatch — the client drains it\n * and respawns. Closes same-version code drift during development.\n */\n buildId?: string\n /**\n * Version of the zidane code the client runs (`ZIDANE_VERSION`, inlined at\n * build). Unlike `buildId` this survives compiled binaries, so it closes\n * the gap released builds had: same protocol version, older code. A\n * client STRICTLY NEWER than the daemon is rejected like a build mismatch\n * and the stale daemon is drained; an older client is accepted and\n * degrades via `optional()`.\n */\n codeVersion?: string\n}\n\n/**\n * What a host process is: a window's own (`in-process`), the local shared\n * daemon (`daemon`), or a remote `zidane-server` (`server`).\n */\nexport type HostKind = 'in-process' | 'daemon' | 'server'\n\n/** Which host a client is talking to, as clients keep it (from `hostRefOf`). */\nexport interface HostRef {\n /** Stable across restarts: persisted in the host's data dir. */\n id: string\n /** What kind of host it is. */\n kind: HostKind\n /** Display name: the machine's hostname by default. */\n name: string\n}\n\n/** Result of the `hello` handshake and of `daemon.info`. */\nexport interface HelloResult {\n /** Protocol version the host speaks. */\n protocolVersion: number\n /** zidane version of the host. */\n appVersion: string\n /** Process id of the host. */\n pid: number\n /** Start time of the host process, epoch ms. */\n startedAt: number\n /** Build fingerprint of the host code. `'unknown'` in compiled binaries. */\n buildId?: string\n /** Version of the zidane code the host runs. */\n codeVersion?: string\n /**\n * Host identity (additive). `hostId` is a UUID persisted once in the host's\n * data dir, so it survives restarts; the in-process host and the local\n * daemon share the data dir, and so the id: they are the same computer.\n */\n hostId?: string\n /** What kind of host this is. */\n hostKind?: HostKind\n /** Display name of the host. */\n hostName?: string\n /**\n * The daemon is older than a client that attached while it had active\n * work: it accepted the handshake instead of draining (which would abort\n * those runs) and exits once idle. Clients attach normally; their\n * reconnect path lands on a fresh daemon after the exit.\n */\n retiring?: boolean\n /**\n * Names this host process's signal numbering ({@link SIGNAL_SEQ_FIELD}):\n * a position from another epoch cannot be resumed. Additive.\n */\n signalEpoch?: string\n /**\n * This server lends itself as a machine to the hosts of its clients\n * (`machine.attach`, `allowAsMachine` on). Absent: it doesn't. Additive.\n */\n machineServe?: boolean\n /**\n * This server takes installs and removals from its clients (`catalog.install`\n * / `remove` / `update`, `mcp.upsert` / `remove`; `allowRemoteInstalls` on).\n * Absent: it doesn't (or predates them). Additive.\n */\n remoteInstalls?: boolean\n /** This server takes settings sync from a client's computer (`sync.*`). Absent: it doesn't. Additive. */\n sync?: boolean\n /**\n * This host runs terminals without a session (`terminal.openInProject` and\n * the other project / draft terminal methods). Absent: sessions only. Additive.\n */\n projectTerminals?: true\n /**\n * `daemon.info` only: a run, compaction, `/` command or background task is\n * in flight on this host (open terminals do not count). `zidane server\n * wait-idle` waits for `false` before a restart. Additive.\n */\n activeWork?: boolean\n}\n\n/** `catalog.install` / `remove` / `update`: what is installed from a client, in the host user's scope. */\nexport type HostInstallKind = 'skill' | 'extension'\n\n/** Which catalog a `catalog:changed` signal says to re-read. */\nexport type HostCatalogName = 'skills' | 'mcps' | 'extensions' | 'plugins'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwMA,MAAa,uBAAuB;;;;;;AAOpC,MAAa,eAAe;CAC1B,iBAAiB;CACjB,eAAe;;CAEf,aAAa;;;;;;CAMb,kBAAkB;;;;;;CAMlB,eAAe;AACjB;;;;;;AAOA,MAAa,cAAc;;;;;;;AAQ3B,MAAa,mBAAmB;;;;;;AAwxBhC,SAAgB,UAAU,OAAoC;CAC5D,IAAI,OAAO,MAAM,WAAW,YAAY,CAAC,MAAM,UAC7C,OAAO;CACT,OAAO;EAAE,IAAI,MAAM;EAAQ,MAAM,MAAM;EAAU,MAAM,MAAM,YAAY,MAAM;CAAO;AACxF;;AAUA,MAAa,yBAAyB;;AAEtC,MAAa,6BAA6B;;;;;;;;AAoD1C,eAAsB,eACpB,SACA,QAC4B;CAC5B,MAAM,SAAS,MAAM,QAAQ,uBAAuB,MAAM;CAC1D,OAAO,MAAM,QAAQ,MAAM,IAAI,EAAE,QAAQ,OAAO,IAAI;AACtD;AAEA,SAAS,mBAAmB,KAAuB;CACjD,OAAO,OAAO,QAAQ,YAAY,QAAQ,QAAS,IAA2B,SAAS,aAAa;AACtG;;;;;;;;;;;;;AAcA,eAAsB,cACpB,SACA,WACA,UAAkC,CAAC,GACX;CACxB,QAAQ,MAAM,kBAAkB,SAAS,WAAW,QAAQ,aAAA,GAAmC,EAAA,CAAG;AACpG;;;;;;;;AASA,eAAsB,eACpB,SACA,WACA,QACA,UAAkC,CAAC,GACkB;CACrD,OAAO,kBAAkB,SAAS,WAAW,QAAQ,aAAA,KAAqC,MAAM;AAClG;AAEA,eAAe,kBACb,SACA,WACA,WACA,QACqD;CACrD,IAAI,QAAQ;CACZ,MAAM,QAAyB,CAAC;CAChC,IAAI,aAAa;CACjB,IAAI,WAAW;CACf,IAAI;CACJ,SAAS;EACP,IAAI;EACJ,IAAI;GACF,OAAO,MAAM,eAAe,SAAS;IAAE;IAAW;IAAO,GAAI,WAAW,KAAA,IAAY,EAAE,OAAO,IAAI,CAAC;GAAG,CAAC;EACxG,SACO,KAAK;GACV,IAAI,mBAAmB,GAAG,KAAK,QAAQ,GAAG;IACxC,QAAQ,KAAK,IAAI,GAAG,KAAK,MAAM,QAAQ,CAAC,CAAC;IACzC;GACF;GACA,MAAM;EACR;EAQA,MAAM,QAAQ,MAAM;EACpB,IAAI,SAAS,CAAC,cAAc,MAAM,EAAE,EAAE,SAAS,iBAAiB,KAAK,OAAO,SAAS,GACnF,MAAM,QAAQ;GAAE,MAAM;GAAa,MAAM;EAAG,CAAC;EAC/C,aAAa,KAAK,UAAU;EAC5B,aAAa,cAAc,KAAK,UAAU,KAAA;EAC1C,MAAM,QAAQ,KAAK,MAAM;EAEzB,IAAI,KAAK,WAAW,KAAA,KAAa,KAAK,UAAU,KAAM,WAAW,KAAA,KAAa,KAAK,UAAU,QAC3F;EACF,IAAI,UAAU,UAAU;GACtB,MAAM,SAAS,MAAM,KAAK;GAC1B,IAAI,OAAO,MAAM,GACf,OAAO;IAAE;IAAQ,SAAS,KAAK;GAAO;EAC1C;EACA,SAAS,KAAK;CAChB;CACA,OAAO;EAAE,QAAQ,MAAM,KAAK;EAAG,SAAS;CAAE;AAC5C;;AAGA,MAAa,qBAAqB;;AAElC,MAAa,yBAAyB;;AAYtC,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;AAmBlC,eAAsB,oBACpB,SACA,WACA,UAAkC,CAAC,GACN;CAC7B,MAAM,SAAS,EAAE,OAAO,QAAQ,aAAA,IAAgC;CAChE,KAAK,IAAI,UAAU,GAAG,WAAW,2BAA2B,WAAW;EACrE,MAAM,OAAO,MAAM,wBAAwB,SAAS,WAAW,MAAM;EACrE,IAAI,SAAS,WACX,OAAO;CACX;CACA,OAAO,eAAe,MAAM,QAAQ,gBAAgB,EAAE,UAAU,CAAC,CAAC;AACpE;AAEA,SAAS,eAAe,MAAsD;CAC5E,IAAI,CAAC,MACH,OAAO;CACT,MAAM,EAAE,SAAS,UAAU,GAAG,SAAS;CACvC,OAAO;AACT;;AAGA,eAAe,wBAAwB,SAAiC,WAAmB,QAAoE;CAC7J,MAAM,QAAuB,CAAC;CAC9B,IAAI,QAAQ;CACZ,IAAI,UAAkC;CACtC,OAAO,MAAM,SAAS,OAAO;EAC3B,IAAI;EACJ,IAAI;GACF,OAAO,MAAM,QAAQ,qBAAqB;IAAE;IAAW,MAAM,MAAM;IAAQ,OAAO,OAAO;GAAM,CAAC;EAClG,SACO,KAAK;GACV,IAAI,MAAM,WAAW,KAAK,iBAAiB,GAAG,GAC5C,OAAO,eAAe,MAAM,QAAQ,gBAAgB,EAAE,UAAU,CAAC,CAAC;GACpE,IAAI,mBAAmB,GAAG,KAAK,OAAO,QAAQ,GAAG;IAC/C,OAAO,QAAQ,KAAK,IAAI,GAAG,KAAK,MAAM,OAAO,QAAQ,CAAC,CAAC;IACvD;GACF;GACA,MAAM;EACR;EACA,IAAI,CAAC,MACH,OAAO;EACT,IAAI,YAAY,MACd,UAAU,EAAE,GAAI,KAAK,YAAY,KAAA,IAAY,EAAE,IAAI,KAAK,QAAQ,IAAI,CAAC,EAAG;OACrE,IAAI,KAAK,YAAY,QAAQ,IAChC,OAAO;EACT,QAAQ,KAAK;EAEb,IAAI,KAAK,MAAM,WAAW,GACxB;EACF,MAAM,KAAK,GAAG,KAAK,KAAK;CAC1B;CACA,MAAM,OAAO,MAAM,QAAQ,gBAAgB;EAAE;EAAW,OAAO;CAAM,CAAC;CACtE,IAAI,CAAC,MACH,OAAO;CACT,IAAI,YAAY,QAAQ,KAAK,YAAY,QAAQ,IAC/C,OAAO;CACT,OAAO;EAAE,GAAG,eAAe,IAAI;EAAI;CAAM;AAC3C;;AA6BA,MAAa,WAAW"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CC as AnthropicBedrockConfig, GC as planAnthropicThinking, HC as AnthropicThinkingPlan, KC as resolveThinkingBinding, SC as applyAnthropicCacheBreakpoints, TC as AnthropicParams, UC as THINKING_BINDING_SETTING_ENV, WC as ThinkingBindingBehavior, _C as buildAnthropicClientOptions, bC as resolveAnthropicBetas, fC as anthropic, gC as classifyAnthropicError, hC as resolveAnthropicMaxOutput, mC as defaultAnthropicMaxTokens, pC as cacheWriteTtlMultiplier, vC as credentialIdentity, wC as AnthropicContextManagement, xC as EXTENDED_CACHE_TTL_BETA, yC as resolveAnthropicAuthShape } from "../index-DyQyDLX1.js";
|
|
2
2
|
export { type AnthropicBedrockConfig, type AnthropicContextManagement, type AnthropicParams, type AnthropicThinkingPlan, EXTENDED_CACHE_TTL_BETA, THINKING_BINDING_SETTING_ENV, type ThinkingBindingBehavior, anthropic, applyAnthropicCacheBreakpoints, buildAnthropicClientOptions, cacheWriteTtlMultiplier, classifyAnthropicError, credentialIdentity, defaultAnthropicMaxTokens, planAnthropicThinking, resolveAnthropicAuthShape, resolveAnthropicBetas, resolveAnthropicMaxOutput, resolveThinkingBinding };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { dC as arcee, uC as ArceeParams } from "../index-DyQyDLX1.js";
|
|
2
2
|
export { ArceeParams, arcee };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cC as baseten, lC as planBasetenReasoning, sC as BasetenParams } from "../index-DyQyDLX1.js";
|
|
2
2
|
export { BasetenParams, baseten, planBasetenReasoning };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { aC as CerebrasParams, oC as cerebras } from "../index-DyQyDLX1.js";
|
|
2
2
|
export { CerebrasParams, cerebras };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $S as loadGoogleWireKit, BS as GoogleRouteName, FS as GOOGLE_EXTRA_MODELS, GS as GoogleVertexParams, HS as GoogleStreamFn, IS as GoogleCompatibleRoute, JS as classifyGoogleError, KS as GoogleWireKit, LS as GoogleExtraModel, PS as GOOGLE_DEFAULT_MODEL, QS as googleVertex, RS as GoogleParams, US as GoogleStreamOptions, VS as GoogleSharedParams, WS as GoogleStreams, XS as google, YS as fromGooglePiAssistantMessage, ZS as googleCompatible, eC as resolveGoogleModel, nC as toGooglePiMessages, qS as GoogleWireModel, tC as resolveVertexAuth, zS as GoogleRequestAuth } from "../index-DyQyDLX1.js";
|
|
2
2
|
export { GOOGLE_DEFAULT_MODEL, GOOGLE_EXTRA_MODELS, GoogleCompatibleRoute, GoogleExtraModel, GoogleParams, GoogleRequestAuth, GoogleRouteName, GoogleSharedParams, GoogleStreamFn, GoogleStreamOptions, GoogleStreams, GoogleVertexParams, GoogleWireKit, GoogleWireModel, classifyGoogleError, fromGooglePiAssistantMessage, google, googleCompatible, googleVertex, loadGoogleWireKit, resolveGoogleModel, resolveVertexAuth, toGooglePiMessages };
|