zidane 5.7.8 → 5.8.2
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 +4 -1
- package/dist/{agent-BSPhByzT.d.ts → agent-acjWZ_4E.d.ts} +145 -2
- package/dist/agent-acjWZ_4E.d.ts.map +1 -0
- package/dist/chat/pure.d.ts +3 -3
- package/dist/chat.d.ts +6 -6
- package/dist/chat.js +2 -2
- package/dist/{headless-CEtk5dzV.js → headless-CJFFU6DI.js} +16 -3
- package/dist/headless-CJFFU6DI.js.map +1 -0
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +1 -1
- package/dist/{index-DmbrQjOk.d.ts → index-Cgr_mbMJ.d.ts} +2 -2
- package/dist/{index-DmbrQjOk.d.ts.map → index-Cgr_mbMJ.d.ts.map} +1 -1
- package/dist/{index-DEqGfnZr.d.ts → index-zy4OtFSv.d.ts} +17 -3
- package/dist/index-zy4OtFSv.d.ts.map +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +5 -296
- package/dist/index.js.map +1 -1
- package/dist/{login-C8Kc4gH0.js → login-BjY_sBdn.js} +301 -4
- package/dist/login-BjY_sBdn.js.map +1 -0
- package/dist/{mcp-Kqzz-Rs_.js → mcp-Br3b1Xm3.js} +50 -8
- package/dist/mcp-Br3b1Xm3.js.map +1 -0
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +2 -2
- package/dist/{presets-DTxFbEZ5.js → presets-BmsTNxjR.js} +2 -2
- package/dist/{presets-DTxFbEZ5.js.map → presets-BmsTNxjR.js.map} +1 -1
- package/dist/presets.d.ts +2 -2
- package/dist/presets.js +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/restate.d.ts +1 -1
- package/dist/session/sqlite.d.ts +1 -1
- package/dist/session.d.ts +1 -1
- package/dist/skills.d.ts +2 -2
- package/dist/{tool-formatters-fUAp2Nr4.d.ts → tool-formatters-B5UNV_sy.d.ts} +2 -2
- package/dist/{tool-formatters-fUAp2Nr4.d.ts.map → tool-formatters-B5UNV_sy.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-dkB_jARJ.js → tools-BzQtic6M.js} +211 -7
- package/dist/tools-BzQtic6M.js.map +1 -0
- package/dist/tools.d.ts +2 -2
- package/dist/tools.js +1 -1
- package/dist/{transcript-anchors-Cl7lbbeP.js → transcript-anchors-C571npbs.js} +46 -6
- package/dist/transcript-anchors-C571npbs.js.map +1 -0
- package/dist/{transcript-anchors-BBN7jlvp.d.ts → transcript-anchors-Dtz6U4GW.d.ts} +5 -5
- package/dist/transcript-anchors-Dtz6U4GW.d.ts.map +1 -0
- package/dist/tui.d.ts +14 -4
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +284 -78
- package/dist/tui.js.map +1 -1
- package/dist/{turn-operations-CE1prnuP.d.ts → turn-operations-CqJAEzoe.d.ts} +3 -3
- package/dist/{turn-operations-CE1prnuP.d.ts.map → turn-operations-CqJAEzoe.d.ts.map} +1 -1
- package/dist/types-BPw_i5vb.js.map +1 -1
- package/dist/types.d.ts +3 -3
- package/docs/ARCHITECTURE.md +4 -2
- package/docs/CHAT.md +19 -1
- package/docs/SKILL.md +1 -0
- package/package.json +1 -1
- package/dist/agent-BSPhByzT.d.ts.map +0 -1
- package/dist/headless-CEtk5dzV.js.map +0 -1
- package/dist/index-DEqGfnZr.d.ts.map +0 -1
- package/dist/login-C8Kc4gH0.js.map +0 -1
- package/dist/mcp-Kqzz-Rs_.js.map +0 -1
- package/dist/tools-dkB_jARJ.js.map +0 -1
- package/dist/transcript-anchors-BBN7jlvp.d.ts.map +0 -1
- package/dist/transcript-anchors-Cl7lbbeP.js.map +0 -1
|
@@ -6,7 +6,7 @@ import { t as reconcileImageMediaType } from "./image-sniff-B7uFSNO1.js";
|
|
|
6
6
|
import { n as createProcessContext } from "./contexts-BD2U_xpi.js";
|
|
7
7
|
import { n as toolOutputByteLength, t as DEFAULT_AGENT_CLOCK } from "./types-BPw_i5vb.js";
|
|
8
8
|
import { b as escapeXml, f as installAllowedToolsGate, g as validateResourcePath, n as resolveSkills, t as interpolateShellCommands, u as buildCatalog, y as createSkillActivationState } from "./interpolate-TySiqKzc.js";
|
|
9
|
-
import {
|
|
9
|
+
import { n as connectMcpServers } from "./mcp-Br3b1Xm3.js";
|
|
10
10
|
import { n as flattenTurns, r as formatTokenUsage, t as effectiveInputFromTurn } from "./stats-DAKBEKjc.js";
|
|
11
11
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
12
12
|
import { createHooks } from "hookable";
|
|
@@ -1382,6 +1382,18 @@ function resolveTasksDir(opts) {
|
|
|
1382
1382
|
return join(opts.userDir, opts.sessionId, "tasks");
|
|
1383
1383
|
}
|
|
1384
1384
|
/**
|
|
1385
|
+
* Resolve the per-session MCP diagnostic directory under
|
|
1386
|
+
* `<userDir>/<sessionId>/mcp-warnings/`.
|
|
1387
|
+
*
|
|
1388
|
+
* Warning logs are cache/session artifacts like background task logs:
|
|
1389
|
+
* useful for debugging, safe to delete, and cleaned up with the session.
|
|
1390
|
+
*/
|
|
1391
|
+
function resolveMcpWarningsDir(opts) {
|
|
1392
|
+
if (!isAbsolute(opts.userDir)) throw new Error(`resolveMcpWarningsDir: userDir must be absolute, got "${opts.userDir}"`);
|
|
1393
|
+
if (!opts.sessionId) throw new Error("resolveMcpWarningsDir: sessionId must be a non-empty string");
|
|
1394
|
+
return join(opts.userDir, opts.sessionId, "mcp-warnings");
|
|
1395
|
+
}
|
|
1396
|
+
/**
|
|
1385
1397
|
* Decide-and-persist for a single tool result. Pure decision + filesystem
|
|
1386
1398
|
* side-effect; returns the new wire-level `output` string when substitution
|
|
1387
1399
|
* happened, otherwise tells the caller to leave the result alone.
|
|
@@ -3643,6 +3655,183 @@ function buildPromptMessage(provider, parts) {
|
|
|
3643
3655
|
return defaultPromptMessage(parts);
|
|
3644
3656
|
}
|
|
3645
3657
|
//#endregion
|
|
3658
|
+
//#region src/repeat-guard.ts
|
|
3659
|
+
const DEFAULT_BLOCK_THRESHOLD = 4;
|
|
3660
|
+
const DEFAULT_ABORT_THRESHOLD = 8;
|
|
3661
|
+
/**
|
|
3662
|
+
* Default tracked-tool predicate: `shell` exactly, plus any tool whose
|
|
3663
|
+
* canonical name ends in `_execute_sql` (the MCP SQL-runner shape,
|
|
3664
|
+
* `mcp_<server>_execute_sql`). Both are auto-approved, side-effect-light
|
|
3665
|
+
* retry magnets — the exact loop shapes the abort escalation exists for.
|
|
3666
|
+
*/
|
|
3667
|
+
function defaultRepeatGuardTracked(name) {
|
|
3668
|
+
return name === "shell" || name.endsWith("_execute_sql");
|
|
3669
|
+
}
|
|
3670
|
+
function compileMatchers(tools) {
|
|
3671
|
+
if (tools === void 0) return defaultRepeatGuardTracked;
|
|
3672
|
+
if (tools.length === 0) return () => false;
|
|
3673
|
+
const exact = /* @__PURE__ */ new Set();
|
|
3674
|
+
const fns = [];
|
|
3675
|
+
for (const m of tools) if (typeof m === "string") exact.add(m);
|
|
3676
|
+
else fns.push(m);
|
|
3677
|
+
return (name) => {
|
|
3678
|
+
if (exact.has(name)) return true;
|
|
3679
|
+
for (const fn of fns) try {
|
|
3680
|
+
if (fn(name)) return true;
|
|
3681
|
+
} catch {}
|
|
3682
|
+
return false;
|
|
3683
|
+
};
|
|
3684
|
+
}
|
|
3685
|
+
/**
|
|
3686
|
+
* Canonicalize a shell command so semantically-identical invocations collapse
|
|
3687
|
+
* to one streak key:
|
|
3688
|
+
*
|
|
3689
|
+
* - strip a leading `cd <path> &&` (or `cd <path>;`) prefix — the model often
|
|
3690
|
+
* re-prefixes the same command with a `cd` into the project root.
|
|
3691
|
+
* - strip a trailing verify-tail of the shape `& sleep N ; <anything>` or
|
|
3692
|
+
* `; sleep N && <anything>` that the model appends to poll a just-started
|
|
3693
|
+
* process (`… & sleep 2 ; curl localhost`).
|
|
3694
|
+
* - collapse runs of whitespace to single spaces and trim.
|
|
3695
|
+
*
|
|
3696
|
+
* Conservative on purpose: it does NOT reorder flags or parse the command —
|
|
3697
|
+
* it only removes the two wrappers we actually saw inflate distinct-looking
|
|
3698
|
+
* retries of the same core command, plus whitespace noise.
|
|
3699
|
+
*/
|
|
3700
|
+
function normalizeShellCommand(command) {
|
|
3701
|
+
let s = command.trim();
|
|
3702
|
+
for (;;) {
|
|
3703
|
+
const m = /^cd\s+(?:"[^"]*"|'[^']*'|\S+)\s*(?:&&|;)\s*/.exec(s);
|
|
3704
|
+
if (!m) break;
|
|
3705
|
+
s = s.slice(m[0].length);
|
|
3706
|
+
}
|
|
3707
|
+
s = s.replace(/\s*(?:&&|&|;)\s*sleep\s+\d+(?:\.\d+)?\s*(?:&&|&|;)\s.*$/i, "");
|
|
3708
|
+
s = s.replace(/\s*(?:&&|&|;)\s*sleep\s+\d+(?:\.\d+)?\s*$/i, "");
|
|
3709
|
+
s = s.replace(/\s+/g, " ").trim();
|
|
3710
|
+
return s;
|
|
3711
|
+
}
|
|
3712
|
+
/**
|
|
3713
|
+
* Built-in normalizer used when the consumer doesn't supply one. Shell-shaped
|
|
3714
|
+
* tools get {@link normalizeShellCommand}; SQL-runner tools get a whitespace-
|
|
3715
|
+
* collapsed query; everything else falls back to a stable JSON encoding.
|
|
3716
|
+
* Returns `undefined` when there's no meaningful payload to key on (so the
|
|
3717
|
+
* call is excluded from streak tracking rather than keyed on `'{}'`).
|
|
3718
|
+
*/
|
|
3719
|
+
function defaultRepeatGuardNormalize(name, input) {
|
|
3720
|
+
if (name === "shell") {
|
|
3721
|
+
const cmd = input.command;
|
|
3722
|
+
if (typeof cmd !== "string" || cmd.trim().length === 0) return void 0;
|
|
3723
|
+
return `shell:${normalizeShellCommand(cmd)}`;
|
|
3724
|
+
}
|
|
3725
|
+
if (name.endsWith("_execute_sql")) {
|
|
3726
|
+
const q = input.query ?? input.sql ?? input.statement;
|
|
3727
|
+
if (typeof q !== "string" || q.trim().length === 0) return void 0;
|
|
3728
|
+
return `sql:${q.replace(/\s+/g, " ").trim().toLowerCase()}`;
|
|
3729
|
+
}
|
|
3730
|
+
try {
|
|
3731
|
+
return `json:${stableStringify(input)}`;
|
|
3732
|
+
} catch {
|
|
3733
|
+
return;
|
|
3734
|
+
}
|
|
3735
|
+
}
|
|
3736
|
+
/** Deterministic JSON with sorted keys so key order doesn't split a streak. */
|
|
3737
|
+
function stableStringify(value) {
|
|
3738
|
+
return JSON.stringify(value, (_k, v) => {
|
|
3739
|
+
if (v && typeof v === "object" && !Array.isArray(v)) {
|
|
3740
|
+
const sorted = {};
|
|
3741
|
+
for (const k of Object.keys(v).sort()) sorted[k] = v[k];
|
|
3742
|
+
return sorted;
|
|
3743
|
+
}
|
|
3744
|
+
return v;
|
|
3745
|
+
});
|
|
3746
|
+
}
|
|
3747
|
+
function formatBlockReason(reason, name, count) {
|
|
3748
|
+
if (typeof reason === "string") return reason;
|
|
3749
|
+
if (typeof reason === "function") try {
|
|
3750
|
+
const out = reason(name, count);
|
|
3751
|
+
if (typeof out === "string" && out.length > 0) return out;
|
|
3752
|
+
} catch {}
|
|
3753
|
+
return `Identical \`${name}\` call repeated ${count} times in a row. This is not making progress — do NOT retry the same payload. Change the command/arguments, inspect why it's failing first, or move on to a different step.`;
|
|
3754
|
+
}
|
|
3755
|
+
/**
|
|
3756
|
+
* Install the consecutive-identical repeat guard on a hook bus.
|
|
3757
|
+
*
|
|
3758
|
+
* `getConfig` returns the resolved `behavior.repeatGuard` (run override merged
|
|
3759
|
+
* with agent defaults), called lazily so a config attached after install
|
|
3760
|
+
* still takes effect. `abort` is bound to the agent's `AbortController` — the
|
|
3761
|
+
* gate calls it at the abort threshold and the loop's existing post-turn
|
|
3762
|
+
* `signal.aborted` check terminates the run (mirrors how `toolBudgets`
|
|
3763
|
+
* receives `enqueueSteer` rather than reaching into the loop).
|
|
3764
|
+
*
|
|
3765
|
+
* Returns an `uninstall` fn — the agent calls it in `finally` so handlers and
|
|
3766
|
+
* streak state never leak across runs.
|
|
3767
|
+
*/
|
|
3768
|
+
function installRepeatGuard(hooks, getConfig, abort) {
|
|
3769
|
+
const streaks = /* @__PURE__ */ new Map();
|
|
3770
|
+
function streakKey(runId, name) {
|
|
3771
|
+
return `${runId ?? "-"}::${name}`;
|
|
3772
|
+
}
|
|
3773
|
+
function resolve(config) {
|
|
3774
|
+
const blockThreshold = Math.max(2, Math.floor(typeof config.blockThreshold === "number" && Number.isFinite(config.blockThreshold) ? config.blockThreshold : DEFAULT_BLOCK_THRESHOLD));
|
|
3775
|
+
const rawAbort = typeof config.abortThreshold === "number" && Number.isFinite(config.abortThreshold) ? config.abortThreshold : DEFAULT_ABORT_THRESHOLD;
|
|
3776
|
+
const abortThreshold = rawAbort > 0 ? Math.max(blockThreshold + 1, Math.floor(rawAbort)) : Infinity;
|
|
3777
|
+
return {
|
|
3778
|
+
isTracked: compileMatchers(config.tools),
|
|
3779
|
+
normalize: config.normalize ?? defaultRepeatGuardNormalize,
|
|
3780
|
+
blockThreshold,
|
|
3781
|
+
abortThreshold
|
|
3782
|
+
};
|
|
3783
|
+
}
|
|
3784
|
+
async function gateHandler(ctx) {
|
|
3785
|
+
if (ctx.block || ctx.result !== void 0) return;
|
|
3786
|
+
const config = getConfig();
|
|
3787
|
+
if (!config) return;
|
|
3788
|
+
const { isTracked, normalize, blockThreshold, abortThreshold } = resolve(config);
|
|
3789
|
+
if (!isTracked(ctx.name)) return;
|
|
3790
|
+
let key;
|
|
3791
|
+
try {
|
|
3792
|
+
key = normalize(ctx.name, ctx.input);
|
|
3793
|
+
} catch {
|
|
3794
|
+
return;
|
|
3795
|
+
}
|
|
3796
|
+
if (typeof key !== "string" || key.length === 0) return;
|
|
3797
|
+
const slot = streakKey(ctx.runId, ctx.name);
|
|
3798
|
+
const prior = streaks.get(slot);
|
|
3799
|
+
const count = prior && prior.key === key ? prior.count + 1 : 1;
|
|
3800
|
+
streaks.set(slot, {
|
|
3801
|
+
key,
|
|
3802
|
+
count
|
|
3803
|
+
});
|
|
3804
|
+
if (count < blockThreshold) return;
|
|
3805
|
+
if (count >= abortThreshold) {
|
|
3806
|
+
ctx.block = true;
|
|
3807
|
+
ctx.reason = formatBlockReason(config.blockReason, ctx.name, count);
|
|
3808
|
+
await hooks.callHook("repeat-guard:exceeded", {
|
|
3809
|
+
tool: ctx.name,
|
|
3810
|
+
count,
|
|
3811
|
+
threshold: abortThreshold,
|
|
3812
|
+
turnId: ctx.turnId,
|
|
3813
|
+
action: "abort"
|
|
3814
|
+
});
|
|
3815
|
+
abort();
|
|
3816
|
+
return;
|
|
3817
|
+
}
|
|
3818
|
+
ctx.block = true;
|
|
3819
|
+
ctx.reason = formatBlockReason(config.blockReason, ctx.name, count);
|
|
3820
|
+
await hooks.callHook("repeat-guard:exceeded", {
|
|
3821
|
+
tool: ctx.name,
|
|
3822
|
+
count,
|
|
3823
|
+
threshold: blockThreshold,
|
|
3824
|
+
turnId: ctx.turnId,
|
|
3825
|
+
action: "block"
|
|
3826
|
+
});
|
|
3827
|
+
}
|
|
3828
|
+
const unregister = hooks.hook("tool:gate", gateHandler);
|
|
3829
|
+
return function uninstall() {
|
|
3830
|
+
unregister();
|
|
3831
|
+
streaks.clear();
|
|
3832
|
+
};
|
|
3833
|
+
}
|
|
3834
|
+
//#endregion
|
|
3646
3835
|
//#region src/tool-budgets.ts
|
|
3647
3836
|
/**
|
|
3648
3837
|
* Install the per-tool soft-budget middleware on a hook bus.
|
|
@@ -4790,6 +4979,7 @@ const HOOK_EVENT_SET = new Set([
|
|
|
4790
4979
|
"child:turn:after",
|
|
4791
4980
|
"mcp:connect",
|
|
4792
4981
|
"mcp:error",
|
|
4982
|
+
"mcp:warn",
|
|
4793
4983
|
"mcp:close",
|
|
4794
4984
|
"mcp:bootstrap:start",
|
|
4795
4985
|
"mcp:bootstrap:end",
|
|
@@ -4815,6 +5005,7 @@ const HOOK_EVENT_SET = new Set([
|
|
|
4815
5005
|
"output",
|
|
4816
5006
|
"budget:exceeded",
|
|
4817
5007
|
"tool-budget:exceeded",
|
|
5008
|
+
"repeat-guard:exceeded",
|
|
4818
5009
|
"pairing:repair",
|
|
4819
5010
|
"tracing:redact",
|
|
4820
5011
|
"agent:abort",
|
|
@@ -4905,6 +5096,7 @@ function resolveBehavior(agentBehavior, runBehavior) {
|
|
|
4905
5096
|
dedupTools: runBehavior?.dedupTools ?? agentBehavior?.dedupTools,
|
|
4906
5097
|
requireReadBeforeEdit: runBehavior?.requireReadBeforeEdit ?? agentBehavior?.requireReadBeforeEdit,
|
|
4907
5098
|
toolBudgets: runBehavior?.toolBudgets ?? agentBehavior?.toolBudgets,
|
|
5099
|
+
repeatGuard: runBehavior?.repeatGuard ?? agentBehavior?.repeatGuard,
|
|
4908
5100
|
readLineNumbers: runBehavior?.readLineNumbers ?? agentBehavior?.readLineNumbers,
|
|
4909
5101
|
elideStaleReads: runBehavior?.elideStaleReads ?? agentBehavior?.elideStaleReads,
|
|
4910
5102
|
toolDisclosure: runBehavior?.toolDisclosure ?? agentBehavior?.toolDisclosure ?? "eager",
|
|
@@ -4917,7 +5109,8 @@ function resolveBehavior(agentBehavior, runBehavior) {
|
|
|
4917
5109
|
tasksDir: runBehavior?.tasksDir ?? agentBehavior?.tasksDir,
|
|
4918
5110
|
disableBackgroundTasks: runBehavior?.disableBackgroundTasks ?? agentBehavior?.disableBackgroundTasks,
|
|
4919
5111
|
strictToolPairing: runBehavior?.strictToolPairing ?? agentBehavior?.strictToolPairing ?? false,
|
|
4920
|
-
maxConsecutivePauseTurns: runBehavior?.maxConsecutivePauseTurns ?? agentBehavior?.maxConsecutivePauseTurns
|
|
5112
|
+
maxConsecutivePauseTurns: runBehavior?.maxConsecutivePauseTurns ?? agentBehavior?.maxConsecutivePauseTurns,
|
|
5113
|
+
persistTurns: runBehavior?.persistTurns ?? agentBehavior?.persistTurns
|
|
4921
5114
|
};
|
|
4922
5115
|
}
|
|
4923
5116
|
/**
|
|
@@ -5291,7 +5484,7 @@ function createAgent({ provider, name: agentName, system: agentSystem, tools: ag
|
|
|
5291
5484
|
const thinking = options.thinking ?? "off";
|
|
5292
5485
|
const model = options.model ?? provider.meta.defaultModel;
|
|
5293
5486
|
const resolvedBehavior = resolveBehavior(agentBehavior, options.behavior);
|
|
5294
|
-
const { maxConcurrentTools, maxTurns, maxCostUsd, maxTotalTokens, maxTokens, retry, thinkingBudget, modelOptions: behaviorModelOptions, schema, cache, toolOutputBudget, toolOutputBudgetExcludeTools, compactStrategy, compactThreshold, compactKeepTurns, thinkingDecay, dedupTools, toolBudgets, elideStaleReads, toolDisclosure, toolSearch, surfaceMcpInstructions, persistThreshold, persistExcludeTools, persistDir, persistMaxBytes, strictToolPairing, maxConsecutivePauseTurns } = resolvedBehavior;
|
|
5487
|
+
const { maxConcurrentTools, maxTurns, maxCostUsd, maxTotalTokens, maxTokens, retry, thinkingBudget, modelOptions: behaviorModelOptions, schema, cache, toolOutputBudget, toolOutputBudgetExcludeTools, compactStrategy, compactThreshold, compactKeepTurns, thinkingDecay, dedupTools, toolBudgets, repeatGuard, elideStaleReads, toolDisclosure, toolSearch, surfaceMcpInstructions, persistThreshold, persistExcludeTools, persistDir, persistMaxBytes, strictToolPairing, maxConsecutivePauseTurns, persistTurns } = resolvedBehavior;
|
|
5295
5488
|
const modelOptions = options.modelOptions ?? behaviorModelOptions;
|
|
5296
5489
|
let system = options.system || agentSystem || "You are a helpful assistant.";
|
|
5297
5490
|
const baseSystemForBreakdown = renderSystemForWire(system);
|
|
@@ -5493,8 +5686,9 @@ function createAgent({ provider, name: agentName, system: agentSystem, tools: ag
|
|
|
5493
5686
|
count: turns.length
|
|
5494
5687
|
});
|
|
5495
5688
|
};
|
|
5496
|
-
const
|
|
5497
|
-
const
|
|
5689
|
+
const perTurnSync = session && persistTurns !== false;
|
|
5690
|
+
const unregisterTurnSync = perTurnSync ? hooks.hook("turn:after", persistPendingTurns) : void 0;
|
|
5691
|
+
const unregisterToolResultsSync = perTurnSync ? hooks.hook("tool-results:after", persistPendingTurns) : void 0;
|
|
5498
5692
|
async function flushTurns(opts = {}) {
|
|
5499
5693
|
if (!session) return;
|
|
5500
5694
|
if (opts.failureFallback) await synthesizeMissingToolResults(turns, await session.generateTurnId?.() ?? clock.randomUUID(), runId, provider, hooks, clock);
|
|
@@ -5529,6 +5723,7 @@ function createAgent({ provider, name: agentName, system: agentSystem, tools: ag
|
|
|
5529
5723
|
}
|
|
5530
5724
|
const uninstallAllowedToolsGate = installAllowedToolsGate(hooks, skillActivationState);
|
|
5531
5725
|
const uninstallToolBudgets = installToolBudgetsGate(hooks, () => toolBudgets, (msg) => steeringQueue.push(msg));
|
|
5726
|
+
const uninstallRepeatGuard = installRepeatGuard(hooks, () => repeatGuard, () => abortController?.abort());
|
|
5532
5727
|
const uninstallDedupTools = installDedupToolsGate(hooks, () => dedupTools, () => session ?? void 0);
|
|
5533
5728
|
const uninstallLazyDisclosureGate = installLazyDisclosureGate(hooks, disclosure.lazyCanonicalNames, unlocked, discoveryToolName);
|
|
5534
5729
|
const runStartMs = await clock.now();
|
|
@@ -5674,6 +5869,7 @@ function createAgent({ provider, name: agentName, system: agentSystem, tools: ag
|
|
|
5674
5869
|
await deactivateAllSkills();
|
|
5675
5870
|
uninstallAllowedToolsGate();
|
|
5676
5871
|
uninstallDedupTools();
|
|
5872
|
+
uninstallRepeatGuard();
|
|
5677
5873
|
uninstallToolBudgets();
|
|
5678
5874
|
uninstallLazyDisclosureGate();
|
|
5679
5875
|
unregisterSpawnHook();
|
|
@@ -7482,10 +7678,18 @@ const writeFile$1 = {
|
|
|
7482
7678
|
const bytes = Buffer.byteLength(targetContent);
|
|
7483
7679
|
if (existing === targetContent) return `No change needed: ${targetPath} already at target state (${bytes} bytes).`;
|
|
7484
7680
|
await ctx.execution.writeFile(ctx.handle, targetPath, targetContent);
|
|
7681
|
+
const readState = resolveReadStateMap(ctx);
|
|
7682
|
+
if (readState) readState.set(readStateKey(ctx.handle.cwd, targetPath), {
|
|
7683
|
+
contentHash: hashContent(targetContent),
|
|
7684
|
+
offset: 0,
|
|
7685
|
+
limit: Number.POSITIVE_INFINITY,
|
|
7686
|
+
maxBytes: Number.POSITIVE_INFINITY,
|
|
7687
|
+
mtimeMs: Date.now()
|
|
7688
|
+
});
|
|
7485
7689
|
return existing === void 0 ? `Created ${targetPath} (${bytes} bytes).` : `Updated ${targetPath} (${bytes} bytes).`;
|
|
7486
7690
|
}
|
|
7487
7691
|
};
|
|
7488
7692
|
//#endregion
|
|
7489
|
-
export {
|
|
7693
|
+
export { resolveTasksDir as A, effectiveContextWindow as B, PERSISTED_STUB_PREFIX as C, maybePersistToolResult as D, cleanupPersistedSession as E, BUILTIN_PROVIDERS as F, modelOptionsFor as G, getContextWindow as H, OUTPUT_RESERVE_TOKENS as I, openaiDescriptor as J, modelSupportsReasoning as K, anthropicDescriptor as L, hashContent as M, readStateKey as N, resolveMcpWarningsDir as O, resolveReadStateMap as P, cerebrasDescriptor as R, validateToolArgs as S, buildPersistedStub as T, getModelInfo as U, enabledModelOptions as V, localDescriptor as W, piIdOf as X, openrouterDescriptor as Y, restoreModelOptions as Z, shell as _, multiEdit as a, TOOL_USE_CANCELLED_MESSAGE as b, grep as c, createAgent as d, createToolSearchTool as f, createShellTool as g, createSkillsReadTool as h, readFile$1 as i, getReadState as j, resolvePersistDir as k, glob$1 as l, createSkillsRunScriptTool as m, createSpawnTool as n, listFiles as o, createSkillsUseTool as p, modelsForDescriptor as q, shellKill as r, createInteractionTool as s, writeFile$1 as t, edit as u, INTERRUPT_MESSAGE_FOR_TOOL_USE as v, PERSISTENCE_PREVIEW_BYTES as w, TOOL_USE_SKIPPED_MESSAGE as x, SHELL_CASCADE_CANCEL_MESSAGE as y, credKeyOf as z };
|
|
7490
7694
|
|
|
7491
|
-
//# sourceMappingURL=tools-
|
|
7695
|
+
//# sourceMappingURL=tools-BzQtic6M.js.map
|