@claxedo/agent-runtime-contract 0.8.0 → 0.10.1

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 (65) hide show
  1. package/README.md +27 -9
  2. package/dist/agent-runtime-event.d.ts +975 -0
  3. package/dist/availability.d.ts +3 -4
  4. package/dist/background-work.d.ts +10 -0
  5. package/dist/claims.d.ts +2 -0
  6. package/dist/connections.d.ts +66 -1
  7. package/dist/content.d.ts +72 -15
  8. package/dist/credential-broker-errors.d.ts +4 -0
  9. package/dist/custom-provider-headers.d.ts +12 -0
  10. package/dist/d1-bookmarks.d.ts +39 -0
  11. package/dist/daemon-ownership-snapshot.d.ts +40 -0
  12. package/dist/diagnostics.d.ts +24 -0
  13. package/dist/elicitation-pattern-worker.d.ts +6 -0
  14. package/dist/elicitation-pattern-worker.mjs +17 -0
  15. package/dist/elicitation-validation.d.ts +23 -0
  16. package/dist/elicitation.d.ts +51 -0
  17. package/dist/errors.d.ts +8 -1
  18. package/dist/event-cursor.d.ts +19 -0
  19. package/dist/events.d.ts +146 -216
  20. package/dist/files.d.ts +2 -0
  21. package/dist/first-turn-error.d.ts +12 -0
  22. package/dist/goals.d.ts +28 -0
  23. package/dist/harness-permission-modes.d.ts +76 -0
  24. package/dist/harness-table.d.ts +66 -4
  25. package/dist/harnesses.d.ts +19 -1
  26. package/dist/ids.d.ts +4 -0
  27. package/dist/index.d.ts +46 -1
  28. package/dist/index.mjs +2814 -95
  29. package/dist/mcp-app.d.ts +24 -0
  30. package/dist/message-page.d.ts +101 -0
  31. package/dist/permissions.d.ts +47 -0
  32. package/dist/pi-providers.d.ts +36 -0
  33. package/dist/prompt-title.d.ts +2 -0
  34. package/dist/provider-projection.d.ts +166 -0
  35. package/dist/raw-harness-event.d.ts +7 -0
  36. package/dist/recovery/actions.d.ts +20 -0
  37. package/dist/recovery/budgets.d.ts +16 -0
  38. package/dist/recovery/facts.d.ts +37 -0
  39. package/dist/recovery/operations.d.ts +66 -0
  40. package/dist/recovery/outcomes.d.ts +48 -0
  41. package/dist/recovery/payload-line.d.ts +19 -0
  42. package/dist/recovery/postconditions.d.ts +18 -0
  43. package/dist/recovery/requests.d.ts +44 -0
  44. package/dist/recovery/targets.d.ts +55 -0
  45. package/dist/recovery/validation.d.ts +9 -0
  46. package/dist/runtime-content.d.ts +34 -0
  47. package/dist/session-handoff.d.ts +4 -0
  48. package/dist/session-titles.d.ts +14 -0
  49. package/dist/sessions.d.ts +183 -5
  50. package/dist/stream-heartbeat.d.ts +11 -0
  51. package/dist/subagents.d.ts +92 -0
  52. package/dist/tool-header.d.ts +13 -0
  53. package/dist/tool-names.d.ts +5 -0
  54. package/dist/transcript-notice.d.ts +28 -0
  55. package/dist/turn-account.d.ts +26 -0
  56. package/dist/turn-error-classes.d.ts +10 -0
  57. package/dist/turn-fold.d.ts +111 -0
  58. package/dist/turn-fold.mjs +414 -0
  59. package/dist/turn-message-ids.d.ts +16 -0
  60. package/dist/turn-outline.d.ts +37 -0
  61. package/dist/turn-page.d.ts +58 -0
  62. package/dist/usage-streams.d.ts +19 -0
  63. package/dist/vendor-body.d.ts +31 -0
  64. package/dist/vendor-providers.d.ts +11 -0
  65. package/package.json +17 -3
@@ -0,0 +1,975 @@
1
+ import type { BackgroundWork } from "./background-work";
2
+ import type { AgentSubagentUpdate, RuntimeGoalSnapshot } from "./subagents";
3
+ import type { RuntimeQuestion, RuntimeUsageObservation } from "./events";
4
+ import type { AgentSessionCommand } from "./sessions";
5
+ import type { RuntimeToolCallContent } from "./runtime-content";
6
+ import type { FirstTurnErrorClass } from "./turn-error-classes";
7
+ import type { TurnAccount } from "./turn-account";
8
+ import type { RuntimeDiagnostic } from "./diagnostics";
9
+ import type { RawHarnessEvent } from "./raw-harness-event";
10
+ import type { AgentConfigOption } from "./content";
11
+ export declare const AGENT_RUNTIME_EVENT_CONTRACT_VERSION = 9;
12
+ export type RuntimeStatus = "busy" | "idle" | "error";
13
+ export type RuntimeToolStatus = "pending" | "running" | "completed" | "failed";
14
+ export type RuntimeNoticeSeverity = "debug" | "info" | "warn" | "error";
15
+ export type SubagentUpdatedEvent = {
16
+ type: "subagent-updated";
17
+ } & AgentSubagentUpdate;
18
+ export type ToolIntent = "shell" | "read" | "lint" | "edit" | "search" | "list" | "fetch" | "move" | "delete" | "reasoning" | "task" | "todos" | "question" | "mcp" | "image" | "computer" | "switch_mode" | "generic";
19
+ type RuntimeEventMeta = {
20
+ harness?: string;
21
+ threadId?: string;
22
+ raw?: RawHarnessEvent;
23
+ diagnostics?: RuntimeDiagnostic[];
24
+ };
25
+ /**
26
+ * Preserve supplied image bytes inline. Native image-view results that report
27
+ * only a path use tool-file: an absolute reference read by the owning runtime.
28
+ * Existing workspace-file records remain workspace-relative.
29
+ */
30
+ export type RuntimeToolAttachment = {
31
+ mime: string;
32
+ filename?: string;
33
+ } & ({
34
+ kind: "tool-file";
35
+ path: string;
36
+ } | {
37
+ kind: "workspace-file";
38
+ path: string;
39
+ sourcePath: string;
40
+ } | {
41
+ kind: "inline";
42
+ url: string;
43
+ } | {
44
+ kind: "unretained";
45
+ sourcePath?: string;
46
+ bytes: number;
47
+ });
48
+ export type ToolDisplay = {
49
+ kind?: string;
50
+ intent?: ToolIntent;
51
+ mode?: string;
52
+ summary?: string;
53
+ description?: string;
54
+ command?: string;
55
+ path?: string;
56
+ filePath?: string;
57
+ pattern?: string;
58
+ query?: string;
59
+ url?: string;
60
+ sourcePath?: string;
61
+ targetPath?: string;
62
+ sessionId?: string;
63
+ agentId?: string;
64
+ subagentType?: unknown;
65
+ durationMs?: number;
66
+ files?: string[];
67
+ locations?: Array<{
68
+ path: string;
69
+ line?: number;
70
+ }>;
71
+ input?: Record<string, unknown>;
72
+ };
73
+ export type AgentRuntimeEvent = RuntimeEventMeta & ({
74
+ type: "text-delta";
75
+ delta: string;
76
+ } | {
77
+ type: "thinking-delta";
78
+ delta: string;
79
+ } | {
80
+ type: "tool-start";
81
+ toolCallId: string;
82
+ toolName: string;
83
+ kind?: string;
84
+ display?: ToolDisplay;
85
+ metadata?: Record<string, unknown>;
86
+ } | {
87
+ type: "tool-input";
88
+ toolCallId: string;
89
+ input: unknown;
90
+ display?: ToolDisplay;
91
+ metadata?: Record<string, unknown>;
92
+ } | {
93
+ type: "tool-status";
94
+ toolCallId: string;
95
+ status: RuntimeToolStatus;
96
+ display?: ToolDisplay;
97
+ metadata?: Record<string, unknown>;
98
+ } | {
99
+ type: "tool-content";
100
+ toolCallId: string;
101
+ content: RuntimeToolCallContent;
102
+ display?: ToolDisplay;
103
+ metadata?: Record<string, unknown>;
104
+ } | {
105
+ type: "tool-output";
106
+ toolCallId: string;
107
+ output: unknown;
108
+ attachments?: RuntimeToolAttachment[];
109
+ display?: ToolDisplay;
110
+ metadata?: Record<string, unknown>;
111
+ } | {
112
+ type: "tool-error";
113
+ toolCallId: string;
114
+ error: string;
115
+ display?: ToolDisplay;
116
+ metadata?: Record<string, unknown>;
117
+ } | {
118
+ type: "file-diff";
119
+ toolCallId?: string;
120
+ path: string;
121
+ oldText?: string;
122
+ newText: string;
123
+ } | {
124
+ type: "step-start";
125
+ newMessageId: string;
126
+ }
127
+ /** The provider took this submitted message into its conversation; `messageId` is the id Claxedo submitted it under. */
128
+ | {
129
+ type: "input-incorporated";
130
+ messageId: string;
131
+ } | {
132
+ type: "permission-request";
133
+ requestId: string;
134
+ tool: string;
135
+ paths: string[];
136
+ details?: {
137
+ command?: string;
138
+ reason?: string;
139
+ };
140
+ options?: {
141
+ id: string;
142
+ label: string;
143
+ description?: string;
144
+ }[];
145
+ } | {
146
+ type: "question";
147
+ requestId: string;
148
+ questions: RuntimeQuestion[];
149
+ } | {
150
+ type: "question-answered";
151
+ requestId: string;
152
+ answers: Record<string, string | string[]>;
153
+ } | {
154
+ type: "proposed-plan-delta";
155
+ delta: string;
156
+ } | {
157
+ type: "proposed-plan-complete";
158
+ planMarkdown: string;
159
+ } | {
160
+ type: "todo-update";
161
+ todos: Array<{
162
+ id: string;
163
+ description: string;
164
+ status: string;
165
+ priority?: string;
166
+ }>;
167
+ } | {
168
+ type: "session-status";
169
+ status: RuntimeStatus;
170
+ } | {
171
+ type: "session-compaction";
172
+ phase: "started" | "completed";
173
+ reason?: string;
174
+ summary?: string;
175
+ metadata?: Record<string, unknown>;
176
+ } | {
177
+ type: "harness-notice";
178
+ code: string;
179
+ message: string;
180
+ severity?: RuntimeNoticeSeverity;
181
+ details?: unknown;
182
+ eventId?: string;
183
+ } | {
184
+ type: "agent-message";
185
+ eventId: string;
186
+ sender: string;
187
+ senderName?: string;
188
+ message: string;
189
+ senderTaskId?: string;
190
+ sourceSessionId?: string;
191
+ }
192
+ /** The harness is retrying a failed model request itself; `attempt` and `delayMs` only when it reports them. */
193
+ | {
194
+ type: "session-retry";
195
+ message: string;
196
+ attempt?: number;
197
+ delayMs?: number;
198
+ }
199
+ /** The model began a response; the content after it, until the next start, is that response's. */
200
+ | {
201
+ type: "response-start";
202
+ responseId: string;
203
+ }
204
+ /** The harness withdrew these responses; their content stays on record, marked withdrawn. */
205
+ | {
206
+ type: "response-retracted";
207
+ responseIds: string[];
208
+ reason: string;
209
+ }
210
+ /** The harness discarded its conversation (Claude's `/clear`); the turns after it start from fresh context in the same session. */
211
+ | {
212
+ type: "conversation-reset";
213
+ trigger: string;
214
+ } | {
215
+ type: "auth-status";
216
+ status: "authenticated" | "unauthenticated" | "unknown";
217
+ authMode?: string | null;
218
+ planType?: string | null;
219
+ metadata?: Record<string, unknown>;
220
+ } | {
221
+ type: "rate-limit";
222
+ status: "ok" | "limited";
223
+ usedPercent?: number;
224
+ resetsAt?: number | null;
225
+ windowDurationMins?: number | null;
226
+ limitId?: string | null;
227
+ limitName?: string | null;
228
+ reason?: string | null;
229
+ metadata?: Record<string, unknown>;
230
+ } | {
231
+ type: "mcp-server-status";
232
+ serverName: string;
233
+ status: "starting" | "ready" | "failed" | "cancelled";
234
+ error?: string | null;
235
+ } | {
236
+ type: "goal-updated";
237
+ sessionId: string;
238
+ goal: RuntimeGoalSnapshot;
239
+ } | {
240
+ type: "goal-cleared";
241
+ sessionId: string;
242
+ } | SubagentUpdatedEvent | {
243
+ type: "finish";
244
+ sessionId: string;
245
+ }
246
+ /** The turn ended because it was stopped. Its own terminal, never inferred from `session-status` idle. */
247
+ | {
248
+ type: "cancelled";
249
+ sessionId: string;
250
+ }
251
+ /**
252
+ * `errorClass` is set only from the harness's own structured error, never
253
+ * guessed from `error`; `account` is the one the turn was launched on.
254
+ */
255
+ | {
256
+ type: "error";
257
+ error: string;
258
+ errorClass?: FirstTurnErrorClass;
259
+ account?: TurnAccount;
260
+ } | {
261
+ type: "image-delta";
262
+ mimeType: string;
263
+ data: string;
264
+ } | {
265
+ type: "audio-delta";
266
+ mimeType: string;
267
+ data: string;
268
+ } | {
269
+ type: "resource-link-delta";
270
+ uri: string;
271
+ name: string;
272
+ mimeType?: string;
273
+ title?: string;
274
+ } | {
275
+ type: "thinking-audio-delta";
276
+ mimeType: string;
277
+ data: string;
278
+ } | {
279
+ type: "thinking-resource-link-delta";
280
+ uri: string;
281
+ name: string;
282
+ mimeType?: string;
283
+ title?: string;
284
+ } | {
285
+ type: "resource-delta";
286
+ resource: unknown;
287
+ channel: "assistant" | "thinking";
288
+ } | {
289
+ type: "tool-location";
290
+ toolCallId: string;
291
+ locations: Array<{
292
+ path: string;
293
+ line?: number;
294
+ }>;
295
+ } | {
296
+ type: "tool-terminal";
297
+ toolCallId: string;
298
+ terminalId: string;
299
+ } | {
300
+ type: "available-commands-update";
301
+ commands: AgentSessionCommand[];
302
+ } | {
303
+ type: "session-agent";
304
+ agentId: string;
305
+ } | {
306
+ type: "config-update";
307
+ options: AgentConfigOption[];
308
+ } | {
309
+ type: "session-info";
310
+ title?: string | null;
311
+ updatedAt?: string | null;
312
+ parentID?: string;
313
+ /** Authoritative placement identity for non-workspace session hosts. */
314
+ sessionRef?: string;
315
+ host?: "workspace";
316
+ workspaceID?: string;
317
+ } | {
318
+ type: "session-title";
319
+ title: string;
320
+ titleSource?: "harness" | "user";
321
+ }
322
+ /** The work the harness runs for the session outside any turn (background agents, shells, other tasks), restated whole whenever it changes; all zero once it settled. Never a turn state. */
323
+ | ({
324
+ type: "background-work";
325
+ } & BackgroundWork) | {
326
+ type: "usage";
327
+ contextSize: number;
328
+ contextUsed: number;
329
+ observation?: RuntimeUsageObservation;
330
+ cost?: {
331
+ amount: number;
332
+ currency: string;
333
+ };
334
+ /** The account the turn was launched on, which these tokens were spent on. */
335
+ account?: TurnAccount;
336
+ } | {
337
+ type: "diagnostic";
338
+ diagnostic: RuntimeDiagnostic;
339
+ });
340
+ export type AgentRuntimeEventType = AgentRuntimeEvent["type"];
341
+ export type AgentRuntimeEventOf<T extends AgentRuntimeEventType> = Extract<AgentRuntimeEvent, {
342
+ type: T;
343
+ }>;
344
+ export type AgentRuntimeEventInput<T extends AgentRuntimeEventType> = Omit<AgentRuntimeEventOf<T>, "type">;
345
+ export declare const AGENT_RUNTIME_EVENT_TYPE_REGISTRY: {
346
+ "text-delta": true;
347
+ "thinking-delta": true;
348
+ "tool-start": true;
349
+ "tool-input": true;
350
+ "tool-status": true;
351
+ "tool-content": true;
352
+ "tool-output": true;
353
+ "tool-error": true;
354
+ "file-diff": true;
355
+ "step-start": true;
356
+ "input-incorporated": true;
357
+ "permission-request": true;
358
+ question: true;
359
+ "question-answered": true;
360
+ "proposed-plan-delta": true;
361
+ "proposed-plan-complete": true;
362
+ "todo-update": true;
363
+ "session-status": true;
364
+ "session-compaction": true;
365
+ "harness-notice": true;
366
+ "agent-message": true;
367
+ "session-retry": true;
368
+ "response-start": true;
369
+ "response-retracted": true;
370
+ "conversation-reset": true;
371
+ "auth-status": true;
372
+ "rate-limit": true;
373
+ "mcp-server-status": true;
374
+ "goal-updated": true;
375
+ "goal-cleared": true;
376
+ "subagent-updated": true;
377
+ finish: true;
378
+ cancelled: true;
379
+ error: true;
380
+ "image-delta": true;
381
+ "audio-delta": true;
382
+ "resource-link-delta": true;
383
+ "thinking-audio-delta": true;
384
+ "thinking-resource-link-delta": true;
385
+ "resource-delta": true;
386
+ "tool-location": true;
387
+ "tool-terminal": true;
388
+ "available-commands-update": true;
389
+ "session-agent": true;
390
+ "config-update": true;
391
+ "session-info": true;
392
+ "session-title": true;
393
+ "background-work": true;
394
+ usage: true;
395
+ diagnostic: true;
396
+ };
397
+ /** Sound because the registry is `satisfies Record<AgentRuntimeEventType, true>`: its keys are exactly the union. */
398
+ export declare function isAgentRuntimeEventType(value: string): value is AgentRuntimeEventType;
399
+ export declare const AGENT_RUNTIME_EVENT_TYPES: AgentRuntimeEventType[];
400
+ export declare const AGENT_RUNTIME_EVENT_FACTORY_TYPES: {
401
+ readonly textDelta: "text-delta";
402
+ readonly thinkingDelta: "thinking-delta";
403
+ readonly toolStart: "tool-start";
404
+ readonly toolInput: "tool-input";
405
+ readonly toolStatus: "tool-status";
406
+ readonly toolContent: "tool-content";
407
+ readonly toolOutput: "tool-output";
408
+ readonly toolError: "tool-error";
409
+ readonly fileDiff: "file-diff";
410
+ readonly stepStart: "step-start";
411
+ readonly inputIncorporated: "input-incorporated";
412
+ readonly permissionRequest: "permission-request";
413
+ readonly question: "question";
414
+ readonly questionAnswered: "question-answered";
415
+ readonly proposedPlanDelta: "proposed-plan-delta";
416
+ readonly proposedPlanComplete: "proposed-plan-complete";
417
+ readonly todoUpdate: "todo-update";
418
+ readonly sessionStatus: "session-status";
419
+ readonly sessionCompaction: "session-compaction";
420
+ readonly harnessNotice: "harness-notice";
421
+ readonly agentMessage: "agent-message";
422
+ readonly sessionRetry: "session-retry";
423
+ readonly responseStart: "response-start";
424
+ readonly responseRetracted: "response-retracted";
425
+ readonly conversationReset: "conversation-reset";
426
+ readonly authStatus: "auth-status";
427
+ readonly rateLimit: "rate-limit";
428
+ readonly mcpServerStatus: "mcp-server-status";
429
+ readonly goalUpdated: "goal-updated";
430
+ readonly goalCleared: "goal-cleared";
431
+ readonly subagentUpdated: "subagent-updated";
432
+ readonly finish: "finish";
433
+ readonly cancelled: "cancelled";
434
+ readonly error: "error";
435
+ readonly imageDelta: "image-delta";
436
+ readonly audioDelta: "audio-delta";
437
+ readonly resourceLinkDelta: "resource-link-delta";
438
+ readonly thinkingAudioDelta: "thinking-audio-delta";
439
+ readonly thinkingResourceLinkDelta: "thinking-resource-link-delta";
440
+ readonly resourceDelta: "resource-delta";
441
+ readonly toolLocation: "tool-location";
442
+ readonly toolTerminal: "tool-terminal";
443
+ readonly availableCommandsUpdate: "available-commands-update";
444
+ readonly sessionAgent: "session-agent";
445
+ readonly configUpdate: "config-update";
446
+ readonly sessionInfo: "session-info";
447
+ readonly sessionTitle: "session-title";
448
+ readonly backgroundWork: "background-work";
449
+ readonly usage: "usage";
450
+ readonly diagnostic: "diagnostic";
451
+ };
452
+ /**
453
+ * One factory per runtime event type. Written out rather than generated so every
454
+ * entry is checked against the union: `satisfies` rejects a missing name, an
455
+ * unknown name, and a body whose payload does not match the event it names.
456
+ */
457
+ export declare const agentRuntimeEvent: {
458
+ textDelta: (input: AgentRuntimeEventInput<"text-delta">) => {
459
+ harness?: string;
460
+ threadId?: string;
461
+ raw?: RawHarnessEvent;
462
+ diagnostics?: RuntimeDiagnostic[];
463
+ delta: string;
464
+ type: "text-delta";
465
+ };
466
+ thinkingDelta: (input: AgentRuntimeEventInput<"thinking-delta">) => {
467
+ harness?: string;
468
+ threadId?: string;
469
+ raw?: RawHarnessEvent;
470
+ diagnostics?: RuntimeDiagnostic[];
471
+ delta: string;
472
+ type: "thinking-delta";
473
+ };
474
+ toolStart: (input: AgentRuntimeEventInput<"tool-start">) => {
475
+ harness?: string;
476
+ threadId?: string;
477
+ raw?: RawHarnessEvent;
478
+ diagnostics?: RuntimeDiagnostic[];
479
+ toolCallId: string;
480
+ toolName: string;
481
+ kind?: string;
482
+ display?: ToolDisplay;
483
+ metadata?: Record<string, unknown>;
484
+ type: "tool-start";
485
+ };
486
+ toolInput: (input: AgentRuntimeEventInput<"tool-input">) => {
487
+ harness?: string;
488
+ threadId?: string;
489
+ raw?: RawHarnessEvent;
490
+ diagnostics?: RuntimeDiagnostic[];
491
+ toolCallId: string;
492
+ input: unknown;
493
+ display?: ToolDisplay;
494
+ metadata?: Record<string, unknown>;
495
+ type: "tool-input";
496
+ };
497
+ toolStatus: (input: AgentRuntimeEventInput<"tool-status">) => {
498
+ harness?: string;
499
+ threadId?: string;
500
+ raw?: RawHarnessEvent;
501
+ diagnostics?: RuntimeDiagnostic[];
502
+ toolCallId: string;
503
+ status: RuntimeToolStatus;
504
+ display?: ToolDisplay;
505
+ metadata?: Record<string, unknown>;
506
+ type: "tool-status";
507
+ };
508
+ toolContent: (input: AgentRuntimeEventInput<"tool-content">) => {
509
+ harness?: string;
510
+ threadId?: string;
511
+ raw?: RawHarnessEvent;
512
+ diagnostics?: RuntimeDiagnostic[];
513
+ toolCallId: string;
514
+ content: RuntimeToolCallContent;
515
+ display?: ToolDisplay;
516
+ metadata?: Record<string, unknown>;
517
+ type: "tool-content";
518
+ };
519
+ toolOutput: (input: AgentRuntimeEventInput<"tool-output">) => {
520
+ harness?: string;
521
+ threadId?: string;
522
+ raw?: RawHarnessEvent;
523
+ diagnostics?: RuntimeDiagnostic[];
524
+ toolCallId: string;
525
+ output: unknown;
526
+ attachments?: RuntimeToolAttachment[];
527
+ display?: ToolDisplay;
528
+ metadata?: Record<string, unknown>;
529
+ type: "tool-output";
530
+ };
531
+ toolError: (input: AgentRuntimeEventInput<"tool-error">) => {
532
+ harness?: string;
533
+ threadId?: string;
534
+ raw?: RawHarnessEvent;
535
+ diagnostics?: RuntimeDiagnostic[];
536
+ toolCallId: string;
537
+ error: string;
538
+ display?: ToolDisplay;
539
+ metadata?: Record<string, unknown>;
540
+ type: "tool-error";
541
+ };
542
+ fileDiff: (input: AgentRuntimeEventInput<"file-diff">) => {
543
+ harness?: string;
544
+ threadId?: string;
545
+ raw?: RawHarnessEvent;
546
+ diagnostics?: RuntimeDiagnostic[];
547
+ toolCallId?: string;
548
+ path: string;
549
+ oldText?: string;
550
+ newText: string;
551
+ type: "file-diff";
552
+ };
553
+ stepStart: (input: AgentRuntimeEventInput<"step-start">) => {
554
+ harness?: string;
555
+ threadId?: string;
556
+ raw?: RawHarnessEvent;
557
+ diagnostics?: RuntimeDiagnostic[];
558
+ newMessageId: string;
559
+ type: "step-start";
560
+ };
561
+ inputIncorporated: (input: AgentRuntimeEventInput<"input-incorporated">) => {
562
+ harness?: string;
563
+ threadId?: string;
564
+ raw?: RawHarnessEvent;
565
+ diagnostics?: RuntimeDiagnostic[];
566
+ messageId: string;
567
+ type: "input-incorporated";
568
+ };
569
+ permissionRequest: (input: AgentRuntimeEventInput<"permission-request">) => {
570
+ harness?: string;
571
+ threadId?: string;
572
+ raw?: RawHarnessEvent;
573
+ diagnostics?: RuntimeDiagnostic[];
574
+ requestId: string;
575
+ tool: string;
576
+ paths: string[];
577
+ details?: {
578
+ command?: string;
579
+ reason?: string;
580
+ };
581
+ options?: {
582
+ id: string;
583
+ label: string;
584
+ description?: string;
585
+ }[];
586
+ type: "permission-request";
587
+ };
588
+ question: (input: AgentRuntimeEventInput<"question">) => {
589
+ harness?: string;
590
+ threadId?: string;
591
+ raw?: RawHarnessEvent;
592
+ diagnostics?: RuntimeDiagnostic[];
593
+ requestId: string;
594
+ questions: RuntimeQuestion[];
595
+ type: "question";
596
+ };
597
+ questionAnswered: (input: AgentRuntimeEventInput<"question-answered">) => {
598
+ harness?: string;
599
+ threadId?: string;
600
+ raw?: RawHarnessEvent;
601
+ diagnostics?: RuntimeDiagnostic[];
602
+ requestId: string;
603
+ answers: Record<string, string | string[]>;
604
+ type: "question-answered";
605
+ };
606
+ proposedPlanDelta: (input: AgentRuntimeEventInput<"proposed-plan-delta">) => {
607
+ harness?: string;
608
+ threadId?: string;
609
+ raw?: RawHarnessEvent;
610
+ diagnostics?: RuntimeDiagnostic[];
611
+ delta: string;
612
+ type: "proposed-plan-delta";
613
+ };
614
+ proposedPlanComplete: (input: AgentRuntimeEventInput<"proposed-plan-complete">) => {
615
+ harness?: string;
616
+ threadId?: string;
617
+ raw?: RawHarnessEvent;
618
+ diagnostics?: RuntimeDiagnostic[];
619
+ planMarkdown: string;
620
+ type: "proposed-plan-complete";
621
+ };
622
+ todoUpdate: (input: AgentRuntimeEventInput<"todo-update">) => {
623
+ harness?: string;
624
+ threadId?: string;
625
+ raw?: RawHarnessEvent;
626
+ diagnostics?: RuntimeDiagnostic[];
627
+ todos: Array<{
628
+ id: string;
629
+ description: string;
630
+ status: string;
631
+ priority?: string;
632
+ }>;
633
+ type: "todo-update";
634
+ };
635
+ sessionStatus: (input: AgentRuntimeEventInput<"session-status">) => {
636
+ harness?: string;
637
+ threadId?: string;
638
+ raw?: RawHarnessEvent;
639
+ diagnostics?: RuntimeDiagnostic[];
640
+ status: RuntimeStatus;
641
+ type: "session-status";
642
+ };
643
+ sessionCompaction: (input: AgentRuntimeEventInput<"session-compaction">) => {
644
+ harness?: string;
645
+ threadId?: string;
646
+ raw?: RawHarnessEvent;
647
+ diagnostics?: RuntimeDiagnostic[];
648
+ phase: "started" | "completed";
649
+ reason?: string;
650
+ summary?: string;
651
+ metadata?: Record<string, unknown>;
652
+ type: "session-compaction";
653
+ };
654
+ harnessNotice: (input: AgentRuntimeEventInput<"harness-notice">) => {
655
+ harness?: string;
656
+ threadId?: string;
657
+ raw?: RawHarnessEvent;
658
+ diagnostics?: RuntimeDiagnostic[];
659
+ code: string;
660
+ message: string;
661
+ severity?: RuntimeNoticeSeverity;
662
+ details?: unknown;
663
+ eventId?: string;
664
+ type: "harness-notice";
665
+ };
666
+ agentMessage: (input: AgentRuntimeEventInput<"agent-message">) => {
667
+ harness?: string;
668
+ threadId?: string;
669
+ raw?: RawHarnessEvent;
670
+ diagnostics?: RuntimeDiagnostic[];
671
+ eventId: string;
672
+ sender: string;
673
+ senderName?: string;
674
+ message: string;
675
+ senderTaskId?: string;
676
+ sourceSessionId?: string;
677
+ type: "agent-message";
678
+ };
679
+ sessionRetry: (input: AgentRuntimeEventInput<"session-retry">) => {
680
+ harness?: string;
681
+ threadId?: string;
682
+ raw?: RawHarnessEvent;
683
+ diagnostics?: RuntimeDiagnostic[];
684
+ message: string;
685
+ attempt?: number;
686
+ delayMs?: number;
687
+ type: "session-retry";
688
+ };
689
+ responseStart: (input: AgentRuntimeEventInput<"response-start">) => {
690
+ harness?: string;
691
+ threadId?: string;
692
+ raw?: RawHarnessEvent;
693
+ diagnostics?: RuntimeDiagnostic[];
694
+ responseId: string;
695
+ type: "response-start";
696
+ };
697
+ responseRetracted: (input: AgentRuntimeEventInput<"response-retracted">) => {
698
+ harness?: string;
699
+ threadId?: string;
700
+ raw?: RawHarnessEvent;
701
+ diagnostics?: RuntimeDiagnostic[];
702
+ responseIds: string[];
703
+ reason: string;
704
+ type: "response-retracted";
705
+ };
706
+ conversationReset: (input: AgentRuntimeEventInput<"conversation-reset">) => {
707
+ harness?: string;
708
+ threadId?: string;
709
+ raw?: RawHarnessEvent;
710
+ diagnostics?: RuntimeDiagnostic[];
711
+ trigger: string;
712
+ type: "conversation-reset";
713
+ };
714
+ authStatus: (input: AgentRuntimeEventInput<"auth-status">) => {
715
+ harness?: string;
716
+ threadId?: string;
717
+ raw?: RawHarnessEvent;
718
+ diagnostics?: RuntimeDiagnostic[];
719
+ status: "authenticated" | "unauthenticated" | "unknown";
720
+ authMode?: string | null;
721
+ planType?: string | null;
722
+ metadata?: Record<string, unknown>;
723
+ type: "auth-status";
724
+ };
725
+ rateLimit: (input: AgentRuntimeEventInput<"rate-limit">) => {
726
+ harness?: string;
727
+ threadId?: string;
728
+ raw?: RawHarnessEvent;
729
+ diagnostics?: RuntimeDiagnostic[];
730
+ status: "ok" | "limited";
731
+ usedPercent?: number;
732
+ resetsAt?: number | null;
733
+ windowDurationMins?: number | null;
734
+ limitId?: string | null;
735
+ limitName?: string | null;
736
+ reason?: string | null;
737
+ metadata?: Record<string, unknown>;
738
+ type: "rate-limit";
739
+ };
740
+ mcpServerStatus: (input: AgentRuntimeEventInput<"mcp-server-status">) => {
741
+ harness?: string;
742
+ threadId?: string;
743
+ raw?: RawHarnessEvent;
744
+ diagnostics?: RuntimeDiagnostic[];
745
+ serverName: string;
746
+ status: "starting" | "ready" | "failed" | "cancelled";
747
+ error?: string | null;
748
+ type: "mcp-server-status";
749
+ };
750
+ goalUpdated: (input: AgentRuntimeEventInput<"goal-updated">) => {
751
+ harness?: string;
752
+ threadId?: string;
753
+ raw?: RawHarnessEvent;
754
+ diagnostics?: RuntimeDiagnostic[];
755
+ sessionId: string;
756
+ goal: RuntimeGoalSnapshot;
757
+ type: "goal-updated";
758
+ };
759
+ goalCleared: (input: AgentRuntimeEventInput<"goal-cleared">) => {
760
+ harness?: string;
761
+ threadId?: string;
762
+ raw?: RawHarnessEvent;
763
+ diagnostics?: RuntimeDiagnostic[];
764
+ sessionId: string;
765
+ type: "goal-cleared";
766
+ };
767
+ subagentUpdated: (input: AgentRuntimeEventInput<"subagent-updated">) => {
768
+ subagentKey: string;
769
+ revision: number;
770
+ toolCallId?: string;
771
+ toolCallRole?: import("./subagents").SubagentToolCallRole;
772
+ mode?: import("./subagents").SubagentMode;
773
+ status?: import("./subagents").SubagentStatus;
774
+ runRevision?: number;
775
+ label?: string;
776
+ subagentType?: string;
777
+ description?: string;
778
+ providerId?: string;
779
+ providerKind?: string;
780
+ childSessionId?: string;
781
+ transcript?: import("./subagents").SubagentTranscript;
782
+ attention?: number;
783
+ wake?: import("./subagents").SubagentWake;
784
+ harness?: string;
785
+ threadId?: string;
786
+ raw?: RawHarnessEvent;
787
+ diagnostics?: RuntimeDiagnostic[];
788
+ type: "subagent-updated";
789
+ };
790
+ finish: (input: AgentRuntimeEventInput<"finish">) => {
791
+ harness?: string;
792
+ threadId?: string;
793
+ raw?: RawHarnessEvent;
794
+ diagnostics?: RuntimeDiagnostic[];
795
+ sessionId: string;
796
+ type: "finish";
797
+ };
798
+ cancelled: (input: AgentRuntimeEventInput<"cancelled">) => {
799
+ harness?: string;
800
+ threadId?: string;
801
+ raw?: RawHarnessEvent;
802
+ diagnostics?: RuntimeDiagnostic[];
803
+ sessionId: string;
804
+ type: "cancelled";
805
+ };
806
+ error: (input: AgentRuntimeEventInput<"error">) => {
807
+ harness?: string;
808
+ threadId?: string;
809
+ raw?: RawHarnessEvent;
810
+ diagnostics?: RuntimeDiagnostic[];
811
+ error: string;
812
+ errorClass?: FirstTurnErrorClass;
813
+ account?: TurnAccount;
814
+ type: "error";
815
+ };
816
+ imageDelta: (input: AgentRuntimeEventInput<"image-delta">) => {
817
+ harness?: string;
818
+ threadId?: string;
819
+ raw?: RawHarnessEvent;
820
+ diagnostics?: RuntimeDiagnostic[];
821
+ mimeType: string;
822
+ data: string;
823
+ type: "image-delta";
824
+ };
825
+ audioDelta: (input: AgentRuntimeEventInput<"audio-delta">) => {
826
+ harness?: string;
827
+ threadId?: string;
828
+ raw?: RawHarnessEvent;
829
+ diagnostics?: RuntimeDiagnostic[];
830
+ mimeType: string;
831
+ data: string;
832
+ type: "audio-delta";
833
+ };
834
+ resourceLinkDelta: (input: AgentRuntimeEventInput<"resource-link-delta">) => {
835
+ harness?: string;
836
+ threadId?: string;
837
+ raw?: RawHarnessEvent;
838
+ diagnostics?: RuntimeDiagnostic[];
839
+ uri: string;
840
+ name: string;
841
+ mimeType?: string;
842
+ title?: string;
843
+ type: "resource-link-delta";
844
+ };
845
+ thinkingAudioDelta: (input: AgentRuntimeEventInput<"thinking-audio-delta">) => {
846
+ harness?: string;
847
+ threadId?: string;
848
+ raw?: RawHarnessEvent;
849
+ diagnostics?: RuntimeDiagnostic[];
850
+ mimeType: string;
851
+ data: string;
852
+ type: "thinking-audio-delta";
853
+ };
854
+ thinkingResourceLinkDelta: (input: AgentRuntimeEventInput<"thinking-resource-link-delta">) => {
855
+ harness?: string;
856
+ threadId?: string;
857
+ raw?: RawHarnessEvent;
858
+ diagnostics?: RuntimeDiagnostic[];
859
+ uri: string;
860
+ name: string;
861
+ mimeType?: string;
862
+ title?: string;
863
+ type: "thinking-resource-link-delta";
864
+ };
865
+ resourceDelta: (input: AgentRuntimeEventInput<"resource-delta">) => {
866
+ harness?: string;
867
+ threadId?: string;
868
+ raw?: RawHarnessEvent;
869
+ diagnostics?: RuntimeDiagnostic[];
870
+ resource: unknown;
871
+ channel: "assistant" | "thinking";
872
+ type: "resource-delta";
873
+ };
874
+ toolLocation: (input: AgentRuntimeEventInput<"tool-location">) => {
875
+ harness?: string;
876
+ threadId?: string;
877
+ raw?: RawHarnessEvent;
878
+ diagnostics?: RuntimeDiagnostic[];
879
+ toolCallId: string;
880
+ locations: Array<{
881
+ path: string;
882
+ line?: number;
883
+ }>;
884
+ type: "tool-location";
885
+ };
886
+ toolTerminal: (input: AgentRuntimeEventInput<"tool-terminal">) => {
887
+ harness?: string;
888
+ threadId?: string;
889
+ raw?: RawHarnessEvent;
890
+ diagnostics?: RuntimeDiagnostic[];
891
+ toolCallId: string;
892
+ terminalId: string;
893
+ type: "tool-terminal";
894
+ };
895
+ availableCommandsUpdate: (input: AgentRuntimeEventInput<"available-commands-update">) => {
896
+ harness?: string;
897
+ threadId?: string;
898
+ raw?: RawHarnessEvent;
899
+ diagnostics?: RuntimeDiagnostic[];
900
+ commands: AgentSessionCommand[];
901
+ type: "available-commands-update";
902
+ };
903
+ sessionAgent: (input: AgentRuntimeEventInput<"session-agent">) => {
904
+ harness?: string;
905
+ threadId?: string;
906
+ raw?: RawHarnessEvent;
907
+ diagnostics?: RuntimeDiagnostic[];
908
+ agentId: string;
909
+ type: "session-agent";
910
+ };
911
+ configUpdate: (input: AgentRuntimeEventInput<"config-update">) => {
912
+ harness?: string;
913
+ threadId?: string;
914
+ raw?: RawHarnessEvent;
915
+ diagnostics?: RuntimeDiagnostic[];
916
+ options: AgentConfigOption[];
917
+ type: "config-update";
918
+ };
919
+ sessionInfo: (input: AgentRuntimeEventInput<"session-info">) => {
920
+ harness?: string;
921
+ threadId?: string;
922
+ raw?: RawHarnessEvent;
923
+ diagnostics?: RuntimeDiagnostic[];
924
+ title?: string | null;
925
+ updatedAt?: string | null;
926
+ parentID?: string;
927
+ sessionRef?: string;
928
+ host?: "workspace";
929
+ workspaceID?: string;
930
+ type: "session-info";
931
+ };
932
+ sessionTitle: (input: AgentRuntimeEventInput<"session-title">) => {
933
+ harness?: string;
934
+ threadId?: string;
935
+ raw?: RawHarnessEvent;
936
+ diagnostics?: RuntimeDiagnostic[];
937
+ title: string;
938
+ titleSource?: "harness" | "user";
939
+ type: "session-title";
940
+ };
941
+ backgroundWork: (input: AgentRuntimeEventInput<"background-work">) => {
942
+ agents: number;
943
+ shells: number;
944
+ other: number;
945
+ harness?: string;
946
+ threadId?: string;
947
+ raw?: RawHarnessEvent;
948
+ diagnostics?: RuntimeDiagnostic[];
949
+ type: "background-work";
950
+ };
951
+ usage: (input: AgentRuntimeEventInput<"usage">) => {
952
+ harness?: string;
953
+ threadId?: string;
954
+ raw?: RawHarnessEvent;
955
+ diagnostics?: RuntimeDiagnostic[];
956
+ contextSize: number;
957
+ contextUsed: number;
958
+ observation?: RuntimeUsageObservation;
959
+ cost?: {
960
+ amount: number;
961
+ currency: string;
962
+ };
963
+ account?: TurnAccount;
964
+ type: "usage";
965
+ };
966
+ diagnostic: (input: AgentRuntimeEventInput<"diagnostic">) => {
967
+ harness?: string;
968
+ threadId?: string;
969
+ raw?: RawHarnessEvent;
970
+ diagnostics?: RuntimeDiagnostic[];
971
+ diagnostic: RuntimeDiagnostic;
972
+ type: "diagnostic";
973
+ };
974
+ };
975
+ export {};