zidane 5.14.5 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{acp-BpFEbCMQ.js → acp-Irby04Us.js} +7 -8
- package/dist/{acp-BpFEbCMQ.js.map → acp-Irby04Us.js.map} +1 -1
- package/dist/acp-cli.js +7 -7
- package/dist/acp.d.ts +2 -3
- package/dist/acp.d.ts.map +1 -1
- package/dist/acp.js +1 -1
- package/dist/{agent-DyI0YsAR.js → agent-DkSmGkDM.js} +10873 -5437
- package/dist/agent-DkSmGkDM.js.map +1 -0
- package/dist/agent.d.ts +1 -2
- package/dist/agent.js +2 -2
- package/dist/{anthropic-cbfW2RGg.js → anthropic-CTHsdFG9.js} +5 -4
- package/dist/{anthropic-cbfW2RGg.js.map → anthropic-CTHsdFG9.js.map} +1 -1
- package/dist/{auth-D9uj0nNr.js → auth-BDSu_0t3.js} +13 -86
- package/dist/auth-BDSu_0t3.js.map +1 -0
- package/dist/chat/pure.d.ts +4 -4
- package/dist/chat/pure.js +4 -3
- package/dist/chat.d.ts +29 -8
- package/dist/chat.d.ts.map +1 -1
- package/dist/chat.js +9 -6
- package/dist/chat.js.map +1 -1
- package/dist/completion-core-CXYSVhZo.js +147 -0
- package/dist/completion-core-CXYSVhZo.js.map +1 -0
- package/dist/{context-breakdown-kO-pDsay.js → context-breakdown-Dzo25N45.js} +2 -23
- package/dist/context-breakdown-Dzo25N45.js.map +1 -0
- package/dist/contexts/daytona.d.ts +3 -3
- package/dist/contexts/daytona.js +1 -1
- package/dist/contexts/docker.d.ts +10 -2
- package/dist/contexts/docker.d.ts.map +1 -1
- package/dist/contexts/docker.js +142 -103
- package/dist/contexts/docker.js.map +1 -1
- package/dist/contexts/e2b.d.ts +2 -2
- package/dist/contexts/e2b.js +1 -1
- package/dist/contexts/sandbox.d.ts +1 -1
- package/dist/contexts/sandbox.js +4 -1
- package/dist/contexts/sandbox.js.map +1 -1
- package/dist/{contexts-Lzf5huID.js → contexts-Vone3qQQ.js} +26 -37
- package/dist/contexts-Vone3qQQ.js.map +1 -0
- package/dist/contexts.d.ts +3 -3
- package/dist/contexts.js +1 -1
- package/dist/errors.d.ts +1 -2
- package/dist/errors.js +1 -1
- package/dist/eval.d.ts +1 -1
- package/dist/eval.js +3 -3
- package/dist/exec-file-size-PXkr-MGA.js +63 -0
- package/dist/exec-file-size-PXkr-MGA.js.map +1 -0
- package/dist/extensions.d.ts +2 -0
- package/dist/extensions.js +2 -0
- package/dist/generate-data-WL_yGVL6.js +324 -0
- package/dist/generate-data-WL_yGVL6.js.map +1 -0
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +15 -10
- package/dist/headless.js.map +1 -1
- package/dist/index-B8UtiZy7.d.ts +14967 -0
- package/dist/index-B8UtiZy7.d.ts.map +1 -0
- package/dist/{index-B3ciFUZx.d.ts → index-DsPQbyUn.d.ts} +2 -2
- package/dist/index-DsPQbyUn.d.ts.map +1 -0
- package/dist/index.d.ts +6 -12
- package/dist/index.js +20 -43
- package/dist/index.js.map +1 -1
- package/dist/{logger-Ktm-lj1s.js → logger-DBX9uYOw.js} +108 -5
- package/dist/logger-DBX9uYOw.js.map +1 -0
- package/dist/login-DOF8pMVM.js +539 -0
- package/dist/login-DOF8pMVM.js.map +1 -0
- package/dist/{mcp-Dn5W65Lv.js → mcp-CcvuVXB9.js} +2 -2
- package/dist/{mcp-Dn5W65Lv.js.map → mcp-CcvuVXB9.js.map} +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +1 -1
- package/dist/{messages-CozesxbB.js → messages-CwujiS74.js} +4 -4
- package/dist/messages-CwujiS74.js.map +1 -0
- package/dist/{openai-compat-FII_9wJP.js → openai-compat-BvgYGSR1.js} +5 -4
- package/dist/{openai-compat-FII_9wJP.js.map → openai-compat-BvgYGSR1.js.map} +1 -1
- package/dist/output/stream-json.d.ts +1 -2
- package/dist/output/stream-json.d.ts.map +1 -1
- package/dist/output/terminal.d.ts +1 -2
- package/dist/output/terminal.d.ts.map +1 -1
- package/dist/{glob-DluQFSw1.js → output-cap-kBUHBlnq.js} +50 -2
- package/dist/output-cap-kBUHBlnq.js.map +1 -0
- package/dist/presets.d.ts +1 -2
- package/dist/presets.js +1 -1
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/anthropic.js +1 -1
- package/dist/providers/arcee.d.ts +1 -1
- package/dist/providers/arcee.js +1 -1
- package/dist/providers/baseten.d.ts +1 -1
- package/dist/providers/baseten.js +1 -1
- package/dist/providers/cerebras.d.ts +1 -1
- package/dist/providers/cerebras.js +1 -1
- package/dist/providers/local.d.ts +1 -1
- package/dist/providers/local.js +1 -1
- package/dist/providers/openai-compat.d.ts +1 -1
- package/dist/providers/openai-compat.js +1 -1
- package/dist/providers/openai.d.ts +1 -1
- package/dist/providers/openai.js +3 -3
- package/dist/providers/openrouter.d.ts +1 -1
- package/dist/providers/openrouter.js +1 -1
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers/xai.js +1 -1
- package/dist/{providers-DYXj2LcE.js → providers-z6LDMAr3.js} +3 -3
- package/dist/{providers-DYXj2LcE.js.map → providers-z6LDMAr3.js.map} +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +4 -4
- package/dist/{read-state-BymF41Jb.js → read-state-Dq_TXUX1.js} +2 -2
- package/dist/{read-state-BymF41Jb.js.map → read-state-Dq_TXUX1.js.map} +1 -1
- package/dist/{interpolate-BtIgcCuz.js → resolve-Cr8JSL_O.js} +562 -136
- package/dist/resolve-Cr8JSL_O.js.map +1 -0
- package/dist/restate.d.ts +2 -2
- package/dist/restate.js +2 -2
- package/dist/{sandbox-Dgy-m6UF.d.ts → sandbox-CgjG2VvQ.d.ts} +2 -2
- package/dist/{sandbox-Dgy-m6UF.d.ts.map → sandbox-CgjG2VvQ.d.ts.map} +1 -1
- package/dist/session/sqlite.d.ts +1 -1
- package/dist/{session-BRCsZsXa.js → session-CsdDIPY8.js} +108 -3
- package/dist/session-CsdDIPY8.js.map +1 -0
- package/dist/session.d.ts +2 -2
- package/dist/session.js +3 -3
- package/dist/skills-Bsb0rvWI.js +295 -0
- package/dist/skills-Bsb0rvWI.js.map +1 -0
- package/dist/skills.d.ts +2 -3
- package/dist/skills.js +3 -24
- package/dist/{errors-CkTvg97v.d.ts → timeout-8vSIRjzl.d.ts} +10 -2
- package/dist/timeout-8vSIRjzl.d.ts.map +1 -0
- package/dist/{timeout-kGGSXagK.js → timeout-BDetbuN6.js} +59 -2
- package/dist/timeout-BDetbuN6.js.map +1 -0
- package/dist/tool-formatters-DY0TDb1r.d.ts +378 -0
- package/dist/tool-formatters-DY0TDb1r.d.ts.map +1 -0
- package/dist/tools/fetch-url.d.ts +1 -1
- package/dist/tools/web-search.d.ts +1 -1
- package/dist/tools.d.ts +2 -3
- package/dist/tools.js +3 -4
- package/dist/{transcript-anchors-BEKMYhfo.d.ts → transcript-anchors-Cb-bDbNH.d.ts} +231 -638
- package/dist/transcript-anchors-Cb-bDbNH.d.ts.map +1 -0
- package/dist/{transcript-anchors-DR4URysA.js → transcript-anchors-DSRPWjiH.js} +189 -984
- package/dist/transcript-anchors-DSRPWjiH.js.map +1 -0
- package/dist/tui.d.ts +329 -11
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +5367 -1418
- package/dist/tui.js.map +1 -1
- package/dist/{turn-operations-BhglWus_.d.ts → turn-operations-CgMROLsr.d.ts} +29 -4
- package/dist/turn-operations-CgMROLsr.d.ts.map +1 -0
- package/dist/{turn-operations-tG0vuBNc.js → turn-operations-Dq9Kx7m2.js} +321 -81
- package/dist/turn-operations-Dq9Kx7m2.js.map +1 -0
- package/dist/{types-BqdTeBaC.d.ts → types-BDccavwj.d.ts} +42 -1
- package/dist/types-BDccavwj.d.ts.map +1 -0
- package/dist/{types-CyVGdbia.js → types-BIarq1qE.js} +90 -2
- package/dist/types-BIarq1qE.js.map +1 -0
- package/dist/types.d.ts +5 -6
- package/dist/types.js +1 -1
- package/dist/{xai-D9tfkrIe.js → xai-B_e6TOA8.js} +2 -2
- package/dist/{xai-D9tfkrIe.js.map → xai-B_e6TOA8.js.map} +1 -1
- package/docs/EXECUTION_CONTEXT.md +16 -0
- package/docs/EXTENSIONS.md +1063 -0
- package/docs/SKILL.md +16 -0
- package/docs/TUI.md +4 -0
- package/package.json +12 -3
- package/dist/agent-DCtsviti.d.ts +0 -6955
- package/dist/agent-DCtsviti.d.ts.map +0 -1
- package/dist/agent-DyI0YsAR.js.map +0 -1
- package/dist/auth-D9uj0nNr.js.map +0 -1
- package/dist/context-breakdown-kO-pDsay.js.map +0 -1
- package/dist/contexts-Lzf5huID.js.map +0 -1
- package/dist/errors-CkTvg97v.d.ts.map +0 -1
- package/dist/glob-DluQFSw1.js.map +0 -1
- package/dist/glob-shell-rJMoCIGb.js +0 -21
- package/dist/glob-shell-rJMoCIGb.js.map +0 -1
- package/dist/index-B3ciFUZx.d.ts.map +0 -1
- package/dist/index-CIbemeZd.d.ts +0 -316
- package/dist/index-CIbemeZd.d.ts.map +0 -1
- package/dist/index-DsIW6pmv.d.ts +0 -2738
- package/dist/index-DsIW6pmv.d.ts.map +0 -1
- package/dist/interpolate-BtIgcCuz.js.map +0 -1
- package/dist/logger-Ktm-lj1s.js.map +0 -1
- package/dist/logger-mw-311EC.d.ts +0 -102
- package/dist/logger-mw-311EC.d.ts.map +0 -1
- package/dist/login-CCA-1lgK.js +0 -267
- package/dist/login-CCA-1lgK.js.map +0 -1
- package/dist/messages-CozesxbB.js.map +0 -1
- package/dist/policy-DcGlpaNs.d.ts +0 -129
- package/dist/policy-DcGlpaNs.d.ts.map +0 -1
- package/dist/presets-DtyUA1-S.js +0 -114
- package/dist/presets-DtyUA1-S.js.map +0 -1
- package/dist/run-summary-BExU5Flb.d.ts +0 -249
- package/dist/run-summary-BExU5Flb.d.ts.map +0 -1
- package/dist/session-BRCsZsXa.js.map +0 -1
- package/dist/shell-quote-BmnhZmdM.js +0 -33
- package/dist/shell-quote-BmnhZmdM.js.map +0 -1
- package/dist/skills.js.map +0 -1
- package/dist/timeout-CpFm0jJ6.d.ts +0 -10
- package/dist/timeout-CpFm0jJ6.d.ts.map +0 -1
- package/dist/timeout-kGGSXagK.js.map +0 -1
- package/dist/tool-formatters-CpCEWwKt.d.ts +0 -1525
- package/dist/tool-formatters-CpCEWwKt.d.ts.map +0 -1
- package/dist/tools-NSzbC6Nr.js +0 -1739
- package/dist/tools-NSzbC6Nr.js.map +0 -1
- package/dist/transcript-anchors-BEKMYhfo.d.ts.map +0 -1
- package/dist/transcript-anchors-DR4URysA.js.map +0 -1
- package/dist/turn-operations-BhglWus_.d.ts.map +0 -1
- package/dist/turn-operations-tG0vuBNc.js.map +0 -1
- package/dist/types-BqdTeBaC.d.ts.map +0 -1
- package/dist/types-CyVGdbia.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"glob-DluQFSw1.js","names":[],"sources":["../src/contexts/git-ls-files.ts","../src/contexts/git-ls-files-local.ts","../src/contexts/glob.ts"],"sourcesContent":["/**\n * Pure (node-free) `git ls-files` helpers shared by the gitignore-aware paths\n * of the `glob` and `grep` tools.\n *\n * `git ls-files --cached --others --exclude-standard` lists tracked files plus\n * untracked-but-not-ignored files, applying `.gitignore`, `.git/info/exclude`,\n * and the user's global excludes. Git never descends ignored directories\n * (`node_modules`, build output, …), so this is both correct and sub-second on\n * large repos — unlike a raw filesystem walk.\n *\n * This module has ZERO node imports so it can be pulled into edge/workerd\n * bundles (e.g. via the `grep` tool, which drives git through the execution\n * context's `exec` seam). The node-spawn variant lives in\n * `./git-ls-files-local`.\n */\n\n/** Argv for `git ls-files`, NUL-delimited so paths with newlines stay intact. */\nexport const GIT_LS_FILES_ARGS = ['ls-files', '--cached', '--others', '--exclude-standard', '-z'] as const\n\n/** The same invocation as a shell command string for the `exec` seam. */\nexport const GIT_LS_FILES_COMMAND = `git ${GIT_LS_FILES_ARGS.join(' ')}`\n\n/** Split NUL-delimited `git ls-files -z` output into paths. */\nexport function parseGitLsFiles(stdout: string): string[] {\n return stdout.split('\\0').filter(p => p.length > 0)\n}\n","/**\n * Node-spawn `git ls-files` runner used by the local process context's glob.\n *\n * Kept separate from `./git-ls-files` (which stays node-free for edge bundles)\n * because this leg imports `node:child_process`.\n */\n\nimport { spawn } from 'node:child_process'\nimport { GIT_LS_FILES_ARGS, parseGitLsFiles } from './git-ls-files'\n\n/**\n * Run `git ls-files` in `cwd` and return its non-ignored paths (relative to\n * `cwd`). Returns `null` when the directory is not a git repo, git is missing,\n * or the call aborts — callers treat `null` as \"fall back to a filesystem\n * walk\". Never throws.\n */\nexport async function gitListFilesLocal(cwd: string, signal?: AbortSignal): Promise<string[] | null> {\n return new Promise<string[] | null>((resolveP) => {\n let child: ReturnType<typeof spawn>\n try {\n child = spawn('git', [...GIT_LS_FILES_ARGS], { cwd, stdio: ['ignore', 'pipe', 'pipe'] })\n }\n catch {\n resolveP(null)\n return\n }\n if (signal?.aborted) {\n child.kill('SIGTERM')\n resolveP(null)\n return\n }\n const stdoutChunks: string[] = []\n const onAbort = () => child.kill('SIGTERM')\n signal?.addEventListener('abort', onAbort, { once: true })\n child.stdout?.setEncoding('utf8')\n child.stdout?.on('data', chunk => stdoutChunks.push(chunk as string))\n child.on('error', () => {\n signal?.removeEventListener('abort', onAbort)\n resolveP(null)\n })\n child.on('close', (code) => {\n signal?.removeEventListener('abort', onAbort)\n if (code !== 0 || signal?.aborted) {\n resolveP(null)\n return\n }\n resolveP(parseGitLsFiles(stdoutChunks.join('')))\n })\n })\n}\n","import type { ListFileMetadata } from './types'\nimport { readdir, stat } from 'node:fs/promises'\nimport { dirname, resolve, sep } from 'node:path'\nimport { lazyAsync } from '../lazy'\nimport { gitListFilesLocal } from './git-ls-files-local'\n\ntype NodeGlob = (pattern: string, options: { cwd: string }) => AsyncIterable<string>\n\ninterface BunGlobInstance { scan: (options: { cwd: string, onlyFiles?: boolean, dot?: boolean }) => AsyncIterable<string> }\ntype BunGlobCtor = new (pattern: string) => BunGlobInstance\n\nconst loadNativeNodeGlob = lazyAsync(async (): Promise<NodeGlob | undefined> => {\n const candidate = (await import('node:fs/promises') as { glob?: unknown }).glob\n return typeof candidate === 'function' ? candidate as NodeGlob : undefined\n})\n\nfunction forcePortable(): boolean {\n return (globalThis as { __zidaneForcePortableGlobForTests?: boolean }).__zidaneForcePortableGlobForTests === true\n}\n\nasync function loadNodeGlob(): Promise<NodeGlob | undefined> {\n if (forcePortable())\n return undefined\n return loadNativeNodeGlob()\n}\n\n/**\n * Bun's `node:fs/promises.glob` buffers the entire directory walk before\n * yielding (so an early `limit` break never fires — a broad `**` pattern over\n * a large `node_modules` hangs). `Bun.Glob().scan()` streams incrementally and\n * is the fast path under Bun. Returns undefined off Bun or when tests force the\n * portable walker.\n */\nfunction loadBunGlob(): BunGlobCtor | undefined {\n if (forcePortable())\n return undefined\n const bun = (globalThis as { Bun?: { Glob?: unknown } }).Bun\n return bun && typeof bun.Glob === 'function' ? bun.Glob as BunGlobCtor : undefined\n}\n\nfunction escapeRegexChar(char: string): string {\n return /[\\\\^$.*+?()[\\]{}|]/.test(char) ? `\\\\${char}` : char\n}\n\nexport function expandBraces(pattern: string): string[] {\n const start = pattern.indexOf('{')\n if (start === -1)\n return [pattern]\n const end = pattern.indexOf('}', start + 1)\n if (end === -1)\n return [pattern]\n const body = pattern.slice(start + 1, end)\n if (!body || !body.includes(','))\n return [pattern]\n return body\n .split(',')\n .flatMap(part => expandBraces(`${pattern.slice(0, start)}${part}${pattern.slice(end + 1)}`))\n}\n\nexport function globPatternToRegex(pattern: string): RegExp {\n let out = '^'\n for (let i = 0; i < pattern.length; i++) {\n const char = pattern[i]\n const next = pattern[i + 1]\n if (char === '*') {\n if (next === '*') {\n const after = pattern[i + 2]\n if (after === '/') {\n out += '(?:[^/]+/)*'\n i += 2\n }\n else {\n out += '.*'\n i += 1\n }\n }\n else {\n out += '[^/]*'\n }\n }\n else if (char === '?') {\n out += '[^/]'\n }\n else if (char === '[') {\n const end = pattern.indexOf(']', i + 1)\n if (end === -1) {\n out += '\\\\['\n }\n else {\n let cls = pattern.slice(i + 1, end)\n if (cls.startsWith('!'))\n cls = `^${cls.slice(1)}`\n out += `[${cls}]`\n i = end\n }\n }\n else {\n out += escapeRegexChar(char)\n }\n }\n return new RegExp(`${out}$`)\n}\n\nexport function globLiteralPrefix(pattern: string): string {\n const firstMeta = pattern.search(/[*?[\\]{}]/)\n const prefix = firstMeta === -1 ? dirname(pattern) : pattern.slice(0, firstMeta)\n const slash = prefix.lastIndexOf('/')\n if (slash === -1)\n return ''\n return prefix.slice(0, slash)\n}\n\nexport function hasGlobPattern(path: string): boolean {\n return /[*?[\\]{}]/.test(path)\n}\n\n/**\n * True when a pattern can match files outside `cwd` — an absolute path, a\n * Windows drive, or any `..` segment. Such patterns can't use the `git\n * ls-files` path (git only knows files under the repo) and fall back to the\n * filesystem walk.\n */\nfunction patternEscapesCwd(pattern: string): boolean {\n const norm = pattern.split(sep).join('/')\n if (norm.startsWith('/') || /^[a-z]:/i.test(norm))\n return true\n return norm.split('/').includes('..')\n}\n\nasync function addMetadata(cwd: string, rel: string, includeMetadata: boolean): Promise<ListFileMetadata | null> {\n try {\n const s = await stat(resolve(cwd, rel))\n if (!s.isFile())\n return null\n return includeMetadata ? { path: rel, size: s.size, mtimeMs: s.mtimeMs } : { path: rel }\n }\n catch {\n return null\n }\n}\n\nfunction compilePattern(pattern: string): RegExp[] {\n return expandBraces(pattern.split(sep).join('/')).map(globPatternToRegex)\n}\n\n/** Match the (already non-ignored) `git ls-files` set against the glob pattern. */\nasync function matchGitFiles(\n gitFiles: readonly string[],\n pattern: string,\n cwd: string,\n limit: number,\n includeMetadata: boolean,\n signal: AbortSignal | undefined,\n): Promise<ListFileMetadata[]> {\n const regexes = compilePattern(pattern)\n const out: ListFileMetadata[] = []\n for (const rel of gitFiles) {\n if (signal?.aborted || out.length >= limit)\n break\n if (!regexes.some(regex => regex.test(rel)))\n continue\n out.push(includeMetadata ? await addMetadata(cwd, rel, true) ?? { path: rel } : { path: rel })\n }\n return out.sort((a, b) => a.path.localeCompare(b.path))\n}\n\n/** Depth-first walk that matches against `regexes` and stops at `limit`. */\nasync function walkMatch(\n root: string,\n prefix: string,\n regexes: RegExp[],\n cwd: string,\n limit: number,\n includeMetadata: boolean,\n signal: AbortSignal | undefined,\n out: ListFileMetadata[],\n): Promise<void> {\n if (out.length >= limit || signal?.aborted)\n return\n let entries: Array<{ name: string, isDirectory: () => boolean, isFile: () => boolean }>\n try {\n entries = await readdir(resolve(root, prefix), { encoding: 'utf8', withFileTypes: true })\n }\n catch {\n return\n }\n for (const entry of entries) {\n if (out.length >= limit || signal?.aborted)\n return\n const rel = prefix ? `${prefix}/${entry.name}` : entry.name\n if (entry.isDirectory()) {\n await walkMatch(root, rel, regexes, cwd, limit, includeMetadata, signal, out)\n }\n else if (entry.isFile() && regexes.some(regex => regex.test(rel))) {\n out.push(includeMetadata ? await addMetadata(cwd, rel, true) ?? { path: rel } : { path: rel })\n }\n }\n}\n\nasync function globPortable(\n pattern: string,\n cwd: string,\n limit: number,\n includeMetadata: boolean,\n signal: AbortSignal | undefined,\n): Promise<ListFileMetadata[]> {\n const normalized = pattern.split(sep).join('/')\n const startPrefix = globLiteralPrefix(normalized)\n const regexes = expandBraces(normalized).map(globPatternToRegex)\n const out: ListFileMetadata[] = []\n await walkMatch(cwd, startPrefix, regexes, cwd, limit, includeMetadata, signal, out)\n return out.sort((a, b) => a.path.localeCompare(b.path))\n}\n\nasync function collectFromIterable(\n iter: AsyncIterable<string>,\n cwd: string,\n limit: number,\n includeMetadata: boolean,\n signal: AbortSignal | undefined,\n): Promise<ListFileMetadata[] | null> {\n const results: ListFileMetadata[] = []\n // A native scan can throw mid-iteration on a pathological tree (e.g. a\n // recursive symlink cycle → ENAMETOOLONG) and there's no way to resume it.\n // Signal the caller (null) to recover via the portable walk, which recurses\n // only into real directories and isolates per-directory errors.\n try {\n for await (const rel of iter) {\n if (signal?.aborted)\n break\n const entry = await addMetadata(cwd, rel, includeMetadata)\n if (!entry)\n continue\n results.push(entry)\n if (results.length >= limit)\n break\n }\n }\n catch {\n return null\n }\n return results.sort((a, b) => a.path.localeCompare(b.path))\n}\n\nfunction globViaBun(\n BunGlob: BunGlobCtor,\n pattern: string,\n cwd: string,\n limit: number,\n includeMetadata: boolean,\n signal: AbortSignal | undefined,\n): Promise<ListFileMetadata[] | null> {\n // `dot: true` keeps dotfile matching consistent with the Node + portable\n // paths; `onlyFiles: true` mirrors their file-only results.\n const scan = new BunGlob(pattern).scan({ cwd, onlyFiles: true, dot: true })\n return collectFromIterable(scan, cwd, limit, includeMetadata, signal)\n}\n\nexport async function globFilesLocal(\n pattern: string,\n cwd: string,\n options: { limit: number, metadata?: boolean, gitignore?: boolean, signal?: AbortSignal },\n): Promise<ListFileMetadata[]> {\n const includeMetadata = options.metadata === true\n const { limit, signal } = options\n\n // Default path: intersect the pattern with git's non-ignored file set. Git\n // skips `.gitignore`d trees (`node_modules`, build dirs) entirely, so this is\n // both correct and fast — and never triggers the Bun `fs.glob` hang. The\n // test-only force-portable flag also bypasses it so the filesystem walker\n // stays directly exercisable.\n if (options.gitignore !== false && !forcePortable() && !patternEscapesCwd(pattern)) {\n const gitFiles = await gitListFilesLocal(cwd, signal)\n if (gitFiles)\n return matchGitFiles(gitFiles, pattern, cwd, limit, includeMetadata, signal)\n }\n\n // Fallback path: filesystem glob (gitignore disabled, not a git repo, or the\n // pattern escapes cwd). Prefer a fast native scanner; if it throws on a\n // pathological tree (null), recover via the portable walk.\n const bunGlob = loadBunGlob()\n if (bunGlob) {\n const viaBun = await globViaBun(bunGlob, pattern, cwd, limit, includeMetadata, signal)\n if (viaBun)\n return viaBun\n }\n else {\n const nodeGlob = await loadNodeGlob()\n if (nodeGlob) {\n const viaNode = await collectFromIterable(nodeGlob(pattern, { cwd }), cwd, limit, includeMetadata, signal)\n if (viaNode)\n return viaNode\n }\n }\n\n return globPortable(pattern, cwd, limit, includeMetadata, signal)\n}\n\n// `globFilesViaShell` moved to `./glob-shell` (node-free) so remote-only\n// contexts can import it without pulling this module's `node:fs` imports.\n// Re-exported here for back-compat.\nexport { globFilesViaShell } from './glob-shell'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiBA,MAAa,oBAAoB;CAAC;CAAY;CAAY;CAAY;CAAsB;AAAI;;AAGhG,MAAa,uBAAuB,OAAO,kBAAkB,KAAK,GAAG;;AAGrE,SAAgB,gBAAgB,QAA0B;CACxD,OAAO,OAAO,MAAM,IAAI,EAAE,QAAO,MAAK,EAAE,SAAS,CAAC;AACpD;;;;;;;;;;;;;;;ACTA,eAAsB,kBAAkB,KAAa,QAAgD;CACnG,OAAO,IAAI,SAA0B,aAAa;EAChD,IAAI;EACJ,IAAI;GACF,QAAQ,MAAM,OAAO,CAAC,GAAG,iBAAiB,GAAG;IAAE;IAAK,OAAO;KAAC;KAAU;KAAQ;IAAM;GAAE,CAAC;EACzF,QACM;GACJ,SAAS,IAAI;GACb;EACF;EACA,IAAI,QAAQ,SAAS;GACnB,MAAM,KAAK,SAAS;GACpB,SAAS,IAAI;GACb;EACF;EACA,MAAM,eAAyB,CAAC;EAChC,MAAM,gBAAgB,MAAM,KAAK,SAAS;EAC1C,QAAQ,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;EACzD,MAAM,QAAQ,YAAY,MAAM;EAChC,MAAM,QAAQ,GAAG,SAAQ,UAAS,aAAa,KAAK,KAAe,CAAC;EACpE,MAAM,GAAG,eAAe;GACtB,QAAQ,oBAAoB,SAAS,OAAO;GAC5C,SAAS,IAAI;EACf,CAAC;EACD,MAAM,GAAG,UAAU,SAAS;GAC1B,QAAQ,oBAAoB,SAAS,OAAO;GAC5C,IAAI,SAAS,KAAK,QAAQ,SAAS;IACjC,SAAS,IAAI;IACb;GACF;GACA,SAAS,gBAAgB,aAAa,KAAK,EAAE,CAAC,CAAC;EACjD,CAAC;CACH,CAAC;AACH;;;ACtCA,MAAM,qBAAqB,UAAU,YAA2C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ACF,OAAO;CACX,OACK;EACH,MAAM,WAAW,MAAM,aAAa;EACpC,IAAI,UAAU;GACZ,MAAM,UAAU,MAAM,oBAAoB,SAAS,SAAS,EAAE,IAAI,CAAC,GAAG,KAAK,OAAO,iBAAiB,MAAM;GACzG,IAAI,SACF,OAAO;EACX;CACF;CAEA,OAAO,aAAa,SAAS,KAAK,OAAO,iBAAiB,MAAM;AAClE"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
//#region src/contexts/glob-shell.ts
|
|
2
|
-
const SAFE_GLOB_PATTERN_RE = /^[\w./*?[\]{}!,^@+-]+$/;
|
|
3
|
-
/**
|
|
4
|
-
* Match files under the execution context's cwd by shelling out to `find`.
|
|
5
|
-
* The `exec` callback runs the command in the target context (sandbox, docker,
|
|
6
|
-
* remote); results are returned as cwd-relative paths, sorted, capped at
|
|
7
|
-
* `limit`.
|
|
8
|
-
*/
|
|
9
|
-
async function globFilesViaShell(pattern, exec, limit) {
|
|
10
|
-
if (!SAFE_GLOB_PATTERN_RE.test(pattern)) throw new Error("Glob pattern contains unsupported characters (shell fallback only allows path/glob metacharacters)");
|
|
11
|
-
const result = await exec(!pattern.includes("/") ? `find . -type f -name '${pattern}'` : `find . -type f -path './${pattern}'`);
|
|
12
|
-
if (result.exitCode !== 0 && !result.stdout.trim()) {
|
|
13
|
-
const detail = result.stderr.trim() || `find exited with code ${result.exitCode}`;
|
|
14
|
-
throw new Error(`file matching requires \`find\` in the execution context (${detail}). Use the \`shell\` tool, or \`list_files\` for a single directory.`);
|
|
15
|
-
}
|
|
16
|
-
return result.stdout.split("\n").map((line) => line.replace(/^\.\//, "")).filter((line) => line.length > 0).sort().slice(0, limit);
|
|
17
|
-
}
|
|
18
|
-
//#endregion
|
|
19
|
-
export { globFilesViaShell as t };
|
|
20
|
-
|
|
21
|
-
//# sourceMappingURL=glob-shell-rJMoCIGb.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"glob-shell-rJMoCIGb.js","names":[],"sources":["../src/contexts/glob-shell.ts"],"sourcesContent":["/**\n * Shell-driven file matching — the node-free half of `./glob`.\n *\n * `globFilesViaShell` runs `find` through a caller-supplied `exec` callback, so\n * it has ZERO Node imports (no `node:fs`, no `node:child_process`). It lives in\n * its own module so remote-only contexts (`createSandboxContext`) can import it\n * without dragging the local-filesystem glob (and its `node:fs/promises`\n * imports) into a workerd/edge bundle. `./glob` re-exports it for back-compat.\n */\n\nimport type { ExecResult } from './types'\n\nconst SAFE_GLOB_PATTERN_RE = /^[\\w./*?[\\]{}!,^@+-]+$/\n\n/**\n * Match files under the execution context's cwd by shelling out to `find`.\n * The `exec` callback runs the command in the target context (sandbox, docker,\n * remote); results are returned as cwd-relative paths, sorted, capped at\n * `limit`.\n */\nexport async function globFilesViaShell(\n pattern: string,\n exec: (command: string) => Promise<ExecResult>,\n limit: number,\n): Promise<string[]> {\n if (!SAFE_GLOB_PATTERN_RE.test(pattern))\n throw new Error('Glob pattern contains unsupported characters (shell fallback only allows path/glob metacharacters)')\n\n const useBasename = !pattern.includes('/')\n const finder = useBasename\n ? `find . -type f -name '${pattern}'`\n : `find . -type f -path './${pattern}'`\n const result = await exec(finder)\n if (result.exitCode !== 0 && !result.stdout.trim()) {\n const detail = result.stderr.trim() || `find exited with code ${result.exitCode}`\n throw new Error(`file matching requires \\`find\\` in the execution context (${detail}). Use the \\`shell\\` tool, or \\`list_files\\` for a single directory.`)\n }\n\n return result.stdout\n .split('\\n')\n .map(line => line.replace(/^\\.\\//, ''))\n .filter(line => line.length > 0)\n .sort()\n .slice(0, limit)\n}\n"],"mappings":";AAYA,MAAM,uBAAuB;;;;;;;AAQ7B,eAAsB,kBACpB,SACA,MACA,OACmB;CACnB,IAAI,CAAC,qBAAqB,KAAK,OAAO,GACpC,MAAM,IAAI,MAAM,oGAAoG;CAMtH,MAAM,SAAS,MAAM,KAHN,CADM,QAAQ,SAAS,GAAG,IAErC,yBAAyB,QAAQ,KACjC,2BAA2B,QAAQ,EACP;CAChC,IAAI,OAAO,aAAa,KAAK,CAAC,OAAO,OAAO,KAAK,GAAG;EAClD,MAAM,SAAS,OAAO,OAAO,KAAK,KAAK,yBAAyB,OAAO;EACvE,MAAM,IAAI,MAAM,6DAA6D,OAAO,qEAAqE;CAC3J;CAEA,OAAO,OAAO,OACX,MAAM,IAAI,EACV,KAAI,SAAQ,KAAK,QAAQ,SAAS,EAAE,CAAC,EACrC,QAAO,SAAQ,KAAK,SAAS,CAAC,EAC9B,KAAK,EACL,MAAM,GAAG,KAAK;AACnB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-B3ciFUZx.d.ts","names":[],"sources":["../src/contexts/process.ts"],"mappings":";;;iBA2HgB,oBAAA,CAAqB,MAAA,GAAS,WAAA,GAAc,gBAAgB"}
|
package/dist/index-CIbemeZd.d.ts
DELETED
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
import { B as SkillSource, L as SkillConfig, R as SkillDiagnostic, V as SkillsConfig, f as SkillActivationState, r as AgentHooks } from "./agent-DCtsviti.js";
|
|
2
|
-
import { c as ExecutionContext, l as ExecutionHandle } from "./types-BqdTeBaC.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
|
-
* - One-level nested block lists, `key:` followed by indented `- item`
|
|
53
|
-
* lines (for `allowed-tools` and any future array fields). Items are
|
|
54
|
-
* unquoted with the same rules as scalar values.
|
|
55
|
-
* - Flow-style scalars are preserved verbatim — interpretation (e.g.
|
|
56
|
-
* `[a, b]` as a list) is left to per-field consumers via
|
|
57
|
-
* {@link takeStringOrArray}.
|
|
58
|
-
* - Lenient recovery from unquoted-colon values (e.g.
|
|
59
|
-
* `description: Use when: the user asks …`) via a quote-wrap retry.
|
|
60
|
-
*/
|
|
61
|
-
declare function parseFrontmatter(content: string): ParsedSkillFile;
|
|
62
|
-
interface ParseSkillOptions {
|
|
63
|
-
/** Source tag to attach to the returned SkillConfig. */
|
|
64
|
-
source?: SkillSource;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Parse a SKILL.md file into a SkillConfig (lenient).
|
|
68
|
-
*
|
|
69
|
-
* Returns `null` only when the skill is fundamentally unusable:
|
|
70
|
-
* - The file is missing
|
|
71
|
-
* - The description is absent (required by spec for disclosure)
|
|
72
|
-
*
|
|
73
|
-
* All other issues are surfaced as `SkillConfig.diagnostics` with severity
|
|
74
|
-
* `warning`. Deprecated top-level fields (`paths`, `model`, `thinking`) are
|
|
75
|
-
* auto-migrated into `metadata['zidane.*']`.
|
|
76
|
-
*/
|
|
77
|
-
declare function parseSkillFile(filePath: string, options?: ParseSkillOptions): Promise<SkillConfig | null>;
|
|
78
|
-
/** A scan path paired with the source tag that should be attached to any skills found in it. */
|
|
79
|
-
interface SourcedScanPath {
|
|
80
|
-
path: string;
|
|
81
|
-
source: SkillSource;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Return the default scan paths tagged by source. Project-scope paths come
|
|
85
|
-
* first; their skills therefore win on name collisions against user-scope
|
|
86
|
-
* skills (first-found wins in discovery).
|
|
87
|
-
*/
|
|
88
|
-
declare function getDefaultScanPaths(): SourcedScanPath[];
|
|
89
|
-
/**
|
|
90
|
-
* Infer a source tag for a user-provided scan path.
|
|
91
|
-
* Paths under `$HOME` are treated as 'user'; everything else as 'project'.
|
|
92
|
-
*/
|
|
93
|
-
declare function inferSource(path: string): SkillSource;
|
|
94
|
-
/**
|
|
95
|
-
* Discover skills from sourced filesystem paths.
|
|
96
|
-
* Each path is scanned for subdirectories containing SKILL.md.
|
|
97
|
-
* Earlier paths have higher priority (first-found wins on name collision).
|
|
98
|
-
*
|
|
99
|
-
* `signal` is checked between each `parseSkillFile` so a rapid `cwd` switch
|
|
100
|
-
* in the host (TUI / GUI) can stop a long scan without leaking I/O. Aborts
|
|
101
|
-
* reject with the signal's `reason` (or a default `AbortError`) — same shape
|
|
102
|
-
* `AbortSignal.throwIfAborted()` produces in modern runtimes.
|
|
103
|
-
*/
|
|
104
|
-
declare function discoverSkills(paths: SourcedScanPath[], signal?: AbortSignal): Promise<SkillConfig[]>;
|
|
105
|
-
//#endregion
|
|
106
|
-
//#region src/skills/interpolate.d.ts
|
|
107
|
-
/**
|
|
108
|
-
* Replace every !\`command\` pattern with a static placeholder, without
|
|
109
|
-
* executing anything. Used when shell interpolation is disabled
|
|
110
|
-
* (`SkillsConfig.allowShellInterpolation: false`): skill content can be
|
|
111
|
-
* third-party input, and running its embedded commands on activation
|
|
112
|
-
* bypasses the allowed-tools gate.
|
|
113
|
-
*/
|
|
114
|
-
declare function stripShellInterpolations(instructions: string): string;
|
|
115
|
-
interface InterpolateShellCommandsOptions {
|
|
116
|
-
/**
|
|
117
|
-
* Called once per !\`command\` that failed (non-zero exit or exec throw)
|
|
118
|
-
* with the command text and the inline placeholder it was replaced with.
|
|
119
|
-
* Lets callers surface a visible warning instead of activation silently
|
|
120
|
-
* proceeding on partial content.
|
|
121
|
-
*/
|
|
122
|
-
onFailure?: (command: string, placeholder: string) => void;
|
|
123
|
-
/**
|
|
124
|
-
* Optional per-command approval gate, invoked BEFORE each !\`command\` runs.
|
|
125
|
-
* Return `false` to skip executing that command — it is replaced with a
|
|
126
|
-
* `[shell interpolation not approved]` placeholder instead of its output.
|
|
127
|
-
* When omitted, every command runs (back-compat).
|
|
128
|
-
*/
|
|
129
|
-
approve?: (command: string) => boolean | Promise<boolean>;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Interpolate shell commands in skill instructions.
|
|
133
|
-
*
|
|
134
|
-
* Runs each !\`command\` through the execution context and replaces
|
|
135
|
-
* the placeholder with the command's stdout. If a command fails,
|
|
136
|
-
* the placeholder is replaced with an error message (and
|
|
137
|
-
* `options.onFailure` is notified when provided).
|
|
138
|
-
*
|
|
139
|
-
* @param instructions - Raw skill instructions with potential !\`command\` patterns
|
|
140
|
-
* @param execution - The execution context to run commands in
|
|
141
|
-
* @param handle - The active execution handle
|
|
142
|
-
* @returns Instructions with all !\`command\` patterns replaced by output
|
|
143
|
-
*/
|
|
144
|
-
declare function interpolateShellCommands(instructions: string, execution: ExecutionContext, handle: ExecutionHandle, options?: InterpolateShellCommandsOptions): Promise<string>;
|
|
145
|
-
//#endregion
|
|
146
|
-
//#region src/skills/resolve.d.ts
|
|
147
|
-
/**
|
|
148
|
-
* Resolved-skills bundle: the materialized list plus a `cleanup` fn that
|
|
149
|
-
* removes any temporary directory created for `config.write` skills.
|
|
150
|
-
*
|
|
151
|
-
* Inline skills must live on disk for the lifetime of the agent (the
|
|
152
|
-
* `skills_read` / `skills_run_script` tools resolve relative paths against
|
|
153
|
-
* `baseDir`), so cleanup is deferred to `agent.destroy()`. When no temp
|
|
154
|
-
* directory was created, `cleanup` is a no-op.
|
|
155
|
-
*/
|
|
156
|
-
interface ResolvedSkillsBundle {
|
|
157
|
-
skills: SkillConfig[];
|
|
158
|
-
cleanup: () => void;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Resolve all skills from a SkillsConfig:
|
|
162
|
-
*
|
|
163
|
-
* 1. Materialize `config.write` entries to a temp directory, tagged as `inline`
|
|
164
|
-
* 2. Combine with default + user-provided scan paths (project-first, user-next)
|
|
165
|
-
* 3. Run lenient disk discovery
|
|
166
|
-
* 4. Merge with any host-provided `config.catalog`. Catalog entries seed the
|
|
167
|
-
* resolution map FIRST, so they shadow disk-discovered skills with the
|
|
168
|
-
* same name (shadow diagnostic attached to the winner — same shape as
|
|
169
|
-
* the disk-vs-disk collision case).
|
|
170
|
-
* 5. Apply filters: optional project-skill trust gate, `exclude`,
|
|
171
|
-
* `enabled` allowlist
|
|
172
|
-
*
|
|
173
|
-
* Returns `{ skills, cleanup }` — call `cleanup()` on agent destroy to remove
|
|
174
|
-
* the temp directory created for inline `config.write` skills. The agent
|
|
175
|
-
* factory wires this automatically; standalone callers must invoke it
|
|
176
|
-
* themselves to avoid leaking OS temp.
|
|
177
|
-
*/
|
|
178
|
-
declare function resolveSkills(config: SkillsConfig): Promise<ResolvedSkillsBundle>;
|
|
179
|
-
//#endregion
|
|
180
|
-
//#region src/skills/validate.d.ts
|
|
181
|
-
/**
|
|
182
|
-
* A single issue surfaced by skill-authoring validation.
|
|
183
|
-
* Distinct from `ValidationResult` in `tools/validation.ts` (tool-input JSON
|
|
184
|
-
* schema validation) — different domain, different module.
|
|
185
|
-
*/
|
|
186
|
-
interface SkillValidationIssue {
|
|
187
|
-
/** Stable machine-readable code for consumer matching. */
|
|
188
|
-
code: string;
|
|
189
|
-
/** Human-readable description. */
|
|
190
|
-
message: string;
|
|
191
|
-
/** Frontmatter field name the issue relates to, when applicable. */
|
|
192
|
-
field?: string;
|
|
193
|
-
}
|
|
194
|
-
interface SkillValidationResult {
|
|
195
|
-
valid: boolean;
|
|
196
|
-
errors: SkillValidationIssue[];
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Validate a skill name per the spec:
|
|
200
|
-
* - 1–64 characters
|
|
201
|
-
* - Lowercase alphanumeric + hyphens only
|
|
202
|
-
* - Must not start or end with a hyphen
|
|
203
|
-
* - Must not contain consecutive hyphens
|
|
204
|
-
*
|
|
205
|
-
* The parent-directory match is validated separately (it requires knowing the
|
|
206
|
-
* skill's `location`, which this function does not).
|
|
207
|
-
*/
|
|
208
|
-
declare function validateSkillName(name: string): boolean;
|
|
209
|
-
/**
|
|
210
|
-
* Strict validation for a skill that is about to be authored / written to disk.
|
|
211
|
-
* Rejects anything that would violate the spec. Use the lenient parser path
|
|
212
|
-
* (`parseSkillFile`) for loading third-party skills.
|
|
213
|
-
*/
|
|
214
|
-
declare function validateSkillForWrite(skill: SkillConfig): SkillValidationResult;
|
|
215
|
-
/**
|
|
216
|
-
* Validate that `relPath` stays inside `baseDir` when resolved.
|
|
217
|
-
*
|
|
218
|
-
* Rejects:
|
|
219
|
-
* - Absolute paths (`/etc/passwd`, `C:\…`)
|
|
220
|
-
* - Parent traversal (`..` segments that escape baseDir)
|
|
221
|
-
* - Null-byte tricks
|
|
222
|
-
*
|
|
223
|
-
* Returns `{ valid: true, absolutePath }` on success or `{ valid: false, error }`
|
|
224
|
-
* with a human-readable reason.
|
|
225
|
-
*/
|
|
226
|
-
declare function validateResourcePath(relPath: string, baseDir: string): {
|
|
227
|
-
valid: true;
|
|
228
|
-
absolutePath: string;
|
|
229
|
-
} | {
|
|
230
|
-
valid: false;
|
|
231
|
-
error: string;
|
|
232
|
-
};
|
|
233
|
-
/**
|
|
234
|
-
* Symlink-hardened variant of {@link validateResourcePath}: after the lexical
|
|
235
|
-
* check passes, resolve both the target and `baseDir` through `realpath` and
|
|
236
|
-
* re-confirm the target still lives under the skill directory. A symlink
|
|
237
|
-
* placed inside the skill dir pointing at e.g. `/etc/passwd` passes the
|
|
238
|
-
* lexical check but fails here.
|
|
239
|
-
*
|
|
240
|
-
* Falls back to the lexical verdict when `realpath` fails (target or baseDir
|
|
241
|
-
* not present on the LOCAL filesystem) — the common causes are a remote
|
|
242
|
-
* execution context (docker/sandbox, where the local realpath is meaningless
|
|
243
|
-
* and the remote side resolves the path itself) or a not-yet-existing file.
|
|
244
|
-
* The returned `absolutePath` is always the lexical one: it's what the
|
|
245
|
-
* execution context resolves; realpath here is verification only.
|
|
246
|
-
*/
|
|
247
|
-
declare function validateResourcePathReal(relPath: string, baseDir: string): Promise<{
|
|
248
|
-
valid: true;
|
|
249
|
-
absolutePath: string;
|
|
250
|
-
} | {
|
|
251
|
-
valid: false;
|
|
252
|
-
error: string;
|
|
253
|
-
}>;
|
|
254
|
-
/**
|
|
255
|
-
* Parse a single `allowed-tools` entry into its tool name + optional argument pattern.
|
|
256
|
-
*
|
|
257
|
-
* Examples:
|
|
258
|
-
* - `Read` → `{ tool: 'Read' }`
|
|
259
|
-
* - `Bash(git:*)` → `{ tool: 'Bash', argPrefix: 'git' }`
|
|
260
|
-
*/
|
|
261
|
-
declare function parseAllowedToolPattern(entry: string): {
|
|
262
|
-
tool: string;
|
|
263
|
-
argPrefix?: string;
|
|
264
|
-
} | null;
|
|
265
|
-
/**
|
|
266
|
-
* Check whether a tool call (identified by its wire/displayName and argument input)
|
|
267
|
-
* matches a skill's allow-list entry.
|
|
268
|
-
*
|
|
269
|
-
* Matching rules (Zidane's interpretation of the spec's unspecified syntax):
|
|
270
|
-
* - Exact match: displayName === pattern (no parens).
|
|
271
|
-
* - Prefix match: for `Tool(arg:*)`, displayName === 'Tool' AND **any** string
|
|
272
|
-
* value in the input object starts with `arg`. This is intentionally
|
|
273
|
-
* permissive: it doesn't depend on a convention about which property carries
|
|
274
|
-
* the "command" (schemas vary across tools), and for the common
|
|
275
|
-
* `shell({ command: 'git …' })` shape it behaves identically to a "primary
|
|
276
|
-
* string" rule.
|
|
277
|
-
* - For tools whose inputs carry no string values, the arg-match returns false.
|
|
278
|
-
*/
|
|
279
|
-
declare function matchesAllowedTool(displayName: string, input: Record<string, unknown>, pattern: string): boolean;
|
|
280
|
-
/**
|
|
281
|
-
* Test whether a tool call is allowed by the union of `allowedTools` across a set
|
|
282
|
-
* of active skills. Returns `true` when the union is empty (permissive default)
|
|
283
|
-
* OR when any entry matches.
|
|
284
|
-
*/
|
|
285
|
-
declare function isToolAllowedByUnion(displayName: string, input: Record<string, unknown>, union: readonly string[]): boolean;
|
|
286
|
-
//#endregion
|
|
287
|
-
//#region src/skills/writer.d.ts
|
|
288
|
-
/**
|
|
289
|
-
* Write a `SkillConfig` to disk as a proper skill directory with SKILL.md.
|
|
290
|
-
* Returns the path to the written SKILL.md file.
|
|
291
|
-
*
|
|
292
|
-
* Throws if the skill fails `validateSkillForWrite` — the authoring path is
|
|
293
|
-
* strict on purpose. For loading third-party skills, use `parseSkillFile`
|
|
294
|
-
* directly (lenient).
|
|
295
|
-
*/
|
|
296
|
-
declare function writeSkillToDisk(skill: SkillConfig, targetDir: string): string;
|
|
297
|
-
/**
|
|
298
|
-
* Write multiple `SkillConfig` objects to a target directory.
|
|
299
|
-
* Each skill gets its own subdirectory with a SKILL.md file.
|
|
300
|
-
* Returns the target directory path (for use as a scan path).
|
|
301
|
-
*/
|
|
302
|
-
declare function writeSkillsToDisk(skills: SkillConfig[], targetDir: string): string;
|
|
303
|
-
//#endregion
|
|
304
|
-
//#region src/skills/index.d.ts
|
|
305
|
-
/**
|
|
306
|
-
* Define an inline skill configuration.
|
|
307
|
-
*
|
|
308
|
-
* Strict-validates at author-time — throws if the config would be rejected by
|
|
309
|
-
* `writeSkillToDisk` or the spec. Source defaults to `'inline'`.
|
|
310
|
-
*/
|
|
311
|
-
declare function defineSkill(config: Omit<SkillConfig, 'source'> & {
|
|
312
|
-
source?: SkillConfig['source'];
|
|
313
|
-
}): SkillConfig;
|
|
314
|
-
//#endregion
|
|
315
|
-
export { buildCatalog as C, parseSkillFile as S, installAllowedToolsGate as T, SourcedScanPath as _, SkillValidationResult as a, inferSource as b, parseAllowedToolPattern as c, validateSkillForWrite as d, validateSkillName as f, stripShellInterpolations as g, interpolateShellCommands as h, SkillValidationIssue as i, validateResourcePath as l, InterpolateShellCommandsOptions as m, writeSkillToDisk as n, isToolAllowedByUnion as o, resolveSkills as p, writeSkillsToDisk as r, matchesAllowedTool as s, defineSkill as t, validateResourcePathReal as u, discoverSkills as v, IMPLICITLY_ALLOWED_SKILL_TOOLS as w, parseFrontmatter as x, getDefaultScanPaths as y };
|
|
316
|
-
//# sourceMappingURL=index-CIbemeZd.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-CIbemeZd.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":";;;;;;cA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