codepunk-protocol 0.0.0-stage → 0.1.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 (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +19 -2
  3. package/dist/approval.d.ts +90 -0
  4. package/dist/approval.d.ts.map +1 -0
  5. package/dist/approval.js +76 -0
  6. package/dist/approval.js.map +1 -0
  7. package/dist/common.d.ts +69 -0
  8. package/dist/common.d.ts.map +1 -0
  9. package/dist/common.js +97 -0
  10. package/dist/common.js.map +1 -0
  11. package/dist/daemon.d.ts +2113 -0
  12. package/dist/daemon.d.ts.map +1 -0
  13. package/dist/daemon.js +161 -0
  14. package/dist/daemon.js.map +1 -0
  15. package/dist/delivery.d.ts +106 -0
  16. package/dist/delivery.d.ts.map +1 -0
  17. package/dist/delivery.js +91 -0
  18. package/dist/delivery.js.map +1 -0
  19. package/dist/evidence.d.ts +268 -0
  20. package/dist/evidence.d.ts.map +1 -0
  21. package/dist/evidence.js +93 -0
  22. package/dist/evidence.js.map +1 -0
  23. package/dist/index.d.ts +26 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +25 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/memory.d.ts +51 -0
  28. package/dist/memory.d.ts.map +1 -0
  29. package/dist/memory.js +53 -0
  30. package/dist/memory.js.map +1 -0
  31. package/dist/plugin.d.ts +77 -0
  32. package/dist/plugin.d.ts.map +1 -0
  33. package/dist/plugin.js +65 -0
  34. package/dist/plugin.js.map +1 -0
  35. package/dist/policy.d.ts +33 -0
  36. package/dist/policy.d.ts.map +1 -0
  37. package/dist/policy.js +33 -0
  38. package/dist/policy.js.map +1 -0
  39. package/dist/retention.d.ts +21 -0
  40. package/dist/retention.d.ts.map +1 -0
  41. package/dist/retention.js +31 -0
  42. package/dist/retention.js.map +1 -0
  43. package/dist/session.d.ts +1941 -0
  44. package/dist/session.d.ts.map +1 -0
  45. package/dist/session.js +649 -0
  46. package/dist/session.js.map +1 -0
  47. package/dist/swarm.d.ts +25 -0
  48. package/dist/swarm.d.ts.map +1 -0
  49. package/dist/swarm.js +33 -0
  50. package/dist/swarm.js.map +1 -0
  51. package/dist/verdict.d.ts +35 -0
  52. package/dist/verdict.d.ts.map +1 -0
  53. package/dist/verdict.js +44 -0
  54. package/dist/verdict.js.map +1 -0
  55. package/dist/version.d.ts +14 -0
  56. package/dist/version.d.ts.map +1 -0
  57. package/dist/version.js +37 -0
  58. package/dist/version.js.map +1 -0
  59. package/package.json +32 -4
@@ -0,0 +1,2113 @@
1
+ import { Type, type Static } from "typebox";
2
+ export declare const DAEMON_PROTOCOL_VERSION: 1;
3
+ export declare const DAEMON_REQUEST_MAX_BYTES: number;
4
+ export declare const DAEMON_RESPONSE_MAX_BYTES: number;
5
+ export declare const DAEMON_DEFAULT_PAGE_SIZE = 100;
6
+ export declare const DAEMON_MAX_PAGE_SIZE = 100;
7
+ export declare const DAEMON_MAX_CONNECTIONS = 32;
8
+ export declare const DAEMON_REQUEST_TIMEOUT_MS = 5000;
9
+ export declare const DAEMON_METHODS: readonly ["daemon/hello", "session/list", "session/read", "session/pin"];
10
+ export declare const DaemonRequestIdSchema: Type.TString;
11
+ export declare const DaemonSessionIdSchema: Type.TString;
12
+ export declare const DaemonErrorCodeSchema: Type.TUnion<[Type.TLiteral<"protocol.invalid_request">, Type.TLiteral<"protocol.version_mismatch">, Type.TLiteral<"daemon.read_only">, Type.TLiteral<"daemon.not_found">, Type.TLiteral<"daemon.request_too_large">, Type.TLiteral<"daemon.response_too_large">, Type.TLiteral<"daemon.timeout">, Type.TLiteral<"daemon.internal">]>;
13
+ export type DaemonErrorCode = Static<typeof DaemonErrorCodeSchema>;
14
+ export declare const DaemonErrorSchema: Type.TObject<{
15
+ code: Type.TUnion<[Type.TLiteral<"protocol.invalid_request">, Type.TLiteral<"protocol.version_mismatch">, Type.TLiteral<"daemon.read_only">, Type.TLiteral<"daemon.not_found">, Type.TLiteral<"daemon.request_too_large">, Type.TLiteral<"daemon.response_too_large">, Type.TLiteral<"daemon.timeout">, Type.TLiteral<"daemon.internal">]>;
16
+ message: Type.TString;
17
+ }>;
18
+ export type DaemonError = Static<typeof DaemonErrorSchema>;
19
+ /**
20
+ * `read_only` describes the whole wire surface, not one method: it is `true`
21
+ * only while every advertised method is a read. `session/pin` makes it
22
+ * `false`, while `DaemonSessionReadResultSchema.read_only` keeps describing
23
+ * that one response, which is still a read-only snapshot.
24
+ */
25
+ export declare const DaemonHelloResultSchema: Type.TObject<{
26
+ protocol_version: Type.TLiteral<1>;
27
+ read_only: Type.TBoolean;
28
+ methods: Type.TArray<Type.TUnion<[Type.TLiteral<"daemon/hello">, Type.TLiteral<"session/list">, Type.TLiteral<"session/read">, Type.TLiteral<"session/pin">]>>;
29
+ pid: Type.TInteger;
30
+ started_at: Type.TString;
31
+ }>;
32
+ export type DaemonHelloResult = Static<typeof DaemonHelloResultSchema>;
33
+ export declare const DaemonSessionSummarySchema: Type.TObject<{
34
+ id: Type.TString;
35
+ created_at: Type.TString;
36
+ updated_at: Type.TString;
37
+ title: Type.TUnion<[Type.TString, Type.TNull]>;
38
+ pinned: Type.TBoolean;
39
+ last_seq: Type.TInteger;
40
+ cwd: Type.TString;
41
+ }>;
42
+ export type DaemonSessionSummary = Static<typeof DaemonSessionSummarySchema>;
43
+ export declare const DaemonSessionListResultSchema: Type.TObject<{
44
+ sessions: Type.TArray<Type.TObject<{
45
+ id: Type.TString;
46
+ created_at: Type.TString;
47
+ updated_at: Type.TString;
48
+ title: Type.TUnion<[Type.TString, Type.TNull]>;
49
+ pinned: Type.TBoolean;
50
+ last_seq: Type.TInteger;
51
+ cwd: Type.TString;
52
+ }>>;
53
+ }>;
54
+ export type DaemonSessionListResult = Static<typeof DaemonSessionListResultSchema>;
55
+ export declare const DaemonSessionReadResultSchema: Type.TObject<{
56
+ header: Type.TObject<{
57
+ type: Type.TLiteral<"codepunk/session">;
58
+ version: Type.TLiteral<1>;
59
+ id: Type.TString;
60
+ project_id: Type.TString;
61
+ cwd: Type.TString;
62
+ created_at: Type.TString;
63
+ pi_version: Type.TString;
64
+ model: Type.TUnion<[Type.TString, Type.TNull]>;
65
+ parent_session_id: Type.TOptional<Type.TString>;
66
+ fork_entry_id: Type.TOptional<Type.TString>;
67
+ }>;
68
+ metadata: Type.TObject<{
69
+ version: Type.TLiteral<1>;
70
+ updated_at: Type.TString;
71
+ title: Type.TUnion<[Type.TString, Type.TNull]>;
72
+ pinned: Type.TBoolean;
73
+ decision_ref: Type.TUnion<[Type.TString, Type.TNull]>;
74
+ log_seq: Type.TInteger;
75
+ state_covers_seq: Type.TInteger;
76
+ }>;
77
+ events: Type.TArray<Type.TUnion<[Type.TObject<{
78
+ type: Type.TLiteral<"codepunk/event">;
79
+ version: Type.TLiteral<1>;
80
+ seq: Type.TInteger;
81
+ at: Type.TString;
82
+ kind: Type.TLiteral<"run/start">;
83
+ data: Type.TObject<{
84
+ run_id: Type.TString;
85
+ session_id: Type.TString;
86
+ }>;
87
+ }>, Type.TObject<{
88
+ type: Type.TLiteral<"codepunk/event">;
89
+ version: Type.TLiteral<1>;
90
+ seq: Type.TInteger;
91
+ at: Type.TString;
92
+ kind: Type.TLiteral<"user/input">;
93
+ data: Type.TObject<{
94
+ run_id: Type.TString;
95
+ text: Type.TString;
96
+ }>;
97
+ }>, Type.TObject<{
98
+ type: Type.TLiteral<"codepunk/event">;
99
+ version: Type.TLiteral<1>;
100
+ seq: Type.TInteger;
101
+ at: Type.TString;
102
+ kind: Type.TLiteral<"session/forked">;
103
+ data: Type.TObject<{
104
+ parent_session_id: Type.TString;
105
+ parent_last_seq: Type.TInteger;
106
+ parent_state_covers_seq: Type.TInteger;
107
+ parent_state_sha256: Type.TString;
108
+ fork_entry_id: Type.TUnion<[Type.TString, Type.TNull]>;
109
+ mode: Type.TUnion<[Type.TLiteral<"clone">, Type.TLiteral<"live">]>;
110
+ }>;
111
+ }>, Type.TObject<{
112
+ type: Type.TLiteral<"codepunk/event">;
113
+ version: Type.TLiteral<1>;
114
+ seq: Type.TInteger;
115
+ at: Type.TString;
116
+ kind: Type.TLiteral<"session/tree">;
117
+ data: Type.TObject<{
118
+ action: Type.TLiteral<"navigate">;
119
+ from_entry_id: Type.TUnion<[Type.TString, Type.TNull]>;
120
+ to_entry_id: Type.TUnion<[Type.TString, Type.TNull]>;
121
+ target_entry_id: Type.TOptional<Type.TString>;
122
+ branch_entries: Type.TInteger;
123
+ }>;
124
+ }>, Type.TObject<{
125
+ type: Type.TLiteral<"codepunk/event">;
126
+ version: Type.TLiteral<1>;
127
+ seq: Type.TInteger;
128
+ at: Type.TString;
129
+ kind: Type.TLiteral<"approval/answer">;
130
+ data: Type.TObject<{
131
+ request_id: Type.TString;
132
+ answer: Type.TUnion<[Type.TLiteral<"allow">, Type.TLiteral<"deny">]>;
133
+ scope: Type.TOptional<Type.TUnion<[Type.TLiteral<"once">, Type.TLiteral<"session">, Type.TLiteral<"persistent">]>>;
134
+ guidance: Type.TOptional<Type.TString>;
135
+ channel: Type.TString;
136
+ channel_id: Type.TString;
137
+ nonce_sha256: Type.TString;
138
+ worker_id: Type.TString;
139
+ session_id: Type.TString;
140
+ tool_call_id: Type.TString;
141
+ answered_at: Type.TString;
142
+ }>;
143
+ }>, Type.TObject<{
144
+ type: Type.TLiteral<"codepunk/event">;
145
+ version: Type.TLiteral<1>;
146
+ seq: Type.TInteger;
147
+ at: Type.TString;
148
+ kind: Type.TLiteral<"bash/result">;
149
+ data: Type.TObject<{
150
+ run_id: Type.TString;
151
+ command: Type.TString;
152
+ exit_code: Type.TUnion<[Type.TInteger, Type.TNull]>;
153
+ output_sha256: Type.TUnion<[Type.TString, Type.TNull]>;
154
+ cancelled: Type.TBoolean;
155
+ }>;
156
+ }>, Type.TObject<{
157
+ type: Type.TLiteral<"codepunk/event">;
158
+ version: Type.TLiteral<1>;
159
+ seq: Type.TInteger;
160
+ at: Type.TString;
161
+ kind: Type.TLiteral<"commit/created">;
162
+ data: Type.TObject<{
163
+ run_id: Type.TString;
164
+ commit: Type.TString;
165
+ previous_commit: Type.TUnion<[Type.TString, Type.TNull]>;
166
+ tree: Type.TString;
167
+ message_sha256: Type.TString;
168
+ message_bytes: Type.TInteger;
169
+ files: Type.TArray<Type.TString>;
170
+ stage: Type.TUnion<[Type.TLiteral<"staged">, Type.TLiteral<"tracked">, Type.TLiteral<"all">]>;
171
+ root: Type.TString;
172
+ evidence_head: Type.TUnion<[Type.TString, Type.TNull]>;
173
+ }>;
174
+ }>, Type.TObject<{
175
+ type: Type.TLiteral<"codepunk/event">;
176
+ version: Type.TLiteral<1>;
177
+ seq: Type.TInteger;
178
+ at: Type.TString;
179
+ kind: Type.TLiteral<"checkpoint/restore">;
180
+ data: Type.TObject<{
181
+ action: Type.TUnion<[Type.TLiteral<"undo">, Type.TLiteral<"redo">]>;
182
+ checkpoint_id: Type.TString;
183
+ tool_call_id: Type.TString;
184
+ target: Type.TString;
185
+ from_sha256: Type.TString;
186
+ to_sha256: Type.TString;
187
+ }>;
188
+ }>, Type.TObject<{
189
+ type: Type.TLiteral<"codepunk/event">;
190
+ version: Type.TLiteral<1>;
191
+ seq: Type.TInteger;
192
+ at: Type.TString;
193
+ kind: Type.TLiteral<"context/loaded">;
194
+ data: Type.TObject<{
195
+ sources: Type.TArray<Type.TObject<{
196
+ rank: Type.TInteger;
197
+ kind: Type.TUnion<[Type.TLiteral<"user-instructions">, Type.TLiteral<"project-instructions">, Type.TLiteral<"append">]>;
198
+ source: Type.TString;
199
+ sha256: Type.TString;
200
+ bytes: Type.TInteger;
201
+ truncated: Type.TBoolean;
202
+ }>>;
203
+ warnings: Type.TArray<Type.TString>;
204
+ total_bytes: Type.TInteger;
205
+ truncated: Type.TBoolean;
206
+ }>;
207
+ }>, Type.TObject<{
208
+ type: Type.TLiteral<"codepunk/event">;
209
+ version: Type.TLiteral<1>;
210
+ seq: Type.TInteger;
211
+ at: Type.TString;
212
+ kind: Type.TLiteral<"trust/decision">;
213
+ data: Type.TObject<{
214
+ cwd: Type.TString;
215
+ root: Type.TString;
216
+ decision: Type.TUnion<[Type.TLiteral<"trusted">, Type.TLiteral<"untrusted">]>;
217
+ mode: Type.TOptional<Type.TUnion<[Type.TLiteral<"all">, Type.TLiteral<"custom">, Type.TLiteral<"none">]>>;
218
+ source: Type.TUnion<[Type.TLiteral<"flag">, Type.TLiteral<"saved">, Type.TLiteral<"prompt">, Type.TLiteral<"default">, Type.TLiteral<"no-resources">]>;
219
+ resources: Type.TArray<Type.TString>;
220
+ skipped: Type.TArray<Type.TString>;
221
+ grants: Type.TOptional<Type.TObject<{
222
+ config: Type.TBoolean;
223
+ policy: Type.TBoolean;
224
+ skills: Type.TBoolean;
225
+ instructions: Type.TBoolean;
226
+ }>>;
227
+ available: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"config">, Type.TLiteral<"policy">, Type.TLiteral<"skills">, Type.TLiteral<"instructions">]>>>;
228
+ }>;
229
+ }>, Type.TObject<{
230
+ type: Type.TLiteral<"codepunk/event">;
231
+ version: Type.TLiteral<1>;
232
+ seq: Type.TInteger;
233
+ at: Type.TString;
234
+ kind: Type.TLiteral<"compaction/decision">;
235
+ data: Type.TObject<{
236
+ run_id: Type.TString;
237
+ reason: Type.TUnion<[Type.TLiteral<"manual">, Type.TLiteral<"threshold">, Type.TLiteral<"overflow">]>;
238
+ cancelled: Type.TBoolean;
239
+ entries: Type.TInteger;
240
+ keep_recent_tokens: Type.TInteger;
241
+ evidence_head: Type.TUnion<[Type.TString, Type.TNull]>;
242
+ failure: Type.TOptional<Type.TString>;
243
+ checkpoint: Type.TOptional<Type.TObject<{
244
+ compaction_entry_id: Type.TString;
245
+ first_kept_entry_id: Type.TString;
246
+ summary_sha256: Type.TString;
247
+ summary_bytes: Type.TInteger;
248
+ tokens_before: Type.TInteger;
249
+ messages_before: Type.TInteger;
250
+ messages_after: Type.TInteger;
251
+ model: Type.TUnion<[Type.TString, Type.TNull]>;
252
+ loadout_sha256: Type.TUnion<[Type.TString, Type.TNull]>;
253
+ tool_names: Type.TArray<Type.TString>;
254
+ usage: Type.TOptional<Type.TObject<{
255
+ input_tokens: Type.TInteger;
256
+ output_tokens: Type.TInteger;
257
+ cache_read_tokens: Type.TInteger;
258
+ cache_write_tokens: Type.TInteger;
259
+ total_tokens: Type.TInteger;
260
+ cost_total: Type.TNumber;
261
+ }>>;
262
+ }>>;
263
+ }>;
264
+ }>, Type.TObject<{
265
+ type: Type.TLiteral<"codepunk/event">;
266
+ version: Type.TLiteral<1>;
267
+ seq: Type.TInteger;
268
+ at: Type.TString;
269
+ kind: Type.TLiteral<"context/request">;
270
+ data: Type.TObject<{
271
+ run_id: Type.TString;
272
+ request_id: Type.TString;
273
+ message_ids: Type.TArray<Type.TString>;
274
+ omitted: Type.TObject<{
275
+ ids: Type.TArray<Type.TString>;
276
+ ranges: Type.TArray<Type.TObject<{
277
+ start: Type.TInteger;
278
+ end: Type.TInteger;
279
+ }>>;
280
+ }>;
281
+ truncation_sha256: Type.TString;
282
+ provider: Type.TString;
283
+ model: Type.TString;
284
+ token_estimate: Type.TInteger;
285
+ compaction_id: Type.TUnion<[Type.TString, Type.TNull]>;
286
+ }>;
287
+ }>, Type.TObject<{
288
+ type: Type.TLiteral<"codepunk/event">;
289
+ version: Type.TLiteral<1>;
290
+ seq: Type.TInteger;
291
+ at: Type.TString;
292
+ kind: Type.TLiteral<"run/end">;
293
+ data: Type.TObject<{
294
+ run_id: Type.TString;
295
+ state: Type.TUnion<[Type.TLiteral<"settled">, Type.TLiteral<"failed">, Type.TLiteral<"aborted">, Type.TLiteral<"cancelled">]>;
296
+ termination: Type.TUnion<[Type.TString, Type.TNull]>;
297
+ evidence_head: Type.TUnion<[Type.TString, Type.TNull]>;
298
+ actor: Type.TString;
299
+ }>;
300
+ }>, Type.TObject<{
301
+ type: Type.TLiteral<"codepunk/event">;
302
+ version: Type.TLiteral<1>;
303
+ seq: Type.TInteger;
304
+ at: Type.TString;
305
+ kind: Type.TLiteral<"verdict/sign_off">;
306
+ data: Type.TObject<{
307
+ sign_off_id: Type.TString;
308
+ previous_sign_off_id: Type.TUnion<[Type.TString, Type.TNull]>;
309
+ run_id: Type.TString;
310
+ evidence_head: Type.TString;
311
+ signed_verdict: Type.TUnion<[Type.TLiteral<"complete">, Type.TLiteral<"incomplete">]>;
312
+ channel: Type.TUnion<[Type.TLiteral<"tui">, Type.TLiteral<"cli">]>;
313
+ actor: Type.TString;
314
+ signed_at: Type.TString;
315
+ }>;
316
+ }>, Type.TObject<{
317
+ type: Type.TLiteral<"codepunk/event">;
318
+ version: Type.TLiteral<1>;
319
+ seq: Type.TInteger;
320
+ at: Type.TString;
321
+ kind: Type.TLiteral<"memory/write">;
322
+ data: Type.TObject<{
323
+ scope: Type.TUnion<[Type.TLiteral<"user">, Type.TLiteral<"project">]>;
324
+ action: Type.TUnion<[Type.TLiteral<"add">, Type.TLiteral<"edit">, Type.TLiteral<"delete">, Type.TLiteral<"archive">, Type.TLiteral<"reject">]>;
325
+ memory_id: Type.TUnion<[Type.TString, Type.TNull]>;
326
+ content_sha256: Type.TUnion<[Type.TString, Type.TNull]>;
327
+ source_refs: Type.TArray<Type.TString>;
328
+ reason: Type.TUnion<[Type.TString, Type.TNull]>;
329
+ }>;
330
+ }>, Type.TObject<{
331
+ type: Type.TLiteral<"codepunk/event">;
332
+ version: Type.TLiteral<1>;
333
+ seq: Type.TInteger;
334
+ at: Type.TString;
335
+ kind: Type.TLiteral<"memory/retrieve">;
336
+ data: Type.TObject<{
337
+ ids: Type.TArray<Type.TString>;
338
+ hashes: Type.TArray<Type.TString>;
339
+ cap: Type.TInteger;
340
+ truncated: Type.TBoolean;
341
+ digest_sha256: Type.TString;
342
+ }>;
343
+ }>, Type.TObject<{
344
+ type: Type.TLiteral<"codepunk/event">;
345
+ version: Type.TLiteral<1>;
346
+ seq: Type.TInteger;
347
+ at: Type.TString;
348
+ kind: Type.TLiteral<"model/change">;
349
+ data: Type.TObject<{
350
+ previous: Type.TUnion<[Type.TString, Type.TNull]>;
351
+ model: Type.TString;
352
+ thinking: Type.TUnion<[Type.TString, Type.TNull]>;
353
+ }>;
354
+ }>, Type.TObject<{
355
+ type: Type.TLiteral<"codepunk/event">;
356
+ version: Type.TLiteral<1>;
357
+ seq: Type.TInteger;
358
+ at: Type.TString;
359
+ kind: Type.TLiteral<"model/usage">;
360
+ data: Type.TObject<{
361
+ run_id: Type.TString;
362
+ provider: Type.TString;
363
+ model: Type.TString;
364
+ input_tokens: Type.TInteger;
365
+ output_tokens: Type.TInteger;
366
+ cache_read_tokens: Type.TInteger;
367
+ cache_write_tokens: Type.TInteger;
368
+ total_tokens: Type.TInteger;
369
+ cost_total: Type.TNumber;
370
+ stop_reason: Type.TString;
371
+ source: Type.TOptional<Type.TUnion<[Type.TLiteral<"assistant">, Type.TLiteral<"summary">]>>;
372
+ }>;
373
+ }>, Type.TObject<{
374
+ type: Type.TLiteral<"codepunk/event">;
375
+ version: Type.TLiteral<1>;
376
+ seq: Type.TInteger;
377
+ at: Type.TString;
378
+ kind: Type.TLiteral<"model/fallback">;
379
+ data: Type.TObject<{
380
+ from: Type.TString;
381
+ to: Type.TUnion<[Type.TString, Type.TNull]>;
382
+ reason: Type.TLiteral<"error">;
383
+ stop_reason: Type.TUnion<[Type.TString, Type.TNull]>;
384
+ attempted: Type.TArray<Type.TString>;
385
+ exhausted: Type.TBoolean;
386
+ chain_sha256: Type.TString;
387
+ }>;
388
+ }>, Type.TObject<{
389
+ type: Type.TLiteral<"codepunk/event">;
390
+ version: Type.TLiteral<1>;
391
+ seq: Type.TInteger;
392
+ at: Type.TString;
393
+ kind: Type.TLiteral<"model/retry_start">;
394
+ data: Type.TObject<{
395
+ run_id: Type.TString;
396
+ model: Type.TUnion<[Type.TString, Type.TNull]>;
397
+ attempt: Type.TInteger;
398
+ max_attempts: Type.TInteger;
399
+ delay_ms: Type.TInteger;
400
+ error_sha256: Type.TString;
401
+ error_preview: Type.TString;
402
+ }>;
403
+ }>, Type.TObject<{
404
+ type: Type.TLiteral<"codepunk/event">;
405
+ version: Type.TLiteral<1>;
406
+ seq: Type.TInteger;
407
+ at: Type.TString;
408
+ kind: Type.TLiteral<"model/retry_end">;
409
+ data: Type.TObject<{
410
+ run_id: Type.TString;
411
+ model: Type.TUnion<[Type.TString, Type.TNull]>;
412
+ attempt: Type.TInteger;
413
+ success: Type.TBoolean;
414
+ final_error_sha256: Type.TUnion<[Type.TString, Type.TNull]>;
415
+ final_error_preview: Type.TUnion<[Type.TString, Type.TNull]>;
416
+ }>;
417
+ }>, Type.TObject<{
418
+ type: Type.TLiteral<"codepunk/event">;
419
+ version: Type.TLiteral<1>;
420
+ seq: Type.TInteger;
421
+ at: Type.TString;
422
+ kind: Type.TLiteral<"budget/exceeded">;
423
+ data: Type.TObject<{
424
+ run_id: Type.TString;
425
+ limit_kind: Type.TUnion<[Type.TLiteral<"tool_calls">, Type.TLiteral<"wall_ms">, Type.TLiteral<"tokens">, Type.TLiteral<"cost">]>;
426
+ limit: Type.TNumber;
427
+ used: Type.TNumber;
428
+ action: Type.TUnion<[Type.TLiteral<"reject_call">, Type.TLiteral<"abort_run">]>;
429
+ }>;
430
+ }>, Type.TObject<{
431
+ type: Type.TLiteral<"codepunk/event">;
432
+ version: Type.TLiteral<1>;
433
+ seq: Type.TInteger;
434
+ at: Type.TString;
435
+ kind: Type.TLiteral<"loop_guard">;
436
+ data: Type.TObject<{
437
+ run_id: Type.TString;
438
+ tool: Type.TString;
439
+ canonical_argv: Type.TArray<Type.TString>;
440
+ cwd: Type.TString;
441
+ repeat_count: Type.TInteger;
442
+ threshold: Type.TInteger;
443
+ decision: Type.TUnion<[Type.TLiteral<"allow">, Type.TLiteral<"ask">, Type.TLiteral<"deny">]>;
444
+ }>;
445
+ }>, Type.TObject<{
446
+ type: Type.TLiteral<"codepunk/event">;
447
+ version: Type.TLiteral<1>;
448
+ seq: Type.TInteger;
449
+ at: Type.TString;
450
+ kind: Type.TLiteral<"network/request">;
451
+ data: Type.TObject<{
452
+ run_id: Type.TString;
453
+ domain: Type.TString;
454
+ requests: Type.TInteger;
455
+ bytes: Type.TInteger;
456
+ limit: Type.TObject<{
457
+ max_requests: Type.TUnion<[Type.TInteger, Type.TNull]>;
458
+ max_bytes: Type.TUnion<[Type.TInteger, Type.TNull]>;
459
+ }>;
460
+ decision: Type.TUnion<[Type.TLiteral<"allow">, Type.TLiteral<"ask">, Type.TLiteral<"deny">]>;
461
+ }>;
462
+ }>, Type.TObject<{
463
+ type: Type.TLiteral<"codepunk/event">;
464
+ version: Type.TLiteral<1>;
465
+ seq: Type.TInteger;
466
+ at: Type.TString;
467
+ kind: Type.TLiteral<"network/redirect">;
468
+ data: Type.TObject<{
469
+ run_id: Type.TString;
470
+ from: Type.TString;
471
+ to: Type.TString;
472
+ status: Type.TInteger;
473
+ decision: Type.TUnion<[Type.TLiteral<"allow">, Type.TLiteral<"ask">, Type.TLiteral<"deny">]>;
474
+ }>;
475
+ }>, Type.TObject<{
476
+ type: Type.TLiteral<"codepunk/event">;
477
+ version: Type.TLiteral<1>;
478
+ seq: Type.TInteger;
479
+ at: Type.TString;
480
+ kind: Type.TLiteral<"network/rejected">;
481
+ data: Type.TObject<{
482
+ run_id: Type.TString;
483
+ domain: Type.TString;
484
+ reason: Type.TString;
485
+ limit: Type.TObject<{
486
+ max_requests: Type.TUnion<[Type.TInteger, Type.TNull]>;
487
+ max_bytes: Type.TUnion<[Type.TInteger, Type.TNull]>;
488
+ }>;
489
+ }>;
490
+ }>, Type.TObject<{
491
+ type: Type.TLiteral<"codepunk/event">;
492
+ version: Type.TLiteral<1>;
493
+ seq: Type.TInteger;
494
+ at: Type.TString;
495
+ kind: Type.TLiteral<"mcp/server_start">;
496
+ data: Type.TObject<{
497
+ server: Type.TString;
498
+ command_sha256: Type.TString;
499
+ pid: Type.TInteger;
500
+ transport: Type.TUnion<[Type.TLiteral<"stdio">, Type.TLiteral<"http">]>;
501
+ coverage: Type.TLiteral<"uncovered">;
502
+ }>;
503
+ }>, Type.TObject<{
504
+ type: Type.TLiteral<"codepunk/event">;
505
+ version: Type.TLiteral<1>;
506
+ seq: Type.TInteger;
507
+ at: Type.TString;
508
+ kind: Type.TLiteral<"skill/loaded">;
509
+ data: Type.TObject<{
510
+ skills: Type.TArray<Type.TObject<{
511
+ name: Type.TString;
512
+ scope: Type.TUnion<[Type.TLiteral<"user">, Type.TLiteral<"project">]>;
513
+ sha256: Type.TString;
514
+ bytes: Type.TInteger;
515
+ }>>;
516
+ block_sha256: Type.TString;
517
+ }>;
518
+ }>, Type.TObject<{
519
+ type: Type.TLiteral<"codepunk/event">;
520
+ version: Type.TLiteral<1>;
521
+ seq: Type.TInteger;
522
+ at: Type.TString;
523
+ kind: Type.TLiteral<"skill/invoked">;
524
+ data: Type.TObject<{
525
+ name: Type.TString;
526
+ scope: Type.TUnion<[Type.TLiteral<"user">, Type.TLiteral<"project">]>;
527
+ sha256: Type.TString;
528
+ bytes: Type.TInteger;
529
+ }>;
530
+ }>, Type.TObject<{
531
+ type: Type.TLiteral<"codepunk/event">;
532
+ version: Type.TLiteral<1>;
533
+ seq: Type.TInteger;
534
+ at: Type.TString;
535
+ kind: Type.TLiteral<"plan/update">;
536
+ data: Type.TObject<{
537
+ run_id: Type.TString;
538
+ steps: Type.TArray<Type.TObject<{
539
+ step: Type.TString;
540
+ status: Type.TUnion<[Type.TLiteral<"pending">, Type.TLiteral<"in_progress">, Type.TLiteral<"completed">]>;
541
+ }>>;
542
+ explanation: Type.TUnion<[Type.TString, Type.TNull]>;
543
+ updated_at: Type.TString;
544
+ sha256: Type.TString;
545
+ }>;
546
+ }>, Type.TObject<{
547
+ type: Type.TLiteral<"codepunk/event">;
548
+ version: Type.TLiteral<1>;
549
+ seq: Type.TInteger;
550
+ at: Type.TString;
551
+ kind: Type.TLiteral<"todo/update">;
552
+ data: Type.TObject<{
553
+ run_id: Type.TString;
554
+ items: Type.TArray<Type.TObject<{
555
+ content: Type.TString;
556
+ status: Type.TUnion<[Type.TLiteral<"pending">, Type.TLiteral<"in_progress">, Type.TLiteral<"completed">]>;
557
+ }>>;
558
+ updated_at: Type.TString;
559
+ sha256: Type.TString;
560
+ }>;
561
+ }>, Type.TObject<{
562
+ type: Type.TLiteral<"codepunk/event">;
563
+ version: Type.TLiteral<1>;
564
+ seq: Type.TInteger;
565
+ at: Type.TString;
566
+ kind: Type.TLiteral<"autonomy/profile">;
567
+ data: Type.TObject<{
568
+ profile: Type.TUnion<[Type.TLiteral<"read-only">, Type.TLiteral<"ask">, Type.TLiteral<"scoped">]>;
569
+ source: Type.TUnion<[Type.TLiteral<"cli">, Type.TLiteral<"user-config">, Type.TLiteral<"default">]>;
570
+ rules_sha256: Type.TUnion<[Type.TString, Type.TNull]>;
571
+ rules: Type.TArray<Type.TObject<{
572
+ id: Type.TString;
573
+ argv: Type.TArray<Type.TString>;
574
+ cwd: Type.TString;
575
+ executable_sha256: Type.TString;
576
+ rule_sha256: Type.TString;
577
+ }>>;
578
+ }>;
579
+ }>, Type.TObject<{
580
+ type: Type.TLiteral<"codepunk/event">;
581
+ version: Type.TLiteral<1>;
582
+ seq: Type.TInteger;
583
+ at: Type.TString;
584
+ kind: Type.TLiteral<"autonomy/revoked">;
585
+ data: Type.TObject<{
586
+ profile: Type.TUnion<[Type.TLiteral<"read-only">, Type.TLiteral<"ask">, Type.TLiteral<"scoped">]>;
587
+ reason: Type.TLiteral<"session_end">;
588
+ }>;
589
+ }>, Type.TObject<{
590
+ type: Type.TLiteral<"codepunk/event">;
591
+ version: Type.TLiteral<1>;
592
+ seq: Type.TInteger;
593
+ at: Type.TString;
594
+ kind: Type.TLiteral<"subagent/result">;
595
+ data: Type.TObject<{
596
+ run_id: Type.TString;
597
+ parent_session_id: Type.TString;
598
+ child_session_id: Type.TString;
599
+ depth: Type.TInteger;
600
+ isolation: Type.TUnion<[Type.TLiteral<"worktree">, Type.TLiteral<"shared">]>;
601
+ model: Type.TUnion<[Type.TString, Type.TNull]>;
602
+ status: Type.TUnion<[Type.TLiteral<"completed">, Type.TLiteral<"failed">, Type.TLiteral<"stopped">]>;
603
+ summary: Type.TString;
604
+ evidence_head: Type.TUnion<[Type.TString, Type.TNull]>;
605
+ child_run_id: Type.TUnion<[Type.TString, Type.TNull]>;
606
+ exit_code: Type.TUnion<[Type.TInteger, Type.TNull]>;
607
+ error: Type.TUnion<[Type.TString, Type.TNull]>;
608
+ profile: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
609
+ profile_sha256: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
610
+ worktree: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
611
+ base_commit: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
612
+ transcript_path: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
613
+ changed_files: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
614
+ }>;
615
+ }>, Type.TObject<{
616
+ type: Type.TLiteral<"codepunk/event">;
617
+ version: Type.TLiteral<1>;
618
+ seq: Type.TInteger;
619
+ at: Type.TString;
620
+ kind: Type.TLiteral<"plugin/started">;
621
+ data: Type.TObject<{
622
+ plugin_id: Type.TString;
623
+ version: Type.TString;
624
+ manifest_sha256: Type.TString;
625
+ pid: Type.TInteger;
626
+ credential_verified: Type.TBoolean;
627
+ started_at: Type.TString;
628
+ }>;
629
+ }>, Type.TObject<{
630
+ type: Type.TLiteral<"codepunk/event">;
631
+ version: Type.TLiteral<1>;
632
+ seq: Type.TInteger;
633
+ at: Type.TString;
634
+ kind: Type.TLiteral<"plugin/tool_call">;
635
+ data: Type.TObject<{
636
+ run_id: Type.TString;
637
+ tool_call_id: Type.TString;
638
+ plugin_id: Type.TString;
639
+ plugin_manifest_sha256: Type.TString;
640
+ executor: Type.TLiteral<"child-host">;
641
+ decision: Type.TUnion<[Type.TLiteral<"allow">, Type.TLiteral<"ask">, Type.TLiteral<"deny">]>;
642
+ approval: Type.TUnion<[Type.TObject<{
643
+ channel: Type.TString;
644
+ request_id: Type.TString;
645
+ nonce_sha256: Type.TString;
646
+ ttl_ms: Type.TInteger;
647
+ worker_id: Type.TString;
648
+ session_id: Type.TString;
649
+ tool_call_id: Type.TString;
650
+ answer: Type.TUnion<[Type.TLiteral<"allow">, Type.TLiteral<"deny">]>;
651
+ scope: Type.TOptional<Type.TUnion<[Type.TLiteral<"once">, Type.TLiteral<"session">, Type.TLiteral<"persistent">]>>;
652
+ guidance: Type.TOptional<Type.TString>;
653
+ reused_from_request_id: Type.TOptional<Type.TString>;
654
+ args_sha256: Type.TOptional<Type.TString>;
655
+ diff_sha256: Type.TOptional<Type.TString>;
656
+ }>, Type.TNull]>;
657
+ outcome: Type.TUnion<[Type.TLiteral<"completed">, Type.TLiteral<"failed">, Type.TLiteral<"denied">, Type.TLiteral<"cancelled">]>;
658
+ reason: Type.TUnion<[Type.TString, Type.TNull]>;
659
+ }>;
660
+ }>, Type.TObject<{
661
+ type: Type.TLiteral<"codepunk/event">;
662
+ version: Type.TLiteral<1>;
663
+ seq: Type.TInteger;
664
+ at: Type.TString;
665
+ kind: Type.TLiteral<"plugin/stopped">;
666
+ data: Type.TObject<{
667
+ plugin_id: Type.TString;
668
+ pid: Type.TInteger;
669
+ credential_verified: Type.TBoolean;
670
+ reason: Type.TUnion<[Type.TLiteral<"exit">, Type.TLiteral<"crash">, Type.TLiteral<"timeout">, Type.TLiteral<"cancel">, Type.TLiteral<"shutdown">, Type.TLiteral<"error">]>;
671
+ exit_code: Type.TUnion<[Type.TInteger, Type.TNull]>;
672
+ stopped_at: Type.TString;
673
+ }>;
674
+ }>]>>;
675
+ after_seq: Type.TInteger;
676
+ next_seq: Type.TInteger;
677
+ has_more: Type.TBoolean;
678
+ read_only: Type.TLiteral<true>;
679
+ }>;
680
+ export type DaemonSessionReadResult = Static<typeof DaemonSessionReadResultSchema>;
681
+ export declare const DaemonSessionPinResultSchema: Type.TObject<{
682
+ session_id: Type.TString;
683
+ pinned: Type.TBoolean;
684
+ }>;
685
+ export type DaemonSessionPinResult = Static<typeof DaemonSessionPinResultSchema>;
686
+ export declare const DaemonHelloRequestSchema: Type.TObject<{
687
+ type: Type.TLiteral<"codepunk/daemon-request">;
688
+ version: Type.TLiteral<1>;
689
+ request_id: Type.TString;
690
+ method: Type.TLiteral<"daemon/hello">;
691
+ params: Type.TObject<{}>;
692
+ }>;
693
+ export declare const DaemonSessionListRequestSchema: Type.TObject<{
694
+ type: Type.TLiteral<"codepunk/daemon-request">;
695
+ version: Type.TLiteral<1>;
696
+ request_id: Type.TString;
697
+ method: Type.TLiteral<"session/list">;
698
+ params: Type.TObject<{}>;
699
+ }>;
700
+ export declare const DaemonSessionReadRequestSchema: Type.TObject<{
701
+ type: Type.TLiteral<"codepunk/daemon-request">;
702
+ version: Type.TLiteral<1>;
703
+ request_id: Type.TString;
704
+ method: Type.TLiteral<"session/read">;
705
+ params: Type.TObject<{
706
+ session_id: Type.TString;
707
+ after_seq: Type.TOptional<Type.TInteger>;
708
+ limit: Type.TOptional<Type.TInteger>;
709
+ }>;
710
+ }>;
711
+ export declare const DaemonSessionPinRequestSchema: Type.TObject<{
712
+ type: Type.TLiteral<"codepunk/daemon-request">;
713
+ version: Type.TLiteral<1>;
714
+ request_id: Type.TString;
715
+ method: Type.TLiteral<"session/pin">;
716
+ params: Type.TObject<{
717
+ session_id: Type.TString;
718
+ pinned: Type.TBoolean;
719
+ }>;
720
+ }>;
721
+ export declare const DaemonRequestSchema: Type.TUnion<[Type.TObject<{
722
+ type: Type.TLiteral<"codepunk/daemon-request">;
723
+ version: Type.TLiteral<1>;
724
+ request_id: Type.TString;
725
+ method: Type.TLiteral<"daemon/hello">;
726
+ params: Type.TObject<{}>;
727
+ }>, Type.TObject<{
728
+ type: Type.TLiteral<"codepunk/daemon-request">;
729
+ version: Type.TLiteral<1>;
730
+ request_id: Type.TString;
731
+ method: Type.TLiteral<"session/list">;
732
+ params: Type.TObject<{}>;
733
+ }>, Type.TObject<{
734
+ type: Type.TLiteral<"codepunk/daemon-request">;
735
+ version: Type.TLiteral<1>;
736
+ request_id: Type.TString;
737
+ method: Type.TLiteral<"session/read">;
738
+ params: Type.TObject<{
739
+ session_id: Type.TString;
740
+ after_seq: Type.TOptional<Type.TInteger>;
741
+ limit: Type.TOptional<Type.TInteger>;
742
+ }>;
743
+ }>, Type.TObject<{
744
+ type: Type.TLiteral<"codepunk/daemon-request">;
745
+ version: Type.TLiteral<1>;
746
+ request_id: Type.TString;
747
+ method: Type.TLiteral<"session/pin">;
748
+ params: Type.TObject<{
749
+ session_id: Type.TString;
750
+ pinned: Type.TBoolean;
751
+ }>;
752
+ }>]>;
753
+ export type DaemonRequest = Static<typeof DaemonRequestSchema>;
754
+ export declare const DaemonHelloResponseSchema: Type.TObject<{
755
+ type: Type.TLiteral<"codepunk/daemon-response">;
756
+ version: Type.TLiteral<1>;
757
+ request_id: Type.TString;
758
+ ok: Type.TLiteral<true>;
759
+ result: Type.TObject<{
760
+ protocol_version: Type.TLiteral<1>;
761
+ read_only: Type.TBoolean;
762
+ methods: Type.TArray<Type.TUnion<[Type.TLiteral<"daemon/hello">, Type.TLiteral<"session/list">, Type.TLiteral<"session/read">, Type.TLiteral<"session/pin">]>>;
763
+ pid: Type.TInteger;
764
+ started_at: Type.TString;
765
+ }>;
766
+ }>;
767
+ export declare const DaemonSessionListResponseSchema: Type.TObject<{
768
+ type: Type.TLiteral<"codepunk/daemon-response">;
769
+ version: Type.TLiteral<1>;
770
+ request_id: Type.TString;
771
+ ok: Type.TLiteral<true>;
772
+ result: Type.TObject<{
773
+ sessions: Type.TArray<Type.TObject<{
774
+ id: Type.TString;
775
+ created_at: Type.TString;
776
+ updated_at: Type.TString;
777
+ title: Type.TUnion<[Type.TString, Type.TNull]>;
778
+ pinned: Type.TBoolean;
779
+ last_seq: Type.TInteger;
780
+ cwd: Type.TString;
781
+ }>>;
782
+ }>;
783
+ }>;
784
+ export declare const DaemonSessionReadResponseSchema: Type.TObject<{
785
+ type: Type.TLiteral<"codepunk/daemon-response">;
786
+ version: Type.TLiteral<1>;
787
+ request_id: Type.TString;
788
+ ok: Type.TLiteral<true>;
789
+ result: Type.TObject<{
790
+ header: Type.TObject<{
791
+ type: Type.TLiteral<"codepunk/session">;
792
+ version: Type.TLiteral<1>;
793
+ id: Type.TString;
794
+ project_id: Type.TString;
795
+ cwd: Type.TString;
796
+ created_at: Type.TString;
797
+ pi_version: Type.TString;
798
+ model: Type.TUnion<[Type.TString, Type.TNull]>;
799
+ parent_session_id: Type.TOptional<Type.TString>;
800
+ fork_entry_id: Type.TOptional<Type.TString>;
801
+ }>;
802
+ metadata: Type.TObject<{
803
+ version: Type.TLiteral<1>;
804
+ updated_at: Type.TString;
805
+ title: Type.TUnion<[Type.TString, Type.TNull]>;
806
+ pinned: Type.TBoolean;
807
+ decision_ref: Type.TUnion<[Type.TString, Type.TNull]>;
808
+ log_seq: Type.TInteger;
809
+ state_covers_seq: Type.TInteger;
810
+ }>;
811
+ events: Type.TArray<Type.TUnion<[Type.TObject<{
812
+ type: Type.TLiteral<"codepunk/event">;
813
+ version: Type.TLiteral<1>;
814
+ seq: Type.TInteger;
815
+ at: Type.TString;
816
+ kind: Type.TLiteral<"run/start">;
817
+ data: Type.TObject<{
818
+ run_id: Type.TString;
819
+ session_id: Type.TString;
820
+ }>;
821
+ }>, Type.TObject<{
822
+ type: Type.TLiteral<"codepunk/event">;
823
+ version: Type.TLiteral<1>;
824
+ seq: Type.TInteger;
825
+ at: Type.TString;
826
+ kind: Type.TLiteral<"user/input">;
827
+ data: Type.TObject<{
828
+ run_id: Type.TString;
829
+ text: Type.TString;
830
+ }>;
831
+ }>, Type.TObject<{
832
+ type: Type.TLiteral<"codepunk/event">;
833
+ version: Type.TLiteral<1>;
834
+ seq: Type.TInteger;
835
+ at: Type.TString;
836
+ kind: Type.TLiteral<"session/forked">;
837
+ data: Type.TObject<{
838
+ parent_session_id: Type.TString;
839
+ parent_last_seq: Type.TInteger;
840
+ parent_state_covers_seq: Type.TInteger;
841
+ parent_state_sha256: Type.TString;
842
+ fork_entry_id: Type.TUnion<[Type.TString, Type.TNull]>;
843
+ mode: Type.TUnion<[Type.TLiteral<"clone">, Type.TLiteral<"live">]>;
844
+ }>;
845
+ }>, Type.TObject<{
846
+ type: Type.TLiteral<"codepunk/event">;
847
+ version: Type.TLiteral<1>;
848
+ seq: Type.TInteger;
849
+ at: Type.TString;
850
+ kind: Type.TLiteral<"session/tree">;
851
+ data: Type.TObject<{
852
+ action: Type.TLiteral<"navigate">;
853
+ from_entry_id: Type.TUnion<[Type.TString, Type.TNull]>;
854
+ to_entry_id: Type.TUnion<[Type.TString, Type.TNull]>;
855
+ target_entry_id: Type.TOptional<Type.TString>;
856
+ branch_entries: Type.TInteger;
857
+ }>;
858
+ }>, Type.TObject<{
859
+ type: Type.TLiteral<"codepunk/event">;
860
+ version: Type.TLiteral<1>;
861
+ seq: Type.TInteger;
862
+ at: Type.TString;
863
+ kind: Type.TLiteral<"approval/answer">;
864
+ data: Type.TObject<{
865
+ request_id: Type.TString;
866
+ answer: Type.TUnion<[Type.TLiteral<"allow">, Type.TLiteral<"deny">]>;
867
+ scope: Type.TOptional<Type.TUnion<[Type.TLiteral<"once">, Type.TLiteral<"session">, Type.TLiteral<"persistent">]>>;
868
+ guidance: Type.TOptional<Type.TString>;
869
+ channel: Type.TString;
870
+ channel_id: Type.TString;
871
+ nonce_sha256: Type.TString;
872
+ worker_id: Type.TString;
873
+ session_id: Type.TString;
874
+ tool_call_id: Type.TString;
875
+ answered_at: Type.TString;
876
+ }>;
877
+ }>, Type.TObject<{
878
+ type: Type.TLiteral<"codepunk/event">;
879
+ version: Type.TLiteral<1>;
880
+ seq: Type.TInteger;
881
+ at: Type.TString;
882
+ kind: Type.TLiteral<"bash/result">;
883
+ data: Type.TObject<{
884
+ run_id: Type.TString;
885
+ command: Type.TString;
886
+ exit_code: Type.TUnion<[Type.TInteger, Type.TNull]>;
887
+ output_sha256: Type.TUnion<[Type.TString, Type.TNull]>;
888
+ cancelled: Type.TBoolean;
889
+ }>;
890
+ }>, Type.TObject<{
891
+ type: Type.TLiteral<"codepunk/event">;
892
+ version: Type.TLiteral<1>;
893
+ seq: Type.TInteger;
894
+ at: Type.TString;
895
+ kind: Type.TLiteral<"commit/created">;
896
+ data: Type.TObject<{
897
+ run_id: Type.TString;
898
+ commit: Type.TString;
899
+ previous_commit: Type.TUnion<[Type.TString, Type.TNull]>;
900
+ tree: Type.TString;
901
+ message_sha256: Type.TString;
902
+ message_bytes: Type.TInteger;
903
+ files: Type.TArray<Type.TString>;
904
+ stage: Type.TUnion<[Type.TLiteral<"staged">, Type.TLiteral<"tracked">, Type.TLiteral<"all">]>;
905
+ root: Type.TString;
906
+ evidence_head: Type.TUnion<[Type.TString, Type.TNull]>;
907
+ }>;
908
+ }>, Type.TObject<{
909
+ type: Type.TLiteral<"codepunk/event">;
910
+ version: Type.TLiteral<1>;
911
+ seq: Type.TInteger;
912
+ at: Type.TString;
913
+ kind: Type.TLiteral<"checkpoint/restore">;
914
+ data: Type.TObject<{
915
+ action: Type.TUnion<[Type.TLiteral<"undo">, Type.TLiteral<"redo">]>;
916
+ checkpoint_id: Type.TString;
917
+ tool_call_id: Type.TString;
918
+ target: Type.TString;
919
+ from_sha256: Type.TString;
920
+ to_sha256: Type.TString;
921
+ }>;
922
+ }>, Type.TObject<{
923
+ type: Type.TLiteral<"codepunk/event">;
924
+ version: Type.TLiteral<1>;
925
+ seq: Type.TInteger;
926
+ at: Type.TString;
927
+ kind: Type.TLiteral<"context/loaded">;
928
+ data: Type.TObject<{
929
+ sources: Type.TArray<Type.TObject<{
930
+ rank: Type.TInteger;
931
+ kind: Type.TUnion<[Type.TLiteral<"user-instructions">, Type.TLiteral<"project-instructions">, Type.TLiteral<"append">]>;
932
+ source: Type.TString;
933
+ sha256: Type.TString;
934
+ bytes: Type.TInteger;
935
+ truncated: Type.TBoolean;
936
+ }>>;
937
+ warnings: Type.TArray<Type.TString>;
938
+ total_bytes: Type.TInteger;
939
+ truncated: Type.TBoolean;
940
+ }>;
941
+ }>, Type.TObject<{
942
+ type: Type.TLiteral<"codepunk/event">;
943
+ version: Type.TLiteral<1>;
944
+ seq: Type.TInteger;
945
+ at: Type.TString;
946
+ kind: Type.TLiteral<"trust/decision">;
947
+ data: Type.TObject<{
948
+ cwd: Type.TString;
949
+ root: Type.TString;
950
+ decision: Type.TUnion<[Type.TLiteral<"trusted">, Type.TLiteral<"untrusted">]>;
951
+ mode: Type.TOptional<Type.TUnion<[Type.TLiteral<"all">, Type.TLiteral<"custom">, Type.TLiteral<"none">]>>;
952
+ source: Type.TUnion<[Type.TLiteral<"flag">, Type.TLiteral<"saved">, Type.TLiteral<"prompt">, Type.TLiteral<"default">, Type.TLiteral<"no-resources">]>;
953
+ resources: Type.TArray<Type.TString>;
954
+ skipped: Type.TArray<Type.TString>;
955
+ grants: Type.TOptional<Type.TObject<{
956
+ config: Type.TBoolean;
957
+ policy: Type.TBoolean;
958
+ skills: Type.TBoolean;
959
+ instructions: Type.TBoolean;
960
+ }>>;
961
+ available: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"config">, Type.TLiteral<"policy">, Type.TLiteral<"skills">, Type.TLiteral<"instructions">]>>>;
962
+ }>;
963
+ }>, Type.TObject<{
964
+ type: Type.TLiteral<"codepunk/event">;
965
+ version: Type.TLiteral<1>;
966
+ seq: Type.TInteger;
967
+ at: Type.TString;
968
+ kind: Type.TLiteral<"compaction/decision">;
969
+ data: Type.TObject<{
970
+ run_id: Type.TString;
971
+ reason: Type.TUnion<[Type.TLiteral<"manual">, Type.TLiteral<"threshold">, Type.TLiteral<"overflow">]>;
972
+ cancelled: Type.TBoolean;
973
+ entries: Type.TInteger;
974
+ keep_recent_tokens: Type.TInteger;
975
+ evidence_head: Type.TUnion<[Type.TString, Type.TNull]>;
976
+ failure: Type.TOptional<Type.TString>;
977
+ checkpoint: Type.TOptional<Type.TObject<{
978
+ compaction_entry_id: Type.TString;
979
+ first_kept_entry_id: Type.TString;
980
+ summary_sha256: Type.TString;
981
+ summary_bytes: Type.TInteger;
982
+ tokens_before: Type.TInteger;
983
+ messages_before: Type.TInteger;
984
+ messages_after: Type.TInteger;
985
+ model: Type.TUnion<[Type.TString, Type.TNull]>;
986
+ loadout_sha256: Type.TUnion<[Type.TString, Type.TNull]>;
987
+ tool_names: Type.TArray<Type.TString>;
988
+ usage: Type.TOptional<Type.TObject<{
989
+ input_tokens: Type.TInteger;
990
+ output_tokens: Type.TInteger;
991
+ cache_read_tokens: Type.TInteger;
992
+ cache_write_tokens: Type.TInteger;
993
+ total_tokens: Type.TInteger;
994
+ cost_total: Type.TNumber;
995
+ }>>;
996
+ }>>;
997
+ }>;
998
+ }>, Type.TObject<{
999
+ type: Type.TLiteral<"codepunk/event">;
1000
+ version: Type.TLiteral<1>;
1001
+ seq: Type.TInteger;
1002
+ at: Type.TString;
1003
+ kind: Type.TLiteral<"context/request">;
1004
+ data: Type.TObject<{
1005
+ run_id: Type.TString;
1006
+ request_id: Type.TString;
1007
+ message_ids: Type.TArray<Type.TString>;
1008
+ omitted: Type.TObject<{
1009
+ ids: Type.TArray<Type.TString>;
1010
+ ranges: Type.TArray<Type.TObject<{
1011
+ start: Type.TInteger;
1012
+ end: Type.TInteger;
1013
+ }>>;
1014
+ }>;
1015
+ truncation_sha256: Type.TString;
1016
+ provider: Type.TString;
1017
+ model: Type.TString;
1018
+ token_estimate: Type.TInteger;
1019
+ compaction_id: Type.TUnion<[Type.TString, Type.TNull]>;
1020
+ }>;
1021
+ }>, Type.TObject<{
1022
+ type: Type.TLiteral<"codepunk/event">;
1023
+ version: Type.TLiteral<1>;
1024
+ seq: Type.TInteger;
1025
+ at: Type.TString;
1026
+ kind: Type.TLiteral<"run/end">;
1027
+ data: Type.TObject<{
1028
+ run_id: Type.TString;
1029
+ state: Type.TUnion<[Type.TLiteral<"settled">, Type.TLiteral<"failed">, Type.TLiteral<"aborted">, Type.TLiteral<"cancelled">]>;
1030
+ termination: Type.TUnion<[Type.TString, Type.TNull]>;
1031
+ evidence_head: Type.TUnion<[Type.TString, Type.TNull]>;
1032
+ actor: Type.TString;
1033
+ }>;
1034
+ }>, Type.TObject<{
1035
+ type: Type.TLiteral<"codepunk/event">;
1036
+ version: Type.TLiteral<1>;
1037
+ seq: Type.TInteger;
1038
+ at: Type.TString;
1039
+ kind: Type.TLiteral<"verdict/sign_off">;
1040
+ data: Type.TObject<{
1041
+ sign_off_id: Type.TString;
1042
+ previous_sign_off_id: Type.TUnion<[Type.TString, Type.TNull]>;
1043
+ run_id: Type.TString;
1044
+ evidence_head: Type.TString;
1045
+ signed_verdict: Type.TUnion<[Type.TLiteral<"complete">, Type.TLiteral<"incomplete">]>;
1046
+ channel: Type.TUnion<[Type.TLiteral<"tui">, Type.TLiteral<"cli">]>;
1047
+ actor: Type.TString;
1048
+ signed_at: Type.TString;
1049
+ }>;
1050
+ }>, Type.TObject<{
1051
+ type: Type.TLiteral<"codepunk/event">;
1052
+ version: Type.TLiteral<1>;
1053
+ seq: Type.TInteger;
1054
+ at: Type.TString;
1055
+ kind: Type.TLiteral<"memory/write">;
1056
+ data: Type.TObject<{
1057
+ scope: Type.TUnion<[Type.TLiteral<"user">, Type.TLiteral<"project">]>;
1058
+ action: Type.TUnion<[Type.TLiteral<"add">, Type.TLiteral<"edit">, Type.TLiteral<"delete">, Type.TLiteral<"archive">, Type.TLiteral<"reject">]>;
1059
+ memory_id: Type.TUnion<[Type.TString, Type.TNull]>;
1060
+ content_sha256: Type.TUnion<[Type.TString, Type.TNull]>;
1061
+ source_refs: Type.TArray<Type.TString>;
1062
+ reason: Type.TUnion<[Type.TString, Type.TNull]>;
1063
+ }>;
1064
+ }>, Type.TObject<{
1065
+ type: Type.TLiteral<"codepunk/event">;
1066
+ version: Type.TLiteral<1>;
1067
+ seq: Type.TInteger;
1068
+ at: Type.TString;
1069
+ kind: Type.TLiteral<"memory/retrieve">;
1070
+ data: Type.TObject<{
1071
+ ids: Type.TArray<Type.TString>;
1072
+ hashes: Type.TArray<Type.TString>;
1073
+ cap: Type.TInteger;
1074
+ truncated: Type.TBoolean;
1075
+ digest_sha256: Type.TString;
1076
+ }>;
1077
+ }>, Type.TObject<{
1078
+ type: Type.TLiteral<"codepunk/event">;
1079
+ version: Type.TLiteral<1>;
1080
+ seq: Type.TInteger;
1081
+ at: Type.TString;
1082
+ kind: Type.TLiteral<"model/change">;
1083
+ data: Type.TObject<{
1084
+ previous: Type.TUnion<[Type.TString, Type.TNull]>;
1085
+ model: Type.TString;
1086
+ thinking: Type.TUnion<[Type.TString, Type.TNull]>;
1087
+ }>;
1088
+ }>, Type.TObject<{
1089
+ type: Type.TLiteral<"codepunk/event">;
1090
+ version: Type.TLiteral<1>;
1091
+ seq: Type.TInteger;
1092
+ at: Type.TString;
1093
+ kind: Type.TLiteral<"model/usage">;
1094
+ data: Type.TObject<{
1095
+ run_id: Type.TString;
1096
+ provider: Type.TString;
1097
+ model: Type.TString;
1098
+ input_tokens: Type.TInteger;
1099
+ output_tokens: Type.TInteger;
1100
+ cache_read_tokens: Type.TInteger;
1101
+ cache_write_tokens: Type.TInteger;
1102
+ total_tokens: Type.TInteger;
1103
+ cost_total: Type.TNumber;
1104
+ stop_reason: Type.TString;
1105
+ source: Type.TOptional<Type.TUnion<[Type.TLiteral<"assistant">, Type.TLiteral<"summary">]>>;
1106
+ }>;
1107
+ }>, Type.TObject<{
1108
+ type: Type.TLiteral<"codepunk/event">;
1109
+ version: Type.TLiteral<1>;
1110
+ seq: Type.TInteger;
1111
+ at: Type.TString;
1112
+ kind: Type.TLiteral<"model/fallback">;
1113
+ data: Type.TObject<{
1114
+ from: Type.TString;
1115
+ to: Type.TUnion<[Type.TString, Type.TNull]>;
1116
+ reason: Type.TLiteral<"error">;
1117
+ stop_reason: Type.TUnion<[Type.TString, Type.TNull]>;
1118
+ attempted: Type.TArray<Type.TString>;
1119
+ exhausted: Type.TBoolean;
1120
+ chain_sha256: Type.TString;
1121
+ }>;
1122
+ }>, Type.TObject<{
1123
+ type: Type.TLiteral<"codepunk/event">;
1124
+ version: Type.TLiteral<1>;
1125
+ seq: Type.TInteger;
1126
+ at: Type.TString;
1127
+ kind: Type.TLiteral<"model/retry_start">;
1128
+ data: Type.TObject<{
1129
+ run_id: Type.TString;
1130
+ model: Type.TUnion<[Type.TString, Type.TNull]>;
1131
+ attempt: Type.TInteger;
1132
+ max_attempts: Type.TInteger;
1133
+ delay_ms: Type.TInteger;
1134
+ error_sha256: Type.TString;
1135
+ error_preview: Type.TString;
1136
+ }>;
1137
+ }>, Type.TObject<{
1138
+ type: Type.TLiteral<"codepunk/event">;
1139
+ version: Type.TLiteral<1>;
1140
+ seq: Type.TInteger;
1141
+ at: Type.TString;
1142
+ kind: Type.TLiteral<"model/retry_end">;
1143
+ data: Type.TObject<{
1144
+ run_id: Type.TString;
1145
+ model: Type.TUnion<[Type.TString, Type.TNull]>;
1146
+ attempt: Type.TInteger;
1147
+ success: Type.TBoolean;
1148
+ final_error_sha256: Type.TUnion<[Type.TString, Type.TNull]>;
1149
+ final_error_preview: Type.TUnion<[Type.TString, Type.TNull]>;
1150
+ }>;
1151
+ }>, Type.TObject<{
1152
+ type: Type.TLiteral<"codepunk/event">;
1153
+ version: Type.TLiteral<1>;
1154
+ seq: Type.TInteger;
1155
+ at: Type.TString;
1156
+ kind: Type.TLiteral<"budget/exceeded">;
1157
+ data: Type.TObject<{
1158
+ run_id: Type.TString;
1159
+ limit_kind: Type.TUnion<[Type.TLiteral<"tool_calls">, Type.TLiteral<"wall_ms">, Type.TLiteral<"tokens">, Type.TLiteral<"cost">]>;
1160
+ limit: Type.TNumber;
1161
+ used: Type.TNumber;
1162
+ action: Type.TUnion<[Type.TLiteral<"reject_call">, Type.TLiteral<"abort_run">]>;
1163
+ }>;
1164
+ }>, Type.TObject<{
1165
+ type: Type.TLiteral<"codepunk/event">;
1166
+ version: Type.TLiteral<1>;
1167
+ seq: Type.TInteger;
1168
+ at: Type.TString;
1169
+ kind: Type.TLiteral<"loop_guard">;
1170
+ data: Type.TObject<{
1171
+ run_id: Type.TString;
1172
+ tool: Type.TString;
1173
+ canonical_argv: Type.TArray<Type.TString>;
1174
+ cwd: Type.TString;
1175
+ repeat_count: Type.TInteger;
1176
+ threshold: Type.TInteger;
1177
+ decision: Type.TUnion<[Type.TLiteral<"allow">, Type.TLiteral<"ask">, Type.TLiteral<"deny">]>;
1178
+ }>;
1179
+ }>, Type.TObject<{
1180
+ type: Type.TLiteral<"codepunk/event">;
1181
+ version: Type.TLiteral<1>;
1182
+ seq: Type.TInteger;
1183
+ at: Type.TString;
1184
+ kind: Type.TLiteral<"network/request">;
1185
+ data: Type.TObject<{
1186
+ run_id: Type.TString;
1187
+ domain: Type.TString;
1188
+ requests: Type.TInteger;
1189
+ bytes: Type.TInteger;
1190
+ limit: Type.TObject<{
1191
+ max_requests: Type.TUnion<[Type.TInteger, Type.TNull]>;
1192
+ max_bytes: Type.TUnion<[Type.TInteger, Type.TNull]>;
1193
+ }>;
1194
+ decision: Type.TUnion<[Type.TLiteral<"allow">, Type.TLiteral<"ask">, Type.TLiteral<"deny">]>;
1195
+ }>;
1196
+ }>, Type.TObject<{
1197
+ type: Type.TLiteral<"codepunk/event">;
1198
+ version: Type.TLiteral<1>;
1199
+ seq: Type.TInteger;
1200
+ at: Type.TString;
1201
+ kind: Type.TLiteral<"network/redirect">;
1202
+ data: Type.TObject<{
1203
+ run_id: Type.TString;
1204
+ from: Type.TString;
1205
+ to: Type.TString;
1206
+ status: Type.TInteger;
1207
+ decision: Type.TUnion<[Type.TLiteral<"allow">, Type.TLiteral<"ask">, Type.TLiteral<"deny">]>;
1208
+ }>;
1209
+ }>, Type.TObject<{
1210
+ type: Type.TLiteral<"codepunk/event">;
1211
+ version: Type.TLiteral<1>;
1212
+ seq: Type.TInteger;
1213
+ at: Type.TString;
1214
+ kind: Type.TLiteral<"network/rejected">;
1215
+ data: Type.TObject<{
1216
+ run_id: Type.TString;
1217
+ domain: Type.TString;
1218
+ reason: Type.TString;
1219
+ limit: Type.TObject<{
1220
+ max_requests: Type.TUnion<[Type.TInteger, Type.TNull]>;
1221
+ max_bytes: Type.TUnion<[Type.TInteger, Type.TNull]>;
1222
+ }>;
1223
+ }>;
1224
+ }>, Type.TObject<{
1225
+ type: Type.TLiteral<"codepunk/event">;
1226
+ version: Type.TLiteral<1>;
1227
+ seq: Type.TInteger;
1228
+ at: Type.TString;
1229
+ kind: Type.TLiteral<"mcp/server_start">;
1230
+ data: Type.TObject<{
1231
+ server: Type.TString;
1232
+ command_sha256: Type.TString;
1233
+ pid: Type.TInteger;
1234
+ transport: Type.TUnion<[Type.TLiteral<"stdio">, Type.TLiteral<"http">]>;
1235
+ coverage: Type.TLiteral<"uncovered">;
1236
+ }>;
1237
+ }>, Type.TObject<{
1238
+ type: Type.TLiteral<"codepunk/event">;
1239
+ version: Type.TLiteral<1>;
1240
+ seq: Type.TInteger;
1241
+ at: Type.TString;
1242
+ kind: Type.TLiteral<"skill/loaded">;
1243
+ data: Type.TObject<{
1244
+ skills: Type.TArray<Type.TObject<{
1245
+ name: Type.TString;
1246
+ scope: Type.TUnion<[Type.TLiteral<"user">, Type.TLiteral<"project">]>;
1247
+ sha256: Type.TString;
1248
+ bytes: Type.TInteger;
1249
+ }>>;
1250
+ block_sha256: Type.TString;
1251
+ }>;
1252
+ }>, Type.TObject<{
1253
+ type: Type.TLiteral<"codepunk/event">;
1254
+ version: Type.TLiteral<1>;
1255
+ seq: Type.TInteger;
1256
+ at: Type.TString;
1257
+ kind: Type.TLiteral<"skill/invoked">;
1258
+ data: Type.TObject<{
1259
+ name: Type.TString;
1260
+ scope: Type.TUnion<[Type.TLiteral<"user">, Type.TLiteral<"project">]>;
1261
+ sha256: Type.TString;
1262
+ bytes: Type.TInteger;
1263
+ }>;
1264
+ }>, Type.TObject<{
1265
+ type: Type.TLiteral<"codepunk/event">;
1266
+ version: Type.TLiteral<1>;
1267
+ seq: Type.TInteger;
1268
+ at: Type.TString;
1269
+ kind: Type.TLiteral<"plan/update">;
1270
+ data: Type.TObject<{
1271
+ run_id: Type.TString;
1272
+ steps: Type.TArray<Type.TObject<{
1273
+ step: Type.TString;
1274
+ status: Type.TUnion<[Type.TLiteral<"pending">, Type.TLiteral<"in_progress">, Type.TLiteral<"completed">]>;
1275
+ }>>;
1276
+ explanation: Type.TUnion<[Type.TString, Type.TNull]>;
1277
+ updated_at: Type.TString;
1278
+ sha256: Type.TString;
1279
+ }>;
1280
+ }>, Type.TObject<{
1281
+ type: Type.TLiteral<"codepunk/event">;
1282
+ version: Type.TLiteral<1>;
1283
+ seq: Type.TInteger;
1284
+ at: Type.TString;
1285
+ kind: Type.TLiteral<"todo/update">;
1286
+ data: Type.TObject<{
1287
+ run_id: Type.TString;
1288
+ items: Type.TArray<Type.TObject<{
1289
+ content: Type.TString;
1290
+ status: Type.TUnion<[Type.TLiteral<"pending">, Type.TLiteral<"in_progress">, Type.TLiteral<"completed">]>;
1291
+ }>>;
1292
+ updated_at: Type.TString;
1293
+ sha256: Type.TString;
1294
+ }>;
1295
+ }>, Type.TObject<{
1296
+ type: Type.TLiteral<"codepunk/event">;
1297
+ version: Type.TLiteral<1>;
1298
+ seq: Type.TInteger;
1299
+ at: Type.TString;
1300
+ kind: Type.TLiteral<"autonomy/profile">;
1301
+ data: Type.TObject<{
1302
+ profile: Type.TUnion<[Type.TLiteral<"read-only">, Type.TLiteral<"ask">, Type.TLiteral<"scoped">]>;
1303
+ source: Type.TUnion<[Type.TLiteral<"cli">, Type.TLiteral<"user-config">, Type.TLiteral<"default">]>;
1304
+ rules_sha256: Type.TUnion<[Type.TString, Type.TNull]>;
1305
+ rules: Type.TArray<Type.TObject<{
1306
+ id: Type.TString;
1307
+ argv: Type.TArray<Type.TString>;
1308
+ cwd: Type.TString;
1309
+ executable_sha256: Type.TString;
1310
+ rule_sha256: Type.TString;
1311
+ }>>;
1312
+ }>;
1313
+ }>, Type.TObject<{
1314
+ type: Type.TLiteral<"codepunk/event">;
1315
+ version: Type.TLiteral<1>;
1316
+ seq: Type.TInteger;
1317
+ at: Type.TString;
1318
+ kind: Type.TLiteral<"autonomy/revoked">;
1319
+ data: Type.TObject<{
1320
+ profile: Type.TUnion<[Type.TLiteral<"read-only">, Type.TLiteral<"ask">, Type.TLiteral<"scoped">]>;
1321
+ reason: Type.TLiteral<"session_end">;
1322
+ }>;
1323
+ }>, Type.TObject<{
1324
+ type: Type.TLiteral<"codepunk/event">;
1325
+ version: Type.TLiteral<1>;
1326
+ seq: Type.TInteger;
1327
+ at: Type.TString;
1328
+ kind: Type.TLiteral<"subagent/result">;
1329
+ data: Type.TObject<{
1330
+ run_id: Type.TString;
1331
+ parent_session_id: Type.TString;
1332
+ child_session_id: Type.TString;
1333
+ depth: Type.TInteger;
1334
+ isolation: Type.TUnion<[Type.TLiteral<"worktree">, Type.TLiteral<"shared">]>;
1335
+ model: Type.TUnion<[Type.TString, Type.TNull]>;
1336
+ status: Type.TUnion<[Type.TLiteral<"completed">, Type.TLiteral<"failed">, Type.TLiteral<"stopped">]>;
1337
+ summary: Type.TString;
1338
+ evidence_head: Type.TUnion<[Type.TString, Type.TNull]>;
1339
+ child_run_id: Type.TUnion<[Type.TString, Type.TNull]>;
1340
+ exit_code: Type.TUnion<[Type.TInteger, Type.TNull]>;
1341
+ error: Type.TUnion<[Type.TString, Type.TNull]>;
1342
+ profile: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
1343
+ profile_sha256: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
1344
+ worktree: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
1345
+ base_commit: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
1346
+ transcript_path: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
1347
+ changed_files: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
1348
+ }>;
1349
+ }>, Type.TObject<{
1350
+ type: Type.TLiteral<"codepunk/event">;
1351
+ version: Type.TLiteral<1>;
1352
+ seq: Type.TInteger;
1353
+ at: Type.TString;
1354
+ kind: Type.TLiteral<"plugin/started">;
1355
+ data: Type.TObject<{
1356
+ plugin_id: Type.TString;
1357
+ version: Type.TString;
1358
+ manifest_sha256: Type.TString;
1359
+ pid: Type.TInteger;
1360
+ credential_verified: Type.TBoolean;
1361
+ started_at: Type.TString;
1362
+ }>;
1363
+ }>, Type.TObject<{
1364
+ type: Type.TLiteral<"codepunk/event">;
1365
+ version: Type.TLiteral<1>;
1366
+ seq: Type.TInteger;
1367
+ at: Type.TString;
1368
+ kind: Type.TLiteral<"plugin/tool_call">;
1369
+ data: Type.TObject<{
1370
+ run_id: Type.TString;
1371
+ tool_call_id: Type.TString;
1372
+ plugin_id: Type.TString;
1373
+ plugin_manifest_sha256: Type.TString;
1374
+ executor: Type.TLiteral<"child-host">;
1375
+ decision: Type.TUnion<[Type.TLiteral<"allow">, Type.TLiteral<"ask">, Type.TLiteral<"deny">]>;
1376
+ approval: Type.TUnion<[Type.TObject<{
1377
+ channel: Type.TString;
1378
+ request_id: Type.TString;
1379
+ nonce_sha256: Type.TString;
1380
+ ttl_ms: Type.TInteger;
1381
+ worker_id: Type.TString;
1382
+ session_id: Type.TString;
1383
+ tool_call_id: Type.TString;
1384
+ answer: Type.TUnion<[Type.TLiteral<"allow">, Type.TLiteral<"deny">]>;
1385
+ scope: Type.TOptional<Type.TUnion<[Type.TLiteral<"once">, Type.TLiteral<"session">, Type.TLiteral<"persistent">]>>;
1386
+ guidance: Type.TOptional<Type.TString>;
1387
+ reused_from_request_id: Type.TOptional<Type.TString>;
1388
+ args_sha256: Type.TOptional<Type.TString>;
1389
+ diff_sha256: Type.TOptional<Type.TString>;
1390
+ }>, Type.TNull]>;
1391
+ outcome: Type.TUnion<[Type.TLiteral<"completed">, Type.TLiteral<"failed">, Type.TLiteral<"denied">, Type.TLiteral<"cancelled">]>;
1392
+ reason: Type.TUnion<[Type.TString, Type.TNull]>;
1393
+ }>;
1394
+ }>, Type.TObject<{
1395
+ type: Type.TLiteral<"codepunk/event">;
1396
+ version: Type.TLiteral<1>;
1397
+ seq: Type.TInteger;
1398
+ at: Type.TString;
1399
+ kind: Type.TLiteral<"plugin/stopped">;
1400
+ data: Type.TObject<{
1401
+ plugin_id: Type.TString;
1402
+ pid: Type.TInteger;
1403
+ credential_verified: Type.TBoolean;
1404
+ reason: Type.TUnion<[Type.TLiteral<"exit">, Type.TLiteral<"crash">, Type.TLiteral<"timeout">, Type.TLiteral<"cancel">, Type.TLiteral<"shutdown">, Type.TLiteral<"error">]>;
1405
+ exit_code: Type.TUnion<[Type.TInteger, Type.TNull]>;
1406
+ stopped_at: Type.TString;
1407
+ }>;
1408
+ }>]>>;
1409
+ after_seq: Type.TInteger;
1410
+ next_seq: Type.TInteger;
1411
+ has_more: Type.TBoolean;
1412
+ read_only: Type.TLiteral<true>;
1413
+ }>;
1414
+ }>;
1415
+ export declare const DaemonSessionPinResponseSchema: Type.TObject<{
1416
+ type: Type.TLiteral<"codepunk/daemon-response">;
1417
+ version: Type.TLiteral<1>;
1418
+ request_id: Type.TString;
1419
+ ok: Type.TLiteral<true>;
1420
+ result: Type.TObject<{
1421
+ session_id: Type.TString;
1422
+ pinned: Type.TBoolean;
1423
+ }>;
1424
+ }>;
1425
+ export declare const DaemonErrorResponseSchema: Type.TObject<{
1426
+ type: Type.TLiteral<"codepunk/daemon-response">;
1427
+ version: Type.TLiteral<1>;
1428
+ request_id: Type.TString;
1429
+ ok: Type.TLiteral<false>;
1430
+ error: Type.TObject<{
1431
+ code: Type.TUnion<[Type.TLiteral<"protocol.invalid_request">, Type.TLiteral<"protocol.version_mismatch">, Type.TLiteral<"daemon.read_only">, Type.TLiteral<"daemon.not_found">, Type.TLiteral<"daemon.request_too_large">, Type.TLiteral<"daemon.response_too_large">, Type.TLiteral<"daemon.timeout">, Type.TLiteral<"daemon.internal">]>;
1432
+ message: Type.TString;
1433
+ }>;
1434
+ }>;
1435
+ export declare const DaemonResponseSchema: Type.TUnion<[Type.TObject<{
1436
+ type: Type.TLiteral<"codepunk/daemon-response">;
1437
+ version: Type.TLiteral<1>;
1438
+ request_id: Type.TString;
1439
+ ok: Type.TLiteral<true>;
1440
+ result: Type.TObject<{
1441
+ protocol_version: Type.TLiteral<1>;
1442
+ read_only: Type.TBoolean;
1443
+ methods: Type.TArray<Type.TUnion<[Type.TLiteral<"daemon/hello">, Type.TLiteral<"session/list">, Type.TLiteral<"session/read">, Type.TLiteral<"session/pin">]>>;
1444
+ pid: Type.TInteger;
1445
+ started_at: Type.TString;
1446
+ }>;
1447
+ }>, Type.TObject<{
1448
+ type: Type.TLiteral<"codepunk/daemon-response">;
1449
+ version: Type.TLiteral<1>;
1450
+ request_id: Type.TString;
1451
+ ok: Type.TLiteral<true>;
1452
+ result: Type.TObject<{
1453
+ sessions: Type.TArray<Type.TObject<{
1454
+ id: Type.TString;
1455
+ created_at: Type.TString;
1456
+ updated_at: Type.TString;
1457
+ title: Type.TUnion<[Type.TString, Type.TNull]>;
1458
+ pinned: Type.TBoolean;
1459
+ last_seq: Type.TInteger;
1460
+ cwd: Type.TString;
1461
+ }>>;
1462
+ }>;
1463
+ }>, Type.TObject<{
1464
+ type: Type.TLiteral<"codepunk/daemon-response">;
1465
+ version: Type.TLiteral<1>;
1466
+ request_id: Type.TString;
1467
+ ok: Type.TLiteral<true>;
1468
+ result: Type.TObject<{
1469
+ header: Type.TObject<{
1470
+ type: Type.TLiteral<"codepunk/session">;
1471
+ version: Type.TLiteral<1>;
1472
+ id: Type.TString;
1473
+ project_id: Type.TString;
1474
+ cwd: Type.TString;
1475
+ created_at: Type.TString;
1476
+ pi_version: Type.TString;
1477
+ model: Type.TUnion<[Type.TString, Type.TNull]>;
1478
+ parent_session_id: Type.TOptional<Type.TString>;
1479
+ fork_entry_id: Type.TOptional<Type.TString>;
1480
+ }>;
1481
+ metadata: Type.TObject<{
1482
+ version: Type.TLiteral<1>;
1483
+ updated_at: Type.TString;
1484
+ title: Type.TUnion<[Type.TString, Type.TNull]>;
1485
+ pinned: Type.TBoolean;
1486
+ decision_ref: Type.TUnion<[Type.TString, Type.TNull]>;
1487
+ log_seq: Type.TInteger;
1488
+ state_covers_seq: Type.TInteger;
1489
+ }>;
1490
+ events: Type.TArray<Type.TUnion<[Type.TObject<{
1491
+ type: Type.TLiteral<"codepunk/event">;
1492
+ version: Type.TLiteral<1>;
1493
+ seq: Type.TInteger;
1494
+ at: Type.TString;
1495
+ kind: Type.TLiteral<"run/start">;
1496
+ data: Type.TObject<{
1497
+ run_id: Type.TString;
1498
+ session_id: Type.TString;
1499
+ }>;
1500
+ }>, Type.TObject<{
1501
+ type: Type.TLiteral<"codepunk/event">;
1502
+ version: Type.TLiteral<1>;
1503
+ seq: Type.TInteger;
1504
+ at: Type.TString;
1505
+ kind: Type.TLiteral<"user/input">;
1506
+ data: Type.TObject<{
1507
+ run_id: Type.TString;
1508
+ text: Type.TString;
1509
+ }>;
1510
+ }>, Type.TObject<{
1511
+ type: Type.TLiteral<"codepunk/event">;
1512
+ version: Type.TLiteral<1>;
1513
+ seq: Type.TInteger;
1514
+ at: Type.TString;
1515
+ kind: Type.TLiteral<"session/forked">;
1516
+ data: Type.TObject<{
1517
+ parent_session_id: Type.TString;
1518
+ parent_last_seq: Type.TInteger;
1519
+ parent_state_covers_seq: Type.TInteger;
1520
+ parent_state_sha256: Type.TString;
1521
+ fork_entry_id: Type.TUnion<[Type.TString, Type.TNull]>;
1522
+ mode: Type.TUnion<[Type.TLiteral<"clone">, Type.TLiteral<"live">]>;
1523
+ }>;
1524
+ }>, Type.TObject<{
1525
+ type: Type.TLiteral<"codepunk/event">;
1526
+ version: Type.TLiteral<1>;
1527
+ seq: Type.TInteger;
1528
+ at: Type.TString;
1529
+ kind: Type.TLiteral<"session/tree">;
1530
+ data: Type.TObject<{
1531
+ action: Type.TLiteral<"navigate">;
1532
+ from_entry_id: Type.TUnion<[Type.TString, Type.TNull]>;
1533
+ to_entry_id: Type.TUnion<[Type.TString, Type.TNull]>;
1534
+ target_entry_id: Type.TOptional<Type.TString>;
1535
+ branch_entries: Type.TInteger;
1536
+ }>;
1537
+ }>, Type.TObject<{
1538
+ type: Type.TLiteral<"codepunk/event">;
1539
+ version: Type.TLiteral<1>;
1540
+ seq: Type.TInteger;
1541
+ at: Type.TString;
1542
+ kind: Type.TLiteral<"approval/answer">;
1543
+ data: Type.TObject<{
1544
+ request_id: Type.TString;
1545
+ answer: Type.TUnion<[Type.TLiteral<"allow">, Type.TLiteral<"deny">]>;
1546
+ scope: Type.TOptional<Type.TUnion<[Type.TLiteral<"once">, Type.TLiteral<"session">, Type.TLiteral<"persistent">]>>;
1547
+ guidance: Type.TOptional<Type.TString>;
1548
+ channel: Type.TString;
1549
+ channel_id: Type.TString;
1550
+ nonce_sha256: Type.TString;
1551
+ worker_id: Type.TString;
1552
+ session_id: Type.TString;
1553
+ tool_call_id: Type.TString;
1554
+ answered_at: Type.TString;
1555
+ }>;
1556
+ }>, Type.TObject<{
1557
+ type: Type.TLiteral<"codepunk/event">;
1558
+ version: Type.TLiteral<1>;
1559
+ seq: Type.TInteger;
1560
+ at: Type.TString;
1561
+ kind: Type.TLiteral<"bash/result">;
1562
+ data: Type.TObject<{
1563
+ run_id: Type.TString;
1564
+ command: Type.TString;
1565
+ exit_code: Type.TUnion<[Type.TInteger, Type.TNull]>;
1566
+ output_sha256: Type.TUnion<[Type.TString, Type.TNull]>;
1567
+ cancelled: Type.TBoolean;
1568
+ }>;
1569
+ }>, Type.TObject<{
1570
+ type: Type.TLiteral<"codepunk/event">;
1571
+ version: Type.TLiteral<1>;
1572
+ seq: Type.TInteger;
1573
+ at: Type.TString;
1574
+ kind: Type.TLiteral<"commit/created">;
1575
+ data: Type.TObject<{
1576
+ run_id: Type.TString;
1577
+ commit: Type.TString;
1578
+ previous_commit: Type.TUnion<[Type.TString, Type.TNull]>;
1579
+ tree: Type.TString;
1580
+ message_sha256: Type.TString;
1581
+ message_bytes: Type.TInteger;
1582
+ files: Type.TArray<Type.TString>;
1583
+ stage: Type.TUnion<[Type.TLiteral<"staged">, Type.TLiteral<"tracked">, Type.TLiteral<"all">]>;
1584
+ root: Type.TString;
1585
+ evidence_head: Type.TUnion<[Type.TString, Type.TNull]>;
1586
+ }>;
1587
+ }>, Type.TObject<{
1588
+ type: Type.TLiteral<"codepunk/event">;
1589
+ version: Type.TLiteral<1>;
1590
+ seq: Type.TInteger;
1591
+ at: Type.TString;
1592
+ kind: Type.TLiteral<"checkpoint/restore">;
1593
+ data: Type.TObject<{
1594
+ action: Type.TUnion<[Type.TLiteral<"undo">, Type.TLiteral<"redo">]>;
1595
+ checkpoint_id: Type.TString;
1596
+ tool_call_id: Type.TString;
1597
+ target: Type.TString;
1598
+ from_sha256: Type.TString;
1599
+ to_sha256: Type.TString;
1600
+ }>;
1601
+ }>, Type.TObject<{
1602
+ type: Type.TLiteral<"codepunk/event">;
1603
+ version: Type.TLiteral<1>;
1604
+ seq: Type.TInteger;
1605
+ at: Type.TString;
1606
+ kind: Type.TLiteral<"context/loaded">;
1607
+ data: Type.TObject<{
1608
+ sources: Type.TArray<Type.TObject<{
1609
+ rank: Type.TInteger;
1610
+ kind: Type.TUnion<[Type.TLiteral<"user-instructions">, Type.TLiteral<"project-instructions">, Type.TLiteral<"append">]>;
1611
+ source: Type.TString;
1612
+ sha256: Type.TString;
1613
+ bytes: Type.TInteger;
1614
+ truncated: Type.TBoolean;
1615
+ }>>;
1616
+ warnings: Type.TArray<Type.TString>;
1617
+ total_bytes: Type.TInteger;
1618
+ truncated: Type.TBoolean;
1619
+ }>;
1620
+ }>, Type.TObject<{
1621
+ type: Type.TLiteral<"codepunk/event">;
1622
+ version: Type.TLiteral<1>;
1623
+ seq: Type.TInteger;
1624
+ at: Type.TString;
1625
+ kind: Type.TLiteral<"trust/decision">;
1626
+ data: Type.TObject<{
1627
+ cwd: Type.TString;
1628
+ root: Type.TString;
1629
+ decision: Type.TUnion<[Type.TLiteral<"trusted">, Type.TLiteral<"untrusted">]>;
1630
+ mode: Type.TOptional<Type.TUnion<[Type.TLiteral<"all">, Type.TLiteral<"custom">, Type.TLiteral<"none">]>>;
1631
+ source: Type.TUnion<[Type.TLiteral<"flag">, Type.TLiteral<"saved">, Type.TLiteral<"prompt">, Type.TLiteral<"default">, Type.TLiteral<"no-resources">]>;
1632
+ resources: Type.TArray<Type.TString>;
1633
+ skipped: Type.TArray<Type.TString>;
1634
+ grants: Type.TOptional<Type.TObject<{
1635
+ config: Type.TBoolean;
1636
+ policy: Type.TBoolean;
1637
+ skills: Type.TBoolean;
1638
+ instructions: Type.TBoolean;
1639
+ }>>;
1640
+ available: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"config">, Type.TLiteral<"policy">, Type.TLiteral<"skills">, Type.TLiteral<"instructions">]>>>;
1641
+ }>;
1642
+ }>, Type.TObject<{
1643
+ type: Type.TLiteral<"codepunk/event">;
1644
+ version: Type.TLiteral<1>;
1645
+ seq: Type.TInteger;
1646
+ at: Type.TString;
1647
+ kind: Type.TLiteral<"compaction/decision">;
1648
+ data: Type.TObject<{
1649
+ run_id: Type.TString;
1650
+ reason: Type.TUnion<[Type.TLiteral<"manual">, Type.TLiteral<"threshold">, Type.TLiteral<"overflow">]>;
1651
+ cancelled: Type.TBoolean;
1652
+ entries: Type.TInteger;
1653
+ keep_recent_tokens: Type.TInteger;
1654
+ evidence_head: Type.TUnion<[Type.TString, Type.TNull]>;
1655
+ failure: Type.TOptional<Type.TString>;
1656
+ checkpoint: Type.TOptional<Type.TObject<{
1657
+ compaction_entry_id: Type.TString;
1658
+ first_kept_entry_id: Type.TString;
1659
+ summary_sha256: Type.TString;
1660
+ summary_bytes: Type.TInteger;
1661
+ tokens_before: Type.TInteger;
1662
+ messages_before: Type.TInteger;
1663
+ messages_after: Type.TInteger;
1664
+ model: Type.TUnion<[Type.TString, Type.TNull]>;
1665
+ loadout_sha256: Type.TUnion<[Type.TString, Type.TNull]>;
1666
+ tool_names: Type.TArray<Type.TString>;
1667
+ usage: Type.TOptional<Type.TObject<{
1668
+ input_tokens: Type.TInteger;
1669
+ output_tokens: Type.TInteger;
1670
+ cache_read_tokens: Type.TInteger;
1671
+ cache_write_tokens: Type.TInteger;
1672
+ total_tokens: Type.TInteger;
1673
+ cost_total: Type.TNumber;
1674
+ }>>;
1675
+ }>>;
1676
+ }>;
1677
+ }>, Type.TObject<{
1678
+ type: Type.TLiteral<"codepunk/event">;
1679
+ version: Type.TLiteral<1>;
1680
+ seq: Type.TInteger;
1681
+ at: Type.TString;
1682
+ kind: Type.TLiteral<"context/request">;
1683
+ data: Type.TObject<{
1684
+ run_id: Type.TString;
1685
+ request_id: Type.TString;
1686
+ message_ids: Type.TArray<Type.TString>;
1687
+ omitted: Type.TObject<{
1688
+ ids: Type.TArray<Type.TString>;
1689
+ ranges: Type.TArray<Type.TObject<{
1690
+ start: Type.TInteger;
1691
+ end: Type.TInteger;
1692
+ }>>;
1693
+ }>;
1694
+ truncation_sha256: Type.TString;
1695
+ provider: Type.TString;
1696
+ model: Type.TString;
1697
+ token_estimate: Type.TInteger;
1698
+ compaction_id: Type.TUnion<[Type.TString, Type.TNull]>;
1699
+ }>;
1700
+ }>, Type.TObject<{
1701
+ type: Type.TLiteral<"codepunk/event">;
1702
+ version: Type.TLiteral<1>;
1703
+ seq: Type.TInteger;
1704
+ at: Type.TString;
1705
+ kind: Type.TLiteral<"run/end">;
1706
+ data: Type.TObject<{
1707
+ run_id: Type.TString;
1708
+ state: Type.TUnion<[Type.TLiteral<"settled">, Type.TLiteral<"failed">, Type.TLiteral<"aborted">, Type.TLiteral<"cancelled">]>;
1709
+ termination: Type.TUnion<[Type.TString, Type.TNull]>;
1710
+ evidence_head: Type.TUnion<[Type.TString, Type.TNull]>;
1711
+ actor: Type.TString;
1712
+ }>;
1713
+ }>, Type.TObject<{
1714
+ type: Type.TLiteral<"codepunk/event">;
1715
+ version: Type.TLiteral<1>;
1716
+ seq: Type.TInteger;
1717
+ at: Type.TString;
1718
+ kind: Type.TLiteral<"verdict/sign_off">;
1719
+ data: Type.TObject<{
1720
+ sign_off_id: Type.TString;
1721
+ previous_sign_off_id: Type.TUnion<[Type.TString, Type.TNull]>;
1722
+ run_id: Type.TString;
1723
+ evidence_head: Type.TString;
1724
+ signed_verdict: Type.TUnion<[Type.TLiteral<"complete">, Type.TLiteral<"incomplete">]>;
1725
+ channel: Type.TUnion<[Type.TLiteral<"tui">, Type.TLiteral<"cli">]>;
1726
+ actor: Type.TString;
1727
+ signed_at: Type.TString;
1728
+ }>;
1729
+ }>, Type.TObject<{
1730
+ type: Type.TLiteral<"codepunk/event">;
1731
+ version: Type.TLiteral<1>;
1732
+ seq: Type.TInteger;
1733
+ at: Type.TString;
1734
+ kind: Type.TLiteral<"memory/write">;
1735
+ data: Type.TObject<{
1736
+ scope: Type.TUnion<[Type.TLiteral<"user">, Type.TLiteral<"project">]>;
1737
+ action: Type.TUnion<[Type.TLiteral<"add">, Type.TLiteral<"edit">, Type.TLiteral<"delete">, Type.TLiteral<"archive">, Type.TLiteral<"reject">]>;
1738
+ memory_id: Type.TUnion<[Type.TString, Type.TNull]>;
1739
+ content_sha256: Type.TUnion<[Type.TString, Type.TNull]>;
1740
+ source_refs: Type.TArray<Type.TString>;
1741
+ reason: Type.TUnion<[Type.TString, Type.TNull]>;
1742
+ }>;
1743
+ }>, Type.TObject<{
1744
+ type: Type.TLiteral<"codepunk/event">;
1745
+ version: Type.TLiteral<1>;
1746
+ seq: Type.TInteger;
1747
+ at: Type.TString;
1748
+ kind: Type.TLiteral<"memory/retrieve">;
1749
+ data: Type.TObject<{
1750
+ ids: Type.TArray<Type.TString>;
1751
+ hashes: Type.TArray<Type.TString>;
1752
+ cap: Type.TInteger;
1753
+ truncated: Type.TBoolean;
1754
+ digest_sha256: Type.TString;
1755
+ }>;
1756
+ }>, Type.TObject<{
1757
+ type: Type.TLiteral<"codepunk/event">;
1758
+ version: Type.TLiteral<1>;
1759
+ seq: Type.TInteger;
1760
+ at: Type.TString;
1761
+ kind: Type.TLiteral<"model/change">;
1762
+ data: Type.TObject<{
1763
+ previous: Type.TUnion<[Type.TString, Type.TNull]>;
1764
+ model: Type.TString;
1765
+ thinking: Type.TUnion<[Type.TString, Type.TNull]>;
1766
+ }>;
1767
+ }>, Type.TObject<{
1768
+ type: Type.TLiteral<"codepunk/event">;
1769
+ version: Type.TLiteral<1>;
1770
+ seq: Type.TInteger;
1771
+ at: Type.TString;
1772
+ kind: Type.TLiteral<"model/usage">;
1773
+ data: Type.TObject<{
1774
+ run_id: Type.TString;
1775
+ provider: Type.TString;
1776
+ model: Type.TString;
1777
+ input_tokens: Type.TInteger;
1778
+ output_tokens: Type.TInteger;
1779
+ cache_read_tokens: Type.TInteger;
1780
+ cache_write_tokens: Type.TInteger;
1781
+ total_tokens: Type.TInteger;
1782
+ cost_total: Type.TNumber;
1783
+ stop_reason: Type.TString;
1784
+ source: Type.TOptional<Type.TUnion<[Type.TLiteral<"assistant">, Type.TLiteral<"summary">]>>;
1785
+ }>;
1786
+ }>, Type.TObject<{
1787
+ type: Type.TLiteral<"codepunk/event">;
1788
+ version: Type.TLiteral<1>;
1789
+ seq: Type.TInteger;
1790
+ at: Type.TString;
1791
+ kind: Type.TLiteral<"model/fallback">;
1792
+ data: Type.TObject<{
1793
+ from: Type.TString;
1794
+ to: Type.TUnion<[Type.TString, Type.TNull]>;
1795
+ reason: Type.TLiteral<"error">;
1796
+ stop_reason: Type.TUnion<[Type.TString, Type.TNull]>;
1797
+ attempted: Type.TArray<Type.TString>;
1798
+ exhausted: Type.TBoolean;
1799
+ chain_sha256: Type.TString;
1800
+ }>;
1801
+ }>, Type.TObject<{
1802
+ type: Type.TLiteral<"codepunk/event">;
1803
+ version: Type.TLiteral<1>;
1804
+ seq: Type.TInteger;
1805
+ at: Type.TString;
1806
+ kind: Type.TLiteral<"model/retry_start">;
1807
+ data: Type.TObject<{
1808
+ run_id: Type.TString;
1809
+ model: Type.TUnion<[Type.TString, Type.TNull]>;
1810
+ attempt: Type.TInteger;
1811
+ max_attempts: Type.TInteger;
1812
+ delay_ms: Type.TInteger;
1813
+ error_sha256: Type.TString;
1814
+ error_preview: Type.TString;
1815
+ }>;
1816
+ }>, Type.TObject<{
1817
+ type: Type.TLiteral<"codepunk/event">;
1818
+ version: Type.TLiteral<1>;
1819
+ seq: Type.TInteger;
1820
+ at: Type.TString;
1821
+ kind: Type.TLiteral<"model/retry_end">;
1822
+ data: Type.TObject<{
1823
+ run_id: Type.TString;
1824
+ model: Type.TUnion<[Type.TString, Type.TNull]>;
1825
+ attempt: Type.TInteger;
1826
+ success: Type.TBoolean;
1827
+ final_error_sha256: Type.TUnion<[Type.TString, Type.TNull]>;
1828
+ final_error_preview: Type.TUnion<[Type.TString, Type.TNull]>;
1829
+ }>;
1830
+ }>, Type.TObject<{
1831
+ type: Type.TLiteral<"codepunk/event">;
1832
+ version: Type.TLiteral<1>;
1833
+ seq: Type.TInteger;
1834
+ at: Type.TString;
1835
+ kind: Type.TLiteral<"budget/exceeded">;
1836
+ data: Type.TObject<{
1837
+ run_id: Type.TString;
1838
+ limit_kind: Type.TUnion<[Type.TLiteral<"tool_calls">, Type.TLiteral<"wall_ms">, Type.TLiteral<"tokens">, Type.TLiteral<"cost">]>;
1839
+ limit: Type.TNumber;
1840
+ used: Type.TNumber;
1841
+ action: Type.TUnion<[Type.TLiteral<"reject_call">, Type.TLiteral<"abort_run">]>;
1842
+ }>;
1843
+ }>, Type.TObject<{
1844
+ type: Type.TLiteral<"codepunk/event">;
1845
+ version: Type.TLiteral<1>;
1846
+ seq: Type.TInteger;
1847
+ at: Type.TString;
1848
+ kind: Type.TLiteral<"loop_guard">;
1849
+ data: Type.TObject<{
1850
+ run_id: Type.TString;
1851
+ tool: Type.TString;
1852
+ canonical_argv: Type.TArray<Type.TString>;
1853
+ cwd: Type.TString;
1854
+ repeat_count: Type.TInteger;
1855
+ threshold: Type.TInteger;
1856
+ decision: Type.TUnion<[Type.TLiteral<"allow">, Type.TLiteral<"ask">, Type.TLiteral<"deny">]>;
1857
+ }>;
1858
+ }>, Type.TObject<{
1859
+ type: Type.TLiteral<"codepunk/event">;
1860
+ version: Type.TLiteral<1>;
1861
+ seq: Type.TInteger;
1862
+ at: Type.TString;
1863
+ kind: Type.TLiteral<"network/request">;
1864
+ data: Type.TObject<{
1865
+ run_id: Type.TString;
1866
+ domain: Type.TString;
1867
+ requests: Type.TInteger;
1868
+ bytes: Type.TInteger;
1869
+ limit: Type.TObject<{
1870
+ max_requests: Type.TUnion<[Type.TInteger, Type.TNull]>;
1871
+ max_bytes: Type.TUnion<[Type.TInteger, Type.TNull]>;
1872
+ }>;
1873
+ decision: Type.TUnion<[Type.TLiteral<"allow">, Type.TLiteral<"ask">, Type.TLiteral<"deny">]>;
1874
+ }>;
1875
+ }>, Type.TObject<{
1876
+ type: Type.TLiteral<"codepunk/event">;
1877
+ version: Type.TLiteral<1>;
1878
+ seq: Type.TInteger;
1879
+ at: Type.TString;
1880
+ kind: Type.TLiteral<"network/redirect">;
1881
+ data: Type.TObject<{
1882
+ run_id: Type.TString;
1883
+ from: Type.TString;
1884
+ to: Type.TString;
1885
+ status: Type.TInteger;
1886
+ decision: Type.TUnion<[Type.TLiteral<"allow">, Type.TLiteral<"ask">, Type.TLiteral<"deny">]>;
1887
+ }>;
1888
+ }>, Type.TObject<{
1889
+ type: Type.TLiteral<"codepunk/event">;
1890
+ version: Type.TLiteral<1>;
1891
+ seq: Type.TInteger;
1892
+ at: Type.TString;
1893
+ kind: Type.TLiteral<"network/rejected">;
1894
+ data: Type.TObject<{
1895
+ run_id: Type.TString;
1896
+ domain: Type.TString;
1897
+ reason: Type.TString;
1898
+ limit: Type.TObject<{
1899
+ max_requests: Type.TUnion<[Type.TInteger, Type.TNull]>;
1900
+ max_bytes: Type.TUnion<[Type.TInteger, Type.TNull]>;
1901
+ }>;
1902
+ }>;
1903
+ }>, Type.TObject<{
1904
+ type: Type.TLiteral<"codepunk/event">;
1905
+ version: Type.TLiteral<1>;
1906
+ seq: Type.TInteger;
1907
+ at: Type.TString;
1908
+ kind: Type.TLiteral<"mcp/server_start">;
1909
+ data: Type.TObject<{
1910
+ server: Type.TString;
1911
+ command_sha256: Type.TString;
1912
+ pid: Type.TInteger;
1913
+ transport: Type.TUnion<[Type.TLiteral<"stdio">, Type.TLiteral<"http">]>;
1914
+ coverage: Type.TLiteral<"uncovered">;
1915
+ }>;
1916
+ }>, Type.TObject<{
1917
+ type: Type.TLiteral<"codepunk/event">;
1918
+ version: Type.TLiteral<1>;
1919
+ seq: Type.TInteger;
1920
+ at: Type.TString;
1921
+ kind: Type.TLiteral<"skill/loaded">;
1922
+ data: Type.TObject<{
1923
+ skills: Type.TArray<Type.TObject<{
1924
+ name: Type.TString;
1925
+ scope: Type.TUnion<[Type.TLiteral<"user">, Type.TLiteral<"project">]>;
1926
+ sha256: Type.TString;
1927
+ bytes: Type.TInteger;
1928
+ }>>;
1929
+ block_sha256: Type.TString;
1930
+ }>;
1931
+ }>, Type.TObject<{
1932
+ type: Type.TLiteral<"codepunk/event">;
1933
+ version: Type.TLiteral<1>;
1934
+ seq: Type.TInteger;
1935
+ at: Type.TString;
1936
+ kind: Type.TLiteral<"skill/invoked">;
1937
+ data: Type.TObject<{
1938
+ name: Type.TString;
1939
+ scope: Type.TUnion<[Type.TLiteral<"user">, Type.TLiteral<"project">]>;
1940
+ sha256: Type.TString;
1941
+ bytes: Type.TInteger;
1942
+ }>;
1943
+ }>, Type.TObject<{
1944
+ type: Type.TLiteral<"codepunk/event">;
1945
+ version: Type.TLiteral<1>;
1946
+ seq: Type.TInteger;
1947
+ at: Type.TString;
1948
+ kind: Type.TLiteral<"plan/update">;
1949
+ data: Type.TObject<{
1950
+ run_id: Type.TString;
1951
+ steps: Type.TArray<Type.TObject<{
1952
+ step: Type.TString;
1953
+ status: Type.TUnion<[Type.TLiteral<"pending">, Type.TLiteral<"in_progress">, Type.TLiteral<"completed">]>;
1954
+ }>>;
1955
+ explanation: Type.TUnion<[Type.TString, Type.TNull]>;
1956
+ updated_at: Type.TString;
1957
+ sha256: Type.TString;
1958
+ }>;
1959
+ }>, Type.TObject<{
1960
+ type: Type.TLiteral<"codepunk/event">;
1961
+ version: Type.TLiteral<1>;
1962
+ seq: Type.TInteger;
1963
+ at: Type.TString;
1964
+ kind: Type.TLiteral<"todo/update">;
1965
+ data: Type.TObject<{
1966
+ run_id: Type.TString;
1967
+ items: Type.TArray<Type.TObject<{
1968
+ content: Type.TString;
1969
+ status: Type.TUnion<[Type.TLiteral<"pending">, Type.TLiteral<"in_progress">, Type.TLiteral<"completed">]>;
1970
+ }>>;
1971
+ updated_at: Type.TString;
1972
+ sha256: Type.TString;
1973
+ }>;
1974
+ }>, Type.TObject<{
1975
+ type: Type.TLiteral<"codepunk/event">;
1976
+ version: Type.TLiteral<1>;
1977
+ seq: Type.TInteger;
1978
+ at: Type.TString;
1979
+ kind: Type.TLiteral<"autonomy/profile">;
1980
+ data: Type.TObject<{
1981
+ profile: Type.TUnion<[Type.TLiteral<"read-only">, Type.TLiteral<"ask">, Type.TLiteral<"scoped">]>;
1982
+ source: Type.TUnion<[Type.TLiteral<"cli">, Type.TLiteral<"user-config">, Type.TLiteral<"default">]>;
1983
+ rules_sha256: Type.TUnion<[Type.TString, Type.TNull]>;
1984
+ rules: Type.TArray<Type.TObject<{
1985
+ id: Type.TString;
1986
+ argv: Type.TArray<Type.TString>;
1987
+ cwd: Type.TString;
1988
+ executable_sha256: Type.TString;
1989
+ rule_sha256: Type.TString;
1990
+ }>>;
1991
+ }>;
1992
+ }>, Type.TObject<{
1993
+ type: Type.TLiteral<"codepunk/event">;
1994
+ version: Type.TLiteral<1>;
1995
+ seq: Type.TInteger;
1996
+ at: Type.TString;
1997
+ kind: Type.TLiteral<"autonomy/revoked">;
1998
+ data: Type.TObject<{
1999
+ profile: Type.TUnion<[Type.TLiteral<"read-only">, Type.TLiteral<"ask">, Type.TLiteral<"scoped">]>;
2000
+ reason: Type.TLiteral<"session_end">;
2001
+ }>;
2002
+ }>, Type.TObject<{
2003
+ type: Type.TLiteral<"codepunk/event">;
2004
+ version: Type.TLiteral<1>;
2005
+ seq: Type.TInteger;
2006
+ at: Type.TString;
2007
+ kind: Type.TLiteral<"subagent/result">;
2008
+ data: Type.TObject<{
2009
+ run_id: Type.TString;
2010
+ parent_session_id: Type.TString;
2011
+ child_session_id: Type.TString;
2012
+ depth: Type.TInteger;
2013
+ isolation: Type.TUnion<[Type.TLiteral<"worktree">, Type.TLiteral<"shared">]>;
2014
+ model: Type.TUnion<[Type.TString, Type.TNull]>;
2015
+ status: Type.TUnion<[Type.TLiteral<"completed">, Type.TLiteral<"failed">, Type.TLiteral<"stopped">]>;
2016
+ summary: Type.TString;
2017
+ evidence_head: Type.TUnion<[Type.TString, Type.TNull]>;
2018
+ child_run_id: Type.TUnion<[Type.TString, Type.TNull]>;
2019
+ exit_code: Type.TUnion<[Type.TInteger, Type.TNull]>;
2020
+ error: Type.TUnion<[Type.TString, Type.TNull]>;
2021
+ profile: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
2022
+ profile_sha256: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
2023
+ worktree: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
2024
+ base_commit: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
2025
+ transcript_path: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
2026
+ changed_files: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
2027
+ }>;
2028
+ }>, Type.TObject<{
2029
+ type: Type.TLiteral<"codepunk/event">;
2030
+ version: Type.TLiteral<1>;
2031
+ seq: Type.TInteger;
2032
+ at: Type.TString;
2033
+ kind: Type.TLiteral<"plugin/started">;
2034
+ data: Type.TObject<{
2035
+ plugin_id: Type.TString;
2036
+ version: Type.TString;
2037
+ manifest_sha256: Type.TString;
2038
+ pid: Type.TInteger;
2039
+ credential_verified: Type.TBoolean;
2040
+ started_at: Type.TString;
2041
+ }>;
2042
+ }>, Type.TObject<{
2043
+ type: Type.TLiteral<"codepunk/event">;
2044
+ version: Type.TLiteral<1>;
2045
+ seq: Type.TInteger;
2046
+ at: Type.TString;
2047
+ kind: Type.TLiteral<"plugin/tool_call">;
2048
+ data: Type.TObject<{
2049
+ run_id: Type.TString;
2050
+ tool_call_id: Type.TString;
2051
+ plugin_id: Type.TString;
2052
+ plugin_manifest_sha256: Type.TString;
2053
+ executor: Type.TLiteral<"child-host">;
2054
+ decision: Type.TUnion<[Type.TLiteral<"allow">, Type.TLiteral<"ask">, Type.TLiteral<"deny">]>;
2055
+ approval: Type.TUnion<[Type.TObject<{
2056
+ channel: Type.TString;
2057
+ request_id: Type.TString;
2058
+ nonce_sha256: Type.TString;
2059
+ ttl_ms: Type.TInteger;
2060
+ worker_id: Type.TString;
2061
+ session_id: Type.TString;
2062
+ tool_call_id: Type.TString;
2063
+ answer: Type.TUnion<[Type.TLiteral<"allow">, Type.TLiteral<"deny">]>;
2064
+ scope: Type.TOptional<Type.TUnion<[Type.TLiteral<"once">, Type.TLiteral<"session">, Type.TLiteral<"persistent">]>>;
2065
+ guidance: Type.TOptional<Type.TString>;
2066
+ reused_from_request_id: Type.TOptional<Type.TString>;
2067
+ args_sha256: Type.TOptional<Type.TString>;
2068
+ diff_sha256: Type.TOptional<Type.TString>;
2069
+ }>, Type.TNull]>;
2070
+ outcome: Type.TUnion<[Type.TLiteral<"completed">, Type.TLiteral<"failed">, Type.TLiteral<"denied">, Type.TLiteral<"cancelled">]>;
2071
+ reason: Type.TUnion<[Type.TString, Type.TNull]>;
2072
+ }>;
2073
+ }>, Type.TObject<{
2074
+ type: Type.TLiteral<"codepunk/event">;
2075
+ version: Type.TLiteral<1>;
2076
+ seq: Type.TInteger;
2077
+ at: Type.TString;
2078
+ kind: Type.TLiteral<"plugin/stopped">;
2079
+ data: Type.TObject<{
2080
+ plugin_id: Type.TString;
2081
+ pid: Type.TInteger;
2082
+ credential_verified: Type.TBoolean;
2083
+ reason: Type.TUnion<[Type.TLiteral<"exit">, Type.TLiteral<"crash">, Type.TLiteral<"timeout">, Type.TLiteral<"cancel">, Type.TLiteral<"shutdown">, Type.TLiteral<"error">]>;
2084
+ exit_code: Type.TUnion<[Type.TInteger, Type.TNull]>;
2085
+ stopped_at: Type.TString;
2086
+ }>;
2087
+ }>]>>;
2088
+ after_seq: Type.TInteger;
2089
+ next_seq: Type.TInteger;
2090
+ has_more: Type.TBoolean;
2091
+ read_only: Type.TLiteral<true>;
2092
+ }>;
2093
+ }>, Type.TObject<{
2094
+ type: Type.TLiteral<"codepunk/daemon-response">;
2095
+ version: Type.TLiteral<1>;
2096
+ request_id: Type.TString;
2097
+ ok: Type.TLiteral<true>;
2098
+ result: Type.TObject<{
2099
+ session_id: Type.TString;
2100
+ pinned: Type.TBoolean;
2101
+ }>;
2102
+ }>, Type.TObject<{
2103
+ type: Type.TLiteral<"codepunk/daemon-response">;
2104
+ version: Type.TLiteral<1>;
2105
+ request_id: Type.TString;
2106
+ ok: Type.TLiteral<false>;
2107
+ error: Type.TObject<{
2108
+ code: Type.TUnion<[Type.TLiteral<"protocol.invalid_request">, Type.TLiteral<"protocol.version_mismatch">, Type.TLiteral<"daemon.read_only">, Type.TLiteral<"daemon.not_found">, Type.TLiteral<"daemon.request_too_large">, Type.TLiteral<"daemon.response_too_large">, Type.TLiteral<"daemon.timeout">, Type.TLiteral<"daemon.internal">]>;
2109
+ message: Type.TString;
2110
+ }>;
2111
+ }>]>;
2112
+ export type DaemonResponse = Static<typeof DaemonResponseSchema>;
2113
+ //# sourceMappingURL=daemon.d.ts.map