claude-code-types 0.1.0 → 0.2.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/LICENSE +21 -21
- package/README.md +59 -79
- package/index.d.ts +733 -535
- package/package.json +32 -30
package/index.d.ts
CHANGED
|
@@ -1,535 +1,733 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type definitions for Claude Code chat history JSONL files.
|
|
3
|
-
*
|
|
4
|
-
* Claude Code stores conversation history at:
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Each line is a JSON object conforming to the
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// ---------------------------------------------------------------------------
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// ---------------------------------------------------------------------------
|
|
48
|
-
//
|
|
49
|
-
// ---------------------------------------------------------------------------
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
//
|
|
311
|
-
//
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
export interface
|
|
315
|
-
type: '
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
export interface
|
|
401
|
-
type: '
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
server_tool_use
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
export interface
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
export interface
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
export type
|
|
475
|
-
|
|
|
476
|
-
|
|
|
477
|
-
|
|
|
478
|
-
|
|
|
479
|
-
|
|
|
480
|
-
|
|
481
|
-
/**
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
/**
|
|
514
|
-
*
|
|
515
|
-
*
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for Claude Code chat history JSONL files.
|
|
3
|
+
*
|
|
4
|
+
* Claude Code stores conversation history at:
|
|
5
|
+
* `~/.claude/projects/<project-slug>/<session-id>.jsonl`
|
|
6
|
+
*
|
|
7
|
+
* Each line is a JSON object conforming to the {@link TranscriptEntry} union type.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import type { TranscriptEntry } from 'claude-code-types';
|
|
12
|
+
* import { readFileSync } from 'fs';
|
|
13
|
+
*
|
|
14
|
+
* const entries: TranscriptEntry[] = readFileSync(path, 'utf-8')
|
|
15
|
+
* .split('\n')
|
|
16
|
+
* .filter(Boolean)
|
|
17
|
+
* .map(line => JSON.parse(line) as TranscriptEntry);
|
|
18
|
+
*
|
|
19
|
+
* for (const entry of entries) {
|
|
20
|
+
* switch (entry.type) {
|
|
21
|
+
* case 'user': console.log(entry.message.content); break;
|
|
22
|
+
* case 'assistant': console.log(entry.message.model); break;
|
|
23
|
+
* case 'system': console.log(entry.subtype); break;
|
|
24
|
+
* }
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @packageDocumentation
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Top-level entry union
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
|
|
35
|
+
/** Discriminated union of all JSONL line types. Switch on `entry.type` to narrow. */
|
|
36
|
+
export type TranscriptEntry =
|
|
37
|
+
| UserEntry
|
|
38
|
+
| AssistantEntry
|
|
39
|
+
| SystemEntry
|
|
40
|
+
| FileHistorySnapshotEntry
|
|
41
|
+
| PrLinkEntry
|
|
42
|
+
| ProgressEntry
|
|
43
|
+
| QueueOperationEntry
|
|
44
|
+
| SavedHookContextEntry
|
|
45
|
+
| SummaryEntry;
|
|
46
|
+
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
// Shared base fields (present on most entries that represent conversation turns)
|
|
49
|
+
// ---------------------------------------------------------------------------
|
|
50
|
+
|
|
51
|
+
interface EntryBase {
|
|
52
|
+
/** Unique identifier for this entry. */
|
|
53
|
+
uuid: string;
|
|
54
|
+
/** UUID of the parent entry in the conversation tree, or `null` for root. */
|
|
55
|
+
parentUuid: string | null;
|
|
56
|
+
/** Whether this entry is on a side-chain (branched conversation path). */
|
|
57
|
+
isSidechain: boolean;
|
|
58
|
+
sessionId: string;
|
|
59
|
+
/** ISO 8601 timestamp. */
|
|
60
|
+
timestamp: string;
|
|
61
|
+
/** Working directory at the time this entry was created. */
|
|
62
|
+
cwd: string;
|
|
63
|
+
/** Claude Code version string (e.g. `"1.0.33"`). */
|
|
64
|
+
version: string;
|
|
65
|
+
gitBranch?: string;
|
|
66
|
+
/** Project slug derived from the working directory. */
|
|
67
|
+
slug?: string;
|
|
68
|
+
teamName?: string;
|
|
69
|
+
userType: 'external';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// ---------------------------------------------------------------------------
|
|
73
|
+
// User entry
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
|
|
76
|
+
/** Human message or tool result delivered back to the model. */
|
|
77
|
+
export interface UserEntry extends EntryBase {
|
|
78
|
+
type: 'user';
|
|
79
|
+
message: UserMessage;
|
|
80
|
+
isMeta?: boolean;
|
|
81
|
+
/** When `true`, this message is a compaction summary replacing earlier history. */
|
|
82
|
+
isCompactSummary?: boolean;
|
|
83
|
+
/** When `true`, this message is shown in the transcript UI but not sent to the API. */
|
|
84
|
+
isVisibleInTranscriptOnly?: boolean;
|
|
85
|
+
imagePasteIds?: string[];
|
|
86
|
+
permissionMode?: PermissionMode;
|
|
87
|
+
planContent?: string;
|
|
88
|
+
thinkingMetadata?: ThinkingMetadata;
|
|
89
|
+
todos?: Todo[];
|
|
90
|
+
/** Present when this user message is a tool result being delivered back. */
|
|
91
|
+
toolUseResult?: unknown;
|
|
92
|
+
/** UUID of the assistant message whose tool_use triggered this result. */
|
|
93
|
+
sourceToolAssistantUUID?: string;
|
|
94
|
+
/** ID of the tool_use content block this result corresponds to. */
|
|
95
|
+
sourceToolUseID?: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** The `message` payload inside a {@link UserEntry}. */
|
|
99
|
+
export interface UserMessage {
|
|
100
|
+
role: 'user';
|
|
101
|
+
content: string | UserContentBlock[];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Content blocks that can appear in a user message. */
|
|
105
|
+
export type UserContentBlock =
|
|
106
|
+
| TextBlock
|
|
107
|
+
| ImageBlock
|
|
108
|
+
| DocumentBlock
|
|
109
|
+
| ToolResultBlock;
|
|
110
|
+
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
// Assistant entry
|
|
113
|
+
// ---------------------------------------------------------------------------
|
|
114
|
+
|
|
115
|
+
/** Model response, including text, thinking, and tool calls. */
|
|
116
|
+
export interface AssistantEntry extends EntryBase {
|
|
117
|
+
type: 'assistant';
|
|
118
|
+
message: AssistantMessage;
|
|
119
|
+
/** Anthropic API request ID for this response. */
|
|
120
|
+
requestId?: string;
|
|
121
|
+
/** Present when the API returned an error instead of a response. */
|
|
122
|
+
apiError?: unknown;
|
|
123
|
+
error?: string;
|
|
124
|
+
isApiErrorMessage?: boolean;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* The `message` payload inside an {@link AssistantEntry}.
|
|
129
|
+
*
|
|
130
|
+
* Mirrors the Anthropic Messages API response shape. Note that `stop_reason`
|
|
131
|
+
* is `null` in streaming `message_start` events and only populated in
|
|
132
|
+
* `message_delta`. Stored entries may retain the `null` from partial snapshots.
|
|
133
|
+
*/
|
|
134
|
+
export interface AssistantMessage {
|
|
135
|
+
role: 'assistant';
|
|
136
|
+
/** Anthropic message ID (e.g. `"msg_01XFDUDYJgAACzvnptvVoYEL"`). Format may change over time. */
|
|
137
|
+
id?: string;
|
|
138
|
+
type?: 'message';
|
|
139
|
+
/** Model that generated this response. See {@link Model}. */
|
|
140
|
+
model?: Model;
|
|
141
|
+
content: AssistantContentBlock[];
|
|
142
|
+
/** `null` during streaming until the final `message_delta` event. */
|
|
143
|
+
stop_reason: StopReason | null;
|
|
144
|
+
stop_sequence?: string | null;
|
|
145
|
+
usage?: Usage;
|
|
146
|
+
/**
|
|
147
|
+
* Present when the code execution tool (beta) was used. Contains `id` and
|
|
148
|
+
* `expires_at` for container reuse. Typed as `unknown` because the schema
|
|
149
|
+
* is still in beta.
|
|
150
|
+
*/
|
|
151
|
+
container?: unknown;
|
|
152
|
+
/**
|
|
153
|
+
* Present when context editing strategies were applied (beta).
|
|
154
|
+
* Contains `applied_edits` describing which tool uses or thinking turns
|
|
155
|
+
* were cleared. Typed as `unknown` because the schema is still in beta.
|
|
156
|
+
*/
|
|
157
|
+
context_management?: unknown;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** Content blocks that can appear in an assistant message. */
|
|
161
|
+
export type AssistantContentBlock =
|
|
162
|
+
| TextBlock
|
|
163
|
+
| ThinkingBlock
|
|
164
|
+
| RedactedThinkingBlock
|
|
165
|
+
| ToolUseBlock
|
|
166
|
+
| ServerToolUseBlock
|
|
167
|
+
| WebSearchToolResultBlock;
|
|
168
|
+
|
|
169
|
+
// ---------------------------------------------------------------------------
|
|
170
|
+
// System entry (multiple subtypes)
|
|
171
|
+
// ---------------------------------------------------------------------------
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Internal system events. Uses `Partial<EntryBase>` — not all base fields
|
|
175
|
+
* are guaranteed present. Switch on `subtype` to determine which optional
|
|
176
|
+
* fields are relevant:
|
|
177
|
+
*
|
|
178
|
+
* - `api_error`: `error`, `cause`, `retryAttempt`, `retryInMs`, `maxRetries`
|
|
179
|
+
* - `compact_boundary`: `compactMetadata`
|
|
180
|
+
* - `microcompact_boundary`: `microcompactMetadata`
|
|
181
|
+
* - `turn_duration`: `durationMs`
|
|
182
|
+
* - `stop_hook_summary`: `hookCount`, `hookErrors`, `hookInfos`, `hasOutput`, `stopReason`, `preventedContinuation`
|
|
183
|
+
*/
|
|
184
|
+
export interface SystemEntry extends Partial<EntryBase> {
|
|
185
|
+
type: 'system';
|
|
186
|
+
subtype: SystemSubtype;
|
|
187
|
+
isMeta?: boolean;
|
|
188
|
+
content?: string;
|
|
189
|
+
level?: string;
|
|
190
|
+
/** Milliseconds the turn took (subtype `turn_duration`). */
|
|
191
|
+
durationMs?: number;
|
|
192
|
+
/** Error message (subtype `api_error`). */
|
|
193
|
+
error?: string;
|
|
194
|
+
cause?: string;
|
|
195
|
+
retryAttempt?: number;
|
|
196
|
+
retryInMs?: number;
|
|
197
|
+
maxRetries?: number;
|
|
198
|
+
/** Subtype `compact_boundary`. */
|
|
199
|
+
compactMetadata?: CompactMetadata;
|
|
200
|
+
/** Subtype `microcompact_boundary`. */
|
|
201
|
+
microcompactMetadata?: MicrocompactMetadata;
|
|
202
|
+
/** Subtype `stop_hook_summary`. */
|
|
203
|
+
hookCount?: number;
|
|
204
|
+
hookErrors?: unknown[];
|
|
205
|
+
hookInfos?: unknown[];
|
|
206
|
+
hasOutput?: boolean;
|
|
207
|
+
stopReason?: string;
|
|
208
|
+
preventedContinuation?: boolean;
|
|
209
|
+
toolUseID?: string;
|
|
210
|
+
logicalParentUuid?: string;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** Discriminator values for {@link SystemEntry.subtype}. */
|
|
214
|
+
export type SystemSubtype =
|
|
215
|
+
| 'api_error'
|
|
216
|
+
| 'compact_boundary'
|
|
217
|
+
| 'informational'
|
|
218
|
+
| 'local_command'
|
|
219
|
+
| 'microcompact_boundary'
|
|
220
|
+
| 'stop_hook_summary'
|
|
221
|
+
| 'turn_duration';
|
|
222
|
+
|
|
223
|
+
// ---------------------------------------------------------------------------
|
|
224
|
+
// File history snapshot (undo/restore tracking)
|
|
225
|
+
// ---------------------------------------------------------------------------
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Tracks file backups for undo/restore. The `messageId` may collide with the
|
|
229
|
+
* immediately following message's `uuid`.
|
|
230
|
+
*/
|
|
231
|
+
export interface FileHistorySnapshotEntry {
|
|
232
|
+
type: 'file-history-snapshot';
|
|
233
|
+
messageId: string;
|
|
234
|
+
/** `false` for initial snapshot, `true` for incremental updates. */
|
|
235
|
+
isSnapshotUpdate: boolean;
|
|
236
|
+
snapshot: FileHistorySnapshot;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/** Snapshot of all tracked file backups at a point in time. */
|
|
240
|
+
export interface FileHistorySnapshot {
|
|
241
|
+
messageId: string;
|
|
242
|
+
timestamp: string;
|
|
243
|
+
/** Map of original file path to backup info. */
|
|
244
|
+
trackedFileBackups: Record<string, FileBackup>;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** Backup metadata for a single tracked file. */
|
|
248
|
+
export interface FileBackup {
|
|
249
|
+
backupFileName: string;
|
|
250
|
+
version: number;
|
|
251
|
+
backupTime: string;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// ---------------------------------------------------------------------------
|
|
255
|
+
// PR link
|
|
256
|
+
// ---------------------------------------------------------------------------
|
|
257
|
+
|
|
258
|
+
/** Records a pull request created or linked during the session. */
|
|
259
|
+
export interface PrLinkEntry {
|
|
260
|
+
type: 'pr-link';
|
|
261
|
+
sessionId: string;
|
|
262
|
+
timestamp: string;
|
|
263
|
+
prNumber: number;
|
|
264
|
+
prUrl: string;
|
|
265
|
+
prRepository: string;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// ---------------------------------------------------------------------------
|
|
269
|
+
// Progress (streaming updates for subagent / Task tool)
|
|
270
|
+
// ---------------------------------------------------------------------------
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Streaming updates from a subagent / Task tool invocation.
|
|
274
|
+
*
|
|
275
|
+
* **Caveat:** Progress entries can be very large (multi-MB) because they may
|
|
276
|
+
* include full `normalizedMessages` snapshots. The `parentToolUseID` may
|
|
277
|
+
* reference UUIDs that don't exist elsewhere in the file.
|
|
278
|
+
*/
|
|
279
|
+
export interface ProgressEntry extends Partial<EntryBase> {
|
|
280
|
+
type: 'progress';
|
|
281
|
+
data: ProgressData;
|
|
282
|
+
parentToolUseID?: string;
|
|
283
|
+
toolUseID?: string;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** Payload inside a {@link ProgressEntry}. */
|
|
287
|
+
export interface ProgressData {
|
|
288
|
+
message: {
|
|
289
|
+
type: 'user' | 'assistant';
|
|
290
|
+
message: UserMessage | AssistantMessage;
|
|
291
|
+
uuid?: string;
|
|
292
|
+
timestamp?: string;
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// ---------------------------------------------------------------------------
|
|
297
|
+
// Queue operation (messages typed while agent is busy)
|
|
298
|
+
// ---------------------------------------------------------------------------
|
|
299
|
+
|
|
300
|
+
/** Messages queued by the user while the agent is processing a turn. */
|
|
301
|
+
export interface QueueOperationEntry {
|
|
302
|
+
type: 'queue-operation';
|
|
303
|
+
operation: 'enqueue' | 'dequeue';
|
|
304
|
+
sessionId: string;
|
|
305
|
+
timestamp: string;
|
|
306
|
+
content: string;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// ---------------------------------------------------------------------------
|
|
310
|
+
// Saved hook context
|
|
311
|
+
// ---------------------------------------------------------------------------
|
|
312
|
+
|
|
313
|
+
/** Persisted context from a hook execution. */
|
|
314
|
+
export interface SavedHookContextEntry extends Partial<EntryBase> {
|
|
315
|
+
type: 'saved_hook_context';
|
|
316
|
+
content: string[];
|
|
317
|
+
hookEvent?: string;
|
|
318
|
+
hookName?: string;
|
|
319
|
+
toolUseID?: string;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// ---------------------------------------------------------------------------
|
|
323
|
+
// Summary
|
|
324
|
+
// ---------------------------------------------------------------------------
|
|
325
|
+
|
|
326
|
+
/** Conversation summary used for context compaction. */
|
|
327
|
+
export interface SummaryEntry {
|
|
328
|
+
type: 'summary';
|
|
329
|
+
summary: string;
|
|
330
|
+
/** UUID of the leaf message this summary covers up to. */
|
|
331
|
+
leafUuid: string;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// ---------------------------------------------------------------------------
|
|
335
|
+
// Content blocks
|
|
336
|
+
// ---------------------------------------------------------------------------
|
|
337
|
+
|
|
338
|
+
/** Plain text content block. Used in both user and assistant messages. */
|
|
339
|
+
export interface TextBlock {
|
|
340
|
+
type: 'text';
|
|
341
|
+
text: string;
|
|
342
|
+
/**
|
|
343
|
+
* Present only when the request included documents with `citations: { enabled: true }`.
|
|
344
|
+
* `cited_text` does not count toward output or input tokens.
|
|
345
|
+
*/
|
|
346
|
+
citations?: TextCitation[] | null;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Extended thinking content block.
|
|
351
|
+
*
|
|
352
|
+
* The `signature` field contains a cryptographic signature used to verify
|
|
353
|
+
* authenticity. **Modifying a thinking block will cause the API to reject it.**
|
|
354
|
+
*
|
|
355
|
+
* During tool use cycles, thinking blocks must be returned with the
|
|
356
|
+
* corresponding tool results. They can only be dropped after the full
|
|
357
|
+
* tool use cycle completes.
|
|
358
|
+
*/
|
|
359
|
+
export interface ThinkingBlock {
|
|
360
|
+
type: 'thinking';
|
|
361
|
+
thinking: string;
|
|
362
|
+
/** Cryptographic signature — do not modify. */
|
|
363
|
+
signature: string;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Redacted thinking block (content hidden by safety classifiers).
|
|
368
|
+
* The `data` field is encrypted and must be passed back to the API as-is.
|
|
369
|
+
*/
|
|
370
|
+
export interface RedactedThinkingBlock {
|
|
371
|
+
type: 'redacted_thinking';
|
|
372
|
+
data: string;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Tool invocation by the model.
|
|
377
|
+
*
|
|
378
|
+
* For Claude Code built-in tools, `name` will be a {@link BuiltinToolName}.
|
|
379
|
+
* MCP tools use the pattern `mcp__<server>__<tool>`.
|
|
380
|
+
*/
|
|
381
|
+
export interface ToolUseBlock {
|
|
382
|
+
type: 'tool_use';
|
|
383
|
+
/** Prefixed with `toolu_` (e.g. `"toolu_01A09q90qw..."`). */
|
|
384
|
+
id: string;
|
|
385
|
+
name: BuiltinToolName | (string & {});
|
|
386
|
+
input: Record<string, unknown>;
|
|
387
|
+
/** Present in progress/streaming entries only — not part of the Anthropic API. */
|
|
388
|
+
caller?: { type: string };
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/** Tool result delivered in a user message. */
|
|
392
|
+
export interface ToolResultBlock {
|
|
393
|
+
type: 'tool_result';
|
|
394
|
+
tool_use_id: string;
|
|
395
|
+
content?: string | TextBlock[];
|
|
396
|
+
is_error?: boolean;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/** Image content block in a user message. */
|
|
400
|
+
export interface ImageBlock {
|
|
401
|
+
type: 'image';
|
|
402
|
+
source: Base64ImageSource | UrlImageSource;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/** Document content block in a user message (PDF, plain text, or URL). */
|
|
406
|
+
export interface DocumentBlock {
|
|
407
|
+
type: 'document';
|
|
408
|
+
source: Base64DocumentSource | PlainTextSource | UrlDocumentSource;
|
|
409
|
+
title?: string | null;
|
|
410
|
+
context?: string | null;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Server-side tool invocation (executed by the Anthropic API, not locally).
|
|
415
|
+
* Currently limited to web search.
|
|
416
|
+
*/
|
|
417
|
+
export interface ServerToolUseBlock {
|
|
418
|
+
type: 'server_tool_use';
|
|
419
|
+
/** Prefixed with `srvtoolu_` (e.g. `"srvtoolu_01B3C4D5..."`). */
|
|
420
|
+
id: string;
|
|
421
|
+
name: 'web_search';
|
|
422
|
+
input: Record<string, unknown>;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/** Result from a server-side web search tool invocation. */
|
|
426
|
+
export interface WebSearchToolResultBlock {
|
|
427
|
+
type: 'web_search_tool_result';
|
|
428
|
+
tool_use_id: string;
|
|
429
|
+
content: WebSearchResultError | WebSearchResultItem[];
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
// ---------------------------------------------------------------------------
|
|
433
|
+
// Media sources
|
|
434
|
+
// ---------------------------------------------------------------------------
|
|
435
|
+
|
|
436
|
+
/** Base64-encoded image source. */
|
|
437
|
+
export interface Base64ImageSource {
|
|
438
|
+
type: 'base64';
|
|
439
|
+
media_type: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp';
|
|
440
|
+
data: string;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/** URL-referenced image source. */
|
|
444
|
+
export interface UrlImageSource {
|
|
445
|
+
type: 'url';
|
|
446
|
+
url: string;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/** Base64-encoded PDF document source. */
|
|
450
|
+
export interface Base64DocumentSource {
|
|
451
|
+
type: 'base64';
|
|
452
|
+
media_type: 'application/pdf';
|
|
453
|
+
data: string;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/** Plain text document source. */
|
|
457
|
+
export interface PlainTextSource {
|
|
458
|
+
type: 'text';
|
|
459
|
+
media_type: 'text/plain';
|
|
460
|
+
data: string;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/** URL-referenced document source. */
|
|
464
|
+
export interface UrlDocumentSource {
|
|
465
|
+
type: 'url';
|
|
466
|
+
url: string;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// ---------------------------------------------------------------------------
|
|
470
|
+
// Citations
|
|
471
|
+
// ---------------------------------------------------------------------------
|
|
472
|
+
|
|
473
|
+
/** Discriminated union of all citation location types. */
|
|
474
|
+
export type TextCitation =
|
|
475
|
+
| CitationCharLocation
|
|
476
|
+
| CitationPageLocation
|
|
477
|
+
| CitationContentBlockLocation
|
|
478
|
+
| CitationWebSearchResultLocation
|
|
479
|
+
| CitationSearchResultLocation;
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* Citation from a plain text document.
|
|
483
|
+
* Character indices are 0-based; `end_char_index` is exclusive.
|
|
484
|
+
*/
|
|
485
|
+
export interface CitationCharLocation {
|
|
486
|
+
type: 'char_location';
|
|
487
|
+
cited_text: string;
|
|
488
|
+
document_index: number;
|
|
489
|
+
document_title: string | null;
|
|
490
|
+
start_char_index: number;
|
|
491
|
+
/** Exclusive upper bound. */
|
|
492
|
+
end_char_index: number;
|
|
493
|
+
/** Non-null only when the document was provided via the Files API. */
|
|
494
|
+
file_id: string | null;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Citation from a PDF document.
|
|
499
|
+
* Page numbers are 1-based; `end_page_number` is exclusive.
|
|
500
|
+
*/
|
|
501
|
+
export interface CitationPageLocation {
|
|
502
|
+
type: 'page_location';
|
|
503
|
+
cited_text: string;
|
|
504
|
+
document_index: number;
|
|
505
|
+
document_title: string | null;
|
|
506
|
+
start_page_number: number;
|
|
507
|
+
/** Exclusive upper bound. */
|
|
508
|
+
end_page_number: number;
|
|
509
|
+
/** Non-null only when the document was provided via the Files API. */
|
|
510
|
+
file_id: string | null;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Citation from a custom content document.
|
|
515
|
+
* Block indices are 0-based; `end_block_index` is exclusive.
|
|
516
|
+
*/
|
|
517
|
+
export interface CitationContentBlockLocation {
|
|
518
|
+
type: 'content_block_location';
|
|
519
|
+
cited_text: string;
|
|
520
|
+
document_index: number;
|
|
521
|
+
document_title: string | null;
|
|
522
|
+
start_block_index: number;
|
|
523
|
+
/** Exclusive upper bound. */
|
|
524
|
+
end_block_index: number;
|
|
525
|
+
/** Non-null only when the document was provided via the Files API. */
|
|
526
|
+
file_id: string | null;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/** Citation from a web search result. */
|
|
530
|
+
export interface CitationWebSearchResultLocation {
|
|
531
|
+
type: 'web_search_result_location';
|
|
532
|
+
cited_text: string;
|
|
533
|
+
encrypted_index: string;
|
|
534
|
+
title: string | null;
|
|
535
|
+
url: string;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Citation from a `search_result` content block (RAG applications).
|
|
540
|
+
* Block indices are 0-based; `end_block_index` is exclusive.
|
|
541
|
+
*/
|
|
542
|
+
export interface CitationSearchResultLocation {
|
|
543
|
+
type: 'search_result_location';
|
|
544
|
+
cited_text: string;
|
|
545
|
+
source: string;
|
|
546
|
+
title: string | null;
|
|
547
|
+
search_result_index: number;
|
|
548
|
+
start_block_index: number;
|
|
549
|
+
/** Exclusive upper bound. */
|
|
550
|
+
end_block_index: number;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
// ---------------------------------------------------------------------------
|
|
554
|
+
// Web search results
|
|
555
|
+
// ---------------------------------------------------------------------------
|
|
556
|
+
|
|
557
|
+
/** Error returned by the server-side web search tool. */
|
|
558
|
+
export interface WebSearchResultError {
|
|
559
|
+
type: 'web_search_error';
|
|
560
|
+
error_code: string;
|
|
561
|
+
message: string;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/** A single web search result item. */
|
|
565
|
+
export interface WebSearchResultItem {
|
|
566
|
+
type: 'web_search_result';
|
|
567
|
+
url: string;
|
|
568
|
+
title: string;
|
|
569
|
+
encrypted_content: string;
|
|
570
|
+
page_age?: string | null;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
// ---------------------------------------------------------------------------
|
|
574
|
+
// Usage & metadata
|
|
575
|
+
// ---------------------------------------------------------------------------
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* Token usage for a single API response.
|
|
579
|
+
*
|
|
580
|
+
* **Total billable input tokens** = `input_tokens + cache_creation_input_tokens + cache_read_input_tokens`.
|
|
581
|
+
*
|
|
582
|
+
* **Caveat:** `cache_read_input_tokens` can be inflated when server tools
|
|
583
|
+
* (e.g. web search) are used, because the API accumulates cache reads from
|
|
584
|
+
* multiple internal calls.
|
|
585
|
+
*/
|
|
586
|
+
export interface Usage {
|
|
587
|
+
input_tokens: number;
|
|
588
|
+
output_tokens: number;
|
|
589
|
+
/** Tokens written to cache. `0` when prompt caching is not configured. */
|
|
590
|
+
cache_creation_input_tokens?: number | null;
|
|
591
|
+
/** Tokens read from cache. `0` when prompt caching is not configured. */
|
|
592
|
+
cache_read_input_tokens?: number | null;
|
|
593
|
+
/** Breakdown of cache creation by TTL. */
|
|
594
|
+
cache_creation?: CacheCreation | null;
|
|
595
|
+
/** Present only when web search was used. */
|
|
596
|
+
server_tool_use?: ServerToolUsage | null;
|
|
597
|
+
service_tier?: 'standard' | 'priority' | 'batch' | null;
|
|
598
|
+
/** Geographic region where inference ran (e.g. `"us-west-2"`). */
|
|
599
|
+
inference_geo?: string | null;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/** Cache creation breakdown by TTL tier. */
|
|
603
|
+
export interface CacheCreation {
|
|
604
|
+
ephemeral_5m_input_tokens: number;
|
|
605
|
+
ephemeral_1h_input_tokens: number;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/** Server-side tool usage counters. */
|
|
609
|
+
export interface ServerToolUsage {
|
|
610
|
+
web_search_requests: number;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/** Metadata emitted with `compact_boundary` system entries. */
|
|
614
|
+
export interface CompactMetadata {
|
|
615
|
+
trigger: 'auto' | 'manual';
|
|
616
|
+
/** Token count before compaction. */
|
|
617
|
+
preTokens: number;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
/** Metadata emitted with `microcompact_boundary` system entries. */
|
|
621
|
+
export interface MicrocompactMetadata {
|
|
622
|
+
trigger: 'auto' | 'manual';
|
|
623
|
+
/** Token count before compaction. */
|
|
624
|
+
preTokens: number;
|
|
625
|
+
tokensSaved: number;
|
|
626
|
+
compactedToolIds: string[];
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
/** Configuration for extended thinking budget. */
|
|
630
|
+
export interface ThinkingMetadata {
|
|
631
|
+
maxThinkingTokens: number;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
/** A todo item tracked in the Claude Code task list. */
|
|
635
|
+
export interface Todo {
|
|
636
|
+
content: string;
|
|
637
|
+
status: string;
|
|
638
|
+
/** Present continuous form shown in the spinner (e.g. `"Running tests"`). */
|
|
639
|
+
activeForm?: string;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
// ---------------------------------------------------------------------------
|
|
643
|
+
// Enums / unions
|
|
644
|
+
// ---------------------------------------------------------------------------
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* Anthropic model identifiers. This list is non-exhaustive — Anthropic
|
|
648
|
+
* regularly adds new model IDs. Some models have aliases that resolve to the
|
|
649
|
+
* same underlying model (e.g. `"claude-sonnet-4-0"` and `"claude-sonnet-4-20250514"`).
|
|
650
|
+
*
|
|
651
|
+
* The `"<synthetic>"` value is specific to Claude Code for locally-generated messages.
|
|
652
|
+
*/
|
|
653
|
+
export type Model =
|
|
654
|
+
| 'claude-opus-4-6'
|
|
655
|
+
| 'claude-opus-4-5-20251101'
|
|
656
|
+
| 'claude-sonnet-4-5-20250929'
|
|
657
|
+
| 'claude-haiku-4-5-20251001'
|
|
658
|
+
| '<synthetic>'
|
|
659
|
+
| (string & {});
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Reason the model stopped generating.
|
|
663
|
+
*
|
|
664
|
+
* - `end_turn` — Natural stopping point. May have empty `content` array.
|
|
665
|
+
* - `max_tokens` — Hit `max_tokens` limit or the model's maximum.
|
|
666
|
+
* - `stop_sequence` — Generated one of the provided `stop_sequences`.
|
|
667
|
+
* - `tool_use` — Model invoked one or more tools.
|
|
668
|
+
* - `pause_turn` — Server-side sampling loop hit its iteration limit while executing server tools; pass the response back as-is to continue.
|
|
669
|
+
* - `refusal` — Streaming classifiers intervened for potential policy violation.
|
|
670
|
+
*/
|
|
671
|
+
export type StopReason =
|
|
672
|
+
| 'end_turn'
|
|
673
|
+
| 'max_tokens'
|
|
674
|
+
| 'stop_sequence'
|
|
675
|
+
| 'tool_use'
|
|
676
|
+
| 'pause_turn'
|
|
677
|
+
| 'refusal';
|
|
678
|
+
|
|
679
|
+
/** Claude Code permission mode set by the user. */
|
|
680
|
+
export type PermissionMode =
|
|
681
|
+
| 'default'
|
|
682
|
+
| 'plan'
|
|
683
|
+
| 'acceptEdits'
|
|
684
|
+
| 'dontAsk'
|
|
685
|
+
| 'bypassPermissions';
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* Built-in Claude Code tools. This list is non-exhaustive and may change
|
|
689
|
+
* between Claude Code versions. MCP tools use the `mcp__<server>__<tool>` pattern.
|
|
690
|
+
*/
|
|
691
|
+
export type BuiltinToolName =
|
|
692
|
+
| 'AskUserQuestion'
|
|
693
|
+
| 'Bash'
|
|
694
|
+
| 'Edit'
|
|
695
|
+
| 'EnterPlanMode'
|
|
696
|
+
| 'ExitPlanMode'
|
|
697
|
+
| 'Glob'
|
|
698
|
+
| 'Grep'
|
|
699
|
+
| 'KillShell'
|
|
700
|
+
| 'ListMcpResourcesTool'
|
|
701
|
+
| 'NotebookEdit'
|
|
702
|
+
| 'Read'
|
|
703
|
+
| 'ReadMcpResourceTool'
|
|
704
|
+
| 'SendMessage'
|
|
705
|
+
| 'Skill'
|
|
706
|
+
| 'Task'
|
|
707
|
+
| 'TaskCreate'
|
|
708
|
+
| 'TaskGet'
|
|
709
|
+
| 'TaskList'
|
|
710
|
+
| 'TaskOutput'
|
|
711
|
+
| 'TaskStop'
|
|
712
|
+
| 'TaskUpdate'
|
|
713
|
+
| 'TodoWrite'
|
|
714
|
+
| 'WebFetch'
|
|
715
|
+
| 'WebSearch'
|
|
716
|
+
| 'Write';
|
|
717
|
+
|
|
718
|
+
// ---------------------------------------------------------------------------
|
|
719
|
+
// Parser helper type
|
|
720
|
+
// ---------------------------------------------------------------------------
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* Signature for a function that parses a single JSONL line into a typed entry.
|
|
724
|
+
*
|
|
725
|
+
* @example
|
|
726
|
+
* ```ts
|
|
727
|
+
* const parseLine: ParseLine = (line) => {
|
|
728
|
+
* try { return JSON.parse(line) as TranscriptEntry; }
|
|
729
|
+
* catch { return null; }
|
|
730
|
+
* };
|
|
731
|
+
* ```
|
|
732
|
+
*/
|
|
733
|
+
export type ParseLine = (line: string) => TranscriptEntry | null;
|