@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.
Files changed (133) hide show
  1. package/LICENSE +110 -0
  2. package/README.md +17 -0
  3. package/dist/src/content/agent-skills-standard.d.ts +17 -0
  4. package/dist/src/content/agent-skills-standard.js +24 -0
  5. package/dist/src/content/frontmatter.d.ts +52 -0
  6. package/dist/src/content/frontmatter.js +115 -0
  7. package/dist/src/content/index.d.ts +11 -0
  8. package/dist/src/content/index.js +11 -0
  9. package/dist/src/content/skill-content.d.ts +43 -0
  10. package/dist/src/content/skill-content.js +184 -0
  11. package/dist/src/content/skill-types.d.ts +22 -0
  12. package/dist/src/content/skill-types.js +9 -0
  13. package/dist/src/content/subagent-content.d.ts +58 -0
  14. package/dist/src/content/subagent-content.js +101 -0
  15. package/dist/src/index.d.ts +23 -0
  16. package/dist/src/index.js +23 -0
  17. package/dist/src/knowledge/index.d.ts +9 -0
  18. package/dist/src/knowledge/index.js +9 -0
  19. package/dist/src/knowledge/knowledge-search.d.ts +32 -0
  20. package/dist/src/knowledge/knowledge-search.js +147 -0
  21. package/dist/src/knowledge/okf.d.ts +86 -0
  22. package/dist/src/knowledge/okf.js +1090 -0
  23. package/dist/src/knowledge/package-inspection.d.ts +125 -0
  24. package/dist/src/knowledge/package-inspection.js +45 -0
  25. package/dist/src/lint/catalog/hook/decision-portability.d.ts +4 -0
  26. package/dist/src/lint/catalog/hook/decision-portability.js +40 -0
  27. package/dist/src/lint/catalog/hook/entrypoint-exists.d.ts +4 -0
  28. package/dist/src/lint/catalog/hook/entrypoint-exists.js +39 -0
  29. package/dist/src/lint/catalog/hook/envelope.d.ts +6 -0
  30. package/dist/src/lint/catalog/hook/envelope.js +15 -0
  31. package/dist/src/lint/catalog/hook/matcher-raw-portability.d.ts +4 -0
  32. package/dist/src/lint/catalog/hook/matcher-raw-portability.js +51 -0
  33. package/dist/src/lint/catalog/hook.d.ts +4 -0
  34. package/dist/src/lint/catalog/hook.js +15 -0
  35. package/dist/src/lint/catalog/knowledge/diagnostics.d.ts +128 -0
  36. package/dist/src/lint/catalog/knowledge/diagnostics.js +78 -0
  37. package/dist/src/lint/catalog/knowledge/envelope.d.ts +6 -0
  38. package/dist/src/lint/catalog/knowledge/envelope.js +15 -0
  39. package/dist/src/lint/catalog/knowledge.d.ts +11 -0
  40. package/dist/src/lint/catalog/knowledge.js +15 -0
  41. package/dist/src/lint/catalog/mcp-server/envelope.d.ts +6 -0
  42. package/dist/src/lint/catalog/mcp-server/envelope.js +15 -0
  43. package/dist/src/lint/catalog/mcp-server.d.ts +4 -0
  44. package/dist/src/lint/catalog/mcp-server.js +4 -0
  45. package/dist/src/lint/catalog/pack/manifest-keys-recognized.d.ts +28 -0
  46. package/dist/src/lint/catalog/pack/manifest-keys-recognized.js +38 -0
  47. package/dist/src/lint/catalog/pack/manifest-present.d.ts +17 -0
  48. package/dist/src/lint/catalog/pack/manifest-present.js +24 -0
  49. package/dist/src/lint/catalog/pack/manifest-schema-valid.d.ts +25 -0
  50. package/dist/src/lint/catalog/pack/manifest-schema-valid.js +33 -0
  51. package/dist/src/lint/catalog/pack-accessor/contexts.d.ts +51 -0
  52. package/dist/src/lint/catalog/pack-accessor/contexts.js +45 -0
  53. package/dist/src/lint/catalog/pack-accessor/platform.d.ts +56 -0
  54. package/dist/src/lint/catalog/pack-accessor/platform.js +93 -0
  55. package/dist/src/lint/catalog/pack-accessor/vft.d.ts +60 -0
  56. package/dist/src/lint/catalog/pack-accessor/vft.js +85 -0
  57. package/dist/src/lint/catalog/pack.d.ts +31 -0
  58. package/dist/src/lint/catalog/pack.js +36 -0
  59. package/dist/src/lint/catalog/rule/envelope.d.ts +6 -0
  60. package/dist/src/lint/catalog/rule/envelope.js +15 -0
  61. package/dist/src/lint/catalog/rule.d.ts +4 -0
  62. package/dist/src/lint/catalog/rule.js +4 -0
  63. package/dist/src/lint/catalog/shared/envelope-rules.d.ts +88 -0
  64. package/dist/src/lint/catalog/shared/envelope-rules.js +84 -0
  65. package/dist/src/lint/catalog/shared/manifest-json.d.ts +18 -0
  66. package/dist/src/lint/catalog/shared/manifest-json.js +28 -0
  67. package/dist/src/lint/catalog/shared/manifest-present.d.ts +25 -0
  68. package/dist/src/lint/catalog/shared/manifest-present.js +37 -0
  69. package/dist/src/lint/catalog/shared/recommended-packs-rules.d.ts +70 -0
  70. package/dist/src/lint/catalog/shared/recommended-packs-rules.js +139 -0
  71. package/dist/src/lint/catalog/shared/schema-rule.d.ts +57 -0
  72. package/dist/src/lint/catalog/shared/schema-rule.js +102 -0
  73. package/dist/src/lint/catalog/skill/frontmatter-parseable.d.ts +31 -0
  74. package/dist/src/lint/catalog/skill/frontmatter-parseable.js +148 -0
  75. package/dist/src/lint/catalog/skill/frontmatter-standard-valid.d.ts +13 -0
  76. package/dist/src/lint/catalog/skill/frontmatter-standard-valid.js +61 -0
  77. package/dist/src/lint/catalog/skill/manifest-keys-recognized.d.ts +26 -0
  78. package/dist/src/lint/catalog/skill/manifest-keys-recognized.js +41 -0
  79. package/dist/src/lint/catalog/skill/manifest-present.d.ts +23 -0
  80. package/dist/src/lint/catalog/skill/manifest-present.js +32 -0
  81. package/dist/src/lint/catalog/skill/manifest-schema-valid.d.ts +21 -0
  82. package/dist/src/lint/catalog/skill/manifest-schema-valid.js +36 -0
  83. package/dist/src/lint/catalog/skill/recommended-packs-valid.d.ts +8 -0
  84. package/dist/src/lint/catalog/skill/recommended-packs-valid.js +12 -0
  85. package/dist/src/lint/catalog/skill/skill-md-present.d.ts +17 -0
  86. package/dist/src/lint/catalog/skill/skill-md-present.js +37 -0
  87. package/dist/src/lint/catalog/skill/standalone-declaration-valid.d.ts +8 -0
  88. package/dist/src/lint/catalog/skill/standalone-declaration-valid.js +12 -0
  89. package/dist/src/lint/catalog/skill-accessor/contexts.d.ts +61 -0
  90. package/dist/src/lint/catalog/skill-accessor/contexts.js +55 -0
  91. package/dist/src/lint/catalog/skill-accessor/platform.d.ts +53 -0
  92. package/dist/src/lint/catalog/skill-accessor/platform.js +90 -0
  93. package/dist/src/lint/catalog/skill-accessor/vft.d.ts +77 -0
  94. package/dist/src/lint/catalog/skill-accessor/vft.js +135 -0
  95. package/dist/src/lint/catalog/skill.d.ts +38 -0
  96. package/dist/src/lint/catalog/skill.js +53 -0
  97. package/dist/src/lint/catalog/subagent/envelope.d.ts +6 -0
  98. package/dist/src/lint/catalog/subagent/envelope.js +15 -0
  99. package/dist/src/lint/catalog/subagent.d.ts +4 -0
  100. package/dist/src/lint/catalog/subagent.js +4 -0
  101. package/dist/src/lint/catalog-metadata.d.ts +125 -0
  102. package/dist/src/lint/catalog-metadata.js +642 -0
  103. package/dist/src/lint/compose-path.d.ts +28 -0
  104. package/dist/src/lint/compose-path.js +64 -0
  105. package/dist/src/lint/config.d.ts +77 -0
  106. package/dist/src/lint/config.js +99 -0
  107. package/dist/src/lint/context.d.ts +239 -0
  108. package/dist/src/lint/context.js +17 -0
  109. package/dist/src/lint/describe-document.d.ts +31 -0
  110. package/dist/src/lint/describe-document.js +50 -0
  111. package/dist/src/lint/evaluate.d.ts +47 -0
  112. package/dist/src/lint/evaluate.js +73 -0
  113. package/dist/src/lint/index.d.ts +36 -0
  114. package/dist/src/lint/index.js +34 -0
  115. package/dist/src/lint/issues-to-findings.d.ts +35 -0
  116. package/dist/src/lint/issues-to-findings.js +149 -0
  117. package/dist/src/lint/rule.d.ts +97 -0
  118. package/dist/src/lint/rule.js +17 -0
  119. package/dist/src/packaging/archive-guardrails.d.ts +39 -0
  120. package/dist/src/packaging/archive-guardrails.js +250 -0
  121. package/dist/src/packaging/filtered-package-validation.d.ts +24 -0
  122. package/dist/src/packaging/filtered-package-validation.js +117 -0
  123. package/dist/src/packaging/ingest-limits.d.ts +25 -0
  124. package/dist/src/packaging/ingest-limits.js +41 -0
  125. package/dist/src/packaging/input-normalization.d.ts +40 -0
  126. package/dist/src/packaging/input-normalization.js +125 -0
  127. package/dist/src/packaging/manifest-policy.d.ts +611 -0
  128. package/dist/src/packaging/manifest-policy.js +196 -0
  129. package/dist/src/packaging/test-zip-helpers.d.ts +13 -0
  130. package/dist/src/packaging/test-zip-helpers.js +117 -0
  131. package/dist/src/testing.d.ts +9 -0
  132. package/dist/src/testing.js +9 -0
  133. package/package.json +65 -0
@@ -0,0 +1,4 @@
1
+ import type { McpServerRuleContext } from "../context.js";
2
+ import type { LintRule } from "../rule.js";
3
+ export declare const mcpServerRules: ReadonlyArray<LintRule<McpServerRuleContext>>;
4
+ //# sourceMappingURL=mcp-server.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { mcpServerEnvelopeRules } from "./mcp-server/envelope.js";
2
+ import { orderedEnvelopeRules } from "./shared/envelope-rules.js";
3
+ export const mcpServerRules = orderedEnvelopeRules(mcpServerEnvelopeRules);
4
+ //# sourceMappingURL=mcp-server.js.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * `pack/manifest-keys-recognized` — `pack.json` contains only keys
3
+ * declared by `PackManifestSchema`.
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
+ * A forbidden `packs:` dependency section (ONTOLOGY D015 "Cross-Domain
10
+ * Pack Semantics") decodes as an unrecognized top-level key here
11
+ * and surfaces at error severity here.
12
+ *
13
+ * Allowed-keys set is derived from `PackManifestSchema.fields` — no
14
+ * copy-paste of field names. A schema gain (or rename) automatically updates
15
+ * the allowlist.
16
+ *
17
+ * Early-return arm (no findings):
18
+ *
19
+ * - `subject.packJson === undefined` / non-object — nothing to enumerate;
20
+ * `pack/manifest-present` owns the absence case.
21
+ *
22
+ * @experimental This API is unstable and may change without notice.
23
+ * @packageDocumentation
24
+ */
25
+ import type { PackRuleContext } from "../../context.js";
26
+ import type { AdvisoryRule } from "../../rule.js";
27
+ export declare const manifestKeysRecognizedRule: AdvisoryRule<PackRuleContext>;
28
+ //# sourceMappingURL=manifest-keys-recognized.d.ts.map
@@ -0,0 +1,38 @@
1
+ /**
2
+ * `pack/manifest-keys-recognized` — `pack.json` contains only keys
3
+ * declared by `PackManifestSchema`.
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
+ * A forbidden `packs:` dependency section (ONTOLOGY D015 "Cross-Domain
10
+ * Pack Semantics") decodes as an unrecognized top-level key here
11
+ * and surfaces at error severity here.
12
+ *
13
+ * Allowed-keys set is derived from `PackManifestSchema.fields` — no
14
+ * copy-paste of field names. A schema gain (or rename) automatically updates
15
+ * the allowlist.
16
+ *
17
+ * Early-return arm (no findings):
18
+ *
19
+ * - `subject.packJson === undefined` / non-object — nothing to enumerate;
20
+ * `pack/manifest-present` owns the absence case.
21
+ *
22
+ * @experimental This API is unstable and may change without notice.
23
+ * @packageDocumentation
24
+ */
25
+ import * as Effect from "effect/Effect";
26
+ import { PackManifestSchema } from "@agentxm/extension-model/unstable/packs/manifest-schema";
27
+ import { enumerateUnknownTopLevelKeys, structFieldKeys } from "../shared/schema-rule.js";
28
+ const RULE_ID = "pack/manifest-keys-recognized";
29
+ const PACK_JSON = "pack.json";
30
+ const allowedKeys = structFieldKeys(PackManifestSchema);
31
+ export const manifestKeysRecognizedRule = {
32
+ id: RULE_ID,
33
+ description: "pack.json uses only supported top-level fields.",
34
+ kind: "advisory",
35
+ severity: "error",
36
+ check: (context) => Effect.succeed(enumerateUnknownTopLevelKeys(RULE_ID, "error", PACK_JSON, allowedKeys, context.subject.packJson)),
37
+ };
38
+ //# sourceMappingURL=manifest-keys-recognized.js.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * `pack/manifest-present` — packs must have a `pack.json` at the
3
+ * pack root.
4
+ *
5
+ * Packs are registry-only at v1; every pack context is expected to expose a
6
+ * manifest. Unlike `skill/manifest-present`, there is no native-vs-non-native
7
+ * split — the rule applies to every pack context unconditionally.
8
+ *
9
+ * Advisory-only — scaffolding a manifest is `axm packs new` (a user-authored
10
+ * action) per the lint design.
11
+ *
12
+ * @experimental This API is unstable and may change without notice.
13
+ * @packageDocumentation
14
+ */
15
+ import type { PackRuleContext } from "../../context.js";
16
+ export declare const manifestPresentRule: import("../../rule.ts").AdvisoryRule<PackRuleContext<import("../../context.js").PackContent>>;
17
+ //# sourceMappingURL=manifest-present.d.ts.map
@@ -0,0 +1,24 @@
1
+ /**
2
+ * `pack/manifest-present` — packs must have a `pack.json` at the
3
+ * pack root.
4
+ *
5
+ * Packs are registry-only at v1; every pack context is expected to expose a
6
+ * manifest. Unlike `skill/manifest-present`, there is no native-vs-non-native
7
+ * split — the rule applies to every pack context unconditionally.
8
+ *
9
+ * Advisory-only — scaffolding a manifest is `axm packs new` (a user-authored
10
+ * action) per the lint design.
11
+ *
12
+ * @experimental This API is unstable and may change without notice.
13
+ * @packageDocumentation
14
+ */
15
+ import { makeManifestPresentRule } from "../shared/manifest-present.js";
16
+ const RULE_ID = "pack/manifest-present";
17
+ const PACK_JSON = "pack.json";
18
+ export const manifestPresentRule = makeManifestPresentRule({
19
+ ruleId: RULE_ID,
20
+ description: "Packs include a root pack.json manifest.",
21
+ manifestFile: PACK_JSON,
22
+ missingMessage: "pack.json is missing. Create pack.json with the required manifest fields (`owner`, `type`, `name`, `version`).",
23
+ });
24
+ //# sourceMappingURL=manifest-present.js.map
@@ -0,0 +1,25 @@
1
+ /**
2
+ * `pack/manifest-schema-valid` — `pack.json` conforms to
3
+ * `PackManifestSchema`.
4
+ *
5
+ * Delegates to Effect Schema. Issues map 1:1 to findings via
6
+ * `issuesToFindings`.
7
+ *
8
+ * Early-return arm (no findings):
9
+ *
10
+ * - `subject.packJson === undefined` — manifest is absent (covered by
11
+ * `pack/manifest-present`).
12
+ *
13
+ * Dependency-map FQN grammar and `VersionRange` decode arms are owned by
14
+ * `PackManifestSchema` itself — the dependency sections are typed
15
+ * `Record<FQN, VersionRange>` so unknown FQNs, malformed grammar, and
16
+ * bad semver ranges surface as normal schema issues through the shared
17
+ * `schemaDecodeFindings` plumbing.
18
+ *
19
+ * @experimental This API is unstable and may change without notice.
20
+ * @packageDocumentation
21
+ */
22
+ import type { PackRuleContext } from "../../context.js";
23
+ import type { AdvisoryRule } from "../../rule.js";
24
+ export declare const manifestSchemaValidRule: AdvisoryRule<PackRuleContext>;
25
+ //# sourceMappingURL=manifest-schema-valid.d.ts.map
@@ -0,0 +1,33 @@
1
+ /**
2
+ * `pack/manifest-schema-valid` — `pack.json` conforms to
3
+ * `PackManifestSchema`.
4
+ *
5
+ * Delegates to Effect Schema. Issues map 1:1 to findings via
6
+ * `issuesToFindings`.
7
+ *
8
+ * Early-return arm (no findings):
9
+ *
10
+ * - `subject.packJson === undefined` — manifest is absent (covered by
11
+ * `pack/manifest-present`).
12
+ *
13
+ * Dependency-map FQN grammar and `VersionRange` decode arms are owned by
14
+ * `PackManifestSchema` itself — the dependency sections are typed
15
+ * `Record<FQN, VersionRange>` so unknown FQNs, malformed grammar, and
16
+ * bad semver ranges surface as normal schema issues through the shared
17
+ * `schemaDecodeFindings` plumbing.
18
+ *
19
+ * @experimental This API is unstable and may change without notice.
20
+ * @packageDocumentation
21
+ */
22
+ import { PackManifestSchema } from "@agentxm/extension-model/unstable/packs/manifest-schema";
23
+ import { schemaDecodeFindings } from "../shared/schema-rule.js";
24
+ const RULE_ID = "pack/manifest-schema-valid";
25
+ const PACK_JSON = "pack.json";
26
+ export const manifestSchemaValidRule = {
27
+ id: RULE_ID,
28
+ description: "pack.json defines a valid pack manifest.",
29
+ kind: "advisory",
30
+ severity: "error",
31
+ check: (context) => schemaDecodeFindings(RULE_ID, "error", PACK_JSON, PackManifestSchema, context.subject.packJson),
32
+ };
33
+ //# sourceMappingURL=manifest-schema-valid.js.map
@@ -0,0 +1,51 @@
1
+ /**
2
+ * `buildPackRuleContexts` — build `PackRuleContext[]` from a structural
3
+ * `installedPacks` 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 pack:
8
+ *
9
+ * - `packJson` — pre-decoded `pack.json` when present (caller
10
+ * decodes once per pack, so rules don't re-read + re-parse).
11
+ * - `displayRoot` — posix-relative root used by the renderer; the caller
12
+ * picks per provenance (see the table below).
13
+ * - `files` — the pre-bound `PackFileAccessor`. The caller chooses VFT or
14
+ * platform-backed.
15
+ *
16
+ * Provenance → `displayRoot` table:
17
+ *
18
+ * | Surface | `displayRoot` |
19
+ * | ---------------------------------- | ----------------------------------------- |
20
+ * | Publish | `""` |
21
+ * | Registry-installed pack | `agent_extensions/<@owner>/packs/<name>` |
22
+ *
23
+ * @experimental This API is unstable and may change without notice.
24
+ * @packageDocumentation
25
+ */
26
+ import type { PackFileAccessor, PackRuleContext } from "../../context.js";
27
+ /**
28
+ * Minimal structural shape `buildPackRuleContexts` needs per installed
29
+ * pack. The full lint workspace view exposes
30
+ * `installedPacks: ReadonlyArray<InstalledPackInfo>`.
31
+ *
32
+ * @experimental This API is unstable and may change without notice.
33
+ */
34
+ export interface InstalledPackInfo {
35
+ readonly packJson: unknown;
36
+ readonly displayRoot: string;
37
+ readonly files: PackFileAccessor;
38
+ }
39
+ /**
40
+ * Project an input's `installedPacks` into `PackRuleContext`s with their
41
+ * `displayRoot` and `subject` fields pre-populated.
42
+ *
43
+ * Publish callers bypass this helper and construct a single context directly
44
+ * — they have exactly one pack in play and no workspace.
45
+ *
46
+ * @experimental This API is unstable and may change without notice.
47
+ */
48
+ export declare const buildPackRuleContexts: (input: {
49
+ readonly installedPacks: ReadonlyArray<InstalledPackInfo>;
50
+ }) => ReadonlyArray<PackRuleContext>;
51
+ //# sourceMappingURL=contexts.d.ts.map
@@ -0,0 +1,45 @@
1
+ /**
2
+ * `buildPackRuleContexts` — build `PackRuleContext[]` from a structural
3
+ * `installedPacks` 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 pack:
8
+ *
9
+ * - `packJson` — pre-decoded `pack.json` when present (caller
10
+ * decodes once per pack, so rules don't re-read + re-parse).
11
+ * - `displayRoot` — posix-relative root used by the renderer; the caller
12
+ * picks per provenance (see the table below).
13
+ * - `files` — the pre-bound `PackFileAccessor`. The caller chooses VFT or
14
+ * platform-backed.
15
+ *
16
+ * Provenance → `displayRoot` table:
17
+ *
18
+ * | Surface | `displayRoot` |
19
+ * | ---------------------------------- | ----------------------------------------- |
20
+ * | Publish | `""` |
21
+ * | Registry-installed pack | `agent_extensions/<@owner>/packs/<name>` |
22
+ *
23
+ * @experimental This API is unstable and may change without notice.
24
+ * @packageDocumentation
25
+ */
26
+ // -----------------------------------------------------------------------------
27
+ // buildPackRuleContexts
28
+ // -----------------------------------------------------------------------------
29
+ /**
30
+ * Project an input's `installedPacks` into `PackRuleContext`s with their
31
+ * `displayRoot` and `subject` fields pre-populated.
32
+ *
33
+ * Publish callers bypass this helper and construct a single context directly
34
+ * — they have exactly one pack in play and no workspace.
35
+ *
36
+ * @experimental This API is unstable and may change without notice.
37
+ */
38
+ export const buildPackRuleContexts = (input) => input.installedPacks.map((info) => ({
39
+ subject: {
40
+ packJson: info.packJson,
41
+ },
42
+ files: info.files,
43
+ displayRoot: info.displayRoot,
44
+ }));
45
+ //# sourceMappingURL=contexts.js.map
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Platform-backed `PackFileAccessor` for `axm lint`.
3
+ *
4
+ * Maps accessor-relative posix paths to on-disk absolute paths rooted at
5
+ * the caller-supplied pack-root directory. Layout conventions per
6
+ * the lint design "Pack accessor root":
7
+ *
8
+ * - **Registry-installed:**
9
+ * `<workspaceRoot>/agent_extensions/<@owner>/packs/<sanitized-name>/`
10
+ *
11
+ * Packs are registry-only at v1 — there is no non-native variant. The caller
12
+ * (`buildPackRuleContexts` or the CLI entry point) picks the root from
13
+ * `computePackPathsForLayout` in `@agentxm/workspace-state`.
14
+ *
15
+ * The `pack.json` sits directly under `canonicalPath`; there is no
16
+ * `src/` subdirectory like skills have — the pack install operation in
17
+ * `@agentxm/extension-lifecycle` owns the authoritative layout.
18
+ *
19
+ * Bounds enforcement:
20
+ *
21
+ * - No `..` segments in accessor-relative paths.
22
+ * - No absolute paths (posix or Windows drive letters).
23
+ * - Resolved absolute paths are verified to stay under the accessor root.
24
+ *
25
+ * The accessor is built via a factory that captures a pre-resolved
26
+ * `FileSystem.FileSystem` + `Path.Path` services and an absolute root, so
27
+ * `PackFileAccessor` stays Layer-free at rule-evaluation time (per
28
+ * `lint-engine` spec "Rule contexts expose narrow caller-bound accessors").
29
+ * It mirrors the VFT-backed accessor in `./vft.ts`; the two are the only
30
+ * `PackFileAccessor` implementations, one for on-disk roots and one for an
31
+ * extracted archive.
32
+ *
33
+ * @experimental This API is unstable and may change without notice.
34
+ * @packageDocumentation
35
+ */
36
+ import type * as FileSystem from "effect/FileSystem";
37
+ import type * as Path from "effect/Path";
38
+ import type { PackFileAccessor } from "../../context.js";
39
+ /**
40
+ * Platform services needed by the platform-backed pack accessor.
41
+ */
42
+ export interface PackAccessorPlatform {
43
+ readonly fs: FileSystem.FileSystem;
44
+ readonly path: Path.Path;
45
+ }
46
+ /**
47
+ * Build a platform-backed `PackFileAccessor` rooted at `absoluteRoot`.
48
+ *
49
+ * `absoluteRoot` SHOULD be the absolute path to the pack root directory
50
+ * (`canonicalPath` from `computePackPathsForLayout` in
51
+ * `@agentxm/workspace-state`).
52
+ *
53
+ * @experimental This API is unstable and may change without notice.
54
+ */
55
+ export declare const makePlatformPackFileAccessor: (platform: PackAccessorPlatform, absoluteRoot: string) => PackFileAccessor;
56
+ //# sourceMappingURL=platform.d.ts.map
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Platform-backed `PackFileAccessor` for `axm lint`.
3
+ *
4
+ * Maps accessor-relative posix paths to on-disk absolute paths rooted at
5
+ * the caller-supplied pack-root directory. Layout conventions per
6
+ * the lint design "Pack accessor root":
7
+ *
8
+ * - **Registry-installed:**
9
+ * `<workspaceRoot>/agent_extensions/<@owner>/packs/<sanitized-name>/`
10
+ *
11
+ * Packs are registry-only at v1 — there is no non-native variant. The caller
12
+ * (`buildPackRuleContexts` or the CLI entry point) picks the root from
13
+ * `computePackPathsForLayout` in `@agentxm/workspace-state`.
14
+ *
15
+ * The `pack.json` sits directly under `canonicalPath`; there is no
16
+ * `src/` subdirectory like skills have — the pack install operation in
17
+ * `@agentxm/extension-lifecycle` owns the authoritative layout.
18
+ *
19
+ * Bounds enforcement:
20
+ *
21
+ * - No `..` segments in accessor-relative paths.
22
+ * - No absolute paths (posix or Windows drive letters).
23
+ * - Resolved absolute paths are verified to stay under the accessor root.
24
+ *
25
+ * The accessor is built via a factory that captures a pre-resolved
26
+ * `FileSystem.FileSystem` + `Path.Path` services and an absolute root, so
27
+ * `PackFileAccessor` stays Layer-free at rule-evaluation time (per
28
+ * `lint-engine` spec "Rule contexts expose narrow caller-bound accessors").
29
+ * It mirrors the VFT-backed accessor in `./vft.ts`; the two are the only
30
+ * `PackFileAccessor` implementations, one for on-disk roots and one for an
31
+ * extracted archive.
32
+ *
33
+ * @experimental This API is unstable and may change without notice.
34
+ * @packageDocumentation
35
+ */
36
+ import * as Effect from "effect/Effect";
37
+ /**
38
+ * Build a platform-backed `PackFileAccessor` rooted at `absoluteRoot`.
39
+ *
40
+ * `absoluteRoot` SHOULD be the absolute path to the pack root directory
41
+ * (`canonicalPath` from `computePackPathsForLayout` in
42
+ * `@agentxm/workspace-state`).
43
+ *
44
+ * @experimental This API is unstable and may change without notice.
45
+ */
46
+ export const makePlatformPackFileAccessor = (platform, absoluteRoot) => {
47
+ const { fs, path } = platform;
48
+ const normalizedRoot = path.resolve(absoluteRoot);
49
+ const resolveWithinRoot = (input) => {
50
+ if (input === "" || input === "." || input === "./") {
51
+ return { kind: "ok", absolute: normalizedRoot };
52
+ }
53
+ if (/^[a-z]:[\\/]/i.test(input) || input.startsWith("/") || input.startsWith("\\")) {
54
+ return { kind: "escape" };
55
+ }
56
+ const normalized = input.replace(/\\/g, "/").replace(/^\.\//, "");
57
+ for (const segment of normalized.split("/")) {
58
+ if (segment === "..") {
59
+ return { kind: "escape" };
60
+ }
61
+ }
62
+ const absolute = path.resolve(normalizedRoot, normalized);
63
+ if (absolute !== normalizedRoot && !absolute.startsWith(`${normalizedRoot}${path.sep}`)) {
64
+ return { kind: "escape" };
65
+ }
66
+ return { kind: "ok", absolute };
67
+ };
68
+ const makeAccessError = (p, reason, message) => ({
69
+ _tag: "FileAccessError",
70
+ path: p,
71
+ reason,
72
+ message,
73
+ });
74
+ return {
75
+ exists: (p) => {
76
+ const resolved = resolveWithinRoot(p);
77
+ if (resolved.kind !== "ok") {
78
+ return Effect.succeed(false);
79
+ }
80
+ return fs.exists(resolved.absolute).pipe(Effect.catch(() => Effect.succeed(false)));
81
+ },
82
+ readBytes: (p) => {
83
+ const resolved = resolveWithinRoot(p);
84
+ if (resolved.kind === "escape") {
85
+ return Effect.fail(makeAccessError(p, "path-escape", `path escapes the accessor root: ${p}`));
86
+ }
87
+ return fs
88
+ .readFile(resolved.absolute)
89
+ .pipe(Effect.mapError((cause) => makeAccessError(p, "read-error", `read failed at ${p}: ${String(cause)}`)));
90
+ },
91
+ };
92
+ };
93
+ //# sourceMappingURL=platform.js.map
@@ -0,0 +1,60 @@
1
+ /**
2
+ * VFT-backed `PackFileAccessor` 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.
16
+ * - Any path containing a `..` segment raises `FileAccessError {
17
+ * reason: "path-escape" }` from `readBytes` and resolves to `false` from
18
+ * `exists`.
19
+ * - Absolute paths (starting with `/` or a Windows drive letter) are
20
+ * treated as escape attempts.
21
+ *
22
+ * Mirrors the skill VFT accessor (`../skill-accessor/vft.ts`). The VFTNode
23
+ * interface is intentionally the same so a publish caller can extract a
24
+ * single archive once and pass the same tree to either accessor factory.
25
+ *
26
+ * @experimental This API is unstable and may change without notice.
27
+ * @packageDocumentation
28
+ */
29
+ import type { PackFileAccessor } from "../../context.js";
30
+ /**
31
+ * Minimal shape of a Virtual File Tree consumed by the accessor.
32
+ *
33
+ * Shape-compatible with `../skill-accessor/vft.ts#VFTNode`; kept as a local
34
+ * declaration to avoid a cross-subfolder import and to document what this
35
+ * accessor uses.
36
+ *
37
+ * @experimental This API is unstable and may change without notice.
38
+ */
39
+ export interface PackVFTNode {
40
+ /**
41
+ * Whether the given posix path points to a file within the tree.
42
+ */
43
+ readonly hasFile: (posixPath: string) => boolean;
44
+ /**
45
+ * Return the bytes for the given posix path, or `undefined` when the path
46
+ * does not resolve to a file (missing, directory, or outside the tree).
47
+ */
48
+ readonly getFile: (posixPath: string) => Uint8Array | undefined;
49
+ }
50
+ /**
51
+ * Build a VFT-backed `PackFileAccessor` rooted at the tree's root.
52
+ *
53
+ * Callers that root the pack at a sub-path of the archive should pre-strip
54
+ * that sub-path before constructing the tree — the accessor enforces no
55
+ * `..` escape above the root it was given.
56
+ *
57
+ * @experimental This API is unstable and may change without notice.
58
+ */
59
+ export declare const makeVftPackFileAccessor: (tree: PackVFTNode) => PackFileAccessor;
60
+ //# sourceMappingURL=vft.d.ts.map
@@ -0,0 +1,85 @@
1
+ /**
2
+ * VFT-backed `PackFileAccessor` 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.
16
+ * - Any path containing a `..` segment raises `FileAccessError {
17
+ * reason: "path-escape" }` from `readBytes` and resolves to `false` from
18
+ * `exists`.
19
+ * - Absolute paths (starting with `/` or a Windows drive letter) are
20
+ * treated as escape attempts.
21
+ *
22
+ * Mirrors the skill VFT accessor (`../skill-accessor/vft.ts`). The VFTNode
23
+ * interface is intentionally the same so a publish caller can extract a
24
+ * single archive once and pass the same tree to either accessor factory.
25
+ *
26
+ * @experimental This API is unstable and may change without notice.
27
+ * @packageDocumentation
28
+ */
29
+ import * as Effect from "effect/Effect";
30
+ /**
31
+ * Build a VFT-backed `PackFileAccessor` rooted at the tree's root.
32
+ *
33
+ * Callers that root the pack at a sub-path of the archive should pre-strip
34
+ * that sub-path before constructing the tree — the accessor enforces no
35
+ * `..` escape above the root it was given.
36
+ *
37
+ * @experimental This API is unstable and may change without notice.
38
+ */
39
+ export const makeVftPackFileAccessor = (tree) => {
40
+ return {
41
+ exists: (path) => {
42
+ const normalized = normalizeAndCheck(path);
43
+ if (normalized.kind !== "ok") {
44
+ return Effect.succeed(false);
45
+ }
46
+ return Effect.succeed(tree.hasFile(normalized.path));
47
+ },
48
+ readBytes: (path) => {
49
+ const normalized = normalizeAndCheck(path);
50
+ if (normalized.kind === "escape") {
51
+ return failFileAccess(path, "path-escape", `path escapes the accessor root: ${path}`);
52
+ }
53
+ const bytes = tree.getFile(normalized.path);
54
+ if (bytes === undefined) {
55
+ return failFileAccess(path, "read-error", `file not found at ${path}`);
56
+ }
57
+ return Effect.succeed(bytes);
58
+ },
59
+ };
60
+ };
61
+ const normalizeAndCheck = (path) => {
62
+ if (path === "" || path === "." || path === "./") {
63
+ return { kind: "ok", path: "" };
64
+ }
65
+ // Windows drive letters (`C:/`) and absolute posix paths both count as
66
+ // escape attempts at a pack-rooted accessor.
67
+ if (/^[a-z]:[\\/]/i.test(path) || path.startsWith("/") || path.startsWith("\\")) {
68
+ return { kind: "escape" };
69
+ }
70
+ const normalized = path.replace(/\\/g, "/").replace(/^\.\//, "");
71
+ const segments = normalized.split("/");
72
+ for (const segment of segments) {
73
+ if (segment === "..") {
74
+ return { kind: "escape" };
75
+ }
76
+ }
77
+ return { kind: "ok", path: normalized };
78
+ };
79
+ const failFileAccess = (path, reason, message) => Effect.fail({
80
+ _tag: "FileAccessError",
81
+ path,
82
+ reason,
83
+ message,
84
+ });
85
+ //# sourceMappingURL=vft.js.map
@@ -0,0 +1,31 @@
1
+ /**
2
+ * `pack/*` rule catalog — the v1 three-rule set.
3
+ *
4
+ * Per the lint design, registry publish and `axm lint`
5
+ * run exactly these rules against each pack context:
6
+ *
7
+ * | ID | Severity | Autofix |
8
+ * | ------------------------------- | -------- | ------- |
9
+ * | `pack/manifest-present` | error | — |
10
+ * | `pack/manifest-schema-valid` | error | — |
11
+ * | `pack/manifest-keys-recognized` | error | — |
12
+ *
13
+ * All three ship `kind: "advisory"`. Packs are registry-only at v1 (no
14
+ * non-native arm), so there is no applicability discriminator — every pack
15
+ * context runs every rule and the `check` body's early-return arms handle
16
+ * manifest-absent cases.
17
+ *
18
+ * @experimental This API is unstable and may change without notice.
19
+ * @packageDocumentation
20
+ */
21
+ import type { LintRule } from "../rule.js";
22
+ import type { PackRuleContext } from "../context.js";
23
+ /**
24
+ * Ordered v1 `pack/*` rule catalog. Declaration order is the evaluation
25
+ * order within a single `evaluateContexts` call (deterministic ordering is
26
+ * test-observable; see `evaluate.ts`).
27
+ *
28
+ * @experimental This API is unstable and may change without notice.
29
+ */
30
+ export declare const packRules: ReadonlyArray<LintRule<PackRuleContext>>;
31
+ //# sourceMappingURL=pack.d.ts.map
@@ -0,0 +1,36 @@
1
+ /**
2
+ * `pack/*` rule catalog — the v1 three-rule set.
3
+ *
4
+ * Per the lint design, registry publish and `axm lint`
5
+ * run exactly these rules against each pack context:
6
+ *
7
+ * | ID | Severity | Autofix |
8
+ * | ------------------------------- | -------- | ------- |
9
+ * | `pack/manifest-present` | error | — |
10
+ * | `pack/manifest-schema-valid` | error | — |
11
+ * | `pack/manifest-keys-recognized` | error | — |
12
+ *
13
+ * All three ship `kind: "advisory"`. Packs are registry-only at v1 (no
14
+ * non-native arm), so there is no applicability discriminator — every pack
15
+ * context runs every rule and the `check` body's early-return arms handle
16
+ * manifest-absent cases.
17
+ *
18
+ * @experimental This API is unstable and may change without notice.
19
+ * @packageDocumentation
20
+ */
21
+ import { manifestPresentRule } from "./pack/manifest-present.js";
22
+ import { manifestSchemaValidRule } from "./pack/manifest-schema-valid.js";
23
+ import { manifestKeysRecognizedRule } from "./pack/manifest-keys-recognized.js";
24
+ /**
25
+ * Ordered v1 `pack/*` rule catalog. Declaration order is the evaluation
26
+ * order within a single `evaluateContexts` call (deterministic ordering is
27
+ * test-observable; see `evaluate.ts`).
28
+ *
29
+ * @experimental This API is unstable and may change without notice.
30
+ */
31
+ export const packRules = [
32
+ manifestPresentRule,
33
+ manifestSchemaValidRule,
34
+ manifestKeysRecognizedRule,
35
+ ];
36
+ //# sourceMappingURL=pack.js.map
@@ -0,0 +1,6 @@
1
+ /**
2
+ * `rule/*` manifest envelope — see `../shared/envelope-rules.ts`.
3
+ */
4
+ import type { RuleRuleContext } from "../../context.js";
5
+ export declare const ruleEnvelopeRules: import("../shared/envelope-rules.js").ManifestEnvelopeRules<RuleRuleContext<import("../../context.js").RuleContent>>;
6
+ //# sourceMappingURL=envelope.d.ts.map