zidane 3.1.2 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-C9q5VMGa.d.ts → agent-BBzkPRAu.d.ts} +61 -27
- package/dist/{chunk-BXO7CZHJ.js → chunk-3D5Q527Y.js} +3 -3
- package/dist/{chunk-BW3WTFIR.js → chunk-LIVB5W4B.js} +1 -1
- package/dist/{chunk-IUBBVF53.js → chunk-UD25QF3H.js} +66 -8
- package/dist/{chunk-BRMURQA2.js → chunk-VGFQEOHF.js} +2 -15
- package/dist/{chunk-YQ7LY6CL.js → chunk-X244RS5H.js} +25 -27
- package/dist/{chunk-TPXPVEH6.js → chunk-X3VOTPVM.js} +12 -5
- package/dist/{chunk-2AE3VM5O.js → chunk-Z2E5QN5X.js} +277 -147
- package/dist/contexts.js +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -9
- package/dist/mcp.d.ts +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/presets.js +4 -4
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +2 -2
- package/dist/session/sqlite.d.ts +1 -1
- package/dist/session/sqlite.js +6 -7
- package/dist/session.d.ts +1 -1
- package/dist/session.js +1 -1
- package/dist/{skills-use-DU0unNP4.d.ts → skills-use-JMcA5NrF.d.ts} +1 -1
- package/dist/skills.d.ts +114 -96
- package/dist/skills.js +2 -2
- package/dist/tools.d.ts +4 -4
- package/dist/tools.js +3 -5
- package/dist/types.d.ts +2 -2
- package/dist/{validation-BKA33eqb.d.ts → validation-c3MQlCza.d.ts} +12 -22
- package/package.json +1 -1
|
@@ -242,7 +242,7 @@ interface AgentBehavior {
|
|
|
242
242
|
* `runTurn` is 1-indexed, run-relative (resumed sessions reset).
|
|
243
243
|
*
|
|
244
244
|
* No-op when `thinkingBudget` is unset. Honored by every provider that
|
|
245
|
-
* respects `thinkingBudget` (anthropic
|
|
245
|
+
* respects `thinkingBudget` (anthropic explicit-budget `enabled` path,
|
|
246
246
|
* adaptive `maxTokensCap`, openai-compat `max_tokens` padding).
|
|
247
247
|
*
|
|
248
248
|
* Default: `undefined` (no decay).
|
|
@@ -356,8 +356,8 @@ interface AgentBehavior {
|
|
|
356
356
|
* model "remembers" stale content and applies a substring edit against
|
|
357
357
|
* bytes that have moved.
|
|
358
358
|
*
|
|
359
|
-
* Requires a session. Off by default
|
|
360
|
-
*
|
|
359
|
+
* Requires a session. Off by default; turn it on for stricter eval-grade
|
|
360
|
+
* runs where silent edit corruption would invalidate the result.
|
|
361
361
|
*
|
|
362
362
|
* Default: `false`.
|
|
363
363
|
*/
|
|
@@ -392,14 +392,40 @@ interface AgentBehavior {
|
|
|
392
392
|
* for elision so the model keeps the freshest tool context. Default: `4`.
|
|
393
393
|
*/
|
|
394
394
|
compactKeepTurns?: number;
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
395
|
+
/**
|
|
396
|
+
* Prefix every line of `read_file` output with its 1-indexed line number
|
|
397
|
+
* followed by a tab (`<N>\t<content>`) — the compact `cat -n`-style
|
|
398
|
+
* format Claude Code emits. The `edit` tool strips the prefix from
|
|
399
|
+
* `old_string` / `new_string` so the model can paste back a numbered
|
|
400
|
+
* chunk verbatim without breaking the match.
|
|
401
|
+
*
|
|
402
|
+
* Set `false` to opt out — useful for callers piping `read_file` into
|
|
403
|
+
* downstream parsers that don't recognize the prefix. Per-call
|
|
404
|
+
* `read_file({ lineNumbers: false })` overrides this default.
|
|
405
|
+
*
|
|
406
|
+
* Default: `true`.
|
|
407
|
+
*/
|
|
408
|
+
readLineNumbers?: boolean;
|
|
409
|
+
/**
|
|
410
|
+
* Replace older `read_file` `tool_result` blocks with a short stub when
|
|
411
|
+
* a successful `edit` / `multi_edit` / `write_file` later in the same
|
|
412
|
+
* run modified the same path. The replacement is applied to the
|
|
413
|
+
* wire-level message list only — persisted session turns keep the
|
|
414
|
+
* original content.
|
|
415
|
+
*
|
|
416
|
+
* Eliminates the common waste pattern where the model carries the
|
|
417
|
+
* pre-edit file body forward across many turns "in case it needs it".
|
|
418
|
+
* Pairs cleanly with `compactStrategy: 'tail'`: stale reads shrink
|
|
419
|
+
* first, then the byte-threshold compaction fires if anything's left.
|
|
420
|
+
*
|
|
421
|
+
* Detection is conservative — only triggers when the corresponding
|
|
422
|
+
* tool_result confirms success (`Edited …`, `Created …`, `Updated …`).
|
|
423
|
+
* Failed edits and `No change needed` write_file calls do NOT
|
|
424
|
+
* invalidate prior reads.
|
|
425
|
+
*
|
|
426
|
+
* Default: `false`.
|
|
427
|
+
*/
|
|
428
|
+
elideStaleReads?: boolean;
|
|
403
429
|
}
|
|
404
430
|
/**
|
|
405
431
|
* One block of a multimodal user prompt.
|
|
@@ -540,11 +566,6 @@ interface AgentRunOptions {
|
|
|
540
566
|
prompt?: string | PromptPart[];
|
|
541
567
|
system?: string;
|
|
542
568
|
thinking?: ThinkingLevel;
|
|
543
|
-
/**
|
|
544
|
-
* Legacy image attachments. When `prompt` is a string, these are appended as image
|
|
545
|
-
* parts after the text. Ignored when `prompt` is a `PromptPart[]`.
|
|
546
|
-
*/
|
|
547
|
-
images?: ImageContent[];
|
|
548
569
|
/** Abort signal — when triggered, the agent stops after the current turn */
|
|
549
570
|
signal?: AbortSignal;
|
|
550
571
|
/** Behavior overrides for this run (overrides agent defaults) */
|
|
@@ -1082,8 +1103,8 @@ interface Provider {
|
|
|
1082
1103
|
} & Record<string, unknown>;
|
|
1083
1104
|
/** Format tool specs for this provider */
|
|
1084
1105
|
formatTools: (tools: ToolSpec[]) => unknown[];
|
|
1085
|
-
/** Create a user message
|
|
1086
|
-
userMessage: (content: string
|
|
1106
|
+
/** Create a text-only user message. Multimodal content goes through `promptMessage`. */
|
|
1107
|
+
userMessage: (content: string) => SessionMessage;
|
|
1087
1108
|
/** Create an assistant message (for priming) */
|
|
1088
1109
|
assistantMessage: (content: string) => SessionMessage;
|
|
1089
1110
|
/** Create a tool results message to send back */
|
|
@@ -1584,13 +1605,13 @@ interface McpConnection {
|
|
|
1584
1605
|
*/
|
|
1585
1606
|
declare function normalizeMcpServers(input: unknown): McpServerConfig[];
|
|
1586
1607
|
/**
|
|
1587
|
-
* Lossy flattener — converts MCP `CallToolResult.content` blocks to a single
|
|
1588
|
-
* Text blocks are extracted; non-text blocks are JSON-stringified.
|
|
1608
|
+
* Lossy flattener — converts MCP `CallToolResult.content` blocks to a single
|
|
1609
|
+
* string. Text blocks are extracted; non-text blocks are JSON-stringified.
|
|
1589
1610
|
*
|
|
1590
|
-
*
|
|
1591
|
-
*
|
|
1592
|
-
*
|
|
1593
|
-
*
|
|
1611
|
+
* Use this only at UI / log boundaries that require a string. The agent
|
|
1612
|
+
* loop itself routes through {@link normalizeMcpBlocks} so image blocks
|
|
1613
|
+
* survive into provider-native tool_result content (Anthropic blocks,
|
|
1614
|
+
* OpenAI companion-user-message).
|
|
1594
1615
|
*/
|
|
1595
1616
|
declare function resultToString(content: unknown[]): string;
|
|
1596
1617
|
/**
|
|
@@ -2092,7 +2113,14 @@ interface AgentOptions {
|
|
|
2092
2113
|
session?: Session;
|
|
2093
2114
|
/** Skills configuration */
|
|
2094
2115
|
skills?: SkillsConfig;
|
|
2095
|
-
/**
|
|
2116
|
+
/**
|
|
2117
|
+
* Test seam — replaces the default MCP connector with a custom
|
|
2118
|
+
* implementation. Bypasses the `mcpServers` normalization layer entirely
|
|
2119
|
+
* and is **not** part of the supported public API. Subject to change or
|
|
2120
|
+
* removal in any release.
|
|
2121
|
+
*
|
|
2122
|
+
* @internal
|
|
2123
|
+
*/
|
|
2096
2124
|
mcpConnector?: (configs: McpServerConfig[]) => Promise<McpConnection>;
|
|
2097
2125
|
/**
|
|
2098
2126
|
* Pre-connect MCP servers in the background as soon as `createAgent` returns,
|
|
@@ -2156,8 +2184,14 @@ interface Agent {
|
|
|
2156
2184
|
readonly session: Session | null;
|
|
2157
2185
|
/** Snapshot of currently active skills. */
|
|
2158
2186
|
readonly activeSkills: readonly ActiveSkill[];
|
|
2159
|
-
|
|
2187
|
+
/**
|
|
2188
|
+
* Frozen view of the underlying `provider.meta`. Read-only to prevent
|
|
2189
|
+
* accidental cross-agent contamination — writes are rejected at runtime
|
|
2190
|
+
* (via `Object.freeze`) and at compile time (via `Readonly`). To override
|
|
2191
|
+
* model / capability defaults, construct a new provider.
|
|
2192
|
+
*/
|
|
2193
|
+
readonly meta: Readonly<Record<string, unknown>>;
|
|
2160
2194
|
}
|
|
2161
2195
|
declare function createAgent({ provider, name: agentName, system: agentSystem, tools: agentTools, toolAliases, behavior: agentBehavior, execution, mcpServers, session, skills: agentSkills, mcpConnector, eager }: AgentOptions): Agent;
|
|
2162
2196
|
|
|
2163
|
-
export { type
|
|
2197
|
+
export { type ToolMap as $, type Agent as A, type SessionData as B, CONTEXT_EXCEEDED_MESSAGE_PATTERNS as C, type SessionEndStatus as D, type SessionHookContext as E, type SessionMessage as F, type SessionRun as G, type SessionStore as H, type SessionTurn as I, type SkillConfig as J, type SkillResource as K, type SkillsConfig as L, type McpConnection as M, type SpawnHookContext as N, type OAuthRefreshHookContext as O, type PromptDocumentPart as P, type StreamCallbacks as Q, type RemoteStoreOptions as R, type Session as S, type StreamHookContext as T, type StreamOptions as U, type ThinkingLevel as V, type ToolCall as W, type ToolContext as X, type ToolDef as Y, type ToolExecutionMode as Z, type ToolHookContext as _, AgentAbortedError as a, type ToolResult as a0, type ToolResultContent as a1, type ToolResultImageContent as a2, type ToolResultTextContent as a3, type ToolSpec as a4, type TurnFinishReason as a5, type TurnResult as a6, type TurnUsage as a7, matchesContextExceeded as a8, toolOutputByteLength as a9, loadSession as aA, mapOAIFinishReason as aB, normalizeMcpBlocks as aC, normalizeMcpServers as aD, openai as aE, openaiCompat as aF, openrouter as aG, resultToString as aH, toAnthropic as aI, toOpenAI as aJ, toTypedError as aK, toolResultToText as aa, type ActivationVia as ab, type ActiveSkill as ac, type DeactivationReason as ad, type FileMapAdapter as ae, type FileMapStoreOptions as af, type OpenAICompatAuthHeader as ag, OpenAICompatHttpError as ah, type OpenAICompatParams as ai, type SkillActivationState as aj, type SkillActivationStateOptions as ak, type SkillDiagnostic as al, type SkillSource as am, anthropic as an, autoDetectAndConvert as ao, cerebras as ap, classifyOpenAICompatError as aq, connectMcpServers as ar, createAgent as as, createFileMapStore as at, createMemoryStore as au, createRemoteStore as av, createSession as aw, createSkillActivationState as ax, fromAnthropic as ay, fromOpenAI as az, type AgentBehavior as b, AgentContextExceededError as c, type AgentHooks as d, type AgentOptions as e, AgentProviderError as f, type AgentRunOptions as g, type AgentStats as h, AgentToolNotAllowedError as i, type AnthropicParams as j, type CerebrasParams as k, type ChildRunStats as l, type ClassifiedError as m, type ClassifiedErrorKind as n, type CreateSessionOptions as o, type McpServerConfig as p, type McpToolHookContext as q, type OpenAIParams as r, type OpenRouterParams as s, type PromptImagePart as t, type PromptPart as u, type PromptTextPart as v, type Provider as w, type ProviderCapabilities as x, type RunHookMap as y, type SessionContentBlock as z };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
|
+
createSpawnTool,
|
|
2
3
|
edit,
|
|
3
4
|
listFiles,
|
|
4
5
|
multiEdit,
|
|
5
6
|
readFile,
|
|
6
7
|
shell,
|
|
7
|
-
spawn,
|
|
8
8
|
writeFile
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-Z2E5QN5X.js";
|
|
10
10
|
|
|
11
11
|
// src/presets/basic.ts
|
|
12
12
|
var basicTools = { shell, readFile, writeFile, listFiles, edit, multiEdit };
|
|
13
13
|
var basic_default = definePreset({
|
|
14
14
|
name: "basic",
|
|
15
15
|
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.",
|
|
16
|
-
tools: { ...basicTools, spawn }
|
|
16
|
+
tools: { ...basicTools, spawn: createSpawnTool() }
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
// src/presets/index.ts
|
|
@@ -78,19 +78,77 @@ function createDockerContext(config) {
|
|
|
78
78
|
const stream = await exec.start({ Detach: false });
|
|
79
79
|
return new Promise((resolve2) => {
|
|
80
80
|
let stdout = "";
|
|
81
|
-
|
|
81
|
+
let stderr = "";
|
|
82
|
+
let resolved = false;
|
|
83
|
+
const stdoutSink = {
|
|
84
|
+
write(chunk) {
|
|
85
|
+
stdout += typeof chunk === "string" ? chunk : chunk.toString("utf-8");
|
|
86
|
+
return true;
|
|
87
|
+
},
|
|
88
|
+
end() {
|
|
89
|
+
},
|
|
90
|
+
on() {
|
|
91
|
+
},
|
|
92
|
+
once() {
|
|
93
|
+
},
|
|
94
|
+
emit() {
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const stderrSink = {
|
|
99
|
+
write(chunk) {
|
|
100
|
+
stderr += typeof chunk === "string" ? chunk : chunk.toString("utf-8");
|
|
101
|
+
return true;
|
|
102
|
+
},
|
|
103
|
+
end() {
|
|
104
|
+
},
|
|
105
|
+
on() {
|
|
106
|
+
},
|
|
107
|
+
once() {
|
|
108
|
+
},
|
|
109
|
+
emit() {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
try {
|
|
114
|
+
ref.docker.modem.demuxStream(stream, stdoutSink, stderrSink);
|
|
115
|
+
} catch {
|
|
116
|
+
stream.on("data", (chunk) => {
|
|
117
|
+
stdout += chunk.toString("utf-8");
|
|
118
|
+
});
|
|
119
|
+
}
|
|
82
120
|
const timeout = options?.timeout ?? defaultLimits?.timeout ?? 30;
|
|
83
121
|
const timer = setTimeout(() => {
|
|
84
|
-
|
|
85
|
-
|
|
122
|
+
if (resolved)
|
|
123
|
+
return;
|
|
124
|
+
resolved = true;
|
|
125
|
+
try {
|
|
126
|
+
stream.destroy?.();
|
|
127
|
+
} catch {
|
|
128
|
+
}
|
|
129
|
+
resolve2({ stdout, stderr: stderr ? `${stderr}
|
|
130
|
+
[timeout]` : "[timeout]", exitCode: 124 });
|
|
86
131
|
}, timeout * 1e3);
|
|
87
|
-
stream.on("data", (chunk) => {
|
|
88
|
-
stdout += chunk.toString("utf-8");
|
|
89
|
-
});
|
|
90
132
|
stream.on("end", async () => {
|
|
133
|
+
if (resolved)
|
|
134
|
+
return;
|
|
135
|
+
resolved = true;
|
|
136
|
+
clearTimeout(timer);
|
|
137
|
+
let exitCode = 0;
|
|
138
|
+
try {
|
|
139
|
+
const inspect = await exec.inspect();
|
|
140
|
+
exitCode = inspect.ExitCode ?? 0;
|
|
141
|
+
} catch {
|
|
142
|
+
}
|
|
143
|
+
resolve2({ stdout, stderr, exitCode });
|
|
144
|
+
});
|
|
145
|
+
stream.on("error", (err) => {
|
|
146
|
+
if (resolved)
|
|
147
|
+
return;
|
|
148
|
+
resolved = true;
|
|
91
149
|
clearTimeout(timer);
|
|
92
|
-
|
|
93
|
-
|
|
150
|
+
resolve2({ stdout, stderr: stderr ? `${stderr}
|
|
151
|
+
${err.message}` : err.message, exitCode: 1 });
|
|
94
152
|
});
|
|
95
153
|
});
|
|
96
154
|
},
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
toAnthropic,
|
|
6
6
|
toolResultsMessage,
|
|
7
7
|
userMessage
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-X244RS5H.js";
|
|
9
9
|
import {
|
|
10
10
|
matchesContextExceeded
|
|
11
11
|
} from "./chunk-LNN5UTS2.js";
|
|
@@ -365,20 +365,7 @@ function anthropic(anthropicParams) {
|
|
|
365
365
|
input_schema: t.inputSchema
|
|
366
366
|
}));
|
|
367
367
|
},
|
|
368
|
-
userMessage(content
|
|
369
|
-
if (images && images.length > 0) {
|
|
370
|
-
return {
|
|
371
|
-
role: "user",
|
|
372
|
-
content: [
|
|
373
|
-
...images.map((img) => ({
|
|
374
|
-
type: "image",
|
|
375
|
-
mediaType: img.source.media_type,
|
|
376
|
-
data: img.source.data
|
|
377
|
-
})),
|
|
378
|
-
{ type: "text", text: content }
|
|
379
|
-
]
|
|
380
|
-
};
|
|
381
|
-
}
|
|
368
|
+
userMessage(content) {
|
|
382
369
|
return { role: "user", content: [{ type: "text", text: content }] };
|
|
383
370
|
},
|
|
384
371
|
assistantMessage(content) {
|
|
@@ -246,20 +246,7 @@ function formatTools(tools) {
|
|
|
246
246
|
function: { name: t.name, description: t.description, parameters: t.inputSchema }
|
|
247
247
|
}));
|
|
248
248
|
}
|
|
249
|
-
function userMessage(content
|
|
250
|
-
if (images?.length) {
|
|
251
|
-
return {
|
|
252
|
-
role: "user",
|
|
253
|
-
content: [
|
|
254
|
-
...images.map((img) => ({
|
|
255
|
-
type: "image",
|
|
256
|
-
mediaType: img.source.media_type,
|
|
257
|
-
data: img.source.data
|
|
258
|
-
})),
|
|
259
|
-
{ type: "text", text: content }
|
|
260
|
-
]
|
|
261
|
-
};
|
|
262
|
-
}
|
|
249
|
+
function userMessage(content) {
|
|
263
250
|
return { role: "user", content: [{ type: "text", text: content }] };
|
|
264
251
|
}
|
|
265
252
|
function assistantMessage(content) {
|
|
@@ -532,22 +519,31 @@ function fromOpenAI(msg) {
|
|
|
532
519
|
content.push({ type: "text", text: c });
|
|
533
520
|
return { role, content };
|
|
534
521
|
}
|
|
535
|
-
if (typeof c === "object" && c._tag === ASSISTANT_TOOL_CALLS_TAG) {
|
|
536
|
-
|
|
537
|
-
|
|
522
|
+
if (typeof c === "object" && !Array.isArray(c) && c._tag === ASSISTANT_TOOL_CALLS_TAG) {
|
|
523
|
+
const tagged = c;
|
|
524
|
+
if (typeof tagged.text === "string" && tagged.text) {
|
|
525
|
+
content.push({ type: "text", text: tagged.text });
|
|
538
526
|
}
|
|
539
|
-
if (Array.isArray(
|
|
540
|
-
for (const
|
|
541
|
-
|
|
542
|
-
|
|
527
|
+
if (Array.isArray(tagged.tool_calls)) {
|
|
528
|
+
for (const raw of tagged.tool_calls) {
|
|
529
|
+
if (!raw || typeof raw !== "object")
|
|
530
|
+
continue;
|
|
531
|
+
const tc = raw;
|
|
532
|
+
const rawArgs = tc.function?.arguments;
|
|
533
|
+
const input = rawArgs ? typeof rawArgs === "string" ? JSON.parse(rawArgs) : rawArgs : {};
|
|
534
|
+
content.push({ type: "tool_call", id: tc.id ?? "", name: tc.function?.name ?? "", input });
|
|
543
535
|
}
|
|
544
536
|
}
|
|
545
537
|
return { role, content };
|
|
546
538
|
}
|
|
547
|
-
if (typeof c === "object" && c._tag === TOOL_RESULTS_TAG) {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
539
|
+
if (typeof c === "object" && !Array.isArray(c) && c._tag === TOOL_RESULTS_TAG) {
|
|
540
|
+
const tagged = c;
|
|
541
|
+
if (Array.isArray(tagged.results)) {
|
|
542
|
+
for (const raw of tagged.results) {
|
|
543
|
+
if (!raw || typeof raw !== "object")
|
|
544
|
+
continue;
|
|
545
|
+
const r = raw;
|
|
546
|
+
content.push({ type: "tool_result", callId: r.tool_call_id ?? "", output: r.content ?? "" });
|
|
551
547
|
}
|
|
552
548
|
}
|
|
553
549
|
return { role, content };
|
|
@@ -649,8 +645,10 @@ function toOpenAI(msg) {
|
|
|
649
645
|
}
|
|
650
646
|
function autoDetectAndConvert(msg) {
|
|
651
647
|
const c = msg.content;
|
|
652
|
-
if (c && typeof c === "object" &&
|
|
653
|
-
|
|
648
|
+
if (c && typeof c === "object" && !Array.isArray(c)) {
|
|
649
|
+
const tag = c._tag;
|
|
650
|
+
if (typeof tag === "string" && tag.startsWith("__zidane_"))
|
|
651
|
+
return fromOpenAI(msg);
|
|
654
652
|
}
|
|
655
653
|
if (Array.isArray(c)) {
|
|
656
654
|
for (const block of c) {
|
|
@@ -252,10 +252,9 @@ function installAllowedToolsGate(hooks, state) {
|
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
// src/skills/catalog.ts
|
|
255
|
-
function buildCatalog(skills,
|
|
255
|
+
function buildCatalog(skills, options = {}) {
|
|
256
256
|
if (skills.length === 0)
|
|
257
257
|
return "";
|
|
258
|
-
const options = typeof optionsOrReadToolName === "string" ? { skillsToolRegistered: false, readToolName: optionsOrReadToolName } : optionsOrReadToolName;
|
|
259
258
|
const skillsToolRegistered = options.skillsToolRegistered ?? true;
|
|
260
259
|
const readToolName = options.readToolName ?? "read_file";
|
|
261
260
|
const entries = skills.map((skill) => {
|
|
@@ -740,11 +739,12 @@ function writeSkillsToDisk(skills, targetDir) {
|
|
|
740
739
|
}
|
|
741
740
|
|
|
742
741
|
// src/skills/resolve.ts
|
|
743
|
-
import { mkdtempSync } from "fs";
|
|
742
|
+
import { mkdtempSync, rmSync } from "fs";
|
|
744
743
|
import { tmpdir } from "os";
|
|
745
744
|
import { join as join3 } from "path";
|
|
746
745
|
async function resolveSkills(config) {
|
|
747
746
|
const sourcedPaths = [];
|
|
747
|
+
let writeDir;
|
|
748
748
|
if (!config.skipDefaultPaths) {
|
|
749
749
|
sourcedPaths.push(...getDefaultScanPaths());
|
|
750
750
|
}
|
|
@@ -752,7 +752,7 @@ async function resolveSkills(config) {
|
|
|
752
752
|
sourcedPaths.push({ path: p, source: inferSource(p) });
|
|
753
753
|
}
|
|
754
754
|
if (config.write?.length) {
|
|
755
|
-
|
|
755
|
+
writeDir = mkdtempSync(join3(tmpdir(), "zidane-skills-"));
|
|
756
756
|
writeSkillsToDisk(config.write, writeDir);
|
|
757
757
|
sourcedPaths.push({ path: writeDir, source: "inline" });
|
|
758
758
|
}
|
|
@@ -766,7 +766,14 @@ async function resolveSkills(config) {
|
|
|
766
766
|
const allowlist = new Set(config.enabled);
|
|
767
767
|
filtered = filtered.filter((s) => allowlist.has(s.name));
|
|
768
768
|
}
|
|
769
|
-
|
|
769
|
+
const cleanup = writeDir ? () => {
|
|
770
|
+
try {
|
|
771
|
+
rmSync(writeDir, { recursive: true, force: true });
|
|
772
|
+
} catch {
|
|
773
|
+
}
|
|
774
|
+
} : () => {
|
|
775
|
+
};
|
|
776
|
+
return { skills: filtered, cleanup };
|
|
770
777
|
}
|
|
771
778
|
|
|
772
779
|
// src/skills/interpolate.ts
|