zidane 5.14.4 → 6.0.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/{acp-24uU2WDs.js → acp-Irby04Us.js} +7 -8
- package/dist/{acp-24uU2WDs.js.map → acp-Irby04Us.js.map} +1 -1
- package/dist/acp-cli.js +7 -7
- package/dist/acp.d.ts +2 -3
- package/dist/acp.d.ts.map +1 -1
- package/dist/acp.js +1 -1
- package/dist/{agent-Cch2ayTt.js → agent-DkSmGkDM.js} +10871 -5411
- package/dist/agent-DkSmGkDM.js.map +1 -0
- package/dist/agent.d.ts +1 -2
- package/dist/agent.js +2 -2
- package/dist/{anthropic-RGqsJlC8.js → anthropic-CTHsdFG9.js} +46 -6
- package/dist/anthropic-CTHsdFG9.js.map +1 -0
- package/dist/{auth-C-ms5N2x.js → auth-BDSu_0t3.js} +13 -86
- package/dist/auth-BDSu_0t3.js.map +1 -0
- package/dist/chat/pure.d.ts +4 -4
- package/dist/chat/pure.js +4 -3
- package/dist/chat.d.ts +45 -8
- package/dist/chat.d.ts.map +1 -1
- package/dist/chat.js +9 -6
- package/dist/chat.js.map +1 -1
- package/dist/completion-core-CXYSVhZo.js +147 -0
- package/dist/completion-core-CXYSVhZo.js.map +1 -0
- package/dist/{context-breakdown-kO-pDsay.js → context-breakdown-Dzo25N45.js} +2 -23
- package/dist/context-breakdown-Dzo25N45.js.map +1 -0
- package/dist/contexts/daytona.d.ts +3 -3
- package/dist/contexts/daytona.js +1 -1
- package/dist/contexts/docker.d.ts +10 -2
- package/dist/contexts/docker.d.ts.map +1 -1
- package/dist/contexts/docker.js +142 -103
- package/dist/contexts/docker.js.map +1 -1
- package/dist/contexts/e2b.d.ts +2 -2
- package/dist/contexts/e2b.js +1 -1
- package/dist/contexts/sandbox.d.ts +1 -1
- package/dist/contexts/sandbox.js +4 -1
- package/dist/contexts/sandbox.js.map +1 -1
- package/dist/{contexts-Lzf5huID.js → contexts-Vone3qQQ.js} +26 -37
- package/dist/contexts-Vone3qQQ.js.map +1 -0
- package/dist/contexts.d.ts +3 -3
- package/dist/contexts.js +1 -1
- package/dist/errors.d.ts +1 -2
- package/dist/errors.js +1 -1
- package/dist/eval.d.ts +1 -1
- package/dist/eval.js +3 -3
- package/dist/exec-file-size-PXkr-MGA.js +63 -0
- package/dist/exec-file-size-PXkr-MGA.js.map +1 -0
- package/dist/extensions.d.ts +2 -0
- package/dist/extensions.js +2 -0
- package/dist/generate-data-WL_yGVL6.js +324 -0
- package/dist/generate-data-WL_yGVL6.js.map +1 -0
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +15 -10
- package/dist/headless.js.map +1 -1
- package/dist/index-B8UtiZy7.d.ts +14967 -0
- package/dist/index-B8UtiZy7.d.ts.map +1 -0
- package/dist/{index-B3ciFUZx.d.ts → index-DsPQbyUn.d.ts} +2 -2
- package/dist/index-DsPQbyUn.d.ts.map +1 -0
- package/dist/index.d.ts +6 -12
- package/dist/index.js +20 -43
- package/dist/index.js.map +1 -1
- package/dist/{logger-Ktm-lj1s.js → logger-DBX9uYOw.js} +108 -5
- package/dist/logger-DBX9uYOw.js.map +1 -0
- package/dist/login-DOF8pMVM.js +539 -0
- package/dist/login-DOF8pMVM.js.map +1 -0
- package/dist/{mcp-Dn5W65Lv.js → mcp-CcvuVXB9.js} +2 -2
- package/dist/{mcp-Dn5W65Lv.js.map → mcp-CcvuVXB9.js.map} +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +1 -1
- package/dist/{messages-YZQLKaz2.js → messages-CwujiS74.js} +4 -4
- package/dist/messages-CwujiS74.js.map +1 -0
- package/dist/{openai-compat-0Y7jcncn.js → openai-compat-BvgYGSR1.js} +7 -6
- package/dist/{openai-compat-0Y7jcncn.js.map → openai-compat-BvgYGSR1.js.map} +1 -1
- package/dist/output/stream-json.d.ts +1 -2
- package/dist/output/stream-json.d.ts.map +1 -1
- package/dist/output/terminal.d.ts +1 -2
- package/dist/output/terminal.d.ts.map +1 -1
- package/dist/{glob-DluQFSw1.js → output-cap-kBUHBlnq.js} +50 -2
- package/dist/output-cap-kBUHBlnq.js.map +1 -0
- package/dist/presets.d.ts +1 -2
- package/dist/presets.js +1 -1
- package/dist/providers/anthropic.d.ts +2 -2
- package/dist/providers/anthropic.js +2 -2
- package/dist/providers/arcee.d.ts +1 -1
- package/dist/providers/arcee.js +1 -1
- package/dist/providers/baseten.d.ts +1 -1
- package/dist/providers/baseten.js +1 -1
- package/dist/providers/cerebras.d.ts +1 -1
- package/dist/providers/cerebras.js +1 -1
- package/dist/providers/local.d.ts +1 -1
- package/dist/providers/local.js +1 -1
- package/dist/providers/openai-compat.d.ts +1 -1
- package/dist/providers/openai-compat.js +1 -1
- package/dist/providers/openai.d.ts +1 -1
- package/dist/providers/openai.js +4 -4
- package/dist/providers/openai.js.map +1 -1
- package/dist/providers/openrouter.d.ts +1 -1
- package/dist/providers/openrouter.js +1 -1
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers/xai.js +1 -1
- package/dist/{providers-DgmdYGKm.js → providers-z6LDMAr3.js} +3 -3
- package/dist/{providers-DgmdYGKm.js.map → providers-z6LDMAr3.js.map} +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +4 -4
- package/dist/{read-state-BymF41Jb.js → read-state-Dq_TXUX1.js} +2 -2
- package/dist/{read-state-BymF41Jb.js.map → read-state-Dq_TXUX1.js.map} +1 -1
- package/dist/{interpolate-BtIgcCuz.js → resolve-Cr8JSL_O.js} +562 -136
- package/dist/resolve-Cr8JSL_O.js.map +1 -0
- package/dist/restate.d.ts +2 -2
- package/dist/restate.js +2 -2
- package/dist/{sandbox-Dgy-m6UF.d.ts → sandbox-CgjG2VvQ.d.ts} +2 -2
- package/dist/{sandbox-Dgy-m6UF.d.ts.map → sandbox-CgjG2VvQ.d.ts.map} +1 -1
- package/dist/session/sqlite.d.ts +1 -1
- package/dist/{session-CqrAFAKJ.js → session-CsdDIPY8.js} +108 -3
- package/dist/session-CsdDIPY8.js.map +1 -0
- package/dist/session.d.ts +2 -2
- package/dist/session.js +3 -3
- package/dist/skills-Bsb0rvWI.js +295 -0
- package/dist/skills-Bsb0rvWI.js.map +1 -0
- package/dist/skills.d.ts +2 -3
- package/dist/skills.js +3 -24
- package/dist/{errors-CkTvg97v.d.ts → timeout-8vSIRjzl.d.ts} +10 -2
- package/dist/timeout-8vSIRjzl.d.ts.map +1 -0
- package/dist/{timeout-kGGSXagK.js → timeout-BDetbuN6.js} +59 -2
- package/dist/timeout-BDetbuN6.js.map +1 -0
- package/dist/tool-formatters-DY0TDb1r.d.ts +378 -0
- package/dist/tool-formatters-DY0TDb1r.d.ts.map +1 -0
- package/dist/tools/fetch-url.d.ts +1 -1
- package/dist/tools/web-search.d.ts +1 -1
- package/dist/tools.d.ts +2 -3
- package/dist/tools.js +3 -4
- package/dist/{transcript-anchors-BHIgMlPq.d.ts → transcript-anchors-Cb-bDbNH.d.ts} +233 -640
- package/dist/transcript-anchors-Cb-bDbNH.d.ts.map +1 -0
- package/dist/{transcript-anchors-DsoBHg43.js → transcript-anchors-DSRPWjiH.js} +391 -961
- package/dist/transcript-anchors-DSRPWjiH.js.map +1 -0
- package/dist/tui.d.ts +335 -11
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +6375 -1892
- package/dist/tui.js.map +1 -1
- package/dist/{turn-operations-Dw02ZoSQ.d.ts → turn-operations-CgMROLsr.d.ts} +29 -4
- package/dist/turn-operations-CgMROLsr.d.ts.map +1 -0
- package/dist/{turn-operations-tG0vuBNc.js → turn-operations-Dq9Kx7m2.js} +321 -81
- package/dist/turn-operations-Dq9Kx7m2.js.map +1 -0
- package/dist/{types-BqdTeBaC.d.ts → types-BDccavwj.d.ts} +42 -1
- package/dist/types-BDccavwj.d.ts.map +1 -0
- package/dist/{types-CyVGdbia.js → types-BIarq1qE.js} +90 -2
- package/dist/types-BIarq1qE.js.map +1 -0
- package/dist/types.d.ts +5 -6
- package/dist/types.js +1 -1
- package/dist/{xai-tPdbAGkq.js → xai-B_e6TOA8.js} +2 -2
- package/dist/{xai-tPdbAGkq.js.map → xai-B_e6TOA8.js.map} +1 -1
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/CHAT.md +7 -6
- package/docs/EXECUTION_CONTEXT.md +16 -0
- package/docs/EXTENSIONS.md +1063 -0
- package/docs/SKILL.md +16 -0
- package/docs/TUI.md +10 -3
- package/package.json +12 -3
- package/dist/agent-Cch2ayTt.js.map +0 -1
- package/dist/agent-EFWt6uQ_.d.ts +0 -6914
- package/dist/agent-EFWt6uQ_.d.ts.map +0 -1
- package/dist/anthropic-RGqsJlC8.js.map +0 -1
- package/dist/auth-C-ms5N2x.js.map +0 -1
- package/dist/context-breakdown-kO-pDsay.js.map +0 -1
- package/dist/contexts-Lzf5huID.js.map +0 -1
- package/dist/errors-CkTvg97v.d.ts.map +0 -1
- package/dist/glob-DluQFSw1.js.map +0 -1
- package/dist/glob-shell-rJMoCIGb.js +0 -21
- package/dist/glob-shell-rJMoCIGb.js.map +0 -1
- package/dist/index-B3ciFUZx.d.ts.map +0 -1
- package/dist/index-BtzE3Uaq.d.ts +0 -2738
- package/dist/index-BtzE3Uaq.d.ts.map +0 -1
- package/dist/index-tSzOaWNt.d.ts +0 -316
- package/dist/index-tSzOaWNt.d.ts.map +0 -1
- package/dist/interpolate-BtIgcCuz.js.map +0 -1
- package/dist/logger-DGiGf7DW.d.ts +0 -102
- package/dist/logger-DGiGf7DW.d.ts.map +0 -1
- package/dist/logger-Ktm-lj1s.js.map +0 -1
- package/dist/login-CCA-1lgK.js +0 -267
- package/dist/login-CCA-1lgK.js.map +0 -1
- package/dist/messages-YZQLKaz2.js.map +0 -1
- package/dist/policy-DcGlpaNs.d.ts +0 -129
- package/dist/policy-DcGlpaNs.d.ts.map +0 -1
- package/dist/presets-BQWYMHdd.js +0 -114
- package/dist/presets-BQWYMHdd.js.map +0 -1
- package/dist/run-summary-DkN8KsHM.d.ts +0 -249
- package/dist/run-summary-DkN8KsHM.d.ts.map +0 -1
- package/dist/session-CqrAFAKJ.js.map +0 -1
- package/dist/shell-quote-BmnhZmdM.js +0 -33
- package/dist/shell-quote-BmnhZmdM.js.map +0 -1
- package/dist/skills.js.map +0 -1
- package/dist/timeout-CpFm0jJ6.d.ts +0 -10
- package/dist/timeout-CpFm0jJ6.d.ts.map +0 -1
- package/dist/timeout-kGGSXagK.js.map +0 -1
- package/dist/tool-formatters-C6iLgc9f.d.ts +0 -1454
- package/dist/tool-formatters-C6iLgc9f.d.ts.map +0 -1
- package/dist/tools-CCd8e-HT.js +0 -1739
- package/dist/tools-CCd8e-HT.js.map +0 -1
- package/dist/transcript-anchors-BHIgMlPq.d.ts.map +0 -1
- package/dist/transcript-anchors-DsoBHg43.js.map +0 -1
- package/dist/turn-operations-Dw02ZoSQ.d.ts.map +0 -1
- package/dist/turn-operations-tG0vuBNc.js.map +0 -1
- package/dist/types-BqdTeBaC.d.ts.map +0 -1
- package/dist/types-CyVGdbia.js.map +0 -1
|
@@ -55,6 +55,63 @@ function withTimeout(promise, options) {
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
+
* Inactivity watchdog around a streaming operation: the timeout fires only
|
|
59
|
+
* after `timeoutMs` of SILENCE, not total elapsed time. Callers report
|
|
60
|
+
* liveness by invoking the returned `touch()` on every streamed delta —
|
|
61
|
+
* a healthy-but-slow stream (huge prompt, long generation) never trips
|
|
62
|
+
* the watchdog, while a hung stream still fails deterministically.
|
|
63
|
+
*
|
|
64
|
+
* Implementation is churn-free under high delta rates: `touch()` only
|
|
65
|
+
* records a timestamp; the timer lazily re-arms for the remaining idle
|
|
66
|
+
* window when it wakes and finds recent activity. A non-positive /
|
|
67
|
+
* non-finite `timeoutMs` disables the guard (mirrors {@link withTimeout}).
|
|
68
|
+
*/
|
|
69
|
+
function withInactivityTimeout(promise, options) {
|
|
70
|
+
const { operation, timeoutMs, onTimeout, message } = options;
|
|
71
|
+
if (!isPositiveFiniteMs(timeoutMs)) return {
|
|
72
|
+
promise,
|
|
73
|
+
touch: () => {}
|
|
74
|
+
};
|
|
75
|
+
let lastActivity = Date.now();
|
|
76
|
+
let settled = false;
|
|
77
|
+
let timer;
|
|
78
|
+
return {
|
|
79
|
+
promise: new Promise((resolve, reject) => {
|
|
80
|
+
const arm = (delayMs) => {
|
|
81
|
+
timer = setTimeout(() => {
|
|
82
|
+
if (settled) return;
|
|
83
|
+
const idleMs = Date.now() - lastActivity;
|
|
84
|
+
if (idleMs < timeoutMs) {
|
|
85
|
+
arm(timeoutMs - idleMs);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
settled = true;
|
|
89
|
+
try {
|
|
90
|
+
onTimeout?.();
|
|
91
|
+
} finally {
|
|
92
|
+
reject(new OperationTimeoutError(operation, timeoutMs, message));
|
|
93
|
+
}
|
|
94
|
+
}, delayMs);
|
|
95
|
+
};
|
|
96
|
+
arm(timeoutMs);
|
|
97
|
+
promise.then((value) => {
|
|
98
|
+
if (settled) return;
|
|
99
|
+
settled = true;
|
|
100
|
+
clearTimeout(timer);
|
|
101
|
+
resolve(value);
|
|
102
|
+
}, (err) => {
|
|
103
|
+
if (settled) return;
|
|
104
|
+
settled = true;
|
|
105
|
+
clearTimeout(timer);
|
|
106
|
+
reject(err);
|
|
107
|
+
});
|
|
108
|
+
}),
|
|
109
|
+
touch: () => {
|
|
110
|
+
lastActivity = Date.now();
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
58
115
|
* Await `work` under `timeoutMs`, swallowing a timeout (logged under
|
|
59
116
|
* `ZIDANE_DEBUG`) and continuing. Non-timeout errors propagate unchanged so a
|
|
60
117
|
* well-behaved-but-throwing handler keeps its prior semantics. Use for
|
|
@@ -79,6 +136,6 @@ async function settleWithinTimeout(operation, work, timeoutMs) {
|
|
|
79
136
|
}
|
|
80
137
|
}
|
|
81
138
|
//#endregion
|
|
82
|
-
export {
|
|
139
|
+
export { withInactivityTimeout as a, settleWithinTimeout as i, linkAbortSignal as n, withTimeout as o, resolveTimeoutMs as r, OperationTimeoutError as t };
|
|
83
140
|
|
|
84
|
-
//# sourceMappingURL=timeout-
|
|
141
|
+
//# sourceMappingURL=timeout-BDetbuN6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeout-BDetbuN6.js","names":[],"sources":["../src/timeout.ts"],"sourcesContent":["export class OperationTimeoutError extends Error {\n readonly code = 'operation_timeout' as const\n readonly timeoutMs: number\n readonly operation: string\n\n constructor(operation: string, timeoutMs: number, message?: string) {\n super(message ?? `${operation} timed out after ${timeoutMs}ms`)\n this.name = 'OperationTimeoutError'\n this.operation = operation\n this.timeoutMs = timeoutMs\n }\n}\n\nexport function isPositiveFiniteMs(value: unknown): value is number {\n return typeof value === 'number' && Number.isFinite(value) && value > 0\n}\n\nexport function resolveTimeoutMs(\n configured: number | undefined,\n fallback: number,\n ceiling?: number,\n): number {\n const base = typeof configured === 'number'\n ? (isPositiveFiniteMs(configured) ? configured : 0)\n : fallback\n if (base <= 0)\n return 0\n return isPositiveFiniteMs(ceiling) ? Math.min(base, ceiling) : base\n}\n\nexport function linkAbortSignal(\n source: AbortSignal,\n target: AbortController,\n): () => void {\n if (source.aborted) {\n target.abort(source.reason)\n return () => {}\n }\n const onAbort = () => target.abort(source.reason)\n source.addEventListener('abort', onAbort, { once: true })\n return () => source.removeEventListener('abort', onAbort)\n}\n\nexport function withTimeout<T>(\n promise: Promise<T>,\n options: {\n operation: string\n timeoutMs: number\n onTimeout?: () => void\n message?: string\n },\n): Promise<T> {\n const { operation, timeoutMs, onTimeout, message } = options\n if (!isPositiveFiniteMs(timeoutMs))\n return promise\n\n return new Promise<T>((resolve, reject) => {\n let settled = false\n const timer = setTimeout(() => {\n if (settled)\n return\n settled = true\n try {\n onTimeout?.()\n }\n finally {\n reject(new OperationTimeoutError(operation, timeoutMs, message))\n }\n }, timeoutMs)\n\n promise.then(\n (value) => {\n if (settled)\n return\n settled = true\n clearTimeout(timer)\n resolve(value)\n },\n (err) => {\n if (settled)\n return\n settled = true\n clearTimeout(timer)\n reject(err)\n },\n )\n })\n}\n\n/**\n * Inactivity watchdog around a streaming operation: the timeout fires only\n * after `timeoutMs` of SILENCE, not total elapsed time. Callers report\n * liveness by invoking the returned `touch()` on every streamed delta —\n * a healthy-but-slow stream (huge prompt, long generation) never trips\n * the watchdog, while a hung stream still fails deterministically.\n *\n * Implementation is churn-free under high delta rates: `touch()` only\n * records a timestamp; the timer lazily re-arms for the remaining idle\n * window when it wakes and finds recent activity. A non-positive /\n * non-finite `timeoutMs` disables the guard (mirrors {@link withTimeout}).\n */\nexport function withInactivityTimeout<T>(\n promise: Promise<T>,\n options: {\n operation: string\n timeoutMs: number\n onTimeout?: () => void\n message?: string\n },\n): { promise: Promise<T>, touch: () => void } {\n const { operation, timeoutMs, onTimeout, message } = options\n if (!isPositiveFiniteMs(timeoutMs))\n return { promise, touch: () => {} }\n\n let lastActivity = Date.now()\n let settled = false\n let timer: ReturnType<typeof setTimeout> | undefined\n\n const guarded = new Promise<T>((resolve, reject) => {\n const arm = (delayMs: number) => {\n timer = setTimeout(() => {\n if (settled)\n return\n const idleMs = Date.now() - lastActivity\n if (idleMs < timeoutMs) {\n arm(timeoutMs - idleMs)\n return\n }\n settled = true\n try {\n onTimeout?.()\n }\n finally {\n reject(new OperationTimeoutError(operation, timeoutMs, message))\n }\n }, delayMs)\n }\n arm(timeoutMs)\n\n promise.then(\n (value) => {\n if (settled)\n return\n settled = true\n clearTimeout(timer)\n resolve(value)\n },\n (err) => {\n if (settled)\n return\n settled = true\n clearTimeout(timer)\n reject(err)\n },\n )\n })\n\n return {\n promise: guarded,\n touch: () => {\n lastActivity = Date.now()\n },\n }\n}\n\n/**\n * Await `work` under `timeoutMs`, swallowing a timeout (logged under\n * `ZIDANE_DEBUG`) and continuing. Non-timeout errors propagate unchanged so a\n * well-behaved-but-throwing handler keeps its prior semantics. Use for\n * observability / lifecycle / teardown awaits that must never block forward\n * progress or strand a run gate (hooks, store writes, MCP close, ctx destroy).\n *\n * A non-positive / non-finite `timeoutMs` disables the bound — `work` is\n * awaited as-is (matching {@link resolveTimeoutMs}'s `0` = \"disabled\").\n */\nexport async function settleWithinTimeout(\n operation: string,\n work: Promise<unknown> | void,\n timeoutMs: number,\n): Promise<void> {\n try {\n await withTimeout(Promise.resolve(work), { operation, timeoutMs })\n }\n catch (err) {\n if (err instanceof OperationTimeoutError) {\n if (process.env.ZIDANE_DEBUG)\n console.error(`[zidane] ${operation} timed out after ${timeoutMs}ms; continuing`)\n return\n }\n throw err\n }\n}\n"],"mappings":";AAAA,IAAa,wBAAb,cAA2C,MAAM;CAC/C,OAAgB;CAChB;CACA;CAEA,YAAY,WAAmB,WAAmB,SAAkB;EAClE,MAAM,WAAW,GAAG,UAAU,mBAAmB,UAAU,GAAG;EAC9D,KAAK,OAAO;EACZ,KAAK,YAAY;EACjB,KAAK,YAAY;CACnB;AACF;AAEA,SAAgB,mBAAmB,OAAiC;CAClE,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,QAAQ;AACxE;AAEA,SAAgB,iBACd,YACA,UACA,SACQ;CACR,MAAM,OAAO,OAAO,eAAe,WAC9B,mBAAmB,UAAU,IAAI,aAAa,IAC/C;CACJ,IAAI,QAAQ,GACV,OAAO;CACT,OAAO,mBAAmB,OAAO,IAAI,KAAK,IAAI,MAAM,OAAO,IAAI;AACjE;AAEA,SAAgB,gBACd,QACA,QACY;CACZ,IAAI,OAAO,SAAS;EAClB,OAAO,MAAM,OAAO,MAAM;EAC1B,aAAa,CAAC;CAChB;CACA,MAAM,gBAAgB,OAAO,MAAM,OAAO,MAAM;CAChD,OAAO,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;CACxD,aAAa,OAAO,oBAAoB,SAAS,OAAO;AAC1D;AAEA,SAAgB,YACd,SACA,SAMY;CACZ,MAAM,EAAE,WAAW,WAAW,WAAW,YAAY;CACrD,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AK,IAAI;EAC1B;CACF;AACF;;;;;;;;;;;AAYA,eAAsB,oBACpB,WACA,MACA,WACe;CACf,IAAI;EACF,MAAM,YAAY,QAAQ,QAAQ,IAAI,GAAG;GAAE;GAAW;EAAU,CAAC;CACnE,SACO,KAAK;EACV,IAAI,eAAe,uBAAuB;GACxC,IAAI,QAAQ,IAAI,cACd,QAAQ,MAAM,YAAY,UAAU,mBAAmB,UAAU,eAAe;GAClF;EACF;EACA,MAAM;CACR;AACF"}
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import { fu as Settings, pu as StreamEvent } from "./index-B8UtiZy7.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/chat/turn-selection.d.ts
|
|
5
|
+
/** Tools whose `tool-result` event is suppressed when `showEditDiffs` is on. */
|
|
6
|
+
declare const EDIT_TOOL_NAMES: ReadonlySet<string>;
|
|
7
|
+
/**
|
|
8
|
+
* Recognize a tool-result body as carrying NON-success information so the
|
|
9
|
+
* renderer doesn't suppress it under `showEditDiffs`. Three categories:
|
|
10
|
+
*
|
|
11
|
+
* - `edit` → "Edit error: …"
|
|
12
|
+
* - `write_file` permission errors wrapped by the loop → "Tool failed: …"
|
|
13
|
+
* - `multi_edit` → legacy single-line error `multi_edit error: …`, OR
|
|
14
|
+
* a result carrying an `<edit-outcomes>…</edit-outcomes>` annotation
|
|
15
|
+
* block. The TUI only appends the annotation when at least one hunk
|
|
16
|
+
* was NOT applied, so its mere presence is the signal — the result
|
|
17
|
+
* body needs to stay visible next to the diff so the user can read
|
|
18
|
+
* denial / skip / failure reasons longer than the per-hunk badge.
|
|
19
|
+
* - Fully-denied gate emit (`[fully denied] <edit-outcomes>…`) likewise
|
|
20
|
+
* stays visible.
|
|
21
|
+
*
|
|
22
|
+
* Exported for unit-testability of the visibility matrix.
|
|
23
|
+
*/
|
|
24
|
+
declare function isEditErrorResult(text: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Per-event visibility — filters honor user toggles and the
|
|
27
|
+
* `hideSubagentOutput` setting. When subagent output is hidden:
|
|
28
|
+
* - Child-agent events are filtered down to the `spawn-start` /
|
|
29
|
+
* `spawn-end` markers so the user still sees "🌱 working… 🌳 done".
|
|
30
|
+
* - The parent's `tool-result` for `spawn` is hidden too. Its body
|
|
31
|
+
* duplicates `spawn-end`'s stats line *and* the parent's next
|
|
32
|
+
* markdown turn; showing it again produces an extra
|
|
33
|
+
* `┃ [sub-agent child-1] Completed …` block users just want gone.
|
|
34
|
+
*
|
|
35
|
+
* Renderer-agnostic — returns plain `boolean` so TUI / GUI consumers
|
|
36
|
+
* can filter events identically.
|
|
37
|
+
*/
|
|
38
|
+
declare function isVisible(event: StreamEvent, settings: Settings): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Build the `resultTurnId → owningAssistantTurnId` map used by the select-
|
|
41
|
+
* turn mode to coalesce a tool-call's surrounding turns into ONE navigation
|
|
42
|
+
* stop.
|
|
43
|
+
*
|
|
44
|
+
* Protocol shape: every `tool_call` block in an assistant turn is closed by
|
|
45
|
+
* a matching `tool_result` block in the *next* user turn (the agent loop's
|
|
46
|
+
* history validator depends on this). When the next user turn's only events
|
|
47
|
+
* are `tool-result`s — i.e. it's pure plumbing for the prior assistant
|
|
48
|
+
* turn — we map it back to that assistant turn here. The select-turn nav
|
|
49
|
+
* index ({@link selectableTurnIds}) skips owned turns, and the renderer's
|
|
50
|
+
* highlight gate ({@link isTurnHighlighted}) extends the selection accent
|
|
51
|
+
* from the assistant turn to the events of any turn it owns. Net effect:
|
|
52
|
+
*
|
|
53
|
+
* - Navigation never lands the cursor on a result-only turn whose own
|
|
54
|
+
* events may be hidden by `showToolResults: false` — the cursor
|
|
55
|
+
* wouldn't be visible.
|
|
56
|
+
* - Selecting an assistant turn highlights the call AND its result as
|
|
57
|
+
* one unit, matching the user's mental model of "one message".
|
|
58
|
+
*
|
|
59
|
+
* Owner-lookup is conservative: result-only turns with no matching prior
|
|
60
|
+
* assistant turn (orphaned — usually because the parent was deleted)
|
|
61
|
+
* stay selectable so the user can act on them via the turn-details modal.
|
|
62
|
+
*
|
|
63
|
+
* Subagent (`childId` set) events are ignored — they live in a separate
|
|
64
|
+
* conversation tree.
|
|
65
|
+
*/
|
|
66
|
+
declare function turnSelectionOwnership(events: readonly StreamEvent[]): Map<string, string>;
|
|
67
|
+
/**
|
|
68
|
+
* Render-time check: should `event` paint with the selection accent?
|
|
69
|
+
*
|
|
70
|
+
* `true` when the event's own turn is selected, OR when the selected turn
|
|
71
|
+
* `owns` the event's turn via {@link turnSelectionOwnership} (the call and
|
|
72
|
+
* its tool-result rows highlight together). `false` when nothing is
|
|
73
|
+
* selected or the relationship doesn't apply.
|
|
74
|
+
*
|
|
75
|
+
* Pure. Renderer-agnostic — the TUI's `<Transcript>` uses it; a GUI's
|
|
76
|
+
* equivalent walks the same rule.
|
|
77
|
+
*/
|
|
78
|
+
declare function isTurnHighlighted(event: Pick<StreamEvent, 'turnId'>, selectedTurnId: string | null, ownership: ReadonlyMap<string, string>): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Deduplicated, in-order list of **parent-conversation** turn ids that appear
|
|
81
|
+
* in a rendered transcript — the navigation index for the TUI's select-turn
|
|
82
|
+
* mode. Three classes of turns are deliberately skipped:
|
|
83
|
+
*
|
|
84
|
+
* - **Subagent turns** (`childId` set). Nested execution detail; the
|
|
85
|
+
* user's mental model of a "message" is the conversational exchange,
|
|
86
|
+
* not each spawn turn. Also filtered out by `isVisible` under
|
|
87
|
+
* `hideSubagentOutput: true` — selecting them would highlight nothing.
|
|
88
|
+
* - **Result-only turns** — see {@link turnSelectionOwnership}. These get
|
|
89
|
+
* coalesced into the assistant turn that emitted their tool_calls.
|
|
90
|
+
* - **Settings-hidden turns** (when `settings` is supplied). A turn whose
|
|
91
|
+
* every event fails {@link isVisible} would render no rows — landing
|
|
92
|
+
* the cursor there hides it from the user entirely. The check is opt-
|
|
93
|
+
* in so SDK callers without a Settings object keep the legacy
|
|
94
|
+
* "everything visible" behavior.
|
|
95
|
+
*
|
|
96
|
+
* Synthetic events (separator, spawn-start, spawn-end) have no `turnId` and
|
|
97
|
+
* are skipped naturally.
|
|
98
|
+
*/
|
|
99
|
+
declare function selectableTurnIds(events: readonly StreamEvent[], settings?: Settings): string[];
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region src/chat/safe-mode-context.d.ts
|
|
102
|
+
/**
|
|
103
|
+
* Outcome of an approval prompt. Four bulk decisions match the original
|
|
104
|
+
* single-edit modal contract; `partial` is the multi-edit branch — the
|
|
105
|
+
* user accepted a subset of an `edit` / `multi_edit` / `write_file` call.
|
|
106
|
+
*
|
|
107
|
+
* `partial.mask` is 1:1 with the call's hunks (in input order): `true`
|
|
108
|
+
* means apply, `false` means deny. The gate handler walks the mask to
|
|
109
|
+
* build per-hunk outcomes; the TUI rebinds `ctx.input.edits` to the
|
|
110
|
+
* approved subset and the renderer reconstructs the full per-hunk view
|
|
111
|
+
* from the `<edit-outcomes>` annotation appended to the tool result.
|
|
112
|
+
*/
|
|
113
|
+
type ApprovalDecision = 'accept-once' | 'accept-session' | 'accept-safelist' | 'deny' | {
|
|
114
|
+
kind: 'partial';
|
|
115
|
+
mask: readonly boolean[];
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Identifies the caller behind an approval prompt — the parent agent or
|
|
119
|
+
* a specific subagent (`child-N`). The modal's right-side title pins the
|
|
120
|
+
* label so the user knows which agent issued the call when subagents
|
|
121
|
+
* bubble their gates up through the parent's hook bus.
|
|
122
|
+
*/
|
|
123
|
+
type ApprovalOriginator = {
|
|
124
|
+
kind: 'parent';
|
|
125
|
+
} | {
|
|
126
|
+
kind: 'child';
|
|
127
|
+
label: string;
|
|
128
|
+
};
|
|
129
|
+
interface ApprovalRequest {
|
|
130
|
+
id: string;
|
|
131
|
+
tool: string;
|
|
132
|
+
input: Record<string, unknown>;
|
|
133
|
+
resolve: (decision: ApprovalDecision) => void;
|
|
134
|
+
/** Caller attribution. Absent ≡ `{ kind: 'parent' }`. */
|
|
135
|
+
originator?: ApprovalOriginator;
|
|
136
|
+
}
|
|
137
|
+
/** Function signature consumed by `tool:gate` handlers + the child-tool wrap. */
|
|
138
|
+
type RequestApproval = (tool: string, input: Record<string, unknown>, originator?: ApprovalOriginator) => Promise<ApprovalDecision>;
|
|
139
|
+
interface SafeModeActions {
|
|
140
|
+
/** Request a decision; resolves once the user picks. */
|
|
141
|
+
requestApproval: RequestApproval;
|
|
142
|
+
/** Resolve the head and shift the queue forward. */
|
|
143
|
+
resolveHead: (decision: ApprovalDecision) => void;
|
|
144
|
+
/** Resolve all pending with `deny`. Used on abort / hard exit. */
|
|
145
|
+
denyAll: () => void;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Owns the queue + actions. Splits the value across two contexts so a queue
|
|
149
|
+
* change doesn't invalidate every callback memo that closes over the actions.
|
|
150
|
+
*/
|
|
151
|
+
declare function SafeModeProvider({
|
|
152
|
+
children
|
|
153
|
+
}: {
|
|
154
|
+
children: ReactNode;
|
|
155
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
156
|
+
declare function useSafeModeQueue(): readonly ApprovalRequest[];
|
|
157
|
+
declare function useSafeModeActions(): SafeModeActions;
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/chat/markdown-segments.d.ts
|
|
160
|
+
/**
|
|
161
|
+
* One block returned by {@link splitMarkdownCodeBlocks}. Prose segments
|
|
162
|
+
* carry their original markdown (including blank lines that bracketed
|
|
163
|
+
* the fence) so the surrounding paragraph spacing stays faithful to the
|
|
164
|
+
* original input. Code segments carry the raw body — fence markers and
|
|
165
|
+
* info-string stripped — so a "copy code" action lands what the user
|
|
166
|
+
* actually sees, byte-for-byte.
|
|
167
|
+
*/
|
|
168
|
+
interface MarkdownSegment {
|
|
169
|
+
kind: 'prose' | 'code';
|
|
170
|
+
content: string;
|
|
171
|
+
/** Info-string (e.g. `ts`, `python`). Empty when the fence had none. */
|
|
172
|
+
lang?: string;
|
|
173
|
+
/**
|
|
174
|
+
* `true` on a code segment whose closing fence hasn't arrived yet —
|
|
175
|
+
* i.e. the trailing block during streaming. Consumers can render this
|
|
176
|
+
* in "streaming" mode (no copy affordance, partial-highlight pipeline)
|
|
177
|
+
* until the closer lands and it flips to a regular closed segment.
|
|
178
|
+
*/
|
|
179
|
+
open?: boolean;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Split markdown text into alternating prose / fenced-code segments.
|
|
183
|
+
*
|
|
184
|
+
* Recognizes both ` ``` ` and `~~~` fences, with arbitrary length ≥ 3,
|
|
185
|
+
* matching CommonMark's "fence indicator must be at least as long to
|
|
186
|
+
* close" rule. Info-strings (the bit after the opening fence) are kept
|
|
187
|
+
* as the `lang` hint; any trailing whitespace is trimmed. Closing
|
|
188
|
+
* fences are detected on a line of their own (whitespace tolerated).
|
|
189
|
+
*
|
|
190
|
+
* Unclosed fences fall back to emitting the would-be-code body as a
|
|
191
|
+
* trailing prose segment so no content is dropped — finalized markdown
|
|
192
|
+
* isn't expected to ship one, but the fallback keeps the renderer
|
|
193
|
+
* truthful when the model produces malformed output.
|
|
194
|
+
*
|
|
195
|
+
* Exported for unit tests.
|
|
196
|
+
*/
|
|
197
|
+
declare function splitMarkdownCodeBlocks(text: string): MarkdownSegment[];
|
|
198
|
+
/**
|
|
199
|
+
* Lift indented fenced code blocks to column 0 while preserving the code
|
|
200
|
+
* body's relative indentation.
|
|
201
|
+
*
|
|
202
|
+
* OpenTUI's markdown renderNode hook only receives top-level code tokens.
|
|
203
|
+
* A common assistant shape is:
|
|
204
|
+
*
|
|
205
|
+
* - Run this:
|
|
206
|
+
* ```bash
|
|
207
|
+
* command
|
|
208
|
+
* ```
|
|
209
|
+
*
|
|
210
|
+
* Marked parses that as code inside a list token, so the TUI loses the
|
|
211
|
+
* code-panel wrapper and copy affordance. Normalizing just the fence's list
|
|
212
|
+
* indentation keeps the prose readable while routing the snippet through
|
|
213
|
+
* the same top-level renderer as ordinary fences.
|
|
214
|
+
*/
|
|
215
|
+
declare function normalizeMarkdownCodeFences(text: string): string;
|
|
216
|
+
/**
|
|
217
|
+
* Default per-chunk target for {@link chunkMarkdownForRender}. Chosen from
|
|
218
|
+
* measurement: marked's lexer (which OpenTUI's `<markdown>` runs
|
|
219
|
+
* internally) is O(n²) over paragraph-heavy input — ~500ms at 64KiB,
|
|
220
|
+
* ~2s at 128KiB, ~6s at 256KiB on an M-series laptop — while staying
|
|
221
|
+
* comfortably in the linear zone below ~32KiB (≤ ~200ms). Chunking a
|
|
222
|
+
* large document into ≤24KiB pieces keeps the total render linear in
|
|
223
|
+
* document size with a small constant.
|
|
224
|
+
*/
|
|
225
|
+
declare const MARKDOWN_RENDER_CHUNK_TARGET_BYTES = 24576;
|
|
226
|
+
/**
|
|
227
|
+
* Split a large markdown document into render-safe chunks at blank-line
|
|
228
|
+
* boundaries outside code fences, each roughly `targetBytes` long.
|
|
229
|
+
*
|
|
230
|
+
* Rendering the chunks as SIBLING markdown renderables (with a one-row
|
|
231
|
+
* gap standing in for the consumed blank line) is visually equivalent to
|
|
232
|
+
* one renderable, but sidesteps the quadratic lexer cost documented on
|
|
233
|
+
* {@link MARKDOWN_RENDER_CHUNK_TARGET_BYTES}. Chunk boundaries are
|
|
234
|
+
* prefix-stable: appending text (streaming) can only ever change the
|
|
235
|
+
* LAST chunk, so keyed-by-index consumers reconcile cheaply.
|
|
236
|
+
*
|
|
237
|
+
* Returns `[text]` untouched for anything at or under the target.
|
|
238
|
+
*/
|
|
239
|
+
declare function chunkMarkdownForRender(text: string, targetBytes?: number): string[];
|
|
240
|
+
//#endregion
|
|
241
|
+
//#region src/chat/prompt-segments.d.ts
|
|
242
|
+
/**
|
|
243
|
+
* Pure string + reference math for rendering a submitted prompt with chip
|
|
244
|
+
* pills around completion references. Renderer-agnostic — the TUI walks
|
|
245
|
+
* the segments into OpenTUI `<text>` nodes, a GUI walks them into JSX
|
|
246
|
+
* spans + `<span class="chip">` pills. No layout engine assumptions.
|
|
247
|
+
*/
|
|
248
|
+
/**
|
|
249
|
+
* Highlight span — half-open `[start, end)` over the source string.
|
|
250
|
+
*
|
|
251
|
+
* Offsets are JS string indices (UTF-16 code units) — the same convention used
|
|
252
|
+
* everywhere else in the chat layer (`text[i]`, `m.index`, `String.slice`).
|
|
253
|
+
* Surrogate pairs that straddle a span boundary would render malformed, but
|
|
254
|
+
* realistic prompts in this surface (terminal text + ASCII triggers) keep that
|
|
255
|
+
* risk theoretical; callers feeding emoji-heavy content should normalize to
|
|
256
|
+
* codepoint walks upstream.
|
|
257
|
+
*/
|
|
258
|
+
interface PromptSegmentRef {
|
|
259
|
+
start: number;
|
|
260
|
+
end: number;
|
|
261
|
+
/** Provider id tagging this span (`'skills'`, `'files'`, …). Free-form. */
|
|
262
|
+
providerId: string;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* One atomic unit emitted by {@link splitPromptSegments}. Plain segments
|
|
266
|
+
* are word-sized so wraps land cleanly between words; chip segments
|
|
267
|
+
* carry the source `providerId` (`'skills'`, `'files'`, …) so renderers
|
|
268
|
+
* can pick per-kind colors without re-walking the ref list.
|
|
269
|
+
*/
|
|
270
|
+
type PromptSegment = {
|
|
271
|
+
kind: 'plain';
|
|
272
|
+
text: string;
|
|
273
|
+
} | {
|
|
274
|
+
kind: 'chip';
|
|
275
|
+
text: string;
|
|
276
|
+
providerId: string;
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* Split a prompt buffer into word-sized atomic segments suitable for a
|
|
280
|
+
* flex-row + flex-wrap renderer (TUI) or a `display: inline` flow with
|
|
281
|
+
* inline-block chips (GUI). Each chip becomes one segment (atomic —
|
|
282
|
+
* never broken across rows); each plain run is split into "word +
|
|
283
|
+
* trailing space" units so wraps land at clean word boundaries.
|
|
284
|
+
*
|
|
285
|
+
* Robust to:
|
|
286
|
+
* - Overlapping refs — sorted by start; later refs that overlap are
|
|
287
|
+
* dropped via the first-wins rule.
|
|
288
|
+
* - Out-of-bounds refs — dropped entirely when `end > text.length` or
|
|
289
|
+
* `start >= text.length`. Partial clipping would silently truncate
|
|
290
|
+
* a chip's label; the caller is in a better position to surface the
|
|
291
|
+
* mismatch (typically a stale `refs` array referencing a previous text).
|
|
292
|
+
* - Whitespace-only plain runs — emitted as their own plain segment
|
|
293
|
+
* so chip-adjacent-to-chip cases keep the original spacing.
|
|
294
|
+
*
|
|
295
|
+
* Word splitter rationale: `\S+\s*` keeps trailing whitespace attached
|
|
296
|
+
* to its preceding word so wrap boundaries land between words (cleanly).
|
|
297
|
+
* A leading-whitespace-only segment is captured by `\s+` so we don't
|
|
298
|
+
* drop it entirely when the plain run starts with a space.
|
|
299
|
+
*/
|
|
300
|
+
declare function splitPromptSegments(text: string, refs: readonly PromptSegmentRef[]): PromptSegment[];
|
|
301
|
+
//#endregion
|
|
302
|
+
//#region src/chat/tool-formatters.d.ts
|
|
303
|
+
/**
|
|
304
|
+
* Per-tool display metadata + one-line formatters consumed by any
|
|
305
|
+
* surface that renders a `tool` event in `'formatted'` mode (see
|
|
306
|
+
* `Settings.toolCallDisplay`).
|
|
307
|
+
*
|
|
308
|
+
* Each native tool gets a curated entry — a `displayName` verb that
|
|
309
|
+
* reads in sentence case (e.g. "Read", "Shell") and a `format` callback
|
|
310
|
+
* that pulls the most informative bits out of the model's raw input to
|
|
311
|
+
* a single scannable line. Unknown tools (MCP servers, host-added
|
|
312
|
+
* tools, future zidane additions) fall back to {@link formatToolCall}
|
|
313
|
+
* returning `null` — the renderer then shows a minimal `↳ <name>` line.
|
|
314
|
+
*
|
|
315
|
+
* Renderer-agnostic: returns plain data (`{ target, meta }`) so the
|
|
316
|
+
* TUI's React/OpenTUI surface and any future GUI consumer can paint
|
|
317
|
+
* the same shape in their own style. Lives in `zidane/chat` because
|
|
318
|
+
* it has no rendering concerns; the TUI just consumes it.
|
|
319
|
+
*/
|
|
320
|
+
interface ToolFormatLine {
|
|
321
|
+
/**
|
|
322
|
+
* Primary target — typically a path, command, pattern, or
|
|
323
|
+
* task description. Renderer paints this in the model accent color
|
|
324
|
+
* so the eye lands on it first.
|
|
325
|
+
*/
|
|
326
|
+
target?: string;
|
|
327
|
+
/**
|
|
328
|
+
* Secondary annotations rendered after the target, joined with
|
|
329
|
+
* ` · ` separators. Use for line ranges (`L10-25`), limits, flags,
|
|
330
|
+
* or any short suffix that adds context without bloating the line.
|
|
331
|
+
*/
|
|
332
|
+
meta?: readonly string[];
|
|
333
|
+
}
|
|
334
|
+
interface ToolDisplayMeta {
|
|
335
|
+
/**
|
|
336
|
+
* Title-case display verb (e.g. `Read`, `Shell`, `Edit`). When the
|
|
337
|
+
* label depends on an input field (e.g. `skills_use`'s
|
|
338
|
+
* `mode: 'activate' | 'deactivate'` → `Enable` / `Disable`), supply
|
|
339
|
+
* a function instead and read the field defensively. The function
|
|
340
|
+
* form is called whenever {@link displayNameFor} has the call's
|
|
341
|
+
* input in scope; callers without input fall back to the function's
|
|
342
|
+
* `input: undefined` branch, which should return a stable default.
|
|
343
|
+
*/
|
|
344
|
+
displayName: string | ((input: Record<string, unknown> | undefined) => string);
|
|
345
|
+
/**
|
|
346
|
+
* Pull a {@link ToolFormatLine} out of the raw model input. Returns
|
|
347
|
+
* `null` when the shape isn't what the tool expects (typed defensively
|
|
348
|
+
* — we never want a malformed call to crash the transcript).
|
|
349
|
+
*/
|
|
350
|
+
format: (input: Record<string, unknown>) => ToolFormatLine | null;
|
|
351
|
+
}
|
|
352
|
+
declare const TOOL_DISPLAY: Readonly<Record<string, ToolDisplayMeta>>;
|
|
353
|
+
/**
|
|
354
|
+
* Resolve the display verb for a tool. Native tools use their curated
|
|
355
|
+
* entry from {@link TOOL_DISPLAY}; everything else gets a sentence-case
|
|
356
|
+
* version of the raw name (`my_host_tool` → `My host tool`) so an MCP /
|
|
357
|
+
* host tool still reads cleanly in the transcript without shouting
|
|
358
|
+
* Title Case at every word.
|
|
359
|
+
*
|
|
360
|
+
* MCP convention: every tool surfaced by `mcp/connectMcpServers` is
|
|
361
|
+
* namespaced as `mcp_<server>_<tool>` (see `src/mcp/index.ts`). The
|
|
362
|
+
* `mcp_` prefix is plumbing — strip it before casing so the label
|
|
363
|
+
* reads as `Github create issue` instead of `Mcp github create issue`.
|
|
364
|
+
* The server name leads, which doubles as a free visual grouping
|
|
365
|
+
* affordance ("everything starting with `Github` came from the github
|
|
366
|
+
* MCP server").
|
|
367
|
+
*/
|
|
368
|
+
declare function displayNameFor(name: string, input?: Record<string, unknown>): string;
|
|
369
|
+
/**
|
|
370
|
+
* Run a tool's curated formatter and return the result, or `null` when
|
|
371
|
+
* no formatter is registered / the input shape doesn't match. Renderer
|
|
372
|
+
* decides what to do with `null` — typically: show `↳ <displayName>`
|
|
373
|
+
* with no target / meta tail.
|
|
374
|
+
*/
|
|
375
|
+
declare function formatToolCall(name: string, input: Record<string, unknown>): ToolFormatLine | null;
|
|
376
|
+
//#endregion
|
|
377
|
+
export { isTurnHighlighted as C, turnSelectionOwnership as E, isEditErrorResult as S, selectableTurnIds as T, SafeModeActions as _, formatToolCall as a, useSafeModeQueue as b, splitPromptSegments as c, chunkMarkdownForRender as d, normalizeMarkdownCodeFences as f, RequestApproval as g, ApprovalRequest as h, displayNameFor as i, MARKDOWN_RENDER_CHUNK_TARGET_BYTES as l, ApprovalDecision as m, ToolDisplayMeta as n, PromptSegment as o, splitMarkdownCodeBlocks as p, ToolFormatLine as r, PromptSegmentRef as s, TOOL_DISPLAY as t, MarkdownSegment as u, SafeModeProvider as v, isVisible as w, EDIT_TOOL_NAMES as x, useSafeModeActions as y };
|
|
378
|
+
//# sourceMappingURL=tool-formatters-DY0TDb1r.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-formatters-DY0TDb1r.d.ts","names":[],"sources":["../src/chat/turn-selection.ts","../src/chat/safe-mode-context.tsx","../src/chat/markdown-segments.ts","../src/chat/prompt-segments.ts","../src/chat/tool-formatters.ts"],"mappings":";;;;;cAaa,eAAA,EAAiB,WAAW;;A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|
package/dist/tools.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export { type ChildAgent, type CreateShellToolOptions, type HydrateReadStateOptions, type InteractionToolOptions, type LazyToolEntry, type ReadStateEntry, type ReadStateMap, type SkillsReadToolOptions, type SkillsRunScriptToolOptions, type SkillsUseToolOptions, type SpawnToolOptions, type SpawnToolState, type SubagentDef, type SubagentRegistry, type TailTruncateOptions, type ToolContext, type ToolDef, type ToolMap, type ToolSearchToolOptions, type ValidationResult, WAIT_TASK_TIMED_OUT_PREFIX, createInteractionTool, createShellTool, createSkillsReadTool, createSkillsRunScriptTool, createSkillsUseTool, createSpawnTool, createToolSearchTool, edit, getReadState, glob, grep, hashContent, hydrateReadStateFromSession, hydrateReadStateFromSessionAsync, listFiles, multiEdit, readFile, readStateKey, resolveReadStateMap, shell, shellKill, tailTruncate, validateToolArgs, waitTask, writeFile };
|
|
1
|
+
import { $n as validateToolArgs, Qn as ValidationResult, Sr as edit, Xn as WAIT_TASK_TIMED_OUT_PREFIX, Yn as writeFile, Zn as waitTask, _f as hydrateReadStateFromSessionAsync, _r as listFiles, ar as SkillsUseToolOptions, br as grep, cf as ToolContext, cr as createSkillsRunScriptTool, cs as SpawnTool, df as HydrateReadStateOptions, dr as shellKill, ds as SubagentDef, er as TailTruncateOptions, ff as ReadStateEntry, fr as CreateShellToolOptions, fs as SubagentOverride, gf as hydrateReadStateFromSession, gr as multiEdit, hf as hashContent, hr as readFile, hs as isSpawnTool, ir as createToolSearchTool, lf as ToolDef, lr as SkillsReadToolOptions, ls as SpawnToolOptions, mf as getReadState, mr as shell, ms as createSpawnTool, nr as LazyToolEntry, or as createSkillsUseTool, os as ChildAgent, pf as ReadStateMap, pr as createShellTool, ps as SubagentRegistry, rr as ToolSearchToolOptions, sr as SkillsRunScriptToolOptions, ss as ExtensionSubagentDef, tr as tailTruncate, uf as ToolMap, ur as createSkillsReadTool, us as SpawnToolState, vf as readStateKey, vr as InteractionToolOptions, xr as glob, yf as resolveReadStateMap, yr as createInteractionTool } from "./index-B8UtiZy7.js";
|
|
2
|
+
export { type ChildAgent, type CreateShellToolOptions, type ExtensionSubagentDef, type HydrateReadStateOptions, type InteractionToolOptions, type LazyToolEntry, type ReadStateEntry, type ReadStateMap, type SkillsReadToolOptions, type SkillsRunScriptToolOptions, type SkillsUseToolOptions, type SpawnTool, type SpawnToolOptions, type SpawnToolState, type SubagentDef, type SubagentOverride, type SubagentRegistry, type TailTruncateOptions, type ToolContext, type ToolDef, type ToolMap, type ToolSearchToolOptions, type ValidationResult, WAIT_TASK_TIMED_OUT_PREFIX, createInteractionTool, createShellTool, createSkillsReadTool, createSkillsRunScriptTool, createSkillsUseTool, createSpawnTool, createToolSearchTool, edit, getReadState, glob, grep, hashContent, hydrateReadStateFromSession, hydrateReadStateFromSessionAsync, isSpawnTool, listFiles, multiEdit, readFile, readStateKey, resolveReadStateMap, shell, shellKill, tailTruncate, validateToolArgs, waitTask, writeFile };
|
package/dist/tools.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { a as hydrateReadStateFromSessionAsync, c as resolveReadStateMap, i as hydrateReadStateFromSession, r as hashContent, s as readStateKey, t as getReadState } from "./read-state-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export { WAIT_TASK_TIMED_OUT_PREFIX, createInteractionTool, createShellTool, createSkillsReadTool, createSkillsRunScriptTool, createSkillsUseTool, createSpawnTool, createToolSearchTool, edit, getReadState, glob, grep, hashContent, hydrateReadStateFromSession, hydrateReadStateFromSessionAsync, listFiles, multiEdit, readFile, readStateKey, resolveReadStateMap, shell, shellKill, tailTruncate, validateToolArgs, waitTask, writeFile };
|
|
1
|
+
import { a as hydrateReadStateFromSessionAsync, c as resolveReadStateMap, i as hydrateReadStateFromSession, r as hashContent, s as readStateKey, t as getReadState } from "./read-state-Dq_TXUX1.js";
|
|
2
|
+
import { Ct as listFiles, Dt as edit, Et as glob, Ot as validateToolArgs, St as multiEdit, Tt as grep, _t as shellKill, bt as tailTruncate, ct as writeFile, dt as createToolSearchTool, ft as createSpawnTool, gt as createSkillsReadTool, ht as createSkillsRunScriptTool, lt as WAIT_TASK_TIMED_OUT_PREFIX, mt as createSkillsUseTool, pt as isSpawnTool, ut as waitTask, vt as createShellTool, wt as createInteractionTool, xt as readFile, yt as shell } from "./agent-DkSmGkDM.js";
|
|
3
|
+
export { WAIT_TASK_TIMED_OUT_PREFIX, createInteractionTool, createShellTool, createSkillsReadTool, createSkillsRunScriptTool, createSkillsUseTool, createSpawnTool, createToolSearchTool, edit, getReadState, glob, grep, hashContent, hydrateReadStateFromSession, hydrateReadStateFromSessionAsync, isSpawnTool, listFiles, multiEdit, readFile, readStateKey, resolveReadStateMap, shell, shellKill, tailTruncate, validateToolArgs, waitTask, writeFile };
|