diff --git a/scripts/generate.js b/scripts/generate.js index b48f575..003336d 100644 --- a/scripts/generate.js +++ b/scripts/generate.js @@ -42,7 +42,16 @@ async function main() { const zodSrc = await fs.readFile(zodPath, "utf8"); await fs.writeFile( zodPath, - updateDocs(zodSrc.replace(`from "zod"`, `from "zod/v4"`)), + updateDocs( + zodSrc + .replace(`from "zod"`, `from "zod/v4"`) + // Weird type issue + .replaceAll(`"McpServerStdio"`, `"stdio"`) + .replaceAll( + "_meta: z.unknown().optional()", + "_meta: z.object().optional()", + ), + ), ); const tsPath = "./src/schema/types.gen.ts"; @@ -50,10 +59,14 @@ async function main() { await fs.writeFile( tsPath, updateDocs( - tsSrc.replace( - `export type ClientOptions`, - `// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype ClientOptions`, - ), + tsSrc + .replace( + `export type ClientOptions`, + `// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype ClientOptions`, + ) + // Weird type issue + .replaceAll(`"McpServerStdio"`, `"stdio"`) + .replaceAll(`_meta?: unknown`, `_meta?: { [key: string]: unknown }`), ), ); diff --git a/src/acp.ts b/src/acp.ts index 4412a4f..7abacb9 100644 --- a/src/acp.ts +++ b/src/acp.ts @@ -1,7 +1,8 @@ import { z } from "zod"; -import * as schema from "./schema"; +import * as schema from "./schema/index.js"; import * as validate from "./schema/zod.gen.js"; -export * from "./schema"; +export type * from "./schema/types.gen.js"; +export * from "./schema/index.js"; export * from "./stream.js"; import type { Stream } from "./stream.js"; diff --git a/src/schema/types.gen.ts b/src/schema/types.gen.ts index 0b521a8..ea1bccd 100644 --- a/src/schema/types.gen.ts +++ b/src/schema/types.gen.ts @@ -17,7 +17,7 @@ export type AgentCapabilities = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Whether the agent supports `session/load`. */ @@ -88,7 +88,7 @@ export type Annotations = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; audience?: Array | null; lastModified?: string | null; priority?: number | null; @@ -101,7 +101,7 @@ export type AudioContent = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; annotations?: Annotations | null; data: string; mimeType: string; @@ -114,7 +114,7 @@ export type AuthMethod = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Optional description providing more details about this authentication method. */ @@ -138,7 +138,7 @@ export type AuthenticateRequest = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The ID of the authentication method to use. * Must be one of the methods advertised in the initialize response. @@ -153,7 +153,7 @@ export type AuthenticateResponse = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; }; /** @@ -163,7 +163,7 @@ export type AvailableCommand = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Human-readable description of what the command does. */ @@ -190,7 +190,7 @@ export type AvailableCommandsUpdate = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Commands the agent can execute */ @@ -204,7 +204,7 @@ export type BlobResourceContents = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; blob: string; mimeType?: string | null; uri: string; @@ -219,7 +219,7 @@ export type CancelNotification = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The ID of the session to cancel operations for. */ @@ -238,7 +238,7 @@ export type ClientCapabilities = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * File system capabilities supported by the client. * Determines which file operations the agent can request. @@ -305,7 +305,7 @@ export type Content = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The actual content block. */ @@ -352,7 +352,7 @@ export type ContentChunk = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * A single item of content */ @@ -366,7 +366,7 @@ export type CreateTerminalRequest = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Array of command arguments. */ @@ -407,7 +407,7 @@ export type CreateTerminalResponse = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The unique identifier for the created terminal. */ @@ -423,7 +423,7 @@ export type CurrentModeUpdate = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The ID of the current mode */ @@ -441,7 +441,7 @@ export type Diff = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The new content after modification. */ @@ -463,7 +463,7 @@ export type EmbeddedResource = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; annotations?: Annotations | null; resource: EmbeddedResourceResource; }; @@ -482,7 +482,7 @@ export type EnvVariable = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The name of the environment variable. */ @@ -556,7 +556,7 @@ export type FileSystemCapability = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Whether the Client supports `fs/read_text_file` requests. */ @@ -574,7 +574,7 @@ export type HttpHeader = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The name of the HTTP header. */ @@ -592,7 +592,7 @@ export type ImageContent = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; annotations?: Annotations | null; data: string; mimeType: string; @@ -608,7 +608,7 @@ export type Implementation = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Intended for programmatic or logical use, but can be used as a display * name fallback if title isn’t present. @@ -639,7 +639,7 @@ export type InitializeRequest = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Capabilities supported by the client. */ @@ -667,7 +667,7 @@ export type InitializeResponse = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Capabilities supported by the agent. */ @@ -698,7 +698,7 @@ export type KillTerminalCommandRequest = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The session ID for this request. */ @@ -716,7 +716,7 @@ export type KillTerminalCommandResponse = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; }; /** @@ -734,7 +734,7 @@ export type ListSessionsRequest = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Opaque cursor token from a previous response's nextCursor field for cursor-based pagination */ @@ -758,7 +758,7 @@ export type ListSessionsResponse = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Opaque cursor token. If present, pass this in the next request's cursor parameter * to fetch the next page. If absent, there are no more results. @@ -781,7 +781,7 @@ export type LoadSessionRequest = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The working directory for this session. */ @@ -803,7 +803,7 @@ export type LoadSessionResponse = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * **UNSTABLE** * @@ -829,7 +829,7 @@ export type McpCapabilities = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Agent supports [`McpServer::Http`]. */ @@ -856,7 +856,7 @@ export type McpServer = type: "sse"; }) | ({ - type?: "McpServerStdio"; + type?: "stdio"; } & McpServerStdio); /** @@ -866,7 +866,7 @@ export type McpServerHttp = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * HTTP headers to set when making requests to the MCP server. */ @@ -888,7 +888,7 @@ export type McpServerSse = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * HTTP headers to set when making requests to the MCP server. */ @@ -910,7 +910,7 @@ export type McpServerStdio = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Command-line arguments to pass to the MCP server. */ @@ -953,7 +953,7 @@ export type ModelInfo = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Optional description of the model. */ @@ -977,7 +977,7 @@ export type NewSessionRequest = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The working directory for this session. Must be an absolute path. */ @@ -997,7 +997,7 @@ export type NewSessionResponse = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * **UNSTABLE** * @@ -1029,7 +1029,7 @@ export type PermissionOption = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Hint about the nature of this permission option. */ @@ -1073,7 +1073,7 @@ export type Plan = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The list of tasks to be accomplished. * @@ -1094,7 +1094,7 @@ export type PlanEntry = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Human-readable description of what this task aims to accomplish. */ @@ -1145,7 +1145,7 @@ export type PromptCapabilities = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Agent supports [`ContentBlock::Audio`]. */ @@ -1174,7 +1174,7 @@ export type PromptRequest = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The blocks of content that compose the user's message. * @@ -1206,7 +1206,7 @@ export type PromptResponse = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Indicates why the agent stopped processing the turn. */ @@ -1230,7 +1230,7 @@ export type ReadTextFileRequest = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Maximum number of lines to read. */ @@ -1256,7 +1256,7 @@ export type ReadTextFileResponse = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; content: string; }; @@ -1267,7 +1267,7 @@ export type ReleaseTerminalRequest = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The session ID for this request. */ @@ -1285,7 +1285,7 @@ export type ReleaseTerminalResponse = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; }; /** @@ -1323,7 +1323,7 @@ export type RequestPermissionRequest = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Available permission options for the user to choose from. */ @@ -1345,7 +1345,7 @@ export type RequestPermissionResponse = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The user's decision on the permission request. */ @@ -1359,7 +1359,7 @@ export type ResourceLink = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; annotations?: Annotations | null; description?: string | null; mimeType?: string | null; @@ -1381,7 +1381,7 @@ export type SelectedPermissionOutcome = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The ID of the option the user selected. */ @@ -1403,7 +1403,7 @@ export type SessionCapabilities = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * **UNSTABLE** * @@ -1439,7 +1439,7 @@ export type SessionInfo = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The working directory for this session. Must be an absolute path. */ @@ -1469,7 +1469,7 @@ export type SessionListCapabilities = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; }; /** @@ -1481,7 +1481,7 @@ export type SessionMode = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; description?: string | null; id: SessionModeId; name: string; @@ -1499,7 +1499,7 @@ export type SessionModeState = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The set of modes that the Agent can operate in */ @@ -1523,7 +1523,7 @@ export type SessionModelState = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The set of models that the Agent can use */ @@ -1545,7 +1545,7 @@ export type SessionNotification = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The ID of the session this update pertains to. */ @@ -1596,7 +1596,7 @@ export type SetSessionModeRequest = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The ID of the mode to set. */ @@ -1611,7 +1611,7 @@ export type SetSessionModeRequest = { * Response to `session/set_mode` method. */ export type SetSessionModeResponse = { - _meta?: unknown; + _meta?: { [key: string]: unknown }; }; /** @@ -1627,7 +1627,7 @@ export type SetSessionModelRequest = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The ID of the model to set. */ @@ -1651,7 +1651,7 @@ export type SetSessionModelResponse = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; }; /** @@ -1677,7 +1677,7 @@ export type Terminal = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; terminalId: string; }; @@ -1688,7 +1688,7 @@ export type TerminalExitStatus = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The process exit code (may be null if terminated by signal). */ @@ -1706,7 +1706,7 @@ export type TerminalOutputRequest = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The session ID for this request. */ @@ -1724,7 +1724,7 @@ export type TerminalOutputResponse = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Exit status if the command has completed. */ @@ -1746,7 +1746,7 @@ export type TextContent = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; annotations?: Annotations | null; text: string; }; @@ -1758,7 +1758,7 @@ export type TextResourceContents = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; mimeType?: string | null; text: string; uri: string; @@ -1776,7 +1776,7 @@ export type ToolCall = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Content produced by the tool call. */ @@ -1849,7 +1849,7 @@ export type ToolCallLocation = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Optional line number within the file. */ @@ -1881,7 +1881,7 @@ export type ToolCallUpdate = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * Replace the content collection. */ @@ -1943,7 +1943,7 @@ export type UnstructuredCommandInput = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * A hint to display when the input hasn't been provided yet */ @@ -1957,7 +1957,7 @@ export type WaitForTerminalExitRequest = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The session ID for this request. */ @@ -1975,7 +1975,7 @@ export type WaitForTerminalExitResponse = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The process exit code (may be null if terminated by signal). */ @@ -1995,7 +1995,7 @@ export type WriteTextFileRequest = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; /** * The text content to write to the file. */ @@ -2017,5 +2017,5 @@ export type WriteTextFileResponse = { /** * Extension point for implementations */ - _meta?: unknown; + _meta?: { [key: string]: unknown }; }; diff --git a/src/schema/zod.gen.ts b/src/schema/zod.gen.ts index 1b0d2e4..43f2533 100644 --- a/src/schema/zod.gen.ts +++ b/src/schema/zod.gen.ts @@ -6,7 +6,7 @@ import { z } from "zod/v4"; * Describes an available authentication method. */ export const zAuthMethod = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), description: z.union([z.string(), z.null()]).optional(), id: z.string(), name: z.string(), @@ -18,7 +18,7 @@ export const zAuthMethod = z.object({ * Specifies which authentication method to use. */ export const zAuthenticateRequest = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), methodId: z.string(), }); @@ -26,14 +26,14 @@ export const zAuthenticateRequest = z.object({ * Response to the `authenticate` method. */ export const zAuthenticateResponse = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), }); /** * Binary resource contents. */ export const zBlobResourceContents = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), blob: z.string(), mimeType: z.union([z.string(), z.null()]).optional(), uri: z.string(), @@ -43,7 +43,7 @@ export const zBlobResourceContents = z.object({ * Response containing the ID of the created terminal. */ export const zCreateTerminalResponse = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), terminalId: z.string(), }); @@ -55,7 +55,7 @@ export const zCreateTerminalResponse = z.object({ * See protocol docs: [Content](https://agentclientprotocol.com/protocol/tool-calls#content) */ export const zDiff = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), newText: z.string(), oldText: z.union([z.string(), z.null()]).optional(), path: z.string(), @@ -65,7 +65,7 @@ export const zDiff = z.object({ * An environment variable to set when launching an MCP server. */ export const zEnvVariable = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), name: z.string(), value: z.string(), }); @@ -118,7 +118,7 @@ export const zExtResponse = z.unknown(); * See protocol docs: [FileSystem](https://agentclientprotocol.com/protocol/initialization#filesystem) */ export const zFileSystemCapability = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), readTextFile: z.boolean().optional().default(false), writeTextFile: z.boolean().optional().default(false), }); @@ -132,7 +132,7 @@ export const zFileSystemCapability = z.object({ * See protocol docs: [Client Capabilities](https://agentclientprotocol.com/protocol/initialization#client-capabilities) */ export const zClientCapabilities = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), fs: zFileSystemCapability .optional() .default({ readTextFile: false, writeTextFile: false }), @@ -143,7 +143,7 @@ export const zClientCapabilities = z.object({ * An HTTP header to set when making requests to the MCP server. */ export const zHttpHeader = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), name: z.string(), value: z.string(), }); @@ -154,7 +154,7 @@ export const zHttpHeader = z.object({ * title for UI representation. */ export const zImplementation = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), name: z.string(), title: z.union([z.string(), z.null()]).optional(), version: z.string(), @@ -164,7 +164,7 @@ export const zImplementation = z.object({ * Response to terminal/kill command method */ export const zKillTerminalCommandResponse = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), }); /** @@ -179,7 +179,7 @@ export const zKillTerminalCommandResponse = z.object({ * @experimental */ export const zListSessionsRequest = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), cursor: z.union([z.string(), z.null()]).optional(), cwd: z.union([z.string(), z.null()]).optional(), }); @@ -188,7 +188,7 @@ export const zListSessionsRequest = z.object({ * MCP capabilities supported by the agent */ export const zMcpCapabilities = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), http: z.boolean().optional().default(false), sse: z.boolean().optional().default(false), }); @@ -197,7 +197,7 @@ export const zMcpCapabilities = z.object({ * HTTP transport configuration for MCP. */ export const zMcpServerHttp = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), headers: z.array(zHttpHeader), name: z.string(), url: z.string(), @@ -207,7 +207,7 @@ export const zMcpServerHttp = z.object({ * SSE transport configuration for MCP. */ export const zMcpServerSse = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), headers: z.array(zHttpHeader), name: z.string(), url: z.string(), @@ -217,7 +217,7 @@ export const zMcpServerSse = z.object({ * Stdio transport configuration for MCP. */ export const zMcpServerStdio = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), args: z.array(z.string()), command: z.string(), env: z.array(zEnvVariable), @@ -245,7 +245,7 @@ export const zMcpServer = z.union([ ), z .object({ - type: z.literal("McpServerStdio").optional(), + type: z.literal("stdio").optional(), }) .and(zMcpServerStdio), ]); @@ -271,7 +271,7 @@ export const zModelId = z.string(); * @experimental */ export const zModelInfo = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), description: z.union([z.string(), z.null()]).optional(), modelId: zModelId, name: z.string(), @@ -283,7 +283,7 @@ export const zModelInfo = z.object({ * See protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol/session-setup#creating-a-session) */ export const zNewSessionRequest = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), cwd: z.string(), mcpServers: z.array(zMcpServer), }); @@ -309,7 +309,7 @@ export const zPermissionOptionKind = z.union([ * An option presented to the user when requesting permission. */ export const zPermissionOption = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), kind: zPermissionOptionKind, name: z.string(), optionId: zPermissionOptionId, @@ -348,7 +348,7 @@ export const zPlanEntryStatus = z.union([ * See protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/agent-plan#plan-entries) */ export const zPlanEntry = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), content: z.string(), priority: zPlanEntryPriority, status: zPlanEntryStatus, @@ -364,7 +364,7 @@ export const zPlanEntry = z.object({ * See protocol docs: [Agent Plan](https://agentclientprotocol.com/protocol/agent-plan) */ export const zPlan = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), entries: z.array(zPlanEntry), }); @@ -383,7 +383,7 @@ export const zPlan = z.object({ * See protocol docs: [Prompt Capabilities](https://agentclientprotocol.com/protocol/initialization#prompt-capabilities) */ export const zPromptCapabilities = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), audio: z.boolean().optional().default(false), embeddedContext: z.boolean().optional().default(false), image: z.boolean().optional().default(false), @@ -405,7 +405,7 @@ export const zProtocolVersion = z.number().int().gte(0).lte(65535); * See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization) */ export const zInitializeRequest = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), clientCapabilities: zClientCapabilities.optional().default({ fs: { readTextFile: false, writeTextFile: false }, terminal: false, @@ -418,7 +418,7 @@ export const zInitializeRequest = z.object({ * Response containing the contents of a text file. */ export const zReadTextFileResponse = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), content: z.string(), }); @@ -426,7 +426,7 @@ export const zReadTextFileResponse = z.object({ * Response to terminal/release method */ export const zReleaseTerminalResponse = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), }); /** @@ -451,7 +451,7 @@ export const zRole = z.enum(["assistant", "user"]); * Optional annotations for the client. The client can use annotations to inform how objects are used or displayed */ export const zAnnotations = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), audience: z.union([z.array(zRole), z.null()]).optional(), lastModified: z.union([z.string(), z.null()]).optional(), priority: z.union([z.number(), z.null()]).optional(), @@ -461,7 +461,7 @@ export const zAnnotations = z.object({ * Audio provided to or from an LLM. */ export const zAudioContent = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), annotations: z.union([zAnnotations, z.null()]).optional(), data: z.string(), mimeType: z.string(), @@ -471,7 +471,7 @@ export const zAudioContent = z.object({ * An image provided to or from an LLM. */ export const zImageContent = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), annotations: z.union([zAnnotations, z.null()]).optional(), data: z.string(), mimeType: z.string(), @@ -482,7 +482,7 @@ export const zImageContent = z.object({ * A resource that the server is capable of reading, included in a prompt or tool call result. */ export const zResourceLink = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), annotations: z.union([zAnnotations, z.null()]).optional(), description: z.union([z.string(), z.null()]).optional(), mimeType: z.union([z.string(), z.null()]).optional(), @@ -496,7 +496,7 @@ export const zResourceLink = z.object({ * The user selected one of the provided options. */ export const zSelectedPermissionOutcome = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), optionId: zPermissionOptionId, }); @@ -518,7 +518,7 @@ export const zRequestPermissionOutcome = z.union([ * Response to a permission request. */ export const zRequestPermissionResponse = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), outcome: zRequestPermissionOutcome, }); @@ -538,7 +538,7 @@ export const zSessionId = z.string(); * See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation) */ export const zCancelNotification = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), sessionId: zSessionId, }); @@ -553,7 +553,7 @@ export const zClientNotification = z.object({ * Request to create a new terminal and execute a command. */ export const zCreateTerminalRequest = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), args: z.array(z.string()).optional(), command: z.string(), cwd: z.union([z.string(), z.null()]).optional(), @@ -566,7 +566,7 @@ export const zCreateTerminalRequest = z.object({ * Request to kill a terminal command without releasing the terminal. */ export const zKillTerminalCommandRequest = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), sessionId: zSessionId, terminalId: z.string(), }); @@ -579,7 +579,7 @@ export const zKillTerminalCommandRequest = z.object({ * See protocol docs: [Loading Sessions](https://agentclientprotocol.com/protocol/session-setup#loading-sessions) */ export const zLoadSessionRequest = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), cwd: z.string(), mcpServers: z.array(zMcpServer), sessionId: zSessionId, @@ -591,7 +591,7 @@ export const zLoadSessionRequest = z.object({ * Only available if the client supports the `fs.readTextFile` capability. */ export const zReadTextFileRequest = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), limit: z.union([z.number().int().gte(0), z.null()]).optional(), line: z.union([z.number().int().gte(0), z.null()]).optional(), path: z.string(), @@ -602,7 +602,7 @@ export const zReadTextFileRequest = z.object({ * Request to release a terminal and free its resources. */ export const zReleaseTerminalRequest = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), sessionId: zSessionId, terminalId: z.string(), }); @@ -617,7 +617,7 @@ export const zReleaseTerminalRequest = z.object({ * @experimental */ export const zSessionInfo = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), cwd: z.string(), sessionId: zSessionId, title: z.union([z.string(), z.null()]).optional(), @@ -634,7 +634,7 @@ export const zSessionInfo = z.object({ * @experimental */ export const zListSessionsResponse = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), nextCursor: z.union([z.string(), z.null()]).optional(), sessions: z.array(zSessionInfo), }); @@ -647,7 +647,7 @@ export const zListSessionsResponse = z.object({ * Further capabilities can be added in the future for other means of filtering or searching the list. */ export const zSessionListCapabilities = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), }); /** @@ -662,7 +662,7 @@ export const zSessionListCapabilities = z.object({ * See protocol docs: [Session Capabilities](https://agentclientprotocol.com/protocol/initialization#session-capabilities) */ export const zSessionCapabilities = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), list: z.union([zSessionListCapabilities, z.null()]).optional(), }); @@ -675,7 +675,7 @@ export const zSessionCapabilities = z.object({ * See protocol docs: [Agent Capabilities](https://agentclientprotocol.com/protocol/initialization#agent-capabilities) */ export const zAgentCapabilities = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), loadSession: z.boolean().optional().default(false), mcpCapabilities: zMcpCapabilities .optional() @@ -696,7 +696,7 @@ export const zAgentCapabilities = z.object({ * See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization) */ export const zInitializeResponse = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), agentCapabilities: zAgentCapabilities.optional().default({ loadSession: false, mcpCapabilities: { http: false, sse: false }, @@ -723,7 +723,7 @@ export const zSessionModeId = z.string(); * See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes) */ export const zCurrentModeUpdate = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), currentModeId: zSessionModeId, }); @@ -733,7 +733,7 @@ export const zCurrentModeUpdate = z.object({ * See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes) */ export const zSessionMode = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), description: z.union([z.string(), z.null()]).optional(), id: zSessionModeId, name: z.string(), @@ -743,7 +743,7 @@ export const zSessionMode = z.object({ * The set of modes and the one currently active. */ export const zSessionModeState = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), availableModes: z.array(zSessionMode), currentModeId: zSessionModeId, }); @@ -758,7 +758,7 @@ export const zSessionModeState = z.object({ * @experimental */ export const zSessionModelState = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), availableModels: z.array(zModelInfo), currentModelId: zModelId, }); @@ -767,7 +767,7 @@ export const zSessionModelState = z.object({ * Response from loading an existing session. */ export const zLoadSessionResponse = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), models: z.union([zSessionModelState, z.null()]).optional(), modes: z.union([zSessionModeState, z.null()]).optional(), }); @@ -778,7 +778,7 @@ export const zLoadSessionResponse = z.object({ * See protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol/session-setup#creating-a-session) */ export const zNewSessionResponse = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), models: z.union([zSessionModelState, z.null()]).optional(), modes: z.union([zSessionModeState, z.null()]).optional(), sessionId: zSessionId, @@ -788,7 +788,7 @@ export const zNewSessionResponse = z.object({ * Request parameters for setting a session mode. */ export const zSetSessionModeRequest = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), modeId: zSessionModeId, sessionId: zSessionId, }); @@ -797,7 +797,7 @@ export const zSetSessionModeRequest = z.object({ * Response to `session/set_mode` method. */ export const zSetSessionModeResponse = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), }); /** @@ -810,7 +810,7 @@ export const zSetSessionModeResponse = z.object({ * @experimental */ export const zSetSessionModelRequest = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), modelId: zModelId, sessionId: zSessionId, }); @@ -825,7 +825,7 @@ export const zSetSessionModelRequest = z.object({ * @experimental */ export const zSetSessionModelResponse = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), }); /** @@ -847,7 +847,7 @@ export const zStopReason = z.union([ * See protocol docs: [Check for Completion](https://agentclientprotocol.com/protocol/prompt-turn#4-check-for-completion) */ export const zPromptResponse = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), stopReason: zStopReason, }); @@ -880,7 +880,7 @@ export const zAgentResponse = z.union([ * See protocol docs: [Terminal](https://agentclientprotocol.com/protocol/terminals) */ export const zTerminal = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), terminalId: z.string(), }); @@ -888,7 +888,7 @@ export const zTerminal = z.object({ * Exit status of a terminal command. */ export const zTerminalExitStatus = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), exitCode: z.union([z.number().int().gte(0), z.null()]).optional(), signal: z.union([z.string(), z.null()]).optional(), }); @@ -897,7 +897,7 @@ export const zTerminalExitStatus = z.object({ * Request to get the current output and status of a terminal. */ export const zTerminalOutputRequest = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), sessionId: zSessionId, terminalId: z.string(), }); @@ -906,7 +906,7 @@ export const zTerminalOutputRequest = z.object({ * Response containing the terminal output and exit status. */ export const zTerminalOutputResponse = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), exitStatus: z.union([zTerminalExitStatus, z.null()]).optional(), output: z.string(), truncated: z.boolean(), @@ -916,7 +916,7 @@ export const zTerminalOutputResponse = z.object({ * Text provided to or from an LLM. */ export const zTextContent = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), annotations: z.union([zAnnotations, z.null()]).optional(), text: z.string(), }); @@ -925,7 +925,7 @@ export const zTextContent = z.object({ * Text-based resource contents. */ export const zTextResourceContents = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), mimeType: z.union([z.string(), z.null()]).optional(), text: z.string(), uri: z.string(), @@ -943,7 +943,7 @@ export const zEmbeddedResourceResource = z.union([ * The contents of a resource, embedded into a prompt or tool call result. */ export const zEmbeddedResource = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), annotations: z.union([zAnnotations, z.null()]).optional(), resource: zEmbeddedResourceResource, }); @@ -996,7 +996,7 @@ export const zContentBlock = z.union([ * Standard content block (text, images, resources). */ export const zContent = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), content: zContentBlock, }); @@ -1004,7 +1004,7 @@ export const zContent = z.object({ * A streamed item of content */ export const zContentChunk = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), content: zContentBlock, }); @@ -1016,7 +1016,7 @@ export const zContentChunk = z.object({ * See protocol docs: [User Message](https://agentclientprotocol.com/protocol/prompt-turn#1-user-message) */ export const zPromptRequest = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), prompt: z.array(zContentBlock), sessionId: zSessionId, }); @@ -1082,7 +1082,7 @@ export const zToolCallId = z.string(); * See protocol docs: [Following the Agent](https://agentclientprotocol.com/protocol/tool-calls#following-the-agent) */ export const zToolCallLocation = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), line: z.union([z.number().int().gte(0), z.null()]).optional(), path: z.string(), }); @@ -1131,7 +1131,7 @@ export const zToolKind = z.union([ * See protocol docs: [Tool Calls](https://agentclientprotocol.com/protocol/tool-calls) */ export const zToolCall = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), content: z.array(zToolCallContent).optional(), kind: zToolKind.optional(), locations: z.array(zToolCallLocation).optional(), @@ -1151,7 +1151,7 @@ export const zToolCall = z.object({ * See protocol docs: [Updating](https://agentclientprotocol.com/protocol/tool-calls#updating) */ export const zToolCallUpdate = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), content: z.union([z.array(zToolCallContent), z.null()]).optional(), kind: z.union([zToolKind, z.null()]).optional(), locations: z.union([z.array(zToolCallLocation), z.null()]).optional(), @@ -1170,7 +1170,7 @@ export const zToolCallUpdate = z.object({ * See protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/tool-calls#requesting-permission) */ export const zRequestPermissionRequest = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), options: z.array(zPermissionOption), sessionId: zSessionId, toolCall: zToolCallUpdate, @@ -1180,7 +1180,7 @@ export const zRequestPermissionRequest = z.object({ * All text that was typed after the command name is provided as input. */ export const zUnstructuredCommandInput = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), hint: z.string(), }); @@ -1193,7 +1193,7 @@ export const zAvailableCommandInput = zUnstructuredCommandInput; * Information about a command. */ export const zAvailableCommand = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), description: z.string(), input: z.union([zAvailableCommandInput, z.null()]).optional(), name: z.string(), @@ -1203,7 +1203,7 @@ export const zAvailableCommand = z.object({ * Available commands are ready or have changed */ export const zAvailableCommandsUpdate = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), availableCommands: z.array(zAvailableCommand), }); @@ -1265,7 +1265,7 @@ export const zSessionUpdate = z.union([ * See protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output) */ export const zSessionNotification = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), sessionId: zSessionId, update: zSessionUpdate, }); @@ -1281,7 +1281,7 @@ export const zAgentNotification = z.object({ * Request to wait for a terminal command to exit. */ export const zWaitForTerminalExitRequest = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), sessionId: zSessionId, terminalId: z.string(), }); @@ -1290,7 +1290,7 @@ export const zWaitForTerminalExitRequest = z.object({ * Response containing the exit status of a terminal command. */ export const zWaitForTerminalExitResponse = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), exitCode: z.union([z.number().int().gte(0), z.null()]).optional(), signal: z.union([z.string(), z.null()]).optional(), }); @@ -1301,7 +1301,7 @@ export const zWaitForTerminalExitResponse = z.object({ * Only available if the client supports the `fs.writeTextFile` capability. */ export const zWriteTextFileRequest = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), content: z.string(), path: z.string(), sessionId: zSessionId, @@ -1332,7 +1332,7 @@ export const zAgentRequest = z.object({ * Response to `fs/write_text_file` */ export const zWriteTextFileResponse = z.object({ - _meta: z.unknown().optional(), + _meta: z.object().optional(), }); export const zClientResponse = z.union([