@vibe-agent-toolkit/agent-skills 0.2.0-rc.10 → 0.2.0-rc.12
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 +31 -13
- package/dist/builder.d.ts +24 -0
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +135 -62
- package/dist/builder.js.map +1 -1
- package/dist/bundle-copy.d.ts +31 -0
- package/dist/bundle-copy.d.ts.map +1 -0
- package/dist/bundle-copy.js +50 -0
- package/dist/bundle-copy.js.map +1 -0
- package/dist/evidence/derive-observations.d.ts +2 -2
- package/dist/evidence/derive-observations.d.ts.map +1 -1
- package/dist/evidence/derive-observations.js +4 -4
- package/dist/evidence/derive-observations.js.map +1 -1
- package/dist/evidence/types.d.ts +2 -2
- package/dist/evidence/types.d.ts.map +1 -1
- package/dist/files-config.d.ts +9 -2
- package/dist/files-config.d.ts.map +1 -1
- package/dist/files-config.js +116 -109
- package/dist/files-config.js.map +1 -1
- package/dist/import.d.ts +21 -2
- package/dist/import.d.ts.map +1 -1
- package/dist/import.js +46 -31
- package/dist/import.js.map +1 -1
- package/dist/index.d.ts +13 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -7
- package/dist/index.js.map +1 -1
- package/dist/inventory/index.d.ts +2 -1
- package/dist/inventory/index.d.ts.map +1 -1
- package/dist/inventory/index.js +1 -1
- package/dist/inventory/index.js.map +1 -1
- package/dist/inventory/serialize.d.ts +5796 -22
- package/dist/inventory/serialize.d.ts.map +1 -1
- package/dist/inventory/serialize.js +145 -33
- package/dist/inventory/serialize.js.map +1 -1
- package/dist/inventory/types.d.ts +3 -3
- package/dist/inventory/types.d.ts.map +1 -1
- package/dist/packaging-errors.d.ts +73 -0
- package/dist/packaging-errors.d.ts.map +1 -0
- package/dist/packaging-errors.js +96 -0
- package/dist/packaging-errors.js.map +1 -0
- package/dist/plugin-distribution-layout.d.ts +9 -3
- package/dist/plugin-distribution-layout.d.ts.map +1 -1
- package/dist/plugin-distribution-layout.js +19 -8
- package/dist/plugin-distribution-layout.js.map +1 -1
- package/dist/post-build-checks.d.ts +1 -1
- package/dist/post-build-checks.d.ts.map +1 -1
- package/dist/post-build-checks.js +36 -30
- package/dist/post-build-checks.js.map +1 -1
- package/dist/projection/skill-extent.d.ts +2 -2
- package/dist/projection/skill-extent.js +2 -2
- package/dist/skill-packager.d.ts +188 -8
- package/dist/skill-packager.d.ts.map +1 -1
- package/dist/skill-packager.js +688 -351
- package/dist/skill-packager.js.map +1 -1
- package/dist/skill-source/content-hash.d.ts +1 -0
- package/dist/skill-source/content-hash.d.ts.map +1 -1
- package/dist/skill-source/content-hash.js +16 -9
- package/dist/skill-source/content-hash.js.map +1 -1
- package/dist/skill-source/fetch-cache.d.ts +7 -1
- package/dist/skill-source/fetch-cache.d.ts.map +1 -1
- package/dist/skill-source/fetch-cache.js +54 -27
- package/dist/skill-source/fetch-cache.js.map +1 -1
- package/dist/skill-source/git-clone.d.ts +18 -0
- package/dist/skill-source/git-clone.d.ts.map +1 -1
- package/dist/skill-source/git-clone.js +207 -24
- package/dist/skill-source/git-clone.js.map +1 -1
- package/dist/skill-source/resolve-skill-source.d.ts +15 -0
- package/dist/skill-source/resolve-skill-source.d.ts.map +1 -1
- package/dist/skill-source/resolve-skill-source.js +23 -1
- package/dist/skill-source/resolve-skill-source.js.map +1 -1
- package/dist/skill-source/source-errors.d.ts +40 -0
- package/dist/skill-source/source-errors.d.ts.map +1 -0
- package/dist/skill-source/source-errors.js +47 -0
- package/dist/skill-source/source-errors.js.map +1 -0
- package/dist/skill-source/sources/npm-source.d.ts +25 -3
- package/dist/skill-source/sources/npm-source.d.ts.map +1 -1
- package/dist/skill-source/sources/npm-source.js +76 -19
- package/dist/skill-source/sources/npm-source.js.map +1 -1
- package/dist/skill-source/sources/path-source.js +1 -1
- package/dist/skill-source/sources/path-source.js.map +1 -1
- package/dist/skill-source/sources/url-source.d.ts +10 -4
- package/dist/skill-source/sources/url-source.d.ts.map +1 -1
- package/dist/skill-source/sources/url-source.js +107 -45
- package/dist/skill-source/sources/url-source.js.map +1 -1
- package/dist/skill-source/sources/vendored-source.js +1 -1
- package/dist/skill-source/sources/vendored-source.js.map +1 -1
- package/dist/skill-source/sources/workspace-source.d.ts.map +1 -1
- package/dist/skill-source/sources/workspace-source.js +6 -11
- package/dist/skill-source/sources/workspace-source.js.map +1 -1
- package/dist/skill-source/stage.d.ts +12 -0
- package/dist/skill-source/stage.d.ts.map +1 -1
- package/dist/skill-source/stage.js +65 -34
- package/dist/skill-source/stage.js.map +1 -1
- package/dist/skill-source/types.d.ts +7 -0
- package/dist/skill-source/types.d.ts.map +1 -1
- package/dist/skill-test/baseline-delta.d.ts +27 -27
- package/dist/skill-test/baseline-integrity.d.ts +9 -9
- package/dist/skill-test/build-hook.d.ts +8 -1
- package/dist/skill-test/build-hook.d.ts.map +1 -1
- package/dist/skill-test/build-hook.js +3 -2
- package/dist/skill-test/build-hook.js.map +1 -1
- package/dist/skill-test/eval-fragment.d.ts +19 -6
- package/dist/skill-test/eval-fragment.d.ts.map +1 -1
- package/dist/skill-test/eval-fragment.js +5 -4
- package/dist/skill-test/eval-fragment.js.map +1 -1
- package/dist/skill-test/eval-grader.d.ts.map +1 -1
- package/dist/skill-test/eval-grader.js +6 -3
- package/dist/skill-test/eval-grader.js.map +1 -1
- package/dist/skill-test/eval-inputs.d.ts +10 -4
- package/dist/skill-test/eval-inputs.d.ts.map +1 -1
- package/dist/skill-test/eval-inputs.js +93 -42
- package/dist/skill-test/eval-inputs.js.map +1 -1
- package/dist/skill-test/eval-suite-isolation.d.ts +1 -1
- package/dist/skill-test/eval-suite-isolation.d.ts.map +1 -1
- package/dist/skill-test/eval-suite-isolation.js +30 -9
- package/dist/skill-test/eval-suite-isolation.js.map +1 -1
- package/dist/skill-test/evals-template.d.ts.map +1 -1
- package/dist/skill-test/evals-template.js +4 -3
- package/dist/skill-test/evals-template.js.map +1 -1
- package/dist/skill-test/failure-reason.d.ts +83 -2
- package/dist/skill-test/failure-reason.d.ts.map +1 -1
- package/dist/skill-test/failure-reason.js +93 -4
- package/dist/skill-test/failure-reason.js.map +1 -1
- package/dist/skill-test/friction-schema.d.ts +53 -10
- package/dist/skill-test/friction-schema.d.ts.map +1 -1
- package/dist/skill-test/friction-schema.js +28 -2
- package/dist/skill-test/friction-schema.js.map +1 -1
- package/dist/skill-test/grader-text.d.ts +1 -1
- package/dist/skill-test/grader-text.js +2 -2
- package/dist/skill-test/harness-location.d.ts +14 -3
- package/dist/skill-test/harness-location.d.ts.map +1 -1
- package/dist/skill-test/harness-location.js +41 -15
- package/dist/skill-test/harness-location.js.map +1 -1
- package/dist/skill-test/index.d.ts +2 -2
- package/dist/skill-test/index.d.ts.map +1 -1
- package/dist/skill-test/index.js +2 -2
- package/dist/skill-test/index.js.map +1 -1
- package/dist/skill-test/lock.d.ts +15 -21
- package/dist/skill-test/lock.d.ts.map +1 -1
- package/dist/skill-test/lock.js +29 -42
- package/dist/skill-test/lock.js.map +1 -1
- package/dist/skill-test/pipeline.d.ts.map +1 -1
- package/dist/skill-test/pipeline.js +30 -29
- package/dist/skill-test/pipeline.js.map +1 -1
- package/dist/skill-test/plugin-layout.d.ts +4 -3
- package/dist/skill-test/plugin-layout.d.ts.map +1 -1
- package/dist/skill-test/plugin-layout.js +4 -3
- package/dist/skill-test/plugin-layout.js.map +1 -1
- package/dist/skill-test/preflight.d.ts +20 -3
- package/dist/skill-test/preflight.d.ts.map +1 -1
- package/dist/skill-test/preflight.js +49 -15
- package/dist/skill-test/preflight.js.map +1 -1
- package/dist/skill-test/run-harness.d.ts +68 -34
- package/dist/skill-test/run-harness.d.ts.map +1 -1
- package/dist/skill-test/run-harness.js +244 -116
- package/dist/skill-test/run-harness.js.map +1 -1
- package/dist/skill-test/staging.d.ts +6 -0
- package/dist/skill-test/staging.d.ts.map +1 -1
- package/dist/skill-test/staging.js +56 -29
- package/dist/skill-test/staging.js.map +1 -1
- package/dist/skill-test/vendor-manifest.d.ts.map +1 -1
- package/dist/skill-test/vendor-manifest.js +7 -5
- package/dist/skill-test/vendor-manifest.js.map +1 -1
- package/dist/skill-zip-layout.d.ts +45 -0
- package/dist/skill-zip-layout.d.ts.map +1 -0
- package/dist/skill-zip-layout.js +64 -0
- package/dist/skill-zip-layout.js.map +1 -0
- package/dist/test-input.d.ts.map +1 -1
- package/dist/test-input.js +4 -3
- package/dist/test-input.js.map +1 -1
- package/dist/validators/agent-instruction-presence.d.ts +4 -1
- package/dist/validators/agent-instruction-presence.d.ts.map +1 -1
- package/dist/validators/agent-instruction-presence.js +8 -4
- package/dist/validators/agent-instruction-presence.js.map +1 -1
- package/dist/validators/bundled-resource-link-detection.d.ts +4 -1
- package/dist/validators/bundled-resource-link-detection.d.ts.map +1 -1
- package/dist/validators/bundled-resource-link-detection.js +16 -8
- package/dist/validators/bundled-resource-link-detection.js.map +1 -1
- package/dist/validators/compat-detectors.js +1 -1
- package/dist/validators/compat-detectors.js.map +1 -1
- package/dist/validators/describe-issues.d.ts +18 -0
- package/dist/validators/describe-issues.d.ts.map +1 -0
- package/dist/validators/describe-issues.js +40 -0
- package/dist/validators/describe-issues.js.map +1 -0
- package/dist/validators/format-detection.d.ts.map +1 -1
- package/dist/validators/format-detection.js +31 -23
- package/dist/validators/format-detection.js.map +1 -1
- package/dist/validators/frontmatter-validation.d.ts +7 -0
- package/dist/validators/frontmatter-validation.d.ts.map +1 -1
- package/dist/validators/frontmatter-validation.js +249 -11
- package/dist/validators/frontmatter-validation.js.map +1 -1
- package/dist/validators/marketplace-validator.d.ts +25 -0
- package/dist/validators/marketplace-validator.d.ts.map +1 -1
- package/dist/validators/marketplace-validator.js +62 -21
- package/dist/validators/marketplace-validator.js.map +1 -1
- package/dist/validators/packaged-size-limit.d.ts +6 -9
- package/dist/validators/packaged-size-limit.d.ts.map +1 -1
- package/dist/validators/packaged-size-limit.js +2 -2
- package/dist/validators/packaged-size-limit.js.map +1 -1
- package/dist/validators/packaging-validator.d.ts +37 -12
- package/dist/validators/packaging-validator.d.ts.map +1 -1
- package/dist/validators/packaging-validator.js +107 -41
- package/dist/validators/packaging-validator.js.map +1 -1
- package/dist/validators/plugin-hosted-shape.d.ts.map +1 -1
- package/dist/validators/plugin-hosted-shape.js +6 -5
- package/dist/validators/plugin-hosted-shape.js.map +1 -1
- package/dist/validators/referenced-path-missing.d.ts +1 -1
- package/dist/validators/referenced-path-missing.d.ts.map +1 -1
- package/dist/validators/referenced-path-missing.js +12 -8
- package/dist/validators/referenced-path-missing.js.map +1 -1
- package/dist/validators/registry-validator.d.ts.map +1 -1
- package/dist/validators/registry-validator.js +21 -25
- package/dist/validators/registry-validator.js.map +1 -1
- package/dist/validators/skill-validator.d.ts.map +1 -1
- package/dist/validators/skill-validator.js +49 -18
- package/dist/validators/skill-validator.js.map +1 -1
- package/dist/validators/types.d.ts +28 -14
- package/dist/validators/types.d.ts.map +1 -1
- package/dist/validators/unified-validator.d.ts.map +1 -1
- package/dist/validators/unified-validator.js +5 -6
- package/dist/validators/unified-validator.js.map +1 -1
- package/dist/walk-link-graph.js +3 -1
- package/dist/walk-link-graph.js.map +1 -1
- package/package.json +7 -7
- package/schemas/friction-report.json +3 -3
- package/dist/fs-attribution.d.ts +0 -45
- package/dist/fs-attribution.d.ts.map +0 -1
- package/dist/fs-attribution.js +0 -57
- package/dist/fs-attribution.js.map +0 -1
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ const result = await validateSkill({
|
|
|
36
36
|
skillPath: './my-skill/SKILL.md',
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
if (result.
|
|
39
|
+
if (result.summary.errors > 0) {
|
|
40
40
|
console.error('Validation failed:');
|
|
41
41
|
for (const issue of result.issues) {
|
|
42
42
|
console.error(` [${issue.code}] ${issue.message}`);
|
|
@@ -93,9 +93,10 @@ interface ValidateOptions {
|
|
|
93
93
|
interface ValidationResult {
|
|
94
94
|
path: string; // Path to skill file
|
|
95
95
|
type: 'agent-skill' | 'vat-agent'; // Detected type
|
|
96
|
-
status: '
|
|
97
|
-
|
|
96
|
+
status: 'ok' | 'findings'; // Literal: `findings` iff any issue is published (info counts)
|
|
97
|
+
description: string; // Human-readable one-liner
|
|
98
98
|
issues: ValidationIssue[]; // All validation issues
|
|
99
|
+
summary: SeverityCounts; // { errors, warnings, info } — gate on summary.errors > 0
|
|
99
100
|
metadata?: { // Extracted metadata
|
|
100
101
|
name?: string;
|
|
101
102
|
description?: string;
|
|
@@ -120,7 +121,7 @@ const result = await validateSkill({
|
|
|
120
121
|
});
|
|
121
122
|
|
|
122
123
|
console.log(`Status: ${result.status}`);
|
|
123
|
-
console.log(`Summary: ${result.
|
|
124
|
+
console.log(`Summary: ${result.description}`);
|
|
124
125
|
|
|
125
126
|
// Check for specific error types
|
|
126
127
|
const nameErrors = result.issues.filter(
|
|
@@ -144,10 +145,23 @@ The validator checks for:
|
|
|
144
145
|
- `SKILL_MISSING_DESCRIPTION` - Required "description" field missing
|
|
145
146
|
- `SKILL_NAME_INVALID` - Name doesn't match pattern: `^[a-z0-9]+(-[a-z0-9]+)*$`
|
|
146
147
|
- `RESERVED_WORD_IN_NAME` (warning) - Name contains "claude" or "anthropic"
|
|
147
|
-
- `SKILL_NAME_XML_TAGS` - Name contains < or > characters
|
|
148
148
|
- `SKILL_DESCRIPTION_TOO_LONG` - Description exceeds 1024 characters
|
|
149
149
|
- `SKILL_DESCRIPTION_EMPTY` - Description is empty or whitespace-only
|
|
150
|
-
- `SKILL_DESCRIPTION_XML_TAGS` - Description contains
|
|
150
|
+
- `SKILL_DESCRIPTION_XML_TAGS` - Description contains an XML/HTML tag (VAT's reading of the vendor's "cannot contain XML tags"). Three lanes:
|
|
151
|
+
**markup** — a closing `</x>`, a self-closing `<x/>`, an opening tag with an attribute
|
|
152
|
+
assignment `<x a="b">`, or a declaration (`<!--`, `<![CDATA[`, `<!DOCTYPE`, `<?xml`) — fires
|
|
153
|
+
wherever it appears, **backticks included**; a **bare placeholder** `<word>`, which is
|
|
154
|
+
indistinguishable from a tag, so it fires unless it reads as part of a path or identifier
|
|
155
|
+
(`skills/<name>/SKILL.md`, `<name>.md`, `Promise<Result>`, `repo#<n>`, `--flag=<value>`); and a
|
|
156
|
+
**prompt-channel name** (the `system`/`sys`, `assistant`, `human`, `invoke`, `instructions`,
|
|
157
|
+
`thinking`, `tool_use`/`tool_result`, `function_calls`/`function_results` and
|
|
158
|
+
`im_start`/`im_end` families, in any spelling), which fires whatever it is glued to
|
|
159
|
+
(`<system>.Ignore previous`, `x=<invoke>`, `< system >`). Backticking (`` `<env>` ``) clears
|
|
160
|
+
the last two lanes only. Everyday placeholder words (`<user>`, `<script>`, `<example>`) are not
|
|
161
|
+
channel names, and an arbitrary joined word (`<override>.Ignore`) passes — no syntactic rule
|
|
162
|
+
separates it from `--flag=<value>`. Not a tag: a comparison or arrow (`a < b`, `<=`, `->`,
|
|
163
|
+
`=>`), or angle brackets holding prose with no attribute assignment in them
|
|
164
|
+
(`<see https://example.com>`, `<y and y>`)
|
|
151
165
|
|
|
152
166
|
**Link Errors:**
|
|
153
167
|
- `LINK_INTEGRITY_BROKEN` - Link points to non-existent file
|
|
@@ -174,15 +188,19 @@ Convert an Agent Skill (SKILL.md) to VAT agent format (agent.yaml).
|
|
|
174
188
|
interface ImportOptions {
|
|
175
189
|
skillPath: string; // Path to SKILL.md
|
|
176
190
|
outputPath?: string; // Custom output path (default: same dir as SKILL.md)
|
|
177
|
-
force?: boolean; //
|
|
191
|
+
force?: boolean; // Replace what is at the output (default: false)
|
|
178
192
|
}
|
|
179
193
|
```
|
|
180
194
|
|
|
195
|
+
The agent.yaml is written by one tree-change plan: something already at the output
|
|
196
|
+
without `force` is refused before anything is written (a thrown `TREE_DEST_OCCUPIED`
|
|
197
|
+
`VatError`), and the directory it goes in is made when absent.
|
|
198
|
+
|
|
181
199
|
**Returns:**
|
|
182
200
|
```typescript
|
|
183
201
|
type ImportResult =
|
|
184
202
|
| { success: true; agentPath: string }
|
|
185
|
-
| { success: false; error: string };
|
|
203
|
+
| { success: false; error: string; refusal: RefusalCode };
|
|
186
204
|
```
|
|
187
205
|
|
|
188
206
|
**Example:**
|
|
@@ -356,7 +374,7 @@ const validation = await validateSkill({
|
|
|
356
374
|
skillPath: './my-skill/SKILL.md',
|
|
357
375
|
});
|
|
358
376
|
|
|
359
|
-
if (validation.
|
|
377
|
+
if (validation.summary.errors > 0) {
|
|
360
378
|
console.error('Validation failed, cannot import');
|
|
361
379
|
process.exit(1);
|
|
362
380
|
}
|
|
@@ -398,7 +416,7 @@ async function validateAllSkills(dir: string) {
|
|
|
398
416
|
}
|
|
399
417
|
|
|
400
418
|
const results = await validateAllSkills('./skills');
|
|
401
|
-
const failed = results.filter(r => r.result.
|
|
419
|
+
const failed = results.filter(r => r.result.summary.errors > 0);
|
|
402
420
|
|
|
403
421
|
console.log(`Validated ${results.length} skills`);
|
|
404
422
|
console.log(`Failed: ${failed.length}`);
|
|
@@ -462,7 +480,7 @@ async function validateInCI() {
|
|
|
462
480
|
skillPath: `./skills/${skill}`,
|
|
463
481
|
});
|
|
464
482
|
|
|
465
|
-
if (result.
|
|
483
|
+
if (result.summary.errors > 0) {
|
|
466
484
|
console.error(`❌ ${skill}:`);
|
|
467
485
|
for (const issue of result.issues) {
|
|
468
486
|
if (issue.severity === 'error') {
|
|
@@ -524,8 +542,8 @@ Validation errors are returned in the `ValidationResult` object, not thrown:
|
|
|
524
542
|
```typescript
|
|
525
543
|
const result = await validateSkill({ skillPath: './skill/SKILL.md' });
|
|
526
544
|
|
|
527
|
-
//
|
|
528
|
-
if (result.
|
|
545
|
+
// errors are counted in result.summary, not thrown
|
|
546
|
+
if (result.summary.errors > 0) {
|
|
529
547
|
// Handle validation failures
|
|
530
548
|
}
|
|
531
549
|
```
|
package/dist/builder.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agent Skill builder - converts VAT agents to Agent Skills
|
|
3
3
|
*/
|
|
4
|
+
import { type TreeChangeWarning } from '@vibe-agent-toolkit/utils';
|
|
5
|
+
/**
|
|
6
|
+
* The `VatError` code of a build with no output location: no `outputPath` was
|
|
7
|
+
* given and no `package.json` encloses the agent to put the default one in.
|
|
8
|
+
* The invocation's to fix — pass an output path, or build from inside a package.
|
|
9
|
+
*/
|
|
10
|
+
export declare const AGENT_PACKAGE_ROOT_MISSING_CODE = "AGENT_PACKAGE_ROOT_MISSING";
|
|
4
11
|
export interface BuildOptions {
|
|
5
12
|
/**
|
|
6
13
|
* Path to agent directory or manifest file
|
|
@@ -26,6 +33,17 @@ export interface BuildOptions {
|
|
|
26
33
|
* @default ['directory']
|
|
27
34
|
*/
|
|
28
35
|
formats?: ('directory' | 'zip' | 'npm' | 'marketplace')[];
|
|
36
|
+
/**
|
|
37
|
+
* Whether `<outputPath>/<agent-name>/` holds a previous build to replace
|
|
38
|
+
* (`--force`). Default `false`: an explicit `outputPath` whose agent directory
|
|
39
|
+
* already holds anything but an empty directory (or a file where an archive a
|
|
40
|
+
* requested format writes beside it goes) is refused (`TREE_DEST_NOT_OWNED`) and
|
|
41
|
+
* left exactly as it was — the one rule of `packageSkill` ({@link packageOwnership}).
|
|
42
|
+
* The default location (no `outputPath`) is VAT's, and is replaced. Either way the
|
|
43
|
+
* build is one tree-change plan: it lands whole or changes nothing. An output that
|
|
44
|
+
* is, or holds, the agent's own source is refused (`TREE_DEST_HOLDS_SOURCE`).
|
|
45
|
+
*/
|
|
46
|
+
replaceExistingOutput?: boolean;
|
|
29
47
|
}
|
|
30
48
|
export interface BuildResult {
|
|
31
49
|
/**
|
|
@@ -47,6 +65,12 @@ export interface BuildResult {
|
|
|
47
65
|
* Package artifacts (when package=true)
|
|
48
66
|
*/
|
|
49
67
|
packageArtifacts?: Record<string, string>;
|
|
68
|
+
/**
|
|
69
|
+
* What the build's plan left beside its output: a previous build, parked by the swap,
|
|
70
|
+
* that the OS would not let VAT remove. The build is complete; each is a warning naming
|
|
71
|
+
* the leftover.
|
|
72
|
+
*/
|
|
73
|
+
residue: readonly TreeChangeWarning[];
|
|
50
74
|
}
|
|
51
75
|
/**
|
|
52
76
|
* Build an Agent Skill from a VAT agent
|
package/dist/builder.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,EAYL,KAAK,iBAAiB,EAGvB,MAAM,2BAA2B,CAAC;AAYnC;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,+BAA+B,CAAC;AAQ5E,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,WAAW,GAAG,KAAK,GAAG,KAAK,GAAG,aAAa,CAAC,EAAE,CAAC;IAE1D;;;;;;;;;OASG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;KAC7B,CAAC;IAEF;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAC;IAEhB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE1C;;;;OAIG;IACH,OAAO,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACvC;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CA4DjF"}
|
package/dist/builder.js
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agent Skill builder - converts VAT agents to Agent Skills
|
|
3
3
|
*/
|
|
4
|
-
import { existsSync } from 'node:fs';
|
|
5
4
|
import fs from 'node:fs/promises';
|
|
6
5
|
import path from 'node:path';
|
|
7
|
-
import { loadAgentManifest } from '@vibe-agent-toolkit/agent-config';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { AGENT_MANIFEST_INVALID_CODE, loadAgentManifest } from '@vibe-agent-toolkit/agent-config';
|
|
7
|
+
import { applyTreePlan, copyTree, everywhere, findProjectRoot, fsBoundary, pathPresent, planTreeChanges, proveTreeReadable, readRegularFile, safePath, VatError, withFsFault, } from '@vibe-agent-toolkit/utils';
|
|
8
|
+
import { asPackagerRefusal } from './packaging-errors.js';
|
|
9
|
+
import { landedPackageResult, packageGeneratedSkillInto, packageOutputChanges, packageOwnership, stagedPathMapper, } from './skill-packager.js';
|
|
10
|
+
/**
|
|
11
|
+
* The `VatError` code of a build with no output location: no `outputPath` was
|
|
12
|
+
* given and no `package.json` encloses the agent to put the default one in.
|
|
13
|
+
* The invocation's to fix — pass an output path, or build from inside a package.
|
|
14
|
+
*/
|
|
15
|
+
export const AGENT_PACKAGE_ROOT_MISSING_CODE = 'AGENT_PACKAGE_ROOT_MISSING';
|
|
16
|
+
/** How `scripts/` is walked, by the proof and the copy alike: a link is shipped as what it points at, inside `scripts/` only, and every read is the input's. */
|
|
17
|
+
const SCRIPTS_LINKS = { links: 'follow-contained', side: 'source' };
|
|
10
18
|
/**
|
|
11
19
|
* Build an Agent Skill from a VAT agent
|
|
12
20
|
*
|
|
@@ -26,75 +34,139 @@ export async function buildAgentSkill(options) {
|
|
|
26
34
|
const baseOutputPath = options.outputPath ?? getDefaultOutputPath(manifest.__manifestPath, target);
|
|
27
35
|
// Append agent name to output path
|
|
28
36
|
const outputPath = safePath.join(baseOutputPath, manifest.metadata.name);
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
const formats = options.formats ?? ['directory'];
|
|
38
|
+
// Every source is read, or proven readable, BEFORE the output is touched: a
|
|
39
|
+
// refused source must never leave a half-written bundle. Role by PATH: the output
|
|
40
|
+
// is the more specific root when it sits inside the agent.
|
|
41
|
+
const sources = await readAgentSources(manifest, agentDir, fsBoundary({ source: [agentDir], destination: [outputPath] }, { origin: 'content' }));
|
|
42
|
+
const projectRoot = findProjectRoot(agentDir) ?? agentDir;
|
|
43
|
+
const packagedFormats = shouldPackage ? formats : [];
|
|
44
|
+
// ONE plan: the agent directory (written whole into a staged tree beside it) and the
|
|
45
|
+
// archives a format writes beside it. It lands whole, or changes nothing — a previous
|
|
46
|
+
// build is never removed first. Who may lose what is there: `packageOwnership`.
|
|
47
|
+
const holder = {};
|
|
48
|
+
const plan = await planTreeChanges(packageOutputChanges({
|
|
49
|
+
outputPath,
|
|
50
|
+
skillName: manifest.metadata.name,
|
|
51
|
+
formats: packagedFormats,
|
|
52
|
+
ownership: packageOwnership({ outputPath: options.outputPath, replaceExistingOutput: options.replaceExistingOutput }),
|
|
53
|
+
reads: sources.paths,
|
|
54
|
+
write: async (staged) => {
|
|
55
|
+
holder.built = await writeAgentBuild({ manifest, agentDir, sources, staged, outputPath, formats, shouldPackage });
|
|
56
|
+
return holder.built.packaged?.siblings ?? {};
|
|
57
|
+
},
|
|
58
|
+
}));
|
|
59
|
+
const { warnings } = await applyTreePlan(plan);
|
|
60
|
+
// The plan resolves only once its fill has run, so the build is there.
|
|
61
|
+
if (holder.built === undefined)
|
|
62
|
+
throw new Error('buildAgentSkill: the plan resolved without writing the build');
|
|
63
|
+
const { staged, files, packaged } = holder.built;
|
|
64
|
+
const landedPath = stagedPathMapper(projectRoot, staged, outputPath);
|
|
65
|
+
const result = {
|
|
66
|
+
outputPath,
|
|
67
|
+
agent: {
|
|
68
|
+
name: manifest.metadata.name,
|
|
69
|
+
version: manifest.metadata.version,
|
|
70
|
+
},
|
|
71
|
+
files: files.map(landedPath),
|
|
72
|
+
residue: warnings,
|
|
73
|
+
};
|
|
74
|
+
if (packaged !== undefined) {
|
|
75
|
+
const landed = landedPackageResult(packaged, { outputPath, projectRoot, formats: packagedFormats, residue: warnings });
|
|
76
|
+
result.files.push(...landed.files.dependencies.map(f => safePath.join(agentDir, f)));
|
|
77
|
+
if (landed.artifacts !== undefined)
|
|
78
|
+
result.packageArtifacts = landed.artifacts;
|
|
79
|
+
}
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Write the agent build into `staged`, a plan's staged tree: the generated SKILL.md and
|
|
84
|
+
* manifest guide, `scripts/`, `LICENSE.txt`, then the package of that SKILL.md, in place.
|
|
85
|
+
* A write is the destination's by path (`staged`); a read of the agent's tree the source's.
|
|
86
|
+
*/
|
|
87
|
+
async function writeAgentBuild(input) {
|
|
88
|
+
const { manifest, agentDir, sources, staged } = input;
|
|
89
|
+
const boundary = fsBoundary({ source: [agentDir], destination: [staged] }, { origin: 'content' });
|
|
90
|
+
const writingOutput = (action, write) => boundary.run(action, 'destination', write);
|
|
31
91
|
const files = [];
|
|
32
92
|
// STEP 1: Generate SKILL.md from agent.yml
|
|
33
|
-
const skillPath = await generateSkillFile(manifest,
|
|
93
|
+
const skillPath = await generateSkillFile(manifest, sources.systemPrompt, staged, writingOutput);
|
|
34
94
|
files.push(skillPath);
|
|
35
95
|
// Generate agent-manifest-guide.md
|
|
36
|
-
const guidePath = await generateManifestGuide(
|
|
96
|
+
const guidePath = await generateManifestGuide(staged, writingOutput);
|
|
37
97
|
files.push(guidePath);
|
|
38
|
-
// Copy scripts/
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
await copyDirectory(scriptsPath, outputScriptsPath);
|
|
98
|
+
// Copy scripts/ (supports .js and .py). Its tree was proven above; a file that turns
|
|
99
|
+
// unreadable before the copy reaches it is still the source's — copyTree classifies its
|
|
100
|
+
// own reads — while a write it fails is decided by the boundary, by path.
|
|
101
|
+
if (sources.scriptsPath !== undefined) {
|
|
102
|
+
const scriptsPath = sources.scriptsPath;
|
|
103
|
+
const outputScriptsPath = safePath.join(staged, 'scripts');
|
|
104
|
+
await writingOutput(`copy ${scriptsPath} to ${outputScriptsPath}`, () => copyTree(scriptsPath, staged, 'scripts', { ...SCRIPTS_LINKS, onto: 'fresh' }));
|
|
46
105
|
files.push(outputScriptsPath);
|
|
47
106
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
await fs.copyFile(licensePath, outputLicensePath);
|
|
107
|
+
if (sources.license !== undefined) {
|
|
108
|
+
const license = sources.license;
|
|
109
|
+
const outputLicensePath = safePath.join(staged, 'LICENSE.txt');
|
|
110
|
+
await writingOutput(`write ${outputLicensePath}`, () => fs.writeFile(outputLicensePath, license));
|
|
53
111
|
files.push(outputLicensePath);
|
|
54
112
|
}
|
|
55
|
-
// STEP 2: Optionally package the generated SKILL.md
|
|
56
|
-
if (shouldPackage)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
113
|
+
// STEP 2: Optionally package the generated SKILL.md, in place.
|
|
114
|
+
if (!input.shouldPackage)
|
|
115
|
+
return { staged, files, packaged: undefined };
|
|
116
|
+
// A source fault inside the packager is the SKILL_PACKAGING_FAILED finding; the agent's own
|
|
117
|
+
// source reads above stay their table refusal. Told apart here, at the packager call.
|
|
118
|
+
const packaged = await packageGeneratedSkillInto(skillPath, staged, { formats: input.formats, basePath: agentDir }, [input.outputPath])
|
|
119
|
+
.catch((error) => {
|
|
120
|
+
throw asPackagerRefusal(error);
|
|
121
|
+
});
|
|
122
|
+
// NOT `refuseFailedChecks`: the build adds scripts/ and LICENSE.txt that the generated SKILL.md
|
|
123
|
+
// never links, so the packager's PACKAGED_UNREFERENCED_FILE (an error) fires on every agent that
|
|
124
|
+
// has them — refusing on it would refuse those builds outright. Registered in known-defects.md.
|
|
125
|
+
return { staged, files, packaged };
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Read the agent's sources. Only ABSENCE skips `scripts/` or `LICENSE.txt`:
|
|
129
|
+
* one that is there but cannot be read fails the build, coded as the source's,
|
|
130
|
+
* rather than shipping a bundle that silently lacks it.
|
|
131
|
+
*/
|
|
132
|
+
async function readAgentSources(manifest, agentDir, boundary) {
|
|
133
|
+
const { path: systemPromptPath, text: systemPrompt } = await readSystemPrompt(manifest, agentDir);
|
|
134
|
+
const paths = [manifest.__manifestPath ?? agentDir, systemPromptPath];
|
|
135
|
+
const scriptsCandidate = safePath.join(agentDir, 'scripts');
|
|
136
|
+
const scriptsPath = pathPresent(scriptsCandidate, { follow: agentDir }, everywhere('source'), 'probe') ? scriptsCandidate : undefined;
|
|
137
|
+
if (scriptsPath !== undefined) {
|
|
138
|
+
// Proven by the walk the copy below follows, before anything is written.
|
|
139
|
+
await proveTreeReadable(scriptsPath, SCRIPTS_LINKS);
|
|
140
|
+
paths.push(scriptsPath);
|
|
75
141
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
files,
|
|
84
|
-
};
|
|
142
|
+
const licensePath = safePath.join(agentDir, 'LICENSE.txt');
|
|
143
|
+
let license;
|
|
144
|
+
if (pathPresent(licensePath, { follow: agentDir }, everywhere('source'), 'probe')) {
|
|
145
|
+
license = await boundary.run(`read ${licensePath}`, 'source', () => readRegularFile(licensePath));
|
|
146
|
+
paths.push(licensePath);
|
|
147
|
+
}
|
|
148
|
+
return { systemPrompt, scriptsPath, license, paths };
|
|
85
149
|
}
|
|
86
150
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
151
|
+
* The system prompt the manifest names. A missing `$ref` is the manifest's to
|
|
152
|
+
* fix. The file it names is read as a `source` of origin `config` — the manifest
|
|
153
|
+
* chose the path — so an absent one is the config's mistake and one the OS will
|
|
154
|
+
* not read is the input's, as the refusal table decides.
|
|
89
155
|
*/
|
|
90
|
-
async function
|
|
91
|
-
// Read system prompt
|
|
156
|
+
async function readSystemPrompt(manifest, agentDir) {
|
|
92
157
|
const systemPromptRef = manifest.spec.prompts?.system?.$ref;
|
|
93
158
|
if (!systemPromptRef) {
|
|
94
|
-
throw new
|
|
159
|
+
throw new VatError(AGENT_MANIFEST_INVALID_CODE, 'Agent must have a system prompt (spec.prompts.system.$ref)');
|
|
95
160
|
}
|
|
96
161
|
const fullSystemPromptPath = safePath.resolve(agentDir, systemPromptRef);
|
|
97
|
-
const
|
|
162
|
+
const text = await withFsFault({ side: 'source', origin: 'config', action: `read the system prompt ${systemPromptRef} (spec.prompts.system.$ref)`, path: fullSystemPromptPath }, () => readRegularFile(fullSystemPromptPath));
|
|
163
|
+
return { path: fullSystemPromptPath, text: text.toString('utf-8') };
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Generate SKILL.md from agent manifest
|
|
167
|
+
* Following Anthropic best practices: frontmatter + concise content + references
|
|
168
|
+
*/
|
|
169
|
+
async function generateSkillFile(manifest, systemPrompt, outputPath, writingOutput) {
|
|
98
170
|
// Build SKILL.md with frontmatter
|
|
99
171
|
const frontmatter = `---
|
|
100
172
|
name: ${manifest.metadata.name}
|
|
@@ -141,13 +213,13 @@ spec:
|
|
|
141
213
|
const skillContent = frontmatter + systemPrompt + manifestSection + toolsSection;
|
|
142
214
|
// Write SKILL.md
|
|
143
215
|
const skillPath = safePath.join(outputPath, 'SKILL.md');
|
|
144
|
-
await fs.writeFile(skillPath, skillContent, 'utf-8');
|
|
216
|
+
await writingOutput(`write ${skillPath}`, () => fs.writeFile(skillPath, skillContent, 'utf-8'));
|
|
145
217
|
return skillPath;
|
|
146
218
|
}
|
|
147
219
|
/**
|
|
148
220
|
* Generate agent-manifest-guide.md with comprehensive documentation
|
|
149
221
|
*/
|
|
150
|
-
async function generateManifestGuide(outputPath) {
|
|
222
|
+
async function generateManifestGuide(outputPath, writingOutput) {
|
|
151
223
|
const guide = `# VAT Agent Manifest Guide
|
|
152
224
|
|
|
153
225
|
## Overview
|
|
@@ -512,7 +584,7 @@ spec:
|
|
|
512
584
|
- Check \`examples/\` for real-world usage patterns
|
|
513
585
|
`;
|
|
514
586
|
const guidePath = safePath.join(outputPath, 'agent-manifest-guide.md');
|
|
515
|
-
await fs.writeFile(guidePath, guide, 'utf-8');
|
|
587
|
+
await writingOutput(`write ${guidePath}`, () => fs.writeFile(guidePath, guide, 'utf-8'));
|
|
516
588
|
return guidePath;
|
|
517
589
|
}
|
|
518
590
|
/**
|
|
@@ -532,12 +604,13 @@ function findAgentPackageRoot(manifestPath) {
|
|
|
532
604
|
// Walk up until we find a package.json or hit the filesystem root
|
|
533
605
|
while (currentDir !== path.dirname(currentDir)) {
|
|
534
606
|
const packageJsonPath = safePath.join(currentDir, 'package.json');
|
|
535
|
-
|
|
607
|
+
// Each ancestor is the operator's own (the manifest's): the entry beneath it is read first.
|
|
608
|
+
if (pathPresent(packageJsonPath, { follow: currentDir }, everywhere('source'), 'probe')) {
|
|
536
609
|
return currentDir;
|
|
537
610
|
}
|
|
538
611
|
currentDir = path.dirname(currentDir);
|
|
539
612
|
}
|
|
540
|
-
throw new
|
|
541
|
-
`Agent must be within an npm package to build bundles.`);
|
|
613
|
+
throw new VatError(AGENT_PACKAGE_ROOT_MISSING_CODE, `Could not find package.json for agent at ${manifestPath}. ` +
|
|
614
|
+
`Agent must be within an npm package to build bundles, or pass an output path.`);
|
|
542
615
|
}
|
|
543
616
|
//# sourceMappingURL=builder.js.map
|
package/dist/builder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,2BAA2B,EAAE,iBAAiB,EAA4B,MAAM,kCAAkC,CAAC;AAC5H,OAAO,EACL,aAAa,EACb,QAAQ,EACR,UAAU,EACV,eAAe,EAEf,UAAU,EACV,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,QAAQ,EAER,QAAQ,EACR,WAAW,GACZ,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EAEzB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,4BAA4B,CAAC;AAE5E,gKAAgK;AAChK,MAAM,aAAa,GAAG,EAAE,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,QAAQ,EAAW,CAAC;AAgF7E;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAqB;IACzD,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAE/E,sBAAsB;IACtB,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACpD,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;I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S,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAEzF,OAAO,SAAS,CAAC;AACnB,CAAC;AAGD;;;GAGG;AACH,SAAS,oBAAoB,CAAC,YAAoB,EAAE,MAAc;IAChE,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAC5D,OAAO,QAAQ,CAAC,IAAI,CAAC,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;AACxE,CAAC;AAED;;;GAGG;AACH,SAAS,oBAAoB,CAAC,YAAoB;IAChD,IAAI,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC;IAE9D,kEAAkE;IAClE,OAAO,UAAU,KAAK,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/C,MAAM,eAAe,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QAClE,4FAA4F;QAC5F,IAAI,WAAW,CAAC,eAAe,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,UAAU,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC;YACxF,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,IAAI,QAAQ,CAChB,+BAA+B,EAC/B,4CAA4C,YAAY,IAAI;QAC1D,+EAA+E,CAClF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copying one of the author's files into a skill bundle, classified once.
|
|
3
|
+
*
|
|
4
|
+
* A copy touches two trees and its errno does not say which one refused, so the
|
|
5
|
+
* two sides are separate steps: the source is proven readable first (the `source`
|
|
6
|
+
* side, origin `content`), and only then is the bundle written (the `destination`
|
|
7
|
+
* side) — its reads still classified on the source's side by `copyRegularFile`. The
|
|
8
|
+
* bundle's LAYOUT is decided by the skill's own `files:` config, so the write is
|
|
9
|
+
* classified with `shapeFromSource`: a dest that lands on or under another dest's
|
|
10
|
+
* file is the skill's to fix, while a full disk stays the destination's.
|
|
11
|
+
*
|
|
12
|
+
* The fault keeps `subject` in its `action`, so the message names what the author
|
|
13
|
+
* can locate — a `files:` entry, a linked file — and not only the absolute path
|
|
14
|
+
* the OS named.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Copy one file into the bundle, creating the directory it lands in — only once the
|
|
18
|
+
* source is proven readable, so a refused source never leaves a directory behind.
|
|
19
|
+
*
|
|
20
|
+
* The copy is made the one way a file is made in a tree VAT is building (`copyRegularFile`):
|
|
21
|
+
* each directory on the way is a real one or is made, the file is created exclusively, and a
|
|
22
|
+
* regular file already at the name is replaced. A file where one of its directories goes is the
|
|
23
|
+
* skill's own layout — a `source` fault naming it — like every other shape the config decides.
|
|
24
|
+
*
|
|
25
|
+
* @param subject What the author can locate: `files: entry 'x'`, `linked file docs/a.md`
|
|
26
|
+
* @param sourcePath The author's file
|
|
27
|
+
* @param bundleRoot The bundle's root directory, which the packager made
|
|
28
|
+
* @param targetPath Where it lands, under `bundleRoot`
|
|
29
|
+
*/
|
|
30
|
+
export declare function copyIntoBundle(subject: string, sourcePath: string, bundleRoot: string, targetPath: string): Promise<void>;
|
|
31
|
+
//# sourceMappingURL=bundle-copy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-copy.d.ts","sourceRoot":"","sources":["../src/bundle-copy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAoBH;;;;;;;;;;;;;GAaG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI/H"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copying one of the author's files into a skill bundle, classified once.
|
|
3
|
+
*
|
|
4
|
+
* A copy touches two trees and its errno does not say which one refused, so the
|
|
5
|
+
* two sides are separate steps: the source is proven readable first (the `source`
|
|
6
|
+
* side, origin `content`), and only then is the bundle written (the `destination`
|
|
7
|
+
* side) — its reads still classified on the source's side by `copyRegularFile`. The
|
|
8
|
+
* bundle's LAYOUT is decided by the skill's own `files:` config, so the write is
|
|
9
|
+
* classified with `shapeFromSource`: a dest that lands on or under another dest's
|
|
10
|
+
* file is the skill's to fix, while a full disk stays the destination's.
|
|
11
|
+
*
|
|
12
|
+
* The fault keeps `subject` in its `action`, so the message names what the author
|
|
13
|
+
* can locate — a `files:` entry, a linked file — and not only the absolute path
|
|
14
|
+
* the OS named.
|
|
15
|
+
*/
|
|
16
|
+
import { copyRegularFile, safePath, withFsFault } from '@vibe-agent-toolkit/utils';
|
|
17
|
+
import { openForReading } from '@vibe-agent-toolkit/utils/fs';
|
|
18
|
+
/**
|
|
19
|
+
* Prove `path` readable by opening it for reading and closing it.
|
|
20
|
+
*
|
|
21
|
+
* Never `access(R_OK)`: Node documents that on Windows it ignores ACLs, so an
|
|
22
|
+
* ACL-denied source passed it and then failed inside the copy, under the guard of
|
|
23
|
+
* the wrong side.
|
|
24
|
+
*
|
|
25
|
+
* @param path A file the build is about to read
|
|
26
|
+
*/
|
|
27
|
+
async function proveReadable(path) {
|
|
28
|
+
// Never blocks: a named pipe is refused (`EFTYPE`), not waited on for a writer.
|
|
29
|
+
const handle = await openForReading(path);
|
|
30
|
+
await handle.close();
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Copy one file into the bundle, creating the directory it lands in — only once the
|
|
34
|
+
* source is proven readable, so a refused source never leaves a directory behind.
|
|
35
|
+
*
|
|
36
|
+
* The copy is made the one way a file is made in a tree VAT is building (`copyRegularFile`):
|
|
37
|
+
* each directory on the way is a real one or is made, the file is created exclusively, and a
|
|
38
|
+
* regular file already at the name is replaced. A file where one of its directories goes is the
|
|
39
|
+
* skill's own layout — a `source` fault naming it — like every other shape the config decides.
|
|
40
|
+
*
|
|
41
|
+
* @param subject What the author can locate: `files: entry 'x'`, `linked file docs/a.md`
|
|
42
|
+
* @param sourcePath The author's file
|
|
43
|
+
* @param bundleRoot The bundle's root directory, which the packager made
|
|
44
|
+
* @param targetPath Where it lands, under `bundleRoot`
|
|
45
|
+
*/
|
|
46
|
+
export async function copyIntoBundle(subject, sourcePath, bundleRoot, targetPath) {
|
|
47
|
+
await withFsFault({ side: 'source', origin: 'content', action: `read ${subject}` }, () => proveReadable(sourcePath));
|
|
48
|
+
await withFsFault({ side: 'destination', shapeFromSource: true, action: `copy ${subject} into the bundle` }, () => copyRegularFile(sourcePath, bundleRoot, safePath.relative(bundleRoot, targetPath), { side: 'source', reading: subject, existing: 'replace', writing: `${subject} into the bundle` }));
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=bundle-copy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-copy.js","sourceRoot":"","sources":["../src/bundle-copy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D;;;;;;;;GAQG;AACH,KAAK,UAAU,aAAa,CAAC,IAAY;IACvC,gFAAgF;IAChF,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC;IAC1C,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;AACvB,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAAe,EAAE,UAAkB,EAAE,UAAkB,EAAE,UAAkB;IAC9G,MAAM,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;IACrH,MAAM,WAAW,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,OAAO,kBAAkB,EAAE,EAAE,GAAG,EAAE,CAChH,eAAe,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,OAAO,kBAAkB,EAAE,CAAC,CAAC,CAAC;AAC1L,CAAC"}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Rolls `EvidenceRecord`s up into `CAPABILITY_*` observations. Callers
|
|
5
5
|
* supply the local-shell pattern-ID set (which differs per subject — skills
|
|
6
|
-
* check fewer patterns than full plugins) and a subject label for
|
|
6
|
+
* check fewer patterns than full plugins) and a subject label for description
|
|
7
7
|
* wording.
|
|
8
8
|
*/
|
|
9
9
|
import type { EvidenceRecord, Observation } from './types.js';
|
|
10
|
-
/** Subject of derivation — controls observation
|
|
10
|
+
/** Subject of derivation — controls observation description wording. */
|
|
11
11
|
export type DerivationSubject = 'skill' | 'plugin';
|
|
12
12
|
export interface DeriveObservationsOptions {
|
|
13
13
|
/** Pattern IDs that imply CAPABILITY_LOCAL_SHELL for this subject. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive-observations.d.ts","sourceRoot":"","sources":["../../src/evidence/derive-observations.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,
|
|
1
|
+
{"version":3,"file":"derive-observations.d.ts","sourceRoot":"","sources":["../../src/evidence/derive-observations.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,wEAAwE;AACxE,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEnD,MAAM,WAAW,yBAAyB;IACxC,sEAAsE;IACtE,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1C,mDAAmD;IACnD,OAAO,EAAE,iBAAiB,CAAC;CAC5B;AAED,8DAA8D;AAC9D,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAStF,CAAC;AAqDF,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,SAAS,cAAc,EAAE,EACnC,OAAO,EAAE,yBAAyB,GACjC,WAAW,EAAE,CAoCf"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Rolls `EvidenceRecord`s up into `CAPABILITY_*` observations. Callers
|
|
5
5
|
* supply the local-shell pattern-ID set (which differs per subject — skills
|
|
6
|
-
* check fewer patterns than full plugins) and a subject label for
|
|
6
|
+
* check fewer patterns than full plugins) and a subject label for description
|
|
7
7
|
* wording.
|
|
8
8
|
*/
|
|
9
9
|
import { detectInterpreter, extractMcpCommandFromMatchText, } from './interpreter-detection.js';
|
|
@@ -75,7 +75,7 @@ export function deriveObservationsFromEvidence(evidence, options) {
|
|
|
75
75
|
if (localShell.length > 0) {
|
|
76
76
|
out.push({
|
|
77
77
|
code: 'CAPABILITY_LOCAL_SHELL',
|
|
78
|
-
|
|
78
|
+
description: `${subjectCap} requires a local shell environment.`,
|
|
79
79
|
supportingEvidence: dedupePatternIds(localShell),
|
|
80
80
|
});
|
|
81
81
|
}
|
|
@@ -87,7 +87,7 @@ export function deriveObservationsFromEvidence(evidence, options) {
|
|
|
87
87
|
continue;
|
|
88
88
|
out.push({
|
|
89
89
|
code: 'CAPABILITY_EXTERNAL_CLI',
|
|
90
|
-
|
|
90
|
+
description: `${subjectCap} invokes external CLI: ${binary}.`,
|
|
91
91
|
payload: { binary },
|
|
92
92
|
supportingEvidence: dedupePatternIds(records),
|
|
93
93
|
});
|
|
@@ -96,7 +96,7 @@ export function deriveObservationsFromEvidence(evidence, options) {
|
|
|
96
96
|
if (browserAuth.length > 0) {
|
|
97
97
|
out.push({
|
|
98
98
|
code: 'CAPABILITY_BROWSER_AUTH',
|
|
99
|
-
|
|
99
|
+
description: `${subjectCap} requires an interactive browser authentication flow.`,
|
|
100
100
|
supportingEvidence: dedupePatternIds(browserAuth),
|
|
101
101
|
});
|
|
102
102
|
}
|