zidane 4.0.2 → 4.1.3
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/README.md +196 -614
- package/dist/agent-BoV5Twdl.d.ts +2347 -0
- package/dist/agent-BoV5Twdl.d.ts.map +1 -0
- package/dist/contexts-3Arvn7yR.js +321 -0
- package/dist/contexts-3Arvn7yR.js.map +1 -0
- package/dist/contexts.d.ts +2 -25
- package/dist/contexts.js +2 -10
- package/dist/errors-D1lhd6mX.js +118 -0
- package/dist/errors-D1lhd6mX.js.map +1 -0
- package/dist/index-28otmfLX.d.ts +400 -0
- package/dist/index-28otmfLX.d.ts.map +1 -0
- package/dist/index-BfSdALzk.d.ts +113 -0
- package/dist/index-BfSdALzk.d.ts.map +1 -0
- package/dist/index-DPsd0qwm.d.ts +254 -0
- package/dist/index-DPsd0qwm.d.ts.map +1 -0
- package/dist/index.d.ts +5 -95
- package/dist/index.js +141 -271
- package/dist/index.js.map +1 -0
- package/dist/interpolate-CukJwP2G.js +887 -0
- package/dist/interpolate-CukJwP2G.js.map +1 -0
- package/dist/mcp-8wClKY-3.js +771 -0
- package/dist/mcp-8wClKY-3.js.map +1 -0
- package/dist/mcp.d.ts +2 -4
- package/dist/mcp.js +2 -13
- package/dist/messages-z5Pq20p7.js +1020 -0
- package/dist/messages-z5Pq20p7.js.map +1 -0
- package/dist/presets-Cs7_CsMk.js +39 -0
- package/dist/presets-Cs7_CsMk.js.map +1 -0
- package/dist/presets.d.ts +2 -43
- package/dist/presets.js +2 -17
- package/dist/providers-CX-R-Oy-.js +969 -0
- package/dist/providers-CX-R-Oy-.js.map +1 -0
- package/dist/providers.d.ts +2 -4
- package/dist/providers.js +3 -23
- package/dist/session/sqlite.d.ts +7 -12
- package/dist/session/sqlite.d.ts.map +1 -0
- package/dist/session/sqlite.js +67 -79
- package/dist/session/sqlite.js.map +1 -0
- package/dist/session-Cn68UASv.js +440 -0
- package/dist/session-Cn68UASv.js.map +1 -0
- package/dist/session.d.ts +2 -4
- package/dist/session.js +3 -27
- package/dist/skills.d.ts +3 -322
- package/dist/skills.js +24 -47
- package/dist/skills.js.map +1 -0
- package/dist/stats-DoKUtF5T.js +58 -0
- package/dist/stats-DoKUtF5T.js.map +1 -0
- package/dist/tools-DpeWKzP1.js +3941 -0
- package/dist/tools-DpeWKzP1.js.map +1 -0
- package/dist/tools.d.ts +3 -95
- package/dist/tools.js +2 -40
- package/dist/tui.d.ts +533 -0
- package/dist/tui.d.ts.map +1 -0
- package/dist/tui.js +2004 -0
- package/dist/tui.js.map +1 -0
- package/dist/types-Bx_F8jet.js +39 -0
- package/dist/types-Bx_F8jet.js.map +1 -0
- package/dist/types.d.ts +4 -55
- package/dist/types.js +4 -28
- package/package.json +38 -4
- package/dist/agent-BAHrGtqu.d.ts +0 -2425
- package/dist/chunk-4ILGBQ23.js +0 -803
- package/dist/chunk-4LPBN547.js +0 -3540
- package/dist/chunk-64LLNY7F.js +0 -28
- package/dist/chunk-6STZTA4N.js +0 -830
- package/dist/chunk-7GQ7P6DM.js +0 -566
- package/dist/chunk-IC7FT4OD.js +0 -37
- package/dist/chunk-JCOB6IYO.js +0 -22
- package/dist/chunk-JH6IAAFA.js +0 -28
- package/dist/chunk-LNN5UTS2.js +0 -97
- package/dist/chunk-PMCQOMV4.js +0 -490
- package/dist/chunk-UD25QF3H.js +0 -304
- package/dist/chunk-W57VY6DJ.js +0 -834
- package/dist/sandbox-D7v6Wy62.d.ts +0 -28
- package/dist/skills-use-DwZrNmcw.d.ts +0 -80
- package/dist/types-Bai5rKpa.d.ts +0 -89
- package/dist/validation-Pm--dQEU.d.ts +0 -185
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { c as ExecutionContext, l as ExecutionHandle } from "./index-BfSdALzk.js";
|
|
2
|
+
import { C as SkillsConfig, S as SkillSource, b as SkillDiagnostic, c as SkillActivationState, n as AgentHooks, y as SkillConfig } from "./agent-BoV5Twdl.js";
|
|
3
|
+
import { Hookable } from "hookable";
|
|
4
|
+
|
|
5
|
+
//#region src/skills/allowed-tools.d.ts
|
|
6
|
+
/** Tools that are always allowed regardless of the active skills' allow-list. */
|
|
7
|
+
declare const IMPLICITLY_ALLOWED_SKILL_TOOLS: readonly string[];
|
|
8
|
+
/**
|
|
9
|
+
* Register `tool:gate` / `mcp:tool:gate` handlers that enforce the union of
|
|
10
|
+
* `allowedTools` across active skills.
|
|
11
|
+
*
|
|
12
|
+
* No-op when no active skill declares an allow-list (permissive default —
|
|
13
|
+
* matches the spec's "experimental" note for `allowed-tools`).
|
|
14
|
+
*
|
|
15
|
+
* Returns an `uninstall` fn. The agent calls this at run end to detach the
|
|
16
|
+
* handlers and prevent cross-run hook leaks.
|
|
17
|
+
*/
|
|
18
|
+
declare function installAllowedToolsGate(hooks: Hookable<AgentHooks>, state: SkillActivationState): () => void;
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/skills/catalog.d.ts
|
|
21
|
+
interface BuildCatalogOptions {
|
|
22
|
+
/**
|
|
23
|
+
* When true (the default), the prose instructs the model to call
|
|
24
|
+
* `skills_use`. Set to false when `SkillsConfig.tool === false` so the
|
|
25
|
+
* system prompt matches the active activation mechanism.
|
|
26
|
+
*/
|
|
27
|
+
skillsToolRegistered?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Name of the tool the model should use to read `SKILL.md` files when
|
|
30
|
+
* `skillsToolRegistered` is false. Defaults to `'read_file'`.
|
|
31
|
+
*/
|
|
32
|
+
readToolName?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Build the skill catalog XML and behavioral instructions for the system prompt.
|
|
36
|
+
*/
|
|
37
|
+
declare function buildCatalog(skills: SkillConfig[], options?: BuildCatalogOptions): string;
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/skills/discovery.d.ts
|
|
40
|
+
interface ParsedSkillFile {
|
|
41
|
+
frontmatter: Record<string, unknown>;
|
|
42
|
+
body: string;
|
|
43
|
+
diagnostics: SkillDiagnostic[];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Parse a SKILL.md file into frontmatter + body.
|
|
47
|
+
*
|
|
48
|
+
* Uses a simple regex-based YAML extractor that handles:
|
|
49
|
+
* - Flat key: value pairs
|
|
50
|
+
* - Quoted values
|
|
51
|
+
* - One-level nested maps (for `metadata:`)
|
|
52
|
+
* - Lenient recovery from unquoted-colon values (e.g.
|
|
53
|
+
* `description: Use when: the user asks …`) via a quote-wrap retry.
|
|
54
|
+
*/
|
|
55
|
+
declare function parseFrontmatter(content: string): ParsedSkillFile;
|
|
56
|
+
interface ParseSkillOptions {
|
|
57
|
+
/** Source tag to attach to the returned SkillConfig. */
|
|
58
|
+
source?: SkillSource;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Parse a SKILL.md file into a SkillConfig (lenient).
|
|
62
|
+
*
|
|
63
|
+
* Returns `null` only when the skill is fundamentally unusable:
|
|
64
|
+
* - The file is missing
|
|
65
|
+
* - The description is absent (required by spec for disclosure)
|
|
66
|
+
*
|
|
67
|
+
* All other issues are surfaced as `SkillConfig.diagnostics` with severity
|
|
68
|
+
* `warning`. Deprecated top-level fields (`paths`, `model`, `thinking`) are
|
|
69
|
+
* auto-migrated into `metadata['zidane.*']`.
|
|
70
|
+
*/
|
|
71
|
+
declare function parseSkillFile(filePath: string, options?: ParseSkillOptions): Promise<SkillConfig | null>;
|
|
72
|
+
/** A scan path paired with the source tag that should be attached to any skills found in it. */
|
|
73
|
+
interface SourcedScanPath {
|
|
74
|
+
path: string;
|
|
75
|
+
source: SkillSource;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Return the default scan paths tagged by source. Project-scope paths come
|
|
79
|
+
* first; their skills therefore win on name collisions against user-scope
|
|
80
|
+
* skills (first-found wins in discovery).
|
|
81
|
+
*/
|
|
82
|
+
declare function getDefaultScanPaths(): SourcedScanPath[];
|
|
83
|
+
/**
|
|
84
|
+
* Infer a source tag for a user-provided scan path.
|
|
85
|
+
* Paths under `$HOME` are treated as 'user'; everything else as 'project'.
|
|
86
|
+
*/
|
|
87
|
+
declare function inferSource(path: string): SkillSource;
|
|
88
|
+
/**
|
|
89
|
+
* Discover skills from sourced filesystem paths.
|
|
90
|
+
* Each path is scanned for subdirectories containing SKILL.md.
|
|
91
|
+
* Earlier paths have higher priority (first-found wins on name collision).
|
|
92
|
+
*/
|
|
93
|
+
declare function discoverSkills(paths: SourcedScanPath[]): Promise<SkillConfig[]>;
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/skills/interpolate.d.ts
|
|
96
|
+
/**
|
|
97
|
+
* Interpolate shell commands in skill instructions.
|
|
98
|
+
*
|
|
99
|
+
* Runs each !\`command\` through the execution context and replaces
|
|
100
|
+
* the placeholder with the command's stdout. If a command fails,
|
|
101
|
+
* the placeholder is replaced with an error message.
|
|
102
|
+
*
|
|
103
|
+
* @param instructions - Raw skill instructions with potential !\`command\` patterns
|
|
104
|
+
* @param execution - The execution context to run commands in
|
|
105
|
+
* @param handle - The active execution handle
|
|
106
|
+
* @returns Instructions with all !\`command\` patterns replaced by output
|
|
107
|
+
*/
|
|
108
|
+
declare function interpolateShellCommands(instructions: string, execution: ExecutionContext, handle: ExecutionHandle): Promise<string>;
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/skills/resolve.d.ts
|
|
111
|
+
/**
|
|
112
|
+
* Resolved-skills bundle: the materialized list plus a `cleanup` fn that
|
|
113
|
+
* removes any temporary directory created for `config.write` skills.
|
|
114
|
+
*
|
|
115
|
+
* Inline skills must live on disk for the lifetime of the agent (the
|
|
116
|
+
* `skills_read` / `skills_run_script` tools resolve relative paths against
|
|
117
|
+
* `baseDir`), so cleanup is deferred to `agent.destroy()`. When no temp
|
|
118
|
+
* directory was created, `cleanup` is a no-op.
|
|
119
|
+
*/
|
|
120
|
+
interface ResolvedSkillsBundle {
|
|
121
|
+
skills: SkillConfig[];
|
|
122
|
+
cleanup: () => void;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Resolve all skills from a SkillsConfig:
|
|
126
|
+
*
|
|
127
|
+
* 1. Materialize `config.write` entries to a temp directory, tagged as `inline`
|
|
128
|
+
* 2. Combine with default + user-provided scan paths (project-first, user-next)
|
|
129
|
+
* 3. Run lenient discovery
|
|
130
|
+
* 4. Apply filters: `exclude`, `enabled` allowlist, optional project-skill trust gate
|
|
131
|
+
*
|
|
132
|
+
* Returns `{ skills, cleanup }` — call `cleanup()` on agent destroy to remove
|
|
133
|
+
* the temp directory created for inline `config.write` skills. The agent
|
|
134
|
+
* factory wires this automatically; standalone callers must invoke it
|
|
135
|
+
* themselves to avoid leaking OS temp.
|
|
136
|
+
*/
|
|
137
|
+
declare function resolveSkills(config: SkillsConfig): Promise<ResolvedSkillsBundle>;
|
|
138
|
+
//#endregion
|
|
139
|
+
//#region src/skills/validate.d.ts
|
|
140
|
+
/**
|
|
141
|
+
* A single issue surfaced by skill-authoring validation.
|
|
142
|
+
* Distinct from `ValidationResult` in `tools/validation.ts` (tool-input JSON
|
|
143
|
+
* schema validation) — different domain, different module.
|
|
144
|
+
*/
|
|
145
|
+
interface SkillValidationIssue {
|
|
146
|
+
/** Stable machine-readable code for consumer matching. */
|
|
147
|
+
code: string;
|
|
148
|
+
/** Human-readable description. */
|
|
149
|
+
message: string;
|
|
150
|
+
/** Frontmatter field name the issue relates to, when applicable. */
|
|
151
|
+
field?: string;
|
|
152
|
+
}
|
|
153
|
+
interface SkillValidationResult {
|
|
154
|
+
valid: boolean;
|
|
155
|
+
errors: SkillValidationIssue[];
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Validate a skill name per the spec:
|
|
159
|
+
* - 1–64 characters
|
|
160
|
+
* - Lowercase alphanumeric + hyphens only
|
|
161
|
+
* - Must not start or end with a hyphen
|
|
162
|
+
* - Must not contain consecutive hyphens
|
|
163
|
+
*
|
|
164
|
+
* The parent-directory match is validated separately (it requires knowing the
|
|
165
|
+
* skill's `location`, which this function does not).
|
|
166
|
+
*/
|
|
167
|
+
declare function validateSkillName(name: string): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Strict validation for a skill that is about to be authored / written to disk.
|
|
170
|
+
* Rejects anything that would violate the spec. Use the lenient parser path
|
|
171
|
+
* (`parseSkillFile`) for loading third-party skills.
|
|
172
|
+
*/
|
|
173
|
+
declare function validateSkillForWrite(skill: SkillConfig): SkillValidationResult;
|
|
174
|
+
/**
|
|
175
|
+
* Validate that `relPath` stays inside `baseDir` when resolved.
|
|
176
|
+
*
|
|
177
|
+
* Rejects:
|
|
178
|
+
* - Absolute paths (`/etc/passwd`, `C:\…`)
|
|
179
|
+
* - Parent traversal (`..` segments that escape baseDir)
|
|
180
|
+
* - Null-byte tricks
|
|
181
|
+
*
|
|
182
|
+
* Returns `{ valid: true, absolutePath }` on success or `{ valid: false, error }`
|
|
183
|
+
* with a human-readable reason.
|
|
184
|
+
*/
|
|
185
|
+
declare function validateResourcePath(relPath: string, baseDir: string): {
|
|
186
|
+
valid: true;
|
|
187
|
+
absolutePath: string;
|
|
188
|
+
} | {
|
|
189
|
+
valid: false;
|
|
190
|
+
error: string;
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Parse a single `allowed-tools` entry into its tool name + optional argument pattern.
|
|
194
|
+
*
|
|
195
|
+
* Examples:
|
|
196
|
+
* - `Read` → `{ tool: 'Read' }`
|
|
197
|
+
* - `Bash(git:*)` → `{ tool: 'Bash', argPrefix: 'git' }`
|
|
198
|
+
*/
|
|
199
|
+
declare function parseAllowedToolPattern(entry: string): {
|
|
200
|
+
tool: string;
|
|
201
|
+
argPrefix?: string;
|
|
202
|
+
} | null;
|
|
203
|
+
/**
|
|
204
|
+
* Check whether a tool call (identified by its wire/displayName and argument input)
|
|
205
|
+
* matches a skill's allow-list entry.
|
|
206
|
+
*
|
|
207
|
+
* Matching rules (Zidane's interpretation of the spec's unspecified syntax):
|
|
208
|
+
* - Exact match: displayName === pattern (no parens).
|
|
209
|
+
* - Prefix match: for `Tool(arg:*)`, displayName === 'Tool' AND **any** string
|
|
210
|
+
* value in the input object starts with `arg`. This is intentionally
|
|
211
|
+
* permissive: it doesn't depend on a convention about which property carries
|
|
212
|
+
* the "command" (schemas vary across tools), and for the common
|
|
213
|
+
* `shell({ command: 'git …' })` shape it behaves identically to a "primary
|
|
214
|
+
* string" rule.
|
|
215
|
+
* - For tools whose inputs carry no string values, the arg-match returns false.
|
|
216
|
+
*/
|
|
217
|
+
declare function matchesAllowedTool(displayName: string, input: Record<string, unknown>, pattern: string): boolean;
|
|
218
|
+
/**
|
|
219
|
+
* Test whether a tool call is allowed by the union of `allowedTools` across a set
|
|
220
|
+
* of active skills. Returns `true` when the union is empty (permissive default)
|
|
221
|
+
* OR when any entry matches.
|
|
222
|
+
*/
|
|
223
|
+
declare function isToolAllowedByUnion(displayName: string, input: Record<string, unknown>, union: readonly string[]): boolean;
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/skills/writer.d.ts
|
|
226
|
+
/**
|
|
227
|
+
* Write a `SkillConfig` to disk as a proper skill directory with SKILL.md.
|
|
228
|
+
* Returns the path to the written SKILL.md file.
|
|
229
|
+
*
|
|
230
|
+
* Throws if the skill fails `validateSkillForWrite` — the authoring path is
|
|
231
|
+
* strict on purpose. For loading third-party skills, use `parseSkillFile`
|
|
232
|
+
* directly (lenient).
|
|
233
|
+
*/
|
|
234
|
+
declare function writeSkillToDisk(skill: SkillConfig, targetDir: string): string;
|
|
235
|
+
/**
|
|
236
|
+
* Write multiple `SkillConfig` objects to a target directory.
|
|
237
|
+
* Each skill gets its own subdirectory with a SKILL.md file.
|
|
238
|
+
* Returns the target directory path (for use as a scan path).
|
|
239
|
+
*/
|
|
240
|
+
declare function writeSkillsToDisk(skills: SkillConfig[], targetDir: string): string;
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region src/skills/index.d.ts
|
|
243
|
+
/**
|
|
244
|
+
* Define an inline skill configuration.
|
|
245
|
+
*
|
|
246
|
+
* Strict-validates at author-time — throws if the config would be rejected by
|
|
247
|
+
* `writeSkillToDisk` or the spec. Source defaults to `'inline'`.
|
|
248
|
+
*/
|
|
249
|
+
declare function defineSkill(config: Omit<SkillConfig, 'source'> & {
|
|
250
|
+
source?: SkillConfig['source'];
|
|
251
|
+
}): SkillConfig;
|
|
252
|
+
//#endregion
|
|
253
|
+
export { installAllowedToolsGate as S, inferSource as _, SkillValidationResult as a, buildCatalog as b, parseAllowedToolPattern as c, validateSkillName as d, resolveSkills as f, getDefaultScanPaths as g, discoverSkills as h, SkillValidationIssue as i, validateResourcePath as l, SourcedScanPath as m, writeSkillToDisk as n, isToolAllowedByUnion as o, interpolateShellCommands as p, writeSkillsToDisk as r, matchesAllowedTool as s, defineSkill as t, validateSkillForWrite as u, parseFrontmatter as v, IMPLICITLY_ALLOWED_SKILL_TOOLS as x, parseSkillFile as y };
|
|
254
|
+
//# sourceMappingURL=index-DPsd0qwm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DPsd0qwm.d.ts","names":[],"sources":["../src/skills/allowed-tools.ts","../src/skills/catalog.ts","../src/skills/discovery.ts","../src/skills/interpolate.ts","../src/skills/resolve.ts","../src/skills/validate.ts","../src/skills/writer.ts","../src/skills/index.ts"],"mappings":";;;;;;cAuBa,8BAAA;;;;;;;;;;ACHb;iBDmBgB,uBAAA,CACd,KAAA,EAAO,QAAA,CAAS,UAAA,GAChB,KAAA,EAAO,oBAAA;;;UCrBQ,mBAAA;EDoBR;;;;;ECdP,oBAAA;EDe2B;;;;ECV3B,YAAA;AAAA;;;;iBAMc,YAAA,CACd,MAAA,EAAQ,WAAA,IACR,OAAA,GAAS,mBAAA;;;UCCD,eAAA;EACR,WAAA,EAAa,MAAA;EACb,IAAA;EACA,WAAA,EAAa,eAAA;AAAA;;;;;;;;;;;iBAaC,gBAAA,CAAiB,OAAA,WAAkB,eAAA;AAAA,UA0MzC,iBAAA;ED9O0B;ECgPlC,MAAA,GAAS,WAAA;AAAA;;AD/NX;;;;;;;;;;iBC6OsB,cAAA,CACpB,QAAA,UACA,OAAA,GAAS,iBAAA,GACR,OAAA,CAAQ,WAAA;;UA0MM,eAAA;EACf,IAAA;EACA,MAAA,EAAQ,WAAA;AAAA;;;;;;iBAQM,mBAAA,CAAA,GAAuB,eAAA;;;AAjbvC;;iBAkcgB,WAAA,CAAY,IAAA,WAAe,WAAA;;;AArY1C;;;iBAkZqB,cAAA,CAAe,KAAA,EAAO,eAAA,KAAoB,OAAA,CAAQ,WAAA;;;;;;;;;;;;;;;iBC1elD,wBAAA,CACpB,YAAA,UACA,SAAA,EAAW,gBAAA,EACX,MAAA,EAAQ,eAAA,GACP,OAAA;;;AHVH;;;;;AAgBA;;;;AAhBA,UIGiB,oBAAA;EACf,MAAA,EAAQ,WAAA;EACR,OAAA;AAAA;;;;;;;;;;;AHRF;;;iBGwBsB,aAAA,CAAc,MAAA,EAAQ,YAAA,GAAe,OAAA,CAAQ,oBAAA;;;;;;AJLnE;;UKCiB,oBAAA;ELAC;EKEhB,IAAA;ELDO;EKGP,OAAA;ELH2B;EKK3B,KAAA;AAAA;AAAA,UAGe,qBAAA;EACf,KAAA;EACA,MAAA,EAAQ,oBAAA;AAAA;;;;;AJ/BV;;;;;AAiBA;iBI+BgB,iBAAA,CAAkB,IAAA;;;;;;iBAmBlB,qBAAA,CAAsB,KAAA,EAAO,WAAA,GAAc,qBAAA;;;;;;AH3E4B;;;;;;iBGiLvE,oBAAA,CACd,OAAA,UACA,OAAA;EACG,KAAA;EAAa,YAAA;AAAA;EAA2B,KAAA;EAAc,KAAA;AAAA;;;;AH3E1D;;;;iBG0He,uBAAA,CAAwB,KAAA;EAAkB,IAAA;EAAc,SAAA;AAAA;;;;;;;;;;;;;AHgPxE;;iBGnNgB,kBAAA,CACd,WAAA,UACA,KAAA,EAAO,MAAA,mBACP,OAAA;;;;;;iBAyBc,oBAAA,CACd,WAAA,UACA,KAAA,EAAO,MAAA,mBACP,KAAA;;;;;;ALpQF;;;;;iBM8BgB,gBAAA,CAAiB,KAAA,EAAO,WAAA,EAAa,SAAA;;;;;;iBAoCrC,iBAAA,CAAkB,MAAA,EAAQ,WAAA,IAAe,SAAA;;;;;;;;;iBCnDzC,WAAA,CAAY,MAAA,EAAQ,IAAA,CAAK,WAAA;EAA2B,MAAA,GAAS,WAAA;AAAA,IAA0B,WAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,95 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
export { Preset, basic, basicTools, definePreset } from './presets.js';
|
|
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 { ModelUsage, flattenTurns, statsByModel } from './types.js';
|
|
9
|
-
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-DwZrNmcw.js';
|
|
10
|
-
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-Pm--dQEU.js';
|
|
11
|
-
import { Hookable } from 'hookable';
|
|
12
|
-
import '@modelcontextprotocol/sdk/client/index.js';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Tracing helper — wraps agent lifecycle hooks in caller-provided spans.
|
|
16
|
-
*
|
|
17
|
-
* Zidane is hooks-native; rather than introducing a plugin abstraction just for
|
|
18
|
-
* observability, we ship a small helper that turns an arbitrary `startSpan`
|
|
19
|
-
* function into a bundle of hook handlers. Works with Sentry, OpenTelemetry,
|
|
20
|
-
* Datadog — any tracer that can hand back an object with an `end()` method.
|
|
21
|
-
*
|
|
22
|
-
* The helper:
|
|
23
|
-
* - Starts a `turn:${n}` span on `turn:before`, ends it on `turn:after`.
|
|
24
|
-
* - Starts a `tool:${name}` span on `tool:before`, ends it on `tool:after` / `tool:error`.
|
|
25
|
-
* - Starts a `mcp:${server}:${tool}` span on `mcp:tool:before`, ends it on `mcp:tool:after` / `mcp:tool:error`.
|
|
26
|
-
* - On `agent:done` closes any spans still open (defensive — normally all tool/turn
|
|
27
|
-
* spans have matching end hooks, but an abort mid-execution can leave dangling ones).
|
|
28
|
-
*
|
|
29
|
-
* Returns an `install(hooks)` helper that registers every handler at once and
|
|
30
|
-
* yields an `uninstall()` function for cleanup. Safe across multiple runs.
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
/** Minimal span shape — any tracer that provides these two methods is compatible. */
|
|
34
|
-
interface Span {
|
|
35
|
-
/** Close the span. Called exactly once per span. */
|
|
36
|
-
end: () => void;
|
|
37
|
-
/** Optional: attach additional attributes after the span is started (ignored if unsupported). */
|
|
38
|
-
setAttributes?: (attrs: Record<string, unknown>) => void;
|
|
39
|
-
}
|
|
40
|
-
/** Function that opens a span. Caller-provided so we stay tracer-agnostic. */
|
|
41
|
-
type StartSpan = (name: string, attrs?: Record<string, unknown>) => Span;
|
|
42
|
-
interface TracingHooksOptions {
|
|
43
|
-
/** Tracer seam. Receives a span name + attributes; must return a `Span`. */
|
|
44
|
-
startSpan: StartSpan;
|
|
45
|
-
/**
|
|
46
|
-
* Optional attribute namespace. Prepended to every span name (e.g. `"agent"` →
|
|
47
|
-
* span names like `agent/turn:0`, `agent/tool:Bash`).
|
|
48
|
-
*/
|
|
49
|
-
namespace?: string;
|
|
50
|
-
}
|
|
51
|
-
/** Value returned by {@link createTracingHooks} — install entrypoint. */
|
|
52
|
-
interface TracingHookSet {
|
|
53
|
-
/**
|
|
54
|
-
* Attach every hook handler to the given agent hooks instance.
|
|
55
|
-
*
|
|
56
|
-
* @returns an `uninstall` function that detaches every handler and closes any
|
|
57
|
-
* still-open spans. Safe to call multiple times.
|
|
58
|
-
*/
|
|
59
|
-
install: (hooks: Hookable<AgentHooks>) => () => void;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Build a set of tracing hook handlers that can be installed on an agent.
|
|
63
|
-
*
|
|
64
|
-
* @example Sentry
|
|
65
|
-
* ```ts
|
|
66
|
-
* const tracing = createTracingHooks({
|
|
67
|
-
* startSpan: (name, attrs) => Sentry.startInactiveSpan({ name, attributes: attrs }),
|
|
68
|
-
* })
|
|
69
|
-
* const uninstall = tracing.install(agent.hooks)
|
|
70
|
-
* try { await agent.run({ prompt }) }
|
|
71
|
-
* finally { uninstall() }
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
declare function createTracingHooks(options: TracingHooksOptions): TracingHookSet;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Zod v4 integration helper.
|
|
78
|
-
*
|
|
79
|
-
* Normalizes the output of z.toJsonSchema() for use as ToolSpec.inputSchema.
|
|
80
|
-
* Zod is an optional peer dependency — consumers call z.toJsonSchema() themselves.
|
|
81
|
-
*
|
|
82
|
-
* Usage:
|
|
83
|
-
* import { z } from 'zod'
|
|
84
|
-
* import { zodToJsonSchema } from 'zidane'
|
|
85
|
-
* const schema = zodToJsonSchema(z.toJsonSchema(z.object({ name: z.string() })))
|
|
86
|
-
*/
|
|
87
|
-
/**
|
|
88
|
-
* Normalize a JSON Schema (e.g. from zod v4's z.toJsonSchema()) for use
|
|
89
|
-
* as a ToolSpec.inputSchema.
|
|
90
|
-
*
|
|
91
|
-
* Strips the $schema key that some providers reject.
|
|
92
|
-
*/
|
|
93
|
-
declare function zodToJsonSchema(jsonSchema: Record<string, unknown>): Record<string, unknown>;
|
|
94
|
-
|
|
95
|
-
export { AgentHooks, type Span, type TracingHookSet, type TracingHooksOptions, createTracingHooks, zodToJsonSchema };
|
|
1
|
+
import { a as ContextCapabilities, c as ExecutionContext, i as createDockerContext, l as ExecutionHandle, n as createSandboxContext, o as ContextType, r as createProcessContext, s as ExecResult, t as SandboxProvider, u as SpawnConfig } from "./index-BfSdALzk.js";
|
|
2
|
+
import { $ as OpenAICompatHttpError, A as loadSession, At as ToolExecutionMode, B as FileMapStoreOptions, Bt as AgentContextExceededError, C as SkillsConfig, Ct as SessionEndStatus, D as SessionRun, Dt as SpawnHookContext, E as SessionData, Et as SessionTurn, F as fromOpenAI, Ft as TurnFinishReason, G as StreamOptions, Gt as ClassifiedErrorKind, H as Provider, Ht as AgentToolNotAllowedError, I as toAnthropic, It as TurnUsage, J as ToolSpec, K as ToolCall, Kt as matchesContextExceeded, L as toOpenAI, Lt as toolOutputByteLength, M as createRemoteStore, Mt as ToolResultContent, N as autoDetectAndConvert, Nt as ToolResultImageContent, O as SessionStore, Ot as StreamHookContext, P as fromAnthropic, Pt as ToolResultTextContent, Q as OpenAICompatAuthHeader, R as createMemoryStore, Rt as toolResultToText, S as SkillSource, St as SessionContentBlock, T as Session, Tt as SessionMessage, U as ProviderCapabilities, Ut as CONTEXT_EXCEEDED_MESSAGE_PATTERNS, V as createFileMapStore, Vt as AgentProviderError, W as StreamCallbacks, Wt as ClassifiedError, X as OpenRouterParams, Y as TurnResult, Z as openrouter, _ as ToolDef, _t as PromptDocumentPart, a as ActivationVia, at as openai, b as SkillDiagnostic, bt as PromptTextPart, c as SkillActivationState, ct as AnthropicParams, d as McpConnection, dt as AgentRunOptions, et as OpenAICompatParams, f as connectMcpServers, ft as AgentStats, g as ToolContext, gt as OAuthRefreshHookContext, h as resultToString, ht as McpToolHookContext, i as createAgent, it as OpenAIParams, j as RemoteStoreOptions, jt as ToolHookContext, k as createSession, kt as ThinkingLevel, l as SkillActivationStateOptions, lt as anthropic, m as normalizeMcpServers, mt as McpServerConfig, n as AgentHooks, nt as mapOAIFinishReason, o as ActiveSkill, ot as CerebrasParams, p as normalizeMcpBlocks, q as ToolResult, qt as toTypedError, r as AgentOptions, rt as openaiCompat, s as DeactivationReason, st as cerebras, t as Agent, tt as classifyOpenAICompatError, u as createSkillActivationState, ut as AgentBehavior, v as ToolMap, vt as PromptImagePart, w as CreateSessionOptions, wt as SessionHookContext, x as SkillResource, xt as RunHookMap, y as SkillConfig, yt as PromptPart, z as FileMapAdapter, zt as AgentAbortedError } from "./agent-BoV5Twdl.js";
|
|
3
|
+
import { A as edit, D as createInteractionTool, E as InteractionToolOptions, F as definePreset, I as _default, L as basicTools, M as flattenTurns, N as statsByModel, O as grep, P as Preset, _ as createSkillsUseTool, a as createTracingHooks, b as SkillsReadToolOptions, c as validateToolArgs, f as ChildAgent, g as SkillsUseToolOptions, h as createSpawnTool, i as TracingHooksOptions, j as ModelUsage, k as glob, m as SpawnToolState, n as Span, p as SpawnToolOptions, r as TracingHookSet, s as ValidationResult, t as zodToJsonSchema, v as SkillsRunScriptToolOptions, w as multiEdit, x as createSkillsReadTool, y as createSkillsRunScriptTool } from "./index-28otmfLX.js";
|
|
4
|
+
import { S as installAllowedToolsGate, a as SkillValidationResult, b as buildCatalog, c as parseAllowedToolPattern, d as validateSkillName, f as resolveSkills, h as discoverSkills, i as SkillValidationIssue, l as validateResourcePath, m as SourcedScanPath, n as writeSkillToDisk, o as isToolAllowedByUnion, p as interpolateShellCommands, r as writeSkillsToDisk, s as matchesAllowedTool, t as defineSkill, u as validateSkillForWrite, x as IMPLICITLY_ALLOWED_SKILL_TOOLS, y as parseSkillFile } from "./index-DPsd0qwm.js";
|
|
5
|
+
export { ActivationVia, ActiveSkill, Agent, AgentAbortedError, AgentBehavior, AgentContextExceededError, AgentHooks, AgentOptions, AgentProviderError, AgentRunOptions, AgentStats, AgentToolNotAllowedError, AnthropicParams, CONTEXT_EXCEEDED_MESSAGE_PATTERNS, CerebrasParams, ChildAgent, ClassifiedError, ClassifiedErrorKind, ContextCapabilities, ContextType, CreateSessionOptions, DeactivationReason, ExecResult, ExecutionContext, ExecutionHandle, FileMapAdapter, FileMapStoreOptions, IMPLICITLY_ALLOWED_SKILL_TOOLS, InteractionToolOptions, McpConnection, McpServerConfig, McpToolHookContext, ModelUsage, OAuthRefreshHookContext, OpenAICompatAuthHeader, OpenAICompatHttpError, OpenAICompatParams, OpenAIParams, OpenRouterParams, Preset, PromptDocumentPart, PromptImagePart, PromptPart, PromptTextPart, Provider, ProviderCapabilities, RemoteStoreOptions, RunHookMap, SandboxProvider, Session, SessionContentBlock, SessionData, SessionEndStatus, SessionHookContext, SessionMessage, SessionRun, SessionStore, SessionTurn, SkillActivationState, SkillActivationStateOptions, SkillConfig, SkillDiagnostic, SkillResource, SkillSource, SkillValidationIssue, SkillValidationResult, SkillsConfig, SkillsReadToolOptions, SkillsRunScriptToolOptions, SkillsUseToolOptions, SourcedScanPath, Span, SpawnConfig, SpawnHookContext, SpawnToolOptions, SpawnToolState, StreamCallbacks, StreamHookContext, StreamOptions, ThinkingLevel, ToolCall, ToolContext, ToolDef, ToolExecutionMode, ToolHookContext, ToolMap, ToolResult, ToolResultContent, ToolResultImageContent, ToolResultTextContent, ToolSpec, TracingHookSet, TracingHooksOptions, TurnFinishReason, TurnResult, TurnUsage, ValidationResult, anthropic, autoDetectAndConvert, _default as basic, basicTools, buildCatalog, cerebras, classifyOpenAICompatError, connectMcpServers, createAgent, createDockerContext, createFileMapStore, createInteractionTool, createMemoryStore, createProcessContext, createRemoteStore, createSandboxContext, createSession, createSkillActivationState, createSkillsReadTool, createSkillsRunScriptTool, createSkillsUseTool, createSpawnTool, createTracingHooks, definePreset, defineSkill, discoverSkills, edit, flattenTurns, fromAnthropic, fromOpenAI, glob, grep, installAllowedToolsGate, interpolateShellCommands, isToolAllowedByUnion, loadSession, mapOAIFinishReason, matchesAllowedTool, matchesContextExceeded, multiEdit, normalizeMcpBlocks, normalizeMcpServers, openai, openaiCompat, openrouter, parseAllowedToolPattern, parseSkillFile, resolveSkills, resultToString, statsByModel, toAnthropic, toOpenAI, toTypedError, toolOutputByteLength, toolResultToText, validateResourcePath, validateSkillForWrite, validateSkillName, validateToolArgs, writeSkillToDisk, writeSkillsToDisk, zodToJsonSchema };
|