zidane 7.0.32 → 7.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -0
- package/dist/{acp-bBDF-dhy.js → acp-B5UfEhMd.js} +4 -4
- package/dist/{acp-bBDF-dhy.js.map → acp-B5UfEhMd.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-BCG9JcZl.js → agent-_xxElOgH.js} +162 -18
- package/dist/agent-_xxElOgH.js.map +1 -0
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +1 -1
- package/dist/{anthropic-B4UmPm4H.js → anthropic-DPPs3wjJ.js} +111 -7
- package/dist/anthropic-DPPs3wjJ.js.map +1 -0
- package/dist/{approvals-DkwGBMZ9.js → approvals-u2T19Dc-.js} +275 -88
- package/dist/approvals-u2T19Dc-.js.map +1 -0
- package/dist/{auth-D0BHBb02.js → auth-HRKkOErn.js} +3 -3
- package/dist/{auth-D0BHBb02.js.map → auth-HRKkOErn.js.map} +1 -1
- package/dist/chat/pure.d.ts +3 -3
- package/dist/chat/pure.js +1 -1
- package/dist/chat.d.ts +6 -6
- package/dist/chat.js +8 -8
- 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-BSFQVclW.js → contexts-CRE9pw07.js} +544 -17
- package/dist/contexts-CRE9pw07.js.map +1 -0
- package/dist/contexts.d.ts +4 -4
- package/dist/contexts.js +2 -2
- package/dist/daemon-cli.js +1 -1
- package/dist/eval.d.ts +1 -1
- package/dist/eval.js +3 -3
- 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-B6FkK6ZN.d.ts → index-C37_ppWv.d.ts} +2 -2
- package/dist/index-C37_ppWv.d.ts.map +1 -0
- package/dist/{index-Ogi2CeHf.d.ts → index-D3TTaaQ5.d.ts} +20 -7
- package/dist/index-D3TTaaQ5.d.ts.map +1 -0
- package/dist/{index-CCB05-JZ.d.ts → index-DZhrTn-v.d.ts} +259 -12
- package/dist/index-DZhrTn-v.d.ts.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +8 -8
- package/dist/{ipc-C10lnS-a.js → ipc-DwauKEE-.js} +3 -3
- package/dist/{ipc-C10lnS-a.js.map → ipc-DwauKEE-.js.map} +1 -1
- package/dist/ipc.d.ts +5 -5
- package/dist/ipc.js +3 -3
- package/dist/{types-U-rIVUDw.d.ts → isolation-Kfoof0MM.d.ts} +93 -2
- package/dist/isolation-Kfoof0MM.d.ts.map +1 -0
- package/dist/mcp.d.ts +1 -1
- package/dist/output/stream-json.d.ts +1 -1
- package/dist/output/terminal.d.ts +1 -1
- package/dist/{plugins-B531Tz5b.js → plugins-gbI7SBA6.js} +3 -3
- package/dist/{plugins-B531Tz5b.js.map → plugins-gbI7SBA6.js.map} +1 -1
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.js +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/presets.js +1 -1
- package/dist/providers/anthropic.d.ts +2 -2
- package/dist/providers/anthropic.js +2 -2
- 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 +2 -2
- package/dist/providers.js +1 -1
- package/dist/restate.d.ts +2 -2
- package/dist/restate.js +1 -1
- package/dist/{sandbox-CDl9tfTo.d.ts → sandbox-BH0WQkXn.d.ts} +2 -2
- package/dist/{sandbox-CDl9tfTo.d.ts.map → sandbox-BH0WQkXn.d.ts.map} +1 -1
- package/dist/{server--mwNA7oC.js → server-DvPnPSZb.js} +8 -8
- package/dist/{server--mwNA7oC.js.map → server-DvPnPSZb.js.map} +1 -1
- package/dist/session/sqlite.d.ts +1 -1
- package/dist/session/sqlite.d.ts.map +1 -1
- package/dist/session/sqlite.js +7 -0
- package/dist/session/sqlite.js.map +1 -1
- package/dist/{session-CVy-2mAy.js → session-BqRP1hS7.js} +33 -3
- package/dist/session-BqRP1hS7.js.map +1 -0
- package/dist/session.d.ts +1 -1
- package/dist/session.js +1 -1
- package/dist/{skills-PJyiSRCp.js → skills-BC3dodWp.js} +2 -2
- package/dist/{skills-PJyiSRCp.js.map → skills-BC3dodWp.js.map} +1 -1
- package/dist/skills.d.ts +1 -1
- package/dist/skills.js +1 -1
- package/dist/{src-CjkY6fBj.js → src-CkNQKFKr.js} +3 -3
- package/dist/{src-CjkY6fBj.js.map → src-CkNQKFKr.js.map} +1 -1
- package/dist/{tool-formatters-Bu4repDJ.d.ts → tool-formatters-C5s88MUd.d.ts} +2 -2
- package/dist/{tool-formatters-Bu4repDJ.d.ts.map → tool-formatters-C5s88MUd.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-CJCxyVE-.d.ts → transcript-anchors-DxofXw_y.d.ts} +3 -3
- package/dist/transcript-anchors-DxofXw_y.d.ts.map +1 -0
- package/dist/tui.d.ts +21 -28
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +163 -69
- package/dist/tui.js.map +1 -1
- package/dist/{turn-operations-HX3g3XIc.js → turn-operations-6JDu2ewy.js} +14 -2
- package/dist/{turn-operations-HX3g3XIc.js.map → turn-operations-6JDu2ewy.js.map} +1 -1
- package/dist/{turn-operations-qcv9UFcL.d.ts → turn-operations-BaQnxzhr.d.ts} +14 -4
- package/dist/{turn-operations-qcv9UFcL.d.ts.map → turn-operations-BaQnxzhr.d.ts.map} +1 -1
- package/dist/types-CWgENVLY.js.map +1 -1
- package/dist/types.d.ts +3 -3
- package/docs/ARCHITECTURE.md +2 -1
- package/docs/CHAT.md +9 -1
- package/docs/EXECUTION_CONTEXT.md +64 -3
- package/docs/SKILL.md +28 -0
- package/docs/TUI.md +6 -5
- package/package.json +1 -1
- package/dist/agent-BCG9JcZl.js.map +0 -1
- package/dist/anthropic-B4UmPm4H.js.map +0 -1
- package/dist/approvals-DkwGBMZ9.js.map +0 -1
- package/dist/contexts-BSFQVclW.js.map +0 -1
- package/dist/index-B6FkK6ZN.d.ts.map +0 -1
- package/dist/index-CCB05-JZ.d.ts.map +0 -1
- package/dist/index-Ogi2CeHf.d.ts.map +0 -1
- package/dist/session-CVy-2mAy.js.map +0 -1
- package/dist/transcript-anchors-CJCxyVE-.d.ts.map +0 -1
- package/dist/types-U-rIVUDw.d.ts.map +0 -1
package/dist/acp-cli.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { m as openaiCompat } from "./openai-compat-Dy56weK8.js";
|
|
3
|
-
import { Ct as basic_default } from "./agent-
|
|
4
|
-
import { r as createProcessContext } from "./contexts-
|
|
3
|
+
import { Ct as basic_default } from "./agent-_xxElOgH.js";
|
|
4
|
+
import { r as createProcessContext } from "./contexts-CRE9pw07.js";
|
|
5
5
|
import { createSandboxContext } from "./contexts/sandbox.js";
|
|
6
|
-
import { p as resolveStorageDirs } from "./plugins-
|
|
7
|
-
import {
|
|
6
|
+
import { p as resolveStorageDirs } from "./plugins-gbI7SBA6.js";
|
|
7
|
+
import { r as anthropic } from "./anthropic-DPPs3wjJ.js";
|
|
8
8
|
import { arcee } from "./providers/arcee.js";
|
|
9
9
|
import { baseten } from "./providers/baseten.js";
|
|
10
10
|
import { cerebras } from "./providers/cerebras.js";
|
|
11
11
|
import { openai } from "./providers/openai.js";
|
|
12
12
|
import { openrouter } from "./providers/openrouter.js";
|
|
13
13
|
import { xai } from "./providers/xai.js";
|
|
14
|
-
import { d as StartUsageError, f as buildStartLocalOptions, h as startProviderNames, i as withAcpDefaultTools, m as startLocalArgOptions, p as parseStartArgValues, t as runAcpStdioServer } from "./acp-
|
|
15
|
-
import { d as BUILTIN_PROVIDERS, i as readCredentials, m as credKeyOf, r as credentialsPath, t as detectAuth, x as modelsForDescriptor } from "./auth-
|
|
14
|
+
import { d as StartUsageError, f as buildStartLocalOptions, h as startProviderNames, i as withAcpDefaultTools, m as startLocalArgOptions, p as parseStartArgValues, t as runAcpStdioServer } from "./acp-B5UfEhMd.js";
|
|
15
|
+
import { d as BUILTIN_PROVIDERS, i as readCredentials, m as credKeyOf, r as credentialsPath, t as detectAuth, x as modelsForDescriptor } from "./auth-HRKkOErn.js";
|
|
16
16
|
import { createDaytonaProvider } from "./contexts/daytona.js";
|
|
17
17
|
import { createDockerContext } from "./contexts/docker.js";
|
|
18
18
|
import { createE2BProvider } from "./contexts/e2b.js";
|
package/dist/acp.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { C_ as TurnUsage, Hg as PromptPart, O_ as ToolDef, Xi as AgentOptions, Zg as SessionContentBlock, jg as McpServerConfig, m_ as ToolResultContent, mg as AgentBehavior, nv as Session, ov as SessionStore, qi as Agent, t as Preset, ym as Provider } from "./index-DZhrTn-v.js";
|
|
2
|
+
import { m as ExecutionContext } from "./isolation-Kfoof0MM.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,3 +1,3 @@
|
|
|
1
1
|
import { n as JsonRpcRemoteError, r as createJsonRpcConnection } from "./json-rpc-rSWMUh9b.js";
|
|
2
|
-
import { a as wrapToolsForAcpClient, c as sessionBlocksToAcp, 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-
|
|
2
|
+
import { a as wrapToolsForAcpClient, c as sessionBlocksToAcp, 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-B5UfEhMd.js";
|
|
3
3
|
export { AcpProtocolError, JsonRpcRemoteError, acpMcpServersToZidane, acpPromptToPromptParts, createAcpServer, createJsonRpcConnection, runAcpStdioServer, sessionBlocksToAcp, stopReasonFromRun, toolResultToAcpContent, withAcpDefaultTools, wrapToolsForAcpClient };
|
|
@@ -3,22 +3,22 @@ import { a as documentBlockMarker, c as toolOutputBudgetByteLength, l as toolOut
|
|
|
3
3
|
import { a as stripLineNumberPrefixes, i as resolveOldString, n as buildContextBreakdown, o as styleReplacementForVia, r as describeVia, t as buildContextSegments } from "./context-segments-BrEsRhA0.js";
|
|
4
4
|
import { n as estimateTokens, r as utf8ByteLength } from "./utils-ngQzYzZD.js";
|
|
5
5
|
import { a as formatDuration, c as previewLine, o as formatTaskStatus, s as formatTaskSummary } from "./format-BF745pLL.js";
|
|
6
|
+
import { r as createProcessContext, t as resolveDetachedTasksCapability } from "./contexts-CRE9pw07.js";
|
|
6
7
|
import { i as parseGitLsFiles, r as GIT_LS_FILES_COMMAND } from "./glob-DluQFSw1.js";
|
|
7
8
|
import { i as isOutputExceededMessage } from "./output-cap-C9zukcCj.js";
|
|
8
|
-
import { r as createProcessContext, t as resolveDetachedTasksCapability } from "./contexts-BSFQVclW.js";
|
|
9
9
|
import { n as shellQuote, t as alwaysQuote } from "./shell-quote-BmnhZmdM.js";
|
|
10
10
|
import { a as AgentProviderError, d as isAbortLikeError, g as toTypedError, i as AgentLengthResumeExhaustedError, n as AgentBudgetExceededError, p as isTransientTransportError, s as AgentToolPairingError, t as AgentAbortedError, u as errorMessage } from "./errors-DKiMrOKq.js";
|
|
11
11
|
import { i as ARTIFACT_KIND_PATTERN, l as normalizeArtifactInput, o as ARTIFACT_URI_MAX_CHARS, r as ARTIFACT_KINDS, t as ARTIFACTS_METADATA_KEY } from "./artifacts-CV2hUKnL.js";
|
|
12
|
-
import { E as buildCatalog, L as projectUserPaths, O as installAllowedToolsGate, P as validateResourcePathReal, R as findGitRoot, _ as lastLine, a as interpolateShellCommands, b as resolveSubdirRoot, g as fetchInstallSource, h as defaultWhich, k as createSkillActivationState, m as defaultExec, n as resolveSkills, o as stripShellInterpolations, p as InstallSourceError, v as parseInstallSource, y as resolveNpmVersion } from "./skills-
|
|
12
|
+
import { E as buildCatalog, L as projectUserPaths, O as installAllowedToolsGate, P as validateResourcePathReal, R as findGitRoot, _ as lastLine, a as interpolateShellCommands, b as resolveSubdirRoot, g as fetchInstallSource, h as defaultWhich, k as createSkillActivationState, m as defaultExec, n as resolveSkills, o as stripShellInterpolations, p as InstallSourceError, v as parseInstallSource, y as resolveNpmVersion } from "./skills-BC3dodWp.js";
|
|
13
13
|
import { n as writeFileAtomicAsync, t as writeFileAtomic } from "./atomic-write-B7zr1ddF.js";
|
|
14
|
-
import { p as resolveStorageDirs, r as loadAgentPlugin } from "./plugins-
|
|
14
|
+
import { p as resolveStorageDirs, r as loadAgentPlugin } from "./plugins-gbI7SBA6.js";
|
|
15
15
|
import { r as createLogger, t as consoleSink } from "./logger--C1VQjwJ.js";
|
|
16
16
|
import { t as escapeXml } from "./xml-D5HBhJle.js";
|
|
17
17
|
import { n as reconcileImageMediaType } from "./media-sniff-UKijEaiQ.js";
|
|
18
18
|
import { f as wrapDiscoveredMcpTools, i as deriveMcpToolMeta, n as connectMcpServers, s as nonOwningMcpView } from "./mcp-CgNd-f3F.js";
|
|
19
19
|
import { appendStaticSection, renderSystemForWire } from "./prompt.js";
|
|
20
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-2jcOA_5R.js";
|
|
21
|
-
import { a as getExtensionSessionState, c as setExtensionSessionState, l as withExtensionSession, n as currentExtensionSession, r as deleteExtensionSessionState, s as resumeChainRunIds } from "./session-
|
|
21
|
+
import { a as getExtensionSessionState, c as setExtensionSessionState, l as withExtensionSession, n as currentExtensionSession, r as deleteExtensionSessionState, s as resumeChainRunIds } from "./session-BqRP1hS7.js";
|
|
22
22
|
import { n as flattenTurns, r as formatTokenUsage, t as effectiveInputFromTurn } from "./stats-DAKBEKjc.js";
|
|
23
23
|
import { a as settleWithinTimeout, i as resolveTimeoutMs, n as abortableSleep, o as withInactivityTimeout, r as linkAbortSignal, s as withTimeout$1, t as OperationTimeoutError } from "./timeout-CjOG2mea.js";
|
|
24
24
|
import { createRequire } from "node:module";
|
|
@@ -26,9 +26,9 @@ import { basename, delimiter, dirname, isAbsolute, join, posix, resolve, sep } f
|
|
|
26
26
|
import { createHooks } from "hookable";
|
|
27
27
|
import { Buffer } from "node:buffer";
|
|
28
28
|
import { cpSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, rmdirSync, statSync, writeFileSync } from "node:fs";
|
|
29
|
+
import { homedir, tmpdir } from "node:os";
|
|
29
30
|
import { copyFile, mkdir, readdir, rm, stat, unlink } from "node:fs/promises";
|
|
30
31
|
import { pathToFileURL } from "node:url";
|
|
31
|
-
import { homedir, tmpdir } from "node:os";
|
|
32
32
|
import { createHash } from "node:crypto";
|
|
33
33
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
34
34
|
//#region src/tools/read-state.ts
|
|
@@ -3022,7 +3022,14 @@ const KEYBINDING_DEFS = [
|
|
|
3022
3022
|
action: "cancelToolCall",
|
|
3023
3023
|
default: "ctrl+k",
|
|
3024
3024
|
label: "cancel tool",
|
|
3025
|
-
description: "open the in-flight tool picker to cancel a single tool call without aborting the run (
|
|
3025
|
+
description: "open the in-flight tool picker to cancel a single tool call without aborting the run (abortRun stops the whole run)",
|
|
3026
|
+
group: "Global"
|
|
3027
|
+
},
|
|
3028
|
+
{
|
|
3029
|
+
action: "abortRun",
|
|
3030
|
+
default: "ctrl+escape",
|
|
3031
|
+
label: "abort",
|
|
3032
|
+
description: "abort the run and deny pending approvals (plain esc leaves for the sessions list; rebind if your terminal cannot report ctrl+esc)",
|
|
3026
3033
|
group: "Global"
|
|
3027
3034
|
},
|
|
3028
3035
|
{
|
|
@@ -3423,7 +3430,9 @@ function resolveExtensionKeybindings(bindings, raw) {
|
|
|
3423
3430
|
}
|
|
3424
3431
|
/**
|
|
3425
3432
|
* `true` when `spec` is one of the chords the framework reserves for
|
|
3426
|
-
* itself — `escape` (
|
|
3433
|
+
* itself — `escape` (back / exit), `ctrl+escape` (the `abortRun`
|
|
3434
|
+
* default — the one built-in that must never be shadowed) and `ctrl+c`
|
|
3435
|
+
* (quit). Extensions
|
|
3427
3436
|
* can never claim these, neither via their declared `default` nor via a
|
|
3428
3437
|
* user override in `keybindings.json`. Single source of truth shared by
|
|
3429
3438
|
* `resolveExtensionKeybindings` above and the registration-time refusal
|
|
@@ -3433,7 +3442,7 @@ function isReservedExtensionBinding(spec) {
|
|
|
3433
3442
|
const parsed = parseBindingSpec(spec);
|
|
3434
3443
|
if (!parsed) return false;
|
|
3435
3444
|
const noExtraModifiers = !parsed.shift && !parsed.alt && !parsed.meta;
|
|
3436
|
-
if (parsed.name === "escape" &&
|
|
3445
|
+
if (parsed.name === "escape" && noExtraModifiers) return true;
|
|
3437
3446
|
return parsed.name === "c" && parsed.ctrl && noExtraModifiers;
|
|
3438
3447
|
}
|
|
3439
3448
|
/**
|
|
@@ -11973,8 +11982,12 @@ function executionBlobWriter(ctx) {
|
|
|
11973
11982
|
* the per-turn `turnId` tags that the TUI's select-turn mode relies on.
|
|
11974
11983
|
*
|
|
11975
11984
|
* Pure: a fresh array is returned only when a marker is found. Input
|
|
11976
|
-
* turns are never mutated
|
|
11977
|
-
*
|
|
11985
|
+
* turns are never mutated. New `SessionTurn`s allocated: the synthetic
|
|
11986
|
+
* markers, plus a copy of every preserved assistant turn older than the
|
|
11987
|
+
* newest marker whose replayable thinking was stripped (see
|
|
11988
|
+
* {@link withoutReplayedThinking}). The output is WIRE-shaped, not
|
|
11989
|
+
* display-shaped: hosts rendering a transcript should read the session
|
|
11990
|
+
* turns, not this view.
|
|
11978
11991
|
*/
|
|
11979
11992
|
/**
|
|
11980
11993
|
* Recover the auto-compaction hysteresis baseline from a resumed session.
|
|
@@ -12036,17 +12049,68 @@ function applyCompactSummaryCutoff(turns) {
|
|
|
12036
12049
|
...m.turn.runId ? { runId: m.turn.runId } : {}
|
|
12037
12050
|
});
|
|
12038
12051
|
}
|
|
12052
|
+
const newestMarkerIdx = markers[markers.length - 1].idx;
|
|
12053
|
+
const stripBound = preservedChainStart(turns, newestMarkerIdx);
|
|
12039
12054
|
const out = [];
|
|
12040
12055
|
for (let i = 0; i < turns.length; i++) {
|
|
12041
12056
|
const synthetic = syntheticAt.get(i);
|
|
12042
12057
|
if (synthetic) out.push(synthetic);
|
|
12043
12058
|
if (markerIdxSet.has(i)) continue;
|
|
12044
12059
|
if (replacedAll.has(turns[i].id)) continue;
|
|
12045
|
-
out.push(turns[i]);
|
|
12060
|
+
out.push(i < stripBound ? withoutReplayedThinking(turns[i]) : turns[i]);
|
|
12046
12061
|
}
|
|
12047
12062
|
return out;
|
|
12048
12063
|
}
|
|
12049
12064
|
/**
|
|
12065
|
+
* Strip bound for the preserved tail behind the marker at `markerIdx`: the
|
|
12066
|
+
* index below which pre-marker assistant turns lose their replayed thinking.
|
|
12067
|
+
*
|
|
12068
|
+
* Reads the turn immediately before the marker to tell whether a tool loop
|
|
12069
|
+
* was in flight when compaction fired. A `tool_result`-only user turn (or an
|
|
12070
|
+
* assistant turn still holding a `tool_call`) means the marker landed mid
|
|
12071
|
+
* loop: the bound retreats to that chain's start — the last user turn before
|
|
12072
|
+
* the marker carrying real, non-`tool_result` content (`compact-summary`
|
|
12073
|
+
* turns render as user text but are not prompts) — so the assistant turn
|
|
12074
|
+
* whose `tool_use` the loop is still answering keeps its thinking. Any other
|
|
12075
|
+
* neighbour (a text-only assistant answer, a bare prompt) means the run had
|
|
12076
|
+
* settled and everything before the marker is strippable. Depends only on
|
|
12077
|
+
* turns before the marker, so it is stable across later requests.
|
|
12078
|
+
*/
|
|
12079
|
+
function preservedChainStart(turns, markerIdx) {
|
|
12080
|
+
const before = turns[markerIdx - 1];
|
|
12081
|
+
if (!(before !== void 0 && (before.role === "user" && before.content.length > 0 && before.content.every((block) => block.type === "tool_result") || before.role === "assistant" && before.content.some((block) => block.type === "tool_call")))) return markerIdx;
|
|
12082
|
+
for (let i = markerIdx - 1; i >= 0; i--) {
|
|
12083
|
+
const turn = turns[i];
|
|
12084
|
+
if (turn.role !== "user") continue;
|
|
12085
|
+
if (turn.content.some((block) => block.type === "compact-summary")) continue;
|
|
12086
|
+
if (turn.content.some((block) => block.type !== "tool_result")) return i;
|
|
12087
|
+
}
|
|
12088
|
+
return markerIdx;
|
|
12089
|
+
}
|
|
12090
|
+
/**
|
|
12091
|
+
* Copy of `turn` with prefix-bound reasoning removed: `redacted_thinking`,
|
|
12092
|
+
* and SIGNED `thinking` blocks not produced by an OpenAI-family provider
|
|
12093
|
+
* (whose encrypted reasoning is bound per item, not per prefix). Unsigned
|
|
12094
|
+
* thinking is left alone — it is what `reasoning_content`-style OpenAI-compat
|
|
12095
|
+
* providers (vLLM, DeepSeek, Arcee) echo back, and `toAnthropic` already
|
|
12096
|
+
* drops it on the Anthropic wire. Same predicate as the provider's
|
|
12097
|
+
* signature scrub. Returns the input object when nothing is removed so
|
|
12098
|
+
* identity-based callers see no churn. A reasoning-only turn keeps a
|
|
12099
|
+
* placeholder so the assistant message stays non-empty on the wire.
|
|
12100
|
+
*/
|
|
12101
|
+
function withoutReplayedThinking(turn) {
|
|
12102
|
+
if (turn.role !== "assistant") return turn;
|
|
12103
|
+
const kept = turn.content.filter((block) => block.type !== "redacted_thinking" && !(block.type === "thinking" && !!block.signature && block.signatureProducer !== "openai"));
|
|
12104
|
+
if (kept.length === turn.content.length) return turn;
|
|
12105
|
+
return {
|
|
12106
|
+
...turn,
|
|
12107
|
+
content: kept.length > 0 ? kept : [{
|
|
12108
|
+
type: "text",
|
|
12109
|
+
text: "[historical reasoning omitted]"
|
|
12110
|
+
}]
|
|
12111
|
+
};
|
|
12112
|
+
}
|
|
12113
|
+
/**
|
|
12050
12114
|
* Flatten image blocks inside previously-stored `tool_result` outputs to text
|
|
12051
12115
|
* markers when the provider reports no vision capability. This handles the
|
|
12052
12116
|
* session-resume / mid-session-provider-switch case:
|
|
@@ -12064,6 +12128,56 @@ function applyCompactSummaryCutoff(turns) {
|
|
|
12064
12128
|
*/
|
|
12065
12129
|
const COMPACTION_STUB = "[…elided: older tool output trimmed to fit the context budget.]";
|
|
12066
12130
|
const COMPACTION_STUB_BYTES = toolOutputByteLength(COMPACTION_STUB);
|
|
12131
|
+
/** Byte threshold tail compaction falls back to when `compactThreshold` is unset. */
|
|
12132
|
+
const DEFAULT_COMPACT_THRESHOLD_BYTES = 131072;
|
|
12133
|
+
/**
|
|
12134
|
+
* Effective byte threshold for client-side compaction (`'tail'` and the
|
|
12135
|
+
* `CompactFunction` path): the host's `compactThreshold` (default 128 KiB),
|
|
12136
|
+
* raised to `compactThresholdWindowFraction × contextWindow × BYTES_PER_TOKEN`
|
|
12137
|
+
* when both are known. Every frontier step re-bills the whole suffix at the
|
|
12138
|
+
* cache-write rate, so on large-context models the byte threshold alone
|
|
12139
|
+
* trips far too early; see `AgentBehavior.compactThresholdWindowFraction`.
|
|
12140
|
+
* Pure — exported for host-behavior tests.
|
|
12141
|
+
*/
|
|
12142
|
+
function resolveTailCompactionThreshold(behavior, contextWindow) {
|
|
12143
|
+
const base = typeof behavior.compactThreshold === "number" && behavior.compactThreshold > 0 ? behavior.compactThreshold : DEFAULT_COMPACT_THRESHOLD_BYTES;
|
|
12144
|
+
const fraction = behavior.compactThresholdWindowFraction;
|
|
12145
|
+
if (typeof fraction !== "number" || !(fraction > 0) || typeof contextWindow !== "number" || !(contextWindow > 0)) return base;
|
|
12146
|
+
return Math.max(base, Math.floor(fraction * contextWindow * 4));
|
|
12147
|
+
}
|
|
12148
|
+
/**
|
|
12149
|
+
* Context window (tokens) of the model currently serving the run, for
|
|
12150
|
+
* window-relative wire budgets.
|
|
12151
|
+
*
|
|
12152
|
+
* On the primary target the host's explicit `behavior.contextWindow` (chat
|
|
12153
|
+
* hosts inject the picked model's window every run) wins, then the resolved
|
|
12154
|
+
* autocompact window, the primary {@link ModelTarget}'s window, and the
|
|
12155
|
+
* provider's advertised `meta.contextWindow`. Once the run has advanced down
|
|
12156
|
+
* the fallback chain, `behavior.contextWindow` describes the model that just
|
|
12157
|
+
* FAILED (1M Fable → 200k Sonnet is the realistic shape), so the active
|
|
12158
|
+
* target's own window and the re-based autocompact window take precedence
|
|
12159
|
+
* and the stale behavior value is only a last resort before provider meta.
|
|
12160
|
+
* `null` when nothing knows.
|
|
12161
|
+
*/
|
|
12162
|
+
function activeContextWindow(ctx) {
|
|
12163
|
+
const positive = (n) => typeof n === "number" && n > 0 ? n : null;
|
|
12164
|
+
const advanced = (ctx.activeTargetIndex ?? 0) > 0;
|
|
12165
|
+
const target = ctx.targets?.[ctx.activeTargetIndex ?? 0];
|
|
12166
|
+
const ordered = advanced ? [
|
|
12167
|
+
target?.contextWindow,
|
|
12168
|
+
ctx.autoCompact?.contextWindow,
|
|
12169
|
+
ctx.behavior.contextWindow
|
|
12170
|
+
] : [
|
|
12171
|
+
ctx.behavior.contextWindow,
|
|
12172
|
+
ctx.autoCompact?.contextWindow,
|
|
12173
|
+
target?.contextWindow
|
|
12174
|
+
];
|
|
12175
|
+
for (const candidate of ordered) {
|
|
12176
|
+
const n = positive(candidate);
|
|
12177
|
+
if (n !== null) return n;
|
|
12178
|
+
}
|
|
12179
|
+
return positive(ctx.provider.meta.contextWindow);
|
|
12180
|
+
}
|
|
12067
12181
|
/**
|
|
12068
12182
|
* Cross-turn memo for `toolOutputBudgetByteLength`, keyed on the tool_result
|
|
12069
12183
|
* block object. The wire pipeline preserves block references for unchanged
|
|
@@ -12947,7 +13061,7 @@ async function enforceSchemaOutput(ctx, turnId) {
|
|
|
12947
13061
|
description: "Return the final structured output matching the required schema.",
|
|
12948
13062
|
inputSchema: ctx.behavior.schema
|
|
12949
13063
|
};
|
|
12950
|
-
const schemaMessages = ensureEndsWithUserMessage(applyPairingRepair(ctx, rewriteMessagesToWire(await resolveContentRefsForWire(ctx, turnsToMessages(applyCompactSummaryCutoff(ctx.turns))), ctx.aliasMaps), turnId), ctx.provider);
|
|
13064
|
+
const schemaMessages = ensureEndsWithUserMessage(applyPairingRepair(ctx, rewriteMessagesToWire(await resolveContentRefsForWire(ctx, turnsToMessages(applyCompactSummaryCutoff(ctx.turns)).map(withoutReplayedThinking)), ctx.aliasMaps), turnId), ctx.provider);
|
|
12951
13065
|
let schemaResult;
|
|
12952
13066
|
try {
|
|
12953
13067
|
schemaResult = await streamWithWatchdogs(ctx, {
|
|
@@ -13171,6 +13285,7 @@ async function streamWithWatchdogs(ctx, options, callbacks, turnId, opts) {
|
|
|
13171
13285
|
if (opts?.startTimeoutCapMs !== void 0 && startTimeoutMs > 0) startTimeoutMs = Math.min(startTimeoutMs, opts.startTimeoutCapMs);
|
|
13172
13286
|
const callerHistoryRepair = callbacks.onHistoryRepair;
|
|
13173
13287
|
let pendingRepair;
|
|
13288
|
+
const callerInputTransformations = callbacks.onInputTransformations;
|
|
13174
13289
|
callbacks = {
|
|
13175
13290
|
...callbacks,
|
|
13176
13291
|
onDiagnostic(event) {
|
|
@@ -13180,6 +13295,20 @@ async function streamWithWatchdogs(ctx, options, callbacks, turnId, opts) {
|
|
|
13180
13295
|
turnId
|
|
13181
13296
|
})).catch(() => {});
|
|
13182
13297
|
},
|
|
13298
|
+
onInputTransformations(transformations) {
|
|
13299
|
+
try {
|
|
13300
|
+
callerInputTransformations?.(transformations);
|
|
13301
|
+
} catch {}
|
|
13302
|
+
const info = {
|
|
13303
|
+
runId: ctx.runId,
|
|
13304
|
+
turnId,
|
|
13305
|
+
...ctx.session?.id ? { sessionId: ctx.session.id } : {},
|
|
13306
|
+
transformations,
|
|
13307
|
+
prefixMismatches: transformations.filter((t) => t.reason === "prefix_binding_mismatch").length,
|
|
13308
|
+
modelMismatches: transformations.filter((t) => t.reason === "model_binding_mismatch").length
|
|
13309
|
+
};
|
|
13310
|
+
Promise.resolve(ctx.hooks.callHook("provider:input-transformations", info)).catch(() => {});
|
|
13311
|
+
},
|
|
13183
13312
|
async onHistoryRepair(repair) {
|
|
13184
13313
|
if (repair.type === "invalid-anthropic-thinking-signature") {
|
|
13185
13314
|
const result = repairInvalidAnthropicThinkingHistory(ctx, options, repair);
|
|
@@ -13675,7 +13804,7 @@ async function executeTurn(ctx, turn, priorUsage) {
|
|
|
13675
13804
|
let callMapsMemo;
|
|
13676
13805
|
const callMaps = () => callMapsMemo ??= collectCallMaps(canonicalMessages);
|
|
13677
13806
|
if (ctx.behavior.compactStrategy === "tail") {
|
|
13678
|
-
const threshold =
|
|
13807
|
+
const threshold = resolveTailCompactionThreshold(ctx.behavior, activeContextWindow(ctx));
|
|
13679
13808
|
const keep = typeof ctx.behavior.compactKeepTurns === "number" && ctx.behavior.compactKeepTurns >= 0 ? ctx.behavior.compactKeepTurns : 4;
|
|
13680
13809
|
const { readPathByCallId, toolNameByCallId } = callMaps();
|
|
13681
13810
|
const compacted = applyTailCompaction(sanitizedMessages, threshold, keep, {
|
|
@@ -13692,7 +13821,7 @@ async function executeTurn(ctx, turn, priorUsage) {
|
|
|
13692
13821
|
writeBlob: executionBlobWriter(ctx)
|
|
13693
13822
|
});
|
|
13694
13823
|
} else if (typeof ctx.behavior.compactStrategy === "function") {
|
|
13695
|
-
const threshold =
|
|
13824
|
+
const threshold = resolveTailCompactionThreshold(ctx.behavior, activeContextWindow(ctx));
|
|
13696
13825
|
const keep = typeof ctx.behavior.compactKeepTurns === "number" && ctx.behavior.compactKeepTurns >= 0 ? ctx.behavior.compactKeepTurns : 4;
|
|
13697
13826
|
let totalBytes = 0;
|
|
13698
13827
|
for (const msg of sanitizedMessages) for (const block of msg.content) if (block.type === "tool_result") totalBytes += memoizedToolResultBudgetBytes(block);
|
|
@@ -16008,6 +16137,7 @@ const HOOK_EVENT_SET = /* @__PURE__ */ new Set([
|
|
|
16008
16137
|
"compact:progress",
|
|
16009
16138
|
"compact:end",
|
|
16010
16139
|
"history:repair",
|
|
16140
|
+
"provider:input-transformations",
|
|
16011
16141
|
"oauth:refresh",
|
|
16012
16142
|
"provider:diagnostic",
|
|
16013
16143
|
"content-ref:resolve",
|
|
@@ -16190,6 +16320,8 @@ function resolveBehavior(agentBehavior, runBehavior) {
|
|
|
16190
16320
|
readFileDefaults: runBehavior?.readFileDefaults ?? agentBehavior?.readFileDefaults,
|
|
16191
16321
|
compactStrategy: runBehavior?.compactStrategy ?? agentBehavior?.compactStrategy ?? "off",
|
|
16192
16322
|
compactThreshold: runBehavior?.compactThreshold ?? agentBehavior?.compactThreshold,
|
|
16323
|
+
compactThresholdWindowFraction: runBehavior?.compactThresholdWindowFraction ?? agentBehavior?.compactThresholdWindowFraction,
|
|
16324
|
+
contextWindow: runBehavior?.contextWindow ?? agentBehavior?.contextWindow,
|
|
16193
16325
|
compactKeepTurns: runBehavior?.compactKeepTurns ?? agentBehavior?.compactKeepTurns,
|
|
16194
16326
|
thinkingDecay: runBehavior?.thinkingDecay ?? agentBehavior?.thinkingDecay,
|
|
16195
16327
|
writeFileExistingPolicy: runBehavior?.writeFileExistingPolicy ?? agentBehavior?.writeFileExistingPolicy,
|
|
@@ -16418,6 +16550,16 @@ function buildMcpToolNameSeparatorAliases(mcpToolNames, servers, separator) {
|
|
|
16418
16550
|
return Object.keys(aliases).length > 0 ? aliases : void 0;
|
|
16419
16551
|
}
|
|
16420
16552
|
/**
|
|
16553
|
+
* Resolve the effective `toolSearch.mode`. An explicit host value always
|
|
16554
|
+
* wins. When unset, Anthropic-family providers default to `'dispatch'`
|
|
16555
|
+
* (see {@link DisclosureStateInput.providerName}); everyone else keeps
|
|
16556
|
+
* `'unlock'`, whose only cost there is a prompt-cache rewrite per wave.
|
|
16557
|
+
*/
|
|
16558
|
+
function resolveToolSearchMode(toolSearch, providerName) {
|
|
16559
|
+
if (toolSearch?.mode !== void 0) return toolSearch.mode;
|
|
16560
|
+
return providerName === "anthropic" ? "dispatch" : "unlock";
|
|
16561
|
+
}
|
|
16562
|
+
/**
|
|
16421
16563
|
* Partition the registry into eager vs lazy buckets and build the per-run
|
|
16422
16564
|
* unlock bookkeeping the loop reads when rebuilding the wire-level tool list.
|
|
16423
16565
|
*
|
|
@@ -16432,7 +16574,8 @@ function buildMcpToolNameSeparatorAliases(mcpToolNames, servers, separator) {
|
|
|
16432
16574
|
* dispatch-map lookup.
|
|
16433
16575
|
*/
|
|
16434
16576
|
function buildRunDisclosureState(input) {
|
|
16435
|
-
const { tools: baseTools, mcpToolNames, mcpServers, toolDisclosure, toolSearch, toolAliases, hasRunToolOverride } = input;
|
|
16577
|
+
const { tools: baseTools, mcpToolNames, mcpServers, toolDisclosure, toolSearch, toolAliases, hasRunToolOverride, providerName } = input;
|
|
16578
|
+
const toolSearchMode = resolveToolSearchMode(toolSearch, providerName);
|
|
16436
16579
|
const disclosure = partitionToolDisclosure(baseTools, mcpToolNames, mcpServers, toolDisclosure, toolAliases);
|
|
16437
16580
|
const unlocked = new Set(disclosure.eagerCanonicalNames);
|
|
16438
16581
|
const initialUnlocked = new Set(disclosure.eagerCanonicalNames);
|
|
@@ -16447,7 +16590,7 @@ function buildRunDisclosureState(input) {
|
|
|
16447
16590
|
};
|
|
16448
16591
|
const hostDefinedToolSearch = !!baseTools.tool_search;
|
|
16449
16592
|
const injectedToolSearch = !hasRunToolOverride && (toolDisclosure === "lazy" || disclosure.lazyEntries.length > 0) && toolSearch?.tool !== false && !hostDefinedToolSearch;
|
|
16450
|
-
const dispatchMode = injectedToolSearch &&
|
|
16593
|
+
const dispatchMode = injectedToolSearch && toolSearchMode === "dispatch" && disclosure.lazyEntries.length > 0 && !baseTools["call_tool"];
|
|
16451
16594
|
let tools = baseTools;
|
|
16452
16595
|
if (injectedToolSearch) {
|
|
16453
16596
|
const toolSearchTool = createToolSearchTool({
|
|
@@ -17395,7 +17538,8 @@ function createAgent(rawOptions) {
|
|
|
17395
17538
|
toolDisclosure,
|
|
17396
17539
|
toolSearch,
|
|
17397
17540
|
toolAliases: effectiveToolAliases,
|
|
17398
|
-
hasRunToolOverride: options.tools !== void 0
|
|
17541
|
+
hasRunToolOverride: options.tools !== void 0,
|
|
17542
|
+
providerName: runProvider.name
|
|
17399
17543
|
});
|
|
17400
17544
|
const discoveryToolName = shouldInjectToolSearch ? "tool_search" : hostDefinedToolSearch ? effectiveToolAliases?.tool_search ?? "tool_search" : null;
|
|
17401
17545
|
let searchableCatalogText;
|
|
@@ -18328,4 +18472,4 @@ function createAgent(rawOptions) {
|
|
|
18328
18472
|
//#endregion
|
|
18329
18473
|
export { ExtensionInstallError as $, effectiveContextWindow as $n, DEFAULT_KEYBINDINGS as $t, buildPostCompactAttachments as A, isValidExtensionConfigItem as An, reserveChildLabel as At, buildFullCompactPrompt as B, artifactKindLabel as Bn, multiEdit as Bt, rehomePersistedStubs as C, parseExtensionScanPathEnv as Cn, basic_default as Ct, resolvePersistDir as D, defineExtension as Dn, createToolSearchTool as Dt, resolveMcpWarningsDir as E, setDebugLogSink as En, waitTask as Et, BASE_INSTRUCTIONS as F, toWireConfigSchema as Fn, createShellTool as Ft, sliceForCompaction as G, parseShortstat as Gn, createInteractionTool as Gt, buildUpToCompactPrompt as H, commitKind as Hn, formatModelLine as Ht, NO_TOOLS_PREAMBLE as I, EXTENSION_BUS_MAX_PAYLOAD_BYTES as In, shell as It, truncateHeadForPtlRetry as J, renderArtifactRow as Jn, edit as Jt, stripImagesFromTurns as K, pullRequestKind as Kn, grep as Kt, TRAILER as L, createExtensionBus as Ln, tailTruncate as Lt, selectFilesFromSession as M, resolveExtensionConfig as Mn, createSkillsRunScriptTool as Mt, selectRecentFiles as N, resolveExtensionConfigValue as Nn, createSkillsReadTool as Nt, resolveSessionDir as O, clampExtensionConfigNumber as On, createSpawnTool as Ot, compactConversation as P, sanitizeExtensionConfigActionPatch as Pn, shellKill as Pt, createExtensionPromptBridge as Q, OUTPUT_RESERVE_TOKENS as Qn, recordArtifact as Qt, buildCompactPrompt as R, serializedPayloadBytes as Rn, readFile$1 as Rt, migrateSessionArtifactDirs as S, isExtensionDefinition as Sn, basicTools as St, resolveLegacySessionDir as T, createDebugLog as Tn, WAIT_TASK_TIMED_OUT_PREFIX as Tt, ANCHOR_PREVIEW_MAX_CHARS as U, fileKind as Un, matchModelEntries as Ut, buildTailCompactPrompt as V, branchKind as Vn, createModelSearchTool as Vt, anchorPreviewFor as W, githubTokenSource as Wn, listFiles as Wt, CompactPromptTooLongError as X, createArtifactDetectHook as Xn, artifacts_default as Xt, CompactInvalidInputError as Y, resolveArtifactKind as Yn, validateToolArgs as Yt, EMPTY_EXTENSION_REGISTRY as Z, AUTO_COMPACT_MIN_GROWTH_FRACTION as Zn, RECORD_ARTIFACT_TOOL as Zt, PERSISTED_STUB_PREFIX as _, registerExtensionHostModules as _n, createArtifactsSurface as _t, stagedToolState as a, groupBindings as an, getReadState as ar, removeInstalledExtension as at, cleanupPersistedSession as b, discoverExtensions as bn, composePresets as bt, INTERRUPT_MESSAGE_FOR_TOOL_USE as c, mergeKeybindings as cn, hydrateReadStateFromSessionAsync as cr, discoverAndBuildExtensionRegistry as ct, TOOL_USE_SKIPPED_MESSAGE as d, readKeybindingsRaw as dn, composeExtensionPreset as dt, KEYBINDING_DEFS as en, shouldAutoCompact as er, fetchExtensionSource as et, applyCompactSummaryCutoff as f, resolveExtensionKeybindings as fn, disposeExtensionRegistry as ft, unwrapCallTool as g, isReservedCredKey as gn, partitionExtensionCatalog as gt, CALL_TOOL_NAME as h, alternateCredKey as hn, mergeContributions as ht, isToolStateOps as i, formatBindingForDisplay as in, stableStringify as ir, readExtensionInstallProvenance as it, selectFilesFromReadState as j, isValidExtensionConfigValue as jn, createSkillsUseTool as jt, resolveTasksDir as k, coerceExtensionConfigInput as kn, isSpawnTool as kt, SHELL_CASCADE_CANCEL_MESSAGE as l, parseBindingSpec as ln, readStateKey as lr, buildExtensionPreset as lt, renderStaleReadNotice as m, ALTERNATE_CRED_KEY_SUFFIX as mn, filterRegistryPlugins as mt, DEFAULT_MAX_VALUE_BYTES as n, KEYBINDING_KEY_COL_WIDTH as nn, defaultRepeatGuardTracked as nr, listExtensionCandidates as nt, normalizeProviders as o, keybindingsPath as on, hashContent as or, updateInstalledExtension as ot, collectNewlyStaleReadPaths as p, stripJsonComments as pn, filterExtensionRegistry as pt, summaryToTurn as q, refreshArtifact as qn, glob as qt, createToolStateController as r, ensureKeybindingsFile as rn, normalizeShellCommand as rr, parseExtensionInstallSource as rt, resolveModelTargets as s, matchesBinding as sn, hydrateReadStateFromSession as sr, createExtensionHud as st, createAgent as t, KEYBINDING_DEF_BY_ACTION as tn, defaultRepeatGuardNormalize as tr, installExtensionFromSpec as tt, TOOL_USE_CANCELLED_MESSAGE as u, readKeybindings as un, resolveReadStateMap as ur, buildExtensionRegistry as ut, PERSISTENCE_PREVIEW_BYTES as v, ENTRY_CANDIDATES as vn, createExtensionHostRuntimeBridge as vt, resolveLegacyPersistDir as w, scanExtensionDirectories as wn, writeFile$1 as wt, maybePersistToolResult as x, inlineLoadedExtension as xn, definePreset as xt, buildPersistedStub as y, defaultExtensionScanPaths as yn, createWorkspaceSurface as yt, buildFromCompactPrompt as z, BUILTIN_ARTIFACT_KINDS as zn, looksBinary as zt };
|
|
18330
18474
|
|
|
18331
|
-
//# sourceMappingURL=agent-
|
|
18475
|
+
//# sourceMappingURL=agent-_xxElOgH.js.map
|