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/contexts.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  createDockerContext,
3
3
  createProcessContext,
4
4
  createSandboxContext
5
- } from "./chunk-IUBBVF53.js";
5
+ } from "./chunk-UD25QF3H.js";
6
6
  export {
7
7
  createDockerContext,
8
8
  createProcessContext,
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { d as AgentHooks } from './agent-C9q5VMGa.js';
2
- export { ac as ActivationVia, ad as ActiveSkill, A as Agent, a as AgentAbortedError, b as AgentBehavior, c as AgentContextExceededError, e as AgentOptions, f as AgentProviderError, g as AgentRunOptions, h as AgentStats, i as AgentToolNotAllowedError, j as AnthropicParams, C as CONTEXT_EXCEEDED_MESSAGE_PATTERNS, k as CerebrasParams, m as ClassifiedError, n as ClassifiedErrorKind, o as CreateSessionOptions, ae as DeactivationReason, af as FileMapAdapter, ag as FileMapStoreOptions, I as ImageContent, M as McpConnection, p as McpServerConfig, q as McpToolHookContext, O as OAuthRefreshHookContext, ah as OpenAICompatAuthHeader, ai as OpenAICompatHttpError, aj as OpenAICompatParams, r as OpenAIParams, s as OpenRouterParams, P as PromptDocumentPart, t as PromptImagePart, u as PromptPart, v as PromptTextPart, w as Provider, x as ProviderCapabilities, R as RemoteStoreOptions, y as RunHookMap, S as Session, z as SessionContentBlock, B as SessionData, D as SessionEndStatus, E as SessionHookContext, F as SessionMessage, G as SessionRun, H as SessionStore, J as SessionTurn, ak as SkillActivationState, al as SkillActivationStateOptions, K as SkillConfig, am as SkillDiagnostic, L as SkillResource, an as SkillSource, N as SkillsConfig, Q as SpawnHookContext, T as StreamCallbacks, U as StreamHookContext, V as StreamOptions, W as ThinkingLevel, X as ToolCall, Y as ToolContext, Z as ToolDef, _ as ToolExecutionMode, $ as ToolHookContext, a0 as ToolMap, a1 as ToolResult, a2 as ToolResultContent, a3 as ToolResultImageContent, a4 as ToolResultTextContent, a5 as ToolSpec, a6 as TurnFinishReason, a7 as TurnResult, a8 as TurnUsage, ao as anthropic, ap as autoDetectAndConvert, aq as cerebras, ar as classifyOpenAICompatError, as as connectMcpServers, at as createAgent, au as createFileMapStore, av as createMemoryStore, aw as createRemoteStore, ax as createSession, ay as createSkillActivationState, az as fromAnthropic, aA as fromOpenAI, aB as loadSession, aC as mapOAIFinishReason, a9 as matchesContextExceeded, aD as normalizeMcpBlocks, aE as normalizeMcpServers, aF as openai, aG as openaiCompat, aH as openrouter, aI as resultToString, aJ as toAnthropic, aK as toOpenAI, aL as toTypedError, aa as toolOutputByteLength, ab as toolResultToText } from './agent-C9q5VMGa.js';
1
+ import { d as AgentHooks } from './agent-BBzkPRAu.js';
2
+ export { ab as ActivationVia, ac as ActiveSkill, A as Agent, a as AgentAbortedError, b as AgentBehavior, c as AgentContextExceededError, e as AgentOptions, f as AgentProviderError, g as AgentRunOptions, h as AgentStats, i as AgentToolNotAllowedError, j as AnthropicParams, C as CONTEXT_EXCEEDED_MESSAGE_PATTERNS, k as CerebrasParams, m as ClassifiedError, n as ClassifiedErrorKind, o as CreateSessionOptions, ad as DeactivationReason, ae as FileMapAdapter, af as FileMapStoreOptions, M as McpConnection, p as McpServerConfig, q as McpToolHookContext, O as OAuthRefreshHookContext, ag as OpenAICompatAuthHeader, ah as OpenAICompatHttpError, ai as OpenAICompatParams, r as OpenAIParams, s as OpenRouterParams, P as PromptDocumentPart, t as PromptImagePart, u as PromptPart, v as PromptTextPart, w as Provider, x as ProviderCapabilities, R as RemoteStoreOptions, y as RunHookMap, S as Session, z as SessionContentBlock, B as SessionData, D as SessionEndStatus, E as SessionHookContext, F as SessionMessage, G as SessionRun, H as SessionStore, I as SessionTurn, aj as SkillActivationState, ak as SkillActivationStateOptions, J as SkillConfig, al as SkillDiagnostic, K as SkillResource, am as SkillSource, L as SkillsConfig, N as SpawnHookContext, Q as StreamCallbacks, T as StreamHookContext, U as StreamOptions, V as ThinkingLevel, W as ToolCall, X as ToolContext, Y as ToolDef, Z as ToolExecutionMode, _ as ToolHookContext, $ as ToolMap, a0 as ToolResult, a1 as ToolResultContent, a2 as ToolResultImageContent, a3 as ToolResultTextContent, a4 as ToolSpec, a5 as TurnFinishReason, a6 as TurnResult, a7 as TurnUsage, an as anthropic, ao as autoDetectAndConvert, ap as cerebras, aq as classifyOpenAICompatError, ar as connectMcpServers, as as createAgent, at as createFileMapStore, au as createMemoryStore, av as createRemoteStore, aw as createSession, ax as createSkillActivationState, ay as fromAnthropic, az as fromOpenAI, aA as loadSession, aB as mapOAIFinishReason, a8 as matchesContextExceeded, aC as normalizeMcpBlocks, aD as normalizeMcpServers, aE as openai, aF as openaiCompat, aG as openrouter, aH as resultToString, aI as toAnthropic, aJ as toOpenAI, aK as toTypedError, a9 as toolOutputByteLength, aa as toolResultToText } from './agent-BBzkPRAu.js';
3
3
  export { createDockerContext, createProcessContext } from './contexts.js';
4
4
  export { S as SandboxProvider, c as createSandboxContext } from './sandbox-CLghrTLi.js';
5
5
  export { C as ContextCapabilities, a as ContextType, E as ExecResult, b as ExecutionContext, c as ExecutionHandle, S as SpawnConfig } from './types-vA1a_ZX7.js';
6
6
  export { Preset, basic, basicTools, definePreset } from './presets.js';
7
7
  export { IMPLICITLY_ALLOWED_SKILL_TOOLS, SkillValidationIssue, SkillValidationResult, SourcedScanPath, buildCatalog, defineSkill, discoverSkills, installAllowedToolsGate, interpolateShellCommands, isToolAllowedByUnion, matchesAllowedTool, parseAllowedToolPattern, parseSkillFile, resolveSkills, validateResourcePath, validateSkillForWrite, validateSkillName, writeSkillToDisk, writeSkillsToDisk } from './skills.js';
8
- export { S as SkillsReadToolOptions, a as SkillsRunScriptToolOptions, b as SkillsUseToolOptions, c as createSkillsReadTool, d as createSkillsRunScriptTool, e as createSkillsUseTool, f as edit, g as glob, h as grep, m as multiEdit } from './skills-use-DU0unNP4.js';
9
- export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, V as ValidationResult, c as createInteractionTool, b as createSpawnTool, s as spawn, v as validateToolArgs } from './validation-BKA33eqb.js';
8
+ export { S as SkillsReadToolOptions, a as SkillsRunScriptToolOptions, b as SkillsUseToolOptions, c as createSkillsReadTool, d as createSkillsRunScriptTool, e as createSkillsUseTool, f as edit, g as glob, h as grep, m as multiEdit } from './skills-use-JMcA5NrF.js';
9
+ export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, V as ValidationResult, c as createInteractionTool, b as createSpawnTool, v as validateToolArgs } from './validation-c3MQlCza.js';
10
10
  import { Hookable } from 'hookable';
11
11
  import '@modelcontextprotocol/sdk/client/index.js';
12
12
 
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  defineSkill
3
- } from "./chunk-BW3WTFIR.js";
3
+ } from "./chunk-LIVB5W4B.js";
4
4
  import {
5
5
  anthropic,
6
6
  cerebras,
7
7
  openai,
8
8
  openrouter
9
- } from "./chunk-BRMURQA2.js";
9
+ } from "./chunk-VGFQEOHF.js";
10
10
  import {
11
11
  basicTools,
12
12
  basic_default,
13
13
  definePreset
14
- } from "./chunk-BXO7CZHJ.js";
14
+ } from "./chunk-3D5Q527Y.js";
15
15
  import {
16
16
  createAgent,
17
17
  createInteractionTool,
@@ -23,9 +23,8 @@ import {
23
23
  glob,
24
24
  grep,
25
25
  multiEdit,
26
- spawn,
27
26
  validateToolArgs
28
- } from "./chunk-2AE3VM5O.js";
27
+ } from "./chunk-Z2E5QN5X.js";
29
28
  import {
30
29
  IMPLICITLY_ALLOWED_SKILL_TOOLS,
31
30
  buildCatalog,
@@ -43,12 +42,12 @@ import {
43
42
  validateSkillName,
44
43
  writeSkillToDisk,
45
44
  writeSkillsToDisk
46
- } from "./chunk-TPXPVEH6.js";
45
+ } from "./chunk-X3VOTPVM.js";
47
46
  import {
48
47
  createDockerContext,
49
48
  createProcessContext,
50
49
  createSandboxContext
51
- } from "./chunk-IUBBVF53.js";
50
+ } from "./chunk-UD25QF3H.js";
52
51
  import {
53
52
  connectMcpServers,
54
53
  normalizeMcpBlocks,
@@ -76,7 +75,7 @@ import {
76
75
  openaiCompat,
77
76
  toAnthropic,
78
77
  toOpenAI
79
- } from "./chunk-YQ7LY6CL.js";
78
+ } from "./chunk-X244RS5H.js";
80
79
  import {
81
80
  AgentAbortedError,
82
81
  AgentContextExceededError,
@@ -255,7 +254,6 @@ export {
255
254
  parseSkillFile,
256
255
  resolveSkills,
257
256
  resultToString,
258
- spawn,
259
257
  toAnthropic,
260
258
  toOpenAI,
261
259
  toTypedError,
package/dist/mcp.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import 'hookable';
2
- export { M as McpConnection, p as McpServerConfig, as as connectMcpServers, aD as normalizeMcpBlocks, aE as normalizeMcpServers, aI as resultToString } from './agent-C9q5VMGa.js';
2
+ export { M as McpConnection, p as McpServerConfig, ar as connectMcpServers, aC as normalizeMcpBlocks, aD as normalizeMcpServers, aH as resultToString } from './agent-BBzkPRAu.js';
3
3
  import '@modelcontextprotocol/sdk/client/index.js';
4
4
  import './types-vA1a_ZX7.js';
package/dist/presets.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Z as ToolDef, e as AgentOptions } from './agent-C9q5VMGa.js';
1
+ import { Y as ToolDef, e as AgentOptions } from './agent-BBzkPRAu.js';
2
2
  import 'hookable';
3
3
  import './types-vA1a_ZX7.js';
4
4
  import '@modelcontextprotocol/sdk/client/index.js';
package/dist/presets.js CHANGED
@@ -2,10 +2,10 @@ import {
2
2
  basicTools,
3
3
  basic_default,
4
4
  definePreset
5
- } from "./chunk-BXO7CZHJ.js";
6
- import "./chunk-2AE3VM5O.js";
7
- import "./chunk-TPXPVEH6.js";
8
- import "./chunk-IUBBVF53.js";
5
+ } from "./chunk-3D5Q527Y.js";
6
+ import "./chunk-Z2E5QN5X.js";
7
+ import "./chunk-X3VOTPVM.js";
8
+ import "./chunk-UD25QF3H.js";
9
9
  import "./chunk-7H34OFDA.js";
10
10
  import "./chunk-JH6IAAFA.js";
11
11
  import "./chunk-LNN5UTS2.js";
@@ -1,4 +1,4 @@
1
- export { j as AnthropicParams, k as CerebrasParams, ah as OpenAICompatAuthHeader, ai as OpenAICompatHttpError, aj as OpenAICompatParams, r as OpenAIParams, s as OpenRouterParams, w as Provider, x as ProviderCapabilities, T as StreamCallbacks, V as StreamOptions, X as ToolCall, a1 as ToolResult, a5 as ToolSpec, a7 as TurnResult, ao as anthropic, aq as cerebras, ar as classifyOpenAICompatError, aC as mapOAIFinishReason, aF as openai, aG as openaiCompat, aH as openrouter } from './agent-C9q5VMGa.js';
1
+ export { j as AnthropicParams, k as CerebrasParams, ag as OpenAICompatAuthHeader, ah as OpenAICompatHttpError, ai as OpenAICompatParams, r as OpenAIParams, s as OpenRouterParams, w as Provider, x as ProviderCapabilities, Q as StreamCallbacks, U as StreamOptions, W as ToolCall, a0 as ToolResult, a4 as ToolSpec, a6 as TurnResult, an as anthropic, ap as cerebras, aq as classifyOpenAICompatError, aB as mapOAIFinishReason, aE as openai, aF as openaiCompat, aG as openrouter } from './agent-BBzkPRAu.js';
2
2
  import 'hookable';
3
3
  import './types-vA1a_ZX7.js';
4
4
  import '@modelcontextprotocol/sdk/client/index.js';
package/dist/providers.js CHANGED
@@ -3,13 +3,13 @@ import {
3
3
  cerebras,
4
4
  openai,
5
5
  openrouter
6
- } from "./chunk-BRMURQA2.js";
6
+ } from "./chunk-VGFQEOHF.js";
7
7
  import {
8
8
  OpenAICompatHttpError,
9
9
  classifyOpenAICompatError,
10
10
  mapOAIFinishReason,
11
11
  openaiCompat
12
- } from "./chunk-YQ7LY6CL.js";
12
+ } from "./chunk-X244RS5H.js";
13
13
  import "./chunk-LNN5UTS2.js";
14
14
  export {
15
15
  OpenAICompatHttpError,
@@ -1,4 +1,4 @@
1
- import { H as SessionStore } from '../agent-C9q5VMGa.js';
1
+ import { H as SessionStore } from '../agent-BBzkPRAu.js';
2
2
  import 'hookable';
3
3
  import '../types-vA1a_ZX7.js';
4
4
  import '@modelcontextprotocol/sdk/client/index.js';
@@ -24,7 +24,9 @@ function createSqliteStore(options) {
24
24
  `);
25
25
  const stmtDelete = db.prepare("DELETE FROM sessions WHERE id = ?");
26
26
  const stmtList = db.prepare("SELECT id FROM sessions ORDER BY updated_at DESC");
27
+ const stmtListLimited = db.prepare("SELECT id FROM sessions ORDER BY updated_at DESC LIMIT ?");
27
28
  const stmtListByAgent = db.prepare("SELECT id FROM sessions WHERE agent_id = ? ORDER BY updated_at DESC");
29
+ const stmtListByAgentLimited = db.prepare("SELECT id FROM sessions WHERE agent_id = ? ORDER BY updated_at DESC LIMIT ?");
28
30
  const store = {
29
31
  async load(sessionId) {
30
32
  const row = stmtLoad.get(sessionId);
@@ -45,17 +47,14 @@ function createSqliteStore(options) {
45
47
  stmtDelete.run(sessionId);
46
48
  },
47
49
  async list(filter) {
50
+ const limit = typeof filter?.limit === "number" && filter.limit > 0 ? filter.limit : void 0;
48
51
  let rows;
49
52
  if (filter?.agentId) {
50
- rows = stmtListByAgent.all(filter.agentId);
53
+ rows = limit ? stmtListByAgentLimited.all(filter.agentId, limit) : stmtListByAgent.all(filter.agentId);
51
54
  } else {
52
- rows = stmtList.all();
55
+ rows = limit ? stmtListLimited.all(limit) : stmtList.all();
53
56
  }
54
- const ids = rows.map((r) => r.id);
55
- if (filter?.limit) {
56
- return ids.slice(0, filter.limit);
57
- }
58
- return ids;
57
+ return rows.map((r) => r.id);
59
58
  },
60
59
  async appendTurns(sessionId, turns) {
61
60
  const data = await store.load(sessionId);
package/dist/session.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { o as CreateSessionOptions, af as FileMapAdapter, ag as FileMapStoreOptions, R as RemoteStoreOptions, S as Session, z as SessionContentBlock, B as SessionData, F as SessionMessage, G as SessionRun, H as SessionStore, J as SessionTurn, ap as autoDetectAndConvert, au as createFileMapStore, av as createMemoryStore, aw as createRemoteStore, ax as createSession, az as fromAnthropic, aA as fromOpenAI, aB as loadSession, aJ as toAnthropic, aK as toOpenAI } from './agent-C9q5VMGa.js';
1
+ export { o as CreateSessionOptions, ae as FileMapAdapter, af as FileMapStoreOptions, R as RemoteStoreOptions, S as Session, z as SessionContentBlock, B as SessionData, F as SessionMessage, G as SessionRun, H as SessionStore, I as SessionTurn, ao as autoDetectAndConvert, at as createFileMapStore, au as createMemoryStore, av as createRemoteStore, aw as createSession, ay as fromAnthropic, az as fromOpenAI, aA as loadSession, aI as toAnthropic, aJ as toOpenAI } from './agent-BBzkPRAu.js';
2
2
  import 'hookable';
3
3
  import './types-vA1a_ZX7.js';
4
4
  import '@modelcontextprotocol/sdk/client/index.js';
package/dist/session.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  fromOpenAI,
12
12
  toAnthropic,
13
13
  toOpenAI
14
- } from "./chunk-YQ7LY6CL.js";
14
+ } from "./chunk-X244RS5H.js";
15
15
  import "./chunk-LNN5UTS2.js";
16
16
  export {
17
17
  autoDetectAndConvert,
@@ -1,4 +1,4 @@
1
- import { Z as ToolDef, K as SkillConfig, ak as SkillActivationState, d as AgentHooks } from './agent-C9q5VMGa.js';
1
+ import { Y as ToolDef, J as SkillConfig, aj as SkillActivationState, d as AgentHooks } from './agent-BBzkPRAu.js';
2
2
  import { Hookable } from 'hookable';
3
3
 
4
4
  /**
package/dist/skills.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { d as AgentHooks, ak as SkillActivationState, K as SkillConfig, an as SkillSource, am as SkillDiagnostic, N as SkillsConfig } from './agent-C9q5VMGa.js';
2
- export { ac as ActivationVia, ad as ActiveSkill, ae as DeactivationReason, al as SkillActivationStateOptions, L as SkillResource, ay as createSkillActivationState } from './agent-C9q5VMGa.js';
1
+ import { d as AgentHooks, aj as SkillActivationState, J as SkillConfig, am as SkillSource, al as SkillDiagnostic, L as SkillsConfig } from './agent-BBzkPRAu.js';
2
+ export { ab as ActivationVia, ac as ActiveSkill, ad as DeactivationReason, ak as SkillActivationStateOptions, K as SkillResource, ax as createSkillActivationState } from './agent-BBzkPRAu.js';
3
3
  import { Hookable } from 'hookable';
4
4
  import { b as ExecutionContext, c as ExecutionHandle } from './types-vA1a_ZX7.js';
5
5
  import '@modelcontextprotocol/sdk/client/index.js';
@@ -66,99 +66,7 @@ interface BuildCatalogOptions {
66
66
  /**
67
67
  * Build the skill catalog XML and behavioral instructions for the system prompt.
68
68
  */
69
- declare function buildCatalog(skills: SkillConfig[], optionsOrReadToolName?: BuildCatalogOptions | string): string;
70
-
71
- /**
72
- * Strict validators for Agent Skills.
73
- *
74
- * Applied on the authoring path (`defineSkill`, `writeSkillToDisk`). Parser-time
75
- * validation is intentionally lenient — see `parseSkillFile` for diagnostic collection.
76
- */
77
-
78
- /**
79
- * A single issue surfaced by skill-authoring validation.
80
- * Distinct from `ValidationResult` in `tools/validation.ts` (tool-input JSON
81
- * schema validation) — different domain, different module.
82
- */
83
- interface SkillValidationIssue {
84
- /** Stable machine-readable code for consumer matching. */
85
- code: string;
86
- /** Human-readable description. */
87
- message: string;
88
- /** Frontmatter field name the issue relates to, when applicable. */
89
- field?: string;
90
- }
91
- interface SkillValidationResult {
92
- valid: boolean;
93
- errors: SkillValidationIssue[];
94
- }
95
- /**
96
- * Validate a skill name per the spec:
97
- * - 1–64 characters
98
- * - Lowercase alphanumeric + hyphens only
99
- * - Must not start or end with a hyphen
100
- * - Must not contain consecutive hyphens
101
- *
102
- * The parent-directory match is validated separately (it requires knowing the
103
- * skill's `location`, which this function does not).
104
- */
105
- declare function validateSkillName(name: string): boolean;
106
- /**
107
- * Strict validation for a skill that is about to be authored / written to disk.
108
- * Rejects anything that would violate the spec. Use the lenient parser path
109
- * (`parseSkillFile`) for loading third-party skills.
110
- */
111
- declare function validateSkillForWrite(skill: SkillConfig): SkillValidationResult;
112
- /**
113
- * Validate that `relPath` stays inside `baseDir` when resolved.
114
- *
115
- * Rejects:
116
- * - Absolute paths (`/etc/passwd`, `C:\…`)
117
- * - Parent traversal (`..` segments that escape baseDir)
118
- * - Null-byte tricks
119
- *
120
- * Returns `{ valid: true, absolutePath }` on success or `{ valid: false, error }`
121
- * with a human-readable reason.
122
- */
123
- declare function validateResourcePath(relPath: string, baseDir: string): {
124
- valid: true;
125
- absolutePath: string;
126
- } | {
127
- valid: false;
128
- error: string;
129
- };
130
- /**
131
- * Parse a single `allowed-tools` entry into its tool name + optional argument pattern.
132
- *
133
- * Examples:
134
- * - `Read` → `{ tool: 'Read' }`
135
- * - `Bash(git:*)` → `{ tool: 'Bash', argPrefix: 'git' }`
136
- */
137
- declare function parseAllowedToolPattern(entry: string): {
138
- tool: string;
139
- argPrefix?: string;
140
- } | null;
141
- /**
142
- * Check whether a tool call (identified by its wire/displayName and argument input)
143
- * matches a skill's allow-list entry.
144
- *
145
- * Matching rules (Zidane's interpretation of the spec's unspecified syntax):
146
- * - Exact match: displayName === pattern (no parens).
147
- * - Prefix match: for `Tool(arg:*)`, displayName === 'Tool' AND **any** string
148
- * value in the input object starts with `arg`. This is intentionally
149
- * permissive: it doesn't depend on a convention about which property carries
150
- * the "command" (schemas vary across tools), and for the common
151
- * `shell({ command: 'git …' })` shape it behaves identically to a "primary
152
- * string" rule.
153
- * - For tools whose inputs carry no string values, the arg-match returns false.
154
- */
155
- declare function matchesAllowedTool(displayName: string, input: Record<string, unknown>, pattern: string): boolean;
156
- /**
157
- * Test whether a tool call is allowed by the union of `allowedTools` across a set
158
- * of active skills. Returns `true` when the union is empty (permissive default)
159
- * OR when any entry matches.
160
- */
161
- declare function isToolAllowedByUnion(displayName: string, input: Record<string, unknown>, union: readonly string[]): boolean;
69
+ declare function buildCatalog(skills: SkillConfig[], options?: BuildCatalogOptions): string;
162
70
 
163
71
  /**
164
72
  * Skill discovery and parsing.
@@ -258,6 +166,19 @@ declare function interpolateShellCommands(instructions: string, execution: Execu
258
166
  * merges everything, and applies filtering.
259
167
  */
260
168
 
169
+ /**
170
+ * Resolved-skills bundle: the materialized list plus a `cleanup` fn that
171
+ * removes any temporary directory created for `config.write` skills.
172
+ *
173
+ * Inline skills must live on disk for the lifetime of the agent (the
174
+ * `skills_read` / `skills_run_script` tools resolve relative paths against
175
+ * `baseDir`), so cleanup is deferred to `agent.destroy()`. When no temp
176
+ * directory was created, `cleanup` is a no-op.
177
+ */
178
+ interface ResolvedSkillsBundle {
179
+ skills: SkillConfig[];
180
+ cleanup: () => void;
181
+ }
261
182
  /**
262
183
  * Resolve all skills from a SkillsConfig:
263
184
  *
@@ -265,8 +186,105 @@ declare function interpolateShellCommands(instructions: string, execution: Execu
265
186
  * 2. Combine with default + user-provided scan paths (project-first, user-next)
266
187
  * 3. Run lenient discovery
267
188
  * 4. Apply filters: `exclude`, `enabled` allowlist, optional project-skill trust gate
189
+ *
190
+ * Returns `{ skills, cleanup }` — call `cleanup()` on agent destroy to remove
191
+ * the temp directory created for inline `config.write` skills. The agent
192
+ * factory wires this automatically; standalone callers must invoke it
193
+ * themselves to avoid leaking OS temp.
194
+ */
195
+ declare function resolveSkills(config: SkillsConfig): Promise<ResolvedSkillsBundle>;
196
+
197
+ /**
198
+ * Strict validators for Agent Skills.
199
+ *
200
+ * Applied on the authoring path (`defineSkill`, `writeSkillToDisk`). Parser-time
201
+ * validation is intentionally lenient — see `parseSkillFile` for diagnostic collection.
202
+ */
203
+
204
+ /**
205
+ * A single issue surfaced by skill-authoring validation.
206
+ * Distinct from `ValidationResult` in `tools/validation.ts` (tool-input JSON
207
+ * schema validation) — different domain, different module.
208
+ */
209
+ interface SkillValidationIssue {
210
+ /** Stable machine-readable code for consumer matching. */
211
+ code: string;
212
+ /** Human-readable description. */
213
+ message: string;
214
+ /** Frontmatter field name the issue relates to, when applicable. */
215
+ field?: string;
216
+ }
217
+ interface SkillValidationResult {
218
+ valid: boolean;
219
+ errors: SkillValidationIssue[];
220
+ }
221
+ /**
222
+ * Validate a skill name per the spec:
223
+ * - 1–64 characters
224
+ * - Lowercase alphanumeric + hyphens only
225
+ * - Must not start or end with a hyphen
226
+ * - Must not contain consecutive hyphens
227
+ *
228
+ * The parent-directory match is validated separately (it requires knowing the
229
+ * skill's `location`, which this function does not).
230
+ */
231
+ declare function validateSkillName(name: string): boolean;
232
+ /**
233
+ * Strict validation for a skill that is about to be authored / written to disk.
234
+ * Rejects anything that would violate the spec. Use the lenient parser path
235
+ * (`parseSkillFile`) for loading third-party skills.
236
+ */
237
+ declare function validateSkillForWrite(skill: SkillConfig): SkillValidationResult;
238
+ /**
239
+ * Validate that `relPath` stays inside `baseDir` when resolved.
240
+ *
241
+ * Rejects:
242
+ * - Absolute paths (`/etc/passwd`, `C:\…`)
243
+ * - Parent traversal (`..` segments that escape baseDir)
244
+ * - Null-byte tricks
245
+ *
246
+ * Returns `{ valid: true, absolutePath }` on success or `{ valid: false, error }`
247
+ * with a human-readable reason.
248
+ */
249
+ declare function validateResourcePath(relPath: string, baseDir: string): {
250
+ valid: true;
251
+ absolutePath: string;
252
+ } | {
253
+ valid: false;
254
+ error: string;
255
+ };
256
+ /**
257
+ * Parse a single `allowed-tools` entry into its tool name + optional argument pattern.
258
+ *
259
+ * Examples:
260
+ * - `Read` → `{ tool: 'Read' }`
261
+ * - `Bash(git:*)` → `{ tool: 'Bash', argPrefix: 'git' }`
268
262
  */
269
- declare function resolveSkills(config: SkillsConfig): Promise<SkillConfig[]>;
263
+ declare function parseAllowedToolPattern(entry: string): {
264
+ tool: string;
265
+ argPrefix?: string;
266
+ } | null;
267
+ /**
268
+ * Check whether a tool call (identified by its wire/displayName and argument input)
269
+ * matches a skill's allow-list entry.
270
+ *
271
+ * Matching rules (Zidane's interpretation of the spec's unspecified syntax):
272
+ * - Exact match: displayName === pattern (no parens).
273
+ * - Prefix match: for `Tool(arg:*)`, displayName === 'Tool' AND **any** string
274
+ * value in the input object starts with `arg`. This is intentionally
275
+ * permissive: it doesn't depend on a convention about which property carries
276
+ * the "command" (schemas vary across tools), and for the common
277
+ * `shell({ command: 'git …' })` shape it behaves identically to a "primary
278
+ * string" rule.
279
+ * - For tools whose inputs carry no string values, the arg-match returns false.
280
+ */
281
+ declare function matchesAllowedTool(displayName: string, input: Record<string, unknown>, pattern: string): boolean;
282
+ /**
283
+ * Test whether a tool call is allowed by the union of `allowedTools` across a set
284
+ * of active skills. Returns `true` when the union is empty (permissive default)
285
+ * OR when any entry matches.
286
+ */
287
+ declare function isToolAllowedByUnion(displayName: string, input: Record<string, unknown>, union: readonly string[]): boolean;
270
288
 
271
289
  /**
272
290
  * Skill writer — materializes inline SkillConfig objects to disk as proper
package/dist/skills.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  defineSkill
3
- } from "./chunk-BW3WTFIR.js";
3
+ } from "./chunk-LIVB5W4B.js";
4
4
  import {
5
5
  IMPLICITLY_ALLOWED_SKILL_TOOLS,
6
6
  buildCatalog,
@@ -21,7 +21,7 @@ import {
21
21
  validateSkillName,
22
22
  writeSkillToDisk,
23
23
  writeSkillsToDisk
24
- } from "./chunk-TPXPVEH6.js";
24
+ } from "./chunk-X3VOTPVM.js";
25
25
  import "./chunk-LNN5UTS2.js";
26
26
  export {
27
27
  IMPLICITLY_ALLOWED_SKILL_TOOLS,
package/dist/tools.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { S as SkillsReadToolOptions, a as SkillsRunScriptToolOptions, b as SkillsUseToolOptions, c as createSkillsReadTool, d as createSkillsRunScriptTool, e as createSkillsUseTool, f as edit, g as glob, h as grep, m as multiEdit } from './skills-use-DU0unNP4.js';
2
- export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, V as ValidationResult, c as createInteractionTool, b as createSpawnTool, s as spawn, v as validateToolArgs } from './validation-BKA33eqb.js';
3
- import { Z as ToolDef } from './agent-C9q5VMGa.js';
4
- export { Y as ToolContext, a0 as ToolMap } from './agent-C9q5VMGa.js';
1
+ export { S as SkillsReadToolOptions, a as SkillsRunScriptToolOptions, b as SkillsUseToolOptions, c as createSkillsReadTool, d as createSkillsRunScriptTool, e as createSkillsUseTool, f as edit, g as glob, h as grep, m as multiEdit } from './skills-use-JMcA5NrF.js';
2
+ export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, V as ValidationResult, c as createInteractionTool, b as createSpawnTool, v as validateToolArgs } from './validation-c3MQlCza.js';
3
+ import { Y as ToolDef } from './agent-BBzkPRAu.js';
4
+ export { X as ToolContext, $ as ToolMap } from './agent-BBzkPRAu.js';
5
5
  import 'hookable';
6
6
  import './presets.js';
7
7
  import './types-vA1a_ZX7.js';
package/dist/tools.js CHANGED
@@ -11,12 +11,11 @@ import {
11
11
  multiEdit,
12
12
  readFile,
13
13
  shell,
14
- spawn,
15
14
  validateToolArgs,
16
15
  writeFile
17
- } from "./chunk-2AE3VM5O.js";
18
- import "./chunk-TPXPVEH6.js";
19
- import "./chunk-IUBBVF53.js";
16
+ } from "./chunk-Z2E5QN5X.js";
17
+ import "./chunk-X3VOTPVM.js";
18
+ import "./chunk-UD25QF3H.js";
20
19
  import "./chunk-7H34OFDA.js";
21
20
  import "./chunk-JH6IAAFA.js";
22
21
  import "./chunk-LNN5UTS2.js";
@@ -33,7 +32,6 @@ export {
33
32
  multiEdit,
34
33
  readFile,
35
34
  shell,
36
- spawn,
37
35
  validateToolArgs,
38
36
  writeFile
39
37
  };
package/dist/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { A as Agent, a as AgentAbortedError, b as AgentBehavior, c as AgentContextExceededError, d as AgentHooks, e as AgentOptions, f as AgentProviderError, g as AgentRunOptions, h as AgentStats, i as AgentToolNotAllowedError, j as AnthropicParams, C as CONTEXT_EXCEEDED_MESSAGE_PATTERNS, k as CerebrasParams, l as ChildRunStats, m as ClassifiedError, n as ClassifiedErrorKind, o as CreateSessionOptions, I as ImageContent, M as McpConnection, p as McpServerConfig, q as McpToolHookContext, O as OAuthRefreshHookContext, r as OpenAIParams, s as OpenRouterParams, P as PromptDocumentPart, t as PromptImagePart, u as PromptPart, v as PromptTextPart, w as Provider, x as ProviderCapabilities, R as RemoteStoreOptions, y as RunHookMap, S as Session, z as SessionContentBlock, B as SessionData, D as SessionEndStatus, E as SessionHookContext, F as SessionMessage, G as SessionRun, H as SessionStore, J as SessionTurn, K as SkillConfig, L as SkillResource, N as SkillsConfig, Q as SpawnHookContext, T as StreamCallbacks, U as StreamHookContext, V as StreamOptions, W as ThinkingLevel, X as ToolCall, Y as ToolContext, Z as ToolDef, _ as ToolExecutionMode, $ as ToolHookContext, a0 as ToolMap, a1 as ToolResult, a2 as ToolResultContent, a3 as ToolResultImageContent, a4 as ToolResultTextContent, a5 as ToolSpec, a6 as TurnFinishReason, a7 as TurnResult, a8 as TurnUsage, a9 as matchesContextExceeded, aa as toolOutputByteLength, ab as toolResultToText } from './agent-C9q5VMGa.js';
1
+ export { A as Agent, a as AgentAbortedError, b as AgentBehavior, c as AgentContextExceededError, d as AgentHooks, e as AgentOptions, f as AgentProviderError, g as AgentRunOptions, h as AgentStats, i as AgentToolNotAllowedError, j as AnthropicParams, C as CONTEXT_EXCEEDED_MESSAGE_PATTERNS, k as CerebrasParams, l as ChildRunStats, m as ClassifiedError, n as ClassifiedErrorKind, o as CreateSessionOptions, M as McpConnection, p as McpServerConfig, q as McpToolHookContext, O as OAuthRefreshHookContext, r as OpenAIParams, s as OpenRouterParams, P as PromptDocumentPart, t as PromptImagePart, u as PromptPart, v as PromptTextPart, w as Provider, x as ProviderCapabilities, R as RemoteStoreOptions, y as RunHookMap, S as Session, z as SessionContentBlock, B as SessionData, D as SessionEndStatus, E as SessionHookContext, F as SessionMessage, G as SessionRun, H as SessionStore, I as SessionTurn, J as SkillConfig, K as SkillResource, L as SkillsConfig, N as SpawnHookContext, Q as StreamCallbacks, T as StreamHookContext, U as StreamOptions, V as ThinkingLevel, W as ToolCall, X as ToolContext, Y as ToolDef, Z as ToolExecutionMode, _ as ToolHookContext, $ as ToolMap, a0 as ToolResult, a1 as ToolResultContent, a2 as ToolResultImageContent, a3 as ToolResultTextContent, a4 as ToolSpec, a5 as TurnFinishReason, a6 as TurnResult, a7 as TurnUsage, a8 as matchesContextExceeded, a9 as toolOutputByteLength, aa as toolResultToText } from './agent-BBzkPRAu.js';
2
2
  export { C as ContextCapabilities, a as ContextType, E as ExecResult, b as ExecutionContext, c as ExecutionHandle, S as SpawnConfig } from './types-vA1a_ZX7.js';
3
3
  export { S as SandboxProvider } from './sandbox-CLghrTLi.js';
4
4
  export { Preset } from './presets.js';
5
- export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, V as ValidationResult } from './validation-BKA33eqb.js';
5
+ export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, V as ValidationResult } from './validation-c3MQlCza.js';
6
6
  import 'hookable';
7
7
  import '@modelcontextprotocol/sdk/client/index.js';
@@ -1,4 +1,4 @@
1
- import { Y as ToolContext, Z as ToolDef, h as AgentStats, l as ChildRunStats } from './agent-C9q5VMGa.js';
1
+ import { X as ToolContext, Y as ToolDef, h as AgentStats, l as ChildRunStats } from './agent-BBzkPRAu.js';
2
2
  import { Preset } from './presets.js';
3
3
 
4
4
  /**
@@ -43,18 +43,21 @@ declare function createInteractionTool(options: InteractionToolOptions): ToolDef
43
43
  *
44
44
  * A configurable factory that reads the parent's preset-y fields from ToolContext.
45
45
  *
46
- * Usage — default (stateless, safe across parent agents):
46
+ * Usage:
47
47
  * ```ts
48
- * import { spawn } from 'zidane'
48
+ * import { createSpawnTool } from 'zidane'
49
49
  * import { definePreset, basicTools } from 'zidane/presets'
50
- * const preset = definePreset({ name: 'orchestrator', tools: { ...basicTools, spawn } })
51
- * ```
52
50
  *
53
- * Usage with shared state (telemetry, lifecycle callbacks):
54
- * ```ts
55
- * const tool = createSpawnTool({ maxConcurrent: 5, onComplete })
51
+ * const preset = definePreset({
52
+ * name: 'orchestrator',
53
+ * tools: { ...basicTools, spawn: createSpawnTool({ maxConcurrent: 5 }) },
54
+ * })
56
55
  * ```
57
56
  *
57
+ * Each `createSpawnTool()` call returns a fresh instance with its own
58
+ * concurrency counter, depth cap, and child-stats accumulator — never
59
+ * share an instance across unrelated parent agents.
60
+ *
58
61
  * Key guarantees:
59
62
  * - **Depth-capped** to `maxDepth` (default 3) to prevent infinite recursion.
60
63
  * - **Concurrency slot is reserved synchronously** before any `await`, so a
@@ -135,19 +138,6 @@ interface SpawnToolOptions {
135
138
  * agent (or use the stateless default `spawn`) to keep them isolated.
136
139
  */
137
140
  declare function createSpawnTool(options?: SpawnToolOptions): ToolDef & SpawnToolState;
138
- /**
139
- * Default spawn tool.
140
- *
141
- * Historically this was a module-scoped `createSpawnTool()` instance shared
142
- * across every agent using `basic` — which meant `maxConcurrent`, `children`,
143
- * and `totalChildStats` leaked between unrelated runs. The shared-state
144
- * surface is preserved for backward compat: the spec + execute still work
145
- * standalone.
146
- *
147
- * Prefer calling `createSpawnTool()` explicitly when you care about
148
- * telemetry isolation between agents.
149
- */
150
- declare const spawn: ToolDef & SpawnToolState;
151
141
 
152
142
  /**
153
143
  * Tool argument validation against JSON Schema-style inputSchema.
@@ -182,4 +172,4 @@ interface ValidationResult {
182
172
  }
183
173
  declare function validateToolArgs(input: Record<string, unknown>, schema: Record<string, unknown>): ValidationResult;
184
174
 
185
- export { type ChildAgent as C, type InteractionToolOptions as I, type SpawnToolOptions as S, type ValidationResult as V, type SpawnToolState as a, createSpawnTool as b, createInteractionTool as c, spawn as s, validateToolArgs as v };
175
+ export { type ChildAgent as C, type InteractionToolOptions as I, type SpawnToolOptions as S, type ValidationResult as V, type SpawnToolState as a, createSpawnTool as b, createInteractionTool as c, validateToolArgs as v };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zidane",
3
- "version": "3.1.2",
3
+ "version": "3.3.0",
4
4
  "description": "an agent that goes straight to the goal",
5
5
  "type": "module",
6
6
  "private": false,