zidane 6.3.4 → 6.3.6
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-IgXPptYr.js → acp-Xkhrpx8r.js} +4 -4
- package/dist/{acp-IgXPptYr.js.map → acp-Xkhrpx8r.js.map} +1 -1
- package/dist/acp-cli.js +6 -6
- package/dist/acp.d.ts +2 -2
- package/dist/acp.js +1 -1
- package/dist/{agent-BJuiohV_.js → agent-xjMzFclr.js} +236 -23
- package/dist/{agent-BJuiohV_.js.map → agent-xjMzFclr.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +1 -1
- package/dist/{anthropic-Drd3842n.js → anthropic-BN0iPMox.js} +20 -5
- package/dist/anthropic-BN0iPMox.js.map +1 -0
- package/dist/{auth-WkdClN2Y.js → auth-Dptb8U5J.js} +10 -5
- package/dist/auth-Dptb8U5J.js.map +1 -0
- package/dist/chat/pure.d.ts +3 -3
- package/dist/chat.d.ts +4 -4
- package/dist/chat.d.ts.map +1 -1
- package/dist/chat.js +3 -3
- package/dist/{context-transport-DAjjzK_x.js → context-transport-O-oQHwhP.js} +3 -3
- package/dist/{context-transport-DAjjzK_x.js.map → context-transport-O-oQHwhP.js.map} +1 -1
- package/dist/contexts/daytona.d.ts +3 -3
- package/dist/contexts/docker.d.ts +1 -1
- package/dist/contexts/e2b.d.ts +2 -2
- package/dist/contexts/sandbox.d.ts +1 -1
- package/dist/contexts-DWVt7MvF.js.map +1 -1
- package/dist/contexts.d.ts +3 -3
- package/dist/eval.d.ts +1 -1
- package/dist/eval.js +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 +3 -3
- package/dist/{index-B9jSo84a.d.ts → index-C8TwH34B.d.ts} +2 -2
- package/dist/index-C8TwH34B.d.ts.map +1 -0
- package/dist/{index-D-DPqXxU.d.ts → index-DTIe4e1R.d.ts} +268 -10
- package/dist/index-DTIe4e1R.d.ts.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +9 -9
- package/dist/{login-ClSY8pN6.js → login-DZHMF7Gl.js} +2 -2
- package/dist/{login-ClSY8pN6.js.map → login-DZHMF7Gl.js.map} +1 -1
- package/dist/{mcp-UIBc81Zm.js → mcp-B5iXOceC.js} +3 -3
- package/dist/{mcp-UIBc81Zm.js.map → mcp-B5iXOceC.js.map} +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +1 -1
- package/dist/{messages-B-Zt-_Oz.js → messages-DoHRwMw-.js} +2 -2
- package/dist/{messages-B-Zt-_Oz.js.map → messages-DoHRwMw-.js.map} +1 -1
- package/dist/{openai-compat-BF1pSB_F.js → openai-compat-Bf9uMTMa.js} +60 -3
- package/dist/openai-compat-Bf9uMTMa.js.map +1 -0
- 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/anthropic.js +1 -1
- package/dist/providers/arcee.d.ts +1 -1
- package/dist/providers/arcee.js +1 -1
- package/dist/providers/baseten.d.ts +1 -1
- package/dist/providers/baseten.js +4 -2
- package/dist/providers/baseten.js.map +1 -1
- package/dist/providers/cerebras.d.ts +1 -1
- package/dist/providers/cerebras.js +1 -1
- package/dist/providers/local.d.ts +1 -1
- package/dist/providers/local.js +1 -1
- package/dist/providers/openai-compat.d.ts +1 -1
- package/dist/providers/openai-compat.js +1 -1
- package/dist/providers/openai.d.ts +1 -1
- package/dist/providers/openai.js +2 -2
- package/dist/providers/openrouter.d.ts +1 -1
- package/dist/providers/openrouter.js +3 -1
- package/dist/providers/openrouter.js.map +1 -1
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers/xai.js +1 -1
- package/dist/{providers-C-lh3sVD.js → providers-BlaXBUwd.js} +3 -3
- package/dist/{providers-C-lh3sVD.js.map → providers-BlaXBUwd.js.map} +1 -1
- package/dist/providers.d.ts +2 -2
- package/dist/providers.js +5 -5
- package/dist/restate.d.ts +2 -2
- package/dist/{sandbox-DqwpKX18.d.ts → sandbox-DLY6uah7.d.ts} +2 -2
- package/dist/{sandbox-DqwpKX18.d.ts.map → sandbox-DLY6uah7.d.ts.map} +1 -1
- package/dist/session/sqlite.d.ts +1 -1
- package/dist/{session-BE9_p0sN.js → session-Bdk31kA5.js} +2 -2
- package/dist/{session-BE9_p0sN.js.map → session-Bdk31kA5.js.map} +1 -1
- package/dist/session.d.ts +1 -1
- package/dist/session.js +2 -2
- package/dist/skills.d.ts +1 -1
- package/dist/{stdio-e45MhlYy.js → stdio-BsB0QEE9.js} +2 -2
- package/dist/{stdio-e45MhlYy.js.map → stdio-BsB0QEE9.js.map} +1 -1
- package/dist/{stdio-loader-Bkrs9e8t.js → stdio-loader-p7qCIzPS.js} +2 -2
- package/dist/{stdio-loader-Bkrs9e8t.js.map → stdio-loader-p7qCIzPS.js.map} +1 -1
- package/dist/{tool-formatters-BX9TaWAr.d.ts → tool-formatters-B_dGfYqT.d.ts} +2 -2
- package/dist/{tool-formatters-BX9TaWAr.d.ts.map → tool-formatters-B_dGfYqT.d.ts.map} +1 -1
- 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 +1 -1
- package/dist/{transcript-anchors-9LKsM0OZ.js → transcript-anchors-Bsmm4435.js} +68 -28
- package/dist/transcript-anchors-Bsmm4435.js.map +1 -0
- package/dist/{transcript-anchors-BpCQElT6.d.ts → transcript-anchors-CqxIlrhv.d.ts} +15 -6
- package/dist/transcript-anchors-CqxIlrhv.d.ts.map +1 -0
- package/dist/tui.d.ts +22 -6
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +214 -211
- package/dist/tui.js.map +1 -1
- package/dist/{turn-operations-C_bn9UmE.d.ts → turn-operations-D7JhuW_X.d.ts} +3 -3
- package/dist/{turn-operations-C_bn9UmE.d.ts.map → turn-operations-D7JhuW_X.d.ts.map} +1 -1
- package/dist/types-BIarq1qE.js.map +1 -1
- package/dist/{types-DdZMQxfT.d.ts → types-M2DauK2D.d.ts} +2 -2
- package/dist/{types-DdZMQxfT.d.ts.map → types-M2DauK2D.d.ts.map} +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/{xai-CLqZQdcj.js → xai-BI4KgCGS.js} +2 -2
- package/dist/{xai-CLqZQdcj.js.map → xai-BI4KgCGS.js.map} +1 -1
- package/docs/ARCHITECTURE.md +29 -1
- package/docs/CHAT.md +1 -1
- package/docs/RUN_IN_BACKGROUND.md +2 -2
- package/docs/SKILL.md +1 -1
- package/docs/TUI.md +1 -1
- package/package.json +1 -1
- package/dist/anthropic-Drd3842n.js.map +0 -1
- package/dist/auth-WkdClN2Y.js.map +0 -1
- package/dist/index-B9jSo84a.d.ts.map +0 -1
- package/dist/index-D-DPqXxU.d.ts.map +0 -1
- package/dist/openai-compat-BF1pSB_F.js.map +0 -1
- package/dist/transcript-anchors-9LKsM0OZ.js.map +0 -1
- package/dist/transcript-anchors-BpCQElT6.d.ts.map +0 -1
package/dist/acp-cli.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { Vt as resolveStorageDirs, ht as basic_default } from "./agent-xjMzFclr.js";
|
|
3
3
|
import { r as createProcessContext } from "./contexts-DWVt7MvF.js";
|
|
4
4
|
import { createSandboxContext } from "./contexts/sandbox.js";
|
|
5
|
-
import { m as openaiCompat } from "./openai-compat-
|
|
6
|
-
import { n as anthropic } from "./anthropic-
|
|
5
|
+
import { m as openaiCompat } from "./openai-compat-Bf9uMTMa.js";
|
|
6
|
+
import { n as anthropic } from "./anthropic-BN0iPMox.js";
|
|
7
7
|
import { arcee } from "./providers/arcee.js";
|
|
8
8
|
import { baseten } from "./providers/baseten.js";
|
|
9
9
|
import { cerebras } from "./providers/cerebras.js";
|
|
10
|
-
import { t as xai } from "./xai-
|
|
10
|
+
import { t as xai } from "./xai-BI4KgCGS.js";
|
|
11
11
|
import { openai } from "./providers/openai.js";
|
|
12
12
|
import { openrouter } from "./providers/openrouter.js";
|
|
13
|
-
import { d as StartUsageError, f as buildStartLocalOptions, h as startProviderNames, i as withAcpDefaultTools, m as startLocalArgOptions, p as parseStartArgValues, t as runAcpStdioServer } from "./acp-
|
|
14
|
-
import { f as credKeyOf, i as readCredentials, l as BUILTIN_PROVIDERS, r as credentialsPath, t as detectAuth, y as modelsForDescriptor } from "./auth-
|
|
13
|
+
import { d as StartUsageError, f as buildStartLocalOptions, h as startProviderNames, i as withAcpDefaultTools, m as startLocalArgOptions, p as parseStartArgValues, t as runAcpStdioServer } from "./acp-Xkhrpx8r.js";
|
|
14
|
+
import { f as credKeyOf, i as readCredentials, l as BUILTIN_PROVIDERS, r as credentialsPath, t as detectAuth, y as modelsForDescriptor } from "./auth-Dptb8U5J.js";
|
|
15
15
|
import { createDaytonaProvider } from "./contexts/daytona.js";
|
|
16
16
|
import { createDockerContext } from "./contexts/docker.js";
|
|
17
17
|
import { createE2BProvider } from "./contexts/e2b.js";
|
package/dist/acp.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as ExecutionContext } from "./types-
|
|
2
|
-
import {
|
|
1
|
+
import { c as ExecutionContext } from "./types-M2DauK2D.js";
|
|
2
|
+
import { Km as ToolDef, Mm as ToolResultContent, Pp as AgentBehavior, Vm as TurnUsage, Wi as Agent, Zp as McpServerConfig, _m as SessionContentBlock, cm as PromptPart, dh as Session, hh as SessionStore, qi as AgentOptions, rf as Provider, t as Preset } from "./index-DTIe4e1R.js";
|
|
3
3
|
import { Readable, Writable } from "node:stream";
|
|
4
4
|
|
|
5
5
|
//#region src/acp/types.d.ts
|
package/dist/acp.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as createJsonRpcConnection, a as wrapToolsForAcpClient, c as sessionBlocksToAcp, g as JsonRpcRemoteError, i as withAcpDefaultTools, l as stopReasonFromRun, n as AcpProtocolError, o as acpMcpServersToZidane, r as createAcpServer, s as acpPromptToPromptParts, t as runAcpStdioServer, u as toolResultToAcpContent } from "./acp-
|
|
1
|
+
import { _ as createJsonRpcConnection, a as wrapToolsForAcpClient, c as sessionBlocksToAcp, g as JsonRpcRemoteError, i as withAcpDefaultTools, l as stopReasonFromRun, n as AcpProtocolError, o as acpMcpServersToZidane, r as createAcpServer, s as acpPromptToPromptParts, t as runAcpStdioServer, u as toolResultToAcpContent } from "./acp-Xkhrpx8r.js";
|
|
2
2
|
export { AcpProtocolError, JsonRpcRemoteError, acpMcpServersToZidane, acpPromptToPromptParts, createAcpServer, createJsonRpcConnection, runAcpStdioServer, sessionBlocksToAcp, stopReasonFromRun, toolResultToAcpContent, withAcpDefaultTools, wrapToolsForAcpClient };
|
|
@@ -14,18 +14,18 @@ import { C as stripShellInterpolations, O as validateResourcePathReal, S as inte
|
|
|
14
14
|
import { n as writeFileAtomicAsync, t as writeFileAtomic } from "./atomic-write-B7zr1ddF.js";
|
|
15
15
|
import { r as createLogger, t as consoleSink } from "./logger-DBX9uYOw.js";
|
|
16
16
|
import { n as reconcileImageMediaType } from "./media-sniff-UKijEaiQ.js";
|
|
17
|
-
import { d as wrapDiscoveredMcpTools, i as deriveMcpToolMeta, n as connectMcpServers, s as nonOwningMcpView } from "./mcp-
|
|
18
|
-
import {
|
|
17
|
+
import { d as wrapDiscoveredMcpTools, i as deriveMcpToolMeta, n as connectMcpServers, s as nonOwningMcpView } from "./mcp-B5iXOceC.js";
|
|
18
|
+
import { E as canonicalizePrompt, T as buildPromptMessage } from "./openai-compat-Bf9uMTMa.js";
|
|
19
19
|
import { appendStaticSection, renderSystemForWire } from "./prompt.js";
|
|
20
|
-
import { a as detectTurnInterruption, c as ensureToolResultPairing, l as filterUnresolvedToolUses, m as resolveContentRefsInMessages, n as SYNTHETIC_TOOL_RESULT_PLACEHOLDER, p as remintDuplicateToolCallIds, s as ensureEndsWithUserMessage } from "./messages-
|
|
21
|
-
import { a as getExtensionSessionState, c as setExtensionSessionState, l as withExtensionSession, n as currentExtensionSession, r as deleteExtensionSessionState, s as resumeChainRunIds } from "./session-
|
|
20
|
+
import { a as detectTurnInterruption, c as ensureToolResultPairing, l as filterUnresolvedToolUses, m as resolveContentRefsInMessages, n as SYNTHETIC_TOOL_RESULT_PLACEHOLDER, p as remintDuplicateToolCallIds, s as ensureEndsWithUserMessage } from "./messages-DoHRwMw-.js";
|
|
21
|
+
import { a as getExtensionSessionState, c as setExtensionSessionState, l as withExtensionSession, n as currentExtensionSession, r as deleteExtensionSessionState, s as resumeChainRunIds } from "./session-Bdk31kA5.js";
|
|
22
22
|
import { n as flattenTurns, r as formatTokenUsage, t as effectiveInputFromTurn } from "./stats-DAKBEKjc.js";
|
|
23
23
|
import { a as withInactivityTimeout, i as settleWithinTimeout, n as linkAbortSignal, o as withTimeout$1, r as resolveTimeoutMs, t as OperationTimeoutError } from "./timeout-BDetbuN6.js";
|
|
24
24
|
import { createRequire } from "node:module";
|
|
25
25
|
import { basename, delimiter, dirname, isAbsolute, join, resolve, sep } from "node:path";
|
|
26
26
|
import { createHooks } from "hookable";
|
|
27
27
|
import { Buffer } from "node:buffer";
|
|
28
|
-
import { cpSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
28
|
+
import { cpSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, rmdirSync, statSync, writeFileSync } from "node:fs";
|
|
29
29
|
import { copyFile, mkdir, readdir, rm, stat, unlink } from "node:fs/promises";
|
|
30
30
|
import { pathToFileURL } from "node:url";
|
|
31
31
|
import { homedir, tmpdir } from "node:os";
|
|
@@ -9200,42 +9200,255 @@ const PERSISTED_STUB_PREFIX = "<persisted-output tool=\"";
|
|
|
9200
9200
|
*/
|
|
9201
9201
|
const SAFE_CALL_ID = /^[\w.-]+$/;
|
|
9202
9202
|
/**
|
|
9203
|
-
*
|
|
9203
|
+
* Root holding every per-session artifact directory: `<userDir>/sessions/`.
|
|
9204
|
+
*
|
|
9205
|
+
* Session-first, not kind-first. The layout exists to make session DELETE a
|
|
9206
|
+
* single recursive remove: every artifact a session owns is one subtree, so
|
|
9207
|
+
* adding a fourth artifact kind later needs no change to the delete path. The
|
|
9208
|
+
* alternative (a `<kind>/<sessionId>/` root per kind) forces the delete path to
|
|
9209
|
+
* enumerate kinds, and a kind missing from that list leaks silently — which is
|
|
9210
|
+
* exactly the bug this layout is designed out of.
|
|
9211
|
+
*
|
|
9212
|
+
* Sits beside `sessions.db` rather than colliding with it: that's a file, this
|
|
9213
|
+
* is a directory.
|
|
9214
|
+
*/
|
|
9215
|
+
const SESSIONS_ROOT = "sessions";
|
|
9216
|
+
/** Per-session artifact subdirectories under `<userDir>/sessions/<sessionId>/`. */
|
|
9217
|
+
const SESSION_ARTIFACT_KINDS = [
|
|
9218
|
+
"tasks",
|
|
9219
|
+
"mcp-warnings",
|
|
9220
|
+
"tool-results"
|
|
9221
|
+
];
|
|
9222
|
+
/**
|
|
9223
|
+
* Resolve the root of a session's artifact subtree
|
|
9224
|
+
* (`<userDir>/sessions/<sessionId>/`).
|
|
9225
|
+
*
|
|
9226
|
+
* This is what session delete removes: one recursive remove reclaims every
|
|
9227
|
+
* artifact kind at once, so adding a kind never touches the delete path.
|
|
9228
|
+
*/
|
|
9229
|
+
function resolveSessionDir(opts) {
|
|
9230
|
+
if (!isAbsolute(opts.userDir)) throw new Error(`resolveSessionDir: userDir must be absolute, got "${opts.userDir}"`);
|
|
9231
|
+
if (!opts.sessionId) throw new Error("resolveSessionDir: sessionId must be a non-empty string");
|
|
9232
|
+
return join(opts.userDir, SESSIONS_ROOT, opts.sessionId);
|
|
9233
|
+
}
|
|
9234
|
+
/**
|
|
9235
|
+
* Resolve the per-session persistence directory under
|
|
9236
|
+
* `<userDir>/sessions/<sessionId>/tool-results/`.
|
|
9204
9237
|
*
|
|
9205
9238
|
* The chat layer calls this at session activation and forwards the result
|
|
9206
9239
|
* via `behavior.persistDir`. Exposed as a public helper so SDK consumers
|
|
9207
9240
|
* pick the same layout — single source of truth for "where do blobs live".
|
|
9241
|
+
*
|
|
9242
|
+
* NOTE for anyone tempted to migrate old blobs into this path: don't. A
|
|
9243
|
+
* persisted stub embeds the blob's ABSOLUTE path in the session transcript
|
|
9244
|
+
* (see the `path="…"` attribute built in {@link buildPersistedStub}) and the
|
|
9245
|
+
* MODEL re-reads it by calling `read_file` on that path. Moving the bytes
|
|
9246
|
+
* without rewriting every transcript strands them mid-conversation. Blobs
|
|
9247
|
+
* written under the old `<userDir>/tool-results/<sessionId>/` therefore stay
|
|
9248
|
+
* put and keep resolving forever; only new writes land here, and session
|
|
9249
|
+
* delete sweeps both (see {@link resolveLegacyPersistDir}).
|
|
9208
9250
|
*/
|
|
9209
9251
|
function resolvePersistDir(opts) {
|
|
9210
|
-
|
|
9211
|
-
if (!opts.sessionId) throw new Error("resolvePersistDir: sessionId must be a non-empty string");
|
|
9212
|
-
return join(opts.userDir, "tool-results", opts.sessionId);
|
|
9252
|
+
return resolveSessionArtifactDir("resolvePersistDir", opts, "tool-results");
|
|
9213
9253
|
}
|
|
9214
9254
|
/**
|
|
9215
9255
|
* Resolve the per-session background-tasks directory under
|
|
9216
|
-
* `<userDir
|
|
9256
|
+
* `<userDir>/sessions/<sessionId>/tasks/`.
|
|
9217
9257
|
*
|
|
9218
|
-
* The chat layer calls this at session activation and forwards the result
|
|
9219
|
-
*
|
|
9220
|
-
*
|
|
9221
|
-
*
|
|
9258
|
+
* The chat layer calls this at session activation and forwards the result via
|
|
9259
|
+
* `behavior.tasksDir`. Created on first write; cleanup is the session-delete
|
|
9260
|
+
* path's job — and since it lives inside the session's own subtree, that
|
|
9261
|
+
* cleanup is the same recursive remove that takes everything else.
|
|
9222
9262
|
*/
|
|
9223
9263
|
function resolveTasksDir(opts) {
|
|
9224
|
-
|
|
9225
|
-
if (!opts.sessionId) throw new Error("resolveTasksDir: sessionId must be a non-empty string");
|
|
9226
|
-
return join(opts.userDir, opts.sessionId, "tasks");
|
|
9264
|
+
return resolveSessionArtifactDir("resolveTasksDir", opts, "tasks");
|
|
9227
9265
|
}
|
|
9228
9266
|
/**
|
|
9229
9267
|
* Resolve the per-session MCP diagnostic directory under
|
|
9230
|
-
* `<userDir
|
|
9268
|
+
* `<userDir>/sessions/<sessionId>/mcp-warnings/`.
|
|
9231
9269
|
*
|
|
9232
9270
|
* Warning logs are cache/session artifacts like background task logs:
|
|
9233
9271
|
* useful for debugging, safe to delete, and cleaned up with the session.
|
|
9234
9272
|
*/
|
|
9235
9273
|
function resolveMcpWarningsDir(opts) {
|
|
9236
|
-
|
|
9237
|
-
|
|
9238
|
-
|
|
9274
|
+
return resolveSessionArtifactDir("resolveMcpWarningsDir", opts, "mcp-warnings");
|
|
9275
|
+
}
|
|
9276
|
+
/**
|
|
9277
|
+
* Shared body of the three resolvers above. Takes the caller's name so a
|
|
9278
|
+
* misuse still reports the function the host actually called.
|
|
9279
|
+
*/
|
|
9280
|
+
function resolveSessionArtifactDir(fn, opts, kind) {
|
|
9281
|
+
if (!isAbsolute(opts.userDir)) throw new Error(`${fn}: userDir must be absolute, got "${opts.userDir}"`);
|
|
9282
|
+
if (!opts.sessionId) throw new Error(`${fn}: sessionId must be a non-empty string`);
|
|
9283
|
+
return join(opts.userDir, SESSIONS_ROOT, opts.sessionId, kind);
|
|
9284
|
+
}
|
|
9285
|
+
/**
|
|
9286
|
+
* Top-level directory names that are roots or shared state, never a session id.
|
|
9287
|
+
* `tool-results` and the kind-first `tasks` / `mcp-warnings` roots are listed
|
|
9288
|
+
* because both are migration SOURCES that must never be mistaken for a session
|
|
9289
|
+
* shell and relocated into themselves.
|
|
9290
|
+
*/
|
|
9291
|
+
const ARTIFACT_ROOTS = /* @__PURE__ */ new Set([...SESSION_ARTIFACT_KINDS, SESSIONS_ROOT]);
|
|
9292
|
+
/**
|
|
9293
|
+
* The two session-id shapes zidane stores have ever minted:
|
|
9294
|
+
* `ses_<base36-ts>_<base36-rand>` (src/session `generateId`) and canonical
|
|
9295
|
+
* UUIDs (ACP hosts). {@link migrateSessionArtifactDirs} matches POSITIVELY on
|
|
9296
|
+
* these instead of sweeping every top-level directory, because the storage
|
|
9297
|
+
* dir also holds `skills/`, `extensions/`, `daemon/`, `sessions/`, … — and a
|
|
9298
|
+
* skill or extension named `tasks` would otherwise look exactly like a
|
|
9299
|
+
* legacy session shell and get silently relocated. Mis-matching in the
|
|
9300
|
+
* other direction is harmless: an exotic host-minted id that fits neither
|
|
9301
|
+
* shape just stays where it is.
|
|
9302
|
+
*/
|
|
9303
|
+
const LEGACY_SESSION_ID = /^(?:ses_[a-z0-9]+_[a-z0-9]+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i;
|
|
9304
|
+
/**
|
|
9305
|
+
* Path of the pre-6.x per-session artifact shell (`<userDir>/<sessionId>/`), or
|
|
9306
|
+
* `undefined` when the id doesn't match a shape zidane ever minted.
|
|
9307
|
+
*
|
|
9308
|
+
* Session delete sweeps this alongside the session subtree: when
|
|
9309
|
+
* {@link migrateSessionArtifactDirs} hits its conflict branch (the target
|
|
9310
|
+
* already existed), the shell is deliberately left in place and counted as
|
|
9311
|
+
* `failed` — and nothing else ever removes it, so deleting the session is the
|
|
9312
|
+
* one moment both copies are provably garbage. The positive id match is what
|
|
9313
|
+
* keeps an exotic host-minted id from resolving to a root like `tasks/`.
|
|
9314
|
+
*/
|
|
9315
|
+
function resolveLegacySessionDir(opts) {
|
|
9316
|
+
if (!isAbsolute(opts.userDir)) throw new Error(`resolveLegacySessionDir: userDir must be absolute, got "${opts.userDir}"`);
|
|
9317
|
+
return LEGACY_SESSION_ID.test(opts.sessionId) ? join(opts.userDir, opts.sessionId) : void 0;
|
|
9318
|
+
}
|
|
9319
|
+
/**
|
|
9320
|
+
* Path of the pre-session-first blob directory (`<userDir>/tool-results/<sessionId>/`),
|
|
9321
|
+
* or `undefined` when the id doesn't match a shape zidane ever minted.
|
|
9322
|
+
*
|
|
9323
|
+
* These blobs are deliberately NOT migrated — a persisted stub carries the
|
|
9324
|
+
* blob's absolute path inside the session transcript and the model re-reads it
|
|
9325
|
+
* with `read_file`, so moving the bytes without rewriting every transcript
|
|
9326
|
+
* strands them (see {@link resolvePersistDir}). They keep resolving where they
|
|
9327
|
+
* are; this resolver exists so session delete still reclaims them. Same
|
|
9328
|
+
* positive id match, same reason.
|
|
9329
|
+
*/
|
|
9330
|
+
function resolveLegacyPersistDir(opts) {
|
|
9331
|
+
if (!isAbsolute(opts.userDir)) throw new Error(`resolveLegacyPersistDir: userDir must be absolute, got "${opts.userDir}"`);
|
|
9332
|
+
return LEGACY_SESSION_ID.test(opts.sessionId) ? join(opts.userDir, "tool-results", opts.sessionId) : void 0;
|
|
9333
|
+
}
|
|
9334
|
+
/**
|
|
9335
|
+
* Fold older artifact layouts into the session-first one
|
|
9336
|
+
* (`<userDir>/sessions/<sessionId>/<kind>/`).
|
|
9337
|
+
*
|
|
9338
|
+
* Two source layouts are folded in:
|
|
9339
|
+
*
|
|
9340
|
+
* 1. pre-6.x `<userDir>/<sessionId>/{tasks,mcp-warnings}/` — one top-level
|
|
9341
|
+
* entry per session, so a few hundred sessions bury `credentials.json`
|
|
9342
|
+
* under noise. This is what is actually on users' disks.
|
|
9343
|
+
* 2. kind-first `<userDir>/{tasks,mcp-warnings}/<sessionId>/` — a shape that
|
|
9344
|
+
* only ever existed in dev builds between the two designs. Handled so a
|
|
9345
|
+
* contributor who ran one doesn't end up with artifacts in three places.
|
|
9346
|
+
*
|
|
9347
|
+
* `tool-results/<sessionId>/` is deliberately NOT a source: those blobs are
|
|
9348
|
+
* referenced by absolute path from inside session transcripts and re-read by
|
|
9349
|
+
* the model, so relocating them without rewriting every transcript would
|
|
9350
|
+
* strand them. See {@link resolvePersistDir} and {@link resolveLegacyPersistDir}.
|
|
9351
|
+
*
|
|
9352
|
+
* Sync + best-effort by design. It runs on the chat bootstrap path, so it
|
|
9353
|
+
* must not make startup fail on a read-only or half-permissioned storage
|
|
9354
|
+
* dir; every filesystem call is individually guarded and failures are
|
|
9355
|
+
* counted, not thrown. `renameSync` within one directory tree can't hit
|
|
9356
|
+
* EXDEV, so the moves are atomic metadata updates, not copies.
|
|
9357
|
+
*
|
|
9358
|
+
* Idempotent and cheap to re-run: one `readdirSync` of the user dir, plus one
|
|
9359
|
+
* of each kind-first root that still exists. A migrated tree has no sources
|
|
9360
|
+
* left to match, so there's no "migration done" marker to keep in sync — the
|
|
9361
|
+
* filesystem shape IS the marker.
|
|
9362
|
+
*
|
|
9363
|
+
* Conflicts are left alone: if the destination already exists, the source
|
|
9364
|
+
* stays put and counts as `failed` rather than having its contents merged or
|
|
9365
|
+
* clobbered. Nothing is ever deleted except an emptied source shell
|
|
9366
|
+
* (`rmdirSync`, which refuses non-empty dirs), so an unexpected layout
|
|
9367
|
+
* survives for the operator to inspect.
|
|
9368
|
+
*
|
|
9369
|
+
* Note that a pending conflict is re-counted on EVERY sweep: nothing but
|
|
9370
|
+
* session-delete can resolve it (both copies are live data), so each boot
|
|
9371
|
+
* legitimately re-observes it and reports `failed: 1`. The effects stay
|
|
9372
|
+
* idempotent — nothing moves, nothing is removed — only the counter repeats.
|
|
9373
|
+
*
|
|
9374
|
+
* Known mixed-version race, accepted: a still-running pre-migration process
|
|
9375
|
+
* holds its tasksDir at the old path and this sweep renames it away. Open
|
|
9376
|
+
* write streams keep working (the inode moves with the rename), but log paths
|
|
9377
|
+
* already quoted in that session's turns go stale, and the old process's
|
|
9378
|
+
* defensive mkdir may recreate the source dir — which the next boot
|
|
9379
|
+
* re-migrates. Task logs are ephemeral debug output, so a liveness heuristic
|
|
9380
|
+
* isn't worth the complexity.
|
|
9381
|
+
*/
|
|
9382
|
+
function migrateSessionArtifactDirs(opts) {
|
|
9383
|
+
if (!isAbsolute(opts.userDir)) throw new Error(`migrateSessionArtifactDirs: userDir must be absolute, got "${opts.userDir}"`);
|
|
9384
|
+
const result = {
|
|
9385
|
+
moved: 0,
|
|
9386
|
+
removed: 0,
|
|
9387
|
+
failed: 0
|
|
9388
|
+
};
|
|
9389
|
+
let entries;
|
|
9390
|
+
try {
|
|
9391
|
+
entries = readdirSync(opts.userDir, { withFileTypes: true });
|
|
9392
|
+
} catch {
|
|
9393
|
+
return result;
|
|
9394
|
+
}
|
|
9395
|
+
/** Move one artifact dir into the session subtree. Never clobbers. */
|
|
9396
|
+
const relocate = (from, sessionId, kind) => {
|
|
9397
|
+
if (!isDirectory(from)) return false;
|
|
9398
|
+
const to = join(opts.userDir, SESSIONS_ROOT, sessionId, kind);
|
|
9399
|
+
if (existsSync(to)) {
|
|
9400
|
+
result.failed++;
|
|
9401
|
+
return false;
|
|
9402
|
+
}
|
|
9403
|
+
try {
|
|
9404
|
+
mkdirSync(dirname(to), { recursive: true });
|
|
9405
|
+
renameSync(from, to);
|
|
9406
|
+
result.moved++;
|
|
9407
|
+
return true;
|
|
9408
|
+
} catch (err) {
|
|
9409
|
+
result.failed++;
|
|
9410
|
+
if (process.env.ZIDANE_DEBUG) process.stderr.write(`[zidane] session-dir migration: "${from}" → "${to}" failed: ${errorMessage(err)}\n`);
|
|
9411
|
+
return false;
|
|
9412
|
+
}
|
|
9413
|
+
};
|
|
9414
|
+
for (const entry of entries) {
|
|
9415
|
+
if (!entry.isDirectory() || ARTIFACT_ROOTS.has(entry.name) || !LEGACY_SESSION_ID.test(entry.name)) continue;
|
|
9416
|
+
const legacyDir = join(opts.userDir, entry.name);
|
|
9417
|
+
let movedHere = 0;
|
|
9418
|
+
for (const kind of SESSION_ARTIFACT_KINDS) if (relocate(join(legacyDir, kind), entry.name, kind)) movedHere++;
|
|
9419
|
+
if (movedHere === 0) continue;
|
|
9420
|
+
try {
|
|
9421
|
+
rmdirSync(legacyDir);
|
|
9422
|
+
result.removed++;
|
|
9423
|
+
} catch {}
|
|
9424
|
+
}
|
|
9425
|
+
for (const kind of ["tasks", "mcp-warnings"]) {
|
|
9426
|
+
const root = join(opts.userDir, kind);
|
|
9427
|
+
let children;
|
|
9428
|
+
try {
|
|
9429
|
+
children = readdirSync(root, { withFileTypes: true });
|
|
9430
|
+
} catch {
|
|
9431
|
+
continue;
|
|
9432
|
+
}
|
|
9433
|
+
let movedFromRoot = 0;
|
|
9434
|
+
for (const child of children) {
|
|
9435
|
+
if (!child.isDirectory() || !LEGACY_SESSION_ID.test(child.name)) continue;
|
|
9436
|
+
if (relocate(join(root, child.name), child.name, kind)) movedFromRoot++;
|
|
9437
|
+
}
|
|
9438
|
+
if (movedFromRoot === 0) continue;
|
|
9439
|
+
try {
|
|
9440
|
+
rmdirSync(root);
|
|
9441
|
+
result.removed++;
|
|
9442
|
+
} catch {}
|
|
9443
|
+
}
|
|
9444
|
+
return result;
|
|
9445
|
+
}
|
|
9446
|
+
function isDirectory(path) {
|
|
9447
|
+
try {
|
|
9448
|
+
return statSync(path).isDirectory();
|
|
9449
|
+
} catch {
|
|
9450
|
+
return false;
|
|
9451
|
+
}
|
|
9239
9452
|
}
|
|
9240
9453
|
/**
|
|
9241
9454
|
* Decide-and-persist for a single tool result. Pure decision + filesystem
|
|
@@ -15703,6 +15916,6 @@ function createAgent(rawOptions) {
|
|
|
15703
15916
|
};
|
|
15704
15917
|
}
|
|
15705
15918
|
//#endregion
|
|
15706
|
-
export {
|
|
15919
|
+
export { removeInstalledExtension as $, readKeybindings as $t, NO_TOOLS_PREAMBLE as A, looksBinary as At, stripImagesFromTurns as B, validateToolArgs as Bt, resolveTasksDir as C, shouldAutoCompact as Cn, createSkillsRunScriptTool as Ct, selectRecentFiles as D, stableStringify as Dn, shell as Dt, selectFilesFromSession as E, normalizeShellCommand as En, createShellTool as Et, buildTailCompactPrompt as F, listFiles as Ft, EMPTY_EXTENSION_REGISTRY as G, KEYBINDING_KEY_COL_WIDTH as Gt, truncateHeadForPtlRetry as H, DEFAULT_KEYBINDINGS as Ht, buildUpToCompactPrompt as I, createInteractionTool as It, fetchExtensionSource as J, groupBindings as Jt, createExtensionPromptBridge as K, ensureKeybindingsFile as Kt, ANCHOR_PREVIEW_MAX_CHARS as L, grep as Lt, buildCompactPrompt as M, createModelSearchTool as Mt, buildFromCompactPrompt as N, formatModelLine as Nt, compactConversation as O, tailTruncate as Ot, buildFullCompactPrompt as P, matchModelEntries as Pt, readExtensionInstallProvenance as Q, parseBindingSpec as Qt, anchorPreviewFor as R, glob as Rt, resolveSessionDir as S, effectiveContextWindow as Sn, createSkillsUseTool as St, selectFilesFromReadState as T, defaultRepeatGuardTracked as Tn, shellKill as Tt, CompactInvalidInputError as U, KEYBINDING_DEFS as Ut, summaryToTurn as V, resolveStorageDirs as Vt, CompactPromptTooLongError as W, KEYBINDING_DEF_BY_ACTION as Wt, listExtensionCandidates as X, matchesBinding as Xt, installExtensionFromSpec as Y, keybindingsPath as Yt, parseExtensionInstallSource as Z, mergeKeybindings as Zt, rehomePersistedStubs as _, resolveExtensionConfigValue as _n, WAIT_TASK_TIMED_OUT_PREFIX as _t, SHELL_CASCADE_CANCEL_MESSAGE as a, defaultExtensionScanPaths as an, composeExtensionPreset as at, resolveMcpWarningsDir as b, AUTO_COMPACT_MIN_GROWTH_FRACTION as bn, createSpawnTool as bt, applyCompactSummaryCutoff as c, isExtensionDefinition as cn, mergeContributions as ct, PERSISTED_STUB_PREFIX as d, defineExtension as dn, createWorkspaceSurface as dt, readKeybindingsRaw as en, updateInstalledExtension as et, PERSISTENCE_PREVIEW_BYTES as f, clampExtensionConfigNumber as fn, composePresets as ft, migrateSessionArtifactDirs as g, resolveExtensionConfig as gn, writeFile$1 as gt, maybePersistToolResult as h, isValidExtensionConfigValue as hn, basic_default as ht, INTERRUPT_MESSAGE_FOR_TOOL_USE as i, ENTRY_CANDIDATES as in, buildExtensionRegistry as it, TRAILER as j, multiEdit as jt, BASE_INSTRUCTIONS as k, readFile$1 as kt, collectNewlyStaleReadPaths as l, parseExtensionScanPathEnv as ln, partitionExtensionCatalog as lt, cleanupPersistedSession as m, isValidExtensionConfigItem as mn, basicTools as mt, normalizeProviders as n, stripJsonComments as nn, discoverAndBuildExtensionRegistry as nt, TOOL_USE_CANCELLED_MESSAGE as o, discoverExtensions as on, disposeExtensionRegistry as ot, buildPersistedStub as p, coerceExtensionConfigInput as pn, definePreset as pt, ExtensionInstallError as q, formatBindingForDisplay as qt, resolveModelTargets as r, registerExtensionHostModules as rn, buildExtensionPreset as rt, TOOL_USE_SKIPPED_MESSAGE as s, inlineLoadedExtension as sn, filterExtensionRegistry as st, createAgent as t, resolveExtensionKeybindings as tn, createExtensionHud as tt, renderStaleReadNotice as u, scanExtensionDirectories as un, createExtensionHostRuntimeBridge as ut, resolveLegacyPersistDir as v, sanitizeExtensionConfigActionPatch as vn, waitTask as vt, buildPostCompactAttachments as w, defaultRepeatGuardNormalize as wn, createSkillsReadTool as wt, resolvePersistDir as x, OUTPUT_RESERVE_TOKENS as xn, isSpawnTool as xt, resolveLegacySessionDir as y, toWireConfigSchema as yn, createToolSearchTool as yt, sliceForCompaction as z, edit as zt };
|
|
15707
15920
|
|
|
15708
|
-
//# sourceMappingURL=agent-
|
|
15921
|
+
//# sourceMappingURL=agent-xjMzFclr.js.map
|