zidane 1.8.1 → 2.0.1

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/index.js CHANGED
@@ -1,34 +1,48 @@
1
1
  import {
2
2
  defineSkill
3
- } from "./chunk-CFLC2I7D.js";
3
+ } from "./chunk-LVC7NQUZ.js";
4
+ import {
5
+ toolResultToText
6
+ } from "./chunk-MYWDHD7C.js";
4
7
  import {
5
8
  anthropic,
6
9
  cerebras,
7
10
  openai,
8
11
  openrouter
9
- } from "./chunk-3S377TS4.js";
12
+ } from "./chunk-FRNFVKWW.js";
10
13
  import {
11
14
  defineHarness,
12
15
  noTools
13
- } from "./chunk-3RJOWJOJ.js";
16
+ } from "./chunk-OVQ4N64O.js";
14
17
  import {
15
18
  createAgent,
16
19
  createInteractionTool,
20
+ createSkillsReadTool,
21
+ createSkillsRunScriptTool,
22
+ createSkillsUseTool,
17
23
  createSpawnTool,
18
24
  glob,
19
25
  spawn
20
- } from "./chunk-4N5ADW7A.js";
26
+ } from "./chunk-PASFWG7S.js";
21
27
  import {
28
+ IMPLICITLY_ALLOWED_SKILL_TOOLS,
22
29
  buildCatalog,
30
+ createSkillActivationState,
23
31
  discoverSkills,
32
+ installAllowedToolsGate,
24
33
  interpolateShellCommands,
34
+ isToolAllowedByUnion,
35
+ matchesAllowedTool,
25
36
  mergeSkillsConfig,
37
+ parseAllowedToolPattern,
26
38
  parseSkillFile,
27
39
  resolveSkills,
40
+ validateResourcePath,
41
+ validateSkillForWrite,
28
42
  validateSkillName,
29
43
  writeSkillToDisk,
30
44
  writeSkillsToDisk
31
- } from "./chunk-4C6Y56CC.js";
45
+ } from "./chunk-BCXXXJ3G.js";
32
46
  import {
33
47
  createDockerContext,
34
48
  createProcessContext,
@@ -36,8 +50,10 @@ import {
36
50
  } from "./chunk-SZA4FKW5.js";
37
51
  import {
38
52
  connectMcpServers,
39
- normalizeMcpServers
40
- } from "./chunk-TBC6MSVK.js";
53
+ normalizeMcpBlocks,
54
+ normalizeMcpServers,
55
+ resultToString
56
+ } from "./chunk-PJUUYBKF.js";
41
57
  import {
42
58
  createFileMapStore,
43
59
  createMemoryStore,
@@ -55,15 +71,16 @@ import {
55
71
  openaiCompat,
56
72
  toAnthropic,
57
73
  toOpenAI
58
- } from "./chunk-EC7IRWVS.js";
74
+ } from "./chunk-LN4LLLHA.js";
59
75
  import {
60
76
  AgentAbortedError,
61
77
  AgentContextExceededError,
62
78
  AgentProviderError,
79
+ AgentToolNotAllowedError,
63
80
  CONTEXT_EXCEEDED_MESSAGE_PATTERNS,
64
81
  matchesContextExceeded,
65
82
  toTypedError
66
- } from "./chunk-FFFDQHMA.js";
83
+ } from "./chunk-7JTBBZ2U.js";
67
84
 
68
85
  // src/tracing.ts
69
86
  function createTracingHooks(options) {
@@ -181,7 +198,9 @@ export {
181
198
  AgentAbortedError,
182
199
  AgentContextExceededError,
183
200
  AgentProviderError,
201
+ AgentToolNotAllowedError,
184
202
  CONTEXT_EXCEEDED_MESSAGE_PATTERNS,
203
+ IMPLICITLY_ALLOWED_SKILL_TOOLS,
185
204
  OpenAICompatHttpError,
186
205
  anthropic,
187
206
  autoDetectAndConvert,
@@ -198,6 +217,10 @@ export {
198
217
  createRemoteStore,
199
218
  createSandboxContext,
200
219
  createSession,
220
+ createSkillActivationState,
221
+ createSkillsReadTool,
222
+ createSkillsRunScriptTool,
223
+ createSkillsUseTool,
201
224
  createSpawnTool,
202
225
  createTracingHooks,
203
226
  defineHarness,
@@ -206,22 +229,31 @@ export {
206
229
  fromAnthropic,
207
230
  fromOpenAI,
208
231
  glob,
232
+ installAllowedToolsGate,
209
233
  interpolateShellCommands,
234
+ isToolAllowedByUnion,
210
235
  loadSession,
211
236
  mapOAIFinishReason,
237
+ matchesAllowedTool,
212
238
  matchesContextExceeded,
213
239
  mergeSkillsConfig,
214
240
  noTools,
241
+ normalizeMcpBlocks,
215
242
  normalizeMcpServers,
216
243
  openai,
217
244
  openaiCompat,
218
245
  openrouter,
246
+ parseAllowedToolPattern,
219
247
  parseSkillFile,
220
248
  resolveSkills,
249
+ resultToString,
221
250
  spawn,
222
251
  toAnthropic,
223
252
  toOpenAI,
224
253
  toTypedError,
254
+ toolResultToText,
255
+ validateResourcePath,
256
+ validateSkillForWrite,
225
257
  validateSkillName,
226
258
  writeSkillToDisk,
227
259
  writeSkillsToDisk,
package/dist/mcp.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import 'hookable';
2
- export { M as McpConnection, p as McpServerConfig, ad as connectMcpServers, ap as normalizeMcpServers, ay as resultToString } from './agent-8QBOx4_0.js';
2
+ export { M as McpConnection, q as McpServerConfig, at as connectMcpServers, aG as normalizeMcpBlocks, aH as normalizeMcpServers, aL as resultToString } from './agent-D-ZFMbSd.js';
3
3
  import '@modelcontextprotocol/sdk/client/index.js';
4
4
  import './types-BpvTmawk.js';
5
- import './types-CDI8Kmve.js';
package/dist/mcp.js CHANGED
@@ -1,10 +1,12 @@
1
1
  import {
2
2
  connectMcpServers,
3
+ normalizeMcpBlocks,
3
4
  normalizeMcpServers,
4
5
  resultToString
5
- } from "./chunk-TBC6MSVK.js";
6
+ } from "./chunk-PJUUYBKF.js";
6
7
  export {
7
8
  connectMcpServers,
9
+ normalizeMcpBlocks,
8
10
  normalizeMcpServers,
9
11
  resultToString
10
12
  };
@@ -1,5 +1,4 @@
1
- export { i as AnthropicParams, j as CerebrasParams, a6 as OpenAICompatAuthHeader, a7 as OpenAICompatHttpError, a8 as OpenAICompatParams, r as OpenAIParams, s as OpenRouterParams, w as Provider, L as StreamCallbacks, Q as StreamOptions, U as ToolCall, _ as ToolResult, $ as ToolSpec, a1 as TurnResult, a9 as anthropic, ab as cerebras, ac as classifyOpenAICompatError, an as mapOAIFinishReason, aq as openai, ar as openaiCompat, as as openrouter } from './agent-8QBOx4_0.js';
1
+ export { j as AnthropicParams, k as CerebrasParams, ai as OpenAICompatAuthHeader, aj as OpenAICompatHttpError, ak as OpenAICompatParams, s as OpenAIParams, t as OpenRouterParams, x as Provider, y as ProviderCapabilities, V as StreamCallbacks, X as StreamOptions, Z as ToolCall, a3 as ToolResult, a7 as ToolSpec, a9 as TurnResult, ap as anthropic, ar as cerebras, as as classifyOpenAICompatError, aE as mapOAIFinishReason, aI as openai, aJ as openaiCompat, aK as openrouter } from './agent-D-ZFMbSd.js';
2
2
  import 'hookable';
3
3
  import './types-BpvTmawk.js';
4
4
  import '@modelcontextprotocol/sdk/client/index.js';
5
- import './types-CDI8Kmve.js';
package/dist/providers.js CHANGED
@@ -3,14 +3,14 @@ import {
3
3
  cerebras,
4
4
  openai,
5
5
  openrouter
6
- } from "./chunk-3S377TS4.js";
6
+ } from "./chunk-FRNFVKWW.js";
7
7
  import {
8
8
  OpenAICompatHttpError,
9
9
  classifyOpenAICompatError,
10
10
  mapOAIFinishReason,
11
11
  openaiCompat
12
- } from "./chunk-EC7IRWVS.js";
13
- import "./chunk-FFFDQHMA.js";
12
+ } from "./chunk-LN4LLLHA.js";
13
+ import "./chunk-7JTBBZ2U.js";
14
14
  export {
15
15
  OpenAICompatHttpError,
16
16
  anthropic,
@@ -1,8 +1,7 @@
1
- import { G as SessionStore } from '../agent-8QBOx4_0.js';
1
+ import { K as SessionStore } from '../agent-D-ZFMbSd.js';
2
2
  import 'hookable';
3
3
  import '../types-BpvTmawk.js';
4
4
  import '@modelcontextprotocol/sdk/client/index.js';
5
- import '../types-CDI8Kmve.js';
6
5
 
7
6
  /**
8
7
  * SQLite session store using Bun's built-in bun:sqlite.
package/dist/session.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- export { n as CreateSessionOptions, a4 as FileMapAdapter, a5 as FileMapStoreOptions, R as RemoteStoreOptions, S as Session, y as SessionContentBlock, z as SessionData, E as SessionMessage, F as SessionRun, G as SessionStore, J as SessionTurn, aa as autoDetectAndConvert, af as createFileMapStore, ag as createMemoryStore, ah as createRemoteStore, ai as createSession, ak as fromAnthropic, al as fromOpenAI, am as loadSession, at as toAnthropic, au as toOpenAI } from './agent-8QBOx4_0.js';
1
+ export { o as CreateSessionOptions, ag as FileMapAdapter, ah as FileMapStoreOptions, R as RemoteStoreOptions, S as Session, B as SessionContentBlock, D as SessionData, G as SessionMessage, J as SessionRun, K as SessionStore, L as SessionTurn, aq as autoDetectAndConvert, av as createFileMapStore, aw as createMemoryStore, ax as createRemoteStore, ay as createSession, aB as fromAnthropic, aC as fromOpenAI, aD as loadSession, aM as toAnthropic, aN as toOpenAI } from './agent-D-ZFMbSd.js';
2
2
  import 'hookable';
3
3
  import './types-BpvTmawk.js';
4
4
  import '@modelcontextprotocol/sdk/client/index.js';
5
- import './types-CDI8Kmve.js';
package/dist/session.js CHANGED
@@ -11,8 +11,8 @@ import {
11
11
  fromOpenAI,
12
12
  toAnthropic,
13
13
  toOpenAI
14
- } from "./chunk-EC7IRWVS.js";
15
- import "./chunk-FFFDQHMA.js";
14
+ } from "./chunk-LN4LLLHA.js";
15
+ import "./chunk-7JTBBZ2U.js";
16
16
  export {
17
17
  autoDetectAndConvert,
18
18
  createFileMapStore,
@@ -0,0 +1,66 @@
1
+ import { $ as ToolDef, N as SkillConfig, al as SkillActivationState, d as AgentHooks } from './agent-D-ZFMbSd.js';
2
+ import { Hookable } from 'hookable';
3
+
4
+ declare const glob: ToolDef;
5
+
6
+ /**
7
+ * `skills_read` tool — reads a bundled resource file from an active skill.
8
+ *
9
+ * Requires the skill to be active (model must have called `skills_use` first).
10
+ * Paths are validated against the skill's `baseDir` to prevent directory
11
+ * traversal. File I/O goes through `ctx.execution.readFile` so docker/sandbox
12
+ * execution contexts work identically to in-process.
13
+ */
14
+
15
+ interface SkillsReadToolOptions {
16
+ catalog: readonly SkillConfig[];
17
+ state: SkillActivationState;
18
+ }
19
+ declare function createSkillsReadTool(options: SkillsReadToolOptions): ToolDef;
20
+
21
+ /**
22
+ * `skills_run_script` tool — executes a script from an active skill's
23
+ * `scripts/` directory via the agent's execution context.
24
+ *
25
+ * Path is validated against the skill's `baseDir` and constrained to the
26
+ * `scripts/` subdirectory. Timeout is configurable via
27
+ * `SkillsConfig.scriptTimeoutMs` (default 60 s).
28
+ */
29
+
30
+ interface SkillsRunScriptToolOptions {
31
+ catalog: readonly SkillConfig[];
32
+ state: SkillActivationState;
33
+ /** Script timeout in milliseconds. Default 60000. */
34
+ scriptTimeoutMs?: number;
35
+ }
36
+ declare function createSkillsRunScriptTool(options: SkillsRunScriptToolOptions): ToolDef;
37
+
38
+ /**
39
+ * `skills_use` tool — activates a skill and returns its full instructions.
40
+ *
41
+ * Implements tier 2 of progressive disclosure per the Agent Skills spec.
42
+ * Body is frontmatter-stripped (the model gets the markdown only, wrapped in
43
+ * `<skill_content>` tags so the harness can identify it during context
44
+ * management). Shell-interpolation (`!` `` `cmd` ``) runs per-activation rather
45
+ * than once per agent, so values like `gh pr diff` reflect the current state.
46
+ */
47
+
48
+ interface SkillsUseToolOptions {
49
+ /** Resolved skills catalog for this run. */
50
+ catalog: readonly SkillConfig[];
51
+ /** Per-agent activation state the tool mutates. */
52
+ state: SkillActivationState;
53
+ /** Agent hooks — used to fire `skills:activate` on first activation. */
54
+ hooks: Hookable<AgentHooks>;
55
+ }
56
+ /**
57
+ * Factory for `skills_use`. Auto-injected into the agent's tool set by the
58
+ * agent runtime when a non-empty skills catalog is available (unless
59
+ * `SkillsConfig.tool === false`).
60
+ *
61
+ * The tool schema's `name` property is `enum`-constrained to the resolved
62
+ * catalog so the LLM cannot hallucinate a skill that doesn't exist.
63
+ */
64
+ declare function createSkillsUseTool(options: SkillsUseToolOptions): ToolDef;
65
+
66
+ export { type SkillsReadToolOptions as S, type SkillsRunScriptToolOptions as a, type SkillsUseToolOptions as b, createSkillsReadTool as c, createSkillsRunScriptTool as d, createSkillsUseTool as e, glob as g };
package/dist/skills.d.ts CHANGED
@@ -1,55 +1,231 @@
1
- import { S as SkillConfig, b as SkillsConfig } from './types-CDI8Kmve.js';
2
- export { a as SkillResource } from './types-CDI8Kmve.js';
1
+ import { d as AgentHooks, al as SkillActivationState, N as SkillConfig, ao as SkillSource, an as SkillDiagnostic, T as SkillsConfig } from './agent-D-ZFMbSd.js';
2
+ export { ad as ActivationVia, ae as ActiveSkill, af as DeactivationReason, am as SkillActivationStateOptions, Q as SkillResource, az as createSkillActivationState } from './agent-D-ZFMbSd.js';
3
+ import { Hookable } from 'hookable';
3
4
  import { b as ExecutionContext, c as ExecutionHandle } from './types-BpvTmawk.js';
5
+ import '@modelcontextprotocol/sdk/client/index.js';
6
+
7
+ /**
8
+ * `allowed-tools` enforcement middleware.
9
+ *
10
+ * Installed by the agent on `tool:gate` and `mcp:tool:gate`. Computes the
11
+ * union of `allowedTools` patterns across currently-active skills; blocks any
12
+ * tool call whose `displayName` is not in that union. The three injected
13
+ * skills tools (`skills_use` / `skills_read` / `skills_run_script`) are
14
+ * implicitly allowed so a skill declaring an allow-list cannot lock out the
15
+ * scaffolding that lets it run at all.
16
+ *
17
+ * The match target is `displayName` (wire / LLM-facing name), not the
18
+ * canonical name, because skill authors write allow-list entries to match
19
+ * what the model sees.
20
+ */
21
+
22
+ /** Tools that are always allowed regardless of the active skills' allow-list. */
23
+ declare const IMPLICITLY_ALLOWED_SKILL_TOOLS: readonly string[];
24
+ /**
25
+ * Register `tool:gate` / `mcp:tool:gate` handlers that enforce the union of
26
+ * `allowedTools` across active skills.
27
+ *
28
+ * No-op when no active skill declares an allow-list (permissive default —
29
+ * matches the spec's "experimental" note for `allowed-tools`).
30
+ *
31
+ * Returns an `uninstall` fn. The agent calls this at run end to detach the
32
+ * handlers and prevent cross-run hook leaks.
33
+ */
34
+ declare function installAllowedToolsGate(hooks: Hookable<AgentHooks>, state: SkillActivationState): () => void;
4
35
 
5
36
  /**
6
37
  * Skill catalog generation.
7
38
  *
8
- * Builds the system prompt section that discloses available skills
9
- * to the agent, following progressive disclosure (tier 1: name + description only).
39
+ * Builds the system prompt section that discloses available skills to the
40
+ * agent tier 1 of progressive disclosure per the Agent Skills spec.
41
+ *
42
+ * The catalog's behavioral prose branches on which activation mechanism is
43
+ * active for the run:
44
+ *
45
+ * - When the `skills_use` tool is auto-injected (the default for a non-empty
46
+ * catalog), the prose tells the model to call `skills_use` with the skill's
47
+ * name. The agent returns a structured `<skill_content>` block.
48
+ * - When the skills tool is opted out (`SkillsConfig.tool: false`), the prose
49
+ * falls back to the file-read pattern — the model reads `SKILL.md` itself
50
+ * via its file-read tool.
10
51
  */
11
52
 
53
+ interface BuildCatalogOptions {
54
+ /**
55
+ * When true (the default), the prose instructs the model to call
56
+ * `skills_use`. Set to false when `SkillsConfig.tool === false` so the
57
+ * system prompt matches the active activation mechanism.
58
+ */
59
+ skillsToolRegistered?: boolean;
60
+ /**
61
+ * Name of the tool the model should use to read `SKILL.md` files when
62
+ * `skillsToolRegistered` is false. Defaults to `'read_file'`.
63
+ */
64
+ readToolName?: string;
65
+ }
12
66
  /**
13
67
  * Build the skill catalog XML and behavioral instructions for the system prompt.
68
+ */
69
+ declare function buildCatalog(skills: SkillConfig[], optionsOrReadToolName?: BuildCatalogOptions | string): string;
70
+
71
+ /**
72
+ * Strict validators for Agent Skills.
14
73
  *
15
- * @param skills - Resolved skills to include (already filtered for excluded)
16
- * @param readToolName - Tool name the agent should use to read skill files (default: 'read_file')
74
+ * Applied on the authoring path (`defineSkill`, `writeSkillToDisk`). Parser-time
75
+ * validation is intentionally lenient see `parseSkillFile` for diagnostic collection.
17
76
  */
18
- declare function buildCatalog(skills: SkillConfig[], readToolName?: string): string;
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;
19
162
 
20
163
  /**
21
164
  * Skill discovery and parsing.
22
165
  *
23
166
  * Scans filesystem directories for SKILL.md files following the
24
167
  * Agent Skills specification (agentskills.io/specification).
168
+ *
169
+ * Parsing is intentionally **lenient** — per the spec's client-implementation
170
+ * guide: warn, don't block. Diagnostics are attached to the returned
171
+ * SkillConfig for host UIs to surface; only unrecoverable errors (missing
172
+ * description, unparseable YAML) skip the skill entirely.
25
173
  */
26
174
 
27
- /**
28
- * Validate a skill name per the Agent Skills spec:
29
- * 1-64 chars, lowercase alphanumeric + hyphens, no leading/trailing/consecutive hyphens.
30
- */
31
- declare function validateSkillName(name: string): boolean;
32
175
  interface ParsedSkillFile {
33
176
  frontmatter: Record<string, unknown>;
34
177
  body: string;
178
+ diagnostics: SkillDiagnostic[];
35
179
  }
36
180
  /**
37
181
  * Parse a SKILL.md file into frontmatter + body.
38
- * Uses simple regex-based extraction (no external YAML lib needed for simple cases).
182
+ *
183
+ * Uses a simple regex-based YAML extractor that handles:
184
+ * - Flat key: value pairs
185
+ * - Quoted values
186
+ * - One-level nested maps (for `metadata:`)
187
+ * - Lenient recovery from unquoted-colon values (e.g.
188
+ * `description: Use when: the user asks …`) via a quote-wrap retry.
39
189
  */
40
190
  declare function parseFrontmatter(content: string): ParsedSkillFile;
191
+ interface ParseSkillOptions {
192
+ /** Source tag to attach to the returned SkillConfig. */
193
+ source?: SkillSource;
194
+ }
41
195
  /**
42
- * Parse a SKILL.md file into a SkillConfig.
43
- * Returns null if the file is invalid (missing description).
196
+ * Parse a SKILL.md file into a SkillConfig (lenient).
197
+ *
198
+ * Returns `null` only when the skill is fundamentally unusable:
199
+ * - The file is missing
200
+ * - The description is absent (required by spec for disclosure)
201
+ *
202
+ * All other issues are surfaced as `SkillConfig.diagnostics` with severity
203
+ * `warning`. Deprecated top-level fields (`paths`, `model`, `thinking`) are
204
+ * auto-migrated into `metadata['zidane.*']`.
44
205
  */
45
- declare function parseSkillFile(filePath: string): Promise<SkillConfig | null>;
46
- declare function getDefaultScanPaths(): string[];
206
+ declare function parseSkillFile(filePath: string, options?: ParseSkillOptions): Promise<SkillConfig | null>;
207
+ /** A scan path paired with the source tag that should be attached to any skills found in it. */
208
+ interface SourcedScanPath {
209
+ path: string;
210
+ source: SkillSource;
211
+ }
47
212
  /**
48
- * Discover skills from filesystem paths.
213
+ * Return the default scan paths tagged by source. Project-scope paths come
214
+ * first; their skills therefore win on name collisions against user-scope
215
+ * skills (first-found wins in discovery).
216
+ */
217
+ declare function getDefaultScanPaths(): SourcedScanPath[];
218
+ /**
219
+ * Infer a source tag for a user-provided scan path.
220
+ * Paths under `$HOME` are treated as 'user'; everything else as 'project'.
221
+ */
222
+ declare function inferSource(path: string): SkillSource;
223
+ /**
224
+ * Discover skills from sourced filesystem paths.
49
225
  * Each path is scanned for subdirectories containing SKILL.md.
50
- * Later paths have lower priority (earlier skill with same name wins).
226
+ * Earlier paths have higher priority (first-found wins on name collision).
51
227
  */
52
- declare function discoverSkills(paths: string[]): Promise<SkillConfig[]>;
228
+ declare function discoverSkills(paths: SourcedScanPath[]): Promise<SkillConfig[]>;
53
229
 
54
230
  /**
55
231
  * Shell interpolation for skill instructions.
@@ -84,12 +260,11 @@ declare function interpolateShellCommands(instructions: string, execution: Execu
84
260
 
85
261
  /**
86
262
  * Resolve all skills from a SkillsConfig:
87
- * 1. Write dynamic skills (config.write) to a temp directory
88
- * 2. Discover skills from scan paths (defaults + config.scan + written dir)
89
- * 3. Filter out exclude skills
90
263
  *
91
- * Written skills are materialized as proper SKILL.md files on disk,
92
- * so they participate in discovery like any other filesystem skill.
264
+ * 1. Materialize `config.write` entries to a temp directory, tagged as `inline`
265
+ * 2. Combine with default + user-provided scan paths (project-first, user-next)
266
+ * 3. Run lenient discovery
267
+ * 4. Apply filters: `exclude`, `enabled` allowlist, optional project-skill trust gate
93
268
  */
94
269
  declare function resolveSkills(config: SkillsConfig): Promise<SkillConfig[]>;
95
270
  /**
@@ -102,15 +277,21 @@ declare function mergeSkillsConfig(harness?: SkillsConfig, agent?: SkillsConfig)
102
277
  /**
103
278
  * Skill writer — materializes inline SkillConfig objects to disk as proper
104
279
  * SKILL.md files so they participate fully in the filesystem-based skill system.
280
+ *
281
+ * Strict-validates each skill before writing (see `validateSkillForWrite`).
105
282
  */
106
283
 
107
284
  /**
108
- * Write a SkillConfig to disk as a proper skill directory with SKILL.md.
285
+ * Write a `SkillConfig` to disk as a proper skill directory with SKILL.md.
109
286
  * Returns the path to the written SKILL.md file.
287
+ *
288
+ * Throws if the skill fails `validateSkillForWrite` — the authoring path is
289
+ * strict on purpose. For loading third-party skills, use `parseSkillFile`
290
+ * directly (lenient).
110
291
  */
111
292
  declare function writeSkillToDisk(skill: SkillConfig, targetDir: string): string;
112
293
  /**
113
- * Write multiple SkillConfig objects to a target directory.
294
+ * Write multiple `SkillConfig` objects to a target directory.
114
295
  * Each skill gets its own subdirectory with a SKILL.md file.
115
296
  * Returns the target directory path (for use as a scan path).
116
297
  */
@@ -118,8 +299,12 @@ declare function writeSkillsToDisk(skills: SkillConfig[], targetDir: string): st
118
299
 
119
300
  /**
120
301
  * Define an inline skill configuration.
121
- * Convenience wrapper for type safety — returns the config as-is.
302
+ *
303
+ * Strict-validates at author-time — throws if the config would be rejected by
304
+ * `writeSkillToDisk` or the spec. Source defaults to `'inline'`.
122
305
  */
123
- declare function defineSkill(config: SkillConfig): SkillConfig;
306
+ declare function defineSkill(config: Omit<SkillConfig, 'source'> & {
307
+ source?: SkillConfig['source'];
308
+ }): SkillConfig;
124
309
 
125
- export { SkillConfig, SkillsConfig, buildCatalog, defineSkill, discoverSkills, getDefaultScanPaths, interpolateShellCommands, mergeSkillsConfig, parseFrontmatter, parseSkillFile, resolveSkills, validateSkillName, writeSkillToDisk, writeSkillsToDisk };
310
+ export { IMPLICITLY_ALLOWED_SKILL_TOOLS, SkillActivationState, SkillConfig, SkillDiagnostic, SkillSource, type SkillValidationIssue, type SkillValidationResult, SkillsConfig, type SourcedScanPath, buildCatalog, defineSkill, discoverSkills, getDefaultScanPaths, inferSource, installAllowedToolsGate, interpolateShellCommands, isToolAllowedByUnion, matchesAllowedTool, mergeSkillsConfig, parseAllowedToolPattern, parseFrontmatter, parseSkillFile, resolveSkills, validateResourcePath, validateSkillForWrite, validateSkillName, writeSkillToDisk, writeSkillsToDisk };
package/dist/skills.js CHANGED
@@ -1,29 +1,48 @@
1
1
  import {
2
2
  defineSkill
3
- } from "./chunk-CFLC2I7D.js";
3
+ } from "./chunk-LVC7NQUZ.js";
4
4
  import {
5
+ IMPLICITLY_ALLOWED_SKILL_TOOLS,
5
6
  buildCatalog,
7
+ createSkillActivationState,
6
8
  discoverSkills,
7
9
  getDefaultScanPaths,
10
+ inferSource,
11
+ installAllowedToolsGate,
8
12
  interpolateShellCommands,
13
+ isToolAllowedByUnion,
14
+ matchesAllowedTool,
9
15
  mergeSkillsConfig,
16
+ parseAllowedToolPattern,
10
17
  parseFrontmatter,
11
18
  parseSkillFile,
12
19
  resolveSkills,
20
+ validateResourcePath,
21
+ validateSkillForWrite,
13
22
  validateSkillName,
14
23
  writeSkillToDisk,
15
24
  writeSkillsToDisk
16
- } from "./chunk-4C6Y56CC.js";
25
+ } from "./chunk-BCXXXJ3G.js";
26
+ import "./chunk-7JTBBZ2U.js";
17
27
  export {
28
+ IMPLICITLY_ALLOWED_SKILL_TOOLS,
18
29
  buildCatalog,
30
+ createSkillActivationState,
19
31
  defineSkill,
20
32
  discoverSkills,
21
33
  getDefaultScanPaths,
34
+ inferSource,
35
+ installAllowedToolsGate,
22
36
  interpolateShellCommands,
37
+ isToolAllowedByUnion,
38
+ matchesAllowedTool,
23
39
  mergeSkillsConfig,
40
+ parseAllowedToolPattern,
24
41
  parseFrontmatter,
25
42
  parseSkillFile,
26
43
  resolveSkills,
44
+ validateResourcePath,
45
+ validateSkillForWrite,
27
46
  validateSkillName,
28
47
  writeSkillToDisk,
29
48
  writeSkillsToDisk
@@ -1,4 +1,4 @@
1
- import { V as ToolContext, W as ToolDef, o as HarnessConfig, h as AgentStats } from './agent-8QBOx4_0.js';
1
+ import { _ as ToolContext, $ as ToolDef, p as HarnessConfig, h as AgentStats } from './agent-D-ZFMbSd.js';
2
2
 
3
3
  /**
4
4
  * Interaction tool — lets the agent request structured input from the outside world.
package/dist/tools.d.ts CHANGED
@@ -1,11 +1,10 @@
1
- export { g as glob } from './glob-Bo0GAiKk.js';
2
- export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, c as createInteractionTool, b as createSpawnTool, s as spawn } from './spawn-jjxPcNcH.js';
3
- import { W as ToolDef } from './agent-8QBOx4_0.js';
1
+ export { S as SkillsReadToolOptions, a as SkillsRunScriptToolOptions, b as SkillsUseToolOptions, c as createSkillsReadTool, d as createSkillsRunScriptTool, e as createSkillsUseTool, g as glob } from './skills-use-C4KFVla0.js';
2
+ export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, c as createInteractionTool, b as createSpawnTool, s as spawn } from './spawn-RoqpjYLZ.js';
3
+ import { $ as ToolDef } from './agent-D-ZFMbSd.js';
4
4
  export { V as ValidationResult, v as validateToolArgs } from './validation-DOY_k7lW.js';
5
5
  import 'hookable';
6
6
  import './types-BpvTmawk.js';
7
7
  import '@modelcontextprotocol/sdk/client/index.js';
8
- import './types-CDI8Kmve.js';
9
8
 
10
9
  declare const listFiles: ToolDef;
11
10