@github/copilot-sdk 0.1.32 → 0.1.33-preview.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,30 @@ 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
+ */
91
+ alreadyInUse?: boolean;
69
92
  };
70
93
  } | {
71
94
  /**
@@ -85,6 +108,9 @@ export type SessionEvent = {
85
108
  */
86
109
  ephemeral?: boolean;
87
110
  type: "session.resume";
111
+ /**
112
+ * Session resume metadata including current context and event count
113
+ */
88
114
  data: {
89
115
  /**
90
116
  * ISO 8601 timestamp when the session was resumed
@@ -94,6 +120,14 @@ export type SessionEvent = {
94
120
  * Total number of persisted events in the session at the time of resume
95
121
  */
96
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;
97
131
  /**
98
132
  * Updated working directory and git context at resume time
99
133
  */
@@ -107,14 +141,30 @@ export type SessionEvent = {
107
141
  */
108
142
  gitRoot?: string;
109
143
  /**
110
- * 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)
111
145
  */
112
146
  repository?: string;
147
+ /**
148
+ * Hosting platform type of the repository (github or ado)
149
+ */
150
+ hostType?: "github" | "ado";
113
151
  /**
114
152
  * Current git branch name
115
153
  */
116
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;
117
163
  };
164
+ /**
165
+ * Whether the session was already in use by another client at resume time
166
+ */
167
+ alreadyInUse?: boolean;
118
168
  };
119
169
  } | {
120
170
  /**
@@ -134,6 +184,9 @@ export type SessionEvent = {
134
184
  */
135
185
  ephemeral?: boolean;
136
186
  type: "session.error";
187
+ /**
188
+ * Error details for timeline display including message and optional diagnostic information
189
+ */
137
190
  data: {
138
191
  /**
139
192
  * Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "query")
@@ -226,6 +279,9 @@ export type SessionEvent = {
226
279
  parentId: string | null;
227
280
  ephemeral: true;
228
281
  type: "session.title_changed";
282
+ /**
283
+ * Session title change payload containing the new display title
284
+ */
229
285
  data: {
230
286
  /**
231
287
  * The new display title for the session
@@ -250,6 +306,9 @@ export type SessionEvent = {
250
306
  */
251
307
  ephemeral?: boolean;
252
308
  type: "session.info";
309
+ /**
310
+ * Informational message for timeline display with categorization
311
+ */
253
312
  data: {
254
313
  /**
255
314
  * Category of informational message (e.g., "notification", "timing", "context_window", "mcp", "snapshot", "configuration", "authentication", "model")
@@ -278,6 +337,9 @@ export type SessionEvent = {
278
337
  */
279
338
  ephemeral?: boolean;
280
339
  type: "session.warning";
340
+ /**
341
+ * Warning message for timeline display with categorization
342
+ */
281
343
  data: {
282
344
  /**
283
345
  * Category of warning (e.g., "subscription", "policy", "mcp")
@@ -306,6 +368,9 @@ export type SessionEvent = {
306
368
  */
307
369
  ephemeral?: boolean;
308
370
  type: "session.model_change";
371
+ /**
372
+ * Model change details including previous and new model identifiers
373
+ */
309
374
  data: {
310
375
  /**
311
376
  * Model that was previously selected, if any
@@ -315,6 +380,14 @@ export type SessionEvent = {
315
380
  * Newly selected model identifier
316
381
  */
317
382
  newModel: string;
383
+ /**
384
+ * Reasoning effort level before the model change, if applicable
385
+ */
386
+ previousReasoningEffort?: string;
387
+ /**
388
+ * Reasoning effort level after the model change, if applicable
389
+ */
390
+ reasoningEffort?: string;
318
391
  };
319
392
  } | {
320
393
  /**
@@ -334,6 +407,9 @@ export type SessionEvent = {
334
407
  */
335
408
  ephemeral?: boolean;
336
409
  type: "session.mode_changed";
410
+ /**
411
+ * Agent mode change details including previous and new modes
412
+ */
337
413
  data: {
338
414
  /**
339
415
  * Agent mode before the change (e.g., "interactive", "plan", "autopilot")
@@ -362,6 +438,9 @@ export type SessionEvent = {
362
438
  */
363
439
  ephemeral?: boolean;
364
440
  type: "session.plan_changed";
441
+ /**
442
+ * Plan file operation details indicating what changed
443
+ */
365
444
  data: {
366
445
  /**
367
446
  * The type of operation performed on the plan file
@@ -386,6 +465,9 @@ export type SessionEvent = {
386
465
  */
387
466
  ephemeral?: boolean;
388
467
  type: "session.workspace_file_changed";
468
+ /**
469
+ * Workspace file change details including path and operation type
470
+ */
389
471
  data: {
390
472
  /**
391
473
  * Relative path within the session workspace files directory
@@ -414,6 +496,9 @@ export type SessionEvent = {
414
496
  */
415
497
  ephemeral?: boolean;
416
498
  type: "session.handoff";
499
+ /**
500
+ * Session handoff metadata including source, context, and repository information
501
+ */
417
502
  data: {
418
503
  /**
419
504
  * ISO 8601 timestamp when the handoff occurred
@@ -471,6 +556,9 @@ export type SessionEvent = {
471
556
  */
472
557
  ephemeral?: boolean;
473
558
  type: "session.truncation";
559
+ /**
560
+ * Conversation truncation statistics including token counts and removed content metrics
561
+ */
474
562
  data: {
475
563
  /**
476
564
  * Maximum token count for the model's context window
@@ -520,6 +608,9 @@ export type SessionEvent = {
520
608
  parentId: string | null;
521
609
  ephemeral: true;
522
610
  type: "session.snapshot_rewind";
611
+ /**
612
+ * Session rewind details including target event and count of removed events
613
+ */
523
614
  data: {
524
615
  /**
525
616
  * Event ID that was rewound to; all events after this one were removed
@@ -548,6 +639,9 @@ export type SessionEvent = {
548
639
  */
549
640
  ephemeral?: boolean;
550
641
  type: "session.shutdown";
642
+ /**
643
+ * Session termination metrics including usage statistics, code changes, and shutdown reason
644
+ */
551
645
  data: {
552
646
  /**
553
647
  * Whether the session ended normally ("routine") or due to a crash/fatal error ("error")
@@ -650,6 +744,9 @@ export type SessionEvent = {
650
744
  */
651
745
  ephemeral?: boolean;
652
746
  type: "session.context_changed";
747
+ /**
748
+ * Updated working directory and git context after the change
749
+ */
653
750
  data: {
654
751
  /**
655
752
  * Current working directory path
@@ -660,13 +757,25 @@ export type SessionEvent = {
660
757
  */
661
758
  gitRoot?: string;
662
759
  /**
663
- * Repository identifier in "owner/name" format, derived from the git remote URL
760
+ * Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps)
664
761
  */
665
762
  repository?: string;
763
+ /**
764
+ * Hosting platform type of the repository (github or ado)
765
+ */
766
+ hostType?: "github" | "ado";
666
767
  /**
667
768
  * Current git branch name
668
769
  */
669
770
  branch?: string;
771
+ /**
772
+ * Head commit of current git branch at session start time
773
+ */
774
+ headCommit?: string;
775
+ /**
776
+ * Base commit of current git branch at session start time
777
+ */
778
+ baseCommit?: string;
670
779
  };
671
780
  } | {
672
781
  /**
@@ -683,6 +792,9 @@ export type SessionEvent = {
683
792
  parentId: string | null;
684
793
  ephemeral: true;
685
794
  type: "session.usage_info";
795
+ /**
796
+ * Current context window usage statistics including token and message counts
797
+ */
686
798
  data: {
687
799
  /**
688
800
  * Maximum token count for the model's context window
@@ -737,6 +849,9 @@ export type SessionEvent = {
737
849
  */
738
850
  ephemeral?: boolean;
739
851
  type: "session.compaction_complete";
852
+ /**
853
+ * Conversation compaction results including success status, metrics, and optional error details
854
+ */
740
855
  data: {
741
856
  /**
742
857
  * Whether compaction completed successfully
@@ -818,6 +933,9 @@ export type SessionEvent = {
818
933
  */
819
934
  ephemeral?: boolean;
820
935
  type: "session.task_complete";
936
+ /**
937
+ * Task completion notification with optional summary from the agent
938
+ */
821
939
  data: {
822
940
  /**
823
941
  * Optional summary of the completed task, provided by the agent
@@ -842,6 +960,9 @@ export type SessionEvent = {
842
960
  */
843
961
  ephemeral?: boolean;
844
962
  type: "user.message";
963
+ /**
964
+ * User message content with optional attachments, source information, and interaction metadata
965
+ */
845
966
  data: {
846
967
  /**
847
968
  * The user's message text as displayed in the timeline
@@ -855,9 +976,12 @@ export type SessionEvent = {
855
976
  * Files, selections, or GitHub references attached to the message
856
977
  */
857
978
  attachments?: ({
979
+ /**
980
+ * Attachment type discriminator
981
+ */
858
982
  type: "file";
859
983
  /**
860
- * Absolute file or directory path
984
+ * Absolute file path
861
985
  */
862
986
  path: string;
863
987
  /**
@@ -878,28 +1002,18 @@ export type SessionEvent = {
878
1002
  end: number;
879
1003
  };
880
1004
  } | {
1005
+ /**
1006
+ * Attachment type discriminator
1007
+ */
881
1008
  type: "directory";
882
1009
  /**
883
- * Absolute file or directory path
1010
+ * Absolute directory path
884
1011
  */
885
1012
  path: string;
886
1013
  /**
887
1014
  * User-facing display name for the attachment
888
1015
  */
889
1016
  displayName: string;
890
- /**
891
- * Optional line range to scope the attachment to a specific section of the file
892
- */
893
- lineRange?: {
894
- /**
895
- * Start line number (1-based)
896
- */
897
- start: number;
898
- /**
899
- * End line number (1-based, inclusive)
900
- */
901
- end: number;
902
- };
903
1017
  } | {
904
1018
  /**
905
1019
  * Attachment type discriminator
@@ -921,6 +1035,9 @@ export type SessionEvent = {
921
1035
  * Position range of the selection within the file
922
1036
  */
923
1037
  selection: {
1038
+ /**
1039
+ * Start position of the selection
1040
+ */
924
1041
  start: {
925
1042
  /**
926
1043
  * Start line number (0-based)
@@ -931,6 +1048,9 @@ export type SessionEvent = {
931
1048
  */
932
1049
  character: number;
933
1050
  };
1051
+ /**
1052
+ * End position of the selection
1053
+ */
934
1054
  end: {
935
1055
  /**
936
1056
  * End line number (0-based)
@@ -967,11 +1087,28 @@ export type SessionEvent = {
967
1087
  * URL to the referenced item on GitHub
968
1088
  */
969
1089
  url: string;
1090
+ } | {
1091
+ /**
1092
+ * Attachment type discriminator
1093
+ */
1094
+ type: "blob";
1095
+ /**
1096
+ * Base64-encoded content
1097
+ */
1098
+ data: string;
1099
+ /**
1100
+ * MIME type of the inline data
1101
+ */
1102
+ mimeType: string;
1103
+ /**
1104
+ * User-facing display name for the attachment
1105
+ */
1106
+ displayName?: string;
970
1107
  })[];
971
1108
  /**
972
- * Origin of this message, used for timeline filtering (e.g., "skill-pdf" for skill-injected messages that should be hidden from the user)
1109
+ * Origin of this message, used for timeline filtering and telemetry (e.g., "user", "autopilot", "skill", or "command")
973
1110
  */
974
- source?: string;
1111
+ source?: "user" | "autopilot" | "skill" | "system" | "command" | "immediate-prompt" | "jit-instruction" | "snippy-blocking" | "thinking-exhausted-continuation" | "other";
975
1112
  /**
976
1113
  * The agent mode that was active when this message was sent
977
1114
  */
@@ -1018,6 +1155,9 @@ export type SessionEvent = {
1018
1155
  */
1019
1156
  ephemeral?: boolean;
1020
1157
  type: "assistant.turn_start";
1158
+ /**
1159
+ * Turn initialization metadata including identifier and interaction tracking
1160
+ */
1021
1161
  data: {
1022
1162
  /**
1023
1163
  * Identifier for this turn within the agentic loop, typically a stringified turn number
@@ -1043,6 +1183,9 @@ export type SessionEvent = {
1043
1183
  parentId: string | null;
1044
1184
  ephemeral: true;
1045
1185
  type: "assistant.intent";
1186
+ /**
1187
+ * Agent intent description for current activity or plan
1188
+ */
1046
1189
  data: {
1047
1190
  /**
1048
1191
  * Short description of what the agent is currently doing or planning to do
@@ -1067,6 +1210,9 @@ export type SessionEvent = {
1067
1210
  */
1068
1211
  ephemeral?: boolean;
1069
1212
  type: "assistant.reasoning";
1213
+ /**
1214
+ * Assistant reasoning content for timeline display with complete thinking text
1215
+ */
1070
1216
  data: {
1071
1217
  /**
1072
1218
  * Unique identifier for this reasoning block
@@ -1092,6 +1238,9 @@ export type SessionEvent = {
1092
1238
  parentId: string | null;
1093
1239
  ephemeral: true;
1094
1240
  type: "assistant.reasoning_delta";
1241
+ /**
1242
+ * Streaming reasoning delta for incremental extended thinking updates
1243
+ */
1095
1244
  data: {
1096
1245
  /**
1097
1246
  * Reasoning block ID this delta belongs to, matching the corresponding assistant.reasoning event
@@ -1117,6 +1266,9 @@ export type SessionEvent = {
1117
1266
  parentId: string | null;
1118
1267
  ephemeral: true;
1119
1268
  type: "assistant.streaming_delta";
1269
+ /**
1270
+ * Streaming response progress with cumulative byte count
1271
+ */
1120
1272
  data: {
1121
1273
  /**
1122
1274
  * Cumulative total bytes received from the streaming response so far
@@ -1141,6 +1293,9 @@ export type SessionEvent = {
1141
1293
  */
1142
1294
  ephemeral?: boolean;
1143
1295
  type: "assistant.message";
1296
+ /**
1297
+ * Assistant response containing text content, optional tool requests, and interaction metadata
1298
+ */
1144
1299
  data: {
1145
1300
  /**
1146
1301
  * Unique identifier for this assistant message
@@ -1172,6 +1327,14 @@ export type SessionEvent = {
1172
1327
  * Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent.
1173
1328
  */
1174
1329
  type?: "function" | "custom";
1330
+ /**
1331
+ * Human-readable display title for the tool
1332
+ */
1333
+ toolTitle?: string;
1334
+ /**
1335
+ * Resolved intention summary describing what this specific call does
1336
+ */
1337
+ intentionSummary?: string | null;
1175
1338
  }[];
1176
1339
  /**
1177
1340
  * Opaque/encrypted extended thinking data from Anthropic models. Session-bound and stripped on resume.
@@ -1217,6 +1380,9 @@ export type SessionEvent = {
1217
1380
  parentId: string | null;
1218
1381
  ephemeral: true;
1219
1382
  type: "assistant.message_delta";
1383
+ /**
1384
+ * Streaming assistant message delta for incremental response updates
1385
+ */
1220
1386
  data: {
1221
1387
  /**
1222
1388
  * Message ID this delta belongs to, matching the corresponding assistant.message event
@@ -1249,6 +1415,9 @@ export type SessionEvent = {
1249
1415
  */
1250
1416
  ephemeral?: boolean;
1251
1417
  type: "assistant.turn_end";
1418
+ /**
1419
+ * Turn completion metadata including the turn identifier
1420
+ */
1252
1421
  data: {
1253
1422
  /**
1254
1423
  * Identifier of the turn that has ended, matching the corresponding assistant.turn_start event
@@ -1270,6 +1439,9 @@ export type SessionEvent = {
1270
1439
  parentId: string | null;
1271
1440
  ephemeral: true;
1272
1441
  type: "assistant.usage";
1442
+ /**
1443
+ * LLM API call usage metrics including tokens, costs, quotas, and billing information
1444
+ */
1273
1445
  data: {
1274
1446
  /**
1275
1447
  * Model identifier used for this API call
@@ -1384,6 +1556,10 @@ export type SessionEvent = {
1384
1556
  */
1385
1557
  totalNanoAiu: number;
1386
1558
  };
1559
+ /**
1560
+ * Reasoning effort level used for model calls, if applicable (e.g. "low", "medium", "high", "xhigh")
1561
+ */
1562
+ reasoningEffort?: string;
1387
1563
  };
1388
1564
  } | {
1389
1565
  /**
@@ -1403,6 +1579,9 @@ export type SessionEvent = {
1403
1579
  */
1404
1580
  ephemeral?: boolean;
1405
1581
  type: "abort";
1582
+ /**
1583
+ * Turn abort information including the reason for termination
1584
+ */
1406
1585
  data: {
1407
1586
  /**
1408
1587
  * Reason the current turn was aborted (e.g., "user initiated")
@@ -1427,6 +1606,9 @@ export type SessionEvent = {
1427
1606
  */
1428
1607
  ephemeral?: boolean;
1429
1608
  type: "tool.user_requested";
1609
+ /**
1610
+ * User-initiated tool invocation request with tool name and arguments
1611
+ */
1430
1612
  data: {
1431
1613
  /**
1432
1614
  * Unique identifier for this tool call
@@ -1461,6 +1643,9 @@ export type SessionEvent = {
1461
1643
  */
1462
1644
  ephemeral?: boolean;
1463
1645
  type: "tool.execution_start";
1646
+ /**
1647
+ * Tool execution startup details including MCP server information when applicable
1648
+ */
1464
1649
  data: {
1465
1650
  /**
1466
1651
  * Unique identifier for this tool call
@@ -1504,6 +1689,9 @@ export type SessionEvent = {
1504
1689
  parentId: string | null;
1505
1690
  ephemeral: true;
1506
1691
  type: "tool.execution_partial_result";
1692
+ /**
1693
+ * Streaming tool execution output for incremental result display
1694
+ */
1507
1695
  data: {
1508
1696
  /**
1509
1697
  * Tool call ID this partial result belongs to
@@ -1529,6 +1717,9 @@ export type SessionEvent = {
1529
1717
  parentId: string | null;
1530
1718
  ephemeral: true;
1531
1719
  type: "tool.execution_progress";
1720
+ /**
1721
+ * Tool execution progress notification with status message
1722
+ */
1532
1723
  data: {
1533
1724
  /**
1534
1725
  * Tool call ID this progress notification belongs to
@@ -1557,6 +1748,9 @@ export type SessionEvent = {
1557
1748
  */
1558
1749
  ephemeral?: boolean;
1559
1750
  type: "tool.execution_complete";
1751
+ /**
1752
+ * Tool execution completion results including success status, detailed output, and error information
1753
+ */
1560
1754
  data: {
1561
1755
  /**
1562
1756
  * Unique identifier for the completed tool call
@@ -1774,6 +1968,9 @@ export type SessionEvent = {
1774
1968
  */
1775
1969
  ephemeral?: boolean;
1776
1970
  type: "skill.invoked";
1971
+ /**
1972
+ * Skill invocation details including content, allowed tools, and plugin metadata
1973
+ */
1777
1974
  data: {
1778
1975
  /**
1779
1976
  * Name of the invoked skill
@@ -1818,6 +2015,9 @@ export type SessionEvent = {
1818
2015
  */
1819
2016
  ephemeral?: boolean;
1820
2017
  type: "subagent.started";
2018
+ /**
2019
+ * Sub-agent startup details including parent tool call and agent information
2020
+ */
1821
2021
  data: {
1822
2022
  /**
1823
2023
  * Tool call ID of the parent tool invocation that spawned this sub-agent
@@ -1854,6 +2054,9 @@ export type SessionEvent = {
1854
2054
  */
1855
2055
  ephemeral?: boolean;
1856
2056
  type: "subagent.completed";
2057
+ /**
2058
+ * Sub-agent completion details for successful execution
2059
+ */
1857
2060
  data: {
1858
2061
  /**
1859
2062
  * Tool call ID of the parent tool invocation that spawned this sub-agent
@@ -1886,6 +2089,9 @@ export type SessionEvent = {
1886
2089
  */
1887
2090
  ephemeral?: boolean;
1888
2091
  type: "subagent.failed";
2092
+ /**
2093
+ * Sub-agent failure details including error message and agent information
2094
+ */
1889
2095
  data: {
1890
2096
  /**
1891
2097
  * Tool call ID of the parent tool invocation that spawned this sub-agent
@@ -1922,6 +2128,9 @@ export type SessionEvent = {
1922
2128
  */
1923
2129
  ephemeral?: boolean;
1924
2130
  type: "subagent.selected";
2131
+ /**
2132
+ * Custom agent selection details including name and available tools
2133
+ */
1925
2134
  data: {
1926
2135
  /**
1927
2136
  * Internal name of the selected custom agent
@@ -1976,6 +2185,9 @@ export type SessionEvent = {
1976
2185
  */
1977
2186
  ephemeral?: boolean;
1978
2187
  type: "hook.start";
2188
+ /**
2189
+ * Hook invocation start details including type and input data
2190
+ */
1979
2191
  data: {
1980
2192
  /**
1981
2193
  * Unique identifier for this hook invocation
@@ -2010,6 +2222,9 @@ export type SessionEvent = {
2010
2222
  */
2011
2223
  ephemeral?: boolean;
2012
2224
  type: "hook.end";
2225
+ /**
2226
+ * Hook invocation completion details including output, success status, and error information
2227
+ */
2013
2228
  data: {
2014
2229
  /**
2015
2230
  * Identifier matching the corresponding hook.start event
@@ -2061,6 +2276,9 @@ export type SessionEvent = {
2061
2276
  */
2062
2277
  ephemeral?: boolean;
2063
2278
  type: "system.message";
2279
+ /**
2280
+ * System or developer message content with role and optional template metadata
2281
+ */
2064
2282
  data: {
2065
2283
  /**
2066
2284
  * The system or developer prompt text
@@ -2090,6 +2308,83 @@ export type SessionEvent = {
2090
2308
  };
2091
2309
  };
2092
2310
  };
2311
+ } | {
2312
+ /**
2313
+ * Unique event identifier (UUID v4), generated when the event is emitted
2314
+ */
2315
+ id: string;
2316
+ /**
2317
+ * ISO 8601 timestamp when the event was created
2318
+ */
2319
+ timestamp: string;
2320
+ /**
2321
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
2322
+ */
2323
+ parentId: string | null;
2324
+ /**
2325
+ * When true, the event is transient and not persisted to the session event log on disk
2326
+ */
2327
+ ephemeral?: boolean;
2328
+ type: "system.notification";
2329
+ /**
2330
+ * System-generated notification for runtime events like background task completion
2331
+ */
2332
+ data: {
2333
+ /**
2334
+ * The notification text, typically wrapped in <system_notification> XML tags
2335
+ */
2336
+ content: string;
2337
+ /**
2338
+ * Structured metadata identifying what triggered this notification
2339
+ */
2340
+ kind: {
2341
+ type: "agent_completed";
2342
+ /**
2343
+ * Unique identifier of the background agent
2344
+ */
2345
+ agentId: string;
2346
+ /**
2347
+ * Type of the agent (e.g., explore, task, general-purpose)
2348
+ */
2349
+ agentType: string;
2350
+ /**
2351
+ * Whether the agent completed successfully or failed
2352
+ */
2353
+ status: "completed" | "failed";
2354
+ /**
2355
+ * Human-readable description of the agent task
2356
+ */
2357
+ description?: string;
2358
+ /**
2359
+ * The full prompt given to the background agent
2360
+ */
2361
+ prompt?: string;
2362
+ } | {
2363
+ type: "shell_completed";
2364
+ /**
2365
+ * Unique identifier of the shell session
2366
+ */
2367
+ shellId: string;
2368
+ /**
2369
+ * Exit code of the shell command, if available
2370
+ */
2371
+ exitCode?: number;
2372
+ /**
2373
+ * Human-readable description of the command
2374
+ */
2375
+ description?: string;
2376
+ } | {
2377
+ type: "shell_detached_completed";
2378
+ /**
2379
+ * Unique identifier of the detached shell session
2380
+ */
2381
+ shellId: string;
2382
+ /**
2383
+ * Human-readable description of the command
2384
+ */
2385
+ description?: string;
2386
+ };
2387
+ };
2093
2388
  } | {
2094
2389
  /**
2095
2390
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -2105,6 +2400,9 @@ export type SessionEvent = {
2105
2400
  parentId: string | null;
2106
2401
  ephemeral: true;
2107
2402
  type: "permission.requested";
2403
+ /**
2404
+ * Permission request notification requiring client approval with request details
2405
+ */
2108
2406
  data: {
2109
2407
  /**
2110
2408
  * Unique identifier for this permission request; used to respond via session.respondToPermission()
@@ -2302,6 +2600,29 @@ export type SessionEvent = {
2302
2600
  args?: {
2303
2601
  [k: string]: unknown;
2304
2602
  };
2603
+ } | {
2604
+ /**
2605
+ * Permission kind discriminator
2606
+ */
2607
+ kind: "hook";
2608
+ /**
2609
+ * Tool call ID that triggered this permission request
2610
+ */
2611
+ toolCallId?: string;
2612
+ /**
2613
+ * Name of the tool the hook is gating
2614
+ */
2615
+ toolName: string;
2616
+ /**
2617
+ * Arguments of the tool call being gated
2618
+ */
2619
+ toolArgs?: {
2620
+ [k: string]: unknown;
2621
+ };
2622
+ /**
2623
+ * Optional message from the hook explaining why confirmation is needed
2624
+ */
2625
+ hookMessage?: string;
2305
2626
  };
2306
2627
  };
2307
2628
  } | {
@@ -2319,6 +2640,9 @@ export type SessionEvent = {
2319
2640
  parentId: string | null;
2320
2641
  ephemeral: true;
2321
2642
  type: "permission.completed";
2643
+ /**
2644
+ * Permission request completion notification signaling UI dismissal
2645
+ */
2322
2646
  data: {
2323
2647
  /**
2324
2648
  * Request ID of the resolved permission request; clients should dismiss any UI for this request
@@ -2349,6 +2673,9 @@ export type SessionEvent = {
2349
2673
  parentId: string | null;
2350
2674
  ephemeral: true;
2351
2675
  type: "user_input.requested";
2676
+ /**
2677
+ * User input request notification with question and optional predefined choices
2678
+ */
2352
2679
  data: {
2353
2680
  /**
2354
2681
  * Unique identifier for this input request; used to respond via session.respondToUserInput()
@@ -2382,6 +2709,9 @@ export type SessionEvent = {
2382
2709
  parentId: string | null;
2383
2710
  ephemeral: true;
2384
2711
  type: "user_input.completed";
2712
+ /**
2713
+ * User input request completion notification signaling UI dismissal
2714
+ */
2385
2715
  data: {
2386
2716
  /**
2387
2717
  * Request ID of the resolved user input request; clients should dismiss any UI for this request
@@ -2403,6 +2733,9 @@ export type SessionEvent = {
2403
2733
  parentId: string | null;
2404
2734
  ephemeral: true;
2405
2735
  type: "elicitation.requested";
2736
+ /**
2737
+ * Structured form elicitation request with JSON schema definition for form fields
2738
+ */
2406
2739
  data: {
2407
2740
  /**
2408
2741
  * Unique identifier for this elicitation request; used to respond via session.respondToElicitation()
@@ -2420,6 +2753,9 @@ export type SessionEvent = {
2420
2753
  * JSON Schema describing the form fields to present to the user
2421
2754
  */
2422
2755
  requestedSchema: {
2756
+ /**
2757
+ * Schema type indicator (always 'object')
2758
+ */
2423
2759
  type: "object";
2424
2760
  /**
2425
2761
  * Form field definitions, keyed by field name
@@ -2449,6 +2785,9 @@ export type SessionEvent = {
2449
2785
  parentId: string | null;
2450
2786
  ephemeral: true;
2451
2787
  type: "elicitation.completed";
2788
+ /**
2789
+ * Elicitation request completion notification signaling UI dismissal
2790
+ */
2452
2791
  data: {
2453
2792
  /**
2454
2793
  * Request ID of the resolved elicitation request; clients should dismiss any UI for this request
@@ -2470,6 +2809,9 @@ export type SessionEvent = {
2470
2809
  parentId: string | null;
2471
2810
  ephemeral: true;
2472
2811
  type: "external_tool.requested";
2812
+ /**
2813
+ * External tool invocation request for client-side tool execution
2814
+ */
2473
2815
  data: {
2474
2816
  /**
2475
2817
  * Unique identifier for this request; used to respond via session.respondToExternalTool()
@@ -2493,6 +2835,14 @@ export type SessionEvent = {
2493
2835
  arguments?: {
2494
2836
  [k: string]: unknown;
2495
2837
  };
2838
+ /**
2839
+ * W3C Trace Context traceparent header for the execute_tool span
2840
+ */
2841
+ traceparent?: string;
2842
+ /**
2843
+ * W3C Trace Context tracestate header for the execute_tool span
2844
+ */
2845
+ tracestate?: string;
2496
2846
  };
2497
2847
  } | {
2498
2848
  /**
@@ -2509,6 +2859,9 @@ export type SessionEvent = {
2509
2859
  parentId: string | null;
2510
2860
  ephemeral: true;
2511
2861
  type: "external_tool.completed";
2862
+ /**
2863
+ * External tool completion notification signaling UI dismissal
2864
+ */
2512
2865
  data: {
2513
2866
  /**
2514
2867
  * Request ID of the resolved external tool request; clients should dismiss any UI for this request
@@ -2530,6 +2883,9 @@ export type SessionEvent = {
2530
2883
  parentId: string | null;
2531
2884
  ephemeral: true;
2532
2885
  type: "command.queued";
2886
+ /**
2887
+ * Queued slash command dispatch request for client execution
2888
+ */
2533
2889
  data: {
2534
2890
  /**
2535
2891
  * Unique identifier for this request; used to respond via session.respondToQueuedCommand()
@@ -2555,6 +2911,9 @@ export type SessionEvent = {
2555
2911
  parentId: string | null;
2556
2912
  ephemeral: true;
2557
2913
  type: "command.completed";
2914
+ /**
2915
+ * Queued command completion notification signaling UI dismissal
2916
+ */
2558
2917
  data: {
2559
2918
  /**
2560
2919
  * Request ID of the resolved command request; clients should dismiss any UI for this request
@@ -2576,6 +2935,9 @@ export type SessionEvent = {
2576
2935
  parentId: string | null;
2577
2936
  ephemeral: true;
2578
2937
  type: "exit_plan_mode.requested";
2938
+ /**
2939
+ * Plan approval request with plan content and available user actions
2940
+ */
2579
2941
  data: {
2580
2942
  /**
2581
2943
  * Unique identifier for this request; used to respond via session.respondToExitPlanMode()
@@ -2613,10 +2975,47 @@ export type SessionEvent = {
2613
2975
  parentId: string | null;
2614
2976
  ephemeral: true;
2615
2977
  type: "exit_plan_mode.completed";
2978
+ /**
2979
+ * Plan mode exit completion notification signaling UI dismissal
2980
+ */
2616
2981
  data: {
2617
2982
  /**
2618
2983
  * Request ID of the resolved exit plan mode request; clients should dismiss any UI for this request
2619
2984
  */
2620
2985
  requestId: string;
2621
2986
  };
2987
+ } | {
2988
+ /**
2989
+ * Unique event identifier (UUID v4), generated when the event is emitted
2990
+ */
2991
+ id: string;
2992
+ /**
2993
+ * ISO 8601 timestamp when the event was created
2994
+ */
2995
+ timestamp: string;
2996
+ /**
2997
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
2998
+ */
2999
+ parentId: string | null;
3000
+ ephemeral: true;
3001
+ type: "session.tools_updated";
3002
+ data: {
3003
+ model: string;
3004
+ };
3005
+ } | {
3006
+ /**
3007
+ * Unique event identifier (UUID v4), generated when the event is emitted
3008
+ */
3009
+ id: string;
3010
+ /**
3011
+ * ISO 8601 timestamp when the event was created
3012
+ */
3013
+ timestamp: string;
3014
+ /**
3015
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3016
+ */
3017
+ parentId: string | null;
3018
+ ephemeral: true;
3019
+ type: "session.background_tasks_changed";
3020
+ data: {};
2622
3021
  };