@agentxm/extension-materialization 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 (89) hide show
  1. package/LICENSE +110 -0
  2. package/README.md +16 -0
  3. package/dist/src/desired-state/errors.d.ts +22 -0
  4. package/dist/src/desired-state/errors.js +22 -0
  5. package/dist/src/desired-state/retained-materialization.d.ts +58 -0
  6. package/dist/src/desired-state/retained-materialization.js +119 -0
  7. package/dist/src/errors.d.ts +42 -0
  8. package/dist/src/errors.js +14 -0
  9. package/dist/src/extensions/canonical-directory.d.ts +106 -0
  10. package/dist/src/extensions/canonical-directory.js +210 -0
  11. package/dist/src/extensions/canonical-reuse.d.ts +43 -0
  12. package/dist/src/extensions/canonical-reuse.js +38 -0
  13. package/dist/src/extensions/copy-directory.d.ts +50 -0
  14. package/dist/src/extensions/copy-directory.js +78 -0
  15. package/dist/src/extensions/errors.d.ts +97 -0
  16. package/dist/src/extensions/errors.js +42 -0
  17. package/dist/src/extensions/materializable-from-disk.d.ts +37 -0
  18. package/dist/src/extensions/materializable-from-disk.js +89 -0
  19. package/dist/src/extensions/operations.d.ts +252 -0
  20. package/dist/src/extensions/operations.js +631 -0
  21. package/dist/src/hooks/errors.d.ts +33 -0
  22. package/dist/src/hooks/errors.js +18 -0
  23. package/dist/src/hooks/manager.d.ts +13 -0
  24. package/dist/src/hooks/manager.js +778 -0
  25. package/dist/src/index.d.ts +44 -0
  26. package/dist/src/index.js +56 -0
  27. package/dist/src/knowledge/errors.d.ts +75 -0
  28. package/dist/src/knowledge/errors.js +36 -0
  29. package/dist/src/knowledge/manager.d.ts +9 -0
  30. package/dist/src/knowledge/manager.js +709 -0
  31. package/dist/src/live.d.ts +20 -0
  32. package/dist/src/live.js +20 -0
  33. package/dist/src/manager-contract.d.ts +136 -0
  34. package/dist/src/manager-contract.js +19 -0
  35. package/dist/src/manager-registry-live.d.ts +11 -0
  36. package/dist/src/manager-registry-live.js +23 -0
  37. package/dist/src/manager-registry.d.ts +37 -0
  38. package/dist/src/manager-registry.js +22 -0
  39. package/dist/src/managers.d.ts +147 -0
  40. package/dist/src/managers.js +32 -0
  41. package/dist/src/mcps/artifact.d.ts +24 -0
  42. package/dist/src/mcps/artifact.js +74 -0
  43. package/dist/src/mcps/authored-materialization.d.ts +28 -0
  44. package/dist/src/mcps/authored-materialization.js +34 -0
  45. package/dist/src/mcps/errors.d.ts +105 -0
  46. package/dist/src/mcps/errors.js +40 -0
  47. package/dist/src/mcps/install-operation.d.ts +92 -0
  48. package/dist/src/mcps/install-operation.js +557 -0
  49. package/dist/src/mcps/manager.d.ts +15 -0
  50. package/dist/src/mcps/manager.js +253 -0
  51. package/dist/src/mcps/native-entry.d.ts +51 -0
  52. package/dist/src/mcps/native-entry.js +100 -0
  53. package/dist/src/mcps/secret-store-live.d.ts +14 -0
  54. package/dist/src/mcps/secret-store-live.js +58 -0
  55. package/dist/src/mcps/secret-store.d.ts +55 -0
  56. package/dist/src/mcps/secret-store.js +33 -0
  57. package/dist/src/packs/errors.d.ts +50 -0
  58. package/dist/src/packs/errors.js +24 -0
  59. package/dist/src/packs/manager.d.ts +16 -0
  60. package/dist/src/packs/manager.js +189 -0
  61. package/dist/src/projection-participants-live.d.ts +17 -0
  62. package/dist/src/projection-participants-live.js +66 -0
  63. package/dist/src/projection-step-failure.d.ts +19 -0
  64. package/dist/src/projection-step-failure.js +76 -0
  65. package/dist/src/registry-materialization.d.ts +52 -0
  66. package/dist/src/registry-materialization.js +67 -0
  67. package/dist/src/rules/errors.d.ts +31 -0
  68. package/dist/src/rules/errors.js +17 -0
  69. package/dist/src/rules/manager.d.ts +18 -0
  70. package/dist/src/rules/manager.js +492 -0
  71. package/dist/src/skills/errors.d.ts +42 -0
  72. package/dist/src/skills/errors.js +21 -0
  73. package/dist/src/skills/manager.d.ts +17 -0
  74. package/dist/src/skills/manager.js +339 -0
  75. package/dist/src/skills/materialization.d.ts +52 -0
  76. package/dist/src/skills/materialization.js +168 -0
  77. package/dist/src/skills/skill-artifact.d.ts +38 -0
  78. package/dist/src/skills/skill-artifact.js +70 -0
  79. package/dist/src/skills/source-hash.d.ts +2 -0
  80. package/dist/src/skills/source-hash.js +6 -0
  81. package/dist/src/subagents/errors.d.ts +43 -0
  82. package/dist/src/subagents/errors.js +20 -0
  83. package/dist/src/subagents/lock-entry-builder.d.ts +20 -0
  84. package/dist/src/subagents/lock-entry-builder.js +63 -0
  85. package/dist/src/subagents/manager.d.ts +17 -0
  86. package/dist/src/subagents/manager.js +736 -0
  87. package/dist/src/testing.d.ts +87 -0
  88. package/dist/src/testing.js +116 -0
  89. package/package.json +70 -0
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Environment-backed layers of the materialization capability: the seven
3
+ * per-extension-type manager implementations behind their service tags, and
4
+ * their registration as `workspace-projection` participants. Only application
5
+ * composition roots import this module.
6
+ *
7
+ * @experimental All exports from this module are unstable and may change without notice.
8
+ * @packageDocumentation
9
+ */
10
+ export { HookManagerLive } from "./hooks/manager.js";
11
+ export { RuleManagerLive } from "./rules/manager.js";
12
+ export { SkillManagerLive } from "./skills/manager.js";
13
+ export { SubagentManagerLive } from "./subagents/manager.js";
14
+ export { McpServerManagerLive } from "./mcps/manager.js";
15
+ export { McpSecretStoreLive } from "./mcps/secret-store-live.js";
16
+ export { PackManagerLive } from "./packs/manager.js";
17
+ export { KnowledgeManagerLive } from "./knowledge/manager.js";
18
+ export { ProjectionParticipantsLive } from "./projection-participants-live.js";
19
+ export { ExtensionManagersLive } from "./manager-registry-live.js";
20
+ //# sourceMappingURL=live.d.ts.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Environment-backed layers of the materialization capability: the seven
3
+ * per-extension-type manager implementations behind their service tags, and
4
+ * their registration as `workspace-projection` participants. Only application
5
+ * composition roots import this module.
6
+ *
7
+ * @experimental All exports from this module are unstable and may change without notice.
8
+ * @packageDocumentation
9
+ */
10
+ export { HookManagerLive } from "./hooks/manager.js";
11
+ export { RuleManagerLive } from "./rules/manager.js";
12
+ export { SkillManagerLive } from "./skills/manager.js";
13
+ export { SubagentManagerLive } from "./subagents/manager.js";
14
+ export { McpServerManagerLive } from "./mcps/manager.js";
15
+ export { McpSecretStoreLive } from "./mcps/secret-store-live.js";
16
+ export { PackManagerLive } from "./packs/manager.js";
17
+ export { KnowledgeManagerLive } from "./knowledge/manager.js";
18
+ export { ProjectionParticipantsLive } from "./projection-participants-live.js";
19
+ export { ExtensionManagersLive } from "./manager-registry-live.js";
20
+ //# sourceMappingURL=live.js.map
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Per-extension-type materialization manager contract.
3
+ *
4
+ * Implemented by the seven extension-type managers and consumed by the closure
5
+ * recipes in `extensions/operations.ts`. Requirements stay explicit in `R`: a
6
+ * manager never captures the platform into its members, and the command
7
+ * boundary composes them once. Materialization facts travel forward as return
8
+ * values, so a later settings or lockfile write reads what the materialization
9
+ * observed instead of a mutable map the layer kept alive between calls.
10
+ *
11
+ * @experimental This API is unstable and may change without notice.
12
+ * @packageDocumentation
13
+ */
14
+ import type * as Effect from "effect/Effect";
15
+ import type * as FileSystem from "effect/FileSystem";
16
+ import type * as Option from "effect/Option";
17
+ import type * as Path from "effect/Path";
18
+ import type * as HttpClient from "effect/unstable/http/HttpClient";
19
+ import type { ExtensionManagerFailure } from "./errors.js";
20
+ import type { NativeWriteAuthority } from "@agentxm/agent-integration";
21
+ import type { ProjectionPlan } from "@agentxm/workspace-projection";
22
+ import type { ExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/extension-ref";
23
+ import type { ExtensionTarget, ExtensionTargetFor } from "@agentxm/workspace-state";
24
+ /**
25
+ * The services every manager keeps in `R`: the platform it reads and writes
26
+ * through, the registry transport its acquisition steps use, and the authority
27
+ * that admits a native write. Uniform across the seven managers so a recipe
28
+ * composes one requirement set, and identical to what a projection participant
29
+ * declares so a manager registers as one without providing anything at a leaf.
30
+ * The transaction scope belongs to the closure recipe, not to a manager: every
31
+ * manager member runs inside a transition the recipe opened.
32
+ */
33
+ export type ManagerRequirements = FileSystem.FileSystem | Path.Path | HttpClient.HttpClient | NativeWriteAuthority;
34
+ /**
35
+ * Machine-local effects observed during the most recent materialization.
36
+ *
37
+ * This data is intentionally ephemeral. It supports operation output without
38
+ * making agent-specific paths part of the shared lockfile contract.
39
+ */
40
+ export interface MaterializationObservation {
41
+ readonly agents: ReadonlyArray<string>;
42
+ readonly targets: ReadonlyArray<{
43
+ readonly path: string;
44
+ readonly agentIds?: ReadonlyArray<string>;
45
+ }>;
46
+ }
47
+ /** An empty observation, for transitions that projected nothing. */
48
+ export declare const NO_MATERIALIZATION_OBSERVATION: MaterializationObservation;
49
+ /**
50
+ * What one materialization observed. Each manager extends this with the
51
+ * content identity its own settings and lockfile writes need; the closure
52
+ * recipes carry the value from `materializeInstall` to those writes and to the
53
+ * step's artifact without inspecting the extension.
54
+ */
55
+ export interface MaterializationFacts {
56
+ readonly observation: MaterializationObservation;
57
+ }
58
+ /**
59
+ * Per-extension-type materialization manager contract.
60
+ *
61
+ * `TMaterialization` is what this manager's `materializeInstall` observed and
62
+ * its entry writes consume; `R` is the requirement set its members declare.
63
+ */
64
+ export interface ExtensionManager<TRef extends ExtensionRef, TMaterialization extends MaterializationFacts = MaterializationFacts, R = ManagerRequirements> {
65
+ readonly type: TRef["type"];
66
+ readonly isInstalled: (args: {
67
+ readonly target: ExtensionTarget;
68
+ }) => Effect.Effect<boolean, ExtensionManagerFailure, R>;
69
+ /** Acquire canonical content and project it, reporting what it observed. */
70
+ readonly materializeInstall: (args: {
71
+ readonly ref: TRef;
72
+ /** When true, re-materialize unconditionally instead of reusing an existing canonical tree. */
73
+ readonly force?: boolean;
74
+ }) => Effect.Effect<TMaterialization, ExtensionManagerFailure, R>;
75
+ /**
76
+ * Capture cleanup for the currently accepted canonical package before a
77
+ * replacement writes its new lock entry. The returned effect runs only
78
+ * after the replacement resolution has been committed inside the same
79
+ * workspace transaction.
80
+ */
81
+ readonly prepareSourceTransition?: (args: {
82
+ readonly ref: TRef;
83
+ }) => Effect.Effect<Effect.Effect<void, ExtensionManagerFailure, R>, ExtensionManagerFailure, R>;
84
+ /**
85
+ * What this manager's shared aggregate units projected in this invocation.
86
+ * Aggregate units render after desired state commits — later than
87
+ * `materializeInstall` returns — so a closure reads the observation back
88
+ * here instead of receiving it with the materialization facts. Managers
89
+ * whose units are singletons report their targets in the facts instead and
90
+ * do not implement this.
91
+ */
92
+ readonly aggregateProjectionObservation?: Effect.Effect<MaterializationObservation, ExtensionManagerFailure, R>;
93
+ /** Build opaque projection plans after desired state and canonical content commit. */
94
+ readonly projectionPlans?: () => Effect.Effect<ReadonlyArray<ProjectionPlan<void, ExtensionManagerFailure, R>>, ExtensionManagerFailure, R>;
95
+ readonly getConfiguredSource?: (args: {
96
+ readonly target: ExtensionTarget;
97
+ }) => Effect.Effect<Option.Option<string>, ExtensionManagerFailure, R>;
98
+ /**
99
+ * Observe whether desired state declares the target independently of whether
100
+ * that declaration points at a package source.
101
+ */
102
+ readonly isConfigured?: (args: {
103
+ readonly target: ExtensionTarget;
104
+ }) => Effect.Effect<boolean, ExtensionManagerFailure, R>;
105
+ readonly listMaterializable: () => Effect.Effect<ReadonlyArray<TRef>, ExtensionManagerFailure, R>;
106
+ /** Remove projections and canonical content, reporting what it withdrew. */
107
+ readonly materializeUninstall: (args: {
108
+ readonly target: ExtensionTargetFor<TRef>;
109
+ }) => Effect.Effect<TMaterialization, ExtensionManagerFailure, R>;
110
+ /** Remove active projections while retaining canonical managed content. */
111
+ readonly materializeDeactivate: (args: {
112
+ readonly target: ExtensionTargetFor<TRef>;
113
+ }) => Effect.Effect<TMaterialization, ExtensionManagerFailure, R>;
114
+ readonly upsertSettingsEntry: (args: {
115
+ readonly ref: TRef;
116
+ readonly versionRange: Option.Option<string>;
117
+ /** What `materializeInstall` observed in this closure, when it ran. */
118
+ readonly materialization: Option.Option<TMaterialization>;
119
+ }) => Effect.Effect<void, ExtensionManagerFailure, R>;
120
+ readonly removeSettingsEntry: (args: {
121
+ readonly target: ExtensionTargetFor<TRef>;
122
+ /** What the withdrawal in this closure observed, when one ran. */
123
+ readonly materialization: Option.Option<TMaterialization>;
124
+ }) => Effect.Effect<void, ExtensionManagerFailure, R>;
125
+ readonly upsertLockfileEntry: (args: {
126
+ readonly ref: TRef;
127
+ /** What `materializeInstall` observed in this closure, when it ran. */
128
+ readonly materialization: Option.Option<TMaterialization>;
129
+ }) => Effect.Effect<void, ExtensionManagerFailure, R>;
130
+ readonly removeLockfileEntry: (args: {
131
+ readonly target: ExtensionTargetFor<TRef>;
132
+ /** What the withdrawal in this closure observed, when one ran. */
133
+ readonly materialization: Option.Option<TMaterialization>;
134
+ }) => Effect.Effect<void, ExtensionManagerFailure, R>;
135
+ }
136
+ //# sourceMappingURL=manager-contract.d.ts.map
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Per-extension-type materialization manager contract.
3
+ *
4
+ * Implemented by the seven extension-type managers and consumed by the closure
5
+ * recipes in `extensions/operations.ts`. Requirements stay explicit in `R`: a
6
+ * manager never captures the platform into its members, and the command
7
+ * boundary composes them once. Materialization facts travel forward as return
8
+ * values, so a later settings or lockfile write reads what the materialization
9
+ * observed instead of a mutable map the layer kept alive between calls.
10
+ *
11
+ * @experimental This API is unstable and may change without notice.
12
+ * @packageDocumentation
13
+ */
14
+ /** An empty observation, for transitions that projected nothing. */
15
+ export const NO_MATERIALIZATION_OBSERVATION = {
16
+ agents: [],
17
+ targets: [],
18
+ };
19
+ //# sourceMappingURL=manager-contract.js.map
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The manager registry composed from the seven individual manager tags.
3
+ *
4
+ * @experimental This API is unstable and may change without notice.
5
+ */
6
+ import * as Layer from "effect/Layer";
7
+ import { ExtensionManagers } from "./manager-registry.js";
8
+ import { HookManager, KnowledgeManager, McpServerManager, PackManager, RuleManager, SkillManager, SubagentManager } from "./managers.js";
9
+ /** Resolve every per-type manager once and publish them as one lookup. */
10
+ export declare const ExtensionManagersLive: Layer.Layer<ExtensionManagers, never, SkillManager | SubagentManager | RuleManager | HookManager | KnowledgeManager | McpServerManager | PackManager>;
11
+ //# sourceMappingURL=manager-registry-live.d.ts.map
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The manager registry composed from the seven individual manager tags.
3
+ *
4
+ * @experimental This API is unstable and may change without notice.
5
+ */
6
+ import * as Effect from "effect/Effect";
7
+ import * as Layer from "effect/Layer";
8
+ import { ExtensionManagers } from "./manager-registry.js";
9
+ import { HookManager, KnowledgeManager, McpServerManager, PackManager, RuleManager, SkillManager, SubagentManager, } from "./managers.js";
10
+ /** Resolve every per-type manager once and publish them as one lookup. */
11
+ export const ExtensionManagersLive = Layer.effect(ExtensionManagers, Effect.gen(function* () {
12
+ const managers = {
13
+ skill: yield* SkillManager,
14
+ subagent: yield* SubagentManager,
15
+ rule: yield* RuleManager,
16
+ hook: yield* HookManager,
17
+ knowledge: yield* KnowledgeManager,
18
+ "mcp-server": yield* McpServerManager,
19
+ pack: yield* PackManager,
20
+ };
21
+ return managers;
22
+ }));
23
+ //# sourceMappingURL=manager-registry-live.js.map
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Every per-extension-type manager under one lookup.
3
+ *
4
+ * A use case that decides the extension type at runtime — creating, forking,
5
+ * adopting, importing, or re-versioning an authored package — needs the
6
+ * manager for the type it decided, not a manager it named at compile time.
7
+ * Without this, each such use case re-derives the same seven-way switch over
8
+ * `ExtensionType`. The registry keeps every entry at its own precise manager
9
+ * type, so narrowing the type narrows the manager with it.
10
+ *
11
+ * @experimental This API is unstable and may change without notice.
12
+ */
13
+ import * as ServiceMap from "effect/Context";
14
+ import type { McpServerExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/mcp-server";
15
+ import type { PackRef } from "@agentxm/extension-model/unstable/extensions/refs/pack";
16
+ import type { SkillExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/skill";
17
+ import type { ExtensionManager, ManagerRequirements } from "./manager-contract.js";
18
+ import type { HookManagerService, KnowledgeManagerService, McpServerMaterializationFacts, PackMaterializationFacts, RuleManagerService, SkillMaterializationFacts, SubagentManagerService } from "./managers.js";
19
+ /** The manager each extension type is materialized through. */
20
+ export interface ExtensionManagersService {
21
+ readonly skill: ExtensionManager<SkillExtensionRef, SkillMaterializationFacts, ManagerRequirements>;
22
+ readonly subagent: SubagentManagerService;
23
+ readonly rule: RuleManagerService;
24
+ readonly hook: HookManagerService;
25
+ readonly knowledge: KnowledgeManagerService;
26
+ readonly "mcp-server": ExtensionManager<McpServerExtensionRef, McpServerMaterializationFacts, ManagerRequirements>;
27
+ readonly pack: ExtensionManager<PackRef, PackMaterializationFacts, ManagerRequirements>;
28
+ }
29
+ declare const ExtensionManagers_base: ServiceMap.ServiceClass<ExtensionManagers, "@agentxm/extension-materialization/ExtensionManagers", ExtensionManagersService>;
30
+ /**
31
+ * The seven managers as one service. The application composes it once from
32
+ * the individual manager tags; `./live` carries that composition.
33
+ */
34
+ export declare class ExtensionManagers extends ExtensionManagers_base {
35
+ }
36
+ export {};
37
+ //# sourceMappingURL=manager-registry.d.ts.map
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Every per-extension-type manager under one lookup.
3
+ *
4
+ * A use case that decides the extension type at runtime — creating, forking,
5
+ * adopting, importing, or re-versioning an authored package — needs the
6
+ * manager for the type it decided, not a manager it named at compile time.
7
+ * Without this, each such use case re-derives the same seven-way switch over
8
+ * `ExtensionType`. The registry keeps every entry at its own precise manager
9
+ * type, so narrowing the type narrows the manager with it.
10
+ *
11
+ * @experimental This API is unstable and may change without notice.
12
+ */
13
+ import * as ServiceMap from "effect/Context";
14
+ const _managersCoverEveryType = true;
15
+ void _managersCoverEveryType;
16
+ /**
17
+ * The seven managers as one service. The application composes it once from
18
+ * the individual manager tags; `./live` carries that composition.
19
+ */
20
+ export class ExtensionManagers extends ServiceMap.Service()("@agentxm/extension-materialization/ExtensionManagers") {
21
+ }
22
+ //# sourceMappingURL=manager-registry.js.map
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Per-extension-type manager service tags and the materialization facts each
3
+ * manager reports.
4
+ *
5
+ * Plan-building features require a manager through its tag without depending
6
+ * on the module that implements it. Every tag pins the facts type its manager
7
+ * carries from a materialization to the settings and lockfile writes that
8
+ * follow it in the same closure, so nothing travels through state the layer
9
+ * keeps alive between calls.
10
+ *
11
+ * @experimental This API is unstable and may change without notice.
12
+ * @packageDocumentation
13
+ */
14
+ import type * as Effect from "effect/Effect";
15
+ import type * as Option from "effect/Option";
16
+ import * as ServiceMap from "effect/Context";
17
+ import type { ExtensionManager, ManagerRequirements, MaterializationFacts, MaterializationObservation } from "./manager-contract.js";
18
+ import type { ExtensionManagerFailure } from "./errors.js";
19
+ import type { ProjectionPlan } from "@agentxm/workspace-projection";
20
+ import type { ConfiguredAgentOutcome } from "@agentxm/workspace-state";
21
+ import type { WorkspaceTransactionScope } from "@agentxm/workspace-transactions";
22
+ import type { SourceHash } from "@agentxm/extension-model/unstable/sources/source-hash";
23
+ import type { TreeIntegrity } from "@agentxm/workspace-state";
24
+ import type { HookExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/hook";
25
+ import type { KnowledgeExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/knowledge";
26
+ import type { McpServerExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/mcp-server";
27
+ import type { PackRef } from "@agentxm/extension-model/unstable/extensions/refs/pack";
28
+ import type { RuleExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/rule";
29
+ import type { SkillExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/skill";
30
+ import type { SubagentExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/subagent";
31
+ import type { VersionRange } from "@agentxm/extension-model/unstable/version-constraints";
32
+ /** The content identity a canonical acquisition established, when it ran. */
33
+ export interface AcquiredContentFacts extends MaterializationFacts {
34
+ /** Absent for workspace-authored packages, which carry no accepted tree. */
35
+ readonly treeIntegrity: Option.Option<TreeIntegrity>;
36
+ }
37
+ /** What a skill materialization observed. */
38
+ export interface SkillMaterializationFacts extends AcquiredContentFacts {
39
+ readonly sourceHash: Option.Option<SourceHash>;
40
+ }
41
+ /** What a subagent materialization observed. */
42
+ export interface SubagentMaterializationFacts extends AcquiredContentFacts {
43
+ readonly sourceHash: Option.Option<SourceHash>;
44
+ }
45
+ /** What a rule materialization observed, including the ref it accepted. */
46
+ export interface RuleMaterializationFacts extends AcquiredContentFacts {
47
+ readonly acquired: Option.Option<{
48
+ readonly ref: RuleExtensionRef;
49
+ readonly workspaceRelativeLocalSourcePath: Option.Option<string>;
50
+ readonly sourceHash: SourceHash;
51
+ readonly treeIntegrity: TreeIntegrity;
52
+ }>;
53
+ }
54
+ /** What a hook materialization observed, including the ref it accepted. */
55
+ export interface HookMaterializationFacts extends AcquiredContentFacts {
56
+ readonly acquired: Option.Option<{
57
+ readonly ref: HookExtensionRef;
58
+ readonly workspaceRelativeLocalSourcePath: Option.Option<string>;
59
+ readonly sourceHash: SourceHash;
60
+ readonly treeIntegrity: TreeIntegrity;
61
+ }>;
62
+ }
63
+ /** What a Knowledge materialization observed. */
64
+ export interface KnowledgeMaterializationFacts extends MaterializationFacts {
65
+ readonly acquired: Option.Option<{
66
+ readonly relativeLocalSource: Option.Option<string>;
67
+ readonly sourceHash: SourceHash;
68
+ readonly treeIntegrity?: TreeIntegrity;
69
+ }>;
70
+ }
71
+ /**
72
+ * What an MCP server materialization observed. A withdrawal also reports which
73
+ * shared registry resolution its lockfile entry may release.
74
+ */
75
+ export interface McpServerMaterializationFacts extends AcquiredContentFacts {
76
+ readonly removal: Option.Option<{
77
+ readonly resolutionKey: Option.Option<string>;
78
+ readonly retainShared: boolean;
79
+ }>;
80
+ }
81
+ /** What a Pack materialization observed: the acquired content identity alone. */
82
+ export type PackMaterializationFacts = AcquiredContentFacts;
83
+ declare const SkillManager_base: ServiceMap.ServiceClass<SkillManager, "@agentxm/extension-materialization/managers/SkillManager", ExtensionManager<SkillExtensionRef, SkillMaterializationFacts, ManagerRequirements>>;
84
+ export declare class SkillManager extends SkillManager_base {
85
+ }
86
+ declare const McpServerManager_base: ServiceMap.ServiceClass<McpServerManager, "@agentxm/extension-materialization/managers/McpServerManager", ExtensionManager<McpServerExtensionRef, McpServerMaterializationFacts, ManagerRequirements>>;
87
+ export declare class McpServerManager extends McpServerManager_base {
88
+ }
89
+ export interface SubagentManagerService extends ExtensionManager<SubagentExtensionRef, SubagentMaterializationFacts, ManagerRequirements> {
90
+ readonly projectionObservation: (ref: SubagentExtensionRef) => Effect.Effect<{
91
+ readonly present: boolean;
92
+ readonly current: boolean;
93
+ }, ExtensionManagerFailure, ManagerRequirements>;
94
+ }
95
+ declare const SubagentManager_base: ServiceMap.ServiceClass<SubagentManager, "@agentxm/extension-materialization/managers/SubagentManager", SubagentManagerService>;
96
+ export declare class SubagentManager extends SubagentManager_base {
97
+ }
98
+ export interface RuleManagerService extends ExtensionManager<RuleExtensionRef, RuleMaterializationFacts, ManagerRequirements> {
99
+ readonly aggregateProjectionObservation: Effect.Effect<MaterializationObservation, ExtensionManagerFailure, ManagerRequirements>;
100
+ readonly projectionPlans: () => Effect.Effect<ReadonlyArray<ProjectionPlan<void, ExtensionManagerFailure, ManagerRequirements>>, ExtensionManagerFailure, ManagerRequirements>;
101
+ }
102
+ declare const RuleManager_base: ServiceMap.ServiceClass<RuleManager, "@agentxm/extension-materialization/managers/RuleManager", RuleManagerService>;
103
+ export declare class RuleManager extends RuleManager_base {
104
+ }
105
+ export interface HookManagerService extends ExtensionManager<HookExtensionRef, HookMaterializationFacts, ManagerRequirements> {
106
+ readonly aggregateProjectionObservation: Effect.Effect<MaterializationObservation, ExtensionManagerFailure, ManagerRequirements>;
107
+ readonly projectionPlans: () => Effect.Effect<ReadonlyArray<ProjectionPlan<void, ExtensionManagerFailure, ManagerRequirements>>, ExtensionManagerFailure, ManagerRequirements>;
108
+ readonly configuredAgentOutcomes?: (state: "projected" | "current") => Effect.Effect<ReadonlyArray<ConfiguredAgentOutcome>, ExtensionManagerFailure, ManagerRequirements>;
109
+ readonly configuredAgentOutcomesForRef?: (ref: HookExtensionRef, state: "projected" | "current") => Effect.Effect<ReadonlyArray<ConfiguredAgentOutcome>, ExtensionManagerFailure, ManagerRequirements>;
110
+ }
111
+ declare const HookManager_base: ServiceMap.ServiceClass<HookManager, "@agentxm/extension-materialization/managers/HookManager", HookManagerService>;
112
+ export declare class HookManager extends HookManager_base {
113
+ }
114
+ export interface KnowledgeSyncResult {
115
+ readonly changed: boolean;
116
+ readonly warnings: ReadonlyArray<string>;
117
+ readonly artifacts: ReadonlyArray<{
118
+ readonly path: string;
119
+ readonly change: "created" | "updated" | "removed" | "unchanged";
120
+ readonly mechanism?: "symlink" | "copy";
121
+ }>;
122
+ }
123
+ export interface KnowledgeManagerService extends ExtensionManager<KnowledgeExtensionRef, KnowledgeMaterializationFacts, ManagerRequirements> {
124
+ readonly projectionPlans: () => Effect.Effect<ReadonlyArray<ProjectionPlan<void, ExtensionManagerFailure, ManagerRequirements>>, ExtensionManagerFailure, ManagerRequirements>;
125
+ /**
126
+ * Catalog refresh, sync, and the atomic install open their own workspace
127
+ * transaction, so they name the transaction scope alongside the manager's
128
+ * own requirements.
129
+ */
130
+ readonly refreshCatalog: () => Effect.Effect<void, ExtensionManagerFailure, ManagerRequirements | WorkspaceTransactionScope>;
131
+ readonly sync: (options: {
132
+ readonly dryRun: boolean;
133
+ }) => Effect.Effect<KnowledgeSyncResult, ExtensionManagerFailure, ManagerRequirements | WorkspaceTransactionScope>;
134
+ readonly install: (args: {
135
+ readonly ref: KnowledgeExtensionRef;
136
+ readonly versionRange: Option.Option<VersionRange>;
137
+ readonly deferProjection?: boolean;
138
+ }) => Effect.Effect<void, ExtensionManagerFailure, ManagerRequirements | WorkspaceTransactionScope>;
139
+ }
140
+ declare const KnowledgeManager_base: ServiceMap.ServiceClass<KnowledgeManager, "@agentxm/extension-materialization/managers/KnowledgeManager", KnowledgeManagerService>;
141
+ export declare class KnowledgeManager extends KnowledgeManager_base {
142
+ }
143
+ declare const PackManager_base: ServiceMap.ServiceClass<PackManager, "@agentxm/extension-materialization/managers/PackManager", ExtensionManager<PackRef, AcquiredContentFacts, ManagerRequirements>>;
144
+ export declare class PackManager extends PackManager_base {
145
+ }
146
+ export {};
147
+ //# sourceMappingURL=managers.d.ts.map
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Per-extension-type manager service tags and the materialization facts each
3
+ * manager reports.
4
+ *
5
+ * Plan-building features require a manager through its tag without depending
6
+ * on the module that implements it. Every tag pins the facts type its manager
7
+ * carries from a materialization to the settings and lockfile writes that
8
+ * follow it in the same closure, so nothing travels through state the layer
9
+ * keeps alive between calls.
10
+ *
11
+ * @experimental This API is unstable and may change without notice.
12
+ * @packageDocumentation
13
+ */
14
+ import * as ServiceMap from "effect/Context";
15
+ // -----------------------------------------------------------------------------
16
+ // Service tags
17
+ // -----------------------------------------------------------------------------
18
+ export class SkillManager extends ServiceMap.Service()("@agentxm/extension-materialization/managers/SkillManager") {
19
+ }
20
+ export class McpServerManager extends ServiceMap.Service()("@agentxm/extension-materialization/managers/McpServerManager") {
21
+ }
22
+ export class SubagentManager extends ServiceMap.Service()("@agentxm/extension-materialization/managers/SubagentManager") {
23
+ }
24
+ export class RuleManager extends ServiceMap.Service()("@agentxm/extension-materialization/managers/RuleManager") {
25
+ }
26
+ export class HookManager extends ServiceMap.Service()("@agentxm/extension-materialization/managers/HookManager") {
27
+ }
28
+ export class KnowledgeManager extends ServiceMap.Service()("@agentxm/extension-materialization/managers/KnowledgeManager") {
29
+ }
30
+ export class PackManager extends ServiceMap.Service()("@agentxm/extension-materialization/managers/PackManager") {
31
+ }
32
+ //# sourceMappingURL=managers.js.map
@@ -0,0 +1,24 @@
1
+ import type { AgentId } from "@agentxm/extension-model/unstable/agents/types";
2
+ import type { McpServerLockEntry } from "@agentxm/workspace-state";
3
+ import type { JobStepArtifact, JobStepArtifactTarget } from "@agentxm/workspace-operations";
4
+ import type { WorkspaceScope } from "@agentxm/extension-model/unstable/workspace-scope";
5
+ export declare const mcpConfigSurface: (scope: WorkspaceScope) => string;
6
+ export declare const MCP_AGENT_CONFIG_SURFACE = ".mcp.json";
7
+ export declare const mcpServerVersion: (entry: McpServerLockEntry) => string | undefined;
8
+ export declare const mcpServerSourcePath: (scope: WorkspaceScope, entry: McpServerLockEntry) => string;
9
+ export declare const agentConfigTarget: (change: JobStepArtifactTarget["change"], agentIds: ReadonlyArray<AgentId>) => JobStepArtifactTarget | undefined;
10
+ export interface AgentMcpConfigOutcome {
11
+ readonly agentId: string;
12
+ readonly targets?: ReadonlyArray<JobStepArtifactTarget>;
13
+ }
14
+ export declare const agentConfigTargets: (outcomes: ReadonlyArray<AgentMcpConfigOutcome>) => ReadonlyArray<JobStepArtifactTarget>;
15
+ export declare const mcpSettingsTarget: (scope: WorkspaceScope, change: JobStepArtifactTarget["change"]) => JobStepArtifactTarget;
16
+ export declare const mcpSourceTarget: (scope: WorkspaceScope, entry: McpServerLockEntry, change: JobStepArtifactTarget["change"]) => JobStepArtifactTarget;
17
+ export declare const mcpServerArtifact: (args: {
18
+ readonly lockEntry: McpServerLockEntry | undefined;
19
+ readonly scope: JobStepArtifact["scope"];
20
+ readonly change: JobStepArtifact["change"];
21
+ readonly targets: ReadonlyArray<JobStepArtifactTarget>;
22
+ readonly agents?: ReadonlyArray<string>;
23
+ }) => JobStepArtifact;
24
+ //# sourceMappingURL=artifact.d.ts.map
@@ -0,0 +1,74 @@
1
+ import { ACQUIRED_EXTENSIONS_DIR } from "@agentxm/workspace-state";
2
+ import { acquiredExtensionDisplayPathFromLockEntry } from "@agentxm/workspace-state";
3
+ export const mcpConfigSurface = (scope) => scope === "project"
4
+ ? "axm.json / axm-lock.yaml"
5
+ : ".axm/workspace/axm.json / .axm/workspace/axm-lock.yaml";
6
+ export const MCP_AGENT_CONFIG_SURFACE = ".mcp.json";
7
+ export const mcpServerVersion = (entry) => entry.type === "registry" ? entry.resolvedVersion : undefined;
8
+ export const mcpServerSourcePath = (scope, entry) => acquiredExtensionDisplayPathFromLockEntry(scope === "project" ? ACQUIRED_EXTENSIONS_DIR : ".axm/workspace/agent_extensions", entry, "mcps", entry.workspaceName);
9
+ export const agentConfigTarget = (change, agentIds) => agentIds.length === 0
10
+ ? undefined
11
+ : {
12
+ path: MCP_AGENT_CONFIG_SURFACE,
13
+ change,
14
+ agentIds,
15
+ };
16
+ const mergeTargetChange = (current, next) => {
17
+ if (current === "created" || next === "created")
18
+ return "created";
19
+ if (current === "updated" || next === "updated")
20
+ return "updated";
21
+ if (current === "removed" || next === "removed")
22
+ return "removed";
23
+ return "unchanged";
24
+ };
25
+ export const agentConfigTargets = (outcomes) => {
26
+ const grouped = new Map();
27
+ for (const outcome of outcomes) {
28
+ for (const target of outcome.targets ?? []) {
29
+ const existing = grouped.get(target.path);
30
+ if (existing === undefined) {
31
+ grouped.set(target.path, {
32
+ path: target.path,
33
+ change: target.change,
34
+ agentIds: [outcome.agentId],
35
+ });
36
+ continue;
37
+ }
38
+ existing.change = mergeTargetChange(existing.change, target.change);
39
+ existing.agentIds.push(outcome.agentId);
40
+ }
41
+ }
42
+ return Array.from(grouped.values()).map((target) => ({
43
+ path: target.path,
44
+ change: target.change,
45
+ agentIds: target.agentIds,
46
+ }));
47
+ };
48
+ export const mcpSettingsTarget = (scope, change) => ({
49
+ path: scope === "project" ? "axm.json" : ".axm/workspace/axm.json",
50
+ change,
51
+ });
52
+ export const mcpSourceTarget = (scope, entry, change) => ({
53
+ path: mcpServerSourcePath(scope, entry),
54
+ change,
55
+ });
56
+ export const mcpServerArtifact = (args) => {
57
+ const version = args.lockEntry === undefined ? undefined : mcpServerVersion(args.lockEntry);
58
+ return {
59
+ path: args.lockEntry === undefined
60
+ ? mcpConfigSurface(args.scope)
61
+ : mcpServerSourcePath(args.scope, args.lockEntry),
62
+ scope: args.scope,
63
+ change: args.change,
64
+ ...(args.agents === undefined ? {} : { agents: args.agents }),
65
+ ...(version === undefined ? {} : { version }),
66
+ ...(args.targets.length === 0
67
+ ? {}
68
+ : {
69
+ fileCount: args.targets.length,
70
+ targets: args.targets,
71
+ }),
72
+ };
73
+ };
74
+ //# sourceMappingURL=artifact.js.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Materializing an authored MCP server package during create, fork, adopt, and
3
+ * native import.
4
+ *
5
+ * The authored closure recipe accepts a type-specific materialization because
6
+ * an MCP server's canonical content is realized by the install operation
7
+ * rather than by its manager. Both live in this capability, so every authoring
8
+ * route reaches the same realization without importing a peer feature.
9
+ *
10
+ * @experimental This API is unstable and may change without notice.
11
+ */
12
+ import * as Effect from "effect/Effect";
13
+ import * as Option from "effect/Option";
14
+ import type { McpServerExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/mcp-server";
15
+ import type { McpServerMaterializationFacts } from "../managers.js";
16
+ import type { ExtensionManagerFailure } from "../errors.js";
17
+ import { type McpServerInstallRequirements } from "./install-operation.js";
18
+ /**
19
+ * Realize the authored package's canonical content and native projections
20
+ * without touching workspace state: the authored closure commits desired state
21
+ * itself. Reports no acquisition facts — an authored package has no accepted
22
+ * registry resolution for the entry writers to record.
23
+ */
24
+ export declare const materializeAuthoredMcpServer: (args: {
25
+ readonly ref: McpServerExtensionRef;
26
+ readonly nonInteractive: boolean;
27
+ }) => Effect.Effect<Option.Option<McpServerMaterializationFacts>, ExtensionManagerFailure, McpServerInstallRequirements>;
28
+ //# sourceMappingURL=authored-materialization.d.ts.map
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Materializing an authored MCP server package during create, fork, adopt, and
3
+ * native import.
4
+ *
5
+ * The authored closure recipe accepts a type-specific materialization because
6
+ * an MCP server's canonical content is realized by the install operation
7
+ * rather than by its manager. Both live in this capability, so every authoring
8
+ * route reaches the same realization without importing a peer feature.
9
+ *
10
+ * @experimental This API is unstable and may change without notice.
11
+ */
12
+ import * as Effect from "effect/Effect";
13
+ import * as Option from "effect/Option";
14
+ import { installMcpServer } from "./install-operation.js";
15
+ /**
16
+ * Realize the authored package's canonical content and native projections
17
+ * without touching workspace state: the authored closure commits desired state
18
+ * itself. Reports no acquisition facts — an authored package has no accepted
19
+ * registry resolution for the entry writers to record.
20
+ */
21
+ export const materializeAuthoredMcpServer = (args) => installMcpServer({
22
+ name: "install-mcp-server",
23
+ args: {
24
+ ref: args.ref,
25
+ nonInteractive: args.nonInteractive,
26
+ force: false,
27
+ allowWorkspaceSourceTransition: true,
28
+ versionRange: Option.none(),
29
+ skipSettings: Option.none(),
30
+ skipStateWrites: true,
31
+ env: Option.none(),
32
+ },
33
+ }).pipe(Effect.as(Option.none()));
34
+ //# sourceMappingURL=authored-materialization.js.map