zidane 5.11.2 → 5.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-D0W9yClt.d.ts → agent-Dt3mALPV.d.ts} +209 -30
- package/dist/agent-Dt3mALPV.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/contexts/e2b.d.ts +1 -1
- package/dist/eval.d.ts +1 -1
- package/dist/eval.js +2 -2
- package/dist/{headless-Bb5gU8AR.js → headless-BqfIgk1W.js} +39 -16
- package/dist/headless-BqfIgk1W.js.map +1 -0
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +1 -1
- package/dist/{index-DZR99FD4.d.ts → index-BDRh3kup.d.ts} +13 -2
- package/dist/index-BDRh3kup.d.ts.map +1 -0
- package/dist/{index-D60tX5XC.d.ts → index-Do7IZGW5.d.ts} +2 -2
- package/dist/{index-D60tX5XC.d.ts.map → index-Do7IZGW5.d.ts.map} +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +15 -12
- package/dist/index.js.map +1 -1
- package/dist/{logger-n4LsLISE.d.ts → logger-C2E41UWq.d.ts} +2 -2
- package/dist/{logger-n4LsLISE.d.ts.map → logger-C2E41UWq.d.ts.map} +1 -1
- package/dist/{login-BHhOdTp9.js → login-DRKh-Uit.js} +33 -5
- package/dist/login-DRKh-Uit.js.map +1 -0
- package/dist/{mcp-Cy9mgCcr.js → mcp-CKlcFeLQ.js} +140 -13
- package/dist/mcp-CKlcFeLQ.js.map +1 -0
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +1 -1
- package/dist/media-sniff-Bn76JxAu.js +216 -0
- package/dist/media-sniff-Bn76JxAu.js.map +1 -0
- package/dist/{messages-RPKrEPvH.js → messages-DOKdwQBD.js} +538 -53
- package/dist/messages-DOKdwQBD.js.map +1 -0
- package/dist/output/stream-json.d.ts +2 -2
- package/dist/output/stream-json.js +1 -1
- package/dist/output/terminal.d.ts +2 -2
- package/dist/{presets-D5ibZTml.js → presets-DErpoTHg.js} +2 -2
- package/dist/{presets-D5ibZTml.js.map → presets-DErpoTHg.js.map} +1 -1
- package/dist/presets.d.ts +2 -2
- package/dist/presets.js +1 -1
- package/dist/{providers-C2cxujp_.js → providers-BOEzzCRs.js} +54 -21
- package/dist/providers-BOEzzCRs.js.map +1 -0
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +2 -2
- package/dist/{read-state-BFqpQRc5.js → read-state-DH2IuQHX.js} +2 -2
- package/dist/{read-state-BFqpQRc5.js.map → read-state-DH2IuQHX.js.map} +1 -1
- package/dist/restate.d.ts +1 -1
- package/dist/restate.js +1 -1
- package/dist/session/sqlite.d.ts +1 -1
- package/dist/{session-Do_TQV7c.js → session-W5_HQYU8.js} +2 -2
- package/dist/{session-Do_TQV7c.js.map → session-W5_HQYU8.js.map} +1 -1
- package/dist/session.d.ts +1 -1
- package/dist/session.js +2 -2
- package/dist/skills.d.ts +2 -2
- package/dist/{tool-formatters-RT5-gyE2.d.ts → tool-formatters-COmtAwgF.d.ts} +2 -2
- package/dist/{tool-formatters-RT5-gyE2.d.ts.map → tool-formatters-COmtAwgF.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-ZHKOh44k.js → tools-CVFNtlyc.js} +48 -101
- package/dist/tools-CVFNtlyc.js.map +1 -0
- package/dist/tools.d.ts +2 -2
- package/dist/tools.js +2 -2
- package/dist/{transcript-anchors-0zzqcSm5.js → transcript-anchors-BftfURAc.js} +22 -15
- package/dist/transcript-anchors-BftfURAc.js.map +1 -0
- package/dist/{transcript-anchors-B4FxkG-8.d.ts → transcript-anchors-DLa8m9_E.d.ts} +4 -4
- package/dist/{transcript-anchors-B4FxkG-8.d.ts.map → transcript-anchors-DLa8m9_E.d.ts.map} +1 -1
- package/dist/tui.d.ts +3 -3
- package/dist/tui.js +8 -8
- package/dist/tui.js.map +1 -1
- package/dist/{turn-operations-CoRj3mYZ.d.ts → turn-operations-ifKg5muR.d.ts} +3 -3
- package/dist/{turn-operations-CoRj3mYZ.d.ts.map → turn-operations-ifKg5muR.d.ts.map} +1 -1
- package/dist/{types-BiobHM1D.js → types-DxHDaqN7.js} +23 -6
- package/dist/{types-BiobHM1D.js.map → types-DxHDaqN7.js.map} +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/types.js +1 -1
- package/docs/RESTATE.md +25 -0
- package/package.json +2 -1
- package/dist/agent-D0W9yClt.d.ts.map +0 -1
- package/dist/headless-Bb5gU8AR.js.map +0 -1
- package/dist/image-sniff-B7uFSNO1.js +0 -90
- package/dist/image-sniff-B7uFSNO1.js.map +0 -1
- package/dist/index-DZR99FD4.d.ts.map +0 -1
- package/dist/login-BHhOdTp9.js.map +0 -1
- package/dist/mcp-Cy9mgCcr.js.map +0 -1
- package/dist/messages-RPKrEPvH.js.map +0 -1
- package/dist/providers-C2cxujp_.js.map +0 -1
- package/dist/tools-ZHKOh44k.js.map +0 -1
- package/dist/transcript-anchors-0zzqcSm5.js.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { r as utf8ByteLength } from "./utils-ngQzYzZD.js";
|
|
2
2
|
import { t as buildContextBreakdown } from "./context-breakdown-kO-pDsay.js";
|
|
3
3
|
import { a as formatTaskStatus, i as formatDuration, o as formatTaskSummary, s as previewLine } from "./format-BNOXpl-1.js";
|
|
4
|
-
import { a as createCursorOAuthProvider, c as baseten, d as anthropic, g as FAST_MODE_OPTIONS, h as ANTHROPIC_EXTRA_MODELS, m as writeFileAtomicAsync, n as openai, o as generatePkce, r as local, s as cerebras, t as openrouter, u as arcee } from "./providers-
|
|
4
|
+
import { a as createCursorOAuthProvider, c as baseten, d as anthropic, g as FAST_MODE_OPTIONS, h as ANTHROPIC_EXTRA_MODELS, m as writeFileAtomicAsync, n as openai, o as generatePkce, r as local, s as cerebras, t as openrouter, u as arcee } from "./providers-BOEzzCRs.js";
|
|
5
5
|
import { i as AgentProviderError, l as errorMessage, n as AgentBudgetExceededError, o as AgentToolPairingError, p as toTypedError, t as AgentAbortedError } from "./errors-DkR6GPJw.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
6
|
+
import { F as canonicalizePrompt, O as appendStaticSection, P as buildPromptMessage, a as detectTurnInterruption, c as filterUnresolvedToolUses, d as remintDuplicateToolCallIds, f as resolveContentRefsInMessages, j as renderSystemForWire, n as SYNTHETIC_TOOL_RESULT_PLACEHOLDER, o as ensureEndsWithUserMessage, s as ensureToolResultPairing } from "./messages-DOKdwQBD.js";
|
|
7
|
+
import { n as reconcileImageMediaType } from "./media-sniff-Bn76JxAu.js";
|
|
8
|
+
import { a as toolOutputByteLength, i as toolOutputBudgetByteLength, o as toolResultToText, r as documentBlockMarker, t as DEFAULT_AGENT_CLOCK } from "./types-DxHDaqN7.js";
|
|
9
9
|
import { r as createProcessContext, t as resolveDetachedTasksCapability } from "./contexts-DglWSzmR.js";
|
|
10
10
|
import { i as styleReplacementForVia, n as resolveOldString, r as stripLineNumberPrefixes, t as describeVia } from "./edit-utils-EGosADZq.js";
|
|
11
|
-
import { a as markReadStateElided, n as getToolDedupState, o as readStateKey, r as hashContent, s as resolveReadStateMap } from "./read-state-
|
|
11
|
+
import { a as markReadStateElided, n as getToolDedupState, o as readStateKey, r as hashContent, s as resolveReadStateMap } from "./read-state-DH2IuQHX.js";
|
|
12
12
|
import { S as escapeXml, d as buildCatalog, n as stripShellInterpolations, p as installAllowedToolsGate, r as resolveSkills, t as interpolateShellCommands, v as validateResourcePathReal, x as createSkillActivationState } from "./interpolate-CTfr0GdR.js";
|
|
13
|
-
import { n as connectMcpServers } from "./mcp-
|
|
13
|
+
import { n as connectMcpServers } from "./mcp-CKlcFeLQ.js";
|
|
14
14
|
import { n as flattenTurns, r as formatTokenUsage, t as effectiveInputFromTurn } from "./stats-DAKBEKjc.js";
|
|
15
15
|
import { n as shellQuote, t as alwaysQuote } from "./shell-quote-BmnhZmdM.js";
|
|
16
16
|
import { isAbsolute, join, resolve } from "node:path";
|
|
@@ -2128,6 +2128,8 @@ function formatValue(value) {
|
|
|
2128
2128
|
//#endregion
|
|
2129
2129
|
//#region src/loop.ts
|
|
2130
2130
|
const IMAGE_OMITTED_MARKER = "[image omitted — model does not support vision]";
|
|
2131
|
+
const AUDIO_OMITTED_MARKER = "[audio omitted — model does not support audio input]";
|
|
2132
|
+
const VIDEO_OMITTED_MARKER = "[video omitted — model does not support video input]";
|
|
2131
2133
|
function documentOmittedMarker(doc) {
|
|
2132
2134
|
return documentBlockMarker(doc, "document omitted — model does not support document attachments");
|
|
2133
2135
|
}
|
|
@@ -2360,7 +2362,7 @@ function applyTailCompaction(messages, threshold, keepTurns, options) {
|
|
|
2360
2362
|
persistableElided
|
|
2361
2363
|
};
|
|
2362
2364
|
let totalBytes = 0;
|
|
2363
|
-
for (const msg of messages) for (const block of msg.content) if (block.type === "tool_result") totalBytes +=
|
|
2365
|
+
for (const msg of messages) for (const block of msg.content) if (block.type === "tool_result") totalBytes += toolOutputBudgetByteLength(block.output);
|
|
2364
2366
|
if (totalBytes <= threshold) return {
|
|
2365
2367
|
messages,
|
|
2366
2368
|
elidedReadPaths,
|
|
@@ -2376,7 +2378,7 @@ function applyTailCompaction(messages, threshold, keepTurns, options) {
|
|
|
2376
2378
|
let keptBytes = 0;
|
|
2377
2379
|
let budgetCutoff = floorCutoff;
|
|
2378
2380
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
2379
|
-
for (const block of messages[i].content) if (block.type === "tool_result") keptBytes +=
|
|
2381
|
+
for (const block of messages[i].content) if (block.type === "tool_result") keptBytes += toolOutputBudgetByteLength(block.output);
|
|
2380
2382
|
if (keptBytes > threshold) {
|
|
2381
2383
|
budgetCutoff = i + 1;
|
|
2382
2384
|
break;
|
|
@@ -2613,7 +2615,6 @@ function applyPairingRepair(ctx, messages, turnId) {
|
|
|
2613
2615
|
return repaired;
|
|
2614
2616
|
}
|
|
2615
2617
|
function sanitizeStoredToolResults(provider, messages) {
|
|
2616
|
-
if (provider.meta.capabilities?.vision !== false && provider.meta.capabilities?.documents === true) return messages;
|
|
2617
2618
|
return messages.map((msg) => {
|
|
2618
2619
|
let changed = false;
|
|
2619
2620
|
const newContent = msg.content.map((block) => {
|
|
@@ -2828,6 +2829,14 @@ async function runLoop(ctx) {
|
|
|
2828
2829
|
unregisterTtftTool();
|
|
2829
2830
|
}
|
|
2830
2831
|
}
|
|
2832
|
+
async function resolveContentRefsForWire(ctx, messages) {
|
|
2833
|
+
return resolveContentRefsInMessages(messages, { resolveContentRef: async (block) => {
|
|
2834
|
+
const hookCtx = { block };
|
|
2835
|
+
await ctx.hooks.callHook("content-ref:resolve", hookCtx);
|
|
2836
|
+
if (typeof hookCtx.data !== "string") throw new Error(`Content ref "${block.ref}" (${block.type}) was not resolved by a content-ref:resolve hook.`);
|
|
2837
|
+
return { data: hookCtx.data };
|
|
2838
|
+
} });
|
|
2839
|
+
}
|
|
2831
2840
|
/**
|
|
2832
2841
|
* Force one provider call whose only tool is the synthetic `__output__`
|
|
2833
2842
|
* spec built from `behavior.schema`, with `toolChoice` pinned to it, so
|
|
@@ -2865,7 +2874,7 @@ async function enforceSchemaOutput(ctx, turnId) {
|
|
|
2865
2874
|
description: "Return the final structured output matching the required schema.",
|
|
2866
2875
|
inputSchema: ctx.schema
|
|
2867
2876
|
};
|
|
2868
|
-
const schemaMessages = ensureEndsWithUserMessage(applyPairingRepair(ctx, rewriteMessagesToWire(turnsToMessages(applyCompactSummaryCutoff(ctx.turns)), ctx.aliasMaps), turnId), ctx.provider);
|
|
2877
|
+
const schemaMessages = ensureEndsWithUserMessage(applyPairingRepair(ctx, rewriteMessagesToWire(await resolveContentRefsForWire(ctx, turnsToMessages(applyCompactSummaryCutoff(ctx.turns))), ctx.aliasMaps), turnId), ctx.provider);
|
|
2869
2878
|
let schemaResult;
|
|
2870
2879
|
try {
|
|
2871
2880
|
schemaResult = await ctx.provider.stream({
|
|
@@ -3124,6 +3133,7 @@ function abortableSleep(ms, signal) {
|
|
|
3124
3133
|
async function executeTurn(ctx, turn, priorUsage) {
|
|
3125
3134
|
const turnId = ctx.clock.randomUUID();
|
|
3126
3135
|
let canonicalMessages = turnsToMessages(applyCompactSummaryCutoff(ctx.turns));
|
|
3136
|
+
canonicalMessages = await resolveContentRefsForWire(ctx, canonicalMessages);
|
|
3127
3137
|
if (ctx.elideStaleReads === true) {
|
|
3128
3138
|
const elision = applyStaleReadElision(canonicalMessages);
|
|
3129
3139
|
canonicalMessages = elision.messages;
|
|
@@ -3151,7 +3161,7 @@ async function executeTurn(ctx, turn, priorUsage) {
|
|
|
3151
3161
|
const threshold = typeof ctx.compactThreshold === "number" && ctx.compactThreshold > 0 ? ctx.compactThreshold : 131072;
|
|
3152
3162
|
const keep = typeof ctx.compactKeepTurns === "number" && ctx.compactKeepTurns >= 0 ? ctx.compactKeepTurns : 4;
|
|
3153
3163
|
let totalBytes = 0;
|
|
3154
|
-
for (const msg of sanitizedMessages) for (const block of msg.content) if (block.type === "tool_result") totalBytes +=
|
|
3164
|
+
for (const msg of sanitizedMessages) for (const block of msg.content) if (block.type === "tool_result") totalBytes += toolOutputBudgetByteLength(block.output);
|
|
3155
3165
|
try {
|
|
3156
3166
|
const compacted = await ctx.compactStrategy(sanitizedMessages, {
|
|
3157
3167
|
threshold,
|
|
@@ -3179,7 +3189,7 @@ async function executeTurn(ctx, turn, priorUsage) {
|
|
|
3179
3189
|
};
|
|
3180
3190
|
const transformCtx = { messages: streamOptions.messages };
|
|
3181
3191
|
await ctx.hooks.callHook("context:transform", transformCtx);
|
|
3182
|
-
streamOptions.messages = transformCtx.messages;
|
|
3192
|
+
streamOptions.messages = await resolveContentRefsForWire(ctx, transformCtx.messages);
|
|
3183
3193
|
streamOptions.messages = applyPairingRepair(ctx, streamOptions.messages, turnId);
|
|
3184
3194
|
streamOptions.messages = ensureEndsWithUserMessage(streamOptions.messages, ctx.provider);
|
|
3185
3195
|
const systemCtx = {
|
|
@@ -3196,6 +3206,7 @@ async function executeTurn(ctx, turn, priorUsage) {
|
|
|
3196
3206
|
turnId,
|
|
3197
3207
|
options: streamOptions
|
|
3198
3208
|
});
|
|
3209
|
+
streamOptions.messages = await resolveContentRefsForWire(ctx, streamOptions.messages);
|
|
3199
3210
|
streamOptions.messages = applyPairingRepair(ctx, streamOptions.messages, turnId);
|
|
3200
3211
|
streamOptions.messages = ensureEndsWithUserMessage(streamOptions.messages, ctx.provider);
|
|
3201
3212
|
let currentText = "";
|
|
@@ -3506,17 +3517,32 @@ function stripImagesForNonVision(provider, output) {
|
|
|
3506
3517
|
}
|
|
3507
3518
|
function sanitizeToolOutputForProvider(provider, output) {
|
|
3508
3519
|
if (typeof output === "string") return output;
|
|
3509
|
-
|
|
3520
|
+
const caps = provider.meta.capabilities;
|
|
3521
|
+
if (caps?.vision !== false && caps?.audio === true && caps?.video === true && caps?.documents === true) return output;
|
|
3510
3522
|
let changed = false;
|
|
3511
3523
|
const sanitized = output.map((block) => {
|
|
3512
|
-
if (block.type === "image" &&
|
|
3524
|
+
if (block.type === "image" && caps?.vision === false) {
|
|
3513
3525
|
changed = true;
|
|
3514
3526
|
return {
|
|
3515
3527
|
type: "text",
|
|
3516
3528
|
text: IMAGE_OMITTED_MARKER
|
|
3517
3529
|
};
|
|
3518
3530
|
}
|
|
3519
|
-
if (block.type === "
|
|
3531
|
+
if (block.type === "audio" && caps?.audio !== true) {
|
|
3532
|
+
changed = true;
|
|
3533
|
+
return {
|
|
3534
|
+
type: "text",
|
|
3535
|
+
text: AUDIO_OMITTED_MARKER
|
|
3536
|
+
};
|
|
3537
|
+
}
|
|
3538
|
+
if (block.type === "video" && caps?.video !== true) {
|
|
3539
|
+
changed = true;
|
|
3540
|
+
return {
|
|
3541
|
+
type: "text",
|
|
3542
|
+
text: VIDEO_OMITTED_MARKER
|
|
3543
|
+
};
|
|
3544
|
+
}
|
|
3545
|
+
if (block.type === "document" && caps?.documents !== true) {
|
|
3520
3546
|
changed = true;
|
|
3521
3547
|
return {
|
|
3522
3548
|
type: "text",
|
|
@@ -4498,89 +4524,6 @@ async function executeNativeToolBatch(ctx, toolCalls, turnId) {
|
|
|
4498
4524
|
}
|
|
4499
4525
|
}
|
|
4500
4526
|
//#endregion
|
|
4501
|
-
//#region src/prompt.ts
|
|
4502
|
-
/**
|
|
4503
|
-
* Coerce the run-level prompt into a `PromptPart[]`.
|
|
4504
|
-
*
|
|
4505
|
-
* - `string` prompt → a single `text` part. Empty string returns `undefined`
|
|
4506
|
-
* so callers skip pushing an empty user turn.
|
|
4507
|
-
* - `PromptPart[]` prompt → validated and returned as-is. An empty array, or
|
|
4508
|
-
* an array whose text parts are all empty with no image/document parts,
|
|
4509
|
-
* returns `undefined`.
|
|
4510
|
-
* - `undefined` → `undefined` (promptless resume path).
|
|
4511
|
-
*/
|
|
4512
|
-
function canonicalizePrompt(prompt) {
|
|
4513
|
-
if (prompt === void 0) return void 0;
|
|
4514
|
-
if (typeof prompt === "string") {
|
|
4515
|
-
if (prompt.length === 0) return void 0;
|
|
4516
|
-
return [{
|
|
4517
|
-
type: "text",
|
|
4518
|
-
text: prompt
|
|
4519
|
-
}];
|
|
4520
|
-
}
|
|
4521
|
-
if (prompt.length === 0) return void 0;
|
|
4522
|
-
for (const part of prompt) {
|
|
4523
|
-
if (!part || typeof part !== "object" || typeof part.type !== "string") throw new Error("Invalid PromptPart: each part must be an object with a `type` field.");
|
|
4524
|
-
const type = part.type;
|
|
4525
|
-
if (type !== "text" && type !== "image" && type !== "document") throw new Error(`Invalid PromptPart type "${type}". Expected "text" | "image" | "document".`);
|
|
4526
|
-
}
|
|
4527
|
-
if (!prompt.some((part) => part.type === "text" && part.text.length > 0 || part.type === "image" || part.type === "document")) return void 0;
|
|
4528
|
-
return prompt;
|
|
4529
|
-
}
|
|
4530
|
-
/**
|
|
4531
|
-
* Build a user `SessionMessage` from prompt parts without provider-specific handling.
|
|
4532
|
-
*
|
|
4533
|
-
* - `text` parts map to `{ type: 'text', text }` blocks.
|
|
4534
|
-
* - `image` parts map to `{ type: 'image', mediaType, data }` blocks.
|
|
4535
|
-
* - `document` parts with `encoding: 'text'` are inlined as an attachment-tagged
|
|
4536
|
-
* text block so every provider can read them.
|
|
4537
|
-
* - `document` parts with `encoding: 'base64'` throw — the caller should switch
|
|
4538
|
-
* to a provider that implements `promptMessage` (e.g. Anthropic for PDFs).
|
|
4539
|
-
*/
|
|
4540
|
-
function defaultPromptMessage(parts) {
|
|
4541
|
-
const content = [];
|
|
4542
|
-
for (const part of parts) {
|
|
4543
|
-
if (part.type === "text") {
|
|
4544
|
-
if (part.text.length > 0) content.push({
|
|
4545
|
-
type: "text",
|
|
4546
|
-
text: part.text
|
|
4547
|
-
});
|
|
4548
|
-
continue;
|
|
4549
|
-
}
|
|
4550
|
-
if (part.type === "image") {
|
|
4551
|
-
content.push({
|
|
4552
|
-
type: "image",
|
|
4553
|
-
mediaType: part.mediaType,
|
|
4554
|
-
data: part.data,
|
|
4555
|
-
...part.name ? { name: part.name } : {}
|
|
4556
|
-
});
|
|
4557
|
-
continue;
|
|
4558
|
-
}
|
|
4559
|
-
if (part.encoding === "text") {
|
|
4560
|
-
const header = part.name ? `<attachment name="${part.name}" media_type="${part.mediaType}">` : `<attachment media_type="${part.mediaType}">`;
|
|
4561
|
-
content.push({
|
|
4562
|
-
type: "text",
|
|
4563
|
-
text: `${header}\n${part.data}\n</attachment>`
|
|
4564
|
-
});
|
|
4565
|
-
continue;
|
|
4566
|
-
}
|
|
4567
|
-
throw new Error(`Provider does not support base64 document parts (mediaType: ${part.mediaType}). Use a text-encoded document or a provider that implements promptMessage (e.g. Anthropic).`);
|
|
4568
|
-
}
|
|
4569
|
-
return {
|
|
4570
|
-
role: "user",
|
|
4571
|
-
content
|
|
4572
|
-
};
|
|
4573
|
-
}
|
|
4574
|
-
/**
|
|
4575
|
-
* Build the prompt `SessionMessage` for a given provider.
|
|
4576
|
-
*
|
|
4577
|
-
* Prefers `provider.promptMessage` when defined, falling back to `defaultPromptMessage`.
|
|
4578
|
-
*/
|
|
4579
|
-
function buildPromptMessage(provider, parts) {
|
|
4580
|
-
if (provider.promptMessage) return provider.promptMessage(parts);
|
|
4581
|
-
return defaultPromptMessage(parts);
|
|
4582
|
-
}
|
|
4583
|
-
//#endregion
|
|
4584
4527
|
//#region src/repeat-guard.ts
|
|
4585
4528
|
const DEFAULT_BLOCK_THRESHOLD = 4;
|
|
4586
4529
|
const DEFAULT_ABORT_THRESHOLD = 8;
|
|
@@ -6094,6 +6037,7 @@ const HOOK_EVENT_SET = new Set([
|
|
|
6094
6037
|
"stream:error",
|
|
6095
6038
|
"stream:retry",
|
|
6096
6039
|
"oauth:refresh",
|
|
6040
|
+
"content-ref:resolve",
|
|
6097
6041
|
"tool:gate",
|
|
6098
6042
|
"tool:dispatched",
|
|
6099
6043
|
"tool:before",
|
|
@@ -8598,6 +8542,7 @@ const BUBBLED_EVENTS = [
|
|
|
8598
8542
|
"turn:after"
|
|
8599
8543
|
];
|
|
8600
8544
|
const BUBBLED_MUTABLE_EVENTS = [
|
|
8545
|
+
"content-ref:resolve",
|
|
8601
8546
|
"tool:gate",
|
|
8602
8547
|
"mcp:tool:gate",
|
|
8603
8548
|
"tool:transform"
|
|
@@ -8620,6 +8565,7 @@ const CHILD_EVENT_NAME = {
|
|
|
8620
8565
|
"turn:after": "child:turn:after"
|
|
8621
8566
|
};
|
|
8622
8567
|
const CHILD_MUTABLE_EVENT_NAME = {
|
|
8568
|
+
"content-ref:resolve": "content-ref:resolve",
|
|
8623
8569
|
"tool:gate": "child:tool:gate",
|
|
8624
8570
|
"mcp:tool:gate": "child:mcp:tool:gate",
|
|
8625
8571
|
"tool:transform": "child:tool:transform"
|
|
@@ -8781,8 +8727,8 @@ function bubbleHooks(childHooks, parentHooks, childId, depth) {
|
|
|
8781
8727
|
unregisters.push(unregister);
|
|
8782
8728
|
}
|
|
8783
8729
|
const tagOnCtx = (ctx) => {
|
|
8784
|
-
ctx.childId
|
|
8785
|
-
ctx.depth
|
|
8730
|
+
ctx.childId ??= childId;
|
|
8731
|
+
ctx.depth ??= depth;
|
|
8786
8732
|
};
|
|
8787
8733
|
for (const evt of BUBBLED_MUTABLE_EVENTS) {
|
|
8788
8734
|
const parentEvt = CHILD_MUTABLE_EVENT_NAME[evt];
|
|
@@ -8801,6 +8747,7 @@ function bubbleHooks(childHooks, parentHooks, childId, depth) {
|
|
|
8801
8747
|
}
|
|
8802
8748
|
for (const evt of BUBBLED_MUTABLE_EVENTS) {
|
|
8803
8749
|
const parentEvt = CHILD_MUTABLE_EVENT_NAME[evt];
|
|
8750
|
+
if (parentEvt === evt) continue;
|
|
8804
8751
|
unregisters.push(chainHook(parentEvt, async (ctx) => {
|
|
8805
8752
|
await fire(parentEvt, ctx);
|
|
8806
8753
|
}));
|
|
@@ -9124,4 +9071,4 @@ const writeFile$1 = {
|
|
|
9124
9071
|
//#endregion
|
|
9125
9072
|
export { restoreModelOptions as $, PERSISTENCE_PREVIEW_BYTES as A, cerebrasDescriptor as B, stableStringify as C, TOOL_USE_SKIPPED_MESSAGE as D, TOOL_USE_CANCELLED_MESSAGE as E, resolvePersistDir as F, getModelInfo as G, effectiveContextWindow as H, resolveTasksDir as I, modelSupportsReasoning as J, localDescriptor as K, BUILTIN_PROVIDERS as L, cleanupPersistedSession as M, maybePersistToolResult as N, validateToolArgs as O, resolveMcpWarningsDir as P, piIdOf as Q, OUTPUT_RESERVE_TOKENS as R, normalizeShellCommand as S, SHELL_CASCADE_CANCEL_MESSAGE as T, enabledModelOptions as U, credKeyOf as V, getContextWindow as W, openaiDescriptor as X, modelsForDescriptor as Y, openrouterDescriptor as Z, createSkillsReadTool as _, multiEdit as a, defaultRepeatGuardNormalize as b, grep as c, createAgent as d, WAIT_TASK_TIMED_OUT_PREFIX as f, createSkillsRunScriptTool as g, createSkillsUseTool as h, readFile$1 as i, buildPersistedStub as j, PERSISTED_STUB_PREFIX as k, glob$1 as l, createToolSearchTool as m, createSpawnTool as n, listFiles as o, waitTask as p, modelOptionsFor as q, shellKill as r, createInteractionTool as s, writeFile$1 as t, edit as u, createShellTool as v, INTERRUPT_MESSAGE_FOR_TOOL_USE as w, defaultRepeatGuardTracked as x, shell as y, anthropicDescriptor as z };
|
|
9126
9073
|
|
|
9127
|
-
//# sourceMappingURL=tools-
|
|
9074
|
+
//# sourceMappingURL=tools-CVFNtlyc.js.map
|