@agentxm/extension-content 0.28.14-preview.1789139351.5cd4595aa
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/LICENSE +110 -0
- package/README.md +17 -0
- package/dist/src/content/agent-skills-standard.d.ts +17 -0
- package/dist/src/content/agent-skills-standard.js +24 -0
- package/dist/src/content/frontmatter.d.ts +52 -0
- package/dist/src/content/frontmatter.js +115 -0
- package/dist/src/content/index.d.ts +11 -0
- package/dist/src/content/index.js +11 -0
- package/dist/src/content/skill-content.d.ts +43 -0
- package/dist/src/content/skill-content.js +184 -0
- package/dist/src/content/skill-types.d.ts +22 -0
- package/dist/src/content/skill-types.js +9 -0
- package/dist/src/content/subagent-content.d.ts +58 -0
- package/dist/src/content/subagent-content.js +101 -0
- package/dist/src/index.d.ts +23 -0
- package/dist/src/index.js +23 -0
- package/dist/src/knowledge/index.d.ts +9 -0
- package/dist/src/knowledge/index.js +9 -0
- package/dist/src/knowledge/knowledge-search.d.ts +32 -0
- package/dist/src/knowledge/knowledge-search.js +147 -0
- package/dist/src/knowledge/okf.d.ts +86 -0
- package/dist/src/knowledge/okf.js +1090 -0
- package/dist/src/knowledge/package-inspection.d.ts +125 -0
- package/dist/src/knowledge/package-inspection.js +45 -0
- package/dist/src/lint/catalog/hook/decision-portability.d.ts +4 -0
- package/dist/src/lint/catalog/hook/decision-portability.js +40 -0
- package/dist/src/lint/catalog/hook/entrypoint-exists.d.ts +4 -0
- package/dist/src/lint/catalog/hook/entrypoint-exists.js +39 -0
- package/dist/src/lint/catalog/hook/envelope.d.ts +6 -0
- package/dist/src/lint/catalog/hook/envelope.js +15 -0
- package/dist/src/lint/catalog/hook/matcher-raw-portability.d.ts +4 -0
- package/dist/src/lint/catalog/hook/matcher-raw-portability.js +51 -0
- package/dist/src/lint/catalog/hook.d.ts +4 -0
- package/dist/src/lint/catalog/hook.js +15 -0
- package/dist/src/lint/catalog/knowledge/diagnostics.d.ts +128 -0
- package/dist/src/lint/catalog/knowledge/diagnostics.js +78 -0
- package/dist/src/lint/catalog/knowledge/envelope.d.ts +6 -0
- package/dist/src/lint/catalog/knowledge/envelope.js +15 -0
- package/dist/src/lint/catalog/knowledge.d.ts +11 -0
- package/dist/src/lint/catalog/knowledge.js +15 -0
- package/dist/src/lint/catalog/mcp-server/envelope.d.ts +6 -0
- package/dist/src/lint/catalog/mcp-server/envelope.js +15 -0
- package/dist/src/lint/catalog/mcp-server.d.ts +4 -0
- package/dist/src/lint/catalog/mcp-server.js +4 -0
- package/dist/src/lint/catalog/pack/manifest-keys-recognized.d.ts +28 -0
- package/dist/src/lint/catalog/pack/manifest-keys-recognized.js +38 -0
- package/dist/src/lint/catalog/pack/manifest-present.d.ts +17 -0
- package/dist/src/lint/catalog/pack/manifest-present.js +24 -0
- package/dist/src/lint/catalog/pack/manifest-schema-valid.d.ts +25 -0
- package/dist/src/lint/catalog/pack/manifest-schema-valid.js +33 -0
- package/dist/src/lint/catalog/pack-accessor/contexts.d.ts +51 -0
- package/dist/src/lint/catalog/pack-accessor/contexts.js +45 -0
- package/dist/src/lint/catalog/pack-accessor/platform.d.ts +56 -0
- package/dist/src/lint/catalog/pack-accessor/platform.js +93 -0
- package/dist/src/lint/catalog/pack-accessor/vft.d.ts +60 -0
- package/dist/src/lint/catalog/pack-accessor/vft.js +85 -0
- package/dist/src/lint/catalog/pack.d.ts +31 -0
- package/dist/src/lint/catalog/pack.js +36 -0
- package/dist/src/lint/catalog/rule/envelope.d.ts +6 -0
- package/dist/src/lint/catalog/rule/envelope.js +15 -0
- package/dist/src/lint/catalog/rule.d.ts +4 -0
- package/dist/src/lint/catalog/rule.js +4 -0
- package/dist/src/lint/catalog/shared/envelope-rules.d.ts +88 -0
- package/dist/src/lint/catalog/shared/envelope-rules.js +84 -0
- package/dist/src/lint/catalog/shared/manifest-json.d.ts +18 -0
- package/dist/src/lint/catalog/shared/manifest-json.js +28 -0
- package/dist/src/lint/catalog/shared/manifest-present.d.ts +25 -0
- package/dist/src/lint/catalog/shared/manifest-present.js +37 -0
- package/dist/src/lint/catalog/shared/recommended-packs-rules.d.ts +70 -0
- package/dist/src/lint/catalog/shared/recommended-packs-rules.js +139 -0
- package/dist/src/lint/catalog/shared/schema-rule.d.ts +57 -0
- package/dist/src/lint/catalog/shared/schema-rule.js +102 -0
- package/dist/src/lint/catalog/skill/frontmatter-parseable.d.ts +31 -0
- package/dist/src/lint/catalog/skill/frontmatter-parseable.js +148 -0
- package/dist/src/lint/catalog/skill/frontmatter-standard-valid.d.ts +13 -0
- package/dist/src/lint/catalog/skill/frontmatter-standard-valid.js +61 -0
- package/dist/src/lint/catalog/skill/manifest-keys-recognized.d.ts +26 -0
- package/dist/src/lint/catalog/skill/manifest-keys-recognized.js +41 -0
- package/dist/src/lint/catalog/skill/manifest-present.d.ts +23 -0
- package/dist/src/lint/catalog/skill/manifest-present.js +32 -0
- package/dist/src/lint/catalog/skill/manifest-schema-valid.d.ts +21 -0
- package/dist/src/lint/catalog/skill/manifest-schema-valid.js +36 -0
- package/dist/src/lint/catalog/skill/recommended-packs-valid.d.ts +8 -0
- package/dist/src/lint/catalog/skill/recommended-packs-valid.js +12 -0
- package/dist/src/lint/catalog/skill/skill-md-present.d.ts +17 -0
- package/dist/src/lint/catalog/skill/skill-md-present.js +37 -0
- package/dist/src/lint/catalog/skill/standalone-declaration-valid.d.ts +8 -0
- package/dist/src/lint/catalog/skill/standalone-declaration-valid.js +12 -0
- package/dist/src/lint/catalog/skill-accessor/contexts.d.ts +61 -0
- package/dist/src/lint/catalog/skill-accessor/contexts.js +55 -0
- package/dist/src/lint/catalog/skill-accessor/platform.d.ts +53 -0
- package/dist/src/lint/catalog/skill-accessor/platform.js +90 -0
- package/dist/src/lint/catalog/skill-accessor/vft.d.ts +77 -0
- package/dist/src/lint/catalog/skill-accessor/vft.js +135 -0
- package/dist/src/lint/catalog/skill.d.ts +38 -0
- package/dist/src/lint/catalog/skill.js +53 -0
- package/dist/src/lint/catalog/subagent/envelope.d.ts +6 -0
- package/dist/src/lint/catalog/subagent/envelope.js +15 -0
- package/dist/src/lint/catalog/subagent.d.ts +4 -0
- package/dist/src/lint/catalog/subagent.js +4 -0
- package/dist/src/lint/catalog-metadata.d.ts +125 -0
- package/dist/src/lint/catalog-metadata.js +642 -0
- package/dist/src/lint/compose-path.d.ts +28 -0
- package/dist/src/lint/compose-path.js +64 -0
- package/dist/src/lint/config.d.ts +77 -0
- package/dist/src/lint/config.js +99 -0
- package/dist/src/lint/context.d.ts +239 -0
- package/dist/src/lint/context.js +17 -0
- package/dist/src/lint/describe-document.d.ts +31 -0
- package/dist/src/lint/describe-document.js +50 -0
- package/dist/src/lint/evaluate.d.ts +47 -0
- package/dist/src/lint/evaluate.js +73 -0
- package/dist/src/lint/index.d.ts +36 -0
- package/dist/src/lint/index.js +34 -0
- package/dist/src/lint/issues-to-findings.d.ts +35 -0
- package/dist/src/lint/issues-to-findings.js +149 -0
- package/dist/src/lint/rule.d.ts +97 -0
- package/dist/src/lint/rule.js +17 -0
- package/dist/src/packaging/archive-guardrails.d.ts +39 -0
- package/dist/src/packaging/archive-guardrails.js +250 -0
- package/dist/src/packaging/filtered-package-validation.d.ts +24 -0
- package/dist/src/packaging/filtered-package-validation.js +117 -0
- package/dist/src/packaging/ingest-limits.d.ts +25 -0
- package/dist/src/packaging/ingest-limits.js +41 -0
- package/dist/src/packaging/input-normalization.d.ts +40 -0
- package/dist/src/packaging/input-normalization.js +125 -0
- package/dist/src/packaging/manifest-policy.d.ts +611 -0
- package/dist/src/packaging/manifest-policy.js +196 -0
- package/dist/src/packaging/test-zip-helpers.d.ts +13 -0
- package/dist/src/packaging/test-zip-helpers.js +117 -0
- package/dist/src/testing.d.ts +9 -0
- package/dist/src/testing.js +9 -0
- package/package.json +65 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `buildSkillRuleContexts` — build `SkillRuleContext[]` from a structural
|
|
3
|
+
* `installedSkills` input. The full lint workspace view
|
|
4
|
+
* (`LintWorkspaceView`) satisfies this by construction.
|
|
5
|
+
*
|
|
6
|
+
* The minimal shape is **exactly** the set of fields the function reads per
|
|
7
|
+
* installed skill:
|
|
8
|
+
*
|
|
9
|
+
* - `isNative` — whether the skill is expected to expose `skill.json`
|
|
10
|
+
* (registry-installed natives: `true`; managed external: `false`).
|
|
11
|
+
* - `skillJson` — pre-decoded `skill.json` when present (caller decodes
|
|
12
|
+
* once per skill, so rules don't re-read + re-parse).
|
|
13
|
+
* - `displayRoot` — posix-relative root used by the renderer; the caller
|
|
14
|
+
* picks per provenance (see the table below).
|
|
15
|
+
* - `files` — the pre-bound content-root `SkillFileAccessor` (rooted at the
|
|
16
|
+
* directory containing `SKILL.md`). The caller chooses VFT or
|
|
17
|
+
* platform-backed.
|
|
18
|
+
* - `packageFiles` — the pre-bound package-root `SkillFileAccessor` (rooted
|
|
19
|
+
* at the directory containing `skill.json` for native skills). For
|
|
20
|
+
* non-native skills, callers MAY alias `files`.
|
|
21
|
+
*
|
|
22
|
+
* Provenance → `displayRoot` table:
|
|
23
|
+
*
|
|
24
|
+
* | Surface | `displayRoot` |
|
|
25
|
+
* | ----------------------------------------- | --------------------------------------------- |
|
|
26
|
+
* | Publish | `""` |
|
|
27
|
+
* | Registry-installed native skill | `agent_extensions/<source>/<@owner>/skills/<name>/src` |
|
|
28
|
+
* | Portable acquired skill | `agent_extensions/<source>/<source-full-name>` |
|
|
29
|
+
*
|
|
30
|
+
* @experimental This API is unstable and may change without notice.
|
|
31
|
+
* @packageDocumentation
|
|
32
|
+
*/
|
|
33
|
+
import type { SkillFileAccessor, SkillRuleContext } from "../../context.js";
|
|
34
|
+
/**
|
|
35
|
+
* Minimal structural shape `buildSkillRuleContexts` needs per installed
|
|
36
|
+
* skill. The full lint workspace view exposes
|
|
37
|
+
* `installedSkills: ReadonlyArray<InstalledSkillInfo>`.
|
|
38
|
+
*
|
|
39
|
+
* @experimental This API is unstable and may change without notice.
|
|
40
|
+
*/
|
|
41
|
+
export interface InstalledSkillInfo {
|
|
42
|
+
readonly isNative: boolean;
|
|
43
|
+
readonly skillJson: unknown;
|
|
44
|
+
readonly expectedName?: string;
|
|
45
|
+
readonly displayRoot: string;
|
|
46
|
+
readonly files: SkillFileAccessor;
|
|
47
|
+
readonly packageFiles: SkillFileAccessor;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Project an input's `installedSkills` into `SkillRuleContext`s with their
|
|
51
|
+
* `displayRoot` and `subject` fields pre-populated.
|
|
52
|
+
*
|
|
53
|
+
* Publish callers bypass this helper and construct a single context directly
|
|
54
|
+
* — they have exactly one skill in play and no workspace.
|
|
55
|
+
*
|
|
56
|
+
* @experimental This API is unstable and may change without notice.
|
|
57
|
+
*/
|
|
58
|
+
export declare const buildSkillRuleContexts: (input: {
|
|
59
|
+
readonly installedSkills: ReadonlyArray<InstalledSkillInfo>;
|
|
60
|
+
}) => ReadonlyArray<SkillRuleContext>;
|
|
61
|
+
//# sourceMappingURL=contexts.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `buildSkillRuleContexts` — build `SkillRuleContext[]` from a structural
|
|
3
|
+
* `installedSkills` input. The full lint workspace view
|
|
4
|
+
* (`LintWorkspaceView`) satisfies this by construction.
|
|
5
|
+
*
|
|
6
|
+
* The minimal shape is **exactly** the set of fields the function reads per
|
|
7
|
+
* installed skill:
|
|
8
|
+
*
|
|
9
|
+
* - `isNative` — whether the skill is expected to expose `skill.json`
|
|
10
|
+
* (registry-installed natives: `true`; managed external: `false`).
|
|
11
|
+
* - `skillJson` — pre-decoded `skill.json` when present (caller decodes
|
|
12
|
+
* once per skill, so rules don't re-read + re-parse).
|
|
13
|
+
* - `displayRoot` — posix-relative root used by the renderer; the caller
|
|
14
|
+
* picks per provenance (see the table below).
|
|
15
|
+
* - `files` — the pre-bound content-root `SkillFileAccessor` (rooted at the
|
|
16
|
+
* directory containing `SKILL.md`). The caller chooses VFT or
|
|
17
|
+
* platform-backed.
|
|
18
|
+
* - `packageFiles` — the pre-bound package-root `SkillFileAccessor` (rooted
|
|
19
|
+
* at the directory containing `skill.json` for native skills). For
|
|
20
|
+
* non-native skills, callers MAY alias `files`.
|
|
21
|
+
*
|
|
22
|
+
* Provenance → `displayRoot` table:
|
|
23
|
+
*
|
|
24
|
+
* | Surface | `displayRoot` |
|
|
25
|
+
* | ----------------------------------------- | --------------------------------------------- |
|
|
26
|
+
* | Publish | `""` |
|
|
27
|
+
* | Registry-installed native skill | `agent_extensions/<source>/<@owner>/skills/<name>/src` |
|
|
28
|
+
* | Portable acquired skill | `agent_extensions/<source>/<source-full-name>` |
|
|
29
|
+
*
|
|
30
|
+
* @experimental This API is unstable and may change without notice.
|
|
31
|
+
* @packageDocumentation
|
|
32
|
+
*/
|
|
33
|
+
// -----------------------------------------------------------------------------
|
|
34
|
+
// buildSkillRuleContexts
|
|
35
|
+
// -----------------------------------------------------------------------------
|
|
36
|
+
/**
|
|
37
|
+
* Project an input's `installedSkills` into `SkillRuleContext`s with their
|
|
38
|
+
* `displayRoot` and `subject` fields pre-populated.
|
|
39
|
+
*
|
|
40
|
+
* Publish callers bypass this helper and construct a single context directly
|
|
41
|
+
* — they have exactly one skill in play and no workspace.
|
|
42
|
+
*
|
|
43
|
+
* @experimental This API is unstable and may change without notice.
|
|
44
|
+
*/
|
|
45
|
+
export const buildSkillRuleContexts = (input) => input.installedSkills.map((info) => ({
|
|
46
|
+
subject: {
|
|
47
|
+
isNative: info.isNative,
|
|
48
|
+
skillJson: info.skillJson,
|
|
49
|
+
...(info.expectedName === undefined ? {} : { expectedName: info.expectedName }),
|
|
50
|
+
},
|
|
51
|
+
files: info.files,
|
|
52
|
+
packageFiles: info.packageFiles,
|
|
53
|
+
displayRoot: info.displayRoot,
|
|
54
|
+
}));
|
|
55
|
+
//# sourceMappingURL=contexts.js.map
|
|
@@ -0,0 +1,53 @@
|
|
|
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 source-qualified package's `src/` directory.
|
|
9
|
+
* - **Portable Agent Skill:** the source-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-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
|
|
@@ -0,0 +1,90 @@
|
|
|
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 source-qualified package's `src/` directory.
|
|
9
|
+
* - **Portable Agent Skill:** the source-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-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=platform.js.map
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
|
@@ -0,0 +1,135 @@
|
|
|
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=vft.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `skill/*` rule catalog.
|
|
3
|
+
*
|
|
4
|
+
* Per the lint design, registry publish and `axm lint`
|
|
5
|
+
* run exactly these rules against each skill context:
|
|
6
|
+
*
|
|
7
|
+
* | ID | Severity | Autofix |
|
|
8
|
+
* | -------------------------------------- | -------- | ------- |
|
|
9
|
+
* | `skill/skill-md-present` | error | — |
|
|
10
|
+
* | `skill/manifest-present` | error | — |
|
|
11
|
+
* | `skill/frontmatter-parseable` | error | — |
|
|
12
|
+
* | `skill/frontmatter-standard-valid` | error | — |
|
|
13
|
+
* | `skill/manifest-schema-valid` | error | — |
|
|
14
|
+
* | `skill/manifest-keys-recognized` | error | — |
|
|
15
|
+
* | `skill/standalone-declaration-valid` | warning | — |
|
|
16
|
+
* | `skill/recommended-packs-valid` | warning | — |
|
|
17
|
+
*
|
|
18
|
+
* The last two come from `catalog/shared/recommended-packs-rules.ts`; every
|
|
19
|
+
* non-pack catalog applies the same pair against its own manifest.
|
|
20
|
+
*
|
|
21
|
+
* All ship `kind: "advisory"`. Native-vs-non-native applicability is
|
|
22
|
+
* expressed via `check` early-return (no separate `applies` predicate); see
|
|
23
|
+
* each rule's module for the guard.
|
|
24
|
+
*
|
|
25
|
+
* @experimental This API is unstable and may change without notice.
|
|
26
|
+
* @packageDocumentation
|
|
27
|
+
*/
|
|
28
|
+
import type { LintRule } from "../rule.js";
|
|
29
|
+
import type { SkillRuleContext } from "../context.js";
|
|
30
|
+
/**
|
|
31
|
+
* Ordered v1 `skill/*` rule catalog. Declaration order is the evaluation
|
|
32
|
+
* order within a single `evaluateContexts` call (deterministic ordering is
|
|
33
|
+
* test-observable; see `evaluate.ts`).
|
|
34
|
+
*
|
|
35
|
+
* @experimental This API is unstable and may change without notice.
|
|
36
|
+
*/
|
|
37
|
+
export declare const skillRules: ReadonlyArray<LintRule<SkillRuleContext>>;
|
|
38
|
+
//# sourceMappingURL=skill.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `skill/*` rule catalog.
|
|
3
|
+
*
|
|
4
|
+
* Per the lint design, registry publish and `axm lint`
|
|
5
|
+
* run exactly these rules against each skill context:
|
|
6
|
+
*
|
|
7
|
+
* | ID | Severity | Autofix |
|
|
8
|
+
* | -------------------------------------- | -------- | ------- |
|
|
9
|
+
* | `skill/skill-md-present` | error | — |
|
|
10
|
+
* | `skill/manifest-present` | error | — |
|
|
11
|
+
* | `skill/frontmatter-parseable` | error | — |
|
|
12
|
+
* | `skill/frontmatter-standard-valid` | error | — |
|
|
13
|
+
* | `skill/manifest-schema-valid` | error | — |
|
|
14
|
+
* | `skill/manifest-keys-recognized` | error | — |
|
|
15
|
+
* | `skill/standalone-declaration-valid` | warning | — |
|
|
16
|
+
* | `skill/recommended-packs-valid` | warning | — |
|
|
17
|
+
*
|
|
18
|
+
* The last two come from `catalog/shared/recommended-packs-rules.ts`; every
|
|
19
|
+
* non-pack catalog applies the same pair against its own manifest.
|
|
20
|
+
*
|
|
21
|
+
* All ship `kind: "advisory"`. Native-vs-non-native applicability is
|
|
22
|
+
* expressed via `check` early-return (no separate `applies` predicate); see
|
|
23
|
+
* each rule's module for the guard.
|
|
24
|
+
*
|
|
25
|
+
* @experimental This API is unstable and may change without notice.
|
|
26
|
+
* @packageDocumentation
|
|
27
|
+
*/
|
|
28
|
+
import { skillMdPresentRule } from "./skill/skill-md-present.js";
|
|
29
|
+
import { manifestPresentRule } from "./skill/manifest-present.js";
|
|
30
|
+
import { frontmatterParseableRule } from "./skill/frontmatter-parseable.js";
|
|
31
|
+
import { frontmatterStandardValidRule } from "./skill/frontmatter-standard-valid.js";
|
|
32
|
+
import { manifestSchemaValidRule } from "./skill/manifest-schema-valid.js";
|
|
33
|
+
import { manifestKeysRecognizedRule } from "./skill/manifest-keys-recognized.js";
|
|
34
|
+
import { recommendedPacksValidRule } from "./skill/recommended-packs-valid.js";
|
|
35
|
+
import { standaloneDeclarationValidRule } from "./skill/standalone-declaration-valid.js";
|
|
36
|
+
/**
|
|
37
|
+
* Ordered v1 `skill/*` rule catalog. Declaration order is the evaluation
|
|
38
|
+
* order within a single `evaluateContexts` call (deterministic ordering is
|
|
39
|
+
* test-observable; see `evaluate.ts`).
|
|
40
|
+
*
|
|
41
|
+
* @experimental This API is unstable and may change without notice.
|
|
42
|
+
*/
|
|
43
|
+
export const skillRules = [
|
|
44
|
+
skillMdPresentRule,
|
|
45
|
+
manifestPresentRule,
|
|
46
|
+
frontmatterParseableRule,
|
|
47
|
+
frontmatterStandardValidRule,
|
|
48
|
+
manifestSchemaValidRule,
|
|
49
|
+
manifestKeysRecognizedRule,
|
|
50
|
+
standaloneDeclarationValidRule,
|
|
51
|
+
recommendedPacksValidRule,
|
|
52
|
+
];
|
|
53
|
+
//# sourceMappingURL=skill.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `subagent/*` manifest envelope — see `../shared/envelope-rules.ts`.
|
|
3
|
+
*/
|
|
4
|
+
import type { SubagentRuleContext } from "../../context.js";
|
|
5
|
+
export declare const subagentEnvelopeRules: import("../shared/envelope-rules.js").ManifestEnvelopeRules<SubagentRuleContext<import("../../context.js").SubagentContent>>;
|
|
6
|
+
//# sourceMappingURL=envelope.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `subagent/*` manifest envelope — see `../shared/envelope-rules.ts`.
|
|
3
|
+
*/
|
|
4
|
+
import { MANIFEST_FILENAME, SubagentManifestSchema, } from "@agentxm/extension-model/unstable/subagents/manifest-schema";
|
|
5
|
+
import { makeManifestEnvelopeRules } from "../shared/envelope-rules.js";
|
|
6
|
+
export const subagentEnvelopeRules = makeManifestEnvelopeRules({
|
|
7
|
+
namespace: "subagent",
|
|
8
|
+
manifestFile: MANIFEST_FILENAME,
|
|
9
|
+
schema: SubagentManifestSchema,
|
|
10
|
+
manifestJson: (context) => context.subject.subagentJson,
|
|
11
|
+
presentDescription: "Subagents include a root subagent.json manifest.",
|
|
12
|
+
presentMissingMessage: "subagent.json is missing. Create subagent.json with the required manifest fields (`owner`, `type`, `name`, `version`).",
|
|
13
|
+
schemaDescription: "subagent.json defines a valid subagent manifest.",
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=envelope.js.map
|