@tylerl0706/ahpx 0.2.10 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -111,7 +111,7 @@ interface IProtectedResourceMetadata {
111
111
  *
112
112
  * @category Root State
113
113
  */
114
- declare enum PolicyState {
114
+ declare const enum PolicyState {
115
115
  Enabled = "enabled",
116
116
  Disabled = "disabled",
117
117
  Unconfigured = "unconfigured"
@@ -126,6 +126,8 @@ interface IRootState {
126
126
  agents: IAgentInfo[];
127
127
  /** Number of active (non-disposed) sessions on the server */
128
128
  activeSessions?: number;
129
+ /** Known terminals on the server. Subscribe to individual terminal URIs for full state. */
130
+ terminals?: ITerminalInfo[];
129
131
  }
130
132
  /**
131
133
  * @category Root State
@@ -181,7 +183,7 @@ interface ISessionModelInfo {
181
183
  *
182
184
  * @category Pending Message Types
183
185
  */
184
- declare enum PendingMessageKind {
186
+ declare const enum PendingMessageKind {
185
187
  /** Injected into the current turn at a convenient point */
186
188
  Steering = "steering",
187
189
  /** Sent automatically as a new turn after the current turn finishes */
@@ -207,20 +209,25 @@ interface IPendingMessage {
207
209
  *
208
210
  * @category Session State
209
211
  */
210
- declare enum SessionLifecycle {
212
+ declare const enum SessionLifecycle {
211
213
  Creating = "creating",
212
214
  Ready = "ready",
213
215
  CreationFailed = "creationFailed"
214
216
  }
215
217
  /**
216
- * Current session status.
218
+ * Bitset of summary-level session status flags.
219
+ *
220
+ * Use bitwise checks instead of equality for non-terminal activity. For example,
221
+ * `status & SessionStatus.InProgress` matches both ordinary in-progress turns
222
+ * and turns that are paused waiting for input.
217
223
  *
218
224
  * @category Session State
219
225
  */
220
- declare enum SessionStatus {
221
- Idle = "idle",
222
- InProgress = "in-progress",
223
- Error = "error"
226
+ declare const enum SessionStatus {
227
+ Idle = 1,
228
+ Error = 2,
229
+ InProgress = 8,
230
+ InputNeeded = 24
224
231
  }
225
232
  /**
226
233
  * Full state for a single session, loaded when a client subscribes to the session's URI.
@@ -248,6 +255,8 @@ interface ISessionState {
248
255
  steeringMessage?: IPendingMessage;
249
256
  /** Messages to send automatically as new turns after the current turn finishes */
250
257
  queuedMessages?: IPendingMessage[];
258
+ /** Requests for user input that are currently blocking or informing session progress */
259
+ inputRequests?: ISessionInputRequest[];
251
260
  /**
252
261
  * Server-provided customizations active in this session.
253
262
  *
@@ -274,6 +283,30 @@ interface ISessionActiveClient {
274
283
  /** Customizations this client contributes to the session */
275
284
  customizations?: ICustomizationRef[];
276
285
  }
286
+ /**
287
+ * A summary of changes to a single file within a session.
288
+ *
289
+ * @category Session State
290
+ */
291
+ interface ISessionFileDiff {
292
+ /** URI of the affected file */
293
+ uri: URI;
294
+ /** Number of items added (e.g., lines for text files, cells for notebooks) */
295
+ added?: number;
296
+ /** Number of items removed (e.g., lines for text files, cells for notebooks) */
297
+ removed?: number;
298
+ }
299
+ /**
300
+ * Server-owned project metadata for a session.
301
+ *
302
+ * @category Session State
303
+ */
304
+ interface IProjectInfo {
305
+ /** Project URI */
306
+ uri: URI;
307
+ /** Human-readable project name */
308
+ displayName: string;
309
+ }
277
310
  /**
278
311
  * @category Session State
279
312
  */
@@ -290,17 +323,218 @@ interface ISessionSummary {
290
323
  createdAt: number;
291
324
  /** Last modification timestamp */
292
325
  modifiedAt: number;
326
+ /** Server-owned project for this session */
327
+ project?: IProjectInfo;
293
328
  /** Currently selected model */
294
329
  model?: string;
295
330
  /** The working directory URI for this session */
296
331
  workingDirectory?: URI;
332
+ /** Whether the client has viewed this session since its last modification */
333
+ isRead?: boolean;
334
+ /** Whether the session has been marked as done by the client */
335
+ isDone?: boolean;
336
+ /** Files changed during this session with diff statistics */
337
+ diffs?: ISessionFileDiff[];
338
+ }
339
+ /**
340
+ * How a client completed an input request.
341
+ *
342
+ * @category Session Input Types
343
+ */
344
+ declare const enum SessionInputResponseKind {
345
+ Accept = "accept",
346
+ Decline = "decline",
347
+ Cancel = "cancel"
348
+ }
349
+ /**
350
+ * Question/input control kind.
351
+ *
352
+ * @category Session Input Types
353
+ */
354
+ declare const enum SessionInputQuestionKind {
355
+ Text = "text",
356
+ Number = "number",
357
+ Integer = "integer",
358
+ Boolean = "boolean",
359
+ SingleSelect = "single-select",
360
+ MultiSelect = "multi-select"
361
+ }
362
+ /**
363
+ * A choice in a select-style question.
364
+ *
365
+ * @category Session Input Types
366
+ */
367
+ interface ISessionInputOption {
368
+ /** Stable option identifier; for MCP enum values this is the enum string */
369
+ id: string;
370
+ /** Display label */
371
+ label: string;
372
+ /** Optional secondary text */
373
+ description?: string;
374
+ /** Whether this option is the recommended/default choice */
375
+ recommended?: boolean;
376
+ }
377
+ interface ISessionInputQuestionBase {
378
+ /** Stable question identifier used as the key in `answers` */
379
+ id: string;
380
+ /** Short display title */
381
+ title?: string;
382
+ /** Prompt shown to the user */
383
+ message: string;
384
+ /** Whether the user must answer this question to accept the request */
385
+ required?: boolean;
386
+ }
387
+ /** Text question within a session input request. */
388
+ interface ISessionInputTextQuestion extends ISessionInputQuestionBase {
389
+ kind: SessionInputQuestionKind.Text;
390
+ /** Format hint for text questions, such as `email`, `uri`, `date`, or `date-time` */
391
+ format?: string;
392
+ /** Minimum string length */
393
+ min?: number;
394
+ /** Maximum string length */
395
+ max?: number;
396
+ /** Default text */
397
+ defaultValue?: string;
398
+ }
399
+ /** Numeric question within a session input request. */
400
+ interface ISessionInputNumberQuestion extends ISessionInputQuestionBase {
401
+ kind: SessionInputQuestionKind.Number | SessionInputQuestionKind.Integer;
402
+ /** Minimum value */
403
+ min?: number;
404
+ /** Maximum value */
405
+ max?: number;
406
+ /** Default numeric value */
407
+ defaultValue?: number;
408
+ }
409
+ /** Boolean question within a session input request. */
410
+ interface ISessionInputBooleanQuestion extends ISessionInputQuestionBase {
411
+ kind: SessionInputQuestionKind.Boolean;
412
+ /** Default boolean value */
413
+ defaultValue?: boolean;
414
+ }
415
+ /** Single-select question within a session input request. */
416
+ interface ISessionInputSingleSelectQuestion extends ISessionInputQuestionBase {
417
+ kind: SessionInputQuestionKind.SingleSelect;
418
+ /** Options the user may select from */
419
+ options: ISessionInputOption[];
420
+ /** Whether the user may enter text instead of selecting an option */
421
+ allowFreeformInput?: boolean;
422
+ }
423
+ /** Multi-select question within a session input request. */
424
+ interface ISessionInputMultiSelectQuestion extends ISessionInputQuestionBase {
425
+ kind: SessionInputQuestionKind.MultiSelect;
426
+ /** Options the user may select from */
427
+ options: ISessionInputOption[];
428
+ /** Whether the user may enter text in addition to selecting options */
429
+ allowFreeformInput?: boolean;
430
+ /** Minimum selected item count */
431
+ min?: number;
432
+ /** Maximum selected item count */
433
+ max?: number;
434
+ }
435
+ /**
436
+ * One question within a session input request.
437
+ *
438
+ * @category Session Input Types
439
+ */
440
+ type ISessionInputQuestion = ISessionInputTextQuestion | ISessionInputNumberQuestion | ISessionInputBooleanQuestion | ISessionInputSingleSelectQuestion | ISessionInputMultiSelectQuestion;
441
+ /**
442
+ * A live request for user input.
443
+ *
444
+ * The server creates or replaces requests with `session/inputRequested`.
445
+ * Clients sync drafts with `session/inputAnswerChanged` and complete requests
446
+ * with `session/inputCompleted`.
447
+ *
448
+ * @category Session Input Types
449
+ */
450
+ interface ISessionInputRequest {
451
+ /** Stable request identifier */
452
+ id: string;
453
+ /** Display message for the request as a whole */
454
+ message: string;
455
+ /** URL the user should review or open, for URL-style elicitations */
456
+ url?: URI;
457
+ /** Ordered questions to ask the user */
458
+ questions?: ISessionInputQuestion[];
459
+ /** Current draft or submitted answers, keyed by question ID */
460
+ answers?: Record<string, ISessionInputAnswer>;
297
461
  }
462
+ /**
463
+ * Answer value kind.
464
+ *
465
+ * @category Session Input Types
466
+ */
467
+ declare const enum SessionInputAnswerValueKind {
468
+ Text = "text",
469
+ Number = "number",
470
+ Boolean = "boolean",
471
+ Selected = "selected",
472
+ SelectedMany = "selected-many"
473
+ }
474
+ /**
475
+ * Value captured for one answer.
476
+ *
477
+ * @category Session Input Types
478
+ */
479
+ interface ISessionInputTextAnswerValue {
480
+ kind: SessionInputAnswerValueKind.Text;
481
+ value: string;
482
+ }
483
+ interface ISessionInputNumberAnswerValue {
484
+ kind: SessionInputAnswerValueKind.Number;
485
+ value: number;
486
+ }
487
+ interface ISessionInputBooleanAnswerValue {
488
+ kind: SessionInputAnswerValueKind.Boolean;
489
+ value: boolean;
490
+ }
491
+ interface ISessionInputSelectedAnswerValue {
492
+ kind: SessionInputAnswerValueKind.Selected;
493
+ value: string;
494
+ /** Free-form text entered instead of selecting an option */
495
+ freeformValues?: string[];
496
+ }
497
+ interface ISessionInputSelectedManyAnswerValue {
498
+ kind: SessionInputAnswerValueKind.SelectedMany;
499
+ value: string[];
500
+ /** Free-form text entered in addition to selected options */
501
+ freeformValues?: string[];
502
+ }
503
+ type ISessionInputAnswerValue = ISessionInputTextAnswerValue | ISessionInputNumberAnswerValue | ISessionInputBooleanAnswerValue | ISessionInputSelectedAnswerValue | ISessionInputSelectedManyAnswerValue;
504
+ interface ISessionInputAnswered {
505
+ /** Answer state */
506
+ state: SessionInputAnswerState.Draft | SessionInputAnswerState.Submitted;
507
+ /** Answer value */
508
+ value: ISessionInputAnswerValue;
509
+ }
510
+ interface ISessionInputSkipped {
511
+ /** Answer state */
512
+ state: SessionInputAnswerState.Skipped;
513
+ /** Free-form reason or value captured while skipping, if any */
514
+ freeformValues?: string[];
515
+ }
516
+ /**
517
+ * Answer lifecycle state.
518
+ *
519
+ * @category Session Input Types
520
+ */
521
+ declare const enum SessionInputAnswerState {
522
+ Draft = "draft",
523
+ Submitted = "submitted",
524
+ Skipped = "skipped"
525
+ }
526
+ /**
527
+ * Draft, submitted, or skipped answer for one question.
528
+ *
529
+ * @category Session Input Types
530
+ */
531
+ type ISessionInputAnswer = ISessionInputAnswered | ISessionInputSkipped;
298
532
  /**
299
533
  * How a turn ended.
300
534
  *
301
535
  * @category Turn Types
302
536
  */
303
- declare enum TurnState {
537
+ declare const enum TurnState {
304
538
  Complete = "complete",
305
539
  Cancelled = "cancelled",
306
540
  Error = "error"
@@ -310,7 +544,7 @@ declare enum TurnState {
310
544
  *
311
545
  * @category Turn Types
312
546
  */
313
- declare enum AttachmentType {
547
+ declare const enum AttachmentType {
314
548
  File = "file",
315
549
  Directory = "directory",
316
550
  Selection = "selection"
@@ -383,7 +617,7 @@ interface IMessageAttachment {
383
617
  *
384
618
  * @category Response Parts
385
619
  */
386
- declare enum ResponsePartKind {
620
+ declare const enum ResponsePartKind {
387
621
  Markdown = "markdown",
388
622
  ContentRef = "contentRef",
389
623
  ToolCall = "toolCall",
@@ -457,7 +691,7 @@ type IResponsePart = IMarkdownResponsePart | IResourceReponsePart | IToolCallRes
457
691
  *
458
692
  * @category Tool Call Types
459
693
  */
460
- declare enum ToolCallStatus {
694
+ declare const enum ToolCallStatus {
461
695
  Streaming = "streaming",
462
696
  PendingConfirmation = "pending-confirmation",
463
697
  Running = "running",
@@ -474,7 +708,7 @@ declare enum ToolCallStatus {
474
708
  *
475
709
  * @category Tool Call Types
476
710
  */
477
- declare enum ToolCallConfirmationReason {
711
+ declare const enum ToolCallConfirmationReason {
478
712
  NotNeeded = "not-needed",
479
713
  UserAction = "user-action",
480
714
  Setting = "setting"
@@ -484,7 +718,7 @@ declare enum ToolCallConfirmationReason {
484
718
  *
485
719
  * @category Tool Call Types
486
720
  */
487
- declare enum ToolCallCancellationReason {
721
+ declare const enum ToolCallCancellationReason {
488
722
  Denied = "denied",
489
723
  Skipped = "skipped",
490
724
  ResultDenied = "result-denied"
@@ -595,6 +829,13 @@ interface IToolCallRunningState extends IToolCallBase, IToolCallParameterFields
595
829
  status: ToolCallStatus.Running;
596
830
  /** How the tool was confirmed for execution */
597
831
  confirmed: ToolCallConfirmationReason;
832
+ /**
833
+ * Partial content produced while the tool is still executing.
834
+ *
835
+ * For example, a terminal content block lets clients subscribe to live
836
+ * output before the tool completes.
837
+ */
838
+ content?: IToolResultContent[];
598
839
  }
599
840
  /**
600
841
  * Tool finished executing, waiting for client to approve the result.
@@ -709,11 +950,13 @@ interface IToolAnnotations {
709
950
  *
710
951
  * @category Tool Result Content
711
952
  */
712
- declare enum ToolResultContentType {
953
+ declare const enum ToolResultContentType {
713
954
  Text = "text",
714
955
  EmbeddedResource = "embeddedResource",
715
956
  Resource = "resource",
716
- FileEdit = "fileEdit"
957
+ FileEdit = "fileEdit",
958
+ Terminal = "terminal",
959
+ Subagent = "subagent"
717
960
  }
718
961
  /**
719
962
  * Text content in a tool result.
@@ -783,16 +1026,52 @@ interface IToolResultFileEditContent {
783
1026
  removed?: number;
784
1027
  };
785
1028
  }
1029
+ /**
1030
+ * A reference to a terminal whose output is relevant to this tool result.
1031
+ *
1032
+ * Clients can subscribe to the terminal's URI to stream its output in real
1033
+ * time, providing live feedback while a tool is executing.
1034
+ *
1035
+ * @category Tool Result Content
1036
+ */
1037
+ interface IToolResultTerminalContent {
1038
+ type: ToolResultContentType.Terminal;
1039
+ /** Terminal URI (subscribable for full terminal state) */
1040
+ resource: URI;
1041
+ /** Display title for the terminal content */
1042
+ title: string;
1043
+ }
1044
+ /**
1045
+ * A reference to a subagent session spawned by a tool.
1046
+ *
1047
+ * Clients can subscribe to the subagent's session URI to stream its
1048
+ * progress in real time, including inner tool calls and responses.
1049
+ *
1050
+ * @category Tool Result Content
1051
+ */
1052
+ interface IToolResultSubagentContent {
1053
+ type: ToolResultContentType.Subagent;
1054
+ /** Subagent session URI (subscribable for full session state) */
1055
+ resource: URI;
1056
+ /** Display title for the subagent */
1057
+ title: string;
1058
+ /** Internal agent name */
1059
+ agentName?: string;
1060
+ /** Human-readable description of the subagent's task */
1061
+ description?: string;
1062
+ }
786
1063
  /**
787
1064
  * Content block in a tool result.
788
1065
  *
789
1066
  * Mirrors the content blocks in MCP `CallToolResult.content`, plus
790
- * `IToolResultResourceContent` for lazy-loading large results and
791
- * `IToolResultFileEditContent` for file edit diffs (AHP extensions).
1067
+ * `IToolResultResourceContent` for lazy-loading large results,
1068
+ * `IToolResultFileEditContent` for file edit diffs,
1069
+ * `IToolResultTerminalContent` for live terminal output, and
1070
+ * `IToolResultSubagentContent` for subagent sessions (AHP extensions).
792
1071
  *
793
1072
  * @category Tool Result Content
794
1073
  */
795
- type IToolResultContent = IToolResultTextContent | IToolResultEmbeddedResourceContent | IToolResultResourceContent | IToolResultFileEditContent;
1074
+ type IToolResultContent = IToolResultTextContent | IToolResultEmbeddedResourceContent | IToolResultResourceContent | IToolResultFileEditContent | IToolResultTerminalContent | IToolResultSubagentContent;
796
1075
  /**
797
1076
  * A reference to an [Open Plugins](https://open-plugins.com/) plugin.
798
1077
  *
@@ -824,7 +1103,7 @@ interface ICustomizationRef {
824
1103
  *
825
1104
  * @category Customization Types
826
1105
  */
827
- declare enum CustomizationStatus {
1106
+ declare const enum CustomizationStatus {
828
1107
  /** Plugin is being loaded */
829
1108
  Loading = "loading",
830
1109
  /** Plugin is fully operational */
@@ -854,6 +1133,87 @@ interface ISessionCustomization {
854
1133
  */
855
1134
  statusMessage?: string;
856
1135
  }
1136
+ /**
1137
+ * Lightweight terminal metadata exposed on the root state.
1138
+ *
1139
+ * @category Terminal Types
1140
+ */
1141
+ interface ITerminalInfo {
1142
+ /** Terminal URI (subscribable for full terminal state) */
1143
+ resource: URI;
1144
+ /** Human-readable terminal title */
1145
+ title: string;
1146
+ /** Who currently holds this terminal */
1147
+ claim: ITerminalClaim;
1148
+ /** Process exit code, if the terminal process has exited */
1149
+ exitCode?: number;
1150
+ }
1151
+ /**
1152
+ * Discriminant for terminal claim kinds.
1153
+ *
1154
+ * @category Terminal Types
1155
+ */
1156
+ declare const enum TerminalClaimKind {
1157
+ Client = "client",
1158
+ Session = "session"
1159
+ }
1160
+ /**
1161
+ * A terminal claimed by a connected client.
1162
+ *
1163
+ * @category Terminal Types
1164
+ */
1165
+ interface ITerminalClientClaim {
1166
+ /** Discriminant */
1167
+ kind: TerminalClaimKind.Client;
1168
+ /** The `clientId` of the claiming client */
1169
+ clientId: string;
1170
+ }
1171
+ /**
1172
+ * A terminal claimed by a session, optionally scoped to a specific turn or tool call.
1173
+ *
1174
+ * @category Terminal Types
1175
+ */
1176
+ interface ITerminalSessionClaim {
1177
+ /** Discriminant */
1178
+ kind: TerminalClaimKind.Session;
1179
+ /** Session URI that claimed the terminal */
1180
+ session: URI;
1181
+ /** Optional turn identifier within the session */
1182
+ turnId?: string;
1183
+ /** Optional tool call identifier within the turn */
1184
+ toolCallId?: string;
1185
+ }
1186
+ /**
1187
+ * Describes who currently holds a terminal. A terminal may be claimed by
1188
+ * either a connected client or a session (e.g. during a tool call).
1189
+ *
1190
+ * @category Terminal Types
1191
+ */
1192
+ type ITerminalClaim = ITerminalClientClaim | ITerminalSessionClaim;
1193
+ /**
1194
+ * Full state for a single terminal, loaded when a client subscribes to the terminal's URI.
1195
+ *
1196
+ * @category Terminal Types
1197
+ */
1198
+ interface ITerminalState {
1199
+ /** Human-readable terminal title */
1200
+ title: string;
1201
+ /** Current working directory of the terminal process */
1202
+ cwd?: URI;
1203
+ /** Terminal width in columns */
1204
+ cols?: number;
1205
+ /** Terminal height in rows */
1206
+ rows?: number;
1207
+ /**
1208
+ * Accumulated terminal output. May contain ANSI escape sequences.
1209
+ * The scrollback length is implementation-defined.
1210
+ */
1211
+ content: string;
1212
+ /** Process exit code, set when the terminal process exits */
1213
+ exitCode?: number;
1214
+ /** Who currently holds this terminal */
1215
+ claim: ITerminalClaim;
1216
+ }
857
1217
  /**
858
1218
  * @category Common Types
859
1219
  */
@@ -888,7 +1248,7 @@ interface ISnapshot {
888
1248
  /** The subscribed resource URI (e.g. `agenthost:/root` or `copilot:/<uuid>`) */
889
1249
  resource: URI;
890
1250
  /** The current state of the resource */
891
- state: IRootState | ISessionState;
1251
+ state: IRootState | ISessionState | ITerminalState;
892
1252
  /** The `serverSeq` at which this snapshot was taken. Subsequent actions will have `serverSeq > fromSeq`. */
893
1253
  fromSeq: number;
894
1254
  }
@@ -906,7 +1266,7 @@ interface ISnapshot {
906
1266
  *
907
1267
  * @category Actions
908
1268
  */
909
- declare enum ActionType {
1269
+ declare const enum ActionType {
910
1270
  RootAgentsChanged = "root/agentsChanged",
911
1271
  RootActiveSessionsChanged = "root/activeSessionsChanged",
912
1272
  SessionReady = "session/ready",
@@ -920,6 +1280,7 @@ declare enum ActionType {
920
1280
  SessionToolCallConfirmed = "session/toolCallConfirmed",
921
1281
  SessionToolCallComplete = "session/toolCallComplete",
922
1282
  SessionToolCallResultConfirmed = "session/toolCallResultConfirmed",
1283
+ SessionToolCallContentChanged = "session/toolCallContentChanged",
923
1284
  SessionTurnComplete = "session/turnComplete",
924
1285
  SessionTurnCancelled = "session/turnCancelled",
925
1286
  SessionError = "session/error",
@@ -933,9 +1294,24 @@ declare enum ActionType {
933
1294
  SessionPendingMessageSet = "session/pendingMessageSet",
934
1295
  SessionPendingMessageRemoved = "session/pendingMessageRemoved",
935
1296
  SessionQueuedMessagesReordered = "session/queuedMessagesReordered",
1297
+ SessionInputRequested = "session/inputRequested",
1298
+ SessionInputAnswerChanged = "session/inputAnswerChanged",
1299
+ SessionInputCompleted = "session/inputCompleted",
936
1300
  SessionCustomizationsChanged = "session/customizationsChanged",
937
1301
  SessionCustomizationToggled = "session/customizationToggled",
938
- SessionTruncated = "session/truncated"
1302
+ SessionTruncated = "session/truncated",
1303
+ SessionIsReadChanged = "session/isReadChanged",
1304
+ SessionIsDoneChanged = "session/isDoneChanged",
1305
+ SessionDiffsChanged = "session/diffsChanged",
1306
+ RootTerminalsChanged = "root/terminalsChanged",
1307
+ TerminalData = "terminal/data",
1308
+ TerminalInput = "terminal/input",
1309
+ TerminalResized = "terminal/resized",
1310
+ TerminalClaimed = "terminal/claimed",
1311
+ TerminalTitleChanged = "terminal/titleChanged",
1312
+ TerminalCwdChanged = "terminal/cwdChanged",
1313
+ TerminalExited = "terminal/exited",
1314
+ TerminalCleared = "terminal/cleared"
939
1315
  }
940
1316
  /**
941
1317
  * Identifies the client that originally dispatched an action.
@@ -998,6 +1374,20 @@ interface IRootActiveSessionsChangedAction {
998
1374
  /** Current count of active sessions */
999
1375
  activeSessions: number;
1000
1376
  }
1377
+ /**
1378
+ * Fired when the list of known terminals changes.
1379
+ *
1380
+ * Full-replacement semantics: the `terminals` array replaces the previous
1381
+ * `terminals` entirely.
1382
+ *
1383
+ * @category Root Actions
1384
+ * @version 1
1385
+ */
1386
+ interface IRootTerminalsChangedAction {
1387
+ type: ActionType.RootTerminalsChanged;
1388
+ /** Updated terminal list (full replacement) */
1389
+ terminals: ITerminalInfo[];
1390
+ }
1001
1391
  /**
1002
1392
  * Session backend initialized successfully.
1003
1393
  *
@@ -1219,6 +1609,21 @@ interface ISessionToolCallResultConfirmedAction extends IToolCallActionBase {
1219
1609
  /** Whether the result was approved */
1220
1610
  approved: boolean;
1221
1611
  }
1612
+ /**
1613
+ * Partial content produced while a tool is still executing.
1614
+ *
1615
+ * Replaces the `content` array on the running tool call state. Clients can
1616
+ * use this to display live feedback (e.g. a terminal reference) before the
1617
+ * tool completes.
1618
+ *
1619
+ * @category Session Actions
1620
+ * @version 1
1621
+ */
1622
+ interface ISessionToolCallContentChangedAction extends IToolCallActionBase {
1623
+ type: ActionType.SessionToolCallContentChanged;
1624
+ /** The current partial content for the running tool call */
1625
+ content: IToolResultContent[];
1626
+ }
1222
1627
  /**
1223
1628
  * Turn finished — the assistant is idle.
1224
1629
  *
@@ -1325,6 +1730,56 @@ interface ISessionModelChangedAction {
1325
1730
  /** New model ID */
1326
1731
  model: string;
1327
1732
  }
1733
+ /**
1734
+ * The read state of the session changed.
1735
+ *
1736
+ * Dispatched by a client to mark a session as read (e.g. after viewing it)
1737
+ * or unread (e.g. after new activity since the client last looked at it).
1738
+ *
1739
+ * @category Session Actions
1740
+ * @version 1
1741
+ * @clientDispatchable
1742
+ */
1743
+ interface ISessionIsReadChangedAction {
1744
+ type: ActionType.SessionIsReadChanged;
1745
+ /** Session URI */
1746
+ session: URI;
1747
+ /** Whether the session has been read */
1748
+ isRead: boolean;
1749
+ }
1750
+ /**
1751
+ * The done state of the session changed.
1752
+ *
1753
+ * Dispatched by a client to mark a session as done (e.g. the task is
1754
+ * complete) or to reopen it.
1755
+ *
1756
+ * @category Session Actions
1757
+ * @version 1
1758
+ * @clientDispatchable
1759
+ */
1760
+ interface ISessionIsDoneChangedAction {
1761
+ type: ActionType.SessionIsDoneChanged;
1762
+ /** Session URI */
1763
+ session: URI;
1764
+ /** Whether the session is done */
1765
+ isDone: boolean;
1766
+ }
1767
+ /**
1768
+ * The file diffs for the session changed.
1769
+ *
1770
+ * Full-replacement semantics: the `diffs` array replaces the previous
1771
+ * `summary.diffs` entirely.
1772
+ *
1773
+ * @category Session Actions
1774
+ * @version 1
1775
+ */
1776
+ interface ISessionDiffsChangedAction {
1777
+ type: ActionType.SessionDiffsChanged;
1778
+ /** Session URI */
1779
+ session: URI;
1780
+ /** Updated file diffs for the session */
1781
+ diffs: ISessionFileDiff[];
1782
+ }
1328
1783
  /**
1329
1784
  * Server tools for this session have changed.
1330
1785
  *
@@ -1498,10 +1953,201 @@ interface ISessionQueuedMessagesReorderedAction {
1498
1953
  /** Queued message IDs in the desired order */
1499
1954
  order: string[];
1500
1955
  }
1956
+ /**
1957
+ * A session requested input from the user.
1958
+ *
1959
+ * Full-request upsert semantics: the `request` replaces any existing request
1960
+ * with the same `id`, or is appended if it is new. Answer drafts are preserved
1961
+ * unless `request.answers` is provided.
1962
+ *
1963
+ * @category Session Actions
1964
+ * @version 1
1965
+ */
1966
+ interface ISessionInputRequestedAction {
1967
+ type: ActionType.SessionInputRequested;
1968
+ /** Session URI */
1969
+ session: URI;
1970
+ /** Input request to create or replace */
1971
+ request: ISessionInputRequest;
1972
+ }
1973
+ /**
1974
+ * A client updated, submitted, skipped, or removed a single in-progress answer.
1975
+ *
1976
+ * Dispatching with `answer: undefined` removes that question's answer draft.
1977
+ *
1978
+ * @category Session Actions
1979
+ * @version 1
1980
+ * @clientDispatchable
1981
+ */
1982
+ interface ISessionInputAnswerChangedAction {
1983
+ type: ActionType.SessionInputAnswerChanged;
1984
+ /** Session URI */
1985
+ session: URI;
1986
+ /** Input request identifier */
1987
+ requestId: string;
1988
+ /** Question identifier within the input request */
1989
+ questionId: string;
1990
+ /** Updated answer, or `undefined` to clear an answer draft */
1991
+ answer?: ISessionInputAnswer;
1992
+ }
1993
+ /**
1994
+ * A client accepted, declined, or cancelled a session input request.
1995
+ *
1996
+ * If accepted, the server uses `answers` (when provided) plus the request's
1997
+ * synced answer state to resume the blocked operation.
1998
+ *
1999
+ * @category Session Actions
2000
+ * @version 1
2001
+ * @clientDispatchable
2002
+ */
2003
+ interface ISessionInputCompletedAction {
2004
+ type: ActionType.SessionInputCompleted;
2005
+ /** Session URI */
2006
+ session: URI;
2007
+ /** Input request identifier */
2008
+ requestId: string;
2009
+ /** Completion outcome */
2010
+ response: SessionInputResponseKind;
2011
+ /** Optional final answer replacement, keyed by question ID */
2012
+ answers?: Record<string, ISessionInputAnswer>;
2013
+ }
2014
+ /**
2015
+ * Terminal output data (pty → client direction).
2016
+ *
2017
+ * Appends `data` to the terminal's `content` in the reducer.
2018
+ *
2019
+ * `terminal/data` and `terminal/input` are intentionally separate actions
2020
+ * because standard write-ahead reconciliation is not safe for terminal I/O.
2021
+ * A pty is a stateful, mutable process — optimistically applying input or
2022
+ * predicting output would produce incorrect state. Instead, `terminal/input`
2023
+ * is a side-effect-only action (client → server → pty), and `terminal/data`
2024
+ * is server-authoritative output (pty → server → client).
2025
+ *
2026
+ * @category Terminal Actions
2027
+ * @version 1
2028
+ */
2029
+ interface ITerminalDataAction {
2030
+ type: ActionType.TerminalData;
2031
+ /** Terminal URI */
2032
+ terminal: URI;
2033
+ /** Output data (may contain ANSI escape sequences) */
2034
+ data: string;
2035
+ }
2036
+ /**
2037
+ * Keyboard input sent to the terminal process (client → pty direction).
2038
+ *
2039
+ * This is a side-effect-only action: the server forwards the data to the
2040
+ * terminal's pty. The reducer treats this as a no-op since `terminal/data`
2041
+ * actions will reflect any resulting output.
2042
+ *
2043
+ * See `terminal/data` for why these two actions are kept separate.
2044
+ *
2045
+ * @category Terminal Actions
2046
+ * @version 1
2047
+ * @clientDispatchable
2048
+ */
2049
+ interface ITerminalInputAction {
2050
+ type: ActionType.TerminalInput;
2051
+ /** Terminal URI */
2052
+ terminal: URI;
2053
+ /** Input data to send to the pty */
2054
+ data: string;
2055
+ }
2056
+ /**
2057
+ * Terminal dimensions changed.
2058
+ *
2059
+ * Dispatchable by clients to request a resize, or by the server to inform
2060
+ * clients of the actual terminal dimensions.
2061
+ *
2062
+ * @category Terminal Actions
2063
+ * @version 1
2064
+ * @clientDispatchable
2065
+ */
2066
+ interface ITerminalResizedAction {
2067
+ type: ActionType.TerminalResized;
2068
+ /** Terminal URI */
2069
+ terminal: URI;
2070
+ /** Terminal width in columns */
2071
+ cols: number;
2072
+ /** Terminal height in rows */
2073
+ rows: number;
2074
+ }
2075
+ /**
2076
+ * Terminal claim changed. A client or session transfers ownership of the terminal.
2077
+ *
2078
+ * The server SHOULD reject if the dispatching client does not currently hold
2079
+ * the claim.
2080
+ *
2081
+ * @category Terminal Actions
2082
+ * @version 1
2083
+ * @clientDispatchable
2084
+ */
2085
+ interface ITerminalClaimedAction {
2086
+ type: ActionType.TerminalClaimed;
2087
+ /** Terminal URI */
2088
+ terminal: URI;
2089
+ /** The new claim */
2090
+ claim: ITerminalClaim;
2091
+ }
2092
+ /**
2093
+ * Terminal title changed.
2094
+ *
2095
+ * Fired by the server when the terminal process updates its title (e.g. via
2096
+ * escape sequences), or dispatched by a client to rename a terminal.
2097
+ *
2098
+ * @category Terminal Actions
2099
+ * @version 1
2100
+ * @clientDispatchable
2101
+ */
2102
+ interface ITerminalTitleChangedAction {
2103
+ type: ActionType.TerminalTitleChanged;
2104
+ /** Terminal URI */
2105
+ terminal: URI;
2106
+ /** New terminal title */
2107
+ title: string;
2108
+ }
2109
+ /**
2110
+ * Terminal working directory changed.
2111
+ *
2112
+ * @category Terminal Actions
2113
+ * @version 1
2114
+ */
2115
+ interface ITerminalCwdChangedAction {
2116
+ type: ActionType.TerminalCwdChanged;
2117
+ /** Terminal URI */
2118
+ terminal: URI;
2119
+ /** New working directory */
2120
+ cwd: URI;
2121
+ }
2122
+ /**
2123
+ * Terminal process exited.
2124
+ *
2125
+ * @category Terminal Actions
2126
+ * @version 1
2127
+ */
2128
+ interface ITerminalExitedAction {
2129
+ type: ActionType.TerminalExited;
2130
+ /** Terminal URI */
2131
+ terminal: URI;
2132
+ /** Process exit code. `undefined` if the process was killed without an exit code. */
2133
+ exitCode?: number;
2134
+ }
2135
+ /**
2136
+ * Terminal scrollback buffer cleared.
2137
+ *
2138
+ * @category Terminal Actions
2139
+ * @version 1
2140
+ * @clientDispatchable
2141
+ */
2142
+ interface ITerminalClearedAction {
2143
+ type: ActionType.TerminalCleared;
2144
+ /** Terminal URI */
2145
+ terminal: URI;
2146
+ }
1501
2147
  /**
1502
2148
  * Discriminated union of all state actions.
1503
2149
  */
1504
- type IStateAction = IRootAgentsChangedAction | IRootActiveSessionsChangedAction | ISessionReadyAction | ISessionCreationFailedAction | ISessionTurnStartedAction | ISessionDeltaAction | ISessionResponsePartAction | ISessionToolCallStartAction | ISessionToolCallDeltaAction | ISessionToolCallReadyAction | ISessionToolCallConfirmedAction | ISessionToolCallCompleteAction | ISessionToolCallResultConfirmedAction | ISessionTurnCompleteAction | ISessionTurnCancelledAction | ISessionErrorAction | ISessionTitleChangedAction | ISessionUsageAction | ISessionReasoningAction | ISessionModelChangedAction | ISessionServerToolsChangedAction | ISessionActiveClientChangedAction | ISessionActiveClientToolsChangedAction | ISessionPendingMessageSetAction | ISessionPendingMessageRemovedAction | ISessionQueuedMessagesReorderedAction | ISessionCustomizationsChangedAction | ISessionCustomizationToggledAction | ISessionTruncatedAction;
2150
+ type IStateAction = IRootAgentsChangedAction | IRootActiveSessionsChangedAction | IRootTerminalsChangedAction | ISessionReadyAction | ISessionCreationFailedAction | ISessionTurnStartedAction | ISessionDeltaAction | ISessionResponsePartAction | ISessionToolCallStartAction | ISessionToolCallDeltaAction | ISessionToolCallReadyAction | ISessionToolCallConfirmedAction | ISessionToolCallCompleteAction | ISessionToolCallResultConfirmedAction | ISessionToolCallContentChangedAction | ISessionTurnCompleteAction | ISessionTurnCancelledAction | ISessionErrorAction | ISessionTitleChangedAction | ISessionUsageAction | ISessionReasoningAction | ISessionModelChangedAction | ISessionServerToolsChangedAction | ISessionActiveClientChangedAction | ISessionActiveClientToolsChangedAction | ISessionPendingMessageSetAction | ISessionPendingMessageRemovedAction | ISessionQueuedMessagesReorderedAction | ISessionInputRequestedAction | ISessionInputAnswerChangedAction | ISessionInputCompletedAction | ISessionCustomizationsChangedAction | ISessionCustomizationToggledAction | ISessionTruncatedAction | ISessionIsReadChangedAction | ISessionIsDoneChangedAction | ISessionDiffsChangedAction | ITerminalDataAction | ITerminalInputAction | ITerminalResizedAction | ITerminalClaimedAction | ITerminalTitleChangedAction | ITerminalCwdChangedAction | ITerminalExitedAction | ITerminalClearedAction;
1505
2151
 
1506
2152
  /**
1507
2153
  * Command Types — Source of truth for all AHP command (JSON-RPC request) definitions.
@@ -1551,7 +2197,7 @@ interface IInitializeResult {
1551
2197
  *
1552
2198
  * @category Commands
1553
2199
  */
1554
- declare enum ReconnectResultType {
2200
+ declare const enum ReconnectResultType {
1555
2201
  Replay = "replay",
1556
2202
  Snapshot = "snapshot"
1557
2203
  }
@@ -1691,6 +2337,49 @@ interface IDisposeSessionParams {
1691
2337
  /** Session URI to dispose */
1692
2338
  session: URI;
1693
2339
  }
2340
+ /**
2341
+ * Creates a new terminal on the server.
2342
+ *
2343
+ * After creation, the client should subscribe to the terminal URI to receive
2344
+ * state updates. The server dispatches `root/terminalsChanged` to update the
2345
+ * root terminal list.
2346
+ *
2347
+ * @category Commands
2348
+ * @method createTerminal
2349
+ * @direction Client → Server
2350
+ * @messageType Request
2351
+ * @version 1
2352
+ */
2353
+ interface ICreateTerminalParams {
2354
+ /** Terminal URI (client-chosen) */
2355
+ terminal: URI;
2356
+ /** Initial owner of the terminal */
2357
+ claim: ITerminalClaim;
2358
+ /** Human-readable terminal name */
2359
+ name?: string;
2360
+ /** Initial working directory URI */
2361
+ cwd?: URI;
2362
+ /** Initial terminal width in columns */
2363
+ cols?: number;
2364
+ /** Initial terminal height in rows */
2365
+ rows?: number;
2366
+ }
2367
+ /**
2368
+ * Disposes a terminal and kills its process if still running.
2369
+ *
2370
+ * The server dispatches `root/terminalsChanged` to remove the terminal from
2371
+ * the root terminal list.
2372
+ *
2373
+ * @category Commands
2374
+ * @method disposeTerminal
2375
+ * @direction Client → Server
2376
+ * @messageType Request
2377
+ * @version 1
2378
+ */
2379
+ interface IDisposeTerminalParams {
2380
+ /** Terminal URI to dispose */
2381
+ terminal: URI;
2382
+ }
1694
2383
  /**
1695
2384
  * Returns a list of session summaries. Used to populate session lists and sidebars.
1696
2385
  *
@@ -1718,7 +2407,7 @@ interface IListSessionsResult {
1718
2407
  *
1719
2408
  * @category Commands
1720
2409
  */
1721
- declare enum ContentEncoding {
2410
+ declare const enum ContentEncoding {
1722
2411
  Base64 = "base64",
1723
2412
  Utf8 = "utf-8"
1724
2413
  }
@@ -2058,7 +2747,7 @@ interface IAuthenticateResult {
2058
2747
  *
2059
2748
  * @category Protocol Notifications
2060
2749
  */
2061
- declare enum AuthRequiredReason {
2750
+ declare const enum AuthRequiredReason {
2062
2751
  /** The client has not yet authenticated for the resource */
2063
2752
  Required = "required",
2064
2753
  /** A previously valid token has expired or been revoked */
@@ -2069,9 +2758,10 @@ declare enum AuthRequiredReason {
2069
2758
  *
2070
2759
  * @category Protocol Notifications
2071
2760
  */
2072
- declare enum NotificationType {
2761
+ declare const enum NotificationType {
2073
2762
  SessionAdded = "notify/sessionAdded",
2074
2763
  SessionRemoved = "notify/sessionRemoved",
2764
+ SessionSummaryChanged = "notify/sessionSummaryChanged",
2075
2765
  AuthRequired = "notify/authRequired"
2076
2766
  }
2077
2767
  /**
@@ -2091,7 +2781,7 @@ declare enum NotificationType {
2091
2781
  * "resource": "copilot:/<uuid>",
2092
2782
  * "provider": "copilot",
2093
2783
  * "title": "New Session",
2094
- * "status": "idle",
2784
+ * "status": 1,
2095
2785
  * "createdAt": 1710000000000,
2096
2786
  * "modifiedAt": 1710000000000
2097
2787
  * }
@@ -2129,6 +2819,70 @@ interface ISessionRemovedNotification {
2129
2819
  /** URI of the removed session */
2130
2820
  session: URI;
2131
2821
  }
2822
+ /**
2823
+ * Broadcast to all connected clients when an existing session's summary
2824
+ * changes (title, status, `modifiedAt`, model, working directory, read/done
2825
+ * state, or diff statistics).
2826
+ *
2827
+ * This notification lets clients that maintain a cached session list — for
2828
+ * example, the result of a previous `listSessions()` call — stay in sync with
2829
+ * in-flight sessions without having to subscribe to every session URI
2830
+ * individually. It is complementary to, not a replacement for,
2831
+ * `notify/sessionAdded` and `notify/sessionRemoved`: those signal lifecycle
2832
+ * (creation/disposal), while this signals summary-level mutations on an
2833
+ * already-known session.
2834
+ *
2835
+ * Semantics:
2836
+ *
2837
+ * - Only fields present in `changes` have new values; omitted fields are
2838
+ * unchanged on the client's cached summary.
2839
+ * - Identity fields (`resource`, `provider`, `createdAt`) never change and
2840
+ * are not carried.
2841
+ * - Like all protocol notifications, this is ephemeral: it is **not**
2842
+ * replayed on reconnect. On reconnect, clients should re-fetch the full
2843
+ * catalog via `listSessions()` as usual.
2844
+ * - The server SHOULD emit this notification whenever any mutable field on
2845
+ * {@link ISessionSummary | `ISessionSummary`} changes for a session the
2846
+ * server has surfaced via `listSessions()` or `notify/sessionAdded`.
2847
+ * Servers MAY coalesce or debounce updates for noisy fields (for example,
2848
+ * `modifiedAt` bumps while a turn is streaming, or rapidly changing
2849
+ * `diffs`) at their discretion.
2850
+ * - Clients that have no cached entry for `session` MAY ignore the
2851
+ * notification; it is not a substitute for `notify/sessionAdded`.
2852
+ *
2853
+ * @category Protocol Notifications
2854
+ * @version 1
2855
+ * @example
2856
+ * ```json
2857
+ * {
2858
+ * "jsonrpc": "2.0",
2859
+ * "method": "notification",
2860
+ * "params": {
2861
+ * "notification": {
2862
+ * "type": "notify/sessionSummaryChanged",
2863
+ * "session": "copilot:/<uuid>",
2864
+ * "changes": {
2865
+ * "title": "Refactor auth middleware",
2866
+ * "status": 8,
2867
+ * "modifiedAt": 1710000123456
2868
+ * }
2869
+ * }
2870
+ * }
2871
+ * }
2872
+ * ```
2873
+ */
2874
+ interface ISessionSummaryChangedNotification {
2875
+ type: NotificationType.SessionSummaryChanged;
2876
+ /** URI of the session whose summary changed */
2877
+ session: URI;
2878
+ /**
2879
+ * Mutable summary fields that changed; omitted fields are unchanged.
2880
+ *
2881
+ * Identity fields (`resource`, `provider`, `createdAt`) never change and
2882
+ * MUST be omitted by senders; receivers SHOULD ignore them if present.
2883
+ */
2884
+ changes: Partial<ISessionSummary>;
2885
+ }
2132
2886
  /**
2133
2887
  * Sent by the server when a protected resource requires (re-)authentication.
2134
2888
  *
@@ -2165,7 +2919,7 @@ interface IAuthRequiredNotification {
2165
2919
  /**
2166
2920
  * Discriminated union of all protocol notifications.
2167
2921
  */
2168
- type IProtocolNotification = ISessionAddedNotification | ISessionRemovedNotification | IAuthRequiredNotification;
2922
+ type IProtocolNotification = ISessionAddedNotification | ISessionRemovedNotification | ISessionSummaryChangedNotification | IAuthRequiredNotification;
2169
2923
 
2170
2924
  /**
2171
2925
  * Message Types — Fully typed JSON-RPC message definitions for the AHP wire protocol.
@@ -2202,6 +2956,14 @@ interface ICommandMap {
2202
2956
  params: IDisposeSessionParams;
2203
2957
  result: null;
2204
2958
  };
2959
+ 'createTerminal': {
2960
+ params: ICreateTerminalParams;
2961
+ result: null;
2962
+ };
2963
+ 'disposeTerminal': {
2964
+ params: IDisposeTerminalParams;
2965
+ result: null;
2966
+ };
2205
2967
  'listSessions': {
2206
2968
  params: IListSessionsParams;
2207
2969
  result: IListSessionsResult;
@@ -2449,6 +3211,7 @@ declare class SessionHandle extends EventEmitter<SessionHandleEvents> {
2449
3211
  declare class StateMirror {
2450
3212
  private rootState;
2451
3213
  private sessions;
3214
+ private terminals;
2452
3215
  private serverSeq;
2453
3216
  private pendingActions;
2454
3217
  /** Current root state (agents, active session count). */
@@ -2459,6 +3222,12 @@ declare class StateMirror {
2459
3222
  getSession(uri: URI): ISessionState | undefined;
2460
3223
  /** All tracked session URIs. */
2461
3224
  get sessionUris(): URI[];
3225
+ /** Get a terminal state by URI. */
3226
+ getTerminal(uri: URI): ITerminalState | undefined;
3227
+ /** All tracked terminal URIs. */
3228
+ get terminalUris(): URI[];
3229
+ /** Remove a terminal from tracking. */
3230
+ removeTerminal(uri: URI): void;
2462
3231
  /**
2463
3232
  * Load a snapshot (from initialize, reconnect, or subscribe).
2464
3233
  * After registering a session, replays any actions that arrived before the snapshot.
@@ -2668,6 +3437,19 @@ declare class AhpClient extends EventEmitter<AhpClientEvents> {
2668
3437
  * Dispose a session and clean up server-side resources.
2669
3438
  */
2670
3439
  disposeSession(sessionUri: URI): Promise<null>;
3440
+ /**
3441
+ * Create a new terminal on the server.
3442
+ */
3443
+ createTerminal(terminalUri: string, claim: ITerminalClaim, options?: {
3444
+ name?: string;
3445
+ cwd?: string;
3446
+ cols?: number;
3447
+ rows?: number;
3448
+ }): Promise<null>;
3449
+ /**
3450
+ * Dispose a terminal and kill its process if still running.
3451
+ */
3452
+ disposeTerminal(terminalUri: string): Promise<null>;
2671
3453
  /**
2672
3454
  * List all sessions on the server.
2673
3455
  */
@@ -3396,4 +4178,22 @@ declare function ensureFileUri(pathOrUri: string): string;
3396
4178
  */
3397
4179
  declare function fileUriToDisplayPath(uri: string): string;
3398
4180
 
3399
- export { ActionType, ActiveClientManager, AhpClient, type AhpClientEvents, type AhpClientOptions, type AhpxEvent, AttachmentType, AuthHandler, type AuthHandlerOptions, AuthRequiredReason, ConnectionPool, type ConnectionPoolOptions, type ConnectionProfile, ContentEncoding, CustomizationStatus, type EventForwarder, FleetManager, type FleetManagerOptions, ForwardingFormatter, type ForwardingFormatterOptions, HealthChecker, type IActionEnvelope, type IActiveTurn, type IAgentInfo, type ICreateSessionParams, type ICustomizationRef, type IErrorInfo, type IFetchTurnsResult, type IInitializeResult, type IListSessionsResult, type IMarkdownResponsePart, type IPendingMessage, type IProtocolNotification, type IReasoningResponsePart, type IResourceCopyParams, type IResourceCopyResult, type IResourceDeleteParams, type IResourceDeleteResult, type IResourceListResult, type IResourceMoveParams, type IResourceMoveResult, type IResourceReadResult, type IResourceWriteParams, type IResourceWriteResult, type IResponsePart, type IRootState, type ISessionCustomization, type ISessionForkSource, type ISessionState, type ISessionSummary, type ISnapshot, type IStateAction, type ISubscribeResult, type IToolAnnotations, type IToolCallResponsePart, type IToolCallState, type IToolDefinition, type ITurn, type IUsageInfo, type IUserMessage, type Icon, NotificationType, type OpenSessionOptions, PendingMessageKind, PolicyState, type PromptOptions, ProtocolLayer, type ProtocolLayerOptions, ReconnectManager, type ReconnectOptions, type ReconnectOutcome, ReconnectResultType, ResponsePartKind, type ResumeOutcome, type RoutingStrategy, RpcError, RpcTimeoutError, type ServerHealth, type ServerRequirements, type SessionFilter, SessionHandle, type SessionHandleEvents, SessionLifecycle, SessionPersistence, type SessionRecord, SessionStatus, SessionStore, type TurnResult as SessionTurnResult, StateMirror, type SyncResult, ToolCallCancellationReason, ToolCallConfirmationReason, ToolCallStatus, ToolResultContentType, Transport, type TransportOptions, TurnState, type TurnSummary, type URI, WebSocketForwarder, type WebSocketForwarderOptions, WebhookForwarder, type WebhookForwarderOptions, buildTurnSummary, ensureFileUri, fileUriToDisplayPath, truncatePreview };
4181
+ /** Union of all terminal-scoped actions. */
4182
+ type ITerminalAction = ITerminalDataAction | ITerminalInputAction | ITerminalResizedAction | ITerminalClaimedAction | ITerminalTitleChangedAction | ITerminalCwdChangedAction | ITerminalExitedAction | ITerminalClearedAction;
4183
+ /** Union of terminal actions that clients may dispatch. */
4184
+ type IClientTerminalAction = ITerminalInputAction | ITerminalResizedAction | ITerminalClaimedAction | ITerminalTitleChangedAction | ITerminalClearedAction;
4185
+ /** Union of terminal actions that only the server may produce. */
4186
+ type IServerTerminalAction = ITerminalDataAction | ITerminalCwdChangedAction | ITerminalExitedAction;
4187
+
4188
+ /**
4189
+ * Reducer Functions — Pure state reducers for AHP root, session, and terminal state.
4190
+ *
4191
+ * @module reducers
4192
+ */
4193
+
4194
+ /**
4195
+ * Pure reducer for terminal state. Handles all {@link ITerminalAction} variants.
4196
+ */
4197
+ declare function terminalReducer(state: ITerminalState, action: ITerminalAction, log?: (msg: string) => void): ITerminalState;
4198
+
4199
+ export { ActionType, ActiveClientManager, AhpClient, type AhpClientEvents, type AhpClientOptions, type AhpxEvent, AttachmentType, AuthHandler, type AuthHandlerOptions, AuthRequiredReason, ConnectionPool, type ConnectionPoolOptions, type ConnectionProfile, ContentEncoding, type EventForwarder, FleetManager, type FleetManagerOptions, ForwardingFormatter, type ForwardingFormatterOptions, HealthChecker, type IActionEnvelope, type IActiveTurn, type IAgentInfo, type IClientTerminalAction, type ICreateSessionParams, type ICreateTerminalParams, type ICustomizationRef, type IDisposeTerminalParams, type IErrorInfo, type IFetchTurnsResult, type IInitializeResult, type IListSessionsResult, type IMarkdownResponsePart, type IPendingMessage, type IProjectInfo, type IProtocolNotification, type IReasoningResponsePart, type IResourceCopyParams, type IResourceCopyResult, type IResourceDeleteParams, type IResourceDeleteResult, type IResourceListResult, type IResourceMoveParams, type IResourceMoveResult, type IResourceReadResult, type IResourceWriteParams, type IResourceWriteResult, type IResponsePart, type IRootState, type IRootTerminalsChangedAction, type IServerTerminalAction, type ISessionCustomization, type ISessionDiffsChangedAction, type ISessionFileDiff, type ISessionForkSource, type ISessionInputAnswer, type ISessionInputAnswerChangedAction, type ISessionInputAnswerValue, type ISessionInputAnswered, type ISessionInputBooleanQuestion, type ISessionInputCompletedAction, type ISessionInputMultiSelectQuestion, type ISessionInputNumberQuestion, type ISessionInputOption, type ISessionInputQuestion, type ISessionInputRequest, type ISessionInputRequestedAction, type ISessionInputSingleSelectQuestion, type ISessionInputSkipped, type ISessionInputTextQuestion, type ISessionIsDoneChangedAction, type ISessionIsReadChangedAction, type ISessionState, type ISessionSummary, type ISessionSummaryChangedNotification, type ISessionToolCallContentChangedAction, type ISnapshot, type IStateAction, type ISubscribeResult, type ITerminalAction, type ITerminalClaim, type ITerminalClaimedAction, type ITerminalClearedAction, type ITerminalClientClaim, type ITerminalCwdChangedAction, type ITerminalDataAction, type ITerminalExitedAction, type ITerminalInfo, type ITerminalInputAction, type ITerminalResizedAction, type ITerminalSessionClaim, type ITerminalState, type ITerminalTitleChangedAction, type IToolAnnotations, type IToolCallResponsePart, type IToolCallState, type IToolDefinition, type IToolResultSubagentContent, type IToolResultTerminalContent, type ITurn, type IUsageInfo, type IUserMessage, type Icon, NotificationType, type OpenSessionOptions, PendingMessageKind, PolicyState, type PromptOptions, ProtocolLayer, type ProtocolLayerOptions, ReconnectManager, type ReconnectOptions, type ReconnectOutcome, ReconnectResultType, ResponsePartKind, type ResumeOutcome, type RoutingStrategy, RpcError, RpcTimeoutError, type ServerHealth, type ServerRequirements, type SessionFilter, SessionHandle, type SessionHandleEvents, SessionInputAnswerState, SessionInputAnswerValueKind, SessionInputQuestionKind, SessionInputResponseKind, SessionLifecycle, SessionPersistence, type SessionRecord, SessionStatus, SessionStore, type TurnResult as SessionTurnResult, StateMirror, type SyncResult, TerminalClaimKind, ToolCallCancellationReason, ToolCallConfirmationReason, ToolCallStatus, ToolResultContentType, Transport, type TransportOptions, TurnState, type TurnSummary, type URI, WebSocketForwarder, type WebSocketForwarderOptions, WebhookForwarder, type WebhookForwarderOptions, buildTurnSummary, ensureFileUri, fileUriToDisplayPath, terminalReducer, truncatePreview };