@agentxm/extension-content 0.35.0 → 0.37.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.
@@ -19,5 +19,6 @@ export { ArchiveGuardrailError, type ArchiveGuardrailLimits, ZIP_LOCAL_SIGNATURE
19
19
  export { FilteredPackageError, type ValidateFilteredPackageArgs, validateFilteredPackage, } from "./packaging/filtered-package-validation.js";
20
20
  export { IngestLimitError, IngestUnsupportedContentTypeError, REGISTRY_PUBLISH_MAX_ARCHIVE_BYTES, REGISTRY_PUBLISH_MAX_REQUEST_BYTES, enforceArchiveContentType, enforceArchiveSizeLimit, enforceRequestSizeLimit, } from "./packaging/ingest-limits.js";
21
21
  export { type NormalizePublishInputArgs, type PublishArchiveInput, type PublishInput, defaultReadEntry, normalizePublishInput, } from "./packaging/input-normalization.js";
22
- export { type DeclaredPublishIdentity, type ExtensionManifest, MANIFEST_FILENAME_BY_TYPE, MANIFEST_SCHEMA_BY_TYPE, ManifestError, type ManifestIdentity, ManifestIdentitySchema, type ManifestResolutionInput, type ResolvedManifest, manifestFilenameForType, manifestSchemaForType, resolveManifest, validateDeclaredManifestAlignment, validateManifestHasNoAgentsField, } from "./packaging/manifest-policy.js";
22
+ export { type DeclaredPublishIdentity, type ExtensionManifest, MANIFEST_FILENAME_BY_TYPE, MANIFEST_FILENAMES, MANIFEST_SCHEMA_BY_TYPE, ManifestError, type ManifestIdentity, ManifestIdentitySchema, type ManifestResolutionInput, type ResolvedManifest, manifestFilenameForType, extensionTypeForManifestFilename, manifestSchemaForType, resolveManifest, validateDeclaredManifestAlignment, validateManifestHasNoAgentsField, } from "./packaging/manifest-policy.js";
23
+ export { readExtensionManifest } from "./packaging/manifest-file.js";
23
24
  //# sourceMappingURL=index.d.ts.map
package/dist/src/index.js CHANGED
@@ -19,5 +19,6 @@ export { ArchiveGuardrailError, ZIP_LOCAL_SIGNATURE, checkForbiddenSourceEntries
19
19
  export { FilteredPackageError, validateFilteredPackage, } from "./packaging/filtered-package-validation.js";
20
20
  export { IngestLimitError, IngestUnsupportedContentTypeError, REGISTRY_PUBLISH_MAX_ARCHIVE_BYTES, REGISTRY_PUBLISH_MAX_REQUEST_BYTES, enforceArchiveContentType, enforceArchiveSizeLimit, enforceRequestSizeLimit, } from "./packaging/ingest-limits.js";
21
21
  export { defaultReadEntry, normalizePublishInput, } from "./packaging/input-normalization.js";
22
- export { MANIFEST_FILENAME_BY_TYPE, MANIFEST_SCHEMA_BY_TYPE, ManifestError, ManifestIdentitySchema, manifestFilenameForType, manifestSchemaForType, resolveManifest, validateDeclaredManifestAlignment, validateManifestHasNoAgentsField, } from "./packaging/manifest-policy.js";
22
+ export { MANIFEST_FILENAME_BY_TYPE, MANIFEST_FILENAMES, MANIFEST_SCHEMA_BY_TYPE, ManifestError, ManifestIdentitySchema, manifestFilenameForType, extensionTypeForManifestFilename, manifestSchemaForType, resolveManifest, validateDeclaredManifestAlignment, validateManifestHasNoAgentsField, } from "./packaging/manifest-policy.js";
23
+ export { readExtensionManifest } from "./packaging/manifest-file.js";
23
24
  //# sourceMappingURL=index.js.map
@@ -10,11 +10,11 @@
10
10
  *
11
11
  * Packs are registry-only at v1 — there is no non-native variant. The caller
12
12
  * (`buildPackRuleContexts` or the CLI entry point) picks the root from
13
- * `computePackPathsForLayout` in `@agentxm/workspace/desired-state`.
13
+ * `computePackPathsForLayout` in `@agentxm/workspace-kernel/workspace-state`.
14
14
  *
15
15
  * The `pack.json` sits directly under `canonicalPath`; there is no
16
16
  * `src/` subdirectory like skills have — the pack install operation in
17
- * `@agentxm/workspace/lifecycle` owns the authoritative layout.
17
+ * `@agentxm/extension-kinds/packs` owns the authoritative layout.
18
18
  *
19
19
  * Bounds enforcement:
20
20
  *
@@ -48,7 +48,7 @@ export interface PackAccessorPlatform {
48
48
  *
49
49
  * `absoluteRoot` SHOULD be the absolute path to the pack root directory
50
50
  * (`canonicalPath` from `computePackPathsForLayout` in
51
- * `@agentxm/workspace/desired-state`).
51
+ * `@agentxm/workspace-kernel/workspace-state`).
52
52
  *
53
53
  * @experimental This API is unstable and may change without notice.
54
54
  */
@@ -10,11 +10,11 @@
10
10
  *
11
11
  * Packs are registry-only at v1 — there is no non-native variant. The caller
12
12
  * (`buildPackRuleContexts` or the CLI entry point) picks the root from
13
- * `computePackPathsForLayout` in `@agentxm/workspace/desired-state`.
13
+ * `computePackPathsForLayout` in `@agentxm/workspace-kernel/workspace-state`.
14
14
  *
15
15
  * The `pack.json` sits directly under `canonicalPath`; there is no
16
16
  * `src/` subdirectory like skills have — the pack install operation in
17
- * `@agentxm/workspace/lifecycle` owns the authoritative layout.
17
+ * `@agentxm/extension-kinds/packs` owns the authoritative layout.
18
18
  *
19
19
  * Bounds enforcement:
20
20
  *
@@ -39,7 +39,7 @@ import * as Effect from "effect/Effect";
39
39
  *
40
40
  * `absoluteRoot` SHOULD be the absolute path to the pack root directory
41
41
  * (`canonicalPath` from `computePackPathsForLayout` in
42
- * `@agentxm/workspace/desired-state`).
42
+ * `@agentxm/workspace-kernel/workspace-state`).
43
43
  *
44
44
  * @experimental This API is unstable and may change without notice.
45
45
  */
@@ -45,7 +45,7 @@ export interface SkillAccessorPlatform {
45
45
  * `absoluteRoot` SHOULD be the absolute path to the skill root directory
46
46
  * (either `.../src/` for native, or the selected package directory for a
47
47
  * portable Agent Skill). The caller typically sources it from
48
- * `computeSkillPathsForLayout` in `@agentxm/workspace/desired-state`.
48
+ * `computeSkillPathsForLayout` in `@agentxm/workspace-kernel/workspace-state`.
49
49
  *
50
50
  * @experimental This API is unstable and may change without notice.
51
51
  */
@@ -36,7 +36,7 @@ import * as Effect from "effect/Effect";
36
36
  * `absoluteRoot` SHOULD be the absolute path to the skill root directory
37
37
  * (either `.../src/` for native, or the selected package directory for a
38
38
  * portable Agent Skill). The caller typically sources it from
39
- * `computeSkillPathsForLayout` in `@agentxm/workspace/desired-state`.
39
+ * `computeSkillPathsForLayout` in `@agentxm/workspace-kernel/workspace-state`.
40
40
  *
41
41
  * @experimental This API is unstable and may change without notice.
42
42
  */
@@ -17,9 +17,8 @@
17
17
  * @packageDocumentation
18
18
  */
19
19
  import { extensionTypeSentenceLabels, extensionTypes, } from "@agentxm/extension-model/unstable/extensions/common";
20
- import { LOCKFILE_NAME } from "@agentxm/extension-model/unstable/workspace-files";
20
+ import { LOCKFILE_NAME, SETTINGS_FILENAME, } from "@agentxm/extension-model/unstable/workspace-files";
21
21
  import { MANIFEST_FILENAME_BY_TYPE } from "../packaging/manifest-policy.js";
22
- import { SETTINGS_FILENAME } from "@agentxm/extension-model/unstable/workspace-files";
23
22
  /** Label used when a filename matches no known document. */
24
23
  export const UNKNOWN_DOCUMENT_LABEL = "Document";
25
24
  const capitalizeFirst = (value) => value.length === 0 ? value : `${value.charAt(0).toUpperCase()}${value.slice(1)}`;
@@ -0,0 +1,20 @@
1
+ /** Read and validate a package manifest from its owning directory. */
2
+ import * as Effect from "effect/Effect";
3
+ import * as FileSystem from "effect/FileSystem";
4
+ import * as Path from "effect/Path";
5
+ import type { ExtensionType } from "@agentxm/extension-model/unstable/extensions/common";
6
+ import type { Handle } from "@agentxm/extension-model/unstable/extensions/handle";
7
+ import { ManifestError, type ExtensionManifest, type ManifestIdentity } from "./manifest-policy.js";
8
+ interface ReadManifestOptions {
9
+ readonly defaultOwner?: Handle;
10
+ }
11
+ interface ReadManifestResult {
12
+ readonly path: string;
13
+ readonly fileName: string;
14
+ readonly raw: unknown;
15
+ readonly manifest: ExtensionManifest;
16
+ readonly identity: ManifestIdentity;
17
+ }
18
+ export declare const readExtensionManifest: (directory: string, type: ExtensionType, options?: ReadManifestOptions) => Effect.Effect<ReadManifestResult, ManifestError, FileSystem.FileSystem | Path.Path>;
19
+ export {};
20
+ //# sourceMappingURL=manifest-file.d.ts.map
@@ -0,0 +1,60 @@
1
+ /** Read and validate a package manifest from its owning directory. */
2
+ import * as Effect from "effect/Effect";
3
+ import * as FileSystem from "effect/FileSystem";
4
+ import * as Path from "effect/Path";
5
+ import * as Schema from "effect/Schema";
6
+ import * as SchemaIssue from "effect/SchemaIssue";
7
+ import { ManifestError, ManifestIdentitySchema, manifestFilenameForType, manifestSchemaForType, } from "./manifest-policy.js";
8
+ const withDefaultOwner = (raw, defaultOwner) => defaultOwner !== undefined &&
9
+ typeof raw === "object" &&
10
+ raw !== null &&
11
+ !Array.isArray(raw) &&
12
+ !Object.hasOwn(raw, "owner")
13
+ ? { ...raw, owner: defaultOwner }
14
+ : raw;
15
+ export const readExtensionManifest = (directory, type, options) => Effect.gen(function* () {
16
+ const fs = yield* FileSystem.FileSystem;
17
+ const path = yield* Path.Path;
18
+ const fileName = manifestFilenameForType(type);
19
+ const manifestPath = path.join(directory, fileName);
20
+ const exists = yield* fs.exists(manifestPath).pipe(Effect.mapError((cause) => new ManifestError({
21
+ code: "manifest_unreadable",
22
+ detail: `Manifest file "${manifestPath}" could not be inspected.`,
23
+ cause,
24
+ })));
25
+ if (!exists) {
26
+ return yield* new ManifestError({
27
+ code: "manifest_missing",
28
+ detail: `Expected manifest file "${fileName}" not found in ${directory}.`,
29
+ });
30
+ }
31
+ const content = yield* fs.readFileString(manifestPath).pipe(Effect.mapError((cause) => new ManifestError({
32
+ code: "manifest_unreadable",
33
+ detail: `Manifest file "${manifestPath}" could not be read.`,
34
+ cause,
35
+ })));
36
+ const parsed = yield* Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Unknown))(content).pipe(Effect.mapError((cause) => new ManifestError({
37
+ code: "manifest_invalid_json",
38
+ detail: `Manifest file "${fileName}" contains invalid JSON.`,
39
+ cause,
40
+ })));
41
+ const raw = withDefaultOwner(parsed, options?.defaultOwner);
42
+ const manifest = yield* Schema.decodeUnknownEffect(manifestSchemaForType(type))(raw).pipe(Effect.mapError((cause) => new ManifestError({
43
+ code: "manifest_schema_invalid",
44
+ detail: `Manifest file "${fileName}" does not conform to the ${type} manifest schema.`,
45
+ details: SchemaIssue.makeFormatterDefault()(cause.issue),
46
+ })));
47
+ const identity = yield* Schema.decodeUnknownEffect(ManifestIdentitySchema)(manifest).pipe(Effect.mapError((cause) => new ManifestError({
48
+ code: "manifest_schema_invalid",
49
+ detail: `Manifest file "${fileName}" is missing required identity fields.`,
50
+ details: SchemaIssue.makeFormatterDefault()(cause.issue),
51
+ })));
52
+ if (identity.type !== type) {
53
+ return yield* new ManifestError({
54
+ code: "manifest_schema_invalid",
55
+ detail: `Manifest declared type "${identity.type}" disagrees with ${fileName}.`,
56
+ });
57
+ }
58
+ return { path: manifestPath, fileName, raw, manifest, identity };
59
+ });
60
+ //# sourceMappingURL=manifest-file.js.map
@@ -9,9 +9,10 @@ declare const ManifestError_base: new <A extends Record<string, any> = {}>(args:
9
9
  readonly _tag: "ManifestError";
10
10
  } & Readonly<A>;
11
11
  export declare class ManifestError extends ManifestError_base<{
12
- readonly code: "manifest_missing" | "manifest_multiple" | "manifest_invalid_json" | "manifest_schema_invalid" | "companion_package_purl_has_version" | "companion_package_scheme_mismatch" | "companion_package_invalid" | "declared_manifest_mismatch";
12
+ readonly code: "manifest_missing" | "manifest_unreadable" | "manifest_multiple" | "manifest_invalid_json" | "manifest_schema_invalid" | "companion_package_purl_has_version" | "companion_package_scheme_mismatch" | "companion_package_invalid" | "declared_manifest_mismatch";
13
13
  readonly detail: string;
14
14
  readonly details?: unknown;
15
+ readonly cause?: unknown;
15
16
  }> {
16
17
  }
17
18
  export declare const MANIFEST_FILENAME_BY_TYPE: {
@@ -23,6 +24,8 @@ export declare const MANIFEST_FILENAME_BY_TYPE: {
23
24
  readonly hook: "hook.json";
24
25
  readonly knowledge: "knowledge.json";
25
26
  };
27
+ export declare const MANIFEST_FILENAMES: ReadonlySet<string>;
28
+ export declare const extensionTypeForManifestFilename: (fileName: string) => ExtensionType | undefined;
26
29
  export declare const manifestFilenameForType: (type: ExtensionType) => string;
27
30
  export declare const ManifestIdentitySchema: Schema.Struct<{
28
31
  readonly owner: Schema.brand<Schema.String, "Handle">;
@@ -3,7 +3,7 @@ import * as Effect from "effect/Effect";
3
3
  import * as Result from "effect/Result";
4
4
  import * as Schema from "effect/Schema";
5
5
  import * as SchemaIssue from "effect/SchemaIssue";
6
- import { ExtensionNameSchema, ExtensionTypeSchema, } from "@agentxm/extension-model/unstable/extensions/common";
6
+ import { ExtensionNameSchema, ExtensionTypeSchema, extensionTypes, } from "@agentxm/extension-model/unstable/extensions/common";
7
7
  import { HookManifestSchema, HOOK_MANIFEST_FILENAME, } from "@agentxm/extension-model/unstable/hooks/manifest-schema";
8
8
  import { HandleSchema } from "@agentxm/extension-model/unstable/extensions/handle";
9
9
  import { KnowledgeManifestSchema, KNOWLEDGE_MANIFEST_FILENAME, } from "@agentxm/extension-model/unstable/knowledge/manifest-schema";
@@ -24,6 +24,8 @@ export const MANIFEST_FILENAME_BY_TYPE = {
24
24
  hook: HOOK_MANIFEST_FILENAME,
25
25
  knowledge: KNOWLEDGE_MANIFEST_FILENAME,
26
26
  };
27
+ export const MANIFEST_FILENAMES = new Set(Object.values(MANIFEST_FILENAME_BY_TYPE));
28
+ export const extensionTypeForManifestFilename = (fileName) => extensionTypes.find((type) => MANIFEST_FILENAME_BY_TYPE[type] === fileName);
27
29
  export const manifestFilenameForType = (type) => MANIFEST_FILENAME_BY_TYPE[type];
28
30
  export const ManifestIdentitySchema = Schema.Struct({
29
31
  owner: HandleSchema.pipe(Schema.annotateKey({ messageMissingKey: "owner is required" })),
package/package.json CHANGED
@@ -4,9 +4,9 @@
4
4
  "url": "https://github.com/agentxm/axm/issues"
5
5
  },
6
6
  "dependencies": {
7
- "@agentxm/extension-model": "^0.35.0",
7
+ "@agentxm/extension-model": "^0.37.0",
8
8
  "effect": "4.0.0-rc.117",
9
- "yaml": "^2.9.0"
9
+ "yaml": "^2.9.1"
10
10
  },
11
11
  "description": "AXM extension content behavior: skill and subagent content parsing, Knowledge bundle inspection and search, the lint rule catalog, and archive and manifest validation shared by the axm CLI and the AgentXM Registry. Unstable and unsupported — use the axm.sh CLI.",
12
12
  "devDependencies": {
@@ -58,5 +58,5 @@
58
58
  },
59
59
  "sideEffects": false,
60
60
  "type": "module",
61
- "version": "0.35.0"
61
+ "version": "0.37.0"
62
62
  }