@agentxm/extension-content 0.49.2 → 0.50.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/src/content/frontmatter.d.ts +16 -0
- package/dist/src/content/frontmatter.js +6 -4
- package/dist/src/content/skill-content.d.ts +13 -14
- package/dist/src/content/skill-content.js +8 -46
- package/dist/src/content/subagent-content.js +14 -10
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.js +3 -3
- package/dist/src/knowledge/index.d.ts +1 -1
- package/dist/src/knowledge/index.js +2 -2
- package/dist/src/knowledge/okf.d.ts +52 -1
- package/dist/src/knowledge/okf.js +86 -59
- package/dist/src/knowledge/package-inspection.d.ts +4 -7
- package/dist/src/knowledge/package-inspection.js +7 -19
- package/dist/src/lint/accessor/platform.d.ts +54 -0
- package/dist/src/lint/accessor/platform.js +89 -0
- package/dist/src/lint/{catalog/pack-accessor → accessor}/vft.d.ts +12 -14
- package/dist/src/lint/accessor/vft.js +83 -0
- package/dist/src/lint/catalog/hook/entrypoint-exists.d.ts +2 -2
- package/dist/src/lint/catalog/hook/entrypoint-exists.js +4 -3
- package/dist/src/lint/catalog/hook/envelope.d.ts +6 -6
- package/dist/src/lint/catalog/hook/envelope.js +5 -4
- package/dist/src/lint/catalog/hook/native-bindings-supported.d.ts +2 -2
- package/dist/src/lint/catalog/hook/native-bindings-supported.js +4 -3
- package/dist/src/lint/catalog/hook.d.ts +2 -2
- package/dist/src/lint/catalog/hook.js +1 -1
- package/dist/src/lint/catalog/knowledge/diagnostics.js +4 -3
- package/dist/src/lint/catalog/knowledge/envelope.d.ts +1 -1
- package/dist/src/lint/catalog/knowledge/envelope.js +4 -3
- package/dist/src/lint/catalog/mcp-server/envelope.d.ts +2 -2
- package/dist/src/lint/catalog/mcp-server/envelope.js +4 -3
- package/dist/src/lint/catalog/mcp-server.d.ts +2 -2
- package/dist/src/lint/catalog/{pack-accessor → pack}/contexts.d.ts +6 -6
- package/dist/src/lint/catalog/{pack-accessor → pack}/contexts.js +4 -4
- package/dist/src/lint/catalog/pack/envelope.d.ts +10 -0
- package/dist/src/lint/catalog/pack/envelope.js +20 -0
- package/dist/src/lint/catalog/pack.d.ts +9 -10
- package/dist/src/lint/catalog/pack.js +12 -15
- package/dist/src/lint/catalog/rule/envelope.d.ts +2 -2
- package/dist/src/lint/catalog/rule/envelope.js +4 -3
- package/dist/src/lint/catalog/rule.d.ts +2 -2
- package/dist/src/lint/catalog/shared/envelope-rules.d.ts +23 -12
- package/dist/src/lint/catalog/shared/envelope-rules.js +22 -13
- package/dist/src/lint/catalog/shared/manifest-present.d.ts +3 -4
- package/dist/src/lint/catalog/shared/recommended-packs-rules.js +5 -3
- package/dist/src/lint/catalog/shared/schema-rule.js +3 -3
- package/dist/src/lint/catalog/{skill-accessor → skill}/contexts.d.ts +5 -5
- package/dist/src/lint/catalog/{skill-accessor → skill}/contexts.js +3 -3
- package/dist/src/lint/catalog/skill/envelope.d.ts +11 -0
- package/dist/src/lint/catalog/skill/envelope.js +23 -0
- package/dist/src/lint/catalog/skill/frontmatter-parseable.d.ts +6 -4
- package/dist/src/lint/catalog/skill/frontmatter-parseable.js +17 -21
- package/dist/src/lint/catalog/skill/frontmatter-standard-valid.js +7 -12
- package/dist/src/lint/catalog/skill.d.ts +4 -5
- package/dist/src/lint/catalog/skill.js +11 -16
- package/dist/src/lint/catalog/subagent/envelope.d.ts +2 -2
- package/dist/src/lint/catalog/subagent/envelope.js +4 -3
- package/dist/src/lint/catalog/subagent.d.ts +2 -2
- package/dist/src/lint/catalog-metadata.js +13 -1
- package/dist/src/lint/context.d.ts +39 -115
- package/dist/src/lint/describe-document.d.ts +1 -1
- package/dist/src/lint/describe-document.js +4 -5
- package/dist/src/lint/index.d.ts +5 -7
- package/dist/src/lint/index.js +5 -7
- package/dist/src/packaging/archive-guardrails.d.ts +11 -0
- package/dist/src/packaging/archive-guardrails.js +111 -74
- package/dist/src/packaging/filtered-package-validation.js +3 -4
- package/dist/src/packaging/manifest-file.d.ts +7 -3
- package/dist/src/packaging/manifest-file.js +10 -11
- package/dist/src/packaging/manifest-policy.d.ts +0 -12
- package/dist/src/packaging/manifest-policy.js +12 -26
- package/dist/src/packaging/test-zip-helpers.js +4 -3
- package/package.json +8 -4
- package/dist/src/lint/catalog/pack/manifest-keys-recognized.d.ts +0 -28
- package/dist/src/lint/catalog/pack/manifest-keys-recognized.js +0 -38
- package/dist/src/lint/catalog/pack/manifest-present.d.ts +0 -17
- package/dist/src/lint/catalog/pack/manifest-present.js +0 -24
- package/dist/src/lint/catalog/pack/manifest-schema-valid.d.ts +0 -25
- package/dist/src/lint/catalog/pack/manifest-schema-valid.js +0 -33
- package/dist/src/lint/catalog/pack-accessor/platform.d.ts +0 -56
- package/dist/src/lint/catalog/pack-accessor/platform.js +0 -93
- package/dist/src/lint/catalog/pack-accessor/vft.js +0 -85
- package/dist/src/lint/catalog/skill/manifest-keys-recognized.d.ts +0 -26
- package/dist/src/lint/catalog/skill/manifest-keys-recognized.js +0 -41
- package/dist/src/lint/catalog/skill/manifest-present.d.ts +0 -23
- package/dist/src/lint/catalog/skill/manifest-present.js +0 -32
- package/dist/src/lint/catalog/skill/manifest-schema-valid.d.ts +0 -21
- package/dist/src/lint/catalog/skill/manifest-schema-valid.js +0 -36
- package/dist/src/lint/catalog/skill/recommended-packs-valid.d.ts +0 -8
- package/dist/src/lint/catalog/skill/recommended-packs-valid.js +0 -12
- package/dist/src/lint/catalog/skill/standalone-declaration-valid.d.ts +0 -8
- package/dist/src/lint/catalog/skill/standalone-declaration-valid.js +0 -12
- package/dist/src/lint/catalog/skill-accessor/platform.d.ts +0 -53
- package/dist/src/lint/catalog/skill-accessor/platform.js +0 -90
- package/dist/src/lint/catalog/skill-accessor/vft.d.ts +0 -77
- package/dist/src/lint/catalog/skill-accessor/vft.js +0 -135
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `skill/manifest-keys-recognized` — `skill.json` contains only keys
|
|
3
|
-
* declared by `SkillManifestSchema`.
|
|
4
|
-
*
|
|
5
|
-
* The paired `-schema-valid` rule ignores excess properties by construction
|
|
6
|
-
* (`onExcessProperty: "ignore"`); this rule rejects them so publish never
|
|
7
|
-
* silently drops unrecognized manifest data.
|
|
8
|
-
*
|
|
9
|
-
* Allowed-keys set is derived from `SkillManifestSchema.fields` — no
|
|
10
|
-
* copy-paste of field names. A schema gain (or rename) automatically updates
|
|
11
|
-
* the allowlist.
|
|
12
|
-
*
|
|
13
|
-
* Early-return arms (no findings):
|
|
14
|
-
*
|
|
15
|
-
* - `subject.isNative === false` — non-native skills have no manifest to
|
|
16
|
-
* check.
|
|
17
|
-
* - `subject.skillJson === undefined` / non-object — nothing to enumerate;
|
|
18
|
-
* `skill/manifest-present` owns the absence case.
|
|
19
|
-
*
|
|
20
|
-
* @experimental This API is unstable and may change without notice.
|
|
21
|
-
* @packageDocumentation
|
|
22
|
-
*/
|
|
23
|
-
import type { SkillRuleContext } from "../../context.js";
|
|
24
|
-
import type { AdvisoryRule } from "../../rule.js";
|
|
25
|
-
export declare const manifestKeysRecognizedRule: AdvisoryRule<SkillRuleContext>;
|
|
26
|
-
//# sourceMappingURL=manifest-keys-recognized.d.ts.map
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `skill/manifest-keys-recognized` — `skill.json` contains only keys
|
|
3
|
-
* declared by `SkillManifestSchema`.
|
|
4
|
-
*
|
|
5
|
-
* The paired `-schema-valid` rule ignores excess properties by construction
|
|
6
|
-
* (`onExcessProperty: "ignore"`); this rule rejects them so publish never
|
|
7
|
-
* silently drops unrecognized manifest data.
|
|
8
|
-
*
|
|
9
|
-
* Allowed-keys set is derived from `SkillManifestSchema.fields` — no
|
|
10
|
-
* copy-paste of field names. A schema gain (or rename) automatically updates
|
|
11
|
-
* the allowlist.
|
|
12
|
-
*
|
|
13
|
-
* Early-return arms (no findings):
|
|
14
|
-
*
|
|
15
|
-
* - `subject.isNative === false` — non-native skills have no manifest to
|
|
16
|
-
* check.
|
|
17
|
-
* - `subject.skillJson === undefined` / non-object — nothing to enumerate;
|
|
18
|
-
* `skill/manifest-present` owns the absence case.
|
|
19
|
-
*
|
|
20
|
-
* @experimental This API is unstable and may change without notice.
|
|
21
|
-
* @packageDocumentation
|
|
22
|
-
*/
|
|
23
|
-
import * as Effect from "effect/Effect";
|
|
24
|
-
import { SkillManifestSchema } from "@agentxm/extension-model/unstable/skills/manifest-schema";
|
|
25
|
-
import { enumerateUnknownTopLevelKeys, structFieldKeys } from "../shared/schema-rule.js";
|
|
26
|
-
const RULE_ID = "skill/manifest-keys-recognized";
|
|
27
|
-
const SKILL_JSON = "skill.json";
|
|
28
|
-
const allowedKeys = structFieldKeys(SkillManifestSchema);
|
|
29
|
-
export const manifestKeysRecognizedRule = {
|
|
30
|
-
id: RULE_ID,
|
|
31
|
-
description: "skill.json uses only supported top-level fields.",
|
|
32
|
-
kind: "advisory",
|
|
33
|
-
severity: "error",
|
|
34
|
-
check: (context) => {
|
|
35
|
-
if (!context.subject.isNative) {
|
|
36
|
-
return Effect.succeed([]);
|
|
37
|
-
}
|
|
38
|
-
return Effect.succeed(enumerateUnknownTopLevelKeys(RULE_ID, "error", SKILL_JSON, allowedKeys, context.subject.skillJson));
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFuaWZlc3Qta2V5cy1yZWNvZ25pemVkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vc3JjL2xpbnQvY2F0YWxvZy9za2lsbC9tYW5pZmVzdC1rZXlzLXJlY29nbml6ZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQXFCRztBQUVILE9BQU8sS0FBSyxNQUFNLE1BQU0sZUFBZSxDQUFDO0FBR3hDLE9BQU8sRUFBRSxtQkFBbUIsRUFBRSxNQUFNLDBEQUEwRCxDQUFDO0FBQy9GLE9BQU8sRUFBRSw0QkFBNEIsRUFBRSxlQUFlLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUV6RixNQUFNLE9BQU8sR0FBRyxnQ0FBZ0MsQ0FBQztBQUNqRCxNQUFNLFVBQVUsR0FBRyxZQUFZLENBQUM7QUFFaEMsTUFBTSxXQUFXLEdBQUcsZUFBZSxDQUFDLG1CQUFtQixDQUFDLENBQUM7QUFFekQsTUFBTSxDQUFDLE1BQU0sMEJBQTBCLEdBQW1DO0lBQ3hFLEVBQUUsRUFBRSxPQUFPO0lBQ1gsV0FBVyxFQUFFLGtEQUFrRDtJQUMvRCxJQUFJLEVBQUUsVUFBVTtJQUNoQixRQUFRLEVBQUUsT0FBTztJQUNqQixLQUFLLEVBQUUsQ0FBQyxPQUFPLEVBQUUsRUFBRTtRQUNqQixJQUFJLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxRQUFRLEVBQUUsQ0FBQztZQUM5QixPQUFPLE1BQU0sQ0FBQyxPQUFPLENBQUMsRUFBRSxDQUFDLENBQUM7UUFDNUIsQ0FBQztRQUNELE9BQU8sTUFBTSxDQUFDLE9BQU8sQ0FDbkIsNEJBQTRCLENBQzFCLE9BQU8sRUFDUCxPQUFPLEVBQ1AsVUFBVSxFQUNWLFdBQVcsRUFDWCxPQUFPLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FDMUIsQ0FDRixDQUFDO0lBQ0osQ0FBQztDQUNGLENBQUMifQ==
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `skill/manifest-present` — native skills must have a `skill.json` at the
|
|
3
|
-
* package root.
|
|
4
|
-
*
|
|
5
|
-
* Reads through `context.packageFiles` (package-root accessor) rather than
|
|
6
|
-
* `context.files` (content-root accessor). For native skills, the package
|
|
7
|
-
* root contains `skill.json` and a `src/` directory holding the skill
|
|
8
|
-
* content; `context.files` is rooted at `src/`, so `skill.json` is only
|
|
9
|
-
* reachable via `packageFiles`.
|
|
10
|
-
*
|
|
11
|
-
* Native-only via `check` early-return: when `subject.isNative === false`
|
|
12
|
-
* (managed-external skills without a declared manifest), the rule produces
|
|
13
|
-
* no findings. No separate `applies` predicate per
|
|
14
|
-
* the lint design.
|
|
15
|
-
*
|
|
16
|
-
* Advisory-only — scaffolding a manifest is a user-authored action.
|
|
17
|
-
*
|
|
18
|
-
* @experimental This API is unstable and may change without notice.
|
|
19
|
-
* @packageDocumentation
|
|
20
|
-
*/
|
|
21
|
-
import type { SkillRuleContext } from "../../context.js";
|
|
22
|
-
export declare const manifestPresentRule: import("../../rule.ts").AdvisoryRule<SkillRuleContext<import("../../context.js").SkillContent>, never>;
|
|
23
|
-
//# sourceMappingURL=manifest-present.d.ts.map
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `skill/manifest-present` — native skills must have a `skill.json` at the
|
|
3
|
-
* package root.
|
|
4
|
-
*
|
|
5
|
-
* Reads through `context.packageFiles` (package-root accessor) rather than
|
|
6
|
-
* `context.files` (content-root accessor). For native skills, the package
|
|
7
|
-
* root contains `skill.json` and a `src/` directory holding the skill
|
|
8
|
-
* content; `context.files` is rooted at `src/`, so `skill.json` is only
|
|
9
|
-
* reachable via `packageFiles`.
|
|
10
|
-
*
|
|
11
|
-
* Native-only via `check` early-return: when `subject.isNative === false`
|
|
12
|
-
* (managed-external skills without a declared manifest), the rule produces
|
|
13
|
-
* no findings. No separate `applies` predicate per
|
|
14
|
-
* the lint design.
|
|
15
|
-
*
|
|
16
|
-
* Advisory-only — scaffolding a manifest is a user-authored action.
|
|
17
|
-
*
|
|
18
|
-
* @experimental This API is unstable and may change without notice.
|
|
19
|
-
* @packageDocumentation
|
|
20
|
-
*/
|
|
21
|
-
import { makeManifestPresentRule } from "../shared/manifest-present.js";
|
|
22
|
-
const RULE_ID = "skill/manifest-present";
|
|
23
|
-
const SKILL_JSON = "skill.json";
|
|
24
|
-
export const manifestPresentRule = makeManifestPresentRule({
|
|
25
|
-
ruleId: RULE_ID,
|
|
26
|
-
description: "Native skills include a root skill.json manifest.",
|
|
27
|
-
manifestFile: SKILL_JSON,
|
|
28
|
-
missingMessage: "This AXM skill package is missing its required skill.json manifest. Restore the package manifest before managing it.",
|
|
29
|
-
getFiles: (context) => context.packageFiles,
|
|
30
|
-
applies: (context) => context.subject.isNative,
|
|
31
|
-
});
|
|
32
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFuaWZlc3QtcHJlc2VudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9saW50L2NhdGFsb2cvc2tpbGwvbWFuaWZlc3QtcHJlc2VudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQW1CRztBQUdILE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBRXhFLE1BQU0sT0FBTyxHQUFHLHdCQUF3QixDQUFDO0FBQ3pDLE1BQU0sVUFBVSxHQUFHLFlBQVksQ0FBQztBQUVoQyxNQUFNLENBQUMsTUFBTSxtQkFBbUIsR0FBRyx1QkFBdUIsQ0FBbUI7SUFDM0UsTUFBTSxFQUFFLE9BQU87SUFDZixXQUFXLEVBQUUsbURBQW1EO0lBQ2hFLFlBQVksRUFBRSxVQUFVO0lBQ3hCLGNBQWMsRUFDWixzSEFBc0g7SUFDeEgsUUFBUSxFQUFFLENBQUMsT0FBTyxFQUFFLEVBQUUsQ0FBQyxPQUFPLENBQUMsWUFBWTtJQUMzQyxPQUFPLEVBQUUsQ0FBQyxPQUFPLEVBQUUsRUFBRSxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsUUFBUTtDQUMvQyxDQUFDLENBQUMifQ==
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `skill/manifest-schema-valid` — `skill.json` conforms to
|
|
3
|
-
* `SkillManifestSchema`.
|
|
4
|
-
*
|
|
5
|
-
* Delegates to Effect Schema. Issues map 1:1 to findings via
|
|
6
|
-
* `issuesToFindings`.
|
|
7
|
-
*
|
|
8
|
-
* Early-return arms (no findings):
|
|
9
|
-
*
|
|
10
|
-
* - `subject.isNative === false` — non-native skills have no manifest to
|
|
11
|
-
* check (complement of `skill/manifest-present`).
|
|
12
|
-
* - `subject.skillJson === undefined` — manifest is absent (covered by
|
|
13
|
-
* `skill/manifest-present`).
|
|
14
|
-
*
|
|
15
|
-
* @experimental This API is unstable and may change without notice.
|
|
16
|
-
* @packageDocumentation
|
|
17
|
-
*/
|
|
18
|
-
import type { SkillRuleContext } from "../../context.js";
|
|
19
|
-
import type { AdvisoryRule } from "../../rule.js";
|
|
20
|
-
export declare const manifestSchemaValidRule: AdvisoryRule<SkillRuleContext>;
|
|
21
|
-
//# sourceMappingURL=manifest-schema-valid.d.ts.map
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `skill/manifest-schema-valid` — `skill.json` conforms to
|
|
3
|
-
* `SkillManifestSchema`.
|
|
4
|
-
*
|
|
5
|
-
* Delegates to Effect Schema. Issues map 1:1 to findings via
|
|
6
|
-
* `issuesToFindings`.
|
|
7
|
-
*
|
|
8
|
-
* Early-return arms (no findings):
|
|
9
|
-
*
|
|
10
|
-
* - `subject.isNative === false` — non-native skills have no manifest to
|
|
11
|
-
* check (complement of `skill/manifest-present`).
|
|
12
|
-
* - `subject.skillJson === undefined` — manifest is absent (covered by
|
|
13
|
-
* `skill/manifest-present`).
|
|
14
|
-
*
|
|
15
|
-
* @experimental This API is unstable and may change without notice.
|
|
16
|
-
* @packageDocumentation
|
|
17
|
-
*/
|
|
18
|
-
import { SkillManifestSchema } from "@agentxm/extension-model/unstable/skills/manifest-schema";
|
|
19
|
-
import { schemaDecodeFindings } from "../shared/schema-rule.js";
|
|
20
|
-
const RULE_ID = "skill/manifest-schema-valid";
|
|
21
|
-
const SKILL_JSON = "skill.json";
|
|
22
|
-
export const manifestSchemaValidRule = {
|
|
23
|
-
id: RULE_ID,
|
|
24
|
-
description: "skill.json defines a valid skill manifest.",
|
|
25
|
-
kind: "advisory",
|
|
26
|
-
severity: "error",
|
|
27
|
-
check: (context) => {
|
|
28
|
-
if (!context.subject.isNative) {
|
|
29
|
-
// Non-native skills have no skill.json to schema-validate. The
|
|
30
|
-
// presence rule (manifest-present) does not fire for non-native either.
|
|
31
|
-
return schemaDecodeFindings(RULE_ID, "error", SKILL_JSON, SkillManifestSchema, undefined);
|
|
32
|
-
}
|
|
33
|
-
return schemaDecodeFindings(RULE_ID, "error", SKILL_JSON, SkillManifestSchema, context.subject.skillJson);
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFuaWZlc3Qtc2NoZW1hLXZhbGlkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vc3JjL2xpbnQvY2F0YWxvZy9za2lsbC9tYW5pZmVzdC1zY2hlbWEtdmFsaWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7Ozs7R0FnQkc7QUFJSCxPQUFPLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSwwREFBMEQsQ0FBQztBQUMvRixPQUFPLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUVoRSxNQUFNLE9BQU8sR0FBRyw2QkFBNkIsQ0FBQztBQUM5QyxNQUFNLFVBQVUsR0FBRyxZQUFZLENBQUM7QUFFaEMsTUFBTSxDQUFDLE1BQU0sdUJBQXVCLEdBQW1DO0lBQ3JFLEVBQUUsRUFBRSxPQUFPO0lBQ1gsV0FBVyxFQUFFLDRDQUE0QztJQUN6RCxJQUFJLEVBQUUsVUFBVTtJQUNoQixRQUFRLEVBQUUsT0FBTztJQUNqQixLQUFLLEVBQUUsQ0FBQyxPQUFPLEVBQUUsRUFBRTtRQUNqQixJQUFJLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxRQUFRLEVBQUUsQ0FBQztZQUM5QiwrREFBK0Q7WUFDL0Qsd0VBQXdFO1lBQ3hFLE9BQU8sb0JBQW9CLENBQUMsT0FBTyxFQUFFLE9BQU8sRUFBRSxVQUFVLEVBQUUsbUJBQW1CLEVBQUUsU0FBUyxDQUFDLENBQUM7UUFDNUYsQ0FBQztRQUNELE9BQU8sb0JBQW9CLENBQ3pCLE9BQU8sRUFDUCxPQUFPLEVBQ1AsVUFBVSxFQUNWLG1CQUFtQixFQUNuQixPQUFPLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FDMUIsQ0FBQztJQUNKLENBQUM7Q0FDRixDQUFDIn0=
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `skill/recommended-packs-valid` — recommended packs are bare FQNs, never
|
|
3
|
-
* version-ranged specs. See `../shared/recommended-packs-rules.ts`.
|
|
4
|
-
*/
|
|
5
|
-
import type { SkillRuleContext } from "../../context.js";
|
|
6
|
-
import type { AdvisoryRule } from "../../rule.js";
|
|
7
|
-
export declare const recommendedPacksValidRule: AdvisoryRule<SkillRuleContext>;
|
|
8
|
-
//# sourceMappingURL=recommended-packs-valid.d.ts.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `skill/recommended-packs-valid` — recommended packs are bare FQNs, never
|
|
3
|
-
* version-ranged specs. See `../shared/recommended-packs-rules.ts`.
|
|
4
|
-
*/
|
|
5
|
-
import { MANIFEST_FILENAME } from "@agentxm/extension-model/unstable/skills/manifest-schema";
|
|
6
|
-
import { makeRecommendedPacksValidRule } from "../shared/recommended-packs-rules.js";
|
|
7
|
-
export const recommendedPacksValidRule = makeRecommendedPacksValidRule({
|
|
8
|
-
namespace: "skill",
|
|
9
|
-
manifestFile: MANIFEST_FILENAME,
|
|
10
|
-
manifestJson: (context) => context.subject.skillJson,
|
|
11
|
-
});
|
|
12
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVjb21tZW5kZWQtcGFja3MtdmFsaWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9zcmMvbGludC9jYXRhbG9nL3NraWxsL3JlY29tbWVuZGVkLXBhY2tzLXZhbGlkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7R0FHRztBQUlILE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLDBEQUEwRCxDQUFDO0FBQzdGLE9BQU8sRUFBRSw2QkFBNkIsRUFBRSxNQUFNLHNDQUFzQyxDQUFDO0FBRXJGLE1BQU0sQ0FBQyxNQUFNLHlCQUF5QixHQUNwQyw2QkFBNkIsQ0FBbUI7SUFDOUMsU0FBUyxFQUFFLE9BQU87SUFDbEIsWUFBWSxFQUFFLGlCQUFpQjtJQUMvQixZQUFZLEVBQUUsQ0FBQyxPQUFPLEVBQUUsRUFBRSxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsU0FBUztDQUNyRCxDQUFDLENBQUMifQ==
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `skill/standalone-declaration-valid` — a manifest that opts out of standalone
|
|
3
|
-
* use names the packs it needs. See `../shared/recommended-packs-rules.ts`.
|
|
4
|
-
*/
|
|
5
|
-
import type { SkillRuleContext } from "../../context.js";
|
|
6
|
-
import type { AdvisoryRule } from "../../rule.js";
|
|
7
|
-
export declare const standaloneDeclarationValidRule: AdvisoryRule<SkillRuleContext>;
|
|
8
|
-
//# sourceMappingURL=standalone-declaration-valid.d.ts.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `skill/standalone-declaration-valid` — a manifest that opts out of standalone
|
|
3
|
-
* use names the packs it needs. See `../shared/recommended-packs-rules.ts`.
|
|
4
|
-
*/
|
|
5
|
-
import { MANIFEST_FILENAME } from "@agentxm/extension-model/unstable/skills/manifest-schema";
|
|
6
|
-
import { makeStandaloneDeclarationValidRule } from "../shared/recommended-packs-rules.js";
|
|
7
|
-
export const standaloneDeclarationValidRule = makeStandaloneDeclarationValidRule({
|
|
8
|
-
namespace: "skill",
|
|
9
|
-
manifestFile: MANIFEST_FILENAME,
|
|
10
|
-
manifestJson: (context) => context.subject.skillJson,
|
|
11
|
-
});
|
|
12
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhbmRhbG9uZS1kZWNsYXJhdGlvbi12YWxpZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9saW50L2NhdGFsb2cvc2tpbGwvc3RhbmRhbG9uZS1kZWNsYXJhdGlvbi12YWxpZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7O0dBR0c7QUFJSCxPQUFPLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSwwREFBMEQsQ0FBQztBQUM3RixPQUFPLEVBQUUsa0NBQWtDLEVBQUUsTUFBTSxzQ0FBc0MsQ0FBQztBQUUxRixNQUFNLENBQUMsTUFBTSw4QkFBOEIsR0FDekMsa0NBQWtDLENBQW1CO0lBQ25ELFNBQVMsRUFBRSxPQUFPO0lBQ2xCLFlBQVksRUFBRSxpQkFBaUI7SUFDL0IsWUFBWSxFQUFFLENBQUMsT0FBTyxFQUFFLEVBQUUsQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLFNBQVM7Q0FDckQsQ0FBQyxDQUFDIn0=
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Platform-backed `SkillFileAccessor` for `axm lint`.
|
|
3
|
-
*
|
|
4
|
-
* Maps accessor-relative posix paths to on-disk absolute paths rooted at
|
|
5
|
-
* the caller-supplied skill-root directory. Layout conventions per
|
|
6
|
-
* the lint design "Skill accessor root":
|
|
7
|
-
*
|
|
8
|
-
* - **Native acquired package:** the identity-qualified package's `src/` directory.
|
|
9
|
-
* - **Portable Agent Skill:** the identity-qualified selected package directory.
|
|
10
|
-
*
|
|
11
|
-
* The accessor is provenance-agnostic — rules see one uniform contract and
|
|
12
|
-
* never branch on native-vs-non-native. The caller (`buildSkillRuleContexts`
|
|
13
|
-
* or the CLI entry point) picks the root.
|
|
14
|
-
*
|
|
15
|
-
* Bounds enforcement:
|
|
16
|
-
*
|
|
17
|
-
* - No `..` segments in accessor-relative paths.
|
|
18
|
-
* - No absolute paths (posix or Windows drive letters).
|
|
19
|
-
* - Resolved absolute paths are verified to stay under the accessor root.
|
|
20
|
-
*
|
|
21
|
-
* The accessor is built via a factory that captures a pre-resolved
|
|
22
|
-
* `FileSystem.FileSystem` + `Path.Path` services and an absolute root, so
|
|
23
|
-
* `SkillFileAccessor` stays Layer-free at rule-evaluation time (per
|
|
24
|
-
* `lint-engine` spec "Rule contexts expose narrow caller-bound accessors").
|
|
25
|
-
* It mirrors the VFT-backed accessor in `./vft.ts`; the two are the only
|
|
26
|
-
* `SkillFileAccessor` implementations, one for on-disk roots and one for an
|
|
27
|
-
* extracted archive.
|
|
28
|
-
*
|
|
29
|
-
* @experimental This API is unstable and may change without notice.
|
|
30
|
-
* @packageDocumentation
|
|
31
|
-
*/
|
|
32
|
-
import type * as FileSystem from "effect/FileSystem";
|
|
33
|
-
import type * as Path from "effect/Path";
|
|
34
|
-
import type { SkillFileAccessor } from "../../context.js";
|
|
35
|
-
/**
|
|
36
|
-
* Platform services needed by the platform-backed skill accessor.
|
|
37
|
-
*/
|
|
38
|
-
export interface SkillAccessorPlatform {
|
|
39
|
-
readonly fs: FileSystem.FileSystem;
|
|
40
|
-
readonly path: Path.Path;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Build a platform-backed `SkillFileAccessor` rooted at `absoluteRoot`.
|
|
44
|
-
*
|
|
45
|
-
* `absoluteRoot` SHOULD be the absolute path to the skill root directory
|
|
46
|
-
* (either `.../src/` for native, or the selected package directory for a
|
|
47
|
-
* portable Agent Skill). The caller typically sources it from
|
|
48
|
-
* `computeSkillPathsForLayout` in `@agentxm/workspace-kernel/workspace-state`.
|
|
49
|
-
*
|
|
50
|
-
* @experimental This API is unstable and may change without notice.
|
|
51
|
-
*/
|
|
52
|
-
export declare const makePlatformSkillFileAccessor: (platform: SkillAccessorPlatform, absoluteRoot: string) => SkillFileAccessor;
|
|
53
|
-
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Platform-backed `SkillFileAccessor` for `axm lint`.
|
|
3
|
-
*
|
|
4
|
-
* Maps accessor-relative posix paths to on-disk absolute paths rooted at
|
|
5
|
-
* the caller-supplied skill-root directory. Layout conventions per
|
|
6
|
-
* the lint design "Skill accessor root":
|
|
7
|
-
*
|
|
8
|
-
* - **Native acquired package:** the identity-qualified package's `src/` directory.
|
|
9
|
-
* - **Portable Agent Skill:** the identity-qualified selected package directory.
|
|
10
|
-
*
|
|
11
|
-
* The accessor is provenance-agnostic — rules see one uniform contract and
|
|
12
|
-
* never branch on native-vs-non-native. The caller (`buildSkillRuleContexts`
|
|
13
|
-
* or the CLI entry point) picks the root.
|
|
14
|
-
*
|
|
15
|
-
* Bounds enforcement:
|
|
16
|
-
*
|
|
17
|
-
* - No `..` segments in accessor-relative paths.
|
|
18
|
-
* - No absolute paths (posix or Windows drive letters).
|
|
19
|
-
* - Resolved absolute paths are verified to stay under the accessor root.
|
|
20
|
-
*
|
|
21
|
-
* The accessor is built via a factory that captures a pre-resolved
|
|
22
|
-
* `FileSystem.FileSystem` + `Path.Path` services and an absolute root, so
|
|
23
|
-
* `SkillFileAccessor` stays Layer-free at rule-evaluation time (per
|
|
24
|
-
* `lint-engine` spec "Rule contexts expose narrow caller-bound accessors").
|
|
25
|
-
* It mirrors the VFT-backed accessor in `./vft.ts`; the two are the only
|
|
26
|
-
* `SkillFileAccessor` implementations, one for on-disk roots and one for an
|
|
27
|
-
* extracted archive.
|
|
28
|
-
*
|
|
29
|
-
* @experimental This API is unstable and may change without notice.
|
|
30
|
-
* @packageDocumentation
|
|
31
|
-
*/
|
|
32
|
-
import * as Effect from "effect/Effect";
|
|
33
|
-
/**
|
|
34
|
-
* Build a platform-backed `SkillFileAccessor` rooted at `absoluteRoot`.
|
|
35
|
-
*
|
|
36
|
-
* `absoluteRoot` SHOULD be the absolute path to the skill root directory
|
|
37
|
-
* (either `.../src/` for native, or the selected package directory for a
|
|
38
|
-
* portable Agent Skill). The caller typically sources it from
|
|
39
|
-
* `computeSkillPathsForLayout` in `@agentxm/workspace-kernel/workspace-state`.
|
|
40
|
-
*
|
|
41
|
-
* @experimental This API is unstable and may change without notice.
|
|
42
|
-
*/
|
|
43
|
-
export const makePlatformSkillFileAccessor = (platform, absoluteRoot) => {
|
|
44
|
-
const { fs, path } = platform;
|
|
45
|
-
const normalizedRoot = path.resolve(absoluteRoot);
|
|
46
|
-
const resolveWithinRoot = (input) => {
|
|
47
|
-
if (input === "" || input === "." || input === "./") {
|
|
48
|
-
return { kind: "ok", absolute: normalizedRoot };
|
|
49
|
-
}
|
|
50
|
-
if (/^[a-z]:[\\/]/i.test(input) || input.startsWith("/") || input.startsWith("\\")) {
|
|
51
|
-
return { kind: "escape" };
|
|
52
|
-
}
|
|
53
|
-
const normalized = input.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
54
|
-
for (const segment of normalized.split("/")) {
|
|
55
|
-
if (segment === "..") {
|
|
56
|
-
return { kind: "escape" };
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
const absolute = path.resolve(normalizedRoot, normalized);
|
|
60
|
-
if (absolute !== normalizedRoot && !absolute.startsWith(`${normalizedRoot}${path.sep}`)) {
|
|
61
|
-
return { kind: "escape" };
|
|
62
|
-
}
|
|
63
|
-
return { kind: "ok", absolute };
|
|
64
|
-
};
|
|
65
|
-
const makeAccessError = (p, reason, message) => ({
|
|
66
|
-
_tag: "FileAccessError",
|
|
67
|
-
path: p,
|
|
68
|
-
reason,
|
|
69
|
-
message,
|
|
70
|
-
});
|
|
71
|
-
return {
|
|
72
|
-
exists: (p) => {
|
|
73
|
-
const resolved = resolveWithinRoot(p);
|
|
74
|
-
if (resolved.kind !== "ok") {
|
|
75
|
-
return Effect.succeed(false);
|
|
76
|
-
}
|
|
77
|
-
return fs.exists(resolved.absolute).pipe(Effect.catch(() => Effect.succeed(false)));
|
|
78
|
-
},
|
|
79
|
-
readBytes: (p) => {
|
|
80
|
-
const resolved = resolveWithinRoot(p);
|
|
81
|
-
if (resolved.kind === "escape") {
|
|
82
|
-
return Effect.fail(makeAccessError(p, "path-escape", `path escapes the accessor root: ${p}`));
|
|
83
|
-
}
|
|
84
|
-
return fs
|
|
85
|
-
.readFile(resolved.absolute)
|
|
86
|
-
.pipe(Effect.mapError((cause) => makeAccessError(p, "read-error", `read failed at ${p}: ${String(cause)}`)));
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGxhdGZvcm0uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9zcmMvbGludC9jYXRhbG9nL3NraWxsLWFjY2Vzc29yL3BsYXRmb3JtLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7R0E4Qkc7QUFFSCxPQUFPLEtBQUssTUFBTSxNQUFNLGVBQWUsQ0FBQztBQW9CeEM7Ozs7Ozs7OztHQVNHO0FBQ0gsTUFBTSxDQUFD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DO1FBQ3RGLENBQUM7UUFDRCxTQUFTLEVBQUUsQ0FBQyxDQUFDLEVBQUUsRUFBRTtZQUNmLE1BQU0sUUFBUSxHQUFHLGlCQUFpQixDQUFDLENBQUMsQ0FBQyxDQUFDO1lBQ3RDLElBQUksUUFBUSxDQUFDLElBQUksS0FBSyxRQUFRLEVBQUUsQ0FBQztnQkFDL0IsT0FBTyxNQUFNLENBQUMsSUFBSSxDQUNoQixlQUFlLENBQUMsQ0FBQyxFQUFFLGFBQWEsRUFBRSxtQ0FBbUMsQ0FBQyxFQUFFLENBQUMsQ0FDMUUsQ0FBQztZQUNKLENBQUM7WUFDRCxPQUFPLEVBQUU7aUJBQ04sUUFBUSxDQUFDLFFBQVEsQ0FBQyxRQUFRLENBQUM7aUJBQzNCLElBQUksQ0FDSCxNQUFNLENBQUMsUUFBUSxDQUFDLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FDeEIsZUFBZSxDQUFDLENBQUMsRUFBRSxZQUFZLEVBQUUsa0JBQWtCLENBQUMsS0FBSyxNQUFNLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxDQUMxRSxDQUNGLENBQUM7UUFDTixDQUFDO0tBQ0YsQ0FBQztBQUNKLENBQUMsQ0FBQyJ9
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* VFT-backed `SkillFileAccessor` for publish callers.
|
|
3
|
-
*
|
|
4
|
-
* A Virtual File Tree (VFT) is an in-memory representation of an extracted
|
|
5
|
-
* archive — the registry publish pipeline extracts an upload into a VFT, then
|
|
6
|
-
* passes that tree into Phase 4 decode/lint. The VFT's schema and bounds
|
|
7
|
-
* (max size, file count, path depth) are owned by the registry extract phase
|
|
8
|
-
* (Phase 4 concern); this accessor treats the tree as a read-only
|
|
9
|
-
* `path -> Uint8Array` map and enforces its own rooted-read + no-`..`-escape
|
|
10
|
-
* invariants at the rule boundary.
|
|
11
|
-
*
|
|
12
|
-
* Bounds enforcement here:
|
|
13
|
-
*
|
|
14
|
-
* - Paths are normalized to posix, `./` prefixes are stripped.
|
|
15
|
-
* - Empty path resolves to the accessor root itself (useful for
|
|
16
|
-
* `location.file = ""` findings but not currently exercised by the v1
|
|
17
|
-
* catalog).
|
|
18
|
-
* - Any path containing a `..` segment raises `FileAccessError {
|
|
19
|
-
* reason: "path-escape" }` from `readBytes` and resolves to `false` from
|
|
20
|
-
* `exists`.
|
|
21
|
-
* - Absolute paths (starting with `/` or a Windows drive letter) are
|
|
22
|
-
* treated as escape attempts.
|
|
23
|
-
*
|
|
24
|
-
* @experimental This API is unstable and may change without notice.
|
|
25
|
-
* @packageDocumentation
|
|
26
|
-
*/
|
|
27
|
-
import type { SkillFileAccessor } from "../../context.js";
|
|
28
|
-
/**
|
|
29
|
-
* Minimal shape of a Virtual File Tree consumed by the accessor.
|
|
30
|
-
*
|
|
31
|
-
* The registry VFT (Phase 4, this-repo) MUST satisfy this interface. The
|
|
32
|
-
* registry may (and will) expose additional methods — file count, archive
|
|
33
|
-
* bounds, iteration — but those are the extract phase's concern.
|
|
34
|
-
*
|
|
35
|
-
* @experimental This API is unstable and may change without notice.
|
|
36
|
-
*/
|
|
37
|
-
export interface VFTNode {
|
|
38
|
-
/**
|
|
39
|
-
* Whether the given posix path points to a file within the tree.
|
|
40
|
-
*/
|
|
41
|
-
readonly hasFile: (posixPath: string) => boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Return the bytes for the given posix path, or `undefined` when the path
|
|
44
|
-
* does not resolve to a file (missing, directory, or outside the tree).
|
|
45
|
-
*/
|
|
46
|
-
readonly getFile: (posixPath: string) => Uint8Array | undefined;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Build a VFT-backed `SkillFileAccessor` rooted at the tree's root.
|
|
50
|
-
*
|
|
51
|
-
* Callers that root the skill at a sub-path of the archive should pre-strip
|
|
52
|
-
* that sub-path before constructing the tree — the accessor enforces no
|
|
53
|
-
* `..` escape above the root it was given.
|
|
54
|
-
*
|
|
55
|
-
* @experimental This API is unstable and may change without notice.
|
|
56
|
-
*/
|
|
57
|
-
export declare const makeVftSkillFileAccessor: (tree: VFTNode) => SkillFileAccessor;
|
|
58
|
-
/**
|
|
59
|
-
* Build a VFT-backed `SkillFileAccessor` rooted at a sub-path of the tree.
|
|
60
|
-
*
|
|
61
|
-
* Publish callers use this when the archive layout nests the skill content
|
|
62
|
-
* under a directory (for native managed skills: `src/` holds the content
|
|
63
|
-
* accessor root while the archive root holds the package). The
|
|
64
|
-
* `prefix` is a posix path relative to the tree root; every rule-supplied
|
|
65
|
-
* path is resolved as `<prefix>/<path>` before dispatching to the tree.
|
|
66
|
-
*
|
|
67
|
-
* Bounds enforcement matches {@link makeVftSkillFileAccessor} — path traversal
|
|
68
|
-
* checks run on the caller-supplied path before the prefix is applied, so
|
|
69
|
-
* rules still cannot escape above the scoped root.
|
|
70
|
-
*
|
|
71
|
-
* The prefix itself is normalized posix (leading `./` and trailing `/` stripped);
|
|
72
|
-
* an empty or `.` prefix is equivalent to {@link makeVftSkillFileAccessor}.
|
|
73
|
-
*
|
|
74
|
-
* @experimental This API is unstable and may change without notice.
|
|
75
|
-
*/
|
|
76
|
-
export declare const makeVftSkillFileAccessorScoped: (tree: VFTNode, prefix: string) => SkillFileAccessor;
|
|
77
|
-
//# sourceMappingURL=vft.d.ts.map
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* VFT-backed `SkillFileAccessor` for publish callers.
|
|
3
|
-
*
|
|
4
|
-
* A Virtual File Tree (VFT) is an in-memory representation of an extracted
|
|
5
|
-
* archive — the registry publish pipeline extracts an upload into a VFT, then
|
|
6
|
-
* passes that tree into Phase 4 decode/lint. The VFT's schema and bounds
|
|
7
|
-
* (max size, file count, path depth) are owned by the registry extract phase
|
|
8
|
-
* (Phase 4 concern); this accessor treats the tree as a read-only
|
|
9
|
-
* `path -> Uint8Array` map and enforces its own rooted-read + no-`..`-escape
|
|
10
|
-
* invariants at the rule boundary.
|
|
11
|
-
*
|
|
12
|
-
* Bounds enforcement here:
|
|
13
|
-
*
|
|
14
|
-
* - Paths are normalized to posix, `./` prefixes are stripped.
|
|
15
|
-
* - Empty path resolves to the accessor root itself (useful for
|
|
16
|
-
* `location.file = ""` findings but not currently exercised by the v1
|
|
17
|
-
* catalog).
|
|
18
|
-
* - Any path containing a `..` segment raises `FileAccessError {
|
|
19
|
-
* reason: "path-escape" }` from `readBytes` and resolves to `false` from
|
|
20
|
-
* `exists`.
|
|
21
|
-
* - Absolute paths (starting with `/` or a Windows drive letter) are
|
|
22
|
-
* treated as escape attempts.
|
|
23
|
-
*
|
|
24
|
-
* @experimental This API is unstable and may change without notice.
|
|
25
|
-
* @packageDocumentation
|
|
26
|
-
*/
|
|
27
|
-
import * as Effect from "effect/Effect";
|
|
28
|
-
/**
|
|
29
|
-
* Build a VFT-backed `SkillFileAccessor` rooted at the tree's root.
|
|
30
|
-
*
|
|
31
|
-
* Callers that root the skill at a sub-path of the archive should pre-strip
|
|
32
|
-
* that sub-path before constructing the tree — the accessor enforces no
|
|
33
|
-
* `..` escape above the root it was given.
|
|
34
|
-
*
|
|
35
|
-
* @experimental This API is unstable and may change without notice.
|
|
36
|
-
*/
|
|
37
|
-
export const makeVftSkillFileAccessor = (tree) => {
|
|
38
|
-
return {
|
|
39
|
-
exists: (path) => {
|
|
40
|
-
const normalized = normalizeAndCheck(path);
|
|
41
|
-
if (normalized.kind !== "ok") {
|
|
42
|
-
return Effect.succeed(false);
|
|
43
|
-
}
|
|
44
|
-
return Effect.succeed(tree.hasFile(normalized.path));
|
|
45
|
-
},
|
|
46
|
-
readBytes: (path) => {
|
|
47
|
-
const normalized = normalizeAndCheck(path);
|
|
48
|
-
if (normalized.kind === "escape") {
|
|
49
|
-
return failFileAccess(path, "path-escape", `path escapes the accessor root: ${path}`);
|
|
50
|
-
}
|
|
51
|
-
const bytes = tree.getFile(normalized.path);
|
|
52
|
-
if (bytes === undefined) {
|
|
53
|
-
return failFileAccess(path, "read-error", `file not found at ${path}`);
|
|
54
|
-
}
|
|
55
|
-
return Effect.succeed(bytes);
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Build a VFT-backed `SkillFileAccessor` rooted at a sub-path of the tree.
|
|
61
|
-
*
|
|
62
|
-
* Publish callers use this when the archive layout nests the skill content
|
|
63
|
-
* under a directory (for native managed skills: `src/` holds the content
|
|
64
|
-
* accessor root while the archive root holds the package). The
|
|
65
|
-
* `prefix` is a posix path relative to the tree root; every rule-supplied
|
|
66
|
-
* path is resolved as `<prefix>/<path>` before dispatching to the tree.
|
|
67
|
-
*
|
|
68
|
-
* Bounds enforcement matches {@link makeVftSkillFileAccessor} — path traversal
|
|
69
|
-
* checks run on the caller-supplied path before the prefix is applied, so
|
|
70
|
-
* rules still cannot escape above the scoped root.
|
|
71
|
-
*
|
|
72
|
-
* The prefix itself is normalized posix (leading `./` and trailing `/` stripped);
|
|
73
|
-
* an empty or `.` prefix is equivalent to {@link makeVftSkillFileAccessor}.
|
|
74
|
-
*
|
|
75
|
-
* @experimental This API is unstable and may change without notice.
|
|
76
|
-
*/
|
|
77
|
-
export const makeVftSkillFileAccessorScoped = (tree, prefix) => {
|
|
78
|
-
const normalizedPrefix = normalizePrefix(prefix);
|
|
79
|
-
if (normalizedPrefix === "") {
|
|
80
|
-
return makeVftSkillFileAccessor(tree);
|
|
81
|
-
}
|
|
82
|
-
const join = (path) => path === "" ? normalizedPrefix : `${normalizedPrefix}/${path}`;
|
|
83
|
-
return {
|
|
84
|
-
exists: (path) => {
|
|
85
|
-
const normalized = normalizeAndCheck(path);
|
|
86
|
-
if (normalized.kind !== "ok") {
|
|
87
|
-
return Effect.succeed(false);
|
|
88
|
-
}
|
|
89
|
-
return Effect.succeed(tree.hasFile(join(normalized.path)));
|
|
90
|
-
},
|
|
91
|
-
readBytes: (path) => {
|
|
92
|
-
const normalized = normalizeAndCheck(path);
|
|
93
|
-
if (normalized.kind === "escape") {
|
|
94
|
-
return failFileAccess(path, "path-escape", `path escapes the accessor root: ${path}`);
|
|
95
|
-
}
|
|
96
|
-
const bytes = tree.getFile(join(normalized.path));
|
|
97
|
-
if (bytes === undefined) {
|
|
98
|
-
return failFileAccess(path, "read-error", `file not found at ${path}`);
|
|
99
|
-
}
|
|
100
|
-
return Effect.succeed(bytes);
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
const normalizePrefix = (prefix) => {
|
|
105
|
-
const stripped = prefix.replace(/\\/g, "/").replace(/^\.\//, "").replace(/\/+$/, "");
|
|
106
|
-
if (stripped === "" || stripped === ".") {
|
|
107
|
-
return "";
|
|
108
|
-
}
|
|
109
|
-
return stripped;
|
|
110
|
-
};
|
|
111
|
-
const normalizeAndCheck = (path) => {
|
|
112
|
-
if (path === "" || path === "." || path === "./") {
|
|
113
|
-
return { kind: "ok", path: "" };
|
|
114
|
-
}
|
|
115
|
-
// Windows drive letters (`C:/`) and absolute posix paths both count as
|
|
116
|
-
// escape attempts at a skill-rooted accessor.
|
|
117
|
-
if (/^[a-z]:[\\/]/i.test(path) || path.startsWith("/") || path.startsWith("\\")) {
|
|
118
|
-
return { kind: "escape" };
|
|
119
|
-
}
|
|
120
|
-
const normalized = path.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
121
|
-
const segments = normalized.split("/");
|
|
122
|
-
for (const segment of segments) {
|
|
123
|
-
if (segment === "..") {
|
|
124
|
-
return { kind: "escape" };
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return { kind: "ok", path: normalized };
|
|
128
|
-
};
|
|
129
|
-
const failFileAccess = (path, reason, message) => Effect.fail({
|
|
130
|
-
_tag: "FileAccessError",
|
|
131
|
-
path,
|
|
132
|
-
reason,
|
|
133
|
-
message,
|
|
134
|
-
});
|
|
135
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmZ0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdX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