| 1 | // This file is generated by the effect-acp package. Do not edit manually. |
| 2 | // Current ACP schema release: schema-v2.0.0-alpha.3 |
| 3 | |
| 4 | import * as Schema from "effect/Schema"; |
| 5 | |
| 6 | export type SessionId = string; |
| 7 | export 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/v2/draft/session-setup#session-id)", |
| 10 | identifier: "SessionId", |
| 11 | }); |
| 12 | |
| 13 | export type NesSuggestionId = string; |
| 14 | export const NesSuggestionId = Schema.String.annotate({ |
| 15 | description: |
| 16 | "**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 NES suggestion.", |
| 17 | identifier: "NesSuggestionId", |
| 18 | }); |
| 19 | |
| 20 | export type PromptImageCapabilities = { |
| 21 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 22 | }; |
| 23 | export const PromptImageCapabilities = Schema.Struct({ |
| 24 | _meta: Schema.optionalKey( |
| 25 | Schema.Union([ |
| 26 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 27 | description: |
| 28 | "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/v2/draft/extensibility)", |
| 29 | }), |
| 30 | Schema.Null, |
| 31 | ]), |
| 32 | ), |
| 33 | }).annotate({ |
| 34 | description: |
| 35 | "Capabilities for image content in prompt requests.\n\nSupplying `{}` means the agent supports image content in prompts.", |
| 36 | identifier: "PromptImageCapabilities", |
| 37 | }); |
| 38 | |
| 39 | export type PromptAudioCapabilities = { |
| 40 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 41 | }; |
| 42 | export const PromptAudioCapabilities = Schema.Struct({ |
| 43 | _meta: Schema.optionalKey( |
| 44 | Schema.Union([ |
| 45 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 46 | description: |
| 47 | "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/v2/draft/extensibility)", |
| 48 | }), |
| 49 | Schema.Null, |
| 50 | ]), |
| 51 | ), |
| 52 | }).annotate({ |
| 53 | description: |
| 54 | "Capabilities for audio content in prompt requests.\n\nSupplying `{}` means the agent supports audio content in prompts.", |
| 55 | identifier: "PromptAudioCapabilities", |
| 56 | }); |
| 57 | |
| 58 | export type PromptEmbeddedContextCapabilities = { |
| 59 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 60 | }; |
| 61 | export const PromptEmbeddedContextCapabilities = Schema.Struct({ |
| 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/v2/draft/extensibility)", |
| 67 | }), |
| 68 | Schema.Null, |
| 69 | ]), |
| 70 | ), |
| 71 | }).annotate({ |
| 72 | description: |
| 73 | "Capabilities for embedded context in prompt requests.\n\nSupplying `{}` means the agent supports embedded context in prompts.", |
| 74 | identifier: "PromptEmbeddedContextCapabilities", |
| 75 | }); |
| 76 | |
| 77 | export type McpStdioCapabilities = { |
| 78 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 79 | }; |
| 80 | export const McpStdioCapabilities = Schema.Struct({ |
| 81 | _meta: Schema.optionalKey( |
| 82 | Schema.Union([ |
| 83 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 84 | description: |
| 85 | "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/v2/draft/extensibility)", |
| 86 | }), |
| 87 | Schema.Null, |
| 88 | ]), |
| 89 | ), |
| 90 | }).annotate({ |
| 91 | description: |
| 92 | "Capabilities for stdio MCP server transports.\n\nSupplying `{}` means the agent supports stdio MCP server transports.", |
| 93 | identifier: "McpStdioCapabilities", |
| 94 | }); |
| 95 | |
| 96 | export type McpHttpCapabilities = { readonly _meta?: { readonly [x: string]: Schema.Json } | null }; |
| 97 | export const McpHttpCapabilities = Schema.Struct({ |
| 98 | _meta: Schema.optionalKey( |
| 99 | Schema.Union([ |
| 100 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 101 | description: |
| 102 | "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/v2/draft/extensibility)", |
| 103 | }), |
| 104 | Schema.Null, |
| 105 | ]), |
| 106 | ), |
| 107 | }).annotate({ |
| 108 | description: |
| 109 | "Capabilities for HTTP MCP server transports.\n\nSupplying `{}` means the agent supports HTTP MCP server transports.", |
| 110 | identifier: "McpHttpCapabilities", |
| 111 | }); |
| 112 | |
| 113 | export type McpAcpCapabilities = { readonly _meta?: { readonly [x: string]: Schema.Json } | null }; |
| 114 | export const McpAcpCapabilities = 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/v2/draft/extensibility)", |
| 120 | }), |
| 121 | Schema.Null, |
| 122 | ]), |
| 123 | ), |
| 124 | }).annotate({ |
| 125 | description: |
| 126 | "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCapabilities for ACP MCP server transports.\n\nSupplying `{}` means the agent supports ACP MCP server transports.", |
| 127 | identifier: "McpAcpCapabilities", |
| 128 | }); |
| 129 | |
| 130 | export type SessionDeleteCapabilities = { |
| 131 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 132 | }; |
| 133 | export 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/v2/draft/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 | |
| 149 | export type SessionAdditionalDirectoriesCapabilities = { |
| 150 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 151 | }; |
| 152 | export 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/v2/draft/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 | |
| 168 | export type SessionForkCapabilities = { |
| 169 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 170 | }; |
| 171 | export 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/v2/draft/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 | |
| 187 | export type AgentAuthCapabilities = { |
| 188 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 189 | }; |
| 190 | export const AgentAuthCapabilities = 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/v2/draft/extensibility)", |
| 196 | }), |
| 197 | Schema.Null, |
| 198 | ]), |
| 199 | ), |
| 200 | }).annotate({ |
| 201 | description: |
| 202 | "Authentication-related extension capabilities supported by the agent.\n\nThis object does not advertise support for `auth/login` or `auth/logout`.\nThose methods are advertised by a non-empty `authMethods` list in the\n`initialize` response.", |
| 203 | identifier: "AgentAuthCapabilities", |
| 204 | }); |
| 205 | |
| 206 | export type ProvidersCapabilities = { |
| 207 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 208 | }; |
| 209 | export const ProvidersCapabilities = 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/v2/draft/extensibility)", |
| 215 | }), |
| 216 | Schema.Null, |
| 217 | ]), |
| 218 | ), |
| 219 | }).annotate({ |
| 220 | description: |
| 221 | "**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.", |
| 222 | identifier: "ProvidersCapabilities", |
| 223 | }); |
| 224 | |
| 225 | export type NesDocumentDidOpenCapabilities = { |
| 226 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 227 | }; |
| 228 | export const NesDocumentDidOpenCapabilities = 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/v2/draft/extensibility)", |
| 234 | }), |
| 235 | Schema.Null, |
| 236 | ]), |
| 237 | ), |
| 238 | }).annotate({ |
| 239 | description: "Marker for `document/didOpen` capability support.", |
| 240 | identifier: "NesDocumentDidOpenCapabilities", |
| 241 | }); |
| 242 | |
| 243 | export type TextDocumentSyncKind = "full" | "incremental"; |
| 244 | export const TextDocumentSyncKind = Schema.Union([ |
| 245 | Schema.Literal("full").annotate({ |
| 246 | description: "Client sends the entire file content on each change.", |
| 247 | }), |
| 248 | Schema.Literal("incremental").annotate({ description: "Client sends only the changed ranges." }), |
| 249 | ]).annotate({ |
| 250 | description: "How the agent wants document changes delivered.", |
| 251 | identifier: "TextDocumentSyncKind", |
| 252 | }); |
| 253 | |
| 254 | export type NesDocumentDidCloseCapabilities = { |
| 255 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 256 | }; |
| 257 | export const NesDocumentDidCloseCapabilities = Schema.Struct({ |
| 258 | _meta: Schema.optionalKey( |
| 259 | Schema.Union([ |
| 260 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 261 | description: |
| 262 | "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/v2/draft/extensibility)", |
| 263 | }), |
| 264 | Schema.Null, |
| 265 | ]), |
| 266 | ), |
| 267 | }).annotate({ |
| 268 | description: "Marker for `document/didClose` capability support.", |
| 269 | identifier: "NesDocumentDidCloseCapabilities", |
| 270 | }); |
| 271 | |
| 272 | export type NesDocumentDidSaveCapabilities = { |
| 273 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 274 | }; |
| 275 | export const NesDocumentDidSaveCapabilities = Schema.Struct({ |
| 276 | _meta: Schema.optionalKey( |
| 277 | Schema.Union([ |
| 278 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 279 | description: |
| 280 | "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/v2/draft/extensibility)", |
| 281 | }), |
| 282 | Schema.Null, |
| 283 | ]), |
| 284 | ), |
| 285 | }).annotate({ |
| 286 | description: "Marker for `document/didSave` capability support.", |
| 287 | identifier: "NesDocumentDidSaveCapabilities", |
| 288 | }); |
| 289 | |
| 290 | export type NesDocumentDidFocusCapabilities = { |
| 291 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 292 | }; |
| 293 | export const NesDocumentDidFocusCapabilities = Schema.Struct({ |
| 294 | _meta: Schema.optionalKey( |
| 295 | Schema.Union([ |
| 296 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 297 | description: |
| 298 | "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/v2/draft/extensibility)", |
| 299 | }), |
| 300 | Schema.Null, |
| 301 | ]), |
| 302 | ), |
| 303 | }).annotate({ |
| 304 | description: "Marker for `document/didFocus` capability support.", |
| 305 | identifier: "NesDocumentDidFocusCapabilities", |
| 306 | }); |
| 307 | |
| 308 | export type NesRecentFilesCapabilities = { |
| 309 | readonly maxCount?: number | null; |
| 310 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 311 | }; |
| 312 | export const NesRecentFilesCapabilities = Schema.Struct({ |
| 313 | maxCount: Schema.optionalKey( |
| 314 | Schema.Union([ |
| 315 | Schema.Number.annotate({ |
| 316 | description: "Maximum number of recent files the agent can use.", |
| 317 | format: "uint32", |
| 318 | }) |
| 319 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 320 | .check( |
| 321 | Schema.isGreaterThanOrEqualTo(0).annotate({ |
| 322 | expected: "a value greater than or equal to 0", |
| 323 | }), |
| 324 | ), |
| 325 | Schema.Null, |
| 326 | ]), |
| 327 | ), |
| 328 | _meta: Schema.optionalKey( |
| 329 | Schema.Union([ |
| 330 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 331 | description: |
| 332 | "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/v2/draft/extensibility)", |
| 333 | }), |
| 334 | Schema.Null, |
| 335 | ]), |
| 336 | ), |
| 337 | }).annotate({ |
| 338 | description: "Capabilities for recent files context.", |
| 339 | identifier: "NesRecentFilesCapabilities", |
| 340 | }); |
| 341 | |
| 342 | export type NesRelatedSnippetsCapabilities = { |
| 343 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 344 | }; |
| 345 | export const NesRelatedSnippetsCapabilities = Schema.Struct({ |
| 346 | _meta: Schema.optionalKey( |
| 347 | Schema.Union([ |
| 348 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 349 | description: |
| 350 | "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/v2/draft/extensibility)", |
| 351 | }), |
| 352 | Schema.Null, |
| 353 | ]), |
| 354 | ), |
| 355 | }).annotate({ |
| 356 | description: "Capabilities for related snippets context.", |
| 357 | identifier: "NesRelatedSnippetsCapabilities", |
| 358 | }); |
| 359 | |
| 360 | export type NesEditHistoryCapabilities = { |
| 361 | readonly maxCount?: number | null; |
| 362 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 363 | }; |
| 364 | export const NesEditHistoryCapabilities = Schema.Struct({ |
| 365 | maxCount: Schema.optionalKey( |
| 366 | Schema.Union([ |
| 367 | Schema.Number.annotate({ |
| 368 | description: "Maximum number of edit history entries the agent can use.", |
| 369 | format: "uint32", |
| 370 | }) |
| 371 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 372 | .check( |
| 373 | Schema.isGreaterThanOrEqualTo(0).annotate({ |
| 374 | expected: "a value greater than or equal to 0", |
| 375 | }), |
| 376 | ), |
| 377 | Schema.Null, |
| 378 | ]), |
| 379 | ), |
| 380 | _meta: Schema.optionalKey( |
| 381 | Schema.Union([ |
| 382 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 383 | description: |
| 384 | "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/v2/draft/extensibility)", |
| 385 | }), |
| 386 | Schema.Null, |
| 387 | ]), |
| 388 | ), |
| 389 | }).annotate({ |
| 390 | description: "Capabilities for edit history context.", |
| 391 | identifier: "NesEditHistoryCapabilities", |
| 392 | }); |
| 393 | |
| 394 | export type NesUserActionsCapabilities = { |
| 395 | readonly maxCount?: number | null; |
| 396 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 397 | }; |
| 398 | export const NesUserActionsCapabilities = Schema.Struct({ |
| 399 | maxCount: Schema.optionalKey( |
| 400 | Schema.Union([ |
| 401 | Schema.Number.annotate({ |
| 402 | description: "Maximum number of user actions the agent can use.", |
| 403 | format: "uint32", |
| 404 | }) |
| 405 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 406 | .check( |
| 407 | Schema.isGreaterThanOrEqualTo(0).annotate({ |
| 408 | expected: "a value greater than or equal to 0", |
| 409 | }), |
| 410 | ), |
| 411 | Schema.Null, |
| 412 | ]), |
| 413 | ), |
| 414 | _meta: Schema.optionalKey( |
| 415 | Schema.Union([ |
| 416 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 417 | description: |
| 418 | "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/v2/draft/extensibility)", |
| 419 | }), |
| 420 | Schema.Null, |
| 421 | ]), |
| 422 | ), |
| 423 | }).annotate({ |
| 424 | description: "Capabilities for user actions context.", |
| 425 | identifier: "NesUserActionsCapabilities", |
| 426 | }); |
| 427 | |
| 428 | export type NesOpenFilesCapabilities = { |
| 429 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 430 | }; |
| 431 | export const NesOpenFilesCapabilities = Schema.Struct({ |
| 432 | _meta: Schema.optionalKey( |
| 433 | Schema.Union([ |
| 434 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 435 | description: |
| 436 | "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/v2/draft/extensibility)", |
| 437 | }), |
| 438 | Schema.Null, |
| 439 | ]), |
| 440 | ), |
| 441 | }).annotate({ |
| 442 | description: "Capabilities for open files context.", |
| 443 | identifier: "NesOpenFilesCapabilities", |
| 444 | }); |
| 445 | |
| 446 | export type NesDiagnosticsCapabilities = { |
| 447 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 448 | }; |
| 449 | export const NesDiagnosticsCapabilities = Schema.Struct({ |
| 450 | _meta: Schema.optionalKey( |
| 451 | Schema.Union([ |
| 452 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 453 | description: |
| 454 | "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/v2/draft/extensibility)", |
| 455 | }), |
| 456 | Schema.Null, |
| 457 | ]), |
| 458 | ), |
| 459 | }).annotate({ |
| 460 | description: "Capabilities for diagnostics context.", |
| 461 | identifier: "NesDiagnosticsCapabilities", |
| 462 | }); |
| 463 | |
| 464 | export type PositionEncodingKind = "utf-16" | "utf-32" | "utf-8"; |
| 465 | export const PositionEncodingKind = Schema.Union([ |
| 466 | Schema.Literal("utf-16").annotate({ |
| 467 | description: "Character offsets count UTF-16 code units. This is the default.", |
| 468 | }), |
| 469 | Schema.Literal("utf-32").annotate({ |
| 470 | description: "Character offsets count Unicode code points.", |
| 471 | }), |
| 472 | Schema.Literal("utf-8").annotate({ |
| 473 | description: "Character offsets count UTF-8 code units (bytes).", |
| 474 | }), |
| 475 | ]).annotate({ |
| 476 | description: |
| 477 | "The encoding used for character offsets in positions.\n\nFollows the same conventions as LSP 3.17. The default is UTF-16.", |
| 478 | identifier: "PositionEncodingKind", |
| 479 | }); |
| 480 | |
| 481 | export type MessageId = string; |
| 482 | export const MessageId = Schema.String.annotate({ |
| 483 | description: "Unique identifier for a message within a session.", |
| 484 | identifier: "MessageId", |
| 485 | }); |
| 486 | |
| 487 | export type Role = "assistant" | "user" | string; |
| 488 | export const Role = Schema.Union([ |
| 489 | Schema.Literal("assistant").annotate({ description: "The assistant side of a conversation." }), |
| 490 | Schema.Literal("user").annotate({ description: "The user side of a conversation." }), |
| 491 | Schema.String.annotate({ |
| 492 | title: "other", |
| 493 | description: |
| 494 | "Custom or future role.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 495 | }), |
| 496 | ]).annotate({ |
| 497 | description: "The sender or recipient of messages and data in a conversation.", |
| 498 | identifier: "Role", |
| 499 | }); |
| 500 | |
| 501 | export type MediaType = string; |
| 502 | export const MediaType = Schema.String.annotate({ |
| 503 | description: "An Internet media type identifying the format of protocol content.", |
| 504 | identifier: "MediaType", |
| 505 | }); |
| 506 | |
| 507 | export type IconTheme = "light" | "dark" | string; |
| 508 | export const IconTheme = Schema.Union([ |
| 509 | Schema.Literal("light").annotate({ description: "Icon designed for light backgrounds." }), |
| 510 | Schema.Literal("dark").annotate({ description: "Icon designed for dark backgrounds." }), |
| 511 | Schema.String.annotate({ |
| 512 | title: "other", |
| 513 | description: |
| 514 | "Custom or future icon theme.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 515 | }), |
| 516 | ]).annotate({ description: "Theme an icon is designed for.", identifier: "IconTheme" }); |
| 517 | |
| 518 | export type StopReason = |
| 519 | | "end_turn" |
| 520 | | "max_tokens" |
| 521 | | "max_turn_requests" |
| 522 | | "refusal" |
| 523 | | "cancelled" |
| 524 | | string; |
| 525 | export const StopReason = Schema.Union([ |
| 526 | Schema.Literal("end_turn").annotate({ description: "The active work ended successfully." }), |
| 527 | Schema.Literal("max_tokens").annotate({ |
| 528 | description: "The active work ended because the agent reached the maximum number of tokens.", |
| 529 | }), |
| 530 | Schema.Literal("max_turn_requests").annotate({ |
| 531 | description: |
| 532 | "The active work ended because the agent reached the maximum number of\nallowed agent requests before returning idle.", |
| 533 | }), |
| 534 | Schema.Literal("refusal").annotate({ |
| 535 | description: |
| 536 | "The active work ended because the agent refused to continue. The user\nprompt and everything that comes after it won't be included in the next\nprompt, so this should be reflected in the UI.", |
| 537 | }), |
| 538 | Schema.Literal("cancelled").annotate({ |
| 539 | description: |
| 540 | "Active session work was cancelled by the client via `session/cancel`.\n\nAgents should report this stop reason on an idle `state_update` session update\nwhen cancellation succeeds, even if cancellation causes exceptions in\nunderlying operations.", |
| 541 | }), |
| 542 | Schema.String.annotate({ |
| 543 | title: "other", |
| 544 | description: |
| 545 | "Custom or future stop reason.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 546 | }), |
| 547 | ]).annotate({ |
| 548 | description: |
| 549 | "Reasons why an agent stops active session work.\n\nSee protocol docs: [Stop Reasons](https://agentclientprotocol.com/protocol/v2/draft/prompt-lifecycle#stop-reasons)", |
| 550 | identifier: "StopReason", |
| 551 | }); |
| 552 | |
| 553 | export type Usage = { |
| 554 | readonly totalTokens: number; |
| 555 | readonly inputTokens: number; |
| 556 | readonly outputTokens: number; |
| 557 | readonly thoughtTokens?: number | null; |
| 558 | readonly cachedReadTokens?: number | null; |
| 559 | readonly cachedWriteTokens?: number | null; |
| 560 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 561 | }; |
| 562 | export const Usage = Schema.Struct({ |
| 563 | totalTokens: Schema.Number.annotate({ |
| 564 | description: "Sum of all token types across session.", |
| 565 | format: "uint64", |
| 566 | }) |
| 567 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 568 | .check( |
| 569 | Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), |
| 570 | ), |
| 571 | inputTokens: Schema.Number.annotate({ description: "Total input tokens.", format: "uint64" }) |
| 572 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 573 | .check( |
| 574 | Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), |
| 575 | ), |
| 576 | outputTokens: Schema.Number.annotate({ description: "Total output tokens.", format: "uint64" }) |
| 577 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 578 | .check( |
| 579 | Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), |
| 580 | ), |
| 581 | thoughtTokens: Schema.optionalKey( |
| 582 | Schema.Union([ |
| 583 | Schema.Number.annotate({ description: "Total thought/reasoning tokens", format: "uint64" }) |
| 584 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 585 | .check( |
| 586 | Schema.isGreaterThanOrEqualTo(0).annotate({ |
| 587 | expected: "a value greater than or equal to 0", |
| 588 | }), |
| 589 | ), |
| 590 | Schema.Null, |
| 591 | ]), |
| 592 | ), |
| 593 | cachedReadTokens: Schema.optionalKey( |
| 594 | Schema.Union([ |
| 595 | Schema.Number.annotate({ description: "Total cache read tokens.", format: "uint64" }) |
| 596 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 597 | .check( |
| 598 | Schema.isGreaterThanOrEqualTo(0).annotate({ |
| 599 | expected: "a value greater than or equal to 0", |
| 600 | }), |
| 601 | ), |
| 602 | Schema.Null, |
| 603 | ]), |
| 604 | ), |
| 605 | cachedWriteTokens: Schema.optionalKey( |
| 606 | Schema.Union([ |
| 607 | Schema.Number.annotate({ description: "Total cache write tokens.", format: "uint64" }) |
| 608 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 609 | .check( |
| 610 | Schema.isGreaterThanOrEqualTo(0).annotate({ |
| 611 | expected: "a value greater than or equal to 0", |
| 612 | }), |
| 613 | ), |
| 614 | Schema.Null, |
| 615 | ]), |
| 616 | ), |
| 617 | _meta: Schema.optionalKey( |
| 618 | Schema.Union([ |
| 619 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 620 | description: |
| 621 | "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/v2/draft/extensibility)", |
| 622 | }), |
| 623 | Schema.Null, |
| 624 | ]), |
| 625 | ), |
| 626 | }).annotate({ |
| 627 | description: |
| 628 | "**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 completed session work.", |
| 629 | identifier: "Usage", |
| 630 | }); |
| 631 | |
| 632 | export type ToolCallId = string; |
| 633 | export const ToolCallId = Schema.String.annotate({ |
| 634 | description: "Unique identifier for a tool call within a session.", |
| 635 | identifier: "ToolCallId", |
| 636 | }); |
| 637 | |
| 638 | export type DiffFileType = "text" | "binary" | "directory" | "symlink" | string; |
| 639 | export const DiffFileType = Schema.Union([ |
| 640 | Schema.Literal("text").annotate({ description: "Text content." }), |
| 641 | Schema.Literal("binary").annotate({ description: "Binary or otherwise non-text content." }), |
| 642 | Schema.Literal("directory").annotate({ description: "Directory entry." }), |
| 643 | Schema.Literal("symlink").annotate({ description: "Symbolic link." }), |
| 644 | Schema.String.annotate({ |
| 645 | title: "other", |
| 646 | description: |
| 647 | "Custom or future file type.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 648 | }), |
| 649 | ]).annotate({ |
| 650 | description: "Kind of file content represented by a diff change.", |
| 651 | identifier: "DiffFileType", |
| 652 | }); |
| 653 | |
| 654 | export type AbsolutePath = string; |
| 655 | export const AbsolutePath = Schema.String.annotate({ |
| 656 | description: "An absolute filesystem path used by the protocol.", |
| 657 | identifier: "AbsolutePath", |
| 658 | }); |
| 659 | |
| 660 | export type DiffPatchFormat = "git_patch" | string; |
| 661 | export const DiffPatchFormat = Schema.Union([ |
| 662 | Schema.Literal("git_patch").annotate({ |
| 663 | description: |
| 664 | "One or more `diff --git` sections in Git's `--patch` (`-p`) text format.\n\nPaths MUST be absolute. Surrounding commit metadata and email envelopes\nMUST NOT be included.", |
| 665 | }), |
| 666 | Schema.String.annotate({ |
| 667 | title: "other", |
| 668 | description: |
| 669 | "Custom or future patch format.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 670 | }), |
| 671 | ]).annotate({ |
| 672 | description: "Text patch format used by [`DiffPatch`].", |
| 673 | identifier: "DiffPatchFormat", |
| 674 | }); |
| 675 | |
| 676 | export type TerminalId = string; |
| 677 | export const TerminalId = Schema.String.annotate({ |
| 678 | description: "Unique identifier for an agent-owned terminal within a session.", |
| 679 | identifier: "TerminalId", |
| 680 | }); |
| 681 | |
| 682 | export type ToolKind = |
| 683 | | "read" |
| 684 | | "edit" |
| 685 | | "delete" |
| 686 | | "move" |
| 687 | | "search" |
| 688 | | "execute" |
| 689 | | "think" |
| 690 | | "fetch" |
| 691 | | "switch_mode" |
| 692 | | "other" |
| 693 | | string; |
| 694 | export const ToolKind = Schema.Union([ |
| 695 | Schema.Literal("read").annotate({ description: "Reading files or data." }), |
| 696 | Schema.Literal("edit").annotate({ description: "Modifying files or content." }), |
| 697 | Schema.Literal("delete").annotate({ description: "Removing files or data." }), |
| 698 | Schema.Literal("move").annotate({ description: "Moving or renaming files." }), |
| 699 | Schema.Literal("search").annotate({ description: "Searching for information." }), |
| 700 | Schema.Literal("execute").annotate({ description: "Running commands or code." }), |
| 701 | Schema.Literal("think").annotate({ description: "Internal reasoning or planning." }), |
| 702 | Schema.Literal("fetch").annotate({ description: "Retrieving external data." }), |
| 703 | Schema.Literal("switch_mode").annotate({ description: "Switching the current session mode." }), |
| 704 | Schema.Literal("other").annotate({ description: "Other tool types (default)." }), |
| 705 | Schema.String.annotate({ |
| 706 | title: "unknown", |
| 707 | description: |
| 708 | "Custom or future tool kind.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 709 | }), |
| 710 | ]).annotate({ |
| 711 | description: |
| 712 | "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/v2/draft/tool-calls#creating)", |
| 713 | identifier: "ToolKind", |
| 714 | }); |
| 715 | |
| 716 | export type ToolCallStatus = |
| 717 | | "pending" |
| 718 | | "in_progress" |
| 719 | | "completed" |
| 720 | | "failed" |
| 721 | | "cancelled" |
| 722 | | string; |
| 723 | export const ToolCallStatus = Schema.Union([ |
| 724 | Schema.Literal("pending").annotate({ |
| 725 | description: |
| 726 | "The tool call hasn't started running yet because the input is either\nstreaming or we're awaiting approval.", |
| 727 | }), |
| 728 | Schema.Literal("in_progress").annotate({ description: "The tool call is currently running." }), |
| 729 | Schema.Literal("completed").annotate({ description: "The tool call completed successfully." }), |
| 730 | Schema.Literal("failed").annotate({ description: "The tool call failed with an error." }), |
| 731 | Schema.Literal("cancelled").annotate({ |
| 732 | description: "The tool call was cancelled before it completed.", |
| 733 | }), |
| 734 | Schema.String.annotate({ |
| 735 | title: "other", |
| 736 | description: |
| 737 | "Custom or future tool call status.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 738 | }), |
| 739 | ]).annotate({ |
| 740 | description: |
| 741 | "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/v2/draft/tool-calls#status)", |
| 742 | identifier: "ToolCallStatus", |
| 743 | }); |
| 744 | |
| 745 | export type TerminalOutput = { |
| 746 | readonly data: string; |
| 747 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 748 | }; |
| 749 | export const TerminalOutput = Schema.Struct({ |
| 750 | data: Schema.String.annotate({ |
| 751 | description: "Base64-encoded replacement terminal output bytes.", |
| 752 | contentEncoding: "base64", |
| 753 | }), |
| 754 | _meta: Schema.optionalKey( |
| 755 | Schema.Union([ |
| 756 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 757 | description: |
| 758 | "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. This metadata is scoped to the replacement snapshot. Omitted\nand `null` are equivalent and mean no snapshot metadata was provided.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 759 | }), |
| 760 | Schema.Null, |
| 761 | ]), |
| 762 | ), |
| 763 | }).annotate({ |
| 764 | description: "An authoritative replacement snapshot of terminal output bytes.", |
| 765 | identifier: "TerminalOutput", |
| 766 | }); |
| 767 | |
| 768 | export type TerminalExitStatus = { |
| 769 | readonly exitCode?: number | null; |
| 770 | readonly signal?: string | null; |
| 771 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 772 | }; |
| 773 | export const TerminalExitStatus = Schema.Struct({ |
| 774 | exitCode: Schema.optionalKey( |
| 775 | Schema.Union([ |
| 776 | Schema.Number.annotate({ |
| 777 | description: "Process exit code, when known. Omitted and `null` are equivalent.", |
| 778 | format: "uint32", |
| 779 | }) |
| 780 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 781 | .check( |
| 782 | Schema.isGreaterThanOrEqualTo(0).annotate({ |
| 783 | expected: "a value greater than or equal to 0", |
| 784 | }), |
| 785 | ), |
| 786 | Schema.Null, |
| 787 | ]), |
| 788 | ), |
| 789 | signal: Schema.optionalKey( |
| 790 | Schema.Union([ |
| 791 | Schema.String.annotate({ |
| 792 | description: |
| 793 | "Signal that terminated the process, when known.\n\nAgents should use the conventional platform signal name. POSIX examples\ninclude `SIGTERM`, `SIGKILL`, and `SIGINT`. Other platforms may use a\nplatform-specific name. Omitted and `null` are equivalent.", |
| 794 | }), |
| 795 | Schema.Null, |
| 796 | ]), |
| 797 | ), |
| 798 | _meta: Schema.optionalKey( |
| 799 | Schema.Union([ |
| 800 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 801 | description: |
| 802 | "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. This metadata is scoped to the exit information. Omitted\nand `null` are equivalent and mean no exit metadata was provided.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 803 | }), |
| 804 | Schema.Null, |
| 805 | ]), |
| 806 | ), |
| 807 | }).annotate({ |
| 808 | description: |
| 809 | "Exit information for an agent-owned terminal.\n\nThe presence of this object marks the terminal as exited, even when neither\nan exit code nor a signal is known.", |
| 810 | identifier: "TerminalExitStatus", |
| 811 | }); |
| 812 | |
| 813 | export type PlanId = string; |
| 814 | export const PlanId = Schema.String.annotate({ |
| 815 | description: "Unique identifier for a plan within a session.", |
| 816 | identifier: "PlanId", |
| 817 | }); |
| 818 | |
| 819 | export type PlanEntryPriority = "high" | "medium" | "low" | string; |
| 820 | export const PlanEntryPriority = Schema.Union([ |
| 821 | Schema.Literal("high").annotate({ |
| 822 | description: "High priority task - critical to the overall goal.", |
| 823 | }), |
| 824 | Schema.Literal("medium").annotate({ |
| 825 | description: "Medium priority task - important but not critical.", |
| 826 | }), |
| 827 | Schema.Literal("low").annotate({ |
| 828 | description: "Low priority task - nice to have but not essential.", |
| 829 | }), |
| 830 | Schema.String.annotate({ |
| 831 | title: "other", |
| 832 | description: |
| 833 | "Custom or future plan entry priority.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 834 | }), |
| 835 | ]).annotate({ |
| 836 | description: |
| 837 | "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/v2/draft/agent-plan#plan-entries)", |
| 838 | identifier: "PlanEntryPriority", |
| 839 | }); |
| 840 | |
| 841 | export type PlanEntryStatus = "pending" | "in_progress" | "completed" | "cancelled" | string; |
| 842 | export const PlanEntryStatus = Schema.Union([ |
| 843 | Schema.Literal("pending").annotate({ description: "The task has not started yet." }), |
| 844 | Schema.Literal("in_progress").annotate({ description: "The task is currently being worked on." }), |
| 845 | Schema.Literal("completed").annotate({ |
| 846 | description: "The task has been successfully completed.", |
| 847 | }), |
| 848 | Schema.Literal("cancelled").annotate({ |
| 849 | description: "The task was cancelled before it completed.", |
| 850 | }), |
| 851 | Schema.String.annotate({ |
| 852 | title: "other", |
| 853 | description: |
| 854 | "Custom or future plan entry status.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 855 | }), |
| 856 | ]).annotate({ |
| 857 | description: |
| 858 | "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/v2/draft/agent-plan#plan-entries)", |
| 859 | identifier: "PlanEntryStatus", |
| 860 | }); |
| 861 | |
| 862 | export type AvailableCommandInput = |
| 863 | | { |
| 864 | readonly type: "text"; |
| 865 | readonly hint: string; |
| 866 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 867 | } |
| 868 | | ({ readonly type: string } & { readonly [x: string]: Schema.Json }); |
| 869 | export const AvailableCommandInput = Schema.Union([ |
| 870 | Schema.Struct({ |
| 871 | type: Schema.Literal("text"), |
| 872 | hint: Schema.String.annotate({ |
| 873 | description: "A hint to display when the input hasn't been provided yet", |
| 874 | }), |
| 875 | _meta: Schema.optionalKey( |
| 876 | Schema.Union([ |
| 877 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 878 | description: |
| 879 | "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/v2/draft/extensibility)", |
| 880 | }), |
| 881 | Schema.Null, |
| 882 | ]), |
| 883 | ), |
| 884 | }).annotate({ |
| 885 | description: "All text that was typed after the command name is provided as input.", |
| 886 | }), |
| 887 | Schema.StructWithRest( |
| 888 | Schema.Struct({ |
| 889 | type: Schema.String.annotate({ |
| 890 | description: |
| 891 | "Custom or future command input type.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 892 | }).check( |
| 893 | Schema.isPattern(new RegExp("^(?!(?:\\x74ext)$)[\\s\\S]*$")).annotate({ |
| 894 | expected: "a string matching the RegExp ^(?!(?:\\x74ext)$)[\\s\\S]*$", |
| 895 | }), |
| 896 | ), |
| 897 | }), |
| 898 | [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], |
| 899 | ).annotate({ |
| 900 | title: "other", |
| 901 | description: |
| 902 | "Custom or future command input specification.\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 input type should preserve the raw\npayload when storing, replaying, proxying, or forwarding command\nmetadata, and otherwise ignore the input specification or display the\ncommand without structured input.", |
| 903 | }), |
| 904 | ]).annotate({ |
| 905 | description: "The input specification for a command.", |
| 906 | identifier: "AvailableCommandInput", |
| 907 | }); |
| 908 | |
| 909 | export type SessionConfigId = string; |
| 910 | export const SessionConfigId = Schema.String.annotate({ |
| 911 | description: "Unique identifier for a session configuration option.", |
| 912 | identifier: "SessionConfigId", |
| 913 | }); |
| 914 | |
| 915 | export type SessionConfigOptionCategory = |
| 916 | | "mode" |
| 917 | | "model" |
| 918 | | "model_config" |
| 919 | | "thought_level" |
| 920 | | string; |
| 921 | export const SessionConfigOptionCategory = Schema.Union([ |
| 922 | Schema.Literal("mode").annotate({ description: "Session mode selector." }), |
| 923 | Schema.Literal("model").annotate({ description: "Model selector." }), |
| 924 | Schema.Literal("model_config").annotate({ |
| 925 | description: "Model-related configuration parameter.", |
| 926 | }), |
| 927 | Schema.Literal("thought_level").annotate({ description: "Thought/reasoning level selector." }), |
| 928 | Schema.String.annotate({ |
| 929 | title: "other", |
| 930 | description: |
| 931 | "Custom or future category.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 932 | }), |
| 933 | ]).annotate({ |
| 934 | description: |
| 935 | "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.", |
| 936 | identifier: "SessionConfigOptionCategory", |
| 937 | }); |
| 938 | |
| 939 | export type SessionConfigValueId = string; |
| 940 | export const SessionConfigValueId = Schema.String.annotate({ |
| 941 | description: "Unique identifier for a session configuration option value.", |
| 942 | identifier: "SessionConfigValueId", |
| 943 | }); |
| 944 | |
| 945 | export type SessionConfigGroupId = string; |
| 946 | export const SessionConfigGroupId = Schema.String.annotate({ |
| 947 | description: "Unique identifier for a session configuration option value group.", |
| 948 | identifier: "SessionConfigGroupId", |
| 949 | }); |
| 950 | |
| 951 | export type Cost = { |
| 952 | readonly amount: number; |
| 953 | readonly currency: string; |
| 954 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 955 | }; |
| 956 | export const Cost = Schema.Struct({ |
| 957 | amount: Schema.Number.annotate({ |
| 958 | description: "Total cumulative cost for session.", |
| 959 | format: "double", |
| 960 | }).check(Schema.isFinite().annotate({ expected: "a finite number" })), |
| 961 | currency: Schema.String.annotate({ |
| 962 | description: 'ISO 4217 currency code (e.g., "USD", "EUR").', |
| 963 | }).check( |
| 964 | Schema.isPattern(new RegExp("^[A-Z]{3}$")).annotate({ |
| 965 | expected: "a string matching the RegExp ^[A-Z]{3}$", |
| 966 | }), |
| 967 | ), |
| 968 | _meta: Schema.optionalKey( |
| 969 | Schema.Union([ |
| 970 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 971 | description: |
| 972 | "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/v2/draft/extensibility)", |
| 973 | }), |
| 974 | Schema.Null, |
| 975 | ]), |
| 976 | ), |
| 977 | }).annotate({ description: "Cost information for a session.", identifier: "Cost" }); |
| 978 | |
| 979 | export type CompactionId = string; |
| 980 | export const CompactionId = Schema.String.annotate({ |
| 981 | description: |
| 982 | "**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.", |
| 983 | identifier: "CompactionId", |
| 984 | }); |
| 985 | |
| 986 | export type CompactionStatus = "in_progress" | "completed" | "failed" | "cancelled" | string; |
| 987 | export const CompactionStatus = Schema.Union([ |
| 988 | Schema.Literal("in_progress").annotate({ |
| 989 | description: "Compaction has started and has not finished.", |
| 990 | }), |
| 991 | Schema.Literal("completed").annotate({ description: "Compaction finished successfully." }), |
| 992 | Schema.Literal("failed").annotate({ description: "Compaction finished unsuccessfully." }), |
| 993 | Schema.Literal("cancelled").annotate({ |
| 994 | description: "Compaction was cancelled before it finished.", |
| 995 | }), |
| 996 | Schema.String.annotate({ |
| 997 | title: "other", |
| 998 | description: |
| 999 | "Custom or future compaction status.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Other unknown values are reserved for future ACP statuses.", |
| 1000 | }), |
| 1001 | ]).annotate({ |
| 1002 | description: |
| 1003 | "**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.", |
| 1004 | identifier: "CompactionStatus", |
| 1005 | }); |
| 1006 | |
| 1007 | export type ElicitationId = string; |
| 1008 | export const ElicitationId = Schema.String.annotate({ |
| 1009 | description: "Unique identifier for an elicitation.", |
| 1010 | identifier: "ElicitationId", |
| 1011 | }); |
| 1012 | |
| 1013 | export type McpConnectionId = string; |
| 1014 | export const McpConnectionId = Schema.String.annotate({ |
| 1015 | description: |
| 1016 | "**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.", |
| 1017 | identifier: "McpConnectionId", |
| 1018 | }); |
| 1019 | |
| 1020 | export type ExtNotification = Schema.Json; |
| 1021 | export const ExtNotification = Schema.Json.annotate({ |
| 1022 | expected: "JSON value", |
| 1023 | description: |
| 1024 | "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/v2/draft/extensibility)", |
| 1025 | identifier: "ExtNotification", |
| 1026 | }); |
| 1027 | |
| 1028 | export type RequestId = null | number | string; |
| 1029 | export const RequestId = Schema.Union([ |
| 1030 | Schema.Null.annotate({ title: "Null", description: "The JSON-RPC `null` request id." }), |
| 1031 | Schema.Number.annotate({ |
| 1032 | title: "Number", |
| 1033 | description: "A numeric JSON-RPC request id.", |
| 1034 | format: "int64", |
| 1035 | }).check(Schema.isInt().annotate({ expected: "an integer" })), |
| 1036 | Schema.String.annotate({ title: "Str", description: "A string JSON-RPC request id." }), |
| 1037 | ]).annotate({ |
| 1038 | description: |
| 1039 | "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.", |
| 1040 | identifier: "RequestId", |
| 1041 | }); |
| 1042 | |
| 1043 | export type PermissionOptionId = string; |
| 1044 | export const PermissionOptionId = Schema.String.annotate({ |
| 1045 | description: "Unique identifier for a permission option.", |
| 1046 | identifier: "PermissionOptionId", |
| 1047 | }); |
| 1048 | |
| 1049 | export type PermissionOptionKind = |
| 1050 | | "allow_once" |
| 1051 | | "allow_always" |
| 1052 | | "reject_once" |
| 1053 | | "reject_always" |
| 1054 | | string; |
| 1055 | export const PermissionOptionKind = Schema.Union([ |
| 1056 | Schema.Literal("allow_once").annotate({ description: "Allow this operation only this time." }), |
| 1057 | Schema.Literal("allow_always").annotate({ |
| 1058 | description: "Allow this operation and remember the choice.", |
| 1059 | }), |
| 1060 | Schema.Literal("reject_once").annotate({ description: "Reject this operation only this time." }), |
| 1061 | Schema.Literal("reject_always").annotate({ |
| 1062 | description: "Reject this operation and remember the choice.", |
| 1063 | }), |
| 1064 | Schema.String.annotate({ |
| 1065 | title: "other", |
| 1066 | description: |
| 1067 | "Custom or future permission option kind.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 1068 | }), |
| 1069 | ]).annotate({ |
| 1070 | description: |
| 1071 | "The type of permission option being presented to the user.\n\nHelps clients choose appropriate icons and UI treatment.", |
| 1072 | identifier: "PermissionOptionKind", |
| 1073 | }); |
| 1074 | |
| 1075 | export type ElicitationSchemaType = "object"; |
| 1076 | export const ElicitationSchemaType = Schema.Union([ |
| 1077 | Schema.Literal("object").annotate({ description: "Object schema type." }), |
| 1078 | ]).annotate({ |
| 1079 | description: "Type discriminator for elicitation schemas.", |
| 1080 | identifier: "ElicitationSchemaType", |
| 1081 | }); |
| 1082 | |
| 1083 | export type StringFormat = "email" | "uri" | "date" | "date-time" | string; |
| 1084 | export const StringFormat = Schema.Union([ |
| 1085 | Schema.Literal("email").annotate({ description: "Email address format." }), |
| 1086 | Schema.Literal("uri").annotate({ description: "URI format." }), |
| 1087 | Schema.Literal("date").annotate({ description: "Date format (YYYY-MM-DD)." }), |
| 1088 | Schema.Literal("date-time").annotate({ description: "Date-time format (RFC 3339)." }), |
| 1089 | Schema.String.annotate({ |
| 1090 | title: "other", |
| 1091 | description: |
| 1092 | "Custom or future string format.\n\nUnknown formats are preserved. Implementations that do not understand a\nformat should treat it as an annotation rather than rejecting the schema.", |
| 1093 | }), |
| 1094 | ]).annotate({ |
| 1095 | description: "String format types for string properties in elicitation schemas.", |
| 1096 | identifier: "StringFormat", |
| 1097 | }); |
| 1098 | |
| 1099 | export type EnumOption = { |
| 1100 | readonly const: string; |
| 1101 | readonly title: string; |
| 1102 | readonly description?: string | null; |
| 1103 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1104 | }; |
| 1105 | export const EnumOption = Schema.Struct({ |
| 1106 | const: Schema.String.annotate({ description: "The constant value for this option." }), |
| 1107 | title: Schema.String.annotate({ description: "Human-readable title for this option." }), |
| 1108 | description: Schema.optionalKey( |
| 1109 | Schema.Union([ |
| 1110 | Schema.String.annotate({ |
| 1111 | description: |
| 1112 | "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.", |
| 1113 | }), |
| 1114 | Schema.Null, |
| 1115 | ]), |
| 1116 | ), |
| 1117 | _meta: Schema.optionalKey( |
| 1118 | Schema.Union([ |
| 1119 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1120 | description: |
| 1121 | "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/v2/draft/extensibility)", |
| 1122 | }), |
| 1123 | Schema.Null, |
| 1124 | ]), |
| 1125 | ), |
| 1126 | }).annotate({ |
| 1127 | description: |
| 1128 | "A titled enum option with a const value, human-readable title, and optional description.", |
| 1129 | identifier: "EnumOption", |
| 1130 | }); |
| 1131 | |
| 1132 | export type TitledMultiSelectItems = never; |
| 1133 | export const TitledMultiSelectItems = Schema.Never.annotate({ |
| 1134 | description: "Items definition for titled multi-select enum properties.", |
| 1135 | identifier: "TitledMultiSelectItems", |
| 1136 | }); |
| 1137 | |
| 1138 | export type McpServerAcpId = string; |
| 1139 | export const McpServerAcpId = Schema.String.annotate({ |
| 1140 | description: |
| 1141 | "**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.", |
| 1142 | identifier: "McpServerAcpId", |
| 1143 | }); |
| 1144 | |
| 1145 | export type ExtRequest = Schema.Json; |
| 1146 | export const ExtRequest = Schema.Json.annotate({ |
| 1147 | expected: "JSON value", |
| 1148 | description: |
| 1149 | "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/v2/draft/extensibility)", |
| 1150 | identifier: "ExtRequest", |
| 1151 | }); |
| 1152 | |
| 1153 | export type ProtocolVersion = number; |
| 1154 | export const ProtocolVersion = Schema.Number.annotate({ |
| 1155 | description: |
| 1156 | "Protocol version identifier.\n\nThis version is only bumped for breaking changes.\nNon-breaking changes should be introduced via capabilities.", |
| 1157 | format: "uint16", |
| 1158 | }) |
| 1159 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 1160 | .check( |
| 1161 | Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), |
| 1162 | ) |
| 1163 | .check( |
| 1164 | Schema.isLessThanOrEqualTo(65535).annotate({ |
| 1165 | expected: "a value less than or equal to 65535", |
| 1166 | identifier: "ProtocolVersion", |
| 1167 | }), |
| 1168 | ); |
| 1169 | |
| 1170 | export type Implementation = { |
| 1171 | readonly name: string; |
| 1172 | readonly title?: string | null; |
| 1173 | readonly version: string; |
| 1174 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1175 | }; |
| 1176 | export const Implementation = Schema.Struct({ |
| 1177 | name: Schema.String.annotate({ |
| 1178 | description: |
| 1179 | "Intended for programmatic or logical use, but can be used as a display\nname fallback if title isn’t present.", |
| 1180 | }), |
| 1181 | title: Schema.optionalKey( |
| 1182 | Schema.Union([ |
| 1183 | Schema.String.annotate({ |
| 1184 | description: |
| 1185 | "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.", |
| 1186 | }), |
| 1187 | Schema.Null, |
| 1188 | ]), |
| 1189 | ), |
| 1190 | version: Schema.String.annotate({ |
| 1191 | description: |
| 1192 | 'Version of the implementation. Can be displayed to the user or used\nfor debugging or metrics purposes. (e.g. "1.0.0").', |
| 1193 | }), |
| 1194 | _meta: Schema.optionalKey( |
| 1195 | Schema.Union([ |
| 1196 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1197 | description: |
| 1198 | "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/v2/draft/extensibility)", |
| 1199 | }), |
| 1200 | Schema.Null, |
| 1201 | ]), |
| 1202 | ), |
| 1203 | }).annotate({ |
| 1204 | description: |
| 1205 | "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.", |
| 1206 | identifier: "Implementation", |
| 1207 | }); |
| 1208 | |
| 1209 | export type AuthMethodId = string; |
| 1210 | export const AuthMethodId = Schema.String.annotate({ |
| 1211 | description: "Typed identifier used for auth method values on the wire.", |
| 1212 | identifier: "AuthMethodId", |
| 1213 | }); |
| 1214 | |
| 1215 | export type EnvVariable = { |
| 1216 | readonly name: string; |
| 1217 | readonly value: string; |
| 1218 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1219 | }; |
| 1220 | export const EnvVariable = Schema.Struct({ |
| 1221 | name: Schema.String.annotate({ description: "The name of the environment variable." }), |
| 1222 | value: Schema.String.annotate({ description: "The value to set for the environment variable." }), |
| 1223 | _meta: Schema.optionalKey( |
| 1224 | Schema.Union([ |
| 1225 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1226 | description: |
| 1227 | "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/v2/draft/extensibility)", |
| 1228 | }), |
| 1229 | Schema.Null, |
| 1230 | ]), |
| 1231 | ), |
| 1232 | }).annotate({ |
| 1233 | description: "An environment variable to set when launching a process.", |
| 1234 | identifier: "EnvVariable", |
| 1235 | }); |
| 1236 | |
| 1237 | export type LoginAuthResponse = { readonly _meta?: { readonly [x: string]: Schema.Json } | null }; |
| 1238 | export const LoginAuthResponse = Schema.Struct({ |
| 1239 | _meta: Schema.optionalKey( |
| 1240 | Schema.Union([ |
| 1241 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1242 | description: |
| 1243 | "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/v2/draft/extensibility)", |
| 1244 | }), |
| 1245 | Schema.Null, |
| 1246 | ]), |
| 1247 | ), |
| 1248 | }).annotate({ |
| 1249 | description: "Response to the `auth/login` method.", |
| 1250 | identifier: "LoginAuthResponse", |
| 1251 | }); |
| 1252 | |
| 1253 | export type ProviderId = string; |
| 1254 | export const ProviderId = Schema.String.annotate({ |
| 1255 | description: |
| 1256 | "**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.", |
| 1257 | identifier: "ProviderId", |
| 1258 | }); |
| 1259 | |
| 1260 | export type LlmProtocol = "anthropic" | "openai" | "azure" | "vertex" | "bedrock" | string; |
| 1261 | export const LlmProtocol = Schema.Union([ |
| 1262 | Schema.Literal("anthropic").annotate({ description: "Anthropic API protocol." }), |
| 1263 | Schema.Literal("openai").annotate({ description: "OpenAI API protocol." }), |
| 1264 | Schema.Literal("azure").annotate({ description: "Azure OpenAI API protocol." }), |
| 1265 | Schema.Literal("vertex").annotate({ description: "Google Vertex AI API protocol." }), |
| 1266 | Schema.Literal("bedrock").annotate({ description: "AWS Bedrock API protocol." }), |
| 1267 | Schema.String.annotate({ |
| 1268 | title: "other", |
| 1269 | description: |
| 1270 | "Custom or future protocol.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 1271 | }), |
| 1272 | ]).annotate({ |
| 1273 | description: |
| 1274 | "**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.", |
| 1275 | identifier: "LlmProtocol", |
| 1276 | }); |
| 1277 | |
| 1278 | export type SetProviderResponse = { readonly _meta?: { readonly [x: string]: Schema.Json } | null }; |
| 1279 | export const SetProviderResponse = Schema.Struct({ |
| 1280 | _meta: Schema.optionalKey( |
| 1281 | Schema.Union([ |
| 1282 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1283 | description: |
| 1284 | "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/v2/draft/extensibility)", |
| 1285 | }), |
| 1286 | Schema.Null, |
| 1287 | ]), |
| 1288 | ), |
| 1289 | }).annotate({ |
| 1290 | description: |
| 1291 | "**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`.", |
| 1292 | identifier: "SetProviderResponse", |
| 1293 | }); |
| 1294 | |
| 1295 | export type DisableProviderResponse = { |
| 1296 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1297 | }; |
| 1298 | export const DisableProviderResponse = Schema.Struct({ |
| 1299 | _meta: Schema.optionalKey( |
| 1300 | Schema.Union([ |
| 1301 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1302 | description: |
| 1303 | "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/v2/draft/extensibility)", |
| 1304 | }), |
| 1305 | Schema.Null, |
| 1306 | ]), |
| 1307 | ), |
| 1308 | }).annotate({ |
| 1309 | description: |
| 1310 | "**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`.", |
| 1311 | identifier: "DisableProviderResponse", |
| 1312 | }); |
| 1313 | |
| 1314 | export type LogoutAuthResponse = { readonly _meta?: { readonly [x: string]: Schema.Json } | null }; |
| 1315 | export const LogoutAuthResponse = Schema.Struct({ |
| 1316 | _meta: Schema.optionalKey( |
| 1317 | Schema.Union([ |
| 1318 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1319 | description: |
| 1320 | "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/v2/draft/extensibility)", |
| 1321 | }), |
| 1322 | Schema.Null, |
| 1323 | ]), |
| 1324 | ), |
| 1325 | }).annotate({ |
| 1326 | description: "Response to the `auth/logout` method.", |
| 1327 | identifier: "LogoutAuthResponse", |
| 1328 | }); |
| 1329 | |
| 1330 | export type SessionListCursor = string; |
| 1331 | export const SessionListCursor = Schema.String.annotate({ |
| 1332 | description: "An opaque cursor used to paginate `session/list` results.", |
| 1333 | identifier: "SessionListCursor", |
| 1334 | }); |
| 1335 | |
| 1336 | export type DeleteSessionResponse = { |
| 1337 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1338 | }; |
| 1339 | export const DeleteSessionResponse = Schema.Struct({ |
| 1340 | _meta: Schema.optionalKey( |
| 1341 | Schema.Union([ |
| 1342 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1343 | description: |
| 1344 | "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/v2/draft/extensibility)", |
| 1345 | }), |
| 1346 | Schema.Null, |
| 1347 | ]), |
| 1348 | ), |
| 1349 | }).annotate({ |
| 1350 | description: "Response from deleting a session.", |
| 1351 | identifier: "DeleteSessionResponse", |
| 1352 | }); |
| 1353 | |
| 1354 | export type CloseSessionResponse = { |
| 1355 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1356 | }; |
| 1357 | export const CloseSessionResponse = Schema.Struct({ |
| 1358 | _meta: Schema.optionalKey( |
| 1359 | Schema.Union([ |
| 1360 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1361 | description: |
| 1362 | "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/v2/draft/extensibility)", |
| 1363 | }), |
| 1364 | Schema.Null, |
| 1365 | ]), |
| 1366 | ), |
| 1367 | }).annotate({ |
| 1368 | description: "Response from closing a session.", |
| 1369 | identifier: "CloseSessionResponse", |
| 1370 | }); |
| 1371 | |
| 1372 | export type PromptResponse = { readonly _meta?: { readonly [x: string]: Schema.Json } | null }; |
| 1373 | export const PromptResponse = Schema.Struct({ |
| 1374 | _meta: Schema.optionalKey( |
| 1375 | Schema.Union([ |
| 1376 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1377 | description: |
| 1378 | "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/v2/draft/extensibility)", |
| 1379 | }), |
| 1380 | Schema.Null, |
| 1381 | ]), |
| 1382 | ), |
| 1383 | }).annotate({ |
| 1384 | description: |
| 1385 | "Response acknowledging that a user prompt was accepted.\n\nThis response does not indicate that the agent has finished processing.\nProcessing and completion are reported through `state_update` session updates.\n\nSee protocol docs: [Prompt Accepted](https://agentclientprotocol.com/protocol/v2/draft/prompt-lifecycle#2-prompt-accepted)", |
| 1386 | identifier: "PromptResponse", |
| 1387 | }); |
| 1388 | |
| 1389 | export type Position = { |
| 1390 | readonly line: number; |
| 1391 | readonly character: number; |
| 1392 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1393 | }; |
| 1394 | export const Position = Schema.Struct({ |
| 1395 | line: Schema.Number.annotate({ description: "Zero-based line number.", format: "uint32" }) |
| 1396 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 1397 | .check( |
| 1398 | Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), |
| 1399 | ), |
| 1400 | character: Schema.Number.annotate({ |
| 1401 | description: "Zero-based character offset (encoding-dependent).", |
| 1402 | format: "uint32", |
| 1403 | }) |
| 1404 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 1405 | .check( |
| 1406 | Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), |
| 1407 | ), |
| 1408 | _meta: Schema.optionalKey( |
| 1409 | Schema.Union([ |
| 1410 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1411 | description: |
| 1412 | "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/v2/draft/extensibility)", |
| 1413 | }), |
| 1414 | Schema.Null, |
| 1415 | ]), |
| 1416 | ), |
| 1417 | }).annotate({ |
| 1418 | description: |
| 1419 | "A zero-based position in a text document.\n\nThe meaning of `character` depends on the negotiated position encoding.", |
| 1420 | identifier: "Position", |
| 1421 | }); |
| 1422 | |
| 1423 | export type CloseNesResponse = { readonly _meta?: { readonly [x: string]: Schema.Json } | null }; |
| 1424 | export const CloseNesResponse = Schema.Struct({ |
| 1425 | _meta: Schema.optionalKey( |
| 1426 | Schema.Union([ |
| 1427 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1428 | description: |
| 1429 | "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/v2/draft/extensibility)", |
| 1430 | }), |
| 1431 | Schema.Null, |
| 1432 | ]), |
| 1433 | ), |
| 1434 | }).annotate({ |
| 1435 | description: "Response from closing an NES session.", |
| 1436 | identifier: "CloseNesResponse", |
| 1437 | }); |
| 1438 | |
| 1439 | export type ExtResponse = Schema.Json; |
| 1440 | export const ExtResponse = Schema.Json.annotate({ |
| 1441 | expected: "JSON value", |
| 1442 | description: |
| 1443 | "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/v2/draft/extensibility)", |
| 1444 | identifier: "ExtResponse", |
| 1445 | }); |
| 1446 | |
| 1447 | export type MessageMcpResponse = Schema.Json; |
| 1448 | export const MessageMcpResponse = Schema.Json.annotate({ |
| 1449 | expected: "JSON value", |
| 1450 | description: |
| 1451 | "**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.", |
| 1452 | identifier: "MessageMcpResponse", |
| 1453 | }); |
| 1454 | |
| 1455 | export type ErrorCode = |
| 1456 | | -32700 |
| 1457 | | -32600 |
| 1458 | | -32601 |
| 1459 | | -32602 |
| 1460 | | -32603 |
| 1461 | | -32800 |
| 1462 | | -32000 |
| 1463 | | -32002 |
| 1464 | | number; |
| 1465 | export const ErrorCode = Schema.Union([ |
| 1466 | Schema.Literal(-32700).annotate({ |
| 1467 | title: "Parse error", |
| 1468 | description: |
| 1469 | "**Parse error**: Invalid JSON was received by the server.\nAn error occurred on the server while parsing the JSON text.", |
| 1470 | format: "int32", |
| 1471 | }), |
| 1472 | Schema.Literal(-32600).annotate({ |
| 1473 | title: "Invalid request", |
| 1474 | description: "**Invalid request**: The JSON sent is not a valid Request object.", |
| 1475 | format: "int32", |
| 1476 | }), |
| 1477 | Schema.Literal(-32601).annotate({ |
| 1478 | title: "Method not found", |
| 1479 | description: "**Method not found**: The method does not exist or is not available.", |
| 1480 | format: "int32", |
| 1481 | }), |
| 1482 | Schema.Literal(-32602).annotate({ |
| 1483 | title: "Invalid params", |
| 1484 | description: "**Invalid params**: Invalid method parameter(s).", |
| 1485 | format: "int32", |
| 1486 | }), |
| 1487 | Schema.Literal(-32603).annotate({ |
| 1488 | title: "Internal error", |
| 1489 | description: |
| 1490 | "**Internal error**: Internal JSON-RPC error.\nReserved for implementation-defined server errors.", |
| 1491 | format: "int32", |
| 1492 | }), |
| 1493 | Schema.Literal(-32800).annotate({ |
| 1494 | title: "Request cancelled", |
| 1495 | description: |
| 1496 | "**Request cancelled**: Execution of the method was aborted either due to a cancellation request from the caller or\nbecause of resource constraints or shutdown.", |
| 1497 | format: "int32", |
| 1498 | }), |
| 1499 | Schema.Literal(-32000).annotate({ |
| 1500 | title: "Authentication required", |
| 1501 | description: |
| 1502 | "**Authentication required**: Authentication is required before this operation can be performed.", |
| 1503 | format: "int32", |
| 1504 | }), |
| 1505 | Schema.Literal(-32002).annotate({ |
| 1506 | title: "Resource not found", |
| 1507 | description: "**Resource not found**: A given resource, such as a file, was not found.", |
| 1508 | format: "int32", |
| 1509 | }), |
| 1510 | Schema.Number.annotate({ |
| 1511 | title: "Other", |
| 1512 | description: "Other undefined error code.", |
| 1513 | format: "int32", |
| 1514 | }).check(Schema.isInt().annotate({ expected: "an integer" })), |
| 1515 | ]).annotate({ |
| 1516 | description: |
| 1517 | "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.", |
| 1518 | identifier: "ErrorCode", |
| 1519 | }); |
| 1520 | |
| 1521 | export type TerminalAuthCapabilities = { |
| 1522 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1523 | }; |
| 1524 | export const TerminalAuthCapabilities = 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\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 1530 | }), |
| 1531 | Schema.Null, |
| 1532 | ]), |
| 1533 | ), |
| 1534 | }).annotate({ |
| 1535 | description: |
| 1536 | "Capabilities for terminal authentication methods.\n\nSupplying `{}` means the client can reproduce the configured agent\ninvocation in an interactive terminal and supports terminal authentication\nmethods.", |
| 1537 | identifier: "TerminalAuthCapabilities", |
| 1538 | }); |
| 1539 | |
| 1540 | export type ElicitationFormCapabilities = { |
| 1541 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1542 | }; |
| 1543 | export const ElicitationFormCapabilities = 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/v2/draft/extensibility)", |
| 1549 | }), |
| 1550 | Schema.Null, |
| 1551 | ]), |
| 1552 | ), |
| 1553 | }).annotate({ |
| 1554 | description: |
| 1555 | "Form-based elicitation capabilities.\n\nSupplying `{}` means the client supports form-based elicitation.", |
| 1556 | identifier: "ElicitationFormCapabilities", |
| 1557 | }); |
| 1558 | |
| 1559 | export type ElicitationUrlCapabilities = { |
| 1560 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1561 | }; |
| 1562 | export const ElicitationUrlCapabilities = Schema.Struct({ |
| 1563 | _meta: Schema.optionalKey( |
| 1564 | Schema.Union([ |
| 1565 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1566 | description: |
| 1567 | "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/v2/draft/extensibility)", |
| 1568 | }), |
| 1569 | Schema.Null, |
| 1570 | ]), |
| 1571 | ), |
| 1572 | }).annotate({ |
| 1573 | description: |
| 1574 | "URL-based elicitation capabilities.\n\nSupplying `{}` means the client supports URL-based elicitation.", |
| 1575 | identifier: "ElicitationUrlCapabilities", |
| 1576 | }); |
| 1577 | |
| 1578 | export type NesJumpCapabilities = { readonly _meta?: { readonly [x: string]: Schema.Json } | null }; |
| 1579 | export const NesJumpCapabilities = Schema.Struct({ |
| 1580 | _meta: Schema.optionalKey( |
| 1581 | Schema.Union([ |
| 1582 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1583 | description: |
| 1584 | "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/v2/draft/extensibility)", |
| 1585 | }), |
| 1586 | Schema.Null, |
| 1587 | ]), |
| 1588 | ), |
| 1589 | }).annotate({ |
| 1590 | description: "Marker for jump suggestion support.", |
| 1591 | identifier: "NesJumpCapabilities", |
| 1592 | }); |
| 1593 | |
| 1594 | export type NesRenameCapabilities = { |
| 1595 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1596 | }; |
| 1597 | export const NesRenameCapabilities = Schema.Struct({ |
| 1598 | _meta: Schema.optionalKey( |
| 1599 | Schema.Union([ |
| 1600 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1601 | description: |
| 1602 | "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/v2/draft/extensibility)", |
| 1603 | }), |
| 1604 | Schema.Null, |
| 1605 | ]), |
| 1606 | ), |
| 1607 | }).annotate({ |
| 1608 | description: "Marker for rename suggestion support.", |
| 1609 | identifier: "NesRenameCapabilities", |
| 1610 | }); |
| 1611 | |
| 1612 | export type NesSearchAndReplaceCapabilities = { |
| 1613 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1614 | }; |
| 1615 | export const NesSearchAndReplaceCapabilities = Schema.Struct({ |
| 1616 | _meta: Schema.optionalKey( |
| 1617 | Schema.Union([ |
| 1618 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1619 | description: |
| 1620 | "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/v2/draft/extensibility)", |
| 1621 | }), |
| 1622 | Schema.Null, |
| 1623 | ]), |
| 1624 | ), |
| 1625 | }).annotate({ |
| 1626 | description: "Marker for search and replace suggestion support.", |
| 1627 | identifier: "NesSearchAndReplaceCapabilities", |
| 1628 | }); |
| 1629 | |
| 1630 | export type NesRejectReason = "rejected" | "ignored" | "replaced" | "cancelled" | string; |
| 1631 | export const NesRejectReason = Schema.Union([ |
| 1632 | Schema.Literal("rejected").annotate({ |
| 1633 | description: "The user explicitly dismissed the suggestion.", |
| 1634 | }), |
| 1635 | Schema.Literal("ignored").annotate({ |
| 1636 | description: "The suggestion was shown but the user continued editing without interacting.", |
| 1637 | }), |
| 1638 | Schema.Literal("replaced").annotate({ |
| 1639 | description: "The suggestion was superseded by a newer suggestion.", |
| 1640 | }), |
| 1641 | Schema.Literal("cancelled").annotate({ |
| 1642 | description: "The request was cancelled before the agent returned a response.", |
| 1643 | }), |
| 1644 | Schema.String.annotate({ |
| 1645 | title: "Other", |
| 1646 | description: |
| 1647 | "Custom or future rejection reason.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 1648 | }), |
| 1649 | ]).annotate({ |
| 1650 | description: "The reason a suggestion was rejected.", |
| 1651 | identifier: "NesRejectReason", |
| 1652 | }); |
| 1653 | |
| 1654 | export type ListProvidersRequest = { |
| 1655 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1656 | }; |
| 1657 | export const ListProvidersRequest = Schema.Struct({ |
| 1658 | _meta: Schema.optionalKey( |
| 1659 | Schema.Union([ |
| 1660 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1661 | description: |
| 1662 | "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/v2/draft/extensibility)", |
| 1663 | }), |
| 1664 | Schema.Null, |
| 1665 | ]), |
| 1666 | ), |
| 1667 | }).annotate({ |
| 1668 | description: |
| 1669 | "**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`.", |
| 1670 | identifier: "ListProvidersRequest", |
| 1671 | }); |
| 1672 | |
| 1673 | export type LogoutAuthRequest = { readonly _meta?: { readonly [x: string]: Schema.Json } | null }; |
| 1674 | export const LogoutAuthRequest = Schema.Struct({ |
| 1675 | _meta: Schema.optionalKey( |
| 1676 | Schema.Union([ |
| 1677 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1678 | description: |
| 1679 | "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/v2/draft/extensibility)", |
| 1680 | }), |
| 1681 | Schema.Null, |
| 1682 | ]), |
| 1683 | ), |
| 1684 | }).annotate({ |
| 1685 | description: |
| 1686 | "Request parameters for the `auth/logout` method.\n\nTerminates the current authenticated session.\n\nAgents MUST support this method when their `initialize` response advertised\nat least one valid authentication method. Clients MUST NOT call this method\nwhen `authMethods` was omitted or empty.", |
| 1687 | identifier: "LogoutAuthRequest", |
| 1688 | }); |
| 1689 | |
| 1690 | export type HttpHeader = { |
| 1691 | readonly name: string; |
| 1692 | readonly value: string; |
| 1693 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1694 | }; |
| 1695 | export const HttpHeader = Schema.Struct({ |
| 1696 | name: Schema.String.annotate({ description: "The name of the HTTP header." }), |
| 1697 | value: Schema.String.annotate({ description: "The value to set for the HTTP header." }), |
| 1698 | _meta: Schema.optionalKey( |
| 1699 | Schema.Union([ |
| 1700 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1701 | description: |
| 1702 | "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/v2/draft/extensibility)", |
| 1703 | }), |
| 1704 | Schema.Null, |
| 1705 | ]), |
| 1706 | ), |
| 1707 | }).annotate({ |
| 1708 | description: "An HTTP header to set when making requests to the MCP server.", |
| 1709 | identifier: "HttpHeader", |
| 1710 | }); |
| 1711 | |
| 1712 | export type ReplayFrom = |
| 1713 | | { readonly type: "start"; readonly _meta?: { readonly [x: string]: Schema.Json } | null } |
| 1714 | | ({ readonly type: string; readonly _meta?: { readonly [x: string]: Schema.Json } | null } & { |
| 1715 | readonly [x: string]: Schema.Json; |
| 1716 | }); |
| 1717 | export const ReplayFrom = Schema.Union([ |
| 1718 | Schema.Struct({ |
| 1719 | type: Schema.Literal("start"), |
| 1720 | _meta: Schema.optionalKey( |
| 1721 | Schema.Union([ |
| 1722 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1723 | description: |
| 1724 | "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/v2/draft/extensibility)", |
| 1725 | }), |
| 1726 | Schema.Null, |
| 1727 | ]), |
| 1728 | ), |
| 1729 | }).annotate({ |
| 1730 | description: "Inclusive replay cursor requesting replay from the start of the conversation.", |
| 1731 | }), |
| 1732 | Schema.StructWithRest( |
| 1733 | Schema.Struct({ |
| 1734 | type: Schema.String.annotate({ |
| 1735 | description: |
| 1736 | "Custom or future replay cursor type.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 1737 | }).check( |
| 1738 | Schema.isPattern(new RegExp("^(?!(?:\\x73tart)$)[\\s\\S]*$")).annotate({ |
| 1739 | expected: "a string matching the RegExp ^(?!(?:\\x73tart)$)[\\s\\S]*$", |
| 1740 | }), |
| 1741 | ), |
| 1742 | _meta: Schema.optionalKey( |
| 1743 | Schema.Union([ |
| 1744 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1745 | description: |
| 1746 | "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/v2/draft/extensibility)", |
| 1747 | }), |
| 1748 | Schema.Null, |
| 1749 | ]), |
| 1750 | ), |
| 1751 | }), |
| 1752 | [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], |
| 1753 | ).annotate({ |
| 1754 | title: "other", |
| 1755 | description: |
| 1756 | "Custom or future replay cursor.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.\n\nReceivers that do not understand this cursor should preserve the raw\npayload when storing, replaying, proxying, or forwarding requests, and\notherwise reject the request rather than guessing where to replay from.", |
| 1757 | }), |
| 1758 | ]).annotate({ |
| 1759 | description: |
| 1760 | "Inclusive cursor describing where replayed session history should begin.\n\nReplay includes the position identified by the cursor.", |
| 1761 | identifier: "ReplayFrom", |
| 1762 | }); |
| 1763 | |
| 1764 | export type WorkspaceFolder = { |
| 1765 | readonly uri: string; |
| 1766 | readonly name: string; |
| 1767 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1768 | }; |
| 1769 | export const WorkspaceFolder = Schema.Struct({ |
| 1770 | uri: Schema.String.annotate({ description: "The URI of the folder.", format: "uri" }), |
| 1771 | name: Schema.String.annotate({ description: "The display name of the folder." }), |
| 1772 | _meta: Schema.optionalKey( |
| 1773 | Schema.Union([ |
| 1774 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1775 | description: |
| 1776 | "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/v2/draft/extensibility)", |
| 1777 | }), |
| 1778 | Schema.Null, |
| 1779 | ]), |
| 1780 | ), |
| 1781 | }).annotate({ description: "A workspace folder.", identifier: "WorkspaceFolder" }); |
| 1782 | |
| 1783 | export type NesRepository = { |
| 1784 | readonly name: string; |
| 1785 | readonly owner: string; |
| 1786 | readonly remoteUrl: string; |
| 1787 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1788 | }; |
| 1789 | export const NesRepository = Schema.Struct({ |
| 1790 | name: Schema.String.annotate({ description: "The repository name." }), |
| 1791 | owner: Schema.String.annotate({ description: "The repository owner." }), |
| 1792 | remoteUrl: Schema.String.annotate({ description: "The remote URL of the repository." }), |
| 1793 | _meta: Schema.optionalKey( |
| 1794 | Schema.Union([ |
| 1795 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1796 | description: |
| 1797 | "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/v2/draft/extensibility)", |
| 1798 | }), |
| 1799 | Schema.Null, |
| 1800 | ]), |
| 1801 | ), |
| 1802 | }).annotate({ |
| 1803 | description: "Repository metadata for an NES session.", |
| 1804 | identifier: "NesRepository", |
| 1805 | }); |
| 1806 | |
| 1807 | export type NesTriggerKind = "automatic" | "diagnostic" | "manual" | string; |
| 1808 | export const NesTriggerKind = Schema.Union([ |
| 1809 | Schema.Literal("automatic").annotate({ |
| 1810 | description: "Triggered by user typing or cursor movement.", |
| 1811 | }), |
| 1812 | Schema.Literal("diagnostic").annotate({ |
| 1813 | description: "Triggered by a diagnostic appearing at or near the cursor.", |
| 1814 | }), |
| 1815 | Schema.Literal("manual").annotate({ |
| 1816 | description: "Triggered by an explicit user action (keyboard shortcut).", |
| 1817 | }), |
| 1818 | Schema.String.annotate({ |
| 1819 | title: "Other", |
| 1820 | description: |
| 1821 | "Custom or future suggestion trigger kind.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 1822 | }), |
| 1823 | ]).annotate({ |
| 1824 | description: "What triggered the suggestion request.", |
| 1825 | identifier: "NesTriggerKind", |
| 1826 | }); |
| 1827 | |
| 1828 | export type NesRecentFile = { |
| 1829 | readonly uri: string; |
| 1830 | readonly languageId: string; |
| 1831 | readonly text: string; |
| 1832 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1833 | }; |
| 1834 | export const NesRecentFile = Schema.Struct({ |
| 1835 | uri: Schema.String.annotate({ description: "The URI of the file.", format: "uri" }), |
| 1836 | languageId: Schema.String.annotate({ description: "The language identifier." }), |
| 1837 | text: Schema.String.annotate({ description: "The full text content of the file." }), |
| 1838 | _meta: Schema.optionalKey( |
| 1839 | Schema.Union([ |
| 1840 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1841 | description: |
| 1842 | "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/v2/draft/extensibility)", |
| 1843 | }), |
| 1844 | Schema.Null, |
| 1845 | ]), |
| 1846 | ), |
| 1847 | }).annotate({ description: "A recently accessed file.", identifier: "NesRecentFile" }); |
| 1848 | |
| 1849 | export type NesExcerpt = { |
| 1850 | readonly startLine: number; |
| 1851 | readonly endLine: number; |
| 1852 | readonly text: string; |
| 1853 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1854 | }; |
| 1855 | export const NesExcerpt = Schema.Struct({ |
| 1856 | startLine: Schema.Number.annotate({ |
| 1857 | description: "The start line of the excerpt (zero-based).", |
| 1858 | format: "uint32", |
| 1859 | }) |
| 1860 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 1861 | .check( |
| 1862 | Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), |
| 1863 | ), |
| 1864 | endLine: Schema.Number.annotate({ |
| 1865 | description: "The end line of the excerpt (zero-based).", |
| 1866 | format: "uint32", |
| 1867 | }) |
| 1868 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 1869 | .check( |
| 1870 | Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), |
| 1871 | ), |
| 1872 | text: Schema.String.annotate({ description: "The text content of the excerpt." }), |
| 1873 | _meta: Schema.optionalKey( |
| 1874 | Schema.Union([ |
| 1875 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1876 | description: |
| 1877 | "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/v2/draft/extensibility)", |
| 1878 | }), |
| 1879 | Schema.Null, |
| 1880 | ]), |
| 1881 | ), |
| 1882 | }).annotate({ description: "A code excerpt from a file.", identifier: "NesExcerpt" }); |
| 1883 | |
| 1884 | export type NesEditHistoryEntry = { |
| 1885 | readonly uri: string; |
| 1886 | readonly diff: string; |
| 1887 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1888 | }; |
| 1889 | export const NesEditHistoryEntry = Schema.Struct({ |
| 1890 | uri: Schema.String.annotate({ description: "The URI of the edited file.", format: "uri" }), |
| 1891 | diff: Schema.String.annotate({ description: "A diff representing the edit." }), |
| 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/v2/draft/extensibility)", |
| 1897 | }), |
| 1898 | Schema.Null, |
| 1899 | ]), |
| 1900 | ), |
| 1901 | }).annotate({ description: "An entry in the edit history.", identifier: "NesEditHistoryEntry" }); |
| 1902 | |
| 1903 | export type NesDiagnosticSeverity = "error" | "warning" | "information" | "hint" | string; |
| 1904 | export const NesDiagnosticSeverity = Schema.Union([ |
| 1905 | Schema.Literal("error").annotate({ description: "An error." }), |
| 1906 | Schema.Literal("warning").annotate({ description: "A warning." }), |
| 1907 | Schema.Literal("information").annotate({ description: "An informational message." }), |
| 1908 | Schema.Literal("hint").annotate({ description: "A hint." }), |
| 1909 | Schema.String.annotate({ |
| 1910 | title: "Other", |
| 1911 | description: |
| 1912 | "Custom or future diagnostic severity.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 1913 | }), |
| 1914 | ]).annotate({ description: "Severity of a diagnostic.", identifier: "NesDiagnosticSeverity" }); |
| 1915 | |
| 1916 | export type ElicitationContentValue = string | number | number | boolean | ReadonlyArray<string>; |
| 1917 | export const ElicitationContentValue = Schema.Union([ |
| 1918 | Schema.String.annotate({ |
| 1919 | title: "String", |
| 1920 | description: "String value accepted in elicitation response content.", |
| 1921 | }), |
| 1922 | Schema.Number.annotate({ |
| 1923 | title: "Integer", |
| 1924 | description: "Integer value accepted in elicitation response content.", |
| 1925 | format: "int64", |
| 1926 | }).check(Schema.isInt().annotate({ expected: "an integer" })), |
| 1927 | Schema.Number.annotate({ |
| 1928 | title: "Number", |
| 1929 | description: "Number value accepted in elicitation response content.", |
| 1930 | format: "double", |
| 1931 | }).check(Schema.isFinite().annotate({ expected: "a finite number" })), |
| 1932 | Schema.Boolean.annotate({ |
| 1933 | title: "Boolean", |
| 1934 | description: "Boolean value accepted in elicitation response content.", |
| 1935 | }), |
| 1936 | Schema.Array(Schema.String).annotate({ |
| 1937 | title: "StringArray", |
| 1938 | description: "String array value accepted in elicitation response content.", |
| 1939 | }), |
| 1940 | ]).annotate({ |
| 1941 | description: "Allowed wire representations for [`ElicitationContentValue`].", |
| 1942 | identifier: "ElicitationContentValue", |
| 1943 | }); |
| 1944 | |
| 1945 | export type DisconnectMcpResponse = { |
| 1946 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1947 | }; |
| 1948 | export const DisconnectMcpResponse = Schema.Struct({ |
| 1949 | _meta: Schema.optionalKey( |
| 1950 | Schema.Union([ |
| 1951 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1952 | description: |
| 1953 | "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/v2/draft/extensibility)", |
| 1954 | }), |
| 1955 | Schema.Null, |
| 1956 | ]), |
| 1957 | ), |
| 1958 | }).annotate({ |
| 1959 | description: |
| 1960 | "**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`.", |
| 1961 | identifier: "DisconnectMcpResponse", |
| 1962 | }); |
| 1963 | |
| 1964 | export type StartNesResponse = { |
| 1965 | readonly sessionId: SessionId; |
| 1966 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1967 | }; |
| 1968 | export const StartNesResponse = Schema.Struct({ |
| 1969 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 1970 | description: "The session ID for the newly started NES session.", |
| 1971 | }), |
| 1972 | _meta: Schema.optionalKey( |
| 1973 | Schema.Union([ |
| 1974 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1975 | description: |
| 1976 | "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/v2/draft/extensibility)", |
| 1977 | }), |
| 1978 | Schema.Null, |
| 1979 | ]), |
| 1980 | ), |
| 1981 | }).annotate({ description: "Response to `nes/start`.", identifier: "StartNesResponse" }); |
| 1982 | |
| 1983 | export type CancelSessionNotification = { |
| 1984 | readonly sessionId: SessionId; |
| 1985 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 1986 | }; |
| 1987 | export const CancelSessionNotification = Schema.Struct({ |
| 1988 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 1989 | description: "The ID of the session to cancel operations for.", |
| 1990 | }), |
| 1991 | _meta: Schema.optionalKey( |
| 1992 | Schema.Union([ |
| 1993 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 1994 | description: |
| 1995 | "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/v2/draft/extensibility)", |
| 1996 | }), |
| 1997 | Schema.Null, |
| 1998 | ]), |
| 1999 | ), |
| 2000 | }).annotate({ |
| 2001 | description: |
| 2002 | "Notification to cancel ongoing operations for a session.\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/v2/draft/prompt-lifecycle#cancellation)", |
| 2003 | identifier: "CancelSessionNotification", |
| 2004 | }); |
| 2005 | |
| 2006 | export type DidOpenDocumentNotification = { |
| 2007 | readonly sessionId: SessionId; |
| 2008 | readonly uri: string; |
| 2009 | readonly languageId: string; |
| 2010 | readonly version: number; |
| 2011 | readonly text: string; |
| 2012 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2013 | }; |
| 2014 | export const DidOpenDocumentNotification = Schema.Struct({ |
| 2015 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 2016 | description: "The session ID for this notification.", |
| 2017 | }), |
| 2018 | uri: Schema.String.annotate({ description: "The URI of the opened document.", format: "uri" }), |
| 2019 | languageId: Schema.String.annotate({ |
| 2020 | description: 'The language identifier of the document (e.g., "rust", "python").', |
| 2021 | }), |
| 2022 | version: Schema.Number.annotate({ |
| 2023 | description: "The version number of the document.", |
| 2024 | format: "int64", |
| 2025 | }).check(Schema.isInt().annotate({ expected: "an integer" })), |
| 2026 | text: Schema.String.annotate({ description: "The full text content of the document." }), |
| 2027 | _meta: Schema.optionalKey( |
| 2028 | Schema.Union([ |
| 2029 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2030 | description: |
| 2031 | "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/v2/draft/extensibility)", |
| 2032 | }), |
| 2033 | Schema.Null, |
| 2034 | ]), |
| 2035 | ), |
| 2036 | }).annotate({ |
| 2037 | description: "Notification sent when a file is opened in the editor.", |
| 2038 | identifier: "DidOpenDocumentNotification", |
| 2039 | }); |
| 2040 | |
| 2041 | export type DidCloseDocumentNotification = { |
| 2042 | readonly sessionId: SessionId; |
| 2043 | readonly uri: string; |
| 2044 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2045 | }; |
| 2046 | export const DidCloseDocumentNotification = Schema.Struct({ |
| 2047 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 2048 | description: "The session ID for this notification.", |
| 2049 | }), |
| 2050 | uri: Schema.String.annotate({ description: "The URI of the closed document.", format: "uri" }), |
| 2051 | _meta: Schema.optionalKey( |
| 2052 | Schema.Union([ |
| 2053 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2054 | description: |
| 2055 | "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/v2/draft/extensibility)", |
| 2056 | }), |
| 2057 | Schema.Null, |
| 2058 | ]), |
| 2059 | ), |
| 2060 | }).annotate({ |
| 2061 | description: "Notification sent when a file is closed.", |
| 2062 | identifier: "DidCloseDocumentNotification", |
| 2063 | }); |
| 2064 | |
| 2065 | export type DidSaveDocumentNotification = { |
| 2066 | readonly sessionId: SessionId; |
| 2067 | readonly uri: string; |
| 2068 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2069 | }; |
| 2070 | export const DidSaveDocumentNotification = Schema.Struct({ |
| 2071 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 2072 | description: "The session ID for this notification.", |
| 2073 | }), |
| 2074 | uri: Schema.String.annotate({ description: "The URI of the saved document.", format: "uri" }), |
| 2075 | _meta: Schema.optionalKey( |
| 2076 | Schema.Union([ |
| 2077 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2078 | description: |
| 2079 | "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/v2/draft/extensibility)", |
| 2080 | }), |
| 2081 | Schema.Null, |
| 2082 | ]), |
| 2083 | ), |
| 2084 | }).annotate({ |
| 2085 | description: "Notification sent when a file is saved.", |
| 2086 | identifier: "DidSaveDocumentNotification", |
| 2087 | }); |
| 2088 | |
| 2089 | export type DeleteSessionRequest = { |
| 2090 | readonly sessionId: SessionId; |
| 2091 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2092 | }; |
| 2093 | export const DeleteSessionRequest = Schema.Struct({ |
| 2094 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 2095 | description: "The ID of the session to delete.", |
| 2096 | }), |
| 2097 | _meta: Schema.optionalKey( |
| 2098 | Schema.Union([ |
| 2099 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2100 | description: |
| 2101 | "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/v2/draft/extensibility)", |
| 2102 | }), |
| 2103 | Schema.Null, |
| 2104 | ]), |
| 2105 | ), |
| 2106 | }).annotate({ |
| 2107 | description: |
| 2108 | "Request parameters for deleting an existing session from `session/list`.\n\nOnly available if the Agent supports the `session.delete` capability.", |
| 2109 | identifier: "DeleteSessionRequest", |
| 2110 | }); |
| 2111 | |
| 2112 | export type CloseSessionRequest = { |
| 2113 | readonly sessionId: SessionId; |
| 2114 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2115 | }; |
| 2116 | export const CloseSessionRequest = Schema.Struct({ |
| 2117 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 2118 | description: "The ID of the session to close.", |
| 2119 | }), |
| 2120 | _meta: Schema.optionalKey( |
| 2121 | Schema.Union([ |
| 2122 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2123 | description: |
| 2124 | "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/v2/draft/extensibility)", |
| 2125 | }), |
| 2126 | Schema.Null, |
| 2127 | ]), |
| 2128 | ), |
| 2129 | }).annotate({ |
| 2130 | description: |
| 2131 | "Request parameters for closing an active session.\n\nThe agent **must** cancel any ongoing work related to the session (treat it\nas if `session/cancel` was called) and then free up any resources associated\nwith the session.", |
| 2132 | identifier: "CloseSessionRequest", |
| 2133 | }); |
| 2134 | |
| 2135 | export type CloseNesRequest = { |
| 2136 | readonly sessionId: SessionId; |
| 2137 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2138 | }; |
| 2139 | export const CloseNesRequest = Schema.Struct({ |
| 2140 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 2141 | description: "The ID of the NES session to close.", |
| 2142 | }), |
| 2143 | _meta: Schema.optionalKey( |
| 2144 | Schema.Union([ |
| 2145 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2146 | description: |
| 2147 | "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/v2/draft/extensibility)", |
| 2148 | }), |
| 2149 | Schema.Null, |
| 2150 | ]), |
| 2151 | ), |
| 2152 | }).annotate({ |
| 2153 | description: |
| 2154 | "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.", |
| 2155 | identifier: "CloseNesRequest", |
| 2156 | }); |
| 2157 | |
| 2158 | export type AcceptNesNotification = { |
| 2159 | readonly sessionId: SessionId; |
| 2160 | readonly suggestionId: NesSuggestionId; |
| 2161 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2162 | }; |
| 2163 | export const AcceptNesNotification = Schema.Struct({ |
| 2164 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 2165 | description: "The session ID for this notification.", |
| 2166 | }), |
| 2167 | suggestionId: Schema.suspend((): Schema.Codec<NesSuggestionId> => NesSuggestionId).annotate({ |
| 2168 | description: "The ID of the accepted suggestion.", |
| 2169 | }), |
| 2170 | _meta: Schema.optionalKey( |
| 2171 | Schema.Union([ |
| 2172 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2173 | description: |
| 2174 | "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/v2/draft/extensibility)", |
| 2175 | }), |
| 2176 | Schema.Null, |
| 2177 | ]), |
| 2178 | ), |
| 2179 | }).annotate({ |
| 2180 | description: "Notification sent when a suggestion is accepted.", |
| 2181 | identifier: "AcceptNesNotification", |
| 2182 | }); |
| 2183 | |
| 2184 | export type PromptCapabilities = { |
| 2185 | readonly image?: PromptImageCapabilities | null; |
| 2186 | readonly audio?: PromptAudioCapabilities | null; |
| 2187 | readonly embeddedContext?: PromptEmbeddedContextCapabilities | null; |
| 2188 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2189 | }; |
| 2190 | export const PromptCapabilities = Schema.Struct({ |
| 2191 | image: Schema.optionalKey( |
| 2192 | Schema.Union([PromptImageCapabilities, Schema.Null]).annotate({ |
| 2193 | description: |
| 2194 | "Agent supports [`ContentBlock::Image`].\n\nOptional. Omitted or `null` both mean the agent does not advertise support.\nSupplying `{}` means the agent supports image content in prompts.", |
| 2195 | }), |
| 2196 | ), |
| 2197 | audio: Schema.optionalKey( |
| 2198 | Schema.Union([PromptAudioCapabilities, Schema.Null]).annotate({ |
| 2199 | description: |
| 2200 | "Agent supports [`ContentBlock::Audio`].\n\nOptional. Omitted or `null` both mean the agent does not advertise support.\nSupplying `{}` means the agent supports audio content in prompts.", |
| 2201 | }), |
| 2202 | ), |
| 2203 | embeddedContext: Schema.optionalKey( |
| 2204 | Schema.Union([PromptEmbeddedContextCapabilities, Schema.Null]).annotate({ |
| 2205 | description: |
| 2206 | "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.\n\nOptional. Omitted or `null` both mean the agent does not advertise support.\nSupplying `{}` means the agent supports embedded context in prompts.", |
| 2207 | }), |
| 2208 | ), |
| 2209 | _meta: Schema.optionalKey( |
| 2210 | Schema.Union([ |
| 2211 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2212 | description: |
| 2213 | "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/v2/draft/extensibility)", |
| 2214 | }), |
| 2215 | Schema.Null, |
| 2216 | ]), |
| 2217 | ), |
| 2218 | }).annotate({ |
| 2219 | description: |
| 2220 | "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/v2/draft/initialization#prompt-capabilities)", |
| 2221 | identifier: "PromptCapabilities", |
| 2222 | }); |
| 2223 | |
| 2224 | export type McpCapabilities = { |
| 2225 | readonly stdio?: McpStdioCapabilities | null; |
| 2226 | readonly http?: McpHttpCapabilities | null; |
| 2227 | readonly acp?: McpAcpCapabilities | null; |
| 2228 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2229 | }; |
| 2230 | export const McpCapabilities = Schema.Struct({ |
| 2231 | stdio: Schema.optionalKey( |
| 2232 | Schema.Union([McpStdioCapabilities, Schema.Null]).annotate({ |
| 2233 | description: |
| 2234 | "Agent supports [`McpServer::Stdio`].\n\nOptional. Omitted or `null` both mean the agent does not advertise support.\nSupplying `{}` means the agent supports stdio MCP server transports.", |
| 2235 | }), |
| 2236 | ), |
| 2237 | http: Schema.optionalKey( |
| 2238 | Schema.Union([McpHttpCapabilities, Schema.Null]).annotate({ |
| 2239 | description: |
| 2240 | "Agent supports [`McpServer::Http`].\n\nOptional. Omitted or `null` both mean the agent does not advertise support.\nSupplying `{}` means the agent supports HTTP MCP server transports.", |
| 2241 | }), |
| 2242 | ), |
| 2243 | acp: Schema.optionalKey( |
| 2244 | Schema.Union([McpAcpCapabilities, Schema.Null]).annotate({ |
| 2245 | description: |
| 2246 | "**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`].\n\nOptional. Omitted or `null` both mean the agent does not advertise support.\nSupplying `{}` means the agent supports ACP MCP server transports.", |
| 2247 | }), |
| 2248 | ), |
| 2249 | _meta: Schema.optionalKey( |
| 2250 | Schema.Union([ |
| 2251 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2252 | description: |
| 2253 | "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/v2/draft/extensibility)", |
| 2254 | }), |
| 2255 | Schema.Null, |
| 2256 | ]), |
| 2257 | ), |
| 2258 | }).annotate({ |
| 2259 | description: "MCP capabilities supported by the agent for session lifecycle requests.", |
| 2260 | identifier: "McpCapabilities", |
| 2261 | }); |
| 2262 | |
| 2263 | export type NesDocumentDidChangeCapabilities = { |
| 2264 | readonly syncKind: TextDocumentSyncKind; |
| 2265 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2266 | }; |
| 2267 | export const NesDocumentDidChangeCapabilities = Schema.Struct({ |
| 2268 | syncKind: Schema.suspend((): Schema.Codec<TextDocumentSyncKind> => TextDocumentSyncKind).annotate( |
| 2269 | { description: 'The sync kind the agent wants: `"full"` or `"incremental"`.' }, |
| 2270 | ), |
| 2271 | _meta: Schema.optionalKey( |
| 2272 | Schema.Union([ |
| 2273 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2274 | description: |
| 2275 | "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/v2/draft/extensibility)", |
| 2276 | }), |
| 2277 | Schema.Null, |
| 2278 | ]), |
| 2279 | ), |
| 2280 | }).annotate({ |
| 2281 | description: "Capabilities for `document/didChange` events.", |
| 2282 | identifier: "NesDocumentDidChangeCapabilities", |
| 2283 | }); |
| 2284 | |
| 2285 | export type NesContextCapabilities = { |
| 2286 | readonly recentFiles?: NesRecentFilesCapabilities | null; |
| 2287 | readonly relatedSnippets?: NesRelatedSnippetsCapabilities | null; |
| 2288 | readonly editHistory?: NesEditHistoryCapabilities | null; |
| 2289 | readonly userActions?: NesUserActionsCapabilities | null; |
| 2290 | readonly openFiles?: NesOpenFilesCapabilities | null; |
| 2291 | readonly diagnostics?: NesDiagnosticsCapabilities | null; |
| 2292 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2293 | }; |
| 2294 | export const NesContextCapabilities = Schema.Struct({ |
| 2295 | recentFiles: Schema.optionalKey( |
| 2296 | Schema.Union([NesRecentFilesCapabilities, Schema.Null]).annotate({ |
| 2297 | description: "Whether the agent wants recent files context.", |
| 2298 | }), |
| 2299 | ), |
| 2300 | relatedSnippets: Schema.optionalKey( |
| 2301 | Schema.Union([NesRelatedSnippetsCapabilities, Schema.Null]).annotate({ |
| 2302 | description: "Whether the agent wants related snippets context.", |
| 2303 | }), |
| 2304 | ), |
| 2305 | editHistory: Schema.optionalKey( |
| 2306 | Schema.Union([NesEditHistoryCapabilities, Schema.Null]).annotate({ |
| 2307 | description: "Whether the agent wants edit history context.", |
| 2308 | }), |
| 2309 | ), |
| 2310 | userActions: Schema.optionalKey( |
| 2311 | Schema.Union([NesUserActionsCapabilities, Schema.Null]).annotate({ |
| 2312 | description: "Whether the agent wants user actions context.", |
| 2313 | }), |
| 2314 | ), |
| 2315 | openFiles: Schema.optionalKey( |
| 2316 | Schema.Union([NesOpenFilesCapabilities, Schema.Null]).annotate({ |
| 2317 | description: "Whether the agent wants open files context.", |
| 2318 | }), |
| 2319 | ), |
| 2320 | diagnostics: Schema.optionalKey( |
| 2321 | Schema.Union([NesDiagnosticsCapabilities, Schema.Null]).annotate({ |
| 2322 | description: "Whether the agent wants diagnostics context.", |
| 2323 | }), |
| 2324 | ), |
| 2325 | _meta: Schema.optionalKey( |
| 2326 | Schema.Union([ |
| 2327 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2328 | description: |
| 2329 | "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/v2/draft/extensibility)", |
| 2330 | }), |
| 2331 | Schema.Null, |
| 2332 | ]), |
| 2333 | ), |
| 2334 | }).annotate({ |
| 2335 | description: "Context capabilities the agent wants attached to each suggestion request.", |
| 2336 | identifier: "NesContextCapabilities", |
| 2337 | }); |
| 2338 | |
| 2339 | export type Annotations = { |
| 2340 | readonly audience?: ReadonlyArray<Role> | null; |
| 2341 | readonly lastModified?: string | null; |
| 2342 | readonly priority?: number | null; |
| 2343 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2344 | }; |
| 2345 | export const Annotations = Schema.Struct({ |
| 2346 | audience: Schema.optionalKey( |
| 2347 | Schema.Union([ |
| 2348 | Schema.Array(Role).annotate({ |
| 2349 | description: "Intended recipients for this content, such as the user or assistant.", |
| 2350 | }), |
| 2351 | Schema.Null, |
| 2352 | ]), |
| 2353 | ), |
| 2354 | lastModified: Schema.optionalKey( |
| 2355 | Schema.Union([ |
| 2356 | Schema.String.annotate({ |
| 2357 | description: |
| 2358 | 'Timestamp indicating when the underlying resource was last modified.\n\nMust be an RFC 3339 formatted string (e.g., "2025-01-12T15:00:58Z").', |
| 2359 | format: "date-time", |
| 2360 | }), |
| 2361 | Schema.Null, |
| 2362 | ]), |
| 2363 | ), |
| 2364 | priority: Schema.optionalKey( |
| 2365 | Schema.Union([ |
| 2366 | Schema.Number.annotate({ |
| 2367 | description: "Relative importance of this content when clients choose what to surface.", |
| 2368 | format: "double", |
| 2369 | }) |
| 2370 | .check(Schema.isFinite().annotate({ expected: "a finite number" })) |
| 2371 | .check( |
| 2372 | Schema.isGreaterThanOrEqualTo(0).annotate({ |
| 2373 | expected: "a value greater than or equal to 0", |
| 2374 | }), |
| 2375 | ) |
| 2376 | .check( |
| 2377 | Schema.isLessThanOrEqualTo(1).annotate({ expected: "a value less than or equal to 1" }), |
| 2378 | ), |
| 2379 | Schema.Null, |
| 2380 | ]), |
| 2381 | ), |
| 2382 | _meta: Schema.optionalKey( |
| 2383 | Schema.Union([ |
| 2384 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2385 | description: |
| 2386 | "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/v2/draft/extensibility)", |
| 2387 | }), |
| 2388 | Schema.Null, |
| 2389 | ]), |
| 2390 | ), |
| 2391 | }).annotate({ |
| 2392 | description: |
| 2393 | "Optional annotations for the client. The client can use annotations to inform how objects are used or displayed", |
| 2394 | identifier: "Annotations", |
| 2395 | }); |
| 2396 | |
| 2397 | export type TextResourceContents = { |
| 2398 | readonly text: string; |
| 2399 | readonly uri: string; |
| 2400 | readonly mimeType?: MediaType | null; |
| 2401 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2402 | }; |
| 2403 | export const TextResourceContents = Schema.Struct({ |
| 2404 | text: Schema.String.annotate({ description: "Text payload carried by this content block." }), |
| 2405 | uri: Schema.String.annotate({ |
| 2406 | description: "URI associated with this resource or media payload.", |
| 2407 | format: "uri", |
| 2408 | }), |
| 2409 | mimeType: Schema.optionalKey( |
| 2410 | Schema.Union([MediaType, Schema.Null]).annotate({ |
| 2411 | description: "MIME type describing the encoded media payload.", |
| 2412 | }), |
| 2413 | ), |
| 2414 | _meta: Schema.optionalKey( |
| 2415 | Schema.Union([ |
| 2416 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2417 | description: |
| 2418 | "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/v2/draft/extensibility)", |
| 2419 | }), |
| 2420 | Schema.Null, |
| 2421 | ]), |
| 2422 | ), |
| 2423 | }).annotate({ description: "Text-based resource contents.", identifier: "TextResourceContents" }); |
| 2424 | |
| 2425 | export type BlobResourceContents = { |
| 2426 | readonly blob: string; |
| 2427 | readonly uri: string; |
| 2428 | readonly mimeType?: MediaType | null; |
| 2429 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2430 | }; |
| 2431 | export const BlobResourceContents = Schema.Struct({ |
| 2432 | blob: Schema.String.annotate({ |
| 2433 | description: "Base64-encoded bytes for a binary resource payload.", |
| 2434 | contentEncoding: "base64", |
| 2435 | }), |
| 2436 | uri: Schema.String.annotate({ |
| 2437 | description: "URI associated with this resource or media payload.", |
| 2438 | format: "uri", |
| 2439 | }), |
| 2440 | mimeType: Schema.optionalKey( |
| 2441 | Schema.Union([MediaType, Schema.Null]).annotate({ |
| 2442 | description: "MIME type describing the encoded media payload.", |
| 2443 | }), |
| 2444 | ), |
| 2445 | _meta: Schema.optionalKey( |
| 2446 | Schema.Union([ |
| 2447 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2448 | description: |
| 2449 | "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/v2/draft/extensibility)", |
| 2450 | }), |
| 2451 | Schema.Null, |
| 2452 | ]), |
| 2453 | ), |
| 2454 | }).annotate({ description: "Binary resource contents.", identifier: "BlobResourceContents" }); |
| 2455 | |
| 2456 | export type Icon = { |
| 2457 | readonly src: string; |
| 2458 | readonly mimeType?: MediaType | null; |
| 2459 | readonly sizes?: ReadonlyArray<string> | null; |
| 2460 | readonly theme?: IconTheme | null; |
| 2461 | }; |
| 2462 | export const Icon = Schema.Struct({ |
| 2463 | src: Schema.String.annotate({ |
| 2464 | description: "A standard URI pointing to an icon resource.", |
| 2465 | format: "uri", |
| 2466 | }), |
| 2467 | mimeType: Schema.optionalKey( |
| 2468 | Schema.Union([MediaType, Schema.Null]).annotate({ |
| 2469 | description: "Optional MIME type override if the source MIME type is missing or generic.", |
| 2470 | }), |
| 2471 | ), |
| 2472 | sizes: Schema.optionalKey( |
| 2473 | Schema.Union([ |
| 2474 | Schema.Array(Schema.String).annotate({ |
| 2475 | description: |
| 2476 | 'Optional array of strings that specify sizes at which the icon can be used.\nEach string should be in `WxH` format (e.g., `"48x48"`, `"96x96"`) or\n`"any"` for scalable formats like SVG.\n\nIf not provided, the client should assume that the icon can be used at any size.', |
| 2477 | }), |
| 2478 | Schema.Null, |
| 2479 | ]), |
| 2480 | ), |
| 2481 | theme: Schema.optionalKey( |
| 2482 | Schema.Union([IconTheme, Schema.Null]).annotate({ |
| 2483 | description: "Optional theme this icon is designed for.", |
| 2484 | }), |
| 2485 | ), |
| 2486 | }).annotate({ |
| 2487 | description: "An optionally-sized icon that can be displayed in a user interface.", |
| 2488 | identifier: "Icon", |
| 2489 | }); |
| 2490 | |
| 2491 | export type DiffChange = |
| 2492 | | { |
| 2493 | readonly fileType?: DiffFileType | null; |
| 2494 | readonly mimeType?: MediaType | null; |
| 2495 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2496 | readonly operation: "add"; |
| 2497 | readonly path: AbsolutePath; |
| 2498 | } |
| 2499 | | { |
| 2500 | readonly fileType?: DiffFileType | null; |
| 2501 | readonly mimeType?: MediaType | null; |
| 2502 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2503 | readonly operation: "delete"; |
| 2504 | readonly path: AbsolutePath; |
| 2505 | } |
| 2506 | | { |
| 2507 | readonly fileType?: DiffFileType | null; |
| 2508 | readonly mimeType?: MediaType | null; |
| 2509 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2510 | readonly operation: "modify"; |
| 2511 | readonly path: AbsolutePath; |
| 2512 | } |
| 2513 | | { |
| 2514 | readonly fileType?: DiffFileType | null; |
| 2515 | readonly mimeType?: MediaType | null; |
| 2516 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2517 | readonly operation: "move"; |
| 2518 | readonly oldPath: AbsolutePath; |
| 2519 | readonly path: AbsolutePath; |
| 2520 | } |
| 2521 | | { |
| 2522 | readonly fileType?: DiffFileType | null; |
| 2523 | readonly mimeType?: MediaType | null; |
| 2524 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2525 | readonly operation: "copy"; |
| 2526 | readonly oldPath: AbsolutePath; |
| 2527 | readonly path: AbsolutePath; |
| 2528 | } |
| 2529 | | ({ |
| 2530 | readonly fileType?: DiffFileType | null; |
| 2531 | readonly mimeType?: MediaType | null; |
| 2532 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2533 | readonly operation: string; |
| 2534 | } & { readonly [x: string]: Schema.Json }); |
| 2535 | export const DiffChange = Schema.Union([ |
| 2536 | Schema.Struct({ |
| 2537 | fileType: Schema.optionalKey( |
| 2538 | Schema.Union([DiffFileType, Schema.Null]).annotate({ |
| 2539 | description: "File content kind.\n\nOmitted or `null` means the content kind is unknown.", |
| 2540 | }), |
| 2541 | ), |
| 2542 | mimeType: Schema.optionalKey( |
| 2543 | Schema.Union([MediaType, Schema.Null]).annotate({ |
| 2544 | description: |
| 2545 | "MIME type of the file contents.\n\nOmitted or `null` means the MIME type is unknown.", |
| 2546 | }), |
| 2547 | ), |
| 2548 | _meta: Schema.optionalKey( |
| 2549 | Schema.Union([ |
| 2550 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2551 | description: |
| 2552 | "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/v2/draft/extensibility)", |
| 2553 | }), |
| 2554 | Schema.Null, |
| 2555 | ]), |
| 2556 | ), |
| 2557 | operation: Schema.Literal("add"), |
| 2558 | path: Schema.suspend((): Schema.Codec<AbsolutePath> => AbsolutePath).annotate({ |
| 2559 | description: "Absolute path for the operation.", |
| 2560 | }), |
| 2561 | }).annotate({ description: "Operation metadata for add, delete, and modify changes." }), |
| 2562 | Schema.Struct({ |
| 2563 | fileType: Schema.optionalKey( |
| 2564 | Schema.Union([DiffFileType, Schema.Null]).annotate({ |
| 2565 | description: "File content kind.\n\nOmitted or `null` means the content kind is unknown.", |
| 2566 | }), |
| 2567 | ), |
| 2568 | mimeType: Schema.optionalKey( |
| 2569 | Schema.Union([MediaType, Schema.Null]).annotate({ |
| 2570 | description: |
| 2571 | "MIME type of the file contents.\n\nOmitted or `null` means the MIME type is unknown.", |
| 2572 | }), |
| 2573 | ), |
| 2574 | _meta: Schema.optionalKey( |
| 2575 | Schema.Union([ |
| 2576 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2577 | description: |
| 2578 | "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/v2/draft/extensibility)", |
| 2579 | }), |
| 2580 | Schema.Null, |
| 2581 | ]), |
| 2582 | ), |
| 2583 | operation: Schema.Literal("delete"), |
| 2584 | path: Schema.suspend((): Schema.Codec<AbsolutePath> => AbsolutePath).annotate({ |
| 2585 | description: "Absolute path for the operation.", |
| 2586 | }), |
| 2587 | }).annotate({ description: "Operation metadata for add, delete, and modify changes." }), |
| 2588 | Schema.Struct({ |
| 2589 | fileType: Schema.optionalKey( |
| 2590 | Schema.Union([DiffFileType, Schema.Null]).annotate({ |
| 2591 | description: "File content kind.\n\nOmitted or `null` means the content kind is unknown.", |
| 2592 | }), |
| 2593 | ), |
| 2594 | mimeType: Schema.optionalKey( |
| 2595 | Schema.Union([MediaType, Schema.Null]).annotate({ |
| 2596 | description: |
| 2597 | "MIME type of the file contents.\n\nOmitted or `null` means the MIME type is unknown.", |
| 2598 | }), |
| 2599 | ), |
| 2600 | _meta: Schema.optionalKey( |
| 2601 | Schema.Union([ |
| 2602 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2603 | description: |
| 2604 | "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/v2/draft/extensibility)", |
| 2605 | }), |
| 2606 | Schema.Null, |
| 2607 | ]), |
| 2608 | ), |
| 2609 | operation: Schema.Literal("modify"), |
| 2610 | path: Schema.suspend((): Schema.Codec<AbsolutePath> => AbsolutePath).annotate({ |
| 2611 | description: "Absolute path for the operation.", |
| 2612 | }), |
| 2613 | }).annotate({ description: "Operation metadata for add, delete, and modify changes." }), |
| 2614 | Schema.Struct({ |
| 2615 | fileType: Schema.optionalKey( |
| 2616 | Schema.Union([DiffFileType, Schema.Null]).annotate({ |
| 2617 | description: "File content kind.\n\nOmitted or `null` means the content kind is unknown.", |
| 2618 | }), |
| 2619 | ), |
| 2620 | mimeType: Schema.optionalKey( |
| 2621 | Schema.Union([MediaType, Schema.Null]).annotate({ |
| 2622 | description: |
| 2623 | "MIME type of the file contents.\n\nOmitted or `null` means the MIME type is unknown.", |
| 2624 | }), |
| 2625 | ), |
| 2626 | _meta: Schema.optionalKey( |
| 2627 | Schema.Union([ |
| 2628 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2629 | description: |
| 2630 | "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/v2/draft/extensibility)", |
| 2631 | }), |
| 2632 | Schema.Null, |
| 2633 | ]), |
| 2634 | ), |
| 2635 | operation: Schema.Literal("move"), |
| 2636 | oldPath: Schema.suspend((): Schema.Codec<AbsolutePath> => AbsolutePath).annotate({ |
| 2637 | description: "Absolute path before the operation.", |
| 2638 | }), |
| 2639 | path: Schema.suspend((): Schema.Codec<AbsolutePath> => AbsolutePath).annotate({ |
| 2640 | description: "Absolute path after the operation.", |
| 2641 | }), |
| 2642 | }).annotate({ description: "Operation metadata for move and copy changes." }), |
| 2643 | Schema.Struct({ |
| 2644 | fileType: Schema.optionalKey( |
| 2645 | Schema.Union([DiffFileType, Schema.Null]).annotate({ |
| 2646 | description: "File content kind.\n\nOmitted or `null` means the content kind is unknown.", |
| 2647 | }), |
| 2648 | ), |
| 2649 | mimeType: Schema.optionalKey( |
| 2650 | Schema.Union([MediaType, Schema.Null]).annotate({ |
| 2651 | description: |
| 2652 | "MIME type of the file contents.\n\nOmitted or `null` means the MIME type is unknown.", |
| 2653 | }), |
| 2654 | ), |
| 2655 | _meta: Schema.optionalKey( |
| 2656 | Schema.Union([ |
| 2657 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2658 | description: |
| 2659 | "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/v2/draft/extensibility)", |
| 2660 | }), |
| 2661 | Schema.Null, |
| 2662 | ]), |
| 2663 | ), |
| 2664 | operation: Schema.Literal("copy"), |
| 2665 | oldPath: Schema.suspend((): Schema.Codec<AbsolutePath> => AbsolutePath).annotate({ |
| 2666 | description: "Absolute path before the operation.", |
| 2667 | }), |
| 2668 | path: Schema.suspend((): Schema.Codec<AbsolutePath> => AbsolutePath).annotate({ |
| 2669 | description: "Absolute path after the operation.", |
| 2670 | }), |
| 2671 | }).annotate({ description: "Operation metadata for move and copy changes." }), |
| 2672 | Schema.StructWithRest( |
| 2673 | Schema.Struct({ |
| 2674 | fileType: Schema.optionalKey( |
| 2675 | Schema.Union([DiffFileType, Schema.Null]).annotate({ |
| 2676 | description: "File content kind.\n\nOmitted or `null` means the content kind is unknown.", |
| 2677 | }), |
| 2678 | ), |
| 2679 | mimeType: Schema.optionalKey( |
| 2680 | Schema.Union([MediaType, Schema.Null]).annotate({ |
| 2681 | description: |
| 2682 | "MIME type of the file contents.\n\nOmitted or `null` means the MIME type is unknown.", |
| 2683 | }), |
| 2684 | ), |
| 2685 | _meta: Schema.optionalKey( |
| 2686 | Schema.Union([ |
| 2687 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2688 | description: |
| 2689 | "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/v2/draft/extensibility)", |
| 2690 | }), |
| 2691 | Schema.Null, |
| 2692 | ]), |
| 2693 | ), |
| 2694 | operation: Schema.String.annotate({ |
| 2695 | description: |
| 2696 | "Custom or future file operation.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 2697 | }).check( |
| 2698 | Schema.isPattern( |
| 2699 | new RegExp("^(?!(?:\\x61dd|\\x64elete|\\x6dodify|\\x6dove|\\x63opy)$)[\\s\\S]*$"), |
| 2700 | ).annotate({ |
| 2701 | expected: |
| 2702 | "a string matching the RegExp ^(?!(?:\\x61dd|\\x64elete|\\x6dodify|\\x6dove|\\x63opy)$)[\\s\\S]*$", |
| 2703 | }), |
| 2704 | ), |
| 2705 | }), |
| 2706 | [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], |
| 2707 | ).annotate({ |
| 2708 | title: "other", |
| 2709 | description: |
| 2710 | "Custom or future file operation.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 2711 | }), |
| 2712 | ]).annotate({ identifier: "DiffChange" }); |
| 2713 | |
| 2714 | export type ToolCallLocation = { |
| 2715 | readonly path: AbsolutePath; |
| 2716 | readonly line?: number | null; |
| 2717 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2718 | }; |
| 2719 | export const ToolCallLocation = Schema.Struct({ |
| 2720 | path: Schema.suspend((): Schema.Codec<AbsolutePath> => AbsolutePath).annotate({ |
| 2721 | description: "The absolute file path being accessed or modified.", |
| 2722 | }), |
| 2723 | line: Schema.optionalKey( |
| 2724 | Schema.Union([ |
| 2725 | Schema.Number.annotate({ |
| 2726 | description: "Optional line number within the file.", |
| 2727 | format: "uint32", |
| 2728 | }) |
| 2729 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 2730 | .check( |
| 2731 | Schema.isGreaterThanOrEqualTo(0).annotate({ |
| 2732 | expected: "a value greater than or equal to 0", |
| 2733 | }), |
| 2734 | ), |
| 2735 | Schema.Null, |
| 2736 | ]), |
| 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/v2/draft/extensibility)", |
| 2743 | }), |
| 2744 | Schema.Null, |
| 2745 | ]), |
| 2746 | ), |
| 2747 | }).annotate({ |
| 2748 | description: |
| 2749 | '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/v2/draft/tool-calls#following-the-agent)', |
| 2750 | identifier: "ToolCallLocation", |
| 2751 | }); |
| 2752 | |
| 2753 | export type SessionInfo = { |
| 2754 | readonly sessionId: SessionId; |
| 2755 | readonly cwd: AbsolutePath; |
| 2756 | readonly additionalDirectories?: ReadonlyArray<AbsolutePath>; |
| 2757 | readonly title?: string | null; |
| 2758 | readonly updatedAt?: string | null; |
| 2759 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2760 | }; |
| 2761 | export const SessionInfo = Schema.Struct({ |
| 2762 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 2763 | description: "Unique identifier for the session", |
| 2764 | }), |
| 2765 | cwd: Schema.suspend((): Schema.Codec<AbsolutePath> => AbsolutePath).annotate({ |
| 2766 | description: "The working directory for this session. Must be an absolute path.", |
| 2767 | }), |
| 2768 | additionalDirectories: Schema.optionalKey( |
| 2769 | Schema.Array(AbsolutePath).annotate({ |
| 2770 | description: |
| 2771 | "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.", |
| 2772 | }), |
| 2773 | ), |
| 2774 | title: Schema.optionalKey( |
| 2775 | Schema.Union([ |
| 2776 | Schema.String.annotate({ description: "Human-readable title for the session" }), |
| 2777 | Schema.Null, |
| 2778 | ]), |
| 2779 | ), |
| 2780 | updatedAt: Schema.optionalKey( |
| 2781 | Schema.Union([ |
| 2782 | Schema.String.annotate({ |
| 2783 | description: "RFC 3339 timestamp of last activity.", |
| 2784 | format: "date-time", |
| 2785 | }), |
| 2786 | Schema.Null, |
| 2787 | ]), |
| 2788 | ), |
| 2789 | _meta: Schema.optionalKey( |
| 2790 | Schema.Union([ |
| 2791 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2792 | description: |
| 2793 | "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/v2/draft/extensibility)", |
| 2794 | }), |
| 2795 | Schema.Null, |
| 2796 | ]), |
| 2797 | ), |
| 2798 | }).annotate({ |
| 2799 | description: "Information about a session returned by session/list", |
| 2800 | identifier: "SessionInfo", |
| 2801 | }); |
| 2802 | |
| 2803 | export type DiffPatch = { readonly format: DiffPatchFormat; readonly text: string }; |
| 2804 | export const DiffPatch = Schema.Struct({ |
| 2805 | format: Schema.suspend((): Schema.Codec<DiffPatchFormat> => DiffPatchFormat).annotate({ |
| 2806 | description: "Patch format. The only ACP-defined value is `git_patch`.", |
| 2807 | }), |
| 2808 | text: Schema.String.annotate({ description: "Patch text in the format named by `format`." }), |
| 2809 | }).annotate({ description: "Renderable patch text and its format.", identifier: "DiffPatch" }); |
| 2810 | |
| 2811 | export type PlanEntry = { |
| 2812 | readonly content: string; |
| 2813 | readonly priority: PlanEntryPriority; |
| 2814 | readonly status: PlanEntryStatus; |
| 2815 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2816 | }; |
| 2817 | export const PlanEntry = Schema.Struct({ |
| 2818 | content: Schema.String.annotate({ |
| 2819 | description: "Human-readable description of what this task aims to accomplish.", |
| 2820 | }), |
| 2821 | priority: Schema.suspend((): Schema.Codec<PlanEntryPriority> => PlanEntryPriority).annotate({ |
| 2822 | description: |
| 2823 | "The relative importance of this task.\nUsed to indicate which tasks are most critical to the overall goal.", |
| 2824 | }), |
| 2825 | status: Schema.suspend((): Schema.Codec<PlanEntryStatus> => PlanEntryStatus).annotate({ |
| 2826 | description: "Current execution status of this task.", |
| 2827 | }), |
| 2828 | _meta: Schema.optionalKey( |
| 2829 | Schema.Union([ |
| 2830 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2831 | description: |
| 2832 | "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/v2/draft/extensibility)", |
| 2833 | }), |
| 2834 | Schema.Null, |
| 2835 | ]), |
| 2836 | ), |
| 2837 | }).annotate({ |
| 2838 | description: |
| 2839 | "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/v2/draft/agent-plan#plan-entries)", |
| 2840 | identifier: "PlanEntry", |
| 2841 | }); |
| 2842 | |
| 2843 | export type AvailableCommand = { |
| 2844 | readonly name: string; |
| 2845 | readonly description: string; |
| 2846 | readonly input?: AvailableCommandInput | null; |
| 2847 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2848 | }; |
| 2849 | export const AvailableCommand = Schema.Struct({ |
| 2850 | name: Schema.String.annotate({ |
| 2851 | description: "Command name (e.g., `create_plan`, `research_codebase`).", |
| 2852 | }), |
| 2853 | description: Schema.String.annotate({ |
| 2854 | description: "Human-readable description of what the command does.", |
| 2855 | }), |
| 2856 | input: Schema.optionalKey( |
| 2857 | Schema.Union([AvailableCommandInput, Schema.Null]).annotate({ |
| 2858 | description: "Input for the command if required", |
| 2859 | }), |
| 2860 | ), |
| 2861 | _meta: Schema.optionalKey( |
| 2862 | Schema.Union([ |
| 2863 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2864 | description: |
| 2865 | "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/v2/draft/extensibility)", |
| 2866 | }), |
| 2867 | Schema.Null, |
| 2868 | ]), |
| 2869 | ), |
| 2870 | }).annotate({ description: "Information about a command.", identifier: "AvailableCommand" }); |
| 2871 | |
| 2872 | export type SessionConfigSelectOption = { |
| 2873 | readonly value: SessionConfigValueId; |
| 2874 | readonly name: string; |
| 2875 | readonly description?: string | null; |
| 2876 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2877 | }; |
| 2878 | export const SessionConfigSelectOption = Schema.Struct({ |
| 2879 | value: Schema.suspend((): Schema.Codec<SessionConfigValueId> => SessionConfigValueId).annotate({ |
| 2880 | description: "Unique identifier for this option value.", |
| 2881 | }), |
| 2882 | name: Schema.String.annotate({ description: "Human-readable label for this option value." }), |
| 2883 | description: Schema.optionalKey( |
| 2884 | Schema.Union([ |
| 2885 | Schema.String.annotate({ description: "Optional description for this option value." }), |
| 2886 | Schema.Null, |
| 2887 | ]), |
| 2888 | ), |
| 2889 | _meta: Schema.optionalKey( |
| 2890 | Schema.Union([ |
| 2891 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2892 | description: |
| 2893 | "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/v2/draft/extensibility)", |
| 2894 | }), |
| 2895 | Schema.Null, |
| 2896 | ]), |
| 2897 | ), |
| 2898 | }).annotate({ |
| 2899 | description: "A possible value for a session configuration option.", |
| 2900 | identifier: "SessionConfigSelectOption", |
| 2901 | }); |
| 2902 | |
| 2903 | export type SetSessionConfigOptionRequest = |
| 2904 | | { |
| 2905 | readonly sessionId: SessionId; |
| 2906 | readonly configId: SessionConfigId; |
| 2907 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 2908 | readonly value: SessionConfigValueId; |
| 2909 | readonly type: "id"; |
| 2910 | } |
| 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 type: string; |
| 2923 | readonly value: Schema.Json; |
| 2924 | } & { readonly [x: string]: Schema.Json }); |
| 2925 | export const SetSessionConfigOptionRequest = Schema.Union([ |
| 2926 | Schema.Struct({ |
| 2927 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 2928 | description: "The ID of the session to set the configuration option for.", |
| 2929 | }), |
| 2930 | configId: Schema.suspend((): Schema.Codec<SessionConfigId> => SessionConfigId).annotate({ |
| 2931 | description: "The ID of the configuration option to set.", |
| 2932 | }), |
| 2933 | _meta: Schema.optionalKey( |
| 2934 | Schema.Union([ |
| 2935 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2936 | description: |
| 2937 | "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/v2/draft/extensibility)", |
| 2938 | }), |
| 2939 | Schema.Null, |
| 2940 | ]), |
| 2941 | ), |
| 2942 | value: Schema.suspend((): Schema.Codec<SessionConfigValueId> => SessionConfigValueId).annotate({ |
| 2943 | description: "The value ID.", |
| 2944 | }), |
| 2945 | type: Schema.Literal("id"), |
| 2946 | }).annotate({ description: 'A [`SessionConfigValueId`] string value (`type: "id"`).' }), |
| 2947 | Schema.Struct({ |
| 2948 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 2949 | description: "The ID of the session to set the configuration option for.", |
| 2950 | }), |
| 2951 | configId: Schema.suspend((): Schema.Codec<SessionConfigId> => SessionConfigId).annotate({ |
| 2952 | description: "The ID of the configuration option to set.", |
| 2953 | }), |
| 2954 | _meta: Schema.optionalKey( |
| 2955 | Schema.Union([ |
| 2956 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2957 | description: |
| 2958 | "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/v2/draft/extensibility)", |
| 2959 | }), |
| 2960 | Schema.Null, |
| 2961 | ]), |
| 2962 | ), |
| 2963 | value: Schema.Boolean.annotate({ description: "The boolean value." }), |
| 2964 | type: Schema.Literal("boolean"), |
| 2965 | }).annotate({ description: 'A boolean value (`type: "boolean"`).' }), |
| 2966 | Schema.StructWithRest( |
| 2967 | Schema.Struct({ |
| 2968 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 2969 | description: "The ID of the session to set the configuration option for.", |
| 2970 | }), |
| 2971 | configId: Schema.suspend((): Schema.Codec<SessionConfigId> => SessionConfigId).annotate({ |
| 2972 | description: "The ID of the configuration option to set.", |
| 2973 | }), |
| 2974 | _meta: Schema.optionalKey( |
| 2975 | Schema.Union([ |
| 2976 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 2977 | description: |
| 2978 | "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/v2/draft/extensibility)", |
| 2979 | }), |
| 2980 | Schema.Null, |
| 2981 | ]), |
| 2982 | ), |
| 2983 | type: Schema.String.annotate({ |
| 2984 | description: |
| 2985 | "Custom or future session configuration option value type.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 2986 | }).check( |
| 2987 | Schema.isPattern(new RegExp("^(?!(?:\\x69d|\\x62oolean)$)[\\s\\S]*$")).annotate({ |
| 2988 | expected: "a string matching the RegExp ^(?!(?:\\x69d|\\x62oolean)$)[\\s\\S]*$", |
| 2989 | }), |
| 2990 | ), |
| 2991 | value: Schema.Json.annotate({ |
| 2992 | expected: "JSON value", |
| 2993 | description: "Raw value payload for the custom or future value type.", |
| 2994 | }), |
| 2995 | }), |
| 2996 | [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], |
| 2997 | ).annotate({ |
| 2998 | title: "other", |
| 2999 | description: |
| 3000 | "Custom or future session configuration option value payload.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 3001 | }), |
| 3002 | ]).annotate({ identifier: "SetSessionConfigOptionRequest" }); |
| 3003 | |
| 3004 | export type CompleteElicitationNotification = { |
| 3005 | readonly elicitationId: ElicitationId; |
| 3006 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3007 | }; |
| 3008 | export const CompleteElicitationNotification = Schema.Struct({ |
| 3009 | elicitationId: Schema.suspend((): Schema.Codec<ElicitationId> => ElicitationId).annotate({ |
| 3010 | description: "The ID of the elicitation that completed.", |
| 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\nOptional. Omitted and `null` are equivalent and mean no metadata.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 3017 | }), |
| 3018 | Schema.Null, |
| 3019 | ]), |
| 3020 | ), |
| 3021 | }).annotate({ |
| 3022 | description: "Notification sent by the agent when a URL-based elicitation is complete.", |
| 3023 | identifier: "CompleteElicitationNotification", |
| 3024 | }); |
| 3025 | |
| 3026 | export type MessageMcpNotification = { |
| 3027 | readonly connectionId: McpConnectionId; |
| 3028 | readonly method: string; |
| 3029 | readonly params?: { readonly [x: string]: Schema.Json } | null; |
| 3030 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3031 | }; |
| 3032 | export const MessageMcpNotification = Schema.Struct({ |
| 3033 | connectionId: Schema.suspend((): Schema.Codec<McpConnectionId> => McpConnectionId).annotate({ |
| 3034 | description: "The MCP-over-ACP connection this message is sent on.", |
| 3035 | }), |
| 3036 | method: Schema.String.annotate({ description: "The inner MCP method name." }), |
| 3037 | params: Schema.optionalKey( |
| 3038 | Schema.Union([ |
| 3039 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3040 | description: |
| 3041 | "Optional inner MCP params.\n\nIf omitted or set to `null`, the inner MCP message has no params.", |
| 3042 | }), |
| 3043 | Schema.Null, |
| 3044 | ]), |
| 3045 | ), |
| 3046 | _meta: Schema.optionalKey( |
| 3047 | Schema.Union([ |
| 3048 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3049 | description: |
| 3050 | "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/v2/draft/extensibility)", |
| 3051 | }), |
| 3052 | Schema.Null, |
| 3053 | ]), |
| 3054 | ), |
| 3055 | }).annotate({ |
| 3056 | description: |
| 3057 | "**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`.", |
| 3058 | identifier: "MessageMcpNotification", |
| 3059 | }); |
| 3060 | |
| 3061 | export type MessageMcpRequest = { |
| 3062 | readonly connectionId: McpConnectionId; |
| 3063 | readonly method: string; |
| 3064 | readonly params?: { readonly [x: string]: Schema.Json } | null; |
| 3065 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3066 | }; |
| 3067 | export const MessageMcpRequest = Schema.Struct({ |
| 3068 | connectionId: Schema.suspend((): Schema.Codec<McpConnectionId> => McpConnectionId).annotate({ |
| 3069 | description: "The MCP-over-ACP connection this message is sent on.", |
| 3070 | }), |
| 3071 | method: Schema.String.annotate({ description: "The inner MCP method name." }), |
| 3072 | params: Schema.optionalKey( |
| 3073 | Schema.Union([ |
| 3074 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3075 | description: |
| 3076 | "Optional inner MCP params.\n\nIf omitted or set to `null`, the inner MCP message has no params.", |
| 3077 | }), |
| 3078 | Schema.Null, |
| 3079 | ]), |
| 3080 | ), |
| 3081 | _meta: Schema.optionalKey( |
| 3082 | Schema.Union([ |
| 3083 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3084 | description: |
| 3085 | "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/v2/draft/extensibility)", |
| 3086 | }), |
| 3087 | Schema.Null, |
| 3088 | ]), |
| 3089 | ), |
| 3090 | }).annotate({ |
| 3091 | description: |
| 3092 | "**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`.", |
| 3093 | identifier: "MessageMcpRequest", |
| 3094 | }); |
| 3095 | |
| 3096 | export type DisconnectMcpRequest = { |
| 3097 | readonly connectionId: McpConnectionId; |
| 3098 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3099 | }; |
| 3100 | export const DisconnectMcpRequest = Schema.Struct({ |
| 3101 | connectionId: Schema.suspend((): Schema.Codec<McpConnectionId> => McpConnectionId).annotate({ |
| 3102 | description: "The MCP-over-ACP connection to close.", |
| 3103 | }), |
| 3104 | _meta: Schema.optionalKey( |
| 3105 | Schema.Union([ |
| 3106 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3107 | description: |
| 3108 | "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/v2/draft/extensibility)", |
| 3109 | }), |
| 3110 | Schema.Null, |
| 3111 | ]), |
| 3112 | ), |
| 3113 | }).annotate({ |
| 3114 | description: |
| 3115 | "**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`.", |
| 3116 | identifier: "DisconnectMcpRequest", |
| 3117 | }); |
| 3118 | |
| 3119 | export type ConnectMcpResponse = { |
| 3120 | readonly connectionId: McpConnectionId; |
| 3121 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3122 | }; |
| 3123 | export const ConnectMcpResponse = Schema.Struct({ |
| 3124 | connectionId: Schema.suspend((): Schema.Codec<McpConnectionId> => McpConnectionId).annotate({ |
| 3125 | description: "The unique identifier for this MCP-over-ACP connection.", |
| 3126 | }), |
| 3127 | _meta: Schema.optionalKey( |
| 3128 | Schema.Union([ |
| 3129 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3130 | description: |
| 3131 | "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/v2/draft/extensibility)", |
| 3132 | }), |
| 3133 | Schema.Null, |
| 3134 | ]), |
| 3135 | ), |
| 3136 | }).annotate({ |
| 3137 | description: |
| 3138 | "**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`.", |
| 3139 | identifier: "ConnectMcpResponse", |
| 3140 | }); |
| 3141 | |
| 3142 | export type CancelRequestNotification = { |
| 3143 | readonly requestId: RequestId; |
| 3144 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3145 | }; |
| 3146 | export const CancelRequestNotification = Schema.Struct({ |
| 3147 | requestId: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({ |
| 3148 | description: "The ID of the request to cancel.", |
| 3149 | }), |
| 3150 | _meta: Schema.optionalKey( |
| 3151 | Schema.Union([ |
| 3152 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3153 | description: |
| 3154 | "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/v2/draft/extensibility)", |
| 3155 | }), |
| 3156 | Schema.Null, |
| 3157 | ]), |
| 3158 | ), |
| 3159 | }).annotate({ |
| 3160 | description: |
| 3161 | "Notification to cancel an ongoing request.\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/v2/draft/cancellation)", |
| 3162 | identifier: "CancelRequestNotification", |
| 3163 | }); |
| 3164 | |
| 3165 | export type RequestPermissionOutcome = |
| 3166 | | { readonly outcome: "cancelled" } |
| 3167 | | { |
| 3168 | readonly outcome: "selected"; |
| 3169 | readonly optionId: PermissionOptionId; |
| 3170 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3171 | } |
| 3172 | | ({ readonly outcome: string } & { readonly [x: string]: Schema.Json }); |
| 3173 | export const RequestPermissionOutcome = Schema.Union([ |
| 3174 | Schema.Struct({ outcome: Schema.Literal("cancelled") }).annotate({ |
| 3175 | description: |
| 3176 | "Active session work was cancelled before the user responded.\n\nWhen a client sends a `session/cancel` notification to cancel active\nsession work, it MUST respond to all pending `session/request_permission`\nrequests with this `Cancelled` outcome.\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/v2/draft/prompt-lifecycle#cancellation)", |
| 3177 | }), |
| 3178 | Schema.Struct({ |
| 3179 | outcome: Schema.Literal("selected"), |
| 3180 | optionId: Schema.suspend((): Schema.Codec<PermissionOptionId> => PermissionOptionId).annotate({ |
| 3181 | description: "The ID of the option the user selected.", |
| 3182 | }), |
| 3183 | _meta: Schema.optionalKey( |
| 3184 | Schema.Union([ |
| 3185 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3186 | description: |
| 3187 | "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/v2/draft/extensibility)", |
| 3188 | }), |
| 3189 | Schema.Null, |
| 3190 | ]), |
| 3191 | ), |
| 3192 | }).annotate({ description: "The user selected one of the provided options." }), |
| 3193 | Schema.StructWithRest( |
| 3194 | Schema.Struct({ |
| 3195 | outcome: Schema.String.annotate({ |
| 3196 | description: |
| 3197 | "Custom or future permission outcome.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 3198 | }).check( |
| 3199 | Schema.isPattern(new RegExp("^(?!(?:\\x63ancelled|\\x73elected)$)[\\s\\S]*$")).annotate({ |
| 3200 | expected: "a string matching the RegExp ^(?!(?:\\x63ancelled|\\x73elected)$)[\\s\\S]*$", |
| 3201 | }), |
| 3202 | ), |
| 3203 | }), |
| 3204 | [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], |
| 3205 | ).annotate({ |
| 3206 | title: "other", |
| 3207 | description: |
| 3208 | "Custom or future permission outcome.\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 outcome MUST NOT treat it as approval.\nThey should preserve the raw payload when storing, replaying, proxying, or\nforwarding permission responses, and otherwise fail or decline the\npermission request according to policy.", |
| 3209 | }), |
| 3210 | ]).annotate({ |
| 3211 | description: "The outcome of a permission request.", |
| 3212 | identifier: "RequestPermissionOutcome", |
| 3213 | }); |
| 3214 | |
| 3215 | export type PermissionOption = { |
| 3216 | readonly optionId: PermissionOptionId; |
| 3217 | readonly name: string; |
| 3218 | readonly kind: PermissionOptionKind; |
| 3219 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3220 | }; |
| 3221 | export const PermissionOption = Schema.Struct({ |
| 3222 | optionId: Schema.suspend((): Schema.Codec<PermissionOptionId> => PermissionOptionId).annotate({ |
| 3223 | description: "Unique identifier for this permission option.", |
| 3224 | }), |
| 3225 | name: Schema.String.annotate({ description: "Human-readable label to display to the user." }), |
| 3226 | kind: Schema.suspend((): Schema.Codec<PermissionOptionKind> => PermissionOptionKind).annotate({ |
| 3227 | description: "Hint about the nature of this permission option.", |
| 3228 | }), |
| 3229 | _meta: Schema.optionalKey( |
| 3230 | Schema.Union([ |
| 3231 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3232 | description: |
| 3233 | "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/v2/draft/extensibility)", |
| 3234 | }), |
| 3235 | Schema.Null, |
| 3236 | ]), |
| 3237 | ), |
| 3238 | }).annotate({ |
| 3239 | description: "An option presented to the user when requesting permission.", |
| 3240 | identifier: "PermissionOption", |
| 3241 | }); |
| 3242 | |
| 3243 | export type MultiSelectItems = |
| 3244 | | { |
| 3245 | readonly type: "string"; |
| 3246 | readonly enum: ReadonlyArray<string>; |
| 3247 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3248 | } |
| 3249 | | ({ readonly type: string } & { readonly [x: string]: Schema.Json }) |
| 3250 | | TitledMultiSelectItems; |
| 3251 | export const MultiSelectItems = Schema.Union([ |
| 3252 | Schema.Struct({ |
| 3253 | type: Schema.Literal("string"), |
| 3254 | enum: Schema.Array(Schema.String) |
| 3255 | .annotate({ description: "Allowed enum values. Must contain at least one value." }) |
| 3256 | .check(Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" })), |
| 3257 | _meta: Schema.optionalKey( |
| 3258 | Schema.Union([ |
| 3259 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3260 | description: |
| 3261 | "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/v2/draft/extensibility)", |
| 3262 | }), |
| 3263 | Schema.Null, |
| 3264 | ]), |
| 3265 | ), |
| 3266 | }).annotate({ description: "String item schema for multi-select enum properties." }), |
| 3267 | Schema.StructWithRest( |
| 3268 | Schema.Struct({ |
| 3269 | type: Schema.String.annotate({ |
| 3270 | description: |
| 3271 | "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.", |
| 3272 | }).check( |
| 3273 | Schema.isPattern(new RegExp("^(?!(?:\\x73tring)$)[\\s\\S]*$")).annotate({ |
| 3274 | expected: "a string matching the RegExp ^(?!(?:\\x73tring)$)[\\s\\S]*$", |
| 3275 | }), |
| 3276 | ), |
| 3277 | }), |
| 3278 | [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], |
| 3279 | ).annotate({ title: "other", description: "Custom or future typed multi-select items." }), |
| 3280 | Schema.suspend((): Schema.Codec<TitledMultiSelectItems> => TitledMultiSelectItems).annotate({ |
| 3281 | title: "titled", |
| 3282 | description: "Titled multi-select items with human-readable labels.", |
| 3283 | }), |
| 3284 | ]).annotate({ |
| 3285 | description: "Items for a multi-select (array) property schema.", |
| 3286 | identifier: "MultiSelectItems", |
| 3287 | }); |
| 3288 | |
| 3289 | export type ConnectMcpRequest = { |
| 3290 | readonly serverId: McpServerAcpId; |
| 3291 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3292 | }; |
| 3293 | export const ConnectMcpRequest = Schema.Struct({ |
| 3294 | serverId: Schema.suspend((): Schema.Codec<McpServerAcpId> => McpServerAcpId).annotate({ |
| 3295 | description: |
| 3296 | "The ACP MCP server ID that was provided by the component declaring the MCP server.", |
| 3297 | }), |
| 3298 | _meta: Schema.optionalKey( |
| 3299 | Schema.Union([ |
| 3300 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3301 | description: |
| 3302 | "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/v2/draft/extensibility)", |
| 3303 | }), |
| 3304 | Schema.Null, |
| 3305 | ]), |
| 3306 | ), |
| 3307 | }).annotate({ |
| 3308 | description: |
| 3309 | "**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`.", |
| 3310 | identifier: "ConnectMcpRequest", |
| 3311 | }); |
| 3312 | |
| 3313 | export type LoginAuthRequest = { |
| 3314 | readonly methodId: AuthMethodId; |
| 3315 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3316 | }; |
| 3317 | export const LoginAuthRequest = Schema.Struct({ |
| 3318 | methodId: Schema.suspend((): Schema.Codec<AuthMethodId> => AuthMethodId).annotate({ |
| 3319 | description: |
| 3320 | "The ID of the authentication method to use.\nMust be one of the methods advertised in the initialize response.", |
| 3321 | }), |
| 3322 | _meta: Schema.optionalKey( |
| 3323 | Schema.Union([ |
| 3324 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3325 | description: |
| 3326 | "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/v2/draft/extensibility)", |
| 3327 | }), |
| 3328 | Schema.Null, |
| 3329 | ]), |
| 3330 | ), |
| 3331 | }).annotate({ |
| 3332 | description: |
| 3333 | "Request parameters for the `auth/login` method.\n\nSpecifies which authentication method to use.\n\nAgents MUST support this method when their `initialize` response advertised\nat least one valid authentication method. Clients MUST NOT call this method\nwhen `authMethods` was omitted or empty.", |
| 3334 | identifier: "LoginAuthRequest", |
| 3335 | }); |
| 3336 | |
| 3337 | export type AuthMethod = |
| 3338 | | { |
| 3339 | readonly type: "terminal"; |
| 3340 | readonly methodId: AuthMethodId; |
| 3341 | readonly name: string; |
| 3342 | readonly description?: string | null; |
| 3343 | readonly args?: ReadonlyArray<string>; |
| 3344 | readonly env?: ReadonlyArray<EnvVariable>; |
| 3345 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3346 | } |
| 3347 | | { |
| 3348 | readonly type: "agent"; |
| 3349 | readonly methodId: AuthMethodId; |
| 3350 | readonly name: string; |
| 3351 | readonly description?: string | null; |
| 3352 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3353 | } |
| 3354 | | ({ |
| 3355 | readonly type: string; |
| 3356 | readonly methodId: AuthMethodId; |
| 3357 | readonly name: string; |
| 3358 | readonly description?: string | null; |
| 3359 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3360 | } & { readonly [x: string]: Schema.Json }); |
| 3361 | export const AuthMethod = Schema.Union([ |
| 3362 | Schema.Struct({ |
| 3363 | type: Schema.Literal("terminal"), |
| 3364 | methodId: Schema.suspend((): Schema.Codec<AuthMethodId> => AuthMethodId).annotate({ |
| 3365 | description: "Unique identifier for this authentication method.", |
| 3366 | }), |
| 3367 | name: Schema.String.annotate({ |
| 3368 | description: "Human-readable name of the authentication method.", |
| 3369 | }), |
| 3370 | description: Schema.optionalKey( |
| 3371 | Schema.Union([ |
| 3372 | Schema.String.annotate({ |
| 3373 | description: |
| 3374 | "Optional description providing more details about this authentication method.", |
| 3375 | }), |
| 3376 | Schema.Null, |
| 3377 | ]), |
| 3378 | ), |
| 3379 | args: Schema.optionalKey( |
| 3380 | Schema.Array(Schema.String).annotate({ |
| 3381 | description: |
| 3382 | "Additional arguments to append to the configured agent invocation for terminal auth.", |
| 3383 | }), |
| 3384 | ), |
| 3385 | env: Schema.optionalKey( |
| 3386 | Schema.Array(EnvVariable).annotate({ |
| 3387 | description: |
| 3388 | "Additional environment variables to set on the configured agent invocation for terminal auth.\nNames MUST be unique. These values override same-named variables in the\nbase launch configuration.", |
| 3389 | }), |
| 3390 | ), |
| 3391 | _meta: Schema.optionalKey( |
| 3392 | Schema.Union([ |
| 3393 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3394 | description: |
| 3395 | "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/v2/draft/extensibility)", |
| 3396 | }), |
| 3397 | Schema.Null, |
| 3398 | ]), |
| 3399 | ), |
| 3400 | }).annotate({ |
| 3401 | description: |
| 3402 | "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 `auth/login`.", |
| 3403 | }), |
| 3404 | Schema.Struct({ |
| 3405 | type: Schema.Literal("agent"), |
| 3406 | methodId: Schema.suspend((): Schema.Codec<AuthMethodId> => AuthMethodId).annotate({ |
| 3407 | description: "Unique identifier for this authentication method.", |
| 3408 | }), |
| 3409 | name: Schema.String.annotate({ |
| 3410 | description: "Human-readable name of the authentication method.", |
| 3411 | }), |
| 3412 | description: Schema.optionalKey( |
| 3413 | Schema.Union([ |
| 3414 | Schema.String.annotate({ |
| 3415 | description: |
| 3416 | "Optional description providing more details about this authentication method.", |
| 3417 | }), |
| 3418 | Schema.Null, |
| 3419 | ]), |
| 3420 | ), |
| 3421 | _meta: Schema.optionalKey( |
| 3422 | Schema.Union([ |
| 3423 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3424 | description: |
| 3425 | "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/v2/draft/extensibility)", |
| 3426 | }), |
| 3427 | Schema.Null, |
| 3428 | ]), |
| 3429 | ), |
| 3430 | }).annotate({ |
| 3431 | description: |
| 3432 | "Agent handles authentication itself through `auth/login`.\n\nThe `type` discriminator value is `agent`.", |
| 3433 | }), |
| 3434 | Schema.StructWithRest( |
| 3435 | Schema.Struct({ |
| 3436 | type: Schema.String.annotate({ |
| 3437 | description: |
| 3438 | "Custom or future authentication method type.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 3439 | }).check( |
| 3440 | Schema.isPattern(new RegExp("^(?!(?:\\x61gent|\\x74erminal)$)[\\s\\S]*$")).annotate({ |
| 3441 | expected: "a string matching the RegExp ^(?!(?:\\x61gent|\\x74erminal)$)[\\s\\S]*$", |
| 3442 | }), |
| 3443 | ), |
| 3444 | methodId: Schema.suspend((): Schema.Codec<AuthMethodId> => AuthMethodId).annotate({ |
| 3445 | description: "Unique identifier for this authentication method.", |
| 3446 | }), |
| 3447 | name: Schema.String.annotate({ |
| 3448 | description: "Human-readable name of the authentication method.", |
| 3449 | }), |
| 3450 | description: Schema.optionalKey( |
| 3451 | Schema.Union([ |
| 3452 | Schema.String.annotate({ |
| 3453 | description: |
| 3454 | "Optional description providing more details about this authentication method.", |
| 3455 | }), |
| 3456 | Schema.Null, |
| 3457 | ]), |
| 3458 | ), |
| 3459 | _meta: Schema.optionalKey( |
| 3460 | Schema.Union([ |
| 3461 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3462 | description: |
| 3463 | "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/v2/draft/extensibility)", |
| 3464 | }), |
| 3465 | Schema.Null, |
| 3466 | ]), |
| 3467 | ), |
| 3468 | }), |
| 3469 | [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], |
| 3470 | ).annotate({ |
| 3471 | title: "other", |
| 3472 | description: |
| 3473 | "Custom or future authentication method.\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 method type should preserve the raw\npayload when storing, replaying, proxying, or forwarding initialization\ndata, and otherwise ignore the method or display it generically.", |
| 3474 | }), |
| 3475 | ]).annotate({ |
| 3476 | description: |
| 3477 | "Describes an available authentication method.\n\nThe `type` field acts as the discriminator in the serialized JSON form.", |
| 3478 | identifier: "AuthMethod", |
| 3479 | }); |
| 3480 | |
| 3481 | export type DisableProviderRequest = { |
| 3482 | readonly providerId: ProviderId; |
| 3483 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3484 | }; |
| 3485 | export const DisableProviderRequest = Schema.Struct({ |
| 3486 | providerId: Schema.suspend((): Schema.Codec<ProviderId> => ProviderId).annotate({ |
| 3487 | description: "Provider ID to disable.", |
| 3488 | }), |
| 3489 | _meta: Schema.optionalKey( |
| 3490 | Schema.Union([ |
| 3491 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3492 | description: |
| 3493 | "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/v2/draft/extensibility)", |
| 3494 | }), |
| 3495 | Schema.Null, |
| 3496 | ]), |
| 3497 | ), |
| 3498 | }).annotate({ |
| 3499 | description: |
| 3500 | "**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`.", |
| 3501 | identifier: "DisableProviderRequest", |
| 3502 | }); |
| 3503 | |
| 3504 | export type ProviderCurrentConfig = { |
| 3505 | readonly apiType: LlmProtocol; |
| 3506 | readonly baseUrl: string; |
| 3507 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3508 | }; |
| 3509 | export const ProviderCurrentConfig = Schema.Struct({ |
| 3510 | apiType: Schema.suspend((): Schema.Codec<LlmProtocol> => LlmProtocol).annotate({ |
| 3511 | description: "Protocol currently used by this provider.", |
| 3512 | }), |
| 3513 | baseUrl: Schema.String.annotate({ |
| 3514 | description: "Base URL currently used by this provider.", |
| 3515 | format: "uri", |
| 3516 | }), |
| 3517 | _meta: Schema.optionalKey( |
| 3518 | Schema.Union([ |
| 3519 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3520 | description: |
| 3521 | "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/v2/draft/extensibility)", |
| 3522 | }), |
| 3523 | Schema.Null, |
| 3524 | ]), |
| 3525 | ), |
| 3526 | }).annotate({ |
| 3527 | description: |
| 3528 | "**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.", |
| 3529 | identifier: "ProviderCurrentConfig", |
| 3530 | }); |
| 3531 | |
| 3532 | export type SetProviderRequest = { |
| 3533 | readonly providerId: ProviderId; |
| 3534 | readonly apiType: LlmProtocol; |
| 3535 | readonly baseUrl: string; |
| 3536 | readonly headers?: { readonly [x: string]: string }; |
| 3537 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3538 | }; |
| 3539 | export const SetProviderRequest = Schema.Struct({ |
| 3540 | providerId: Schema.suspend((): Schema.Codec<ProviderId> => ProviderId).annotate({ |
| 3541 | description: "Provider ID to configure.", |
| 3542 | }), |
| 3543 | apiType: Schema.suspend((): Schema.Codec<LlmProtocol> => LlmProtocol).annotate({ |
| 3544 | description: "Protocol type for this provider.", |
| 3545 | }), |
| 3546 | baseUrl: Schema.String.annotate({ |
| 3547 | description: "Base URL for requests sent through this provider.", |
| 3548 | format: "uri", |
| 3549 | }), |
| 3550 | headers: Schema.optionalKey( |
| 3551 | Schema.Record(Schema.String, Schema.String).annotate({ |
| 3552 | description: |
| 3553 | "Full headers map for this provider.\nMay include authorization, routing, or other integration-specific headers.", |
| 3554 | }), |
| 3555 | ), |
| 3556 | _meta: Schema.optionalKey( |
| 3557 | Schema.Union([ |
| 3558 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3559 | description: |
| 3560 | "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/v2/draft/extensibility)", |
| 3561 | }), |
| 3562 | Schema.Null, |
| 3563 | ]), |
| 3564 | ), |
| 3565 | }).annotate({ |
| 3566 | description: |
| 3567 | "**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.", |
| 3568 | identifier: "SetProviderRequest", |
| 3569 | }); |
| 3570 | |
| 3571 | export type ListSessionsRequest = { |
| 3572 | readonly cwd?: AbsolutePath | null; |
| 3573 | readonly cursor?: SessionListCursor | null; |
| 3574 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3575 | }; |
| 3576 | export const ListSessionsRequest = Schema.Struct({ |
| 3577 | cwd: Schema.optionalKey( |
| 3578 | Schema.Union([AbsolutePath, Schema.Null]).annotate({ |
| 3579 | description: "Filter sessions by working directory. Must be an absolute path.", |
| 3580 | }), |
| 3581 | ), |
| 3582 | cursor: Schema.optionalKey( |
| 3583 | Schema.Union([SessionListCursor, Schema.Null]).annotate({ |
| 3584 | description: |
| 3585 | "Opaque cursor token from a previous response's nextCursor field for cursor-based pagination", |
| 3586 | }), |
| 3587 | ), |
| 3588 | _meta: Schema.optionalKey( |
| 3589 | Schema.Union([ |
| 3590 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3591 | description: |
| 3592 | "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/v2/draft/extensibility)", |
| 3593 | }), |
| 3594 | Schema.Null, |
| 3595 | ]), |
| 3596 | ), |
| 3597 | }).annotate({ |
| 3598 | description: "Request parameters for listing existing sessions.", |
| 3599 | identifier: "ListSessionsRequest", |
| 3600 | }); |
| 3601 | |
| 3602 | export type Range = { |
| 3603 | readonly start: Position; |
| 3604 | readonly end: Position; |
| 3605 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3606 | }; |
| 3607 | export const Range = Schema.Struct({ |
| 3608 | start: Schema.suspend((): Schema.Codec<Position> => Position).annotate({ |
| 3609 | description: "The start position (inclusive).", |
| 3610 | }), |
| 3611 | end: Schema.suspend((): Schema.Codec<Position> => Position).annotate({ |
| 3612 | description: "The end position (exclusive).", |
| 3613 | }), |
| 3614 | _meta: Schema.optionalKey( |
| 3615 | Schema.Union([ |
| 3616 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3617 | description: |
| 3618 | "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/v2/draft/extensibility)", |
| 3619 | }), |
| 3620 | Schema.Null, |
| 3621 | ]), |
| 3622 | ), |
| 3623 | }).annotate({ |
| 3624 | description: "A range in a text document, expressed as start and end positions.", |
| 3625 | identifier: "Range", |
| 3626 | }); |
| 3627 | |
| 3628 | export type NesUserAction = { |
| 3629 | readonly action: string; |
| 3630 | readonly uri: string; |
| 3631 | readonly position: Position; |
| 3632 | readonly timestampMs: number; |
| 3633 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3634 | }; |
| 3635 | export const NesUserAction = Schema.Struct({ |
| 3636 | action: Schema.String.annotate({ |
| 3637 | description: 'The kind of action (e.g., "insertChar", "cursorMovement").', |
| 3638 | }), |
| 3639 | uri: Schema.String.annotate({ |
| 3640 | description: "The URI of the file where the action occurred.", |
| 3641 | format: "uri", |
| 3642 | }), |
| 3643 | position: Schema.suspend((): Schema.Codec<Position> => Position).annotate({ |
| 3644 | description: "The position where the action occurred.", |
| 3645 | }), |
| 3646 | timestampMs: Schema.Number.annotate({ |
| 3647 | description: "Timestamp in milliseconds since epoch.", |
| 3648 | format: "uint64", |
| 3649 | }) |
| 3650 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 3651 | .check( |
| 3652 | Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), |
| 3653 | ), |
| 3654 | _meta: Schema.optionalKey( |
| 3655 | Schema.Union([ |
| 3656 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3657 | description: |
| 3658 | "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/v2/draft/extensibility)", |
| 3659 | }), |
| 3660 | Schema.Null, |
| 3661 | ]), |
| 3662 | ), |
| 3663 | }).annotate({ |
| 3664 | description: "A user action (typing, cursor movement, etc.).", |
| 3665 | identifier: "NesUserAction", |
| 3666 | }); |
| 3667 | |
| 3668 | export type Error = { |
| 3669 | readonly code: ErrorCode; |
| 3670 | readonly message: string; |
| 3671 | readonly data?: Schema.Json; |
| 3672 | }; |
| 3673 | export const Error = Schema.Struct({ |
| 3674 | code: Schema.suspend((): Schema.Codec<ErrorCode> => ErrorCode).annotate({ |
| 3675 | description: |
| 3676 | "A number indicating the error type that occurred.\nThis must be an integer as defined in the JSON-RPC specification.", |
| 3677 | }), |
| 3678 | message: Schema.String.annotate({ |
| 3679 | description: |
| 3680 | "A string providing a short description of the error.\nThe message should be limited to a concise single sentence.", |
| 3681 | }), |
| 3682 | data: Schema.optionalKey( |
| 3683 | Schema.Json.annotate({ |
| 3684 | expected: "JSON value", |
| 3685 | description: |
| 3686 | "Optional primitive or structured value that contains additional information about the error.\nThis may include debugging information or context-specific details.", |
| 3687 | }), |
| 3688 | ), |
| 3689 | }).annotate({ |
| 3690 | description: |
| 3691 | "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)", |
| 3692 | identifier: "Error", |
| 3693 | }); |
| 3694 | |
| 3695 | export type AuthCapabilities = { |
| 3696 | readonly terminal?: TerminalAuthCapabilities | null; |
| 3697 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3698 | }; |
| 3699 | export const AuthCapabilities = Schema.Struct({ |
| 3700 | terminal: Schema.optionalKey( |
| 3701 | Schema.Union([TerminalAuthCapabilities, Schema.Null]).annotate({ |
| 3702 | description: |
| 3703 | "Whether the client supports `terminal` authentication methods.\n\nOptional. Omitted or `null` both mean the client does not advertise support.\nThe client should supply `{}` only when it can reproduce the configured\nagent invocation in an interactive terminal. Supplying `{}` means the\nagent may include `terminal` entries in its authentication methods.", |
| 3704 | }), |
| 3705 | ), |
| 3706 | _meta: Schema.optionalKey( |
| 3707 | Schema.Union([ |
| 3708 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3709 | description: |
| 3710 | "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/v2/draft/extensibility)", |
| 3711 | }), |
| 3712 | Schema.Null, |
| 3713 | ]), |
| 3714 | ), |
| 3715 | }).annotate({ |
| 3716 | description: |
| 3717 | "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.", |
| 3718 | identifier: "AuthCapabilities", |
| 3719 | }); |
| 3720 | |
| 3721 | export type ElicitationCapabilities = { |
| 3722 | readonly form?: ElicitationFormCapabilities | null; |
| 3723 | readonly url?: ElicitationUrlCapabilities | null; |
| 3724 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3725 | }; |
| 3726 | export const ElicitationCapabilities = Schema.Struct({ |
| 3727 | form: Schema.optionalKey( |
| 3728 | Schema.Union([ElicitationFormCapabilities, Schema.Null]).annotate({ |
| 3729 | description: |
| 3730 | "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.", |
| 3731 | }), |
| 3732 | ), |
| 3733 | url: Schema.optionalKey( |
| 3734 | Schema.Union([ElicitationUrlCapabilities, Schema.Null]).annotate({ |
| 3735 | description: |
| 3736 | "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.", |
| 3737 | }), |
| 3738 | ), |
| 3739 | _meta: Schema.optionalKey( |
| 3740 | Schema.Union([ |
| 3741 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3742 | description: |
| 3743 | "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/v2/draft/extensibility)", |
| 3744 | }), |
| 3745 | Schema.Null, |
| 3746 | ]), |
| 3747 | ), |
| 3748 | }).annotate({ |
| 3749 | description: "Elicitation capabilities supported by the client.", |
| 3750 | identifier: "ElicitationCapabilities", |
| 3751 | }); |
| 3752 | |
| 3753 | export type ClientNesCapabilities = { |
| 3754 | readonly jump?: NesJumpCapabilities | null; |
| 3755 | readonly rename?: NesRenameCapabilities | null; |
| 3756 | readonly searchAndReplace?: NesSearchAndReplaceCapabilities | null; |
| 3757 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3758 | }; |
| 3759 | export const ClientNesCapabilities = Schema.Struct({ |
| 3760 | jump: Schema.optionalKey( |
| 3761 | Schema.Union([NesJumpCapabilities, Schema.Null]).annotate({ |
| 3762 | description: "Whether the client supports the `jump` suggestion kind.", |
| 3763 | }), |
| 3764 | ), |
| 3765 | rename: Schema.optionalKey( |
| 3766 | Schema.Union([NesRenameCapabilities, Schema.Null]).annotate({ |
| 3767 | description: "Whether the client supports the `rename` suggestion kind.", |
| 3768 | }), |
| 3769 | ), |
| 3770 | searchAndReplace: Schema.optionalKey( |
| 3771 | Schema.Union([NesSearchAndReplaceCapabilities, Schema.Null]).annotate({ |
| 3772 | description: "Whether the client supports the `searchAndReplace` suggestion kind.", |
| 3773 | }), |
| 3774 | ), |
| 3775 | _meta: Schema.optionalKey( |
| 3776 | Schema.Union([ |
| 3777 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3778 | description: |
| 3779 | "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/v2/draft/extensibility)", |
| 3780 | }), |
| 3781 | Schema.Null, |
| 3782 | ]), |
| 3783 | ), |
| 3784 | }).annotate({ |
| 3785 | description: "NES capabilities advertised by the client during initialization.", |
| 3786 | identifier: "ClientNesCapabilities", |
| 3787 | }); |
| 3788 | |
| 3789 | export type RejectNesNotification = { |
| 3790 | readonly sessionId: SessionId; |
| 3791 | readonly suggestionId: NesSuggestionId; |
| 3792 | readonly reason?: NesRejectReason | null; |
| 3793 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3794 | }; |
| 3795 | export const RejectNesNotification = Schema.Struct({ |
| 3796 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 3797 | description: "The session ID for this notification.", |
| 3798 | }), |
| 3799 | suggestionId: Schema.suspend((): Schema.Codec<NesSuggestionId> => NesSuggestionId).annotate({ |
| 3800 | description: "The ID of the rejected suggestion.", |
| 3801 | }), |
| 3802 | reason: Schema.optionalKey( |
| 3803 | Schema.Union([NesRejectReason, Schema.Null]).annotate({ |
| 3804 | description: "The reason for rejection.", |
| 3805 | }), |
| 3806 | ), |
| 3807 | _meta: Schema.optionalKey( |
| 3808 | Schema.Union([ |
| 3809 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3810 | description: |
| 3811 | "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/v2/draft/extensibility)", |
| 3812 | }), |
| 3813 | Schema.Null, |
| 3814 | ]), |
| 3815 | ), |
| 3816 | }).annotate({ |
| 3817 | description: "Notification sent when a suggestion is rejected.", |
| 3818 | identifier: "RejectNesNotification", |
| 3819 | }); |
| 3820 | |
| 3821 | export type McpServer = |
| 3822 | | { |
| 3823 | readonly type: "http"; |
| 3824 | readonly name: string; |
| 3825 | readonly url: string; |
| 3826 | readonly headers?: ReadonlyArray<HttpHeader>; |
| 3827 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3828 | } |
| 3829 | | { |
| 3830 | readonly type: "acp"; |
| 3831 | readonly name: string; |
| 3832 | readonly serverId: McpServerAcpId; |
| 3833 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3834 | } |
| 3835 | | { |
| 3836 | readonly type: "stdio"; |
| 3837 | readonly name: string; |
| 3838 | readonly command: AbsolutePath; |
| 3839 | readonly args?: ReadonlyArray<string>; |
| 3840 | readonly env?: ReadonlyArray<EnvVariable>; |
| 3841 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3842 | } |
| 3843 | | ({ readonly type: string } & { readonly [x: string]: Schema.Json }); |
| 3844 | export const McpServer = Schema.Union([ |
| 3845 | Schema.Struct({ |
| 3846 | type: Schema.Literal("http"), |
| 3847 | name: Schema.String.annotate({ |
| 3848 | description: "Human-readable name identifying this MCP server.", |
| 3849 | }), |
| 3850 | url: Schema.String.annotate({ description: "URL to the MCP server.", format: "uri" }), |
| 3851 | headers: Schema.optionalKey( |
| 3852 | Schema.Array(HttpHeader).annotate({ |
| 3853 | description: "HTTP headers to set when making requests to the MCP server.", |
| 3854 | }), |
| 3855 | ), |
| 3856 | _meta: Schema.optionalKey( |
| 3857 | Schema.Union([ |
| 3858 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3859 | description: |
| 3860 | "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/v2/draft/extensibility)", |
| 3861 | }), |
| 3862 | Schema.Null, |
| 3863 | ]), |
| 3864 | ), |
| 3865 | }).annotate({ description: "HTTP transport configuration for MCP." }), |
| 3866 | Schema.Struct({ |
| 3867 | type: Schema.Literal("acp"), |
| 3868 | name: Schema.String.annotate({ |
| 3869 | description: "Human-readable name identifying this MCP server.", |
| 3870 | }), |
| 3871 | serverId: Schema.suspend((): Schema.Codec<McpServerAcpId> => McpServerAcpId).annotate({ |
| 3872 | description: |
| 3873 | "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.", |
| 3874 | }), |
| 3875 | _meta: Schema.optionalKey( |
| 3876 | Schema.Union([ |
| 3877 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3878 | description: |
| 3879 | "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/v2/draft/extensibility)", |
| 3880 | }), |
| 3881 | Schema.Null, |
| 3882 | ]), |
| 3883 | ), |
| 3884 | }).annotate({ |
| 3885 | description: |
| 3886 | "**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`.", |
| 3887 | }), |
| 3888 | Schema.Struct({ |
| 3889 | type: Schema.Literal("stdio"), |
| 3890 | name: Schema.String.annotate({ |
| 3891 | description: "Human-readable name identifying this MCP server.", |
| 3892 | }), |
| 3893 | command: Schema.suspend((): Schema.Codec<AbsolutePath> => AbsolutePath).annotate({ |
| 3894 | description: "Absolute path to the MCP server executable.", |
| 3895 | }), |
| 3896 | args: Schema.optionalKey( |
| 3897 | Schema.Array(Schema.String).annotate({ |
| 3898 | description: "Command-line arguments to pass to the MCP server.", |
| 3899 | }), |
| 3900 | ), |
| 3901 | env: Schema.optionalKey( |
| 3902 | Schema.Array(EnvVariable).annotate({ |
| 3903 | description: "Environment variables to set when launching the MCP server.", |
| 3904 | }), |
| 3905 | ), |
| 3906 | _meta: Schema.optionalKey( |
| 3907 | Schema.Union([ |
| 3908 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3909 | description: |
| 3910 | "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/v2/draft/extensibility)", |
| 3911 | }), |
| 3912 | Schema.Null, |
| 3913 | ]), |
| 3914 | ), |
| 3915 | }).annotate({ description: "Stdio transport configuration for MCP." }), |
| 3916 | Schema.StructWithRest( |
| 3917 | Schema.Struct({ |
| 3918 | type: Schema.String.annotate({ |
| 3919 | description: |
| 3920 | "Custom or future MCP server transport type.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 3921 | }).check( |
| 3922 | Schema.isPattern(new RegExp("^(?!(?:\\x68ttp|\\x73tdio|\\x61cp)$)[\\s\\S]*$")).annotate({ |
| 3923 | expected: "a string matching the RegExp ^(?!(?:\\x68ttp|\\x73tdio|\\x61cp)$)[\\s\\S]*$", |
| 3924 | }), |
| 3925 | ), |
| 3926 | }), |
| 3927 | [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], |
| 3928 | ).annotate({ |
| 3929 | title: "other", |
| 3930 | description: |
| 3931 | "Custom or future MCP server transport configuration.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.\n\nReceivers that do not understand this transport should preserve the raw\npayload when storing, replaying, proxying, or forwarding session setup\ndata, and otherwise ignore it or reject the server configuration.", |
| 3932 | }), |
| 3933 | ]).annotate({ |
| 3934 | description: |
| 3935 | "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/v2/draft/session-setup#mcp-servers)", |
| 3936 | identifier: "McpServer", |
| 3937 | }); |
| 3938 | |
| 3939 | export type StartNesRequest = { |
| 3940 | readonly workspaceUri?: string | null; |
| 3941 | readonly workspaceFolders?: ReadonlyArray<WorkspaceFolder> | null; |
| 3942 | readonly repository?: NesRepository | null; |
| 3943 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3944 | }; |
| 3945 | export const StartNesRequest = Schema.Struct({ |
| 3946 | workspaceUri: Schema.optionalKey( |
| 3947 | Schema.Union([ |
| 3948 | Schema.String.annotate({ description: "The root URI of the workspace.", format: "uri" }), |
| 3949 | Schema.Null, |
| 3950 | ]), |
| 3951 | ), |
| 3952 | workspaceFolders: Schema.optionalKey( |
| 3953 | Schema.Union([ |
| 3954 | Schema.Array(WorkspaceFolder).annotate({ description: "The workspace folders." }), |
| 3955 | Schema.Null, |
| 3956 | ]), |
| 3957 | ), |
| 3958 | repository: Schema.optionalKey( |
| 3959 | Schema.Union([NesRepository, Schema.Null]).annotate({ |
| 3960 | description: "Repository metadata, if the workspace is a git repository.", |
| 3961 | }), |
| 3962 | ), |
| 3963 | _meta: Schema.optionalKey( |
| 3964 | Schema.Union([ |
| 3965 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3966 | description: |
| 3967 | "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/v2/draft/extensibility)", |
| 3968 | }), |
| 3969 | Schema.Null, |
| 3970 | ]), |
| 3971 | ), |
| 3972 | }).annotate({ description: "Request to start an NES session.", identifier: "StartNesRequest" }); |
| 3973 | |
| 3974 | export type NesRelatedSnippet = { |
| 3975 | readonly uri: string; |
| 3976 | readonly excerpts: ReadonlyArray<NesExcerpt>; |
| 3977 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 3978 | }; |
| 3979 | export const NesRelatedSnippet = Schema.Struct({ |
| 3980 | uri: Schema.String.annotate({ |
| 3981 | description: "The URI of the file containing the snippets.", |
| 3982 | format: "uri", |
| 3983 | }), |
| 3984 | excerpts: Schema.Array(NesExcerpt).annotate({ description: "The code excerpts." }), |
| 3985 | _meta: Schema.optionalKey( |
| 3986 | Schema.Union([ |
| 3987 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 3988 | description: |
| 3989 | "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/v2/draft/extensibility)", |
| 3990 | }), |
| 3991 | Schema.Null, |
| 3992 | ]), |
| 3993 | ), |
| 3994 | }).annotate({ |
| 3995 | description: "A related code snippet from a file.", |
| 3996 | identifier: "NesRelatedSnippet", |
| 3997 | }); |
| 3998 | |
| 3999 | export type CreateElicitationResponse = |
| 4000 | | { |
| 4001 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 4002 | readonly action: "accept"; |
| 4003 | readonly content?: { readonly [x: string]: ElicitationContentValue } | null; |
| 4004 | } |
| 4005 | | { readonly _meta?: { readonly [x: string]: Schema.Json } | null; readonly action: "decline" } |
| 4006 | | { readonly _meta?: { readonly [x: string]: Schema.Json } | null; readonly action: "cancel" } |
| 4007 | | ({ readonly _meta?: { readonly [x: string]: Schema.Json } | null; readonly action: string } & { |
| 4008 | readonly [x: string]: Schema.Json; |
| 4009 | }); |
| 4010 | export const CreateElicitationResponse = Schema.Union([ |
| 4011 | Schema.Struct({ |
| 4012 | _meta: Schema.optionalKey( |
| 4013 | Schema.Union([ |
| 4014 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4015 | description: |
| 4016 | "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/v2/draft/extensibility)", |
| 4017 | }), |
| 4018 | Schema.Null, |
| 4019 | ]), |
| 4020 | ), |
| 4021 | action: Schema.Literal("accept"), |
| 4022 | content: Schema.optionalKey( |
| 4023 | Schema.Union([ |
| 4024 | Schema.Record(Schema.String, ElicitationContentValue).annotate({ |
| 4025 | description: |
| 4026 | "The user-provided content, if any, as an object matching the requested schema.", |
| 4027 | }), |
| 4028 | Schema.Null, |
| 4029 | ]), |
| 4030 | ), |
| 4031 | }).annotate({ description: "The user accepted the elicitation and provided content." }), |
| 4032 | Schema.Struct({ |
| 4033 | _meta: Schema.optionalKey( |
| 4034 | Schema.Union([ |
| 4035 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4036 | description: |
| 4037 | "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/v2/draft/extensibility)", |
| 4038 | }), |
| 4039 | Schema.Null, |
| 4040 | ]), |
| 4041 | ), |
| 4042 | action: Schema.Literal("decline"), |
| 4043 | }).annotate({ description: "The user declined the elicitation." }), |
| 4044 | Schema.Struct({ |
| 4045 | _meta: Schema.optionalKey( |
| 4046 | Schema.Union([ |
| 4047 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4048 | description: |
| 4049 | "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/v2/draft/extensibility)", |
| 4050 | }), |
| 4051 | Schema.Null, |
| 4052 | ]), |
| 4053 | ), |
| 4054 | action: Schema.Literal("cancel"), |
| 4055 | }).annotate({ description: "The elicitation was cancelled." }), |
| 4056 | Schema.StructWithRest( |
| 4057 | Schema.Struct({ |
| 4058 | _meta: Schema.optionalKey( |
| 4059 | Schema.Union([ |
| 4060 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4061 | description: |
| 4062 | "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/v2/draft/extensibility)", |
| 4063 | }), |
| 4064 | Schema.Null, |
| 4065 | ]), |
| 4066 | ), |
| 4067 | action: Schema.String.annotate({ |
| 4068 | description: |
| 4069 | "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.", |
| 4070 | }).check( |
| 4071 | Schema.isPattern( |
| 4072 | new RegExp("^(?!(?:\\x61ccept|\\x64ecline|\\x63ancel)$)[\\s\\S]*$"), |
| 4073 | ).annotate({ |
| 4074 | expected: |
| 4075 | "a string matching the RegExp ^(?!(?:\\x61ccept|\\x64ecline|\\x63ancel)$)[\\s\\S]*$", |
| 4076 | }), |
| 4077 | ), |
| 4078 | }), |
| 4079 | [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], |
| 4080 | ).annotate({ |
| 4081 | title: "other", |
| 4082 | description: |
| 4083 | "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.", |
| 4084 | }), |
| 4085 | ]).annotate({ identifier: "CreateElicitationResponse" }); |
| 4086 | |
| 4087 | export type SessionCapabilities = { |
| 4088 | readonly prompt?: PromptCapabilities | null; |
| 4089 | readonly mcp?: McpCapabilities | null; |
| 4090 | readonly delete?: SessionDeleteCapabilities | null; |
| 4091 | readonly additionalDirectories?: SessionAdditionalDirectoriesCapabilities | null; |
| 4092 | readonly fork?: SessionForkCapabilities | null; |
| 4093 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 4094 | }; |
| 4095 | export const SessionCapabilities = Schema.Struct({ |
| 4096 | prompt: Schema.optionalKey( |
| 4097 | Schema.Union([PromptCapabilities, Schema.Null]).annotate({ |
| 4098 | description: |
| 4099 | "Prompt capabilities supported by the agent in `session/prompt` requests.\n\nOptional. Omitted or `null` both mean the agent does not advertise any\nprompt extensions beyond the baseline text and resource-link content\nrequired by `session/prompt`.", |
| 4100 | }), |
| 4101 | ), |
| 4102 | mcp: Schema.optionalKey( |
| 4103 | Schema.Union([McpCapabilities, Schema.Null]).annotate({ |
| 4104 | description: |
| 4105 | "MCP capabilities supported by the agent for session lifecycle requests.\n\nOptional. Omitted or `null` both mean the agent does not advertise MCP\nserver transport support for sessions.", |
| 4106 | }), |
| 4107 | ), |
| 4108 | delete: Schema.optionalKey( |
| 4109 | Schema.Union([SessionDeleteCapabilities, Schema.Null]).annotate({ |
| 4110 | description: |
| 4111 | "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`.", |
| 4112 | }), |
| 4113 | ), |
| 4114 | additionalDirectories: Schema.optionalKey( |
| 4115 | Schema.Union([SessionAdditionalDirectoriesCapabilities, Schema.Null]).annotate({ |
| 4116 | description: |
| 4117 | "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 may return `SessionInfo.additionalDirectories` to report the\ncomplete ordered additional-root list associated with a listed session.", |
| 4118 | }), |
| 4119 | ), |
| 4120 | fork: Schema.optionalKey( |
| 4121 | Schema.Union([SessionForkCapabilities, Schema.Null]).annotate({ |
| 4122 | description: |
| 4123 | "**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.", |
| 4124 | }), |
| 4125 | ), |
| 4126 | _meta: Schema.optionalKey( |
| 4127 | Schema.Union([ |
| 4128 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4129 | description: |
| 4130 | "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/v2/draft/extensibility)", |
| 4131 | }), |
| 4132 | Schema.Null, |
| 4133 | ]), |
| 4134 | ), |
| 4135 | }).annotate({ |
| 4136 | description: |
| 4137 | "Session capabilities supported by the agent.\n\nSupplying `{}` means the agent supports the baseline session methods:\n`session/new`, `session/list`, `session/resume`, `session/close`,\n`session/prompt`, `session/cancel`, and `session/update`.\n\nAgents that support sessions **MAY** support additional session methods,\nprompt content types, and MCP transports by specifying additional\ncapabilities.\n\nSee protocol docs: [Session Capabilities](https://agentclientprotocol.com/protocol/v2/draft/initialization#session-capabilities)", |
| 4138 | identifier: "SessionCapabilities", |
| 4139 | }); |
| 4140 | |
| 4141 | export type NesDocumentEventCapabilities = { |
| 4142 | readonly didOpen?: NesDocumentDidOpenCapabilities | null; |
| 4143 | readonly didChange?: NesDocumentDidChangeCapabilities | null; |
| 4144 | readonly didClose?: NesDocumentDidCloseCapabilities | null; |
| 4145 | readonly didSave?: NesDocumentDidSaveCapabilities | null; |
| 4146 | readonly didFocus?: NesDocumentDidFocusCapabilities | null; |
| 4147 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 4148 | }; |
| 4149 | export const NesDocumentEventCapabilities = Schema.Struct({ |
| 4150 | didOpen: Schema.optionalKey( |
| 4151 | Schema.Union([NesDocumentDidOpenCapabilities, Schema.Null]).annotate({ |
| 4152 | description: "Whether the agent wants `document/didOpen` events.", |
| 4153 | }), |
| 4154 | ), |
| 4155 | didChange: Schema.optionalKey( |
| 4156 | Schema.Union([NesDocumentDidChangeCapabilities, Schema.Null]).annotate({ |
| 4157 | description: "Whether the agent wants `document/didChange` events, and the sync kind.", |
| 4158 | }), |
| 4159 | ), |
| 4160 | didClose: Schema.optionalKey( |
| 4161 | Schema.Union([NesDocumentDidCloseCapabilities, Schema.Null]).annotate({ |
| 4162 | description: "Whether the agent wants `document/didClose` events.", |
| 4163 | }), |
| 4164 | ), |
| 4165 | didSave: Schema.optionalKey( |
| 4166 | Schema.Union([NesDocumentDidSaveCapabilities, Schema.Null]).annotate({ |
| 4167 | description: "Whether the agent wants `document/didSave` events.", |
| 4168 | }), |
| 4169 | ), |
| 4170 | didFocus: Schema.optionalKey( |
| 4171 | Schema.Union([NesDocumentDidFocusCapabilities, Schema.Null]).annotate({ |
| 4172 | description: "Whether the agent wants `document/didFocus` events.", |
| 4173 | }), |
| 4174 | ), |
| 4175 | _meta: Schema.optionalKey( |
| 4176 | Schema.Union([ |
| 4177 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4178 | description: |
| 4179 | "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/v2/draft/extensibility)", |
| 4180 | }), |
| 4181 | Schema.Null, |
| 4182 | ]), |
| 4183 | ), |
| 4184 | }).annotate({ |
| 4185 | description: "Document event capabilities the agent wants to receive.", |
| 4186 | identifier: "NesDocumentEventCapabilities", |
| 4187 | }); |
| 4188 | |
| 4189 | export type EmbeddedResourceResource = TextResourceContents | BlobResourceContents; |
| 4190 | export const EmbeddedResourceResource = Schema.Union([ |
| 4191 | Schema.suspend((): Schema.Codec<TextResourceContents> => TextResourceContents).annotate({ |
| 4192 | title: "TextResourceContents", |
| 4193 | description: "Text resource contents embedded directly in the message.", |
| 4194 | }), |
| 4195 | Schema.suspend((): Schema.Codec<BlobResourceContents> => BlobResourceContents).annotate({ |
| 4196 | title: "BlobResourceContents", |
| 4197 | description: "Binary resource contents embedded directly in the message.", |
| 4198 | }), |
| 4199 | ]).annotate({ |
| 4200 | description: "Resource content that can be embedded in a message.", |
| 4201 | identifier: "EmbeddedResourceResource", |
| 4202 | }); |
| 4203 | |
| 4204 | export type ListSessionsResponse = { |
| 4205 | readonly sessions: ReadonlyArray<SessionInfo>; |
| 4206 | readonly nextCursor?: SessionListCursor | null; |
| 4207 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 4208 | }; |
| 4209 | export const ListSessionsResponse = Schema.Struct({ |
| 4210 | sessions: Schema.Array(SessionInfo).annotate({ |
| 4211 | description: "Array of session information objects.", |
| 4212 | }), |
| 4213 | nextCursor: Schema.optionalKey( |
| 4214 | Schema.Union([SessionListCursor, Schema.Null]).annotate({ |
| 4215 | description: |
| 4216 | "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.", |
| 4217 | }), |
| 4218 | ), |
| 4219 | _meta: Schema.optionalKey( |
| 4220 | Schema.Union([ |
| 4221 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4222 | description: |
| 4223 | "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/v2/draft/extensibility)", |
| 4224 | }), |
| 4225 | Schema.Null, |
| 4226 | ]), |
| 4227 | ), |
| 4228 | }).annotate({ description: "Response from listing sessions.", identifier: "ListSessionsResponse" }); |
| 4229 | |
| 4230 | export type PlanUpdateContent = |
| 4231 | | { |
| 4232 | readonly type: "items"; |
| 4233 | readonly planId: PlanId; |
| 4234 | readonly entries: ReadonlyArray<PlanEntry>; |
| 4235 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 4236 | } |
| 4237 | | { |
| 4238 | readonly type: "file"; |
| 4239 | readonly planId: PlanId; |
| 4240 | readonly uri: string; |
| 4241 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 4242 | } |
| 4243 | | { |
| 4244 | readonly type: "markdown"; |
| 4245 | readonly planId: PlanId; |
| 4246 | readonly content: string; |
| 4247 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 4248 | } |
| 4249 | | ({ readonly type: string; readonly planId: PlanId } & { readonly [x: string]: Schema.Json }); |
| 4250 | export const PlanUpdateContent = Schema.Union([ |
| 4251 | Schema.Struct({ |
| 4252 | type: Schema.Literal("items"), |
| 4253 | planId: Schema.suspend((): Schema.Codec<PlanId> => PlanId).annotate({ |
| 4254 | description: "The plan ID to update.", |
| 4255 | }), |
| 4256 | entries: Schema.Array(PlanEntry).annotate({ |
| 4257 | description: |
| 4258 | "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.", |
| 4259 | }), |
| 4260 | _meta: Schema.optionalKey( |
| 4261 | Schema.Union([ |
| 4262 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4263 | description: |
| 4264 | "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/v2/draft/extensibility)", |
| 4265 | }), |
| 4266 | Schema.Null, |
| 4267 | ]), |
| 4268 | ), |
| 4269 | }).annotate({ description: "A plan represented as structured entries." }), |
| 4270 | Schema.Struct({ |
| 4271 | type: Schema.Literal("file"), |
| 4272 | planId: Schema.suspend((): Schema.Codec<PlanId> => PlanId).annotate({ |
| 4273 | description: "The plan ID to update.", |
| 4274 | }), |
| 4275 | uri: Schema.String.annotate({ |
| 4276 | description: "The URI of the file containing the plan.", |
| 4277 | format: "uri", |
| 4278 | }), |
| 4279 | _meta: Schema.optionalKey( |
| 4280 | Schema.Union([ |
| 4281 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4282 | description: |
| 4283 | "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/v2/draft/extensibility)", |
| 4284 | }), |
| 4285 | Schema.Null, |
| 4286 | ]), |
| 4287 | ), |
| 4288 | }).annotate({ |
| 4289 | description: |
| 4290 | "**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.", |
| 4291 | }), |
| 4292 | Schema.Struct({ |
| 4293 | type: Schema.Literal("markdown"), |
| 4294 | planId: Schema.suspend((): Schema.Codec<PlanId> => PlanId).annotate({ |
| 4295 | description: "The plan ID to update.", |
| 4296 | }), |
| 4297 | content: Schema.String.annotate({ description: "Markdown content for the plan." }), |
| 4298 | _meta: Schema.optionalKey( |
| 4299 | Schema.Union([ |
| 4300 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4301 | description: |
| 4302 | "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/v2/draft/extensibility)", |
| 4303 | }), |
| 4304 | Schema.Null, |
| 4305 | ]), |
| 4306 | ), |
| 4307 | }).annotate({ |
| 4308 | description: |
| 4309 | "**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.", |
| 4310 | }), |
| 4311 | Schema.StructWithRest( |
| 4312 | Schema.Struct({ |
| 4313 | type: Schema.String.annotate({ |
| 4314 | description: |
| 4315 | "Custom or future plan update content type.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 4316 | }).check( |
| 4317 | Schema.isPattern( |
| 4318 | new RegExp("^(?!(?:\\x69tems|\\x66ile|\\x6darkdown)$)[\\s\\S]*$"), |
| 4319 | ).annotate({ |
| 4320 | expected: |
| 4321 | "a string matching the RegExp ^(?!(?:\\x69tems|\\x66ile|\\x6darkdown)$)[\\s\\S]*$", |
| 4322 | }), |
| 4323 | ), |
| 4324 | planId: Schema.suspend((): Schema.Codec<PlanId> => PlanId).annotate({ |
| 4325 | description: "The plan ID to update.", |
| 4326 | }), |
| 4327 | }), |
| 4328 | [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], |
| 4329 | ).annotate({ |
| 4330 | title: "other", |
| 4331 | description: |
| 4332 | "Custom or future plan update content.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.\n\nReceivers that do not understand this content type should preserve the\nraw payload when storing, replaying, proxying, or forwarding plans, and\notherwise ignore it or display it generically.", |
| 4333 | }), |
| 4334 | ]).annotate({ description: "Updated content for a plan.", identifier: "PlanUpdateContent" }); |
| 4335 | |
| 4336 | export type SessionConfigSelectGroup = { |
| 4337 | readonly groupId: SessionConfigGroupId; |
| 4338 | readonly name: string; |
| 4339 | readonly options: ReadonlyArray<SessionConfigSelectOption>; |
| 4340 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 4341 | }; |
| 4342 | export const SessionConfigSelectGroup = Schema.Struct({ |
| 4343 | groupId: Schema.suspend((): Schema.Codec<SessionConfigGroupId> => SessionConfigGroupId).annotate({ |
| 4344 | description: "Unique identifier for this group.", |
| 4345 | }), |
| 4346 | name: Schema.String.annotate({ description: "Human-readable label for this group." }), |
| 4347 | options: Schema.Array(SessionConfigSelectOption).annotate({ |
| 4348 | description: "The set of option values in this group.", |
| 4349 | }), |
| 4350 | _meta: Schema.optionalKey( |
| 4351 | Schema.Union([ |
| 4352 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4353 | description: |
| 4354 | "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/v2/draft/extensibility)", |
| 4355 | }), |
| 4356 | Schema.Null, |
| 4357 | ]), |
| 4358 | ), |
| 4359 | }).annotate({ |
| 4360 | description: "A group of possible values for a session configuration option.", |
| 4361 | identifier: "SessionConfigSelectGroup", |
| 4362 | }); |
| 4363 | |
| 4364 | export type RequestPermissionResponse = { |
| 4365 | readonly outcome: RequestPermissionOutcome; |
| 4366 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 4367 | }; |
| 4368 | export const RequestPermissionResponse = Schema.Struct({ |
| 4369 | outcome: Schema.suspend( |
| 4370 | (): Schema.Codec<RequestPermissionOutcome> => RequestPermissionOutcome, |
| 4371 | ).annotate({ description: "The user's decision on the permission request." }), |
| 4372 | _meta: Schema.optionalKey( |
| 4373 | Schema.Union([ |
| 4374 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4375 | description: |
| 4376 | "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/v2/draft/extensibility)", |
| 4377 | }), |
| 4378 | Schema.Null, |
| 4379 | ]), |
| 4380 | ), |
| 4381 | }).annotate({ |
| 4382 | description: "Response to a permission request.", |
| 4383 | identifier: "RequestPermissionResponse", |
| 4384 | }); |
| 4385 | |
| 4386 | export type ElicitationPropertySchema = |
| 4387 | | { |
| 4388 | readonly type: "string"; |
| 4389 | readonly title?: string | null; |
| 4390 | readonly description?: string | null; |
| 4391 | readonly minLength?: number | null; |
| 4392 | readonly maxLength?: number | null; |
| 4393 | readonly pattern?: string | null; |
| 4394 | readonly format?: StringFormat | null; |
| 4395 | readonly default?: string | null; |
| 4396 | readonly enum?: ReadonlyArray<string> | null; |
| 4397 | readonly oneOf?: ReadonlyArray<EnumOption> | null; |
| 4398 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 4399 | } |
| 4400 | | { |
| 4401 | readonly type: "number"; |
| 4402 | readonly title?: string | null; |
| 4403 | readonly description?: string | null; |
| 4404 | readonly minimum?: number | null; |
| 4405 | readonly maximum?: number | null; |
| 4406 | readonly default?: number | null; |
| 4407 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 4408 | } |
| 4409 | | { |
| 4410 | readonly type: "integer"; |
| 4411 | readonly title?: string | null; |
| 4412 | readonly description?: string | null; |
| 4413 | readonly minimum?: number | null; |
| 4414 | readonly maximum?: number | null; |
| 4415 | readonly default?: number | null; |
| 4416 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 4417 | } |
| 4418 | | { |
| 4419 | readonly type: "boolean"; |
| 4420 | readonly title?: string | null; |
| 4421 | readonly description?: string | null; |
| 4422 | readonly default?: boolean | null; |
| 4423 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 4424 | } |
| 4425 | | { |
| 4426 | readonly type: "array"; |
| 4427 | readonly title?: string | null; |
| 4428 | readonly description?: string | null; |
| 4429 | readonly minItems?: number | null; |
| 4430 | readonly maxItems?: number | null; |
| 4431 | readonly items: MultiSelectItems; |
| 4432 | readonly default?: ReadonlyArray<string> | null; |
| 4433 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 4434 | } |
| 4435 | | ({ readonly type: string } & { readonly [x: string]: Schema.Json }); |
| 4436 | export const ElicitationPropertySchema = Schema.Union([ |
| 4437 | Schema.Struct({ |
| 4438 | type: Schema.Literal("string"), |
| 4439 | title: Schema.optionalKey( |
| 4440 | Schema.Union([ |
| 4441 | Schema.String.annotate({ |
| 4442 | description: |
| 4443 | "Optional title for the property.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.", |
| 4444 | }), |
| 4445 | Schema.Null, |
| 4446 | ]), |
| 4447 | ), |
| 4448 | description: Schema.optionalKey( |
| 4449 | Schema.Union([ |
| 4450 | Schema.String.annotate({ |
| 4451 | description: |
| 4452 | "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.", |
| 4453 | }), |
| 4454 | Schema.Null, |
| 4455 | ]), |
| 4456 | ), |
| 4457 | minLength: Schema.optionalKey( |
| 4458 | Schema.Union([ |
| 4459 | Schema.Number.annotate({ |
| 4460 | description: |
| 4461 | "Minimum string length.\n\nOptional. Omitted and `null` are equivalent and mean there is no minimum length constraint.", |
| 4462 | format: "uint32", |
| 4463 | }) |
| 4464 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 4465 | .check( |
| 4466 | Schema.isGreaterThanOrEqualTo(0).annotate({ |
| 4467 | expected: "a value greater than or equal to 0", |
| 4468 | }), |
| 4469 | ), |
| 4470 | Schema.Null, |
| 4471 | ]), |
| 4472 | ), |
| 4473 | maxLength: Schema.optionalKey( |
| 4474 | Schema.Union([ |
| 4475 | Schema.Number.annotate({ |
| 4476 | description: |
| 4477 | "Maximum string length.\n\nOptional. Omitted and `null` are equivalent and mean there is no maximum length constraint.", |
| 4478 | format: "uint32", |
| 4479 | }) |
| 4480 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 4481 | .check( |
| 4482 | Schema.isGreaterThanOrEqualTo(0).annotate({ |
| 4483 | expected: "a value greater than or equal to 0", |
| 4484 | }), |
| 4485 | ), |
| 4486 | Schema.Null, |
| 4487 | ]), |
| 4488 | ), |
| 4489 | pattern: Schema.optionalKey( |
| 4490 | Schema.Union([ |
| 4491 | Schema.String.annotate({ |
| 4492 | description: |
| 4493 | "Pattern the string must match.\n\nOptional. Omitted and `null` are equivalent and mean there is no pattern constraint.", |
| 4494 | format: "regex", |
| 4495 | }), |
| 4496 | Schema.Null, |
| 4497 | ]), |
| 4498 | ), |
| 4499 | format: Schema.optionalKey( |
| 4500 | Schema.Union([StringFormat, Schema.Null]).annotate({ |
| 4501 | description: |
| 4502 | "String format.\n\nOptional. Omitted and `null` are equivalent and mean there is no format constraint.", |
| 4503 | }), |
| 4504 | ), |
| 4505 | default: Schema.optionalKey( |
| 4506 | Schema.Union([ |
| 4507 | Schema.String.annotate({ |
| 4508 | description: |
| 4509 | "Default value.\n\nOptional. Omitted and `null` are equivalent and mean no default value is provided.", |
| 4510 | }), |
| 4511 | Schema.Null, |
| 4512 | ]), |
| 4513 | ), |
| 4514 | enum: Schema.optionalKey( |
| 4515 | Schema.Union([ |
| 4516 | Schema.Array(Schema.String) |
| 4517 | .annotate({ |
| 4518 | description: |
| 4519 | "Enum values for untitled single-select enums.\nMust contain at least one value when present.\nOptional. Omitted and `null` are equivalent and mean no untitled single-select choices are\ndeclared by `enum`.", |
| 4520 | }) |
| 4521 | .check( |
| 4522 | Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" }), |
| 4523 | ), |
| 4524 | Schema.Null, |
| 4525 | ]), |
| 4526 | ), |
| 4527 | oneOf: Schema.optionalKey( |
| 4528 | Schema.Union([ |
| 4529 | Schema.Array(EnumOption) |
| 4530 | .annotate({ |
| 4531 | description: |
| 4532 | "Titled enum options for titled single-select enums.\nMust contain at least one option when present.\nOptional. Omitted and `null` are equivalent and mean no titled single-select choices are\ndeclared by `oneOf`.", |
| 4533 | }) |
| 4534 | .check( |
| 4535 | Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" }), |
| 4536 | ), |
| 4537 | Schema.Null, |
| 4538 | ]), |
| 4539 | ), |
| 4540 | _meta: Schema.optionalKey( |
| 4541 | Schema.Union([ |
| 4542 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4543 | description: |
| 4544 | "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/v2/draft/extensibility)", |
| 4545 | }), |
| 4546 | Schema.Null, |
| 4547 | ]), |
| 4548 | ), |
| 4549 | }).annotate({ |
| 4550 | description: |
| 4551 | 'Schema for string properties in an elicitation form.\n\nWhen `enum` or `oneOf` is set, this represents a single-select enum\nwith `"type": "string"`.', |
| 4552 | }), |
| 4553 | Schema.Struct({ |
| 4554 | type: Schema.Literal("number"), |
| 4555 | title: Schema.optionalKey( |
| 4556 | Schema.Union([ |
| 4557 | Schema.String.annotate({ |
| 4558 | description: |
| 4559 | "Optional title for the property.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.", |
| 4560 | }), |
| 4561 | Schema.Null, |
| 4562 | ]), |
| 4563 | ), |
| 4564 | description: Schema.optionalKey( |
| 4565 | Schema.Union([ |
| 4566 | Schema.String.annotate({ |
| 4567 | description: |
| 4568 | "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.", |
| 4569 | }), |
| 4570 | Schema.Null, |
| 4571 | ]), |
| 4572 | ), |
| 4573 | minimum: Schema.optionalKey( |
| 4574 | Schema.Union([ |
| 4575 | Schema.Number.annotate({ |
| 4576 | description: |
| 4577 | "Minimum value (inclusive).\n\nOptional. Omitted and `null` are equivalent and mean there is no inclusive lower bound.", |
| 4578 | format: "double", |
| 4579 | }).check(Schema.isFinite().annotate({ expected: "a finite number" })), |
| 4580 | Schema.Null, |
| 4581 | ]), |
| 4582 | ), |
| 4583 | maximum: Schema.optionalKey( |
| 4584 | Schema.Union([ |
| 4585 | Schema.Number.annotate({ |
| 4586 | description: |
| 4587 | "Maximum value (inclusive).\n\nOptional. Omitted and `null` are equivalent and mean there is no inclusive upper bound.", |
| 4588 | format: "double", |
| 4589 | }).check(Schema.isFinite().annotate({ expected: "a finite number" })), |
| 4590 | Schema.Null, |
| 4591 | ]), |
| 4592 | ), |
| 4593 | default: Schema.optionalKey( |
| 4594 | Schema.Union([ |
| 4595 | Schema.Number.annotate({ |
| 4596 | description: |
| 4597 | "Default value.\n\nOptional. Omitted and `null` are equivalent and mean no default value is provided.", |
| 4598 | format: "double", |
| 4599 | }).check(Schema.isFinite().annotate({ expected: "a finite number" })), |
| 4600 | Schema.Null, |
| 4601 | ]), |
| 4602 | ), |
| 4603 | _meta: Schema.optionalKey( |
| 4604 | Schema.Union([ |
| 4605 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4606 | description: |
| 4607 | "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/v2/draft/extensibility)", |
| 4608 | }), |
| 4609 | Schema.Null, |
| 4610 | ]), |
| 4611 | ), |
| 4612 | }).annotate({ |
| 4613 | description: "Schema for number (floating-point) properties in an elicitation form.", |
| 4614 | }), |
| 4615 | Schema.Struct({ |
| 4616 | type: Schema.Literal("integer"), |
| 4617 | title: Schema.optionalKey( |
| 4618 | Schema.Union([ |
| 4619 | Schema.String.annotate({ |
| 4620 | description: |
| 4621 | "Optional title for the property.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.", |
| 4622 | }), |
| 4623 | Schema.Null, |
| 4624 | ]), |
| 4625 | ), |
| 4626 | description: Schema.optionalKey( |
| 4627 | Schema.Union([ |
| 4628 | Schema.String.annotate({ |
| 4629 | description: |
| 4630 | "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.", |
| 4631 | }), |
| 4632 | Schema.Null, |
| 4633 | ]), |
| 4634 | ), |
| 4635 | minimum: Schema.optionalKey( |
| 4636 | Schema.Union([ |
| 4637 | Schema.Number.annotate({ |
| 4638 | description: |
| 4639 | "Minimum value (inclusive).\n\nOptional. Omitted and `null` are equivalent and mean there is no inclusive lower bound.", |
| 4640 | format: "int64", |
| 4641 | }).check(Schema.isInt().annotate({ expected: "an integer" })), |
| 4642 | Schema.Null, |
| 4643 | ]), |
| 4644 | ), |
| 4645 | maximum: Schema.optionalKey( |
| 4646 | Schema.Union([ |
| 4647 | Schema.Number.annotate({ |
| 4648 | description: |
| 4649 | "Maximum value (inclusive).\n\nOptional. Omitted and `null` are equivalent and mean there is no inclusive upper bound.", |
| 4650 | format: "int64", |
| 4651 | }).check(Schema.isInt().annotate({ expected: "an integer" })), |
| 4652 | Schema.Null, |
| 4653 | ]), |
| 4654 | ), |
| 4655 | default: Schema.optionalKey( |
| 4656 | Schema.Union([ |
| 4657 | Schema.Number.annotate({ |
| 4658 | description: |
| 4659 | "Default value.\n\nOptional. Omitted and `null` are equivalent and mean no default value is provided.", |
| 4660 | format: "int64", |
| 4661 | }).check(Schema.isInt().annotate({ expected: "an integer" })), |
| 4662 | Schema.Null, |
| 4663 | ]), |
| 4664 | ), |
| 4665 | _meta: Schema.optionalKey( |
| 4666 | Schema.Union([ |
| 4667 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4668 | description: |
| 4669 | "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/v2/draft/extensibility)", |
| 4670 | }), |
| 4671 | Schema.Null, |
| 4672 | ]), |
| 4673 | ), |
| 4674 | }).annotate({ description: "Schema for integer properties in an elicitation form." }), |
| 4675 | Schema.Struct({ |
| 4676 | type: Schema.Literal("boolean"), |
| 4677 | title: Schema.optionalKey( |
| 4678 | Schema.Union([ |
| 4679 | Schema.String.annotate({ |
| 4680 | description: |
| 4681 | "Optional title for the property.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.", |
| 4682 | }), |
| 4683 | Schema.Null, |
| 4684 | ]), |
| 4685 | ), |
| 4686 | description: Schema.optionalKey( |
| 4687 | Schema.Union([ |
| 4688 | Schema.String.annotate({ |
| 4689 | description: |
| 4690 | "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.", |
| 4691 | }), |
| 4692 | Schema.Null, |
| 4693 | ]), |
| 4694 | ), |
| 4695 | default: Schema.optionalKey( |
| 4696 | Schema.Union([ |
| 4697 | Schema.Boolean.annotate({ |
| 4698 | description: |
| 4699 | "Default value.\n\nOptional. Omitted and `null` are equivalent and mean no default value is provided.", |
| 4700 | }), |
| 4701 | Schema.Null, |
| 4702 | ]), |
| 4703 | ), |
| 4704 | _meta: Schema.optionalKey( |
| 4705 | Schema.Union([ |
| 4706 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4707 | description: |
| 4708 | "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/v2/draft/extensibility)", |
| 4709 | }), |
| 4710 | Schema.Null, |
| 4711 | ]), |
| 4712 | ), |
| 4713 | }).annotate({ description: "Schema for boolean properties in an elicitation form." }), |
| 4714 | Schema.Struct({ |
| 4715 | type: Schema.Literal("array"), |
| 4716 | title: Schema.optionalKey( |
| 4717 | Schema.Union([ |
| 4718 | Schema.String.annotate({ |
| 4719 | description: |
| 4720 | "Optional title for the property.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.", |
| 4721 | }), |
| 4722 | Schema.Null, |
| 4723 | ]), |
| 4724 | ), |
| 4725 | description: Schema.optionalKey( |
| 4726 | Schema.Union([ |
| 4727 | Schema.String.annotate({ |
| 4728 | description: |
| 4729 | "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.", |
| 4730 | }), |
| 4731 | Schema.Null, |
| 4732 | ]), |
| 4733 | ), |
| 4734 | minItems: Schema.optionalKey( |
| 4735 | Schema.Union([ |
| 4736 | Schema.Number.annotate({ |
| 4737 | description: |
| 4738 | "Minimum number of items to select.\n\nOptional. Omitted and `null` are equivalent and mean there is no minimum selection count.", |
| 4739 | format: "uint64", |
| 4740 | }) |
| 4741 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 4742 | .check( |
| 4743 | Schema.isGreaterThanOrEqualTo(0).annotate({ |
| 4744 | expected: "a value greater than or equal to 0", |
| 4745 | }), |
| 4746 | ), |
| 4747 | Schema.Null, |
| 4748 | ]), |
| 4749 | ), |
| 4750 | maxItems: Schema.optionalKey( |
| 4751 | Schema.Union([ |
| 4752 | Schema.Number.annotate({ |
| 4753 | description: |
| 4754 | "Maximum number of items to select.\n\nOptional. Omitted and `null` are equivalent and mean there is no maximum selection count.", |
| 4755 | format: "uint64", |
| 4756 | }) |
| 4757 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 4758 | .check( |
| 4759 | Schema.isGreaterThanOrEqualTo(0).annotate({ |
| 4760 | expected: "a value greater than or equal to 0", |
| 4761 | }), |
| 4762 | ), |
| 4763 | Schema.Null, |
| 4764 | ]), |
| 4765 | ), |
| 4766 | items: Schema.suspend((): Schema.Codec<MultiSelectItems> => MultiSelectItems).annotate({ |
| 4767 | description: "The items definition describing allowed values.", |
| 4768 | }), |
| 4769 | default: Schema.optionalKey( |
| 4770 | Schema.Union([ |
| 4771 | Schema.Array(Schema.String).annotate({ |
| 4772 | description: |
| 4773 | "Default selected values.\n\nOptional. Omitted and `null` are equivalent and mean no default selections are provided.", |
| 4774 | }), |
| 4775 | Schema.Null, |
| 4776 | ]), |
| 4777 | ), |
| 4778 | _meta: Schema.optionalKey( |
| 4779 | Schema.Union([ |
| 4780 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4781 | description: |
| 4782 | "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/v2/draft/extensibility)", |
| 4783 | }), |
| 4784 | Schema.Null, |
| 4785 | ]), |
| 4786 | ), |
| 4787 | }).annotate({ |
| 4788 | description: "Schema for multi-select (array) properties in an elicitation form.", |
| 4789 | }), |
| 4790 | Schema.StructWithRest( |
| 4791 | Schema.Struct({ |
| 4792 | type: Schema.String.annotate({ |
| 4793 | description: |
| 4794 | "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.", |
| 4795 | }).check( |
| 4796 | Schema.isPattern( |
| 4797 | new RegExp("^(?!(?:\\x73tring|\\x6eumber|\\x69nteger|\\x62oolean|\\x61rray)$)[\\s\\S]*$"), |
| 4798 | ).annotate({ |
| 4799 | expected: |
| 4800 | "a string matching the RegExp ^(?!(?:\\x73tring|\\x6eumber|\\x69nteger|\\x62oolean|\\x61rray)$)[\\s\\S]*$", |
| 4801 | }), |
| 4802 | ), |
| 4803 | }), |
| 4804 | [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], |
| 4805 | ).annotate({ |
| 4806 | title: "other", |
| 4807 | description: |
| 4808 | "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.", |
| 4809 | }), |
| 4810 | ]).annotate({ |
| 4811 | description: |
| 4812 | '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.', |
| 4813 | identifier: "ElicitationPropertySchema", |
| 4814 | }); |
| 4815 | |
| 4816 | export type ProviderInfo = { |
| 4817 | readonly providerId: ProviderId; |
| 4818 | readonly supported: ReadonlyArray<LlmProtocol>; |
| 4819 | readonly required: boolean; |
| 4820 | readonly current?: ProviderCurrentConfig | null; |
| 4821 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 4822 | }; |
| 4823 | export const ProviderInfo = Schema.Struct({ |
| 4824 | providerId: Schema.suspend((): Schema.Codec<ProviderId> => ProviderId).annotate({ |
| 4825 | description: 'Provider identifier, for example "main" or "openai".', |
| 4826 | }), |
| 4827 | supported: Schema.Array(LlmProtocol).annotate({ |
| 4828 | description: "Supported protocol types for this provider.", |
| 4829 | }), |
| 4830 | required: Schema.Boolean.annotate({ |
| 4831 | description: |
| 4832 | "Whether this provider is mandatory and cannot be disabled via `providers/disable`.\nIf true, clients must not call `providers/disable` for this provider ID.", |
| 4833 | }), |
| 4834 | current: Schema.optionalKey( |
| 4835 | Schema.Union([ProviderCurrentConfig, Schema.Null]).annotate({ |
| 4836 | description: |
| 4837 | "Current effective non-secret routing config.\nNull or omitted means provider is disabled.", |
| 4838 | }), |
| 4839 | ), |
| 4840 | _meta: Schema.optionalKey( |
| 4841 | Schema.Union([ |
| 4842 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4843 | description: |
| 4844 | "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/v2/draft/extensibility)", |
| 4845 | }), |
| 4846 | Schema.Null, |
| 4847 | ]), |
| 4848 | ), |
| 4849 | }).annotate({ |
| 4850 | description: |
| 4851 | "**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.", |
| 4852 | identifier: "ProviderInfo", |
| 4853 | }); |
| 4854 | |
| 4855 | export type NesTextEdit = { |
| 4856 | readonly range: Range; |
| 4857 | readonly newText: string; |
| 4858 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 4859 | }; |
| 4860 | export const NesTextEdit = Schema.Struct({ |
| 4861 | range: Schema.suspend((): Schema.Codec<Range> => Range).annotate({ |
| 4862 | description: "The range to replace.", |
| 4863 | }), |
| 4864 | newText: Schema.String.annotate({ description: "The replacement text." }), |
| 4865 | _meta: Schema.optionalKey( |
| 4866 | Schema.Union([ |
| 4867 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4868 | description: |
| 4869 | "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/v2/draft/extensibility)", |
| 4870 | }), |
| 4871 | Schema.Null, |
| 4872 | ]), |
| 4873 | ), |
| 4874 | }).annotate({ description: "A text edit within a suggestion.", identifier: "NesTextEdit" }); |
| 4875 | |
| 4876 | export type TextDocumentContentChangeEvent = { |
| 4877 | readonly range?: Range | null; |
| 4878 | readonly text: string; |
| 4879 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 4880 | }; |
| 4881 | export const TextDocumentContentChangeEvent = Schema.Struct({ |
| 4882 | range: Schema.optionalKey( |
| 4883 | Schema.Union([Range, Schema.Null]).annotate({ |
| 4884 | description: |
| 4885 | "The range of the document that changed. If `None`, the entire content is replaced.", |
| 4886 | }), |
| 4887 | ), |
| 4888 | text: Schema.String.annotate({ |
| 4889 | description: "The new text for the range, or the full document content if `range` is `None`.", |
| 4890 | }), |
| 4891 | _meta: Schema.optionalKey( |
| 4892 | Schema.Union([ |
| 4893 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4894 | description: |
| 4895 | "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/v2/draft/extensibility)", |
| 4896 | }), |
| 4897 | Schema.Null, |
| 4898 | ]), |
| 4899 | ), |
| 4900 | }).annotate({ |
| 4901 | description: |
| 4902 | "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.", |
| 4903 | identifier: "TextDocumentContentChangeEvent", |
| 4904 | }); |
| 4905 | |
| 4906 | export type DidFocusDocumentNotification = { |
| 4907 | readonly sessionId: SessionId; |
| 4908 | readonly uri: string; |
| 4909 | readonly version: number; |
| 4910 | readonly position: Position; |
| 4911 | readonly visibleRange: Range; |
| 4912 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 4913 | }; |
| 4914 | export const DidFocusDocumentNotification = Schema.Struct({ |
| 4915 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 4916 | description: "The session ID for this notification.", |
| 4917 | }), |
| 4918 | uri: Schema.String.annotate({ description: "The URI of the focused document.", format: "uri" }), |
| 4919 | version: Schema.Number.annotate({ |
| 4920 | description: "The version number of the document.", |
| 4921 | format: "int64", |
| 4922 | }).check(Schema.isInt().annotate({ expected: "an integer" })), |
| 4923 | position: Schema.suspend((): Schema.Codec<Position> => Position).annotate({ |
| 4924 | description: "The current cursor position.", |
| 4925 | }), |
| 4926 | visibleRange: Schema.suspend((): Schema.Codec<Range> => Range).annotate({ |
| 4927 | description: "The portion of the file currently visible in the editor viewport.", |
| 4928 | }), |
| 4929 | _meta: Schema.optionalKey( |
| 4930 | Schema.Union([ |
| 4931 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4932 | description: |
| 4933 | "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/v2/draft/extensibility)", |
| 4934 | }), |
| 4935 | Schema.Null, |
| 4936 | ]), |
| 4937 | ), |
| 4938 | }).annotate({ |
| 4939 | description: "Notification sent when a file becomes the active editor tab.", |
| 4940 | identifier: "DidFocusDocumentNotification", |
| 4941 | }); |
| 4942 | |
| 4943 | export type NesOpenFile = { |
| 4944 | readonly uri: string; |
| 4945 | readonly languageId: string; |
| 4946 | readonly visibleRange?: Range | null; |
| 4947 | readonly lastFocusedMs?: number | null; |
| 4948 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 4949 | }; |
| 4950 | export const NesOpenFile = Schema.Struct({ |
| 4951 | uri: Schema.String.annotate({ description: "The URI of the file.", format: "uri" }), |
| 4952 | languageId: Schema.String.annotate({ description: "The language identifier." }), |
| 4953 | visibleRange: Schema.optionalKey( |
| 4954 | Schema.Union([Range, Schema.Null]).annotate({ |
| 4955 | description: "The visible range in the editor, if any.", |
| 4956 | }), |
| 4957 | ), |
| 4958 | lastFocusedMs: Schema.optionalKey( |
| 4959 | Schema.Union([ |
| 4960 | Schema.Number.annotate({ |
| 4961 | description: "Timestamp in milliseconds since epoch of when the file was last focused.", |
| 4962 | format: "uint64", |
| 4963 | }) |
| 4964 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 4965 | .check( |
| 4966 | Schema.isGreaterThanOrEqualTo(0).annotate({ |
| 4967 | expected: "a value greater than or equal to 0", |
| 4968 | }), |
| 4969 | ), |
| 4970 | Schema.Null, |
| 4971 | ]), |
| 4972 | ), |
| 4973 | _meta: Schema.optionalKey( |
| 4974 | Schema.Union([ |
| 4975 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 4976 | description: |
| 4977 | "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/v2/draft/extensibility)", |
| 4978 | }), |
| 4979 | Schema.Null, |
| 4980 | ]), |
| 4981 | ), |
| 4982 | }).annotate({ description: "An open file in the editor.", identifier: "NesOpenFile" }); |
| 4983 | |
| 4984 | export type NesDiagnostic = { |
| 4985 | readonly uri: string; |
| 4986 | readonly range: Range; |
| 4987 | readonly severity: NesDiagnosticSeverity; |
| 4988 | readonly message: string; |
| 4989 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 4990 | }; |
| 4991 | export const NesDiagnostic = Schema.Struct({ |
| 4992 | uri: Schema.String.annotate({ |
| 4993 | description: "The URI of the file containing the diagnostic.", |
| 4994 | format: "uri", |
| 4995 | }), |
| 4996 | range: Schema.suspend((): Schema.Codec<Range> => Range).annotate({ |
| 4997 | description: "The range of the diagnostic.", |
| 4998 | }), |
| 4999 | severity: Schema.suspend( |
| 5000 | (): Schema.Codec<NesDiagnosticSeverity> => NesDiagnosticSeverity, |
| 5001 | ).annotate({ description: "The severity of the diagnostic." }), |
| 5002 | message: Schema.String.annotate({ description: "The diagnostic message." }), |
| 5003 | _meta: Schema.optionalKey( |
| 5004 | Schema.Union([ |
| 5005 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5006 | description: |
| 5007 | "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/v2/draft/extensibility)", |
| 5008 | }), |
| 5009 | Schema.Null, |
| 5010 | ]), |
| 5011 | ), |
| 5012 | }).annotate({ description: "A diagnostic (error, warning, etc.).", identifier: "NesDiagnostic" }); |
| 5013 | |
| 5014 | export type ClientCapabilities = { |
| 5015 | readonly auth?: AuthCapabilities | null; |
| 5016 | readonly elicitation?: ElicitationCapabilities | null; |
| 5017 | readonly nes?: ClientNesCapabilities | null; |
| 5018 | readonly positionEncodings?: ReadonlyArray<PositionEncodingKind>; |
| 5019 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5020 | }; |
| 5021 | export const ClientCapabilities = Schema.Struct({ |
| 5022 | auth: Schema.optionalKey( |
| 5023 | Schema.Union([AuthCapabilities, Schema.Null]).annotate({ |
| 5024 | description: |
| 5025 | "Authentication capabilities supported by the client.\nDetermines which authentication method types the agent may include\nin its `InitializeResponse`.\n\nOptional. Omitted or `null` both mean the client does not advertise any\nauthentication-method extensions.", |
| 5026 | }), |
| 5027 | ), |
| 5028 | elicitation: Schema.optionalKey( |
| 5029 | Schema.Union([ElicitationCapabilities, Schema.Null]).annotate({ |
| 5030 | description: |
| 5031 | "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.", |
| 5032 | }), |
| 5033 | ), |
| 5034 | nes: Schema.optionalKey( |
| 5035 | Schema.Union([ClientNesCapabilities, Schema.Null]).annotate({ |
| 5036 | description: |
| 5037 | "**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.", |
| 5038 | }), |
| 5039 | ), |
| 5040 | positionEncodings: Schema.optionalKey( |
| 5041 | Schema.Array(PositionEncodingKind).annotate({ |
| 5042 | description: |
| 5043 | "**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.", |
| 5044 | }), |
| 5045 | ), |
| 5046 | _meta: Schema.optionalKey( |
| 5047 | Schema.Union([ |
| 5048 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5049 | description: |
| 5050 | "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/v2/draft/extensibility)", |
| 5051 | }), |
| 5052 | Schema.Null, |
| 5053 | ]), |
| 5054 | ), |
| 5055 | }).annotate({ |
| 5056 | description: |
| 5057 | "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/v2/draft/initialization#client-capabilities)", |
| 5058 | identifier: "ClientCapabilities", |
| 5059 | }); |
| 5060 | |
| 5061 | export type NewSessionRequest = { |
| 5062 | readonly cwd: AbsolutePath; |
| 5063 | readonly additionalDirectories?: ReadonlyArray<AbsolutePath>; |
| 5064 | readonly mcpServers?: ReadonlyArray<McpServer>; |
| 5065 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5066 | }; |
| 5067 | export const NewSessionRequest = Schema.Struct({ |
| 5068 | cwd: Schema.suspend((): Schema.Codec<AbsolutePath> => AbsolutePath).annotate({ |
| 5069 | description: "The working directory for this session. Must be an absolute path.", |
| 5070 | }), |
| 5071 | additionalDirectories: Schema.optionalKey( |
| 5072 | Schema.Array(AbsolutePath).annotate({ |
| 5073 | description: |
| 5074 | "Additional workspace roots for this session. Each path must be absolute.\n\nThese expand the session's workspace scope without changing `cwd`, which\nremains the base for relative paths. When omitted or empty, no\nadditional roots are activated for the new session.", |
| 5075 | }), |
| 5076 | ), |
| 5077 | mcpServers: Schema.optionalKey( |
| 5078 | Schema.Array(McpServer).annotate({ |
| 5079 | description: "List of MCP (Model Context Protocol) servers the agent should connect to.", |
| 5080 | }), |
| 5081 | ), |
| 5082 | _meta: Schema.optionalKey( |
| 5083 | Schema.Union([ |
| 5084 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5085 | description: |
| 5086 | "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/v2/draft/extensibility)", |
| 5087 | }), |
| 5088 | Schema.Null, |
| 5089 | ]), |
| 5090 | ), |
| 5091 | }).annotate({ |
| 5092 | description: |
| 5093 | "Request parameters for creating a new session.\n\nSee protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol/v2/draft/session-setup#creating-a-session)", |
| 5094 | identifier: "NewSessionRequest", |
| 5095 | }); |
| 5096 | |
| 5097 | export type ForkSessionRequest = { |
| 5098 | readonly sessionId: SessionId; |
| 5099 | readonly cwd: AbsolutePath; |
| 5100 | readonly additionalDirectories?: ReadonlyArray<AbsolutePath>; |
| 5101 | readonly mcpServers?: ReadonlyArray<McpServer>; |
| 5102 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5103 | }; |
| 5104 | export const ForkSessionRequest = Schema.Struct({ |
| 5105 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 5106 | description: "The ID of the session to fork.", |
| 5107 | }), |
| 5108 | cwd: Schema.suspend((): Schema.Codec<AbsolutePath> => AbsolutePath).annotate({ |
| 5109 | description: "The working directory for this session. Must be an absolute path.", |
| 5110 | }), |
| 5111 | additionalDirectories: Schema.optionalKey( |
| 5112 | Schema.Array(AbsolutePath).annotate({ |
| 5113 | description: |
| 5114 | "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.", |
| 5115 | }), |
| 5116 | ), |
| 5117 | mcpServers: Schema.optionalKey( |
| 5118 | Schema.Array(McpServer).annotate({ |
| 5119 | description: "List of MCP servers to connect to for this session.", |
| 5120 | }), |
| 5121 | ), |
| 5122 | _meta: Schema.optionalKey( |
| 5123 | Schema.Union([ |
| 5124 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5125 | description: |
| 5126 | "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/v2/draft/extensibility)", |
| 5127 | }), |
| 5128 | Schema.Null, |
| 5129 | ]), |
| 5130 | ), |
| 5131 | }).annotate({ |
| 5132 | description: |
| 5133 | "**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.", |
| 5134 | identifier: "ForkSessionRequest", |
| 5135 | }); |
| 5136 | |
| 5137 | export type ResumeSessionRequest = { |
| 5138 | readonly sessionId: SessionId; |
| 5139 | readonly cwd: AbsolutePath; |
| 5140 | readonly additionalDirectories?: ReadonlyArray<AbsolutePath>; |
| 5141 | readonly mcpServers?: ReadonlyArray<McpServer>; |
| 5142 | readonly replayFrom?: ReplayFrom | null; |
| 5143 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5144 | }; |
| 5145 | export const ResumeSessionRequest = Schema.Struct({ |
| 5146 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 5147 | description: "The ID of the session to resume.", |
| 5148 | }), |
| 5149 | cwd: Schema.suspend((): Schema.Codec<AbsolutePath> => AbsolutePath).annotate({ |
| 5150 | description: "The working directory for this session. Must be an absolute path.", |
| 5151 | }), |
| 5152 | additionalDirectories: Schema.optionalKey( |
| 5153 | Schema.Array(AbsolutePath).annotate({ |
| 5154 | description: |
| 5155 | "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`.", |
| 5156 | }), |
| 5157 | ), |
| 5158 | mcpServers: Schema.optionalKey( |
| 5159 | Schema.Array(McpServer).annotate({ |
| 5160 | description: "List of MCP servers to connect to for this session.", |
| 5161 | }), |
| 5162 | ), |
| 5163 | replayFrom: Schema.optionalKey( |
| 5164 | Schema.Union([ReplayFrom, Schema.Null]).annotate({ |
| 5165 | description: |
| 5166 | 'Inclusive cursor describing where conversation replay should begin.\n\nOptional. Omitted or `null` both mean the Agent should resume without\nreplaying previous conversation history. Replay cursors are inclusive:\nreplay includes the position identified by the cursor. Supplying\n`{ "type": "start" }` means the Agent should replay the whole\nconversation before responding.', |
| 5167 | }), |
| 5168 | ), |
| 5169 | _meta: Schema.optionalKey( |
| 5170 | Schema.Union([ |
| 5171 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5172 | description: |
| 5173 | "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/v2/draft/extensibility)", |
| 5174 | }), |
| 5175 | Schema.Null, |
| 5176 | ]), |
| 5177 | ), |
| 5178 | }).annotate({ |
| 5179 | description: |
| 5180 | "Request parameters for resuming an existing session.\n\nResumes an existing session and optionally replays prior conversation\nhistory according to `replayFrom`.", |
| 5181 | identifier: "ResumeSessionRequest", |
| 5182 | }); |
| 5183 | |
| 5184 | export type NesEventCapabilities = { |
| 5185 | readonly document?: NesDocumentEventCapabilities | null; |
| 5186 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5187 | }; |
| 5188 | export const NesEventCapabilities = Schema.Struct({ |
| 5189 | document: Schema.optionalKey( |
| 5190 | Schema.Union([NesDocumentEventCapabilities, Schema.Null]).annotate({ |
| 5191 | description: "Document event capabilities.", |
| 5192 | }), |
| 5193 | ), |
| 5194 | _meta: Schema.optionalKey( |
| 5195 | Schema.Union([ |
| 5196 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5197 | description: |
| 5198 | "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/v2/draft/extensibility)", |
| 5199 | }), |
| 5200 | Schema.Null, |
| 5201 | ]), |
| 5202 | ), |
| 5203 | }).annotate({ |
| 5204 | description: "Event capabilities the agent can consume.", |
| 5205 | identifier: "NesEventCapabilities", |
| 5206 | }); |
| 5207 | |
| 5208 | export type ContentBlock = |
| 5209 | | { |
| 5210 | readonly type: "text"; |
| 5211 | readonly text: string; |
| 5212 | readonly annotations?: Annotations | null; |
| 5213 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5214 | } |
| 5215 | | { |
| 5216 | readonly type: "image"; |
| 5217 | readonly data: string; |
| 5218 | readonly mimeType: MediaType; |
| 5219 | readonly uri?: string | null; |
| 5220 | readonly annotations?: Annotations | null; |
| 5221 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5222 | } |
| 5223 | | { |
| 5224 | readonly type: "audio"; |
| 5225 | readonly data: string; |
| 5226 | readonly mimeType: MediaType; |
| 5227 | readonly annotations?: Annotations | null; |
| 5228 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5229 | } |
| 5230 | | { |
| 5231 | readonly type: "resource_link"; |
| 5232 | readonly name: string; |
| 5233 | readonly uri: string; |
| 5234 | readonly title?: string | null; |
| 5235 | readonly description?: string | null; |
| 5236 | readonly icons?: ReadonlyArray<Icon> | null; |
| 5237 | readonly mimeType?: MediaType | null; |
| 5238 | readonly size?: number | null; |
| 5239 | readonly annotations?: Annotations | null; |
| 5240 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5241 | } |
| 5242 | | { |
| 5243 | readonly type: "resource"; |
| 5244 | readonly resource: EmbeddedResourceResource; |
| 5245 | readonly annotations?: Annotations | null; |
| 5246 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5247 | } |
| 5248 | | ({ readonly type: string } & { readonly [x: string]: Schema.Json }); |
| 5249 | export const ContentBlock = Schema.Union([ |
| 5250 | Schema.Struct({ |
| 5251 | type: Schema.Literal("text"), |
| 5252 | text: Schema.String.annotate({ description: "Text payload carried by this content block." }), |
| 5253 | annotations: Schema.optionalKey( |
| 5254 | Schema.Union([Annotations, Schema.Null]).annotate({ |
| 5255 | description: |
| 5256 | "Optional annotations that help clients decide how to display or route this content.", |
| 5257 | }), |
| 5258 | ), |
| 5259 | _meta: Schema.optionalKey( |
| 5260 | Schema.Union([ |
| 5261 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5262 | description: |
| 5263 | "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/v2/draft/extensibility)", |
| 5264 | }), |
| 5265 | Schema.Null, |
| 5266 | ]), |
| 5267 | ), |
| 5268 | }).annotate({ description: "Text provided to or from an LLM." }), |
| 5269 | Schema.Struct({ |
| 5270 | type: Schema.Literal("image"), |
| 5271 | data: Schema.String.annotate({ |
| 5272 | description: "Base64-encoded media payload.", |
| 5273 | contentEncoding: "base64", |
| 5274 | }), |
| 5275 | mimeType: Schema.suspend((): Schema.Codec<MediaType> => MediaType).annotate({ |
| 5276 | description: "MIME type describing the encoded media payload.", |
| 5277 | }), |
| 5278 | uri: Schema.optionalKey( |
| 5279 | Schema.Union([ |
| 5280 | Schema.String.annotate({ |
| 5281 | description: "URI associated with this resource or media payload.", |
| 5282 | format: "uri", |
| 5283 | }), |
| 5284 | Schema.Null, |
| 5285 | ]), |
| 5286 | ), |
| 5287 | annotations: Schema.optionalKey( |
| 5288 | Schema.Union([Annotations, Schema.Null]).annotate({ |
| 5289 | description: |
| 5290 | "Optional annotations that help clients decide how to display or route this content.", |
| 5291 | }), |
| 5292 | ), |
| 5293 | _meta: Schema.optionalKey( |
| 5294 | Schema.Union([ |
| 5295 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5296 | description: |
| 5297 | "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/v2/draft/extensibility)", |
| 5298 | }), |
| 5299 | Schema.Null, |
| 5300 | ]), |
| 5301 | ), |
| 5302 | }).annotate({ description: "An image provided to or from an LLM." }), |
| 5303 | Schema.Struct({ |
| 5304 | type: Schema.Literal("audio"), |
| 5305 | data: Schema.String.annotate({ |
| 5306 | description: "Base64-encoded media payload.", |
| 5307 | contentEncoding: "base64", |
| 5308 | }), |
| 5309 | mimeType: Schema.suspend((): Schema.Codec<MediaType> => MediaType).annotate({ |
| 5310 | description: "MIME type describing the encoded media payload.", |
| 5311 | }), |
| 5312 | annotations: Schema.optionalKey( |
| 5313 | Schema.Union([Annotations, Schema.Null]).annotate({ |
| 5314 | description: |
| 5315 | "Optional annotations that help clients decide how to display or route this content.", |
| 5316 | }), |
| 5317 | ), |
| 5318 | _meta: Schema.optionalKey( |
| 5319 | Schema.Union([ |
| 5320 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5321 | description: |
| 5322 | "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/v2/draft/extensibility)", |
| 5323 | }), |
| 5324 | Schema.Null, |
| 5325 | ]), |
| 5326 | ), |
| 5327 | }).annotate({ description: "Audio provided to or from an LLM." }), |
| 5328 | Schema.Struct({ |
| 5329 | type: Schema.Literal("resource_link"), |
| 5330 | name: Schema.String.annotate({ |
| 5331 | description: "Human-readable name shown for this protocol object.", |
| 5332 | }), |
| 5333 | uri: Schema.String.annotate({ |
| 5334 | description: "URI associated with this resource or media payload.", |
| 5335 | format: "uri", |
| 5336 | }), |
| 5337 | title: Schema.optionalKey( |
| 5338 | Schema.Union([ |
| 5339 | Schema.String.annotate({ description: "Optional display title for end-user UI." }), |
| 5340 | Schema.Null, |
| 5341 | ]), |
| 5342 | ), |
| 5343 | description: Schema.optionalKey( |
| 5344 | Schema.Union([ |
| 5345 | Schema.String.annotate({ |
| 5346 | description: "Optional human-readable details shown with this protocol object.", |
| 5347 | }), |
| 5348 | Schema.Null, |
| 5349 | ]), |
| 5350 | ), |
| 5351 | icons: Schema.optionalKey( |
| 5352 | Schema.Union([ |
| 5353 | Schema.Array(Icon).annotate({ |
| 5354 | description: |
| 5355 | "Optional set of sized icons that the client can display in a user interface.", |
| 5356 | }), |
| 5357 | Schema.Null, |
| 5358 | ]), |
| 5359 | ), |
| 5360 | mimeType: Schema.optionalKey( |
| 5361 | Schema.Union([MediaType, Schema.Null]).annotate({ |
| 5362 | description: "MIME type describing the encoded media payload.", |
| 5363 | }), |
| 5364 | ), |
| 5365 | size: Schema.optionalKey( |
| 5366 | Schema.Union([ |
| 5367 | Schema.Number.annotate({ |
| 5368 | description: "Optional size of the linked resource in bytes, if known.", |
| 5369 | format: "int64", |
| 5370 | }).check(Schema.isInt().annotate({ expected: "an integer" })), |
| 5371 | Schema.Null, |
| 5372 | ]), |
| 5373 | ), |
| 5374 | annotations: Schema.optionalKey( |
| 5375 | Schema.Union([Annotations, Schema.Null]).annotate({ |
| 5376 | description: |
| 5377 | "Optional annotations that help clients decide how to display or route this content.", |
| 5378 | }), |
| 5379 | ), |
| 5380 | _meta: Schema.optionalKey( |
| 5381 | Schema.Union([ |
| 5382 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5383 | description: |
| 5384 | "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/v2/draft/extensibility)", |
| 5385 | }), |
| 5386 | Schema.Null, |
| 5387 | ]), |
| 5388 | ), |
| 5389 | }).annotate({ |
| 5390 | description: |
| 5391 | "A resource that the server is capable of reading, included in a prompt or tool call result.", |
| 5392 | }), |
| 5393 | Schema.Struct({ |
| 5394 | type: Schema.Literal("resource"), |
| 5395 | resource: Schema.suspend( |
| 5396 | (): Schema.Codec<EmbeddedResourceResource> => EmbeddedResourceResource, |
| 5397 | ).annotate({ description: "Embedded resource payload, either text or binary data." }), |
| 5398 | annotations: Schema.optionalKey( |
| 5399 | Schema.Union([Annotations, Schema.Null]).annotate({ |
| 5400 | description: |
| 5401 | "Optional annotations that help clients decide how to display or route this content.", |
| 5402 | }), |
| 5403 | ), |
| 5404 | _meta: Schema.optionalKey( |
| 5405 | Schema.Union([ |
| 5406 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5407 | description: |
| 5408 | "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/v2/draft/extensibility)", |
| 5409 | }), |
| 5410 | Schema.Null, |
| 5411 | ]), |
| 5412 | ), |
| 5413 | }).annotate({ |
| 5414 | description: "The contents of a resource, embedded into a prompt or tool call result.", |
| 5415 | }), |
| 5416 | Schema.StructWithRest( |
| 5417 | Schema.Struct({ |
| 5418 | type: Schema.String.annotate({ |
| 5419 | description: |
| 5420 | "Custom or future content block type.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 5421 | }).check( |
| 5422 | Schema.isPattern( |
| 5423 | new RegExp( |
| 5424 | "^(?!(?:\\x74ext|\\x69mage|\\x61udio|\\x72esource_link|\\x72esource)$)[\\s\\S]*$", |
| 5425 | ), |
| 5426 | ).annotate({ |
| 5427 | expected: |
| 5428 | "a string matching the RegExp ^(?!(?:\\x74ext|\\x69mage|\\x61udio|\\x72esource_link|\\x72esource)$)[\\s\\S]*$", |
| 5429 | }), |
| 5430 | ), |
| 5431 | }), |
| 5432 | [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], |
| 5433 | ).annotate({ |
| 5434 | title: "other", |
| 5435 | description: |
| 5436 | "Custom or future content block.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.\n\nReceivers that do not understand this content block type should preserve\nthe raw payload when storing, replaying, proxying, or forwarding content,\nand otherwise ignore it or display it generically.", |
| 5437 | }), |
| 5438 | ]).annotate({ |
| 5439 | description: |
| 5440 | "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 reported through `session/update` notifications as\n message updates or streamed chunks\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/v2/draft/content)", |
| 5441 | identifier: "ContentBlock", |
| 5442 | }); |
| 5443 | |
| 5444 | export type SessionConfigSelectOptions = |
| 5445 | | ReadonlyArray<SessionConfigSelectOption> |
| 5446 | | ReadonlyArray<SessionConfigSelectGroup>; |
| 5447 | export const SessionConfigSelectOptions = Schema.Union([ |
| 5448 | Schema.Array(SessionConfigSelectOption).annotate({ |
| 5449 | title: "Ungrouped", |
| 5450 | description: "A flat list of options with no grouping.", |
| 5451 | }), |
| 5452 | Schema.Array(SessionConfigSelectGroup).annotate({ |
| 5453 | title: "Grouped", |
| 5454 | description: "A list of options grouped under headers.", |
| 5455 | }), |
| 5456 | ]).annotate({ |
| 5457 | description: "Possible values for a session configuration option.", |
| 5458 | identifier: "SessionConfigSelectOptions", |
| 5459 | }); |
| 5460 | |
| 5461 | export type ElicitationSchema = { |
| 5462 | readonly type?: ElicitationSchemaType; |
| 5463 | readonly title?: string | null; |
| 5464 | readonly properties?: { readonly [x: string]: ElicitationPropertySchema }; |
| 5465 | readonly required?: ReadonlyArray<string> | null; |
| 5466 | readonly description?: string | null; |
| 5467 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5468 | }; |
| 5469 | export const ElicitationSchema = Schema.Struct({ |
| 5470 | type: Schema.optionalKey( |
| 5471 | Schema.suspend((): Schema.Codec<ElicitationSchemaType> => ElicitationSchemaType).annotate({ |
| 5472 | description: 'Type discriminator. Always `"object"`.', |
| 5473 | default: "object", |
| 5474 | }), |
| 5475 | ), |
| 5476 | title: Schema.optionalKey( |
| 5477 | Schema.Union([ |
| 5478 | Schema.String.annotate({ |
| 5479 | description: |
| 5480 | "Optional title for the schema.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.", |
| 5481 | }), |
| 5482 | Schema.Null, |
| 5483 | ]), |
| 5484 | ), |
| 5485 | properties: Schema.optionalKey( |
| 5486 | Schema.Record(Schema.String, ElicitationPropertySchema).annotate({ |
| 5487 | description: "Property definitions (must be primitive types).", |
| 5488 | default: {}, |
| 5489 | }), |
| 5490 | ), |
| 5491 | required: Schema.optionalKey( |
| 5492 | Schema.Union([ |
| 5493 | Schema.Array(Schema.String).annotate({ |
| 5494 | description: |
| 5495 | "List of required property names.\n\nOptional. Omitted and `null` are equivalent and mean no property names are required.", |
| 5496 | }), |
| 5497 | Schema.Null, |
| 5498 | ]), |
| 5499 | ), |
| 5500 | description: Schema.optionalKey( |
| 5501 | Schema.Union([ |
| 5502 | Schema.String.annotate({ |
| 5503 | description: |
| 5504 | "Optional description of what this schema represents.\n\nOptional. Omitted and `null` are equivalent and mean no schema description is provided.", |
| 5505 | }), |
| 5506 | Schema.Null, |
| 5507 | ]), |
| 5508 | ), |
| 5509 | _meta: Schema.optionalKey( |
| 5510 | Schema.Union([ |
| 5511 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5512 | description: |
| 5513 | "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/v2/draft/extensibility)", |
| 5514 | }), |
| 5515 | Schema.Null, |
| 5516 | ]), |
| 5517 | ), |
| 5518 | }).annotate({ |
| 5519 | description: |
| 5520 | "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.", |
| 5521 | identifier: "ElicitationSchema", |
| 5522 | }); |
| 5523 | |
| 5524 | export type ListProvidersResponse = { |
| 5525 | readonly providers: ReadonlyArray<ProviderInfo>; |
| 5526 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5527 | }; |
| 5528 | export const ListProvidersResponse = Schema.Struct({ |
| 5529 | providers: Schema.Array(ProviderInfo).annotate({ |
| 5530 | description: "Configurable providers with current routing info suitable for UI display.", |
| 5531 | }), |
| 5532 | _meta: Schema.optionalKey( |
| 5533 | Schema.Union([ |
| 5534 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5535 | description: |
| 5536 | "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/v2/draft/extensibility)", |
| 5537 | }), |
| 5538 | Schema.Null, |
| 5539 | ]), |
| 5540 | ), |
| 5541 | }).annotate({ |
| 5542 | description: |
| 5543 | "**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`.", |
| 5544 | identifier: "ListProvidersResponse", |
| 5545 | }); |
| 5546 | |
| 5547 | export type NesSuggestion = |
| 5548 | | { |
| 5549 | readonly kind: "edit"; |
| 5550 | readonly suggestionId: NesSuggestionId; |
| 5551 | readonly uri: string; |
| 5552 | readonly edits: ReadonlyArray<NesTextEdit>; |
| 5553 | readonly cursorPosition?: Position | null; |
| 5554 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5555 | } |
| 5556 | | { |
| 5557 | readonly kind: "jump"; |
| 5558 | readonly suggestionId: NesSuggestionId; |
| 5559 | readonly uri: string; |
| 5560 | readonly position: Position; |
| 5561 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5562 | } |
| 5563 | | { |
| 5564 | readonly kind: "rename"; |
| 5565 | readonly suggestionId: NesSuggestionId; |
| 5566 | readonly uri: string; |
| 5567 | readonly position: Position; |
| 5568 | readonly newName: string; |
| 5569 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5570 | } |
| 5571 | | { |
| 5572 | readonly kind: "searchAndReplace"; |
| 5573 | readonly suggestionId: NesSuggestionId; |
| 5574 | readonly uri: string; |
| 5575 | readonly search: string; |
| 5576 | readonly replace: string; |
| 5577 | readonly isRegex?: boolean | null; |
| 5578 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5579 | } |
| 5580 | | ({ readonly kind: string; readonly suggestionId: NesSuggestionId } & { |
| 5581 | readonly [x: string]: Schema.Json; |
| 5582 | }); |
| 5583 | export const NesSuggestion = Schema.Union([ |
| 5584 | Schema.Struct({ |
| 5585 | kind: Schema.Literal("edit"), |
| 5586 | suggestionId: Schema.suspend((): Schema.Codec<NesSuggestionId> => NesSuggestionId).annotate({ |
| 5587 | description: "Unique identifier for accept/reject tracking.", |
| 5588 | }), |
| 5589 | uri: Schema.String.annotate({ description: "The URI of the file to edit.", format: "uri" }), |
| 5590 | edits: Schema.Array(NesTextEdit) |
| 5591 | .annotate({ description: "The text edits to apply. Must contain at least one edit." }) |
| 5592 | .check(Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" })), |
| 5593 | cursorPosition: Schema.optionalKey( |
| 5594 | Schema.Union([Position, Schema.Null]).annotate({ |
| 5595 | description: "Optional suggested cursor position after applying edits.", |
| 5596 | }), |
| 5597 | ), |
| 5598 | _meta: Schema.optionalKey( |
| 5599 | Schema.Union([ |
| 5600 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5601 | description: |
| 5602 | "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/v2/draft/extensibility)", |
| 5603 | }), |
| 5604 | Schema.Null, |
| 5605 | ]), |
| 5606 | ), |
| 5607 | }).annotate({ description: "A text edit suggestion." }), |
| 5608 | Schema.Struct({ |
| 5609 | kind: Schema.Literal("jump"), |
| 5610 | suggestionId: Schema.suspend((): Schema.Codec<NesSuggestionId> => NesSuggestionId).annotate({ |
| 5611 | description: "Unique identifier for accept/reject tracking.", |
| 5612 | }), |
| 5613 | uri: Schema.String.annotate({ description: "The file to navigate to.", format: "uri" }), |
| 5614 | position: Schema.suspend((): Schema.Codec<Position> => Position).annotate({ |
| 5615 | description: "The target position within the file.", |
| 5616 | }), |
| 5617 | _meta: Schema.optionalKey( |
| 5618 | Schema.Union([ |
| 5619 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5620 | description: |
| 5621 | "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/v2/draft/extensibility)", |
| 5622 | }), |
| 5623 | Schema.Null, |
| 5624 | ]), |
| 5625 | ), |
| 5626 | }).annotate({ description: "A jump-to-location suggestion." }), |
| 5627 | Schema.Struct({ |
| 5628 | kind: Schema.Literal("rename"), |
| 5629 | suggestionId: Schema.suspend((): Schema.Codec<NesSuggestionId> => NesSuggestionId).annotate({ |
| 5630 | description: "Unique identifier for accept/reject tracking.", |
| 5631 | }), |
| 5632 | uri: Schema.String.annotate({ |
| 5633 | description: "The file URI containing the symbol.", |
| 5634 | format: "uri", |
| 5635 | }), |
| 5636 | position: Schema.suspend((): Schema.Codec<Position> => Position).annotate({ |
| 5637 | description: "The position of the symbol to rename.", |
| 5638 | }), |
| 5639 | newName: Schema.String.annotate({ description: "The new name for the symbol." }), |
| 5640 | _meta: Schema.optionalKey( |
| 5641 | Schema.Union([ |
| 5642 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5643 | description: |
| 5644 | "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/v2/draft/extensibility)", |
| 5645 | }), |
| 5646 | Schema.Null, |
| 5647 | ]), |
| 5648 | ), |
| 5649 | }).annotate({ description: "A rename symbol suggestion." }), |
| 5650 | Schema.Struct({ |
| 5651 | kind: Schema.Literal("searchAndReplace"), |
| 5652 | suggestionId: Schema.suspend((): Schema.Codec<NesSuggestionId> => NesSuggestionId).annotate({ |
| 5653 | description: "Unique identifier for accept/reject tracking.", |
| 5654 | }), |
| 5655 | uri: Schema.String.annotate({ description: "The file URI to search within.", format: "uri" }), |
| 5656 | search: Schema.String.annotate({ description: "The text or pattern to find." }), |
| 5657 | replace: Schema.String.annotate({ description: "The replacement text." }), |
| 5658 | isRegex: Schema.optionalKey( |
| 5659 | Schema.Union([ |
| 5660 | Schema.Boolean.annotate({ |
| 5661 | description: "Whether `search` is a regular expression. Defaults to `false`.", |
| 5662 | }), |
| 5663 | Schema.Null, |
| 5664 | ]), |
| 5665 | ), |
| 5666 | _meta: Schema.optionalKey( |
| 5667 | Schema.Union([ |
| 5668 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5669 | description: |
| 5670 | "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/v2/draft/extensibility)", |
| 5671 | }), |
| 5672 | Schema.Null, |
| 5673 | ]), |
| 5674 | ), |
| 5675 | }).annotate({ description: "A search-and-replace suggestion." }), |
| 5676 | Schema.StructWithRest( |
| 5677 | Schema.Struct({ |
| 5678 | kind: Schema.String.annotate({ |
| 5679 | description: |
| 5680 | "Custom or future NES suggestion kind.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 5681 | }).check( |
| 5682 | Schema.isPattern( |
| 5683 | new RegExp("^(?!(?:\\x65dit|\\x6aump|\\x72ename|\\x73earchAndReplace)$)[\\s\\S]*$"), |
| 5684 | ).annotate({ |
| 5685 | expected: |
| 5686 | "a string matching the RegExp ^(?!(?:\\x65dit|\\x6aump|\\x72ename|\\x73earchAndReplace)$)[\\s\\S]*$", |
| 5687 | }), |
| 5688 | ), |
| 5689 | suggestionId: Schema.suspend((): Schema.Codec<NesSuggestionId> => NesSuggestionId).annotate({ |
| 5690 | description: "Unique identifier for accept/reject tracking.", |
| 5691 | }), |
| 5692 | }), |
| 5693 | [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], |
| 5694 | ).annotate({ |
| 5695 | title: "other", |
| 5696 | description: |
| 5697 | "Custom or future NES suggestion.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.\n\nReceivers that do not understand this suggestion kind should preserve\nthe raw payload when storing, replaying, proxying, or forwarding\nsuggestions, and otherwise ignore it or display it generically.", |
| 5698 | }), |
| 5699 | ]).annotate({ description: "A suggestion returned by the agent.", identifier: "NesSuggestion" }); |
| 5700 | |
| 5701 | export type DidChangeDocumentNotification = { |
| 5702 | readonly sessionId: SessionId; |
| 5703 | readonly uri: string; |
| 5704 | readonly version: number; |
| 5705 | readonly contentChanges: ReadonlyArray<TextDocumentContentChangeEvent>; |
| 5706 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5707 | }; |
| 5708 | export const DidChangeDocumentNotification = Schema.Struct({ |
| 5709 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 5710 | description: "The session ID for this notification.", |
| 5711 | }), |
| 5712 | uri: Schema.String.annotate({ description: "The URI of the changed document.", format: "uri" }), |
| 5713 | version: Schema.Number.annotate({ |
| 5714 | description: "The new version number of the document.", |
| 5715 | format: "int64", |
| 5716 | }).check(Schema.isInt().annotate({ expected: "an integer" })), |
| 5717 | contentChanges: Schema.Array(TextDocumentContentChangeEvent).annotate({ |
| 5718 | description: "The content changes.", |
| 5719 | }), |
| 5720 | _meta: Schema.optionalKey( |
| 5721 | Schema.Union([ |
| 5722 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5723 | description: |
| 5724 | "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/v2/draft/extensibility)", |
| 5725 | }), |
| 5726 | Schema.Null, |
| 5727 | ]), |
| 5728 | ), |
| 5729 | }).annotate({ |
| 5730 | description: "Notification sent when a file is edited.", |
| 5731 | identifier: "DidChangeDocumentNotification", |
| 5732 | }); |
| 5733 | |
| 5734 | export type NesSuggestContext = { |
| 5735 | readonly recentFiles?: ReadonlyArray<NesRecentFile> | null; |
| 5736 | readonly relatedSnippets?: ReadonlyArray<NesRelatedSnippet> | null; |
| 5737 | readonly editHistory?: ReadonlyArray<NesEditHistoryEntry> | null; |
| 5738 | readonly userActions?: ReadonlyArray<NesUserAction> | null; |
| 5739 | readonly openFiles?: ReadonlyArray<NesOpenFile> | null; |
| 5740 | readonly diagnostics?: ReadonlyArray<NesDiagnostic> | null; |
| 5741 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5742 | }; |
| 5743 | export const NesSuggestContext = Schema.Struct({ |
| 5744 | recentFiles: Schema.optionalKey( |
| 5745 | Schema.Union([ |
| 5746 | Schema.Array(NesRecentFile).annotate({ description: "Recently accessed files." }), |
| 5747 | Schema.Null, |
| 5748 | ]), |
| 5749 | ), |
| 5750 | relatedSnippets: Schema.optionalKey( |
| 5751 | Schema.Union([ |
| 5752 | Schema.Array(NesRelatedSnippet).annotate({ description: "Related code snippets." }), |
| 5753 | Schema.Null, |
| 5754 | ]), |
| 5755 | ), |
| 5756 | editHistory: Schema.optionalKey( |
| 5757 | Schema.Union([ |
| 5758 | Schema.Array(NesEditHistoryEntry).annotate({ description: "Recent edit history." }), |
| 5759 | Schema.Null, |
| 5760 | ]), |
| 5761 | ), |
| 5762 | userActions: Schema.optionalKey( |
| 5763 | Schema.Union([ |
| 5764 | Schema.Array(NesUserAction).annotate({ |
| 5765 | description: "Recent user actions (typing, navigation, etc.).", |
| 5766 | }), |
| 5767 | Schema.Null, |
| 5768 | ]), |
| 5769 | ), |
| 5770 | openFiles: Schema.optionalKey( |
| 5771 | Schema.Union([ |
| 5772 | Schema.Array(NesOpenFile).annotate({ description: "Currently open files in the editor." }), |
| 5773 | Schema.Null, |
| 5774 | ]), |
| 5775 | ), |
| 5776 | diagnostics: Schema.optionalKey( |
| 5777 | Schema.Union([ |
| 5778 | Schema.Array(NesDiagnostic).annotate({ |
| 5779 | description: "Current diagnostics (errors, warnings).", |
| 5780 | }), |
| 5781 | Schema.Null, |
| 5782 | ]), |
| 5783 | ), |
| 5784 | _meta: Schema.optionalKey( |
| 5785 | Schema.Union([ |
| 5786 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5787 | description: |
| 5788 | "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/v2/draft/extensibility)", |
| 5789 | }), |
| 5790 | Schema.Null, |
| 5791 | ]), |
| 5792 | ), |
| 5793 | }).annotate({ |
| 5794 | description: "Context attached to a suggestion request.", |
| 5795 | identifier: "NesSuggestContext", |
| 5796 | }); |
| 5797 | |
| 5798 | export type InitializeRequest = { |
| 5799 | readonly protocolVersion: ProtocolVersion; |
| 5800 | readonly info: Implementation; |
| 5801 | readonly capabilities?: ClientCapabilities; |
| 5802 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5803 | }; |
| 5804 | export const InitializeRequest = Schema.Struct({ |
| 5805 | protocolVersion: Schema.suspend((): Schema.Codec<ProtocolVersion> => ProtocolVersion).annotate({ |
| 5806 | description: "The latest protocol version supported by the client.", |
| 5807 | }), |
| 5808 | info: Schema.suspend((): Schema.Codec<Implementation> => Implementation).annotate({ |
| 5809 | description: "Information about the implementation sending this initialize request.", |
| 5810 | }), |
| 5811 | capabilities: Schema.optionalKey( |
| 5812 | Schema.suspend((): Schema.Codec<ClientCapabilities> => ClientCapabilities).annotate({ |
| 5813 | description: "Capabilities supported by the client.", |
| 5814 | default: {}, |
| 5815 | }), |
| 5816 | ), |
| 5817 | _meta: Schema.optionalKey( |
| 5818 | Schema.Union([ |
| 5819 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5820 | description: |
| 5821 | "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/v2/draft/extensibility)", |
| 5822 | }), |
| 5823 | Schema.Null, |
| 5824 | ]), |
| 5825 | ), |
| 5826 | }).annotate({ |
| 5827 | description: |
| 5828 | "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/v2/draft/initialization)", |
| 5829 | identifier: "InitializeRequest", |
| 5830 | }); |
| 5831 | |
| 5832 | export type NesCapabilities = { |
| 5833 | readonly events?: NesEventCapabilities | null; |
| 5834 | readonly context?: NesContextCapabilities | null; |
| 5835 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5836 | }; |
| 5837 | export const NesCapabilities = Schema.Struct({ |
| 5838 | events: Schema.optionalKey( |
| 5839 | Schema.Union([NesEventCapabilities, Schema.Null]).annotate({ |
| 5840 | description: "Events the agent wants to receive.", |
| 5841 | }), |
| 5842 | ), |
| 5843 | context: Schema.optionalKey( |
| 5844 | Schema.Union([NesContextCapabilities, Schema.Null]).annotate({ |
| 5845 | description: "Context the agent wants attached to each suggestion request.", |
| 5846 | }), |
| 5847 | ), |
| 5848 | _meta: Schema.optionalKey( |
| 5849 | Schema.Union([ |
| 5850 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5851 | description: |
| 5852 | "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/v2/draft/extensibility)", |
| 5853 | }), |
| 5854 | Schema.Null, |
| 5855 | ]), |
| 5856 | ), |
| 5857 | }).annotate({ |
| 5858 | description: |
| 5859 | "NES capabilities advertised by the agent during initialization.\n\nSupplying `{}` means the agent supports the NES method surface. Omitted or\n`null` both mean the agent does not advertise support for `nes/*` methods.", |
| 5860 | identifier: "NesCapabilities", |
| 5861 | }); |
| 5862 | |
| 5863 | export type ToolCallContent = |
| 5864 | | { |
| 5865 | readonly type: "content"; |
| 5866 | readonly content: ContentBlock; |
| 5867 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5868 | } |
| 5869 | | { |
| 5870 | readonly type: "diff"; |
| 5871 | readonly changes: ReadonlyArray<DiffChange>; |
| 5872 | readonly patch?: DiffPatch | null; |
| 5873 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5874 | } |
| 5875 | | { |
| 5876 | readonly type: "terminal"; |
| 5877 | readonly terminalId: TerminalId; |
| 5878 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5879 | } |
| 5880 | | ({ readonly type: string } & { readonly [x: string]: Schema.Json }); |
| 5881 | export const ToolCallContent = Schema.Union([ |
| 5882 | Schema.Struct({ |
| 5883 | type: Schema.Literal("content"), |
| 5884 | content: Schema.suspend((): Schema.Codec<ContentBlock> => ContentBlock).annotate({ |
| 5885 | description: "The actual content block.", |
| 5886 | }), |
| 5887 | _meta: Schema.optionalKey( |
| 5888 | Schema.Union([ |
| 5889 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5890 | description: |
| 5891 | "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/v2/draft/extensibility)", |
| 5892 | }), |
| 5893 | Schema.Null, |
| 5894 | ]), |
| 5895 | ), |
| 5896 | }).annotate({ description: "Standard content block (text, images, resources)." }), |
| 5897 | Schema.Struct({ |
| 5898 | type: Schema.Literal("diff"), |
| 5899 | changes: Schema.Array(DiffChange).annotate({ |
| 5900 | description: |
| 5901 | "Structured file changes described by this diff.\n\nClients can use this field without parsing patch text to determine affected paths.", |
| 5902 | }), |
| 5903 | patch: Schema.optionalKey( |
| 5904 | Schema.Union([DiffPatch, Schema.Null]).annotate({ |
| 5905 | description: |
| 5906 | "Renderable patch text for some or all of the structured changes.\n\nAgents SHOULD provide patch text whenever feasible. Omitted or `null`\nmeans no renderable patch text was provided.", |
| 5907 | }), |
| 5908 | ), |
| 5909 | _meta: Schema.optionalKey( |
| 5910 | Schema.Union([ |
| 5911 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5912 | description: |
| 5913 | "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/v2/draft/extensibility)", |
| 5914 | }), |
| 5915 | Schema.Null, |
| 5916 | ]), |
| 5917 | ), |
| 5918 | }).annotate({ |
| 5919 | description: |
| 5920 | "File changes produced by a tool call.\n\n`changes` is authoritative for affected absolute paths and operations.\n`patch` optionally carries renderable text for some or all of those changes\nand MUST be consistent with `changes`. Agents SHOULD provide `patch` whenever\nfeasible. Clients MUST handle diffs where `patch` is omitted or `null`.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/v2/draft/tool-calls#content)", |
| 5921 | }), |
| 5922 | Schema.Struct({ |
| 5923 | type: Schema.Literal("terminal"), |
| 5924 | terminalId: Schema.suspend((): Schema.Codec<TerminalId> => TerminalId).annotate({ |
| 5925 | description: "The ID of the terminal to display.", |
| 5926 | }), |
| 5927 | _meta: Schema.optionalKey( |
| 5928 | Schema.Union([ |
| 5929 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5930 | description: |
| 5931 | "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. This metadata is scoped to the content reference. Omitted\nand `null` are equivalent and mean no item metadata was provided.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 5932 | }), |
| 5933 | Schema.Null, |
| 5934 | ]), |
| 5935 | ), |
| 5936 | }).annotate({ |
| 5937 | description: |
| 5938 | "A display-only reference to an agent-owned terminal.\n\nTerminal state and output are delivered separately through\n[`TerminalUpdate`] and [`TerminalOutputChunk`].", |
| 5939 | }), |
| 5940 | Schema.StructWithRest( |
| 5941 | Schema.Struct({ |
| 5942 | type: Schema.String.annotate({ |
| 5943 | description: |
| 5944 | "Custom or future tool call content type.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 5945 | }).check( |
| 5946 | Schema.isPattern( |
| 5947 | new RegExp("^(?!(?:\\x63ontent|\\x64iff|\\x74erminal)$)[\\s\\S]*$"), |
| 5948 | ).annotate({ |
| 5949 | expected: |
| 5950 | "a string matching the RegExp ^(?!(?:\\x63ontent|\\x64iff|\\x74erminal)$)[\\s\\S]*$", |
| 5951 | }), |
| 5952 | ), |
| 5953 | }), |
| 5954 | [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], |
| 5955 | ).annotate({ |
| 5956 | title: "other", |
| 5957 | description: |
| 5958 | "Custom or future tool call content.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.\n\nReceivers that do not understand this content type should preserve the\nraw payload when storing, replaying, proxying, or forwarding tool call\noutput, and otherwise ignore it or display it generically.", |
| 5959 | }), |
| 5960 | ]).annotate({ |
| 5961 | description: |
| 5962 | "Content produced by a tool call.\n\nTool calls can produce different types of content including standard\ncontent blocks (text, images), file diffs, or display-only terminals.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/v2/draft/tool-calls#content)", |
| 5963 | identifier: "ToolCallContent", |
| 5964 | }); |
| 5965 | |
| 5966 | export type PromptRequest = { |
| 5967 | readonly sessionId: SessionId; |
| 5968 | readonly prompt: ReadonlyArray<ContentBlock>; |
| 5969 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 5970 | }; |
| 5971 | export const PromptRequest = Schema.Struct({ |
| 5972 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 5973 | description: "The ID of the session to send this user message to", |
| 5974 | }), |
| 5975 | prompt: Schema.Array(ContentBlock).annotate({ |
| 5976 | description: |
| 5977 | "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.", |
| 5978 | }), |
| 5979 | _meta: Schema.optionalKey( |
| 5980 | Schema.Union([ |
| 5981 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 5982 | description: |
| 5983 | "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/v2/draft/extensibility)", |
| 5984 | }), |
| 5985 | Schema.Null, |
| 5986 | ]), |
| 5987 | ), |
| 5988 | }).annotate({ |
| 5989 | description: |
| 5990 | "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/v2/draft/prompt-lifecycle#1-user-message)", |
| 5991 | identifier: "PromptRequest", |
| 5992 | }); |
| 5993 | |
| 5994 | export type SessionConfigOption = |
| 5995 | | { |
| 5996 | readonly configId: SessionConfigId; |
| 5997 | readonly name: string; |
| 5998 | readonly description?: string | null; |
| 5999 | readonly category?: SessionConfigOptionCategory | null; |
| 6000 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6001 | readonly type: "select"; |
| 6002 | readonly currentValue: SessionConfigValueId; |
| 6003 | readonly options: SessionConfigSelectOptions; |
| 6004 | } |
| 6005 | | { |
| 6006 | readonly configId: SessionConfigId; |
| 6007 | readonly name: string; |
| 6008 | readonly description?: string | null; |
| 6009 | readonly category?: SessionConfigOptionCategory | null; |
| 6010 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6011 | readonly type: "boolean"; |
| 6012 | readonly currentValue: boolean; |
| 6013 | } |
| 6014 | | ({ |
| 6015 | readonly configId: SessionConfigId; |
| 6016 | readonly name: string; |
| 6017 | readonly description?: string | null; |
| 6018 | readonly category?: SessionConfigOptionCategory | null; |
| 6019 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6020 | readonly type: string; |
| 6021 | } & { readonly [x: string]: Schema.Json }); |
| 6022 | export const SessionConfigOption = Schema.Union([ |
| 6023 | Schema.Struct({ |
| 6024 | configId: Schema.suspend((): Schema.Codec<SessionConfigId> => SessionConfigId).annotate({ |
| 6025 | description: "Unique identifier for the configuration option.", |
| 6026 | }), |
| 6027 | name: Schema.String.annotate({ description: "Human-readable label for the option." }), |
| 6028 | description: Schema.optionalKey( |
| 6029 | Schema.Union([ |
| 6030 | Schema.String.annotate({ |
| 6031 | description: "Optional description for the Client to display to the user.", |
| 6032 | }), |
| 6033 | Schema.Null, |
| 6034 | ]), |
| 6035 | ), |
| 6036 | category: Schema.optionalKey( |
| 6037 | Schema.Union([SessionConfigOptionCategory, Schema.Null]).annotate({ |
| 6038 | description: "Optional semantic category for this option (UX only).", |
| 6039 | }), |
| 6040 | ), |
| 6041 | _meta: Schema.optionalKey( |
| 6042 | Schema.Union([ |
| 6043 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 6044 | description: |
| 6045 | "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/v2/draft/extensibility)", |
| 6046 | }), |
| 6047 | Schema.Null, |
| 6048 | ]), |
| 6049 | ), |
| 6050 | type: Schema.Literal("select"), |
| 6051 | currentValue: Schema.suspend( |
| 6052 | (): Schema.Codec<SessionConfigValueId> => SessionConfigValueId, |
| 6053 | ).annotate({ description: "The currently selected value." }), |
| 6054 | options: Schema.suspend( |
| 6055 | (): Schema.Codec<SessionConfigSelectOptions> => SessionConfigSelectOptions, |
| 6056 | ).annotate({ description: "The set of selectable options." }), |
| 6057 | }).annotate({ |
| 6058 | description: "A single-value selector (dropdown) session configuration option payload.", |
| 6059 | }), |
| 6060 | Schema.Struct({ |
| 6061 | configId: Schema.suspend((): Schema.Codec<SessionConfigId> => SessionConfigId).annotate({ |
| 6062 | description: "Unique identifier for the configuration option.", |
| 6063 | }), |
| 6064 | name: Schema.String.annotate({ description: "Human-readable label for the option." }), |
| 6065 | description: Schema.optionalKey( |
| 6066 | Schema.Union([ |
| 6067 | Schema.String.annotate({ |
| 6068 | description: "Optional description for the Client to display to the user.", |
| 6069 | }), |
| 6070 | Schema.Null, |
| 6071 | ]), |
| 6072 | ), |
| 6073 | category: Schema.optionalKey( |
| 6074 | Schema.Union([SessionConfigOptionCategory, Schema.Null]).annotate({ |
| 6075 | description: "Optional semantic category for this option (UX only).", |
| 6076 | }), |
| 6077 | ), |
| 6078 | _meta: Schema.optionalKey( |
| 6079 | Schema.Union([ |
| 6080 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 6081 | description: |
| 6082 | "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/v2/draft/extensibility)", |
| 6083 | }), |
| 6084 | Schema.Null, |
| 6085 | ]), |
| 6086 | ), |
| 6087 | type: Schema.Literal("boolean"), |
| 6088 | currentValue: Schema.Boolean.annotate({ |
| 6089 | description: "The current value of the boolean option.", |
| 6090 | }), |
| 6091 | }).annotate({ description: "A boolean on/off toggle session configuration option payload." }), |
| 6092 | Schema.StructWithRest( |
| 6093 | Schema.Struct({ |
| 6094 | configId: Schema.suspend((): Schema.Codec<SessionConfigId> => SessionConfigId).annotate({ |
| 6095 | description: "Unique identifier for the configuration option.", |
| 6096 | }), |
| 6097 | name: Schema.String.annotate({ description: "Human-readable label for the option." }), |
| 6098 | description: Schema.optionalKey( |
| 6099 | Schema.Union([ |
| 6100 | Schema.String.annotate({ |
| 6101 | description: "Optional description for the Client to display to the user.", |
| 6102 | }), |
| 6103 | Schema.Null, |
| 6104 | ]), |
| 6105 | ), |
| 6106 | category: Schema.optionalKey( |
| 6107 | Schema.Union([SessionConfigOptionCategory, Schema.Null]).annotate({ |
| 6108 | description: "Optional semantic category for this option (UX only).", |
| 6109 | }), |
| 6110 | ), |
| 6111 | _meta: Schema.optionalKey( |
| 6112 | Schema.Union([ |
| 6113 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 6114 | description: |
| 6115 | "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/v2/draft/extensibility)", |
| 6116 | }), |
| 6117 | Schema.Null, |
| 6118 | ]), |
| 6119 | ), |
| 6120 | type: Schema.String.annotate({ |
| 6121 | description: |
| 6122 | "Custom or future session configuration option type.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 6123 | }).check( |
| 6124 | Schema.isPattern(new RegExp("^(?!(?:\\x73elect|\\x62oolean)$)[\\s\\S]*$")).annotate({ |
| 6125 | expected: "a string matching the RegExp ^(?!(?:\\x73elect|\\x62oolean)$)[\\s\\S]*$", |
| 6126 | }), |
| 6127 | ), |
| 6128 | }), |
| 6129 | [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], |
| 6130 | ).annotate({ |
| 6131 | title: "other", |
| 6132 | description: |
| 6133 | "Custom or future session configuration option payload.\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 option type should preserve the raw\npayload when storing, replaying, proxying, or forwarding configuration\ndata, and otherwise ignore the option or display it generically.", |
| 6134 | }), |
| 6135 | ]).annotate({ identifier: "SessionConfigOption" }); |
| 6136 | |
| 6137 | export type CreateElicitationRequest = |
| 6138 | | { |
| 6139 | readonly message: string; |
| 6140 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6141 | readonly mode: "form"; |
| 6142 | readonly requestedSchema: ElicitationSchema; |
| 6143 | readonly sessionId: SessionId; |
| 6144 | readonly toolCallId?: ToolCallId | null; |
| 6145 | } |
| 6146 | | { |
| 6147 | readonly message: string; |
| 6148 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6149 | readonly mode: "form"; |
| 6150 | readonly requestedSchema: ElicitationSchema; |
| 6151 | readonly requestId: RequestId; |
| 6152 | } |
| 6153 | | { |
| 6154 | readonly message: string; |
| 6155 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6156 | readonly mode: "url"; |
| 6157 | readonly elicitationId: ElicitationId; |
| 6158 | readonly url: string; |
| 6159 | readonly sessionId: SessionId; |
| 6160 | readonly toolCallId?: ToolCallId | null; |
| 6161 | } |
| 6162 | | { |
| 6163 | readonly message: string; |
| 6164 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6165 | readonly mode: "url"; |
| 6166 | readonly elicitationId: ElicitationId; |
| 6167 | readonly url: string; |
| 6168 | readonly requestId: RequestId; |
| 6169 | } |
| 6170 | | ({ |
| 6171 | readonly message: string; |
| 6172 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6173 | readonly mode: string; |
| 6174 | readonly sessionId: SessionId; |
| 6175 | readonly toolCallId?: ToolCallId | null; |
| 6176 | } & { readonly [x: string]: Schema.Json }) |
| 6177 | | ({ |
| 6178 | readonly message: string; |
| 6179 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6180 | readonly mode: string; |
| 6181 | readonly requestId: RequestId; |
| 6182 | } & { readonly [x: string]: Schema.Json }); |
| 6183 | export const CreateElicitationRequest = Schema.Union([ |
| 6184 | Schema.Union([ |
| 6185 | Schema.Struct({ |
| 6186 | message: Schema.String.annotate({ |
| 6187 | description: "A human-readable message describing what input is needed.", |
| 6188 | }), |
| 6189 | _meta: Schema.optionalKey( |
| 6190 | Schema.Union([ |
| 6191 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 6192 | description: |
| 6193 | "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/v2/draft/extensibility)", |
| 6194 | }), |
| 6195 | Schema.Null, |
| 6196 | ]), |
| 6197 | ), |
| 6198 | mode: Schema.Literal("form"), |
| 6199 | requestedSchema: Schema.suspend( |
| 6200 | (): Schema.Codec<ElicitationSchema> => ElicitationSchema, |
| 6201 | ).annotate({ |
| 6202 | description: "A JSON Schema describing the form fields to present to the user.", |
| 6203 | }), |
| 6204 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 6205 | description: "The session this elicitation is tied to.", |
| 6206 | }), |
| 6207 | toolCallId: Schema.optionalKey( |
| 6208 | Schema.Union([ToolCallId, Schema.Null]).annotate({ |
| 6209 | description: |
| 6210 | "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.", |
| 6211 | }), |
| 6212 | ), |
| 6213 | }).annotate({ |
| 6214 | description: |
| 6215 | "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.", |
| 6216 | }), |
| 6217 | Schema.Struct({ |
| 6218 | message: Schema.String.annotate({ |
| 6219 | description: "A human-readable message describing what input is needed.", |
| 6220 | }), |
| 6221 | _meta: Schema.optionalKey( |
| 6222 | Schema.Union([ |
| 6223 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 6224 | description: |
| 6225 | "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/v2/draft/extensibility)", |
| 6226 | }), |
| 6227 | Schema.Null, |
| 6228 | ]), |
| 6229 | ), |
| 6230 | mode: Schema.Literal("form"), |
| 6231 | requestedSchema: Schema.suspend( |
| 6232 | (): Schema.Codec<ElicitationSchema> => ElicitationSchema, |
| 6233 | ).annotate({ |
| 6234 | description: "A JSON Schema describing the form fields to present to the user.", |
| 6235 | }), |
| 6236 | requestId: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({ |
| 6237 | description: "The request this elicitation is tied to.", |
| 6238 | }), |
| 6239 | }).annotate({ |
| 6240 | description: |
| 6241 | "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).", |
| 6242 | }), |
| 6243 | ]), |
| 6244 | Schema.Union([ |
| 6245 | Schema.Struct({ |
| 6246 | message: Schema.String.annotate({ |
| 6247 | description: "A human-readable message describing what input is needed.", |
| 6248 | }), |
| 6249 | _meta: Schema.optionalKey( |
| 6250 | Schema.Union([ |
| 6251 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 6252 | description: |
| 6253 | "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/v2/draft/extensibility)", |
| 6254 | }), |
| 6255 | Schema.Null, |
| 6256 | ]), |
| 6257 | ), |
| 6258 | mode: Schema.Literal("url"), |
| 6259 | elicitationId: Schema.suspend((): Schema.Codec<ElicitationId> => ElicitationId).annotate({ |
| 6260 | description: "The unique identifier for this elicitation.", |
| 6261 | }), |
| 6262 | url: Schema.String.annotate({ description: "The URL to direct the user to.", format: "uri" }), |
| 6263 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 6264 | description: "The session this elicitation is tied to.", |
| 6265 | }), |
| 6266 | toolCallId: Schema.optionalKey( |
| 6267 | Schema.Union([ToolCallId, Schema.Null]).annotate({ |
| 6268 | description: |
| 6269 | "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.", |
| 6270 | }), |
| 6271 | ), |
| 6272 | }).annotate({ |
| 6273 | description: |
| 6274 | "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.", |
| 6275 | }), |
| 6276 | Schema.Struct({ |
| 6277 | message: Schema.String.annotate({ |
| 6278 | description: "A human-readable message describing what input is needed.", |
| 6279 | }), |
| 6280 | _meta: Schema.optionalKey( |
| 6281 | Schema.Union([ |
| 6282 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 6283 | description: |
| 6284 | "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/v2/draft/extensibility)", |
| 6285 | }), |
| 6286 | Schema.Null, |
| 6287 | ]), |
| 6288 | ), |
| 6289 | mode: Schema.Literal("url"), |
| 6290 | elicitationId: Schema.suspend((): Schema.Codec<ElicitationId> => ElicitationId).annotate({ |
| 6291 | description: "The unique identifier for this elicitation.", |
| 6292 | }), |
| 6293 | url: Schema.String.annotate({ description: "The URL to direct the user to.", format: "uri" }), |
| 6294 | requestId: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({ |
| 6295 | description: "The request this elicitation is tied to.", |
| 6296 | }), |
| 6297 | }).annotate({ |
| 6298 | description: |
| 6299 | "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).", |
| 6300 | }), |
| 6301 | ]), |
| 6302 | Schema.Union([ |
| 6303 | Schema.StructWithRest( |
| 6304 | Schema.Struct({ |
| 6305 | message: Schema.String.annotate({ |
| 6306 | description: "A human-readable message describing what input is needed.", |
| 6307 | }), |
| 6308 | _meta: Schema.optionalKey( |
| 6309 | Schema.Union([ |
| 6310 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate( |
| 6311 | { |
| 6312 | description: |
| 6313 | "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/v2/draft/extensibility)", |
| 6314 | }, |
| 6315 | ), |
| 6316 | Schema.Null, |
| 6317 | ]), |
| 6318 | ), |
| 6319 | mode: Schema.String.annotate({ |
| 6320 | description: |
| 6321 | "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.", |
| 6322 | }).check( |
| 6323 | Schema.isPattern(new RegExp("^(?!(?:\\x66orm|\\x75rl)$)[\\s\\S]*$")).annotate({ |
| 6324 | expected: "a string matching the RegExp ^(?!(?:\\x66orm|\\x75rl)$)[\\s\\S]*$", |
| 6325 | }), |
| 6326 | ), |
| 6327 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 6328 | description: "The session this elicitation is tied to.", |
| 6329 | }), |
| 6330 | toolCallId: Schema.optionalKey( |
| 6331 | Schema.Union([ToolCallId, Schema.Null]).annotate({ |
| 6332 | description: |
| 6333 | "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.", |
| 6334 | }), |
| 6335 | ), |
| 6336 | }), |
| 6337 | [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], |
| 6338 | ).annotate({ |
| 6339 | title: "other", |
| 6340 | description: |
| 6341 | "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.", |
| 6342 | }), |
| 6343 | Schema.StructWithRest( |
| 6344 | Schema.Struct({ |
| 6345 | message: Schema.String.annotate({ |
| 6346 | description: "A human-readable message describing what input is needed.", |
| 6347 | }), |
| 6348 | _meta: Schema.optionalKey( |
| 6349 | Schema.Union([ |
| 6350 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate( |
| 6351 | { |
| 6352 | description: |
| 6353 | "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/v2/draft/extensibility)", |
| 6354 | }, |
| 6355 | ), |
| 6356 | Schema.Null, |
| 6357 | ]), |
| 6358 | ), |
| 6359 | mode: Schema.String.annotate({ |
| 6360 | description: |
| 6361 | "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.", |
| 6362 | }).check( |
| 6363 | Schema.isPattern(new RegExp("^(?!(?:\\x66orm|\\x75rl)$)[\\s\\S]*$")).annotate({ |
| 6364 | expected: "a string matching the RegExp ^(?!(?:\\x66orm|\\x75rl)$)[\\s\\S]*$", |
| 6365 | }), |
| 6366 | ), |
| 6367 | requestId: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({ |
| 6368 | description: "The request this elicitation is tied to.", |
| 6369 | }), |
| 6370 | }), |
| 6371 | [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], |
| 6372 | ).annotate({ |
| 6373 | title: "other", |
| 6374 | description: |
| 6375 | "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).", |
| 6376 | }), |
| 6377 | ]), |
| 6378 | ]).annotate({ identifier: "CreateElicitationRequest" }); |
| 6379 | |
| 6380 | export type SuggestNesResponse = { |
| 6381 | readonly suggestions: ReadonlyArray<NesSuggestion>; |
| 6382 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6383 | }; |
| 6384 | export const SuggestNesResponse = Schema.Struct({ |
| 6385 | suggestions: Schema.Array(NesSuggestion).annotate({ description: "The list of suggestions." }), |
| 6386 | _meta: Schema.optionalKey( |
| 6387 | Schema.Union([ |
| 6388 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 6389 | description: |
| 6390 | "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/v2/draft/extensibility)", |
| 6391 | }), |
| 6392 | Schema.Null, |
| 6393 | ]), |
| 6394 | ), |
| 6395 | }).annotate({ description: "Response to `nes/suggest`.", identifier: "SuggestNesResponse" }); |
| 6396 | |
| 6397 | export type SuggestNesRequest = { |
| 6398 | readonly sessionId: SessionId; |
| 6399 | readonly uri: string; |
| 6400 | readonly version: number; |
| 6401 | readonly position: Position; |
| 6402 | readonly selection?: Range | null; |
| 6403 | readonly triggerKind: NesTriggerKind; |
| 6404 | readonly context?: NesSuggestContext | null; |
| 6405 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6406 | }; |
| 6407 | export const SuggestNesRequest = Schema.Struct({ |
| 6408 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 6409 | description: "The session ID for this request.", |
| 6410 | }), |
| 6411 | uri: Schema.String.annotate({ |
| 6412 | description: "The URI of the document to suggest for.", |
| 6413 | format: "uri", |
| 6414 | }), |
| 6415 | version: Schema.Number.annotate({ |
| 6416 | description: "The version number of the document.", |
| 6417 | format: "int64", |
| 6418 | }).check(Schema.isInt().annotate({ expected: "an integer" })), |
| 6419 | position: Schema.suspend((): Schema.Codec<Position> => Position).annotate({ |
| 6420 | description: "The current cursor position.", |
| 6421 | }), |
| 6422 | selection: Schema.optionalKey( |
| 6423 | Schema.Union([Range, Schema.Null]).annotate({ |
| 6424 | description: "The current text selection range, if any.", |
| 6425 | }), |
| 6426 | ), |
| 6427 | triggerKind: Schema.suspend((): Schema.Codec<NesTriggerKind> => NesTriggerKind).annotate({ |
| 6428 | description: "What triggered this suggestion request.", |
| 6429 | }), |
| 6430 | context: Schema.optionalKey( |
| 6431 | Schema.Union([NesSuggestContext, Schema.Null]).annotate({ |
| 6432 | description: "Context for the suggestion, included based on agent capabilities.", |
| 6433 | }), |
| 6434 | ), |
| 6435 | _meta: Schema.optionalKey( |
| 6436 | Schema.Union([ |
| 6437 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 6438 | description: |
| 6439 | "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/v2/draft/extensibility)", |
| 6440 | }), |
| 6441 | Schema.Null, |
| 6442 | ]), |
| 6443 | ), |
| 6444 | }).annotate({ description: "Request for a code suggestion.", identifier: "SuggestNesRequest" }); |
| 6445 | |
| 6446 | export type AgentCapabilities = { |
| 6447 | readonly session?: SessionCapabilities | null; |
| 6448 | readonly auth?: AgentAuthCapabilities | null; |
| 6449 | readonly providers?: ProvidersCapabilities | null; |
| 6450 | readonly nes?: NesCapabilities | null; |
| 6451 | readonly positionEncoding?: PositionEncodingKind | null; |
| 6452 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6453 | }; |
| 6454 | export const AgentCapabilities = Schema.Struct({ |
| 6455 | session: Schema.optionalKey( |
| 6456 | Schema.Union([SessionCapabilities, Schema.Null]).annotate({ |
| 6457 | description: |
| 6458 | "Session capabilities supported by the agent.\n\nOptional. Omitted or `null` both mean the agent does not support the\n`session/*` method surface. Supplying `{}` means the agent supports the\nbaseline session methods: `session/new`, `session/prompt`,\n`session/cancel`, and `session/update`.", |
| 6459 | }), |
| 6460 | ), |
| 6461 | auth: Schema.optionalKey( |
| 6462 | Schema.Union([AgentAuthCapabilities, Schema.Null]).annotate({ |
| 6463 | description: |
| 6464 | "Authentication-related extension capabilities supported by the agent.\n\nOptional. Omitted or `null` both mean the agent does not advertise any\nauthentication-related extensions. This field does not advertise support\nfor `auth/login` or `auth/logout`; those methods are advertised by a\nnon-empty `authMethods` list in the `initialize` response.", |
| 6465 | }), |
| 6466 | ), |
| 6467 | providers: Schema.optionalKey( |
| 6468 | Schema.Union([ProvidersCapabilities, Schema.Null]).annotate({ |
| 6469 | description: |
| 6470 | "**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.", |
| 6471 | }), |
| 6472 | ), |
| 6473 | nes: Schema.optionalKey( |
| 6474 | Schema.Union([NesCapabilities, Schema.Null]).annotate({ |
| 6475 | description: |
| 6476 | "**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.", |
| 6477 | }), |
| 6478 | ), |
| 6479 | positionEncoding: Schema.optionalKey( |
| 6480 | Schema.Union([PositionEncodingKind, Schema.Null]).annotate({ |
| 6481 | description: |
| 6482 | "**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.", |
| 6483 | }), |
| 6484 | ), |
| 6485 | _meta: Schema.optionalKey( |
| 6486 | Schema.Union([ |
| 6487 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 6488 | description: |
| 6489 | "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/v2/draft/extensibility)", |
| 6490 | }), |
| 6491 | Schema.Null, |
| 6492 | ]), |
| 6493 | ), |
| 6494 | }).annotate({ |
| 6495 | description: |
| 6496 | "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/v2/draft/initialization#agent-capabilities)", |
| 6497 | identifier: "AgentCapabilities", |
| 6498 | }); |
| 6499 | |
| 6500 | export type ToolCallUpdate = { |
| 6501 | readonly toolCallId: ToolCallId; |
| 6502 | readonly name?: string | null; |
| 6503 | readonly title?: string | null; |
| 6504 | readonly kind?: ToolKind | null; |
| 6505 | readonly status?: ToolCallStatus | null; |
| 6506 | readonly content?: ReadonlyArray<ToolCallContent> | null; |
| 6507 | readonly locations?: ReadonlyArray<ToolCallLocation> | null; |
| 6508 | readonly rawInput?: Schema.Json; |
| 6509 | readonly rawOutput?: Schema.Json; |
| 6510 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6511 | }; |
| 6512 | export const ToolCallUpdate = Schema.Struct({ |
| 6513 | toolCallId: Schema.suspend((): Schema.Codec<ToolCallId> => ToolCallId).annotate({ |
| 6514 | description: "Unique identifier for this tool call within the session.", |
| 6515 | }), |
| 6516 | name: Schema.optionalKey( |
| 6517 | Schema.Union([ |
| 6518 | Schema.String.annotate({ |
| 6519 | description: |
| 6520 | "**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 and has patch semantics. Omission means no\nchange, `null` clears the name, and a string replaces it. For a tool\ncall ID the client has not seen before, omission or `null` means that no\ntool name is available.", |
| 6521 | }), |
| 6522 | Schema.Null, |
| 6523 | ]), |
| 6524 | ), |
| 6525 | title: Schema.optionalKey( |
| 6526 | Schema.Union([ |
| 6527 | Schema.String.annotate({ |
| 6528 | description: "Human-readable title describing what the tool is doing.", |
| 6529 | }), |
| 6530 | Schema.Null, |
| 6531 | ]), |
| 6532 | ), |
| 6533 | kind: Schema.optionalKey( |
| 6534 | Schema.Union([ToolKind, Schema.Null]).annotate({ |
| 6535 | description: |
| 6536 | "The category of tool being invoked.\nHelps clients choose appropriate icons and UI treatment.", |
| 6537 | }), |
| 6538 | ), |
| 6539 | status: Schema.optionalKey( |
| 6540 | Schema.Union([ToolCallStatus, Schema.Null]).annotate({ |
| 6541 | description: "Current execution status of the tool call.", |
| 6542 | }), |
| 6543 | ), |
| 6544 | content: Schema.optionalKey( |
| 6545 | Schema.Union([ |
| 6546 | Schema.Array(ToolCallContent).annotate({ description: "Content produced by the tool call." }), |
| 6547 | Schema.Null, |
| 6548 | ]), |
| 6549 | ), |
| 6550 | locations: Schema.optionalKey( |
| 6551 | Schema.Union([ |
| 6552 | Schema.Array(ToolCallLocation).annotate({ |
| 6553 | description: |
| 6554 | 'File locations affected by this tool call.\nEnables "follow-along" features in clients.', |
| 6555 | }), |
| 6556 | Schema.Null, |
| 6557 | ]), |
| 6558 | ), |
| 6559 | rawInput: Schema.optionalKey( |
| 6560 | Schema.Json.annotate({ |
| 6561 | expected: "JSON value", |
| 6562 | description: "Raw input parameters sent to the tool.", |
| 6563 | }), |
| 6564 | ), |
| 6565 | rawOutput: Schema.optionalKey( |
| 6566 | Schema.Json.annotate({ |
| 6567 | expected: "JSON value", |
| 6568 | description: "Raw output returned by the tool.", |
| 6569 | }), |
| 6570 | ), |
| 6571 | _meta: Schema.optionalKey( |
| 6572 | Schema.Union([ |
| 6573 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 6574 | description: |
| 6575 | "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Omitted means no metadata update; `null` is an\nexplicit clear signal. Implementations MUST NOT make assumptions about values at these keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 6576 | }), |
| 6577 | Schema.Null, |
| 6578 | ]), |
| 6579 | ), |
| 6580 | }).annotate({ |
| 6581 | description: |
| 6582 | "Represents an upsert for 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\nOnly [`ToolCallUpdate::tool_call_id`] is required. Other fields have patch semantics:\nomitted fields leave the existing tool call value unchanged, `null` clears or\nunsets the value, and concrete values replace the previous value. For\ncollection fields, concrete arrays replace the previous collection, and both\n`null` and `[]` clear the collection. When a client receives a tool call ID it\nhas not seen before, omitted fields use client defaults.\n\nSee protocol docs: [Tool Calls](https://agentclientprotocol.com/protocol/v2/draft/tool-calls)", |
| 6583 | identifier: "ToolCallUpdate", |
| 6584 | }); |
| 6585 | |
| 6586 | export type SessionUpdate = |
| 6587 | | { |
| 6588 | readonly sessionUpdate: "user_message_chunk"; |
| 6589 | readonly messageId: MessageId; |
| 6590 | readonly content: ContentBlock; |
| 6591 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6592 | } |
| 6593 | | { |
| 6594 | readonly sessionUpdate: "user_message"; |
| 6595 | readonly messageId: MessageId; |
| 6596 | readonly content?: ReadonlyArray<ContentBlock> | null; |
| 6597 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6598 | } |
| 6599 | | { |
| 6600 | readonly sessionUpdate: "agent_message_chunk"; |
| 6601 | readonly messageId: MessageId; |
| 6602 | readonly content: ContentBlock; |
| 6603 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6604 | } |
| 6605 | | { |
| 6606 | readonly sessionUpdate: "agent_message"; |
| 6607 | readonly messageId: MessageId; |
| 6608 | readonly content?: ReadonlyArray<ContentBlock> | null; |
| 6609 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6610 | } |
| 6611 | | { |
| 6612 | readonly sessionUpdate: "agent_thought_chunk"; |
| 6613 | readonly messageId: MessageId; |
| 6614 | readonly content: ContentBlock; |
| 6615 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6616 | } |
| 6617 | | { |
| 6618 | readonly sessionUpdate: "agent_thought"; |
| 6619 | readonly messageId: MessageId; |
| 6620 | readonly content?: ReadonlyArray<ContentBlock> | null; |
| 6621 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6622 | } |
| 6623 | | { |
| 6624 | readonly sessionUpdate: "state_update"; |
| 6625 | readonly state: "running"; |
| 6626 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6627 | } |
| 6628 | | { |
| 6629 | readonly sessionUpdate: "state_update"; |
| 6630 | readonly state: "idle"; |
| 6631 | readonly stopReason?: StopReason | null; |
| 6632 | readonly usage?: Usage | null; |
| 6633 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6634 | } |
| 6635 | | { |
| 6636 | readonly sessionUpdate: "state_update"; |
| 6637 | readonly state: "requires_action"; |
| 6638 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6639 | } |
| 6640 | | ({ readonly sessionUpdate: "state_update"; readonly state: string } & { |
| 6641 | readonly [x: string]: Schema.Json; |
| 6642 | }) |
| 6643 | | { |
| 6644 | readonly sessionUpdate: "tool_call_content_chunk"; |
| 6645 | readonly toolCallId: ToolCallId; |
| 6646 | readonly content: ToolCallContent; |
| 6647 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6648 | } |
| 6649 | | { |
| 6650 | readonly sessionUpdate: "tool_call_update"; |
| 6651 | readonly toolCallId: ToolCallId; |
| 6652 | readonly name?: string | null; |
| 6653 | readonly title?: string | null; |
| 6654 | readonly kind?: ToolKind | null; |
| 6655 | readonly status?: ToolCallStatus | null; |
| 6656 | readonly content?: ReadonlyArray<ToolCallContent> | null; |
| 6657 | readonly locations?: ReadonlyArray<ToolCallLocation> | null; |
| 6658 | readonly rawInput?: Schema.Json; |
| 6659 | readonly rawOutput?: Schema.Json; |
| 6660 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6661 | } |
| 6662 | | { |
| 6663 | readonly sessionUpdate: "terminal_update"; |
| 6664 | readonly terminalId: TerminalId; |
| 6665 | readonly command?: string | null; |
| 6666 | readonly cwd?: AbsolutePath | null; |
| 6667 | readonly output?: TerminalOutput | null; |
| 6668 | readonly exitStatus?: TerminalExitStatus | null; |
| 6669 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6670 | } |
| 6671 | | { |
| 6672 | readonly sessionUpdate: "terminal_output_chunk"; |
| 6673 | readonly terminalId: TerminalId; |
| 6674 | readonly data: string; |
| 6675 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6676 | } |
| 6677 | | { |
| 6678 | readonly sessionUpdate: "plan_update"; |
| 6679 | readonly plan: PlanUpdateContent; |
| 6680 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6681 | } |
| 6682 | | { |
| 6683 | readonly sessionUpdate: "plan_removed"; |
| 6684 | readonly planId: PlanId; |
| 6685 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6686 | } |
| 6687 | | { |
| 6688 | readonly sessionUpdate: "available_commands_update"; |
| 6689 | readonly availableCommands: ReadonlyArray<AvailableCommand>; |
| 6690 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6691 | } |
| 6692 | | { |
| 6693 | readonly sessionUpdate: "config_option_update"; |
| 6694 | readonly configOptions: ReadonlyArray<SessionConfigOption>; |
| 6695 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6696 | } |
| 6697 | | { |
| 6698 | readonly sessionUpdate: "session_info_update"; |
| 6699 | readonly title?: string | null; |
| 6700 | readonly updatedAt?: string | null; |
| 6701 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6702 | } |
| 6703 | | { |
| 6704 | readonly sessionUpdate: "usage_update"; |
| 6705 | readonly used: number; |
| 6706 | readonly size: number; |
| 6707 | readonly cost?: Cost | null; |
| 6708 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6709 | } |
| 6710 | | { |
| 6711 | readonly sessionUpdate: "compaction_update"; |
| 6712 | readonly compactionId: CompactionId; |
| 6713 | readonly status: CompactionStatus; |
| 6714 | readonly summary?: ReadonlyArray<ContentBlock> | null; |
| 6715 | readonly error?: string | null; |
| 6716 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6717 | } |
| 6718 | | { |
| 6719 | readonly sessionUpdate: "compaction_summary_chunk"; |
| 6720 | readonly compactionId: CompactionId; |
| 6721 | readonly content: ContentBlock; |
| 6722 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 6723 | } |
| 6724 | | ({ readonly sessionUpdate: string } & { readonly [x: string]: Schema.Json }); |
| 6725 | export const SessionUpdate = Schema.Union([ |
| 6726 | Schema.Struct({ |
| 6727 | sessionUpdate: Schema.Literal("user_message_chunk"), |
| 6728 | messageId: Schema.suspend((): Schema.Codec<MessageId> => MessageId).annotate({ |
| 6729 | description: |
| 6730 | "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.", |
| 6731 | }), |
| 6732 | content: Schema.suspend((): Schema.Codec<ContentBlock> => ContentBlock).annotate({ |
| 6733 | description: "A single item of content", |
| 6734 | }), |
| 6735 | _meta: Schema.optionalKey( |
| 6736 | Schema.Union([ |
| 6737 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 6738 | description: |
| 6739 | "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. This field is chunk-scoped.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 6740 | }), |
| 6741 | Schema.Null, |
| 6742 | ]), |
| 6743 | ), |
| 6744 | }).annotate({ description: "A streamed item of message content." }), |
| 6745 | Schema.Struct({ |
| 6746 | sessionUpdate: Schema.Literal("user_message"), |
| 6747 | messageId: Schema.suspend((): Schema.Codec<MessageId> => MessageId).annotate({ |
| 6748 | description: "A unique identifier for the message.", |
| 6749 | }), |
| 6750 | content: Schema.optionalKey( |
| 6751 | Schema.Union([ |
| 6752 | Schema.Array(ContentBlock).annotate({ |
| 6753 | description: "Complete replacement content for this message.", |
| 6754 | }), |
| 6755 | Schema.Null, |
| 6756 | ]), |
| 6757 | ), |
| 6758 | _meta: Schema.optionalKey( |
| 6759 | Schema.Union([ |
| 6760 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 6761 | description: |
| 6762 | "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. Omitted means no metadata update; `null` is an explicit clear signal.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 6763 | }), |
| 6764 | Schema.Null, |
| 6765 | ]), |
| 6766 | ), |
| 6767 | }).annotate({ |
| 6768 | description: |
| 6769 | "A user message upsert.\n\nOnly [`UserMessage::message_id`] is required. `content` has patch semantics:\nan omitted field leaves existing message content unchanged, `null` clears the\nvalue, and a concrete array replaces the previous value. For a new\n`messageId`, omitted fields use client defaults. `content` is replaced as a\nwhole array; send `[]` or `null` to clear it.\n\nMessage updates and chunks are applied in the order they are received. When\na `user_message` update includes `content`, that array replaces any content\npreviously accumulated for the message, including content from earlier\nchunks. Later chunks with the same `messageId` append to the current\ncontent.", |
| 6770 | }), |
| 6771 | Schema.Struct({ |
| 6772 | sessionUpdate: Schema.Literal("agent_message_chunk"), |
| 6773 | messageId: Schema.suspend((): Schema.Codec<MessageId> => MessageId).annotate({ |
| 6774 | description: |
| 6775 | "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.", |
| 6776 | }), |
| 6777 | content: Schema.suspend((): Schema.Codec<ContentBlock> => ContentBlock).annotate({ |
| 6778 | description: "A single item of content", |
| 6779 | }), |
| 6780 | _meta: Schema.optionalKey( |
| 6781 | Schema.Union([ |
| 6782 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 6783 | description: |
| 6784 | "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. This field is chunk-scoped.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 6785 | }), |
| 6786 | Schema.Null, |
| 6787 | ]), |
| 6788 | ), |
| 6789 | }).annotate({ description: "A streamed item of message content." }), |
| 6790 | Schema.Struct({ |
| 6791 | sessionUpdate: Schema.Literal("agent_message"), |
| 6792 | messageId: Schema.suspend((): Schema.Codec<MessageId> => MessageId).annotate({ |
| 6793 | description: "A unique identifier for the message.", |
| 6794 | }), |
| 6795 | content: Schema.optionalKey( |
| 6796 | Schema.Union([ |
| 6797 | Schema.Array(ContentBlock).annotate({ |
| 6798 | description: "Complete replacement content for this message.", |
| 6799 | }), |
| 6800 | Schema.Null, |
| 6801 | ]), |
| 6802 | ), |
| 6803 | _meta: Schema.optionalKey( |
| 6804 | Schema.Union([ |
| 6805 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 6806 | description: |
| 6807 | "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. Omitted means no metadata update; `null` is an explicit clear signal.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 6808 | }), |
| 6809 | Schema.Null, |
| 6810 | ]), |
| 6811 | ), |
| 6812 | }).annotate({ |
| 6813 | description: |
| 6814 | "An agent message upsert.\n\nOnly [`AgentMessage::message_id`] is required. `content` has patch semantics:\nan omitted field leaves existing message content unchanged, `null` clears the\nvalue, and a concrete array replaces the previous value. For a new\n`messageId`, omitted fields use client defaults. `content` is replaced as a\nwhole array; send `[]` or `null` to clear it.\n\nMessage updates and chunks are applied in the order they are received. When\nan `agent_message` update includes `content`, that array replaces any\ncontent previously accumulated for the message, including content from\nearlier chunks. Later chunks with the same `messageId` append to the current\ncontent.", |
| 6815 | }), |
| 6816 | Schema.Struct({ |
| 6817 | sessionUpdate: Schema.Literal("agent_thought_chunk"), |
| 6818 | messageId: Schema.suspend((): Schema.Codec<MessageId> => MessageId).annotate({ |
| 6819 | description: |
| 6820 | "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.", |
| 6821 | }), |
| 6822 | content: Schema.suspend((): Schema.Codec<ContentBlock> => ContentBlock).annotate({ |
| 6823 | description: "A single item of content", |
| 6824 | }), |
| 6825 | _meta: Schema.optionalKey( |
| 6826 | Schema.Union([ |
| 6827 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 6828 | description: |
| 6829 | "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. This field is chunk-scoped.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 6830 | }), |
| 6831 | Schema.Null, |
| 6832 | ]), |
| 6833 | ), |
| 6834 | }).annotate({ description: "A streamed item of message content." }), |
| 6835 | Schema.Struct({ |
| 6836 | sessionUpdate: Schema.Literal("agent_thought"), |
| 6837 | messageId: Schema.suspend((): Schema.Codec<MessageId> => MessageId).annotate({ |
| 6838 | description: "A unique identifier for the thought message.", |
| 6839 | }), |
| 6840 | content: Schema.optionalKey( |
| 6841 | Schema.Union([ |
| 6842 | Schema.Array(ContentBlock).annotate({ |
| 6843 | description: "Complete replacement content for this thought message.", |
| 6844 | }), |
| 6845 | Schema.Null, |
| 6846 | ]), |
| 6847 | ), |
| 6848 | _meta: Schema.optionalKey( |
| 6849 | Schema.Union([ |
| 6850 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 6851 | description: |
| 6852 | "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. Omitted means no metadata update; `null` is an explicit clear signal.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 6853 | }), |
| 6854 | Schema.Null, |
| 6855 | ]), |
| 6856 | ), |
| 6857 | }).annotate({ |
| 6858 | description: |
| 6859 | "An agent thought or reasoning message upsert.\n\nOnly [`AgentThought::message_id`] is required. `content` has patch semantics:\nan omitted field leaves existing thought content unchanged, `null` clears the\nvalue, and a concrete array replaces the previous value. For a new\n`messageId`, omitted fields use client defaults. `content` is replaced as a\nwhole array; send `[]` or `null` to clear it.\n\nMessage updates and chunks are applied in the order they are received. When\nan `agent_thought` update includes `content`, that array replaces any\ncontent previously accumulated for the thought, including content from\nearlier chunks. Later chunks with the same `messageId` append to the current\ncontent.", |
| 6860 | }), |
| 6861 | Schema.Union([ |
| 6862 | Schema.Struct({ |
| 6863 | sessionUpdate: Schema.Literal("state_update"), |
| 6864 | state: Schema.Literal("running"), |
| 6865 | _meta: Schema.optionalKey( |
| 6866 | Schema.Union([ |
| 6867 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 6868 | description: |
| 6869 | "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/v2/draft/extensibility)", |
| 6870 | }), |
| 6871 | Schema.Null, |
| 6872 | ]), |
| 6873 | ), |
| 6874 | }).annotate({ description: "Foreground work is in progress." }), |
| 6875 | Schema.Struct({ |
| 6876 | sessionUpdate: Schema.Literal("state_update"), |
| 6877 | state: Schema.Literal("idle"), |
| 6878 | stopReason: Schema.optionalKey( |
| 6879 | Schema.Union([StopReason, Schema.Null]).annotate({ |
| 6880 | description: |
| 6881 | "Indicates why foreground work stopped.\n\nOptional. Omitted or `null` both mean the agent is not reporting a stop reason.\nAgents SHOULD include this when the idle transition ends foreground work.", |
| 6882 | }), |
| 6883 | ), |
| 6884 | usage: Schema.optionalKey( |
| 6885 | Schema.Union([Usage, Schema.Null]).annotate({ |
| 6886 | description: |
| 6887 | "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nToken usage for completed foreground work.\n\nOptional. Omitted or `null` both mean the agent is not reporting token\nusage for this state update.", |
| 6888 | }), |
| 6889 | ), |
| 6890 | _meta: Schema.optionalKey( |
| 6891 | Schema.Union([ |
| 6892 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 6893 | description: |
| 6894 | "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/v2/draft/extensibility)", |
| 6895 | }), |
| 6896 | Schema.Null, |
| 6897 | ]), |
| 6898 | ), |
| 6899 | }).annotate({ description: "The agent is ready to process a new prompt." }), |
| 6900 | Schema.Struct({ |
| 6901 | sessionUpdate: Schema.Literal("state_update"), |
| 6902 | state: Schema.Literal("requires_action"), |
| 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/v2/draft/extensibility)", |
| 6908 | }), |
| 6909 | Schema.Null, |
| 6910 | ]), |
| 6911 | ), |
| 6912 | }).annotate({ description: "Foreground work is blocked on user action." }), |
| 6913 | Schema.StructWithRest( |
| 6914 | Schema.Struct({ |
| 6915 | sessionUpdate: Schema.Literal("state_update"), |
| 6916 | state: Schema.String.annotate({ |
| 6917 | description: |
| 6918 | "Custom or future session state.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 6919 | }).check( |
| 6920 | Schema.isPattern( |
| 6921 | new RegExp("^(?!(?:\\x72unning|\\x69dle|\\x72equires_action)$)[\\s\\S]*$"), |
| 6922 | ).annotate({ |
| 6923 | expected: |
| 6924 | "a string matching the RegExp ^(?!(?:\\x72unning|\\x69dle|\\x72equires_action)$)[\\s\\S]*$", |
| 6925 | }), |
| 6926 | ), |
| 6927 | }), |
| 6928 | [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], |
| 6929 | ).annotate({ |
| 6930 | title: "other", |
| 6931 | description: |
| 6932 | "Custom or future session state.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 6933 | }), |
| 6934 | ]), |
| 6935 | Schema.Struct({ |
| 6936 | sessionUpdate: Schema.Literal("tool_call_content_chunk"), |
| 6937 | toolCallId: Schema.suspend((): Schema.Codec<ToolCallId> => ToolCallId).annotate({ |
| 6938 | description: "The ID of the tool call this content belongs to.", |
| 6939 | }), |
| 6940 | content: Schema.suspend((): Schema.Codec<ToolCallContent> => ToolCallContent).annotate({ |
| 6941 | description: "A single item of content produced by the tool call.", |
| 6942 | }), |
| 6943 | _meta: Schema.optionalKey( |
| 6944 | Schema.Union([ |
| 6945 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 6946 | description: |
| 6947 | "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. This field is chunk-scoped.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 6948 | }), |
| 6949 | Schema.Null, |
| 6950 | ]), |
| 6951 | ), |
| 6952 | }).annotate({ |
| 6953 | description: |
| 6954 | "A streamed item of tool-call content.\n\nTool-call content chunks append one [`ToolCallContent`] item to the current\ncontent for the matching [`ToolCallId`]. Agents can use\n[`ToolCallUpdate::content`] when they need to replace the whole content\ncollection instead.", |
| 6955 | }), |
| 6956 | Schema.Struct({ |
| 6957 | sessionUpdate: Schema.Literal("tool_call_update"), |
| 6958 | toolCallId: Schema.suspend((): Schema.Codec<ToolCallId> => ToolCallId).annotate({ |
| 6959 | description: "Unique identifier for this tool call within the session.", |
| 6960 | }), |
| 6961 | name: Schema.optionalKey( |
| 6962 | Schema.Union([ |
| 6963 | Schema.String.annotate({ |
| 6964 | description: |
| 6965 | "**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 and has patch semantics. Omission means no\nchange, `null` clears the name, and a string replaces it. For a tool\ncall ID the client has not seen before, omission or `null` means that no\ntool name is available.", |
| 6966 | }), |
| 6967 | Schema.Null, |
| 6968 | ]), |
| 6969 | ), |
| 6970 | title: Schema.optionalKey( |
| 6971 | Schema.Union([ |
| 6972 | Schema.String.annotate({ |
| 6973 | description: "Human-readable title describing what the tool is doing.", |
| 6974 | }), |
| 6975 | Schema.Null, |
| 6976 | ]), |
| 6977 | ), |
| 6978 | kind: Schema.optionalKey( |
| 6979 | Schema.Union([ToolKind, Schema.Null]).annotate({ |
| 6980 | description: |
| 6981 | "The category of tool being invoked.\nHelps clients choose appropriate icons and UI treatment.", |
| 6982 | }), |
| 6983 | ), |
| 6984 | status: Schema.optionalKey( |
| 6985 | Schema.Union([ToolCallStatus, Schema.Null]).annotate({ |
| 6986 | description: "Current execution status of the tool call.", |
| 6987 | }), |
| 6988 | ), |
| 6989 | content: Schema.optionalKey( |
| 6990 | Schema.Union([ |
| 6991 | Schema.Array(ToolCallContent).annotate({ |
| 6992 | description: "Content produced by the tool call.", |
| 6993 | }), |
| 6994 | Schema.Null, |
| 6995 | ]), |
| 6996 | ), |
| 6997 | locations: Schema.optionalKey( |
| 6998 | Schema.Union([ |
| 6999 | Schema.Array(ToolCallLocation).annotate({ |
| 7000 | description: |
| 7001 | 'File locations affected by this tool call.\nEnables "follow-along" features in clients.', |
| 7002 | }), |
| 7003 | Schema.Null, |
| 7004 | ]), |
| 7005 | ), |
| 7006 | rawInput: Schema.optionalKey( |
| 7007 | Schema.Json.annotate({ |
| 7008 | expected: "JSON value", |
| 7009 | description: "Raw input parameters sent to the tool.", |
| 7010 | }), |
| 7011 | ), |
| 7012 | rawOutput: Schema.optionalKey( |
| 7013 | Schema.Json.annotate({ |
| 7014 | expected: "JSON value", |
| 7015 | description: "Raw output returned by the tool.", |
| 7016 | }), |
| 7017 | ), |
| 7018 | _meta: Schema.optionalKey( |
| 7019 | Schema.Union([ |
| 7020 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7021 | description: |
| 7022 | "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Omitted means no metadata update; `null` is an\nexplicit clear signal. Implementations MUST NOT make assumptions about values at these keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 7023 | }), |
| 7024 | Schema.Null, |
| 7025 | ]), |
| 7026 | ), |
| 7027 | }).annotate({ |
| 7028 | description: |
| 7029 | "Represents an upsert for 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\nOnly [`ToolCallUpdate::tool_call_id`] is required. Other fields have patch semantics:\nomitted fields leave the existing tool call value unchanged, `null` clears or\nunsets the value, and concrete values replace the previous value. For\ncollection fields, concrete arrays replace the previous collection, and both\n`null` and `[]` clear the collection. When a client receives a tool call ID it\nhas not seen before, omitted fields use client defaults.\n\nSee protocol docs: [Tool Calls](https://agentclientprotocol.com/protocol/v2/draft/tool-calls)", |
| 7030 | }), |
| 7031 | Schema.Struct({ |
| 7032 | sessionUpdate: Schema.Literal("terminal_update"), |
| 7033 | terminalId: Schema.suspend((): Schema.Codec<TerminalId> => TerminalId).annotate({ |
| 7034 | description: "Unique identifier for this terminal within the session.", |
| 7035 | }), |
| 7036 | command: Schema.optionalKey( |
| 7037 | Schema.Union([ |
| 7038 | Schema.String.annotate({ description: "The command being run." }), |
| 7039 | Schema.Null, |
| 7040 | ]), |
| 7041 | ), |
| 7042 | cwd: Schema.optionalKey( |
| 7043 | Schema.Union([AbsolutePath, Schema.Null]).annotate({ |
| 7044 | description: "The absolute working directory of the command.", |
| 7045 | }), |
| 7046 | ), |
| 7047 | output: Schema.optionalKey( |
| 7048 | Schema.Union([TerminalOutput, Schema.Null]).annotate({ |
| 7049 | description: "An authoritative replacement snapshot of terminal output bytes.", |
| 7050 | }), |
| 7051 | ), |
| 7052 | exitStatus: Schema.optionalKey( |
| 7053 | Schema.Union([TerminalExitStatus, Schema.Null]).annotate({ |
| 7054 | description: "Exit information. A concrete object marks the terminal as exited.", |
| 7055 | }), |
| 7056 | ), |
| 7057 | _meta: Schema.optionalKey( |
| 7058 | Schema.Union([ |
| 7059 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7060 | description: |
| 7061 | "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Omitted means no metadata update; `null` is an\nexplicit clear signal. Implementations MUST NOT make assumptions about values at these keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 7062 | }), |
| 7063 | Schema.Null, |
| 7064 | ]), |
| 7065 | ), |
| 7066 | }).annotate({ |
| 7067 | description: |
| 7068 | "An upsert for the stored state of an agent-owned terminal.\n\nOnly [`TerminalUpdate::terminal_id`] is required. Other fields have patch\nsemantics: omitted fields leave the stored value unchanged, `null` clears\nit, and concrete values replace it. When the terminal ID is new, omitted\nfields start unknown.", |
| 7069 | }), |
| 7070 | Schema.Struct({ |
| 7071 | sessionUpdate: Schema.Literal("terminal_output_chunk"), |
| 7072 | terminalId: Schema.suspend((): Schema.Codec<TerminalId> => TerminalId).annotate({ |
| 7073 | description: "The terminal receiving these bytes.", |
| 7074 | }), |
| 7075 | data: Schema.String.annotate({ |
| 7076 | description: "Independently base64-encoded terminal output bytes.", |
| 7077 | contentEncoding: "base64", |
| 7078 | }), |
| 7079 | _meta: Schema.optionalKey( |
| 7080 | Schema.Union([ |
| 7081 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7082 | description: |
| 7083 | "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. This field is chunk-scoped. Omitted and `null` are\nequivalent and mean no chunk metadata was provided.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 7084 | }), |
| 7085 | Schema.Null, |
| 7086 | ]), |
| 7087 | ), |
| 7088 | }).annotate({ description: "A chunk of bytes appended to an agent-owned terminal's output." }), |
| 7089 | Schema.Struct({ |
| 7090 | sessionUpdate: Schema.Literal("plan_update"), |
| 7091 | plan: Schema.suspend((): Schema.Codec<PlanUpdateContent> => PlanUpdateContent).annotate({ |
| 7092 | description: "The updated plan content.", |
| 7093 | }), |
| 7094 | _meta: Schema.optionalKey( |
| 7095 | Schema.Union([ |
| 7096 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7097 | description: |
| 7098 | "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/v2/draft/extensibility)", |
| 7099 | }), |
| 7100 | Schema.Null, |
| 7101 | ]), |
| 7102 | ), |
| 7103 | }).annotate({ description: "A content update for a plan identified by ID." }), |
| 7104 | Schema.Struct({ |
| 7105 | sessionUpdate: Schema.Literal("plan_removed"), |
| 7106 | planId: Schema.suspend((): Schema.Codec<PlanId> => PlanId).annotate({ |
| 7107 | description: "The plan ID to remove.", |
| 7108 | }), |
| 7109 | _meta: Schema.optionalKey( |
| 7110 | Schema.Union([ |
| 7111 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7112 | description: |
| 7113 | "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/v2/draft/extensibility)", |
| 7114 | }), |
| 7115 | Schema.Null, |
| 7116 | ]), |
| 7117 | ), |
| 7118 | }).annotate({ |
| 7119 | description: |
| 7120 | "**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.", |
| 7121 | }), |
| 7122 | Schema.Struct({ |
| 7123 | sessionUpdate: Schema.Literal("available_commands_update"), |
| 7124 | availableCommands: Schema.Array(AvailableCommand).annotate({ |
| 7125 | description: "Commands the agent can execute.", |
| 7126 | }), |
| 7127 | _meta: Schema.optionalKey( |
| 7128 | Schema.Union([ |
| 7129 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7130 | description: |
| 7131 | "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/v2/draft/extensibility)", |
| 7132 | }), |
| 7133 | Schema.Null, |
| 7134 | ]), |
| 7135 | ), |
| 7136 | }).annotate({ description: "Available commands are ready or have changed" }), |
| 7137 | Schema.Struct({ |
| 7138 | sessionUpdate: Schema.Literal("config_option_update"), |
| 7139 | configOptions: Schema.Array(SessionConfigOption).annotate({ |
| 7140 | description: "The full set of configuration options and their current values.", |
| 7141 | }), |
| 7142 | _meta: Schema.optionalKey( |
| 7143 | Schema.Union([ |
| 7144 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7145 | description: |
| 7146 | "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/v2/draft/extensibility)", |
| 7147 | }), |
| 7148 | Schema.Null, |
| 7149 | ]), |
| 7150 | ), |
| 7151 | }).annotate({ description: "Session configuration options have been updated." }), |
| 7152 | Schema.Struct({ |
| 7153 | sessionUpdate: Schema.Literal("session_info_update"), |
| 7154 | title: Schema.optionalKey( |
| 7155 | Schema.Union([ |
| 7156 | Schema.String.annotate({ |
| 7157 | description: "Human-readable title for the session. Set to null to clear.", |
| 7158 | }), |
| 7159 | Schema.Null, |
| 7160 | ]), |
| 7161 | ), |
| 7162 | updatedAt: Schema.optionalKey( |
| 7163 | Schema.Union([ |
| 7164 | Schema.String.annotate({ |
| 7165 | description: "RFC 3339 timestamp of last activity. Set to null to clear.", |
| 7166 | format: "date-time", |
| 7167 | }), |
| 7168 | Schema.Null, |
| 7169 | ]), |
| 7170 | ), |
| 7171 | _meta: Schema.optionalKey( |
| 7172 | Schema.Union([ |
| 7173 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7174 | description: |
| 7175 | "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Omitted means no metadata update; `null` is an\nexplicit clear signal. Implementations MUST NOT make assumptions about values at these keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 7176 | }), |
| 7177 | Schema.Null, |
| 7178 | ]), |
| 7179 | ), |
| 7180 | }).annotate({ |
| 7181 | description: |
| 7182 | "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.\n\nOmitted fields leave the existing session info unchanged. `null` clears the\ncorresponding value.", |
| 7183 | }), |
| 7184 | Schema.Struct({ |
| 7185 | sessionUpdate: Schema.Literal("usage_update"), |
| 7186 | used: Schema.Number.annotate({ description: "Tokens currently in context.", format: "uint64" }) |
| 7187 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 7188 | .check( |
| 7189 | Schema.isGreaterThanOrEqualTo(0).annotate({ |
| 7190 | expected: "a value greater than or equal to 0", |
| 7191 | }), |
| 7192 | ), |
| 7193 | size: Schema.Number.annotate({ |
| 7194 | description: "Total context window size in tokens.", |
| 7195 | format: "uint64", |
| 7196 | }) |
| 7197 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 7198 | .check( |
| 7199 | Schema.isGreaterThanOrEqualTo(0).annotate({ |
| 7200 | expected: "a value greater than or equal to 0", |
| 7201 | }), |
| 7202 | ), |
| 7203 | cost: Schema.optionalKey( |
| 7204 | Schema.Union([Cost, Schema.Null]).annotate({ |
| 7205 | description: "Cumulative session cost (optional).", |
| 7206 | }), |
| 7207 | ), |
| 7208 | _meta: Schema.optionalKey( |
| 7209 | Schema.Union([ |
| 7210 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7211 | description: |
| 7212 | "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/v2/draft/extensibility)", |
| 7213 | }), |
| 7214 | Schema.Null, |
| 7215 | ]), |
| 7216 | ), |
| 7217 | }).annotate({ description: "Context window and cost update for a session." }), |
| 7218 | Schema.Struct({ |
| 7219 | sessionUpdate: Schema.Literal("compaction_update"), |
| 7220 | compactionId: Schema.suspend((): Schema.Codec<CompactionId> => CompactionId).annotate({ |
| 7221 | description: "The Agent-owned ID of this compaction, unique within the session.", |
| 7222 | }), |
| 7223 | status: Schema.suspend((): Schema.Codec<CompactionStatus> => CompactionStatus).annotate({ |
| 7224 | description: "Current lifecycle status.", |
| 7225 | }), |
| 7226 | summary: Schema.optionalKey( |
| 7227 | Schema.Union([ |
| 7228 | Schema.Array(ContentBlock).annotate({ |
| 7229 | description: "Complete replacement user-displayable summary retained by the compaction.", |
| 7230 | }), |
| 7231 | Schema.Null, |
| 7232 | ]), |
| 7233 | ), |
| 7234 | error: Schema.optionalKey( |
| 7235 | Schema.Union([ |
| 7236 | Schema.String.annotate({ |
| 7237 | description: "Human-readable description of why the compaction failed.", |
| 7238 | }), |
| 7239 | Schema.Null, |
| 7240 | ]), |
| 7241 | ), |
| 7242 | _meta: Schema.optionalKey( |
| 7243 | Schema.Union([ |
| 7244 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7245 | description: "Extensible metadata patch for this compaction.", |
| 7246 | }), |
| 7247 | Schema.Null, |
| 7248 | ]), |
| 7249 | ), |
| 7250 | }).annotate({ |
| 7251 | description: |
| 7252 | "**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.\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`.", |
| 7253 | }), |
| 7254 | Schema.Struct({ |
| 7255 | sessionUpdate: Schema.Literal("compaction_summary_chunk"), |
| 7256 | compactionId: Schema.suspend((): Schema.Codec<CompactionId> => CompactionId).annotate({ |
| 7257 | description: "ID of the compaction whose summary receives this content.", |
| 7258 | }), |
| 7259 | content: Schema.suspend((): Schema.Codec<ContentBlock> => ContentBlock).annotate({ |
| 7260 | description: "One content block to append.", |
| 7261 | }), |
| 7262 | _meta: Schema.optionalKey( |
| 7263 | Schema.Union([ |
| 7264 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7265 | description: "Metadata scoped to this chunk. Omission and `null` both mean absent.", |
| 7266 | }), |
| 7267 | Schema.Null, |
| 7268 | ]), |
| 7269 | ), |
| 7270 | }).annotate({ |
| 7271 | description: |
| 7272 | "**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.", |
| 7273 | }), |
| 7274 | Schema.StructWithRest( |
| 7275 | Schema.Struct({ |
| 7276 | sessionUpdate: Schema.String.annotate({ |
| 7277 | description: |
| 7278 | "Custom or future session update type.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 7279 | }).check( |
| 7280 | Schema.isPattern( |
| 7281 | new RegExp( |
| 7282 | "^(?!(?:\\x75ser_message_chunk|\\x75ser_message|\\x61gent_message_chunk|\\x61gent_message|\\x61gent_thought_chunk|\\x61gent_thought|\\x73tate_update|\\x74ool_call_content_chunk|\\x74ool_call_update|\\x74erminal_update|\\x74erminal_output_chunk|\\x70lan_update|\\x61vailable_commands_update|\\x63onfig_option_update|\\x73ession_info_update|\\x70lan_removed|\\x75sage_update|\\x63ompaction_update|\\x63ompaction_summary_chunk)$)[\\s\\S]*$", |
| 7283 | ), |
| 7284 | ).annotate({ |
| 7285 | expected: |
| 7286 | "a string matching the RegExp ^(?!(?:\\x75ser_message_chunk|\\x75ser_message|\\x61gent_message_chunk|\\x61gent_message|\\x61gent_thought_chunk|\\x61gent_thought|\\x73tate_update|\\x74ool_call_content_chunk|\\x74ool_call_update|\\x74erminal_update|\\x74erminal_output_chunk|\\x70lan_update|\\x61vailable_commands_update|\\x63onfig_option_update|\\x73ession_info_update|\\x70lan_removed|\\x75sage_update|\\x63ompaction_update|\\x63ompaction_summary_chunk)$)[\\s\\S]*$", |
| 7287 | }), |
| 7288 | ), |
| 7289 | }), |
| 7290 | [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], |
| 7291 | ).annotate({ |
| 7292 | title: "other", |
| 7293 | description: |
| 7294 | "Custom or future session update.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.\n\nReceivers that do not understand this update type should preserve the\nraw payload when storing, replaying, proxying, or forwarding session\nhistory, and otherwise ignore it or display it generically.", |
| 7295 | }), |
| 7296 | ]).annotate({ |
| 7297 | description: |
| 7298 | "Different types of updates that can be sent while a session exists.\n\nThese updates report messages, progress, and other session activity.\n\nSee protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/v2/draft/prompt-lifecycle#3-agent-reports-output)", |
| 7299 | identifier: "SessionUpdate", |
| 7300 | }); |
| 7301 | |
| 7302 | export type NewSessionResponse = { |
| 7303 | readonly sessionId: SessionId; |
| 7304 | readonly configOptions?: ReadonlyArray<SessionConfigOption>; |
| 7305 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 7306 | }; |
| 7307 | export const NewSessionResponse = Schema.Struct({ |
| 7308 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 7309 | description: |
| 7310 | "Unique identifier for the created session.\n\nUsed in all subsequent requests for this conversation.", |
| 7311 | }), |
| 7312 | configOptions: Schema.optionalKey( |
| 7313 | Schema.Array(SessionConfigOption).annotate({ |
| 7314 | description: "Initial session configuration options.", |
| 7315 | }), |
| 7316 | ), |
| 7317 | _meta: Schema.optionalKey( |
| 7318 | Schema.Union([ |
| 7319 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7320 | description: |
| 7321 | "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/v2/draft/extensibility)", |
| 7322 | }), |
| 7323 | Schema.Null, |
| 7324 | ]), |
| 7325 | ), |
| 7326 | }).annotate({ |
| 7327 | description: |
| 7328 | "Response from creating a new session.\n\nSee protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol/v2/draft/session-setup#creating-a-session)", |
| 7329 | identifier: "NewSessionResponse", |
| 7330 | }); |
| 7331 | |
| 7332 | export type ForkSessionResponse = { |
| 7333 | readonly sessionId: SessionId; |
| 7334 | readonly configOptions?: ReadonlyArray<SessionConfigOption>; |
| 7335 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 7336 | }; |
| 7337 | export const ForkSessionResponse = Schema.Struct({ |
| 7338 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 7339 | description: "Unique identifier for the newly created forked session.", |
| 7340 | }), |
| 7341 | configOptions: Schema.optionalKey( |
| 7342 | Schema.Array(SessionConfigOption).annotate({ |
| 7343 | description: "Initial session configuration options.", |
| 7344 | }), |
| 7345 | ), |
| 7346 | _meta: Schema.optionalKey( |
| 7347 | Schema.Union([ |
| 7348 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7349 | description: |
| 7350 | "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/v2/draft/extensibility)", |
| 7351 | }), |
| 7352 | Schema.Null, |
| 7353 | ]), |
| 7354 | ), |
| 7355 | }).annotate({ |
| 7356 | description: |
| 7357 | "**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.", |
| 7358 | identifier: "ForkSessionResponse", |
| 7359 | }); |
| 7360 | |
| 7361 | export type ResumeSessionResponse = { |
| 7362 | readonly configOptions?: ReadonlyArray<SessionConfigOption>; |
| 7363 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 7364 | }; |
| 7365 | export const ResumeSessionResponse = Schema.Struct({ |
| 7366 | configOptions: Schema.optionalKey( |
| 7367 | Schema.Array(SessionConfigOption).annotate({ |
| 7368 | description: "Initial session configuration options.", |
| 7369 | }), |
| 7370 | ), |
| 7371 | _meta: Schema.optionalKey( |
| 7372 | Schema.Union([ |
| 7373 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7374 | description: |
| 7375 | "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/v2/draft/extensibility)", |
| 7376 | }), |
| 7377 | Schema.Null, |
| 7378 | ]), |
| 7379 | ), |
| 7380 | }).annotate({ |
| 7381 | description: "Response from resuming an existing session.", |
| 7382 | identifier: "ResumeSessionResponse", |
| 7383 | }); |
| 7384 | |
| 7385 | export type SetSessionConfigOptionResponse = { |
| 7386 | readonly configOptions: ReadonlyArray<SessionConfigOption>; |
| 7387 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 7388 | }; |
| 7389 | export const SetSessionConfigOptionResponse = Schema.Struct({ |
| 7390 | configOptions: Schema.Array(SessionConfigOption).annotate({ |
| 7391 | description: "The full set of configuration options and their current values.", |
| 7392 | }), |
| 7393 | _meta: Schema.optionalKey( |
| 7394 | Schema.Union([ |
| 7395 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7396 | description: |
| 7397 | "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/v2/draft/extensibility)", |
| 7398 | }), |
| 7399 | Schema.Null, |
| 7400 | ]), |
| 7401 | ), |
| 7402 | }).annotate({ |
| 7403 | description: "Response to `session/set_config_option` method.", |
| 7404 | identifier: "SetSessionConfigOptionResponse", |
| 7405 | }); |
| 7406 | |
| 7407 | export type InitializeResponse = { |
| 7408 | readonly protocolVersion: ProtocolVersion; |
| 7409 | readonly info: Implementation; |
| 7410 | readonly capabilities?: AgentCapabilities; |
| 7411 | readonly authMethods?: ReadonlyArray<AuthMethod>; |
| 7412 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 7413 | }; |
| 7414 | export const InitializeResponse = Schema.Struct({ |
| 7415 | protocolVersion: Schema.suspend((): Schema.Codec<ProtocolVersion> => ProtocolVersion).annotate({ |
| 7416 | description: |
| 7417 | "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.", |
| 7418 | }), |
| 7419 | info: Schema.suspend((): Schema.Codec<Implementation> => Implementation).annotate({ |
| 7420 | description: "Information about the implementation sending this initialize response.", |
| 7421 | }), |
| 7422 | capabilities: Schema.optionalKey( |
| 7423 | Schema.suspend((): Schema.Codec<AgentCapabilities> => AgentCapabilities).annotate({ |
| 7424 | description: "Capabilities supported by the agent.", |
| 7425 | default: {}, |
| 7426 | }), |
| 7427 | ), |
| 7428 | authMethods: Schema.optionalKey( |
| 7429 | Schema.Array(AuthMethod).annotate({ |
| 7430 | description: |
| 7431 | "Authentication methods supported by the agent.\n\nOptional. Omitted or empty means the agent does not advertise the\nauthentication method surface. Supplying one or more valid methods means\nthe agent MUST support both `auth/login` and `auth/logout`.", |
| 7432 | }), |
| 7433 | ), |
| 7434 | _meta: Schema.optionalKey( |
| 7435 | Schema.Union([ |
| 7436 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7437 | description: |
| 7438 | "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/v2/draft/extensibility)", |
| 7439 | }), |
| 7440 | Schema.Null, |
| 7441 | ]), |
| 7442 | ), |
| 7443 | }).annotate({ |
| 7444 | description: |
| 7445 | "Response to the `initialize` method.\n\nContains the negotiated protocol version and agent capabilities.\n\nSee protocol docs: [Initialization](https://agentclientprotocol.com/protocol/v2/draft/initialization)", |
| 7446 | identifier: "InitializeResponse", |
| 7447 | }); |
| 7448 | |
| 7449 | export type RequestPermissionSubject = |
| 7450 | | { readonly type: "tool_call"; readonly toolCall: ToolCallUpdate } |
| 7451 | | { |
| 7452 | readonly type: "command"; |
| 7453 | readonly command: string; |
| 7454 | readonly cwd: AbsolutePath; |
| 7455 | readonly toolCallId?: ToolCallId | null; |
| 7456 | readonly terminalId?: TerminalId | null; |
| 7457 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 7458 | } |
| 7459 | | ({ readonly type: string } & { readonly [x: string]: Schema.Json }); |
| 7460 | export const RequestPermissionSubject = Schema.Union([ |
| 7461 | Schema.Struct({ |
| 7462 | type: Schema.Literal("tool_call"), |
| 7463 | toolCall: Schema.suspend((): Schema.Codec<ToolCallUpdate> => ToolCallUpdate).annotate({ |
| 7464 | description: "Details about the tool call requiring permission.", |
| 7465 | }), |
| 7466 | }).annotate({ description: "Permission request details for a tool call." }), |
| 7467 | Schema.Struct({ |
| 7468 | type: Schema.Literal("command"), |
| 7469 | command: Schema.String.annotate({ |
| 7470 | description: "The command that would be run if permission is granted.", |
| 7471 | }), |
| 7472 | cwd: Schema.suspend((): Schema.Codec<AbsolutePath> => AbsolutePath).annotate({ |
| 7473 | description: "The absolute working directory for the command.", |
| 7474 | }), |
| 7475 | toolCallId: Schema.optionalKey( |
| 7476 | Schema.Union([ToolCallId, Schema.Null]).annotate({ |
| 7477 | description: "The associated tool call, when known. Omitted and `null` are equivalent.", |
| 7478 | }), |
| 7479 | ), |
| 7480 | terminalId: Schema.optionalKey( |
| 7481 | Schema.Union([TerminalId, Schema.Null]).annotate({ |
| 7482 | description: |
| 7483 | "The associated terminal, when already known. Omitted and `null` are equivalent.", |
| 7484 | }), |
| 7485 | ), |
| 7486 | _meta: Schema.optionalKey( |
| 7487 | Schema.Union([ |
| 7488 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7489 | description: |
| 7490 | "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. Omitted and `null` are equivalent and mean no subject metadata was provided.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 7491 | }), |
| 7492 | Schema.Null, |
| 7493 | ]), |
| 7494 | ), |
| 7495 | }).annotate({ description: "Permission request details for a command." }), |
| 7496 | Schema.StructWithRest( |
| 7497 | Schema.Struct({ |
| 7498 | type: Schema.String.annotate({ |
| 7499 | description: |
| 7500 | "Custom or future permission subject type.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 7501 | }).check( |
| 7502 | Schema.isPattern(new RegExp("^(?!(?:\\x74ool_call|\\x63ommand)$)[\\s\\S]*$")).annotate({ |
| 7503 | expected: "a string matching the RegExp ^(?!(?:\\x74ool_call|\\x63ommand)$)[\\s\\S]*$", |
| 7504 | }), |
| 7505 | ), |
| 7506 | }), |
| 7507 | [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], |
| 7508 | ).annotate({ |
| 7509 | title: "other", |
| 7510 | description: |
| 7511 | "Custom or future permission subject.\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 subject type should preserve the raw\npayload when storing, replaying, proxying, or forwarding permission\nrequests, and otherwise display a generic permission prompt or decline it\naccording to policy.", |
| 7512 | }), |
| 7513 | ]).annotate({ |
| 7514 | description: "The operation requiring permission.", |
| 7515 | identifier: "RequestPermissionSubject", |
| 7516 | }); |
| 7517 | |
| 7518 | export type UpdateSessionNotification = { |
| 7519 | readonly sessionId: SessionId; |
| 7520 | readonly update: SessionUpdate; |
| 7521 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 7522 | }; |
| 7523 | export const UpdateSessionNotification = Schema.Struct({ |
| 7524 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 7525 | description: "The ID of the session this update pertains to.", |
| 7526 | }), |
| 7527 | update: Schema.suspend((): Schema.Codec<SessionUpdate> => SessionUpdate).annotate({ |
| 7528 | description: "The actual update content.", |
| 7529 | }), |
| 7530 | _meta: Schema.optionalKey( |
| 7531 | Schema.Union([ |
| 7532 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7533 | description: |
| 7534 | "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/v2/draft/extensibility)", |
| 7535 | }), |
| 7536 | Schema.Null, |
| 7537 | ]), |
| 7538 | ), |
| 7539 | }).annotate({ |
| 7540 | description: |
| 7541 | "Notification containing a session update from the agent.\n\nAgents can send session updates at any point while the session exists.\n\nSee protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/v2/draft/prompt-lifecycle#3-agent-reports-output)", |
| 7542 | identifier: "UpdateSessionNotification", |
| 7543 | }); |
| 7544 | |
| 7545 | export type RequestPermissionRequest = { |
| 7546 | readonly sessionId: SessionId; |
| 7547 | readonly title: string; |
| 7548 | readonly description?: string | null; |
| 7549 | readonly subject?: RequestPermissionSubject | null; |
| 7550 | readonly options: ReadonlyArray<PermissionOption>; |
| 7551 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 7552 | }; |
| 7553 | export const RequestPermissionRequest = Schema.Struct({ |
| 7554 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 7555 | description: "The session ID for this request.", |
| 7556 | }), |
| 7557 | title: Schema.String.annotate({ |
| 7558 | description: |
| 7559 | "Human-readable title for the permission prompt.\n\nThis title is specific to the permission prompt and does not update any\nsubject's displayed title.", |
| 7560 | }), |
| 7561 | description: Schema.optionalKey( |
| 7562 | Schema.Union([ |
| 7563 | Schema.String.annotate({ |
| 7564 | description: |
| 7565 | "Optional human-readable explanation of why permission is needed.\n\nThis text is specific to the permission prompt and does not update any\nsubject's displayed content. Omitted or `null` both mean no separate\npermission description was provided.", |
| 7566 | }), |
| 7567 | Schema.Null, |
| 7568 | ]), |
| 7569 | ), |
| 7570 | subject: Schema.optionalKey( |
| 7571 | Schema.Union([RequestPermissionSubject, Schema.Null]).annotate({ |
| 7572 | description: |
| 7573 | "Optional structured context about the operation requiring permission.\n\nOmitted or `null` both mean no structured subject was provided.", |
| 7574 | }), |
| 7575 | ), |
| 7576 | options: Schema.Array(PermissionOption) |
| 7577 | .annotate({ |
| 7578 | description: |
| 7579 | "Available permission options for the user to choose from.\nMust contain at least one option.", |
| 7580 | }) |
| 7581 | .check(Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" })), |
| 7582 | _meta: Schema.optionalKey( |
| 7583 | Schema.Union([ |
| 7584 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7585 | description: |
| 7586 | "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/v2/draft/extensibility)", |
| 7587 | }), |
| 7588 | Schema.Null, |
| 7589 | ]), |
| 7590 | ), |
| 7591 | }).annotate({ |
| 7592 | description: |
| 7593 | "Request for user permission to proceed with an operation.\n\nSent when the agent needs authorization before performing a sensitive operation.\n\nSee protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/v2/draft/tool-calls#requesting-permission)", |
| 7594 | identifier: "RequestPermissionRequest", |
| 7595 | }); |
| 7596 | |
| 7597 | export type AgentMessage = { |
| 7598 | readonly messageId: MessageId; |
| 7599 | readonly content?: ReadonlyArray<ContentBlock> | null; |
| 7600 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 7601 | }; |
| 7602 | export const AgentMessage = Schema.Struct({ |
| 7603 | messageId: Schema.suspend((): Schema.Codec<MessageId> => MessageId).annotate({ |
| 7604 | description: "A unique identifier for the message.", |
| 7605 | }), |
| 7606 | content: Schema.optionalKey( |
| 7607 | Schema.Union([ |
| 7608 | Schema.Array(ContentBlock).annotate({ |
| 7609 | description: "Complete replacement content for this message.", |
| 7610 | }), |
| 7611 | Schema.Null, |
| 7612 | ]), |
| 7613 | ), |
| 7614 | _meta: Schema.optionalKey( |
| 7615 | Schema.Union([ |
| 7616 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7617 | description: |
| 7618 | "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. Omitted means no metadata update; `null` is an explicit clear signal.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 7619 | }), |
| 7620 | Schema.Null, |
| 7621 | ]), |
| 7622 | ), |
| 7623 | }).annotate({ |
| 7624 | description: |
| 7625 | "An agent message upsert.\n\nOnly [`AgentMessage::message_id`] is required. `content` has patch semantics:\nan omitted field leaves existing message content unchanged, `null` clears the\nvalue, and a concrete array replaces the previous value. For a new\n`messageId`, omitted fields use client defaults. `content` is replaced as a\nwhole array; send `[]` or `null` to clear it.\n\nMessage updates and chunks are applied in the order they are received. When\nan `agent_message` update includes `content`, that array replaces any\ncontent previously accumulated for the message, including content from\nearlier chunks. Later chunks with the same `messageId` append to the current\ncontent.", |
| 7626 | }); |
| 7627 | |
| 7628 | export type AgentNotification = { |
| 7629 | readonly method: string; |
| 7630 | readonly params?: |
| 7631 | | UpdateSessionNotification |
| 7632 | | CompleteElicitationNotification |
| 7633 | | MessageMcpNotification |
| 7634 | | ExtNotification |
| 7635 | | null; |
| 7636 | }; |
| 7637 | export const AgentNotification = Schema.Struct({ |
| 7638 | method: Schema.String.annotate({ description: "The notification method name." }), |
| 7639 | params: Schema.optionalKey( |
| 7640 | Schema.Union([ |
| 7641 | Schema.Union([ |
| 7642 | Schema.suspend( |
| 7643 | (): Schema.Codec<UpdateSessionNotification> => UpdateSessionNotification, |
| 7644 | ).annotate({ |
| 7645 | title: "UpdateSessionNotification", |
| 7646 | description: |
| 7647 | "Handles session update notifications from the agent.\n\nThis is a notification endpoint (no response expected) that receives\nupdates about session activity, including message updates, 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 reporting an idle `state_update` with the cancelled\nstop reason.\n\nSee protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/v2/draft/prompt-lifecycle#3-agent-reports-output)", |
| 7648 | }), |
| 7649 | Schema.suspend( |
| 7650 | (): Schema.Codec<CompleteElicitationNotification> => CompleteElicitationNotification, |
| 7651 | ).annotate({ |
| 7652 | title: "CompleteElicitationNotification", |
| 7653 | description: |
| 7654 | "Notification that a URL-based elicitation has completed.\n\nSee protocol docs: [Elicitation](https://agentclientprotocol.com/protocol/v2/draft/elicitation#url-completion)", |
| 7655 | }), |
| 7656 | Schema.suspend((): Schema.Codec<MessageMcpNotification> => MessageMcpNotification).annotate( |
| 7657 | { |
| 7658 | title: "MessageMcpNotification", |
| 7659 | description: |
| 7660 | "**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.", |
| 7661 | }, |
| 7662 | ), |
| 7663 | Schema.suspend((): Schema.Codec<ExtNotification> => ExtNotification).annotate({ |
| 7664 | title: "ExtNotification", |
| 7665 | description: |
| 7666 | "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/v2/draft/extensibility)", |
| 7667 | }), |
| 7668 | ]).annotate({ |
| 7669 | description: |
| 7670 | "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.", |
| 7671 | }), |
| 7672 | Schema.Null, |
| 7673 | ]).annotate({ description: "Method-specific notification parameters." }), |
| 7674 | ), |
| 7675 | }).annotate({ description: "A JSON-RPC notification object." }); |
| 7676 | |
| 7677 | export type AgentRequest = { |
| 7678 | readonly id: RequestId; |
| 7679 | readonly method: string; |
| 7680 | readonly params?: |
| 7681 | | RequestPermissionRequest |
| 7682 | | CreateElicitationRequest |
| 7683 | | ConnectMcpRequest |
| 7684 | | MessageMcpRequest |
| 7685 | | DisconnectMcpRequest |
| 7686 | | ExtRequest |
| 7687 | | null; |
| 7688 | }; |
| 7689 | export const AgentRequest = Schema.Struct({ |
| 7690 | id: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({ |
| 7691 | description: "The request id used to correlate the matching response.", |
| 7692 | }), |
| 7693 | method: Schema.String.annotate({ description: "The method name to invoke." }), |
| 7694 | params: Schema.optionalKey( |
| 7695 | Schema.Union([ |
| 7696 | Schema.Union([ |
| 7697 | Schema.suspend( |
| 7698 | (): Schema.Codec<RequestPermissionRequest> => RequestPermissionRequest, |
| 7699 | ).annotate({ |
| 7700 | title: "RequestPermissionRequest", |
| 7701 | description: |
| 7702 | "Requests permission from the user for an 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 active session work via `session/cancel`, it MUST\nrespond to this request with `RequestPermissionOutcome::Cancelled`.\n\nSee protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/v2/draft/tool-calls#requesting-permission)", |
| 7703 | }), |
| 7704 | Schema.suspend( |
| 7705 | (): Schema.Codec<CreateElicitationRequest> => CreateElicitationRequest, |
| 7706 | ).annotate({ |
| 7707 | title: "CreateElicitationRequest", |
| 7708 | description: |
| 7709 | "Requests structured user input via a form or URL.\n\nSee protocol docs: [Elicitation](https://agentclientprotocol.com/protocol/v2/draft/elicitation)", |
| 7710 | }), |
| 7711 | Schema.suspend((): Schema.Codec<ConnectMcpRequest> => ConnectMcpRequest).annotate({ |
| 7712 | title: "ConnectMcpRequest", |
| 7713 | description: |
| 7714 | "**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.", |
| 7715 | }), |
| 7716 | Schema.suspend((): Schema.Codec<MessageMcpRequest> => MessageMcpRequest).annotate({ |
| 7717 | title: "MessageMcpRequest", |
| 7718 | description: |
| 7719 | "**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.", |
| 7720 | }), |
| 7721 | Schema.suspend((): Schema.Codec<DisconnectMcpRequest> => DisconnectMcpRequest).annotate({ |
| 7722 | title: "DisconnectMcpRequest", |
| 7723 | description: |
| 7724 | "**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.", |
| 7725 | }), |
| 7726 | Schema.suspend((): Schema.Codec<ExtRequest> => ExtRequest).annotate({ |
| 7727 | title: "ExtMethodRequest", |
| 7728 | description: |
| 7729 | "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/v2/draft/extensibility)", |
| 7730 | }), |
| 7731 | ]).annotate({ |
| 7732 | description: |
| 7733 | "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.", |
| 7734 | }), |
| 7735 | Schema.Null, |
| 7736 | ]).annotate({ description: "Method-specific request parameters." }), |
| 7737 | ), |
| 7738 | }).annotate({ description: "A JSON-RPC request object." }); |
| 7739 | |
| 7740 | export type AgentResponse = |
| 7741 | | { |
| 7742 | readonly id: RequestId; |
| 7743 | readonly result: |
| 7744 | | InitializeResponse |
| 7745 | | LoginAuthResponse |
| 7746 | | ListProvidersResponse |
| 7747 | | SetProviderResponse |
| 7748 | | DisableProviderResponse |
| 7749 | | LogoutAuthResponse |
| 7750 | | NewSessionResponse |
| 7751 | | ListSessionsResponse |
| 7752 | | DeleteSessionResponse |
| 7753 | | ForkSessionResponse |
| 7754 | | ResumeSessionResponse |
| 7755 | | CloseSessionResponse |
| 7756 | | SetSessionConfigOptionResponse |
| 7757 | | PromptResponse |
| 7758 | | StartNesResponse |
| 7759 | | SuggestNesResponse |
| 7760 | | CloseNesResponse |
| 7761 | | ExtResponse |
| 7762 | | MessageMcpResponse; |
| 7763 | } |
| 7764 | | { readonly id: RequestId; readonly error: Error }; |
| 7765 | export const AgentResponse = Schema.Union([ |
| 7766 | Schema.Struct({ |
| 7767 | id: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({ |
| 7768 | description: "The id of the request this response answers.", |
| 7769 | }), |
| 7770 | result: Schema.Union([ |
| 7771 | Schema.suspend((): Schema.Codec<InitializeResponse> => InitializeResponse).annotate({ |
| 7772 | title: "InitializeResponse", |
| 7773 | description: "Successful result returned for a `initialize` request.", |
| 7774 | }), |
| 7775 | Schema.suspend((): Schema.Codec<LoginAuthResponse> => LoginAuthResponse).annotate({ |
| 7776 | title: "LoginAuthResponse", |
| 7777 | description: "Successful result returned for an `auth/login` request.", |
| 7778 | }), |
| 7779 | Schema.suspend((): Schema.Codec<ListProvidersResponse> => ListProvidersResponse).annotate({ |
| 7780 | title: "ListProvidersResponse", |
| 7781 | description: "Successful result returned for a `providers/list` request.", |
| 7782 | }), |
| 7783 | Schema.suspend((): Schema.Codec<SetProviderResponse> => SetProviderResponse).annotate({ |
| 7784 | title: "SetProviderResponse", |
| 7785 | description: "Successful result returned for a `providers/set` request.", |
| 7786 | }), |
| 7787 | Schema.suspend((): Schema.Codec<DisableProviderResponse> => DisableProviderResponse).annotate( |
| 7788 | { |
| 7789 | title: "DisableProviderResponse", |
| 7790 | description: "Successful result returned for a `providers/disable` request.", |
| 7791 | }, |
| 7792 | ), |
| 7793 | Schema.suspend((): Schema.Codec<LogoutAuthResponse> => LogoutAuthResponse).annotate({ |
| 7794 | title: "LogoutAuthResponse", |
| 7795 | description: "Successful result returned for an `auth/logout` request.", |
| 7796 | }), |
| 7797 | Schema.suspend((): Schema.Codec<NewSessionResponse> => NewSessionResponse).annotate({ |
| 7798 | title: "NewSessionResponse", |
| 7799 | description: "Successful result returned for a `session/new` request.", |
| 7800 | }), |
| 7801 | Schema.suspend((): Schema.Codec<ListSessionsResponse> => ListSessionsResponse).annotate({ |
| 7802 | title: "ListSessionsResponse", |
| 7803 | description: "Successful result returned for a `session/list` request.", |
| 7804 | }), |
| 7805 | Schema.suspend((): Schema.Codec<DeleteSessionResponse> => DeleteSessionResponse).annotate({ |
| 7806 | title: "DeleteSessionResponse", |
| 7807 | description: "Successful result returned for a `session/delete` request.", |
| 7808 | }), |
| 7809 | Schema.suspend((): Schema.Codec<ForkSessionResponse> => ForkSessionResponse).annotate({ |
| 7810 | title: "ForkSessionResponse", |
| 7811 | description: "Successful result returned for a `session/fork` request.", |
| 7812 | }), |
| 7813 | Schema.suspend((): Schema.Codec<ResumeSessionResponse> => ResumeSessionResponse).annotate({ |
| 7814 | title: "ResumeSessionResponse", |
| 7815 | description: "Successful result returned for a `session/resume` request.", |
| 7816 | }), |
| 7817 | Schema.suspend((): Schema.Codec<CloseSessionResponse> => CloseSessionResponse).annotate({ |
| 7818 | title: "CloseSessionResponse", |
| 7819 | description: "Successful result returned for a `session/close` request.", |
| 7820 | }), |
| 7821 | Schema.suspend( |
| 7822 | (): Schema.Codec<SetSessionConfigOptionResponse> => SetSessionConfigOptionResponse, |
| 7823 | ).annotate({ |
| 7824 | title: "SetSessionConfigOptionResponse", |
| 7825 | description: "Successful result returned for a `session/set_config_option` request.", |
| 7826 | }), |
| 7827 | Schema.suspend((): Schema.Codec<PromptResponse> => PromptResponse).annotate({ |
| 7828 | title: "PromptResponse", |
| 7829 | description: "Successful result returned for a `session/prompt` request.", |
| 7830 | }), |
| 7831 | Schema.suspend((): Schema.Codec<StartNesResponse> => StartNesResponse).annotate({ |
| 7832 | title: "StartNesResponse", |
| 7833 | description: "Successful result returned for a `nes/start` request.", |
| 7834 | }), |
| 7835 | Schema.suspend((): Schema.Codec<SuggestNesResponse> => SuggestNesResponse).annotate({ |
| 7836 | title: "SuggestNesResponse", |
| 7837 | description: "Successful result returned for a `nes/suggest` request.", |
| 7838 | }), |
| 7839 | Schema.suspend((): Schema.Codec<CloseNesResponse> => CloseNesResponse).annotate({ |
| 7840 | title: "CloseNesResponse", |
| 7841 | description: "Successful result returned for a `nes/close` request.", |
| 7842 | }), |
| 7843 | Schema.suspend((): Schema.Codec<ExtResponse> => ExtResponse).annotate({ |
| 7844 | title: "ExtMethodResponse", |
| 7845 | description: |
| 7846 | "Successful result returned by an extension method outside the core ACP method set.", |
| 7847 | }), |
| 7848 | Schema.suspend((): Schema.Codec<MessageMcpResponse> => MessageMcpResponse).annotate({ |
| 7849 | title: "MessageMcpResponse", |
| 7850 | description: "Successful result returned by an MCP-over-ACP `mcp/message` request.", |
| 7851 | }), |
| 7852 | ]).annotate({ description: "Method-specific response data." }), |
| 7853 | }).annotate({ title: "Result", description: "A successful JSON-RPC response." }), |
| 7854 | Schema.Struct({ |
| 7855 | id: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({ |
| 7856 | description: "The id of the request this response answers.", |
| 7857 | }), |
| 7858 | error: Schema.suspend((): Schema.Codec<Error> => Error).annotate({ |
| 7859 | description: "Method-specific error data.", |
| 7860 | }), |
| 7861 | }).annotate({ title: "Error", description: "A failed JSON-RPC response." }), |
| 7862 | ]).annotate({ description: "A JSON-RPC response object." }); |
| 7863 | |
| 7864 | export type AgentThought = { |
| 7865 | readonly messageId: MessageId; |
| 7866 | readonly content?: ReadonlyArray<ContentBlock> | null; |
| 7867 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 7868 | }; |
| 7869 | export const AgentThought = Schema.Struct({ |
| 7870 | messageId: Schema.suspend((): Schema.Codec<MessageId> => MessageId).annotate({ |
| 7871 | description: "A unique identifier for the thought message.", |
| 7872 | }), |
| 7873 | content: Schema.optionalKey( |
| 7874 | Schema.Union([ |
| 7875 | Schema.Array(ContentBlock).annotate({ |
| 7876 | description: "Complete replacement content for this thought message.", |
| 7877 | }), |
| 7878 | Schema.Null, |
| 7879 | ]), |
| 7880 | ), |
| 7881 | _meta: Schema.optionalKey( |
| 7882 | Schema.Union([ |
| 7883 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7884 | description: |
| 7885 | "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. Omitted means no metadata update; `null` is an explicit clear signal.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 7886 | }), |
| 7887 | Schema.Null, |
| 7888 | ]), |
| 7889 | ), |
| 7890 | }).annotate({ |
| 7891 | description: |
| 7892 | "An agent thought or reasoning message upsert.\n\nOnly [`AgentThought::message_id`] is required. `content` has patch semantics:\nan omitted field leaves existing thought content unchanged, `null` clears the\nvalue, and a concrete array replaces the previous value. For a new\n`messageId`, omitted fields use client defaults. `content` is replaced as a\nwhole array; send `[]` or `null` to clear it.\n\nMessage updates and chunks are applied in the order they are received. When\nan `agent_thought` update includes `content`, that array replaces any\ncontent previously accumulated for the thought, including content from\nearlier chunks. Later chunks with the same `messageId` append to the current\ncontent.", |
| 7893 | }); |
| 7894 | |
| 7895 | export type AudioContent = { |
| 7896 | readonly data: string; |
| 7897 | readonly mimeType: MediaType; |
| 7898 | readonly annotations?: Annotations | null; |
| 7899 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 7900 | }; |
| 7901 | export const AudioContent = Schema.Struct({ |
| 7902 | data: Schema.String.annotate({ |
| 7903 | description: "Base64-encoded media payload.", |
| 7904 | contentEncoding: "base64", |
| 7905 | }), |
| 7906 | mimeType: Schema.suspend((): Schema.Codec<MediaType> => MediaType).annotate({ |
| 7907 | description: "MIME type describing the encoded media payload.", |
| 7908 | }), |
| 7909 | annotations: Schema.optionalKey( |
| 7910 | Schema.Union([Annotations, Schema.Null]).annotate({ |
| 7911 | description: |
| 7912 | "Optional annotations that help clients decide how to display or route this content.", |
| 7913 | }), |
| 7914 | ), |
| 7915 | _meta: Schema.optionalKey( |
| 7916 | Schema.Union([ |
| 7917 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7918 | description: |
| 7919 | "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/v2/draft/extensibility)", |
| 7920 | }), |
| 7921 | Schema.Null, |
| 7922 | ]), |
| 7923 | ), |
| 7924 | }).annotate({ description: "Audio provided to or from an LLM." }); |
| 7925 | |
| 7926 | export type AuthMethodAgent = { |
| 7927 | readonly methodId: AuthMethodId; |
| 7928 | readonly name: string; |
| 7929 | readonly description?: string | null; |
| 7930 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 7931 | }; |
| 7932 | export const AuthMethodAgent = Schema.Struct({ |
| 7933 | methodId: Schema.suspend((): Schema.Codec<AuthMethodId> => AuthMethodId).annotate({ |
| 7934 | description: "Unique identifier for this authentication method.", |
| 7935 | }), |
| 7936 | name: Schema.String.annotate({ |
| 7937 | description: "Human-readable name of the authentication method.", |
| 7938 | }), |
| 7939 | description: Schema.optionalKey( |
| 7940 | Schema.Union([ |
| 7941 | Schema.String.annotate({ |
| 7942 | description: |
| 7943 | "Optional description providing more details about this authentication method.", |
| 7944 | }), |
| 7945 | Schema.Null, |
| 7946 | ]), |
| 7947 | ), |
| 7948 | _meta: Schema.optionalKey( |
| 7949 | Schema.Union([ |
| 7950 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 7951 | description: |
| 7952 | "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/v2/draft/extensibility)", |
| 7953 | }), |
| 7954 | Schema.Null, |
| 7955 | ]), |
| 7956 | ), |
| 7957 | }).annotate({ |
| 7958 | description: |
| 7959 | "Agent handles authentication itself through `auth/login`.\n\nThe `type` discriminator value is `agent`.", |
| 7960 | }); |
| 7961 | |
| 7962 | export type AuthMethodTerminal = { |
| 7963 | readonly methodId: AuthMethodId; |
| 7964 | readonly name: string; |
| 7965 | readonly description?: string | null; |
| 7966 | readonly args?: ReadonlyArray<string>; |
| 7967 | readonly env?: ReadonlyArray<EnvVariable>; |
| 7968 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 7969 | }; |
| 7970 | export const AuthMethodTerminal = Schema.Struct({ |
| 7971 | methodId: Schema.suspend((): Schema.Codec<AuthMethodId> => AuthMethodId).annotate({ |
| 7972 | description: "Unique identifier for this authentication method.", |
| 7973 | }), |
| 7974 | name: Schema.String.annotate({ |
| 7975 | description: "Human-readable name of the authentication method.", |
| 7976 | }), |
| 7977 | description: Schema.optionalKey( |
| 7978 | Schema.Union([ |
| 7979 | Schema.String.annotate({ |
| 7980 | description: |
| 7981 | "Optional description providing more details about this authentication method.", |
| 7982 | }), |
| 7983 | Schema.Null, |
| 7984 | ]), |
| 7985 | ), |
| 7986 | args: Schema.optionalKey( |
| 7987 | Schema.Array(Schema.String).annotate({ |
| 7988 | description: |
| 7989 | "Additional arguments to append to the configured agent invocation for terminal auth.", |
| 7990 | }), |
| 7991 | ), |
| 7992 | env: Schema.optionalKey( |
| 7993 | Schema.Array(EnvVariable).annotate({ |
| 7994 | description: |
| 7995 | "Additional environment variables to set on the configured agent invocation for terminal auth.\nNames MUST be unique. These values override same-named variables in the\nbase launch configuration.", |
| 7996 | }), |
| 7997 | ), |
| 7998 | _meta: Schema.optionalKey( |
| 7999 | Schema.Union([ |
| 8000 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 8001 | description: |
| 8002 | "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/v2/draft/extensibility)", |
| 8003 | }), |
| 8004 | Schema.Null, |
| 8005 | ]), |
| 8006 | ), |
| 8007 | }).annotate({ |
| 8008 | description: |
| 8009 | "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 `auth/login`.", |
| 8010 | }); |
| 8011 | |
| 8012 | export type AvailableCommandsUpdate = { |
| 8013 | readonly availableCommands: ReadonlyArray<AvailableCommand>; |
| 8014 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 8015 | }; |
| 8016 | export const AvailableCommandsUpdate = Schema.Struct({ |
| 8017 | availableCommands: Schema.Array(AvailableCommand).annotate({ |
| 8018 | description: "Commands the agent can execute.", |
| 8019 | }), |
| 8020 | _meta: Schema.optionalKey( |
| 8021 | Schema.Union([ |
| 8022 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 8023 | description: |
| 8024 | "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/v2/draft/extensibility)", |
| 8025 | }), |
| 8026 | Schema.Null, |
| 8027 | ]), |
| 8028 | ), |
| 8029 | }).annotate({ description: "Available commands are ready or have changed" }); |
| 8030 | |
| 8031 | export type BooleanPropertySchema = { |
| 8032 | readonly title?: string | null; |
| 8033 | readonly description?: string | null; |
| 8034 | readonly default?: boolean | null; |
| 8035 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 8036 | }; |
| 8037 | export const BooleanPropertySchema = Schema.Struct({ |
| 8038 | title: Schema.optionalKey( |
| 8039 | Schema.Union([ |
| 8040 | Schema.String.annotate({ |
| 8041 | description: |
| 8042 | "Optional title for the property.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.", |
| 8043 | }), |
| 8044 | Schema.Null, |
| 8045 | ]), |
| 8046 | ), |
| 8047 | description: Schema.optionalKey( |
| 8048 | Schema.Union([ |
| 8049 | Schema.String.annotate({ |
| 8050 | description: |
| 8051 | "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.", |
| 8052 | }), |
| 8053 | Schema.Null, |
| 8054 | ]), |
| 8055 | ), |
| 8056 | default: Schema.optionalKey( |
| 8057 | Schema.Union([ |
| 8058 | Schema.Boolean.annotate({ |
| 8059 | description: |
| 8060 | "Default value.\n\nOptional. Omitted and `null` are equivalent and mean no default value is provided.", |
| 8061 | }), |
| 8062 | Schema.Null, |
| 8063 | ]), |
| 8064 | ), |
| 8065 | _meta: Schema.optionalKey( |
| 8066 | Schema.Union([ |
| 8067 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 8068 | description: |
| 8069 | "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/v2/draft/extensibility)", |
| 8070 | }), |
| 8071 | Schema.Null, |
| 8072 | ]), |
| 8073 | ), |
| 8074 | }).annotate({ description: "Schema for boolean properties in an elicitation form." }); |
| 8075 | |
| 8076 | export type ClientNotification = { |
| 8077 | readonly method: string; |
| 8078 | readonly params?: |
| 8079 | | CancelSessionNotification |
| 8080 | | DidOpenDocumentNotification |
| 8081 | | DidChangeDocumentNotification |
| 8082 | | DidCloseDocumentNotification |
| 8083 | | DidSaveDocumentNotification |
| 8084 | | DidFocusDocumentNotification |
| 8085 | | AcceptNesNotification |
| 8086 | | RejectNesNotification |
| 8087 | | MessageMcpNotification |
| 8088 | | ExtNotification |
| 8089 | | null; |
| 8090 | }; |
| 8091 | export const ClientNotification = Schema.Struct({ |
| 8092 | method: Schema.String.annotate({ description: "The notification method name." }), |
| 8093 | params: Schema.optionalKey( |
| 8094 | Schema.Union([ |
| 8095 | Schema.Union([ |
| 8096 | Schema.suspend( |
| 8097 | (): Schema.Codec<CancelSessionNotification> => CancelSessionNotification, |
| 8098 | ).annotate({ |
| 8099 | title: "CancelSessionNotification", |
| 8100 | description: |
| 8101 | "Cancels ongoing operations for a session.\n\nThis is a notification sent by the client to cancel active work in a\nsession.\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- Report an idle `state_update` with `StopReason::Cancelled` after\n cancellation succeeds\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/v2/draft/prompt-lifecycle#cancellation)", |
| 8102 | }), |
| 8103 | Schema.suspend( |
| 8104 | (): Schema.Codec<DidOpenDocumentNotification> => DidOpenDocumentNotification, |
| 8105 | ).annotate({ |
| 8106 | title: "DidOpenDocumentNotification", |
| 8107 | description: "**UNSTABLE**\n\nNotification sent when a file is opened in the editor.", |
| 8108 | }), |
| 8109 | Schema.suspend( |
| 8110 | (): Schema.Codec<DidChangeDocumentNotification> => DidChangeDocumentNotification, |
| 8111 | ).annotate({ |
| 8112 | title: "DidChangeDocumentNotification", |
| 8113 | description: "**UNSTABLE**\n\nNotification sent when a file is edited.", |
| 8114 | }), |
| 8115 | Schema.suspend( |
| 8116 | (): Schema.Codec<DidCloseDocumentNotification> => DidCloseDocumentNotification, |
| 8117 | ).annotate({ |
| 8118 | title: "DidCloseDocumentNotification", |
| 8119 | description: "**UNSTABLE**\n\nNotification sent when a file is closed.", |
| 8120 | }), |
| 8121 | Schema.suspend( |
| 8122 | (): Schema.Codec<DidSaveDocumentNotification> => DidSaveDocumentNotification, |
| 8123 | ).annotate({ |
| 8124 | title: "DidSaveDocumentNotification", |
| 8125 | description: "**UNSTABLE**\n\nNotification sent when a file is saved.", |
| 8126 | }), |
| 8127 | Schema.suspend( |
| 8128 | (): Schema.Codec<DidFocusDocumentNotification> => DidFocusDocumentNotification, |
| 8129 | ).annotate({ |
| 8130 | title: "DidFocusDocumentNotification", |
| 8131 | description: |
| 8132 | "**UNSTABLE**\n\nNotification sent when a file becomes the active editor tab.", |
| 8133 | }), |
| 8134 | Schema.suspend((): Schema.Codec<AcceptNesNotification> => AcceptNesNotification).annotate({ |
| 8135 | title: "AcceptNesNotification", |
| 8136 | description: "**UNSTABLE**\n\nNotification sent when a suggestion is accepted.", |
| 8137 | }), |
| 8138 | Schema.suspend((): Schema.Codec<RejectNesNotification> => RejectNesNotification).annotate({ |
| 8139 | title: "RejectNesNotification", |
| 8140 | description: "**UNSTABLE**\n\nNotification sent when a suggestion is rejected.", |
| 8141 | }), |
| 8142 | Schema.suspend((): Schema.Codec<MessageMcpNotification> => MessageMcpNotification).annotate( |
| 8143 | { |
| 8144 | title: "MessageMcpNotification", |
| 8145 | description: |
| 8146 | "**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.", |
| 8147 | }, |
| 8148 | ), |
| 8149 | Schema.suspend((): Schema.Codec<ExtNotification> => ExtNotification).annotate({ |
| 8150 | title: "ExtNotification", |
| 8151 | description: |
| 8152 | "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/v2/draft/extensibility)", |
| 8153 | }), |
| 8154 | ]).annotate({ |
| 8155 | description: |
| 8156 | "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.", |
| 8157 | }), |
| 8158 | Schema.Null, |
| 8159 | ]).annotate({ description: "Method-specific notification parameters." }), |
| 8160 | ), |
| 8161 | }).annotate({ description: "A JSON-RPC notification object." }); |
| 8162 | |
| 8163 | export type ClientRequest = { |
| 8164 | readonly id: RequestId; |
| 8165 | readonly method: string; |
| 8166 | readonly params?: |
| 8167 | | InitializeRequest |
| 8168 | | LoginAuthRequest |
| 8169 | | ListProvidersRequest |
| 8170 | | SetProviderRequest |
| 8171 | | DisableProviderRequest |
| 8172 | | LogoutAuthRequest |
| 8173 | | NewSessionRequest |
| 8174 | | ListSessionsRequest |
| 8175 | | DeleteSessionRequest |
| 8176 | | ForkSessionRequest |
| 8177 | | ResumeSessionRequest |
| 8178 | | CloseSessionRequest |
| 8179 | | SetSessionConfigOptionRequest |
| 8180 | | PromptRequest |
| 8181 | | StartNesRequest |
| 8182 | | SuggestNesRequest |
| 8183 | | CloseNesRequest |
| 8184 | | MessageMcpRequest |
| 8185 | | ExtRequest |
| 8186 | | null; |
| 8187 | }; |
| 8188 | export const ClientRequest = Schema.Struct({ |
| 8189 | id: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({ |
| 8190 | description: "The request id used to correlate the matching response.", |
| 8191 | }), |
| 8192 | method: Schema.String.annotate({ description: "The method name to invoke." }), |
| 8193 | params: Schema.optionalKey( |
| 8194 | Schema.Union([ |
| 8195 | Schema.Union([ |
| 8196 | Schema.suspend((): Schema.Codec<InitializeRequest> => InitializeRequest).annotate({ |
| 8197 | title: "InitializeRequest", |
| 8198 | description: |
| 8199 | "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/v2/draft/initialization)", |
| 8200 | }), |
| 8201 | Schema.suspend((): Schema.Codec<LoginAuthRequest> => LoginAuthRequest).annotate({ |
| 8202 | title: "LoginAuthRequest", |
| 8203 | description: |
| 8204 | "Authenticates the client using the specified authentication method.\n\nAgents MUST support this method when their `initialize` response advertised\nat least one valid authentication method. Clients MUST call this method only\nwith a method whose type defines a protocol-driven login flow, and MUST NOT\ncall it when `authMethods` was omitted or empty.\n\nCalled when the agent requires authentication before allowing session creation.\nThe client provides the authentication method ID that was advertised during initialization.\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/v2/draft/initialization)", |
| 8205 | }), |
| 8206 | Schema.suspend((): Schema.Codec<ListProvidersRequest> => ListProvidersRequest).annotate({ |
| 8207 | title: "ListProvidersRequest", |
| 8208 | description: |
| 8209 | "**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.", |
| 8210 | }), |
| 8211 | Schema.suspend((): Schema.Codec<SetProviderRequest> => SetProviderRequest).annotate({ |
| 8212 | title: "SetProviderRequest", |
| 8213 | description: |
| 8214 | "**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.", |
| 8215 | }), |
| 8216 | Schema.suspend((): Schema.Codec<DisableProviderRequest> => DisableProviderRequest).annotate( |
| 8217 | { |
| 8218 | title: "DisableProviderRequest", |
| 8219 | description: |
| 8220 | "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nDisables a provider.", |
| 8221 | }, |
| 8222 | ), |
| 8223 | Schema.suspend((): Schema.Codec<LogoutAuthRequest> => LogoutAuthRequest).annotate({ |
| 8224 | title: "LogoutAuthRequest", |
| 8225 | description: |
| 8226 | "Logs out of the current authenticated state.\n\nAgents MUST support this method when their `initialize` response advertised\nat least one valid authentication method. Clients MUST NOT call this method\nwhen `authMethods` was omitted or empty.\n\nAfter a successful logout, authentication-gated requests require the\nclient to complete an advertised authentication flow again. There is no\nguarantee about the behavior of already running sessions.", |
| 8227 | }), |
| 8228 | Schema.suspend((): Schema.Codec<NewSessionRequest> => NewSessionRequest).annotate({ |
| 8229 | title: "NewSessionRequest", |
| 8230 | description: |
| 8231 | "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/v2/draft/session-setup)", |
| 8232 | }), |
| 8233 | Schema.suspend((): Schema.Codec<ListSessionsRequest> => ListSessionsRequest).annotate({ |
| 8234 | title: "ListSessionsRequest", |
| 8235 | description: |
| 8236 | "Lists existing sessions known to the agent.\n\nThe agent should return metadata about sessions with optional filtering and pagination support.", |
| 8237 | }), |
| 8238 | Schema.suspend((): Schema.Codec<DeleteSessionRequest> => DeleteSessionRequest).annotate({ |
| 8239 | title: "DeleteSessionRequest", |
| 8240 | description: |
| 8241 | "Deletes an existing session from `session/list`.\n\nThis method is only available if the agent advertises the `session.delete` capability.", |
| 8242 | }), |
| 8243 | Schema.suspend((): Schema.Codec<ForkSessionRequest> => ForkSessionRequest).annotate({ |
| 8244 | title: "ForkSessionRequest", |
| 8245 | description: |
| 8246 | "**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.", |
| 8247 | }), |
| 8248 | Schema.suspend((): Schema.Codec<ResumeSessionRequest> => ResumeSessionRequest).annotate({ |
| 8249 | title: "ResumeSessionRequest", |
| 8250 | description: |
| 8251 | "Resumes an existing session.\n\nThe agent should resume the session context, allowing the conversation\nto continue. If `replayFrom` is set, the agent should replay\nconversation history before responding.", |
| 8252 | }), |
| 8253 | Schema.suspend((): Schema.Codec<CloseSessionRequest> => CloseSessionRequest).annotate({ |
| 8254 | title: "CloseSessionRequest", |
| 8255 | description: |
| 8256 | "Closes an active session and frees up any resources associated with it.\n\nThe agent must cancel any ongoing work (as if `session/cancel` was called)\nand then free up any resources associated with the session.", |
| 8257 | }), |
| 8258 | Schema.suspend( |
| 8259 | (): Schema.Codec<SetSessionConfigOptionRequest> => SetSessionConfigOptionRequest, |
| 8260 | ).annotate({ |
| 8261 | title: "SetSessionConfigOptionRequest", |
| 8262 | description: "Sets the current value for a session configuration option.", |
| 8263 | }), |
| 8264 | Schema.suspend((): Schema.Codec<PromptRequest> => PromptRequest).annotate({ |
| 8265 | title: "PromptRequest", |
| 8266 | description: |
| 8267 | "Processes a user prompt within a session.\n\nThis request accepts the prompt:\n- Receives user messages with optional context (files, images, etc.)\n- Returns once the prompt is accepted\n\nAfter acceptance, the Agent reports the accepted user message,\nprocessing state, output, tool calls, and completion through\n`session/update` notifications.\n\nSee protocol docs: [Prompt Lifecycle](https://agentclientprotocol.com/protocol/v2/draft/prompt-lifecycle)", |
| 8268 | }), |
| 8269 | Schema.suspend((): Schema.Codec<StartNesRequest> => StartNesRequest).annotate({ |
| 8270 | title: "StartNesRequest", |
| 8271 | description: |
| 8272 | "**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.", |
| 8273 | }), |
| 8274 | Schema.suspend((): Schema.Codec<SuggestNesRequest> => SuggestNesRequest).annotate({ |
| 8275 | title: "SuggestNesRequest", |
| 8276 | description: |
| 8277 | "**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.", |
| 8278 | }), |
| 8279 | Schema.suspend((): Schema.Codec<CloseNesRequest> => CloseNesRequest).annotate({ |
| 8280 | title: "CloseNesRequest", |
| 8281 | description: |
| 8282 | "**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.", |
| 8283 | }), |
| 8284 | Schema.suspend((): Schema.Codec<MessageMcpRequest> => MessageMcpRequest).annotate({ |
| 8285 | title: "MessageMcpRequest", |
| 8286 | description: |
| 8287 | "**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.", |
| 8288 | }), |
| 8289 | Schema.suspend((): Schema.Codec<ExtRequest> => ExtRequest).annotate({ |
| 8290 | title: "ExtMethodRequest", |
| 8291 | description: |
| 8292 | "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/v2/draft/extensibility)", |
| 8293 | }), |
| 8294 | ]).annotate({ |
| 8295 | description: |
| 8296 | "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.", |
| 8297 | }), |
| 8298 | Schema.Null, |
| 8299 | ]).annotate({ description: "Method-specific request parameters." }), |
| 8300 | ), |
| 8301 | }).annotate({ description: "A JSON-RPC request object." }); |
| 8302 | |
| 8303 | export type ClientResponse = |
| 8304 | | { |
| 8305 | readonly id: RequestId; |
| 8306 | readonly result: |
| 8307 | | RequestPermissionResponse |
| 8308 | | CreateElicitationResponse |
| 8309 | | ConnectMcpResponse |
| 8310 | | DisconnectMcpResponse |
| 8311 | | MessageMcpResponse |
| 8312 | | ExtResponse; |
| 8313 | } |
| 8314 | | { readonly id: RequestId; readonly error: Error }; |
| 8315 | export const ClientResponse = Schema.Union([ |
| 8316 | Schema.Struct({ |
| 8317 | id: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({ |
| 8318 | description: "The id of the request this response answers.", |
| 8319 | }), |
| 8320 | result: Schema.Union([ |
| 8321 | Schema.suspend( |
| 8322 | (): Schema.Codec<RequestPermissionResponse> => RequestPermissionResponse, |
| 8323 | ).annotate({ |
| 8324 | title: "RequestPermissionResponse", |
| 8325 | description: "Successful result returned for a `session/request_permission` request.", |
| 8326 | }), |
| 8327 | Schema.suspend( |
| 8328 | (): Schema.Codec<CreateElicitationResponse> => CreateElicitationResponse, |
| 8329 | ).annotate({ |
| 8330 | title: "CreateElicitationResponse", |
| 8331 | description: "Successful result returned for a `elicitation/create` request.", |
| 8332 | }), |
| 8333 | Schema.suspend((): Schema.Codec<ConnectMcpResponse> => ConnectMcpResponse).annotate({ |
| 8334 | title: "ConnectMcpResponse", |
| 8335 | description: "Successful result returned for a `mcp/connect` request.", |
| 8336 | }), |
| 8337 | Schema.suspend((): Schema.Codec<DisconnectMcpResponse> => DisconnectMcpResponse).annotate({ |
| 8338 | title: "DisconnectMcpResponse", |
| 8339 | description: "Successful result returned for a `mcp/disconnect` request.", |
| 8340 | }), |
| 8341 | Schema.suspend((): Schema.Codec<MessageMcpResponse> => MessageMcpResponse).annotate({ |
| 8342 | title: "MessageMcpResponse", |
| 8343 | description: "Successful result returned by an MCP-over-ACP `mcp/message` request.", |
| 8344 | }), |
| 8345 | Schema.suspend((): Schema.Codec<ExtResponse> => ExtResponse).annotate({ |
| 8346 | title: "ExtMethodResponse", |
| 8347 | description: |
| 8348 | "Successful result returned by an extension method outside the core ACP method set.", |
| 8349 | }), |
| 8350 | ]).annotate({ description: "Method-specific response data." }), |
| 8351 | }).annotate({ title: "Result", description: "A successful JSON-RPC response." }), |
| 8352 | Schema.Struct({ |
| 8353 | id: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({ |
| 8354 | description: "The id of the request this response answers.", |
| 8355 | }), |
| 8356 | error: Schema.suspend((): Schema.Codec<Error> => Error).annotate({ |
| 8357 | description: "Method-specific error data.", |
| 8358 | }), |
| 8359 | }).annotate({ title: "Error", description: "A failed JSON-RPC response." }), |
| 8360 | ]).annotate({ description: "A JSON-RPC response object." }); |
| 8361 | |
| 8362 | export type CommandPermissionSubject = { |
| 8363 | readonly command: string; |
| 8364 | readonly cwd: AbsolutePath; |
| 8365 | readonly toolCallId?: ToolCallId | null; |
| 8366 | readonly terminalId?: TerminalId | null; |
| 8367 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 8368 | }; |
| 8369 | export const CommandPermissionSubject = Schema.Struct({ |
| 8370 | command: Schema.String.annotate({ |
| 8371 | description: "The command that would be run if permission is granted.", |
| 8372 | }), |
| 8373 | cwd: Schema.suspend((): Schema.Codec<AbsolutePath> => AbsolutePath).annotate({ |
| 8374 | description: "The absolute working directory for the command.", |
| 8375 | }), |
| 8376 | toolCallId: Schema.optionalKey( |
| 8377 | Schema.Union([ToolCallId, Schema.Null]).annotate({ |
| 8378 | description: "The associated tool call, when known. Omitted and `null` are equivalent.", |
| 8379 | }), |
| 8380 | ), |
| 8381 | terminalId: Schema.optionalKey( |
| 8382 | Schema.Union([TerminalId, Schema.Null]).annotate({ |
| 8383 | description: |
| 8384 | "The associated terminal, when already known. Omitted and `null` are equivalent.", |
| 8385 | }), |
| 8386 | ), |
| 8387 | _meta: Schema.optionalKey( |
| 8388 | Schema.Union([ |
| 8389 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 8390 | description: |
| 8391 | "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. Omitted and `null` are equivalent and mean no subject metadata was provided.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 8392 | }), |
| 8393 | Schema.Null, |
| 8394 | ]), |
| 8395 | ), |
| 8396 | }).annotate({ description: "Permission request details for a command." }); |
| 8397 | |
| 8398 | export type CompactionSummaryChunk = { |
| 8399 | readonly compactionId: CompactionId; |
| 8400 | readonly content: ContentBlock; |
| 8401 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 8402 | }; |
| 8403 | export const CompactionSummaryChunk = Schema.Struct({ |
| 8404 | compactionId: Schema.suspend((): Schema.Codec<CompactionId> => CompactionId).annotate({ |
| 8405 | description: "ID of the compaction whose summary receives this content.", |
| 8406 | }), |
| 8407 | content: Schema.suspend((): Schema.Codec<ContentBlock> => ContentBlock).annotate({ |
| 8408 | description: "One content block to append.", |
| 8409 | }), |
| 8410 | _meta: Schema.optionalKey( |
| 8411 | Schema.Union([ |
| 8412 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 8413 | description: "Metadata scoped to this chunk. Omission and `null` both mean absent.", |
| 8414 | }), |
| 8415 | Schema.Null, |
| 8416 | ]), |
| 8417 | ), |
| 8418 | }).annotate({ |
| 8419 | description: |
| 8420 | "**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.", |
| 8421 | }); |
| 8422 | |
| 8423 | export type CompactionUpdate = { |
| 8424 | readonly compactionId: CompactionId; |
| 8425 | readonly status: CompactionStatus; |
| 8426 | readonly summary?: ReadonlyArray<ContentBlock> | null; |
| 8427 | readonly error?: string | null; |
| 8428 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 8429 | }; |
| 8430 | export const CompactionUpdate = Schema.Struct({ |
| 8431 | compactionId: Schema.suspend((): Schema.Codec<CompactionId> => CompactionId).annotate({ |
| 8432 | description: "The Agent-owned ID of this compaction, unique within the session.", |
| 8433 | }), |
| 8434 | status: Schema.suspend((): Schema.Codec<CompactionStatus> => CompactionStatus).annotate({ |
| 8435 | description: "Current lifecycle status.", |
| 8436 | }), |
| 8437 | summary: Schema.optionalKey( |
| 8438 | Schema.Union([ |
| 8439 | Schema.Array(ContentBlock).annotate({ |
| 8440 | description: "Complete replacement user-displayable summary retained by the compaction.", |
| 8441 | }), |
| 8442 | Schema.Null, |
| 8443 | ]), |
| 8444 | ), |
| 8445 | error: Schema.optionalKey( |
| 8446 | Schema.Union([ |
| 8447 | Schema.String.annotate({ |
| 8448 | description: "Human-readable description of why the compaction failed.", |
| 8449 | }), |
| 8450 | Schema.Null, |
| 8451 | ]), |
| 8452 | ), |
| 8453 | _meta: Schema.optionalKey( |
| 8454 | Schema.Union([ |
| 8455 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 8456 | description: "Extensible metadata patch for this compaction.", |
| 8457 | }), |
| 8458 | Schema.Null, |
| 8459 | ]), |
| 8460 | ), |
| 8461 | }).annotate({ |
| 8462 | description: |
| 8463 | "**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.\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`.", |
| 8464 | }); |
| 8465 | |
| 8466 | export type ConfigOptionUpdate = { |
| 8467 | readonly configOptions: ReadonlyArray<SessionConfigOption>; |
| 8468 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 8469 | }; |
| 8470 | export const ConfigOptionUpdate = Schema.Struct({ |
| 8471 | configOptions: Schema.Array(SessionConfigOption).annotate({ |
| 8472 | description: "The full set of configuration options and their current values.", |
| 8473 | }), |
| 8474 | _meta: Schema.optionalKey( |
| 8475 | Schema.Union([ |
| 8476 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 8477 | description: |
| 8478 | "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/v2/draft/extensibility)", |
| 8479 | }), |
| 8480 | Schema.Null, |
| 8481 | ]), |
| 8482 | ), |
| 8483 | }).annotate({ description: "Session configuration options have been updated." }); |
| 8484 | |
| 8485 | export type Content = { |
| 8486 | readonly content: ContentBlock; |
| 8487 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 8488 | }; |
| 8489 | export const Content = Schema.Struct({ |
| 8490 | content: Schema.suspend((): Schema.Codec<ContentBlock> => ContentBlock).annotate({ |
| 8491 | description: "The actual content block.", |
| 8492 | }), |
| 8493 | _meta: Schema.optionalKey( |
| 8494 | Schema.Union([ |
| 8495 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 8496 | description: |
| 8497 | "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/v2/draft/extensibility)", |
| 8498 | }), |
| 8499 | Schema.Null, |
| 8500 | ]), |
| 8501 | ), |
| 8502 | }).annotate({ description: "Standard content block (text, images, resources)." }); |
| 8503 | |
| 8504 | export type ContentChunk = { |
| 8505 | readonly messageId: MessageId; |
| 8506 | readonly content: ContentBlock; |
| 8507 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 8508 | }; |
| 8509 | export const ContentChunk = Schema.Struct({ |
| 8510 | messageId: Schema.suspend((): Schema.Codec<MessageId> => MessageId).annotate({ |
| 8511 | description: |
| 8512 | "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.", |
| 8513 | }), |
| 8514 | content: Schema.suspend((): Schema.Codec<ContentBlock> => ContentBlock).annotate({ |
| 8515 | description: "A single item of content", |
| 8516 | }), |
| 8517 | _meta: Schema.optionalKey( |
| 8518 | Schema.Union([ |
| 8519 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 8520 | description: |
| 8521 | "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. This field is chunk-scoped.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 8522 | }), |
| 8523 | Schema.Null, |
| 8524 | ]), |
| 8525 | ), |
| 8526 | }).annotate({ description: "A streamed item of message content." }); |
| 8527 | |
| 8528 | export type Diff = { |
| 8529 | readonly changes: ReadonlyArray<DiffChange>; |
| 8530 | readonly patch?: DiffPatch | null; |
| 8531 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 8532 | }; |
| 8533 | export const Diff = Schema.Struct({ |
| 8534 | changes: Schema.Array(DiffChange).annotate({ |
| 8535 | description: |
| 8536 | "Structured file changes described by this diff.\n\nClients can use this field without parsing patch text to determine affected paths.", |
| 8537 | }), |
| 8538 | patch: Schema.optionalKey( |
| 8539 | Schema.Union([DiffPatch, Schema.Null]).annotate({ |
| 8540 | description: |
| 8541 | "Renderable patch text for some or all of the structured changes.\n\nAgents SHOULD provide patch text whenever feasible. Omitted or `null`\nmeans no renderable patch text was provided.", |
| 8542 | }), |
| 8543 | ), |
| 8544 | _meta: Schema.optionalKey( |
| 8545 | Schema.Union([ |
| 8546 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 8547 | description: |
| 8548 | "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/v2/draft/extensibility)", |
| 8549 | }), |
| 8550 | Schema.Null, |
| 8551 | ]), |
| 8552 | ), |
| 8553 | }).annotate({ |
| 8554 | description: |
| 8555 | "File changes produced by a tool call.\n\n`changes` is authoritative for affected absolute paths and operations.\n`patch` optionally carries renderable text for some or all of those changes\nand MUST be consistent with `changes`. Agents SHOULD provide `patch` whenever\nfeasible. Clients MUST handle diffs where `patch` is omitted or `null`.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/v2/draft/tool-calls#content)", |
| 8556 | }); |
| 8557 | |
| 8558 | export type DiffPathChange = { readonly path: AbsolutePath }; |
| 8559 | export const DiffPathChange = Schema.Struct({ |
| 8560 | path: Schema.suspend((): Schema.Codec<AbsolutePath> => AbsolutePath).annotate({ |
| 8561 | description: "Absolute path for the operation.", |
| 8562 | }), |
| 8563 | }).annotate({ description: "Operation metadata for add, delete, and modify changes." }); |
| 8564 | |
| 8565 | export type DiffPathPairChange = { readonly oldPath: AbsolutePath; readonly path: AbsolutePath }; |
| 8566 | export const DiffPathPairChange = Schema.Struct({ |
| 8567 | oldPath: Schema.suspend((): Schema.Codec<AbsolutePath> => AbsolutePath).annotate({ |
| 8568 | description: "Absolute path before the operation.", |
| 8569 | }), |
| 8570 | path: Schema.suspend((): Schema.Codec<AbsolutePath> => AbsolutePath).annotate({ |
| 8571 | description: "Absolute path after the operation.", |
| 8572 | }), |
| 8573 | }).annotate({ description: "Operation metadata for move and copy changes." }); |
| 8574 | |
| 8575 | export type ElicitationAcceptAction = { |
| 8576 | readonly content?: { readonly [x: string]: ElicitationContentValue } | null; |
| 8577 | }; |
| 8578 | export const ElicitationAcceptAction = Schema.Struct({ |
| 8579 | content: Schema.optionalKey( |
| 8580 | Schema.Union([ |
| 8581 | Schema.Record(Schema.String, ElicitationContentValue).annotate({ |
| 8582 | description: |
| 8583 | "The user-provided content, if any, as an object matching the requested schema.", |
| 8584 | }), |
| 8585 | Schema.Null, |
| 8586 | ]), |
| 8587 | ), |
| 8588 | }).annotate({ description: "The user accepted the elicitation and provided content." }); |
| 8589 | |
| 8590 | export type ElicitationFormMode = |
| 8591 | | { |
| 8592 | readonly requestedSchema: ElicitationSchema; |
| 8593 | readonly sessionId: SessionId; |
| 8594 | readonly toolCallId?: ToolCallId | null; |
| 8595 | } |
| 8596 | | { readonly requestedSchema: ElicitationSchema; readonly requestId: RequestId }; |
| 8597 | export const ElicitationFormMode = Schema.Union([ |
| 8598 | Schema.Struct({ |
| 8599 | requestedSchema: Schema.suspend( |
| 8600 | (): Schema.Codec<ElicitationSchema> => ElicitationSchema, |
| 8601 | ).annotate({ description: "A JSON Schema describing the form fields to present to the user." }), |
| 8602 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 8603 | description: "The session this elicitation is tied to.", |
| 8604 | }), |
| 8605 | toolCallId: Schema.optionalKey( |
| 8606 | Schema.Union([ToolCallId, Schema.Null]).annotate({ |
| 8607 | description: |
| 8608 | "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.", |
| 8609 | }), |
| 8610 | ), |
| 8611 | }).annotate({ |
| 8612 | description: |
| 8613 | "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.", |
| 8614 | }), |
| 8615 | Schema.Struct({ |
| 8616 | requestedSchema: Schema.suspend( |
| 8617 | (): Schema.Codec<ElicitationSchema> => ElicitationSchema, |
| 8618 | ).annotate({ description: "A JSON Schema describing the form fields to present to the user." }), |
| 8619 | requestId: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({ |
| 8620 | description: "The request this elicitation is tied to.", |
| 8621 | }), |
| 8622 | }).annotate({ |
| 8623 | description: |
| 8624 | "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).", |
| 8625 | }), |
| 8626 | ]); |
| 8627 | |
| 8628 | export type ElicitationRequestScope = { readonly requestId: RequestId }; |
| 8629 | export const ElicitationRequestScope = Schema.Struct({ |
| 8630 | requestId: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({ |
| 8631 | description: "The request this elicitation is tied to.", |
| 8632 | }), |
| 8633 | }).annotate({ |
| 8634 | description: |
| 8635 | "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).", |
| 8636 | }); |
| 8637 | |
| 8638 | export type ElicitationSessionScope = { |
| 8639 | readonly sessionId: SessionId; |
| 8640 | readonly toolCallId?: ToolCallId | null; |
| 8641 | }; |
| 8642 | export const ElicitationSessionScope = Schema.Struct({ |
| 8643 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 8644 | description: "The session this elicitation is tied to.", |
| 8645 | }), |
| 8646 | toolCallId: Schema.optionalKey( |
| 8647 | Schema.Union([ToolCallId, Schema.Null]).annotate({ |
| 8648 | description: |
| 8649 | "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.", |
| 8650 | }), |
| 8651 | ), |
| 8652 | }).annotate({ |
| 8653 | description: |
| 8654 | "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.", |
| 8655 | }); |
| 8656 | |
| 8657 | export type ElicitationUrlMode = |
| 8658 | | { |
| 8659 | readonly elicitationId: ElicitationId; |
| 8660 | readonly url: string; |
| 8661 | readonly sessionId: SessionId; |
| 8662 | readonly toolCallId?: ToolCallId | null; |
| 8663 | } |
| 8664 | | { readonly elicitationId: ElicitationId; readonly url: string; readonly requestId: RequestId }; |
| 8665 | export const ElicitationUrlMode = Schema.Union([ |
| 8666 | Schema.Struct({ |
| 8667 | elicitationId: Schema.suspend((): Schema.Codec<ElicitationId> => ElicitationId).annotate({ |
| 8668 | description: "The unique identifier for this elicitation.", |
| 8669 | }), |
| 8670 | url: Schema.String.annotate({ description: "The URL to direct the user to.", format: "uri" }), |
| 8671 | sessionId: Schema.suspend((): Schema.Codec<SessionId> => SessionId).annotate({ |
| 8672 | description: "The session this elicitation is tied to.", |
| 8673 | }), |
| 8674 | toolCallId: Schema.optionalKey( |
| 8675 | Schema.Union([ToolCallId, Schema.Null]).annotate({ |
| 8676 | description: |
| 8677 | "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.", |
| 8678 | }), |
| 8679 | ), |
| 8680 | }).annotate({ |
| 8681 | description: |
| 8682 | "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.", |
| 8683 | }), |
| 8684 | Schema.Struct({ |
| 8685 | elicitationId: Schema.suspend((): Schema.Codec<ElicitationId> => ElicitationId).annotate({ |
| 8686 | description: "The unique identifier for this elicitation.", |
| 8687 | }), |
| 8688 | url: Schema.String.annotate({ description: "The URL to direct the user to.", format: "uri" }), |
| 8689 | requestId: Schema.suspend((): Schema.Codec<RequestId> => RequestId).annotate({ |
| 8690 | description: "The request this elicitation is tied to.", |
| 8691 | }), |
| 8692 | }).annotate({ |
| 8693 | description: |
| 8694 | "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).", |
| 8695 | }), |
| 8696 | ]); |
| 8697 | |
| 8698 | export type EmbeddedResource = { |
| 8699 | readonly resource: EmbeddedResourceResource; |
| 8700 | readonly annotations?: Annotations | null; |
| 8701 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 8702 | }; |
| 8703 | export const EmbeddedResource = Schema.Struct({ |
| 8704 | resource: Schema.suspend( |
| 8705 | (): Schema.Codec<EmbeddedResourceResource> => EmbeddedResourceResource, |
| 8706 | ).annotate({ description: "Embedded resource payload, either text or binary data." }), |
| 8707 | annotations: Schema.optionalKey( |
| 8708 | Schema.Union([Annotations, Schema.Null]).annotate({ |
| 8709 | description: |
| 8710 | "Optional annotations that help clients decide how to display or route this content.", |
| 8711 | }), |
| 8712 | ), |
| 8713 | _meta: Schema.optionalKey( |
| 8714 | Schema.Union([ |
| 8715 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 8716 | description: |
| 8717 | "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/v2/draft/extensibility)", |
| 8718 | }), |
| 8719 | Schema.Null, |
| 8720 | ]), |
| 8721 | ), |
| 8722 | }).annotate({ |
| 8723 | description: "The contents of a resource, embedded into a prompt or tool call result.", |
| 8724 | }); |
| 8725 | |
| 8726 | export type IdleStateUpdate = { |
| 8727 | readonly stopReason?: StopReason | null; |
| 8728 | readonly usage?: Usage | null; |
| 8729 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 8730 | }; |
| 8731 | export const IdleStateUpdate = Schema.Struct({ |
| 8732 | stopReason: Schema.optionalKey( |
| 8733 | Schema.Union([StopReason, Schema.Null]).annotate({ |
| 8734 | description: |
| 8735 | "Indicates why foreground work stopped.\n\nOptional. Omitted or `null` both mean the agent is not reporting a stop reason.\nAgents SHOULD include this when the idle transition ends foreground work.", |
| 8736 | }), |
| 8737 | ), |
| 8738 | usage: Schema.optionalKey( |
| 8739 | Schema.Union([Usage, Schema.Null]).annotate({ |
| 8740 | description: |
| 8741 | "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nToken usage for completed foreground work.\n\nOptional. Omitted or `null` both mean the agent is not reporting token\nusage for this state update.", |
| 8742 | }), |
| 8743 | ), |
| 8744 | _meta: Schema.optionalKey( |
| 8745 | Schema.Union([ |
| 8746 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 8747 | description: |
| 8748 | "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/v2/draft/extensibility)", |
| 8749 | }), |
| 8750 | Schema.Null, |
| 8751 | ]), |
| 8752 | ), |
| 8753 | }).annotate({ description: "The agent is ready to process a new prompt." }); |
| 8754 | |
| 8755 | export type ImageContent = { |
| 8756 | readonly data: string; |
| 8757 | readonly mimeType: MediaType; |
| 8758 | readonly uri?: string | null; |
| 8759 | readonly annotations?: Annotations | null; |
| 8760 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 8761 | }; |
| 8762 | export const ImageContent = Schema.Struct({ |
| 8763 | data: Schema.String.annotate({ |
| 8764 | description: "Base64-encoded media payload.", |
| 8765 | contentEncoding: "base64", |
| 8766 | }), |
| 8767 | mimeType: Schema.suspend((): Schema.Codec<MediaType> => MediaType).annotate({ |
| 8768 | description: "MIME type describing the encoded media payload.", |
| 8769 | }), |
| 8770 | uri: Schema.optionalKey( |
| 8771 | Schema.Union([ |
| 8772 | Schema.String.annotate({ |
| 8773 | description: "URI associated with this resource or media payload.", |
| 8774 | format: "uri", |
| 8775 | }), |
| 8776 | Schema.Null, |
| 8777 | ]), |
| 8778 | ), |
| 8779 | annotations: Schema.optionalKey( |
| 8780 | Schema.Union([Annotations, Schema.Null]).annotate({ |
| 8781 | description: |
| 8782 | "Optional annotations that help clients decide how to display or route this content.", |
| 8783 | }), |
| 8784 | ), |
| 8785 | _meta: Schema.optionalKey( |
| 8786 | Schema.Union([ |
| 8787 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 8788 | description: |
| 8789 | "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/v2/draft/extensibility)", |
| 8790 | }), |
| 8791 | Schema.Null, |
| 8792 | ]), |
| 8793 | ), |
| 8794 | }).annotate({ description: "An image provided to or from an LLM." }); |
| 8795 | |
| 8796 | export type IntegerPropertySchema = { |
| 8797 | readonly title?: string | null; |
| 8798 | readonly description?: string | null; |
| 8799 | readonly minimum?: number | null; |
| 8800 | readonly maximum?: number | null; |
| 8801 | readonly default?: number | null; |
| 8802 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 8803 | }; |
| 8804 | export const IntegerPropertySchema = Schema.Struct({ |
| 8805 | title: Schema.optionalKey( |
| 8806 | Schema.Union([ |
| 8807 | Schema.String.annotate({ |
| 8808 | description: |
| 8809 | "Optional title for the property.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.", |
| 8810 | }), |
| 8811 | Schema.Null, |
| 8812 | ]), |
| 8813 | ), |
| 8814 | description: Schema.optionalKey( |
| 8815 | Schema.Union([ |
| 8816 | Schema.String.annotate({ |
| 8817 | description: |
| 8818 | "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.", |
| 8819 | }), |
| 8820 | Schema.Null, |
| 8821 | ]), |
| 8822 | ), |
| 8823 | minimum: Schema.optionalKey( |
| 8824 | Schema.Union([ |
| 8825 | Schema.Number.annotate({ |
| 8826 | description: |
| 8827 | "Minimum value (inclusive).\n\nOptional. Omitted and `null` are equivalent and mean there is no inclusive lower bound.", |
| 8828 | format: "int64", |
| 8829 | }).check(Schema.isInt().annotate({ expected: "an integer" })), |
| 8830 | Schema.Null, |
| 8831 | ]), |
| 8832 | ), |
| 8833 | maximum: Schema.optionalKey( |
| 8834 | Schema.Union([ |
| 8835 | Schema.Number.annotate({ |
| 8836 | description: |
| 8837 | "Maximum value (inclusive).\n\nOptional. Omitted and `null` are equivalent and mean there is no inclusive upper bound.", |
| 8838 | format: "int64", |
| 8839 | }).check(Schema.isInt().annotate({ expected: "an integer" })), |
| 8840 | Schema.Null, |
| 8841 | ]), |
| 8842 | ), |
| 8843 | default: Schema.optionalKey( |
| 8844 | Schema.Union([ |
| 8845 | Schema.Number.annotate({ |
| 8846 | description: |
| 8847 | "Default value.\n\nOptional. Omitted and `null` are equivalent and mean no default value is provided.", |
| 8848 | format: "int64", |
| 8849 | }).check(Schema.isInt().annotate({ expected: "an integer" })), |
| 8850 | Schema.Null, |
| 8851 | ]), |
| 8852 | ), |
| 8853 | _meta: Schema.optionalKey( |
| 8854 | Schema.Union([ |
| 8855 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 8856 | description: |
| 8857 | "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/v2/draft/extensibility)", |
| 8858 | }), |
| 8859 | Schema.Null, |
| 8860 | ]), |
| 8861 | ), |
| 8862 | }).annotate({ description: "Schema for integer properties in an elicitation form." }); |
| 8863 | |
| 8864 | export type McpServerAcp = { |
| 8865 | readonly name: string; |
| 8866 | readonly serverId: McpServerAcpId; |
| 8867 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 8868 | }; |
| 8869 | export const McpServerAcp = Schema.Struct({ |
| 8870 | name: Schema.String.annotate({ description: "Human-readable name identifying this MCP server." }), |
| 8871 | serverId: Schema.suspend((): Schema.Codec<McpServerAcpId> => McpServerAcpId).annotate({ |
| 8872 | description: |
| 8873 | "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.", |
| 8874 | }), |
| 8875 | _meta: Schema.optionalKey( |
| 8876 | Schema.Union([ |
| 8877 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 8878 | description: |
| 8879 | "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/v2/draft/extensibility)", |
| 8880 | }), |
| 8881 | Schema.Null, |
| 8882 | ]), |
| 8883 | ), |
| 8884 | }).annotate({ |
| 8885 | description: |
| 8886 | "**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`.", |
| 8887 | }); |
| 8888 | |
| 8889 | export type McpServerHttp = { |
| 8890 | readonly name: string; |
| 8891 | readonly url: string; |
| 8892 | readonly headers?: ReadonlyArray<HttpHeader>; |
| 8893 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 8894 | }; |
| 8895 | export const McpServerHttp = Schema.Struct({ |
| 8896 | name: Schema.String.annotate({ description: "Human-readable name identifying this MCP server." }), |
| 8897 | url: Schema.String.annotate({ description: "URL to the MCP server.", format: "uri" }), |
| 8898 | headers: Schema.optionalKey( |
| 8899 | Schema.Array(HttpHeader).annotate({ |
| 8900 | description: "HTTP headers to set when making requests to the MCP server.", |
| 8901 | }), |
| 8902 | ), |
| 8903 | _meta: Schema.optionalKey( |
| 8904 | Schema.Union([ |
| 8905 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 8906 | description: |
| 8907 | "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/v2/draft/extensibility)", |
| 8908 | }), |
| 8909 | Schema.Null, |
| 8910 | ]), |
| 8911 | ), |
| 8912 | }).annotate({ description: "HTTP transport configuration for MCP." }); |
| 8913 | |
| 8914 | export type McpServerStdio = { |
| 8915 | readonly name: string; |
| 8916 | readonly command: AbsolutePath; |
| 8917 | readonly args?: ReadonlyArray<string>; |
| 8918 | readonly env?: ReadonlyArray<EnvVariable>; |
| 8919 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 8920 | }; |
| 8921 | export const McpServerStdio = Schema.Struct({ |
| 8922 | name: Schema.String.annotate({ description: "Human-readable name identifying this MCP server." }), |
| 8923 | command: Schema.suspend((): Schema.Codec<AbsolutePath> => AbsolutePath).annotate({ |
| 8924 | description: "Absolute path to the MCP server executable.", |
| 8925 | }), |
| 8926 | args: Schema.optionalKey( |
| 8927 | Schema.Array(Schema.String).annotate({ |
| 8928 | description: "Command-line arguments to pass to the MCP server.", |
| 8929 | }), |
| 8930 | ), |
| 8931 | env: Schema.optionalKey( |
| 8932 | Schema.Array(EnvVariable).annotate({ |
| 8933 | description: "Environment variables to set when launching the MCP server.", |
| 8934 | }), |
| 8935 | ), |
| 8936 | _meta: Schema.optionalKey( |
| 8937 | Schema.Union([ |
| 8938 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 8939 | description: |
| 8940 | "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/v2/draft/extensibility)", |
| 8941 | }), |
| 8942 | Schema.Null, |
| 8943 | ]), |
| 8944 | ), |
| 8945 | }).annotate({ description: "Stdio transport configuration for MCP." }); |
| 8946 | |
| 8947 | export type MultiSelectPropertySchema = { |
| 8948 | readonly title?: string | null; |
| 8949 | readonly description?: string | null; |
| 8950 | readonly minItems?: number | null; |
| 8951 | readonly maxItems?: number | null; |
| 8952 | readonly items: MultiSelectItems; |
| 8953 | readonly default?: ReadonlyArray<string> | null; |
| 8954 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 8955 | }; |
| 8956 | export const MultiSelectPropertySchema = Schema.Struct({ |
| 8957 | title: Schema.optionalKey( |
| 8958 | Schema.Union([ |
| 8959 | Schema.String.annotate({ |
| 8960 | description: |
| 8961 | "Optional title for the property.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.", |
| 8962 | }), |
| 8963 | Schema.Null, |
| 8964 | ]), |
| 8965 | ), |
| 8966 | description: Schema.optionalKey( |
| 8967 | Schema.Union([ |
| 8968 | Schema.String.annotate({ |
| 8969 | description: |
| 8970 | "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.", |
| 8971 | }), |
| 8972 | Schema.Null, |
| 8973 | ]), |
| 8974 | ), |
| 8975 | minItems: Schema.optionalKey( |
| 8976 | Schema.Union([ |
| 8977 | Schema.Number.annotate({ |
| 8978 | description: |
| 8979 | "Minimum number of items to select.\n\nOptional. Omitted and `null` are equivalent and mean there is no minimum selection count.", |
| 8980 | format: "uint64", |
| 8981 | }) |
| 8982 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 8983 | .check( |
| 8984 | Schema.isGreaterThanOrEqualTo(0).annotate({ |
| 8985 | expected: "a value greater than or equal to 0", |
| 8986 | }), |
| 8987 | ), |
| 8988 | Schema.Null, |
| 8989 | ]), |
| 8990 | ), |
| 8991 | maxItems: Schema.optionalKey( |
| 8992 | Schema.Union([ |
| 8993 | Schema.Number.annotate({ |
| 8994 | description: |
| 8995 | "Maximum number of items to select.\n\nOptional. Omitted and `null` are equivalent and mean there is no maximum selection count.", |
| 8996 | format: "uint64", |
| 8997 | }) |
| 8998 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 8999 | .check( |
| 9000 | Schema.isGreaterThanOrEqualTo(0).annotate({ |
| 9001 | expected: "a value greater than or equal to 0", |
| 9002 | }), |
| 9003 | ), |
| 9004 | Schema.Null, |
| 9005 | ]), |
| 9006 | ), |
| 9007 | items: Schema.suspend((): Schema.Codec<MultiSelectItems> => MultiSelectItems).annotate({ |
| 9008 | description: "The items definition describing allowed values.", |
| 9009 | }), |
| 9010 | default: Schema.optionalKey( |
| 9011 | Schema.Union([ |
| 9012 | Schema.Array(Schema.String).annotate({ |
| 9013 | description: |
| 9014 | "Default selected values.\n\nOptional. Omitted and `null` are equivalent and mean no default selections are provided.", |
| 9015 | }), |
| 9016 | Schema.Null, |
| 9017 | ]), |
| 9018 | ), |
| 9019 | _meta: Schema.optionalKey( |
| 9020 | Schema.Union([ |
| 9021 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9022 | description: |
| 9023 | "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/v2/draft/extensibility)", |
| 9024 | }), |
| 9025 | Schema.Null, |
| 9026 | ]), |
| 9027 | ), |
| 9028 | }).annotate({ description: "Schema for multi-select (array) properties in an elicitation form." }); |
| 9029 | |
| 9030 | export type NesEditSuggestion = { |
| 9031 | readonly suggestionId: NesSuggestionId; |
| 9032 | readonly uri: string; |
| 9033 | readonly edits: ReadonlyArray<NesTextEdit>; |
| 9034 | readonly cursorPosition?: Position | null; |
| 9035 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9036 | }; |
| 9037 | export const NesEditSuggestion = Schema.Struct({ |
| 9038 | suggestionId: Schema.suspend((): Schema.Codec<NesSuggestionId> => NesSuggestionId).annotate({ |
| 9039 | description: "Unique identifier for accept/reject tracking.", |
| 9040 | }), |
| 9041 | uri: Schema.String.annotate({ description: "The URI of the file to edit.", format: "uri" }), |
| 9042 | edits: Schema.Array(NesTextEdit) |
| 9043 | .annotate({ description: "The text edits to apply. Must contain at least one edit." }) |
| 9044 | .check(Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" })), |
| 9045 | cursorPosition: Schema.optionalKey( |
| 9046 | Schema.Union([Position, Schema.Null]).annotate({ |
| 9047 | description: "Optional suggested cursor position after applying edits.", |
| 9048 | }), |
| 9049 | ), |
| 9050 | _meta: Schema.optionalKey( |
| 9051 | Schema.Union([ |
| 9052 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9053 | description: |
| 9054 | "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/v2/draft/extensibility)", |
| 9055 | }), |
| 9056 | Schema.Null, |
| 9057 | ]), |
| 9058 | ), |
| 9059 | }).annotate({ description: "A text edit suggestion." }); |
| 9060 | |
| 9061 | export type NesJumpSuggestion = { |
| 9062 | readonly suggestionId: NesSuggestionId; |
| 9063 | readonly uri: string; |
| 9064 | readonly position: Position; |
| 9065 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9066 | }; |
| 9067 | export const NesJumpSuggestion = Schema.Struct({ |
| 9068 | suggestionId: Schema.suspend((): Schema.Codec<NesSuggestionId> => NesSuggestionId).annotate({ |
| 9069 | description: "Unique identifier for accept/reject tracking.", |
| 9070 | }), |
| 9071 | uri: Schema.String.annotate({ description: "The file to navigate to.", format: "uri" }), |
| 9072 | position: Schema.suspend((): Schema.Codec<Position> => Position).annotate({ |
| 9073 | description: "The target position within the file.", |
| 9074 | }), |
| 9075 | _meta: Schema.optionalKey( |
| 9076 | Schema.Union([ |
| 9077 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9078 | description: |
| 9079 | "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/v2/draft/extensibility)", |
| 9080 | }), |
| 9081 | Schema.Null, |
| 9082 | ]), |
| 9083 | ), |
| 9084 | }).annotate({ description: "A jump-to-location suggestion." }); |
| 9085 | |
| 9086 | export type NesRenameSuggestion = { |
| 9087 | readonly suggestionId: NesSuggestionId; |
| 9088 | readonly uri: string; |
| 9089 | readonly position: Position; |
| 9090 | readonly newName: string; |
| 9091 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9092 | }; |
| 9093 | export const NesRenameSuggestion = Schema.Struct({ |
| 9094 | suggestionId: Schema.suspend((): Schema.Codec<NesSuggestionId> => NesSuggestionId).annotate({ |
| 9095 | description: "Unique identifier for accept/reject tracking.", |
| 9096 | }), |
| 9097 | uri: Schema.String.annotate({ |
| 9098 | description: "The file URI containing the symbol.", |
| 9099 | format: "uri", |
| 9100 | }), |
| 9101 | position: Schema.suspend((): Schema.Codec<Position> => Position).annotate({ |
| 9102 | description: "The position of the symbol to rename.", |
| 9103 | }), |
| 9104 | newName: Schema.String.annotate({ description: "The new name for the symbol." }), |
| 9105 | _meta: Schema.optionalKey( |
| 9106 | Schema.Union([ |
| 9107 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9108 | description: |
| 9109 | "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/v2/draft/extensibility)", |
| 9110 | }), |
| 9111 | Schema.Null, |
| 9112 | ]), |
| 9113 | ), |
| 9114 | }).annotate({ description: "A rename symbol suggestion." }); |
| 9115 | |
| 9116 | export type NesSearchAndReplaceSuggestion = { |
| 9117 | readonly suggestionId: NesSuggestionId; |
| 9118 | readonly uri: string; |
| 9119 | readonly search: string; |
| 9120 | readonly replace: string; |
| 9121 | readonly isRegex?: boolean | null; |
| 9122 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9123 | }; |
| 9124 | export const NesSearchAndReplaceSuggestion = Schema.Struct({ |
| 9125 | suggestionId: Schema.suspend((): Schema.Codec<NesSuggestionId> => NesSuggestionId).annotate({ |
| 9126 | description: "Unique identifier for accept/reject tracking.", |
| 9127 | }), |
| 9128 | uri: Schema.String.annotate({ description: "The file URI to search within.", format: "uri" }), |
| 9129 | search: Schema.String.annotate({ description: "The text or pattern to find." }), |
| 9130 | replace: Schema.String.annotate({ description: "The replacement text." }), |
| 9131 | isRegex: Schema.optionalKey( |
| 9132 | Schema.Union([ |
| 9133 | Schema.Boolean.annotate({ |
| 9134 | description: "Whether `search` is a regular expression. Defaults to `false`.", |
| 9135 | }), |
| 9136 | Schema.Null, |
| 9137 | ]), |
| 9138 | ), |
| 9139 | _meta: Schema.optionalKey( |
| 9140 | Schema.Union([ |
| 9141 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9142 | description: |
| 9143 | "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/v2/draft/extensibility)", |
| 9144 | }), |
| 9145 | Schema.Null, |
| 9146 | ]), |
| 9147 | ), |
| 9148 | }).annotate({ description: "A search-and-replace suggestion." }); |
| 9149 | |
| 9150 | export type NumberPropertySchema = { |
| 9151 | readonly title?: string | null; |
| 9152 | readonly description?: string | null; |
| 9153 | readonly minimum?: number | null; |
| 9154 | readonly maximum?: number | null; |
| 9155 | readonly default?: number | null; |
| 9156 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9157 | }; |
| 9158 | export const NumberPropertySchema = Schema.Struct({ |
| 9159 | title: Schema.optionalKey( |
| 9160 | Schema.Union([ |
| 9161 | Schema.String.annotate({ |
| 9162 | description: |
| 9163 | "Optional title for the property.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.", |
| 9164 | }), |
| 9165 | Schema.Null, |
| 9166 | ]), |
| 9167 | ), |
| 9168 | description: Schema.optionalKey( |
| 9169 | Schema.Union([ |
| 9170 | Schema.String.annotate({ |
| 9171 | description: |
| 9172 | "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.", |
| 9173 | }), |
| 9174 | Schema.Null, |
| 9175 | ]), |
| 9176 | ), |
| 9177 | minimum: Schema.optionalKey( |
| 9178 | Schema.Union([ |
| 9179 | Schema.Number.annotate({ |
| 9180 | description: |
| 9181 | "Minimum value (inclusive).\n\nOptional. Omitted and `null` are equivalent and mean there is no inclusive lower bound.", |
| 9182 | format: "double", |
| 9183 | }).check(Schema.isFinite().annotate({ expected: "a finite number" })), |
| 9184 | Schema.Null, |
| 9185 | ]), |
| 9186 | ), |
| 9187 | maximum: Schema.optionalKey( |
| 9188 | Schema.Union([ |
| 9189 | Schema.Number.annotate({ |
| 9190 | description: |
| 9191 | "Maximum value (inclusive).\n\nOptional. Omitted and `null` are equivalent and mean there is no inclusive upper bound.", |
| 9192 | format: "double", |
| 9193 | }).check(Schema.isFinite().annotate({ expected: "a finite number" })), |
| 9194 | Schema.Null, |
| 9195 | ]), |
| 9196 | ), |
| 9197 | default: Schema.optionalKey( |
| 9198 | Schema.Union([ |
| 9199 | Schema.Number.annotate({ |
| 9200 | description: |
| 9201 | "Default value.\n\nOptional. Omitted and `null` are equivalent and mean no default value is provided.", |
| 9202 | format: "double", |
| 9203 | }).check(Schema.isFinite().annotate({ expected: "a finite number" })), |
| 9204 | Schema.Null, |
| 9205 | ]), |
| 9206 | ), |
| 9207 | _meta: Schema.optionalKey( |
| 9208 | Schema.Union([ |
| 9209 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9210 | description: |
| 9211 | "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/v2/draft/extensibility)", |
| 9212 | }), |
| 9213 | Schema.Null, |
| 9214 | ]), |
| 9215 | ), |
| 9216 | }).annotate({ |
| 9217 | description: "Schema for number (floating-point) properties in an elicitation form.", |
| 9218 | }); |
| 9219 | |
| 9220 | export type PlanFile = { |
| 9221 | readonly planId: PlanId; |
| 9222 | readonly uri: string; |
| 9223 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9224 | }; |
| 9225 | export const PlanFile = Schema.Struct({ |
| 9226 | planId: Schema.suspend((): Schema.Codec<PlanId> => PlanId).annotate({ |
| 9227 | description: "The plan ID to update.", |
| 9228 | }), |
| 9229 | uri: Schema.String.annotate({ |
| 9230 | description: "The URI of the file containing the plan.", |
| 9231 | format: "uri", |
| 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\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 9238 | }), |
| 9239 | Schema.Null, |
| 9240 | ]), |
| 9241 | ), |
| 9242 | }).annotate({ |
| 9243 | description: |
| 9244 | "**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.", |
| 9245 | }); |
| 9246 | |
| 9247 | export type PlanItems = { |
| 9248 | readonly planId: PlanId; |
| 9249 | readonly entries: ReadonlyArray<PlanEntry>; |
| 9250 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9251 | }; |
| 9252 | export const PlanItems = Schema.Struct({ |
| 9253 | planId: Schema.suspend((): Schema.Codec<PlanId> => PlanId).annotate({ |
| 9254 | description: "The plan ID to update.", |
| 9255 | }), |
| 9256 | entries: Schema.Array(PlanEntry).annotate({ |
| 9257 | description: |
| 9258 | "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.", |
| 9259 | }), |
| 9260 | _meta: Schema.optionalKey( |
| 9261 | Schema.Union([ |
| 9262 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9263 | description: |
| 9264 | "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/v2/draft/extensibility)", |
| 9265 | }), |
| 9266 | Schema.Null, |
| 9267 | ]), |
| 9268 | ), |
| 9269 | }).annotate({ description: "A plan represented as structured entries." }); |
| 9270 | |
| 9271 | export type PlanMarkdown = { |
| 9272 | readonly planId: PlanId; |
| 9273 | readonly content: string; |
| 9274 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9275 | }; |
| 9276 | export const PlanMarkdown = Schema.Struct({ |
| 9277 | planId: Schema.suspend((): Schema.Codec<PlanId> => PlanId).annotate({ |
| 9278 | description: "The plan ID to update.", |
| 9279 | }), |
| 9280 | content: Schema.String.annotate({ description: "Markdown content for the plan." }), |
| 9281 | _meta: Schema.optionalKey( |
| 9282 | Schema.Union([ |
| 9283 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9284 | description: |
| 9285 | "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/v2/draft/extensibility)", |
| 9286 | }), |
| 9287 | Schema.Null, |
| 9288 | ]), |
| 9289 | ), |
| 9290 | }).annotate({ |
| 9291 | description: |
| 9292 | "**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.", |
| 9293 | }); |
| 9294 | |
| 9295 | export type PlanRemoved = { |
| 9296 | readonly planId: PlanId; |
| 9297 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9298 | }; |
| 9299 | export const PlanRemoved = Schema.Struct({ |
| 9300 | planId: Schema.suspend((): Schema.Codec<PlanId> => PlanId).annotate({ |
| 9301 | description: "The plan ID to remove.", |
| 9302 | }), |
| 9303 | _meta: Schema.optionalKey( |
| 9304 | Schema.Union([ |
| 9305 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9306 | description: |
| 9307 | "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/v2/draft/extensibility)", |
| 9308 | }), |
| 9309 | Schema.Null, |
| 9310 | ]), |
| 9311 | ), |
| 9312 | }).annotate({ |
| 9313 | description: |
| 9314 | "**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.", |
| 9315 | }); |
| 9316 | |
| 9317 | export type PlanUpdate = { |
| 9318 | readonly plan: PlanUpdateContent; |
| 9319 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9320 | }; |
| 9321 | export const PlanUpdate = Schema.Struct({ |
| 9322 | plan: Schema.suspend((): Schema.Codec<PlanUpdateContent> => PlanUpdateContent).annotate({ |
| 9323 | description: "The updated plan content.", |
| 9324 | }), |
| 9325 | _meta: Schema.optionalKey( |
| 9326 | Schema.Union([ |
| 9327 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9328 | description: |
| 9329 | "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/v2/draft/extensibility)", |
| 9330 | }), |
| 9331 | Schema.Null, |
| 9332 | ]), |
| 9333 | ), |
| 9334 | }).annotate({ description: "A content update for a plan identified by ID." }); |
| 9335 | |
| 9336 | export type ProtocolLevelNotification = { |
| 9337 | readonly method: string; |
| 9338 | readonly params?: CancelRequestNotification | null; |
| 9339 | }; |
| 9340 | export const ProtocolLevelNotification = Schema.Struct({ |
| 9341 | method: Schema.String.annotate({ description: "The notification method name." }), |
| 9342 | params: Schema.optionalKey( |
| 9343 | Schema.Union([ |
| 9344 | Schema.Union([ |
| 9345 | Schema.suspend( |
| 9346 | (): Schema.Codec<CancelRequestNotification> => CancelRequestNotification, |
| 9347 | ).annotate({ |
| 9348 | title: "CancelRequestNotification", |
| 9349 | description: |
| 9350 | "Cancels an ongoing request.\n\nThis is a notification sent by the side that sent a request to cancel that request.\n\nUpon receiving this notification, the receiver:\n\n1. MAY cancel the corresponding request activity and all nested activities\n2. MAY send any pending notifications.\n3. MUST send one of these responses for the original request:\n - Valid response with appropriate data (partial results or cancellation marker)\n - Error response with code `-32800` (Cancelled)\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/v2/draft/cancellation)", |
| 9351 | }), |
| 9352 | ]).annotate({ |
| 9353 | description: |
| 9354 | "General protocol-level notifications that all sides are expected to\nimplement.\n\nNotifications whose methods start with '$/' are messages which\nare protocol implementation dependent and might not be implementable in all\nclients or agents. For example if the implementation uses a single threaded\nsynchronous programming language then there is little it can do to react to\na `$/cancel_request` notification. If an agent or client receives\nnotifications starting with '$/' it is free to ignore the notification.\n\nNotifications do not expect a response.", |
| 9355 | }), |
| 9356 | Schema.Null, |
| 9357 | ]).annotate({ description: "Method-specific notification parameters." }), |
| 9358 | ), |
| 9359 | }).annotate({ description: "A JSON-RPC notification object." }); |
| 9360 | |
| 9361 | export type ReplayFromStart = { readonly _meta?: { readonly [x: string]: Schema.Json } | null }; |
| 9362 | export const ReplayFromStart = Schema.Struct({ |
| 9363 | _meta: Schema.optionalKey( |
| 9364 | Schema.Union([ |
| 9365 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9366 | description: |
| 9367 | "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/v2/draft/extensibility)", |
| 9368 | }), |
| 9369 | Schema.Null, |
| 9370 | ]), |
| 9371 | ), |
| 9372 | }).annotate({ |
| 9373 | description: "Inclusive replay cursor requesting replay from the start of the conversation.", |
| 9374 | }); |
| 9375 | |
| 9376 | export type RequiresActionStateUpdate = { |
| 9377 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9378 | }; |
| 9379 | export const RequiresActionStateUpdate = Schema.Struct({ |
| 9380 | _meta: Schema.optionalKey( |
| 9381 | Schema.Union([ |
| 9382 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9383 | description: |
| 9384 | "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/v2/draft/extensibility)", |
| 9385 | }), |
| 9386 | Schema.Null, |
| 9387 | ]), |
| 9388 | ), |
| 9389 | }).annotate({ description: "Foreground work is blocked on user action." }); |
| 9390 | |
| 9391 | export type ResourceLink = { |
| 9392 | readonly name: string; |
| 9393 | readonly uri: string; |
| 9394 | readonly title?: string | null; |
| 9395 | readonly description?: string | null; |
| 9396 | readonly icons?: ReadonlyArray<Icon> | null; |
| 9397 | readonly mimeType?: MediaType | null; |
| 9398 | readonly size?: number | null; |
| 9399 | readonly annotations?: Annotations | null; |
| 9400 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9401 | }; |
| 9402 | export const ResourceLink = Schema.Struct({ |
| 9403 | name: Schema.String.annotate({ |
| 9404 | description: "Human-readable name shown for this protocol object.", |
| 9405 | }), |
| 9406 | uri: Schema.String.annotate({ |
| 9407 | description: "URI associated with this resource or media payload.", |
| 9408 | format: "uri", |
| 9409 | }), |
| 9410 | title: Schema.optionalKey( |
| 9411 | Schema.Union([ |
| 9412 | Schema.String.annotate({ description: "Optional display title for end-user UI." }), |
| 9413 | Schema.Null, |
| 9414 | ]), |
| 9415 | ), |
| 9416 | description: Schema.optionalKey( |
| 9417 | Schema.Union([ |
| 9418 | Schema.String.annotate({ |
| 9419 | description: "Optional human-readable details shown with this protocol object.", |
| 9420 | }), |
| 9421 | Schema.Null, |
| 9422 | ]), |
| 9423 | ), |
| 9424 | icons: Schema.optionalKey( |
| 9425 | Schema.Union([ |
| 9426 | Schema.Array(Icon).annotate({ |
| 9427 | description: "Optional set of sized icons that the client can display in a user interface.", |
| 9428 | }), |
| 9429 | Schema.Null, |
| 9430 | ]), |
| 9431 | ), |
| 9432 | mimeType: Schema.optionalKey( |
| 9433 | Schema.Union([MediaType, Schema.Null]).annotate({ |
| 9434 | description: "MIME type describing the encoded media payload.", |
| 9435 | }), |
| 9436 | ), |
| 9437 | size: Schema.optionalKey( |
| 9438 | Schema.Union([ |
| 9439 | Schema.Number.annotate({ |
| 9440 | description: "Optional size of the linked resource in bytes, if known.", |
| 9441 | format: "int64", |
| 9442 | }).check(Schema.isInt().annotate({ expected: "an integer" })), |
| 9443 | Schema.Null, |
| 9444 | ]), |
| 9445 | ), |
| 9446 | annotations: Schema.optionalKey( |
| 9447 | Schema.Union([Annotations, Schema.Null]).annotate({ |
| 9448 | description: |
| 9449 | "Optional annotations that help clients decide how to display or route this content.", |
| 9450 | }), |
| 9451 | ), |
| 9452 | _meta: Schema.optionalKey( |
| 9453 | Schema.Union([ |
| 9454 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9455 | description: |
| 9456 | "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/v2/draft/extensibility)", |
| 9457 | }), |
| 9458 | Schema.Null, |
| 9459 | ]), |
| 9460 | ), |
| 9461 | }).annotate({ |
| 9462 | description: |
| 9463 | "A resource that the server is capable of reading, included in a prompt or tool call result.", |
| 9464 | }); |
| 9465 | |
| 9466 | export type RunningStateUpdate = { readonly _meta?: { readonly [x: string]: Schema.Json } | null }; |
| 9467 | export const RunningStateUpdate = Schema.Struct({ |
| 9468 | _meta: Schema.optionalKey( |
| 9469 | Schema.Union([ |
| 9470 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9471 | description: |
| 9472 | "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/v2/draft/extensibility)", |
| 9473 | }), |
| 9474 | Schema.Null, |
| 9475 | ]), |
| 9476 | ), |
| 9477 | }).annotate({ description: "Foreground work is in progress." }); |
| 9478 | |
| 9479 | export type SelectedPermissionOutcome = { |
| 9480 | readonly optionId: PermissionOptionId; |
| 9481 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9482 | }; |
| 9483 | export const SelectedPermissionOutcome = Schema.Struct({ |
| 9484 | optionId: Schema.suspend((): Schema.Codec<PermissionOptionId> => PermissionOptionId).annotate({ |
| 9485 | description: "The ID of the option the user selected.", |
| 9486 | }), |
| 9487 | _meta: Schema.optionalKey( |
| 9488 | Schema.Union([ |
| 9489 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9490 | description: |
| 9491 | "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/v2/draft/extensibility)", |
| 9492 | }), |
| 9493 | Schema.Null, |
| 9494 | ]), |
| 9495 | ), |
| 9496 | }).annotate({ description: "The user selected one of the provided options." }); |
| 9497 | |
| 9498 | export type SessionConfigBoolean = { readonly currentValue: boolean }; |
| 9499 | export const SessionConfigBoolean = Schema.Struct({ |
| 9500 | currentValue: Schema.Boolean.annotate({ |
| 9501 | description: "The current value of the boolean option.", |
| 9502 | }), |
| 9503 | }).annotate({ description: "A boolean on/off toggle session configuration option payload." }); |
| 9504 | |
| 9505 | export type SessionConfigSelect = { |
| 9506 | readonly currentValue: SessionConfigValueId; |
| 9507 | readonly options: SessionConfigSelectOptions; |
| 9508 | }; |
| 9509 | export const SessionConfigSelect = Schema.Struct({ |
| 9510 | currentValue: Schema.suspend( |
| 9511 | (): Schema.Codec<SessionConfigValueId> => SessionConfigValueId, |
| 9512 | ).annotate({ description: "The currently selected value." }), |
| 9513 | options: Schema.suspend( |
| 9514 | (): Schema.Codec<SessionConfigSelectOptions> => SessionConfigSelectOptions, |
| 9515 | ).annotate({ description: "The set of selectable options." }), |
| 9516 | }).annotate({ |
| 9517 | description: "A single-value selector (dropdown) session configuration option payload.", |
| 9518 | }); |
| 9519 | |
| 9520 | export type SessionInfoUpdate = { |
| 9521 | readonly title?: string | null; |
| 9522 | readonly updatedAt?: string | null; |
| 9523 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9524 | }; |
| 9525 | export const SessionInfoUpdate = Schema.Struct({ |
| 9526 | title: Schema.optionalKey( |
| 9527 | Schema.Union([ |
| 9528 | Schema.String.annotate({ |
| 9529 | description: "Human-readable title for the session. Set to null to clear.", |
| 9530 | }), |
| 9531 | Schema.Null, |
| 9532 | ]), |
| 9533 | ), |
| 9534 | updatedAt: Schema.optionalKey( |
| 9535 | Schema.Union([ |
| 9536 | Schema.String.annotate({ |
| 9537 | description: "RFC 3339 timestamp of last activity. Set to null to clear.", |
| 9538 | format: "date-time", |
| 9539 | }), |
| 9540 | Schema.Null, |
| 9541 | ]), |
| 9542 | ), |
| 9543 | _meta: Schema.optionalKey( |
| 9544 | Schema.Union([ |
| 9545 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9546 | description: |
| 9547 | "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Omitted means no metadata update; `null` is an\nexplicit clear signal. Implementations MUST NOT make assumptions about values at these keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 9548 | }), |
| 9549 | Schema.Null, |
| 9550 | ]), |
| 9551 | ), |
| 9552 | }).annotate({ |
| 9553 | description: |
| 9554 | "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.\n\nOmitted fields leave the existing session info unchanged. `null` clears the\ncorresponding value.", |
| 9555 | }); |
| 9556 | |
| 9557 | export type StateUpdate = |
| 9558 | | { readonly state: "running"; readonly _meta?: { readonly [x: string]: Schema.Json } | null } |
| 9559 | | { |
| 9560 | readonly state: "idle"; |
| 9561 | readonly stopReason?: StopReason | null; |
| 9562 | readonly usage?: Usage | null; |
| 9563 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9564 | } |
| 9565 | | { |
| 9566 | readonly state: "requires_action"; |
| 9567 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9568 | } |
| 9569 | | ({ readonly state: string } & { readonly [x: string]: Schema.Json }); |
| 9570 | export const StateUpdate = Schema.Union([ |
| 9571 | Schema.Struct({ |
| 9572 | state: Schema.Literal("running"), |
| 9573 | _meta: Schema.optionalKey( |
| 9574 | Schema.Union([ |
| 9575 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9576 | description: |
| 9577 | "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/v2/draft/extensibility)", |
| 9578 | }), |
| 9579 | Schema.Null, |
| 9580 | ]), |
| 9581 | ), |
| 9582 | }).annotate({ description: "Foreground work is in progress." }), |
| 9583 | Schema.Struct({ |
| 9584 | state: Schema.Literal("idle"), |
| 9585 | stopReason: Schema.optionalKey( |
| 9586 | Schema.Union([StopReason, Schema.Null]).annotate({ |
| 9587 | description: |
| 9588 | "Indicates why foreground work stopped.\n\nOptional. Omitted or `null` both mean the agent is not reporting a stop reason.\nAgents SHOULD include this when the idle transition ends foreground work.", |
| 9589 | }), |
| 9590 | ), |
| 9591 | usage: Schema.optionalKey( |
| 9592 | Schema.Union([Usage, Schema.Null]).annotate({ |
| 9593 | description: |
| 9594 | "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nToken usage for completed foreground work.\n\nOptional. Omitted or `null` both mean the agent is not reporting token\nusage for this state update.", |
| 9595 | }), |
| 9596 | ), |
| 9597 | _meta: Schema.optionalKey( |
| 9598 | Schema.Union([ |
| 9599 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9600 | description: |
| 9601 | "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/v2/draft/extensibility)", |
| 9602 | }), |
| 9603 | Schema.Null, |
| 9604 | ]), |
| 9605 | ), |
| 9606 | }).annotate({ description: "The agent is ready to process a new prompt." }), |
| 9607 | Schema.Struct({ |
| 9608 | state: Schema.Literal("requires_action"), |
| 9609 | _meta: Schema.optionalKey( |
| 9610 | Schema.Union([ |
| 9611 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9612 | description: |
| 9613 | "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/v2/draft/extensibility)", |
| 9614 | }), |
| 9615 | Schema.Null, |
| 9616 | ]), |
| 9617 | ), |
| 9618 | }).annotate({ description: "Foreground work is blocked on user action." }), |
| 9619 | Schema.StructWithRest( |
| 9620 | Schema.Struct({ |
| 9621 | state: Schema.String.annotate({ |
| 9622 | description: |
| 9623 | "Custom or future session state.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 9624 | }).check( |
| 9625 | Schema.isPattern( |
| 9626 | new RegExp("^(?!(?:\\x72unning|\\x69dle|\\x72equires_action)$)[\\s\\S]*$"), |
| 9627 | ).annotate({ |
| 9628 | expected: |
| 9629 | "a string matching the RegExp ^(?!(?:\\x72unning|\\x69dle|\\x72equires_action)$)[\\s\\S]*$", |
| 9630 | }), |
| 9631 | ), |
| 9632 | }), |
| 9633 | [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], |
| 9634 | ).annotate({ |
| 9635 | title: "other", |
| 9636 | description: |
| 9637 | "Custom or future session state.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Unknown values that do not begin with `_` are reserved for\nfuture ACP variants.", |
| 9638 | }), |
| 9639 | ]).annotate({ |
| 9640 | description: |
| 9641 | "The state of the agent's foreground work has changed.\n\nBackground activity can continue and emit other `session/update` notifications\nwhile `idle`. Those notifications do not change this state.", |
| 9642 | }); |
| 9643 | |
| 9644 | export type StringMultiSelectItems = { |
| 9645 | readonly enum: ReadonlyArray<string>; |
| 9646 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9647 | }; |
| 9648 | export const StringMultiSelectItems = Schema.Struct({ |
| 9649 | enum: Schema.Array(Schema.String) |
| 9650 | .annotate({ description: "Allowed enum values. Must contain at least one value." }) |
| 9651 | .check(Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" })), |
| 9652 | _meta: Schema.optionalKey( |
| 9653 | Schema.Union([ |
| 9654 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9655 | description: |
| 9656 | "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/v2/draft/extensibility)", |
| 9657 | }), |
| 9658 | Schema.Null, |
| 9659 | ]), |
| 9660 | ), |
| 9661 | }).annotate({ description: "String item schema for multi-select enum properties." }); |
| 9662 | |
| 9663 | export type StringPropertySchema = { |
| 9664 | readonly title?: string | null; |
| 9665 | readonly description?: string | null; |
| 9666 | readonly minLength?: number | null; |
| 9667 | readonly maxLength?: number | null; |
| 9668 | readonly pattern?: string | null; |
| 9669 | readonly format?: StringFormat | null; |
| 9670 | readonly default?: string | null; |
| 9671 | readonly enum?: ReadonlyArray<string> | null; |
| 9672 | readonly oneOf?: ReadonlyArray<EnumOption> | null; |
| 9673 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9674 | }; |
| 9675 | export const StringPropertySchema = Schema.Struct({ |
| 9676 | title: Schema.optionalKey( |
| 9677 | Schema.Union([ |
| 9678 | Schema.String.annotate({ |
| 9679 | description: |
| 9680 | "Optional title for the property.\n\nOptional. Omitted and `null` are equivalent and mean no title is provided.", |
| 9681 | }), |
| 9682 | Schema.Null, |
| 9683 | ]), |
| 9684 | ), |
| 9685 | description: Schema.optionalKey( |
| 9686 | Schema.Union([ |
| 9687 | Schema.String.annotate({ |
| 9688 | description: |
| 9689 | "Human-readable description.\n\nOptional. Omitted and `null` are equivalent and mean no description is provided.", |
| 9690 | }), |
| 9691 | Schema.Null, |
| 9692 | ]), |
| 9693 | ), |
| 9694 | minLength: Schema.optionalKey( |
| 9695 | Schema.Union([ |
| 9696 | Schema.Number.annotate({ |
| 9697 | description: |
| 9698 | "Minimum string length.\n\nOptional. Omitted and `null` are equivalent and mean there is no minimum length constraint.", |
| 9699 | format: "uint32", |
| 9700 | }) |
| 9701 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 9702 | .check( |
| 9703 | Schema.isGreaterThanOrEqualTo(0).annotate({ |
| 9704 | expected: "a value greater than or equal to 0", |
| 9705 | }), |
| 9706 | ), |
| 9707 | Schema.Null, |
| 9708 | ]), |
| 9709 | ), |
| 9710 | maxLength: Schema.optionalKey( |
| 9711 | Schema.Union([ |
| 9712 | Schema.Number.annotate({ |
| 9713 | description: |
| 9714 | "Maximum string length.\n\nOptional. Omitted and `null` are equivalent and mean there is no maximum length constraint.", |
| 9715 | format: "uint32", |
| 9716 | }) |
| 9717 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 9718 | .check( |
| 9719 | Schema.isGreaterThanOrEqualTo(0).annotate({ |
| 9720 | expected: "a value greater than or equal to 0", |
| 9721 | }), |
| 9722 | ), |
| 9723 | Schema.Null, |
| 9724 | ]), |
| 9725 | ), |
| 9726 | pattern: Schema.optionalKey( |
| 9727 | Schema.Union([ |
| 9728 | Schema.String.annotate({ |
| 9729 | description: |
| 9730 | "Pattern the string must match.\n\nOptional. Omitted and `null` are equivalent and mean there is no pattern constraint.", |
| 9731 | format: "regex", |
| 9732 | }), |
| 9733 | Schema.Null, |
| 9734 | ]), |
| 9735 | ), |
| 9736 | format: Schema.optionalKey( |
| 9737 | Schema.Union([StringFormat, Schema.Null]).annotate({ |
| 9738 | description: |
| 9739 | "String format.\n\nOptional. Omitted and `null` are equivalent and mean there is no format constraint.", |
| 9740 | }), |
| 9741 | ), |
| 9742 | default: Schema.optionalKey( |
| 9743 | Schema.Union([ |
| 9744 | Schema.String.annotate({ |
| 9745 | description: |
| 9746 | "Default value.\n\nOptional. Omitted and `null` are equivalent and mean no default value is provided.", |
| 9747 | }), |
| 9748 | Schema.Null, |
| 9749 | ]), |
| 9750 | ), |
| 9751 | enum: Schema.optionalKey( |
| 9752 | Schema.Union([ |
| 9753 | Schema.Array(Schema.String) |
| 9754 | .annotate({ |
| 9755 | description: |
| 9756 | "Enum values for untitled single-select enums.\nMust contain at least one value when present.\nOptional. Omitted and `null` are equivalent and mean no untitled single-select choices are\ndeclared by `enum`.", |
| 9757 | }) |
| 9758 | .check(Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" })), |
| 9759 | Schema.Null, |
| 9760 | ]), |
| 9761 | ), |
| 9762 | oneOf: Schema.optionalKey( |
| 9763 | Schema.Union([ |
| 9764 | Schema.Array(EnumOption) |
| 9765 | .annotate({ |
| 9766 | description: |
| 9767 | "Titled enum options for titled single-select enums.\nMust contain at least one option when present.\nOptional. Omitted and `null` are equivalent and mean no titled single-select choices are\ndeclared by `oneOf`.", |
| 9768 | }) |
| 9769 | .check(Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" })), |
| 9770 | Schema.Null, |
| 9771 | ]), |
| 9772 | ), |
| 9773 | _meta: Schema.optionalKey( |
| 9774 | Schema.Union([ |
| 9775 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9776 | description: |
| 9777 | "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/v2/draft/extensibility)", |
| 9778 | }), |
| 9779 | Schema.Null, |
| 9780 | ]), |
| 9781 | ), |
| 9782 | }).annotate({ |
| 9783 | description: |
| 9784 | 'Schema for string properties in an elicitation form.\n\nWhen `enum` or `oneOf` is set, this represents a single-select enum\nwith `"type": "string"`.', |
| 9785 | }); |
| 9786 | |
| 9787 | export type Terminal = { |
| 9788 | readonly terminalId: TerminalId; |
| 9789 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9790 | }; |
| 9791 | export const Terminal = Schema.Struct({ |
| 9792 | terminalId: Schema.suspend((): Schema.Codec<TerminalId> => TerminalId).annotate({ |
| 9793 | description: "The ID of the terminal to display.", |
| 9794 | }), |
| 9795 | _meta: Schema.optionalKey( |
| 9796 | Schema.Union([ |
| 9797 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9798 | description: |
| 9799 | "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. This metadata is scoped to the content reference. Omitted\nand `null` are equivalent and mean no item metadata was provided.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 9800 | }), |
| 9801 | Schema.Null, |
| 9802 | ]), |
| 9803 | ), |
| 9804 | }).annotate({ |
| 9805 | description: |
| 9806 | "A display-only reference to an agent-owned terminal.\n\nTerminal state and output are delivered separately through\n[`TerminalUpdate`] and [`TerminalOutputChunk`].", |
| 9807 | }); |
| 9808 | |
| 9809 | export type TerminalOutputChunk = { |
| 9810 | readonly terminalId: TerminalId; |
| 9811 | readonly data: string; |
| 9812 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9813 | }; |
| 9814 | export const TerminalOutputChunk = Schema.Struct({ |
| 9815 | terminalId: Schema.suspend((): Schema.Codec<TerminalId> => TerminalId).annotate({ |
| 9816 | description: "The terminal receiving these bytes.", |
| 9817 | }), |
| 9818 | data: Schema.String.annotate({ |
| 9819 | description: "Independently base64-encoded terminal output bytes.", |
| 9820 | contentEncoding: "base64", |
| 9821 | }), |
| 9822 | _meta: Schema.optionalKey( |
| 9823 | Schema.Union([ |
| 9824 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9825 | description: |
| 9826 | "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. This field is chunk-scoped. Omitted and `null` are\nequivalent and mean no chunk metadata was provided.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 9827 | }), |
| 9828 | Schema.Null, |
| 9829 | ]), |
| 9830 | ), |
| 9831 | }).annotate({ description: "A chunk of bytes appended to an agent-owned terminal's output." }); |
| 9832 | |
| 9833 | export type TerminalUpdate = { |
| 9834 | readonly terminalId: TerminalId; |
| 9835 | readonly command?: string | null; |
| 9836 | readonly cwd?: AbsolutePath | null; |
| 9837 | readonly output?: TerminalOutput | null; |
| 9838 | readonly exitStatus?: TerminalExitStatus | null; |
| 9839 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9840 | }; |
| 9841 | export const TerminalUpdate = Schema.Struct({ |
| 9842 | terminalId: Schema.suspend((): Schema.Codec<TerminalId> => TerminalId).annotate({ |
| 9843 | description: "Unique identifier for this terminal within the session.", |
| 9844 | }), |
| 9845 | command: Schema.optionalKey( |
| 9846 | Schema.Union([Schema.String.annotate({ description: "The command being run." }), Schema.Null]), |
| 9847 | ), |
| 9848 | cwd: Schema.optionalKey( |
| 9849 | Schema.Union([AbsolutePath, Schema.Null]).annotate({ |
| 9850 | description: "The absolute working directory of the command.", |
| 9851 | }), |
| 9852 | ), |
| 9853 | output: Schema.optionalKey( |
| 9854 | Schema.Union([TerminalOutput, Schema.Null]).annotate({ |
| 9855 | description: "An authoritative replacement snapshot of terminal output bytes.", |
| 9856 | }), |
| 9857 | ), |
| 9858 | exitStatus: Schema.optionalKey( |
| 9859 | Schema.Union([TerminalExitStatus, Schema.Null]).annotate({ |
| 9860 | description: "Exit information. A concrete object marks the terminal as exited.", |
| 9861 | }), |
| 9862 | ), |
| 9863 | _meta: Schema.optionalKey( |
| 9864 | Schema.Union([ |
| 9865 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9866 | description: |
| 9867 | "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Omitted means no metadata update; `null` is an\nexplicit clear signal. Implementations MUST NOT make assumptions about values at these keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 9868 | }), |
| 9869 | Schema.Null, |
| 9870 | ]), |
| 9871 | ), |
| 9872 | }).annotate({ |
| 9873 | description: |
| 9874 | "An upsert for the stored state of an agent-owned terminal.\n\nOnly [`TerminalUpdate::terminal_id`] is required. Other fields have patch\nsemantics: omitted fields leave the stored value unchanged, `null` clears\nit, and concrete values replace it. When the terminal ID is new, omitted\nfields start unknown.", |
| 9875 | }); |
| 9876 | |
| 9877 | export type TextCommandInput = { |
| 9878 | readonly hint: string; |
| 9879 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9880 | }; |
| 9881 | export const TextCommandInput = Schema.Struct({ |
| 9882 | hint: Schema.String.annotate({ |
| 9883 | description: "A hint to display when the input hasn't been provided yet", |
| 9884 | }), |
| 9885 | _meta: Schema.optionalKey( |
| 9886 | Schema.Union([ |
| 9887 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9888 | description: |
| 9889 | "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/v2/draft/extensibility)", |
| 9890 | }), |
| 9891 | Schema.Null, |
| 9892 | ]), |
| 9893 | ), |
| 9894 | }).annotate({ |
| 9895 | description: "All text that was typed after the command name is provided as input.", |
| 9896 | }); |
| 9897 | |
| 9898 | export type TextContent = { |
| 9899 | readonly text: string; |
| 9900 | readonly annotations?: Annotations | null; |
| 9901 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9902 | }; |
| 9903 | export const TextContent = Schema.Struct({ |
| 9904 | text: Schema.String.annotate({ description: "Text payload carried by this content block." }), |
| 9905 | annotations: Schema.optionalKey( |
| 9906 | Schema.Union([Annotations, Schema.Null]).annotate({ |
| 9907 | description: |
| 9908 | "Optional annotations that help clients decide how to display or route this content.", |
| 9909 | }), |
| 9910 | ), |
| 9911 | _meta: Schema.optionalKey( |
| 9912 | Schema.Union([ |
| 9913 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9914 | description: |
| 9915 | "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/v2/draft/extensibility)", |
| 9916 | }), |
| 9917 | Schema.Null, |
| 9918 | ]), |
| 9919 | ), |
| 9920 | }).annotate({ description: "Text provided to or from an LLM." }); |
| 9921 | |
| 9922 | export type ToolCallContentChunk = { |
| 9923 | readonly toolCallId: ToolCallId; |
| 9924 | readonly content: ToolCallContent; |
| 9925 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9926 | }; |
| 9927 | export const ToolCallContentChunk = Schema.Struct({ |
| 9928 | toolCallId: Schema.suspend((): Schema.Codec<ToolCallId> => ToolCallId).annotate({ |
| 9929 | description: "The ID of the tool call this content belongs to.", |
| 9930 | }), |
| 9931 | content: Schema.suspend((): Schema.Codec<ToolCallContent> => ToolCallContent).annotate({ |
| 9932 | description: "A single item of content produced by the tool call.", |
| 9933 | }), |
| 9934 | _meta: Schema.optionalKey( |
| 9935 | Schema.Union([ |
| 9936 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9937 | description: |
| 9938 | "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. This field is chunk-scoped.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 9939 | }), |
| 9940 | Schema.Null, |
| 9941 | ]), |
| 9942 | ), |
| 9943 | }).annotate({ |
| 9944 | description: |
| 9945 | "A streamed item of tool-call content.\n\nTool-call content chunks append one [`ToolCallContent`] item to the current\ncontent for the matching [`ToolCallId`]. Agents can use\n[`ToolCallUpdate::content`] when they need to replace the whole content\ncollection instead.", |
| 9946 | }); |
| 9947 | |
| 9948 | export type ToolCallPermissionSubject = { readonly toolCall: ToolCallUpdate }; |
| 9949 | export const ToolCallPermissionSubject = Schema.Struct({ |
| 9950 | toolCall: Schema.suspend((): Schema.Codec<ToolCallUpdate> => ToolCallUpdate).annotate({ |
| 9951 | description: "Details about the tool call requiring permission.", |
| 9952 | }), |
| 9953 | }).annotate({ description: "Permission request details for a tool call." }); |
| 9954 | |
| 9955 | export type UsageUpdate = { |
| 9956 | readonly used: number; |
| 9957 | readonly size: number; |
| 9958 | readonly cost?: Cost | null; |
| 9959 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9960 | }; |
| 9961 | export const UsageUpdate = Schema.Struct({ |
| 9962 | used: Schema.Number.annotate({ description: "Tokens currently in context.", format: "uint64" }) |
| 9963 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 9964 | .check( |
| 9965 | Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), |
| 9966 | ), |
| 9967 | size: Schema.Number.annotate({ |
| 9968 | description: "Total context window size in tokens.", |
| 9969 | format: "uint64", |
| 9970 | }) |
| 9971 | .check(Schema.isInt().annotate({ expected: "an integer" })) |
| 9972 | .check( |
| 9973 | Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }), |
| 9974 | ), |
| 9975 | cost: Schema.optionalKey( |
| 9976 | Schema.Union([Cost, Schema.Null]).annotate({ |
| 9977 | description: "Cumulative session cost (optional).", |
| 9978 | }), |
| 9979 | ), |
| 9980 | _meta: Schema.optionalKey( |
| 9981 | Schema.Union([ |
| 9982 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 9983 | description: |
| 9984 | "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/v2/draft/extensibility)", |
| 9985 | }), |
| 9986 | Schema.Null, |
| 9987 | ]), |
| 9988 | ), |
| 9989 | }).annotate({ description: "Context window and cost update for a session." }); |
| 9990 | |
| 9991 | export type UserMessage = { |
| 9992 | readonly messageId: MessageId; |
| 9993 | readonly content?: ReadonlyArray<ContentBlock> | null; |
| 9994 | readonly _meta?: { readonly [x: string]: Schema.Json } | null; |
| 9995 | }; |
| 9996 | export const UserMessage = Schema.Struct({ |
| 9997 | messageId: Schema.suspend((): Schema.Codec<MessageId> => MessageId).annotate({ |
| 9998 | description: "A unique identifier for the message.", |
| 9999 | }), |
| 10000 | content: Schema.optionalKey( |
| 10001 | Schema.Union([ |
| 10002 | Schema.Array(ContentBlock).annotate({ |
| 10003 | description: "Complete replacement content for this message.", |
| 10004 | }), |
| 10005 | Schema.Null, |
| 10006 | ]), |
| 10007 | ), |
| 10008 | _meta: Schema.optionalKey( |
| 10009 | Schema.Union([ |
| 10010 | Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ |
| 10011 | description: |
| 10012 | "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. Omitted means no metadata update; `null` is an explicit clear signal.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", |
| 10013 | }), |
| 10014 | Schema.Null, |
| 10015 | ]), |
| 10016 | ), |
| 10017 | }).annotate({ |
| 10018 | description: |
| 10019 | "A user message upsert.\n\nOnly [`UserMessage::message_id`] is required. `content` has patch semantics:\nan omitted field leaves existing message content unchanged, `null` clears the\nvalue, and a concrete array replaces the previous value. For a new\n`messageId`, omitted fields use client defaults. `content` is replaced as a\nwhole array; send `[]` or `null` to clear it.\n\nMessage updates and chunks are applied in the order they are received. When\na `user_message` update includes `content`, that array replaces any content\npreviously accumulated for the message, including content from earlier\nchunks. Later chunks with the same `messageId` append to the current\ncontent.", |
| 10020 | }); |