@github/copilot-sdk 0.1.30 → 0.1.31-unstable.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.
- package/dist/client.d.ts +6 -8
- package/dist/client.js +29 -98
- package/dist/extension.d.ts +2 -0
- package/dist/extension.js +5 -0
- package/dist/generated/rpc.d.ts +39 -3
- package/dist/generated/rpc.js +6 -0
- package/dist/generated/session-events.d.ts +1942 -13
- package/dist/sdkProtocolVersion.d.ts +1 -1
- package/dist/sdkProtocolVersion.js +1 -1
- package/dist/session.d.ts +19 -9
- package/dist/session.js +69 -20
- package/dist/types.d.ts +6 -0
- package/package.json +6 -2
|
@@ -3,691 +3,2620 @@
|
|
|
3
3
|
* Generated from: session-events.schema.json
|
|
4
4
|
*/
|
|
5
5
|
export type SessionEvent = {
|
|
6
|
+
/**
|
|
7
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
8
|
+
*/
|
|
6
9
|
id: string;
|
|
10
|
+
/**
|
|
11
|
+
* ISO 8601 timestamp when the event was created
|
|
12
|
+
*/
|
|
7
13
|
timestamp: string;
|
|
14
|
+
/**
|
|
15
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
16
|
+
*/
|
|
8
17
|
parentId: string | null;
|
|
18
|
+
/**
|
|
19
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
20
|
+
*/
|
|
9
21
|
ephemeral?: boolean;
|
|
10
22
|
type: "session.start";
|
|
11
23
|
data: {
|
|
24
|
+
/**
|
|
25
|
+
* Unique identifier for the session
|
|
26
|
+
*/
|
|
12
27
|
sessionId: string;
|
|
28
|
+
/**
|
|
29
|
+
* Schema version number for the session event format
|
|
30
|
+
*/
|
|
13
31
|
version: number;
|
|
32
|
+
/**
|
|
33
|
+
* Identifier of the software producing the events (e.g., "copilot-agent")
|
|
34
|
+
*/
|
|
14
35
|
producer: string;
|
|
36
|
+
/**
|
|
37
|
+
* Version string of the Copilot application
|
|
38
|
+
*/
|
|
15
39
|
copilotVersion: string;
|
|
40
|
+
/**
|
|
41
|
+
* ISO 8601 timestamp when the session was created
|
|
42
|
+
*/
|
|
16
43
|
startTime: string;
|
|
44
|
+
/**
|
|
45
|
+
* Model selected at session creation time, if any
|
|
46
|
+
*/
|
|
17
47
|
selectedModel?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Working directory and git context at session start
|
|
50
|
+
*/
|
|
18
51
|
context?: {
|
|
52
|
+
/**
|
|
53
|
+
* Current working directory path
|
|
54
|
+
*/
|
|
19
55
|
cwd: string;
|
|
56
|
+
/**
|
|
57
|
+
* Root directory of the git repository, resolved via git rev-parse
|
|
58
|
+
*/
|
|
20
59
|
gitRoot?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Repository identifier in "owner/name" format, derived from the git remote URL
|
|
62
|
+
*/
|
|
21
63
|
repository?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Current git branch name
|
|
66
|
+
*/
|
|
22
67
|
branch?: string;
|
|
23
68
|
};
|
|
24
69
|
};
|
|
25
70
|
} | {
|
|
71
|
+
/**
|
|
72
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
73
|
+
*/
|
|
26
74
|
id: string;
|
|
75
|
+
/**
|
|
76
|
+
* ISO 8601 timestamp when the event was created
|
|
77
|
+
*/
|
|
27
78
|
timestamp: string;
|
|
79
|
+
/**
|
|
80
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
81
|
+
*/
|
|
28
82
|
parentId: string | null;
|
|
83
|
+
/**
|
|
84
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
85
|
+
*/
|
|
29
86
|
ephemeral?: boolean;
|
|
30
87
|
type: "session.resume";
|
|
31
88
|
data: {
|
|
89
|
+
/**
|
|
90
|
+
* ISO 8601 timestamp when the session was resumed
|
|
91
|
+
*/
|
|
32
92
|
resumeTime: string;
|
|
93
|
+
/**
|
|
94
|
+
* Total number of persisted events in the session at the time of resume
|
|
95
|
+
*/
|
|
33
96
|
eventCount: number;
|
|
97
|
+
/**
|
|
98
|
+
* Updated working directory and git context at resume time
|
|
99
|
+
*/
|
|
34
100
|
context?: {
|
|
101
|
+
/**
|
|
102
|
+
* Current working directory path
|
|
103
|
+
*/
|
|
35
104
|
cwd: string;
|
|
105
|
+
/**
|
|
106
|
+
* Root directory of the git repository, resolved via git rev-parse
|
|
107
|
+
*/
|
|
36
108
|
gitRoot?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Repository identifier in "owner/name" format, derived from the git remote URL
|
|
111
|
+
*/
|
|
37
112
|
repository?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Current git branch name
|
|
115
|
+
*/
|
|
38
116
|
branch?: string;
|
|
39
117
|
};
|
|
40
118
|
};
|
|
41
119
|
} | {
|
|
120
|
+
/**
|
|
121
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
122
|
+
*/
|
|
42
123
|
id: string;
|
|
124
|
+
/**
|
|
125
|
+
* ISO 8601 timestamp when the event was created
|
|
126
|
+
*/
|
|
43
127
|
timestamp: string;
|
|
128
|
+
/**
|
|
129
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
130
|
+
*/
|
|
44
131
|
parentId: string | null;
|
|
132
|
+
/**
|
|
133
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
134
|
+
*/
|
|
45
135
|
ephemeral?: boolean;
|
|
46
136
|
type: "session.error";
|
|
47
137
|
data: {
|
|
138
|
+
/**
|
|
139
|
+
* Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "query")
|
|
140
|
+
*/
|
|
48
141
|
errorType: string;
|
|
142
|
+
/**
|
|
143
|
+
* Human-readable error message
|
|
144
|
+
*/
|
|
49
145
|
message: string;
|
|
146
|
+
/**
|
|
147
|
+
* Error stack trace, when available
|
|
148
|
+
*/
|
|
50
149
|
stack?: string;
|
|
150
|
+
/**
|
|
151
|
+
* HTTP status code from the upstream request, if applicable
|
|
152
|
+
*/
|
|
51
153
|
statusCode?: number;
|
|
154
|
+
/**
|
|
155
|
+
* GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs
|
|
156
|
+
*/
|
|
52
157
|
providerCallId?: string;
|
|
53
158
|
};
|
|
54
159
|
} | {
|
|
160
|
+
/**
|
|
161
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
162
|
+
*/
|
|
55
163
|
id: string;
|
|
164
|
+
/**
|
|
165
|
+
* ISO 8601 timestamp when the event was created
|
|
166
|
+
*/
|
|
56
167
|
timestamp: string;
|
|
168
|
+
/**
|
|
169
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
170
|
+
*/
|
|
57
171
|
parentId: string | null;
|
|
58
172
|
ephemeral: true;
|
|
59
173
|
type: "session.idle";
|
|
60
|
-
|
|
174
|
+
/**
|
|
175
|
+
* Payload indicating the agent is idle; includes any background tasks still in flight
|
|
176
|
+
*/
|
|
177
|
+
data: {
|
|
178
|
+
/**
|
|
179
|
+
* Background tasks still running when the agent became idle
|
|
180
|
+
*/
|
|
181
|
+
backgroundTasks?: {
|
|
182
|
+
/**
|
|
183
|
+
* Currently running background agents
|
|
184
|
+
*/
|
|
185
|
+
agents: {
|
|
186
|
+
/**
|
|
187
|
+
* Unique identifier of the background agent
|
|
188
|
+
*/
|
|
189
|
+
agentId: string;
|
|
190
|
+
/**
|
|
191
|
+
* Type of the background agent
|
|
192
|
+
*/
|
|
193
|
+
agentType: string;
|
|
194
|
+
/**
|
|
195
|
+
* Human-readable description of the agent task
|
|
196
|
+
*/
|
|
197
|
+
description?: string;
|
|
198
|
+
}[];
|
|
199
|
+
/**
|
|
200
|
+
* Currently running background shell commands
|
|
201
|
+
*/
|
|
202
|
+
shells: {
|
|
203
|
+
/**
|
|
204
|
+
* Unique identifier of the background shell
|
|
205
|
+
*/
|
|
206
|
+
shellId: string;
|
|
207
|
+
/**
|
|
208
|
+
* Human-readable description of the shell command
|
|
209
|
+
*/
|
|
210
|
+
description?: string;
|
|
211
|
+
}[];
|
|
212
|
+
};
|
|
213
|
+
};
|
|
61
214
|
} | {
|
|
215
|
+
/**
|
|
216
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
217
|
+
*/
|
|
62
218
|
id: string;
|
|
219
|
+
/**
|
|
220
|
+
* ISO 8601 timestamp when the event was created
|
|
221
|
+
*/
|
|
63
222
|
timestamp: string;
|
|
223
|
+
/**
|
|
224
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
225
|
+
*/
|
|
64
226
|
parentId: string | null;
|
|
65
227
|
ephemeral: true;
|
|
66
228
|
type: "session.title_changed";
|
|
67
229
|
data: {
|
|
230
|
+
/**
|
|
231
|
+
* The new display title for the session
|
|
232
|
+
*/
|
|
68
233
|
title: string;
|
|
69
234
|
};
|
|
70
235
|
} | {
|
|
236
|
+
/**
|
|
237
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
238
|
+
*/
|
|
71
239
|
id: string;
|
|
240
|
+
/**
|
|
241
|
+
* ISO 8601 timestamp when the event was created
|
|
242
|
+
*/
|
|
72
243
|
timestamp: string;
|
|
244
|
+
/**
|
|
245
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
246
|
+
*/
|
|
73
247
|
parentId: string | null;
|
|
248
|
+
/**
|
|
249
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
250
|
+
*/
|
|
74
251
|
ephemeral?: boolean;
|
|
75
252
|
type: "session.info";
|
|
76
253
|
data: {
|
|
254
|
+
/**
|
|
255
|
+
* Category of informational message (e.g., "notification", "timing", "context_window", "mcp", "snapshot", "configuration", "authentication", "model")
|
|
256
|
+
*/
|
|
77
257
|
infoType: string;
|
|
258
|
+
/**
|
|
259
|
+
* Human-readable informational message for display in the timeline
|
|
260
|
+
*/
|
|
78
261
|
message: string;
|
|
79
262
|
};
|
|
80
263
|
} | {
|
|
264
|
+
/**
|
|
265
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
266
|
+
*/
|
|
81
267
|
id: string;
|
|
268
|
+
/**
|
|
269
|
+
* ISO 8601 timestamp when the event was created
|
|
270
|
+
*/
|
|
82
271
|
timestamp: string;
|
|
272
|
+
/**
|
|
273
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
274
|
+
*/
|
|
83
275
|
parentId: string | null;
|
|
276
|
+
/**
|
|
277
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
278
|
+
*/
|
|
84
279
|
ephemeral?: boolean;
|
|
85
280
|
type: "session.warning";
|
|
86
281
|
data: {
|
|
282
|
+
/**
|
|
283
|
+
* Category of warning (e.g., "subscription", "policy", "mcp")
|
|
284
|
+
*/
|
|
87
285
|
warningType: string;
|
|
286
|
+
/**
|
|
287
|
+
* Human-readable warning message for display in the timeline
|
|
288
|
+
*/
|
|
88
289
|
message: string;
|
|
89
290
|
};
|
|
90
291
|
} | {
|
|
292
|
+
/**
|
|
293
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
294
|
+
*/
|
|
91
295
|
id: string;
|
|
296
|
+
/**
|
|
297
|
+
* ISO 8601 timestamp when the event was created
|
|
298
|
+
*/
|
|
92
299
|
timestamp: string;
|
|
300
|
+
/**
|
|
301
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
302
|
+
*/
|
|
93
303
|
parentId: string | null;
|
|
304
|
+
/**
|
|
305
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
306
|
+
*/
|
|
94
307
|
ephemeral?: boolean;
|
|
95
308
|
type: "session.model_change";
|
|
96
309
|
data: {
|
|
310
|
+
/**
|
|
311
|
+
* Model that was previously selected, if any
|
|
312
|
+
*/
|
|
97
313
|
previousModel?: string;
|
|
314
|
+
/**
|
|
315
|
+
* Newly selected model identifier
|
|
316
|
+
*/
|
|
98
317
|
newModel: string;
|
|
99
318
|
};
|
|
100
319
|
} | {
|
|
320
|
+
/**
|
|
321
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
322
|
+
*/
|
|
101
323
|
id: string;
|
|
324
|
+
/**
|
|
325
|
+
* ISO 8601 timestamp when the event was created
|
|
326
|
+
*/
|
|
102
327
|
timestamp: string;
|
|
328
|
+
/**
|
|
329
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
330
|
+
*/
|
|
103
331
|
parentId: string | null;
|
|
332
|
+
/**
|
|
333
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
334
|
+
*/
|
|
104
335
|
ephemeral?: boolean;
|
|
105
336
|
type: "session.mode_changed";
|
|
106
337
|
data: {
|
|
338
|
+
/**
|
|
339
|
+
* Agent mode before the change (e.g., "interactive", "plan", "autopilot")
|
|
340
|
+
*/
|
|
107
341
|
previousMode: string;
|
|
342
|
+
/**
|
|
343
|
+
* Agent mode after the change (e.g., "interactive", "plan", "autopilot")
|
|
344
|
+
*/
|
|
108
345
|
newMode: string;
|
|
109
346
|
};
|
|
110
347
|
} | {
|
|
348
|
+
/**
|
|
349
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
350
|
+
*/
|
|
111
351
|
id: string;
|
|
352
|
+
/**
|
|
353
|
+
* ISO 8601 timestamp when the event was created
|
|
354
|
+
*/
|
|
112
355
|
timestamp: string;
|
|
356
|
+
/**
|
|
357
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
358
|
+
*/
|
|
113
359
|
parentId: string | null;
|
|
360
|
+
/**
|
|
361
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
362
|
+
*/
|
|
114
363
|
ephemeral?: boolean;
|
|
115
364
|
type: "session.plan_changed";
|
|
116
365
|
data: {
|
|
366
|
+
/**
|
|
367
|
+
* The type of operation performed on the plan file
|
|
368
|
+
*/
|
|
117
369
|
operation: "create" | "update" | "delete";
|
|
118
370
|
};
|
|
119
371
|
} | {
|
|
372
|
+
/**
|
|
373
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
374
|
+
*/
|
|
120
375
|
id: string;
|
|
376
|
+
/**
|
|
377
|
+
* ISO 8601 timestamp when the event was created
|
|
378
|
+
*/
|
|
121
379
|
timestamp: string;
|
|
380
|
+
/**
|
|
381
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
382
|
+
*/
|
|
122
383
|
parentId: string | null;
|
|
384
|
+
/**
|
|
385
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
386
|
+
*/
|
|
123
387
|
ephemeral?: boolean;
|
|
124
388
|
type: "session.workspace_file_changed";
|
|
125
389
|
data: {
|
|
126
390
|
/**
|
|
127
|
-
* Relative path within the workspace files directory
|
|
391
|
+
* Relative path within the session workspace files directory
|
|
128
392
|
*/
|
|
129
393
|
path: string;
|
|
394
|
+
/**
|
|
395
|
+
* Whether the file was newly created or updated
|
|
396
|
+
*/
|
|
130
397
|
operation: "create" | "update";
|
|
131
398
|
};
|
|
132
399
|
} | {
|
|
400
|
+
/**
|
|
401
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
402
|
+
*/
|
|
133
403
|
id: string;
|
|
404
|
+
/**
|
|
405
|
+
* ISO 8601 timestamp when the event was created
|
|
406
|
+
*/
|
|
134
407
|
timestamp: string;
|
|
408
|
+
/**
|
|
409
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
410
|
+
*/
|
|
135
411
|
parentId: string | null;
|
|
412
|
+
/**
|
|
413
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
414
|
+
*/
|
|
136
415
|
ephemeral?: boolean;
|
|
137
416
|
type: "session.handoff";
|
|
138
417
|
data: {
|
|
418
|
+
/**
|
|
419
|
+
* ISO 8601 timestamp when the handoff occurred
|
|
420
|
+
*/
|
|
139
421
|
handoffTime: string;
|
|
422
|
+
/**
|
|
423
|
+
* Origin type of the session being handed off
|
|
424
|
+
*/
|
|
140
425
|
sourceType: "remote" | "local";
|
|
426
|
+
/**
|
|
427
|
+
* Repository context for the handed-off session
|
|
428
|
+
*/
|
|
141
429
|
repository?: {
|
|
430
|
+
/**
|
|
431
|
+
* Repository owner (user or organization)
|
|
432
|
+
*/
|
|
142
433
|
owner: string;
|
|
434
|
+
/**
|
|
435
|
+
* Repository name
|
|
436
|
+
*/
|
|
143
437
|
name: string;
|
|
438
|
+
/**
|
|
439
|
+
* Git branch name, if applicable
|
|
440
|
+
*/
|
|
144
441
|
branch?: string;
|
|
145
442
|
};
|
|
443
|
+
/**
|
|
444
|
+
* Additional context information for the handoff
|
|
445
|
+
*/
|
|
146
446
|
context?: string;
|
|
447
|
+
/**
|
|
448
|
+
* Summary of the work done in the source session
|
|
449
|
+
*/
|
|
147
450
|
summary?: string;
|
|
451
|
+
/**
|
|
452
|
+
* Session ID of the remote session being handed off
|
|
453
|
+
*/
|
|
148
454
|
remoteSessionId?: string;
|
|
149
455
|
};
|
|
150
456
|
} | {
|
|
457
|
+
/**
|
|
458
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
459
|
+
*/
|
|
151
460
|
id: string;
|
|
461
|
+
/**
|
|
462
|
+
* ISO 8601 timestamp when the event was created
|
|
463
|
+
*/
|
|
152
464
|
timestamp: string;
|
|
465
|
+
/**
|
|
466
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
467
|
+
*/
|
|
153
468
|
parentId: string | null;
|
|
469
|
+
/**
|
|
470
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
471
|
+
*/
|
|
154
472
|
ephemeral?: boolean;
|
|
155
473
|
type: "session.truncation";
|
|
156
474
|
data: {
|
|
475
|
+
/**
|
|
476
|
+
* Maximum token count for the model's context window
|
|
477
|
+
*/
|
|
157
478
|
tokenLimit: number;
|
|
479
|
+
/**
|
|
480
|
+
* Total tokens in conversation messages before truncation
|
|
481
|
+
*/
|
|
158
482
|
preTruncationTokensInMessages: number;
|
|
483
|
+
/**
|
|
484
|
+
* Number of conversation messages before truncation
|
|
485
|
+
*/
|
|
159
486
|
preTruncationMessagesLength: number;
|
|
487
|
+
/**
|
|
488
|
+
* Total tokens in conversation messages after truncation
|
|
489
|
+
*/
|
|
160
490
|
postTruncationTokensInMessages: number;
|
|
491
|
+
/**
|
|
492
|
+
* Number of conversation messages after truncation
|
|
493
|
+
*/
|
|
161
494
|
postTruncationMessagesLength: number;
|
|
495
|
+
/**
|
|
496
|
+
* Number of tokens removed by truncation
|
|
497
|
+
*/
|
|
162
498
|
tokensRemovedDuringTruncation: number;
|
|
499
|
+
/**
|
|
500
|
+
* Number of messages removed by truncation
|
|
501
|
+
*/
|
|
163
502
|
messagesRemovedDuringTruncation: number;
|
|
503
|
+
/**
|
|
504
|
+
* Identifier of the component that performed truncation (e.g., "BasicTruncator")
|
|
505
|
+
*/
|
|
164
506
|
performedBy: string;
|
|
165
507
|
};
|
|
166
508
|
} | {
|
|
509
|
+
/**
|
|
510
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
511
|
+
*/
|
|
167
512
|
id: string;
|
|
513
|
+
/**
|
|
514
|
+
* ISO 8601 timestamp when the event was created
|
|
515
|
+
*/
|
|
168
516
|
timestamp: string;
|
|
517
|
+
/**
|
|
518
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
519
|
+
*/
|
|
169
520
|
parentId: string | null;
|
|
170
521
|
ephemeral: true;
|
|
171
522
|
type: "session.snapshot_rewind";
|
|
172
523
|
data: {
|
|
524
|
+
/**
|
|
525
|
+
* Event ID that was rewound to; all events after this one were removed
|
|
526
|
+
*/
|
|
173
527
|
upToEventId: string;
|
|
528
|
+
/**
|
|
529
|
+
* Number of events that were removed by the rewind
|
|
530
|
+
*/
|
|
174
531
|
eventsRemoved: number;
|
|
175
532
|
};
|
|
176
533
|
} | {
|
|
534
|
+
/**
|
|
535
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
536
|
+
*/
|
|
177
537
|
id: string;
|
|
538
|
+
/**
|
|
539
|
+
* ISO 8601 timestamp when the event was created
|
|
540
|
+
*/
|
|
178
541
|
timestamp: string;
|
|
542
|
+
/**
|
|
543
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
544
|
+
*/
|
|
179
545
|
parentId: string | null;
|
|
180
|
-
|
|
546
|
+
/**
|
|
547
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
548
|
+
*/
|
|
549
|
+
ephemeral?: boolean;
|
|
181
550
|
type: "session.shutdown";
|
|
182
551
|
data: {
|
|
552
|
+
/**
|
|
553
|
+
* Whether the session ended normally ("routine") or due to a crash/fatal error ("error")
|
|
554
|
+
*/
|
|
183
555
|
shutdownType: "routine" | "error";
|
|
556
|
+
/**
|
|
557
|
+
* Error description when shutdownType is "error"
|
|
558
|
+
*/
|
|
184
559
|
errorReason?: string;
|
|
560
|
+
/**
|
|
561
|
+
* Total number of premium API requests used during the session
|
|
562
|
+
*/
|
|
185
563
|
totalPremiumRequests: number;
|
|
564
|
+
/**
|
|
565
|
+
* Cumulative time spent in API calls during the session, in milliseconds
|
|
566
|
+
*/
|
|
186
567
|
totalApiDurationMs: number;
|
|
568
|
+
/**
|
|
569
|
+
* Unix timestamp (milliseconds) when the session started
|
|
570
|
+
*/
|
|
187
571
|
sessionStartTime: number;
|
|
572
|
+
/**
|
|
573
|
+
* Aggregate code change metrics for the session
|
|
574
|
+
*/
|
|
188
575
|
codeChanges: {
|
|
576
|
+
/**
|
|
577
|
+
* Total number of lines added during the session
|
|
578
|
+
*/
|
|
189
579
|
linesAdded: number;
|
|
580
|
+
/**
|
|
581
|
+
* Total number of lines removed during the session
|
|
582
|
+
*/
|
|
190
583
|
linesRemoved: number;
|
|
584
|
+
/**
|
|
585
|
+
* List of file paths that were modified during the session
|
|
586
|
+
*/
|
|
191
587
|
filesModified: string[];
|
|
192
588
|
};
|
|
589
|
+
/**
|
|
590
|
+
* Per-model usage breakdown, keyed by model identifier
|
|
591
|
+
*/
|
|
193
592
|
modelMetrics: {
|
|
194
593
|
[k: string]: {
|
|
594
|
+
/**
|
|
595
|
+
* Request count and cost metrics
|
|
596
|
+
*/
|
|
195
597
|
requests: {
|
|
598
|
+
/**
|
|
599
|
+
* Total number of API requests made to this model
|
|
600
|
+
*/
|
|
196
601
|
count: number;
|
|
602
|
+
/**
|
|
603
|
+
* Cumulative cost multiplier for requests to this model
|
|
604
|
+
*/
|
|
197
605
|
cost: number;
|
|
198
606
|
};
|
|
607
|
+
/**
|
|
608
|
+
* Token usage breakdown
|
|
609
|
+
*/
|
|
199
610
|
usage: {
|
|
611
|
+
/**
|
|
612
|
+
* Total input tokens consumed across all requests to this model
|
|
613
|
+
*/
|
|
200
614
|
inputTokens: number;
|
|
615
|
+
/**
|
|
616
|
+
* Total output tokens produced across all requests to this model
|
|
617
|
+
*/
|
|
201
618
|
outputTokens: number;
|
|
619
|
+
/**
|
|
620
|
+
* Total tokens read from prompt cache across all requests
|
|
621
|
+
*/
|
|
202
622
|
cacheReadTokens: number;
|
|
623
|
+
/**
|
|
624
|
+
* Total tokens written to prompt cache across all requests
|
|
625
|
+
*/
|
|
203
626
|
cacheWriteTokens: number;
|
|
204
627
|
};
|
|
205
628
|
};
|
|
206
629
|
};
|
|
630
|
+
/**
|
|
631
|
+
* Model that was selected at the time of shutdown
|
|
632
|
+
*/
|
|
207
633
|
currentModel?: string;
|
|
208
634
|
};
|
|
209
635
|
} | {
|
|
636
|
+
/**
|
|
637
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
638
|
+
*/
|
|
210
639
|
id: string;
|
|
640
|
+
/**
|
|
641
|
+
* ISO 8601 timestamp when the event was created
|
|
642
|
+
*/
|
|
211
643
|
timestamp: string;
|
|
644
|
+
/**
|
|
645
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
646
|
+
*/
|
|
212
647
|
parentId: string | null;
|
|
648
|
+
/**
|
|
649
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
650
|
+
*/
|
|
213
651
|
ephemeral?: boolean;
|
|
214
652
|
type: "session.context_changed";
|
|
215
653
|
data: {
|
|
654
|
+
/**
|
|
655
|
+
* Current working directory path
|
|
656
|
+
*/
|
|
216
657
|
cwd: string;
|
|
658
|
+
/**
|
|
659
|
+
* Root directory of the git repository, resolved via git rev-parse
|
|
660
|
+
*/
|
|
217
661
|
gitRoot?: string;
|
|
662
|
+
/**
|
|
663
|
+
* Repository identifier in "owner/name" format, derived from the git remote URL
|
|
664
|
+
*/
|
|
218
665
|
repository?: string;
|
|
666
|
+
/**
|
|
667
|
+
* Current git branch name
|
|
668
|
+
*/
|
|
219
669
|
branch?: string;
|
|
220
670
|
};
|
|
221
671
|
} | {
|
|
672
|
+
/**
|
|
673
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
674
|
+
*/
|
|
222
675
|
id: string;
|
|
676
|
+
/**
|
|
677
|
+
* ISO 8601 timestamp when the event was created
|
|
678
|
+
*/
|
|
223
679
|
timestamp: string;
|
|
680
|
+
/**
|
|
681
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
682
|
+
*/
|
|
224
683
|
parentId: string | null;
|
|
225
684
|
ephemeral: true;
|
|
226
685
|
type: "session.usage_info";
|
|
227
686
|
data: {
|
|
687
|
+
/**
|
|
688
|
+
* Maximum token count for the model's context window
|
|
689
|
+
*/
|
|
228
690
|
tokenLimit: number;
|
|
691
|
+
/**
|
|
692
|
+
* Current number of tokens in the context window
|
|
693
|
+
*/
|
|
229
694
|
currentTokens: number;
|
|
695
|
+
/**
|
|
696
|
+
* Current number of messages in the conversation
|
|
697
|
+
*/
|
|
230
698
|
messagesLength: number;
|
|
231
699
|
};
|
|
232
700
|
} | {
|
|
701
|
+
/**
|
|
702
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
703
|
+
*/
|
|
233
704
|
id: string;
|
|
705
|
+
/**
|
|
706
|
+
* ISO 8601 timestamp when the event was created
|
|
707
|
+
*/
|
|
234
708
|
timestamp: string;
|
|
709
|
+
/**
|
|
710
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
711
|
+
*/
|
|
235
712
|
parentId: string | null;
|
|
713
|
+
/**
|
|
714
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
715
|
+
*/
|
|
236
716
|
ephemeral?: boolean;
|
|
237
717
|
type: "session.compaction_start";
|
|
718
|
+
/**
|
|
719
|
+
* Empty payload; the event signals that LLM-powered conversation compaction has begun
|
|
720
|
+
*/
|
|
238
721
|
data: {};
|
|
239
722
|
} | {
|
|
723
|
+
/**
|
|
724
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
725
|
+
*/
|
|
240
726
|
id: string;
|
|
727
|
+
/**
|
|
728
|
+
* ISO 8601 timestamp when the event was created
|
|
729
|
+
*/
|
|
241
730
|
timestamp: string;
|
|
731
|
+
/**
|
|
732
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
733
|
+
*/
|
|
242
734
|
parentId: string | null;
|
|
735
|
+
/**
|
|
736
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
737
|
+
*/
|
|
243
738
|
ephemeral?: boolean;
|
|
244
739
|
type: "session.compaction_complete";
|
|
245
740
|
data: {
|
|
741
|
+
/**
|
|
742
|
+
* Whether compaction completed successfully
|
|
743
|
+
*/
|
|
246
744
|
success: boolean;
|
|
745
|
+
/**
|
|
746
|
+
* Error message if compaction failed
|
|
747
|
+
*/
|
|
247
748
|
error?: string;
|
|
749
|
+
/**
|
|
750
|
+
* Total tokens in conversation before compaction
|
|
751
|
+
*/
|
|
248
752
|
preCompactionTokens?: number;
|
|
753
|
+
/**
|
|
754
|
+
* Total tokens in conversation after compaction
|
|
755
|
+
*/
|
|
249
756
|
postCompactionTokens?: number;
|
|
757
|
+
/**
|
|
758
|
+
* Number of messages before compaction
|
|
759
|
+
*/
|
|
250
760
|
preCompactionMessagesLength?: number;
|
|
761
|
+
/**
|
|
762
|
+
* Number of messages removed during compaction
|
|
763
|
+
*/
|
|
251
764
|
messagesRemoved?: number;
|
|
765
|
+
/**
|
|
766
|
+
* Number of tokens removed during compaction
|
|
767
|
+
*/
|
|
252
768
|
tokensRemoved?: number;
|
|
769
|
+
/**
|
|
770
|
+
* LLM-generated summary of the compacted conversation history
|
|
771
|
+
*/
|
|
253
772
|
summaryContent?: string;
|
|
773
|
+
/**
|
|
774
|
+
* Checkpoint snapshot number created for recovery
|
|
775
|
+
*/
|
|
254
776
|
checkpointNumber?: number;
|
|
777
|
+
/**
|
|
778
|
+
* File path where the checkpoint was stored
|
|
779
|
+
*/
|
|
255
780
|
checkpointPath?: string;
|
|
781
|
+
/**
|
|
782
|
+
* Token usage breakdown for the compaction LLM call
|
|
783
|
+
*/
|
|
256
784
|
compactionTokensUsed?: {
|
|
785
|
+
/**
|
|
786
|
+
* Input tokens consumed by the compaction LLM call
|
|
787
|
+
*/
|
|
257
788
|
input: number;
|
|
789
|
+
/**
|
|
790
|
+
* Output tokens produced by the compaction LLM call
|
|
791
|
+
*/
|
|
258
792
|
output: number;
|
|
793
|
+
/**
|
|
794
|
+
* Cached input tokens reused in the compaction LLM call
|
|
795
|
+
*/
|
|
259
796
|
cachedInput: number;
|
|
260
797
|
};
|
|
798
|
+
/**
|
|
799
|
+
* GitHub request tracing ID (x-github-request-id header) for the compaction LLM call
|
|
800
|
+
*/
|
|
261
801
|
requestId?: string;
|
|
262
802
|
};
|
|
263
803
|
} | {
|
|
804
|
+
/**
|
|
805
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
806
|
+
*/
|
|
264
807
|
id: string;
|
|
808
|
+
/**
|
|
809
|
+
* ISO 8601 timestamp when the event was created
|
|
810
|
+
*/
|
|
265
811
|
timestamp: string;
|
|
812
|
+
/**
|
|
813
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
814
|
+
*/
|
|
266
815
|
parentId: string | null;
|
|
816
|
+
/**
|
|
817
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
818
|
+
*/
|
|
267
819
|
ephemeral?: boolean;
|
|
268
820
|
type: "session.task_complete";
|
|
269
821
|
data: {
|
|
822
|
+
/**
|
|
823
|
+
* Optional summary of the completed task, provided by the agent
|
|
824
|
+
*/
|
|
270
825
|
summary?: string;
|
|
271
826
|
};
|
|
272
827
|
} | {
|
|
828
|
+
/**
|
|
829
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
830
|
+
*/
|
|
273
831
|
id: string;
|
|
832
|
+
/**
|
|
833
|
+
* ISO 8601 timestamp when the event was created
|
|
834
|
+
*/
|
|
274
835
|
timestamp: string;
|
|
836
|
+
/**
|
|
837
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
838
|
+
*/
|
|
275
839
|
parentId: string | null;
|
|
840
|
+
/**
|
|
841
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
842
|
+
*/
|
|
276
843
|
ephemeral?: boolean;
|
|
277
844
|
type: "user.message";
|
|
278
845
|
data: {
|
|
846
|
+
/**
|
|
847
|
+
* The user's message text as displayed in the timeline
|
|
848
|
+
*/
|
|
279
849
|
content: string;
|
|
850
|
+
/**
|
|
851
|
+
* Transformed version of the message sent to the model, with XML wrapping, timestamps, and other augmentations for prompt caching
|
|
852
|
+
*/
|
|
280
853
|
transformedContent?: string;
|
|
854
|
+
/**
|
|
855
|
+
* Files, selections, or GitHub references attached to the message
|
|
856
|
+
*/
|
|
281
857
|
attachments?: ({
|
|
282
858
|
type: "file";
|
|
859
|
+
/**
|
|
860
|
+
* Absolute file or directory path
|
|
861
|
+
*/
|
|
283
862
|
path: string;
|
|
863
|
+
/**
|
|
864
|
+
* User-facing display name for the attachment
|
|
865
|
+
*/
|
|
284
866
|
displayName: string;
|
|
867
|
+
/**
|
|
868
|
+
* Optional line range to scope the attachment to a specific section of the file
|
|
869
|
+
*/
|
|
285
870
|
lineRange?: {
|
|
871
|
+
/**
|
|
872
|
+
* Start line number (1-based)
|
|
873
|
+
*/
|
|
286
874
|
start: number;
|
|
875
|
+
/**
|
|
876
|
+
* End line number (1-based, inclusive)
|
|
877
|
+
*/
|
|
287
878
|
end: number;
|
|
288
879
|
};
|
|
289
880
|
} | {
|
|
290
881
|
type: "directory";
|
|
882
|
+
/**
|
|
883
|
+
* Absolute file or directory path
|
|
884
|
+
*/
|
|
291
885
|
path: string;
|
|
886
|
+
/**
|
|
887
|
+
* User-facing display name for the attachment
|
|
888
|
+
*/
|
|
292
889
|
displayName: string;
|
|
890
|
+
/**
|
|
891
|
+
* Optional line range to scope the attachment to a specific section of the file
|
|
892
|
+
*/
|
|
293
893
|
lineRange?: {
|
|
894
|
+
/**
|
|
895
|
+
* Start line number (1-based)
|
|
896
|
+
*/
|
|
294
897
|
start: number;
|
|
898
|
+
/**
|
|
899
|
+
* End line number (1-based, inclusive)
|
|
900
|
+
*/
|
|
295
901
|
end: number;
|
|
296
902
|
};
|
|
297
903
|
} | {
|
|
904
|
+
/**
|
|
905
|
+
* Attachment type discriminator
|
|
906
|
+
*/
|
|
298
907
|
type: "selection";
|
|
908
|
+
/**
|
|
909
|
+
* Absolute path to the file containing the selection
|
|
910
|
+
*/
|
|
299
911
|
filePath: string;
|
|
912
|
+
/**
|
|
913
|
+
* User-facing display name for the selection
|
|
914
|
+
*/
|
|
300
915
|
displayName: string;
|
|
916
|
+
/**
|
|
917
|
+
* The selected text content
|
|
918
|
+
*/
|
|
301
919
|
text: string;
|
|
920
|
+
/**
|
|
921
|
+
* Position range of the selection within the file
|
|
922
|
+
*/
|
|
302
923
|
selection: {
|
|
303
924
|
start: {
|
|
925
|
+
/**
|
|
926
|
+
* Start line number (0-based)
|
|
927
|
+
*/
|
|
304
928
|
line: number;
|
|
929
|
+
/**
|
|
930
|
+
* Start character offset within the line (0-based)
|
|
931
|
+
*/
|
|
305
932
|
character: number;
|
|
306
933
|
};
|
|
307
934
|
end: {
|
|
935
|
+
/**
|
|
936
|
+
* End line number (0-based)
|
|
937
|
+
*/
|
|
308
938
|
line: number;
|
|
939
|
+
/**
|
|
940
|
+
* End character offset within the line (0-based)
|
|
941
|
+
*/
|
|
309
942
|
character: number;
|
|
310
943
|
};
|
|
311
944
|
};
|
|
312
945
|
} | {
|
|
946
|
+
/**
|
|
947
|
+
* Attachment type discriminator
|
|
948
|
+
*/
|
|
313
949
|
type: "github_reference";
|
|
950
|
+
/**
|
|
951
|
+
* Issue, pull request, or discussion number
|
|
952
|
+
*/
|
|
314
953
|
number: number;
|
|
954
|
+
/**
|
|
955
|
+
* Title of the referenced item
|
|
956
|
+
*/
|
|
315
957
|
title: string;
|
|
958
|
+
/**
|
|
959
|
+
* Type of GitHub reference
|
|
960
|
+
*/
|
|
316
961
|
referenceType: "issue" | "pr" | "discussion";
|
|
962
|
+
/**
|
|
963
|
+
* Current state of the referenced item (e.g., open, closed, merged)
|
|
964
|
+
*/
|
|
317
965
|
state: string;
|
|
966
|
+
/**
|
|
967
|
+
* URL to the referenced item on GitHub
|
|
968
|
+
*/
|
|
318
969
|
url: string;
|
|
319
970
|
})[];
|
|
971
|
+
/**
|
|
972
|
+
* Origin of this message, used for timeline filtering (e.g., "skill-pdf" for skill-injected messages that should be hidden from the user)
|
|
973
|
+
*/
|
|
320
974
|
source?: string;
|
|
975
|
+
/**
|
|
976
|
+
* The agent mode that was active when this message was sent
|
|
977
|
+
*/
|
|
321
978
|
agentMode?: "interactive" | "plan" | "autopilot" | "shell";
|
|
979
|
+
/**
|
|
980
|
+
* CAPI interaction ID for correlating this user message with its turn
|
|
981
|
+
*/
|
|
322
982
|
interactionId?: string;
|
|
323
983
|
};
|
|
324
984
|
} | {
|
|
985
|
+
/**
|
|
986
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
987
|
+
*/
|
|
325
988
|
id: string;
|
|
989
|
+
/**
|
|
990
|
+
* ISO 8601 timestamp when the event was created
|
|
991
|
+
*/
|
|
326
992
|
timestamp: string;
|
|
993
|
+
/**
|
|
994
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
995
|
+
*/
|
|
327
996
|
parentId: string | null;
|
|
328
997
|
ephemeral: true;
|
|
329
998
|
type: "pending_messages.modified";
|
|
999
|
+
/**
|
|
1000
|
+
* Empty payload; the event signals that the pending message queue has changed
|
|
1001
|
+
*/
|
|
330
1002
|
data: {};
|
|
331
1003
|
} | {
|
|
1004
|
+
/**
|
|
1005
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1006
|
+
*/
|
|
332
1007
|
id: string;
|
|
1008
|
+
/**
|
|
1009
|
+
* ISO 8601 timestamp when the event was created
|
|
1010
|
+
*/
|
|
333
1011
|
timestamp: string;
|
|
1012
|
+
/**
|
|
1013
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1014
|
+
*/
|
|
334
1015
|
parentId: string | null;
|
|
1016
|
+
/**
|
|
1017
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
1018
|
+
*/
|
|
335
1019
|
ephemeral?: boolean;
|
|
336
1020
|
type: "assistant.turn_start";
|
|
337
1021
|
data: {
|
|
1022
|
+
/**
|
|
1023
|
+
* Identifier for this turn within the agentic loop, typically a stringified turn number
|
|
1024
|
+
*/
|
|
338
1025
|
turnId: string;
|
|
1026
|
+
/**
|
|
1027
|
+
* CAPI interaction ID for correlating this turn with upstream telemetry
|
|
1028
|
+
*/
|
|
339
1029
|
interactionId?: string;
|
|
340
1030
|
};
|
|
341
1031
|
} | {
|
|
1032
|
+
/**
|
|
1033
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1034
|
+
*/
|
|
342
1035
|
id: string;
|
|
1036
|
+
/**
|
|
1037
|
+
* ISO 8601 timestamp when the event was created
|
|
1038
|
+
*/
|
|
343
1039
|
timestamp: string;
|
|
1040
|
+
/**
|
|
1041
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1042
|
+
*/
|
|
344
1043
|
parentId: string | null;
|
|
345
1044
|
ephemeral: true;
|
|
346
1045
|
type: "assistant.intent";
|
|
347
1046
|
data: {
|
|
1047
|
+
/**
|
|
1048
|
+
* Short description of what the agent is currently doing or planning to do
|
|
1049
|
+
*/
|
|
348
1050
|
intent: string;
|
|
349
1051
|
};
|
|
350
1052
|
} | {
|
|
1053
|
+
/**
|
|
1054
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1055
|
+
*/
|
|
351
1056
|
id: string;
|
|
1057
|
+
/**
|
|
1058
|
+
* ISO 8601 timestamp when the event was created
|
|
1059
|
+
*/
|
|
352
1060
|
timestamp: string;
|
|
1061
|
+
/**
|
|
1062
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1063
|
+
*/
|
|
353
1064
|
parentId: string | null;
|
|
1065
|
+
/**
|
|
1066
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
1067
|
+
*/
|
|
354
1068
|
ephemeral?: boolean;
|
|
355
1069
|
type: "assistant.reasoning";
|
|
356
1070
|
data: {
|
|
1071
|
+
/**
|
|
1072
|
+
* Unique identifier for this reasoning block
|
|
1073
|
+
*/
|
|
357
1074
|
reasoningId: string;
|
|
1075
|
+
/**
|
|
1076
|
+
* The complete extended thinking text from the model
|
|
1077
|
+
*/
|
|
358
1078
|
content: string;
|
|
359
1079
|
};
|
|
360
1080
|
} | {
|
|
1081
|
+
/**
|
|
1082
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1083
|
+
*/
|
|
361
1084
|
id: string;
|
|
1085
|
+
/**
|
|
1086
|
+
* ISO 8601 timestamp when the event was created
|
|
1087
|
+
*/
|
|
362
1088
|
timestamp: string;
|
|
1089
|
+
/**
|
|
1090
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1091
|
+
*/
|
|
363
1092
|
parentId: string | null;
|
|
364
1093
|
ephemeral: true;
|
|
365
1094
|
type: "assistant.reasoning_delta";
|
|
366
1095
|
data: {
|
|
1096
|
+
/**
|
|
1097
|
+
* Reasoning block ID this delta belongs to, matching the corresponding assistant.reasoning event
|
|
1098
|
+
*/
|
|
367
1099
|
reasoningId: string;
|
|
1100
|
+
/**
|
|
1101
|
+
* Incremental text chunk to append to the reasoning content
|
|
1102
|
+
*/
|
|
368
1103
|
deltaContent: string;
|
|
369
1104
|
};
|
|
370
1105
|
} | {
|
|
1106
|
+
/**
|
|
1107
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1108
|
+
*/
|
|
371
1109
|
id: string;
|
|
1110
|
+
/**
|
|
1111
|
+
* ISO 8601 timestamp when the event was created
|
|
1112
|
+
*/
|
|
372
1113
|
timestamp: string;
|
|
1114
|
+
/**
|
|
1115
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1116
|
+
*/
|
|
373
1117
|
parentId: string | null;
|
|
374
1118
|
ephemeral: true;
|
|
375
1119
|
type: "assistant.streaming_delta";
|
|
376
1120
|
data: {
|
|
1121
|
+
/**
|
|
1122
|
+
* Cumulative total bytes received from the streaming response so far
|
|
1123
|
+
*/
|
|
377
1124
|
totalResponseSizeBytes: number;
|
|
378
1125
|
};
|
|
379
1126
|
} | {
|
|
1127
|
+
/**
|
|
1128
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1129
|
+
*/
|
|
380
1130
|
id: string;
|
|
1131
|
+
/**
|
|
1132
|
+
* ISO 8601 timestamp when the event was created
|
|
1133
|
+
*/
|
|
381
1134
|
timestamp: string;
|
|
1135
|
+
/**
|
|
1136
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1137
|
+
*/
|
|
382
1138
|
parentId: string | null;
|
|
1139
|
+
/**
|
|
1140
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
1141
|
+
*/
|
|
383
1142
|
ephemeral?: boolean;
|
|
384
1143
|
type: "assistant.message";
|
|
385
1144
|
data: {
|
|
1145
|
+
/**
|
|
1146
|
+
* Unique identifier for this assistant message
|
|
1147
|
+
*/
|
|
386
1148
|
messageId: string;
|
|
1149
|
+
/**
|
|
1150
|
+
* The assistant's text response content
|
|
1151
|
+
*/
|
|
387
1152
|
content: string;
|
|
1153
|
+
/**
|
|
1154
|
+
* Tool invocations requested by the assistant in this message
|
|
1155
|
+
*/
|
|
388
1156
|
toolRequests?: {
|
|
1157
|
+
/**
|
|
1158
|
+
* Unique identifier for this tool call
|
|
1159
|
+
*/
|
|
389
1160
|
toolCallId: string;
|
|
1161
|
+
/**
|
|
1162
|
+
* Name of the tool being invoked
|
|
1163
|
+
*/
|
|
390
1164
|
name: string;
|
|
391
|
-
|
|
1165
|
+
/**
|
|
1166
|
+
* Arguments to pass to the tool, format depends on the tool
|
|
1167
|
+
*/
|
|
1168
|
+
arguments?: {
|
|
1169
|
+
[k: string]: unknown;
|
|
1170
|
+
};
|
|
1171
|
+
/**
|
|
1172
|
+
* Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent.
|
|
1173
|
+
*/
|
|
392
1174
|
type?: "function" | "custom";
|
|
393
1175
|
}[];
|
|
1176
|
+
/**
|
|
1177
|
+
* Opaque/encrypted extended thinking data from Anthropic models. Session-bound and stripped on resume.
|
|
1178
|
+
*/
|
|
394
1179
|
reasoningOpaque?: string;
|
|
1180
|
+
/**
|
|
1181
|
+
* Readable reasoning text from the model's extended thinking
|
|
1182
|
+
*/
|
|
395
1183
|
reasoningText?: string;
|
|
1184
|
+
/**
|
|
1185
|
+
* Encrypted reasoning content from OpenAI models. Session-bound and stripped on resume.
|
|
1186
|
+
*/
|
|
396
1187
|
encryptedContent?: string;
|
|
1188
|
+
/**
|
|
1189
|
+
* Generation phase for phased-output models (e.g., thinking vs. response phases)
|
|
1190
|
+
*/
|
|
397
1191
|
phase?: string;
|
|
1192
|
+
/**
|
|
1193
|
+
* Actual output token count from the API response (completion_tokens), used for accurate token accounting
|
|
1194
|
+
*/
|
|
1195
|
+
outputTokens?: number;
|
|
1196
|
+
/**
|
|
1197
|
+
* CAPI interaction ID for correlating this message with upstream telemetry
|
|
1198
|
+
*/
|
|
398
1199
|
interactionId?: string;
|
|
1200
|
+
/**
|
|
1201
|
+
* Tool call ID of the parent tool invocation when this event originates from a sub-agent
|
|
1202
|
+
*/
|
|
399
1203
|
parentToolCallId?: string;
|
|
400
1204
|
};
|
|
401
1205
|
} | {
|
|
1206
|
+
/**
|
|
1207
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1208
|
+
*/
|
|
402
1209
|
id: string;
|
|
1210
|
+
/**
|
|
1211
|
+
* ISO 8601 timestamp when the event was created
|
|
1212
|
+
*/
|
|
403
1213
|
timestamp: string;
|
|
1214
|
+
/**
|
|
1215
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1216
|
+
*/
|
|
404
1217
|
parentId: string | null;
|
|
405
1218
|
ephemeral: true;
|
|
406
1219
|
type: "assistant.message_delta";
|
|
407
1220
|
data: {
|
|
1221
|
+
/**
|
|
1222
|
+
* Message ID this delta belongs to, matching the corresponding assistant.message event
|
|
1223
|
+
*/
|
|
408
1224
|
messageId: string;
|
|
1225
|
+
/**
|
|
1226
|
+
* Incremental text chunk to append to the message content
|
|
1227
|
+
*/
|
|
409
1228
|
deltaContent: string;
|
|
1229
|
+
/**
|
|
1230
|
+
* Tool call ID of the parent tool invocation when this event originates from a sub-agent
|
|
1231
|
+
*/
|
|
410
1232
|
parentToolCallId?: string;
|
|
411
1233
|
};
|
|
412
1234
|
} | {
|
|
1235
|
+
/**
|
|
1236
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1237
|
+
*/
|
|
413
1238
|
id: string;
|
|
1239
|
+
/**
|
|
1240
|
+
* ISO 8601 timestamp when the event was created
|
|
1241
|
+
*/
|
|
414
1242
|
timestamp: string;
|
|
1243
|
+
/**
|
|
1244
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1245
|
+
*/
|
|
415
1246
|
parentId: string | null;
|
|
1247
|
+
/**
|
|
1248
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
1249
|
+
*/
|
|
416
1250
|
ephemeral?: boolean;
|
|
417
1251
|
type: "assistant.turn_end";
|
|
418
1252
|
data: {
|
|
1253
|
+
/**
|
|
1254
|
+
* Identifier of the turn that has ended, matching the corresponding assistant.turn_start event
|
|
1255
|
+
*/
|
|
419
1256
|
turnId: string;
|
|
420
1257
|
};
|
|
421
1258
|
} | {
|
|
1259
|
+
/**
|
|
1260
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1261
|
+
*/
|
|
422
1262
|
id: string;
|
|
1263
|
+
/**
|
|
1264
|
+
* ISO 8601 timestamp when the event was created
|
|
1265
|
+
*/
|
|
423
1266
|
timestamp: string;
|
|
1267
|
+
/**
|
|
1268
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1269
|
+
*/
|
|
424
1270
|
parentId: string | null;
|
|
425
1271
|
ephemeral: true;
|
|
426
1272
|
type: "assistant.usage";
|
|
427
1273
|
data: {
|
|
1274
|
+
/**
|
|
1275
|
+
* Model identifier used for this API call
|
|
1276
|
+
*/
|
|
428
1277
|
model: string;
|
|
1278
|
+
/**
|
|
1279
|
+
* Number of input tokens consumed
|
|
1280
|
+
*/
|
|
429
1281
|
inputTokens?: number;
|
|
1282
|
+
/**
|
|
1283
|
+
* Number of output tokens produced
|
|
1284
|
+
*/
|
|
430
1285
|
outputTokens?: number;
|
|
1286
|
+
/**
|
|
1287
|
+
* Number of tokens read from prompt cache
|
|
1288
|
+
*/
|
|
431
1289
|
cacheReadTokens?: number;
|
|
1290
|
+
/**
|
|
1291
|
+
* Number of tokens written to prompt cache
|
|
1292
|
+
*/
|
|
432
1293
|
cacheWriteTokens?: number;
|
|
1294
|
+
/**
|
|
1295
|
+
* Model multiplier cost for billing purposes
|
|
1296
|
+
*/
|
|
433
1297
|
cost?: number;
|
|
1298
|
+
/**
|
|
1299
|
+
* Duration of the API call in milliseconds
|
|
1300
|
+
*/
|
|
434
1301
|
duration?: number;
|
|
1302
|
+
/**
|
|
1303
|
+
* What initiated this API call (e.g., "sub-agent"); absent for user-initiated calls
|
|
1304
|
+
*/
|
|
435
1305
|
initiator?: string;
|
|
1306
|
+
/**
|
|
1307
|
+
* Completion ID from the model provider (e.g., chatcmpl-abc123)
|
|
1308
|
+
*/
|
|
436
1309
|
apiCallId?: string;
|
|
1310
|
+
/**
|
|
1311
|
+
* GitHub request tracing ID (x-github-request-id header) for server-side log correlation
|
|
1312
|
+
*/
|
|
437
1313
|
providerCallId?: string;
|
|
1314
|
+
/**
|
|
1315
|
+
* Parent tool call ID when this usage originates from a sub-agent
|
|
1316
|
+
*/
|
|
438
1317
|
parentToolCallId?: string;
|
|
1318
|
+
/**
|
|
1319
|
+
* Per-quota resource usage snapshots, keyed by quota identifier
|
|
1320
|
+
*/
|
|
439
1321
|
quotaSnapshots?: {
|
|
440
1322
|
[k: string]: {
|
|
1323
|
+
/**
|
|
1324
|
+
* Whether the user has an unlimited usage entitlement
|
|
1325
|
+
*/
|
|
441
1326
|
isUnlimitedEntitlement: boolean;
|
|
1327
|
+
/**
|
|
1328
|
+
* Total requests allowed by the entitlement
|
|
1329
|
+
*/
|
|
442
1330
|
entitlementRequests: number;
|
|
1331
|
+
/**
|
|
1332
|
+
* Number of requests already consumed
|
|
1333
|
+
*/
|
|
443
1334
|
usedRequests: number;
|
|
1335
|
+
/**
|
|
1336
|
+
* Whether usage is still permitted after quota exhaustion
|
|
1337
|
+
*/
|
|
444
1338
|
usageAllowedWithExhaustedQuota: boolean;
|
|
1339
|
+
/**
|
|
1340
|
+
* Number of requests over the entitlement limit
|
|
1341
|
+
*/
|
|
445
1342
|
overage: number;
|
|
1343
|
+
/**
|
|
1344
|
+
* Whether overage is allowed when quota is exhausted
|
|
1345
|
+
*/
|
|
446
1346
|
overageAllowedWithExhaustedQuota: boolean;
|
|
1347
|
+
/**
|
|
1348
|
+
* Percentage of quota remaining (0.0 to 1.0)
|
|
1349
|
+
*/
|
|
447
1350
|
remainingPercentage: number;
|
|
1351
|
+
/**
|
|
1352
|
+
* Date when the quota resets
|
|
1353
|
+
*/
|
|
448
1354
|
resetDate?: string;
|
|
449
1355
|
};
|
|
450
1356
|
};
|
|
1357
|
+
/**
|
|
1358
|
+
* Per-request cost and usage data from the CAPI copilot_usage response field
|
|
1359
|
+
*/
|
|
451
1360
|
copilotUsage?: {
|
|
1361
|
+
/**
|
|
1362
|
+
* Itemized token usage breakdown
|
|
1363
|
+
*/
|
|
452
1364
|
tokenDetails: {
|
|
1365
|
+
/**
|
|
1366
|
+
* Number of tokens in this billing batch
|
|
1367
|
+
*/
|
|
453
1368
|
batchSize: number;
|
|
1369
|
+
/**
|
|
1370
|
+
* Cost per batch of tokens
|
|
1371
|
+
*/
|
|
454
1372
|
costPerBatch: number;
|
|
1373
|
+
/**
|
|
1374
|
+
* Total token count for this entry
|
|
1375
|
+
*/
|
|
455
1376
|
tokenCount: number;
|
|
1377
|
+
/**
|
|
1378
|
+
* Token category (e.g., "input", "output")
|
|
1379
|
+
*/
|
|
456
1380
|
tokenType: string;
|
|
457
1381
|
}[];
|
|
1382
|
+
/**
|
|
1383
|
+
* Total cost in nano-AIU (AI Units) for this request
|
|
1384
|
+
*/
|
|
458
1385
|
totalNanoAiu: number;
|
|
459
1386
|
};
|
|
460
1387
|
};
|
|
461
1388
|
} | {
|
|
1389
|
+
/**
|
|
1390
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1391
|
+
*/
|
|
462
1392
|
id: string;
|
|
1393
|
+
/**
|
|
1394
|
+
* ISO 8601 timestamp when the event was created
|
|
1395
|
+
*/
|
|
463
1396
|
timestamp: string;
|
|
1397
|
+
/**
|
|
1398
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1399
|
+
*/
|
|
464
1400
|
parentId: string | null;
|
|
1401
|
+
/**
|
|
1402
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
1403
|
+
*/
|
|
465
1404
|
ephemeral?: boolean;
|
|
466
1405
|
type: "abort";
|
|
467
1406
|
data: {
|
|
1407
|
+
/**
|
|
1408
|
+
* Reason the current turn was aborted (e.g., "user initiated")
|
|
1409
|
+
*/
|
|
468
1410
|
reason: string;
|
|
469
1411
|
};
|
|
470
1412
|
} | {
|
|
1413
|
+
/**
|
|
1414
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1415
|
+
*/
|
|
471
1416
|
id: string;
|
|
1417
|
+
/**
|
|
1418
|
+
* ISO 8601 timestamp when the event was created
|
|
1419
|
+
*/
|
|
472
1420
|
timestamp: string;
|
|
1421
|
+
/**
|
|
1422
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1423
|
+
*/
|
|
473
1424
|
parentId: string | null;
|
|
1425
|
+
/**
|
|
1426
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
1427
|
+
*/
|
|
474
1428
|
ephemeral?: boolean;
|
|
475
1429
|
type: "tool.user_requested";
|
|
476
1430
|
data: {
|
|
1431
|
+
/**
|
|
1432
|
+
* Unique identifier for this tool call
|
|
1433
|
+
*/
|
|
477
1434
|
toolCallId: string;
|
|
1435
|
+
/**
|
|
1436
|
+
* Name of the tool the user wants to invoke
|
|
1437
|
+
*/
|
|
478
1438
|
toolName: string;
|
|
479
|
-
|
|
1439
|
+
/**
|
|
1440
|
+
* Arguments for the tool invocation
|
|
1441
|
+
*/
|
|
1442
|
+
arguments?: {
|
|
1443
|
+
[k: string]: unknown;
|
|
1444
|
+
};
|
|
480
1445
|
};
|
|
481
1446
|
} | {
|
|
1447
|
+
/**
|
|
1448
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1449
|
+
*/
|
|
482
1450
|
id: string;
|
|
1451
|
+
/**
|
|
1452
|
+
* ISO 8601 timestamp when the event was created
|
|
1453
|
+
*/
|
|
483
1454
|
timestamp: string;
|
|
1455
|
+
/**
|
|
1456
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1457
|
+
*/
|
|
484
1458
|
parentId: string | null;
|
|
1459
|
+
/**
|
|
1460
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
1461
|
+
*/
|
|
485
1462
|
ephemeral?: boolean;
|
|
486
1463
|
type: "tool.execution_start";
|
|
487
1464
|
data: {
|
|
1465
|
+
/**
|
|
1466
|
+
* Unique identifier for this tool call
|
|
1467
|
+
*/
|
|
488
1468
|
toolCallId: string;
|
|
1469
|
+
/**
|
|
1470
|
+
* Name of the tool being executed
|
|
1471
|
+
*/
|
|
489
1472
|
toolName: string;
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
}
|
|
1473
|
+
/**
|
|
1474
|
+
* Arguments passed to the tool
|
|
1475
|
+
*/
|
|
1476
|
+
arguments?: {
|
|
1477
|
+
[k: string]: unknown;
|
|
1478
|
+
};
|
|
1479
|
+
/**
|
|
1480
|
+
* Name of the MCP server hosting this tool, when the tool is an MCP tool
|
|
1481
|
+
*/
|
|
1482
|
+
mcpServerName?: string;
|
|
1483
|
+
/**
|
|
1484
|
+
* Original tool name on the MCP server, when the tool is an MCP tool
|
|
1485
|
+
*/
|
|
1486
|
+
mcpToolName?: string;
|
|
1487
|
+
/**
|
|
1488
|
+
* Tool call ID of the parent tool invocation when this event originates from a sub-agent
|
|
1489
|
+
*/
|
|
1490
|
+
parentToolCallId?: string;
|
|
1491
|
+
};
|
|
1492
|
+
} | {
|
|
1493
|
+
/**
|
|
1494
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1495
|
+
*/
|
|
496
1496
|
id: string;
|
|
1497
|
+
/**
|
|
1498
|
+
* ISO 8601 timestamp when the event was created
|
|
1499
|
+
*/
|
|
497
1500
|
timestamp: string;
|
|
1501
|
+
/**
|
|
1502
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1503
|
+
*/
|
|
498
1504
|
parentId: string | null;
|
|
499
1505
|
ephemeral: true;
|
|
500
1506
|
type: "tool.execution_partial_result";
|
|
501
1507
|
data: {
|
|
1508
|
+
/**
|
|
1509
|
+
* Tool call ID this partial result belongs to
|
|
1510
|
+
*/
|
|
502
1511
|
toolCallId: string;
|
|
1512
|
+
/**
|
|
1513
|
+
* Incremental output chunk from the running tool
|
|
1514
|
+
*/
|
|
503
1515
|
partialOutput: string;
|
|
504
1516
|
};
|
|
505
1517
|
} | {
|
|
1518
|
+
/**
|
|
1519
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1520
|
+
*/
|
|
506
1521
|
id: string;
|
|
1522
|
+
/**
|
|
1523
|
+
* ISO 8601 timestamp when the event was created
|
|
1524
|
+
*/
|
|
507
1525
|
timestamp: string;
|
|
1526
|
+
/**
|
|
1527
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1528
|
+
*/
|
|
508
1529
|
parentId: string | null;
|
|
509
1530
|
ephemeral: true;
|
|
510
1531
|
type: "tool.execution_progress";
|
|
511
1532
|
data: {
|
|
1533
|
+
/**
|
|
1534
|
+
* Tool call ID this progress notification belongs to
|
|
1535
|
+
*/
|
|
512
1536
|
toolCallId: string;
|
|
1537
|
+
/**
|
|
1538
|
+
* Human-readable progress status message (e.g., from an MCP server)
|
|
1539
|
+
*/
|
|
513
1540
|
progressMessage: string;
|
|
514
1541
|
};
|
|
515
1542
|
} | {
|
|
1543
|
+
/**
|
|
1544
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1545
|
+
*/
|
|
516
1546
|
id: string;
|
|
1547
|
+
/**
|
|
1548
|
+
* ISO 8601 timestamp when the event was created
|
|
1549
|
+
*/
|
|
517
1550
|
timestamp: string;
|
|
1551
|
+
/**
|
|
1552
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1553
|
+
*/
|
|
518
1554
|
parentId: string | null;
|
|
1555
|
+
/**
|
|
1556
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
1557
|
+
*/
|
|
519
1558
|
ephemeral?: boolean;
|
|
520
1559
|
type: "tool.execution_complete";
|
|
521
1560
|
data: {
|
|
1561
|
+
/**
|
|
1562
|
+
* Unique identifier for the completed tool call
|
|
1563
|
+
*/
|
|
522
1564
|
toolCallId: string;
|
|
1565
|
+
/**
|
|
1566
|
+
* Whether the tool execution completed successfully
|
|
1567
|
+
*/
|
|
523
1568
|
success: boolean;
|
|
1569
|
+
/**
|
|
1570
|
+
* Model identifier that generated this tool call
|
|
1571
|
+
*/
|
|
524
1572
|
model?: string;
|
|
1573
|
+
/**
|
|
1574
|
+
* CAPI interaction ID for correlating this tool execution with upstream telemetry
|
|
1575
|
+
*/
|
|
525
1576
|
interactionId?: string;
|
|
1577
|
+
/**
|
|
1578
|
+
* Whether this tool call was explicitly requested by the user rather than the assistant
|
|
1579
|
+
*/
|
|
526
1580
|
isUserRequested?: boolean;
|
|
1581
|
+
/**
|
|
1582
|
+
* Tool execution result on success
|
|
1583
|
+
*/
|
|
527
1584
|
result?: {
|
|
1585
|
+
/**
|
|
1586
|
+
* Concise tool result text sent to the LLM for chat completion, potentially truncated for token efficiency
|
|
1587
|
+
*/
|
|
528
1588
|
content: string;
|
|
1589
|
+
/**
|
|
1590
|
+
* Full detailed tool result for UI/timeline display, preserving complete content such as diffs. Falls back to content when absent.
|
|
1591
|
+
*/
|
|
529
1592
|
detailedContent?: string;
|
|
1593
|
+
/**
|
|
1594
|
+
* Structured content blocks (text, images, audio, resources) returned by the tool in their native format
|
|
1595
|
+
*/
|
|
530
1596
|
contents?: ({
|
|
1597
|
+
/**
|
|
1598
|
+
* Content block type discriminator
|
|
1599
|
+
*/
|
|
531
1600
|
type: "text";
|
|
1601
|
+
/**
|
|
1602
|
+
* The text content
|
|
1603
|
+
*/
|
|
532
1604
|
text: string;
|
|
533
1605
|
} | {
|
|
1606
|
+
/**
|
|
1607
|
+
* Content block type discriminator
|
|
1608
|
+
*/
|
|
534
1609
|
type: "terminal";
|
|
1610
|
+
/**
|
|
1611
|
+
* Terminal/shell output text
|
|
1612
|
+
*/
|
|
535
1613
|
text: string;
|
|
1614
|
+
/**
|
|
1615
|
+
* Process exit code, if the command has completed
|
|
1616
|
+
*/
|
|
536
1617
|
exitCode?: number;
|
|
1618
|
+
/**
|
|
1619
|
+
* Working directory where the command was executed
|
|
1620
|
+
*/
|
|
537
1621
|
cwd?: string;
|
|
538
1622
|
} | {
|
|
1623
|
+
/**
|
|
1624
|
+
* Content block type discriminator
|
|
1625
|
+
*/
|
|
539
1626
|
type: "image";
|
|
1627
|
+
/**
|
|
1628
|
+
* Base64-encoded image data
|
|
1629
|
+
*/
|
|
540
1630
|
data: string;
|
|
1631
|
+
/**
|
|
1632
|
+
* MIME type of the image (e.g., image/png, image/jpeg)
|
|
1633
|
+
*/
|
|
541
1634
|
mimeType: string;
|
|
542
1635
|
} | {
|
|
1636
|
+
/**
|
|
1637
|
+
* Content block type discriminator
|
|
1638
|
+
*/
|
|
543
1639
|
type: "audio";
|
|
1640
|
+
/**
|
|
1641
|
+
* Base64-encoded audio data
|
|
1642
|
+
*/
|
|
544
1643
|
data: string;
|
|
1644
|
+
/**
|
|
1645
|
+
* MIME type of the audio (e.g., audio/wav, audio/mpeg)
|
|
1646
|
+
*/
|
|
545
1647
|
mimeType: string;
|
|
546
1648
|
} | {
|
|
1649
|
+
/**
|
|
1650
|
+
* Icons associated with this resource
|
|
1651
|
+
*/
|
|
547
1652
|
icons?: {
|
|
1653
|
+
/**
|
|
1654
|
+
* URL or path to the icon image
|
|
1655
|
+
*/
|
|
548
1656
|
src: string;
|
|
1657
|
+
/**
|
|
1658
|
+
* MIME type of the icon image
|
|
1659
|
+
*/
|
|
549
1660
|
mimeType?: string;
|
|
1661
|
+
/**
|
|
1662
|
+
* Available icon sizes (e.g., ['16x16', '32x32'])
|
|
1663
|
+
*/
|
|
550
1664
|
sizes?: string[];
|
|
1665
|
+
/**
|
|
1666
|
+
* Theme variant this icon is intended for
|
|
1667
|
+
*/
|
|
551
1668
|
theme?: "light" | "dark";
|
|
552
1669
|
}[];
|
|
1670
|
+
/**
|
|
1671
|
+
* Resource name identifier
|
|
1672
|
+
*/
|
|
553
1673
|
name: string;
|
|
1674
|
+
/**
|
|
1675
|
+
* Human-readable display title for the resource
|
|
1676
|
+
*/
|
|
554
1677
|
title?: string;
|
|
1678
|
+
/**
|
|
1679
|
+
* URI identifying the resource
|
|
1680
|
+
*/
|
|
555
1681
|
uri: string;
|
|
1682
|
+
/**
|
|
1683
|
+
* Human-readable description of the resource
|
|
1684
|
+
*/
|
|
556
1685
|
description?: string;
|
|
1686
|
+
/**
|
|
1687
|
+
* MIME type of the resource content
|
|
1688
|
+
*/
|
|
557
1689
|
mimeType?: string;
|
|
1690
|
+
/**
|
|
1691
|
+
* Size of the resource in bytes
|
|
1692
|
+
*/
|
|
558
1693
|
size?: number;
|
|
1694
|
+
/**
|
|
1695
|
+
* Content block type discriminator
|
|
1696
|
+
*/
|
|
559
1697
|
type: "resource_link";
|
|
560
1698
|
} | {
|
|
1699
|
+
/**
|
|
1700
|
+
* Content block type discriminator
|
|
1701
|
+
*/
|
|
561
1702
|
type: "resource";
|
|
1703
|
+
/**
|
|
1704
|
+
* The embedded resource contents, either text or base64-encoded binary
|
|
1705
|
+
*/
|
|
562
1706
|
resource: {
|
|
1707
|
+
/**
|
|
1708
|
+
* URI identifying the resource
|
|
1709
|
+
*/
|
|
563
1710
|
uri: string;
|
|
1711
|
+
/**
|
|
1712
|
+
* MIME type of the text content
|
|
1713
|
+
*/
|
|
564
1714
|
mimeType?: string;
|
|
1715
|
+
/**
|
|
1716
|
+
* Text content of the resource
|
|
1717
|
+
*/
|
|
565
1718
|
text: string;
|
|
566
1719
|
} | {
|
|
1720
|
+
/**
|
|
1721
|
+
* URI identifying the resource
|
|
1722
|
+
*/
|
|
567
1723
|
uri: string;
|
|
1724
|
+
/**
|
|
1725
|
+
* MIME type of the blob content
|
|
1726
|
+
*/
|
|
568
1727
|
mimeType?: string;
|
|
1728
|
+
/**
|
|
1729
|
+
* Base64-encoded binary content of the resource
|
|
1730
|
+
*/
|
|
569
1731
|
blob: string;
|
|
570
1732
|
};
|
|
571
1733
|
})[];
|
|
572
1734
|
};
|
|
1735
|
+
/**
|
|
1736
|
+
* Error details when the tool execution failed
|
|
1737
|
+
*/
|
|
573
1738
|
error?: {
|
|
1739
|
+
/**
|
|
1740
|
+
* Human-readable error message
|
|
1741
|
+
*/
|
|
574
1742
|
message: string;
|
|
1743
|
+
/**
|
|
1744
|
+
* Machine-readable error code
|
|
1745
|
+
*/
|
|
575
1746
|
code?: string;
|
|
576
1747
|
};
|
|
1748
|
+
/**
|
|
1749
|
+
* Tool-specific telemetry data (e.g., CodeQL check counts, grep match counts)
|
|
1750
|
+
*/
|
|
577
1751
|
toolTelemetry?: {
|
|
578
1752
|
[k: string]: unknown;
|
|
579
1753
|
};
|
|
1754
|
+
/**
|
|
1755
|
+
* Tool call ID of the parent tool invocation when this event originates from a sub-agent
|
|
1756
|
+
*/
|
|
580
1757
|
parentToolCallId?: string;
|
|
581
1758
|
};
|
|
582
1759
|
} | {
|
|
1760
|
+
/**
|
|
1761
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1762
|
+
*/
|
|
583
1763
|
id: string;
|
|
1764
|
+
/**
|
|
1765
|
+
* ISO 8601 timestamp when the event was created
|
|
1766
|
+
*/
|
|
584
1767
|
timestamp: string;
|
|
1768
|
+
/**
|
|
1769
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1770
|
+
*/
|
|
585
1771
|
parentId: string | null;
|
|
1772
|
+
/**
|
|
1773
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
1774
|
+
*/
|
|
586
1775
|
ephemeral?: boolean;
|
|
587
1776
|
type: "skill.invoked";
|
|
588
1777
|
data: {
|
|
1778
|
+
/**
|
|
1779
|
+
* Name of the invoked skill
|
|
1780
|
+
*/
|
|
589
1781
|
name: string;
|
|
1782
|
+
/**
|
|
1783
|
+
* File path to the SKILL.md definition
|
|
1784
|
+
*/
|
|
590
1785
|
path: string;
|
|
1786
|
+
/**
|
|
1787
|
+
* Full content of the skill file, injected into the conversation for the model
|
|
1788
|
+
*/
|
|
591
1789
|
content: string;
|
|
1790
|
+
/**
|
|
1791
|
+
* Tool names that should be auto-approved when this skill is active
|
|
1792
|
+
*/
|
|
592
1793
|
allowedTools?: string[];
|
|
1794
|
+
/**
|
|
1795
|
+
* Name of the plugin this skill originated from, when applicable
|
|
1796
|
+
*/
|
|
593
1797
|
pluginName?: string;
|
|
1798
|
+
/**
|
|
1799
|
+
* Version of the plugin this skill originated from, when applicable
|
|
1800
|
+
*/
|
|
594
1801
|
pluginVersion?: string;
|
|
595
1802
|
};
|
|
596
1803
|
} | {
|
|
1804
|
+
/**
|
|
1805
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1806
|
+
*/
|
|
597
1807
|
id: string;
|
|
1808
|
+
/**
|
|
1809
|
+
* ISO 8601 timestamp when the event was created
|
|
1810
|
+
*/
|
|
598
1811
|
timestamp: string;
|
|
1812
|
+
/**
|
|
1813
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1814
|
+
*/
|
|
599
1815
|
parentId: string | null;
|
|
1816
|
+
/**
|
|
1817
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
1818
|
+
*/
|
|
600
1819
|
ephemeral?: boolean;
|
|
601
1820
|
type: "subagent.started";
|
|
602
1821
|
data: {
|
|
1822
|
+
/**
|
|
1823
|
+
* Tool call ID of the parent tool invocation that spawned this sub-agent
|
|
1824
|
+
*/
|
|
603
1825
|
toolCallId: string;
|
|
1826
|
+
/**
|
|
1827
|
+
* Internal name of the sub-agent
|
|
1828
|
+
*/
|
|
604
1829
|
agentName: string;
|
|
1830
|
+
/**
|
|
1831
|
+
* Human-readable display name of the sub-agent
|
|
1832
|
+
*/
|
|
605
1833
|
agentDisplayName: string;
|
|
1834
|
+
/**
|
|
1835
|
+
* Description of what the sub-agent does
|
|
1836
|
+
*/
|
|
606
1837
|
agentDescription: string;
|
|
607
1838
|
};
|
|
608
1839
|
} | {
|
|
1840
|
+
/**
|
|
1841
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1842
|
+
*/
|
|
609
1843
|
id: string;
|
|
1844
|
+
/**
|
|
1845
|
+
* ISO 8601 timestamp when the event was created
|
|
1846
|
+
*/
|
|
610
1847
|
timestamp: string;
|
|
1848
|
+
/**
|
|
1849
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1850
|
+
*/
|
|
611
1851
|
parentId: string | null;
|
|
1852
|
+
/**
|
|
1853
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
1854
|
+
*/
|
|
612
1855
|
ephemeral?: boolean;
|
|
613
1856
|
type: "subagent.completed";
|
|
614
1857
|
data: {
|
|
1858
|
+
/**
|
|
1859
|
+
* Tool call ID of the parent tool invocation that spawned this sub-agent
|
|
1860
|
+
*/
|
|
615
1861
|
toolCallId: string;
|
|
1862
|
+
/**
|
|
1863
|
+
* Internal name of the sub-agent
|
|
1864
|
+
*/
|
|
616
1865
|
agentName: string;
|
|
1866
|
+
/**
|
|
1867
|
+
* Human-readable display name of the sub-agent
|
|
1868
|
+
*/
|
|
617
1869
|
agentDisplayName: string;
|
|
618
1870
|
};
|
|
619
1871
|
} | {
|
|
1872
|
+
/**
|
|
1873
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1874
|
+
*/
|
|
620
1875
|
id: string;
|
|
1876
|
+
/**
|
|
1877
|
+
* ISO 8601 timestamp when the event was created
|
|
1878
|
+
*/
|
|
621
1879
|
timestamp: string;
|
|
1880
|
+
/**
|
|
1881
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1882
|
+
*/
|
|
622
1883
|
parentId: string | null;
|
|
1884
|
+
/**
|
|
1885
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
1886
|
+
*/
|
|
623
1887
|
ephemeral?: boolean;
|
|
624
1888
|
type: "subagent.failed";
|
|
625
1889
|
data: {
|
|
1890
|
+
/**
|
|
1891
|
+
* Tool call ID of the parent tool invocation that spawned this sub-agent
|
|
1892
|
+
*/
|
|
626
1893
|
toolCallId: string;
|
|
1894
|
+
/**
|
|
1895
|
+
* Internal name of the sub-agent
|
|
1896
|
+
*/
|
|
627
1897
|
agentName: string;
|
|
1898
|
+
/**
|
|
1899
|
+
* Human-readable display name of the sub-agent
|
|
1900
|
+
*/
|
|
628
1901
|
agentDisplayName: string;
|
|
1902
|
+
/**
|
|
1903
|
+
* Error message describing why the sub-agent failed
|
|
1904
|
+
*/
|
|
629
1905
|
error: string;
|
|
630
1906
|
};
|
|
631
1907
|
} | {
|
|
1908
|
+
/**
|
|
1909
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1910
|
+
*/
|
|
632
1911
|
id: string;
|
|
1912
|
+
/**
|
|
1913
|
+
* ISO 8601 timestamp when the event was created
|
|
1914
|
+
*/
|
|
633
1915
|
timestamp: string;
|
|
1916
|
+
/**
|
|
1917
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1918
|
+
*/
|
|
634
1919
|
parentId: string | null;
|
|
1920
|
+
/**
|
|
1921
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
1922
|
+
*/
|
|
635
1923
|
ephemeral?: boolean;
|
|
636
1924
|
type: "subagent.selected";
|
|
637
1925
|
data: {
|
|
1926
|
+
/**
|
|
1927
|
+
* Internal name of the selected custom agent
|
|
1928
|
+
*/
|
|
638
1929
|
agentName: string;
|
|
1930
|
+
/**
|
|
1931
|
+
* Human-readable display name of the selected custom agent
|
|
1932
|
+
*/
|
|
639
1933
|
agentDisplayName: string;
|
|
1934
|
+
/**
|
|
1935
|
+
* List of tool names available to this agent, or null for all tools
|
|
1936
|
+
*/
|
|
640
1937
|
tools: string[] | null;
|
|
641
1938
|
};
|
|
642
1939
|
} | {
|
|
1940
|
+
/**
|
|
1941
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1942
|
+
*/
|
|
643
1943
|
id: string;
|
|
1944
|
+
/**
|
|
1945
|
+
* ISO 8601 timestamp when the event was created
|
|
1946
|
+
*/
|
|
644
1947
|
timestamp: string;
|
|
1948
|
+
/**
|
|
1949
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1950
|
+
*/
|
|
645
1951
|
parentId: string | null;
|
|
1952
|
+
/**
|
|
1953
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
1954
|
+
*/
|
|
646
1955
|
ephemeral?: boolean;
|
|
647
1956
|
type: "subagent.deselected";
|
|
1957
|
+
/**
|
|
1958
|
+
* Empty payload; the event signals that the custom agent was deselected, returning to the default agent
|
|
1959
|
+
*/
|
|
648
1960
|
data: {};
|
|
649
1961
|
} | {
|
|
1962
|
+
/**
|
|
1963
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1964
|
+
*/
|
|
650
1965
|
id: string;
|
|
1966
|
+
/**
|
|
1967
|
+
* ISO 8601 timestamp when the event was created
|
|
1968
|
+
*/
|
|
651
1969
|
timestamp: string;
|
|
1970
|
+
/**
|
|
1971
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
1972
|
+
*/
|
|
652
1973
|
parentId: string | null;
|
|
1974
|
+
/**
|
|
1975
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
1976
|
+
*/
|
|
653
1977
|
ephemeral?: boolean;
|
|
654
1978
|
type: "hook.start";
|
|
655
1979
|
data: {
|
|
1980
|
+
/**
|
|
1981
|
+
* Unique identifier for this hook invocation
|
|
1982
|
+
*/
|
|
656
1983
|
hookInvocationId: string;
|
|
1984
|
+
/**
|
|
1985
|
+
* Type of hook being invoked (e.g., "preToolUse", "postToolUse", "sessionStart")
|
|
1986
|
+
*/
|
|
657
1987
|
hookType: string;
|
|
658
|
-
|
|
1988
|
+
/**
|
|
1989
|
+
* Input data passed to the hook
|
|
1990
|
+
*/
|
|
1991
|
+
input?: {
|
|
1992
|
+
[k: string]: unknown;
|
|
1993
|
+
};
|
|
659
1994
|
};
|
|
660
1995
|
} | {
|
|
1996
|
+
/**
|
|
1997
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
1998
|
+
*/
|
|
661
1999
|
id: string;
|
|
2000
|
+
/**
|
|
2001
|
+
* ISO 8601 timestamp when the event was created
|
|
2002
|
+
*/
|
|
662
2003
|
timestamp: string;
|
|
2004
|
+
/**
|
|
2005
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
2006
|
+
*/
|
|
663
2007
|
parentId: string | null;
|
|
2008
|
+
/**
|
|
2009
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
2010
|
+
*/
|
|
664
2011
|
ephemeral?: boolean;
|
|
665
2012
|
type: "hook.end";
|
|
666
2013
|
data: {
|
|
2014
|
+
/**
|
|
2015
|
+
* Identifier matching the corresponding hook.start event
|
|
2016
|
+
*/
|
|
667
2017
|
hookInvocationId: string;
|
|
2018
|
+
/**
|
|
2019
|
+
* Type of hook that was invoked (e.g., "preToolUse", "postToolUse", "sessionStart")
|
|
2020
|
+
*/
|
|
668
2021
|
hookType: string;
|
|
669
|
-
|
|
2022
|
+
/**
|
|
2023
|
+
* Output data produced by the hook
|
|
2024
|
+
*/
|
|
2025
|
+
output?: {
|
|
2026
|
+
[k: string]: unknown;
|
|
2027
|
+
};
|
|
2028
|
+
/**
|
|
2029
|
+
* Whether the hook completed successfully
|
|
2030
|
+
*/
|
|
670
2031
|
success: boolean;
|
|
2032
|
+
/**
|
|
2033
|
+
* Error details when the hook failed
|
|
2034
|
+
*/
|
|
671
2035
|
error?: {
|
|
2036
|
+
/**
|
|
2037
|
+
* Human-readable error message
|
|
2038
|
+
*/
|
|
672
2039
|
message: string;
|
|
2040
|
+
/**
|
|
2041
|
+
* Error stack trace, when available
|
|
2042
|
+
*/
|
|
673
2043
|
stack?: string;
|
|
674
2044
|
};
|
|
675
2045
|
};
|
|
676
2046
|
} | {
|
|
2047
|
+
/**
|
|
2048
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
2049
|
+
*/
|
|
677
2050
|
id: string;
|
|
2051
|
+
/**
|
|
2052
|
+
* ISO 8601 timestamp when the event was created
|
|
2053
|
+
*/
|
|
678
2054
|
timestamp: string;
|
|
2055
|
+
/**
|
|
2056
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
2057
|
+
*/
|
|
679
2058
|
parentId: string | null;
|
|
2059
|
+
/**
|
|
2060
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
2061
|
+
*/
|
|
680
2062
|
ephemeral?: boolean;
|
|
681
2063
|
type: "system.message";
|
|
682
2064
|
data: {
|
|
2065
|
+
/**
|
|
2066
|
+
* The system or developer prompt text
|
|
2067
|
+
*/
|
|
683
2068
|
content: string;
|
|
2069
|
+
/**
|
|
2070
|
+
* Message role: "system" for system prompts, "developer" for developer-injected instructions
|
|
2071
|
+
*/
|
|
684
2072
|
role: "system" | "developer";
|
|
2073
|
+
/**
|
|
2074
|
+
* Optional name identifier for the message source
|
|
2075
|
+
*/
|
|
685
2076
|
name?: string;
|
|
2077
|
+
/**
|
|
2078
|
+
* Metadata about the prompt template and its construction
|
|
2079
|
+
*/
|
|
686
2080
|
metadata?: {
|
|
2081
|
+
/**
|
|
2082
|
+
* Version identifier of the prompt template used
|
|
2083
|
+
*/
|
|
687
2084
|
promptVersion?: string;
|
|
2085
|
+
/**
|
|
2086
|
+
* Template variables used when constructing the prompt
|
|
2087
|
+
*/
|
|
688
2088
|
variables?: {
|
|
689
2089
|
[k: string]: unknown;
|
|
690
2090
|
};
|
|
691
2091
|
};
|
|
692
2092
|
};
|
|
2093
|
+
} | {
|
|
2094
|
+
/**
|
|
2095
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
2096
|
+
*/
|
|
2097
|
+
id: string;
|
|
2098
|
+
/**
|
|
2099
|
+
* ISO 8601 timestamp when the event was created
|
|
2100
|
+
*/
|
|
2101
|
+
timestamp: string;
|
|
2102
|
+
/**
|
|
2103
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
2104
|
+
*/
|
|
2105
|
+
parentId: string | null;
|
|
2106
|
+
ephemeral: true;
|
|
2107
|
+
type: "permission.requested";
|
|
2108
|
+
data: {
|
|
2109
|
+
/**
|
|
2110
|
+
* Unique identifier for this permission request; used to respond via session.respondToPermission()
|
|
2111
|
+
*/
|
|
2112
|
+
requestId: string;
|
|
2113
|
+
/**
|
|
2114
|
+
* Details of the permission being requested
|
|
2115
|
+
*/
|
|
2116
|
+
permissionRequest: {
|
|
2117
|
+
/**
|
|
2118
|
+
* Permission kind discriminator
|
|
2119
|
+
*/
|
|
2120
|
+
kind: "shell";
|
|
2121
|
+
/**
|
|
2122
|
+
* Tool call ID that triggered this permission request
|
|
2123
|
+
*/
|
|
2124
|
+
toolCallId?: string;
|
|
2125
|
+
/**
|
|
2126
|
+
* The complete shell command text to be executed
|
|
2127
|
+
*/
|
|
2128
|
+
fullCommandText: string;
|
|
2129
|
+
/**
|
|
2130
|
+
* Human-readable description of what the command intends to do
|
|
2131
|
+
*/
|
|
2132
|
+
intention: string;
|
|
2133
|
+
/**
|
|
2134
|
+
* Parsed command identifiers found in the command text
|
|
2135
|
+
*/
|
|
2136
|
+
commands: {
|
|
2137
|
+
/**
|
|
2138
|
+
* Command identifier (e.g., executable name)
|
|
2139
|
+
*/
|
|
2140
|
+
identifier: string;
|
|
2141
|
+
/**
|
|
2142
|
+
* Whether this command is read-only (no side effects)
|
|
2143
|
+
*/
|
|
2144
|
+
readOnly: boolean;
|
|
2145
|
+
}[];
|
|
2146
|
+
/**
|
|
2147
|
+
* File paths that may be read or written by the command
|
|
2148
|
+
*/
|
|
2149
|
+
possiblePaths: string[];
|
|
2150
|
+
/**
|
|
2151
|
+
* URLs that may be accessed by the command
|
|
2152
|
+
*/
|
|
2153
|
+
possibleUrls: {
|
|
2154
|
+
/**
|
|
2155
|
+
* URL that may be accessed by the command
|
|
2156
|
+
*/
|
|
2157
|
+
url: string;
|
|
2158
|
+
}[];
|
|
2159
|
+
/**
|
|
2160
|
+
* Whether the command includes a file write redirection (e.g., > or >>)
|
|
2161
|
+
*/
|
|
2162
|
+
hasWriteFileRedirection: boolean;
|
|
2163
|
+
/**
|
|
2164
|
+
* Whether the UI can offer session-wide approval for this command pattern
|
|
2165
|
+
*/
|
|
2166
|
+
canOfferSessionApproval: boolean;
|
|
2167
|
+
/**
|
|
2168
|
+
* Optional warning message about risks of running this command
|
|
2169
|
+
*/
|
|
2170
|
+
warning?: string;
|
|
2171
|
+
} | {
|
|
2172
|
+
/**
|
|
2173
|
+
* Permission kind discriminator
|
|
2174
|
+
*/
|
|
2175
|
+
kind: "write";
|
|
2176
|
+
/**
|
|
2177
|
+
* Tool call ID that triggered this permission request
|
|
2178
|
+
*/
|
|
2179
|
+
toolCallId?: string;
|
|
2180
|
+
/**
|
|
2181
|
+
* Human-readable description of the intended file change
|
|
2182
|
+
*/
|
|
2183
|
+
intention: string;
|
|
2184
|
+
/**
|
|
2185
|
+
* Path of the file being written to
|
|
2186
|
+
*/
|
|
2187
|
+
fileName: string;
|
|
2188
|
+
/**
|
|
2189
|
+
* Unified diff showing the proposed changes
|
|
2190
|
+
*/
|
|
2191
|
+
diff: string;
|
|
2192
|
+
/**
|
|
2193
|
+
* Complete new file contents for newly created files
|
|
2194
|
+
*/
|
|
2195
|
+
newFileContents?: string;
|
|
2196
|
+
} | {
|
|
2197
|
+
/**
|
|
2198
|
+
* Permission kind discriminator
|
|
2199
|
+
*/
|
|
2200
|
+
kind: "read";
|
|
2201
|
+
/**
|
|
2202
|
+
* Tool call ID that triggered this permission request
|
|
2203
|
+
*/
|
|
2204
|
+
toolCallId?: string;
|
|
2205
|
+
/**
|
|
2206
|
+
* Human-readable description of why the file is being read
|
|
2207
|
+
*/
|
|
2208
|
+
intention: string;
|
|
2209
|
+
/**
|
|
2210
|
+
* Path of the file or directory being read
|
|
2211
|
+
*/
|
|
2212
|
+
path: string;
|
|
2213
|
+
} | {
|
|
2214
|
+
/**
|
|
2215
|
+
* Permission kind discriminator
|
|
2216
|
+
*/
|
|
2217
|
+
kind: "mcp";
|
|
2218
|
+
/**
|
|
2219
|
+
* Tool call ID that triggered this permission request
|
|
2220
|
+
*/
|
|
2221
|
+
toolCallId?: string;
|
|
2222
|
+
/**
|
|
2223
|
+
* Name of the MCP server providing the tool
|
|
2224
|
+
*/
|
|
2225
|
+
serverName: string;
|
|
2226
|
+
/**
|
|
2227
|
+
* Internal name of the MCP tool
|
|
2228
|
+
*/
|
|
2229
|
+
toolName: string;
|
|
2230
|
+
/**
|
|
2231
|
+
* Human-readable title of the MCP tool
|
|
2232
|
+
*/
|
|
2233
|
+
toolTitle: string;
|
|
2234
|
+
/**
|
|
2235
|
+
* Arguments to pass to the MCP tool
|
|
2236
|
+
*/
|
|
2237
|
+
args?: {
|
|
2238
|
+
[k: string]: unknown;
|
|
2239
|
+
};
|
|
2240
|
+
/**
|
|
2241
|
+
* Whether this MCP tool is read-only (no side effects)
|
|
2242
|
+
*/
|
|
2243
|
+
readOnly: boolean;
|
|
2244
|
+
} | {
|
|
2245
|
+
/**
|
|
2246
|
+
* Permission kind discriminator
|
|
2247
|
+
*/
|
|
2248
|
+
kind: "url";
|
|
2249
|
+
/**
|
|
2250
|
+
* Tool call ID that triggered this permission request
|
|
2251
|
+
*/
|
|
2252
|
+
toolCallId?: string;
|
|
2253
|
+
/**
|
|
2254
|
+
* Human-readable description of why the URL is being accessed
|
|
2255
|
+
*/
|
|
2256
|
+
intention: string;
|
|
2257
|
+
/**
|
|
2258
|
+
* URL to be fetched
|
|
2259
|
+
*/
|
|
2260
|
+
url: string;
|
|
2261
|
+
} | {
|
|
2262
|
+
/**
|
|
2263
|
+
* Permission kind discriminator
|
|
2264
|
+
*/
|
|
2265
|
+
kind: "memory";
|
|
2266
|
+
/**
|
|
2267
|
+
* Tool call ID that triggered this permission request
|
|
2268
|
+
*/
|
|
2269
|
+
toolCallId?: string;
|
|
2270
|
+
/**
|
|
2271
|
+
* Topic or subject of the memory being stored
|
|
2272
|
+
*/
|
|
2273
|
+
subject: string;
|
|
2274
|
+
/**
|
|
2275
|
+
* The fact or convention being stored
|
|
2276
|
+
*/
|
|
2277
|
+
fact: string;
|
|
2278
|
+
/**
|
|
2279
|
+
* Source references for the stored fact
|
|
2280
|
+
*/
|
|
2281
|
+
citations: string;
|
|
2282
|
+
} | {
|
|
2283
|
+
/**
|
|
2284
|
+
* Permission kind discriminator
|
|
2285
|
+
*/
|
|
2286
|
+
kind: "custom-tool";
|
|
2287
|
+
/**
|
|
2288
|
+
* Tool call ID that triggered this permission request
|
|
2289
|
+
*/
|
|
2290
|
+
toolCallId?: string;
|
|
2291
|
+
/**
|
|
2292
|
+
* Name of the custom tool
|
|
2293
|
+
*/
|
|
2294
|
+
toolName: string;
|
|
2295
|
+
/**
|
|
2296
|
+
* Description of what the custom tool does
|
|
2297
|
+
*/
|
|
2298
|
+
toolDescription: string;
|
|
2299
|
+
/**
|
|
2300
|
+
* Arguments to pass to the custom tool
|
|
2301
|
+
*/
|
|
2302
|
+
args?: {
|
|
2303
|
+
[k: string]: unknown;
|
|
2304
|
+
};
|
|
2305
|
+
};
|
|
2306
|
+
};
|
|
2307
|
+
} | {
|
|
2308
|
+
/**
|
|
2309
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
2310
|
+
*/
|
|
2311
|
+
id: string;
|
|
2312
|
+
/**
|
|
2313
|
+
* ISO 8601 timestamp when the event was created
|
|
2314
|
+
*/
|
|
2315
|
+
timestamp: string;
|
|
2316
|
+
/**
|
|
2317
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
2318
|
+
*/
|
|
2319
|
+
parentId: string | null;
|
|
2320
|
+
ephemeral: true;
|
|
2321
|
+
type: "permission.completed";
|
|
2322
|
+
data: {
|
|
2323
|
+
/**
|
|
2324
|
+
* Request ID of the resolved permission request; clients should dismiss any UI for this request
|
|
2325
|
+
*/
|
|
2326
|
+
requestId: string;
|
|
2327
|
+
/**
|
|
2328
|
+
* The result of the permission request
|
|
2329
|
+
*/
|
|
2330
|
+
result: {
|
|
2331
|
+
/**
|
|
2332
|
+
* The outcome of the permission request
|
|
2333
|
+
*/
|
|
2334
|
+
kind: "approved" | "denied-by-rules" | "denied-no-approval-rule-and-could-not-request-from-user" | "denied-interactively-by-user" | "denied-by-content-exclusion-policy";
|
|
2335
|
+
};
|
|
2336
|
+
};
|
|
2337
|
+
} | {
|
|
2338
|
+
/**
|
|
2339
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
2340
|
+
*/
|
|
2341
|
+
id: string;
|
|
2342
|
+
/**
|
|
2343
|
+
* ISO 8601 timestamp when the event was created
|
|
2344
|
+
*/
|
|
2345
|
+
timestamp: string;
|
|
2346
|
+
/**
|
|
2347
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
2348
|
+
*/
|
|
2349
|
+
parentId: string | null;
|
|
2350
|
+
ephemeral: true;
|
|
2351
|
+
type: "user_input.requested";
|
|
2352
|
+
data: {
|
|
2353
|
+
/**
|
|
2354
|
+
* Unique identifier for this input request; used to respond via session.respondToUserInput()
|
|
2355
|
+
*/
|
|
2356
|
+
requestId: string;
|
|
2357
|
+
/**
|
|
2358
|
+
* The question or prompt to present to the user
|
|
2359
|
+
*/
|
|
2360
|
+
question: string;
|
|
2361
|
+
/**
|
|
2362
|
+
* Predefined choices for the user to select from, if applicable
|
|
2363
|
+
*/
|
|
2364
|
+
choices?: string[];
|
|
2365
|
+
/**
|
|
2366
|
+
* Whether the user can provide a free-form text response in addition to predefined choices
|
|
2367
|
+
*/
|
|
2368
|
+
allowFreeform?: boolean;
|
|
2369
|
+
};
|
|
2370
|
+
} | {
|
|
2371
|
+
/**
|
|
2372
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
2373
|
+
*/
|
|
2374
|
+
id: string;
|
|
2375
|
+
/**
|
|
2376
|
+
* ISO 8601 timestamp when the event was created
|
|
2377
|
+
*/
|
|
2378
|
+
timestamp: string;
|
|
2379
|
+
/**
|
|
2380
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
2381
|
+
*/
|
|
2382
|
+
parentId: string | null;
|
|
2383
|
+
ephemeral: true;
|
|
2384
|
+
type: "user_input.completed";
|
|
2385
|
+
data: {
|
|
2386
|
+
/**
|
|
2387
|
+
* Request ID of the resolved user input request; clients should dismiss any UI for this request
|
|
2388
|
+
*/
|
|
2389
|
+
requestId: string;
|
|
2390
|
+
};
|
|
2391
|
+
} | {
|
|
2392
|
+
/**
|
|
2393
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
2394
|
+
*/
|
|
2395
|
+
id: string;
|
|
2396
|
+
/**
|
|
2397
|
+
* ISO 8601 timestamp when the event was created
|
|
2398
|
+
*/
|
|
2399
|
+
timestamp: string;
|
|
2400
|
+
/**
|
|
2401
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
2402
|
+
*/
|
|
2403
|
+
parentId: string | null;
|
|
2404
|
+
ephemeral: true;
|
|
2405
|
+
type: "elicitation.requested";
|
|
2406
|
+
data: {
|
|
2407
|
+
/**
|
|
2408
|
+
* Unique identifier for this elicitation request; used to respond via session.respondToElicitation()
|
|
2409
|
+
*/
|
|
2410
|
+
requestId: string;
|
|
2411
|
+
/**
|
|
2412
|
+
* Message describing what information is needed from the user
|
|
2413
|
+
*/
|
|
2414
|
+
message: string;
|
|
2415
|
+
/**
|
|
2416
|
+
* Elicitation mode; currently only "form" is supported. Defaults to "form" when absent.
|
|
2417
|
+
*/
|
|
2418
|
+
mode?: "form";
|
|
2419
|
+
/**
|
|
2420
|
+
* JSON Schema describing the form fields to present to the user
|
|
2421
|
+
*/
|
|
2422
|
+
requestedSchema: {
|
|
2423
|
+
type: "object";
|
|
2424
|
+
/**
|
|
2425
|
+
* Form field definitions, keyed by field name
|
|
2426
|
+
*/
|
|
2427
|
+
properties: {
|
|
2428
|
+
[k: string]: unknown;
|
|
2429
|
+
};
|
|
2430
|
+
/**
|
|
2431
|
+
* List of required field names
|
|
2432
|
+
*/
|
|
2433
|
+
required?: string[];
|
|
2434
|
+
};
|
|
2435
|
+
[k: string]: unknown;
|
|
2436
|
+
};
|
|
2437
|
+
} | {
|
|
2438
|
+
/**
|
|
2439
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
2440
|
+
*/
|
|
2441
|
+
id: string;
|
|
2442
|
+
/**
|
|
2443
|
+
* ISO 8601 timestamp when the event was created
|
|
2444
|
+
*/
|
|
2445
|
+
timestamp: string;
|
|
2446
|
+
/**
|
|
2447
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
2448
|
+
*/
|
|
2449
|
+
parentId: string | null;
|
|
2450
|
+
ephemeral: true;
|
|
2451
|
+
type: "elicitation.completed";
|
|
2452
|
+
data: {
|
|
2453
|
+
/**
|
|
2454
|
+
* Request ID of the resolved elicitation request; clients should dismiss any UI for this request
|
|
2455
|
+
*/
|
|
2456
|
+
requestId: string;
|
|
2457
|
+
};
|
|
2458
|
+
} | {
|
|
2459
|
+
/**
|
|
2460
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
2461
|
+
*/
|
|
2462
|
+
id: string;
|
|
2463
|
+
/**
|
|
2464
|
+
* ISO 8601 timestamp when the event was created
|
|
2465
|
+
*/
|
|
2466
|
+
timestamp: string;
|
|
2467
|
+
/**
|
|
2468
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
2469
|
+
*/
|
|
2470
|
+
parentId: string | null;
|
|
2471
|
+
ephemeral: true;
|
|
2472
|
+
type: "external_tool.requested";
|
|
2473
|
+
data: {
|
|
2474
|
+
/**
|
|
2475
|
+
* Unique identifier for this request; used to respond via session.respondToExternalTool()
|
|
2476
|
+
*/
|
|
2477
|
+
requestId: string;
|
|
2478
|
+
/**
|
|
2479
|
+
* Session ID that this external tool request belongs to
|
|
2480
|
+
*/
|
|
2481
|
+
sessionId: string;
|
|
2482
|
+
/**
|
|
2483
|
+
* Tool call ID assigned to this external tool invocation
|
|
2484
|
+
*/
|
|
2485
|
+
toolCallId: string;
|
|
2486
|
+
/**
|
|
2487
|
+
* Name of the external tool to invoke
|
|
2488
|
+
*/
|
|
2489
|
+
toolName: string;
|
|
2490
|
+
/**
|
|
2491
|
+
* Arguments to pass to the external tool
|
|
2492
|
+
*/
|
|
2493
|
+
arguments?: {
|
|
2494
|
+
[k: string]: unknown;
|
|
2495
|
+
};
|
|
2496
|
+
};
|
|
2497
|
+
} | {
|
|
2498
|
+
/**
|
|
2499
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
2500
|
+
*/
|
|
2501
|
+
id: string;
|
|
2502
|
+
/**
|
|
2503
|
+
* ISO 8601 timestamp when the event was created
|
|
2504
|
+
*/
|
|
2505
|
+
timestamp: string;
|
|
2506
|
+
/**
|
|
2507
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
2508
|
+
*/
|
|
2509
|
+
parentId: string | null;
|
|
2510
|
+
ephemeral: true;
|
|
2511
|
+
type: "external_tool.completed";
|
|
2512
|
+
data: {
|
|
2513
|
+
/**
|
|
2514
|
+
* Request ID of the resolved external tool request; clients should dismiss any UI for this request
|
|
2515
|
+
*/
|
|
2516
|
+
requestId: string;
|
|
2517
|
+
};
|
|
2518
|
+
} | {
|
|
2519
|
+
/**
|
|
2520
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
2521
|
+
*/
|
|
2522
|
+
id: string;
|
|
2523
|
+
/**
|
|
2524
|
+
* ISO 8601 timestamp when the event was created
|
|
2525
|
+
*/
|
|
2526
|
+
timestamp: string;
|
|
2527
|
+
/**
|
|
2528
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
2529
|
+
*/
|
|
2530
|
+
parentId: string | null;
|
|
2531
|
+
ephemeral: true;
|
|
2532
|
+
type: "command.queued";
|
|
2533
|
+
data: {
|
|
2534
|
+
/**
|
|
2535
|
+
* Unique identifier for this request; used to respond via session.respondToQueuedCommand()
|
|
2536
|
+
*/
|
|
2537
|
+
requestId: string;
|
|
2538
|
+
/**
|
|
2539
|
+
* The slash command text to be executed (e.g., /help, /clear)
|
|
2540
|
+
*/
|
|
2541
|
+
command: string;
|
|
2542
|
+
};
|
|
2543
|
+
} | {
|
|
2544
|
+
/**
|
|
2545
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
2546
|
+
*/
|
|
2547
|
+
id: string;
|
|
2548
|
+
/**
|
|
2549
|
+
* ISO 8601 timestamp when the event was created
|
|
2550
|
+
*/
|
|
2551
|
+
timestamp: string;
|
|
2552
|
+
/**
|
|
2553
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
2554
|
+
*/
|
|
2555
|
+
parentId: string | null;
|
|
2556
|
+
ephemeral: true;
|
|
2557
|
+
type: "command.completed";
|
|
2558
|
+
data: {
|
|
2559
|
+
/**
|
|
2560
|
+
* Request ID of the resolved command request; clients should dismiss any UI for this request
|
|
2561
|
+
*/
|
|
2562
|
+
requestId: string;
|
|
2563
|
+
};
|
|
2564
|
+
} | {
|
|
2565
|
+
/**
|
|
2566
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
2567
|
+
*/
|
|
2568
|
+
id: string;
|
|
2569
|
+
/**
|
|
2570
|
+
* ISO 8601 timestamp when the event was created
|
|
2571
|
+
*/
|
|
2572
|
+
timestamp: string;
|
|
2573
|
+
/**
|
|
2574
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
2575
|
+
*/
|
|
2576
|
+
parentId: string | null;
|
|
2577
|
+
ephemeral: true;
|
|
2578
|
+
type: "exit_plan_mode.requested";
|
|
2579
|
+
data: {
|
|
2580
|
+
/**
|
|
2581
|
+
* Unique identifier for this request; used to respond via session.respondToExitPlanMode()
|
|
2582
|
+
*/
|
|
2583
|
+
requestId: string;
|
|
2584
|
+
/**
|
|
2585
|
+
* Summary of the plan that was created
|
|
2586
|
+
*/
|
|
2587
|
+
summary: string;
|
|
2588
|
+
/**
|
|
2589
|
+
* Full content of the plan file
|
|
2590
|
+
*/
|
|
2591
|
+
planContent: string;
|
|
2592
|
+
/**
|
|
2593
|
+
* Available actions the user can take (e.g., approve, edit, reject)
|
|
2594
|
+
*/
|
|
2595
|
+
actions: string[];
|
|
2596
|
+
/**
|
|
2597
|
+
* The recommended action for the user to take
|
|
2598
|
+
*/
|
|
2599
|
+
recommendedAction: string;
|
|
2600
|
+
};
|
|
2601
|
+
} | {
|
|
2602
|
+
/**
|
|
2603
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
2604
|
+
*/
|
|
2605
|
+
id: string;
|
|
2606
|
+
/**
|
|
2607
|
+
* ISO 8601 timestamp when the event was created
|
|
2608
|
+
*/
|
|
2609
|
+
timestamp: string;
|
|
2610
|
+
/**
|
|
2611
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
2612
|
+
*/
|
|
2613
|
+
parentId: string | null;
|
|
2614
|
+
ephemeral: true;
|
|
2615
|
+
type: "exit_plan_mode.completed";
|
|
2616
|
+
data: {
|
|
2617
|
+
/**
|
|
2618
|
+
* Request ID of the resolved exit plan mode request; clients should dismiss any UI for this request
|
|
2619
|
+
*/
|
|
2620
|
+
requestId: string;
|
|
2621
|
+
};
|
|
693
2622
|
};
|