@codingame/monaco-vscode-xterm-common 30.0.1 → 31.0.1

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.
Files changed (30) hide show
  1. package/package.json +4 -4
  2. package/vscode/src/vs/platform/agentHost/common/state/protocol/actions.d.ts +990 -0
  3. package/vscode/src/vs/platform/agentHost/common/state/protocol/actions.js +56 -0
  4. package/vscode/src/vs/platform/agentHost/common/state/protocol/notifications.d.ts +179 -0
  5. package/vscode/src/vs/platform/agentHost/common/state/protocol/notifications.js +16 -0
  6. package/vscode/src/vs/platform/agentHost/common/state/protocol/state.d.ts +1418 -0
  7. package/vscode/src/vs/platform/agentHost/common/state/protocol/state.js +118 -0
  8. package/vscode/src/vs/platform/agentHost/common/state/sessionState.d.ts +76 -0
  9. package/vscode/src/vs/platform/agentHost/common/state/sessionState.js +20 -0
  10. package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostPty.d.ts +106 -0
  11. package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostPty.js +276 -0
  12. package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostTerminalService.d.ts +56 -0
  13. package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostTerminalService.js +237 -0
  14. package/vscode/src/vs/workbench/contrib/terminal/browser/ahpTerminalCommandSource.d.ts +111 -0
  15. package/vscode/src/vs/workbench/contrib/terminal/browser/ahpTerminalCommandSource.js +138 -0
  16. package/vscode/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.js +5 -5
  17. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalActions.js +61 -61
  18. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.d.ts +9 -2
  19. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.js +79 -40
  20. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.js +8 -4
  21. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTabsList.js +5 -5
  22. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTooltip.js +3 -3
  23. package/vscode/src/vs/workbench/contrib/terminal/common/basePty.d.ts +38 -0
  24. package/vscode/src/vs/workbench/contrib/terminal/common/basePty.js +127 -0
  25. package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry.js +3 -3
  26. package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.js +3 -3
  27. package/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.d.ts +0 -38
  28. package/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.js +0 -321
  29. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.d.ts +0 -59
  30. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.js +0 -70
@@ -0,0 +1,990 @@
1
+ import { ToolCallConfirmationReason, ToolCallCancellationReason, PendingMessageKind, type URI, type StringOrMarkdown, type IAgentInfo, type IErrorInfo, type IModelSelection, type IUserMessage, type IResponsePart, type IToolCallResult, type IToolResultContent, type IToolDefinition, type ISessionActiveClient, type IUsageInfo, type ISessionCustomization, type IFileEdit, type ISessionInputAnswer, type ISessionInputRequest, type ITerminalInfo, type ITerminalClaim, type SessionInputResponseKind } from "./state.js";
2
+ /**
3
+ * Discriminant values for all state actions.
4
+ *
5
+ * @category Actions
6
+ */
7
+ export declare enum ActionType {
8
+ RootAgentsChanged = "root/agentsChanged",
9
+ RootActiveSessionsChanged = "root/activeSessionsChanged",
10
+ SessionReady = "session/ready",
11
+ SessionCreationFailed = "session/creationFailed",
12
+ SessionTurnStarted = "session/turnStarted",
13
+ SessionDelta = "session/delta",
14
+ SessionResponsePart = "session/responsePart",
15
+ SessionToolCallStart = "session/toolCallStart",
16
+ SessionToolCallDelta = "session/toolCallDelta",
17
+ SessionToolCallReady = "session/toolCallReady",
18
+ SessionToolCallConfirmed = "session/toolCallConfirmed",
19
+ SessionToolCallComplete = "session/toolCallComplete",
20
+ SessionToolCallResultConfirmed = "session/toolCallResultConfirmed",
21
+ SessionToolCallContentChanged = "session/toolCallContentChanged",
22
+ SessionTurnComplete = "session/turnComplete",
23
+ SessionTurnCancelled = "session/turnCancelled",
24
+ SessionError = "session/error",
25
+ SessionTitleChanged = "session/titleChanged",
26
+ SessionUsage = "session/usage",
27
+ SessionReasoning = "session/reasoning",
28
+ SessionModelChanged = "session/modelChanged",
29
+ SessionServerToolsChanged = "session/serverToolsChanged",
30
+ SessionActiveClientChanged = "session/activeClientChanged",
31
+ SessionActiveClientToolsChanged = "session/activeClientToolsChanged",
32
+ SessionPendingMessageSet = "session/pendingMessageSet",
33
+ SessionPendingMessageRemoved = "session/pendingMessageRemoved",
34
+ SessionQueuedMessagesReordered = "session/queuedMessagesReordered",
35
+ SessionInputRequested = "session/inputRequested",
36
+ SessionInputAnswerChanged = "session/inputAnswerChanged",
37
+ SessionInputCompleted = "session/inputCompleted",
38
+ SessionCustomizationsChanged = "session/customizationsChanged",
39
+ SessionCustomizationToggled = "session/customizationToggled",
40
+ SessionTruncated = "session/truncated",
41
+ SessionIsReadChanged = "session/isReadChanged",
42
+ SessionIsDoneChanged = "session/isDoneChanged",
43
+ SessionDiffsChanged = "session/diffsChanged",
44
+ SessionConfigChanged = "session/configChanged",
45
+ RootTerminalsChanged = "root/terminalsChanged",
46
+ TerminalData = "terminal/data",
47
+ TerminalInput = "terminal/input",
48
+ TerminalResized = "terminal/resized",
49
+ TerminalClaimed = "terminal/claimed",
50
+ TerminalTitleChanged = "terminal/titleChanged",
51
+ TerminalCwdChanged = "terminal/cwdChanged",
52
+ TerminalExited = "terminal/exited",
53
+ TerminalCleared = "terminal/cleared",
54
+ TerminalCommandDetectionAvailable = "terminal/commandDetectionAvailable",
55
+ TerminalCommandExecuted = "terminal/commandExecuted",
56
+ TerminalCommandFinished = "terminal/commandFinished"
57
+ }
58
+ /**
59
+ * Identifies the client that originally dispatched an action.
60
+ */
61
+ export interface IActionOrigin {
62
+ clientId: string;
63
+ clientSeq: number;
64
+ }
65
+ /**
66
+ * Every action is wrapped in an `ActionEnvelope`.
67
+ */
68
+ export interface IActionEnvelope {
69
+ readonly action: IStateAction;
70
+ readonly serverSeq: number;
71
+ readonly origin: IActionOrigin | undefined;
72
+ readonly rejectionReason?: string;
73
+ }
74
+ /**
75
+ * Base interface for all tool-call-scoped actions, carrying the common
76
+ * session, turn, and tool call identifiers.
77
+ *
78
+ * @category Session Actions
79
+ */
80
+ interface IToolCallActionBase {
81
+ /** Session URI */
82
+ session: URI;
83
+ /** Turn identifier */
84
+ turnId: string;
85
+ /** Tool call identifier */
86
+ toolCallId: string;
87
+ /**
88
+ * Additional provider-specific metadata for this tool call.
89
+ *
90
+ * Clients MAY look for well-known keys here to provide enhanced UI.
91
+ * For example, a `ptyTerminal` key with `{ input: string; output: string }`
92
+ * indicates the tool operated on a terminal (both `input` and `output` may
93
+ * contain escape sequences).
94
+ */
95
+ _meta?: Record<string, unknown>;
96
+ }
97
+ /**
98
+ * Fired when available agent backends or their models change.
99
+ *
100
+ * @category Root Actions
101
+ * @version 1
102
+ */
103
+ export interface IRootAgentsChangedAction {
104
+ type: ActionType.RootAgentsChanged;
105
+ /** Updated agent list */
106
+ agents: IAgentInfo[];
107
+ }
108
+ /**
109
+ * Fired when the number of active sessions changes.
110
+ *
111
+ * @category Root Actions
112
+ * @version 1
113
+ */
114
+ export interface IRootActiveSessionsChangedAction {
115
+ type: ActionType.RootActiveSessionsChanged;
116
+ /** Current count of active sessions */
117
+ activeSessions: number;
118
+ }
119
+ /**
120
+ * Fired when the list of known terminals changes.
121
+ *
122
+ * Full-replacement semantics: the `terminals` array replaces the previous
123
+ * `terminals` entirely.
124
+ *
125
+ * @category Root Actions
126
+ * @version 1
127
+ */
128
+ export interface IRootTerminalsChangedAction {
129
+ type: ActionType.RootTerminalsChanged;
130
+ /** Updated terminal list (full replacement) */
131
+ terminals: ITerminalInfo[];
132
+ }
133
+ /**
134
+ * Session backend initialized successfully.
135
+ *
136
+ * @category Session Actions
137
+ * @version 1
138
+ */
139
+ export interface ISessionReadyAction {
140
+ type: ActionType.SessionReady;
141
+ /** Session URI */
142
+ session: URI;
143
+ }
144
+ /**
145
+ * Session backend failed to initialize.
146
+ *
147
+ * @category Session Actions
148
+ * @version 1
149
+ */
150
+ export interface ISessionCreationFailedAction {
151
+ type: ActionType.SessionCreationFailed;
152
+ /** Session URI */
153
+ session: URI;
154
+ /** Error details */
155
+ error: IErrorInfo;
156
+ }
157
+ /**
158
+ * User sent a message; server starts agent processing.
159
+ *
160
+ * @category Session Actions
161
+ * @version 1
162
+ * @clientDispatchable
163
+ */
164
+ export interface ISessionTurnStartedAction {
165
+ type: ActionType.SessionTurnStarted;
166
+ /** Session URI */
167
+ session: URI;
168
+ /** Turn identifier */
169
+ turnId: string;
170
+ /** User's message */
171
+ userMessage: IUserMessage;
172
+ /** If this turn was auto-started from a queued message, the ID of that message */
173
+ queuedMessageId?: string;
174
+ }
175
+ /**
176
+ * Streaming text chunk from the assistant, appended to a specific response part.
177
+ *
178
+ * The server MUST first emit a `session/responsePart` to create the target
179
+ * part (markdown or reasoning), then use this action to append text to it.
180
+ *
181
+ * @category Session Actions
182
+ * @version 1
183
+ */
184
+ export interface ISessionDeltaAction {
185
+ type: ActionType.SessionDelta;
186
+ /** Session URI */
187
+ session: URI;
188
+ /** Turn identifier */
189
+ turnId: string;
190
+ /** Identifier of the response part to append to */
191
+ partId: string;
192
+ /** Text chunk */
193
+ content: string;
194
+ }
195
+ /**
196
+ * Structured content appended to the response.
197
+ *
198
+ * @category Session Actions
199
+ * @version 1
200
+ */
201
+ export interface ISessionResponsePartAction {
202
+ type: ActionType.SessionResponsePart;
203
+ /** Session URI */
204
+ session: URI;
205
+ /** Turn identifier */
206
+ turnId: string;
207
+ /** Response part (markdown or content ref) */
208
+ part: IResponsePart;
209
+ }
210
+ /**
211
+ * A tool call begins — parameters are streaming from the LM.
212
+ *
213
+ * For client-provided tools, the server sets `toolClientId` to identify the
214
+ * owning client. That client is responsible for executing the tool once it
215
+ * reaches the `running` state and dispatching `session/toolCallComplete`.
216
+ *
217
+ * @category Session Actions
218
+ * @version 1
219
+ */
220
+ export interface ISessionToolCallStartAction extends IToolCallActionBase {
221
+ type: ActionType.SessionToolCallStart;
222
+ /** Internal tool name (for debugging/logging) */
223
+ toolName: string;
224
+ /** Human-readable tool name */
225
+ displayName: string;
226
+ /**
227
+ * If this tool is provided by a client, the `clientId` of the owning client.
228
+ * Absent for server-side tools.
229
+ */
230
+ toolClientId?: string;
231
+ }
232
+ /**
233
+ * Streaming partial parameters for a tool call.
234
+ *
235
+ * @category Session Actions
236
+ * @version 1
237
+ */
238
+ export interface ISessionToolCallDeltaAction extends IToolCallActionBase {
239
+ type: ActionType.SessionToolCallDelta;
240
+ /** Partial parameter content to append */
241
+ content: string;
242
+ /** Updated progress message */
243
+ invocationMessage?: StringOrMarkdown;
244
+ }
245
+ /**
246
+ * Tool call parameters are complete, or a running tool requires re-confirmation.
247
+ *
248
+ * When dispatched for a `streaming` tool call, transitions to `pending-confirmation`
249
+ * or directly to `running` if `confirmed` is set.
250
+ *
251
+ * When dispatched for a `running` tool call (e.g. mid-execution permission needed),
252
+ * transitions back to `pending-confirmation`. The `invocationMessage` and `_meta`
253
+ * SHOULD be updated to describe the specific confirmation needed. Clients use the
254
+ * standard `session/toolCallConfirmed` flow to approve or deny.
255
+ *
256
+ * For client-provided tools, the server typically sets `confirmed` to
257
+ * `'not-needed'` so the tool transitions directly to `running`, where the
258
+ * owning client can begin execution immediately.
259
+ *
260
+ * @category Session Actions
261
+ * @version 1
262
+ */
263
+ export interface ISessionToolCallReadyAction extends IToolCallActionBase {
264
+ type: ActionType.SessionToolCallReady;
265
+ /** Message describing what the tool will do or what confirmation is needed */
266
+ invocationMessage: StringOrMarkdown;
267
+ /** Raw tool input */
268
+ toolInput?: string;
269
+ /** Short title for the confirmation prompt (e.g. `"Run in terminal"`, `"Write file"`) */
270
+ confirmationTitle?: StringOrMarkdown;
271
+ /** File edits that this tool call will perform, for preview before confirmation */
272
+ edits?: {
273
+ items: IFileEdit[];
274
+ };
275
+ /** Whether the agent host allows the client to edit the tool's input parameters before confirming */
276
+ editable?: boolean;
277
+ /** If set, the tool was auto-confirmed and transitions directly to `running` */
278
+ confirmed?: ToolCallConfirmationReason;
279
+ }
280
+ /**
281
+ * Client approves a pending tool call. The tool transitions to `running`.
282
+ *
283
+ * @category Session Actions
284
+ * @version 1
285
+ * @clientDispatchable
286
+ */
287
+ export interface ISessionToolCallApprovedAction extends IToolCallActionBase {
288
+ type: ActionType.SessionToolCallConfirmed;
289
+ /** The tool call was approved */
290
+ approved: true;
291
+ /** How the tool was confirmed */
292
+ confirmed: ToolCallConfirmationReason;
293
+ /** Edited tool input parameters, if the client modified them before confirming */
294
+ editedToolInput?: string;
295
+ }
296
+ /**
297
+ * Client denies a pending tool call. The tool transitions to `cancelled`.
298
+ *
299
+ * For client-provided tools, the owning client MUST dispatch this if it does
300
+ * not recognize the tool or cannot execute it.
301
+ *
302
+ * @category Session Actions
303
+ * @version 1
304
+ * @clientDispatchable
305
+ */
306
+ export interface ISessionToolCallDeniedAction extends IToolCallActionBase {
307
+ type: ActionType.SessionToolCallConfirmed;
308
+ /** The tool call was denied */
309
+ approved: false;
310
+ /** Why the tool was cancelled */
311
+ reason: ToolCallCancellationReason.Denied | ToolCallCancellationReason.Skipped;
312
+ /** What the user suggested doing instead */
313
+ userSuggestion?: IUserMessage;
314
+ /** Optional explanation for the denial */
315
+ reasonMessage?: StringOrMarkdown;
316
+ }
317
+ /**
318
+ * Client confirms or denies a pending tool call.
319
+ *
320
+ * @category Session Actions
321
+ * @version 1
322
+ * @clientDispatchable
323
+ */
324
+ export type ISessionToolCallConfirmedAction = ISessionToolCallApprovedAction | ISessionToolCallDeniedAction;
325
+ /**
326
+ * Tool execution finished. Transitions to `completed` or `pending-result-confirmation`
327
+ * if `requiresResultConfirmation` is `true`.
328
+ *
329
+ * For client-provided tools (where `toolClientId` is set on the tool call state),
330
+ * the owning client dispatches this action with the execution result. The server
331
+ * SHOULD reject this action if the dispatching client does not match `toolClientId`.
332
+ *
333
+ * Servers waiting on a client tool call MAY time out after a reasonable duration
334
+ * if the implementing client disconnects or becomes unresponsive, and dispatch
335
+ * this action with `result.success = false` and an appropriate error.
336
+ *
337
+ * @category Session Actions
338
+ * @version 1
339
+ * @clientDispatchable
340
+ */
341
+ export interface ISessionToolCallCompleteAction extends IToolCallActionBase {
342
+ type: ActionType.SessionToolCallComplete;
343
+ /** Execution result */
344
+ result: IToolCallResult;
345
+ /** If true, the result requires client approval before finalizing */
346
+ requiresResultConfirmation?: boolean;
347
+ }
348
+ /**
349
+ * Client approves or denies a tool's result.
350
+ *
351
+ * If `approved` is `false`, the tool transitions to `cancelled` with reason `result-denied`.
352
+ *
353
+ * @category Session Actions
354
+ * @version 1
355
+ * @clientDispatchable
356
+ */
357
+ export interface ISessionToolCallResultConfirmedAction extends IToolCallActionBase {
358
+ type: ActionType.SessionToolCallResultConfirmed;
359
+ /** Whether the result was approved */
360
+ approved: boolean;
361
+ }
362
+ /**
363
+ * Partial content produced while a tool is still executing.
364
+ *
365
+ * Replaces the `content` array on the running tool call state. Clients can
366
+ * use this to display live feedback (e.g. a terminal reference) before the
367
+ * tool completes.
368
+ *
369
+ * For client-provided tools (where `toolClientId` is set on the tool call state),
370
+ * the owning client dispatches this action to stream intermediate content while
371
+ * executing. The server SHOULD reject this action if the dispatching client does
372
+ * not match `toolClientId`.
373
+ *
374
+ * @category Session Actions
375
+ * @version 1
376
+ * @clientDispatchable
377
+ */
378
+ export interface ISessionToolCallContentChangedAction extends IToolCallActionBase {
379
+ type: ActionType.SessionToolCallContentChanged;
380
+ /** The current partial content for the running tool call */
381
+ content: IToolResultContent[];
382
+ }
383
+ /**
384
+ * Turn finished — the assistant is idle.
385
+ *
386
+ * @category Session Actions
387
+ * @version 1
388
+ */
389
+ export interface ISessionTurnCompleteAction {
390
+ type: ActionType.SessionTurnComplete;
391
+ /** Session URI */
392
+ session: URI;
393
+ /** Turn identifier */
394
+ turnId: string;
395
+ }
396
+ /**
397
+ * Turn was aborted; server stops processing.
398
+ *
399
+ * @category Session Actions
400
+ * @version 1
401
+ * @clientDispatchable
402
+ */
403
+ export interface ISessionTurnCancelledAction {
404
+ type: ActionType.SessionTurnCancelled;
405
+ /** Session URI */
406
+ session: URI;
407
+ /** Turn identifier */
408
+ turnId: string;
409
+ }
410
+ /**
411
+ * Error during turn processing.
412
+ *
413
+ * @category Session Actions
414
+ * @version 1
415
+ */
416
+ export interface ISessionErrorAction {
417
+ type: ActionType.SessionError;
418
+ /** Session URI */
419
+ session: URI;
420
+ /** Turn identifier */
421
+ turnId: string;
422
+ /** Error details */
423
+ error: IErrorInfo;
424
+ }
425
+ /**
426
+ * Session title updated. Fired by the server when the title is auto-generated
427
+ * from conversation, or dispatched by a client to rename a session.
428
+ *
429
+ * @category Session Actions
430
+ * @clientDispatchable
431
+ * @version 1
432
+ */
433
+ export interface ISessionTitleChangedAction {
434
+ type: ActionType.SessionTitleChanged;
435
+ /** Session URI */
436
+ session: URI;
437
+ /** New title */
438
+ title: string;
439
+ }
440
+ /**
441
+ * Token usage report for a turn.
442
+ *
443
+ * @category Session Actions
444
+ * @version 1
445
+ */
446
+ export interface ISessionUsageAction {
447
+ type: ActionType.SessionUsage;
448
+ /** Session URI */
449
+ session: URI;
450
+ /** Turn identifier */
451
+ turnId: string;
452
+ /** Token usage data */
453
+ usage: IUsageInfo;
454
+ }
455
+ /**
456
+ * Reasoning/thinking text from the model, appended to a specific reasoning response part.
457
+ *
458
+ * The server MUST first emit a `session/responsePart` to create the target
459
+ * reasoning part, then use this action to append text to it.
460
+ *
461
+ * @category Session Actions
462
+ * @version 1
463
+ */
464
+ export interface ISessionReasoningAction {
465
+ type: ActionType.SessionReasoning;
466
+ /** Session URI */
467
+ session: URI;
468
+ /** Turn identifier */
469
+ turnId: string;
470
+ /** Identifier of the reasoning response part to append to */
471
+ partId: string;
472
+ /** Reasoning text chunk */
473
+ content: string;
474
+ }
475
+ /**
476
+ * Model changed for this session.
477
+ *
478
+ * @category Session Actions
479
+ * @version 1
480
+ * @clientDispatchable
481
+ */
482
+ export interface ISessionModelChangedAction {
483
+ type: ActionType.SessionModelChanged;
484
+ /** Session URI */
485
+ session: URI;
486
+ /** New model selection */
487
+ model: IModelSelection;
488
+ }
489
+ /**
490
+ * The read state of the session changed.
491
+ *
492
+ * Dispatched by a client to mark a session as read (e.g. after viewing it)
493
+ * or unread (e.g. after new activity since the client last looked at it).
494
+ *
495
+ * @category Session Actions
496
+ * @version 1
497
+ * @clientDispatchable
498
+ */
499
+ export interface ISessionIsReadChangedAction {
500
+ type: ActionType.SessionIsReadChanged;
501
+ /** Session URI */
502
+ session: URI;
503
+ /** Whether the session has been read */
504
+ isRead: boolean;
505
+ }
506
+ /**
507
+ * The done state of the session changed.
508
+ *
509
+ * Dispatched by a client to mark a session as done (e.g. the task is
510
+ * complete) or to reopen it.
511
+ *
512
+ * @category Session Actions
513
+ * @version 1
514
+ * @clientDispatchable
515
+ */
516
+ export interface ISessionIsDoneChangedAction {
517
+ type: ActionType.SessionIsDoneChanged;
518
+ /** Session URI */
519
+ session: URI;
520
+ /** Whether the session is done */
521
+ isDone: boolean;
522
+ }
523
+ /**
524
+ * The file diffs for the session changed.
525
+ *
526
+ * Full-replacement semantics: the `diffs` array replaces the previous
527
+ * `summary.diffs` entirely.
528
+ *
529
+ * @category Session Actions
530
+ * @version 1
531
+ */
532
+ export interface ISessionDiffsChangedAction {
533
+ type: ActionType.SessionDiffsChanged;
534
+ /** Session URI */
535
+ session: URI;
536
+ /** Updated file diffs for the session */
537
+ diffs: IFileEdit[];
538
+ }
539
+ /**
540
+ * Server tools for this session have changed.
541
+ *
542
+ * Full-replacement semantics: the `tools` array replaces the previous `serverTools` entirely.
543
+ *
544
+ * @category Session Actions
545
+ * @version 1
546
+ */
547
+ export interface ISessionServerToolsChangedAction {
548
+ type: ActionType.SessionServerToolsChanged;
549
+ /** Session URI */
550
+ session: URI;
551
+ /** Updated server tools list (full replacement) */
552
+ tools: IToolDefinition[];
553
+ }
554
+ /**
555
+ * The active client for this session has changed.
556
+ *
557
+ * A client dispatches this action with its own `ISessionActiveClient` to claim
558
+ * the active role, or with `null` to release it. The server SHOULD reject if
559
+ * another client is already active. The server SHOULD automatically dispatch
560
+ * this action with `activeClient: null` when the active client disconnects.
561
+ *
562
+ * @category Session Actions
563
+ * @version 1
564
+ * @clientDispatchable
565
+ */
566
+ export interface ISessionActiveClientChangedAction {
567
+ type: ActionType.SessionActiveClientChanged;
568
+ /** Session URI */
569
+ session: URI;
570
+ /** The new active client, or `null` to unset */
571
+ activeClient: ISessionActiveClient | null;
572
+ }
573
+ /**
574
+ * The active client's tool list has changed.
575
+ *
576
+ * Full-replacement semantics: the `tools` array replaces the active client's
577
+ * previous tools entirely. The server SHOULD reject if the dispatching client
578
+ * is not the current active client.
579
+ *
580
+ * @category Session Actions
581
+ * @version 1
582
+ * @clientDispatchable
583
+ */
584
+ export interface ISessionActiveClientToolsChangedAction {
585
+ type: ActionType.SessionActiveClientToolsChanged;
586
+ /** Session URI */
587
+ session: URI;
588
+ /** Updated client tools list (full replacement) */
589
+ tools: IToolDefinition[];
590
+ }
591
+ /**
592
+ * The session's customizations have changed.
593
+ *
594
+ * Full-replacement semantics: the `customizations` array replaces the
595
+ * previous `customizations` entirely.
596
+ *
597
+ * @category Session Actions
598
+ * @version 1
599
+ */
600
+ export interface ISessionCustomizationsChangedAction {
601
+ type: ActionType.SessionCustomizationsChanged;
602
+ /** Session URI */
603
+ session: URI;
604
+ /** Updated customization list (full replacement) */
605
+ customizations: ISessionCustomization[];
606
+ }
607
+ /**
608
+ * A client toggled a customization on or off.
609
+ *
610
+ * The server locates the customization by `uri` in the session's
611
+ * customization list and sets its `enabled` flag.
612
+ *
613
+ * @category Session Actions
614
+ * @version 1
615
+ * @clientDispatchable
616
+ */
617
+ export interface ISessionCustomizationToggledAction {
618
+ type: ActionType.SessionCustomizationToggled;
619
+ /** Session URI */
620
+ session: URI;
621
+ /** The URI of the customization to toggle */
622
+ uri: URI;
623
+ /** Whether to enable or disable the customization */
624
+ enabled: boolean;
625
+ }
626
+ /**
627
+ * Client changed a mutable config value mid-session.
628
+ *
629
+ * Only properties with `sessionMutable: true` in the config schema may be
630
+ * changed. The server validates and broadcasts the action; the reducer merges
631
+ * the new values into `state.config.values`.
632
+ *
633
+ * @category Session Actions
634
+ * @version 1
635
+ * @clientDispatchable
636
+ */
637
+ export interface ISessionConfigChangedAction {
638
+ type: ActionType.SessionConfigChanged;
639
+ /** Session URI */
640
+ session: URI;
641
+ /** Updated config values (merged into existing config) */
642
+ config: Record<string, string>;
643
+ }
644
+ /**
645
+ * Truncates a session's history. If `turnId` is provided, all turns after that
646
+ * turn are removed and the specified turn is kept. If `turnId` is omitted, all
647
+ * turns are removed.
648
+ *
649
+ * If there is an active turn it is silently dropped and the session status
650
+ * returns to `idle`.
651
+ *
652
+ * Common use-case: truncate old data then dispatch a new
653
+ * `session/turnStarted` with an edited message.
654
+ *
655
+ * @category Session Actions
656
+ * @version 1
657
+ * @clientDispatchable
658
+ */
659
+ export interface ISessionTruncatedAction {
660
+ type: ActionType.SessionTruncated;
661
+ /** Session URI */
662
+ session: URI;
663
+ /** Keep turns up to and including this turn. Omit to clear all turns. */
664
+ turnId?: string;
665
+ }
666
+ /**
667
+ * A pending message was set (upsert semantics: creates or replaces).
668
+ *
669
+ * For steering messages, this always replaces the single steering message.
670
+ * For queued messages, if a message with the given `id` already exists it is
671
+ * updated in place; otherwise it is appended to the queue. If the session is
672
+ * idle when a queued message is set, the server SHOULD immediately consume it
673
+ * and start a new turn.
674
+ *
675
+ * @category Session Actions
676
+ * @version 1
677
+ * @clientDispatchable
678
+ */
679
+ export interface ISessionPendingMessageSetAction {
680
+ type: ActionType.SessionPendingMessageSet;
681
+ /** Session URI */
682
+ session: URI;
683
+ /** Whether this is a steering or queued message */
684
+ kind: PendingMessageKind;
685
+ /** Unique identifier for this pending message */
686
+ id: string;
687
+ /** The message content */
688
+ userMessage: IUserMessage;
689
+ }
690
+ /**
691
+ * A pending message was removed (steering or queued).
692
+ *
693
+ * Dispatched by clients to cancel a pending message, or by the server when
694
+ * it consumes a message (e.g. starting a turn from a queued message or
695
+ * injecting a steering message into the current turn).
696
+ *
697
+ * @category Session Actions
698
+ * @version 1
699
+ * @clientDispatchable
700
+ */
701
+ export interface ISessionPendingMessageRemovedAction {
702
+ type: ActionType.SessionPendingMessageRemoved;
703
+ /** Session URI */
704
+ session: URI;
705
+ /** Whether this is a steering or queued message */
706
+ kind: PendingMessageKind;
707
+ /** Identifier of the pending message to remove */
708
+ id: string;
709
+ }
710
+ /**
711
+ * Reorder the queued messages.
712
+ *
713
+ * The `order` array contains the IDs of queued messages in their new
714
+ * desired order. IDs not present in the current queue are ignored.
715
+ * Queued messages whose IDs are absent from `order` are appended at
716
+ * the end in their original relative order (so a client with a stale
717
+ * view of the queue never silently drops messages).
718
+ *
719
+ * @category Session Actions
720
+ * @version 1
721
+ * @clientDispatchable
722
+ */
723
+ export interface ISessionQueuedMessagesReorderedAction {
724
+ type: ActionType.SessionQueuedMessagesReordered;
725
+ /** Session URI */
726
+ session: URI;
727
+ /** Queued message IDs in the desired order */
728
+ order: string[];
729
+ }
730
+ /**
731
+ * A session requested input from the user.
732
+ *
733
+ * Full-request upsert semantics: the `request` replaces any existing request
734
+ * with the same `id`, or is appended if it is new. Answer drafts are preserved
735
+ * unless `request.answers` is provided.
736
+ *
737
+ * @category Session Actions
738
+ * @version 1
739
+ */
740
+ export interface ISessionInputRequestedAction {
741
+ type: ActionType.SessionInputRequested;
742
+ /** Session URI */
743
+ session: URI;
744
+ /** Input request to create or replace */
745
+ request: ISessionInputRequest;
746
+ }
747
+ /**
748
+ * A client updated, submitted, skipped, or removed a single in-progress answer.
749
+ *
750
+ * Dispatching with `answer: undefined` removes that question's answer draft.
751
+ *
752
+ * @category Session Actions
753
+ * @version 1
754
+ * @clientDispatchable
755
+ */
756
+ export interface ISessionInputAnswerChangedAction {
757
+ type: ActionType.SessionInputAnswerChanged;
758
+ /** Session URI */
759
+ session: URI;
760
+ /** Input request identifier */
761
+ requestId: string;
762
+ /** Question identifier within the input request */
763
+ questionId: string;
764
+ /** Updated answer, or `undefined` to clear an answer draft */
765
+ answer?: ISessionInputAnswer;
766
+ }
767
+ /**
768
+ * A client accepted, declined, or cancelled a session input request.
769
+ *
770
+ * If accepted, the server uses `answers` (when provided) plus the request's
771
+ * synced answer state to resume the blocked operation.
772
+ *
773
+ * @category Session Actions
774
+ * @version 1
775
+ * @clientDispatchable
776
+ */
777
+ export interface ISessionInputCompletedAction {
778
+ type: ActionType.SessionInputCompleted;
779
+ /** Session URI */
780
+ session: URI;
781
+ /** Input request identifier */
782
+ requestId: string;
783
+ /** Completion outcome */
784
+ response: SessionInputResponseKind;
785
+ /** Optional final answer replacement, keyed by question ID */
786
+ answers?: Record<string, ISessionInputAnswer>;
787
+ }
788
+ /**
789
+ * Terminal output data (pty → client direction).
790
+ *
791
+ * Appends `data` to the terminal's `content` in the reducer.
792
+ *
793
+ * `terminal/data` and `terminal/input` are intentionally separate actions
794
+ * because standard write-ahead reconciliation is not safe for terminal I/O.
795
+ * A pty is a stateful, mutable process — optimistically applying input or
796
+ * predicting output would produce incorrect state. Instead, `terminal/input`
797
+ * is a side-effect-only action (client → server → pty), and `terminal/data`
798
+ * is server-authoritative output (pty → server → client).
799
+ *
800
+ * @category Terminal Actions
801
+ * @version 1
802
+ */
803
+ export interface ITerminalDataAction {
804
+ type: ActionType.TerminalData;
805
+ /** Terminal URI */
806
+ terminal: URI;
807
+ /** Output data (may contain ANSI escape sequences) */
808
+ data: string;
809
+ }
810
+ /**
811
+ * Keyboard input sent to the terminal process (client → pty direction).
812
+ *
813
+ * This is a side-effect-only action: the server forwards the data to the
814
+ * terminal's pty. The reducer treats this as a no-op since `terminal/data`
815
+ * actions will reflect any resulting output.
816
+ *
817
+ * See `terminal/data` for why these two actions are kept separate.
818
+ *
819
+ * @category Terminal Actions
820
+ * @version 1
821
+ * @clientDispatchable
822
+ */
823
+ export interface ITerminalInputAction {
824
+ type: ActionType.TerminalInput;
825
+ /** Terminal URI */
826
+ terminal: URI;
827
+ /** Input data to send to the pty */
828
+ data: string;
829
+ }
830
+ /**
831
+ * Terminal dimensions changed.
832
+ *
833
+ * Dispatchable by clients to request a resize, or by the server to inform
834
+ * clients of the actual terminal dimensions.
835
+ *
836
+ * @category Terminal Actions
837
+ * @version 1
838
+ * @clientDispatchable
839
+ */
840
+ export interface ITerminalResizedAction {
841
+ type: ActionType.TerminalResized;
842
+ /** Terminal URI */
843
+ terminal: URI;
844
+ /** Terminal width in columns */
845
+ cols: number;
846
+ /** Terminal height in rows */
847
+ rows: number;
848
+ }
849
+ /**
850
+ * Terminal claim changed. A client or session transfers ownership of the terminal.
851
+ *
852
+ * The server SHOULD reject if the dispatching client does not currently hold
853
+ * the claim.
854
+ *
855
+ * @category Terminal Actions
856
+ * @version 1
857
+ * @clientDispatchable
858
+ */
859
+ export interface ITerminalClaimedAction {
860
+ type: ActionType.TerminalClaimed;
861
+ /** Terminal URI */
862
+ terminal: URI;
863
+ /** The new claim */
864
+ claim: ITerminalClaim;
865
+ }
866
+ /**
867
+ * Terminal title changed.
868
+ *
869
+ * Fired by the server when the terminal process updates its title (e.g. via
870
+ * escape sequences), or dispatched by a client to rename a terminal.
871
+ *
872
+ * @category Terminal Actions
873
+ * @version 1
874
+ * @clientDispatchable
875
+ */
876
+ export interface ITerminalTitleChangedAction {
877
+ type: ActionType.TerminalTitleChanged;
878
+ /** Terminal URI */
879
+ terminal: URI;
880
+ /** New terminal title */
881
+ title: string;
882
+ }
883
+ /**
884
+ * Terminal working directory changed.
885
+ *
886
+ * @category Terminal Actions
887
+ * @version 1
888
+ */
889
+ export interface ITerminalCwdChangedAction {
890
+ type: ActionType.TerminalCwdChanged;
891
+ /** Terminal URI */
892
+ terminal: URI;
893
+ /** New working directory */
894
+ cwd: URI;
895
+ }
896
+ /**
897
+ * Terminal process exited.
898
+ *
899
+ * @category Terminal Actions
900
+ * @version 1
901
+ */
902
+ export interface ITerminalExitedAction {
903
+ type: ActionType.TerminalExited;
904
+ /** Terminal URI */
905
+ terminal: URI;
906
+ /** Process exit code. `undefined` if the process was killed without an exit code. */
907
+ exitCode?: number;
908
+ }
909
+ /**
910
+ * Terminal scrollback buffer cleared.
911
+ *
912
+ * @category Terminal Actions
913
+ * @version 1
914
+ * @clientDispatchable
915
+ */
916
+ export interface ITerminalClearedAction {
917
+ type: ActionType.TerminalCleared;
918
+ /** Terminal URI */
919
+ terminal: URI;
920
+ }
921
+ /**
922
+ * Shell integration has loaded and the terminal now supports command
923
+ * detection. The server dispatches this when shell integration becomes
924
+ * available (which may happen asynchronously after the terminal is created).
925
+ *
926
+ * Clients MUST NOT assume command detection is available until this action
927
+ * (or `terminal/commandExecuted`) has been received.
928
+ *
929
+ * @category Terminal Actions
930
+ * @version 1
931
+ */
932
+ export interface ITerminalCommandDetectionAvailableAction {
933
+ type: ActionType.TerminalCommandDetectionAvailable;
934
+ /** Terminal URI */
935
+ terminal: URI;
936
+ }
937
+ /**
938
+ * A command has been submitted to the shell and is now executing.
939
+ * All subsequent `terminal/data` actions (until the matching
940
+ * `terminal/commandFinished`) constitute this command's output.
941
+ *
942
+ * @category Terminal Actions
943
+ * @version 1
944
+ */
945
+ export interface ITerminalCommandExecutedAction {
946
+ type: ActionType.TerminalCommandExecuted;
947
+ /** Terminal URI */
948
+ terminal: URI;
949
+ /**
950
+ * Stable identifier for this command, scoped to the terminal URI.
951
+ * Allows correlating `commandExecuted` → `commandFinished` pairs.
952
+ */
953
+ commandId: string;
954
+ /** The command line text that was submitted */
955
+ commandLine: string;
956
+ /**
957
+ * Unix timestamp (ms) of when the command started executing, as measured
958
+ * on the server.
959
+ */
960
+ timestamp: number;
961
+ }
962
+ /**
963
+ * A command has finished executing.
964
+ *
965
+ * The sequence of `terminal/data` actions between the preceding
966
+ * `terminal/commandExecuted` (same `commandId`) and this action constitutes
967
+ * the complete output of the command.
968
+ *
969
+ * @category Terminal Actions
970
+ * @version 1
971
+ */
972
+ export interface ITerminalCommandFinishedAction {
973
+ type: ActionType.TerminalCommandFinished;
974
+ /** Terminal URI */
975
+ terminal: URI;
976
+ /** Matches the `commandId` from the corresponding `commandExecuted` */
977
+ commandId: string;
978
+ /** Shell exit code. `undefined` if the shell did not report one. */
979
+ exitCode?: number;
980
+ /**
981
+ * Wall-clock duration of the command in milliseconds, as measured by the
982
+ * shell integration script on the server side.
983
+ */
984
+ durationMs?: number;
985
+ }
986
+ /**
987
+ * Discriminated union of all state actions.
988
+ */
989
+ export 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 | ISessionConfigChangedAction | ITerminalDataAction | ITerminalInputAction | ITerminalResizedAction | ITerminalClaimedAction | ITerminalTitleChangedAction | ITerminalCwdChangedAction | ITerminalExitedAction | ITerminalClearedAction | ITerminalCommandDetectionAvailableAction | ITerminalCommandExecutedAction | ITerminalCommandFinishedAction;
990
+ export {};