@agentconnect.md/daemon 1.0.1-rc.2 → 1.1.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{acp-host-D7YzDuAj.js → acp-host-CZZ9sWf6.js} +2 -2
- package/dist/{acp-host-D7YzDuAj.js.map → acp-host-CZZ9sWf6.js.map} +1 -1
- package/dist/{agent-list-DJ5xDqYv.js → agent-list-DStLn6n1.js} +2 -2
- package/dist/{agent-list-DJ5xDqYv.js.map → agent-list-DStLn6n1.js.map} +1 -1
- package/dist/{chat-DYbBGnhw.js → chat-Dm0o4xg-.js} +3 -3
- package/dist/{chat-DYbBGnhw.js.map → chat-Dm0o4xg-.js.map} +1 -1
- package/dist/{dist-Bv1W3Nap.js → dist-B3ma8vHf.js} +3 -2
- package/dist/dist-B3ma8vHf.js.map +1 -0
- package/dist/{gh-token-CFtRUAS4.js → gh-token-z5M0o2mY.js} +2 -2
- package/dist/{gh-token-CFtRUAS4.js.map → gh-token-z5M0o2mY.js.map} +1 -1
- package/dist/index.js +5 -5
- package/dist/{load-agents-JwHAoWxG.js → load-agents-CRobMHIx.js} +3 -2
- package/dist/load-agents-CRobMHIx.js.map +1 -0
- package/dist/{login-BVAfcbB6.js → login-CVKg9pP8.js} +4 -4
- package/dist/{login-BVAfcbB6.js.map → login-CVKg9pP8.js.map} +1 -1
- package/dist/run-foreground-DBNTf5aQ.js +2 -0
- package/dist/{run-foreground-CO3S1OIB.js → run-foreground-hLi_PdA1.js} +178 -6
- package/dist/{run-foreground-CO3S1OIB.js.map → run-foreground-hLi_PdA1.js.map} +1 -1
- package/package.json +1 -1
- package/dist/dist-Bv1W3Nap.js.map +0 -1
- package/dist/load-agents-JwHAoWxG.js.map +0 -1
- package/dist/run-foreground-CUuX2OFP.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acp-host-D7YzDuAj.js","names":["z.object","z.string","z.array","z.record","z\n .object","z.union","fsp","fsp","c","o","r","m","v","FOLDER","isPathSpec","isPathSpec2","pathspec2","pathspec3","vulnerabilityCheck","isPathSpec3","toPaths","z.unknown","z.NEVER","z\n .array","z.union","z.number","z.string","z.object","z.record","z.unknown","z\n .int","z.literal","z.array","z.boolean","z\n .record","z.intersection","z.url","z\n .union","z.int","validate.zInitializeRequest","validate.zNewSessionRequest","validate.zLoadSessionRequest","validate.zForkSessionRequest","validate.zListSessionsRequest","validate.zDeleteSessionRequest","validate.zResumeSessionRequest","validate.zCloseSessionRequest","validate.zSetSessionModeRequest","validate.zSetSessionConfigOptionRequest","validate.zAuthenticateRequest","validate.zListProvidersRequest","validate.zSetProviderRequest","validate.zDisableProviderRequest","validate.zLogoutRequest","validate.zPromptRequest","validate.zStartNesRequest","validate.zSuggestNesRequest","validate.zCloseNesRequest","validate.zCancelNotification","validate.zDidOpenDocumentNotification","validate.zDidChangeDocumentNotification","validate.zDidCloseDocumentNotification","validate.zDidSaveDocumentNotification","validate.zDidFocusDocumentNotification","validate.zAcceptNesNotification","validate.zRejectNesNotification","validate.zRequestPermissionRequest","validate.zWriteTextFileRequest","validate.zReadTextFileRequest","validate.zCreateTerminalRequest","validate.zTerminalOutputRequest","validate.zReleaseTerminalRequest","validate.zWaitForTerminalExitRequest","validate.zKillTerminalRequest","validate.zCreateElicitationRequest","validate.zSessionNotification","validate.zCompleteElicitationNotification","spawn","createClientApp"],"sources":["../src/runtimes/registry.ts","../src/mcp/tools.ts","../src/agents/memory.ts","../src/agents/native-memory.ts","../src/agents/memory-provider.ts","../../../node_modules/.pnpm/@kwsites+file-exists@1.1.1/node_modules/@kwsites/file-exists/dist/src/index.js","../../../node_modules/.pnpm/@kwsites+file-exists@1.1.1/node_modules/@kwsites/file-exists/dist/index.js","../../../node_modules/.pnpm/@simple-git+args-pathspec@1.0.3/node_modules/@simple-git/args-pathspec/dist/index.mjs","../../../node_modules/.pnpm/@kwsites+promise-deferred@1.1.1/node_modules/@kwsites/promise-deferred/dist/index.js","../../../node_modules/.pnpm/@simple-git+argv-parser@1.1.1/node_modules/@simple-git/argv-parser/dist/index.mjs","../../../node_modules/.pnpm/simple-git@3.36.0/node_modules/simple-git/dist/esm/index.js","../src/workspace/git-injection.ts","../src/workspace/workspace-manager.ts","../../../node_modules/.pnpm/@agentclientprotocol+sdk@1.1.0_zod@4.4.3/node_modules/@agentclientprotocol/sdk/dist/schema/index.js","../../../node_modules/.pnpm/@agentclientprotocol+sdk@1.1.0_zod@4.4.3/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.js","../../../node_modules/.pnpm/@agentclientprotocol+sdk@1.1.0_zod@4.4.3/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.js","../../../node_modules/.pnpm/@agentclientprotocol+sdk@1.1.0_zod@4.4.3/node_modules/@agentclientprotocol/sdk/dist/stream.js","../../../node_modules/.pnpm/@agentclientprotocol+sdk@1.1.0_zod@4.4.3/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.js","../../../node_modules/.pnpm/@agentclientprotocol+sdk@1.1.0_zod@4.4.3/node_modules/@agentclientprotocol/sdk/dist/acp.js","../src/runtimes/probe.ts","../src/acp/acp-host.ts"],"sourcesContent":["import { z } from 'zod'\nimport { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs'\nimport { dirname } from 'node:path'\nimport type { RuntimeDef, Config } from '../config/config-schema.js'\nimport { registryPath, registryCachePath } from '../paths.js'\n\nconst PackageDistSchema = z.object({ package: z.string(), args: z.array(z.string()).default([]) })\nconst BinaryPlatformSchema = z.object({\n archive: z.string().optional(),\n cmd: z.string(),\n args: z.array(z.string()).default([]),\n env: z.record(z.string(), z.string()).default({})\n})\nconst DistributionSchema = z.object({\n npx: PackageDistSchema.optional(),\n uvx: PackageDistSchema.optional(),\n binary: z.record(z.string(), BinaryPlatformSchema).optional()\n})\nexport const RegistryEntrySchema = z.object({\n id: z.string(),\n name: z.string().default(''),\n version: z.string().default(''),\n distribution: DistributionSchema\n})\nexport type RegistryEntry = z.infer<typeof RegistryEntrySchema>\n\n// Root tolerates both an id-keyed object and an {agents:[...]} array; normalizes to {agents: Record}.\nexport const RegistryDocSchema = z\n .object({ agents: z.union([z.array(RegistryEntrySchema), z.record(z.string(), RegistryEntrySchema)]) })\n .transform((d) => ({\n agents: Array.isArray(d.agents) ? Object.fromEntries(d.agents.map((a) => [a.id, a])) : d.agents\n }))\nexport type RegistryDoc = { agents: Record<string, RegistryEntry> }\n\nexport function platformKey(): string | null {\n const os =\n process.platform === 'win32'\n ? 'windows'\n : process.platform === 'darwin'\n ? 'darwin'\n : process.platform === 'linux'\n ? 'linux'\n : null\n const arch = process.arch === 'arm64' ? 'aarch64' : process.arch === 'x64' ? 'x86_64' : null\n if (!os || !arch) return null\n return `${os}-${arch}`\n}\n\nexport function toRuntimeDef(entry: RegistryEntry): RuntimeDef | null {\n const d = entry.distribution\n if (d.npx) return { command: 'npx', args: ['-y', d.npx.package, ...d.npx.args], env: [] }\n if (d.uvx) return { command: 'uvx', args: [d.uvx.package, ...d.uvx.args], env: [] }\n if (d.binary) {\n const key = platformKey()\n const bin = key ? d.binary[key] : undefined\n if (!bin) return null\n return { command: bin.cmd, args: bin.args, env: Object.entries(bin.env).map(([name, value]) => ({ name, value })) }\n }\n return null\n}\n\nconst REGISTRY_URL = 'https://cdn.agentclientprotocol.com/registry/v1/latest/registry.json'\nconst DEFAULT_TIMEOUT_MS = 4500\n\ninterface CacheMeta {\n etag?: string\n lastModified?: string\n fetchedAt?: number\n}\n\nfunction readCachedDoc(root: string): RegistryDoc | null {\n const file = registryPath(root)\n if (!existsSync(file)) return null\n try {\n return RegistryDocSchema.parse(JSON.parse(readFileSync(file, 'utf8')))\n } catch {\n return null\n }\n}\n\nfunction readCacheMeta(root: string): CacheMeta {\n const file = registryCachePath(root)\n if (!existsSync(file)) return {}\n try {\n return JSON.parse(readFileSync(file, 'utf8')) as CacheMeta\n } catch {\n return {}\n }\n}\n\nexport async function fetchRegistry(\n root: string,\n opts: { fetchImpl?: typeof fetch; timeoutMs?: number } = {}\n): Promise<RegistryDoc> {\n const doFetch = opts.fetchImpl ?? fetch\n const meta = readCacheMeta(root)\n const headers: Record<string, string> = {}\n if (meta.etag) headers['If-None-Match'] = meta.etag\n if (meta.lastModified) headers['If-Modified-Since'] = meta.lastModified\n\n const ac = new AbortController()\n const timer = setTimeout(() => ac.abort(), opts.timeoutMs ?? DEFAULT_TIMEOUT_MS)\n try {\n const res = await doFetch(REGISTRY_URL, { headers, signal: ac.signal })\n if (res.status === 304) return readCachedDoc(root) ?? { agents: {} }\n if (!res.ok) return readCachedDoc(root) ?? { agents: {} }\n const bodyText = await res.text()\n const doc = RegistryDocSchema.parse(JSON.parse(bodyText))\n mkdirSync(dirname(registryPath(root)), { recursive: true }) // root may not exist on a zero-config first run\n writeFileSync(registryPath(root), bodyText)\n const newMeta: CacheMeta = {\n etag: res.headers.get('etag') ?? undefined,\n lastModified: res.headers.get('last-modified') ?? undefined,\n fetchedAt: Date.now()\n }\n writeFileSync(registryCachePath(root), JSON.stringify(newMeta))\n return doc\n } catch {\n return readCachedDoc(root) ?? { agents: {} }\n } finally {\n clearTimeout(timer)\n }\n}\n\n/**\n * Display names (registry id -> human-facing `name`) read from the local cache.\n * Used for capability reporting — the daemon advertises the tool name to the CP\n * rather than the registry id. Entries with no `name` are omitted (callers fall\n * back to the id). Returns `{}` when no cached registry doc exists.\n */\nexport function cachedRuntimeNames(root: string): Record<string, string> {\n const doc = readCachedDoc(root)\n if (!doc) return {}\n const out: Record<string, string> = {}\n for (const [id, entry] of Object.entries(doc.agents)) {\n if (entry.name) out[id] = entry.name\n }\n return out\n}\n\n/**\n * Runtime versions (registry id -> `version`) read from the local cache. Used to\n * stamp each entry of the `facts/daemon-runtimes` snapshot the daemon reports.\n * Entries with no `version` are omitted (callers fall back to ''). `{}` when no\n * cached registry doc exists.\n */\nexport function cachedRuntimeVersions(root: string): Record<string, string> {\n const doc = readCachedDoc(root)\n if (!doc) return {}\n const out: Record<string, string> = {}\n for (const [id, entry] of Object.entries(doc.agents)) {\n if (entry.version) out[id] = entry.version\n }\n return out\n}\n\nexport async function defaultRuntimes(\n root: string,\n opts: { mode?: 'cache-first' | 'blocking'; fetchImpl?: typeof fetch; timeoutMs?: number } = {}\n): Promise<Record<string, RuntimeDef>> {\n const mode = opts.mode ?? 'blocking'\n const cached = mode === 'cache-first' ? readCachedDoc(root) : null\n let doc: RegistryDoc\n if (cached) {\n doc = cached\n void fetchRegistry(root, opts).catch(() => {}) // background refresh; affects next run only\n } else {\n doc = await fetchRegistry(root, opts)\n }\n const out: Record<string, RuntimeDef> = {}\n for (const [id, entry] of Object.entries(doc.agents)) {\n const rt = toRuntimeDef(entry)\n if (rt) out[id] = rt\n }\n return out\n}\n\nexport async function resolveRuntimes(\n cfg: Config,\n root: string,\n opts: {\n neededRuntimes?: string[]\n mode?: 'cache-first' | 'blocking'\n fetchImpl?: typeof fetch\n timeoutMs?: number\n } = {}\n): Promise<Record<string, RuntimeDef>> {\n const userRuntimes = cfg.runtimes ?? {}\n const needed = opts.neededRuntimes\n if (needed && needed.length > 0 && needed.every((n) => userRuntimes[n])) {\n return { ...userRuntimes }\n }\n const defaults = await defaultRuntimes(root, opts)\n return { ...defaults, ...userRuntimes }\n}\n","import type { Integration } from '../agents/agent-schema.js'\n\n/**\n * A tool descriptor in MCP's `tools/list` shape: a name, a human/model-facing\n * description, and a JSON Schema for the arguments. The daemon owns these\n * definitions; the stdio bridge just relays them to the agent harness verbatim.\n */\nexport interface ToolDescriptor {\n name: string\n description: string\n inputSchema: Record<string, unknown>\n}\n\nconst obj = (properties: Record<string, unknown>, required: string[] = []): Record<string, unknown> => ({\n type: 'object',\n properties,\n required,\n additionalProperties: false\n})\n\n/**\n * Session metadata tools are available to every agent, independently of the\n * platform and memory backend. The title is deliberately model-authored: ACP\n * runtimes do not all generate a semantic session title themselves, while the\n * agent already has the context needed to choose one without a second LLM call.\n */\nexport const SESSION_TOOLS: ToolDescriptor[] = [\n {\n name: 'setSessionTitle',\n description:\n 'Set the user-facing title for this AgentConnect session. Before your first substantive answer, after you ' +\n 'understand the first meaningful request (ignore greetings and acknowledgements), call this once with a ' +\n 'concise, specific title of about 3-8 words or a similarly short phrase. Call it again only if the task focus ' +\n 'materially changes. If the user asks what the title is, set the exact title you give them. Do not mention this ' +\n 'housekeeping call in your response.',\n inputSchema: obj(\n {\n title: {\n type: 'string',\n minLength: 1,\n maxLength: 80,\n description: 'A concise, specific session title (maximum 80 characters).'\n }\n },\n ['title']\n )\n }\n]\n\n/**\n * Tools injected when an agent has a Slack integration. `sendSlackMessage` is\n * the active-messaging tool from the design (token held by the daemon, invisible\n * to the model); the rest are channel/user read helpers.\n */\nconst SLACK_TOOLS: ToolDescriptor[] = [\n {\n name: 'sendSlackMessage',\n description:\n 'Send a message to a Slack channel. Omit `channel` to post in the channel this conversation is happening in. ' +\n 'Omit `thread` to reply in the current thread; pass an empty string to post to the channel root instead.',\n inputSchema: obj(\n {\n text: {\n type: 'string',\n description:\n 'Message body, in standard Markdown (CommonMark/GFM). Use `**bold**`, `~~strikethrough~~`, ' +\n '`# headings`, tables, etc. — Slack renders standard Markdown natively (do NOT use single-char ' +\n 'Slack mrkdwn like `*bold*` or `~strike~`).'\n },\n channel: {\n type: 'string',\n description: 'Target channel ID (e.g. C0123ABC). Defaults to the current channel.'\n },\n thread: {\n type: 'string',\n description: 'Thread timestamp to reply under. Defaults to the current thread; \"\" posts to the channel root.'\n }\n },\n ['text']\n )\n },\n {\n name: 'getCurrentChannel',\n description:\n 'Return the Slack channel (and thread) this conversation is bound to, including the channel name when available.',\n inputSchema: obj({})\n },\n {\n name: 'listChannelMembers',\n description:\n 'List the users and bots in a channel (id, name, is_bot). Omit `channel` to list members of the current channel.',\n inputSchema: obj({\n channel: { type: 'string', description: 'Channel ID. Defaults to the current channel.' }\n })\n },\n {\n name: 'listChannels',\n description: 'List the public/private channels the bot is a member of and can post to.',\n inputSchema: obj({})\n },\n {\n name: 'getUserProfile',\n description: 'Look up a Slack user or bot by id, returning their display name, real name, and bot flag.',\n inputSchema: obj({ user: { type: 'string', description: 'User ID (e.g. U0123ABC).' } }, ['user'])\n },\n {\n name: 'readSlackFile',\n description:\n 'Fetch the contents of a file shared in Slack, using the bot credentials. You do NOT have direct network access ' +\n \"to Slack's private file URLs (they require the bot token) — use this tool instead of curl/fetch. Pass the file's \" +\n '`url` (the `url_private` / `uri` from a shared attachment or resource link). Images are returned as viewable image ' +\n 'content; text files as text. Supply `mimeType` when known for correct handling.',\n inputSchema: obj(\n {\n url: { type: 'string', description: \"The file's url_private (or url_private_download) / resource-link uri.\" },\n mimeType: { type: 'string', description: 'Optional MIME type hint, e.g. image/png or text/plain.' }\n },\n ['url']\n )\n }\n]\n\n/**\n * Tools injected when an agent has a Telegram integration. Mirrors the Slack set\n * but for the Telegram data model: `channel` is a chat id (e.g. -1001234567890),\n * `thread` is a forum-topic `message_thread_id`, and there is no `listChannels`\n * (a bot cannot enumerate the chats it belongs to).\n */\nconst TELEGRAM_TOOLS: ToolDescriptor[] = [\n {\n name: 'sendTelegramMessage',\n description:\n 'Send a message to a Telegram chat. Omit `channel` to post in the chat this conversation is happening in. ' +\n 'Omit `thread` to reply in the current forum topic; pass an empty string to post outside any topic.',\n inputSchema: obj(\n {\n text: {\n type: 'string',\n description:\n 'Message body, in standard Markdown (CommonMark/GFM). Use `**bold**`, `*italic*`, `` `code` ``, ' +\n '`[links](url)`, lists, etc. — the daemon converts it to Telegram formatting and escapes special ' +\n 'characters for you, so write plain Markdown (do NOT pre-escape with backslashes).'\n },\n channel: {\n type: 'string',\n description:\n 'Target chat id (e.g. -1001234567890, or a positive id for a private chat). Defaults to the current chat.'\n },\n thread: {\n type: 'string',\n description:\n 'Forum-topic message_thread_id to reply under. Defaults to the current topic; \"\" posts outside any topic.'\n }\n },\n ['text']\n )\n },\n {\n name: 'getCurrentChannel',\n description:\n 'Return the Telegram chat (and forum topic) this conversation is bound to, including the chat title when available.',\n inputSchema: obj({})\n },\n {\n name: 'listChannelMembers',\n description:\n 'List the users and bots in a chat (id, name, is_bot). Omit `channel` to list members of the current chat. ' +\n 'Note: Telegram only exposes administrators for large groups.',\n inputSchema: obj({\n channel: { type: 'string', description: 'Chat id. Defaults to the current chat.' }\n })\n },\n {\n name: 'getUserProfile',\n description: 'Look up a Telegram user or bot by id, returning their display name, username, and bot flag.',\n inputSchema: obj({ user: { type: 'string', description: 'Numeric user id (e.g. 12345678).' } }, ['user'])\n },\n {\n name: 'readTelegramFile',\n description:\n 'Fetch the contents of a file shared in Telegram, using the bot credentials. You do NOT have direct network ' +\n \"access to Telegram's file storage — use this tool instead of curl/fetch. Pass the file's `url` (the `file_id` \" +\n 'from a shared attachment or the `uri` of a resource link). Images are returned as viewable image content; text ' +\n 'files as text. Supply `mimeType` when known for correct handling.',\n inputSchema: obj(\n {\n url: { type: 'string', description: \"The shared file's Telegram file_id (or resource-link uri).\" },\n mimeType: { type: 'string', description: 'Optional MIME type hint, e.g. image/png or text/plain.' }\n },\n ['url']\n )\n }\n]\n\n/**\n * The agent's long-term memory tools — available to EVERY agent regardless of\n * integrations. Memory is a directory (`<agent-root>/memory/`) with a `MEMORY.md`\n * index (injected into the prompt each session) plus `<topic>.md` files the agent\n * reads on demand. Keep the index short; move detail into topic files.\n */\nexport const MEMORY_TOOLS: ToolDescriptor[] = [\n {\n name: 'listMemory',\n description:\n 'List your memory files — the MEMORY.md index plus any topic files you have written. Use this to discover ' +\n 'what you have stored before reading or updating it.',\n inputSchema: obj({})\n },\n {\n name: 'readMemory',\n description:\n 'Read one of your memory files. Omit `path` (or pass \"MEMORY.md\") to read the index; pass a topic file name ' +\n '(e.g. \"deploys.md\") to read that topic. The index is already shown to you at the start of each session — use ' +\n 'this to pull the detail behind an index entry when it is relevant.',\n inputSchema: obj({\n path: { type: 'string', description: 'Memory file name (e.g. \"deploys.md\"). Defaults to the MEMORY.md index.' }\n })\n },\n {\n name: 'writeMemory',\n description:\n 'Save one of your memory files (whole-file overwrite). Omit `path` to write the MEMORY.md index; pass a topic ' +\n 'file name (e.g. \"deploys.md\") for a topic. Keep the INDEX short — a scannable list that links to topic files ' +\n '(e.g. \"- [deploys](deploys.md) — how we ship\"); put the actual detail in the topic files. Use for durable ' +\n 'facts across sessions: conventions, decisions, who to ask, things you had to re-learn. A flat directory — no ' +\n 'subfolders in the path.',\n inputSchema: obj(\n {\n path: {\n type: 'string',\n description: 'Memory file name (e.g. \"deploys.md\"). Defaults to the MEMORY.md index. No subdirectories.'\n },\n content: { type: 'string', description: 'The full new file contents, in Markdown. Replaces the file.' }\n },\n ['content']\n )\n }\n]\n\n/** The memory tool names — used to strip them for a `native`-memory agent (which\n * uses the runtime's own memory instead). */\nexport const MEMORY_TOOL_NAMES = new Set(MEMORY_TOOLS.map((t) => t.name))\n\n/**\n * Agent-collaboration tools — available to EVERY agent regardless of platform\n * (discovery is org/coords-level, not platform-gated). `listChannelAgents` asks\n * the CP who else is in the current channel so an agent can find peers to work\n * with. The requesting agent's identity is injected by the daemon from the\n * session context — it is NOT a tool input.\n */\nexport const COLLABORATION_TOOLS: ToolDescriptor[] = [\n {\n name: 'listChannelAgents',\n description:\n 'List the other AI agents present in a channel — their id, name, displayName, description, and status — so you ' +\n 'can discover peers to collaborate with. Omit `channel` to list agents in the channel this conversation is ' +\n 'happening in. Only channels you are a member of can be listed, and only agents you are allowed to reach are ' +\n 'returned.',\n inputSchema: obj({\n channel: {\n type: 'string',\n description: 'Channel/chat id to list agents for. Defaults to the current channel.'\n }\n })\n },\n {\n name: 'messageAgent',\n description:\n 'Wake another AI agent by delivering a message into its session, so it picks the work up in its own turn. ' +\n 'Use `toAgentId` from listChannelAgents. The message is delivered asynchronously — this does NOT return the ' +\n \"peer's reply; the peer answers in the channel/thread (and can message you back). Omit `channel`/`thread` to \" +\n 'target the same thread this conversation is in. Your identity as the caller is attached automatically — you ' +\n 'cannot message yourself, and the target may be configured to reject calls from you (then `delivered` is false ' +\n 'with a `reason`). When you are REPLYING to an agent that messaged you (you set `toAgentId` to that same agent), ' +\n 'your reply automatically carries the correlation back to it — you do NOT need to pass `correlationId`; the ' +\n 'daemon threads it for you so orchestration results are matched. Pass `correlationId` only to override this ' +\n 'default (advanced/manual use). ' +\n 'IMPORTANT — be quiet about the mechanics: do NOT post a separate chat message announcing that you sent it or ' +\n 'restating \"delivered: true\"; the delivery is handled and already visible. After calling this tool, stay silent ' +\n 'and end your turn unless you have something substantive for the human (a genuine blocker, or the peer’s actual ' +\n 'reply once it arrives). Keep any necessary status to one short line.',\n inputSchema: obj(\n {\n toAgentId: { type: 'string', description: 'The agent id to message (from listChannelAgents).' },\n text: { type: 'string', description: 'The message to deliver into the target agent’s session.' },\n channel: {\n type: 'string',\n description: 'Target channel/chat id. Defaults to the current channel.'\n },\n thread: {\n type: 'string',\n description: 'Target thread. Defaults to the current thread; \"\" targets the channel root.'\n },\n correlationId: {\n type: 'string',\n description:\n 'Optional opaque id to correlate a reply back to this request (used by multi-agent orchestration). ' +\n 'You normally do NOT set this: when replying to an agent that called you, the correlation is inherited ' +\n 'automatically. Provide it only to override the inherited value.'\n }\n },\n ['toAgentId', 'text']\n )\n },\n {\n name: 'startOrchestration',\n description:\n 'Fan out a batch of subtasks to worker agents in one atomic step, then wait asynchronously. ' +\n 'The daemon persists an orchestration record (all subtasks pending) BEFORE delivering, delivers each ' +\n 'subtask to its worker (attaching a correlationId so their replies map back), and schedules a one-shot ' +\n 'deadline that wakes THIS session when it fires. Returns { orchestrationId, delivered:[correlationId…], ' +\n 'failed:[{correlationId, reason}…] }. This does NOT return the workers’ results — you are woken (by a ' +\n 'worker reply or the deadline) and then call getOrchestration to read statuses/results and summarize. ' +\n 'Tell each worker in its `text` to report back to you when done (their reply auto-carries the correlationId).',\n inputSchema: obj(\n {\n subtasks: {\n type: 'array',\n description: 'The subtasks to fan out, one per worker delivery.',\n items: obj(\n {\n toAgentId: { type: 'string', description: 'The worker agent id to deliver this subtask to.' },\n text: { type: 'string', description: 'The instruction delivered into the worker’s session.' }\n },\n ['toAgentId', 'text']\n )\n },\n deadlineMs: {\n type: 'number',\n description:\n 'Optional deadline in milliseconds from now. When it elapses, your session is woken so you can ' +\n 'summarize partial results; unreported subtasks are marked timed_out. Omit for no deadline.'\n },\n replyTarget: {\n type: 'string',\n description: 'Optional opaque marker for where you should post the final human-facing summary.'\n }\n },\n ['subtasks']\n )\n },\n {\n name: 'getOrchestration',\n description:\n 'Read one of YOUR orchestrations — its subtasks with per-subtask status (pending/sending/delivered/' +\n 'succeeded/worker_error/timed_out) and any collected results. Call this each time you are woken (by a ' +\n 'worker report or the deadline) to judge whether all subtasks are in (N-of-N) or the deadline passed, ' +\n 'then summarize. Only the orchestration’s owning main agent+session may read it.',\n inputSchema: obj(\n { orchestrationId: { type: 'string', description: 'The orchestrationId returned by startOrchestration.' } },\n ['orchestrationId']\n )\n },\n {\n name: 'cancelOrchestration',\n description:\n 'Cancel one of YOUR orchestrations: cancels its pending deadline and writes a cancelled tombstone (the ' +\n 'record is kept, not deleted). Already-delivered workers are not recalled — a late report from them after ' +\n 'cancellation is ignored. Only the owning main agent+session may cancel.',\n inputSchema: obj(\n { orchestrationId: { type: 'string', description: 'The orchestrationId returned by startOrchestration.' } },\n ['orchestrationId']\n )\n }\n]\n\n/**\n * Formal GitHub PR review effect. The descriptor may remain attached to a\n * long-lived per-thread ACP session, but availability is not authorization:\n * execution resolves the daemon-private active hook turn and fails closed for\n * every ordinary/non-PR/policy-off turn. The target is intentionally absent.\n */\nexport const GITHUB_REVIEW_TOOLS: ToolDescriptor[] = [\n {\n name: 'submitGithubReview',\n description:\n 'Submit the formal review for the active GitHub pull-request hook turn. The repository, pull request, and ' +\n 'commit are fixed by trusted turn metadata and cannot be selected here. Use COMMENT for a formal non-blocking ' +\n 'review, REQUEST_CHANGES for a failing review, or APPROVE for a passing review. This tool is unavailable ' +\n 'outside an authorized active PR hook turn, and at most one review can be submitted per turn. The review body ' +\n 'is the complete public response: once an attempt starts, only a definite not_submitted result preserves the ordinary-comment fallback.',\n inputSchema: obj(\n {\n event: { type: 'string', enum: ['COMMENT', 'REQUEST_CHANGES', 'APPROVE'] },\n verdict: { type: 'string', enum: ['pass', 'fail', 'neutral'] },\n body: {\n type: 'string',\n minLength: 1,\n description:\n 'Complete, self-contained top-level public review summary. Required and non-empty for every event, including APPROVE.'\n },\n comments: {\n type: 'array',\n description: 'Optional inline review comments, submitted atomically with the top-level review.',\n items: obj(\n {\n path: { type: 'string' },\n body: { type: 'string' },\n line: { type: 'integer', minimum: 1 },\n side: { type: 'string', enum: ['LEFT', 'RIGHT'] },\n startLine: { type: 'integer', minimum: 1 },\n startSide: { type: 'string', enum: ['LEFT', 'RIGHT'] }\n },\n ['path', 'body', 'line', 'side']\n )\n }\n },\n ['event', 'verdict', 'body']\n )\n }\n]\n\nexport const ALL_TOOL_NAMES = [\n ...new Set(\n [\n ...SESSION_TOOLS,\n ...SLACK_TOOLS,\n ...TELEGRAM_TOOLS,\n ...MEMORY_TOOLS,\n ...COLLABORATION_TOOLS,\n ...GITHUB_REVIEW_TOOLS\n ].map((t) => t.name)\n )\n]\n\n/**\n * The default MCP tool set for an agent. Session metadata, memory, and\n * collaboration tools are always present; platform tools are gated by the\n * agent's integrations. Deduped by name so an agent bridging both platforms\n * doesn't get the shared read helpers (getCurrentChannel/listChannelMembers/getUserProfile)\n * twice — the first platform's variant wins, and both behave identically.\n */\nexport function toolsForIntegrations(integrations: Integration[]): ToolDescriptor[] {\n const tools: ToolDescriptor[] = []\n const seen = new Set<string>()\n const add = (set: ToolDescriptor[]) => {\n for (const t of set) {\n if (seen.has(t.name)) continue\n seen.add(t.name)\n tools.push(t)\n }\n }\n add(SESSION_TOOLS)\n add(MEMORY_TOOLS)\n add(COLLABORATION_TOOLS)\n if (integrations.some((i) => i.platform === 'slack')) add(SLACK_TOOLS)\n if (integrations.some((i) => i.platform === 'telegram')) add(TELEGRAM_TOOLS)\n return tools\n}\n","/**\n * Agent memory — a DIRECTORY at the agent's ROOT (`<agent-root>/memory/`), OUTSIDE\n * the workspace so it survives a workspace reset / re-clone and is never committed\n * into a github-workspace repo.\n *\n * Index-plus-topics shape (the structure Claude Code's auto-memory uses): a lean\n * `MEMORY.md` index — injected into the prompt every session, so it must stay small\n * — plus any number of `<topic>.md` files the agent reads on demand. The agent\n * maintains it via the `readMemory` / `writeMemory` / `listMemory` MCP tools; the\n * daemon serves the same directory to the CP for the console.\n *\n * SECURITY: topic paths are agent/console-supplied, so every path is contained to\n * the memory dir — absolute paths and `..` escapes are rejected, and the resolved\n * path is re-checked so a symlink can't smuggle a target out. Flat by design (one\n * level): a topic is a file directly under `memory/`, no nested dirs.\n */\nimport { promises as fsp, mkdirSync, existsSync, writeFileSync } from 'node:fs'\nimport { join, resolve, isAbsolute, sep } from 'node:path'\nimport { MEMORY_INDEX } from '@agentconnect.md/protocol'\n\nexport const MEMORY_DIRNAME = 'memory'\nexport { MEMORY_INDEX }\n\n/** Max bytes of the index injected into the prompt each session — keeps a large\n * memory from swelling the context (mirrors Claude Code's 25 KB entrypoint cap). */\nexport const MAX_INDEX_INJECT_BYTES = 25_000\n\n/** Hard cap on a single memory file. Injected/read every session, so an unbounded\n * file would swell the prompt and the wire; writes over this are rejected. */\nexport const MAX_MEMORY_FILE_BYTES = 256_000\n\n/** The append-only change log for an agent's memory, a sidecar beside the memory\n * files (`<agent-root>/memory/.history`). One JSON line per write, for provenance\n * (who/what/when changed a file). Dotfile so it never surfaces as a topic. */\nexport const MEMORY_HISTORY_FILENAME = '.history'\n\n/** Cap on a `before`/`after` snapshot stored in a history line — keeps a single log\n * entry bounded even for a large file. Over this, the snapshot is truncated (with a\n * `…` marker) rather than omitted, so the line stays small but still human-readable. */\nexport const MAX_HISTORY_VALUE_BYTES = 4_000\n\n/** Where a memory write originated — for change-log provenance. */\nexport type MemoryWriteSource = 'tool' | 'console' | 'distill'\n\n/** One line in the memory change log (`.history`). `event` is `add` on a first write,\n * `update` on an overwrite; `delete` is reserved (no delete op exists today — a\n * \"clear\" is an empty write, recorded as an `update`). `before`/`after` are the\n * file's text, truncated to {@link MAX_HISTORY_VALUE_BYTES}. */\nexport interface MemoryHistoryRecord {\n path: string\n event: 'add' | 'update' | 'delete'\n before?: string\n after: string\n at: string\n scope: string\n source: MemoryWriteSource\n truncated?: boolean\n}\n\n/** Raised when a memory path escapes the memory dir. Surfaces as `BAD_PAYLOAD`. */\nexport class MemoryPathError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'MemoryPathError'\n }\n}\n\n/** Raised when a write exceeds {@link MAX_MEMORY_FILE_BYTES}. `BAD_PAYLOAD`. */\nexport class MemoryTooLargeError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'MemoryTooLargeError'\n }\n}\n\n/** Raised when an `ifMatchMtime` precondition fails (the file changed under the\n * writer — e.g. a console edit racing a newer agent write). Surfaces as CONFLICT. */\nexport class MemoryConflictError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'MemoryConflictError'\n }\n}\n\n/** The memory directory for an agent, given its root dir (where agent.json lives). */\nexport function memoryDir(agentDir: string): string {\n return join(agentDir, MEMORY_DIRNAME)\n}\n\n/** Resolve a memory-dir-relative path to an absolute one, contained to the dir.\n * Rejects absolute paths, `..` escapes, and any nested directory (flat only). */\nexport function resolveInMemoryDir(agentDir: string, relPath: string): string {\n if (isAbsolute(relPath)) throw new MemoryPathError('absolute paths are not allowed')\n const dir = memoryDir(agentDir)\n const abs = resolve(dir, relPath)\n if (abs !== dir && !abs.startsWith(dir + sep)) throw new MemoryPathError('path escapes the memory dir')\n // Flat memory dir: a topic is a direct child, never a nested path.\n const rel = abs.slice(dir.length + 1)\n if (rel.includes(sep)) throw new MemoryPathError('memory is a flat directory (no subdirectories)')\n if (rel.length === 0) throw new MemoryPathError('a file name is required')\n return abs\n}\n\n/** Seed `<agent-root>/memory/MEMORY.md` with a header if the dir/index is absent\n * (idempotent). Called at session start so a brand-new agent always has an index. */\nexport function ensureMemory(agentDir: string, agentName: string): void {\n const dir = memoryDir(agentDir)\n mkdirSync(dir, { recursive: true })\n const index = join(dir, MEMORY_INDEX)\n if (!existsSync(index)) {\n writeFileSync(\n index,\n `# ${agentName} memory\\n\\nYour long-term memory index. Keep it short — link out to topic files ` +\n `(e.g. \\`[deploys](deploys.md)\\`) for detail and read them on demand with the readMemory tool.\\n`\n )\n }\n}\n\n/** Read the memory index (`MEMORY.md`) for prompt injection, trimmed to the inject\n * cap so a large index can't blow up the prompt; '' when absent. */\nexport async function readIndex(agentDir: string): Promise<string> {\n const text = await readMemoryFile(agentDir, MEMORY_INDEX)\n if (Buffer.byteLength(text) <= MAX_INDEX_INJECT_BYTES) return text\n // Cut on a UTF-8 boundary near the cap and flag the truncation.\n const buf = Buffer.from(text, 'utf8').subarray(0, MAX_INDEX_INJECT_BYTES)\n return buf.toString('utf8') + '\\n\\n[…memory index truncated — trim MEMORY.md]'\n}\n\n/** Read a memory file's text; '' when it does not exist (never throws on ENOENT). */\nexport async function readMemoryFile(agentDir: string, relPath: string): Promise<string> {\n const abs = resolveInMemoryDir(agentDir, relPath)\n try {\n return await fsp.readFile(abs, 'utf8')\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return ''\n throw err\n }\n}\n\n/** Truncate a snapshot to the history value cap, on a UTF-8 boundary, flagging it. */\nfunction clampHistoryValue(text: string): { value: string; truncated: boolean } {\n if (Buffer.byteLength(text) <= MAX_HISTORY_VALUE_BYTES) return { value: text, truncated: false }\n const buf = Buffer.from(text, 'utf8').subarray(0, MAX_HISTORY_VALUE_BYTES)\n return { value: buf.toString('utf8') + '…', truncated: true }\n}\n\n/** Append one line to the memory change log (`<agent-root>/memory/.history`). A single\n * `O_APPEND` write, so concurrent appends never interleave a partial line. Best-effort:\n * a logging failure must never fail the write it describes, so errors are swallowed. */\nexport async function appendHistory(agentDir: string, record: MemoryHistoryRecord): Promise<void> {\n try {\n await fsp.mkdir(memoryDir(agentDir), { recursive: true })\n await fsp.appendFile(join(memoryDir(agentDir), MEMORY_HISTORY_FILENAME), JSON.stringify(record) + '\\n', 'utf8')\n } catch {\n // provenance is best-effort — never let it break the actual memory write.\n }\n}\n\n/** Overwrite a memory file with `content` (creating the dir if needed). Atomic\n * (tmp + rename) so a concurrent read never sees a partial file. Appends a line to\n * the change log (`.history`) recording the add/update, its `before`/`after`\n * snapshot (bounded), and the `source`.\n *\n * - Rejects content over {@link MAX_MEMORY_FILE_BYTES} ({@link MemoryTooLargeError}).\n * - `ifMatchMtime` (optimistic concurrency): when given, the current file's mtime\n * must equal it, else {@link MemoryConflictError} — so a console edit can't\n * clobber a newer write. A brand-new file (no mtime) matches `ifMatchMtime`\n * only when the caller passes none (or the empty string). */\nexport async function writeMemoryFile(\n agentDir: string,\n relPath: string,\n content: string,\n ifMatchMtime?: string,\n source: MemoryWriteSource = 'tool'\n): Promise<{ size: number; mtime: string }> {\n if (Buffer.byteLength(content) > MAX_MEMORY_FILE_BYTES) {\n throw new MemoryTooLargeError(`memory file exceeds the ${MAX_MEMORY_FILE_BYTES}-byte limit`)\n }\n const abs = resolveInMemoryDir(agentDir, relPath)\n // Read the prior contents (for the change log's `before` + to decide add vs update)\n // before we overwrite. '' when absent ⇒ this is an `add`.\n let before = ''\n let existed = false\n try {\n before = await fsp.readFile(abs, 'utf8')\n existed = true\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code !== 'ENOENT') throw err\n }\n if (ifMatchMtime) {\n let current: string | null = null\n try {\n current = (await fsp.stat(abs)).mtime.toISOString()\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code !== 'ENOENT') throw err\n }\n if (current !== ifMatchMtime) {\n throw new MemoryConflictError('the memory file changed since it was read; reload and retry')\n }\n }\n await fsp.mkdir(memoryDir(agentDir), { recursive: true })\n const tmp = `${abs}.tmp`\n await fsp.writeFile(tmp, content, 'utf8')\n await fsp.rename(tmp, abs)\n const st = await fsp.stat(abs)\n\n const beforeClamped = existed ? clampHistoryValue(before) : undefined\n const afterClamped = clampHistoryValue(content)\n await appendHistory(agentDir, {\n path: relPath,\n event: existed ? 'update' : 'add',\n ...(beforeClamped ? { before: beforeClamped.value } : {}),\n after: afterClamped.value,\n at: st.mtime.toISOString(),\n scope: 'agent',\n source,\n ...(afterClamped.truncated || beforeClamped?.truncated ? { truncated: true } : {})\n })\n return { size: st.size, mtime: st.mtime.toISOString() }\n}\n\n/** One file in the memory dir. */\nexport interface MemoryFile {\n name: string\n size: number\n mtime: string\n}\n\n/** List the files in the memory dir (flat; index + topics), sorted with the index\n * first. Empty when the dir does not exist. `.tmp` write artifacts are skipped. */\nexport async function listMemory(agentDir: string): Promise<MemoryFile[]> {\n const dir = memoryDir(agentDir)\n let dirents\n try {\n dirents = await fsp.readdir(dir, { withFileTypes: true })\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return []\n throw err\n }\n const files: MemoryFile[] = []\n for (const d of dirents) {\n // Skip non-files, `.tmp` write artifacts, and dotfiles (the `.history` change log\n // is a sidecar, not a topic the agent/console should see).\n if (!d.isFile() || d.name.endsWith('.tmp') || d.name.startsWith('.')) continue\n try {\n const st = await fsp.stat(join(dir, d.name))\n files.push({ name: d.name, size: st.size, mtime: st.mtime.toISOString() })\n } catch {\n // raced deletion — skip\n }\n }\n files.sort((a, b) => (a.name === MEMORY_INDEX ? -1 : b.name === MEMORY_INDEX ? 1 : a.name.localeCompare(b.name)))\n return files\n}\n","/**\n * Native-memory runtime levers + file surfacing.\n *\n * The `native` MemoryProvider (agents/memory-provider.ts) redirects the runtime's\n * OWN memory under the agent root — so each agent's native memory is isolated\n * instead of sharing the host's `~/.claude` / `~/.codex`. Two responsibilities:\n *\n * 1. `nativeRuntimeEnv` — the env delta that redirects (and, where needed, enables)\n * the runtime's memory. This is an EXPLICIT per-runtime registry: we only set\n * env for runtimes whose levers we've verified against their docs. A runtime not\n * in the registry is `isNativeRuntimeSupported === false`, and selecting native\n * for it fails loudly upstream — we never guess env for an unverified runtime.\n *\n * 2. `nativeMemoryList/Read/Write` — surface the runtime's memory files to the\n * console from wherever the redirect points. Unlike managed's flat\n * `<agent-root>/memory/`, the runtime dirs are nested (Claude keys memory by a\n * sanitized-cwd subpath), so this uses a nested-but-contained walk.\n *\n * Levers verified 2026-07-08 (claude docs + binary strings; codex docs; and the\n * daemon's own `runtimes/probe.ts` home-override table):\n * - claude → `CLAUDE_CONFIG_DIR=<root>/.claude`; auto-memory lands at\n * `<root>/.claude/projects/<sanitized-cwd>/memory/`. Do NOT set the disable flag.\n * - codex → `CODEX_HOME=<root>/.codex`; memories at `<root>/.codex/memories/`.\n */\nimport { promises as fsp } from 'node:fs'\nimport { join, resolve, isAbsolute, sep, relative } from 'node:path'\nimport type { RuntimeDef } from '../config/config-schema.js'\nimport type { MemoryEntry } from '@agentconnect.md/protocol'\nimport type { MemoryReadResult, MemoryWriteResult } from './memory-provider.js'\nimport { MemoryPathError, MemoryTooLargeError, MAX_MEMORY_FILE_BYTES } from './memory.js'\n\n/** A registered native runtime: how to detect it, and the env + read-root it implies. */\ninterface NativeRuntimeSpec {\n /** Does this RuntimeDef refer to this runtime? (command/args substring, lowercased) */\n matches: (runtime: RuntimeDef) => boolean\n /** Env delta that redirects (and enables) the runtime's own memory under `root`. */\n env: (root: string) => Record<string, string>\n /** The dir (relative to the agent root) the runtime writes its memory into — what\n * the console lists/reads. Nested files under it are allowed. */\n readRoot: (root: string) => string\n}\n\nfunction cmdIncludes(runtime: RuntimeDef, needle: string): boolean {\n return [runtime.command, ...runtime.args].join(' ').toLowerCase().includes(needle)\n}\n\n/**\n * The explicit registry. ADD a runtime here only after verifying its env levers\n * against the tool's own docs (and, ideally, the installed binary) — mirroring the\n * home-override table the daemon already keeps in `runtimes/probe.ts`. An absent\n * runtime is intentionally unsupported for native memory.\n */\nconst NATIVE_RUNTIMES: NativeRuntimeSpec[] = [\n {\n // Anthropic Claude Code — CLAUDE_CONFIG_DIR relocates the whole `.claude` state\n // dir; auto-memory lives under it at projects/<sanitized-cwd>/memory/. We do NOT\n // set CLAUDE_CODE_DISABLE_AUTO_MEMORY (that's managed's job).\n matches: (rt) => cmdIncludes(rt, 'claude'),\n env: (root) => ({ CLAUDE_CONFIG_DIR: join(root, '.claude') }),\n // memory lands in a cwd-derived subpath — list the projects tree and pick out\n // the memory dirs (see listUnder, which walks nested files).\n readRoot: (root) => join(root, '.claude', 'projects')\n },\n {\n // OpenAI Codex — CODEX_HOME relocates the home; memories land in memories/.\n matches: (rt) => cmdIncludes(rt, 'codex'),\n env: (root) => ({ CODEX_HOME: join(root, '.codex') }),\n readRoot: (root) => join(root, '.codex', 'memories')\n }\n]\n\nfunction specFor(runtime: RuntimeDef | undefined): NativeRuntimeSpec | undefined {\n if (!runtime) return undefined\n return NATIVE_RUNTIMES.find((s) => s.matches(runtime))\n}\n\n/** Whether native memory is supported (env levers registered) for this runtime. */\nexport function isNativeRuntimeSupported(runtime: RuntimeDef): boolean {\n return specFor(runtime) !== undefined\n}\n\n/** The env delta redirecting the runtime's own memory under `agentRoot`. Empty for\n * an unregistered runtime (callers should gate on `isNativeRuntimeSupported`). */\nexport function nativeRuntimeEnv(runtime: RuntimeDef, agentRoot: string): Record<string, string> {\n return specFor(runtime)?.env(agentRoot) ?? {}\n}\n\n/** Resolve a console-supplied relative path under `root`, allowing nested dirs but\n * rejecting absolute paths, `..` escapes, and symlink-smuggled escapes. Unlike the\n * managed dir (flat), native runtime dirs are nested. */\nfunction resolveContained(root: string, relPath: string): string {\n if (isAbsolute(relPath)) throw new MemoryPathError('absolute paths are not allowed')\n const abs = resolve(root, relPath)\n if (abs !== root && !abs.startsWith(root + sep)) throw new MemoryPathError('path escapes the memory dir')\n if (abs === root) throw new MemoryPathError('a file name is required')\n return abs\n}\n\n/** Recursively list files under `dir` (relative names, posix-ish with `sep`), sorted.\n * Empty when the dir is absent. Skips `.tmp` artifacts. */\nasync function listUnder(dir: string): Promise<MemoryEntry[]> {\n const out: MemoryEntry[] = []\n async function walk(cur: string): Promise<void> {\n let dirents\n try {\n dirents = await fsp.readdir(cur, { withFileTypes: true })\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return\n throw err\n }\n for (const d of dirents) {\n const p = join(cur, d.name)\n if (d.isDirectory()) {\n await walk(p)\n } else if (d.isFile() && !d.name.endsWith('.tmp')) {\n try {\n const st = await fsp.stat(p)\n out.push({ name: relative(dir, p), size: st.size, mtime: st.mtime.toISOString() })\n } catch {\n // raced deletion — skip\n }\n }\n }\n }\n await walk(dir)\n out.sort((a, b) => a.name.localeCompare(b.name))\n return out\n}\n\n/** List the runtime's native memory files under the agent root. */\nexport async function nativeMemoryList(agentDir: string, runtime: RuntimeDef | undefined): Promise<MemoryEntry[]> {\n const spec = specFor(runtime)\n if (!spec) return []\n return listUnder(spec.readRoot(agentDir))\n}\n\n/** Read one native memory file (relative to the runtime's read root); '' when absent. */\nexport async function nativeMemoryRead(\n agentDir: string,\n runtime: RuntimeDef | undefined,\n path: string\n): Promise<MemoryReadResult> {\n const spec = specFor(runtime)\n if (!spec) return { path, content: '' }\n const abs = resolveContained(spec.readRoot(agentDir), path)\n try {\n return { path, content: await fsp.readFile(abs, 'utf8') }\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return { path, content: '' }\n throw err\n }\n}\n\n/** Overwrite one native memory file (console edit). Atomic tmp+rename; size-capped. */\nexport async function nativeMemoryWrite(\n agentDir: string,\n runtime: RuntimeDef | undefined,\n path: string,\n content: string,\n _ifMatch?: string\n): Promise<MemoryWriteResult> {\n const spec = specFor(runtime)\n if (!spec) throw new MemoryPathError('native memory is not supported for this runtime')\n if (Buffer.byteLength(content) > MAX_MEMORY_FILE_BYTES) {\n throw new MemoryTooLargeError(`memory file exceeds the ${MAX_MEMORY_FILE_BYTES}-byte limit`)\n }\n const abs = resolveContained(spec.readRoot(agentDir), path)\n const dir = abs.slice(0, abs.length - (abs.split(sep).pop()?.length ?? 0))\n await fsp.mkdir(dir, { recursive: true })\n const tmp = `${abs}.tmp`\n await fsp.writeFile(tmp, content, 'utf8')\n await fsp.rename(tmp, abs)\n const st = await fsp.stat(abs)\n return { ok: true, path, size: st.size, mtime: st.mtime.toISOString() }\n}\n","/**\n * `MemoryProvider` — the pluggable seam behind an agent's long-term memory.\n *\n * The daemon drives a provider at the existing hook points: it seeds/injects the\n * memory index at session start, exposes the memory tools, serves list/read/write\n * for both the agent (MCP tools) and the console, and contributes the runtime-env\n * delta that decides where the runtime's OWN memory lives. Making this a port lets\n * memory be backed three ways (design: docs/designs/memory-evolution.md):\n *\n * - `managed` — our directory (`<agent-root>/memory/`), the default. The runtime's\n * own memory is DISABLED so there's one store.\n * - `native` — the runtime's own memory (Claude auto-memory / Codex memories),\n * REDIRECTED under the agent root (via env) for per-agent isolation. We don't\n * inject or expose tools — the runtime manages and loads it itself.\n * - `external` — an outside service (e.g. mem0). Not yet implemented (M-5).\n *\n * Per-agent selection: each agent carries `memory.provider`. The daemon holds a\n * `DispatchingMemoryProvider` that routes every scope-bearing call to the agent's\n * configured concrete provider. The one non-scoped seam is `runtimeEnv` (it needs\n * the agent root + the concrete runtime), applied directly in `daemon.ts` where the\n * full agent is in hand — see `memoryProviderFor`.\n *\n * The CP frame path keeps its own byte-sliced reader (`cp/memory-reader.ts`): its\n * UTF-8-boundary + frame-budget slicing is a wire-transport concern that must not\n * leak into this storage-domain port. `read()` here is whole-file (MCP semantics).\n */\nimport type { MemoryEntry } from '@agentconnect.md/protocol'\nimport type { RuntimeDef } from '../config/config-schema.js'\nimport type { ToolDescriptor } from '../mcp/tools.js'\nimport { MEMORY_TOOLS } from '../mcp/tools.js'\nimport {\n ensureMemory,\n readIndex,\n readMemoryFile,\n writeMemoryFile,\n listMemory,\n type MemoryWriteSource\n} from './memory.js'\nimport {\n nativeMemoryList,\n nativeMemoryRead,\n nativeMemoryWrite,\n nativeRuntimeEnv,\n isNativeRuntimeSupported\n} from './native-memory.js'\n\nexport type { MemoryEntry }\n\n/** The provider kind an agent is configured with (protocol `memory.provider`). */\nexport type MemoryProviderKind = 'native' | 'managed' | 'external'\n\n/** The context key every memory op carries. `managed` uses `agentId` only today;\n * `userId`/`sessionId` are reserved for per-scope partitioning in later providers. */\nexport interface MemoryScope {\n agentId: string\n userId?: string\n sessionId?: string\n}\n\n/** Result of the `readMemory` tool path — the whole file's text. */\nexport interface MemoryReadResult {\n path: string\n content: string\n}\n\n/** Result of the `writeMemory` tool path. */\nexport interface MemoryWriteResult {\n ok: true\n path: string\n size: number\n mtime: string\n}\n\n/** A recorded agent turn — the hook `native`/`external` providers use to distill\n * memory. `managed`/`native` M-2 have no per-turn distillation, so `recordTurn`\n * is a no-op and this stays opaque. */\nexport type TurnRecord = unknown\n\n/**\n * The port. Every method is scope-carrying so a later provider can partition by\n * user/session without a signature change.\n */\nexport interface MemoryProvider {\n readonly kind: MemoryProviderKind\n\n /** Env delta to merge into the runtime child so its OWN memory goes where this\n * provider wants it: `managed` disables it; `native` redirects it under the\n * agent root; applied by `daemon.ts` at spawn (see `memoryProviderFor`). */\n runtimeEnv(runtime: RuntimeDef): Record<string, string>\n\n /** Seed a brand-new agent's memory so injection and the tools always have a\n * target (idempotent). Called once per session handle before prompt building. */\n ensure(scope: MemoryScope, agentName: string): void\n\n /** The text to inject at the start of a FRESH session (the memory index, capped).\n * '' when there is nothing to inject. The caller owns the surrounding prompt prose. */\n injectAtSessionStart(scope: MemoryScope): Promise<string>\n\n /** Record one finished turn for providers that distill memory from turns. No-op\n * for `managed`/`native`. */\n recordTurn(scope: MemoryScope, turn: TurnRecord): Promise<void>\n\n /** The memory MCP tools to expose to the agent. Empty when the runtime manages\n * its own memory (`native`). */\n tools(): ToolDescriptor[]\n\n list(scope: MemoryScope): Promise<MemoryEntry[]>\n read(scope: MemoryScope, path: string): Promise<MemoryReadResult>\n write(\n scope: MemoryScope,\n path: string,\n content: string,\n ifMatch?: string,\n source?: MemoryWriteSource\n ): Promise<MemoryWriteResult>\n}\n\n/** Thrown when a provider can't be built for an agent (e.g. `external` not yet\n * implemented, or `native` on a runtime whose memory env levers aren't registered). */\nexport class MemoryProviderUnavailableError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'MemoryProviderUnavailableError'\n }\n}\n\n/**\n * `managed` memory: our `<agent-root>/memory/` directory. A thin facade over\n * `agents/memory.ts` — every method delegates to the existing primitive and lets\n * its error classes (`MemoryPathError` / `MemoryTooLargeError` /\n * `MemoryConflictError`) propagate raw, so the MCP + CP error mappings are unchanged.\n */\nexport class ManagedMemoryProvider implements MemoryProvider {\n readonly kind = 'managed' as const\n\n /** `agentDirByAgent` resolves an agent id → its root dir (which holds `memory/`),\n * or undefined for an unknown agent. */\n constructor(private readonly agentDirByAgent: (agentId: string) => string | undefined) {}\n\n private dirFor(agentId: string): string {\n const dir = this.agentDirByAgent(agentId)\n // Match the pre-provider MCP path's message verbatim (mcp/ops.ts) so the tool\n // error surface is byte-identical.\n if (!dir) throw new Error(`unknown agent ${agentId}`)\n return dir\n }\n\n // Managed keeps a single store: turn OFF the runtime's own memory so the agent\n // doesn't end up with two competing ones. Claude's off-switch is an env flag\n // (respect an explicit operator override, as the daemon did before the port).\n runtimeEnv(runtime: RuntimeDef): Record<string, string> {\n if (isClaudeRuntime(runtime)) return { CLAUDE_CODE_DISABLE_AUTO_MEMORY: '1' }\n return {}\n }\n\n ensure(scope: MemoryScope, agentName: string): void {\n ensureMemory(this.dirFor(scope.agentId), agentName)\n }\n\n async injectAtSessionStart(scope: MemoryScope): Promise<string> {\n return readIndex(this.dirFor(scope.agentId))\n }\n\n async recordTurn(_scope: MemoryScope, _turn: TurnRecord): Promise<void> {\n // managed has no per-turn distillation — memory changes only on writeMemory.\n }\n\n tools(): ToolDescriptor[] {\n return MEMORY_TOOLS\n }\n\n async list(scope: MemoryScope): Promise<MemoryEntry[]> {\n return listMemory(this.dirFor(scope.agentId))\n }\n\n async read(scope: MemoryScope, path: string): Promise<MemoryReadResult> {\n return { path, content: await readMemoryFile(this.dirFor(scope.agentId), path) }\n }\n\n async write(\n scope: MemoryScope,\n path: string,\n content: string,\n ifMatch?: string,\n source?: MemoryWriteSource\n ): Promise<MemoryWriteResult> {\n const { size, mtime } = await writeMemoryFile(this.dirFor(scope.agentId), path, content, ifMatch, source)\n return { ok: true, path, size, mtime }\n }\n}\n\n/**\n * `native` memory: the runtime's OWN memory (Claude auto-memory / Codex memories),\n * redirected under the agent root via `runtimeEnv` for per-agent isolation. The\n * runtime writes and loads it itself, so we do NOT seed, inject, or expose tools —\n * doing so would create a second store the runtime never reads. `list`/`read`/`write`\n * surface the runtime's memory files for the console (see native-memory.ts).\n *\n * The per-runtime env levers are an explicit registry (native-memory.ts). An agent\n * selecting `native` on a runtime whose levers aren't registered fails loudly at\n * construction rather than silently mis-setting env — we don't guess env for a\n * runtime we haven't verified.\n */\nexport class NativeMemoryProvider implements MemoryProvider {\n readonly kind = 'native' as const\n\n constructor(\n private readonly agentDirByAgent: (agentId: string) => string | undefined,\n private readonly runtimeFor: (agentId: string) => RuntimeDef | undefined\n ) {}\n\n private dirFor(agentId: string): string {\n const dir = this.agentDirByAgent(agentId)\n if (!dir) throw new Error(`unknown agent ${agentId}`)\n return dir\n }\n\n runtimeEnv(_runtime: RuntimeDef): Record<string, string> {\n // Not the live path: the spawn env is sourced via memoryProviderFor (which binds\n // the agent root). Routing it through the dispatcher/interface here would lack\n // the root, so make the misuse obvious.\n throw new Error('NativeMemoryProvider.runtimeEnv must not be called — use memoryProviderFor at spawn')\n }\n\n ensure(): void {\n // The runtime manages its own memory — nothing to seed.\n }\n\n async injectAtSessionStart(): Promise<string> {\n // The runtime loads its own memory; don't double-inject.\n return ''\n }\n\n async recordTurn(): Promise<void> {\n // no per-turn distillation.\n }\n\n tools(): ToolDescriptor[] {\n // The runtime has its own memory mechanism; our tools would target a different\n // store than it reads. Expose none.\n return []\n }\n\n async list(scope: MemoryScope): Promise<MemoryEntry[]> {\n return nativeMemoryList(this.dirFor(scope.agentId), this.runtimeFor(scope.agentId))\n }\n\n async read(scope: MemoryScope, path: string): Promise<MemoryReadResult> {\n return nativeMemoryRead(this.dirFor(scope.agentId), this.runtimeFor(scope.agentId), path)\n }\n\n async write(\n scope: MemoryScope,\n path: string,\n content: string,\n ifMatch?: string,\n _source?: MemoryWriteSource\n ): Promise<MemoryWriteResult> {\n // native writes go to the runtime's own store — no managed `.history` log there.\n return nativeMemoryWrite(this.dirFor(scope.agentId), this.runtimeFor(scope.agentId), path, content, ifMatch)\n }\n}\n\n/** A claude runtime — its command/args reference `claude` (mirrors AcpHost.isClaudeRuntime). */\nexport function isClaudeRuntime(runtime: RuntimeDef): boolean {\n return [runtime.command, ...runtime.args].join(' ').toLowerCase().includes('claude')\n}\n\n/**\n * `DispatchingMemoryProvider` — the daemon's single `MemoryProvider`. Routes every\n * scope-bearing call to the agent's configured concrete provider (managed | native),\n * built lazily and cached (both are stateless facades over the resolvers). `external`\n * throws `MemoryProviderUnavailableError` when first needed.\n *\n * `runtimeEnv` is NOT the dispatch path (it has no scope); it throws here to make the\n * misuse obvious — the spawn path uses `memoryProviderFor` directly.\n */\nexport class DispatchingMemoryProvider implements MemoryProvider {\n readonly kind = 'managed' as const // nominal; real kind is per-agent\n\n private managed: ManagedMemoryProvider\n private native: NativeMemoryProvider\n\n constructor(\n private readonly agentDirByAgent: (agentId: string) => string | undefined,\n private readonly runtimeFor: (agentId: string) => RuntimeDef | undefined,\n private readonly providerKindFor: (agentId: string) => MemoryProviderKind\n ) {\n this.managed = new ManagedMemoryProvider(agentDirByAgent)\n this.native = new NativeMemoryProvider(agentDirByAgent, runtimeFor)\n }\n\n private forAgent(agentId: string): MemoryProvider {\n const kind = this.providerKindFor(agentId)\n if (kind === 'managed') return this.managed\n if (kind === 'native') return this.native\n throw new MemoryProviderUnavailableError(`memory provider \"${kind}\" is not yet implemented`)\n }\n\n runtimeEnv(_runtime: RuntimeDef): Record<string, string> {\n throw new Error('DispatchingMemoryProvider.runtimeEnv must not be called — use memoryProviderFor at spawn')\n }\n\n ensure(scope: MemoryScope, agentName: string): void {\n this.forAgent(scope.agentId).ensure(scope, agentName)\n }\n injectAtSessionStart(scope: MemoryScope): Promise<string> {\n return this.forAgent(scope.agentId).injectAtSessionStart(scope)\n }\n recordTurn(scope: MemoryScope, turn: TurnRecord): Promise<void> {\n return this.forAgent(scope.agentId).recordTurn(scope, turn)\n }\n list(scope: MemoryScope): Promise<MemoryEntry[]> {\n return this.forAgent(scope.agentId).list(scope)\n }\n read(scope: MemoryScope, path: string): Promise<MemoryReadResult> {\n return this.forAgent(scope.agentId).read(scope, path)\n }\n write(\n scope: MemoryScope,\n path: string,\n content: string,\n ifMatch?: string,\n source?: MemoryWriteSource\n ): Promise<MemoryWriteResult> {\n return this.forAgent(scope.agentId).write(scope, path, content, ifMatch, source)\n }\n\n /** The memory tools to inject for a specific agent (the daemon calls this in\n * `mcpServersFor` — native contributes none). Scope-carrying, unlike the\n * interface's scopeless `tools()`. */\n toolsForAgent(agentId: string): ToolDescriptor[] {\n return this.forAgent(agentId).tools()\n }\n\n /** Interface `tools()` has no scope; the daemon uses `toolsForAgent`. Return the\n * managed set as a safe default (never the live injection path). */\n tools(): ToolDescriptor[] {\n return MEMORY_TOOLS\n }\n}\n\n/** The daemon-side memory provider kind for an agent (absent ⇒ managed default). */\nexport function memoryKindOf(agent: { memory?: { provider?: MemoryProviderKind } }): MemoryProviderKind {\n return agent.memory?.provider ?? 'managed'\n}\n\n/**\n * Build the concrete provider for ONE agent — used at spawn (`daemon.ts` / `chat.ts`)\n * to source `runtimeEnv`, and validated eagerly so a misconfigured agent (external,\n * or native on an unregistered runtime) fails loudly with the agent's root bound.\n * Throws `MemoryProviderUnavailableError` on an unbuildable provider.\n */\nexport function memoryProviderFor(\n agent: {\n dir: string\n runtime?: string\n memory?: { provider?: MemoryProviderKind }\n },\n runtime: RuntimeDef\n): { runtimeEnv(): Record<string, string> } {\n const kind = memoryKindOf(agent)\n if (kind === 'managed') {\n const p = new ManagedMemoryProvider(() => agent.dir)\n return { runtimeEnv: () => p.runtimeEnv(runtime) }\n }\n if (kind === 'native') {\n if (!isNativeRuntimeSupported(runtime)) {\n throw new MemoryProviderUnavailableError(\n `native memory is not supported for this runtime (env levers unverified): ${runtime.command}`\n )\n }\n // Bind the agent root so runtimeEnv can compute the redirect target.\n return { runtimeEnv: () => nativeRuntimeEnv(runtime, agent.dir) }\n }\n throw new MemoryProviderUnavailableError(`memory provider \"${kind}\" is not yet implemented`)\n}\n\n/** Build the daemon's dispatching memory provider over the agent resolvers. */\nexport function createMemoryProvider(\n agentDirByAgent: (agentId: string) => string | undefined,\n runtimeFor: (agentId: string) => RuntimeDef | undefined,\n providerKindFor: (agentId: string) => MemoryProviderKind\n): DispatchingMemoryProvider {\n return new DispatchingMemoryProvider(agentDirByAgent, runtimeFor, providerKindFor)\n}\n\n/** Back-compat: a managed-only provider (used where per-agent dispatch isn't needed,\n * e.g. tests). */\nexport function createManagedMemoryProvider(agentDirByAgent: (agentId: string) => string | undefined): MemoryProvider {\n return new ManagedMemoryProvider(agentDirByAgent)\n}\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fs_1 = require(\"fs\");\nconst debug_1 = __importDefault(require(\"debug\"));\nconst log = debug_1.default('@kwsites/file-exists');\nfunction check(path, isFile, isDirectory) {\n log(`checking %s`, path);\n try {\n const stat = fs_1.statSync(path);\n if (stat.isFile() && isFile) {\n log(`[OK] path represents a file`);\n return true;\n }\n if (stat.isDirectory() && isDirectory) {\n log(`[OK] path represents a directory`);\n return true;\n }\n log(`[FAIL] path represents something other than a file or directory`);\n return false;\n }\n catch (e) {\n if (e.code === 'ENOENT') {\n log(`[FAIL] path is not accessible: %o`, e);\n return false;\n }\n log(`[FATAL] %o`, e);\n throw e;\n }\n}\n/**\n * Synchronous validation of a path existing either as a file or as a directory.\n *\n * @param {string} path The path to check\n * @param {number} type One or both of the exported numeric constants\n */\nfunction exists(path, type = exports.READABLE) {\n return check(path, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);\n}\nexports.exists = exists;\n/**\n * Constant representing a file\n */\nexports.FILE = 1;\n/**\n * Constant representing a folder\n */\nexports.FOLDER = 2;\n/**\n * Constant representing either a file or a folder\n */\nexports.READABLE = exports.FILE + exports.FOLDER;\n//# sourceMappingURL=index.js.map","\"use strict\";\nfunction __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n}\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__export(require(\"./src\"));\n//# sourceMappingURL=index.js.map","const t = /* @__PURE__ */ new WeakMap();\nfunction c(...n) {\n const e = new String(n);\n return t.set(e, n), e;\n}\nfunction r(n) {\n return n instanceof String && t.has(n);\n}\nfunction o(n) {\n return t.get(n) ?? [];\n}\nexport {\n r as isPathSpec,\n c as pathspec,\n o as toPaths\n};\n//# sourceMappingURL=index.mjs.map\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createDeferred = exports.deferred = void 0;\n/**\n * Creates a new `DeferredPromise`\n *\n * ```typescript\n import {deferred} from '@kwsites/promise-deferred`;\n ```\n */\nfunction deferred() {\n let done;\n let fail;\n let status = 'pending';\n const promise = new Promise((_done, _fail) => {\n done = _done;\n fail = _fail;\n });\n return {\n promise,\n done(result) {\n if (status === 'pending') {\n status = 'resolved';\n done(result);\n }\n },\n fail(error) {\n if (status === 'pending') {\n status = 'rejected';\n fail(error);\n }\n },\n get fulfilled() {\n return status !== 'pending';\n },\n get status() {\n return status;\n },\n };\n}\nexports.deferred = deferred;\n/**\n * Alias of the exported `deferred` function, to help consumers wanting to use `deferred` as the\n * local variable name rather than the factory import name, without needing to rename on import.\n *\n * ```typescript\n import {createDeferred} from '@kwsites/promise-deferred`;\n ```\n */\nexports.createDeferred = deferred;\n/**\n * Default export allows use as:\n *\n * ```typescript\n import deferred from '@kwsites/promise-deferred`;\n ```\n */\nexports.default = deferred;\n//# sourceMappingURL=index.js.map","import { isPathSpec as m, toPaths as v } from \"@simple-git/args-pathspec\";\nfunction* U(e, t) {\n const n = t === \"global\";\n for (const o of e)\n o.isGlobal === n && (yield o);\n}\nconst k = /* @__PURE__ */ new Set([\n \"--add\",\n \"--edit\",\n \"--remove-section\",\n \"--rename-section\",\n \"--replace-all\",\n \"--unset\",\n \"--unset-all\",\n \"-e\"\n]), S = /* @__PURE__ */ new Set([\n \"--get\",\n \"--get-all\",\n \"--get-color\",\n \"--get-colorbool\",\n \"--get-regexp\",\n \"--get-urlmatch\",\n \"--list\",\n \"-l\"\n]), P = /* @__PURE__ */ new Set([\n \"edit\",\n \"remove-section\",\n \"rename-section\",\n \"set\",\n \"unset\"\n]), E = /* @__PURE__ */ new Set([\"get\", \"get-color\", \"get-colorbool\", \"list\"]);\nfunction F(e, t) {\n for (const { name: o } of U(e, \"task\")) {\n if (k.has(o))\n return p(!0, t);\n if (S.has(o))\n return p(!1, t);\n }\n const n = t.at(0)?.toLowerCase();\n return n === void 0 ? null : P.has(n) ? p(!0, t.slice(1)) : E.has(n) ? p(!1, t.slice(1)) : t.length === 1 ? p(!1, t) : p(!0, t);\n}\nfunction p(e = !1, t = []) {\n const n = t.at(0)?.toLowerCase();\n return n === void 0 ? null : {\n isWrite: e,\n isRead: !e,\n key: n,\n value: t.at(1)\n };\n}\nfunction A(e, t) {\n return t.isWrite && t.value !== void 0 ? { key: t.key, value: t.value, scope: e } : { key: t.key, scope: e };\n}\nfunction M(e) {\n const t = e?.indexOf(\"=\") || -1;\n return !e || t < 0 ? null : {\n key: e.slice(0, t).trim().toLowerCase(),\n value: e.slice(t + 1)\n };\n}\nfunction N(e) {\n for (const { name: t } of U(e, \"task\"))\n switch (t) {\n case \"--global\":\n return \"global\";\n case \"--system\":\n return \"system\";\n case \"--worktree\":\n return \"worktree\";\n case \"--local\":\n return \"local\";\n case \"--file\":\n case \"-f\":\n return \"file\";\n }\n return \"local\";\n}\nfunction G({ name: e }) {\n if (e === \"-c\" || e === \"--config\")\n return \"inline\";\n if (e === \"--config-env\")\n return \"env\";\n}\nfunction* O(e) {\n for (const t of e) {\n const n = G(t), o = n && M(t.value);\n o && (yield {\n ...o,\n scope: n\n });\n }\n}\nfunction L(e, t, n) {\n const o = {\n read: [],\n write: [...O(t)]\n };\n return e === \"config\" && $(\n o,\n N(t),\n F(t, n)\n ), o;\n}\nfunction $(e, t, n) {\n if (n === null)\n return;\n const o = A(t, n);\n n.isWrite ? e.write.push(o) : e.read.push(o);\n}\nconst x = {\n short: /* @__PURE__ */ new Map([\n [\"c\", !0]\n // -c <k=v> set config key for this invocation\n ])\n}, D = {\n short: new Map([\n [\"C\", !0],\n // -C <path> change working directory\n [\"P\", !1],\n // -P no pager (alias for --no-pager)\n [\"h\", !1],\n // -h help\n [\"p\", !1],\n // -p paginate\n [\"v\", !1],\n // -v version\n ...x.short.entries()\n ]),\n long: /* @__PURE__ */ new Set([\n \"attr-source\",\n \"config-env\",\n \"exec-path\",\n \"git-dir\",\n \"list-cmds\",\n \"namespace\",\n \"super-prefix\",\n \"work-tree\"\n ])\n}, R = {\n clone: {\n short: /* @__PURE__ */ new Map([\n [\"b\", !0],\n // -b <branch>\n [\"j\", !0],\n // -j <n> parallel jobs\n [\"l\", !1],\n // -l local\n [\"n\", !1],\n // -n no-checkout\n [\"o\", !0],\n // -o <name> remote name\n [\"q\", !1],\n // -q quiet\n [\"s\", !1],\n // -s shared\n [\"u\", !0]\n // -u <upload-pack>\n ]),\n long: /* @__PURE__ */ new Set([\"branch\", \"config\", \"jobs\", \"origin\", \"upload-pack\", \"u\", \"template\"])\n },\n commit: {\n short: /* @__PURE__ */ new Map([\n [\"C\", !0],\n // -C <commit> reuse message\n [\"F\", !0],\n // -F <file> read message from file\n [\"c\", !0],\n // -c <commit> reedit message\n [\"m\", !0],\n // -m <msg>\n [\"t\", !0]\n // -t <template>\n ]),\n long: /* @__PURE__ */ new Set([\"file\", \"message\", \"reedit-message\", \"reuse-message\", \"template\"])\n },\n config: {\n short: /* @__PURE__ */ new Map([\n [\"e\", !1],\n // -e open editor\n [\"f\", !0],\n // -f <file>\n [\"l\", !1]\n // -l list\n ]),\n long: /* @__PURE__ */ new Set([\"blob\", \"comment\", \"default\", \"file\", \"type\", \"value\"])\n },\n fetch: {\n short: /* @__PURE__ */ new Map(),\n long: /* @__PURE__ */ new Set([\"upload-pack\"])\n },\n init: {\n short: /* @__PURE__ */ new Map(),\n long: /* @__PURE__ */ new Set([\"template\"])\n },\n pull: {\n short: /* @__PURE__ */ new Map(),\n long: /* @__PURE__ */ new Set([\"upload-pack\"])\n },\n push: {\n short: /* @__PURE__ */ new Map(),\n long: /* @__PURE__ */ new Set([\"exec\", \"receive-pack\"])\n }\n}, T = { short: /* @__PURE__ */ new Map(), long: /* @__PURE__ */ new Set() };\nfunction I(e) {\n const t = R[e ?? \"\"] ?? T;\n return {\n short: new Map([...x.short.entries(), ...t.short.entries()]),\n long: t.long\n };\n}\nfunction b(e, t = D) {\n if (e.startsWith(\"--\")) {\n const n = e.indexOf(\"=\");\n if (n > 2)\n return [{ name: e.slice(0, n), value: e.slice(n + 1), needsNext: !1 }];\n const o = e.slice(2);\n return [{ name: e, needsNext: t.long.has(o) }];\n }\n if (e.length === 2) {\n const n = e.charAt(1), o = t.short.get(n);\n return [{ name: e, needsNext: o === !0 }];\n }\n return W(e, t.short);\n}\nfunction W(e, t) {\n const n = e.slice(1).split(\"\"), o = [];\n for (let s = 0; s < n.length; s++) {\n const r = n[s], l = t.get(r);\n if (l === void 0)\n return [{ name: e, needsNext: !1 }];\n if (l) {\n const a = n.slice(s + 1).join(\"\");\n if (a && ![...a].every((w) => t.has(w)))\n return o.push({ name: `-${r}`, value: a, needsNext: !1 }), o;\n }\n o.push({ name: `-${r}`, needsNext: l });\n }\n return o;\n}\nfunction j(e, t = []) {\n let n = 0;\n for (; n < e.length; ) {\n const o = String(e[n]);\n if (!o.startsWith(\"-\") || o.length < 2) break;\n const s = b(o);\n let r = n + 1;\n for (const l of s) {\n const a = {\n name: l.name,\n value: l.value,\n absorbedNext: !1,\n isGlobal: !0\n };\n l.needsNext && a.value === void 0 && r < e.length && (a.value = String(e[r]), a.absorbedNext = !0, r++), t.push(a);\n }\n n = r;\n }\n return { flags: t, taskIndex: n };\n}\nfunction B(e, t, n = []) {\n const o = I(t), s = [], r = [];\n let l = 0;\n for (; l < e.length; ) {\n const a = e[l];\n if (m(a)) {\n r.push(...v(a)), l++;\n continue;\n }\n const f = String(a);\n if (f === \"--\") {\n for (let g = l + 1; g < e.length; g++) {\n const u = e[g];\n m(u) ? r.push(...v(u)) : r.push(String(u));\n }\n break;\n }\n if (!f.startsWith(\"-\") || f.length < 2) {\n s.push(f), l++;\n continue;\n }\n const w = b(f, o);\n let d = l + 1;\n for (const g of w) {\n const u = {\n name: g.name,\n value: g.value,\n absorbedNext: !1,\n isGlobal: !1\n };\n g.needsNext && u.value === void 0 && d < e.length && !m(e[d]) && (u.value = String(e[d]), u.absorbedNext = !0, d++), n.push(u);\n }\n l = d;\n }\n return { flags: n, positionals: s, pathspecs: r };\n}\nfunction* V({\n write: e\n}) {\n for (const t of e)\n for (const n of q) {\n const o = n(t.key);\n o && (yield o);\n }\n}\nfunction c(e, t, n = String(e)) {\n const o = typeof e == \"string\" ? new RegExp(`\\\\s*${e.toLowerCase()}`) : e;\n return function(r) {\n if (o.test(r))\n return {\n category: t,\n message: `Configuring ${n} is not permitted without enabling ${t}`\n };\n };\n}\nfunction i(e, t) {\n const n = new RegExp(`\\\\s*${e.toLowerCase().replace(/\\./g, \"(..+)?.\")}`);\n return c(n, t, e);\n}\nconst q = [\n c(\"alias\", \"allowUnsafeAlias\"),\n c(\"core.askPass\", \"allowUnsafeAskPass\"),\n c(\"core.editor\", \"allowUnsafeEditor\"),\n c(\"core.fsmonitor\", \"allowUnsafeFsMonitor\"),\n c(\"core.gitProxy\", \"allowUnsafeGitProxy\"),\n c(\"core.hooksPath\", \"allowUnsafeHooksPath\"),\n c(\"core.pager\", \"allowUnsafePager\"),\n c(\"core.sshCommand\", \"allowUnsafeSshCommand\"),\n i(\"credential.helper\", \"allowUnsafeCredentialHelper\"),\n i(\"diff.command\", \"allowUnsafeDiffExternal\"),\n c(\"diff.external\", \"allowUnsafeDiffExternal\"),\n i(\"diff.textconv\", \"allowUnsafeDiffTextConv\"),\n i(\"filter.clean\", \"allowUnsafeFilter\"),\n i(\"filter.smudge\", \"allowUnsafeFilter\"),\n i(\"gpg.program\", \"allowUnsafeGpgProgram\"),\n c(\"init.templateDir\", \"allowUnsafeTemplateDir\"),\n i(\"merge.driver\", \"allowUnsafeMergeDriver\"),\n i(\"mergetool.path\", \"allowUnsafeMergeDriver\"),\n i(\"mergetool.cmd\", \"allowUnsafeMergeDriver\"),\n i(\"protocol.allow\", \"allowUnsafeProtocolOverride\"),\n i(\"remote.receivepack\", \"allowUnsafePack\"),\n i(\"remote.uploadpack\", \"allowUnsafePack\"),\n c(\"sequence.editor\", \"allowUnsafeEditor\")\n];\nfunction* K(e, t) {\n for (const n of t)\n for (const o of H) {\n const s = o(e, n.name);\n s && (yield s);\n }\n}\nfunction h(e, t, n, o = String(t)) {\n const s = typeof t == \"string\" ? new RegExp(`\\\\s*${t.toLowerCase()}`) : t, r = `Use of ${e ? `${e} with option ` : \"\"}${o} is not permitted without enabling ${n}`;\n return function(a, f) {\n if ((!e || a === e) && s.test(f))\n return {\n category: n,\n message: r\n };\n };\n}\nconst H = [\n h(\n null,\n /--(upload|receive)-pack/,\n \"allowUnsafePack\",\n \"--upload-pack or --receive-pack\"\n ),\n h(\"clone\", /^-\\w*u/, \"allowUnsafePack\"),\n h(\"clone\", \"--u\", \"allowUnsafePack\"),\n h(\"push\", \"--exec\", \"allowUnsafePack\"),\n h(null, \"--template\", \"allowUnsafeTemplateDir\")\n];\nfunction C(e, t, n) {\n return [...K(e, t), ...V(n)];\n}\nfunction Y(...e) {\n const { flags: t, taskIndex: n } = j(e), o = n < e.length ? String(e[n]).toLowerCase() : null, s = o !== null ? e.slice(n + 1) : [], { positionals: r, pathspecs: l } = B(s, o, t), a = L(o, t, r);\n return {\n task: o,\n flags: t.map(J),\n paths: l,\n config: a,\n vulnerabilities: z(C(o, t, a))\n };\n}\nfunction z(e) {\n return Object.defineProperty(e, \"vulnerabilities\", {\n value: e\n });\n}\nfunction J({ value: e, name: t }) {\n return e !== void 0 ? { name: t, value: e } : { name: t };\n}\nconst y = {\n editor: \"allowUnsafeEditor\",\n git_askpass: \"allowUnsafeAskPass\",\n git_config_global: \"allowUnsafeConfigPaths\",\n git_config_system: \"allowUnsafeConfigPaths\",\n git_config_count: \"allowUnsafeConfigEnvCount\",\n git_config: \"allowUnsafeConfigPaths\",\n git_editor: \"allowUnsafeEditor\",\n git_exec_path: \"allowUnsafeConfigPaths\",\n git_external_diff: \"allowUnsafeDiffExternal\",\n git_pager: \"allowUnsafePager\",\n git_proxy_command: \"allowUnsafeGitProxy\",\n git_template_dir: \"allowUnsafeTemplateDir\",\n git_sequence_editor: \"allowUnsafeEditor\",\n git_ssh: \"allowUnsafeSshCommand\",\n git_ssh_command: \"allowUnsafeSshCommand\",\n pager: \"allowUnsafePager\",\n prefix: \"allowUnsafeConfigPaths\",\n ssh_askpass: \"allowUnsafeAskPass\"\n};\nfunction* Q(e) {\n const t = parseInt(e.git_config_count ?? \"0\", 10);\n for (let n = 0; n < t; n++) {\n const o = e[`git_config_key_${n}`], s = e[`git_config_value_${n}`];\n o !== void 0 && (yield { key: o.toLowerCase().trim(), value: s, scope: \"env\" });\n }\n}\nfunction* X(e) {\n for (const t of Object.keys(e))\n if (_(t)) {\n const n = y[t];\n yield {\n category: n,\n message: `Use of \"${t.toUpperCase()}\" is not permitted without enabling ${n}`\n };\n }\n}\nfunction _(e) {\n return Object.hasOwn(y, e);\n}\nfunction Z(e) {\n const t = {};\n for (const [n, o] of Object.entries(e)) {\n const s = n.toLowerCase().trim();\n (_(s) || s.startsWith(\"git\")) && (t[s] = String(o));\n }\n return t;\n}\nfunction ee(e) {\n const t = Z(e), n = {\n read: [],\n write: [...Q(t)]\n }, o = [\n ...X(t),\n ...C(null, [], n)\n ];\n return {\n config: n,\n vulnerabilities: o\n };\n}\nfunction ne(e, t) {\n return [...Y(...e).vulnerabilities, ...ee(t).vulnerabilities];\n}\nexport {\n Y as parseArgv,\n ee as parseEnv,\n ne as vulnerabilityCheck\n};\n//# sourceMappingURL=index.mjs.map\n","var __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __esm = (fn, res) => function __init() {\n return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;\n};\nvar __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n};\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/lib/errors/git-error.ts\nvar GitError;\nvar init_git_error = __esm({\n \"src/lib/errors/git-error.ts\"() {\n \"use strict\";\n GitError = class extends Error {\n constructor(task, message) {\n super(message);\n this.task = task;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n };\n }\n});\n\n// src/lib/errors/git-response-error.ts\nvar GitResponseError;\nvar init_git_response_error = __esm({\n \"src/lib/errors/git-response-error.ts\"() {\n \"use strict\";\n init_git_error();\n GitResponseError = class extends GitError {\n constructor(git, message) {\n super(void 0, message || String(git));\n this.git = git;\n }\n };\n }\n});\n\n// src/lib/errors/task-configuration-error.ts\nvar TaskConfigurationError;\nvar init_task_configuration_error = __esm({\n \"src/lib/errors/task-configuration-error.ts\"() {\n \"use strict\";\n init_git_error();\n TaskConfigurationError = class extends GitError {\n constructor(message) {\n super(void 0, message);\n }\n };\n }\n});\n\n// src/lib/utils/util.ts\nimport { exists, FOLDER } from \"@kwsites/file-exists\";\nfunction asFunction(source) {\n if (typeof source !== \"function\") {\n return NOOP;\n }\n return source;\n}\nfunction isUserFunction(source) {\n return typeof source === \"function\" && source !== NOOP;\n}\nfunction splitOn(input, char) {\n const index = input.indexOf(char);\n if (index <= 0) {\n return [input, \"\"];\n }\n return [input.substr(0, index), input.substr(index + 1)];\n}\nfunction first(input, offset = 0) {\n return isArrayLike(input) && input.length > offset ? input[offset] : void 0;\n}\nfunction last(input, offset = 0) {\n if (isArrayLike(input) && input.length > offset) {\n return input[input.length - 1 - offset];\n }\n}\nfunction isArrayLike(input) {\n return filterHasLength(input);\n}\nfunction toLinesWithContent(input = \"\", trimmed2 = true, separator = \"\\n\") {\n return input.split(separator).reduce((output, line) => {\n const lineContent = trimmed2 ? line.trim() : line;\n if (lineContent) {\n output.push(lineContent);\n }\n return output;\n }, []);\n}\nfunction forEachLineWithContent(input, callback) {\n return toLinesWithContent(input, true).map((line) => callback(line));\n}\nfunction folderExists(path) {\n return exists(path, FOLDER);\n}\nfunction append(target, item) {\n if (Array.isArray(target)) {\n if (!target.includes(item)) {\n target.push(item);\n }\n } else {\n target.add(item);\n }\n return item;\n}\nfunction including(target, item) {\n if (Array.isArray(target) && !target.includes(item)) {\n target.push(item);\n }\n return target;\n}\nfunction remove(target, item) {\n if (Array.isArray(target)) {\n const index = target.indexOf(item);\n if (index >= 0) {\n target.splice(index, 1);\n }\n } else {\n target.delete(item);\n }\n return item;\n}\nfunction asArray(source) {\n return Array.isArray(source) ? source : [source];\n}\nfunction asCamelCase(str) {\n return str.replace(/[\\s-]+(.)/g, (_all, chr) => {\n return chr.toUpperCase();\n });\n}\nfunction asStringArray(source) {\n return asArray(source).map((item) => {\n return item instanceof String ? item : String(item);\n });\n}\nfunction asNumber(source, onNaN = 0) {\n if (source == null) {\n return onNaN;\n }\n const num = parseInt(source, 10);\n return Number.isNaN(num) ? onNaN : num;\n}\nfunction prefixedArray(input, prefix) {\n const output = [];\n for (let i = 0, max = input.length; i < max; i++) {\n output.push(prefix, input[i]);\n }\n return output;\n}\nfunction bufferToString(input) {\n return (Array.isArray(input) ? Buffer.concat(input) : input).toString(\"utf-8\");\n}\nfunction pick(source, properties) {\n const out = {};\n properties.forEach((key) => {\n if (source[key] !== void 0) {\n out[key] = source[key];\n }\n });\n return out;\n}\nfunction delay(duration = 0) {\n return new Promise((done) => setTimeout(done, duration));\n}\nfunction orVoid(input) {\n if (input === false) {\n return void 0;\n }\n return input;\n}\nvar NULL, NOOP, objectToString;\nvar init_util = __esm({\n \"src/lib/utils/util.ts\"() {\n \"use strict\";\n init_argument_filters();\n NULL = \"\\0\";\n NOOP = () => {\n };\n objectToString = Object.prototype.toString.call.bind(Object.prototype.toString);\n }\n});\n\n// src/lib/utils/argument-filters.ts\nimport { isPathSpec } from \"@simple-git/args-pathspec\";\nfunction filterType(input, filter, def) {\n if (filter(input)) {\n return input;\n }\n return arguments.length > 2 ? def : void 0;\n}\nfunction filterPrimitives(input, omit) {\n const type = isPathSpec(input) ? \"string\" : typeof input;\n return /number|string|boolean/.test(type) && (!omit || !omit.includes(type));\n}\nfunction filterPlainObject(input) {\n return !!input && objectToString(input) === \"[object Object]\";\n}\nfunction filterFunction(input) {\n return typeof input === \"function\";\n}\nvar filterArray, filterNumber, filterString, filterStringOrStringArray, filterHasLength;\nvar init_argument_filters = __esm({\n \"src/lib/utils/argument-filters.ts\"() {\n \"use strict\";\n init_util();\n filterArray = (input) => {\n return Array.isArray(input);\n };\n filterNumber = (input) => {\n return typeof input === \"number\";\n };\n filterString = (input) => {\n return typeof input === \"string\" || isPathSpec(input);\n };\n filterStringOrStringArray = (input) => {\n return filterString(input) || Array.isArray(input) && input.every(filterString);\n };\n filterHasLength = (input) => {\n if (input == null || \"number|boolean|function\".includes(typeof input)) {\n return false;\n }\n return typeof input.length === \"number\";\n };\n }\n});\n\n// src/lib/utils/exit-codes.ts\nvar ExitCodes;\nvar init_exit_codes = __esm({\n \"src/lib/utils/exit-codes.ts\"() {\n \"use strict\";\n ExitCodes = /* @__PURE__ */ ((ExitCodes2) => {\n ExitCodes2[ExitCodes2[\"SUCCESS\"] = 0] = \"SUCCESS\";\n ExitCodes2[ExitCodes2[\"ERROR\"] = 1] = \"ERROR\";\n ExitCodes2[ExitCodes2[\"NOT_FOUND\"] = -2] = \"NOT_FOUND\";\n ExitCodes2[ExitCodes2[\"UNCLEAN\"] = 128] = \"UNCLEAN\";\n return ExitCodes2;\n })(ExitCodes || {});\n }\n});\n\n// src/lib/utils/git-output-streams.ts\nvar GitOutputStreams;\nvar init_git_output_streams = __esm({\n \"src/lib/utils/git-output-streams.ts\"() {\n \"use strict\";\n GitOutputStreams = class _GitOutputStreams {\n constructor(stdOut, stdErr) {\n this.stdOut = stdOut;\n this.stdErr = stdErr;\n }\n asStrings() {\n return new _GitOutputStreams(this.stdOut.toString(\"utf8\"), this.stdErr.toString(\"utf8\"));\n }\n };\n }\n});\n\n// src/lib/utils/line-parser.ts\nfunction useMatchesDefault() {\n throw new Error(`LineParser:useMatches not implemented`);\n}\nvar LineParser, RemoteLineParser;\nvar init_line_parser = __esm({\n \"src/lib/utils/line-parser.ts\"() {\n \"use strict\";\n LineParser = class {\n constructor(regExp, useMatches) {\n this.matches = [];\n this.useMatches = useMatchesDefault;\n this.parse = (line, target) => {\n this.resetMatches();\n if (!this._regExp.every((reg, index) => this.addMatch(reg, index, line(index)))) {\n return false;\n }\n return this.useMatches(target, this.prepareMatches()) !== false;\n };\n this._regExp = Array.isArray(regExp) ? regExp : [regExp];\n if (useMatches) {\n this.useMatches = useMatches;\n }\n }\n resetMatches() {\n this.matches.length = 0;\n }\n prepareMatches() {\n return this.matches;\n }\n addMatch(reg, index, line) {\n const matched = line && reg.exec(line);\n if (matched) {\n this.pushMatch(index, matched);\n }\n return !!matched;\n }\n pushMatch(_index, matched) {\n this.matches.push(...matched.slice(1));\n }\n };\n RemoteLineParser = class extends LineParser {\n addMatch(reg, index, line) {\n return /^remote:\\s/.test(String(line)) && super.addMatch(reg, index, line);\n }\n pushMatch(index, matched) {\n if (index > 0 || matched.length > 1) {\n super.pushMatch(index, matched);\n }\n }\n };\n }\n});\n\n// src/lib/utils/simple-git-options.ts\nfunction createInstanceConfig(...options) {\n const baseDir = process.cwd();\n const config = Object.assign(\n { baseDir, ...defaultOptions },\n ...options.filter((o) => typeof o === \"object\" && o)\n );\n config.baseDir = config.baseDir || baseDir;\n config.trimmed = config.trimmed === true;\n return config;\n}\nvar defaultOptions;\nvar init_simple_git_options = __esm({\n \"src/lib/utils/simple-git-options.ts\"() {\n \"use strict\";\n defaultOptions = {\n binary: \"git\",\n maxConcurrentProcesses: 5,\n config: [],\n trimmed: false\n };\n }\n});\n\n// src/lib/utils/task-options.ts\nimport { isPathSpec as isPathSpec2 } from \"@simple-git/args-pathspec\";\nfunction appendTaskOptions(options, commands = []) {\n if (!filterPlainObject(options)) {\n return commands;\n }\n return Object.keys(options).reduce((commands2, key) => {\n const value = options[key];\n if (isPathSpec2(value)) {\n commands2.push(value);\n } else if (filterPrimitives(value, [\"boolean\"])) {\n commands2.push(key + \"=\" + value);\n } else if (Array.isArray(value)) {\n for (const v of value) {\n if (!filterPrimitives(v, [\"string\", \"number\"])) {\n commands2.push(key + \"=\" + v);\n }\n }\n } else {\n commands2.push(key);\n }\n return commands2;\n }, commands);\n}\nfunction getTrailingOptions(args, initialPrimitive = 0, objectOnly = false) {\n const command = [];\n for (let i = 0, max = initialPrimitive < 0 ? args.length : initialPrimitive; i < max; i++) {\n if (\"string|number\".includes(typeof args[i])) {\n command.push(String(args[i]));\n }\n }\n appendTaskOptions(trailingOptionsArgument(args), command);\n if (!objectOnly) {\n command.push(...trailingArrayArgument(args));\n }\n return command;\n}\nfunction trailingArrayArgument(args) {\n const hasTrailingCallback = typeof last(args) === \"function\";\n return asStringArray(filterType(last(args, hasTrailingCallback ? 1 : 0), filterArray, []));\n}\nfunction trailingOptionsArgument(args) {\n const hasTrailingCallback = filterFunction(last(args));\n return filterType(last(args, hasTrailingCallback ? 1 : 0), filterPlainObject);\n}\nfunction trailingFunctionArgument(args, includeNoop = true) {\n const callback = asFunction(last(args));\n return includeNoop || isUserFunction(callback) ? callback : void 0;\n}\nvar init_task_options = __esm({\n \"src/lib/utils/task-options.ts\"() {\n \"use strict\";\n init_argument_filters();\n init_util();\n }\n});\n\n// src/lib/utils/task-parser.ts\nfunction callTaskParser(parser4, streams) {\n return parser4(streams.stdOut, streams.stdErr);\n}\nfunction parseStringResponse(result, parsers12, texts, trim = true) {\n asArray(texts).forEach((text) => {\n for (let lines = toLinesWithContent(text, trim), i = 0, max = lines.length; i < max; i++) {\n const line = (offset = 0) => {\n if (i + offset >= max) {\n return;\n }\n return lines[i + offset];\n };\n parsers12.some(({ parse }) => parse(line, result));\n }\n });\n return result;\n}\nvar init_task_parser = __esm({\n \"src/lib/utils/task-parser.ts\"() {\n \"use strict\";\n init_util();\n }\n});\n\n// src/lib/utils/index.ts\nvar utils_exports = {};\n__export(utils_exports, {\n ExitCodes: () => ExitCodes,\n GitOutputStreams: () => GitOutputStreams,\n LineParser: () => LineParser,\n NOOP: () => NOOP,\n NULL: () => NULL,\n RemoteLineParser: () => RemoteLineParser,\n append: () => append,\n appendTaskOptions: () => appendTaskOptions,\n asArray: () => asArray,\n asCamelCase: () => asCamelCase,\n asFunction: () => asFunction,\n asNumber: () => asNumber,\n asStringArray: () => asStringArray,\n bufferToString: () => bufferToString,\n callTaskParser: () => callTaskParser,\n createInstanceConfig: () => createInstanceConfig,\n delay: () => delay,\n filterArray: () => filterArray,\n filterFunction: () => filterFunction,\n filterHasLength: () => filterHasLength,\n filterNumber: () => filterNumber,\n filterPlainObject: () => filterPlainObject,\n filterPrimitives: () => filterPrimitives,\n filterString: () => filterString,\n filterStringOrStringArray: () => filterStringOrStringArray,\n filterType: () => filterType,\n first: () => first,\n folderExists: () => folderExists,\n forEachLineWithContent: () => forEachLineWithContent,\n getTrailingOptions: () => getTrailingOptions,\n including: () => including,\n isUserFunction: () => isUserFunction,\n last: () => last,\n objectToString: () => objectToString,\n orVoid: () => orVoid,\n parseStringResponse: () => parseStringResponse,\n pick: () => pick,\n prefixedArray: () => prefixedArray,\n remove: () => remove,\n splitOn: () => splitOn,\n toLinesWithContent: () => toLinesWithContent,\n trailingFunctionArgument: () => trailingFunctionArgument,\n trailingOptionsArgument: () => trailingOptionsArgument\n});\nvar init_utils = __esm({\n \"src/lib/utils/index.ts\"() {\n \"use strict\";\n init_argument_filters();\n init_exit_codes();\n init_git_output_streams();\n init_line_parser();\n init_simple_git_options();\n init_task_options();\n init_task_parser();\n init_util();\n }\n});\n\n// src/lib/tasks/check-is-repo.ts\nvar check_is_repo_exports = {};\n__export(check_is_repo_exports, {\n CheckRepoActions: () => CheckRepoActions,\n checkIsBareRepoTask: () => checkIsBareRepoTask,\n checkIsRepoRootTask: () => checkIsRepoRootTask,\n checkIsRepoTask: () => checkIsRepoTask\n});\nfunction checkIsRepoTask(action) {\n switch (action) {\n case \"bare\" /* BARE */:\n return checkIsBareRepoTask();\n case \"root\" /* IS_REPO_ROOT */:\n return checkIsRepoRootTask();\n }\n const commands = [\"rev-parse\", \"--is-inside-work-tree\"];\n return {\n commands,\n format: \"utf-8\",\n onError,\n parser\n };\n}\nfunction checkIsRepoRootTask() {\n const commands = [\"rev-parse\", \"--git-dir\"];\n return {\n commands,\n format: \"utf-8\",\n onError,\n parser(path) {\n return /^\\.(git)?$/.test(path.trim());\n }\n };\n}\nfunction checkIsBareRepoTask() {\n const commands = [\"rev-parse\", \"--is-bare-repository\"];\n return {\n commands,\n format: \"utf-8\",\n onError,\n parser\n };\n}\nfunction isNotRepoMessage(error) {\n return /(Not a git repository|Kein Git-Repository)/i.test(String(error));\n}\nvar CheckRepoActions, onError, parser;\nvar init_check_is_repo = __esm({\n \"src/lib/tasks/check-is-repo.ts\"() {\n \"use strict\";\n init_utils();\n CheckRepoActions = /* @__PURE__ */ ((CheckRepoActions2) => {\n CheckRepoActions2[\"BARE\"] = \"bare\";\n CheckRepoActions2[\"IN_TREE\"] = \"tree\";\n CheckRepoActions2[\"IS_REPO_ROOT\"] = \"root\";\n return CheckRepoActions2;\n })(CheckRepoActions || {});\n onError = ({ exitCode }, error, done, fail) => {\n if (exitCode === 128 /* UNCLEAN */ && isNotRepoMessage(error)) {\n return done(Buffer.from(\"false\"));\n }\n fail(error);\n };\n parser = (text) => {\n return text.trim() === \"true\";\n };\n }\n});\n\n// src/lib/responses/CleanSummary.ts\nfunction cleanSummaryParser(dryRun, text) {\n const summary = new CleanResponse(dryRun);\n const regexp = dryRun ? dryRunRemovalRegexp : removalRegexp;\n toLinesWithContent(text).forEach((line) => {\n const removed = line.replace(regexp, \"\");\n summary.paths.push(removed);\n (isFolderRegexp.test(removed) ? summary.folders : summary.files).push(removed);\n });\n return summary;\n}\nvar CleanResponse, removalRegexp, dryRunRemovalRegexp, isFolderRegexp;\nvar init_CleanSummary = __esm({\n \"src/lib/responses/CleanSummary.ts\"() {\n \"use strict\";\n init_utils();\n CleanResponse = class {\n constructor(dryRun) {\n this.dryRun = dryRun;\n this.paths = [];\n this.files = [];\n this.folders = [];\n }\n };\n removalRegexp = /^[a-z]+\\s*/i;\n dryRunRemovalRegexp = /^[a-z]+\\s+[a-z]+\\s*/i;\n isFolderRegexp = /\\/$/;\n }\n});\n\n// src/lib/tasks/task.ts\nvar task_exports = {};\n__export(task_exports, {\n EMPTY_COMMANDS: () => EMPTY_COMMANDS,\n adhocExecTask: () => adhocExecTask,\n configurationErrorTask: () => configurationErrorTask,\n isBufferTask: () => isBufferTask,\n isEmptyTask: () => isEmptyTask,\n straightThroughBufferTask: () => straightThroughBufferTask,\n straightThroughStringTask: () => straightThroughStringTask\n});\nfunction adhocExecTask(parser4) {\n return {\n commands: EMPTY_COMMANDS,\n format: \"empty\",\n parser: parser4\n };\n}\nfunction configurationErrorTask(error) {\n return {\n commands: EMPTY_COMMANDS,\n format: \"empty\",\n parser() {\n throw typeof error === \"string\" ? new TaskConfigurationError(error) : error;\n }\n };\n}\nfunction straightThroughStringTask(commands, trimmed2 = false) {\n return {\n commands,\n format: \"utf-8\",\n parser(text) {\n return trimmed2 ? String(text).trim() : text;\n }\n };\n}\nfunction straightThroughBufferTask(commands) {\n return {\n commands,\n format: \"buffer\",\n parser(buffer) {\n return buffer;\n }\n };\n}\nfunction isBufferTask(task) {\n return task.format === \"buffer\";\n}\nfunction isEmptyTask(task) {\n return task.format === \"empty\" || !task.commands.length;\n}\nvar EMPTY_COMMANDS;\nvar init_task = __esm({\n \"src/lib/tasks/task.ts\"() {\n \"use strict\";\n init_task_configuration_error();\n EMPTY_COMMANDS = [];\n }\n});\n\n// src/lib/tasks/clean.ts\nvar clean_exports = {};\n__export(clean_exports, {\n CONFIG_ERROR_INTERACTIVE_MODE: () => CONFIG_ERROR_INTERACTIVE_MODE,\n CONFIG_ERROR_MODE_REQUIRED: () => CONFIG_ERROR_MODE_REQUIRED,\n CONFIG_ERROR_UNKNOWN_OPTION: () => CONFIG_ERROR_UNKNOWN_OPTION,\n CleanOptions: () => CleanOptions,\n cleanTask: () => cleanTask,\n cleanWithOptionsTask: () => cleanWithOptionsTask,\n isCleanOptionsArray: () => isCleanOptionsArray\n});\nfunction cleanWithOptionsTask(mode, customArgs) {\n const { cleanMode, options, valid } = getCleanOptions(mode);\n if (!cleanMode) {\n return configurationErrorTask(CONFIG_ERROR_MODE_REQUIRED);\n }\n if (!valid.options) {\n return configurationErrorTask(CONFIG_ERROR_UNKNOWN_OPTION + JSON.stringify(mode));\n }\n options.push(...customArgs);\n if (options.some(isInteractiveMode)) {\n return configurationErrorTask(CONFIG_ERROR_INTERACTIVE_MODE);\n }\n return cleanTask(cleanMode, options);\n}\nfunction cleanTask(mode, customArgs) {\n const commands = [\"clean\", `-${mode}`, ...customArgs];\n return {\n commands,\n format: \"utf-8\",\n parser(text) {\n return cleanSummaryParser(mode === \"n\" /* DRY_RUN */, text);\n }\n };\n}\nfunction isCleanOptionsArray(input) {\n return Array.isArray(input) && input.every((test) => CleanOptionValues.has(test));\n}\nfunction getCleanOptions(input) {\n let cleanMode;\n let options = [];\n let valid = { cleanMode: false, options: true };\n input.replace(/[^a-z]i/g, \"\").split(\"\").forEach((char) => {\n if (isCleanMode(char)) {\n cleanMode = char;\n valid.cleanMode = true;\n } else {\n valid.options = valid.options && isKnownOption(options[options.length] = `-${char}`);\n }\n });\n return {\n cleanMode,\n options,\n valid\n };\n}\nfunction isCleanMode(cleanMode) {\n return cleanMode === \"f\" /* FORCE */ || cleanMode === \"n\" /* DRY_RUN */;\n}\nfunction isKnownOption(option) {\n return /^-[a-z]$/i.test(option) && CleanOptionValues.has(option.charAt(1));\n}\nfunction isInteractiveMode(option) {\n if (/^-[^\\-]/.test(option)) {\n return option.indexOf(\"i\") > 0;\n }\n return option === \"--interactive\";\n}\nvar CONFIG_ERROR_INTERACTIVE_MODE, CONFIG_ERROR_MODE_REQUIRED, CONFIG_ERROR_UNKNOWN_OPTION, CleanOptions, CleanOptionValues;\nvar init_clean = __esm({\n \"src/lib/tasks/clean.ts\"() {\n \"use strict\";\n init_CleanSummary();\n init_utils();\n init_task();\n CONFIG_ERROR_INTERACTIVE_MODE = \"Git clean interactive mode is not supported\";\n CONFIG_ERROR_MODE_REQUIRED = 'Git clean mode parameter (\"n\" or \"f\") is required';\n CONFIG_ERROR_UNKNOWN_OPTION = \"Git clean unknown option found in: \";\n CleanOptions = /* @__PURE__ */ ((CleanOptions2) => {\n CleanOptions2[\"DRY_RUN\"] = \"n\";\n CleanOptions2[\"FORCE\"] = \"f\";\n CleanOptions2[\"IGNORED_INCLUDED\"] = \"x\";\n CleanOptions2[\"IGNORED_ONLY\"] = \"X\";\n CleanOptions2[\"EXCLUDING\"] = \"e\";\n CleanOptions2[\"QUIET\"] = \"q\";\n CleanOptions2[\"RECURSIVE\"] = \"d\";\n return CleanOptions2;\n })(CleanOptions || {});\n CleanOptionValues = /* @__PURE__ */ new Set([\n \"i\",\n ...asStringArray(Object.values(CleanOptions))\n ]);\n }\n});\n\n// src/lib/responses/ConfigList.ts\nfunction configListParser(text) {\n const config = new ConfigList();\n for (const item of configParser(text)) {\n config.addValue(item.file, String(item.key), item.value);\n }\n return config;\n}\nfunction configGetParser(text, key) {\n let value = null;\n const values = [];\n const scopes = /* @__PURE__ */ new Map();\n for (const item of configParser(text, key)) {\n if (item.key !== key) {\n continue;\n }\n values.push(value = item.value);\n if (!scopes.has(item.file)) {\n scopes.set(item.file, []);\n }\n scopes.get(item.file).push(value);\n }\n return {\n key,\n paths: Array.from(scopes.keys()),\n scopes,\n value,\n values\n };\n}\nfunction configFilePath(filePath) {\n return filePath.replace(/^(file):/, \"\");\n}\nfunction* configParser(text, requestedKey = null) {\n const lines = text.split(\"\\0\");\n for (let i = 0, max = lines.length - 1; i < max; ) {\n const file = configFilePath(lines[i++]);\n let value = lines[i++];\n let key = requestedKey;\n if (value.includes(\"\\n\")) {\n const line = splitOn(value, \"\\n\");\n key = line[0];\n value = line[1];\n }\n yield { file, key, value };\n }\n}\nvar ConfigList;\nvar init_ConfigList = __esm({\n \"src/lib/responses/ConfigList.ts\"() {\n \"use strict\";\n init_utils();\n ConfigList = class {\n constructor() {\n this.files = [];\n this.values = /* @__PURE__ */ Object.create(null);\n }\n get all() {\n if (!this._all) {\n this._all = this.files.reduce((all, file) => {\n return Object.assign(all, this.values[file]);\n }, {});\n }\n return this._all;\n }\n addFile(file) {\n if (!(file in this.values)) {\n const latest = last(this.files);\n this.values[file] = latest ? Object.create(this.values[latest]) : {};\n this.files.push(file);\n }\n return this.values[file];\n }\n addValue(file, key, value) {\n const values = this.addFile(file);\n if (!Object.hasOwn(values, key)) {\n values[key] = value;\n } else if (Array.isArray(values[key])) {\n values[key].push(value);\n } else {\n values[key] = [values[key], value];\n }\n this._all = void 0;\n }\n };\n }\n});\n\n// src/lib/tasks/config.ts\nfunction asConfigScope(scope, fallback) {\n if (typeof scope === \"string\" && Object.hasOwn(GitConfigScope, scope)) {\n return scope;\n }\n return fallback;\n}\nfunction addConfigTask(key, value, append2, scope) {\n const commands = [\"config\", `--${scope}`];\n if (append2) {\n commands.push(\"--add\");\n }\n commands.push(key, value);\n return {\n commands,\n format: \"utf-8\",\n parser(text) {\n return text;\n }\n };\n}\nfunction getConfigTask(key, scope) {\n const commands = [\"config\", \"--null\", \"--show-origin\", \"--get-all\", key];\n if (scope) {\n commands.splice(1, 0, `--${scope}`);\n }\n return {\n commands,\n format: \"utf-8\",\n parser(text) {\n return configGetParser(text, key);\n }\n };\n}\nfunction listConfigTask(scope) {\n const commands = [\"config\", \"--list\", \"--show-origin\", \"--null\"];\n if (scope) {\n commands.push(`--${scope}`);\n }\n return {\n commands,\n format: \"utf-8\",\n parser(text) {\n return configListParser(text);\n }\n };\n}\nfunction config_default() {\n return {\n addConfig(key, value, ...rest) {\n return this._runTask(\n addConfigTask(\n key,\n value,\n rest[0] === true,\n asConfigScope(rest[1], \"local\" /* local */)\n ),\n trailingFunctionArgument(arguments)\n );\n },\n getConfig(key, scope) {\n return this._runTask(\n getConfigTask(key, asConfigScope(scope, void 0)),\n trailingFunctionArgument(arguments)\n );\n },\n listConfig(...rest) {\n return this._runTask(\n listConfigTask(asConfigScope(rest[0], void 0)),\n trailingFunctionArgument(arguments)\n );\n }\n };\n}\nvar GitConfigScope;\nvar init_config = __esm({\n \"src/lib/tasks/config.ts\"() {\n \"use strict\";\n init_ConfigList();\n init_utils();\n GitConfigScope = /* @__PURE__ */ ((GitConfigScope2) => {\n GitConfigScope2[\"system\"] = \"system\";\n GitConfigScope2[\"global\"] = \"global\";\n GitConfigScope2[\"local\"] = \"local\";\n GitConfigScope2[\"worktree\"] = \"worktree\";\n return GitConfigScope2;\n })(GitConfigScope || {});\n }\n});\n\n// src/lib/tasks/diff-name-status.ts\nfunction isDiffNameStatus(input) {\n return diffNameStatus.has(input);\n}\nvar DiffNameStatus, diffNameStatus;\nvar init_diff_name_status = __esm({\n \"src/lib/tasks/diff-name-status.ts\"() {\n \"use strict\";\n DiffNameStatus = /* @__PURE__ */ ((DiffNameStatus2) => {\n DiffNameStatus2[\"ADDED\"] = \"A\";\n DiffNameStatus2[\"COPIED\"] = \"C\";\n DiffNameStatus2[\"DELETED\"] = \"D\";\n DiffNameStatus2[\"MODIFIED\"] = \"M\";\n DiffNameStatus2[\"RENAMED\"] = \"R\";\n DiffNameStatus2[\"CHANGED\"] = \"T\";\n DiffNameStatus2[\"UNMERGED\"] = \"U\";\n DiffNameStatus2[\"UNKNOWN\"] = \"X\";\n DiffNameStatus2[\"BROKEN\"] = \"B\";\n return DiffNameStatus2;\n })(DiffNameStatus || {});\n diffNameStatus = new Set(Object.values(DiffNameStatus));\n }\n});\n\n// src/lib/tasks/grep.ts\nfunction grepQueryBuilder(...params) {\n return new GrepQuery().param(...params);\n}\nfunction parseGrep(grep) {\n const paths = /* @__PURE__ */ new Set();\n const results = {};\n forEachLineWithContent(grep, (input) => {\n const [path, line, preview] = input.split(NULL);\n paths.add(path);\n (results[path] = results[path] || []).push({\n line: asNumber(line),\n path,\n preview\n });\n });\n return {\n paths,\n results\n };\n}\nfunction grep_default() {\n return {\n grep(searchTerm) {\n const then = trailingFunctionArgument(arguments);\n const options = getTrailingOptions(arguments);\n for (const option of disallowedOptions) {\n if (options.includes(option)) {\n return this._runTask(\n configurationErrorTask(`git.grep: use of \"${option}\" is not supported.`),\n then\n );\n }\n }\n if (typeof searchTerm === \"string\") {\n searchTerm = grepQueryBuilder().param(searchTerm);\n }\n const commands = [\"grep\", \"--null\", \"-n\", \"--full-name\", ...options, ...searchTerm];\n return this._runTask(\n {\n commands,\n format: \"utf-8\",\n parser(stdOut) {\n return parseGrep(stdOut);\n }\n },\n then\n );\n }\n };\n}\nvar disallowedOptions, Query, _a, GrepQuery;\nvar init_grep = __esm({\n \"src/lib/tasks/grep.ts\"() {\n \"use strict\";\n init_utils();\n init_task();\n disallowedOptions = [\"-h\"];\n Query = Symbol(\"grepQuery\");\n GrepQuery = class {\n constructor() {\n this[_a] = [];\n }\n *[(_a = Query, Symbol.iterator)]() {\n for (const query of this[Query]) {\n yield query;\n }\n }\n and(...and) {\n and.length && this[Query].push(\"--and\", \"(\", ...prefixedArray(and, \"-e\"), \")\");\n return this;\n }\n param(...param) {\n this[Query].push(...prefixedArray(param, \"-e\"));\n return this;\n }\n };\n }\n});\n\n// src/lib/tasks/reset.ts\nvar reset_exports = {};\n__export(reset_exports, {\n ResetMode: () => ResetMode,\n getResetMode: () => getResetMode,\n resetTask: () => resetTask\n});\nfunction resetTask(mode, customArgs) {\n const commands = [\"reset\"];\n if (isValidResetMode(mode)) {\n commands.push(`--${mode}`);\n }\n commands.push(...customArgs);\n return straightThroughStringTask(commands);\n}\nfunction getResetMode(mode) {\n if (isValidResetMode(mode)) {\n return mode;\n }\n switch (typeof mode) {\n case \"string\":\n case \"undefined\":\n return \"soft\" /* SOFT */;\n }\n return;\n}\nfunction isValidResetMode(mode) {\n return typeof mode === \"string\" && validResetModes.includes(mode);\n}\nvar ResetMode, validResetModes;\nvar init_reset = __esm({\n \"src/lib/tasks/reset.ts\"() {\n \"use strict\";\n init_utils();\n init_task();\n ResetMode = /* @__PURE__ */ ((ResetMode2) => {\n ResetMode2[\"MIXED\"] = \"mixed\";\n ResetMode2[\"SOFT\"] = \"soft\";\n ResetMode2[\"HARD\"] = \"hard\";\n ResetMode2[\"MERGE\"] = \"merge\";\n ResetMode2[\"KEEP\"] = \"keep\";\n return ResetMode2;\n })(ResetMode || {});\n validResetModes = asStringArray(Object.values(ResetMode));\n }\n});\n\n// src/lib/git-logger.ts\nimport debug from \"debug\";\nfunction createLog() {\n return debug(\"simple-git\");\n}\nfunction prefixedLogger(to, prefix, forward) {\n if (!prefix || !String(prefix).replace(/\\s*/, \"\")) {\n return !forward ? to : (message, ...args) => {\n to(message, ...args);\n forward(message, ...args);\n };\n }\n return (message, ...args) => {\n to(`%s ${message}`, prefix, ...args);\n if (forward) {\n forward(message, ...args);\n }\n };\n}\nfunction childLoggerName(name, childDebugger, { namespace: parentNamespace }) {\n if (typeof name === \"string\") {\n return name;\n }\n const childNamespace = childDebugger && childDebugger.namespace || \"\";\n if (childNamespace.startsWith(parentNamespace)) {\n return childNamespace.substr(parentNamespace.length + 1);\n }\n return childNamespace || parentNamespace;\n}\nfunction createLogger(label, verbose, initialStep, infoDebugger = createLog()) {\n const labelPrefix = label && `[${label}]` || \"\";\n const spawned = [];\n const debugDebugger = typeof verbose === \"string\" ? infoDebugger.extend(verbose) : verbose;\n const key = childLoggerName(filterType(verbose, filterString), debugDebugger, infoDebugger);\n return step(initialStep);\n function sibling(name, initial) {\n return append(\n spawned,\n createLogger(label, key.replace(/^[^:]+/, name), initial, infoDebugger)\n );\n }\n function step(phase) {\n const stepPrefix = phase && `[${phase}]` || \"\";\n const debug2 = debugDebugger && prefixedLogger(debugDebugger, stepPrefix) || NOOP;\n const info = prefixedLogger(infoDebugger, `${labelPrefix} ${stepPrefix}`, debug2);\n return Object.assign(debugDebugger ? debug2 : info, {\n label,\n sibling,\n info,\n step\n });\n }\n}\nvar init_git_logger = __esm({\n \"src/lib/git-logger.ts\"() {\n \"use strict\";\n init_utils();\n debug.formatters.L = (value) => String(filterHasLength(value) ? value.length : \"-\");\n debug.formatters.B = (value) => {\n if (Buffer.isBuffer(value)) {\n return value.toString(\"utf8\");\n }\n return objectToString(value);\n };\n }\n});\n\n// src/lib/runners/tasks-pending-queue.ts\nvar TasksPendingQueue;\nvar init_tasks_pending_queue = __esm({\n \"src/lib/runners/tasks-pending-queue.ts\"() {\n \"use strict\";\n init_git_error();\n init_git_logger();\n TasksPendingQueue = class _TasksPendingQueue {\n constructor(logLabel = \"GitExecutor\") {\n this.logLabel = logLabel;\n this._queue = /* @__PURE__ */ new Map();\n }\n withProgress(task) {\n return this._queue.get(task);\n }\n createProgress(task) {\n const name = _TasksPendingQueue.getName(task.commands[0]);\n const logger = createLogger(this.logLabel, name);\n return {\n task,\n logger,\n name\n };\n }\n push(task) {\n const progress = this.createProgress(task);\n progress.logger(\"Adding task to the queue, commands = %o\", task.commands);\n this._queue.set(task, progress);\n return progress;\n }\n fatal(err) {\n for (const [task, { logger }] of Array.from(this._queue.entries())) {\n if (task === err.task) {\n logger.info(`Failed %o`, err);\n logger(\n `Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`\n );\n } else {\n logger.info(\n `A fatal exception occurred in a previous task, the queue has been purged: %o`,\n err.message\n );\n }\n this.complete(task);\n }\n if (this._queue.size !== 0) {\n throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`);\n }\n }\n complete(task) {\n const progress = this.withProgress(task);\n if (progress) {\n this._queue.delete(task);\n }\n }\n attempt(task) {\n const progress = this.withProgress(task);\n if (!progress) {\n throw new GitError(void 0, \"TasksPendingQueue: attempt called for an unknown task\");\n }\n progress.logger(\"Starting task\");\n return progress;\n }\n static getName(name = \"empty\") {\n return `task:${name}:${++_TasksPendingQueue.counter}`;\n }\n static {\n this.counter = 0;\n }\n };\n }\n});\n\n// src/lib/runners/git-executor-chain.ts\nimport { spawn } from \"child_process\";\nfunction pluginContext(task, commands) {\n return {\n method: first(task.commands) || \"\",\n commands\n };\n}\nfunction onErrorReceived(target, logger) {\n return (err) => {\n logger(`[ERROR] child process exception %o`, err);\n target.push(Buffer.from(String(err.stack), \"ascii\"));\n };\n}\nfunction onDataReceived(target, name, logger, output) {\n return (buffer) => {\n logger(`%s received %L bytes`, name, buffer);\n output(`%B`, buffer);\n target.push(buffer);\n };\n}\nvar GitExecutorChain;\nvar init_git_executor_chain = __esm({\n \"src/lib/runners/git-executor-chain.ts\"() {\n \"use strict\";\n init_git_error();\n init_task();\n init_utils();\n init_tasks_pending_queue();\n GitExecutorChain = class {\n constructor(_executor, _scheduler, _plugins) {\n this._executor = _executor;\n this._scheduler = _scheduler;\n this._plugins = _plugins;\n this._chain = Promise.resolve();\n this._queue = new TasksPendingQueue();\n }\n get cwd() {\n return this._cwd || this._executor.cwd;\n }\n set cwd(cwd) {\n this._cwd = cwd;\n }\n get env() {\n return this._executor.env;\n }\n get outputHandler() {\n return this._executor.outputHandler;\n }\n chain() {\n return this;\n }\n push(task) {\n this._queue.push(task);\n return this._chain = this._chain.then(() => this.attemptTask(task));\n }\n async attemptTask(task) {\n const onScheduleComplete = await this._scheduler.next();\n const onQueueComplete = () => this._queue.complete(task);\n try {\n const { logger } = this._queue.attempt(task);\n return await (isEmptyTask(task) ? this.attemptEmptyTask(task, logger) : this.attemptRemoteTask(task, logger));\n } catch (e) {\n throw this.onFatalException(task, e);\n } finally {\n onQueueComplete();\n onScheduleComplete();\n }\n }\n onFatalException(task, e) {\n const gitError = e instanceof GitError ? Object.assign(e, { task }) : new GitError(task, e && String(e));\n this._chain = Promise.resolve();\n this._queue.fatal(gitError);\n return gitError;\n }\n async attemptRemoteTask(task, logger) {\n const binary = this._plugins.exec(\"spawn.binary\", \"\", pluginContext(task, task.commands));\n const args = this._plugins.exec(\"spawn.args\", [...task.commands], {\n ...pluginContext(task, task.commands),\n env: { ...this.env }\n });\n const raw = await this.gitResponse(\n task,\n binary,\n args,\n this.outputHandler,\n logger.step(\"SPAWN\")\n );\n const outputStreams = await this.handleTaskData(task, args, raw, logger.step(\"HANDLE\"));\n logger(`passing response to task's parser as a %s`, task.format);\n if (isBufferTask(task)) {\n return callTaskParser(task.parser, outputStreams);\n }\n return callTaskParser(task.parser, outputStreams.asStrings());\n }\n async attemptEmptyTask(task, logger) {\n logger(`empty task bypassing child process to call to task's parser`);\n return task.parser(this);\n }\n handleTaskData(task, args, result, logger) {\n const { exitCode, rejection, stdOut, stdErr } = result;\n return new Promise((done, fail) => {\n logger(`Preparing to handle process response exitCode=%d stdOut=`, exitCode);\n const { error } = this._plugins.exec(\n \"task.error\",\n { error: rejection },\n {\n ...pluginContext(task, args),\n ...result\n }\n );\n if (error && task.onError) {\n logger.info(`exitCode=%s handling with custom error handler`);\n return task.onError(\n result,\n error,\n (newStdOut) => {\n logger.info(`custom error handler treated as success`);\n logger(`custom error returned a %s`, objectToString(newStdOut));\n done(\n new GitOutputStreams(\n Array.isArray(newStdOut) ? Buffer.concat(newStdOut) : newStdOut,\n Buffer.concat(stdErr)\n )\n );\n },\n fail\n );\n }\n if (error) {\n logger.info(\n `handling as error: exitCode=%s stdErr=%s rejection=%o`,\n exitCode,\n stdErr.length,\n rejection\n );\n return fail(error);\n }\n logger.info(`retrieving task output complete`);\n done(new GitOutputStreams(Buffer.concat(stdOut), Buffer.concat(stdErr)));\n });\n }\n async gitResponse(task, command, args, outputHandler, logger) {\n const outputLogger = logger.sibling(\"output\");\n const spawnOptions = this._plugins.exec(\n \"spawn.options\",\n {\n cwd: this.cwd,\n env: this.env,\n windowsHide: true\n },\n pluginContext(task, task.commands)\n );\n return new Promise((done) => {\n const stdOut = [];\n const stdErr = [];\n logger.info(`%s %o`, command, args);\n logger(\"%O\", spawnOptions);\n let rejection = this._beforeSpawn(task, args);\n if (rejection) {\n return done({\n stdOut,\n stdErr,\n exitCode: 9901,\n rejection\n });\n }\n this._plugins.exec(\"spawn.before\", void 0, {\n ...pluginContext(task, args),\n kill(reason) {\n rejection = reason || rejection;\n }\n });\n const spawned = spawn(command, args, spawnOptions);\n spawned.stdout.on(\n \"data\",\n onDataReceived(stdOut, \"stdOut\", logger, outputLogger.step(\"stdOut\"))\n );\n spawned.stderr.on(\n \"data\",\n onDataReceived(stdErr, \"stdErr\", logger, outputLogger.step(\"stdErr\"))\n );\n spawned.on(\"error\", onErrorReceived(stdErr, logger));\n if (outputHandler) {\n logger(`Passing child process stdOut/stdErr to custom outputHandler`);\n outputHandler(command, spawned.stdout, spawned.stderr, [...args]);\n }\n this._plugins.exec(\"spawn.after\", void 0, {\n ...pluginContext(task, args),\n spawned,\n close(exitCode, reason) {\n done({\n stdOut,\n stdErr,\n exitCode,\n rejection: rejection || reason\n });\n },\n kill(reason) {\n if (spawned.killed) {\n return;\n }\n rejection = reason;\n spawned.kill(\"SIGINT\");\n }\n });\n });\n }\n _beforeSpawn(task, args) {\n let rejection;\n this._plugins.exec(\"spawn.before\", void 0, {\n ...pluginContext(task, args),\n kill(reason) {\n rejection = reason || rejection;\n }\n });\n return rejection;\n }\n };\n }\n});\n\n// src/lib/runners/git-executor.ts\nvar git_executor_exports = {};\n__export(git_executor_exports, {\n GitExecutor: () => GitExecutor\n});\nvar GitExecutor;\nvar init_git_executor = __esm({\n \"src/lib/runners/git-executor.ts\"() {\n \"use strict\";\n init_git_executor_chain();\n GitExecutor = class {\n constructor(cwd, _scheduler, _plugins) {\n this.cwd = cwd;\n this._scheduler = _scheduler;\n this._plugins = _plugins;\n this._chain = new GitExecutorChain(this, this._scheduler, this._plugins);\n }\n chain() {\n return new GitExecutorChain(this, this._scheduler, this._plugins);\n }\n push(task) {\n return this._chain.push(task);\n }\n };\n }\n});\n\n// src/lib/task-callback.ts\nfunction taskCallback(task, response, callback = NOOP) {\n const onSuccess = (data) => {\n callback(null, data);\n };\n const onError2 = (err) => {\n if (err?.task === task) {\n callback(\n err instanceof GitResponseError ? addDeprecationNoticeToError(err) : err,\n void 0\n );\n }\n };\n response.then(onSuccess, onError2);\n}\nfunction addDeprecationNoticeToError(err) {\n let log = (name) => {\n console.warn(\n `simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3`\n );\n log = NOOP;\n };\n return Object.create(err, Object.getOwnPropertyNames(err.git).reduce(descriptorReducer, {}));\n function descriptorReducer(all, name) {\n if (name in err) {\n return all;\n }\n all[name] = {\n enumerable: false,\n configurable: false,\n get() {\n log(name);\n return err.git[name];\n }\n };\n return all;\n }\n}\nvar init_task_callback = __esm({\n \"src/lib/task-callback.ts\"() {\n \"use strict\";\n init_git_response_error();\n init_utils();\n }\n});\n\n// src/lib/tasks/change-working-directory.ts\nfunction changeWorkingDirectoryTask(directory, root) {\n return adhocExecTask((instance) => {\n if (!folderExists(directory)) {\n throw new Error(`Git.cwd: cannot change to non-directory \"${directory}\"`);\n }\n return (root || instance).cwd = directory;\n });\n}\nvar init_change_working_directory = __esm({\n \"src/lib/tasks/change-working-directory.ts\"() {\n \"use strict\";\n init_utils();\n init_task();\n }\n});\n\n// src/lib/tasks/checkout.ts\nfunction checkoutTask(args) {\n const commands = [\"checkout\", ...args];\n if (commands[1] === \"-b\" && commands.includes(\"-B\")) {\n commands[1] = remove(commands, \"-B\");\n }\n return straightThroughStringTask(commands);\n}\nfunction checkout_default() {\n return {\n checkout() {\n return this._runTask(\n checkoutTask(getTrailingOptions(arguments, 1)),\n trailingFunctionArgument(arguments)\n );\n },\n checkoutBranch(branchName, startPoint) {\n return this._runTask(\n checkoutTask([\"-b\", branchName, startPoint, ...getTrailingOptions(arguments)]),\n trailingFunctionArgument(arguments)\n );\n },\n checkoutLocalBranch(branchName) {\n return this._runTask(\n checkoutTask([\"-b\", branchName, ...getTrailingOptions(arguments)]),\n trailingFunctionArgument(arguments)\n );\n }\n };\n}\nvar init_checkout = __esm({\n \"src/lib/tasks/checkout.ts\"() {\n \"use strict\";\n init_utils();\n init_task();\n }\n});\n\n// src/lib/tasks/count-objects.ts\nfunction countObjectsResponse() {\n return {\n count: 0,\n garbage: 0,\n inPack: 0,\n packs: 0,\n prunePackable: 0,\n size: 0,\n sizeGarbage: 0,\n sizePack: 0\n };\n}\nfunction count_objects_default() {\n return {\n countObjects() {\n return this._runTask({\n commands: [\"count-objects\", \"--verbose\"],\n format: \"utf-8\",\n parser(stdOut) {\n return parseStringResponse(countObjectsResponse(), [parser2], stdOut);\n }\n });\n }\n };\n}\nvar parser2;\nvar init_count_objects = __esm({\n \"src/lib/tasks/count-objects.ts\"() {\n \"use strict\";\n init_utils();\n parser2 = new LineParser(\n /([a-z-]+): (\\d+)$/,\n (result, [key, value]) => {\n const property = asCamelCase(key);\n if (Object.hasOwn(result, property)) {\n result[property] = asNumber(value);\n }\n }\n );\n }\n});\n\n// src/lib/parsers/parse-commit.ts\nfunction parseCommitResult(stdOut) {\n const result = {\n author: null,\n branch: \"\",\n commit: \"\",\n root: false,\n summary: {\n changes: 0,\n insertions: 0,\n deletions: 0\n }\n };\n return parseStringResponse(result, parsers, stdOut);\n}\nvar parsers;\nvar init_parse_commit = __esm({\n \"src/lib/parsers/parse-commit.ts\"() {\n \"use strict\";\n init_utils();\n parsers = [\n new LineParser(/^\\[([^\\s]+)( \\([^)]+\\))? ([^\\]]+)/, (result, [branch, root, commit]) => {\n result.branch = branch;\n result.commit = commit;\n result.root = !!root;\n }),\n new LineParser(/\\s*Author:\\s(.+)/i, (result, [author]) => {\n const parts = author.split(\"<\");\n const email = parts.pop();\n if (!email || !email.includes(\"@\")) {\n return;\n }\n result.author = {\n email: email.substr(0, email.length - 1),\n name: parts.join(\"<\").trim()\n };\n }),\n new LineParser(\n /(\\d+)[^,]*(?:,\\s*(\\d+)[^,]*)(?:,\\s*(\\d+))/g,\n (result, [changes, insertions, deletions]) => {\n result.summary.changes = parseInt(changes, 10) || 0;\n result.summary.insertions = parseInt(insertions, 10) || 0;\n result.summary.deletions = parseInt(deletions, 10) || 0;\n }\n ),\n new LineParser(\n /^(\\d+)[^,]*(?:,\\s*(\\d+)[^(]+\\(([+-]))?/,\n (result, [changes, lines, direction]) => {\n result.summary.changes = parseInt(changes, 10) || 0;\n const count = parseInt(lines, 10) || 0;\n if (direction === \"-\") {\n result.summary.deletions = count;\n } else if (direction === \"+\") {\n result.summary.insertions = count;\n }\n }\n )\n ];\n }\n});\n\n// src/lib/tasks/commit.ts\nfunction commitTask(message, files, customArgs) {\n const commands = [\n \"-c\",\n \"core.abbrev=40\",\n \"commit\",\n ...prefixedArray(message, \"-m\"),\n ...files,\n ...customArgs\n ];\n return {\n commands,\n format: \"utf-8\",\n parser: parseCommitResult\n };\n}\nfunction commit_default() {\n return {\n commit(message, ...rest) {\n const next = trailingFunctionArgument(arguments);\n const task = rejectDeprecatedSignatures(message) || commitTask(\n asArray(message),\n asArray(filterType(rest[0], filterStringOrStringArray, [])),\n [\n ...asStringArray(filterType(rest[1], filterArray, [])),\n ...getTrailingOptions(arguments, 0, true)\n ]\n );\n return this._runTask(task, next);\n }\n };\n function rejectDeprecatedSignatures(message) {\n return !filterStringOrStringArray(message) && configurationErrorTask(\n `git.commit: requires the commit message to be supplied as a string/string[]`\n );\n }\n}\nvar init_commit = __esm({\n \"src/lib/tasks/commit.ts\"() {\n \"use strict\";\n init_parse_commit();\n init_utils();\n init_task();\n }\n});\n\n// src/lib/tasks/first-commit.ts\nfunction first_commit_default() {\n return {\n firstCommit() {\n return this._runTask(\n straightThroughStringTask([\"rev-list\", \"--max-parents=0\", \"HEAD\"], true),\n trailingFunctionArgument(arguments)\n );\n }\n };\n}\nvar init_first_commit = __esm({\n \"src/lib/tasks/first-commit.ts\"() {\n \"use strict\";\n init_utils();\n init_task();\n }\n});\n\n// src/lib/tasks/hash-object.ts\nfunction hashObjectTask(filePath, write) {\n const commands = [\"hash-object\", filePath];\n if (write) {\n commands.push(\"-w\");\n }\n return straightThroughStringTask(commands, true);\n}\nvar init_hash_object = __esm({\n \"src/lib/tasks/hash-object.ts\"() {\n \"use strict\";\n init_task();\n }\n});\n\n// src/lib/responses/InitSummary.ts\nfunction parseInit(bare, path, text) {\n const response = String(text).trim();\n let result;\n if (result = initResponseRegex.exec(response)) {\n return new InitSummary(bare, path, false, result[1]);\n }\n if (result = reInitResponseRegex.exec(response)) {\n return new InitSummary(bare, path, true, result[1]);\n }\n let gitDir = \"\";\n const tokens = response.split(\" \");\n while (tokens.length) {\n const token = tokens.shift();\n if (token === \"in\") {\n gitDir = tokens.join(\" \");\n break;\n }\n }\n return new InitSummary(bare, path, /^re/i.test(response), gitDir);\n}\nvar InitSummary, initResponseRegex, reInitResponseRegex;\nvar init_InitSummary = __esm({\n \"src/lib/responses/InitSummary.ts\"() {\n \"use strict\";\n InitSummary = class {\n constructor(bare, path, existing, gitDir) {\n this.bare = bare;\n this.path = path;\n this.existing = existing;\n this.gitDir = gitDir;\n }\n };\n initResponseRegex = /^Init.+ repository in (.+)$/;\n reInitResponseRegex = /^Rein.+ in (.+)$/;\n }\n});\n\n// src/lib/tasks/init.ts\nfunction hasBareCommand(command) {\n return command.includes(bareCommand);\n}\nfunction initTask(bare = false, path, customArgs) {\n const commands = [\"init\", ...customArgs];\n if (bare && !hasBareCommand(commands)) {\n commands.splice(1, 0, bareCommand);\n }\n return {\n commands,\n format: \"utf-8\",\n parser(text) {\n return parseInit(commands.includes(\"--bare\"), path, text);\n }\n };\n}\nvar bareCommand;\nvar init_init = __esm({\n \"src/lib/tasks/init.ts\"() {\n \"use strict\";\n init_InitSummary();\n bareCommand = \"--bare\";\n }\n});\n\n// src/lib/args/log-format.ts\nfunction logFormatFromCommand(customArgs) {\n for (let i = 0; i < customArgs.length; i++) {\n const format = logFormatRegex.exec(customArgs[i]);\n if (format) {\n return `--${format[1]}`;\n }\n }\n return \"\" /* NONE */;\n}\nfunction isLogFormat(customArg) {\n return logFormatRegex.test(customArg);\n}\nvar logFormatRegex;\nvar init_log_format = __esm({\n \"src/lib/args/log-format.ts\"() {\n \"use strict\";\n logFormatRegex = /^--(stat|numstat|name-only|name-status)(=|$)/;\n }\n});\n\n// src/lib/responses/DiffSummary.ts\nvar DiffSummary;\nvar init_DiffSummary = __esm({\n \"src/lib/responses/DiffSummary.ts\"() {\n \"use strict\";\n DiffSummary = class {\n constructor() {\n this.changed = 0;\n this.deletions = 0;\n this.insertions = 0;\n this.files = [];\n }\n };\n }\n});\n\n// src/lib/parsers/parse-diff-summary.ts\nfunction getDiffParser(format = \"\" /* NONE */) {\n const parser4 = diffSummaryParsers[format];\n return (stdOut) => parseStringResponse(new DiffSummary(), parser4, stdOut, false);\n}\nvar statParser, numStatParser, nameOnlyParser, nameStatusParser, diffSummaryParsers;\nvar init_parse_diff_summary = __esm({\n \"src/lib/parsers/parse-diff-summary.ts\"() {\n \"use strict\";\n init_log_format();\n init_DiffSummary();\n init_diff_name_status();\n init_utils();\n statParser = [\n new LineParser(\n /^(.+)\\s+\\|\\s+(\\d+)(\\s+[+\\-]+)?$/,\n (result, [file, changes, alterations = \"\"]) => {\n result.files.push({\n file: file.trim(),\n changes: asNumber(changes),\n insertions: alterations.replace(/[^+]/g, \"\").length,\n deletions: alterations.replace(/[^-]/g, \"\").length,\n binary: false\n });\n }\n ),\n new LineParser(\n /^(.+) \\|\\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,\n (result, [file, before, after]) => {\n result.files.push({\n file: file.trim(),\n before: asNumber(before),\n after: asNumber(after),\n binary: true\n });\n }\n ),\n new LineParser(\n /(\\d+) files? changed\\s*((?:, \\d+ [^,]+){0,2})/,\n (result, [changed, summary]) => {\n const inserted = /(\\d+) i/.exec(summary);\n const deleted = /(\\d+) d/.exec(summary);\n result.changed = asNumber(changed);\n result.insertions = asNumber(inserted?.[1]);\n result.deletions = asNumber(deleted?.[1]);\n }\n )\n ];\n numStatParser = [\n new LineParser(\n /(\\d+)\\t(\\d+)\\t(.+)$/,\n (result, [changesInsert, changesDelete, file]) => {\n const insertions = asNumber(changesInsert);\n const deletions = asNumber(changesDelete);\n result.changed++;\n result.insertions += insertions;\n result.deletions += deletions;\n result.files.push({\n file,\n changes: insertions + deletions,\n insertions,\n deletions,\n binary: false\n });\n }\n ),\n new LineParser(/-\\t-\\t(.+)$/, (result, [file]) => {\n result.changed++;\n result.files.push({\n file,\n after: 0,\n before: 0,\n binary: true\n });\n })\n ];\n nameOnlyParser = [\n new LineParser(/(.+)$/, (result, [file]) => {\n result.changed++;\n result.files.push({\n file,\n changes: 0,\n insertions: 0,\n deletions: 0,\n binary: false\n });\n })\n ];\n nameStatusParser = [\n new LineParser(\n /([ACDMRTUXB])([0-9]{0,3})\\t(.[^\\t]*)(\\t(.[^\\t]*))?$/,\n (result, [status, similarity, from, _to, to]) => {\n result.changed++;\n result.files.push({\n file: to ?? from,\n changes: 0,\n insertions: 0,\n deletions: 0,\n binary: false,\n status: orVoid(isDiffNameStatus(status) && status),\n from: orVoid(!!to && from !== to && from),\n similarity: asNumber(similarity)\n });\n }\n )\n ];\n diffSummaryParsers = {\n [\"\" /* NONE */]: statParser,\n [\"--stat\" /* STAT */]: statParser,\n [\"--numstat\" /* NUM_STAT */]: numStatParser,\n [\"--name-status\" /* NAME_STATUS */]: nameStatusParser,\n [\"--name-only\" /* NAME_ONLY */]: nameOnlyParser\n };\n }\n});\n\n// src/lib/parsers/parse-list-log-summary.ts\nfunction lineBuilder(tokens, fields) {\n return fields.reduce(\n (line, field, index) => {\n line[field] = tokens[index] || \"\";\n return line;\n },\n /* @__PURE__ */ Object.create({ diff: null })\n );\n}\nfunction createListLogSummaryParser(splitter = SPLITTER, fields = defaultFieldNames, logFormat = \"\" /* NONE */) {\n const parseDiffResult = getDiffParser(logFormat);\n return function(stdOut) {\n const all = toLinesWithContent(\n stdOut.trim(),\n false,\n START_BOUNDARY\n ).map(function(item) {\n const lineDetail = item.split(COMMIT_BOUNDARY);\n const listLogLine = lineBuilder(lineDetail[0].split(splitter), fields);\n if (lineDetail.length > 1 && !!lineDetail[1].trim()) {\n listLogLine.diff = parseDiffResult(lineDetail[1]);\n }\n return listLogLine;\n });\n return {\n all,\n latest: all.length && all[0] || null,\n total: all.length\n };\n };\n}\nvar START_BOUNDARY, COMMIT_BOUNDARY, SPLITTER, defaultFieldNames;\nvar init_parse_list_log_summary = __esm({\n \"src/lib/parsers/parse-list-log-summary.ts\"() {\n \"use strict\";\n init_utils();\n init_parse_diff_summary();\n init_log_format();\n START_BOUNDARY = \"\\xF2\\xF2\\xF2\\xF2\\xF2\\xF2 \";\n COMMIT_BOUNDARY = \" \\xF2\\xF2\";\n SPLITTER = \" \\xF2 \";\n defaultFieldNames = [\"hash\", \"date\", \"message\", \"refs\", \"author_name\", \"author_email\"];\n }\n});\n\n// src/lib/tasks/diff.ts\nvar diff_exports = {};\n__export(diff_exports, {\n diffSummaryTask: () => diffSummaryTask,\n validateLogFormatConfig: () => validateLogFormatConfig\n});\nfunction diffSummaryTask(customArgs) {\n let logFormat = logFormatFromCommand(customArgs);\n const commands = [\"diff\"];\n if (logFormat === \"\" /* NONE */) {\n logFormat = \"--stat\" /* STAT */;\n commands.push(\"--stat=4096\");\n }\n commands.push(...customArgs);\n return validateLogFormatConfig(commands) || {\n commands,\n format: \"utf-8\",\n parser: getDiffParser(logFormat)\n };\n}\nfunction validateLogFormatConfig(customArgs) {\n const flags = customArgs.filter(isLogFormat);\n if (flags.length > 1) {\n return configurationErrorTask(\n `Summary flags are mutually exclusive - pick one of ${flags.join(\",\")}`\n );\n }\n if (flags.length && customArgs.includes(\"-z\")) {\n return configurationErrorTask(\n `Summary flag ${flags} parsing is not compatible with null termination option '-z'`\n );\n }\n}\nvar init_diff = __esm({\n \"src/lib/tasks/diff.ts\"() {\n \"use strict\";\n init_log_format();\n init_parse_diff_summary();\n init_task();\n }\n});\n\n// src/lib/tasks/log.ts\nimport { pathspec as pathspec2 } from \"@simple-git/args-pathspec\";\nfunction prettyFormat(format, splitter) {\n const fields = [];\n const formatStr = [];\n Object.keys(format).forEach((field) => {\n fields.push(field);\n formatStr.push(String(format[field]));\n });\n return [fields, formatStr.join(splitter)];\n}\nfunction userOptions(input) {\n return Object.keys(input).reduce((out, key) => {\n if (!(key in excludeOptions)) {\n out[key] = input[key];\n }\n return out;\n }, {});\n}\nfunction parseLogOptions(opt = {}, customArgs = []) {\n const splitter = filterType(opt.splitter, filterString, SPLITTER);\n const format = filterPlainObject(opt.format) ? opt.format : {\n hash: \"%H\",\n date: opt.strictDate === false ? \"%ai\" : \"%aI\",\n message: \"%s\",\n refs: \"%D\",\n body: opt.multiLine ? \"%B\" : \"%b\",\n author_name: opt.mailMap !== false ? \"%aN\" : \"%an\",\n author_email: opt.mailMap !== false ? \"%aE\" : \"%ae\"\n };\n const [fields, formatStr] = prettyFormat(format, splitter);\n const suffix = [];\n const command = [\n `--pretty=format:${START_BOUNDARY}${formatStr}${COMMIT_BOUNDARY}`,\n ...customArgs\n ];\n const maxCount = opt.n || opt[\"max-count\"] || opt.maxCount;\n if (maxCount) {\n command.push(`--max-count=${maxCount}`);\n }\n if (opt.from || opt.to) {\n const rangeOperator = opt.symmetric !== false ? \"...\" : \"..\";\n suffix.push(`${opt.from || \"\"}${rangeOperator}${opt.to || \"\"}`);\n }\n if (filterString(opt.file)) {\n command.push(\"--follow\", pathspec2(opt.file));\n }\n appendTaskOptions(userOptions(opt), command);\n return {\n fields,\n splitter,\n commands: [...command, ...suffix]\n };\n}\nfunction logTask(splitter, fields, customArgs) {\n const parser4 = createListLogSummaryParser(splitter, fields, logFormatFromCommand(customArgs));\n return {\n commands: [\"log\", ...customArgs],\n format: \"utf-8\",\n parser: parser4\n };\n}\nfunction log_default() {\n return {\n log(...rest) {\n const next = trailingFunctionArgument(arguments);\n const options = parseLogOptions(\n trailingOptionsArgument(arguments),\n asStringArray(filterType(arguments[0], filterArray, []))\n );\n const task = rejectDeprecatedSignatures(...rest) || validateLogFormatConfig(options.commands) || createLogTask(options);\n return this._runTask(task, next);\n }\n };\n function createLogTask(options) {\n return logTask(options.splitter, options.fields, options.commands);\n }\n function rejectDeprecatedSignatures(from, to) {\n return filterString(from) && filterString(to) && configurationErrorTask(\n `git.log(string, string) should be replaced with git.log({ from: string, to: string })`\n );\n }\n}\nvar excludeOptions;\nvar init_log = __esm({\n \"src/lib/tasks/log.ts\"() {\n \"use strict\";\n init_log_format();\n init_parse_list_log_summary();\n init_utils();\n init_task();\n init_diff();\n excludeOptions = /* @__PURE__ */ ((excludeOptions2) => {\n excludeOptions2[excludeOptions2[\"--pretty\"] = 0] = \"--pretty\";\n excludeOptions2[excludeOptions2[\"max-count\"] = 1] = \"max-count\";\n excludeOptions2[excludeOptions2[\"maxCount\"] = 2] = \"maxCount\";\n excludeOptions2[excludeOptions2[\"n\"] = 3] = \"n\";\n excludeOptions2[excludeOptions2[\"file\"] = 4] = \"file\";\n excludeOptions2[excludeOptions2[\"format\"] = 5] = \"format\";\n excludeOptions2[excludeOptions2[\"from\"] = 6] = \"from\";\n excludeOptions2[excludeOptions2[\"to\"] = 7] = \"to\";\n excludeOptions2[excludeOptions2[\"splitter\"] = 8] = \"splitter\";\n excludeOptions2[excludeOptions2[\"symmetric\"] = 9] = \"symmetric\";\n excludeOptions2[excludeOptions2[\"mailMap\"] = 10] = \"mailMap\";\n excludeOptions2[excludeOptions2[\"multiLine\"] = 11] = \"multiLine\";\n excludeOptions2[excludeOptions2[\"strictDate\"] = 12] = \"strictDate\";\n return excludeOptions2;\n })(excludeOptions || {});\n }\n});\n\n// src/lib/responses/MergeSummary.ts\nvar MergeSummaryConflict, MergeSummaryDetail;\nvar init_MergeSummary = __esm({\n \"src/lib/responses/MergeSummary.ts\"() {\n \"use strict\";\n MergeSummaryConflict = class {\n constructor(reason, file = null, meta) {\n this.reason = reason;\n this.file = file;\n this.meta = meta;\n }\n toString() {\n return `${this.file}:${this.reason}`;\n }\n };\n MergeSummaryDetail = class {\n constructor() {\n this.conflicts = [];\n this.merges = [];\n this.result = \"success\";\n }\n get failed() {\n return this.conflicts.length > 0;\n }\n get reason() {\n return this.result;\n }\n toString() {\n if (this.conflicts.length) {\n return `CONFLICTS: ${this.conflicts.join(\", \")}`;\n }\n return \"OK\";\n }\n };\n }\n});\n\n// src/lib/responses/PullSummary.ts\nvar PullSummary, PullFailedSummary;\nvar init_PullSummary = __esm({\n \"src/lib/responses/PullSummary.ts\"() {\n \"use strict\";\n PullSummary = class {\n constructor() {\n this.remoteMessages = {\n all: []\n };\n this.created = [];\n this.deleted = [];\n this.files = [];\n this.deletions = {};\n this.insertions = {};\n this.summary = {\n changes: 0,\n deletions: 0,\n insertions: 0\n };\n }\n };\n PullFailedSummary = class {\n constructor() {\n this.remote = \"\";\n this.hash = {\n local: \"\",\n remote: \"\"\n };\n this.branch = {\n local: \"\",\n remote: \"\"\n };\n this.message = \"\";\n }\n toString() {\n return this.message;\n }\n };\n }\n});\n\n// src/lib/parsers/parse-remote-objects.ts\nfunction objectEnumerationResult(remoteMessages) {\n return remoteMessages.objects = remoteMessages.objects || {\n compressing: 0,\n counting: 0,\n enumerating: 0,\n packReused: 0,\n reused: { count: 0, delta: 0 },\n total: { count: 0, delta: 0 }\n };\n}\nfunction asObjectCount(source) {\n const count = /^\\s*(\\d+)/.exec(source);\n const delta = /delta (\\d+)/i.exec(source);\n return {\n count: asNumber(count && count[1] || \"0\"),\n delta: asNumber(delta && delta[1] || \"0\")\n };\n}\nvar remoteMessagesObjectParsers;\nvar init_parse_remote_objects = __esm({\n \"src/lib/parsers/parse-remote-objects.ts\"() {\n \"use strict\";\n init_utils();\n remoteMessagesObjectParsers = [\n new RemoteLineParser(\n /^remote:\\s*(enumerating|counting|compressing) objects: (\\d+),/i,\n (result, [action, count]) => {\n const key = action.toLowerCase();\n const enumeration = objectEnumerationResult(result.remoteMessages);\n Object.assign(enumeration, { [key]: asNumber(count) });\n }\n ),\n new RemoteLineParser(\n /^remote:\\s*(enumerating|counting|compressing) objects: \\d+% \\(\\d+\\/(\\d+)\\),/i,\n (result, [action, count]) => {\n const key = action.toLowerCase();\n const enumeration = objectEnumerationResult(result.remoteMessages);\n Object.assign(enumeration, { [key]: asNumber(count) });\n }\n ),\n new RemoteLineParser(\n /total ([^,]+), reused ([^,]+), pack-reused (\\d+)/i,\n (result, [total, reused, packReused]) => {\n const objects = objectEnumerationResult(result.remoteMessages);\n objects.total = asObjectCount(total);\n objects.reused = asObjectCount(reused);\n objects.packReused = asNumber(packReused);\n }\n )\n ];\n }\n});\n\n// src/lib/parsers/parse-remote-messages.ts\nfunction parseRemoteMessages(_stdOut, stdErr) {\n return parseStringResponse({ remoteMessages: new RemoteMessageSummary() }, parsers2, stdErr);\n}\nvar parsers2, RemoteMessageSummary;\nvar init_parse_remote_messages = __esm({\n \"src/lib/parsers/parse-remote-messages.ts\"() {\n \"use strict\";\n init_utils();\n init_parse_remote_objects();\n parsers2 = [\n new RemoteLineParser(/^remote:\\s*(.+)$/, (result, [text]) => {\n result.remoteMessages.all.push(text.trim());\n return false;\n }),\n ...remoteMessagesObjectParsers,\n new RemoteLineParser(\n [/create a (?:pull|merge) request/i, /\\s(https?:\\/\\/\\S+)$/],\n (result, [pullRequestUrl]) => {\n result.remoteMessages.pullRequestUrl = pullRequestUrl;\n }\n ),\n new RemoteLineParser(\n [/found (\\d+) vulnerabilities.+\\(([^)]+)\\)/i, /\\s(https?:\\/\\/\\S+)$/],\n (result, [count, summary, url]) => {\n result.remoteMessages.vulnerabilities = {\n count: asNumber(count),\n summary,\n url\n };\n }\n )\n ];\n RemoteMessageSummary = class {\n constructor() {\n this.all = [];\n }\n };\n }\n});\n\n// src/lib/parsers/parse-pull.ts\nfunction parsePullErrorResult(stdOut, stdErr) {\n const pullError = parseStringResponse(new PullFailedSummary(), errorParsers, [stdOut, stdErr]);\n return pullError.message && pullError;\n}\nvar FILE_UPDATE_REGEX, SUMMARY_REGEX, ACTION_REGEX, parsers3, errorParsers, parsePullDetail, parsePullResult;\nvar init_parse_pull = __esm({\n \"src/lib/parsers/parse-pull.ts\"() {\n \"use strict\";\n init_PullSummary();\n init_utils();\n init_parse_remote_messages();\n FILE_UPDATE_REGEX = /^\\s*(.+?)\\s+\\|\\s+\\d+\\s*(\\+*)(-*)/;\n SUMMARY_REGEX = /(\\d+)\\D+((\\d+)\\D+\\(\\+\\))?(\\D+(\\d+)\\D+\\(-\\))?/;\n ACTION_REGEX = /^(create|delete) mode \\d+ (.+)/;\n parsers3 = [\n new LineParser(FILE_UPDATE_REGEX, (result, [file, insertions, deletions]) => {\n result.files.push(file);\n if (insertions) {\n result.insertions[file] = insertions.length;\n }\n if (deletions) {\n result.deletions[file] = deletions.length;\n }\n }),\n new LineParser(SUMMARY_REGEX, (result, [changes, , insertions, , deletions]) => {\n if (insertions !== void 0 || deletions !== void 0) {\n result.summary.changes = +changes || 0;\n result.summary.insertions = +insertions || 0;\n result.summary.deletions = +deletions || 0;\n return true;\n }\n return false;\n }),\n new LineParser(ACTION_REGEX, (result, [action, file]) => {\n append(result.files, file);\n append(action === \"create\" ? result.created : result.deleted, file);\n })\n ];\n errorParsers = [\n new LineParser(/^from\\s(.+)$/i, (result, [remote]) => void (result.remote = remote)),\n new LineParser(/^fatal:\\s(.+)$/, (result, [message]) => void (result.message = message)),\n new LineParser(\n /([a-z0-9]+)\\.\\.([a-z0-9]+)\\s+(\\S+)\\s+->\\s+(\\S+)$/,\n (result, [hashLocal, hashRemote, branchLocal, branchRemote]) => {\n result.branch.local = branchLocal;\n result.hash.local = hashLocal;\n result.branch.remote = branchRemote;\n result.hash.remote = hashRemote;\n }\n )\n ];\n parsePullDetail = (stdOut, stdErr) => {\n return parseStringResponse(new PullSummary(), parsers3, [stdOut, stdErr]);\n };\n parsePullResult = (stdOut, stdErr) => {\n return Object.assign(\n new PullSummary(),\n parsePullDetail(stdOut, stdErr),\n parseRemoteMessages(stdOut, stdErr)\n );\n };\n }\n});\n\n// src/lib/parsers/parse-merge.ts\nvar parsers4, parseMergeResult, parseMergeDetail;\nvar init_parse_merge = __esm({\n \"src/lib/parsers/parse-merge.ts\"() {\n \"use strict\";\n init_MergeSummary();\n init_utils();\n init_parse_pull();\n parsers4 = [\n new LineParser(/^Auto-merging\\s+(.+)$/, (summary, [autoMerge]) => {\n summary.merges.push(autoMerge);\n }),\n new LineParser(/^CONFLICT\\s+\\((.+)\\): Merge conflict in (.+)$/, (summary, [reason, file]) => {\n summary.conflicts.push(new MergeSummaryConflict(reason, file));\n }),\n new LineParser(\n /^CONFLICT\\s+\\((.+\\/delete)\\): (.+) deleted in (.+) and/,\n (summary, [reason, file, deleteRef]) => {\n summary.conflicts.push(new MergeSummaryConflict(reason, file, { deleteRef }));\n }\n ),\n new LineParser(/^CONFLICT\\s+\\((.+)\\):/, (summary, [reason]) => {\n summary.conflicts.push(new MergeSummaryConflict(reason, null));\n }),\n new LineParser(/^Automatic merge failed;\\s+(.+)$/, (summary, [result]) => {\n summary.result = result;\n })\n ];\n parseMergeResult = (stdOut, stdErr) => {\n return Object.assign(parseMergeDetail(stdOut, stdErr), parsePullResult(stdOut, stdErr));\n };\n parseMergeDetail = (stdOut) => {\n return parseStringResponse(new MergeSummaryDetail(), parsers4, stdOut);\n };\n }\n});\n\n// src/lib/tasks/merge.ts\nfunction mergeTask(customArgs) {\n if (!customArgs.length) {\n return configurationErrorTask(\"Git.merge requires at least one option\");\n }\n return {\n commands: [\"merge\", ...customArgs],\n format: \"utf-8\",\n parser(stdOut, stdErr) {\n const merge = parseMergeResult(stdOut, stdErr);\n if (merge.failed) {\n throw new GitResponseError(merge);\n }\n return merge;\n }\n };\n}\nvar init_merge = __esm({\n \"src/lib/tasks/merge.ts\"() {\n \"use strict\";\n init_git_response_error();\n init_parse_merge();\n init_task();\n }\n});\n\n// src/lib/parsers/parse-push.ts\nfunction pushResultPushedItem(local, remote, status) {\n const deleted = status.includes(\"deleted\");\n const tag = status.includes(\"tag\") || /^refs\\/tags/.test(local);\n const alreadyUpdated = !status.includes(\"new\");\n return {\n deleted,\n tag,\n branch: !tag,\n new: !alreadyUpdated,\n alreadyUpdated,\n local,\n remote\n };\n}\nvar parsers5, parsePushResult, parsePushDetail;\nvar init_parse_push = __esm({\n \"src/lib/parsers/parse-push.ts\"() {\n \"use strict\";\n init_utils();\n init_parse_remote_messages();\n parsers5 = [\n new LineParser(/^Pushing to (.+)$/, (result, [repo]) => {\n result.repo = repo;\n }),\n new LineParser(/^updating local tracking ref '(.+)'/, (result, [local]) => {\n result.ref = {\n ...result.ref || {},\n local\n };\n }),\n new LineParser(/^[=*-]\\s+([^:]+):(\\S+)\\s+\\[(.+)]$/, (result, [local, remote, type]) => {\n result.pushed.push(pushResultPushedItem(local, remote, type));\n }),\n new LineParser(\n /^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,\n (result, [local, remote, remoteName]) => {\n result.branch = {\n ...result.branch || {},\n local,\n remote,\n remoteName\n };\n }\n ),\n new LineParser(\n /^([^:]+):(\\S+)\\s+([a-z0-9]+)\\.\\.([a-z0-9]+)$/,\n (result, [local, remote, from, to]) => {\n result.update = {\n head: {\n local,\n remote\n },\n hash: {\n from,\n to\n }\n };\n }\n )\n ];\n parsePushResult = (stdOut, stdErr) => {\n const pushDetail = parsePushDetail(stdOut, stdErr);\n const responseDetail = parseRemoteMessages(stdOut, stdErr);\n return {\n ...pushDetail,\n ...responseDetail\n };\n };\n parsePushDetail = (stdOut, stdErr) => {\n return parseStringResponse({ pushed: [] }, parsers5, [stdOut, stdErr]);\n };\n }\n});\n\n// src/lib/tasks/push.ts\nvar push_exports = {};\n__export(push_exports, {\n pushTagsTask: () => pushTagsTask,\n pushTask: () => pushTask\n});\nfunction pushTagsTask(ref = {}, customArgs) {\n append(customArgs, \"--tags\");\n return pushTask(ref, customArgs);\n}\nfunction pushTask(ref = {}, customArgs) {\n const commands = [\"push\", ...customArgs];\n if (ref.branch) {\n commands.splice(1, 0, ref.branch);\n }\n if (ref.remote) {\n commands.splice(1, 0, ref.remote);\n }\n remove(commands, \"-v\");\n append(commands, \"--verbose\");\n append(commands, \"--porcelain\");\n return {\n commands,\n format: \"utf-8\",\n parser: parsePushResult\n };\n}\nvar init_push = __esm({\n \"src/lib/tasks/push.ts\"() {\n \"use strict\";\n init_parse_push();\n init_utils();\n }\n});\n\n// src/lib/tasks/show.ts\nfunction show_default() {\n return {\n showBuffer() {\n const commands = [\"show\", ...getTrailingOptions(arguments, 1)];\n if (!commands.includes(\"--binary\")) {\n commands.splice(1, 0, \"--binary\");\n }\n return this._runTask(\n straightThroughBufferTask(commands),\n trailingFunctionArgument(arguments)\n );\n },\n show() {\n const commands = [\"show\", ...getTrailingOptions(arguments, 1)];\n return this._runTask(\n straightThroughStringTask(commands),\n trailingFunctionArgument(arguments)\n );\n }\n };\n}\nvar init_show = __esm({\n \"src/lib/tasks/show.ts\"() {\n \"use strict\";\n init_utils();\n init_task();\n }\n});\n\n// src/lib/responses/FileStatusSummary.ts\nvar fromPathRegex, FileStatusSummary;\nvar init_FileStatusSummary = __esm({\n \"src/lib/responses/FileStatusSummary.ts\"() {\n \"use strict\";\n fromPathRegex = /^(.+)\\0(.+)$/;\n FileStatusSummary = class {\n constructor(path, index, working_dir) {\n this.path = path;\n this.index = index;\n this.working_dir = working_dir;\n if (index === \"R\" || working_dir === \"R\") {\n const detail = fromPathRegex.exec(path) || [null, path, path];\n this.from = detail[2] || \"\";\n this.path = detail[1] || \"\";\n }\n }\n };\n }\n});\n\n// src/lib/responses/StatusSummary.ts\nfunction renamedFile(line) {\n const [to, from] = line.split(NULL);\n return {\n from: from || to,\n to\n };\n}\nfunction parser3(indexX, indexY, handler) {\n return [`${indexX}${indexY}`, handler];\n}\nfunction conflicts(indexX, ...indexY) {\n return indexY.map((y) => parser3(indexX, y, (result, file) => result.conflicted.push(file)));\n}\nfunction splitLine(result, lineStr) {\n const trimmed2 = lineStr.trim();\n switch (\" \") {\n case trimmed2.charAt(2):\n return data(trimmed2.charAt(0), trimmed2.charAt(1), trimmed2.slice(3));\n case trimmed2.charAt(1):\n return data(\" \" /* NONE */, trimmed2.charAt(0), trimmed2.slice(2));\n default:\n return;\n }\n function data(index, workingDir, path) {\n const raw = `${index}${workingDir}`;\n const handler = parsers6.get(raw);\n if (handler) {\n handler(result, path);\n }\n if (raw !== \"##\" && raw !== \"!!\") {\n result.files.push(new FileStatusSummary(path, index, workingDir));\n }\n }\n}\nvar StatusSummary, parsers6, parseStatusSummary;\nvar init_StatusSummary = __esm({\n \"src/lib/responses/StatusSummary.ts\"() {\n \"use strict\";\n init_utils();\n init_FileStatusSummary();\n StatusSummary = class {\n constructor() {\n this.not_added = [];\n this.conflicted = [];\n this.created = [];\n this.deleted = [];\n this.ignored = void 0;\n this.modified = [];\n this.renamed = [];\n this.files = [];\n this.staged = [];\n this.ahead = 0;\n this.behind = 0;\n this.current = null;\n this.tracking = null;\n this.detached = false;\n this.isClean = () => {\n return !this.files.length;\n };\n }\n };\n parsers6 = new Map([\n parser3(\n \" \" /* NONE */,\n \"A\" /* ADDED */,\n (result, file) => result.created.push(file)\n ),\n parser3(\n \" \" /* NONE */,\n \"D\" /* DELETED */,\n (result, file) => result.deleted.push(file)\n ),\n parser3(\n \" \" /* NONE */,\n \"M\" /* MODIFIED */,\n (result, file) => result.modified.push(file)\n ),\n parser3(\"A\" /* ADDED */, \" \" /* NONE */, (result, file) => {\n result.created.push(file);\n result.staged.push(file);\n }),\n parser3(\"A\" /* ADDED */, \"M\" /* MODIFIED */, (result, file) => {\n result.created.push(file);\n result.staged.push(file);\n result.modified.push(file);\n }),\n parser3(\"D\" /* DELETED */, \" \" /* NONE */, (result, file) => {\n result.deleted.push(file);\n result.staged.push(file);\n }),\n parser3(\"M\" /* MODIFIED */, \" \" /* NONE */, (result, file) => {\n result.modified.push(file);\n result.staged.push(file);\n }),\n parser3(\"M\" /* MODIFIED */, \"M\" /* MODIFIED */, (result, file) => {\n result.modified.push(file);\n result.staged.push(file);\n }),\n parser3(\"R\" /* RENAMED */, \" \" /* NONE */, (result, file) => {\n result.renamed.push(renamedFile(file));\n }),\n parser3(\"R\" /* RENAMED */, \"M\" /* MODIFIED */, (result, file) => {\n const renamed = renamedFile(file);\n result.renamed.push(renamed);\n result.modified.push(renamed.to);\n }),\n parser3(\"!\" /* IGNORED */, \"!\" /* IGNORED */, (_result, _file) => {\n (_result.ignored = _result.ignored || []).push(_file);\n }),\n parser3(\n \"?\" /* UNTRACKED */,\n \"?\" /* UNTRACKED */,\n (result, file) => result.not_added.push(file)\n ),\n ...conflicts(\"A\" /* ADDED */, \"A\" /* ADDED */, \"U\" /* UNMERGED */),\n ...conflicts(\n \"D\" /* DELETED */,\n \"D\" /* DELETED */,\n \"U\" /* UNMERGED */\n ),\n ...conflicts(\n \"U\" /* UNMERGED */,\n \"A\" /* ADDED */,\n \"D\" /* DELETED */,\n \"U\" /* UNMERGED */\n ),\n [\n \"##\",\n (result, line) => {\n const aheadReg = /ahead (\\d+)/;\n const behindReg = /behind (\\d+)/;\n const currentReg = /^(.+?(?=(?:\\.{3}|\\s|$)))/;\n const trackingReg = /\\.{3}(\\S*)/;\n const onEmptyBranchReg = /\\son\\s(\\S+?)(?=\\.{3}|$)/;\n let regexResult = aheadReg.exec(line);\n result.ahead = regexResult && +regexResult[1] || 0;\n regexResult = behindReg.exec(line);\n result.behind = regexResult && +regexResult[1] || 0;\n regexResult = currentReg.exec(line);\n result.current = filterType(regexResult?.[1], filterString, null);\n regexResult = trackingReg.exec(line);\n result.tracking = filterType(regexResult?.[1], filterString, null);\n regexResult = onEmptyBranchReg.exec(line);\n if (regexResult) {\n result.current = filterType(regexResult?.[1], filterString, result.current);\n }\n result.detached = /\\(no branch\\)/.test(line);\n }\n ]\n ]);\n parseStatusSummary = function(text) {\n const lines = text.split(NULL);\n const status = new StatusSummary();\n for (let i = 0, l = lines.length; i < l; ) {\n let line = lines[i++].trim();\n if (!line) {\n continue;\n }\n if (line.charAt(0) === \"R\" /* RENAMED */) {\n line += NULL + (lines[i++] || \"\");\n }\n splitLine(status, line);\n }\n return status;\n };\n }\n});\n\n// src/lib/tasks/status.ts\nfunction statusTask(customArgs) {\n const commands = [\n \"status\",\n \"--porcelain\",\n \"-b\",\n \"-u\",\n \"--null\",\n ...customArgs.filter((arg) => !ignoredOptions.includes(arg))\n ];\n return {\n format: \"utf-8\",\n commands,\n parser(text) {\n return parseStatusSummary(text);\n }\n };\n}\nvar ignoredOptions;\nvar init_status = __esm({\n \"src/lib/tasks/status.ts\"() {\n \"use strict\";\n init_StatusSummary();\n ignoredOptions = [\"--null\", \"-z\"];\n }\n});\n\n// src/lib/tasks/version.ts\nfunction versionResponse(major = 0, minor = 0, patch = 0, agent = \"\", installed = true) {\n return Object.defineProperty(\n {\n major,\n minor,\n patch,\n agent,\n installed\n },\n \"toString\",\n {\n value() {\n return `${this.major}.${this.minor}.${this.patch}`;\n },\n configurable: false,\n enumerable: false\n }\n );\n}\nfunction notInstalledResponse() {\n return versionResponse(0, 0, 0, \"\", false);\n}\nfunction version_default() {\n return {\n version() {\n return this._runTask({\n commands: [\"--version\"],\n format: \"utf-8\",\n parser: versionParser,\n onError(result, error, done, fail) {\n if (result.exitCode === -2 /* NOT_FOUND */) {\n return done(Buffer.from(NOT_INSTALLED));\n }\n fail(error);\n }\n });\n }\n };\n}\nfunction versionParser(stdOut) {\n if (stdOut === NOT_INSTALLED) {\n return notInstalledResponse();\n }\n return parseStringResponse(versionResponse(0, 0, 0, stdOut), parsers7, stdOut);\n}\nvar NOT_INSTALLED, parsers7;\nvar init_version = __esm({\n \"src/lib/tasks/version.ts\"() {\n \"use strict\";\n init_utils();\n NOT_INSTALLED = \"installed=false\";\n parsers7 = [\n new LineParser(\n /version (\\d+)\\.(\\d+)\\.(\\d+)(?:\\s*\\((.+)\\))?/,\n (result, [major, minor, patch, agent = \"\"]) => {\n Object.assign(\n result,\n versionResponse(asNumber(major), asNumber(minor), asNumber(patch), agent)\n );\n }\n ),\n new LineParser(\n /version (\\d+)\\.(\\d+)\\.(\\D+)(.+)?$/,\n (result, [major, minor, patch, agent = \"\"]) => {\n Object.assign(result, versionResponse(asNumber(major), asNumber(minor), patch, agent));\n }\n )\n ];\n }\n});\n\n// src/lib/tasks/clone.ts\nimport { pathspec as pathspec3 } from \"@simple-git/args-pathspec\";\nfunction createCloneTask(api, task, repoPath, ...args) {\n if (!filterString(repoPath)) {\n return configurationErrorTask(`git.${api}() requires a string 'repoPath'`);\n }\n return task(repoPath, filterType(args[0], filterString), getTrailingOptions(arguments));\n}\nfunction clone_default() {\n return {\n clone(repo, ...rest) {\n return this._runTask(\n createCloneTask(\"clone\", cloneTask, filterType(repo, filterString), ...rest),\n trailingFunctionArgument(arguments)\n );\n },\n mirror(repo, ...rest) {\n return this._runTask(\n createCloneTask(\"mirror\", cloneMirrorTask, filterType(repo, filterString), ...rest),\n trailingFunctionArgument(arguments)\n );\n }\n };\n}\nvar cloneTask, cloneMirrorTask;\nvar init_clone = __esm({\n \"src/lib/tasks/clone.ts\"() {\n \"use strict\";\n init_task();\n init_utils();\n cloneTask = (repo, directory, customArgs) => {\n const commands = [\"clone\", ...customArgs];\n filterString(repo) && commands.push(pathspec3(repo));\n filterString(directory) && commands.push(pathspec3(directory));\n return straightThroughStringTask(commands);\n };\n cloneMirrorTask = (repo, directory, customArgs) => {\n append(customArgs, \"--mirror\");\n return cloneTask(repo, directory, customArgs);\n };\n }\n});\n\n// src/lib/simple-git-api.ts\nvar simple_git_api_exports = {};\n__export(simple_git_api_exports, {\n SimpleGitApi: () => SimpleGitApi\n});\nvar SimpleGitApi;\nvar init_simple_git_api = __esm({\n \"src/lib/simple-git-api.ts\"() {\n \"use strict\";\n init_task_callback();\n init_change_working_directory();\n init_checkout();\n init_count_objects();\n init_commit();\n init_config();\n init_first_commit();\n init_grep();\n init_hash_object();\n init_init();\n init_log();\n init_merge();\n init_push();\n init_show();\n init_status();\n init_task();\n init_version();\n init_utils();\n init_clone();\n SimpleGitApi = class {\n constructor(_executor) {\n this._executor = _executor;\n }\n _runTask(task, then) {\n const chain = this._executor.chain();\n const promise = chain.push(task);\n if (then) {\n taskCallback(task, promise, then);\n }\n return Object.create(this, {\n then: { value: promise.then.bind(promise) },\n catch: { value: promise.catch.bind(promise) },\n _executor: { value: chain }\n });\n }\n add(files) {\n return this._runTask(\n straightThroughStringTask([\"add\", ...asArray(files)]),\n trailingFunctionArgument(arguments)\n );\n }\n cwd(directory) {\n const next = trailingFunctionArgument(arguments);\n if (typeof directory === \"string\") {\n return this._runTask(changeWorkingDirectoryTask(directory, this._executor), next);\n }\n if (typeof directory?.path === \"string\") {\n return this._runTask(\n changeWorkingDirectoryTask(\n directory.path,\n directory.root && this._executor || void 0\n ),\n next\n );\n }\n return this._runTask(\n configurationErrorTask(\"Git.cwd: workingDirectory must be supplied as a string\"),\n next\n );\n }\n hashObject(path, write) {\n return this._runTask(\n hashObjectTask(path, write === true),\n trailingFunctionArgument(arguments)\n );\n }\n init(bare) {\n return this._runTask(\n initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments)\n );\n }\n merge() {\n return this._runTask(\n mergeTask(getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments)\n );\n }\n mergeFromTo(remote, branch) {\n if (!(filterString(remote) && filterString(branch))) {\n return this._runTask(\n configurationErrorTask(\n `Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`\n )\n );\n }\n return this._runTask(\n mergeTask([remote, branch, ...getTrailingOptions(arguments)]),\n trailingFunctionArgument(arguments, false)\n );\n }\n outputHandler(handler) {\n this._executor.outputHandler = handler;\n return this;\n }\n push() {\n const task = pushTask(\n {\n remote: filterType(arguments[0], filterString),\n branch: filterType(arguments[1], filterString)\n },\n getTrailingOptions(arguments)\n );\n return this._runTask(task, trailingFunctionArgument(arguments));\n }\n stash() {\n return this._runTask(\n straightThroughStringTask([\"stash\", ...getTrailingOptions(arguments)]),\n trailingFunctionArgument(arguments)\n );\n }\n status() {\n return this._runTask(\n statusTask(getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments)\n );\n }\n };\n Object.assign(\n SimpleGitApi.prototype,\n checkout_default(),\n clone_default(),\n commit_default(),\n config_default(),\n count_objects_default(),\n first_commit_default(),\n grep_default(),\n log_default(),\n show_default(),\n version_default()\n );\n }\n});\n\n// src/lib/runners/scheduler.ts\nvar scheduler_exports = {};\n__export(scheduler_exports, {\n Scheduler: () => Scheduler\n});\nimport { createDeferred } from \"@kwsites/promise-deferred\";\nvar createScheduledTask, Scheduler;\nvar init_scheduler = __esm({\n \"src/lib/runners/scheduler.ts\"() {\n \"use strict\";\n init_utils();\n init_git_logger();\n createScheduledTask = /* @__PURE__ */ (() => {\n let id = 0;\n return () => {\n id++;\n const { promise, done } = createDeferred();\n return {\n promise,\n done,\n id\n };\n };\n })();\n Scheduler = class {\n constructor(concurrency = 2) {\n this.concurrency = concurrency;\n this.logger = createLogger(\"\", \"scheduler\");\n this.pending = [];\n this.running = [];\n this.logger(`Constructed, concurrency=%s`, concurrency);\n }\n schedule() {\n if (!this.pending.length || this.running.length >= this.concurrency) {\n this.logger(\n `Schedule attempt ignored, pending=%s running=%s concurrency=%s`,\n this.pending.length,\n this.running.length,\n this.concurrency\n );\n return;\n }\n const task = append(this.running, this.pending.shift());\n this.logger(`Attempting id=%s`, task.id);\n task.done(() => {\n this.logger(`Completing id=`, task.id);\n remove(this.running, task);\n this.schedule();\n });\n }\n next() {\n const { promise, id } = append(this.pending, createScheduledTask());\n this.logger(`Scheduling id=%s`, id);\n this.schedule();\n return promise;\n }\n };\n }\n});\n\n// src/lib/tasks/apply-patch.ts\nvar apply_patch_exports = {};\n__export(apply_patch_exports, {\n applyPatchTask: () => applyPatchTask\n});\nfunction applyPatchTask(patches, customArgs) {\n return straightThroughStringTask([\"apply\", ...customArgs, ...patches]);\n}\nvar init_apply_patch = __esm({\n \"src/lib/tasks/apply-patch.ts\"() {\n \"use strict\";\n init_task();\n }\n});\n\n// src/lib/responses/BranchDeleteSummary.ts\nfunction branchDeletionSuccess(branch, hash) {\n return {\n branch,\n hash,\n success: true\n };\n}\nfunction branchDeletionFailure(branch) {\n return {\n branch,\n hash: null,\n success: false\n };\n}\nvar BranchDeletionBatch;\nvar init_BranchDeleteSummary = __esm({\n \"src/lib/responses/BranchDeleteSummary.ts\"() {\n \"use strict\";\n BranchDeletionBatch = class {\n constructor() {\n this.all = [];\n this.branches = {};\n this.errors = [];\n }\n get success() {\n return !this.errors.length;\n }\n };\n }\n});\n\n// src/lib/parsers/parse-branch-delete.ts\nfunction hasBranchDeletionError(data, processExitCode) {\n return processExitCode === 1 /* ERROR */ && deleteErrorRegex.test(data);\n}\nvar deleteSuccessRegex, deleteErrorRegex, parsers8, parseBranchDeletions;\nvar init_parse_branch_delete = __esm({\n \"src/lib/parsers/parse-branch-delete.ts\"() {\n \"use strict\";\n init_BranchDeleteSummary();\n init_utils();\n deleteSuccessRegex = /(\\S+)\\s+\\(\\S+\\s([^)]+)\\)/;\n deleteErrorRegex = /^error[^']+'([^']+)'/m;\n parsers8 = [\n new LineParser(deleteSuccessRegex, (result, [branch, hash]) => {\n const deletion = branchDeletionSuccess(branch, hash);\n result.all.push(deletion);\n result.branches[branch] = deletion;\n }),\n new LineParser(deleteErrorRegex, (result, [branch]) => {\n const deletion = branchDeletionFailure(branch);\n result.errors.push(deletion);\n result.all.push(deletion);\n result.branches[branch] = deletion;\n })\n ];\n parseBranchDeletions = (stdOut, stdErr) => {\n return parseStringResponse(new BranchDeletionBatch(), parsers8, [stdOut, stdErr]);\n };\n }\n});\n\n// src/lib/responses/BranchSummary.ts\nvar BranchSummaryResult;\nvar init_BranchSummary = __esm({\n \"src/lib/responses/BranchSummary.ts\"() {\n \"use strict\";\n BranchSummaryResult = class {\n constructor() {\n this.all = [];\n this.branches = {};\n this.current = \"\";\n this.detached = false;\n }\n push(status, detached, name, commit, label) {\n if (status === \"*\" /* CURRENT */) {\n this.detached = detached;\n this.current = name;\n }\n this.all.push(name);\n this.branches[name] = {\n current: status === \"*\" /* CURRENT */,\n linkedWorkTree: status === \"+\" /* LINKED */,\n name,\n commit,\n label\n };\n }\n };\n }\n});\n\n// src/lib/parsers/parse-branch.ts\nfunction branchStatus(input) {\n return input ? input.charAt(0) : \"\";\n}\nfunction parseBranchSummary(stdOut, currentOnly = false) {\n return parseStringResponse(\n new BranchSummaryResult(),\n currentOnly ? [currentBranchParser] : parsers9,\n stdOut\n );\n}\nvar parsers9, currentBranchParser;\nvar init_parse_branch = __esm({\n \"src/lib/parsers/parse-branch.ts\"() {\n \"use strict\";\n init_BranchSummary();\n init_utils();\n parsers9 = [\n new LineParser(\n /^([*+]\\s)?\\((?:HEAD )?detached (?:from|at) (\\S+)\\)\\s+([a-z0-9]+)\\s(.*)$/,\n (result, [current, name, commit, label]) => {\n result.push(branchStatus(current), true, name, commit, label);\n }\n ),\n new LineParser(\n /^([*+]\\s)?(\\S+)\\s+([a-z0-9]+)\\s?(.*)$/s,\n (result, [current, name, commit, label]) => {\n result.push(branchStatus(current), false, name, commit, label);\n }\n )\n ];\n currentBranchParser = new LineParser(/^(\\S+)$/s, (result, [name]) => {\n result.push(\"*\" /* CURRENT */, false, name, \"\", \"\");\n });\n }\n});\n\n// src/lib/tasks/branch.ts\nvar branch_exports = {};\n__export(branch_exports, {\n branchLocalTask: () => branchLocalTask,\n branchTask: () => branchTask,\n containsDeleteBranchCommand: () => containsDeleteBranchCommand,\n deleteBranchTask: () => deleteBranchTask,\n deleteBranchesTask: () => deleteBranchesTask\n});\nfunction containsDeleteBranchCommand(commands) {\n const deleteCommands = [\"-d\", \"-D\", \"--delete\"];\n return commands.some((command) => deleteCommands.includes(command));\n}\nfunction branchTask(customArgs) {\n const isDelete = containsDeleteBranchCommand(customArgs);\n const isCurrentOnly = customArgs.includes(\"--show-current\");\n const commands = [\"branch\", ...customArgs];\n if (commands.length === 1) {\n commands.push(\"-a\");\n }\n if (!commands.includes(\"-v\")) {\n commands.splice(1, 0, \"-v\");\n }\n return {\n format: \"utf-8\",\n commands,\n parser(stdOut, stdErr) {\n if (isDelete) {\n return parseBranchDeletions(stdOut, stdErr).all[0];\n }\n return parseBranchSummary(stdOut, isCurrentOnly);\n }\n };\n}\nfunction branchLocalTask() {\n return {\n format: \"utf-8\",\n commands: [\"branch\", \"-v\"],\n parser(stdOut) {\n return parseBranchSummary(stdOut);\n }\n };\n}\nfunction deleteBranchesTask(branches, forceDelete = false) {\n return {\n format: \"utf-8\",\n commands: [\"branch\", \"-v\", forceDelete ? \"-D\" : \"-d\", ...branches],\n parser(stdOut, stdErr) {\n return parseBranchDeletions(stdOut, stdErr);\n },\n onError({ exitCode, stdOut }, error, done, fail) {\n if (!hasBranchDeletionError(String(error), exitCode)) {\n return fail(error);\n }\n done(stdOut);\n }\n };\n}\nfunction deleteBranchTask(branch, forceDelete = false) {\n const task = {\n format: \"utf-8\",\n commands: [\"branch\", \"-v\", forceDelete ? \"-D\" : \"-d\", branch],\n parser(stdOut, stdErr) {\n return parseBranchDeletions(stdOut, stdErr).branches[branch];\n },\n onError({ exitCode, stdErr, stdOut }, error, _, fail) {\n if (!hasBranchDeletionError(String(error), exitCode)) {\n return fail(error);\n }\n throw new GitResponseError(\n task.parser(bufferToString(stdOut), bufferToString(stdErr)),\n String(error)\n );\n }\n };\n return task;\n}\nvar init_branch = __esm({\n \"src/lib/tasks/branch.ts\"() {\n \"use strict\";\n init_git_response_error();\n init_parse_branch_delete();\n init_parse_branch();\n init_utils();\n }\n});\n\n// src/lib/responses/CheckIgnore.ts\nimport { normalize } from \"node:path\";\nfunction toPath(input) {\n const path = input.trim().replace(/^[\"']|[\"']$/g, \"\");\n return path && normalize(path);\n}\nvar parseCheckIgnore;\nvar init_CheckIgnore = __esm({\n \"src/lib/responses/CheckIgnore.ts\"() {\n \"use strict\";\n parseCheckIgnore = (text) => {\n return text.split(/\\n/g).map(toPath).filter(Boolean);\n };\n }\n});\n\n// src/lib/tasks/check-ignore.ts\nvar check_ignore_exports = {};\n__export(check_ignore_exports, {\n checkIgnoreTask: () => checkIgnoreTask\n});\nfunction checkIgnoreTask(paths) {\n return {\n commands: [\"check-ignore\", ...paths],\n format: \"utf-8\",\n parser: parseCheckIgnore\n };\n}\nvar init_check_ignore = __esm({\n \"src/lib/tasks/check-ignore.ts\"() {\n \"use strict\";\n init_CheckIgnore();\n }\n});\n\n// src/lib/parsers/parse-fetch.ts\nfunction parseFetchResult(stdOut, stdErr) {\n const result = {\n raw: stdOut,\n remote: null,\n branches: [],\n tags: [],\n updated: [],\n deleted: []\n };\n return parseStringResponse(result, parsers10, [stdOut, stdErr]);\n}\nvar parsers10;\nvar init_parse_fetch = __esm({\n \"src/lib/parsers/parse-fetch.ts\"() {\n \"use strict\";\n init_utils();\n parsers10 = [\n new LineParser(/From (.+)$/, (result, [remote]) => {\n result.remote = remote;\n }),\n new LineParser(/\\* \\[new branch]\\s+(\\S+)\\s*-> (.+)$/, (result, [name, tracking]) => {\n result.branches.push({\n name,\n tracking\n });\n }),\n new LineParser(/\\* \\[new tag]\\s+(\\S+)\\s*-> (.+)$/, (result, [name, tracking]) => {\n result.tags.push({\n name,\n tracking\n });\n }),\n new LineParser(/- \\[deleted]\\s+\\S+\\s*-> (.+)$/, (result, [tracking]) => {\n result.deleted.push({\n tracking\n });\n }),\n new LineParser(\n /\\s*([^.]+)\\.\\.(\\S+)\\s+(\\S+)\\s*-> (.+)$/,\n (result, [from, to, name, tracking]) => {\n result.updated.push({\n name,\n tracking,\n to,\n from\n });\n }\n )\n ];\n }\n});\n\n// src/lib/tasks/fetch.ts\nvar fetch_exports = {};\n__export(fetch_exports, {\n fetchTask: () => fetchTask\n});\nfunction disallowedCommand(command) {\n return /^--upload-pack(=|$)/.test(command);\n}\nfunction fetchTask(remote, branch, customArgs) {\n const commands = [\"fetch\", ...customArgs];\n if (remote && branch) {\n commands.push(remote, branch);\n }\n const banned = commands.find(disallowedCommand);\n if (banned) {\n return configurationErrorTask(`git.fetch: potential exploit argument blocked.`);\n }\n return {\n commands,\n format: \"utf-8\",\n parser: parseFetchResult\n };\n}\nvar init_fetch = __esm({\n \"src/lib/tasks/fetch.ts\"() {\n \"use strict\";\n init_parse_fetch();\n init_task();\n }\n});\n\n// src/lib/parsers/parse-move.ts\nfunction parseMoveResult(stdOut) {\n return parseStringResponse({ moves: [] }, parsers11, stdOut);\n}\nvar parsers11;\nvar init_parse_move = __esm({\n \"src/lib/parsers/parse-move.ts\"() {\n \"use strict\";\n init_utils();\n parsers11 = [\n new LineParser(/^Renaming (.+) to (.+)$/, (result, [from, to]) => {\n result.moves.push({ from, to });\n })\n ];\n }\n});\n\n// src/lib/tasks/move.ts\nvar move_exports = {};\n__export(move_exports, {\n moveTask: () => moveTask\n});\nfunction moveTask(from, to) {\n return {\n commands: [\"mv\", \"-v\", ...asArray(from), to],\n format: \"utf-8\",\n parser: parseMoveResult\n };\n}\nvar init_move = __esm({\n \"src/lib/tasks/move.ts\"() {\n \"use strict\";\n init_parse_move();\n init_utils();\n }\n});\n\n// src/lib/tasks/pull.ts\nvar pull_exports = {};\n__export(pull_exports, {\n pullTask: () => pullTask\n});\nfunction pullTask(remote, branch, customArgs) {\n const commands = [\"pull\", ...customArgs];\n if (remote && branch) {\n commands.splice(1, 0, remote, branch);\n }\n return {\n commands,\n format: \"utf-8\",\n parser(stdOut, stdErr) {\n return parsePullResult(stdOut, stdErr);\n },\n onError(result, _error, _done, fail) {\n const pullError = parsePullErrorResult(\n bufferToString(result.stdOut),\n bufferToString(result.stdErr)\n );\n if (pullError) {\n return fail(new GitResponseError(pullError));\n }\n fail(_error);\n }\n };\n}\nvar init_pull = __esm({\n \"src/lib/tasks/pull.ts\"() {\n \"use strict\";\n init_git_response_error();\n init_parse_pull();\n init_utils();\n }\n});\n\n// src/lib/responses/GetRemoteSummary.ts\nfunction parseGetRemotes(text) {\n const remotes = {};\n forEach(text, ([name]) => remotes[name] = { name });\n return Object.values(remotes);\n}\nfunction parseGetRemotesVerbose(text) {\n const remotes = {};\n forEach(text, ([name, url, purpose]) => {\n if (!Object.hasOwn(remotes, name)) {\n remotes[name] = {\n name,\n refs: { fetch: \"\", push: \"\" }\n };\n }\n if (purpose && url) {\n remotes[name].refs[purpose.replace(/[^a-z]/g, \"\")] = url;\n }\n });\n return Object.values(remotes);\n}\nfunction forEach(text, handler) {\n forEachLineWithContent(text, (line) => handler(line.split(/\\s+/)));\n}\nvar init_GetRemoteSummary = __esm({\n \"src/lib/responses/GetRemoteSummary.ts\"() {\n \"use strict\";\n init_utils();\n }\n});\n\n// src/lib/tasks/remote.ts\nvar remote_exports = {};\n__export(remote_exports, {\n addRemoteTask: () => addRemoteTask,\n getRemotesTask: () => getRemotesTask,\n listRemotesTask: () => listRemotesTask,\n remoteTask: () => remoteTask,\n removeRemoteTask: () => removeRemoteTask\n});\nfunction addRemoteTask(remoteName, remoteRepo, customArgs) {\n return straightThroughStringTask([\"remote\", \"add\", ...customArgs, remoteName, remoteRepo]);\n}\nfunction getRemotesTask(verbose) {\n const commands = [\"remote\"];\n if (verbose) {\n commands.push(\"-v\");\n }\n return {\n commands,\n format: \"utf-8\",\n parser: verbose ? parseGetRemotesVerbose : parseGetRemotes\n };\n}\nfunction listRemotesTask(customArgs) {\n const commands = [...customArgs];\n if (commands[0] !== \"ls-remote\") {\n commands.unshift(\"ls-remote\");\n }\n return straightThroughStringTask(commands);\n}\nfunction remoteTask(customArgs) {\n const commands = [...customArgs];\n if (commands[0] !== \"remote\") {\n commands.unshift(\"remote\");\n }\n return straightThroughStringTask(commands);\n}\nfunction removeRemoteTask(remoteName) {\n return straightThroughStringTask([\"remote\", \"remove\", remoteName]);\n}\nvar init_remote = __esm({\n \"src/lib/tasks/remote.ts\"() {\n \"use strict\";\n init_GetRemoteSummary();\n init_task();\n }\n});\n\n// src/lib/tasks/stash-list.ts\nvar stash_list_exports = {};\n__export(stash_list_exports, {\n stashListTask: () => stashListTask\n});\nfunction stashListTask(opt = {}, customArgs) {\n const options = parseLogOptions(opt);\n const commands = [\"stash\", \"list\", ...options.commands, ...customArgs];\n const parser4 = createListLogSummaryParser(\n options.splitter,\n options.fields,\n logFormatFromCommand(commands)\n );\n return validateLogFormatConfig(commands) || {\n commands,\n format: \"utf-8\",\n parser: parser4\n };\n}\nvar init_stash_list = __esm({\n \"src/lib/tasks/stash-list.ts\"() {\n \"use strict\";\n init_log_format();\n init_parse_list_log_summary();\n init_diff();\n init_log();\n }\n});\n\n// src/lib/tasks/sub-module.ts\nvar sub_module_exports = {};\n__export(sub_module_exports, {\n addSubModuleTask: () => addSubModuleTask,\n initSubModuleTask: () => initSubModuleTask,\n subModuleTask: () => subModuleTask,\n updateSubModuleTask: () => updateSubModuleTask\n});\nfunction addSubModuleTask(repo, path) {\n return subModuleTask([\"add\", repo, path]);\n}\nfunction initSubModuleTask(customArgs) {\n return subModuleTask([\"init\", ...customArgs]);\n}\nfunction subModuleTask(customArgs) {\n const commands = [...customArgs];\n if (commands[0] !== \"submodule\") {\n commands.unshift(\"submodule\");\n }\n return straightThroughStringTask(commands);\n}\nfunction updateSubModuleTask(customArgs) {\n return subModuleTask([\"update\", ...customArgs]);\n}\nvar init_sub_module = __esm({\n \"src/lib/tasks/sub-module.ts\"() {\n \"use strict\";\n init_task();\n }\n});\n\n// src/lib/responses/TagList.ts\nfunction singleSorted(a, b) {\n const aIsNum = Number.isNaN(a);\n const bIsNum = Number.isNaN(b);\n if (aIsNum !== bIsNum) {\n return aIsNum ? 1 : -1;\n }\n return aIsNum ? sorted(a, b) : 0;\n}\nfunction sorted(a, b) {\n return a === b ? 0 : a > b ? 1 : -1;\n}\nfunction trimmed(input) {\n return input.trim();\n}\nfunction toNumber(input) {\n if (typeof input === \"string\") {\n return parseInt(input.replace(/^\\D+/g, \"\"), 10) || 0;\n }\n return 0;\n}\nvar TagList, parseTagList;\nvar init_TagList = __esm({\n \"src/lib/responses/TagList.ts\"() {\n \"use strict\";\n TagList = class {\n constructor(all, latest) {\n this.all = all;\n this.latest = latest;\n }\n };\n parseTagList = function(data, customSort = false) {\n const tags = data.split(\"\\n\").map(trimmed).filter(Boolean);\n if (!customSort) {\n tags.sort(function(tagA, tagB) {\n const partsA = tagA.split(\".\");\n const partsB = tagB.split(\".\");\n if (partsA.length === 1 || partsB.length === 1) {\n return singleSorted(toNumber(partsA[0]), toNumber(partsB[0]));\n }\n for (let i = 0, l = Math.max(partsA.length, partsB.length); i < l; i++) {\n const diff = sorted(toNumber(partsA[i]), toNumber(partsB[i]));\n if (diff) {\n return diff;\n }\n }\n return 0;\n });\n }\n const latest = customSort ? tags[0] : [...tags].reverse().find((tag) => tag.indexOf(\".\") >= 0);\n return new TagList(tags, latest);\n };\n }\n});\n\n// src/lib/tasks/tag.ts\nvar tag_exports = {};\n__export(tag_exports, {\n addAnnotatedTagTask: () => addAnnotatedTagTask,\n addTagTask: () => addTagTask,\n tagListTask: () => tagListTask\n});\nfunction tagListTask(customArgs = []) {\n const hasCustomSort = customArgs.some((option) => /^--sort=/.test(option));\n return {\n format: \"utf-8\",\n commands: [\"tag\", \"-l\", ...customArgs],\n parser(text) {\n return parseTagList(text, hasCustomSort);\n }\n };\n}\nfunction addTagTask(name) {\n return {\n format: \"utf-8\",\n commands: [\"tag\", name],\n parser() {\n return { name };\n }\n };\n}\nfunction addAnnotatedTagTask(name, tagMessage) {\n return {\n format: \"utf-8\",\n commands: [\"tag\", \"-a\", \"-m\", tagMessage, name],\n parser() {\n return { name };\n }\n };\n}\nvar init_tag = __esm({\n \"src/lib/tasks/tag.ts\"() {\n \"use strict\";\n init_TagList();\n }\n});\n\n// src/git.js\nvar require_git = __commonJS({\n \"src/git.js\"(exports, module) {\n \"use strict\";\n var { GitExecutor: GitExecutor2 } = (init_git_executor(), __toCommonJS(git_executor_exports));\n var { SimpleGitApi: SimpleGitApi2 } = (init_simple_git_api(), __toCommonJS(simple_git_api_exports));\n var { Scheduler: Scheduler2 } = (init_scheduler(), __toCommonJS(scheduler_exports));\n var { adhocExecTask: adhocExecTask2, configurationErrorTask: configurationErrorTask2 } = (init_task(), __toCommonJS(task_exports));\n var {\n asArray: asArray2,\n filterArray: filterArray2,\n filterPrimitives: filterPrimitives2,\n filterString: filterString2,\n filterStringOrStringArray: filterStringOrStringArray2,\n filterType: filterType2,\n getTrailingOptions: getTrailingOptions2,\n trailingFunctionArgument: trailingFunctionArgument2,\n trailingOptionsArgument: trailingOptionsArgument2\n } = (init_utils(), __toCommonJS(utils_exports));\n var { applyPatchTask: applyPatchTask2 } = (init_apply_patch(), __toCommonJS(apply_patch_exports));\n var {\n branchTask: branchTask2,\n branchLocalTask: branchLocalTask2,\n deleteBranchesTask: deleteBranchesTask2,\n deleteBranchTask: deleteBranchTask2\n } = (init_branch(), __toCommonJS(branch_exports));\n var { checkIgnoreTask: checkIgnoreTask2 } = (init_check_ignore(), __toCommonJS(check_ignore_exports));\n var { checkIsRepoTask: checkIsRepoTask2 } = (init_check_is_repo(), __toCommonJS(check_is_repo_exports));\n var { cleanWithOptionsTask: cleanWithOptionsTask2, isCleanOptionsArray: isCleanOptionsArray2 } = (init_clean(), __toCommonJS(clean_exports));\n var { diffSummaryTask: diffSummaryTask2 } = (init_diff(), __toCommonJS(diff_exports));\n var { fetchTask: fetchTask2 } = (init_fetch(), __toCommonJS(fetch_exports));\n var { moveTask: moveTask2 } = (init_move(), __toCommonJS(move_exports));\n var { pullTask: pullTask2 } = (init_pull(), __toCommonJS(pull_exports));\n var { pushTagsTask: pushTagsTask2 } = (init_push(), __toCommonJS(push_exports));\n var {\n addRemoteTask: addRemoteTask2,\n getRemotesTask: getRemotesTask2,\n listRemotesTask: listRemotesTask2,\n remoteTask: remoteTask2,\n removeRemoteTask: removeRemoteTask2\n } = (init_remote(), __toCommonJS(remote_exports));\n var { getResetMode: getResetMode2, resetTask: resetTask2 } = (init_reset(), __toCommonJS(reset_exports));\n var { stashListTask: stashListTask2 } = (init_stash_list(), __toCommonJS(stash_list_exports));\n var {\n addSubModuleTask: addSubModuleTask2,\n initSubModuleTask: initSubModuleTask2,\n subModuleTask: subModuleTask2,\n updateSubModuleTask: updateSubModuleTask2\n } = (init_sub_module(), __toCommonJS(sub_module_exports));\n var { addAnnotatedTagTask: addAnnotatedTagTask2, addTagTask: addTagTask2, tagListTask: tagListTask2 } = (init_tag(), __toCommonJS(tag_exports));\n var { straightThroughBufferTask: straightThroughBufferTask2, straightThroughStringTask: straightThroughStringTask2 } = (init_task(), __toCommonJS(task_exports));\n function Git2(options, plugins) {\n this._plugins = plugins;\n this._executor = new GitExecutor2(\n options.baseDir,\n new Scheduler2(options.maxConcurrentProcesses),\n plugins\n );\n this._trimmed = options.trimmed;\n }\n (Git2.prototype = Object.create(SimpleGitApi2.prototype)).constructor = Git2;\n Git2.prototype.customBinary = function(command) {\n this._plugins.reconfigure(\"binary\", command);\n return this;\n };\n Git2.prototype.env = function(name, value) {\n if (arguments.length === 1 && typeof name === \"object\") {\n this._executor.env = name;\n } else {\n (this._executor.env = this._executor.env || {})[name] = value;\n }\n return this;\n };\n Git2.prototype.stashList = function(options) {\n return this._runTask(\n stashListTask2(\n trailingOptionsArgument2(arguments) || {},\n filterArray2(options) && options || []\n ),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.mv = function(from, to) {\n return this._runTask(moveTask2(from, to), trailingFunctionArgument2(arguments));\n };\n Git2.prototype.checkoutLatestTag = function(then) {\n var git = this;\n return this.pull(function() {\n git.tags(function(err, tags) {\n git.checkout(tags.latest, then);\n });\n });\n };\n Git2.prototype.pull = function(remote, branch, options, then) {\n return this._runTask(\n pullTask2(\n filterType2(remote, filterString2),\n filterType2(branch, filterString2),\n getTrailingOptions2(arguments)\n ),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.fetch = function(remote, branch) {\n return this._runTask(\n fetchTask2(\n filterType2(remote, filterString2),\n filterType2(branch, filterString2),\n getTrailingOptions2(arguments)\n ),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.silent = function(silence) {\n return this._runTask(\n adhocExecTask2(\n () => console.warn(\n \"simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.\"\n )\n )\n );\n };\n Git2.prototype.tags = function(options, then) {\n return this._runTask(\n tagListTask2(getTrailingOptions2(arguments)),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.rebase = function() {\n return this._runTask(\n straightThroughStringTask2([\"rebase\", ...getTrailingOptions2(arguments)]),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.reset = function(mode) {\n return this._runTask(\n resetTask2(getResetMode2(mode), getTrailingOptions2(arguments)),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.revert = function(commit) {\n const next = trailingFunctionArgument2(arguments);\n if (typeof commit !== \"string\") {\n return this._runTask(configurationErrorTask2(\"Commit must be a string\"), next);\n }\n return this._runTask(\n straightThroughStringTask2([\"revert\", ...getTrailingOptions2(arguments, 0, true), commit]),\n next\n );\n };\n Git2.prototype.addTag = function(name) {\n const task = typeof name === \"string\" ? addTagTask2(name) : configurationErrorTask2(\"Git.addTag requires a tag name\");\n return this._runTask(task, trailingFunctionArgument2(arguments));\n };\n Git2.prototype.addAnnotatedTag = function(tagName, tagMessage) {\n return this._runTask(\n addAnnotatedTagTask2(tagName, tagMessage),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.deleteLocalBranch = function(branchName, forceDelete, then) {\n return this._runTask(\n deleteBranchTask2(branchName, typeof forceDelete === \"boolean\" ? forceDelete : false),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.deleteLocalBranches = function(branchNames, forceDelete, then) {\n return this._runTask(\n deleteBranchesTask2(branchNames, typeof forceDelete === \"boolean\" ? forceDelete : false),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.branch = function(options, then) {\n return this._runTask(\n branchTask2(getTrailingOptions2(arguments)),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.branchLocal = function(then) {\n return this._runTask(branchLocalTask2(), trailingFunctionArgument2(arguments));\n };\n Git2.prototype.raw = function(commands) {\n const createRestCommands = !Array.isArray(commands);\n const command = [].slice.call(createRestCommands ? arguments : commands, 0);\n for (let i = 0; i < command.length && createRestCommands; i++) {\n if (!filterPrimitives2(command[i])) {\n command.splice(i, command.length - i);\n break;\n }\n }\n command.push(...getTrailingOptions2(arguments, 0, true));\n var next = trailingFunctionArgument2(arguments);\n if (!command.length) {\n return this._runTask(\n configurationErrorTask2(\"Raw: must supply one or more command to execute\"),\n next\n );\n }\n return this._runTask(straightThroughStringTask2(command, this._trimmed), next);\n };\n Git2.prototype.submoduleAdd = function(repo, path, then) {\n return this._runTask(addSubModuleTask2(repo, path), trailingFunctionArgument2(arguments));\n };\n Git2.prototype.submoduleUpdate = function(args, then) {\n return this._runTask(\n updateSubModuleTask2(getTrailingOptions2(arguments, true)),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.submoduleInit = function(args, then) {\n return this._runTask(\n initSubModuleTask2(getTrailingOptions2(arguments, true)),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.subModule = function(options, then) {\n return this._runTask(\n subModuleTask2(getTrailingOptions2(arguments)),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.listRemote = function() {\n return this._runTask(\n listRemotesTask2(getTrailingOptions2(arguments)),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.addRemote = function(remoteName, remoteRepo, then) {\n return this._runTask(\n addRemoteTask2(remoteName, remoteRepo, getTrailingOptions2(arguments)),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.removeRemote = function(remoteName, then) {\n return this._runTask(removeRemoteTask2(remoteName), trailingFunctionArgument2(arguments));\n };\n Git2.prototype.getRemotes = function(verbose, then) {\n return this._runTask(getRemotesTask2(verbose === true), trailingFunctionArgument2(arguments));\n };\n Git2.prototype.remote = function(options, then) {\n return this._runTask(\n remoteTask2(getTrailingOptions2(arguments)),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.tag = function(options, then) {\n const command = getTrailingOptions2(arguments);\n if (command[0] !== \"tag\") {\n command.unshift(\"tag\");\n }\n return this._runTask(straightThroughStringTask2(command), trailingFunctionArgument2(arguments));\n };\n Git2.prototype.updateServerInfo = function(then) {\n return this._runTask(\n straightThroughStringTask2([\"update-server-info\"]),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.pushTags = function(remote, then) {\n const task = pushTagsTask2(\n { remote: filterType2(remote, filterString2) },\n getTrailingOptions2(arguments)\n );\n return this._runTask(task, trailingFunctionArgument2(arguments));\n };\n Git2.prototype.rm = function(files) {\n return this._runTask(\n straightThroughStringTask2([\"rm\", \"-f\", ...asArray2(files)]),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.rmKeepLocal = function(files) {\n return this._runTask(\n straightThroughStringTask2([\"rm\", \"--cached\", ...asArray2(files)]),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.catFile = function(options, then) {\n return this._catFile(\"utf-8\", arguments);\n };\n Git2.prototype.binaryCatFile = function() {\n return this._catFile(\"buffer\", arguments);\n };\n Git2.prototype._catFile = function(format, args) {\n var handler = trailingFunctionArgument2(args);\n var command = [\"cat-file\"];\n var options = args[0];\n if (typeof options === \"string\") {\n return this._runTask(\n configurationErrorTask2(\"Git.catFile: options must be supplied as an array of strings\"),\n handler\n );\n }\n if (Array.isArray(options)) {\n command.push.apply(command, options);\n }\n const task = format === \"buffer\" ? straightThroughBufferTask2(command) : straightThroughStringTask2(command);\n return this._runTask(task, handler);\n };\n Git2.prototype.diff = function(options, then) {\n const task = filterString2(options) ? configurationErrorTask2(\n \"git.diff: supplying options as a single string is no longer supported, switch to an array of strings\"\n ) : straightThroughStringTask2([\"diff\", ...getTrailingOptions2(arguments)]);\n return this._runTask(task, trailingFunctionArgument2(arguments));\n };\n Git2.prototype.diffSummary = function() {\n return this._runTask(\n diffSummaryTask2(getTrailingOptions2(arguments, 1)),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.applyPatch = function(patches) {\n const task = !filterStringOrStringArray2(patches) ? configurationErrorTask2(\n `git.applyPatch requires one or more string patches as the first argument`\n ) : applyPatchTask2(asArray2(patches), getTrailingOptions2([].slice.call(arguments, 1)));\n return this._runTask(task, trailingFunctionArgument2(arguments));\n };\n Git2.prototype.revparse = function() {\n const commands = [\"rev-parse\", ...getTrailingOptions2(arguments, true)];\n return this._runTask(\n straightThroughStringTask2(commands, true),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.clean = function(mode, options, then) {\n const usingCleanOptionsArray = isCleanOptionsArray2(mode);\n const cleanMode = usingCleanOptionsArray && mode.join(\"\") || filterType2(mode, filterString2) || \"\";\n const customArgs = getTrailingOptions2([].slice.call(arguments, usingCleanOptionsArray ? 1 : 0));\n return this._runTask(\n cleanWithOptionsTask2(cleanMode, customArgs),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.exec = function(then) {\n const task = {\n commands: [],\n format: \"utf-8\",\n parser() {\n if (typeof then === \"function\") {\n then();\n }\n }\n };\n return this._runTask(task);\n };\n Git2.prototype.clearQueue = function() {\n return this._runTask(\n adhocExecTask2(\n () => console.warn(\n \"simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.\"\n )\n )\n );\n };\n Git2.prototype.checkIgnore = function(pathnames, then) {\n return this._runTask(\n checkIgnoreTask2(asArray2(filterType2(pathnames, filterStringOrStringArray2, []))),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.checkIsRepo = function(checkType, then) {\n return this._runTask(\n checkIsRepoTask2(filterType2(checkType, filterString2)),\n trailingFunctionArgument2(arguments)\n );\n };\n module.exports = Git2;\n }\n});\n\n// src/lib/api.ts\nimport { pathspec } from \"@simple-git/args-pathspec\";\n\n// src/lib/errors/git-construct-error.ts\ninit_git_error();\nvar GitConstructError = class extends GitError {\n constructor(config, message) {\n super(void 0, message);\n this.config = config;\n }\n};\n\n// src/lib/api.ts\ninit_git_error();\n\n// src/lib/errors/git-plugin-error.ts\ninit_git_error();\nvar GitPluginError = class extends GitError {\n constructor(task, plugin, message) {\n super(task, message);\n this.task = task;\n this.plugin = plugin;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n};\n\n// src/lib/api.ts\ninit_git_response_error();\ninit_task_configuration_error();\ninit_check_is_repo();\ninit_clean();\ninit_config();\ninit_diff_name_status();\ninit_grep();\ninit_reset();\n\n// src/lib/plugins/abort-plugin.ts\nfunction abortPlugin(signal) {\n if (!signal) {\n return;\n }\n const onSpawnAfter = {\n type: \"spawn.after\",\n action(_data, context) {\n function kill() {\n context.kill(new GitPluginError(void 0, \"abort\", \"Abort signal received\"));\n }\n signal.addEventListener(\"abort\", kill);\n context.spawned.on(\"close\", () => signal.removeEventListener(\"abort\", kill));\n }\n };\n const onSpawnBefore = {\n type: \"spawn.before\",\n action(_data, context) {\n if (signal.aborted) {\n context.kill(new GitPluginError(void 0, \"abort\", \"Abort already signaled\"));\n }\n }\n };\n return [onSpawnBefore, onSpawnAfter];\n}\n\n// src/lib/plugins/block-unsafe-operations-plugin.ts\nimport { vulnerabilityCheck } from \"@simple-git/argv-parser\";\nfunction blockUnsafeOperationsPlugin(options = {}) {\n return {\n type: \"spawn.args\",\n action(args, { env }) {\n for (const vulnerability of vulnerabilityCheck(args, env)) {\n if (options[vulnerability.category] !== true) {\n throw new GitPluginError(void 0, \"unsafe\", vulnerability.message);\n }\n }\n return args;\n }\n };\n}\n\n// src/lib/plugins/command-config-prefixing-plugin.ts\ninit_utils();\nfunction commandConfigPrefixingPlugin(configuration) {\n const prefix = prefixedArray(configuration, \"-c\");\n return {\n type: \"spawn.args\",\n action(data) {\n return [...prefix, ...data];\n }\n };\n}\n\n// src/lib/plugins/completion-detection.plugin.ts\ninit_utils();\nimport { deferred } from \"@kwsites/promise-deferred\";\nvar never = deferred().promise;\nfunction completionDetectionPlugin({\n onClose = true,\n onExit = 50\n} = {}) {\n function createEvents() {\n let exitCode = -1;\n const events = {\n close: deferred(),\n closeTimeout: deferred(),\n exit: deferred(),\n exitTimeout: deferred()\n };\n const result = Promise.race([\n onClose === false ? never : events.closeTimeout.promise,\n onExit === false ? never : events.exitTimeout.promise\n ]);\n configureTimeout(onClose, events.close, events.closeTimeout);\n configureTimeout(onExit, events.exit, events.exitTimeout);\n return {\n close(code) {\n exitCode = code;\n events.close.done();\n },\n exit(code) {\n exitCode = code;\n events.exit.done();\n },\n get exitCode() {\n return exitCode;\n },\n result\n };\n }\n function configureTimeout(flag, event, timeout) {\n if (flag === false) {\n return;\n }\n (flag === true ? event.promise : event.promise.then(() => delay(flag))).then(timeout.done);\n }\n return {\n type: \"spawn.after\",\n async action(_data, { spawned, close }) {\n const events = createEvents();\n let deferClose = true;\n let quickClose = () => void (deferClose = false);\n spawned.stdout?.on(\"data\", quickClose);\n spawned.stderr?.on(\"data\", quickClose);\n spawned.on(\"error\", quickClose);\n spawned.on(\"close\", (code) => events.close(code));\n spawned.on(\"exit\", (code) => events.exit(code));\n try {\n await events.result;\n if (deferClose) {\n await delay(50);\n }\n close(events.exitCode);\n } catch (err) {\n close(events.exitCode, err);\n }\n }\n };\n}\n\n// src/lib/plugins/custom-binary.plugin.ts\ninit_utils();\nvar WRONG_NUMBER_ERR = `Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings`;\nvar WRONG_CHARS_ERR = `Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option`;\nfunction isBadArgument(arg) {\n return !arg || !/^([a-z]:)?([a-z0-9/.\\\\_~-]+)$/i.test(arg);\n}\nfunction toBinaryConfig(input, allowUnsafe) {\n if (input.length < 1 || input.length > 2) {\n throw new GitPluginError(void 0, \"binary\", WRONG_NUMBER_ERR);\n }\n const isBad = input.some(isBadArgument);\n if (isBad) {\n if (allowUnsafe) {\n console.warn(WRONG_CHARS_ERR);\n } else {\n throw new GitPluginError(void 0, \"binary\", WRONG_CHARS_ERR);\n }\n }\n const [binary, prefix] = input;\n return {\n binary,\n prefix\n };\n}\nfunction customBinaryPlugin(plugins, input = [\"git\"], allowUnsafe = false) {\n let config = toBinaryConfig(asArray(input), allowUnsafe);\n plugins.on(\"binary\", (input2) => {\n config = toBinaryConfig(asArray(input2), allowUnsafe);\n });\n plugins.append(\"spawn.binary\", () => {\n return config.binary;\n });\n plugins.append(\"spawn.args\", (data) => {\n return config.prefix ? [config.prefix, ...data] : data;\n });\n}\n\n// src/lib/plugins/error-detection.plugin.ts\ninit_git_error();\nfunction isTaskError(result) {\n return !!(result.exitCode && result.stdErr.length);\n}\nfunction getErrorMessage(result) {\n return Buffer.concat([...result.stdOut, ...result.stdErr]);\n}\nfunction errorDetectionHandler(overwrite = false, isError = isTaskError, errorMessage = getErrorMessage) {\n return (error, result) => {\n if (!overwrite && error || !isError(result)) {\n return error;\n }\n return errorMessage(result);\n };\n}\nfunction errorDetectionPlugin(config) {\n return {\n type: \"task.error\",\n action(data, context) {\n const error = config(data.error, {\n stdErr: context.stdErr,\n stdOut: context.stdOut,\n exitCode: context.exitCode\n });\n if (Buffer.isBuffer(error)) {\n return { error: new GitError(void 0, error.toString(\"utf-8\")) };\n }\n return {\n error\n };\n }\n };\n}\n\n// src/lib/plugins/plugin-store.ts\ninit_utils();\nimport { EventEmitter } from \"node:events\";\nvar PluginStore = class {\n constructor() {\n this.plugins = /* @__PURE__ */ new Set();\n this.events = new EventEmitter();\n }\n on(type, listener) {\n this.events.on(type, listener);\n }\n reconfigure(type, data) {\n this.events.emit(type, data);\n }\n append(type, action) {\n const plugin = append(this.plugins, { type, action });\n return () => this.plugins.delete(plugin);\n }\n add(plugin) {\n const plugins = [];\n asArray(plugin).forEach((plugin2) => plugin2 && this.plugins.add(append(plugins, plugin2)));\n return () => {\n plugins.forEach((plugin2) => this.plugins.delete(plugin2));\n };\n }\n exec(type, data, context) {\n let output = data;\n const contextual = Object.freeze(Object.create(context));\n for (const plugin of this.plugins) {\n if (plugin.type === type) {\n output = plugin.action(output, contextual);\n }\n }\n return output;\n }\n};\n\n// src/lib/plugins/progress-monitor-plugin.ts\ninit_utils();\nfunction progressMonitorPlugin(progress) {\n const progressCommand = \"--progress\";\n const progressMethods = [\"checkout\", \"clone\", \"fetch\", \"pull\", \"push\"];\n const onProgress = {\n type: \"spawn.after\",\n action(_data, context) {\n if (!context.commands.includes(progressCommand)) {\n return;\n }\n context.spawned.stderr?.on(\"data\", (chunk) => {\n const message = /^([\\s\\S]+?):\\s*(\\d+)% \\((\\d+)\\/(\\d+)\\)/.exec(chunk.toString(\"utf8\"));\n if (!message) {\n return;\n }\n progress({\n method: context.method,\n stage: progressEventStage(message[1]),\n progress: asNumber(message[2]),\n processed: asNumber(message[3]),\n total: asNumber(message[4])\n });\n });\n }\n };\n const onArgs = {\n type: \"spawn.args\",\n action(args, context) {\n if (!progressMethods.includes(context.method)) {\n return args;\n }\n return including(args, progressCommand);\n }\n };\n return [onArgs, onProgress];\n}\nfunction progressEventStage(input) {\n return String(input.toLowerCase().split(\" \", 1)) || \"unknown\";\n}\n\n// src/lib/plugins/spawn-options-plugin.ts\ninit_utils();\nfunction spawnOptionsPlugin(spawnOptions) {\n const options = pick(spawnOptions, [\"uid\", \"gid\"]);\n return {\n type: \"spawn.options\",\n action(data) {\n return { ...options, ...data };\n }\n };\n}\n\n// src/lib/plugins/timout-plugin.ts\nfunction timeoutPlugin({\n block,\n stdErr = true,\n stdOut = true\n}) {\n if (block > 0) {\n return {\n type: \"spawn.after\",\n action(_data, context) {\n let timeout;\n function wait() {\n timeout && clearTimeout(timeout);\n timeout = setTimeout(kill, block);\n }\n function stop() {\n context.spawned.stdout?.off(\"data\", wait);\n context.spawned.stderr?.off(\"data\", wait);\n context.spawned.off(\"exit\", stop);\n context.spawned.off(\"close\", stop);\n timeout && clearTimeout(timeout);\n }\n function kill() {\n stop();\n context.kill(new GitPluginError(void 0, \"timeout\", `block timeout reached`));\n }\n stdOut && context.spawned.stdout?.on(\"data\", wait);\n stdErr && context.spawned.stderr?.on(\"data\", wait);\n context.spawned.on(\"exit\", stop);\n context.spawned.on(\"close\", stop);\n wait();\n }\n };\n }\n}\n\n// src/lib/plugins/suffix-paths.plugin.ts\nimport { isPathSpec as isPathSpec3, toPaths } from \"@simple-git/args-pathspec\";\nfunction suffixPathsPlugin() {\n return {\n type: \"spawn.args\",\n action(data) {\n const prefix = [];\n let suffix;\n function append2(args) {\n (suffix = suffix || []).push(...args);\n }\n for (let i = 0; i < data.length; i++) {\n const param = data[i];\n if (isPathSpec3(param)) {\n append2(toPaths(param));\n continue;\n }\n if (param === \"--\") {\n append2(\n data.slice(i + 1).flatMap((item) => isPathSpec3(item) && toPaths(item) || item)\n );\n break;\n }\n prefix.push(param);\n }\n return !suffix ? prefix : [...prefix, \"--\", ...suffix.map(String)];\n }\n };\n}\n\n// src/lib/git-factory.ts\ninit_utils();\nvar Git = require_git();\nfunction gitInstanceFactory(baseDir, options) {\n const plugins = new PluginStore();\n const config = createInstanceConfig(\n baseDir && (typeof baseDir === \"string\" ? { baseDir } : baseDir) || {},\n options\n );\n if (!folderExists(config.baseDir)) {\n throw new GitConstructError(\n config,\n `Cannot use simple-git on a directory that does not exist`\n );\n }\n if (Array.isArray(config.config)) {\n plugins.add(commandConfigPrefixingPlugin(config.config));\n }\n plugins.add(blockUnsafeOperationsPlugin(config.unsafe));\n plugins.add(completionDetectionPlugin(config.completion));\n config.abort && plugins.add(abortPlugin(config.abort));\n config.progress && plugins.add(progressMonitorPlugin(config.progress));\n config.timeout && plugins.add(timeoutPlugin(config.timeout));\n config.spawnOptions && plugins.add(spawnOptionsPlugin(config.spawnOptions));\n plugins.add(suffixPathsPlugin());\n plugins.add(errorDetectionPlugin(errorDetectionHandler(true)));\n config.errors && plugins.add(errorDetectionPlugin(config.errors));\n customBinaryPlugin(plugins, config.binary, config.unsafe?.allowUnsafeCustomBinary);\n return new Git(config, plugins);\n}\n\n// src/lib/runners/promise-wrapped.ts\ninit_git_response_error();\nvar functionNamesBuilderApi = [\"customBinary\", \"env\", \"outputHandler\", \"silent\"];\nvar functionNamesPromiseApi = [\n \"add\",\n \"addAnnotatedTag\",\n \"addConfig\",\n \"addRemote\",\n \"addTag\",\n \"applyPatch\",\n \"binaryCatFile\",\n \"branch\",\n \"branchLocal\",\n \"catFile\",\n \"checkIgnore\",\n \"checkIsRepo\",\n \"checkout\",\n \"checkoutBranch\",\n \"checkoutLatestTag\",\n \"checkoutLocalBranch\",\n \"clean\",\n \"clone\",\n \"commit\",\n \"cwd\",\n \"deleteLocalBranch\",\n \"deleteLocalBranches\",\n \"diff\",\n \"diffSummary\",\n \"exec\",\n \"fetch\",\n \"getRemotes\",\n \"init\",\n \"listConfig\",\n \"listRemote\",\n \"log\",\n \"merge\",\n \"mergeFromTo\",\n \"mirror\",\n \"mv\",\n \"pull\",\n \"push\",\n \"pushTags\",\n \"raw\",\n \"rebase\",\n \"remote\",\n \"removeRemote\",\n \"reset\",\n \"revert\",\n \"revparse\",\n \"rm\",\n \"rmKeepLocal\",\n \"show\",\n \"stash\",\n \"stashList\",\n \"status\",\n \"subModule\",\n \"submoduleAdd\",\n \"submoduleInit\",\n \"submoduleUpdate\",\n \"tag\",\n \"tags\",\n \"updateServerInfo\"\n];\nfunction gitP(...args) {\n let git;\n let chain = Promise.resolve();\n try {\n git = gitInstanceFactory(...args);\n } catch (e) {\n chain = Promise.reject(e);\n }\n function builderReturn() {\n return promiseApi;\n }\n function chainReturn() {\n return chain;\n }\n const promiseApi = [...functionNamesBuilderApi, ...functionNamesPromiseApi].reduce(\n (api, name) => {\n const isAsync = functionNamesPromiseApi.includes(name);\n const valid = isAsync ? asyncWrapper(name, git) : syncWrapper(name, git, api);\n const alternative = isAsync ? chainReturn : builderReturn;\n Object.defineProperty(api, name, {\n enumerable: false,\n configurable: false,\n value: git ? valid : alternative\n });\n return api;\n },\n {}\n );\n return promiseApi;\n function asyncWrapper(fn, git2) {\n return function(...args2) {\n if (typeof args2[args2.length] === \"function\") {\n throw new TypeError(\n \"Promise interface requires that handlers are not supplied inline, trailing function not allowed in call to \" + fn\n );\n }\n return chain.then(function() {\n return new Promise(function(resolve, reject) {\n const callback = (err, result) => {\n if (err) {\n return reject(toError(err));\n }\n resolve(result);\n };\n args2.push(callback);\n git2[fn].apply(git2, args2);\n });\n });\n };\n }\n function syncWrapper(fn, git2, api) {\n return (...args2) => {\n git2[fn](...args2);\n return api;\n };\n }\n}\nfunction toError(error) {\n if (error instanceof Error) {\n return error;\n }\n if (typeof error === \"string\") {\n return new Error(error);\n }\n return new GitResponseError(error);\n}\n\n// src/esm.mjs\nvar simpleGit = gitInstanceFactory;\nvar esm_default = gitInstanceFactory;\nexport {\n CheckRepoActions,\n CleanOptions,\n DiffNameStatus,\n GitConfigScope,\n GitConstructError,\n GitError,\n GitPluginError,\n GitResponseError,\n ResetMode,\n TaskConfigurationError,\n esm_default as default,\n gitP,\n grepQueryBuilder,\n pathspec,\n simpleGit\n};\n//# sourceMappingURL=index.js.map\n","/**\n * Git credential injection (docs/designs/github-app-git-credentials.md\n * §git 操作注入 / §子仓库) — the TWO secret-free channels that point every git\n * process at `agentconnect git-credential`:\n *\n * 1. Repo-local `.git/config` (written once post-clone): covers agent-run git\n * in the main checkout. Multiple agents can share one checkout — the file\n * carries the LAST writer's agentId, so channel 2 is authoritative there.\n * 2. Session-env `GIT_CONFIG_GLOBAL` pointing at a generated per-agent\n * gitconfig (includes the user's real global config first). Inherited by\n * the WHOLE agent process tree — submodules and nested clones hit OUR\n * helper (and get a clean denial) instead of leaking to a machine-global\n * osxkeychain credential. NOT GIT_CONFIG_COUNT: the indexed env vars don't\n * merge across processes, so any child that sets its own COUNT would\n * silently drop the reset and reopen the leak.\n *\n * All config values single-quote the shim path (git runs `!`-helpers via\n * `sh -c` — a space in $HOME must not word-split), reset the helper list first\n * (empty entry) and set useHttpPath=true (git strips `path` from credential\n * lookups by default; the reset-list semantics for URL-scoped keys are\n * implementation behavior verified on git ≥2.32 — see the design doc).\n *\n * Everything written here is a POINTER to the daemon — never a secret.\n */\nimport { execFile } from 'node:child_process'\nimport { mkdirSync, writeFileSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\nimport { simpleGit, type SimpleGit } from 'simple-git'\n\n/**\n * simple-git ≥3.36 vulnerability-checks argv AND any child env passed via\n * `.env()` (blockUnsafeOperationsPlugin → @simple-git/argv-parser). Two\n * behaviors matter here:\n *\n * - configuring `credential.helper` (any scope — argv `config` writes AND\n * GIT_CONFIG_KEY_n pairs) and the GIT_CONFIG_COUNT env channel itself each\n * need their own unsafe opt-in;\n * - a NAME blocklist of editor/pager/ssh/askpass/exec-path env vars is\n * refused outright, presence-based — the value is never read, so an empty\n * string or the operator's login-shell EDITOR both throw.\n *\n * Our helper injection IS the feature — opt in to exactly the two categories\n * whose values the daemon constructs itself. The host-shell noise (EDITOR,\n * stray GIT_DIR, a host GIT_CONFIG_*) gets SANITIZED instead: none of it\n * belongs in a daemon-run git child.\n */\nconst UNSAFE_OPTS = {\n unsafe: {\n allowUnsafeCredentialHelper: true, // the daemon-built credential.https://github.com.helper pairs\n allowUnsafeConfigEnvCount: true // the daemon-built GIT_CONFIG_COUNT/KEY_n/VALUE_n channel\n }\n} as const\n\n/**\n * simple-git bound to a cwd with the credential-helper opt-in. An `abort`\n * signal KILLS the spawned git child (abort-plugin) — pair budget timeouts\n * with it, or the abandoned child keeps running and holds .git locks\n * (index.lock) into the next session's pull.\n */\nexport function gitFor(cwd?: string, abort?: AbortSignal): SimpleGit {\n return simpleGit({\n ...(cwd ? { baseDir: cwd } : {}),\n ...(abort ? { abort } : {}),\n ...UNSAFE_OPTS\n })\n}\n\n// Every env var simple-git's checker refuses by NAME (it matches\n// case-insensitively — mirror that) + repo-context overrides that must never\n// leak into a clone/pull child. VISUAL rides along with the editor family.\nconst HOST_ENV_STRIP = new Set([\n 'EDITOR',\n 'VISUAL',\n 'PAGER',\n 'PREFIX',\n 'GIT_EDITOR',\n 'GIT_SEQUENCE_EDITOR',\n 'GIT_PAGER',\n 'GIT_SSH',\n 'GIT_SSH_COMMAND',\n 'GIT_ASKPASS',\n 'SSH_ASKPASS',\n 'GIT_EXEC_PATH',\n 'GIT_EXTERNAL_DIFF',\n 'GIT_PROXY_COMMAND',\n 'GIT_TEMPLATE_DIR',\n 'GIT_DIR',\n 'GIT_WORK_TREE',\n 'GIT_INDEX_FILE',\n 'GIT_NAMESPACE',\n 'GIT_CONFIG',\n 'GIT_CONFIG_GLOBAL',\n 'GIT_CONFIG_SYSTEM'\n])\n\n/**\n * `process.env` minus host-shell git noise — the base for every daemon-run git\n * child. The host keeps its ambient capabilities (PATH, HOME → ~/.gitconfig\n * and ~/.ssh/config, SSH_AUTH_SOCK, proxies); what goes is anything the\n * checker blocks by name plus repo-context overrides. A host that truly needs\n * e.g. a custom ssh command can set core.sshCommand in ~/.gitconfig — config\n * FILES are honored as ever, only env-var overrides are dropped.\n */\nexport function gitEnvBase(): Record<string, string> {\n const env: Record<string, string> = {}\n for (const [k, v] of Object.entries(process.env)) {\n if (v === undefined) continue\n const key = k.toUpperCase()\n if (HOST_ENV_STRIP.has(key)) continue\n if (key.startsWith('GIT_CONFIG_')) continue // stray host GIT_CONFIG_COUNT/KEY_n/VALUE_n\n env[k] = v\n }\n return env\n}\n\n/** Module-level init (workspace-manager is functional; mirrors cloneInFlight). */\nlet shimPath: string | undefined\nlet runDir: string | undefined\nlet preWarm: ((agentId: string, reason: 'clone' | 'pull') => Promise<void>) | undefined\n\nexport function initGitInjection(opts: {\n shimPath: string\n runDir: string\n /** Warm the daemon credential cache BEFORE a timed git op (never inside its budget). */\n preWarm: (agentId: string, reason: 'clone' | 'pull') => Promise<void>\n}): void {\n shimPath = opts.shimPath\n runDir = opts.runDir\n preWarm = opts.preWarm\n}\n\nfunction quotedHelper(agentId: string): string {\n if (!shimPath) throw new Error('git credential injection is not initialized')\n return `!'${shimPath.replaceAll(\"'\", \"'\\\\''\")}' ${agentId}`\n}\n\n/** The three github.com-scoped config pairs both channels share. */\nfunction configPairs(agentId: string): Array<[string, string]> {\n return [\n ['credential.https://github.com.helper', ''], // reset: machine helpers must never answer for github.com\n ['credential.https://github.com.helper', quotedHelper(agentId)],\n ['credential.https://github.com.useHttpPath', 'true'] // git strips `path` otherwise — the helper wants it\n ]\n}\n\n/**\n * Env for a DAEMON-RUN git process (clone — no repo config exists yet).\n * Spread over `process.env` by the caller: simple-git's `.env()` REPLACES the\n * child environment (v3.36 verified), a bare object would strip PATH/HOME.\n */\nexport function cloneGitEnv(agentId: string): Record<string, string> {\n const pairs = configPairs(agentId)\n const env: Record<string, string> = {\n GIT_TERMINAL_PROMPT: '0',\n GIT_CONFIG_COUNT: String(pairs.length)\n }\n pairs.forEach(([k, v], i) => {\n env[`GIT_CONFIG_KEY_${i}`] = k\n env[`GIT_CONFIG_VALUE_${i}`] = v\n })\n return env\n}\n\n/**\n * Session-env channel: (re)write the per-agent gitconfig and return the env to\n * inject into the agent's ACP runtime process. Regenerated on every host spawn\n * (#251 retries rebuild the host ⇒ this re-runs).\n */\nexport function sessionGitEnv(agentId: string): Record<string, string> {\n if (!runDir) throw new Error('git credential injection is not initialized')\n const dir = join(runDir, 'gitcred')\n mkdirSync(dir, { recursive: true, mode: 0o700 })\n const file = join(dir, `${agentId}.gitconfig`)\n const lines = [\n '# agentconnect session git config — regenerated on agent start; NO secrets.',\n '# Keeps the user global config, then pins github.com credentials to the daemon helper.',\n '[include]',\n `\\tpath = ${join(homedir(), '.gitconfig')}`,\n '[credential \"https://github.com\"]',\n '\\thelper = ', // reset the accumulated helper list for github.com\n `\\thelper = ${quotedHelper(agentId)}`,\n '\\tuseHttpPath = true',\n ''\n ]\n writeFileSync(file, lines.join('\\n'), { mode: 0o644 })\n return { GIT_CONFIG_GLOBAL: file, GIT_TERMINAL_PROMPT: '0' }\n}\n\n/** Post-clone: pin the repo-local helper so agent-run git in the checkout works. */\nexport async function writeRepoHelperConfig(cwd: string, agentId: string): Promise<void> {\n const git = gitFor(cwd)\n // `--replace-all` on the first write resets any stale helper list from a\n // previous agent generation; addConfig(append=true) accumulates the rest.\n await git.raw(['config', '--replace-all', 'credential.https://github.com.helper', ''])\n await git.raw(['config', '--add', 'credential.https://github.com.helper', quotedHelper(agentId)])\n await git.raw(['config', 'credential.https://github.com.useHttpPath', 'true'])\n}\n\n/** Pre-warm hook for workspace-manager (no-op until initialized). */\nexport async function preWarmGitCred(agentId: string, reason: 'clone' | 'pull'): Promise<void> {\n if (!preWarm) return\n await preWarm(agentId, reason)\n}\n\n// The session channel (GIT_CONFIG_GLOBAL) needs git ≥ 2.32 and DEGRADES\n// SILENTLY below it — old git just ignores the variable and agent-run git\n// falls through to whatever machine credentials exist. The clone channel\n// (GIT_CONFIG_COUNT/KEY_n/VALUE_n) needs ≥ 2.31 and fails loudly instead.\nconst MIN_GIT: readonly [number, number] = [2, 32]\n\n/** `git version 2.39.5 (Apple Git-154)` → [2, 39]; null when unparseable. */\nexport function parseGitVersion(raw: string): [number, number] | null {\n const m = /git version (\\d+)\\.(\\d+)/.exec(raw)\n return m ? [Number(m[1]), Number(m[2])] : null\n}\n\n/**\n * Boot-time probe (fire-and-forget): a host below the floor would otherwise\n * only show up as a mysterious credential prompt / auth failure deep inside an\n * agent session — say it once, at startup, in plain words.\n */\nexport function probeGitVersion(warn: (msg: string) => void): void {\n execFile('git', ['--version'], { timeout: 5_000 }, (err, stdout) => {\n if (err) {\n warn('git probe: `git --version` failed — git workspaces will not work on this host')\n return\n }\n const v = parseGitVersion(String(stdout))\n if (!v) return // vendor-mangled banner — do not cry wolf\n const [major, minor] = v\n if (major > MIN_GIT[0] || (major === MIN_GIT[0] && minor >= MIN_GIT[1])) return\n const cloneToo = major < 2 || (major === 2 && minor < 31)\n warn(\n `git ${major}.${minor} found but github-app workspaces need git >= ${MIN_GIT[0]}.${MIN_GIT[1]}: ` +\n 'this git silently ignores the session credential channel (GIT_CONFIG_GLOBAL)' +\n (cloneToo ? ' and clone-time injection (GIT_CONFIG_COUNT, needs >= 2.31) will fail' : '')\n )\n })\n}\n","import { mkdirSync, existsSync, rmSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { normalizeGitUrl } from '@agentconnect.md/protocol'\nimport type { Agent } from '../agents/agent-schema.js'\nimport { cloneGitEnv, gitEnvBase, gitFor, preWarmGitCred, writeRepoHelperConfig } from './git-injection.js'\n\nconst PULL_TIMEOUT_MS = 4500\n\n// Single-flight clone lock keyed by the absolute cwd. Two concurrent sessions\n// (especially multiple agents sharing one repo checkout) must not race into the\n// same dir — the second awaits the first's in-flight clone instead of re-cloning.\nconst cloneInFlight = new Map<string, Promise<void>>()\n\nfunction usesGithubApp(agent: Agent): boolean {\n return agent.workspace.mode === 'git-repo' && agent.workspace.gitCredential === 'github-app'\n}\n\nexport async function prepareWorkspace(agent: Agent): Promise<string> {\n const cwd = agent.workspace.path\n mkdirSync(cwd, { recursive: true })\n\n if (agent.workspace.mode === 'from-scratch') {\n // The agent's memory file lives at the agent ROOT (outside the workspace) and\n // is seeded separately (see agents/memory.ts `ensureMemory`), so from-scratch\n // just needs the (empty) workspace dir to exist.\n return cwd\n }\n\n // git-repo, first session: no checkout yet → clone. Unlike pull, a clone has no\n // on-disk fallback, so on failure we THROW (the session creation fails + the error\n // surfaces) rather than silently proceeding with an empty dir (design §4.3).\n if (!existsSync(join(cwd, '.git'))) {\n await cloneRepo(agent)\n return cwd\n }\n\n // git-repo, existing checkout: best-effort ff-only pull; never block/throw on\n // offline (design §4.3) — proceed with the on-disk checkout.\n if (agent.workspace.pullOnNewSession) {\n // github-app: warm the credential cache OUTSIDE the pull budget — a cold\n // cache means a CP round trip that would otherwise eat the whole 4.5s.\n if (usesGithubApp(agent)) await preWarmGitCred(agent.id, 'pull').catch(() => undefined)\n // Abort-driven budget: the signal makes simple-git KILL the git child at\n // the deadline. A bare Promise.race would abandon it still running — a\n // wedged pull (network black hole) then holds .git/index.lock into the\n // next session's pull.\n const abort = new AbortController()\n const timer = setTimeout(() => abort.abort(), PULL_TIMEOUT_MS)\n try {\n await gitFor(cwd, abort.signal)\n .env({ ...gitEnvBase(), GIT_TERMINAL_PROMPT: '0' })\n .pull(['--ff-only'])\n } catch {\n // offline / timed out / non-fast-forward: proceed with the on-disk checkout\n } finally {\n clearTimeout(timer)\n }\n }\n return cwd\n}\n\n/**\n * Eagerly clone a git-repo workspace that has no checkout yet — for reconcile-time\n * prefetch so the repo is warm before the first message arrives. No-op for\n * from-scratch or an already-cloned checkout (the session-time `prepareWorkspace`\n * stays authoritative and still owns pull + hard-fail). Reuses the single-flight\n * lock so a prefetch and a concurrent session-start clone never race into the same\n * dir. The caller invokes this fire-and-forget and logs any rejection — clone\n * failure here is non-fatal because `prepareWorkspace` re-clones (and hard-fails)\n * on the first session as the backstop.\n */\nexport async function prefetchWorkspace(agent: Agent): Promise<void> {\n if (agent.workspace.mode !== 'git-repo') return\n const cwd = agent.workspace.path\n if (existsSync(join(cwd, '.git'))) return\n mkdirSync(cwd, { recursive: true })\n await cloneRepo(agent)\n}\n\n/** Clone agent.workspace.gitRepo @ gitBranch into cwd, single-flight per cwd. */\nasync function cloneRepo(agent: Agent): Promise<void> {\n const cwd = agent.workspace.path\n const inflight = cloneInFlight.get(cwd)\n if (inflight) return inflight\n\n // Stored value should already be a full address, but normalize defensively —\n // a hand-edited or pre-normalization agent.json may still say \"org/repo\",\n // which git would treat as a local path (\"repository ... does not exist\").\n const gitRepo = agent.workspace.gitRepo && normalizeGitUrl(agent.workspace.gitRepo)\n if (!gitRepo) throw new Error(`workspace clone: agent \"${agent.id}\" has git-repo mode but no gitRepo configured`)\n const branch = agent.workspace.gitBranch\n const githubApp = usesGithubApp(agent)\n\n const p = (async () => {\n // github-app: credentials ride the env-injected helper (no repo config exists\n // yet). SPREAD over process.env — simple-git's .env() REPLACES the child env.\n if (githubApp) await preWarmGitCred(agent.id, 'clone')\n const git = githubApp\n ? gitFor().env({ ...gitEnvBase(), ...cloneGitEnv(agent.id) })\n : gitFor().env({ ...gitEnvBase(), GIT_TERMINAL_PROMPT: '0' })\n try {\n await git.clone(gitRepo, cwd, ['--branch', branch, '--single-branch'])\n } catch (e) {\n // A failed clone leaves a half-written dir whose stray `.git` would make\n // every later attempt think the checkout exists — clean before rethrowing.\n rmSync(join(cwd, '.git'), { recursive: true, force: true })\n throw e\n }\n // Pin the repo-local helper so AGENT-run git in this checkout authenticates\n // through the daemon too — the \"no credentials on the machine, but the agent\n // can still push\" half of the design.\n if (githubApp) await writeRepoHelperConfig(cwd, agent.id)\n })().finally(() => {\n cloneInFlight.delete(cwd)\n })\n cloneInFlight.set(cwd, p)\n return p\n}\n","// This file is auto-generated by @hey-api/openapi-ts\nexport const AGENT_METHODS = {\n initialize: \"initialize\",\n authenticate: \"authenticate\",\n providers_list: \"providers/list\",\n providers_set: \"providers/set\",\n providers_disable: \"providers/disable\",\n session_new: \"session/new\",\n session_load: \"session/load\",\n session_set_mode: \"session/set_mode\",\n session_set_config_option: \"session/set_config_option\",\n session_prompt: \"session/prompt\",\n session_cancel: \"session/cancel\",\n mcp_message: \"mcp/message\",\n session_list: \"session/list\",\n session_delete: \"session/delete\",\n session_fork: \"session/fork\",\n session_resume: \"session/resume\",\n session_close: \"session/close\",\n logout: \"logout\",\n nes_start: \"nes/start\",\n nes_suggest: \"nes/suggest\",\n nes_accept: \"nes/accept\",\n nes_reject: \"nes/reject\",\n nes_close: \"nes/close\",\n document_did_open: \"document/didOpen\",\n document_did_change: \"document/didChange\",\n document_did_close: \"document/didClose\",\n document_did_save: \"document/didSave\",\n document_did_focus: \"document/didFocus\",\n};\nexport const CLIENT_METHODS = {\n session_request_permission: \"session/request_permission\",\n session_update: \"session/update\",\n fs_write_text_file: \"fs/write_text_file\",\n fs_read_text_file: \"fs/read_text_file\",\n terminal_create: \"terminal/create\",\n terminal_output: \"terminal/output\",\n terminal_release: \"terminal/release\",\n terminal_wait_for_exit: \"terminal/wait_for_exit\",\n terminal_kill: \"terminal/kill\",\n mcp_connect: \"mcp/connect\",\n mcp_message: \"mcp/message\",\n mcp_disconnect: \"mcp/disconnect\",\n elicitation_create: \"elicitation/create\",\n elicitation_complete: \"elicitation/complete\",\n};\nexport const PROTOCOL_METHODS = {\n cancel_request: \"$/cancel_request\",\n};\nexport const PROTOCOL_VERSION = 1;\n//# sourceMappingURL=index.js.map","import { z } from \"zod/v4\";\nconst skippedItem = Symbol(\"skippedItem\");\nexport function defaultOnError(schema, fallback) {\n return schema.catch(fallback);\n}\nexport function requiredDefaultOnError(schema, fallback) {\n const schemaWithCatch = schema.catch(fallback);\n return z.unknown().transform((value, context) => {\n if (value !== undefined)\n return schemaWithCatch.parse(value);\n context.addIssue({\n code: \"custom\",\n message: \"Required value is missing\",\n });\n return z.NEVER;\n });\n}\nexport function vecSkipError(itemSchema) {\n return z\n .array(itemSchema.catch(skippedItem))\n .transform((items) => items.filter((item) => item !== skippedItem));\n}\n//# sourceMappingURL=schema-deserialize.js.map","// This file is auto-generated by @hey-api/openapi-ts\nimport { defaultOnError, requiredDefaultOnError, vecSkipError, } from \"../schema-deserialize.js\";\nimport * as z from \"zod/v4\";\n/**\n * JSON RPC Request Id\n *\n * An 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 *\n * The 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.\n */\nexport const zRequestId = z.union([z.number(), z.string()]).nullable();\n/**\n * A unique identifier for a conversation session between a client and agent.\n *\n * Sessions maintain their own context, conversation history, and state,\n * allowing multiple independent interactions with the same agent.\n *\n * See protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)\n */\nexport const zSessionId = z.string();\n/**\n * Request to write content to a text file.\n *\n * Only available if the client supports the `fs.writeTextFile` capability.\n */\nexport const zWriteTextFileRequest = z.object({\n sessionId: zSessionId,\n path: z.string(),\n content: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request to read content from a text file.\n *\n * Only available if the client supports the `fs.readTextFile` capability.\n */\nexport const zReadTextFileRequest = z.object({\n sessionId: zSessionId,\n path: z.string(),\n line: z\n .int()\n .gte(0)\n .max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n })\n .nullish(),\n limit: z\n .int()\n .gte(0)\n .max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n })\n .nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Unique identifier for a tool call within a session.\n */\nexport const zToolCallId = z.string();\n/**\n * Categories of tools that can be invoked.\n *\n * Tool kinds help clients choose appropriate icons and optimize how they\n * display tool execution progress.\n *\n * See protocol docs: [Creating](https://agentclientprotocol.com/protocol/tool-calls#creating)\n */\nexport const zToolKind = z.union([\n z.literal(\"read\"),\n z.literal(\"edit\"),\n z.literal(\"delete\"),\n z.literal(\"move\"),\n z.literal(\"search\"),\n z.literal(\"execute\"),\n z.literal(\"think\"),\n z.literal(\"fetch\"),\n z.literal(\"switch_mode\"),\n z.literal(\"other\"),\n]);\n/**\n * Execution status of a tool call.\n *\n * Tool calls progress through different statuses during their lifecycle.\n *\n * See protocol docs: [Status](https://agentclientprotocol.com/protocol/tool-calls#status)\n */\nexport const zToolCallStatus = z.union([\n z.literal(\"pending\"),\n z.literal(\"in_progress\"),\n z.literal(\"completed\"),\n z.literal(\"failed\"),\n]);\n/**\n * The sender or recipient of messages and data in a conversation.\n */\nexport const zRole = z.union([z.literal(\"assistant\"), z.literal(\"user\")]);\n/**\n * Optional annotations for the client. The client can use annotations to inform how objects are used or displayed\n */\nexport const zAnnotations = z.object({\n audience: defaultOnError(vecSkipError(zRole).nullish(), () => undefined),\n lastModified: z.string().nullish(),\n priority: z.number().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Text provided to or from an LLM.\n */\nexport const zTextContent = z.object({\n annotations: defaultOnError(zAnnotations.nullish(), () => undefined),\n text: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * An image provided to or from an LLM.\n */\nexport const zImageContent = z.object({\n annotations: defaultOnError(zAnnotations.nullish(), () => undefined),\n data: z.string(),\n mimeType: z.string(),\n uri: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Audio provided to or from an LLM.\n */\nexport const zAudioContent = z.object({\n annotations: defaultOnError(zAnnotations.nullish(), () => undefined),\n data: z.string(),\n mimeType: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A resource that the server is capable of reading, included in a prompt or tool call result.\n */\nexport const zResourceLink = z.object({\n annotations: defaultOnError(zAnnotations.nullish(), () => undefined),\n description: z.string().nullish(),\n mimeType: z.string().nullish(),\n name: z.string(),\n size: z.number().nullish(),\n title: z.string().nullish(),\n uri: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Text-based resource contents.\n */\nexport const zTextResourceContents = z.object({\n mimeType: z.string().nullish(),\n text: z.string(),\n uri: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Binary resource contents.\n */\nexport const zBlobResourceContents = z.object({\n blob: z.string(),\n mimeType: z.string().nullish(),\n uri: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Resource content that can be embedded in a message.\n */\nexport const zEmbeddedResourceResource = z.union([\n zTextResourceContents,\n zBlobResourceContents,\n]);\n/**\n * The contents of a resource, embedded into a prompt or tool call result.\n */\nexport const zEmbeddedResource = z.object({\n annotations: defaultOnError(zAnnotations.nullish(), () => undefined),\n resource: zEmbeddedResourceResource,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Content blocks represent displayable information in the Agent Client Protocol.\n *\n * They provide a structured way to handle various types of user-facing content—whether\n * it's text from language models, images for analysis, or embedded resources for context.\n *\n * Content blocks appear in:\n * - User prompts sent via `session/prompt`\n * - Language model output streamed through `session/update` notifications\n * - Progress updates and results from tool calls\n *\n * This structure is compatible with the Model Context Protocol (MCP), enabling\n * agents to seamlessly forward content from MCP tool outputs without transformation.\n *\n * See protocol docs: [Content](https://agentclientprotocol.com/protocol/content)\n */\nexport const zContentBlock = z.union([\n zTextContent.and(z.object({\n type: z.literal(\"text\"),\n })),\n zImageContent.and(z.object({\n type: z.literal(\"image\"),\n })),\n zAudioContent.and(z.object({\n type: z.literal(\"audio\"),\n })),\n zResourceLink.and(z.object({\n type: z.literal(\"resource_link\"),\n })),\n zEmbeddedResource.and(z.object({\n type: z.literal(\"resource\"),\n })),\n]);\n/**\n * Standard content block (text, images, resources).\n */\nexport const zContent = z.object({\n content: zContentBlock,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A diff representing file modifications.\n *\n * Shows changes to files in a format suitable for display in the client UI.\n *\n * See protocol docs: [Content](https://agentclientprotocol.com/protocol/tool-calls#content)\n */\nexport const zDiff = z.object({\n path: z.string(),\n oldText: z.string().nullish(),\n newText: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Typed identifier used for terminal values on the wire.\n */\nexport const zTerminalId = z.string();\n/**\n * Embed a terminal created with `terminal/create` by its id.\n *\n * The terminal must be added before calling `terminal/release`.\n *\n * See protocol docs: [Terminal](https://agentclientprotocol.com/protocol/terminals)\n */\nexport const zTerminal = z.object({\n terminalId: zTerminalId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Content produced by a tool call.\n *\n * Tool calls can produce different types of content including\n * standard content blocks (text, images) or file diffs.\n *\n * See protocol docs: [Content](https://agentclientprotocol.com/protocol/tool-calls#content)\n */\nexport const zToolCallContent = z.union([\n zContent.and(z.object({\n type: z.literal(\"content\"),\n })),\n zDiff.and(z.object({\n type: z.literal(\"diff\"),\n })),\n zTerminal.and(z.object({\n type: z.literal(\"terminal\"),\n })),\n]);\n/**\n * A file location being accessed or modified by a tool.\n *\n * Enables clients to implement \"follow-along\" features that track\n * which files the agent is working with in real-time.\n *\n * See protocol docs: [Following the Agent](https://agentclientprotocol.com/protocol/tool-calls#following-the-agent)\n */\nexport const zToolCallLocation = z.object({\n path: z.string(),\n line: z\n .int()\n .gte(0)\n .max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n })\n .nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * An update to an existing tool call.\n *\n * Used to report progress and results as tools execute. All fields except\n * the tool call ID are optional - only changed fields need to be included.\n *\n * See protocol docs: [Updating](https://agentclientprotocol.com/protocol/tool-calls#updating)\n */\nexport const zToolCallUpdate = z.object({\n toolCallId: zToolCallId,\n kind: defaultOnError(zToolKind.nullish(), () => undefined),\n status: defaultOnError(zToolCallStatus.nullish(), () => undefined),\n title: z.string().nullish(),\n content: defaultOnError(vecSkipError(zToolCallContent).nullish(), () => undefined),\n locations: defaultOnError(vecSkipError(zToolCallLocation).nullish(), () => undefined),\n rawInput: z.unknown().optional(),\n rawOutput: z.unknown().optional(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Unique identifier for a permission option.\n */\nexport const zPermissionOptionId = z.string();\n/**\n * The type of permission option being presented to the user.\n *\n * Helps clients choose appropriate icons and UI treatment.\n */\nexport const zPermissionOptionKind = z.union([\n z.literal(\"allow_once\"),\n z.literal(\"allow_always\"),\n z.literal(\"reject_once\"),\n z.literal(\"reject_always\"),\n]);\n/**\n * An option presented to the user when requesting permission.\n */\nexport const zPermissionOption = z.object({\n optionId: zPermissionOptionId,\n name: z.string(),\n kind: zPermissionOptionKind,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request for user permission to execute a tool call.\n *\n * Sent when the agent needs authorization before performing a sensitive operation.\n *\n * See protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/tool-calls#requesting-permission)\n */\nexport const zRequestPermissionRequest = z.object({\n sessionId: zSessionId,\n toolCall: zToolCallUpdate,\n options: z.array(zPermissionOption),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * An environment variable to set when launching an MCP server.\n */\nexport const zEnvVariable = z.object({\n name: z.string(),\n value: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request to create a new terminal and execute a command.\n */\nexport const zCreateTerminalRequest = z.object({\n sessionId: zSessionId,\n command: z.string(),\n args: z.array(z.string()).optional(),\n env: z.array(zEnvVariable).optional(),\n cwd: z.string().nullish(),\n outputByteLimit: z.number().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request to get the current output and status of a terminal.\n */\nexport const zTerminalOutputRequest = z.object({\n sessionId: zSessionId,\n terminalId: zTerminalId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request to release a terminal and free its resources.\n */\nexport const zReleaseTerminalRequest = z.object({\n sessionId: zSessionId,\n terminalId: zTerminalId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request to wait for a terminal command to exit.\n */\nexport const zWaitForTerminalExitRequest = z.object({\n sessionId: zSessionId,\n terminalId: zTerminalId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request to kill a terminal without releasing it.\n */\nexport const zKillTerminalRequest = z.object({\n sessionId: zSessionId,\n terminalId: zTerminalId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Session-scoped elicitation, optionally tied to a specific tool call.\n *\n * When `tool_call_id` is set, the elicitation is tied to a specific tool call.\n * This is useful when an agent receives an elicitation from an MCP server\n * during a tool call and needs to redirect it to the user.\n *\n * @experimental\n */\nexport const zElicitationSessionScope = z.object({\n sessionId: zSessionId,\n toolCallId: zToolCallId.nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * 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).\n *\n * @experimental\n */\nexport const zElicitationRequestScope = z.object({\n requestId: zRequestId,\n});\n/**\n * Object schema type.\n */\nexport const zElicitationSchemaType = z.literal(\"object\");\n/**\n * String format types for string properties in elicitation schemas.\n */\nexport const zStringFormat = z.union([\n z.literal(\"email\"),\n z.literal(\"uri\"),\n z.literal(\"date\"),\n z.literal(\"date-time\"),\n]);\n/**\n * A titled enum option with a const value and human-readable title.\n */\nexport const zEnumOption = z.object({\n const: z.string(),\n title: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Schema for string properties in an elicitation form.\n *\n * When `enum` or `oneOf` is set, this represents a single-select enum\n * with `\"type\": \"string\"`.\n */\nexport const zStringPropertySchema = z.object({\n title: z.string().nullish(),\n description: z.string().nullish(),\n minLength: z\n .int()\n .gte(0)\n .max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n })\n .nullish(),\n maxLength: z\n .int()\n .gte(0)\n .max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n })\n .nullish(),\n pattern: z.string().nullish(),\n format: zStringFormat.nullish(),\n default: z.string().nullish(),\n enum: z.array(z.string()).nullish(),\n oneOf: z.array(zEnumOption).nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Schema for number (floating-point) properties in an elicitation form.\n */\nexport const zNumberPropertySchema = z.object({\n title: z.string().nullish(),\n description: z.string().nullish(),\n minimum: z.number().nullish(),\n maximum: z.number().nullish(),\n default: z.number().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Schema for integer properties in an elicitation form.\n */\nexport const zIntegerPropertySchema = z.object({\n title: z.string().nullish(),\n description: z.string().nullish(),\n minimum: z.number().nullish(),\n maximum: z.number().nullish(),\n default: z.number().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Schema for boolean properties in an elicitation form.\n */\nexport const zBooleanPropertySchema = z.object({\n title: z.string().nullish(),\n description: z.string().nullish(),\n default: z.boolean().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * String schema type.\n */\nexport const zElicitationStringType = z.literal(\"string\");\n/**\n * Items definition for untitled multi-select enum properties.\n */\nexport const zUntitledMultiSelectItems = z.object({\n type: zElicitationStringType,\n enum: z.array(z.string()),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Items definition for titled multi-select enum properties.\n */\nexport const zTitledMultiSelectItems = z.object({\n anyOf: z.array(zEnumOption),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Items for a multi-select (array) property schema.\n */\nexport const zMultiSelectItems = z.union([\n zUntitledMultiSelectItems,\n zTitledMultiSelectItems,\n]);\n/**\n * Schema for multi-select (array) properties in an elicitation form.\n */\nexport const zMultiSelectPropertySchema = z.object({\n title: z.string().nullish(),\n description: z.string().nullish(),\n minItems: z.number().nullish(),\n maxItems: z.number().nullish(),\n items: zMultiSelectItems,\n default: z.array(z.string()).nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Property schema for elicitation form fields.\n *\n * Each variant corresponds to a JSON Schema `\"type\"` value.\n * Single-select enums use the `String` variant with `enum` or `oneOf` set.\n * Multi-select enums use the `Array` variant.\n */\nexport const zElicitationPropertySchema = z.union([\n zStringPropertySchema.and(z.object({\n type: z.literal(\"string\"),\n })),\n zNumberPropertySchema.and(z.object({\n type: z.literal(\"number\"),\n })),\n zIntegerPropertySchema.and(z.object({\n type: z.literal(\"integer\"),\n })),\n zBooleanPropertySchema.and(z.object({\n type: z.literal(\"boolean\"),\n })),\n zMultiSelectPropertySchema.and(z.object({\n type: z.literal(\"array\"),\n })),\n]);\n/**\n * Type-safe elicitation schema for requesting structured user input.\n *\n * This represents a JSON Schema object with primitive-typed properties,\n * as required by the elicitation specification.\n */\nexport const zElicitationSchema = z.object({\n type: zElicitationSchemaType.optional().default(\"object\"),\n title: z.string().nullish(),\n properties: z\n .record(z.string(), zElicitationPropertySchema)\n .optional()\n .default({}),\n required: z.array(z.string()).nullish(),\n description: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Form-based elicitation mode where the client renders a form from the provided schema.\n *\n * @experimental\n */\nexport const zElicitationFormMode = z.intersection(z.union([zElicitationSessionScope, zElicitationRequestScope]), z.object({\n requestedSchema: zElicitationSchema,\n}));\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Unique identifier for an elicitation.\n *\n * @experimental\n */\nexport const zElicitationId = z.string();\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * URL-based elicitation mode where the client directs the user to a URL.\n *\n * @experimental\n */\nexport const zElicitationUrlMode = z.intersection(z.union([zElicitationSessionScope, zElicitationRequestScope]), z.object({\n elicitationId: zElicitationId,\n url: z.url(),\n}));\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Request from the agent to elicit structured user input.\n *\n * The agent sends this to the client to request information from the user,\n * either via a form or by directing them to a URL.\n * Elicitations are tied to a session (optionally a tool call) or a request.\n *\n * @experimental\n */\nexport const zCreateElicitationRequest = z.intersection(z.union([\n zElicitationFormMode.and(z.object({\n mode: z.literal(\"form\"),\n })),\n zElicitationUrlMode.and(z.object({\n mode: z.literal(\"url\"),\n })),\n]), z.object({\n message: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n}));\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Unique identifier for an MCP server using the ACP transport.\n *\n * The value is opaque and generated by the ACP component providing the MCP server. It is\n * used by `mcp/connect` to route connection requests back to the component that declared the\n * server.\n *\n * @experimental\n */\nexport const zMcpServerAcpId = z.string();\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Request parameters for `mcp/connect`.\n *\n * @experimental\n */\nexport const zConnectMcpRequest = z.object({\n acpId: zMcpServerAcpId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * A unique identifier for an active MCP-over-ACP connection.\n *\n * @experimental\n */\nexport const zMcpConnectionId = z.string();\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Request parameters for `mcp/message`.\n *\n * @experimental\n */\nexport const zMessageMcpRequest = z.object({\n connectionId: zMcpConnectionId,\n method: z.string(),\n params: z.record(z.string(), z.unknown()).nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Request parameters for `mcp/disconnect`.\n *\n * @experimental\n */\nexport const zDisconnectMcpRequest = z.object({\n connectionId: zMcpConnectionId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Allows for sending an arbitrary request that is not part of the ACP spec.\n * Extension methods provide a way to add custom functionality while maintaining\n * protocol compatibility.\n *\n * See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)\n */\nexport const zExtRequest = z.unknown();\n/**\n * A JSON-RPC request object.\n */\nexport const zAgentRequest = z.object({\n id: zRequestId,\n method: z.string(),\n params: z\n .union([\n zWriteTextFileRequest,\n zReadTextFileRequest,\n zRequestPermissionRequest,\n zCreateTerminalRequest,\n zTerminalOutputRequest,\n zReleaseTerminalRequest,\n zWaitForTerminalExitRequest,\n zKillTerminalRequest,\n zCreateElicitationRequest,\n zConnectMcpRequest,\n zMessageMcpRequest,\n zDisconnectMcpRequest,\n zExtRequest,\n ])\n .nullish(),\n});\n/**\n * Protocol version identifier.\n *\n * This version is only bumped for breaking changes.\n * Non-breaking changes should be introduced via capabilities.\n */\nexport const zProtocolVersion = z.int().gte(0).lte(65535);\n/**\n * Prompt capabilities supported by the agent in `session/prompt` requests.\n *\n * Baseline agent functionality requires support for [`ContentBlock::Text`]\n * and [`ContentBlock::ResourceLink`] in prompt requests.\n *\n * Other variants must be explicitly opted in to.\n * Capabilities for different types of content in prompt requests.\n *\n * Indicates which content types beyond the baseline (text and resource links)\n * the agent can process.\n *\n * See protocol docs: [Prompt Capabilities](https://agentclientprotocol.com/protocol/initialization#prompt-capabilities)\n */\nexport const zPromptCapabilities = z.object({\n image: z.boolean().optional().default(false),\n audio: z.boolean().optional().default(false),\n embeddedContext: z.boolean().optional().default(false),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * MCP capabilities supported by the agent\n */\nexport const zMcpCapabilities = z.object({\n http: z.boolean().optional().default(false),\n sse: z.boolean().optional().default(false),\n acp: z.boolean().optional().default(false),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for the `session/list` method.\n *\n * By supplying `{}` it means that the agent supports listing of sessions.\n */\nexport const zSessionListCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for the `session/delete` method.\n *\n * Supplying `{}` means the agent supports deleting sessions from `session/list`.\n */\nexport const zSessionDeleteCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for additional session directories support.\n *\n * By supplying `{}` it means that the agent supports the `additionalDirectories`\n * field on supported session lifecycle requests. Agents that also support\n * `session/list` may return `SessionInfo.additionalDirectories` to report the\n * complete ordered additional-root list associated with a listed session.\n */\nexport const zSessionAdditionalDirectoriesCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Capabilities for the `session/fork` method.\n *\n * By supplying `{}` it means that the agent supports forking of sessions.\n *\n * @experimental\n */\nexport const zSessionForkCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for the `session/resume` method.\n *\n * By supplying `{}` it means that the agent supports resuming of sessions.\n */\nexport const zSessionResumeCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for the `session/close` method.\n *\n * By supplying `{}` it means that the agent supports closing of sessions.\n */\nexport const zSessionCloseCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Session capabilities supported by the agent.\n *\n * As a baseline, all Agents **MUST** support `session/new`, `session/prompt`, `session/cancel`, and `session/update`.\n *\n * Optionally, they **MAY** support other session methods and notifications by specifying additional capabilities.\n *\n * Note: `session/load` is still handled by the top-level `load_session` capability. This will be unified in future versions of the protocol.\n *\n * See protocol docs: [Session Capabilities](https://agentclientprotocol.com/protocol/initialization#session-capabilities)\n */\nexport const zSessionCapabilities = z.object({\n list: defaultOnError(zSessionListCapabilities.nullish(), () => undefined),\n delete: defaultOnError(zSessionDeleteCapabilities.nullish(), () => undefined),\n additionalDirectories: defaultOnError(zSessionAdditionalDirectoriesCapabilities.nullish(), () => undefined),\n fork: defaultOnError(zSessionForkCapabilities.nullish(), () => undefined),\n resume: defaultOnError(zSessionResumeCapabilities.nullish(), () => undefined),\n close: defaultOnError(zSessionCloseCapabilities.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Logout capabilities supported by the agent.\n *\n * By supplying `{}` it means that the agent supports the logout method.\n */\nexport const zLogoutCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Authentication-related capabilities supported by the agent.\n */\nexport const zAgentAuthCapabilities = z.object({\n logout: defaultOnError(zLogoutCapabilities.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Provider configuration capabilities supported by the agent.\n *\n * By supplying `{}` it means that the agent supports provider configuration methods.\n *\n * @experimental\n */\nexport const zProvidersCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Marker for `document/didOpen` capability support.\n */\nexport const zNesDocumentDidOpenCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * How the agent wants document changes delivered.\n */\nexport const zTextDocumentSyncKind = z.union([\n z.literal(\"full\"),\n z.literal(\"incremental\"),\n]);\n/**\n * Capabilities for `document/didChange` events.\n */\nexport const zNesDocumentDidChangeCapabilities = z.object({\n syncKind: zTextDocumentSyncKind,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Marker for `document/didClose` capability support.\n */\nexport const zNesDocumentDidCloseCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Marker for `document/didSave` capability support.\n */\nexport const zNesDocumentDidSaveCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Marker for `document/didFocus` capability support.\n */\nexport const zNesDocumentDidFocusCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Document event capabilities the agent wants to receive.\n */\nexport const zNesDocumentEventCapabilities = z.object({\n didOpen: defaultOnError(zNesDocumentDidOpenCapabilities.nullish(), () => undefined),\n didChange: defaultOnError(zNesDocumentDidChangeCapabilities.nullish(), () => undefined),\n didClose: defaultOnError(zNesDocumentDidCloseCapabilities.nullish(), () => undefined),\n didSave: defaultOnError(zNesDocumentDidSaveCapabilities.nullish(), () => undefined),\n didFocus: defaultOnError(zNesDocumentDidFocusCapabilities.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Event capabilities the agent can consume.\n */\nexport const zNesEventCapabilities = z.object({\n document: defaultOnError(zNesDocumentEventCapabilities.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for recent files context.\n */\nexport const zNesRecentFilesCapabilities = z.object({\n maxCount: z\n .int()\n .gte(0)\n .max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n })\n .nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for related snippets context.\n */\nexport const zNesRelatedSnippetsCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for edit history context.\n */\nexport const zNesEditHistoryCapabilities = z.object({\n maxCount: z\n .int()\n .gte(0)\n .max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n })\n .nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for user actions context.\n */\nexport const zNesUserActionsCapabilities = z.object({\n maxCount: z\n .int()\n .gte(0)\n .max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n })\n .nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for open files context.\n */\nexport const zNesOpenFilesCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for diagnostics context.\n */\nexport const zNesDiagnosticsCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Context capabilities the agent wants attached to each suggestion request.\n */\nexport const zNesContextCapabilities = z.object({\n recentFiles: defaultOnError(zNesRecentFilesCapabilities.nullish(), () => undefined),\n relatedSnippets: defaultOnError(zNesRelatedSnippetsCapabilities.nullish(), () => undefined),\n editHistory: defaultOnError(zNesEditHistoryCapabilities.nullish(), () => undefined),\n userActions: defaultOnError(zNesUserActionsCapabilities.nullish(), () => undefined),\n openFiles: defaultOnError(zNesOpenFilesCapabilities.nullish(), () => undefined),\n diagnostics: defaultOnError(zNesDiagnosticsCapabilities.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * NES capabilities advertised by the agent during initialization.\n */\nexport const zNesCapabilities = z.object({\n events: defaultOnError(zNesEventCapabilities.nullish(), () => undefined),\n context: defaultOnError(zNesContextCapabilities.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * The encoding used for character offsets in positions.\n *\n * Follows the same conventions as LSP 3.17. The default is UTF-16.\n */\nexport const zPositionEncodingKind = z.union([\n z.literal(\"utf-16\"),\n z.literal(\"utf-32\"),\n z.literal(\"utf-8\"),\n]);\n/**\n * Capabilities supported by the agent.\n *\n * Advertised during initialization to inform the client about\n * available features and content types.\n *\n * See protocol docs: [Agent Capabilities](https://agentclientprotocol.com/protocol/initialization#agent-capabilities)\n */\nexport const zAgentCapabilities = z.object({\n loadSession: z.boolean().optional().default(false),\n promptCapabilities: zPromptCapabilities.optional().default({\n image: false,\n audio: false,\n embeddedContext: false,\n }),\n mcpCapabilities: zMcpCapabilities.optional().default({\n http: false,\n sse: false,\n acp: false,\n }),\n sessionCapabilities: zSessionCapabilities.optional().default({}),\n auth: zAgentAuthCapabilities.optional().default({}),\n providers: defaultOnError(zProvidersCapabilities.nullish(), () => undefined),\n nes: defaultOnError(zNesCapabilities.nullish(), () => undefined),\n positionEncoding: defaultOnError(zPositionEncodingKind.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Typed identifier used for auth method values on the wire.\n */\nexport const zAuthMethodId = z.string();\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Describes a single environment variable for an [`AuthMethodEnvVar`] authentication method.\n *\n * @experimental\n */\nexport const zAuthEnvVar = z.object({\n name: z.string(),\n label: z.string().nullish(),\n secret: z.boolean().optional().default(true),\n optional: z.boolean().optional().default(false),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Environment variable authentication method.\n *\n * The user provides credentials that the client passes to the agent as environment variables.\n *\n * @experimental\n */\nexport const zAuthMethodEnvVar = z.object({\n id: zAuthMethodId,\n name: z.string(),\n description: z.string().nullish(),\n vars: z.array(zAuthEnvVar),\n link: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Terminal-based authentication method.\n *\n * The client runs an interactive terminal for the user to authenticate via a TUI.\n *\n * @experimental\n */\nexport const zAuthMethodTerminal = z.object({\n id: zAuthMethodId,\n name: z.string(),\n description: z.string().nullish(),\n args: z.array(z.string()).optional(),\n env: z.record(z.string(), z.string()).optional(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Agent handles authentication itself.\n *\n * This is the default authentication method type.\n */\nexport const zAuthMethodAgent = z.object({\n id: zAuthMethodId,\n name: z.string(),\n description: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Describes an available authentication method.\n *\n * The `type` field acts as the discriminator in the serialized JSON form.\n * When no `type` is present, the method is treated as `agent`.\n */\nexport const zAuthMethod = z.union([\n zAuthMethodEnvVar.and(z.object({\n type: z.literal(\"env_var\"),\n })),\n zAuthMethodTerminal.and(z.object({\n type: z.literal(\"terminal\"),\n })),\n zAuthMethodAgent,\n]);\n/**\n * Metadata about the implementation of the client or agent.\n * Describes the name and version of an MCP implementation, with an optional\n * title for UI representation.\n */\nexport const zImplementation = z.object({\n name: z.string(),\n title: z.string().nullish(),\n version: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response to the `initialize` method.\n *\n * Contains the negotiated protocol version and agent capabilities.\n *\n * See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)\n */\nexport const zInitializeResponse = z.object({\n protocolVersion: zProtocolVersion,\n agentCapabilities: zAgentCapabilities.optional().default({\n loadSession: false,\n promptCapabilities: {\n image: false,\n audio: false,\n embeddedContext: false,\n },\n mcpCapabilities: {\n http: false,\n sse: false,\n acp: false,\n },\n sessionCapabilities: {},\n auth: {},\n }),\n authMethods: defaultOnError(vecSkipError(zAuthMethod).optional().default([]), () => []),\n agentInfo: defaultOnError(zImplementation.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response to the `authenticate` method.\n */\nexport const zAuthenticateResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Well-known API protocol identifiers for LLM providers.\n *\n * Agents and clients MUST handle unknown protocol identifiers gracefully.\n *\n * Protocol names beginning with `_` are free for custom use, like other ACP extension methods.\n * Protocol names that do not begin with `_` are reserved for the ACP spec.\n *\n * @experimental\n */\nexport const zLlmProtocol = z.union([\n z.literal(\"anthropic\"),\n z.literal(\"openai\"),\n z.literal(\"azure\"),\n z.literal(\"vertex\"),\n z.literal(\"bedrock\"),\n z.string(),\n]);\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Current effective non-secret routing configuration for a provider.\n *\n * @experimental\n */\nexport const zProviderCurrentConfig = z.object({\n apiType: zLlmProtocol,\n baseUrl: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Information about a configurable LLM provider.\n *\n * @experimental\n */\nexport const zProviderInfo = z.object({\n id: z.string(),\n supported: requiredDefaultOnError(vecSkipError(zLlmProtocol), () => []),\n required: z.boolean(),\n current: zProviderCurrentConfig.nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Response to `providers/list`.\n *\n * @experimental\n */\nexport const zListProvidersResponse = z.object({\n providers: requiredDefaultOnError(vecSkipError(zProviderInfo), () => []),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Response to `providers/set`.\n *\n * @experimental\n */\nexport const zSetProviderResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Response to `providers/disable`.\n *\n * @experimental\n */\nexport const zDisableProviderResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response to the `logout` method.\n */\nexport const zLogoutResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Unique identifier for a Session Mode.\n */\nexport const zSessionModeId = z.string();\n/**\n * A mode the agent can operate in.\n *\n * See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)\n */\nexport const zSessionMode = z.object({\n id: zSessionModeId,\n name: z.string(),\n description: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * The set of modes and the one currently active.\n */\nexport const zSessionModeState = z.object({\n currentModeId: zSessionModeId,\n availableModes: requiredDefaultOnError(vecSkipError(zSessionMode), () => []),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Unique identifier for a session configuration option.\n */\nexport const zSessionConfigId = z.string();\n/**\n * Semantic category for a session configuration option.\n *\n * This is intended to help Clients distinguish broadly common selectors (e.g. model selector vs\n * session mode selector vs thought/reasoning level) for UX purposes (keyboard shortcuts, icons,\n * placement). It MUST NOT be required for correctness. Clients MUST handle missing or unknown\n * categories gracefully.\n *\n * Category names beginning with `_` are free for custom use, like other ACP extension methods.\n * Category names that do not begin with `_` are reserved for the ACP spec.\n */\nexport const zSessionConfigOptionCategory = z.union([\n z.literal(\"mode\"),\n z.literal(\"model\"),\n z.literal(\"model_config\"),\n z.literal(\"thought_level\"),\n z.string(),\n]);\n/**\n * Unique identifier for a session configuration option value.\n */\nexport const zSessionConfigValueId = z.string();\n/**\n * A possible value for a session configuration option.\n */\nexport const zSessionConfigSelectOption = z.object({\n value: zSessionConfigValueId,\n name: z.string(),\n description: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Unique identifier for a session configuration option value group.\n */\nexport const zSessionConfigGroupId = z.string();\n/**\n * A group of possible values for a session configuration option.\n */\nexport const zSessionConfigSelectGroup = z.object({\n group: zSessionConfigGroupId,\n name: z.string(),\n options: z.array(zSessionConfigSelectOption),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Possible values for a session configuration option.\n */\nexport const zSessionConfigSelectOptions = z.union([\n z.array(zSessionConfigSelectOption),\n z.array(zSessionConfigSelectGroup),\n]);\n/**\n * A single-value selector (dropdown) session configuration option payload.\n */\nexport const zSessionConfigSelect = z.object({\n currentValue: zSessionConfigValueId,\n options: zSessionConfigSelectOptions,\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * A boolean on/off toggle session configuration option payload.\n *\n * @experimental\n */\nexport const zSessionConfigBoolean = z.object({\n currentValue: z.boolean(),\n});\n/**\n * A session configuration option selector and its current state.\n */\nexport const zSessionConfigOption = z.intersection(z.union([\n zSessionConfigSelect.and(z.object({\n type: z.literal(\"select\"),\n })),\n zSessionConfigBoolean.and(z.object({\n type: z.literal(\"boolean\"),\n })),\n]), z.object({\n id: zSessionConfigId,\n name: z.string(),\n description: z.string().nullish(),\n category: defaultOnError(zSessionConfigOptionCategory.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n}));\n/**\n * Response from creating a new session.\n *\n * See protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol/session-setup#creating-a-session)\n */\nexport const zNewSessionResponse = z.object({\n sessionId: zSessionId,\n modes: defaultOnError(zSessionModeState.nullish(), () => undefined),\n configOptions: defaultOnError(vecSkipError(zSessionConfigOption).nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response from loading an existing session.\n */\nexport const zLoadSessionResponse = z.object({\n modes: defaultOnError(zSessionModeState.nullish(), () => undefined),\n configOptions: defaultOnError(vecSkipError(zSessionConfigOption).nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Information about a session returned by session/list\n */\nexport const zSessionInfo = z.object({\n sessionId: zSessionId,\n cwd: z.string(),\n additionalDirectories: z.array(z.string()).optional(),\n title: defaultOnError(z.string().nullish(), () => undefined),\n updatedAt: defaultOnError(z.string().nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response from listing sessions.\n */\nexport const zListSessionsResponse = z.object({\n sessions: requiredDefaultOnError(vecSkipError(zSessionInfo), () => []),\n nextCursor: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response from deleting a session.\n */\nexport const zDeleteSessionResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Response from forking an existing session.\n *\n * @experimental\n */\nexport const zForkSessionResponse = z.object({\n sessionId: zSessionId,\n modes: defaultOnError(zSessionModeState.nullish(), () => undefined),\n configOptions: defaultOnError(vecSkipError(zSessionConfigOption).nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response from resuming an existing session.\n */\nexport const zResumeSessionResponse = z.object({\n modes: defaultOnError(zSessionModeState.nullish(), () => undefined),\n configOptions: defaultOnError(vecSkipError(zSessionConfigOption).nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response from closing a session.\n */\nexport const zCloseSessionResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response to `session/set_mode` method.\n */\nexport const zSetSessionModeResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response to `session/set_config_option` method.\n */\nexport const zSetSessionConfigOptionResponse = z.object({\n configOptions: requiredDefaultOnError(vecSkipError(zSessionConfigOption), () => []),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Reasons why an agent stops processing a prompt turn.\n *\n * See protocol docs: [Stop Reasons](https://agentclientprotocol.com/protocol/prompt-turn#stop-reasons)\n */\nexport const zStopReason = z.union([\n z.literal(\"end_turn\"),\n z.literal(\"max_tokens\"),\n z.literal(\"max_turn_requests\"),\n z.literal(\"refusal\"),\n z.literal(\"cancelled\"),\n]);\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Token usage information for a prompt turn.\n *\n * @experimental\n */\nexport const zUsage = z.object({\n totalTokens: z.number(),\n inputTokens: z.number(),\n outputTokens: z.number(),\n thoughtTokens: z.number().nullish(),\n cachedReadTokens: z.number().nullish(),\n cachedWriteTokens: z.number().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response from processing a user prompt.\n *\n * See protocol docs: [Check for Completion](https://agentclientprotocol.com/protocol/prompt-turn#4-check-for-completion)\n */\nexport const zPromptResponse = z.object({\n stopReason: zStopReason,\n usage: defaultOnError(zUsage.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response to `nes/start`.\n */\nexport const zStartNesResponse = z.object({\n sessionId: zSessionId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A zero-based position in a text document.\n *\n * The meaning of `character` depends on the negotiated position encoding.\n */\nexport const zPosition = z.object({\n line: z.int().gte(0).max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n }),\n character: z.int().gte(0).max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n }),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A range in a text document, expressed as start and end positions.\n */\nexport const zRange = z.object({\n start: zPosition,\n end: zPosition,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A text edit within a suggestion.\n */\nexport const zNesTextEdit = z.object({\n range: zRange,\n newText: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A text edit suggestion.\n */\nexport const zNesEditSuggestion = z.object({\n id: z.string(),\n uri: z.string(),\n edits: z.array(zNesTextEdit),\n cursorPosition: defaultOnError(zPosition.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A jump-to-location suggestion.\n */\nexport const zNesJumpSuggestion = z.object({\n id: z.string(),\n uri: z.string(),\n position: zPosition,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A rename symbol suggestion.\n */\nexport const zNesRenameSuggestion = z.object({\n id: z.string(),\n uri: z.string(),\n position: zPosition,\n newName: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A search-and-replace suggestion.\n */\nexport const zNesSearchAndReplaceSuggestion = z.object({\n id: z.string(),\n uri: z.string(),\n search: z.string(),\n replace: z.string(),\n isRegex: z.boolean().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A suggestion returned by the agent.\n */\nexport const zNesSuggestion = z.union([\n zNesEditSuggestion.and(z.object({\n kind: z.literal(\"edit\"),\n })),\n zNesJumpSuggestion.and(z.object({\n kind: z.literal(\"jump\"),\n })),\n zNesRenameSuggestion.and(z.object({\n kind: z.literal(\"rename\"),\n })),\n zNesSearchAndReplaceSuggestion.and(z.object({\n kind: z.literal(\"searchAndReplace\"),\n })),\n]);\n/**\n * Response to `nes/suggest`.\n */\nexport const zSuggestNesResponse = z.object({\n suggestions: requiredDefaultOnError(vecSkipError(zNesSuggestion), () => []),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response from closing an NES session.\n */\nexport const zCloseNesResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Allows for sending an arbitrary response to an [`ExtRequest`] that is not part of the ACP spec.\n * Extension methods provide a way to add custom functionality while maintaining\n * protocol compatibility.\n *\n * See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)\n */\nexport const zExtResponse = z.unknown();\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Response to `mcp/message`.\n *\n * This is the inner MCP response result payload. Any JSON value is valid.\n *\n * @experimental\n */\nexport const zMessageMcpResponse = z.unknown();\n/**\n * Predefined error codes for common JSON-RPC and ACP-specific errors.\n *\n * These codes follow the JSON-RPC 2.0 specification for standard errors\n * and use the reserved range (-32000 to -32099) for protocol-specific errors.\n */\nexport const zErrorCode = z.union([\n z.literal(-32700),\n z.literal(-32600),\n z.literal(-32601),\n z.literal(-32602),\n z.literal(-32603),\n z.literal(-32800),\n z.literal(-32000),\n z.literal(-32002),\n z.literal(-32042),\n z\n .int()\n .min(-2147483648, {\n error: \"Invalid value: Expected int32 to be >= -2147483648\",\n })\n .max(2147483647, {\n error: \"Invalid value: Expected int32 to be <= 2147483647\",\n }),\n]);\n/**\n * JSON-RPC error object.\n *\n * Represents an error that occurred during method execution, following the\n * JSON-RPC 2.0 error object specification with optional additional data.\n *\n * See protocol docs: [JSON-RPC Error Object](https://www.jsonrpc.org/specification#error_object)\n */\nexport const zError = z.object({\n code: zErrorCode,\n message: z.string(),\n data: z.unknown().optional(),\n});\n/**\n * A JSON-RPC response object.\n */\nexport const zAgentResponse = z.union([\n z.object({\n id: zRequestId,\n result: z.union([\n zInitializeResponse,\n zAuthenticateResponse,\n zListProvidersResponse,\n zSetProviderResponse,\n zDisableProviderResponse,\n zLogoutResponse,\n zNewSessionResponse,\n zLoadSessionResponse,\n zListSessionsResponse,\n zDeleteSessionResponse,\n zForkSessionResponse,\n zResumeSessionResponse,\n zCloseSessionResponse,\n zSetSessionModeResponse,\n zSetSessionConfigOptionResponse,\n zPromptResponse,\n zStartNesResponse,\n zSuggestNesResponse,\n zCloseNesResponse,\n zExtResponse,\n zMessageMcpResponse,\n ]),\n }),\n z.object({\n id: zRequestId,\n error: zError,\n }),\n]);\n/**\n * Unique identifier for a message within a session.\n */\nexport const zMessageId = z.string();\n/**\n * A streamed item of content\n */\nexport const zContentChunk = z.object({\n content: zContentBlock,\n messageId: zMessageId.nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Represents a tool call that the language model has requested.\n *\n * Tool calls are actions that the agent executes on behalf of the language model,\n * such as reading files, executing code, or fetching data from external sources.\n *\n * See protocol docs: [Tool Calls](https://agentclientprotocol.com/protocol/tool-calls)\n */\nexport const zToolCall = z.object({\n toolCallId: zToolCallId,\n title: z.string(),\n kind: zToolKind.optional(),\n status: zToolCallStatus.optional(),\n content: defaultOnError(vecSkipError(zToolCallContent).optional(), () => []),\n locations: defaultOnError(vecSkipError(zToolCallLocation).optional(), () => []),\n rawInput: z.unknown().optional(),\n rawOutput: z.unknown().optional(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Priority levels for plan entries.\n *\n * Used to indicate the relative importance or urgency of different\n * tasks in the execution plan.\n * See protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/agent-plan#plan-entries)\n */\nexport const zPlanEntryPriority = z.union([\n z.literal(\"high\"),\n z.literal(\"medium\"),\n z.literal(\"low\"),\n]);\n/**\n * Status of a plan entry in the execution flow.\n *\n * Tracks the lifecycle of each task from planning through completion.\n * See protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/agent-plan#plan-entries)\n */\nexport const zPlanEntryStatus = z.union([\n z.literal(\"pending\"),\n z.literal(\"in_progress\"),\n z.literal(\"completed\"),\n]);\n/**\n * A single entry in the execution plan.\n *\n * Represents a task or goal that the assistant intends to accomplish\n * as part of fulfilling the user's request.\n * See protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/agent-plan#plan-entries)\n */\nexport const zPlanEntry = z.object({\n content: z.string(),\n priority: zPlanEntryPriority,\n status: zPlanEntryStatus,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * An execution plan for accomplishing complex tasks.\n *\n * Plans consist of multiple entries representing individual tasks or goals.\n * Agents report plans to clients to provide visibility into their execution strategy.\n * Plans can evolve during execution as the agent discovers new requirements or completes tasks.\n *\n * See protocol docs: [Agent Plan](https://agentclientprotocol.com/protocol/agent-plan)\n */\nexport const zPlan = z.object({\n entries: requiredDefaultOnError(vecSkipError(zPlanEntry), () => []),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Unique identifier for a plan within a session.\n *\n * @experimental\n */\nexport const zPlanId = z.string();\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * A plan represented as structured entries.\n *\n * @experimental\n */\nexport const zPlanItems = z.object({\n id: zPlanId,\n entries: requiredDefaultOnError(vecSkipError(zPlanEntry), () => []),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * A plan represented by a file URI.\n *\n * @experimental\n */\nexport const zPlanFile = z.object({\n id: zPlanId,\n uri: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * A plan represented as raw markdown content.\n *\n * @experimental\n */\nexport const zPlanMarkdown = z.object({\n id: zPlanId,\n content: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Updated content for a plan.\n *\n * @experimental\n */\nexport const zPlanUpdateContent = z.union([\n zPlanItems.and(z.object({\n type: z.literal(\"items\"),\n })),\n zPlanFile.and(z.object({\n type: z.literal(\"file\"),\n })),\n zPlanMarkdown.and(z.object({\n type: z.literal(\"markdown\"),\n })),\n]);\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * A content update for a plan identified by ID.\n *\n * @experimental\n */\nexport const zPlanUpdate = z.object({\n plan: zPlanUpdateContent,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Removal notice for a plan identified by ID.\n *\n * @experimental\n */\nexport const zPlanRemoved = z.object({\n id: zPlanId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * All text that was typed after the command name is provided as input.\n */\nexport const zUnstructuredCommandInput = z.object({\n hint: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * unstructured\n *\n * All text that was typed after the command name is provided as input.\n */\nexport const zAvailableCommandInput = zUnstructuredCommandInput;\n/**\n * Information about a command.\n */\nexport const zAvailableCommand = z.object({\n name: z.string(),\n description: z.string(),\n input: defaultOnError(zAvailableCommandInput.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Available commands are ready or have changed\n */\nexport const zAvailableCommandsUpdate = z.object({\n availableCommands: requiredDefaultOnError(vecSkipError(zAvailableCommand), () => []),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * The current mode of the session has changed\n *\n * See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)\n */\nexport const zCurrentModeUpdate = z.object({\n currentModeId: zSessionModeId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Session configuration options have been updated.\n */\nexport const zConfigOptionUpdate = z.object({\n configOptions: requiredDefaultOnError(vecSkipError(zSessionConfigOption), () => []),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Update to session metadata. All fields are optional to support partial updates.\n *\n * Agents send this notification to update session information like title or custom metadata.\n * This allows clients to display dynamic session names and track session state changes.\n */\nexport const zSessionInfoUpdate = z.object({\n title: z.string().nullish(),\n updatedAt: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Cost information for a session.\n */\nexport const zCost = z.object({\n amount: z.number(),\n currency: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Context window and cost update for a session.\n */\nexport const zUsageUpdate = z.object({\n used: z.number(),\n size: z.number(),\n cost: defaultOnError(zCost.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Different types of updates that can be sent during session processing.\n *\n * These updates provide real-time feedback about the agent's progress.\n *\n * See protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)\n */\nexport const zSessionUpdate = z.union([\n zContentChunk.and(z.object({\n sessionUpdate: z.literal(\"user_message_chunk\"),\n })),\n zContentChunk.and(z.object({\n sessionUpdate: z.literal(\"agent_message_chunk\"),\n })),\n zContentChunk.and(z.object({\n sessionUpdate: z.literal(\"agent_thought_chunk\"),\n })),\n zToolCall.and(z.object({\n sessionUpdate: z.literal(\"tool_call\"),\n })),\n zToolCallUpdate.and(z.object({\n sessionUpdate: z.literal(\"tool_call_update\"),\n })),\n zPlan.and(z.object({\n sessionUpdate: z.literal(\"plan\"),\n })),\n zPlanUpdate.and(z.object({\n sessionUpdate: z.literal(\"plan_update\"),\n })),\n zPlanRemoved.and(z.object({\n sessionUpdate: z.literal(\"plan_removed\"),\n })),\n zAvailableCommandsUpdate.and(z.object({\n sessionUpdate: z.literal(\"available_commands_update\"),\n })),\n zCurrentModeUpdate.and(z.object({\n sessionUpdate: z.literal(\"current_mode_update\"),\n })),\n zConfigOptionUpdate.and(z.object({\n sessionUpdate: z.literal(\"config_option_update\"),\n })),\n zSessionInfoUpdate.and(z.object({\n sessionUpdate: z.literal(\"session_info_update\"),\n })),\n zUsageUpdate.and(z.object({\n sessionUpdate: z.literal(\"usage_update\"),\n })),\n]);\n/**\n * Notification containing a session update from the agent.\n *\n * Used to stream real-time progress and results during prompt processing.\n *\n * See protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)\n */\nexport const zSessionNotification = z.object({\n sessionId: zSessionId,\n update: zSessionUpdate,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notification sent by the agent when a URL-based elicitation is complete.\n *\n * @experimental\n */\nexport const zCompleteElicitationNotification = z.object({\n elicitationId: zElicitationId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notification parameters for `mcp/message`.\n *\n * This is used when the wrapped MCP message is a notification and the outer JSON-RPC\n * envelope has no `id`.\n *\n * @experimental\n */\nexport const zMessageMcpNotification = z.object({\n connectionId: zMcpConnectionId,\n method: z.string(),\n params: z.record(z.string(), z.unknown()).nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Allows the Agent to send an arbitrary notification that is not part of the ACP spec.\n * Extension notifications provide a way to send one-way messages for custom functionality\n * while maintaining protocol compatibility.\n *\n * See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)\n */\nexport const zExtNotification = z.unknown();\n/**\n * A JSON-RPC notification object.\n */\nexport const zAgentNotification = z.object({\n method: z.string(),\n params: z\n .union([\n zSessionNotification,\n zCompleteElicitationNotification,\n zMessageMcpNotification,\n zExtNotification,\n ])\n .nullish(),\n});\n/**\n * File system capabilities that a client may support.\n *\n * See protocol docs: [FileSystem](https://agentclientprotocol.com/protocol/initialization#filesystem)\n */\nexport const zFileSystemCapabilities = z.object({\n readTextFile: z.boolean().optional().default(false),\n writeTextFile: z.boolean().optional().default(false),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Capabilities for boolean session configuration options.\n *\n * Supplying `{}` means the client supports boolean session configuration options.\n *\n * @experimental\n */\nexport const zBooleanConfigOptionCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Session configuration option capabilities supported by the client.\n *\n * @experimental\n */\nexport const zSessionConfigOptionsCapabilities = z.object({\n boolean: defaultOnError(zBooleanConfigOptionCapabilities.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Session-related capabilities supported by the client.\n *\n * @experimental\n */\nexport const zClientSessionCapabilities = z.object({\n configOptions: defaultOnError(zSessionConfigOptionsCapabilities.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Capabilities for receiving `plan_update` and `plan_removed` session updates.\n *\n * @experimental\n */\nexport const zPlanCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Authentication capabilities supported by the client.\n *\n * Advertised during initialization to inform the agent which authentication\n * method types the client can handle. This governs opt-in types that require\n * additional client-side support.\n *\n * @experimental\n */\nexport const zAuthCapabilities = z.object({\n terminal: z.boolean().optional().default(false),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Form-based elicitation capabilities.\n *\n * @experimental\n */\nexport const zElicitationFormCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * URL-based elicitation capabilities.\n *\n * @experimental\n */\nexport const zElicitationUrlCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Elicitation capabilities supported by the client.\n *\n * @experimental\n */\nexport const zElicitationCapabilities = z.object({\n form: defaultOnError(zElicitationFormCapabilities.nullish(), () => undefined),\n url: defaultOnError(zElicitationUrlCapabilities.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Marker for jump suggestion support.\n */\nexport const zNesJumpCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Marker for rename suggestion support.\n */\nexport const zNesRenameCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Marker for search and replace suggestion support.\n */\nexport const zNesSearchAndReplaceCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * NES capabilities advertised by the client during initialization.\n */\nexport const zClientNesCapabilities = z.object({\n jump: defaultOnError(zNesJumpCapabilities.nullish(), () => undefined),\n rename: defaultOnError(zNesRenameCapabilities.nullish(), () => undefined),\n searchAndReplace: defaultOnError(zNesSearchAndReplaceCapabilities.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities supported by the client.\n *\n * Advertised during initialization to inform the agent about\n * available features and methods.\n *\n * See protocol docs: [Client Capabilities](https://agentclientprotocol.com/protocol/initialization#client-capabilities)\n */\nexport const zClientCapabilities = z.object({\n fs: zFileSystemCapabilities\n .optional()\n .default({ readTextFile: false, writeTextFile: false }),\n terminal: z.boolean().optional().default(false),\n session: defaultOnError(zClientSessionCapabilities.nullish(), () => undefined),\n plan: defaultOnError(zPlanCapabilities.nullish(), () => undefined),\n auth: zAuthCapabilities.optional().default({ terminal: false }),\n elicitation: defaultOnError(zElicitationCapabilities.nullish(), () => undefined),\n nes: defaultOnError(zClientNesCapabilities.nullish(), () => undefined),\n positionEncodings: defaultOnError(vecSkipError(zPositionEncodingKind).optional(), () => []),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request parameters for the initialize method.\n *\n * Sent by the client to establish connection and negotiate capabilities.\n *\n * See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)\n */\nexport const zInitializeRequest = z.object({\n protocolVersion: zProtocolVersion,\n clientCapabilities: zClientCapabilities.optional().default({\n fs: { readTextFile: false, writeTextFile: false },\n terminal: false,\n auth: { terminal: false },\n }),\n clientInfo: defaultOnError(zImplementation.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request parameters for the authenticate method.\n *\n * Specifies which authentication method to use.\n */\nexport const zAuthenticateRequest = z.object({\n methodId: zAuthMethodId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Request parameters for `providers/list`.\n *\n * @experimental\n */\nexport const zListProvidersRequest = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Request parameters for `providers/set`.\n *\n * Replaces the full configuration for one provider id.\n *\n * @experimental\n */\nexport const zSetProviderRequest = z.object({\n id: z.string(),\n apiType: zLlmProtocol,\n baseUrl: z.string(),\n headers: z.record(z.string(), z.string()).optional(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Request parameters for `providers/disable`.\n *\n * @experimental\n */\nexport const zDisableProviderRequest = z.object({\n id: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request parameters for the logout method.\n *\n * Terminates the current authenticated session.\n */\nexport const zLogoutRequest = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * An HTTP header to set when making requests to the MCP server.\n */\nexport const zHttpHeader = z.object({\n name: z.string(),\n value: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * HTTP transport configuration for MCP.\n */\nexport const zMcpServerHttp = z.object({\n name: z.string(),\n url: z.string(),\n headers: z.array(zHttpHeader),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * SSE transport configuration for MCP.\n */\nexport const zMcpServerSse = z.object({\n name: z.string(),\n url: z.string(),\n headers: z.array(zHttpHeader),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * ACP transport configuration for MCP.\n *\n * The MCP server is provided by an ACP component and communicates over the ACP channel\n * using `mcp/connect`, `mcp/message`, and `mcp/disconnect`.\n *\n * @experimental\n */\nexport const zMcpServerAcp = z.object({\n name: z.string(),\n id: zMcpServerAcpId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Stdio transport configuration for MCP.\n */\nexport const zMcpServerStdio = z.object({\n name: z.string(),\n command: z.string(),\n args: z.array(z.string()),\n env: z.array(zEnvVariable),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Configuration for connecting to an MCP (Model Context Protocol) server.\n *\n * MCP servers provide tools and context that the agent can use when\n * processing prompts.\n *\n * See protocol docs: [MCP Servers](https://agentclientprotocol.com/protocol/session-setup#mcp-servers)\n */\nexport const zMcpServer = z.union([\n zMcpServerHttp.and(z.object({\n type: z.literal(\"http\"),\n })),\n zMcpServerSse.and(z.object({\n type: z.literal(\"sse\"),\n })),\n zMcpServerAcp.and(z.object({\n type: z.literal(\"acp\"),\n })),\n zMcpServerStdio,\n]);\n/**\n * Request parameters for creating a new session.\n *\n * See protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol/session-setup#creating-a-session)\n */\nexport const zNewSessionRequest = z.object({\n cwd: z.string(),\n additionalDirectories: z.array(z.string()).optional(),\n mcpServers: z.array(zMcpServer),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request parameters for loading an existing session.\n *\n * Only available if the Agent supports the `loadSession` capability.\n *\n * See protocol docs: [Loading Sessions](https://agentclientprotocol.com/protocol/session-setup#loading-sessions)\n */\nexport const zLoadSessionRequest = z.object({\n mcpServers: z.array(zMcpServer),\n cwd: z.string(),\n additionalDirectories: z.array(z.string()).optional(),\n sessionId: zSessionId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request parameters for listing existing sessions.\n *\n * Only available if the Agent supports the `sessionCapabilities.list` capability.\n */\nexport const zListSessionsRequest = z.object({\n cwd: z.string().nullish(),\n cursor: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request parameters for deleting an existing session from `session/list`.\n *\n * Only available if the Agent supports the `sessionCapabilities.delete` capability.\n */\nexport const zDeleteSessionRequest = z.object({\n sessionId: zSessionId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Request parameters for forking an existing session.\n *\n * Creates a new session based on the context of an existing one, allowing\n * operations like generating summaries without affecting the original session's history.\n *\n * Only available if the Agent supports the `session.fork` capability.\n *\n * @experimental\n */\nexport const zForkSessionRequest = z.object({\n sessionId: zSessionId,\n cwd: z.string(),\n additionalDirectories: z.array(z.string()).optional(),\n mcpServers: z.array(zMcpServer).optional(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request parameters for resuming an existing session.\n *\n * Resumes an existing session without returning previous messages (unlike `session/load`).\n * This is useful for agents that can resume sessions but don't implement full session loading.\n *\n * Only available if the Agent supports the `sessionCapabilities.resume` capability.\n */\nexport const zResumeSessionRequest = z.object({\n sessionId: zSessionId,\n cwd: z.string(),\n additionalDirectories: z.array(z.string()).optional(),\n mcpServers: z.array(zMcpServer).optional(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request parameters for closing an active session.\n *\n * If supported, the agent **must** cancel any ongoing work related to the session\n * (treat it as if `session/cancel` was called) and then free up any resources\n * associated with the session.\n *\n * Only available if the Agent supports the `sessionCapabilities.close` capability.\n */\nexport const zCloseSessionRequest = z.object({\n sessionId: zSessionId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request parameters for setting a session mode.\n */\nexport const zSetSessionModeRequest = z.object({\n sessionId: zSessionId,\n modeId: zSessionModeId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request parameters for setting a session configuration option.\n */\nexport const zSetSessionConfigOptionRequest = z.intersection(z.union([\n z.object({\n value: z.boolean(),\n type: z.literal(\"boolean\"),\n }),\n z.object({\n value: zSessionConfigValueId,\n }),\n]), z.object({\n sessionId: zSessionId,\n configId: zSessionConfigId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n}));\n/**\n * Request parameters for sending a user prompt to the agent.\n *\n * Contains the user's message and any additional context.\n *\n * See protocol docs: [User Message](https://agentclientprotocol.com/protocol/prompt-turn#1-user-message)\n */\nexport const zPromptRequest = z.object({\n sessionId: zSessionId,\n prompt: z.array(zContentBlock),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A workspace folder.\n */\nexport const zWorkspaceFolder = z.object({\n uri: z.string(),\n name: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Repository metadata for an NES session.\n */\nexport const zNesRepository = z.object({\n name: z.string(),\n owner: z.string(),\n remoteUrl: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request to start an NES session.\n */\nexport const zStartNesRequest = z.object({\n workspaceUri: z.string().nullish(),\n workspaceFolders: defaultOnError(vecSkipError(zWorkspaceFolder).nullish(), () => undefined),\n repository: defaultOnError(zNesRepository.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * What triggered the suggestion request.\n */\nexport const zNesTriggerKind = z.union([\n z.literal(\"automatic\"),\n z.literal(\"diagnostic\"),\n z.literal(\"manual\"),\n]);\n/**\n * A recently accessed file.\n */\nexport const zNesRecentFile = z.object({\n uri: z.string(),\n languageId: z.string(),\n text: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A code excerpt from a file.\n */\nexport const zNesExcerpt = z.object({\n startLine: z.int().gte(0).max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n }),\n endLine: z.int().gte(0).max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n }),\n text: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A related code snippet from a file.\n */\nexport const zNesRelatedSnippet = z.object({\n uri: z.string(),\n excerpts: z.array(zNesExcerpt),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * An entry in the edit history.\n */\nexport const zNesEditHistoryEntry = z.object({\n uri: z.string(),\n diff: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A user action (typing, cursor movement, etc.).\n */\nexport const zNesUserAction = z.object({\n action: z.string(),\n uri: z.string(),\n position: zPosition,\n timestampMs: z.number(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * An open file in the editor.\n */\nexport const zNesOpenFile = z.object({\n uri: z.string(),\n languageId: z.string(),\n visibleRange: defaultOnError(zRange.nullish(), () => undefined),\n lastFocusedMs: defaultOnError(z.number().nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Severity of a diagnostic.\n */\nexport const zNesDiagnosticSeverity = z.union([\n z.literal(\"error\"),\n z.literal(\"warning\"),\n z.literal(\"information\"),\n z.literal(\"hint\"),\n]);\n/**\n * A diagnostic (error, warning, etc.).\n */\nexport const zNesDiagnostic = z.object({\n uri: z.string(),\n range: zRange,\n severity: zNesDiagnosticSeverity,\n message: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Context attached to a suggestion request.\n */\nexport const zNesSuggestContext = z.object({\n recentFiles: defaultOnError(vecSkipError(zNesRecentFile).nullish(), () => undefined),\n relatedSnippets: defaultOnError(vecSkipError(zNesRelatedSnippet).nullish(), () => undefined),\n editHistory: defaultOnError(vecSkipError(zNesEditHistoryEntry).nullish(), () => undefined),\n userActions: defaultOnError(vecSkipError(zNesUserAction).nullish(), () => undefined),\n openFiles: defaultOnError(vecSkipError(zNesOpenFile).nullish(), () => undefined),\n diagnostics: defaultOnError(vecSkipError(zNesDiagnostic).nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request for a code suggestion.\n */\nexport const zSuggestNesRequest = z.object({\n sessionId: zSessionId,\n uri: z.string(),\n version: z.number(),\n position: zPosition,\n selection: defaultOnError(zRange.nullish(), () => undefined),\n triggerKind: zNesTriggerKind,\n context: defaultOnError(zNesSuggestContext.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request to close an NES session.\n *\n * The agent **must** cancel any ongoing work related to the NES session\n * and then free up any resources associated with the session.\n */\nexport const zCloseNesRequest = z.object({\n sessionId: zSessionId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A JSON-RPC request object.\n */\nexport const zClientRequest = z.object({\n id: zRequestId,\n method: z.string(),\n params: z\n .union([\n zInitializeRequest,\n zAuthenticateRequest,\n zListProvidersRequest,\n zSetProviderRequest,\n zDisableProviderRequest,\n zLogoutRequest,\n zNewSessionRequest,\n zLoadSessionRequest,\n zListSessionsRequest,\n zDeleteSessionRequest,\n zForkSessionRequest,\n zResumeSessionRequest,\n zCloseSessionRequest,\n zSetSessionModeRequest,\n zSetSessionConfigOptionRequest,\n zPromptRequest,\n zStartNesRequest,\n zSuggestNesRequest,\n zCloseNesRequest,\n zMessageMcpRequest,\n zExtRequest,\n ])\n .nullish(),\n});\n/**\n * Response to `fs/write_text_file`\n */\nexport const zWriteTextFileResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response containing the contents of a text file.\n */\nexport const zReadTextFileResponse = z.object({\n content: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * The user selected one of the provided options.\n */\nexport const zSelectedPermissionOutcome = z.object({\n optionId: zPermissionOptionId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * The outcome of a permission request.\n */\nexport const zRequestPermissionOutcome = z.union([\n z.object({\n outcome: z.literal(\"cancelled\"),\n }),\n zSelectedPermissionOutcome.and(z.object({\n outcome: z.literal(\"selected\"),\n })),\n]);\n/**\n * Response to a permission request.\n */\nexport const zRequestPermissionResponse = z.object({\n outcome: zRequestPermissionOutcome,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response containing the ID of the created terminal.\n */\nexport const zCreateTerminalResponse = z.object({\n terminalId: zTerminalId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Exit status of a terminal command.\n */\nexport const zTerminalExitStatus = z.object({\n exitCode: z\n .int()\n .gte(0)\n .max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n })\n .nullish(),\n signal: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response containing the terminal output and exit status.\n */\nexport const zTerminalOutputResponse = z.object({\n output: z.string(),\n truncated: z.boolean(),\n exitStatus: zTerminalExitStatus.nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response to terminal/release method\n */\nexport const zReleaseTerminalResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response containing the exit status of a terminal command.\n */\nexport const zWaitForTerminalExitResponse = z.object({\n exitCode: z\n .int()\n .gte(0)\n .max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n })\n .nullish(),\n signal: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response to `terminal/kill` method\n */\nexport const zKillTerminalResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Allowed wire representations for [`ElicitationContentValue`].\n */\nexport const zElicitationContentValue = z.union([\n z.string(),\n z.number(),\n z.number(),\n z.boolean(),\n z.array(z.string()),\n]);\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * The user accepted the elicitation and provided content.\n *\n * @experimental\n */\nexport const zElicitationAcceptAction = z.object({\n content: z.record(z.string(), zElicitationContentValue).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Response from the client to an elicitation request.\n *\n * @experimental\n */\nexport const zCreateElicitationResponse = z.intersection(z.union([\n zElicitationAcceptAction.and(z.object({\n action: z.literal(\"accept\"),\n })),\n z.object({\n action: z.literal(\"decline\"),\n }),\n z.object({\n action: z.literal(\"cancel\"),\n }),\n]), z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n}));\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Response to `mcp/connect`.\n *\n * @experimental\n */\nexport const zConnectMcpResponse = z.object({\n connectionId: zMcpConnectionId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Response to `mcp/disconnect`.\n *\n * @experimental\n */\nexport const zDisconnectMcpResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A JSON-RPC response object.\n */\nexport const zClientResponse = z.union([\n z.object({\n id: zRequestId,\n result: z.union([\n zWriteTextFileResponse,\n zReadTextFileResponse,\n zRequestPermissionResponse,\n zCreateTerminalResponse,\n zTerminalOutputResponse,\n zReleaseTerminalResponse,\n zWaitForTerminalExitResponse,\n zKillTerminalResponse,\n zCreateElicitationResponse,\n zConnectMcpResponse,\n zDisconnectMcpResponse,\n zExtResponse,\n zMessageMcpResponse,\n ]),\n }),\n z.object({\n id: zRequestId,\n error: zError,\n }),\n]);\n/**\n * Notification to cancel ongoing operations for a session.\n *\n * See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation)\n */\nexport const zCancelNotification = z.object({\n sessionId: zSessionId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Notification sent when a file is opened in the editor.\n */\nexport const zDidOpenDocumentNotification = z.object({\n sessionId: zSessionId,\n uri: z.string(),\n languageId: z.string(),\n version: z.number(),\n text: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A content change event for a document.\n *\n * When `range` is `None`, `text` is the full content of the document.\n * When `range` is `Some`, `text` replaces the given range.\n */\nexport const zTextDocumentContentChangeEvent = z.object({\n range: zRange.nullish(),\n text: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Notification sent when a file is edited.\n */\nexport const zDidChangeDocumentNotification = z.object({\n sessionId: zSessionId,\n uri: z.string(),\n version: z.number(),\n contentChanges: z.array(zTextDocumentContentChangeEvent),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Notification sent when a file is closed.\n */\nexport const zDidCloseDocumentNotification = z.object({\n sessionId: zSessionId,\n uri: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Notification sent when a file is saved.\n */\nexport const zDidSaveDocumentNotification = z.object({\n sessionId: zSessionId,\n uri: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Notification sent when a file becomes the active editor tab.\n */\nexport const zDidFocusDocumentNotification = z.object({\n sessionId: zSessionId,\n uri: z.string(),\n version: z.number(),\n position: zPosition,\n visibleRange: zRange,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Notification sent when a suggestion is accepted.\n */\nexport const zAcceptNesNotification = z.object({\n sessionId: zSessionId,\n id: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * The reason a suggestion was rejected.\n */\nexport const zNesRejectReason = z.union([\n z.literal(\"rejected\"),\n z.literal(\"ignored\"),\n z.literal(\"replaced\"),\n z.literal(\"cancelled\"),\n]);\n/**\n * Notification sent when a suggestion is rejected.\n */\nexport const zRejectNesNotification = z.object({\n sessionId: zSessionId,\n id: z.string(),\n reason: defaultOnError(zNesRejectReason.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A JSON-RPC notification object.\n */\nexport const zClientNotification = z.object({\n method: z.string(),\n params: z\n .union([\n zCancelNotification,\n zDidOpenDocumentNotification,\n zDidChangeDocumentNotification,\n zDidCloseDocumentNotification,\n zDidSaveDocumentNotification,\n zDidFocusDocumentNotification,\n zAcceptNesNotification,\n zRejectNesNotification,\n zMessageMcpNotification,\n zExtNotification,\n ])\n .nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notification to cancel an ongoing request.\n *\n * See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)\n *\n * @experimental\n */\nexport const zCancelRequestNotification = z.object({\n requestId: zRequestId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n//# sourceMappingURL=zod.gen.js.map","/**\n * Creates an ACP Stream from a pair of newline-delimited JSON streams.\n *\n * This is the typical way to handle ACP connections over stdio, converting\n * between AnyMessage objects and newline-delimited JSON.\n *\n * @param output - The writable stream to send encoded messages to\n * @param input - The readable stream to receive encoded messages from\n * @returns A Stream for bidirectional ACP communication\n */\nexport function ndJsonStream(output, input) {\n const textEncoder = new TextEncoder();\n const textDecoder = new TextDecoder();\n let cancelled = false;\n let inputReader;\n const readable = new ReadableStream({\n async start(controller) {\n let content = \"\";\n const reader = input.getReader();\n inputReader = reader;\n try {\n while (true) {\n const { value, done } = await reader.read();\n if (cancelled) {\n return;\n }\n if (done) {\n content += textDecoder.decode();\n break;\n }\n if (!value) {\n continue;\n }\n content += textDecoder.decode(value, { stream: true });\n const lines = content.split(\"\\n\");\n content = lines.pop() || \"\";\n for (const line of lines) {\n if (cancelled) {\n return;\n }\n const trimmedLine = line.trim();\n if (trimmedLine) {\n try {\n const message = JSON.parse(trimmedLine);\n controller.enqueue(message);\n }\n catch (err) {\n console.error(\"Failed to parse JSON message:\", trimmedLine, err);\n }\n }\n }\n }\n if (cancelled) {\n return;\n }\n const trimmedLine = content.trim();\n if (trimmedLine) {\n try {\n const message = JSON.parse(trimmedLine);\n controller.enqueue(message);\n }\n catch (err) {\n console.error(\"Failed to parse JSON message:\", trimmedLine, err);\n }\n }\n }\n catch (err) {\n if (cancelled) {\n return;\n }\n controller.error(err);\n return;\n }\n finally {\n if (inputReader === reader) {\n inputReader = undefined;\n }\n reader.releaseLock();\n }\n if (cancelled) {\n return;\n }\n controller.close();\n },\n cancel(reason) {\n cancelled = true;\n return inputReader?.cancel(reason);\n },\n });\n const writable = new WritableStream({\n async write(message) {\n const content = JSON.stringify(message) + \"\\n\";\n const writer = output.getWriter();\n try {\n await writer.write(textEncoder.encode(content));\n }\n finally {\n writer.releaseLock();\n }\n },\n });\n return { readable, writable };\n}\n//# sourceMappingURL=stream.js.map","const CANCEL_REQUEST_METHOD = \"$/cancel_request\";\nexport function isJsonRpcMessage(value) {\n return (isRequestMessage(value) ||\n isResponseMessage(value) ||\n isNotificationMessage(value));\n}\nexport function isRequestMessage(value) {\n return (isJsonRpcEnvelope(value) &&\n \"id\" in value &&\n typeof value[\"method\"] === \"string\" &&\n isJsonRpcId(value[\"id\"]));\n}\nexport function isResponseMessage(value) {\n if (!isJsonRpcEnvelope(value) || \"method\" in value) {\n return false;\n }\n if (!(\"id\" in value) || !isJsonRpcId(value[\"id\"])) {\n return false;\n }\n const hasResult = Object.hasOwn(value, \"result\");\n const hasError = Object.hasOwn(value, \"error\");\n if (hasResult === hasError) {\n return false;\n }\n return !hasError || isErrorResponse(value[\"error\"]);\n}\nexport function isNotificationMessage(value) {\n return (isJsonRpcEnvelope(value) &&\n !(\"id\" in value) &&\n typeof value[\"method\"] === \"string\");\n}\nexport function isRecord(value) {\n return typeof value === \"object\" && value !== null;\n}\nfunction isJsonRpcEnvelope(value) {\n return isRecord(value) && value[\"jsonrpc\"] === \"2.0\";\n}\nfunction isJsonRpcId(value) {\n return (value === null ||\n typeof value === \"string\" ||\n (typeof value === \"number\" && Number.isFinite(value)));\n}\nfunction cancelRequestId(params) {\n if (!isRecord(params) || !isJsonRpcId(params[\"requestId\"])) {\n return undefined;\n }\n return params[\"requestId\"];\n}\nfunction isErrorResponse(value) {\n return (isRecord(value) &&\n typeof value[\"code\"] === \"number\" &&\n Number.isInteger(value[\"code\"]) &&\n typeof value[\"message\"] === \"string\");\n}\n/**\n * Helpers for constructing `HandleResult` values.\n */\nexport const Handled = {\n /**\n * Marks a message as handled.\n */\n yes() {\n return { handled: true };\n },\n /**\n * Leaves a message unhandled so later handlers can process it.\n */\n no(message, retry = false) {\n return { handled: false, message, retry };\n },\n};\nfunction rejectedPromise(error) {\n const promise = Promise.reject(error);\n promise.catch(() => { });\n return promise;\n}\nfunction errorDetails(error) {\n if (error instanceof Error) {\n return error.message;\n }\n if (typeof error === \"object\" &&\n error != null &&\n \"message\" in error &&\n typeof error.message === \"string\") {\n return error.message;\n }\n return undefined;\n}\nfunction isZodError(error) {\n return (typeof error === \"object\" &&\n error !== null &&\n \"name\" in error &&\n error.name === \"ZodError\" &&\n \"issues\" in error &&\n Array.isArray(error.issues) &&\n \"format\" in error &&\n typeof error.format === \"function\");\n}\nfunction errorToResult(error) {\n if (error instanceof RequestError) {\n return error.toResult();\n }\n if (isZodError(error)) {\n return RequestError.invalidParams(error.format()).toResult();\n }\n const details = errorDetails(error);\n try {\n return RequestError.internalError(details ? JSON.parse(details) : {}).toResult();\n }\n catch {\n return RequestError.internalError({ details }).toResult();\n }\n}\nfunction requestCancelledError(reason) {\n if (reason instanceof RequestError && reason.code === -32800) {\n return reason;\n }\n return RequestError.requestCancelled(reason);\n}\nfunction errorToRequestResult(error, signal) {\n const requestCancelled = abortErrorToRequestCancelled(error, signal);\n return requestCancelled ? requestCancelled.toResult() : errorToResult(error);\n}\nfunction abortErrorToRequestCancelled(error, signal) {\n if (!signal.aborted || !isAbortError(error)) {\n return undefined;\n }\n return requestCancelledError(signal.reason);\n}\nfunction isAbortError(error) {\n if (typeof error !== \"object\" || error === null) {\n return false;\n }\n const maybeAbortError = error;\n return (maybeAbortError.name === \"AbortError\" ||\n maybeAbortError.code === \"ABORT_ERR\");\n}\n/**\n * Responder for one incoming JSON-RPC request.\n *\n * Handlers may use this when they need to decide exactly when or how the\n * response is sent.\n */\nexport class RequestResponder {\n id;\n sendResult;\n signal;\n finishRequest;\n didRespond = false;\n constructor(\n /**\n * Request ID to include in the response.\n */\n id, sendResult, \n /**\n * AbortSignal for this incoming request.\n */\n signal = new AbortController().signal, finishRequest) {\n this.id = id;\n this.sendResult = sendResult;\n this.signal = signal;\n this.finishRequest = finishRequest;\n }\n /**\n * Whether this request has already received a response.\n */\n get responded() {\n return this.didRespond;\n }\n /**\n * Sends a successful JSON-RPC response.\n */\n respond(response) {\n return this.respondWithResult({ result: (response ?? null) });\n }\n /**\n * Sends an error JSON-RPC response.\n */\n respondWithError(error) {\n const errorResponse = error instanceof RequestError ? error.toErrorResponse() : error;\n return this.respondWithResult({ error: errorResponse });\n }\n /**\n * Sends a complete JSON-RPC result payload.\n */\n respondWithResult(result) {\n if (this.didRespond) {\n return rejectedPromise(new Error(\"JSON-RPC request already responded\"));\n }\n this.didRespond = true;\n return this.sendResult(result).finally(() => {\n this.finishRequest?.();\n });\n }\n}\n/**\n * Disposable handle returned when a handler is registered dynamically.\n */\nexport class HandlerRegistration {\n disposeHandler;\n active = true;\n constructor(disposeHandler) {\n this.disposeHandler = disposeHandler;\n }\n /**\n * Unregisters the associated handler.\n */\n dispose() {\n if (!this.active) {\n return;\n }\n this.active = false;\n this.disposeHandler();\n }\n /**\n * Supports explicit resource management with `using`.\n */\n [Symbol.dispose]() {\n this.dispose();\n }\n /**\n * Returns this registration for call sites that intentionally keep it active.\n */\n runIndefinitely() {\n return this;\n }\n}\n/**\n * Per-connection context passed to low-level JSON-RPC handlers.\n */\nexport class ConnectionContext {\n connection;\n constructor(connection) {\n this.connection = connection;\n }\n /**\n * Sends a request over the connection.\n */\n sendRequest(method, params, mapResponse, options) {\n return this.connection.sendRequest(method, params, mapResponse, options);\n }\n /**\n * Sends a notification over the connection.\n */\n sendNotification(method, params) {\n return this.connection.sendNotification(method, params);\n }\n /**\n * Sends a protocol-level request cancellation notification.\n */\n sendCancelRequest(requestId) {\n return this.connection.sendCancelRequest(requestId);\n }\n /**\n * Registers a handler that can be disposed independently.\n */\n addDynamicHandler(handler) {\n return this.connection.addDynamicHandler(handler);\n }\n /**\n * AbortSignal that aborts when the connection closes.\n */\n get signal() {\n return this.connection.signal;\n }\n /**\n * Promise that resolves when the connection closes.\n */\n get closed() {\n return this.connection.closed;\n }\n}\n/**\n * Lower-level JSON-RPC connection over an ACP `Stream`.\n *\n * Most ACP integrations should use `agent(...)` or `client(...)`. Use this\n * class when building generic JSON-RPC middleware or custom dispatch behavior.\n */\nexport class Connection {\n pendingResponses = new Map();\n incomingRequests = new Map();\n nextRequestId = 0;\n staticHandlers = [];\n dynamicHandlers = new Set();\n stream;\n writeQueue = Promise.resolve();\n abortController = new AbortController();\n closedPromise;\n retryQueue = [];\n context = new ConnectionContext(this);\n receiveReader;\n constructor(requestHandlerOrStream, notificationHandlerOrHandlers, streamOrOptions, options) {\n if (typeof requestHandlerOrStream === \"function\") {\n const requestHandler = requestHandlerOrStream;\n const notificationHandler = notificationHandlerOrHandlers;\n const stream = streamOrOptions;\n this.initialize(stream, [\n ...(options?.handlers ?? []),\n this.legacyHandler(requestHandler, notificationHandler),\n ]);\n return;\n }\n const stream = requestHandlerOrStream;\n const handlers = notificationHandlerOrHandlers;\n const connectionOptions = streamOrOptions;\n this.initialize(stream, [\n ...(connectionOptions?.handlers ?? []),\n ...handlers,\n ]);\n }\n /**\n * Creates a builder for configuring a handler-based connection.\n */\n static builder() {\n return new ConnectionBuilder();\n }\n /**\n * Runs an operation while the connection is open, then closes the connection.\n *\n * If the stream closes before `op` settles, the returned promise rejects with\n * the connection close reason.\n */\n runUntil(op) {\n let opSettled = false;\n const opPromise = Promise.resolve()\n .then(() => op(this.context))\n .finally(() => {\n opSettled = true;\n });\n const closedPromise = this.closed.then(() => {\n if (opSettled) {\n return new Promise(() => { });\n }\n throw this.closedReason();\n });\n return Promise.race([opPromise, closedPromise]).finally(() => {\n opSettled = true;\n this.close();\n });\n }\n /**\n * Adds a handler after the connection has started.\n *\n * Any messages queued with `Handled.no(message, true)` are retried after the\n * handler is added.\n */\n addDynamicHandler(handler) {\n this.dynamicHandlers.add(handler);\n if (this.retryQueue.length > 0) {\n for (const message of this.retryQueue.splice(0)) {\n void this.processIncomingMessage(message).catch((error) => this.close(error));\n }\n }\n return new HandlerRegistration(() => {\n this.dynamicHandlers.delete(handler);\n });\n }\n /**\n * AbortSignal that aborts when the connection closes.\n */\n get signal() {\n return this.abortController.signal;\n }\n /**\n * Promise that resolves when the connection closes.\n */\n get closed() {\n return this.closedPromise;\n }\n /** @internal */\n getContext() {\n return this.context;\n }\n /**\n * Sends a JSON-RPC request.\n *\n * `mapResponse` can convert the raw result before the returned promise\n * resolves.\n */\n sendRequest(method, params, mapResponse, options = {}) {\n if (this.abortController.signal.aborted) {\n return rejectedPromise(this.closedReason());\n }\n const id = this.nextRequestId++;\n let cancel = () => { };\n const responsePromise = new Promise((resolve, reject) => {\n const pendingResponse = {\n resolve: (response) => {\n try {\n const value = mapResponse\n ? mapResponse(response)\n : response;\n resolve(value);\n }\n catch (error) {\n reject(error);\n }\n },\n reject,\n };\n cancel = () => {\n if (pendingResponse.cancellationSent) {\n return;\n }\n pendingResponse.cancellationSent = true;\n pendingResponse.cleanup?.();\n void this.sendCancelRequest(id).catch(() => { });\n };\n options.cancellationSignal?.addEventListener(\"abort\", cancel, {\n once: true,\n });\n pendingResponse.cleanup = () => {\n options.cancellationSignal?.removeEventListener(\"abort\", cancel);\n };\n this.pendingResponses.set(id, pendingResponse);\n });\n responsePromise.catch(() => { });\n const requestSent = this.sendMessage({\n jsonrpc: \"2.0\",\n id,\n method,\n params,\n });\n void requestSent.catch(() => { });\n if (options.cancellationSignal?.aborted) {\n cancel();\n }\n return responsePromise;\n }\n /**\n * Sends a protocol-level request cancellation notification.\n */\n sendCancelRequest(requestId) {\n return this.sendNotification(CANCEL_REQUEST_METHOD, { requestId });\n }\n /**\n * Sends a JSON-RPC notification.\n */\n sendNotification(method, params) {\n if (this.abortController.signal.aborted) {\n return rejectedPromise(this.closedReason());\n }\n return this.sendMessage({ jsonrpc: \"2.0\", method, params });\n }\n /**\n * Closes the connection and rejects pending requests.\n */\n close(error) {\n if (this.abortController.signal.aborted) {\n return;\n }\n const closeError = error ?? new Error(\"ACP connection closed\");\n this.abortController.abort(closeError);\n for (const pendingResponse of this.pendingResponses.values()) {\n pendingResponse.cleanup?.();\n pendingResponse.reject(closeError);\n }\n this.pendingResponses.clear();\n for (const controller of this.incomingRequests.values()) {\n controller.abort(closeError);\n }\n this.incomingRequests.clear();\n void this.receiveReader?.cancel(closeError).catch(() => { });\n }\n initialize(stream, handlers) {\n this.stream = stream;\n this.staticHandlers = handlers;\n this.closedPromise = new Promise((resolve) => {\n this.abortController.signal.addEventListener(\"abort\", () => resolve());\n });\n void this.receive();\n }\n legacyHandler(requestHandler, notificationHandler) {\n return {\n handleMessage: async (message, cx) => {\n if (message.kind === \"request\") {\n const result = await requestHandler(message.method, message.params, cx);\n await message.responder.respond(result);\n }\n else {\n await notificationHandler(message.method, message.params, cx);\n }\n return Handled.yes();\n },\n };\n }\n async receive() {\n let closeError = undefined;\n try {\n const reader = this.stream.readable.getReader();\n this.receiveReader = reader;\n try {\n while (!this.abortController.signal.aborted) {\n const { value: message, done } = await reader.read();\n if (this.abortController.signal.aborted) {\n break;\n }\n if (done) {\n break;\n }\n if (!message) {\n continue;\n }\n this.receiveMessage(message);\n }\n }\n finally {\n if (this.receiveReader === reader) {\n this.receiveReader = undefined;\n }\n reader.releaseLock();\n }\n }\n catch (error) {\n closeError = error;\n }\n finally {\n this.close(closeError);\n }\n }\n receiveMessage(message) {\n if (this.abortController.signal.aborted) {\n return;\n }\n if (\"method\" in message) {\n if (!(\"id\" in message)) {\n this.handleProtocolNotification(message);\n }\n void this.processIncomingMessage(this.toIncomingMessage(message)).catch((error) => this.close(error));\n }\n else if (\"id\" in message) {\n this.handleResponse(message);\n }\n else {\n console.error(\"Invalid message\", { message });\n }\n }\n async processIncomingMessage(message) {\n if (this.abortController.signal.aborted) {\n return;\n }\n let current = message;\n let retry = false;\n try {\n for (const handler of [\n ...this.staticHandlers,\n ...this.dynamicHandlers.values(),\n ]) {\n if (this.abortController.signal.aborted) {\n return;\n }\n const result = (await handler.handleMessage(current, this.context)) ?? {\n handled: true,\n };\n if (result.handled) {\n return;\n }\n current = result.message ?? current;\n retry = retry || Boolean(result.retry);\n }\n if (retry) {\n this.retryQueue.push(current);\n }\n else if (current.kind === \"request\") {\n await current.responder.respondWithError(RequestError.methodNotFound(current.method));\n }\n }\n catch (error) {\n if (this.abortController.signal.aborted) {\n return;\n }\n if (current.kind === \"request\" && !current.responder.responded) {\n await current.responder.respondWithResult(errorToRequestResult(error, current.responder.signal));\n }\n else {\n const response = errorToResult(error);\n if (\"error\" in response) {\n console.error(\"Error handling notification\", message.raw, response.error);\n }\n }\n }\n }\n toIncomingMessage(message) {\n if (\"id\" in message) {\n const abortController = new AbortController();\n this.incomingRequests.set(message.id, abortController);\n const finishRequest = () => {\n if (this.incomingRequests.get(message.id) === abortController) {\n this.incomingRequests.delete(message.id);\n }\n };\n return {\n kind: \"request\",\n method: message.method,\n params: message.params,\n raw: message,\n signal: abortController.signal,\n responder: new RequestResponder(message.id, (result) => this.sendMessage({\n jsonrpc: \"2.0\",\n id: message.id,\n ...result,\n }), abortController.signal, finishRequest),\n };\n }\n return {\n kind: \"notification\",\n method: message.method,\n params: message.params,\n raw: message,\n };\n }\n handleResponse(response) {\n const pendingResponse = this.pendingResponses.get(response.id);\n if (pendingResponse) {\n this.pendingResponses.delete(response.id);\n pendingResponse.cleanup?.();\n if (\"result\" in response) {\n pendingResponse.resolve(response.result);\n }\n else if (\"error\" in response) {\n const { code, message, data } = response.error;\n pendingResponse.reject(new RequestError(code, message, data));\n }\n else {\n pendingResponse.reject(RequestError.invalidRequest(response));\n }\n }\n else {\n console.error(\"Got response to unknown request\", response.id);\n }\n }\n handleProtocolNotification(message) {\n if (message.method !== CANCEL_REQUEST_METHOD) {\n return;\n }\n const requestId = cancelRequestId(message.params);\n if (requestId === undefined) {\n return;\n }\n const controller = this.incomingRequests.get(requestId);\n if (!controller || controller.signal.aborted) {\n return;\n }\n controller.abort(RequestError.requestCancelled({ requestId }));\n }\n closedReason() {\n return (this.abortController.signal.reason ?? new Error(\"ACP connection closed\"));\n }\n async sendMessage(message) {\n if (this.abortController.signal.aborted) {\n return rejectedPromise(this.closedReason());\n }\n this.writeQueue = this.writeQueue\n .then(async () => {\n if (this.abortController.signal.aborted) {\n throw this.closedReason();\n }\n const writer = this.stream.writable.getWriter();\n try {\n await writer.write(message);\n }\n finally {\n writer.releaseLock();\n }\n })\n .catch((error) => {\n this.close(error);\n throw error;\n });\n return this.writeQueue;\n }\n}\n/**\n * Builder for a lower-level handler-based JSON-RPC connection.\n */\nexport class ConnectionBuilder {\n handlers = [];\n connectionName;\n /**\n * Sets a diagnostic name used by handlers created from this builder.\n */\n name(name) {\n this.connectionName = name;\n return this;\n }\n /**\n * Adds a raw JSON-RPC handler to the handler chain.\n */\n withHandler(handler) {\n this.handlers.push(handler);\n return this;\n }\n /**\n * Adds a handler that can inspect every incoming request or notification.\n *\n * Observer callbacks that return void pass the message through to later\n * handlers. Return `Handled.yes()` to stop dispatch explicitly.\n */\n onReceiveMessage(handler) {\n return this.withHandler({\n handleMessage: async (message, cx) => (await handler(message, cx)) ?? Handled.no(message),\n describe: () => this.connectionName ?? \"onReceiveMessage\",\n });\n }\n /**\n * Adds a typed request handler for one method.\n */\n onReceiveRequest(method, parse, handler) {\n return this.withHandler({\n handleMessage: async (message, cx) => {\n if (message.kind !== \"request\" || message.method !== method) {\n return Handled.no(message);\n }\n const request = parse(message.params);\n return ((await handler(request, message.responder, cx)) ?? Handled.yes());\n },\n describe: () => `${this.connectionName ?? \"request\"}:${method}`,\n });\n }\n /**\n * Adds a typed notification handler for one method.\n */\n onReceiveNotification(method, parse, handler) {\n return this.withHandler({\n handleMessage: async (message, cx) => {\n if (message.kind !== \"notification\" || message.method !== method) {\n return Handled.no(message);\n }\n const notification = parse(message.params);\n return (await handler(notification, cx)) ?? Handled.yes();\n },\n describe: () => `${this.connectionName ?? \"notification\"}:${method}`,\n });\n }\n /**\n * Connects the configured handlers to a stream.\n */\n connect(stream, options) {\n return new Connection(stream, this.handlers, options);\n }\n /**\n * Connects to a stream for the lifetime of `op`, then closes the connection.\n */\n connectWith(stream, op, options) {\n return this.connect(stream, options).runUntil(op);\n }\n}\n/**\n * JSON-RPC error object.\n *\n * Represents an error that occurred during method execution, following the\n * JSON-RPC 2.0 error object specification with optional additional data.\n *\n * See protocol docs: [JSON-RPC Error Object](https://www.jsonrpc.org/specification#error_object)\n */\nexport class RequestError extends Error {\n code;\n /**\n * Additional JSON-RPC error data.\n */\n data;\n constructor(\n /**\n * JSON-RPC error code.\n */\n code, message, data) {\n super(message);\n this.code = code;\n this.name = \"RequestError\";\n this.data = data;\n }\n /**\n * Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text.\n */\n static parseError(data, additionalMessage) {\n return new RequestError(-32700, `Parse error${additionalMessage ? `: ${additionalMessage}` : \"\"}`, data);\n }\n /**\n * The JSON sent is not a valid Request object.\n */\n static invalidRequest(data, additionalMessage) {\n return new RequestError(-32600, `Invalid request${additionalMessage ? `: ${additionalMessage}` : \"\"}`, data);\n }\n /**\n * The method does not exist / is not available.\n */\n static methodNotFound(method) {\n return new RequestError(-32601, `\"Method not found\": ${method}`, {\n method,\n });\n }\n /**\n * Invalid method parameter(s).\n */\n static invalidParams(data, additionalMessage) {\n return new RequestError(-32602, `Invalid params${additionalMessage ? `: ${additionalMessage}` : \"\"}`, data);\n }\n /**\n * Internal JSON-RPC error.\n */\n static internalError(data, additionalMessage) {\n return new RequestError(-32603, `Internal error${additionalMessage ? `: ${additionalMessage}` : \"\"}`, data);\n }\n /**\n * Execution of the request was aborted.\n */\n static requestCancelled(data, additionalMessage) {\n return new RequestError(-32800, `Request cancelled${additionalMessage ? `: ${additionalMessage}` : \"\"}`, data);\n }\n /**\n * Authentication required.\n */\n static authRequired(data, additionalMessage) {\n return new RequestError(-32000, `Authentication required${additionalMessage ? `: ${additionalMessage}` : \"\"}`, data);\n }\n /**\n * Resource, such as a file, was not found\n */\n static resourceNotFound(uri) {\n return new RequestError(-32002, `Resource not found${uri ? `: ${uri}` : \"\"}`, uri && { uri });\n }\n /**\n * Converts this error to a JSON-RPC result object.\n */\n toResult() {\n return {\n error: {\n code: this.code,\n message: this.message,\n data: this.data,\n },\n };\n }\n /**\n * Converts this error to a JSON-RPC error response payload.\n */\n toErrorResponse() {\n return {\n code: this.code,\n message: this.message,\n data: this.data,\n };\n }\n}\n//# sourceMappingURL=jsonrpc.js.map","import * as schema from \"./schema/index.js\";\nimport * as validate from \"./schema/zod.gen.js\";\nexport { AGENT_METHODS, CLIENT_METHODS, PROTOCOL_METHODS, PROTOCOL_VERSION, } from \"./schema/index.js\";\nexport * from \"./stream.js\";\nexport { RequestError } from \"./jsonrpc.js\";\nimport { Connection, Handled, HandlerRegistration } from \"./jsonrpc.js\";\nfunction emptyObjectResponse(response) {\n return response ?? {};\n}\nfunction isStream(value) {\n return (typeof value === \"object\" &&\n value !== null &&\n \"readable\" in value &&\n \"writable\" in value);\n}\nfunction memoryStreamPair() {\n const leftToRight = new TransformStream();\n const rightToLeft = new TransformStream();\n return [\n {\n readable: rightToLeft.readable,\n writable: leftToRight.writable,\n },\n {\n readable: leftToRight.readable,\n writable: rightToLeft.writable,\n },\n ];\n}\n/**\n * ACP method-name constants.\n *\n * Use these with `onRequest(...)`, `onNotification(...)`, `request(...)`, and\n * `notify(...)` when you want literal-string type inference without spelling\n * protocol strings inline.\n */\nexport const methods = {\n agent: {\n initialize: schema.AGENT_METHODS.initialize,\n authenticate: schema.AGENT_METHODS.authenticate,\n logout: schema.AGENT_METHODS.logout,\n providers: {\n list: schema.AGENT_METHODS.providers_list,\n set: schema.AGENT_METHODS.providers_set,\n disable: schema.AGENT_METHODS.providers_disable,\n },\n session: {\n new: schema.AGENT_METHODS.session_new,\n load: schema.AGENT_METHODS.session_load,\n list: schema.AGENT_METHODS.session_list,\n delete: schema.AGENT_METHODS.session_delete,\n fork: schema.AGENT_METHODS.session_fork,\n resume: schema.AGENT_METHODS.session_resume,\n close: schema.AGENT_METHODS.session_close,\n setMode: schema.AGENT_METHODS.session_set_mode,\n setConfigOption: schema.AGENT_METHODS.session_set_config_option,\n prompt: schema.AGENT_METHODS.session_prompt,\n cancel: schema.AGENT_METHODS.session_cancel,\n },\n nes: {\n start: schema.AGENT_METHODS.nes_start,\n suggest: schema.AGENT_METHODS.nes_suggest,\n accept: schema.AGENT_METHODS.nes_accept,\n reject: schema.AGENT_METHODS.nes_reject,\n close: schema.AGENT_METHODS.nes_close,\n },\n document: {\n didOpen: schema.AGENT_METHODS.document_did_open,\n didChange: schema.AGENT_METHODS.document_did_change,\n didClose: schema.AGENT_METHODS.document_did_close,\n didSave: schema.AGENT_METHODS.document_did_save,\n didFocus: schema.AGENT_METHODS.document_did_focus,\n },\n },\n client: {\n session: {\n requestPermission: schema.CLIENT_METHODS.session_request_permission,\n update: schema.CLIENT_METHODS.session_update,\n },\n fs: {\n writeTextFile: schema.CLIENT_METHODS.fs_write_text_file,\n readTextFile: schema.CLIENT_METHODS.fs_read_text_file,\n },\n terminal: {\n create: schema.CLIENT_METHODS.terminal_create,\n output: schema.CLIENT_METHODS.terminal_output,\n release: schema.CLIENT_METHODS.terminal_release,\n waitForExit: schema.CLIENT_METHODS.terminal_wait_for_exit,\n kill: schema.CLIENT_METHODS.terminal_kill,\n },\n elicitation: {\n create: schema.CLIENT_METHODS.elicitation_create,\n complete: schema.CLIENT_METHODS.elicitation_complete,\n },\n },\n protocol: {\n cancelRequest: schema.PROTOCOL_METHODS.cancel_request,\n },\n};\nconst startActiveSession = Symbol(\"startActiveSession\");\nclass AcpContext {\n cx;\n currentRequestId;\n /** @internal */\n constructor(cx, currentRequestId) {\n this.cx = cx;\n this.currentRequestId = currentRequestId;\n }\n /**\n * JSON-RPC id of the request currently being handled.\n *\n * This is `undefined` for notification handlers and for contexts created\n * outside an inbound request, such as `connect(...)` and `connectWith(...)`.\n */\n get requestId() {\n return this.currentRequestId;\n }\n /** @internal */\n get connectionContext() {\n return this.cx;\n }\n /** @internal */\n sendRequest(method, params, mapResponse, options) {\n return this.cx.sendRequest(method, params, mapResponse, options);\n }\n /** @internal */\n sendNotification(method, params) {\n return this.cx.sendNotification(method, params);\n }\n /** @internal */\n addDynamicHandler(handler) {\n return this.cx.addDynamicHandler(handler);\n }\n}\n/**\n * Context passed to agent-side handlers.\n *\n * Agents use this context to call client-side ACP methods while handling\n * requests such as `session/prompt`.\n */\nexport class AgentContext extends AcpContext {\n constructor(cx, requestId) {\n super(cx, requestId);\n }\n /** @internal */\n static create(cx, requestId) {\n return new AgentContext(cx, requestId);\n }\n request(method, params, options) {\n const spec = clientRequestSpecsByMethod[method];\n return this.sendRequest(method, params, spec?.mapResponse, options);\n }\n notify(method, params) {\n return this.sendNotification(method, params);\n }\n}\n/**\n * Context used by clients to call agent-side ACP methods.\n *\n * `connectWith` passes a `ClientContext` to the callback. Client handlers also\n * receive one as `ctx.agent` when they need to call back into the agent.\n */\nexport class ClientContext extends AcpContext {\n constructor(cx, requestId) {\n super(cx, requestId);\n }\n /** @internal */\n static create(cx, requestId) {\n return new ClientContext(cx, requestId);\n }\n /** @internal */\n [startActiveSession](params, options) {\n return this.sendRequest(schema.AGENT_METHODS.session_new, params, (response) => this.attachSession(response), options);\n }\n buildSession(cwdOrRequest) {\n if (typeof cwdOrRequest === \"string\") {\n return SessionBuilder.create(this, {\n cwd: cwdOrRequest,\n mcpServers: [],\n });\n }\n return SessionBuilder.create(this, cwdOrRequest);\n }\n /**\n * Builds active-session helpers around a `session/new` response.\n */\n attachSession(response) {\n const updates = new AsyncQueue();\n const closeSignal = this.connectionContext.signal;\n const failUpdatesOnClose = () => {\n updates.fail(closeSignal.reason ?? new Error(\"ACP connection closed\"));\n };\n if (closeSignal.aborted) {\n failUpdatesOnClose();\n }\n else {\n closeSignal.addEventListener(\"abort\", failUpdatesOnClose);\n }\n const sessionRegistration = sessionUpdateRouter(this.connectionContext).attach(response, updates);\n const closeRegistration = new HandlerRegistration(() => {\n closeSignal.removeEventListener(\"abort\", failUpdatesOnClose);\n });\n return ActiveSession.create(this, response, updates, [\n sessionRegistration,\n closeRegistration,\n ]);\n }\n request(method, params, options) {\n const spec = agentRequestSpecsByMethod[method];\n return this.sendRequest(method, params, spec?.mapResponse, options);\n }\n notify(method, params) {\n return this.sendNotification(method, params);\n }\n}\nclass AcpConnectionHandle {\n connection;\n constructor(connection) {\n this.connection = connection;\n }\n get signal() {\n return this.connection.signal;\n }\n get closed() {\n return this.connection.closed;\n }\n close(error) {\n this.connection.close(error);\n }\n}\nclass AgentConnectionHandle extends AcpConnectionHandle {\n connectHandlers;\n client;\n didStartConnectHandlers = false;\n constructor(connection, connectHandlers = []) {\n super(connection);\n this.connectHandlers = connectHandlers;\n this.client = AgentContext.create(connection.getContext());\n }\n /** @internal */\n startConnectHandlers() {\n if (this.didStartConnectHandlers) {\n return;\n }\n this.didStartConnectHandlers = true;\n runConnectHandlers(this, this.connectHandlers);\n }\n}\nclass ClientConnectionHandle extends AcpConnectionHandle {\n connectHandlers;\n agent;\n didStartConnectHandlers = false;\n constructor(connection, connectHandlers = []) {\n super(connection);\n this.connectHandlers = connectHandlers;\n this.agent = ClientContext.create(connection.getContext());\n }\n /** @internal */\n startConnectHandlers() {\n if (this.didStartConnectHandlers) {\n return;\n }\n this.didStartConnectHandlers = true;\n runConnectHandlers(this, this.connectHandlers);\n }\n}\nfunction agentConnection(connection, connectHandlers = []) {\n return new AgentConnectionHandle(connection, connectHandlers);\n}\nfunction clientConnection(connection, connectHandlers = []) {\n return new ClientConnectionHandle(connection, connectHandlers);\n}\nclass AsyncQueue {\n values = [];\n waiters = [];\n failed = false;\n failure;\n enqueue(value) {\n if (this.failed) {\n return;\n }\n const waiter = this.waiters.shift();\n if (waiter) {\n waiter.resolve(value);\n }\n else {\n this.values.push({ kind: \"value\", value });\n }\n }\n reject(error) {\n if (this.failed) {\n return;\n }\n if (this.waiters.length > 0) {\n for (const waiter of this.waiters.splice(0)) {\n waiter.reject(error);\n }\n return;\n }\n this.values.push({ kind: \"error\", error });\n }\n clearErrors() {\n this.values = this.values.filter((entry) => entry.kind === \"value\");\n }\n fail(error) {\n if (this.failed) {\n return;\n }\n this.failed = true;\n this.failure = error;\n for (const waiter of this.waiters.splice(0)) {\n waiter.reject(error);\n }\n }\n next() {\n if (this.values.length > 0) {\n const entry = this.values.shift();\n if (entry.kind === \"error\") {\n return Promise.reject(entry.error);\n }\n return Promise.resolve(entry.value);\n }\n if (this.failed) {\n return Promise.reject(this.failure);\n }\n return new Promise((resolve, reject) => {\n this.waiters.push({ resolve, reject });\n });\n }\n}\nfunction cloneNewSessionRequest(request) {\n return {\n ...request,\n additionalDirectories: request.additionalDirectories\n ? [...request.additionalDirectories]\n : undefined,\n mcpServers: [...request.mcpServers],\n };\n}\n/**\n * Builder for creating an `ActiveSession`.\n *\n * Start from `ctx.buildSession(\"/absolute/cwd\")` for the common case, or\n * pass a full `NewSessionRequest` to `ctx.buildSession(...)` when the session\n * needs MCP servers, `_meta`, or additional request fields. All paths in ACP\n * payloads should be absolute.\n */\nexport class SessionBuilder {\n cx;\n request;\n constructor(cx, request) {\n this.cx = cx;\n this.request = cloneNewSessionRequest(request);\n }\n /** @internal */\n static create(cx, request) {\n return new SessionBuilder(cx, request);\n }\n /**\n * Returns the `session/new` request that will be sent.\n *\n * The returned object is a defensive copy, so mutating it does not change the\n * builder.\n */\n toRequest() {\n return cloneNewSessionRequest(this.request);\n }\n /**\n * Replaces the additional workspace roots for this session.\n *\n * `additionalDirectories` expand the session's file-system scope without\n * changing `cwd`. Each path should be absolute.\n */\n withAdditionalDirectories(additionalDirectories) {\n this.request = {\n ...this.request,\n additionalDirectories: [...additionalDirectories],\n };\n return this;\n }\n /**\n * Adds one MCP server to the `session/new` request.\n */\n withMcpServer(mcpServer) {\n this.request = {\n ...this.request,\n mcpServers: [...this.request.mcpServers, mcpServer],\n };\n return this;\n }\n /**\n * Starts the session and returns an `ActiveSession` for prompting and reading\n * updates.\n *\n * Call `dispose()` on the returned session when you no longer need update\n * routing, or use `withSession(...)` to scope disposal automatically.\n */\n async start(options) {\n return this.cx[startActiveSession](this.toRequest(), options);\n }\n /**\n * Starts the session, runs `op`, and disposes the active-session update\n * routing when `op` finishes or throws.\n */\n async withSession(op) {\n const session = await this.start();\n try {\n return await op(session);\n }\n finally {\n session.dispose();\n }\n }\n}\n/**\n * Convenience wrapper for an active ACP session.\n *\n * An active session routes `session/update` notifications for one session ID\n * into an async queue. Use `prompt(...)` to send user content, then read updates\n * with `nextUpdate()` until a `stop` message is returned.\n */\nexport class ActiveSession {\n cx;\n sessionResponse;\n updates;\n registrations;\n constructor(cx, sessionResponse, updates, registrations) {\n this.cx = cx;\n this.sessionResponse = sessionResponse;\n this.updates = updates;\n this.registrations = registrations;\n }\n /** @internal */\n static create(cx, sessionResponse, updates, registrations) {\n return new ActiveSession(cx, sessionResponse, updates, registrations);\n }\n /**\n * Session ID returned by `session/new`.\n */\n get sessionId() {\n return this.sessionResponse.sessionId;\n }\n /**\n * Mode state returned when the session was created, if the agent provided it.\n */\n get modes() {\n return this.sessionResponse.modes;\n }\n /**\n * Metadata returned when the session was created.\n */\n get meta() {\n return this.sessionResponse._meta;\n }\n /**\n * Full response returned by `session/new`.\n */\n get newSessionResponse() {\n return this.sessionResponse;\n }\n /**\n * Sends a prompt to this session.\n *\n * Strings are converted to one text content block. A single content block is\n * wrapped in an array. The returned promise resolves with the final\n * `PromptResponse`, and the same completion is also queued as a `stop`\n * message for `nextUpdate()`.\n */\n prompt(prompt, options) {\n this.updates.clearErrors();\n const response = this.cx.request(schema.AGENT_METHODS.session_prompt, {\n sessionId: this.sessionId,\n prompt: this.promptBlocks(prompt),\n }, options);\n void response.then((value) => {\n this.updates.enqueue({\n kind: \"stop\",\n response: value,\n stopReason: value.stopReason,\n });\n }, (error) => {\n this.updates.reject(error);\n });\n return response;\n }\n /**\n * Reads the next update or stop message for this session.\n */\n nextUpdate() {\n return this.updates.next();\n }\n /**\n * Reads text chunks until the current prompt turn stops.\n *\n * Only `agent_message_chunk` updates with text content are appended. Other\n * update types are ignored by this helper; use `nextUpdate()` when you need\n * tool calls, plans, or the final `PromptResponse`.\n */\n async readText() {\n let output = \"\";\n for (;;) {\n const message = await this.nextUpdate();\n if (message.kind === \"stop\") {\n return output;\n }\n const { update } = message;\n if (update.sessionUpdate === \"agent_message_chunk\" &&\n update.content.type === \"text\") {\n output += update.content.text;\n }\n }\n }\n /**\n * Stops routing updates to this active-session helper.\n *\n * This does not close the ACP session on the agent. Use `ClientContext`\n * session lifecycle methods when the protocol session itself should be closed\n * or deleted.\n */\n dispose() {\n for (const registration of this.registrations.splice(0)) {\n registration.dispose();\n }\n this.updates.fail(new Error(\"Active session disposed\"));\n }\n /**\n * Supports explicit resource management with `using`.\n */\n [Symbol.dispose]() {\n this.dispose();\n }\n promptBlocks(prompt) {\n if (typeof prompt === \"string\") {\n return [{ type: \"text\", text: prompt }];\n }\n if (Array.isArray(prompt)) {\n return prompt;\n }\n return [prompt];\n }\n}\nfunction parseParams(parser, params) {\n if (!parser) {\n return params;\n }\n if (typeof parser === \"function\") {\n return parser(params);\n }\n return parser.parse(params);\n}\nfunction requestSpec(method, params, mapResponse) {\n return { method, params, mapResponse };\n}\nfunction notificationSpec(method, params) {\n return { method, params };\n}\nfunction registerAppRequest(builder, spec, context, handler) {\n builder.onReceiveRequest(spec.method, (params) => parseParams(spec.params, params), async (params, responder, cx) => {\n const response = await handler(context(params, cx, responder.signal, responder.id));\n await responder.respond((spec.mapResponse\n ? spec.mapResponse(response)\n : response));\n });\n}\nfunction registerAppNotification(builder, spec, context, handler) {\n builder.onReceiveNotification(spec.method, (params) => parseParams(spec.params, params), (params, cx) => handler(context(params, cx, cx.signal)));\n}\nfunction specsByMethod(specs) {\n const byMethod = {};\n for (const spec of Object.values(specs)) {\n byMethod[spec.method] = spec;\n }\n return byMethod;\n}\nconst agentRequestSpecs = {\n initialize: requestSpec(schema.AGENT_METHODS.initialize, validate.zInitializeRequest),\n newSession: requestSpec(schema.AGENT_METHODS.session_new, validate.zNewSessionRequest),\n loadSession: requestSpec(schema.AGENT_METHODS.session_load, validate.zLoadSessionRequest, emptyObjectResponse),\n unstable_forkSession: requestSpec(schema.AGENT_METHODS.session_fork, validate.zForkSessionRequest),\n listSessions: requestSpec(schema.AGENT_METHODS.session_list, validate.zListSessionsRequest),\n deleteSession: requestSpec(schema.AGENT_METHODS.session_delete, validate.zDeleteSessionRequest, emptyObjectResponse),\n resumeSession: requestSpec(schema.AGENT_METHODS.session_resume, validate.zResumeSessionRequest),\n closeSession: requestSpec(schema.AGENT_METHODS.session_close, validate.zCloseSessionRequest, emptyObjectResponse),\n setSessionMode: requestSpec(schema.AGENT_METHODS.session_set_mode, validate.zSetSessionModeRequest, emptyObjectResponse),\n setSessionConfigOption: requestSpec(schema.AGENT_METHODS.session_set_config_option, validate.zSetSessionConfigOptionRequest),\n authenticate: requestSpec(schema.AGENT_METHODS.authenticate, validate.zAuthenticateRequest, emptyObjectResponse),\n unstable_listProviders: requestSpec(schema.AGENT_METHODS.providers_list, validate.zListProvidersRequest),\n unstable_setProvider: requestSpec(schema.AGENT_METHODS.providers_set, validate.zSetProviderRequest, emptyObjectResponse),\n unstable_disableProvider: requestSpec(schema.AGENT_METHODS.providers_disable, validate.zDisableProviderRequest, emptyObjectResponse),\n logout: requestSpec(schema.AGENT_METHODS.logout, validate.zLogoutRequest, emptyObjectResponse),\n prompt: requestSpec(schema.AGENT_METHODS.session_prompt, validate.zPromptRequest),\n unstable_startNes: requestSpec(schema.AGENT_METHODS.nes_start, validate.zStartNesRequest),\n unstable_suggestNes: requestSpec(schema.AGENT_METHODS.nes_suggest, validate.zSuggestNesRequest),\n unstable_closeNes: requestSpec(schema.AGENT_METHODS.nes_close, validate.zCloseNesRequest, emptyObjectResponse),\n};\nconst agentNotificationSpecs = {\n cancel: notificationSpec(schema.AGENT_METHODS.session_cancel, validate.zCancelNotification),\n unstable_didOpenDocument: notificationSpec(schema.AGENT_METHODS.document_did_open, validate.zDidOpenDocumentNotification),\n unstable_didChangeDocument: notificationSpec(schema.AGENT_METHODS.document_did_change, validate.zDidChangeDocumentNotification),\n unstable_didCloseDocument: notificationSpec(schema.AGENT_METHODS.document_did_close, validate.zDidCloseDocumentNotification),\n unstable_didSaveDocument: notificationSpec(schema.AGENT_METHODS.document_did_save, validate.zDidSaveDocumentNotification),\n unstable_didFocusDocument: notificationSpec(schema.AGENT_METHODS.document_did_focus, validate.zDidFocusDocumentNotification),\n unstable_acceptNes: notificationSpec(schema.AGENT_METHODS.nes_accept, validate.zAcceptNesNotification),\n unstable_rejectNes: notificationSpec(schema.AGENT_METHODS.nes_reject, validate.zRejectNesNotification),\n};\nconst clientRequestSpecs = {\n requestPermission: requestSpec(schema.CLIENT_METHODS.session_request_permission, validate.zRequestPermissionRequest),\n writeTextFile: requestSpec(schema.CLIENT_METHODS.fs_write_text_file, validate.zWriteTextFileRequest, emptyObjectResponse),\n readTextFile: requestSpec(schema.CLIENT_METHODS.fs_read_text_file, validate.zReadTextFileRequest),\n createTerminal: requestSpec(schema.CLIENT_METHODS.terminal_create, validate.zCreateTerminalRequest),\n terminalOutput: requestSpec(schema.CLIENT_METHODS.terminal_output, validate.zTerminalOutputRequest),\n releaseTerminal: requestSpec(schema.CLIENT_METHODS.terminal_release, validate.zReleaseTerminalRequest, emptyObjectResponse),\n waitForTerminalExit: requestSpec(schema.CLIENT_METHODS.terminal_wait_for_exit, validate.zWaitForTerminalExitRequest),\n killTerminal: requestSpec(schema.CLIENT_METHODS.terminal_kill, validate.zKillTerminalRequest, emptyObjectResponse),\n unstable_createElicitation: requestSpec(schema.CLIENT_METHODS.elicitation_create, validate.zCreateElicitationRequest),\n};\nconst clientNotificationSpecs = {\n sessionUpdate: notificationSpec(schema.CLIENT_METHODS.session_update, validate.zSessionNotification),\n unstable_completeElicitation: notificationSpec(schema.CLIENT_METHODS.elicitation_complete, validate.zCompleteElicitationNotification),\n};\nconst agentRequestSpecsByMethod = specsByMethod(agentRequestSpecs);\nconst agentNotificationSpecsByMethod = specsByMethod(agentNotificationSpecs);\nconst clientRequestSpecsByMethod = specsByMethod(clientRequestSpecs);\nconst clientNotificationSpecsByMethod = specsByMethod(clientNotificationSpecs);\nfunction agentRequestContext(params, client, signal, requestId) {\n return {\n params,\n requestId,\n signal,\n client,\n };\n}\nfunction agentNotificationContext(params, client, signal) {\n return {\n params,\n signal,\n client,\n };\n}\nfunction clientRequestContext(params, agent, signal, requestId) {\n return {\n params,\n requestId,\n signal,\n agent,\n };\n}\nfunction clientNotificationContext(params, agent, signal) {\n return {\n params,\n signal,\n agent,\n };\n}\nclass SessionUpdateRouter {\n activeSessions = new Map();\n handleMessage(message) {\n if (message.kind !== \"notification\" ||\n message.method !== schema.CLIENT_METHODS.session_update) {\n return Handled.no(message);\n }\n const notification = validate.zSessionNotification.parse(message.params);\n const update = {\n kind: \"session_update\",\n notification,\n update: notification.update,\n };\n const activeSessions = this.activeSessions.get(notification.sessionId);\n if (activeSessions && activeSessions.size > 0) {\n for (const session of activeSessions) {\n session.enqueue(update);\n }\n }\n return Handled.no(message);\n }\n attach(response, updates) {\n const sessions = this.activeSessions.get(response.sessionId) ??\n new Set();\n sessions.add(updates);\n this.activeSessions.set(response.sessionId, sessions);\n return new HandlerRegistration(() => {\n sessions.delete(updates);\n if (sessions.size === 0) {\n this.activeSessions.delete(response.sessionId);\n }\n });\n }\n}\nconst sessionUpdateRouters = new WeakMap();\nfunction sessionUpdateRouter(cx) {\n let router = sessionUpdateRouters.get(cx);\n if (!router) {\n router = new SessionUpdateRouter();\n sessionUpdateRouters.set(cx, router);\n }\n return router;\n}\nfunction runConnectHandlers(connection, handlers) {\n for (const handler of handlers) {\n let result;\n try {\n result = handler(connection);\n }\n catch (error) {\n connection.close(error);\n throw error;\n }\n void Promise.resolve(result).catch((error) => {\n connection.close(error);\n });\n }\n}\nconst appBuilder = Symbol(\"appBuilder\");\nconst runAgentConnectHandlers = Symbol(\"runAgentConnectHandlers\");\nconst runClientConnectHandlers = Symbol(\"runClientConnectHandlers\");\n/**\n * Creates an agent-side app.\n *\n * Register request and notification handlers by ACP method name, then call\n * `connect(stream)` to serve an ACP client.\n */\nexport function agent(options) {\n return new AgentApp(options);\n}\n/**\n * Agent-side app builder.\n *\n * Methods on this class register typed request or notification handlers and\n * return `this`, so apps can be built with a fluent chain. Handler params are\n * parsed with the generated ACP schemas before your handler runs, and thrown\n * errors are converted to JSON-RPC errors by the connection layer.\n */\nexport class AgentApp {\n builder = Connection.builder();\n connectHandlers = [];\n constructor(options = {}) {\n if (options.name) {\n this.builder.name(options.name);\n }\n }\n /** @internal */\n [appBuilder]() {\n return this.builder;\n }\n /** @internal */\n [runAgentConnectHandlers](connection) {\n runConnectHandlers(connection, this.connectHandlers);\n }\n connect(target, options = {}) {\n return this.connectConnection(target, options).connection;\n }\n connectWith(target, op) {\n const { rawConnection, connection } = this.connectConnection(target);\n return rawConnection.runUntil(() => op(connection.client));\n }\n /**\n * Registers a handler that runs when this agent app opens a connection.\n *\n * Use this for connection-scoped work that needs to call client-side ACP\n * methods outside an inbound request handler.\n */\n onConnect(handler) {\n this.connectHandlers.push(handler);\n return this;\n }\n onRequest(method, handlerOrParams, handler) {\n if (handler) {\n return this.request({ method, params: handlerOrParams }, handler);\n }\n const spec = agentRequestSpecsByMethod[method];\n if (!spec) {\n throw new Error(`Unknown ACP request method '${method}'. Pass a params parser for custom methods.`);\n }\n return this.request(spec, handlerOrParams);\n }\n onNotification(method, handlerOrParams, handler) {\n if (handler) {\n return this.notification({ method, params: handlerOrParams }, handler);\n }\n const spec = agentNotificationSpecsByMethod[method];\n if (!spec) {\n throw new Error(`Unknown ACP notification method '${method}'. Pass a params parser for custom methods.`);\n }\n return this.notification(spec, handlerOrParams);\n }\n request(spec, handler) {\n registerAppRequest(this.builder, spec, (params, cx, signal, requestId) => agentRequestContext(params, AgentContext.create(cx, requestId), signal, requestId), handler);\n return this;\n }\n notification(spec, handler) {\n registerAppNotification(this.builder, spec, (params, cx, signal) => agentNotificationContext(params, AgentContext.create(cx), signal), handler);\n return this;\n }\n connectConnection(target, options = {}) {\n if (isStream(target)) {\n const state = this.openStreamConnection(target);\n if (!options.deferConnectHandlers) {\n this[runAgentConnectHandlers](state.connection);\n }\n return state;\n }\n const [thisStream, peerStream] = memoryStreamPair();\n const peerRawConnection = target[appBuilder]().connect(peerStream);\n const peerConnection = clientConnection(peerRawConnection);\n const state = this.openStreamConnection(thisStream);\n void state.rawConnection.closed.then(() => peerConnection.close());\n void peerRawConnection.closed.then(() => state.connection.close());\n try {\n target[runClientConnectHandlers](peerConnection);\n this[runAgentConnectHandlers](state.connection);\n }\n catch (error) {\n peerConnection.close(error);\n state.connection.close(error);\n throw error;\n }\n return state;\n }\n openStreamConnection(stream) {\n const rawConnection = this.builder.connect(stream);\n return {\n rawConnection,\n connection: agentConnection(rawConnection, this.connectHandlers),\n };\n }\n}\n/**\n * Creates a client-side app.\n *\n * Register request and notification handlers by ACP method name, then use\n * `connectWith(...)` to run the workflow that calls agent-side methods.\n */\nexport function client(options) {\n return new ClientApp(options);\n}\n/**\n * Client-side app builder.\n *\n * Methods on this class register typed client handlers and return `this`, so\n * apps can be built with a fluent chain. `connectWith(...)` is the usual entry\n * point for clients because it provides a `ClientContext` for calling\n * agent-side requests and session helpers.\n */\nexport class ClientApp {\n builder = Connection.builder();\n connectHandlers = [];\n constructor(options = {}) {\n if (options.name) {\n this.builder.name(options.name);\n }\n this.builder.withHandler({\n handleMessage: (message, cx) => sessionUpdateRouter(cx).handleMessage(message),\n describe: () => \"client-session-update-router\",\n });\n }\n /** @internal */\n [appBuilder]() {\n return this.builder;\n }\n /** @internal */\n [runClientConnectHandlers](connection) {\n runConnectHandlers(connection, this.connectHandlers);\n }\n connect(target) {\n return this.connectConnection(target).connection;\n }\n connectWith(target, op) {\n const { rawConnection, connection } = this.connectConnection(target);\n return rawConnection.runUntil(() => op(connection.agent));\n }\n /**\n * Registers a handler that runs when this client app opens a connection.\n *\n * Use this for connection-scoped work that needs to call agent-side ACP\n * methods outside an inbound request handler.\n */\n onConnect(handler) {\n this.connectHandlers.push(handler);\n return this;\n }\n onRequest(method, handlerOrParams, handler) {\n if (handler) {\n return this.request({ method, params: handlerOrParams }, handler);\n }\n const spec = clientRequestSpecsByMethod[method];\n if (!spec) {\n throw new Error(`Unknown ACP request method '${method}'. Pass a params parser for custom methods.`);\n }\n return this.request(spec, handlerOrParams);\n }\n onNotification(method, handlerOrParams, handler) {\n if (handler) {\n return this.notification({ method, params: handlerOrParams }, handler);\n }\n const spec = clientNotificationSpecsByMethod[method];\n if (!spec) {\n throw new Error(`Unknown ACP notification method '${method}'. Pass a params parser for custom methods.`);\n }\n return this.notification(spec, handlerOrParams);\n }\n request(spec, handler) {\n registerAppRequest(this.builder, spec, (params, cx, signal, requestId) => clientRequestContext(params, ClientContext.create(cx, requestId), signal, requestId), handler);\n return this;\n }\n notification(spec, handler) {\n registerAppNotification(this.builder, spec, (params, cx, signal) => clientNotificationContext(params, ClientContext.create(cx), signal), handler);\n return this;\n }\n connectConnection(target) {\n if (isStream(target)) {\n const state = this.openStreamConnection(target);\n this[runClientConnectHandlers](state.connection);\n return state;\n }\n const [thisStream, peerStream] = memoryStreamPair();\n const peerRawConnection = target[appBuilder]().connect(peerStream);\n const peerConnection = agentConnection(peerRawConnection);\n const state = this.openStreamConnection(thisStream);\n void state.rawConnection.closed.then(() => peerConnection.close());\n void peerRawConnection.closed.then(() => state.connection.close());\n try {\n target[runAgentConnectHandlers](peerConnection);\n this[runClientConnectHandlers](state.connection);\n }\n catch (error) {\n peerConnection.close(error);\n state.connection.close(error);\n throw error;\n }\n return state;\n }\n openStreamConnection(stream) {\n const rawConnection = this.builder.connect(stream);\n return {\n rawConnection,\n connection: clientConnection(rawConnection, this.connectHandlers),\n };\n }\n}\nconst legacyAgentRequestMethods = new Set([\n schema.AGENT_METHODS.initialize,\n schema.AGENT_METHODS.authenticate,\n schema.AGENT_METHODS.providers_list,\n schema.AGENT_METHODS.providers_set,\n schema.AGENT_METHODS.providers_disable,\n schema.AGENT_METHODS.session_new,\n schema.AGENT_METHODS.session_load,\n schema.AGENT_METHODS.session_set_mode,\n schema.AGENT_METHODS.session_set_config_option,\n schema.AGENT_METHODS.session_prompt,\n schema.AGENT_METHODS.session_list,\n schema.AGENT_METHODS.session_delete,\n schema.AGENT_METHODS.session_fork,\n schema.AGENT_METHODS.session_resume,\n schema.AGENT_METHODS.session_close,\n schema.AGENT_METHODS.logout,\n schema.AGENT_METHODS.nes_start,\n schema.AGENT_METHODS.nes_suggest,\n schema.AGENT_METHODS.nes_close,\n]);\nconst legacyAgentNotificationMethods = new Set([\n schema.AGENT_METHODS.session_cancel,\n schema.AGENT_METHODS.nes_accept,\n schema.AGENT_METHODS.nes_reject,\n schema.AGENT_METHODS.document_did_open,\n schema.AGENT_METHODS.document_did_change,\n schema.AGENT_METHODS.document_did_close,\n schema.AGENT_METHODS.document_did_save,\n schema.AGENT_METHODS.document_did_focus,\n]);\nconst legacyClientRequestMethods = new Set([\n schema.CLIENT_METHODS.session_request_permission,\n schema.CLIENT_METHODS.fs_write_text_file,\n schema.CLIENT_METHODS.fs_read_text_file,\n schema.CLIENT_METHODS.terminal_create,\n schema.CLIENT_METHODS.terminal_output,\n schema.CLIENT_METHODS.terminal_release,\n schema.CLIENT_METHODS.terminal_wait_for_exit,\n schema.CLIENT_METHODS.terminal_kill,\n schema.CLIENT_METHODS.elicitation_create,\n]);\nconst legacyClientNotificationMethods = new Set([\n schema.CLIENT_METHODS.session_update,\n schema.CLIENT_METHODS.elicitation_complete,\n]);\nfunction legacyAgentApp(implementation) {\n const app = agent()\n .onRequest(schema.AGENT_METHODS.initialize, (ctx) => implementation.initialize(ctx.params))\n .onRequest(schema.AGENT_METHODS.session_new, (ctx) => implementation.newSession(ctx.params))\n .onRequest(schema.AGENT_METHODS.authenticate, async (ctx) => (await implementation.authenticate(ctx.params)) ?? {})\n .onRequest(schema.AGENT_METHODS.session_prompt, (ctx) => implementation.prompt(ctx.params))\n .onNotification(schema.AGENT_METHODS.session_cancel, (ctx) => implementation.cancel(ctx.params));\n if (implementation.loadSession) {\n app.onRequest(schema.AGENT_METHODS.session_load, (ctx) => implementation.loadSession(ctx.params));\n }\n if (implementation.listSessions) {\n app.onRequest(schema.AGENT_METHODS.session_list, (ctx) => implementation.listSessions(ctx.params));\n }\n if (implementation.deleteSession) {\n app.onRequest(schema.AGENT_METHODS.session_delete, async (ctx) => (await implementation.deleteSession(ctx.params)) ?? {});\n }\n if (implementation.unstable_forkSession) {\n app.onRequest(schema.AGENT_METHODS.session_fork, (ctx) => implementation.unstable_forkSession(ctx.params));\n }\n if (implementation.resumeSession) {\n app.onRequest(schema.AGENT_METHODS.session_resume, (ctx) => implementation.resumeSession(ctx.params));\n }\n if (implementation.closeSession) {\n app.onRequest(schema.AGENT_METHODS.session_close, async (ctx) => (await implementation.closeSession(ctx.params)) ?? {});\n }\n if (implementation.setSessionMode) {\n app.onRequest(schema.AGENT_METHODS.session_set_mode, async (ctx) => (await implementation.setSessionMode(ctx.params)) ?? {});\n }\n if (implementation.setSessionConfigOption) {\n app.onRequest(schema.AGENT_METHODS.session_set_config_option, (ctx) => implementation.setSessionConfigOption(ctx.params));\n }\n if (implementation.unstable_listProviders) {\n app.onRequest(schema.AGENT_METHODS.providers_list, (ctx) => implementation.unstable_listProviders(ctx.params));\n }\n if (implementation.unstable_setProvider) {\n app.onRequest(schema.AGENT_METHODS.providers_set, async (ctx) => (await implementation.unstable_setProvider(ctx.params)) ?? {});\n }\n if (implementation.unstable_disableProvider) {\n app.onRequest(schema.AGENT_METHODS.providers_disable, async (ctx) => (await implementation.unstable_disableProvider(ctx.params)) ?? {});\n }\n if (implementation.logout) {\n app.onRequest(schema.AGENT_METHODS.logout, async (ctx) => (await implementation.logout(ctx.params)) ?? {});\n }\n if (implementation.unstable_startNes) {\n app.onRequest(schema.AGENT_METHODS.nes_start, (ctx) => implementation.unstable_startNes(ctx.params));\n }\n if (implementation.unstable_suggestNes) {\n app.onRequest(schema.AGENT_METHODS.nes_suggest, (ctx) => implementation.unstable_suggestNes(ctx.params));\n }\n if (implementation.unstable_closeNes) {\n app.onRequest(schema.AGENT_METHODS.nes_close, async (ctx) => (await implementation.unstable_closeNes(ctx.params)) ?? {});\n }\n if (implementation.unstable_didOpenDocument) {\n app.onNotification(schema.AGENT_METHODS.document_did_open, (ctx) => implementation.unstable_didOpenDocument(ctx.params));\n }\n if (implementation.unstable_didChangeDocument) {\n app.onNotification(schema.AGENT_METHODS.document_did_change, (ctx) => implementation.unstable_didChangeDocument(ctx.params));\n }\n if (implementation.unstable_didCloseDocument) {\n app.onNotification(schema.AGENT_METHODS.document_did_close, (ctx) => implementation.unstable_didCloseDocument(ctx.params));\n }\n if (implementation.unstable_didSaveDocument) {\n app.onNotification(schema.AGENT_METHODS.document_did_save, (ctx) => implementation.unstable_didSaveDocument(ctx.params));\n }\n if (implementation.unstable_didFocusDocument) {\n app.onNotification(schema.AGENT_METHODS.document_did_focus, (ctx) => implementation.unstable_didFocusDocument(ctx.params));\n }\n if (implementation.unstable_acceptNes) {\n app.onNotification(schema.AGENT_METHODS.nes_accept, (ctx) => implementation.unstable_acceptNes(ctx.params));\n }\n if (implementation.unstable_rejectNes) {\n app.onNotification(schema.AGENT_METHODS.nes_reject, (ctx) => implementation.unstable_rejectNes(ctx.params));\n }\n if (implementation.extMethod) {\n app[appBuilder]().withHandler({\n handleMessage: async (message) => {\n if (message.kind !== \"request\" ||\n legacyAgentRequestMethods.has(message.method)) {\n return Handled.no(message);\n }\n await message.responder.respond(await implementation.extMethod(message.method, message.params));\n return Handled.yes();\n },\n describe: () => \"legacy-agent-extension-request\",\n });\n }\n if (implementation.extNotification) {\n app[appBuilder]().withHandler({\n handleMessage: async (message) => {\n if (message.kind !== \"notification\" ||\n legacyAgentNotificationMethods.has(message.method)) {\n return Handled.no(message);\n }\n await implementation.extNotification(message.method, message.params);\n return Handled.yes();\n },\n describe: () => \"legacy-agent-extension-notification\",\n });\n }\n return app;\n}\nfunction legacyClientApp(implementation) {\n const app = client()\n .onRequest(schema.CLIENT_METHODS.session_request_permission, (ctx) => implementation.requestPermission(ctx.params))\n .onNotification(schema.CLIENT_METHODS.session_update, (ctx) => implementation.sessionUpdate(ctx.params))\n .onRequest(schema.CLIENT_METHODS.fs_write_text_file, async (ctx) => (await implementation.writeTextFile?.(ctx.params)) ?? {})\n .onRequest(schema.CLIENT_METHODS.fs_read_text_file, async (ctx) => (await implementation.readTextFile?.(ctx.params)))\n .onRequest(schema.CLIENT_METHODS.terminal_create, async (ctx) => (await implementation.createTerminal?.(ctx.params)))\n .onRequest(schema.CLIENT_METHODS.terminal_output, async (ctx) => (await implementation.terminalOutput?.(ctx.params)))\n .onRequest(schema.CLIENT_METHODS.terminal_release, async (ctx) => (await implementation.releaseTerminal?.(ctx.params)) ?? {})\n .onRequest(schema.CLIENT_METHODS.terminal_wait_for_exit, async (ctx) => (await implementation.waitForTerminalExit?.(ctx.params)))\n .onRequest(schema.CLIENT_METHODS.terminal_kill, async (ctx) => (await implementation.killTerminal?.(ctx.params)) ?? {});\n if (implementation.unstable_createElicitation) {\n app.onRequest(schema.CLIENT_METHODS.elicitation_create, (ctx) => implementation.unstable_createElicitation(ctx.params));\n }\n if (implementation.unstable_completeElicitation) {\n app.onNotification(schema.CLIENT_METHODS.elicitation_complete, (ctx) => implementation.unstable_completeElicitation(ctx.params));\n }\n if (implementation.extMethod) {\n app[appBuilder]().withHandler({\n handleMessage: async (message) => {\n if (message.kind !== \"request\" ||\n legacyClientRequestMethods.has(message.method)) {\n return Handled.no(message);\n }\n await message.responder.respond(await implementation.extMethod(message.method, message.params));\n return Handled.yes();\n },\n describe: () => \"legacy-client-extension-request\",\n });\n }\n if (implementation.extNotification) {\n app[appBuilder]().withHandler({\n handleMessage: async (message) => {\n if (message.kind !== \"notification\" ||\n legacyClientNotificationMethods.has(message.method)) {\n return Handled.no(message);\n }\n await implementation.extNotification(message.method, message.params);\n return Handled.yes();\n },\n describe: () => \"legacy-client-extension-notification\",\n });\n }\n return app;\n}\n/**\n * An agent-side connection to a client.\n *\n * This class provides the agent's view of an ACP connection, allowing\n * agents to communicate with clients. It implements the {@link Client} interface\n * to provide methods for requesting permissions, accessing the file system,\n * and sending session updates.\n *\n * See protocol docs: [Agent](https://agentclientprotocol.com/protocol/overview#agent)\n *\n * @deprecated Prefer {@link agent}, which registers typed handlers with a\n * single context object and supports direct app composition.\n */\nexport class AgentSideConnection {\n connection;\n /**\n * Creates a new agent-side connection to a client.\n *\n * This establishes the communication channel from the agent's perspective\n * following the ACP specification.\n *\n * @param toAgent - A function that creates an Agent handler to process incoming client requests\n * @param stream - The bidirectional message stream for communication. Typically created using\n * {@link ndJsonStream} for stdio-based connections.\n *\n * See protocol docs: [Communication Model](https://agentclientprotocol.com/protocol/overview#communication-model)\n *\n * @deprecated Prefer `agent({ name }).connect(stream)`.\n */\n constructor(toAgent, stream) {\n this.connection = legacyAgentApp(toAgent(this))[appBuilder]()\n .connect(stream);\n }\n /**\n * Handles session update notifications from the agent.\n *\n * This is a notification endpoint (no response expected) that sends\n * real-time updates about session progress, including message chunks,\n * tool calls, and execution plans.\n *\n * Note: Clients SHOULD continue accepting tool call updates even after\n * sending a `session/cancel` notification, as the agent may send final\n * updates before responding with the cancelled stop reason.\n *\n * See protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)\n */\n sessionUpdate(params) {\n return this.connection.sendNotification(schema.CLIENT_METHODS.session_update, params);\n }\n /**\n * Requests permission from the user for a tool call operation.\n *\n * Called by the agent when it needs user authorization before executing\n * a potentially sensitive operation. The client should present the options\n * to the user and return their decision.\n *\n * If the client cancels the prompt turn via `session/cancel`, it MUST\n * respond to this request with `RequestPermissionOutcome::Cancelled`.\n *\n * See protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/tool-calls#requesting-permission)\n */\n requestPermission(params) {\n return this.connection.sendRequest(schema.CLIENT_METHODS.session_request_permission, params);\n }\n /**\n * Reads content from a text file in the client's file system.\n *\n * Only available if the client advertises the `fs.readTextFile` capability.\n * Allows the agent to access file contents within the client's environment.\n *\n * See protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client)\n */\n readTextFile(params) {\n return this.connection.sendRequest(schema.CLIENT_METHODS.fs_read_text_file, params);\n }\n /**\n * Writes content to a text file in the client's file system.\n *\n * Only available if the client advertises the `fs.writeTextFile` capability.\n * Allows the agent to create or modify files within the client's environment.\n *\n * See protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client)\n */\n writeTextFile(params) {\n return this.connection.sendRequest(schema.CLIENT_METHODS.fs_write_text_file, params, emptyObjectResponse);\n }\n /**\n * Executes a command in a new terminal.\n *\n * Returns a `TerminalHandle` that can be used to get output, wait for exit,\n * kill the command, or release the terminal.\n *\n * The terminal can also be embedded in tool calls by using its ID in\n * `ToolCallContent` with type \"terminal\".\n *\n * @param params - The terminal creation parameters\n * @returns A handle to control and monitor the terminal\n */\n createTerminal(params) {\n return this.connection.sendRequest(schema.CLIENT_METHODS.terminal_create, params, (response) => TerminalHandle.create(response.terminalId, params.sessionId, this.connection));\n }\n /**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Creates an elicitation to request input from the user.\n *\n * @experimental\n */\n unstable_createElicitation(params) {\n return this.connection.sendRequest(schema.CLIENT_METHODS.elicitation_create, params);\n }\n /**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notifies the client that a URL-based elicitation is complete.\n *\n * @experimental\n */\n unstable_completeElicitation(params) {\n return this.connection.sendNotification(schema.CLIENT_METHODS.elicitation_complete, params);\n }\n request(method, params, options) {\n const spec = clientRequestSpecsByMethod[method];\n return this.connection.sendRequest(method, params, spec?.mapResponse, options);\n }\n notify(method, params) {\n return this.connection.sendNotification(method, params);\n }\n /**\n * Extension method.\n *\n * @deprecated Use {@link request}.\n */\n extMethod(method, params) {\n return this.request(method, params);\n }\n /**\n * Extension notification.\n *\n * @deprecated Use {@link notify}.\n */\n extNotification(method, params) {\n return this.notify(method, params);\n }\n /**\n * AbortSignal that aborts when the connection closes.\n *\n * This signal can be used to:\n * - Listen for connection closure: `connection.signal.addEventListener('abort', () => {...})`\n * - Check connection status synchronously: `if (connection.signal.aborted) {...}`\n * - Pass to other APIs (fetch, setTimeout) for automatic cancellation\n *\n * The connection closes when the underlying stream ends, either normally or due to an error.\n *\n * @example\n * ```typescript\n * const connection = new AgentSideConnection(agent, stream);\n *\n * // Listen for closure\n * connection.signal.addEventListener('abort', () => {\n * console.log('Connection closed - performing cleanup');\n * });\n *\n * // Check status\n * if (connection.signal.aborted) {\n * console.log('Connection is already closed');\n * }\n *\n * // Pass to other APIs\n * fetch(url, { signal: connection.signal });\n * ```\n */\n get signal() {\n return this.connection.signal;\n }\n /**\n * Promise that resolves when the connection closes.\n *\n * The connection closes when the underlying stream ends, either normally or due to an error.\n * Once closed, the connection cannot send or receive any more messages.\n *\n * This is useful for async/await style cleanup:\n *\n * @example\n * ```typescript\n * const connection = new AgentSideConnection(agent, stream);\n * await connection.closed;\n * console.log('Connection closed - performing cleanup');\n * ```\n */\n get closed() {\n return this.connection.closed;\n }\n}\n/**\n * Handle for controlling and monitoring a terminal created via `createTerminal`.\n *\n * Provides methods to:\n * - Get current output without waiting\n * - Wait for command completion\n * - Kill the running command\n * - Release terminal resources\n *\n * **Important:** Always call `release()` when done with the terminal to free resources.\n\n * The terminal supports async disposal via `Symbol.asyncDispose` for automatic cleanup.\n\n * You can use `await using` to ensure the terminal is automatically released when it\n * goes out of scope.\n */\nexport class TerminalHandle {\n /**\n * Terminal identifier returned by `terminal/create`.\n */\n id;\n sessionId;\n connection;\n constructor(id, sessionId, conn) {\n this.id = id;\n this.sessionId = sessionId;\n this.connection = conn;\n }\n /** @internal */\n static create(id, sessionId, conn) {\n return new TerminalHandle(id, sessionId, conn);\n }\n /**\n * Gets the current terminal output without waiting for the command to exit.\n */\n currentOutput() {\n return this.connection.sendRequest(schema.CLIENT_METHODS.terminal_output, {\n sessionId: this.sessionId,\n terminalId: this.id,\n });\n }\n /**\n * Waits for the terminal command to complete and returns its exit status.\n */\n waitForExit() {\n return this.connection.sendRequest(schema.CLIENT_METHODS.terminal_wait_for_exit, {\n sessionId: this.sessionId,\n terminalId: this.id,\n });\n }\n /**\n * Kills the terminal command without releasing the terminal.\n *\n * The terminal remains valid after killing, allowing you to:\n * - Get the final output with `currentOutput()`\n * - Check the exit status\n * - Release the terminal when done\n *\n * Useful for implementing timeouts or cancellation.\n */\n kill() {\n return this.connection.sendRequest(schema.CLIENT_METHODS.terminal_kill, {\n sessionId: this.sessionId,\n terminalId: this.id,\n }, emptyObjectResponse);\n }\n /**\n * Releases the terminal and frees all associated resources.\n *\n * If the command is still running, it will be killed.\n * After release, the terminal ID becomes invalid and cannot be used\n * with other terminal methods.\n *\n * Tool calls that already reference this terminal will continue to\n * display its output.\n *\n * **Important:** Always call this method when done with the terminal.\n */\n release() {\n return this.connection.sendRequest(schema.CLIENT_METHODS.terminal_release, {\n sessionId: this.sessionId,\n terminalId: this.id,\n }, emptyObjectResponse);\n }\n /**\n * Releases the terminal when used with `await using`.\n */\n async [Symbol.asyncDispose]() {\n await this.release();\n }\n}\n/**\n * A client-side connection to an agent.\n *\n * This class provides the client's view of an ACP connection, allowing\n * clients (such as code editors) to communicate with agents. It implements\n * the {@link Agent} interface to provide methods for initializing sessions, sending\n * prompts, and managing the agent lifecycle.\n *\n * See protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client)\n *\n * @deprecated Prefer {@link client}, which registers typed handlers with a\n * single context object and supports `connectWith` and session helpers.\n */\nexport class ClientSideConnection {\n connection;\n /**\n * Creates a new client-side connection to an agent.\n *\n * This establishes the communication channel between a client and agent\n * following the ACP specification.\n *\n * @param toClient - A function that creates a Client handler to process incoming agent requests\n * @param stream - The bidirectional message stream for communication. Typically created using\n * {@link ndJsonStream} for stdio-based connections.\n *\n * See protocol docs: [Communication Model](https://agentclientprotocol.com/protocol/overview#communication-model)\n *\n * @deprecated Prefer `client({ name }).connectWith(stream, async (ctx) => ...)`.\n */\n constructor(toClient, stream) {\n this.connection = legacyClientApp(toClient(this))[appBuilder]()\n .connect(stream);\n }\n /**\n * Establishes the connection with a client and negotiates protocol capabilities.\n *\n * This 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 *\n * The agent should respond with its supported protocol version and capabilities.\n *\n * See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)\n */\n initialize(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.initialize, params);\n }\n /**\n * Creates a new conversation session with the agent.\n *\n * Sessions represent independent conversation contexts with their own history and state.\n *\n * The 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 *\n * The request may include `additionalDirectories` to expand the session's filesystem\n * scope beyond `cwd` without changing the base for relative paths.\n *\n * May return an `auth_required` error if the agent requires authentication.\n *\n * See protocol docs: [Session Setup](https://agentclientprotocol.com/protocol/session-setup)\n */\n newSession(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.session_new, params);\n }\n /**\n * Loads an existing session to resume a previous conversation.\n *\n * This method is only available if the agent advertises the `loadSession` capability.\n *\n * The agent should:\n * - Restore the session context and conversation history\n * - Connect to the specified MCP servers\n * - Stream the entire conversation history back to the client via notifications\n *\n * The request may include `additionalDirectories` to set the complete list of\n * additional workspace roots for the loaded session.\n *\n * See protocol docs: [Loading Sessions](https://agentclientprotocol.com/protocol/session-setup#loading-sessions)\n */\n loadSession(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.session_load, params, emptyObjectResponse);\n }\n /**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Forks an existing session to create a new independent session.\n *\n * Creates a new session based on the context of an existing one, allowing\n * operations like generating summaries without affecting the original session's history.\n *\n * The request may include `additionalDirectories` to set the complete list of\n * additional workspace roots for the forked session.\n *\n * This method is only available if the agent advertises the `session.fork` capability.\n *\n * @experimental\n */\n unstable_forkSession(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.session_fork, params);\n }\n /**\n * Lists existing sessions from the agent.\n *\n * This method is only available if the agent advertises the `listSessions` capability.\n *\n * Returns a list of sessions with metadata like session ID, working directory,\n * title, and last update time. Supports filtering by working directory,\n * `additionalDirectories`, and cursor-based pagination.\n */\n listSessions(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.session_list, params);\n }\n /**\n * Deletes an existing session returned by `session/list`.\n *\n * This method is only available if the agent advertises the `sessionCapabilities.delete` capability.\n */\n deleteSession(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.session_delete, params, emptyObjectResponse);\n }\n /**\n * Resumes an existing session without returning previous messages.\n *\n * This method is only available if the agent advertises the `session.resume` capability.\n *\n * The agent should resume the session context, allowing the conversation to continue\n * without replaying the message history (unlike `session/load`).\n *\n * The request may include `additionalDirectories` to set the complete list of\n * additional workspace roots for the resumed session.\n */\n resumeSession(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.session_resume, params);\n }\n /**\n * Closes an active session and frees up any resources associated with it.\n *\n * This method is only available if the agent advertises the `session.close` capability.\n *\n * The agent must cancel any ongoing work (as if `session/cancel` was called)\n * and then free up any resources associated with the session.\n */\n closeSession(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.session_close, params, emptyObjectResponse);\n }\n /**\n * Sets the operational mode for a session.\n *\n * Allows switching between different agent modes (e.g., \"ask\", \"architect\", \"code\")\n * that affect system prompts, tool availability, and permission behaviors.\n *\n * The mode must be one of the modes advertised in `availableModes` during session\n * creation or loading. Agents may also change modes autonomously and notify the\n * client via `current_mode_update` notifications.\n *\n * This method can be called at any time during a session, whether the Agent is\n * idle or actively generating a turn.\n *\n * See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)\n */\n setSessionMode(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.session_set_mode, params, emptyObjectResponse);\n }\n /**\n * Set a configuration option for a given session.\n *\n * The response contains the full set of configuration options and their current values,\n * as changing one option may affect the available values or state of other options.\n */\n setSessionConfigOption(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.session_set_config_option, params);\n }\n /**\n * Authenticates the client using the specified authentication method.\n *\n * Called when the agent requires authentication before allowing session creation.\n * The client provides the authentication method ID that was advertised during initialization.\n *\n * After successful authentication, the client can proceed to create sessions with\n * `newSession` without receiving an `auth_required` error.\n *\n * See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)\n */\n authenticate(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.authenticate, params, emptyObjectResponse);\n }\n /**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Lists providers that can be configured by the client.\n *\n * This method is only available if the agent advertises the `providers` capability.\n *\n * @experimental\n */\n unstable_listProviders(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.providers_list, params);\n }\n /**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Replaces the configuration for a provider.\n *\n * This method is only available if the agent advertises the `providers` capability.\n *\n * @experimental\n */\n unstable_setProvider(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.providers_set, params, emptyObjectResponse);\n }\n /**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Disables a provider.\n *\n * This method is only available if the agent advertises the `providers` capability.\n *\n * @experimental\n */\n unstable_disableProvider(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.providers_disable, params, emptyObjectResponse);\n }\n /**\n * Logout of the current authentication method.\n */\n logout(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.logout, params, emptyObjectResponse);\n }\n /**\n * Processes a user prompt within a session.\n *\n * This method handles the whole lifecycle of a prompt:\n * - Receives user messages with optional context (files, images, etc.)\n * - Processes the prompt using language models\n * - Reports language model content and tool calls to the Clients\n * - Requests permission to run tools\n * - Executes any requested tool calls\n * - Returns when the turn is complete with a stop reason\n *\n * See protocol docs: [Prompt Turn](https://agentclientprotocol.com/protocol/prompt-turn)\n */\n prompt(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.session_prompt, params);\n }\n /**\n * Cancels ongoing operations for a session.\n *\n * This is a notification sent by the client to cancel an ongoing prompt turn.\n *\n * Upon receiving this notification, the Agent SHOULD:\n * - Stop all language model requests as soon as possible\n * - Abort all tool call invocations in progress\n * - Send any pending `session/update` notifications\n * - Respond to the original `session/prompt` request with `StopReason::Cancelled`\n *\n * See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation)\n */\n cancel(params) {\n return this.connection.sendNotification(schema.AGENT_METHODS.session_cancel, params);\n }\n /**\n * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Starts a NES (Next Edit Suggestions) session.\n *\n * @experimental\n */\n unstable_startNes(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.nes_start, params);\n }\n /**\n * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Sends a NES suggestion request.\n *\n * @experimental\n */\n unstable_suggestNes(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.nes_suggest, params);\n }\n /**\n * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Closes a NES session.\n *\n * @experimental\n */\n unstable_closeNes(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.nes_close, params, emptyObjectResponse);\n }\n /**\n * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notifies the agent that a document was opened.\n *\n * @experimental\n */\n unstable_didOpenDocument(params) {\n return this.connection.sendNotification(schema.AGENT_METHODS.document_did_open, params);\n }\n /**\n * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notifies the agent that a document was changed.\n *\n * @experimental\n */\n unstable_didChangeDocument(params) {\n return this.connection.sendNotification(schema.AGENT_METHODS.document_did_change, params);\n }\n /**\n * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notifies the agent that a document was closed.\n *\n * @experimental\n */\n unstable_didCloseDocument(params) {\n return this.connection.sendNotification(schema.AGENT_METHODS.document_did_close, params);\n }\n /**\n * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notifies the agent that a document was saved.\n *\n * @experimental\n */\n unstable_didSaveDocument(params) {\n return this.connection.sendNotification(schema.AGENT_METHODS.document_did_save, params);\n }\n /**\n * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notifies the agent that a document received focus.\n *\n * @experimental\n */\n unstable_didFocusDocument(params) {\n return this.connection.sendNotification(schema.AGENT_METHODS.document_did_focus, params);\n }\n /**\n * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notifies the agent that a NES suggestion was accepted.\n *\n * @experimental\n */\n unstable_acceptNes(params) {\n return this.connection.sendNotification(schema.AGENT_METHODS.nes_accept, params);\n }\n /**\n * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notifies the agent that a NES suggestion was rejected.\n *\n * @experimental\n */\n unstable_rejectNes(params) {\n return this.connection.sendNotification(schema.AGENT_METHODS.nes_reject, params);\n }\n request(method, params, options) {\n const spec = agentRequestSpecsByMethod[method];\n return this.connection.sendRequest(method, params, spec?.mapResponse, options);\n }\n notify(method, params) {\n return this.connection.sendNotification(method, params);\n }\n /**\n * Extension method.\n *\n * @deprecated Use {@link request}.\n */\n extMethod(method, params) {\n return this.request(method, params);\n }\n /**\n * Extension notification.\n *\n * @deprecated Use {@link notify}.\n */\n extNotification(method, params) {\n return this.notify(method, params);\n }\n /**\n * AbortSignal that aborts when the connection closes.\n *\n * This signal can be used to:\n * - Listen for connection closure: `connection.signal.addEventListener('abort', () => {...})`\n * - Check connection status synchronously: `if (connection.signal.aborted) {...}`\n * - Pass to other APIs (fetch, setTimeout) for automatic cancellation\n *\n * The connection closes when the underlying stream ends, either normally or due to an error.\n *\n * @example\n * ```typescript\n * const connection = new ClientSideConnection(client, stream);\n *\n * // Listen for closure\n * connection.signal.addEventListener('abort', () => {\n * console.log('Connection closed - performing cleanup');\n * });\n *\n * // Check status\n * if (connection.signal.aborted) {\n * console.log('Connection is already closed');\n * }\n *\n * // Pass to other APIs\n * fetch(url, { signal: connection.signal });\n * ```\n */\n get signal() {\n return this.connection.signal;\n }\n /**\n * Promise that resolves when the connection closes.\n *\n * The connection closes when the underlying stream ends, either normally or due to an error.\n * Once closed, the connection cannot send or receive any more messages.\n *\n * This is useful for async/await style cleanup:\n *\n * @example\n * ```typescript\n * const connection = new ClientSideConnection(client, stream);\n * await connection.closed;\n * console.log('Connection closed - performing cleanup');\n * ```\n */\n get closed() {\n return this.connection.closed;\n }\n}\n//# sourceMappingURL=acp.js.map","import { accessSync, constants, existsSync } from 'node:fs'\nimport { delimiter, join } from 'node:path'\nimport { homedir } from 'node:os'\nimport type { RuntimeDef } from '../config/config-schema.js'\n\n/**\n * Host-availability probing for runtimes.\n *\n * `resolveRuntimes()` produces a runtime for every ACP-registry entry that has a\n * distribution for this platform — but that says nothing about whether the tool\n * is actually runnable *here*. This module answers that question so the daemon\n * only advertises genuinely-installed runtimes in `RegisterReq.capabilities`.\n *\n * Two layers:\n * 1. A generic launcher check — is the runtime's `command` resolvable? For a\n * runtime distributed as a real binary (`command` is the tool's own\n * executable) this is a meaningful signal: the binary on `$PATH` means it's\n * installed.\n * 2. For runtimes distributed via a package launcher (`npx`/`uvx`), (1) is\n * meaningless — the launcher fetches on demand, so \"npx exists\" is true on\n * virtually every dev host and tells us nothing about the wrapped agent. For\n * those we REQUIRE a per-runtime custom probe (`CUSTOM_PROBES`) that looks for\n * the wrapped CLI's own config/state dir, which appears once the user has\n * installed and run/initialized it. A launcher-distributed runtime with no\n * probe is treated as NOT installed — otherwise every npx/uvx agent in the\n * ACP registry would be falsely advertised just because `npx` is on `$PATH`.\n *\n * The custom probes test for the config *directory* (the \"installed & initialized\n * on this host\" signal). A stricter \"is logged in\" check would look for the auth\n * file instead (e.g. `~/.codex/auth.json`), but that yields false negatives for\n * users who authenticate via an API-key env var, so directory presence is the\n * pragmatic signal. Paths verified against each tool's docs (July 2026).\n */\n\nconst isWin = process.platform === 'win32'\n\nfunction isExecutableFile(p: string): boolean {\n try {\n // X_OK is meaningless on Windows; fall back to mere existence there.\n accessSync(p, isWin ? constants.F_OK : constants.X_OK)\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Resolve a launcher command the way a shell would. A command containing a path\n * separator is treated as a literal path; a bare name is searched across `$PATH`\n * (trying `$PATHEXT` extensions on Windows).\n */\nexport function isCommandAvailable(command: string, env: NodeJS.ProcessEnv = process.env): boolean {\n return resolveCommandPath(command, env) !== undefined\n}\n\n/**\n * Resolve a launcher/command to its absolute path the way a shell would — a path\n * containing a separator is checked literally; a bare name is searched across\n * `$PATH` (trying `$PATHEXT` extensions on Windows). Returns undefined if not found.\n */\nexport function resolveCommandPath(command: string, env: NodeJS.ProcessEnv = process.env): string | undefined {\n const exts = isWin ? ['', ...(env.PATHEXT ?? '.EXE;.CMD;.BAT;.COM').split(';')] : ['']\n const hasSep = command.includes('/') || (isWin && command.includes('\\\\'))\n if (hasSep) {\n // Try as a literal path relative to CWD first (covers auto-downloaded archives\n // where the binary sits in the extraction directory).\n const literal = exts.map((ext) => command + ext).find(isExecutableFile)\n if (literal) return literal\n // Not found as a literal path — the ACP registry stores binary commands with a\n // `./` prefix (\"./opencode\", \"./goose\", …) which is meaningful when the daemon\n // downloads and extracts the archive itself, but the tool may also be installed\n // directly on `$PATH` as just the basename. Fall back to PATH search with the\n // basename (stripping any directory prefix) so the probe finds it either way.\n const basename = command.split(/[/\\\\]/).filter(Boolean).pop() ?? command\n if (basename !== command) {\n const dirs = (env.PATH ?? '').split(delimiter).filter(Boolean)\n for (const dir of dirs) {\n for (const ext of exts) {\n const p = join(dir, basename) + ext\n if (isExecutableFile(p)) return p\n }\n }\n }\n return undefined\n }\n const dirs = (env.PATH ?? '').split(delimiter).filter(Boolean)\n for (const dir of dirs) {\n for (const ext of exts) {\n const p = join(dir, command) + ext\n if (isExecutableFile(p)) return p\n }\n }\n return undefined\n}\n\n/** Extra, runtime-specific check layered (AND) on top of the launcher probe. */\nexport type RuntimeProbe = (env: NodeJS.ProcessEnv) => boolean\n\n// --- home / XDG path resolution (honors the standard env overrides) ----------\n\nfunction home(env: NodeJS.ProcessEnv): string {\n return (isWin ? env.USERPROFILE : env.HOME) || homedir()\n}\nfunction xdgConfigHome(env: NodeJS.ProcessEnv): string {\n return env.XDG_CONFIG_HOME || join(home(env), '.config')\n}\nfunction xdgDataHome(env: NodeJS.ProcessEnv): string {\n return env.XDG_DATA_HOME || join(home(env), '.local', 'share')\n}\nfunction pathExists(p: string | undefined): boolean {\n return !!p && existsSync(p)\n}\n/** True if any candidate path exists (undefined candidates are skipped). */\nfunction anyExists(...candidates: (string | undefined)[]): boolean {\n return candidates.some(pathExists)\n}\n\n/**\n * Custom probes keyed by ACP-registry runtime id. Add an entry here whenever the\n * launcher-on-PATH check is too weak to mean \"actually installed & set up\".\n * Each tests for the tool's home/XDG config dir (or, where the dir is ambiguous,\n * a tool-specific file), honoring the documented env overrides.\n */\nexport const CUSTOM_PROBES: Record<string, RuntimeProbe> = {\n // Anthropic Claude Code — ~/.claude state dir + ~/.claude.json global config.\n 'claude-acp': (env) => anyExists(join(home(env), '.claude'), join(home(env), '.claude.json')),\n\n // OpenAI Codex CLI — ~/.codex (honors $CODEX_HOME).\n 'codex-acp': (env) => anyExists(env.CODEX_HOME, join(home(env), '.codex')),\n\n // Google Gemini CLI — ~/.gemini.\n gemini: (env) => pathExists(join(home(env), '.gemini')),\n\n // Qwen Code (Gemini-CLI fork) — ~/.qwen.\n 'qwen-code': (env) => pathExists(join(home(env), '.qwen')),\n\n // GitHub Copilot CLI — ~/.copilot (honors $COPILOT_HOME).\n 'github-copilot-cli': (env) => anyExists(env.COPILOT_HOME, join(home(env), '.copilot')),\n\n // Cursor CLI — ~/.cursor is shared with the editor, so probe the CLI-specific\n // config file (honors $CURSOR_CONFIG_DIR).\n cursor: (env) =>\n anyExists(\n env.CURSOR_CONFIG_DIR ? join(env.CURSOR_CONFIG_DIR, 'cli-config.json') : undefined,\n join(home(env), '.cursor', 'cli-config.json')\n ),\n\n // sst OpenCode — XDG config dir + auth file under XDG data. `~/.opencode` is the\n // project-level config dir, not the documented global one, but it lands in $HOME\n // when opencode is run from home, so accept it as a fallback signal.\n opencode: (env) =>\n anyExists(\n join(xdgConfigHome(env), 'opencode'),\n join(xdgDataHome(env), 'opencode', 'auth.json'),\n join(home(env), '.opencode')\n ),\n\n // pi (svkozak pi-acp npx adapter) — ~/.pi (agent state under ~/.pi/agent).\n 'pi-acp': (env) => pathExists(join(home(env), '.pi')),\n\n // Nous Research Hermes — ~/.hermes (honors $HERMES_HOME, which relocates the\n // whole home dir). Not yet in the ACP registry; this covers a user-configured\n // `hermes` runtime, keyed like the other native-ACP tools (opencode/goose).\n hermes: (env) => anyExists(env.HERMES_HOME, join(home(env), '.hermes')),\n\n // Block goose — $XDG_CONFIG_HOME/goose.\n goose: (env) => pathExists(join(xdgConfigHome(env), 'goose')),\n\n // Sourcegraph Amp — $XDG_CONFIG_HOME/amp (honors $AMP_SETTINGS_FILE).\n 'amp-acp': (env) => anyExists(env.AMP_SETTINGS_FILE, join(xdgConfigHome(env), 'amp')),\n\n // Augment auggie — ~/.augment.\n auggie: (env) => pathExists(join(home(env), '.augment')),\n\n // Cline CLI — ~/.cline (honors $CLINE_DATA_DIR).\n cline: (env) => anyExists(env.CLINE_DATA_DIR, join(home(env), '.cline')),\n\n // xAI Grok CLI — ~/.grok.\n 'grok-build': (env) => pathExists(join(home(env), '.grok')),\n\n // Moonshot Kimi CLI — ~/.kimi (legacy) or ~/.kimi-code (newer, honors $KIMI_CODE_HOME).\n kimi: (env) => anyExists(env.KIMI_CODE_HOME, join(home(env), '.kimi'), join(home(env), '.kimi-code')),\n\n // Factory Droid — ~/.factory.\n 'factory-droid': (env) => pathExists(join(home(env), '.factory')),\n\n // Cognition Devin (for Terminal) — XDG config + data dirs.\n devin: (env) => anyExists(join(xdgConfigHome(env), 'devin'), join(xdgDataHome(env), 'devin'))\n}\n\n/**\n * Package launchers that fetch-and-run on demand. When a runtime is launched via\n * one of these, the launcher being on `$PATH` says nothing about whether the\n * wrapped agent is installed, so such runtimes require a custom probe to count.\n */\nconst PACKAGE_LAUNCHERS = new Set(['npx', 'uvx'])\n\n/** Is this runtime actually usable on this host? */\nexport function isRuntimeAvailable(id: string, rt: RuntimeDef, env: NodeJS.ProcessEnv = process.env): boolean {\n if (!isCommandAvailable(rt.command, env)) return false\n const custom = CUSTOM_PROBES[id]\n if (custom) return custom(env)\n // No bespoke probe: trust the launcher check only for real-binary distributions.\n // Package-launcher runtimes (npx/uvx) without a probe are NOT considered\n // installed — the launcher is present on almost every host regardless.\n return !PACKAGE_LAUNCHERS.has(rt.command)\n}\n\n/**\n * Filter a runtime map down to those installed on this host — what the daemon\n * should report to the Control Plane and is able to launch.\n */\nexport function installedRuntimes(\n runtimes: Record<string, RuntimeDef>,\n env: NodeJS.ProcessEnv = process.env\n): Record<string, RuntimeDef> {\n const out: Record<string, RuntimeDef> = {}\n for (const [id, rt] of Object.entries(runtimes)) {\n if (isRuntimeAvailable(id, rt, env)) out[id] = rt\n }\n return out\n}\n","import { spawn, type ChildProcess } from 'node:child_process'\nimport { Readable, Writable } from 'node:stream'\nimport {\n client as createClientApp,\n methods,\n ndJsonStream,\n type ClientConnection,\n type ContentBlock,\n type CreateElicitationRequest,\n type CreateElicitationResponse,\n type McpServer,\n type RequestPermissionRequest,\n type RequestPermissionResponse,\n type SessionConfigOption,\n type SessionUpdate,\n type StopReason,\n type Usage\n} from '@agentclientprotocol/sdk'\nimport {\n HOOK_REPORT_REASON_PROVIDER_AUTH_REQUIRED,\n HOOK_REPORT_REASON_PROVIDER_QUOTA_EXHAUSTED,\n type McpTransportCapabilities\n} from '@agentconnect.md/protocol'\nimport type { RuntimeDef } from '../config/config-schema.js'\nimport { resolveCommandPath } from '../runtimes/probe.js'\nimport type { Logger } from '../log.js'\n\nconst PROTOCOL_VERSION = 1\n\n/** A session/load may replay the historical conversation stream. Keep that off\n * platform transports, but preserve latest-wins metadata needed to converge the\n * local/CP session projection after a restart. */\nexport function shouldForwardUpdateDuringLoad(update: SessionUpdate): boolean {\n return update.sessionUpdate === 'session_info_update' || update.sessionUpdate === 'usage_update'\n}\n\n/** A runtime's advertised model selector, distilled from ACP session config options. */\nexport interface ModelOptions {\n /** The model id currently selected for the session (the agent's default). */\n current?: string\n /** Selectable model ids (group structure flattened away). */\n models: string[]\n}\n\n/** A runtime's advertised reasoning-effort selector (ACP `thought_level`), distilled\n * from session config options and augmented with the synthetic `ultracode`/`max`\n * entries on Claude runtimes (they aren't `thought_level` select values — see\n * {@link ULTRACODE_EFFORT} / {@link claudeSessionMeta}). */\nexport interface EffortOptions {\n /** The effort level currently selected on the session (per the `thought_level`\n * select's currentValue) — note a `_meta`-driven `ultracode` won't appear here. */\n current?: string\n /** Selectable effort levels (group structure flattened; synthetic entries appended). */\n efforts: string[]\n}\n\n/** A runtime's advertised permission/approval mode selector (ACP `mode`). Values are\n * runtime-owned (`default` / `plan` on Claude, `agent` / `read-only` on Codex). */\nexport interface PermissionModeOptions {\n /** The permission mode currently selected for the session. */\n current?: string\n /** Selectable permission mode values (group structure flattened away). */\n modes: string[]\n}\n\n/** A runtime's advertised fast-mode toggle (ACP `model_config` on/off select). The\n * option only exists once a fast-capable model is selected, so `null` means the\n * current model offers no fast toggle. */\nexport interface FastModeOption {\n /** Whether fast mode is currently on (the select's currentValue === \"on\"). */\n current: boolean\n}\n\n/**\n * Desired per-session runtime config, applied through ACP session config\n * options (`session/set_config_option`) right after `session/new` /\n * `session/load`. This is the only channel a runtime like claude-acp accepts\n * for reasoning effort — there is no env var or spawn flag for it; the model\n * additionally has env fallbacks some runtimes read (see cp-overlay.ts).\n */\nexport interface SessionConfigPrefs {\n /** Model id, matched against the option tagged `category: \"model\"`. */\n model?: string\n /** Effort level, matched against the option tagged `category: \"thought_level\"`. */\n reasoningEffort?: string\n /** Fast mode, matched against the option tagged `category: \"model_config\"` —\n * both claude-acp (id \"fast\") and codex-acp (id \"fast-mode\") advertise it\n * there, as an on/off `select` (we don't opt into boolean config options).\n * The option only exists when the selected model supports fast mode, so an\n * unsupported combination degrades to a logged skip. undefined ⇒ don't touch. */\n fastMode?: boolean\n /** Runtime permission/approval mode, matched against the option tagged\n * `category: \"mode\"`. Values are runtime-owned (`default` / `plan` on\n * claude-acp, `agent` / `read-only` on codex-acp, etc.). */\n permissionMode?: string\n /** Optional host-level system-prompt seed, layered ahead of any per-session append\n * on Claude runtimes (see {@link claudeSessionMeta}). Left unset by default: the\n * agent's identity + description now travel per-session in the agent meta object\n * (see SessionManager), which also carries the channel source. undefined ⇒ none. */\n systemPrompt?: string\n}\n\n/** The `session/set_config_option` call that applies a desired value, or the reason none is needed. */\nexport type ConfigSelectionPlan = { configId: string; value: string } | { skip: string }\n\n/**\n * Distill the human-actionable reason from a failed ACP request. Adapters wrap\n * their runtime's own message in a JSON-RPC error whose `message` is often just\n * the generic title — codex-acp reports quota exhaustion as code -32603\n * \"Internal error\" with the real text (\"You've hit your usage limit. Visit … or\n * try again at 7:01 PM.\") under `error.data.message` — so prefer that detail\n * over a bare title, and append it when a specific message carries extra data.\n * Non-RequestError failures fall back to the plain Error message.\n */\nexport function turnFailureReason(err: unknown): string {\n const e = err as { message?: unknown; data?: { message?: unknown } } | null | undefined\n const msg = typeof e?.message === 'string' && e.message.trim() ? e.message.trim() : String(err)\n const detail = typeof e?.data?.message === 'string' ? e.data.message.trim() : ''\n if (!detail || msg.includes(detail)) return msg\n // The SDK's generic titles (RequestError statics) add nothing over the\n // runtime's own text; any more specific message keeps both.\n const generic =\n /^(parse error|invalid request|invalid params|internal error|request cancelled|authentication required|resource not found)$/i\n return generic.test(msg) ? detail : `${msg}: ${detail}`\n}\n\n/** Machine-stable classification for a failed ACP turn. Keep the default conservative:\n * callers only relax reporting for a provider limit or revoked credential that\n * we can identify from a structured adapter code or narrow provider-authored\n * message. In particular, an ordinary transient `rate_limit_error` or generic\n * \"sign in again\" text remains `turn_failed`.\n */\nexport type TurnFailureCode =\n typeof HOOK_REPORT_REASON_PROVIDER_AUTH_REQUIRED | typeof HOOK_REPORT_REASON_PROVIDER_QUOTA_EXHAUSTED | 'turn_failed'\n\nconst PROVIDER_QUOTA_CODES = new Set([\n 'billinghardlimitreached',\n 'creditbalancetoolow',\n 'creditsexhausted',\n 'insufficientquota',\n 'nocreditsremaining',\n 'outofcredits',\n 'planlimitreached',\n 'quotaexhausted',\n 'usagelimitexceeded',\n 'usagelimitreached'\n])\n\nconst PROVIDER_QUOTA_MESSAGES = [\n /\\b(?:you(?:'|’)ve|you have) hit your (?:[a-z]+ )?usage limit\\b/i,\n /\\busage limit (?:has been )?(?:reached|exceeded)\\b/i,\n /\\b(?:you(?:'|’)ve|you have) hit your limit\\b[\\s\\S]{0,120}\\bresets?\\b/i,\n /\\b(?:credit|credits) balance (?:is )?(?:too low|depleted|exhausted)\\b/i,\n /\\b(?:insufficient|not enough|no) (?:api )?credits?(?: (?:remaining|available))?\\b/i,\n /\\b(?:out of|exhausted) (?:api )?credits?\\b/i,\n /\\bexceeded your current quota\\b/i,\n /\\b(?:billing|plan|account) quota (?:has been )?(?:reached|exceeded|exhausted)\\b/i\n]\n\nconst PROVIDER_AUTH_MESSAGES = [\n /\\brefresh token was revoked\\b/i,\n /\\baccess token could not be refreshed\\b[\\s\\S]{0,160}\\b(?:log out|sign out) and sign in again\\b/i\n]\n\n/** Collect the small family of fields ACP adapters and provider SDKs use to\n * wrap an upstream error. The depth/seen guards tolerate nested `error.data`\n * and `cause` shapes without recursively inspecting an arbitrary request body.\n */\nfunction failureSignals(value: unknown, depth = 0, seen = new Set<object>()): string[] {\n if (typeof value === 'string') return value.trim() ? [value.trim()] : []\n if (!value || typeof value !== 'object' || depth >= 5 || seen.has(value)) return []\n seen.add(value)\n const out: string[] = []\n for (const key of [\n 'message',\n 'code',\n 'type',\n 'reason',\n 'codexErrorInfo',\n 'errorInfo',\n 'errorType',\n 'error_type',\n 'error',\n 'data',\n 'details',\n 'cause'\n ]) {\n try {\n out.push(...failureSignals(Reflect.get(value, key), depth + 1, seen))\n } catch {\n // A hostile/custom error getter must not replace the original turn error.\n }\n }\n return out\n}\n\nexport function turnFailureCode(err: unknown): TurnFailureCode {\n const signals = failureSignals(err)\n if (signals.some((signal) => PROVIDER_QUOTA_CODES.has(signal.toLowerCase().replace(/[^a-z0-9]/g, '')))) {\n return HOOK_REPORT_REASON_PROVIDER_QUOTA_EXHAUSTED\n }\n const message = signals.join('\\n')\n if (PROVIDER_AUTH_MESSAGES.some((pattern) => pattern.test(message))) {\n return HOOK_REPORT_REASON_PROVIDER_AUTH_REQUIRED\n }\n return PROVIDER_QUOTA_MESSAGES.some((pattern) => pattern.test(message))\n ? HOOK_REPORT_REASON_PROVIDER_QUOTA_EXHAUSTED\n : 'turn_failed'\n}\n\n/**\n * Resolve how to apply `desired` to the select config option tagged `category`.\n * `{skip}` (with the reason) means nothing should be sent: the runtime\n * advertises no such selector, doesn't offer the value, or already has it set.\n */\nexport function planConfigSelection(\n configOptions: SessionConfigOption[] | null | undefined,\n category: string,\n desired: string\n): ConfigSelectionPlan {\n const opt = configOptions?.find((o) => o.category === category && o.type === 'select')\n if (!opt || opt.type !== 'select') return { skip: `runtime advertises no ${category} selector` }\n const values = opt.options.flatMap((o) => ('group' in o ? o.options : [o])).map((o) => o.value)\n if (!values.includes(desired)) {\n return { skip: `value \"${desired}\" not offered (available: ${values.join(', ')})` }\n }\n if (opt.currentValue === desired) return { skip: `already \"${desired}\"` }\n return { configId: opt.id, value: desired }\n}\n\n/** Effort sentinel `'ultracode'` (matching Claude Code's own `ultracode` settings\n * key) meaning xhigh reasoning PLUS standing dynamic-workflow orchestration. It is\n * deliberately NOT a `thought_level` select value: the claude-acp runtime rejects\n * effort=\"ultracode\" (\"Invalid value\"). See {@link claudeSessionMeta}. */\nexport const ULTRACODE_EFFORT = 'ultracode'\n\n/** The session `_meta` sent to a Claude runtime on session/new and session/load\n * (`_meta.claudeCode.options` is spread into the SDK `query()` options layer), or\n * undefined off Claude runtimes. Three things ride on it:\n *\n * - `thinking`: recent models default `thinking.display` to \"omitted\" — thinking\n * blocks stream signature-only with empty text, so the ACP wrapper never emits\n * `agent_thought_chunk` and the transcript loses its reasoning rows. Request\n * \"summarized\" (the fullest display the API offers) so thoughts reach the stream.\n * - `settings.ultracode` (effort \"ultracode\" only): a session-scoped flag setting\n * the effort select can't reach — the runtime rejects effort=\"ultracode\".\n * `enableWorkflows` rides along so the \"pro\" plan default (workflows off) doesn't\n * silently drop the orchestration half. Best-effort: on a non-xhigh-capable model\n * or with workflows unavailable the runtime reports `applied.ultracode=false` and\n * the session still runs on its default effort — nothing to fail on our side.\n * - `systemPrompt` (top-level, sibling of `claudeCode`): the agent's system-prompt\n * seed PLUS, on a fresh session, the agent's memory index (standing context, not a\n * user turn — see SessionManager). We send it as `{ append }` so it layers ON TOP\n * of claude-acp's `claude_code` preset (keeping the coding scaffolding) rather than\n * replacing it. Honored by claude-agent-acp #91; older runtimes ignore the unknown\n * `_meta` key. This is the only channel for the system prompt — ACP session/new has\n * no such field, and other runtimes have no equivalent yet (see cp-overlay.ts). */\nexport function claudeSessionMeta(\n reasoningEffort: string | undefined,\n isClaudeRuntime: boolean,\n systemPrompt?: string,\n memoryAppend?: string\n):\n | {\n claudeCode: {\n options: {\n thinking: { type: 'adaptive'; display: 'summarized' }\n settings?: { ultracode: true; enableWorkflows: true }\n }\n }\n systemPrompt?: { append: string }\n }\n | undefined {\n if (!isClaudeRuntime) return undefined\n // The seed and the memory index ride the SAME append (seed first, blank line, then\n // memory). Either/both/neither — an empty result omits `systemPrompt` entirely.\n const append = [systemPrompt, memoryAppend].filter(Boolean).join('\\n\\n')\n return {\n claudeCode: {\n options: {\n thinking: { type: 'adaptive', display: 'summarized' },\n ...(reasoningEffort === ULTRACODE_EFFORT\n ? { settings: { ultracode: true as const, enableWorkflows: true as const } }\n : {})\n }\n },\n ...(append ? { systemPrompt: { append } } : {})\n }\n}\n\n/**\n * Extract the model selector from a session's `configOptions`. ACP models are an\n * (experimental) session config option tagged `category: \"model\"`, `type:\n * \"select\"`; the selectable values (optionally grouped) are the model list.\n * Returns null when the agent advertises no model selector.\n */\nexport function modelOptionsFrom(configOptions: SessionConfigOption[] | null | undefined): ModelOptions | null {\n const model = configOptions?.find((o) => o.category === 'model' && o.type === 'select')\n if (!model || model.type !== 'select') return null\n // `options` is either a flat SelectOption[] or a SelectGroup[]; flatten groups.\n const models = model.options.flatMap((o) => ('group' in o ? o.options : [o])).map((o) => o.value)\n return { current: model.currentValue, models }\n}\n\n/**\n * Extract the reasoning-effort selector from a session's `configOptions` (ACP\n * `category: \"thought_level\"`, `type: \"select\"`). Effort support is per-model: a runtime\n * only advertises this select for models that support effort (e.g. Opus/Sonnet, not\n * Haiku), so a missing/empty selector means the CURRENT model has no effort → returns\n * null and the picker is hidden. When the model DOES support effort, Claude runtimes get\n * the synthetic `max`/`ultracode` entries appended if not already offered (see\n * {@link ULTRACODE_EFFORT}) — never fabricated for a model that lacks effort entirely.\n */\nexport function effortOptionsFrom(\n configOptions: SessionConfigOption[] | null | undefined,\n isClaudeRuntime: boolean\n): EffortOptions | null {\n const opt = configOptions?.find((o) => o.category === 'thought_level' && o.type === 'select')\n if (!opt || opt.type !== 'select') return null\n const advertised = opt.options.flatMap((o) => ('group' in o ? o.options : [o])).map((o) => o.value)\n if (advertised.length === 0) return null\n const efforts = [...advertised]\n // The current model supports effort — Claude additionally allows `max` (session-only)\n // and `ultracode` (xhigh + workflow orchestration), which aren't `thought_level` values.\n if (isClaudeRuntime) for (const extra of ['max', ULTRACODE_EFFORT]) if (!efforts.includes(extra)) efforts.push(extra)\n return { current: opt.currentValue, efforts }\n}\n\n/**\n * Extract the permission/approval mode selector from a session's `configOptions` (ACP\n * `category: \"mode\"`, `type: \"select\"`). Returns null when the runtime exposes no mode\n * selector.\n */\nexport function permissionModeOptionsFrom(\n configOptions: SessionConfigOption[] | null | undefined\n): PermissionModeOptions | null {\n const opt = configOptions?.find((o) => o.category === 'mode' && o.type === 'select')\n if (!opt || opt.type !== 'select') return null\n const modes = opt.options.flatMap((o) => ('group' in o ? o.options : [o])).map((o) => o.value)\n return { current: opt.currentValue, modes }\n}\n\n/**\n * Extract the fast-mode toggle from a session's `configOptions` (ACP `category:\n * \"model_config\"`, `type: \"select\"` with on/off values). Returns null when the current\n * model advertises no fast toggle.\n */\nexport function fastOptionFrom(configOptions: SessionConfigOption[] | null | undefined): FastModeOption | null {\n const opt = configOptions?.find((o) => o.category === 'model_config' && o.type === 'select')\n if (!opt || opt.type !== 'select') return null\n return { current: opt.currentValue === 'on' }\n}\n\nexport class AcpHost {\n private child?: ChildProcess\n private conn?: ClientConnection\n // acpSessionIds this process created (or loaded). ACP sessions are in-memory in\n // the subprocess, so an id persisted across a daemon restart / host eviction is\n // unknown to a fresh process and must be re-created or re-loaded.\n private live = new Set<string>()\n // sessionIds currently mid-load: `session/load` makes the agent REPLAY its whole\n // history via session/update, which we must NOT forward to the platform (it would\n // re-post the entire conversation). Cleared when the load resolves.\n private loadingSessions = new Set<string>()\n // whether the agent advertised the `loadSession` capability at initialize.\n private canLoad = false\n // prompt content-block variants the agent opted into at initialize. text +\n // resource_link are always baseline; image/audio/embeddedContext are gated.\n private promptCaps: { image?: boolean; audio?: boolean; embeddedContext?: boolean } = {}\n // Selectors from the most recent session/new|load|set, distilled from the reconciled\n // config options. Populated by refreshOptionCaches(); read via modelOptions() /\n // effortOptions() / fastModeOption(). null ⇒ the runtime advertised no such selector.\n private lastModelOptions: ModelOptions | null = null\n private lastEffortOptions: EffortOptions | null = null\n private lastPermissionModeOptions: PermissionModeOptions | null = null\n private lastFastOption: FastModeOption | null = null\n // The most recent reconciled config-option set per live session, cached so a\n // mid-session `set_config_option` (e.g. setSessionModel) can plan against the\n // current options without a round-trip. Updated on new/load and each set.\n private sessionConfigs = new Map<string, SessionConfigOption[] | null | undefined>()\n // ACP protocol version the agent negotiated at initialize (it echoes the version\n // we requested if supported, else downgrades to its own latest). Read via\n // acpProtocolVersion(); undefined until start() completes the handshake.\n private negotiatedProtocolVersion?: number\n // Optional MCP transports the agent opted into at initialize (stdio is the ACP\n // baseline and always accepted). null until the handshake completes; the\n // unstable `acp` transport flag is deliberately ignored. Read via mcpCapabilities().\n private mcpCaps: McpTransportCapabilities | null = null\n\n constructor(\n private runtime: RuntimeDef,\n private opts: {\n onUpdate: (sessionId: string, update: SessionUpdate) => void\n /**\n * Interactive permission policy for ACP `session/request_permission`. When set,\n * the daemon renders the options to the user (e.g. a Slack card) and resolves\n * with their choice. Omitted (or throwing / returning undefined) falls back to\n * the non-interactive auto-allow below — so a platform with no interactive\n * surface, or a resolver that fails, never hangs the turn.\n */\n onPermission?: (\n sessionId: string,\n params: RequestPermissionRequest\n ) => Promise<RequestPermissionResponse | undefined>\n /**\n * Structured-input policy for ACP `elicitation/create` (form mode). When set, the\n * daemon renders the form to the user (e.g. a Slack select/buttons card) and\n * resolves with their choice. Omitted / throwing / returning undefined falls back\n * to declining the elicitation — the spec has agents handle `decline` — so a\n * platform with no interactive surface, or an unrenderable form, never hangs.\n */\n onElicit?: (sessionId: string, params: CreateElicitationRequest) => Promise<CreateElicitationResponse | undefined>\n env?: Record<string, string>\n configPrefs?: SessionConfigPrefs\n log?: Logger\n }\n ) {}\n\n /** A Claude Code runtime (its command/args reference `claude`) — these embed the\n * @anthropic-ai/claude-agent-sdk, which needs a Claude Code executable. */\n private isClaudeRuntime(): boolean {\n return [this.runtime.command, ...this.runtime.args].join(' ').toLowerCase().includes('claude')\n }\n\n async start(): Promise<void> {\n if (this.child) throw new Error('AcpHost: already started')\n const env: NodeJS.ProcessEnv = {\n ...process.env,\n ...Object.fromEntries(this.runtime.env.map((e) => [e.name, e.value])),\n ...(this.opts.env ?? {})\n }\n // The claude-agent-sdk resolves the Claude Code binary from its own bundled\n // native package (an OPTIONAL npm dep, often missing under npx / --omit=optional)\n // OR from `CLAUDE_CODE_EXECUTABLE`. If nothing set it but a `claude` CLI is on\n // PATH, point at it so an out-of-the-box Claude Code install just works.\n if (!env.CLAUDE_CODE_EXECUTABLE && this.isClaudeRuntime()) {\n const claude = resolveCommandPath('claude', env)\n if (claude) {\n env.CLAUDE_CODE_EXECUTABLE = claude\n this.opts.log?.info(`acp: CLAUDE_CODE_EXECUTABLE not set — using claude on PATH (${claude})`)\n }\n }\n // NOTE: the memory-backend env (disable the runtime's own memory for `managed`,\n // or redirect it under the agent root for `native`) is assembled by the daemon\n // in ensureHost via memoryProviderFor(agent).runtimeEnv() and passed in through\n // `opts.env` — it is NOT set here, so it stays per-agent-configurable. The\n // runtime prober / chat CLI construct AcpHost without that env and therefore get\n // the runtime's default memory behavior.\n // Resolve the command through resolveCommandPath so spawn gets an absolute path\n // (or a path-qualified relative one for auto-downloaded archives). This handles\n // ACP registry binary commands with a `./` prefix (\"./opencode\", \"./goose\", …)\n // that spawn() would otherwise resolve only against CWD and miss the binary on\n // `$PATH`. Falls back to the raw command when resolution fails (spawn's own error\n // surface is clearer than a synthetic ours).\n const resolved = resolveCommandPath(this.runtime.command, env) ?? this.runtime.command\n const child = spawn(resolved, this.runtime.args, {\n stdio: ['pipe', 'pipe', 'inherit'],\n env,\n // Own process group (POSIX): a foreground daemon's Ctrl-C sends SIGINT to the\n // whole terminal group, which killed adapters out from under the graceful\n // drain; and stop()'s escalation must reach the full tree — npx-distributed\n // runtimes run the real adapter as a grandchild of the npm wrapper, and\n // SIGKILLing just the wrapper orphans the adapter. The group id (= child pid)\n // lets stop() signal wrapper + adapter + their children in one kill.\n detached: process.platform !== 'win32'\n })\n this.child = child\n child.once('exit', () => {\n // Sweep group survivors (an adapter orphaned by its npx wrapper's death) NOW:\n // moments after the leader exits its pgid cannot have been recycled — a pgid\n // stays reserved while any member lives — so this can never hit a stranger.\n // A later sweep could (pid reuse), which is why stop() never signals a child\n // it found already dead. Clearing the handle also lets stop() early-return\n // instead of waiting on an 'exit' that already fired.\n if (child.pid && process.platform !== 'win32') {\n try {\n process.kill(-child.pid, 'SIGTERM')\n } catch {\n /* group already empty */\n }\n }\n if (this.child === child) this.child = undefined\n })\n\n if (!child.stdin || !child.stdout) {\n throw new Error('AcpHost: subprocess stdin/stdout are not piped')\n }\n const toAgent = Writable.toWeb(child.stdin) as WritableStream<Uint8Array>\n const fromAgent = Readable.toWeb(child.stdout) as unknown as ReadableStream<Uint8Array>\n const stream = ndJsonStream(toAgent, fromAgent)\n\n const self = this\n // fs read/write handlers are intentionally omitted (we advertise fs:false);\n // the SDK auto-replies method-not-found if the agent ever calls them.\n this.conn = createClientApp({ name: 'agentconnect' })\n .onNotification(methods.client.session.update, (ctx) => {\n // Drop historical conversation/tool chunks replayed by session/load, but\n // keep metadata such as restored titles and usage snapshots.\n if (self.loadingSessions.has(ctx.params.sessionId) && !shouldForwardUpdateDuringLoad(ctx.params.update)) return\n self.opts.onUpdate(ctx.params.sessionId, ctx.params.update)\n })\n .onRequest(methods.client.session.requestPermission, async (ctx) => {\n // Interactive policy first: ask the user via the platform (Slack card, …).\n // Any failure — no resolver, an unsupported surface, a thrown error, or an\n // undefined result — falls through to the auto-allow default so the turn can\n // never hang on a permission prompt.\n if (self.opts.onPermission) {\n try {\n const res = await self.opts.onPermission(ctx.params.sessionId, ctx.params)\n if (res) return res\n } catch (err) {\n self.opts.log?.debug(`acp: onPermission failed, auto-allowing: ${(err as Error).message}`)\n }\n }\n // Fallback: auto-allow the first allow option (no interactive resolution).\n const allow = ctx.params.options.find((o) => o.kind === 'allow_once' || o.kind === 'allow_always')\n const optionId = (allow ?? ctx.params.options[0])?.optionId\n return {\n outcome: optionId ? { outcome: 'selected', optionId } : { outcome: 'cancelled' }\n }\n })\n .onRequest(methods.client.elicitation.create, async (ctx) => {\n // Structured input (choice/boolean forms). Delegate to the platform policy; on\n // any failure — no resolver, unsupported surface/form, or a thrown error — decline\n // so the agent's turn never hangs (agents are expected to handle `decline`).\n // Only session-scoped elicitations map to a live turn; request-scoped ones\n // (auth/config phase, no session) have no sessionId — decline those.\n const sessionId = (ctx.params as { sessionId?: string }).sessionId\n if (self.opts.onElicit && sessionId) {\n try {\n const res = await self.opts.onElicit(sessionId, ctx.params)\n if (res) return res\n } catch (err) {\n self.opts.log?.debug(`acp: onElicit failed, declining: ${(err as Error).message}`)\n }\n }\n return { action: 'decline' }\n })\n .connect(stream)\n\n const init = await this.conn.agent.request(methods.agent.initialize, {\n protocolVersion: PROTOCOL_VERSION,\n clientCapabilities: {\n fs: { readTextFile: false, writeTextFile: false },\n // Advertise form-based elicitation so runtimes may ask structured questions\n // (choice/boolean). Unrenderable forms / non-interactive platforms are declined\n // gracefully by the onElicit fallback above.\n elicitation: { form: {} }\n }\n })\n this.negotiatedProtocolVersion = init.protocolVersion\n this.canLoad = init.agentCapabilities?.loadSession ?? false\n this.promptCaps = init.agentCapabilities?.promptCapabilities ?? {}\n const mcp = init.agentCapabilities?.mcpCapabilities\n this.mcpCaps = { http: mcp?.http ?? false, sse: mcp?.sse ?? false }\n this.opts.log?.debug(\n `acp: agent initialized (loadSession=${this.canLoad}, prompt caps: image=${!!this.promptCaps.image} audio=${!!this.promptCaps.audio} embeddedContext=${!!this.promptCaps.embeddedContext}, mcp: http=${this.mcpCaps.http} sse=${this.mcpCaps.sse})`\n )\n }\n\n /** Whether the agent advertised support for a gated prompt content-block kind.\n * `text` and `resource_link` are baseline and always return true. */\n promptSupports(kind: 'image' | 'audio' | 'embeddedContext'): boolean {\n return Boolean(this.promptCaps[kind])\n }\n\n /** Whether this runtime carries the system prompt (and the fresh-session memory\n * index) via `_meta.systemPrompt` — true for Claude, which gets them there rather\n * than as a leading inline block. Lets SessionManager route memory correctly:\n * Claude → `_meta` (via newSession's memoryAppend); others → an inline block. */\n usesMetaSystemPrompt(): boolean {\n return this.isClaudeRuntime()\n }\n\n /** Create a fresh ACP session. `effortOverride` (the sticky per-session effort choice,\n * when set) takes the place of the agent default in the Claude `_meta` — the only\n * channel `ultracode` can ride (the `thought_level` select rejects it); select-based\n * effort/model/fast overrides are layered on afterward by the daemon at turn start.\n * `systemAppend` (the agent meta object + the agent's memory index, for a FRESH\n * session) rides the Claude `_meta.systemPrompt` append — standing context, never a\n * user turn (see #398). */\n async newSession(\n cwd: string,\n mcpServers: McpServer[] = [],\n effortOverride?: string,\n systemAppend?: string\n ): Promise<string> {\n const _meta = claudeSessionMeta(\n effortOverride ?? this.opts.configPrefs?.reasoningEffort,\n this.isClaudeRuntime(),\n this.opts.configPrefs?.systemPrompt,\n systemAppend\n )\n const res = await this.conn!.agent.request(methods.agent.session.new, {\n cwd,\n mcpServers,\n ...(_meta ? { _meta } : {})\n })\n this.live.add(res.sessionId)\n const configOptions = await this.applySessionConfig(res.sessionId, res.configOptions)\n this.refreshOptionCaches(configOptions)\n this.sessionConfigs.set(res.sessionId, configOptions)\n return res.sessionId\n }\n\n /**\n * Apply the desired model / reasoning effort / fast mode to a fresh session\n * via ACP `session/set_config_option`. Model first — the effort and fast-mode\n * vocabularies depend on the selected model, and each response returns the\n * reconciled option set the next step plans against. Best-effort by design: a\n * runtime without the selector, an unoffered value, or a failed request logs\n * and moves on — the session still runs on the runtime's defaults. Returns the\n * final option set.\n */\n private async applySessionConfig(\n sessionId: string,\n initial: SessionConfigOption[] | null | undefined\n ): Promise<SessionConfigOption[] | null | undefined> {\n let options = initial\n // ultracode rides `_meta` on session/new|load (see claudeSessionMeta), not the\n // thought_level select — the runtime rejects effort=\"ultracode\". When it's\n // requested, skip thought_level entirely (it would only `{skip}` anyway, and\n // ultracode already forces effort to xhigh).\n const ultracode = this.isClaudeRuntime() && this.opts.configPrefs?.reasoningEffort === ULTRACODE_EFFORT\n const fastMode = this.opts.configPrefs?.fastMode\n const prefs: Array<[category: string, desired: string | undefined]> = [\n ['model', this.opts.configPrefs?.model],\n ['mode', this.opts.configPrefs?.permissionMode],\n ['thought_level', ultracode ? undefined : this.opts.configPrefs?.reasoningEffort],\n // Fast mode comes AFTER model: the option is only advertised (and the\n // reconciled option set only carries it) once a fast-capable model is set.\n ['model_config', fastMode === undefined ? undefined : fastMode ? 'on' : 'off']\n ]\n for (const [category, desired] of prefs) {\n if (!desired) continue\n const plan = planConfigSelection(options, category, desired)\n if ('skip' in plan) {\n this.opts.log?.debug(`acp: session config ${category}=\"${desired}\" not applied — ${plan.skip}`)\n continue\n }\n try {\n const res = await this.conn!.agent.request(methods.agent.session.setConfigOption, {\n sessionId,\n configId: plan.configId,\n value: plan.value\n })\n options = res.configOptions\n this.opts.log?.info(`acp: session config ${category} set to \"${desired}\"`)\n } catch (err) {\n this.opts.log?.warn(`acp: failed to set session config ${category}=\"${desired}\": ${(err as Error).message}`)\n }\n }\n return options\n }\n\n /** Re-derive the model / effort / fast selector caches from a reconciled option set. */\n private refreshOptionCaches(configOptions: SessionConfigOption[] | null | undefined): void {\n this.lastModelOptions = modelOptionsFrom(configOptions)\n this.lastEffortOptions = effortOptionsFrom(configOptions, this.isClaudeRuntime())\n this.lastPermissionModeOptions = permissionModeOptionsFrom(configOptions)\n this.lastFastOption = fastOptionFrom(configOptions)\n }\n\n /** The model selector for one live session, or the most recently reconciled\n * selector when no session is supplied (runtime probing/backward compatibility). */\n modelOptions(sessionId?: string): ModelOptions | null {\n if (sessionId !== undefined) return modelOptionsFrom(this.sessionConfigs.get(sessionId))\n return this.lastModelOptions\n }\n\n /** The reasoning-effort selector (incl. synthetic ultracode/max on Claude runtimes)\n * from the most recent session/new|load, or null if none is offered. */\n effortOptions(): EffortOptions | null {\n return this.lastEffortOptions\n }\n\n /** The permission/approval mode selector from the most recent session/new|load, or\n * null if none is offered. */\n permissionModeOptions(): PermissionModeOptions | null {\n return this.lastPermissionModeOptions\n }\n\n /** The fast-mode toggle from the most recent session/new|load, or null if the current\n * model offers no fast mode. */\n fastModeOption(): FastModeOption | null {\n return this.lastFastOption\n }\n\n /**\n * Apply one select config option to an ALREADY-RUNNING session via ACP\n * `session/set_config_option`, refreshing the cached option set + selector caches on\n * success. Returns true iff applied: false when the session isn't live here, the\n * runtime advertises no such selector, the value isn't offered, or it's already set.\n */\n private async setSessionConfig(sessionId: string, category: string, value: string): Promise<boolean> {\n if (!this.live.has(sessionId)) return false\n const plan = planConfigSelection(this.sessionConfigs.get(sessionId), category, value)\n if ('skip' in plan) {\n this.opts.log?.debug(`acp: set ${category}=\"${value}\" on ${sessionId} not applied — ${plan.skip}`)\n return false\n }\n const res = await this.conn!.agent.request(methods.agent.session.setConfigOption, {\n sessionId,\n configId: plan.configId,\n value: plan.value\n })\n this.sessionConfigs.set(sessionId, res.configOptions)\n this.refreshOptionCaches(res.configOptions)\n this.opts.log?.info(`acp: session ${sessionId} ${category} set to \"${value}\"`)\n return true\n }\n\n /** Switch the model of an already-running session (ACP `model` select) — the\n * mid-session counterpart of the model applied at new/load. */\n async setSessionModel(sessionId: string, model: string): Promise<boolean> {\n return this.setSessionConfig(sessionId, 'model', model)\n }\n\n /** Switch the reasoning effort of an already-running session (ACP `thought_level`\n * select). Returns false for `ultracode` — it isn't a select value and can only ride\n * session `_meta` at new/load, so the caller relies on the override being re-applied\n * when the session is next (re)created or resumed. */\n async setSessionEffort(sessionId: string, effort: string): Promise<boolean> {\n if (effort === ULTRACODE_EFFORT) return false\n return this.setSessionConfig(sessionId, 'thought_level', effort)\n }\n\n /** Switch the permission/approval mode of an already-running session (ACP `mode`\n * select). Values are runtime-owned and validated against the advertised options. */\n async setSessionPermissionMode(sessionId: string, mode: string): Promise<boolean> {\n return this.setSessionConfig(sessionId, 'mode', mode)\n }\n\n /** Toggle fast mode on an already-running session (ACP `model_config` on/off select).\n * False when the current model offers no fast toggle. */\n async setSessionFastMode(sessionId: string, on: boolean): Promise<boolean> {\n return this.setSessionConfig(sessionId, 'model_config', on ? 'on' : 'off')\n }\n\n /** The ACP protocol version negotiated at initialize, or undefined before the\n * handshake completed. Used by the runtime probe to report ACP coverage. */\n acpProtocolVersion(): number | undefined {\n return this.negotiatedProtocolVersion\n }\n\n /** The optional MCP transports the agent advertised at initialize (stdio is\n * baseline and always accepted; the unstable `acp` flag is ignored). null\n * before the handshake completed. Feeds the runtime probe's transport gating. */\n mcpCapabilities(): McpTransportCapabilities | null {\n return this.mcpCaps\n }\n\n /** True iff THIS agent process created or loaded `sessionId` in its current lifetime. */\n hasSession(sessionId: string): boolean {\n return this.live.has(sessionId)\n }\n\n /** Whether the agent advertised the `loadSession` capability (session/load is usable). */\n loadSupported(): boolean {\n return this.canLoad\n }\n\n /** Resume a previously-created session by id (ACP `session/load`). The agent\n * restores its own history server-side; replayed conversation/tool output is\n * suppressed while metadata updates still converge. `mcpServers` must be\n * re-attached here — the agent doesn't persist them across processes. `systemAppend` (the agent meta\n * object) is re-asserted via `_meta.systemPrompt` so a session resumed in a fresh\n * agent process keeps its system prompt. Throws if the agent can't load the id\n * (caller falls back to newSession). */\n async loadSession(\n sessionId: string,\n cwd: string,\n mcpServers: McpServer[] = [],\n effortOverride?: string,\n systemAppend?: string\n ): Promise<void> {\n this.loadingSessions.add(sessionId)\n try {\n const _meta = claudeSessionMeta(\n effortOverride ?? this.opts.configPrefs?.reasoningEffort,\n this.isClaudeRuntime(),\n systemAppend ?? this.opts.configPrefs?.systemPrompt\n )\n const res = await this.conn!.agent.request(methods.agent.session.load, {\n sessionId,\n cwd,\n mcpServers,\n ...(_meta ? { _meta } : {})\n })\n this.live.add(sessionId)\n // Re-apply config prefs: ACP sessions restore their own last model/effort,\n // which may predate a CP-side agent edit.\n const configOptions = await this.applySessionConfig(sessionId, res.configOptions)\n // Refresh the selectors from the reconciled options — a resumed session must\n // report its own model/effort/fast, not stale ones from the last session/new (or\n // null if this process never created one). Mirrors newSession().\n this.refreshOptionCaches(configOptions)\n this.sessionConfigs.set(sessionId, configOptions)\n this.opts.log?.info(`acp: resumed session ${sessionId} via session/load`)\n } catch (err) {\n this.opts.log?.debug(`acp: session/load failed for ${sessionId} (${(err as Error).message}) — will recreate`)\n throw err\n } finally {\n this.loadingSessions.delete(sessionId)\n }\n }\n\n /** Drive one turn to completion. Returns the stop reason plus the agent's token\n * `usage` when the runtime reports it (ACP's experimental per-turn usage, which\n * carries session-cumulative counts) — `undefined` when it doesn't. */\n async prompt(sessionId: string, blocks: ContentBlock[]): Promise<{ stopReason: StopReason; usage?: Usage }> {\n const res = await this.conn!.agent.request(methods.agent.session.prompt, { sessionId, prompt: blocks })\n return { stopReason: res.stopReason, usage: res.usage ?? undefined }\n }\n\n async cancel(sessionId: string): Promise<void> {\n await this.conn!.agent.notify(methods.agent.session.cancel, { sessionId })\n }\n\n /** Stop the adapter child: stdin EOF + SIGTERM, then escalate to SIGKILL if it\n * hasn't exited within `deadlineMs` (a buggy/hung agent must never block daemon\n * shutdown or an idle reap). Signals target the child's process group (it is\n * spawned detached) so they reach the real adapter behind an npx wrapper too.\n * Idempotent — the child handle is cleared up front so a concurrent stop (drain\n * + reconcile racing) is a no-op rather than a double-kill. */\n async stop(deadlineMs = 5000): Promise<void> {\n const child = this.child\n if (!child) return\n this.child = undefined\n // Group signal when the child has its own group (detached spawn); fall back to\n // the direct child on win32 or once the group is gone (ESRCH).\n const kill = (sig: NodeJS.Signals) => {\n if (child.pid && process.platform !== 'win32') {\n try {\n process.kill(-child.pid, sig)\n return\n } catch {\n /* group already gone — try the direct child */\n }\n }\n child.kill(sig)\n }\n // A child that already exited on its own has emitted 'exit' already: once('exit')\n // below would never fire and stop() would hang the daemon forever, kill() being a\n // no-op on a reaped pid. No group sweep here — the child may have been dead for\n // minutes (idle sweep cadence) and its pgid recycled to an unrelated process;\n // the spawn-time 'exit' listener already swept while the pgid was provably ours.\n if (child.exitCode !== null || child.signalCode !== null) return\n // Graceful first: ACP is a stdio protocol, EOF on stdin is the idiomatic \"we're\n // done\" and propagates through an npx wrapper to the adapter. The web-stream\n // wrapper may hold the pipe locked mid-write — then the signals below still land.\n try {\n child.stdin?.end()\n } catch {\n /* stream locked/destroyed — signals still land */\n }\n kill('SIGTERM')\n await new Promise<void>((resolve) => {\n let settled = false\n let killFailsafe: NodeJS.Timeout | undefined\n const done = () => {\n if (settled) return\n settled = true\n clearTimeout(timer)\n clearTimeout(killFailsafe)\n resolve()\n }\n const timer = setTimeout(() => {\n this.opts.log?.warn(`acp: child ignored SIGTERM after ${deadlineMs}ms — sending SIGKILL`)\n kill('SIGKILL')\n // SIGKILL on a live child always ends in 'exit'; the failsafe only covers a\n // kill with nothing left to hit, so stop() resolves no matter what.\n killFailsafe = setTimeout(done, 2000)\n }, deadlineMs)\n child.once('exit', done)\n })\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MAAM,KAAK,aAAa,KAAqB;EAC3C,MAAM,QAAQ,KAAK;EACnB,IAAI,CAAC,OAAO;EACZ,KAAK,QAAQ,KAAA;EAGb,MAAM,QAAQ,QAAwB;GACpC,IAAI,MAAM,OAAO,QAAQ,aAAa,SACpC,IAAI;IACF,QAAQ,KAAK,CAAC,MAAM,KAAK,GAAG;IAC5B;GACF,QAAQ,CAER;GAEF,MAAM,KAAK,GAAG;EAChB;EAMA,IAAI,MAAM,aAAa,QAAQ,MAAM,eAAe,MAAM;EAI1D,IAAI;GACF,MAAM,OAAO,IAAI;EACnB,QAAQ,CAER;EACA,KAAK,SAAS;EACd,MAAM,IAAI,SAAe,YAAY;GACnC,IAAI,UAAU;GACd,IAAI;GACJ,MAAM,aAAa;IACjB,IAAI,SAAS;IACb,UAAU;IACV,aAAa,KAAK;IAClB,aAAa,YAAY;IACzB,QAAQ;GACV;GACA,MAAM,QAAQ,iBAAiB;IAC7B,KAAK,KAAK,KAAK,KAAK,oCAAoC,WAAW,qBAAqB;IACxF,KAAK,SAAS;IAGd,eAAe,WAAW,MAAM,GAAI;GACtC,GAAG,UAAU;GACb,MAAM,KAAK,QAAQ,IAAI;EACzB,CAAC;CACH;AACF"}
|
|
1
|
+
{"version":3,"file":"acp-host-CZZ9sWf6.js","names":["z.object","z.string","z.array","z.record","z\n .object","z.union","fsp","fsp","c","o","r","m","v","FOLDER","isPathSpec","isPathSpec2","pathspec2","pathspec3","vulnerabilityCheck","isPathSpec3","toPaths","z.unknown","z.NEVER","z\n .array","z.union","z.number","z.string","z.object","z.record","z.unknown","z\n .int","z.literal","z.array","z.boolean","z\n .record","z.intersection","z.url","z\n .union","z.int","validate.zInitializeRequest","validate.zNewSessionRequest","validate.zLoadSessionRequest","validate.zForkSessionRequest","validate.zListSessionsRequest","validate.zDeleteSessionRequest","validate.zResumeSessionRequest","validate.zCloseSessionRequest","validate.zSetSessionModeRequest","validate.zSetSessionConfigOptionRequest","validate.zAuthenticateRequest","validate.zListProvidersRequest","validate.zSetProviderRequest","validate.zDisableProviderRequest","validate.zLogoutRequest","validate.zPromptRequest","validate.zStartNesRequest","validate.zSuggestNesRequest","validate.zCloseNesRequest","validate.zCancelNotification","validate.zDidOpenDocumentNotification","validate.zDidChangeDocumentNotification","validate.zDidCloseDocumentNotification","validate.zDidSaveDocumentNotification","validate.zDidFocusDocumentNotification","validate.zAcceptNesNotification","validate.zRejectNesNotification","validate.zRequestPermissionRequest","validate.zWriteTextFileRequest","validate.zReadTextFileRequest","validate.zCreateTerminalRequest","validate.zTerminalOutputRequest","validate.zReleaseTerminalRequest","validate.zWaitForTerminalExitRequest","validate.zKillTerminalRequest","validate.zCreateElicitationRequest","validate.zSessionNotification","validate.zCompleteElicitationNotification","spawn","createClientApp"],"sources":["../src/runtimes/registry.ts","../src/mcp/tools.ts","../src/agents/memory.ts","../src/agents/native-memory.ts","../src/agents/memory-provider.ts","../../../node_modules/.pnpm/@kwsites+file-exists@1.1.1/node_modules/@kwsites/file-exists/dist/src/index.js","../../../node_modules/.pnpm/@kwsites+file-exists@1.1.1/node_modules/@kwsites/file-exists/dist/index.js","../../../node_modules/.pnpm/@simple-git+args-pathspec@1.0.3/node_modules/@simple-git/args-pathspec/dist/index.mjs","../../../node_modules/.pnpm/@kwsites+promise-deferred@1.1.1/node_modules/@kwsites/promise-deferred/dist/index.js","../../../node_modules/.pnpm/@simple-git+argv-parser@1.1.1/node_modules/@simple-git/argv-parser/dist/index.mjs","../../../node_modules/.pnpm/simple-git@3.36.0/node_modules/simple-git/dist/esm/index.js","../src/workspace/git-injection.ts","../src/workspace/workspace-manager.ts","../../../node_modules/.pnpm/@agentclientprotocol+sdk@1.1.0_zod@4.4.3/node_modules/@agentclientprotocol/sdk/dist/schema/index.js","../../../node_modules/.pnpm/@agentclientprotocol+sdk@1.1.0_zod@4.4.3/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.js","../../../node_modules/.pnpm/@agentclientprotocol+sdk@1.1.0_zod@4.4.3/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.js","../../../node_modules/.pnpm/@agentclientprotocol+sdk@1.1.0_zod@4.4.3/node_modules/@agentclientprotocol/sdk/dist/stream.js","../../../node_modules/.pnpm/@agentclientprotocol+sdk@1.1.0_zod@4.4.3/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.js","../../../node_modules/.pnpm/@agentclientprotocol+sdk@1.1.0_zod@4.4.3/node_modules/@agentclientprotocol/sdk/dist/acp.js","../src/runtimes/probe.ts","../src/acp/acp-host.ts"],"sourcesContent":["import { z } from 'zod'\nimport { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs'\nimport { dirname } from 'node:path'\nimport type { RuntimeDef, Config } from '../config/config-schema.js'\nimport { registryPath, registryCachePath } from '../paths.js'\n\nconst PackageDistSchema = z.object({ package: z.string(), args: z.array(z.string()).default([]) })\nconst BinaryPlatformSchema = z.object({\n archive: z.string().optional(),\n cmd: z.string(),\n args: z.array(z.string()).default([]),\n env: z.record(z.string(), z.string()).default({})\n})\nconst DistributionSchema = z.object({\n npx: PackageDistSchema.optional(),\n uvx: PackageDistSchema.optional(),\n binary: z.record(z.string(), BinaryPlatformSchema).optional()\n})\nexport const RegistryEntrySchema = z.object({\n id: z.string(),\n name: z.string().default(''),\n version: z.string().default(''),\n distribution: DistributionSchema\n})\nexport type RegistryEntry = z.infer<typeof RegistryEntrySchema>\n\n// Root tolerates both an id-keyed object and an {agents:[...]} array; normalizes to {agents: Record}.\nexport const RegistryDocSchema = z\n .object({ agents: z.union([z.array(RegistryEntrySchema), z.record(z.string(), RegistryEntrySchema)]) })\n .transform((d) => ({\n agents: Array.isArray(d.agents) ? Object.fromEntries(d.agents.map((a) => [a.id, a])) : d.agents\n }))\nexport type RegistryDoc = { agents: Record<string, RegistryEntry> }\n\nexport function platformKey(): string | null {\n const os =\n process.platform === 'win32'\n ? 'windows'\n : process.platform === 'darwin'\n ? 'darwin'\n : process.platform === 'linux'\n ? 'linux'\n : null\n const arch = process.arch === 'arm64' ? 'aarch64' : process.arch === 'x64' ? 'x86_64' : null\n if (!os || !arch) return null\n return `${os}-${arch}`\n}\n\nexport function toRuntimeDef(entry: RegistryEntry): RuntimeDef | null {\n const d = entry.distribution\n if (d.npx) return { command: 'npx', args: ['-y', d.npx.package, ...d.npx.args], env: [] }\n if (d.uvx) return { command: 'uvx', args: [d.uvx.package, ...d.uvx.args], env: [] }\n if (d.binary) {\n const key = platformKey()\n const bin = key ? d.binary[key] : undefined\n if (!bin) return null\n return { command: bin.cmd, args: bin.args, env: Object.entries(bin.env).map(([name, value]) => ({ name, value })) }\n }\n return null\n}\n\nconst REGISTRY_URL = 'https://cdn.agentclientprotocol.com/registry/v1/latest/registry.json'\nconst DEFAULT_TIMEOUT_MS = 4500\n\ninterface CacheMeta {\n etag?: string\n lastModified?: string\n fetchedAt?: number\n}\n\nfunction readCachedDoc(root: string): RegistryDoc | null {\n const file = registryPath(root)\n if (!existsSync(file)) return null\n try {\n return RegistryDocSchema.parse(JSON.parse(readFileSync(file, 'utf8')))\n } catch {\n return null\n }\n}\n\nfunction readCacheMeta(root: string): CacheMeta {\n const file = registryCachePath(root)\n if (!existsSync(file)) return {}\n try {\n return JSON.parse(readFileSync(file, 'utf8')) as CacheMeta\n } catch {\n return {}\n }\n}\n\nexport async function fetchRegistry(\n root: string,\n opts: { fetchImpl?: typeof fetch; timeoutMs?: number } = {}\n): Promise<RegistryDoc> {\n const doFetch = opts.fetchImpl ?? fetch\n const meta = readCacheMeta(root)\n const headers: Record<string, string> = {}\n if (meta.etag) headers['If-None-Match'] = meta.etag\n if (meta.lastModified) headers['If-Modified-Since'] = meta.lastModified\n\n const ac = new AbortController()\n const timer = setTimeout(() => ac.abort(), opts.timeoutMs ?? DEFAULT_TIMEOUT_MS)\n try {\n const res = await doFetch(REGISTRY_URL, { headers, signal: ac.signal })\n if (res.status === 304) return readCachedDoc(root) ?? { agents: {} }\n if (!res.ok) return readCachedDoc(root) ?? { agents: {} }\n const bodyText = await res.text()\n const doc = RegistryDocSchema.parse(JSON.parse(bodyText))\n mkdirSync(dirname(registryPath(root)), { recursive: true }) // root may not exist on a zero-config first run\n writeFileSync(registryPath(root), bodyText)\n const newMeta: CacheMeta = {\n etag: res.headers.get('etag') ?? undefined,\n lastModified: res.headers.get('last-modified') ?? undefined,\n fetchedAt: Date.now()\n }\n writeFileSync(registryCachePath(root), JSON.stringify(newMeta))\n return doc\n } catch {\n return readCachedDoc(root) ?? { agents: {} }\n } finally {\n clearTimeout(timer)\n }\n}\n\n/**\n * Display names (registry id -> human-facing `name`) read from the local cache.\n * Used for capability reporting — the daemon advertises the tool name to the CP\n * rather than the registry id. Entries with no `name` are omitted (callers fall\n * back to the id). Returns `{}` when no cached registry doc exists.\n */\nexport function cachedRuntimeNames(root: string): Record<string, string> {\n const doc = readCachedDoc(root)\n if (!doc) return {}\n const out: Record<string, string> = {}\n for (const [id, entry] of Object.entries(doc.agents)) {\n if (entry.name) out[id] = entry.name\n }\n return out\n}\n\n/**\n * Runtime versions (registry id -> `version`) read from the local cache. Used to\n * stamp each entry of the `facts/daemon-runtimes` snapshot the daemon reports.\n * Entries with no `version` are omitted (callers fall back to ''). `{}` when no\n * cached registry doc exists.\n */\nexport function cachedRuntimeVersions(root: string): Record<string, string> {\n const doc = readCachedDoc(root)\n if (!doc) return {}\n const out: Record<string, string> = {}\n for (const [id, entry] of Object.entries(doc.agents)) {\n if (entry.version) out[id] = entry.version\n }\n return out\n}\n\nexport async function defaultRuntimes(\n root: string,\n opts: { mode?: 'cache-first' | 'blocking'; fetchImpl?: typeof fetch; timeoutMs?: number } = {}\n): Promise<Record<string, RuntimeDef>> {\n const mode = opts.mode ?? 'blocking'\n const cached = mode === 'cache-first' ? readCachedDoc(root) : null\n let doc: RegistryDoc\n if (cached) {\n doc = cached\n void fetchRegistry(root, opts).catch(() => {}) // background refresh; affects next run only\n } else {\n doc = await fetchRegistry(root, opts)\n }\n const out: Record<string, RuntimeDef> = {}\n for (const [id, entry] of Object.entries(doc.agents)) {\n const rt = toRuntimeDef(entry)\n if (rt) out[id] = rt\n }\n return out\n}\n\nexport async function resolveRuntimes(\n cfg: Config,\n root: string,\n opts: {\n neededRuntimes?: string[]\n mode?: 'cache-first' | 'blocking'\n fetchImpl?: typeof fetch\n timeoutMs?: number\n } = {}\n): Promise<Record<string, RuntimeDef>> {\n const userRuntimes = cfg.runtimes ?? {}\n const needed = opts.neededRuntimes\n if (needed && needed.length > 0 && needed.every((n) => userRuntimes[n])) {\n return { ...userRuntimes }\n }\n const defaults = await defaultRuntimes(root, opts)\n return { ...defaults, ...userRuntimes }\n}\n","import type { Integration } from '../agents/agent-schema.js'\n\n/**\n * A tool descriptor in MCP's `tools/list` shape: a name, a human/model-facing\n * description, and a JSON Schema for the arguments. The daemon owns these\n * definitions; the stdio bridge just relays them to the agent harness verbatim.\n */\nexport interface ToolDescriptor {\n name: string\n description: string\n inputSchema: Record<string, unknown>\n}\n\nconst obj = (properties: Record<string, unknown>, required: string[] = []): Record<string, unknown> => ({\n type: 'object',\n properties,\n required,\n additionalProperties: false\n})\n\n/**\n * Session metadata tools are available to every agent, independently of the\n * platform and memory backend. The title is deliberately model-authored: ACP\n * runtimes do not all generate a semantic session title themselves, while the\n * agent already has the context needed to choose one without a second LLM call.\n */\nexport const SESSION_TOOLS: ToolDescriptor[] = [\n {\n name: 'setSessionTitle',\n description:\n 'Set the user-facing title for this AgentConnect session. Before your first substantive answer, after you ' +\n 'understand the first meaningful request (ignore greetings and acknowledgements), call this once with a ' +\n 'concise, specific title of about 3-8 words or a similarly short phrase. Call it again only if the task focus ' +\n 'materially changes. If the user asks what the title is, set the exact title you give them. Do not mention this ' +\n 'housekeeping call in your response.',\n inputSchema: obj(\n {\n title: {\n type: 'string',\n minLength: 1,\n maxLength: 80,\n description: 'A concise, specific session title (maximum 80 characters).'\n }\n },\n ['title']\n )\n }\n]\n\n/**\n * Tools injected when an agent has a Slack integration. `sendSlackMessage` is\n * the active-messaging tool from the design (token held by the daemon, invisible\n * to the model); the rest are channel/user read helpers.\n */\nconst SLACK_TOOLS: ToolDescriptor[] = [\n {\n name: 'sendSlackMessage',\n description:\n 'Send a message to a Slack channel. Omit `channel` to post in the channel this conversation is happening in. ' +\n 'Omit `thread` to reply in the current thread; pass an empty string to post to the channel root instead.',\n inputSchema: obj(\n {\n text: {\n type: 'string',\n description:\n 'Message body, in standard Markdown (CommonMark/GFM). Use `**bold**`, `~~strikethrough~~`, ' +\n '`# headings`, tables, etc. — Slack renders standard Markdown natively (do NOT use single-char ' +\n 'Slack mrkdwn like `*bold*` or `~strike~`).'\n },\n channel: {\n type: 'string',\n description: 'Target channel ID (e.g. C0123ABC). Defaults to the current channel.'\n },\n thread: {\n type: 'string',\n description: 'Thread timestamp to reply under. Defaults to the current thread; \"\" posts to the channel root.'\n }\n },\n ['text']\n )\n },\n {\n name: 'getCurrentChannel',\n description:\n 'Return the Slack channel (and thread) this conversation is bound to, including the channel name when available.',\n inputSchema: obj({})\n },\n {\n name: 'listChannelMembers',\n description:\n 'List the users and bots in a channel (id, name, is_bot). Omit `channel` to list members of the current channel.',\n inputSchema: obj({\n channel: { type: 'string', description: 'Channel ID. Defaults to the current channel.' }\n })\n },\n {\n name: 'listChannels',\n description: 'List the public/private channels the bot is a member of and can post to.',\n inputSchema: obj({})\n },\n {\n name: 'getUserProfile',\n description: 'Look up a Slack user or bot by id, returning their display name, real name, and bot flag.',\n inputSchema: obj({ user: { type: 'string', description: 'User ID (e.g. U0123ABC).' } }, ['user'])\n },\n {\n name: 'readSlackFile',\n description:\n 'Fetch the contents of a file shared in Slack, using the bot credentials. You do NOT have direct network access ' +\n \"to Slack's private file URLs (they require the bot token) — use this tool instead of curl/fetch. Pass the file's \" +\n '`url` (the `url_private` / `uri` from a shared attachment or resource link). Images are returned as viewable image ' +\n 'content; text files as text. Supply `mimeType` when known for correct handling.',\n inputSchema: obj(\n {\n url: { type: 'string', description: \"The file's url_private (or url_private_download) / resource-link uri.\" },\n mimeType: { type: 'string', description: 'Optional MIME type hint, e.g. image/png or text/plain.' }\n },\n ['url']\n )\n }\n]\n\n/**\n * Tools injected when an agent has a Telegram integration. Mirrors the Slack set\n * but for the Telegram data model: `channel` is a chat id (e.g. -1001234567890),\n * `thread` is a forum-topic `message_thread_id`, and there is no `listChannels`\n * (a bot cannot enumerate the chats it belongs to).\n */\nconst TELEGRAM_TOOLS: ToolDescriptor[] = [\n {\n name: 'sendTelegramMessage',\n description:\n 'Send a message to a Telegram chat. Omit `channel` to post in the chat this conversation is happening in. ' +\n 'Omit `thread` to reply in the current forum topic; pass an empty string to post outside any topic.',\n inputSchema: obj(\n {\n text: {\n type: 'string',\n description:\n 'Message body, in standard Markdown (CommonMark/GFM). Use `**bold**`, `*italic*`, `` `code` ``, ' +\n '`[links](url)`, lists, etc. — the daemon converts it to Telegram formatting and escapes special ' +\n 'characters for you, so write plain Markdown (do NOT pre-escape with backslashes).'\n },\n channel: {\n type: 'string',\n description:\n 'Target chat id (e.g. -1001234567890, or a positive id for a private chat). Defaults to the current chat.'\n },\n thread: {\n type: 'string',\n description:\n 'Forum-topic message_thread_id to reply under. Defaults to the current topic; \"\" posts outside any topic.'\n }\n },\n ['text']\n )\n },\n {\n name: 'getCurrentChannel',\n description:\n 'Return the Telegram chat (and forum topic) this conversation is bound to, including the chat title when available.',\n inputSchema: obj({})\n },\n {\n name: 'listChannelMembers',\n description:\n 'List the users and bots in a chat (id, name, is_bot). Omit `channel` to list members of the current chat. ' +\n 'Note: Telegram only exposes administrators for large groups.',\n inputSchema: obj({\n channel: { type: 'string', description: 'Chat id. Defaults to the current chat.' }\n })\n },\n {\n name: 'getUserProfile',\n description: 'Look up a Telegram user or bot by id, returning their display name, username, and bot flag.',\n inputSchema: obj({ user: { type: 'string', description: 'Numeric user id (e.g. 12345678).' } }, ['user'])\n },\n {\n name: 'readTelegramFile',\n description:\n 'Fetch the contents of a file shared in Telegram, using the bot credentials. You do NOT have direct network ' +\n \"access to Telegram's file storage — use this tool instead of curl/fetch. Pass the file's `url` (the `file_id` \" +\n 'from a shared attachment or the `uri` of a resource link). Images are returned as viewable image content; text ' +\n 'files as text. Supply `mimeType` when known for correct handling.',\n inputSchema: obj(\n {\n url: { type: 'string', description: \"The shared file's Telegram file_id (or resource-link uri).\" },\n mimeType: { type: 'string', description: 'Optional MIME type hint, e.g. image/png or text/plain.' }\n },\n ['url']\n )\n }\n]\n\n/**\n * The agent's long-term memory tools — available to EVERY agent regardless of\n * integrations. Memory is a directory (`<agent-root>/memory/`) with a `MEMORY.md`\n * index (injected into the prompt each session) plus `<topic>.md` files the agent\n * reads on demand. Keep the index short; move detail into topic files.\n */\nexport const MEMORY_TOOLS: ToolDescriptor[] = [\n {\n name: 'listMemory',\n description:\n 'List your memory files — the MEMORY.md index plus any topic files you have written. Use this to discover ' +\n 'what you have stored before reading or updating it.',\n inputSchema: obj({})\n },\n {\n name: 'readMemory',\n description:\n 'Read one of your memory files. Omit `path` (or pass \"MEMORY.md\") to read the index; pass a topic file name ' +\n '(e.g. \"deploys.md\") to read that topic. The index is already shown to you at the start of each session — use ' +\n 'this to pull the detail behind an index entry when it is relevant.',\n inputSchema: obj({\n path: { type: 'string', description: 'Memory file name (e.g. \"deploys.md\"). Defaults to the MEMORY.md index.' }\n })\n },\n {\n name: 'writeMemory',\n description:\n 'Save one of your memory files (whole-file overwrite). Omit `path` to write the MEMORY.md index; pass a topic ' +\n 'file name (e.g. \"deploys.md\") for a topic. Keep the INDEX short — a scannable list that links to topic files ' +\n '(e.g. \"- [deploys](deploys.md) — how we ship\"); put the actual detail in the topic files. Use for durable ' +\n 'facts across sessions: conventions, decisions, who to ask, things you had to re-learn. A flat directory — no ' +\n 'subfolders in the path.',\n inputSchema: obj(\n {\n path: {\n type: 'string',\n description: 'Memory file name (e.g. \"deploys.md\"). Defaults to the MEMORY.md index. No subdirectories.'\n },\n content: { type: 'string', description: 'The full new file contents, in Markdown. Replaces the file.' }\n },\n ['content']\n )\n }\n]\n\n/** The memory tool names — used to strip them for a `native`-memory agent (which\n * uses the runtime's own memory instead). */\nexport const MEMORY_TOOL_NAMES = new Set(MEMORY_TOOLS.map((t) => t.name))\n\n/**\n * Agent-collaboration tools — available to EVERY agent regardless of platform\n * (discovery is org/coords-level, not platform-gated). `listChannelAgents` asks\n * the CP who else is in the current channel so an agent can find peers to work\n * with. The requesting agent's identity is injected by the daemon from the\n * session context — it is NOT a tool input.\n */\nexport const COLLABORATION_TOOLS: ToolDescriptor[] = [\n {\n name: 'listChannelAgents',\n description:\n 'List the other AI agents present in a channel — their id, name, displayName, description, and status — so you ' +\n 'can discover peers to collaborate with. Omit `channel` to list agents in the channel this conversation is ' +\n 'happening in. Only channels you are a member of can be listed, and only agents you are allowed to reach are ' +\n 'returned.',\n inputSchema: obj({\n channel: {\n type: 'string',\n description: 'Channel/chat id to list agents for. Defaults to the current channel.'\n }\n })\n },\n {\n name: 'messageAgent',\n description:\n 'Wake another AI agent by delivering a message into its session, so it picks the work up in its own turn. ' +\n 'Use `toAgentId` from listChannelAgents. The message is delivered asynchronously — this does NOT return the ' +\n \"peer's reply; the peer answers in the channel/thread (and can message you back). Omit `channel`/`thread` to \" +\n 'target the same thread this conversation is in. Your identity as the caller is attached automatically — you ' +\n 'cannot message yourself, and the target may be configured to reject calls from you (then `delivered` is false ' +\n 'with a `reason`). When you are REPLYING to an agent that messaged you (you set `toAgentId` to that same agent), ' +\n 'your reply automatically carries the correlation back to it — you do NOT need to pass `correlationId`; the ' +\n 'daemon threads it for you so orchestration results are matched. Pass `correlationId` only to override this ' +\n 'default (advanced/manual use). ' +\n 'IMPORTANT — be quiet about the mechanics: do NOT post a separate chat message announcing that you sent it or ' +\n 'restating \"delivered: true\"; the delivery is handled and already visible. After calling this tool, stay silent ' +\n 'and end your turn unless you have something substantive for the human (a genuine blocker, or the peer’s actual ' +\n 'reply once it arrives). Keep any necessary status to one short line.',\n inputSchema: obj(\n {\n toAgentId: { type: 'string', description: 'The agent id to message (from listChannelAgents).' },\n text: { type: 'string', description: 'The message to deliver into the target agent’s session.' },\n channel: {\n type: 'string',\n description: 'Target channel/chat id. Defaults to the current channel.'\n },\n thread: {\n type: 'string',\n description: 'Target thread. Defaults to the current thread; \"\" targets the channel root.'\n },\n correlationId: {\n type: 'string',\n description:\n 'Optional opaque id to correlate a reply back to this request (used by multi-agent orchestration). ' +\n 'You normally do NOT set this: when replying to an agent that called you, the correlation is inherited ' +\n 'automatically. Provide it only to override the inherited value.'\n }\n },\n ['toAgentId', 'text']\n )\n },\n {\n name: 'startOrchestration',\n description:\n 'Fan out a batch of subtasks to worker agents in one atomic step, then wait asynchronously. ' +\n 'The daemon persists an orchestration record (all subtasks pending) BEFORE delivering, delivers each ' +\n 'subtask to its worker (attaching a correlationId so their replies map back), and schedules a one-shot ' +\n 'deadline that wakes THIS session when it fires. Returns { orchestrationId, delivered:[correlationId…], ' +\n 'failed:[{correlationId, reason}…] }. This does NOT return the workers’ results — you are woken (by a ' +\n 'worker reply or the deadline) and then call getOrchestration to read statuses/results and summarize. ' +\n 'Tell each worker in its `text` to report back to you when done (their reply auto-carries the correlationId).',\n inputSchema: obj(\n {\n subtasks: {\n type: 'array',\n description: 'The subtasks to fan out, one per worker delivery.',\n items: obj(\n {\n toAgentId: { type: 'string', description: 'The worker agent id to deliver this subtask to.' },\n text: { type: 'string', description: 'The instruction delivered into the worker’s session.' }\n },\n ['toAgentId', 'text']\n )\n },\n deadlineMs: {\n type: 'number',\n description:\n 'Optional deadline in milliseconds from now. When it elapses, your session is woken so you can ' +\n 'summarize partial results; unreported subtasks are marked timed_out. Omit for no deadline.'\n },\n replyTarget: {\n type: 'string',\n description: 'Optional opaque marker for where you should post the final human-facing summary.'\n }\n },\n ['subtasks']\n )\n },\n {\n name: 'getOrchestration',\n description:\n 'Read one of YOUR orchestrations — its subtasks with per-subtask status (pending/sending/delivered/' +\n 'succeeded/worker_error/timed_out) and any collected results. Call this each time you are woken (by a ' +\n 'worker report or the deadline) to judge whether all subtasks are in (N-of-N) or the deadline passed, ' +\n 'then summarize. Only the orchestration’s owning main agent+session may read it.',\n inputSchema: obj(\n { orchestrationId: { type: 'string', description: 'The orchestrationId returned by startOrchestration.' } },\n ['orchestrationId']\n )\n },\n {\n name: 'cancelOrchestration',\n description:\n 'Cancel one of YOUR orchestrations: cancels its pending deadline and writes a cancelled tombstone (the ' +\n 'record is kept, not deleted). Already-delivered workers are not recalled — a late report from them after ' +\n 'cancellation is ignored. Only the owning main agent+session may cancel.',\n inputSchema: obj(\n { orchestrationId: { type: 'string', description: 'The orchestrationId returned by startOrchestration.' } },\n ['orchestrationId']\n )\n }\n]\n\n/**\n * Formal GitHub PR review effect. The descriptor may remain attached to a\n * long-lived per-thread ACP session, but availability is not authorization:\n * execution resolves the daemon-private active hook turn and fails closed for\n * every ordinary/non-PR/policy-off turn. The target is intentionally absent.\n */\nexport const GITHUB_REVIEW_TOOLS: ToolDescriptor[] = [\n {\n name: 'submitGithubReview',\n description:\n 'Submit the formal review for the active GitHub pull-request hook turn. The repository, pull request, and ' +\n 'commit are fixed by trusted turn metadata and cannot be selected here. Use COMMENT for a formal non-blocking ' +\n 'review, REQUEST_CHANGES for a failing review, or APPROVE for a passing review. This tool is unavailable ' +\n 'outside an authorized active PR hook turn, and at most one review can be submitted per turn. The review body ' +\n 'is the complete public response: once an attempt starts, only a definite not_submitted result preserves the ordinary-comment fallback.',\n inputSchema: obj(\n {\n event: { type: 'string', enum: ['COMMENT', 'REQUEST_CHANGES', 'APPROVE'] },\n verdict: { type: 'string', enum: ['pass', 'fail', 'neutral'] },\n body: {\n type: 'string',\n minLength: 1,\n description:\n 'Complete, self-contained top-level public review summary. Required and non-empty for every event, including APPROVE.'\n },\n comments: {\n type: 'array',\n description: 'Optional inline review comments, submitted atomically with the top-level review.',\n items: obj(\n {\n path: { type: 'string' },\n body: { type: 'string' },\n line: { type: 'integer', minimum: 1 },\n side: { type: 'string', enum: ['LEFT', 'RIGHT'] },\n startLine: { type: 'integer', minimum: 1 },\n startSide: { type: 'string', enum: ['LEFT', 'RIGHT'] }\n },\n ['path', 'body', 'line', 'side']\n )\n }\n },\n ['event', 'verdict', 'body']\n )\n }\n]\n\nexport const ALL_TOOL_NAMES = [\n ...new Set(\n [\n ...SESSION_TOOLS,\n ...SLACK_TOOLS,\n ...TELEGRAM_TOOLS,\n ...MEMORY_TOOLS,\n ...COLLABORATION_TOOLS,\n ...GITHUB_REVIEW_TOOLS\n ].map((t) => t.name)\n )\n]\n\n/**\n * The default MCP tool set for an agent. Session metadata, memory, and\n * collaboration tools are always present; platform tools are gated by the\n * agent's integrations. Deduped by name so an agent bridging both platforms\n * doesn't get the shared read helpers (getCurrentChannel/listChannelMembers/getUserProfile)\n * twice — the first platform's variant wins, and both behave identically.\n */\nexport function toolsForIntegrations(integrations: Integration[]): ToolDescriptor[] {\n const tools: ToolDescriptor[] = []\n const seen = new Set<string>()\n const add = (set: ToolDescriptor[]) => {\n for (const t of set) {\n if (seen.has(t.name)) continue\n seen.add(t.name)\n tools.push(t)\n }\n }\n add(SESSION_TOOLS)\n add(MEMORY_TOOLS)\n add(COLLABORATION_TOOLS)\n if (integrations.some((i) => i.platform === 'slack')) add(SLACK_TOOLS)\n if (integrations.some((i) => i.platform === 'telegram')) add(TELEGRAM_TOOLS)\n return tools\n}\n","/**\n * Agent memory — a DIRECTORY at the agent's ROOT (`<agent-root>/memory/`), OUTSIDE\n * the workspace so it survives a workspace reset / re-clone and is never committed\n * into a github-workspace repo.\n *\n * Index-plus-topics shape (the structure Claude Code's auto-memory uses): a lean\n * `MEMORY.md` index — injected into the prompt every session, so it must stay small\n * — plus any number of `<topic>.md` files the agent reads on demand. The agent\n * maintains it via the `readMemory` / `writeMemory` / `listMemory` MCP tools; the\n * daemon serves the same directory to the CP for the console.\n *\n * SECURITY: topic paths are agent/console-supplied, so every path is contained to\n * the memory dir — absolute paths and `..` escapes are rejected, and the resolved\n * path is re-checked so a symlink can't smuggle a target out. Flat by design (one\n * level): a topic is a file directly under `memory/`, no nested dirs.\n */\nimport { promises as fsp, mkdirSync, existsSync, writeFileSync } from 'node:fs'\nimport { join, resolve, isAbsolute, sep } from 'node:path'\nimport { MEMORY_INDEX } from '@agentconnect.md/protocol'\n\nexport const MEMORY_DIRNAME = 'memory'\nexport { MEMORY_INDEX }\n\n/** Max bytes of the index injected into the prompt each session — keeps a large\n * memory from swelling the context (mirrors Claude Code's 25 KB entrypoint cap). */\nexport const MAX_INDEX_INJECT_BYTES = 25_000\n\n/** Hard cap on a single memory file. Injected/read every session, so an unbounded\n * file would swell the prompt and the wire; writes over this are rejected. */\nexport const MAX_MEMORY_FILE_BYTES = 256_000\n\n/** The append-only change log for an agent's memory, a sidecar beside the memory\n * files (`<agent-root>/memory/.history`). One JSON line per write, for provenance\n * (who/what/when changed a file). Dotfile so it never surfaces as a topic. */\nexport const MEMORY_HISTORY_FILENAME = '.history'\n\n/** Cap on a `before`/`after` snapshot stored in a history line — keeps a single log\n * entry bounded even for a large file. Over this, the snapshot is truncated (with a\n * `…` marker) rather than omitted, so the line stays small but still human-readable. */\nexport const MAX_HISTORY_VALUE_BYTES = 4_000\n\n/** Where a memory write originated — for change-log provenance. */\nexport type MemoryWriteSource = 'tool' | 'console' | 'distill'\n\n/** One line in the memory change log (`.history`). `event` is `add` on a first write,\n * `update` on an overwrite; `delete` is reserved (no delete op exists today — a\n * \"clear\" is an empty write, recorded as an `update`). `before`/`after` are the\n * file's text, truncated to {@link MAX_HISTORY_VALUE_BYTES}. */\nexport interface MemoryHistoryRecord {\n path: string\n event: 'add' | 'update' | 'delete'\n before?: string\n after: string\n at: string\n scope: string\n source: MemoryWriteSource\n truncated?: boolean\n}\n\n/** Raised when a memory path escapes the memory dir. Surfaces as `BAD_PAYLOAD`. */\nexport class MemoryPathError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'MemoryPathError'\n }\n}\n\n/** Raised when a write exceeds {@link MAX_MEMORY_FILE_BYTES}. `BAD_PAYLOAD`. */\nexport class MemoryTooLargeError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'MemoryTooLargeError'\n }\n}\n\n/** Raised when an `ifMatchMtime` precondition fails (the file changed under the\n * writer — e.g. a console edit racing a newer agent write). Surfaces as CONFLICT. */\nexport class MemoryConflictError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'MemoryConflictError'\n }\n}\n\n/** The memory directory for an agent, given its root dir (where agent.json lives). */\nexport function memoryDir(agentDir: string): string {\n return join(agentDir, MEMORY_DIRNAME)\n}\n\n/** Resolve a memory-dir-relative path to an absolute one, contained to the dir.\n * Rejects absolute paths, `..` escapes, and any nested directory (flat only). */\nexport function resolveInMemoryDir(agentDir: string, relPath: string): string {\n if (isAbsolute(relPath)) throw new MemoryPathError('absolute paths are not allowed')\n const dir = memoryDir(agentDir)\n const abs = resolve(dir, relPath)\n if (abs !== dir && !abs.startsWith(dir + sep)) throw new MemoryPathError('path escapes the memory dir')\n // Flat memory dir: a topic is a direct child, never a nested path.\n const rel = abs.slice(dir.length + 1)\n if (rel.includes(sep)) throw new MemoryPathError('memory is a flat directory (no subdirectories)')\n if (rel.length === 0) throw new MemoryPathError('a file name is required')\n return abs\n}\n\n/** Seed `<agent-root>/memory/MEMORY.md` with a header if the dir/index is absent\n * (idempotent). Called at session start so a brand-new agent always has an index. */\nexport function ensureMemory(agentDir: string, agentName: string): void {\n const dir = memoryDir(agentDir)\n mkdirSync(dir, { recursive: true })\n const index = join(dir, MEMORY_INDEX)\n if (!existsSync(index)) {\n writeFileSync(\n index,\n `# ${agentName} memory\\n\\nYour long-term memory index. Keep it short — link out to topic files ` +\n `(e.g. \\`[deploys](deploys.md)\\`) for detail and read them on demand with the readMemory tool.\\n`\n )\n }\n}\n\n/** Read the memory index (`MEMORY.md`) for prompt injection, trimmed to the inject\n * cap so a large index can't blow up the prompt; '' when absent. */\nexport async function readIndex(agentDir: string): Promise<string> {\n const text = await readMemoryFile(agentDir, MEMORY_INDEX)\n if (Buffer.byteLength(text) <= MAX_INDEX_INJECT_BYTES) return text\n // Cut on a UTF-8 boundary near the cap and flag the truncation.\n const buf = Buffer.from(text, 'utf8').subarray(0, MAX_INDEX_INJECT_BYTES)\n return buf.toString('utf8') + '\\n\\n[…memory index truncated — trim MEMORY.md]'\n}\n\n/** Read a memory file's text; '' when it does not exist (never throws on ENOENT). */\nexport async function readMemoryFile(agentDir: string, relPath: string): Promise<string> {\n const abs = resolveInMemoryDir(agentDir, relPath)\n try {\n return await fsp.readFile(abs, 'utf8')\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return ''\n throw err\n }\n}\n\n/** Truncate a snapshot to the history value cap, on a UTF-8 boundary, flagging it. */\nfunction clampHistoryValue(text: string): { value: string; truncated: boolean } {\n if (Buffer.byteLength(text) <= MAX_HISTORY_VALUE_BYTES) return { value: text, truncated: false }\n const buf = Buffer.from(text, 'utf8').subarray(0, MAX_HISTORY_VALUE_BYTES)\n return { value: buf.toString('utf8') + '…', truncated: true }\n}\n\n/** Append one line to the memory change log (`<agent-root>/memory/.history`). A single\n * `O_APPEND` write, so concurrent appends never interleave a partial line. Best-effort:\n * a logging failure must never fail the write it describes, so errors are swallowed. */\nexport async function appendHistory(agentDir: string, record: MemoryHistoryRecord): Promise<void> {\n try {\n await fsp.mkdir(memoryDir(agentDir), { recursive: true })\n await fsp.appendFile(join(memoryDir(agentDir), MEMORY_HISTORY_FILENAME), JSON.stringify(record) + '\\n', 'utf8')\n } catch {\n // provenance is best-effort — never let it break the actual memory write.\n }\n}\n\n/** Overwrite a memory file with `content` (creating the dir if needed). Atomic\n * (tmp + rename) so a concurrent read never sees a partial file. Appends a line to\n * the change log (`.history`) recording the add/update, its `before`/`after`\n * snapshot (bounded), and the `source`.\n *\n * - Rejects content over {@link MAX_MEMORY_FILE_BYTES} ({@link MemoryTooLargeError}).\n * - `ifMatchMtime` (optimistic concurrency): when given, the current file's mtime\n * must equal it, else {@link MemoryConflictError} — so a console edit can't\n * clobber a newer write. A brand-new file (no mtime) matches `ifMatchMtime`\n * only when the caller passes none (or the empty string). */\nexport async function writeMemoryFile(\n agentDir: string,\n relPath: string,\n content: string,\n ifMatchMtime?: string,\n source: MemoryWriteSource = 'tool'\n): Promise<{ size: number; mtime: string }> {\n if (Buffer.byteLength(content) > MAX_MEMORY_FILE_BYTES) {\n throw new MemoryTooLargeError(`memory file exceeds the ${MAX_MEMORY_FILE_BYTES}-byte limit`)\n }\n const abs = resolveInMemoryDir(agentDir, relPath)\n // Read the prior contents (for the change log's `before` + to decide add vs update)\n // before we overwrite. '' when absent ⇒ this is an `add`.\n let before = ''\n let existed = false\n try {\n before = await fsp.readFile(abs, 'utf8')\n existed = true\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code !== 'ENOENT') throw err\n }\n if (ifMatchMtime) {\n let current: string | null = null\n try {\n current = (await fsp.stat(abs)).mtime.toISOString()\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code !== 'ENOENT') throw err\n }\n if (current !== ifMatchMtime) {\n throw new MemoryConflictError('the memory file changed since it was read; reload and retry')\n }\n }\n await fsp.mkdir(memoryDir(agentDir), { recursive: true })\n const tmp = `${abs}.tmp`\n await fsp.writeFile(tmp, content, 'utf8')\n await fsp.rename(tmp, abs)\n const st = await fsp.stat(abs)\n\n const beforeClamped = existed ? clampHistoryValue(before) : undefined\n const afterClamped = clampHistoryValue(content)\n await appendHistory(agentDir, {\n path: relPath,\n event: existed ? 'update' : 'add',\n ...(beforeClamped ? { before: beforeClamped.value } : {}),\n after: afterClamped.value,\n at: st.mtime.toISOString(),\n scope: 'agent',\n source,\n ...(afterClamped.truncated || beforeClamped?.truncated ? { truncated: true } : {})\n })\n return { size: st.size, mtime: st.mtime.toISOString() }\n}\n\n/** One file in the memory dir. */\nexport interface MemoryFile {\n name: string\n size: number\n mtime: string\n}\n\n/** List the files in the memory dir (flat; index + topics), sorted with the index\n * first. Empty when the dir does not exist. `.tmp` write artifacts are skipped. */\nexport async function listMemory(agentDir: string): Promise<MemoryFile[]> {\n const dir = memoryDir(agentDir)\n let dirents\n try {\n dirents = await fsp.readdir(dir, { withFileTypes: true })\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return []\n throw err\n }\n const files: MemoryFile[] = []\n for (const d of dirents) {\n // Skip non-files, `.tmp` write artifacts, and dotfiles (the `.history` change log\n // is a sidecar, not a topic the agent/console should see).\n if (!d.isFile() || d.name.endsWith('.tmp') || d.name.startsWith('.')) continue\n try {\n const st = await fsp.stat(join(dir, d.name))\n files.push({ name: d.name, size: st.size, mtime: st.mtime.toISOString() })\n } catch {\n // raced deletion — skip\n }\n }\n files.sort((a, b) => (a.name === MEMORY_INDEX ? -1 : b.name === MEMORY_INDEX ? 1 : a.name.localeCompare(b.name)))\n return files\n}\n","/**\n * Native-memory runtime levers + file surfacing.\n *\n * The `native` MemoryProvider (agents/memory-provider.ts) redirects the runtime's\n * OWN memory under the agent root — so each agent's native memory is isolated\n * instead of sharing the host's `~/.claude` / `~/.codex`. Two responsibilities:\n *\n * 1. `nativeRuntimeEnv` — the env delta that redirects (and, where needed, enables)\n * the runtime's memory. This is an EXPLICIT per-runtime registry: we only set\n * env for runtimes whose levers we've verified against their docs. A runtime not\n * in the registry is `isNativeRuntimeSupported === false`, and selecting native\n * for it fails loudly upstream — we never guess env for an unverified runtime.\n *\n * 2. `nativeMemoryList/Read/Write` — surface the runtime's memory files to the\n * console from wherever the redirect points. Unlike managed's flat\n * `<agent-root>/memory/`, the runtime dirs are nested (Claude keys memory by a\n * sanitized-cwd subpath), so this uses a nested-but-contained walk.\n *\n * Levers verified 2026-07-08 (claude docs + binary strings; codex docs; and the\n * daemon's own `runtimes/probe.ts` home-override table):\n * - claude → `CLAUDE_CONFIG_DIR=<root>/.claude`; auto-memory lands at\n * `<root>/.claude/projects/<sanitized-cwd>/memory/`. Do NOT set the disable flag.\n * - codex → `CODEX_HOME=<root>/.codex`; memories at `<root>/.codex/memories/`.\n */\nimport { promises as fsp } from 'node:fs'\nimport { join, resolve, isAbsolute, sep, relative } from 'node:path'\nimport type { RuntimeDef } from '../config/config-schema.js'\nimport type { MemoryEntry } from '@agentconnect.md/protocol'\nimport type { MemoryReadResult, MemoryWriteResult } from './memory-provider.js'\nimport { MemoryPathError, MemoryTooLargeError, MAX_MEMORY_FILE_BYTES } from './memory.js'\n\n/** A registered native runtime: how to detect it, and the env + read-root it implies. */\ninterface NativeRuntimeSpec {\n /** Does this RuntimeDef refer to this runtime? (command/args substring, lowercased) */\n matches: (runtime: RuntimeDef) => boolean\n /** Env delta that redirects (and enables) the runtime's own memory under `root`. */\n env: (root: string) => Record<string, string>\n /** The dir (relative to the agent root) the runtime writes its memory into — what\n * the console lists/reads. Nested files under it are allowed. */\n readRoot: (root: string) => string\n}\n\nfunction cmdIncludes(runtime: RuntimeDef, needle: string): boolean {\n return [runtime.command, ...runtime.args].join(' ').toLowerCase().includes(needle)\n}\n\n/**\n * The explicit registry. ADD a runtime here only after verifying its env levers\n * against the tool's own docs (and, ideally, the installed binary) — mirroring the\n * home-override table the daemon already keeps in `runtimes/probe.ts`. An absent\n * runtime is intentionally unsupported for native memory.\n */\nconst NATIVE_RUNTIMES: NativeRuntimeSpec[] = [\n {\n // Anthropic Claude Code — CLAUDE_CONFIG_DIR relocates the whole `.claude` state\n // dir; auto-memory lives under it at projects/<sanitized-cwd>/memory/. We do NOT\n // set CLAUDE_CODE_DISABLE_AUTO_MEMORY (that's managed's job).\n matches: (rt) => cmdIncludes(rt, 'claude'),\n env: (root) => ({ CLAUDE_CONFIG_DIR: join(root, '.claude') }),\n // memory lands in a cwd-derived subpath — list the projects tree and pick out\n // the memory dirs (see listUnder, which walks nested files).\n readRoot: (root) => join(root, '.claude', 'projects')\n },\n {\n // OpenAI Codex — CODEX_HOME relocates the home; memories land in memories/.\n matches: (rt) => cmdIncludes(rt, 'codex'),\n env: (root) => ({ CODEX_HOME: join(root, '.codex') }),\n readRoot: (root) => join(root, '.codex', 'memories')\n }\n]\n\nfunction specFor(runtime: RuntimeDef | undefined): NativeRuntimeSpec | undefined {\n if (!runtime) return undefined\n return NATIVE_RUNTIMES.find((s) => s.matches(runtime))\n}\n\n/** Whether native memory is supported (env levers registered) for this runtime. */\nexport function isNativeRuntimeSupported(runtime: RuntimeDef): boolean {\n return specFor(runtime) !== undefined\n}\n\n/** The env delta redirecting the runtime's own memory under `agentRoot`. Empty for\n * an unregistered runtime (callers should gate on `isNativeRuntimeSupported`). */\nexport function nativeRuntimeEnv(runtime: RuntimeDef, agentRoot: string): Record<string, string> {\n return specFor(runtime)?.env(agentRoot) ?? {}\n}\n\n/** Resolve a console-supplied relative path under `root`, allowing nested dirs but\n * rejecting absolute paths, `..` escapes, and symlink-smuggled escapes. Unlike the\n * managed dir (flat), native runtime dirs are nested. */\nfunction resolveContained(root: string, relPath: string): string {\n if (isAbsolute(relPath)) throw new MemoryPathError('absolute paths are not allowed')\n const abs = resolve(root, relPath)\n if (abs !== root && !abs.startsWith(root + sep)) throw new MemoryPathError('path escapes the memory dir')\n if (abs === root) throw new MemoryPathError('a file name is required')\n return abs\n}\n\n/** Recursively list files under `dir` (relative names, posix-ish with `sep`), sorted.\n * Empty when the dir is absent. Skips `.tmp` artifacts. */\nasync function listUnder(dir: string): Promise<MemoryEntry[]> {\n const out: MemoryEntry[] = []\n async function walk(cur: string): Promise<void> {\n let dirents\n try {\n dirents = await fsp.readdir(cur, { withFileTypes: true })\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return\n throw err\n }\n for (const d of dirents) {\n const p = join(cur, d.name)\n if (d.isDirectory()) {\n await walk(p)\n } else if (d.isFile() && !d.name.endsWith('.tmp')) {\n try {\n const st = await fsp.stat(p)\n out.push({ name: relative(dir, p), size: st.size, mtime: st.mtime.toISOString() })\n } catch {\n // raced deletion — skip\n }\n }\n }\n }\n await walk(dir)\n out.sort((a, b) => a.name.localeCompare(b.name))\n return out\n}\n\n/** List the runtime's native memory files under the agent root. */\nexport async function nativeMemoryList(agentDir: string, runtime: RuntimeDef | undefined): Promise<MemoryEntry[]> {\n const spec = specFor(runtime)\n if (!spec) return []\n return listUnder(spec.readRoot(agentDir))\n}\n\n/** Read one native memory file (relative to the runtime's read root); '' when absent. */\nexport async function nativeMemoryRead(\n agentDir: string,\n runtime: RuntimeDef | undefined,\n path: string\n): Promise<MemoryReadResult> {\n const spec = specFor(runtime)\n if (!spec) return { path, content: '' }\n const abs = resolveContained(spec.readRoot(agentDir), path)\n try {\n return { path, content: await fsp.readFile(abs, 'utf8') }\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return { path, content: '' }\n throw err\n }\n}\n\n/** Overwrite one native memory file (console edit). Atomic tmp+rename; size-capped. */\nexport async function nativeMemoryWrite(\n agentDir: string,\n runtime: RuntimeDef | undefined,\n path: string,\n content: string,\n _ifMatch?: string\n): Promise<MemoryWriteResult> {\n const spec = specFor(runtime)\n if (!spec) throw new MemoryPathError('native memory is not supported for this runtime')\n if (Buffer.byteLength(content) > MAX_MEMORY_FILE_BYTES) {\n throw new MemoryTooLargeError(`memory file exceeds the ${MAX_MEMORY_FILE_BYTES}-byte limit`)\n }\n const abs = resolveContained(spec.readRoot(agentDir), path)\n const dir = abs.slice(0, abs.length - (abs.split(sep).pop()?.length ?? 0))\n await fsp.mkdir(dir, { recursive: true })\n const tmp = `${abs}.tmp`\n await fsp.writeFile(tmp, content, 'utf8')\n await fsp.rename(tmp, abs)\n const st = await fsp.stat(abs)\n return { ok: true, path, size: st.size, mtime: st.mtime.toISOString() }\n}\n","/**\n * `MemoryProvider` — the pluggable seam behind an agent's long-term memory.\n *\n * The daemon drives a provider at the existing hook points: it seeds/injects the\n * memory index at session start, exposes the memory tools, serves list/read/write\n * for both the agent (MCP tools) and the console, and contributes the runtime-env\n * delta that decides where the runtime's OWN memory lives. Making this a port lets\n * memory be backed three ways (design: docs/designs/memory-evolution.md):\n *\n * - `managed` — our directory (`<agent-root>/memory/`), the default. The runtime's\n * own memory is DISABLED so there's one store.\n * - `native` — the runtime's own memory (Claude auto-memory / Codex memories),\n * REDIRECTED under the agent root (via env) for per-agent isolation. We don't\n * inject or expose tools — the runtime manages and loads it itself.\n * - `external` — an outside service (e.g. mem0). Not yet implemented (M-5).\n *\n * Per-agent selection: each agent carries `memory.provider`. The daemon holds a\n * `DispatchingMemoryProvider` that routes every scope-bearing call to the agent's\n * configured concrete provider. The one non-scoped seam is `runtimeEnv` (it needs\n * the agent root + the concrete runtime), applied directly in `daemon.ts` where the\n * full agent is in hand — see `memoryProviderFor`.\n *\n * The CP frame path keeps its own byte-sliced reader (`cp/memory-reader.ts`): its\n * UTF-8-boundary + frame-budget slicing is a wire-transport concern that must not\n * leak into this storage-domain port. `read()` here is whole-file (MCP semantics).\n */\nimport type { MemoryEntry } from '@agentconnect.md/protocol'\nimport type { RuntimeDef } from '../config/config-schema.js'\nimport type { ToolDescriptor } from '../mcp/tools.js'\nimport { MEMORY_TOOLS } from '../mcp/tools.js'\nimport {\n ensureMemory,\n readIndex,\n readMemoryFile,\n writeMemoryFile,\n listMemory,\n type MemoryWriteSource\n} from './memory.js'\nimport {\n nativeMemoryList,\n nativeMemoryRead,\n nativeMemoryWrite,\n nativeRuntimeEnv,\n isNativeRuntimeSupported\n} from './native-memory.js'\n\nexport type { MemoryEntry }\n\n/** The provider kind an agent is configured with (protocol `memory.provider`). */\nexport type MemoryProviderKind = 'native' | 'managed' | 'external'\n\n/** The context key every memory op carries. `managed` uses `agentId` only today;\n * `userId`/`sessionId` are reserved for per-scope partitioning in later providers. */\nexport interface MemoryScope {\n agentId: string\n userId?: string\n sessionId?: string\n}\n\n/** Result of the `readMemory` tool path — the whole file's text. */\nexport interface MemoryReadResult {\n path: string\n content: string\n}\n\n/** Result of the `writeMemory` tool path. */\nexport interface MemoryWriteResult {\n ok: true\n path: string\n size: number\n mtime: string\n}\n\n/** A recorded agent turn — the hook `native`/`external` providers use to distill\n * memory. `managed`/`native` M-2 have no per-turn distillation, so `recordTurn`\n * is a no-op and this stays opaque. */\nexport type TurnRecord = unknown\n\n/**\n * The port. Every method is scope-carrying so a later provider can partition by\n * user/session without a signature change.\n */\nexport interface MemoryProvider {\n readonly kind: MemoryProviderKind\n\n /** Env delta to merge into the runtime child so its OWN memory goes where this\n * provider wants it: `managed` disables it; `native` redirects it under the\n * agent root; applied by `daemon.ts` at spawn (see `memoryProviderFor`). */\n runtimeEnv(runtime: RuntimeDef): Record<string, string>\n\n /** Seed a brand-new agent's memory so injection and the tools always have a\n * target (idempotent). Called once per session handle before prompt building. */\n ensure(scope: MemoryScope, agentName: string): void\n\n /** The text to inject at the start of a FRESH session (the memory index, capped).\n * '' when there is nothing to inject. The caller owns the surrounding prompt prose. */\n injectAtSessionStart(scope: MemoryScope): Promise<string>\n\n /** Record one finished turn for providers that distill memory from turns. No-op\n * for `managed`/`native`. */\n recordTurn(scope: MemoryScope, turn: TurnRecord): Promise<void>\n\n /** The memory MCP tools to expose to the agent. Empty when the runtime manages\n * its own memory (`native`). */\n tools(): ToolDescriptor[]\n\n list(scope: MemoryScope): Promise<MemoryEntry[]>\n read(scope: MemoryScope, path: string): Promise<MemoryReadResult>\n write(\n scope: MemoryScope,\n path: string,\n content: string,\n ifMatch?: string,\n source?: MemoryWriteSource\n ): Promise<MemoryWriteResult>\n}\n\n/** Thrown when a provider can't be built for an agent (e.g. `external` not yet\n * implemented, or `native` on a runtime whose memory env levers aren't registered). */\nexport class MemoryProviderUnavailableError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'MemoryProviderUnavailableError'\n }\n}\n\n/**\n * `managed` memory: our `<agent-root>/memory/` directory. A thin facade over\n * `agents/memory.ts` — every method delegates to the existing primitive and lets\n * its error classes (`MemoryPathError` / `MemoryTooLargeError` /\n * `MemoryConflictError`) propagate raw, so the MCP + CP error mappings are unchanged.\n */\nexport class ManagedMemoryProvider implements MemoryProvider {\n readonly kind = 'managed' as const\n\n /** `agentDirByAgent` resolves an agent id → its root dir (which holds `memory/`),\n * or undefined for an unknown agent. */\n constructor(private readonly agentDirByAgent: (agentId: string) => string | undefined) {}\n\n private dirFor(agentId: string): string {\n const dir = this.agentDirByAgent(agentId)\n // Match the pre-provider MCP path's message verbatim (mcp/ops.ts) so the tool\n // error surface is byte-identical.\n if (!dir) throw new Error(`unknown agent ${agentId}`)\n return dir\n }\n\n // Managed keeps a single store: turn OFF the runtime's own memory so the agent\n // doesn't end up with two competing ones. Claude's off-switch is an env flag\n // (respect an explicit operator override, as the daemon did before the port).\n runtimeEnv(runtime: RuntimeDef): Record<string, string> {\n if (isClaudeRuntime(runtime)) return { CLAUDE_CODE_DISABLE_AUTO_MEMORY: '1' }\n return {}\n }\n\n ensure(scope: MemoryScope, agentName: string): void {\n ensureMemory(this.dirFor(scope.agentId), agentName)\n }\n\n async injectAtSessionStart(scope: MemoryScope): Promise<string> {\n return readIndex(this.dirFor(scope.agentId))\n }\n\n async recordTurn(_scope: MemoryScope, _turn: TurnRecord): Promise<void> {\n // managed has no per-turn distillation — memory changes only on writeMemory.\n }\n\n tools(): ToolDescriptor[] {\n return MEMORY_TOOLS\n }\n\n async list(scope: MemoryScope): Promise<MemoryEntry[]> {\n return listMemory(this.dirFor(scope.agentId))\n }\n\n async read(scope: MemoryScope, path: string): Promise<MemoryReadResult> {\n return { path, content: await readMemoryFile(this.dirFor(scope.agentId), path) }\n }\n\n async write(\n scope: MemoryScope,\n path: string,\n content: string,\n ifMatch?: string,\n source?: MemoryWriteSource\n ): Promise<MemoryWriteResult> {\n const { size, mtime } = await writeMemoryFile(this.dirFor(scope.agentId), path, content, ifMatch, source)\n return { ok: true, path, size, mtime }\n }\n}\n\n/**\n * `native` memory: the runtime's OWN memory (Claude auto-memory / Codex memories),\n * redirected under the agent root via `runtimeEnv` for per-agent isolation. The\n * runtime writes and loads it itself, so we do NOT seed, inject, or expose tools —\n * doing so would create a second store the runtime never reads. `list`/`read`/`write`\n * surface the runtime's memory files for the console (see native-memory.ts).\n *\n * The per-runtime env levers are an explicit registry (native-memory.ts). An agent\n * selecting `native` on a runtime whose levers aren't registered fails loudly at\n * construction rather than silently mis-setting env — we don't guess env for a\n * runtime we haven't verified.\n */\nexport class NativeMemoryProvider implements MemoryProvider {\n readonly kind = 'native' as const\n\n constructor(\n private readonly agentDirByAgent: (agentId: string) => string | undefined,\n private readonly runtimeFor: (agentId: string) => RuntimeDef | undefined\n ) {}\n\n private dirFor(agentId: string): string {\n const dir = this.agentDirByAgent(agentId)\n if (!dir) throw new Error(`unknown agent ${agentId}`)\n return dir\n }\n\n runtimeEnv(_runtime: RuntimeDef): Record<string, string> {\n // Not the live path: the spawn env is sourced via memoryProviderFor (which binds\n // the agent root). Routing it through the dispatcher/interface here would lack\n // the root, so make the misuse obvious.\n throw new Error('NativeMemoryProvider.runtimeEnv must not be called — use memoryProviderFor at spawn')\n }\n\n ensure(): void {\n // The runtime manages its own memory — nothing to seed.\n }\n\n async injectAtSessionStart(): Promise<string> {\n // The runtime loads its own memory; don't double-inject.\n return ''\n }\n\n async recordTurn(): Promise<void> {\n // no per-turn distillation.\n }\n\n tools(): ToolDescriptor[] {\n // The runtime has its own memory mechanism; our tools would target a different\n // store than it reads. Expose none.\n return []\n }\n\n async list(scope: MemoryScope): Promise<MemoryEntry[]> {\n return nativeMemoryList(this.dirFor(scope.agentId), this.runtimeFor(scope.agentId))\n }\n\n async read(scope: MemoryScope, path: string): Promise<MemoryReadResult> {\n return nativeMemoryRead(this.dirFor(scope.agentId), this.runtimeFor(scope.agentId), path)\n }\n\n async write(\n scope: MemoryScope,\n path: string,\n content: string,\n ifMatch?: string,\n _source?: MemoryWriteSource\n ): Promise<MemoryWriteResult> {\n // native writes go to the runtime's own store — no managed `.history` log there.\n return nativeMemoryWrite(this.dirFor(scope.agentId), this.runtimeFor(scope.agentId), path, content, ifMatch)\n }\n}\n\n/** A claude runtime — its command/args reference `claude` (mirrors AcpHost.isClaudeRuntime). */\nexport function isClaudeRuntime(runtime: RuntimeDef): boolean {\n return [runtime.command, ...runtime.args].join(' ').toLowerCase().includes('claude')\n}\n\n/**\n * `DispatchingMemoryProvider` — the daemon's single `MemoryProvider`. Routes every\n * scope-bearing call to the agent's configured concrete provider (managed | native),\n * built lazily and cached (both are stateless facades over the resolvers). `external`\n * throws `MemoryProviderUnavailableError` when first needed.\n *\n * `runtimeEnv` is NOT the dispatch path (it has no scope); it throws here to make the\n * misuse obvious — the spawn path uses `memoryProviderFor` directly.\n */\nexport class DispatchingMemoryProvider implements MemoryProvider {\n readonly kind = 'managed' as const // nominal; real kind is per-agent\n\n private managed: ManagedMemoryProvider\n private native: NativeMemoryProvider\n\n constructor(\n private readonly agentDirByAgent: (agentId: string) => string | undefined,\n private readonly runtimeFor: (agentId: string) => RuntimeDef | undefined,\n private readonly providerKindFor: (agentId: string) => MemoryProviderKind\n ) {\n this.managed = new ManagedMemoryProvider(agentDirByAgent)\n this.native = new NativeMemoryProvider(agentDirByAgent, runtimeFor)\n }\n\n private forAgent(agentId: string): MemoryProvider {\n const kind = this.providerKindFor(agentId)\n if (kind === 'managed') return this.managed\n if (kind === 'native') return this.native\n throw new MemoryProviderUnavailableError(`memory provider \"${kind}\" is not yet implemented`)\n }\n\n runtimeEnv(_runtime: RuntimeDef): Record<string, string> {\n throw new Error('DispatchingMemoryProvider.runtimeEnv must not be called — use memoryProviderFor at spawn')\n }\n\n ensure(scope: MemoryScope, agentName: string): void {\n this.forAgent(scope.agentId).ensure(scope, agentName)\n }\n injectAtSessionStart(scope: MemoryScope): Promise<string> {\n return this.forAgent(scope.agentId).injectAtSessionStart(scope)\n }\n recordTurn(scope: MemoryScope, turn: TurnRecord): Promise<void> {\n return this.forAgent(scope.agentId).recordTurn(scope, turn)\n }\n list(scope: MemoryScope): Promise<MemoryEntry[]> {\n return this.forAgent(scope.agentId).list(scope)\n }\n read(scope: MemoryScope, path: string): Promise<MemoryReadResult> {\n return this.forAgent(scope.agentId).read(scope, path)\n }\n write(\n scope: MemoryScope,\n path: string,\n content: string,\n ifMatch?: string,\n source?: MemoryWriteSource\n ): Promise<MemoryWriteResult> {\n return this.forAgent(scope.agentId).write(scope, path, content, ifMatch, source)\n }\n\n /** The memory tools to inject for a specific agent (the daemon calls this in\n * `mcpServersFor` — native contributes none). Scope-carrying, unlike the\n * interface's scopeless `tools()`. */\n toolsForAgent(agentId: string): ToolDescriptor[] {\n return this.forAgent(agentId).tools()\n }\n\n /** Interface `tools()` has no scope; the daemon uses `toolsForAgent`. Return the\n * managed set as a safe default (never the live injection path). */\n tools(): ToolDescriptor[] {\n return MEMORY_TOOLS\n }\n}\n\n/** The daemon-side memory provider kind for an agent (absent ⇒ managed default). */\nexport function memoryKindOf(agent: { memory?: { provider?: MemoryProviderKind } }): MemoryProviderKind {\n return agent.memory?.provider ?? 'managed'\n}\n\n/**\n * Build the concrete provider for ONE agent — used at spawn (`daemon.ts` / `chat.ts`)\n * to source `runtimeEnv`, and validated eagerly so a misconfigured agent (external,\n * or native on an unregistered runtime) fails loudly with the agent's root bound.\n * Throws `MemoryProviderUnavailableError` on an unbuildable provider.\n */\nexport function memoryProviderFor(\n agent: {\n dir: string\n runtime?: string\n memory?: { provider?: MemoryProviderKind }\n },\n runtime: RuntimeDef\n): { runtimeEnv(): Record<string, string> } {\n const kind = memoryKindOf(agent)\n if (kind === 'managed') {\n const p = new ManagedMemoryProvider(() => agent.dir)\n return { runtimeEnv: () => p.runtimeEnv(runtime) }\n }\n if (kind === 'native') {\n if (!isNativeRuntimeSupported(runtime)) {\n throw new MemoryProviderUnavailableError(\n `native memory is not supported for this runtime (env levers unverified): ${runtime.command}`\n )\n }\n // Bind the agent root so runtimeEnv can compute the redirect target.\n return { runtimeEnv: () => nativeRuntimeEnv(runtime, agent.dir) }\n }\n throw new MemoryProviderUnavailableError(`memory provider \"${kind}\" is not yet implemented`)\n}\n\n/** Build the daemon's dispatching memory provider over the agent resolvers. */\nexport function createMemoryProvider(\n agentDirByAgent: (agentId: string) => string | undefined,\n runtimeFor: (agentId: string) => RuntimeDef | undefined,\n providerKindFor: (agentId: string) => MemoryProviderKind\n): DispatchingMemoryProvider {\n return new DispatchingMemoryProvider(agentDirByAgent, runtimeFor, providerKindFor)\n}\n\n/** Back-compat: a managed-only provider (used where per-agent dispatch isn't needed,\n * e.g. tests). */\nexport function createManagedMemoryProvider(agentDirByAgent: (agentId: string) => string | undefined): MemoryProvider {\n return new ManagedMemoryProvider(agentDirByAgent)\n}\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fs_1 = require(\"fs\");\nconst debug_1 = __importDefault(require(\"debug\"));\nconst log = debug_1.default('@kwsites/file-exists');\nfunction check(path, isFile, isDirectory) {\n log(`checking %s`, path);\n try {\n const stat = fs_1.statSync(path);\n if (stat.isFile() && isFile) {\n log(`[OK] path represents a file`);\n return true;\n }\n if (stat.isDirectory() && isDirectory) {\n log(`[OK] path represents a directory`);\n return true;\n }\n log(`[FAIL] path represents something other than a file or directory`);\n return false;\n }\n catch (e) {\n if (e.code === 'ENOENT') {\n log(`[FAIL] path is not accessible: %o`, e);\n return false;\n }\n log(`[FATAL] %o`, e);\n throw e;\n }\n}\n/**\n * Synchronous validation of a path existing either as a file or as a directory.\n *\n * @param {string} path The path to check\n * @param {number} type One or both of the exported numeric constants\n */\nfunction exists(path, type = exports.READABLE) {\n return check(path, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);\n}\nexports.exists = exists;\n/**\n * Constant representing a file\n */\nexports.FILE = 1;\n/**\n * Constant representing a folder\n */\nexports.FOLDER = 2;\n/**\n * Constant representing either a file or a folder\n */\nexports.READABLE = exports.FILE + exports.FOLDER;\n//# sourceMappingURL=index.js.map","\"use strict\";\nfunction __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n}\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__export(require(\"./src\"));\n//# sourceMappingURL=index.js.map","const t = /* @__PURE__ */ new WeakMap();\nfunction c(...n) {\n const e = new String(n);\n return t.set(e, n), e;\n}\nfunction r(n) {\n return n instanceof String && t.has(n);\n}\nfunction o(n) {\n return t.get(n) ?? [];\n}\nexport {\n r as isPathSpec,\n c as pathspec,\n o as toPaths\n};\n//# sourceMappingURL=index.mjs.map\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createDeferred = exports.deferred = void 0;\n/**\n * Creates a new `DeferredPromise`\n *\n * ```typescript\n import {deferred} from '@kwsites/promise-deferred`;\n ```\n */\nfunction deferred() {\n let done;\n let fail;\n let status = 'pending';\n const promise = new Promise((_done, _fail) => {\n done = _done;\n fail = _fail;\n });\n return {\n promise,\n done(result) {\n if (status === 'pending') {\n status = 'resolved';\n done(result);\n }\n },\n fail(error) {\n if (status === 'pending') {\n status = 'rejected';\n fail(error);\n }\n },\n get fulfilled() {\n return status !== 'pending';\n },\n get status() {\n return status;\n },\n };\n}\nexports.deferred = deferred;\n/**\n * Alias of the exported `deferred` function, to help consumers wanting to use `deferred` as the\n * local variable name rather than the factory import name, without needing to rename on import.\n *\n * ```typescript\n import {createDeferred} from '@kwsites/promise-deferred`;\n ```\n */\nexports.createDeferred = deferred;\n/**\n * Default export allows use as:\n *\n * ```typescript\n import deferred from '@kwsites/promise-deferred`;\n ```\n */\nexports.default = deferred;\n//# sourceMappingURL=index.js.map","import { isPathSpec as m, toPaths as v } from \"@simple-git/args-pathspec\";\nfunction* U(e, t) {\n const n = t === \"global\";\n for (const o of e)\n o.isGlobal === n && (yield o);\n}\nconst k = /* @__PURE__ */ new Set([\n \"--add\",\n \"--edit\",\n \"--remove-section\",\n \"--rename-section\",\n \"--replace-all\",\n \"--unset\",\n \"--unset-all\",\n \"-e\"\n]), S = /* @__PURE__ */ new Set([\n \"--get\",\n \"--get-all\",\n \"--get-color\",\n \"--get-colorbool\",\n \"--get-regexp\",\n \"--get-urlmatch\",\n \"--list\",\n \"-l\"\n]), P = /* @__PURE__ */ new Set([\n \"edit\",\n \"remove-section\",\n \"rename-section\",\n \"set\",\n \"unset\"\n]), E = /* @__PURE__ */ new Set([\"get\", \"get-color\", \"get-colorbool\", \"list\"]);\nfunction F(e, t) {\n for (const { name: o } of U(e, \"task\")) {\n if (k.has(o))\n return p(!0, t);\n if (S.has(o))\n return p(!1, t);\n }\n const n = t.at(0)?.toLowerCase();\n return n === void 0 ? null : P.has(n) ? p(!0, t.slice(1)) : E.has(n) ? p(!1, t.slice(1)) : t.length === 1 ? p(!1, t) : p(!0, t);\n}\nfunction p(e = !1, t = []) {\n const n = t.at(0)?.toLowerCase();\n return n === void 0 ? null : {\n isWrite: e,\n isRead: !e,\n key: n,\n value: t.at(1)\n };\n}\nfunction A(e, t) {\n return t.isWrite && t.value !== void 0 ? { key: t.key, value: t.value, scope: e } : { key: t.key, scope: e };\n}\nfunction M(e) {\n const t = e?.indexOf(\"=\") || -1;\n return !e || t < 0 ? null : {\n key: e.slice(0, t).trim().toLowerCase(),\n value: e.slice(t + 1)\n };\n}\nfunction N(e) {\n for (const { name: t } of U(e, \"task\"))\n switch (t) {\n case \"--global\":\n return \"global\";\n case \"--system\":\n return \"system\";\n case \"--worktree\":\n return \"worktree\";\n case \"--local\":\n return \"local\";\n case \"--file\":\n case \"-f\":\n return \"file\";\n }\n return \"local\";\n}\nfunction G({ name: e }) {\n if (e === \"-c\" || e === \"--config\")\n return \"inline\";\n if (e === \"--config-env\")\n return \"env\";\n}\nfunction* O(e) {\n for (const t of e) {\n const n = G(t), o = n && M(t.value);\n o && (yield {\n ...o,\n scope: n\n });\n }\n}\nfunction L(e, t, n) {\n const o = {\n read: [],\n write: [...O(t)]\n };\n return e === \"config\" && $(\n o,\n N(t),\n F(t, n)\n ), o;\n}\nfunction $(e, t, n) {\n if (n === null)\n return;\n const o = A(t, n);\n n.isWrite ? e.write.push(o) : e.read.push(o);\n}\nconst x = {\n short: /* @__PURE__ */ new Map([\n [\"c\", !0]\n // -c <k=v> set config key for this invocation\n ])\n}, D = {\n short: new Map([\n [\"C\", !0],\n // -C <path> change working directory\n [\"P\", !1],\n // -P no pager (alias for --no-pager)\n [\"h\", !1],\n // -h help\n [\"p\", !1],\n // -p paginate\n [\"v\", !1],\n // -v version\n ...x.short.entries()\n ]),\n long: /* @__PURE__ */ new Set([\n \"attr-source\",\n \"config-env\",\n \"exec-path\",\n \"git-dir\",\n \"list-cmds\",\n \"namespace\",\n \"super-prefix\",\n \"work-tree\"\n ])\n}, R = {\n clone: {\n short: /* @__PURE__ */ new Map([\n [\"b\", !0],\n // -b <branch>\n [\"j\", !0],\n // -j <n> parallel jobs\n [\"l\", !1],\n // -l local\n [\"n\", !1],\n // -n no-checkout\n [\"o\", !0],\n // -o <name> remote name\n [\"q\", !1],\n // -q quiet\n [\"s\", !1],\n // -s shared\n [\"u\", !0]\n // -u <upload-pack>\n ]),\n long: /* @__PURE__ */ new Set([\"branch\", \"config\", \"jobs\", \"origin\", \"upload-pack\", \"u\", \"template\"])\n },\n commit: {\n short: /* @__PURE__ */ new Map([\n [\"C\", !0],\n // -C <commit> reuse message\n [\"F\", !0],\n // -F <file> read message from file\n [\"c\", !0],\n // -c <commit> reedit message\n [\"m\", !0],\n // -m <msg>\n [\"t\", !0]\n // -t <template>\n ]),\n long: /* @__PURE__ */ new Set([\"file\", \"message\", \"reedit-message\", \"reuse-message\", \"template\"])\n },\n config: {\n short: /* @__PURE__ */ new Map([\n [\"e\", !1],\n // -e open editor\n [\"f\", !0],\n // -f <file>\n [\"l\", !1]\n // -l list\n ]),\n long: /* @__PURE__ */ new Set([\"blob\", \"comment\", \"default\", \"file\", \"type\", \"value\"])\n },\n fetch: {\n short: /* @__PURE__ */ new Map(),\n long: /* @__PURE__ */ new Set([\"upload-pack\"])\n },\n init: {\n short: /* @__PURE__ */ new Map(),\n long: /* @__PURE__ */ new Set([\"template\"])\n },\n pull: {\n short: /* @__PURE__ */ new Map(),\n long: /* @__PURE__ */ new Set([\"upload-pack\"])\n },\n push: {\n short: /* @__PURE__ */ new Map(),\n long: /* @__PURE__ */ new Set([\"exec\", \"receive-pack\"])\n }\n}, T = { short: /* @__PURE__ */ new Map(), long: /* @__PURE__ */ new Set() };\nfunction I(e) {\n const t = R[e ?? \"\"] ?? T;\n return {\n short: new Map([...x.short.entries(), ...t.short.entries()]),\n long: t.long\n };\n}\nfunction b(e, t = D) {\n if (e.startsWith(\"--\")) {\n const n = e.indexOf(\"=\");\n if (n > 2)\n return [{ name: e.slice(0, n), value: e.slice(n + 1), needsNext: !1 }];\n const o = e.slice(2);\n return [{ name: e, needsNext: t.long.has(o) }];\n }\n if (e.length === 2) {\n const n = e.charAt(1), o = t.short.get(n);\n return [{ name: e, needsNext: o === !0 }];\n }\n return W(e, t.short);\n}\nfunction W(e, t) {\n const n = e.slice(1).split(\"\"), o = [];\n for (let s = 0; s < n.length; s++) {\n const r = n[s], l = t.get(r);\n if (l === void 0)\n return [{ name: e, needsNext: !1 }];\n if (l) {\n const a = n.slice(s + 1).join(\"\");\n if (a && ![...a].every((w) => t.has(w)))\n return o.push({ name: `-${r}`, value: a, needsNext: !1 }), o;\n }\n o.push({ name: `-${r}`, needsNext: l });\n }\n return o;\n}\nfunction j(e, t = []) {\n let n = 0;\n for (; n < e.length; ) {\n const o = String(e[n]);\n if (!o.startsWith(\"-\") || o.length < 2) break;\n const s = b(o);\n let r = n + 1;\n for (const l of s) {\n const a = {\n name: l.name,\n value: l.value,\n absorbedNext: !1,\n isGlobal: !0\n };\n l.needsNext && a.value === void 0 && r < e.length && (a.value = String(e[r]), a.absorbedNext = !0, r++), t.push(a);\n }\n n = r;\n }\n return { flags: t, taskIndex: n };\n}\nfunction B(e, t, n = []) {\n const o = I(t), s = [], r = [];\n let l = 0;\n for (; l < e.length; ) {\n const a = e[l];\n if (m(a)) {\n r.push(...v(a)), l++;\n continue;\n }\n const f = String(a);\n if (f === \"--\") {\n for (let g = l + 1; g < e.length; g++) {\n const u = e[g];\n m(u) ? r.push(...v(u)) : r.push(String(u));\n }\n break;\n }\n if (!f.startsWith(\"-\") || f.length < 2) {\n s.push(f), l++;\n continue;\n }\n const w = b(f, o);\n let d = l + 1;\n for (const g of w) {\n const u = {\n name: g.name,\n value: g.value,\n absorbedNext: !1,\n isGlobal: !1\n };\n g.needsNext && u.value === void 0 && d < e.length && !m(e[d]) && (u.value = String(e[d]), u.absorbedNext = !0, d++), n.push(u);\n }\n l = d;\n }\n return { flags: n, positionals: s, pathspecs: r };\n}\nfunction* V({\n write: e\n}) {\n for (const t of e)\n for (const n of q) {\n const o = n(t.key);\n o && (yield o);\n }\n}\nfunction c(e, t, n = String(e)) {\n const o = typeof e == \"string\" ? new RegExp(`\\\\s*${e.toLowerCase()}`) : e;\n return function(r) {\n if (o.test(r))\n return {\n category: t,\n message: `Configuring ${n} is not permitted without enabling ${t}`\n };\n };\n}\nfunction i(e, t) {\n const n = new RegExp(`\\\\s*${e.toLowerCase().replace(/\\./g, \"(..+)?.\")}`);\n return c(n, t, e);\n}\nconst q = [\n c(\"alias\", \"allowUnsafeAlias\"),\n c(\"core.askPass\", \"allowUnsafeAskPass\"),\n c(\"core.editor\", \"allowUnsafeEditor\"),\n c(\"core.fsmonitor\", \"allowUnsafeFsMonitor\"),\n c(\"core.gitProxy\", \"allowUnsafeGitProxy\"),\n c(\"core.hooksPath\", \"allowUnsafeHooksPath\"),\n c(\"core.pager\", \"allowUnsafePager\"),\n c(\"core.sshCommand\", \"allowUnsafeSshCommand\"),\n i(\"credential.helper\", \"allowUnsafeCredentialHelper\"),\n i(\"diff.command\", \"allowUnsafeDiffExternal\"),\n c(\"diff.external\", \"allowUnsafeDiffExternal\"),\n i(\"diff.textconv\", \"allowUnsafeDiffTextConv\"),\n i(\"filter.clean\", \"allowUnsafeFilter\"),\n i(\"filter.smudge\", \"allowUnsafeFilter\"),\n i(\"gpg.program\", \"allowUnsafeGpgProgram\"),\n c(\"init.templateDir\", \"allowUnsafeTemplateDir\"),\n i(\"merge.driver\", \"allowUnsafeMergeDriver\"),\n i(\"mergetool.path\", \"allowUnsafeMergeDriver\"),\n i(\"mergetool.cmd\", \"allowUnsafeMergeDriver\"),\n i(\"protocol.allow\", \"allowUnsafeProtocolOverride\"),\n i(\"remote.receivepack\", \"allowUnsafePack\"),\n i(\"remote.uploadpack\", \"allowUnsafePack\"),\n c(\"sequence.editor\", \"allowUnsafeEditor\")\n];\nfunction* K(e, t) {\n for (const n of t)\n for (const o of H) {\n const s = o(e, n.name);\n s && (yield s);\n }\n}\nfunction h(e, t, n, o = String(t)) {\n const s = typeof t == \"string\" ? new RegExp(`\\\\s*${t.toLowerCase()}`) : t, r = `Use of ${e ? `${e} with option ` : \"\"}${o} is not permitted without enabling ${n}`;\n return function(a, f) {\n if ((!e || a === e) && s.test(f))\n return {\n category: n,\n message: r\n };\n };\n}\nconst H = [\n h(\n null,\n /--(upload|receive)-pack/,\n \"allowUnsafePack\",\n \"--upload-pack or --receive-pack\"\n ),\n h(\"clone\", /^-\\w*u/, \"allowUnsafePack\"),\n h(\"clone\", \"--u\", \"allowUnsafePack\"),\n h(\"push\", \"--exec\", \"allowUnsafePack\"),\n h(null, \"--template\", \"allowUnsafeTemplateDir\")\n];\nfunction C(e, t, n) {\n return [...K(e, t), ...V(n)];\n}\nfunction Y(...e) {\n const { flags: t, taskIndex: n } = j(e), o = n < e.length ? String(e[n]).toLowerCase() : null, s = o !== null ? e.slice(n + 1) : [], { positionals: r, pathspecs: l } = B(s, o, t), a = L(o, t, r);\n return {\n task: o,\n flags: t.map(J),\n paths: l,\n config: a,\n vulnerabilities: z(C(o, t, a))\n };\n}\nfunction z(e) {\n return Object.defineProperty(e, \"vulnerabilities\", {\n value: e\n });\n}\nfunction J({ value: e, name: t }) {\n return e !== void 0 ? { name: t, value: e } : { name: t };\n}\nconst y = {\n editor: \"allowUnsafeEditor\",\n git_askpass: \"allowUnsafeAskPass\",\n git_config_global: \"allowUnsafeConfigPaths\",\n git_config_system: \"allowUnsafeConfigPaths\",\n git_config_count: \"allowUnsafeConfigEnvCount\",\n git_config: \"allowUnsafeConfigPaths\",\n git_editor: \"allowUnsafeEditor\",\n git_exec_path: \"allowUnsafeConfigPaths\",\n git_external_diff: \"allowUnsafeDiffExternal\",\n git_pager: \"allowUnsafePager\",\n git_proxy_command: \"allowUnsafeGitProxy\",\n git_template_dir: \"allowUnsafeTemplateDir\",\n git_sequence_editor: \"allowUnsafeEditor\",\n git_ssh: \"allowUnsafeSshCommand\",\n git_ssh_command: \"allowUnsafeSshCommand\",\n pager: \"allowUnsafePager\",\n prefix: \"allowUnsafeConfigPaths\",\n ssh_askpass: \"allowUnsafeAskPass\"\n};\nfunction* Q(e) {\n const t = parseInt(e.git_config_count ?? \"0\", 10);\n for (let n = 0; n < t; n++) {\n const o = e[`git_config_key_${n}`], s = e[`git_config_value_${n}`];\n o !== void 0 && (yield { key: o.toLowerCase().trim(), value: s, scope: \"env\" });\n }\n}\nfunction* X(e) {\n for (const t of Object.keys(e))\n if (_(t)) {\n const n = y[t];\n yield {\n category: n,\n message: `Use of \"${t.toUpperCase()}\" is not permitted without enabling ${n}`\n };\n }\n}\nfunction _(e) {\n return Object.hasOwn(y, e);\n}\nfunction Z(e) {\n const t = {};\n for (const [n, o] of Object.entries(e)) {\n const s = n.toLowerCase().trim();\n (_(s) || s.startsWith(\"git\")) && (t[s] = String(o));\n }\n return t;\n}\nfunction ee(e) {\n const t = Z(e), n = {\n read: [],\n write: [...Q(t)]\n }, o = [\n ...X(t),\n ...C(null, [], n)\n ];\n return {\n config: n,\n vulnerabilities: o\n };\n}\nfunction ne(e, t) {\n return [...Y(...e).vulnerabilities, ...ee(t).vulnerabilities];\n}\nexport {\n Y as parseArgv,\n ee as parseEnv,\n ne as vulnerabilityCheck\n};\n//# sourceMappingURL=index.mjs.map\n","var __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __esm = (fn, res) => function __init() {\n return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;\n};\nvar __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n};\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/lib/errors/git-error.ts\nvar GitError;\nvar init_git_error = __esm({\n \"src/lib/errors/git-error.ts\"() {\n \"use strict\";\n GitError = class extends Error {\n constructor(task, message) {\n super(message);\n this.task = task;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n };\n }\n});\n\n// src/lib/errors/git-response-error.ts\nvar GitResponseError;\nvar init_git_response_error = __esm({\n \"src/lib/errors/git-response-error.ts\"() {\n \"use strict\";\n init_git_error();\n GitResponseError = class extends GitError {\n constructor(git, message) {\n super(void 0, message || String(git));\n this.git = git;\n }\n };\n }\n});\n\n// src/lib/errors/task-configuration-error.ts\nvar TaskConfigurationError;\nvar init_task_configuration_error = __esm({\n \"src/lib/errors/task-configuration-error.ts\"() {\n \"use strict\";\n init_git_error();\n TaskConfigurationError = class extends GitError {\n constructor(message) {\n super(void 0, message);\n }\n };\n }\n});\n\n// src/lib/utils/util.ts\nimport { exists, FOLDER } from \"@kwsites/file-exists\";\nfunction asFunction(source) {\n if (typeof source !== \"function\") {\n return NOOP;\n }\n return source;\n}\nfunction isUserFunction(source) {\n return typeof source === \"function\" && source !== NOOP;\n}\nfunction splitOn(input, char) {\n const index = input.indexOf(char);\n if (index <= 0) {\n return [input, \"\"];\n }\n return [input.substr(0, index), input.substr(index + 1)];\n}\nfunction first(input, offset = 0) {\n return isArrayLike(input) && input.length > offset ? input[offset] : void 0;\n}\nfunction last(input, offset = 0) {\n if (isArrayLike(input) && input.length > offset) {\n return input[input.length - 1 - offset];\n }\n}\nfunction isArrayLike(input) {\n return filterHasLength(input);\n}\nfunction toLinesWithContent(input = \"\", trimmed2 = true, separator = \"\\n\") {\n return input.split(separator).reduce((output, line) => {\n const lineContent = trimmed2 ? line.trim() : line;\n if (lineContent) {\n output.push(lineContent);\n }\n return output;\n }, []);\n}\nfunction forEachLineWithContent(input, callback) {\n return toLinesWithContent(input, true).map((line) => callback(line));\n}\nfunction folderExists(path) {\n return exists(path, FOLDER);\n}\nfunction append(target, item) {\n if (Array.isArray(target)) {\n if (!target.includes(item)) {\n target.push(item);\n }\n } else {\n target.add(item);\n }\n return item;\n}\nfunction including(target, item) {\n if (Array.isArray(target) && !target.includes(item)) {\n target.push(item);\n }\n return target;\n}\nfunction remove(target, item) {\n if (Array.isArray(target)) {\n const index = target.indexOf(item);\n if (index >= 0) {\n target.splice(index, 1);\n }\n } else {\n target.delete(item);\n }\n return item;\n}\nfunction asArray(source) {\n return Array.isArray(source) ? source : [source];\n}\nfunction asCamelCase(str) {\n return str.replace(/[\\s-]+(.)/g, (_all, chr) => {\n return chr.toUpperCase();\n });\n}\nfunction asStringArray(source) {\n return asArray(source).map((item) => {\n return item instanceof String ? item : String(item);\n });\n}\nfunction asNumber(source, onNaN = 0) {\n if (source == null) {\n return onNaN;\n }\n const num = parseInt(source, 10);\n return Number.isNaN(num) ? onNaN : num;\n}\nfunction prefixedArray(input, prefix) {\n const output = [];\n for (let i = 0, max = input.length; i < max; i++) {\n output.push(prefix, input[i]);\n }\n return output;\n}\nfunction bufferToString(input) {\n return (Array.isArray(input) ? Buffer.concat(input) : input).toString(\"utf-8\");\n}\nfunction pick(source, properties) {\n const out = {};\n properties.forEach((key) => {\n if (source[key] !== void 0) {\n out[key] = source[key];\n }\n });\n return out;\n}\nfunction delay(duration = 0) {\n return new Promise((done) => setTimeout(done, duration));\n}\nfunction orVoid(input) {\n if (input === false) {\n return void 0;\n }\n return input;\n}\nvar NULL, NOOP, objectToString;\nvar init_util = __esm({\n \"src/lib/utils/util.ts\"() {\n \"use strict\";\n init_argument_filters();\n NULL = \"\\0\";\n NOOP = () => {\n };\n objectToString = Object.prototype.toString.call.bind(Object.prototype.toString);\n }\n});\n\n// src/lib/utils/argument-filters.ts\nimport { isPathSpec } from \"@simple-git/args-pathspec\";\nfunction filterType(input, filter, def) {\n if (filter(input)) {\n return input;\n }\n return arguments.length > 2 ? def : void 0;\n}\nfunction filterPrimitives(input, omit) {\n const type = isPathSpec(input) ? \"string\" : typeof input;\n return /number|string|boolean/.test(type) && (!omit || !omit.includes(type));\n}\nfunction filterPlainObject(input) {\n return !!input && objectToString(input) === \"[object Object]\";\n}\nfunction filterFunction(input) {\n return typeof input === \"function\";\n}\nvar filterArray, filterNumber, filterString, filterStringOrStringArray, filterHasLength;\nvar init_argument_filters = __esm({\n \"src/lib/utils/argument-filters.ts\"() {\n \"use strict\";\n init_util();\n filterArray = (input) => {\n return Array.isArray(input);\n };\n filterNumber = (input) => {\n return typeof input === \"number\";\n };\n filterString = (input) => {\n return typeof input === \"string\" || isPathSpec(input);\n };\n filterStringOrStringArray = (input) => {\n return filterString(input) || Array.isArray(input) && input.every(filterString);\n };\n filterHasLength = (input) => {\n if (input == null || \"number|boolean|function\".includes(typeof input)) {\n return false;\n }\n return typeof input.length === \"number\";\n };\n }\n});\n\n// src/lib/utils/exit-codes.ts\nvar ExitCodes;\nvar init_exit_codes = __esm({\n \"src/lib/utils/exit-codes.ts\"() {\n \"use strict\";\n ExitCodes = /* @__PURE__ */ ((ExitCodes2) => {\n ExitCodes2[ExitCodes2[\"SUCCESS\"] = 0] = \"SUCCESS\";\n ExitCodes2[ExitCodes2[\"ERROR\"] = 1] = \"ERROR\";\n ExitCodes2[ExitCodes2[\"NOT_FOUND\"] = -2] = \"NOT_FOUND\";\n ExitCodes2[ExitCodes2[\"UNCLEAN\"] = 128] = \"UNCLEAN\";\n return ExitCodes2;\n })(ExitCodes || {});\n }\n});\n\n// src/lib/utils/git-output-streams.ts\nvar GitOutputStreams;\nvar init_git_output_streams = __esm({\n \"src/lib/utils/git-output-streams.ts\"() {\n \"use strict\";\n GitOutputStreams = class _GitOutputStreams {\n constructor(stdOut, stdErr) {\n this.stdOut = stdOut;\n this.stdErr = stdErr;\n }\n asStrings() {\n return new _GitOutputStreams(this.stdOut.toString(\"utf8\"), this.stdErr.toString(\"utf8\"));\n }\n };\n }\n});\n\n// src/lib/utils/line-parser.ts\nfunction useMatchesDefault() {\n throw new Error(`LineParser:useMatches not implemented`);\n}\nvar LineParser, RemoteLineParser;\nvar init_line_parser = __esm({\n \"src/lib/utils/line-parser.ts\"() {\n \"use strict\";\n LineParser = class {\n constructor(regExp, useMatches) {\n this.matches = [];\n this.useMatches = useMatchesDefault;\n this.parse = (line, target) => {\n this.resetMatches();\n if (!this._regExp.every((reg, index) => this.addMatch(reg, index, line(index)))) {\n return false;\n }\n return this.useMatches(target, this.prepareMatches()) !== false;\n };\n this._regExp = Array.isArray(regExp) ? regExp : [regExp];\n if (useMatches) {\n this.useMatches = useMatches;\n }\n }\n resetMatches() {\n this.matches.length = 0;\n }\n prepareMatches() {\n return this.matches;\n }\n addMatch(reg, index, line) {\n const matched = line && reg.exec(line);\n if (matched) {\n this.pushMatch(index, matched);\n }\n return !!matched;\n }\n pushMatch(_index, matched) {\n this.matches.push(...matched.slice(1));\n }\n };\n RemoteLineParser = class extends LineParser {\n addMatch(reg, index, line) {\n return /^remote:\\s/.test(String(line)) && super.addMatch(reg, index, line);\n }\n pushMatch(index, matched) {\n if (index > 0 || matched.length > 1) {\n super.pushMatch(index, matched);\n }\n }\n };\n }\n});\n\n// src/lib/utils/simple-git-options.ts\nfunction createInstanceConfig(...options) {\n const baseDir = process.cwd();\n const config = Object.assign(\n { baseDir, ...defaultOptions },\n ...options.filter((o) => typeof o === \"object\" && o)\n );\n config.baseDir = config.baseDir || baseDir;\n config.trimmed = config.trimmed === true;\n return config;\n}\nvar defaultOptions;\nvar init_simple_git_options = __esm({\n \"src/lib/utils/simple-git-options.ts\"() {\n \"use strict\";\n defaultOptions = {\n binary: \"git\",\n maxConcurrentProcesses: 5,\n config: [],\n trimmed: false\n };\n }\n});\n\n// src/lib/utils/task-options.ts\nimport { isPathSpec as isPathSpec2 } from \"@simple-git/args-pathspec\";\nfunction appendTaskOptions(options, commands = []) {\n if (!filterPlainObject(options)) {\n return commands;\n }\n return Object.keys(options).reduce((commands2, key) => {\n const value = options[key];\n if (isPathSpec2(value)) {\n commands2.push(value);\n } else if (filterPrimitives(value, [\"boolean\"])) {\n commands2.push(key + \"=\" + value);\n } else if (Array.isArray(value)) {\n for (const v of value) {\n if (!filterPrimitives(v, [\"string\", \"number\"])) {\n commands2.push(key + \"=\" + v);\n }\n }\n } else {\n commands2.push(key);\n }\n return commands2;\n }, commands);\n}\nfunction getTrailingOptions(args, initialPrimitive = 0, objectOnly = false) {\n const command = [];\n for (let i = 0, max = initialPrimitive < 0 ? args.length : initialPrimitive; i < max; i++) {\n if (\"string|number\".includes(typeof args[i])) {\n command.push(String(args[i]));\n }\n }\n appendTaskOptions(trailingOptionsArgument(args), command);\n if (!objectOnly) {\n command.push(...trailingArrayArgument(args));\n }\n return command;\n}\nfunction trailingArrayArgument(args) {\n const hasTrailingCallback = typeof last(args) === \"function\";\n return asStringArray(filterType(last(args, hasTrailingCallback ? 1 : 0), filterArray, []));\n}\nfunction trailingOptionsArgument(args) {\n const hasTrailingCallback = filterFunction(last(args));\n return filterType(last(args, hasTrailingCallback ? 1 : 0), filterPlainObject);\n}\nfunction trailingFunctionArgument(args, includeNoop = true) {\n const callback = asFunction(last(args));\n return includeNoop || isUserFunction(callback) ? callback : void 0;\n}\nvar init_task_options = __esm({\n \"src/lib/utils/task-options.ts\"() {\n \"use strict\";\n init_argument_filters();\n init_util();\n }\n});\n\n// src/lib/utils/task-parser.ts\nfunction callTaskParser(parser4, streams) {\n return parser4(streams.stdOut, streams.stdErr);\n}\nfunction parseStringResponse(result, parsers12, texts, trim = true) {\n asArray(texts).forEach((text) => {\n for (let lines = toLinesWithContent(text, trim), i = 0, max = lines.length; i < max; i++) {\n const line = (offset = 0) => {\n if (i + offset >= max) {\n return;\n }\n return lines[i + offset];\n };\n parsers12.some(({ parse }) => parse(line, result));\n }\n });\n return result;\n}\nvar init_task_parser = __esm({\n \"src/lib/utils/task-parser.ts\"() {\n \"use strict\";\n init_util();\n }\n});\n\n// src/lib/utils/index.ts\nvar utils_exports = {};\n__export(utils_exports, {\n ExitCodes: () => ExitCodes,\n GitOutputStreams: () => GitOutputStreams,\n LineParser: () => LineParser,\n NOOP: () => NOOP,\n NULL: () => NULL,\n RemoteLineParser: () => RemoteLineParser,\n append: () => append,\n appendTaskOptions: () => appendTaskOptions,\n asArray: () => asArray,\n asCamelCase: () => asCamelCase,\n asFunction: () => asFunction,\n asNumber: () => asNumber,\n asStringArray: () => asStringArray,\n bufferToString: () => bufferToString,\n callTaskParser: () => callTaskParser,\n createInstanceConfig: () => createInstanceConfig,\n delay: () => delay,\n filterArray: () => filterArray,\n filterFunction: () => filterFunction,\n filterHasLength: () => filterHasLength,\n filterNumber: () => filterNumber,\n filterPlainObject: () => filterPlainObject,\n filterPrimitives: () => filterPrimitives,\n filterString: () => filterString,\n filterStringOrStringArray: () => filterStringOrStringArray,\n filterType: () => filterType,\n first: () => first,\n folderExists: () => folderExists,\n forEachLineWithContent: () => forEachLineWithContent,\n getTrailingOptions: () => getTrailingOptions,\n including: () => including,\n isUserFunction: () => isUserFunction,\n last: () => last,\n objectToString: () => objectToString,\n orVoid: () => orVoid,\n parseStringResponse: () => parseStringResponse,\n pick: () => pick,\n prefixedArray: () => prefixedArray,\n remove: () => remove,\n splitOn: () => splitOn,\n toLinesWithContent: () => toLinesWithContent,\n trailingFunctionArgument: () => trailingFunctionArgument,\n trailingOptionsArgument: () => trailingOptionsArgument\n});\nvar init_utils = __esm({\n \"src/lib/utils/index.ts\"() {\n \"use strict\";\n init_argument_filters();\n init_exit_codes();\n init_git_output_streams();\n init_line_parser();\n init_simple_git_options();\n init_task_options();\n init_task_parser();\n init_util();\n }\n});\n\n// src/lib/tasks/check-is-repo.ts\nvar check_is_repo_exports = {};\n__export(check_is_repo_exports, {\n CheckRepoActions: () => CheckRepoActions,\n checkIsBareRepoTask: () => checkIsBareRepoTask,\n checkIsRepoRootTask: () => checkIsRepoRootTask,\n checkIsRepoTask: () => checkIsRepoTask\n});\nfunction checkIsRepoTask(action) {\n switch (action) {\n case \"bare\" /* BARE */:\n return checkIsBareRepoTask();\n case \"root\" /* IS_REPO_ROOT */:\n return checkIsRepoRootTask();\n }\n const commands = [\"rev-parse\", \"--is-inside-work-tree\"];\n return {\n commands,\n format: \"utf-8\",\n onError,\n parser\n };\n}\nfunction checkIsRepoRootTask() {\n const commands = [\"rev-parse\", \"--git-dir\"];\n return {\n commands,\n format: \"utf-8\",\n onError,\n parser(path) {\n return /^\\.(git)?$/.test(path.trim());\n }\n };\n}\nfunction checkIsBareRepoTask() {\n const commands = [\"rev-parse\", \"--is-bare-repository\"];\n return {\n commands,\n format: \"utf-8\",\n onError,\n parser\n };\n}\nfunction isNotRepoMessage(error) {\n return /(Not a git repository|Kein Git-Repository)/i.test(String(error));\n}\nvar CheckRepoActions, onError, parser;\nvar init_check_is_repo = __esm({\n \"src/lib/tasks/check-is-repo.ts\"() {\n \"use strict\";\n init_utils();\n CheckRepoActions = /* @__PURE__ */ ((CheckRepoActions2) => {\n CheckRepoActions2[\"BARE\"] = \"bare\";\n CheckRepoActions2[\"IN_TREE\"] = \"tree\";\n CheckRepoActions2[\"IS_REPO_ROOT\"] = \"root\";\n return CheckRepoActions2;\n })(CheckRepoActions || {});\n onError = ({ exitCode }, error, done, fail) => {\n if (exitCode === 128 /* UNCLEAN */ && isNotRepoMessage(error)) {\n return done(Buffer.from(\"false\"));\n }\n fail(error);\n };\n parser = (text) => {\n return text.trim() === \"true\";\n };\n }\n});\n\n// src/lib/responses/CleanSummary.ts\nfunction cleanSummaryParser(dryRun, text) {\n const summary = new CleanResponse(dryRun);\n const regexp = dryRun ? dryRunRemovalRegexp : removalRegexp;\n toLinesWithContent(text).forEach((line) => {\n const removed = line.replace(regexp, \"\");\n summary.paths.push(removed);\n (isFolderRegexp.test(removed) ? summary.folders : summary.files).push(removed);\n });\n return summary;\n}\nvar CleanResponse, removalRegexp, dryRunRemovalRegexp, isFolderRegexp;\nvar init_CleanSummary = __esm({\n \"src/lib/responses/CleanSummary.ts\"() {\n \"use strict\";\n init_utils();\n CleanResponse = class {\n constructor(dryRun) {\n this.dryRun = dryRun;\n this.paths = [];\n this.files = [];\n this.folders = [];\n }\n };\n removalRegexp = /^[a-z]+\\s*/i;\n dryRunRemovalRegexp = /^[a-z]+\\s+[a-z]+\\s*/i;\n isFolderRegexp = /\\/$/;\n }\n});\n\n// src/lib/tasks/task.ts\nvar task_exports = {};\n__export(task_exports, {\n EMPTY_COMMANDS: () => EMPTY_COMMANDS,\n adhocExecTask: () => adhocExecTask,\n configurationErrorTask: () => configurationErrorTask,\n isBufferTask: () => isBufferTask,\n isEmptyTask: () => isEmptyTask,\n straightThroughBufferTask: () => straightThroughBufferTask,\n straightThroughStringTask: () => straightThroughStringTask\n});\nfunction adhocExecTask(parser4) {\n return {\n commands: EMPTY_COMMANDS,\n format: \"empty\",\n parser: parser4\n };\n}\nfunction configurationErrorTask(error) {\n return {\n commands: EMPTY_COMMANDS,\n format: \"empty\",\n parser() {\n throw typeof error === \"string\" ? new TaskConfigurationError(error) : error;\n }\n };\n}\nfunction straightThroughStringTask(commands, trimmed2 = false) {\n return {\n commands,\n format: \"utf-8\",\n parser(text) {\n return trimmed2 ? String(text).trim() : text;\n }\n };\n}\nfunction straightThroughBufferTask(commands) {\n return {\n commands,\n format: \"buffer\",\n parser(buffer) {\n return buffer;\n }\n };\n}\nfunction isBufferTask(task) {\n return task.format === \"buffer\";\n}\nfunction isEmptyTask(task) {\n return task.format === \"empty\" || !task.commands.length;\n}\nvar EMPTY_COMMANDS;\nvar init_task = __esm({\n \"src/lib/tasks/task.ts\"() {\n \"use strict\";\n init_task_configuration_error();\n EMPTY_COMMANDS = [];\n }\n});\n\n// src/lib/tasks/clean.ts\nvar clean_exports = {};\n__export(clean_exports, {\n CONFIG_ERROR_INTERACTIVE_MODE: () => CONFIG_ERROR_INTERACTIVE_MODE,\n CONFIG_ERROR_MODE_REQUIRED: () => CONFIG_ERROR_MODE_REQUIRED,\n CONFIG_ERROR_UNKNOWN_OPTION: () => CONFIG_ERROR_UNKNOWN_OPTION,\n CleanOptions: () => CleanOptions,\n cleanTask: () => cleanTask,\n cleanWithOptionsTask: () => cleanWithOptionsTask,\n isCleanOptionsArray: () => isCleanOptionsArray\n});\nfunction cleanWithOptionsTask(mode, customArgs) {\n const { cleanMode, options, valid } = getCleanOptions(mode);\n if (!cleanMode) {\n return configurationErrorTask(CONFIG_ERROR_MODE_REQUIRED);\n }\n if (!valid.options) {\n return configurationErrorTask(CONFIG_ERROR_UNKNOWN_OPTION + JSON.stringify(mode));\n }\n options.push(...customArgs);\n if (options.some(isInteractiveMode)) {\n return configurationErrorTask(CONFIG_ERROR_INTERACTIVE_MODE);\n }\n return cleanTask(cleanMode, options);\n}\nfunction cleanTask(mode, customArgs) {\n const commands = [\"clean\", `-${mode}`, ...customArgs];\n return {\n commands,\n format: \"utf-8\",\n parser(text) {\n return cleanSummaryParser(mode === \"n\" /* DRY_RUN */, text);\n }\n };\n}\nfunction isCleanOptionsArray(input) {\n return Array.isArray(input) && input.every((test) => CleanOptionValues.has(test));\n}\nfunction getCleanOptions(input) {\n let cleanMode;\n let options = [];\n let valid = { cleanMode: false, options: true };\n input.replace(/[^a-z]i/g, \"\").split(\"\").forEach((char) => {\n if (isCleanMode(char)) {\n cleanMode = char;\n valid.cleanMode = true;\n } else {\n valid.options = valid.options && isKnownOption(options[options.length] = `-${char}`);\n }\n });\n return {\n cleanMode,\n options,\n valid\n };\n}\nfunction isCleanMode(cleanMode) {\n return cleanMode === \"f\" /* FORCE */ || cleanMode === \"n\" /* DRY_RUN */;\n}\nfunction isKnownOption(option) {\n return /^-[a-z]$/i.test(option) && CleanOptionValues.has(option.charAt(1));\n}\nfunction isInteractiveMode(option) {\n if (/^-[^\\-]/.test(option)) {\n return option.indexOf(\"i\") > 0;\n }\n return option === \"--interactive\";\n}\nvar CONFIG_ERROR_INTERACTIVE_MODE, CONFIG_ERROR_MODE_REQUIRED, CONFIG_ERROR_UNKNOWN_OPTION, CleanOptions, CleanOptionValues;\nvar init_clean = __esm({\n \"src/lib/tasks/clean.ts\"() {\n \"use strict\";\n init_CleanSummary();\n init_utils();\n init_task();\n CONFIG_ERROR_INTERACTIVE_MODE = \"Git clean interactive mode is not supported\";\n CONFIG_ERROR_MODE_REQUIRED = 'Git clean mode parameter (\"n\" or \"f\") is required';\n CONFIG_ERROR_UNKNOWN_OPTION = \"Git clean unknown option found in: \";\n CleanOptions = /* @__PURE__ */ ((CleanOptions2) => {\n CleanOptions2[\"DRY_RUN\"] = \"n\";\n CleanOptions2[\"FORCE\"] = \"f\";\n CleanOptions2[\"IGNORED_INCLUDED\"] = \"x\";\n CleanOptions2[\"IGNORED_ONLY\"] = \"X\";\n CleanOptions2[\"EXCLUDING\"] = \"e\";\n CleanOptions2[\"QUIET\"] = \"q\";\n CleanOptions2[\"RECURSIVE\"] = \"d\";\n return CleanOptions2;\n })(CleanOptions || {});\n CleanOptionValues = /* @__PURE__ */ new Set([\n \"i\",\n ...asStringArray(Object.values(CleanOptions))\n ]);\n }\n});\n\n// src/lib/responses/ConfigList.ts\nfunction configListParser(text) {\n const config = new ConfigList();\n for (const item of configParser(text)) {\n config.addValue(item.file, String(item.key), item.value);\n }\n return config;\n}\nfunction configGetParser(text, key) {\n let value = null;\n const values = [];\n const scopes = /* @__PURE__ */ new Map();\n for (const item of configParser(text, key)) {\n if (item.key !== key) {\n continue;\n }\n values.push(value = item.value);\n if (!scopes.has(item.file)) {\n scopes.set(item.file, []);\n }\n scopes.get(item.file).push(value);\n }\n return {\n key,\n paths: Array.from(scopes.keys()),\n scopes,\n value,\n values\n };\n}\nfunction configFilePath(filePath) {\n return filePath.replace(/^(file):/, \"\");\n}\nfunction* configParser(text, requestedKey = null) {\n const lines = text.split(\"\\0\");\n for (let i = 0, max = lines.length - 1; i < max; ) {\n const file = configFilePath(lines[i++]);\n let value = lines[i++];\n let key = requestedKey;\n if (value.includes(\"\\n\")) {\n const line = splitOn(value, \"\\n\");\n key = line[0];\n value = line[1];\n }\n yield { file, key, value };\n }\n}\nvar ConfigList;\nvar init_ConfigList = __esm({\n \"src/lib/responses/ConfigList.ts\"() {\n \"use strict\";\n init_utils();\n ConfigList = class {\n constructor() {\n this.files = [];\n this.values = /* @__PURE__ */ Object.create(null);\n }\n get all() {\n if (!this._all) {\n this._all = this.files.reduce((all, file) => {\n return Object.assign(all, this.values[file]);\n }, {});\n }\n return this._all;\n }\n addFile(file) {\n if (!(file in this.values)) {\n const latest = last(this.files);\n this.values[file] = latest ? Object.create(this.values[latest]) : {};\n this.files.push(file);\n }\n return this.values[file];\n }\n addValue(file, key, value) {\n const values = this.addFile(file);\n if (!Object.hasOwn(values, key)) {\n values[key] = value;\n } else if (Array.isArray(values[key])) {\n values[key].push(value);\n } else {\n values[key] = [values[key], value];\n }\n this._all = void 0;\n }\n };\n }\n});\n\n// src/lib/tasks/config.ts\nfunction asConfigScope(scope, fallback) {\n if (typeof scope === \"string\" && Object.hasOwn(GitConfigScope, scope)) {\n return scope;\n }\n return fallback;\n}\nfunction addConfigTask(key, value, append2, scope) {\n const commands = [\"config\", `--${scope}`];\n if (append2) {\n commands.push(\"--add\");\n }\n commands.push(key, value);\n return {\n commands,\n format: \"utf-8\",\n parser(text) {\n return text;\n }\n };\n}\nfunction getConfigTask(key, scope) {\n const commands = [\"config\", \"--null\", \"--show-origin\", \"--get-all\", key];\n if (scope) {\n commands.splice(1, 0, `--${scope}`);\n }\n return {\n commands,\n format: \"utf-8\",\n parser(text) {\n return configGetParser(text, key);\n }\n };\n}\nfunction listConfigTask(scope) {\n const commands = [\"config\", \"--list\", \"--show-origin\", \"--null\"];\n if (scope) {\n commands.push(`--${scope}`);\n }\n return {\n commands,\n format: \"utf-8\",\n parser(text) {\n return configListParser(text);\n }\n };\n}\nfunction config_default() {\n return {\n addConfig(key, value, ...rest) {\n return this._runTask(\n addConfigTask(\n key,\n value,\n rest[0] === true,\n asConfigScope(rest[1], \"local\" /* local */)\n ),\n trailingFunctionArgument(arguments)\n );\n },\n getConfig(key, scope) {\n return this._runTask(\n getConfigTask(key, asConfigScope(scope, void 0)),\n trailingFunctionArgument(arguments)\n );\n },\n listConfig(...rest) {\n return this._runTask(\n listConfigTask(asConfigScope(rest[0], void 0)),\n trailingFunctionArgument(arguments)\n );\n }\n };\n}\nvar GitConfigScope;\nvar init_config = __esm({\n \"src/lib/tasks/config.ts\"() {\n \"use strict\";\n init_ConfigList();\n init_utils();\n GitConfigScope = /* @__PURE__ */ ((GitConfigScope2) => {\n GitConfigScope2[\"system\"] = \"system\";\n GitConfigScope2[\"global\"] = \"global\";\n GitConfigScope2[\"local\"] = \"local\";\n GitConfigScope2[\"worktree\"] = \"worktree\";\n return GitConfigScope2;\n })(GitConfigScope || {});\n }\n});\n\n// src/lib/tasks/diff-name-status.ts\nfunction isDiffNameStatus(input) {\n return diffNameStatus.has(input);\n}\nvar DiffNameStatus, diffNameStatus;\nvar init_diff_name_status = __esm({\n \"src/lib/tasks/diff-name-status.ts\"() {\n \"use strict\";\n DiffNameStatus = /* @__PURE__ */ ((DiffNameStatus2) => {\n DiffNameStatus2[\"ADDED\"] = \"A\";\n DiffNameStatus2[\"COPIED\"] = \"C\";\n DiffNameStatus2[\"DELETED\"] = \"D\";\n DiffNameStatus2[\"MODIFIED\"] = \"M\";\n DiffNameStatus2[\"RENAMED\"] = \"R\";\n DiffNameStatus2[\"CHANGED\"] = \"T\";\n DiffNameStatus2[\"UNMERGED\"] = \"U\";\n DiffNameStatus2[\"UNKNOWN\"] = \"X\";\n DiffNameStatus2[\"BROKEN\"] = \"B\";\n return DiffNameStatus2;\n })(DiffNameStatus || {});\n diffNameStatus = new Set(Object.values(DiffNameStatus));\n }\n});\n\n// src/lib/tasks/grep.ts\nfunction grepQueryBuilder(...params) {\n return new GrepQuery().param(...params);\n}\nfunction parseGrep(grep) {\n const paths = /* @__PURE__ */ new Set();\n const results = {};\n forEachLineWithContent(grep, (input) => {\n const [path, line, preview] = input.split(NULL);\n paths.add(path);\n (results[path] = results[path] || []).push({\n line: asNumber(line),\n path,\n preview\n });\n });\n return {\n paths,\n results\n };\n}\nfunction grep_default() {\n return {\n grep(searchTerm) {\n const then = trailingFunctionArgument(arguments);\n const options = getTrailingOptions(arguments);\n for (const option of disallowedOptions) {\n if (options.includes(option)) {\n return this._runTask(\n configurationErrorTask(`git.grep: use of \"${option}\" is not supported.`),\n then\n );\n }\n }\n if (typeof searchTerm === \"string\") {\n searchTerm = grepQueryBuilder().param(searchTerm);\n }\n const commands = [\"grep\", \"--null\", \"-n\", \"--full-name\", ...options, ...searchTerm];\n return this._runTask(\n {\n commands,\n format: \"utf-8\",\n parser(stdOut) {\n return parseGrep(stdOut);\n }\n },\n then\n );\n }\n };\n}\nvar disallowedOptions, Query, _a, GrepQuery;\nvar init_grep = __esm({\n \"src/lib/tasks/grep.ts\"() {\n \"use strict\";\n init_utils();\n init_task();\n disallowedOptions = [\"-h\"];\n Query = Symbol(\"grepQuery\");\n GrepQuery = class {\n constructor() {\n this[_a] = [];\n }\n *[(_a = Query, Symbol.iterator)]() {\n for (const query of this[Query]) {\n yield query;\n }\n }\n and(...and) {\n and.length && this[Query].push(\"--and\", \"(\", ...prefixedArray(and, \"-e\"), \")\");\n return this;\n }\n param(...param) {\n this[Query].push(...prefixedArray(param, \"-e\"));\n return this;\n }\n };\n }\n});\n\n// src/lib/tasks/reset.ts\nvar reset_exports = {};\n__export(reset_exports, {\n ResetMode: () => ResetMode,\n getResetMode: () => getResetMode,\n resetTask: () => resetTask\n});\nfunction resetTask(mode, customArgs) {\n const commands = [\"reset\"];\n if (isValidResetMode(mode)) {\n commands.push(`--${mode}`);\n }\n commands.push(...customArgs);\n return straightThroughStringTask(commands);\n}\nfunction getResetMode(mode) {\n if (isValidResetMode(mode)) {\n return mode;\n }\n switch (typeof mode) {\n case \"string\":\n case \"undefined\":\n return \"soft\" /* SOFT */;\n }\n return;\n}\nfunction isValidResetMode(mode) {\n return typeof mode === \"string\" && validResetModes.includes(mode);\n}\nvar ResetMode, validResetModes;\nvar init_reset = __esm({\n \"src/lib/tasks/reset.ts\"() {\n \"use strict\";\n init_utils();\n init_task();\n ResetMode = /* @__PURE__ */ ((ResetMode2) => {\n ResetMode2[\"MIXED\"] = \"mixed\";\n ResetMode2[\"SOFT\"] = \"soft\";\n ResetMode2[\"HARD\"] = \"hard\";\n ResetMode2[\"MERGE\"] = \"merge\";\n ResetMode2[\"KEEP\"] = \"keep\";\n return ResetMode2;\n })(ResetMode || {});\n validResetModes = asStringArray(Object.values(ResetMode));\n }\n});\n\n// src/lib/git-logger.ts\nimport debug from \"debug\";\nfunction createLog() {\n return debug(\"simple-git\");\n}\nfunction prefixedLogger(to, prefix, forward) {\n if (!prefix || !String(prefix).replace(/\\s*/, \"\")) {\n return !forward ? to : (message, ...args) => {\n to(message, ...args);\n forward(message, ...args);\n };\n }\n return (message, ...args) => {\n to(`%s ${message}`, prefix, ...args);\n if (forward) {\n forward(message, ...args);\n }\n };\n}\nfunction childLoggerName(name, childDebugger, { namespace: parentNamespace }) {\n if (typeof name === \"string\") {\n return name;\n }\n const childNamespace = childDebugger && childDebugger.namespace || \"\";\n if (childNamespace.startsWith(parentNamespace)) {\n return childNamespace.substr(parentNamespace.length + 1);\n }\n return childNamespace || parentNamespace;\n}\nfunction createLogger(label, verbose, initialStep, infoDebugger = createLog()) {\n const labelPrefix = label && `[${label}]` || \"\";\n const spawned = [];\n const debugDebugger = typeof verbose === \"string\" ? infoDebugger.extend(verbose) : verbose;\n const key = childLoggerName(filterType(verbose, filterString), debugDebugger, infoDebugger);\n return step(initialStep);\n function sibling(name, initial) {\n return append(\n spawned,\n createLogger(label, key.replace(/^[^:]+/, name), initial, infoDebugger)\n );\n }\n function step(phase) {\n const stepPrefix = phase && `[${phase}]` || \"\";\n const debug2 = debugDebugger && prefixedLogger(debugDebugger, stepPrefix) || NOOP;\n const info = prefixedLogger(infoDebugger, `${labelPrefix} ${stepPrefix}`, debug2);\n return Object.assign(debugDebugger ? debug2 : info, {\n label,\n sibling,\n info,\n step\n });\n }\n}\nvar init_git_logger = __esm({\n \"src/lib/git-logger.ts\"() {\n \"use strict\";\n init_utils();\n debug.formatters.L = (value) => String(filterHasLength(value) ? value.length : \"-\");\n debug.formatters.B = (value) => {\n if (Buffer.isBuffer(value)) {\n return value.toString(\"utf8\");\n }\n return objectToString(value);\n };\n }\n});\n\n// src/lib/runners/tasks-pending-queue.ts\nvar TasksPendingQueue;\nvar init_tasks_pending_queue = __esm({\n \"src/lib/runners/tasks-pending-queue.ts\"() {\n \"use strict\";\n init_git_error();\n init_git_logger();\n TasksPendingQueue = class _TasksPendingQueue {\n constructor(logLabel = \"GitExecutor\") {\n this.logLabel = logLabel;\n this._queue = /* @__PURE__ */ new Map();\n }\n withProgress(task) {\n return this._queue.get(task);\n }\n createProgress(task) {\n const name = _TasksPendingQueue.getName(task.commands[0]);\n const logger = createLogger(this.logLabel, name);\n return {\n task,\n logger,\n name\n };\n }\n push(task) {\n const progress = this.createProgress(task);\n progress.logger(\"Adding task to the queue, commands = %o\", task.commands);\n this._queue.set(task, progress);\n return progress;\n }\n fatal(err) {\n for (const [task, { logger }] of Array.from(this._queue.entries())) {\n if (task === err.task) {\n logger.info(`Failed %o`, err);\n logger(\n `Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`\n );\n } else {\n logger.info(\n `A fatal exception occurred in a previous task, the queue has been purged: %o`,\n err.message\n );\n }\n this.complete(task);\n }\n if (this._queue.size !== 0) {\n throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`);\n }\n }\n complete(task) {\n const progress = this.withProgress(task);\n if (progress) {\n this._queue.delete(task);\n }\n }\n attempt(task) {\n const progress = this.withProgress(task);\n if (!progress) {\n throw new GitError(void 0, \"TasksPendingQueue: attempt called for an unknown task\");\n }\n progress.logger(\"Starting task\");\n return progress;\n }\n static getName(name = \"empty\") {\n return `task:${name}:${++_TasksPendingQueue.counter}`;\n }\n static {\n this.counter = 0;\n }\n };\n }\n});\n\n// src/lib/runners/git-executor-chain.ts\nimport { spawn } from \"child_process\";\nfunction pluginContext(task, commands) {\n return {\n method: first(task.commands) || \"\",\n commands\n };\n}\nfunction onErrorReceived(target, logger) {\n return (err) => {\n logger(`[ERROR] child process exception %o`, err);\n target.push(Buffer.from(String(err.stack), \"ascii\"));\n };\n}\nfunction onDataReceived(target, name, logger, output) {\n return (buffer) => {\n logger(`%s received %L bytes`, name, buffer);\n output(`%B`, buffer);\n target.push(buffer);\n };\n}\nvar GitExecutorChain;\nvar init_git_executor_chain = __esm({\n \"src/lib/runners/git-executor-chain.ts\"() {\n \"use strict\";\n init_git_error();\n init_task();\n init_utils();\n init_tasks_pending_queue();\n GitExecutorChain = class {\n constructor(_executor, _scheduler, _plugins) {\n this._executor = _executor;\n this._scheduler = _scheduler;\n this._plugins = _plugins;\n this._chain = Promise.resolve();\n this._queue = new TasksPendingQueue();\n }\n get cwd() {\n return this._cwd || this._executor.cwd;\n }\n set cwd(cwd) {\n this._cwd = cwd;\n }\n get env() {\n return this._executor.env;\n }\n get outputHandler() {\n return this._executor.outputHandler;\n }\n chain() {\n return this;\n }\n push(task) {\n this._queue.push(task);\n return this._chain = this._chain.then(() => this.attemptTask(task));\n }\n async attemptTask(task) {\n const onScheduleComplete = await this._scheduler.next();\n const onQueueComplete = () => this._queue.complete(task);\n try {\n const { logger } = this._queue.attempt(task);\n return await (isEmptyTask(task) ? this.attemptEmptyTask(task, logger) : this.attemptRemoteTask(task, logger));\n } catch (e) {\n throw this.onFatalException(task, e);\n } finally {\n onQueueComplete();\n onScheduleComplete();\n }\n }\n onFatalException(task, e) {\n const gitError = e instanceof GitError ? Object.assign(e, { task }) : new GitError(task, e && String(e));\n this._chain = Promise.resolve();\n this._queue.fatal(gitError);\n return gitError;\n }\n async attemptRemoteTask(task, logger) {\n const binary = this._plugins.exec(\"spawn.binary\", \"\", pluginContext(task, task.commands));\n const args = this._plugins.exec(\"spawn.args\", [...task.commands], {\n ...pluginContext(task, task.commands),\n env: { ...this.env }\n });\n const raw = await this.gitResponse(\n task,\n binary,\n args,\n this.outputHandler,\n logger.step(\"SPAWN\")\n );\n const outputStreams = await this.handleTaskData(task, args, raw, logger.step(\"HANDLE\"));\n logger(`passing response to task's parser as a %s`, task.format);\n if (isBufferTask(task)) {\n return callTaskParser(task.parser, outputStreams);\n }\n return callTaskParser(task.parser, outputStreams.asStrings());\n }\n async attemptEmptyTask(task, logger) {\n logger(`empty task bypassing child process to call to task's parser`);\n return task.parser(this);\n }\n handleTaskData(task, args, result, logger) {\n const { exitCode, rejection, stdOut, stdErr } = result;\n return new Promise((done, fail) => {\n logger(`Preparing to handle process response exitCode=%d stdOut=`, exitCode);\n const { error } = this._plugins.exec(\n \"task.error\",\n { error: rejection },\n {\n ...pluginContext(task, args),\n ...result\n }\n );\n if (error && task.onError) {\n logger.info(`exitCode=%s handling with custom error handler`);\n return task.onError(\n result,\n error,\n (newStdOut) => {\n logger.info(`custom error handler treated as success`);\n logger(`custom error returned a %s`, objectToString(newStdOut));\n done(\n new GitOutputStreams(\n Array.isArray(newStdOut) ? Buffer.concat(newStdOut) : newStdOut,\n Buffer.concat(stdErr)\n )\n );\n },\n fail\n );\n }\n if (error) {\n logger.info(\n `handling as error: exitCode=%s stdErr=%s rejection=%o`,\n exitCode,\n stdErr.length,\n rejection\n );\n return fail(error);\n }\n logger.info(`retrieving task output complete`);\n done(new GitOutputStreams(Buffer.concat(stdOut), Buffer.concat(stdErr)));\n });\n }\n async gitResponse(task, command, args, outputHandler, logger) {\n const outputLogger = logger.sibling(\"output\");\n const spawnOptions = this._plugins.exec(\n \"spawn.options\",\n {\n cwd: this.cwd,\n env: this.env,\n windowsHide: true\n },\n pluginContext(task, task.commands)\n );\n return new Promise((done) => {\n const stdOut = [];\n const stdErr = [];\n logger.info(`%s %o`, command, args);\n logger(\"%O\", spawnOptions);\n let rejection = this._beforeSpawn(task, args);\n if (rejection) {\n return done({\n stdOut,\n stdErr,\n exitCode: 9901,\n rejection\n });\n }\n this._plugins.exec(\"spawn.before\", void 0, {\n ...pluginContext(task, args),\n kill(reason) {\n rejection = reason || rejection;\n }\n });\n const spawned = spawn(command, args, spawnOptions);\n spawned.stdout.on(\n \"data\",\n onDataReceived(stdOut, \"stdOut\", logger, outputLogger.step(\"stdOut\"))\n );\n spawned.stderr.on(\n \"data\",\n onDataReceived(stdErr, \"stdErr\", logger, outputLogger.step(\"stdErr\"))\n );\n spawned.on(\"error\", onErrorReceived(stdErr, logger));\n if (outputHandler) {\n logger(`Passing child process stdOut/stdErr to custom outputHandler`);\n outputHandler(command, spawned.stdout, spawned.stderr, [...args]);\n }\n this._plugins.exec(\"spawn.after\", void 0, {\n ...pluginContext(task, args),\n spawned,\n close(exitCode, reason) {\n done({\n stdOut,\n stdErr,\n exitCode,\n rejection: rejection || reason\n });\n },\n kill(reason) {\n if (spawned.killed) {\n return;\n }\n rejection = reason;\n spawned.kill(\"SIGINT\");\n }\n });\n });\n }\n _beforeSpawn(task, args) {\n let rejection;\n this._plugins.exec(\"spawn.before\", void 0, {\n ...pluginContext(task, args),\n kill(reason) {\n rejection = reason || rejection;\n }\n });\n return rejection;\n }\n };\n }\n});\n\n// src/lib/runners/git-executor.ts\nvar git_executor_exports = {};\n__export(git_executor_exports, {\n GitExecutor: () => GitExecutor\n});\nvar GitExecutor;\nvar init_git_executor = __esm({\n \"src/lib/runners/git-executor.ts\"() {\n \"use strict\";\n init_git_executor_chain();\n GitExecutor = class {\n constructor(cwd, _scheduler, _plugins) {\n this.cwd = cwd;\n this._scheduler = _scheduler;\n this._plugins = _plugins;\n this._chain = new GitExecutorChain(this, this._scheduler, this._plugins);\n }\n chain() {\n return new GitExecutorChain(this, this._scheduler, this._plugins);\n }\n push(task) {\n return this._chain.push(task);\n }\n };\n }\n});\n\n// src/lib/task-callback.ts\nfunction taskCallback(task, response, callback = NOOP) {\n const onSuccess = (data) => {\n callback(null, data);\n };\n const onError2 = (err) => {\n if (err?.task === task) {\n callback(\n err instanceof GitResponseError ? addDeprecationNoticeToError(err) : err,\n void 0\n );\n }\n };\n response.then(onSuccess, onError2);\n}\nfunction addDeprecationNoticeToError(err) {\n let log = (name) => {\n console.warn(\n `simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3`\n );\n log = NOOP;\n };\n return Object.create(err, Object.getOwnPropertyNames(err.git).reduce(descriptorReducer, {}));\n function descriptorReducer(all, name) {\n if (name in err) {\n return all;\n }\n all[name] = {\n enumerable: false,\n configurable: false,\n get() {\n log(name);\n return err.git[name];\n }\n };\n return all;\n }\n}\nvar init_task_callback = __esm({\n \"src/lib/task-callback.ts\"() {\n \"use strict\";\n init_git_response_error();\n init_utils();\n }\n});\n\n// src/lib/tasks/change-working-directory.ts\nfunction changeWorkingDirectoryTask(directory, root) {\n return adhocExecTask((instance) => {\n if (!folderExists(directory)) {\n throw new Error(`Git.cwd: cannot change to non-directory \"${directory}\"`);\n }\n return (root || instance).cwd = directory;\n });\n}\nvar init_change_working_directory = __esm({\n \"src/lib/tasks/change-working-directory.ts\"() {\n \"use strict\";\n init_utils();\n init_task();\n }\n});\n\n// src/lib/tasks/checkout.ts\nfunction checkoutTask(args) {\n const commands = [\"checkout\", ...args];\n if (commands[1] === \"-b\" && commands.includes(\"-B\")) {\n commands[1] = remove(commands, \"-B\");\n }\n return straightThroughStringTask(commands);\n}\nfunction checkout_default() {\n return {\n checkout() {\n return this._runTask(\n checkoutTask(getTrailingOptions(arguments, 1)),\n trailingFunctionArgument(arguments)\n );\n },\n checkoutBranch(branchName, startPoint) {\n return this._runTask(\n checkoutTask([\"-b\", branchName, startPoint, ...getTrailingOptions(arguments)]),\n trailingFunctionArgument(arguments)\n );\n },\n checkoutLocalBranch(branchName) {\n return this._runTask(\n checkoutTask([\"-b\", branchName, ...getTrailingOptions(arguments)]),\n trailingFunctionArgument(arguments)\n );\n }\n };\n}\nvar init_checkout = __esm({\n \"src/lib/tasks/checkout.ts\"() {\n \"use strict\";\n init_utils();\n init_task();\n }\n});\n\n// src/lib/tasks/count-objects.ts\nfunction countObjectsResponse() {\n return {\n count: 0,\n garbage: 0,\n inPack: 0,\n packs: 0,\n prunePackable: 0,\n size: 0,\n sizeGarbage: 0,\n sizePack: 0\n };\n}\nfunction count_objects_default() {\n return {\n countObjects() {\n return this._runTask({\n commands: [\"count-objects\", \"--verbose\"],\n format: \"utf-8\",\n parser(stdOut) {\n return parseStringResponse(countObjectsResponse(), [parser2], stdOut);\n }\n });\n }\n };\n}\nvar parser2;\nvar init_count_objects = __esm({\n \"src/lib/tasks/count-objects.ts\"() {\n \"use strict\";\n init_utils();\n parser2 = new LineParser(\n /([a-z-]+): (\\d+)$/,\n (result, [key, value]) => {\n const property = asCamelCase(key);\n if (Object.hasOwn(result, property)) {\n result[property] = asNumber(value);\n }\n }\n );\n }\n});\n\n// src/lib/parsers/parse-commit.ts\nfunction parseCommitResult(stdOut) {\n const result = {\n author: null,\n branch: \"\",\n commit: \"\",\n root: false,\n summary: {\n changes: 0,\n insertions: 0,\n deletions: 0\n }\n };\n return parseStringResponse(result, parsers, stdOut);\n}\nvar parsers;\nvar init_parse_commit = __esm({\n \"src/lib/parsers/parse-commit.ts\"() {\n \"use strict\";\n init_utils();\n parsers = [\n new LineParser(/^\\[([^\\s]+)( \\([^)]+\\))? ([^\\]]+)/, (result, [branch, root, commit]) => {\n result.branch = branch;\n result.commit = commit;\n result.root = !!root;\n }),\n new LineParser(/\\s*Author:\\s(.+)/i, (result, [author]) => {\n const parts = author.split(\"<\");\n const email = parts.pop();\n if (!email || !email.includes(\"@\")) {\n return;\n }\n result.author = {\n email: email.substr(0, email.length - 1),\n name: parts.join(\"<\").trim()\n };\n }),\n new LineParser(\n /(\\d+)[^,]*(?:,\\s*(\\d+)[^,]*)(?:,\\s*(\\d+))/g,\n (result, [changes, insertions, deletions]) => {\n result.summary.changes = parseInt(changes, 10) || 0;\n result.summary.insertions = parseInt(insertions, 10) || 0;\n result.summary.deletions = parseInt(deletions, 10) || 0;\n }\n ),\n new LineParser(\n /^(\\d+)[^,]*(?:,\\s*(\\d+)[^(]+\\(([+-]))?/,\n (result, [changes, lines, direction]) => {\n result.summary.changes = parseInt(changes, 10) || 0;\n const count = parseInt(lines, 10) || 0;\n if (direction === \"-\") {\n result.summary.deletions = count;\n } else if (direction === \"+\") {\n result.summary.insertions = count;\n }\n }\n )\n ];\n }\n});\n\n// src/lib/tasks/commit.ts\nfunction commitTask(message, files, customArgs) {\n const commands = [\n \"-c\",\n \"core.abbrev=40\",\n \"commit\",\n ...prefixedArray(message, \"-m\"),\n ...files,\n ...customArgs\n ];\n return {\n commands,\n format: \"utf-8\",\n parser: parseCommitResult\n };\n}\nfunction commit_default() {\n return {\n commit(message, ...rest) {\n const next = trailingFunctionArgument(arguments);\n const task = rejectDeprecatedSignatures(message) || commitTask(\n asArray(message),\n asArray(filterType(rest[0], filterStringOrStringArray, [])),\n [\n ...asStringArray(filterType(rest[1], filterArray, [])),\n ...getTrailingOptions(arguments, 0, true)\n ]\n );\n return this._runTask(task, next);\n }\n };\n function rejectDeprecatedSignatures(message) {\n return !filterStringOrStringArray(message) && configurationErrorTask(\n `git.commit: requires the commit message to be supplied as a string/string[]`\n );\n }\n}\nvar init_commit = __esm({\n \"src/lib/tasks/commit.ts\"() {\n \"use strict\";\n init_parse_commit();\n init_utils();\n init_task();\n }\n});\n\n// src/lib/tasks/first-commit.ts\nfunction first_commit_default() {\n return {\n firstCommit() {\n return this._runTask(\n straightThroughStringTask([\"rev-list\", \"--max-parents=0\", \"HEAD\"], true),\n trailingFunctionArgument(arguments)\n );\n }\n };\n}\nvar init_first_commit = __esm({\n \"src/lib/tasks/first-commit.ts\"() {\n \"use strict\";\n init_utils();\n init_task();\n }\n});\n\n// src/lib/tasks/hash-object.ts\nfunction hashObjectTask(filePath, write) {\n const commands = [\"hash-object\", filePath];\n if (write) {\n commands.push(\"-w\");\n }\n return straightThroughStringTask(commands, true);\n}\nvar init_hash_object = __esm({\n \"src/lib/tasks/hash-object.ts\"() {\n \"use strict\";\n init_task();\n }\n});\n\n// src/lib/responses/InitSummary.ts\nfunction parseInit(bare, path, text) {\n const response = String(text).trim();\n let result;\n if (result = initResponseRegex.exec(response)) {\n return new InitSummary(bare, path, false, result[1]);\n }\n if (result = reInitResponseRegex.exec(response)) {\n return new InitSummary(bare, path, true, result[1]);\n }\n let gitDir = \"\";\n const tokens = response.split(\" \");\n while (tokens.length) {\n const token = tokens.shift();\n if (token === \"in\") {\n gitDir = tokens.join(\" \");\n break;\n }\n }\n return new InitSummary(bare, path, /^re/i.test(response), gitDir);\n}\nvar InitSummary, initResponseRegex, reInitResponseRegex;\nvar init_InitSummary = __esm({\n \"src/lib/responses/InitSummary.ts\"() {\n \"use strict\";\n InitSummary = class {\n constructor(bare, path, existing, gitDir) {\n this.bare = bare;\n this.path = path;\n this.existing = existing;\n this.gitDir = gitDir;\n }\n };\n initResponseRegex = /^Init.+ repository in (.+)$/;\n reInitResponseRegex = /^Rein.+ in (.+)$/;\n }\n});\n\n// src/lib/tasks/init.ts\nfunction hasBareCommand(command) {\n return command.includes(bareCommand);\n}\nfunction initTask(bare = false, path, customArgs) {\n const commands = [\"init\", ...customArgs];\n if (bare && !hasBareCommand(commands)) {\n commands.splice(1, 0, bareCommand);\n }\n return {\n commands,\n format: \"utf-8\",\n parser(text) {\n return parseInit(commands.includes(\"--bare\"), path, text);\n }\n };\n}\nvar bareCommand;\nvar init_init = __esm({\n \"src/lib/tasks/init.ts\"() {\n \"use strict\";\n init_InitSummary();\n bareCommand = \"--bare\";\n }\n});\n\n// src/lib/args/log-format.ts\nfunction logFormatFromCommand(customArgs) {\n for (let i = 0; i < customArgs.length; i++) {\n const format = logFormatRegex.exec(customArgs[i]);\n if (format) {\n return `--${format[1]}`;\n }\n }\n return \"\" /* NONE */;\n}\nfunction isLogFormat(customArg) {\n return logFormatRegex.test(customArg);\n}\nvar logFormatRegex;\nvar init_log_format = __esm({\n \"src/lib/args/log-format.ts\"() {\n \"use strict\";\n logFormatRegex = /^--(stat|numstat|name-only|name-status)(=|$)/;\n }\n});\n\n// src/lib/responses/DiffSummary.ts\nvar DiffSummary;\nvar init_DiffSummary = __esm({\n \"src/lib/responses/DiffSummary.ts\"() {\n \"use strict\";\n DiffSummary = class {\n constructor() {\n this.changed = 0;\n this.deletions = 0;\n this.insertions = 0;\n this.files = [];\n }\n };\n }\n});\n\n// src/lib/parsers/parse-diff-summary.ts\nfunction getDiffParser(format = \"\" /* NONE */) {\n const parser4 = diffSummaryParsers[format];\n return (stdOut) => parseStringResponse(new DiffSummary(), parser4, stdOut, false);\n}\nvar statParser, numStatParser, nameOnlyParser, nameStatusParser, diffSummaryParsers;\nvar init_parse_diff_summary = __esm({\n \"src/lib/parsers/parse-diff-summary.ts\"() {\n \"use strict\";\n init_log_format();\n init_DiffSummary();\n init_diff_name_status();\n init_utils();\n statParser = [\n new LineParser(\n /^(.+)\\s+\\|\\s+(\\d+)(\\s+[+\\-]+)?$/,\n (result, [file, changes, alterations = \"\"]) => {\n result.files.push({\n file: file.trim(),\n changes: asNumber(changes),\n insertions: alterations.replace(/[^+]/g, \"\").length,\n deletions: alterations.replace(/[^-]/g, \"\").length,\n binary: false\n });\n }\n ),\n new LineParser(\n /^(.+) \\|\\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,\n (result, [file, before, after]) => {\n result.files.push({\n file: file.trim(),\n before: asNumber(before),\n after: asNumber(after),\n binary: true\n });\n }\n ),\n new LineParser(\n /(\\d+) files? changed\\s*((?:, \\d+ [^,]+){0,2})/,\n (result, [changed, summary]) => {\n const inserted = /(\\d+) i/.exec(summary);\n const deleted = /(\\d+) d/.exec(summary);\n result.changed = asNumber(changed);\n result.insertions = asNumber(inserted?.[1]);\n result.deletions = asNumber(deleted?.[1]);\n }\n )\n ];\n numStatParser = [\n new LineParser(\n /(\\d+)\\t(\\d+)\\t(.+)$/,\n (result, [changesInsert, changesDelete, file]) => {\n const insertions = asNumber(changesInsert);\n const deletions = asNumber(changesDelete);\n result.changed++;\n result.insertions += insertions;\n result.deletions += deletions;\n result.files.push({\n file,\n changes: insertions + deletions,\n insertions,\n deletions,\n binary: false\n });\n }\n ),\n new LineParser(/-\\t-\\t(.+)$/, (result, [file]) => {\n result.changed++;\n result.files.push({\n file,\n after: 0,\n before: 0,\n binary: true\n });\n })\n ];\n nameOnlyParser = [\n new LineParser(/(.+)$/, (result, [file]) => {\n result.changed++;\n result.files.push({\n file,\n changes: 0,\n insertions: 0,\n deletions: 0,\n binary: false\n });\n })\n ];\n nameStatusParser = [\n new LineParser(\n /([ACDMRTUXB])([0-9]{0,3})\\t(.[^\\t]*)(\\t(.[^\\t]*))?$/,\n (result, [status, similarity, from, _to, to]) => {\n result.changed++;\n result.files.push({\n file: to ?? from,\n changes: 0,\n insertions: 0,\n deletions: 0,\n binary: false,\n status: orVoid(isDiffNameStatus(status) && status),\n from: orVoid(!!to && from !== to && from),\n similarity: asNumber(similarity)\n });\n }\n )\n ];\n diffSummaryParsers = {\n [\"\" /* NONE */]: statParser,\n [\"--stat\" /* STAT */]: statParser,\n [\"--numstat\" /* NUM_STAT */]: numStatParser,\n [\"--name-status\" /* NAME_STATUS */]: nameStatusParser,\n [\"--name-only\" /* NAME_ONLY */]: nameOnlyParser\n };\n }\n});\n\n// src/lib/parsers/parse-list-log-summary.ts\nfunction lineBuilder(tokens, fields) {\n return fields.reduce(\n (line, field, index) => {\n line[field] = tokens[index] || \"\";\n return line;\n },\n /* @__PURE__ */ Object.create({ diff: null })\n );\n}\nfunction createListLogSummaryParser(splitter = SPLITTER, fields = defaultFieldNames, logFormat = \"\" /* NONE */) {\n const parseDiffResult = getDiffParser(logFormat);\n return function(stdOut) {\n const all = toLinesWithContent(\n stdOut.trim(),\n false,\n START_BOUNDARY\n ).map(function(item) {\n const lineDetail = item.split(COMMIT_BOUNDARY);\n const listLogLine = lineBuilder(lineDetail[0].split(splitter), fields);\n if (lineDetail.length > 1 && !!lineDetail[1].trim()) {\n listLogLine.diff = parseDiffResult(lineDetail[1]);\n }\n return listLogLine;\n });\n return {\n all,\n latest: all.length && all[0] || null,\n total: all.length\n };\n };\n}\nvar START_BOUNDARY, COMMIT_BOUNDARY, SPLITTER, defaultFieldNames;\nvar init_parse_list_log_summary = __esm({\n \"src/lib/parsers/parse-list-log-summary.ts\"() {\n \"use strict\";\n init_utils();\n init_parse_diff_summary();\n init_log_format();\n START_BOUNDARY = \"\\xF2\\xF2\\xF2\\xF2\\xF2\\xF2 \";\n COMMIT_BOUNDARY = \" \\xF2\\xF2\";\n SPLITTER = \" \\xF2 \";\n defaultFieldNames = [\"hash\", \"date\", \"message\", \"refs\", \"author_name\", \"author_email\"];\n }\n});\n\n// src/lib/tasks/diff.ts\nvar diff_exports = {};\n__export(diff_exports, {\n diffSummaryTask: () => diffSummaryTask,\n validateLogFormatConfig: () => validateLogFormatConfig\n});\nfunction diffSummaryTask(customArgs) {\n let logFormat = logFormatFromCommand(customArgs);\n const commands = [\"diff\"];\n if (logFormat === \"\" /* NONE */) {\n logFormat = \"--stat\" /* STAT */;\n commands.push(\"--stat=4096\");\n }\n commands.push(...customArgs);\n return validateLogFormatConfig(commands) || {\n commands,\n format: \"utf-8\",\n parser: getDiffParser(logFormat)\n };\n}\nfunction validateLogFormatConfig(customArgs) {\n const flags = customArgs.filter(isLogFormat);\n if (flags.length > 1) {\n return configurationErrorTask(\n `Summary flags are mutually exclusive - pick one of ${flags.join(\",\")}`\n );\n }\n if (flags.length && customArgs.includes(\"-z\")) {\n return configurationErrorTask(\n `Summary flag ${flags} parsing is not compatible with null termination option '-z'`\n );\n }\n}\nvar init_diff = __esm({\n \"src/lib/tasks/diff.ts\"() {\n \"use strict\";\n init_log_format();\n init_parse_diff_summary();\n init_task();\n }\n});\n\n// src/lib/tasks/log.ts\nimport { pathspec as pathspec2 } from \"@simple-git/args-pathspec\";\nfunction prettyFormat(format, splitter) {\n const fields = [];\n const formatStr = [];\n Object.keys(format).forEach((field) => {\n fields.push(field);\n formatStr.push(String(format[field]));\n });\n return [fields, formatStr.join(splitter)];\n}\nfunction userOptions(input) {\n return Object.keys(input).reduce((out, key) => {\n if (!(key in excludeOptions)) {\n out[key] = input[key];\n }\n return out;\n }, {});\n}\nfunction parseLogOptions(opt = {}, customArgs = []) {\n const splitter = filterType(opt.splitter, filterString, SPLITTER);\n const format = filterPlainObject(opt.format) ? opt.format : {\n hash: \"%H\",\n date: opt.strictDate === false ? \"%ai\" : \"%aI\",\n message: \"%s\",\n refs: \"%D\",\n body: opt.multiLine ? \"%B\" : \"%b\",\n author_name: opt.mailMap !== false ? \"%aN\" : \"%an\",\n author_email: opt.mailMap !== false ? \"%aE\" : \"%ae\"\n };\n const [fields, formatStr] = prettyFormat(format, splitter);\n const suffix = [];\n const command = [\n `--pretty=format:${START_BOUNDARY}${formatStr}${COMMIT_BOUNDARY}`,\n ...customArgs\n ];\n const maxCount = opt.n || opt[\"max-count\"] || opt.maxCount;\n if (maxCount) {\n command.push(`--max-count=${maxCount}`);\n }\n if (opt.from || opt.to) {\n const rangeOperator = opt.symmetric !== false ? \"...\" : \"..\";\n suffix.push(`${opt.from || \"\"}${rangeOperator}${opt.to || \"\"}`);\n }\n if (filterString(opt.file)) {\n command.push(\"--follow\", pathspec2(opt.file));\n }\n appendTaskOptions(userOptions(opt), command);\n return {\n fields,\n splitter,\n commands: [...command, ...suffix]\n };\n}\nfunction logTask(splitter, fields, customArgs) {\n const parser4 = createListLogSummaryParser(splitter, fields, logFormatFromCommand(customArgs));\n return {\n commands: [\"log\", ...customArgs],\n format: \"utf-8\",\n parser: parser4\n };\n}\nfunction log_default() {\n return {\n log(...rest) {\n const next = trailingFunctionArgument(arguments);\n const options = parseLogOptions(\n trailingOptionsArgument(arguments),\n asStringArray(filterType(arguments[0], filterArray, []))\n );\n const task = rejectDeprecatedSignatures(...rest) || validateLogFormatConfig(options.commands) || createLogTask(options);\n return this._runTask(task, next);\n }\n };\n function createLogTask(options) {\n return logTask(options.splitter, options.fields, options.commands);\n }\n function rejectDeprecatedSignatures(from, to) {\n return filterString(from) && filterString(to) && configurationErrorTask(\n `git.log(string, string) should be replaced with git.log({ from: string, to: string })`\n );\n }\n}\nvar excludeOptions;\nvar init_log = __esm({\n \"src/lib/tasks/log.ts\"() {\n \"use strict\";\n init_log_format();\n init_parse_list_log_summary();\n init_utils();\n init_task();\n init_diff();\n excludeOptions = /* @__PURE__ */ ((excludeOptions2) => {\n excludeOptions2[excludeOptions2[\"--pretty\"] = 0] = \"--pretty\";\n excludeOptions2[excludeOptions2[\"max-count\"] = 1] = \"max-count\";\n excludeOptions2[excludeOptions2[\"maxCount\"] = 2] = \"maxCount\";\n excludeOptions2[excludeOptions2[\"n\"] = 3] = \"n\";\n excludeOptions2[excludeOptions2[\"file\"] = 4] = \"file\";\n excludeOptions2[excludeOptions2[\"format\"] = 5] = \"format\";\n excludeOptions2[excludeOptions2[\"from\"] = 6] = \"from\";\n excludeOptions2[excludeOptions2[\"to\"] = 7] = \"to\";\n excludeOptions2[excludeOptions2[\"splitter\"] = 8] = \"splitter\";\n excludeOptions2[excludeOptions2[\"symmetric\"] = 9] = \"symmetric\";\n excludeOptions2[excludeOptions2[\"mailMap\"] = 10] = \"mailMap\";\n excludeOptions2[excludeOptions2[\"multiLine\"] = 11] = \"multiLine\";\n excludeOptions2[excludeOptions2[\"strictDate\"] = 12] = \"strictDate\";\n return excludeOptions2;\n })(excludeOptions || {});\n }\n});\n\n// src/lib/responses/MergeSummary.ts\nvar MergeSummaryConflict, MergeSummaryDetail;\nvar init_MergeSummary = __esm({\n \"src/lib/responses/MergeSummary.ts\"() {\n \"use strict\";\n MergeSummaryConflict = class {\n constructor(reason, file = null, meta) {\n this.reason = reason;\n this.file = file;\n this.meta = meta;\n }\n toString() {\n return `${this.file}:${this.reason}`;\n }\n };\n MergeSummaryDetail = class {\n constructor() {\n this.conflicts = [];\n this.merges = [];\n this.result = \"success\";\n }\n get failed() {\n return this.conflicts.length > 0;\n }\n get reason() {\n return this.result;\n }\n toString() {\n if (this.conflicts.length) {\n return `CONFLICTS: ${this.conflicts.join(\", \")}`;\n }\n return \"OK\";\n }\n };\n }\n});\n\n// src/lib/responses/PullSummary.ts\nvar PullSummary, PullFailedSummary;\nvar init_PullSummary = __esm({\n \"src/lib/responses/PullSummary.ts\"() {\n \"use strict\";\n PullSummary = class {\n constructor() {\n this.remoteMessages = {\n all: []\n };\n this.created = [];\n this.deleted = [];\n this.files = [];\n this.deletions = {};\n this.insertions = {};\n this.summary = {\n changes: 0,\n deletions: 0,\n insertions: 0\n };\n }\n };\n PullFailedSummary = class {\n constructor() {\n this.remote = \"\";\n this.hash = {\n local: \"\",\n remote: \"\"\n };\n this.branch = {\n local: \"\",\n remote: \"\"\n };\n this.message = \"\";\n }\n toString() {\n return this.message;\n }\n };\n }\n});\n\n// src/lib/parsers/parse-remote-objects.ts\nfunction objectEnumerationResult(remoteMessages) {\n return remoteMessages.objects = remoteMessages.objects || {\n compressing: 0,\n counting: 0,\n enumerating: 0,\n packReused: 0,\n reused: { count: 0, delta: 0 },\n total: { count: 0, delta: 0 }\n };\n}\nfunction asObjectCount(source) {\n const count = /^\\s*(\\d+)/.exec(source);\n const delta = /delta (\\d+)/i.exec(source);\n return {\n count: asNumber(count && count[1] || \"0\"),\n delta: asNumber(delta && delta[1] || \"0\")\n };\n}\nvar remoteMessagesObjectParsers;\nvar init_parse_remote_objects = __esm({\n \"src/lib/parsers/parse-remote-objects.ts\"() {\n \"use strict\";\n init_utils();\n remoteMessagesObjectParsers = [\n new RemoteLineParser(\n /^remote:\\s*(enumerating|counting|compressing) objects: (\\d+),/i,\n (result, [action, count]) => {\n const key = action.toLowerCase();\n const enumeration = objectEnumerationResult(result.remoteMessages);\n Object.assign(enumeration, { [key]: asNumber(count) });\n }\n ),\n new RemoteLineParser(\n /^remote:\\s*(enumerating|counting|compressing) objects: \\d+% \\(\\d+\\/(\\d+)\\),/i,\n (result, [action, count]) => {\n const key = action.toLowerCase();\n const enumeration = objectEnumerationResult(result.remoteMessages);\n Object.assign(enumeration, { [key]: asNumber(count) });\n }\n ),\n new RemoteLineParser(\n /total ([^,]+), reused ([^,]+), pack-reused (\\d+)/i,\n (result, [total, reused, packReused]) => {\n const objects = objectEnumerationResult(result.remoteMessages);\n objects.total = asObjectCount(total);\n objects.reused = asObjectCount(reused);\n objects.packReused = asNumber(packReused);\n }\n )\n ];\n }\n});\n\n// src/lib/parsers/parse-remote-messages.ts\nfunction parseRemoteMessages(_stdOut, stdErr) {\n return parseStringResponse({ remoteMessages: new RemoteMessageSummary() }, parsers2, stdErr);\n}\nvar parsers2, RemoteMessageSummary;\nvar init_parse_remote_messages = __esm({\n \"src/lib/parsers/parse-remote-messages.ts\"() {\n \"use strict\";\n init_utils();\n init_parse_remote_objects();\n parsers2 = [\n new RemoteLineParser(/^remote:\\s*(.+)$/, (result, [text]) => {\n result.remoteMessages.all.push(text.trim());\n return false;\n }),\n ...remoteMessagesObjectParsers,\n new RemoteLineParser(\n [/create a (?:pull|merge) request/i, /\\s(https?:\\/\\/\\S+)$/],\n (result, [pullRequestUrl]) => {\n result.remoteMessages.pullRequestUrl = pullRequestUrl;\n }\n ),\n new RemoteLineParser(\n [/found (\\d+) vulnerabilities.+\\(([^)]+)\\)/i, /\\s(https?:\\/\\/\\S+)$/],\n (result, [count, summary, url]) => {\n result.remoteMessages.vulnerabilities = {\n count: asNumber(count),\n summary,\n url\n };\n }\n )\n ];\n RemoteMessageSummary = class {\n constructor() {\n this.all = [];\n }\n };\n }\n});\n\n// src/lib/parsers/parse-pull.ts\nfunction parsePullErrorResult(stdOut, stdErr) {\n const pullError = parseStringResponse(new PullFailedSummary(), errorParsers, [stdOut, stdErr]);\n return pullError.message && pullError;\n}\nvar FILE_UPDATE_REGEX, SUMMARY_REGEX, ACTION_REGEX, parsers3, errorParsers, parsePullDetail, parsePullResult;\nvar init_parse_pull = __esm({\n \"src/lib/parsers/parse-pull.ts\"() {\n \"use strict\";\n init_PullSummary();\n init_utils();\n init_parse_remote_messages();\n FILE_UPDATE_REGEX = /^\\s*(.+?)\\s+\\|\\s+\\d+\\s*(\\+*)(-*)/;\n SUMMARY_REGEX = /(\\d+)\\D+((\\d+)\\D+\\(\\+\\))?(\\D+(\\d+)\\D+\\(-\\))?/;\n ACTION_REGEX = /^(create|delete) mode \\d+ (.+)/;\n parsers3 = [\n new LineParser(FILE_UPDATE_REGEX, (result, [file, insertions, deletions]) => {\n result.files.push(file);\n if (insertions) {\n result.insertions[file] = insertions.length;\n }\n if (deletions) {\n result.deletions[file] = deletions.length;\n }\n }),\n new LineParser(SUMMARY_REGEX, (result, [changes, , insertions, , deletions]) => {\n if (insertions !== void 0 || deletions !== void 0) {\n result.summary.changes = +changes || 0;\n result.summary.insertions = +insertions || 0;\n result.summary.deletions = +deletions || 0;\n return true;\n }\n return false;\n }),\n new LineParser(ACTION_REGEX, (result, [action, file]) => {\n append(result.files, file);\n append(action === \"create\" ? result.created : result.deleted, file);\n })\n ];\n errorParsers = [\n new LineParser(/^from\\s(.+)$/i, (result, [remote]) => void (result.remote = remote)),\n new LineParser(/^fatal:\\s(.+)$/, (result, [message]) => void (result.message = message)),\n new LineParser(\n /([a-z0-9]+)\\.\\.([a-z0-9]+)\\s+(\\S+)\\s+->\\s+(\\S+)$/,\n (result, [hashLocal, hashRemote, branchLocal, branchRemote]) => {\n result.branch.local = branchLocal;\n result.hash.local = hashLocal;\n result.branch.remote = branchRemote;\n result.hash.remote = hashRemote;\n }\n )\n ];\n parsePullDetail = (stdOut, stdErr) => {\n return parseStringResponse(new PullSummary(), parsers3, [stdOut, stdErr]);\n };\n parsePullResult = (stdOut, stdErr) => {\n return Object.assign(\n new PullSummary(),\n parsePullDetail(stdOut, stdErr),\n parseRemoteMessages(stdOut, stdErr)\n );\n };\n }\n});\n\n// src/lib/parsers/parse-merge.ts\nvar parsers4, parseMergeResult, parseMergeDetail;\nvar init_parse_merge = __esm({\n \"src/lib/parsers/parse-merge.ts\"() {\n \"use strict\";\n init_MergeSummary();\n init_utils();\n init_parse_pull();\n parsers4 = [\n new LineParser(/^Auto-merging\\s+(.+)$/, (summary, [autoMerge]) => {\n summary.merges.push(autoMerge);\n }),\n new LineParser(/^CONFLICT\\s+\\((.+)\\): Merge conflict in (.+)$/, (summary, [reason, file]) => {\n summary.conflicts.push(new MergeSummaryConflict(reason, file));\n }),\n new LineParser(\n /^CONFLICT\\s+\\((.+\\/delete)\\): (.+) deleted in (.+) and/,\n (summary, [reason, file, deleteRef]) => {\n summary.conflicts.push(new MergeSummaryConflict(reason, file, { deleteRef }));\n }\n ),\n new LineParser(/^CONFLICT\\s+\\((.+)\\):/, (summary, [reason]) => {\n summary.conflicts.push(new MergeSummaryConflict(reason, null));\n }),\n new LineParser(/^Automatic merge failed;\\s+(.+)$/, (summary, [result]) => {\n summary.result = result;\n })\n ];\n parseMergeResult = (stdOut, stdErr) => {\n return Object.assign(parseMergeDetail(stdOut, stdErr), parsePullResult(stdOut, stdErr));\n };\n parseMergeDetail = (stdOut) => {\n return parseStringResponse(new MergeSummaryDetail(), parsers4, stdOut);\n };\n }\n});\n\n// src/lib/tasks/merge.ts\nfunction mergeTask(customArgs) {\n if (!customArgs.length) {\n return configurationErrorTask(\"Git.merge requires at least one option\");\n }\n return {\n commands: [\"merge\", ...customArgs],\n format: \"utf-8\",\n parser(stdOut, stdErr) {\n const merge = parseMergeResult(stdOut, stdErr);\n if (merge.failed) {\n throw new GitResponseError(merge);\n }\n return merge;\n }\n };\n}\nvar init_merge = __esm({\n \"src/lib/tasks/merge.ts\"() {\n \"use strict\";\n init_git_response_error();\n init_parse_merge();\n init_task();\n }\n});\n\n// src/lib/parsers/parse-push.ts\nfunction pushResultPushedItem(local, remote, status) {\n const deleted = status.includes(\"deleted\");\n const tag = status.includes(\"tag\") || /^refs\\/tags/.test(local);\n const alreadyUpdated = !status.includes(\"new\");\n return {\n deleted,\n tag,\n branch: !tag,\n new: !alreadyUpdated,\n alreadyUpdated,\n local,\n remote\n };\n}\nvar parsers5, parsePushResult, parsePushDetail;\nvar init_parse_push = __esm({\n \"src/lib/parsers/parse-push.ts\"() {\n \"use strict\";\n init_utils();\n init_parse_remote_messages();\n parsers5 = [\n new LineParser(/^Pushing to (.+)$/, (result, [repo]) => {\n result.repo = repo;\n }),\n new LineParser(/^updating local tracking ref '(.+)'/, (result, [local]) => {\n result.ref = {\n ...result.ref || {},\n local\n };\n }),\n new LineParser(/^[=*-]\\s+([^:]+):(\\S+)\\s+\\[(.+)]$/, (result, [local, remote, type]) => {\n result.pushed.push(pushResultPushedItem(local, remote, type));\n }),\n new LineParser(\n /^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,\n (result, [local, remote, remoteName]) => {\n result.branch = {\n ...result.branch || {},\n local,\n remote,\n remoteName\n };\n }\n ),\n new LineParser(\n /^([^:]+):(\\S+)\\s+([a-z0-9]+)\\.\\.([a-z0-9]+)$/,\n (result, [local, remote, from, to]) => {\n result.update = {\n head: {\n local,\n remote\n },\n hash: {\n from,\n to\n }\n };\n }\n )\n ];\n parsePushResult = (stdOut, stdErr) => {\n const pushDetail = parsePushDetail(stdOut, stdErr);\n const responseDetail = parseRemoteMessages(stdOut, stdErr);\n return {\n ...pushDetail,\n ...responseDetail\n };\n };\n parsePushDetail = (stdOut, stdErr) => {\n return parseStringResponse({ pushed: [] }, parsers5, [stdOut, stdErr]);\n };\n }\n});\n\n// src/lib/tasks/push.ts\nvar push_exports = {};\n__export(push_exports, {\n pushTagsTask: () => pushTagsTask,\n pushTask: () => pushTask\n});\nfunction pushTagsTask(ref = {}, customArgs) {\n append(customArgs, \"--tags\");\n return pushTask(ref, customArgs);\n}\nfunction pushTask(ref = {}, customArgs) {\n const commands = [\"push\", ...customArgs];\n if (ref.branch) {\n commands.splice(1, 0, ref.branch);\n }\n if (ref.remote) {\n commands.splice(1, 0, ref.remote);\n }\n remove(commands, \"-v\");\n append(commands, \"--verbose\");\n append(commands, \"--porcelain\");\n return {\n commands,\n format: \"utf-8\",\n parser: parsePushResult\n };\n}\nvar init_push = __esm({\n \"src/lib/tasks/push.ts\"() {\n \"use strict\";\n init_parse_push();\n init_utils();\n }\n});\n\n// src/lib/tasks/show.ts\nfunction show_default() {\n return {\n showBuffer() {\n const commands = [\"show\", ...getTrailingOptions(arguments, 1)];\n if (!commands.includes(\"--binary\")) {\n commands.splice(1, 0, \"--binary\");\n }\n return this._runTask(\n straightThroughBufferTask(commands),\n trailingFunctionArgument(arguments)\n );\n },\n show() {\n const commands = [\"show\", ...getTrailingOptions(arguments, 1)];\n return this._runTask(\n straightThroughStringTask(commands),\n trailingFunctionArgument(arguments)\n );\n }\n };\n}\nvar init_show = __esm({\n \"src/lib/tasks/show.ts\"() {\n \"use strict\";\n init_utils();\n init_task();\n }\n});\n\n// src/lib/responses/FileStatusSummary.ts\nvar fromPathRegex, FileStatusSummary;\nvar init_FileStatusSummary = __esm({\n \"src/lib/responses/FileStatusSummary.ts\"() {\n \"use strict\";\n fromPathRegex = /^(.+)\\0(.+)$/;\n FileStatusSummary = class {\n constructor(path, index, working_dir) {\n this.path = path;\n this.index = index;\n this.working_dir = working_dir;\n if (index === \"R\" || working_dir === \"R\") {\n const detail = fromPathRegex.exec(path) || [null, path, path];\n this.from = detail[2] || \"\";\n this.path = detail[1] || \"\";\n }\n }\n };\n }\n});\n\n// src/lib/responses/StatusSummary.ts\nfunction renamedFile(line) {\n const [to, from] = line.split(NULL);\n return {\n from: from || to,\n to\n };\n}\nfunction parser3(indexX, indexY, handler) {\n return [`${indexX}${indexY}`, handler];\n}\nfunction conflicts(indexX, ...indexY) {\n return indexY.map((y) => parser3(indexX, y, (result, file) => result.conflicted.push(file)));\n}\nfunction splitLine(result, lineStr) {\n const trimmed2 = lineStr.trim();\n switch (\" \") {\n case trimmed2.charAt(2):\n return data(trimmed2.charAt(0), trimmed2.charAt(1), trimmed2.slice(3));\n case trimmed2.charAt(1):\n return data(\" \" /* NONE */, trimmed2.charAt(0), trimmed2.slice(2));\n default:\n return;\n }\n function data(index, workingDir, path) {\n const raw = `${index}${workingDir}`;\n const handler = parsers6.get(raw);\n if (handler) {\n handler(result, path);\n }\n if (raw !== \"##\" && raw !== \"!!\") {\n result.files.push(new FileStatusSummary(path, index, workingDir));\n }\n }\n}\nvar StatusSummary, parsers6, parseStatusSummary;\nvar init_StatusSummary = __esm({\n \"src/lib/responses/StatusSummary.ts\"() {\n \"use strict\";\n init_utils();\n init_FileStatusSummary();\n StatusSummary = class {\n constructor() {\n this.not_added = [];\n this.conflicted = [];\n this.created = [];\n this.deleted = [];\n this.ignored = void 0;\n this.modified = [];\n this.renamed = [];\n this.files = [];\n this.staged = [];\n this.ahead = 0;\n this.behind = 0;\n this.current = null;\n this.tracking = null;\n this.detached = false;\n this.isClean = () => {\n return !this.files.length;\n };\n }\n };\n parsers6 = new Map([\n parser3(\n \" \" /* NONE */,\n \"A\" /* ADDED */,\n (result, file) => result.created.push(file)\n ),\n parser3(\n \" \" /* NONE */,\n \"D\" /* DELETED */,\n (result, file) => result.deleted.push(file)\n ),\n parser3(\n \" \" /* NONE */,\n \"M\" /* MODIFIED */,\n (result, file) => result.modified.push(file)\n ),\n parser3(\"A\" /* ADDED */, \" \" /* NONE */, (result, file) => {\n result.created.push(file);\n result.staged.push(file);\n }),\n parser3(\"A\" /* ADDED */, \"M\" /* MODIFIED */, (result, file) => {\n result.created.push(file);\n result.staged.push(file);\n result.modified.push(file);\n }),\n parser3(\"D\" /* DELETED */, \" \" /* NONE */, (result, file) => {\n result.deleted.push(file);\n result.staged.push(file);\n }),\n parser3(\"M\" /* MODIFIED */, \" \" /* NONE */, (result, file) => {\n result.modified.push(file);\n result.staged.push(file);\n }),\n parser3(\"M\" /* MODIFIED */, \"M\" /* MODIFIED */, (result, file) => {\n result.modified.push(file);\n result.staged.push(file);\n }),\n parser3(\"R\" /* RENAMED */, \" \" /* NONE */, (result, file) => {\n result.renamed.push(renamedFile(file));\n }),\n parser3(\"R\" /* RENAMED */, \"M\" /* MODIFIED */, (result, file) => {\n const renamed = renamedFile(file);\n result.renamed.push(renamed);\n result.modified.push(renamed.to);\n }),\n parser3(\"!\" /* IGNORED */, \"!\" /* IGNORED */, (_result, _file) => {\n (_result.ignored = _result.ignored || []).push(_file);\n }),\n parser3(\n \"?\" /* UNTRACKED */,\n \"?\" /* UNTRACKED */,\n (result, file) => result.not_added.push(file)\n ),\n ...conflicts(\"A\" /* ADDED */, \"A\" /* ADDED */, \"U\" /* UNMERGED */),\n ...conflicts(\n \"D\" /* DELETED */,\n \"D\" /* DELETED */,\n \"U\" /* UNMERGED */\n ),\n ...conflicts(\n \"U\" /* UNMERGED */,\n \"A\" /* ADDED */,\n \"D\" /* DELETED */,\n \"U\" /* UNMERGED */\n ),\n [\n \"##\",\n (result, line) => {\n const aheadReg = /ahead (\\d+)/;\n const behindReg = /behind (\\d+)/;\n const currentReg = /^(.+?(?=(?:\\.{3}|\\s|$)))/;\n const trackingReg = /\\.{3}(\\S*)/;\n const onEmptyBranchReg = /\\son\\s(\\S+?)(?=\\.{3}|$)/;\n let regexResult = aheadReg.exec(line);\n result.ahead = regexResult && +regexResult[1] || 0;\n regexResult = behindReg.exec(line);\n result.behind = regexResult && +regexResult[1] || 0;\n regexResult = currentReg.exec(line);\n result.current = filterType(regexResult?.[1], filterString, null);\n regexResult = trackingReg.exec(line);\n result.tracking = filterType(regexResult?.[1], filterString, null);\n regexResult = onEmptyBranchReg.exec(line);\n if (regexResult) {\n result.current = filterType(regexResult?.[1], filterString, result.current);\n }\n result.detached = /\\(no branch\\)/.test(line);\n }\n ]\n ]);\n parseStatusSummary = function(text) {\n const lines = text.split(NULL);\n const status = new StatusSummary();\n for (let i = 0, l = lines.length; i < l; ) {\n let line = lines[i++].trim();\n if (!line) {\n continue;\n }\n if (line.charAt(0) === \"R\" /* RENAMED */) {\n line += NULL + (lines[i++] || \"\");\n }\n splitLine(status, line);\n }\n return status;\n };\n }\n});\n\n// src/lib/tasks/status.ts\nfunction statusTask(customArgs) {\n const commands = [\n \"status\",\n \"--porcelain\",\n \"-b\",\n \"-u\",\n \"--null\",\n ...customArgs.filter((arg) => !ignoredOptions.includes(arg))\n ];\n return {\n format: \"utf-8\",\n commands,\n parser(text) {\n return parseStatusSummary(text);\n }\n };\n}\nvar ignoredOptions;\nvar init_status = __esm({\n \"src/lib/tasks/status.ts\"() {\n \"use strict\";\n init_StatusSummary();\n ignoredOptions = [\"--null\", \"-z\"];\n }\n});\n\n// src/lib/tasks/version.ts\nfunction versionResponse(major = 0, minor = 0, patch = 0, agent = \"\", installed = true) {\n return Object.defineProperty(\n {\n major,\n minor,\n patch,\n agent,\n installed\n },\n \"toString\",\n {\n value() {\n return `${this.major}.${this.minor}.${this.patch}`;\n },\n configurable: false,\n enumerable: false\n }\n );\n}\nfunction notInstalledResponse() {\n return versionResponse(0, 0, 0, \"\", false);\n}\nfunction version_default() {\n return {\n version() {\n return this._runTask({\n commands: [\"--version\"],\n format: \"utf-8\",\n parser: versionParser,\n onError(result, error, done, fail) {\n if (result.exitCode === -2 /* NOT_FOUND */) {\n return done(Buffer.from(NOT_INSTALLED));\n }\n fail(error);\n }\n });\n }\n };\n}\nfunction versionParser(stdOut) {\n if (stdOut === NOT_INSTALLED) {\n return notInstalledResponse();\n }\n return parseStringResponse(versionResponse(0, 0, 0, stdOut), parsers7, stdOut);\n}\nvar NOT_INSTALLED, parsers7;\nvar init_version = __esm({\n \"src/lib/tasks/version.ts\"() {\n \"use strict\";\n init_utils();\n NOT_INSTALLED = \"installed=false\";\n parsers7 = [\n new LineParser(\n /version (\\d+)\\.(\\d+)\\.(\\d+)(?:\\s*\\((.+)\\))?/,\n (result, [major, minor, patch, agent = \"\"]) => {\n Object.assign(\n result,\n versionResponse(asNumber(major), asNumber(minor), asNumber(patch), agent)\n );\n }\n ),\n new LineParser(\n /version (\\d+)\\.(\\d+)\\.(\\D+)(.+)?$/,\n (result, [major, minor, patch, agent = \"\"]) => {\n Object.assign(result, versionResponse(asNumber(major), asNumber(minor), patch, agent));\n }\n )\n ];\n }\n});\n\n// src/lib/tasks/clone.ts\nimport { pathspec as pathspec3 } from \"@simple-git/args-pathspec\";\nfunction createCloneTask(api, task, repoPath, ...args) {\n if (!filterString(repoPath)) {\n return configurationErrorTask(`git.${api}() requires a string 'repoPath'`);\n }\n return task(repoPath, filterType(args[0], filterString), getTrailingOptions(arguments));\n}\nfunction clone_default() {\n return {\n clone(repo, ...rest) {\n return this._runTask(\n createCloneTask(\"clone\", cloneTask, filterType(repo, filterString), ...rest),\n trailingFunctionArgument(arguments)\n );\n },\n mirror(repo, ...rest) {\n return this._runTask(\n createCloneTask(\"mirror\", cloneMirrorTask, filterType(repo, filterString), ...rest),\n trailingFunctionArgument(arguments)\n );\n }\n };\n}\nvar cloneTask, cloneMirrorTask;\nvar init_clone = __esm({\n \"src/lib/tasks/clone.ts\"() {\n \"use strict\";\n init_task();\n init_utils();\n cloneTask = (repo, directory, customArgs) => {\n const commands = [\"clone\", ...customArgs];\n filterString(repo) && commands.push(pathspec3(repo));\n filterString(directory) && commands.push(pathspec3(directory));\n return straightThroughStringTask(commands);\n };\n cloneMirrorTask = (repo, directory, customArgs) => {\n append(customArgs, \"--mirror\");\n return cloneTask(repo, directory, customArgs);\n };\n }\n});\n\n// src/lib/simple-git-api.ts\nvar simple_git_api_exports = {};\n__export(simple_git_api_exports, {\n SimpleGitApi: () => SimpleGitApi\n});\nvar SimpleGitApi;\nvar init_simple_git_api = __esm({\n \"src/lib/simple-git-api.ts\"() {\n \"use strict\";\n init_task_callback();\n init_change_working_directory();\n init_checkout();\n init_count_objects();\n init_commit();\n init_config();\n init_first_commit();\n init_grep();\n init_hash_object();\n init_init();\n init_log();\n init_merge();\n init_push();\n init_show();\n init_status();\n init_task();\n init_version();\n init_utils();\n init_clone();\n SimpleGitApi = class {\n constructor(_executor) {\n this._executor = _executor;\n }\n _runTask(task, then) {\n const chain = this._executor.chain();\n const promise = chain.push(task);\n if (then) {\n taskCallback(task, promise, then);\n }\n return Object.create(this, {\n then: { value: promise.then.bind(promise) },\n catch: { value: promise.catch.bind(promise) },\n _executor: { value: chain }\n });\n }\n add(files) {\n return this._runTask(\n straightThroughStringTask([\"add\", ...asArray(files)]),\n trailingFunctionArgument(arguments)\n );\n }\n cwd(directory) {\n const next = trailingFunctionArgument(arguments);\n if (typeof directory === \"string\") {\n return this._runTask(changeWorkingDirectoryTask(directory, this._executor), next);\n }\n if (typeof directory?.path === \"string\") {\n return this._runTask(\n changeWorkingDirectoryTask(\n directory.path,\n directory.root && this._executor || void 0\n ),\n next\n );\n }\n return this._runTask(\n configurationErrorTask(\"Git.cwd: workingDirectory must be supplied as a string\"),\n next\n );\n }\n hashObject(path, write) {\n return this._runTask(\n hashObjectTask(path, write === true),\n trailingFunctionArgument(arguments)\n );\n }\n init(bare) {\n return this._runTask(\n initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments)\n );\n }\n merge() {\n return this._runTask(\n mergeTask(getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments)\n );\n }\n mergeFromTo(remote, branch) {\n if (!(filterString(remote) && filterString(branch))) {\n return this._runTask(\n configurationErrorTask(\n `Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`\n )\n );\n }\n return this._runTask(\n mergeTask([remote, branch, ...getTrailingOptions(arguments)]),\n trailingFunctionArgument(arguments, false)\n );\n }\n outputHandler(handler) {\n this._executor.outputHandler = handler;\n return this;\n }\n push() {\n const task = pushTask(\n {\n remote: filterType(arguments[0], filterString),\n branch: filterType(arguments[1], filterString)\n },\n getTrailingOptions(arguments)\n );\n return this._runTask(task, trailingFunctionArgument(arguments));\n }\n stash() {\n return this._runTask(\n straightThroughStringTask([\"stash\", ...getTrailingOptions(arguments)]),\n trailingFunctionArgument(arguments)\n );\n }\n status() {\n return this._runTask(\n statusTask(getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments)\n );\n }\n };\n Object.assign(\n SimpleGitApi.prototype,\n checkout_default(),\n clone_default(),\n commit_default(),\n config_default(),\n count_objects_default(),\n first_commit_default(),\n grep_default(),\n log_default(),\n show_default(),\n version_default()\n );\n }\n});\n\n// src/lib/runners/scheduler.ts\nvar scheduler_exports = {};\n__export(scheduler_exports, {\n Scheduler: () => Scheduler\n});\nimport { createDeferred } from \"@kwsites/promise-deferred\";\nvar createScheduledTask, Scheduler;\nvar init_scheduler = __esm({\n \"src/lib/runners/scheduler.ts\"() {\n \"use strict\";\n init_utils();\n init_git_logger();\n createScheduledTask = /* @__PURE__ */ (() => {\n let id = 0;\n return () => {\n id++;\n const { promise, done } = createDeferred();\n return {\n promise,\n done,\n id\n };\n };\n })();\n Scheduler = class {\n constructor(concurrency = 2) {\n this.concurrency = concurrency;\n this.logger = createLogger(\"\", \"scheduler\");\n this.pending = [];\n this.running = [];\n this.logger(`Constructed, concurrency=%s`, concurrency);\n }\n schedule() {\n if (!this.pending.length || this.running.length >= this.concurrency) {\n this.logger(\n `Schedule attempt ignored, pending=%s running=%s concurrency=%s`,\n this.pending.length,\n this.running.length,\n this.concurrency\n );\n return;\n }\n const task = append(this.running, this.pending.shift());\n this.logger(`Attempting id=%s`, task.id);\n task.done(() => {\n this.logger(`Completing id=`, task.id);\n remove(this.running, task);\n this.schedule();\n });\n }\n next() {\n const { promise, id } = append(this.pending, createScheduledTask());\n this.logger(`Scheduling id=%s`, id);\n this.schedule();\n return promise;\n }\n };\n }\n});\n\n// src/lib/tasks/apply-patch.ts\nvar apply_patch_exports = {};\n__export(apply_patch_exports, {\n applyPatchTask: () => applyPatchTask\n});\nfunction applyPatchTask(patches, customArgs) {\n return straightThroughStringTask([\"apply\", ...customArgs, ...patches]);\n}\nvar init_apply_patch = __esm({\n \"src/lib/tasks/apply-patch.ts\"() {\n \"use strict\";\n init_task();\n }\n});\n\n// src/lib/responses/BranchDeleteSummary.ts\nfunction branchDeletionSuccess(branch, hash) {\n return {\n branch,\n hash,\n success: true\n };\n}\nfunction branchDeletionFailure(branch) {\n return {\n branch,\n hash: null,\n success: false\n };\n}\nvar BranchDeletionBatch;\nvar init_BranchDeleteSummary = __esm({\n \"src/lib/responses/BranchDeleteSummary.ts\"() {\n \"use strict\";\n BranchDeletionBatch = class {\n constructor() {\n this.all = [];\n this.branches = {};\n this.errors = [];\n }\n get success() {\n return !this.errors.length;\n }\n };\n }\n});\n\n// src/lib/parsers/parse-branch-delete.ts\nfunction hasBranchDeletionError(data, processExitCode) {\n return processExitCode === 1 /* ERROR */ && deleteErrorRegex.test(data);\n}\nvar deleteSuccessRegex, deleteErrorRegex, parsers8, parseBranchDeletions;\nvar init_parse_branch_delete = __esm({\n \"src/lib/parsers/parse-branch-delete.ts\"() {\n \"use strict\";\n init_BranchDeleteSummary();\n init_utils();\n deleteSuccessRegex = /(\\S+)\\s+\\(\\S+\\s([^)]+)\\)/;\n deleteErrorRegex = /^error[^']+'([^']+)'/m;\n parsers8 = [\n new LineParser(deleteSuccessRegex, (result, [branch, hash]) => {\n const deletion = branchDeletionSuccess(branch, hash);\n result.all.push(deletion);\n result.branches[branch] = deletion;\n }),\n new LineParser(deleteErrorRegex, (result, [branch]) => {\n const deletion = branchDeletionFailure(branch);\n result.errors.push(deletion);\n result.all.push(deletion);\n result.branches[branch] = deletion;\n })\n ];\n parseBranchDeletions = (stdOut, stdErr) => {\n return parseStringResponse(new BranchDeletionBatch(), parsers8, [stdOut, stdErr]);\n };\n }\n});\n\n// src/lib/responses/BranchSummary.ts\nvar BranchSummaryResult;\nvar init_BranchSummary = __esm({\n \"src/lib/responses/BranchSummary.ts\"() {\n \"use strict\";\n BranchSummaryResult = class {\n constructor() {\n this.all = [];\n this.branches = {};\n this.current = \"\";\n this.detached = false;\n }\n push(status, detached, name, commit, label) {\n if (status === \"*\" /* CURRENT */) {\n this.detached = detached;\n this.current = name;\n }\n this.all.push(name);\n this.branches[name] = {\n current: status === \"*\" /* CURRENT */,\n linkedWorkTree: status === \"+\" /* LINKED */,\n name,\n commit,\n label\n };\n }\n };\n }\n});\n\n// src/lib/parsers/parse-branch.ts\nfunction branchStatus(input) {\n return input ? input.charAt(0) : \"\";\n}\nfunction parseBranchSummary(stdOut, currentOnly = false) {\n return parseStringResponse(\n new BranchSummaryResult(),\n currentOnly ? [currentBranchParser] : parsers9,\n stdOut\n );\n}\nvar parsers9, currentBranchParser;\nvar init_parse_branch = __esm({\n \"src/lib/parsers/parse-branch.ts\"() {\n \"use strict\";\n init_BranchSummary();\n init_utils();\n parsers9 = [\n new LineParser(\n /^([*+]\\s)?\\((?:HEAD )?detached (?:from|at) (\\S+)\\)\\s+([a-z0-9]+)\\s(.*)$/,\n (result, [current, name, commit, label]) => {\n result.push(branchStatus(current), true, name, commit, label);\n }\n ),\n new LineParser(\n /^([*+]\\s)?(\\S+)\\s+([a-z0-9]+)\\s?(.*)$/s,\n (result, [current, name, commit, label]) => {\n result.push(branchStatus(current), false, name, commit, label);\n }\n )\n ];\n currentBranchParser = new LineParser(/^(\\S+)$/s, (result, [name]) => {\n result.push(\"*\" /* CURRENT */, false, name, \"\", \"\");\n });\n }\n});\n\n// src/lib/tasks/branch.ts\nvar branch_exports = {};\n__export(branch_exports, {\n branchLocalTask: () => branchLocalTask,\n branchTask: () => branchTask,\n containsDeleteBranchCommand: () => containsDeleteBranchCommand,\n deleteBranchTask: () => deleteBranchTask,\n deleteBranchesTask: () => deleteBranchesTask\n});\nfunction containsDeleteBranchCommand(commands) {\n const deleteCommands = [\"-d\", \"-D\", \"--delete\"];\n return commands.some((command) => deleteCommands.includes(command));\n}\nfunction branchTask(customArgs) {\n const isDelete = containsDeleteBranchCommand(customArgs);\n const isCurrentOnly = customArgs.includes(\"--show-current\");\n const commands = [\"branch\", ...customArgs];\n if (commands.length === 1) {\n commands.push(\"-a\");\n }\n if (!commands.includes(\"-v\")) {\n commands.splice(1, 0, \"-v\");\n }\n return {\n format: \"utf-8\",\n commands,\n parser(stdOut, stdErr) {\n if (isDelete) {\n return parseBranchDeletions(stdOut, stdErr).all[0];\n }\n return parseBranchSummary(stdOut, isCurrentOnly);\n }\n };\n}\nfunction branchLocalTask() {\n return {\n format: \"utf-8\",\n commands: [\"branch\", \"-v\"],\n parser(stdOut) {\n return parseBranchSummary(stdOut);\n }\n };\n}\nfunction deleteBranchesTask(branches, forceDelete = false) {\n return {\n format: \"utf-8\",\n commands: [\"branch\", \"-v\", forceDelete ? \"-D\" : \"-d\", ...branches],\n parser(stdOut, stdErr) {\n return parseBranchDeletions(stdOut, stdErr);\n },\n onError({ exitCode, stdOut }, error, done, fail) {\n if (!hasBranchDeletionError(String(error), exitCode)) {\n return fail(error);\n }\n done(stdOut);\n }\n };\n}\nfunction deleteBranchTask(branch, forceDelete = false) {\n const task = {\n format: \"utf-8\",\n commands: [\"branch\", \"-v\", forceDelete ? \"-D\" : \"-d\", branch],\n parser(stdOut, stdErr) {\n return parseBranchDeletions(stdOut, stdErr).branches[branch];\n },\n onError({ exitCode, stdErr, stdOut }, error, _, fail) {\n if (!hasBranchDeletionError(String(error), exitCode)) {\n return fail(error);\n }\n throw new GitResponseError(\n task.parser(bufferToString(stdOut), bufferToString(stdErr)),\n String(error)\n );\n }\n };\n return task;\n}\nvar init_branch = __esm({\n \"src/lib/tasks/branch.ts\"() {\n \"use strict\";\n init_git_response_error();\n init_parse_branch_delete();\n init_parse_branch();\n init_utils();\n }\n});\n\n// src/lib/responses/CheckIgnore.ts\nimport { normalize } from \"node:path\";\nfunction toPath(input) {\n const path = input.trim().replace(/^[\"']|[\"']$/g, \"\");\n return path && normalize(path);\n}\nvar parseCheckIgnore;\nvar init_CheckIgnore = __esm({\n \"src/lib/responses/CheckIgnore.ts\"() {\n \"use strict\";\n parseCheckIgnore = (text) => {\n return text.split(/\\n/g).map(toPath).filter(Boolean);\n };\n }\n});\n\n// src/lib/tasks/check-ignore.ts\nvar check_ignore_exports = {};\n__export(check_ignore_exports, {\n checkIgnoreTask: () => checkIgnoreTask\n});\nfunction checkIgnoreTask(paths) {\n return {\n commands: [\"check-ignore\", ...paths],\n format: \"utf-8\",\n parser: parseCheckIgnore\n };\n}\nvar init_check_ignore = __esm({\n \"src/lib/tasks/check-ignore.ts\"() {\n \"use strict\";\n init_CheckIgnore();\n }\n});\n\n// src/lib/parsers/parse-fetch.ts\nfunction parseFetchResult(stdOut, stdErr) {\n const result = {\n raw: stdOut,\n remote: null,\n branches: [],\n tags: [],\n updated: [],\n deleted: []\n };\n return parseStringResponse(result, parsers10, [stdOut, stdErr]);\n}\nvar parsers10;\nvar init_parse_fetch = __esm({\n \"src/lib/parsers/parse-fetch.ts\"() {\n \"use strict\";\n init_utils();\n parsers10 = [\n new LineParser(/From (.+)$/, (result, [remote]) => {\n result.remote = remote;\n }),\n new LineParser(/\\* \\[new branch]\\s+(\\S+)\\s*-> (.+)$/, (result, [name, tracking]) => {\n result.branches.push({\n name,\n tracking\n });\n }),\n new LineParser(/\\* \\[new tag]\\s+(\\S+)\\s*-> (.+)$/, (result, [name, tracking]) => {\n result.tags.push({\n name,\n tracking\n });\n }),\n new LineParser(/- \\[deleted]\\s+\\S+\\s*-> (.+)$/, (result, [tracking]) => {\n result.deleted.push({\n tracking\n });\n }),\n new LineParser(\n /\\s*([^.]+)\\.\\.(\\S+)\\s+(\\S+)\\s*-> (.+)$/,\n (result, [from, to, name, tracking]) => {\n result.updated.push({\n name,\n tracking,\n to,\n from\n });\n }\n )\n ];\n }\n});\n\n// src/lib/tasks/fetch.ts\nvar fetch_exports = {};\n__export(fetch_exports, {\n fetchTask: () => fetchTask\n});\nfunction disallowedCommand(command) {\n return /^--upload-pack(=|$)/.test(command);\n}\nfunction fetchTask(remote, branch, customArgs) {\n const commands = [\"fetch\", ...customArgs];\n if (remote && branch) {\n commands.push(remote, branch);\n }\n const banned = commands.find(disallowedCommand);\n if (banned) {\n return configurationErrorTask(`git.fetch: potential exploit argument blocked.`);\n }\n return {\n commands,\n format: \"utf-8\",\n parser: parseFetchResult\n };\n}\nvar init_fetch = __esm({\n \"src/lib/tasks/fetch.ts\"() {\n \"use strict\";\n init_parse_fetch();\n init_task();\n }\n});\n\n// src/lib/parsers/parse-move.ts\nfunction parseMoveResult(stdOut) {\n return parseStringResponse({ moves: [] }, parsers11, stdOut);\n}\nvar parsers11;\nvar init_parse_move = __esm({\n \"src/lib/parsers/parse-move.ts\"() {\n \"use strict\";\n init_utils();\n parsers11 = [\n new LineParser(/^Renaming (.+) to (.+)$/, (result, [from, to]) => {\n result.moves.push({ from, to });\n })\n ];\n }\n});\n\n// src/lib/tasks/move.ts\nvar move_exports = {};\n__export(move_exports, {\n moveTask: () => moveTask\n});\nfunction moveTask(from, to) {\n return {\n commands: [\"mv\", \"-v\", ...asArray(from), to],\n format: \"utf-8\",\n parser: parseMoveResult\n };\n}\nvar init_move = __esm({\n \"src/lib/tasks/move.ts\"() {\n \"use strict\";\n init_parse_move();\n init_utils();\n }\n});\n\n// src/lib/tasks/pull.ts\nvar pull_exports = {};\n__export(pull_exports, {\n pullTask: () => pullTask\n});\nfunction pullTask(remote, branch, customArgs) {\n const commands = [\"pull\", ...customArgs];\n if (remote && branch) {\n commands.splice(1, 0, remote, branch);\n }\n return {\n commands,\n format: \"utf-8\",\n parser(stdOut, stdErr) {\n return parsePullResult(stdOut, stdErr);\n },\n onError(result, _error, _done, fail) {\n const pullError = parsePullErrorResult(\n bufferToString(result.stdOut),\n bufferToString(result.stdErr)\n );\n if (pullError) {\n return fail(new GitResponseError(pullError));\n }\n fail(_error);\n }\n };\n}\nvar init_pull = __esm({\n \"src/lib/tasks/pull.ts\"() {\n \"use strict\";\n init_git_response_error();\n init_parse_pull();\n init_utils();\n }\n});\n\n// src/lib/responses/GetRemoteSummary.ts\nfunction parseGetRemotes(text) {\n const remotes = {};\n forEach(text, ([name]) => remotes[name] = { name });\n return Object.values(remotes);\n}\nfunction parseGetRemotesVerbose(text) {\n const remotes = {};\n forEach(text, ([name, url, purpose]) => {\n if (!Object.hasOwn(remotes, name)) {\n remotes[name] = {\n name,\n refs: { fetch: \"\", push: \"\" }\n };\n }\n if (purpose && url) {\n remotes[name].refs[purpose.replace(/[^a-z]/g, \"\")] = url;\n }\n });\n return Object.values(remotes);\n}\nfunction forEach(text, handler) {\n forEachLineWithContent(text, (line) => handler(line.split(/\\s+/)));\n}\nvar init_GetRemoteSummary = __esm({\n \"src/lib/responses/GetRemoteSummary.ts\"() {\n \"use strict\";\n init_utils();\n }\n});\n\n// src/lib/tasks/remote.ts\nvar remote_exports = {};\n__export(remote_exports, {\n addRemoteTask: () => addRemoteTask,\n getRemotesTask: () => getRemotesTask,\n listRemotesTask: () => listRemotesTask,\n remoteTask: () => remoteTask,\n removeRemoteTask: () => removeRemoteTask\n});\nfunction addRemoteTask(remoteName, remoteRepo, customArgs) {\n return straightThroughStringTask([\"remote\", \"add\", ...customArgs, remoteName, remoteRepo]);\n}\nfunction getRemotesTask(verbose) {\n const commands = [\"remote\"];\n if (verbose) {\n commands.push(\"-v\");\n }\n return {\n commands,\n format: \"utf-8\",\n parser: verbose ? parseGetRemotesVerbose : parseGetRemotes\n };\n}\nfunction listRemotesTask(customArgs) {\n const commands = [...customArgs];\n if (commands[0] !== \"ls-remote\") {\n commands.unshift(\"ls-remote\");\n }\n return straightThroughStringTask(commands);\n}\nfunction remoteTask(customArgs) {\n const commands = [...customArgs];\n if (commands[0] !== \"remote\") {\n commands.unshift(\"remote\");\n }\n return straightThroughStringTask(commands);\n}\nfunction removeRemoteTask(remoteName) {\n return straightThroughStringTask([\"remote\", \"remove\", remoteName]);\n}\nvar init_remote = __esm({\n \"src/lib/tasks/remote.ts\"() {\n \"use strict\";\n init_GetRemoteSummary();\n init_task();\n }\n});\n\n// src/lib/tasks/stash-list.ts\nvar stash_list_exports = {};\n__export(stash_list_exports, {\n stashListTask: () => stashListTask\n});\nfunction stashListTask(opt = {}, customArgs) {\n const options = parseLogOptions(opt);\n const commands = [\"stash\", \"list\", ...options.commands, ...customArgs];\n const parser4 = createListLogSummaryParser(\n options.splitter,\n options.fields,\n logFormatFromCommand(commands)\n );\n return validateLogFormatConfig(commands) || {\n commands,\n format: \"utf-8\",\n parser: parser4\n };\n}\nvar init_stash_list = __esm({\n \"src/lib/tasks/stash-list.ts\"() {\n \"use strict\";\n init_log_format();\n init_parse_list_log_summary();\n init_diff();\n init_log();\n }\n});\n\n// src/lib/tasks/sub-module.ts\nvar sub_module_exports = {};\n__export(sub_module_exports, {\n addSubModuleTask: () => addSubModuleTask,\n initSubModuleTask: () => initSubModuleTask,\n subModuleTask: () => subModuleTask,\n updateSubModuleTask: () => updateSubModuleTask\n});\nfunction addSubModuleTask(repo, path) {\n return subModuleTask([\"add\", repo, path]);\n}\nfunction initSubModuleTask(customArgs) {\n return subModuleTask([\"init\", ...customArgs]);\n}\nfunction subModuleTask(customArgs) {\n const commands = [...customArgs];\n if (commands[0] !== \"submodule\") {\n commands.unshift(\"submodule\");\n }\n return straightThroughStringTask(commands);\n}\nfunction updateSubModuleTask(customArgs) {\n return subModuleTask([\"update\", ...customArgs]);\n}\nvar init_sub_module = __esm({\n \"src/lib/tasks/sub-module.ts\"() {\n \"use strict\";\n init_task();\n }\n});\n\n// src/lib/responses/TagList.ts\nfunction singleSorted(a, b) {\n const aIsNum = Number.isNaN(a);\n const bIsNum = Number.isNaN(b);\n if (aIsNum !== bIsNum) {\n return aIsNum ? 1 : -1;\n }\n return aIsNum ? sorted(a, b) : 0;\n}\nfunction sorted(a, b) {\n return a === b ? 0 : a > b ? 1 : -1;\n}\nfunction trimmed(input) {\n return input.trim();\n}\nfunction toNumber(input) {\n if (typeof input === \"string\") {\n return parseInt(input.replace(/^\\D+/g, \"\"), 10) || 0;\n }\n return 0;\n}\nvar TagList, parseTagList;\nvar init_TagList = __esm({\n \"src/lib/responses/TagList.ts\"() {\n \"use strict\";\n TagList = class {\n constructor(all, latest) {\n this.all = all;\n this.latest = latest;\n }\n };\n parseTagList = function(data, customSort = false) {\n const tags = data.split(\"\\n\").map(trimmed).filter(Boolean);\n if (!customSort) {\n tags.sort(function(tagA, tagB) {\n const partsA = tagA.split(\".\");\n const partsB = tagB.split(\".\");\n if (partsA.length === 1 || partsB.length === 1) {\n return singleSorted(toNumber(partsA[0]), toNumber(partsB[0]));\n }\n for (let i = 0, l = Math.max(partsA.length, partsB.length); i < l; i++) {\n const diff = sorted(toNumber(partsA[i]), toNumber(partsB[i]));\n if (diff) {\n return diff;\n }\n }\n return 0;\n });\n }\n const latest = customSort ? tags[0] : [...tags].reverse().find((tag) => tag.indexOf(\".\") >= 0);\n return new TagList(tags, latest);\n };\n }\n});\n\n// src/lib/tasks/tag.ts\nvar tag_exports = {};\n__export(tag_exports, {\n addAnnotatedTagTask: () => addAnnotatedTagTask,\n addTagTask: () => addTagTask,\n tagListTask: () => tagListTask\n});\nfunction tagListTask(customArgs = []) {\n const hasCustomSort = customArgs.some((option) => /^--sort=/.test(option));\n return {\n format: \"utf-8\",\n commands: [\"tag\", \"-l\", ...customArgs],\n parser(text) {\n return parseTagList(text, hasCustomSort);\n }\n };\n}\nfunction addTagTask(name) {\n return {\n format: \"utf-8\",\n commands: [\"tag\", name],\n parser() {\n return { name };\n }\n };\n}\nfunction addAnnotatedTagTask(name, tagMessage) {\n return {\n format: \"utf-8\",\n commands: [\"tag\", \"-a\", \"-m\", tagMessage, name],\n parser() {\n return { name };\n }\n };\n}\nvar init_tag = __esm({\n \"src/lib/tasks/tag.ts\"() {\n \"use strict\";\n init_TagList();\n }\n});\n\n// src/git.js\nvar require_git = __commonJS({\n \"src/git.js\"(exports, module) {\n \"use strict\";\n var { GitExecutor: GitExecutor2 } = (init_git_executor(), __toCommonJS(git_executor_exports));\n var { SimpleGitApi: SimpleGitApi2 } = (init_simple_git_api(), __toCommonJS(simple_git_api_exports));\n var { Scheduler: Scheduler2 } = (init_scheduler(), __toCommonJS(scheduler_exports));\n var { adhocExecTask: adhocExecTask2, configurationErrorTask: configurationErrorTask2 } = (init_task(), __toCommonJS(task_exports));\n var {\n asArray: asArray2,\n filterArray: filterArray2,\n filterPrimitives: filterPrimitives2,\n filterString: filterString2,\n filterStringOrStringArray: filterStringOrStringArray2,\n filterType: filterType2,\n getTrailingOptions: getTrailingOptions2,\n trailingFunctionArgument: trailingFunctionArgument2,\n trailingOptionsArgument: trailingOptionsArgument2\n } = (init_utils(), __toCommonJS(utils_exports));\n var { applyPatchTask: applyPatchTask2 } = (init_apply_patch(), __toCommonJS(apply_patch_exports));\n var {\n branchTask: branchTask2,\n branchLocalTask: branchLocalTask2,\n deleteBranchesTask: deleteBranchesTask2,\n deleteBranchTask: deleteBranchTask2\n } = (init_branch(), __toCommonJS(branch_exports));\n var { checkIgnoreTask: checkIgnoreTask2 } = (init_check_ignore(), __toCommonJS(check_ignore_exports));\n var { checkIsRepoTask: checkIsRepoTask2 } = (init_check_is_repo(), __toCommonJS(check_is_repo_exports));\n var { cleanWithOptionsTask: cleanWithOptionsTask2, isCleanOptionsArray: isCleanOptionsArray2 } = (init_clean(), __toCommonJS(clean_exports));\n var { diffSummaryTask: diffSummaryTask2 } = (init_diff(), __toCommonJS(diff_exports));\n var { fetchTask: fetchTask2 } = (init_fetch(), __toCommonJS(fetch_exports));\n var { moveTask: moveTask2 } = (init_move(), __toCommonJS(move_exports));\n var { pullTask: pullTask2 } = (init_pull(), __toCommonJS(pull_exports));\n var { pushTagsTask: pushTagsTask2 } = (init_push(), __toCommonJS(push_exports));\n var {\n addRemoteTask: addRemoteTask2,\n getRemotesTask: getRemotesTask2,\n listRemotesTask: listRemotesTask2,\n remoteTask: remoteTask2,\n removeRemoteTask: removeRemoteTask2\n } = (init_remote(), __toCommonJS(remote_exports));\n var { getResetMode: getResetMode2, resetTask: resetTask2 } = (init_reset(), __toCommonJS(reset_exports));\n var { stashListTask: stashListTask2 } = (init_stash_list(), __toCommonJS(stash_list_exports));\n var {\n addSubModuleTask: addSubModuleTask2,\n initSubModuleTask: initSubModuleTask2,\n subModuleTask: subModuleTask2,\n updateSubModuleTask: updateSubModuleTask2\n } = (init_sub_module(), __toCommonJS(sub_module_exports));\n var { addAnnotatedTagTask: addAnnotatedTagTask2, addTagTask: addTagTask2, tagListTask: tagListTask2 } = (init_tag(), __toCommonJS(tag_exports));\n var { straightThroughBufferTask: straightThroughBufferTask2, straightThroughStringTask: straightThroughStringTask2 } = (init_task(), __toCommonJS(task_exports));\n function Git2(options, plugins) {\n this._plugins = plugins;\n this._executor = new GitExecutor2(\n options.baseDir,\n new Scheduler2(options.maxConcurrentProcesses),\n plugins\n );\n this._trimmed = options.trimmed;\n }\n (Git2.prototype = Object.create(SimpleGitApi2.prototype)).constructor = Git2;\n Git2.prototype.customBinary = function(command) {\n this._plugins.reconfigure(\"binary\", command);\n return this;\n };\n Git2.prototype.env = function(name, value) {\n if (arguments.length === 1 && typeof name === \"object\") {\n this._executor.env = name;\n } else {\n (this._executor.env = this._executor.env || {})[name] = value;\n }\n return this;\n };\n Git2.prototype.stashList = function(options) {\n return this._runTask(\n stashListTask2(\n trailingOptionsArgument2(arguments) || {},\n filterArray2(options) && options || []\n ),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.mv = function(from, to) {\n return this._runTask(moveTask2(from, to), trailingFunctionArgument2(arguments));\n };\n Git2.prototype.checkoutLatestTag = function(then) {\n var git = this;\n return this.pull(function() {\n git.tags(function(err, tags) {\n git.checkout(tags.latest, then);\n });\n });\n };\n Git2.prototype.pull = function(remote, branch, options, then) {\n return this._runTask(\n pullTask2(\n filterType2(remote, filterString2),\n filterType2(branch, filterString2),\n getTrailingOptions2(arguments)\n ),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.fetch = function(remote, branch) {\n return this._runTask(\n fetchTask2(\n filterType2(remote, filterString2),\n filterType2(branch, filterString2),\n getTrailingOptions2(arguments)\n ),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.silent = function(silence) {\n return this._runTask(\n adhocExecTask2(\n () => console.warn(\n \"simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.\"\n )\n )\n );\n };\n Git2.prototype.tags = function(options, then) {\n return this._runTask(\n tagListTask2(getTrailingOptions2(arguments)),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.rebase = function() {\n return this._runTask(\n straightThroughStringTask2([\"rebase\", ...getTrailingOptions2(arguments)]),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.reset = function(mode) {\n return this._runTask(\n resetTask2(getResetMode2(mode), getTrailingOptions2(arguments)),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.revert = function(commit) {\n const next = trailingFunctionArgument2(arguments);\n if (typeof commit !== \"string\") {\n return this._runTask(configurationErrorTask2(\"Commit must be a string\"), next);\n }\n return this._runTask(\n straightThroughStringTask2([\"revert\", ...getTrailingOptions2(arguments, 0, true), commit]),\n next\n );\n };\n Git2.prototype.addTag = function(name) {\n const task = typeof name === \"string\" ? addTagTask2(name) : configurationErrorTask2(\"Git.addTag requires a tag name\");\n return this._runTask(task, trailingFunctionArgument2(arguments));\n };\n Git2.prototype.addAnnotatedTag = function(tagName, tagMessage) {\n return this._runTask(\n addAnnotatedTagTask2(tagName, tagMessage),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.deleteLocalBranch = function(branchName, forceDelete, then) {\n return this._runTask(\n deleteBranchTask2(branchName, typeof forceDelete === \"boolean\" ? forceDelete : false),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.deleteLocalBranches = function(branchNames, forceDelete, then) {\n return this._runTask(\n deleteBranchesTask2(branchNames, typeof forceDelete === \"boolean\" ? forceDelete : false),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.branch = function(options, then) {\n return this._runTask(\n branchTask2(getTrailingOptions2(arguments)),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.branchLocal = function(then) {\n return this._runTask(branchLocalTask2(), trailingFunctionArgument2(arguments));\n };\n Git2.prototype.raw = function(commands) {\n const createRestCommands = !Array.isArray(commands);\n const command = [].slice.call(createRestCommands ? arguments : commands, 0);\n for (let i = 0; i < command.length && createRestCommands; i++) {\n if (!filterPrimitives2(command[i])) {\n command.splice(i, command.length - i);\n break;\n }\n }\n command.push(...getTrailingOptions2(arguments, 0, true));\n var next = trailingFunctionArgument2(arguments);\n if (!command.length) {\n return this._runTask(\n configurationErrorTask2(\"Raw: must supply one or more command to execute\"),\n next\n );\n }\n return this._runTask(straightThroughStringTask2(command, this._trimmed), next);\n };\n Git2.prototype.submoduleAdd = function(repo, path, then) {\n return this._runTask(addSubModuleTask2(repo, path), trailingFunctionArgument2(arguments));\n };\n Git2.prototype.submoduleUpdate = function(args, then) {\n return this._runTask(\n updateSubModuleTask2(getTrailingOptions2(arguments, true)),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.submoduleInit = function(args, then) {\n return this._runTask(\n initSubModuleTask2(getTrailingOptions2(arguments, true)),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.subModule = function(options, then) {\n return this._runTask(\n subModuleTask2(getTrailingOptions2(arguments)),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.listRemote = function() {\n return this._runTask(\n listRemotesTask2(getTrailingOptions2(arguments)),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.addRemote = function(remoteName, remoteRepo, then) {\n return this._runTask(\n addRemoteTask2(remoteName, remoteRepo, getTrailingOptions2(arguments)),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.removeRemote = function(remoteName, then) {\n return this._runTask(removeRemoteTask2(remoteName), trailingFunctionArgument2(arguments));\n };\n Git2.prototype.getRemotes = function(verbose, then) {\n return this._runTask(getRemotesTask2(verbose === true), trailingFunctionArgument2(arguments));\n };\n Git2.prototype.remote = function(options, then) {\n return this._runTask(\n remoteTask2(getTrailingOptions2(arguments)),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.tag = function(options, then) {\n const command = getTrailingOptions2(arguments);\n if (command[0] !== \"tag\") {\n command.unshift(\"tag\");\n }\n return this._runTask(straightThroughStringTask2(command), trailingFunctionArgument2(arguments));\n };\n Git2.prototype.updateServerInfo = function(then) {\n return this._runTask(\n straightThroughStringTask2([\"update-server-info\"]),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.pushTags = function(remote, then) {\n const task = pushTagsTask2(\n { remote: filterType2(remote, filterString2) },\n getTrailingOptions2(arguments)\n );\n return this._runTask(task, trailingFunctionArgument2(arguments));\n };\n Git2.prototype.rm = function(files) {\n return this._runTask(\n straightThroughStringTask2([\"rm\", \"-f\", ...asArray2(files)]),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.rmKeepLocal = function(files) {\n return this._runTask(\n straightThroughStringTask2([\"rm\", \"--cached\", ...asArray2(files)]),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.catFile = function(options, then) {\n return this._catFile(\"utf-8\", arguments);\n };\n Git2.prototype.binaryCatFile = function() {\n return this._catFile(\"buffer\", arguments);\n };\n Git2.prototype._catFile = function(format, args) {\n var handler = trailingFunctionArgument2(args);\n var command = [\"cat-file\"];\n var options = args[0];\n if (typeof options === \"string\") {\n return this._runTask(\n configurationErrorTask2(\"Git.catFile: options must be supplied as an array of strings\"),\n handler\n );\n }\n if (Array.isArray(options)) {\n command.push.apply(command, options);\n }\n const task = format === \"buffer\" ? straightThroughBufferTask2(command) : straightThroughStringTask2(command);\n return this._runTask(task, handler);\n };\n Git2.prototype.diff = function(options, then) {\n const task = filterString2(options) ? configurationErrorTask2(\n \"git.diff: supplying options as a single string is no longer supported, switch to an array of strings\"\n ) : straightThroughStringTask2([\"diff\", ...getTrailingOptions2(arguments)]);\n return this._runTask(task, trailingFunctionArgument2(arguments));\n };\n Git2.prototype.diffSummary = function() {\n return this._runTask(\n diffSummaryTask2(getTrailingOptions2(arguments, 1)),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.applyPatch = function(patches) {\n const task = !filterStringOrStringArray2(patches) ? configurationErrorTask2(\n `git.applyPatch requires one or more string patches as the first argument`\n ) : applyPatchTask2(asArray2(patches), getTrailingOptions2([].slice.call(arguments, 1)));\n return this._runTask(task, trailingFunctionArgument2(arguments));\n };\n Git2.prototype.revparse = function() {\n const commands = [\"rev-parse\", ...getTrailingOptions2(arguments, true)];\n return this._runTask(\n straightThroughStringTask2(commands, true),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.clean = function(mode, options, then) {\n const usingCleanOptionsArray = isCleanOptionsArray2(mode);\n const cleanMode = usingCleanOptionsArray && mode.join(\"\") || filterType2(mode, filterString2) || \"\";\n const customArgs = getTrailingOptions2([].slice.call(arguments, usingCleanOptionsArray ? 1 : 0));\n return this._runTask(\n cleanWithOptionsTask2(cleanMode, customArgs),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.exec = function(then) {\n const task = {\n commands: [],\n format: \"utf-8\",\n parser() {\n if (typeof then === \"function\") {\n then();\n }\n }\n };\n return this._runTask(task);\n };\n Git2.prototype.clearQueue = function() {\n return this._runTask(\n adhocExecTask2(\n () => console.warn(\n \"simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.\"\n )\n )\n );\n };\n Git2.prototype.checkIgnore = function(pathnames, then) {\n return this._runTask(\n checkIgnoreTask2(asArray2(filterType2(pathnames, filterStringOrStringArray2, []))),\n trailingFunctionArgument2(arguments)\n );\n };\n Git2.prototype.checkIsRepo = function(checkType, then) {\n return this._runTask(\n checkIsRepoTask2(filterType2(checkType, filterString2)),\n trailingFunctionArgument2(arguments)\n );\n };\n module.exports = Git2;\n }\n});\n\n// src/lib/api.ts\nimport { pathspec } from \"@simple-git/args-pathspec\";\n\n// src/lib/errors/git-construct-error.ts\ninit_git_error();\nvar GitConstructError = class extends GitError {\n constructor(config, message) {\n super(void 0, message);\n this.config = config;\n }\n};\n\n// src/lib/api.ts\ninit_git_error();\n\n// src/lib/errors/git-plugin-error.ts\ninit_git_error();\nvar GitPluginError = class extends GitError {\n constructor(task, plugin, message) {\n super(task, message);\n this.task = task;\n this.plugin = plugin;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n};\n\n// src/lib/api.ts\ninit_git_response_error();\ninit_task_configuration_error();\ninit_check_is_repo();\ninit_clean();\ninit_config();\ninit_diff_name_status();\ninit_grep();\ninit_reset();\n\n// src/lib/plugins/abort-plugin.ts\nfunction abortPlugin(signal) {\n if (!signal) {\n return;\n }\n const onSpawnAfter = {\n type: \"spawn.after\",\n action(_data, context) {\n function kill() {\n context.kill(new GitPluginError(void 0, \"abort\", \"Abort signal received\"));\n }\n signal.addEventListener(\"abort\", kill);\n context.spawned.on(\"close\", () => signal.removeEventListener(\"abort\", kill));\n }\n };\n const onSpawnBefore = {\n type: \"spawn.before\",\n action(_data, context) {\n if (signal.aborted) {\n context.kill(new GitPluginError(void 0, \"abort\", \"Abort already signaled\"));\n }\n }\n };\n return [onSpawnBefore, onSpawnAfter];\n}\n\n// src/lib/plugins/block-unsafe-operations-plugin.ts\nimport { vulnerabilityCheck } from \"@simple-git/argv-parser\";\nfunction blockUnsafeOperationsPlugin(options = {}) {\n return {\n type: \"spawn.args\",\n action(args, { env }) {\n for (const vulnerability of vulnerabilityCheck(args, env)) {\n if (options[vulnerability.category] !== true) {\n throw new GitPluginError(void 0, \"unsafe\", vulnerability.message);\n }\n }\n return args;\n }\n };\n}\n\n// src/lib/plugins/command-config-prefixing-plugin.ts\ninit_utils();\nfunction commandConfigPrefixingPlugin(configuration) {\n const prefix = prefixedArray(configuration, \"-c\");\n return {\n type: \"spawn.args\",\n action(data) {\n return [...prefix, ...data];\n }\n };\n}\n\n// src/lib/plugins/completion-detection.plugin.ts\ninit_utils();\nimport { deferred } from \"@kwsites/promise-deferred\";\nvar never = deferred().promise;\nfunction completionDetectionPlugin({\n onClose = true,\n onExit = 50\n} = {}) {\n function createEvents() {\n let exitCode = -1;\n const events = {\n close: deferred(),\n closeTimeout: deferred(),\n exit: deferred(),\n exitTimeout: deferred()\n };\n const result = Promise.race([\n onClose === false ? never : events.closeTimeout.promise,\n onExit === false ? never : events.exitTimeout.promise\n ]);\n configureTimeout(onClose, events.close, events.closeTimeout);\n configureTimeout(onExit, events.exit, events.exitTimeout);\n return {\n close(code) {\n exitCode = code;\n events.close.done();\n },\n exit(code) {\n exitCode = code;\n events.exit.done();\n },\n get exitCode() {\n return exitCode;\n },\n result\n };\n }\n function configureTimeout(flag, event, timeout) {\n if (flag === false) {\n return;\n }\n (flag === true ? event.promise : event.promise.then(() => delay(flag))).then(timeout.done);\n }\n return {\n type: \"spawn.after\",\n async action(_data, { spawned, close }) {\n const events = createEvents();\n let deferClose = true;\n let quickClose = () => void (deferClose = false);\n spawned.stdout?.on(\"data\", quickClose);\n spawned.stderr?.on(\"data\", quickClose);\n spawned.on(\"error\", quickClose);\n spawned.on(\"close\", (code) => events.close(code));\n spawned.on(\"exit\", (code) => events.exit(code));\n try {\n await events.result;\n if (deferClose) {\n await delay(50);\n }\n close(events.exitCode);\n } catch (err) {\n close(events.exitCode, err);\n }\n }\n };\n}\n\n// src/lib/plugins/custom-binary.plugin.ts\ninit_utils();\nvar WRONG_NUMBER_ERR = `Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings`;\nvar WRONG_CHARS_ERR = `Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option`;\nfunction isBadArgument(arg) {\n return !arg || !/^([a-z]:)?([a-z0-9/.\\\\_~-]+)$/i.test(arg);\n}\nfunction toBinaryConfig(input, allowUnsafe) {\n if (input.length < 1 || input.length > 2) {\n throw new GitPluginError(void 0, \"binary\", WRONG_NUMBER_ERR);\n }\n const isBad = input.some(isBadArgument);\n if (isBad) {\n if (allowUnsafe) {\n console.warn(WRONG_CHARS_ERR);\n } else {\n throw new GitPluginError(void 0, \"binary\", WRONG_CHARS_ERR);\n }\n }\n const [binary, prefix] = input;\n return {\n binary,\n prefix\n };\n}\nfunction customBinaryPlugin(plugins, input = [\"git\"], allowUnsafe = false) {\n let config = toBinaryConfig(asArray(input), allowUnsafe);\n plugins.on(\"binary\", (input2) => {\n config = toBinaryConfig(asArray(input2), allowUnsafe);\n });\n plugins.append(\"spawn.binary\", () => {\n return config.binary;\n });\n plugins.append(\"spawn.args\", (data) => {\n return config.prefix ? [config.prefix, ...data] : data;\n });\n}\n\n// src/lib/plugins/error-detection.plugin.ts\ninit_git_error();\nfunction isTaskError(result) {\n return !!(result.exitCode && result.stdErr.length);\n}\nfunction getErrorMessage(result) {\n return Buffer.concat([...result.stdOut, ...result.stdErr]);\n}\nfunction errorDetectionHandler(overwrite = false, isError = isTaskError, errorMessage = getErrorMessage) {\n return (error, result) => {\n if (!overwrite && error || !isError(result)) {\n return error;\n }\n return errorMessage(result);\n };\n}\nfunction errorDetectionPlugin(config) {\n return {\n type: \"task.error\",\n action(data, context) {\n const error = config(data.error, {\n stdErr: context.stdErr,\n stdOut: context.stdOut,\n exitCode: context.exitCode\n });\n if (Buffer.isBuffer(error)) {\n return { error: new GitError(void 0, error.toString(\"utf-8\")) };\n }\n return {\n error\n };\n }\n };\n}\n\n// src/lib/plugins/plugin-store.ts\ninit_utils();\nimport { EventEmitter } from \"node:events\";\nvar PluginStore = class {\n constructor() {\n this.plugins = /* @__PURE__ */ new Set();\n this.events = new EventEmitter();\n }\n on(type, listener) {\n this.events.on(type, listener);\n }\n reconfigure(type, data) {\n this.events.emit(type, data);\n }\n append(type, action) {\n const plugin = append(this.plugins, { type, action });\n return () => this.plugins.delete(plugin);\n }\n add(plugin) {\n const plugins = [];\n asArray(plugin).forEach((plugin2) => plugin2 && this.plugins.add(append(plugins, plugin2)));\n return () => {\n plugins.forEach((plugin2) => this.plugins.delete(plugin2));\n };\n }\n exec(type, data, context) {\n let output = data;\n const contextual = Object.freeze(Object.create(context));\n for (const plugin of this.plugins) {\n if (plugin.type === type) {\n output = plugin.action(output, contextual);\n }\n }\n return output;\n }\n};\n\n// src/lib/plugins/progress-monitor-plugin.ts\ninit_utils();\nfunction progressMonitorPlugin(progress) {\n const progressCommand = \"--progress\";\n const progressMethods = [\"checkout\", \"clone\", \"fetch\", \"pull\", \"push\"];\n const onProgress = {\n type: \"spawn.after\",\n action(_data, context) {\n if (!context.commands.includes(progressCommand)) {\n return;\n }\n context.spawned.stderr?.on(\"data\", (chunk) => {\n const message = /^([\\s\\S]+?):\\s*(\\d+)% \\((\\d+)\\/(\\d+)\\)/.exec(chunk.toString(\"utf8\"));\n if (!message) {\n return;\n }\n progress({\n method: context.method,\n stage: progressEventStage(message[1]),\n progress: asNumber(message[2]),\n processed: asNumber(message[3]),\n total: asNumber(message[4])\n });\n });\n }\n };\n const onArgs = {\n type: \"spawn.args\",\n action(args, context) {\n if (!progressMethods.includes(context.method)) {\n return args;\n }\n return including(args, progressCommand);\n }\n };\n return [onArgs, onProgress];\n}\nfunction progressEventStage(input) {\n return String(input.toLowerCase().split(\" \", 1)) || \"unknown\";\n}\n\n// src/lib/plugins/spawn-options-plugin.ts\ninit_utils();\nfunction spawnOptionsPlugin(spawnOptions) {\n const options = pick(spawnOptions, [\"uid\", \"gid\"]);\n return {\n type: \"spawn.options\",\n action(data) {\n return { ...options, ...data };\n }\n };\n}\n\n// src/lib/plugins/timout-plugin.ts\nfunction timeoutPlugin({\n block,\n stdErr = true,\n stdOut = true\n}) {\n if (block > 0) {\n return {\n type: \"spawn.after\",\n action(_data, context) {\n let timeout;\n function wait() {\n timeout && clearTimeout(timeout);\n timeout = setTimeout(kill, block);\n }\n function stop() {\n context.spawned.stdout?.off(\"data\", wait);\n context.spawned.stderr?.off(\"data\", wait);\n context.spawned.off(\"exit\", stop);\n context.spawned.off(\"close\", stop);\n timeout && clearTimeout(timeout);\n }\n function kill() {\n stop();\n context.kill(new GitPluginError(void 0, \"timeout\", `block timeout reached`));\n }\n stdOut && context.spawned.stdout?.on(\"data\", wait);\n stdErr && context.spawned.stderr?.on(\"data\", wait);\n context.spawned.on(\"exit\", stop);\n context.spawned.on(\"close\", stop);\n wait();\n }\n };\n }\n}\n\n// src/lib/plugins/suffix-paths.plugin.ts\nimport { isPathSpec as isPathSpec3, toPaths } from \"@simple-git/args-pathspec\";\nfunction suffixPathsPlugin() {\n return {\n type: \"spawn.args\",\n action(data) {\n const prefix = [];\n let suffix;\n function append2(args) {\n (suffix = suffix || []).push(...args);\n }\n for (let i = 0; i < data.length; i++) {\n const param = data[i];\n if (isPathSpec3(param)) {\n append2(toPaths(param));\n continue;\n }\n if (param === \"--\") {\n append2(\n data.slice(i + 1).flatMap((item) => isPathSpec3(item) && toPaths(item) || item)\n );\n break;\n }\n prefix.push(param);\n }\n return !suffix ? prefix : [...prefix, \"--\", ...suffix.map(String)];\n }\n };\n}\n\n// src/lib/git-factory.ts\ninit_utils();\nvar Git = require_git();\nfunction gitInstanceFactory(baseDir, options) {\n const plugins = new PluginStore();\n const config = createInstanceConfig(\n baseDir && (typeof baseDir === \"string\" ? { baseDir } : baseDir) || {},\n options\n );\n if (!folderExists(config.baseDir)) {\n throw new GitConstructError(\n config,\n `Cannot use simple-git on a directory that does not exist`\n );\n }\n if (Array.isArray(config.config)) {\n plugins.add(commandConfigPrefixingPlugin(config.config));\n }\n plugins.add(blockUnsafeOperationsPlugin(config.unsafe));\n plugins.add(completionDetectionPlugin(config.completion));\n config.abort && plugins.add(abortPlugin(config.abort));\n config.progress && plugins.add(progressMonitorPlugin(config.progress));\n config.timeout && plugins.add(timeoutPlugin(config.timeout));\n config.spawnOptions && plugins.add(spawnOptionsPlugin(config.spawnOptions));\n plugins.add(suffixPathsPlugin());\n plugins.add(errorDetectionPlugin(errorDetectionHandler(true)));\n config.errors && plugins.add(errorDetectionPlugin(config.errors));\n customBinaryPlugin(plugins, config.binary, config.unsafe?.allowUnsafeCustomBinary);\n return new Git(config, plugins);\n}\n\n// src/lib/runners/promise-wrapped.ts\ninit_git_response_error();\nvar functionNamesBuilderApi = [\"customBinary\", \"env\", \"outputHandler\", \"silent\"];\nvar functionNamesPromiseApi = [\n \"add\",\n \"addAnnotatedTag\",\n \"addConfig\",\n \"addRemote\",\n \"addTag\",\n \"applyPatch\",\n \"binaryCatFile\",\n \"branch\",\n \"branchLocal\",\n \"catFile\",\n \"checkIgnore\",\n \"checkIsRepo\",\n \"checkout\",\n \"checkoutBranch\",\n \"checkoutLatestTag\",\n \"checkoutLocalBranch\",\n \"clean\",\n \"clone\",\n \"commit\",\n \"cwd\",\n \"deleteLocalBranch\",\n \"deleteLocalBranches\",\n \"diff\",\n \"diffSummary\",\n \"exec\",\n \"fetch\",\n \"getRemotes\",\n \"init\",\n \"listConfig\",\n \"listRemote\",\n \"log\",\n \"merge\",\n \"mergeFromTo\",\n \"mirror\",\n \"mv\",\n \"pull\",\n \"push\",\n \"pushTags\",\n \"raw\",\n \"rebase\",\n \"remote\",\n \"removeRemote\",\n \"reset\",\n \"revert\",\n \"revparse\",\n \"rm\",\n \"rmKeepLocal\",\n \"show\",\n \"stash\",\n \"stashList\",\n \"status\",\n \"subModule\",\n \"submoduleAdd\",\n \"submoduleInit\",\n \"submoduleUpdate\",\n \"tag\",\n \"tags\",\n \"updateServerInfo\"\n];\nfunction gitP(...args) {\n let git;\n let chain = Promise.resolve();\n try {\n git = gitInstanceFactory(...args);\n } catch (e) {\n chain = Promise.reject(e);\n }\n function builderReturn() {\n return promiseApi;\n }\n function chainReturn() {\n return chain;\n }\n const promiseApi = [...functionNamesBuilderApi, ...functionNamesPromiseApi].reduce(\n (api, name) => {\n const isAsync = functionNamesPromiseApi.includes(name);\n const valid = isAsync ? asyncWrapper(name, git) : syncWrapper(name, git, api);\n const alternative = isAsync ? chainReturn : builderReturn;\n Object.defineProperty(api, name, {\n enumerable: false,\n configurable: false,\n value: git ? valid : alternative\n });\n return api;\n },\n {}\n );\n return promiseApi;\n function asyncWrapper(fn, git2) {\n return function(...args2) {\n if (typeof args2[args2.length] === \"function\") {\n throw new TypeError(\n \"Promise interface requires that handlers are not supplied inline, trailing function not allowed in call to \" + fn\n );\n }\n return chain.then(function() {\n return new Promise(function(resolve, reject) {\n const callback = (err, result) => {\n if (err) {\n return reject(toError(err));\n }\n resolve(result);\n };\n args2.push(callback);\n git2[fn].apply(git2, args2);\n });\n });\n };\n }\n function syncWrapper(fn, git2, api) {\n return (...args2) => {\n git2[fn](...args2);\n return api;\n };\n }\n}\nfunction toError(error) {\n if (error instanceof Error) {\n return error;\n }\n if (typeof error === \"string\") {\n return new Error(error);\n }\n return new GitResponseError(error);\n}\n\n// src/esm.mjs\nvar simpleGit = gitInstanceFactory;\nvar esm_default = gitInstanceFactory;\nexport {\n CheckRepoActions,\n CleanOptions,\n DiffNameStatus,\n GitConfigScope,\n GitConstructError,\n GitError,\n GitPluginError,\n GitResponseError,\n ResetMode,\n TaskConfigurationError,\n esm_default as default,\n gitP,\n grepQueryBuilder,\n pathspec,\n simpleGit\n};\n//# sourceMappingURL=index.js.map\n","/**\n * Git credential injection (docs/designs/github-app-git-credentials.md\n * §git 操作注入 / §子仓库) — the TWO secret-free channels that point every git\n * process at `agentconnect git-credential`:\n *\n * 1. Repo-local `.git/config` (written once post-clone): covers agent-run git\n * in the main checkout. Multiple agents can share one checkout — the file\n * carries the LAST writer's agentId, so channel 2 is authoritative there.\n * 2. Session-env `GIT_CONFIG_GLOBAL` pointing at a generated per-agent\n * gitconfig (includes the user's real global config first). Inherited by\n * the WHOLE agent process tree — submodules and nested clones hit OUR\n * helper (and get a clean denial) instead of leaking to a machine-global\n * osxkeychain credential. NOT GIT_CONFIG_COUNT: the indexed env vars don't\n * merge across processes, so any child that sets its own COUNT would\n * silently drop the reset and reopen the leak.\n *\n * All config values single-quote the shim path (git runs `!`-helpers via\n * `sh -c` — a space in $HOME must not word-split), reset the helper list first\n * (empty entry) and set useHttpPath=true (git strips `path` from credential\n * lookups by default; the reset-list semantics for URL-scoped keys are\n * implementation behavior verified on git ≥2.32 — see the design doc).\n *\n * Everything written here is a POINTER to the daemon — never a secret.\n */\nimport { execFile } from 'node:child_process'\nimport { mkdirSync, writeFileSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\nimport { simpleGit, type SimpleGit } from 'simple-git'\n\n/**\n * simple-git ≥3.36 vulnerability-checks argv AND any child env passed via\n * `.env()` (blockUnsafeOperationsPlugin → @simple-git/argv-parser). Two\n * behaviors matter here:\n *\n * - configuring `credential.helper` (any scope — argv `config` writes AND\n * GIT_CONFIG_KEY_n pairs) and the GIT_CONFIG_COUNT env channel itself each\n * need their own unsafe opt-in;\n * - a NAME blocklist of editor/pager/ssh/askpass/exec-path env vars is\n * refused outright, presence-based — the value is never read, so an empty\n * string or the operator's login-shell EDITOR both throw.\n *\n * Our helper injection IS the feature — opt in to exactly the two categories\n * whose values the daemon constructs itself. The host-shell noise (EDITOR,\n * stray GIT_DIR, a host GIT_CONFIG_*) gets SANITIZED instead: none of it\n * belongs in a daemon-run git child.\n */\nconst UNSAFE_OPTS = {\n unsafe: {\n allowUnsafeCredentialHelper: true, // the daemon-built credential.https://github.com.helper pairs\n allowUnsafeConfigEnvCount: true // the daemon-built GIT_CONFIG_COUNT/KEY_n/VALUE_n channel\n }\n} as const\n\n/**\n * simple-git bound to a cwd with the credential-helper opt-in. An `abort`\n * signal KILLS the spawned git child (abort-plugin) — pair budget timeouts\n * with it, or the abandoned child keeps running and holds .git locks\n * (index.lock) into the next session's pull.\n */\nexport function gitFor(cwd?: string, abort?: AbortSignal): SimpleGit {\n return simpleGit({\n ...(cwd ? { baseDir: cwd } : {}),\n ...(abort ? { abort } : {}),\n ...UNSAFE_OPTS\n })\n}\n\n// Every env var simple-git's checker refuses by NAME (it matches\n// case-insensitively — mirror that) + repo-context overrides that must never\n// leak into a clone/pull child. VISUAL rides along with the editor family.\nconst HOST_ENV_STRIP = new Set([\n 'EDITOR',\n 'VISUAL',\n 'PAGER',\n 'PREFIX',\n 'GIT_EDITOR',\n 'GIT_SEQUENCE_EDITOR',\n 'GIT_PAGER',\n 'GIT_SSH',\n 'GIT_SSH_COMMAND',\n 'GIT_ASKPASS',\n 'SSH_ASKPASS',\n 'GIT_EXEC_PATH',\n 'GIT_EXTERNAL_DIFF',\n 'GIT_PROXY_COMMAND',\n 'GIT_TEMPLATE_DIR',\n 'GIT_DIR',\n 'GIT_WORK_TREE',\n 'GIT_INDEX_FILE',\n 'GIT_NAMESPACE',\n 'GIT_CONFIG',\n 'GIT_CONFIG_GLOBAL',\n 'GIT_CONFIG_SYSTEM'\n])\n\n/**\n * `process.env` minus host-shell git noise — the base for every daemon-run git\n * child. The host keeps its ambient capabilities (PATH, HOME → ~/.gitconfig\n * and ~/.ssh/config, SSH_AUTH_SOCK, proxies); what goes is anything the\n * checker blocks by name plus repo-context overrides. A host that truly needs\n * e.g. a custom ssh command can set core.sshCommand in ~/.gitconfig — config\n * FILES are honored as ever, only env-var overrides are dropped.\n */\nexport function gitEnvBase(): Record<string, string> {\n const env: Record<string, string> = {}\n for (const [k, v] of Object.entries(process.env)) {\n if (v === undefined) continue\n const key = k.toUpperCase()\n if (HOST_ENV_STRIP.has(key)) continue\n if (key.startsWith('GIT_CONFIG_')) continue // stray host GIT_CONFIG_COUNT/KEY_n/VALUE_n\n env[k] = v\n }\n return env\n}\n\n/** Module-level init (workspace-manager is functional; mirrors cloneInFlight). */\nlet shimPath: string | undefined\nlet runDir: string | undefined\nlet preWarm: ((agentId: string, reason: 'clone' | 'pull') => Promise<void>) | undefined\n\nexport function initGitInjection(opts: {\n shimPath: string\n runDir: string\n /** Warm the daemon credential cache BEFORE a timed git op (never inside its budget). */\n preWarm: (agentId: string, reason: 'clone' | 'pull') => Promise<void>\n}): void {\n shimPath = opts.shimPath\n runDir = opts.runDir\n preWarm = opts.preWarm\n}\n\nfunction quotedHelper(agentId: string): string {\n if (!shimPath) throw new Error('git credential injection is not initialized')\n return `!'${shimPath.replaceAll(\"'\", \"'\\\\''\")}' ${agentId}`\n}\n\n/** The three github.com-scoped config pairs both channels share. */\nfunction configPairs(agentId: string): Array<[string, string]> {\n return [\n ['credential.https://github.com.helper', ''], // reset: machine helpers must never answer for github.com\n ['credential.https://github.com.helper', quotedHelper(agentId)],\n ['credential.https://github.com.useHttpPath', 'true'] // git strips `path` otherwise — the helper wants it\n ]\n}\n\n/**\n * Env for a DAEMON-RUN git process (clone — no repo config exists yet).\n * Spread over `process.env` by the caller: simple-git's `.env()` REPLACES the\n * child environment (v3.36 verified), a bare object would strip PATH/HOME.\n */\nexport function cloneGitEnv(agentId: string): Record<string, string> {\n const pairs = configPairs(agentId)\n const env: Record<string, string> = {\n GIT_TERMINAL_PROMPT: '0',\n GIT_CONFIG_COUNT: String(pairs.length)\n }\n pairs.forEach(([k, v], i) => {\n env[`GIT_CONFIG_KEY_${i}`] = k\n env[`GIT_CONFIG_VALUE_${i}`] = v\n })\n return env\n}\n\n/**\n * Session-env channel: (re)write the per-agent gitconfig and return the env to\n * inject into the agent's ACP runtime process. Regenerated on every host spawn\n * (#251 retries rebuild the host ⇒ this re-runs).\n */\nexport function sessionGitEnv(agentId: string): Record<string, string> {\n if (!runDir) throw new Error('git credential injection is not initialized')\n const dir = join(runDir, 'gitcred')\n mkdirSync(dir, { recursive: true, mode: 0o700 })\n const file = join(dir, `${agentId}.gitconfig`)\n const lines = [\n '# agentconnect session git config — regenerated on agent start; NO secrets.',\n '# Keeps the user global config, then pins github.com credentials to the daemon helper.',\n '[include]',\n `\\tpath = ${join(homedir(), '.gitconfig')}`,\n '[credential \"https://github.com\"]',\n '\\thelper = ', // reset the accumulated helper list for github.com\n `\\thelper = ${quotedHelper(agentId)}`,\n '\\tuseHttpPath = true',\n ''\n ]\n writeFileSync(file, lines.join('\\n'), { mode: 0o644 })\n return { GIT_CONFIG_GLOBAL: file, GIT_TERMINAL_PROMPT: '0' }\n}\n\n/** Post-clone: pin the repo-local helper so agent-run git in the checkout works. */\nexport async function writeRepoHelperConfig(cwd: string, agentId: string): Promise<void> {\n const git = gitFor(cwd)\n // `--replace-all` on the first write resets any stale helper list from a\n // previous agent generation; addConfig(append=true) accumulates the rest.\n await git.raw(['config', '--replace-all', 'credential.https://github.com.helper', ''])\n await git.raw(['config', '--add', 'credential.https://github.com.helper', quotedHelper(agentId)])\n await git.raw(['config', 'credential.https://github.com.useHttpPath', 'true'])\n}\n\n/** Pre-warm hook for workspace-manager (no-op until initialized). */\nexport async function preWarmGitCred(agentId: string, reason: 'clone' | 'pull'): Promise<void> {\n if (!preWarm) return\n await preWarm(agentId, reason)\n}\n\n// The session channel (GIT_CONFIG_GLOBAL) needs git ≥ 2.32 and DEGRADES\n// SILENTLY below it — old git just ignores the variable and agent-run git\n// falls through to whatever machine credentials exist. The clone channel\n// (GIT_CONFIG_COUNT/KEY_n/VALUE_n) needs ≥ 2.31 and fails loudly instead.\nconst MIN_GIT: readonly [number, number] = [2, 32]\n\n/** `git version 2.39.5 (Apple Git-154)` → [2, 39]; null when unparseable. */\nexport function parseGitVersion(raw: string): [number, number] | null {\n const m = /git version (\\d+)\\.(\\d+)/.exec(raw)\n return m ? [Number(m[1]), Number(m[2])] : null\n}\n\n/**\n * Boot-time probe (fire-and-forget): a host below the floor would otherwise\n * only show up as a mysterious credential prompt / auth failure deep inside an\n * agent session — say it once, at startup, in plain words.\n */\nexport function probeGitVersion(warn: (msg: string) => void): void {\n execFile('git', ['--version'], { timeout: 5_000 }, (err, stdout) => {\n if (err) {\n warn('git probe: `git --version` failed — git workspaces will not work on this host')\n return\n }\n const v = parseGitVersion(String(stdout))\n if (!v) return // vendor-mangled banner — do not cry wolf\n const [major, minor] = v\n if (major > MIN_GIT[0] || (major === MIN_GIT[0] && minor >= MIN_GIT[1])) return\n const cloneToo = major < 2 || (major === 2 && minor < 31)\n warn(\n `git ${major}.${minor} found but github-app workspaces need git >= ${MIN_GIT[0]}.${MIN_GIT[1]}: ` +\n 'this git silently ignores the session credential channel (GIT_CONFIG_GLOBAL)' +\n (cloneToo ? ' and clone-time injection (GIT_CONFIG_COUNT, needs >= 2.31) will fail' : '')\n )\n })\n}\n","import { mkdirSync, existsSync, rmSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { normalizeGitUrl } from '@agentconnect.md/protocol'\nimport type { Agent } from '../agents/agent-schema.js'\nimport { cloneGitEnv, gitEnvBase, gitFor, preWarmGitCred, writeRepoHelperConfig } from './git-injection.js'\n\nconst PULL_TIMEOUT_MS = 4500\n\n// Single-flight clone lock keyed by the absolute cwd. Two concurrent sessions\n// (especially multiple agents sharing one repo checkout) must not race into the\n// same dir — the second awaits the first's in-flight clone instead of re-cloning.\nconst cloneInFlight = new Map<string, Promise<void>>()\n\nfunction usesGithubApp(agent: Agent): boolean {\n return agent.workspace.mode === 'git-repo' && agent.workspace.gitCredential === 'github-app'\n}\n\nexport async function prepareWorkspace(agent: Agent): Promise<string> {\n const cwd = agent.workspace.path\n mkdirSync(cwd, { recursive: true })\n\n if (agent.workspace.mode === 'from-scratch') {\n // The agent's memory file lives at the agent ROOT (outside the workspace) and\n // is seeded separately (see agents/memory.ts `ensureMemory`), so from-scratch\n // just needs the (empty) workspace dir to exist.\n return cwd\n }\n\n // git-repo, first session: no checkout yet → clone. Unlike pull, a clone has no\n // on-disk fallback, so on failure we THROW (the session creation fails + the error\n // surfaces) rather than silently proceeding with an empty dir (design §4.3).\n if (!existsSync(join(cwd, '.git'))) {\n await cloneRepo(agent)\n return cwd\n }\n\n // git-repo, existing checkout: best-effort ff-only pull; never block/throw on\n // offline (design §4.3) — proceed with the on-disk checkout.\n if (agent.workspace.pullOnNewSession) {\n // github-app: warm the credential cache OUTSIDE the pull budget — a cold\n // cache means a CP round trip that would otherwise eat the whole 4.5s.\n if (usesGithubApp(agent)) await preWarmGitCred(agent.id, 'pull').catch(() => undefined)\n // Abort-driven budget: the signal makes simple-git KILL the git child at\n // the deadline. A bare Promise.race would abandon it still running — a\n // wedged pull (network black hole) then holds .git/index.lock into the\n // next session's pull.\n const abort = new AbortController()\n const timer = setTimeout(() => abort.abort(), PULL_TIMEOUT_MS)\n try {\n await gitFor(cwd, abort.signal)\n .env({ ...gitEnvBase(), GIT_TERMINAL_PROMPT: '0' })\n .pull(['--ff-only'])\n } catch {\n // offline / timed out / non-fast-forward: proceed with the on-disk checkout\n } finally {\n clearTimeout(timer)\n }\n }\n return cwd\n}\n\n/**\n * Eagerly clone a git-repo workspace that has no checkout yet — for reconcile-time\n * prefetch so the repo is warm before the first message arrives. No-op for\n * from-scratch or an already-cloned checkout (the session-time `prepareWorkspace`\n * stays authoritative and still owns pull + hard-fail). Reuses the single-flight\n * lock so a prefetch and a concurrent session-start clone never race into the same\n * dir. The caller invokes this fire-and-forget and logs any rejection — clone\n * failure here is non-fatal because `prepareWorkspace` re-clones (and hard-fails)\n * on the first session as the backstop.\n */\nexport async function prefetchWorkspace(agent: Agent): Promise<void> {\n if (agent.workspace.mode !== 'git-repo') return\n const cwd = agent.workspace.path\n if (existsSync(join(cwd, '.git'))) return\n mkdirSync(cwd, { recursive: true })\n await cloneRepo(agent)\n}\n\n/** Clone agent.workspace.gitRepo @ gitBranch into cwd, single-flight per cwd. */\nasync function cloneRepo(agent: Agent): Promise<void> {\n const cwd = agent.workspace.path\n const inflight = cloneInFlight.get(cwd)\n if (inflight) return inflight\n\n // Stored value should already be a full address, but normalize defensively —\n // a hand-edited or pre-normalization agent.json may still say \"org/repo\",\n // which git would treat as a local path (\"repository ... does not exist\").\n const gitRepo = agent.workspace.gitRepo && normalizeGitUrl(agent.workspace.gitRepo)\n if (!gitRepo) throw new Error(`workspace clone: agent \"${agent.id}\" has git-repo mode but no gitRepo configured`)\n const branch = agent.workspace.gitBranch\n const githubApp = usesGithubApp(agent)\n\n const p = (async () => {\n // github-app: credentials ride the env-injected helper (no repo config exists\n // yet). SPREAD over process.env — simple-git's .env() REPLACES the child env.\n if (githubApp) await preWarmGitCred(agent.id, 'clone')\n const git = githubApp\n ? gitFor().env({ ...gitEnvBase(), ...cloneGitEnv(agent.id) })\n : gitFor().env({ ...gitEnvBase(), GIT_TERMINAL_PROMPT: '0' })\n try {\n await git.clone(gitRepo, cwd, ['--branch', branch, '--single-branch'])\n } catch (e) {\n // A failed clone leaves a half-written dir whose stray `.git` would make\n // every later attempt think the checkout exists — clean before rethrowing.\n rmSync(join(cwd, '.git'), { recursive: true, force: true })\n throw e\n }\n // Pin the repo-local helper so AGENT-run git in this checkout authenticates\n // through the daemon too — the \"no credentials on the machine, but the agent\n // can still push\" half of the design.\n if (githubApp) await writeRepoHelperConfig(cwd, agent.id)\n })().finally(() => {\n cloneInFlight.delete(cwd)\n })\n cloneInFlight.set(cwd, p)\n return p\n}\n","// This file is auto-generated by @hey-api/openapi-ts\nexport const AGENT_METHODS = {\n initialize: \"initialize\",\n authenticate: \"authenticate\",\n providers_list: \"providers/list\",\n providers_set: \"providers/set\",\n providers_disable: \"providers/disable\",\n session_new: \"session/new\",\n session_load: \"session/load\",\n session_set_mode: \"session/set_mode\",\n session_set_config_option: \"session/set_config_option\",\n session_prompt: \"session/prompt\",\n session_cancel: \"session/cancel\",\n mcp_message: \"mcp/message\",\n session_list: \"session/list\",\n session_delete: \"session/delete\",\n session_fork: \"session/fork\",\n session_resume: \"session/resume\",\n session_close: \"session/close\",\n logout: \"logout\",\n nes_start: \"nes/start\",\n nes_suggest: \"nes/suggest\",\n nes_accept: \"nes/accept\",\n nes_reject: \"nes/reject\",\n nes_close: \"nes/close\",\n document_did_open: \"document/didOpen\",\n document_did_change: \"document/didChange\",\n document_did_close: \"document/didClose\",\n document_did_save: \"document/didSave\",\n document_did_focus: \"document/didFocus\",\n};\nexport const CLIENT_METHODS = {\n session_request_permission: \"session/request_permission\",\n session_update: \"session/update\",\n fs_write_text_file: \"fs/write_text_file\",\n fs_read_text_file: \"fs/read_text_file\",\n terminal_create: \"terminal/create\",\n terminal_output: \"terminal/output\",\n terminal_release: \"terminal/release\",\n terminal_wait_for_exit: \"terminal/wait_for_exit\",\n terminal_kill: \"terminal/kill\",\n mcp_connect: \"mcp/connect\",\n mcp_message: \"mcp/message\",\n mcp_disconnect: \"mcp/disconnect\",\n elicitation_create: \"elicitation/create\",\n elicitation_complete: \"elicitation/complete\",\n};\nexport const PROTOCOL_METHODS = {\n cancel_request: \"$/cancel_request\",\n};\nexport const PROTOCOL_VERSION = 1;\n//# sourceMappingURL=index.js.map","import { z } from \"zod/v4\";\nconst skippedItem = Symbol(\"skippedItem\");\nexport function defaultOnError(schema, fallback) {\n return schema.catch(fallback);\n}\nexport function requiredDefaultOnError(schema, fallback) {\n const schemaWithCatch = schema.catch(fallback);\n return z.unknown().transform((value, context) => {\n if (value !== undefined)\n return schemaWithCatch.parse(value);\n context.addIssue({\n code: \"custom\",\n message: \"Required value is missing\",\n });\n return z.NEVER;\n });\n}\nexport function vecSkipError(itemSchema) {\n return z\n .array(itemSchema.catch(skippedItem))\n .transform((items) => items.filter((item) => item !== skippedItem));\n}\n//# sourceMappingURL=schema-deserialize.js.map","// This file is auto-generated by @hey-api/openapi-ts\nimport { defaultOnError, requiredDefaultOnError, vecSkipError, } from \"../schema-deserialize.js\";\nimport * as z from \"zod/v4\";\n/**\n * JSON RPC Request Id\n *\n * An 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 *\n * The 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.\n */\nexport const zRequestId = z.union([z.number(), z.string()]).nullable();\n/**\n * A unique identifier for a conversation session between a client and agent.\n *\n * Sessions maintain their own context, conversation history, and state,\n * allowing multiple independent interactions with the same agent.\n *\n * See protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)\n */\nexport const zSessionId = z.string();\n/**\n * Request to write content to a text file.\n *\n * Only available if the client supports the `fs.writeTextFile` capability.\n */\nexport const zWriteTextFileRequest = z.object({\n sessionId: zSessionId,\n path: z.string(),\n content: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request to read content from a text file.\n *\n * Only available if the client supports the `fs.readTextFile` capability.\n */\nexport const zReadTextFileRequest = z.object({\n sessionId: zSessionId,\n path: z.string(),\n line: z\n .int()\n .gte(0)\n .max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n })\n .nullish(),\n limit: z\n .int()\n .gte(0)\n .max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n })\n .nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Unique identifier for a tool call within a session.\n */\nexport const zToolCallId = z.string();\n/**\n * Categories of tools that can be invoked.\n *\n * Tool kinds help clients choose appropriate icons and optimize how they\n * display tool execution progress.\n *\n * See protocol docs: [Creating](https://agentclientprotocol.com/protocol/tool-calls#creating)\n */\nexport const zToolKind = z.union([\n z.literal(\"read\"),\n z.literal(\"edit\"),\n z.literal(\"delete\"),\n z.literal(\"move\"),\n z.literal(\"search\"),\n z.literal(\"execute\"),\n z.literal(\"think\"),\n z.literal(\"fetch\"),\n z.literal(\"switch_mode\"),\n z.literal(\"other\"),\n]);\n/**\n * Execution status of a tool call.\n *\n * Tool calls progress through different statuses during their lifecycle.\n *\n * See protocol docs: [Status](https://agentclientprotocol.com/protocol/tool-calls#status)\n */\nexport const zToolCallStatus = z.union([\n z.literal(\"pending\"),\n z.literal(\"in_progress\"),\n z.literal(\"completed\"),\n z.literal(\"failed\"),\n]);\n/**\n * The sender or recipient of messages and data in a conversation.\n */\nexport const zRole = z.union([z.literal(\"assistant\"), z.literal(\"user\")]);\n/**\n * Optional annotations for the client. The client can use annotations to inform how objects are used or displayed\n */\nexport const zAnnotations = z.object({\n audience: defaultOnError(vecSkipError(zRole).nullish(), () => undefined),\n lastModified: z.string().nullish(),\n priority: z.number().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Text provided to or from an LLM.\n */\nexport const zTextContent = z.object({\n annotations: defaultOnError(zAnnotations.nullish(), () => undefined),\n text: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * An image provided to or from an LLM.\n */\nexport const zImageContent = z.object({\n annotations: defaultOnError(zAnnotations.nullish(), () => undefined),\n data: z.string(),\n mimeType: z.string(),\n uri: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Audio provided to or from an LLM.\n */\nexport const zAudioContent = z.object({\n annotations: defaultOnError(zAnnotations.nullish(), () => undefined),\n data: z.string(),\n mimeType: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A resource that the server is capable of reading, included in a prompt or tool call result.\n */\nexport const zResourceLink = z.object({\n annotations: defaultOnError(zAnnotations.nullish(), () => undefined),\n description: z.string().nullish(),\n mimeType: z.string().nullish(),\n name: z.string(),\n size: z.number().nullish(),\n title: z.string().nullish(),\n uri: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Text-based resource contents.\n */\nexport const zTextResourceContents = z.object({\n mimeType: z.string().nullish(),\n text: z.string(),\n uri: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Binary resource contents.\n */\nexport const zBlobResourceContents = z.object({\n blob: z.string(),\n mimeType: z.string().nullish(),\n uri: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Resource content that can be embedded in a message.\n */\nexport const zEmbeddedResourceResource = z.union([\n zTextResourceContents,\n zBlobResourceContents,\n]);\n/**\n * The contents of a resource, embedded into a prompt or tool call result.\n */\nexport const zEmbeddedResource = z.object({\n annotations: defaultOnError(zAnnotations.nullish(), () => undefined),\n resource: zEmbeddedResourceResource,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Content blocks represent displayable information in the Agent Client Protocol.\n *\n * They provide a structured way to handle various types of user-facing content—whether\n * it's text from language models, images for analysis, or embedded resources for context.\n *\n * Content blocks appear in:\n * - User prompts sent via `session/prompt`\n * - Language model output streamed through `session/update` notifications\n * - Progress updates and results from tool calls\n *\n * This structure is compatible with the Model Context Protocol (MCP), enabling\n * agents to seamlessly forward content from MCP tool outputs without transformation.\n *\n * See protocol docs: [Content](https://agentclientprotocol.com/protocol/content)\n */\nexport const zContentBlock = z.union([\n zTextContent.and(z.object({\n type: z.literal(\"text\"),\n })),\n zImageContent.and(z.object({\n type: z.literal(\"image\"),\n })),\n zAudioContent.and(z.object({\n type: z.literal(\"audio\"),\n })),\n zResourceLink.and(z.object({\n type: z.literal(\"resource_link\"),\n })),\n zEmbeddedResource.and(z.object({\n type: z.literal(\"resource\"),\n })),\n]);\n/**\n * Standard content block (text, images, resources).\n */\nexport const zContent = z.object({\n content: zContentBlock,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A diff representing file modifications.\n *\n * Shows changes to files in a format suitable for display in the client UI.\n *\n * See protocol docs: [Content](https://agentclientprotocol.com/protocol/tool-calls#content)\n */\nexport const zDiff = z.object({\n path: z.string(),\n oldText: z.string().nullish(),\n newText: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Typed identifier used for terminal values on the wire.\n */\nexport const zTerminalId = z.string();\n/**\n * Embed a terminal created with `terminal/create` by its id.\n *\n * The terminal must be added before calling `terminal/release`.\n *\n * See protocol docs: [Terminal](https://agentclientprotocol.com/protocol/terminals)\n */\nexport const zTerminal = z.object({\n terminalId: zTerminalId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Content produced by a tool call.\n *\n * Tool calls can produce different types of content including\n * standard content blocks (text, images) or file diffs.\n *\n * See protocol docs: [Content](https://agentclientprotocol.com/protocol/tool-calls#content)\n */\nexport const zToolCallContent = z.union([\n zContent.and(z.object({\n type: z.literal(\"content\"),\n })),\n zDiff.and(z.object({\n type: z.literal(\"diff\"),\n })),\n zTerminal.and(z.object({\n type: z.literal(\"terminal\"),\n })),\n]);\n/**\n * A file location being accessed or modified by a tool.\n *\n * Enables clients to implement \"follow-along\" features that track\n * which files the agent is working with in real-time.\n *\n * See protocol docs: [Following the Agent](https://agentclientprotocol.com/protocol/tool-calls#following-the-agent)\n */\nexport const zToolCallLocation = z.object({\n path: z.string(),\n line: z\n .int()\n .gte(0)\n .max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n })\n .nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * An update to an existing tool call.\n *\n * Used to report progress and results as tools execute. All fields except\n * the tool call ID are optional - only changed fields need to be included.\n *\n * See protocol docs: [Updating](https://agentclientprotocol.com/protocol/tool-calls#updating)\n */\nexport const zToolCallUpdate = z.object({\n toolCallId: zToolCallId,\n kind: defaultOnError(zToolKind.nullish(), () => undefined),\n status: defaultOnError(zToolCallStatus.nullish(), () => undefined),\n title: z.string().nullish(),\n content: defaultOnError(vecSkipError(zToolCallContent).nullish(), () => undefined),\n locations: defaultOnError(vecSkipError(zToolCallLocation).nullish(), () => undefined),\n rawInput: z.unknown().optional(),\n rawOutput: z.unknown().optional(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Unique identifier for a permission option.\n */\nexport const zPermissionOptionId = z.string();\n/**\n * The type of permission option being presented to the user.\n *\n * Helps clients choose appropriate icons and UI treatment.\n */\nexport const zPermissionOptionKind = z.union([\n z.literal(\"allow_once\"),\n z.literal(\"allow_always\"),\n z.literal(\"reject_once\"),\n z.literal(\"reject_always\"),\n]);\n/**\n * An option presented to the user when requesting permission.\n */\nexport const zPermissionOption = z.object({\n optionId: zPermissionOptionId,\n name: z.string(),\n kind: zPermissionOptionKind,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request for user permission to execute a tool call.\n *\n * Sent when the agent needs authorization before performing a sensitive operation.\n *\n * See protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/tool-calls#requesting-permission)\n */\nexport const zRequestPermissionRequest = z.object({\n sessionId: zSessionId,\n toolCall: zToolCallUpdate,\n options: z.array(zPermissionOption),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * An environment variable to set when launching an MCP server.\n */\nexport const zEnvVariable = z.object({\n name: z.string(),\n value: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request to create a new terminal and execute a command.\n */\nexport const zCreateTerminalRequest = z.object({\n sessionId: zSessionId,\n command: z.string(),\n args: z.array(z.string()).optional(),\n env: z.array(zEnvVariable).optional(),\n cwd: z.string().nullish(),\n outputByteLimit: z.number().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request to get the current output and status of a terminal.\n */\nexport const zTerminalOutputRequest = z.object({\n sessionId: zSessionId,\n terminalId: zTerminalId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request to release a terminal and free its resources.\n */\nexport const zReleaseTerminalRequest = z.object({\n sessionId: zSessionId,\n terminalId: zTerminalId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request to wait for a terminal command to exit.\n */\nexport const zWaitForTerminalExitRequest = z.object({\n sessionId: zSessionId,\n terminalId: zTerminalId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request to kill a terminal without releasing it.\n */\nexport const zKillTerminalRequest = z.object({\n sessionId: zSessionId,\n terminalId: zTerminalId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Session-scoped elicitation, optionally tied to a specific tool call.\n *\n * When `tool_call_id` is set, the elicitation is tied to a specific tool call.\n * This is useful when an agent receives an elicitation from an MCP server\n * during a tool call and needs to redirect it to the user.\n *\n * @experimental\n */\nexport const zElicitationSessionScope = z.object({\n sessionId: zSessionId,\n toolCallId: zToolCallId.nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * 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).\n *\n * @experimental\n */\nexport const zElicitationRequestScope = z.object({\n requestId: zRequestId,\n});\n/**\n * Object schema type.\n */\nexport const zElicitationSchemaType = z.literal(\"object\");\n/**\n * String format types for string properties in elicitation schemas.\n */\nexport const zStringFormat = z.union([\n z.literal(\"email\"),\n z.literal(\"uri\"),\n z.literal(\"date\"),\n z.literal(\"date-time\"),\n]);\n/**\n * A titled enum option with a const value and human-readable title.\n */\nexport const zEnumOption = z.object({\n const: z.string(),\n title: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Schema for string properties in an elicitation form.\n *\n * When `enum` or `oneOf` is set, this represents a single-select enum\n * with `\"type\": \"string\"`.\n */\nexport const zStringPropertySchema = z.object({\n title: z.string().nullish(),\n description: z.string().nullish(),\n minLength: z\n .int()\n .gte(0)\n .max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n })\n .nullish(),\n maxLength: z\n .int()\n .gte(0)\n .max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n })\n .nullish(),\n pattern: z.string().nullish(),\n format: zStringFormat.nullish(),\n default: z.string().nullish(),\n enum: z.array(z.string()).nullish(),\n oneOf: z.array(zEnumOption).nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Schema for number (floating-point) properties in an elicitation form.\n */\nexport const zNumberPropertySchema = z.object({\n title: z.string().nullish(),\n description: z.string().nullish(),\n minimum: z.number().nullish(),\n maximum: z.number().nullish(),\n default: z.number().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Schema for integer properties in an elicitation form.\n */\nexport const zIntegerPropertySchema = z.object({\n title: z.string().nullish(),\n description: z.string().nullish(),\n minimum: z.number().nullish(),\n maximum: z.number().nullish(),\n default: z.number().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Schema for boolean properties in an elicitation form.\n */\nexport const zBooleanPropertySchema = z.object({\n title: z.string().nullish(),\n description: z.string().nullish(),\n default: z.boolean().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * String schema type.\n */\nexport const zElicitationStringType = z.literal(\"string\");\n/**\n * Items definition for untitled multi-select enum properties.\n */\nexport const zUntitledMultiSelectItems = z.object({\n type: zElicitationStringType,\n enum: z.array(z.string()),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Items definition for titled multi-select enum properties.\n */\nexport const zTitledMultiSelectItems = z.object({\n anyOf: z.array(zEnumOption),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Items for a multi-select (array) property schema.\n */\nexport const zMultiSelectItems = z.union([\n zUntitledMultiSelectItems,\n zTitledMultiSelectItems,\n]);\n/**\n * Schema for multi-select (array) properties in an elicitation form.\n */\nexport const zMultiSelectPropertySchema = z.object({\n title: z.string().nullish(),\n description: z.string().nullish(),\n minItems: z.number().nullish(),\n maxItems: z.number().nullish(),\n items: zMultiSelectItems,\n default: z.array(z.string()).nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Property schema for elicitation form fields.\n *\n * Each variant corresponds to a JSON Schema `\"type\"` value.\n * Single-select enums use the `String` variant with `enum` or `oneOf` set.\n * Multi-select enums use the `Array` variant.\n */\nexport const zElicitationPropertySchema = z.union([\n zStringPropertySchema.and(z.object({\n type: z.literal(\"string\"),\n })),\n zNumberPropertySchema.and(z.object({\n type: z.literal(\"number\"),\n })),\n zIntegerPropertySchema.and(z.object({\n type: z.literal(\"integer\"),\n })),\n zBooleanPropertySchema.and(z.object({\n type: z.literal(\"boolean\"),\n })),\n zMultiSelectPropertySchema.and(z.object({\n type: z.literal(\"array\"),\n })),\n]);\n/**\n * Type-safe elicitation schema for requesting structured user input.\n *\n * This represents a JSON Schema object with primitive-typed properties,\n * as required by the elicitation specification.\n */\nexport const zElicitationSchema = z.object({\n type: zElicitationSchemaType.optional().default(\"object\"),\n title: z.string().nullish(),\n properties: z\n .record(z.string(), zElicitationPropertySchema)\n .optional()\n .default({}),\n required: z.array(z.string()).nullish(),\n description: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Form-based elicitation mode where the client renders a form from the provided schema.\n *\n * @experimental\n */\nexport const zElicitationFormMode = z.intersection(z.union([zElicitationSessionScope, zElicitationRequestScope]), z.object({\n requestedSchema: zElicitationSchema,\n}));\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Unique identifier for an elicitation.\n *\n * @experimental\n */\nexport const zElicitationId = z.string();\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * URL-based elicitation mode where the client directs the user to a URL.\n *\n * @experimental\n */\nexport const zElicitationUrlMode = z.intersection(z.union([zElicitationSessionScope, zElicitationRequestScope]), z.object({\n elicitationId: zElicitationId,\n url: z.url(),\n}));\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Request from the agent to elicit structured user input.\n *\n * The agent sends this to the client to request information from the user,\n * either via a form or by directing them to a URL.\n * Elicitations are tied to a session (optionally a tool call) or a request.\n *\n * @experimental\n */\nexport const zCreateElicitationRequest = z.intersection(z.union([\n zElicitationFormMode.and(z.object({\n mode: z.literal(\"form\"),\n })),\n zElicitationUrlMode.and(z.object({\n mode: z.literal(\"url\"),\n })),\n]), z.object({\n message: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n}));\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Unique identifier for an MCP server using the ACP transport.\n *\n * The value is opaque and generated by the ACP component providing the MCP server. It is\n * used by `mcp/connect` to route connection requests back to the component that declared the\n * server.\n *\n * @experimental\n */\nexport const zMcpServerAcpId = z.string();\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Request parameters for `mcp/connect`.\n *\n * @experimental\n */\nexport const zConnectMcpRequest = z.object({\n acpId: zMcpServerAcpId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * A unique identifier for an active MCP-over-ACP connection.\n *\n * @experimental\n */\nexport const zMcpConnectionId = z.string();\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Request parameters for `mcp/message`.\n *\n * @experimental\n */\nexport const zMessageMcpRequest = z.object({\n connectionId: zMcpConnectionId,\n method: z.string(),\n params: z.record(z.string(), z.unknown()).nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Request parameters for `mcp/disconnect`.\n *\n * @experimental\n */\nexport const zDisconnectMcpRequest = z.object({\n connectionId: zMcpConnectionId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Allows for sending an arbitrary request that is not part of the ACP spec.\n * Extension methods provide a way to add custom functionality while maintaining\n * protocol compatibility.\n *\n * See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)\n */\nexport const zExtRequest = z.unknown();\n/**\n * A JSON-RPC request object.\n */\nexport const zAgentRequest = z.object({\n id: zRequestId,\n method: z.string(),\n params: z\n .union([\n zWriteTextFileRequest,\n zReadTextFileRequest,\n zRequestPermissionRequest,\n zCreateTerminalRequest,\n zTerminalOutputRequest,\n zReleaseTerminalRequest,\n zWaitForTerminalExitRequest,\n zKillTerminalRequest,\n zCreateElicitationRequest,\n zConnectMcpRequest,\n zMessageMcpRequest,\n zDisconnectMcpRequest,\n zExtRequest,\n ])\n .nullish(),\n});\n/**\n * Protocol version identifier.\n *\n * This version is only bumped for breaking changes.\n * Non-breaking changes should be introduced via capabilities.\n */\nexport const zProtocolVersion = z.int().gte(0).lte(65535);\n/**\n * Prompt capabilities supported by the agent in `session/prompt` requests.\n *\n * Baseline agent functionality requires support for [`ContentBlock::Text`]\n * and [`ContentBlock::ResourceLink`] in prompt requests.\n *\n * Other variants must be explicitly opted in to.\n * Capabilities for different types of content in prompt requests.\n *\n * Indicates which content types beyond the baseline (text and resource links)\n * the agent can process.\n *\n * See protocol docs: [Prompt Capabilities](https://agentclientprotocol.com/protocol/initialization#prompt-capabilities)\n */\nexport const zPromptCapabilities = z.object({\n image: z.boolean().optional().default(false),\n audio: z.boolean().optional().default(false),\n embeddedContext: z.boolean().optional().default(false),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * MCP capabilities supported by the agent\n */\nexport const zMcpCapabilities = z.object({\n http: z.boolean().optional().default(false),\n sse: z.boolean().optional().default(false),\n acp: z.boolean().optional().default(false),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for the `session/list` method.\n *\n * By supplying `{}` it means that the agent supports listing of sessions.\n */\nexport const zSessionListCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for the `session/delete` method.\n *\n * Supplying `{}` means the agent supports deleting sessions from `session/list`.\n */\nexport const zSessionDeleteCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for additional session directories support.\n *\n * By supplying `{}` it means that the agent supports the `additionalDirectories`\n * field on supported session lifecycle requests. Agents that also support\n * `session/list` may return `SessionInfo.additionalDirectories` to report the\n * complete ordered additional-root list associated with a listed session.\n */\nexport const zSessionAdditionalDirectoriesCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Capabilities for the `session/fork` method.\n *\n * By supplying `{}` it means that the agent supports forking of sessions.\n *\n * @experimental\n */\nexport const zSessionForkCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for the `session/resume` method.\n *\n * By supplying `{}` it means that the agent supports resuming of sessions.\n */\nexport const zSessionResumeCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for the `session/close` method.\n *\n * By supplying `{}` it means that the agent supports closing of sessions.\n */\nexport const zSessionCloseCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Session capabilities supported by the agent.\n *\n * As a baseline, all Agents **MUST** support `session/new`, `session/prompt`, `session/cancel`, and `session/update`.\n *\n * Optionally, they **MAY** support other session methods and notifications by specifying additional capabilities.\n *\n * Note: `session/load` is still handled by the top-level `load_session` capability. This will be unified in future versions of the protocol.\n *\n * See protocol docs: [Session Capabilities](https://agentclientprotocol.com/protocol/initialization#session-capabilities)\n */\nexport const zSessionCapabilities = z.object({\n list: defaultOnError(zSessionListCapabilities.nullish(), () => undefined),\n delete: defaultOnError(zSessionDeleteCapabilities.nullish(), () => undefined),\n additionalDirectories: defaultOnError(zSessionAdditionalDirectoriesCapabilities.nullish(), () => undefined),\n fork: defaultOnError(zSessionForkCapabilities.nullish(), () => undefined),\n resume: defaultOnError(zSessionResumeCapabilities.nullish(), () => undefined),\n close: defaultOnError(zSessionCloseCapabilities.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Logout capabilities supported by the agent.\n *\n * By supplying `{}` it means that the agent supports the logout method.\n */\nexport const zLogoutCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Authentication-related capabilities supported by the agent.\n */\nexport const zAgentAuthCapabilities = z.object({\n logout: defaultOnError(zLogoutCapabilities.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Provider configuration capabilities supported by the agent.\n *\n * By supplying `{}` it means that the agent supports provider configuration methods.\n *\n * @experimental\n */\nexport const zProvidersCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Marker for `document/didOpen` capability support.\n */\nexport const zNesDocumentDidOpenCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * How the agent wants document changes delivered.\n */\nexport const zTextDocumentSyncKind = z.union([\n z.literal(\"full\"),\n z.literal(\"incremental\"),\n]);\n/**\n * Capabilities for `document/didChange` events.\n */\nexport const zNesDocumentDidChangeCapabilities = z.object({\n syncKind: zTextDocumentSyncKind,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Marker for `document/didClose` capability support.\n */\nexport const zNesDocumentDidCloseCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Marker for `document/didSave` capability support.\n */\nexport const zNesDocumentDidSaveCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Marker for `document/didFocus` capability support.\n */\nexport const zNesDocumentDidFocusCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Document event capabilities the agent wants to receive.\n */\nexport const zNesDocumentEventCapabilities = z.object({\n didOpen: defaultOnError(zNesDocumentDidOpenCapabilities.nullish(), () => undefined),\n didChange: defaultOnError(zNesDocumentDidChangeCapabilities.nullish(), () => undefined),\n didClose: defaultOnError(zNesDocumentDidCloseCapabilities.nullish(), () => undefined),\n didSave: defaultOnError(zNesDocumentDidSaveCapabilities.nullish(), () => undefined),\n didFocus: defaultOnError(zNesDocumentDidFocusCapabilities.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Event capabilities the agent can consume.\n */\nexport const zNesEventCapabilities = z.object({\n document: defaultOnError(zNesDocumentEventCapabilities.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for recent files context.\n */\nexport const zNesRecentFilesCapabilities = z.object({\n maxCount: z\n .int()\n .gte(0)\n .max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n })\n .nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for related snippets context.\n */\nexport const zNesRelatedSnippetsCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for edit history context.\n */\nexport const zNesEditHistoryCapabilities = z.object({\n maxCount: z\n .int()\n .gte(0)\n .max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n })\n .nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for user actions context.\n */\nexport const zNesUserActionsCapabilities = z.object({\n maxCount: z\n .int()\n .gte(0)\n .max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n })\n .nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for open files context.\n */\nexport const zNesOpenFilesCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities for diagnostics context.\n */\nexport const zNesDiagnosticsCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Context capabilities the agent wants attached to each suggestion request.\n */\nexport const zNesContextCapabilities = z.object({\n recentFiles: defaultOnError(zNesRecentFilesCapabilities.nullish(), () => undefined),\n relatedSnippets: defaultOnError(zNesRelatedSnippetsCapabilities.nullish(), () => undefined),\n editHistory: defaultOnError(zNesEditHistoryCapabilities.nullish(), () => undefined),\n userActions: defaultOnError(zNesUserActionsCapabilities.nullish(), () => undefined),\n openFiles: defaultOnError(zNesOpenFilesCapabilities.nullish(), () => undefined),\n diagnostics: defaultOnError(zNesDiagnosticsCapabilities.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * NES capabilities advertised by the agent during initialization.\n */\nexport const zNesCapabilities = z.object({\n events: defaultOnError(zNesEventCapabilities.nullish(), () => undefined),\n context: defaultOnError(zNesContextCapabilities.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * The encoding used for character offsets in positions.\n *\n * Follows the same conventions as LSP 3.17. The default is UTF-16.\n */\nexport const zPositionEncodingKind = z.union([\n z.literal(\"utf-16\"),\n z.literal(\"utf-32\"),\n z.literal(\"utf-8\"),\n]);\n/**\n * Capabilities supported by the agent.\n *\n * Advertised during initialization to inform the client about\n * available features and content types.\n *\n * See protocol docs: [Agent Capabilities](https://agentclientprotocol.com/protocol/initialization#agent-capabilities)\n */\nexport const zAgentCapabilities = z.object({\n loadSession: z.boolean().optional().default(false),\n promptCapabilities: zPromptCapabilities.optional().default({\n image: false,\n audio: false,\n embeddedContext: false,\n }),\n mcpCapabilities: zMcpCapabilities.optional().default({\n http: false,\n sse: false,\n acp: false,\n }),\n sessionCapabilities: zSessionCapabilities.optional().default({}),\n auth: zAgentAuthCapabilities.optional().default({}),\n providers: defaultOnError(zProvidersCapabilities.nullish(), () => undefined),\n nes: defaultOnError(zNesCapabilities.nullish(), () => undefined),\n positionEncoding: defaultOnError(zPositionEncodingKind.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Typed identifier used for auth method values on the wire.\n */\nexport const zAuthMethodId = z.string();\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Describes a single environment variable for an [`AuthMethodEnvVar`] authentication method.\n *\n * @experimental\n */\nexport const zAuthEnvVar = z.object({\n name: z.string(),\n label: z.string().nullish(),\n secret: z.boolean().optional().default(true),\n optional: z.boolean().optional().default(false),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Environment variable authentication method.\n *\n * The user provides credentials that the client passes to the agent as environment variables.\n *\n * @experimental\n */\nexport const zAuthMethodEnvVar = z.object({\n id: zAuthMethodId,\n name: z.string(),\n description: z.string().nullish(),\n vars: z.array(zAuthEnvVar),\n link: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Terminal-based authentication method.\n *\n * The client runs an interactive terminal for the user to authenticate via a TUI.\n *\n * @experimental\n */\nexport const zAuthMethodTerminal = z.object({\n id: zAuthMethodId,\n name: z.string(),\n description: z.string().nullish(),\n args: z.array(z.string()).optional(),\n env: z.record(z.string(), z.string()).optional(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Agent handles authentication itself.\n *\n * This is the default authentication method type.\n */\nexport const zAuthMethodAgent = z.object({\n id: zAuthMethodId,\n name: z.string(),\n description: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Describes an available authentication method.\n *\n * The `type` field acts as the discriminator in the serialized JSON form.\n * When no `type` is present, the method is treated as `agent`.\n */\nexport const zAuthMethod = z.union([\n zAuthMethodEnvVar.and(z.object({\n type: z.literal(\"env_var\"),\n })),\n zAuthMethodTerminal.and(z.object({\n type: z.literal(\"terminal\"),\n })),\n zAuthMethodAgent,\n]);\n/**\n * Metadata about the implementation of the client or agent.\n * Describes the name and version of an MCP implementation, with an optional\n * title for UI representation.\n */\nexport const zImplementation = z.object({\n name: z.string(),\n title: z.string().nullish(),\n version: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response to the `initialize` method.\n *\n * Contains the negotiated protocol version and agent capabilities.\n *\n * See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)\n */\nexport const zInitializeResponse = z.object({\n protocolVersion: zProtocolVersion,\n agentCapabilities: zAgentCapabilities.optional().default({\n loadSession: false,\n promptCapabilities: {\n image: false,\n audio: false,\n embeddedContext: false,\n },\n mcpCapabilities: {\n http: false,\n sse: false,\n acp: false,\n },\n sessionCapabilities: {},\n auth: {},\n }),\n authMethods: defaultOnError(vecSkipError(zAuthMethod).optional().default([]), () => []),\n agentInfo: defaultOnError(zImplementation.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response to the `authenticate` method.\n */\nexport const zAuthenticateResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Well-known API protocol identifiers for LLM providers.\n *\n * Agents and clients MUST handle unknown protocol identifiers gracefully.\n *\n * Protocol names beginning with `_` are free for custom use, like other ACP extension methods.\n * Protocol names that do not begin with `_` are reserved for the ACP spec.\n *\n * @experimental\n */\nexport const zLlmProtocol = z.union([\n z.literal(\"anthropic\"),\n z.literal(\"openai\"),\n z.literal(\"azure\"),\n z.literal(\"vertex\"),\n z.literal(\"bedrock\"),\n z.string(),\n]);\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Current effective non-secret routing configuration for a provider.\n *\n * @experimental\n */\nexport const zProviderCurrentConfig = z.object({\n apiType: zLlmProtocol,\n baseUrl: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Information about a configurable LLM provider.\n *\n * @experimental\n */\nexport const zProviderInfo = z.object({\n id: z.string(),\n supported: requiredDefaultOnError(vecSkipError(zLlmProtocol), () => []),\n required: z.boolean(),\n current: zProviderCurrentConfig.nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Response to `providers/list`.\n *\n * @experimental\n */\nexport const zListProvidersResponse = z.object({\n providers: requiredDefaultOnError(vecSkipError(zProviderInfo), () => []),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Response to `providers/set`.\n *\n * @experimental\n */\nexport const zSetProviderResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Response to `providers/disable`.\n *\n * @experimental\n */\nexport const zDisableProviderResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response to the `logout` method.\n */\nexport const zLogoutResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Unique identifier for a Session Mode.\n */\nexport const zSessionModeId = z.string();\n/**\n * A mode the agent can operate in.\n *\n * See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)\n */\nexport const zSessionMode = z.object({\n id: zSessionModeId,\n name: z.string(),\n description: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * The set of modes and the one currently active.\n */\nexport const zSessionModeState = z.object({\n currentModeId: zSessionModeId,\n availableModes: requiredDefaultOnError(vecSkipError(zSessionMode), () => []),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Unique identifier for a session configuration option.\n */\nexport const zSessionConfigId = z.string();\n/**\n * Semantic category for a session configuration option.\n *\n * This is intended to help Clients distinguish broadly common selectors (e.g. model selector vs\n * session mode selector vs thought/reasoning level) for UX purposes (keyboard shortcuts, icons,\n * placement). It MUST NOT be required for correctness. Clients MUST handle missing or unknown\n * categories gracefully.\n *\n * Category names beginning with `_` are free for custom use, like other ACP extension methods.\n * Category names that do not begin with `_` are reserved for the ACP spec.\n */\nexport const zSessionConfigOptionCategory = z.union([\n z.literal(\"mode\"),\n z.literal(\"model\"),\n z.literal(\"model_config\"),\n z.literal(\"thought_level\"),\n z.string(),\n]);\n/**\n * Unique identifier for a session configuration option value.\n */\nexport const zSessionConfigValueId = z.string();\n/**\n * A possible value for a session configuration option.\n */\nexport const zSessionConfigSelectOption = z.object({\n value: zSessionConfigValueId,\n name: z.string(),\n description: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Unique identifier for a session configuration option value group.\n */\nexport const zSessionConfigGroupId = z.string();\n/**\n * A group of possible values for a session configuration option.\n */\nexport const zSessionConfigSelectGroup = z.object({\n group: zSessionConfigGroupId,\n name: z.string(),\n options: z.array(zSessionConfigSelectOption),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Possible values for a session configuration option.\n */\nexport const zSessionConfigSelectOptions = z.union([\n z.array(zSessionConfigSelectOption),\n z.array(zSessionConfigSelectGroup),\n]);\n/**\n * A single-value selector (dropdown) session configuration option payload.\n */\nexport const zSessionConfigSelect = z.object({\n currentValue: zSessionConfigValueId,\n options: zSessionConfigSelectOptions,\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * A boolean on/off toggle session configuration option payload.\n *\n * @experimental\n */\nexport const zSessionConfigBoolean = z.object({\n currentValue: z.boolean(),\n});\n/**\n * A session configuration option selector and its current state.\n */\nexport const zSessionConfigOption = z.intersection(z.union([\n zSessionConfigSelect.and(z.object({\n type: z.literal(\"select\"),\n })),\n zSessionConfigBoolean.and(z.object({\n type: z.literal(\"boolean\"),\n })),\n]), z.object({\n id: zSessionConfigId,\n name: z.string(),\n description: z.string().nullish(),\n category: defaultOnError(zSessionConfigOptionCategory.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n}));\n/**\n * Response from creating a new session.\n *\n * See protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol/session-setup#creating-a-session)\n */\nexport const zNewSessionResponse = z.object({\n sessionId: zSessionId,\n modes: defaultOnError(zSessionModeState.nullish(), () => undefined),\n configOptions: defaultOnError(vecSkipError(zSessionConfigOption).nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response from loading an existing session.\n */\nexport const zLoadSessionResponse = z.object({\n modes: defaultOnError(zSessionModeState.nullish(), () => undefined),\n configOptions: defaultOnError(vecSkipError(zSessionConfigOption).nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Information about a session returned by session/list\n */\nexport const zSessionInfo = z.object({\n sessionId: zSessionId,\n cwd: z.string(),\n additionalDirectories: z.array(z.string()).optional(),\n title: defaultOnError(z.string().nullish(), () => undefined),\n updatedAt: defaultOnError(z.string().nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response from listing sessions.\n */\nexport const zListSessionsResponse = z.object({\n sessions: requiredDefaultOnError(vecSkipError(zSessionInfo), () => []),\n nextCursor: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response from deleting a session.\n */\nexport const zDeleteSessionResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Response from forking an existing session.\n *\n * @experimental\n */\nexport const zForkSessionResponse = z.object({\n sessionId: zSessionId,\n modes: defaultOnError(zSessionModeState.nullish(), () => undefined),\n configOptions: defaultOnError(vecSkipError(zSessionConfigOption).nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response from resuming an existing session.\n */\nexport const zResumeSessionResponse = z.object({\n modes: defaultOnError(zSessionModeState.nullish(), () => undefined),\n configOptions: defaultOnError(vecSkipError(zSessionConfigOption).nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response from closing a session.\n */\nexport const zCloseSessionResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response to `session/set_mode` method.\n */\nexport const zSetSessionModeResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response to `session/set_config_option` method.\n */\nexport const zSetSessionConfigOptionResponse = z.object({\n configOptions: requiredDefaultOnError(vecSkipError(zSessionConfigOption), () => []),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Reasons why an agent stops processing a prompt turn.\n *\n * See protocol docs: [Stop Reasons](https://agentclientprotocol.com/protocol/prompt-turn#stop-reasons)\n */\nexport const zStopReason = z.union([\n z.literal(\"end_turn\"),\n z.literal(\"max_tokens\"),\n z.literal(\"max_turn_requests\"),\n z.literal(\"refusal\"),\n z.literal(\"cancelled\"),\n]);\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Token usage information for a prompt turn.\n *\n * @experimental\n */\nexport const zUsage = z.object({\n totalTokens: z.number(),\n inputTokens: z.number(),\n outputTokens: z.number(),\n thoughtTokens: z.number().nullish(),\n cachedReadTokens: z.number().nullish(),\n cachedWriteTokens: z.number().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response from processing a user prompt.\n *\n * See protocol docs: [Check for Completion](https://agentclientprotocol.com/protocol/prompt-turn#4-check-for-completion)\n */\nexport const zPromptResponse = z.object({\n stopReason: zStopReason,\n usage: defaultOnError(zUsage.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response to `nes/start`.\n */\nexport const zStartNesResponse = z.object({\n sessionId: zSessionId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A zero-based position in a text document.\n *\n * The meaning of `character` depends on the negotiated position encoding.\n */\nexport const zPosition = z.object({\n line: z.int().gte(0).max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n }),\n character: z.int().gte(0).max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n }),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A range in a text document, expressed as start and end positions.\n */\nexport const zRange = z.object({\n start: zPosition,\n end: zPosition,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A text edit within a suggestion.\n */\nexport const zNesTextEdit = z.object({\n range: zRange,\n newText: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A text edit suggestion.\n */\nexport const zNesEditSuggestion = z.object({\n id: z.string(),\n uri: z.string(),\n edits: z.array(zNesTextEdit),\n cursorPosition: defaultOnError(zPosition.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A jump-to-location suggestion.\n */\nexport const zNesJumpSuggestion = z.object({\n id: z.string(),\n uri: z.string(),\n position: zPosition,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A rename symbol suggestion.\n */\nexport const zNesRenameSuggestion = z.object({\n id: z.string(),\n uri: z.string(),\n position: zPosition,\n newName: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A search-and-replace suggestion.\n */\nexport const zNesSearchAndReplaceSuggestion = z.object({\n id: z.string(),\n uri: z.string(),\n search: z.string(),\n replace: z.string(),\n isRegex: z.boolean().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A suggestion returned by the agent.\n */\nexport const zNesSuggestion = z.union([\n zNesEditSuggestion.and(z.object({\n kind: z.literal(\"edit\"),\n })),\n zNesJumpSuggestion.and(z.object({\n kind: z.literal(\"jump\"),\n })),\n zNesRenameSuggestion.and(z.object({\n kind: z.literal(\"rename\"),\n })),\n zNesSearchAndReplaceSuggestion.and(z.object({\n kind: z.literal(\"searchAndReplace\"),\n })),\n]);\n/**\n * Response to `nes/suggest`.\n */\nexport const zSuggestNesResponse = z.object({\n suggestions: requiredDefaultOnError(vecSkipError(zNesSuggestion), () => []),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response from closing an NES session.\n */\nexport const zCloseNesResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Allows for sending an arbitrary response to an [`ExtRequest`] that is not part of the ACP spec.\n * Extension methods provide a way to add custom functionality while maintaining\n * protocol compatibility.\n *\n * See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)\n */\nexport const zExtResponse = z.unknown();\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Response to `mcp/message`.\n *\n * This is the inner MCP response result payload. Any JSON value is valid.\n *\n * @experimental\n */\nexport const zMessageMcpResponse = z.unknown();\n/**\n * Predefined error codes for common JSON-RPC and ACP-specific errors.\n *\n * These codes follow the JSON-RPC 2.0 specification for standard errors\n * and use the reserved range (-32000 to -32099) for protocol-specific errors.\n */\nexport const zErrorCode = z.union([\n z.literal(-32700),\n z.literal(-32600),\n z.literal(-32601),\n z.literal(-32602),\n z.literal(-32603),\n z.literal(-32800),\n z.literal(-32000),\n z.literal(-32002),\n z.literal(-32042),\n z\n .int()\n .min(-2147483648, {\n error: \"Invalid value: Expected int32 to be >= -2147483648\",\n })\n .max(2147483647, {\n error: \"Invalid value: Expected int32 to be <= 2147483647\",\n }),\n]);\n/**\n * JSON-RPC error object.\n *\n * Represents an error that occurred during method execution, following the\n * JSON-RPC 2.0 error object specification with optional additional data.\n *\n * See protocol docs: [JSON-RPC Error Object](https://www.jsonrpc.org/specification#error_object)\n */\nexport const zError = z.object({\n code: zErrorCode,\n message: z.string(),\n data: z.unknown().optional(),\n});\n/**\n * A JSON-RPC response object.\n */\nexport const zAgentResponse = z.union([\n z.object({\n id: zRequestId,\n result: z.union([\n zInitializeResponse,\n zAuthenticateResponse,\n zListProvidersResponse,\n zSetProviderResponse,\n zDisableProviderResponse,\n zLogoutResponse,\n zNewSessionResponse,\n zLoadSessionResponse,\n zListSessionsResponse,\n zDeleteSessionResponse,\n zForkSessionResponse,\n zResumeSessionResponse,\n zCloseSessionResponse,\n zSetSessionModeResponse,\n zSetSessionConfigOptionResponse,\n zPromptResponse,\n zStartNesResponse,\n zSuggestNesResponse,\n zCloseNesResponse,\n zExtResponse,\n zMessageMcpResponse,\n ]),\n }),\n z.object({\n id: zRequestId,\n error: zError,\n }),\n]);\n/**\n * Unique identifier for a message within a session.\n */\nexport const zMessageId = z.string();\n/**\n * A streamed item of content\n */\nexport const zContentChunk = z.object({\n content: zContentBlock,\n messageId: zMessageId.nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Represents a tool call that the language model has requested.\n *\n * Tool calls are actions that the agent executes on behalf of the language model,\n * such as reading files, executing code, or fetching data from external sources.\n *\n * See protocol docs: [Tool Calls](https://agentclientprotocol.com/protocol/tool-calls)\n */\nexport const zToolCall = z.object({\n toolCallId: zToolCallId,\n title: z.string(),\n kind: zToolKind.optional(),\n status: zToolCallStatus.optional(),\n content: defaultOnError(vecSkipError(zToolCallContent).optional(), () => []),\n locations: defaultOnError(vecSkipError(zToolCallLocation).optional(), () => []),\n rawInput: z.unknown().optional(),\n rawOutput: z.unknown().optional(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Priority levels for plan entries.\n *\n * Used to indicate the relative importance or urgency of different\n * tasks in the execution plan.\n * See protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/agent-plan#plan-entries)\n */\nexport const zPlanEntryPriority = z.union([\n z.literal(\"high\"),\n z.literal(\"medium\"),\n z.literal(\"low\"),\n]);\n/**\n * Status of a plan entry in the execution flow.\n *\n * Tracks the lifecycle of each task from planning through completion.\n * See protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/agent-plan#plan-entries)\n */\nexport const zPlanEntryStatus = z.union([\n z.literal(\"pending\"),\n z.literal(\"in_progress\"),\n z.literal(\"completed\"),\n]);\n/**\n * A single entry in the execution plan.\n *\n * Represents a task or goal that the assistant intends to accomplish\n * as part of fulfilling the user's request.\n * See protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/agent-plan#plan-entries)\n */\nexport const zPlanEntry = z.object({\n content: z.string(),\n priority: zPlanEntryPriority,\n status: zPlanEntryStatus,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * An execution plan for accomplishing complex tasks.\n *\n * Plans consist of multiple entries representing individual tasks or goals.\n * Agents report plans to clients to provide visibility into their execution strategy.\n * Plans can evolve during execution as the agent discovers new requirements or completes tasks.\n *\n * See protocol docs: [Agent Plan](https://agentclientprotocol.com/protocol/agent-plan)\n */\nexport const zPlan = z.object({\n entries: requiredDefaultOnError(vecSkipError(zPlanEntry), () => []),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Unique identifier for a plan within a session.\n *\n * @experimental\n */\nexport const zPlanId = z.string();\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * A plan represented as structured entries.\n *\n * @experimental\n */\nexport const zPlanItems = z.object({\n id: zPlanId,\n entries: requiredDefaultOnError(vecSkipError(zPlanEntry), () => []),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * A plan represented by a file URI.\n *\n * @experimental\n */\nexport const zPlanFile = z.object({\n id: zPlanId,\n uri: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * A plan represented as raw markdown content.\n *\n * @experimental\n */\nexport const zPlanMarkdown = z.object({\n id: zPlanId,\n content: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Updated content for a plan.\n *\n * @experimental\n */\nexport const zPlanUpdateContent = z.union([\n zPlanItems.and(z.object({\n type: z.literal(\"items\"),\n })),\n zPlanFile.and(z.object({\n type: z.literal(\"file\"),\n })),\n zPlanMarkdown.and(z.object({\n type: z.literal(\"markdown\"),\n })),\n]);\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * A content update for a plan identified by ID.\n *\n * @experimental\n */\nexport const zPlanUpdate = z.object({\n plan: zPlanUpdateContent,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Removal notice for a plan identified by ID.\n *\n * @experimental\n */\nexport const zPlanRemoved = z.object({\n id: zPlanId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * All text that was typed after the command name is provided as input.\n */\nexport const zUnstructuredCommandInput = z.object({\n hint: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * unstructured\n *\n * All text that was typed after the command name is provided as input.\n */\nexport const zAvailableCommandInput = zUnstructuredCommandInput;\n/**\n * Information about a command.\n */\nexport const zAvailableCommand = z.object({\n name: z.string(),\n description: z.string(),\n input: defaultOnError(zAvailableCommandInput.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Available commands are ready or have changed\n */\nexport const zAvailableCommandsUpdate = z.object({\n availableCommands: requiredDefaultOnError(vecSkipError(zAvailableCommand), () => []),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * The current mode of the session has changed\n *\n * See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)\n */\nexport const zCurrentModeUpdate = z.object({\n currentModeId: zSessionModeId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Session configuration options have been updated.\n */\nexport const zConfigOptionUpdate = z.object({\n configOptions: requiredDefaultOnError(vecSkipError(zSessionConfigOption), () => []),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Update to session metadata. All fields are optional to support partial updates.\n *\n * Agents send this notification to update session information like title or custom metadata.\n * This allows clients to display dynamic session names and track session state changes.\n */\nexport const zSessionInfoUpdate = z.object({\n title: z.string().nullish(),\n updatedAt: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Cost information for a session.\n */\nexport const zCost = z.object({\n amount: z.number(),\n currency: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Context window and cost update for a session.\n */\nexport const zUsageUpdate = z.object({\n used: z.number(),\n size: z.number(),\n cost: defaultOnError(zCost.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Different types of updates that can be sent during session processing.\n *\n * These updates provide real-time feedback about the agent's progress.\n *\n * See protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)\n */\nexport const zSessionUpdate = z.union([\n zContentChunk.and(z.object({\n sessionUpdate: z.literal(\"user_message_chunk\"),\n })),\n zContentChunk.and(z.object({\n sessionUpdate: z.literal(\"agent_message_chunk\"),\n })),\n zContentChunk.and(z.object({\n sessionUpdate: z.literal(\"agent_thought_chunk\"),\n })),\n zToolCall.and(z.object({\n sessionUpdate: z.literal(\"tool_call\"),\n })),\n zToolCallUpdate.and(z.object({\n sessionUpdate: z.literal(\"tool_call_update\"),\n })),\n zPlan.and(z.object({\n sessionUpdate: z.literal(\"plan\"),\n })),\n zPlanUpdate.and(z.object({\n sessionUpdate: z.literal(\"plan_update\"),\n })),\n zPlanRemoved.and(z.object({\n sessionUpdate: z.literal(\"plan_removed\"),\n })),\n zAvailableCommandsUpdate.and(z.object({\n sessionUpdate: z.literal(\"available_commands_update\"),\n })),\n zCurrentModeUpdate.and(z.object({\n sessionUpdate: z.literal(\"current_mode_update\"),\n })),\n zConfigOptionUpdate.and(z.object({\n sessionUpdate: z.literal(\"config_option_update\"),\n })),\n zSessionInfoUpdate.and(z.object({\n sessionUpdate: z.literal(\"session_info_update\"),\n })),\n zUsageUpdate.and(z.object({\n sessionUpdate: z.literal(\"usage_update\"),\n })),\n]);\n/**\n * Notification containing a session update from the agent.\n *\n * Used to stream real-time progress and results during prompt processing.\n *\n * See protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)\n */\nexport const zSessionNotification = z.object({\n sessionId: zSessionId,\n update: zSessionUpdate,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notification sent by the agent when a URL-based elicitation is complete.\n *\n * @experimental\n */\nexport const zCompleteElicitationNotification = z.object({\n elicitationId: zElicitationId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notification parameters for `mcp/message`.\n *\n * This is used when the wrapped MCP message is a notification and the outer JSON-RPC\n * envelope has no `id`.\n *\n * @experimental\n */\nexport const zMessageMcpNotification = z.object({\n connectionId: zMcpConnectionId,\n method: z.string(),\n params: z.record(z.string(), z.unknown()).nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Allows the Agent to send an arbitrary notification that is not part of the ACP spec.\n * Extension notifications provide a way to send one-way messages for custom functionality\n * while maintaining protocol compatibility.\n *\n * See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)\n */\nexport const zExtNotification = z.unknown();\n/**\n * A JSON-RPC notification object.\n */\nexport const zAgentNotification = z.object({\n method: z.string(),\n params: z\n .union([\n zSessionNotification,\n zCompleteElicitationNotification,\n zMessageMcpNotification,\n zExtNotification,\n ])\n .nullish(),\n});\n/**\n * File system capabilities that a client may support.\n *\n * See protocol docs: [FileSystem](https://agentclientprotocol.com/protocol/initialization#filesystem)\n */\nexport const zFileSystemCapabilities = z.object({\n readTextFile: z.boolean().optional().default(false),\n writeTextFile: z.boolean().optional().default(false),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Capabilities for boolean session configuration options.\n *\n * Supplying `{}` means the client supports boolean session configuration options.\n *\n * @experimental\n */\nexport const zBooleanConfigOptionCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Session configuration option capabilities supported by the client.\n *\n * @experimental\n */\nexport const zSessionConfigOptionsCapabilities = z.object({\n boolean: defaultOnError(zBooleanConfigOptionCapabilities.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Session-related capabilities supported by the client.\n *\n * @experimental\n */\nexport const zClientSessionCapabilities = z.object({\n configOptions: defaultOnError(zSessionConfigOptionsCapabilities.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Capabilities for receiving `plan_update` and `plan_removed` session updates.\n *\n * @experimental\n */\nexport const zPlanCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Authentication capabilities supported by the client.\n *\n * Advertised during initialization to inform the agent which authentication\n * method types the client can handle. This governs opt-in types that require\n * additional client-side support.\n *\n * @experimental\n */\nexport const zAuthCapabilities = z.object({\n terminal: z.boolean().optional().default(false),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Form-based elicitation capabilities.\n *\n * @experimental\n */\nexport const zElicitationFormCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * URL-based elicitation capabilities.\n *\n * @experimental\n */\nexport const zElicitationUrlCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Elicitation capabilities supported by the client.\n *\n * @experimental\n */\nexport const zElicitationCapabilities = z.object({\n form: defaultOnError(zElicitationFormCapabilities.nullish(), () => undefined),\n url: defaultOnError(zElicitationUrlCapabilities.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Marker for jump suggestion support.\n */\nexport const zNesJumpCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Marker for rename suggestion support.\n */\nexport const zNesRenameCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Marker for search and replace suggestion support.\n */\nexport const zNesSearchAndReplaceCapabilities = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * NES capabilities advertised by the client during initialization.\n */\nexport const zClientNesCapabilities = z.object({\n jump: defaultOnError(zNesJumpCapabilities.nullish(), () => undefined),\n rename: defaultOnError(zNesRenameCapabilities.nullish(), () => undefined),\n searchAndReplace: defaultOnError(zNesSearchAndReplaceCapabilities.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Capabilities supported by the client.\n *\n * Advertised during initialization to inform the agent about\n * available features and methods.\n *\n * See protocol docs: [Client Capabilities](https://agentclientprotocol.com/protocol/initialization#client-capabilities)\n */\nexport const zClientCapabilities = z.object({\n fs: zFileSystemCapabilities\n .optional()\n .default({ readTextFile: false, writeTextFile: false }),\n terminal: z.boolean().optional().default(false),\n session: defaultOnError(zClientSessionCapabilities.nullish(), () => undefined),\n plan: defaultOnError(zPlanCapabilities.nullish(), () => undefined),\n auth: zAuthCapabilities.optional().default({ terminal: false }),\n elicitation: defaultOnError(zElicitationCapabilities.nullish(), () => undefined),\n nes: defaultOnError(zClientNesCapabilities.nullish(), () => undefined),\n positionEncodings: defaultOnError(vecSkipError(zPositionEncodingKind).optional(), () => []),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request parameters for the initialize method.\n *\n * Sent by the client to establish connection and negotiate capabilities.\n *\n * See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)\n */\nexport const zInitializeRequest = z.object({\n protocolVersion: zProtocolVersion,\n clientCapabilities: zClientCapabilities.optional().default({\n fs: { readTextFile: false, writeTextFile: false },\n terminal: false,\n auth: { terminal: false },\n }),\n clientInfo: defaultOnError(zImplementation.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request parameters for the authenticate method.\n *\n * Specifies which authentication method to use.\n */\nexport const zAuthenticateRequest = z.object({\n methodId: zAuthMethodId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Request parameters for `providers/list`.\n *\n * @experimental\n */\nexport const zListProvidersRequest = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Request parameters for `providers/set`.\n *\n * Replaces the full configuration for one provider id.\n *\n * @experimental\n */\nexport const zSetProviderRequest = z.object({\n id: z.string(),\n apiType: zLlmProtocol,\n baseUrl: z.string(),\n headers: z.record(z.string(), z.string()).optional(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Request parameters for `providers/disable`.\n *\n * @experimental\n */\nexport const zDisableProviderRequest = z.object({\n id: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request parameters for the logout method.\n *\n * Terminates the current authenticated session.\n */\nexport const zLogoutRequest = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * An HTTP header to set when making requests to the MCP server.\n */\nexport const zHttpHeader = z.object({\n name: z.string(),\n value: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * HTTP transport configuration for MCP.\n */\nexport const zMcpServerHttp = z.object({\n name: z.string(),\n url: z.string(),\n headers: z.array(zHttpHeader),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * SSE transport configuration for MCP.\n */\nexport const zMcpServerSse = z.object({\n name: z.string(),\n url: z.string(),\n headers: z.array(zHttpHeader),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * ACP transport configuration for MCP.\n *\n * The MCP server is provided by an ACP component and communicates over the ACP channel\n * using `mcp/connect`, `mcp/message`, and `mcp/disconnect`.\n *\n * @experimental\n */\nexport const zMcpServerAcp = z.object({\n name: z.string(),\n id: zMcpServerAcpId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Stdio transport configuration for MCP.\n */\nexport const zMcpServerStdio = z.object({\n name: z.string(),\n command: z.string(),\n args: z.array(z.string()),\n env: z.array(zEnvVariable),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Configuration for connecting to an MCP (Model Context Protocol) server.\n *\n * MCP servers provide tools and context that the agent can use when\n * processing prompts.\n *\n * See protocol docs: [MCP Servers](https://agentclientprotocol.com/protocol/session-setup#mcp-servers)\n */\nexport const zMcpServer = z.union([\n zMcpServerHttp.and(z.object({\n type: z.literal(\"http\"),\n })),\n zMcpServerSse.and(z.object({\n type: z.literal(\"sse\"),\n })),\n zMcpServerAcp.and(z.object({\n type: z.literal(\"acp\"),\n })),\n zMcpServerStdio,\n]);\n/**\n * Request parameters for creating a new session.\n *\n * See protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol/session-setup#creating-a-session)\n */\nexport const zNewSessionRequest = z.object({\n cwd: z.string(),\n additionalDirectories: z.array(z.string()).optional(),\n mcpServers: z.array(zMcpServer),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request parameters for loading an existing session.\n *\n * Only available if the Agent supports the `loadSession` capability.\n *\n * See protocol docs: [Loading Sessions](https://agentclientprotocol.com/protocol/session-setup#loading-sessions)\n */\nexport const zLoadSessionRequest = z.object({\n mcpServers: z.array(zMcpServer),\n cwd: z.string(),\n additionalDirectories: z.array(z.string()).optional(),\n sessionId: zSessionId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request parameters for listing existing sessions.\n *\n * Only available if the Agent supports the `sessionCapabilities.list` capability.\n */\nexport const zListSessionsRequest = z.object({\n cwd: z.string().nullish(),\n cursor: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request parameters for deleting an existing session from `session/list`.\n *\n * Only available if the Agent supports the `sessionCapabilities.delete` capability.\n */\nexport const zDeleteSessionRequest = z.object({\n sessionId: zSessionId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Request parameters for forking an existing session.\n *\n * Creates a new session based on the context of an existing one, allowing\n * operations like generating summaries without affecting the original session's history.\n *\n * Only available if the Agent supports the `session.fork` capability.\n *\n * @experimental\n */\nexport const zForkSessionRequest = z.object({\n sessionId: zSessionId,\n cwd: z.string(),\n additionalDirectories: z.array(z.string()).optional(),\n mcpServers: z.array(zMcpServer).optional(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request parameters for resuming an existing session.\n *\n * Resumes an existing session without returning previous messages (unlike `session/load`).\n * This is useful for agents that can resume sessions but don't implement full session loading.\n *\n * Only available if the Agent supports the `sessionCapabilities.resume` capability.\n */\nexport const zResumeSessionRequest = z.object({\n sessionId: zSessionId,\n cwd: z.string(),\n additionalDirectories: z.array(z.string()).optional(),\n mcpServers: z.array(zMcpServer).optional(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request parameters for closing an active session.\n *\n * If supported, the agent **must** cancel any ongoing work related to the session\n * (treat it as if `session/cancel` was called) and then free up any resources\n * associated with the session.\n *\n * Only available if the Agent supports the `sessionCapabilities.close` capability.\n */\nexport const zCloseSessionRequest = z.object({\n sessionId: zSessionId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request parameters for setting a session mode.\n */\nexport const zSetSessionModeRequest = z.object({\n sessionId: zSessionId,\n modeId: zSessionModeId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request parameters for setting a session configuration option.\n */\nexport const zSetSessionConfigOptionRequest = z.intersection(z.union([\n z.object({\n value: z.boolean(),\n type: z.literal(\"boolean\"),\n }),\n z.object({\n value: zSessionConfigValueId,\n }),\n]), z.object({\n sessionId: zSessionId,\n configId: zSessionConfigId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n}));\n/**\n * Request parameters for sending a user prompt to the agent.\n *\n * Contains the user's message and any additional context.\n *\n * See protocol docs: [User Message](https://agentclientprotocol.com/protocol/prompt-turn#1-user-message)\n */\nexport const zPromptRequest = z.object({\n sessionId: zSessionId,\n prompt: z.array(zContentBlock),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A workspace folder.\n */\nexport const zWorkspaceFolder = z.object({\n uri: z.string(),\n name: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Repository metadata for an NES session.\n */\nexport const zNesRepository = z.object({\n name: z.string(),\n owner: z.string(),\n remoteUrl: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request to start an NES session.\n */\nexport const zStartNesRequest = z.object({\n workspaceUri: z.string().nullish(),\n workspaceFolders: defaultOnError(vecSkipError(zWorkspaceFolder).nullish(), () => undefined),\n repository: defaultOnError(zNesRepository.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * What triggered the suggestion request.\n */\nexport const zNesTriggerKind = z.union([\n z.literal(\"automatic\"),\n z.literal(\"diagnostic\"),\n z.literal(\"manual\"),\n]);\n/**\n * A recently accessed file.\n */\nexport const zNesRecentFile = z.object({\n uri: z.string(),\n languageId: z.string(),\n text: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A code excerpt from a file.\n */\nexport const zNesExcerpt = z.object({\n startLine: z.int().gte(0).max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n }),\n endLine: z.int().gte(0).max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n }),\n text: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A related code snippet from a file.\n */\nexport const zNesRelatedSnippet = z.object({\n uri: z.string(),\n excerpts: z.array(zNesExcerpt),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * An entry in the edit history.\n */\nexport const zNesEditHistoryEntry = z.object({\n uri: z.string(),\n diff: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A user action (typing, cursor movement, etc.).\n */\nexport const zNesUserAction = z.object({\n action: z.string(),\n uri: z.string(),\n position: zPosition,\n timestampMs: z.number(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * An open file in the editor.\n */\nexport const zNesOpenFile = z.object({\n uri: z.string(),\n languageId: z.string(),\n visibleRange: defaultOnError(zRange.nullish(), () => undefined),\n lastFocusedMs: defaultOnError(z.number().nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Severity of a diagnostic.\n */\nexport const zNesDiagnosticSeverity = z.union([\n z.literal(\"error\"),\n z.literal(\"warning\"),\n z.literal(\"information\"),\n z.literal(\"hint\"),\n]);\n/**\n * A diagnostic (error, warning, etc.).\n */\nexport const zNesDiagnostic = z.object({\n uri: z.string(),\n range: zRange,\n severity: zNesDiagnosticSeverity,\n message: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Context attached to a suggestion request.\n */\nexport const zNesSuggestContext = z.object({\n recentFiles: defaultOnError(vecSkipError(zNesRecentFile).nullish(), () => undefined),\n relatedSnippets: defaultOnError(vecSkipError(zNesRelatedSnippet).nullish(), () => undefined),\n editHistory: defaultOnError(vecSkipError(zNesEditHistoryEntry).nullish(), () => undefined),\n userActions: defaultOnError(vecSkipError(zNesUserAction).nullish(), () => undefined),\n openFiles: defaultOnError(vecSkipError(zNesOpenFile).nullish(), () => undefined),\n diagnostics: defaultOnError(vecSkipError(zNesDiagnostic).nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request for a code suggestion.\n */\nexport const zSuggestNesRequest = z.object({\n sessionId: zSessionId,\n uri: z.string(),\n version: z.number(),\n position: zPosition,\n selection: defaultOnError(zRange.nullish(), () => undefined),\n triggerKind: zNesTriggerKind,\n context: defaultOnError(zNesSuggestContext.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Request to close an NES session.\n *\n * The agent **must** cancel any ongoing work related to the NES session\n * and then free up any resources associated with the session.\n */\nexport const zCloseNesRequest = z.object({\n sessionId: zSessionId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A JSON-RPC request object.\n */\nexport const zClientRequest = z.object({\n id: zRequestId,\n method: z.string(),\n params: z\n .union([\n zInitializeRequest,\n zAuthenticateRequest,\n zListProvidersRequest,\n zSetProviderRequest,\n zDisableProviderRequest,\n zLogoutRequest,\n zNewSessionRequest,\n zLoadSessionRequest,\n zListSessionsRequest,\n zDeleteSessionRequest,\n zForkSessionRequest,\n zResumeSessionRequest,\n zCloseSessionRequest,\n zSetSessionModeRequest,\n zSetSessionConfigOptionRequest,\n zPromptRequest,\n zStartNesRequest,\n zSuggestNesRequest,\n zCloseNesRequest,\n zMessageMcpRequest,\n zExtRequest,\n ])\n .nullish(),\n});\n/**\n * Response to `fs/write_text_file`\n */\nexport const zWriteTextFileResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response containing the contents of a text file.\n */\nexport const zReadTextFileResponse = z.object({\n content: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * The user selected one of the provided options.\n */\nexport const zSelectedPermissionOutcome = z.object({\n optionId: zPermissionOptionId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * The outcome of a permission request.\n */\nexport const zRequestPermissionOutcome = z.union([\n z.object({\n outcome: z.literal(\"cancelled\"),\n }),\n zSelectedPermissionOutcome.and(z.object({\n outcome: z.literal(\"selected\"),\n })),\n]);\n/**\n * Response to a permission request.\n */\nexport const zRequestPermissionResponse = z.object({\n outcome: zRequestPermissionOutcome,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response containing the ID of the created terminal.\n */\nexport const zCreateTerminalResponse = z.object({\n terminalId: zTerminalId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Exit status of a terminal command.\n */\nexport const zTerminalExitStatus = z.object({\n exitCode: z\n .int()\n .gte(0)\n .max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n })\n .nullish(),\n signal: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response containing the terminal output and exit status.\n */\nexport const zTerminalOutputResponse = z.object({\n output: z.string(),\n truncated: z.boolean(),\n exitStatus: zTerminalExitStatus.nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response to terminal/release method\n */\nexport const zReleaseTerminalResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response containing the exit status of a terminal command.\n */\nexport const zWaitForTerminalExitResponse = z.object({\n exitCode: z\n .int()\n .gte(0)\n .max(4294967295, {\n error: \"Invalid value: Expected uint32 to be <= 4294967295\",\n })\n .nullish(),\n signal: z.string().nullish(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Response to `terminal/kill` method\n */\nexport const zKillTerminalResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Allowed wire representations for [`ElicitationContentValue`].\n */\nexport const zElicitationContentValue = z.union([\n z.string(),\n z.number(),\n z.number(),\n z.boolean(),\n z.array(z.string()),\n]);\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * The user accepted the elicitation and provided content.\n *\n * @experimental\n */\nexport const zElicitationAcceptAction = z.object({\n content: z.record(z.string(), zElicitationContentValue).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Response from the client to an elicitation request.\n *\n * @experimental\n */\nexport const zCreateElicitationResponse = z.intersection(z.union([\n zElicitationAcceptAction.and(z.object({\n action: z.literal(\"accept\"),\n })),\n z.object({\n action: z.literal(\"decline\"),\n }),\n z.object({\n action: z.literal(\"cancel\"),\n }),\n]), z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n}));\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Response to `mcp/connect`.\n *\n * @experimental\n */\nexport const zConnectMcpResponse = z.object({\n connectionId: zMcpConnectionId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Response to `mcp/disconnect`.\n *\n * @experimental\n */\nexport const zDisconnectMcpResponse = z.object({\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A JSON-RPC response object.\n */\nexport const zClientResponse = z.union([\n z.object({\n id: zRequestId,\n result: z.union([\n zWriteTextFileResponse,\n zReadTextFileResponse,\n zRequestPermissionResponse,\n zCreateTerminalResponse,\n zTerminalOutputResponse,\n zReleaseTerminalResponse,\n zWaitForTerminalExitResponse,\n zKillTerminalResponse,\n zCreateElicitationResponse,\n zConnectMcpResponse,\n zDisconnectMcpResponse,\n zExtResponse,\n zMessageMcpResponse,\n ]),\n }),\n z.object({\n id: zRequestId,\n error: zError,\n }),\n]);\n/**\n * Notification to cancel ongoing operations for a session.\n *\n * See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation)\n */\nexport const zCancelNotification = z.object({\n sessionId: zSessionId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Notification sent when a file is opened in the editor.\n */\nexport const zDidOpenDocumentNotification = z.object({\n sessionId: zSessionId,\n uri: z.string(),\n languageId: z.string(),\n version: z.number(),\n text: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A content change event for a document.\n *\n * When `range` is `None`, `text` is the full content of the document.\n * When `range` is `Some`, `text` replaces the given range.\n */\nexport const zTextDocumentContentChangeEvent = z.object({\n range: zRange.nullish(),\n text: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Notification sent when a file is edited.\n */\nexport const zDidChangeDocumentNotification = z.object({\n sessionId: zSessionId,\n uri: z.string(),\n version: z.number(),\n contentChanges: z.array(zTextDocumentContentChangeEvent),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Notification sent when a file is closed.\n */\nexport const zDidCloseDocumentNotification = z.object({\n sessionId: zSessionId,\n uri: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Notification sent when a file is saved.\n */\nexport const zDidSaveDocumentNotification = z.object({\n sessionId: zSessionId,\n uri: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Notification sent when a file becomes the active editor tab.\n */\nexport const zDidFocusDocumentNotification = z.object({\n sessionId: zSessionId,\n uri: z.string(),\n version: z.number(),\n position: zPosition,\n visibleRange: zRange,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * Notification sent when a suggestion is accepted.\n */\nexport const zAcceptNesNotification = z.object({\n sessionId: zSessionId,\n id: z.string(),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * The reason a suggestion was rejected.\n */\nexport const zNesRejectReason = z.union([\n z.literal(\"rejected\"),\n z.literal(\"ignored\"),\n z.literal(\"replaced\"),\n z.literal(\"cancelled\"),\n]);\n/**\n * Notification sent when a suggestion is rejected.\n */\nexport const zRejectNesNotification = z.object({\n sessionId: zSessionId,\n id: z.string(),\n reason: defaultOnError(zNesRejectReason.nullish(), () => undefined),\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n/**\n * A JSON-RPC notification object.\n */\nexport const zClientNotification = z.object({\n method: z.string(),\n params: z\n .union([\n zCancelNotification,\n zDidOpenDocumentNotification,\n zDidChangeDocumentNotification,\n zDidCloseDocumentNotification,\n zDidSaveDocumentNotification,\n zDidFocusDocumentNotification,\n zAcceptNesNotification,\n zRejectNesNotification,\n zMessageMcpNotification,\n zExtNotification,\n ])\n .nullish(),\n});\n/**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notification to cancel an ongoing request.\n *\n * See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)\n *\n * @experimental\n */\nexport const zCancelRequestNotification = z.object({\n requestId: zRequestId,\n _meta: z.record(z.string(), z.unknown()).nullish(),\n});\n//# sourceMappingURL=zod.gen.js.map","/**\n * Creates an ACP Stream from a pair of newline-delimited JSON streams.\n *\n * This is the typical way to handle ACP connections over stdio, converting\n * between AnyMessage objects and newline-delimited JSON.\n *\n * @param output - The writable stream to send encoded messages to\n * @param input - The readable stream to receive encoded messages from\n * @returns A Stream for bidirectional ACP communication\n */\nexport function ndJsonStream(output, input) {\n const textEncoder = new TextEncoder();\n const textDecoder = new TextDecoder();\n let cancelled = false;\n let inputReader;\n const readable = new ReadableStream({\n async start(controller) {\n let content = \"\";\n const reader = input.getReader();\n inputReader = reader;\n try {\n while (true) {\n const { value, done } = await reader.read();\n if (cancelled) {\n return;\n }\n if (done) {\n content += textDecoder.decode();\n break;\n }\n if (!value) {\n continue;\n }\n content += textDecoder.decode(value, { stream: true });\n const lines = content.split(\"\\n\");\n content = lines.pop() || \"\";\n for (const line of lines) {\n if (cancelled) {\n return;\n }\n const trimmedLine = line.trim();\n if (trimmedLine) {\n try {\n const message = JSON.parse(trimmedLine);\n controller.enqueue(message);\n }\n catch (err) {\n console.error(\"Failed to parse JSON message:\", trimmedLine, err);\n }\n }\n }\n }\n if (cancelled) {\n return;\n }\n const trimmedLine = content.trim();\n if (trimmedLine) {\n try {\n const message = JSON.parse(trimmedLine);\n controller.enqueue(message);\n }\n catch (err) {\n console.error(\"Failed to parse JSON message:\", trimmedLine, err);\n }\n }\n }\n catch (err) {\n if (cancelled) {\n return;\n }\n controller.error(err);\n return;\n }\n finally {\n if (inputReader === reader) {\n inputReader = undefined;\n }\n reader.releaseLock();\n }\n if (cancelled) {\n return;\n }\n controller.close();\n },\n cancel(reason) {\n cancelled = true;\n return inputReader?.cancel(reason);\n },\n });\n const writable = new WritableStream({\n async write(message) {\n const content = JSON.stringify(message) + \"\\n\";\n const writer = output.getWriter();\n try {\n await writer.write(textEncoder.encode(content));\n }\n finally {\n writer.releaseLock();\n }\n },\n });\n return { readable, writable };\n}\n//# sourceMappingURL=stream.js.map","const CANCEL_REQUEST_METHOD = \"$/cancel_request\";\nexport function isJsonRpcMessage(value) {\n return (isRequestMessage(value) ||\n isResponseMessage(value) ||\n isNotificationMessage(value));\n}\nexport function isRequestMessage(value) {\n return (isJsonRpcEnvelope(value) &&\n \"id\" in value &&\n typeof value[\"method\"] === \"string\" &&\n isJsonRpcId(value[\"id\"]));\n}\nexport function isResponseMessage(value) {\n if (!isJsonRpcEnvelope(value) || \"method\" in value) {\n return false;\n }\n if (!(\"id\" in value) || !isJsonRpcId(value[\"id\"])) {\n return false;\n }\n const hasResult = Object.hasOwn(value, \"result\");\n const hasError = Object.hasOwn(value, \"error\");\n if (hasResult === hasError) {\n return false;\n }\n return !hasError || isErrorResponse(value[\"error\"]);\n}\nexport function isNotificationMessage(value) {\n return (isJsonRpcEnvelope(value) &&\n !(\"id\" in value) &&\n typeof value[\"method\"] === \"string\");\n}\nexport function isRecord(value) {\n return typeof value === \"object\" && value !== null;\n}\nfunction isJsonRpcEnvelope(value) {\n return isRecord(value) && value[\"jsonrpc\"] === \"2.0\";\n}\nfunction isJsonRpcId(value) {\n return (value === null ||\n typeof value === \"string\" ||\n (typeof value === \"number\" && Number.isFinite(value)));\n}\nfunction cancelRequestId(params) {\n if (!isRecord(params) || !isJsonRpcId(params[\"requestId\"])) {\n return undefined;\n }\n return params[\"requestId\"];\n}\nfunction isErrorResponse(value) {\n return (isRecord(value) &&\n typeof value[\"code\"] === \"number\" &&\n Number.isInteger(value[\"code\"]) &&\n typeof value[\"message\"] === \"string\");\n}\n/**\n * Helpers for constructing `HandleResult` values.\n */\nexport const Handled = {\n /**\n * Marks a message as handled.\n */\n yes() {\n return { handled: true };\n },\n /**\n * Leaves a message unhandled so later handlers can process it.\n */\n no(message, retry = false) {\n return { handled: false, message, retry };\n },\n};\nfunction rejectedPromise(error) {\n const promise = Promise.reject(error);\n promise.catch(() => { });\n return promise;\n}\nfunction errorDetails(error) {\n if (error instanceof Error) {\n return error.message;\n }\n if (typeof error === \"object\" &&\n error != null &&\n \"message\" in error &&\n typeof error.message === \"string\") {\n return error.message;\n }\n return undefined;\n}\nfunction isZodError(error) {\n return (typeof error === \"object\" &&\n error !== null &&\n \"name\" in error &&\n error.name === \"ZodError\" &&\n \"issues\" in error &&\n Array.isArray(error.issues) &&\n \"format\" in error &&\n typeof error.format === \"function\");\n}\nfunction errorToResult(error) {\n if (error instanceof RequestError) {\n return error.toResult();\n }\n if (isZodError(error)) {\n return RequestError.invalidParams(error.format()).toResult();\n }\n const details = errorDetails(error);\n try {\n return RequestError.internalError(details ? JSON.parse(details) : {}).toResult();\n }\n catch {\n return RequestError.internalError({ details }).toResult();\n }\n}\nfunction requestCancelledError(reason) {\n if (reason instanceof RequestError && reason.code === -32800) {\n return reason;\n }\n return RequestError.requestCancelled(reason);\n}\nfunction errorToRequestResult(error, signal) {\n const requestCancelled = abortErrorToRequestCancelled(error, signal);\n return requestCancelled ? requestCancelled.toResult() : errorToResult(error);\n}\nfunction abortErrorToRequestCancelled(error, signal) {\n if (!signal.aborted || !isAbortError(error)) {\n return undefined;\n }\n return requestCancelledError(signal.reason);\n}\nfunction isAbortError(error) {\n if (typeof error !== \"object\" || error === null) {\n return false;\n }\n const maybeAbortError = error;\n return (maybeAbortError.name === \"AbortError\" ||\n maybeAbortError.code === \"ABORT_ERR\");\n}\n/**\n * Responder for one incoming JSON-RPC request.\n *\n * Handlers may use this when they need to decide exactly when or how the\n * response is sent.\n */\nexport class RequestResponder {\n id;\n sendResult;\n signal;\n finishRequest;\n didRespond = false;\n constructor(\n /**\n * Request ID to include in the response.\n */\n id, sendResult, \n /**\n * AbortSignal for this incoming request.\n */\n signal = new AbortController().signal, finishRequest) {\n this.id = id;\n this.sendResult = sendResult;\n this.signal = signal;\n this.finishRequest = finishRequest;\n }\n /**\n * Whether this request has already received a response.\n */\n get responded() {\n return this.didRespond;\n }\n /**\n * Sends a successful JSON-RPC response.\n */\n respond(response) {\n return this.respondWithResult({ result: (response ?? null) });\n }\n /**\n * Sends an error JSON-RPC response.\n */\n respondWithError(error) {\n const errorResponse = error instanceof RequestError ? error.toErrorResponse() : error;\n return this.respondWithResult({ error: errorResponse });\n }\n /**\n * Sends a complete JSON-RPC result payload.\n */\n respondWithResult(result) {\n if (this.didRespond) {\n return rejectedPromise(new Error(\"JSON-RPC request already responded\"));\n }\n this.didRespond = true;\n return this.sendResult(result).finally(() => {\n this.finishRequest?.();\n });\n }\n}\n/**\n * Disposable handle returned when a handler is registered dynamically.\n */\nexport class HandlerRegistration {\n disposeHandler;\n active = true;\n constructor(disposeHandler) {\n this.disposeHandler = disposeHandler;\n }\n /**\n * Unregisters the associated handler.\n */\n dispose() {\n if (!this.active) {\n return;\n }\n this.active = false;\n this.disposeHandler();\n }\n /**\n * Supports explicit resource management with `using`.\n */\n [Symbol.dispose]() {\n this.dispose();\n }\n /**\n * Returns this registration for call sites that intentionally keep it active.\n */\n runIndefinitely() {\n return this;\n }\n}\n/**\n * Per-connection context passed to low-level JSON-RPC handlers.\n */\nexport class ConnectionContext {\n connection;\n constructor(connection) {\n this.connection = connection;\n }\n /**\n * Sends a request over the connection.\n */\n sendRequest(method, params, mapResponse, options) {\n return this.connection.sendRequest(method, params, mapResponse, options);\n }\n /**\n * Sends a notification over the connection.\n */\n sendNotification(method, params) {\n return this.connection.sendNotification(method, params);\n }\n /**\n * Sends a protocol-level request cancellation notification.\n */\n sendCancelRequest(requestId) {\n return this.connection.sendCancelRequest(requestId);\n }\n /**\n * Registers a handler that can be disposed independently.\n */\n addDynamicHandler(handler) {\n return this.connection.addDynamicHandler(handler);\n }\n /**\n * AbortSignal that aborts when the connection closes.\n */\n get signal() {\n return this.connection.signal;\n }\n /**\n * Promise that resolves when the connection closes.\n */\n get closed() {\n return this.connection.closed;\n }\n}\n/**\n * Lower-level JSON-RPC connection over an ACP `Stream`.\n *\n * Most ACP integrations should use `agent(...)` or `client(...)`. Use this\n * class when building generic JSON-RPC middleware or custom dispatch behavior.\n */\nexport class Connection {\n pendingResponses = new Map();\n incomingRequests = new Map();\n nextRequestId = 0;\n staticHandlers = [];\n dynamicHandlers = new Set();\n stream;\n writeQueue = Promise.resolve();\n abortController = new AbortController();\n closedPromise;\n retryQueue = [];\n context = new ConnectionContext(this);\n receiveReader;\n constructor(requestHandlerOrStream, notificationHandlerOrHandlers, streamOrOptions, options) {\n if (typeof requestHandlerOrStream === \"function\") {\n const requestHandler = requestHandlerOrStream;\n const notificationHandler = notificationHandlerOrHandlers;\n const stream = streamOrOptions;\n this.initialize(stream, [\n ...(options?.handlers ?? []),\n this.legacyHandler(requestHandler, notificationHandler),\n ]);\n return;\n }\n const stream = requestHandlerOrStream;\n const handlers = notificationHandlerOrHandlers;\n const connectionOptions = streamOrOptions;\n this.initialize(stream, [\n ...(connectionOptions?.handlers ?? []),\n ...handlers,\n ]);\n }\n /**\n * Creates a builder for configuring a handler-based connection.\n */\n static builder() {\n return new ConnectionBuilder();\n }\n /**\n * Runs an operation while the connection is open, then closes the connection.\n *\n * If the stream closes before `op` settles, the returned promise rejects with\n * the connection close reason.\n */\n runUntil(op) {\n let opSettled = false;\n const opPromise = Promise.resolve()\n .then(() => op(this.context))\n .finally(() => {\n opSettled = true;\n });\n const closedPromise = this.closed.then(() => {\n if (opSettled) {\n return new Promise(() => { });\n }\n throw this.closedReason();\n });\n return Promise.race([opPromise, closedPromise]).finally(() => {\n opSettled = true;\n this.close();\n });\n }\n /**\n * Adds a handler after the connection has started.\n *\n * Any messages queued with `Handled.no(message, true)` are retried after the\n * handler is added.\n */\n addDynamicHandler(handler) {\n this.dynamicHandlers.add(handler);\n if (this.retryQueue.length > 0) {\n for (const message of this.retryQueue.splice(0)) {\n void this.processIncomingMessage(message).catch((error) => this.close(error));\n }\n }\n return new HandlerRegistration(() => {\n this.dynamicHandlers.delete(handler);\n });\n }\n /**\n * AbortSignal that aborts when the connection closes.\n */\n get signal() {\n return this.abortController.signal;\n }\n /**\n * Promise that resolves when the connection closes.\n */\n get closed() {\n return this.closedPromise;\n }\n /** @internal */\n getContext() {\n return this.context;\n }\n /**\n * Sends a JSON-RPC request.\n *\n * `mapResponse` can convert the raw result before the returned promise\n * resolves.\n */\n sendRequest(method, params, mapResponse, options = {}) {\n if (this.abortController.signal.aborted) {\n return rejectedPromise(this.closedReason());\n }\n const id = this.nextRequestId++;\n let cancel = () => { };\n const responsePromise = new Promise((resolve, reject) => {\n const pendingResponse = {\n resolve: (response) => {\n try {\n const value = mapResponse\n ? mapResponse(response)\n : response;\n resolve(value);\n }\n catch (error) {\n reject(error);\n }\n },\n reject,\n };\n cancel = () => {\n if (pendingResponse.cancellationSent) {\n return;\n }\n pendingResponse.cancellationSent = true;\n pendingResponse.cleanup?.();\n void this.sendCancelRequest(id).catch(() => { });\n };\n options.cancellationSignal?.addEventListener(\"abort\", cancel, {\n once: true,\n });\n pendingResponse.cleanup = () => {\n options.cancellationSignal?.removeEventListener(\"abort\", cancel);\n };\n this.pendingResponses.set(id, pendingResponse);\n });\n responsePromise.catch(() => { });\n const requestSent = this.sendMessage({\n jsonrpc: \"2.0\",\n id,\n method,\n params,\n });\n void requestSent.catch(() => { });\n if (options.cancellationSignal?.aborted) {\n cancel();\n }\n return responsePromise;\n }\n /**\n * Sends a protocol-level request cancellation notification.\n */\n sendCancelRequest(requestId) {\n return this.sendNotification(CANCEL_REQUEST_METHOD, { requestId });\n }\n /**\n * Sends a JSON-RPC notification.\n */\n sendNotification(method, params) {\n if (this.abortController.signal.aborted) {\n return rejectedPromise(this.closedReason());\n }\n return this.sendMessage({ jsonrpc: \"2.0\", method, params });\n }\n /**\n * Closes the connection and rejects pending requests.\n */\n close(error) {\n if (this.abortController.signal.aborted) {\n return;\n }\n const closeError = error ?? new Error(\"ACP connection closed\");\n this.abortController.abort(closeError);\n for (const pendingResponse of this.pendingResponses.values()) {\n pendingResponse.cleanup?.();\n pendingResponse.reject(closeError);\n }\n this.pendingResponses.clear();\n for (const controller of this.incomingRequests.values()) {\n controller.abort(closeError);\n }\n this.incomingRequests.clear();\n void this.receiveReader?.cancel(closeError).catch(() => { });\n }\n initialize(stream, handlers) {\n this.stream = stream;\n this.staticHandlers = handlers;\n this.closedPromise = new Promise((resolve) => {\n this.abortController.signal.addEventListener(\"abort\", () => resolve());\n });\n void this.receive();\n }\n legacyHandler(requestHandler, notificationHandler) {\n return {\n handleMessage: async (message, cx) => {\n if (message.kind === \"request\") {\n const result = await requestHandler(message.method, message.params, cx);\n await message.responder.respond(result);\n }\n else {\n await notificationHandler(message.method, message.params, cx);\n }\n return Handled.yes();\n },\n };\n }\n async receive() {\n let closeError = undefined;\n try {\n const reader = this.stream.readable.getReader();\n this.receiveReader = reader;\n try {\n while (!this.abortController.signal.aborted) {\n const { value: message, done } = await reader.read();\n if (this.abortController.signal.aborted) {\n break;\n }\n if (done) {\n break;\n }\n if (!message) {\n continue;\n }\n this.receiveMessage(message);\n }\n }\n finally {\n if (this.receiveReader === reader) {\n this.receiveReader = undefined;\n }\n reader.releaseLock();\n }\n }\n catch (error) {\n closeError = error;\n }\n finally {\n this.close(closeError);\n }\n }\n receiveMessage(message) {\n if (this.abortController.signal.aborted) {\n return;\n }\n if (\"method\" in message) {\n if (!(\"id\" in message)) {\n this.handleProtocolNotification(message);\n }\n void this.processIncomingMessage(this.toIncomingMessage(message)).catch((error) => this.close(error));\n }\n else if (\"id\" in message) {\n this.handleResponse(message);\n }\n else {\n console.error(\"Invalid message\", { message });\n }\n }\n async processIncomingMessage(message) {\n if (this.abortController.signal.aborted) {\n return;\n }\n let current = message;\n let retry = false;\n try {\n for (const handler of [\n ...this.staticHandlers,\n ...this.dynamicHandlers.values(),\n ]) {\n if (this.abortController.signal.aborted) {\n return;\n }\n const result = (await handler.handleMessage(current, this.context)) ?? {\n handled: true,\n };\n if (result.handled) {\n return;\n }\n current = result.message ?? current;\n retry = retry || Boolean(result.retry);\n }\n if (retry) {\n this.retryQueue.push(current);\n }\n else if (current.kind === \"request\") {\n await current.responder.respondWithError(RequestError.methodNotFound(current.method));\n }\n }\n catch (error) {\n if (this.abortController.signal.aborted) {\n return;\n }\n if (current.kind === \"request\" && !current.responder.responded) {\n await current.responder.respondWithResult(errorToRequestResult(error, current.responder.signal));\n }\n else {\n const response = errorToResult(error);\n if (\"error\" in response) {\n console.error(\"Error handling notification\", message.raw, response.error);\n }\n }\n }\n }\n toIncomingMessage(message) {\n if (\"id\" in message) {\n const abortController = new AbortController();\n this.incomingRequests.set(message.id, abortController);\n const finishRequest = () => {\n if (this.incomingRequests.get(message.id) === abortController) {\n this.incomingRequests.delete(message.id);\n }\n };\n return {\n kind: \"request\",\n method: message.method,\n params: message.params,\n raw: message,\n signal: abortController.signal,\n responder: new RequestResponder(message.id, (result) => this.sendMessage({\n jsonrpc: \"2.0\",\n id: message.id,\n ...result,\n }), abortController.signal, finishRequest),\n };\n }\n return {\n kind: \"notification\",\n method: message.method,\n params: message.params,\n raw: message,\n };\n }\n handleResponse(response) {\n const pendingResponse = this.pendingResponses.get(response.id);\n if (pendingResponse) {\n this.pendingResponses.delete(response.id);\n pendingResponse.cleanup?.();\n if (\"result\" in response) {\n pendingResponse.resolve(response.result);\n }\n else if (\"error\" in response) {\n const { code, message, data } = response.error;\n pendingResponse.reject(new RequestError(code, message, data));\n }\n else {\n pendingResponse.reject(RequestError.invalidRequest(response));\n }\n }\n else {\n console.error(\"Got response to unknown request\", response.id);\n }\n }\n handleProtocolNotification(message) {\n if (message.method !== CANCEL_REQUEST_METHOD) {\n return;\n }\n const requestId = cancelRequestId(message.params);\n if (requestId === undefined) {\n return;\n }\n const controller = this.incomingRequests.get(requestId);\n if (!controller || controller.signal.aborted) {\n return;\n }\n controller.abort(RequestError.requestCancelled({ requestId }));\n }\n closedReason() {\n return (this.abortController.signal.reason ?? new Error(\"ACP connection closed\"));\n }\n async sendMessage(message) {\n if (this.abortController.signal.aborted) {\n return rejectedPromise(this.closedReason());\n }\n this.writeQueue = this.writeQueue\n .then(async () => {\n if (this.abortController.signal.aborted) {\n throw this.closedReason();\n }\n const writer = this.stream.writable.getWriter();\n try {\n await writer.write(message);\n }\n finally {\n writer.releaseLock();\n }\n })\n .catch((error) => {\n this.close(error);\n throw error;\n });\n return this.writeQueue;\n }\n}\n/**\n * Builder for a lower-level handler-based JSON-RPC connection.\n */\nexport class ConnectionBuilder {\n handlers = [];\n connectionName;\n /**\n * Sets a diagnostic name used by handlers created from this builder.\n */\n name(name) {\n this.connectionName = name;\n return this;\n }\n /**\n * Adds a raw JSON-RPC handler to the handler chain.\n */\n withHandler(handler) {\n this.handlers.push(handler);\n return this;\n }\n /**\n * Adds a handler that can inspect every incoming request or notification.\n *\n * Observer callbacks that return void pass the message through to later\n * handlers. Return `Handled.yes()` to stop dispatch explicitly.\n */\n onReceiveMessage(handler) {\n return this.withHandler({\n handleMessage: async (message, cx) => (await handler(message, cx)) ?? Handled.no(message),\n describe: () => this.connectionName ?? \"onReceiveMessage\",\n });\n }\n /**\n * Adds a typed request handler for one method.\n */\n onReceiveRequest(method, parse, handler) {\n return this.withHandler({\n handleMessage: async (message, cx) => {\n if (message.kind !== \"request\" || message.method !== method) {\n return Handled.no(message);\n }\n const request = parse(message.params);\n return ((await handler(request, message.responder, cx)) ?? Handled.yes());\n },\n describe: () => `${this.connectionName ?? \"request\"}:${method}`,\n });\n }\n /**\n * Adds a typed notification handler for one method.\n */\n onReceiveNotification(method, parse, handler) {\n return this.withHandler({\n handleMessage: async (message, cx) => {\n if (message.kind !== \"notification\" || message.method !== method) {\n return Handled.no(message);\n }\n const notification = parse(message.params);\n return (await handler(notification, cx)) ?? Handled.yes();\n },\n describe: () => `${this.connectionName ?? \"notification\"}:${method}`,\n });\n }\n /**\n * Connects the configured handlers to a stream.\n */\n connect(stream, options) {\n return new Connection(stream, this.handlers, options);\n }\n /**\n * Connects to a stream for the lifetime of `op`, then closes the connection.\n */\n connectWith(stream, op, options) {\n return this.connect(stream, options).runUntil(op);\n }\n}\n/**\n * JSON-RPC error object.\n *\n * Represents an error that occurred during method execution, following the\n * JSON-RPC 2.0 error object specification with optional additional data.\n *\n * See protocol docs: [JSON-RPC Error Object](https://www.jsonrpc.org/specification#error_object)\n */\nexport class RequestError extends Error {\n code;\n /**\n * Additional JSON-RPC error data.\n */\n data;\n constructor(\n /**\n * JSON-RPC error code.\n */\n code, message, data) {\n super(message);\n this.code = code;\n this.name = \"RequestError\";\n this.data = data;\n }\n /**\n * Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text.\n */\n static parseError(data, additionalMessage) {\n return new RequestError(-32700, `Parse error${additionalMessage ? `: ${additionalMessage}` : \"\"}`, data);\n }\n /**\n * The JSON sent is not a valid Request object.\n */\n static invalidRequest(data, additionalMessage) {\n return new RequestError(-32600, `Invalid request${additionalMessage ? `: ${additionalMessage}` : \"\"}`, data);\n }\n /**\n * The method does not exist / is not available.\n */\n static methodNotFound(method) {\n return new RequestError(-32601, `\"Method not found\": ${method}`, {\n method,\n });\n }\n /**\n * Invalid method parameter(s).\n */\n static invalidParams(data, additionalMessage) {\n return new RequestError(-32602, `Invalid params${additionalMessage ? `: ${additionalMessage}` : \"\"}`, data);\n }\n /**\n * Internal JSON-RPC error.\n */\n static internalError(data, additionalMessage) {\n return new RequestError(-32603, `Internal error${additionalMessage ? `: ${additionalMessage}` : \"\"}`, data);\n }\n /**\n * Execution of the request was aborted.\n */\n static requestCancelled(data, additionalMessage) {\n return new RequestError(-32800, `Request cancelled${additionalMessage ? `: ${additionalMessage}` : \"\"}`, data);\n }\n /**\n * Authentication required.\n */\n static authRequired(data, additionalMessage) {\n return new RequestError(-32000, `Authentication required${additionalMessage ? `: ${additionalMessage}` : \"\"}`, data);\n }\n /**\n * Resource, such as a file, was not found\n */\n static resourceNotFound(uri) {\n return new RequestError(-32002, `Resource not found${uri ? `: ${uri}` : \"\"}`, uri && { uri });\n }\n /**\n * Converts this error to a JSON-RPC result object.\n */\n toResult() {\n return {\n error: {\n code: this.code,\n message: this.message,\n data: this.data,\n },\n };\n }\n /**\n * Converts this error to a JSON-RPC error response payload.\n */\n toErrorResponse() {\n return {\n code: this.code,\n message: this.message,\n data: this.data,\n };\n }\n}\n//# sourceMappingURL=jsonrpc.js.map","import * as schema from \"./schema/index.js\";\nimport * as validate from \"./schema/zod.gen.js\";\nexport { AGENT_METHODS, CLIENT_METHODS, PROTOCOL_METHODS, PROTOCOL_VERSION, } from \"./schema/index.js\";\nexport * from \"./stream.js\";\nexport { RequestError } from \"./jsonrpc.js\";\nimport { Connection, Handled, HandlerRegistration } from \"./jsonrpc.js\";\nfunction emptyObjectResponse(response) {\n return response ?? {};\n}\nfunction isStream(value) {\n return (typeof value === \"object\" &&\n value !== null &&\n \"readable\" in value &&\n \"writable\" in value);\n}\nfunction memoryStreamPair() {\n const leftToRight = new TransformStream();\n const rightToLeft = new TransformStream();\n return [\n {\n readable: rightToLeft.readable,\n writable: leftToRight.writable,\n },\n {\n readable: leftToRight.readable,\n writable: rightToLeft.writable,\n },\n ];\n}\n/**\n * ACP method-name constants.\n *\n * Use these with `onRequest(...)`, `onNotification(...)`, `request(...)`, and\n * `notify(...)` when you want literal-string type inference without spelling\n * protocol strings inline.\n */\nexport const methods = {\n agent: {\n initialize: schema.AGENT_METHODS.initialize,\n authenticate: schema.AGENT_METHODS.authenticate,\n logout: schema.AGENT_METHODS.logout,\n providers: {\n list: schema.AGENT_METHODS.providers_list,\n set: schema.AGENT_METHODS.providers_set,\n disable: schema.AGENT_METHODS.providers_disable,\n },\n session: {\n new: schema.AGENT_METHODS.session_new,\n load: schema.AGENT_METHODS.session_load,\n list: schema.AGENT_METHODS.session_list,\n delete: schema.AGENT_METHODS.session_delete,\n fork: schema.AGENT_METHODS.session_fork,\n resume: schema.AGENT_METHODS.session_resume,\n close: schema.AGENT_METHODS.session_close,\n setMode: schema.AGENT_METHODS.session_set_mode,\n setConfigOption: schema.AGENT_METHODS.session_set_config_option,\n prompt: schema.AGENT_METHODS.session_prompt,\n cancel: schema.AGENT_METHODS.session_cancel,\n },\n nes: {\n start: schema.AGENT_METHODS.nes_start,\n suggest: schema.AGENT_METHODS.nes_suggest,\n accept: schema.AGENT_METHODS.nes_accept,\n reject: schema.AGENT_METHODS.nes_reject,\n close: schema.AGENT_METHODS.nes_close,\n },\n document: {\n didOpen: schema.AGENT_METHODS.document_did_open,\n didChange: schema.AGENT_METHODS.document_did_change,\n didClose: schema.AGENT_METHODS.document_did_close,\n didSave: schema.AGENT_METHODS.document_did_save,\n didFocus: schema.AGENT_METHODS.document_did_focus,\n },\n },\n client: {\n session: {\n requestPermission: schema.CLIENT_METHODS.session_request_permission,\n update: schema.CLIENT_METHODS.session_update,\n },\n fs: {\n writeTextFile: schema.CLIENT_METHODS.fs_write_text_file,\n readTextFile: schema.CLIENT_METHODS.fs_read_text_file,\n },\n terminal: {\n create: schema.CLIENT_METHODS.terminal_create,\n output: schema.CLIENT_METHODS.terminal_output,\n release: schema.CLIENT_METHODS.terminal_release,\n waitForExit: schema.CLIENT_METHODS.terminal_wait_for_exit,\n kill: schema.CLIENT_METHODS.terminal_kill,\n },\n elicitation: {\n create: schema.CLIENT_METHODS.elicitation_create,\n complete: schema.CLIENT_METHODS.elicitation_complete,\n },\n },\n protocol: {\n cancelRequest: schema.PROTOCOL_METHODS.cancel_request,\n },\n};\nconst startActiveSession = Symbol(\"startActiveSession\");\nclass AcpContext {\n cx;\n currentRequestId;\n /** @internal */\n constructor(cx, currentRequestId) {\n this.cx = cx;\n this.currentRequestId = currentRequestId;\n }\n /**\n * JSON-RPC id of the request currently being handled.\n *\n * This is `undefined` for notification handlers and for contexts created\n * outside an inbound request, such as `connect(...)` and `connectWith(...)`.\n */\n get requestId() {\n return this.currentRequestId;\n }\n /** @internal */\n get connectionContext() {\n return this.cx;\n }\n /** @internal */\n sendRequest(method, params, mapResponse, options) {\n return this.cx.sendRequest(method, params, mapResponse, options);\n }\n /** @internal */\n sendNotification(method, params) {\n return this.cx.sendNotification(method, params);\n }\n /** @internal */\n addDynamicHandler(handler) {\n return this.cx.addDynamicHandler(handler);\n }\n}\n/**\n * Context passed to agent-side handlers.\n *\n * Agents use this context to call client-side ACP methods while handling\n * requests such as `session/prompt`.\n */\nexport class AgentContext extends AcpContext {\n constructor(cx, requestId) {\n super(cx, requestId);\n }\n /** @internal */\n static create(cx, requestId) {\n return new AgentContext(cx, requestId);\n }\n request(method, params, options) {\n const spec = clientRequestSpecsByMethod[method];\n return this.sendRequest(method, params, spec?.mapResponse, options);\n }\n notify(method, params) {\n return this.sendNotification(method, params);\n }\n}\n/**\n * Context used by clients to call agent-side ACP methods.\n *\n * `connectWith` passes a `ClientContext` to the callback. Client handlers also\n * receive one as `ctx.agent` when they need to call back into the agent.\n */\nexport class ClientContext extends AcpContext {\n constructor(cx, requestId) {\n super(cx, requestId);\n }\n /** @internal */\n static create(cx, requestId) {\n return new ClientContext(cx, requestId);\n }\n /** @internal */\n [startActiveSession](params, options) {\n return this.sendRequest(schema.AGENT_METHODS.session_new, params, (response) => this.attachSession(response), options);\n }\n buildSession(cwdOrRequest) {\n if (typeof cwdOrRequest === \"string\") {\n return SessionBuilder.create(this, {\n cwd: cwdOrRequest,\n mcpServers: [],\n });\n }\n return SessionBuilder.create(this, cwdOrRequest);\n }\n /**\n * Builds active-session helpers around a `session/new` response.\n */\n attachSession(response) {\n const updates = new AsyncQueue();\n const closeSignal = this.connectionContext.signal;\n const failUpdatesOnClose = () => {\n updates.fail(closeSignal.reason ?? new Error(\"ACP connection closed\"));\n };\n if (closeSignal.aborted) {\n failUpdatesOnClose();\n }\n else {\n closeSignal.addEventListener(\"abort\", failUpdatesOnClose);\n }\n const sessionRegistration = sessionUpdateRouter(this.connectionContext).attach(response, updates);\n const closeRegistration = new HandlerRegistration(() => {\n closeSignal.removeEventListener(\"abort\", failUpdatesOnClose);\n });\n return ActiveSession.create(this, response, updates, [\n sessionRegistration,\n closeRegistration,\n ]);\n }\n request(method, params, options) {\n const spec = agentRequestSpecsByMethod[method];\n return this.sendRequest(method, params, spec?.mapResponse, options);\n }\n notify(method, params) {\n return this.sendNotification(method, params);\n }\n}\nclass AcpConnectionHandle {\n connection;\n constructor(connection) {\n this.connection = connection;\n }\n get signal() {\n return this.connection.signal;\n }\n get closed() {\n return this.connection.closed;\n }\n close(error) {\n this.connection.close(error);\n }\n}\nclass AgentConnectionHandle extends AcpConnectionHandle {\n connectHandlers;\n client;\n didStartConnectHandlers = false;\n constructor(connection, connectHandlers = []) {\n super(connection);\n this.connectHandlers = connectHandlers;\n this.client = AgentContext.create(connection.getContext());\n }\n /** @internal */\n startConnectHandlers() {\n if (this.didStartConnectHandlers) {\n return;\n }\n this.didStartConnectHandlers = true;\n runConnectHandlers(this, this.connectHandlers);\n }\n}\nclass ClientConnectionHandle extends AcpConnectionHandle {\n connectHandlers;\n agent;\n didStartConnectHandlers = false;\n constructor(connection, connectHandlers = []) {\n super(connection);\n this.connectHandlers = connectHandlers;\n this.agent = ClientContext.create(connection.getContext());\n }\n /** @internal */\n startConnectHandlers() {\n if (this.didStartConnectHandlers) {\n return;\n }\n this.didStartConnectHandlers = true;\n runConnectHandlers(this, this.connectHandlers);\n }\n}\nfunction agentConnection(connection, connectHandlers = []) {\n return new AgentConnectionHandle(connection, connectHandlers);\n}\nfunction clientConnection(connection, connectHandlers = []) {\n return new ClientConnectionHandle(connection, connectHandlers);\n}\nclass AsyncQueue {\n values = [];\n waiters = [];\n failed = false;\n failure;\n enqueue(value) {\n if (this.failed) {\n return;\n }\n const waiter = this.waiters.shift();\n if (waiter) {\n waiter.resolve(value);\n }\n else {\n this.values.push({ kind: \"value\", value });\n }\n }\n reject(error) {\n if (this.failed) {\n return;\n }\n if (this.waiters.length > 0) {\n for (const waiter of this.waiters.splice(0)) {\n waiter.reject(error);\n }\n return;\n }\n this.values.push({ kind: \"error\", error });\n }\n clearErrors() {\n this.values = this.values.filter((entry) => entry.kind === \"value\");\n }\n fail(error) {\n if (this.failed) {\n return;\n }\n this.failed = true;\n this.failure = error;\n for (const waiter of this.waiters.splice(0)) {\n waiter.reject(error);\n }\n }\n next() {\n if (this.values.length > 0) {\n const entry = this.values.shift();\n if (entry.kind === \"error\") {\n return Promise.reject(entry.error);\n }\n return Promise.resolve(entry.value);\n }\n if (this.failed) {\n return Promise.reject(this.failure);\n }\n return new Promise((resolve, reject) => {\n this.waiters.push({ resolve, reject });\n });\n }\n}\nfunction cloneNewSessionRequest(request) {\n return {\n ...request,\n additionalDirectories: request.additionalDirectories\n ? [...request.additionalDirectories]\n : undefined,\n mcpServers: [...request.mcpServers],\n };\n}\n/**\n * Builder for creating an `ActiveSession`.\n *\n * Start from `ctx.buildSession(\"/absolute/cwd\")` for the common case, or\n * pass a full `NewSessionRequest` to `ctx.buildSession(...)` when the session\n * needs MCP servers, `_meta`, or additional request fields. All paths in ACP\n * payloads should be absolute.\n */\nexport class SessionBuilder {\n cx;\n request;\n constructor(cx, request) {\n this.cx = cx;\n this.request = cloneNewSessionRequest(request);\n }\n /** @internal */\n static create(cx, request) {\n return new SessionBuilder(cx, request);\n }\n /**\n * Returns the `session/new` request that will be sent.\n *\n * The returned object is a defensive copy, so mutating it does not change the\n * builder.\n */\n toRequest() {\n return cloneNewSessionRequest(this.request);\n }\n /**\n * Replaces the additional workspace roots for this session.\n *\n * `additionalDirectories` expand the session's file-system scope without\n * changing `cwd`. Each path should be absolute.\n */\n withAdditionalDirectories(additionalDirectories) {\n this.request = {\n ...this.request,\n additionalDirectories: [...additionalDirectories],\n };\n return this;\n }\n /**\n * Adds one MCP server to the `session/new` request.\n */\n withMcpServer(mcpServer) {\n this.request = {\n ...this.request,\n mcpServers: [...this.request.mcpServers, mcpServer],\n };\n return this;\n }\n /**\n * Starts the session and returns an `ActiveSession` for prompting and reading\n * updates.\n *\n * Call `dispose()` on the returned session when you no longer need update\n * routing, or use `withSession(...)` to scope disposal automatically.\n */\n async start(options) {\n return this.cx[startActiveSession](this.toRequest(), options);\n }\n /**\n * Starts the session, runs `op`, and disposes the active-session update\n * routing when `op` finishes or throws.\n */\n async withSession(op) {\n const session = await this.start();\n try {\n return await op(session);\n }\n finally {\n session.dispose();\n }\n }\n}\n/**\n * Convenience wrapper for an active ACP session.\n *\n * An active session routes `session/update` notifications for one session ID\n * into an async queue. Use `prompt(...)` to send user content, then read updates\n * with `nextUpdate()` until a `stop` message is returned.\n */\nexport class ActiveSession {\n cx;\n sessionResponse;\n updates;\n registrations;\n constructor(cx, sessionResponse, updates, registrations) {\n this.cx = cx;\n this.sessionResponse = sessionResponse;\n this.updates = updates;\n this.registrations = registrations;\n }\n /** @internal */\n static create(cx, sessionResponse, updates, registrations) {\n return new ActiveSession(cx, sessionResponse, updates, registrations);\n }\n /**\n * Session ID returned by `session/new`.\n */\n get sessionId() {\n return this.sessionResponse.sessionId;\n }\n /**\n * Mode state returned when the session was created, if the agent provided it.\n */\n get modes() {\n return this.sessionResponse.modes;\n }\n /**\n * Metadata returned when the session was created.\n */\n get meta() {\n return this.sessionResponse._meta;\n }\n /**\n * Full response returned by `session/new`.\n */\n get newSessionResponse() {\n return this.sessionResponse;\n }\n /**\n * Sends a prompt to this session.\n *\n * Strings are converted to one text content block. A single content block is\n * wrapped in an array. The returned promise resolves with the final\n * `PromptResponse`, and the same completion is also queued as a `stop`\n * message for `nextUpdate()`.\n */\n prompt(prompt, options) {\n this.updates.clearErrors();\n const response = this.cx.request(schema.AGENT_METHODS.session_prompt, {\n sessionId: this.sessionId,\n prompt: this.promptBlocks(prompt),\n }, options);\n void response.then((value) => {\n this.updates.enqueue({\n kind: \"stop\",\n response: value,\n stopReason: value.stopReason,\n });\n }, (error) => {\n this.updates.reject(error);\n });\n return response;\n }\n /**\n * Reads the next update or stop message for this session.\n */\n nextUpdate() {\n return this.updates.next();\n }\n /**\n * Reads text chunks until the current prompt turn stops.\n *\n * Only `agent_message_chunk` updates with text content are appended. Other\n * update types are ignored by this helper; use `nextUpdate()` when you need\n * tool calls, plans, or the final `PromptResponse`.\n */\n async readText() {\n let output = \"\";\n for (;;) {\n const message = await this.nextUpdate();\n if (message.kind === \"stop\") {\n return output;\n }\n const { update } = message;\n if (update.sessionUpdate === \"agent_message_chunk\" &&\n update.content.type === \"text\") {\n output += update.content.text;\n }\n }\n }\n /**\n * Stops routing updates to this active-session helper.\n *\n * This does not close the ACP session on the agent. Use `ClientContext`\n * session lifecycle methods when the protocol session itself should be closed\n * or deleted.\n */\n dispose() {\n for (const registration of this.registrations.splice(0)) {\n registration.dispose();\n }\n this.updates.fail(new Error(\"Active session disposed\"));\n }\n /**\n * Supports explicit resource management with `using`.\n */\n [Symbol.dispose]() {\n this.dispose();\n }\n promptBlocks(prompt) {\n if (typeof prompt === \"string\") {\n return [{ type: \"text\", text: prompt }];\n }\n if (Array.isArray(prompt)) {\n return prompt;\n }\n return [prompt];\n }\n}\nfunction parseParams(parser, params) {\n if (!parser) {\n return params;\n }\n if (typeof parser === \"function\") {\n return parser(params);\n }\n return parser.parse(params);\n}\nfunction requestSpec(method, params, mapResponse) {\n return { method, params, mapResponse };\n}\nfunction notificationSpec(method, params) {\n return { method, params };\n}\nfunction registerAppRequest(builder, spec, context, handler) {\n builder.onReceiveRequest(spec.method, (params) => parseParams(spec.params, params), async (params, responder, cx) => {\n const response = await handler(context(params, cx, responder.signal, responder.id));\n await responder.respond((spec.mapResponse\n ? spec.mapResponse(response)\n : response));\n });\n}\nfunction registerAppNotification(builder, spec, context, handler) {\n builder.onReceiveNotification(spec.method, (params) => parseParams(spec.params, params), (params, cx) => handler(context(params, cx, cx.signal)));\n}\nfunction specsByMethod(specs) {\n const byMethod = {};\n for (const spec of Object.values(specs)) {\n byMethod[spec.method] = spec;\n }\n return byMethod;\n}\nconst agentRequestSpecs = {\n initialize: requestSpec(schema.AGENT_METHODS.initialize, validate.zInitializeRequest),\n newSession: requestSpec(schema.AGENT_METHODS.session_new, validate.zNewSessionRequest),\n loadSession: requestSpec(schema.AGENT_METHODS.session_load, validate.zLoadSessionRequest, emptyObjectResponse),\n unstable_forkSession: requestSpec(schema.AGENT_METHODS.session_fork, validate.zForkSessionRequest),\n listSessions: requestSpec(schema.AGENT_METHODS.session_list, validate.zListSessionsRequest),\n deleteSession: requestSpec(schema.AGENT_METHODS.session_delete, validate.zDeleteSessionRequest, emptyObjectResponse),\n resumeSession: requestSpec(schema.AGENT_METHODS.session_resume, validate.zResumeSessionRequest),\n closeSession: requestSpec(schema.AGENT_METHODS.session_close, validate.zCloseSessionRequest, emptyObjectResponse),\n setSessionMode: requestSpec(schema.AGENT_METHODS.session_set_mode, validate.zSetSessionModeRequest, emptyObjectResponse),\n setSessionConfigOption: requestSpec(schema.AGENT_METHODS.session_set_config_option, validate.zSetSessionConfigOptionRequest),\n authenticate: requestSpec(schema.AGENT_METHODS.authenticate, validate.zAuthenticateRequest, emptyObjectResponse),\n unstable_listProviders: requestSpec(schema.AGENT_METHODS.providers_list, validate.zListProvidersRequest),\n unstable_setProvider: requestSpec(schema.AGENT_METHODS.providers_set, validate.zSetProviderRequest, emptyObjectResponse),\n unstable_disableProvider: requestSpec(schema.AGENT_METHODS.providers_disable, validate.zDisableProviderRequest, emptyObjectResponse),\n logout: requestSpec(schema.AGENT_METHODS.logout, validate.zLogoutRequest, emptyObjectResponse),\n prompt: requestSpec(schema.AGENT_METHODS.session_prompt, validate.zPromptRequest),\n unstable_startNes: requestSpec(schema.AGENT_METHODS.nes_start, validate.zStartNesRequest),\n unstable_suggestNes: requestSpec(schema.AGENT_METHODS.nes_suggest, validate.zSuggestNesRequest),\n unstable_closeNes: requestSpec(schema.AGENT_METHODS.nes_close, validate.zCloseNesRequest, emptyObjectResponse),\n};\nconst agentNotificationSpecs = {\n cancel: notificationSpec(schema.AGENT_METHODS.session_cancel, validate.zCancelNotification),\n unstable_didOpenDocument: notificationSpec(schema.AGENT_METHODS.document_did_open, validate.zDidOpenDocumentNotification),\n unstable_didChangeDocument: notificationSpec(schema.AGENT_METHODS.document_did_change, validate.zDidChangeDocumentNotification),\n unstable_didCloseDocument: notificationSpec(schema.AGENT_METHODS.document_did_close, validate.zDidCloseDocumentNotification),\n unstable_didSaveDocument: notificationSpec(schema.AGENT_METHODS.document_did_save, validate.zDidSaveDocumentNotification),\n unstable_didFocusDocument: notificationSpec(schema.AGENT_METHODS.document_did_focus, validate.zDidFocusDocumentNotification),\n unstable_acceptNes: notificationSpec(schema.AGENT_METHODS.nes_accept, validate.zAcceptNesNotification),\n unstable_rejectNes: notificationSpec(schema.AGENT_METHODS.nes_reject, validate.zRejectNesNotification),\n};\nconst clientRequestSpecs = {\n requestPermission: requestSpec(schema.CLIENT_METHODS.session_request_permission, validate.zRequestPermissionRequest),\n writeTextFile: requestSpec(schema.CLIENT_METHODS.fs_write_text_file, validate.zWriteTextFileRequest, emptyObjectResponse),\n readTextFile: requestSpec(schema.CLIENT_METHODS.fs_read_text_file, validate.zReadTextFileRequest),\n createTerminal: requestSpec(schema.CLIENT_METHODS.terminal_create, validate.zCreateTerminalRequest),\n terminalOutput: requestSpec(schema.CLIENT_METHODS.terminal_output, validate.zTerminalOutputRequest),\n releaseTerminal: requestSpec(schema.CLIENT_METHODS.terminal_release, validate.zReleaseTerminalRequest, emptyObjectResponse),\n waitForTerminalExit: requestSpec(schema.CLIENT_METHODS.terminal_wait_for_exit, validate.zWaitForTerminalExitRequest),\n killTerminal: requestSpec(schema.CLIENT_METHODS.terminal_kill, validate.zKillTerminalRequest, emptyObjectResponse),\n unstable_createElicitation: requestSpec(schema.CLIENT_METHODS.elicitation_create, validate.zCreateElicitationRequest),\n};\nconst clientNotificationSpecs = {\n sessionUpdate: notificationSpec(schema.CLIENT_METHODS.session_update, validate.zSessionNotification),\n unstable_completeElicitation: notificationSpec(schema.CLIENT_METHODS.elicitation_complete, validate.zCompleteElicitationNotification),\n};\nconst agentRequestSpecsByMethod = specsByMethod(agentRequestSpecs);\nconst agentNotificationSpecsByMethod = specsByMethod(agentNotificationSpecs);\nconst clientRequestSpecsByMethod = specsByMethod(clientRequestSpecs);\nconst clientNotificationSpecsByMethod = specsByMethod(clientNotificationSpecs);\nfunction agentRequestContext(params, client, signal, requestId) {\n return {\n params,\n requestId,\n signal,\n client,\n };\n}\nfunction agentNotificationContext(params, client, signal) {\n return {\n params,\n signal,\n client,\n };\n}\nfunction clientRequestContext(params, agent, signal, requestId) {\n return {\n params,\n requestId,\n signal,\n agent,\n };\n}\nfunction clientNotificationContext(params, agent, signal) {\n return {\n params,\n signal,\n agent,\n };\n}\nclass SessionUpdateRouter {\n activeSessions = new Map();\n handleMessage(message) {\n if (message.kind !== \"notification\" ||\n message.method !== schema.CLIENT_METHODS.session_update) {\n return Handled.no(message);\n }\n const notification = validate.zSessionNotification.parse(message.params);\n const update = {\n kind: \"session_update\",\n notification,\n update: notification.update,\n };\n const activeSessions = this.activeSessions.get(notification.sessionId);\n if (activeSessions && activeSessions.size > 0) {\n for (const session of activeSessions) {\n session.enqueue(update);\n }\n }\n return Handled.no(message);\n }\n attach(response, updates) {\n const sessions = this.activeSessions.get(response.sessionId) ??\n new Set();\n sessions.add(updates);\n this.activeSessions.set(response.sessionId, sessions);\n return new HandlerRegistration(() => {\n sessions.delete(updates);\n if (sessions.size === 0) {\n this.activeSessions.delete(response.sessionId);\n }\n });\n }\n}\nconst sessionUpdateRouters = new WeakMap();\nfunction sessionUpdateRouter(cx) {\n let router = sessionUpdateRouters.get(cx);\n if (!router) {\n router = new SessionUpdateRouter();\n sessionUpdateRouters.set(cx, router);\n }\n return router;\n}\nfunction runConnectHandlers(connection, handlers) {\n for (const handler of handlers) {\n let result;\n try {\n result = handler(connection);\n }\n catch (error) {\n connection.close(error);\n throw error;\n }\n void Promise.resolve(result).catch((error) => {\n connection.close(error);\n });\n }\n}\nconst appBuilder = Symbol(\"appBuilder\");\nconst runAgentConnectHandlers = Symbol(\"runAgentConnectHandlers\");\nconst runClientConnectHandlers = Symbol(\"runClientConnectHandlers\");\n/**\n * Creates an agent-side app.\n *\n * Register request and notification handlers by ACP method name, then call\n * `connect(stream)` to serve an ACP client.\n */\nexport function agent(options) {\n return new AgentApp(options);\n}\n/**\n * Agent-side app builder.\n *\n * Methods on this class register typed request or notification handlers and\n * return `this`, so apps can be built with a fluent chain. Handler params are\n * parsed with the generated ACP schemas before your handler runs, and thrown\n * errors are converted to JSON-RPC errors by the connection layer.\n */\nexport class AgentApp {\n builder = Connection.builder();\n connectHandlers = [];\n constructor(options = {}) {\n if (options.name) {\n this.builder.name(options.name);\n }\n }\n /** @internal */\n [appBuilder]() {\n return this.builder;\n }\n /** @internal */\n [runAgentConnectHandlers](connection) {\n runConnectHandlers(connection, this.connectHandlers);\n }\n connect(target, options = {}) {\n return this.connectConnection(target, options).connection;\n }\n connectWith(target, op) {\n const { rawConnection, connection } = this.connectConnection(target);\n return rawConnection.runUntil(() => op(connection.client));\n }\n /**\n * Registers a handler that runs when this agent app opens a connection.\n *\n * Use this for connection-scoped work that needs to call client-side ACP\n * methods outside an inbound request handler.\n */\n onConnect(handler) {\n this.connectHandlers.push(handler);\n return this;\n }\n onRequest(method, handlerOrParams, handler) {\n if (handler) {\n return this.request({ method, params: handlerOrParams }, handler);\n }\n const spec = agentRequestSpecsByMethod[method];\n if (!spec) {\n throw new Error(`Unknown ACP request method '${method}'. Pass a params parser for custom methods.`);\n }\n return this.request(spec, handlerOrParams);\n }\n onNotification(method, handlerOrParams, handler) {\n if (handler) {\n return this.notification({ method, params: handlerOrParams }, handler);\n }\n const spec = agentNotificationSpecsByMethod[method];\n if (!spec) {\n throw new Error(`Unknown ACP notification method '${method}'. Pass a params parser for custom methods.`);\n }\n return this.notification(spec, handlerOrParams);\n }\n request(spec, handler) {\n registerAppRequest(this.builder, spec, (params, cx, signal, requestId) => agentRequestContext(params, AgentContext.create(cx, requestId), signal, requestId), handler);\n return this;\n }\n notification(spec, handler) {\n registerAppNotification(this.builder, spec, (params, cx, signal) => agentNotificationContext(params, AgentContext.create(cx), signal), handler);\n return this;\n }\n connectConnection(target, options = {}) {\n if (isStream(target)) {\n const state = this.openStreamConnection(target);\n if (!options.deferConnectHandlers) {\n this[runAgentConnectHandlers](state.connection);\n }\n return state;\n }\n const [thisStream, peerStream] = memoryStreamPair();\n const peerRawConnection = target[appBuilder]().connect(peerStream);\n const peerConnection = clientConnection(peerRawConnection);\n const state = this.openStreamConnection(thisStream);\n void state.rawConnection.closed.then(() => peerConnection.close());\n void peerRawConnection.closed.then(() => state.connection.close());\n try {\n target[runClientConnectHandlers](peerConnection);\n this[runAgentConnectHandlers](state.connection);\n }\n catch (error) {\n peerConnection.close(error);\n state.connection.close(error);\n throw error;\n }\n return state;\n }\n openStreamConnection(stream) {\n const rawConnection = this.builder.connect(stream);\n return {\n rawConnection,\n connection: agentConnection(rawConnection, this.connectHandlers),\n };\n }\n}\n/**\n * Creates a client-side app.\n *\n * Register request and notification handlers by ACP method name, then use\n * `connectWith(...)` to run the workflow that calls agent-side methods.\n */\nexport function client(options) {\n return new ClientApp(options);\n}\n/**\n * Client-side app builder.\n *\n * Methods on this class register typed client handlers and return `this`, so\n * apps can be built with a fluent chain. `connectWith(...)` is the usual entry\n * point for clients because it provides a `ClientContext` for calling\n * agent-side requests and session helpers.\n */\nexport class ClientApp {\n builder = Connection.builder();\n connectHandlers = [];\n constructor(options = {}) {\n if (options.name) {\n this.builder.name(options.name);\n }\n this.builder.withHandler({\n handleMessage: (message, cx) => sessionUpdateRouter(cx).handleMessage(message),\n describe: () => \"client-session-update-router\",\n });\n }\n /** @internal */\n [appBuilder]() {\n return this.builder;\n }\n /** @internal */\n [runClientConnectHandlers](connection) {\n runConnectHandlers(connection, this.connectHandlers);\n }\n connect(target) {\n return this.connectConnection(target).connection;\n }\n connectWith(target, op) {\n const { rawConnection, connection } = this.connectConnection(target);\n return rawConnection.runUntil(() => op(connection.agent));\n }\n /**\n * Registers a handler that runs when this client app opens a connection.\n *\n * Use this for connection-scoped work that needs to call agent-side ACP\n * methods outside an inbound request handler.\n */\n onConnect(handler) {\n this.connectHandlers.push(handler);\n return this;\n }\n onRequest(method, handlerOrParams, handler) {\n if (handler) {\n return this.request({ method, params: handlerOrParams }, handler);\n }\n const spec = clientRequestSpecsByMethod[method];\n if (!spec) {\n throw new Error(`Unknown ACP request method '${method}'. Pass a params parser for custom methods.`);\n }\n return this.request(spec, handlerOrParams);\n }\n onNotification(method, handlerOrParams, handler) {\n if (handler) {\n return this.notification({ method, params: handlerOrParams }, handler);\n }\n const spec = clientNotificationSpecsByMethod[method];\n if (!spec) {\n throw new Error(`Unknown ACP notification method '${method}'. Pass a params parser for custom methods.`);\n }\n return this.notification(spec, handlerOrParams);\n }\n request(spec, handler) {\n registerAppRequest(this.builder, spec, (params, cx, signal, requestId) => clientRequestContext(params, ClientContext.create(cx, requestId), signal, requestId), handler);\n return this;\n }\n notification(spec, handler) {\n registerAppNotification(this.builder, spec, (params, cx, signal) => clientNotificationContext(params, ClientContext.create(cx), signal), handler);\n return this;\n }\n connectConnection(target) {\n if (isStream(target)) {\n const state = this.openStreamConnection(target);\n this[runClientConnectHandlers](state.connection);\n return state;\n }\n const [thisStream, peerStream] = memoryStreamPair();\n const peerRawConnection = target[appBuilder]().connect(peerStream);\n const peerConnection = agentConnection(peerRawConnection);\n const state = this.openStreamConnection(thisStream);\n void state.rawConnection.closed.then(() => peerConnection.close());\n void peerRawConnection.closed.then(() => state.connection.close());\n try {\n target[runAgentConnectHandlers](peerConnection);\n this[runClientConnectHandlers](state.connection);\n }\n catch (error) {\n peerConnection.close(error);\n state.connection.close(error);\n throw error;\n }\n return state;\n }\n openStreamConnection(stream) {\n const rawConnection = this.builder.connect(stream);\n return {\n rawConnection,\n connection: clientConnection(rawConnection, this.connectHandlers),\n };\n }\n}\nconst legacyAgentRequestMethods = new Set([\n schema.AGENT_METHODS.initialize,\n schema.AGENT_METHODS.authenticate,\n schema.AGENT_METHODS.providers_list,\n schema.AGENT_METHODS.providers_set,\n schema.AGENT_METHODS.providers_disable,\n schema.AGENT_METHODS.session_new,\n schema.AGENT_METHODS.session_load,\n schema.AGENT_METHODS.session_set_mode,\n schema.AGENT_METHODS.session_set_config_option,\n schema.AGENT_METHODS.session_prompt,\n schema.AGENT_METHODS.session_list,\n schema.AGENT_METHODS.session_delete,\n schema.AGENT_METHODS.session_fork,\n schema.AGENT_METHODS.session_resume,\n schema.AGENT_METHODS.session_close,\n schema.AGENT_METHODS.logout,\n schema.AGENT_METHODS.nes_start,\n schema.AGENT_METHODS.nes_suggest,\n schema.AGENT_METHODS.nes_close,\n]);\nconst legacyAgentNotificationMethods = new Set([\n schema.AGENT_METHODS.session_cancel,\n schema.AGENT_METHODS.nes_accept,\n schema.AGENT_METHODS.nes_reject,\n schema.AGENT_METHODS.document_did_open,\n schema.AGENT_METHODS.document_did_change,\n schema.AGENT_METHODS.document_did_close,\n schema.AGENT_METHODS.document_did_save,\n schema.AGENT_METHODS.document_did_focus,\n]);\nconst legacyClientRequestMethods = new Set([\n schema.CLIENT_METHODS.session_request_permission,\n schema.CLIENT_METHODS.fs_write_text_file,\n schema.CLIENT_METHODS.fs_read_text_file,\n schema.CLIENT_METHODS.terminal_create,\n schema.CLIENT_METHODS.terminal_output,\n schema.CLIENT_METHODS.terminal_release,\n schema.CLIENT_METHODS.terminal_wait_for_exit,\n schema.CLIENT_METHODS.terminal_kill,\n schema.CLIENT_METHODS.elicitation_create,\n]);\nconst legacyClientNotificationMethods = new Set([\n schema.CLIENT_METHODS.session_update,\n schema.CLIENT_METHODS.elicitation_complete,\n]);\nfunction legacyAgentApp(implementation) {\n const app = agent()\n .onRequest(schema.AGENT_METHODS.initialize, (ctx) => implementation.initialize(ctx.params))\n .onRequest(schema.AGENT_METHODS.session_new, (ctx) => implementation.newSession(ctx.params))\n .onRequest(schema.AGENT_METHODS.authenticate, async (ctx) => (await implementation.authenticate(ctx.params)) ?? {})\n .onRequest(schema.AGENT_METHODS.session_prompt, (ctx) => implementation.prompt(ctx.params))\n .onNotification(schema.AGENT_METHODS.session_cancel, (ctx) => implementation.cancel(ctx.params));\n if (implementation.loadSession) {\n app.onRequest(schema.AGENT_METHODS.session_load, (ctx) => implementation.loadSession(ctx.params));\n }\n if (implementation.listSessions) {\n app.onRequest(schema.AGENT_METHODS.session_list, (ctx) => implementation.listSessions(ctx.params));\n }\n if (implementation.deleteSession) {\n app.onRequest(schema.AGENT_METHODS.session_delete, async (ctx) => (await implementation.deleteSession(ctx.params)) ?? {});\n }\n if (implementation.unstable_forkSession) {\n app.onRequest(schema.AGENT_METHODS.session_fork, (ctx) => implementation.unstable_forkSession(ctx.params));\n }\n if (implementation.resumeSession) {\n app.onRequest(schema.AGENT_METHODS.session_resume, (ctx) => implementation.resumeSession(ctx.params));\n }\n if (implementation.closeSession) {\n app.onRequest(schema.AGENT_METHODS.session_close, async (ctx) => (await implementation.closeSession(ctx.params)) ?? {});\n }\n if (implementation.setSessionMode) {\n app.onRequest(schema.AGENT_METHODS.session_set_mode, async (ctx) => (await implementation.setSessionMode(ctx.params)) ?? {});\n }\n if (implementation.setSessionConfigOption) {\n app.onRequest(schema.AGENT_METHODS.session_set_config_option, (ctx) => implementation.setSessionConfigOption(ctx.params));\n }\n if (implementation.unstable_listProviders) {\n app.onRequest(schema.AGENT_METHODS.providers_list, (ctx) => implementation.unstable_listProviders(ctx.params));\n }\n if (implementation.unstable_setProvider) {\n app.onRequest(schema.AGENT_METHODS.providers_set, async (ctx) => (await implementation.unstable_setProvider(ctx.params)) ?? {});\n }\n if (implementation.unstable_disableProvider) {\n app.onRequest(schema.AGENT_METHODS.providers_disable, async (ctx) => (await implementation.unstable_disableProvider(ctx.params)) ?? {});\n }\n if (implementation.logout) {\n app.onRequest(schema.AGENT_METHODS.logout, async (ctx) => (await implementation.logout(ctx.params)) ?? {});\n }\n if (implementation.unstable_startNes) {\n app.onRequest(schema.AGENT_METHODS.nes_start, (ctx) => implementation.unstable_startNes(ctx.params));\n }\n if (implementation.unstable_suggestNes) {\n app.onRequest(schema.AGENT_METHODS.nes_suggest, (ctx) => implementation.unstable_suggestNes(ctx.params));\n }\n if (implementation.unstable_closeNes) {\n app.onRequest(schema.AGENT_METHODS.nes_close, async (ctx) => (await implementation.unstable_closeNes(ctx.params)) ?? {});\n }\n if (implementation.unstable_didOpenDocument) {\n app.onNotification(schema.AGENT_METHODS.document_did_open, (ctx) => implementation.unstable_didOpenDocument(ctx.params));\n }\n if (implementation.unstable_didChangeDocument) {\n app.onNotification(schema.AGENT_METHODS.document_did_change, (ctx) => implementation.unstable_didChangeDocument(ctx.params));\n }\n if (implementation.unstable_didCloseDocument) {\n app.onNotification(schema.AGENT_METHODS.document_did_close, (ctx) => implementation.unstable_didCloseDocument(ctx.params));\n }\n if (implementation.unstable_didSaveDocument) {\n app.onNotification(schema.AGENT_METHODS.document_did_save, (ctx) => implementation.unstable_didSaveDocument(ctx.params));\n }\n if (implementation.unstable_didFocusDocument) {\n app.onNotification(schema.AGENT_METHODS.document_did_focus, (ctx) => implementation.unstable_didFocusDocument(ctx.params));\n }\n if (implementation.unstable_acceptNes) {\n app.onNotification(schema.AGENT_METHODS.nes_accept, (ctx) => implementation.unstable_acceptNes(ctx.params));\n }\n if (implementation.unstable_rejectNes) {\n app.onNotification(schema.AGENT_METHODS.nes_reject, (ctx) => implementation.unstable_rejectNes(ctx.params));\n }\n if (implementation.extMethod) {\n app[appBuilder]().withHandler({\n handleMessage: async (message) => {\n if (message.kind !== \"request\" ||\n legacyAgentRequestMethods.has(message.method)) {\n return Handled.no(message);\n }\n await message.responder.respond(await implementation.extMethod(message.method, message.params));\n return Handled.yes();\n },\n describe: () => \"legacy-agent-extension-request\",\n });\n }\n if (implementation.extNotification) {\n app[appBuilder]().withHandler({\n handleMessage: async (message) => {\n if (message.kind !== \"notification\" ||\n legacyAgentNotificationMethods.has(message.method)) {\n return Handled.no(message);\n }\n await implementation.extNotification(message.method, message.params);\n return Handled.yes();\n },\n describe: () => \"legacy-agent-extension-notification\",\n });\n }\n return app;\n}\nfunction legacyClientApp(implementation) {\n const app = client()\n .onRequest(schema.CLIENT_METHODS.session_request_permission, (ctx) => implementation.requestPermission(ctx.params))\n .onNotification(schema.CLIENT_METHODS.session_update, (ctx) => implementation.sessionUpdate(ctx.params))\n .onRequest(schema.CLIENT_METHODS.fs_write_text_file, async (ctx) => (await implementation.writeTextFile?.(ctx.params)) ?? {})\n .onRequest(schema.CLIENT_METHODS.fs_read_text_file, async (ctx) => (await implementation.readTextFile?.(ctx.params)))\n .onRequest(schema.CLIENT_METHODS.terminal_create, async (ctx) => (await implementation.createTerminal?.(ctx.params)))\n .onRequest(schema.CLIENT_METHODS.terminal_output, async (ctx) => (await implementation.terminalOutput?.(ctx.params)))\n .onRequest(schema.CLIENT_METHODS.terminal_release, async (ctx) => (await implementation.releaseTerminal?.(ctx.params)) ?? {})\n .onRequest(schema.CLIENT_METHODS.terminal_wait_for_exit, async (ctx) => (await implementation.waitForTerminalExit?.(ctx.params)))\n .onRequest(schema.CLIENT_METHODS.terminal_kill, async (ctx) => (await implementation.killTerminal?.(ctx.params)) ?? {});\n if (implementation.unstable_createElicitation) {\n app.onRequest(schema.CLIENT_METHODS.elicitation_create, (ctx) => implementation.unstable_createElicitation(ctx.params));\n }\n if (implementation.unstable_completeElicitation) {\n app.onNotification(schema.CLIENT_METHODS.elicitation_complete, (ctx) => implementation.unstable_completeElicitation(ctx.params));\n }\n if (implementation.extMethod) {\n app[appBuilder]().withHandler({\n handleMessage: async (message) => {\n if (message.kind !== \"request\" ||\n legacyClientRequestMethods.has(message.method)) {\n return Handled.no(message);\n }\n await message.responder.respond(await implementation.extMethod(message.method, message.params));\n return Handled.yes();\n },\n describe: () => \"legacy-client-extension-request\",\n });\n }\n if (implementation.extNotification) {\n app[appBuilder]().withHandler({\n handleMessage: async (message) => {\n if (message.kind !== \"notification\" ||\n legacyClientNotificationMethods.has(message.method)) {\n return Handled.no(message);\n }\n await implementation.extNotification(message.method, message.params);\n return Handled.yes();\n },\n describe: () => \"legacy-client-extension-notification\",\n });\n }\n return app;\n}\n/**\n * An agent-side connection to a client.\n *\n * This class provides the agent's view of an ACP connection, allowing\n * agents to communicate with clients. It implements the {@link Client} interface\n * to provide methods for requesting permissions, accessing the file system,\n * and sending session updates.\n *\n * See protocol docs: [Agent](https://agentclientprotocol.com/protocol/overview#agent)\n *\n * @deprecated Prefer {@link agent}, which registers typed handlers with a\n * single context object and supports direct app composition.\n */\nexport class AgentSideConnection {\n connection;\n /**\n * Creates a new agent-side connection to a client.\n *\n * This establishes the communication channel from the agent's perspective\n * following the ACP specification.\n *\n * @param toAgent - A function that creates an Agent handler to process incoming client requests\n * @param stream - The bidirectional message stream for communication. Typically created using\n * {@link ndJsonStream} for stdio-based connections.\n *\n * See protocol docs: [Communication Model](https://agentclientprotocol.com/protocol/overview#communication-model)\n *\n * @deprecated Prefer `agent({ name }).connect(stream)`.\n */\n constructor(toAgent, stream) {\n this.connection = legacyAgentApp(toAgent(this))[appBuilder]()\n .connect(stream);\n }\n /**\n * Handles session update notifications from the agent.\n *\n * This is a notification endpoint (no response expected) that sends\n * real-time updates about session progress, including message chunks,\n * tool calls, and execution plans.\n *\n * Note: Clients SHOULD continue accepting tool call updates even after\n * sending a `session/cancel` notification, as the agent may send final\n * updates before responding with the cancelled stop reason.\n *\n * See protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)\n */\n sessionUpdate(params) {\n return this.connection.sendNotification(schema.CLIENT_METHODS.session_update, params);\n }\n /**\n * Requests permission from the user for a tool call operation.\n *\n * Called by the agent when it needs user authorization before executing\n * a potentially sensitive operation. The client should present the options\n * to the user and return their decision.\n *\n * If the client cancels the prompt turn via `session/cancel`, it MUST\n * respond to this request with `RequestPermissionOutcome::Cancelled`.\n *\n * See protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/tool-calls#requesting-permission)\n */\n requestPermission(params) {\n return this.connection.sendRequest(schema.CLIENT_METHODS.session_request_permission, params);\n }\n /**\n * Reads content from a text file in the client's file system.\n *\n * Only available if the client advertises the `fs.readTextFile` capability.\n * Allows the agent to access file contents within the client's environment.\n *\n * See protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client)\n */\n readTextFile(params) {\n return this.connection.sendRequest(schema.CLIENT_METHODS.fs_read_text_file, params);\n }\n /**\n * Writes content to a text file in the client's file system.\n *\n * Only available if the client advertises the `fs.writeTextFile` capability.\n * Allows the agent to create or modify files within the client's environment.\n *\n * See protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client)\n */\n writeTextFile(params) {\n return this.connection.sendRequest(schema.CLIENT_METHODS.fs_write_text_file, params, emptyObjectResponse);\n }\n /**\n * Executes a command in a new terminal.\n *\n * Returns a `TerminalHandle` that can be used to get output, wait for exit,\n * kill the command, or release the terminal.\n *\n * The terminal can also be embedded in tool calls by using its ID in\n * `ToolCallContent` with type \"terminal\".\n *\n * @param params - The terminal creation parameters\n * @returns A handle to control and monitor the terminal\n */\n createTerminal(params) {\n return this.connection.sendRequest(schema.CLIENT_METHODS.terminal_create, params, (response) => TerminalHandle.create(response.terminalId, params.sessionId, this.connection));\n }\n /**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Creates an elicitation to request input from the user.\n *\n * @experimental\n */\n unstable_createElicitation(params) {\n return this.connection.sendRequest(schema.CLIENT_METHODS.elicitation_create, params);\n }\n /**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notifies the client that a URL-based elicitation is complete.\n *\n * @experimental\n */\n unstable_completeElicitation(params) {\n return this.connection.sendNotification(schema.CLIENT_METHODS.elicitation_complete, params);\n }\n request(method, params, options) {\n const spec = clientRequestSpecsByMethod[method];\n return this.connection.sendRequest(method, params, spec?.mapResponse, options);\n }\n notify(method, params) {\n return this.connection.sendNotification(method, params);\n }\n /**\n * Extension method.\n *\n * @deprecated Use {@link request}.\n */\n extMethod(method, params) {\n return this.request(method, params);\n }\n /**\n * Extension notification.\n *\n * @deprecated Use {@link notify}.\n */\n extNotification(method, params) {\n return this.notify(method, params);\n }\n /**\n * AbortSignal that aborts when the connection closes.\n *\n * This signal can be used to:\n * - Listen for connection closure: `connection.signal.addEventListener('abort', () => {...})`\n * - Check connection status synchronously: `if (connection.signal.aborted) {...}`\n * - Pass to other APIs (fetch, setTimeout) for automatic cancellation\n *\n * The connection closes when the underlying stream ends, either normally or due to an error.\n *\n * @example\n * ```typescript\n * const connection = new AgentSideConnection(agent, stream);\n *\n * // Listen for closure\n * connection.signal.addEventListener('abort', () => {\n * console.log('Connection closed - performing cleanup');\n * });\n *\n * // Check status\n * if (connection.signal.aborted) {\n * console.log('Connection is already closed');\n * }\n *\n * // Pass to other APIs\n * fetch(url, { signal: connection.signal });\n * ```\n */\n get signal() {\n return this.connection.signal;\n }\n /**\n * Promise that resolves when the connection closes.\n *\n * The connection closes when the underlying stream ends, either normally or due to an error.\n * Once closed, the connection cannot send or receive any more messages.\n *\n * This is useful for async/await style cleanup:\n *\n * @example\n * ```typescript\n * const connection = new AgentSideConnection(agent, stream);\n * await connection.closed;\n * console.log('Connection closed - performing cleanup');\n * ```\n */\n get closed() {\n return this.connection.closed;\n }\n}\n/**\n * Handle for controlling and monitoring a terminal created via `createTerminal`.\n *\n * Provides methods to:\n * - Get current output without waiting\n * - Wait for command completion\n * - Kill the running command\n * - Release terminal resources\n *\n * **Important:** Always call `release()` when done with the terminal to free resources.\n\n * The terminal supports async disposal via `Symbol.asyncDispose` for automatic cleanup.\n\n * You can use `await using` to ensure the terminal is automatically released when it\n * goes out of scope.\n */\nexport class TerminalHandle {\n /**\n * Terminal identifier returned by `terminal/create`.\n */\n id;\n sessionId;\n connection;\n constructor(id, sessionId, conn) {\n this.id = id;\n this.sessionId = sessionId;\n this.connection = conn;\n }\n /** @internal */\n static create(id, sessionId, conn) {\n return new TerminalHandle(id, sessionId, conn);\n }\n /**\n * Gets the current terminal output without waiting for the command to exit.\n */\n currentOutput() {\n return this.connection.sendRequest(schema.CLIENT_METHODS.terminal_output, {\n sessionId: this.sessionId,\n terminalId: this.id,\n });\n }\n /**\n * Waits for the terminal command to complete and returns its exit status.\n */\n waitForExit() {\n return this.connection.sendRequest(schema.CLIENT_METHODS.terminal_wait_for_exit, {\n sessionId: this.sessionId,\n terminalId: this.id,\n });\n }\n /**\n * Kills the terminal command without releasing the terminal.\n *\n * The terminal remains valid after killing, allowing you to:\n * - Get the final output with `currentOutput()`\n * - Check the exit status\n * - Release the terminal when done\n *\n * Useful for implementing timeouts or cancellation.\n */\n kill() {\n return this.connection.sendRequest(schema.CLIENT_METHODS.terminal_kill, {\n sessionId: this.sessionId,\n terminalId: this.id,\n }, emptyObjectResponse);\n }\n /**\n * Releases the terminal and frees all associated resources.\n *\n * If the command is still running, it will be killed.\n * After release, the terminal ID becomes invalid and cannot be used\n * with other terminal methods.\n *\n * Tool calls that already reference this terminal will continue to\n * display its output.\n *\n * **Important:** Always call this method when done with the terminal.\n */\n release() {\n return this.connection.sendRequest(schema.CLIENT_METHODS.terminal_release, {\n sessionId: this.sessionId,\n terminalId: this.id,\n }, emptyObjectResponse);\n }\n /**\n * Releases the terminal when used with `await using`.\n */\n async [Symbol.asyncDispose]() {\n await this.release();\n }\n}\n/**\n * A client-side connection to an agent.\n *\n * This class provides the client's view of an ACP connection, allowing\n * clients (such as code editors) to communicate with agents. It implements\n * the {@link Agent} interface to provide methods for initializing sessions, sending\n * prompts, and managing the agent lifecycle.\n *\n * See protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client)\n *\n * @deprecated Prefer {@link client}, which registers typed handlers with a\n * single context object and supports `connectWith` and session helpers.\n */\nexport class ClientSideConnection {\n connection;\n /**\n * Creates a new client-side connection to an agent.\n *\n * This establishes the communication channel between a client and agent\n * following the ACP specification.\n *\n * @param toClient - A function that creates a Client handler to process incoming agent requests\n * @param stream - The bidirectional message stream for communication. Typically created using\n * {@link ndJsonStream} for stdio-based connections.\n *\n * See protocol docs: [Communication Model](https://agentclientprotocol.com/protocol/overview#communication-model)\n *\n * @deprecated Prefer `client({ name }).connectWith(stream, async (ctx) => ...)`.\n */\n constructor(toClient, stream) {\n this.connection = legacyClientApp(toClient(this))[appBuilder]()\n .connect(stream);\n }\n /**\n * Establishes the connection with a client and negotiates protocol capabilities.\n *\n * This 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 *\n * The agent should respond with its supported protocol version and capabilities.\n *\n * See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)\n */\n initialize(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.initialize, params);\n }\n /**\n * Creates a new conversation session with the agent.\n *\n * Sessions represent independent conversation contexts with their own history and state.\n *\n * The 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 *\n * The request may include `additionalDirectories` to expand the session's filesystem\n * scope beyond `cwd` without changing the base for relative paths.\n *\n * May return an `auth_required` error if the agent requires authentication.\n *\n * See protocol docs: [Session Setup](https://agentclientprotocol.com/protocol/session-setup)\n */\n newSession(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.session_new, params);\n }\n /**\n * Loads an existing session to resume a previous conversation.\n *\n * This method is only available if the agent advertises the `loadSession` capability.\n *\n * The agent should:\n * - Restore the session context and conversation history\n * - Connect to the specified MCP servers\n * - Stream the entire conversation history back to the client via notifications\n *\n * The request may include `additionalDirectories` to set the complete list of\n * additional workspace roots for the loaded session.\n *\n * See protocol docs: [Loading Sessions](https://agentclientprotocol.com/protocol/session-setup#loading-sessions)\n */\n loadSession(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.session_load, params, emptyObjectResponse);\n }\n /**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Forks an existing session to create a new independent session.\n *\n * Creates a new session based on the context of an existing one, allowing\n * operations like generating summaries without affecting the original session's history.\n *\n * The request may include `additionalDirectories` to set the complete list of\n * additional workspace roots for the forked session.\n *\n * This method is only available if the agent advertises the `session.fork` capability.\n *\n * @experimental\n */\n unstable_forkSession(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.session_fork, params);\n }\n /**\n * Lists existing sessions from the agent.\n *\n * This method is only available if the agent advertises the `listSessions` capability.\n *\n * Returns a list of sessions with metadata like session ID, working directory,\n * title, and last update time. Supports filtering by working directory,\n * `additionalDirectories`, and cursor-based pagination.\n */\n listSessions(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.session_list, params);\n }\n /**\n * Deletes an existing session returned by `session/list`.\n *\n * This method is only available if the agent advertises the `sessionCapabilities.delete` capability.\n */\n deleteSession(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.session_delete, params, emptyObjectResponse);\n }\n /**\n * Resumes an existing session without returning previous messages.\n *\n * This method is only available if the agent advertises the `session.resume` capability.\n *\n * The agent should resume the session context, allowing the conversation to continue\n * without replaying the message history (unlike `session/load`).\n *\n * The request may include `additionalDirectories` to set the complete list of\n * additional workspace roots for the resumed session.\n */\n resumeSession(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.session_resume, params);\n }\n /**\n * Closes an active session and frees up any resources associated with it.\n *\n * This method is only available if the agent advertises the `session.close` capability.\n *\n * The agent must cancel any ongoing work (as if `session/cancel` was called)\n * and then free up any resources associated with the session.\n */\n closeSession(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.session_close, params, emptyObjectResponse);\n }\n /**\n * Sets the operational mode for a session.\n *\n * Allows switching between different agent modes (e.g., \"ask\", \"architect\", \"code\")\n * that affect system prompts, tool availability, and permission behaviors.\n *\n * The mode must be one of the modes advertised in `availableModes` during session\n * creation or loading. Agents may also change modes autonomously and notify the\n * client via `current_mode_update` notifications.\n *\n * This method can be called at any time during a session, whether the Agent is\n * idle or actively generating a turn.\n *\n * See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)\n */\n setSessionMode(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.session_set_mode, params, emptyObjectResponse);\n }\n /**\n * Set a configuration option for a given session.\n *\n * The response contains the full set of configuration options and their current values,\n * as changing one option may affect the available values or state of other options.\n */\n setSessionConfigOption(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.session_set_config_option, params);\n }\n /**\n * Authenticates the client using the specified authentication method.\n *\n * Called when the agent requires authentication before allowing session creation.\n * The client provides the authentication method ID that was advertised during initialization.\n *\n * After successful authentication, the client can proceed to create sessions with\n * `newSession` without receiving an `auth_required` error.\n *\n * See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)\n */\n authenticate(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.authenticate, params, emptyObjectResponse);\n }\n /**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Lists providers that can be configured by the client.\n *\n * This method is only available if the agent advertises the `providers` capability.\n *\n * @experimental\n */\n unstable_listProviders(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.providers_list, params);\n }\n /**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Replaces the configuration for a provider.\n *\n * This method is only available if the agent advertises the `providers` capability.\n *\n * @experimental\n */\n unstable_setProvider(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.providers_set, params, emptyObjectResponse);\n }\n /**\n * **UNSTABLE**\n *\n * This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Disables a provider.\n *\n * This method is only available if the agent advertises the `providers` capability.\n *\n * @experimental\n */\n unstable_disableProvider(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.providers_disable, params, emptyObjectResponse);\n }\n /**\n * Logout of the current authentication method.\n */\n logout(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.logout, params, emptyObjectResponse);\n }\n /**\n * Processes a user prompt within a session.\n *\n * This method handles the whole lifecycle of a prompt:\n * - Receives user messages with optional context (files, images, etc.)\n * - Processes the prompt using language models\n * - Reports language model content and tool calls to the Clients\n * - Requests permission to run tools\n * - Executes any requested tool calls\n * - Returns when the turn is complete with a stop reason\n *\n * See protocol docs: [Prompt Turn](https://agentclientprotocol.com/protocol/prompt-turn)\n */\n prompt(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.session_prompt, params);\n }\n /**\n * Cancels ongoing operations for a session.\n *\n * This is a notification sent by the client to cancel an ongoing prompt turn.\n *\n * Upon receiving this notification, the Agent SHOULD:\n * - Stop all language model requests as soon as possible\n * - Abort all tool call invocations in progress\n * - Send any pending `session/update` notifications\n * - Respond to the original `session/prompt` request with `StopReason::Cancelled`\n *\n * See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation)\n */\n cancel(params) {\n return this.connection.sendNotification(schema.AGENT_METHODS.session_cancel, params);\n }\n /**\n * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Starts a NES (Next Edit Suggestions) session.\n *\n * @experimental\n */\n unstable_startNes(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.nes_start, params);\n }\n /**\n * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Sends a NES suggestion request.\n *\n * @experimental\n */\n unstable_suggestNes(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.nes_suggest, params);\n }\n /**\n * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Closes a NES session.\n *\n * @experimental\n */\n unstable_closeNes(params) {\n return this.connection.sendRequest(schema.AGENT_METHODS.nes_close, params, emptyObjectResponse);\n }\n /**\n * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notifies the agent that a document was opened.\n *\n * @experimental\n */\n unstable_didOpenDocument(params) {\n return this.connection.sendNotification(schema.AGENT_METHODS.document_did_open, params);\n }\n /**\n * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notifies the agent that a document was changed.\n *\n * @experimental\n */\n unstable_didChangeDocument(params) {\n return this.connection.sendNotification(schema.AGENT_METHODS.document_did_change, params);\n }\n /**\n * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notifies the agent that a document was closed.\n *\n * @experimental\n */\n unstable_didCloseDocument(params) {\n return this.connection.sendNotification(schema.AGENT_METHODS.document_did_close, params);\n }\n /**\n * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notifies the agent that a document was saved.\n *\n * @experimental\n */\n unstable_didSaveDocument(params) {\n return this.connection.sendNotification(schema.AGENT_METHODS.document_did_save, params);\n }\n /**\n * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notifies the agent that a document received focus.\n *\n * @experimental\n */\n unstable_didFocusDocument(params) {\n return this.connection.sendNotification(schema.AGENT_METHODS.document_did_focus, params);\n }\n /**\n * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notifies the agent that a NES suggestion was accepted.\n *\n * @experimental\n */\n unstable_acceptNes(params) {\n return this.connection.sendNotification(schema.AGENT_METHODS.nes_accept, params);\n }\n /**\n * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.\n *\n * Notifies the agent that a NES suggestion was rejected.\n *\n * @experimental\n */\n unstable_rejectNes(params) {\n return this.connection.sendNotification(schema.AGENT_METHODS.nes_reject, params);\n }\n request(method, params, options) {\n const spec = agentRequestSpecsByMethod[method];\n return this.connection.sendRequest(method, params, spec?.mapResponse, options);\n }\n notify(method, params) {\n return this.connection.sendNotification(method, params);\n }\n /**\n * Extension method.\n *\n * @deprecated Use {@link request}.\n */\n extMethod(method, params) {\n return this.request(method, params);\n }\n /**\n * Extension notification.\n *\n * @deprecated Use {@link notify}.\n */\n extNotification(method, params) {\n return this.notify(method, params);\n }\n /**\n * AbortSignal that aborts when the connection closes.\n *\n * This signal can be used to:\n * - Listen for connection closure: `connection.signal.addEventListener('abort', () => {...})`\n * - Check connection status synchronously: `if (connection.signal.aborted) {...}`\n * - Pass to other APIs (fetch, setTimeout) for automatic cancellation\n *\n * The connection closes when the underlying stream ends, either normally or due to an error.\n *\n * @example\n * ```typescript\n * const connection = new ClientSideConnection(client, stream);\n *\n * // Listen for closure\n * connection.signal.addEventListener('abort', () => {\n * console.log('Connection closed - performing cleanup');\n * });\n *\n * // Check status\n * if (connection.signal.aborted) {\n * console.log('Connection is already closed');\n * }\n *\n * // Pass to other APIs\n * fetch(url, { signal: connection.signal });\n * ```\n */\n get signal() {\n return this.connection.signal;\n }\n /**\n * Promise that resolves when the connection closes.\n *\n * The connection closes when the underlying stream ends, either normally or due to an error.\n * Once closed, the connection cannot send or receive any more messages.\n *\n * This is useful for async/await style cleanup:\n *\n * @example\n * ```typescript\n * const connection = new ClientSideConnection(client, stream);\n * await connection.closed;\n * console.log('Connection closed - performing cleanup');\n * ```\n */\n get closed() {\n return this.connection.closed;\n }\n}\n//# sourceMappingURL=acp.js.map","import { accessSync, constants, existsSync } from 'node:fs'\nimport { delimiter, join } from 'node:path'\nimport { homedir } from 'node:os'\nimport type { RuntimeDef } from '../config/config-schema.js'\n\n/**\n * Host-availability probing for runtimes.\n *\n * `resolveRuntimes()` produces a runtime for every ACP-registry entry that has a\n * distribution for this platform — but that says nothing about whether the tool\n * is actually runnable *here*. This module answers that question so the daemon\n * only advertises genuinely-installed runtimes in `RegisterReq.capabilities`.\n *\n * Two layers:\n * 1. A generic launcher check — is the runtime's `command` resolvable? For a\n * runtime distributed as a real binary (`command` is the tool's own\n * executable) this is a meaningful signal: the binary on `$PATH` means it's\n * installed.\n * 2. For runtimes distributed via a package launcher (`npx`/`uvx`), (1) is\n * meaningless — the launcher fetches on demand, so \"npx exists\" is true on\n * virtually every dev host and tells us nothing about the wrapped agent. For\n * those we REQUIRE a per-runtime custom probe (`CUSTOM_PROBES`) that looks for\n * the wrapped CLI's own config/state dir, which appears once the user has\n * installed and run/initialized it. A launcher-distributed runtime with no\n * probe is treated as NOT installed — otherwise every npx/uvx agent in the\n * ACP registry would be falsely advertised just because `npx` is on `$PATH`.\n *\n * The custom probes test for the config *directory* (the \"installed & initialized\n * on this host\" signal). A stricter \"is logged in\" check would look for the auth\n * file instead (e.g. `~/.codex/auth.json`), but that yields false negatives for\n * users who authenticate via an API-key env var, so directory presence is the\n * pragmatic signal. Paths verified against each tool's docs (July 2026).\n */\n\nconst isWin = process.platform === 'win32'\n\nfunction isExecutableFile(p: string): boolean {\n try {\n // X_OK is meaningless on Windows; fall back to mere existence there.\n accessSync(p, isWin ? constants.F_OK : constants.X_OK)\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Resolve a launcher command the way a shell would. A command containing a path\n * separator is treated as a literal path; a bare name is searched across `$PATH`\n * (trying `$PATHEXT` extensions on Windows).\n */\nexport function isCommandAvailable(command: string, env: NodeJS.ProcessEnv = process.env): boolean {\n return resolveCommandPath(command, env) !== undefined\n}\n\n/**\n * Resolve a launcher/command to its absolute path the way a shell would — a path\n * containing a separator is checked literally; a bare name is searched across\n * `$PATH` (trying `$PATHEXT` extensions on Windows). Returns undefined if not found.\n */\nexport function resolveCommandPath(command: string, env: NodeJS.ProcessEnv = process.env): string | undefined {\n const exts = isWin ? ['', ...(env.PATHEXT ?? '.EXE;.CMD;.BAT;.COM').split(';')] : ['']\n const hasSep = command.includes('/') || (isWin && command.includes('\\\\'))\n if (hasSep) {\n // Try as a literal path relative to CWD first (covers auto-downloaded archives\n // where the binary sits in the extraction directory).\n const literal = exts.map((ext) => command + ext).find(isExecutableFile)\n if (literal) return literal\n // Not found as a literal path — the ACP registry stores binary commands with a\n // `./` prefix (\"./opencode\", \"./goose\", …) which is meaningful when the daemon\n // downloads and extracts the archive itself, but the tool may also be installed\n // directly on `$PATH` as just the basename. Fall back to PATH search with the\n // basename (stripping any directory prefix) so the probe finds it either way.\n const basename = command.split(/[/\\\\]/).filter(Boolean).pop() ?? command\n if (basename !== command) {\n const dirs = (env.PATH ?? '').split(delimiter).filter(Boolean)\n for (const dir of dirs) {\n for (const ext of exts) {\n const p = join(dir, basename) + ext\n if (isExecutableFile(p)) return p\n }\n }\n }\n return undefined\n }\n const dirs = (env.PATH ?? '').split(delimiter).filter(Boolean)\n for (const dir of dirs) {\n for (const ext of exts) {\n const p = join(dir, command) + ext\n if (isExecutableFile(p)) return p\n }\n }\n return undefined\n}\n\n/** Extra, runtime-specific check layered (AND) on top of the launcher probe. */\nexport type RuntimeProbe = (env: NodeJS.ProcessEnv) => boolean\n\n// --- home / XDG path resolution (honors the standard env overrides) ----------\n\nfunction home(env: NodeJS.ProcessEnv): string {\n return (isWin ? env.USERPROFILE : env.HOME) || homedir()\n}\nfunction xdgConfigHome(env: NodeJS.ProcessEnv): string {\n return env.XDG_CONFIG_HOME || join(home(env), '.config')\n}\nfunction xdgDataHome(env: NodeJS.ProcessEnv): string {\n return env.XDG_DATA_HOME || join(home(env), '.local', 'share')\n}\nfunction pathExists(p: string | undefined): boolean {\n return !!p && existsSync(p)\n}\n/** True if any candidate path exists (undefined candidates are skipped). */\nfunction anyExists(...candidates: (string | undefined)[]): boolean {\n return candidates.some(pathExists)\n}\n\n/**\n * Custom probes keyed by ACP-registry runtime id. Add an entry here whenever the\n * launcher-on-PATH check is too weak to mean \"actually installed & set up\".\n * Each tests for the tool's home/XDG config dir (or, where the dir is ambiguous,\n * a tool-specific file), honoring the documented env overrides.\n */\nexport const CUSTOM_PROBES: Record<string, RuntimeProbe> = {\n // Anthropic Claude Code — ~/.claude state dir + ~/.claude.json global config.\n 'claude-acp': (env) => anyExists(join(home(env), '.claude'), join(home(env), '.claude.json')),\n\n // OpenAI Codex CLI — ~/.codex (honors $CODEX_HOME).\n 'codex-acp': (env) => anyExists(env.CODEX_HOME, join(home(env), '.codex')),\n\n // Google Gemini CLI — ~/.gemini.\n gemini: (env) => pathExists(join(home(env), '.gemini')),\n\n // Qwen Code (Gemini-CLI fork) — ~/.qwen.\n 'qwen-code': (env) => pathExists(join(home(env), '.qwen')),\n\n // GitHub Copilot CLI — ~/.copilot (honors $COPILOT_HOME).\n 'github-copilot-cli': (env) => anyExists(env.COPILOT_HOME, join(home(env), '.copilot')),\n\n // Cursor CLI — ~/.cursor is shared with the editor, so probe the CLI-specific\n // config file (honors $CURSOR_CONFIG_DIR).\n cursor: (env) =>\n anyExists(\n env.CURSOR_CONFIG_DIR ? join(env.CURSOR_CONFIG_DIR, 'cli-config.json') : undefined,\n join(home(env), '.cursor', 'cli-config.json')\n ),\n\n // sst OpenCode — XDG config dir + auth file under XDG data. `~/.opencode` is the\n // project-level config dir, not the documented global one, but it lands in $HOME\n // when opencode is run from home, so accept it as a fallback signal.\n opencode: (env) =>\n anyExists(\n join(xdgConfigHome(env), 'opencode'),\n join(xdgDataHome(env), 'opencode', 'auth.json'),\n join(home(env), '.opencode')\n ),\n\n // pi (svkozak pi-acp npx adapter) — ~/.pi (agent state under ~/.pi/agent).\n 'pi-acp': (env) => pathExists(join(home(env), '.pi')),\n\n // Nous Research Hermes — ~/.hermes (honors $HERMES_HOME, which relocates the\n // whole home dir). Not yet in the ACP registry; this covers a user-configured\n // `hermes` runtime, keyed like the other native-ACP tools (opencode/goose).\n hermes: (env) => anyExists(env.HERMES_HOME, join(home(env), '.hermes')),\n\n // Block goose — $XDG_CONFIG_HOME/goose.\n goose: (env) => pathExists(join(xdgConfigHome(env), 'goose')),\n\n // Sourcegraph Amp — $XDG_CONFIG_HOME/amp (honors $AMP_SETTINGS_FILE).\n 'amp-acp': (env) => anyExists(env.AMP_SETTINGS_FILE, join(xdgConfigHome(env), 'amp')),\n\n // Augment auggie — ~/.augment.\n auggie: (env) => pathExists(join(home(env), '.augment')),\n\n // Cline CLI — ~/.cline (honors $CLINE_DATA_DIR).\n cline: (env) => anyExists(env.CLINE_DATA_DIR, join(home(env), '.cline')),\n\n // xAI Grok CLI — ~/.grok.\n 'grok-build': (env) => pathExists(join(home(env), '.grok')),\n\n // Moonshot Kimi CLI — ~/.kimi (legacy) or ~/.kimi-code (newer, honors $KIMI_CODE_HOME).\n kimi: (env) => anyExists(env.KIMI_CODE_HOME, join(home(env), '.kimi'), join(home(env), '.kimi-code')),\n\n // Factory Droid — ~/.factory.\n 'factory-droid': (env) => pathExists(join(home(env), '.factory')),\n\n // Cognition Devin (for Terminal) — XDG config + data dirs.\n devin: (env) => anyExists(join(xdgConfigHome(env), 'devin'), join(xdgDataHome(env), 'devin'))\n}\n\n/**\n * Package launchers that fetch-and-run on demand. When a runtime is launched via\n * one of these, the launcher being on `$PATH` says nothing about whether the\n * wrapped agent is installed, so such runtimes require a custom probe to count.\n */\nconst PACKAGE_LAUNCHERS = new Set(['npx', 'uvx'])\n\n/** Is this runtime actually usable on this host? */\nexport function isRuntimeAvailable(id: string, rt: RuntimeDef, env: NodeJS.ProcessEnv = process.env): boolean {\n if (!isCommandAvailable(rt.command, env)) return false\n const custom = CUSTOM_PROBES[id]\n if (custom) return custom(env)\n // No bespoke probe: trust the launcher check only for real-binary distributions.\n // Package-launcher runtimes (npx/uvx) without a probe are NOT considered\n // installed — the launcher is present on almost every host regardless.\n return !PACKAGE_LAUNCHERS.has(rt.command)\n}\n\n/**\n * Filter a runtime map down to those installed on this host — what the daemon\n * should report to the Control Plane and is able to launch.\n */\nexport function installedRuntimes(\n runtimes: Record<string, RuntimeDef>,\n env: NodeJS.ProcessEnv = process.env\n): Record<string, RuntimeDef> {\n const out: Record<string, RuntimeDef> = {}\n for (const [id, rt] of Object.entries(runtimes)) {\n if (isRuntimeAvailable(id, rt, env)) out[id] = rt\n }\n return out\n}\n","import { spawn, type ChildProcess } from 'node:child_process'\nimport { Readable, Writable } from 'node:stream'\nimport {\n client as createClientApp,\n methods,\n ndJsonStream,\n type ClientConnection,\n type ContentBlock,\n type CreateElicitationRequest,\n type CreateElicitationResponse,\n type McpServer,\n type RequestPermissionRequest,\n type RequestPermissionResponse,\n type SessionConfigOption,\n type SessionUpdate,\n type StopReason,\n type Usage\n} from '@agentclientprotocol/sdk'\nimport {\n HOOK_REPORT_REASON_PROVIDER_AUTH_REQUIRED,\n HOOK_REPORT_REASON_PROVIDER_QUOTA_EXHAUSTED,\n type McpTransportCapabilities\n} from '@agentconnect.md/protocol'\nimport type { RuntimeDef } from '../config/config-schema.js'\nimport { resolveCommandPath } from '../runtimes/probe.js'\nimport type { Logger } from '../log.js'\n\nconst PROTOCOL_VERSION = 1\n\n/** A session/load may replay the historical conversation stream. Keep that off\n * platform transports, but preserve latest-wins metadata needed to converge the\n * local/CP session projection after a restart. */\nexport function shouldForwardUpdateDuringLoad(update: SessionUpdate): boolean {\n return update.sessionUpdate === 'session_info_update' || update.sessionUpdate === 'usage_update'\n}\n\n/** A runtime's advertised model selector, distilled from ACP session config options. */\nexport interface ModelOptions {\n /** The model id currently selected for the session (the agent's default). */\n current?: string\n /** Selectable model ids (group structure flattened away). */\n models: string[]\n}\n\n/** A runtime's advertised reasoning-effort selector (ACP `thought_level`), distilled\n * from session config options and augmented with the synthetic `ultracode`/`max`\n * entries on Claude runtimes (they aren't `thought_level` select values — see\n * {@link ULTRACODE_EFFORT} / {@link claudeSessionMeta}). */\nexport interface EffortOptions {\n /** The effort level currently selected on the session (per the `thought_level`\n * select's currentValue) — note a `_meta`-driven `ultracode` won't appear here. */\n current?: string\n /** Selectable effort levels (group structure flattened; synthetic entries appended). */\n efforts: string[]\n}\n\n/** A runtime's advertised permission/approval mode selector (ACP `mode`). Values are\n * runtime-owned (`default` / `plan` on Claude, `agent` / `read-only` on Codex). */\nexport interface PermissionModeOptions {\n /** The permission mode currently selected for the session. */\n current?: string\n /** Selectable permission mode values (group structure flattened away). */\n modes: string[]\n}\n\n/** A runtime's advertised fast-mode toggle (ACP `model_config` on/off select). The\n * option only exists once a fast-capable model is selected, so `null` means the\n * current model offers no fast toggle. */\nexport interface FastModeOption {\n /** Whether fast mode is currently on (the select's currentValue === \"on\"). */\n current: boolean\n}\n\n/**\n * Desired per-session runtime config, applied through ACP session config\n * options (`session/set_config_option`) right after `session/new` /\n * `session/load`. This is the only channel a runtime like claude-acp accepts\n * for reasoning effort — there is no env var or spawn flag for it; the model\n * additionally has env fallbacks some runtimes read (see cp-overlay.ts).\n */\nexport interface SessionConfigPrefs {\n /** Model id, matched against the option tagged `category: \"model\"`. */\n model?: string\n /** Effort level, matched against the option tagged `category: \"thought_level\"`. */\n reasoningEffort?: string\n /** Fast mode, matched against the option tagged `category: \"model_config\"` —\n * both claude-acp (id \"fast\") and codex-acp (id \"fast-mode\") advertise it\n * there, as an on/off `select` (we don't opt into boolean config options).\n * The option only exists when the selected model supports fast mode, so an\n * unsupported combination degrades to a logged skip. undefined ⇒ don't touch. */\n fastMode?: boolean\n /** Runtime permission/approval mode, matched against the option tagged\n * `category: \"mode\"`. Values are runtime-owned (`default` / `plan` on\n * claude-acp, `agent` / `read-only` on codex-acp, etc.). */\n permissionMode?: string\n /** Optional host-level system-prompt seed, layered ahead of any per-session append\n * on Claude runtimes (see {@link claudeSessionMeta}). Left unset by default: the\n * agent's identity + description now travel per-session in the agent meta object\n * (see SessionManager), which also carries the channel source. undefined ⇒ none. */\n systemPrompt?: string\n}\n\n/** The `session/set_config_option` call that applies a desired value, or the reason none is needed. */\nexport type ConfigSelectionPlan = { configId: string; value: string } | { skip: string }\n\n/**\n * Distill the human-actionable reason from a failed ACP request. Adapters wrap\n * their runtime's own message in a JSON-RPC error whose `message` is often just\n * the generic title — codex-acp reports quota exhaustion as code -32603\n * \"Internal error\" with the real text (\"You've hit your usage limit. Visit … or\n * try again at 7:01 PM.\") under `error.data.message` — so prefer that detail\n * over a bare title, and append it when a specific message carries extra data.\n * Non-RequestError failures fall back to the plain Error message.\n */\nexport function turnFailureReason(err: unknown): string {\n const e = err as { message?: unknown; data?: { message?: unknown } } | null | undefined\n const msg = typeof e?.message === 'string' && e.message.trim() ? e.message.trim() : String(err)\n const detail = typeof e?.data?.message === 'string' ? e.data.message.trim() : ''\n if (!detail || msg.includes(detail)) return msg\n // The SDK's generic titles (RequestError statics) add nothing over the\n // runtime's own text; any more specific message keeps both.\n const generic =\n /^(parse error|invalid request|invalid params|internal error|request cancelled|authentication required|resource not found)$/i\n return generic.test(msg) ? detail : `${msg}: ${detail}`\n}\n\n/** Machine-stable classification for a failed ACP turn. Keep the default conservative:\n * callers only relax reporting for a provider limit or revoked credential that\n * we can identify from a structured adapter code or narrow provider-authored\n * message. In particular, an ordinary transient `rate_limit_error` or generic\n * \"sign in again\" text remains `turn_failed`.\n */\nexport type TurnFailureCode =\n typeof HOOK_REPORT_REASON_PROVIDER_AUTH_REQUIRED | typeof HOOK_REPORT_REASON_PROVIDER_QUOTA_EXHAUSTED | 'turn_failed'\n\nconst PROVIDER_QUOTA_CODES = new Set([\n 'billinghardlimitreached',\n 'creditbalancetoolow',\n 'creditsexhausted',\n 'insufficientquota',\n 'nocreditsremaining',\n 'outofcredits',\n 'planlimitreached',\n 'quotaexhausted',\n 'usagelimitexceeded',\n 'usagelimitreached'\n])\n\nconst PROVIDER_QUOTA_MESSAGES = [\n /\\b(?:you(?:'|’)ve|you have) hit your (?:[a-z]+ )?usage limit\\b/i,\n /\\busage limit (?:has been )?(?:reached|exceeded)\\b/i,\n /\\b(?:you(?:'|’)ve|you have) hit your limit\\b[\\s\\S]{0,120}\\bresets?\\b/i,\n /\\b(?:credit|credits) balance (?:is )?(?:too low|depleted|exhausted)\\b/i,\n /\\b(?:insufficient|not enough|no) (?:api )?credits?(?: (?:remaining|available))?\\b/i,\n /\\b(?:out of|exhausted) (?:api )?credits?\\b/i,\n /\\bexceeded your current quota\\b/i,\n /\\b(?:billing|plan|account) quota (?:has been )?(?:reached|exceeded|exhausted)\\b/i\n]\n\nconst PROVIDER_AUTH_MESSAGES = [\n /\\brefresh token was revoked\\b/i,\n /\\baccess token could not be refreshed\\b[\\s\\S]{0,160}\\b(?:log out|sign out) and sign in again\\b/i\n]\n\n/** Collect the small family of fields ACP adapters and provider SDKs use to\n * wrap an upstream error. The depth/seen guards tolerate nested `error.data`\n * and `cause` shapes without recursively inspecting an arbitrary request body.\n */\nfunction failureSignals(value: unknown, depth = 0, seen = new Set<object>()): string[] {\n if (typeof value === 'string') return value.trim() ? [value.trim()] : []\n if (!value || typeof value !== 'object' || depth >= 5 || seen.has(value)) return []\n seen.add(value)\n const out: string[] = []\n for (const key of [\n 'message',\n 'code',\n 'type',\n 'reason',\n 'codexErrorInfo',\n 'errorInfo',\n 'errorType',\n 'error_type',\n 'error',\n 'data',\n 'details',\n 'cause'\n ]) {\n try {\n out.push(...failureSignals(Reflect.get(value, key), depth + 1, seen))\n } catch {\n // A hostile/custom error getter must not replace the original turn error.\n }\n }\n return out\n}\n\nexport function turnFailureCode(err: unknown): TurnFailureCode {\n const signals = failureSignals(err)\n if (signals.some((signal) => PROVIDER_QUOTA_CODES.has(signal.toLowerCase().replace(/[^a-z0-9]/g, '')))) {\n return HOOK_REPORT_REASON_PROVIDER_QUOTA_EXHAUSTED\n }\n const message = signals.join('\\n')\n if (PROVIDER_AUTH_MESSAGES.some((pattern) => pattern.test(message))) {\n return HOOK_REPORT_REASON_PROVIDER_AUTH_REQUIRED\n }\n return PROVIDER_QUOTA_MESSAGES.some((pattern) => pattern.test(message))\n ? HOOK_REPORT_REASON_PROVIDER_QUOTA_EXHAUSTED\n : 'turn_failed'\n}\n\n/**\n * Resolve how to apply `desired` to the select config option tagged `category`.\n * `{skip}` (with the reason) means nothing should be sent: the runtime\n * advertises no such selector, doesn't offer the value, or already has it set.\n */\nexport function planConfigSelection(\n configOptions: SessionConfigOption[] | null | undefined,\n category: string,\n desired: string\n): ConfigSelectionPlan {\n const opt = configOptions?.find((o) => o.category === category && o.type === 'select')\n if (!opt || opt.type !== 'select') return { skip: `runtime advertises no ${category} selector` }\n const values = opt.options.flatMap((o) => ('group' in o ? o.options : [o])).map((o) => o.value)\n if (!values.includes(desired)) {\n return { skip: `value \"${desired}\" not offered (available: ${values.join(', ')})` }\n }\n if (opt.currentValue === desired) return { skip: `already \"${desired}\"` }\n return { configId: opt.id, value: desired }\n}\n\n/** Effort sentinel `'ultracode'` (matching Claude Code's own `ultracode` settings\n * key) meaning xhigh reasoning PLUS standing dynamic-workflow orchestration. It is\n * deliberately NOT a `thought_level` select value: the claude-acp runtime rejects\n * effort=\"ultracode\" (\"Invalid value\"). See {@link claudeSessionMeta}. */\nexport const ULTRACODE_EFFORT = 'ultracode'\n\n/** The session `_meta` sent to a Claude runtime on session/new and session/load\n * (`_meta.claudeCode.options` is spread into the SDK `query()` options layer), or\n * undefined off Claude runtimes. Three things ride on it:\n *\n * - `thinking`: recent models default `thinking.display` to \"omitted\" — thinking\n * blocks stream signature-only with empty text, so the ACP wrapper never emits\n * `agent_thought_chunk` and the transcript loses its reasoning rows. Request\n * \"summarized\" (the fullest display the API offers) so thoughts reach the stream.\n * - `settings.ultracode` (effort \"ultracode\" only): a session-scoped flag setting\n * the effort select can't reach — the runtime rejects effort=\"ultracode\".\n * `enableWorkflows` rides along so the \"pro\" plan default (workflows off) doesn't\n * silently drop the orchestration half. Best-effort: on a non-xhigh-capable model\n * or with workflows unavailable the runtime reports `applied.ultracode=false` and\n * the session still runs on its default effort — nothing to fail on our side.\n * - `systemPrompt` (top-level, sibling of `claudeCode`): the agent's system-prompt\n * seed PLUS, on a fresh session, the agent's memory index (standing context, not a\n * user turn — see SessionManager). We send it as `{ append }` so it layers ON TOP\n * of claude-acp's `claude_code` preset (keeping the coding scaffolding) rather than\n * replacing it. Honored by claude-agent-acp #91; older runtimes ignore the unknown\n * `_meta` key. This is the only channel for the system prompt — ACP session/new has\n * no such field, and other runtimes have no equivalent yet (see cp-overlay.ts). */\nexport function claudeSessionMeta(\n reasoningEffort: string | undefined,\n isClaudeRuntime: boolean,\n systemPrompt?: string,\n memoryAppend?: string\n):\n | {\n claudeCode: {\n options: {\n thinking: { type: 'adaptive'; display: 'summarized' }\n settings?: { ultracode: true; enableWorkflows: true }\n }\n }\n systemPrompt?: { append: string }\n }\n | undefined {\n if (!isClaudeRuntime) return undefined\n // The seed and the memory index ride the SAME append (seed first, blank line, then\n // memory). Either/both/neither — an empty result omits `systemPrompt` entirely.\n const append = [systemPrompt, memoryAppend].filter(Boolean).join('\\n\\n')\n return {\n claudeCode: {\n options: {\n thinking: { type: 'adaptive', display: 'summarized' },\n ...(reasoningEffort === ULTRACODE_EFFORT\n ? { settings: { ultracode: true as const, enableWorkflows: true as const } }\n : {})\n }\n },\n ...(append ? { systemPrompt: { append } } : {})\n }\n}\n\n/**\n * Extract the model selector from a session's `configOptions`. ACP models are an\n * (experimental) session config option tagged `category: \"model\"`, `type:\n * \"select\"`; the selectable values (optionally grouped) are the model list.\n * Returns null when the agent advertises no model selector.\n */\nexport function modelOptionsFrom(configOptions: SessionConfigOption[] | null | undefined): ModelOptions | null {\n const model = configOptions?.find((o) => o.category === 'model' && o.type === 'select')\n if (!model || model.type !== 'select') return null\n // `options` is either a flat SelectOption[] or a SelectGroup[]; flatten groups.\n const models = model.options.flatMap((o) => ('group' in o ? o.options : [o])).map((o) => o.value)\n return { current: model.currentValue, models }\n}\n\n/**\n * Extract the reasoning-effort selector from a session's `configOptions` (ACP\n * `category: \"thought_level\"`, `type: \"select\"`). Effort support is per-model: a runtime\n * only advertises this select for models that support effort (e.g. Opus/Sonnet, not\n * Haiku), so a missing/empty selector means the CURRENT model has no effort → returns\n * null and the picker is hidden. When the model DOES support effort, Claude runtimes get\n * the synthetic `max`/`ultracode` entries appended if not already offered (see\n * {@link ULTRACODE_EFFORT}) — never fabricated for a model that lacks effort entirely.\n */\nexport function effortOptionsFrom(\n configOptions: SessionConfigOption[] | null | undefined,\n isClaudeRuntime: boolean\n): EffortOptions | null {\n const opt = configOptions?.find((o) => o.category === 'thought_level' && o.type === 'select')\n if (!opt || opt.type !== 'select') return null\n const advertised = opt.options.flatMap((o) => ('group' in o ? o.options : [o])).map((o) => o.value)\n if (advertised.length === 0) return null\n const efforts = [...advertised]\n // The current model supports effort — Claude additionally allows `max` (session-only)\n // and `ultracode` (xhigh + workflow orchestration), which aren't `thought_level` values.\n if (isClaudeRuntime) for (const extra of ['max', ULTRACODE_EFFORT]) if (!efforts.includes(extra)) efforts.push(extra)\n return { current: opt.currentValue, efforts }\n}\n\n/**\n * Extract the permission/approval mode selector from a session's `configOptions` (ACP\n * `category: \"mode\"`, `type: \"select\"`). Returns null when the runtime exposes no mode\n * selector.\n */\nexport function permissionModeOptionsFrom(\n configOptions: SessionConfigOption[] | null | undefined\n): PermissionModeOptions | null {\n const opt = configOptions?.find((o) => o.category === 'mode' && o.type === 'select')\n if (!opt || opt.type !== 'select') return null\n const modes = opt.options.flatMap((o) => ('group' in o ? o.options : [o])).map((o) => o.value)\n return { current: opt.currentValue, modes }\n}\n\n/**\n * Extract the fast-mode toggle from a session's `configOptions` (ACP `category:\n * \"model_config\"`, `type: \"select\"` with on/off values). Returns null when the current\n * model advertises no fast toggle.\n */\nexport function fastOptionFrom(configOptions: SessionConfigOption[] | null | undefined): FastModeOption | null {\n const opt = configOptions?.find((o) => o.category === 'model_config' && o.type === 'select')\n if (!opt || opt.type !== 'select') return null\n return { current: opt.currentValue === 'on' }\n}\n\nexport class AcpHost {\n private child?: ChildProcess\n private conn?: ClientConnection\n // acpSessionIds this process created (or loaded). ACP sessions are in-memory in\n // the subprocess, so an id persisted across a daemon restart / host eviction is\n // unknown to a fresh process and must be re-created or re-loaded.\n private live = new Set<string>()\n // sessionIds currently mid-load: `session/load` makes the agent REPLAY its whole\n // history via session/update, which we must NOT forward to the platform (it would\n // re-post the entire conversation). Cleared when the load resolves.\n private loadingSessions = new Set<string>()\n // whether the agent advertised the `loadSession` capability at initialize.\n private canLoad = false\n // prompt content-block variants the agent opted into at initialize. text +\n // resource_link are always baseline; image/audio/embeddedContext are gated.\n private promptCaps: { image?: boolean; audio?: boolean; embeddedContext?: boolean } = {}\n // Selectors from the most recent session/new|load|set, distilled from the reconciled\n // config options. Populated by refreshOptionCaches(); read via modelOptions() /\n // effortOptions() / fastModeOption(). null ⇒ the runtime advertised no such selector.\n private lastModelOptions: ModelOptions | null = null\n private lastEffortOptions: EffortOptions | null = null\n private lastPermissionModeOptions: PermissionModeOptions | null = null\n private lastFastOption: FastModeOption | null = null\n // The most recent reconciled config-option set per live session, cached so a\n // mid-session `set_config_option` (e.g. setSessionModel) can plan against the\n // current options without a round-trip. Updated on new/load and each set.\n private sessionConfigs = new Map<string, SessionConfigOption[] | null | undefined>()\n // ACP protocol version the agent negotiated at initialize (it echoes the version\n // we requested if supported, else downgrades to its own latest). Read via\n // acpProtocolVersion(); undefined until start() completes the handshake.\n private negotiatedProtocolVersion?: number\n // Optional MCP transports the agent opted into at initialize (stdio is the ACP\n // baseline and always accepted). null until the handshake completes; the\n // unstable `acp` transport flag is deliberately ignored. Read via mcpCapabilities().\n private mcpCaps: McpTransportCapabilities | null = null\n\n constructor(\n private runtime: RuntimeDef,\n private opts: {\n onUpdate: (sessionId: string, update: SessionUpdate) => void\n /**\n * Interactive permission policy for ACP `session/request_permission`. When set,\n * the daemon renders the options to the user (e.g. a Slack card) and resolves\n * with their choice. Omitted (or throwing / returning undefined) falls back to\n * the non-interactive auto-allow below — so a platform with no interactive\n * surface, or a resolver that fails, never hangs the turn.\n */\n onPermission?: (\n sessionId: string,\n params: RequestPermissionRequest\n ) => Promise<RequestPermissionResponse | undefined>\n /**\n * Structured-input policy for ACP `elicitation/create` (form mode). When set, the\n * daemon renders the form to the user (e.g. a Slack select/buttons card) and\n * resolves with their choice. Omitted / throwing / returning undefined falls back\n * to declining the elicitation — the spec has agents handle `decline` — so a\n * platform with no interactive surface, or an unrenderable form, never hangs.\n */\n onElicit?: (sessionId: string, params: CreateElicitationRequest) => Promise<CreateElicitationResponse | undefined>\n env?: Record<string, string>\n configPrefs?: SessionConfigPrefs\n log?: Logger\n }\n ) {}\n\n /** A Claude Code runtime (its command/args reference `claude`) — these embed the\n * @anthropic-ai/claude-agent-sdk, which needs a Claude Code executable. */\n private isClaudeRuntime(): boolean {\n return [this.runtime.command, ...this.runtime.args].join(' ').toLowerCase().includes('claude')\n }\n\n async start(): Promise<void> {\n if (this.child) throw new Error('AcpHost: already started')\n const env: NodeJS.ProcessEnv = {\n ...process.env,\n ...Object.fromEntries(this.runtime.env.map((e) => [e.name, e.value])),\n ...(this.opts.env ?? {})\n }\n // The claude-agent-sdk resolves the Claude Code binary from its own bundled\n // native package (an OPTIONAL npm dep, often missing under npx / --omit=optional)\n // OR from `CLAUDE_CODE_EXECUTABLE`. If nothing set it but a `claude` CLI is on\n // PATH, point at it so an out-of-the-box Claude Code install just works.\n if (!env.CLAUDE_CODE_EXECUTABLE && this.isClaudeRuntime()) {\n const claude = resolveCommandPath('claude', env)\n if (claude) {\n env.CLAUDE_CODE_EXECUTABLE = claude\n this.opts.log?.info(`acp: CLAUDE_CODE_EXECUTABLE not set — using claude on PATH (${claude})`)\n }\n }\n // NOTE: the memory-backend env (disable the runtime's own memory for `managed`,\n // or redirect it under the agent root for `native`) is assembled by the daemon\n // in ensureHost via memoryProviderFor(agent).runtimeEnv() and passed in through\n // `opts.env` — it is NOT set here, so it stays per-agent-configurable. The\n // runtime prober / chat CLI construct AcpHost without that env and therefore get\n // the runtime's default memory behavior.\n // Resolve the command through resolveCommandPath so spawn gets an absolute path\n // (or a path-qualified relative one for auto-downloaded archives). This handles\n // ACP registry binary commands with a `./` prefix (\"./opencode\", \"./goose\", …)\n // that spawn() would otherwise resolve only against CWD and miss the binary on\n // `$PATH`. Falls back to the raw command when resolution fails (spawn's own error\n // surface is clearer than a synthetic ours).\n const resolved = resolveCommandPath(this.runtime.command, env) ?? this.runtime.command\n const child = spawn(resolved, this.runtime.args, {\n stdio: ['pipe', 'pipe', 'inherit'],\n env,\n // Own process group (POSIX): a foreground daemon's Ctrl-C sends SIGINT to the\n // whole terminal group, which killed adapters out from under the graceful\n // drain; and stop()'s escalation must reach the full tree — npx-distributed\n // runtimes run the real adapter as a grandchild of the npm wrapper, and\n // SIGKILLing just the wrapper orphans the adapter. The group id (= child pid)\n // lets stop() signal wrapper + adapter + their children in one kill.\n detached: process.platform !== 'win32'\n })\n this.child = child\n child.once('exit', () => {\n // Sweep group survivors (an adapter orphaned by its npx wrapper's death) NOW:\n // moments after the leader exits its pgid cannot have been recycled — a pgid\n // stays reserved while any member lives — so this can never hit a stranger.\n // A later sweep could (pid reuse), which is why stop() never signals a child\n // it found already dead. Clearing the handle also lets stop() early-return\n // instead of waiting on an 'exit' that already fired.\n if (child.pid && process.platform !== 'win32') {\n try {\n process.kill(-child.pid, 'SIGTERM')\n } catch {\n /* group already empty */\n }\n }\n if (this.child === child) this.child = undefined\n })\n\n if (!child.stdin || !child.stdout) {\n throw new Error('AcpHost: subprocess stdin/stdout are not piped')\n }\n const toAgent = Writable.toWeb(child.stdin) as WritableStream<Uint8Array>\n const fromAgent = Readable.toWeb(child.stdout) as unknown as ReadableStream<Uint8Array>\n const stream = ndJsonStream(toAgent, fromAgent)\n\n const self = this\n // fs read/write handlers are intentionally omitted (we advertise fs:false);\n // the SDK auto-replies method-not-found if the agent ever calls them.\n this.conn = createClientApp({ name: 'agentconnect' })\n .onNotification(methods.client.session.update, (ctx) => {\n // Drop historical conversation/tool chunks replayed by session/load, but\n // keep metadata such as restored titles and usage snapshots.\n if (self.loadingSessions.has(ctx.params.sessionId) && !shouldForwardUpdateDuringLoad(ctx.params.update)) return\n self.opts.onUpdate(ctx.params.sessionId, ctx.params.update)\n })\n .onRequest(methods.client.session.requestPermission, async (ctx) => {\n // Interactive policy first: ask the user via the platform (Slack card, …).\n // Any failure — no resolver, an unsupported surface, a thrown error, or an\n // undefined result — falls through to the auto-allow default so the turn can\n // never hang on a permission prompt.\n if (self.opts.onPermission) {\n try {\n const res = await self.opts.onPermission(ctx.params.sessionId, ctx.params)\n if (res) return res\n } catch (err) {\n self.opts.log?.debug(`acp: onPermission failed, auto-allowing: ${(err as Error).message}`)\n }\n }\n // Fallback: auto-allow the first allow option (no interactive resolution).\n const allow = ctx.params.options.find((o) => o.kind === 'allow_once' || o.kind === 'allow_always')\n const optionId = (allow ?? ctx.params.options[0])?.optionId\n return {\n outcome: optionId ? { outcome: 'selected', optionId } : { outcome: 'cancelled' }\n }\n })\n .onRequest(methods.client.elicitation.create, async (ctx) => {\n // Structured input (choice/boolean forms). Delegate to the platform policy; on\n // any failure — no resolver, unsupported surface/form, or a thrown error — decline\n // so the agent's turn never hangs (agents are expected to handle `decline`).\n // Only session-scoped elicitations map to a live turn; request-scoped ones\n // (auth/config phase, no session) have no sessionId — decline those.\n const sessionId = (ctx.params as { sessionId?: string }).sessionId\n if (self.opts.onElicit && sessionId) {\n try {\n const res = await self.opts.onElicit(sessionId, ctx.params)\n if (res) return res\n } catch (err) {\n self.opts.log?.debug(`acp: onElicit failed, declining: ${(err as Error).message}`)\n }\n }\n return { action: 'decline' }\n })\n .connect(stream)\n\n const init = await this.conn.agent.request(methods.agent.initialize, {\n protocolVersion: PROTOCOL_VERSION,\n clientCapabilities: {\n fs: { readTextFile: false, writeTextFile: false },\n // Advertise form-based elicitation so runtimes may ask structured questions\n // (choice/boolean). Unrenderable forms / non-interactive platforms are declined\n // gracefully by the onElicit fallback above.\n elicitation: { form: {} }\n }\n })\n this.negotiatedProtocolVersion = init.protocolVersion\n this.canLoad = init.agentCapabilities?.loadSession ?? false\n this.promptCaps = init.agentCapabilities?.promptCapabilities ?? {}\n const mcp = init.agentCapabilities?.mcpCapabilities\n this.mcpCaps = { http: mcp?.http ?? false, sse: mcp?.sse ?? false }\n this.opts.log?.debug(\n `acp: agent initialized (loadSession=${this.canLoad}, prompt caps: image=${!!this.promptCaps.image} audio=${!!this.promptCaps.audio} embeddedContext=${!!this.promptCaps.embeddedContext}, mcp: http=${this.mcpCaps.http} sse=${this.mcpCaps.sse})`\n )\n }\n\n /** Whether the agent advertised support for a gated prompt content-block kind.\n * `text` and `resource_link` are baseline and always return true. */\n promptSupports(kind: 'image' | 'audio' | 'embeddedContext'): boolean {\n return Boolean(this.promptCaps[kind])\n }\n\n /** Whether this runtime carries the system prompt (and the fresh-session memory\n * index) via `_meta.systemPrompt` — true for Claude, which gets them there rather\n * than as a leading inline block. Lets SessionManager route memory correctly:\n * Claude → `_meta` (via newSession's memoryAppend); others → an inline block. */\n usesMetaSystemPrompt(): boolean {\n return this.isClaudeRuntime()\n }\n\n /** Create a fresh ACP session. `effortOverride` (the sticky per-session effort choice,\n * when set) takes the place of the agent default in the Claude `_meta` — the only\n * channel `ultracode` can ride (the `thought_level` select rejects it); select-based\n * effort/model/fast overrides are layered on afterward by the daemon at turn start.\n * `systemAppend` (the agent meta object + the agent's memory index, for a FRESH\n * session) rides the Claude `_meta.systemPrompt` append — standing context, never a\n * user turn (see #398). */\n async newSession(\n cwd: string,\n mcpServers: McpServer[] = [],\n effortOverride?: string,\n systemAppend?: string\n ): Promise<string> {\n const _meta = claudeSessionMeta(\n effortOverride ?? this.opts.configPrefs?.reasoningEffort,\n this.isClaudeRuntime(),\n this.opts.configPrefs?.systemPrompt,\n systemAppend\n )\n const res = await this.conn!.agent.request(methods.agent.session.new, {\n cwd,\n mcpServers,\n ...(_meta ? { _meta } : {})\n })\n this.live.add(res.sessionId)\n const configOptions = await this.applySessionConfig(res.sessionId, res.configOptions)\n this.refreshOptionCaches(configOptions)\n this.sessionConfigs.set(res.sessionId, configOptions)\n return res.sessionId\n }\n\n /**\n * Apply the desired model / reasoning effort / fast mode to a fresh session\n * via ACP `session/set_config_option`. Model first — the effort and fast-mode\n * vocabularies depend on the selected model, and each response returns the\n * reconciled option set the next step plans against. Best-effort by design: a\n * runtime without the selector, an unoffered value, or a failed request logs\n * and moves on — the session still runs on the runtime's defaults. Returns the\n * final option set.\n */\n private async applySessionConfig(\n sessionId: string,\n initial: SessionConfigOption[] | null | undefined\n ): Promise<SessionConfigOption[] | null | undefined> {\n let options = initial\n // ultracode rides `_meta` on session/new|load (see claudeSessionMeta), not the\n // thought_level select — the runtime rejects effort=\"ultracode\". When it's\n // requested, skip thought_level entirely (it would only `{skip}` anyway, and\n // ultracode already forces effort to xhigh).\n const ultracode = this.isClaudeRuntime() && this.opts.configPrefs?.reasoningEffort === ULTRACODE_EFFORT\n const fastMode = this.opts.configPrefs?.fastMode\n const prefs: Array<[category: string, desired: string | undefined]> = [\n ['model', this.opts.configPrefs?.model],\n ['mode', this.opts.configPrefs?.permissionMode],\n ['thought_level', ultracode ? undefined : this.opts.configPrefs?.reasoningEffort],\n // Fast mode comes AFTER model: the option is only advertised (and the\n // reconciled option set only carries it) once a fast-capable model is set.\n ['model_config', fastMode === undefined ? undefined : fastMode ? 'on' : 'off']\n ]\n for (const [category, desired] of prefs) {\n if (!desired) continue\n const plan = planConfigSelection(options, category, desired)\n if ('skip' in plan) {\n this.opts.log?.debug(`acp: session config ${category}=\"${desired}\" not applied — ${plan.skip}`)\n continue\n }\n try {\n const res = await this.conn!.agent.request(methods.agent.session.setConfigOption, {\n sessionId,\n configId: plan.configId,\n value: plan.value\n })\n options = res.configOptions\n this.opts.log?.info(`acp: session config ${category} set to \"${desired}\"`)\n } catch (err) {\n this.opts.log?.warn(`acp: failed to set session config ${category}=\"${desired}\": ${(err as Error).message}`)\n }\n }\n return options\n }\n\n /** Re-derive the model / effort / fast selector caches from a reconciled option set. */\n private refreshOptionCaches(configOptions: SessionConfigOption[] | null | undefined): void {\n this.lastModelOptions = modelOptionsFrom(configOptions)\n this.lastEffortOptions = effortOptionsFrom(configOptions, this.isClaudeRuntime())\n this.lastPermissionModeOptions = permissionModeOptionsFrom(configOptions)\n this.lastFastOption = fastOptionFrom(configOptions)\n }\n\n /** The model selector for one live session, or the most recently reconciled\n * selector when no session is supplied (runtime probing/backward compatibility). */\n modelOptions(sessionId?: string): ModelOptions | null {\n if (sessionId !== undefined) return modelOptionsFrom(this.sessionConfigs.get(sessionId))\n return this.lastModelOptions\n }\n\n /** The reasoning-effort selector (incl. synthetic ultracode/max on Claude runtimes)\n * from the most recent session/new|load, or null if none is offered. */\n effortOptions(): EffortOptions | null {\n return this.lastEffortOptions\n }\n\n /** The permission/approval mode selector from the most recent session/new|load, or\n * null if none is offered. */\n permissionModeOptions(): PermissionModeOptions | null {\n return this.lastPermissionModeOptions\n }\n\n /** The fast-mode toggle from the most recent session/new|load, or null if the current\n * model offers no fast mode. */\n fastModeOption(): FastModeOption | null {\n return this.lastFastOption\n }\n\n /**\n * Apply one select config option to an ALREADY-RUNNING session via ACP\n * `session/set_config_option`, refreshing the cached option set + selector caches on\n * success. Returns true iff applied: false when the session isn't live here, the\n * runtime advertises no such selector, the value isn't offered, or it's already set.\n */\n private async setSessionConfig(sessionId: string, category: string, value: string): Promise<boolean> {\n if (!this.live.has(sessionId)) return false\n const plan = planConfigSelection(this.sessionConfigs.get(sessionId), category, value)\n if ('skip' in plan) {\n this.opts.log?.debug(`acp: set ${category}=\"${value}\" on ${sessionId} not applied — ${plan.skip}`)\n return false\n }\n const res = await this.conn!.agent.request(methods.agent.session.setConfigOption, {\n sessionId,\n configId: plan.configId,\n value: plan.value\n })\n this.sessionConfigs.set(sessionId, res.configOptions)\n this.refreshOptionCaches(res.configOptions)\n this.opts.log?.info(`acp: session ${sessionId} ${category} set to \"${value}\"`)\n return true\n }\n\n /** Switch the model of an already-running session (ACP `model` select) — the\n * mid-session counterpart of the model applied at new/load. */\n async setSessionModel(sessionId: string, model: string): Promise<boolean> {\n return this.setSessionConfig(sessionId, 'model', model)\n }\n\n /** Switch the reasoning effort of an already-running session (ACP `thought_level`\n * select). Returns false for `ultracode` — it isn't a select value and can only ride\n * session `_meta` at new/load, so the caller relies on the override being re-applied\n * when the session is next (re)created or resumed. */\n async setSessionEffort(sessionId: string, effort: string): Promise<boolean> {\n if (effort === ULTRACODE_EFFORT) return false\n return this.setSessionConfig(sessionId, 'thought_level', effort)\n }\n\n /** Switch the permission/approval mode of an already-running session (ACP `mode`\n * select). Values are runtime-owned and validated against the advertised options. */\n async setSessionPermissionMode(sessionId: string, mode: string): Promise<boolean> {\n return this.setSessionConfig(sessionId, 'mode', mode)\n }\n\n /** Toggle fast mode on an already-running session (ACP `model_config` on/off select).\n * False when the current model offers no fast toggle. */\n async setSessionFastMode(sessionId: string, on: boolean): Promise<boolean> {\n return this.setSessionConfig(sessionId, 'model_config', on ? 'on' : 'off')\n }\n\n /** The ACP protocol version negotiated at initialize, or undefined before the\n * handshake completed. Used by the runtime probe to report ACP coverage. */\n acpProtocolVersion(): number | undefined {\n return this.negotiatedProtocolVersion\n }\n\n /** The optional MCP transports the agent advertised at initialize (stdio is\n * baseline and always accepted; the unstable `acp` flag is ignored). null\n * before the handshake completed. Feeds the runtime probe's transport gating. */\n mcpCapabilities(): McpTransportCapabilities | null {\n return this.mcpCaps\n }\n\n /** True iff THIS agent process created or loaded `sessionId` in its current lifetime. */\n hasSession(sessionId: string): boolean {\n return this.live.has(sessionId)\n }\n\n /** Whether the agent advertised the `loadSession` capability (session/load is usable). */\n loadSupported(): boolean {\n return this.canLoad\n }\n\n /** Resume a previously-created session by id (ACP `session/load`). The agent\n * restores its own history server-side; replayed conversation/tool output is\n * suppressed while metadata updates still converge. `mcpServers` must be\n * re-attached here — the agent doesn't persist them across processes. `systemAppend` (the agent meta\n * object) is re-asserted via `_meta.systemPrompt` so a session resumed in a fresh\n * agent process keeps its system prompt. Throws if the agent can't load the id\n * (caller falls back to newSession). */\n async loadSession(\n sessionId: string,\n cwd: string,\n mcpServers: McpServer[] = [],\n effortOverride?: string,\n systemAppend?: string\n ): Promise<void> {\n this.loadingSessions.add(sessionId)\n try {\n const _meta = claudeSessionMeta(\n effortOverride ?? this.opts.configPrefs?.reasoningEffort,\n this.isClaudeRuntime(),\n systemAppend ?? this.opts.configPrefs?.systemPrompt\n )\n const res = await this.conn!.agent.request(methods.agent.session.load, {\n sessionId,\n cwd,\n mcpServers,\n ...(_meta ? { _meta } : {})\n })\n this.live.add(sessionId)\n // Re-apply config prefs: ACP sessions restore their own last model/effort,\n // which may predate a CP-side agent edit.\n const configOptions = await this.applySessionConfig(sessionId, res.configOptions)\n // Refresh the selectors from the reconciled options — a resumed session must\n // report its own model/effort/fast, not stale ones from the last session/new (or\n // null if this process never created one). Mirrors newSession().\n this.refreshOptionCaches(configOptions)\n this.sessionConfigs.set(sessionId, configOptions)\n this.opts.log?.info(`acp: resumed session ${sessionId} via session/load`)\n } catch (err) {\n this.opts.log?.debug(`acp: session/load failed for ${sessionId} (${(err as Error).message}) — will recreate`)\n throw err\n } finally {\n this.loadingSessions.delete(sessionId)\n }\n }\n\n /** Drive one turn to completion. Returns the stop reason plus the agent's token\n * `usage` when the runtime reports it (ACP's experimental per-turn usage, which\n * carries session-cumulative counts) — `undefined` when it doesn't. */\n async prompt(sessionId: string, blocks: ContentBlock[]): Promise<{ stopReason: StopReason; usage?: Usage }> {\n const res = await this.conn!.agent.request(methods.agent.session.prompt, { sessionId, prompt: blocks })\n return { stopReason: res.stopReason, usage: res.usage ?? undefined }\n }\n\n async cancel(sessionId: string): Promise<void> {\n await this.conn!.agent.notify(methods.agent.session.cancel, { sessionId })\n }\n\n /** Stop the adapter child: stdin EOF + SIGTERM, then escalate to SIGKILL if it\n * hasn't exited within `deadlineMs` (a buggy/hung agent must never block daemon\n * shutdown or an idle reap). Signals target the child's process group (it is\n * spawned detached) so they reach the real adapter behind an npx wrapper too.\n * Idempotent — the child handle is cleared up front so a concurrent stop (drain\n * + reconcile racing) is a no-op rather than a double-kill. */\n async stop(deadlineMs = 5000): Promise<void> {\n const child = this.child\n if (!child) return\n this.child = undefined\n // Group signal when the child has its own group (detached spawn); fall back to\n // the direct child on win32 or once the group is gone (ESRCH).\n const kill = (sig: NodeJS.Signals) => {\n if (child.pid && process.platform !== 'win32') {\n try {\n process.kill(-child.pid, sig)\n return\n } catch {\n /* group already gone — try the direct child */\n }\n }\n child.kill(sig)\n }\n // A child that already exited on its own has emitted 'exit' already: once('exit')\n // below would never fire and stop() would hang the daemon forever, kill() being a\n // no-op on a reaped pid. No group sweep here — the child may have been dead for\n // minutes (idle sweep cadence) and its pgid recycled to an unrelated process;\n // the spawn-time 'exit' listener already swept while the pgid was provably ours.\n if (child.exitCode !== null || child.signalCode !== null) return\n // Graceful first: ACP is a stdio protocol, EOF on stdin is the idiomatic \"we're\n // done\" and propagates through an npx wrapper to the adapter. The web-stream\n // wrapper may hold the pipe locked mid-write — then the signals below still land.\n try {\n child.stdin?.end()\n } catch {\n /* stream locked/destroyed — signals still land */\n }\n kill('SIGTERM')\n await new Promise<void>((resolve) => {\n let settled = false\n let killFailsafe: NodeJS.Timeout | undefined\n const done = () => {\n if (settled) return\n settled = true\n clearTimeout(timer)\n clearTimeout(killFailsafe)\n resolve()\n }\n const timer = setTimeout(() => {\n this.opts.log?.warn(`acp: child ignored SIGTERM after ${deadlineMs}ms — sending SIGKILL`)\n kill('SIGKILL')\n // SIGKILL on a live child always ends in 'exit'; the failsafe only covers a\n // kill with nothing left to hit, so stop() resolves no matter what.\n killFailsafe = setTimeout(done, 2000)\n }, deadlineMs)\n child.once('exit', done)\n })\n }\n}\n"],"x_google_ignoreList":[5,6,7,8,9,10,13,14,15,16,17,18],"mappings":";;;;;;;;;;;;;AAMA,MAAM,oBAAoBA,OAAS;CAAE,SAASC,OAAS;CAAG,MAAMC,MAAQD,OAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AAAE,CAAC;AACjG,MAAM,uBAAuBD,OAAS;CACpC,SAASC,OAAS,CAAC,CAAC,SAAS;CAC7B,KAAKA,OAAS;CACd,MAAMC,MAAQD,OAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;CACpC,KAAKE,OAASF,OAAS,GAAGA,OAAS,CAAC,CAAC,CA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