@agentxm/extension-lifecycle 0.28.11 → 0.28.13

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 (207) hide show
  1. package/dist/src/activation/display-paths.d.ts +25 -0
  2. package/dist/src/activation/display-paths.js +25 -0
  3. package/dist/src/activation/errors.d.ts +16 -0
  4. package/dist/src/activation/errors.js +7 -0
  5. package/dist/src/activation/set-activation.d.ts +134 -0
  6. package/dist/src/activation/set-activation.js +772 -0
  7. package/dist/src/demote/demote-to-external-source.d.ts +82 -0
  8. package/dist/src/demote/demote-to-external-source.js +233 -0
  9. package/dist/src/errors.d.ts +0 -8
  10. package/dist/src/errors.js +0 -8
  11. package/dist/src/glob.d.ts +35 -0
  12. package/dist/src/glob.js +75 -0
  13. package/dist/src/hooks/configured-agent-outcomes-provider.d.ts +7 -3
  14. package/dist/src/hooks/configured-agent-outcomes-provider.js +11 -4
  15. package/dist/src/hooks/install/plan.d.ts +45 -0
  16. package/dist/src/hooks/install/plan.js +224 -0
  17. package/dist/src/hooks/uninstall/plan.d.ts +20 -0
  18. package/dist/src/hooks/uninstall/plan.js +77 -0
  19. package/dist/src/index.d.ts +48 -16
  20. package/dist/src/index.js +60 -17
  21. package/dist/src/install/aggregate-projection-step.d.ts +16 -0
  22. package/dist/src/install/aggregate-projection-step.js +49 -0
  23. package/dist/src/install/configured.d.ts +65 -0
  24. package/dist/src/install/configured.js +406 -0
  25. package/dist/src/install/inline-mcp-operation.d.ts +4 -0
  26. package/dist/src/install/inline-mcp-operation.js +25 -0
  27. package/dist/src/install/install-extensions.d.ts +110 -0
  28. package/dist/src/install/install-extensions.js +282 -0
  29. package/dist/src/install/per-type-install.d.ts +12 -0
  30. package/dist/src/install/per-type-install.js +12 -0
  31. package/dist/src/install/registry-install-target.d.ts +35 -0
  32. package/dist/src/install/registry-install-target.js +66 -0
  33. package/dist/src/install/registry-login-suggestion.d.ts +21 -0
  34. package/dist/src/install/registry-login-suggestion.js +34 -0
  35. package/dist/src/install/registry-source-resolution.d.ts +54 -0
  36. package/dist/src/install/registry-source-resolution.js +216 -0
  37. package/dist/src/install/root-intent.d.ts +19 -0
  38. package/dist/src/install/root-intent.js +122 -0
  39. package/dist/src/install/selection-interaction.d.ts +46 -0
  40. package/dist/src/install/selection-interaction.js +22 -0
  41. package/dist/src/install/vocabulary.d.ts +143 -0
  42. package/dist/src/install/vocabulary.js +29 -0
  43. package/dist/src/knowledge/install/plan.d.ts +35 -0
  44. package/dist/src/knowledge/install/plan.js +128 -0
  45. package/dist/src/knowledge/uninstall/plan.d.ts +23 -0
  46. package/dist/src/knowledge/uninstall/plan.js +140 -0
  47. package/dist/src/live.d.ts +4 -11
  48. package/dist/src/live.js +4 -11
  49. package/dist/src/mcps/install/plan.d.ts +65 -0
  50. package/dist/src/mcps/install/plan.js +301 -0
  51. package/dist/src/mcps/operations/disable.d.ts +5 -3
  52. package/dist/src/mcps/operations/disable.js +6 -4
  53. package/dist/src/mcps/operations/enable.d.ts +5 -3
  54. package/dist/src/mcps/operations/enable.js +8 -6
  55. package/dist/src/mcps/operations/sync-outcome.d.ts +1 -1
  56. package/dist/src/mcps/operations/uninstall.d.ts +5 -3
  57. package/dist/src/mcps/operations/uninstall.js +4 -4
  58. package/dist/src/mcps/uninstall/plan.d.ts +24 -0
  59. package/dist/src/mcps/uninstall/plan.js +109 -0
  60. package/dist/src/packs/artifact.d.ts +21 -0
  61. package/dist/src/packs/artifact.js +32 -0
  62. package/dist/src/packs/constraint-gate.d.ts +30 -0
  63. package/dist/src/packs/constraint-gate.js +76 -0
  64. package/dist/src/packs/expansion.d.ts +13 -14
  65. package/dist/src/packs/expansion.js +1 -2
  66. package/dist/src/packs/graph-transition.d.ts +64 -0
  67. package/dist/src/packs/graph-transition.js +219 -0
  68. package/dist/src/packs/install/plan.d.ts +95 -0
  69. package/dist/src/packs/install/plan.js +845 -0
  70. package/dist/src/packs/member-install-step.d.ts +29 -0
  71. package/dist/src/packs/member-install-step.js +156 -0
  72. package/dist/src/packs/operations/install.d.ts +3 -3
  73. package/dist/src/packs/operations/install.js +5 -5
  74. package/dist/src/packs/promote-authored-pack.d.ts +86 -0
  75. package/dist/src/packs/promote-authored-pack.js +239 -0
  76. package/dist/src/packs/resolved-dependency.d.ts +9 -26
  77. package/dist/src/packs/resolved-dependency.js +8 -20
  78. package/dist/src/packs/uninstall/plan.d.ts +66 -0
  79. package/dist/src/packs/uninstall/plan.js +344 -0
  80. package/dist/src/packs/uninstall/readiness.d.ts +50 -0
  81. package/dist/src/packs/uninstall/readiness.js +130 -0
  82. package/dist/src/publisher-binding.d.ts +8 -40
  83. package/dist/src/publisher-binding.js +8 -46
  84. package/dist/src/rules/install/plan.d.ts +35 -0
  85. package/dist/src/rules/install/plan.js +133 -0
  86. package/dist/src/rules/uninstall/plan.d.ts +19 -0
  87. package/dist/src/rules/uninstall/plan.js +54 -0
  88. package/dist/src/skills/install/bundled.d.ts +73 -0
  89. package/dist/src/skills/install/bundled.js +244 -0
  90. package/dist/src/skills/install/plan.d.ts +72 -0
  91. package/dist/src/skills/install/plan.js +429 -0
  92. package/dist/src/skills/install/selection.d.ts +26 -0
  93. package/dist/src/skills/install/selection.js +41 -0
  94. package/dist/src/skills/install/source.d.ts +21 -0
  95. package/dist/src/skills/install/source.js +76 -0
  96. package/dist/src/skills/operations/disable.d.ts +3 -2
  97. package/dist/src/skills/operations/disable.js +7 -11
  98. package/dist/src/skills/operations/enable.d.ts +3 -2
  99. package/dist/src/skills/operations/enable.js +6 -8
  100. package/dist/src/skills/operations/install.d.ts +4 -4
  101. package/dist/src/skills/operations/install.js +13 -12
  102. package/dist/src/skills/uninstall/plan.d.ts +23 -0
  103. package/dist/src/skills/uninstall/plan.js +165 -0
  104. package/dist/src/skills/utils.js +1 -1
  105. package/dist/src/step-failure-conversion.d.ts +44 -0
  106. package/dist/src/step-failure-conversion.js +26 -0
  107. package/dist/src/step-failure.d.ts +29 -0
  108. package/dist/src/step-failure.js +130 -0
  109. package/dist/src/subagents/install/plan.d.ts +49 -0
  110. package/dist/src/subagents/install/plan.js +270 -0
  111. package/dist/src/subagents/install/selection.d.ts +26 -0
  112. package/dist/src/subagents/install/selection.js +37 -0
  113. package/dist/src/subagents/install/source.d.ts +18 -0
  114. package/dist/src/subagents/install/source.js +72 -0
  115. package/dist/src/subagents/operations/disable.d.ts +5 -3
  116. package/dist/src/subagents/operations/disable.js +5 -3
  117. package/dist/src/subagents/operations/enable.d.ts +5 -3
  118. package/dist/src/subagents/operations/enable.js +17 -12
  119. package/dist/src/subagents/uninstall/plan.d.ts +20 -0
  120. package/dist/src/subagents/uninstall/plan.js +142 -0
  121. package/dist/src/test-packages.d.ts +34 -0
  122. package/dist/src/test-packages.js +111 -0
  123. package/dist/src/test-registry.d.ts +78 -0
  124. package/dist/src/test-registry.js +223 -0
  125. package/dist/src/testing.d.ts +108 -0
  126. package/dist/src/testing.js +241 -0
  127. package/dist/src/uninstall/retention-policy.d.ts +21 -0
  128. package/dist/src/uninstall/retention-policy.js +28 -0
  129. package/dist/src/uninstall/root-intent.d.ts +17 -0
  130. package/dist/src/uninstall/root-intent.js +101 -0
  131. package/dist/src/uninstall/uninstall-extensions.d.ts +61 -0
  132. package/dist/src/uninstall/uninstall-extensions.js +127 -0
  133. package/dist/src/uninstall/vocabulary.d.ts +40 -0
  134. package/dist/src/uninstall/vocabulary.js +14 -0
  135. package/dist/src/update/atomicity.d.ts +22 -0
  136. package/dist/src/update/atomicity.js +23 -0
  137. package/dist/src/update/blockers.d.ts +31 -0
  138. package/dist/src/update/blockers.js +78 -0
  139. package/dist/src/update/configured.d.ts +78 -0
  140. package/dist/src/update/configured.js +546 -0
  141. package/dist/src/update/root-request.d.ts +39 -0
  142. package/dist/src/update/root-request.js +117 -0
  143. package/dist/src/update/selective/plan.d.ts +45 -0
  144. package/dist/src/update/selective/plan.js +61 -0
  145. package/dist/src/update/selective/requirements.d.ts +17 -0
  146. package/dist/src/update/selective/requirements.js +14 -0
  147. package/dist/src/update/selective/selection.d.ts +63 -0
  148. package/dist/src/update/selective/selection.js +85 -0
  149. package/dist/src/update/selective/skills.d.ts +55 -0
  150. package/dist/src/update/selective/skills.js +596 -0
  151. package/dist/src/update/selective/subagents.d.ts +52 -0
  152. package/dist/src/update/selective/subagents.js +331 -0
  153. package/dist/src/update/selective/use-case.d.ts +121 -0
  154. package/dist/src/update/selective/use-case.js +28 -0
  155. package/dist/src/update/selective/vocabulary.d.ts +43 -0
  156. package/dist/src/update/selective/vocabulary.js +28 -0
  157. package/dist/src/update/selector.d.ts +72 -0
  158. package/dist/src/update/selector.js +120 -0
  159. package/dist/src/update/targeted-plan.d.ts +30 -0
  160. package/dist/src/update/targeted-plan.js +113 -0
  161. package/dist/src/update/update-extensions.d.ts +164 -0
  162. package/dist/src/update/update-extensions.js +579 -0
  163. package/dist/src/workspace-paths.d.ts +31 -0
  164. package/dist/src/workspace-paths.js +46 -0
  165. package/package.json +22 -12
  166. package/dist/src/configured-entry-resolution.d.ts +0 -111
  167. package/dist/src/configured-entry-resolution.js +0 -731
  168. package/dist/src/failure-adapter.d.ts +0 -35
  169. package/dist/src/failure-adapter.js +0 -23
  170. package/dist/src/hooks/manager.d.ts +0 -15
  171. package/dist/src/hooks/manager.js +0 -769
  172. package/dist/src/internal/fs-helpers.d.ts +0 -12
  173. package/dist/src/internal/fs-helpers.js +0 -13
  174. package/dist/src/internal/integrity.d.ts +0 -13
  175. package/dist/src/internal/integrity.js +0 -17
  176. package/dist/src/knowledge/manager.d.ts +0 -11
  177. package/dist/src/knowledge/manager.js +0 -711
  178. package/dist/src/mcps/manager.d.ts +0 -16
  179. package/dist/src/mcps/manager.js +0 -247
  180. package/dist/src/mcps/operations/artifact.d.ts +0 -24
  181. package/dist/src/mcps/operations/artifact.js +0 -74
  182. package/dist/src/mcps/operations/install.d.ts +0 -78
  183. package/dist/src/mcps/operations/install.js +0 -596
  184. package/dist/src/packs/dependency-resolution.d.ts +0 -65
  185. package/dist/src/packs/dependency-resolution.js +0 -414
  186. package/dist/src/packs/manager.d.ts +0 -16
  187. package/dist/src/packs/manager.js +0 -181
  188. package/dist/src/registry-materialization.d.ts +0 -52
  189. package/dist/src/registry-materialization.js +0 -72
  190. package/dist/src/release-age-posture.d.ts +0 -23
  191. package/dist/src/release-age-posture.js +0 -15
  192. package/dist/src/resolution-timeout.d.ts +0 -5
  193. package/dist/src/resolution-timeout.js +0 -11
  194. package/dist/src/rules/manager.d.ts +0 -20
  195. package/dist/src/rules/manager.js +0 -480
  196. package/dist/src/skills/manager.d.ts +0 -18
  197. package/dist/src/skills/manager.js +0 -346
  198. package/dist/src/skills/materialization.d.ts +0 -54
  199. package/dist/src/skills/materialization.js +0 -158
  200. package/dist/src/skills/operations/source-hash.d.ts +0 -2
  201. package/dist/src/skills/operations/source-hash.js +0 -6
  202. package/dist/src/subagents/manager.d.ts +0 -18
  203. package/dist/src/subagents/manager.js +0 -722
  204. package/dist/src/workflows/install-command/workflow.d.ts +0 -56
  205. package/dist/src/workflows/install-command/workflow.js +0 -46
  206. package/dist/src/workflows/uninstall-command/workflow.d.ts +0 -42
  207. package/dist/src/workflows/uninstall-command/workflow.js +0 -29
@@ -7,11 +7,13 @@
7
7
  */
8
8
  import * as FileSystem from "effect/FileSystem";
9
9
  import * as Path from "effect/Path";
10
- import { CodingAgentRepository } from "@agentxm/extension-workspace";
11
- import { LifecycleFailureAdapter } from "../../failure-adapter.js";
10
+ import { CodingAgentRepository } from "@agentxm/workspace-projection";
11
+ import { NativeWriteAuthority } from "@agentxm/agent-integration";
12
+ import { StepFailureConversion } from "../../step-failure-conversion.js";
12
13
  import type { OperationHandler } from "@agentxm/workspace-operations";
13
14
  import type { Operation } from "@agentxm/workspace-operations";
14
15
  import { WorkspaceMutations } from "@agentxm/workspace-state";
16
+ import { WorkspaceTransactionScope } from "@agentxm/workspace-transactions";
15
17
  /**
16
18
  * Enable a previously disabled subagent (re-render files and update state).
17
19
  *
@@ -26,5 +28,5 @@ export type EnableSubagentOperation = Operation<"enable-subagent", {
26
28
  * Resolves accepted canonical content, renders to configured agents, and then
27
29
  * updates the desired settings entry.
28
30
  */
29
- export declare const enableSubagent: OperationHandler<EnableSubagentOperation, FileSystem.FileSystem | Path.Path | WorkspaceMutations | CodingAgentRepository | LifecycleFailureAdapter>;
31
+ export declare const enableSubagent: OperationHandler<EnableSubagentOperation, FileSystem.FileSystem | Path.Path | WorkspaceMutations | WorkspaceTransactionScope | CodingAgentRepository | NativeWriteAuthority | StepFailureConversion>;
30
32
  //# sourceMappingURL=enable.d.ts.map
@@ -10,13 +10,16 @@ import * as Path from "effect/Path";
10
10
  import * as Effect from "effect/Effect";
11
11
  import * as Option from "effect/Option";
12
12
  import * as Schema from "effect/Schema";
13
- import { CodingAgentRepository, subagentContentFilename, subagentContentPath, warnOnOrphanOverrides, managedSubagentFile, } from "@agentxm/extension-workspace";
13
+ import { subagentContentFilename, subagentContentPath } from "@agentxm/workspace-state";
14
+ import { CodingAgentRepository, managedSubagentRenderInput, managedSubagentFile, } from "@agentxm/workspace-projection";
15
+ import { NativeWriteAuthority, warnOnOrphanOverrides } from "@agentxm/agent-integration";
14
16
  import { ExtensionLifecycleFailed } from "../../errors.js";
15
- import { LifecycleFailureAdapter, withAdaptedStepFailures } from "../../failure-adapter.js";
17
+ import { StepFailureConversion, withAdaptedStepFailures } from "../../step-failure-conversion.js";
16
18
  import { WorkspaceMutations } from "@agentxm/workspace-state";
19
+ import { WorkspaceTransactionScope, runWorkspaceTransaction, } from "@agentxm/workspace-transactions";
17
20
  import { RenderedFilesMapSchema } from "@agentxm/workspace-state";
18
21
  import { makeWorkspaceRelativePath } from "@agentxm/extension-model/unstable/path-types";
19
- import { parseSubagentMd } from "@agentxm/registry-protocol/unstable/content/subagent-content";
22
+ import { parseSubagentMd } from "@agentxm/extension-content";
20
23
  import { subagentLifecycleArtifact } from "./artifact.js";
21
24
  import { usableAcceptedCanonical } from "@agentxm/workspace-state";
22
25
  /**
@@ -93,20 +96,22 @@ export const enableSubagent = (op) => Effect.gen(function* () {
93
96
  const configuredAgents = yield* agentRepo.getConfiguredAgents();
94
97
  yield* warnOnOrphanOverrides(`Subagent "${op.args.subagentName}"`, agentOverrides, configuredAgents.map((a) => a.id));
95
98
  const renderedFilesMap = {};
96
- yield* ws.runTransaction({
99
+ yield* runWorkspaceTransaction({
97
100
  transition: Effect.gen(function* () {
98
101
  yield* Effect.forEach(configuredAgents, (agent) => agent
99
102
  .addSubagent({
100
103
  workspaceRoot: baseDir,
101
104
  scope: ws.scope,
102
- managedFile,
103
- input: {
104
- agentId: agent.id,
105
- name: op.args.subagentName,
106
- body: parsed.body,
107
- frontmatter: renderFrontmatter,
108
- agentOverrides: agentOverrides?.[agent.id],
109
- },
105
+ input: managedSubagentRenderInput({
106
+ managedFile,
107
+ input: {
108
+ agentId: agent.id,
109
+ name: op.args.subagentName,
110
+ body: parsed.body,
111
+ frontmatter: renderFrontmatter,
112
+ agentOverrides: agentOverrides?.[agent.id],
113
+ },
114
+ }),
110
115
  force: false,
111
116
  })
112
117
  .pipe(Effect.flatMap((outcome) => {
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Uninstalling subagents.
3
+ *
4
+ * The removal reports what it withdrew from the settlement the operation
5
+ * returns, so a package retained because an installed pack still requires it
6
+ * is reported as retained rather than as removed.
7
+ *
8
+ * @experimental This API is unstable and may change without notice.
9
+ */
10
+ import * as Effect from "effect/Effect";
11
+ import { SubagentManager } from "@agentxm/extension-materialization";
12
+ import type { Plan } from "@agentxm/workspace-operations";
13
+ import type { ExtensionLifecycleFailed } from "../../errors.js";
14
+ import { type InstallStepRequirements } from "../../install/vocabulary.js";
15
+ import type { SubagentUninstallIntent } from "../../uninstall/vocabulary.js";
16
+ /** Expand the selector against installed subagents; a glob may match nothing. */
17
+ export declare const parseSubagentUninstallRequest: (selector: string) => Effect.Effect<SubagentUninstallIntent, ExtensionLifecycleFailed, InstallStepRequirements>;
18
+ /** The closures a settled subagent removal becomes. */
19
+ export declare const planSubagentUninstall: (intent: SubagentUninstallIntent) => Effect.Effect<Plan<InstallStepRequirements>, ExtensionLifecycleFailed, InstallStepRequirements | SubagentManager>;
20
+ //# sourceMappingURL=plan.d.ts.map
@@ -0,0 +1,142 @@
1
+ /**
2
+ * Uninstalling subagents.
3
+ *
4
+ * The removal reports what it withdrew from the settlement the operation
5
+ * returns, so a package retained because an installed pack still requires it
6
+ * is reported as retained rather than as removed.
7
+ *
8
+ * @experimental This API is unstable and may change without notice.
9
+ */
10
+ import * as Effect from "effect/Effect";
11
+ import * as Option from "effect/Option";
12
+ import { NO_MATERIALIZATION_OBSERVATION, SubagentManager, buildUninstallOperation, } from "@agentxm/extension-materialization";
13
+ import { parseExtensionFqnParts } from "@agentxm/extension-model/unstable/extensions";
14
+ import { WorkspaceMutations, acquiredExtensionDisplayPathFromLockEntry, } from "@agentxm/workspace-state";
15
+ import { expandGlob } from "../../glob.js";
16
+ import { lifecycleStepFailure } from "../../step-failure.js";
17
+ import { installRefused } from "../../install/vocabulary.js";
18
+ import { makeWorkspaceRetentionPolicy } from "../../uninstall/retention-policy.js";
19
+ import { workspaceCanonicalPath, workspaceCanonicalRoot, workspaceLockfilePath, workspaceSettingsPath, } from "../../workspace-paths.js";
20
+ const resolvedVersion = (entry) => entry !== undefined && entry.type === "registry" ? entry.resolvedVersion : undefined;
21
+ const subagentSourceTarget = (args) => args.lockEntry === undefined
22
+ ? { path: workspaceCanonicalPath(args.scope, args.name), change: args.change }
23
+ : {
24
+ path: acquiredExtensionDisplayPathFromLockEntry(workspaceCanonicalRoot(args.scope), args.lockEntry, "subagents", args.lockEntry.workspaceName),
25
+ change: args.change,
26
+ };
27
+ const subagentArtifact = (args) => {
28
+ const targetChange = args.change === "removed" ? "removed" : "unchanged";
29
+ const targets = [
30
+ { path: workspaceLockfilePath(args.scope), change: args.lockfileChange },
31
+ { path: workspaceSettingsPath(args.scope), change: "updated" },
32
+ subagentSourceTarget({
33
+ name: args.name,
34
+ lockEntry: args.lockEntry,
35
+ change: targetChange,
36
+ scope: args.scope,
37
+ }),
38
+ ...args.materializedTargets.map((target) => ({ ...target, change: targetChange })),
39
+ ];
40
+ const firstTarget = targets[0];
41
+ const version = resolvedVersion(args.lockEntry);
42
+ return {
43
+ path: firstTarget?.path ?? args.name,
44
+ scope: args.scope,
45
+ ...(args.agents.length > 0 ? { agents: args.agents } : {}),
46
+ ...(version !== undefined ? { version } : {}),
47
+ change: args.change,
48
+ fileCount: targets.length,
49
+ ...(targets.length > 0 ? { targets } : {}),
50
+ };
51
+ };
52
+ /** Expand the selector against installed subagents; a glob may match nothing. */
53
+ export const parseSubagentUninstallRequest = Effect.fn("UninstallExtensions.parseSubagentRequest")(function* (selector) {
54
+ const ws = yield* WorkspaceMutations;
55
+ const rows = yield* ws.records.rows("subagent").pipe(Effect.mapError((cause) => installRefused({
56
+ category: "internal",
57
+ detail: "Installed subagents could not be read",
58
+ cause,
59
+ })));
60
+ const installedNames = [...new Set(rows.map((row) => row.name))];
61
+ const matched = expandGlob(selector, installedNames);
62
+ if (selector.includes("*") && matched.length === 0) {
63
+ return { targets: [] };
64
+ }
65
+ const names = matched.length > 0
66
+ ? matched
67
+ : (() => {
68
+ const parsed = parseExtensionFqnParts(selector);
69
+ const resolvedName = parsed?.type === "subagent" ? parsed.name : selector;
70
+ return installedNames.includes(resolvedName) ? [resolvedName] : [];
71
+ })();
72
+ return {
73
+ targets: names.map((name) => ({ type: "subagent", name })),
74
+ };
75
+ });
76
+ /** The closures a settled subagent removal becomes. */
77
+ export const planSubagentUninstall = Effect.fn("UninstallExtensions.planSubagents")(function* (intent) {
78
+ const ws = yield* WorkspaceMutations;
79
+ const subagentManager = yield* SubagentManager;
80
+ const retentionPolicy = makeWorkspaceRetentionPolicy(ws);
81
+ // The accepted resolution names the package the removal retires, and the
82
+ // removal deletes it, so it is read before the step runs.
83
+ const steps = yield* Effect.forEach(intent.targets, (target) => Effect.gen(function* () {
84
+ const lockEntry = Option.getOrUndefined(yield* ws
85
+ .getLockedSubagent(target.name)
86
+ .pipe(Effect.catch(() => Effect.succeed(Option.none()))));
87
+ return buildUninstallOperation(subagentManager, retentionPolicy, {
88
+ target,
89
+ toStepFailure: lifecycleStepFailure,
90
+ buildArtifact: ({ settlement, unmaterialization }) => {
91
+ if (settlement.declaration === "absent") {
92
+ return Effect.succeed(subagentArtifact({
93
+ name: target.name,
94
+ lockEntry,
95
+ materializedTargets: [],
96
+ agents: [],
97
+ change: "unchanged",
98
+ lockfileChange: "unchanged",
99
+ scope: ws.scope,
100
+ }));
101
+ }
102
+ if (settlement.canonical === "retained-by-pack") {
103
+ // The declaration was withdrawn, so this changed the workspace
104
+ // even though the package and its projections stay.
105
+ return Effect.succeed(subagentArtifact({
106
+ name: target.name,
107
+ lockEntry,
108
+ materializedTargets: [],
109
+ agents: [],
110
+ change: "updated",
111
+ lockfileChange: "unchanged",
112
+ scope: ws.scope,
113
+ }));
114
+ }
115
+ const observation = Option.match(unmaterialization, {
116
+ onNone: () => NO_MATERIALIZATION_OBSERVATION,
117
+ onSome: (facts) => facts.observation,
118
+ });
119
+ return Effect.succeed(subagentArtifact({
120
+ name: target.name,
121
+ lockEntry,
122
+ materializedTargets: observation.targets,
123
+ agents: observation.agents,
124
+ change: "removed",
125
+ lockfileChange: "updated",
126
+ scope: ws.scope,
127
+ }));
128
+ },
129
+ });
130
+ }));
131
+ return {
132
+ _tag: "Plan",
133
+ name: intent.targets.length === 0
134
+ ? "Uninstall subagents"
135
+ : intent.targets.length === 1
136
+ ? "Uninstall subagent"
137
+ : `Uninstall ${intent.targets.length} subagents`,
138
+ description: Option.none(),
139
+ jobs: [{ concurrency: 1, steps }],
140
+ };
141
+ });
142
+ //# sourceMappingURL=plan.js.map
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Minimal valid local extension packages, one per type an install can acquire
3
+ * from a directory.
4
+ *
5
+ * Each writes the manifest and the canonical content the product itself
6
+ * requires — nothing simulated — under `<root>/vendor/<name>`, and returns the
7
+ * package root so a specification can hand it to an install as a source.
8
+ *
9
+ * @experimental This API is unstable and may change without notice.
10
+ */
11
+ /** What a local package fixture is called and how it identifies itself. */
12
+ export interface LocalPackageFixture {
13
+ readonly name: string;
14
+ readonly description?: string;
15
+ readonly version?: string;
16
+ readonly owner?: string;
17
+ }
18
+ /** A local skill package: `skill.json` plus `src/SKILL.md`. */
19
+ export declare const writeLocalSkillPackage: (root: string, fixture: LocalPackageFixture) => string;
20
+ /**
21
+ * A bare Agent Skill directory: one root `SKILL.md` carrying the frontmatter
22
+ * the Agent Skill format requires, with no `skill.json` and no `src/`. It is
23
+ * the other entry-document layout a Skill source can arrive in.
24
+ */
25
+ export declare const writeAgentSkillDirectory: (root: string, fixture: LocalPackageFixture) => string;
26
+ /** A local subagent package: `subagent.json` plus `src/<name>.md`. */
27
+ export declare const writeLocalSubagentPackage: (root: string, fixture: LocalPackageFixture) => string;
28
+ /** A local rule package: `rule.json` plus `src/RULE.md`. */
29
+ export declare const writeLocalRulePackage: (root: string, fixture: LocalPackageFixture) => string;
30
+ /** A local hooks package: `hook.json` plus `src/hook.sh`. */
31
+ export declare const writeLocalHookPackage: (root: string, fixture: LocalPackageFixture) => string;
32
+ /** A local Open Knowledge Format bundle: `knowledge.json` plus `src/index.md`. */
33
+ export declare const writeLocalKnowledgePackage: (root: string, fixture: LocalPackageFixture) => string;
34
+ //# sourceMappingURL=test-packages.d.ts.map
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Minimal valid local extension packages, one per type an install can acquire
3
+ * from a directory.
4
+ *
5
+ * Each writes the manifest and the canonical content the product itself
6
+ * requires — nothing simulated — under `<root>/vendor/<name>`, and returns the
7
+ * package root so a specification can hand it to an install as a source.
8
+ *
9
+ * @experimental This API is unstable and may change without notice.
10
+ */
11
+ import * as fs from "node:fs";
12
+ import * as nodePath from "node:path";
13
+ const writePackageFile = (packageRoot, relative, contents) => {
14
+ const file = nodePath.join(packageRoot, relative);
15
+ fs.mkdirSync(nodePath.dirname(file), { recursive: true });
16
+ fs.writeFileSync(file, contents);
17
+ };
18
+ const preparePackageRoot = (root, fixture, manifestFilename, manifest) => {
19
+ const packageRoot = nodePath.join(root, "vendor", fixture.name);
20
+ fs.mkdirSync(nodePath.join(packageRoot, "src"), { recursive: true });
21
+ writePackageFile(packageRoot, manifestFilename, `${JSON.stringify(manifest, null, 2)}\n`);
22
+ return packageRoot;
23
+ };
24
+ /** A local skill package: `skill.json` plus `src/SKILL.md`. */
25
+ export const writeLocalSkillPackage = (root, fixture) => {
26
+ const description = fixture.description ?? `The ${fixture.name} skill.`;
27
+ const packageRoot = preparePackageRoot(root, fixture, "skill.json", {
28
+ $schema: "https://axm.sh/schemas/skill.schema.json",
29
+ owner: fixture.owner ?? "@acme",
30
+ type: "skill",
31
+ name: fixture.name,
32
+ version: fixture.version ?? "1.0.0",
33
+ description,
34
+ });
35
+ writePackageFile(packageRoot, "src/SKILL.md", `---\nname: "${fixture.name}"\ndescription: "${description}"\n---\n\n# ${fixture.name}\n\n${description}\n`);
36
+ return packageRoot;
37
+ };
38
+ /**
39
+ * A bare Agent Skill directory: one root `SKILL.md` carrying the frontmatter
40
+ * the Agent Skill format requires, with no `skill.json` and no `src/`. It is
41
+ * the other entry-document layout a Skill source can arrive in.
42
+ */
43
+ export const writeAgentSkillDirectory = (root, fixture) => {
44
+ const description = fixture.description ?? `The ${fixture.name} skill.`;
45
+ const packageRoot = nodePath.join(root, "vendor", fixture.name);
46
+ fs.mkdirSync(packageRoot, { recursive: true });
47
+ writePackageFile(packageRoot, "SKILL.md", `---\nname: "${fixture.name}"\ndescription: "${description}"\n---\n\n# ${fixture.name}\n\n${description}\n`);
48
+ return packageRoot;
49
+ };
50
+ /** A local subagent package: `subagent.json` plus `src/<name>.md`. */
51
+ export const writeLocalSubagentPackage = (root, fixture) => {
52
+ const description = fixture.description ?? `The ${fixture.name} subagent.`;
53
+ const packageRoot = preparePackageRoot(root, fixture, "subagent.json", {
54
+ $schema: "https://axm.sh/schemas/subagent.schema.json",
55
+ owner: fixture.owner ?? "@acme",
56
+ type: "subagent",
57
+ name: fixture.name,
58
+ version: fixture.version ?? "1.0.0",
59
+ description,
60
+ });
61
+ writePackageFile(packageRoot, `src/${fixture.name}.md`, `---\nname: ${fixture.name}\ndescription: ${description}\n---\n\n# ${fixture.name}\n`);
62
+ return packageRoot;
63
+ };
64
+ /** A local rule package: `rule.json` plus `src/RULE.md`. */
65
+ export const writeLocalRulePackage = (root, fixture) => {
66
+ const description = fixture.description ?? `The ${fixture.name} rule.`;
67
+ const packageRoot = preparePackageRoot(root, fixture, "rule.json", {
68
+ $schema: "https://axm.sh/schemas/rule.schema.json",
69
+ owner: fixture.owner ?? "@acme",
70
+ type: "rule",
71
+ name: fixture.name,
72
+ version: fixture.version ?? "1.0.0",
73
+ description,
74
+ });
75
+ writePackageFile(packageRoot, "src/RULE.md", `Guidance for ${fixture.name}: ${description}\n`);
76
+ return packageRoot;
77
+ };
78
+ /** A local hooks package: `hook.json` plus `src/hook.sh`. */
79
+ export const writeLocalHookPackage = (root, fixture) => {
80
+ const description = fixture.description ?? `The ${fixture.name} hook.`;
81
+ const packageRoot = preparePackageRoot(root, fixture, "hook.json", {
82
+ $schema: "https://axm.sh/schemas/hook.schema.json",
83
+ owner: fixture.owner ?? "@acme",
84
+ type: "hook",
85
+ name: fixture.name,
86
+ version: fixture.version ?? "1.0.0",
87
+ description,
88
+ runtime: "bash",
89
+ entrypoint: "src/hook.sh",
90
+ bindings: [{ on: "tool.pre", match: { tools: ["file.write"] } }],
91
+ });
92
+ writePackageFile(packageRoot, "src/hook.sh", `#!/usr/bin/env bash\necho "${fixture.name}"\n`);
93
+ return packageRoot;
94
+ };
95
+ /** A local Open Knowledge Format bundle: `knowledge.json` plus `src/index.md`. */
96
+ export const writeLocalKnowledgePackage = (root, fixture) => {
97
+ const description = fixture.description ?? `The ${fixture.name} knowledge bundle.`;
98
+ const packageRoot = preparePackageRoot(root, fixture, "knowledge.json", {
99
+ $schema: "https://axm.sh/schemas/knowledge.schema.json",
100
+ owner: fixture.owner ?? "@acme",
101
+ type: "knowledge",
102
+ name: fixture.name,
103
+ version: fixture.version ?? "1.0.0",
104
+ description,
105
+ format: { name: "okf", version: "0.2" },
106
+ bundleRoot: "src",
107
+ });
108
+ writePackageFile(packageRoot, "src/index.md", `---\nokf_version: "0.2"\ndescription: "${description}"\n---\n\n# ${fixture.name}\n`);
109
+ return packageRoot;
110
+ };
111
+ //# sourceMappingURL=test-packages.js.map
@@ -0,0 +1,78 @@
1
+ /**
2
+ * A file-backed Registry a specification can publish into.
3
+ *
4
+ * Writes the real Registry directory layout — a per-extension index plus
5
+ * version archives with genuine integrity hashes — that the production
6
+ * source-resolution layer reads over `file://`. Publication instants predate
7
+ * the deterministic test clock by more than the default minimum release age,
8
+ * so every written version is immediately eligible; rewriting an extension
9
+ * with a longer version list models a later publication.
10
+ *
11
+ * @experimental This API is unstable and may change without notice.
12
+ */
13
+ export interface RegistrySkillVersion {
14
+ readonly version: string;
15
+ /** Body text of the skill document, so versions are observably distinct. */
16
+ readonly body: string;
17
+ /**
18
+ * Publication instant. Defaults to one that predates the minimum release
19
+ * age; pass a recent instant to model a release the age policy still holds.
20
+ */
21
+ readonly published?: string;
22
+ }
23
+ export interface RegistrySubagentVersion {
24
+ readonly version: string;
25
+ /** Body text of the subagent document, so versions are observably distinct. */
26
+ readonly body: string;
27
+ readonly published?: string;
28
+ }
29
+ export interface RegistryMcpVersion {
30
+ readonly version: string;
31
+ /** Additional package files included in the version archive. */
32
+ readonly files?: Readonly<Record<string, string>>;
33
+ /** Declared environment input, for credential-lifecycle evidence. */
34
+ readonly secretInput?: string;
35
+ }
36
+ export interface RegistryPackVersion {
37
+ readonly version: string;
38
+ readonly files?: Readonly<Record<string, string>>;
39
+ /** Member constraints keyed by fully qualified name, as the manifest records them. */
40
+ readonly dependencies: Readonly<Record<string, string>>;
41
+ readonly published?: string;
42
+ }
43
+ export interface RegistryKnowledgeVersion {
44
+ readonly version: string;
45
+ /** Body text of the bundle's root index, so versions are observably distinct. */
46
+ readonly body: string;
47
+ readonly published?: string;
48
+ }
49
+ export interface RegistryRuleVersion {
50
+ readonly version: string;
51
+ readonly body: string;
52
+ readonly published?: string;
53
+ }
54
+ export interface RegistryHookVersion {
55
+ readonly version: string;
56
+ readonly published?: string;
57
+ }
58
+ export interface LifecycleRegistry {
59
+ /** Absolute Registry root directory. */
60
+ readonly root: string;
61
+ /** The settings `sources` entry that points at this Registry. */
62
+ readonly source: {
63
+ readonly name: string;
64
+ readonly type: "registry";
65
+ readonly location: string;
66
+ };
67
+ readonly writeSkill: (name: string, versions: ReadonlyArray<RegistrySkillVersion>) => void;
68
+ readonly writeSubagent: (name: string, versions: ReadonlyArray<RegistrySubagentVersion>) => void;
69
+ readonly writeRule: (name: string, versions: ReadonlyArray<RegistryRuleVersion>) => void;
70
+ readonly writeHook: (name: string, versions: ReadonlyArray<RegistryHookVersion>) => void;
71
+ readonly writeMcp: (name: string, versions: ReadonlyArray<RegistryMcpVersion>) => void;
72
+ readonly writePack: (name: string, versions: ReadonlyArray<RegistryPackVersion>) => void;
73
+ readonly writeKnowledge: (name: string, versions: ReadonlyArray<RegistryKnowledgeVersion>) => void;
74
+ readonly cleanup: () => void;
75
+ }
76
+ /** Publish into a throwaway `file://` Registry. */
77
+ export declare const makeLifecycleRegistry: () => LifecycleRegistry;
78
+ //# sourceMappingURL=test-registry.d.ts.map