1// This file is generated by the effect-acp package. Do not edit manually.
2// Current ACP schema release: schema-v1.21.0
3
4import * as Schema from "effect/Schema";
5
6export type SessionId = string;
7export const SessionId = Schema.String.annotate({
8 description:
9 "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)",
10 identifier: "SessionId",
11});
12
13export type NesSuggestionId = string;
14export const NesSuggestionId = Schema.String.annotate({
15 description: "Unique identifier for a next edit suggestion.",
16 identifier: "NesSuggestionId",
17});
18
19export type LogoutCapabilities = { readonly _meta?: { readonly [x: string]: Schema.Json } | null };
20export const LogoutCapabilities = Schema.Struct({
21 _meta: Schema.optionalKey(
22 Schema.Union([
23 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
24 description:
25 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
26 }),
27 Schema.Null,
28 ]),
29 ),
30}).annotate({
31 description:
32 "Logout capabilities supported by the agent.\n\nSupplying `{}` means the agent supports the logout method.",
33 identifier: "LogoutCapabilities",
34});
35
36export type PromptCapabilities = {
37 readonly image?: boolean;
38 readonly audio?: boolean;
39 readonly embeddedContext?: boolean;
40 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
41};
42export const PromptCapabilities = Schema.Struct({
43 image: Schema.optionalKey(
44 Schema.Boolean.annotate({
45 description: "Agent supports [`ContentBlock::Image`].",
46 default: false,
47 }),
48 ),
49 audio: Schema.optionalKey(
50 Schema.Boolean.annotate({
51 description: "Agent supports [`ContentBlock::Audio`].",
52 default: false,
53 }),
54 ),
55 embeddedContext: Schema.optionalKey(
56 Schema.Boolean.annotate({
57 description:
58 "Agent supports embedded context in `session/prompt` requests.\n\nWhen enabled, the Client is allowed to include [`ContentBlock::Resource`]\nin prompt requests for pieces of context that are referenced in the message.",
59 default: false,
60 }),
61 ),
62 _meta: Schema.optionalKey(
63 Schema.Union([
64 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
65 description:
66 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
67 }),
68 Schema.Null,
69 ]),
70 ),
71}).annotate({
72 description:
73 "Prompt capabilities supported by the agent in `session/prompt` requests.\n\nBaseline agent functionality requires support for [`ContentBlock::Text`]\nand [`ContentBlock::ResourceLink`] in prompt requests.\n\nOther variants must be explicitly opted in to.\nCapabilities for different types of content in prompt requests.\n\nIndicates which content types beyond the baseline (text and resource links)\nthe agent can process.\n\nSee protocol docs: [Prompt Capabilities](https://agentclientprotocol.com/protocol/initialization#prompt-capabilities)",
74 identifier: "PromptCapabilities",
75});
76
77export type McpCapabilities = {
78 readonly http?: boolean;
79 readonly sse?: boolean;
80 readonly acp?: boolean;
81 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
82};
83export const McpCapabilities = Schema.Struct({
84 http: Schema.optionalKey(
85 Schema.Boolean.annotate({ description: "Agent supports [`McpServer::Http`].", default: false }),
86 ),
87 sse: Schema.optionalKey(
88 Schema.Boolean.annotate({ description: "Agent supports [`McpServer::Sse`].", default: false }),
89 ),
90 acp: Schema.optionalKey(
91 Schema.Boolean.annotate({
92 description:
93 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAgent supports [`McpServer::Acp`].",
94 default: false,
95 }),
96 ),
97 _meta: Schema.optionalKey(
98 Schema.Union([
99 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
100 description:
101 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
102 }),
103 Schema.Null,
104 ]),
105 ),
106}).annotate({
107 description: "MCP capabilities supported by the agent",
108 identifier: "McpCapabilities",
109});
110
111export type SessionListCapabilities = {
112 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
113};
114export const SessionListCapabilities = Schema.Struct({
115 _meta: Schema.optionalKey(
116 Schema.Union([
117 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
118 description:
119 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
120 }),
121 Schema.Null,
122 ]),
123 ),
124}).annotate({
125 description:
126 "Capabilities for the `session/list` method.\n\nSupplying `{}` means the agent supports listing sessions.",
127 identifier: "SessionListCapabilities",
128});
129
130export type SessionDeleteCapabilities = {
131 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
132};
133export const SessionDeleteCapabilities = Schema.Struct({
134 _meta: Schema.optionalKey(
135 Schema.Union([
136 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
137 description:
138 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
139 }),
140 Schema.Null,
141 ]),
142 ),
143}).annotate({
144 description:
145 "Capabilities for the `session/delete` method.\n\nSupplying `{}` means the agent supports deleting sessions from `session/list`.",
146 identifier: "SessionDeleteCapabilities",
147});
148
149export type SessionAdditionalDirectoriesCapabilities = {
150 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
151};
152export const SessionAdditionalDirectoriesCapabilities = Schema.Struct({
153 _meta: Schema.optionalKey(
154 Schema.Union([
155 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
156 description:
157 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
158 }),
159 Schema.Null,
160 ]),
161 ),
162}).annotate({
163 description:
164 "Capabilities for additional session directories support.\n\nSupplying `{}` means the agent supports the `additionalDirectories` field on\nsupported session lifecycle requests. Agents that also support\n`session/list` may return `SessionInfo.additionalDirectories` to report the\ncomplete ordered additional-root list associated with a listed session.",
165 identifier: "SessionAdditionalDirectoriesCapabilities",
166});
167
168export type SessionForkCapabilities = {
169 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
170};
171export const SessionForkCapabilities = Schema.Struct({
172 _meta: Schema.optionalKey(
173 Schema.Union([
174 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
175 description:
176 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
177 }),
178 Schema.Null,
179 ]),
180 ),
181}).annotate({
182 description:
183 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCapabilities for the `session/fork` method.\n\nSupplying `{}` means the agent supports forking sessions.",
184 identifier: "SessionForkCapabilities",
185});
186
187export type SessionResumeCapabilities = {
188 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
189};
190export const SessionResumeCapabilities = Schema.Struct({
191 _meta: Schema.optionalKey(
192 Schema.Union([
193 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
194 description:
195 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
196 }),
197 Schema.Null,
198 ]),
199 ),
200}).annotate({
201 description:
202 "Capabilities for the `session/resume` method.\n\nSupplying `{}` means the agent supports resuming sessions.",
203 identifier: "SessionResumeCapabilities",
204});
205
206export type SessionCloseCapabilities = {
207 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
208};
209export const SessionCloseCapabilities = Schema.Struct({
210 _meta: Schema.optionalKey(
211 Schema.Union([
212 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
213 description:
214 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
215 }),
216 Schema.Null,
217 ]),
218 ),
219}).annotate({
220 description:
221 "Capabilities for the `session/close` method.\n\nSupplying `{}` means the agent supports closing sessions.",
222 identifier: "SessionCloseCapabilities",
223});
224
225export type ProvidersCapabilities = {
226 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
227};
228export const ProvidersCapabilities = Schema.Struct({
229 _meta: Schema.optionalKey(
230 Schema.Union([
231 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
232 description:
233 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
234 }),
235 Schema.Null,
236 ]),
237 ),
238}).annotate({
239 description:
240 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nProvider configuration capabilities supported by the agent.\n\nSupplying `{}` means the agent supports provider configuration methods.",
241 identifier: "ProvidersCapabilities",
242});
243
244export type NesDocumentDidOpenCapabilities = {
245 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
246};
247export const NesDocumentDidOpenCapabilities = Schema.Struct({
248 _meta: Schema.optionalKey(
249 Schema.Union([
250 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
251 description:
252 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
253 }),
254 Schema.Null,
255 ]),
256 ),
257}).annotate({
258 description: "Marker for `document/didOpen` capability support.",
259 identifier: "NesDocumentDidOpenCapabilities",
260});
261
262export type TextDocumentSyncKind = "full" | "incremental";
263export const TextDocumentSyncKind = Schema.Union([
264 Schema.Literal("full").annotate({
265 description: "Client sends the entire file content on each change.",
266 }),
267 Schema.Literal("incremental").annotate({ description: "Client sends only the changed ranges." }),
268]).annotate({
269 description: "How the agent wants document changes delivered.",
270 identifier: "TextDocumentSyncKind",
271});
272
273export type NesDocumentDidCloseCapabilities = {
274 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
275};
276export const NesDocumentDidCloseCapabilities = Schema.Struct({
277 _meta: Schema.optionalKey(
278 Schema.Union([
279 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
280 description:
281 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
282 }),
283 Schema.Null,
284 ]),
285 ),
286}).annotate({
287 description: "Marker for `document/didClose` capability support.",
288 identifier: "NesDocumentDidCloseCapabilities",
289});
290
291export type NesDocumentDidSaveCapabilities = {
292 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
293};
294export const NesDocumentDidSaveCapabilities = Schema.Struct({
295 _meta: Schema.optionalKey(
296 Schema.Union([
297 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
298 description:
299 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
300 }),
301 Schema.Null,
302 ]),
303 ),
304}).annotate({
305 description: "Marker for `document/didSave` capability support.",
306 identifier: "NesDocumentDidSaveCapabilities",
307});
308
309export type NesDocumentDidFocusCapabilities = {
310 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
311};
312export const NesDocumentDidFocusCapabilities = Schema.Struct({
313 _meta: Schema.optionalKey(
314 Schema.Union([
315 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
316 description:
317 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
318 }),
319 Schema.Null,
320 ]),
321 ),
322}).annotate({
323 description: "Marker for `document/didFocus` capability support.",
324 identifier: "NesDocumentDidFocusCapabilities",
325});
326
327export type NesRecentFilesCapabilities = {
328 readonly maxCount?: number | null;
329 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
330};
331export const NesRecentFilesCapabilities = Schema.Struct({
332 maxCount: Schema.optionalKey(
333 Schema.Union([
334 Schema.Number.annotate({
335 description: "Maximum number of recent files the agent can use.",
336 format: "uint32",
337 })
338 .check(Schema.isInt().annotate({ expected: "an integer" }))
339 .check(
340 Schema.isGreaterThanOrEqualTo(0).annotate({
341 expected: "a value greater than or equal to 0",
342 }),
343 ),
344 Schema.Null,
345 ]),
346 ),
347 _meta: Schema.optionalKey(
348 Schema.Union([
349 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
350 description:
351 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
352 }),
353 Schema.Null,
354 ]),
355 ),
356}).annotate({
357 description: "Capabilities for recent files context.",
358 identifier: "NesRecentFilesCapabilities",
359});
360
361export type NesRelatedSnippetsCapabilities = {
362 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
363};
364export const NesRelatedSnippetsCapabilities = Schema.Struct({
365 _meta: Schema.optionalKey(
366 Schema.Union([
367 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
368 description:
369 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
370 }),
371 Schema.Null,
372 ]),
373 ),
374}).annotate({
375 description: "Capabilities for related snippets context.",
376 identifier: "NesRelatedSnippetsCapabilities",
377});
378
379export type NesEditHistoryCapabilities = {
380 readonly maxCount?: number | null;
381 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
382};
383export const NesEditHistoryCapabilities = Schema.Struct({
384 maxCount: Schema.optionalKey(
385 Schema.Union([
386 Schema.Number.annotate({
387 description: "Maximum number of edit history entries the agent can use.",
388 format: "uint32",
389 })
390 .check(Schema.isInt().annotate({ expected: "an integer" }))
391 .check(
392 Schema.isGreaterThanOrEqualTo(0).annotate({
393 expected: "a value greater than or equal to 0",
394 }),
395 ),
396 Schema.Null,
397 ]),
398 ),
399 _meta: Schema.optionalKey(
400 Schema.Union([
401 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
402 description:
403 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
404 }),
405 Schema.Null,
406 ]),
407 ),
408}).annotate({
409 description: "Capabilities for edit history context.",
410 identifier: "NesEditHistoryCapabilities",
411});
412
413export type NesUserActionsCapabilities = {
414 readonly maxCount?: number | null;
415 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
416};
417export const NesUserActionsCapabilities = Schema.Struct({
418 maxCount: Schema.optionalKey(
419 Schema.Union([
420 Schema.Number.annotate({
421 description: "Maximum number of user actions the agent can use.",
422 format: "uint32",
423 })
424 .check(Schema.isInt().annotate({ expected: "an integer" }))
425 .check(
426 Schema.isGreaterThanOrEqualTo(0).annotate({
427 expected: "a value greater than or equal to 0",
428 }),
429 ),
430 Schema.Null,
431 ]),
432 ),
433 _meta: Schema.optionalKey(
434 Schema.Union([
435 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
436 description:
437 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
438 }),
439 Schema.Null,
440 ]),
441 ),
442}).annotate({
443 description: "Capabilities for user actions context.",
444 identifier: "NesUserActionsCapabilities",
445});
446
447export type NesOpenFilesCapabilities = {
448 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
449};
450export const NesOpenFilesCapabilities = Schema.Struct({
451 _meta: Schema.optionalKey(
452 Schema.Union([
453 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
454 description:
455 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
456 }),
457 Schema.Null,
458 ]),
459 ),
460}).annotate({
461 description: "Capabilities for open files context.",
462 identifier: "NesOpenFilesCapabilities",
463});
464
465export type NesDiagnosticsCapabilities = {
466 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
467};
468export const NesDiagnosticsCapabilities = Schema.Struct({
469 _meta: Schema.optionalKey(
470 Schema.Union([
471 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
472 description:
473 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
474 }),
475 Schema.Null,
476 ]),
477 ),
478}).annotate({
479 description: "Capabilities for diagnostics context.",
480 identifier: "NesDiagnosticsCapabilities",
481});
482
483export type PositionEncodingKind = "utf-16" | "utf-32" | "utf-8";
484export const PositionEncodingKind = Schema.Union([
485 Schema.Literal("utf-16").annotate({
486 description: "Character offsets count UTF-16 code units. This is the default.",
487 }),
488 Schema.Literal("utf-32").annotate({
489 description: "Character offsets count Unicode code points.",
490 }),
491 Schema.Literal("utf-8").annotate({
492 description: "Character offsets count UTF-8 code units (bytes).",
493 }),
494]).annotate({
495 description:
496 "The encoding used for character offsets in positions.\n\nFollows the same conventions as LSP 3.17. The default is UTF-16.",
497 identifier: "PositionEncodingKind",
498});
499
500export type Role = "assistant" | "user";
501export const Role = Schema.Union([
502 Schema.Literal("assistant").annotate({ description: "The assistant side of a conversation." }),
503 Schema.Literal("user").annotate({ description: "The user side of a conversation." }),
504]).annotate({
505 description: "The sender or recipient of messages and data in a conversation.",
506 identifier: "Role",
507});
508
509export type TextResourceContents = {
510 readonly mimeType?: string | null;
511 readonly text: string;
512 readonly uri: string;
513 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
514};
515export const TextResourceContents = Schema.Struct({
516 mimeType: Schema.optionalKey(
517 Schema.Union([
518 Schema.String.annotate({ description: "MIME type describing the encoded media payload." }),
519 Schema.Null,
520 ]),
521 ),
522 text: Schema.String.annotate({ description: "Text payload carried by this content block." }),
523 uri: Schema.String.annotate({
524 description: "URI associated with this resource or media payload.",
525 }),
526 _meta: Schema.optionalKey(
527 Schema.Union([
528 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
529 description:
530 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
531 }),
532 Schema.Null,
533 ]),
534 ),
535}).annotate({ description: "Text-based resource contents.", identifier: "TextResourceContents" });
536
537export type BlobResourceContents = {
538 readonly blob: string;
539 readonly mimeType?: string | null;
540 readonly uri: string;
541 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
542};
543export const BlobResourceContents = Schema.Struct({
544 blob: Schema.String.annotate({
545 description: "Base64-encoded bytes for a binary resource payload.",
546 }),
547 mimeType: Schema.optionalKey(
548 Schema.Union([
549 Schema.String.annotate({ description: "MIME type describing the encoded media payload." }),
550 Schema.Null,
551 ]),
552 ),
553 uri: Schema.String.annotate({
554 description: "URI associated with this resource or media payload.",
555 }),
556 _meta: Schema.optionalKey(
557 Schema.Union([
558 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
559 description:
560 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
561 }),
562 Schema.Null,
563 ]),
564 ),
565}).annotate({ description: "Binary resource contents.", identifier: "BlobResourceContents" });
566
567export type MessageId = string;
568export const MessageId = Schema.String.annotate({
569 description: "Unique identifier for a message within a session.",
570 identifier: "MessageId",
571});
572
573export type ToolCallId = string;
574export const ToolCallId = Schema.String.annotate({
575 description: "Unique identifier for a tool call within a session.",
576 identifier: "ToolCallId",
577});
578
579export type ToolKind =
580 | "read"
581 | "edit"
582 | "delete"
583 | "move"
584 | "search"
585 | "execute"
586 | "think"
587 | "fetch"
588 | "switch_mode"
589 | "other";
590export const ToolKind = Schema.Union([
591 Schema.Literal("read").annotate({ description: "Reading files or data." }),
592 Schema.Literal("edit").annotate({ description: "Modifying files or content." }),
593 Schema.Literal("delete").annotate({ description: "Removing files or data." }),
594 Schema.Literal("move").annotate({ description: "Moving or renaming files." }),
595 Schema.Literal("search").annotate({ description: "Searching for information." }),
596 Schema.Literal("execute").annotate({ description: "Running commands or code." }),
597 Schema.Literal("think").annotate({ description: "Internal reasoning or planning." }),
598 Schema.Literal("fetch").annotate({ description: "Retrieving external data." }),
599 Schema.Literal("switch_mode").annotate({ description: "Switching the current session mode." }),
600 Schema.Literal("other").annotate({ description: "Other tool types (default)." }),
601]).annotate({
602 description:
603 "Categories of tools that can be invoked.\n\nTool kinds help clients choose appropriate icons and optimize how they\ndisplay tool execution progress.\n\nSee protocol docs: [Creating](https://agentclientprotocol.com/protocol/tool-calls#creating)",
604 identifier: "ToolKind",
605});
606
607export type ToolCallStatus = "pending" | "in_progress" | "completed" | "failed";
608export const ToolCallStatus = Schema.Union([
609 Schema.Literal("pending").annotate({
610 description:
611 "The tool call hasn't started running yet because the input is either\nstreaming or we're awaiting approval.",
612 }),
613 Schema.Literal("in_progress").annotate({ description: "The tool call is currently running." }),
614 Schema.Literal("completed").annotate({ description: "The tool call completed successfully." }),
615 Schema.Literal("failed").annotate({ description: "The tool call failed with an error." }),
616]).annotate({
617 description:
618 "Execution status of a tool call.\n\nTool calls progress through different statuses during their lifecycle.\n\nSee protocol docs: [Status](https://agentclientprotocol.com/protocol/tool-calls#status)",
619 identifier: "ToolCallStatus",
620});
621
622export type TerminalId = string;
623export const TerminalId = Schema.String.annotate({
624 description: "Typed identifier used for terminal values on the wire.",
625 identifier: "TerminalId",
626});
627
628export type ToolCallLocation = {
629 readonly path: string;
630 readonly line?: number | null;
631 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
632};
633export const ToolCallLocation = Schema.Struct({
634 path: Schema.String.annotate({
635 description: "The absolute file path being accessed or modified.",
636 }),
637 line: Schema.optionalKey(
638 Schema.Union([
639 Schema.Number.annotate({
640 description: "Optional line number within the file.",
641 format: "uint32",
642 })
643 .check(Schema.isInt().annotate({ expected: "an integer" }))
644 .check(
645 Schema.isGreaterThanOrEqualTo(0).annotate({
646 expected: "a value greater than or equal to 0",
647 }),
648 ),
649 Schema.Null,
650 ]),
651 ),
652 _meta: Schema.optionalKey(
653 Schema.Union([
654 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
655 description:
656 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
657 }),
658 Schema.Null,
659 ]),
660 ),
661}).annotate({
662 description:
663 'A file location being accessed or modified by a tool.\n\nEnables clients to implement "follow-along" features that track\nwhich files the agent is working with in real-time.\n\nSee protocol docs: [Following the Agent](https://agentclientprotocol.com/protocol/tool-calls#following-the-agent)',
664 identifier: "ToolCallLocation",
665});
666
667export type PlanEntryPriority = "high" | "medium" | "low";
668export const PlanEntryPriority = Schema.Union([
669 Schema.Literal("high").annotate({
670 description: "High priority task - critical to the overall goal.",
671 }),
672 Schema.Literal("medium").annotate({
673 description: "Medium priority task - important but not critical.",
674 }),
675 Schema.Literal("low").annotate({
676 description: "Low priority task - nice to have but not essential.",
677 }),
678]).annotate({
679 description:
680 "Priority levels for plan entries.\n\nUsed to indicate the relative importance or urgency of different\ntasks in the execution plan.\nSee protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/agent-plan#plan-entries)",
681 identifier: "PlanEntryPriority",
682});
683
684export type PlanEntryStatus = "pending" | "in_progress" | "completed";
685export const PlanEntryStatus = Schema.Union([
686 Schema.Literal("pending").annotate({ description: "The task has not started yet." }),
687 Schema.Literal("in_progress").annotate({ description: "The task is currently being worked on." }),
688 Schema.Literal("completed").annotate({
689 description: "The task has been successfully completed.",
690 }),
691]).annotate({
692 description:
693 "Status of a plan entry in the execution flow.\n\nTracks the lifecycle of each task from planning through completion.\nSee protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/agent-plan#plan-entries)",
694 identifier: "PlanEntryStatus",
695});
696
697export type PlanId = string;
698export const PlanId = Schema.String.annotate({
699 description:
700 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nUnique identifier for a plan within a session.",
701 identifier: "PlanId",
702});
703
704export type UnstructuredCommandInput = {
705 readonly hint: string;
706 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
707};
708export const UnstructuredCommandInput = Schema.Struct({
709 hint: Schema.String.annotate({
710 description: "A hint to display when the input hasn't been provided yet",
711 }),
712 _meta: Schema.optionalKey(
713 Schema.Union([
714 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
715 description:
716 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
717 }),
718 Schema.Null,
719 ]),
720 ),
721}).annotate({
722 description: "All text that was typed after the command name is provided as input.",
723 identifier: "UnstructuredCommandInput",
724});
725
726export type SessionModeId = string;
727export const SessionModeId = Schema.String.annotate({
728 description: "Unique identifier for a Session Mode.",
729 identifier: "SessionModeId",
730});
731
732export type SessionConfigId = string;
733export const SessionConfigId = Schema.String.annotate({
734 description: "Unique identifier for a session configuration option.",
735 identifier: "SessionConfigId",
736});
737
738export type SessionConfigOptionCategory =
739 | "mode"
740 | "model"
741 | "model_config"
742 | "thought_level"
743 | string;
744export const SessionConfigOptionCategory = Schema.Union([
745 Schema.Literal("mode").annotate({ description: "Session mode selector." }),
746 Schema.Literal("model").annotate({ description: "Model selector." }),
747 Schema.Literal("model_config").annotate({
748 description: "Model-related configuration parameter.",
749 }),
750 Schema.Literal("thought_level").annotate({ description: "Thought/reasoning level selector." }),
751 Schema.String.annotate({ title: "other", description: "Unknown / uncategorized selector." }),
752]).annotate({
753 description:
754 "Semantic category for a session configuration option.\n\nThis is intended to help Clients distinguish broadly common selectors (e.g. model selector vs\nsession mode selector vs thought/reasoning level) for UX purposes (keyboard shortcuts, icons,\nplacement). It MUST NOT be required for correctness. Clients MUST handle missing or unknown\ncategories gracefully.\n\nCategory names beginning with `_` are free for custom use, like other ACP extension methods.\nCategory names that do not begin with `_` are reserved for the ACP spec.",
755 identifier: "SessionConfigOptionCategory",
756});
757
758export type SessionConfigValueId = string;
759export const SessionConfigValueId = Schema.String.annotate({
760 description: "Unique identifier for a session configuration option value.",
761 identifier: "SessionConfigValueId",
762});
763
764export type SessionConfigGroupId = string;
765export const SessionConfigGroupId = Schema.String.annotate({
766 description: "Unique identifier for a session configuration option value group.",
767 identifier: "SessionConfigGroupId",
768});
769
770export type Cost = {
771 readonly amount: number;
772 readonly currency: string;
773 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
774};
775export const Cost = Schema.Struct({
776 amount: Schema.Number.annotate({
777 description: "Total cumulative cost for session.",
778 format: "double",
779 }).check(Schema.isFinite().annotate({ expected: "a finite number" })),
780 currency: Schema.String.annotate({ description: 'ISO 4217 currency code (e.g., "USD", "EUR").' }),
781 _meta: Schema.optionalKey(
782 Schema.Union([
783 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
784 description:
785 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
786 }),
787 Schema.Null,
788 ]),
789 ),
790}).annotate({ description: "Cost information for a session.", identifier: "Cost" });
791
792export type CompactionId = string;
793export const CompactionId = Schema.String.annotate({
794 description:
795 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nUnique identifier for a context compaction within a session.",
796 identifier: "CompactionId",
797});
798
799export type CompactionStatus = "in_progress" | "completed" | "failed" | "cancelled" | string;
800export const CompactionStatus = Schema.Union([
801 Schema.Literal("in_progress").annotate({
802 description: "Compaction has started and has not finished.",
803 }),
804 Schema.Literal("completed").annotate({ description: "Compaction finished successfully." }),
805 Schema.Literal("failed").annotate({ description: "Compaction finished unsuccessfully." }),
806 Schema.Literal("cancelled").annotate({
807 description: "Compaction was cancelled before it finished.",
808 }),
809 Schema.String.annotate({
810 title: "other",
811 description:
812 "Custom or future compaction status.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Other unknown values are reserved for future ACP statuses.",
813 }),
814]).annotate({
815 description:
816 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nLifecycle state of a context compaction.",
817 identifier: "CompactionStatus",
818});
819
820export type ElicitationId = string;
821export const ElicitationId = Schema.String.annotate({
822 description: "Unique identifier for an elicitation.",
823 identifier: "ElicitationId",
824});
825
826export type McpConnectionId = string;
827export const McpConnectionId = Schema.String.annotate({
828 description:
829 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA unique identifier for an active MCP-over-ACP connection.",
830 identifier: "McpConnectionId",
831});
832
833export type ExtNotification = Schema.Json;
834export const ExtNotification = Schema.Json.annotate({
835 expected: "JSON value",
836 description:
837 "Allows the Agent to send an arbitrary notification that is not part of the ACP spec.\nExtension notifications provide a way to send one-way messages for custom functionality\nwhile maintaining protocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
838 identifier: "ExtNotification",
839});
840
841export type RequestId = null | number | string;
842export const RequestId = Schema.Union([
843 Schema.Null.annotate({ title: "Null", description: "The JSON-RPC `null` request id." }),
844 Schema.Number.annotate({
845 title: "Number",
846 description: "A numeric JSON-RPC request id.",
847 format: "int64",
848 }).check(Schema.isInt().annotate({ expected: "an integer" })),
849 Schema.String.annotate({ title: "Str", description: "A string JSON-RPC request id." }),
850]).annotate({
851 description:
852 "JSON RPC Request Id\n\nAn identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null \\[1\\] and Numbers SHOULD NOT contain fractional parts \\[2\\]\n\nThe Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.\n\n\\[1\\] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.\n\n\\[2\\] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions.",
853 identifier: "RequestId",
854});
855
856export type PermissionOptionId = string;
857export const PermissionOptionId = Schema.String.annotate({
858 description: "Unique identifier for a permission option.",
859 identifier: "PermissionOptionId",
860});
861
862export type PermissionOptionKind = "allow_once" | "allow_always" | "reject_once" | "reject_always";
863export const PermissionOptionKind = Schema.Union([
864 Schema.Literal("allow_once").annotate({ description: "Allow this operation only this time." }),
865 Schema.Literal("allow_always").annotate({
866 description: "Allow this operation and remember the choice.",
867 }),
868 Schema.Literal("reject_once").annotate({ description: "Reject this operation only this time." }),
869 Schema.Literal("reject_always").annotate({
870 description: "Reject this operation and remember the choice.",
871 }),
872]).annotate({
873 description:
874 "The type of permission option being presented to the user.\n\nHelps clients choose appropriate icons and UI treatment.",
875 identifier: "PermissionOptionKind",
876});
877
878export type EnvVariable = {
879 readonly name: string;
880 readonly value: string;
881 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
882};
883export const EnvVariable = Schema.Struct({
884 name: Schema.String.annotate({ description: "The name of the environment variable." }),
885 value: Schema.String.annotate({ description: "The value to set for the environment variable." }),
886 _meta: Schema.optionalKey(
887 Schema.Union([
888 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
889 description:
890 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
891 }),
892 Schema.Null,
893 ]),
894 ),
895}).annotate({
896 description: "An environment variable to set when launching an MCP server.",
897 identifier: "EnvVariable",
898});
899
900export type ElicitationSchemaType = "object";
901export const ElicitationSchemaType = Schema.Union([
902 Schema.Literal("object").annotate({ description: "Object schema type." }),
903]).annotate({
904 description: "Type discriminator for elicitation schemas.",
905 identifier: "ElicitationSchemaType",
906});
907
908export type StringFormat = "email" | "uri" | "date" | "date-time";
909export const StringFormat = Schema.Union([
910 Schema.Literal("email").annotate({ description: "Email address format." }),
911 Schema.Literal("uri").annotate({ description: "URI format." }),
912 Schema.Literal("date").annotate({ description: "Date format (YYYY-MM-DD)." }),
913 Schema.Literal("date-time").annotate({ description: "Date-time format (ISO 8601)." }),
914]).annotate({
915 description: "String format types for string properties in elicitation schemas.",
916 identifier: "StringFormat",
917});
918
919export type EnumOption = {
920 readonly const: string;
921 readonly title: string;
922 readonly description?: string | null;
923 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
924};
925export const EnumOption = Schema.Struct({
926 const: Schema.String.annotate({ description: "The constant value for this option." }),
927 title: Schema.String.annotate({ description: "Human-readable title for this option." }),
928 description: Schema.optionalKey(
929 Schema.Union([
930 Schema.String.annotate({
931 description:
932 "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.",
933 }),
934 Schema.Null,
935 ]),
936 ),
937 _meta: Schema.optionalKey(
938 Schema.Union([
939 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
940 description:
941 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
942 }),
943 Schema.Null,
944 ]),
945 ),
946}).annotate({
947 description:
948 "A titled enum option with a const value, human-readable title, and optional description.",
949 identifier: "EnumOption",
950});
951
952export type TitledMultiSelectItems = never;
953export const TitledMultiSelectItems = Schema.Never.annotate({
954 description: "Items definition for titled multi-select enum properties.",
955 identifier: "TitledMultiSelectItems",
956});
957
958export type McpServerAcpId = string;
959export const McpServerAcpId = Schema.String.annotate({
960 description:
961 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nUnique identifier for an MCP server using the ACP transport.\n\nThe value is opaque and generated by the ACP component providing the MCP server. It is\nused by `mcp/connect` to route connection requests back to the component that declared the\nserver.",
962 identifier: "McpServerAcpId",
963});
964
965export type ExtRequest = Schema.Json;
966export const ExtRequest = Schema.Json.annotate({
967 expected: "JSON value",
968 description:
969 "Allows for sending an arbitrary request that is not part of the ACP spec.\nExtension methods provide a way to add custom functionality while maintaining\nprotocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
970 identifier: "ExtRequest",
971});
972
973export type ProtocolVersion = number;
974export const ProtocolVersion = Schema.Number.annotate({
975 description:
976 "Protocol version identifier.\n\nThis version is only bumped for breaking changes.\nNon-breaking changes should be introduced via capabilities.",
977 format: "uint16",
978})
979 .check(Schema.isInt().annotate({ expected: "an integer" }))
980 .check(
981 Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }),
982 )
983 .check(
984 Schema.isLessThanOrEqualTo(65535).annotate({
985 expected: "a value less than or equal to 65535",
986 identifier: "ProtocolVersion",
987 }),
988 );
989
990export type AuthMethodId = string;
991export const AuthMethodId = Schema.String.annotate({
992 description: "Typed identifier used for auth method values on the wire.",
993 identifier: "AuthMethodId",
994});
995
996export type Implementation = {
997 readonly name: string;
998 readonly title?: string | null;
999 readonly version: string;
1000 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1001};
1002export const Implementation = Schema.Struct({
1003 name: Schema.String.annotate({
1004 description:
1005 "Intended for programmatic or logical use, but can be used as a display\nname fallback if title isn’t present.",
1006 }),
1007 title: Schema.optionalKey(
1008 Schema.Union([
1009 Schema.String.annotate({
1010 description:
1011 "Intended for UI and end-user contexts — optimized to be human-readable\nand easily understood.\n\nIf not provided, the name should be used for display.",
1012 }),
1013 Schema.Null,
1014 ]),
1015 ),
1016 version: Schema.String.annotate({
1017 description:
1018 'Version of the implementation. Can be displayed to the user or used\nfor debugging or metrics purposes. (e.g. "1.0.0").',
1019 }),
1020 _meta: Schema.optionalKey(
1021 Schema.Union([
1022 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1023 description:
1024 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1025 }),
1026 Schema.Null,
1027 ]),
1028 ),
1029}).annotate({
1030 description:
1031 "Metadata about the implementation of the client or agent.\nDescribes the name and version of an ACP implementation, with an optional\ntitle for UI representation.",
1032 identifier: "Implementation",
1033});
1034
1035export type AuthenticateResponse = {
1036 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1037};
1038export const AuthenticateResponse = Schema.Struct({
1039 _meta: Schema.optionalKey(
1040 Schema.Union([
1041 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1042 description:
1043 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1044 }),
1045 Schema.Null,
1046 ]),
1047 ),
1048}).annotate({
1049 description: "Response to the `authenticate` method.",
1050 identifier: "AuthenticateResponse",
1051});
1052
1053export type ProviderId = string;
1054export const ProviderId = Schema.String.annotate({
1055 description:
1056 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nUnique identifier for a configurable LLM provider.",
1057 identifier: "ProviderId",
1058});
1059
1060export type LlmProtocol = "anthropic" | "openai" | "azure" | "vertex" | "bedrock" | string;
1061export const LlmProtocol = Schema.Union([
1062 Schema.Literal("anthropic").annotate({ description: "Anthropic API protocol." }),
1063 Schema.Literal("openai").annotate({ description: "OpenAI API protocol." }),
1064 Schema.Literal("azure").annotate({ description: "Azure OpenAI API protocol." }),
1065 Schema.Literal("vertex").annotate({ description: "Google Vertex AI API protocol." }),
1066 Schema.Literal("bedrock").annotate({ description: "AWS Bedrock API protocol." }),
1067 Schema.String.annotate({ title: "other", description: "Unknown or custom protocol." }),
1068]).annotate({
1069 description:
1070 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWell-known API protocol identifiers for LLM providers.\n\nAgents and clients MUST handle unknown protocol identifiers gracefully.\n\nProtocol names beginning with `_` are free for custom use, like other ACP extension methods.\nProtocol names that do not begin with `_` are reserved for the ACP spec.",
1071 identifier: "LlmProtocol",
1072});
1073
1074export type SetProviderResponse = { readonly _meta?: { readonly [x: string]: Schema.Json } | null };
1075export const SetProviderResponse = Schema.Struct({
1076 _meta: Schema.optionalKey(
1077 Schema.Union([
1078 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1079 description:
1080 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1081 }),
1082 Schema.Null,
1083 ]),
1084 ),
1085}).annotate({
1086 description:
1087 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse to `providers/set`.",
1088 identifier: "SetProviderResponse",
1089});
1090
1091export type DisableProviderResponse = {
1092 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1093};
1094export const DisableProviderResponse = Schema.Struct({
1095 _meta: Schema.optionalKey(
1096 Schema.Union([
1097 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1098 description:
1099 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1100 }),
1101 Schema.Null,
1102 ]),
1103 ),
1104}).annotate({
1105 description:
1106 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse to `providers/disable`.",
1107 identifier: "DisableProviderResponse",
1108});
1109
1110export type LogoutResponse = { readonly _meta?: { readonly [x: string]: Schema.Json } | null };
1111export const LogoutResponse = Schema.Struct({
1112 _meta: Schema.optionalKey(
1113 Schema.Union([
1114 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1115 description:
1116 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1117 }),
1118 Schema.Null,
1119 ]),
1120 ),
1121}).annotate({ description: "Response to the `logout` method.", identifier: "LogoutResponse" });
1122
1123export type DeleteSessionResponse = {
1124 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1125};
1126export const DeleteSessionResponse = Schema.Struct({
1127 _meta: Schema.optionalKey(
1128 Schema.Union([
1129 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1130 description:
1131 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1132 }),
1133 Schema.Null,
1134 ]),
1135 ),
1136}).annotate({
1137 description: "Response from deleting a session.",
1138 identifier: "DeleteSessionResponse",
1139});
1140
1141export type CloseSessionResponse = {
1142 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1143};
1144export const CloseSessionResponse = Schema.Struct({
1145 _meta: Schema.optionalKey(
1146 Schema.Union([
1147 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1148 description:
1149 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1150 }),
1151 Schema.Null,
1152 ]),
1153 ),
1154}).annotate({
1155 description: "Response from closing a session.",
1156 identifier: "CloseSessionResponse",
1157});
1158
1159export type SetSessionModeResponse = {
1160 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1161};
1162export const SetSessionModeResponse = Schema.Struct({
1163 _meta: Schema.optionalKey(
1164 Schema.Union([
1165 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1166 description:
1167 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1168 }),
1169 Schema.Null,
1170 ]),
1171 ),
1172}).annotate({
1173 description: "Response to `session/set_mode` method.",
1174 identifier: "SetSessionModeResponse",
1175});
1176
1177export type StopReason = "end_turn" | "max_tokens" | "max_turn_requests" | "refusal" | "cancelled";
1178export const StopReason = Schema.Union([
1179 Schema.Literal("end_turn").annotate({ description: "The turn ended successfully." }),
1180 Schema.Literal("max_tokens").annotate({
1181 description: "The turn ended because the agent reached the maximum number of tokens.",
1182 }),
1183 Schema.Literal("max_turn_requests").annotate({
1184 description:
1185 "The turn ended because the agent reached the maximum number of allowed\nagent requests between user turns.",
1186 }),
1187 Schema.Literal("refusal").annotate({
1188 description:
1189 "The turn ended because the agent refused to continue. The user prompt\nand everything that comes after it won't be included in the next\nprompt, so this should be reflected in the UI.",
1190 }),
1191 Schema.Literal("cancelled").annotate({
1192 description:
1193 "The turn was cancelled by the client via `session/cancel`.\n\nThis stop reason MUST be returned when the client sends a `session/cancel`\nnotification, even if the cancellation causes exceptions in underlying operations.\nAgents should catch these exceptions and return this semantically meaningful\nresponse to confirm successful cancellation.",
1194 }),
1195]).annotate({
1196 description:
1197 "Reasons why an agent stops processing a prompt turn.\n\nSee protocol docs: [Stop Reasons](https://agentclientprotocol.com/protocol/prompt-turn#stop-reasons)",
1198 identifier: "StopReason",
1199});
1200
1201export type Usage = {
1202 readonly totalTokens: number;
1203 readonly inputTokens: number;
1204 readonly outputTokens: number;
1205 readonly thoughtTokens?: number | null;
1206 readonly cachedReadTokens?: number | null;
1207 readonly cachedWriteTokens?: number | null;
1208 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1209};
1210export const Usage = Schema.Struct({
1211 totalTokens: Schema.Number.annotate({
1212 description: "Sum of all token types across session.",
1213 format: "uint64",
1214 })
1215 .check(Schema.isInt().annotate({ expected: "an integer" }))
1216 .check(
1217 Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }),
1218 ),
1219 inputTokens: Schema.Number.annotate({
1220 description: "Total input tokens across all turns.",
1221 format: "uint64",
1222 })
1223 .check(Schema.isInt().annotate({ expected: "an integer" }))
1224 .check(
1225 Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }),
1226 ),
1227 outputTokens: Schema.Number.annotate({
1228 description: "Total output tokens across all turns.",
1229 format: "uint64",
1230 })
1231 .check(Schema.isInt().annotate({ expected: "an integer" }))
1232 .check(
1233 Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }),
1234 ),
1235 thoughtTokens: Schema.optionalKey(
1236 Schema.Union([
1237 Schema.Number.annotate({ description: "Total thought/reasoning tokens", format: "uint64" })
1238 .check(Schema.isInt().annotate({ expected: "an integer" }))
1239 .check(
1240 Schema.isGreaterThanOrEqualTo(0).annotate({
1241 expected: "a value greater than or equal to 0",
1242 }),
1243 ),
1244 Schema.Null,
1245 ]),
1246 ),
1247 cachedReadTokens: Schema.optionalKey(
1248 Schema.Union([
1249 Schema.Number.annotate({ description: "Total cache read tokens.", format: "uint64" })
1250 .check(Schema.isInt().annotate({ expected: "an integer" }))
1251 .check(
1252 Schema.isGreaterThanOrEqualTo(0).annotate({
1253 expected: "a value greater than or equal to 0",
1254 }),
1255 ),
1256 Schema.Null,
1257 ]),
1258 ),
1259 cachedWriteTokens: Schema.optionalKey(
1260 Schema.Union([
1261 Schema.Number.annotate({ description: "Total cache write tokens.", format: "uint64" })
1262 .check(Schema.isInt().annotate({ expected: "an integer" }))
1263 .check(
1264 Schema.isGreaterThanOrEqualTo(0).annotate({
1265 expected: "a value greater than or equal to 0",
1266 }),
1267 ),
1268 Schema.Null,
1269 ]),
1270 ),
1271 _meta: Schema.optionalKey(
1272 Schema.Union([
1273 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1274 description:
1275 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1276 }),
1277 Schema.Null,
1278 ]),
1279 ),
1280}).annotate({
1281 description:
1282 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nToken usage information for a prompt turn.",
1283 identifier: "Usage",
1284});
1285
1286export type Position = {
1287 readonly line: number;
1288 readonly character: number;
1289 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1290};
1291export const Position = Schema.Struct({
1292 line: Schema.Number.annotate({ description: "Zero-based line number.", format: "uint32" })
1293 .check(Schema.isInt().annotate({ expected: "an integer" }))
1294 .check(
1295 Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }),
1296 ),
1297 character: Schema.Number.annotate({
1298 description: "Zero-based character offset (encoding-dependent).",
1299 format: "uint32",
1300 })
1301 .check(Schema.isInt().annotate({ expected: "an integer" }))
1302 .check(
1303 Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }),
1304 ),
1305 _meta: Schema.optionalKey(
1306 Schema.Union([
1307 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1308 description:
1309 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1310 }),
1311 Schema.Null,
1312 ]),
1313 ),
1314}).annotate({
1315 description:
1316 "A zero-based position in a text document.\n\nThe meaning of `character` depends on the negotiated position encoding.",
1317 identifier: "Position",
1318});
1319
1320export type CloseNesResponse = { readonly _meta?: { readonly [x: string]: Schema.Json } | null };
1321export const CloseNesResponse = Schema.Struct({
1322 _meta: Schema.optionalKey(
1323 Schema.Union([
1324 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1325 description:
1326 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1327 }),
1328 Schema.Null,
1329 ]),
1330 ),
1331}).annotate({
1332 description: "Response from closing an NES session.",
1333 identifier: "CloseNesResponse",
1334});
1335
1336export type ExtResponse = Schema.Json;
1337export const ExtResponse = Schema.Json.annotate({
1338 expected: "JSON value",
1339 description:
1340 "Allows for sending an arbitrary response to an [`ExtRequest`] that is not part of the ACP spec.\nExtension methods provide a way to add custom functionality while maintaining\nprotocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1341 identifier: "ExtResponse",
1342});
1343
1344export type MessageMcpResponse = Schema.Json;
1345export const MessageMcpResponse = Schema.Json.annotate({
1346 expected: "JSON value",
1347 description:
1348 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse to `mcp/message`.\n\nThis is the inner MCP response result payload. Any JSON value is valid.",
1349 identifier: "MessageMcpResponse",
1350});
1351
1352export type ErrorCode =
1353 | -32700
1354 | -32600
1355 | -32601
1356 | -32602
1357 | -32603
1358 | -32800
1359 | -32000
1360 | -32002
1361 | number;
1362export const ErrorCode = Schema.Union([
1363 Schema.Literal(-32700).annotate({
1364 title: "Parse error",
1365 description:
1366 "**Parse error**: Invalid JSON was received by the server.\nAn error occurred on the server while parsing the JSON text.",
1367 format: "int32",
1368 }),
1369 Schema.Literal(-32600).annotate({
1370 title: "Invalid request",
1371 description: "**Invalid request**: The JSON sent is not a valid Request object.",
1372 format: "int32",
1373 }),
1374 Schema.Literal(-32601).annotate({
1375 title: "Method not found",
1376 description: "**Method not found**: The method does not exist or is not available.",
1377 format: "int32",
1378 }),
1379 Schema.Literal(-32602).annotate({
1380 title: "Invalid params",
1381 description: "**Invalid params**: Invalid method parameter(s).",
1382 format: "int32",
1383 }),
1384 Schema.Literal(-32603).annotate({
1385 title: "Internal error",
1386 description:
1387 "**Internal error**: Internal JSON-RPC error.\nReserved for implementation-defined server errors.",
1388 format: "int32",
1389 }),
1390 Schema.Literal(-32800).annotate({
1391 title: "Request cancelled",
1392 description:
1393 "**Request cancelled**: Execution of the method was aborted either due to a cancellation request from the caller or\nbecause of resource constraints or shutdown.",
1394 format: "int32",
1395 }),
1396 Schema.Literal(-32000).annotate({
1397 title: "Authentication required",
1398 description:
1399 "**Authentication required**: Authentication is required before this operation can be performed.",
1400 format: "int32",
1401 }),
1402 Schema.Literal(-32002).annotate({
1403 title: "Resource not found",
1404 description: "**Resource not found**: A given resource, such as a file, was not found.",
1405 format: "int32",
1406 }),
1407 Schema.Number.annotate({
1408 title: "Other",
1409 description: "Other undefined error code.",
1410 format: "int32",
1411 }).check(Schema.isInt().annotate({ expected: "an integer" })),
1412]).annotate({
1413 description:
1414 "Predefined error codes for common JSON-RPC and ACP-specific errors.\n\nThese codes follow the JSON-RPC 2.0 specification for standard errors\nand use the reserved range (-32000 to -32099) for protocol-specific errors.",
1415 identifier: "ErrorCode",
1416});
1417
1418export type FileSystemCapabilities = {
1419 readonly readTextFile?: boolean;
1420 readonly writeTextFile?: boolean;
1421 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1422};
1423export const FileSystemCapabilities = Schema.Struct({
1424 readTextFile: Schema.optionalKey(
1425 Schema.Boolean.annotate({
1426 description: "Whether the Client supports `fs/read_text_file` requests.",
1427 default: false,
1428 }),
1429 ),
1430 writeTextFile: Schema.optionalKey(
1431 Schema.Boolean.annotate({
1432 description: "Whether the Client supports `fs/write_text_file` requests.",
1433 default: false,
1434 }),
1435 ),
1436 _meta: Schema.optionalKey(
1437 Schema.Union([
1438 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1439 description:
1440 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1441 }),
1442 Schema.Null,
1443 ]),
1444 ),
1445}).annotate({
1446 description:
1447 "File system capabilities that a client may support.\n\nSee protocol docs: [FileSystem](https://agentclientprotocol.com/protocol/initialization#filesystem)",
1448 identifier: "FileSystemCapabilities",
1449});
1450
1451export type CompactionCapabilities = { readonly [x: string]: never };
1452export const CompactionCapabilities = Schema.Record(Schema.String, Schema.Never).annotate({
1453 description:
1454 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nClient support for ID-addressed context compaction updates.",
1455 identifier: "CompactionCapabilities",
1456});
1457
1458export type BooleanConfigOptionCapabilities = {
1459 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1460};
1461export const BooleanConfigOptionCapabilities = Schema.Struct({
1462 _meta: Schema.optionalKey(
1463 Schema.Union([
1464 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1465 description:
1466 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1467 }),
1468 Schema.Null,
1469 ]),
1470 ),
1471}).annotate({
1472 description:
1473 "Capabilities for boolean session configuration options.\n\nSupplying `{}` means the client supports boolean session configuration options.",
1474 identifier: "BooleanConfigOptionCapabilities",
1475});
1476
1477export type PlanCapabilities = { readonly _meta?: { readonly [x: string]: Schema.Json } | null };
1478export const PlanCapabilities = Schema.Struct({
1479 _meta: Schema.optionalKey(
1480 Schema.Union([
1481 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1482 description:
1483 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1484 }),
1485 Schema.Null,
1486 ]),
1487 ),
1488}).annotate({
1489 description:
1490 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCapabilities for receiving `plan_update` and `plan_removed` session updates.",
1491 identifier: "PlanCapabilities",
1492});
1493
1494export type AuthCapabilities = {
1495 readonly terminal?: boolean;
1496 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1497};
1498export const AuthCapabilities = Schema.Struct({
1499 terminal: Schema.optionalKey(
1500 Schema.Boolean.annotate({
1501 description:
1502 "Whether the client supports `terminal` authentication methods.\n\nThe client should set this to `true` only when it can reproduce the\nconfigured agent invocation in an interactive terminal. When `true`, the\nagent may include `terminal` entries in its authentication methods.",
1503 default: false,
1504 }),
1505 ),
1506 _meta: Schema.optionalKey(
1507 Schema.Union([
1508 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1509 description:
1510 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1511 }),
1512 Schema.Null,
1513 ]),
1514 ),
1515}).annotate({
1516 description:
1517 "Authentication capabilities supported by the client.\n\nAdvertised during initialization to inform the agent which authentication\nmethod types the client can handle. This governs opt-in types that require\nadditional client-side support.",
1518 identifier: "AuthCapabilities",
1519});
1520
1521export type ElicitationFormCapabilities = {
1522 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1523};
1524export const ElicitationFormCapabilities = Schema.Struct({
1525 _meta: Schema.optionalKey(
1526 Schema.Union([
1527 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1528 description:
1529 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1530 }),
1531 Schema.Null,
1532 ]),
1533 ),
1534}).annotate({
1535 description:
1536 "Form-based elicitation capabilities.\n\nSupplying `{}` means the client supports form-based elicitation.",
1537 identifier: "ElicitationFormCapabilities",
1538});
1539
1540export type ElicitationUrlCapabilities = {
1541 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1542};
1543export const ElicitationUrlCapabilities = Schema.Struct({
1544 _meta: Schema.optionalKey(
1545 Schema.Union([
1546 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1547 description:
1548 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1549 }),
1550 Schema.Null,
1551 ]),
1552 ),
1553}).annotate({
1554 description:
1555 "URL-based elicitation capabilities.\n\nSupplying `{}` means the client supports URL-based elicitation.",
1556 identifier: "ElicitationUrlCapabilities",
1557});
1558
1559export type NesJumpCapabilities = { readonly _meta?: { readonly [x: string]: Schema.Json } | null };
1560export const NesJumpCapabilities = Schema.Struct({
1561 _meta: Schema.optionalKey(
1562 Schema.Union([
1563 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1564 description:
1565 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1566 }),
1567 Schema.Null,
1568 ]),
1569 ),
1570}).annotate({
1571 description: "Marker for jump suggestion support.",
1572 identifier: "NesJumpCapabilities",
1573});
1574
1575export type NesRenameCapabilities = {
1576 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1577};
1578export const NesRenameCapabilities = Schema.Struct({
1579 _meta: Schema.optionalKey(
1580 Schema.Union([
1581 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1582 description:
1583 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1584 }),
1585 Schema.Null,
1586 ]),
1587 ),
1588}).annotate({
1589 description: "Marker for rename suggestion support.",
1590 identifier: "NesRenameCapabilities",
1591});
1592
1593export type NesSearchAndReplaceCapabilities = {
1594 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1595};
1596export const NesSearchAndReplaceCapabilities = Schema.Struct({
1597 _meta: Schema.optionalKey(
1598 Schema.Union([
1599 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1600 description:
1601 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1602 }),
1603 Schema.Null,
1604 ]),
1605 ),
1606}).annotate({
1607 description: "Marker for search and replace suggestion support.",
1608 identifier: "NesSearchAndReplaceCapabilities",
1609});
1610
1611export type NesRejectReason = "rejected" | "ignored" | "replaced" | "cancelled";
1612export const NesRejectReason = Schema.Union([
1613 Schema.Literal("rejected").annotate({
1614 description: "The user explicitly dismissed the suggestion.",
1615 }),
1616 Schema.Literal("ignored").annotate({
1617 description: "The suggestion was shown but the user continued editing without interacting.",
1618 }),
1619 Schema.Literal("replaced").annotate({
1620 description: "The suggestion was superseded by a newer suggestion.",
1621 }),
1622 Schema.Literal("cancelled").annotate({
1623 description: "The request was cancelled before the agent returned a response.",
1624 }),
1625]).annotate({
1626 description: "The reason a suggestion was rejected.",
1627 identifier: "NesRejectReason",
1628});
1629
1630export type ListProvidersRequest = {
1631 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1632};
1633export const ListProvidersRequest = Schema.Struct({
1634 _meta: Schema.optionalKey(
1635 Schema.Union([
1636 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1637 description:
1638 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1639 }),
1640 Schema.Null,
1641 ]),
1642 ),
1643}).annotate({
1644 description:
1645 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for `providers/list`.",
1646 identifier: "ListProvidersRequest",
1647});
1648
1649export type LogoutRequest = { readonly _meta?: { readonly [x: string]: Schema.Json } | null };
1650export const LogoutRequest = Schema.Struct({
1651 _meta: Schema.optionalKey(
1652 Schema.Union([
1653 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1654 description:
1655 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1656 }),
1657 Schema.Null,
1658 ]),
1659 ),
1660}).annotate({
1661 description:
1662 "Request parameters for the logout method.\n\nTerminates the current authenticated session.",
1663 identifier: "LogoutRequest",
1664});
1665
1666export type HttpHeader = {
1667 readonly name: string;
1668 readonly value: string;
1669 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1670};
1671export const HttpHeader = Schema.Struct({
1672 name: Schema.String.annotate({ description: "The name of the HTTP header." }),
1673 value: Schema.String.annotate({ description: "The value to set for the HTTP header." }),
1674 _meta: Schema.optionalKey(
1675 Schema.Union([
1676 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1677 description:
1678 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1679 }),
1680 Schema.Null,
1681 ]),
1682 ),
1683}).annotate({
1684 description: "An HTTP header to set when making requests to the MCP server.",
1685 identifier: "HttpHeader",
1686});
1687
1688export type ListSessionsRequest = {
1689 readonly cwd?: string | null;
1690 readonly cursor?: string | null;
1691 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1692};
1693export const ListSessionsRequest = Schema.Struct({
1694 cwd: Schema.optionalKey(
1695 Schema.Union([
1696 Schema.String.annotate({
1697 description: "Filter sessions by working directory. Must be an absolute path.",
1698 }),
1699 Schema.Null,
1700 ]),
1701 ),
1702 cursor: Schema.optionalKey(
1703 Schema.Union([
1704 Schema.String.annotate({
1705 description:
1706 "Opaque cursor token from a previous response's nextCursor field for cursor-based pagination",
1707 }),
1708 Schema.Null,
1709 ]),
1710 ),
1711 _meta: Schema.optionalKey(
1712 Schema.Union([
1713 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1714 description:
1715 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1716 }),
1717 Schema.Null,
1718 ]),
1719 ),
1720}).annotate({
1721 description:
1722 "Request parameters for listing existing sessions.\n\nOnly available if the Agent supports the `sessionCapabilities.list` capability.",
1723 identifier: "ListSessionsRequest",
1724});
1725
1726export type WorkspaceFolder = {
1727 readonly uri: string;
1728 readonly name: string;
1729 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1730};
1731export const WorkspaceFolder = Schema.Struct({
1732 uri: Schema.String.annotate({ description: "The URI of the folder." }),
1733 name: Schema.String.annotate({ description: "The display name of the folder." }),
1734 _meta: Schema.optionalKey(
1735 Schema.Union([
1736 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1737 description:
1738 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1739 }),
1740 Schema.Null,
1741 ]),
1742 ),
1743}).annotate({ description: "A workspace folder.", identifier: "WorkspaceFolder" });
1744
1745export type NesRepository = {
1746 readonly name: string;
1747 readonly owner: string;
1748 readonly remoteUrl: string;
1749 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1750};
1751export const NesRepository = Schema.Struct({
1752 name: Schema.String.annotate({ description: "The repository name." }),
1753 owner: Schema.String.annotate({ description: "The repository owner." }),
1754 remoteUrl: Schema.String.annotate({ description: "The remote URL of the repository." }),
1755 _meta: Schema.optionalKey(
1756 Schema.Union([
1757 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1758 description:
1759 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1760 }),
1761 Schema.Null,
1762 ]),
1763 ),
1764}).annotate({
1765 description: "Repository metadata for an NES session.",
1766 identifier: "NesRepository",
1767});
1768
1769export type NesTriggerKind = "automatic" | "diagnostic" | "manual";
1770export const NesTriggerKind = Schema.Union([
1771 Schema.Literal("automatic").annotate({
1772 description: "Triggered by user typing or cursor movement.",
1773 }),
1774 Schema.Literal("diagnostic").annotate({
1775 description: "Triggered by a diagnostic appearing at or near the cursor.",
1776 }),
1777 Schema.Literal("manual").annotate({
1778 description: "Triggered by an explicit user action (keyboard shortcut).",
1779 }),
1780]).annotate({
1781 description: "What triggered the suggestion request.",
1782 identifier: "NesTriggerKind",
1783});
1784
1785export type NesRecentFile = {
1786 readonly uri: string;
1787 readonly languageId: string;
1788 readonly text: string;
1789 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1790};
1791export const NesRecentFile = Schema.Struct({
1792 uri: Schema.String.annotate({ description: "The URI of the file." }),
1793 languageId: Schema.String.annotate({ description: "The language identifier." }),
1794 text: Schema.String.annotate({ description: "The full text content of the file." }),
1795 _meta: Schema.optionalKey(
1796 Schema.Union([
1797 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1798 description:
1799 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1800 }),
1801 Schema.Null,
1802 ]),
1803 ),
1804}).annotate({ description: "A recently accessed file.", identifier: "NesRecentFile" });
1805
1806export type NesExcerpt = {
1807 readonly startLine: number;
1808 readonly endLine: number;
1809 readonly text: string;
1810 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1811};
1812export const NesExcerpt = Schema.Struct({
1813 startLine: Schema.Number.annotate({
1814 description: "The start line of the excerpt (zero-based).",
1815 format: "uint32",
1816 })
1817 .check(Schema.isInt().annotate({ expected: "an integer" }))
1818 .check(
1819 Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }),
1820 ),
1821 endLine: Schema.Number.annotate({
1822 description: "The end line of the excerpt (zero-based).",
1823 format: "uint32",
1824 })
1825 .check(Schema.isInt().annotate({ expected: "an integer" }))
1826 .check(
1827 Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }),
1828 ),
1829 text: Schema.String.annotate({ description: "The text content of the excerpt." }),
1830 _meta: Schema.optionalKey(
1831 Schema.Union([
1832 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1833 description:
1834 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1835 }),
1836 Schema.Null,
1837 ]),
1838 ),
1839}).annotate({ description: "A code excerpt from a file.", identifier: "NesExcerpt" });
1840
1841export type NesEditHistoryEntry = {
1842 readonly uri: string;
1843 readonly diff: string;
1844 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1845};
1846export const NesEditHistoryEntry = Schema.Struct({
1847 uri: Schema.String.annotate({ description: "The URI of the edited file." }),
1848 diff: Schema.String.annotate({ description: "A diff representing the edit." }),
1849 _meta: Schema.optionalKey(
1850 Schema.Union([
1851 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1852 description:
1853 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1854 }),
1855 Schema.Null,
1856 ]),
1857 ),
1858}).annotate({ description: "An entry in the edit history.", identifier: "NesEditHistoryEntry" });
1859
1860export type NesDiagnosticSeverity = "error" | "warning" | "information" | "hint";
1861export const NesDiagnosticSeverity = Schema.Union([
1862 Schema.Literal("error").annotate({ description: "An error." }),
1863 Schema.Literal("warning").annotate({ description: "A warning." }),
1864 Schema.Literal("information").annotate({ description: "An informational message." }),
1865 Schema.Literal("hint").annotate({ description: "A hint." }),
1866]).annotate({ description: "Severity of a diagnostic.", identifier: "NesDiagnosticSeverity" });
1867
1868export type WriteTextFileResponse = {
1869 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1870};
1871export const WriteTextFileResponse = Schema.Struct({
1872 _meta: Schema.optionalKey(
1873 Schema.Union([
1874 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1875 description:
1876 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1877 }),
1878 Schema.Null,
1879 ]),
1880 ),
1881}).annotate({
1882 description: "Response to `fs/write_text_file`",
1883 identifier: "WriteTextFileResponse",
1884});
1885
1886export type ReadTextFileResponse = {
1887 readonly content: string;
1888 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1889};
1890export const ReadTextFileResponse = Schema.Struct({
1891 content: Schema.String.annotate({ description: "Content payload returned by this response." }),
1892 _meta: Schema.optionalKey(
1893 Schema.Union([
1894 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1895 description:
1896 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1897 }),
1898 Schema.Null,
1899 ]),
1900 ),
1901}).annotate({
1902 description: "Response containing the contents of a text file.",
1903 identifier: "ReadTextFileResponse",
1904});
1905
1906export type TerminalExitStatus = {
1907 readonly exitCode?: number | null;
1908 readonly signal?: string | null;
1909 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1910};
1911export const TerminalExitStatus = Schema.Struct({
1912 exitCode: Schema.optionalKey(
1913 Schema.Union([
1914 Schema.Number.annotate({
1915 description: "The process exit code (may be null if terminated by signal).",
1916 format: "uint32",
1917 })
1918 .check(Schema.isInt().annotate({ expected: "an integer" }))
1919 .check(
1920 Schema.isGreaterThanOrEqualTo(0).annotate({
1921 expected: "a value greater than or equal to 0",
1922 }),
1923 ),
1924 Schema.Null,
1925 ]),
1926 ),
1927 signal: Schema.optionalKey(
1928 Schema.Union([
1929 Schema.String.annotate({
1930 description: "The signal that terminated the process (may be null if exited normally).",
1931 }),
1932 Schema.Null,
1933 ]),
1934 ),
1935 _meta: Schema.optionalKey(
1936 Schema.Union([
1937 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1938 description:
1939 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1940 }),
1941 Schema.Null,
1942 ]),
1943 ),
1944}).annotate({
1945 description: "Exit status of a terminal command.",
1946 identifier: "TerminalExitStatus",
1947});
1948
1949export type ReleaseTerminalResponse = {
1950 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1951};
1952export const ReleaseTerminalResponse = Schema.Struct({
1953 _meta: Schema.optionalKey(
1954 Schema.Union([
1955 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1956 description:
1957 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1958 }),
1959 Schema.Null,
1960 ]),
1961 ),
1962}).annotate({
1963 description: "Response to terminal/release method",
1964 identifier: "ReleaseTerminalResponse",
1965});
1966
1967export type WaitForTerminalExitResponse = {
1968 readonly exitCode?: number | null;
1969 readonly signal?: string | null;
1970 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
1971};
1972export const WaitForTerminalExitResponse = Schema.Struct({
1973 exitCode: Schema.optionalKey(
1974 Schema.Union([
1975 Schema.Number.annotate({
1976 description: "The process exit code (may be null if terminated by signal).",
1977 format: "uint32",
1978 })
1979 .check(Schema.isInt().annotate({ expected: "an integer" }))
1980 .check(
1981 Schema.isGreaterThanOrEqualTo(0).annotate({
1982 expected: "a value greater than or equal to 0",
1983 }),
1984 ),
1985 Schema.Null,
1986 ]),
1987 ),
1988 signal: Schema.optionalKey(
1989 Schema.Union([
1990 Schema.String.annotate({
1991 description: "The signal that terminated the process (may be null if exited normally).",
1992 }),
1993 Schema.Null,
1994 ]),
1995 ),
1996 _meta: Schema.optionalKey(
1997 Schema.Union([
1998 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
1999 description:
2000 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2001 }),
2002 Schema.Null,
2003 ]),
2004 ),
2005}).annotate({
2006 description: "Response containing the exit status of a terminal command.",
2007 identifier: "WaitForTerminalExitResponse",
2008});
2009
2010export type KillTerminalResponse = {
2011 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2012};
2013export const KillTerminalResponse = Schema.Struct({
2014 _meta: Schema.optionalKey(
2015 Schema.Union([
2016 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2017 description:
2018 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2019 }),
2020 Schema.Null,
2021 ]),
2022 ),
2023}).annotate({
2024 description: "Response to `terminal/kill` method",
2025 identifier: "KillTerminalResponse",
2026});
2027
2028export type ElicitationContentValue = string | number | number | boolean | ReadonlyArray<string>;
2029export const ElicitationContentValue = Schema.Union([
2030 Schema.String.annotate({
2031 title: "String",
2032 description: "String value accepted in elicitation response content.",
2033 }),
2034 Schema.Number.annotate({
2035 title: "Integer",
2036 description: "Integer value accepted in elicitation response content.",
2037 format: "int64",
2038 }).check(Schema.isInt().annotate({ expected: "an integer" })),
2039 Schema.Number.annotate({
2040 title: "Number",
2041 description: "Number value accepted in elicitation response content.",
2042 format: "double",
2043 }).check(Schema.isFinite().annotate({ expected: "a finite number" })),
2044 Schema.Boolean.annotate({
2045 title: "Boolean",
2046 description: "Boolean value accepted in elicitation response content.",
2047 }),
2048 Schema.Array(Schema.String).annotate({
2049 title: "StringArray",
2050 description: "String array value accepted in elicitation response content.",
2051 }),
2052]).annotate({
2053 description: "Allowed wire representations for [`ElicitationContentValue`].",
2054 identifier: "ElicitationContentValue",
2055});
2056
2057export type DisconnectMcpResponse = {
2058 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2059};
2060export const DisconnectMcpResponse = Schema.Struct({
2061 _meta: Schema.optionalKey(
2062 Schema.Union([
2063 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2064 description:
2065 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2066 }),
2067 Schema.Null,
2068 ]),
2069 ),
2070}).annotate({
2071 description:
2072 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse to `mcp/disconnect`.",
2073 identifier: "DisconnectMcpResponse",
2074});
2075
2076export type WriteTextFileRequest = {
2077 readonly sessionId: SessionId;
2078 readonly path: string;
2079 readonly content: string;
2080 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2081};
2082export const WriteTextFileRequest = Schema.Struct({
2083 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
2084 description: "The session ID for this request.",
2085 }),
2086 path: Schema.String.annotate({ description: "Absolute path to the file to write." }),
2087 content: Schema.String.annotate({ description: "The text content to write to the file." }),
2088 _meta: Schema.optionalKey(
2089 Schema.Union([
2090 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2091 description:
2092 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2093 }),
2094 Schema.Null,
2095 ]),
2096 ),
2097}).annotate({
2098 description:
2099 "Request to write content to a text file.\n\nOnly available if the client supports the `fs.writeTextFile` capability.",
2100 identifier: "WriteTextFileRequest",
2101});
2102
2103export type ReadTextFileRequest = {
2104 readonly sessionId: SessionId;
2105 readonly path: string;
2106 readonly line?: number | null;
2107 readonly limit?: number | null;
2108 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2109};
2110export const ReadTextFileRequest = Schema.Struct({
2111 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
2112 description: "The session ID for this request.",
2113 }),
2114 path: Schema.String.annotate({ description: "Absolute path to the file to read." }),
2115 line: Schema.optionalKey(
2116 Schema.Union([
2117 Schema.Number.annotate({
2118 description: "Line number to start reading from (1-based).",
2119 format: "uint32",
2120 })
2121 .check(Schema.isInt().annotate({ expected: "an integer" }))
2122 .check(
2123 Schema.isGreaterThanOrEqualTo(0).annotate({
2124 expected: "a value greater than or equal to 0",
2125 }),
2126 ),
2127 Schema.Null,
2128 ]),
2129 ),
2130 limit: Schema.optionalKey(
2131 Schema.Union([
2132 Schema.Number.annotate({ description: "Maximum number of lines to read.", format: "uint32" })
2133 .check(Schema.isInt().annotate({ expected: "an integer" }))
2134 .check(
2135 Schema.isGreaterThanOrEqualTo(0).annotate({
2136 expected: "a value greater than or equal to 0",
2137 }),
2138 ),
2139 Schema.Null,
2140 ]),
2141 ),
2142 _meta: Schema.optionalKey(
2143 Schema.Union([
2144 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2145 description:
2146 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2147 }),
2148 Schema.Null,
2149 ]),
2150 ),
2151}).annotate({
2152 description:
2153 "Request to read content from a text file.\n\nOnly available if the client supports the `fs.readTextFile` capability.",
2154 identifier: "ReadTextFileRequest",
2155});
2156
2157export type SessionInfo = {
2158 readonly sessionId: SessionId;
2159 readonly cwd: string;
2160 readonly additionalDirectories?: ReadonlyArray<string>;
2161 readonly title?: string | null;
2162 readonly updatedAt?: string | null;
2163 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2164};
2165export const SessionInfo = Schema.Struct({
2166 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
2167 description: "Unique identifier for the session",
2168 }),
2169 cwd: Schema.String.annotate({
2170 description: "The working directory for this session. Must be an absolute path.",
2171 }),
2172 additionalDirectories: Schema.optionalKey(
2173 Schema.Array(Schema.String).annotate({
2174 description:
2175 "Additional workspace roots reported for this session. Each path must be absolute.\n\nWhen present, this is the complete ordered additional-root list reported\nby the Agent. Omitted and empty values are equivalent: the response\nreports no additional roots.",
2176 }),
2177 ),
2178 title: Schema.optionalKey(
2179 Schema.Union([
2180 Schema.String.annotate({ description: "Human-readable title for the session" }),
2181 Schema.Null,
2182 ]),
2183 ),
2184 updatedAt: Schema.optionalKey(
2185 Schema.Union([
2186 Schema.String.annotate({ description: "ISO 8601 timestamp of last activity" }),
2187 Schema.Null,
2188 ]),
2189 ),
2190 _meta: Schema.optionalKey(
2191 Schema.Union([
2192 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2193 description:
2194 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2195 }),
2196 Schema.Null,
2197 ]),
2198 ),
2199}).annotate({
2200 description: "Information about a session returned by session/list",
2201 identifier: "SessionInfo",
2202});
2203
2204export type StartNesResponse = {
2205 readonly sessionId: SessionId;
2206 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2207};
2208export const StartNesResponse = Schema.Struct({
2209 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
2210 description: "The session ID for the newly started NES session.",
2211 }),
2212 _meta: Schema.optionalKey(
2213 Schema.Union([
2214 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2215 description:
2216 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2217 }),
2218 Schema.Null,
2219 ]),
2220 ),
2221}).annotate({ description: "Response to `nes/start`.", identifier: "StartNesResponse" });
2222
2223export type CancelNotification = {
2224 readonly sessionId: SessionId;
2225 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2226};
2227export const CancelNotification = Schema.Struct({
2228 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
2229 description: "The ID of the session to cancel operations for.",
2230 }),
2231 _meta: Schema.optionalKey(
2232 Schema.Union([
2233 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2234 description:
2235 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2236 }),
2237 Schema.Null,
2238 ]),
2239 ),
2240}).annotate({
2241 description:
2242 "Notification to cancel ongoing operations for a session.\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation)",
2243 identifier: "CancelNotification",
2244});
2245
2246export type DidOpenDocumentNotification = {
2247 readonly sessionId: SessionId;
2248 readonly uri: string;
2249 readonly languageId: string;
2250 readonly version: number;
2251 readonly text: string;
2252 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2253};
2254export const DidOpenDocumentNotification = Schema.Struct({
2255 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
2256 description: "The session ID for this notification.",
2257 }),
2258 uri: Schema.String.annotate({ description: "The URI of the opened document." }),
2259 languageId: Schema.String.annotate({
2260 description: 'The language identifier of the document (e.g., "rust", "python").',
2261 }),
2262 version: Schema.Number.annotate({
2263 description: "The version number of the document.",
2264 format: "int64",
2265 }).check(Schema.isInt().annotate({ expected: "an integer" })),
2266 text: Schema.String.annotate({ description: "The full text content of the document." }),
2267 _meta: Schema.optionalKey(
2268 Schema.Union([
2269 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2270 description:
2271 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2272 }),
2273 Schema.Null,
2274 ]),
2275 ),
2276}).annotate({
2277 description: "Notification sent when a file is opened in the editor.",
2278 identifier: "DidOpenDocumentNotification",
2279});
2280
2281export type DidCloseDocumentNotification = {
2282 readonly sessionId: SessionId;
2283 readonly uri: string;
2284 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2285};
2286export const DidCloseDocumentNotification = Schema.Struct({
2287 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
2288 description: "The session ID for this notification.",
2289 }),
2290 uri: Schema.String.annotate({ description: "The URI of the closed document." }),
2291 _meta: Schema.optionalKey(
2292 Schema.Union([
2293 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2294 description:
2295 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2296 }),
2297 Schema.Null,
2298 ]),
2299 ),
2300}).annotate({
2301 description: "Notification sent when a file is closed.",
2302 identifier: "DidCloseDocumentNotification",
2303});
2304
2305export type DidSaveDocumentNotification = {
2306 readonly sessionId: SessionId;
2307 readonly uri: string;
2308 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2309};
2310export const DidSaveDocumentNotification = Schema.Struct({
2311 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
2312 description: "The session ID for this notification.",
2313 }),
2314 uri: Schema.String.annotate({ description: "The URI of the saved document." }),
2315 _meta: Schema.optionalKey(
2316 Schema.Union([
2317 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2318 description:
2319 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2320 }),
2321 Schema.Null,
2322 ]),
2323 ),
2324}).annotate({
2325 description: "Notification sent when a file is saved.",
2326 identifier: "DidSaveDocumentNotification",
2327});
2328
2329export type DeleteSessionRequest = {
2330 readonly sessionId: SessionId;
2331 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2332};
2333export const DeleteSessionRequest = Schema.Struct({
2334 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
2335 description: "The ID of the session to delete.",
2336 }),
2337 _meta: Schema.optionalKey(
2338 Schema.Union([
2339 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2340 description:
2341 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2342 }),
2343 Schema.Null,
2344 ]),
2345 ),
2346}).annotate({
2347 description:
2348 "Request parameters for deleting an existing session from `session/list`.\n\nOnly available if the Agent supports the `sessionCapabilities.delete` capability.",
2349 identifier: "DeleteSessionRequest",
2350});
2351
2352export type CloseSessionRequest = {
2353 readonly sessionId: SessionId;
2354 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2355};
2356export const CloseSessionRequest = Schema.Struct({
2357 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
2358 description: "The ID of the session to close.",
2359 }),
2360 _meta: Schema.optionalKey(
2361 Schema.Union([
2362 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2363 description:
2364 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2365 }),
2366 Schema.Null,
2367 ]),
2368 ),
2369}).annotate({
2370 description:
2371 "Request parameters for closing an active session.\n\nIf supported, the agent **must** cancel any ongoing work related to the session\n(treat it as if `session/cancel` was called) and then free up any resources\nassociated with the session.\n\nOnly available if the Agent supports the `sessionCapabilities.close` capability.",
2372 identifier: "CloseSessionRequest",
2373});
2374
2375export type CloseNesRequest = {
2376 readonly sessionId: SessionId;
2377 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2378};
2379export const CloseNesRequest = Schema.Struct({
2380 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
2381 description: "The ID of the NES session to close.",
2382 }),
2383 _meta: Schema.optionalKey(
2384 Schema.Union([
2385 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2386 description:
2387 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2388 }),
2389 Schema.Null,
2390 ]),
2391 ),
2392}).annotate({
2393 description:
2394 "Request to close an NES session.\n\nThe agent **must** cancel any ongoing work related to the NES session\nand then free up any resources associated with the session.",
2395 identifier: "CloseNesRequest",
2396});
2397
2398export type AcceptNesNotification = {
2399 readonly sessionId: SessionId;
2400 readonly id: NesSuggestionId;
2401 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2402};
2403export const AcceptNesNotification = Schema.Struct({
2404 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
2405 description: "The session ID for this notification.",
2406 }),
2407 id: Schema.suspend((): Schema.Codec<NesSuggestionId> => NesSuggestionId).annotate({
2408 description: "The ID of the accepted suggestion.",
2409 }),
2410 _meta: Schema.optionalKey(
2411 Schema.Union([
2412 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2413 description:
2414 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2415 }),
2416 Schema.Null,
2417 ]),
2418 ),
2419}).annotate({
2420 description: "Notification sent when a suggestion is accepted.",
2421 identifier: "AcceptNesNotification",
2422});
2423
2424export type AgentAuthCapabilities = {
2425 readonly logout?: LogoutCapabilities | null;
2426 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2427};
2428export const AgentAuthCapabilities = Schema.Struct({
2429 logout: Schema.optionalKey(
2430 Schema.Union([LogoutCapabilities, Schema.Null]).annotate({
2431 description:
2432 "Whether the agent supports the logout method.\n\nOptional. Omitted or `null` both mean the agent does not advertise support.\nSupplying `{}` means the agent supports the logout method.",
2433 }),
2434 ),
2435 _meta: Schema.optionalKey(
2436 Schema.Union([
2437 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2438 description:
2439 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2440 }),
2441 Schema.Null,
2442 ]),
2443 ),
2444}).annotate({
2445 description: "Authentication-related capabilities supported by the agent.",
2446 identifier: "AgentAuthCapabilities",
2447});
2448
2449export type SessionCapabilities = {
2450 readonly list?: SessionListCapabilities | null;
2451 readonly delete?: SessionDeleteCapabilities | null;
2452 readonly additionalDirectories?: SessionAdditionalDirectoriesCapabilities | null;
2453 readonly fork?: SessionForkCapabilities | null;
2454 readonly resume?: SessionResumeCapabilities | null;
2455 readonly close?: SessionCloseCapabilities | null;
2456 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2457};
2458export const SessionCapabilities = Schema.Struct({
2459 list: Schema.optionalKey(
2460 Schema.Union([SessionListCapabilities, Schema.Null]).annotate({
2461 description:
2462 "Whether the agent supports `session/list`.\n\nOptional. Omitted or `null` both mean the agent does not advertise support.\nSupplying `{}` means the agent supports listing sessions.",
2463 }),
2464 ),
2465 delete: Schema.optionalKey(
2466 Schema.Union([SessionDeleteCapabilities, Schema.Null]).annotate({
2467 description:
2468 "Whether the agent supports `session/delete`.\n\nOptional. Omitted or `null` both mean the agent does not advertise support.\nSupplying `{}` means the agent supports deleting sessions from `session/list`.",
2469 }),
2470 ),
2471 additionalDirectories: Schema.optionalKey(
2472 Schema.Union([SessionAdditionalDirectoriesCapabilities, Schema.Null]).annotate({
2473 description:
2474 "Whether the agent supports `additionalDirectories` on supported session lifecycle requests.\n\nOptional. Omitted or `null` both mean the agent does not advertise support.\nSupplying `{}` means the agent supports `additionalDirectories` on\nsupported session lifecycle requests.\n\nAgents that also support `session/list` may return\n`SessionInfo.additionalDirectories` to report the complete ordered\nadditional-root list associated with a listed session.",
2475 }),
2476 ),
2477 fork: Schema.optionalKey(
2478 Schema.Union([SessionForkCapabilities, Schema.Null]).annotate({
2479 description:
2480 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `session/fork`.\n\nOptional. Omitted or `null` both mean the agent does not advertise support.\nSupplying `{}` means the agent supports forking sessions.",
2481 }),
2482 ),
2483 resume: Schema.optionalKey(
2484 Schema.Union([SessionResumeCapabilities, Schema.Null]).annotate({
2485 description:
2486 "Whether the agent supports `session/resume`.\n\nOptional. Omitted or `null` both mean the agent does not advertise support.\nSupplying `{}` means the agent supports resuming sessions.",
2487 }),
2488 ),
2489 close: Schema.optionalKey(
2490 Schema.Union([SessionCloseCapabilities, Schema.Null]).annotate({
2491 description:
2492 "Whether the agent supports `session/close`.\n\nOptional. Omitted or `null` both mean the agent does not advertise support.\nSupplying `{}` means the agent supports closing sessions.",
2493 }),
2494 ),
2495 _meta: Schema.optionalKey(
2496 Schema.Union([
2497 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2498 description:
2499 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2500 }),
2501 Schema.Null,
2502 ]),
2503 ),
2504}).annotate({
2505 description:
2506 "Session capabilities supported by the agent.\n\nAs a baseline, all Agents **MUST** support `session/new`, `session/prompt`, `session/cancel`, and `session/update`.\n\nOptionally, they **MAY** support other session methods and notifications by specifying additional capabilities.\n\nNote: `session/load` is still handled by the top-level `load_session` capability. This will be unified in future versions of the protocol.\n\nSee protocol docs: [Session Capabilities](https://agentclientprotocol.com/protocol/initialization#session-capabilities)",
2507 identifier: "SessionCapabilities",
2508});
2509
2510export type NesDocumentDidChangeCapabilities = {
2511 readonly syncKind: TextDocumentSyncKind;
2512 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2513};
2514export const NesDocumentDidChangeCapabilities = Schema.Struct({
2515 syncKind: Schema.suspend((): Schema.Codec<TextDocumentSyncKind> => TextDocumentSyncKind).annotate(
2516 { description: 'The sync kind the agent wants: `"full"` or `"incremental"`.' },
2517 ),
2518 _meta: Schema.optionalKey(
2519 Schema.Union([
2520 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2521 description:
2522 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2523 }),
2524 Schema.Null,
2525 ]),
2526 ),
2527}).annotate({
2528 description: "Capabilities for `document/didChange` events.",
2529 identifier: "NesDocumentDidChangeCapabilities",
2530});
2531
2532export type NesContextCapabilities = {
2533 readonly recentFiles?: NesRecentFilesCapabilities | null;
2534 readonly relatedSnippets?: NesRelatedSnippetsCapabilities | null;
2535 readonly editHistory?: NesEditHistoryCapabilities | null;
2536 readonly userActions?: NesUserActionsCapabilities | null;
2537 readonly openFiles?: NesOpenFilesCapabilities | null;
2538 readonly diagnostics?: NesDiagnosticsCapabilities | null;
2539 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2540};
2541export const NesContextCapabilities = Schema.Struct({
2542 recentFiles: Schema.optionalKey(
2543 Schema.Union([NesRecentFilesCapabilities, Schema.Null]).annotate({
2544 description: "Whether the agent wants recent files context.",
2545 }),
2546 ),
2547 relatedSnippets: Schema.optionalKey(
2548 Schema.Union([NesRelatedSnippetsCapabilities, Schema.Null]).annotate({
2549 description: "Whether the agent wants related snippets context.",
2550 }),
2551 ),
2552 editHistory: Schema.optionalKey(
2553 Schema.Union([NesEditHistoryCapabilities, Schema.Null]).annotate({
2554 description: "Whether the agent wants edit history context.",
2555 }),
2556 ),
2557 userActions: Schema.optionalKey(
2558 Schema.Union([NesUserActionsCapabilities, Schema.Null]).annotate({
2559 description: "Whether the agent wants user actions context.",
2560 }),
2561 ),
2562 openFiles: Schema.optionalKey(
2563 Schema.Union([NesOpenFilesCapabilities, Schema.Null]).annotate({
2564 description: "Whether the agent wants open files context.",
2565 }),
2566 ),
2567 diagnostics: Schema.optionalKey(
2568 Schema.Union([NesDiagnosticsCapabilities, Schema.Null]).annotate({
2569 description: "Whether the agent wants diagnostics context.",
2570 }),
2571 ),
2572 _meta: Schema.optionalKey(
2573 Schema.Union([
2574 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2575 description:
2576 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2577 }),
2578 Schema.Null,
2579 ]),
2580 ),
2581}).annotate({
2582 description: "Context capabilities the agent wants attached to each suggestion request.",
2583 identifier: "NesContextCapabilities",
2584});
2585
2586export type Annotations = {
2587 readonly audience?: ReadonlyArray<Role> | null;
2588 readonly lastModified?: string | null;
2589 readonly priority?: number | null;
2590 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2591};
2592export const Annotations = Schema.Struct({
2593 audience: Schema.optionalKey(
2594 Schema.Union([
2595 Schema.Array(Role).annotate({
2596 description: "Intended recipients for this content, such as the user or assistant.",
2597 }),
2598 Schema.Null,
2599 ]),
2600 ),
2601 lastModified: Schema.optionalKey(
2602 Schema.Union([
2603 Schema.String.annotate({
2604 description: "Timestamp indicating when the underlying resource was last modified.",
2605 }),
2606 Schema.Null,
2607 ]),
2608 ),
2609 priority: Schema.optionalKey(
2610 Schema.Union([
2611 Schema.Number.annotate({
2612 description: "Relative importance of this content when clients choose what to surface.",
2613 format: "double",
2614 }).check(Schema.isFinite().annotate({ expected: "a finite number" })),
2615 Schema.Null,
2616 ]),
2617 ),
2618 _meta: Schema.optionalKey(
2619 Schema.Union([
2620 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2621 description:
2622 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2623 }),
2624 Schema.Null,
2625 ]),
2626 ),
2627}).annotate({
2628 description:
2629 "Optional annotations for the client. The client can use annotations to inform how objects are used or displayed",
2630 identifier: "Annotations",
2631});
2632
2633export type EmbeddedResourceResource = TextResourceContents | BlobResourceContents;
2634export const EmbeddedResourceResource = Schema.Union([
2635 Schema.suspend((): Schema.Codec<TextResourceContents> => TextResourceContents).annotate({
2636 title: "TextResourceContents",
2637 description: "Text resource contents embedded directly in the message.",
2638 }),
2639 Schema.suspend((): Schema.Codec<BlobResourceContents> => BlobResourceContents).annotate({
2640 title: "BlobResourceContents",
2641 description: "Binary resource contents embedded directly in the message.",
2642 }),
2643]).annotate({
2644 description: "Resource content that can be embedded in a message.",
2645 identifier: "EmbeddedResourceResource",
2646});
2647
2648export type TerminalOutputRequest = {
2649 readonly sessionId: SessionId;
2650 readonly terminalId: TerminalId;
2651 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2652};
2653export const TerminalOutputRequest = Schema.Struct({
2654 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
2655 description: "The session ID for this request.",
2656 }),
2657 terminalId: Schema.suspend((): Schema.Codec<TerminalId> => TerminalId).annotate({
2658 description: "The ID of the terminal to get output from.",
2659 }),
2660 _meta: Schema.optionalKey(
2661 Schema.Union([
2662 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2663 description:
2664 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2665 }),
2666 Schema.Null,
2667 ]),
2668 ),
2669}).annotate({
2670 description: "Request to get the current output and status of a terminal.",
2671 identifier: "TerminalOutputRequest",
2672});
2673
2674export type ReleaseTerminalRequest = {
2675 readonly sessionId: SessionId;
2676 readonly terminalId: TerminalId;
2677 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2678};
2679export const ReleaseTerminalRequest = Schema.Struct({
2680 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
2681 description: "The session ID for this request.",
2682 }),
2683 terminalId: Schema.suspend((): Schema.Codec<TerminalId> => TerminalId).annotate({
2684 description: "The ID of the terminal to release.",
2685 }),
2686 _meta: Schema.optionalKey(
2687 Schema.Union([
2688 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2689 description:
2690 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2691 }),
2692 Schema.Null,
2693 ]),
2694 ),
2695}).annotate({
2696 description: "Request to release a terminal and free its resources.",
2697 identifier: "ReleaseTerminalRequest",
2698});
2699
2700export type WaitForTerminalExitRequest = {
2701 readonly sessionId: SessionId;
2702 readonly terminalId: TerminalId;
2703 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2704};
2705export const WaitForTerminalExitRequest = Schema.Struct({
2706 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
2707 description: "The session ID for this request.",
2708 }),
2709 terminalId: Schema.suspend((): Schema.Codec<TerminalId> => TerminalId).annotate({
2710 description: "The ID of the terminal to wait for.",
2711 }),
2712 _meta: Schema.optionalKey(
2713 Schema.Union([
2714 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2715 description:
2716 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2717 }),
2718 Schema.Null,
2719 ]),
2720 ),
2721}).annotate({
2722 description: "Request to wait for a terminal command to exit.",
2723 identifier: "WaitForTerminalExitRequest",
2724});
2725
2726export type KillTerminalRequest = {
2727 readonly sessionId: SessionId;
2728 readonly terminalId: TerminalId;
2729 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2730};
2731export const KillTerminalRequest = Schema.Struct({
2732 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
2733 description: "The session ID for this request.",
2734 }),
2735 terminalId: Schema.suspend((): Schema.Codec<TerminalId> => TerminalId).annotate({
2736 description: "The ID of the terminal to kill.",
2737 }),
2738 _meta: Schema.optionalKey(
2739 Schema.Union([
2740 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2741 description:
2742 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2743 }),
2744 Schema.Null,
2745 ]),
2746 ),
2747}).annotate({
2748 description: "Request to kill a terminal without releasing it.",
2749 identifier: "KillTerminalRequest",
2750});
2751
2752export type CreateTerminalResponse = {
2753 readonly terminalId: TerminalId;
2754 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2755};
2756export const CreateTerminalResponse = Schema.Struct({
2757 terminalId: Schema.suspend((): Schema.Codec<TerminalId> => TerminalId).annotate({
2758 description: "The unique identifier for the created terminal.",
2759 }),
2760 _meta: Schema.optionalKey(
2761 Schema.Union([
2762 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2763 description:
2764 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2765 }),
2766 Schema.Null,
2767 ]),
2768 ),
2769}).annotate({
2770 description: "Response containing the ID of the created terminal.",
2771 identifier: "CreateTerminalResponse",
2772});
2773
2774export type PlanEntry = {
2775 readonly content: string;
2776 readonly priority: PlanEntryPriority;
2777 readonly status: PlanEntryStatus;
2778 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2779};
2780export const PlanEntry = Schema.Struct({
2781 content: Schema.String.annotate({
2782 description: "Human-readable description of what this task aims to accomplish.",
2783 }),
2784 priority: Schema.suspend((): Schema.Codec<PlanEntryPriority> => PlanEntryPriority).annotate({
2785 description:
2786 "The relative importance of this task.\nUsed to indicate which tasks are most critical to the overall goal.",
2787 }),
2788 status: Schema.suspend((): Schema.Codec<PlanEntryStatus> => PlanEntryStatus).annotate({
2789 description: "Current execution status of this task.",
2790 }),
2791 _meta: Schema.optionalKey(
2792 Schema.Union([
2793 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2794 description:
2795 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2796 }),
2797 Schema.Null,
2798 ]),
2799 ),
2800}).annotate({
2801 description:
2802 "A single entry in the execution plan.\n\nRepresents a task or goal that the assistant intends to accomplish\nas part of fulfilling the user's request.\nSee protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/agent-plan#plan-entries)",
2803 identifier: "PlanEntry",
2804});
2805
2806export type AvailableCommandInput = UnstructuredCommandInput;
2807export const AvailableCommandInput = Schema.Union([
2808 Schema.suspend((): Schema.Codec<UnstructuredCommandInput> => UnstructuredCommandInput).annotate({
2809 title: "unstructured",
2810 description: "All text that was typed after the command name is provided as input.",
2811 }),
2812]).annotate({
2813 description: "The input specification for a command.",
2814 identifier: "AvailableCommandInput",
2815});
2816
2817export type SessionMode = {
2818 readonly id: SessionModeId;
2819 readonly name: string;
2820 readonly description?: string | null;
2821 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2822};
2823export const SessionMode = Schema.Struct({
2824 id: Schema.suspend((): Schema.Codec<SessionModeId> => SessionModeId).annotate({
2825 description: "Stable identifier used to refer to this protocol object in later messages.",
2826 }),
2827 name: Schema.String.annotate({
2828 description: "Human-readable name shown for this protocol object.",
2829 }),
2830 description: Schema.optionalKey(
2831 Schema.Union([
2832 Schema.String.annotate({
2833 description: "Optional human-readable details shown with this protocol object.",
2834 }),
2835 Schema.Null,
2836 ]),
2837 ),
2838 _meta: Schema.optionalKey(
2839 Schema.Union([
2840 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2841 description:
2842 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2843 }),
2844 Schema.Null,
2845 ]),
2846 ),
2847}).annotate({
2848 description:
2849 "A mode the agent can operate in.\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)",
2850 identifier: "SessionMode",
2851});
2852
2853export type SetSessionModeRequest = {
2854 readonly sessionId: SessionId;
2855 readonly modeId: SessionModeId;
2856 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2857};
2858export const SetSessionModeRequest = Schema.Struct({
2859 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
2860 description: "The ID of the session to set the mode for.",
2861 }),
2862 modeId: Schema.suspend((): Schema.Codec<SessionModeId> => SessionModeId).annotate({
2863 description: "The ID of the mode to set.",
2864 }),
2865 _meta: Schema.optionalKey(
2866 Schema.Union([
2867 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2868 description:
2869 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2870 }),
2871 Schema.Null,
2872 ]),
2873 ),
2874}).annotate({
2875 description: "Request parameters for setting a session mode.",
2876 identifier: "SetSessionModeRequest",
2877});
2878
2879export type SessionConfigSelectOption = {
2880 readonly value: SessionConfigValueId;
2881 readonly name: string;
2882 readonly description?: string | null;
2883 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2884};
2885export const SessionConfigSelectOption = Schema.Struct({
2886 value: Schema.suspend((): Schema.Codec<SessionConfigValueId> => SessionConfigValueId).annotate({
2887 description: "Unique identifier for this option value.",
2888 }),
2889 name: Schema.String.annotate({ description: "Human-readable label for this option value." }),
2890 description: Schema.optionalKey(
2891 Schema.Union([
2892 Schema.String.annotate({ description: "Optional description for this option value." }),
2893 Schema.Null,
2894 ]),
2895 ),
2896 _meta: Schema.optionalKey(
2897 Schema.Union([
2898 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2899 description:
2900 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2901 }),
2902 Schema.Null,
2903 ]),
2904 ),
2905}).annotate({
2906 description: "A possible value for a session configuration option.",
2907 identifier: "SessionConfigSelectOption",
2908});
2909
2910export type SetSessionConfigOptionRequest =
2911 | {
2912 readonly sessionId: SessionId;
2913 readonly configId: SessionConfigId;
2914 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2915 readonly value: boolean;
2916 readonly type: "boolean";
2917 }
2918 | {
2919 readonly sessionId: SessionId;
2920 readonly configId: SessionConfigId;
2921 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2922 readonly value: SessionConfigValueId;
2923 };
2924export const SetSessionConfigOptionRequest = Schema.Union([
2925 Schema.Struct({
2926 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
2927 description: "The ID of the session to set the configuration option for.",
2928 }),
2929 configId: Schema.suspend((): Schema.Codec<SessionConfigId> => SessionConfigId).annotate({
2930 description: "The ID of the configuration option to set.",
2931 }),
2932 _meta: Schema.optionalKey(
2933 Schema.Union([
2934 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2935 description:
2936 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2937 }),
2938 Schema.Null,
2939 ]),
2940 ),
2941 value: Schema.Boolean.annotate({ description: "The boolean value." }),
2942 type: Schema.Literal("boolean"),
2943 }).annotate({ description: 'A boolean value (`type: "boolean"`).' }),
2944 Schema.Struct({
2945 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
2946 description: "The ID of the session to set the configuration option for.",
2947 }),
2948 configId: Schema.suspend((): Schema.Codec<SessionConfigId> => SessionConfigId).annotate({
2949 description: "The ID of the configuration option to set.",
2950 }),
2951 _meta: Schema.optionalKey(
2952 Schema.Union([
2953 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2954 description:
2955 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2956 }),
2957 Schema.Null,
2958 ]),
2959 ),
2960 value: Schema.suspend((): Schema.Codec<SessionConfigValueId> => SessionConfigValueId).annotate({
2961 description: "The value ID.",
2962 }),
2963 }).annotate({
2964 title: "value_id",
2965 description:
2966 "A [`SessionConfigValueId`] string value.\n\nThis is the default when `type` is absent on the wire. Unknown `type`\nvalues with string payloads also gracefully deserialize into this\nvariant.",
2967 }),
2968]).annotate({ identifier: "SetSessionConfigOptionRequest" });
2969
2970export type CompleteElicitationNotification = {
2971 readonly elicitationId: ElicitationId;
2972 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2973};
2974export const CompleteElicitationNotification = Schema.Struct({
2975 elicitationId: Schema.suspend((): Schema.Codec<ElicitationId> => ElicitationId).annotate({
2976 description: "The ID of the elicitation that completed.",
2977 }),
2978 _meta: Schema.optionalKey(
2979 Schema.Union([
2980 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
2981 description:
2982 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2983 }),
2984 Schema.Null,
2985 ]),
2986 ),
2987}).annotate({
2988 description: "Notification sent by the agent when a URL-based elicitation is complete.",
2989 identifier: "CompleteElicitationNotification",
2990});
2991
2992export type MessageMcpNotification = {
2993 readonly connectionId: McpConnectionId;
2994 readonly method: string;
2995 readonly params?: { readonly [x: string]: Schema.Json } | null;
2996 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
2997};
2998export const MessageMcpNotification = Schema.Struct({
2999 connectionId: Schema.suspend((): Schema.Codec<McpConnectionId> => McpConnectionId).annotate({
3000 description: "The MCP-over-ACP connection this message is sent on.",
3001 }),
3002 method: Schema.String.annotate({ description: "The inner MCP method name." }),
3003 params: Schema.optionalKey(
3004 Schema.Union([
3005 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3006 description:
3007 "Optional inner MCP params.\n\nIf omitted or set to `null`, the inner MCP message has no params.",
3008 }),
3009 Schema.Null,
3010 ]),
3011 ),
3012 _meta: Schema.optionalKey(
3013 Schema.Union([
3014 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3015 description:
3016 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3017 }),
3018 Schema.Null,
3019 ]),
3020 ),
3021}).annotate({
3022 description:
3023 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nNotification parameters for `mcp/message`.\n\nThis is used when the wrapped MCP message is a notification and the outer JSON-RPC\nenvelope has no `id`.",
3024 identifier: "MessageMcpNotification",
3025});
3026
3027export type MessageMcpRequest = {
3028 readonly connectionId: McpConnectionId;
3029 readonly method: string;
3030 readonly params?: { readonly [x: string]: Schema.Json } | null;
3031 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3032};
3033export const MessageMcpRequest = Schema.Struct({
3034 connectionId: Schema.suspend((): Schema.Codec<McpConnectionId> => McpConnectionId).annotate({
3035 description: "The MCP-over-ACP connection this message is sent on.",
3036 }),
3037 method: Schema.String.annotate({ description: "The inner MCP method name." }),
3038 params: Schema.optionalKey(
3039 Schema.Union([
3040 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3041 description:
3042 "Optional inner MCP params.\n\nIf omitted or set to `null`, the inner MCP message has no params.",
3043 }),
3044 Schema.Null,
3045 ]),
3046 ),
3047 _meta: Schema.optionalKey(
3048 Schema.Union([
3049 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3050 description:
3051 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3052 }),
3053 Schema.Null,
3054 ]),
3055 ),
3056}).annotate({
3057 description:
3058 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for `mcp/message`.",
3059 identifier: "MessageMcpRequest",
3060});
3061
3062export type DisconnectMcpRequest = {
3063 readonly connectionId: McpConnectionId;
3064 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3065};
3066export const DisconnectMcpRequest = Schema.Struct({
3067 connectionId: Schema.suspend((): Schema.Codec<McpConnectionId> => McpConnectionId).annotate({
3068 description: "The MCP-over-ACP connection to close.",
3069 }),
3070 _meta: Schema.optionalKey(
3071 Schema.Union([
3072 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3073 description:
3074 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3075 }),
3076 Schema.Null,
3077 ]),
3078 ),
3079}).annotate({
3080 description:
3081 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for `mcp/disconnect`.",
3082 identifier: "DisconnectMcpRequest",
3083});
3084
3085export type ConnectMcpResponse = {
3086 readonly connectionId: McpConnectionId;
3087 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3088};
3089export const ConnectMcpResponse = Schema.Struct({
3090 connectionId: Schema.suspend((): Schema.Codec<McpConnectionId> => McpConnectionId).annotate({
3091 description: "The unique identifier for this MCP-over-ACP connection.",
3092 }),
3093 _meta: Schema.optionalKey(
3094 Schema.Union([
3095 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3096 description:
3097 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3098 }),
3099 Schema.Null,
3100 ]),
3101 ),
3102}).annotate({
3103 description:
3104 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse to `mcp/connect`.",
3105 identifier: "ConnectMcpResponse",
3106});
3107
3108export type RequestPermissionOutcome =
3109 | { readonly outcome: "cancelled" }
3110 | {
3111 readonly outcome: "selected";
3112 readonly optionId: PermissionOptionId;
3113 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3114 };
3115export const RequestPermissionOutcome = Schema.Union([
3116 Schema.Struct({ outcome: Schema.Literal("cancelled") }).annotate({
3117 description:
3118 "The prompt turn was cancelled before the user responded.\n\nWhen a client sends a `session/cancel` notification to cancel an ongoing\nprompt turn, it MUST respond to all pending `session/request_permission`\nrequests with this `Cancelled` outcome.\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation)",
3119 }),
3120 Schema.Struct({
3121 outcome: Schema.Literal("selected"),
3122 optionId: Schema.suspend((): Schema.Codec<PermissionOptionId> => PermissionOptionId).annotate({
3123 description: "The ID of the option the user selected.",
3124 }),
3125 _meta: Schema.optionalKey(
3126 Schema.Union([
3127 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3128 description:
3129 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3130 }),
3131 Schema.Null,
3132 ]),
3133 ),
3134 }).annotate({ description: "The user selected one of the provided options." }),
3135]).annotate({
3136 description: "The outcome of a permission request.",
3137 identifier: "RequestPermissionOutcome",
3138});
3139
3140export type PermissionOption = {
3141 readonly optionId: PermissionOptionId;
3142 readonly name: string;
3143 readonly kind: PermissionOptionKind;
3144 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3145};
3146export const PermissionOption = Schema.Struct({
3147 optionId: Schema.suspend((): Schema.Codec<PermissionOptionId> => PermissionOptionId).annotate({
3148 description: "Unique identifier for this permission option.",
3149 }),
3150 name: Schema.String.annotate({ description: "Human-readable label to display to the user." }),
3151 kind: Schema.suspend((): Schema.Codec<PermissionOptionKind> => PermissionOptionKind).annotate({
3152 description: "Hint about the nature of this permission option.",
3153 }),
3154 _meta: Schema.optionalKey(
3155 Schema.Union([
3156 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3157 description:
3158 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3159 }),
3160 Schema.Null,
3161 ]),
3162 ),
3163}).annotate({
3164 description: "An option presented to the user when requesting permission.",
3165 identifier: "PermissionOption",
3166});
3167
3168export type CreateTerminalRequest = {
3169 readonly sessionId: SessionId;
3170 readonly command: string;
3171 readonly args?: ReadonlyArray<string>;
3172 readonly env?: ReadonlyArray<EnvVariable>;
3173 readonly cwd?: string | null;
3174 readonly outputByteLimit?: number | null;
3175 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3176};
3177export const CreateTerminalRequest = Schema.Struct({
3178 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
3179 description: "The session ID for this request.",
3180 }),
3181 command: Schema.String.annotate({ description: "The command to execute." }),
3182 args: Schema.optionalKey(
3183 Schema.Array(Schema.String).annotate({ description: "Array of command arguments." }),
3184 ),
3185 env: Schema.optionalKey(
3186 Schema.Array(EnvVariable).annotate({ description: "Environment variables for the command." }),
3187 ),
3188 cwd: Schema.optionalKey(
3189 Schema.Union([
3190 Schema.String.annotate({
3191 description: "Working directory for the command. Must be an absolute path.",
3192 }),
3193 Schema.Null,
3194 ]),
3195 ),
3196 outputByteLimit: Schema.optionalKey(
3197 Schema.Union([
3198 Schema.Number.annotate({
3199 description:
3200 "Maximum number of output bytes to retain.\n\nWhen the limit is exceeded, the Client truncates from the beginning of the output\nto stay within the limit.\n\nThe Client MUST ensure truncation happens at a character boundary to maintain valid\nstring output, even if this means the retained output is slightly less than the\nspecified limit.",
3201 format: "uint64",
3202 })
3203 .check(Schema.isInt().annotate({ expected: "an integer" }))
3204 .check(
3205 Schema.isGreaterThanOrEqualTo(0).annotate({
3206 expected: "a value greater than or equal to 0",
3207 }),
3208 ),
3209 Schema.Null,
3210 ]),
3211 ),
3212 _meta: Schema.optionalKey(
3213 Schema.Union([
3214 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3215 description:
3216 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3217 }),
3218 Schema.Null,
3219 ]),
3220 ),
3221}).annotate({
3222 description: "Request to create a new terminal and execute a command.",
3223 identifier: "CreateTerminalRequest",
3224});
3225
3226export type McpServerStdio = {
3227 readonly name: string;
3228 readonly command: string;
3229 readonly args: ReadonlyArray<string>;
3230 readonly env: ReadonlyArray<EnvVariable>;
3231 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3232};
3233export const McpServerStdio = Schema.Struct({
3234 name: Schema.String.annotate({ description: "Human-readable name identifying this MCP server." }),
3235 command: Schema.String.annotate({ description: "Absolute path to the MCP server executable." }),
3236 args: Schema.Array(Schema.String).annotate({
3237 description: "Command-line arguments to pass to the MCP server.",
3238 }),
3239 env: Schema.Array(EnvVariable).annotate({
3240 description: "Environment variables to set when launching the MCP server.",
3241 }),
3242 _meta: Schema.optionalKey(
3243 Schema.Union([
3244 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3245 description:
3246 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3247 }),
3248 Schema.Null,
3249 ]),
3250 ),
3251}).annotate({
3252 description: "Stdio transport configuration for MCP.",
3253 identifier: "McpServerStdio",
3254});
3255
3256export type MultiSelectItems =
3257 | {
3258 readonly type: "string";
3259 readonly enum: ReadonlyArray<string>;
3260 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3261 }
3262 | ({ readonly type: string } & { readonly [x: string]: Schema.Json })
3263 | TitledMultiSelectItems;
3264export const MultiSelectItems = Schema.Union([
3265 Schema.Struct({
3266 type: Schema.Literal("string"),
3267 enum: Schema.Array(Schema.String).annotate({ description: "Allowed enum values." }),
3268 _meta: Schema.optionalKey(
3269 Schema.Union([
3270 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3271 description:
3272 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3273 }),
3274 Schema.Null,
3275 ]),
3276 ),
3277 }).annotate({ description: "String item schema for multi-select enum properties." }),
3278 Schema.StructWithRest(
3279 Schema.Struct({
3280 type: Schema.String.annotate({
3281 description:
3282 "Custom or future multi-select item type.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.",
3283 }).check(
3284 Schema.isPattern(new RegExp("^(?!(?:\\x73tring)$)[\\s\\S]*$")).annotate({
3285 expected: "a string matching the RegExp ^(?!(?:\\x73tring)$)[\\s\\S]*$",
3286 }),
3287 ),
3288 }),
3289 [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))],
3290 ).annotate({ title: "other", description: "Custom or future typed multi-select items." }),
3291 Schema.suspend((): Schema.Codec<TitledMultiSelectItems> => TitledMultiSelectItems).annotate({
3292 title: "titled",
3293 description: "Titled multi-select items with human-readable labels.",
3294 }),
3295]).annotate({
3296 description: "Items for a multi-select (array) property schema.",
3297 identifier: "MultiSelectItems",
3298});
3299
3300export type ConnectMcpRequest = {
3301 readonly serverId: McpServerAcpId;
3302 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3303};
3304export const ConnectMcpRequest = Schema.Struct({
3305 serverId: Schema.suspend((): Schema.Codec<McpServerAcpId> => McpServerAcpId).annotate({
3306 description:
3307 "The ACP MCP server ID that was provided by the component declaring the MCP server.",
3308 }),
3309 _meta: Schema.optionalKey(
3310 Schema.Union([
3311 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3312 description:
3313 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3314 }),
3315 Schema.Null,
3316 ]),
3317 ),
3318}).annotate({
3319 description:
3320 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for `mcp/connect`.",
3321 identifier: "ConnectMcpRequest",
3322});
3323
3324export type AuthMethodAgent = {
3325 readonly id: AuthMethodId;
3326 readonly name: string;
3327 readonly description?: string | null;
3328 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3329};
3330export const AuthMethodAgent = Schema.Struct({
3331 id: Schema.suspend((): Schema.Codec<AuthMethodId> => AuthMethodId).annotate({
3332 description: "Unique identifier for this authentication method.",
3333 }),
3334 name: Schema.String.annotate({
3335 description: "Human-readable name of the authentication method.",
3336 }),
3337 description: Schema.optionalKey(
3338 Schema.Union([
3339 Schema.String.annotate({
3340 description:
3341 "Optional description providing more details about this authentication method.",
3342 }),
3343 Schema.Null,
3344 ]),
3345 ),
3346 _meta: Schema.optionalKey(
3347 Schema.Union([
3348 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3349 description:
3350 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3351 }),
3352 Schema.Null,
3353 ]),
3354 ),
3355}).annotate({
3356 description:
3357 "Agent handles authentication itself through `authenticate`.\n\nThis is the default authentication method type.",
3358 identifier: "AuthMethodAgent",
3359});
3360
3361export type AuthenticateRequest = {
3362 readonly methodId: AuthMethodId;
3363 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3364};
3365export const AuthenticateRequest = Schema.Struct({
3366 methodId: Schema.suspend((): Schema.Codec<AuthMethodId> => AuthMethodId).annotate({
3367 description:
3368 "The ID of the authentication method to use.\nMust be one of the methods advertised in the initialize response.",
3369 }),
3370 _meta: Schema.optionalKey(
3371 Schema.Union([
3372 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3373 description:
3374 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3375 }),
3376 Schema.Null,
3377 ]),
3378 ),
3379}).annotate({
3380 description:
3381 "Request parameters for the authenticate method.\n\nSpecifies which authentication method to use.",
3382 identifier: "AuthenticateRequest",
3383});
3384
3385export type DisableProviderRequest = {
3386 readonly providerId: ProviderId;
3387 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3388};
3389export const DisableProviderRequest = Schema.Struct({
3390 providerId: Schema.suspend((): Schema.Codec<ProviderId> => ProviderId).annotate({
3391 description: "Provider ID to disable.",
3392 }),
3393 _meta: Schema.optionalKey(
3394 Schema.Union([
3395 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3396 description:
3397 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3398 }),
3399 Schema.Null,
3400 ]),
3401 ),
3402}).annotate({
3403 description:
3404 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for `providers/disable`.",
3405 identifier: "DisableProviderRequest",
3406});
3407
3408export type ProviderCurrentConfig = {
3409 readonly apiType: LlmProtocol;
3410 readonly baseUrl: string;
3411 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3412};
3413export const ProviderCurrentConfig = Schema.Struct({
3414 apiType: Schema.suspend((): Schema.Codec<LlmProtocol> => LlmProtocol).annotate({
3415 description: "Protocol currently used by this provider.",
3416 }),
3417 baseUrl: Schema.String.annotate({ description: "Base URL currently used by this provider." }),
3418 _meta: Schema.optionalKey(
3419 Schema.Union([
3420 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3421 description:
3422 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3423 }),
3424 Schema.Null,
3425 ]),
3426 ),
3427}).annotate({
3428 description:
3429 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCurrent effective non-secret routing configuration for a provider.",
3430 identifier: "ProviderCurrentConfig",
3431});
3432
3433export type SetProviderRequest = {
3434 readonly providerId: ProviderId;
3435 readonly apiType: LlmProtocol;
3436 readonly baseUrl: string;
3437 readonly headers?: { readonly [x: string]: string };
3438 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3439};
3440export const SetProviderRequest = Schema.Struct({
3441 providerId: Schema.suspend((): Schema.Codec<ProviderId> => ProviderId).annotate({
3442 description: "Provider ID to configure.",
3443 }),
3444 apiType: Schema.suspend((): Schema.Codec<LlmProtocol> => LlmProtocol).annotate({
3445 description: "Protocol type for this provider.",
3446 }),
3447 baseUrl: Schema.String.annotate({
3448 description: "Base URL for requests sent through this provider.",
3449 }),
3450 headers: Schema.optionalKey(
3451 Schema.Record(Schema.String, Schema.String).annotate({
3452 description:
3453 "Full headers map for this provider.\nMay include authorization, routing, or other integration-specific headers.",
3454 }),
3455 ),
3456 _meta: Schema.optionalKey(
3457 Schema.Union([
3458 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3459 description:
3460 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3461 }),
3462 Schema.Null,
3463 ]),
3464 ),
3465}).annotate({
3466 description:
3467 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for `providers/set`.\n\nReplaces the full configuration for one provider ID.",
3468 identifier: "SetProviderRequest",
3469});
3470
3471export type PromptResponse = {
3472 readonly stopReason: StopReason;
3473 readonly usage?: Usage | null;
3474 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3475};
3476export const PromptResponse = Schema.Struct({
3477 stopReason: Schema.suspend((): Schema.Codec<StopReason> => StopReason).annotate({
3478 description: "Indicates why the agent stopped processing the turn.",
3479 }),
3480 usage: Schema.optionalKey(
3481 Schema.Union([Usage, Schema.Null]).annotate({
3482 description:
3483 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nToken usage for this turn (optional).",
3484 }),
3485 ),
3486 _meta: Schema.optionalKey(
3487 Schema.Union([
3488 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3489 description:
3490 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3491 }),
3492 Schema.Null,
3493 ]),
3494 ),
3495}).annotate({
3496 description:
3497 "Response from processing a user prompt.\n\nSee protocol docs: [Check for Completion](https://agentclientprotocol.com/protocol/prompt-turn#4-check-for-completion)",
3498 identifier: "PromptResponse",
3499});
3500
3501export type Range = {
3502 readonly start: Position;
3503 readonly end: Position;
3504 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3505};
3506export const Range = Schema.Struct({
3507 start: Schema.suspend((): Schema.Codec<Position> => Position).annotate({
3508 description: "The start position (inclusive).",
3509 }),
3510 end: Schema.suspend((): Schema.Codec<Position> => Position).annotate({
3511 description: "The end position (exclusive).",
3512 }),
3513 _meta: Schema.optionalKey(
3514 Schema.Union([
3515 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3516 description:
3517 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3518 }),
3519 Schema.Null,
3520 ]),
3521 ),
3522}).annotate({
3523 description: "A range in a text document, expressed as start and end positions.",
3524 identifier: "Range",
3525});
3526
3527export type NesUserAction = {
3528 readonly action: string;
3529 readonly uri: string;
3530 readonly position: Position;
3531 readonly timestampMs: number;
3532 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3533};
3534export const NesUserAction = Schema.Struct({
3535 action: Schema.String.annotate({
3536 description: 'The kind of action (e.g., "insertChar", "cursorMovement").',
3537 }),
3538 uri: Schema.String.annotate({ description: "The URI of the file where the action occurred." }),
3539 position: Schema.suspend((): Schema.Codec<Position> => Position).annotate({
3540 description: "The position where the action occurred.",
3541 }),
3542 timestampMs: Schema.Number.annotate({
3543 description: "Timestamp in milliseconds since epoch.",
3544 format: "uint64",
3545 })
3546 .check(Schema.isInt().annotate({ expected: "an integer" }))
3547 .check(
3548 Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }),
3549 ),
3550 _meta: Schema.optionalKey(
3551 Schema.Union([
3552 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3553 description:
3554 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3555 }),
3556 Schema.Null,
3557 ]),
3558 ),
3559}).annotate({
3560 description: "A user action (typing, cursor movement, etc.).",
3561 identifier: "NesUserAction",
3562});
3563
3564export type Error = {
3565 readonly code: ErrorCode;
3566 readonly message: string;
3567 readonly data?: Schema.Json;
3568};
3569export const Error = Schema.Struct({
3570 code: Schema.suspend((): Schema.Codec<ErrorCode> => ErrorCode).annotate({
3571 description:
3572 "A number indicating the error type that occurred.\nThis must be an integer as defined in the JSON-RPC specification.",
3573 }),
3574 message: Schema.String.annotate({
3575 description:
3576 "A string providing a short description of the error.\nThe message should be limited to a concise single sentence.",
3577 }),
3578 data: Schema.optionalKey(
3579 Schema.Json.annotate({
3580 expected: "JSON value",
3581 description:
3582 "Optional primitive or structured value that contains additional information about the error.\nThis may include debugging information or context-specific details.",
3583 }),
3584 ),
3585}).annotate({
3586 description:
3587 "JSON-RPC error object.\n\nRepresents an error that occurred during method execution, following the\nJSON-RPC 2.0 error object specification with optional additional data.\n\nSee protocol docs: [JSON-RPC Error Object](https://www.jsonrpc.org/specification#error_object)",
3588 identifier: "Error",
3589});
3590
3591export type SessionConfigOptionsCapabilities = {
3592 readonly boolean?: BooleanConfigOptionCapabilities | null;
3593 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3594};
3595export const SessionConfigOptionsCapabilities = Schema.Struct({
3596 boolean: Schema.optionalKey(
3597 Schema.Union([BooleanConfigOptionCapabilities, Schema.Null]).annotate({
3598 description:
3599 'Whether the client supports boolean session configuration options.\n\nOptional. Omitted or `null` both mean the client does not advertise support.\nSupplying `{}` means agents may include `type: "boolean"` entries in\n`configOptions`, and the client may send `session/set_config_option`\nrequests with `type: "boolean"` and a boolean `value`.',
3600 }),
3601 ),
3602 _meta: Schema.optionalKey(
3603 Schema.Union([
3604 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3605 description:
3606 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3607 }),
3608 Schema.Null,
3609 ]),
3610 ),
3611}).annotate({
3612 description: "Session configuration option capabilities supported by the client.",
3613 identifier: "SessionConfigOptionsCapabilities",
3614});
3615
3616export type ElicitationCapabilities = {
3617 readonly form?: ElicitationFormCapabilities | null;
3618 readonly url?: ElicitationUrlCapabilities | null;
3619 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3620};
3621export const ElicitationCapabilities = Schema.Struct({
3622 form: Schema.optionalKey(
3623 Schema.Union([ElicitationFormCapabilities, Schema.Null]).annotate({
3624 description:
3625 "Whether the client supports form-based elicitation.\n\nOptional. Omitted and `null` are equivalent and mean form support is not advertised.\nSupplying `{}` explicitly advertises form support.",
3626 }),
3627 ),
3628 url: Schema.optionalKey(
3629 Schema.Union([ElicitationUrlCapabilities, Schema.Null]).annotate({
3630 description:
3631 "Whether the client supports URL-based elicitation.\n\nOptional. Omitted or `null` both mean the client does not advertise support.\nSupplying `{}` means the client supports URL-based elicitation.",
3632 }),
3633 ),
3634 _meta: Schema.optionalKey(
3635 Schema.Union([
3636 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3637 description:
3638 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3639 }),
3640 Schema.Null,
3641 ]),
3642 ),
3643}).annotate({
3644 description: "Elicitation capabilities supported by the client.",
3645 identifier: "ElicitationCapabilities",
3646});
3647
3648export type ClientNesCapabilities = {
3649 readonly jump?: NesJumpCapabilities | null;
3650 readonly rename?: NesRenameCapabilities | null;
3651 readonly searchAndReplace?: NesSearchAndReplaceCapabilities | null;
3652 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3653};
3654export const ClientNesCapabilities = Schema.Struct({
3655 jump: Schema.optionalKey(
3656 Schema.Union([NesJumpCapabilities, Schema.Null]).annotate({
3657 description: "Whether the client supports the `jump` suggestion kind.",
3658 }),
3659 ),
3660 rename: Schema.optionalKey(
3661 Schema.Union([NesRenameCapabilities, Schema.Null]).annotate({
3662 description: "Whether the client supports the `rename` suggestion kind.",
3663 }),
3664 ),
3665 searchAndReplace: Schema.optionalKey(
3666 Schema.Union([NesSearchAndReplaceCapabilities, Schema.Null]).annotate({
3667 description: "Whether the client supports the `searchAndReplace` suggestion kind.",
3668 }),
3669 ),
3670 _meta: Schema.optionalKey(
3671 Schema.Union([
3672 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3673 description:
3674 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3675 }),
3676 Schema.Null,
3677 ]),
3678 ),
3679}).annotate({
3680 description: "NES capabilities advertised by the client during initialization.",
3681 identifier: "ClientNesCapabilities",
3682});
3683
3684export type RejectNesNotification = {
3685 readonly sessionId: SessionId;
3686 readonly id: NesSuggestionId;
3687 readonly reason?: NesRejectReason | null;
3688 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3689};
3690export const RejectNesNotification = Schema.Struct({
3691 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
3692 description: "The session ID for this notification.",
3693 }),
3694 id: Schema.suspend((): Schema.Codec<NesSuggestionId> => NesSuggestionId).annotate({
3695 description: "The ID of the rejected suggestion.",
3696 }),
3697 reason: Schema.optionalKey(
3698 Schema.Union([NesRejectReason, Schema.Null]).annotate({
3699 description: "The reason for rejection.",
3700 }),
3701 ),
3702 _meta: Schema.optionalKey(
3703 Schema.Union([
3704 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3705 description:
3706 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3707 }),
3708 Schema.Null,
3709 ]),
3710 ),
3711}).annotate({
3712 description: "Notification sent when a suggestion is rejected.",
3713 identifier: "RejectNesNotification",
3714});
3715
3716export type StartNesRequest = {
3717 readonly workspaceUri?: string | null;
3718 readonly workspaceFolders?: ReadonlyArray<WorkspaceFolder> | null;
3719 readonly repository?: NesRepository | null;
3720 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3721};
3722export const StartNesRequest = Schema.Struct({
3723 workspaceUri: Schema.optionalKey(
3724 Schema.Union([
3725 Schema.String.annotate({ description: "The root URI of the workspace." }),
3726 Schema.Null,
3727 ]),
3728 ),
3729 workspaceFolders: Schema.optionalKey(
3730 Schema.Union([
3731 Schema.Array(WorkspaceFolder).annotate({ description: "The workspace folders." }),
3732 Schema.Null,
3733 ]),
3734 ),
3735 repository: Schema.optionalKey(
3736 Schema.Union([NesRepository, Schema.Null]).annotate({
3737 description: "Repository metadata, if the workspace is a git repository.",
3738 }),
3739 ),
3740 _meta: Schema.optionalKey(
3741 Schema.Union([
3742 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3743 description:
3744 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3745 }),
3746 Schema.Null,
3747 ]),
3748 ),
3749}).annotate({ description: "Request to start an NES session.", identifier: "StartNesRequest" });
3750
3751export type NesRelatedSnippet = {
3752 readonly uri: string;
3753 readonly excerpts: ReadonlyArray<NesExcerpt>;
3754 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3755};
3756export const NesRelatedSnippet = Schema.Struct({
3757 uri: Schema.String.annotate({ description: "The URI of the file containing the snippets." }),
3758 excerpts: Schema.Array(NesExcerpt).annotate({ description: "The code excerpts." }),
3759 _meta: Schema.optionalKey(
3760 Schema.Union([
3761 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3762 description:
3763 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3764 }),
3765 Schema.Null,
3766 ]),
3767 ),
3768}).annotate({
3769 description: "A related code snippet from a file.",
3770 identifier: "NesRelatedSnippet",
3771});
3772
3773export type TerminalOutputResponse = {
3774 readonly output: string;
3775 readonly truncated: boolean;
3776 readonly exitStatus?: TerminalExitStatus | null;
3777 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3778};
3779export const TerminalOutputResponse = Schema.Struct({
3780 output: Schema.String.annotate({ description: "The terminal output captured so far." }),
3781 truncated: Schema.Boolean.annotate({
3782 description: "Whether the output was truncated due to byte limits.",
3783 }),
3784 exitStatus: Schema.optionalKey(
3785 Schema.Union([TerminalExitStatus, Schema.Null]).annotate({
3786 description: "Exit status if the command has completed.",
3787 }),
3788 ),
3789 _meta: Schema.optionalKey(
3790 Schema.Union([
3791 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3792 description:
3793 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3794 }),
3795 Schema.Null,
3796 ]),
3797 ),
3798}).annotate({
3799 description: "Response containing the terminal output and exit status.",
3800 identifier: "TerminalOutputResponse",
3801});
3802
3803export type CreateElicitationResponse =
3804 | {
3805 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3806 readonly action: "accept";
3807 readonly content?: { readonly [x: string]: ElicitationContentValue } | null;
3808 }
3809 | { readonly _meta?: { readonly [x: string]: Schema.Json } | null; readonly action: "decline" }
3810 | { readonly _meta?: { readonly [x: string]: Schema.Json } | null; readonly action: "cancel" }
3811 | ({ readonly _meta?: { readonly [x: string]: Schema.Json } | null; readonly action: string } & {
3812 readonly [x: string]: Schema.Json;
3813 });
3814export const CreateElicitationResponse = Schema.Union([
3815 Schema.Struct({
3816 _meta: Schema.optionalKey(
3817 Schema.Union([
3818 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3819 description:
3820 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3821 }),
3822 Schema.Null,
3823 ]),
3824 ),
3825 action: Schema.Literal("accept"),
3826 content: Schema.optionalKey(
3827 Schema.Union([
3828 Schema.Record(Schema.String, ElicitationContentValue).annotate({
3829 description:
3830 "The user-provided content, if any, as an object matching the requested schema.",
3831 }),
3832 Schema.Null,
3833 ]),
3834 ),
3835 }).annotate({ description: "The user accepted the elicitation and provided content." }),
3836 Schema.Struct({
3837 _meta: Schema.optionalKey(
3838 Schema.Union([
3839 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3840 description:
3841 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3842 }),
3843 Schema.Null,
3844 ]),
3845 ),
3846 action: Schema.Literal("decline"),
3847 }).annotate({ description: "The user declined the elicitation." }),
3848 Schema.Struct({
3849 _meta: Schema.optionalKey(
3850 Schema.Union([
3851 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3852 description:
3853 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3854 }),
3855 Schema.Null,
3856 ]),
3857 ),
3858 action: Schema.Literal("cancel"),
3859 }).annotate({ description: "The elicitation was cancelled." }),
3860 Schema.StructWithRest(
3861 Schema.Struct({
3862 _meta: Schema.optionalKey(
3863 Schema.Union([
3864 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3865 description:
3866 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3867 }),
3868 Schema.Null,
3869 ]),
3870 ),
3871 action: Schema.String.annotate({
3872 description:
3873 "Custom or future elicitation action.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.",
3874 }).check(
3875 Schema.isPattern(
3876 new RegExp("^(?!(?:\\x61ccept|\\x64ecline|\\x63ancel)$)[\\s\\S]*$"),
3877 ).annotate({
3878 expected:
3879 "a string matching the RegExp ^(?!(?:\\x61ccept|\\x64ecline|\\x63ancel)$)[\\s\\S]*$",
3880 }),
3881 ),
3882 }),
3883 [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))],
3884 ).annotate({
3885 title: "other",
3886 description:
3887 "Custom or future elicitation action.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.\n\nAgents that do not understand this action should preserve the raw\npayload when storing, replaying, proxying, or forwarding elicitation\nresponses. They MUST NOT treat it as a known elicitation action.",
3888 }),
3889]).annotate({ identifier: "CreateElicitationResponse" });
3890
3891export type ListSessionsResponse = {
3892 readonly sessions: ReadonlyArray<SessionInfo>;
3893 readonly nextCursor?: string | null;
3894 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3895};
3896export const ListSessionsResponse = Schema.Struct({
3897 sessions: Schema.Array(SessionInfo).annotate({
3898 description: "Array of session information objects",
3899 }),
3900 nextCursor: Schema.optionalKey(
3901 Schema.Union([
3902 Schema.String.annotate({
3903 description:
3904 "Opaque cursor token. If present, pass this in the next request's cursor parameter\nto fetch the next page. If absent, there are no more results.",
3905 }),
3906 Schema.Null,
3907 ]),
3908 ),
3909 _meta: Schema.optionalKey(
3910 Schema.Union([
3911 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3912 description:
3913 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3914 }),
3915 Schema.Null,
3916 ]),
3917 ),
3918}).annotate({ description: "Response from listing sessions.", identifier: "ListSessionsResponse" });
3919
3920export type NesDocumentEventCapabilities = {
3921 readonly didOpen?: NesDocumentDidOpenCapabilities | null;
3922 readonly didChange?: NesDocumentDidChangeCapabilities | null;
3923 readonly didClose?: NesDocumentDidCloseCapabilities | null;
3924 readonly didSave?: NesDocumentDidSaveCapabilities | null;
3925 readonly didFocus?: NesDocumentDidFocusCapabilities | null;
3926 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3927};
3928export const NesDocumentEventCapabilities = Schema.Struct({
3929 didOpen: Schema.optionalKey(
3930 Schema.Union([NesDocumentDidOpenCapabilities, Schema.Null]).annotate({
3931 description: "Whether the agent wants `document/didOpen` events.",
3932 }),
3933 ),
3934 didChange: Schema.optionalKey(
3935 Schema.Union([NesDocumentDidChangeCapabilities, Schema.Null]).annotate({
3936 description: "Whether the agent wants `document/didChange` events, and the sync kind.",
3937 }),
3938 ),
3939 didClose: Schema.optionalKey(
3940 Schema.Union([NesDocumentDidCloseCapabilities, Schema.Null]).annotate({
3941 description: "Whether the agent wants `document/didClose` events.",
3942 }),
3943 ),
3944 didSave: Schema.optionalKey(
3945 Schema.Union([NesDocumentDidSaveCapabilities, Schema.Null]).annotate({
3946 description: "Whether the agent wants `document/didSave` events.",
3947 }),
3948 ),
3949 didFocus: Schema.optionalKey(
3950 Schema.Union([NesDocumentDidFocusCapabilities, Schema.Null]).annotate({
3951 description: "Whether the agent wants `document/didFocus` events.",
3952 }),
3953 ),
3954 _meta: Schema.optionalKey(
3955 Schema.Union([
3956 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
3957 description:
3958 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3959 }),
3960 Schema.Null,
3961 ]),
3962 ),
3963}).annotate({
3964 description: "Document event capabilities the agent wants to receive.",
3965 identifier: "NesDocumentEventCapabilities",
3966});
3967
3968export type ContentBlock =
3969 | {
3970 readonly type: "text";
3971 readonly annotations?: Annotations | null;
3972 readonly text: string;
3973 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3974 }
3975 | {
3976 readonly type: "image";
3977 readonly annotations?: Annotations | null;
3978 readonly data: string;
3979 readonly mimeType: string;
3980 readonly uri?: string | null;
3981 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3982 }
3983 | {
3984 readonly type: "audio";
3985 readonly annotations?: Annotations | null;
3986 readonly data: string;
3987 readonly mimeType: string;
3988 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
3989 }
3990 | {
3991 readonly type: "resource_link";
3992 readonly annotations?: Annotations | null;
3993 readonly description?: string | null;
3994 readonly mimeType?: string | null;
3995 readonly name: string;
3996 readonly size?: number | null;
3997 readonly title?: string | null;
3998 readonly uri: string;
3999 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
4000 }
4001 | {
4002 readonly type: "resource";
4003 readonly annotations?: Annotations | null;
4004 readonly resource: EmbeddedResourceResource;
4005 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
4006 };
4007export const ContentBlock = Schema.Union([
4008 Schema.Struct({
4009 type: Schema.Literal("text"),
4010 annotations: Schema.optionalKey(
4011 Schema.Union([Annotations, Schema.Null]).annotate({
4012 description:
4013 "Optional annotations that help clients decide how to display or route this content.",
4014 }),
4015 ),
4016 text: Schema.String.annotate({ description: "Text payload carried by this content block." }),
4017 _meta: Schema.optionalKey(
4018 Schema.Union([
4019 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4020 description:
4021 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4022 }),
4023 Schema.Null,
4024 ]),
4025 ),
4026 }).annotate({ description: "Text provided to or from an LLM." }),
4027 Schema.Struct({
4028 type: Schema.Literal("image"),
4029 annotations: Schema.optionalKey(
4030 Schema.Union([Annotations, Schema.Null]).annotate({
4031 description:
4032 "Optional annotations that help clients decide how to display or route this content.",
4033 }),
4034 ),
4035 data: Schema.String.annotate({ description: "Base64-encoded media payload." }),
4036 mimeType: Schema.String.annotate({
4037 description: "MIME type describing the encoded media payload.",
4038 }),
4039 uri: Schema.optionalKey(
4040 Schema.Union([
4041 Schema.String.annotate({
4042 description: "URI associated with this resource or media payload.",
4043 }),
4044 Schema.Null,
4045 ]),
4046 ),
4047 _meta: Schema.optionalKey(
4048 Schema.Union([
4049 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4050 description:
4051 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4052 }),
4053 Schema.Null,
4054 ]),
4055 ),
4056 }).annotate({ description: "An image provided to or from an LLM." }),
4057 Schema.Struct({
4058 type: Schema.Literal("audio"),
4059 annotations: Schema.optionalKey(
4060 Schema.Union([Annotations, Schema.Null]).annotate({
4061 description:
4062 "Optional annotations that help clients decide how to display or route this content.",
4063 }),
4064 ),
4065 data: Schema.String.annotate({ description: "Base64-encoded media payload." }),
4066 mimeType: Schema.String.annotate({
4067 description: "MIME type describing the encoded media payload.",
4068 }),
4069 _meta: Schema.optionalKey(
4070 Schema.Union([
4071 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4072 description:
4073 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4074 }),
4075 Schema.Null,
4076 ]),
4077 ),
4078 }).annotate({ description: "Audio provided to or from an LLM." }),
4079 Schema.Struct({
4080 type: Schema.Literal("resource_link"),
4081 annotations: Schema.optionalKey(
4082 Schema.Union([Annotations, Schema.Null]).annotate({
4083 description:
4084 "Optional annotations that help clients decide how to display or route this content.",
4085 }),
4086 ),
4087 description: Schema.optionalKey(
4088 Schema.Union([
4089 Schema.String.annotate({
4090 description: "Optional human-readable details shown with this protocol object.",
4091 }),
4092 Schema.Null,
4093 ]),
4094 ),
4095 mimeType: Schema.optionalKey(
4096 Schema.Union([
4097 Schema.String.annotate({ description: "MIME type describing the encoded media payload." }),
4098 Schema.Null,
4099 ]),
4100 ),
4101 name: Schema.String.annotate({
4102 description: "Human-readable name shown for this protocol object.",
4103 }),
4104 size: Schema.optionalKey(
4105 Schema.Union([
4106 Schema.Number.annotate({
4107 description: "Optional size of the linked resource in bytes, if known.",
4108 format: "int64",
4109 }).check(Schema.isInt().annotate({ expected: "an integer" })),
4110 Schema.Null,
4111 ]),
4112 ),
4113 title: Schema.optionalKey(
4114 Schema.Union([
4115 Schema.String.annotate({ description: "Optional display title for end-user UI." }),
4116 Schema.Null,
4117 ]),
4118 ),
4119 uri: Schema.String.annotate({
4120 description: "URI associated with this resource or media payload.",
4121 }),
4122 _meta: Schema.optionalKey(
4123 Schema.Union([
4124 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4125 description:
4126 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4127 }),
4128 Schema.Null,
4129 ]),
4130 ),
4131 }).annotate({
4132 description:
4133 "A resource that the server is capable of reading, included in a prompt or tool call result.",
4134 }),
4135 Schema.Struct({
4136 type: Schema.Literal("resource"),
4137 annotations: Schema.optionalKey(
4138 Schema.Union([Annotations, Schema.Null]).annotate({
4139 description:
4140 "Optional annotations that help clients decide how to display or route this content.",
4141 }),
4142 ),
4143 resource: Schema.suspend(
4144 (): Schema.Codec<EmbeddedResourceResource> => EmbeddedResourceResource,
4145 ).annotate({ description: "Embedded resource payload, either text or binary data." }),
4146 _meta: Schema.optionalKey(
4147 Schema.Union([
4148 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4149 description:
4150 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4151 }),
4152 Schema.Null,
4153 ]),
4154 ),
4155 }).annotate({
4156 description: "The contents of a resource, embedded into a prompt or tool call result.",
4157 }),
4158]).annotate({
4159 description:
4160 "Content blocks represent displayable information in the Agent Client Protocol.\n\nThey provide a structured way to handle various types of user-facing content—whether\nit's text from language models, images for analysis, or embedded resources for context.\n\nContent blocks appear in:\n- User prompts sent via `session/prompt`\n- Language model output streamed through `session/update` notifications\n- Progress updates and results from tool calls\n\nThis structure is compatible with the Model Context Protocol (MCP), enabling\nagents to seamlessly forward content from MCP tool outputs without transformation.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/content)",
4161 identifier: "ContentBlock",
4162});
4163
4164export type PlanUpdateContent =
4165 | {
4166 readonly type: "items";
4167 readonly planId: PlanId;
4168 readonly entries: ReadonlyArray<PlanEntry>;
4169 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
4170 }
4171 | {
4172 readonly type: "file";
4173 readonly planId: PlanId;
4174 readonly uri: string;
4175 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
4176 }
4177 | {
4178 readonly type: "markdown";
4179 readonly planId: PlanId;
4180 readonly content: string;
4181 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
4182 };
4183export const PlanUpdateContent = Schema.Union([
4184 Schema.Struct({
4185 type: Schema.Literal("items"),
4186 planId: Schema.suspend((): Schema.Codec<PlanId> => PlanId).annotate({
4187 description: "The plan ID to update.",
4188 }),
4189 entries: Schema.Array(PlanEntry).annotate({
4190 description:
4191 "The list of tasks to be accomplished.\n\nWhen updating an item-based plan, the agent must send a complete list of all entries\nwith their current status. The client replaces that plan with each update.",
4192 }),
4193 _meta: Schema.optionalKey(
4194 Schema.Union([
4195 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4196 description:
4197 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4198 }),
4199 Schema.Null,
4200 ]),
4201 ),
4202 }).annotate({
4203 description:
4204 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA plan represented as structured entries.",
4205 }),
4206 Schema.Struct({
4207 type: Schema.Literal("file"),
4208 planId: Schema.suspend((): Schema.Codec<PlanId> => PlanId).annotate({
4209 description: "The plan ID to update.",
4210 }),
4211 uri: Schema.String.annotate({ description: "The URI of the file containing the plan." }),
4212 _meta: Schema.optionalKey(
4213 Schema.Union([
4214 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4215 description:
4216 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4217 }),
4218 Schema.Null,
4219 ]),
4220 ),
4221 }).annotate({
4222 description:
4223 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA plan represented by a file URI.",
4224 }),
4225 Schema.Struct({
4226 type: Schema.Literal("markdown"),
4227 planId: Schema.suspend((): Schema.Codec<PlanId> => PlanId).annotate({
4228 description: "The plan ID to update.",
4229 }),
4230 content: Schema.String.annotate({ description: "Markdown content for the plan." }),
4231 _meta: Schema.optionalKey(
4232 Schema.Union([
4233 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4234 description:
4235 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4236 }),
4237 Schema.Null,
4238 ]),
4239 ),
4240 }).annotate({
4241 description:
4242 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA plan represented as raw markdown content.",
4243 }),
4244]).annotate({
4245 description:
4246 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nUpdated content for a plan.",
4247 identifier: "PlanUpdateContent",
4248});
4249
4250export type AvailableCommand = {
4251 readonly name: string;
4252 readonly description: string;
4253 readonly input?: AvailableCommandInput | null;
4254 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
4255};
4256export const AvailableCommand = Schema.Struct({
4257 name: Schema.String.annotate({
4258 description: "Command name (e.g., `create_plan`, `research_codebase`).",
4259 }),
4260 description: Schema.String.annotate({
4261 description: "Human-readable description of what the command does.",
4262 }),
4263 input: Schema.optionalKey(
4264 Schema.Union([AvailableCommandInput, Schema.Null]).annotate({
4265 description: "Input for the command if required",
4266 }),
4267 ),
4268 _meta: Schema.optionalKey(
4269 Schema.Union([
4270 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4271 description:
4272 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4273 }),
4274 Schema.Null,
4275 ]),
4276 ),
4277}).annotate({ description: "Information about a command.", identifier: "AvailableCommand" });
4278
4279export type SessionModeState = {
4280 readonly currentModeId: SessionModeId;
4281 readonly availableModes: ReadonlyArray<SessionMode>;
4282 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
4283};
4284export const SessionModeState = Schema.Struct({
4285 currentModeId: Schema.suspend((): Schema.Codec<SessionModeId> => SessionModeId).annotate({
4286 description: "The current mode the Agent is in.",
4287 }),
4288 availableModes: Schema.Array(SessionMode).annotate({
4289 description: "The set of modes that the Agent can operate in",
4290 }),
4291 _meta: Schema.optionalKey(
4292 Schema.Union([
4293 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4294 description:
4295 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4296 }),
4297 Schema.Null,
4298 ]),
4299 ),
4300}).annotate({
4301 description: "The set of modes and the one currently active.",
4302 identifier: "SessionModeState",
4303});
4304
4305export type SessionConfigSelectGroup = {
4306 readonly group: SessionConfigGroupId;
4307 readonly name: string;
4308 readonly options: ReadonlyArray<SessionConfigSelectOption>;
4309 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
4310};
4311export const SessionConfigSelectGroup = Schema.Struct({
4312 group: Schema.suspend((): Schema.Codec<SessionConfigGroupId> => SessionConfigGroupId).annotate({
4313 description: "Unique identifier for this group.",
4314 }),
4315 name: Schema.String.annotate({ description: "Human-readable label for this group." }),
4316 options: Schema.Array(SessionConfigSelectOption).annotate({
4317 description: "The set of option values in this group.",
4318 }),
4319 _meta: Schema.optionalKey(
4320 Schema.Union([
4321 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4322 description:
4323 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4324 }),
4325 Schema.Null,
4326 ]),
4327 ),
4328}).annotate({
4329 description: "A group of possible values for a session configuration option.",
4330 identifier: "SessionConfigSelectGroup",
4331});
4332
4333export type RequestPermissionResponse = {
4334 readonly outcome: RequestPermissionOutcome;
4335 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
4336};
4337export const RequestPermissionResponse = Schema.Struct({
4338 outcome: Schema.suspend(
4339 (): Schema.Codec<RequestPermissionOutcome> => RequestPermissionOutcome,
4340 ).annotate({ description: "The user's decision on the permission request." }),
4341 _meta: Schema.optionalKey(
4342 Schema.Union([
4343 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4344 description:
4345 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4346 }),
4347 Schema.Null,
4348 ]),
4349 ),
4350}).annotate({
4351 description: "Response to a permission request.",
4352 identifier: "RequestPermissionResponse",
4353});
4354
4355export type McpServer =
4356 | {
4357 readonly type: "http";
4358 readonly name: string;
4359 readonly url: string;
4360 readonly headers: ReadonlyArray<HttpHeader>;
4361 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
4362 }
4363 | {
4364 readonly type: "sse";
4365 readonly name: string;
4366 readonly url: string;
4367 readonly headers: ReadonlyArray<HttpHeader>;
4368 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
4369 }
4370 | {
4371 readonly type: "acp";
4372 readonly name: string;
4373 readonly serverId: McpServerAcpId;
4374 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
4375 }
4376 | McpServerStdio;
4377export const McpServer = Schema.Union([
4378 Schema.Struct({
4379 type: Schema.Literal("http"),
4380 name: Schema.String.annotate({
4381 description: "Human-readable name identifying this MCP server.",
4382 }),
4383 url: Schema.String.annotate({ description: "URL to the MCP server." }),
4384 headers: Schema.Array(HttpHeader).annotate({
4385 description: "HTTP headers to set when making requests to the MCP server.",
4386 }),
4387 _meta: Schema.optionalKey(
4388 Schema.Union([
4389 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4390 description:
4391 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4392 }),
4393 Schema.Null,
4394 ]),
4395 ),
4396 }).annotate({ description: "HTTP transport configuration for MCP." }),
4397 Schema.Struct({
4398 type: Schema.Literal("sse"),
4399 name: Schema.String.annotate({
4400 description: "Human-readable name identifying this MCP server.",
4401 }),
4402 url: Schema.String.annotate({ description: "URL to the MCP server." }),
4403 headers: Schema.Array(HttpHeader).annotate({
4404 description: "HTTP headers to set when making requests to the MCP server.",
4405 }),
4406 _meta: Schema.optionalKey(
4407 Schema.Union([
4408 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4409 description:
4410 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4411 }),
4412 Schema.Null,
4413 ]),
4414 ),
4415 }).annotate({ description: "SSE transport configuration for MCP." }),
4416 Schema.Struct({
4417 type: Schema.Literal("acp"),
4418 name: Schema.String.annotate({
4419 description: "Human-readable name identifying this MCP server.",
4420 }),
4421 serverId: Schema.suspend((): Schema.Codec<McpServerAcpId> => McpServerAcpId).annotate({
4422 description:
4423 "Unique identifier for this MCP server, generated by the component providing it.\n\nProviders MUST NOT reuse an ID for multiple ACP-transport MCP servers that are visible\non the same ACP connection.",
4424 }),
4425 _meta: Schema.optionalKey(
4426 Schema.Union([
4427 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4428 description:
4429 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4430 }),
4431 Schema.Null,
4432 ]),
4433 ),
4434 }).annotate({
4435 description:
4436 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nACP transport configuration for MCP.\n\nThe MCP server is provided by an ACP component and communicates over the ACP channel\nusing `mcp/connect`, `mcp/message`, and `mcp/disconnect`.",
4437 }),
4438 Schema.suspend((): Schema.Codec<McpServerStdio> => McpServerStdio).annotate({
4439 title: "stdio",
4440 description: "Stdio transport configuration\n\nAll Agents MUST support this transport.",
4441 }),
4442]).annotate({
4443 description:
4444 "Configuration for connecting to an MCP (Model Context Protocol) server.\n\nMCP servers provide tools and context that the agent can use when\nprocessing prompts.\n\nSee protocol docs: [MCP Servers](https://agentclientprotocol.com/protocol/session-setup#mcp-servers)",
4445 identifier: "McpServer",
4446});
4447
4448export type ElicitationPropertySchema =
4449 | {
4450 readonly type: "string";
4451 readonly title?: string | null;
4452 readonly description?: string | null;
4453 readonly minLength?: number | null;
4454 readonly maxLength?: number | null;
4455 readonly pattern?: string | null;
4456 readonly format?: StringFormat | null;
4457 readonly default?: string | null;
4458 readonly enum?: ReadonlyArray<string> | null;
4459 readonly oneOf?: ReadonlyArray<EnumOption> | null;
4460 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
4461 }
4462 | {
4463 readonly type: "number";
4464 readonly title?: string | null;
4465 readonly description?: string | null;
4466 readonly minimum?: number | null;
4467 readonly maximum?: number | null;
4468 readonly default?: number | null;
4469 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
4470 }
4471 | {
4472 readonly type: "integer";
4473 readonly title?: string | null;
4474 readonly description?: string | null;
4475 readonly minimum?: number | null;
4476 readonly maximum?: number | null;
4477 readonly default?: number | null;
4478 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
4479 }
4480 | {
4481 readonly type: "boolean";
4482 readonly title?: string | null;
4483 readonly description?: string | null;
4484 readonly default?: boolean | null;
4485 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
4486 }
4487 | {
4488 readonly type: "array";
4489 readonly title?: string | null;
4490 readonly description?: string | null;
4491 readonly minItems?: number | null;
4492 readonly maxItems?: number | null;
4493 readonly items: MultiSelectItems;
4494 readonly default?: ReadonlyArray<string> | null;
4495 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
4496 }
4497 | ({ readonly type: string } & { readonly [x: string]: Schema.Json });
4498export const ElicitationPropertySchema = Schema.Union([
4499 Schema.Struct({
4500 type: Schema.Literal("string"),
4501 title: Schema.optionalKey(
4502 Schema.Union([
4503 Schema.String.annotate({
4504 description:
4505 "Optional title for the property.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.",
4506 }),
4507 Schema.Null,
4508 ]),
4509 ),
4510 description: Schema.optionalKey(
4511 Schema.Union([
4512 Schema.String.annotate({
4513 description:
4514 "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.",
4515 }),
4516 Schema.Null,
4517 ]),
4518 ),
4519 minLength: Schema.optionalKey(
4520 Schema.Union([
4521 Schema.Number.annotate({
4522 description:
4523 "Minimum string length.\n\nOptional. Omitted and `null` are equivalent and mean there is no minimum length constraint.",
4524 format: "uint32",
4525 })
4526 .check(Schema.isInt().annotate({ expected: "an integer" }))
4527 .check(
4528 Schema.isGreaterThanOrEqualTo(0).annotate({
4529 expected: "a value greater than or equal to 0",
4530 }),
4531 ),
4532 Schema.Null,
4533 ]),
4534 ),
4535 maxLength: Schema.optionalKey(
4536 Schema.Union([
4537 Schema.Number.annotate({
4538 description:
4539 "Maximum string length.\n\nOptional. Omitted and `null` are equivalent and mean there is no maximum length constraint.",
4540 format: "uint32",
4541 })
4542 .check(Schema.isInt().annotate({ expected: "an integer" }))
4543 .check(
4544 Schema.isGreaterThanOrEqualTo(0).annotate({
4545 expected: "a value greater than or equal to 0",
4546 }),
4547 ),
4548 Schema.Null,
4549 ]),
4550 ),
4551 pattern: Schema.optionalKey(
4552 Schema.Union([
4553 Schema.String.annotate({
4554 description:
4555 "Pattern the string must match.\n\nOptional. Omitted and `null` are equivalent and mean there is no pattern constraint.",
4556 }),
4557 Schema.Null,
4558 ]),
4559 ),
4560 format: Schema.optionalKey(
4561 Schema.Union([StringFormat, Schema.Null]).annotate({
4562 description:
4563 "String format.\n\nOptional. Omitted and `null` are equivalent and mean there is no format constraint.",
4564 }),
4565 ),
4566 default: Schema.optionalKey(
4567 Schema.Union([
4568 Schema.String.annotate({
4569 description:
4570 "Default value.\n\nOptional. Omitted and `null` are equivalent and mean no default value is provided.",
4571 }),
4572 Schema.Null,
4573 ]),
4574 ),
4575 enum: Schema.optionalKey(
4576 Schema.Union([
4577 Schema.Array(Schema.String).annotate({
4578 description:
4579 "Enum values for untitled single-select enums.\nOptional. Omitted and `null` are equivalent and mean no untitled single-select choices are\ndeclared by `enum`.",
4580 }),
4581 Schema.Null,
4582 ]),
4583 ),
4584 oneOf: Schema.optionalKey(
4585 Schema.Union([
4586 Schema.Array(EnumOption).annotate({
4587 description:
4588 "Titled enum options for titled single-select enums.\nOptional. Omitted and `null` are equivalent and mean no titled single-select choices are\ndeclared by `oneOf`.",
4589 }),
4590 Schema.Null,
4591 ]),
4592 ),
4593 _meta: Schema.optionalKey(
4594 Schema.Union([
4595 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4596 description:
4597 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4598 }),
4599 Schema.Null,
4600 ]),
4601 ),
4602 }).annotate({
4603 description:
4604 'Schema for string properties in an elicitation form.\n\nWhen `enum` or `oneOf` is set, this represents a single-select enum\nwith `"type": "string"`.',
4605 }),
4606 Schema.Struct({
4607 type: Schema.Literal("number"),
4608 title: Schema.optionalKey(
4609 Schema.Union([
4610 Schema.String.annotate({
4611 description:
4612 "Optional title for the property.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.",
4613 }),
4614 Schema.Null,
4615 ]),
4616 ),
4617 description: Schema.optionalKey(
4618 Schema.Union([
4619 Schema.String.annotate({
4620 description:
4621 "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.",
4622 }),
4623 Schema.Null,
4624 ]),
4625 ),
4626 minimum: Schema.optionalKey(
4627 Schema.Union([
4628 Schema.Number.annotate({
4629 description:
4630 "Minimum value (inclusive).\n\nOptional. Omitted and `null` are equivalent and mean there is no inclusive lower bound.",
4631 format: "double",
4632 }).check(Schema.isFinite().annotate({ expected: "a finite number" })),
4633 Schema.Null,
4634 ]),
4635 ),
4636 maximum: Schema.optionalKey(
4637 Schema.Union([
4638 Schema.Number.annotate({
4639 description:
4640 "Maximum value (inclusive).\n\nOptional. Omitted and `null` are equivalent and mean there is no inclusive upper bound.",
4641 format: "double",
4642 }).check(Schema.isFinite().annotate({ expected: "a finite number" })),
4643 Schema.Null,
4644 ]),
4645 ),
4646 default: Schema.optionalKey(
4647 Schema.Union([
4648 Schema.Number.annotate({
4649 description:
4650 "Default value.\n\nOptional. Omitted and `null` are equivalent and mean no default value is provided.",
4651 format: "double",
4652 }).check(Schema.isFinite().annotate({ expected: "a finite number" })),
4653 Schema.Null,
4654 ]),
4655 ),
4656 _meta: Schema.optionalKey(
4657 Schema.Union([
4658 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4659 description:
4660 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4661 }),
4662 Schema.Null,
4663 ]),
4664 ),
4665 }).annotate({
4666 description: "Schema for number (floating-point) properties in an elicitation form.",
4667 }),
4668 Schema.Struct({
4669 type: Schema.Literal("integer"),
4670 title: Schema.optionalKey(
4671 Schema.Union([
4672 Schema.String.annotate({
4673 description:
4674 "Optional title for the property.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.",
4675 }),
4676 Schema.Null,
4677 ]),
4678 ),
4679 description: Schema.optionalKey(
4680 Schema.Union([
4681 Schema.String.annotate({
4682 description:
4683 "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.",
4684 }),
4685 Schema.Null,
4686 ]),
4687 ),
4688 minimum: Schema.optionalKey(
4689 Schema.Union([
4690 Schema.Number.annotate({
4691 description:
4692 "Minimum value (inclusive).\n\nOptional. Omitted and `null` are equivalent and mean there is no inclusive lower bound.",
4693 format: "int64",
4694 }).check(Schema.isInt().annotate({ expected: "an integer" })),
4695 Schema.Null,
4696 ]),
4697 ),
4698 maximum: Schema.optionalKey(
4699 Schema.Union([
4700 Schema.Number.annotate({
4701 description:
4702 "Maximum value (inclusive).\n\nOptional. Omitted and `null` are equivalent and mean there is no inclusive upper bound.",
4703 format: "int64",
4704 }).check(Schema.isInt().annotate({ expected: "an integer" })),
4705 Schema.Null,
4706 ]),
4707 ),
4708 default: Schema.optionalKey(
4709 Schema.Union([
4710 Schema.Number.annotate({
4711 description:
4712 "Default value.\n\nOptional. Omitted and `null` are equivalent and mean no default value is provided.",
4713 format: "int64",
4714 }).check(Schema.isInt().annotate({ expected: "an integer" })),
4715 Schema.Null,
4716 ]),
4717 ),
4718 _meta: Schema.optionalKey(
4719 Schema.Union([
4720 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4721 description:
4722 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4723 }),
4724 Schema.Null,
4725 ]),
4726 ),
4727 }).annotate({ description: "Schema for integer properties in an elicitation form." }),
4728 Schema.Struct({
4729 type: Schema.Literal("boolean"),
4730 title: Schema.optionalKey(
4731 Schema.Union([
4732 Schema.String.annotate({
4733 description:
4734 "Optional title for the property.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.",
4735 }),
4736 Schema.Null,
4737 ]),
4738 ),
4739 description: Schema.optionalKey(
4740 Schema.Union([
4741 Schema.String.annotate({
4742 description:
4743 "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.",
4744 }),
4745 Schema.Null,
4746 ]),
4747 ),
4748 default: Schema.optionalKey(
4749 Schema.Union([
4750 Schema.Boolean.annotate({
4751 description:
4752 "Default value.\n\nOptional. Omitted and `null` are equivalent and mean no default value is provided.",
4753 }),
4754 Schema.Null,
4755 ]),
4756 ),
4757 _meta: Schema.optionalKey(
4758 Schema.Union([
4759 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4760 description:
4761 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4762 }),
4763 Schema.Null,
4764 ]),
4765 ),
4766 }).annotate({ description: "Schema for boolean properties in an elicitation form." }),
4767 Schema.Struct({
4768 type: Schema.Literal("array"),
4769 title: Schema.optionalKey(
4770 Schema.Union([
4771 Schema.String.annotate({
4772 description:
4773 "Optional title for the property.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.",
4774 }),
4775 Schema.Null,
4776 ]),
4777 ),
4778 description: Schema.optionalKey(
4779 Schema.Union([
4780 Schema.String.annotate({
4781 description:
4782 "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.",
4783 }),
4784 Schema.Null,
4785 ]),
4786 ),
4787 minItems: Schema.optionalKey(
4788 Schema.Union([
4789 Schema.Number.annotate({
4790 description:
4791 "Minimum number of items to select.\n\nOptional. Omitted and `null` are equivalent and mean there is no minimum selection count.",
4792 format: "uint64",
4793 })
4794 .check(Schema.isInt().annotate({ expected: "an integer" }))
4795 .check(
4796 Schema.isGreaterThanOrEqualTo(0).annotate({
4797 expected: "a value greater than or equal to 0",
4798 }),
4799 ),
4800 Schema.Null,
4801 ]),
4802 ),
4803 maxItems: Schema.optionalKey(
4804 Schema.Union([
4805 Schema.Number.annotate({
4806 description:
4807 "Maximum number of items to select.\n\nOptional. Omitted and `null` are equivalent and mean there is no maximum selection count.",
4808 format: "uint64",
4809 })
4810 .check(Schema.isInt().annotate({ expected: "an integer" }))
4811 .check(
4812 Schema.isGreaterThanOrEqualTo(0).annotate({
4813 expected: "a value greater than or equal to 0",
4814 }),
4815 ),
4816 Schema.Null,
4817 ]),
4818 ),
4819 items: Schema.suspend((): Schema.Codec<MultiSelectItems> => MultiSelectItems).annotate({
4820 description: "The items definition describing allowed values.",
4821 }),
4822 default: Schema.optionalKey(
4823 Schema.Union([
4824 Schema.Array(Schema.String).annotate({
4825 description:
4826 "Default selected values.\n\nOptional. Omitted and `null` are equivalent and mean no default selections are provided.",
4827 }),
4828 Schema.Null,
4829 ]),
4830 ),
4831 _meta: Schema.optionalKey(
4832 Schema.Union([
4833 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4834 description:
4835 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4836 }),
4837 Schema.Null,
4838 ]),
4839 ),
4840 }).annotate({
4841 description: "Schema for multi-select (array) properties in an elicitation form.",
4842 }),
4843 Schema.StructWithRest(
4844 Schema.Struct({
4845 type: Schema.String.annotate({
4846 description:
4847 "Custom or future elicitation property schema type.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.",
4848 }).check(
4849 Schema.isPattern(
4850 new RegExp("^(?!(?:\\x73tring|\\x6eumber|\\x69nteger|\\x62oolean|\\x61rray)$)[\\s\\S]*$"),
4851 ).annotate({
4852 expected:
4853 "a string matching the RegExp ^(?!(?:\\x73tring|\\x6eumber|\\x69nteger|\\x62oolean|\\x61rray)$)[\\s\\S]*$",
4854 }),
4855 ),
4856 }),
4857 [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))],
4858 ).annotate({
4859 title: "other",
4860 description:
4861 "Custom or future elicitation property schema.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.\n\nClients that do not understand this property schema type should preserve\nthe raw schema when storing, replaying, proxying, or forwarding\nelicitation requests. They MUST NOT render it as a known input control.",
4862 }),
4863]).annotate({
4864 description:
4865 'Property schema for elicitation form fields.\n\nEach variant corresponds to a JSON Schema `"type"` value.\nSingle-select enums use the `String` variant with `enum` or `oneOf` set.\nMulti-select enums use the `Array` variant.',
4866 identifier: "ElicitationPropertySchema",
4867});
4868
4869export type AuthMethod =
4870 | {
4871 readonly type: "terminal";
4872 readonly id: AuthMethodId;
4873 readonly name: string;
4874 readonly description?: string | null;
4875 readonly args?: ReadonlyArray<string>;
4876 readonly env?: { readonly [x: string]: string };
4877 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
4878 }
4879 | AuthMethodAgent;
4880export const AuthMethod = Schema.Union([
4881 Schema.Struct({
4882 type: Schema.Literal("terminal"),
4883 id: Schema.suspend((): Schema.Codec<AuthMethodId> => AuthMethodId).annotate({
4884 description: "Unique identifier for this authentication method.",
4885 }),
4886 name: Schema.String.annotate({
4887 description: "Human-readable name of the authentication method.",
4888 }),
4889 description: Schema.optionalKey(
4890 Schema.Union([
4891 Schema.String.annotate({
4892 description:
4893 "Optional description providing more details about this authentication method.",
4894 }),
4895 Schema.Null,
4896 ]),
4897 ),
4898 args: Schema.optionalKey(
4899 Schema.Array(Schema.String).annotate({
4900 description:
4901 "Additional arguments to append to the configured agent invocation for terminal auth.",
4902 }),
4903 ),
4904 env: Schema.optionalKey(
4905 Schema.Record(Schema.String, Schema.String).annotate({
4906 description:
4907 "Additional environment variables to set on the configured agent invocation for terminal auth.\nThese values override same-named variables in the base launch configuration.",
4908 }),
4909 ),
4910 _meta: Schema.optionalKey(
4911 Schema.Union([
4912 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4913 description:
4914 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4915 }),
4916 Schema.Null,
4917 ]),
4918 ),
4919 }).annotate({
4920 description:
4921 "Terminal-based authentication method.\n\nThe client runs the configured agent program as a separate interactive\nprocess for the user to authenticate via a TUI. Agents MUST advertise this\nmethod only when the client enabled its terminal authentication capability.\nA zero exit status signals success; any other termination signals failure.\nThe client MUST NOT pass this method to `authenticate`.",
4922 }),
4923 Schema.suspend((): Schema.Codec<AuthMethodAgent> => AuthMethodAgent).annotate({
4924 title: "agent",
4925 description:
4926 "Agent handles authentication itself through `authenticate`.\n\nThis is the default when no `type` is specified.",
4927 }),
4928]).annotate({
4929 description:
4930 "Describes an available authentication method.\n\nThe `type` field acts as the discriminator in the serialized JSON form.\nWhen no `type` is present, the method is treated as `agent`.",
4931 identifier: "AuthMethod",
4932});
4933
4934export type ProviderInfo = {
4935 readonly providerId: ProviderId;
4936 readonly supported: ReadonlyArray<LlmProtocol>;
4937 readonly required: boolean;
4938 readonly current?: ProviderCurrentConfig | null;
4939 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
4940};
4941export const ProviderInfo = Schema.Struct({
4942 providerId: Schema.suspend((): Schema.Codec<ProviderId> => ProviderId).annotate({
4943 description: 'Provider identifier, for example "main" or "openai".',
4944 }),
4945 supported: Schema.Array(LlmProtocol).annotate({
4946 description: "Supported protocol types for this provider.",
4947 }),
4948 required: Schema.Boolean.annotate({
4949 description:
4950 "Whether this provider is mandatory and cannot be disabled via `providers/disable`.\nIf true, clients must not call `providers/disable` for this provider ID.",
4951 }),
4952 current: Schema.optionalKey(
4953 Schema.Union([ProviderCurrentConfig, Schema.Null]).annotate({
4954 description:
4955 "Current effective non-secret routing config.\nNull or omitted means provider is disabled.",
4956 }),
4957 ),
4958 _meta: Schema.optionalKey(
4959 Schema.Union([
4960 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4961 description:
4962 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4963 }),
4964 Schema.Null,
4965 ]),
4966 ),
4967}).annotate({
4968 description:
4969 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInformation about a configurable LLM provider.",
4970 identifier: "ProviderInfo",
4971});
4972
4973export type NesTextEdit = {
4974 readonly range: Range;
4975 readonly newText: string;
4976 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
4977};
4978export const NesTextEdit = Schema.Struct({
4979 range: Schema.suspend((): Schema.Codec<Range> => Range).annotate({
4980 description: "The range to replace.",
4981 }),
4982 newText: Schema.String.annotate({ description: "The replacement text." }),
4983 _meta: Schema.optionalKey(
4984 Schema.Union([
4985 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
4986 description:
4987 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
4988 }),
4989 Schema.Null,
4990 ]),
4991 ),
4992}).annotate({ description: "A text edit within a suggestion.", identifier: "NesTextEdit" });
4993
4994export type TextDocumentContentChangeEvent = {
4995 readonly range?: Range | null;
4996 readonly text: string;
4997 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
4998};
4999export const TextDocumentContentChangeEvent = Schema.Struct({
5000 range: Schema.optionalKey(
5001 Schema.Union([Range, Schema.Null]).annotate({
5002 description:
5003 "The range of the document that changed. If `None`, the entire content is replaced.",
5004 }),
5005 ),
5006 text: Schema.String.annotate({
5007 description: "The new text for the range, or the full document content if `range` is `None`.",
5008 }),
5009 _meta: Schema.optionalKey(
5010 Schema.Union([
5011 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5012 description:
5013 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5014 }),
5015 Schema.Null,
5016 ]),
5017 ),
5018}).annotate({
5019 description:
5020 "A content change event for a document.\n\nWhen `range` is `None`, `text` is the full content of the document.\nWhen `range` is `Some`, `text` replaces the given range.",
5021 identifier: "TextDocumentContentChangeEvent",
5022});
5023
5024export type DidFocusDocumentNotification = {
5025 readonly sessionId: SessionId;
5026 readonly uri: string;
5027 readonly version: number;
5028 readonly position: Position;
5029 readonly visibleRange: Range;
5030 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5031};
5032export const DidFocusDocumentNotification = Schema.Struct({
5033 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
5034 description: "The session ID for this notification.",
5035 }),
5036 uri: Schema.String.annotate({ description: "The URI of the focused document." }),
5037 version: Schema.Number.annotate({
5038 description: "The version number of the document.",
5039 format: "int64",
5040 }).check(Schema.isInt().annotate({ expected: "an integer" })),
5041 position: Schema.suspend((): Schema.Codec<Position> => Position).annotate({
5042 description: "The current cursor position.",
5043 }),
5044 visibleRange: Schema.suspend((): Schema.Codec<Range> => Range).annotate({
5045 description: "The portion of the file currently visible in the editor viewport.",
5046 }),
5047 _meta: Schema.optionalKey(
5048 Schema.Union([
5049 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5050 description:
5051 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5052 }),
5053 Schema.Null,
5054 ]),
5055 ),
5056}).annotate({
5057 description: "Notification sent when a file becomes the active editor tab.",
5058 identifier: "DidFocusDocumentNotification",
5059});
5060
5061export type NesOpenFile = {
5062 readonly uri: string;
5063 readonly languageId: string;
5064 readonly visibleRange?: Range | null;
5065 readonly lastFocusedMs?: number | null;
5066 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5067};
5068export const NesOpenFile = Schema.Struct({
5069 uri: Schema.String.annotate({ description: "The URI of the file." }),
5070 languageId: Schema.String.annotate({ description: "The language identifier." }),
5071 visibleRange: Schema.optionalKey(
5072 Schema.Union([Range, Schema.Null]).annotate({
5073 description: "The visible range in the editor, if any.",
5074 }),
5075 ),
5076 lastFocusedMs: Schema.optionalKey(
5077 Schema.Union([
5078 Schema.Number.annotate({
5079 description: "Timestamp in milliseconds since epoch of when the file was last focused.",
5080 format: "uint64",
5081 })
5082 .check(Schema.isInt().annotate({ expected: "an integer" }))
5083 .check(
5084 Schema.isGreaterThanOrEqualTo(0).annotate({
5085 expected: "a value greater than or equal to 0",
5086 }),
5087 ),
5088 Schema.Null,
5089 ]),
5090 ),
5091 _meta: Schema.optionalKey(
5092 Schema.Union([
5093 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5094 description:
5095 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5096 }),
5097 Schema.Null,
5098 ]),
5099 ),
5100}).annotate({ description: "An open file in the editor.", identifier: "NesOpenFile" });
5101
5102export type NesDiagnostic = {
5103 readonly uri: string;
5104 readonly range: Range;
5105 readonly severity: NesDiagnosticSeverity;
5106 readonly message: string;
5107 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5108};
5109export const NesDiagnostic = Schema.Struct({
5110 uri: Schema.String.annotate({ description: "The URI of the file containing the diagnostic." }),
5111 range: Schema.suspend((): Schema.Codec<Range> => Range).annotate({
5112 description: "The range of the diagnostic.",
5113 }),
5114 severity: Schema.suspend(
5115 (): Schema.Codec<NesDiagnosticSeverity> => NesDiagnosticSeverity,
5116 ).annotate({ description: "The severity of the diagnostic." }),
5117 message: Schema.String.annotate({ description: "The diagnostic message." }),
5118 _meta: Schema.optionalKey(
5119 Schema.Union([
5120 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5121 description:
5122 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5123 }),
5124 Schema.Null,
5125 ]),
5126 ),
5127}).annotate({ description: "A diagnostic (error, warning, etc.).", identifier: "NesDiagnostic" });
5128
5129export type ClientSessionCapabilities = {
5130 readonly compaction?: CompactionCapabilities | null;
5131 readonly configOptions?: SessionConfigOptionsCapabilities | null;
5132 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5133};
5134export const ClientSessionCapabilities = Schema.Struct({
5135 compaction: Schema.optionalKey(
5136 Schema.Union([CompactionCapabilities, Schema.Null]).annotate({
5137 description:
5138 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nSupport for ID-addressed context compaction updates. Omitted or `null`\nmeans unsupported; `{}` advertises the complete compaction contract.",
5139 }),
5140 ),
5141 configOptions: Schema.optionalKey(
5142 Schema.Union([SessionConfigOptionsCapabilities, Schema.Null]).annotate({
5143 description:
5144 "Config option capabilities supported by the client.\n\nOmitted or `null` both mean the client does not advertise support for any\nconfig option extensions.",
5145 }),
5146 ),
5147 _meta: Schema.optionalKey(
5148 Schema.Union([
5149 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5150 description:
5151 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5152 }),
5153 Schema.Null,
5154 ]),
5155 ),
5156}).annotate({
5157 description: "Session-related capabilities supported by the client.",
5158 identifier: "ClientSessionCapabilities",
5159});
5160
5161export type NesEventCapabilities = {
5162 readonly document?: NesDocumentEventCapabilities | null;
5163 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5164};
5165export const NesEventCapabilities = Schema.Struct({
5166 document: Schema.optionalKey(
5167 Schema.Union([NesDocumentEventCapabilities, Schema.Null]).annotate({
5168 description: "Document event capabilities.",
5169 }),
5170 ),
5171 _meta: Schema.optionalKey(
5172 Schema.Union([
5173 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5174 description:
5175 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5176 }),
5177 Schema.Null,
5178 ]),
5179 ),
5180}).annotate({
5181 description: "Event capabilities the agent can consume.",
5182 identifier: "NesEventCapabilities",
5183});
5184
5185export type ToolCallContent =
5186 | {
5187 readonly type: "content";
5188 readonly content: ContentBlock;
5189 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5190 }
5191 | {
5192 readonly type: "diff";
5193 readonly path: string;
5194 readonly oldText?: string | null;
5195 readonly newText: string;
5196 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5197 }
5198 | {
5199 readonly type: "terminal";
5200 readonly terminalId: TerminalId;
5201 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5202 };
5203export const ToolCallContent = Schema.Union([
5204 Schema.Struct({
5205 type: Schema.Literal("content"),
5206 content: Schema.suspend((): Schema.Codec<ContentBlock> => ContentBlock).annotate({
5207 description: "The actual content block.",
5208 }),
5209 _meta: Schema.optionalKey(
5210 Schema.Union([
5211 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5212 description:
5213 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5214 }),
5215 Schema.Null,
5216 ]),
5217 ),
5218 }).annotate({ description: "Standard content block (text, images, resources)." }),
5219 Schema.Struct({
5220 type: Schema.Literal("diff"),
5221 path: Schema.String.annotate({ description: "The absolute file path being modified." }),
5222 oldText: Schema.optionalKey(
5223 Schema.Union([
5224 Schema.String.annotate({ description: "The original content (None for new files)." }),
5225 Schema.Null,
5226 ]),
5227 ),
5228 newText: Schema.String.annotate({ description: "The new content after modification." }),
5229 _meta: Schema.optionalKey(
5230 Schema.Union([
5231 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5232 description:
5233 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5234 }),
5235 Schema.Null,
5236 ]),
5237 ),
5238 }).annotate({
5239 description:
5240 "A diff representing file modifications.\n\nShows changes to files in a format suitable for display in the client UI.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/tool-calls#content)",
5241 }),
5242 Schema.Struct({
5243 type: Schema.Literal("terminal"),
5244 terminalId: Schema.suspend((): Schema.Codec<TerminalId> => TerminalId).annotate({
5245 description: "Identifier of the terminal instance to embed in the content stream.",
5246 }),
5247 _meta: Schema.optionalKey(
5248 Schema.Union([
5249 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5250 description:
5251 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5252 }),
5253 Schema.Null,
5254 ]),
5255 ),
5256 }).annotate({
5257 description:
5258 "Embed a terminal created with `terminal/create` by its id.\n\nThe terminal must be added before calling `terminal/release`.\n\nSee protocol docs: [Terminal](https://agentclientprotocol.com/protocol/terminals)",
5259 }),
5260]).annotate({
5261 description:
5262 "Content produced by a tool call.\n\nTool calls can produce different types of content including\nstandard content blocks (text, images) or file diffs.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/tool-calls#content)",
5263 identifier: "ToolCallContent",
5264});
5265
5266export type PromptRequest = {
5267 readonly sessionId: SessionId;
5268 readonly prompt: ReadonlyArray<ContentBlock>;
5269 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5270};
5271export const PromptRequest = Schema.Struct({
5272 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
5273 description: "The ID of the session to send this user message to",
5274 }),
5275 prompt: Schema.Array(ContentBlock).annotate({
5276 description:
5277 "The blocks of content that compose the user's message.\n\nAs a baseline, the Agent MUST support [`ContentBlock::Text`] and [`ContentBlock::ResourceLink`],\nwhile other variants are optionally enabled via [`PromptCapabilities`].\n\nThe Client MUST adapt its interface according to [`PromptCapabilities`].\n\nThe client MAY include referenced pieces of context as either\n[`ContentBlock::Resource`] or [`ContentBlock::ResourceLink`].\n\nWhen available, [`ContentBlock::Resource`] is preferred\nas it avoids extra round-trips and allows the message to include\npieces of context from sources the agent may not have access to.",
5278 }),
5279 _meta: Schema.optionalKey(
5280 Schema.Union([
5281 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5282 description:
5283 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5284 }),
5285 Schema.Null,
5286 ]),
5287 ),
5288}).annotate({
5289 description:
5290 "Request parameters for sending a user prompt to the agent.\n\nContains the user's message and any additional context.\n\nSee protocol docs: [User Message](https://agentclientprotocol.com/protocol/prompt-turn#1-user-message)",
5291 identifier: "PromptRequest",
5292});
5293
5294export type SessionConfigSelectOptions =
5295 | ReadonlyArray<SessionConfigSelectOption>
5296 | ReadonlyArray<SessionConfigSelectGroup>;
5297export const SessionConfigSelectOptions = Schema.Union([
5298 Schema.Array(SessionConfigSelectOption).annotate({
5299 title: "Ungrouped",
5300 description: "A flat list of options with no grouping.",
5301 }),
5302 Schema.Array(SessionConfigSelectGroup).annotate({
5303 title: "Grouped",
5304 description: "A list of options grouped under headers.",
5305 }),
5306]).annotate({
5307 description: "Possible values for a session configuration option.",
5308 identifier: "SessionConfigSelectOptions",
5309});
5310
5311export type NewSessionRequest = {
5312 readonly cwd: string;
5313 readonly additionalDirectories?: ReadonlyArray<string>;
5314 readonly mcpServers: ReadonlyArray<McpServer>;
5315 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5316};
5317export const NewSessionRequest = Schema.Struct({
5318 cwd: Schema.String.annotate({
5319 description: "The working directory for this session. Must be an absolute path.",
5320 }),
5321 additionalDirectories: Schema.optionalKey(
5322 Schema.Array(Schema.String).annotate({
5323 description:
5324 "Additional workspace roots for this session. Each path must be absolute.\n\nThese expand the session's filesystem scope without changing `cwd`, which\nremains the base for relative paths. When omitted or empty, no\nadditional roots are activated for the new session.",
5325 }),
5326 ),
5327 mcpServers: Schema.Array(McpServer).annotate({
5328 description: "List of MCP (Model Context Protocol) servers the agent should connect to.",
5329 }),
5330 _meta: Schema.optionalKey(
5331 Schema.Union([
5332 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5333 description:
5334 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5335 }),
5336 Schema.Null,
5337 ]),
5338 ),
5339}).annotate({
5340 description:
5341 "Request parameters for creating a new session.\n\nSee protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol/session-setup#creating-a-session)",
5342 identifier: "NewSessionRequest",
5343});
5344
5345export type LoadSessionRequest = {
5346 readonly mcpServers: ReadonlyArray<McpServer>;
5347 readonly cwd: string;
5348 readonly additionalDirectories?: ReadonlyArray<string>;
5349 readonly sessionId: SessionId;
5350 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5351};
5352export const LoadSessionRequest = Schema.Struct({
5353 mcpServers: Schema.Array(McpServer).annotate({
5354 description: "List of MCP servers to connect to for this session.",
5355 }),
5356 cwd: Schema.String.annotate({
5357 description: "The working directory for this session. Must be an absolute path.",
5358 }),
5359 additionalDirectories: Schema.optionalKey(
5360 Schema.Array(Schema.String).annotate({
5361 description:
5362 "Additional workspace roots to activate for this session. Each path must be absolute.\n\nWhen omitted or empty, no additional roots are activated. When non-empty,\nthis is the complete resulting additional-root list for the loaded\nsession. It may differ from any previously used or reported list as long as\nthe request `cwd` matches the session's `cwd`.",
5363 }),
5364 ),
5365 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
5366 description: "The ID of the session to load.",
5367 }),
5368 _meta: Schema.optionalKey(
5369 Schema.Union([
5370 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5371 description:
5372 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5373 }),
5374 Schema.Null,
5375 ]),
5376 ),
5377}).annotate({
5378 description:
5379 "Request parameters for loading an existing session.\n\nOnly available if the Agent supports the `loadSession` capability.\n\nSee protocol docs: [Loading Sessions](https://agentclientprotocol.com/protocol/session-setup#loading-sessions)",
5380 identifier: "LoadSessionRequest",
5381});
5382
5383export type ForkSessionRequest = {
5384 readonly sessionId: SessionId;
5385 readonly cwd: string;
5386 readonly additionalDirectories?: ReadonlyArray<string>;
5387 readonly mcpServers?: ReadonlyArray<McpServer>;
5388 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5389};
5390export const ForkSessionRequest = Schema.Struct({
5391 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
5392 description: "The ID of the session to fork.",
5393 }),
5394 cwd: Schema.String.annotate({
5395 description: "The working directory for this session. Must be an absolute path.",
5396 }),
5397 additionalDirectories: Schema.optionalKey(
5398 Schema.Array(Schema.String).annotate({
5399 description:
5400 "Additional workspace roots to activate for this session. Each path must be absolute.\n\nWhen omitted or empty, no additional roots are activated. When non-empty,\nthis is the complete resulting additional-root list for the forked\nsession.",
5401 }),
5402 ),
5403 mcpServers: Schema.optionalKey(
5404 Schema.Array(McpServer).annotate({
5405 description: "List of MCP servers to connect to for this session.",
5406 }),
5407 ),
5408 _meta: Schema.optionalKey(
5409 Schema.Union([
5410 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5411 description:
5412 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5413 }),
5414 Schema.Null,
5415 ]),
5416 ),
5417}).annotate({
5418 description:
5419 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for forking an existing session.\n\nCreates a new session based on the context of an existing one, allowing\noperations like generating summaries without affecting the original session's history.\n\nOnly available if the Agent supports the `session.fork` capability.",
5420 identifier: "ForkSessionRequest",
5421});
5422
5423export type ResumeSessionRequest = {
5424 readonly sessionId: SessionId;
5425 readonly cwd: string;
5426 readonly additionalDirectories?: ReadonlyArray<string>;
5427 readonly mcpServers?: ReadonlyArray<McpServer>;
5428 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5429};
5430export const ResumeSessionRequest = Schema.Struct({
5431 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
5432 description: "The ID of the session to resume.",
5433 }),
5434 cwd: Schema.String.annotate({
5435 description: "The working directory for this session. Must be an absolute path.",
5436 }),
5437 additionalDirectories: Schema.optionalKey(
5438 Schema.Array(Schema.String).annotate({
5439 description:
5440 "Additional workspace roots to activate for this session. Each path must be absolute.\n\nWhen omitted or empty, no additional roots are activated. When non-empty,\nthis is the complete resulting additional-root list for the resumed\nsession. It may differ from any previously used or reported list as long as\nthe request `cwd` matches the session's `cwd`.",
5441 }),
5442 ),
5443 mcpServers: Schema.optionalKey(
5444 Schema.Array(McpServer).annotate({
5445 description: "List of MCP servers to connect to for this session.",
5446 }),
5447 ),
5448 _meta: Schema.optionalKey(
5449 Schema.Union([
5450 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5451 description:
5452 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5453 }),
5454 Schema.Null,
5455 ]),
5456 ),
5457}).annotate({
5458 description:
5459 "Request parameters for resuming an existing session.\n\nResumes an existing session without returning previous messages (unlike `session/load`).\nThis is useful for agents that can resume sessions but don't implement full session loading.\n\nOnly available if the Agent supports the `sessionCapabilities.resume` capability.",
5460 identifier: "ResumeSessionRequest",
5461});
5462
5463export type ElicitationSchema = {
5464 readonly type?: ElicitationSchemaType;
5465 readonly title?: string | null;
5466 readonly properties?: { readonly [x: string]: ElicitationPropertySchema };
5467 readonly required?: ReadonlyArray<string> | null;
5468 readonly description?: string | null;
5469 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5470};
5471export const ElicitationSchema = Schema.Struct({
5472 type: Schema.optionalKey(
5473 Schema.suspend((): Schema.Codec<ElicitationSchemaType> => ElicitationSchemaType).annotate({
5474 description: 'Type discriminator. Always `"object"`.',
5475 default: "object",
5476 }),
5477 ),
5478 title: Schema.optionalKey(
5479 Schema.Union([
5480 Schema.String.annotate({
5481 description:
5482 "Optional title for the schema.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.",
5483 }),
5484 Schema.Null,
5485 ]),
5486 ),
5487 properties: Schema.optionalKey(
5488 Schema.Record(Schema.String, ElicitationPropertySchema).annotate({
5489 description: "Property definitions (must be primitive types).",
5490 default: {},
5491 }),
5492 ),
5493 required: Schema.optionalKey(
5494 Schema.Union([
5495 Schema.Array(Schema.String).annotate({
5496 description:
5497 "List of required property names.\n\nOptional. Omitted and `null` are equivalent and mean no property names are required.",
5498 }),
5499 Schema.Null,
5500 ]),
5501 ),
5502 description: Schema.optionalKey(
5503 Schema.Union([
5504 Schema.String.annotate({
5505 description:
5506 "Optional description of what this schema represents.\n\nOptional. Omitted and `null` are equivalent and mean no schema description is provided.",
5507 }),
5508 Schema.Null,
5509 ]),
5510 ),
5511 _meta: Schema.optionalKey(
5512 Schema.Union([
5513 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5514 description:
5515 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5516 }),
5517 Schema.Null,
5518 ]),
5519 ),
5520}).annotate({
5521 description:
5522 "Type-safe elicitation schema for requesting structured user input.\n\nThis represents a JSON Schema object with primitive-typed properties,\nas required by the elicitation specification.",
5523 identifier: "ElicitationSchema",
5524});
5525
5526export type ListProvidersResponse = {
5527 readonly providers: ReadonlyArray<ProviderInfo>;
5528 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5529};
5530export const ListProvidersResponse = Schema.Struct({
5531 providers: Schema.Array(ProviderInfo).annotate({
5532 description: "Configurable providers with current routing info suitable for UI display.",
5533 }),
5534 _meta: Schema.optionalKey(
5535 Schema.Union([
5536 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5537 description:
5538 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5539 }),
5540 Schema.Null,
5541 ]),
5542 ),
5543}).annotate({
5544 description:
5545 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse to `providers/list`.",
5546 identifier: "ListProvidersResponse",
5547});
5548
5549export type NesSuggestion =
5550 | {
5551 readonly kind: "edit";
5552 readonly id: NesSuggestionId;
5553 readonly uri: string;
5554 readonly edits: ReadonlyArray<NesTextEdit>;
5555 readonly cursorPosition?: Position | null;
5556 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5557 }
5558 | {
5559 readonly kind: "jump";
5560 readonly id: NesSuggestionId;
5561 readonly uri: string;
5562 readonly position: Position;
5563 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5564 }
5565 | {
5566 readonly kind: "rename";
5567 readonly id: NesSuggestionId;
5568 readonly uri: string;
5569 readonly position: Position;
5570 readonly newName: string;
5571 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5572 }
5573 | {
5574 readonly kind: "searchAndReplace";
5575 readonly id: NesSuggestionId;
5576 readonly uri: string;
5577 readonly search: string;
5578 readonly replace: string;
5579 readonly isRegex?: boolean | null;
5580 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5581 };
5582export const NesSuggestion = Schema.Union([
5583 Schema.Struct({
5584 kind: Schema.Literal("edit"),
5585 id: Schema.suspend((): Schema.Codec<NesSuggestionId> => NesSuggestionId).annotate({
5586 description: "Unique identifier for accept/reject tracking.",
5587 }),
5588 uri: Schema.String.annotate({ description: "The URI of the file to edit." }),
5589 edits: Schema.Array(NesTextEdit).annotate({ description: "The text edits to apply." }),
5590 cursorPosition: Schema.optionalKey(
5591 Schema.Union([Position, Schema.Null]).annotate({
5592 description: "Optional suggested cursor position after applying edits.",
5593 }),
5594 ),
5595 _meta: Schema.optionalKey(
5596 Schema.Union([
5597 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5598 description:
5599 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5600 }),
5601 Schema.Null,
5602 ]),
5603 ),
5604 }).annotate({ description: "A text edit suggestion." }),
5605 Schema.Struct({
5606 kind: Schema.Literal("jump"),
5607 id: Schema.suspend((): Schema.Codec<NesSuggestionId> => NesSuggestionId).annotate({
5608 description: "Unique identifier for accept/reject tracking.",
5609 }),
5610 uri: Schema.String.annotate({ description: "The file to navigate to." }),
5611 position: Schema.suspend((): Schema.Codec<Position> => Position).annotate({
5612 description: "The target position within the file.",
5613 }),
5614 _meta: Schema.optionalKey(
5615 Schema.Union([
5616 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5617 description:
5618 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5619 }),
5620 Schema.Null,
5621 ]),
5622 ),
5623 }).annotate({ description: "A jump-to-location suggestion." }),
5624 Schema.Struct({
5625 kind: Schema.Literal("rename"),
5626 id: Schema.suspend((): Schema.Codec<NesSuggestionId> => NesSuggestionId).annotate({
5627 description: "Unique identifier for accept/reject tracking.",
5628 }),
5629 uri: Schema.String.annotate({ description: "The file URI containing the symbol." }),
5630 position: Schema.suspend((): Schema.Codec<Position> => Position).annotate({
5631 description: "The position of the symbol to rename.",
5632 }),
5633 newName: Schema.String.annotate({ description: "The new name for the symbol." }),
5634 _meta: Schema.optionalKey(
5635 Schema.Union([
5636 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5637 description:
5638 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5639 }),
5640 Schema.Null,
5641 ]),
5642 ),
5643 }).annotate({ description: "A rename symbol suggestion." }),
5644 Schema.Struct({
5645 kind: Schema.Literal("searchAndReplace"),
5646 id: Schema.suspend((): Schema.Codec<NesSuggestionId> => NesSuggestionId).annotate({
5647 description: "Unique identifier for accept/reject tracking.",
5648 }),
5649 uri: Schema.String.annotate({ description: "The file URI to search within." }),
5650 search: Schema.String.annotate({ description: "The text or pattern to find." }),
5651 replace: Schema.String.annotate({ description: "The replacement text." }),
5652 isRegex: Schema.optionalKey(
5653 Schema.Union([
5654 Schema.Boolean.annotate({
5655 description: "Whether `search` is a regular expression. Defaults to `false`.",
5656 }),
5657 Schema.Null,
5658 ]),
5659 ),
5660 _meta: Schema.optionalKey(
5661 Schema.Union([
5662 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5663 description:
5664 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5665 }),
5666 Schema.Null,
5667 ]),
5668 ),
5669 }).annotate({ description: "A search-and-replace suggestion." }),
5670]).annotate({ description: "A suggestion returned by the agent.", identifier: "NesSuggestion" });
5671
5672export type DidChangeDocumentNotification = {
5673 readonly sessionId: SessionId;
5674 readonly uri: string;
5675 readonly version: number;
5676 readonly contentChanges: ReadonlyArray<TextDocumentContentChangeEvent>;
5677 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5678};
5679export const DidChangeDocumentNotification = Schema.Struct({
5680 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
5681 description: "The session ID for this notification.",
5682 }),
5683 uri: Schema.String.annotate({ description: "The URI of the changed document." }),
5684 version: Schema.Number.annotate({
5685 description: "The new version number of the document.",
5686 format: "int64",
5687 }).check(Schema.isInt().annotate({ expected: "an integer" })),
5688 contentChanges: Schema.Array(TextDocumentContentChangeEvent).annotate({
5689 description: "The content changes.",
5690 }),
5691 _meta: Schema.optionalKey(
5692 Schema.Union([
5693 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5694 description:
5695 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5696 }),
5697 Schema.Null,
5698 ]),
5699 ),
5700}).annotate({
5701 description: "Notification sent when a file is edited.",
5702 identifier: "DidChangeDocumentNotification",
5703});
5704
5705export type NesSuggestContext = {
5706 readonly recentFiles?: ReadonlyArray<NesRecentFile> | null;
5707 readonly relatedSnippets?: ReadonlyArray<NesRelatedSnippet> | null;
5708 readonly editHistory?: ReadonlyArray<NesEditHistoryEntry> | null;
5709 readonly userActions?: ReadonlyArray<NesUserAction> | null;
5710 readonly openFiles?: ReadonlyArray<NesOpenFile> | null;
5711 readonly diagnostics?: ReadonlyArray<NesDiagnostic> | null;
5712 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5713};
5714export const NesSuggestContext = Schema.Struct({
5715 recentFiles: Schema.optionalKey(
5716 Schema.Union([
5717 Schema.Array(NesRecentFile).annotate({ description: "Recently accessed files." }),
5718 Schema.Null,
5719 ]),
5720 ),
5721 relatedSnippets: Schema.optionalKey(
5722 Schema.Union([
5723 Schema.Array(NesRelatedSnippet).annotate({ description: "Related code snippets." }),
5724 Schema.Null,
5725 ]),
5726 ),
5727 editHistory: Schema.optionalKey(
5728 Schema.Union([
5729 Schema.Array(NesEditHistoryEntry).annotate({ description: "Recent edit history." }),
5730 Schema.Null,
5731 ]),
5732 ),
5733 userActions: Schema.optionalKey(
5734 Schema.Union([
5735 Schema.Array(NesUserAction).annotate({
5736 description: "Recent user actions (typing, navigation, etc.).",
5737 }),
5738 Schema.Null,
5739 ]),
5740 ),
5741 openFiles: Schema.optionalKey(
5742 Schema.Union([
5743 Schema.Array(NesOpenFile).annotate({ description: "Currently open files in the editor." }),
5744 Schema.Null,
5745 ]),
5746 ),
5747 diagnostics: Schema.optionalKey(
5748 Schema.Union([
5749 Schema.Array(NesDiagnostic).annotate({
5750 description: "Current diagnostics (errors, warnings).",
5751 }),
5752 Schema.Null,
5753 ]),
5754 ),
5755 _meta: Schema.optionalKey(
5756 Schema.Union([
5757 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5758 description:
5759 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5760 }),
5761 Schema.Null,
5762 ]),
5763 ),
5764}).annotate({
5765 description: "Context attached to a suggestion request.",
5766 identifier: "NesSuggestContext",
5767});
5768
5769export type ClientCapabilities = {
5770 readonly fs?: FileSystemCapabilities;
5771 readonly terminal?: boolean;
5772 readonly session?: ClientSessionCapabilities | null;
5773 readonly plan?: PlanCapabilities | null;
5774 readonly auth?: AuthCapabilities;
5775 readonly elicitation?: ElicitationCapabilities | null;
5776 readonly nes?: ClientNesCapabilities | null;
5777 readonly positionEncodings?: ReadonlyArray<PositionEncodingKind>;
5778 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5779};
5780export const ClientCapabilities = Schema.Struct({
5781 fs: Schema.optionalKey(
5782 Schema.suspend((): Schema.Codec<FileSystemCapabilities> => FileSystemCapabilities).annotate({
5783 description:
5784 "File system capabilities supported by the client.\nDetermines which file operations the agent can request.",
5785 default: { readTextFile: false, writeTextFile: false },
5786 }),
5787 ),
5788 terminal: Schema.optionalKey(
5789 Schema.Boolean.annotate({
5790 description: "Whether the Client support all `terminal/*` methods.",
5791 default: false,
5792 }),
5793 ),
5794 session: Schema.optionalKey(
5795 Schema.Union([ClientSessionCapabilities, Schema.Null]).annotate({
5796 description:
5797 "Session-related capabilities supported by the client.\n\nOptional. Omitted or `null` both mean the client does not advertise any\nsession-related extensions.",
5798 }),
5799 ),
5800 plan: Schema.optionalKey(
5801 Schema.Union([PlanCapabilities, Schema.Null]).annotate({
5802 description:
5803 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the client supports `plan_update` and `plan_removed` session updates.\n\nOptional. Omitted or `null` both mean the client does not advertise support.\nSupplying `{}` means the client can receive both update types.",
5804 }),
5805 ),
5806 auth: Schema.optionalKey(
5807 Schema.suspend((): Schema.Codec<AuthCapabilities> => AuthCapabilities).annotate({
5808 description:
5809 "Authentication capabilities supported by the client.\nDetermines which authentication method types the agent may include\nin its `InitializeResponse`.",
5810 default: { terminal: false },
5811 }),
5812 ),
5813 elicitation: Schema.optionalKey(
5814 Schema.Union([ElicitationCapabilities, Schema.Null]).annotate({
5815 description:
5816 "Elicitation capabilities supported by the client.\nDetermines which elicitation modes the agent may use.\n\nOptional. Omitted or `null` both mean the client does not advertise\nelicitation support.",
5817 }),
5818 ),
5819 nes: Schema.optionalKey(
5820 Schema.Union([ClientNesCapabilities, Schema.Null]).annotate({
5821 description:
5822 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nNES (Next Edit Suggestions) capabilities supported by the client.\n\nOptional. Omitted or `null` both mean the client does not advertise any\nNES suggestion-kind extensions.",
5823 }),
5824 ),
5825 positionEncodings: Schema.optionalKey(
5826 Schema.Array(PositionEncodingKind).annotate({
5827 description:
5828 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nThe position encodings supported by the client, in order of preference.",
5829 }),
5830 ),
5831 _meta: Schema.optionalKey(
5832 Schema.Union([
5833 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5834 description:
5835 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5836 }),
5837 Schema.Null,
5838 ]),
5839 ),
5840}).annotate({
5841 description:
5842 "Capabilities supported by the client.\n\nAdvertised during initialization to inform the agent about\navailable features and methods.\n\nSee protocol docs: [Client Capabilities](https://agentclientprotocol.com/protocol/initialization#client-capabilities)",
5843 identifier: "ClientCapabilities",
5844});
5845
5846export type NesCapabilities = {
5847 readonly events?: NesEventCapabilities | null;
5848 readonly context?: NesContextCapabilities | null;
5849 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5850};
5851export const NesCapabilities = Schema.Struct({
5852 events: Schema.optionalKey(
5853 Schema.Union([NesEventCapabilities, Schema.Null]).annotate({
5854 description: "Events the agent wants to receive.",
5855 }),
5856 ),
5857 context: Schema.optionalKey(
5858 Schema.Union([NesContextCapabilities, Schema.Null]).annotate({
5859 description: "Context the agent wants attached to each suggestion request.",
5860 }),
5861 ),
5862 _meta: Schema.optionalKey(
5863 Schema.Union([
5864 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5865 description:
5866 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5867 }),
5868 Schema.Null,
5869 ]),
5870 ),
5871}).annotate({
5872 description: "NES capabilities advertised by the agent during initialization.",
5873 identifier: "NesCapabilities",
5874});
5875
5876export type ToolCallUpdate = {
5877 readonly toolCallId: ToolCallId;
5878 readonly kind?: ToolKind | null;
5879 readonly status?: ToolCallStatus | null;
5880 readonly title?: string | null;
5881 readonly name?: string | null;
5882 readonly content?: ReadonlyArray<ToolCallContent> | null;
5883 readonly locations?: ReadonlyArray<ToolCallLocation> | null;
5884 readonly rawInput?: Schema.Json;
5885 readonly rawOutput?: Schema.Json;
5886 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5887};
5888export const ToolCallUpdate = Schema.Struct({
5889 toolCallId: Schema.suspend((): Schema.Codec<ToolCallId> => ToolCallId).annotate({
5890 description: "The ID of the tool call being updated.",
5891 }),
5892 kind: Schema.optionalKey(
5893 Schema.Union([ToolKind, Schema.Null]).annotate({ description: "Update the tool kind." }),
5894 ),
5895 status: Schema.optionalKey(
5896 Schema.Union([ToolCallStatus, Schema.Null]).annotate({
5897 description: "Update the execution status.",
5898 }),
5899 ),
5900 title: Schema.optionalKey(
5901 Schema.Union([
5902 Schema.String.annotate({ description: "Update the human-readable title." }),
5903 Schema.Null,
5904 ]),
5905 ),
5906 name: Schema.optionalKey(
5907 Schema.Union([
5908 Schema.String.annotate({
5909 description:
5910 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nUpdate the programmatic name of the tool being invoked.\n\nThis field is optional. Omitting it or sending `null` both mean that\nthe existing name is left unchanged.",
5911 }),
5912 Schema.Null,
5913 ]),
5914 ),
5915 content: Schema.optionalKey(
5916 Schema.Union([
5917 Schema.Array(ToolCallContent).annotate({ description: "Replace the content collection." }),
5918 Schema.Null,
5919 ]),
5920 ),
5921 locations: Schema.optionalKey(
5922 Schema.Union([
5923 Schema.Array(ToolCallLocation).annotate({ description: "Replace the locations collection." }),
5924 Schema.Null,
5925 ]),
5926 ),
5927 rawInput: Schema.optionalKey(
5928 Schema.Json.annotate({ expected: "JSON value", description: "Update the raw input." }),
5929 ),
5930 rawOutput: Schema.optionalKey(
5931 Schema.Json.annotate({ expected: "JSON value", description: "Update the raw output." }),
5932 ),
5933 _meta: Schema.optionalKey(
5934 Schema.Union([
5935 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5936 description:
5937 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5938 }),
5939 Schema.Null,
5940 ]),
5941 ),
5942}).annotate({
5943 description:
5944 "An update to an existing tool call.\n\nUsed to report progress and results as tools execute. All fields except\nthe tool call ID are optional - only changed fields need to be included.\n\nSee protocol docs: [Updating](https://agentclientprotocol.com/protocol/tool-calls#updating)",
5945 identifier: "ToolCallUpdate",
5946});
5947
5948export type SessionConfigOption =
5949 | {
5950 readonly id: SessionConfigId;
5951 readonly name: string;
5952 readonly description?: string | null;
5953 readonly category?: SessionConfigOptionCategory | null;
5954 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5955 readonly type: "select";
5956 readonly currentValue: SessionConfigValueId;
5957 readonly options: SessionConfigSelectOptions;
5958 }
5959 | {
5960 readonly id: SessionConfigId;
5961 readonly name: string;
5962 readonly description?: string | null;
5963 readonly category?: SessionConfigOptionCategory | null;
5964 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
5965 readonly type: "boolean";
5966 readonly currentValue: boolean;
5967 };
5968export const SessionConfigOption = Schema.Union([
5969 Schema.Struct({
5970 id: Schema.suspend((): Schema.Codec<SessionConfigId> => SessionConfigId).annotate({
5971 description: "Unique identifier for the configuration option.",
5972 }),
5973 name: Schema.String.annotate({ description: "Human-readable label for the option." }),
5974 description: Schema.optionalKey(
5975 Schema.Union([
5976 Schema.String.annotate({
5977 description: "Optional description for the Client to display to the user.",
5978 }),
5979 Schema.Null,
5980 ]),
5981 ),
5982 category: Schema.optionalKey(
5983 Schema.Union([SessionConfigOptionCategory, Schema.Null]).annotate({
5984 description: "Optional semantic category for this option (UX only).",
5985 }),
5986 ),
5987 _meta: Schema.optionalKey(
5988 Schema.Union([
5989 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
5990 description:
5991 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
5992 }),
5993 Schema.Null,
5994 ]),
5995 ),
5996 type: Schema.Literal("select"),
5997 currentValue: Schema.suspend(
5998 (): Schema.Codec<SessionConfigValueId> => SessionConfigValueId,
5999 ).annotate({ description: "The currently selected value." }),
6000 options: Schema.suspend(
6001 (): Schema.Codec<SessionConfigSelectOptions> => SessionConfigSelectOptions,
6002 ).annotate({ description: "The set of selectable options." }),
6003 }).annotate({
6004 description: "A single-value selector (dropdown) session configuration option payload.",
6005 }),
6006 Schema.Struct({
6007 id: Schema.suspend((): Schema.Codec<SessionConfigId> => SessionConfigId).annotate({
6008 description: "Unique identifier for the configuration option.",
6009 }),
6010 name: Schema.String.annotate({ description: "Human-readable label for the option." }),
6011 description: Schema.optionalKey(
6012 Schema.Union([
6013 Schema.String.annotate({
6014 description: "Optional description for the Client to display to the user.",
6015 }),
6016 Schema.Null,
6017 ]),
6018 ),
6019 category: Schema.optionalKey(
6020 Schema.Union([SessionConfigOptionCategory, Schema.Null]).annotate({
6021 description: "Optional semantic category for this option (UX only).",
6022 }),
6023 ),
6024 _meta: Schema.optionalKey(
6025 Schema.Union([
6026 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6027 description:
6028 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6029 }),
6030 Schema.Null,
6031 ]),
6032 ),
6033 type: Schema.Literal("boolean"),
6034 currentValue: Schema.Boolean.annotate({
6035 description: "The current value of the boolean option.",
6036 }),
6037 }).annotate({ description: "A boolean on/off toggle session configuration option payload." }),
6038]).annotate({ identifier: "SessionConfigOption" });
6039
6040export type CreateElicitationRequest =
6041 | {
6042 readonly message: string;
6043 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6044 readonly mode: "form";
6045 readonly requestedSchema: ElicitationSchema;
6046 readonly sessionId: SessionId;
6047 readonly toolCallId?: ToolCallId | null;
6048 }
6049 | {
6050 readonly message: string;
6051 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6052 readonly mode: "form";
6053 readonly requestedSchema: ElicitationSchema;
6054 readonly requestId: RequestId;
6055 }
6056 | {
6057 readonly message: string;
6058 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6059 readonly mode: "url";
6060 readonly elicitationId: ElicitationId;
6061 readonly url: string;
6062 readonly sessionId: SessionId;
6063 readonly toolCallId?: ToolCallId | null;
6064 }
6065 | {
6066 readonly message: string;
6067 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6068 readonly mode: "url";
6069 readonly elicitationId: ElicitationId;
6070 readonly url: string;
6071 readonly requestId: RequestId;
6072 }
6073 | ({
6074 readonly message: string;
6075 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6076 readonly mode: string;
6077 readonly sessionId: SessionId;
6078 readonly toolCallId?: ToolCallId | null;
6079 } & { readonly [x: string]: Schema.Json })
6080 | ({
6081 readonly message: string;
6082 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6083 readonly mode: string;
6084 readonly requestId: RequestId;
6085 } & { readonly [x: string]: Schema.Json });
6086export const CreateElicitationRequest = Schema.Union([
6087 Schema.Union([
6088 Schema.Struct({
6089 message: Schema.String.annotate({
6090 description: "A human-readable message describing what input is needed.",
6091 }),
6092 _meta: Schema.optionalKey(
6093 Schema.Union([
6094 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6095 description:
6096 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6097 }),
6098 Schema.Null,
6099 ]),
6100 ),
6101 mode: Schema.Literal("form"),
6102 requestedSchema: Schema.suspend(
6103 (): Schema.Codec<ElicitationSchema> => ElicitationSchema,
6104 ).annotate({
6105 description: "A JSON Schema describing the form fields to present to the user.",
6106 }),
6107 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
6108 description: "The session this elicitation is tied to.",
6109 }),
6110 toolCallId: Schema.optionalKey(
6111 Schema.Union([ToolCallId, Schema.Null]).annotate({
6112 description:
6113 "Optional tool call within the session.\n\nOptional. Omitted and `null` are equivalent and mean the elicitation is scoped to the\nsession without a specific tool call.",
6114 }),
6115 ),
6116 }).annotate({
6117 description:
6118 "Session-scoped elicitation, optionally tied to a specific tool call.\n\nWhen `tool_call_id` is set, the elicitation is tied to a specific tool call.\nThis is useful when an agent receives an elicitation from an MCP server\nduring a tool call and needs to redirect it to the user.",
6119 }),
6120 Schema.Struct({
6121 message: Schema.String.annotate({
6122 description: "A human-readable message describing what input is needed.",
6123 }),
6124 _meta: Schema.optionalKey(
6125 Schema.Union([
6126 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6127 description:
6128 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6129 }),
6130 Schema.Null,
6131 ]),
6132 ),
6133 mode: Schema.Literal("form"),
6134 requestedSchema: Schema.suspend(
6135 (): Schema.Codec<ElicitationSchema> => ElicitationSchema,
6136 ).annotate({
6137 description: "A JSON Schema describing the form fields to present to the user.",
6138 }),
6139 requestId: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({
6140 description: "The request this elicitation is tied to.",
6141 }),
6142 }).annotate({
6143 description:
6144 "Request-scoped elicitation, tied to a specific JSON-RPC request outside of a session\n(e.g., during auth/configuration phases before any session is started).",
6145 }),
6146 ]),
6147 Schema.Union([
6148 Schema.Struct({
6149 message: Schema.String.annotate({
6150 description: "A human-readable message describing what input is needed.",
6151 }),
6152 _meta: Schema.optionalKey(
6153 Schema.Union([
6154 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6155 description:
6156 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6157 }),
6158 Schema.Null,
6159 ]),
6160 ),
6161 mode: Schema.Literal("url"),
6162 elicitationId: Schema.suspend((): Schema.Codec<ElicitationId> => ElicitationId).annotate({
6163 description: "The unique identifier for this elicitation.",
6164 }),
6165 url: Schema.String.annotate({ description: "The URL to direct the user to.", format: "uri" }),
6166 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
6167 description: "The session this elicitation is tied to.",
6168 }),
6169 toolCallId: Schema.optionalKey(
6170 Schema.Union([ToolCallId, Schema.Null]).annotate({
6171 description:
6172 "Optional tool call within the session.\n\nOptional. Omitted and `null` are equivalent and mean the elicitation is scoped to the\nsession without a specific tool call.",
6173 }),
6174 ),
6175 }).annotate({
6176 description:
6177 "Session-scoped elicitation, optionally tied to a specific tool call.\n\nWhen `tool_call_id` is set, the elicitation is tied to a specific tool call.\nThis is useful when an agent receives an elicitation from an MCP server\nduring a tool call and needs to redirect it to the user.",
6178 }),
6179 Schema.Struct({
6180 message: Schema.String.annotate({
6181 description: "A human-readable message describing what input is needed.",
6182 }),
6183 _meta: Schema.optionalKey(
6184 Schema.Union([
6185 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6186 description:
6187 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6188 }),
6189 Schema.Null,
6190 ]),
6191 ),
6192 mode: Schema.Literal("url"),
6193 elicitationId: Schema.suspend((): Schema.Codec<ElicitationId> => ElicitationId).annotate({
6194 description: "The unique identifier for this elicitation.",
6195 }),
6196 url: Schema.String.annotate({ description: "The URL to direct the user to.", format: "uri" }),
6197 requestId: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({
6198 description: "The request this elicitation is tied to.",
6199 }),
6200 }).annotate({
6201 description:
6202 "Request-scoped elicitation, tied to a specific JSON-RPC request outside of a session\n(e.g., during auth/configuration phases before any session is started).",
6203 }),
6204 ]),
6205 Schema.Union([
6206 Schema.StructWithRest(
6207 Schema.Struct({
6208 message: Schema.String.annotate({
6209 description: "A human-readable message describing what input is needed.",
6210 }),
6211 _meta: Schema.optionalKey(
6212 Schema.Union([
6213 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate(
6214 {
6215 description:
6216 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6217 },
6218 ),
6219 Schema.Null,
6220 ]),
6221 ),
6222 mode: Schema.String.annotate({
6223 description:
6224 "Custom or future elicitation mode.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.",
6225 }).check(
6226 Schema.isPattern(new RegExp("^(?!(?:\\x66orm|\\x75rl)$)[\\s\\S]*$")).annotate({
6227 expected: "a string matching the RegExp ^(?!(?:\\x66orm|\\x75rl)$)[\\s\\S]*$",
6228 }),
6229 ),
6230 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
6231 description: "The session this elicitation is tied to.",
6232 }),
6233 toolCallId: Schema.optionalKey(
6234 Schema.Union([ToolCallId, Schema.Null]).annotate({
6235 description:
6236 "Optional tool call within the session.\n\nOptional. Omitted and `null` are equivalent and mean the elicitation is scoped to the\nsession without a specific tool call.",
6237 }),
6238 ),
6239 }),
6240 [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))],
6241 ).annotate({
6242 title: "other",
6243 description:
6244 "Session-scoped elicitation, optionally tied to a specific tool call.\n\nWhen `tool_call_id` is set, the elicitation is tied to a specific tool call.\nThis is useful when an agent receives an elicitation from an MCP server\nduring a tool call and needs to redirect it to the user.",
6245 }),
6246 Schema.StructWithRest(
6247 Schema.Struct({
6248 message: Schema.String.annotate({
6249 description: "A human-readable message describing what input is needed.",
6250 }),
6251 _meta: Schema.optionalKey(
6252 Schema.Union([
6253 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate(
6254 {
6255 description:
6256 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6257 },
6258 ),
6259 Schema.Null,
6260 ]),
6261 ),
6262 mode: Schema.String.annotate({
6263 description:
6264 "Custom or future elicitation mode.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.",
6265 }).check(
6266 Schema.isPattern(new RegExp("^(?!(?:\\x66orm|\\x75rl)$)[\\s\\S]*$")).annotate({
6267 expected: "a string matching the RegExp ^(?!(?:\\x66orm|\\x75rl)$)[\\s\\S]*$",
6268 }),
6269 ),
6270 requestId: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({
6271 description: "The request this elicitation is tied to.",
6272 }),
6273 }),
6274 [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))],
6275 ).annotate({
6276 title: "other",
6277 description:
6278 "Request-scoped elicitation, tied to a specific JSON-RPC request outside of a session\n(e.g., during auth/configuration phases before any session is started).",
6279 }),
6280 ]),
6281]).annotate({ identifier: "CreateElicitationRequest" });
6282
6283export type SuggestNesResponse = {
6284 readonly suggestions: ReadonlyArray<NesSuggestion>;
6285 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6286};
6287export const SuggestNesResponse = Schema.Struct({
6288 suggestions: Schema.Array(NesSuggestion).annotate({ description: "The list of suggestions." }),
6289 _meta: Schema.optionalKey(
6290 Schema.Union([
6291 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6292 description:
6293 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6294 }),
6295 Schema.Null,
6296 ]),
6297 ),
6298}).annotate({ description: "Response to `nes/suggest`.", identifier: "SuggestNesResponse" });
6299
6300export type SuggestNesRequest = {
6301 readonly sessionId: SessionId;
6302 readonly uri: string;
6303 readonly version: number;
6304 readonly position: Position;
6305 readonly selection?: Range | null;
6306 readonly triggerKind: NesTriggerKind;
6307 readonly context?: NesSuggestContext | null;
6308 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6309};
6310export const SuggestNesRequest = Schema.Struct({
6311 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
6312 description: "The session ID for this request.",
6313 }),
6314 uri: Schema.String.annotate({ description: "The URI of the document to suggest for." }),
6315 version: Schema.Number.annotate({
6316 description: "The version number of the document.",
6317 format: "int64",
6318 }).check(Schema.isInt().annotate({ expected: "an integer" })),
6319 position: Schema.suspend((): Schema.Codec<Position> => Position).annotate({
6320 description: "The current cursor position.",
6321 }),
6322 selection: Schema.optionalKey(
6323 Schema.Union([Range, Schema.Null]).annotate({
6324 description: "The current text selection range, if any.",
6325 }),
6326 ),
6327 triggerKind: Schema.suspend((): Schema.Codec<NesTriggerKind> => NesTriggerKind).annotate({
6328 description: "What triggered this suggestion request.",
6329 }),
6330 context: Schema.optionalKey(
6331 Schema.Union([NesSuggestContext, Schema.Null]).annotate({
6332 description: "Context for the suggestion, included based on agent capabilities.",
6333 }),
6334 ),
6335 _meta: Schema.optionalKey(
6336 Schema.Union([
6337 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6338 description:
6339 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6340 }),
6341 Schema.Null,
6342 ]),
6343 ),
6344}).annotate({ description: "Request for a code suggestion.", identifier: "SuggestNesRequest" });
6345
6346export type InitializeRequest = {
6347 readonly protocolVersion: ProtocolVersion;
6348 readonly clientCapabilities?: ClientCapabilities;
6349 readonly clientInfo?: Implementation | null;
6350 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6351};
6352export const InitializeRequest = Schema.Struct({
6353 protocolVersion: Schema.suspend((): Schema.Codec<ProtocolVersion> => ProtocolVersion).annotate({
6354 description: "The latest protocol version supported by the client.",
6355 }),
6356 clientCapabilities: Schema.optionalKey(
6357 Schema.suspend((): Schema.Codec<ClientCapabilities> => ClientCapabilities).annotate({
6358 description: "Capabilities supported by the client.",
6359 default: {
6360 fs: { readTextFile: false, writeTextFile: false },
6361 terminal: false,
6362 auth: { terminal: false },
6363 },
6364 }),
6365 ),
6366 clientInfo: Schema.optionalKey(
6367 Schema.Union([Implementation, Schema.Null]).annotate({
6368 description:
6369 "Information about the Client name and version sent to the Agent.\n\nNote: in future versions of the protocol, this will be required.",
6370 }),
6371 ),
6372 _meta: Schema.optionalKey(
6373 Schema.Union([
6374 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6375 description:
6376 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6377 }),
6378 Schema.Null,
6379 ]),
6380 ),
6381}).annotate({
6382 description:
6383 "Request parameters for the initialize method.\n\nSent by the client to establish connection and negotiate capabilities.\n\nSee protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)",
6384 identifier: "InitializeRequest",
6385});
6386
6387export type AgentCapabilities = {
6388 readonly loadSession?: boolean;
6389 readonly promptCapabilities?: PromptCapabilities;
6390 readonly mcpCapabilities?: McpCapabilities;
6391 readonly sessionCapabilities?: SessionCapabilities;
6392 readonly auth?: AgentAuthCapabilities;
6393 readonly providers?: ProvidersCapabilities | null;
6394 readonly nes?: NesCapabilities | null;
6395 readonly positionEncoding?: PositionEncodingKind | null;
6396 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6397};
6398export const AgentCapabilities = Schema.Struct({
6399 loadSession: Schema.optionalKey(
6400 Schema.Boolean.annotate({
6401 description: "Whether the agent supports `session/load`.",
6402 default: false,
6403 }),
6404 ),
6405 promptCapabilities: Schema.optionalKey(
6406 Schema.suspend((): Schema.Codec<PromptCapabilities> => PromptCapabilities).annotate({
6407 description: "Prompt capabilities supported by the agent.",
6408 default: { image: false, audio: false, embeddedContext: false },
6409 }),
6410 ),
6411 mcpCapabilities: Schema.optionalKey(
6412 Schema.suspend((): Schema.Codec<McpCapabilities> => McpCapabilities).annotate({
6413 description: "MCP capabilities supported by the agent.",
6414 default: { http: false, sse: false, acp: false },
6415 }),
6416 ),
6417 sessionCapabilities: Schema.optionalKey(
6418 Schema.suspend((): Schema.Codec<SessionCapabilities> => SessionCapabilities).annotate({
6419 description: "Session lifecycle and prompt capabilities advertised by the agent.",
6420 default: {},
6421 }),
6422 ),
6423 auth: Schema.optionalKey(
6424 Schema.suspend((): Schema.Codec<AgentAuthCapabilities> => AgentAuthCapabilities).annotate({
6425 description: "Authentication-related capabilities supported by the agent.",
6426 default: {},
6427 }),
6428 ),
6429 providers: Schema.optionalKey(
6430 Schema.Union([ProvidersCapabilities, Schema.Null]).annotate({
6431 description:
6432 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nProvider configuration capabilities supported by the agent.\n\nOptional. Omitted or `null` both mean the agent does not advertise support.\nSupplying `{}` means the agent supports provider configuration methods.",
6433 }),
6434 ),
6435 nes: Schema.optionalKey(
6436 Schema.Union([NesCapabilities, Schema.Null]).annotate({
6437 description:
6438 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nNES (Next Edit Suggestions) capabilities supported by the agent.\n\nOptional. Omitted or `null` both mean the agent does not advertise support\nfor NES methods.",
6439 }),
6440 ),
6441 positionEncoding: Schema.optionalKey(
6442 Schema.Union([PositionEncodingKind, Schema.Null]).annotate({
6443 description:
6444 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nThe position encoding selected by the agent from the client's supported encodings.",
6445 }),
6446 ),
6447 _meta: Schema.optionalKey(
6448 Schema.Union([
6449 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6450 description:
6451 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6452 }),
6453 Schema.Null,
6454 ]),
6455 ),
6456}).annotate({
6457 description:
6458 "Capabilities supported by the agent.\n\nAdvertised during initialization to inform the client about\navailable features and content types.\n\nSee protocol docs: [Agent Capabilities](https://agentclientprotocol.com/protocol/initialization#agent-capabilities)",
6459 identifier: "AgentCapabilities",
6460});
6461
6462export type RequestPermissionRequest = {
6463 readonly sessionId: SessionId;
6464 readonly toolCall: ToolCallUpdate;
6465 readonly options: ReadonlyArray<PermissionOption>;
6466 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6467};
6468export const RequestPermissionRequest = Schema.Struct({
6469 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
6470 description: "The session ID for this request.",
6471 }),
6472 toolCall: Schema.suspend((): Schema.Codec<ToolCallUpdate> => ToolCallUpdate).annotate({
6473 description: "Details about the tool call requiring permission.",
6474 }),
6475 options: Schema.Array(PermissionOption).annotate({
6476 description: "Available permission options for the user to choose from.",
6477 }),
6478 _meta: Schema.optionalKey(
6479 Schema.Union([
6480 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6481 description:
6482 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6483 }),
6484 Schema.Null,
6485 ]),
6486 ),
6487}).annotate({
6488 description:
6489 "Request for user permission to execute a tool call.\n\nSent when the agent needs authorization before performing a sensitive operation.\n\nSee protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/tool-calls#requesting-permission)",
6490 identifier: "RequestPermissionRequest",
6491});
6492
6493export type SessionUpdate =
6494 | {
6495 readonly sessionUpdate: "user_message_chunk";
6496 readonly content: ContentBlock;
6497 readonly messageId?: MessageId | null;
6498 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6499 }
6500 | {
6501 readonly sessionUpdate: "agent_message_chunk";
6502 readonly content: ContentBlock;
6503 readonly messageId?: MessageId | null;
6504 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6505 }
6506 | {
6507 readonly sessionUpdate: "agent_thought_chunk";
6508 readonly content: ContentBlock;
6509 readonly messageId?: MessageId | null;
6510 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6511 }
6512 | {
6513 readonly sessionUpdate: "tool_call";
6514 readonly toolCallId: ToolCallId;
6515 readonly title: string;
6516 readonly name?: string | null;
6517 readonly kind?: ToolKind;
6518 readonly status?: ToolCallStatus;
6519 readonly content?: ReadonlyArray<ToolCallContent>;
6520 readonly locations?: ReadonlyArray<ToolCallLocation>;
6521 readonly rawInput?: Schema.Json;
6522 readonly rawOutput?: Schema.Json;
6523 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6524 }
6525 | {
6526 readonly sessionUpdate: "tool_call_update";
6527 readonly toolCallId: ToolCallId;
6528 readonly kind?: ToolKind | null;
6529 readonly status?: ToolCallStatus | null;
6530 readonly title?: string | null;
6531 readonly name?: string | null;
6532 readonly content?: ReadonlyArray<ToolCallContent> | null;
6533 readonly locations?: ReadonlyArray<ToolCallLocation> | null;
6534 readonly rawInput?: Schema.Json;
6535 readonly rawOutput?: Schema.Json;
6536 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6537 }
6538 | {
6539 readonly sessionUpdate: "plan";
6540 readonly entries: ReadonlyArray<PlanEntry>;
6541 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6542 }
6543 | {
6544 readonly sessionUpdate: "plan_update";
6545 readonly plan: PlanUpdateContent;
6546 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6547 }
6548 | {
6549 readonly sessionUpdate: "plan_removed";
6550 readonly planId: PlanId;
6551 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6552 }
6553 | {
6554 readonly sessionUpdate: "available_commands_update";
6555 readonly availableCommands: ReadonlyArray<AvailableCommand>;
6556 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6557 }
6558 | {
6559 readonly sessionUpdate: "current_mode_update";
6560 readonly currentModeId: SessionModeId;
6561 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6562 }
6563 | {
6564 readonly sessionUpdate: "config_option_update";
6565 readonly configOptions: ReadonlyArray<SessionConfigOption>;
6566 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6567 }
6568 | {
6569 readonly sessionUpdate: "session_info_update";
6570 readonly title?: string | null;
6571 readonly updatedAt?: string | null;
6572 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6573 }
6574 | {
6575 readonly sessionUpdate: "usage_update";
6576 readonly used: number;
6577 readonly size: number;
6578 readonly cost?: Cost | null;
6579 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6580 }
6581 | {
6582 readonly sessionUpdate: "compaction_update";
6583 readonly compactionId: CompactionId;
6584 readonly status: CompactionStatus;
6585 readonly summary?: ReadonlyArray<ContentBlock> | null;
6586 readonly error?: string | null;
6587 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6588 }
6589 | {
6590 readonly sessionUpdate: "compaction_summary_chunk";
6591 readonly compactionId: CompactionId;
6592 readonly content: ContentBlock;
6593 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
6594 };
6595export const SessionUpdate = Schema.Union([
6596 Schema.Struct({
6597 sessionUpdate: Schema.Literal("user_message_chunk"),
6598 content: Schema.suspend((): Schema.Codec<ContentBlock> => ContentBlock).annotate({
6599 description: "A single item of content",
6600 }),
6601 messageId: Schema.optionalKey(
6602 Schema.Union([MessageId, Schema.Null]).annotate({
6603 description:
6604 "A unique identifier for the message this chunk belongs to.\n\nAll chunks belonging to the same message share the same `messageId`.\nA change in `messageId` indicates a new message has started.",
6605 }),
6606 ),
6607 _meta: Schema.optionalKey(
6608 Schema.Union([
6609 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6610 description:
6611 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6612 }),
6613 Schema.Null,
6614 ]),
6615 ),
6616 }).annotate({ description: "A streamed item of content" }),
6617 Schema.Struct({
6618 sessionUpdate: Schema.Literal("agent_message_chunk"),
6619 content: Schema.suspend((): Schema.Codec<ContentBlock> => ContentBlock).annotate({
6620 description: "A single item of content",
6621 }),
6622 messageId: Schema.optionalKey(
6623 Schema.Union([MessageId, Schema.Null]).annotate({
6624 description:
6625 "A unique identifier for the message this chunk belongs to.\n\nAll chunks belonging to the same message share the same `messageId`.\nA change in `messageId` indicates a new message has started.",
6626 }),
6627 ),
6628 _meta: Schema.optionalKey(
6629 Schema.Union([
6630 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6631 description:
6632 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6633 }),
6634 Schema.Null,
6635 ]),
6636 ),
6637 }).annotate({ description: "A streamed item of content" }),
6638 Schema.Struct({
6639 sessionUpdate: Schema.Literal("agent_thought_chunk"),
6640 content: Schema.suspend((): Schema.Codec<ContentBlock> => ContentBlock).annotate({
6641 description: "A single item of content",
6642 }),
6643 messageId: Schema.optionalKey(
6644 Schema.Union([MessageId, Schema.Null]).annotate({
6645 description:
6646 "A unique identifier for the message this chunk belongs to.\n\nAll chunks belonging to the same message share the same `messageId`.\nA change in `messageId` indicates a new message has started.",
6647 }),
6648 ),
6649 _meta: Schema.optionalKey(
6650 Schema.Union([
6651 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6652 description:
6653 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6654 }),
6655 Schema.Null,
6656 ]),
6657 ),
6658 }).annotate({ description: "A streamed item of content" }),
6659 Schema.Struct({
6660 sessionUpdate: Schema.Literal("tool_call"),
6661 toolCallId: Schema.suspend((): Schema.Codec<ToolCallId> => ToolCallId).annotate({
6662 description: "Unique identifier for this tool call within the session.",
6663 }),
6664 title: Schema.String.annotate({
6665 description: "Human-readable title describing what the tool is doing.",
6666 }),
6667 name: Schema.optionalKey(
6668 Schema.Union([
6669 Schema.String.annotate({
6670 description:
6671 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nProgrammatic name of the tool being invoked.\n\nThis field is optional. Omitting it or sending `null` both mean that no\ntool name is available.",
6672 }),
6673 Schema.Null,
6674 ]),
6675 ),
6676 kind: Schema.optionalKey(
6677 Schema.suspend((): Schema.Codec<ToolKind> => ToolKind).annotate({
6678 description:
6679 "The category of tool being invoked.\nHelps clients choose appropriate icons and UI treatment.",
6680 }),
6681 ),
6682 status: Schema.optionalKey(
6683 Schema.suspend((): Schema.Codec<ToolCallStatus> => ToolCallStatus).annotate({
6684 description: "Current execution status of the tool call.",
6685 }),
6686 ),
6687 content: Schema.optionalKey(
6688 Schema.Array(ToolCallContent).annotate({ description: "Content produced by the tool call." }),
6689 ),
6690 locations: Schema.optionalKey(
6691 Schema.Array(ToolCallLocation).annotate({
6692 description:
6693 'File locations affected by this tool call.\nEnables "follow-along" features in clients.',
6694 }),
6695 ),
6696 rawInput: Schema.optionalKey(
6697 Schema.Json.annotate({
6698 expected: "JSON value",
6699 description: "Raw input parameters sent to the tool.",
6700 }),
6701 ),
6702 rawOutput: Schema.optionalKey(
6703 Schema.Json.annotate({
6704 expected: "JSON value",
6705 description: "Raw output returned by the tool.",
6706 }),
6707 ),
6708 _meta: Schema.optionalKey(
6709 Schema.Union([
6710 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6711 description:
6712 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6713 }),
6714 Schema.Null,
6715 ]),
6716 ),
6717 }).annotate({
6718 description:
6719 "Represents a tool call that the language model has requested.\n\nTool calls are actions that the agent executes on behalf of the language model,\nsuch as reading files, executing code, or fetching data from external sources.\n\nSee protocol docs: [Tool Calls](https://agentclientprotocol.com/protocol/tool-calls)",
6720 }),
6721 Schema.Struct({
6722 sessionUpdate: Schema.Literal("tool_call_update"),
6723 toolCallId: Schema.suspend((): Schema.Codec<ToolCallId> => ToolCallId).annotate({
6724 description: "The ID of the tool call being updated.",
6725 }),
6726 kind: Schema.optionalKey(
6727 Schema.Union([ToolKind, Schema.Null]).annotate({ description: "Update the tool kind." }),
6728 ),
6729 status: Schema.optionalKey(
6730 Schema.Union([ToolCallStatus, Schema.Null]).annotate({
6731 description: "Update the execution status.",
6732 }),
6733 ),
6734 title: Schema.optionalKey(
6735 Schema.Union([
6736 Schema.String.annotate({ description: "Update the human-readable title." }),
6737 Schema.Null,
6738 ]),
6739 ),
6740 name: Schema.optionalKey(
6741 Schema.Union([
6742 Schema.String.annotate({
6743 description:
6744 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nUpdate the programmatic name of the tool being invoked.\n\nThis field is optional. Omitting it or sending `null` both mean that\nthe existing name is left unchanged.",
6745 }),
6746 Schema.Null,
6747 ]),
6748 ),
6749 content: Schema.optionalKey(
6750 Schema.Union([
6751 Schema.Array(ToolCallContent).annotate({ description: "Replace the content collection." }),
6752 Schema.Null,
6753 ]),
6754 ),
6755 locations: Schema.optionalKey(
6756 Schema.Union([
6757 Schema.Array(ToolCallLocation).annotate({
6758 description: "Replace the locations collection.",
6759 }),
6760 Schema.Null,
6761 ]),
6762 ),
6763 rawInput: Schema.optionalKey(
6764 Schema.Json.annotate({ expected: "JSON value", description: "Update the raw input." }),
6765 ),
6766 rawOutput: Schema.optionalKey(
6767 Schema.Json.annotate({ expected: "JSON value", description: "Update the raw output." }),
6768 ),
6769 _meta: Schema.optionalKey(
6770 Schema.Union([
6771 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6772 description:
6773 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6774 }),
6775 Schema.Null,
6776 ]),
6777 ),
6778 }).annotate({
6779 description:
6780 "An update to an existing tool call.\n\nUsed to report progress and results as tools execute. All fields except\nthe tool call ID are optional - only changed fields need to be included.\n\nSee protocol docs: [Updating](https://agentclientprotocol.com/protocol/tool-calls#updating)",
6781 }),
6782 Schema.Struct({
6783 sessionUpdate: Schema.Literal("plan"),
6784 entries: Schema.Array(PlanEntry).annotate({
6785 description:
6786 "The list of tasks to be accomplished.\n\nWhen updating a plan, the agent must send a complete list of all entries\nwith their current status. The client replaces the entire plan with each update.",
6787 }),
6788 _meta: Schema.optionalKey(
6789 Schema.Union([
6790 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6791 description:
6792 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6793 }),
6794 Schema.Null,
6795 ]),
6796 ),
6797 }).annotate({
6798 description:
6799 "An execution plan for accomplishing complex tasks.\n\nPlans consist of multiple entries representing individual tasks or goals.\nAgents report plans to clients to provide visibility into their execution strategy.\nPlans can evolve during execution as the agent discovers new requirements or completes tasks.\n\nSee protocol docs: [Agent Plan](https://agentclientprotocol.com/protocol/agent-plan)",
6800 }),
6801 Schema.Struct({
6802 sessionUpdate: Schema.Literal("plan_update"),
6803 plan: Schema.suspend((): Schema.Codec<PlanUpdateContent> => PlanUpdateContent).annotate({
6804 description: "The updated plan content.",
6805 }),
6806 _meta: Schema.optionalKey(
6807 Schema.Union([
6808 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6809 description:
6810 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6811 }),
6812 Schema.Null,
6813 ]),
6814 ),
6815 }).annotate({
6816 description:
6817 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA content update for a plan identified by ID.",
6818 }),
6819 Schema.Struct({
6820 sessionUpdate: Schema.Literal("plan_removed"),
6821 planId: Schema.suspend((): Schema.Codec<PlanId> => PlanId).annotate({
6822 description: "The plan ID to remove.",
6823 }),
6824 _meta: Schema.optionalKey(
6825 Schema.Union([
6826 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6827 description:
6828 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6829 }),
6830 Schema.Null,
6831 ]),
6832 ),
6833 }).annotate({
6834 description:
6835 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRemoval notice for a plan identified by ID.",
6836 }),
6837 Schema.Struct({
6838 sessionUpdate: Schema.Literal("available_commands_update"),
6839 availableCommands: Schema.Array(AvailableCommand).annotate({
6840 description: "Commands the agent can execute",
6841 }),
6842 _meta: Schema.optionalKey(
6843 Schema.Union([
6844 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6845 description:
6846 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6847 }),
6848 Schema.Null,
6849 ]),
6850 ),
6851 }).annotate({ description: "Available commands are ready or have changed" }),
6852 Schema.Struct({
6853 sessionUpdate: Schema.Literal("current_mode_update"),
6854 currentModeId: Schema.suspend((): Schema.Codec<SessionModeId> => SessionModeId).annotate({
6855 description: "The ID of the current mode",
6856 }),
6857 _meta: Schema.optionalKey(
6858 Schema.Union([
6859 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6860 description:
6861 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6862 }),
6863 Schema.Null,
6864 ]),
6865 ),
6866 }).annotate({
6867 description:
6868 "The current mode of the session has changed\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)",
6869 }),
6870 Schema.Struct({
6871 sessionUpdate: Schema.Literal("config_option_update"),
6872 configOptions: Schema.Array(SessionConfigOption).annotate({
6873 description: "The full set of configuration options and their current values.",
6874 }),
6875 _meta: Schema.optionalKey(
6876 Schema.Union([
6877 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6878 description:
6879 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6880 }),
6881 Schema.Null,
6882 ]),
6883 ),
6884 }).annotate({ description: "Session configuration options have been updated." }),
6885 Schema.Struct({
6886 sessionUpdate: Schema.Literal("session_info_update"),
6887 title: Schema.optionalKey(
6888 Schema.Union([
6889 Schema.String.annotate({
6890 description: "Human-readable title for the session. Set to null to clear.",
6891 }),
6892 Schema.Null,
6893 ]),
6894 ),
6895 updatedAt: Schema.optionalKey(
6896 Schema.Union([
6897 Schema.String.annotate({
6898 description: "ISO 8601 timestamp of last activity. Set to null to clear.",
6899 }),
6900 Schema.Null,
6901 ]),
6902 ),
6903 _meta: Schema.optionalKey(
6904 Schema.Union([
6905 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6906 description:
6907 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6908 }),
6909 Schema.Null,
6910 ]),
6911 ),
6912 }).annotate({
6913 description:
6914 "Update to session metadata. All fields are optional to support partial updates.\n\nAgents send this notification to update session information like title or custom metadata.\nThis allows clients to display dynamic session names and track session state changes.",
6915 }),
6916 Schema.Struct({
6917 sessionUpdate: Schema.Literal("usage_update"),
6918 used: Schema.Number.annotate({ description: "Tokens currently in context.", format: "uint64" })
6919 .check(Schema.isInt().annotate({ expected: "an integer" }))
6920 .check(
6921 Schema.isGreaterThanOrEqualTo(0).annotate({
6922 expected: "a value greater than or equal to 0",
6923 }),
6924 ),
6925 size: Schema.Number.annotate({
6926 description: "Total context window size in tokens.",
6927 format: "uint64",
6928 })
6929 .check(Schema.isInt().annotate({ expected: "an integer" }))
6930 .check(
6931 Schema.isGreaterThanOrEqualTo(0).annotate({
6932 expected: "a value greater than or equal to 0",
6933 }),
6934 ),
6935 cost: Schema.optionalKey(
6936 Schema.Union([Cost, Schema.Null]).annotate({
6937 description: "Cumulative session cost (optional).",
6938 }),
6939 ),
6940 _meta: Schema.optionalKey(
6941 Schema.Union([
6942 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6943 description:
6944 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
6945 }),
6946 Schema.Null,
6947 ]),
6948 ),
6949 }).annotate({ description: "Context window and cost update for a session." }),
6950 Schema.Struct({
6951 sessionUpdate: Schema.Literal("compaction_update"),
6952 compactionId: Schema.suspend((): Schema.Codec<CompactionId> => CompactionId).annotate({
6953 description: "The Agent-owned ID of this compaction, unique within the session.",
6954 }),
6955 status: Schema.suspend((): Schema.Codec<CompactionStatus> => CompactionStatus).annotate({
6956 description: "Current lifecycle status.",
6957 }),
6958 summary: Schema.optionalKey(
6959 Schema.Union([
6960 Schema.Array(ContentBlock).annotate({
6961 description: "Complete replacement user-displayable summary retained by the compaction.",
6962 }),
6963 Schema.Null,
6964 ]),
6965 ),
6966 error: Schema.optionalKey(
6967 Schema.Union([
6968 Schema.String.annotate({
6969 description: "Human-readable description of why the compaction failed.",
6970 }),
6971 Schema.Null,
6972 ]),
6973 ),
6974 _meta: Schema.optionalKey(
6975 Schema.Union([
6976 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6977 description: "Extensible metadata patch for this compaction.",
6978 }),
6979 Schema.Null,
6980 ]),
6981 ),
6982 }).annotate({
6983 description:
6984 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA context compaction upsert. The first update fixes the compaction's\ntimeline position. Later updates with the same ID patch that entity in place.\nAgents MUST only send this update when the Client advertised\n[`ClientSessionCapabilities::compaction`].\n\n`summary`, `error`, and `_meta` have patch semantics: omission leaves the\nstored value unchanged, `null` clears it, and a concrete value replaces it.\n`summary: []` also clears the retained summary. A non-empty summary is only\nvalid with `completed`; `error` is only valid with `failed`.",
6985 }),
6986 Schema.Struct({
6987 sessionUpdate: Schema.Literal("compaction_summary_chunk"),
6988 compactionId: Schema.suspend((): Schema.Codec<CompactionId> => CompactionId).annotate({
6989 description: "ID of the compaction whose summary receives this content.",
6990 }),
6991 content: Schema.suspend((): Schema.Codec<ContentBlock> => ContentBlock).annotate({
6992 description: "One content block to append.",
6993 }),
6994 _meta: Schema.optionalKey(
6995 Schema.Union([
6996 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
6997 description: "Metadata scoped to this chunk. Omission and `null` both mean absent.",
6998 }),
6999 Schema.Null,
7000 ]),
7001 ),
7002 }).annotate({
7003 description:
7004 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA content block appended to the retained summary of an in-progress\ncompaction. Agents send chunks only after an `in_progress` update and before\nthe terminal update for the same ID. Agents MUST only send this update when\nthe Client advertised [`ClientSessionCapabilities::compaction`].",
7005 }),
7006]).annotate({
7007 description:
7008 "Different types of updates that can be sent during session processing.\n\nThese updates provide real-time feedback about the agent's progress.\n\nSee protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)",
7009 identifier: "SessionUpdate",
7010});
7011
7012export type NewSessionResponse = {
7013 readonly sessionId: SessionId;
7014 readonly modes?: SessionModeState | null;
7015 readonly configOptions?: ReadonlyArray<SessionConfigOption> | null;
7016 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
7017};
7018export const NewSessionResponse = Schema.Struct({
7019 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
7020 description:
7021 "Unique identifier for the created session.\n\nUsed in all subsequent requests for this conversation.",
7022 }),
7023 modes: Schema.optionalKey(
7024 Schema.Union([SessionModeState, Schema.Null]).annotate({
7025 description:
7026 "Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)",
7027 }),
7028 ),
7029 configOptions: Schema.optionalKey(
7030 Schema.Union([
7031 Schema.Array(SessionConfigOption).annotate({
7032 description: "Initial session configuration options if supported by the Agent.",
7033 }),
7034 Schema.Null,
7035 ]),
7036 ),
7037 _meta: Schema.optionalKey(
7038 Schema.Union([
7039 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
7040 description:
7041 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
7042 }),
7043 Schema.Null,
7044 ]),
7045 ),
7046}).annotate({
7047 description:
7048 "Response from creating a new session.\n\nSee protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol/session-setup#creating-a-session)",
7049 identifier: "NewSessionResponse",
7050});
7051
7052export type LoadSessionResponse = {
7053 readonly modes?: SessionModeState | null;
7054 readonly configOptions?: ReadonlyArray<SessionConfigOption> | null;
7055 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
7056};
7057export const LoadSessionResponse = Schema.Struct({
7058 modes: Schema.optionalKey(
7059 Schema.Union([SessionModeState, Schema.Null]).annotate({
7060 description:
7061 "Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)",
7062 }),
7063 ),
7064 configOptions: Schema.optionalKey(
7065 Schema.Union([
7066 Schema.Array(SessionConfigOption).annotate({
7067 description: "Initial session configuration options if supported by the Agent.",
7068 }),
7069 Schema.Null,
7070 ]),
7071 ),
7072 _meta: Schema.optionalKey(
7073 Schema.Union([
7074 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
7075 description:
7076 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
7077 }),
7078 Schema.Null,
7079 ]),
7080 ),
7081}).annotate({
7082 description: "Response from loading an existing session.",
7083 identifier: "LoadSessionResponse",
7084});
7085
7086export type ForkSessionResponse = {
7087 readonly sessionId: SessionId;
7088 readonly modes?: SessionModeState | null;
7089 readonly configOptions?: ReadonlyArray<SessionConfigOption> | null;
7090 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
7091};
7092export const ForkSessionResponse = Schema.Struct({
7093 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
7094 description: "Unique identifier for the newly created forked session.",
7095 }),
7096 modes: Schema.optionalKey(
7097 Schema.Union([SessionModeState, Schema.Null]).annotate({
7098 description:
7099 "Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)",
7100 }),
7101 ),
7102 configOptions: Schema.optionalKey(
7103 Schema.Union([
7104 Schema.Array(SessionConfigOption).annotate({
7105 description: "Initial session configuration options if supported by the Agent.",
7106 }),
7107 Schema.Null,
7108 ]),
7109 ),
7110 _meta: Schema.optionalKey(
7111 Schema.Union([
7112 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
7113 description:
7114 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
7115 }),
7116 Schema.Null,
7117 ]),
7118 ),
7119}).annotate({
7120 description:
7121 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse from forking an existing session.",
7122 identifier: "ForkSessionResponse",
7123});
7124
7125export type ResumeSessionResponse = {
7126 readonly modes?: SessionModeState | null;
7127 readonly configOptions?: ReadonlyArray<SessionConfigOption> | null;
7128 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
7129};
7130export const ResumeSessionResponse = Schema.Struct({
7131 modes: Schema.optionalKey(
7132 Schema.Union([SessionModeState, Schema.Null]).annotate({
7133 description:
7134 "Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)",
7135 }),
7136 ),
7137 configOptions: Schema.optionalKey(
7138 Schema.Union([
7139 Schema.Array(SessionConfigOption).annotate({
7140 description: "Initial session configuration options if supported by the Agent.",
7141 }),
7142 Schema.Null,
7143 ]),
7144 ),
7145 _meta: Schema.optionalKey(
7146 Schema.Union([
7147 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
7148 description:
7149 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
7150 }),
7151 Schema.Null,
7152 ]),
7153 ),
7154}).annotate({
7155 description: "Response from resuming an existing session.",
7156 identifier: "ResumeSessionResponse",
7157});
7158
7159export type SetSessionConfigOptionResponse = {
7160 readonly configOptions: ReadonlyArray<SessionConfigOption>;
7161 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
7162};
7163export const SetSessionConfigOptionResponse = Schema.Struct({
7164 configOptions: Schema.Array(SessionConfigOption).annotate({
7165 description: "The full set of configuration options and their current values.",
7166 }),
7167 _meta: Schema.optionalKey(
7168 Schema.Union([
7169 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
7170 description:
7171 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
7172 }),
7173 Schema.Null,
7174 ]),
7175 ),
7176}).annotate({
7177 description: "Response to `session/set_config_option` method.",
7178 identifier: "SetSessionConfigOptionResponse",
7179});
7180
7181export type InitializeResponse = {
7182 readonly protocolVersion: ProtocolVersion;
7183 readonly agentCapabilities?: AgentCapabilities;
7184 readonly authMethods?: ReadonlyArray<AuthMethod>;
7185 readonly agentInfo?: Implementation | null;
7186 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
7187};
7188export const InitializeResponse = Schema.Struct({
7189 protocolVersion: Schema.suspend((): Schema.Codec<ProtocolVersion> => ProtocolVersion).annotate({
7190 description:
7191 "The protocol version the client specified if supported by the agent,\nor the latest protocol version supported by the agent.\n\nThe client should disconnect, if it doesn't support this version.",
7192 }),
7193 agentCapabilities: Schema.optionalKey(
7194 Schema.suspend((): Schema.Codec<AgentCapabilities> => AgentCapabilities).annotate({
7195 description: "Capabilities supported by the agent.",
7196 default: {
7197 loadSession: false,
7198 promptCapabilities: { image: false, audio: false, embeddedContext: false },
7199 mcpCapabilities: { http: false, sse: false, acp: false },
7200 sessionCapabilities: {},
7201 auth: {},
7202 },
7203 }),
7204 ),
7205 authMethods: Schema.optionalKey(
7206 Schema.Array(AuthMethod).annotate({
7207 description: "Authentication methods supported by the agent.",
7208 default: [],
7209 }),
7210 ),
7211 agentInfo: Schema.optionalKey(
7212 Schema.Union([Implementation, Schema.Null]).annotate({
7213 description:
7214 "Information about the Agent name and version sent to the Client.\n\nNote: in future versions of the protocol, this will be required.",
7215 }),
7216 ),
7217 _meta: Schema.optionalKey(
7218 Schema.Union([
7219 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
7220 description:
7221 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
7222 }),
7223 Schema.Null,
7224 ]),
7225 ),
7226}).annotate({
7227 description:
7228 "Response to the `initialize` method.\n\nContains the negotiated protocol version and agent capabilities.\n\nSee protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)",
7229 identifier: "InitializeResponse",
7230});
7231
7232export type SessionNotification = {
7233 readonly sessionId: SessionId;
7234 readonly update: SessionUpdate;
7235 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
7236};
7237export const SessionNotification = Schema.Struct({
7238 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
7239 description: "The ID of the session this update pertains to.",
7240 }),
7241 update: Schema.suspend((): Schema.Codec<SessionUpdate> => SessionUpdate).annotate({
7242 description: "The actual update content.",
7243 }),
7244 _meta: Schema.optionalKey(
7245 Schema.Union([
7246 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
7247 description:
7248 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
7249 }),
7250 Schema.Null,
7251 ]),
7252 ),
7253}).annotate({
7254 description:
7255 "Notification containing a session update from the agent.\n\nUsed to stream real-time progress and results during prompt processing.\n\nSee protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)",
7256 identifier: "SessionNotification",
7257});
7258
7259export type AgentNotification = {
7260 readonly method: string;
7261 readonly params?:
7262 | SessionNotification
7263 | CompleteElicitationNotification
7264 | MessageMcpNotification
7265 | ExtNotification
7266 | null;
7267};
7268export const AgentNotification = Schema.Struct({
7269 method: Schema.String.annotate({ description: "The notification method name." }),
7270 params: Schema.optionalKey(
7271 Schema.Union([
7272 Schema.Union([
7273 Schema.suspend((): Schema.Codec<SessionNotification> => SessionNotification).annotate({
7274 title: "SessionNotification",
7275 description:
7276 "Handles session update notifications from the agent.\n\nThis is a notification endpoint (no response expected) that receives\nreal-time updates about session progress, including message chunks,\ntool calls, and execution plans.\n\nNote: Clients SHOULD continue accepting tool call updates even after\nsending a `session/cancel` notification, as the agent may send final\nupdates before responding with the cancelled stop reason.\n\nSee protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)",
7277 }),
7278 Schema.suspend(
7279 (): Schema.Codec<CompleteElicitationNotification> => CompleteElicitationNotification,
7280 ).annotate({
7281 title: "CompleteElicitationNotification",
7282 description:
7283 "Notification that a URL-based elicitation has completed.\n\nSee protocol docs: [Elicitation](https://agentclientprotocol.com/protocol/elicitation#url-completion)",
7284 }),
7285 Schema.suspend((): Schema.Codec<MessageMcpNotification> => MessageMcpNotification).annotate(
7286 {
7287 title: "MessageMcpNotification",
7288 description:
7289 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nReceives an MCP-over-ACP notification.",
7290 },
7291 ),
7292 Schema.suspend((): Schema.Codec<ExtNotification> => ExtNotification).annotate({
7293 title: "ExtNotification",
7294 description:
7295 "Handles extension notifications from the agent.\n\nAllows the Agent to send an arbitrary notification that is not part of the ACP spec.\nExtension notifications provide a way to send one-way messages for custom functionality\nwhile maintaining protocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
7296 }),
7297 ]).annotate({
7298 description:
7299 "All possible notifications that an agent can send to a client.\n\nThis enum is used internally for routing RPC notifications. You typically won't need\nto use this directly.\n\nNotifications do not expect a response.",
7300 }),
7301 Schema.Null,
7302 ]).annotate({ description: "Method-specific notification parameters." }),
7303 ),
7304}).annotate({ description: "A JSON-RPC notification object." });
7305
7306export type AgentRequest = {
7307 readonly id: RequestId;
7308 readonly method: string;
7309 readonly params?:
7310 | WriteTextFileRequest
7311 | ReadTextFileRequest
7312 | RequestPermissionRequest
7313 | CreateTerminalRequest
7314 | TerminalOutputRequest
7315 | ReleaseTerminalRequest
7316 | WaitForTerminalExitRequest
7317 | KillTerminalRequest
7318 | CreateElicitationRequest
7319 | ConnectMcpRequest
7320 | MessageMcpRequest
7321 | DisconnectMcpRequest
7322 | ExtRequest
7323 | null;
7324};
7325export const AgentRequest = Schema.Struct({
7326 id: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({
7327 description: "The request id used to correlate the matching response.",
7328 }),
7329 method: Schema.String.annotate({ description: "The method name to invoke." }),
7330 params: Schema.optionalKey(
7331 Schema.Union([
7332 Schema.Union([
7333 Schema.suspend((): Schema.Codec<WriteTextFileRequest> => WriteTextFileRequest).annotate({
7334 title: "WriteTextFileRequest",
7335 description:
7336 "Writes content to a text file in the client's file system.\n\nOnly available if the client advertises the `fs.writeTextFile` capability.\nAllows the agent to create or modify files within the client's environment.\n\nSee protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client)",
7337 }),
7338 Schema.suspend((): Schema.Codec<ReadTextFileRequest> => ReadTextFileRequest).annotate({
7339 title: "ReadTextFileRequest",
7340 description:
7341 "Reads content from a text file in the client's file system.\n\nOnly available if the client advertises the `fs.readTextFile` capability.\nAllows the agent to access file contents within the client's environment.\n\nSee protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client)",
7342 }),
7343 Schema.suspend(
7344 (): Schema.Codec<RequestPermissionRequest> => RequestPermissionRequest,
7345 ).annotate({
7346 title: "RequestPermissionRequest",
7347 description:
7348 "Requests permission from the user for a tool call operation.\n\nCalled by the agent when it needs user authorization before executing\na potentially sensitive operation. The client should present the options\nto the user and return their decision.\n\nIf the client cancels the prompt turn via `session/cancel`, it MUST\nrespond to this request with `RequestPermissionOutcome::Cancelled`.\n\nSee protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/tool-calls#requesting-permission)",
7349 }),
7350 Schema.suspend((): Schema.Codec<CreateTerminalRequest> => CreateTerminalRequest).annotate({
7351 title: "CreateTerminalRequest",
7352 description:
7353 "Executes a command in a new terminal\n\nOnly available if the `terminal` Client capability is set to `true`.\n\nReturns a `TerminalId` that can be used with other terminal methods\nto get the current output, wait for exit, and kill the command.\n\nThe `TerminalId` can also be used to embed the terminal in a tool call\nby using the `ToolCallContent::Terminal` variant.\n\nThe Agent is responsible for releasing the terminal by using the `terminal/release`\nmethod.\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)",
7354 }),
7355 Schema.suspend((): Schema.Codec<TerminalOutputRequest> => TerminalOutputRequest).annotate({
7356 title: "TerminalOutputRequest",
7357 description:
7358 "Gets the terminal output and exit status\n\nReturns the current content in the terminal without waiting for the command to exit.\nIf the command has already exited, the exit status is included.\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)",
7359 }),
7360 Schema.suspend((): Schema.Codec<ReleaseTerminalRequest> => ReleaseTerminalRequest).annotate(
7361 {
7362 title: "ReleaseTerminalRequest",
7363 description:
7364 "Releases a terminal\n\nThe command is killed if it hasn't exited yet. Use `terminal/wait_for_exit`\nto wait for the command to exit before releasing the terminal.\n\nAfter release, the `TerminalId` can no longer be used with other `terminal/*` methods,\nbut tool calls that already contain it, continue to display its output.\n\nThe `terminal/kill` method can be used to terminate the command without releasing\nthe terminal, allowing the Agent to call `terminal/output` and other methods.\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)",
7365 },
7366 ),
7367 Schema.suspend(
7368 (): Schema.Codec<WaitForTerminalExitRequest> => WaitForTerminalExitRequest,
7369 ).annotate({
7370 title: "WaitForTerminalExitRequest",
7371 description:
7372 "Waits for the terminal command to exit and return its exit status\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)",
7373 }),
7374 Schema.suspend((): Schema.Codec<KillTerminalRequest> => KillTerminalRequest).annotate({
7375 title: "KillTerminalRequest",
7376 description:
7377 "Kills the terminal command without releasing the terminal\n\nWhile `terminal/release` will also kill the command, this method will keep\nthe `TerminalId` valid so it can be used with other methods.\n\nThis method can be helpful when implementing command timeouts which terminate\nthe command as soon as elapsed, and then get the final output so it can be sent\nto the model.\n\nNote: Call `terminal/release` when `TerminalId` is no longer needed.\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)",
7378 }),
7379 Schema.suspend(
7380 (): Schema.Codec<CreateElicitationRequest> => CreateElicitationRequest,
7381 ).annotate({
7382 title: "CreateElicitationRequest",
7383 description:
7384 "Requests structured user input via a form or URL.\n\nSee protocol docs: [Elicitation](https://agentclientprotocol.com/protocol/elicitation)",
7385 }),
7386 Schema.suspend((): Schema.Codec<ConnectMcpRequest> => ConnectMcpRequest).annotate({
7387 title: "ConnectMcpRequest",
7388 description:
7389 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nOpens an MCP-over-ACP connection.",
7390 }),
7391 Schema.suspend((): Schema.Codec<MessageMcpRequest> => MessageMcpRequest).annotate({
7392 title: "MessageMcpRequest",
7393 description:
7394 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nExchanges an MCP-over-ACP message.",
7395 }),
7396 Schema.suspend((): Schema.Codec<DisconnectMcpRequest> => DisconnectMcpRequest).annotate({
7397 title: "DisconnectMcpRequest",
7398 description:
7399 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCloses an MCP-over-ACP connection.",
7400 }),
7401 Schema.suspend((): Schema.Codec<ExtRequest> => ExtRequest).annotate({
7402 title: "ExtMethodRequest",
7403 description:
7404 "Handles extension method requests from the agent.\n\nAllows the Agent to send an arbitrary request that is not part of the ACP spec.\nExtension methods provide a way to add custom functionality while maintaining\nprotocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
7405 }),
7406 ]).annotate({
7407 description:
7408 "All possible requests that an agent can send to a client.\n\nThis enum is used internally for routing RPC requests. You typically won't need\nto use this directly.\n\nThis enum encompasses all method calls from agent to client.",
7409 }),
7410 Schema.Null,
7411 ]).annotate({ description: "Method-specific request parameters." }),
7412 ),
7413}).annotate({ description: "A JSON-RPC request object." });
7414
7415export type AgentResponse =
7416 | {
7417 readonly id: RequestId;
7418 readonly result:
7419 | InitializeResponse
7420 | AuthenticateResponse
7421 | ListProvidersResponse
7422 | SetProviderResponse
7423 | DisableProviderResponse
7424 | LogoutResponse
7425 | NewSessionResponse
7426 | LoadSessionResponse
7427 | ListSessionsResponse
7428 | DeleteSessionResponse
7429 | ForkSessionResponse
7430 | ResumeSessionResponse
7431 | CloseSessionResponse
7432 | SetSessionModeResponse
7433 | SetSessionConfigOptionResponse
7434 | PromptResponse
7435 | StartNesResponse
7436 | SuggestNesResponse
7437 | CloseNesResponse
7438 | ExtResponse
7439 | MessageMcpResponse;
7440 }
7441 | { readonly id: RequestId; readonly error: Error };
7442export const AgentResponse = Schema.Union([
7443 Schema.Struct({
7444 id: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({
7445 description: "The id of the request this response answers.",
7446 }),
7447 result: Schema.Union([
7448 Schema.suspend((): Schema.Codec<InitializeResponse> => InitializeResponse).annotate({
7449 title: "InitializeResponse",
7450 description: "Successful result returned for a `initialize` request.",
7451 }),
7452 Schema.suspend((): Schema.Codec<AuthenticateResponse> => AuthenticateResponse).annotate({
7453 title: "AuthenticateResponse",
7454 description: "Successful result returned for a `authenticate` request.",
7455 }),
7456 Schema.suspend((): Schema.Codec<ListProvidersResponse> => ListProvidersResponse).annotate({
7457 title: "ListProvidersResponse",
7458 description: "Successful result returned for a `providers/list` request.",
7459 }),
7460 Schema.suspend((): Schema.Codec<SetProviderResponse> => SetProviderResponse).annotate({
7461 title: "SetProviderResponse",
7462 description: "Successful result returned for a `providers/set` request.",
7463 }),
7464 Schema.suspend((): Schema.Codec<DisableProviderResponse> => DisableProviderResponse).annotate(
7465 {
7466 title: "DisableProviderResponse",
7467 description: "Successful result returned for a `providers/disable` request.",
7468 },
7469 ),
7470 Schema.suspend((): Schema.Codec<LogoutResponse> => LogoutResponse).annotate({
7471 title: "LogoutResponse",
7472 description: "Successful result returned for a `logout` request.",
7473 }),
7474 Schema.suspend((): Schema.Codec<NewSessionResponse> => NewSessionResponse).annotate({
7475 title: "NewSessionResponse",
7476 description: "Successful result returned for a `session/new` request.",
7477 }),
7478 Schema.suspend((): Schema.Codec<LoadSessionResponse> => LoadSessionResponse).annotate({
7479 title: "LoadSessionResponse",
7480 description: "Successful result returned for a `session/load` request.",
7481 }),
7482 Schema.suspend((): Schema.Codec<ListSessionsResponse> => ListSessionsResponse).annotate({
7483 title: "ListSessionsResponse",
7484 description: "Successful result returned for a `session/list` request.",
7485 }),
7486 Schema.suspend((): Schema.Codec<DeleteSessionResponse> => DeleteSessionResponse).annotate({
7487 title: "DeleteSessionResponse",
7488 description: "Successful result returned for a `session/delete` request.",
7489 }),
7490 Schema.suspend((): Schema.Codec<ForkSessionResponse> => ForkSessionResponse).annotate({
7491 title: "ForkSessionResponse",
7492 description: "Successful result returned for a `session/fork` request.",
7493 }),
7494 Schema.suspend((): Schema.Codec<ResumeSessionResponse> => ResumeSessionResponse).annotate({
7495 title: "ResumeSessionResponse",
7496 description: "Successful result returned for a `session/resume` request.",
7497 }),
7498 Schema.suspend((): Schema.Codec<CloseSessionResponse> => CloseSessionResponse).annotate({
7499 title: "CloseSessionResponse",
7500 description: "Successful result returned for a `session/close` request.",
7501 }),
7502 Schema.suspend((): Schema.Codec<SetSessionModeResponse> => SetSessionModeResponse).annotate({
7503 title: "SetSessionModeResponse",
7504 description: "Successful result returned for a `session/set_mode` request.",
7505 }),
7506 Schema.suspend(
7507 (): Schema.Codec<SetSessionConfigOptionResponse> => SetSessionConfigOptionResponse,
7508 ).annotate({
7509 title: "SetSessionConfigOptionResponse",
7510 description: "Successful result returned for a `session/set_config_option` request.",
7511 }),
7512 Schema.suspend((): Schema.Codec<PromptResponse> => PromptResponse).annotate({
7513 title: "PromptResponse",
7514 description: "Successful result returned for a `session/prompt` request.",
7515 }),
7516 Schema.suspend((): Schema.Codec<StartNesResponse> => StartNesResponse).annotate({
7517 title: "StartNesResponse",
7518 description: "Successful result returned for a `nes/start` request.",
7519 }),
7520 Schema.suspend((): Schema.Codec<SuggestNesResponse> => SuggestNesResponse).annotate({
7521 title: "SuggestNesResponse",
7522 description: "Successful result returned for a `nes/suggest` request.",
7523 }),
7524 Schema.suspend((): Schema.Codec<CloseNesResponse> => CloseNesResponse).annotate({
7525 title: "CloseNesResponse",
7526 description: "Successful result returned for a `nes/close` request.",
7527 }),
7528 Schema.suspend((): Schema.Codec<ExtResponse> => ExtResponse).annotate({
7529 title: "ExtMethodResponse",
7530 description:
7531 "Successful result returned by an extension method outside the core ACP method set.",
7532 }),
7533 Schema.suspend((): Schema.Codec<MessageMcpResponse> => MessageMcpResponse).annotate({
7534 title: "MessageMcpResponse",
7535 description: "Successful result returned by an MCP-over-ACP `mcp/message` request.",
7536 }),
7537 ]).annotate({ description: "Method-specific response data." }),
7538 }).annotate({ title: "Result", description: "A successful JSON-RPC response." }),
7539 Schema.Struct({
7540 id: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({
7541 description: "The id of the request this response answers.",
7542 }),
7543 error: Schema.suspend((): Schema.Codec<Error> => Error).annotate({
7544 description: "Method-specific error data.",
7545 }),
7546 }).annotate({ title: "Error", description: "A failed JSON-RPC response." }),
7547]).annotate({ description: "A JSON-RPC response object." });
7548
7549export type AudioContent = {
7550 readonly annotations?: Annotations | null;
7551 readonly data: string;
7552 readonly mimeType: string;
7553 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
7554};
7555export const AudioContent = Schema.Struct({
7556 annotations: Schema.optionalKey(
7557 Schema.Union([Annotations, Schema.Null]).annotate({
7558 description:
7559 "Optional annotations that help clients decide how to display or route this content.",
7560 }),
7561 ),
7562 data: Schema.String.annotate({ description: "Base64-encoded media payload." }),
7563 mimeType: Schema.String.annotate({
7564 description: "MIME type describing the encoded media payload.",
7565 }),
7566 _meta: Schema.optionalKey(
7567 Schema.Union([
7568 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
7569 description:
7570 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
7571 }),
7572 Schema.Null,
7573 ]),
7574 ),
7575}).annotate({ description: "Audio provided to or from an LLM." });
7576
7577export type AuthMethodTerminal = {
7578 readonly id: AuthMethodId;
7579 readonly name: string;
7580 readonly description?: string | null;
7581 readonly args?: ReadonlyArray<string>;
7582 readonly env?: { readonly [x: string]: string };
7583 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
7584};
7585export const AuthMethodTerminal = Schema.Struct({
7586 id: Schema.suspend((): Schema.Codec<AuthMethodId> => AuthMethodId).annotate({
7587 description: "Unique identifier for this authentication method.",
7588 }),
7589 name: Schema.String.annotate({
7590 description: "Human-readable name of the authentication method.",
7591 }),
7592 description: Schema.optionalKey(
7593 Schema.Union([
7594 Schema.String.annotate({
7595 description:
7596 "Optional description providing more details about this authentication method.",
7597 }),
7598 Schema.Null,
7599 ]),
7600 ),
7601 args: Schema.optionalKey(
7602 Schema.Array(Schema.String).annotate({
7603 description:
7604 "Additional arguments to append to the configured agent invocation for terminal auth.",
7605 }),
7606 ),
7607 env: Schema.optionalKey(
7608 Schema.Record(Schema.String, Schema.String).annotate({
7609 description:
7610 "Additional environment variables to set on the configured agent invocation for terminal auth.\nThese values override same-named variables in the base launch configuration.",
7611 }),
7612 ),
7613 _meta: Schema.optionalKey(
7614 Schema.Union([
7615 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
7616 description:
7617 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
7618 }),
7619 Schema.Null,
7620 ]),
7621 ),
7622}).annotate({
7623 description:
7624 "Terminal-based authentication method.\n\nThe client runs the configured agent program as a separate interactive\nprocess for the user to authenticate via a TUI. Agents MUST advertise this\nmethod only when the client enabled its terminal authentication capability.\nA zero exit status signals success; any other termination signals failure.\nThe client MUST NOT pass this method to `authenticate`.",
7625});
7626
7627export type AvailableCommandsUpdate = {
7628 readonly availableCommands: ReadonlyArray<AvailableCommand>;
7629 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
7630};
7631export const AvailableCommandsUpdate = Schema.Struct({
7632 availableCommands: Schema.Array(AvailableCommand).annotate({
7633 description: "Commands the agent can execute",
7634 }),
7635 _meta: Schema.optionalKey(
7636 Schema.Union([
7637 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
7638 description:
7639 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
7640 }),
7641 Schema.Null,
7642 ]),
7643 ),
7644}).annotate({ description: "Available commands are ready or have changed" });
7645
7646export type BooleanPropertySchema = {
7647 readonly title?: string | null;
7648 readonly description?: string | null;
7649 readonly default?: boolean | null;
7650 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
7651};
7652export const BooleanPropertySchema = Schema.Struct({
7653 title: Schema.optionalKey(
7654 Schema.Union([
7655 Schema.String.annotate({
7656 description:
7657 "Optional title for the property.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.",
7658 }),
7659 Schema.Null,
7660 ]),
7661 ),
7662 description: Schema.optionalKey(
7663 Schema.Union([
7664 Schema.String.annotate({
7665 description:
7666 "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.",
7667 }),
7668 Schema.Null,
7669 ]),
7670 ),
7671 default: Schema.optionalKey(
7672 Schema.Union([
7673 Schema.Boolean.annotate({
7674 description:
7675 "Default value.\n\nOptional. Omitted and `null` are equivalent and mean no default value is provided.",
7676 }),
7677 Schema.Null,
7678 ]),
7679 ),
7680 _meta: Schema.optionalKey(
7681 Schema.Union([
7682 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
7683 description:
7684 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
7685 }),
7686 Schema.Null,
7687 ]),
7688 ),
7689}).annotate({ description: "Schema for boolean properties in an elicitation form." });
7690
7691export type CancelRequestNotification = {
7692 readonly requestId: RequestId;
7693 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
7694};
7695export const CancelRequestNotification = Schema.Struct({
7696 requestId: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({
7697 description: "The ID of the request to cancel.",
7698 }),
7699 _meta: Schema.optionalKey(
7700 Schema.Union([
7701 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
7702 description:
7703 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
7704 }),
7705 Schema.Null,
7706 ]),
7707 ),
7708}).annotate({
7709 description:
7710 "Notification to cancel an ongoing request.\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)",
7711});
7712
7713export type ClientNotification = {
7714 readonly method: string;
7715 readonly params?:
7716 | CancelNotification
7717 | DidOpenDocumentNotification
7718 | DidChangeDocumentNotification
7719 | DidCloseDocumentNotification
7720 | DidSaveDocumentNotification
7721 | DidFocusDocumentNotification
7722 | AcceptNesNotification
7723 | RejectNesNotification
7724 | MessageMcpNotification
7725 | ExtNotification
7726 | null;
7727};
7728export const ClientNotification = Schema.Struct({
7729 method: Schema.String.annotate({ description: "The notification method name." }),
7730 params: Schema.optionalKey(
7731 Schema.Union([
7732 Schema.Union([
7733 Schema.suspend((): Schema.Codec<CancelNotification> => CancelNotification).annotate({
7734 title: "CancelNotification",
7735 description:
7736 "Cancels ongoing operations for a session.\n\nThis is a notification sent by the client to cancel an ongoing prompt turn.\n\nUpon receiving this notification, the Agent SHOULD:\n- Stop all language model requests as soon as possible\n- Abort all tool call invocations in progress\n- Send any pending `session/update` notifications\n- Respond to the original `session/prompt` request with `StopReason::Cancelled`\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation)",
7737 }),
7738 Schema.suspend(
7739 (): Schema.Codec<DidOpenDocumentNotification> => DidOpenDocumentNotification,
7740 ).annotate({
7741 title: "DidOpenDocumentNotification",
7742 description: "**UNSTABLE**\n\nNotification sent when a file is opened in the editor.",
7743 }),
7744 Schema.suspend(
7745 (): Schema.Codec<DidChangeDocumentNotification> => DidChangeDocumentNotification,
7746 ).annotate({
7747 title: "DidChangeDocumentNotification",
7748 description: "**UNSTABLE**\n\nNotification sent when a file is edited.",
7749 }),
7750 Schema.suspend(
7751 (): Schema.Codec<DidCloseDocumentNotification> => DidCloseDocumentNotification,
7752 ).annotate({
7753 title: "DidCloseDocumentNotification",
7754 description: "**UNSTABLE**\n\nNotification sent when a file is closed.",
7755 }),
7756 Schema.suspend(
7757 (): Schema.Codec<DidSaveDocumentNotification> => DidSaveDocumentNotification,
7758 ).annotate({
7759 title: "DidSaveDocumentNotification",
7760 description: "**UNSTABLE**\n\nNotification sent when a file is saved.",
7761 }),
7762 Schema.suspend(
7763 (): Schema.Codec<DidFocusDocumentNotification> => DidFocusDocumentNotification,
7764 ).annotate({
7765 title: "DidFocusDocumentNotification",
7766 description:
7767 "**UNSTABLE**\n\nNotification sent when a file becomes the active editor tab.",
7768 }),
7769 Schema.suspend((): Schema.Codec<AcceptNesNotification> => AcceptNesNotification).annotate({
7770 title: "AcceptNesNotification",
7771 description: "**UNSTABLE**\n\nNotification sent when a suggestion is accepted.",
7772 }),
7773 Schema.suspend((): Schema.Codec<RejectNesNotification> => RejectNesNotification).annotate({
7774 title: "RejectNesNotification",
7775 description: "**UNSTABLE**\n\nNotification sent when a suggestion is rejected.",
7776 }),
7777 Schema.suspend((): Schema.Codec<MessageMcpNotification> => MessageMcpNotification).annotate(
7778 {
7779 title: "MessageMcpNotification",
7780 description:
7781 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nSends an MCP-over-ACP notification.",
7782 },
7783 ),
7784 Schema.suspend((): Schema.Codec<ExtNotification> => ExtNotification).annotate({
7785 title: "ExtNotification",
7786 description:
7787 "Handles extension notifications from the client.\n\nExtension notifications provide a way to send one-way messages for custom functionality\nwhile maintaining protocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
7788 }),
7789 ]).annotate({
7790 description:
7791 "All possible notifications that a client can send to an agent.\n\nThis enum is used internally for routing RPC notifications. You typically won't need\nto use this directly.\n\nNotifications do not expect a response.",
7792 }),
7793 Schema.Null,
7794 ]).annotate({ description: "Method-specific notification parameters." }),
7795 ),
7796}).annotate({ description: "A JSON-RPC notification object." });
7797
7798export type ClientRequest = {
7799 readonly id: RequestId;
7800 readonly method: string;
7801 readonly params?:
7802 | InitializeRequest
7803 | AuthenticateRequest
7804 | ListProvidersRequest
7805 | SetProviderRequest
7806 | DisableProviderRequest
7807 | LogoutRequest
7808 | NewSessionRequest
7809 | LoadSessionRequest
7810 | ListSessionsRequest
7811 | DeleteSessionRequest
7812 | ForkSessionRequest
7813 | ResumeSessionRequest
7814 | CloseSessionRequest
7815 | SetSessionModeRequest
7816 | SetSessionConfigOptionRequest
7817 | PromptRequest
7818 | StartNesRequest
7819 | SuggestNesRequest
7820 | CloseNesRequest
7821 | MessageMcpRequest
7822 | ExtRequest
7823 | null;
7824};
7825export const ClientRequest = Schema.Struct({
7826 id: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({
7827 description: "The request id used to correlate the matching response.",
7828 }),
7829 method: Schema.String.annotate({ description: "The method name to invoke." }),
7830 params: Schema.optionalKey(
7831 Schema.Union([
7832 Schema.Union([
7833 Schema.suspend((): Schema.Codec<InitializeRequest> => InitializeRequest).annotate({
7834 title: "InitializeRequest",
7835 description:
7836 "Establishes the connection with a client and negotiates protocol capabilities.\n\nThis method is called once at the beginning of the connection to:\n- Negotiate the protocol version to use\n- Exchange capability information between client and agent\n- Determine available authentication methods\n\nThe agent should respond with its supported protocol version and capabilities.\n\nSee protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)",
7837 }),
7838 Schema.suspend((): Schema.Codec<AuthenticateRequest> => AuthenticateRequest).annotate({
7839 title: "AuthenticateRequest",
7840 description:
7841 "Authenticates the client using the specified authentication method.\n\nCalled when the agent requires authentication before allowing session creation.\nThe client provides an authentication method ID that was advertised during\ninitialization and whose type defines the `authenticate` flow.\n\nAfter successful authentication, the client can proceed to create sessions with\n`new_session` without receiving an `auth_required` error.\n\nSee protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)",
7842 }),
7843 Schema.suspend((): Schema.Codec<ListProvidersRequest> => ListProvidersRequest).annotate({
7844 title: "ListProvidersRequest",
7845 description:
7846 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nLists providers that can be configured by the client.",
7847 }),
7848 Schema.suspend((): Schema.Codec<SetProviderRequest> => SetProviderRequest).annotate({
7849 title: "SetProviderRequest",
7850 description:
7851 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nReplaces the configuration for a provider.",
7852 }),
7853 Schema.suspend((): Schema.Codec<DisableProviderRequest> => DisableProviderRequest).annotate(
7854 {
7855 title: "DisableProviderRequest",
7856 description:
7857 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nDisables a provider.",
7858 },
7859 ),
7860 Schema.suspend((): Schema.Codec<LogoutRequest> => LogoutRequest).annotate({
7861 title: "LogoutRequest",
7862 description:
7863 "Logs out of the current authenticated state.\n\nAfter a successful logout, all new sessions will require authentication.\nThere is no guarantee about the behavior of already running sessions.",
7864 }),
7865 Schema.suspend((): Schema.Codec<NewSessionRequest> => NewSessionRequest).annotate({
7866 title: "NewSessionRequest",
7867 description:
7868 "Creates a new conversation session with the agent.\n\nSessions represent independent conversation contexts with their own history and state.\n\nThe agent should:\n- Create a new session context\n- Connect to any specified MCP servers\n- Return a unique session ID for future requests\n\nMay return an `auth_required` error if the agent requires authentication.\n\nSee protocol docs: [Session Setup](https://agentclientprotocol.com/protocol/session-setup)",
7869 }),
7870 Schema.suspend((): Schema.Codec<LoadSessionRequest> => LoadSessionRequest).annotate({
7871 title: "LoadSessionRequest",
7872 description:
7873 "Loads an existing session to resume a previous conversation.\n\nThis method is only available if the agent advertises the `loadSession` capability.\n\nThe agent should:\n- Restore the session context and conversation history\n- Connect to the specified MCP servers\n- Stream the entire conversation history back to the client via notifications\n\nSee protocol docs: [Loading Sessions](https://agentclientprotocol.com/protocol/session-setup#loading-sessions)",
7874 }),
7875 Schema.suspend((): Schema.Codec<ListSessionsRequest> => ListSessionsRequest).annotate({
7876 title: "ListSessionsRequest",
7877 description:
7878 "Lists existing sessions known to the agent.\n\nThis method is only available if the agent advertises the `sessionCapabilities.list` capability.\n\nThe agent should return metadata about sessions with optional filtering and pagination support.",
7879 }),
7880 Schema.suspend((): Schema.Codec<DeleteSessionRequest> => DeleteSessionRequest).annotate({
7881 title: "DeleteSessionRequest",
7882 description:
7883 "Deletes an existing session from `session/list`.\n\nThis method is only available if the agent advertises the `sessionCapabilities.delete` capability.",
7884 }),
7885 Schema.suspend((): Schema.Codec<ForkSessionRequest> => ForkSessionRequest).annotate({
7886 title: "ForkSessionRequest",
7887 description:
7888 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nForks an existing session to create a new independent session.\n\nThis method is only available if the agent advertises the `session.fork` capability.\n\nThe agent should create a new session with the same conversation context as the\noriginal, allowing operations like generating summaries without affecting the\noriginal session's history.",
7889 }),
7890 Schema.suspend((): Schema.Codec<ResumeSessionRequest> => ResumeSessionRequest).annotate({
7891 title: "ResumeSessionRequest",
7892 description:
7893 "Resumes an existing session without returning previous messages.\n\nThis method is only available if the agent advertises the `sessionCapabilities.resume` capability.\n\nThe agent should resume the session context, allowing the conversation to continue\nwithout replaying the message history (unlike `session/load`).",
7894 }),
7895 Schema.suspend((): Schema.Codec<CloseSessionRequest> => CloseSessionRequest).annotate({
7896 title: "CloseSessionRequest",
7897 description:
7898 "Closes an active session and frees up any resources associated with it.\n\nThis method is only available if the agent advertises the `sessionCapabilities.close` capability.\n\nThe agent must cancel any ongoing work (as if `session/cancel` was called)\nand then free up any resources associated with the session.",
7899 }),
7900 Schema.suspend((): Schema.Codec<SetSessionModeRequest> => SetSessionModeRequest).annotate({
7901 title: "SetSessionModeRequest",
7902 description:
7903 'Sets the current mode for a session.\n\nAllows switching between different agent modes (e.g., "ask", "architect", "code")\nthat affect system prompts, tool availability, and permission behaviors.\n\nThe mode must be one of the modes advertised in `availableModes` during session\ncreation or loading. Agents may also change modes autonomously and notify the\nclient via `current_mode_update` notifications.\n\nThis method can be called at any time during a session, whether the Agent is\nidle or actively generating a response.\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)',
7904 }),
7905 Schema.suspend(
7906 (): Schema.Codec<SetSessionConfigOptionRequest> => SetSessionConfigOptionRequest,
7907 ).annotate({
7908 title: "SetSessionConfigOptionRequest",
7909 description: "Sets the current value for a session configuration option.",
7910 }),
7911 Schema.suspend((): Schema.Codec<PromptRequest> => PromptRequest).annotate({
7912 title: "PromptRequest",
7913 description:
7914 "Processes a user prompt within a session.\n\nThis method handles the whole lifecycle of a prompt:\n- Receives user messages with optional context (files, images, etc.)\n- Processes the prompt using language models\n- Reports language model content and tool calls to the Clients\n- Requests permission to run tools\n- Executes any requested tool calls\n- Returns when the turn is complete with a stop reason\n\nSee protocol docs: [Prompt Turn](https://agentclientprotocol.com/protocol/prompt-turn)",
7915 }),
7916 Schema.suspend((): Schema.Codec<StartNesRequest> => StartNesRequest).annotate({
7917 title: "StartNesRequest",
7918 description:
7919 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nStarts an NES session.",
7920 }),
7921 Schema.suspend((): Schema.Codec<SuggestNesRequest> => SuggestNesRequest).annotate({
7922 title: "SuggestNesRequest",
7923 description:
7924 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequests a code suggestion.",
7925 }),
7926 Schema.suspend((): Schema.Codec<CloseNesRequest> => CloseNesRequest).annotate({
7927 title: "CloseNesRequest",
7928 description:
7929 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCloses an active NES session and frees up any resources associated with it.\n\nThe agent must cancel any ongoing work and then free up any resources\nassociated with the NES session.",
7930 }),
7931 Schema.suspend((): Schema.Codec<MessageMcpRequest> => MessageMcpRequest).annotate({
7932 title: "MessageMcpRequest",
7933 description:
7934 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nExchanges an MCP-over-ACP message.",
7935 }),
7936 Schema.suspend((): Schema.Codec<ExtRequest> => ExtRequest).annotate({
7937 title: "ExtMethodRequest",
7938 description:
7939 "Handles extension method requests from the client.\n\nExtension methods provide a way to add custom functionality while maintaining\nprotocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
7940 }),
7941 ]).annotate({
7942 description:
7943 "All possible requests that a client can send to an agent.\n\nThis enum is used internally for routing RPC requests. You typically won't need\nto use this directly.\n\nThis enum encompasses all method calls from client to agent.",
7944 }),
7945 Schema.Null,
7946 ]).annotate({ description: "Method-specific request parameters." }),
7947 ),
7948}).annotate({ description: "A JSON-RPC request object." });
7949
7950export type ClientResponse =
7951 | {
7952 readonly id: RequestId;
7953 readonly result:
7954 | WriteTextFileResponse
7955 | ReadTextFileResponse
7956 | RequestPermissionResponse
7957 | CreateTerminalResponse
7958 | TerminalOutputResponse
7959 | ReleaseTerminalResponse
7960 | WaitForTerminalExitResponse
7961 | KillTerminalResponse
7962 | CreateElicitationResponse
7963 | ConnectMcpResponse
7964 | DisconnectMcpResponse
7965 | MessageMcpResponse
7966 | ExtResponse;
7967 }
7968 | { readonly id: RequestId; readonly error: Error };
7969export const ClientResponse = Schema.Union([
7970 Schema.Struct({
7971 id: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({
7972 description: "The id of the request this response answers.",
7973 }),
7974 result: Schema.Union([
7975 Schema.suspend((): Schema.Codec<WriteTextFileResponse> => WriteTextFileResponse).annotate({
7976 title: "WriteTextFileResponse",
7977 description: "Successful result returned for a `fs/write_text_file` request.",
7978 }),
7979 Schema.suspend((): Schema.Codec<ReadTextFileResponse> => ReadTextFileResponse).annotate({
7980 title: "ReadTextFileResponse",
7981 description: "Successful result returned for a `fs/read_text_file` request.",
7982 }),
7983 Schema.suspend(
7984 (): Schema.Codec<RequestPermissionResponse> => RequestPermissionResponse,
7985 ).annotate({
7986 title: "RequestPermissionResponse",
7987 description: "Successful result returned for a `session/request_permission` request.",
7988 }),
7989 Schema.suspend((): Schema.Codec<CreateTerminalResponse> => CreateTerminalResponse).annotate({
7990 title: "CreateTerminalResponse",
7991 description: "Successful result returned for a `terminal/create` request.",
7992 }),
7993 Schema.suspend((): Schema.Codec<TerminalOutputResponse> => TerminalOutputResponse).annotate({
7994 title: "TerminalOutputResponse",
7995 description: "Successful result returned for a `terminal/output` request.",
7996 }),
7997 Schema.suspend((): Schema.Codec<ReleaseTerminalResponse> => ReleaseTerminalResponse).annotate(
7998 {
7999 title: "ReleaseTerminalResponse",
8000 description: "Successful result returned for a `terminal/release` request.",
8001 },
8002 ),
8003 Schema.suspend(
8004 (): Schema.Codec<WaitForTerminalExitResponse> => WaitForTerminalExitResponse,
8005 ).annotate({
8006 title: "WaitForTerminalExitResponse",
8007 description: "Successful result returned for a `terminal/wait_for_exit` request.",
8008 }),
8009 Schema.suspend((): Schema.Codec<KillTerminalResponse> => KillTerminalResponse).annotate({
8010 title: "KillTerminalResponse",
8011 description: "Successful result returned for a `terminal/kill` request.",
8012 }),
8013 Schema.suspend(
8014 (): Schema.Codec<CreateElicitationResponse> => CreateElicitationResponse,
8015 ).annotate({
8016 title: "CreateElicitationResponse",
8017 description: "Successful result returned for a `elicitation/create` request.",
8018 }),
8019 Schema.suspend((): Schema.Codec<ConnectMcpResponse> => ConnectMcpResponse).annotate({
8020 title: "ConnectMcpResponse",
8021 description: "Successful result returned for a `mcp/connect` request.",
8022 }),
8023 Schema.suspend((): Schema.Codec<DisconnectMcpResponse> => DisconnectMcpResponse).annotate({
8024 title: "DisconnectMcpResponse",
8025 description: "Successful result returned for a `mcp/disconnect` request.",
8026 }),
8027 Schema.suspend((): Schema.Codec<MessageMcpResponse> => MessageMcpResponse).annotate({
8028 title: "MessageMcpResponse",
8029 description: "Successful result returned by an MCP-over-ACP `mcp/message` request.",
8030 }),
8031 Schema.suspend((): Schema.Codec<ExtResponse> => ExtResponse).annotate({
8032 title: "ExtMethodResponse",
8033 description:
8034 "Successful result returned by an extension method outside the core ACP method set.",
8035 }),
8036 ]).annotate({ description: "Method-specific response data." }),
8037 }).annotate({ title: "Result", description: "A successful JSON-RPC response." }),
8038 Schema.Struct({
8039 id: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({
8040 description: "The id of the request this response answers.",
8041 }),
8042 error: Schema.suspend((): Schema.Codec<Error> => Error).annotate({
8043 description: "Method-specific error data.",
8044 }),
8045 }).annotate({ title: "Error", description: "A failed JSON-RPC response." }),
8046]).annotate({ description: "A JSON-RPC response object." });
8047
8048export type CompactionSummaryChunk = {
8049 readonly compactionId: CompactionId;
8050 readonly content: ContentBlock;
8051 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8052};
8053export const CompactionSummaryChunk = Schema.Struct({
8054 compactionId: Schema.suspend((): Schema.Codec<CompactionId> => CompactionId).annotate({
8055 description: "ID of the compaction whose summary receives this content.",
8056 }),
8057 content: Schema.suspend((): Schema.Codec<ContentBlock> => ContentBlock).annotate({
8058 description: "One content block to append.",
8059 }),
8060 _meta: Schema.optionalKey(
8061 Schema.Union([
8062 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8063 description: "Metadata scoped to this chunk. Omission and `null` both mean absent.",
8064 }),
8065 Schema.Null,
8066 ]),
8067 ),
8068}).annotate({
8069 description:
8070 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA content block appended to the retained summary of an in-progress\ncompaction. Agents send chunks only after an `in_progress` update and before\nthe terminal update for the same ID. Agents MUST only send this update when\nthe Client advertised [`ClientSessionCapabilities::compaction`].",
8071});
8072
8073export type CompactionUpdate = {
8074 readonly compactionId: CompactionId;
8075 readonly status: CompactionStatus;
8076 readonly summary?: ReadonlyArray<ContentBlock> | null;
8077 readonly error?: string | null;
8078 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8079};
8080export const CompactionUpdate = Schema.Struct({
8081 compactionId: Schema.suspend((): Schema.Codec<CompactionId> => CompactionId).annotate({
8082 description: "The Agent-owned ID of this compaction, unique within the session.",
8083 }),
8084 status: Schema.suspend((): Schema.Codec<CompactionStatus> => CompactionStatus).annotate({
8085 description: "Current lifecycle status.",
8086 }),
8087 summary: Schema.optionalKey(
8088 Schema.Union([
8089 Schema.Array(ContentBlock).annotate({
8090 description: "Complete replacement user-displayable summary retained by the compaction.",
8091 }),
8092 Schema.Null,
8093 ]),
8094 ),
8095 error: Schema.optionalKey(
8096 Schema.Union([
8097 Schema.String.annotate({
8098 description: "Human-readable description of why the compaction failed.",
8099 }),
8100 Schema.Null,
8101 ]),
8102 ),
8103 _meta: Schema.optionalKey(
8104 Schema.Union([
8105 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8106 description: "Extensible metadata patch for this compaction.",
8107 }),
8108 Schema.Null,
8109 ]),
8110 ),
8111}).annotate({
8112 description:
8113 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA context compaction upsert. The first update fixes the compaction's\ntimeline position. Later updates with the same ID patch that entity in place.\nAgents MUST only send this update when the Client advertised\n[`ClientSessionCapabilities::compaction`].\n\n`summary`, `error`, and `_meta` have patch semantics: omission leaves the\nstored value unchanged, `null` clears it, and a concrete value replaces it.\n`summary: []` also clears the retained summary. A non-empty summary is only\nvalid with `completed`; `error` is only valid with `failed`.",
8114});
8115
8116export type ConfigOptionUpdate = {
8117 readonly configOptions: ReadonlyArray<SessionConfigOption>;
8118 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8119};
8120export const ConfigOptionUpdate = Schema.Struct({
8121 configOptions: Schema.Array(SessionConfigOption).annotate({
8122 description: "The full set of configuration options and their current values.",
8123 }),
8124 _meta: Schema.optionalKey(
8125 Schema.Union([
8126 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8127 description:
8128 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8129 }),
8130 Schema.Null,
8131 ]),
8132 ),
8133}).annotate({ description: "Session configuration options have been updated." });
8134
8135export type Content = {
8136 readonly content: ContentBlock;
8137 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8138};
8139export const Content = Schema.Struct({
8140 content: Schema.suspend((): Schema.Codec<ContentBlock> => ContentBlock).annotate({
8141 description: "The actual content block.",
8142 }),
8143 _meta: Schema.optionalKey(
8144 Schema.Union([
8145 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8146 description:
8147 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8148 }),
8149 Schema.Null,
8150 ]),
8151 ),
8152}).annotate({ description: "Standard content block (text, images, resources)." });
8153
8154export type ContentChunk = {
8155 readonly content: ContentBlock;
8156 readonly messageId?: MessageId | null;
8157 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8158};
8159export const ContentChunk = Schema.Struct({
8160 content: Schema.suspend((): Schema.Codec<ContentBlock> => ContentBlock).annotate({
8161 description: "A single item of content",
8162 }),
8163 messageId: Schema.optionalKey(
8164 Schema.Union([MessageId, Schema.Null]).annotate({
8165 description:
8166 "A unique identifier for the message this chunk belongs to.\n\nAll chunks belonging to the same message share the same `messageId`.\nA change in `messageId` indicates a new message has started.",
8167 }),
8168 ),
8169 _meta: Schema.optionalKey(
8170 Schema.Union([
8171 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8172 description:
8173 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8174 }),
8175 Schema.Null,
8176 ]),
8177 ),
8178}).annotate({ description: "A streamed item of content" });
8179
8180export type CurrentModeUpdate = {
8181 readonly currentModeId: SessionModeId;
8182 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8183};
8184export const CurrentModeUpdate = Schema.Struct({
8185 currentModeId: Schema.suspend((): Schema.Codec<SessionModeId> => SessionModeId).annotate({
8186 description: "The ID of the current mode",
8187 }),
8188 _meta: Schema.optionalKey(
8189 Schema.Union([
8190 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8191 description:
8192 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8193 }),
8194 Schema.Null,
8195 ]),
8196 ),
8197}).annotate({
8198 description:
8199 "The current mode of the session has changed\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)",
8200});
8201
8202export type Diff = {
8203 readonly path: string;
8204 readonly oldText?: string | null;
8205 readonly newText: string;
8206 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8207};
8208export const Diff = Schema.Struct({
8209 path: Schema.String.annotate({ description: "The absolute file path being modified." }),
8210 oldText: Schema.optionalKey(
8211 Schema.Union([
8212 Schema.String.annotate({ description: "The original content (None for new files)." }),
8213 Schema.Null,
8214 ]),
8215 ),
8216 newText: Schema.String.annotate({ description: "The new content after modification." }),
8217 _meta: Schema.optionalKey(
8218 Schema.Union([
8219 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8220 description:
8221 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8222 }),
8223 Schema.Null,
8224 ]),
8225 ),
8226}).annotate({
8227 description:
8228 "A diff representing file modifications.\n\nShows changes to files in a format suitable for display in the client UI.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/tool-calls#content)",
8229});
8230
8231export type ElicitationAcceptAction = {
8232 readonly content?: { readonly [x: string]: ElicitationContentValue } | null;
8233};
8234export const ElicitationAcceptAction = Schema.Struct({
8235 content: Schema.optionalKey(
8236 Schema.Union([
8237 Schema.Record(Schema.String, ElicitationContentValue).annotate({
8238 description:
8239 "The user-provided content, if any, as an object matching the requested schema.",
8240 }),
8241 Schema.Null,
8242 ]),
8243 ),
8244}).annotate({ description: "The user accepted the elicitation and provided content." });
8245
8246export type ElicitationFormMode =
8247 | {
8248 readonly requestedSchema: ElicitationSchema;
8249 readonly sessionId: SessionId;
8250 readonly toolCallId?: ToolCallId | null;
8251 }
8252 | { readonly requestedSchema: ElicitationSchema; readonly requestId: RequestId };
8253export const ElicitationFormMode = Schema.Union([
8254 Schema.Struct({
8255 requestedSchema: Schema.suspend(
8256 (): Schema.Codec<ElicitationSchema> => ElicitationSchema,
8257 ).annotate({ description: "A JSON Schema describing the form fields to present to the user." }),
8258 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
8259 description: "The session this elicitation is tied to.",
8260 }),
8261 toolCallId: Schema.optionalKey(
8262 Schema.Union([ToolCallId, Schema.Null]).annotate({
8263 description:
8264 "Optional tool call within the session.\n\nOptional. Omitted and `null` are equivalent and mean the elicitation is scoped to the\nsession without a specific tool call.",
8265 }),
8266 ),
8267 }).annotate({
8268 description:
8269 "Session-scoped elicitation, optionally tied to a specific tool call.\n\nWhen `tool_call_id` is set, the elicitation is tied to a specific tool call.\nThis is useful when an agent receives an elicitation from an MCP server\nduring a tool call and needs to redirect it to the user.",
8270 }),
8271 Schema.Struct({
8272 requestedSchema: Schema.suspend(
8273 (): Schema.Codec<ElicitationSchema> => ElicitationSchema,
8274 ).annotate({ description: "A JSON Schema describing the form fields to present to the user." }),
8275 requestId: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({
8276 description: "The request this elicitation is tied to.",
8277 }),
8278 }).annotate({
8279 description:
8280 "Request-scoped elicitation, tied to a specific JSON-RPC request outside of a session\n(e.g., during auth/configuration phases before any session is started).",
8281 }),
8282]);
8283
8284export type ElicitationRequestScope = { readonly requestId: RequestId };
8285export const ElicitationRequestScope = Schema.Struct({
8286 requestId: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({
8287 description: "The request this elicitation is tied to.",
8288 }),
8289}).annotate({
8290 description:
8291 "Request-scoped elicitation, tied to a specific JSON-RPC request outside of a session\n(e.g., during auth/configuration phases before any session is started).",
8292});
8293
8294export type ElicitationSessionScope = {
8295 readonly sessionId: SessionId;
8296 readonly toolCallId?: ToolCallId | null;
8297};
8298export const ElicitationSessionScope = Schema.Struct({
8299 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
8300 description: "The session this elicitation is tied to.",
8301 }),
8302 toolCallId: Schema.optionalKey(
8303 Schema.Union([ToolCallId, Schema.Null]).annotate({
8304 description:
8305 "Optional tool call within the session.\n\nOptional. Omitted and `null` are equivalent and mean the elicitation is scoped to the\nsession without a specific tool call.",
8306 }),
8307 ),
8308}).annotate({
8309 description:
8310 "Session-scoped elicitation, optionally tied to a specific tool call.\n\nWhen `tool_call_id` is set, the elicitation is tied to a specific tool call.\nThis is useful when an agent receives an elicitation from an MCP server\nduring a tool call and needs to redirect it to the user.",
8311});
8312
8313export type ElicitationUrlMode =
8314 | {
8315 readonly elicitationId: ElicitationId;
8316 readonly url: string;
8317 readonly sessionId: SessionId;
8318 readonly toolCallId?: ToolCallId | null;
8319 }
8320 | { readonly elicitationId: ElicitationId; readonly url: string; readonly requestId: RequestId };
8321export const ElicitationUrlMode = Schema.Union([
8322 Schema.Struct({
8323 elicitationId: Schema.suspend((): Schema.Codec<ElicitationId> => ElicitationId).annotate({
8324 description: "The unique identifier for this elicitation.",
8325 }),
8326 url: Schema.String.annotate({ description: "The URL to direct the user to.", format: "uri" }),
8327 sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({
8328 description: "The session this elicitation is tied to.",
8329 }),
8330 toolCallId: Schema.optionalKey(
8331 Schema.Union([ToolCallId, Schema.Null]).annotate({
8332 description:
8333 "Optional tool call within the session.\n\nOptional. Omitted and `null` are equivalent and mean the elicitation is scoped to the\nsession without a specific tool call.",
8334 }),
8335 ),
8336 }).annotate({
8337 description:
8338 "Session-scoped elicitation, optionally tied to a specific tool call.\n\nWhen `tool_call_id` is set, the elicitation is tied to a specific tool call.\nThis is useful when an agent receives an elicitation from an MCP server\nduring a tool call and needs to redirect it to the user.",
8339 }),
8340 Schema.Struct({
8341 elicitationId: Schema.suspend((): Schema.Codec<ElicitationId> => ElicitationId).annotate({
8342 description: "The unique identifier for this elicitation.",
8343 }),
8344 url: Schema.String.annotate({ description: "The URL to direct the user to.", format: "uri" }),
8345 requestId: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({
8346 description: "The request this elicitation is tied to.",
8347 }),
8348 }).annotate({
8349 description:
8350 "Request-scoped elicitation, tied to a specific JSON-RPC request outside of a session\n(e.g., during auth/configuration phases before any session is started).",
8351 }),
8352]);
8353
8354export type EmbeddedResource = {
8355 readonly annotations?: Annotations | null;
8356 readonly resource: EmbeddedResourceResource;
8357 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8358};
8359export const EmbeddedResource = Schema.Struct({
8360 annotations: Schema.optionalKey(
8361 Schema.Union([Annotations, Schema.Null]).annotate({
8362 description:
8363 "Optional annotations that help clients decide how to display or route this content.",
8364 }),
8365 ),
8366 resource: Schema.suspend(
8367 (): Schema.Codec<EmbeddedResourceResource> => EmbeddedResourceResource,
8368 ).annotate({ description: "Embedded resource payload, either text or binary data." }),
8369 _meta: Schema.optionalKey(
8370 Schema.Union([
8371 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8372 description:
8373 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8374 }),
8375 Schema.Null,
8376 ]),
8377 ),
8378}).annotate({
8379 description: "The contents of a resource, embedded into a prompt or tool call result.",
8380});
8381
8382export type ImageContent = {
8383 readonly annotations?: Annotations | null;
8384 readonly data: string;
8385 readonly mimeType: string;
8386 readonly uri?: string | null;
8387 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8388};
8389export const ImageContent = Schema.Struct({
8390 annotations: Schema.optionalKey(
8391 Schema.Union([Annotations, Schema.Null]).annotate({
8392 description:
8393 "Optional annotations that help clients decide how to display or route this content.",
8394 }),
8395 ),
8396 data: Schema.String.annotate({ description: "Base64-encoded media payload." }),
8397 mimeType: Schema.String.annotate({
8398 description: "MIME type describing the encoded media payload.",
8399 }),
8400 uri: Schema.optionalKey(
8401 Schema.Union([
8402 Schema.String.annotate({
8403 description: "URI associated with this resource or media payload.",
8404 }),
8405 Schema.Null,
8406 ]),
8407 ),
8408 _meta: Schema.optionalKey(
8409 Schema.Union([
8410 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8411 description:
8412 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8413 }),
8414 Schema.Null,
8415 ]),
8416 ),
8417}).annotate({ description: "An image provided to or from an LLM." });
8418
8419export type IntegerPropertySchema = {
8420 readonly title?: string | null;
8421 readonly description?: string | null;
8422 readonly minimum?: number | null;
8423 readonly maximum?: number | null;
8424 readonly default?: number | null;
8425 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8426};
8427export const IntegerPropertySchema = Schema.Struct({
8428 title: Schema.optionalKey(
8429 Schema.Union([
8430 Schema.String.annotate({
8431 description:
8432 "Optional title for the property.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.",
8433 }),
8434 Schema.Null,
8435 ]),
8436 ),
8437 description: Schema.optionalKey(
8438 Schema.Union([
8439 Schema.String.annotate({
8440 description:
8441 "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.",
8442 }),
8443 Schema.Null,
8444 ]),
8445 ),
8446 minimum: Schema.optionalKey(
8447 Schema.Union([
8448 Schema.Number.annotate({
8449 description:
8450 "Minimum value (inclusive).\n\nOptional. Omitted and `null` are equivalent and mean there is no inclusive lower bound.",
8451 format: "int64",
8452 }).check(Schema.isInt().annotate({ expected: "an integer" })),
8453 Schema.Null,
8454 ]),
8455 ),
8456 maximum: Schema.optionalKey(
8457 Schema.Union([
8458 Schema.Number.annotate({
8459 description:
8460 "Maximum value (inclusive).\n\nOptional. Omitted and `null` are equivalent and mean there is no inclusive upper bound.",
8461 format: "int64",
8462 }).check(Schema.isInt().annotate({ expected: "an integer" })),
8463 Schema.Null,
8464 ]),
8465 ),
8466 default: Schema.optionalKey(
8467 Schema.Union([
8468 Schema.Number.annotate({
8469 description:
8470 "Default value.\n\nOptional. Omitted and `null` are equivalent and mean no default value is provided.",
8471 format: "int64",
8472 }).check(Schema.isInt().annotate({ expected: "an integer" })),
8473 Schema.Null,
8474 ]),
8475 ),
8476 _meta: Schema.optionalKey(
8477 Schema.Union([
8478 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8479 description:
8480 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8481 }),
8482 Schema.Null,
8483 ]),
8484 ),
8485}).annotate({ description: "Schema for integer properties in an elicitation form." });
8486
8487export type McpServerAcp = {
8488 readonly name: string;
8489 readonly serverId: McpServerAcpId;
8490 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8491};
8492export const McpServerAcp = Schema.Struct({
8493 name: Schema.String.annotate({ description: "Human-readable name identifying this MCP server." }),
8494 serverId: Schema.suspend((): Schema.Codec<McpServerAcpId> => McpServerAcpId).annotate({
8495 description:
8496 "Unique identifier for this MCP server, generated by the component providing it.\n\nProviders MUST NOT reuse an ID for multiple ACP-transport MCP servers that are visible\non the same ACP connection.",
8497 }),
8498 _meta: Schema.optionalKey(
8499 Schema.Union([
8500 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8501 description:
8502 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8503 }),
8504 Schema.Null,
8505 ]),
8506 ),
8507}).annotate({
8508 description:
8509 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nACP transport configuration for MCP.\n\nThe MCP server is provided by an ACP component and communicates over the ACP channel\nusing `mcp/connect`, `mcp/message`, and `mcp/disconnect`.",
8510});
8511
8512export type McpServerHttp = {
8513 readonly name: string;
8514 readonly url: string;
8515 readonly headers: ReadonlyArray<HttpHeader>;
8516 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8517};
8518export const McpServerHttp = Schema.Struct({
8519 name: Schema.String.annotate({ description: "Human-readable name identifying this MCP server." }),
8520 url: Schema.String.annotate({ description: "URL to the MCP server." }),
8521 headers: Schema.Array(HttpHeader).annotate({
8522 description: "HTTP headers to set when making requests to the MCP server.",
8523 }),
8524 _meta: Schema.optionalKey(
8525 Schema.Union([
8526 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8527 description:
8528 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8529 }),
8530 Schema.Null,
8531 ]),
8532 ),
8533}).annotate({ description: "HTTP transport configuration for MCP." });
8534
8535export type McpServerSse = {
8536 readonly name: string;
8537 readonly url: string;
8538 readonly headers: ReadonlyArray<HttpHeader>;
8539 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8540};
8541export const McpServerSse = Schema.Struct({
8542 name: Schema.String.annotate({ description: "Human-readable name identifying this MCP server." }),
8543 url: Schema.String.annotate({ description: "URL to the MCP server." }),
8544 headers: Schema.Array(HttpHeader).annotate({
8545 description: "HTTP headers to set when making requests to the MCP server.",
8546 }),
8547 _meta: Schema.optionalKey(
8548 Schema.Union([
8549 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8550 description:
8551 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8552 }),
8553 Schema.Null,
8554 ]),
8555 ),
8556}).annotate({ description: "SSE transport configuration for MCP." });
8557
8558export type MultiSelectPropertySchema = {
8559 readonly title?: string | null;
8560 readonly description?: string | null;
8561 readonly minItems?: number | null;
8562 readonly maxItems?: number | null;
8563 readonly items: MultiSelectItems;
8564 readonly default?: ReadonlyArray<string> | null;
8565 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8566};
8567export const MultiSelectPropertySchema = Schema.Struct({
8568 title: Schema.optionalKey(
8569 Schema.Union([
8570 Schema.String.annotate({
8571 description:
8572 "Optional title for the property.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.",
8573 }),
8574 Schema.Null,
8575 ]),
8576 ),
8577 description: Schema.optionalKey(
8578 Schema.Union([
8579 Schema.String.annotate({
8580 description:
8581 "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.",
8582 }),
8583 Schema.Null,
8584 ]),
8585 ),
8586 minItems: Schema.optionalKey(
8587 Schema.Union([
8588 Schema.Number.annotate({
8589 description:
8590 "Minimum number of items to select.\n\nOptional. Omitted and `null` are equivalent and mean there is no minimum selection count.",
8591 format: "uint64",
8592 })
8593 .check(Schema.isInt().annotate({ expected: "an integer" }))
8594 .check(
8595 Schema.isGreaterThanOrEqualTo(0).annotate({
8596 expected: "a value greater than or equal to 0",
8597 }),
8598 ),
8599 Schema.Null,
8600 ]),
8601 ),
8602 maxItems: Schema.optionalKey(
8603 Schema.Union([
8604 Schema.Number.annotate({
8605 description:
8606 "Maximum number of items to select.\n\nOptional. Omitted and `null` are equivalent and mean there is no maximum selection count.",
8607 format: "uint64",
8608 })
8609 .check(Schema.isInt().annotate({ expected: "an integer" }))
8610 .check(
8611 Schema.isGreaterThanOrEqualTo(0).annotate({
8612 expected: "a value greater than or equal to 0",
8613 }),
8614 ),
8615 Schema.Null,
8616 ]),
8617 ),
8618 items: Schema.suspend((): Schema.Codec<MultiSelectItems> => MultiSelectItems).annotate({
8619 description: "The items definition describing allowed values.",
8620 }),
8621 default: Schema.optionalKey(
8622 Schema.Union([
8623 Schema.Array(Schema.String).annotate({
8624 description:
8625 "Default selected values.\n\nOptional. Omitted and `null` are equivalent and mean no default selections are provided.",
8626 }),
8627 Schema.Null,
8628 ]),
8629 ),
8630 _meta: Schema.optionalKey(
8631 Schema.Union([
8632 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8633 description:
8634 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8635 }),
8636 Schema.Null,
8637 ]),
8638 ),
8639}).annotate({ description: "Schema for multi-select (array) properties in an elicitation form." });
8640
8641export type NesEditSuggestion = {
8642 readonly id: NesSuggestionId;
8643 readonly uri: string;
8644 readonly edits: ReadonlyArray<NesTextEdit>;
8645 readonly cursorPosition?: Position | null;
8646 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8647};
8648export const NesEditSuggestion = Schema.Struct({
8649 id: Schema.suspend((): Schema.Codec<NesSuggestionId> => NesSuggestionId).annotate({
8650 description: "Unique identifier for accept/reject tracking.",
8651 }),
8652 uri: Schema.String.annotate({ description: "The URI of the file to edit." }),
8653 edits: Schema.Array(NesTextEdit).annotate({ description: "The text edits to apply." }),
8654 cursorPosition: Schema.optionalKey(
8655 Schema.Union([Position, Schema.Null]).annotate({
8656 description: "Optional suggested cursor position after applying edits.",
8657 }),
8658 ),
8659 _meta: Schema.optionalKey(
8660 Schema.Union([
8661 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8662 description:
8663 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8664 }),
8665 Schema.Null,
8666 ]),
8667 ),
8668}).annotate({ description: "A text edit suggestion." });
8669
8670export type NesJumpSuggestion = {
8671 readonly id: NesSuggestionId;
8672 readonly uri: string;
8673 readonly position: Position;
8674 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8675};
8676export const NesJumpSuggestion = Schema.Struct({
8677 id: Schema.suspend((): Schema.Codec<NesSuggestionId> => NesSuggestionId).annotate({
8678 description: "Unique identifier for accept/reject tracking.",
8679 }),
8680 uri: Schema.String.annotate({ description: "The file to navigate to." }),
8681 position: Schema.suspend((): Schema.Codec<Position> => Position).annotate({
8682 description: "The target position within the file.",
8683 }),
8684 _meta: Schema.optionalKey(
8685 Schema.Union([
8686 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8687 description:
8688 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8689 }),
8690 Schema.Null,
8691 ]),
8692 ),
8693}).annotate({ description: "A jump-to-location suggestion." });
8694
8695export type NesRenameSuggestion = {
8696 readonly id: NesSuggestionId;
8697 readonly uri: string;
8698 readonly position: Position;
8699 readonly newName: string;
8700 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8701};
8702export const NesRenameSuggestion = Schema.Struct({
8703 id: Schema.suspend((): Schema.Codec<NesSuggestionId> => NesSuggestionId).annotate({
8704 description: "Unique identifier for accept/reject tracking.",
8705 }),
8706 uri: Schema.String.annotate({ description: "The file URI containing the symbol." }),
8707 position: Schema.suspend((): Schema.Codec<Position> => Position).annotate({
8708 description: "The position of the symbol to rename.",
8709 }),
8710 newName: Schema.String.annotate({ description: "The new name for the symbol." }),
8711 _meta: Schema.optionalKey(
8712 Schema.Union([
8713 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8714 description:
8715 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8716 }),
8717 Schema.Null,
8718 ]),
8719 ),
8720}).annotate({ description: "A rename symbol suggestion." });
8721
8722export type NesSearchAndReplaceSuggestion = {
8723 readonly id: NesSuggestionId;
8724 readonly uri: string;
8725 readonly search: string;
8726 readonly replace: string;
8727 readonly isRegex?: boolean | null;
8728 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8729};
8730export const NesSearchAndReplaceSuggestion = Schema.Struct({
8731 id: Schema.suspend((): Schema.Codec<NesSuggestionId> => NesSuggestionId).annotate({
8732 description: "Unique identifier for accept/reject tracking.",
8733 }),
8734 uri: Schema.String.annotate({ description: "The file URI to search within." }),
8735 search: Schema.String.annotate({ description: "The text or pattern to find." }),
8736 replace: Schema.String.annotate({ description: "The replacement text." }),
8737 isRegex: Schema.optionalKey(
8738 Schema.Union([
8739 Schema.Boolean.annotate({
8740 description: "Whether `search` is a regular expression. Defaults to `false`.",
8741 }),
8742 Schema.Null,
8743 ]),
8744 ),
8745 _meta: Schema.optionalKey(
8746 Schema.Union([
8747 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8748 description:
8749 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8750 }),
8751 Schema.Null,
8752 ]),
8753 ),
8754}).annotate({ description: "A search-and-replace suggestion." });
8755
8756export type NumberPropertySchema = {
8757 readonly title?: string | null;
8758 readonly description?: string | null;
8759 readonly minimum?: number | null;
8760 readonly maximum?: number | null;
8761 readonly default?: number | null;
8762 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8763};
8764export const NumberPropertySchema = Schema.Struct({
8765 title: Schema.optionalKey(
8766 Schema.Union([
8767 Schema.String.annotate({
8768 description:
8769 "Optional title for the property.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.",
8770 }),
8771 Schema.Null,
8772 ]),
8773 ),
8774 description: Schema.optionalKey(
8775 Schema.Union([
8776 Schema.String.annotate({
8777 description:
8778 "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.",
8779 }),
8780 Schema.Null,
8781 ]),
8782 ),
8783 minimum: Schema.optionalKey(
8784 Schema.Union([
8785 Schema.Number.annotate({
8786 description:
8787 "Minimum value (inclusive).\n\nOptional. Omitted and `null` are equivalent and mean there is no inclusive lower bound.",
8788 format: "double",
8789 }).check(Schema.isFinite().annotate({ expected: "a finite number" })),
8790 Schema.Null,
8791 ]),
8792 ),
8793 maximum: Schema.optionalKey(
8794 Schema.Union([
8795 Schema.Number.annotate({
8796 description:
8797 "Maximum value (inclusive).\n\nOptional. Omitted and `null` are equivalent and mean there is no inclusive upper bound.",
8798 format: "double",
8799 }).check(Schema.isFinite().annotate({ expected: "a finite number" })),
8800 Schema.Null,
8801 ]),
8802 ),
8803 default: Schema.optionalKey(
8804 Schema.Union([
8805 Schema.Number.annotate({
8806 description:
8807 "Default value.\n\nOptional. Omitted and `null` are equivalent and mean no default value is provided.",
8808 format: "double",
8809 }).check(Schema.isFinite().annotate({ expected: "a finite number" })),
8810 Schema.Null,
8811 ]),
8812 ),
8813 _meta: Schema.optionalKey(
8814 Schema.Union([
8815 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8816 description:
8817 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8818 }),
8819 Schema.Null,
8820 ]),
8821 ),
8822}).annotate({
8823 description: "Schema for number (floating-point) properties in an elicitation form.",
8824});
8825
8826export type Plan = {
8827 readonly entries: ReadonlyArray<PlanEntry>;
8828 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8829};
8830export const Plan = Schema.Struct({
8831 entries: Schema.Array(PlanEntry).annotate({
8832 description:
8833 "The list of tasks to be accomplished.\n\nWhen updating a plan, the agent must send a complete list of all entries\nwith their current status. The client replaces the entire plan with each update.",
8834 }),
8835 _meta: Schema.optionalKey(
8836 Schema.Union([
8837 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8838 description:
8839 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8840 }),
8841 Schema.Null,
8842 ]),
8843 ),
8844}).annotate({
8845 description:
8846 "An execution plan for accomplishing complex tasks.\n\nPlans consist of multiple entries representing individual tasks or goals.\nAgents report plans to clients to provide visibility into their execution strategy.\nPlans can evolve during execution as the agent discovers new requirements or completes tasks.\n\nSee protocol docs: [Agent Plan](https://agentclientprotocol.com/protocol/agent-plan)",
8847});
8848
8849export type PlanFile = {
8850 readonly planId: PlanId;
8851 readonly uri: string;
8852 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8853};
8854export const PlanFile = Schema.Struct({
8855 planId: Schema.suspend((): Schema.Codec<PlanId> => PlanId).annotate({
8856 description: "The plan ID to update.",
8857 }),
8858 uri: Schema.String.annotate({ description: "The URI of the file containing the plan." }),
8859 _meta: Schema.optionalKey(
8860 Schema.Union([
8861 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8862 description:
8863 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8864 }),
8865 Schema.Null,
8866 ]),
8867 ),
8868}).annotate({
8869 description:
8870 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA plan represented by a file URI.",
8871});
8872
8873export type PlanItems = {
8874 readonly planId: PlanId;
8875 readonly entries: ReadonlyArray<PlanEntry>;
8876 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8877};
8878export const PlanItems = Schema.Struct({
8879 planId: Schema.suspend((): Schema.Codec<PlanId> => PlanId).annotate({
8880 description: "The plan ID to update.",
8881 }),
8882 entries: Schema.Array(PlanEntry).annotate({
8883 description:
8884 "The list of tasks to be accomplished.\n\nWhen updating an item-based plan, the agent must send a complete list of all entries\nwith their current status. The client replaces that plan with each update.",
8885 }),
8886 _meta: Schema.optionalKey(
8887 Schema.Union([
8888 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8889 description:
8890 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8891 }),
8892 Schema.Null,
8893 ]),
8894 ),
8895}).annotate({
8896 description:
8897 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA plan represented as structured entries.",
8898});
8899
8900export type PlanMarkdown = {
8901 readonly planId: PlanId;
8902 readonly content: string;
8903 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8904};
8905export const PlanMarkdown = Schema.Struct({
8906 planId: Schema.suspend((): Schema.Codec<PlanId> => PlanId).annotate({
8907 description: "The plan ID to update.",
8908 }),
8909 content: Schema.String.annotate({ description: "Markdown content for the plan." }),
8910 _meta: Schema.optionalKey(
8911 Schema.Union([
8912 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8913 description:
8914 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8915 }),
8916 Schema.Null,
8917 ]),
8918 ),
8919}).annotate({
8920 description:
8921 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA plan represented as raw markdown content.",
8922});
8923
8924export type PlanRemoved = {
8925 readonly planId: PlanId;
8926 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8927};
8928export const PlanRemoved = Schema.Struct({
8929 planId: Schema.suspend((): Schema.Codec<PlanId> => PlanId).annotate({
8930 description: "The plan ID to remove.",
8931 }),
8932 _meta: Schema.optionalKey(
8933 Schema.Union([
8934 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8935 description:
8936 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8937 }),
8938 Schema.Null,
8939 ]),
8940 ),
8941}).annotate({
8942 description:
8943 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRemoval notice for a plan identified by ID.",
8944});
8945
8946export type PlanUpdate = {
8947 readonly plan: PlanUpdateContent;
8948 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8949};
8950export const PlanUpdate = Schema.Struct({
8951 plan: Schema.suspend((): Schema.Codec<PlanUpdateContent> => PlanUpdateContent).annotate({
8952 description: "The updated plan content.",
8953 }),
8954 _meta: Schema.optionalKey(
8955 Schema.Union([
8956 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
8957 description:
8958 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
8959 }),
8960 Schema.Null,
8961 ]),
8962 ),
8963}).annotate({
8964 description:
8965 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA content update for a plan identified by ID.",
8966});
8967
8968export type ResourceLink = {
8969 readonly annotations?: Annotations | null;
8970 readonly description?: string | null;
8971 readonly mimeType?: string | null;
8972 readonly name: string;
8973 readonly size?: number | null;
8974 readonly title?: string | null;
8975 readonly uri: string;
8976 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
8977};
8978export const ResourceLink = Schema.Struct({
8979 annotations: Schema.optionalKey(
8980 Schema.Union([Annotations, Schema.Null]).annotate({
8981 description:
8982 "Optional annotations that help clients decide how to display or route this content.",
8983 }),
8984 ),
8985 description: Schema.optionalKey(
8986 Schema.Union([
8987 Schema.String.annotate({
8988 description: "Optional human-readable details shown with this protocol object.",
8989 }),
8990 Schema.Null,
8991 ]),
8992 ),
8993 mimeType: Schema.optionalKey(
8994 Schema.Union([
8995 Schema.String.annotate({ description: "MIME type describing the encoded media payload." }),
8996 Schema.Null,
8997 ]),
8998 ),
8999 name: Schema.String.annotate({
9000 description: "Human-readable name shown for this protocol object.",
9001 }),
9002 size: Schema.optionalKey(
9003 Schema.Union([
9004 Schema.Number.annotate({
9005 description: "Optional size of the linked resource in bytes, if known.",
9006 format: "int64",
9007 }).check(Schema.isInt().annotate({ expected: "an integer" })),
9008 Schema.Null,
9009 ]),
9010 ),
9011 title: Schema.optionalKey(
9012 Schema.Union([
9013 Schema.String.annotate({ description: "Optional display title for end-user UI." }),
9014 Schema.Null,
9015 ]),
9016 ),
9017 uri: Schema.String.annotate({
9018 description: "URI associated with this resource or media payload.",
9019 }),
9020 _meta: Schema.optionalKey(
9021 Schema.Union([
9022 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
9023 description:
9024 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
9025 }),
9026 Schema.Null,
9027 ]),
9028 ),
9029}).annotate({
9030 description:
9031 "A resource that the server is capable of reading, included in a prompt or tool call result.",
9032});
9033
9034export type SelectedPermissionOutcome = {
9035 readonly optionId: PermissionOptionId;
9036 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
9037};
9038export const SelectedPermissionOutcome = Schema.Struct({
9039 optionId: Schema.suspend((): Schema.Codec<PermissionOptionId> => PermissionOptionId).annotate({
9040 description: "The ID of the option the user selected.",
9041 }),
9042 _meta: Schema.optionalKey(
9043 Schema.Union([
9044 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
9045 description:
9046 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
9047 }),
9048 Schema.Null,
9049 ]),
9050 ),
9051}).annotate({ description: "The user selected one of the provided options." });
9052
9053export type SessionConfigBoolean = { readonly currentValue: boolean };
9054export const SessionConfigBoolean = Schema.Struct({
9055 currentValue: Schema.Boolean.annotate({
9056 description: "The current value of the boolean option.",
9057 }),
9058}).annotate({ description: "A boolean on/off toggle session configuration option payload." });
9059
9060export type SessionConfigSelect = {
9061 readonly currentValue: SessionConfigValueId;
9062 readonly options: SessionConfigSelectOptions;
9063};
9064export const SessionConfigSelect = Schema.Struct({
9065 currentValue: Schema.suspend(
9066 (): Schema.Codec<SessionConfigValueId> => SessionConfigValueId,
9067 ).annotate({ description: "The currently selected value." }),
9068 options: Schema.suspend(
9069 (): Schema.Codec<SessionConfigSelectOptions> => SessionConfigSelectOptions,
9070 ).annotate({ description: "The set of selectable options." }),
9071}).annotate({
9072 description: "A single-value selector (dropdown) session configuration option payload.",
9073});
9074
9075export type SessionInfoUpdate = {
9076 readonly title?: string | null;
9077 readonly updatedAt?: string | null;
9078 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
9079};
9080export const SessionInfoUpdate = Schema.Struct({
9081 title: Schema.optionalKey(
9082 Schema.Union([
9083 Schema.String.annotate({
9084 description: "Human-readable title for the session. Set to null to clear.",
9085 }),
9086 Schema.Null,
9087 ]),
9088 ),
9089 updatedAt: Schema.optionalKey(
9090 Schema.Union([
9091 Schema.String.annotate({
9092 description: "ISO 8601 timestamp of last activity. Set to null to clear.",
9093 }),
9094 Schema.Null,
9095 ]),
9096 ),
9097 _meta: Schema.optionalKey(
9098 Schema.Union([
9099 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
9100 description:
9101 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
9102 }),
9103 Schema.Null,
9104 ]),
9105 ),
9106}).annotate({
9107 description:
9108 "Update to session metadata. All fields are optional to support partial updates.\n\nAgents send this notification to update session information like title or custom metadata.\nThis allows clients to display dynamic session names and track session state changes.",
9109});
9110
9111export type StringMultiSelectItems = {
9112 readonly enum: ReadonlyArray<string>;
9113 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
9114};
9115export const StringMultiSelectItems = Schema.Struct({
9116 enum: Schema.Array(Schema.String).annotate({ description: "Allowed enum values." }),
9117 _meta: Schema.optionalKey(
9118 Schema.Union([
9119 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
9120 description:
9121 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
9122 }),
9123 Schema.Null,
9124 ]),
9125 ),
9126}).annotate({ description: "String item schema for multi-select enum properties." });
9127
9128export type StringPropertySchema = {
9129 readonly title?: string | null;
9130 readonly description?: string | null;
9131 readonly minLength?: number | null;
9132 readonly maxLength?: number | null;
9133 readonly pattern?: string | null;
9134 readonly format?: StringFormat | null;
9135 readonly default?: string | null;
9136 readonly enum?: ReadonlyArray<string> | null;
9137 readonly oneOf?: ReadonlyArray<EnumOption> | null;
9138 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
9139};
9140export const StringPropertySchema = Schema.Struct({
9141 title: Schema.optionalKey(
9142 Schema.Union([
9143 Schema.String.annotate({
9144 description:
9145 "Optional title for the property.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.",
9146 }),
9147 Schema.Null,
9148 ]),
9149 ),
9150 description: Schema.optionalKey(
9151 Schema.Union([
9152 Schema.String.annotate({
9153 description:
9154 "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.",
9155 }),
9156 Schema.Null,
9157 ]),
9158 ),
9159 minLength: Schema.optionalKey(
9160 Schema.Union([
9161 Schema.Number.annotate({
9162 description:
9163 "Minimum string length.\n\nOptional. Omitted and `null` are equivalent and mean there is no minimum length constraint.",
9164 format: "uint32",
9165 })
9166 .check(Schema.isInt().annotate({ expected: "an integer" }))
9167 .check(
9168 Schema.isGreaterThanOrEqualTo(0).annotate({
9169 expected: "a value greater than or equal to 0",
9170 }),
9171 ),
9172 Schema.Null,
9173 ]),
9174 ),
9175 maxLength: Schema.optionalKey(
9176 Schema.Union([
9177 Schema.Number.annotate({
9178 description:
9179 "Maximum string length.\n\nOptional. Omitted and `null` are equivalent and mean there is no maximum length constraint.",
9180 format: "uint32",
9181 })
9182 .check(Schema.isInt().annotate({ expected: "an integer" }))
9183 .check(
9184 Schema.isGreaterThanOrEqualTo(0).annotate({
9185 expected: "a value greater than or equal to 0",
9186 }),
9187 ),
9188 Schema.Null,
9189 ]),
9190 ),
9191 pattern: Schema.optionalKey(
9192 Schema.Union([
9193 Schema.String.annotate({
9194 description:
9195 "Pattern the string must match.\n\nOptional. Omitted and `null` are equivalent and mean there is no pattern constraint.",
9196 }),
9197 Schema.Null,
9198 ]),
9199 ),
9200 format: Schema.optionalKey(
9201 Schema.Union([StringFormat, Schema.Null]).annotate({
9202 description:
9203 "String format.\n\nOptional. Omitted and `null` are equivalent and mean there is no format constraint.",
9204 }),
9205 ),
9206 default: Schema.optionalKey(
9207 Schema.Union([
9208 Schema.String.annotate({
9209 description:
9210 "Default value.\n\nOptional. Omitted and `null` are equivalent and mean no default value is provided.",
9211 }),
9212 Schema.Null,
9213 ]),
9214 ),
9215 enum: Schema.optionalKey(
9216 Schema.Union([
9217 Schema.Array(Schema.String).annotate({
9218 description:
9219 "Enum values for untitled single-select enums.\nOptional. Omitted and `null` are equivalent and mean no untitled single-select choices are\ndeclared by `enum`.",
9220 }),
9221 Schema.Null,
9222 ]),
9223 ),
9224 oneOf: Schema.optionalKey(
9225 Schema.Union([
9226 Schema.Array(EnumOption).annotate({
9227 description:
9228 "Titled enum options for titled single-select enums.\nOptional. Omitted and `null` are equivalent and mean no titled single-select choices are\ndeclared by `oneOf`.",
9229 }),
9230 Schema.Null,
9231 ]),
9232 ),
9233 _meta: Schema.optionalKey(
9234 Schema.Union([
9235 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
9236 description:
9237 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
9238 }),
9239 Schema.Null,
9240 ]),
9241 ),
9242}).annotate({
9243 description:
9244 'Schema for string properties in an elicitation form.\n\nWhen `enum` or `oneOf` is set, this represents a single-select enum\nwith `"type": "string"`.',
9245});
9246
9247export type Terminal = {
9248 readonly terminalId: TerminalId;
9249 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
9250};
9251export const Terminal = Schema.Struct({
9252 terminalId: Schema.suspend((): Schema.Codec<TerminalId> => TerminalId).annotate({
9253 description: "Identifier of the terminal instance to embed in the content stream.",
9254 }),
9255 _meta: Schema.optionalKey(
9256 Schema.Union([
9257 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
9258 description:
9259 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
9260 }),
9261 Schema.Null,
9262 ]),
9263 ),
9264}).annotate({
9265 description:
9266 "Embed a terminal created with `terminal/create` by its id.\n\nThe terminal must be added before calling `terminal/release`.\n\nSee protocol docs: [Terminal](https://agentclientprotocol.com/protocol/terminals)",
9267});
9268
9269export type TextContent = {
9270 readonly annotations?: Annotations | null;
9271 readonly text: string;
9272 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
9273};
9274export const TextContent = Schema.Struct({
9275 annotations: Schema.optionalKey(
9276 Schema.Union([Annotations, Schema.Null]).annotate({
9277 description:
9278 "Optional annotations that help clients decide how to display or route this content.",
9279 }),
9280 ),
9281 text: Schema.String.annotate({ description: "Text payload carried by this content block." }),
9282 _meta: Schema.optionalKey(
9283 Schema.Union([
9284 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
9285 description:
9286 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
9287 }),
9288 Schema.Null,
9289 ]),
9290 ),
9291}).annotate({ description: "Text provided to or from an LLM." });
9292
9293export type ToolCall = {
9294 readonly toolCallId: ToolCallId;
9295 readonly title: string;
9296 readonly name?: string | null;
9297 readonly kind?: ToolKind;
9298 readonly status?: ToolCallStatus;
9299 readonly content?: ReadonlyArray<ToolCallContent>;
9300 readonly locations?: ReadonlyArray<ToolCallLocation>;
9301 readonly rawInput?: Schema.Json;
9302 readonly rawOutput?: Schema.Json;
9303 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
9304};
9305export const ToolCall = Schema.Struct({
9306 toolCallId: Schema.suspend((): Schema.Codec<ToolCallId> => ToolCallId).annotate({
9307 description: "Unique identifier for this tool call within the session.",
9308 }),
9309 title: Schema.String.annotate({
9310 description: "Human-readable title describing what the tool is doing.",
9311 }),
9312 name: Schema.optionalKey(
9313 Schema.Union([
9314 Schema.String.annotate({
9315 description:
9316 "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nProgrammatic name of the tool being invoked.\n\nThis field is optional. Omitting it or sending `null` both mean that no\ntool name is available.",
9317 }),
9318 Schema.Null,
9319 ]),
9320 ),
9321 kind: Schema.optionalKey(
9322 Schema.suspend((): Schema.Codec<ToolKind> => ToolKind).annotate({
9323 description:
9324 "The category of tool being invoked.\nHelps clients choose appropriate icons and UI treatment.",
9325 }),
9326 ),
9327 status: Schema.optionalKey(
9328 Schema.suspend((): Schema.Codec<ToolCallStatus> => ToolCallStatus).annotate({
9329 description: "Current execution status of the tool call.",
9330 }),
9331 ),
9332 content: Schema.optionalKey(
9333 Schema.Array(ToolCallContent).annotate({ description: "Content produced by the tool call." }),
9334 ),
9335 locations: Schema.optionalKey(
9336 Schema.Array(ToolCallLocation).annotate({
9337 description:
9338 'File locations affected by this tool call.\nEnables "follow-along" features in clients.',
9339 }),
9340 ),
9341 rawInput: Schema.optionalKey(
9342 Schema.Json.annotate({
9343 expected: "JSON value",
9344 description: "Raw input parameters sent to the tool.",
9345 }),
9346 ),
9347 rawOutput: Schema.optionalKey(
9348 Schema.Json.annotate({
9349 expected: "JSON value",
9350 description: "Raw output returned by the tool.",
9351 }),
9352 ),
9353 _meta: Schema.optionalKey(
9354 Schema.Union([
9355 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
9356 description:
9357 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
9358 }),
9359 Schema.Null,
9360 ]),
9361 ),
9362}).annotate({
9363 description:
9364 "Represents a tool call that the language model has requested.\n\nTool calls are actions that the agent executes on behalf of the language model,\nsuch as reading files, executing code, or fetching data from external sources.\n\nSee protocol docs: [Tool Calls](https://agentclientprotocol.com/protocol/tool-calls)",
9365});
9366
9367export type UsageUpdate = {
9368 readonly used: number;
9369 readonly size: number;
9370 readonly cost?: Cost | null;
9371 readonly _meta?: { readonly [x: string]: Schema.Json } | null;
9372};
9373export const UsageUpdate = Schema.Struct({
9374 used: Schema.Number.annotate({ description: "Tokens currently in context.", format: "uint64" })
9375 .check(Schema.isInt().annotate({ expected: "an integer" }))
9376 .check(
9377 Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }),
9378 ),
9379 size: Schema.Number.annotate({
9380 description: "Total context window size in tokens.",
9381 format: "uint64",
9382 })
9383 .check(Schema.isInt().annotate({ expected: "an integer" }))
9384 .check(
9385 Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }),
9386 ),
9387 cost: Schema.optionalKey(
9388 Schema.Union([Cost, Schema.Null]).annotate({
9389 description: "Cumulative session cost (optional).",
9390 }),
9391 ),
9392 _meta: Schema.optionalKey(
9393 Schema.Union([
9394 Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({
9395 description:
9396 "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
9397 }),
9398 Schema.Null,
9399 ]),
9400 ),
9401}).annotate({ description: "Context window and cost update for a session." });