zidane 5.8.2 → 5.8.3
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-acjWZ_4E.d.ts → agent-CL4nT5Ti.d.ts} +145 -10
- package/dist/agent-CL4nT5Ti.d.ts.map +1 -0
- package/dist/chat/pure.d.ts +3 -3
- package/dist/chat.d.ts +6 -6
- package/dist/chat.js +2 -2
- package/dist/{headless-CJFFU6DI.js → headless-BfEQtRfX.js} +4 -4
- package/dist/{headless-CJFFU6DI.js.map → headless-BfEQtRfX.js.map} +1 -1
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +1 -1
- package/dist/{index-zy4OtFSv.d.ts → index-DdjlsREW.d.ts} +2 -2
- package/dist/{index-zy4OtFSv.d.ts.map → index-DdjlsREW.d.ts.map} +1 -1
- package/dist/{index-Cgr_mbMJ.d.ts → index-DtLfTUXt.d.ts} +2 -2
- package/dist/{index-Cgr_mbMJ.d.ts.map → index-DtLfTUXt.d.ts.map} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/{login-BjY_sBdn.js → login-Ck6dmcMH.js} +2 -2
- package/dist/{login-BjY_sBdn.js.map → login-Ck6dmcMH.js.map} +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/{presets-BmsTNxjR.js → presets-DIweYdlN.js} +2 -2
- package/dist/{presets-BmsTNxjR.js.map → presets-DIweYdlN.js.map} +1 -1
- package/dist/presets.d.ts +2 -2
- package/dist/presets.js +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/restate.d.ts +1 -1
- package/dist/session/sqlite.d.ts +1 -1
- package/dist/session.d.ts +1 -1
- package/dist/skills.d.ts +2 -2
- package/dist/{tool-formatters-B5UNV_sy.d.ts → tool-formatters-D-aWpu2N.d.ts} +2 -2
- package/dist/{tool-formatters-B5UNV_sy.d.ts.map → tool-formatters-D-aWpu2N.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-BzQtic6M.js → tools-DLRIhCl1.js} +94 -34
- package/dist/tools-DLRIhCl1.js.map +1 -0
- package/dist/tools.d.ts +2 -2
- package/dist/tools.js +1 -1
- package/dist/{transcript-anchors-Dtz6U4GW.d.ts → transcript-anchors-BJpOyLPm.d.ts} +4 -4
- package/dist/{transcript-anchors-Dtz6U4GW.d.ts.map → transcript-anchors-BJpOyLPm.d.ts.map} +1 -1
- package/dist/{transcript-anchors-C571npbs.js → transcript-anchors-Dc0WlxnA.js} +3 -3
- package/dist/{transcript-anchors-C571npbs.js.map → transcript-anchors-Dc0WlxnA.js.map} +1 -1
- package/dist/tui.d.ts +3 -3
- package/dist/tui.js +3 -3
- package/dist/{turn-operations-CqJAEzoe.d.ts → turn-operations-D-fypW6K.d.ts} +3 -3
- package/dist/{turn-operations-CqJAEzoe.d.ts.map → turn-operations-D-fypW6K.d.ts.map} +1 -1
- package/dist/types-BPw_i5vb.js.map +1 -1
- package/dist/types.d.ts +3 -3
- package/package.json +1 -1
- package/dist/agent-acjWZ_4E.d.ts.map +0 -1
- package/dist/tools-BzQtic6M.js.map +0 -1
package/dist/mcp.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Qt as McpServerConfig, _ as normalizeMcpServers, en as McpToolSchema, f as ConnectMcpServersOptions, g as normalizeMcpBlocks, h as connectMcpServers, m as attachStderrWarnPump, p as McpConnection, v as resultToString } from "./agent-
|
|
1
|
+
import { Qt as McpServerConfig, _ as normalizeMcpServers, en as McpToolSchema, f as ConnectMcpServersOptions, g as normalizeMcpBlocks, h as connectMcpServers, m as attachStderrWarnPump, p as McpConnection, v as resultToString } from "./agent-CL4nT5Ti.js";
|
|
2
2
|
export { ConnectMcpServersOptions, McpConnection, type McpServerConfig, type McpToolSchema, attachStderrWarnPump, connectMcpServers, normalizeMcpBlocks, normalizeMcpServers, resultToString };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as shell, a as multiEdit, i as readFile, n as createSpawnTool, o as listFiles, r as shellKill, t as writeFile, u as edit } from "./tools-
|
|
1
|
+
import { _ as shell, a as multiEdit, i as readFile, n as createSpawnTool, o as listFiles, r as shellKill, t as writeFile, u as edit } from "./tools-DLRIhCl1.js";
|
|
2
2
|
//#region src/presets/basic.ts
|
|
3
3
|
/**
|
|
4
4
|
* Core tools available in every basic preset (without spawn).
|
|
@@ -107,4 +107,4 @@ function composePresets(...presets) {
|
|
|
107
107
|
//#endregion
|
|
108
108
|
export { basic_default as i, definePreset as n, basicTools as r, composePresets as t };
|
|
109
109
|
|
|
110
|
-
//# sourceMappingURL=presets-
|
|
110
|
+
//# sourceMappingURL=presets-DIweYdlN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets-
|
|
1
|
+
{"version":3,"file":"presets-DIweYdlN.js","names":[],"sources":["../src/presets/basic.ts","../src/presets/index.ts"],"sourcesContent":["import { definePreset } from '.'\nimport { edit, listFiles, multiEdit, readFile, shell, shellKill, writeFile } from '../tools'\nimport { createSpawnTool } from '../tools/spawn'\n\n/**\n * Core tools available in every basic preset (without spawn).\n *\n * `edit` and `multi_edit` ship in the basic set because surgical edits are the\n * default modality for production agents — `write_file` is for full overwrites.\n * `glob` and `grep` are exported but opt-in: not every agent needs codebase\n * search, and shipping them by default would force `tool:gate` work onto\n * consumers that prefer the model to use `shell` + classic Unix tools.\n */\nexport const basicTools = { shell, shellKill, readFile, writeFile, listFiles, edit, multiEdit }\n\nexport default definePreset({\n name: 'basic',\n system: 'You are a helpful assistant with access to shell, file reading, file writing, surgical and multi-edit tools, directory listing, and sub-agent spawning. Prefer `edit` / `multi_edit` for in-place changes and `write_file` for full file overwrites. Use them to accomplish tasks in the project directory.',\n // `persist: true` shares the parent's session with every child agent — child\n // turns land in `session.turns` tagged with their own `runId`, and the run\n // itself is recorded in `session.runs` with `parentRunId` + `depth`. That's\n // what lets a reloaded TUI session reconstruct the full subagent tree (see\n // `eventsFromTurns` in `tui/store.ts`). Hosts that want children in-memory\n // only can construct their own preset with `createSpawnTool()`.\n tools: { ...basicTools, spawn: createSpawnTool({ persist: true }) },\n})\n","import type { AgentHooks, AgentOptions } from '../agent'\n\nexport type { AgentHookMap } from '../agent'\n\n/**\n * A preset is a reusable slice of `AgentOptions` — spread it into `createAgent()`\n * to configure tools, a default system prompt, aliases, behavior defaults, and\n * agent-lifetime hooks.\n *\n * `provider`, `execution`, `session`, and internal fields are excluded so presets\n * remain shareable and composable.\n *\n * ```ts\n * import { basic } from 'zidane/presets'\n * createAgent({ ...basic, provider })\n * ```\n *\n * ### Composing multiple presets\n *\n * Bare `...spread` is shallow — `{ ...a, ...b }` overwrites every key `b`\n * defines, including `hooks`. Use {@link composePresets} when you want\n * field-aware merging (per-event hook concat, tools shallow-merge, etc.):\n *\n * ```ts\n * createAgent({ ...composePresets(basic, telemetry, mine), provider })\n * ```\n */\nexport type Preset = Omit<Partial<AgentOptions>, 'provider' | 'execution' | 'session' | 'mcpConnector'>\n\n/**\n * Identity helper for type inference when defining a preset.\n */\nexport function definePreset(config: Preset): Preset {\n return config\n}\n\n/**\n * Field-aware composition of presets. Right-most preset wins for scalar fields;\n * objects shallow-merge; arrays and hook handler lists concatenate. Designed so\n * stacking presets does the obvious thing without the spread-collision footgun:\n *\n * - `name`, `system`, `eager`, `skills` → last-defined wins\n * - `tools`, `toolAliases`, `behavior` → shallow-merge (later keys override)\n * - `behavior.dedupTools`, `behavior.toolBudgets` → **deep-merge** (per-tool-name; later wins on collision)\n * - `mcpServers` → concat with last-wins on `name` collision\n * - `hooks` → per-event concat; every handler fires\n *\n * `hooks` always emerges as `event → handler[]` so downstream registration\n * (in `createAgent`) sees a uniform shape. Order of handlers within an event\n * follows preset order: earlier presets register first.\n *\n * `mcpServers` is deduped by `name` because shipping two servers with the same\n * name would trip the connector at runtime — a later preset overriding an\n * earlier preset's `github` server is the practical intent.\n *\n * `behavior.dedupTools` and `behavior.toolBudgets` get the same per-key deep-merge\n * because they are tool-name-keyed records — a preset that ships a dedup hasher\n * for one tool should not erase a hasher another preset ships for a different\n * tool. Last-wins still applies on a per-tool collision so a downstream preset\n * can override an upstream preset's policy for one specific tool. Other\n * `behavior` fields keep last-wins semantics.\n */\nexport function composePresets(...presets: Preset[]): Preset {\n const out: Preset = {}\n const hooksByEvent: { [K in keyof AgentHooks]?: AgentHooks[K][] } = {}\n // Keep mcpServers in source-order on first sight, but allow later\n // declarations to override earlier ones with the same `name`. A `Map`\n // keyed by name gives O(1) override + stable iteration.\n const mcpByName = new Map<string, NonNullable<Preset['mcpServers']>[number]>()\n\n for (const p of presets) {\n if (p.name !== undefined)\n out.name = p.name\n if (p.system !== undefined)\n out.system = p.system\n if (p.eager !== undefined)\n out.eager = p.eager\n if (p.skills !== undefined)\n out.skills = p.skills\n if (p.tools)\n out.tools = { ...out.tools, ...p.tools }\n if (p.toolAliases)\n out.toolAliases = { ...out.toolAliases, ...p.toolAliases }\n if (p.behavior) {\n // Top-level shallow-merge first; then deep-merge the two tool-name-keyed\n // sub-records so per-tool entries from earlier presets aren't clobbered.\n const merged: NonNullable<Preset['behavior']> = { ...out.behavior, ...p.behavior }\n if (out.behavior?.dedupTools || p.behavior.dedupTools) {\n merged.dedupTools = { ...out.behavior?.dedupTools, ...p.behavior.dedupTools }\n }\n if (out.behavior?.toolBudgets || p.behavior.toolBudgets) {\n merged.toolBudgets = { ...out.behavior?.toolBudgets, ...p.behavior.toolBudgets }\n }\n out.behavior = merged\n }\n if (p.mcpServers) {\n for (const server of p.mcpServers)\n mcpByName.set(server.name, server)\n }\n if (p.hooks) {\n for (const [event, handler] of Object.entries(p.hooks)) {\n if (handler === undefined)\n continue\n const list = Array.isArray(handler) ? handler : [handler]\n const key = event as keyof AgentHooks\n // Safe cast: we read the loose `AgentHookMap` shape (handler-or-array)\n // and re-emit only as arrays. Each `list` element matches the event's\n // handler signature by construction (the input was typed `AgentHookMap`).\n const bucket = (hooksByEvent[key] ??= []) as unknown[]\n bucket.push(...(list as unknown[]))\n }\n }\n }\n\n if (mcpByName.size > 0)\n out.mcpServers = [...mcpByName.values()]\n\n if (Object.keys(hooksByEvent).length > 0)\n out.hooks = hooksByEvent\n\n return out\n}\n\nexport { default as basic, basicTools } from './basic'\n"],"mappings":";;;;;;;;;;;AAaA,MAAa,aAAa;CAAE;CAAO;CAAW;CAAU;CAAW;CAAW;CAAM;AAAU;AAE9F,IAAA,gBAAe,aAAa;CAC1B,MAAM;CACN,QAAQ;CAOR,OAAO;EAAE,GAAG;EAAY,OAAO,gBAAgB,EAAE,SAAS,KAAK,CAAC;CAAE;AACpE,CAAC;;;;;;ACOD,SAAgB,aAAa,QAAwB;CACnD,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAgB,eAAe,GAAG,SAA2B;CAC3D,MAAM,MAAc,CAAC;CACrB,MAAM,eAA8D,CAAC;CAIrE,MAAM,4BAAY,IAAI,IAAuD;CAE7E,KAAK,MAAM,KAAK,SAAS;EACvB,IAAI,EAAE,SAAS,KAAA,GACb,IAAI,OAAO,EAAE;EACf,IAAI,EAAE,WAAW,KAAA,GACf,IAAI,SAAS,EAAE;EACjB,IAAI,EAAE,UAAU,KAAA,GACd,IAAI,QAAQ,EAAE;EAChB,IAAI,EAAE,WAAW,KAAA,GACf,IAAI,SAAS,EAAE;EACjB,IAAI,EAAE,OACJ,IAAI,QAAQ;GAAE,GAAG,IAAI;GAAO,GAAG,EAAE;EAAM;EACzC,IAAI,EAAE,aACJ,IAAI,cAAc;GAAE,GAAG,IAAI;GAAa,GAAG,EAAE;EAAY;EAC3D,IAAI,EAAE,UAAU;GAGd,MAAM,SAA0C;IAAE,GAAG,IAAI;IAAU,GAAG,EAAE;GAAS;GACjF,IAAI,IAAI,UAAU,cAAc,EAAE,SAAS,YACzC,OAAO,aAAa;IAAE,GAAG,IAAI,UAAU;IAAY,GAAG,EAAE,SAAS;GAAW;GAE9E,IAAI,IAAI,UAAU,eAAe,EAAE,SAAS,aAC1C,OAAO,cAAc;IAAE,GAAG,IAAI,UAAU;IAAa,GAAG,EAAE,SAAS;GAAY;GAEjF,IAAI,WAAW;EACjB;EACA,IAAI,EAAE,YACJ,KAAK,MAAM,UAAU,EAAE,YACrB,UAAU,IAAI,OAAO,MAAM,MAAM;EAErC,IAAI,EAAE,OACJ,KAAK,MAAM,CAAC,OAAO,YAAY,OAAO,QAAQ,EAAE,KAAK,GAAG;GACtD,IAAI,YAAY,KAAA,GACd;GACF,MAAM,OAAO,MAAM,QAAQ,OAAO,IAAI,UAAU,CAAC,OAAO;GACxD,MAAM,MAAM;GAKZ,CADgB,aAAa,SAAS,CAAC,GAChC,KAAK,GAAI,IAAkB;EACpC;CAEJ;CAEA,IAAI,UAAU,OAAO,GACnB,IAAI,aAAa,CAAC,GAAG,UAAU,OAAO,CAAC;CAEzC,IAAI,OAAO,KAAK,YAAY,EAAE,SAAS,GACrC,IAAI,QAAQ;CAEd,OAAO;AACT"}
|
package/dist/presets.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as AgentHookMap } from "./agent-
|
|
2
|
-
import { a as basicTools, i as _default, n as composePresets, r as definePreset, t as Preset } from "./index-
|
|
1
|
+
import { n as AgentHookMap } from "./agent-CL4nT5Ti.js";
|
|
2
|
+
import { a as basicTools, i as _default, n as composePresets, r as definePreset, t as Preset } from "./index-DdjlsREW.js";
|
|
3
3
|
export { type AgentHookMap, Preset, _default as basic, basicTools, composePresets, definePreset };
|
package/dist/presets.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as basic_default, n as definePreset, r as basicTools, t as composePresets } from "./presets-
|
|
1
|
+
import { i as basic_default, n as definePreset, r as basicTools, t as composePresets } from "./presets-DIweYdlN.js";
|
|
2
2
|
export { basic_default as basic, basicTools, composePresets, definePreset };
|
package/dist/providers.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { At as mapOAIFinishReason, Bt as AnthropicParams, Ct as sanitizeToolSpecs, Dt as OpenAICompatHttpError, Et as OpenAICompatAuthHeader, Ft as local, Ht as applyAnthropicCacheBreakpoints, It as CursorParams, Lt as cursor, Mt as OpenAIParams, Nt as openai, Ot as OpenAICompatParams, Pt as LocalParams, Rt as CerebrasParams, St as sanitizeToolSchema, Tt as openrouter, Vt as anthropic, _t as ToolSpec, bt as SchemaSanitizeProfile, dt as ProviderCapabilities, ft as StreamCallbacks, gt as ToolResult, ht as ToolCall, jt as openaiCompat, kt as classifyOpenAICompatError, mt as TokenCountPayload, pt as StreamOptions, ut as Provider, vt as TurnResult, wt as OpenRouterParams, xt as SchemaSanitizeResult, yt as SchemaSanitizeOptions, zt as cerebras } from "./agent-
|
|
1
|
+
import { At as mapOAIFinishReason, Bt as AnthropicParams, Ct as sanitizeToolSpecs, Dt as OpenAICompatHttpError, Et as OpenAICompatAuthHeader, Ft as local, Ht as applyAnthropicCacheBreakpoints, It as CursorParams, Lt as cursor, Mt as OpenAIParams, Nt as openai, Ot as OpenAICompatParams, Pt as LocalParams, Rt as CerebrasParams, St as sanitizeToolSchema, Tt as openrouter, Vt as anthropic, _t as ToolSpec, bt as SchemaSanitizeProfile, dt as ProviderCapabilities, ft as StreamCallbacks, gt as ToolResult, ht as ToolCall, jt as openaiCompat, kt as classifyOpenAICompatError, mt as TokenCountPayload, pt as StreamOptions, ut as Provider, vt as TurnResult, wt as OpenRouterParams, xt as SchemaSanitizeResult, yt as SchemaSanitizeOptions, zt as cerebras } from "./agent-CL4nT5Ti.js";
|
|
2
2
|
export { type AnthropicParams, type CerebrasParams, type CursorParams, type LocalParams, type OpenAICompatAuthHeader, OpenAICompatHttpError, type OpenAICompatParams, type OpenAIParams, type OpenRouterParams, Provider, ProviderCapabilities, type SchemaSanitizeOptions, type SchemaSanitizeProfile, type SchemaSanitizeResult, StreamCallbacks, StreamOptions, TokenCountPayload, ToolCall, ToolResult, ToolSpec, TurnResult, anthropic, applyAnthropicCacheBreakpoints, cerebras, classifyOpenAICompatError, cursor, local, mapOAIFinishReason, openai, openaiCompat, openrouter, sanitizeToolSchema, sanitizeToolSpecs };
|
package/dist/restate.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as SessionStore, Wt as AgentClock, b as ToolDef, pt as StreamOptions, ut as Provider } from "./agent-
|
|
1
|
+
import { L as SessionStore, Wt as AgentClock, b as ToolDef, pt as StreamOptions, ut as Provider } from "./agent-CL4nT5Ti.js";
|
|
2
2
|
|
|
3
3
|
//#region src/restate/types.d.ts
|
|
4
4
|
/**
|
package/dist/session/sqlite.d.ts
CHANGED
package/dist/session.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { B as RemoteStoreOptions, F as SessionData, G as createFileMapStore, H as createMemoryStore, I as SessionRun, L as SessionStore, N as CreateSessionOptions, P as Session, Q as ToWireMessagesOptions, R as createSession, U as FileMapAdapter, V as createRemoteStore, W as FileMapStoreOptions, at as fromAnthropic, ct as toOpenAI, et as autoDetectAndConvert, lt as toWireMessages, mn as SessionTurn, ot as fromOpenAI, pn as SessionMessage, st as toAnthropic, un as SessionContentBlock, z as loadSession } from "./agent-
|
|
1
|
+
import { B as RemoteStoreOptions, F as SessionData, G as createFileMapStore, H as createMemoryStore, I as SessionRun, L as SessionStore, N as CreateSessionOptions, P as Session, Q as ToWireMessagesOptions, R as createSession, U as FileMapAdapter, V as createRemoteStore, W as FileMapStoreOptions, at as fromAnthropic, ct as toOpenAI, et as autoDetectAndConvert, lt as toWireMessages, mn as SessionTurn, ot as fromOpenAI, pn as SessionMessage, st as toAnthropic, un as SessionContentBlock, z as loadSession } from "./agent-CL4nT5Ti.js";
|
|
2
2
|
export { CreateSessionOptions, type FileMapAdapter, type FileMapStoreOptions, type RemoteStoreOptions, Session, type SessionContentBlock, SessionData, type SessionMessage, SessionRun, SessionStore, type SessionTurn, type ToWireMessagesOptions, autoDetectAndConvert, createFileMapStore, createMemoryStore, createRemoteStore, createSession, fromAnthropic, fromOpenAI, loadSession, toAnthropic, toOpenAI, toWireMessages };
|
package/dist/skills.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as SkillResource, M as SkillsConfig, O as SkillConfig, c as DeactivationReason, d as createSkillActivationState, j as SkillSource, k as SkillDiagnostic, l as SkillActivationState, o as ActivationVia, s as ActiveSkill, u as SkillActivationStateOptions } from "./agent-
|
|
2
|
-
import { S as installAllowedToolsGate, _ as inferSource, a as SkillValidationResult, b as buildCatalog, c as parseAllowedToolPattern, d as validateSkillName, f as resolveSkills, g as getDefaultScanPaths, h as discoverSkills, i as SkillValidationIssue, l as validateResourcePath, m as SourcedScanPath, n as writeSkillToDisk, o as isToolAllowedByUnion, p as interpolateShellCommands, r as writeSkillsToDisk, s as matchesAllowedTool, t as defineSkill, u as validateSkillForWrite, v as parseFrontmatter, x as IMPLICITLY_ALLOWED_SKILL_TOOLS, y as parseSkillFile } from "./index-
|
|
1
|
+
import { A as SkillResource, M as SkillsConfig, O as SkillConfig, c as DeactivationReason, d as createSkillActivationState, j as SkillSource, k as SkillDiagnostic, l as SkillActivationState, o as ActivationVia, s as ActiveSkill, u as SkillActivationStateOptions } from "./agent-CL4nT5Ti.js";
|
|
2
|
+
import { S as installAllowedToolsGate, _ as inferSource, a as SkillValidationResult, b as buildCatalog, c as parseAllowedToolPattern, d as validateSkillName, f as resolveSkills, g as getDefaultScanPaths, h as discoverSkills, i as SkillValidationIssue, l as validateResourcePath, m as SourcedScanPath, n as writeSkillToDisk, o as isToolAllowedByUnion, p as interpolateShellCommands, r as writeSkillsToDisk, s as matchesAllowedTool, t as defineSkill, u as validateSkillForWrite, v as parseFrontmatter, x as IMPLICITLY_ALLOWED_SKILL_TOOLS, y as parseSkillFile } from "./index-DtLfTUXt.js";
|
|
3
3
|
export { type ActivationVia, type ActiveSkill, type DeactivationReason, IMPLICITLY_ALLOWED_SKILL_TOOLS, type SkillActivationState, type SkillActivationStateOptions, type SkillConfig, type SkillDiagnostic, type SkillResource, type SkillSource, type SkillValidationIssue, type SkillValidationResult, type SkillsConfig, type SourcedScanPath, buildCatalog, createSkillActivationState, defineSkill, discoverSkills, getDefaultScanPaths, inferSource, installAllowedToolsGate, interpolateShellCommands, isToolAllowedByUnion, matchesAllowedTool, parseAllowedToolPattern, parseFrontmatter, parseSkillFile, resolveSkills, validateResourcePath, validateSkillForWrite, validateSkillName, writeSkillToDisk, writeSkillsToDisk };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _n as ThinkingLevel, ut as Provider } from "./agent-
|
|
1
|
+
import { _n as ThinkingLevel, ut as Provider } from "./agent-CL4nT5Ti.js";
|
|
2
2
|
import { OAuthProviderInterface } from "@earendil-works/pi-ai/oauth";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
|
|
@@ -1468,4 +1468,4 @@ declare function displayNameFor(name: string, input?: Record<string, unknown>):
|
|
|
1468
1468
|
declare function formatToolCall(name: string, input: Record<string, unknown>): ToolFormatLine | null;
|
|
1469
1469
|
//#endregion
|
|
1470
1470
|
export { anthropicDescriptor as $, SessionMeta as A, collectReferences as B, EditHunk as C, Owner as D, EditPayload as E, CompletionContext as F, ProviderKey as G, mergeReferences as H, CompletionItem as I, CustomField as J, detectAuth as K, CompletionProvider as L, StreamEvent as M, ToolCallDisplay as N, Picked as O, ActiveTrigger as P, ProviderDescriptor as Q, CompletionReference as R, EditDiffDisplay as S, EditOutcomeKind as T, AuthMethod as U, findActiveTrigger as V, ProviderAuth as W, ModelOption as X, ModelInfo as Y, OUTPUT_RESERVE_TOKENS as Z, isEditErrorResult as _, formatToolCall as a, getModelInfo as at, selectableTurnIds as b, splitPromptSegments as c, modelSupportsReasoning as ct, RequestApproval as d, openrouterDescriptor as dt, cerebrasDescriptor as et, SafeModeActions as f, piIdOf as ft, EDIT_TOOL_NAMES as g, useSafeModeQueue as h, displayNameFor as i, getContextWindow as it, Settings as j, Screen as k, ApprovalDecision as l, modelsForDescriptor as lt, useSafeModeActions as m, ToolDisplayMeta as n, effectiveContextWindow as nt, PromptSegment as o, localDescriptor as ot, SafeModeProvider as p, restoreModelOptions as pt, BUILTIN_PROVIDERS as q, ToolFormatLine as r, enabledModelOptions as rt, PromptSegmentRef as s, modelOptionsFor as st, TOOL_DISPLAY as t, credKeyOf as tt, ApprovalRequest as u, openaiDescriptor as ut, isTurnHighlighted as v, EditOutcome as w, turnSelectionOwnership as x, isVisible as y, applyInsert as z };
|
|
1471
|
-
//# sourceMappingURL=tool-formatters-
|
|
1471
|
+
//# sourceMappingURL=tool-formatters-D-aWpu2N.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-formatters-
|
|
1
|
+
{"version":3,"file":"tool-formatters-D-aWpu2N.d.ts","names":[],"sources":["../src/chat/providers.ts","../src/chat/auth.ts","../src/chat/completion-core.ts","../src/chat/types.ts","../src/chat/turn-selection.ts","../src/chat/safe-mode-context.tsx","../src/chat/prompt-segments.ts","../src/chat/tool-formatters.ts"],"mappings":";;;;;;;;;;;;;;;;;UA8CiB,SAAA;EACf,EAAA;EACA,IAAA;EACA,aAAA;EACA,SAAA;EACA,SAAA;EACA,KAAA;EACA,IAAA;IAAS,KAAA;IAAe,MAAA;IAAgB,SAAA;IAAoB,UAAA;EAAA;EAC5D,QAAA;EA4BkF;AAAA;AAgBpF;;;;;EApCE,OAAA,YAAmB,WAAW;AAAA;;;;;AAgDtB;UAxCO,WAAA;EA2CkB;EAzCjC,EAAA;EAwDe;EAtDf,KAAA;EAqGkB;EAnGlB,WAAA;EAwHuB;;;;;EAlHvB,cAAA;IAAmB,KAAA;IAAgB,MAAA;IAAiB,SAAA;IAAoB,UAAA;EAAA;AAAA;;;;;;;;;;;;;;UAgBzD,WAAA;EAwHI;EAtHnB,GAAA;EA0Hc;EAxHd,KAAA;;EAEA,MAAA;EAsHgD;EApHhD,WAAA;EAyHoB;EAvHpB,IAAA;EAuH2B;EArH3B,QAAA;AAAA;AAAA,UAGe,kBAAA;;;A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;;iBAmBc,gBAAA,CAAA;EAAmB;AAAA;EAAc,QAAA,EAAU,SAAS;AAAA,gCAAE,GAAA,CAAA,OAAA;AAAA,iBAuDtD,gBAAA,CAAA,YAA6B,eAAe;AAAA,iBAI5C,kBAAA,CAAA,GAAsB,eAAe;;;;;;;;AL1GrD;;;;;;;;;;;UM7BiB,gBAAA;EACf,KAAA;EACA,GAAA;ENkC4D;EMhC5D,UAAA;AAAA;;;ANyC8B;AAQhC;;;KMxCY,aAAA;EACJ,IAAA;EAAe,IAAA;AAAA;EACf,IAAA;EAAc,IAAA;EAAc,UAAA;AAAA;;;ANkDgD;AAgBpF;;;;;;;;;;;AAYU;AAGV;;;;;;;iBMzDgB,mBAAA,CACd,IAAA,UACA,IAAA,WAAe,gBAAA,KACd,aAAa;;;;;;;;ANbhB;;;;;;;;;;;;UO1BiB,cAAA;EPiCyB;;;;;EO3BxC,MAAA;EPoC8B;AAQhC;;;;EOtCE,IAAI;AAAA;AAAA,UAGW,eAAA;EP+Cf;;;;;;AAAkF;AAgBpF;;EOrDE,WAAA,aAAwB,KAAA,EAAO,MAAA;EPqDL;;;;;EO/C1B,MAAA,GAAS,KAAA,EAAO,MAAA,sBAA4B,cAAA;AAAA;AAAA,cAOjC,YAAA,EAAc,QAAA,CAAS,MAAA,SAAe,eAAA;APoDzC;AAGV;;;;;;;;;;;;;;AAHU,iBO4OM,cAAA,CACd,IAAA,UACA,KAAA,GAAQ,MAAM;;;;;;;iBAkBA,cAAA,CAAe,IAAA,UAAc,KAAA,EAAO,MAAA,oBAA0B,cAAc"}
|
|
@@ -1988,6 +1988,16 @@ const TOOL_USE_SKIPPED_MESSAGE = "[Tool use skipped — superseded by user messa
|
|
|
1988
1988
|
* calls in the batch continue running, in contrast with a full-run abort.
|
|
1989
1989
|
*/
|
|
1990
1990
|
const TOOL_USE_CANCELLED_MESSAGE = "[Tool call cancelled by user]";
|
|
1991
|
+
/** Reason surfaced on `siblingAbort.signal` when a shell error cancels its fleet. */
|
|
1992
|
+
const SHELL_CASCADE_REASON = "sibling-shell-error";
|
|
1993
|
+
/**
|
|
1994
|
+
* Canonical `tool_result.content` text emitted to siblings that were
|
|
1995
|
+
* cancelled by a `shell` error in the same batch. Distinct from
|
|
1996
|
+
* {@link INTERRUPT_MESSAGE_FOR_TOOL_USE} (user-issued abort) and
|
|
1997
|
+
* {@link TOOL_USE_SKIPPED_MESSAGE} (steered) so consumers can split
|
|
1998
|
+
* the three causes by string-match.
|
|
1999
|
+
*/
|
|
2000
|
+
const SHELL_CASCADE_CANCEL_MESSAGE = "Cancelled: a sibling `shell` call in the same batch errored; re-run independently if still needed.";
|
|
1991
2001
|
/**
|
|
1992
2002
|
* Sentinel message rejected from the per-call cancellation promise inside
|
|
1993
2003
|
* {@link executeSingleTool}'s race. Plain-string and module-private — only
|
|
@@ -2347,6 +2357,19 @@ function sanitizeStoredToolResults(provider, messages) {
|
|
|
2347
2357
|
} : msg;
|
|
2348
2358
|
});
|
|
2349
2359
|
}
|
|
2360
|
+
/**
|
|
2361
|
+
* Build the `agent:abort` ctx, attaching the run id and (when present) the
|
|
2362
|
+
* string reason carried on `signal.reason` — lets telemetry correlate the
|
|
2363
|
+
* abort with its run and distinguish a reasoned abort (e.g. a guard) from a
|
|
2364
|
+
* bare `agent.abort()`.
|
|
2365
|
+
*/
|
|
2366
|
+
function buildAbortCtx(ctx) {
|
|
2367
|
+
const reason = ctx.signal.reason;
|
|
2368
|
+
return {
|
|
2369
|
+
...ctx.runId ? { runId: ctx.runId } : {},
|
|
2370
|
+
...typeof reason === "string" && reason.length > 0 ? { reason } : {}
|
|
2371
|
+
};
|
|
2372
|
+
}
|
|
2350
2373
|
async function runLoop(ctx) {
|
|
2351
2374
|
let totalIn = 0;
|
|
2352
2375
|
let totalOut = 0;
|
|
@@ -2368,7 +2391,7 @@ async function runLoop(ctx) {
|
|
|
2368
2391
|
try {
|
|
2369
2392
|
for (let turn = 0; turn < maxTurns; turn++) {
|
|
2370
2393
|
if (ctx.signal.aborted) {
|
|
2371
|
-
await ctx.hooks.callHook("agent:abort",
|
|
2394
|
+
await ctx.hooks.callHook("agent:abort", buildAbortCtx(ctx));
|
|
2372
2395
|
break;
|
|
2373
2396
|
}
|
|
2374
2397
|
const result = await executeTurn(ctx, turn, {
|
|
@@ -2397,7 +2420,7 @@ async function runLoop(ctx) {
|
|
|
2397
2420
|
if (pauseCap > 0 && consecutiveEmptyPauseTurns >= pauseCap) break;
|
|
2398
2421
|
} else consecutiveEmptyPauseTurns = 0;
|
|
2399
2422
|
if (ctx.signal.aborted) {
|
|
2400
|
-
await ctx.hooks.callHook("agent:abort",
|
|
2423
|
+
await ctx.hooks.callHook("agent:abort", buildAbortCtx(ctx));
|
|
2401
2424
|
break;
|
|
2402
2425
|
}
|
|
2403
2426
|
const breach = checkRunBudget({
|
|
@@ -2853,6 +2876,7 @@ async function executeTurn(ctx, turn, priorUsage) {
|
|
|
2853
2876
|
turnId,
|
|
2854
2877
|
usage: errorUsage,
|
|
2855
2878
|
message: errorTurn,
|
|
2879
|
+
aborted: wasAborted,
|
|
2856
2880
|
toolCounts: {
|
|
2857
2881
|
turn: Object.freeze({}),
|
|
2858
2882
|
run: Object.freeze({ ...ctx.runToolCounts })
|
|
@@ -2892,6 +2916,7 @@ async function executeTurn(ctx, turn, priorUsage) {
|
|
|
2892
2916
|
turnId,
|
|
2893
2917
|
usage: result.usage,
|
|
2894
2918
|
message: assistantTurn,
|
|
2919
|
+
aborted: ctx.signal.aborted,
|
|
2895
2920
|
toolCounts: {
|
|
2896
2921
|
turn: Object.freeze(turnCounts),
|
|
2897
2922
|
run: Object.freeze({ ...ctx.runToolCounts })
|
|
@@ -3228,6 +3253,7 @@ async function runSingleToolDispatch(ctx, call, turnId, fixed) {
|
|
|
3228
3253
|
let output = "";
|
|
3229
3254
|
let isError = false;
|
|
3230
3255
|
let cancelledByUser = false;
|
|
3256
|
+
let reportedOutcome;
|
|
3231
3257
|
const childSignal = typeof AbortSignal.any === "function" ? AbortSignal.any([ctx.signal, perCallAbort.signal]) : ctx.signal;
|
|
3232
3258
|
try {
|
|
3233
3259
|
const toolCtx = {
|
|
@@ -3250,7 +3276,10 @@ async function runSingleToolDispatch(ctx, call, turnId, fixed) {
|
|
|
3250
3276
|
...ctx.session ? { session: ctx.session } : {},
|
|
3251
3277
|
...ctx.readState ? { readState: ctx.readState } : {},
|
|
3252
3278
|
...typeof ctx.depth === "number" ? { depth: ctx.depth } : {},
|
|
3253
|
-
clock: ctx.clock
|
|
3279
|
+
clock: ctx.clock,
|
|
3280
|
+
reportOutcome: (outcome) => {
|
|
3281
|
+
reportedOutcome = outcome;
|
|
3282
|
+
}
|
|
3254
3283
|
};
|
|
3255
3284
|
const bodyPromise = toolDef.execute(effectiveInput, toolCtx);
|
|
3256
3285
|
bodyPromise.catch(() => {});
|
|
@@ -3273,7 +3302,10 @@ async function runSingleToolDispatch(ctx, call, turnId, fixed) {
|
|
|
3273
3302
|
const isOurSentinel = err instanceof Error && err.message === CANCELLED_BY_USER_SENTINEL;
|
|
3274
3303
|
const isAbortError = err instanceof Error && err.name === "AbortError";
|
|
3275
3304
|
if (isOurSentinel || isAbortError && perCallAbort.signal.aborted) cancelledByUser = true;
|
|
3276
|
-
else {
|
|
3305
|
+
else if (isAbortError && ctx.signal.aborted) {
|
|
3306
|
+
output = ctx.signal.reason === SHELL_CASCADE_REASON ? SHELL_CASCADE_CANCEL_MESSAGE : INTERRUPT_MESSAGE_FOR_TOOL_USE;
|
|
3307
|
+
isError = true;
|
|
3308
|
+
} else {
|
|
3277
3309
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
3278
3310
|
const errorCtx = {
|
|
3279
3311
|
...buildToolHookBase(ctx, turnId, callId, call.name, displayName, effectiveInput),
|
|
@@ -3306,7 +3338,8 @@ async function runSingleToolDispatch(ctx, call, turnId, fixed) {
|
|
|
3306
3338
|
output,
|
|
3307
3339
|
isError,
|
|
3308
3340
|
runToolCounts,
|
|
3309
|
-
...coercions ? { coercions } : {}
|
|
3341
|
+
...coercions ? { coercions } : {},
|
|
3342
|
+
...reportedOutcome ? { outcome: reportedOutcome } : {}
|
|
3310
3343
|
});
|
|
3311
3344
|
return { result: {
|
|
3312
3345
|
id: callId,
|
|
@@ -3316,12 +3349,14 @@ async function runSingleToolDispatch(ctx, call, turnId, fixed) {
|
|
|
3316
3349
|
}
|
|
3317
3350
|
/**
|
|
3318
3351
|
* Fire `tool:dispatched` with the resolved path discriminator. Every code
|
|
3319
|
-
* path in {@link executeSingleTool} that produces a tool_result
|
|
3320
|
-
*
|
|
3321
|
-
*
|
|
3322
|
-
*
|
|
3323
|
-
*
|
|
3324
|
-
*
|
|
3352
|
+
* path in {@link executeSingleTool} that produces a tool_result calls this
|
|
3353
|
+
* exactly once — so a `tool:dispatched` precedes every terminal event. The
|
|
3354
|
+
* terminal that closes a dispatch depends on `outcome`: `execute` closes with
|
|
3355
|
+
* `tool:after` OR `tool:cancelled` (in-flight cancel), `gate-substitute` with
|
|
3356
|
+
* `tool:after`, and `gate-block`/`invalid-input`/`unknown` carry their result
|
|
3357
|
+
* on the dispatch path itself (no `tool:after`). See the `tool:dispatched`
|
|
3358
|
+
* hook doc in `agent.ts` for the full per-outcome pairing. The strict
|
|
3359
|
+
* direction holds unconditionally: no `tool:after` fires without a dispatch.
|
|
3325
3360
|
*
|
|
3326
3361
|
* Helper exists to centralize the optional-field plumbing for `reason`
|
|
3327
3362
|
* (only set on `gate-block`) without sprinkling spread-conditional logic
|
|
@@ -3349,7 +3384,7 @@ async function fireDispatched(ctx, params) {
|
|
|
3349
3384
|
* on the wire.
|
|
3350
3385
|
*/
|
|
3351
3386
|
async function emitToolResult(ctx, params) {
|
|
3352
|
-
const { turnId, callId, name, displayName, input, runToolCounts, coercions } = params;
|
|
3387
|
+
const { turnId, callId, name, displayName, input, runToolCounts, coercions, outcome } = params;
|
|
3353
3388
|
let output = params.output;
|
|
3354
3389
|
let isError = params.isError;
|
|
3355
3390
|
const transformCtx = {
|
|
@@ -3362,6 +3397,7 @@ async function emitToolResult(ctx, params) {
|
|
|
3362
3397
|
await ctx.hooks.callHook("tool:transform", transformCtx);
|
|
3363
3398
|
output = transformCtx.result;
|
|
3364
3399
|
isError = transformCtx.isError;
|
|
3400
|
+
const finalOutcome = isError && outcome && outcome !== "failed" ? "failed" : outcome;
|
|
3365
3401
|
const threshold = ctx.persistThreshold;
|
|
3366
3402
|
const persistDir = ctx.persistDir;
|
|
3367
3403
|
if (threshold && threshold > 0 && persistDir) {
|
|
@@ -3383,7 +3419,8 @@ async function emitToolResult(ctx, params) {
|
|
|
3383
3419
|
result: output,
|
|
3384
3420
|
outputBytes: toolOutputByteLength(output),
|
|
3385
3421
|
runToolCounts,
|
|
3386
|
-
...coercions ? { coercions } : {}
|
|
3422
|
+
...coercions ? { coercions } : {},
|
|
3423
|
+
...finalOutcome ? { outcome: finalOutcome } : {}
|
|
3387
3424
|
});
|
|
3388
3425
|
return {
|
|
3389
3426
|
output,
|
|
@@ -3394,16 +3431,6 @@ async function emitToolResult(ctx, params) {
|
|
|
3394
3431
|
const DEFAULT_MAX_CONCURRENT_TOOLS = 10;
|
|
3395
3432
|
/** Canonical name of the shell tool — referenced for cascade-cancel semantics. */
|
|
3396
3433
|
const SHELL_TOOL_NAME = "shell";
|
|
3397
|
-
/** Reason surfaced on `siblingAbort.signal` when a shell error cancels its fleet. */
|
|
3398
|
-
const SHELL_CASCADE_REASON = "sibling-shell-error";
|
|
3399
|
-
/**
|
|
3400
|
-
* Canonical `tool_result.content` text emitted to siblings that were
|
|
3401
|
-
* cancelled by a `shell` error in the same batch. Distinct from
|
|
3402
|
-
* {@link INTERRUPT_MESSAGE_FOR_TOOL_USE} (user-issued abort) and
|
|
3403
|
-
* {@link TOOL_USE_SKIPPED_MESSAGE} (steered) so consumers can split
|
|
3404
|
-
* the three causes by string-match.
|
|
3405
|
-
*/
|
|
3406
|
-
const SHELL_CASCADE_CANCEL_MESSAGE = "Cancelled: a sibling `shell` call in the same batch errored; re-run independently if still needed.";
|
|
3407
3434
|
/**
|
|
3408
3435
|
* Resolve a tool's concurrency-safety verdict for a specific call.
|
|
3409
3436
|
*
|
|
@@ -5433,9 +5460,9 @@ function createAgent({ provider, name: agentName, system: agentSystem, tools: ag
|
|
|
5433
5460
|
startedAt: runStartedAt,
|
|
5434
5461
|
...options.tracingContext ? { tracingContext: Object.freeze({ ...options.tracingContext }) } : {}
|
|
5435
5462
|
});
|
|
5436
|
-
if (externalSignal) if (externalSignal.aborted) abortController.abort();
|
|
5463
|
+
if (externalSignal) if (externalSignal.aborted) abortController.abort(externalSignal.reason);
|
|
5437
5464
|
else {
|
|
5438
|
-
externalAbortListener = () => abortController?.abort();
|
|
5465
|
+
externalAbortListener = () => abortController?.abort(externalSignal.reason);
|
|
5439
5466
|
externalSignal.addEventListener("abort", externalAbortListener, { once: true });
|
|
5440
5467
|
}
|
|
5441
5468
|
idlePromise = new Promise((resolve) => {
|
|
@@ -5836,6 +5863,11 @@ function createAgent({ provider, name: agentName, system: agentSystem, tools: ag
|
|
|
5836
5863
|
} catch (err) {
|
|
5837
5864
|
await flushTurns({ failureFallback: true });
|
|
5838
5865
|
if (abortController.signal.aborted) {
|
|
5866
|
+
const abortReason = abortController.signal.reason;
|
|
5867
|
+
await hooks.callHook("agent:abort", {
|
|
5868
|
+
...runId ? { runId } : {},
|
|
5869
|
+
...typeof abortReason === "string" && abortReason.length > 0 ? { reason: abortReason } : {}
|
|
5870
|
+
});
|
|
5839
5871
|
session?.abortRun(runId);
|
|
5840
5872
|
await finalizeSession("aborted");
|
|
5841
5873
|
const stats = {
|
|
@@ -5900,10 +5932,14 @@ function createAgent({ provider, name: agentName, system: agentSystem, tools: ag
|
|
|
5900
5932
|
return await executionContext.killBackground(executionHandle, taskId) !== null;
|
|
5901
5933
|
}
|
|
5902
5934
|
function steer(message) {
|
|
5935
|
+
if (abortController?.signal.aborted) return false;
|
|
5903
5936
|
steeringQueue.push(message);
|
|
5937
|
+
return true;
|
|
5904
5938
|
}
|
|
5905
5939
|
function followUpFn(message) {
|
|
5940
|
+
if (abortController?.signal.aborted) return false;
|
|
5906
5941
|
followUpQueue.push(message);
|
|
5942
|
+
return true;
|
|
5907
5943
|
}
|
|
5908
5944
|
function waitForIdle() {
|
|
5909
5945
|
return idlePromise ?? Promise.resolve();
|
|
@@ -6022,6 +6058,7 @@ function createAgent({ provider, name: agentName, system: agentSystem, tools: ag
|
|
|
6022
6058
|
if (destroyed) return;
|
|
6023
6059
|
destroyed = true;
|
|
6024
6060
|
pendingTaskNotifications.clear();
|
|
6061
|
+
if (abortController && !abortController.signal.aborted) abortController.abort("agent-destroyed");
|
|
6025
6062
|
for (const controller of pendingToolCancels.values()) if (!controller.signal.aborted) controller.abort("agent-destroyed");
|
|
6026
6063
|
pendingToolCancels.clear();
|
|
6027
6064
|
if (mcpWarmupPromise) try {
|
|
@@ -6314,7 +6351,9 @@ const edit = {
|
|
|
6314
6351
|
try {
|
|
6315
6352
|
original = await ctx.execution.readFile(ctx.handle, target);
|
|
6316
6353
|
} catch {
|
|
6317
|
-
|
|
6354
|
+
const hint = await suggestionFor(ctx.execution, ctx.handle, target);
|
|
6355
|
+
ctx.reportOutcome?.("failed");
|
|
6356
|
+
return `Edit error: file not found: ${target}.${hint}`;
|
|
6318
6357
|
}
|
|
6319
6358
|
if (ctx.behavior?.requireReadBeforeEdit) {
|
|
6320
6359
|
const readState = resolveReadStateMap(ctx);
|
|
@@ -6328,13 +6367,17 @@ const edit = {
|
|
|
6328
6367
|
const match = resolveOldString(original, find);
|
|
6329
6368
|
if (!match) {
|
|
6330
6369
|
const preview = nearestMatchPreview(original, find);
|
|
6370
|
+
ctx.reportOutcome?.("failed");
|
|
6331
6371
|
return preview ? `Edit error: old_string not found in ${target}. Closest match in the file: ${preview}` : `Edit error: old_string not found in ${target}.`;
|
|
6332
6372
|
}
|
|
6333
6373
|
const { actual, occurrences, via } = match;
|
|
6334
6374
|
if (occurrences > 1 && !replaceAll) return `Edit error: old_string appears ${occurrences} times in ${target}. Pass replace_all=true or expand old_string for uniqueness.`;
|
|
6335
6375
|
const styledReplacement = styleReplacementForVia(replacement, via, actual);
|
|
6336
6376
|
const updated = replaceAll ? original.split(actual).join(styledReplacement) : original.replace(actual, styledReplacement);
|
|
6337
|
-
if (updated === original)
|
|
6377
|
+
if (updated === original) {
|
|
6378
|
+
ctx.reportOutcome?.("noop");
|
|
6379
|
+
return `Edit error: replacement produced no change in ${target}.`;
|
|
6380
|
+
}
|
|
6338
6381
|
await ctx.execution.writeFile(ctx.handle, target, updated);
|
|
6339
6382
|
const readState = resolveReadStateMap(ctx);
|
|
6340
6383
|
if (readState) {
|
|
@@ -6346,6 +6389,7 @@ const edit = {
|
|
|
6346
6389
|
mtimeMs: Date.now()
|
|
6347
6390
|
});
|
|
6348
6391
|
}
|
|
6392
|
+
ctx.reportOutcome?.("edited");
|
|
6349
6393
|
return `Edited ${target}: replaced ${occurrences} occurrence${occurrences === 1 ? "" : "s"}.`;
|
|
6350
6394
|
}
|
|
6351
6395
|
};
|
|
@@ -6808,20 +6852,31 @@ const multiEdit = {
|
|
|
6808
6852
|
async execute({ path, edits }, ctx) {
|
|
6809
6853
|
const target = path;
|
|
6810
6854
|
const steps = edits;
|
|
6811
|
-
if (!Array.isArray(steps) || steps.length === 0)
|
|
6855
|
+
if (!Array.isArray(steps) || steps.length === 0) {
|
|
6856
|
+
ctx.reportOutcome?.("failed");
|
|
6857
|
+
return `multi_edit error: edits must be a non-empty array.`;
|
|
6858
|
+
}
|
|
6812
6859
|
let current;
|
|
6813
6860
|
try {
|
|
6814
6861
|
current = await ctx.execution.readFile(ctx.handle, target);
|
|
6815
6862
|
} catch {
|
|
6816
|
-
|
|
6863
|
+
const hint = await suggestionFor(ctx.execution, ctx.handle, target);
|
|
6864
|
+
ctx.reportOutcome?.("failed");
|
|
6865
|
+
return `multi_edit error: file not found: ${target}.${hint}`;
|
|
6817
6866
|
}
|
|
6818
6867
|
if (ctx.behavior?.requireReadBeforeEdit) {
|
|
6819
6868
|
const readState = resolveReadStateMap(ctx);
|
|
6820
6869
|
if (readState) {
|
|
6821
6870
|
const absKey = readStateKey(ctx.handle.cwd, target);
|
|
6822
6871
|
const prior = readState.get(absKey);
|
|
6823
|
-
if (!prior)
|
|
6824
|
-
|
|
6872
|
+
if (!prior) {
|
|
6873
|
+
ctx.reportOutcome?.("failed");
|
|
6874
|
+
return `multi_edit error: ${target} has not been read in this session. Call read_file first so the edits apply against the current contents.`;
|
|
6875
|
+
}
|
|
6876
|
+
if (prior.contentHash !== hashContent(current)) {
|
|
6877
|
+
ctx.reportOutcome?.("failed");
|
|
6878
|
+
return `multi_edit error: ${target} has changed on disk since the last read. Re-read the file before editing.`;
|
|
6879
|
+
}
|
|
6825
6880
|
}
|
|
6826
6881
|
}
|
|
6827
6882
|
const outcomes = [];
|
|
@@ -6877,6 +6932,7 @@ const multiEdit = {
|
|
|
6877
6932
|
const failedCount = outcomes.length - appliedCount;
|
|
6878
6933
|
if (appliedCount > 0) {
|
|
6879
6934
|
await ctx.execution.writeFile(ctx.handle, target, current);
|
|
6935
|
+
ctx.reportOutcome?.("edited");
|
|
6880
6936
|
const readState = resolveReadStateMap(ctx);
|
|
6881
6937
|
if (readState) {
|
|
6882
6938
|
const absKey = readStateKey(ctx.handle.cwd, target);
|
|
@@ -6887,7 +6943,7 @@ const multiEdit = {
|
|
|
6887
6943
|
mtimeMs: Date.now()
|
|
6888
6944
|
});
|
|
6889
6945
|
}
|
|
6890
|
-
}
|
|
6946
|
+
} else ctx.reportOutcome?.("failed");
|
|
6891
6947
|
const n = steps.length;
|
|
6892
6948
|
let header;
|
|
6893
6949
|
if (appliedCount === n) header = `Edited ${target}: applied ${n} edit${n === 1 ? "" : "s"} (${totalReplacements} replacement${totalReplacements === 1 ? "" : "s"}).`;
|
|
@@ -7676,7 +7732,10 @@ const writeFile$1 = {
|
|
|
7676
7732
|
existing = await ctx.execution.readFile(ctx.handle, targetPath);
|
|
7677
7733
|
} catch {}
|
|
7678
7734
|
const bytes = Buffer.byteLength(targetContent);
|
|
7679
|
-
if (existing === targetContent)
|
|
7735
|
+
if (existing === targetContent) {
|
|
7736
|
+
ctx.reportOutcome?.("noop");
|
|
7737
|
+
return `No change needed: ${targetPath} already at target state (${bytes} bytes).`;
|
|
7738
|
+
}
|
|
7680
7739
|
await ctx.execution.writeFile(ctx.handle, targetPath, targetContent);
|
|
7681
7740
|
const readState = resolveReadStateMap(ctx);
|
|
7682
7741
|
if (readState) readState.set(readStateKey(ctx.handle.cwd, targetPath), {
|
|
@@ -7686,10 +7745,11 @@ const writeFile$1 = {
|
|
|
7686
7745
|
maxBytes: Number.POSITIVE_INFINITY,
|
|
7687
7746
|
mtimeMs: Date.now()
|
|
7688
7747
|
});
|
|
7748
|
+
ctx.reportOutcome?.(existing === void 0 ? "created" : "updated");
|
|
7689
7749
|
return existing === void 0 ? `Created ${targetPath} (${bytes} bytes).` : `Updated ${targetPath} (${bytes} bytes).`;
|
|
7690
7750
|
}
|
|
7691
7751
|
};
|
|
7692
7752
|
//#endregion
|
|
7693
7753
|
export { resolveTasksDir as A, effectiveContextWindow as B, PERSISTED_STUB_PREFIX as C, maybePersistToolResult as D, cleanupPersistedSession as E, BUILTIN_PROVIDERS as F, modelOptionsFor as G, getContextWindow as H, OUTPUT_RESERVE_TOKENS as I, openaiDescriptor as J, modelSupportsReasoning as K, anthropicDescriptor as L, hashContent as M, readStateKey as N, resolveMcpWarningsDir as O, resolveReadStateMap as P, cerebrasDescriptor as R, validateToolArgs as S, buildPersistedStub as T, getModelInfo as U, enabledModelOptions as V, localDescriptor as W, piIdOf as X, openrouterDescriptor as Y, restoreModelOptions as Z, shell as _, multiEdit as a, TOOL_USE_CANCELLED_MESSAGE as b, grep as c, createAgent as d, createToolSearchTool as f, createShellTool as g, createSkillsReadTool as h, readFile$1 as i, getReadState as j, resolvePersistDir as k, glob$1 as l, createSkillsRunScriptTool as m, createSpawnTool as n, listFiles as o, createSkillsUseTool as p, modelsForDescriptor as q, shellKill as r, createInteractionTool as s, writeFile$1 as t, edit as u, INTERRUPT_MESSAGE_FOR_TOOL_USE as v, PERSISTENCE_PREVIEW_BYTES as w, TOOL_USE_SKIPPED_MESSAGE as x, SHELL_CASCADE_CANCEL_MESSAGE as y, credKeyOf as z };
|
|
7694
7754
|
|
|
7695
|
-
//# sourceMappingURL=tools-
|
|
7755
|
+
//# sourceMappingURL=tools-DLRIhCl1.js.map
|