zidane 6.6.4 → 7.0.0

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.
Files changed (157) hide show
  1. package/dist/{acp-BQqhozmt.js → acp-Wr8l4IDI.js} +7 -180
  2. package/dist/acp-Wr8l4IDI.js.map +1 -0
  3. package/dist/acp-cli.js +6 -6
  4. package/dist/acp.d.ts +1 -1
  5. package/dist/acp.d.ts.map +1 -1
  6. package/dist/acp.js +2 -1
  7. package/dist/{agent-DTxH7RHW.js → agent-C-camKQW.js} +162 -12
  8. package/dist/agent-C-camKQW.js.map +1 -0
  9. package/dist/agent.d.ts +1 -1
  10. package/dist/agent.js +1 -1
  11. package/dist/{anthropic-DRNRnd6W.js → anthropic-BDOGzhtj.js} +3 -3
  12. package/dist/{anthropic-DRNRnd6W.js.map → anthropic-BDOGzhtj.js.map} +1 -1
  13. package/dist/{transcript-anchors-BjH-68k2.js → approvals-CqqxE5Vh.js} +4924 -275
  14. package/dist/approvals-CqqxE5Vh.js.map +1 -0
  15. package/dist/{auth-7rv6ZfWk.js → auth-BdwDROYg.js} +12 -8
  16. package/dist/{auth-7rv6ZfWk.js.map → auth-BdwDROYg.js.map} +1 -1
  17. package/dist/chat/pure.d.ts +221 -4
  18. package/dist/chat/pure.d.ts.map +1 -0
  19. package/dist/chat/pure.js +4 -2
  20. package/dist/chat.d.ts +6 -2911
  21. package/dist/chat.js +8 -261
  22. package/dist/{context-transport-D8yeGdpd.js → context-transport-BqYwzJYE.js} +2 -2
  23. package/dist/{context-transport-D8yeGdpd.js.map → context-transport-BqYwzJYE.js.map} +1 -1
  24. package/dist/contexts/daytona.d.ts +1 -1
  25. package/dist/contexts/daytona.js +1 -1
  26. package/dist/contexts/e2b.d.ts +1 -1
  27. package/dist/contexts/e2b.js +1 -1
  28. package/dist/daemon-cli.d.ts +1 -0
  29. package/dist/daemon-cli.js +90 -0
  30. package/dist/daemon-cli.js.map +1 -0
  31. package/dist/eval.d.ts +1 -1
  32. package/dist/eval.js +1 -1
  33. package/dist/extensions.d.ts +2 -2
  34. package/dist/extensions.js +2 -2
  35. package/dist/headless.d.ts +1 -1
  36. package/dist/headless.js +4 -4
  37. package/dist/{index-D0O-QO7Z.d.ts → index-B-FSaM3_.d.ts} +2863 -2375
  38. package/dist/index-B-FSaM3_.d.ts.map +1 -0
  39. package/dist/index-DgdzXRPH.d.ts +3590 -0
  40. package/dist/index-DgdzXRPH.d.ts.map +1 -0
  41. package/dist/index.d.ts +2 -2
  42. package/dist/index.js +14 -1179
  43. package/dist/ipc-CIv87xuH.js +331 -0
  44. package/dist/ipc-CIv87xuH.js.map +1 -0
  45. package/dist/ipc.d.ts +849 -0
  46. package/dist/ipc.d.ts.map +1 -0
  47. package/dist/ipc.js +4 -0
  48. package/dist/json-rpc-rSWMUh9b.js +192 -0
  49. package/dist/json-rpc-rSWMUh9b.js.map +1 -0
  50. package/dist/{logger-DBX9uYOw.js → logger--C1VQjwJ.js} +3 -13
  51. package/dist/logger--C1VQjwJ.js.map +1 -0
  52. package/dist/logs-view-CWG8aUAG.js +44 -0
  53. package/dist/logs-view-CWG8aUAG.js.map +1 -0
  54. package/dist/{mcp-CVtSQTWg.js → mcp-BIWa57eY.js} +3 -3
  55. package/dist/{mcp-CVtSQTWg.js.map → mcp-BIWa57eY.js.map} +1 -1
  56. package/dist/mcp.d.ts +1 -1
  57. package/dist/mcp.js +1 -1
  58. package/dist/{messages-CZMUuKzo.js → messages-21XfHxyF.js} +3 -3
  59. package/dist/{messages-CZMUuKzo.js.map → messages-21XfHxyF.js.map} +1 -1
  60. package/dist/{openai-compat-BoTi-9fd.js → openai-compat-DY-AKxCg.js} +2 -2
  61. package/dist/{openai-compat-BoTi-9fd.js.map → openai-compat-DY-AKxCg.js.map} +1 -1
  62. package/dist/output/stream-json.d.ts +1 -1
  63. package/dist/output/terminal.d.ts +1 -1
  64. package/dist/{plugins-onDvTHEm.js → plugins-B531Tz5b.js} +2 -2
  65. package/dist/{plugins-onDvTHEm.js.map → plugins-B531Tz5b.js.map} +1 -1
  66. package/dist/plugins.d.ts +1 -1
  67. package/dist/plugins.js +1 -1
  68. package/dist/presets.d.ts +1 -1
  69. package/dist/presets.js +1 -1
  70. package/dist/providers/anthropic.d.ts +1 -1
  71. package/dist/providers/anthropic.js +1 -1
  72. package/dist/providers/arcee.d.ts +1 -1
  73. package/dist/providers/arcee.js +1 -1
  74. package/dist/providers/baseten.d.ts +1 -1
  75. package/dist/providers/baseten.js +1 -1
  76. package/dist/providers/cerebras.d.ts +1 -1
  77. package/dist/providers/cerebras.js +1 -1
  78. package/dist/providers/local.d.ts +1 -1
  79. package/dist/providers/local.js +1 -1
  80. package/dist/providers/openai-compat.d.ts +1 -1
  81. package/dist/providers/openai-compat.js +1 -1
  82. package/dist/providers/openai.d.ts +1 -1
  83. package/dist/providers/openai.js +3 -3
  84. package/dist/providers/openrouter.d.ts +1 -1
  85. package/dist/providers/openrouter.js +1 -1
  86. package/dist/providers/xai.d.ts +1 -1
  87. package/dist/providers/xai.js +1 -1
  88. package/dist/{providers-CmhdtD7w.js → providers-DX91jwir.js} +2 -2
  89. package/dist/{providers-CmhdtD7w.js.map → providers-DX91jwir.js.map} +1 -1
  90. package/dist/providers.d.ts +1 -1
  91. package/dist/providers.js +3 -3
  92. package/dist/restate.d.ts +1 -1
  93. package/dist/restate.js +8 -8
  94. package/dist/restate.js.map +1 -1
  95. package/dist/server-DJqp9dIR.js +1317 -0
  96. package/dist/server-DJqp9dIR.js.map +1 -0
  97. package/dist/session/sqlite.d.ts +1 -1
  98. package/dist/session/sqlite.d.ts.map +1 -1
  99. package/dist/session/sqlite.js +42 -4
  100. package/dist/session/sqlite.js.map +1 -1
  101. package/dist/{session-CyRLSsVa.js → session-K3icbPH9.js} +8 -2
  102. package/dist/session-K3icbPH9.js.map +1 -0
  103. package/dist/session.d.ts +1 -1
  104. package/dist/session.js +2 -2
  105. package/dist/{skills-BMGH_KK1.js → skills-PJyiSRCp.js} +3 -21
  106. package/dist/skills-PJyiSRCp.js.map +1 -0
  107. package/dist/skills.d.ts +1 -1
  108. package/dist/skills.js +1 -1
  109. package/dist/src-DzzhE2YO.js +2461 -0
  110. package/dist/src-DzzhE2YO.js.map +1 -0
  111. package/dist/todo-edits-Dw2oO2ON.js +378 -0
  112. package/dist/todo-edits-Dw2oO2ON.js.map +1 -0
  113. package/dist/{tool-formatters-NrzD6Fkk.d.ts → tool-formatters-DO56YBBw.d.ts} +104 -4
  114. package/dist/tool-formatters-DO56YBBw.d.ts.map +1 -0
  115. package/dist/tools/fetch-url.d.ts +1 -1
  116. package/dist/tools/web-search.d.ts +1 -1
  117. package/dist/tools.d.ts +1 -1
  118. package/dist/tools.js +1 -1
  119. package/dist/{transcript-anchors-UhC58Tmj.d.ts → transcript-anchors-DXqWWGbq.d.ts} +53 -4
  120. package/dist/transcript-anchors-DXqWWGbq.d.ts.map +1 -0
  121. package/dist/tui.d.ts +94 -13
  122. package/dist/tui.d.ts.map +1 -1
  123. package/dist/tui.js +2241 -1009
  124. package/dist/tui.js.map +1 -1
  125. package/dist/{turn-operations-mMxDRgLY.js → turn-operations-CZLsNgw-.js} +896 -11
  126. package/dist/turn-operations-CZLsNgw-.js.map +1 -0
  127. package/dist/{turn-operations-Cuc9pwiB.d.ts → turn-operations-DKFYWP3O.d.ts} +501 -4
  128. package/dist/turn-operations-DKFYWP3O.d.ts.map +1 -0
  129. package/dist/{types-BIarq1qE.js → types-CWgENVLY.js} +24 -2
  130. package/dist/types-CWgENVLY.js.map +1 -0
  131. package/dist/types.d.ts +1 -1
  132. package/dist/types.js +1 -1
  133. package/dist/xml-D5HBhJle.js +22 -0
  134. package/dist/xml-D5HBhJle.js.map +1 -0
  135. package/docs/CHAT.md +39 -0
  136. package/docs/IPC.md +420 -0
  137. package/docs/TUI.md +62 -0
  138. package/package.json +8 -2
  139. package/dist/acp-BQqhozmt.js.map +0 -1
  140. package/dist/agent-DTxH7RHW.js.map +0 -1
  141. package/dist/chat.d.ts.map +0 -1
  142. package/dist/chat.js.map +0 -1
  143. package/dist/index-D0O-QO7Z.d.ts.map +0 -1
  144. package/dist/index.js.map +0 -1
  145. package/dist/inline-autocomplete-D0MPvBaS.js +0 -596
  146. package/dist/inline-autocomplete-D0MPvBaS.js.map +0 -1
  147. package/dist/logger-DBX9uYOw.js.map +0 -1
  148. package/dist/login-CB23LyI1.js +0 -707
  149. package/dist/login-CB23LyI1.js.map +0 -1
  150. package/dist/session-CyRLSsVa.js.map +0 -1
  151. package/dist/skills-BMGH_KK1.js.map +0 -1
  152. package/dist/tool-formatters-NrzD6Fkk.d.ts.map +0 -1
  153. package/dist/transcript-anchors-BjH-68k2.js.map +0 -1
  154. package/dist/transcript-anchors-UhC58Tmj.d.ts.map +0 -1
  155. package/dist/turn-operations-Cuc9pwiB.d.ts.map +0 -1
  156. package/dist/turn-operations-mMxDRgLY.js.map +0 -1
  157. package/dist/types-BIarq1qE.js.map +0 -1
package/dist/ipc.d.ts ADDED
@@ -0,0 +1,849 @@
1
+ import { Cd as ProviderKey, Cu as StreamEvent, Ha as ExtensionBus, Og as ThinkingLevel, Sg as SessionTurn, Zh as JsonValue, if as InteractionResponse, yp as ContextBreakdown } from "./index-B-FSaM3_.js";
2
+ import { An as ChatHostEnvironment, Bn as RunningWorkItem, Cn as PendingAnnotation, Dn as ApprovalRequestInput, En as ApprovalHub, Fn as HostSettings, Gn as WireApprovalRequest, Hn as SerializedPreview, In as HostSignal, Ln as PendingInteraction, Mn as ApprovalOriginator, Nn as CommandArgSuggestionSummary, On as createApprovalHub, Pn as CommandSummary, Rn as PromptAttachment, Sn as EditOutcomeLedger, Tn as runCompaction, Un as SessionPresence, Vn as SendOptions, Wn as TodosSnapshot, _n as CreateWorkerParams, bn as InteractionHub, dn as readFileSafe, fn as resolveCwdPath, gn as createChatHost, hn as ContextSegmentsReport, jn as PendingApprovalsStore, kn as createMemoryApprovalsStore, mn as ChatHost, pn as serializePreview, un as extractEditPayloadForGate, v as SystemMdFile, vn as WorkerRow, wn as CompactionEntry, xn as createInteractionHub, yn as WorkerSummary, zn as QueuedItem } from "./index-DgdzXRPH.js";
3
+ import { O as ResolvedConfig } from "./transcript-anchors-DXqWWGbq.js";
4
+ import { p as TodoItem } from "./turn-operations-DKFYWP3O.js";
5
+ import { T as SessionHistoryMatch, V as ApprovalDecision, w as SearchTurnResult } from "./tool-formatters-DO56YBBw.js";
6
+
7
+ //#region src/ipc/attach.d.ts
8
+ interface AttachOptions {
9
+ socketPath?: string;
10
+ /** Attach to this session id (prefix match against the list). */
11
+ sessionId?: string;
12
+ /** Create a fresh session instead of picking. */
13
+ createNew?: boolean;
14
+ cwd?: string;
15
+ appVersion?: string;
16
+ /** Spawn-on-demand command when no daemon is listening. */
17
+ spawnCommand?: string[];
18
+ /** Injectable streams for tests. */
19
+ stdin?: NodeJS.ReadableStream;
20
+ stdout?: NodeJS.WritableStream;
21
+ }
22
+ declare function runAttach(options?: AttachOptions): Promise<void>;
23
+ //#endregion
24
+ //#region src/ipc/daemon/lifecycle.d.ts
25
+ /**
26
+ * Build fingerprint for the handshake — the mtime of this module's file
27
+ * at import time. Client and daemon load the same file from disk, so a
28
+ * daemon spawned before a rebuild (or a source edit in dev) reports a
29
+ * different id than a freshly-started client, and the client drains +
30
+ * respawns it. This closes the "same protocol version, different code"
31
+ * gap that a hand-bumped version constant can't: during development the
32
+ * daemon process is frozen at spawn while the tree keeps moving.
33
+ *
34
+ * Compiled binaries (`/$bunfs/…` virtual paths) can't be stat'ed and
35
+ * report `'unknown'`; the check is skipped when EITHER side is unknown,
36
+ * so released builds rely on `IPC_PROTOCOL_VERSION` alone — correct,
37
+ * since their code only changes when the version does.
38
+ */
39
+ declare const IPC_BUILD_ID: string;
40
+ declare function defaultSocketPath(): string;
41
+ /**
42
+ * Spawn command that re-enters the CURRENT zidane program as `… daemon`.
43
+ *
44
+ * Three launch shapes:
45
+ * - compiled Bun binary — `Bun.main` is the virtual `/$bunfs/…` entry the
46
+ * binary self-inserts as argv[1], so the spawn must NOT repeat it
47
+ * (verified: repeating it makes the child parse the junk path as its
48
+ * subcommand and boot the full TUI instead of the daemon).
49
+ * - dev (`bun run cli.ts`) — the script path must ride along.
50
+ * - Node hosts (no `Bun` global) — fall back to the published bin.
51
+ */
52
+ declare function selfDaemonSpawnCommand(): string[];
53
+ /**
54
+ * True when something accepts connections on `socketPath`. Distinguishes a
55
+ * live daemon from a stale socket file left by a crashed one.
56
+ */
57
+ declare function probeSocket(socketPath: string, timeoutMs?: number): Promise<boolean>;
58
+ interface EnsureDaemonOptions {
59
+ socketPath?: string;
60
+ /**
61
+ * Command used to spawn the daemon when nothing is listening. Defaults to
62
+ * `['zidane-daemon']` (the published bin). The child is detached and
63
+ * unref'd — it outlives the spawning client by design.
64
+ */
65
+ spawnCommand?: string[];
66
+ /** Total time to wait for the daemon to accept connections. */
67
+ timeoutMs?: number;
68
+ }
69
+ /**
70
+ * Make sure a daemon is listening, spawning one if needed. Resolves with
71
+ * the socket path once a connection succeeds; rejects when the daemon
72
+ * failed to come up within `timeoutMs`.
73
+ */
74
+ declare function ensureDaemonRunning(options?: EnsureDaemonOptions): Promise<string>;
75
+ //#endregion
76
+ //#region src/ipc/protocol.d.ts
77
+ /**
78
+ * v6 (changes since v5):
79
+ * - `event` signals carry an optional `echo` flag marking host-generated
80
+ * SEND/STEER echoes of the user's own message.
81
+ * - `chat.pushQueued` result gained the `'queued'` delivered variant.
82
+ * - `sessions.setModel` now honors `fallbacks`: it persists the canonical
83
+ * `metadata.modelChain` and CLEARS a previously persisted chain when
84
+ * omitted/empty.
85
+ * - additive: `extension.emit` notification + `extension:signal` fan-out
86
+ * (the permission-gated per-extension cross-window bus, `ctx.bus`).
87
+ * Older daemons ignore the unknown notification; older clients drop the
88
+ * unknown signal kind — no version bump needed.
89
+ * - additive: `extension.emit` / `extension:signal` carry an optional
90
+ * `nonce` (the emitter's per-process random id) so receivers dedupe on
91
+ * `(extensionId, nonce, seq)` instead of the collision-prone
92
+ * `(extensionId, seq)`. Older peers omit it and fall back to the
93
+ * seq-only key — no version bump needed.
94
+ * - `SessionRow.modelFallbacks` is now populated from the session's
95
+ * persisted `metadata.modelChain`.
96
+ * - Default socket path moved from `<stateDir>/daemon.sock` to the
97
+ * dedicated `<stateDir>/daemon/daemon.sock` (dir chmod'd 0700) so the
98
+ * daemon can harden its socket dir without touching shared state files.
99
+ * - ADDITIVE (no version bump — older daemons answer "method not
100
+ * found", clients degrade to local compute): `suggest.resolve` RPC
101
+ * resolves inline ghost-text autocomplete daemon-side, and the
102
+ * `suggest:changed` signal fans the result out to every OTHER peer
103
+ * on the session so mirroring windows paint the same ghost without
104
+ * recomputing.
105
+ * - ADDITIVE (no version bump — optional field, older daemons simply
106
+ * omit it and clients fall back to the single `suggestion`):
107
+ * `suggest.resolve` results and `suggest:changed` signals carry the
108
+ * resolver's full ordered `candidates` list so daemon mode keeps
109
+ * ↑/↓ candidate rotation instead of degrading to one suggestion.
110
+ */
111
+ declare const IPC_PROTOCOL_VERSION = 8;
112
+ /**
113
+ * JSON-RPC error codes specific to the zidane daemon. Lives here (not in
114
+ * `daemon/server.ts`) so clients can import the codes without pulling the
115
+ * server's module graph.
116
+ */
117
+ declare const IpcErrorCode: {
118
+ readonly VersionMismatch: -32010;
119
+ readonly NotHandshaken: -32011;
120
+ };
121
+ /**
122
+ * Typed method map for the daemon transport. Keys are JSON-RPC method
123
+ * names; each entry pins params/result so both the daemon dispatch table
124
+ * and the client proxy are checked against the same contract.
125
+ *
126
+ * Scope: the chat core every client needs. Host-UI-specific surfaces
127
+ * (folder pickers, themes, keybindings) intentionally stay client-local.
128
+ */
129
+ interface IpcMethods {
130
+ /** `wake` is host-internal (see `SendOptions.wake`) — not accepted over the wire. */
131
+ 'chat.send': {
132
+ params: Omit<SendOptions, 'wake'>;
133
+ result: {
134
+ runId: string;
135
+ };
136
+ };
137
+ 'chat.interrupt': {
138
+ params: {
139
+ sessionId: string;
140
+ };
141
+ result: void;
142
+ };
143
+ 'chat.steer': {
144
+ params: {
145
+ sessionId: string;
146
+ message: string;
147
+ };
148
+ result: void;
149
+ };
150
+ 'chat.followUp': {
151
+ params: {
152
+ sessionId: string;
153
+ message: string;
154
+ };
155
+ result: void;
156
+ };
157
+ 'chat.pushQueued': {
158
+ params: {
159
+ sessionId: string;
160
+ message: string;
161
+ activatedSkills?: string[];
162
+ };
163
+ result: {
164
+ delivered: 'steer' | 'send' | 'command' | 'queued';
165
+ };
166
+ };
167
+ 'chat.isRunning': {
168
+ params: {
169
+ sessionId: string;
170
+ };
171
+ result: boolean;
172
+ };
173
+ /**
174
+ * Retire the session's live agent so the next run rebuilds against
175
+ * fresh config/credentials (MCP login, extension reload). Run-end
176
+ * deferred when a run is in flight; HITL/queue state survives.
177
+ */
178
+ 'chat.rebuildAgent': {
179
+ params: {
180
+ sessionId: string;
181
+ };
182
+ result: void;
183
+ };
184
+ 'chat.listWork': {
185
+ params: {
186
+ sessionId: string;
187
+ };
188
+ result: RunningWorkItem[];
189
+ };
190
+ 'chat.cancelWork': {
191
+ params: {
192
+ sessionId: string;
193
+ id: string | 'all';
194
+ reason?: string;
195
+ };
196
+ result: boolean;
197
+ };
198
+ 'sessions.list': {
199
+ params: {
200
+ projectRoot?: string | null;
201
+ archive?: 'active' | 'archived' | 'all';
202
+ };
203
+ result: SessionRow[];
204
+ };
205
+ 'sessions.create': {
206
+ params: CreateSessionParams;
207
+ result: SessionRow;
208
+ };
209
+ 'sessions.delete': {
210
+ params: {
211
+ sessionId: string;
212
+ };
213
+ result: void;
214
+ };
215
+ 'sessions.setTitle': {
216
+ params: {
217
+ sessionId: string;
218
+ title: string;
219
+ };
220
+ result: void;
221
+ };
222
+ 'sessions.setArchived': {
223
+ params: {
224
+ sessionId: string;
225
+ archived: boolean;
226
+ };
227
+ result: void;
228
+ };
229
+ 'sessions.setAgentId': {
230
+ params: {
231
+ sessionId: string;
232
+ agentId: string;
233
+ };
234
+ result: void;
235
+ };
236
+ 'sessions.setEffort': {
237
+ params: {
238
+ sessionId: string;
239
+ effort: ThinkingLevel;
240
+ };
241
+ result: void;
242
+ };
243
+ /**
244
+ * `fallbacks` (ordered, primary excluded) is PATCH-like: omitted
245
+ * leaves a persisted chain untouched; an explicit `[]` clears it;
246
+ * non-empty persists the canonical `metadata.modelChain`
247
+ * (`[primary, ...fallbacks]`, TUI byte format);
248
+ * see the patch-like semantics above.
249
+ */
250
+ 'sessions.setModel': {
251
+ params: {
252
+ sessionId: string;
253
+ providerKey: ProviderKey;
254
+ modelId: string;
255
+ fallbacks?: ModelFallbackRef[];
256
+ };
257
+ result: void;
258
+ };
259
+ 'sessions.setModelOptions': {
260
+ params: {
261
+ sessionId: string;
262
+ options: Record<string, boolean>;
263
+ };
264
+ result: void;
265
+ };
266
+ 'sessions.loadEvents': {
267
+ params: {
268
+ sessionId: string;
269
+ };
270
+ result: StreamEvent[];
271
+ };
272
+ 'sessions.getTurn': {
273
+ params: {
274
+ sessionId: string;
275
+ turnId: string;
276
+ };
277
+ result: SessionTurn | null;
278
+ };
279
+ 'sessions.contextBreakdown': {
280
+ params: {
281
+ sessionId: string;
282
+ };
283
+ result: ContextBreakdown | null;
284
+ };
285
+ /**
286
+ * Transcript search over ONE session, daemon-side. The daemon owns the
287
+ * authoritative turns (live wrapper when an agent is active — fresh
288
+ * mid-run, which a window's load-time snapshot is not) and an LRU index
289
+ * cache shared by every window, so repeat queries pay match cost only.
290
+ * Results come back in TURN ORDER (search is a transcript filter).
291
+ */
292
+ 'history.searchSession': {
293
+ params: {
294
+ sessionId: string;
295
+ query: string;
296
+ limit?: number;
297
+ };
298
+ result: SearchTurnResult[];
299
+ };
300
+ /**
301
+ * Cross-session content search, daemon-side. One RPC replaces a
302
+ * window's per-session index/build/search round-trips — indexes are
303
+ * built once in the daemon and shared by every window.
304
+ */
305
+ 'history.searchAll': {
306
+ params: {
307
+ query: string;
308
+ sessionIds: string[];
309
+ excerptLimit?: number;
310
+ };
311
+ result: Record<string, SessionHistoryMatch>;
312
+ };
313
+ /**
314
+ * A window appended transcript content OUT-OF-BAND (local `/` command
315
+ * output, `!` shell turns — written straight to the shared store, not
316
+ * through a host run). The daemon fans out `sessions:changed` so every
317
+ * window (issuer included) re-converges on the canonical replay NOW
318
+ * instead of at the next run end. Sent as a notification.
319
+ */
320
+ 'sessions.touch': {
321
+ params: {
322
+ sessionId: string;
323
+ };
324
+ result: void;
325
+ };
326
+ 'sessions.compact': {
327
+ params: {
328
+ sessionId: string;
329
+ };
330
+ result: void;
331
+ };
332
+ 'todos.get': {
333
+ params: {
334
+ sessionId: string;
335
+ };
336
+ result: TodosSnapshot | null;
337
+ };
338
+ /**
339
+ * Apply a user todo edit (add / edit / remove / cycle / clear) to the
340
+ * session the MODEL reads.
341
+ *
342
+ * Required because todos live in `session.metadata` and `todowrite` reads
343
+ * them off the daemon agent's in-memory `Session`. A window writing its own
344
+ * `Session` instance persisted an edit that the daemon never observed, so the
345
+ * model's next `todowrite` silently overwrote it.
346
+ *
347
+ * Sends the whole list rather than a delta: the mutators in
348
+ * `chat/todo-edits.ts` are already whole-list transforms, and a delta would
349
+ * need conflict rules against a list the model rewrites concurrently.
350
+ *
351
+ * `null` = no live agent (or no run owns a todo slot), and the caller should
352
+ * apply its own store-level write — race-free, since nothing is appending.
353
+ */
354
+ 'todos.set': {
355
+ params: {
356
+ sessionId: string;
357
+ items: readonly TodoItem[];
358
+ };
359
+ result: TodosSnapshot | null;
360
+ };
361
+ /** The main session id, creating it (directory-less) when the setting is on and none exists. */
362
+ 'orchestration.main': {
363
+ params: Record<string, never>;
364
+ result: string | null;
365
+ };
366
+ 'orchestration.createWorker': {
367
+ params: {
368
+ mainId: string;
369
+ } & CreateWorkerParams;
370
+ result: string;
371
+ };
372
+ 'orchestration.list': {
373
+ params: {
374
+ mainId: string;
375
+ limit?: number;
376
+ };
377
+ result: WorkerRow[];
378
+ };
379
+ 'orchestration.read': {
380
+ params: {
381
+ mainId: string;
382
+ sessionId: string;
383
+ };
384
+ result: WorkerSummary | null;
385
+ };
386
+ /** `wake` (default true): whether that run finishing wakes the main. */
387
+ 'orchestration.send': {
388
+ params: {
389
+ mainId: string;
390
+ sessionId: string;
391
+ prompt: string;
392
+ wake?: boolean;
393
+ };
394
+ result: void;
395
+ };
396
+ 'orchestration.steer': {
397
+ params: {
398
+ mainId: string;
399
+ sessionId: string;
400
+ message: string;
401
+ };
402
+ result: void;
403
+ };
404
+ 'orchestration.cancel': {
405
+ params: {
406
+ mainId: string;
407
+ sessionId: string;
408
+ };
409
+ result: void;
410
+ };
411
+ 'orchestration.transcript': {
412
+ params: {
413
+ mainId: string;
414
+ sessionId: string;
415
+ limit?: number;
416
+ };
417
+ result: string;
418
+ };
419
+ /** Extension-contributed `/` commands discovered for `cwd`. */
420
+ 'commands.list': {
421
+ params: {
422
+ cwd: string;
423
+ };
424
+ result: CommandSummary[];
425
+ };
426
+ /** Argument suggestions for `/name <prefix>` — best-effort, empty on failure. */
427
+ 'commands.completeArgs': {
428
+ params: {
429
+ cwd: string;
430
+ name: string;
431
+ argsPrefix: string;
432
+ };
433
+ result: CommandArgSuggestionSummary[];
434
+ };
435
+ 'interactions.list': {
436
+ params: {
437
+ sessionId?: string;
438
+ };
439
+ result: PendingInteraction[];
440
+ };
441
+ 'interactions.respond': {
442
+ params: {
443
+ requestId: string;
444
+ response: InteractionResponse;
445
+ };
446
+ result: {
447
+ ok: boolean;
448
+ };
449
+ };
450
+ 'interactions.cancel': {
451
+ params: {
452
+ requestId: string;
453
+ reason?: string;
454
+ };
455
+ result: {
456
+ ok: boolean;
457
+ };
458
+ };
459
+ 'interactions.rehydrate': {
460
+ params: {
461
+ sessionId: string;
462
+ };
463
+ result: PendingInteraction[];
464
+ };
465
+ 'approvals.resolve': {
466
+ params: {
467
+ requestId: string;
468
+ decision: ApprovalDecision;
469
+ };
470
+ result: void;
471
+ };
472
+ 'approvals.denyAll': {
473
+ params: {
474
+ sessionId?: string;
475
+ };
476
+ result: void;
477
+ };
478
+ 'approvals.listPending': {
479
+ params: Record<string, never>;
480
+ result: WireApprovalRequest[];
481
+ };
482
+ /**
483
+ * Type-ahead queue, host-owned so every window sees and can manipulate
484
+ * the same list. `queue.add` queues when a run is in flight and sends
485
+ * immediately otherwise; the host auto-drains the queue FIFO at run end.
486
+ */
487
+ 'queue.list': {
488
+ params: {
489
+ sessionId: string;
490
+ };
491
+ result: QueuedItem[];
492
+ };
493
+ /**
494
+ * Which `SYSTEM.md` override composes this session's prompt, for windows
495
+ * attaching to an already-warm agent.
496
+ *
497
+ * The `system-md` signal fires once per agent BUILD and the daemon caches
498
+ * agents, so the normal multi-window case (daemon already running, open a
499
+ * second terminal or the GUI) would otherwise never learn that the built-in
500
+ * safety and git doctrine has been replaced. `null` = no live agent yet, in
501
+ * which case the next build broadcasts it.
502
+ */
503
+ 'sessions.systemMd': {
504
+ params: {
505
+ sessionId: string;
506
+ };
507
+ result: {
508
+ file: SystemMdFile | null;
509
+ shadowed: readonly SystemMdFile[];
510
+ } | null;
511
+ };
512
+ /**
513
+ * Every chunk of the session's system prompt with provenance — the
514
+ * Instructions tab. Built from the live agent's assembly, so it reflects
515
+ * MCP instructions, extension fragments and the resolved `SYSTEM.md`.
516
+ */
517
+ 'sessions.contextSegments': {
518
+ params: {
519
+ sessionId: string;
520
+ };
521
+ result: ContextSegmentsReport | null;
522
+ };
523
+ /** Seed a user-scope `SYSTEM.md` from the session's doctrine; throws when an override could not apply. */
524
+ 'sessions.createSystemOverride': {
525
+ params: {
526
+ sessionId: string;
527
+ };
528
+ result: {
529
+ path: string;
530
+ created: boolean;
531
+ };
532
+ };
533
+ 'queue.add': {
534
+ params: {
535
+ sessionId: string;
536
+ text: string;
537
+ activatedSkills?: string[];
538
+ attachments?: PromptAttachment[];
539
+ };
540
+ result: {
541
+ delivered: 'queued' | 'sent';
542
+ };
543
+ };
544
+ 'queue.remove': {
545
+ params: {
546
+ sessionId: string;
547
+ id: string;
548
+ };
549
+ result: boolean;
550
+ };
551
+ /** Steer a queued entry into the live run now (falls back to send when idle). */
552
+ 'queue.pushNow': {
553
+ params: {
554
+ sessionId: string;
555
+ id: string;
556
+ };
557
+ result: {
558
+ delivered: 'steer' | 'send' | 'missing';
559
+ };
560
+ };
561
+ /** Current shared draft for a session — backfill on window attach. */
562
+ 'drafts.get': {
563
+ params: {
564
+ sessionId: string;
565
+ };
566
+ result: {
567
+ text: string;
568
+ shell?: boolean;
569
+ attachments?: PromptAttachment[];
570
+ search?: {
571
+ active: boolean;
572
+ query: string;
573
+ };
574
+ };
575
+ };
576
+ /**
577
+ * Replace the session's shared draft. Fans out `draft:changed` to every
578
+ * OTHER peer. Ephemeral daemon state — drafts don't survive a daemon
579
+ * restart and are cleared when any window submits the prompt.
580
+ */
581
+ /**
582
+ * `shell` carries the prompt's shell mode OUT OF BAND — never encoded
583
+ * into the text, so a literal leading `!` in a normal draft can't flip
584
+ * other windows into shell-execution semantics.
585
+ */
586
+ 'drafts.set': {
587
+ params: {
588
+ sessionId: string;
589
+ text: string;
590
+ shell?: boolean;
591
+ };
592
+ result: void;
593
+ };
594
+ /** Replace the shared draft's composing attachments (notification). */
595
+ 'drafts.setAttachments': {
596
+ params: {
597
+ sessionId: string;
598
+ attachments: PromptAttachment[];
599
+ };
600
+ result: void;
601
+ };
602
+ /** Replace the shared transcript-search state (notification, per keystroke). */
603
+ 'search.set': {
604
+ params: {
605
+ sessionId: string;
606
+ active: boolean;
607
+ query: string;
608
+ };
609
+ result: void;
610
+ };
611
+ /**
612
+ * Extension bus emit from a wire client whose extensions run CLIENT-side
613
+ * (TUI daemon mode — the extension has no host to broadcast through).
614
+ * Sent as a notification. The daemon validates the extension id against
615
+ * the session cwd's registry (boot registry when no `sessionId`) and the
616
+ * `'ipc'` permission, re-validates the 64 KiB payload cap, delivers to
617
+ * its own subscribers, and fans out `extension:signal` to every OTHER
618
+ * peer (origin excluded — the emitter already delivered locally).
619
+ */
620
+ 'extension.emit': {
621
+ params: {
622
+ extensionId: string;
623
+ sessionId?: string;
624
+ payload: JsonValue;
625
+ seq: number;
626
+ nonce?: string;
627
+ };
628
+ result: void;
629
+ };
630
+ /**
631
+ * Resolve inline ghost-text autocomplete daemon-side (the typing
632
+ * window's request IS the single computation): canonical resolver
633
+ * against the session cwd's extension registry. Latest-wins per
634
+ * session — a `seq` older than the newest seen returns
635
+ * `{ suggestion: null }` without computing, and a newer request
636
+ * aborts an in-flight compute. The result additionally fans out as
637
+ * `suggest:changed` to every OTHER peer.
638
+ */
639
+ 'suggest.resolve': {
640
+ params: {
641
+ sessionId: string;
642
+ text: string;
643
+ caret: number;
644
+ seq: number;
645
+ };
646
+ result: {
647
+ suggestion: string | null;
648
+ seq: number;
649
+ candidates?: string[];
650
+ };
651
+ };
652
+ 'settings.get': {
653
+ params: Record<string, never>;
654
+ result: HostSettings;
655
+ };
656
+ 'settings.set': {
657
+ params: {
658
+ patch: Partial<HostSettings>;
659
+ };
660
+ result: HostSettings;
661
+ };
662
+ /** Current presence snapshot — backfill for a freshly opened session list. */
663
+ 'presence.list': {
664
+ params: Record<string, never>;
665
+ result: SessionPresence[];
666
+ };
667
+ /**
668
+ * Tag the calling peer as watching a session (one per connection; the
669
+ * TUI opens one connection per activated session). Sent as a
670
+ * notification right after the handshake. Detach is implicit — the
671
+ * daemon recomputes presence when the socket drops.
672
+ */
673
+ 'presence.watch': {
674
+ params: {
675
+ sessionId: string;
676
+ };
677
+ result: void;
678
+ };
679
+ 'daemon.info': {
680
+ params: Record<string, never>;
681
+ result: HelloResult;
682
+ };
683
+ /**
684
+ * Graceful drain: deny pending approvals, abort live runs, close the
685
+ * socket. Used by clients that detect a protocol-version mismatch and
686
+ * need the stale daemon gone before respawning.
687
+ */
688
+ 'daemon.shutdown': {
689
+ params: Record<string, never>;
690
+ result: void;
691
+ };
692
+ }
693
+ type IpcMethodName = keyof IpcMethods;
694
+ type IpcParams<M extends IpcMethodName> = IpcMethods[M]['params'];
695
+ type IpcResult<M extends IpcMethodName> = IpcMethods[M]['result'];
696
+ /** One row in a cross-window session list. */
697
+ /** One ordered model-fallback target (primary excluded). */
698
+ interface ModelFallbackRef {
699
+ providerKey: ProviderKey;
700
+ modelId: string;
701
+ }
702
+ interface SessionRow {
703
+ id: string;
704
+ title: string;
705
+ projectRoot: string | null;
706
+ cwd: string;
707
+ agentId?: string;
708
+ status: 'idle' | 'running' | 'completed' | 'error';
709
+ createdAt: number;
710
+ updatedAt: number;
711
+ archived: boolean;
712
+ /** Orchestration main session — see `SessionMeta.isMain`. Additive. */
713
+ isMain?: boolean;
714
+ providerKey?: ProviderKey;
715
+ modelId?: string;
716
+ effort?: ThinkingLevel;
717
+ modelOptions?: Record<string, boolean>;
718
+ /** Validated (head-matched) fallback chain tail, for pickers/badges. */
719
+ modelFallbacks?: ModelFallbackRef[];
720
+ }
721
+ interface CreateSessionParams {
722
+ /** Tool-execution directory — `projectRoot` is derived from it host-side. */
723
+ cwd: string;
724
+ title?: string;
725
+ agentId?: string;
726
+ providerKey?: ProviderKey;
727
+ modelId?: string;
728
+ /** Seed an ordered fallback chain alongside the model pick. */
729
+ fallbacks?: ModelFallbackRef[];
730
+ /** Mark as an extension-authoring session (auto-activates the docs skill). */
731
+ extensionEdit?: boolean;
732
+ }
733
+ interface HelloParams {
734
+ protocolVersion: number;
735
+ /** Client's zidane version — surfaced in daemon diagnostics. */
736
+ appVersion: string;
737
+ pid: number;
738
+ /**
739
+ * Build fingerprint (module mtime; `'unknown'` in compiled binaries).
740
+ * When BOTH sides report a real id and they differ, the daemon rejects
741
+ * the handshake like a protocol-version mismatch — the client drains it
742
+ * and respawns. Closes same-version code drift during development.
743
+ */
744
+ buildId?: string;
745
+ }
746
+ interface HelloResult {
747
+ protocolVersion: number;
748
+ appVersion: string;
749
+ pid: number;
750
+ startedAt: number;
751
+ buildId?: string;
752
+ }
753
+ //#endregion
754
+ //#region src/ipc/client.d.ts
755
+ declare class IpcVersionMismatchError extends Error {
756
+ readonly daemon?: HelloResult | undefined;
757
+ constructor(message: string, daemon?: HelloResult | undefined);
758
+ }
759
+ interface IpcClientOptions {
760
+ socketPath: string;
761
+ /** Client zidane version, surfaced in daemon diagnostics. */
762
+ appVersion?: string;
763
+ /** Called when the daemon connection drops (socket close/error). */
764
+ onClose?: () => void;
765
+ /**
766
+ * On a version/build mismatch, ask the stale daemon to drain before
767
+ * throwing (default). PASSIVE clients (the presence watcher) must set
768
+ * this false: they retry on a timer, and an old-build window left open
769
+ * across a protocol bump would otherwise drain the NEW daemon in a
770
+ * loop, aborting every other window's runs.
771
+ */
772
+ drainOnMismatch?: boolean;
773
+ }
774
+ interface IpcClient {
775
+ hello: HelloResult;
776
+ request: <M extends IpcMethodName>(method: M, params: IpcParams<M>) => Promise<IpcResult<M>>;
777
+ /**
778
+ * Fire-and-forget notification — same method table as `request`, but no
779
+ * id, no response, no pending-promise bookkeeping. The hot path for
780
+ * high-frequency writes (per-keystroke draft sync). Daemons that don't
781
+ * know the method ignore it silently.
782
+ */
783
+ notify: <M extends IpcMethodName>(method: M, params: IpcParams<M>) => void;
784
+ onSignal: (cb: (signal: HostSignal) => void) => () => void;
785
+ close: () => void;
786
+ }
787
+ declare function connectIpcClient(options: IpcClientOptions): Promise<IpcClient>;
788
+ /**
789
+ * One-call convenience for windows: make sure a daemon is up (spawning if
790
+ * needed), connect, and — when the running daemon speaks an older protocol
791
+ * — drain it and spawn a fresh one before retrying once.
792
+ */
793
+ declare function connectOrSpawnDaemon(options?: Omit<IpcClientOptions, 'socketPath'> & EnsureDaemonOptions): Promise<IpcClient>;
794
+ //#endregion
795
+ //#region src/ipc/daemon/environment.d.ts
796
+ interface DaemonEnvironment extends ChatHostEnvironment {
797
+ writeSettings: (patch: Partial<HostSettings>) => HostSettings;
798
+ /** Drop the per-cwd runtime-config memo (settings changed). */
799
+ invalidateRuntime: () => void;
800
+ /** Base config resolved at daemon boot (paths, store, state). */
801
+ config: ResolvedConfig;
802
+ /**
803
+ * Shared extension bus for daemon-side registries (`ctx.bus`). The
804
+ * server delivers validated `extension.emit` notifications into it;
805
+ * daemon-side emits leave through its `onEmit` → `broadcast`. Optional:
806
+ * test environments without extensions omit it.
807
+ */
808
+ extensionBus?: ExtensionBus;
809
+ }
810
+ /**
811
+ * File-backed pending-approvals persistence (`pending-approvals.json` next
812
+ * to `state.json`). Small, rewritten atomically enough for its purpose —
813
+ * the queue holds at most a handful of rows.
814
+ */
815
+ declare function createFileApprovalsStore(path: string): PendingApprovalsStore;
816
+ declare function createDaemonEnvironment(options: {
817
+ broadcast: (signal: HostSignal) => void; /** Base cwd for boot-time config resolution. Default: `process.cwd()`. */
818
+ cwd?: string;
819
+ debugStream?: boolean;
820
+ }): Promise<DaemonEnvironment>;
821
+ //#endregion
822
+ //#region src/ipc/daemon/server.d.ts
823
+ interface IpcDaemonOptions {
824
+ socketPath: string;
825
+ /**
826
+ * Environment factory — the production daemon uses the disk-backed
827
+ * `createDaemonEnvironment`; tests inject an in-memory one. Receives the
828
+ * broadcast sink wired to peer fan-out.
829
+ */
830
+ createEnvironment?: (broadcast: (signal: HostSignal) => void) => DaemonEnvironment | Promise<DaemonEnvironment>;
831
+ appVersion?: string;
832
+ /**
833
+ * Called when the daemon has had zero peers for `idleShutdownMs` and no
834
+ * session is running. The CLI exits the process; embedded servers ignore.
835
+ */
836
+ idleShutdownMs?: number;
837
+ onIdle?: () => void;
838
+ onLog?: (line: string) => void;
839
+ }
840
+ interface IpcDaemon {
841
+ socketPath: string;
842
+ host: ChatHost;
843
+ peerCount: () => number;
844
+ close: () => Promise<void>;
845
+ }
846
+ declare function startIpcDaemon(options: IpcDaemonOptions): Promise<IpcDaemon>;
847
+ //#endregion
848
+ export { type ApprovalHub, type ApprovalOriginator, type ApprovalRequestInput, type AttachOptions, type ChatHost, type ChatHostEnvironment, type CompactionEntry, type CreateSessionParams, type DaemonEnvironment, EditOutcomeLedger, type EnsureDaemonOptions, type HelloParams, type HelloResult, type HostSettings, type HostSignal, IPC_BUILD_ID, IPC_PROTOCOL_VERSION, type InteractionHub, type IpcClient, type IpcClientOptions, type IpcDaemon, type IpcDaemonOptions, IpcErrorCode, type IpcMethodName, type IpcMethods, type IpcParams, type IpcResult, IpcVersionMismatchError, type PendingAnnotation, type PendingApprovalsStore, type PendingInteraction, type PromptAttachment, type QueuedItem, type RunningWorkItem, type SendOptions, type SerializedPreview, type SessionPresence, type SessionRow, type TodosSnapshot, type WireApprovalRequest, connectIpcClient, connectOrSpawnDaemon, createApprovalHub, createChatHost, createDaemonEnvironment, createFileApprovalsStore, createInteractionHub, createMemoryApprovalsStore, defaultSocketPath, ensureDaemonRunning, extractEditPayloadForGate, probeSocket, readFileSafe, resolveCwdPath, runAttach, runCompaction, selfDaemonSpawnCommand, serializePreview, startIpcDaemon };
849
+ //# sourceMappingURL=ipc.d.ts.map