@github/copilot-sdk 0.1.33-unstable.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.
@@ -20,6 +20,9 @@ export type SessionEvent = {
20
20
  */
21
21
  ephemeral?: boolean;
22
22
  type: "session.start";
23
+ /**
24
+ * Session initialization metadata including context and configuration
25
+ */
23
26
  data: {
24
27
  /**
25
28
  * Unique identifier for the session
@@ -45,6 +48,10 @@ export type SessionEvent = {
45
48
  * Model selected at session creation time, if any
46
49
  */
47
50
  selectedModel?: string;
51
+ /**
52
+ * Reasoning effort level used for model calls, if applicable (e.g. "low", "medium", "high", "xhigh")
53
+ */
54
+ reasoningEffort?: string;
48
55
  /**
49
56
  * Working directory and git context at session start
50
57
  */
@@ -58,14 +65,29 @@ export type SessionEvent = {
58
65
  */
59
66
  gitRoot?: string;
60
67
  /**
61
- * Repository identifier in "owner/name" format, derived from the git remote URL
68
+ * Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps)
62
69
  */
63
70
  repository?: string;
71
+ /**
72
+ * Hosting platform type of the repository (github or ado)
73
+ */
74
+ hostType?: "github" | "ado";
64
75
  /**
65
76
  * Current git branch name
66
77
  */
67
78
  branch?: string;
79
+ /**
80
+ * Head commit of current git branch at session start time
81
+ */
82
+ headCommit?: string;
83
+ /**
84
+ * Base commit of current git branch at session start time
85
+ */
86
+ baseCommit?: string;
68
87
  };
88
+ /**
89
+ * Whether the session was already in use by another client at start time
90
+ */
69
91
  alreadyInUse?: boolean;
70
92
  };
71
93
  } | {
@@ -86,6 +108,9 @@ export type SessionEvent = {
86
108
  */
87
109
  ephemeral?: boolean;
88
110
  type: "session.resume";
111
+ /**
112
+ * Session resume metadata including current context and event count
113
+ */
89
114
  data: {
90
115
  /**
91
116
  * ISO 8601 timestamp when the session was resumed
@@ -95,6 +120,14 @@ export type SessionEvent = {
95
120
  * Total number of persisted events in the session at the time of resume
96
121
  */
97
122
  eventCount: number;
123
+ /**
124
+ * Model currently selected at resume time
125
+ */
126
+ selectedModel?: string;
127
+ /**
128
+ * Reasoning effort level used for model calls, if applicable (e.g. "low", "medium", "high", "xhigh")
129
+ */
130
+ reasoningEffort?: string;
98
131
  /**
99
132
  * Updated working directory and git context at resume time
100
133
  */
@@ -108,14 +141,29 @@ export type SessionEvent = {
108
141
  */
109
142
  gitRoot?: string;
110
143
  /**
111
- * Repository identifier in "owner/name" format, derived from the git remote URL
144
+ * Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps)
112
145
  */
113
146
  repository?: string;
147
+ /**
148
+ * Hosting platform type of the repository (github or ado)
149
+ */
150
+ hostType?: "github" | "ado";
114
151
  /**
115
152
  * Current git branch name
116
153
  */
117
154
  branch?: string;
155
+ /**
156
+ * Head commit of current git branch at session start time
157
+ */
158
+ headCommit?: string;
159
+ /**
160
+ * Base commit of current git branch at session start time
161
+ */
162
+ baseCommit?: string;
118
163
  };
164
+ /**
165
+ * Whether the session was already in use by another client at resume time
166
+ */
119
167
  alreadyInUse?: boolean;
120
168
  };
121
169
  } | {
@@ -136,6 +184,9 @@ export type SessionEvent = {
136
184
  */
137
185
  ephemeral?: boolean;
138
186
  type: "session.error";
187
+ /**
188
+ * Error details for timeline display including message and optional diagnostic information
189
+ */
139
190
  data: {
140
191
  /**
141
192
  * Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "query")
@@ -157,6 +208,10 @@ export type SessionEvent = {
157
208
  * GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs
158
209
  */
159
210
  providerCallId?: string;
211
+ /**
212
+ * Optional URL associated with this error that the user can open in a browser
213
+ */
214
+ url?: string;
160
215
  };
161
216
  } | {
162
217
  /**
@@ -228,6 +283,9 @@ export type SessionEvent = {
228
283
  parentId: string | null;
229
284
  ephemeral: true;
230
285
  type: "session.title_changed";
286
+ /**
287
+ * Session title change payload containing the new display title
288
+ */
231
289
  data: {
232
290
  /**
233
291
  * The new display title for the session
@@ -252,6 +310,9 @@ export type SessionEvent = {
252
310
  */
253
311
  ephemeral?: boolean;
254
312
  type: "session.info";
313
+ /**
314
+ * Informational message for timeline display with categorization
315
+ */
255
316
  data: {
256
317
  /**
257
318
  * Category of informational message (e.g., "notification", "timing", "context_window", "mcp", "snapshot", "configuration", "authentication", "model")
@@ -261,6 +322,10 @@ export type SessionEvent = {
261
322
  * Human-readable informational message for display in the timeline
262
323
  */
263
324
  message: string;
325
+ /**
326
+ * Optional URL associated with this message that the user can open in a browser
327
+ */
328
+ url?: string;
264
329
  };
265
330
  } | {
266
331
  /**
@@ -280,6 +345,9 @@ export type SessionEvent = {
280
345
  */
281
346
  ephemeral?: boolean;
282
347
  type: "session.warning";
348
+ /**
349
+ * Warning message for timeline display with categorization
350
+ */
283
351
  data: {
284
352
  /**
285
353
  * Category of warning (e.g., "subscription", "policy", "mcp")
@@ -289,6 +357,10 @@ export type SessionEvent = {
289
357
  * Human-readable warning message for display in the timeline
290
358
  */
291
359
  message: string;
360
+ /**
361
+ * Optional URL associated with this warning that the user can open in a browser
362
+ */
363
+ url?: string;
292
364
  };
293
365
  } | {
294
366
  /**
@@ -308,6 +380,9 @@ export type SessionEvent = {
308
380
  */
309
381
  ephemeral?: boolean;
310
382
  type: "session.model_change";
383
+ /**
384
+ * Model change details including previous and new model identifiers
385
+ */
311
386
  data: {
312
387
  /**
313
388
  * Model that was previously selected, if any
@@ -317,6 +392,14 @@ export type SessionEvent = {
317
392
  * Newly selected model identifier
318
393
  */
319
394
  newModel: string;
395
+ /**
396
+ * Reasoning effort level before the model change, if applicable
397
+ */
398
+ previousReasoningEffort?: string;
399
+ /**
400
+ * Reasoning effort level after the model change, if applicable
401
+ */
402
+ reasoningEffort?: string;
320
403
  };
321
404
  } | {
322
405
  /**
@@ -336,6 +419,9 @@ export type SessionEvent = {
336
419
  */
337
420
  ephemeral?: boolean;
338
421
  type: "session.mode_changed";
422
+ /**
423
+ * Agent mode change details including previous and new modes
424
+ */
339
425
  data: {
340
426
  /**
341
427
  * Agent mode before the change (e.g., "interactive", "plan", "autopilot")
@@ -364,6 +450,9 @@ export type SessionEvent = {
364
450
  */
365
451
  ephemeral?: boolean;
366
452
  type: "session.plan_changed";
453
+ /**
454
+ * Plan file operation details indicating what changed
455
+ */
367
456
  data: {
368
457
  /**
369
458
  * The type of operation performed on the plan file
@@ -388,6 +477,9 @@ export type SessionEvent = {
388
477
  */
389
478
  ephemeral?: boolean;
390
479
  type: "session.workspace_file_changed";
480
+ /**
481
+ * Workspace file change details including path and operation type
482
+ */
391
483
  data: {
392
484
  /**
393
485
  * Relative path within the session workspace files directory
@@ -416,6 +508,9 @@ export type SessionEvent = {
416
508
  */
417
509
  ephemeral?: boolean;
418
510
  type: "session.handoff";
511
+ /**
512
+ * Session handoff metadata including source, context, and repository information
513
+ */
419
514
  data: {
420
515
  /**
421
516
  * ISO 8601 timestamp when the handoff occurred
@@ -454,6 +549,10 @@ export type SessionEvent = {
454
549
  * Session ID of the remote session being handed off
455
550
  */
456
551
  remoteSessionId?: string;
552
+ /**
553
+ * GitHub host URL for the source session (e.g., https://github.com or https://tenant.ghe.com)
554
+ */
555
+ host?: string;
457
556
  };
458
557
  } | {
459
558
  /**
@@ -473,6 +572,9 @@ export type SessionEvent = {
473
572
  */
474
573
  ephemeral?: boolean;
475
574
  type: "session.truncation";
575
+ /**
576
+ * Conversation truncation statistics including token counts and removed content metrics
577
+ */
476
578
  data: {
477
579
  /**
478
580
  * Maximum token count for the model's context window
@@ -522,6 +624,9 @@ export type SessionEvent = {
522
624
  parentId: string | null;
523
625
  ephemeral: true;
524
626
  type: "session.snapshot_rewind";
627
+ /**
628
+ * Session rewind details including target event and count of removed events
629
+ */
525
630
  data: {
526
631
  /**
527
632
  * Event ID that was rewound to; all events after this one were removed
@@ -550,6 +655,9 @@ export type SessionEvent = {
550
655
  */
551
656
  ephemeral?: boolean;
552
657
  type: "session.shutdown";
658
+ /**
659
+ * Session termination metrics including usage statistics, code changes, and shutdown reason
660
+ */
553
661
  data: {
554
662
  /**
555
663
  * Whether the session ended normally ("routine") or due to a crash/fatal error ("error")
@@ -633,6 +741,22 @@ export type SessionEvent = {
633
741
  * Model that was selected at the time of shutdown
634
742
  */
635
743
  currentModel?: string;
744
+ /**
745
+ * Total tokens in context window at shutdown
746
+ */
747
+ currentTokens?: number;
748
+ /**
749
+ * System message token count at shutdown
750
+ */
751
+ systemTokens?: number;
752
+ /**
753
+ * Non-system message token count at shutdown
754
+ */
755
+ conversationTokens?: number;
756
+ /**
757
+ * Tool definitions token count at shutdown
758
+ */
759
+ toolDefinitionsTokens?: number;
636
760
  };
637
761
  } | {
638
762
  /**
@@ -652,6 +776,9 @@ export type SessionEvent = {
652
776
  */
653
777
  ephemeral?: boolean;
654
778
  type: "session.context_changed";
779
+ /**
780
+ * Updated working directory and git context after the change
781
+ */
655
782
  data: {
656
783
  /**
657
784
  * Current working directory path
@@ -662,13 +789,25 @@ export type SessionEvent = {
662
789
  */
663
790
  gitRoot?: string;
664
791
  /**
665
- * Repository identifier in "owner/name" format, derived from the git remote URL
792
+ * Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps)
666
793
  */
667
794
  repository?: string;
795
+ /**
796
+ * Hosting platform type of the repository (github or ado)
797
+ */
798
+ hostType?: "github" | "ado";
668
799
  /**
669
800
  * Current git branch name
670
801
  */
671
802
  branch?: string;
803
+ /**
804
+ * Head commit of current git branch at session start time
805
+ */
806
+ headCommit?: string;
807
+ /**
808
+ * Base commit of current git branch at session start time
809
+ */
810
+ baseCommit?: string;
672
811
  };
673
812
  } | {
674
813
  /**
@@ -685,6 +824,9 @@ export type SessionEvent = {
685
824
  parentId: string | null;
686
825
  ephemeral: true;
687
826
  type: "session.usage_info";
827
+ /**
828
+ * Current context window usage statistics including token and message counts
829
+ */
688
830
  data: {
689
831
  /**
690
832
  * Maximum token count for the model's context window
@@ -698,6 +840,22 @@ export type SessionEvent = {
698
840
  * Current number of messages in the conversation
699
841
  */
700
842
  messagesLength: number;
843
+ /**
844
+ * Token count from system message(s)
845
+ */
846
+ systemTokens?: number;
847
+ /**
848
+ * Token count from non-system messages (user, assistant, tool)
849
+ */
850
+ conversationTokens?: number;
851
+ /**
852
+ * Token count from tool definitions
853
+ */
854
+ toolDefinitionsTokens?: number;
855
+ /**
856
+ * Whether this is the first usage_info event emitted in this session
857
+ */
858
+ isInitial?: boolean;
701
859
  };
702
860
  } | {
703
861
  /**
@@ -718,9 +876,22 @@ export type SessionEvent = {
718
876
  ephemeral?: boolean;
719
877
  type: "session.compaction_start";
720
878
  /**
721
- * Empty payload; the event signals that LLM-powered conversation compaction has begun
879
+ * Context window breakdown at the start of LLM-powered conversation compaction
722
880
  */
723
- data: {};
881
+ data: {
882
+ /**
883
+ * Token count from system message(s) at compaction start
884
+ */
885
+ systemTokens?: number;
886
+ /**
887
+ * Token count from non-system messages (user, assistant, tool) at compaction start
888
+ */
889
+ conversationTokens?: number;
890
+ /**
891
+ * Token count from tool definitions at compaction start
892
+ */
893
+ toolDefinitionsTokens?: number;
894
+ };
724
895
  } | {
725
896
  /**
726
897
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -739,6 +910,9 @@ export type SessionEvent = {
739
910
  */
740
911
  ephemeral?: boolean;
741
912
  type: "session.compaction_complete";
913
+ /**
914
+ * Conversation compaction results including success status, metrics, and optional error details
915
+ */
742
916
  data: {
743
917
  /**
744
918
  * Whether compaction completed successfully
@@ -801,6 +975,18 @@ export type SessionEvent = {
801
975
  * GitHub request tracing ID (x-github-request-id header) for the compaction LLM call
802
976
  */
803
977
  requestId?: string;
978
+ /**
979
+ * Token count from system message(s) after compaction
980
+ */
981
+ systemTokens?: number;
982
+ /**
983
+ * Token count from non-system messages (user, assistant, tool) after compaction
984
+ */
985
+ conversationTokens?: number;
986
+ /**
987
+ * Token count from tool definitions after compaction
988
+ */
989
+ toolDefinitionsTokens?: number;
804
990
  };
805
991
  } | {
806
992
  /**
@@ -820,11 +1006,18 @@ export type SessionEvent = {
820
1006
  */
821
1007
  ephemeral?: boolean;
822
1008
  type: "session.task_complete";
1009
+ /**
1010
+ * Task completion notification with summary from the agent
1011
+ */
823
1012
  data: {
824
1013
  /**
825
- * Optional summary of the completed task, provided by the agent
1014
+ * Summary of the completed task, provided by the agent
826
1015
  */
827
1016
  summary?: string;
1017
+ /**
1018
+ * Whether the tool call succeeded. False when validation failed (e.g., invalid arguments)
1019
+ */
1020
+ success?: boolean;
828
1021
  };
829
1022
  } | {
830
1023
  /**
@@ -857,9 +1050,12 @@ export type SessionEvent = {
857
1050
  * Files, selections, or GitHub references attached to the message
858
1051
  */
859
1052
  attachments?: ({
1053
+ /**
1054
+ * Attachment type discriminator
1055
+ */
860
1056
  type: "file";
861
1057
  /**
862
- * Absolute file or directory path
1058
+ * Absolute file path
863
1059
  */
864
1060
  path: string;
865
1061
  /**
@@ -880,28 +1076,18 @@ export type SessionEvent = {
880
1076
  end: number;
881
1077
  };
882
1078
  } | {
1079
+ /**
1080
+ * Attachment type discriminator
1081
+ */
883
1082
  type: "directory";
884
1083
  /**
885
- * Absolute file or directory path
1084
+ * Absolute directory path
886
1085
  */
887
1086
  path: string;
888
1087
  /**
889
1088
  * User-facing display name for the attachment
890
1089
  */
891
1090
  displayName: string;
892
- /**
893
- * Optional line range to scope the attachment to a specific section of the file
894
- */
895
- lineRange?: {
896
- /**
897
- * Start line number (1-based)
898
- */
899
- start: number;
900
- /**
901
- * End line number (1-based, inclusive)
902
- */
903
- end: number;
904
- };
905
1091
  } | {
906
1092
  /**
907
1093
  * Attachment type discriminator
@@ -923,6 +1109,9 @@ export type SessionEvent = {
923
1109
  * Position range of the selection within the file
924
1110
  */
925
1111
  selection: {
1112
+ /**
1113
+ * Start position of the selection
1114
+ */
926
1115
  start: {
927
1116
  /**
928
1117
  * Start line number (0-based)
@@ -933,6 +1122,9 @@ export type SessionEvent = {
933
1122
  */
934
1123
  character: number;
935
1124
  };
1125
+ /**
1126
+ * End position of the selection
1127
+ */
936
1128
  end: {
937
1129
  /**
938
1130
  * End line number (0-based)
@@ -969,6 +1161,23 @@ export type SessionEvent = {
969
1161
  * URL to the referenced item on GitHub
970
1162
  */
971
1163
  url: string;
1164
+ } | {
1165
+ /**
1166
+ * Attachment type discriminator
1167
+ */
1168
+ type: "blob";
1169
+ /**
1170
+ * Base64-encoded content
1171
+ */
1172
+ data: string;
1173
+ /**
1174
+ * MIME type of the inline data
1175
+ */
1176
+ mimeType: string;
1177
+ /**
1178
+ * User-facing display name for the attachment
1179
+ */
1180
+ displayName?: string;
972
1181
  })[];
973
1182
  /**
974
1183
  * Origin of this message, used for timeline filtering (e.g., "skill-pdf" for skill-injected messages that should be hidden from the user)
@@ -1020,6 +1229,9 @@ export type SessionEvent = {
1020
1229
  */
1021
1230
  ephemeral?: boolean;
1022
1231
  type: "assistant.turn_start";
1232
+ /**
1233
+ * Turn initialization metadata including identifier and interaction tracking
1234
+ */
1023
1235
  data: {
1024
1236
  /**
1025
1237
  * Identifier for this turn within the agentic loop, typically a stringified turn number
@@ -1045,6 +1257,9 @@ export type SessionEvent = {
1045
1257
  parentId: string | null;
1046
1258
  ephemeral: true;
1047
1259
  type: "assistant.intent";
1260
+ /**
1261
+ * Agent intent description for current activity or plan
1262
+ */
1048
1263
  data: {
1049
1264
  /**
1050
1265
  * Short description of what the agent is currently doing or planning to do
@@ -1069,6 +1284,9 @@ export type SessionEvent = {
1069
1284
  */
1070
1285
  ephemeral?: boolean;
1071
1286
  type: "assistant.reasoning";
1287
+ /**
1288
+ * Assistant reasoning content for timeline display with complete thinking text
1289
+ */
1072
1290
  data: {
1073
1291
  /**
1074
1292
  * Unique identifier for this reasoning block
@@ -1094,6 +1312,9 @@ export type SessionEvent = {
1094
1312
  parentId: string | null;
1095
1313
  ephemeral: true;
1096
1314
  type: "assistant.reasoning_delta";
1315
+ /**
1316
+ * Streaming reasoning delta for incremental extended thinking updates
1317
+ */
1097
1318
  data: {
1098
1319
  /**
1099
1320
  * Reasoning block ID this delta belongs to, matching the corresponding assistant.reasoning event
@@ -1119,6 +1340,9 @@ export type SessionEvent = {
1119
1340
  parentId: string | null;
1120
1341
  ephemeral: true;
1121
1342
  type: "assistant.streaming_delta";
1343
+ /**
1344
+ * Streaming response progress with cumulative byte count
1345
+ */
1122
1346
  data: {
1123
1347
  /**
1124
1348
  * Cumulative total bytes received from the streaming response so far
@@ -1143,6 +1367,9 @@ export type SessionEvent = {
1143
1367
  */
1144
1368
  ephemeral?: boolean;
1145
1369
  type: "assistant.message";
1370
+ /**
1371
+ * Assistant response containing text content, optional tool requests, and interaction metadata
1372
+ */
1146
1373
  data: {
1147
1374
  /**
1148
1375
  * Unique identifier for this assistant message
@@ -1174,6 +1401,14 @@ export type SessionEvent = {
1174
1401
  * Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent.
1175
1402
  */
1176
1403
  type?: "function" | "custom";
1404
+ /**
1405
+ * Human-readable display title for the tool
1406
+ */
1407
+ toolTitle?: string;
1408
+ /**
1409
+ * Resolved intention summary describing what this specific call does
1410
+ */
1411
+ intentionSummary?: string | null;
1177
1412
  }[];
1178
1413
  /**
1179
1414
  * Opaque/encrypted extended thinking data from Anthropic models. Session-bound and stripped on resume.
@@ -1219,6 +1454,9 @@ export type SessionEvent = {
1219
1454
  parentId: string | null;
1220
1455
  ephemeral: true;
1221
1456
  type: "assistant.message_delta";
1457
+ /**
1458
+ * Streaming assistant message delta for incremental response updates
1459
+ */
1222
1460
  data: {
1223
1461
  /**
1224
1462
  * Message ID this delta belongs to, matching the corresponding assistant.message event
@@ -1251,6 +1489,9 @@ export type SessionEvent = {
1251
1489
  */
1252
1490
  ephemeral?: boolean;
1253
1491
  type: "assistant.turn_end";
1492
+ /**
1493
+ * Turn completion metadata including the turn identifier
1494
+ */
1254
1495
  data: {
1255
1496
  /**
1256
1497
  * Identifier of the turn that has ended, matching the corresponding assistant.turn_start event
@@ -1272,6 +1513,9 @@ export type SessionEvent = {
1272
1513
  parentId: string | null;
1273
1514
  ephemeral: true;
1274
1515
  type: "assistant.usage";
1516
+ /**
1517
+ * LLM API call usage metrics including tokens, costs, quotas, and billing information
1518
+ */
1275
1519
  data: {
1276
1520
  /**
1277
1521
  * Model identifier used for this API call
@@ -1386,6 +1630,10 @@ export type SessionEvent = {
1386
1630
  */
1387
1631
  totalNanoAiu: number;
1388
1632
  };
1633
+ /**
1634
+ * Reasoning effort level used for model calls, if applicable (e.g. "low", "medium", "high", "xhigh")
1635
+ */
1636
+ reasoningEffort?: string;
1389
1637
  };
1390
1638
  } | {
1391
1639
  /**
@@ -1405,6 +1653,9 @@ export type SessionEvent = {
1405
1653
  */
1406
1654
  ephemeral?: boolean;
1407
1655
  type: "abort";
1656
+ /**
1657
+ * Turn abort information including the reason for termination
1658
+ */
1408
1659
  data: {
1409
1660
  /**
1410
1661
  * Reason the current turn was aborted (e.g., "user initiated")
@@ -1429,6 +1680,9 @@ export type SessionEvent = {
1429
1680
  */
1430
1681
  ephemeral?: boolean;
1431
1682
  type: "tool.user_requested";
1683
+ /**
1684
+ * User-initiated tool invocation request with tool name and arguments
1685
+ */
1432
1686
  data: {
1433
1687
  /**
1434
1688
  * Unique identifier for this tool call
@@ -1463,6 +1717,9 @@ export type SessionEvent = {
1463
1717
  */
1464
1718
  ephemeral?: boolean;
1465
1719
  type: "tool.execution_start";
1720
+ /**
1721
+ * Tool execution startup details including MCP server information when applicable
1722
+ */
1466
1723
  data: {
1467
1724
  /**
1468
1725
  * Unique identifier for this tool call
@@ -1506,6 +1763,9 @@ export type SessionEvent = {
1506
1763
  parentId: string | null;
1507
1764
  ephemeral: true;
1508
1765
  type: "tool.execution_partial_result";
1766
+ /**
1767
+ * Streaming tool execution output for incremental result display
1768
+ */
1509
1769
  data: {
1510
1770
  /**
1511
1771
  * Tool call ID this partial result belongs to
@@ -1531,6 +1791,9 @@ export type SessionEvent = {
1531
1791
  parentId: string | null;
1532
1792
  ephemeral: true;
1533
1793
  type: "tool.execution_progress";
1794
+ /**
1795
+ * Tool execution progress notification with status message
1796
+ */
1534
1797
  data: {
1535
1798
  /**
1536
1799
  * Tool call ID this progress notification belongs to
@@ -1559,6 +1822,9 @@ export type SessionEvent = {
1559
1822
  */
1560
1823
  ephemeral?: boolean;
1561
1824
  type: "tool.execution_complete";
1825
+ /**
1826
+ * Tool execution completion results including success status, detailed output, and error information
1827
+ */
1562
1828
  data: {
1563
1829
  /**
1564
1830
  * Unique identifier for the completed tool call
@@ -1776,6 +2042,9 @@ export type SessionEvent = {
1776
2042
  */
1777
2043
  ephemeral?: boolean;
1778
2044
  type: "skill.invoked";
2045
+ /**
2046
+ * Skill invocation details including content, allowed tools, and plugin metadata
2047
+ */
1779
2048
  data: {
1780
2049
  /**
1781
2050
  * Name of the invoked skill
@@ -1820,6 +2089,9 @@ export type SessionEvent = {
1820
2089
  */
1821
2090
  ephemeral?: boolean;
1822
2091
  type: "subagent.started";
2092
+ /**
2093
+ * Sub-agent startup details including parent tool call and agent information
2094
+ */
1823
2095
  data: {
1824
2096
  /**
1825
2097
  * Tool call ID of the parent tool invocation that spawned this sub-agent
@@ -1856,6 +2128,9 @@ export type SessionEvent = {
1856
2128
  */
1857
2129
  ephemeral?: boolean;
1858
2130
  type: "subagent.completed";
2131
+ /**
2132
+ * Sub-agent completion details for successful execution
2133
+ */
1859
2134
  data: {
1860
2135
  /**
1861
2136
  * Tool call ID of the parent tool invocation that spawned this sub-agent
@@ -1888,6 +2163,9 @@ export type SessionEvent = {
1888
2163
  */
1889
2164
  ephemeral?: boolean;
1890
2165
  type: "subagent.failed";
2166
+ /**
2167
+ * Sub-agent failure details including error message and agent information
2168
+ */
1891
2169
  data: {
1892
2170
  /**
1893
2171
  * Tool call ID of the parent tool invocation that spawned this sub-agent
@@ -1924,6 +2202,9 @@ export type SessionEvent = {
1924
2202
  */
1925
2203
  ephemeral?: boolean;
1926
2204
  type: "subagent.selected";
2205
+ /**
2206
+ * Custom agent selection details including name and available tools
2207
+ */
1927
2208
  data: {
1928
2209
  /**
1929
2210
  * Internal name of the selected custom agent
@@ -1978,6 +2259,9 @@ export type SessionEvent = {
1978
2259
  */
1979
2260
  ephemeral?: boolean;
1980
2261
  type: "hook.start";
2262
+ /**
2263
+ * Hook invocation start details including type and input data
2264
+ */
1981
2265
  data: {
1982
2266
  /**
1983
2267
  * Unique identifier for this hook invocation
@@ -2012,6 +2296,9 @@ export type SessionEvent = {
2012
2296
  */
2013
2297
  ephemeral?: boolean;
2014
2298
  type: "hook.end";
2299
+ /**
2300
+ * Hook invocation completion details including output, success status, and error information
2301
+ */
2015
2302
  data: {
2016
2303
  /**
2017
2304
  * Identifier matching the corresponding hook.start event
@@ -2063,6 +2350,9 @@ export type SessionEvent = {
2063
2350
  */
2064
2351
  ephemeral?: boolean;
2065
2352
  type: "system.message";
2353
+ /**
2354
+ * System or developer message content with role and optional template metadata
2355
+ */
2066
2356
  data: {
2067
2357
  /**
2068
2358
  * The system or developer prompt text
@@ -2110,6 +2400,9 @@ export type SessionEvent = {
2110
2400
  */
2111
2401
  ephemeral?: boolean;
2112
2402
  type: "system.notification";
2403
+ /**
2404
+ * System-generated notification for runtime events like background task completion
2405
+ */
2113
2406
  data: {
2114
2407
  /**
2115
2408
  * The notification text, typically wrapped in <system_notification> XML tags
@@ -2140,6 +2433,20 @@ export type SessionEvent = {
2140
2433
  * The full prompt given to the background agent
2141
2434
  */
2142
2435
  prompt?: string;
2436
+ } | {
2437
+ type: "agent_idle";
2438
+ /**
2439
+ * Unique identifier of the background agent
2440
+ */
2441
+ agentId: string;
2442
+ /**
2443
+ * Type of the agent (e.g., explore, task, general-purpose)
2444
+ */
2445
+ agentType: string;
2446
+ /**
2447
+ * Human-readable description of the agent task
2448
+ */
2449
+ description?: string;
2143
2450
  } | {
2144
2451
  type: "shell_completed";
2145
2452
  /**
@@ -2181,6 +2488,9 @@ export type SessionEvent = {
2181
2488
  parentId: string | null;
2182
2489
  ephemeral: true;
2183
2490
  type: "permission.requested";
2491
+ /**
2492
+ * Permission request notification requiring client approval with request details
2493
+ */
2184
2494
  data: {
2185
2495
  /**
2186
2496
  * Unique identifier for this permission request; used to respond via session.respondToPermission()
@@ -2378,6 +2688,29 @@ export type SessionEvent = {
2378
2688
  args?: {
2379
2689
  [k: string]: unknown;
2380
2690
  };
2691
+ } | {
2692
+ /**
2693
+ * Permission kind discriminator
2694
+ */
2695
+ kind: "hook";
2696
+ /**
2697
+ * Tool call ID that triggered this permission request
2698
+ */
2699
+ toolCallId?: string;
2700
+ /**
2701
+ * Name of the tool the hook is gating
2702
+ */
2703
+ toolName: string;
2704
+ /**
2705
+ * Arguments of the tool call being gated
2706
+ */
2707
+ toolArgs?: {
2708
+ [k: string]: unknown;
2709
+ };
2710
+ /**
2711
+ * Optional message from the hook explaining why confirmation is needed
2712
+ */
2713
+ hookMessage?: string;
2381
2714
  };
2382
2715
  };
2383
2716
  } | {
@@ -2395,6 +2728,9 @@ export type SessionEvent = {
2395
2728
  parentId: string | null;
2396
2729
  ephemeral: true;
2397
2730
  type: "permission.completed";
2731
+ /**
2732
+ * Permission request completion notification signaling UI dismissal
2733
+ */
2398
2734
  data: {
2399
2735
  /**
2400
2736
  * Request ID of the resolved permission request; clients should dismiss any UI for this request
@@ -2425,6 +2761,9 @@ export type SessionEvent = {
2425
2761
  parentId: string | null;
2426
2762
  ephemeral: true;
2427
2763
  type: "user_input.requested";
2764
+ /**
2765
+ * User input request notification with question and optional predefined choices
2766
+ */
2428
2767
  data: {
2429
2768
  /**
2430
2769
  * Unique identifier for this input request; used to respond via session.respondToUserInput()
@@ -2442,6 +2781,10 @@ export type SessionEvent = {
2442
2781
  * Whether the user can provide a free-form text response in addition to predefined choices
2443
2782
  */
2444
2783
  allowFreeform?: boolean;
2784
+ /**
2785
+ * The LLM-assigned tool call ID that triggered this request; used by remote UIs to correlate responses
2786
+ */
2787
+ toolCallId?: string;
2445
2788
  };
2446
2789
  } | {
2447
2790
  /**
@@ -2458,6 +2801,9 @@ export type SessionEvent = {
2458
2801
  parentId: string | null;
2459
2802
  ephemeral: true;
2460
2803
  type: "user_input.completed";
2804
+ /**
2805
+ * User input request completion notification signaling UI dismissal
2806
+ */
2461
2807
  data: {
2462
2808
  /**
2463
2809
  * Request ID of the resolved user input request; clients should dismiss any UI for this request
@@ -2479,23 +2825,37 @@ export type SessionEvent = {
2479
2825
  parentId: string | null;
2480
2826
  ephemeral: true;
2481
2827
  type: "elicitation.requested";
2828
+ /**
2829
+ * Elicitation request; may be form-based (structured input) or URL-based (browser redirect)
2830
+ */
2482
2831
  data: {
2483
2832
  /**
2484
2833
  * Unique identifier for this elicitation request; used to respond via session.respondToElicitation()
2485
2834
  */
2486
2835
  requestId: string;
2836
+ /**
2837
+ * Tool call ID from the LLM completion; used to correlate with CompletionChunk.toolCall.id for remote UIs
2838
+ */
2839
+ toolCallId?: string;
2840
+ /**
2841
+ * The source that initiated the request (MCP server name, or absent for agent-initiated)
2842
+ */
2843
+ elicitationSource?: string;
2487
2844
  /**
2488
2845
  * Message describing what information is needed from the user
2489
2846
  */
2490
2847
  message: string;
2491
2848
  /**
2492
- * Elicitation mode; currently only "form" is supported. Defaults to "form" when absent.
2849
+ * Elicitation mode; "form" for structured input, "url" for browser-based. Defaults to "form" when absent.
2493
2850
  */
2494
- mode?: "form";
2851
+ mode?: "form" | "url";
2495
2852
  /**
2496
- * JSON Schema describing the form fields to present to the user
2853
+ * JSON Schema describing the form fields to present to the user (form mode only)
2497
2854
  */
2498
- requestedSchema: {
2855
+ requestedSchema?: {
2856
+ /**
2857
+ * Schema type indicator (always 'object')
2858
+ */
2499
2859
  type: "object";
2500
2860
  /**
2501
2861
  * Form field definitions, keyed by field name
@@ -2508,6 +2868,10 @@ export type SessionEvent = {
2508
2868
  */
2509
2869
  required?: string[];
2510
2870
  };
2871
+ /**
2872
+ * URL to open in the user's browser (url mode only)
2873
+ */
2874
+ url?: string;
2511
2875
  [k: string]: unknown;
2512
2876
  };
2513
2877
  } | {
@@ -2525,12 +2889,84 @@ export type SessionEvent = {
2525
2889
  parentId: string | null;
2526
2890
  ephemeral: true;
2527
2891
  type: "elicitation.completed";
2892
+ /**
2893
+ * Elicitation request completion notification signaling UI dismissal
2894
+ */
2528
2895
  data: {
2529
2896
  /**
2530
2897
  * Request ID of the resolved elicitation request; clients should dismiss any UI for this request
2531
2898
  */
2532
2899
  requestId: string;
2533
2900
  };
2901
+ } | {
2902
+ /**
2903
+ * Unique event identifier (UUID v4), generated when the event is emitted
2904
+ */
2905
+ id: string;
2906
+ /**
2907
+ * ISO 8601 timestamp when the event was created
2908
+ */
2909
+ timestamp: string;
2910
+ /**
2911
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
2912
+ */
2913
+ parentId: string | null;
2914
+ ephemeral: true;
2915
+ type: "mcp.oauth_required";
2916
+ /**
2917
+ * OAuth authentication request for an MCP server
2918
+ */
2919
+ data: {
2920
+ /**
2921
+ * Unique identifier for this OAuth request; used to respond via session.respondToMcpOAuth()
2922
+ */
2923
+ requestId: string;
2924
+ /**
2925
+ * Display name of the MCP server that requires OAuth
2926
+ */
2927
+ serverName: string;
2928
+ /**
2929
+ * URL of the MCP server that requires OAuth
2930
+ */
2931
+ serverUrl: string;
2932
+ /**
2933
+ * Static OAuth client configuration, if the server specifies one
2934
+ */
2935
+ staticClientConfig?: {
2936
+ /**
2937
+ * OAuth client ID for the server
2938
+ */
2939
+ clientId: string;
2940
+ /**
2941
+ * Whether this is a public OAuth client
2942
+ */
2943
+ publicClient?: boolean;
2944
+ };
2945
+ };
2946
+ } | {
2947
+ /**
2948
+ * Unique event identifier (UUID v4), generated when the event is emitted
2949
+ */
2950
+ id: string;
2951
+ /**
2952
+ * ISO 8601 timestamp when the event was created
2953
+ */
2954
+ timestamp: string;
2955
+ /**
2956
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
2957
+ */
2958
+ parentId: string | null;
2959
+ ephemeral: true;
2960
+ type: "mcp.oauth_completed";
2961
+ /**
2962
+ * MCP OAuth request completion notification
2963
+ */
2964
+ data: {
2965
+ /**
2966
+ * Request ID of the resolved OAuth request
2967
+ */
2968
+ requestId: string;
2969
+ };
2534
2970
  } | {
2535
2971
  /**
2536
2972
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -2546,6 +2982,9 @@ export type SessionEvent = {
2546
2982
  parentId: string | null;
2547
2983
  ephemeral: true;
2548
2984
  type: "external_tool.requested";
2985
+ /**
2986
+ * External tool invocation request for client-side tool execution
2987
+ */
2549
2988
  data: {
2550
2989
  /**
2551
2990
  * Unique identifier for this request; used to respond via session.respondToExternalTool()
@@ -2569,6 +3008,14 @@ export type SessionEvent = {
2569
3008
  arguments?: {
2570
3009
  [k: string]: unknown;
2571
3010
  };
3011
+ /**
3012
+ * W3C Trace Context traceparent header for the execute_tool span
3013
+ */
3014
+ traceparent?: string;
3015
+ /**
3016
+ * W3C Trace Context tracestate header for the execute_tool span
3017
+ */
3018
+ tracestate?: string;
2572
3019
  };
2573
3020
  } | {
2574
3021
  /**
@@ -2585,6 +3032,9 @@ export type SessionEvent = {
2585
3032
  parentId: string | null;
2586
3033
  ephemeral: true;
2587
3034
  type: "external_tool.completed";
3035
+ /**
3036
+ * External tool completion notification signaling UI dismissal
3037
+ */
2588
3038
  data: {
2589
3039
  /**
2590
3040
  * Request ID of the resolved external tool request; clients should dismiss any UI for this request
@@ -2606,6 +3056,9 @@ export type SessionEvent = {
2606
3056
  parentId: string | null;
2607
3057
  ephemeral: true;
2608
3058
  type: "command.queued";
3059
+ /**
3060
+ * Queued slash command dispatch request for client execution
3061
+ */
2609
3062
  data: {
2610
3063
  /**
2611
3064
  * Unique identifier for this request; used to respond via session.respondToQueuedCommand()
@@ -2616,6 +3069,42 @@ export type SessionEvent = {
2616
3069
  */
2617
3070
  command: string;
2618
3071
  };
3072
+ } | {
3073
+ /**
3074
+ * Unique event identifier (UUID v4), generated when the event is emitted
3075
+ */
3076
+ id: string;
3077
+ /**
3078
+ * ISO 8601 timestamp when the event was created
3079
+ */
3080
+ timestamp: string;
3081
+ /**
3082
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3083
+ */
3084
+ parentId: string | null;
3085
+ ephemeral: true;
3086
+ type: "command.execute";
3087
+ /**
3088
+ * Registered command dispatch request routed to the owning client
3089
+ */
3090
+ data: {
3091
+ /**
3092
+ * Unique identifier; used to respond via session.commands.handlePendingCommand()
3093
+ */
3094
+ requestId: string;
3095
+ /**
3096
+ * The full command text (e.g., /deploy production)
3097
+ */
3098
+ command: string;
3099
+ /**
3100
+ * Command name without leading /
3101
+ */
3102
+ commandName: string;
3103
+ /**
3104
+ * Raw argument string after the command name
3105
+ */
3106
+ args: string;
3107
+ };
2619
3108
  } | {
2620
3109
  /**
2621
3110
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -2631,12 +3120,42 @@ export type SessionEvent = {
2631
3120
  parentId: string | null;
2632
3121
  ephemeral: true;
2633
3122
  type: "command.completed";
3123
+ /**
3124
+ * Queued command completion notification signaling UI dismissal
3125
+ */
2634
3126
  data: {
2635
3127
  /**
2636
3128
  * Request ID of the resolved command request; clients should dismiss any UI for this request
2637
3129
  */
2638
3130
  requestId: string;
2639
3131
  };
3132
+ } | {
3133
+ /**
3134
+ * Unique event identifier (UUID v4), generated when the event is emitted
3135
+ */
3136
+ id: string;
3137
+ /**
3138
+ * ISO 8601 timestamp when the event was created
3139
+ */
3140
+ timestamp: string;
3141
+ /**
3142
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3143
+ */
3144
+ parentId: string | null;
3145
+ ephemeral: true;
3146
+ type: "commands.changed";
3147
+ /**
3148
+ * SDK command registration change notification
3149
+ */
3150
+ data: {
3151
+ /**
3152
+ * Current list of registered SDK commands
3153
+ */
3154
+ commands: {
3155
+ name: string;
3156
+ description?: string;
3157
+ }[];
3158
+ };
2640
3159
  } | {
2641
3160
  /**
2642
3161
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -2652,6 +3171,9 @@ export type SessionEvent = {
2652
3171
  parentId: string | null;
2653
3172
  ephemeral: true;
2654
3173
  type: "exit_plan_mode.requested";
3174
+ /**
3175
+ * Plan approval request with plan content and available user actions
3176
+ */
2655
3177
  data: {
2656
3178
  /**
2657
3179
  * Unique identifier for this request; used to respond via session.respondToExitPlanMode()
@@ -2689,10 +3211,194 @@ export type SessionEvent = {
2689
3211
  parentId: string | null;
2690
3212
  ephemeral: true;
2691
3213
  type: "exit_plan_mode.completed";
3214
+ /**
3215
+ * Plan mode exit completion notification signaling UI dismissal
3216
+ */
2692
3217
  data: {
2693
3218
  /**
2694
3219
  * Request ID of the resolved exit plan mode request; clients should dismiss any UI for this request
2695
3220
  */
2696
3221
  requestId: string;
2697
3222
  };
3223
+ } | {
3224
+ /**
3225
+ * Unique event identifier (UUID v4), generated when the event is emitted
3226
+ */
3227
+ id: string;
3228
+ /**
3229
+ * ISO 8601 timestamp when the event was created
3230
+ */
3231
+ timestamp: string;
3232
+ /**
3233
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3234
+ */
3235
+ parentId: string | null;
3236
+ ephemeral: true;
3237
+ type: "session.tools_updated";
3238
+ data: {
3239
+ model: string;
3240
+ };
3241
+ } | {
3242
+ /**
3243
+ * Unique event identifier (UUID v4), generated when the event is emitted
3244
+ */
3245
+ id: string;
3246
+ /**
3247
+ * ISO 8601 timestamp when the event was created
3248
+ */
3249
+ timestamp: string;
3250
+ /**
3251
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3252
+ */
3253
+ parentId: string | null;
3254
+ ephemeral: true;
3255
+ type: "session.background_tasks_changed";
3256
+ data: {};
3257
+ } | {
3258
+ /**
3259
+ * Unique event identifier (UUID v4), generated when the event is emitted
3260
+ */
3261
+ id: string;
3262
+ /**
3263
+ * ISO 8601 timestamp when the event was created
3264
+ */
3265
+ timestamp: string;
3266
+ /**
3267
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3268
+ */
3269
+ parentId: string | null;
3270
+ ephemeral: true;
3271
+ type: "session.skills_loaded";
3272
+ data: {
3273
+ /**
3274
+ * Array of resolved skill metadata
3275
+ */
3276
+ skills: {
3277
+ /**
3278
+ * Unique identifier for the skill
3279
+ */
3280
+ name: string;
3281
+ /**
3282
+ * Description of what the skill does
3283
+ */
3284
+ description: string;
3285
+ /**
3286
+ * Source location type of the skill (e.g., project, personal, plugin)
3287
+ */
3288
+ source: string;
3289
+ /**
3290
+ * Whether the skill can be invoked by the user as a slash command
3291
+ */
3292
+ userInvocable: boolean;
3293
+ /**
3294
+ * Whether the skill is currently enabled
3295
+ */
3296
+ enabled: boolean;
3297
+ /**
3298
+ * Absolute path to the skill file, if available
3299
+ */
3300
+ path?: string;
3301
+ }[];
3302
+ };
3303
+ } | {
3304
+ /**
3305
+ * Unique event identifier (UUID v4), generated when the event is emitted
3306
+ */
3307
+ id: string;
3308
+ /**
3309
+ * ISO 8601 timestamp when the event was created
3310
+ */
3311
+ timestamp: string;
3312
+ /**
3313
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3314
+ */
3315
+ parentId: string | null;
3316
+ ephemeral: true;
3317
+ type: "session.mcp_servers_loaded";
3318
+ data: {
3319
+ /**
3320
+ * Array of MCP server status summaries
3321
+ */
3322
+ servers: {
3323
+ /**
3324
+ * Server name (config key)
3325
+ */
3326
+ name: string;
3327
+ /**
3328
+ * Connection status: connected, failed, pending, disabled, or not_configured
3329
+ */
3330
+ status: "connected" | "failed" | "pending" | "disabled" | "not_configured";
3331
+ /**
3332
+ * Configuration source: user, workspace, plugin, or builtin
3333
+ */
3334
+ source?: string;
3335
+ /**
3336
+ * Error message if the server failed to connect
3337
+ */
3338
+ error?: string;
3339
+ }[];
3340
+ };
3341
+ } | {
3342
+ /**
3343
+ * Unique event identifier (UUID v4), generated when the event is emitted
3344
+ */
3345
+ id: string;
3346
+ /**
3347
+ * ISO 8601 timestamp when the event was created
3348
+ */
3349
+ timestamp: string;
3350
+ /**
3351
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3352
+ */
3353
+ parentId: string | null;
3354
+ ephemeral: true;
3355
+ type: "session.mcp_server_status_changed";
3356
+ data: {
3357
+ /**
3358
+ * Name of the MCP server whose status changed
3359
+ */
3360
+ serverName: string;
3361
+ /**
3362
+ * New connection status: connected, failed, pending, disabled, or not_configured
3363
+ */
3364
+ status: "connected" | "failed" | "pending" | "disabled" | "not_configured";
3365
+ };
3366
+ } | {
3367
+ /**
3368
+ * Unique event identifier (UUID v4), generated when the event is emitted
3369
+ */
3370
+ id: string;
3371
+ /**
3372
+ * ISO 8601 timestamp when the event was created
3373
+ */
3374
+ timestamp: string;
3375
+ /**
3376
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3377
+ */
3378
+ parentId: string | null;
3379
+ ephemeral: true;
3380
+ type: "session.extensions_loaded";
3381
+ data: {
3382
+ /**
3383
+ * Array of discovered extensions and their status
3384
+ */
3385
+ extensions: {
3386
+ /**
3387
+ * Source-qualified extension ID (e.g., 'project:my-ext', 'user:auth-helper')
3388
+ */
3389
+ id: string;
3390
+ /**
3391
+ * Extension name (directory name)
3392
+ */
3393
+ name: string;
3394
+ /**
3395
+ * Discovery source
3396
+ */
3397
+ source: "project" | "user";
3398
+ /**
3399
+ * Current status: running, disabled, failed, or starting
3400
+ */
3401
+ status: "running" | "disabled" | "failed" | "starting";
3402
+ }[];
3403
+ };
2698
3404
  };