zidane 7.0.31 → 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-m3TLCY_C.js → acp-bBDF-dhy.js} +2 -2
- package/dist/{acp-m3TLCY_C.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-9gf8ZlBR.js → agent-BCG9JcZl.js} +147 -17
- package/dist/agent-BCG9JcZl.js.map +1 -0
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +1 -1
- package/dist/{approvals-DaCEPCTV.js → approvals-DkwGBMZ9.js} +27 -12
- package/dist/approvals-DkwGBMZ9.js.map +1 -0
- package/dist/{auth-CJogE9q7.js → auth-D0BHBb02.js} +2 -2
- package/dist/{auth-CJogE9q7.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 +5 -5
- 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 +1 -1
- package/dist/extensions.js +1 -1
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +1 -1
- package/dist/{index-hd4zLhp8.d.ts → index-CCB05-JZ.d.ts} +53 -9
- package/dist/index-CCB05-JZ.d.ts.map +1 -0
- package/dist/{index-JkEO3MBV.d.ts → index-Ogi2CeHf.d.ts} +25 -6
- package/dist/index-Ogi2CeHf.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{ipc-BtN5SIc0.js → ipc-C10lnS-a.js} +2 -2
- package/dist/{ipc-BtN5SIc0.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.d.ts +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-ktOMu5gk.js → server--mwNA7oC.js} +6 -6
- package/dist/{server-ktOMu5gk.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/{tool-formatters-C4QIFCNa.d.ts → tool-formatters-Bu4repDJ.d.ts} +2 -2
- package/dist/{tool-formatters-C4QIFCNa.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-Bbn1HX5D.d.ts → transcript-anchors-CJCxyVE-.d.ts} +2 -2
- package/dist/{transcript-anchors-Bbn1HX5D.d.ts.map → transcript-anchors-CJCxyVE-.d.ts.map} +1 -1
- package/dist/tui.d.ts +3 -3
- package/dist/tui.js +43 -11
- 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-BhHCpCkP.d.ts → turn-operations-qcv9UFcL.d.ts} +3 -3
- package/dist/{turn-operations-BhHCpCkP.d.ts.map → turn-operations-qcv9UFcL.d.ts.map} +1 -1
- package/dist/types-CWgENVLY.js.map +1 -1
- package/dist/types.d.ts +1 -1
- 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/package.json +1 -1
- package/dist/agent-9gf8ZlBR.js.map +0 -1
- package/dist/approvals-DaCEPCTV.js.map +0 -1
- package/dist/index-JkEO3MBV.d.ts.map +0 -1
- package/dist/index-hd4zLhp8.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 { 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-
|
|
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 };
|
|
@@ -7140,11 +7140,19 @@ function applyToolSearchToUnlocked(catalog, input, unlocked, defaultLimit, addUn
|
|
|
7140
7140
|
*/
|
|
7141
7141
|
function createToolSearchTool(options) {
|
|
7142
7142
|
const defaultLimit = options.defaultLimit ?? DEFAULT_LIMIT;
|
|
7143
|
+
const dispatcher = options.dispatcherName;
|
|
7143
7144
|
return {
|
|
7144
7145
|
isConcurrencySafe: true,
|
|
7145
7146
|
spec: {
|
|
7146
7147
|
name: "tool_search",
|
|
7147
|
-
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(" "),
|
|
7148
7156
|
inputSchema: {
|
|
7149
7157
|
type: "object",
|
|
7150
7158
|
properties: {
|
|
@@ -7186,7 +7194,7 @@ function createToolSearchTool(options) {
|
|
|
7186
7194
|
else {
|
|
7187
7195
|
for (const entry of shown) parts.push(formatMatch(entry));
|
|
7188
7196
|
parts.push("");
|
|
7189
|
-
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.");
|
|
7190
7198
|
if (truncated) parts.push(` ${total - shown.length} additional matches were truncated; refine the query or raise \`limit\`.`);
|
|
7191
7199
|
}
|
|
7192
7200
|
if (misses.length > 0) parts.push(` <misses>${misses.map(escapeXml).join(", ")}</misses>`);
|
|
@@ -11698,6 +11706,72 @@ function textForPersistence(output) {
|
|
|
11698
11706
|
return parts.join("\n");
|
|
11699
11707
|
}
|
|
11700
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
|
|
11701
11775
|
//#region src/loop.ts
|
|
11702
11776
|
const DEFAULT_PROVIDER_STREAM_START_TIMEOUT_MS = 300 * 1e3;
|
|
11703
11777
|
const DEFAULT_PROVIDER_STREAM_TIMEOUT_MS = 1800 * 1e3;
|
|
@@ -13989,6 +14063,7 @@ async function executeTurn(ctx, turn, priorUsage) {
|
|
|
13989
14063
|
})).catch(() => {});
|
|
13990
14064
|
}
|
|
13991
14065
|
}
|
|
14066
|
+
canonicalToolCalls = unwrapDispatchCalls(ctx, canonicalToolCalls);
|
|
13992
14067
|
if (turnTtftMs !== void 0 && result.usage.timeToFirstTokenMs === void 0) result.usage.timeToFirstTokenMs = turnTtftMs;
|
|
13993
14068
|
if (result.usage.streamDurationMs === void 0) result.usage.streamDurationMs = Date.now() - streamStartedAt;
|
|
13994
14069
|
const assistantTurn = {
|
|
@@ -14290,6 +14365,31 @@ async function commitToolState(ctx, callId, toolName) {
|
|
|
14290
14365
|
if (!hookCtx.handled) console.error(`[zidane] tool state commit for ${toolName} (${callId}) failed; the write did NOT land, continuing:`, error);
|
|
14291
14366
|
}
|
|
14292
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
|
+
}
|
|
14293
14393
|
async function executeSingleTool(ctx, call, turnId) {
|
|
14294
14394
|
const toolDef = ctx.tools[call.name];
|
|
14295
14395
|
const callId = call.id;
|
|
@@ -16347,13 +16447,15 @@ function buildRunDisclosureState(input) {
|
|
|
16347
16447
|
};
|
|
16348
16448
|
const hostDefinedToolSearch = !!baseTools.tool_search;
|
|
16349
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"];
|
|
16350
16451
|
let tools = baseTools;
|
|
16351
16452
|
if (injectedToolSearch) {
|
|
16352
16453
|
const toolSearchTool = createToolSearchTool({
|
|
16353
16454
|
catalog: disclosure.lazyEntries,
|
|
16354
16455
|
unlocked,
|
|
16355
16456
|
addUnlock: recordUnlock,
|
|
16356
|
-
...toolSearch?.limit !== void 0 ? { defaultLimit: toolSearch.limit } : {}
|
|
16457
|
+
...toolSearch?.limit !== void 0 ? { defaultLimit: toolSearch.limit } : {},
|
|
16458
|
+
...dispatchMode ? { dispatcherName: CALL_TOOL_NAME } : {}
|
|
16357
16459
|
});
|
|
16358
16460
|
tools = {
|
|
16359
16461
|
...baseTools,
|
|
@@ -16361,6 +16463,19 @@ function buildRunDisclosureState(input) {
|
|
|
16361
16463
|
};
|
|
16362
16464
|
unlocked.add(toolSearchTool.spec.name);
|
|
16363
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
|
+
}
|
|
16364
16479
|
}
|
|
16365
16480
|
return {
|
|
16366
16481
|
disclosure,
|
|
@@ -16370,7 +16485,8 @@ function buildRunDisclosureState(input) {
|
|
|
16370
16485
|
recordUnlock,
|
|
16371
16486
|
tools,
|
|
16372
16487
|
injectedToolSearch,
|
|
16373
|
-
hostDefinedToolSearch
|
|
16488
|
+
hostDefinedToolSearch,
|
|
16489
|
+
dispatchMode
|
|
16374
16490
|
};
|
|
16375
16491
|
}
|
|
16376
16492
|
/**
|
|
@@ -16631,7 +16747,11 @@ function buildSearchableCatalog(entries, options) {
|
|
|
16631
16747
|
}
|
|
16632
16748
|
const serverNames = [...byServer.keys()].sort();
|
|
16633
16749
|
const parts = [];
|
|
16634
|
-
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
|
+
}
|
|
16635
16755
|
parts.push("<searchable_tools>");
|
|
16636
16756
|
for (const server of serverNames) {
|
|
16637
16757
|
parts.push(` <server name="${escapeXml(server)}">`);
|
|
@@ -16655,14 +16775,15 @@ function buildSearchableCatalog(entries, options) {
|
|
|
16655
16775
|
* Returns an uninstall function the run-end teardown calls so handlers
|
|
16656
16776
|
* never leak across runs.
|
|
16657
16777
|
*/
|
|
16658
|
-
function installLazyDisclosureGate(hooks, lazyCanonicalNames, unlocked, discoveryToolName) {
|
|
16778
|
+
function installLazyDisclosureGate(hooks, lazyCanonicalNames, unlocked, discoveryToolName, dispatcherName) {
|
|
16659
16779
|
if (lazyCanonicalNames.size === 0) return () => {};
|
|
16660
16780
|
return hooks.hook("tool:gate", (ctx) => {
|
|
16661
16781
|
if (ctx.block) return;
|
|
16662
16782
|
if (!lazyCanonicalNames.has(ctx.name)) return;
|
|
16663
16783
|
if (unlocked.has(ctx.name)) return;
|
|
16664
16784
|
ctx.block = true;
|
|
16665
|
-
|
|
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.`;
|
|
16666
16787
|
});
|
|
16667
16788
|
}
|
|
16668
16789
|
/**
|
|
@@ -17267,7 +17388,7 @@ function createAgent(rawOptions) {
|
|
|
17267
17388
|
executionContext,
|
|
17268
17389
|
behavior: resolvedBehavior
|
|
17269
17390
|
});
|
|
17270
|
-
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({
|
|
17271
17392
|
tools: toolsPreSearch,
|
|
17272
17393
|
mcpToolNames,
|
|
17273
17394
|
mcpServers,
|
|
@@ -17279,7 +17400,10 @@ function createAgent(rawOptions) {
|
|
|
17279
17400
|
const discoveryToolName = shouldInjectToolSearch ? "tool_search" : hostDefinedToolSearch ? effectiveToolAliases?.tool_search ?? "tool_search" : null;
|
|
17280
17401
|
let searchableCatalogText;
|
|
17281
17402
|
if (disclosure.lazyEntries.length > 0) {
|
|
17282
|
-
searchableCatalogText = buildSearchableCatalog(disclosure.lazyEntries, {
|
|
17403
|
+
searchableCatalogText = buildSearchableCatalog(disclosure.lazyEntries, {
|
|
17404
|
+
discoveryToolName,
|
|
17405
|
+
...dispatchMode ? { dispatcherName: CALL_TOOL_NAME } : {}
|
|
17406
|
+
});
|
|
17283
17407
|
system = appendStaticSection(system, searchableCatalogText);
|
|
17284
17408
|
}
|
|
17285
17409
|
if (surfaceMcpInstructions && mcpConnection?.instructions && mcpConnection.instructions.size > 0) {
|
|
@@ -17288,10 +17412,11 @@ function createAgent(rawOptions) {
|
|
|
17288
17412
|
}
|
|
17289
17413
|
const aliasMaps = buildAliasMaps(effectiveToolAliases, Object.keys(tools));
|
|
17290
17414
|
augmentMcpDoubleUnderscoreAliases(aliasMaps, Object.keys(tools));
|
|
17415
|
+
const wireTailLength = () => dispatchMode ? 0 : dynamicUnlockOrder.length;
|
|
17291
17416
|
const formattedToolsCache = /* @__PURE__ */ new Map();
|
|
17292
17417
|
function buildFormattedTools(forProvider = runProvider) {
|
|
17293
17418
|
const cached = formattedToolsCache.get(forProvider);
|
|
17294
|
-
if (cached && cached.tailLen ===
|
|
17419
|
+
if (cached && cached.tailLen === wireTailLength()) return cached.value;
|
|
17295
17420
|
const specs = [];
|
|
17296
17421
|
for (const t of Object.values(tools)) {
|
|
17297
17422
|
if (!initialUnlocked.has(t.spec.name)) continue;
|
|
@@ -17301,7 +17426,7 @@ function createAgent(rawOptions) {
|
|
|
17301
17426
|
inputSchema: t.spec.inputSchema
|
|
17302
17427
|
});
|
|
17303
17428
|
}
|
|
17304
|
-
for (const canonical of dynamicUnlockOrder) {
|
|
17429
|
+
for (const canonical of dispatchMode ? [] : dynamicUnlockOrder) {
|
|
17305
17430
|
const t = tools[canonical];
|
|
17306
17431
|
if (!t) continue;
|
|
17307
17432
|
specs.push({
|
|
@@ -17312,7 +17437,7 @@ function createAgent(rawOptions) {
|
|
|
17312
17437
|
}
|
|
17313
17438
|
const value = specs.length > 0 ? forProvider.formatTools(specs) : [];
|
|
17314
17439
|
formattedToolsCache.set(forProvider, {
|
|
17315
|
-
tailLen:
|
|
17440
|
+
tailLen: wireTailLength(),
|
|
17316
17441
|
value
|
|
17317
17442
|
});
|
|
17318
17443
|
return value;
|
|
@@ -17321,13 +17446,14 @@ function createAgent(rawOptions) {
|
|
|
17321
17446
|
function advertisedToolNames() {
|
|
17322
17447
|
const names = [];
|
|
17323
17448
|
for (const t of Object.values(tools)) if (initialUnlocked.has(t.spec.name)) names.push(toWireName(t.spec.name, aliasMaps));
|
|
17324
|
-
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));
|
|
17325
17450
|
return names;
|
|
17326
17451
|
}
|
|
17327
17452
|
{
|
|
17328
17453
|
const disclosedTools = [];
|
|
17454
|
+
const onWire = dispatchMode ? initialUnlocked : unlocked;
|
|
17329
17455
|
for (const t of Object.values(tools)) {
|
|
17330
|
-
if (!
|
|
17456
|
+
if (!onWire.has(t.spec.name)) continue;
|
|
17331
17457
|
const wireName = aliasMaps.aliasByCanonical.get(t.spec.name) ?? t.spec.name;
|
|
17332
17458
|
disclosedTools.push({
|
|
17333
17459
|
name: wireName,
|
|
@@ -17512,7 +17638,7 @@ function createAgent(rawOptions) {
|
|
|
17512
17638
|
recordUnlock: recordDynamicUnlock,
|
|
17513
17639
|
defaultLimit: toolSearch?.limit
|
|
17514
17640
|
}));
|
|
17515
|
-
perRunUnregisters.push(installLazyDisclosureGate(hooks, disclosure.lazyCanonicalNames, unlocked, discoveryToolName));
|
|
17641
|
+
perRunUnregisters.push(installLazyDisclosureGate(hooks, disclosure.lazyCanonicalNames, unlocked, discoveryToolName, dispatchMode ? CALL_TOOL_NAME : void 0));
|
|
17516
17642
|
perRunUnregisters.push(installReadBeforeEditHydrationGate(hooks, resolvedBehavior.requireReadBeforeEdit === true, {
|
|
17517
17643
|
session: session ?? void 0,
|
|
17518
17644
|
getHandle: () => executionHandle,
|
|
@@ -17642,6 +17768,10 @@ function createAgent(rawOptions) {
|
|
|
17642
17768
|
tools,
|
|
17643
17769
|
formattedTools,
|
|
17644
17770
|
rebuildFormattedTools: buildFormattedTools,
|
|
17771
|
+
...dispatchMode ? { dispatcher: {
|
|
17772
|
+
name: CALL_TOOL_NAME,
|
|
17773
|
+
targets: disclosure.lazyCanonicalNames
|
|
17774
|
+
} } : {},
|
|
17645
17775
|
aliasMaps,
|
|
17646
17776
|
model,
|
|
17647
17777
|
system,
|
|
@@ -18196,6 +18326,6 @@ function createAgent(rawOptions) {
|
|
|
18196
18326
|
};
|
|
18197
18327
|
}
|
|
18198
18328
|
//#endregion
|
|
18199
|
-
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 };
|
|
18200
18330
|
|
|
18201
|
-
//# sourceMappingURL=agent-
|
|
18331
|
+
//# sourceMappingURL=agent-BCG9JcZl.js.map
|