zidane 7.0.30 → 7.0.32
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 +2 -2
- package/dist/{acp-Cu879kus.js → acp-bBDF-dhy.js} +2 -2
- package/dist/{acp-Cu879kus.js.map → acp-bBDF-dhy.js.map} +1 -1
- package/dist/acp-cli.js +3 -3
- package/dist/acp.d.ts +1 -1
- package/dist/acp.js +1 -1
- package/dist/{agent-BipX4BBj.js → agent-BCG9JcZl.js} +199 -31
- package/dist/agent-BCG9JcZl.js.map +1 -0
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +1 -1
- package/dist/{approvals-staFZZ5o.js → approvals-DkwGBMZ9.js} +372 -19
- package/dist/approvals-DkwGBMZ9.js.map +1 -0
- package/dist/{auth-D4MpTfvF.js → auth-D0BHBb02.js} +2 -2
- package/dist/{auth-D4MpTfvF.js.map → auth-D0BHBb02.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 +6 -6
- package/dist/{context-transport-BqYwzJYE.js → context-transport-T_6AYIvy.js} +2 -2
- package/dist/{context-transport-BqYwzJYE.js.map → context-transport-T_6AYIvy.js.map} +1 -1
- package/dist/contexts/daytona.d.ts +1 -1
- package/dist/contexts/e2b.d.ts +1 -1
- package/dist/daemon-cli.js +1 -1
- package/dist/eval.d.ts +1 -1
- package/dist/extensions.d.ts +2 -2
- package/dist/extensions.js +2 -2
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +1 -1
- package/dist/{index-C0y2tSgk.d.ts → index-CCB05-JZ.d.ts} +104 -10
- package/dist/index-CCB05-JZ.d.ts.map +1 -0
- package/dist/{index-CnXKeZ8p.d.ts → index-Ogi2CeHf.d.ts} +179 -6
- package/dist/index-Ogi2CeHf.d.ts.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/{ipc-CbkrpfkI.js → ipc-C10lnS-a.js} +2 -2
- package/dist/{ipc-CbkrpfkI.js.map → ipc-C10lnS-a.js.map} +1 -1
- package/dist/ipc.d.ts +5 -5
- package/dist/ipc.js +3 -3
- package/dist/{mcp-BIWa57eY.js → mcp-CgNd-f3F.js} +3 -3
- package/dist/{mcp-BIWa57eY.js.map → mcp-CgNd-f3F.js.map} +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +1 -1
- package/dist/output/stream-json.d.ts +1 -1
- package/dist/output/terminal.d.ts +1 -1
- package/dist/plugins.d.ts +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/presets.js +1 -1
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/arcee.d.ts +1 -1
- package/dist/providers/baseten.d.ts +1 -1
- package/dist/providers/cerebras.d.ts +1 -1
- package/dist/providers/local.d.ts +1 -1
- package/dist/providers/openai-compat.d.ts +1 -1
- package/dist/providers/openai.d.ts +1 -1
- package/dist/providers/openrouter.d.ts +1 -1
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/restate.d.ts +1 -1
- package/dist/restate.js +1 -1
- package/dist/{server-GJ2gNRt_.js → server--mwNA7oC.js} +7 -7
- package/dist/{server-GJ2gNRt_.js.map → server--mwNA7oC.js.map} +1 -1
- package/dist/session/sqlite.d.ts +1 -1
- package/dist/session.d.ts +1 -1
- package/dist/skills.d.ts +1 -1
- package/dist/{src-DzzhE2YO.js → src-CjkY6fBj.js} +2 -2
- package/dist/{src-DzzhE2YO.js.map → src-CjkY6fBj.js.map} +1 -1
- package/dist/{stdio-loader-CI4sPFve.js → stdio-loader-Bbx19dMZ.js} +2 -2
- package/dist/{stdio-loader-CI4sPFve.js.map → stdio-loader-Bbx19dMZ.js.map} +1 -1
- package/dist/{tool-formatters-bbgUM3zI.d.ts → tool-formatters-Bu4repDJ.d.ts} +2 -2
- package/dist/{tool-formatters-bbgUM3zI.d.ts.map → tool-formatters-Bu4repDJ.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-BHyrChoO.d.ts → transcript-anchors-CJCxyVE-.d.ts} +8 -2
- package/dist/transcript-anchors-CJCxyVE-.d.ts.map +1 -0
- package/dist/tui.d.ts +3 -3
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +69 -14
- package/dist/tui.js.map +1 -1
- package/dist/{turn-operations-BgqpLlOG.js → turn-operations-HX3g3XIc.js} +11 -1
- package/dist/{turn-operations-BgqpLlOG.js.map → turn-operations-HX3g3XIc.js.map} +1 -1
- package/dist/{turn-operations-ZP5-2OWi.d.ts → turn-operations-qcv9UFcL.d.ts} +3 -3
- package/dist/{turn-operations-ZP5-2OWi.d.ts.map → turn-operations-qcv9UFcL.d.ts.map} +1 -1
- package/dist/types-CWgENVLY.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/docs/ARCHITECTURE.md +11 -2
- package/docs/CHAT.md +1 -0
- package/docs/INTERACTIONS.md +14 -2
- package/docs/SKILL.md +3 -1
- package/docs/TUI.md +5 -3
- package/package.json +1 -1
- package/dist/agent-BipX4BBj.js.map +0 -1
- package/dist/approvals-staFZZ5o.js.map +0 -1
- package/dist/index-C0y2tSgk.d.ts.map +0 -1
- package/dist/index-CnXKeZ8p.d.ts.map +0 -1
- package/dist/transcript-anchors-BHyrChoO.d.ts.map +0 -1
package/dist/acp-cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { m as openaiCompat } from "./openai-compat-Dy56weK8.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Ct as basic_default } from "./agent-BCG9JcZl.js";
|
|
4
4
|
import { r as createProcessContext } from "./contexts-BSFQVclW.js";
|
|
5
5
|
import { createSandboxContext } from "./contexts/sandbox.js";
|
|
6
6
|
import { p as resolveStorageDirs } from "./plugins-B531Tz5b.js";
|
|
@@ -11,8 +11,8 @@ 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-bBDF-dhy.js";
|
|
15
|
+
import { d as BUILTIN_PROVIDERS, i as readCredentials, m as credKeyOf, r as credentialsPath, t as detectAuth, x as modelsForDescriptor } from "./auth-D0BHBb02.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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Dg as McpServerConfig, Q_ as Session, Rg as PromptPart, Xi as AgentOptions, nv as SessionStore, qg as SessionContentBlock, qi as Agent, t as Preset, u_ as ToolResultContent, ug as AgentBehavior, vm as Provider, w_ as ToolDef, y_ as TurnUsage } from "./index-CCB05-JZ.js";
|
|
2
2
|
import { c as ExecutionContext } from "./types-U-rIVUDw.js";
|
|
3
3
|
import { Readable, Writable } from "node:stream";
|
|
4
4
|
|
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-bBDF-dhy.js";
|
|
3
3
|
export { AcpProtocolError, JsonRpcRemoteError, acpMcpServersToZidane, acpPromptToPromptParts, createAcpServer, createJsonRpcConnection, runAcpStdioServer, sessionBlocksToAcp, stopReasonFromRun, toolResultToAcpContent, withAcpDefaultTools, wrapToolsForAcpClient };
|
|
@@ -15,7 +15,7 @@ import { p as resolveStorageDirs, r as loadAgentPlugin } from "./plugins-B531Tz5
|
|
|
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
|
-
import { f as wrapDiscoveredMcpTools, i as deriveMcpToolMeta, n as connectMcpServers, s as nonOwningMcpView } from "./mcp-
|
|
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
21
|
import { a as getExtensionSessionState, c as setExtensionSessionState, l as withExtensionSession, n as currentExtensionSession, r as deleteExtensionSessionState, s as resumeChainRunIds } from "./session-CVy-2mAy.js";
|
|
@@ -1627,11 +1627,8 @@ const pullRequestKind = {
|
|
|
1627
1627
|
const meta = metaRecord(artifact);
|
|
1628
1628
|
const state = typeof meta.state === "string" ? meta.state : void 0;
|
|
1629
1629
|
const badges = [];
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
tone: "diff",
|
|
1633
|
-
...typeof meta.changedFiles === "number" ? { title: `${meta.changedFiles} file${meta.changedFiles === 1 ? "" : "s"} changed` } : {}
|
|
1634
|
-
});
|
|
1630
|
+
const diff = diffBadge(meta);
|
|
1631
|
+
if (diff) badges.push(diff);
|
|
1635
1632
|
if (typeof meta.reviews === "number" && meta.reviews > 0) badges.push({
|
|
1636
1633
|
text: `${meta.reviews} review${meta.reviews === 1 ? "" : "s"}`,
|
|
1637
1634
|
tone: "neutral"
|
|
@@ -1791,11 +1788,17 @@ const commitKind = {
|
|
|
1791
1788
|
else resolve(stdout.trim());
|
|
1792
1789
|
});
|
|
1793
1790
|
});
|
|
1791
|
+
const stats = await git("show", "--shortstat", "--format=", revision).then(parseShortstat, () => void 0);
|
|
1792
|
+
const prior = metaRecord(artifact);
|
|
1793
|
+
const base = {
|
|
1794
|
+
...prior,
|
|
1795
|
+
...stats
|
|
1796
|
+
};
|
|
1797
|
+
const patch = (meta) => sameFlatMeta(prior, meta) ? void 0 : { meta };
|
|
1794
1798
|
const unlink = () => {
|
|
1795
|
-
const meta = { ...
|
|
1796
|
-
if (meta.url === void 0) return void 0;
|
|
1799
|
+
const meta = { ...base };
|
|
1797
1800
|
delete meta.url;
|
|
1798
|
-
return
|
|
1801
|
+
return patch(meta);
|
|
1799
1802
|
};
|
|
1800
1803
|
try {
|
|
1801
1804
|
const origin = await git("remote", "get-url", "origin");
|
|
@@ -1804,11 +1807,11 @@ const commitKind = {
|
|
|
1804
1807
|
const sha = await git("rev-parse", "--verify", `${revision}^{commit}`);
|
|
1805
1808
|
if (!/^[0-9a-f]{40}$/.test(sha)) return unlink();
|
|
1806
1809
|
if (!await git("for-each-ref", `--contains=${sha}`, "--format=%(refname)", "refs/remotes/origin/")) return unlink();
|
|
1807
|
-
return {
|
|
1808
|
-
...
|
|
1810
|
+
return patch({
|
|
1811
|
+
...base,
|
|
1809
1812
|
sha,
|
|
1810
1813
|
url: `https://github.com/${repo[1]}/${repo[2]}/commit/${sha}`
|
|
1811
|
-
}
|
|
1814
|
+
});
|
|
1812
1815
|
} catch {
|
|
1813
1816
|
return unlink();
|
|
1814
1817
|
}
|
|
@@ -1820,10 +1823,39 @@ const commitKind = {
|
|
|
1820
1823
|
return {
|
|
1821
1824
|
title: artifact.label,
|
|
1822
1825
|
...sha || branch ? { subtitle: [sha, branch].filter(Boolean).join(" · ") } : {},
|
|
1823
|
-
...typeof meta.url === "string" && /^https:\/\/github\.com\/[\w.-]+\/[\w.-]+\/commit\/[0-9a-f]{40}$/.test(meta.url) ? { href: meta.url } : {}
|
|
1826
|
+
...typeof meta.url === "string" && /^https:\/\/github\.com\/[\w.-]+\/[\w.-]+\/commit\/[0-9a-f]{40}$/.test(meta.url) ? { href: meta.url } : {},
|
|
1827
|
+
...diffBadge(meta) ? { badges: [diffBadge(meta)] } : {}
|
|
1824
1828
|
};
|
|
1825
1829
|
}
|
|
1826
1830
|
};
|
|
1831
|
+
/**
|
|
1832
|
+
* `git show --shortstat --format=` → `{ additions, deletions, changedFiles }`
|
|
1833
|
+
* (` 4 files changed, 120 insertions(+), 8 deletions(-)`). Any missing
|
|
1834
|
+
* clause is 0; an empty stat (empty commit) is `undefined`.
|
|
1835
|
+
*/
|
|
1836
|
+
function parseShortstat(out) {
|
|
1837
|
+
const files = /(\d+) files? changed/.exec(out);
|
|
1838
|
+
if (!files) return void 0;
|
|
1839
|
+
return {
|
|
1840
|
+
changedFiles: Number(files[1]),
|
|
1841
|
+
additions: Number(/(\d+) insertions?\(\+\)/.exec(out)?.[1] ?? 0),
|
|
1842
|
+
deletions: Number(/(\d+) deletions?\(-\)/.exec(out)?.[1] ?? 0)
|
|
1843
|
+
};
|
|
1844
|
+
}
|
|
1845
|
+
/** Same keys, same primitive values — the commit meta is flat (sha, branch, message, url, stats). */
|
|
1846
|
+
function sameFlatMeta(a, b) {
|
|
1847
|
+
const keys = Object.keys(a);
|
|
1848
|
+
return keys.length === Object.keys(b).length && keys.every((key) => key in b && a[key] === b[key]);
|
|
1849
|
+
}
|
|
1850
|
+
/** The `+120 −8` badge shared by the PR and commit rows, from `additions` / `deletions` / `changedFiles` meta. */
|
|
1851
|
+
function diffBadge(meta) {
|
|
1852
|
+
if (typeof meta.additions !== "number" && typeof meta.deletions !== "number") return void 0;
|
|
1853
|
+
return {
|
|
1854
|
+
text: `+${meta.additions ?? 0} −${meta.deletions ?? 0}`,
|
|
1855
|
+
tone: "diff",
|
|
1856
|
+
...typeof meta.changedFiles === "number" ? { title: `${meta.changedFiles} file${meta.changedFiles === 1 ? "" : "s"} changed` } : {}
|
|
1857
|
+
};
|
|
1858
|
+
}
|
|
1827
1859
|
const branchKind = {
|
|
1828
1860
|
kind: ARTIFACT_KINDS.branch,
|
|
1829
1861
|
label: "Branch",
|
|
@@ -7108,11 +7140,19 @@ function applyToolSearchToUnlocked(catalog, input, unlocked, defaultLimit, addUn
|
|
|
7108
7140
|
*/
|
|
7109
7141
|
function createToolSearchTool(options) {
|
|
7110
7142
|
const defaultLimit = options.defaultLimit ?? DEFAULT_LIMIT;
|
|
7143
|
+
const dispatcher = options.dispatcherName;
|
|
7111
7144
|
return {
|
|
7112
7145
|
isConcurrencySafe: true,
|
|
7113
7146
|
spec: {
|
|
7114
7147
|
name: "tool_search",
|
|
7115
|
-
description:
|
|
7148
|
+
description: [
|
|
7149
|
+
"Discover and load schemas for additional tools listed in <searchable_tools>.",
|
|
7150
|
+
"Tools listed there are advertised by name + description only; their input",
|
|
7151
|
+
"schemas are not loaded into context until you surface them through this tool.",
|
|
7152
|
+
"Pass `query` for a substring search, `names` to load specific tools, or `server`",
|
|
7153
|
+
"to load every tool from one MCP server.",
|
|
7154
|
+
dispatcher ? `Returned tools become callable through \`${dispatcher}\` (name + arguments) for the rest of this run.` : "Returned tools become callable for the rest of this run."
|
|
7155
|
+
].join(" "),
|
|
7116
7156
|
inputSchema: {
|
|
7117
7157
|
type: "object",
|
|
7118
7158
|
properties: {
|
|
@@ -7154,7 +7194,7 @@ function createToolSearchTool(options) {
|
|
|
7154
7194
|
else {
|
|
7155
7195
|
for (const entry of shown) parts.push(formatMatch(entry));
|
|
7156
7196
|
parts.push("");
|
|
7157
|
-
parts.push(" These tools are now callable. Invoke them by name in subsequent turns.");
|
|
7197
|
+
parts.push(dispatcher ? ` These tools are now callable through \`${dispatcher}\`: pass the tool name as \`name\` and an object matching its schema as \`arguments\`.` : " These tools are now callable. Invoke them by name in subsequent turns.");
|
|
7158
7198
|
if (truncated) parts.push(` ${total - shown.length} additional matches were truncated; refine the query or raise \`limit\`.`);
|
|
7159
7199
|
}
|
|
7160
7200
|
if (misses.length > 0) parts.push(` <misses>${misses.map(escapeXml).join(", ")}</misses>`);
|
|
@@ -11666,6 +11706,72 @@ function textForPersistence(output) {
|
|
|
11666
11706
|
return parts.join("\n");
|
|
11667
11707
|
}
|
|
11668
11708
|
//#endregion
|
|
11709
|
+
//#region src/tools/call-tool.ts
|
|
11710
|
+
const CALL_TOOL_NAME = "call_tool";
|
|
11711
|
+
/**
|
|
11712
|
+
* Unwrap a `call_tool` envelope. `null` when `name` is not the dispatcher or
|
|
11713
|
+
* the envelope is malformed (missing / non-string `name`, non-object
|
|
11714
|
+
* `arguments`) — callers then treat the call as a plain `call_tool` call and
|
|
11715
|
+
* let the dispatcher's own schema validation produce the error the model
|
|
11716
|
+
* needs to fix its input.
|
|
11717
|
+
*
|
|
11718
|
+
* `arguments` may be omitted for zero-argument tools: it defaults to `{}`.
|
|
11719
|
+
*/
|
|
11720
|
+
function unwrapCallTool(name, input) {
|
|
11721
|
+
if (name !== "call_tool") return null;
|
|
11722
|
+
if (!input || typeof input !== "object" || Array.isArray(input)) return null;
|
|
11723
|
+
const { name: inner, arguments: args } = input;
|
|
11724
|
+
if (typeof inner !== "string" || inner.length === 0) return null;
|
|
11725
|
+
if (args === void 0) return {
|
|
11726
|
+
name: inner,
|
|
11727
|
+
input: {}
|
|
11728
|
+
};
|
|
11729
|
+
if (!args || typeof args !== "object" || Array.isArray(args)) return null;
|
|
11730
|
+
return {
|
|
11731
|
+
name: inner,
|
|
11732
|
+
input: args
|
|
11733
|
+
};
|
|
11734
|
+
}
|
|
11735
|
+
/**
|
|
11736
|
+
* Build the dispatcher ToolDef. The loop rewrites every envelope around a
|
|
11737
|
+
* lazy catalog tool into the inner call before dispatch, so `execute` only
|
|
11738
|
+
* runs for envelopes it refused: an inner tool that is not a catalog entry
|
|
11739
|
+
* (eager tools are called directly, so their history stays scannable by
|
|
11740
|
+
* name) or a malformed shape that slipped past schema validation.
|
|
11741
|
+
*/
|
|
11742
|
+
function createCallToolTool(options = {}) {
|
|
11743
|
+
const discovery = options.discoveryToolName ?? "tool_search";
|
|
11744
|
+
const isDispatchable = options.isDispatchable ?? (() => true);
|
|
11745
|
+
return {
|
|
11746
|
+
isConcurrencySafe: false,
|
|
11747
|
+
spec: {
|
|
11748
|
+
name: CALL_TOOL_NAME,
|
|
11749
|
+
description: `Invoke a tool listed in <searchable_tools>. Load its schema with \`${discovery}\` first (the result shows the exact \`name\` and input schema), then call it here with \`name\` set to that tool name and \`arguments\` set to an object matching its schema. Arguments are validated against the tool's own schema; a validation error names the offending field.`,
|
|
11750
|
+
inputSchema: {
|
|
11751
|
+
type: "object",
|
|
11752
|
+
properties: {
|
|
11753
|
+
name: {
|
|
11754
|
+
type: "string",
|
|
11755
|
+
description: "Tool name exactly as shown in <searchable_tools> / the tool_search result."
|
|
11756
|
+
},
|
|
11757
|
+
arguments: {
|
|
11758
|
+
type: "object",
|
|
11759
|
+
description: "Input for the tool, matching its schema. Omit for zero-argument tools.",
|
|
11760
|
+
additionalProperties: true
|
|
11761
|
+
}
|
|
11762
|
+
},
|
|
11763
|
+
required: ["name"],
|
|
11764
|
+
additionalProperties: false
|
|
11765
|
+
}
|
|
11766
|
+
},
|
|
11767
|
+
async execute(input) {
|
|
11768
|
+
const target = input.name;
|
|
11769
|
+
if (typeof target === "string" && target.length > 0 && !isDispatchable(target)) throw new Error(`call_tool: "${target}" is not listed in <searchable_tools>. Call it directly by name if it is one of your tools; call_tool is only for surfaced catalog tools.`);
|
|
11770
|
+
throw new Error(`call_tool: malformed envelope for ${typeof target === "string" ? `"${target}"` : "unknown tool"}: expected \`name\` (string) and optional \`arguments\` (object).`);
|
|
11771
|
+
}
|
|
11772
|
+
};
|
|
11773
|
+
}
|
|
11774
|
+
//#endregion
|
|
11669
11775
|
//#region src/loop.ts
|
|
11670
11776
|
const DEFAULT_PROVIDER_STREAM_START_TIMEOUT_MS = 300 * 1e3;
|
|
11671
11777
|
const DEFAULT_PROVIDER_STREAM_TIMEOUT_MS = 1800 * 1e3;
|
|
@@ -13957,6 +14063,7 @@ async function executeTurn(ctx, turn, priorUsage) {
|
|
|
13957
14063
|
})).catch(() => {});
|
|
13958
14064
|
}
|
|
13959
14065
|
}
|
|
14066
|
+
canonicalToolCalls = unwrapDispatchCalls(ctx, canonicalToolCalls);
|
|
13960
14067
|
if (turnTtftMs !== void 0 && result.usage.timeToFirstTokenMs === void 0) result.usage.timeToFirstTokenMs = turnTtftMs;
|
|
13961
14068
|
if (result.usage.streamDurationMs === void 0) result.usage.streamDurationMs = Date.now() - streamStartedAt;
|
|
13962
14069
|
const assistantTurn = {
|
|
@@ -14258,6 +14365,31 @@ async function commitToolState(ctx, callId, toolName) {
|
|
|
14258
14365
|
if (!hookCtx.handled) console.error(`[zidane] tool state commit for ${toolName} (${callId}) failed; the write did NOT land, continuing:`, error);
|
|
14259
14366
|
}
|
|
14260
14367
|
}
|
|
14368
|
+
/**
|
|
14369
|
+
* Rewrite every well-formed `call_tool` envelope around a lazy catalog tool
|
|
14370
|
+
* into the inner call it carries (same `id`, inner wire name → canonical,
|
|
14371
|
+
* `arguments` → `input`). No-op unless the run is in dispatch mode
|
|
14372
|
+
* ({@link LoopContext.dispatcher}). Left as a `call_tool` call, so the
|
|
14373
|
+
* dispatcher itself answers: a malformed envelope (its schema validation
|
|
14374
|
+
* reports the shape error) and an inner name outside the catalog (its
|
|
14375
|
+
* `execute` says to call the tool directly, or that it does not exist).
|
|
14376
|
+
*/
|
|
14377
|
+
function unwrapDispatchCalls(ctx, calls) {
|
|
14378
|
+
const dispatcher = ctx.dispatcher;
|
|
14379
|
+
if (!dispatcher) return calls.slice();
|
|
14380
|
+
return calls.map((call) => {
|
|
14381
|
+
if (call.name !== dispatcher.name) return call;
|
|
14382
|
+
const inner = unwrapCallTool(call.name, call.input);
|
|
14383
|
+
if (!inner) return call;
|
|
14384
|
+
const canonical = toCanonicalName(inner.name, ctx.aliasMaps);
|
|
14385
|
+
if (!dispatcher.targets.has(canonical)) return call;
|
|
14386
|
+
return {
|
|
14387
|
+
...call,
|
|
14388
|
+
name: canonical,
|
|
14389
|
+
input: inner.input
|
|
14390
|
+
};
|
|
14391
|
+
});
|
|
14392
|
+
}
|
|
14261
14393
|
async function executeSingleTool(ctx, call, turnId) {
|
|
14262
14394
|
const toolDef = ctx.tools[call.name];
|
|
14263
14395
|
const callId = call.id;
|
|
@@ -15554,7 +15686,12 @@ function createToolStateController(store) {
|
|
|
15554
15686
|
views.delete(callId);
|
|
15555
15687
|
},
|
|
15556
15688
|
pending: (callId) => views.get(callId)?.[STAGED].pending() ?? [],
|
|
15557
|
-
snapshot: () => Object.fromEntries(snapshot)
|
|
15689
|
+
snapshot: () => Object.fromEntries(snapshot),
|
|
15690
|
+
committed: {
|
|
15691
|
+
get: (key) => snapshot.get(key),
|
|
15692
|
+
has: (key) => snapshot.has(key),
|
|
15693
|
+
keys: () => [...snapshot.keys()].sort()
|
|
15694
|
+
}
|
|
15558
15695
|
};
|
|
15559
15696
|
}
|
|
15560
15697
|
/**
|
|
@@ -16310,13 +16447,15 @@ function buildRunDisclosureState(input) {
|
|
|
16310
16447
|
};
|
|
16311
16448
|
const hostDefinedToolSearch = !!baseTools.tool_search;
|
|
16312
16449
|
const injectedToolSearch = !hasRunToolOverride && (toolDisclosure === "lazy" || disclosure.lazyEntries.length > 0) && toolSearch?.tool !== false && !hostDefinedToolSearch;
|
|
16450
|
+
const dispatchMode = injectedToolSearch && toolSearch?.mode === "dispatch" && disclosure.lazyEntries.length > 0 && !baseTools["call_tool"];
|
|
16313
16451
|
let tools = baseTools;
|
|
16314
16452
|
if (injectedToolSearch) {
|
|
16315
16453
|
const toolSearchTool = createToolSearchTool({
|
|
16316
16454
|
catalog: disclosure.lazyEntries,
|
|
16317
16455
|
unlocked,
|
|
16318
16456
|
addUnlock: recordUnlock,
|
|
16319
|
-
...toolSearch?.limit !== void 0 ? { defaultLimit: toolSearch.limit } : {}
|
|
16457
|
+
...toolSearch?.limit !== void 0 ? { defaultLimit: toolSearch.limit } : {},
|
|
16458
|
+
...dispatchMode ? { dispatcherName: CALL_TOOL_NAME } : {}
|
|
16320
16459
|
});
|
|
16321
16460
|
tools = {
|
|
16322
16461
|
...baseTools,
|
|
@@ -16324,6 +16463,19 @@ function buildRunDisclosureState(input) {
|
|
|
16324
16463
|
};
|
|
16325
16464
|
unlocked.add(toolSearchTool.spec.name);
|
|
16326
16465
|
initialUnlocked.add(toolSearchTool.spec.name);
|
|
16466
|
+
if (dispatchMode) {
|
|
16467
|
+
const lazyWireNames = new Set(disclosure.lazyEntries.map((entry) => entry.name));
|
|
16468
|
+
const callTool = createCallToolTool({
|
|
16469
|
+
discoveryToolName: toolSearchTool.spec.name,
|
|
16470
|
+
isDispatchable: (name) => lazyWireNames.has(name)
|
|
16471
|
+
});
|
|
16472
|
+
tools = {
|
|
16473
|
+
...tools,
|
|
16474
|
+
[CALL_TOOL_NAME]: callTool
|
|
16475
|
+
};
|
|
16476
|
+
unlocked.add(CALL_TOOL_NAME);
|
|
16477
|
+
initialUnlocked.add(CALL_TOOL_NAME);
|
|
16478
|
+
}
|
|
16327
16479
|
}
|
|
16328
16480
|
return {
|
|
16329
16481
|
disclosure,
|
|
@@ -16333,7 +16485,8 @@ function buildRunDisclosureState(input) {
|
|
|
16333
16485
|
recordUnlock,
|
|
16334
16486
|
tools,
|
|
16335
16487
|
injectedToolSearch,
|
|
16336
|
-
hostDefinedToolSearch
|
|
16488
|
+
hostDefinedToolSearch,
|
|
16489
|
+
dispatchMode
|
|
16337
16490
|
};
|
|
16338
16491
|
}
|
|
16339
16492
|
/**
|
|
@@ -16594,7 +16747,11 @@ function buildSearchableCatalog(entries, options) {
|
|
|
16594
16747
|
}
|
|
16595
16748
|
const serverNames = [...byServer.keys()].sort();
|
|
16596
16749
|
const parts = [];
|
|
16597
|
-
if (options.discoveryToolName)
|
|
16750
|
+
if (options.discoveryToolName) {
|
|
16751
|
+
parts.push("The following tools are available but their input schemas are NOT loaded in your context.", `Call the \`${options.discoveryToolName}\` tool to load schemas for any tool below that you have not already surfaced. Surfaced tools persist for the rest of the run.`);
|
|
16752
|
+
if (options.dispatcherName) parts.push(`Surfaced tools are invoked through \`${options.dispatcherName}\` with \`name\` set to the tool name and \`arguments\` matching the loaded schema; they are never added to your tool list directly.`);
|
|
16753
|
+
parts.push("");
|
|
16754
|
+
}
|
|
16598
16755
|
parts.push("<searchable_tools>");
|
|
16599
16756
|
for (const server of serverNames) {
|
|
16600
16757
|
parts.push(` <server name="${escapeXml(server)}">`);
|
|
@@ -16618,14 +16775,15 @@ function buildSearchableCatalog(entries, options) {
|
|
|
16618
16775
|
* Returns an uninstall function the run-end teardown calls so handlers
|
|
16619
16776
|
* never leak across runs.
|
|
16620
16777
|
*/
|
|
16621
|
-
function installLazyDisclosureGate(hooks, lazyCanonicalNames, unlocked, discoveryToolName) {
|
|
16778
|
+
function installLazyDisclosureGate(hooks, lazyCanonicalNames, unlocked, discoveryToolName, dispatcherName) {
|
|
16622
16779
|
if (lazyCanonicalNames.size === 0) return () => {};
|
|
16623
16780
|
return hooks.hook("tool:gate", (ctx) => {
|
|
16624
16781
|
if (ctx.block) return;
|
|
16625
16782
|
if (!lazyCanonicalNames.has(ctx.name)) return;
|
|
16626
16783
|
if (unlocked.has(ctx.name)) return;
|
|
16627
16784
|
ctx.block = true;
|
|
16628
|
-
|
|
16785
|
+
const reissue = dispatcherName ? `re-issue the call through \`${dispatcherName}\`` : "re-issue the call";
|
|
16786
|
+
ctx.reason = discoveryToolName ? `Tool "${ctx.name}" is listed in <searchable_tools> but its schema has not been loaded. Call the \`${discoveryToolName}\` tool with names: ["${ctx.name}"] first, then ${reissue}.` : `Tool "${ctx.name}" is listed in <searchable_tools> but its schema has not been loaded.`;
|
|
16629
16787
|
});
|
|
16630
16788
|
}
|
|
16631
16789
|
/**
|
|
@@ -17230,7 +17388,7 @@ function createAgent(rawOptions) {
|
|
|
17230
17388
|
executionContext,
|
|
17231
17389
|
behavior: resolvedBehavior
|
|
17232
17390
|
});
|
|
17233
|
-
const { disclosure, unlocked, initialUnlocked, dynamicUnlockOrder, recordUnlock: recordDynamicUnlock, tools, injectedToolSearch: shouldInjectToolSearch, hostDefinedToolSearch } = buildRunDisclosureState({
|
|
17391
|
+
const { disclosure, unlocked, initialUnlocked, dynamicUnlockOrder, recordUnlock: recordDynamicUnlock, tools, injectedToolSearch: shouldInjectToolSearch, hostDefinedToolSearch, dispatchMode } = buildRunDisclosureState({
|
|
17234
17392
|
tools: toolsPreSearch,
|
|
17235
17393
|
mcpToolNames,
|
|
17236
17394
|
mcpServers,
|
|
@@ -17242,7 +17400,10 @@ function createAgent(rawOptions) {
|
|
|
17242
17400
|
const discoveryToolName = shouldInjectToolSearch ? "tool_search" : hostDefinedToolSearch ? effectiveToolAliases?.tool_search ?? "tool_search" : null;
|
|
17243
17401
|
let searchableCatalogText;
|
|
17244
17402
|
if (disclosure.lazyEntries.length > 0) {
|
|
17245
|
-
searchableCatalogText = buildSearchableCatalog(disclosure.lazyEntries, {
|
|
17403
|
+
searchableCatalogText = buildSearchableCatalog(disclosure.lazyEntries, {
|
|
17404
|
+
discoveryToolName,
|
|
17405
|
+
...dispatchMode ? { dispatcherName: CALL_TOOL_NAME } : {}
|
|
17406
|
+
});
|
|
17246
17407
|
system = appendStaticSection(system, searchableCatalogText);
|
|
17247
17408
|
}
|
|
17248
17409
|
if (surfaceMcpInstructions && mcpConnection?.instructions && mcpConnection.instructions.size > 0) {
|
|
@@ -17251,10 +17412,11 @@ function createAgent(rawOptions) {
|
|
|
17251
17412
|
}
|
|
17252
17413
|
const aliasMaps = buildAliasMaps(effectiveToolAliases, Object.keys(tools));
|
|
17253
17414
|
augmentMcpDoubleUnderscoreAliases(aliasMaps, Object.keys(tools));
|
|
17415
|
+
const wireTailLength = () => dispatchMode ? 0 : dynamicUnlockOrder.length;
|
|
17254
17416
|
const formattedToolsCache = /* @__PURE__ */ new Map();
|
|
17255
17417
|
function buildFormattedTools(forProvider = runProvider) {
|
|
17256
17418
|
const cached = formattedToolsCache.get(forProvider);
|
|
17257
|
-
if (cached && cached.tailLen ===
|
|
17419
|
+
if (cached && cached.tailLen === wireTailLength()) return cached.value;
|
|
17258
17420
|
const specs = [];
|
|
17259
17421
|
for (const t of Object.values(tools)) {
|
|
17260
17422
|
if (!initialUnlocked.has(t.spec.name)) continue;
|
|
@@ -17264,7 +17426,7 @@ function createAgent(rawOptions) {
|
|
|
17264
17426
|
inputSchema: t.spec.inputSchema
|
|
17265
17427
|
});
|
|
17266
17428
|
}
|
|
17267
|
-
for (const canonical of dynamicUnlockOrder) {
|
|
17429
|
+
for (const canonical of dispatchMode ? [] : dynamicUnlockOrder) {
|
|
17268
17430
|
const t = tools[canonical];
|
|
17269
17431
|
if (!t) continue;
|
|
17270
17432
|
specs.push({
|
|
@@ -17275,7 +17437,7 @@ function createAgent(rawOptions) {
|
|
|
17275
17437
|
}
|
|
17276
17438
|
const value = specs.length > 0 ? forProvider.formatTools(specs) : [];
|
|
17277
17439
|
formattedToolsCache.set(forProvider, {
|
|
17278
|
-
tailLen:
|
|
17440
|
+
tailLen: wireTailLength(),
|
|
17279
17441
|
value
|
|
17280
17442
|
});
|
|
17281
17443
|
return value;
|
|
@@ -17284,13 +17446,14 @@ function createAgent(rawOptions) {
|
|
|
17284
17446
|
function advertisedToolNames() {
|
|
17285
17447
|
const names = [];
|
|
17286
17448
|
for (const t of Object.values(tools)) if (initialUnlocked.has(t.spec.name)) names.push(toWireName(t.spec.name, aliasMaps));
|
|
17287
|
-
for (const canonical of dynamicUnlockOrder) if (tools[canonical]) names.push(toWireName(canonical, aliasMaps));
|
|
17449
|
+
for (const canonical of dispatchMode ? [] : dynamicUnlockOrder) if (tools[canonical]) names.push(toWireName(canonical, aliasMaps));
|
|
17288
17450
|
return names;
|
|
17289
17451
|
}
|
|
17290
17452
|
{
|
|
17291
17453
|
const disclosedTools = [];
|
|
17454
|
+
const onWire = dispatchMode ? initialUnlocked : unlocked;
|
|
17292
17455
|
for (const t of Object.values(tools)) {
|
|
17293
|
-
if (!
|
|
17456
|
+
if (!onWire.has(t.spec.name)) continue;
|
|
17294
17457
|
const wireName = aliasMaps.aliasByCanonical.get(t.spec.name) ?? t.spec.name;
|
|
17295
17458
|
disclosedTools.push({
|
|
17296
17459
|
name: wireName,
|
|
@@ -17475,7 +17638,7 @@ function createAgent(rawOptions) {
|
|
|
17475
17638
|
recordUnlock: recordDynamicUnlock,
|
|
17476
17639
|
defaultLimit: toolSearch?.limit
|
|
17477
17640
|
}));
|
|
17478
|
-
perRunUnregisters.push(installLazyDisclosureGate(hooks, disclosure.lazyCanonicalNames, unlocked, discoveryToolName));
|
|
17641
|
+
perRunUnregisters.push(installLazyDisclosureGate(hooks, disclosure.lazyCanonicalNames, unlocked, discoveryToolName, dispatchMode ? CALL_TOOL_NAME : void 0));
|
|
17479
17642
|
perRunUnregisters.push(installReadBeforeEditHydrationGate(hooks, resolvedBehavior.requireReadBeforeEdit === true, {
|
|
17480
17643
|
session: session ?? void 0,
|
|
17481
17644
|
getHandle: () => executionHandle,
|
|
@@ -17605,6 +17768,10 @@ function createAgent(rawOptions) {
|
|
|
17605
17768
|
tools,
|
|
17606
17769
|
formattedTools,
|
|
17607
17770
|
rebuildFormattedTools: buildFormattedTools,
|
|
17771
|
+
...dispatchMode ? { dispatcher: {
|
|
17772
|
+
name: CALL_TOOL_NAME,
|
|
17773
|
+
targets: disclosure.lazyCanonicalNames
|
|
17774
|
+
} } : {},
|
|
17608
17775
|
aliasMaps,
|
|
17609
17776
|
model,
|
|
17610
17777
|
system,
|
|
@@ -18152,12 +18319,13 @@ function createAgent(rawOptions) {
|
|
|
18152
18319
|
return skillActivationState.active();
|
|
18153
18320
|
},
|
|
18154
18321
|
meta: Object.freeze({ ...provider.meta }),
|
|
18322
|
+
toolState: toolStateController.committed,
|
|
18155
18323
|
getContextBreakdown,
|
|
18156
18324
|
getContextSegments,
|
|
18157
18325
|
[Symbol.asyncDispose]: destroy
|
|
18158
18326
|
};
|
|
18159
18327
|
}
|
|
18160
18328
|
//#endregion
|
|
18161
|
-
export {
|
|
18329
|
+
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 };
|
|
18162
18330
|
|
|
18163
|
-
//# sourceMappingURL=agent-
|
|
18331
|
+
//# sourceMappingURL=agent-BCG9JcZl.js.map
|