@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,1418 @@
1
+ /** A URI string (e.g. `agenthost:/root` or `copilot:/<uuid>`). */
2
+ export type URI = string;
3
+ /**
4
+ * A string that may optionally be rendered as Markdown.
5
+ *
6
+ * - A plain `string` is rendered as-is (no Markdown processing).
7
+ * - An object with `{ markdown: string }` is rendered with Markdown formatting.
8
+ */
9
+ export type StringOrMarkdown = string | {
10
+ markdown: string;
11
+ };
12
+ /**
13
+ * An optionally-sized icon that can be displayed in a user interface.
14
+ *
15
+ * @category Common Types
16
+ */
17
+ export interface Icon {
18
+ /**
19
+ * A standard URI pointing to an icon resource. May be an HTTP/HTTPS URL or a
20
+ * `data:` URI with Base64-encoded image data.
21
+ *
22
+ * Consumers SHOULD take steps to ensure URLs serving icons are from the
23
+ * same domain as the client/server or a trusted domain.
24
+ *
25
+ * Consumers SHOULD take appropriate precautions when consuming SVGs as they can contain
26
+ * executable JavaScript.
27
+ */
28
+ src: URI;
29
+ /**
30
+ * Optional MIME type override if the source MIME type is missing or generic.
31
+ * For example: `"image/png"`, `"image/jpeg"`, or `"image/svg+xml"`.
32
+ */
33
+ contentType?: string;
34
+ /**
35
+ * Optional array of strings that specify sizes at which the icon can be used.
36
+ * Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG.
37
+ *
38
+ * If not provided, the client should assume that the icon can be used at any size.
39
+ */
40
+ sizes?: string[];
41
+ /**
42
+ * Optional specifier for the theme this icon is designed for. `"light"` indicates
43
+ * the icon is designed to be used with a light background, and `"dark"` indicates
44
+ * the icon is designed to be used with a dark background.
45
+ *
46
+ * If not provided, the client should assume the icon can be used with any theme.
47
+ */
48
+ theme?: "light" | "dark";
49
+ }
50
+ /**
51
+ * Describes a protected resource's authentication requirements using
52
+ * [RFC 9728](https://datatracker.ietf.org/doc/html/rfc9728) (OAuth 2.0
53
+ * Protected Resource Metadata) semantics.
54
+ *
55
+ * Field names use snake_case to match the RFC 9728 JSON format.
56
+ *
57
+ * @category Authentication
58
+ * @see {@link https://datatracker.ietf.org/doc/html/rfc9728 | RFC 9728}
59
+ */
60
+ export interface IProtectedResourceMetadata {
61
+ /**
62
+ * REQUIRED. The protected resource's resource identifier, a URL using the
63
+ * `https` scheme with no fragment component (e.g. `"https://api.github.com"`).
64
+ */
65
+ resource: string;
66
+ /** OPTIONAL. Human-readable name of the protected resource. */
67
+ resource_name?: string;
68
+ /** OPTIONAL. JSON array of OAuth authorization server identifier URLs. */
69
+ authorization_servers?: string[];
70
+ /** OPTIONAL. URL of the protected resource's JWK Set document. */
71
+ jwks_uri?: string;
72
+ /** RECOMMENDED. JSON array of OAuth 2.0 scope values used in authorization requests. */
73
+ scopes_supported?: string[];
74
+ /** OPTIONAL. JSON array of Bearer Token presentation methods supported. */
75
+ bearer_methods_supported?: string[];
76
+ /** OPTIONAL. JSON array of JWS signing algorithms supported. */
77
+ resource_signing_alg_values_supported?: string[];
78
+ /** OPTIONAL. JSON array of JWE encryption algorithms (alg) supported. */
79
+ resource_encryption_alg_values_supported?: string[];
80
+ /** OPTIONAL. JSON array of JWE encryption algorithms (enc) supported. */
81
+ resource_encryption_enc_values_supported?: string[];
82
+ /** OPTIONAL. URL of human-readable documentation for the resource. */
83
+ resource_documentation?: string;
84
+ /** OPTIONAL. URL of the resource's data-usage policy. */
85
+ resource_policy_uri?: string;
86
+ /** OPTIONAL. URL of the resource's terms of service. */
87
+ resource_tos_uri?: string;
88
+ /**
89
+ * AHP extension. Whether authentication is required for this resource.
90
+ *
91
+ * - `true` (default) — the agent cannot be used without a valid token.
92
+ * The server SHOULD return `AuthRequired` (`-32007`) if the client
93
+ * attempts to use the agent without authenticating.
94
+ * - `false` — the agent works without authentication but MAY offer
95
+ * enhanced capabilities when a token is provided.
96
+ *
97
+ * Clients SHOULD treat an absent field the same as `true`.
98
+ */
99
+ required?: boolean;
100
+ }
101
+ /**
102
+ * Policy configuration state for a model.
103
+ *
104
+ * @category Root State
105
+ */
106
+ export declare enum PolicyState {
107
+ Enabled = "enabled",
108
+ Disabled = "disabled",
109
+ Unconfigured = "unconfigured"
110
+ }
111
+ /**
112
+ * Global state shared with every client subscribed to `agenthost:/root`.
113
+ *
114
+ * @category Root State
115
+ */
116
+ export interface IRootState {
117
+ /** Available agent backends and their models */
118
+ agents: IAgentInfo[];
119
+ /** Number of active (non-disposed) sessions on the server */
120
+ activeSessions?: number;
121
+ /** Known terminals on the server. Subscribe to individual terminal URIs for full state. */
122
+ terminals?: ITerminalInfo[];
123
+ }
124
+ /**
125
+ * @category Root State
126
+ */
127
+ export interface IAgentInfo {
128
+ /** Agent provider ID (e.g. `'copilot'`) */
129
+ provider: string;
130
+ /** Human-readable name */
131
+ displayName: string;
132
+ /** Description string */
133
+ description: string;
134
+ /** Available models for this agent */
135
+ models: ISessionModelInfo[];
136
+ /**
137
+ * Protected resources this agent requires authentication for.
138
+ *
139
+ * Each entry describes an OAuth 2.0 protected resource using
140
+ * [RFC 9728](https://datatracker.ietf.org/doc/html/rfc9728) semantics.
141
+ * Clients should obtain tokens from the declared `authorization_servers`
142
+ * and push them via the `authenticate` command before creating sessions
143
+ * with this agent.
144
+ *
145
+ * @see {@link /specification/authentication | Authentication}
146
+ */
147
+ protectedResources?: IProtectedResourceMetadata[];
148
+ /**
149
+ * Customizations (Open Plugins) associated with this agent.
150
+ *
151
+ * Each entry is a reference to an [Open Plugins](https://open-plugins.com/)
152
+ * plugin that the agent host can activate for sessions using this agent.
153
+ */
154
+ customizations?: ICustomizationRef[];
155
+ }
156
+ /**
157
+ * @category Root State
158
+ */
159
+ export interface ISessionModelInfo {
160
+ /** Model identifier */
161
+ id: string;
162
+ /** Provider this model belongs to */
163
+ provider: string;
164
+ /** Human-readable model name */
165
+ name: string;
166
+ /** Maximum context window size */
167
+ maxContextWindow?: number;
168
+ /** Whether the model supports vision */
169
+ supportsVision?: boolean;
170
+ /** Policy configuration state */
171
+ policyState?: PolicyState;
172
+ /**
173
+ * Configuration schema describing model-specific options (e.g. thinking
174
+ * level). Clients present this as a form and pass the resolved values in
175
+ * {@link IModelSelection.config} when creating or changing sessions.
176
+ */
177
+ configSchema?: IConfigSchema;
178
+ }
179
+ /**
180
+ * A model selection: the chosen model ID together with any model-specific
181
+ * configuration values whose keys correspond to the model's
182
+ * {@link ISessionModelInfo.configSchema}.
183
+ *
184
+ * @category Root State
185
+ */
186
+ export interface IModelSelection {
187
+ /** Model identifier */
188
+ id: string;
189
+ /** Model-specific configuration values */
190
+ config?: Record<string, string>;
191
+ }
192
+ /**
193
+ * Discriminant for pending message kinds.
194
+ *
195
+ * @category Pending Message Types
196
+ */
197
+ export declare enum PendingMessageKind {
198
+ /** Injected into the current turn at a convenient point */
199
+ Steering = "steering",
200
+ /** Sent automatically as a new turn after the current turn finishes */
201
+ Queued = "queued"
202
+ }
203
+ /**
204
+ * A message queued for future delivery to the agent.
205
+ *
206
+ * Steering messages are injected into the current turn mid-flight.
207
+ * Queued messages are automatically started as new turns after the
208
+ * current turn naturally finishes.
209
+ *
210
+ * @category Pending Message Types
211
+ */
212
+ export interface IPendingMessage {
213
+ /** Unique identifier for this pending message */
214
+ id: string;
215
+ /** The message content */
216
+ userMessage: IUserMessage;
217
+ }
218
+ /**
219
+ * Session initialization state.
220
+ *
221
+ * @category Session State
222
+ */
223
+ export declare enum SessionLifecycle {
224
+ Creating = "creating",
225
+ Ready = "ready",
226
+ CreationFailed = "creationFailed"
227
+ }
228
+ /**
229
+ * Bitset of summary-level session status flags.
230
+ *
231
+ * Use bitwise checks instead of equality for non-terminal activity. For example,
232
+ * `status & SessionStatus.InProgress` matches both ordinary in-progress turns
233
+ * and turns that are paused waiting for input.
234
+ *
235
+ * @category Session State
236
+ */
237
+ export declare enum SessionStatus {
238
+ Idle = 1,
239
+ Error = 2,
240
+ InProgress = 8,
241
+ InputNeeded = 24
242
+ }
243
+ /**
244
+ * Full state for a single session, loaded when a client subscribes to the session's URI.
245
+ *
246
+ * @category Session State
247
+ */
248
+ export interface ISessionState {
249
+ /** Lightweight session metadata */
250
+ summary: ISessionSummary;
251
+ /** Session initialization state */
252
+ lifecycle: SessionLifecycle;
253
+ /** Error details if creation failed */
254
+ creationError?: IErrorInfo;
255
+ /** Tools provided by the server (agent host) for this session */
256
+ serverTools?: IToolDefinition[];
257
+ /** The client currently providing tools and interactive capabilities to this session */
258
+ activeClient?: ISessionActiveClient;
259
+ /** Completed turns */
260
+ turns: ITurn[];
261
+ /** Currently in-progress turn */
262
+ activeTurn?: IActiveTurn;
263
+ /** Message to inject into the current turn at a convenient point */
264
+ steeringMessage?: IPendingMessage;
265
+ /** Messages to send automatically as new turns after the current turn finishes */
266
+ queuedMessages?: IPendingMessage[];
267
+ /** Requests for user input that are currently blocking or informing session progress */
268
+ inputRequests?: ISessionInputRequest[];
269
+ /** Session configuration schema and current values */
270
+ config?: ISessionConfigState;
271
+ /**
272
+ * Server-provided customizations active in this session.
273
+ *
274
+ * Client-provided customizations are available on
275
+ * {@link ISessionActiveClient.customizations | activeClient.customizations}.
276
+ */
277
+ customizations?: ISessionCustomization[];
278
+ }
279
+ /**
280
+ * The client currently providing tools and interactive capabilities to a session.
281
+ *
282
+ * Only one client may be active per session at a time. The server SHOULD
283
+ * automatically unset the active client if that client disconnects.
284
+ *
285
+ * @category Session State
286
+ */
287
+ export interface ISessionActiveClient {
288
+ /** Client identifier (matches `clientId` from `initialize`) */
289
+ clientId: string;
290
+ /** Human-readable client name (e.g. `"VS Code"`) */
291
+ displayName?: string;
292
+ /** Tools this client provides to the session */
293
+ tools: IToolDefinition[];
294
+ /** Customizations this client contributes to the session */
295
+ customizations?: ICustomizationRef[];
296
+ }
297
+ /**
298
+ * Server-owned project metadata for a session.
299
+ *
300
+ * @category Session State
301
+ */
302
+ export interface IProjectInfo {
303
+ /** Project URI */
304
+ uri: URI;
305
+ /** Human-readable project name */
306
+ displayName: string;
307
+ }
308
+ /**
309
+ * @category Session State
310
+ */
311
+ export interface ISessionSummary {
312
+ /** Session URI */
313
+ resource: URI;
314
+ /** Agent provider ID */
315
+ provider: string;
316
+ /** Session title */
317
+ title: string;
318
+ /** Current session status */
319
+ status: SessionStatus;
320
+ /** Creation timestamp */
321
+ createdAt: number;
322
+ /** Last modification timestamp */
323
+ modifiedAt: number;
324
+ /** Server-owned project for this session */
325
+ project?: IProjectInfo;
326
+ /** Currently selected model */
327
+ model?: IModelSelection;
328
+ /** The working directory URI for this session */
329
+ workingDirectory?: URI;
330
+ /** Whether the client has viewed this session since its last modification */
331
+ isRead?: boolean;
332
+ /** Whether the session has been marked as done by the client */
333
+ isDone?: boolean;
334
+ /** Files changed during this session with diff statistics */
335
+ diffs?: IFileEdit[];
336
+ }
337
+ /**
338
+ * A JSON Schema-compatible string enum property descriptor with display extensions.
339
+ *
340
+ * Standard JSON Schema fields (`type`, `title`, `description`, `default`,
341
+ * `enum`) allow validators to process the schema. Display extensions
342
+ * (`enumLabels`, `enumDescriptions`) are parallel arrays that provide UI
343
+ * metadata for each `enum` value.
344
+ *
345
+ * This is the generic base type. See {@link ISessionConfigPropertySchema} for
346
+ * session-specific extensions.
347
+ *
348
+ * @category Config Schema Types
349
+ */
350
+ export interface IConfigPropertySchema {
351
+ /** JSON Schema: property type. Only string enum properties are currently supported. */
352
+ type: "string";
353
+ /** JSON Schema: human-readable label for the property */
354
+ title: string;
355
+ /** JSON Schema: description / tooltip */
356
+ description?: string;
357
+ /** JSON Schema: default value */
358
+ default?: string;
359
+ /** JSON Schema: allowed values */
360
+ enum: string[];
361
+ /** Display extension: human-readable label per enum value (parallel array) */
362
+ enumLabels?: string[];
363
+ /** Display extension: description per enum value (parallel array) */
364
+ enumDescriptions?: string[];
365
+ /** JSON Schema: when `true`, the property is displayed but cannot be modified by the user */
366
+ readOnly?: boolean;
367
+ }
368
+ /**
369
+ * A JSON Schema object describing available configuration properties.
370
+ *
371
+ * This is the generic base type. See {@link ISessionConfigSchema} for
372
+ * session-specific usage.
373
+ *
374
+ * @category Config Schema Types
375
+ */
376
+ export interface IConfigSchema {
377
+ /** JSON Schema: always `'object'` */
378
+ type: "object";
379
+ /** JSON Schema: property descriptors keyed by property id */
380
+ properties: Record<string, IConfigPropertySchema>;
381
+ /** JSON Schema: list of required property ids */
382
+ required?: string[];
383
+ }
384
+ /**
385
+ * A session configuration property descriptor.
386
+ *
387
+ * Extends the generic {@link IConfigPropertySchema} with session-specific
388
+ * display extensions.
389
+ *
390
+ * @category Session Config Types
391
+ */
392
+ export interface ISessionConfigPropertySchema extends IConfigPropertySchema {
393
+ /**
394
+ * Display extension: when `true`, the full set of allowed values is too large
395
+ * to enumerate statically. The client SHOULD use `sessionConfigCompletions`
396
+ * to fetch matching values based on user input. Any values in `enum` are
397
+ * seed/recent values for initial display.
398
+ */
399
+ enumDynamic?: boolean;
400
+ /** When `true`, the user may change this property after session creation */
401
+ sessionMutable?: boolean;
402
+ }
403
+ /**
404
+ * A JSON Schema object describing available session configuration metadata.
405
+ *
406
+ * @category Session Config Types
407
+ */
408
+ export interface ISessionConfigSchema {
409
+ /** JSON Schema: always `'object'` */
410
+ type: "object";
411
+ /** JSON Schema: property descriptors keyed by property id */
412
+ properties: Record<string, ISessionConfigPropertySchema>;
413
+ /** JSON Schema: list of required property ids */
414
+ required?: string[];
415
+ }
416
+ /**
417
+ * Live session configuration metadata.
418
+ *
419
+ * The schema describes the available configuration properties and the values
420
+ * contain the current value for each resolved property.
421
+ *
422
+ * @category Session Config Types
423
+ */
424
+ export interface ISessionConfigState {
425
+ /** JSON Schema describing available configuration properties */
426
+ schema: ISessionConfigSchema;
427
+ /** Current configuration values */
428
+ values: Record<string, string>;
429
+ }
430
+ /**
431
+ * How a client completed an input request.
432
+ *
433
+ * @category Session Input Types
434
+ */
435
+ export declare enum SessionInputResponseKind {
436
+ Accept = "accept",
437
+ Decline = "decline",
438
+ Cancel = "cancel"
439
+ }
440
+ /**
441
+ * Question/input control kind.
442
+ *
443
+ * @category Session Input Types
444
+ */
445
+ export declare enum SessionInputQuestionKind {
446
+ Text = "text",
447
+ Number = "number",
448
+ Integer = "integer",
449
+ Boolean = "boolean",
450
+ SingleSelect = "single-select",
451
+ MultiSelect = "multi-select"
452
+ }
453
+ /**
454
+ * A choice in a select-style question.
455
+ *
456
+ * @category Session Input Types
457
+ */
458
+ export interface ISessionInputOption {
459
+ /** Stable option identifier; for MCP enum values this is the enum string */
460
+ id: string;
461
+ /** Display label */
462
+ label: string;
463
+ /** Optional secondary text */
464
+ description?: string;
465
+ /** Whether this option is the recommended/default choice */
466
+ recommended?: boolean;
467
+ }
468
+ interface ISessionInputQuestionBase {
469
+ /** Stable question identifier used as the key in `answers` */
470
+ id: string;
471
+ /** Short display title */
472
+ title?: string;
473
+ /** Prompt shown to the user */
474
+ message: string;
475
+ /** Whether the user must answer this question to accept the request */
476
+ required?: boolean;
477
+ }
478
+ /** Text question within a session input request. */
479
+ export interface ISessionInputTextQuestion extends ISessionInputQuestionBase {
480
+ kind: SessionInputQuestionKind.Text;
481
+ /** Format hint for text questions, such as `email`, `uri`, `date`, or `date-time` */
482
+ format?: string;
483
+ /** Minimum string length */
484
+ min?: number;
485
+ /** Maximum string length */
486
+ max?: number;
487
+ /** Default text */
488
+ defaultValue?: string;
489
+ }
490
+ /** Numeric question within a session input request. */
491
+ export interface ISessionInputNumberQuestion extends ISessionInputQuestionBase {
492
+ kind: SessionInputQuestionKind.Number | SessionInputQuestionKind.Integer;
493
+ /** Minimum value */
494
+ min?: number;
495
+ /** Maximum value */
496
+ max?: number;
497
+ /** Default numeric value */
498
+ defaultValue?: number;
499
+ }
500
+ /** Boolean question within a session input request. */
501
+ export interface ISessionInputBooleanQuestion extends ISessionInputQuestionBase {
502
+ kind: SessionInputQuestionKind.Boolean;
503
+ /** Default boolean value */
504
+ defaultValue?: boolean;
505
+ }
506
+ /** Single-select question within a session input request. */
507
+ export interface ISessionInputSingleSelectQuestion extends ISessionInputQuestionBase {
508
+ kind: SessionInputQuestionKind.SingleSelect;
509
+ /** Options the user may select from */
510
+ options: ISessionInputOption[];
511
+ /** Whether the user may enter text instead of selecting an option */
512
+ allowFreeformInput?: boolean;
513
+ }
514
+ /** Multi-select question within a session input request. */
515
+ export interface ISessionInputMultiSelectQuestion extends ISessionInputQuestionBase {
516
+ kind: SessionInputQuestionKind.MultiSelect;
517
+ /** Options the user may select from */
518
+ options: ISessionInputOption[];
519
+ /** Whether the user may enter text in addition to selecting options */
520
+ allowFreeformInput?: boolean;
521
+ /** Minimum selected item count */
522
+ min?: number;
523
+ /** Maximum selected item count */
524
+ max?: number;
525
+ }
526
+ /**
527
+ * One question within a session input request.
528
+ *
529
+ * @category Session Input Types
530
+ */
531
+ export type ISessionInputQuestion = ISessionInputTextQuestion | ISessionInputNumberQuestion | ISessionInputBooleanQuestion | ISessionInputSingleSelectQuestion | ISessionInputMultiSelectQuestion;
532
+ /**
533
+ * A live request for user input.
534
+ *
535
+ * The server creates or replaces requests with `session/inputRequested`.
536
+ * Clients sync drafts with `session/inputAnswerChanged` and complete requests
537
+ * with `session/inputCompleted`.
538
+ *
539
+ * @category Session Input Types
540
+ */
541
+ export interface ISessionInputRequest {
542
+ /** Stable request identifier */
543
+ id: string;
544
+ /** Display message for the request as a whole */
545
+ message: string;
546
+ /** URL the user should review or open, for URL-style elicitations */
547
+ url?: URI;
548
+ /** Ordered questions to ask the user */
549
+ questions?: ISessionInputQuestion[];
550
+ /** Current draft or submitted answers, keyed by question ID */
551
+ answers?: Record<string, ISessionInputAnswer>;
552
+ }
553
+ /**
554
+ * Answer value kind.
555
+ *
556
+ * @category Session Input Types
557
+ */
558
+ export declare enum SessionInputAnswerValueKind {
559
+ Text = "text",
560
+ Number = "number",
561
+ Boolean = "boolean",
562
+ Selected = "selected",
563
+ SelectedMany = "selected-many"
564
+ }
565
+ /**
566
+ * Value captured for one answer.
567
+ *
568
+ * @category Session Input Types
569
+ */
570
+ export interface ISessionInputTextAnswerValue {
571
+ kind: SessionInputAnswerValueKind.Text;
572
+ value: string;
573
+ }
574
+ export interface ISessionInputNumberAnswerValue {
575
+ kind: SessionInputAnswerValueKind.Number;
576
+ value: number;
577
+ }
578
+ export interface ISessionInputBooleanAnswerValue {
579
+ kind: SessionInputAnswerValueKind.Boolean;
580
+ value: boolean;
581
+ }
582
+ export interface ISessionInputSelectedAnswerValue {
583
+ kind: SessionInputAnswerValueKind.Selected;
584
+ value: string;
585
+ /** Free-form text entered instead of selecting an option */
586
+ freeformValues?: string[];
587
+ }
588
+ export interface ISessionInputSelectedManyAnswerValue {
589
+ kind: SessionInputAnswerValueKind.SelectedMany;
590
+ value: string[];
591
+ /** Free-form text entered in addition to selected options */
592
+ freeformValues?: string[];
593
+ }
594
+ export type ISessionInputAnswerValue = ISessionInputTextAnswerValue | ISessionInputNumberAnswerValue | ISessionInputBooleanAnswerValue | ISessionInputSelectedAnswerValue | ISessionInputSelectedManyAnswerValue;
595
+ export interface ISessionInputAnswered {
596
+ /** Answer state */
597
+ state: SessionInputAnswerState.Draft | SessionInputAnswerState.Submitted;
598
+ /** Answer value */
599
+ value: ISessionInputAnswerValue;
600
+ }
601
+ export interface ISessionInputSkipped {
602
+ /** Answer state */
603
+ state: SessionInputAnswerState.Skipped;
604
+ /** Free-form reason or value captured while skipping, if any */
605
+ freeformValues?: string[];
606
+ }
607
+ /**
608
+ * Answer lifecycle state.
609
+ *
610
+ * @category Session Input Types
611
+ */
612
+ export declare enum SessionInputAnswerState {
613
+ Draft = "draft",
614
+ Submitted = "submitted",
615
+ Skipped = "skipped"
616
+ }
617
+ /**
618
+ * Draft, submitted, or skipped answer for one question.
619
+ *
620
+ * @category Session Input Types
621
+ */
622
+ export type ISessionInputAnswer = ISessionInputAnswered | ISessionInputSkipped;
623
+ /**
624
+ * How a turn ended.
625
+ *
626
+ * @category Turn Types
627
+ */
628
+ export declare enum TurnState {
629
+ Complete = "complete",
630
+ Cancelled = "cancelled",
631
+ Error = "error"
632
+ }
633
+ /**
634
+ * Type of a message attachment.
635
+ *
636
+ * @category Turn Types
637
+ */
638
+ export declare enum AttachmentType {
639
+ File = "file",
640
+ Directory = "directory",
641
+ Selection = "selection"
642
+ }
643
+ /**
644
+ * A completed request/response cycle.
645
+ *
646
+ * @category Turn Types
647
+ */
648
+ export interface ITurn {
649
+ /** Turn identifier */
650
+ id: string;
651
+ /** The user's input */
652
+ userMessage: IUserMessage;
653
+ /**
654
+ * All response content in stream order: text, tool calls, reasoning, and content refs.
655
+ *
656
+ * Consumers should derive display text by concatenating markdown parts,
657
+ * and find tool calls by filtering for `ToolCall` parts.
658
+ */
659
+ responseParts: IResponsePart[];
660
+ /** Token usage info */
661
+ usage: IUsageInfo | undefined;
662
+ /** How the turn ended */
663
+ state: TurnState;
664
+ /** Error details if state is `'error'` */
665
+ error?: IErrorInfo;
666
+ }
667
+ /**
668
+ * An in-progress turn — the assistant is actively streaming.
669
+ *
670
+ * @category Turn Types
671
+ */
672
+ export interface IActiveTurn {
673
+ /** Turn identifier */
674
+ id: string;
675
+ /** The user's input */
676
+ userMessage: IUserMessage;
677
+ /**
678
+ * All response content in stream order: text, tool calls, reasoning, and content refs.
679
+ *
680
+ * Tool call parts include `pendingPermissions` when permissions are awaiting user approval.
681
+ */
682
+ responseParts: IResponsePart[];
683
+ /** Token usage info */
684
+ usage: IUsageInfo | undefined;
685
+ }
686
+ /**
687
+ * @category Turn Types
688
+ */
689
+ export interface IUserMessage {
690
+ /** Message text */
691
+ text: string;
692
+ /** File/selection attachments */
693
+ attachments?: IMessageAttachment[];
694
+ }
695
+ /**
696
+ * @category Turn Types
697
+ */
698
+ export interface IMessageAttachment {
699
+ /** Attachment type */
700
+ type: AttachmentType;
701
+ /** File/directory path */
702
+ path: string;
703
+ /** Display name */
704
+ displayName?: string;
705
+ }
706
+ /**
707
+ * Discriminant for response part types.
708
+ *
709
+ * @category Response Parts
710
+ */
711
+ export declare enum ResponsePartKind {
712
+ Markdown = "markdown",
713
+ ContentRef = "contentRef",
714
+ ToolCall = "toolCall",
715
+ Reasoning = "reasoning"
716
+ }
717
+ /**
718
+ * @category Response Parts
719
+ */
720
+ export interface IMarkdownResponsePart {
721
+ /** Discriminant */
722
+ kind: ResponsePartKind.Markdown;
723
+ /** Part identifier, used by `session/delta` to target this part for content appends */
724
+ id: string;
725
+ /** Markdown content */
726
+ content: string;
727
+ }
728
+ /**
729
+ * A reference to large content stored outside the state tree.
730
+ */
731
+ export interface IContentRef {
732
+ /** Content URI */
733
+ uri: URI;
734
+ /** Approximate size in bytes */
735
+ sizeHint?: number;
736
+ /** Content MIME type */
737
+ contentType?: string;
738
+ }
739
+ /**
740
+ * A content part that's a reference to large content stored outside the state tree.
741
+ *
742
+ * @category Response Parts
743
+ */
744
+ export interface IResourceReponsePart extends IContentRef {
745
+ /** Discriminant */
746
+ kind: ResponsePartKind.ContentRef;
747
+ }
748
+ /**
749
+ * A tool call represented as a response part.
750
+ *
751
+ * Tool calls are part of the response stream, interleaved with text and
752
+ * reasoning. The `toolCall.toolCallId` serves as the part identifier for
753
+ * actions that target this part.
754
+ *
755
+ * @category Response Parts
756
+ */
757
+ export interface IToolCallResponsePart {
758
+ /** Discriminant */
759
+ kind: ResponsePartKind.ToolCall;
760
+ /** Full tool call lifecycle state */
761
+ toolCall: IToolCallState;
762
+ }
763
+ /**
764
+ * Reasoning/thinking content from the model.
765
+ *
766
+ * @category Response Parts
767
+ */
768
+ export interface IReasoningResponsePart {
769
+ /** Discriminant */
770
+ kind: ResponsePartKind.Reasoning;
771
+ /** Part identifier, used by `session/reasoning` to target this part for content appends */
772
+ id: string;
773
+ /** Accumulated reasoning text */
774
+ content: string;
775
+ }
776
+ /**
777
+ * @category Response Parts
778
+ */
779
+ export type IResponsePart = IMarkdownResponsePart | IResourceReponsePart | IToolCallResponsePart | IReasoningResponsePart;
780
+ /**
781
+ * Status of a tool call in the lifecycle state machine.
782
+ *
783
+ * @category Tool Call Types
784
+ */
785
+ export declare enum ToolCallStatus {
786
+ Streaming = "streaming",
787
+ PendingConfirmation = "pending-confirmation",
788
+ Running = "running",
789
+ PendingResultConfirmation = "pending-result-confirmation",
790
+ Completed = "completed",
791
+ Cancelled = "cancelled"
792
+ }
793
+ /**
794
+ * How a tool call was confirmed for execution.
795
+ *
796
+ * - `NotNeeded` — No confirmation required (auto-approved)
797
+ * - `UserAction` — User explicitly approved
798
+ * - `Setting` — Approved by a persistent user setting
799
+ *
800
+ * @category Tool Call Types
801
+ */
802
+ export declare enum ToolCallConfirmationReason {
803
+ NotNeeded = "not-needed",
804
+ UserAction = "user-action",
805
+ Setting = "setting"
806
+ }
807
+ /**
808
+ * Why a tool call was cancelled.
809
+ *
810
+ * @category Tool Call Types
811
+ */
812
+ export declare enum ToolCallCancellationReason {
813
+ Denied = "denied",
814
+ Skipped = "skipped",
815
+ ResultDenied = "result-denied"
816
+ }
817
+ /**
818
+ * Metadata common to all tool call states.
819
+ *
820
+ * @category Tool Call Types
821
+ * @remarks
822
+ * Fields like `toolName` carry agent-specific identifiers on the wire despite the
823
+ * agent-agnostic design principle. These exist for debugging and logging purposes.
824
+ * A future version may move these to a separate diagnostic channel or namespace them
825
+ * more clearly.
826
+ */
827
+ interface IToolCallBase {
828
+ /** Unique tool call identifier */
829
+ toolCallId: string;
830
+ /** Internal tool name (for debugging/logging) */
831
+ toolName: string;
832
+ /** Human-readable tool name */
833
+ displayName: string;
834
+ /**
835
+ * If this tool is provided by a client, the `clientId` of the owning client.
836
+ * Absent for server-side tools.
837
+ *
838
+ * When set, the identified client is responsible for executing the tool and
839
+ * dispatching `session/toolCallComplete` with the result.
840
+ */
841
+ toolClientId?: string;
842
+ /**
843
+ * Additional provider-specific metadata for this tool call.
844
+ *
845
+ * Clients MAY look for well-known keys here to provide enhanced UI.
846
+ * For example, a `ptyTerminal` key with `{ input: string; output: string }`
847
+ * indicates the tool operated on a terminal (both `input` and `output` may
848
+ * contain escape sequences).
849
+ */
850
+ _meta?: Record<string, unknown>;
851
+ }
852
+ /**
853
+ * Properties available once tool call parameters are fully received.
854
+ *
855
+ * @category Tool Call Types
856
+ */
857
+ interface IToolCallParameterFields {
858
+ /** Message describing what the tool will do */
859
+ invocationMessage: StringOrMarkdown;
860
+ /** Raw tool input */
861
+ toolInput?: string;
862
+ }
863
+ /**
864
+ * Tool execution result details, available after execution completes.
865
+ *
866
+ * @category Tool Call Types
867
+ */
868
+ export interface IToolCallResult {
869
+ /** Whether the tool succeeded */
870
+ success: boolean;
871
+ /** Past-tense description of what the tool did */
872
+ pastTenseMessage: StringOrMarkdown;
873
+ /**
874
+ * Unstructured result content blocks.
875
+ *
876
+ * This mirrors the `content` field of MCP `CallToolResult`.
877
+ */
878
+ content?: IToolResultContent[];
879
+ /**
880
+ * Optional structured result object.
881
+ *
882
+ * This mirrors the `structuredContent` field of MCP `CallToolResult`.
883
+ */
884
+ structuredContent?: Record<string, unknown>;
885
+ /** Error details if the tool failed */
886
+ error?: {
887
+ message: string;
888
+ code?: string;
889
+ };
890
+ }
891
+ /**
892
+ * LM is streaming the tool call parameters.
893
+ *
894
+ * @category Tool Call Types
895
+ */
896
+ export interface IToolCallStreamingState extends IToolCallBase {
897
+ status: ToolCallStatus.Streaming;
898
+ /** Partial parameters accumulated so far */
899
+ partialInput?: string;
900
+ /** Progress message shown while parameters are streaming */
901
+ invocationMessage?: StringOrMarkdown;
902
+ }
903
+ /**
904
+ * Parameters are complete, or a running tool requires re-confirmation
905
+ * (e.g. a mid-execution permission check).
906
+ *
907
+ * @category Tool Call Types
908
+ */
909
+ export interface IToolCallPendingConfirmationState extends IToolCallBase, IToolCallParameterFields {
910
+ status: ToolCallStatus.PendingConfirmation;
911
+ /** Short title for the confirmation prompt (e.g. `"Run in terminal"`, `"Write file"`) */
912
+ confirmationTitle?: StringOrMarkdown;
913
+ /** File edits that this tool call will perform, for preview before confirmation */
914
+ edits?: {
915
+ items: IFileEdit[];
916
+ };
917
+ /** Whether the agent host allows the client to edit the tool's input parameters before confirming */
918
+ editable?: boolean;
919
+ }
920
+ /**
921
+ * Tool is actively executing.
922
+ *
923
+ * @category Tool Call Types
924
+ */
925
+ export interface IToolCallRunningState extends IToolCallBase, IToolCallParameterFields {
926
+ status: ToolCallStatus.Running;
927
+ /** How the tool was confirmed for execution */
928
+ confirmed: ToolCallConfirmationReason;
929
+ /**
930
+ * Partial content produced while the tool is still executing.
931
+ *
932
+ * For example, a terminal content block lets clients subscribe to live
933
+ * output before the tool completes.
934
+ */
935
+ content?: IToolResultContent[];
936
+ }
937
+ /**
938
+ * Tool finished executing, waiting for client to approve the result.
939
+ *
940
+ * @category Tool Call Types
941
+ */
942
+ export interface IToolCallPendingResultConfirmationState extends IToolCallBase, IToolCallParameterFields, IToolCallResult {
943
+ status: ToolCallStatus.PendingResultConfirmation;
944
+ /** How the tool was confirmed for execution */
945
+ confirmed: ToolCallConfirmationReason;
946
+ }
947
+ /**
948
+ * Tool completed successfully or with an error.
949
+ *
950
+ * @category Tool Call Types
951
+ */
952
+ export interface IToolCallCompletedState extends IToolCallBase, IToolCallParameterFields, IToolCallResult {
953
+ status: ToolCallStatus.Completed;
954
+ /** How the tool was confirmed for execution */
955
+ confirmed: ToolCallConfirmationReason;
956
+ }
957
+ /**
958
+ * Tool call was cancelled before execution.
959
+ *
960
+ * @category Tool Call Types
961
+ */
962
+ export interface IToolCallCancelledState extends IToolCallBase, IToolCallParameterFields {
963
+ status: ToolCallStatus.Cancelled;
964
+ /** Why the tool was cancelled */
965
+ reason: ToolCallCancellationReason;
966
+ /** Optional message explaining the cancellation */
967
+ reasonMessage?: StringOrMarkdown;
968
+ /** What the user suggested doing instead */
969
+ userSuggestion?: IUserMessage;
970
+ }
971
+ /**
972
+ * Discriminated union of all tool call lifecycle states.
973
+ *
974
+ * See the [state model guide](/guide/state-model.html#tool-call-lifecycle)
975
+ * for the full state machine diagram.
976
+ *
977
+ * @category Tool Call Types
978
+ */
979
+ export type IToolCallState = IToolCallStreamingState | IToolCallPendingConfirmationState | IToolCallRunningState | IToolCallPendingResultConfirmationState | IToolCallCompletedState | IToolCallCancelledState;
980
+ /**
981
+ * Describes a tool available in a session, provided by either the server or the active client.
982
+ *
983
+ * @category Tool Definition Types
984
+ */
985
+ export interface IToolDefinition {
986
+ /** Unique tool identifier */
987
+ name: string;
988
+ /** Human-readable display name */
989
+ title?: string;
990
+ /** Description of what the tool does */
991
+ description?: string;
992
+ /**
993
+ * JSON Schema defining the expected input parameters.
994
+ *
995
+ * Optional because client-provided tools may not have formal schemas.
996
+ * Mirrors MCP `Tool.inputSchema`.
997
+ */
998
+ inputSchema?: {
999
+ type: "object";
1000
+ properties?: Record<string, object>;
1001
+ required?: string[];
1002
+ };
1003
+ /**
1004
+ * JSON Schema defining the structure of the tool's output.
1005
+ *
1006
+ * Mirrors MCP `Tool.outputSchema`.
1007
+ */
1008
+ outputSchema?: {
1009
+ type: "object";
1010
+ properties?: Record<string, object>;
1011
+ required?: string[];
1012
+ };
1013
+ /** Behavioral hints about the tool. All properties are advisory. */
1014
+ annotations?: IToolAnnotations;
1015
+ /**
1016
+ * Additional provider-specific metadata.
1017
+ *
1018
+ * Mirrors the MCP `_meta` convention.
1019
+ */
1020
+ _meta?: Record<string, unknown>;
1021
+ }
1022
+ /**
1023
+ * Behavioral hints about a tool. All properties are advisory and not
1024
+ * guaranteed to faithfully describe tool behavior.
1025
+ *
1026
+ * Mirrors MCP `ToolAnnotations` from the Model Context Protocol specification.
1027
+ *
1028
+ * @category Tool Definition Types
1029
+ */
1030
+ export interface IToolAnnotations {
1031
+ /** Alternate human-readable title */
1032
+ title?: string;
1033
+ /** Tool does not modify its environment (default: false) */
1034
+ readOnlyHint?: boolean;
1035
+ /** Tool may perform destructive updates (default: true) */
1036
+ destructiveHint?: boolean;
1037
+ /** Repeated calls with the same arguments have no additional effect (default: false) */
1038
+ idempotentHint?: boolean;
1039
+ /** Tool may interact with external entities (default: true) */
1040
+ openWorldHint?: boolean;
1041
+ }
1042
+ /**
1043
+ * Discriminant for tool result content types.
1044
+ *
1045
+ * @category Tool Result Content
1046
+ */
1047
+ export declare enum ToolResultContentType {
1048
+ Text = "text",
1049
+ EmbeddedResource = "embeddedResource",
1050
+ Resource = "resource",
1051
+ FileEdit = "fileEdit",
1052
+ Terminal = "terminal",
1053
+ Subagent = "subagent"
1054
+ }
1055
+ /**
1056
+ * Text content in a tool result.
1057
+ *
1058
+ * Mirrors MCP `TextContent`.
1059
+ *
1060
+ * @category Tool Result Content
1061
+ */
1062
+ export interface IToolResultTextContent {
1063
+ type: ToolResultContentType.Text;
1064
+ /** The text content */
1065
+ text: string;
1066
+ }
1067
+ /**
1068
+ * Base64-encoded binary content embedded in a tool result.
1069
+ *
1070
+ * Mirrors MCP `EmbeddedResource` for inline binary data.
1071
+ *
1072
+ * @category Tool Result Content
1073
+ */
1074
+ export interface IToolResultEmbeddedResourceContent {
1075
+ type: ToolResultContentType.EmbeddedResource;
1076
+ /** Base64-encoded data */
1077
+ data: string;
1078
+ /** Content type (e.g. `"image/png"`, `"application/pdf"`) */
1079
+ contentType: string;
1080
+ }
1081
+ /**
1082
+ * A reference to a resource stored outside the tool result.
1083
+ *
1084
+ * Wraps {@link IContentRef} for lazy-loading large results.
1085
+ *
1086
+ * @category Tool Result Content
1087
+ */
1088
+ export interface IToolResultResourceContent extends IContentRef {
1089
+ type: ToolResultContentType.Resource;
1090
+ }
1091
+ /**
1092
+ * Describes a file modification with before/after state and diff metadata.
1093
+ *
1094
+ * Supports creates (only `after`), deletes (only `before`), renames/moves
1095
+ * (different `uri` in `before` and `after`), and edits (same `uri`, different content).
1096
+ *
1097
+ * @category Tool Result Content
1098
+ */
1099
+ export interface IFileEdit {
1100
+ /** The file state before the edit. Absent for file creations or for in-place file edits. */
1101
+ before?: {
1102
+ /** URI of the file before the edit */
1103
+ uri: URI;
1104
+ /** Reference to the file content before the edit */
1105
+ content: IContentRef;
1106
+ };
1107
+ /** The file state after the edit. Absent for file deletions. */
1108
+ after?: {
1109
+ /** URI of the file after the edit */
1110
+ uri: URI;
1111
+ /** Reference to the file content after the edit */
1112
+ content: IContentRef;
1113
+ };
1114
+ /** Optional diff display metadata */
1115
+ diff?: {
1116
+ /** Number of items added (e.g., lines for text files, cells for notebooks) */
1117
+ added?: number;
1118
+ /** Number of items removed (e.g., lines for text files, cells for notebooks) */
1119
+ removed?: number;
1120
+ };
1121
+ }
1122
+ /**
1123
+ * Describes a file modification performed by a tool.
1124
+ *
1125
+ * @category Tool Result Content
1126
+ */
1127
+ export interface IToolResultFileEditContent extends IFileEdit {
1128
+ type: ToolResultContentType.FileEdit;
1129
+ }
1130
+ /**
1131
+ * A reference to a terminal whose output is relevant to this tool result.
1132
+ *
1133
+ * Clients can subscribe to the terminal's URI to stream its output in real
1134
+ * time, providing live feedback while a tool is executing.
1135
+ *
1136
+ * @category Tool Result Content
1137
+ */
1138
+ export interface IToolResultTerminalContent {
1139
+ type: ToolResultContentType.Terminal;
1140
+ /** Terminal URI (subscribable for full terminal state) */
1141
+ resource: URI;
1142
+ /** Display title for the terminal content */
1143
+ title: string;
1144
+ }
1145
+ /**
1146
+ * A reference to a subagent session spawned by a tool.
1147
+ *
1148
+ * Clients can subscribe to the subagent's session URI to stream its
1149
+ * progress in real time, including inner tool calls and responses.
1150
+ *
1151
+ * @category Tool Result Content
1152
+ */
1153
+ export interface IToolResultSubagentContent {
1154
+ type: ToolResultContentType.Subagent;
1155
+ /** Subagent session URI (subscribable for full session state) */
1156
+ resource: URI;
1157
+ /** Display title for the subagent */
1158
+ title: string;
1159
+ /** Internal agent name */
1160
+ agentName?: string;
1161
+ /** Human-readable description of the subagent's task */
1162
+ description?: string;
1163
+ }
1164
+ /**
1165
+ * Content block in a tool result.
1166
+ *
1167
+ * Mirrors the content blocks in MCP `CallToolResult.content`, plus
1168
+ * `IToolResultResourceContent` for lazy-loading large results,
1169
+ * `IToolResultFileEditContent` for file edit diffs,
1170
+ * `IToolResultTerminalContent` for live terminal output, and
1171
+ * `IToolResultSubagentContent` for subagent sessions (AHP extensions).
1172
+ *
1173
+ * @category Tool Result Content
1174
+ */
1175
+ export type IToolResultContent = IToolResultTextContent | IToolResultEmbeddedResourceContent | IToolResultResourceContent | IToolResultFileEditContent | IToolResultTerminalContent | IToolResultSubagentContent;
1176
+ /**
1177
+ * A reference to an [Open Plugins](https://open-plugins.com/) plugin.
1178
+ *
1179
+ * This is intentionally thin — AHP specifies plugin identity and metadata
1180
+ * but not implementation details, which are defined by the Open Plugins spec.
1181
+ *
1182
+ * @category Customization Types
1183
+ */
1184
+ export interface ICustomizationRef {
1185
+ /** Plugin URI (e.g. an HTTPS URL or marketplace identifier) */
1186
+ uri: URI;
1187
+ /** Human-readable name */
1188
+ displayName: string;
1189
+ /** Description of what the plugin provides */
1190
+ description?: string;
1191
+ /** Icons for the plugin */
1192
+ icons?: Icon[];
1193
+ /**
1194
+ * Opaque version token for this customization.
1195
+ *
1196
+ * Clients SHOULD include a nonce with every customization they provide.
1197
+ * Consumers can compare nonces to detect whether a customization has
1198
+ * changed since it was last seen, avoiding redundant reloads or copies.
1199
+ */
1200
+ nonce?: string;
1201
+ }
1202
+ /**
1203
+ * Loading status for a server-managed customization.
1204
+ *
1205
+ * @category Customization Types
1206
+ */
1207
+ export declare enum CustomizationStatus {
1208
+ /** Plugin is being loaded */
1209
+ Loading = "loading",
1210
+ /** Plugin is fully operational */
1211
+ Loaded = "loaded",
1212
+ /** Plugin partially loaded but has warnings */
1213
+ Degraded = "degraded",
1214
+ /** Plugin was unable to load */
1215
+ Error = "error"
1216
+ }
1217
+ /**
1218
+ * A customization active in a session.
1219
+ *
1220
+ * Entries without a `clientId` are server-provided; entries with a `clientId`
1221
+ * originate from that client.
1222
+ *
1223
+ * @category Customization Types
1224
+ */
1225
+ export interface ISessionCustomization {
1226
+ /** The plugin this customization refers to */
1227
+ customization: ICustomizationRef;
1228
+ /** Whether this customization is currently enabled */
1229
+ enabled: boolean;
1230
+ /** Server-reported loading status */
1231
+ status?: CustomizationStatus;
1232
+ /**
1233
+ * Human-readable status detail (e.g. error message or degradation warning).
1234
+ */
1235
+ statusMessage?: string;
1236
+ }
1237
+ /**
1238
+ * Lightweight terminal metadata exposed on the root state.
1239
+ *
1240
+ * @category Terminal Types
1241
+ */
1242
+ export interface ITerminalInfo {
1243
+ /** Terminal URI (subscribable for full terminal state) */
1244
+ resource: URI;
1245
+ /** Human-readable terminal title */
1246
+ title: string;
1247
+ /** Who currently holds this terminal */
1248
+ claim: ITerminalClaim;
1249
+ /** Process exit code, if the terminal process has exited */
1250
+ exitCode?: number;
1251
+ }
1252
+ /**
1253
+ * Discriminant for terminal claim kinds.
1254
+ *
1255
+ * @category Terminal Types
1256
+ */
1257
+ export declare enum TerminalClaimKind {
1258
+ Client = "client",
1259
+ Session = "session"
1260
+ }
1261
+ /**
1262
+ * A terminal claimed by a connected client.
1263
+ *
1264
+ * @category Terminal Types
1265
+ */
1266
+ export interface ITerminalClientClaim {
1267
+ /** Discriminant */
1268
+ kind: TerminalClaimKind.Client;
1269
+ /** The `clientId` of the claiming client */
1270
+ clientId: string;
1271
+ }
1272
+ /**
1273
+ * A terminal claimed by a session, optionally scoped to a specific turn or tool call.
1274
+ *
1275
+ * @category Terminal Types
1276
+ */
1277
+ export interface ITerminalSessionClaim {
1278
+ /** Discriminant */
1279
+ kind: TerminalClaimKind.Session;
1280
+ /** Session URI that claimed the terminal */
1281
+ session: URI;
1282
+ /** Optional turn identifier within the session */
1283
+ turnId?: string;
1284
+ /** Optional tool call identifier within the turn */
1285
+ toolCallId?: string;
1286
+ }
1287
+ /**
1288
+ * Describes who currently holds a terminal. A terminal may be claimed by
1289
+ * either a connected client or a session (e.g. during a tool call).
1290
+ *
1291
+ * @category Terminal Types
1292
+ */
1293
+ export type ITerminalClaim = ITerminalClientClaim | ITerminalSessionClaim;
1294
+ /**
1295
+ * Full state for a single terminal, loaded when a client subscribes to the terminal's URI.
1296
+ *
1297
+ * @category Terminal Types
1298
+ */
1299
+ export interface ITerminalState {
1300
+ /** Human-readable terminal title */
1301
+ title: string;
1302
+ /** Current working directory of the terminal process */
1303
+ cwd?: URI;
1304
+ /** Terminal width in columns */
1305
+ cols?: number;
1306
+ /** Terminal height in rows */
1307
+ rows?: number;
1308
+ /**
1309
+ * Typed content parts, replacing the flat `content: string`.
1310
+ *
1311
+ * Naive consumers that only need the raw VT stream can reconstruct it with:
1312
+ * `content.map(p => p.type === 'command' ? p.output : p.value).join('')`
1313
+ *
1314
+ * Consumers that need command boundaries can filter by part type.
1315
+ */
1316
+ content: ITerminalContentPart[];
1317
+ /** Process exit code, set when the terminal process exits */
1318
+ exitCode?: number;
1319
+ /** Who currently holds this terminal */
1320
+ claim: ITerminalClaim;
1321
+ /**
1322
+ * Whether this terminal emits `terminal/commandExecuted` and
1323
+ * `terminal/commandFinished` actions and populates `command`-typed parts.
1324
+ *
1325
+ * Clients MUST check this flag before relying on command detection.
1326
+ * Do NOT use the presence of a `command` part as a feature flag — parts
1327
+ * are absent in the normal idle state.
1328
+ */
1329
+ supportsCommandDetection?: boolean;
1330
+ }
1331
+ /**
1332
+ * A content part within terminal output.
1333
+ *
1334
+ * @category Terminal Types
1335
+ */
1336
+ export type ITerminalContentPart = ITerminalUnclassifiedPart | ITerminalCommandPart;
1337
+ /**
1338
+ * Unstructured terminal output — content before, between, or after commands,
1339
+ * or from terminals that do not support command detection.
1340
+ *
1341
+ * @category Terminal Types
1342
+ */
1343
+ export interface ITerminalUnclassifiedPart {
1344
+ type: "unclassified";
1345
+ /** Accumulated VT output. Appended to by `terminal/data` when no command is executing. */
1346
+ value: string;
1347
+ }
1348
+ /**
1349
+ * A single command: its command line and the output it produced.
1350
+ *
1351
+ * While `isComplete` is false the command is still executing; `output` grows
1352
+ * as `terminal/data` actions arrive. At `terminal/commandFinished` the part
1353
+ * is mutated in-place with `isComplete: true` and the completion metadata.
1354
+ *
1355
+ * @category Terminal Types
1356
+ */
1357
+ export interface ITerminalCommandPart {
1358
+ type: "command";
1359
+ /**
1360
+ * Stable id matching the `commandId` on the corresponding
1361
+ * `terminal/commandExecuted` and `terminal/commandFinished` actions.
1362
+ */
1363
+ commandId: string;
1364
+ /** The command line submitted to the shell. */
1365
+ commandLine: string;
1366
+ /**
1367
+ * Accumulated VT output. Appended to by `terminal/data` while `isComplete`
1368
+ * is false. Shell integration escape sequences are stripped by the server.
1369
+ */
1370
+ output: string;
1371
+ /** Unix timestamp (ms) when execution started, as reported by the server. */
1372
+ timestamp: number;
1373
+ /** Whether the command has finished. */
1374
+ isComplete: boolean;
1375
+ /** Shell exit code. Set at completion. `undefined` if unknown. */
1376
+ exitCode?: number;
1377
+ /** Wall-clock duration in milliseconds. Set at completion. */
1378
+ durationMs?: number;
1379
+ }
1380
+ /**
1381
+ * @category Common Types
1382
+ */
1383
+ export interface IUsageInfo {
1384
+ /** Input tokens consumed */
1385
+ inputTokens?: number;
1386
+ /** Output tokens generated */
1387
+ outputTokens?: number;
1388
+ /** Model used */
1389
+ model?: string;
1390
+ /** Tokens read from cache */
1391
+ cacheReadTokens?: number;
1392
+ }
1393
+ /**
1394
+ * @category Common Types
1395
+ */
1396
+ export interface IErrorInfo {
1397
+ /** Error type identifier */
1398
+ errorType: string;
1399
+ /** Human-readable error message */
1400
+ message: string;
1401
+ /** Stack trace */
1402
+ stack?: string;
1403
+ }
1404
+ /**
1405
+ * A point-in-time snapshot of a subscribed resource's state, returned by
1406
+ * `initialize`, `reconnect`, and `subscribe`.
1407
+ *
1408
+ * @category Common Types
1409
+ */
1410
+ export interface ISnapshot {
1411
+ /** The subscribed resource URI (e.g. `agenthost:/root` or `copilot:/<uuid>`) */
1412
+ resource: URI;
1413
+ /** The current state of the resource */
1414
+ state: IRootState | ISessionState | ITerminalState;
1415
+ /** The `serverSeq` at which this snapshot was taken. Subsequent actions will have `serverSeq > fromSeq`. */
1416
+ fromSeq: number;
1417
+ }
1418
+ export {};