zidane 6.4.3 → 6.4.4
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-Kr7LyExq.js → acp-BLO58K3F.js} +3 -3
- package/dist/{acp-Kr7LyExq.js.map → acp-BLO58K3F.js.map} +1 -1
- package/dist/acp-cli.js +2 -2
- package/dist/acp.d.ts +1 -1
- package/dist/acp.js +1 -1
- package/dist/{agent-CEvzc1Ao.js → agent-8sUadp5M.js} +69 -6
- package/dist/{agent-CEvzc1Ao.js.map → agent-8sUadp5M.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +2 -2
- package/dist/chat/pure.d.ts +3 -3
- package/dist/chat.d.ts +4 -4
- package/dist/chat.js +2 -2
- package/dist/{context-transport-DbzJctSl.js → context-transport-D29WvHcm.js} +3 -3
- package/dist/{context-transport-DbzJctSl.js.map → context-transport-D29WvHcm.js.map} +1 -1
- package/dist/contexts/daytona.d.ts +1 -1
- package/dist/contexts/e2b.d.ts +1 -1
- package/dist/eval.d.ts +1 -1
- package/dist/extensions.d.ts +1 -1
- package/dist/extensions.js +1 -1
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +1 -1
- package/dist/{index-W_8010Lt.d.ts → index-C-Nd2ZbV.d.ts} +257 -2
- package/dist/index-C-Nd2ZbV.d.ts.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/{login-Blkiy-58.js → login-CMVVnAHS.js} +2 -2
- package/dist/{login-Blkiy-58.js.map → login-CMVVnAHS.js.map} +1 -1
- package/dist/{mcp-CDN-m5lp.js → mcp-3GXUBwur.js} +3 -3
- package/dist/{mcp-CDN-m5lp.js.map → mcp-3GXUBwur.js.map} +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +1 -1
- package/dist/output/stream-json.d.ts +1 -1
- package/dist/output/terminal.d.ts +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/presets.js +1 -1
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/arcee.d.ts +1 -1
- package/dist/providers/baseten.d.ts +1 -1
- package/dist/providers/cerebras.d.ts +1 -1
- package/dist/providers/local.d.ts +1 -1
- package/dist/providers/openai-compat.d.ts +1 -1
- package/dist/providers/openai.d.ts +1 -1
- package/dist/providers/openrouter.d.ts +1 -1
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/restate.d.ts +52 -2
- package/dist/restate.d.ts.map +1 -1
- package/dist/restate.js +151 -33
- package/dist/restate.js.map +1 -1
- package/dist/session/sqlite.d.ts +1 -1
- package/dist/session.d.ts +1 -1
- package/dist/skills.d.ts +1 -1
- package/dist/{stdio-DWQKYKad.js → stdio-BvL8HGYW.js} +2 -2
- package/dist/{stdio-DWQKYKad.js.map → stdio-BvL8HGYW.js.map} +1 -1
- package/dist/{stdio-loader-3uz37d_3.js → stdio-loader-CjfoqBle.js} +2 -2
- package/dist/{stdio-loader-3uz37d_3.js.map → stdio-loader-CjfoqBle.js.map} +1 -1
- package/dist/{tool-formatters-bhC2Xp8z.d.ts → tool-formatters-DPQjso_C.d.ts} +2 -2
- package/dist/{tool-formatters-bhC2Xp8z.d.ts.map → tool-formatters-DPQjso_C.d.ts.map} +1 -1
- package/dist/{read-state-Dt7UbVsd.js → tool-state-DTs-3ZHH.js} +218 -2
- package/dist/tool-state-DTs-3ZHH.js.map +1 -0
- package/dist/tools/fetch-url.d.ts +1 -1
- package/dist/tools/web-search.d.ts +1 -1
- package/dist/tools.d.ts +1 -1
- package/dist/tools.js +2 -2
- package/dist/{transcript-anchors-mcMLuXM1.d.ts → transcript-anchors-BCUpbNxc.d.ts} +2 -2
- package/dist/{transcript-anchors-mcMLuXM1.d.ts.map → transcript-anchors-BCUpbNxc.d.ts.map} +1 -1
- package/dist/{transcript-anchors-D7wVCZ2S.js → transcript-anchors-CgDzYin1.js} +3 -3
- package/dist/{transcript-anchors-D7wVCZ2S.js.map → transcript-anchors-CgDzYin1.js.map} +1 -1
- package/dist/tui.d.ts +3 -3
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +58 -47
- package/dist/tui.js.map +1 -1
- package/dist/{turn-operations-B5vVcG0Z.d.ts → turn-operations-Bu2Hkinw.d.ts} +3 -3
- package/dist/{turn-operations-B5vVcG0Z.d.ts.map → turn-operations-Bu2Hkinw.d.ts.map} +1 -1
- package/dist/types.d.ts +2 -2
- package/docs/ARCHITECTURE.md +2 -0
- package/docs/RESTATE.md +66 -2
- package/package.json +1 -1
- package/dist/index-W_8010Lt.d.ts.map +0 -1
- package/dist/read-state-Dt7UbVsd.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio-loader-3uz37d_3.js","names":["spawn","nodeSpawn","spawnSync","nodeSpawnSync","spawn"],"sources":["../scripts/cross-spawn-shim.mjs","../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js"],"sourcesContent":["/**\n * Build-time replacement for the userland process-spawn helper that the\n * MCP SDK's stdio transport depends on. Injected by tsdown via the\n * rolldown alias plugin in `tsdown.config.ts`.\n *\n * Why this exists\n *\n * The upstream spawn helper is CJS and its first line dynamically resolves\n * Node's process-spawn built-in via a bare specifier. When a downstream\n * consumer re-bundles zidane as ESM (esbuild / Vite / tsup with\n * `format: 'esm'` and Node built-ins not externalized), that bare\n * resolution gets wrapped in esbuild's `__require` shim and throws at\n * runtime — every stdio MCP server fails to launch.\n *\n * Aliasing the helper to this file at zidane's own build step replaces\n * the offending bare resolution with explicit `node:`-prefixed imports.\n * Downstream bundlers recognize the `node:` prefix as a Node built-in\n * and externalize it automatically. The upstream MCP SDK is unmodified.\n *\n * Tradeoff\n *\n * The replaced helper does two extra things vs. raw spawn:\n * 1. Windows `.cmd` / `.bat` / `.ps1` resolution via PATHEXT + cmd.exe\n * shelling. Compensated below with `shell: true` on Win32, which\n * routes through cmd.exe and handles the common `npx` / `pnpm` /\n * `yarn` shims.\n * 2. Synthesizes a clean ENOENT error event for missing commands.\n * `node:child_process.spawn` already emits a perfectly usable\n * `error` event with `code === 'ENOENT'`, which the MCP SDK's stdio\n * transport forwards to `onerror`. Functionally equivalent.\n *\n * Net: zero behavioural change on POSIX, near-identical on Windows for\n * MCP-style stdio invocations.\n */\n\nimport { spawn as nodeSpawn, spawnSync as nodeSpawnSync } from 'node:child_process'\nimport process from 'node:process'\n\nconst IS_WIN32 = process.platform === 'win32'\n\nfunction withWin32Shell(options) {\n // Only opt into shell mode on Windows, and only when the caller hasn't\n // explicitly disabled it. POSIX never needs the shell wrapper — args\n // would have to be re-quoted (changes argv semantics) and trap/`set -e`\n // behaviour shifts in subtle ways.\n if (!IS_WIN32)\n return options\n if (options && options.shell !== undefined)\n return options\n return { ...(options ?? {}), shell: true }\n}\n\nexport function spawn(command, args, options) {\n return nodeSpawn(command, args, withWin32Shell(options))\n}\n\nexport function spawnSync(command, args, options) {\n return nodeSpawnSync(command, args, withWin32Shell(options))\n}\n\n// Match cross-spawn's CommonJS interop shape so existing imports keep\n// working byte-for-byte:\n// - default import: `import spawn from 'cross-spawn'` (SDK uses this)\n// - named import: `import { spawn, sync } from 'cross-spawn'`\n// - require pattern: `const cs = require('cross-spawn'); cs.sync(...)`\nspawn.spawn = spawn\nspawn.sync = spawnSync\n\nexport const sync = spawnSync\nexport default spawn\n","import spawn from 'cross-spawn';\nimport process from 'node:process';\nimport { PassThrough } from 'node:stream';\nimport { ReadBuffer, serializeMessage } from '../shared/stdio.js';\n/**\n * Environment variables to inherit by default, if an environment is not explicitly given.\n */\nexport const DEFAULT_INHERITED_ENV_VARS = process.platform === 'win32'\n ? [\n 'APPDATA',\n 'HOMEDRIVE',\n 'HOMEPATH',\n 'LOCALAPPDATA',\n 'PATH',\n 'PROCESSOR_ARCHITECTURE',\n 'SYSTEMDRIVE',\n 'SYSTEMROOT',\n 'TEMP',\n 'USERNAME',\n 'USERPROFILE',\n 'PROGRAMFILES'\n ]\n : /* list inspired by the default env inheritance of sudo */\n ['HOME', 'LOGNAME', 'PATH', 'SHELL', 'TERM', 'USER'];\n/**\n * Returns a default environment object including only environment variables deemed safe to inherit.\n */\nexport function getDefaultEnvironment() {\n const env = {};\n for (const key of DEFAULT_INHERITED_ENV_VARS) {\n const value = process.env[key];\n if (value === undefined) {\n continue;\n }\n if (value.startsWith('()')) {\n // Skip functions, which are a security risk.\n continue;\n }\n env[key] = value;\n }\n return env;\n}\n/**\n * Client transport for stdio: this will connect to a server by spawning a process and communicating with it over stdin/stdout.\n *\n * This transport is only available in Node.js environments.\n */\nexport class StdioClientTransport {\n constructor(server) {\n this._readBuffer = new ReadBuffer();\n this._stderrStream = null;\n this._serverParams = server;\n if (server.stderr === 'pipe' || server.stderr === 'overlapped') {\n this._stderrStream = new PassThrough();\n }\n }\n /**\n * Starts the server process and prepares to communicate with it.\n */\n async start() {\n if (this._process) {\n throw new Error('StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.');\n }\n return new Promise((resolve, reject) => {\n this._process = spawn(this._serverParams.command, this._serverParams.args ?? [], {\n // merge default env with server env because mcp server needs some env vars\n env: {\n ...getDefaultEnvironment(),\n ...this._serverParams.env\n },\n stdio: ['pipe', 'pipe', this._serverParams.stderr ?? 'inherit'],\n shell: false,\n windowsHide: process.platform === 'win32',\n cwd: this._serverParams.cwd\n });\n this._process.on('error', error => {\n reject(error);\n this.onerror?.(error);\n });\n this._process.on('spawn', () => {\n resolve();\n });\n this._process.on('close', _code => {\n this._process = undefined;\n this.onclose?.();\n });\n this._process.stdin?.on('error', error => {\n this.onerror?.(error);\n });\n this._process.stdout?.on('data', chunk => {\n this._readBuffer.append(chunk);\n this.processReadBuffer();\n });\n this._process.stdout?.on('error', error => {\n this.onerror?.(error);\n });\n if (this._stderrStream && this._process.stderr) {\n this._process.stderr.pipe(this._stderrStream);\n }\n });\n }\n /**\n * The stderr stream of the child process, if `StdioServerParameters.stderr` was set to \"pipe\" or \"overlapped\".\n *\n * If stderr piping was requested, a PassThrough stream is returned _immediately_, allowing callers to\n * attach listeners before the start method is invoked. This prevents loss of any early\n * error output emitted by the child process.\n */\n get stderr() {\n if (this._stderrStream) {\n return this._stderrStream;\n }\n return this._process?.stderr ?? null;\n }\n /**\n * The child process pid spawned by this transport.\n *\n * This is only available after the transport has been started.\n */\n get pid() {\n return this._process?.pid ?? null;\n }\n processReadBuffer() {\n while (true) {\n try {\n const message = this._readBuffer.readMessage();\n if (message === null) {\n break;\n }\n this.onmessage?.(message);\n }\n catch (error) {\n this.onerror?.(error);\n }\n }\n }\n async close() {\n if (this._process) {\n const processToClose = this._process;\n this._process = undefined;\n const closePromise = new Promise(resolve => {\n processToClose.once('close', () => {\n resolve();\n });\n });\n try {\n processToClose.stdin?.end();\n }\n catch {\n // ignore\n }\n await Promise.race([closePromise, new Promise(resolve => setTimeout(resolve, 2000).unref())]);\n if (processToClose.exitCode === null) {\n try {\n processToClose.kill('SIGTERM');\n }\n catch {\n // ignore\n }\n await Promise.race([closePromise, new Promise(resolve => setTimeout(resolve, 2000).unref())]);\n }\n if (processToClose.exitCode === null) {\n try {\n processToClose.kill('SIGKILL');\n }\n catch {\n // ignore\n }\n }\n }\n this._readBuffer.clear();\n }\n send(message) {\n return new Promise(resolve => {\n if (!this._process?.stdin) {\n throw new Error('Not connected');\n }\n const json = serializeMessage(message);\n if (this._process.stdin.write(json)) {\n resolve();\n }\n else {\n this._process.stdin.once('drain', resolve);\n }\n });\n }\n}\n//# sourceMappingURL=stdio.js.map"],"x_google_ignoreList":[1],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAM,WAAW,QAAQ,aAAa;AAEtC,SAAS,eAAe,SAAS;CAK/B,IAAI,CAAC,UACH,OAAO;CACT,IAAI,WAAW,QAAQ,UAAU,KAAA,GAC/B,OAAO;CACT,OAAO;EAAE,GAAI,WAAW,CAAC;EAAI,OAAO;CAAK;AAC3C;AAEA,SAAgBA,QAAM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AI,eAAe,aAAa,MAAM;IAClC,IAAI;KACA,eAAe,KAAK,SAAS;IACjC,QACM,CAEN;IACA,MAAM,QAAQ,KAAK,CAAC,cAAc,IAAI,SAAQ,YAAW,WAAW,SAAS,GAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;GAChG;GACA,IAAI,eAAe,aAAa,MAC5B,IAAI;IACA,eAAe,KAAK,SAAS;GACjC,QACM,CAEN;EAER;EACA,KAAK,YAAY,MAAM;CAC3B;CACA,KAAK,SAAS;EACV,OAAO,IAAI,SAAQ,YAAW;GAC1B,IAAI,CAAC,KAAK,UAAU,OAChB,MAAM,IAAI,MAAM,eAAe;GAEnC,MAAM,OAAO,iBAAiB,OAAO;GACrC,IAAI,KAAK,SAAS,MAAM,MAAM,IAAI,GAC9B,QAAQ;QAGR,KAAK,SAAS,MAAM,KAAK,SAAS,OAAO;EAEjD,CAAC;CACL;AACJ"}
|
|
1
|
+
{"version":3,"file":"stdio-loader-CjfoqBle.js","names":["spawn","nodeSpawn","spawnSync","nodeSpawnSync","spawn"],"sources":["../scripts/cross-spawn-shim.mjs","../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js"],"sourcesContent":["/**\n * Build-time replacement for the userland process-spawn helper that the\n * MCP SDK's stdio transport depends on. Injected by tsdown via the\n * rolldown alias plugin in `tsdown.config.ts`.\n *\n * Why this exists\n *\n * The upstream spawn helper is CJS and its first line dynamically resolves\n * Node's process-spawn built-in via a bare specifier. When a downstream\n * consumer re-bundles zidane as ESM (esbuild / Vite / tsup with\n * `format: 'esm'` and Node built-ins not externalized), that bare\n * resolution gets wrapped in esbuild's `__require` shim and throws at\n * runtime — every stdio MCP server fails to launch.\n *\n * Aliasing the helper to this file at zidane's own build step replaces\n * the offending bare resolution with explicit `node:`-prefixed imports.\n * Downstream bundlers recognize the `node:` prefix as a Node built-in\n * and externalize it automatically. The upstream MCP SDK is unmodified.\n *\n * Tradeoff\n *\n * The replaced helper does two extra things vs. raw spawn:\n * 1. Windows `.cmd` / `.bat` / `.ps1` resolution via PATHEXT + cmd.exe\n * shelling. Compensated below with `shell: true` on Win32, which\n * routes through cmd.exe and handles the common `npx` / `pnpm` /\n * `yarn` shims.\n * 2. Synthesizes a clean ENOENT error event for missing commands.\n * `node:child_process.spawn` already emits a perfectly usable\n * `error` event with `code === 'ENOENT'`, which the MCP SDK's stdio\n * transport forwards to `onerror`. Functionally equivalent.\n *\n * Net: zero behavioural change on POSIX, near-identical on Windows for\n * MCP-style stdio invocations.\n */\n\nimport { spawn as nodeSpawn, spawnSync as nodeSpawnSync } from 'node:child_process'\nimport process from 'node:process'\n\nconst IS_WIN32 = process.platform === 'win32'\n\nfunction withWin32Shell(options) {\n // Only opt into shell mode on Windows, and only when the caller hasn't\n // explicitly disabled it. POSIX never needs the shell wrapper — args\n // would have to be re-quoted (changes argv semantics) and trap/`set -e`\n // behaviour shifts in subtle ways.\n if (!IS_WIN32)\n return options\n if (options && options.shell !== undefined)\n return options\n return { ...(options ?? {}), shell: true }\n}\n\nexport function spawn(command, args, options) {\n return nodeSpawn(command, args, withWin32Shell(options))\n}\n\nexport function spawnSync(command, args, options) {\n return nodeSpawnSync(command, args, withWin32Shell(options))\n}\n\n// Match cross-spawn's CommonJS interop shape so existing imports keep\n// working byte-for-byte:\n// - default import: `import spawn from 'cross-spawn'` (SDK uses this)\n// - named import: `import { spawn, sync } from 'cross-spawn'`\n// - require pattern: `const cs = require('cross-spawn'); cs.sync(...)`\nspawn.spawn = spawn\nspawn.sync = spawnSync\n\nexport const sync = spawnSync\nexport default spawn\n","import spawn from 'cross-spawn';\nimport process from 'node:process';\nimport { PassThrough } from 'node:stream';\nimport { ReadBuffer, serializeMessage } from '../shared/stdio.js';\n/**\n * Environment variables to inherit by default, if an environment is not explicitly given.\n */\nexport const DEFAULT_INHERITED_ENV_VARS = process.platform === 'win32'\n ? [\n 'APPDATA',\n 'HOMEDRIVE',\n 'HOMEPATH',\n 'LOCALAPPDATA',\n 'PATH',\n 'PROCESSOR_ARCHITECTURE',\n 'SYSTEMDRIVE',\n 'SYSTEMROOT',\n 'TEMP',\n 'USERNAME',\n 'USERPROFILE',\n 'PROGRAMFILES'\n ]\n : /* list inspired by the default env inheritance of sudo */\n ['HOME', 'LOGNAME', 'PATH', 'SHELL', 'TERM', 'USER'];\n/**\n * Returns a default environment object including only environment variables deemed safe to inherit.\n */\nexport function getDefaultEnvironment() {\n const env = {};\n for (const key of DEFAULT_INHERITED_ENV_VARS) {\n const value = process.env[key];\n if (value === undefined) {\n continue;\n }\n if (value.startsWith('()')) {\n // Skip functions, which are a security risk.\n continue;\n }\n env[key] = value;\n }\n return env;\n}\n/**\n * Client transport for stdio: this will connect to a server by spawning a process and communicating with it over stdin/stdout.\n *\n * This transport is only available in Node.js environments.\n */\nexport class StdioClientTransport {\n constructor(server) {\n this._readBuffer = new ReadBuffer();\n this._stderrStream = null;\n this._serverParams = server;\n if (server.stderr === 'pipe' || server.stderr === 'overlapped') {\n this._stderrStream = new PassThrough();\n }\n }\n /**\n * Starts the server process and prepares to communicate with it.\n */\n async start() {\n if (this._process) {\n throw new Error('StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.');\n }\n return new Promise((resolve, reject) => {\n this._process = spawn(this._serverParams.command, this._serverParams.args ?? [], {\n // merge default env with server env because mcp server needs some env vars\n env: {\n ...getDefaultEnvironment(),\n ...this._serverParams.env\n },\n stdio: ['pipe', 'pipe', this._serverParams.stderr ?? 'inherit'],\n shell: false,\n windowsHide: process.platform === 'win32',\n cwd: this._serverParams.cwd\n });\n this._process.on('error', error => {\n reject(error);\n this.onerror?.(error);\n });\n this._process.on('spawn', () => {\n resolve();\n });\n this._process.on('close', _code => {\n this._process = undefined;\n this.onclose?.();\n });\n this._process.stdin?.on('error', error => {\n this.onerror?.(error);\n });\n this._process.stdout?.on('data', chunk => {\n this._readBuffer.append(chunk);\n this.processReadBuffer();\n });\n this._process.stdout?.on('error', error => {\n this.onerror?.(error);\n });\n if (this._stderrStream && this._process.stderr) {\n this._process.stderr.pipe(this._stderrStream);\n }\n });\n }\n /**\n * The stderr stream of the child process, if `StdioServerParameters.stderr` was set to \"pipe\" or \"overlapped\".\n *\n * If stderr piping was requested, a PassThrough stream is returned _immediately_, allowing callers to\n * attach listeners before the start method is invoked. This prevents loss of any early\n * error output emitted by the child process.\n */\n get stderr() {\n if (this._stderrStream) {\n return this._stderrStream;\n }\n return this._process?.stderr ?? null;\n }\n /**\n * The child process pid spawned by this transport.\n *\n * This is only available after the transport has been started.\n */\n get pid() {\n return this._process?.pid ?? null;\n }\n processReadBuffer() {\n while (true) {\n try {\n const message = this._readBuffer.readMessage();\n if (message === null) {\n break;\n }\n this.onmessage?.(message);\n }\n catch (error) {\n this.onerror?.(error);\n }\n }\n }\n async close() {\n if (this._process) {\n const processToClose = this._process;\n this._process = undefined;\n const closePromise = new Promise(resolve => {\n processToClose.once('close', () => {\n resolve();\n });\n });\n try {\n processToClose.stdin?.end();\n }\n catch {\n // ignore\n }\n await Promise.race([closePromise, new Promise(resolve => setTimeout(resolve, 2000).unref())]);\n if (processToClose.exitCode === null) {\n try {\n processToClose.kill('SIGTERM');\n }\n catch {\n // ignore\n }\n await Promise.race([closePromise, new Promise(resolve => setTimeout(resolve, 2000).unref())]);\n }\n if (processToClose.exitCode === null) {\n try {\n processToClose.kill('SIGKILL');\n }\n catch {\n // ignore\n }\n }\n }\n this._readBuffer.clear();\n }\n send(message) {\n return new Promise(resolve => {\n if (!this._process?.stdin) {\n throw new Error('Not connected');\n }\n const json = serializeMessage(message);\n if (this._process.stdin.write(json)) {\n resolve();\n }\n else {\n this._process.stdin.once('drain', resolve);\n }\n });\n }\n}\n//# sourceMappingURL=stdio.js.map"],"x_google_ignoreList":[1],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAM,WAAW,QAAQ,aAAa;AAEtC,SAAS,eAAe,SAAS;CAK/B,IAAI,CAAC,U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;GAC9B,QACM,CAEN;GACA,MAAM,QAAQ,KAAK,CAAC,cAAc,IAAI,SAAQ,YAAW,WAAW,SAAS,GAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;GAC5F,IAAI,eAAe,aAAa,MAAM;IAClC,IAAI;KACA,eAAe,KAAK,SAAS;IACjC,QACM,CAEN;IACA,MAAM,QAAQ,KAAK,CAAC,cAAc,IAAI,SAAQ,YAAW,WAAW,SAAS,GAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;GAChG;GACA,IAAI,eAAe,aAAa,MAC5B,IAAI;IACA,eAAe,KAAK,SAAS;GACjC,QACM,CAEN;EAER;EACA,KAAK,YAAY,MAAM;CAC3B;CACA,KAAK,SAAS;EACV,OAAO,IAAI,SAAQ,YAAW;GAC1B,IAAI,CAAC,KAAK,UAAU,OAChB,MAAM,IAAI,MAAM,eAAe;GAEnC,MAAM,OAAO,iBAAiB,OAAO;GACrC,IAAI,KAAK,SAAS,MAAM,MAAM,IAAI,GAC9B,QAAQ;QAGR,KAAK,SAAS,MAAM,KAAK,SAAS,OAAO;EAEjD,CAAC;CACL;AACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Gu as StreamEvent, Om as SessionTurn, Uu as SessionMeta, Wu as Settings, cd as ModelInfo, id as ProviderKey, rd as ProviderAuth } from "./index-
|
|
1
|
+
import { Gu as StreamEvent, Om as SessionTurn, Uu as SessionMeta, Wu as Settings, cd as ModelInfo, id as ProviderKey, rd as ProviderAuth } from "./index-C-Nd2ZbV.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/chat/turn-selection.d.ts
|
|
@@ -557,4 +557,4 @@ declare function displayNameFor(name: string, input?: Record<string, unknown>):
|
|
|
557
557
|
declare function formatToolCall(name: string, input: Record<string, unknown>): ToolFormatLine | null;
|
|
558
558
|
//#endregion
|
|
559
559
|
export { retagUserPromptEvents as $, highlightSegments as A, ApprovalDecision as B, SearchTurnResult as C, buildSessionSearchIndex as D, SessionSearchIndex as E, searchSessionIndex as F, useSafeModeActions as G, RequestApproval as H, searchSessionIndexAsync as I, EDIT_TOOL_NAMES as J, useSafeModeQueue as K, searchSessionTurns as L, searchSessionHistory as M, searchSessionHistoryIndex as N, buildSessionSearchIndexAsync as O, searchSessionHistoryIndexAsync as P, isVisible as Q, searchTurns as R, SearchSessionResult as S, SessionSearchExcerpt as T, SafeModeActions as U, ApprovalRequest as V, SafeModeProvider as W, isTurnHighlighted as X, isEditErrorResult as Y, isUserBashEvent as Z, splitMarkdownCodeBlocks as _, formatToolCall as a, IndexedSearchTurn as b, splitPromptSegments as c, filterModelCatalog as d, selectableTurnIds as et, indexOfEntry as f, normalizeMarkdownCodeFences as g, chunkMarkdownForRender as h, displayNameFor as i, searchHighlightRanges as j, filterSessionSearchCatalog as k, CatalogEntry as l, MarkdownSegment as m, ToolDisplayMeta as n, turnSelectionOwnership as nt, PromptSegment as o, MARKDOWN_RENDER_CHUNK_TARGET_BYTES as p, BASH_CALL_ID_PREFIX as q, ToolFormatLine as r, PromptSegmentRef as s, TOOL_DISPLAY as t, selectionAfterTurnRemoval as tt, buildModelCatalog as u, HighlightRange as v, SessionHistoryMatch as w, SearchExcerpt as x, HighlightSegment as y, searchableTurnText as z };
|
|
560
|
-
//# sourceMappingURL=tool-formatters-
|
|
560
|
+
//# sourceMappingURL=tool-formatters-DPQjso_C.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-formatters-
|
|
1
|
+
{"version":3,"file":"tool-formatters-DPQjso_C.d.ts","names":[],"sources":["../src/chat/turn-selection.ts","../src/chat/safe-mode-context.tsx","../src/chat/history-search.ts","../src/chat/markdown-segments.ts","../src/chat/model-catalog.ts","../src/chat/prompt-segments.ts","../src/chat/tool-formatters.ts"],"mappings":";;;;;cAea,eAAA,EAAiB,WAAW;AAAzC;;;;AAAyC;AAAzC,iBAOgB,yBAAA,CACd,MAAA,qBACA,SAAA,UACA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AAA;ENoD8B;;;AAAA;AAGhC;EMjDE,IAAI;AAAA;AAAA,UAGW,eAAA;EN8CsB;;;;AAAoC;AAsD3E;;;;EM1FE,WAAA,aAAwB,KAAA,EAAO,MAAA;EN6FrB;;;;;EMvFV,MAAA,GAAS,KAAA,EAAO,MAAA,sBAA4B,cAAA;AAAA;AAAA,cAOjC,YAAA,EAAc,QAAA,CAAS,MAAA,SAAe,eAAA;;ANgF5B;AAiEvB;;;;;;;;;AAAgE;AA2DhE;;;iBMuGgB,cAAA,CACd,IAAA,UACA,KAAA,GAAQ,MAAM;;;;;ANzG2D;AAkE3E;iBMyDgB,cAAA,CAAe,IAAA,UAAc,KAAA,EAAO,MAAA,oBAA0B,cAAc"}
|
|
@@ -2,6 +2,7 @@ import { o as toCanonicalName } from "./aliasing-lVFbm81n.js";
|
|
|
2
2
|
import { l as toolResultToText } from "./types-BIarq1qE.js";
|
|
3
3
|
import { i as styleReplacementForVia, n as resolveOldString } from "./edit-utils-EGosADZq.js";
|
|
4
4
|
import { resolve } from "node:path";
|
|
5
|
+
import { Buffer } from "node:buffer";
|
|
5
6
|
//#region src/tools/read-state.ts
|
|
6
7
|
const STATE = /* @__PURE__ */ new WeakMap();
|
|
7
8
|
/**
|
|
@@ -432,6 +433,221 @@ function getToolDedupState(session) {
|
|
|
432
433
|
return map;
|
|
433
434
|
}
|
|
434
435
|
//#endregion
|
|
435
|
-
|
|
436
|
+
//#region src/tool-state.ts
|
|
437
|
+
/**
|
|
438
|
+
* Durable key/value state for tools.
|
|
439
|
+
*
|
|
440
|
+
* A tool reaches this through {@link ToolContext.state} — a plain,
|
|
441
|
+
* SYNCHRONOUS map view. Synchronous is not a convenience choice: under a
|
|
442
|
+
* durable-execution runtime the tool body runs inside a journaled action
|
|
443
|
+
* (Restate's `ctx.run`), and a durable read (`ctx.get`) is illegal in
|
|
444
|
+
* there. So the flow is split into three phases the runtime can journal
|
|
445
|
+
* independently:
|
|
446
|
+
*
|
|
447
|
+
* 1. **hydrate** — load the snapshot ONCE per agent, outside any
|
|
448
|
+
* journaled action, before the first tool dispatch.
|
|
449
|
+
* 2. **stage** — the tool mutates its per-call view. Mutations are
|
|
450
|
+
* recorded as an ordered {@link ToolStateOp} list, NOT written
|
|
451
|
+
* through: they're plain data, so a durable adapter can journal them
|
|
452
|
+
* alongside the tool result.
|
|
453
|
+
* 3. **commit** — the loop applies the staged ops through
|
|
454
|
+
* {@link ToolStateStore.commit} after the call settles, outside the
|
|
455
|
+
* journaled action.
|
|
456
|
+
*
|
|
457
|
+
* The invariant that makes this replay-safe:
|
|
458
|
+
*
|
|
459
|
+
* > A staged mutation is committed only if it came back OUT of a journal
|
|
460
|
+
* > entry.
|
|
461
|
+
*
|
|
462
|
+
* A durable adapter (see `restateTool`) reads {@link StagedToolState.pending}
|
|
463
|
+
* from inside its journaled closure, ships the ops out as part of the
|
|
464
|
+
* journaled value, and calls {@link StagedToolState.restore} outside it. On
|
|
465
|
+
* replay the tool body never runs, so nothing is staged live — `restore`
|
|
466
|
+
* re-seeds the exact same ops from the journal and the commit re-issues an
|
|
467
|
+
* identical write. Paths that produced no journal entry (a fatal error, a
|
|
468
|
+
* control abort, a dead attempt) call {@link StagedToolState.clear} so live
|
|
469
|
+
* mutations from an attempt nobody recorded can never reach the store.
|
|
470
|
+
*
|
|
471
|
+
* The store seam is deliberately runtime-agnostic: `zidane/restate` ships
|
|
472
|
+
* `restateToolStateStore`, but a Redis / Postgres / file-backed
|
|
473
|
+
* implementation is the same two methods. With no store configured the
|
|
474
|
+
* controller is in-memory only — `ctx.state` still works everywhere
|
|
475
|
+
* (local CLI, tests, subagents), it just doesn't outlive the process.
|
|
476
|
+
*/
|
|
477
|
+
/**
|
|
478
|
+
* Default per-value size budget: 64 KiB of JSON.
|
|
479
|
+
*
|
|
480
|
+
* Deliberately far below any backend's hard ceiling (Restate's journal-entry
|
|
481
|
+
* limit is 32 MiB) because this is a design guard, not a protocol limit.
|
|
482
|
+
* Durable tool state is for flags, ids, counters, and cursors; a value that
|
|
483
|
+
* doesn't fit in 64 KiB is a payload, and payloads belong in the tool result
|
|
484
|
+
* or in storage the tool owns. Raise it on the store if you disagree — but
|
|
485
|
+
* know that everything here is rewritten on every commit.
|
|
486
|
+
*/
|
|
487
|
+
const DEFAULT_MAX_VALUE_BYTES = 64 * 1024;
|
|
488
|
+
/** Brand so {@link stagedToolState} can recognise views this module made. */
|
|
489
|
+
const STAGED = Symbol("zidane.toolState.staged");
|
|
490
|
+
/**
|
|
491
|
+
* Resolve the staging handle behind a view. Returns `undefined` for a
|
|
492
|
+
* missing view or a foreign implementation (a host that supplied its own
|
|
493
|
+
* `ToolStateView`), which lets adapters degrade to "no durable staging"
|
|
494
|
+
* instead of throwing.
|
|
495
|
+
*/
|
|
496
|
+
function stagedToolState(view) {
|
|
497
|
+
if (!view) return void 0;
|
|
498
|
+
return view[STAGED] ?? void 0;
|
|
499
|
+
}
|
|
500
|
+
function createToolStateController(store) {
|
|
501
|
+
const snapshot = /* @__PURE__ */ new Map();
|
|
502
|
+
const views = /* @__PURE__ */ new Map();
|
|
503
|
+
const maxValueBytes = store?.maxValueBytes ?? 65536;
|
|
504
|
+
let hydrated;
|
|
505
|
+
const hydrate = () => {
|
|
506
|
+
if (hydrated) return hydrated;
|
|
507
|
+
hydrated = (async () => {
|
|
508
|
+
if (!store) return;
|
|
509
|
+
const loaded = await store.load();
|
|
510
|
+
for (const [key, value] of Object.entries(loaded ?? {})) if (!snapshot.has(key)) snapshot.set(key, value);
|
|
511
|
+
})().catch((err) => {
|
|
512
|
+
hydrated = void 0;
|
|
513
|
+
throw err;
|
|
514
|
+
});
|
|
515
|
+
return hydrated;
|
|
516
|
+
};
|
|
517
|
+
const begin = (callId) => {
|
|
518
|
+
const existing = views.get(callId);
|
|
519
|
+
if (existing) return existing;
|
|
520
|
+
const view = createStagingView(snapshot, maxValueBytes);
|
|
521
|
+
views.set(callId, view);
|
|
522
|
+
return view;
|
|
523
|
+
};
|
|
524
|
+
const commit = async (callId) => {
|
|
525
|
+
const view = views.get(callId);
|
|
526
|
+
if (!view) return;
|
|
527
|
+
views.delete(callId);
|
|
528
|
+
const ops = view[STAGED].pending();
|
|
529
|
+
if (ops.length === 0) return;
|
|
530
|
+
await store?.commit(ops);
|
|
531
|
+
applyOps(snapshot, ops);
|
|
532
|
+
};
|
|
533
|
+
return {
|
|
534
|
+
hydrate,
|
|
535
|
+
begin,
|
|
536
|
+
commit,
|
|
537
|
+
discard: (callId) => {
|
|
538
|
+
views.delete(callId);
|
|
539
|
+
},
|
|
540
|
+
pending: (callId) => views.get(callId)?.[STAGED].pending() ?? [],
|
|
541
|
+
snapshot: () => Object.fromEntries(snapshot)
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Build a view over `snapshot` that records writes instead of applying
|
|
546
|
+
* them. Reads layer staged ops on top of the snapshot so a tool sees its
|
|
547
|
+
* own writes back — including deletions, which read as absent.
|
|
548
|
+
*/
|
|
549
|
+
function createStagingView(snapshot, maxValueBytes) {
|
|
550
|
+
let ops = [];
|
|
551
|
+
const latest = /* @__PURE__ */ new Map();
|
|
552
|
+
const stage = (op) => {
|
|
553
|
+
ops.push(op);
|
|
554
|
+
latest.set(op.key, op);
|
|
555
|
+
};
|
|
556
|
+
const resolve = (key) => {
|
|
557
|
+
const staged = latest.get(key);
|
|
558
|
+
if (staged) return staged.delete === true ? { present: false } : {
|
|
559
|
+
present: true,
|
|
560
|
+
value: staged.value
|
|
561
|
+
};
|
|
562
|
+
return snapshot.has(key) ? {
|
|
563
|
+
present: true,
|
|
564
|
+
value: snapshot.get(key)
|
|
565
|
+
} : { present: false };
|
|
566
|
+
};
|
|
567
|
+
const view = {
|
|
568
|
+
get: (key) => {
|
|
569
|
+
const resolved = resolve(key);
|
|
570
|
+
return resolved.present ? resolved.value : void 0;
|
|
571
|
+
},
|
|
572
|
+
set: (key, value) => {
|
|
573
|
+
assertStorable(key, value, maxValueBytes);
|
|
574
|
+
if (value === void 0) stage({
|
|
575
|
+
key,
|
|
576
|
+
delete: true
|
|
577
|
+
});
|
|
578
|
+
else stage({
|
|
579
|
+
key,
|
|
580
|
+
value
|
|
581
|
+
});
|
|
582
|
+
},
|
|
583
|
+
delete: (key) => {
|
|
584
|
+
stage({
|
|
585
|
+
key,
|
|
586
|
+
delete: true
|
|
587
|
+
});
|
|
588
|
+
},
|
|
589
|
+
has: (key) => resolve(key).present,
|
|
590
|
+
keys: () => {
|
|
591
|
+
const keys = new Set(snapshot.keys());
|
|
592
|
+
for (const [key, op] of latest) if (op.delete === true) keys.delete(key);
|
|
593
|
+
else keys.add(key);
|
|
594
|
+
return [...keys].sort();
|
|
595
|
+
},
|
|
596
|
+
[STAGED]: {
|
|
597
|
+
pending: () => [...ops],
|
|
598
|
+
restore: (restored) => {
|
|
599
|
+
ops = [...restored];
|
|
600
|
+
latest.clear();
|
|
601
|
+
for (const op of ops) latest.set(op.key, op);
|
|
602
|
+
},
|
|
603
|
+
clear: () => {
|
|
604
|
+
ops = [];
|
|
605
|
+
latest.clear();
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
};
|
|
609
|
+
Object.defineProperty(view, STAGED, {
|
|
610
|
+
value: view[STAGED],
|
|
611
|
+
enumerable: false
|
|
612
|
+
});
|
|
613
|
+
return view;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Reject a value that can't survive the trip to the store, at the moment the
|
|
617
|
+
* tool stages it.
|
|
618
|
+
*
|
|
619
|
+
* Scalars are skipped: they're bounded, and paying a `JSON.stringify` per
|
|
620
|
+
* `set` on a hot tool would be a real cost for no signal. Strings and objects
|
|
621
|
+
* are measured in UTF-8 bytes, which is what both the journal and the store
|
|
622
|
+
* actually spend.
|
|
623
|
+
*/
|
|
624
|
+
function assertStorable(key, value, maxValueBytes) {
|
|
625
|
+
if (value === void 0 || value === null || typeof value === "boolean" || typeof value === "number") return;
|
|
626
|
+
if (typeof value === "function" || typeof value === "symbol" || typeof value === "bigint") throw new TypeError(`tool state value for "${key}" is a ${typeof value}, which cannot cross a durable store — use a JSON-serializable value.`);
|
|
627
|
+
let json;
|
|
628
|
+
try {
|
|
629
|
+
json = typeof value === "string" ? value : JSON.stringify(value) ?? "";
|
|
630
|
+
} catch (err) {
|
|
631
|
+
throw new TypeError(`tool state value for "${key}" is not JSON-serializable (${err instanceof Error ? err.message : String(err)}) — durable tool state crosses a journal, so cycles and exotic values can't be stored.`);
|
|
632
|
+
}
|
|
633
|
+
const bytes = Buffer.byteLength(json, "utf8");
|
|
634
|
+
if (bytes > maxValueBytes) throw new RangeError(`tool state value for "${key}" is ${formatBytes(bytes)}, over the ${formatBytes(maxValueBytes)} limit. Durable tool state is for flags, ids, counters, and cursors — it is rewritten on every commit and crosses a journal entry. Keep the payload in the tool result or in storage the tool owns, and store a reference here.`);
|
|
635
|
+
}
|
|
636
|
+
function formatBytes(bytes) {
|
|
637
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
638
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
639
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
640
|
+
}
|
|
641
|
+
/** Apply ops to a snapshot map in order — last write per key wins. */
|
|
642
|
+
function applyOps(snapshot, ops) {
|
|
643
|
+
for (const op of ops) if (op.delete === true) snapshot.delete(op.key);
|
|
644
|
+
else snapshot.set(op.key, op.value);
|
|
645
|
+
}
|
|
646
|
+
/** Runtime guard for a journaled op list — adapters validate before restoring. */
|
|
647
|
+
function isToolStateOps(value) {
|
|
648
|
+
return Array.isArray(value) && value.every((op) => typeof op === "object" && op !== null && typeof op.key === "string" && (op.delete === true || "value" in op));
|
|
649
|
+
}
|
|
650
|
+
//#endregion
|
|
651
|
+
export { getReadState as a, hydrateReadStateFromSession as c, noteStaleRejection as d, readStateKey as f, stagedToolState as i, hydrateReadStateFromSessionAsync as l, staleRefusalHint as m, createToolStateController as n, getToolDedupState as o, resolveReadStateMap as p, isToolStateOps as r, hashContent as s, DEFAULT_MAX_VALUE_BYTES as t, markReadStateElided as u };
|
|
436
652
|
|
|
437
|
-
//# sourceMappingURL=
|
|
653
|
+
//# sourceMappingURL=tool-state-DTs-3ZHH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-state-DTs-3ZHH.js","names":[],"sources":["../src/tools/read-state.ts","../src/tool-state.ts"],"sourcesContent":["/**\n * Per-session file read tracking + tool-dedup state.\n *\n * Two concerns, one module so they can share the `WeakMap<Session, …>`\n * pattern (state lives as long as the session does, GC'd alongside it —\n * no public schema changes, no persistence). Each section below stands\n * on its own; the two maps don't share keys or behavior.\n *\n * ## Read-state\n *\n * Shared between `read_file` (dedup re-reads) and `edit` / `multi_edit`\n * (`requireReadBeforeEdit` guard). The state map records, per canonical\n * absolute file path:\n *\n * - `contentHash` — 64-bit FNV-style hash of the bytes the model last saw. Identical\n * re-reads return a stub; edits compare against this hash to detect\n * stale content.\n * - `(offset, limit, maxBytes, lineNumbers)` — slice / shape of the last\n * read, so a wider re-read invalidates the prior stub and a different\n * `lineNumbers` mode doesn't dedup against the previous shape.\n * - `mtimeMs` — wall-clock at last read, diagnostic only.\n *\n * Resolution is split between two helpers so consumers don't have to\n * juggle the `Session` vs. explicit-map cases themselves:\n *\n * - {@link getReadState} returns the map keyed by `Session` instance.\n * - {@link resolveReadStateMap} prefers an explicit `ctx.readState`\n * (the path `spawn`'s `shareReadState` uses to forward the parent's\n * map into a sessionless child) and falls back to the session-keyed\n * lookup. Tools should call this helper, not `getReadState` directly.\n *\n * ## Tool-dedup\n *\n * Backs `behavior.dedupTools`. Records the most recent `(hash, result)`\n * per canonical tool name within a session. Same WeakMap pattern; no\n * cross-talk with the read-state map.\n */\n\nimport type { AliasMaps } from '../aliasing'\nimport type { Session } from '../session'\nimport type { SessionTurn, ToolResultContent } from '../types'\nimport { resolve } from 'node:path'\nimport { toCanonicalName } from '../aliasing'\nimport { toolResultToText } from '../types'\nimport { resolveOldString, styleReplacementForVia } from './edit-utils'\n\n// ---------------------------------------------------------------------------\n// Read-state\n// ---------------------------------------------------------------------------\n\nexport interface ReadStateEntry {\n contentHash: string\n /** Slice parameters for the last read. */\n offset: number\n limit: number\n maxBytes: number\n /**\n * Whether the prior read emitted line-number prefixes. Tracked so a\n * read with `lineNumbers: true` doesn't dedup against one with\n * `lineNumbers: false` (or vice versa) — the dedup stub would mislead\n * the model about the prior output's shape.\n */\n lineNumbers?: boolean\n /** Wall-clock at last read — diagnostic only, not used for invalidation. */\n mtimeMs: number\n /**\n * Consecutive `requireReadBeforeEdit` drift refusals on this file since\n * the last fresh read. Fuel for {@link staleRefusalHint}: one refusal is\n * routine (the model edited after an out-of-band mutation and just needs\n * to re-read), but repeated refusals mean re-reading isn't fixing it —\n * something OUTSIDE the session (editor auto-save, formatter, codegen\n * watcher) keeps rewriting the file, and the error message must say so\n * instead of repeating advice the model already followed. That repetition\n * is exactly what teaches models to abandon `edit` for raw shell writes\n * that bypass every guard.\n *\n * Cleared by any fresh read (`rememberRead` writes a flag-less entry) and\n * by any successful edit (the mutation-site refresh drops it).\n */\n staleRejections?: number\n /**\n * Set when the on-wire read output this entry tracks can no longer be\n * trusted as-is, so `read_file`'s dedup must MISS on the next identical\n * re-read — the \"unchanged since the previous read\" stub would otherwise\n * point at content the model can no longer see, or that is no longer true.\n *\n * Two writers:\n * - the wire transforms (stale-read elision, tail compaction), which REMOVE\n * the output from the on-wire history;\n * - the mutating tools (`edit` / `multi_edit` / `write_file`), which refresh\n * `contentHash` to the post-mutation bytes — without the flag that refresh\n * would make the very next re-read hash-match and dedup would claim the\n * PRE-mutation body is \"still current\". Marking at the mutation keeps\n * dedup honest in every `elideStaleReads` mode, including off.\n *\n * The entry stays registered either way — `requireReadBeforeEdit` must keep\n * passing (the contentHash still guards against disk drift; un-registering\n * here is what degraded models into shell-edit one-liner workarounds).\n * Cleared by the next fresh read (`rememberRead` writes a flag-less entry).\n */\n elided?: true\n}\n\nexport type ReadStateMap = Map<string, ReadStateEntry>\n\nconst STATE = new WeakMap<Session, ReadStateMap>()\n\n/**\n * Get or lazily create the per-session read-state map. Returns `undefined`\n * when no session is provided.\n *\n * Most tool callers should prefer {@link resolveReadStateMap}, which\n * additionally honors an explicit `ctx.readState` (the path\n * `spawn`'s `shareReadState: true` uses to forward the parent's map\n * into a sessionless child). Use this helper directly only when the\n * Session-keyed map is exactly what you want and you don't need to\n * accept an override.\n */\nexport function getReadState(session: Session | undefined): ReadStateMap | undefined {\n if (!session)\n return undefined\n let map = STATE.get(session)\n if (!map) {\n map = new Map()\n STATE.set(session, map)\n }\n return map\n}\n\n/**\n * Resolve the active read-state map from a tool context. An explicit\n * `ctx.readState` wins (used by `spawn`'s `shareReadState` opt-in to\n * forward the parent's map into a sessionless child); otherwise the\n * usual `Session`-keyed lookup applies.\n *\n * Tools should call this helper instead of `getReadState(ctx.session)`\n * directly so the `shareReadState` plumbing is honored uniformly.\n */\nexport function resolveReadStateMap(ctx: {\n session?: Session\n readState?: ReadStateMap\n}): ReadStateMap | undefined {\n return ctx.readState ?? getReadState(ctx.session)\n}\n\n/**\n * Mark a read-state entry as elided from the on-wire history WITHOUT\n * un-registering it.\n *\n * Used by the loop's `elideStaleReads` pass. The entry must survive —\n * deleting it made the `requireReadBeforeEdit` gate reject the very next\n * edit on a file the model had demonstrably read and just edited (the\n * gate's failure mode then defeats the gate: models degrade to raw shell\n * edits that bypass the guard entirely). The `elided` flag instead\n * defeats only the dedup stub: the next identical re-read returns the\n * full body again, and `rememberRead` clears the flag.\n *\n * No-op when the path has no entry in the resolved map(s).\n */\nexport function markReadStateElided(ctx: {\n session?: Session\n readState?: ReadStateMap\n}, cwd: string, path: string): void {\n const key = readStateKey(cwd, path)\n for (const map of [ctx.readState, ctx.session ? STATE.get(ctx.session) : undefined]) {\n const entry = map?.get(key)\n if (entry && entry.elided !== true)\n map!.set(key, { ...entry, elided: true })\n }\n}\n\n/**\n * Record one `requireReadBeforeEdit` drift refusal against `entry` and\n * return the consecutive count (1 for the first). The caller composes the\n * refusal message with {@link staleRefusalHint}.\n */\nexport function noteStaleRejection(map: ReadStateMap, key: string, entry: ReadStateEntry): number {\n const count = (entry.staleRejections ?? 0) + 1\n map.set(key, { ...entry, staleRejections: count })\n return count\n}\n\n/**\n * Escalating suffix for a drift refusal. Empty on the first refusal — the\n * base \"re-read the file\" advice is correct and sufficient. From the second\n * consecutive refusal on, the model has demonstrably re-read and been\n * refused again, so repeating the same advice reads as a broken tool;\n * name the real hypothesis (an external writer) instead.\n */\nexport function staleRefusalHint(count: number): string {\n if (count < 2)\n return ''\n return ` This is refusal #${count} since your last read — a process outside this session (editor auto-save, formatter, codegen watcher) may be rewriting the file between your reads.`\n}\n\n/**\n * Canonical read-state key for a `(cwd, path)` pair.\n *\n * `ctx.execution.readFile(handle, path)` resolves the model-provided\n * path against `handle.cwd` before touching disk — so `src/App.tsx`,\n * `./src/App.tsx`, and `/abs/cwd/src/App.tsx` all read the **same**\n * bytes. The read-state map MUST mirror that resolution: without it,\n * a model that reads `src/App.tsx` and then edits `./src/App.tsx`\n * trips the `requireReadBeforeEdit` gate for a file it demonstrably\n * already saw (the gate's \"has not been read in this session\" message\n * fires on a stale key).\n *\n * `node:path`'s `resolve(cwd, path)` short-circuits when `path` is\n * already absolute, so absolute and relative shapes converge on the\n * same canonical form. We don't `realpath()` symlinks — the file IS\n * the path the model addressed, not the realpath behind it; the host's\n * execution context decides how to dereference.\n */\nexport function readStateKey(cwd: string, path: string): string {\n return resolve(cwd, path)\n}\n\n/**\n * 64-bit content hash: two independent 32-bit FNV-1a-style lanes (different\n * offset bases + multipliers) concatenated as 16 hex chars. Fast,\n * non-cryptographic — but wide enough that the `requireReadBeforeEdit`\n * drift gate, which silently corrupts a file on a false \"unchanged\"\n * verdict, isn't betting on a 32-bit birthday bound (~1 in 4 billion per\n * pair; uncomfortably reachable over many files × many sessions). Entries\n * live only in per-session in-memory maps, so widening needs no\n * stored-format migration. Still cheaper than allocating a Buffer and\n * pulling in `crypto`.\n */\nexport function hashContent(text: string): string {\n let h1 = 0x811C9DC5 // FNV-1a offset basis\n let h2 = 0x7EE36237 // arbitrary distinct basis for the second lane\n for (let i = 0; i < text.length; i++) {\n const c = text.charCodeAt(i)\n h1 = Math.imul(h1 ^ c, 0x01000193) >>> 0 // FNV prime 16777619\n h2 = Math.imul(h2 ^ c, 0x85EBCA6B) >>> 0 // murmur3 fmix multiplier\n }\n return h1.toString(16).padStart(8, '0') + h2.toString(16).padStart(8, '0')\n}\n\nexport interface HydrateReadStateOptions {\n /** Canonical read-file tool name. Defaults to `read_file`. */\n readFileToolName?: string\n /** Canonical write-file tool name. Defaults to `write_file`. */\n writeFileToolName?: string\n /** Canonical edit tool name. Defaults to `edit`. */\n editToolName?: string\n /** Canonical multi-edit tool name. Defaults to `multi_edit`. */\n multiEditToolName?: string\n /** Agent-level default for omitted `read_file.lineNumbers`. */\n defaultLineNumbers?: boolean\n /**\n * Optional replay-only fallback for read_file results whose transcript output\n * is partial/truncated. Receives the model-provided path and should return\n * the current full text bytes to hash exactly like live read_file.\n */\n readFileForHash?: (path: string) => Promise<string | null | undefined>\n /**\n * Tool-name aliases in effect for the transcript being replayed. zidane's\n * loop canonicalizes tool-call names before persisting, so durable turns\n * normally already carry canonical names — but a transcript captured from a\n * host that persists WIRE names (the aliased form the model saw, e.g.\n * `Read` / `Edit`), or one imported from another stack, would otherwise be\n * unrecognized and hydrate nothing. When provided, each tool-call name is\n * resolved to canonical (`toCanonicalName`) before matching, so both the\n * canonical and the aliased shape are honored. No-op for already-canonical\n * names.\n */\n aliasMaps?: AliasMaps\n}\n\ntype NormalizedHydrateReadStateOptions = Required<Omit<HydrateReadStateOptions, 'readFileForHash' | 'aliasMaps'>> & {\n readFileForHash?: HydrateReadStateOptions['readFileForHash']\n aliasMaps?: AliasMaps\n}\n\ninterface PendingToolCall {\n name: string\n input: Record<string, unknown>\n}\n\ninterface KnownFile {\n content: string\n entry: ReadStateEntry\n}\n\nconst READ_FILE_DEFAULT_OFFSET = 1\nconst READ_FILE_DEFAULT_LIMIT = 2000\nconst READ_FILE_DEFAULT_MAX_BYTES = 262_144\nconst READ_FILE_FOOTER_RE = /\\n\\n…(?:read lines|truncated)/\nconst READ_FILE_LINE_RE = /^\\d{1,9}\\t(.*)$/\n\n/**\n * Rebuild the per-session read-state map from durable session turns.\n *\n * Durable replay runtimes may return recorded tool results without re-running\n * the tool body, so in-memory side effects like `readState.set(...)` can be\n * missing even though the transcript contains the successful `read_file`.\n * This helper is intentionally opt-in: live hosts keep the normal side-effect\n * behavior unless they call it themselves.\n *\n * Hydration only fills missing keys. Live in-memory state may already reflect a\n * newer read or edit from the current run, and durable history cannot prove it\n * is fresher. Relative paths are resolved against the current execution cwd,\n * matching replay hosts that run sessions from a stable workspace.\n */\nexport function hydrateReadStateFromSession(\n session: Session | undefined,\n cwd: string,\n options: HydrateReadStateOptions = {},\n): number {\n if (!session)\n return 0\n\n const readState = getReadState(session)\n if (!readState)\n return 0\n\n const normalized = normalizeHydrateReadStateOptions(options)\n const pending = new Map<string, PendingToolCall>()\n const known = new Map<string, KnownFile>()\n const preexistingKeys = new Set(readState.keys())\n let hydrated = 0\n\n for (const turn of session.turns) {\n for (const block of turn.content) {\n if (block.type === 'tool_call') {\n // Resolve wire aliases (e.g. `Read`/`Edit`) to canonical before\n // matching, and STORE the canonical name in `pending` so the\n // downstream `stateFromToolResult` dispatch (which keys off the\n // canonical tool-name options) lines up regardless of how the\n // transcript spelled the call.\n const canonicalName = canonicalToolCallName(block.name, normalized)\n if (\n canonicalName === normalized.readFileToolName\n || canonicalName === normalized.writeFileToolName\n || canonicalName === normalized.editToolName\n || canonicalName === normalized.multiEditToolName\n ) {\n pending.set(block.id, { name: canonicalName, input: block.input })\n }\n continue\n }\n\n if (block.type !== 'tool_result')\n continue\n\n const call = pending.get(block.callId)\n if (!call)\n continue\n pending.delete(block.callId)\n if (block.isError === true)\n continue\n\n const output = toolResultToText(block.output)\n const next = stateFromToolResult(call, output, turn, cwd, normalized, known)\n if (!next)\n continue\n\n if (!preexistingKeys.has(next.key)) {\n readState.set(next.key, next.file.entry)\n hydrated += 1\n }\n known.set(next.key, next.file)\n }\n }\n\n return hydrated\n}\n\n/**\n * Async replay hydrator for durable hosts that can cheaply read the current\n * full file through their execution context. Transcript-only reconstruction is\n * still preferred for full reads; partial/truncated read_file entries fall back\n * to `readFileForHash` and hash those full current bytes.\n */\nexport async function hydrateReadStateFromSessionAsync(\n session: Session | undefined,\n cwd: string,\n options: HydrateReadStateOptions = {},\n): Promise<number> {\n if (!session)\n return 0\n\n const readState = getReadState(session)\n if (!readState)\n return 0\n\n const normalized = normalizeHydrateReadStateOptions(options)\n const pending = new Map<string, PendingToolCall>()\n const known = new Map<string, KnownFile>()\n const preexistingKeys = new Set(readState.keys())\n let hydrated = 0\n\n for (const turn of session.turns) {\n for (const block of turn.content) {\n if (block.type === 'tool_call') {\n // Resolve wire aliases (e.g. `Read`/`Edit`) to canonical before\n // matching, and STORE the canonical name in `pending` so the\n // downstream `stateFromToolResult` dispatch (which keys off the\n // canonical tool-name options) lines up regardless of how the\n // transcript spelled the call.\n const canonicalName = canonicalToolCallName(block.name, normalized)\n if (\n canonicalName === normalized.readFileToolName\n || canonicalName === normalized.writeFileToolName\n || canonicalName === normalized.editToolName\n || canonicalName === normalized.multiEditToolName\n ) {\n pending.set(block.id, { name: canonicalName, input: block.input })\n }\n continue\n }\n\n if (block.type !== 'tool_result')\n continue\n\n const call = pending.get(block.callId)\n if (!call)\n continue\n pending.delete(block.callId)\n if (block.isError === true)\n continue\n\n const output = toolResultToText(block.output)\n const next = await stateFromToolResultAsync(call, output, turn, cwd, normalized, known)\n if (!next)\n continue\n\n if (!preexistingKeys.has(next.key)) {\n readState.set(next.key, next.file.entry)\n hydrated += 1\n }\n known.set(next.key, next.file)\n }\n }\n\n return hydrated\n}\n\nfunction normalizeHydrateReadStateOptions(options: HydrateReadStateOptions): NormalizedHydrateReadStateOptions {\n return {\n readFileToolName: options.readFileToolName ?? 'read_file',\n writeFileToolName: options.writeFileToolName ?? 'write_file',\n editToolName: options.editToolName ?? 'edit',\n multiEditToolName: options.multiEditToolName ?? 'multi_edit',\n defaultLineNumbers: options.defaultLineNumbers ?? true,\n ...(options.readFileForHash ? { readFileForHash: options.readFileForHash } : {}),\n ...(options.aliasMaps ? { aliasMaps: options.aliasMaps } : {}),\n }\n}\n\n/**\n * Resolve a transcript tool-call name to its canonical form for matching.\n * Honors `aliasMaps` (wire → canonical) when present; otherwise the name is\n * already canonical (zidane persists canonical names) and passes through.\n */\nfunction canonicalToolCallName(name: string, options: NormalizedHydrateReadStateOptions): string {\n return options.aliasMaps ? toCanonicalName(name, options.aliasMaps) : name\n}\n\nfunction stateFromToolResult(\n call: PendingToolCall,\n output: string,\n resultTurn: SessionTurn,\n cwd: string,\n options: NormalizedHydrateReadStateOptions,\n known: Map<string, KnownFile>,\n): { key: string, file: KnownFile } | undefined {\n if (call.name === options.readFileToolName)\n return readFileStateFromResult(call.input, output, resultTurn, cwd, options.defaultLineNumbers)\n if (call.name === options.writeFileToolName)\n return writeFileStateFromResult(call.input, output, resultTurn, cwd)\n if (call.name === options.editToolName)\n return editStateFromResult(call.input, output, resultTurn, cwd, known)\n if (call.name === options.multiEditToolName)\n return multiEditStateFromResult(call.input, output, resultTurn, cwd, known)\n return undefined\n}\n\nasync function stateFromToolResultAsync(\n call: PendingToolCall,\n output: string,\n resultTurn: SessionTurn,\n cwd: string,\n options: NormalizedHydrateReadStateOptions,\n known: Map<string, KnownFile>,\n): Promise<{ key: string, file: KnownFile } | undefined> {\n if (call.name === options.readFileToolName) {\n return await readFileStateFromResultAsync(call.input, output, resultTurn, cwd, {\n defaultLineNumbers: options.defaultLineNumbers,\n readFileForHash: options.readFileForHash,\n })\n }\n return stateFromToolResult(call, output, resultTurn, cwd, options, known)\n}\n\nfunction readFileStateFromResult(\n input: Record<string, unknown>,\n output: string,\n resultTurn: SessionTurn,\n cwd: string,\n defaultLineNumbers: boolean,\n): { key: string, file: KnownFile } | undefined {\n const path = typeof input.path === 'string' ? input.path : undefined\n if (!path || !isSuccessfulFullReadOutput(output))\n return undefined\n\n const lineNumbers = typeof input.lineNumbers === 'boolean' ? input.lineNumbers : defaultLineNumbers\n const content = lineNumbers ? stripReadFileLineNumbers(output) : output\n if (content === undefined)\n return undefined\n\n const entry: ReadStateEntry = {\n contentHash: hashContent(content),\n offset: normalizeReadInteger(input.offset, READ_FILE_DEFAULT_OFFSET),\n limit: normalizeReadInteger(input.limit, READ_FILE_DEFAULT_LIMIT),\n maxBytes: normalizeReadInteger(input.maxBytes, READ_FILE_DEFAULT_MAX_BYTES),\n lineNumbers,\n mtimeMs: resultTurn.createdAt,\n }\n return { key: readStateKey(cwd, path), file: { content, entry } }\n}\n\nasync function readFileStateFromResultAsync(\n input: Record<string, unknown>,\n output: string,\n resultTurn: SessionTurn,\n cwd: string,\n options: {\n defaultLineNumbers: boolean\n readFileForHash?: HydrateReadStateOptions['readFileForHash']\n },\n): Promise<{ key: string, file: KnownFile } | undefined> {\n const reconstructed = readFileStateFromResult(input, output, resultTurn, cwd, options.defaultLineNumbers)\n if (reconstructed)\n return reconstructed\n\n const path = typeof input.path === 'string' ? input.path : undefined\n if (!path || !options.readFileForHash || !isSuccessfulReadOutput(output))\n return undefined\n\n let content: string | null | undefined\n try {\n content = await options.readFileForHash(path)\n }\n catch {\n return undefined\n }\n if (typeof content !== 'string')\n return undefined\n\n const lineNumbers = typeof input.lineNumbers === 'boolean' ? input.lineNumbers : options.defaultLineNumbers\n const entry: ReadStateEntry = {\n contentHash: hashContent(content),\n offset: normalizeReadInteger(input.offset, READ_FILE_DEFAULT_OFFSET),\n limit: normalizeReadInteger(input.limit, READ_FILE_DEFAULT_LIMIT),\n maxBytes: normalizeReadInteger(input.maxBytes, READ_FILE_DEFAULT_MAX_BYTES),\n lineNumbers,\n mtimeMs: resultTurn.createdAt,\n }\n return { key: readStateKey(cwd, path), file: { content, entry } }\n}\n\nfunction writeFileStateFromResult(\n input: Record<string, unknown>,\n output: string,\n resultTurn: SessionTurn,\n cwd: string,\n): { key: string, file: KnownFile } | undefined {\n const path = typeof input.path === 'string' ? input.path : undefined\n const content = typeof input.content === 'string' ? input.content : undefined\n if (!path || content === undefined)\n return undefined\n if (!output.startsWith(`Created ${path} (`) && !output.startsWith(`Updated ${path} (`))\n return undefined\n\n return {\n key: readStateKey(cwd, path),\n file: {\n content,\n entry: {\n contentHash: hashContent(content),\n offset: 0,\n limit: Number.POSITIVE_INFINITY,\n maxBytes: Number.POSITIVE_INFINITY,\n mtimeMs: resultTurn.createdAt,\n // Mirrors the live seed in `write-file.ts`: the write superseded any\n // prior on-wire read output, so the first re-read on the resumed\n // session must miss dedup and serve the fresh body — otherwise the\n // mutation-site honesty fix evaporates across a process restart.\n elided: true,\n },\n },\n }\n}\n\nfunction editStateFromResult(\n input: Record<string, unknown>,\n output: string,\n resultTurn: SessionTurn,\n cwd: string,\n known: Map<string, KnownFile>,\n): { key: string, file: KnownFile } | undefined {\n const path = typeof input.path === 'string' ? input.path : undefined\n const oldString = typeof input.old_string === 'string' ? input.old_string : undefined\n const newString = typeof input.new_string === 'string' ? input.new_string : undefined\n if (!path || oldString === undefined || newString === undefined)\n return undefined\n if (!output.startsWith(`Edited ${path}: replaced `))\n return undefined\n\n const key = readStateKey(cwd, path)\n const prior = known.get(key)\n if (!prior)\n return undefined\n\n const nextContent = applyEdit(prior.content, oldString, newString, input.replace_all === true)\n if (nextContent === undefined)\n return undefined\n\n return {\n key,\n file: {\n content: nextContent,\n // `elided: true` mirrors the live refresh in `edit.ts`: the hash now\n // matches post-edit bytes while the replayed wire still shows the\n // pre-edit read, so dedup must miss on the next re-read.\n entry: { ...prior.entry, contentHash: hashContent(nextContent), mtimeMs: resultTurn.createdAt, elided: true },\n },\n }\n}\n\ninterface MultiEditStep {\n old_string?: unknown\n new_string?: unknown\n replace_all?: unknown\n}\n\nfunction multiEditStateFromResult(\n input: Record<string, unknown>,\n output: string,\n resultTurn: SessionTurn,\n cwd: string,\n known: Map<string, KnownFile>,\n): { key: string, file: KnownFile } | undefined {\n const path = typeof input.path === 'string' ? input.path : undefined\n const edits = Array.isArray(input.edits) ? (input.edits as MultiEditStep[]) : undefined\n if (!path || !edits)\n return undefined\n if (!output.startsWith(`Edited ${path}: applied `))\n return undefined\n\n const key = readStateKey(cwd, path)\n const prior = known.get(key)\n if (!prior)\n return undefined\n\n const applied = parseMultiEditAppliedSteps(output, edits.length)\n let current = prior.content\n for (let i = 0; i < edits.length; i++) {\n if (!applied.has(i))\n continue\n const step = edits[i]\n if (typeof step.old_string !== 'string' || typeof step.new_string !== 'string')\n return undefined\n const next = applyEdit(current, step.old_string, step.new_string, step.replace_all === true)\n if (next === undefined)\n return undefined\n current = next\n }\n\n return {\n key,\n file: {\n content: current,\n // same rationale as `editStateFromResult` above\n entry: { ...prior.entry, contentHash: hashContent(current), mtimeMs: resultTurn.createdAt, elided: true },\n },\n }\n}\n\nfunction applyEdit(content: string, oldString: string, newString: string, replaceAll: boolean): string | undefined {\n const match = resolveOldString(content, oldString)\n if (!match)\n return undefined\n if (match.occurrences > 1 && !replaceAll)\n return undefined\n const styledReplacement = styleReplacementForVia(newString, match.via, match.actual)\n return replaceAll\n ? content.split(match.actual).join(styledReplacement)\n : content.replace(match.actual, styledReplacement)\n}\n\nfunction parseMultiEditAppliedSteps(output: string, editCount: number): Set<number> {\n const annotationMatch = /<edit-outcomes>\\n([\\s\\S]*?)\\n<\\/edit-outcomes>/.exec(output)\n if (!annotationMatch) {\n return new Set(Array.from({ length: editCount }, (_, i) => i))\n }\n\n const applied = new Set<number>()\n for (const line of annotationMatch[1].split('\\n')) {\n const match = /^#(\\d+) applied$/.exec(line.trim())\n if (!match)\n continue\n const index = Number(match[1]) - 1\n if (index >= 0 && index < editCount)\n applied.add(index)\n }\n return applied\n}\n\nfunction isSuccessfulFullReadOutput(output: string): boolean {\n // Live read_file stores a hash of the raw full file before pagination or\n // truncation. Durable turns only contain rendered output, so partial reads\n // cannot be reconstructed safely; skip them and require a real re-read.\n if (!isSuccessfulReadOutput(output) || READ_FILE_FOOTER_RE.test(output))\n return false\n return true\n}\n\nfunction isSuccessfulReadOutput(output: string): boolean {\n if (output.length === 0)\n return true\n if (\n output.startsWith('File not found:')\n || output.startsWith('[binary file:')\n || output.startsWith('Image:')\n || output.startsWith('Document:')\n || output.startsWith('[image too large to inline:')\n || output.startsWith('[document:')\n || output.startsWith('[document too large to attach:')\n || output.startsWith('Image read failed:')\n || output.startsWith('Document read failed:')\n || output.includes(' unchanged since the previous read in this session ')\n ) {\n return false\n }\n return true\n}\n\nfunction stripReadFileLineNumbers(output: string): string | undefined {\n const lines = output.split('\\n')\n const stripped: string[] = []\n for (const line of lines) {\n const match = READ_FILE_LINE_RE.exec(line)\n if (!match)\n return undefined\n stripped.push(match[1])\n }\n return stripped.join('\\n')\n}\n\nfunction normalizeReadInteger(value: unknown, fallback: number): number {\n if (typeof value !== 'number' || !Number.isFinite(value) || value < 0)\n return fallback\n return Math.floor(value)\n}\n\n// ---------------------------------------------------------------------------\n// Tool-dedup\n// ---------------------------------------------------------------------------\n\nexport interface ToolDedupEntry {\n hash: string\n result: string | ToolResultContent[]\n /**\n * Number of replay-hits accumulated against this `(name, hash)` since\n * the most recent fresh dispatch. `0` immediately after a fresh\n * dispatch; incremented every time a `tool:gate` handler returns the\n * cached result for an identical input. Used by `dedup-tools` to\n * implement `mode: 'block-after'` — when the count crosses the\n * configured threshold, the gate stops replaying and refuses the call\n * with a `Blocked:` tool_result so the model breaks out of the loop.\n *\n * Resets to `0` on a hash change (a different input under the same\n * tool name is treated as a fresh sequence). Optional for back-compat\n * with consumers that built the entry directly; absent is treated as\n * `0`.\n */\n repeats?: number\n /**\n * The recorded result was a failure or noop verdict (wire `isError`, or\n * `outcome: 'failed' | 'noop'`). Such verdicts are state-dependent —\n * replaying one would freeze a transient failure into a permanent one —\n * so `dedup-tools` never substitutes them on a hash hit; the call\n * re-executes instead. The entry still exists so identical failing\n * calls keep counting toward `mode: 'block-after'` thresholds.\n */\n failed?: boolean\n}\n\nexport type ToolDedupMap = Map<string, ToolDedupEntry>\n\nconst TOOL_DEDUP_STATE = new WeakMap<Session, ToolDedupMap>()\n\n/**\n * Get or lazily create the per-session tool-dedup map. Returns `undefined`\n * when no session is provided — middleware should treat that as \"no dedup\".\n */\nexport function getToolDedupState(session: Session | undefined): ToolDedupMap | undefined {\n if (!session)\n return undefined\n let map = TOOL_DEDUP_STATE.get(session)\n if (!map) {\n map = new Map()\n TOOL_DEDUP_STATE.set(session, map)\n }\n return map\n}\n","/**\n * Durable key/value state for tools.\n *\n * A tool reaches this through {@link ToolContext.state} — a plain,\n * SYNCHRONOUS map view. Synchronous is not a convenience choice: under a\n * durable-execution runtime the tool body runs inside a journaled action\n * (Restate's `ctx.run`), and a durable read (`ctx.get`) is illegal in\n * there. So the flow is split into three phases the runtime can journal\n * independently:\n *\n * 1. **hydrate** — load the snapshot ONCE per agent, outside any\n * journaled action, before the first tool dispatch.\n * 2. **stage** — the tool mutates its per-call view. Mutations are\n * recorded as an ordered {@link ToolStateOp} list, NOT written\n * through: they're plain data, so a durable adapter can journal them\n * alongside the tool result.\n * 3. **commit** — the loop applies the staged ops through\n * {@link ToolStateStore.commit} after the call settles, outside the\n * journaled action.\n *\n * The invariant that makes this replay-safe:\n *\n * > A staged mutation is committed only if it came back OUT of a journal\n * > entry.\n *\n * A durable adapter (see `restateTool`) reads {@link StagedToolState.pending}\n * from inside its journaled closure, ships the ops out as part of the\n * journaled value, and calls {@link StagedToolState.restore} outside it. On\n * replay the tool body never runs, so nothing is staged live — `restore`\n * re-seeds the exact same ops from the journal and the commit re-issues an\n * identical write. Paths that produced no journal entry (a fatal error, a\n * control abort, a dead attempt) call {@link StagedToolState.clear} so live\n * mutations from an attempt nobody recorded can never reach the store.\n *\n * The store seam is deliberately runtime-agnostic: `zidane/restate` ships\n * `restateToolStateStore`, but a Redis / Postgres / file-backed\n * implementation is the same two methods. With no store configured the\n * controller is in-memory only — `ctx.state` still works everywhere\n * (local CLI, tests, subagents), it just doesn't outlive the process.\n */\n\nimport { Buffer } from 'node:buffer'\n\n/**\n * Tool-facing view. Reads hit the hydrated snapshot merged with this\n * call's own staged writes; writes stage an op (see the module docstring\n * for why they aren't written through).\n */\nexport interface ToolStateView {\n /**\n * Value for `key`, or `undefined` when absent (or staged for deletion).\n * Pass the expected type (`get<boolean>('delivered')`) — what crossed the\n * store is JSON, so nothing here can validate it for you.\n */\n get: <T = unknown>(key: string) => T | undefined\n /**\n * Stage a write. Values must be JSON-serializable — they cross a journal\n * and a store. `set(key, undefined)` is normalized to a deletion, since\n * that is what a read would report and an undefined value would not\n * survive serialization intact.\n *\n * Throws if the value is not serializable, or if it exceeds the store's\n * size budget ({@link ToolStateStore.maxValueBytes}, default\n * {@link DEFAULT_MAX_VALUE_BYTES}). Failing HERE is the point: the\n * alternative is a rejection at commit time, long after the tool that\n * caused it returned — and under Restate an oversized state value fails\n * the whole invocation with `RT0003` and retries it, so an unguarded fat\n * write is a poison pill, not a dropped write.\n */\n set: (key: string, value: unknown) => void\n /** Stage a deletion. */\n delete: (key: string) => void\n /** Whether `key` currently resolves to a value. */\n has: (key: string) => boolean\n /** Keys visible to this call, snapshot + staged writes, ascending. */\n keys: () => string[]\n}\n\n/**\n * One staged mutation. JSON-shaped on purpose: durable adapters journal\n * these verbatim, so a tagged union with an explicit delete flag beats\n * `value: undefined` (which JSON drops).\n */\nexport type ToolStateOp\n = | { key: string, value: unknown, delete?: never }\n | { key: string, delete: true, value?: never }\n\n/**\n * Durable backing for tool state. NOT runtime-specific — implement it\n * against whatever the host already trusts with durable writes.\n *\n * `load` runs once per agent instance, before any tool dispatch. `commit`\n * receives the ops staged by one tool call, in the order the tool made them.\n *\n * Two requirements on `commit`:\n *\n * - **Idempotent.** A durable adapter may hand the same ops twice if the\n * invocation is retried before the commit is recorded.\n * - **Non-throwing, ideally.** A rejection does not fail the tool call — the\n * body already ran and its side effects already happened, so the dispatch\n * path logs the failure under `ZIDANE_DEBUG` and drops the write rather\n * than killing the run. Retry inside your implementation if the write\n * matters more than the latency.\n */\nexport interface ToolStateStore {\n load: () => Promise<Record<string, unknown>> | Record<string, unknown>\n commit: (ops: readonly ToolStateOp[]) => Promise<void> | void\n /**\n * Largest single value this store accepts, in bytes of JSON. Declared by\n * the store because the limit belongs to the backend, not the caller:\n * Restate's is a journal-entry cap, Redis's is a value cap, a file store's\n * is whatever you say it is. `ToolStateView.set` enforces it at stage time.\n * Defaults to {@link DEFAULT_MAX_VALUE_BYTES}.\n */\n maxValueBytes?: number\n}\n\n/**\n * Default per-value size budget: 64 KiB of JSON.\n *\n * Deliberately far below any backend's hard ceiling (Restate's journal-entry\n * limit is 32 MiB) because this is a design guard, not a protocol limit.\n * Durable tool state is for flags, ids, counters, and cursors; a value that\n * doesn't fit in 64 KiB is a payload, and payloads belong in the tool result\n * or in storage the tool owns. Raise it on the store if you disagree — but\n * know that everything here is rewritten on every commit.\n */\nexport const DEFAULT_MAX_VALUE_BYTES = 64 * 1024\n\n/**\n * Staging handle behind a {@link ToolStateView} — the seam durable\n * adapters use to move a call's mutations through a journal. Not part of\n * the tool-facing surface; resolve it with {@link stagedToolState}.\n */\nexport interface StagedToolState {\n /** Ops staged so far, in mutation order. Non-destructive. */\n pending: () => ToolStateOp[]\n /** Replace the staged ops (replay path: re-seed from the journaled value). */\n restore: (ops: readonly ToolStateOp[]) => void\n /** Drop staged ops — for paths whose mutations were never journaled. */\n clear: () => void\n}\n\n/**\n * Per-agent owner of the snapshot + per-call staging.\n *\n * One controller per agent instance: the snapshot is shared across runs\n * (so state written in run 1 is visible in run 2 without a reload), while\n * each tool call gets its own view so its mutations can be journaled and\n * committed independently.\n */\nexport interface ToolStateController {\n /**\n * Load the snapshot from the store. Idempotent and memoized — the first\n * caller performs the load, later callers await the same promise. Hosts\n * don't call this directly; the agent invokes it at run start, which is\n * the deterministic outside-the-journal position a durable store needs.\n */\n hydrate: () => Promise<void>\n /** Fresh staging view for `callId`. Repeated calls return the same view. */\n begin: (callId: string) => ToolStateView\n /**\n * Apply `callId`'s staged ops to the store and merge them into the\n * snapshot, then drop the view. No-op when nothing was staged — which\n * is the common case and, crucially, means no durable write happens for\n * calls that never touched state.\n */\n commit: (callId: string) => Promise<void>\n /** Discard `callId`'s view without committing. */\n discard: (callId: string) => void\n /**\n * Ops `callId` has staged but not yet committed, in staging order. For\n * reporting a failed commit (the controller drops the view on failure, so\n * a caller that wants the lost delta must read it beforehand).\n */\n pending: (callId: string) => readonly ToolStateOp[]\n /** Current snapshot, for hosts that want to inspect or persist it. */\n snapshot: () => Readonly<Record<string, unknown>>\n}\n\n/** Brand so {@link stagedToolState} can recognise views this module made. */\nconst STAGED = Symbol('zidane.toolState.staged')\n\ninterface BrandedView extends ToolStateView {\n [STAGED]: StagedToolState\n}\n\n/**\n * Resolve the staging handle behind a view. Returns `undefined` for a\n * missing view or a foreign implementation (a host that supplied its own\n * `ToolStateView`), which lets adapters degrade to \"no durable staging\"\n * instead of throwing.\n */\nexport function stagedToolState(view: ToolStateView | undefined): StagedToolState | undefined {\n if (!view)\n return undefined\n const branded = (view as Partial<BrandedView>)[STAGED]\n return branded ?? undefined\n}\n\nexport function createToolStateController(store?: ToolStateStore): ToolStateController {\n const snapshot = new Map<string, unknown>()\n const views = new Map<string, BrandedView>()\n const maxValueBytes = store?.maxValueBytes ?? DEFAULT_MAX_VALUE_BYTES\n let hydrated: Promise<void> | undefined\n\n const hydrate = (): Promise<void> => {\n if (hydrated)\n return hydrated\n const attempt = (async () => {\n if (!store)\n return\n const loaded = await store.load()\n // Keys already written this process win: a `commit` can only have\n // landed after a load in the same controller, but a host-supplied\n // store may resolve `load` lazily/slowly, and losing a committed\n // write to a stale snapshot would be silent corruption.\n for (const [key, value] of Object.entries(loaded ?? {})) {\n if (!snapshot.has(key))\n snapshot.set(key, value)\n }\n })()\n // Memoize the SUCCESS only. Caching a rejection would brick every later\n // run of a long-lived agent on one transient store blip — the agent\n // hydrates before each run, so a cleared memo simply retries the load.\n hydrated = attempt.catch((err: unknown) => {\n hydrated = undefined\n throw err\n })\n return hydrated\n }\n\n const begin = (callId: string): ToolStateView => {\n const existing = views.get(callId)\n if (existing)\n return existing\n const view = createStagingView(snapshot, maxValueBytes)\n views.set(callId, view)\n return view\n }\n\n const commit = async (callId: string): Promise<void> => {\n const view = views.get(callId)\n if (!view)\n return\n views.delete(callId)\n const ops = view[STAGED].pending()\n if (ops.length === 0)\n return\n // Store first, snapshot second: if the store rejects, memory must not be\n // left claiming a write that never persisted — later calls in the run\n // would read it back as if it had landed.\n await store?.commit(ops)\n applyOps(snapshot, ops)\n }\n\n return {\n hydrate,\n begin,\n commit,\n discard: (callId: string) => {\n views.delete(callId)\n },\n pending: (callId: string) => views.get(callId)?.[STAGED].pending() ?? [],\n snapshot: () => Object.fromEntries(snapshot),\n }\n}\n\n/**\n * Build a view over `snapshot` that records writes instead of applying\n * them. Reads layer staged ops on top of the snapshot so a tool sees its\n * own writes back — including deletions, which read as absent.\n */\nfunction createStagingView(snapshot: Map<string, unknown>, maxValueBytes: number): BrandedView {\n let ops: ToolStateOp[] = []\n // Last op per key — reads resolve against this, so repeated writes to\n // one key stay O(1) and last-write-wins matches what `commit` applies.\n const latest = new Map<string, ToolStateOp>()\n\n const stage = (op: ToolStateOp): void => {\n ops.push(op)\n latest.set(op.key, op)\n }\n\n const resolve = (key: string): { present: boolean, value?: unknown } => {\n const staged = latest.get(key)\n if (staged)\n return staged.delete === true ? { present: false } : { present: true, value: staged.value }\n return snapshot.has(key) ? { present: true, value: snapshot.get(key) } : { present: false }\n }\n\n const view: BrandedView = {\n get: <T = unknown>(key: string): T | undefined => {\n const resolved = resolve(key)\n return resolved.present ? (resolved.value as T) : undefined\n },\n set: (key: string, value: unknown): void => {\n assertStorable(key, value, maxValueBytes)\n // `set(k, undefined)` stages a DELETE, not a `{ key, value: undefined }`\n // op. Two reasons: `get(k)` reports undefined for both cases anyway, and\n // an op with an undefined value is not JSON-stable — a journal or store\n // round-trip drops the property, so the op would come back as a bare\n // `{ key }` that no longer matches its own schema.\n if (value === undefined)\n stage({ key, delete: true })\n else\n stage({ key, value })\n },\n delete: (key: string): void => {\n stage({ key, delete: true })\n },\n has: (key: string): boolean => resolve(key).present,\n keys: (): string[] => {\n const keys = new Set(snapshot.keys())\n for (const [key, op] of latest) {\n if (op.delete === true)\n keys.delete(key)\n else\n keys.add(key)\n }\n return [...keys].sort()\n },\n [STAGED]: {\n pending: () => [...ops],\n restore: (restored: readonly ToolStateOp[]) => {\n ops = [...restored]\n latest.clear()\n for (const op of ops)\n latest.set(op.key, op)\n },\n clear: () => {\n ops = []\n latest.clear()\n },\n },\n }\n // Keep the brand off `Object.keys` / spreads so a host that clones the\n // view for its own tool context doesn't silently carry the staging\n // handle onto an unrelated object.\n Object.defineProperty(view, STAGED, { value: view[STAGED], enumerable: false })\n return view\n}\n\n/**\n * Reject a value that can't survive the trip to the store, at the moment the\n * tool stages it.\n *\n * Scalars are skipped: they're bounded, and paying a `JSON.stringify` per\n * `set` on a hot tool would be a real cost for no signal. Strings and objects\n * are measured in UTF-8 bytes, which is what both the journal and the store\n * actually spend.\n */\nfunction assertStorable(key: string, value: unknown, maxValueBytes: number): void {\n if (value === undefined || value === null || typeof value === 'boolean' || typeof value === 'number')\n return\n if (typeof value === 'function' || typeof value === 'symbol' || typeof value === 'bigint') {\n throw new TypeError(\n `tool state value for \"${key}\" is a ${typeof value}, which cannot cross a durable store — use a JSON-serializable value.`,\n )\n }\n\n let json: string\n try {\n json = typeof value === 'string' ? value : JSON.stringify(value) ?? ''\n }\n catch (err) {\n throw new TypeError(\n `tool state value for \"${key}\" is not JSON-serializable (${err instanceof Error ? err.message : String(err)}) — durable tool state crosses a journal, so cycles and exotic values can't be stored.`,\n )\n }\n\n const bytes = Buffer.byteLength(json, 'utf8')\n if (bytes > maxValueBytes) {\n throw new RangeError(\n `tool state value for \"${key}\" is ${formatBytes(bytes)}, over the ${formatBytes(maxValueBytes)} limit. `\n + 'Durable tool state is for flags, ids, counters, and cursors — it is rewritten on every commit and crosses a journal entry. '\n + 'Keep the payload in the tool result or in storage the tool owns, and store a reference here.',\n )\n }\n}\n\nfunction formatBytes(bytes: number): string {\n if (bytes < 1024)\n return `${bytes} B`\n if (bytes < 1024 * 1024)\n return `${(bytes / 1024).toFixed(1)} KB`\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`\n}\n\n/** Apply ops to a snapshot map in order — last write per key wins. */\nfunction applyOps(snapshot: Map<string, unknown>, ops: readonly ToolStateOp[]): void {\n for (const op of ops) {\n if (op.delete === true)\n snapshot.delete(op.key)\n else\n snapshot.set(op.key, op.value)\n }\n}\n\n/** Runtime guard for a journaled op list — adapters validate before restoring. */\nexport function isToolStateOps(value: unknown): value is ToolStateOp[] {\n return Array.isArray(value) && value.every(op =>\n typeof op === 'object' && op !== null\n && typeof (op as ToolStateOp).key === 'string'\n && ((op as ToolStateOp).delete === true || 'value' in (op as object)),\n )\n}\n"],"mappings":";;;;;;AAyGA,MAAM,wBAAQ,IAAI,QAA+B;;;;;;;;;;;;AAajD,SAAgB,aAAa,SAAwD;CACnF,IAAI,CAAC,SACH,OAAO,KAAA;CACT,IAAI,MAAM,MAAM,IAAI,OAAO;CAC3B,IAAI,CAAC,KAAK;EACR,sBAAM,IAAI,IAAI;EACd,MAAM,IAAI,SAAS,GAAG;CACxB;CACA,OAAO;AACT;;;;;;;;;;AAWA,SAAgB,oBAAoB,KAGP;CAC3B,OAAO,IAAI,aAAa,aAAa,IAAI,OAAO;AAClD;;;;;;;;;;;;;;;AAgBA,SAAgB,oBAAoB,KAGjC,KAAa,MAAoB;CAClC,MAAM,MAAM,aAAa,KAAK,IAAI;CAClC,KAAK,MAAM,OAAO,CAAC,IAAI,WAAW,IAAI,UAAU,MAAM,IAAI,IAAI,OAAO,IAAI,KAAA,CAAS,GAAG;EACnF,MAAM,QAAQ,KAAK,IAAI,GAAG;EAC1B,IAAI,SAAS,MAAM,WAAW,MAC5B,IA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AM,QAAQ,KAAK,KAAK,MAAM,OAAM,OACzC,OAAO,OAAO,YAAY,OAAO,QAC9B,OAAQ,GAAmB,QAAQ,aACjC,GAAmB,WAAW,QAAQ,WAAY,GACzD;AACF"}
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $m as ToolDef, Ar as createSkillsReadTool, As as SpawnToolOptions, Br as grep, Bs as matchModelEntries, Cr as ToolSearchToolOptions, Dr as SkillsRunScriptToolOptions, Ds as SpawnTaskInput, Er as createSkillsUseTool, Es as ExtensionSubagentDef, Fr as readFile, Fs as createSpawnTool, Hr as edit, Ir as multiEdit, Is as isSpawnTool, Lr as listFiles, Ls as SpawnModelEntry, Mr as CreateShellToolOptions, Ms as SubagentDef, Nr as createShellTool, Ns as SubagentOverride, Or as createSkillsRunScriptTool, Os as SpawnTaskOutcome, Pr as shell, Ps as SubagentRegistry, Qm as ToolContext, Rr as InteractionToolOptions, Rs as createModelSearchTool, Sr as LazyToolEntry, Tr as SkillsUseToolOptions, Ts as ChildAgent, Vr as glob, _r as waitTask, ah as hashContent, br as TailTruncateOptions, ch as readStateKey, eh as ToolMap, gr as WAIT_TASK_TIMED_OUT_PREFIX, hr as writeFile, ih as getReadState, jr as shellKill, js as SpawnToolState, kr as SkillsReadToolOptions, ks as SpawnTool, lh as resolveReadStateMap, nh as ReadStateEntry, oh as hydrateReadStateFromSession, rh as ReadStateMap, sh as hydrateReadStateFromSessionAsync, th as HydrateReadStateOptions, vr as ValidationResult, wr as createToolSearchTool, xr as tailTruncate, yr as validateToolArgs, zr as createInteractionTool, zs as formatModelLine } from "./index-
|
|
1
|
+
import { $m as ToolDef, Ar as createSkillsReadTool, As as SpawnToolOptions, Br as grep, Bs as matchModelEntries, Cr as ToolSearchToolOptions, Dr as SkillsRunScriptToolOptions, Ds as SpawnTaskInput, Er as createSkillsUseTool, Es as ExtensionSubagentDef, Fr as readFile, Fs as createSpawnTool, Hr as edit, Ir as multiEdit, Is as isSpawnTool, Lr as listFiles, Ls as SpawnModelEntry, Mr as CreateShellToolOptions, Ms as SubagentDef, Nr as createShellTool, Ns as SubagentOverride, Or as createSkillsRunScriptTool, Os as SpawnTaskOutcome, Pr as shell, Ps as SubagentRegistry, Qm as ToolContext, Rr as InteractionToolOptions, Rs as createModelSearchTool, Sr as LazyToolEntry, Tr as SkillsUseToolOptions, Ts as ChildAgent, Vr as glob, _r as waitTask, ah as hashContent, br as TailTruncateOptions, ch as readStateKey, eh as ToolMap, gr as WAIT_TASK_TIMED_OUT_PREFIX, hr as writeFile, ih as getReadState, jr as shellKill, js as SpawnToolState, kr as SkillsReadToolOptions, ks as SpawnTool, lh as resolveReadStateMap, nh as ReadStateEntry, oh as hydrateReadStateFromSession, rh as ReadStateMap, sh as hydrateReadStateFromSessionAsync, th as HydrateReadStateOptions, vr as ValidationResult, wr as createToolSearchTool, xr as tailTruncate, yr as validateToolArgs, zr as createInteractionTool, zs as formatModelLine } from "./index-C-Nd2ZbV.js";
|
|
2
2
|
export { type ChildAgent, type CreateShellToolOptions, type ExtensionSubagentDef, type HydrateReadStateOptions, type InteractionToolOptions, type LazyToolEntry, type ReadStateEntry, type ReadStateMap, type SkillsReadToolOptions, type SkillsRunScriptToolOptions, type SkillsUseToolOptions, type SpawnModelEntry, type SpawnTaskInput, type SpawnTaskOutcome, type SpawnTool, type SpawnToolOptions, type SpawnToolState, type SubagentDef, type SubagentOverride, type SubagentRegistry, type TailTruncateOptions, type ToolContext, type ToolDef, type ToolMap, type ToolSearchToolOptions, type ValidationResult, WAIT_TASK_TIMED_OUT_PREFIX, createInteractionTool, createModelSearchTool, createShellTool, createSkillsReadTool, createSkillsRunScriptTool, createSkillsUseTool, createSpawnTool, createToolSearchTool, edit, formatModelLine, getReadState, glob, grep, hashContent, hydrateReadStateFromSession, hydrateReadStateFromSessionAsync, isSpawnTool, listFiles, matchModelEntries, multiEdit, readFile, readStateKey, resolveReadStateMap, shell, shellKill, tailTruncate, validateToolArgs, waitTask, writeFile };
|
package/dist/tools.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { Bt as validateToolArgs, Ct as createSkillsRunScriptTool, Dt as shell, Et as createShellTool, Ft as listFiles, It as createInteractionTool, Lt as grep, Mt as createModelSearchTool, Nt as formatModelLine, Ot as tailTruncate, Pt as matchModelEntries, Rt as glob, St as createSkillsUseTool, Tt as shellKill, _t as WAIT_TASK_TIMED_OUT_PREFIX, bt as createSpawnTool, gt as writeFile, jt as multiEdit, kt as readFile, vt as waitTask, wt as createSkillsReadTool, xt as isSpawnTool, yt as createToolSearchTool, zt as edit } from "./agent-
|
|
1
|
+
import { a as getReadState, c as hydrateReadStateFromSession, f as readStateKey, l as hydrateReadStateFromSessionAsync, p as resolveReadStateMap, s as hashContent } from "./tool-state-DTs-3ZHH.js";
|
|
2
|
+
import { Bt as validateToolArgs, Ct as createSkillsRunScriptTool, Dt as shell, Et as createShellTool, Ft as listFiles, It as createInteractionTool, Lt as grep, Mt as createModelSearchTool, Nt as formatModelLine, Ot as tailTruncate, Pt as matchModelEntries, Rt as glob, St as createSkillsUseTool, Tt as shellKill, _t as WAIT_TASK_TIMED_OUT_PREFIX, bt as createSpawnTool, gt as writeFile, jt as multiEdit, kt as readFile, vt as waitTask, wt as createSkillsReadTool, xt as isSpawnTool, yt as createToolSearchTool, zt as edit } from "./agent-8sUadp5M.js";
|
|
3
3
|
export { WAIT_TASK_TIMED_OUT_PREFIX, createInteractionTool, createModelSearchTool, createShellTool, createSkillsReadTool, createSkillsRunScriptTool, createSkillsUseTool, createSpawnTool, createToolSearchTool, edit, formatModelLine, getReadState, glob, grep, hashContent, hydrateReadStateFromSession, hydrateReadStateFromSessionAsync, isSpawnTool, listFiles, matchModelEntries, multiEdit, readFile, readStateKey, resolveReadStateMap, shell, shellKill, tailTruncate, validateToolArgs, waitTask, writeFile };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Gu as StreamEvent, Lo as ExtensionRegistry, Lu as EditOutcome, Ns as SubagentOverride, Om as SessionTurn, Pm as ThinkingLevel, Ps as SubagentRegistry,
|
|
1
|
+
import { Ah as SessionRun, Gu as StreamEvent, Lo as ExtensionRegistry, Lu as EditOutcome, Ns as SubagentOverride, Oh as SessionData, Om as SessionTurn, Pm as ThinkingLevel, Ps as SubagentRegistry, Tu as AgentRegistry, Uu as SessionMeta, Vu as Picked, Wa as ExtensionConfigCategory, Wu as Settings, cd as ModelInfo, id as ProviderKey, im as McpServerConfig, jh as SessionStore, no as StoredExtensionConfigItem, qu as ModelChainEntry, rd as ProviderAuth, t as Preset, ud as ProviderDescriptor, wm as SessionContentBlock, zm as ToolResultContent } from "./index-C-Nd2ZbV.js";
|
|
2
2
|
//#region src/chat/hints.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Single hint entry — `<key> <label>`, optionally followed by an inline
|
|
@@ -1485,4 +1485,4 @@ declare function computeTurnAnchors(items: readonly TranscriptItem[]): {
|
|
|
1485
1485
|
};
|
|
1486
1486
|
//#endregion
|
|
1487
1487
|
export { KEYBINDING_KEY_COL_WIDTH as $, resolveStorageDirs as A, loadState as B, ResolvedPaths as C, StorageDirs as D, ResolveStorageDirsOptions as E, createStateStore as F, titleFromTurns as G, saveState as H, deriveSessionTitle as I, updateToolEventOutcomes as J, toolCallPreview as K, eventsFromTurns as L, StateStoreApi as M, TuiState as N, StorageMode as O, compactSummaryEvent as P, KEYBINDING_DEF_BY_ACTION as Q, lastContextSizeFromTurns as R, ResolvedConfig as S, resolveStoragePaths as T, stripSpawnTokensLine as U, marginTopFor as V, sumRunCosts as W, DEFAULT_KEYBINDINGS as X, usageByModel as Y, KEYBINDING_DEFS as Z, discoverProjectMcps as _, EMPTY_HINTS as _t, SessionExportTarget as a, ResolvedExtensionKeybinding as at, ChatOptions as b, hintsLength as bt, writeSessionExport as c, groupBindings as ct, useEnabledToggleSet as d, mergeKeybindings as dt, KeyAction as et, DiscoveredMcp as f, parseBindingSpec as ft, defaultMcpsConfigPaths as g, stripJsonComments as gt, buildMcpServers as h, resolveExtensionKeybindings as ht, SessionExportFormat as i, ParsedBinding as it, ModelUsageSummary as j, StorageSlot as k, EnabledAllowlistKey as l, keybindingsPath as lt, DiscoveryResult as m, readKeybindingsRaw as mt, computeTurnAnchors as n, KeyBindingSection as nt, renderSession as o, ensureKeybindingsFile as ot, DiscoveryError as p, readKeybindings as pt, toolResultText as q, SessionExportAnchor as r, KeyBindings as rt, resolveSessionExportTarget as s, formatBindingForDisplay as st, TranscriptItem as t, KeyBindingDef as tt, EnabledToggleSet as u, matchesBinding as ut, parseMcpsFile as v, Hint as vt, resolveConfig as w, ProviderRegistry as x, truncateTrailing as xt, AutoUpdateConfig as y, clipHintsToWidth as yt, listSessionMeta as z };
|
|
1488
|
-
//# sourceMappingURL=transcript-anchors-
|
|
1488
|
+
//# sourceMappingURL=transcript-anchors-BCUpbNxc.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transcript-anchors-
|
|
1
|
+
{"version":3,"file":"transcript-anchors-BCUpbNxc.d.ts","names":[],"sources":["../src/chat/hints.ts","../src/start/shared-options.ts","../src/chat/keybindings.ts","../src/chat/store.ts","../src/chat/xdg.ts","../src/chat/config.ts","../src/chat/mcps-discovery.ts","../src/chat/enabled-toggle-set.ts","../src/chat/session-export.ts","../src/chat/transcript-anchors.ts"],"mappings":";;;;;;AAuBA;;;;;;UAAiB,IAAA;EACf,GAAA;EACA,KAAA;EAYE;EAVF,QAAA;EAmBE;EAjBF,UAAA;EAqBE;;AAAU;AAcd;;;EA5BE,KAAA;IACE,GAAA;IACA,KAAA;IAmDuB;;;AAAuB;AAqBlD;;;IAhEI,OAAA,WAgEmC;IA9DnC,QAAA,WA2E4B;IAzE5B,UAAA;EAAA;AAAA;;;;;AAyEmF;;;;ACnHvF;;iBDwDgB,gBAAA,CAAiB,IAAA,UAAc,GAAW;;ACxDuF;AACjJ;;;;iBDgFgB,WAAA,CAAY,KAAsB,WA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a,QAAA,GAAW,WAAA;AAAA;EAC9C,IAAA;EAAmB,MAAA,EAAQ,WAAA;EAAe,QAAA,GAAW,WAAA;AAAA;EACrD,IAAA;EAAoB,GAAA;EAAa,MAAA,EAAQ,WAAA;EAAe,QAAA,GAAW,WAAA;AAAA;ATuDzB;AAqBlD;;;;AAAuC;AAavC;;;;;;;;;AAAuF;;;AAlCrC,iBSnClC,kBAAA,CAAmB,KAAA,WAAgB,cAAA;EACjD,QAAA,EAAU,WAAW;EACrB,GAAA;EACA,UAAA;AAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { l as toolResultToText } from "./types-BIarq1qE.js";
|
|
2
|
-
import { Dt as shell, Ft as listFiles, G as EMPTY_EXTENSION_REGISTRY, Lt as grep, Rt as glob, Tt as shellKill, Vt as resolveStorageDirs, Zt as mergeKeybindings, bt as createSpawnTool, en as readKeybindingsRaw, ft as composePresets, g as migrateSessionArtifactDirs, gt as writeFile$1, jt as multiEdit, kt as readFile$1, pt as definePreset, rt as buildExtensionPreset, tn as resolveExtensionKeybindings, vt as waitTask, zt as edit } from "./agent-
|
|
2
|
+
import { Dt as shell, Ft as listFiles, G as EMPTY_EXTENSION_REGISTRY, Lt as grep, Rt as glob, Tt as shellKill, Vt as resolveStorageDirs, Zt as mergeKeybindings, bt as createSpawnTool, en as readKeybindingsRaw, ft as composePresets, g as migrateSessionArtifactDirs, gt as writeFile$1, jt as multiEdit, kt as readFile$1, pt as definePreset, rt as buildExtensionPreset, tn as resolveExtensionKeybindings, vt as waitTask, zt as edit } from "./agent-8sUadp5M.js";
|
|
3
3
|
import { a as formatDuration, c as previewLine, i as fmtTokens, l as shortId } from "./format-BF745pLL.js";
|
|
4
4
|
import { u as errorMessage } from "./errors-BwBxu3zD.js";
|
|
5
5
|
import { M as findGitRoot$1, i as discoverSkills, j as projectUserPaths } from "./resolve-CZJxds85.js";
|
|
6
6
|
import { t as writeFileAtomic } from "./atomic-write-B7zr1ddF.js";
|
|
7
|
-
import { l as normalizeMcpServers, n as connectMcpServers } from "./mcp-
|
|
7
|
+
import { l as normalizeMcpServers, n as connectMcpServers } from "./mcp-3GXUBwur.js";
|
|
8
8
|
import { joinSystemPrompt } from "./prompt.js";
|
|
9
9
|
import { r as formatTokenUsage } from "./stats-DAKBEKjc.js";
|
|
10
10
|
import { i as findActiveTriggers, n as collectReferences, o as mergeSuggestions, t as applyInsert } from "./completion-core-BRo86R_L.js";
|
|
@@ -10276,4 +10276,4 @@ function computeTurnAnchors(items) {
|
|
|
10276
10276
|
//#endregion
|
|
10277
10277
|
export { reduceMcpAuth as $, IDENTITY_PREFIX as $n, toggleChainEntry as $t, redirectUriFromAuthUrl as A, DEFAULT_BUDGET_EXCLUDE_TOOLS as An, resolveTheme as At, buildToolToggle as B, TODO_WRITE_COUNTS_METADATA_KEY as Bn, useDiscovery as Bt, projectsFilePath as C, resolvePlatformPackage as Cn, sumRunCosts as Cr, SETTINGS_TOGGLES as Ct, formatPathForCwd as D, BUILD_AGENT as Dn, updateToolEventOutcomes as Dr, BUILTIN_THEMES as Dt, writeProjects as E, renderAgentsMdBlock as En, toolResultText as Er, useSettings as Et, loadMcpToolsCache as F, singleAgentRegistry as Fn, CATPPUCCIN_LATTE as Ft, parentServerName as G, pickActiveRunId as Gn, resolveStoragePaths as Gt, useMcpToolToggleSet as H, getArchivedTodosForRun as Hn, ConfigProvider as Ht, mcpToolsCachePath as I, TODOREAD_TOOL as In, CATPPUCCIN_MACCHIATO as It, patchMcpCredential as J, setTodosForRun as Jn, chainsEqual as Jt, createFileMcpCredentialStore as K, pruneTodosByRun as Kn, buildRunModel as Kt, refreshMcpToolsCatalog as L, TODOS_METADATA_KEY as Ln, CATPPUCCIN_MOCHA as Lt, runOAuthLogin as M, PLAN_AGENT as Mn, GRUVBOX_DARK as Mt, supportsOAuth as N, accentColor as Nn, GRUVBOX_LIGHT as Nt, fetchOAuthRedirect as O, BUILTIN_AGENTS as On, usageByModel as Or, DEFAULT_THEME as Ot, clearMcpToolsCache as P, resolveAgentId as Pn, CATPPUCCIN_FRAPPE as Pt, getMcpAuthStatus as Q, DOING_TASKS_DOCTRINE as Qn, sanitizeModelChain as Qt, saveMcpToolsCache as R, TODOWRITE_TOOL as Rn, createDiscoverySlot as Rt, matchesSafelistEntry as S, performSelfUpdate as Sn, stripSpawnTokensLine as Sr, SETTINGS_INPUTS as St, suggestSafelistEntries as T, discoverAgentsMd as Tn, toolCallPreview as Tr, clampFps as Tt, buildVisibleMcpRows as U, getTodosForRun as Un, useConfig as Ut, useMcpToolToggleMap as V, createTodoTools as Vn, useDiscoveryOptional as Vt, indexOfServerRow as W, isTodoTool as Wn, resolveConfig as Wt, useMcpAuthDispatch as X, ACTIONS_WITH_CARE_DOCTRINE as Xn, providerKeySetChanged as Xt, McpAuthProvider as Y, useActiveTodos as Yn, filterChainFallbacks as Yt, useMcpAuthState as Z, COMMUNICATION_DOCTRINE as Zn, restoreChainFallbacks as Zt, useSafeModeQueue as _, compareSemver as _n, listSessionMeta as _r, listProjectFiles as _t, useSurfaces as a, removeMcpServer as an, TOKEN_DISCIPLINE_DOCTRINE as ar, isInteractionTool as at, getSafelist as b, parseSemver as bn, saveState as br, SETTINGS_CATEGORIES as bt, useStreamBuffer as c, defaultMcpsConfigPaths as cn, envSection as cr, serializeInteractionResponse as ct, discoverProjectSkills as d, tryOpenBrowser as dn, DEFAULT_SESSION_TITLE as dr, EMPTY_HINTS as dt, useCompletion as en, INTERACTION_GUIDANCE as er, ASK_USER_TOOL as et, renderSession as f, bootProfileEnabled as fn, compactSummaryEvent as fr, clipHintsToWidth as ft, useSafeModeActions as g, checkForUpdate as gn, lastContextSizeFromTurns as gr, shortChord as gt, SafeModeProvider as h, useUpdateCheck as hn, eventsFromTurns as hr, buildHints as ht, useSelectStyle as i, mcpsWritePath as in, SUBAGENT_GUIDANCE as ir, createInteractionTools as it, oauthUsesManualCodePaste as j, DEFAULT_PERSIST_EXCLUDE_TOOLS as jn, VAPORWAVE_THEME as jt, normalizeRedirectPaste as k, DEFAULT_AGENT_ID as kn, __exportAll as kr, resolveChipColor as kt, buildSkillsConfig as l, discoverProjectMcps as ln, chatReferenceTokensForPrompt as lr, useInteractionsActions as lt, writeSessionExport as m, buildUpdateHint as mn, deriveSessionTitle as mr, truncateTrailing as mt, ThemeProvider as n, hasClaudeCodeSetup as nn, PLAN_MODE_DOCTRINE as nr, PRESENT_PLAN_TOOL as nt, useSyntaxStyles as o, upsertMcpServer as on, buildBuildSystem as or, makeRequestInteraction as ot, resolveSessionExportTarget as p, bootTick as pn, createStateStore as pr, hintsLength as pt, mcpCredentialsPath as q, selectActiveTodos as qn, chainPositionOf as qt, useColors as r, importFromClaudeCode as rn, PLAN_MODE_DOCTRINE_NO_PROMPTS as rr, buildResumedToolResultsTurn as rt, useTheme as s, buildMcpServers as sn, buildPlanSystem as sr, pendingInteractionsFromTurns as st, computeTurnAnchors as t, countClaudeSessionFiles as tn, INTERACTION_GUIDANCE_NO_PROMPTS as tr, InteractionsProvider as tt, defaultSkillScanPaths as u, parseMcpsFile as un, createChatTurnsReadTool as ur, useInteractionsQueue as ut, IMPLICITLY_SAFE_TOOLS as v, detectLibc as vn, loadState as vr, useEnabledToggleSet as vt, readProjects as w, chatAutoCompactBehavior as wn, titleFromTurns as wr, SettingsProvider as wt, isOnSafelist as x, performInPlaceSelfUpdate as xn, serverToolResultSummary as xr, SETTINGS_CHOICES as xt, addToSafelist as y, detectPackageManager as yn, marginTopFor as yr, DEFAULT_SETTINGS as yt, subscribeMcpToolsCache as z, TODO_STATUS_GLYPHS as zn, DiscoveryProvider as zt };
|
|
10278
10278
|
|
|
10279
|
-
//# sourceMappingURL=transcript-anchors-
|
|
10279
|
+
//# sourceMappingURL=transcript-anchors-CgDzYin1.js.map
|