zidane 5.6.3 → 5.6.7
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/chat.d.ts +158 -3
- package/dist/chat.d.ts.map +1 -1
- package/dist/chat.js +3 -3
- package/dist/{index-DKpXHp1c.d.ts → index-8mn3PIaa.d.ts} +24 -1
- package/dist/{index-DKpXHp1c.d.ts.map → index-8mn3PIaa.d.ts.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/{login-YckkS-Bq.js → login-Btpliwct.js} +2 -2
- package/dist/{login-YckkS-Bq.js.map → login-Btpliwct.js.map} +1 -1
- package/dist/{presets-ZT3TJDEb.js → presets-BXmWG3kd.js} +2 -2
- package/dist/{presets-ZT3TJDEb.js.map → presets-BXmWG3kd.js.map} +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/presets.js +1 -1
- package/dist/{tools-Bgx8OBqK.js → tools-FerA0zSl.js} +72 -9
- package/dist/tools-FerA0zSl.js.map +1 -0
- package/dist/tools.d.ts +1 -1
- package/dist/tools.js +1 -1
- package/dist/{transcript-anchors-CtSVZeBi.d.ts → transcript-anchors-C5Sp1Snh.d.ts} +256 -18
- package/dist/transcript-anchors-C5Sp1Snh.d.ts.map +1 -0
- package/dist/tui.d.ts +47 -2
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +456 -175
- package/dist/tui.js.map +1 -1
- package/dist/{turn-operations-CH7rnULP.js → turn-operations-D-OQYUgS.js} +524 -125
- package/dist/turn-operations-D-OQYUgS.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/docs/CHAT.md +52 -20
- package/docs/TUI.md +5 -5
- package/package.json +1 -1
- package/dist/tools-Bgx8OBqK.js.map +0 -1
- package/dist/transcript-anchors-CtSVZeBi.d.ts.map +0 -1
- package/dist/turn-operations-CH7rnULP.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets-
|
|
1
|
+
{"version":3,"file":"presets-BXmWG3kd.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;CAAW;AAE/F,IAAA,gBAAe,aAAa;CAC1B,MAAM;CACN,QAAQ;CAOR,OAAO;EAAE,GAAG;EAAY,OAAO,gBAAgB,EAAE,SAAS,MAAM,CAAC;EAAE;CACpE,CAAC;;;;;;ACOF,SAAgB,aAAa,QAAwB;CACnD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BT,SAAgB,eAAe,GAAG,SAA2B;CAC3D,MAA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,IAAI,OAAO,KAAK,aAAa,CAAC,SAAS,GACrC,IAAI,QAAQ;CAEd,OAAO"}
|
package/dist/presets.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { n as AgentHookMap } from "./agent-D70rr6Uk.js";
|
|
2
|
-
import { a as basicTools, i as _default, n as composePresets, r as definePreset, t as Preset } from "./index-
|
|
2
|
+
import { a as basicTools, i as _default, n as composePresets, r as definePreset, t as Preset } from "./index-8mn3PIaa.js";
|
|
3
3
|
export { 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-BXmWG3kd.js";
|
|
2
2
|
export { basic_default as basic, basicTools, composePresets, definePreset };
|
|
@@ -2771,16 +2771,72 @@ function isReadOnlyShellCommand(command) {
|
|
|
2771
2771
|
return false;
|
|
2772
2772
|
}
|
|
2773
2773
|
/**
|
|
2774
|
-
*
|
|
2775
|
-
*
|
|
2776
|
-
* model
|
|
2774
|
+
* Canonical sibling tools that, when registered alongside `shell`, are worth
|
|
2775
|
+
* nudging the model toward — re-running `ls`/`cat` to "verify" a path the
|
|
2776
|
+
* model already inspected through a dedicated tool is a measurable Kimi/Sonnet
|
|
2777
|
+
* failure mode. Each entry maps the canonical tool name to the line rendered
|
|
2778
|
+
* in the description; the rendered tool name itself is alias-resolved at
|
|
2779
|
+
* render time so deployments that wire-rename (e.g. `read_file` → `Read`)
|
|
2780
|
+
* still point at a name the model recognizes from the tool spec.
|
|
2777
2781
|
*/
|
|
2778
|
-
|
|
2782
|
+
const SHELL_SWAP_HINTS = [
|
|
2783
|
+
{
|
|
2784
|
+
canonical: "read_file",
|
|
2785
|
+
label: "Read files",
|
|
2786
|
+
instead: "cat/head/tail"
|
|
2787
|
+
},
|
|
2788
|
+
{
|
|
2789
|
+
canonical: "glob",
|
|
2790
|
+
label: "File search",
|
|
2791
|
+
instead: "find/ls"
|
|
2792
|
+
},
|
|
2793
|
+
{
|
|
2794
|
+
canonical: "grep",
|
|
2795
|
+
label: "Content search",
|
|
2796
|
+
instead: "grep/rg"
|
|
2797
|
+
},
|
|
2798
|
+
{
|
|
2799
|
+
canonical: "list_files",
|
|
2800
|
+
label: "Directory listings",
|
|
2801
|
+
instead: "ls"
|
|
2802
|
+
},
|
|
2803
|
+
{
|
|
2804
|
+
canonical: "edit",
|
|
2805
|
+
label: "Edit files",
|
|
2806
|
+
instead: "sed/awk"
|
|
2807
|
+
},
|
|
2808
|
+
{
|
|
2809
|
+
canonical: "write_file",
|
|
2810
|
+
label: "Write files",
|
|
2811
|
+
instead: "echo>/heredoc"
|
|
2812
|
+
}
|
|
2813
|
+
];
|
|
2814
|
+
/**
|
|
2815
|
+
* Build the `shell` tool's description text.
|
|
2816
|
+
*
|
|
2817
|
+
* - The background-mode paragraphs are appended only when `allowBackground`
|
|
2818
|
+
* is true so the model isn't pointed at a feature the agent has disabled.
|
|
2819
|
+
* - The "prefer the dedicated tool" swap block is appended only for siblings
|
|
2820
|
+
* actually present in `registeredCanonicals`. Hosts that ship `shell`
|
|
2821
|
+
* without `read_file`/`glob`/etc. don't see misleading nudges. Aliased
|
|
2822
|
+
* names are rendered via `toolAliases` so the printed name matches what
|
|
2823
|
+
* the model sees in the tool spec.
|
|
2824
|
+
*/
|
|
2825
|
+
function buildShellDescription({ allowBackground, registeredCanonicals, toolAliases }) {
|
|
2779
2826
|
const lines = [
|
|
2780
2827
|
"Execute a shell command in the project root and return its combined stdout/stderr.",
|
|
2781
2828
|
"Output is tail-priority truncated at 32 KiB by default; errors and exit-code summaries live in the tail.",
|
|
2782
2829
|
"By default each call appends a `(exit N, Nms)` footer and surfaces non-empty stderr in a separate section even on success — set `metadata: false` to return only stdout. Set maxOutputBytes=0 to disable truncation."
|
|
2783
2830
|
];
|
|
2831
|
+
if (registeredCanonicals && registeredCanonicals.size > 0) {
|
|
2832
|
+
const swaps = [];
|
|
2833
|
+
for (const { canonical, label, instead } of SHELL_SWAP_HINTS) {
|
|
2834
|
+
if (!registeredCanonicals.has(canonical)) continue;
|
|
2835
|
+
const wireName = toolAliases?.[canonical] ?? canonical;
|
|
2836
|
+
swaps.push(`- ${label}: use \`${wireName}\` (not ${instead})`);
|
|
2837
|
+
}
|
|
2838
|
+
if (swaps.length > 0) lines.push("", "When a dedicated tool fits, prefer it over shell:", ...swaps, "", "Re-running `ls`/`cat` on the same path is not useful — the prior result is still current unless you wrote to that path since.");
|
|
2839
|
+
}
|
|
2784
2840
|
if (allowBackground) lines.push("", "Long-running commands (`npm run dev`, `python train.py`, anything that would otherwise block your turn for minutes) → `run_in_background: true`. The call returns immediately with `{ task_id, output_path, pid }`; stdout + stderr stream to the log file at `output_path`.", "", "After spawning a background task: end your current turn (do NOT keep iterating). A `<task-notification>` arrives on the agent's NEXT user-turn with the final status. Polling the log file in a loop wastes tokens and blocks your turn — the notification IS the wake-up. If you NEED to check progress immediately (rare), call `read_file({ path: output_path, ... })` exactly once and decide. To terminate, use `shell_kill({ task_id })`.", "", "When called from inside a `spawn`'d subagent: you have NO next user-turn — your `agent.run` ends as soon as you finish responding. Start the background task, return a brief summary including the `task_id`, and end your turn. Ownership of the task is transferred to the parent agent when your run finishes; the parent will see the notification on ITS next user-turn.");
|
|
2785
2841
|
return lines.join("\n");
|
|
2786
2842
|
}
|
|
@@ -2837,11 +2893,16 @@ function buildShellInputSchema({ allowBackground }) {
|
|
|
2837
2893
|
*/
|
|
2838
2894
|
function createShellTool(opts = {}) {
|
|
2839
2895
|
const allowBackground = opts.allowBackground !== false;
|
|
2896
|
+
const { registeredCanonicals, toolAliases } = opts;
|
|
2840
2897
|
return {
|
|
2841
2898
|
isConcurrencySafe: (input) => isReadOnlyShellCommand(input.command),
|
|
2842
2899
|
spec: {
|
|
2843
2900
|
name: "shell",
|
|
2844
|
-
description: buildShellDescription({
|
|
2901
|
+
description: buildShellDescription({
|
|
2902
|
+
allowBackground,
|
|
2903
|
+
registeredCanonicals,
|
|
2904
|
+
toolAliases
|
|
2905
|
+
}),
|
|
2845
2906
|
inputSchema: buildShellInputSchema({ allowBackground })
|
|
2846
2907
|
},
|
|
2847
2908
|
async execute({ command, timeout, maxOutputBytes, metadata, run_in_background }, ctx) {
|
|
@@ -3971,9 +4032,11 @@ function createAgent({ provider, name: agentName, system: agentSystem, tools: ag
|
|
|
3971
4032
|
} : runBaseTools;
|
|
3972
4033
|
const toolsPreSearch = {};
|
|
3973
4034
|
for (const tool of Object.values(mergedWithSkills)) toolsPreSearch[tool.spec.name] = tool;
|
|
3974
|
-
if (toolsPreSearch.shell === shell) {
|
|
3975
|
-
|
|
3976
|
-
|
|
4035
|
+
if (toolsPreSearch.shell === shell) toolsPreSearch.shell = createShellTool({
|
|
4036
|
+
allowBackground: typeof resolvedBehavior?.tasksDir === "string" && resolvedBehavior.tasksDir.length > 0 && resolvedBehavior.disableBackgroundTasks !== true,
|
|
4037
|
+
registeredCanonicals: new Set(Object.keys(toolsPreSearch)),
|
|
4038
|
+
...toolAliases ? { toolAliases } : {}
|
|
4039
|
+
});
|
|
3977
4040
|
const disclosure = partitionToolDisclosure(toolsPreSearch, mcpToolNames, mcpServers, toolDisclosure, toolAliases);
|
|
3978
4041
|
const unlocked = new Set(disclosure.eagerCanonicalNames);
|
|
3979
4042
|
const hostDefinedToolSearch = !!toolsPreSearch.tool_search;
|
|
@@ -6055,4 +6118,4 @@ const writeFile$1 = {
|
|
|
6055
6118
|
//#endregion
|
|
6056
6119
|
export { resolvePersistDir as A, formatTaskStatus as B, TOOL_USE_SKIPPED_MESSAGE as C, buildPersistedStub as D, PERSISTENCE_PREVIEW_BYTES as E, resolveReadStateMap as F, previewLine as H, ageString as I, compactPath as L, getReadState as M, hashContent as N, cleanupPersistedSession as O, readStateKey as P, fmtTokens as R, TOOL_USE_CANCELLED_MESSAGE as S, PERSISTED_STUB_PREFIX as T, shortId as U, formatTaskSummary as V, createSkillsReadTool as _, multiEdit as a, INTERRUPT_MESSAGE_FOR_TOOL_USE as b, grep as c, resolveOldString as d, styleReplacementForVia as f, createSkillsRunScriptTool as g, createSkillsUseTool as h, readFile$1 as i, resolveTasksDir as j, maybePersistToolResult as k, glob as l, createToolSearchTool as m, createSpawnTool as n, listFiles as o, createAgent as p, shellKill as r, createInteractionTool as s, writeFile$1 as t, edit as u, createShellTool as v, validateToolArgs as w, SHELL_CASCADE_CANCEL_MESSAGE as x, shell as y, formatDuration as z };
|
|
6057
6120
|
|
|
6058
|
-
//# sourceMappingURL=tools-
|
|
6121
|
+
//# sourceMappingURL=tools-FerA0zSl.js.map
|