@agentxm/registry-protocol 0.28.4-bootstrap.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.
Files changed (137) hide show
  1. package/LICENSE +110 -0
  2. package/README.md +13 -0
  3. package/dist/src/unstable/content/agent-skills-standard.d.ts +17 -0
  4. package/dist/src/unstable/content/agent-skills-standard.js +24 -0
  5. package/dist/src/unstable/content/frontmatter.d.ts +52 -0
  6. package/dist/src/unstable/content/frontmatter.js +115 -0
  7. package/dist/src/unstable/content/index.d.ts +11 -0
  8. package/dist/src/unstable/content/index.js +11 -0
  9. package/dist/src/unstable/content/skill-content.d.ts +43 -0
  10. package/dist/src/unstable/content/skill-content.js +184 -0
  11. package/dist/src/unstable/content/skill-types.d.ts +22 -0
  12. package/dist/src/unstable/content/skill-types.js +9 -0
  13. package/dist/src/unstable/content/subagent-content.d.ts +58 -0
  14. package/dist/src/unstable/content/subagent-content.js +101 -0
  15. package/dist/src/unstable/knowledge/index.d.ts +8 -0
  16. package/dist/src/unstable/knowledge/index.js +8 -0
  17. package/dist/src/unstable/knowledge/knowledge-search.d.ts +32 -0
  18. package/dist/src/unstable/knowledge/knowledge-search.js +147 -0
  19. package/dist/src/unstable/knowledge/okf.d.ts +86 -0
  20. package/dist/src/unstable/knowledge/okf.js +1090 -0
  21. package/dist/src/unstable/lint/catalog/hook/decision-portability.d.ts +4 -0
  22. package/dist/src/unstable/lint/catalog/hook/decision-portability.js +40 -0
  23. package/dist/src/unstable/lint/catalog/hook/entrypoint-exists.d.ts +4 -0
  24. package/dist/src/unstable/lint/catalog/hook/entrypoint-exists.js +39 -0
  25. package/dist/src/unstable/lint/catalog/hook/envelope.d.ts +6 -0
  26. package/dist/src/unstable/lint/catalog/hook/envelope.js +15 -0
  27. package/dist/src/unstable/lint/catalog/hook/matcher-raw-portability.d.ts +4 -0
  28. package/dist/src/unstable/lint/catalog/hook/matcher-raw-portability.js +51 -0
  29. package/dist/src/unstable/lint/catalog/hook.d.ts +4 -0
  30. package/dist/src/unstable/lint/catalog/hook.js +17 -0
  31. package/dist/src/unstable/lint/catalog/knowledge/diagnostics.d.ts +128 -0
  32. package/dist/src/unstable/lint/catalog/knowledge/diagnostics.js +78 -0
  33. package/dist/src/unstable/lint/catalog/knowledge/envelope.d.ts +6 -0
  34. package/dist/src/unstable/lint/catalog/knowledge/envelope.js +15 -0
  35. package/dist/src/unstable/lint/catalog/knowledge.d.ts +5 -0
  36. package/dist/src/unstable/lint/catalog/knowledge.js +11 -0
  37. package/dist/src/unstable/lint/catalog/mcp-server/envelope.d.ts +6 -0
  38. package/dist/src/unstable/lint/catalog/mcp-server/envelope.js +15 -0
  39. package/dist/src/unstable/lint/catalog/mcp-server.d.ts +4 -0
  40. package/dist/src/unstable/lint/catalog/mcp-server.js +6 -0
  41. package/dist/src/unstable/lint/catalog/pack/manifest-keys-recognized.d.ts +28 -0
  42. package/dist/src/unstable/lint/catalog/pack/manifest-keys-recognized.js +38 -0
  43. package/dist/src/unstable/lint/catalog/pack/manifest-present.d.ts +17 -0
  44. package/dist/src/unstable/lint/catalog/pack/manifest-present.js +24 -0
  45. package/dist/src/unstable/lint/catalog/pack/manifest-schema-valid.d.ts +25 -0
  46. package/dist/src/unstable/lint/catalog/pack/manifest-schema-valid.js +33 -0
  47. package/dist/src/unstable/lint/catalog/pack-accessor/contexts.d.ts +51 -0
  48. package/dist/src/unstable/lint/catalog/pack-accessor/contexts.js +45 -0
  49. package/dist/src/unstable/lint/catalog/pack-accessor/vft.d.ts +60 -0
  50. package/dist/src/unstable/lint/catalog/pack-accessor/vft.js +85 -0
  51. package/dist/src/unstable/lint/catalog/pack.d.ts +37 -0
  52. package/dist/src/unstable/lint/catalog/pack.js +47 -0
  53. package/dist/src/unstable/lint/catalog/rule/envelope.d.ts +6 -0
  54. package/dist/src/unstable/lint/catalog/rule/envelope.js +15 -0
  55. package/dist/src/unstable/lint/catalog/rule.d.ts +4 -0
  56. package/dist/src/unstable/lint/catalog/rule.js +6 -0
  57. package/dist/src/unstable/lint/catalog/shared/envelope-rules.d.ts +93 -0
  58. package/dist/src/unstable/lint/catalog/shared/envelope-rules.js +89 -0
  59. package/dist/src/unstable/lint/catalog/shared/manifest-json.d.ts +18 -0
  60. package/dist/src/unstable/lint/catalog/shared/manifest-json.js +28 -0
  61. package/dist/src/unstable/lint/catalog/shared/manifest-present.d.ts +25 -0
  62. package/dist/src/unstable/lint/catalog/shared/manifest-present.js +37 -0
  63. package/dist/src/unstable/lint/catalog/shared/recommended-packs-rules.d.ts +70 -0
  64. package/dist/src/unstable/lint/catalog/shared/recommended-packs-rules.js +139 -0
  65. package/dist/src/unstable/lint/catalog/shared/schema-rule.d.ts +58 -0
  66. package/dist/src/unstable/lint/catalog/shared/schema-rule.js +103 -0
  67. package/dist/src/unstable/lint/catalog/skill/frontmatter-parseable.d.ts +31 -0
  68. package/dist/src/unstable/lint/catalog/skill/frontmatter-parseable.js +148 -0
  69. package/dist/src/unstable/lint/catalog/skill/frontmatter-standard-valid.d.ts +13 -0
  70. package/dist/src/unstable/lint/catalog/skill/frontmatter-standard-valid.js +61 -0
  71. package/dist/src/unstable/lint/catalog/skill/manifest-keys-recognized.d.ts +26 -0
  72. package/dist/src/unstable/lint/catalog/skill/manifest-keys-recognized.js +41 -0
  73. package/dist/src/unstable/lint/catalog/skill/manifest-present.d.ts +23 -0
  74. package/dist/src/unstable/lint/catalog/skill/manifest-present.js +32 -0
  75. package/dist/src/unstable/lint/catalog/skill/manifest-schema-valid.d.ts +21 -0
  76. package/dist/src/unstable/lint/catalog/skill/manifest-schema-valid.js +36 -0
  77. package/dist/src/unstable/lint/catalog/skill/recommended-packs-valid.d.ts +8 -0
  78. package/dist/src/unstable/lint/catalog/skill/recommended-packs-valid.js +12 -0
  79. package/dist/src/unstable/lint/catalog/skill/skill-md-present.d.ts +17 -0
  80. package/dist/src/unstable/lint/catalog/skill/skill-md-present.js +37 -0
  81. package/dist/src/unstable/lint/catalog/skill/standalone-declaration-valid.d.ts +8 -0
  82. package/dist/src/unstable/lint/catalog/skill/standalone-declaration-valid.js +12 -0
  83. package/dist/src/unstable/lint/catalog/skill-accessor/contexts.d.ts +61 -0
  84. package/dist/src/unstable/lint/catalog/skill-accessor/contexts.js +55 -0
  85. package/dist/src/unstable/lint/catalog/skill-accessor/vft.d.ts +77 -0
  86. package/dist/src/unstable/lint/catalog/skill-accessor/vft.js +135 -0
  87. package/dist/src/unstable/lint/catalog/skill.d.ts +44 -0
  88. package/dist/src/unstable/lint/catalog/skill.js +64 -0
  89. package/dist/src/unstable/lint/catalog/subagent/envelope.d.ts +6 -0
  90. package/dist/src/unstable/lint/catalog/subagent/envelope.js +15 -0
  91. package/dist/src/unstable/lint/catalog/subagent.d.ts +4 -0
  92. package/dist/src/unstable/lint/catalog/subagent.js +6 -0
  93. package/dist/src/unstable/lint/compose-path.d.ts +28 -0
  94. package/dist/src/unstable/lint/compose-path.js +64 -0
  95. package/dist/src/unstable/lint/config.d.ts +103 -0
  96. package/dist/src/unstable/lint/config.js +140 -0
  97. package/dist/src/unstable/lint/context.d.ts +246 -0
  98. package/dist/src/unstable/lint/context.js +21 -0
  99. package/dist/src/unstable/lint/describe-document.d.ts +31 -0
  100. package/dist/src/unstable/lint/describe-document.js +50 -0
  101. package/dist/src/unstable/lint/evaluate.d.ts +47 -0
  102. package/dist/src/unstable/lint/evaluate.js +82 -0
  103. package/dist/src/unstable/lint/issues-to-findings.d.ts +35 -0
  104. package/dist/src/unstable/lint/issues-to-findings.js +149 -0
  105. package/dist/src/unstable/lint/publish.d.ts +49 -0
  106. package/dist/src/unstable/lint/publish.js +86 -0
  107. package/dist/src/unstable/lint/rule.d.ts +98 -0
  108. package/dist/src/unstable/lint/rule.js +18 -0
  109. package/dist/src/unstable/publish/archive-guardrails.d.ts +39 -0
  110. package/dist/src/unstable/publish/archive-guardrails.js +250 -0
  111. package/dist/src/unstable/publish/filtered-package-validation.d.ts +24 -0
  112. package/dist/src/unstable/publish/filtered-package-validation.js +117 -0
  113. package/dist/src/unstable/publish/index.d.ts +12 -0
  114. package/dist/src/unstable/publish/index.js +12 -0
  115. package/dist/src/unstable/publish/ingest-limits.d.ts +25 -0
  116. package/dist/src/unstable/publish/ingest-limits.js +41 -0
  117. package/dist/src/unstable/publish/input-normalization.d.ts +40 -0
  118. package/dist/src/unstable/publish/input-normalization.js +125 -0
  119. package/dist/src/unstable/publish/manifest-policy.d.ts +611 -0
  120. package/dist/src/unstable/publish/manifest-policy.js +196 -0
  121. package/dist/src/unstable/publish/test-zip-helpers.d.ts +13 -0
  122. package/dist/src/unstable/publish/test-zip-helpers.js +117 -0
  123. package/dist/src/unstable/publish/visibility.d.ts +161 -0
  124. package/dist/src/unstable/publish/visibility.js +124 -0
  125. package/dist/src/unstable/registry/discover-schema.d.ts +68 -0
  126. package/dist/src/unstable/registry/discover-schema.js +35 -0
  127. package/dist/src/unstable/registry/index.d.ts +9 -0
  128. package/dist/src/unstable/registry/index.js +9 -0
  129. package/dist/src/unstable/registry/publication-set.d.ts +303 -0
  130. package/dist/src/unstable/registry/publication-set.js +507 -0
  131. package/dist/src/unstable/registry/release-age-policy.d.ts +57 -0
  132. package/dist/src/unstable/registry/release-age-policy.js +117 -0
  133. package/dist/src/unstable/registry/schema.d.ts +220 -0
  134. package/dist/src/unstable/registry/schema.js +114 -0
  135. package/dist/src/unstable/suggested-action.d.ts +19 -0
  136. package/dist/src/unstable/suggested-action.js +42 -0
  137. package/package.json +214 -0
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Registry-publish lint surface.
3
+ *
4
+ * This entry point intentionally exports only the primitives the registry
5
+ * publish gate needs. It avoids the full lint barrel because that surface also
6
+ * constructs workspace-settings schemas and workspace catalogs for `axm lint`.
7
+ *
8
+ * @experimental This API is unstable and may change without notice.
9
+ * @packageDocumentation
10
+ */
11
+ import type { HookRuleContext, KnowledgeRuleContext, McpServerRuleContext, PackRuleContext, RuleRuleContext, SkillRuleContext, SubagentRuleContext } from "./context.js";
12
+ import type { LintRule } from "./rule.js";
13
+ export { composePath } from "./compose-path.js";
14
+ export { evaluateContexts, type Evaluated } from "./evaluate.js";
15
+ export type { LintConfig } from "./config.js";
16
+ export type { FileAccessError, HookContent, HookFileAccessor, HookRuleContext, KnowledgeContent, KnowledgeFileAccessor, KnowledgeRuleContext, RuleContent, RuleFileAccessor, RuleRuleContext, McpServerContent, McpServerFileAccessor, McpServerRuleContext, PackContent, PackFileAccessor, PackRuleContext, SkillContent, SkillFileAccessor, SkillRuleContext, SubagentContent, SubagentFileAccessor, SubagentRuleContext, } from "./context.js";
17
+ export type { LintFinding, LintRule } from "./rule.js";
18
+ export { makeVftPackFileAccessor, type PackVFTNode } from "./catalog/pack-accessor/vft.js";
19
+ export { makeVftSkillFileAccessor, makeVftSkillFileAccessorScoped, type VFTNode, } from "./catalog/skill-accessor/vft.js";
20
+ /**
21
+ * Ordered publish-safe `pack/*` rule catalog.
22
+ *
23
+ * This intentionally avoids `./catalog/pack.js`, whose module-load rule-id
24
+ * registration imports the workspace lint config schema.
25
+ */
26
+ export declare const packRules: ReadonlyArray<LintRule<PackRuleContext>>;
27
+ /**
28
+ * Ordered publish-safe `skill/*` rule catalog.
29
+ *
30
+ * This intentionally avoids `./catalog/skill.js`, whose module-load rule-id
31
+ * registration imports the workspace lint config schema.
32
+ */
33
+ export declare const skillRules: ReadonlyArray<LintRule<SkillRuleContext>>;
34
+ export declare const subagentRules: ReadonlyArray<LintRule<SubagentRuleContext>>;
35
+ export declare const mcpServerRules: ReadonlyArray<LintRule<McpServerRuleContext>>;
36
+ /**
37
+ * Ordered publish-safe `hook//*` rule catalog.
38
+ *
39
+ * Identical to `catalog/hook.ts`: `hook/matcher-raw-portability` used to be
40
+ * omitted here, which meant `axm publish` and `axm lint` disagreed about the
41
+ * same `hook.json`. It is a pure-manifest advisory at `warning` severity, and
42
+ * the publish gate fails only on `error` findings, so running it at publish
43
+ * time surfaces the portability advice to the author without gating the
44
+ * publish.
45
+ */
46
+ export declare const hookRules: ReadonlyArray<LintRule<HookRuleContext>>;
47
+ export declare const ruleRules: ReadonlyArray<LintRule<RuleRuleContext>>;
48
+ export declare const knowledgeRules: ReadonlyArray<LintRule<KnowledgeRuleContext>>;
49
+ //# sourceMappingURL=publish.d.ts.map
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Registry-publish lint surface.
3
+ *
4
+ * This entry point intentionally exports only the primitives the registry
5
+ * publish gate needs. It avoids the full lint barrel because that surface also
6
+ * constructs workspace-settings schemas and workspace catalogs for `axm lint`.
7
+ *
8
+ * @experimental This API is unstable and may change without notice.
9
+ * @packageDocumentation
10
+ */
11
+ import { manifestKeysRecognizedRule as packManifestKeysRecognizedRule } from "./catalog/pack/manifest-keys-recognized.js";
12
+ import { manifestPresentRule as packManifestPresentRule } from "./catalog/pack/manifest-present.js";
13
+ import { manifestSchemaValidRule as packManifestSchemaValidRule } from "./catalog/pack/manifest-schema-valid.js";
14
+ import { subagentEnvelopeRules } from "./catalog/subagent/envelope.js";
15
+ import { mcpServerEnvelopeRules } from "./catalog/mcp-server/envelope.js";
16
+ import { hookEnvelopeRules } from "./catalog/hook/envelope.js";
17
+ import { ruleEnvelopeRules } from "./catalog/rule/envelope.js";
18
+ import { knowledgeEnvelopeRules } from "./catalog/knowledge/envelope.js";
19
+ import { orderedEnvelopeRules } from "./catalog/shared/envelope-rules.js";
20
+ import { entrypointExistsRule as hookEntrypointExistsRule } from "./catalog/hook/entrypoint-exists.js";
21
+ import { matcherRawPortabilityRule as hookMatcherRawPortabilityRule } from "./catalog/hook/matcher-raw-portability.js";
22
+ import { decisionPortabilityRule as hookDecisionPortabilityRule } from "./catalog/hook/decision-portability.js";
23
+ import { frontmatterParseableRule as skillFrontmatterParseableRule } from "./catalog/skill/frontmatter-parseable.js";
24
+ import { frontmatterStandardValidRule as skillFrontmatterStandardValidRule } from "./catalog/skill/frontmatter-standard-valid.js";
25
+ import { manifestKeysRecognizedRule as skillManifestKeysRecognizedRule } from "./catalog/skill/manifest-keys-recognized.js";
26
+ import { manifestPresentRule as skillManifestPresentRule } from "./catalog/skill/manifest-present.js";
27
+ import { manifestSchemaValidRule as skillManifestSchemaValidRule } from "./catalog/skill/manifest-schema-valid.js";
28
+ import { skillMdPresentRule } from "./catalog/skill/skill-md-present.js";
29
+ import { recommendedPacksValidRule as skillRecommendedPacksValidRule } from "./catalog/skill/recommended-packs-valid.js";
30
+ import { standaloneDeclarationValidRule as skillStandaloneDeclarationValidRule } from "./catalog/skill/standalone-declaration-valid.js";
31
+ export { composePath } from "./compose-path.js";
32
+ export { evaluateContexts } from "./evaluate.js";
33
+ export { makeVftPackFileAccessor } from "./catalog/pack-accessor/vft.js";
34
+ export { makeVftSkillFileAccessor, makeVftSkillFileAccessorScoped, } from "./catalog/skill-accessor/vft.js";
35
+ /**
36
+ * Ordered publish-safe `pack/*` rule catalog.
37
+ *
38
+ * This intentionally avoids `./catalog/pack.js`, whose module-load rule-id
39
+ * registration imports the workspace lint config schema.
40
+ */
41
+ export const packRules = [
42
+ packManifestPresentRule,
43
+ packManifestSchemaValidRule,
44
+ packManifestKeysRecognizedRule,
45
+ ];
46
+ /**
47
+ * Ordered publish-safe `skill/*` rule catalog.
48
+ *
49
+ * This intentionally avoids `./catalog/skill.js`, whose module-load rule-id
50
+ * registration imports the workspace lint config schema.
51
+ */
52
+ export const skillRules = [
53
+ skillMdPresentRule,
54
+ skillManifestPresentRule,
55
+ skillFrontmatterParseableRule,
56
+ skillFrontmatterStandardValidRule,
57
+ skillManifestSchemaValidRule,
58
+ skillManifestKeysRecognizedRule,
59
+ skillStandaloneDeclarationValidRule,
60
+ skillRecommendedPacksValidRule,
61
+ ];
62
+ export const subagentRules = orderedEnvelopeRules(subagentEnvelopeRules);
63
+ export const mcpServerRules = orderedEnvelopeRules(mcpServerEnvelopeRules);
64
+ /**
65
+ * Ordered publish-safe `hook//*` rule catalog.
66
+ *
67
+ * Identical to `catalog/hook.ts`: `hook/matcher-raw-portability` used to be
68
+ * omitted here, which meant `axm publish` and `axm lint` disagreed about the
69
+ * same `hook.json`. It is a pure-manifest advisory at `warning` severity, and
70
+ * the publish gate fails only on `error` findings, so running it at publish
71
+ * time surfaces the portability advice to the author without gating the
72
+ * publish.
73
+ */
74
+ export const hookRules = [
75
+ hookEnvelopeRules.manifestPresent,
76
+ hookEnvelopeRules.manifestSchemaValid,
77
+ hookEnvelopeRules.manifestKeysRecognized,
78
+ hookDecisionPortabilityRule,
79
+ hookMatcherRawPortabilityRule,
80
+ hookEntrypointExistsRule,
81
+ hookEnvelopeRules.standaloneDeclarationValid,
82
+ hookEnvelopeRules.recommendedPacksValid,
83
+ ];
84
+ export const ruleRules = orderedEnvelopeRules(ruleEnvelopeRules);
85
+ export const knowledgeRules = orderedEnvelopeRules(knowledgeEnvelopeRules);
86
+ //# sourceMappingURL=publish.js.map
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Lint rule and finding primitives.
3
+ *
4
+ * Library-style discriminated unions for the lint engine. Rules are plain
5
+ * values generic over a caller-built `RuleContext` — no Layer wiring and no
6
+ * ambient service bag. Findings are produced by `rule.check`; rules do not
7
+ * carry mutation or workflow guidance.
8
+ *
9
+ * Rule ids follow `<namespace>/<subject>-<predicate>` with lowercase letters,
10
+ * digits, and hyphens; ids leak into settings files, CI logs, and agent
11
+ * transcripts, so they are public API stable under a deprecation-alias policy
12
+ * per the `lint-engine` design doc.
13
+ *
14
+ * @experimental This API is unstable and may change without notice.
15
+ * @packageDocumentation
16
+ */
17
+ import type * as Effect from "effect/Effect";
18
+ /**
19
+ * Platform-canonical finding severity.
20
+ *
21
+ * WorkspaceMutations `lint.rules` overrides can raise or lower the severity at
22
+ * evaluation time; the catalog pins the platform default.
23
+ *
24
+ * @experimental This API is unstable and may change without notice.
25
+ */
26
+ export type Severity = "error" | "warning" | "info";
27
+ /**
28
+ * Accessor-relative location of a finding.
29
+ *
30
+ * `file` is posix and relative to the rule context's accessor root (skill or
31
+ * pack manifest directory for per-extension rules, workspace root for workspace
32
+ * rules). Rules MUST NOT embed absolute paths, `displayRoot`-qualified paths,
33
+ * or source coordinates in `message`; the display path is composed from
34
+ * `context.displayRoot` and `location.file` at format time via `composePath`.
35
+ *
36
+ * `file: ""` targets the context root itself (e.g., a missing `SKILL.md` on a
37
+ * skill context).
38
+ *
39
+ * @experimental This API is unstable and may change without notice.
40
+ */
41
+ export interface FindingLocation {
42
+ readonly file: string;
43
+ readonly line?: number;
44
+ readonly column?: number;
45
+ readonly byteOffset?: number;
46
+ readonly byteLength?: number;
47
+ }
48
+ /**
49
+ * Fields common to all lint findings.
50
+ *
51
+ * @experimental This API is unstable and may change without notice.
52
+ */
53
+ export interface FindingBase {
54
+ readonly ruleId: string;
55
+ readonly severity: Severity;
56
+ readonly message: string;
57
+ readonly location?: FindingLocation;
58
+ }
59
+ /**
60
+ * Intrinsic fact produced by a lint rule.
61
+ *
62
+ * @experimental This API is unstable and may change without notice.
63
+ */
64
+ export interface AdvisoryFinding extends FindingBase {
65
+ readonly kind: "advisory";
66
+ }
67
+ /**
68
+ * Discriminated union of lint findings on `kind`.
69
+ *
70
+ * @experimental This API is unstable and may change without notice.
71
+ */
72
+ export type LintFinding = AdvisoryFinding;
73
+ /**
74
+ * Fields common to all lint rules.
75
+ *
76
+ * @experimental This API is unstable and may change without notice.
77
+ */
78
+ export interface RuleBase {
79
+ readonly id: string;
80
+ readonly description: string;
81
+ readonly severity: Severity;
82
+ }
83
+ /**
84
+ * Rule that only surfaces findings; never autofixes.
85
+ *
86
+ * @experimental This API is unstable and may change without notice.
87
+ */
88
+ export interface AdvisoryRule<C> extends RuleBase {
89
+ readonly kind: "advisory";
90
+ readonly check: (context: C) => Effect.Effect<ReadonlyArray<AdvisoryFinding>>;
91
+ }
92
+ /**
93
+ * Discriminated union of lint rules over a caller-built rule-context type `C`.
94
+ *
95
+ * @experimental This API is unstable and may change without notice.
96
+ */
97
+ export type LintRule<C> = AdvisoryRule<C>;
98
+ //# sourceMappingURL=rule.d.ts.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Lint rule and finding primitives.
3
+ *
4
+ * Library-style discriminated unions for the lint engine. Rules are plain
5
+ * values generic over a caller-built `RuleContext` — no Layer wiring and no
6
+ * ambient service bag. Findings are produced by `rule.check`; rules do not
7
+ * carry mutation or workflow guidance.
8
+ *
9
+ * Rule ids follow `<namespace>/<subject>-<predicate>` with lowercase letters,
10
+ * digits, and hyphens; ids leak into settings files, CI logs, and agent
11
+ * transcripts, so they are public API stable under a deprecation-alias policy
12
+ * per the `lint-engine` design doc.
13
+ *
14
+ * @experimental This API is unstable and may change without notice.
15
+ * @packageDocumentation
16
+ */
17
+ export {};
18
+ //# sourceMappingURL=rule.js.map
@@ -0,0 +1,39 @@
1
+ import * as Effect from "effect/Effect";
2
+ declare const ArchiveGuardrailError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
3
+ readonly _tag: "ArchiveGuardrailError";
4
+ } & Readonly<A>;
5
+ export declare class ArchiveGuardrailError extends ArchiveGuardrailError_base<{
6
+ readonly code: "path_traversal" | "absolute_path" | "duplicate_entry" | "symlink_entry" | "unsupported_compression" | "malformed_archive" | "decompression_limit_exceeded" | "compression_ratio_exceeded" | "entry_count_exceeded" | "forbidden_entry";
7
+ readonly message: string;
8
+ readonly entry?: string;
9
+ }> {
10
+ }
11
+ export declare const ZIP_LOCAL_SIGNATURE = 67324752;
12
+ export interface ZipEntry {
13
+ readonly fileName: string;
14
+ readonly compressedSize: number;
15
+ readonly uncompressedSize: number;
16
+ readonly compressionMethod: number;
17
+ readonly externalAttributes: number;
18
+ readonly localHeaderOffset: number;
19
+ }
20
+ export interface ArchiveGuardrailLimits {
21
+ readonly maxEntries?: number;
22
+ readonly maxDecompressedBytes?: number;
23
+ readonly maxCompressionRatio?: number;
24
+ }
25
+ export declare const parseZipCentralDirectory: (buf: Uint8Array) => Effect.Effect<readonly ZipEntry[], ArchiveGuardrailError>;
26
+ /**
27
+ * Reject archives carrying build or secret leftovers: any `node_modules` or
28
+ * `.git` path segment, and `.env` / `.env.*` files. Kept out of
29
+ * {@link validateArchive} on purpose — that function is the registry ingest
30
+ * contract, and archives accepted by earlier clients must keep ingesting.
31
+ *
32
+ * `.env*` matches the basename exactly (`.env`) or by dotted prefix
33
+ * (`.env.local`, `.env.production`, and also `.env.example`), so sibling names
34
+ * like `.envrc` and `environment.md` are unaffected.
35
+ */
36
+ export declare const checkForbiddenSourceEntries: (entries: readonly ZipEntry[]) => Effect.Effect<void, ArchiveGuardrailError>;
37
+ export declare const validateArchive: (archiveBytes: Uint8Array, limits?: ArchiveGuardrailLimits) => Effect.Effect<readonly ZipEntry[], ArchiveGuardrailError>;
38
+ export {};
39
+ //# sourceMappingURL=archive-guardrails.d.ts.map
@@ -0,0 +1,250 @@
1
+ import * as Data from "effect/Data";
2
+ import * as Effect from "effect/Effect";
3
+ export class ArchiveGuardrailError extends Data.TaggedError("ArchiveGuardrailError") {
4
+ }
5
+ const ZIP_EOCD_SIGNATURE = 0x06054b50;
6
+ const ZIP_CDIR_SIGNATURE = 0x02014b50;
7
+ export const ZIP_LOCAL_SIGNATURE = 0x04034b50;
8
+ const COMPRESSION_STORE = 0;
9
+ const COMPRESSION_DEFLATE = 8;
10
+ const SUPPORTED_COMPRESSION = new Set([COMPRESSION_STORE, COMPRESSION_DEFLATE]);
11
+ const S_IFLNK = 0xa000;
12
+ const S_IFMT = 0xf000;
13
+ const textDecoder = new TextDecoder();
14
+ const DEFAULT_LIMITS = {
15
+ maxEntries: 10_000,
16
+ maxDecompressedBytes: 256 * 1024 * 1024,
17
+ maxCompressionRatio: 100,
18
+ };
19
+ const findEocdOffset = (buf) => Effect.gen(function* () {
20
+ const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
21
+ const minOffset = Math.max(0, buf.length - 22 - 65535);
22
+ for (let i = buf.length - 22; i >= minOffset; i--) {
23
+ if (view.getUint32(i, true) === ZIP_EOCD_SIGNATURE) {
24
+ return i;
25
+ }
26
+ }
27
+ return yield* new ArchiveGuardrailError({
28
+ code: "malformed_archive",
29
+ message: "ZIP end-of-central-directory record not found.",
30
+ });
31
+ });
32
+ export const parseZipCentralDirectory = (buf) => Effect.gen(function* () {
33
+ if (buf.length < 22) {
34
+ return yield* new ArchiveGuardrailError({
35
+ code: "malformed_archive",
36
+ message: "Archive too small to be a valid ZIP file.",
37
+ });
38
+ }
39
+ const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
40
+ if (view.getUint32(0, true) !== ZIP_LOCAL_SIGNATURE) {
41
+ return yield* new ArchiveGuardrailError({
42
+ code: "malformed_archive",
43
+ message: "Archive does not start with a valid ZIP local file header signature.",
44
+ });
45
+ }
46
+ const eocdOffset = yield* findEocdOffset(buf);
47
+ const totalEntries = view.getUint16(eocdOffset + 10, true);
48
+ const cdirSize = view.getUint32(eocdOffset + 12, true);
49
+ const cdirOffset = view.getUint32(eocdOffset + 16, true);
50
+ if (cdirOffset + cdirSize > buf.length) {
51
+ return yield* new ArchiveGuardrailError({
52
+ code: "malformed_archive",
53
+ message: "Central directory offset and size exceed archive bounds.",
54
+ });
55
+ }
56
+ const entries = [];
57
+ let offset = cdirOffset;
58
+ for (let i = 0; i < totalEntries; i++) {
59
+ if (offset + 46 > buf.length) {
60
+ return yield* new ArchiveGuardrailError({
61
+ code: "malformed_archive",
62
+ message: `Central directory entry ${i} exceeds archive bounds.`,
63
+ });
64
+ }
65
+ const signature = view.getUint32(offset, true);
66
+ if (signature !== ZIP_CDIR_SIGNATURE) {
67
+ return yield* new ArchiveGuardrailError({
68
+ code: "malformed_archive",
69
+ message: `Invalid central directory entry signature at offset ${offset}.`,
70
+ });
71
+ }
72
+ const compressionMethod = view.getUint16(offset + 10, true);
73
+ const compressedSize = view.getUint32(offset + 20, true);
74
+ const uncompressedSize = view.getUint32(offset + 24, true);
75
+ const fileNameLength = view.getUint16(offset + 28, true);
76
+ const extraFieldLength = view.getUint16(offset + 30, true);
77
+ const fileCommentLength = view.getUint16(offset + 32, true);
78
+ const externalAttributes = view.getUint32(offset + 38, true);
79
+ const localHeaderOffset = view.getUint32(offset + 42, true);
80
+ const fileNameStart = offset + 46;
81
+ const fileNameEnd = fileNameStart + fileNameLength;
82
+ if (fileNameEnd > buf.length) {
83
+ return yield* new ArchiveGuardrailError({
84
+ code: "malformed_archive",
85
+ message: `File name for entry ${i} exceeds archive bounds.`,
86
+ });
87
+ }
88
+ const fileName = textDecoder.decode(buf.slice(fileNameStart, fileNameEnd));
89
+ entries.push({
90
+ fileName,
91
+ compressedSize,
92
+ uncompressedSize,
93
+ compressionMethod,
94
+ externalAttributes,
95
+ localHeaderOffset,
96
+ });
97
+ offset = fileNameEnd + extraFieldLength + fileCommentLength;
98
+ }
99
+ return entries;
100
+ });
101
+ const checkPathTraversal = (entries) => {
102
+ for (const entry of entries) {
103
+ const normalized = entry.fileName.replace(/\\/g, "/");
104
+ if (normalized.includes("../") || normalized.includes("/..") || normalized === "..") {
105
+ return Effect.fail(new ArchiveGuardrailError({
106
+ code: "path_traversal",
107
+ message: `Archive entry contains path traversal: "${entry.fileName}".`,
108
+ entry: entry.fileName,
109
+ }));
110
+ }
111
+ }
112
+ return Effect.void;
113
+ };
114
+ const checkAbsolutePaths = (entries) => {
115
+ for (const entry of entries) {
116
+ const normalized = entry.fileName.replace(/\\/g, "/");
117
+ if (normalized.startsWith("/") || /^[A-Za-z]:\//.test(normalized)) {
118
+ return Effect.fail(new ArchiveGuardrailError({
119
+ code: "absolute_path",
120
+ message: `Archive entry contains an absolute path: "${entry.fileName}".`,
121
+ entry: entry.fileName,
122
+ }));
123
+ }
124
+ }
125
+ return Effect.void;
126
+ };
127
+ const checkDuplicateEntries = (entries) => {
128
+ const seen = new Set();
129
+ for (const entry of entries) {
130
+ const normalized = entry.fileName.toLowerCase();
131
+ if (seen.has(normalized)) {
132
+ return Effect.fail(new ArchiveGuardrailError({
133
+ code: "duplicate_entry",
134
+ message: `Archive contains duplicate entry: "${entry.fileName}".`,
135
+ entry: entry.fileName,
136
+ }));
137
+ }
138
+ seen.add(normalized);
139
+ }
140
+ return Effect.void;
141
+ };
142
+ const checkSymlinks = (entries) => {
143
+ for (const entry of entries) {
144
+ const unixMode = entry.externalAttributes >>> 16;
145
+ if ((unixMode & S_IFMT) === S_IFLNK) {
146
+ return Effect.fail(new ArchiveGuardrailError({
147
+ code: "symlink_entry",
148
+ message: `Archive contains symlink entry: "${entry.fileName}".`,
149
+ entry: entry.fileName,
150
+ }));
151
+ }
152
+ }
153
+ return Effect.void;
154
+ };
155
+ const checkCompressionMethods = (entries) => {
156
+ for (const entry of entries) {
157
+ if (!SUPPORTED_COMPRESSION.has(entry.compressionMethod)) {
158
+ return Effect.fail(new ArchiveGuardrailError({
159
+ code: "unsupported_compression",
160
+ message: `Archive entry uses unsupported compression method ${entry.compressionMethod}: "${entry.fileName}".`,
161
+ entry: entry.fileName,
162
+ }));
163
+ }
164
+ }
165
+ return Effect.void;
166
+ };
167
+ const checkEntryCount = (entries, limits) => entries.length > limits.maxEntries
168
+ ? Effect.fail(new ArchiveGuardrailError({
169
+ code: "entry_count_exceeded",
170
+ message: `Archive contains ${entries.length} entries, exceeding the maximum allowed ${limits.maxEntries}.`,
171
+ }))
172
+ : Effect.void;
173
+ const checkDecompressedSize = (entries, limits) => {
174
+ let totalUncompressed = 0;
175
+ for (const entry of entries) {
176
+ totalUncompressed += entry.uncompressedSize;
177
+ if (totalUncompressed > limits.maxDecompressedBytes) {
178
+ return Effect.fail(new ArchiveGuardrailError({
179
+ code: "decompression_limit_exceeded",
180
+ message: `Archive decompressed size exceeds maximum allowed ${limits.maxDecompressedBytes} bytes.`,
181
+ entry: entry.fileName,
182
+ }));
183
+ }
184
+ }
185
+ return Effect.void;
186
+ };
187
+ const checkCompressionRatio = (entries, limits) => {
188
+ for (const entry of entries) {
189
+ if (entry.compressedSize === 0) {
190
+ if (entry.uncompressedSize > 0) {
191
+ return Effect.fail(new ArchiveGuardrailError({
192
+ code: "compression_ratio_exceeded",
193
+ message: `Archive entry "${entry.fileName}" exceeds maximum compression ratio.`,
194
+ entry: entry.fileName,
195
+ }));
196
+ }
197
+ continue;
198
+ }
199
+ const ratio = entry.uncompressedSize / entry.compressedSize;
200
+ if (ratio > limits.maxCompressionRatio) {
201
+ return Effect.fail(new ArchiveGuardrailError({
202
+ code: "compression_ratio_exceeded",
203
+ message: `Archive entry "${entry.fileName}" exceeds maximum compression ratio ${limits.maxCompressionRatio}.`,
204
+ entry: entry.fileName,
205
+ }));
206
+ }
207
+ }
208
+ return Effect.void;
209
+ };
210
+ const FORBIDDEN_SEGMENTS = new Set(["node_modules", ".git"]);
211
+ /**
212
+ * Reject archives carrying build or secret leftovers: any `node_modules` or
213
+ * `.git` path segment, and `.env` / `.env.*` files. Kept out of
214
+ * {@link validateArchive} on purpose — that function is the registry ingest
215
+ * contract, and archives accepted by earlier clients must keep ingesting.
216
+ *
217
+ * `.env*` matches the basename exactly (`.env`) or by dotted prefix
218
+ * (`.env.local`, `.env.production`, and also `.env.example`), so sibling names
219
+ * like `.envrc` and `environment.md` are unaffected.
220
+ */
221
+ export const checkForbiddenSourceEntries = (entries) => {
222
+ for (const entry of entries) {
223
+ const segments = entry.fileName.replace(/\\/g, "/").split("/");
224
+ const basename = segments[segments.length - 1] ?? "";
225
+ if (segments.some((segment) => FORBIDDEN_SEGMENTS.has(segment)) ||
226
+ basename === ".env" ||
227
+ basename.startsWith(".env.")) {
228
+ return Effect.fail(new ArchiveGuardrailError({
229
+ code: "forbidden_entry",
230
+ message: `Archive contains a forbidden entry: "${entry.fileName}".`,
231
+ entry: entry.fileName,
232
+ }));
233
+ }
234
+ }
235
+ return Effect.void;
236
+ };
237
+ export const validateArchive = (archiveBytes, limits) => Effect.gen(function* () {
238
+ const appliedLimits = { ...DEFAULT_LIMITS, ...limits };
239
+ const entries = yield* parseZipCentralDirectory(archiveBytes);
240
+ yield* checkPathTraversal(entries);
241
+ yield* checkAbsolutePaths(entries);
242
+ yield* checkDuplicateEntries(entries);
243
+ yield* checkSymlinks(entries);
244
+ yield* checkCompressionMethods(entries);
245
+ yield* checkEntryCount(entries, appliedLimits);
246
+ yield* checkDecompressedSize(entries, appliedLimits);
247
+ yield* checkCompressionRatio(entries, appliedLimits);
248
+ return entries;
249
+ });
250
+ //# sourceMappingURL=archive-guardrails.js.map
@@ -0,0 +1,24 @@
1
+ import * as Effect from "effect/Effect";
2
+ import type { ExtensionType } from "@agentxm/extension-model/unstable/extensions";
3
+ import type { ArchiveGuardrailError, ZipEntry } from "./archive-guardrails.js";
4
+ import type { ResolvedManifest } from "./manifest-policy.js";
5
+ declare const FilteredPackageError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
6
+ readonly _tag: "FilteredPackageError";
7
+ } & Readonly<A>;
8
+ /** A type-specific package invariant failed against the filtered archive. */
9
+ export declare class FilteredPackageError extends FilteredPackageError_base<{
10
+ readonly code: "required_file_missing" | "content_invalid" | "reference_invalid";
11
+ readonly detail: string;
12
+ readonly path?: string;
13
+ }> {
14
+ }
15
+ export interface ValidateFilteredPackageArgs {
16
+ readonly type: ExtensionType;
17
+ readonly entries: ReadonlyArray<ZipEntry>;
18
+ readonly manifest: ResolvedManifest;
19
+ readonly readEntry: (fileName: string) => Effect.Effect<Uint8Array, ArchiveGuardrailError | FilteredPackageError>;
20
+ }
21
+ /** Validate the complete type-specific package after Registry-only filtering. */
22
+ export declare const validateFilteredPackage: (args: ValidateFilteredPackageArgs) => Effect.Effect<void, FilteredPackageError>;
23
+ export {};
24
+ //# sourceMappingURL=filtered-package-validation.d.ts.map