@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
@@ -1,414 +0,0 @@
1
- import * as Effect from "effect/Effect";
2
- import * as Option from "effect/Option";
3
- import { formatFqn, parseFqnOrThrow, toExtensionTypePlural, } from "@agentxm/extension-model/unstable/extensions";
4
- import { SourceAuthorityBlocked, PackConstraintShadowed, PackDependencyConflict, PackDependencyInvalid, PackDependencyMissing, PackDependencyUnsatisfied, } from "@agentxm/extension-workspace";
5
- import * as semver from "semver";
6
- import { releaseAgeExemptionForIdentity } from "@agentxm/registry-protocol/unstable/registry/release-age-policy";
7
- const validateSelectedDependency = (candidate, expectedType, parsed, fqn, constraint) => {
8
- if (candidate.type !== expectedType ||
9
- (candidate.refType !== "registry" && candidate.refType !== "workspace") ||
10
- candidate.owner !== parsed.owner ||
11
- candidate.name !== parsed.name) {
12
- return new PackDependencyConflict({
13
- detail: `Authorized dependency resolution does not match pack dependency ${fqn}`,
14
- });
15
- }
16
- if (!semver.satisfies(candidate.version, constraint)) {
17
- return new PackDependencyConflict({
18
- detail: `Authorized dependency ${fqn}@${candidate.version} does not satisfy ${constraint}`,
19
- });
20
- }
21
- return Effect.succeed({
22
- owner: parsed.owner,
23
- type: expectedType,
24
- name: parsed.name,
25
- ref: candidate,
26
- });
27
- };
28
- const registrySourceForDependency = (pack, owner, sourceOverride) => {
29
- const source = sourceOverride ?? (pack.source.type === "registry" ? pack.source : undefined);
30
- if (source === undefined) {
31
- return Effect.fail(new PackDependencyInvalid({
32
- detail: `Cannot resolve pack dependencies from non-registry source`,
33
- }));
34
- }
35
- return Effect.succeed({
36
- ...source,
37
- owner: Option.some(owner),
38
- });
39
- };
40
- const workspaceConstraintConflict = (pack, memberFqn, workspaceVersion, constraint) => new PackConstraintShadowed({
41
- packSource: pack.source.type === "workspace" ? "workspace" : "registry",
42
- packFqn: formatFqn({ owner: pack.owner, type: "pack", name: pack.pack.name }),
43
- memberFqn,
44
- constraint,
45
- workspaceVersion,
46
- });
47
- const resolveDependencyRef = (pack, expectedType, fqn, constraint, sources, minimumReleaseAge, sourceOverride, workspaceResolver, dependencyResolver) => Effect.gen(function* () {
48
- const parsed = parseFqnOrThrow(fqn);
49
- if (parsed.type !== expectedType) {
50
- return yield* new PackDependencyInvalid({
51
- detail: `Pack dependency type mismatch for expected ${expectedType}`,
52
- });
53
- }
54
- if (workspaceResolver !== undefined) {
55
- const workspace = yield* workspaceResolver({
56
- owner: parsed.owner,
57
- type: expectedType,
58
- name: parsed.name,
59
- constraint,
60
- root: formatFqn({ owner: pack.owner, type: "pack", name: pack.pack.name }),
61
- });
62
- if (workspace.kind === "blocked") {
63
- return yield* new SourceAuthorityBlocked({
64
- detail: workspace.fact.detail,
65
- recovery: workspace.fact.recovery,
66
- });
67
- }
68
- if (workspace.kind === "selected") {
69
- const candidate = workspace.ref;
70
- if (candidate.type !== expectedType ||
71
- candidate.refType !== "workspace" ||
72
- candidate.owner !== parsed.owner ||
73
- candidate.name !== parsed.name) {
74
- return yield* new PackDependencyConflict({
75
- detail: `Configured workspace authority does not match pack dependency ${fqn}`,
76
- });
77
- }
78
- if (!semver.satisfies(candidate.version, constraint)) {
79
- return yield* workspaceConstraintConflict(pack, fqn, candidate.version, constraint);
80
- }
81
- return {
82
- owner: parsed.owner,
83
- type: expectedType,
84
- name: parsed.name,
85
- ref: candidate,
86
- };
87
- }
88
- }
89
- if (dependencyResolver !== undefined) {
90
- const candidate = yield* dependencyResolver({
91
- owner: parsed.owner,
92
- type: expectedType,
93
- name: parsed.name,
94
- constraint,
95
- root: formatFqn({ owner: pack.owner, type: "pack", name: pack.pack.name }),
96
- });
97
- return yield* validateSelectedDependency(candidate, expectedType, parsed, fqn, constraint);
98
- }
99
- const source = yield* registrySourceForDependency(pack, parsed.owner, sourceOverride);
100
- const matches = yield* Effect.scoped(sources.find(source, {
101
- names: [parsed.name],
102
- type: expectedType,
103
- owner: Option.some(parsed.owner),
104
- versionRange: Option.some(constraint),
105
- ...(minimumReleaseAge === undefined ? {} : { minimumReleaseAge }),
106
- }));
107
- const matchingRef = matches.find((candidate) => candidate.type === expectedType &&
108
- candidate.refType === "registry" &&
109
- candidate.owner === parsed.owner &&
110
- candidate.name === parsed.name);
111
- if (matchingRef === undefined) {
112
- return yield* new PackDependencyInvalid({
113
- detail: `Unable to resolve pack dependency ${fqn}@${constraint}`,
114
- });
115
- }
116
- return {
117
- owner: parsed.owner,
118
- type: expectedType,
119
- name: parsed.name,
120
- ref: matchingRef,
121
- };
122
- });
123
- const dependencyReleaseAgeRecord = (args) => ({
124
- reason: "minimum-release-age",
125
- target: args.dependencyTarget,
126
- dependencyPath: [args.packTarget, args.dependencyTarget],
127
- requestedRange: args.constraint,
128
- ...(args.selectedVersion === undefined ? {} : { selectedVersion: args.selectedVersion }),
129
- candidateVersion: args.evidence.version,
130
- publishedAt: args.evidence.publishedAt,
131
- eligibleAt: args.evidence.eligibleAt,
132
- minimumReleaseAgeSeconds: args.evidence.minimumReleaseAgeSeconds,
133
- });
134
- const resolveDependencyRefWithReleaseAge = (pack, expectedType, fqn, constraint, sources, evaluation, sourceOverride, workspaceResolver, dependencyResolver) => Effect.gen(function* () {
135
- const parsed = parseFqnOrThrow(fqn);
136
- if (parsed.type !== expectedType) {
137
- return yield* new PackDependencyInvalid({
138
- detail: `Pack dependency type mismatch for expected ${expectedType}`,
139
- });
140
- }
141
- if (workspaceResolver !== undefined) {
142
- const workspace = yield* workspaceResolver({
143
- owner: parsed.owner,
144
- type: expectedType,
145
- name: parsed.name,
146
- constraint,
147
- root: formatFqn({ owner: pack.owner, type: "pack", name: pack.pack.name }),
148
- });
149
- if (workspace.kind === "blocked") {
150
- return yield* new SourceAuthorityBlocked({
151
- detail: workspace.fact.detail,
152
- recovery: workspace.fact.recovery,
153
- });
154
- }
155
- if (workspace.kind === "selected") {
156
- const candidate = workspace.ref;
157
- if (candidate.type !== expectedType ||
158
- candidate.refType !== "workspace" ||
159
- candidate.owner !== parsed.owner ||
160
- candidate.name !== parsed.name) {
161
- return yield* new PackDependencyConflict({
162
- detail: `Configured workspace authority does not match pack dependency ${fqn}`,
163
- });
164
- }
165
- if (!semver.satisfies(candidate.version, constraint)) {
166
- return yield* workspaceConstraintConflict(pack, fqn, candidate.version, constraint);
167
- }
168
- return {
169
- kind: "selected",
170
- dependency: {
171
- owner: parsed.owner,
172
- type: expectedType,
173
- name: parsed.name,
174
- ref: candidate,
175
- },
176
- holdbacks: [],
177
- bypasses: [],
178
- };
179
- }
180
- }
181
- if (dependencyResolver !== undefined) {
182
- const candidate = yield* dependencyResolver({
183
- owner: parsed.owner,
184
- type: expectedType,
185
- name: parsed.name,
186
- constraint,
187
- root: formatFqn({ owner: pack.owner, type: "pack", name: pack.pack.name }),
188
- });
189
- return {
190
- kind: "selected",
191
- dependency: yield* validateSelectedDependency(candidate, expectedType, parsed, fqn, constraint),
192
- holdbacks: [],
193
- bypasses: [],
194
- };
195
- }
196
- const source = yield* registrySourceForDependency(pack, parsed.owner, sourceOverride);
197
- const resolution = yield* Effect.scoped(sources.resolveNamedRegistry(source, {
198
- name: parsed.name,
199
- type: expectedType,
200
- owner: parsed.owner,
201
- versionRange: Option.some(constraint),
202
- releaseAgeEvaluation: evaluation,
203
- }));
204
- const packTarget = formatFqn({ owner: pack.owner, type: "pack", name: pack.pack.name });
205
- const dependencyTarget = formatFqn(parsed);
206
- if (resolution.kind === "not_found") {
207
- return yield* new PackDependencyMissing({ dependencyTarget });
208
- }
209
- if (resolution.kind === "version_unsatisfied") {
210
- return yield* new PackDependencyUnsatisfied({ dependencyTarget, constraint });
211
- }
212
- if (resolution.kind === "policy_held") {
213
- return {
214
- kind: "policy_held",
215
- holdback: dependencyReleaseAgeRecord({
216
- packTarget,
217
- dependencyTarget,
218
- constraint,
219
- evidence: resolution.candidate,
220
- }),
221
- };
222
- }
223
- const ref = resolution.ref;
224
- return {
225
- kind: "selected",
226
- dependency: {
227
- owner: parsed.owner,
228
- type: expectedType,
229
- name: parsed.name,
230
- ref,
231
- },
232
- holdbacks: resolution.kind === "exempted" || resolution.newerHeld === undefined
233
- ? []
234
- : [
235
- dependencyReleaseAgeRecord({
236
- packTarget,
237
- dependencyTarget,
238
- constraint,
239
- evidence: resolution.newerHeld,
240
- selectedVersion: ref.version,
241
- }),
242
- ],
243
- bypasses: resolution.kind === "selected"
244
- ? []
245
- : [
246
- {
247
- ...dependencyReleaseAgeRecord({
248
- packTarget,
249
- dependencyTarget,
250
- constraint,
251
- evidence: resolution.bypassed,
252
- selectedVersion: ref.version,
253
- }),
254
- ...resolution.exemption,
255
- },
256
- ],
257
- };
258
- });
259
- const toResolvedMap = (dependencies) => Object.fromEntries(dependencies.map((dependency) => {
260
- const ref = dependency.ref;
261
- return [
262
- formatFqn(dependency),
263
- ref.refType === "registry"
264
- ? {
265
- source: "registry",
266
- version: ref.version,
267
- publisherBindingId: ref.publisherBindingId,
268
- integrity: Option.getOrElse(ref.integrity, () => ""),
269
- }
270
- : {
271
- source: "workspace",
272
- version: ref.version,
273
- sourceIdentity: `workspace:${ref.owner}/${toExtensionTypePlural(ref.type)}/${ref.name}`,
274
- contentIdentity: ref.sourceHash,
275
- },
276
- ];
277
- }));
278
- const resolveDependencyGroup = (pack, dependencies, expectedType, sources, minimumReleaseAge, sourceOverride, workspaceResolver, dependencyResolver) => Effect.forEach(dependencies, ([fqn, constraint]) => resolveDependencyRef(pack, expectedType, fqn, constraint, sources, minimumReleaseAge, sourceOverride, workspaceResolver, dependencyResolver), { concurrency: "unbounded" });
279
- /**
280
- * Group dependency FQNs by extension type.
281
- *
282
- * The `groups` record is keyed by every non-pack extension type, so a new type
283
- * fails compile here rather than being silently dropped from pack membership.
284
- */
285
- const partitionDependencies = (dependencies) => {
286
- const groups = {
287
- skill: [],
288
- "mcp-server": [],
289
- subagent: [],
290
- rule: [],
291
- hook: [],
292
- knowledge: [],
293
- };
294
- const unsupported = [];
295
- for (const [fqn, constraint] of Object.entries(dependencies)) {
296
- const parsed = parseFqnOrThrow(fqn);
297
- if (parsed.type === "pack") {
298
- unsupported.push(fqn);
299
- continue;
300
- }
301
- groups[parsed.type].push([fqn, constraint]);
302
- }
303
- return { groups, unsupported };
304
- };
305
- export const resolvePackDependencies = (pack, sources, minimumReleaseAge, sourceOverride, workspaceResolver, dependencyResolver) => Effect.gen(function* () {
306
- const dependencies = partitionDependencies(pack.pack.dependencies);
307
- if (dependencies.unsupported.length > 0) {
308
- return yield* new PackDependencyInvalid({
309
- detail: `Pack declares ${dependencies.unsupported.length} unsupported dependency type${dependencies.unsupported.length === 1 ? "" : "s"}: ${dependencies.unsupported.join(", ")}`,
310
- });
311
- }
312
- const resolveGroup = (type) => resolveDependencyGroup(pack, dependencies.groups[type], type, sources, minimumReleaseAge, sourceOverride, workspaceResolver, dependencyResolver);
313
- const resolvedSkills = yield* resolveGroup("skill");
314
- const resolvedMcpServers = yield* resolveGroup("mcp-server");
315
- const resolvedSubagents = yield* resolveGroup("subagent");
316
- const resolvedRules = yield* resolveGroup("rule");
317
- const resolvedHooks = yield* resolveGroup("hook");
318
- const resolvedKnowledge = yield* resolveGroup("knowledge");
319
- return {
320
- resolvedSkills: toResolvedMap(resolvedSkills),
321
- resolvedMcpServers: toResolvedMap(resolvedMcpServers),
322
- resolvedSubagents: toResolvedMap(resolvedSubagents),
323
- resolvedRules: toResolvedMap(resolvedRules),
324
- resolvedHooks: toResolvedMap(resolvedHooks),
325
- resolvedKnowledge: toResolvedMap(resolvedKnowledge),
326
- dependencyRefs: [
327
- ...resolvedSkills,
328
- ...resolvedMcpServers,
329
- ...resolvedSubagents,
330
- ...resolvedRules,
331
- ...resolvedHooks,
332
- ...resolvedKnowledge,
333
- ].map((dependency) => dependency.ref),
334
- };
335
- });
336
- export const resolvePackDependenciesWithReleaseAge = (pack, sources, evaluation, sourceOverride, workspaceResolver, dependencyResolver) => Effect.gen(function* () {
337
- const packExemption = pack.refType === "registry"
338
- ? releaseAgeExemptionForIdentity(evaluation, {
339
- owner: pack.owner,
340
- type: "pack",
341
- name: pack.pack.name,
342
- })
343
- : undefined;
344
- const dependencyEvaluation = packExemption?.bypassCause === "exclude"
345
- ? { ...evaluation, grantedExemption: packExemption }
346
- : evaluation;
347
- const dependencies = partitionDependencies(pack.pack.dependencies);
348
- if (dependencies.unsupported.length > 0) {
349
- return yield* new PackDependencyInvalid({
350
- detail: `Pack declares ${dependencies.unsupported.length} unsupported dependency type${dependencies.unsupported.length === 1 ? "" : "s"}: ${dependencies.unsupported.join(", ")}`,
351
- });
352
- }
353
- const entries = [
354
- ...dependencies.groups.skill.map(([fqn, constraint]) => ({
355
- type: "skill",
356
- fqn,
357
- constraint,
358
- })),
359
- ...dependencies.groups["mcp-server"].map(([fqn, constraint]) => ({
360
- type: "mcp-server",
361
- fqn,
362
- constraint,
363
- })),
364
- ...dependencies.groups.subagent.map(([fqn, constraint]) => ({
365
- type: "subagent",
366
- fqn,
367
- constraint,
368
- })),
369
- ...dependencies.groups.rule.map(([fqn, constraint]) => ({
370
- type: "rule",
371
- fqn,
372
- constraint,
373
- })),
374
- ...dependencies.groups.hook.map(([fqn, constraint]) => ({
375
- type: "hook",
376
- fqn,
377
- constraint,
378
- })),
379
- ...dependencies.groups.knowledge.map(([fqn, constraint]) => ({
380
- type: "knowledge",
381
- fqn,
382
- constraint,
383
- })),
384
- ];
385
- const resolutions = yield* Effect.forEach(entries, ({ type, fqn, constraint }) => resolveDependencyRefWithReleaseAge(pack, type, fqn, constraint, sources, dependencyEvaluation, sourceOverride, workspaceResolver, dependencyResolver), { concurrency: "unbounded" });
386
- const holdbacks = resolutions.flatMap((resolution) => resolution.kind === "policy_held" ? [resolution.holdback] : resolution.holdbacks);
387
- const bypasses = resolutions.flatMap((resolution) => resolution.kind === "selected" ? resolution.bypasses : []);
388
- if (resolutions.some((resolution) => resolution.kind === "policy_held")) {
389
- return { kind: "policy_held", holdbacks, bypasses };
390
- }
391
- const selected = resolutions.flatMap((resolution) => resolution.kind === "selected" ? [resolution.dependency] : []);
392
- const byType = (type) => selected.filter((dependency) => dependency.type === type);
393
- const resolvedSkills = byType("skill");
394
- const resolvedMcpServers = byType("mcp-server");
395
- const resolvedSubagents = byType("subagent");
396
- const resolvedRules = byType("rule");
397
- const resolvedHooks = byType("hook");
398
- const resolvedKnowledge = byType("knowledge");
399
- return {
400
- kind: "selected",
401
- holdbacks,
402
- bypasses,
403
- dependencies: {
404
- resolvedSkills: toResolvedMap(resolvedSkills),
405
- resolvedMcpServers: toResolvedMap(resolvedMcpServers),
406
- resolvedSubagents: toResolvedMap(resolvedSubagents),
407
- resolvedRules: toResolvedMap(resolvedRules),
408
- resolvedHooks: toResolvedMap(resolvedHooks),
409
- resolvedKnowledge: toResolvedMap(resolvedKnowledge),
410
- dependencyRefs: selected.map((dependency) => dependency.ref),
411
- },
412
- };
413
- });
414
- //# sourceMappingURL=dependency-resolution.js.map
@@ -1,16 +0,0 @@
1
- /**
2
- * Pack manager service.
3
- *
4
- * Implements ExtensionManager<PackRef>. Delegates to existing
5
- * pack materialization functions and workspace service methods.
6
- *
7
- * @experimental This API is unstable and may change without notice.
8
- */
9
- import * as FileSystem from "effect/FileSystem";
10
- import * as Path from "effect/Path";
11
- import * as Layer from "effect/Layer";
12
- import { SourceHostProviders } from "@agentxm/extension-sources";
13
- import { PackManager } from "@agentxm/extension-workspace";
14
- import { WorkspaceMutations } from "@agentxm/workspace-state";
15
- export declare const PackManagerLive: Layer.Layer<PackManager, never, SourceHostProviders | WorkspaceMutations | FileSystem.FileSystem | Path.Path>;
16
- //# sourceMappingURL=manager.d.ts.map
@@ -1,181 +0,0 @@
1
- /**
2
- * Pack manager service.
3
- *
4
- * Implements ExtensionManager<PackRef>. Delegates to existing
5
- * pack materialization functions and workspace service methods.
6
- *
7
- * @experimental This API is unstable and may change without notice.
8
- */
9
- import * as FileSystem from "effect/FileSystem";
10
- import * as Path from "effect/Path";
11
- import * as Effect from "effect/Effect";
12
- import * as Layer from "effect/Layer";
13
- import * as Option from "effect/Option";
14
- import { PackArchiveFetchFailed, PackDefinitionInvalid, PackInstallStateMissing, PackStagingFailed, } from "@agentxm/extension-workspace";
15
- import { canReuseInstalledPackage, replaceCanonicalDirectoryWithInspection, } from "@agentxm/extension-workspace";
16
- import { configuredPacksToDiskRefs } from "@agentxm/extension-workspace";
17
- import { SourceHostProviders } from "@agentxm/extension-sources";
18
- import { PackManager } from "@agentxm/extension-workspace";
19
- import { WorkspaceMutations } from "@agentxm/workspace-state";
20
- import { copyExtensionDirectory } from "@agentxm/extension-workspace";
21
- import { computePackPathsForLayout } from "@agentxm/workspace-state";
22
- import { removeIfExists } from "@agentxm/workspace-state";
23
- import { acceptedRegistryVersionForRef, validateExactResolvedVersion, } from "@agentxm/workspace-state";
24
- import { decodeVersionSync } from "@agentxm/extension-model/unstable/version-constraints";
25
- import { configuredRowsByName } from "@agentxm/workspace-state";
26
- import { isObservedInstalled } from "@agentxm/workspace-state";
27
- import { acceptedCanonicalObservation, prepareAcceptedCanonicalTransition, removableAcceptedCanonicalPath, } from "@agentxm/workspace-state";
28
- import { computePackManifestContentIdentity } from "@agentxm/workspace-state";
29
- import { computeMaterializedTreeIntegrity, } from "@agentxm/workspace-state";
30
- // Build pack SetPackArgs from a registry ref
31
- const buildSetPackArgs = (ref, versionRange, treeIntegrity) => ({
32
- type: "registry",
33
- sourceType: "registry",
34
- packageFormat: "agentxm",
35
- endpoint: ref.source.location,
36
- extensionType: "pack",
37
- workspaceName: ref.pack.name,
38
- owner: ref.owner,
39
- name: ref.pack.name,
40
- resolvedVersion: decodeVersionSync(ref.version),
41
- integrity: Option.getOrElse(ref.integrity, () => ""),
42
- sourceName: ref.source.name,
43
- publisherBindingId: ref.publisherBindingId,
44
- treeIntegrity,
45
- manifestContentIdentity: computePackManifestContentIdentity({
46
- owner: ref.owner,
47
- type: "pack",
48
- name: ref.pack.name,
49
- version: ref.version,
50
- dependencies: ref.pack.dependencies,
51
- }),
52
- versionRange,
53
- });
54
- // -----------------------------------------------------------------------------
55
- // Live Layer
56
- // -----------------------------------------------------------------------------
57
- export const PackManagerLive = Layer.effect(PackManager, Effect.gen(function* () {
58
- const ws = yield* WorkspaceMutations;
59
- const fs = yield* FileSystem.FileSystem;
60
- const path = yield* Path.Path;
61
- const sources = yield* SourceHostProviders;
62
- const baseDir = ws.baseDir;
63
- // Build a layer to provide FileSystem + Path to inner effects
64
- const fsPathLayer = Layer.merge(Layer.succeed(FileSystem.FileSystem, fs), Layer.succeed(Path.Path, path));
65
- const provide = (effect) => Effect.provide(effect, fsPathLayer);
66
- const lastTreeIntegrities = new Map();
67
- const materializeInstall = Effect.fn("PackManager.materializeInstall")(function* ({ ref, force }) {
68
- if (ref.refType === "registry") {
69
- yield* validateExactResolvedVersion(`packs.${ref.pack.name}.resolvedVersion`, ref.version);
70
- }
71
- const packDir = computePackPathsForLayout(path.join, ws.layout, ref.refType === "workspace" ? "workspace" : ref.source.name, ref.owner, ref.pack.name).canonicalPath;
72
- const canonicalExists = yield* fs.exists(packDir).pipe(Effect.orElseSucceed(() => false));
73
- if (ref.refType === "workspace") {
74
- if (ref.scope !== ws.scope || path.resolve(ref.location) !== path.resolve(packDir)) {
75
- return yield* new PackDefinitionInvalid({
76
- detail: `Invalid workspace pack source location: ${ref.location}`,
77
- });
78
- }
79
- if (!canonicalExists) {
80
- return yield* new PackDefinitionInvalid({
81
- detail: `Workspace pack package is missing: ${packDir}`,
82
- });
83
- }
84
- return;
85
- }
86
- const lockedEntry = yield* ws.getLockedPack(ref.pack.name);
87
- const lockedVersion = acceptedRegistryVersionForRef(lockedEntry, ref);
88
- if (yield* provide(canReuseInstalledPackage({
89
- installedPath: packDir,
90
- force: force === true,
91
- refVersion: ref.version,
92
- hasIntegrity: Option.isSome(ref.integrity),
93
- ...(lockedVersion === undefined ? {} : { lockedVersion }),
94
- existsFailureDetail: (target) => `Failed to check if canonical pack path exists: ${target}`,
95
- }))) {
96
- if (Option.isSome(lockedEntry)) {
97
- const observedTree = yield* provide(computeMaterializedTreeIntegrity(packDir));
98
- if (observedTree === lockedEntry.value.treeIntegrity) {
99
- lastTreeIntegrities.set(ref.pack.name, lockedEntry.value.treeIntegrity);
100
- return;
101
- }
102
- }
103
- }
104
- yield* Effect.scoped(Effect.gen(function* () {
105
- const fetched = yield* sources
106
- .fetch(ref)
107
- .pipe(Effect.mapError((e) => new PackArchiveFetchFailed({ message: e.message, cause: e })));
108
- const materialized = yield* provide(replaceCanonicalDirectoryWithInspection({
109
- baseDir,
110
- canonicalPath: packDir,
111
- populate: (stagingPath) => copyExtensionDirectory(fetched.directory, stagingPath).pipe(Effect.mapError((cause) => new PackStagingFailed({ packDir, cause }))),
112
- inspect: computeMaterializedTreeIntegrity,
113
- }));
114
- lastTreeIntegrities.set(ref.pack.name, materialized.inspection);
115
- }));
116
- });
117
- const materializeUninstall = Effect.fn("PackManager.materializeUninstall")(function* ({ target }) {
118
- const canonical = yield* provide(acceptedCanonicalObservation({ workspace: ws, type: "pack", name: target.name }));
119
- const packDir = removableAcceptedCanonicalPath(canonical);
120
- if (Option.isSome(packDir))
121
- yield* removeIfExists(fs, packDir.value);
122
- });
123
- const materializeDeactivate = () => Effect.void;
124
- const buildCurrentPackArgs = (ref, versionRange) => Effect.gen(function* () {
125
- if (ref.refType !== "registry")
126
- return Option.none();
127
- const treeIntegrity = lastTreeIntegrities.get(ref.pack.name);
128
- if (treeIntegrity === undefined) {
129
- return yield* new PackInstallStateMissing({ name: ref.pack.name });
130
- }
131
- return Option.some(buildSetPackArgs(ref, versionRange, treeIntegrity));
132
- });
133
- return {
134
- type: "pack",
135
- runTransaction: ws.runTransaction,
136
- isInstalled: Effect.fn("PackManager.isInstalled")(function* ({ target, }) {
137
- return yield* isObservedInstalled(ws, "pack", target.name);
138
- }),
139
- materializeInstall,
140
- prepareSourceTransition: ({ ref }) => provide(prepareAcceptedCanonicalTransition({
141
- workspace: ws,
142
- type: "pack",
143
- name: ref.pack.name,
144
- ref,
145
- })),
146
- getConfiguredSource: Effect.fn("PackManager.getConfiguredSource")(function* ({ target }) {
147
- const configured = yield* ws.getConfiguredPackEntries();
148
- return Option.fromUndefinedOr(configured[target.name]?.source);
149
- }),
150
- listMaterializable: Effect.fn("PackManager.listMaterializable")(function* () {
151
- const configured = yield* ws.records.rows("pack").pipe(Effect.map(configuredRowsByName));
152
- return yield* configuredPacksToDiskRefs({ fs, path, baseDir, scope: ws.scope, layout: ws.layout }, configured);
153
- }),
154
- materializeUninstall,
155
- materializeDeactivate,
156
- upsertSettingsEntry: Effect.fn("PackManager.upsertSettingsEntry")(function* ({ ref, versionRange, }) {
157
- const args = yield* buildCurrentPackArgs(ref, versionRange);
158
- if (Option.isSome(args)) {
159
- yield* ws.setPack(args.value);
160
- }
161
- else {
162
- yield* ws.setPackEntry(ref.pack.name, {
163
- source: "workspace",
164
- enabled: true,
165
- });
166
- }
167
- }),
168
- removeSettingsEntry: ({ target }) => ws.removePackSettings(target.name).pipe(Effect.withSpan("PackManager.removeSettingsEntry")),
169
- upsertLockfileEntry: Effect.fn("PackManager.upsertLockfileEntry")(function* ({ ref }) {
170
- const args = yield* buildCurrentPackArgs(ref, Option.none());
171
- if (Option.isSome(args)) {
172
- yield* ws.setPackLock(args.value);
173
- }
174
- else {
175
- yield* ws.removePackLock(ref.pack.name);
176
- }
177
- }),
178
- removeLockfileEntry: ({ target }) => ws.removePackLock(target.name).pipe(Effect.withSpan("PackManager.removeLockfileEntry")),
179
- };
180
- }));
181
- //# sourceMappingURL=manager.js.map
@@ -1,52 +0,0 @@
1
- /**
2
- * Registry-backed canonical package materialization.
3
- *
4
- * The canonical-directory staging/swap machinery lives in
5
- * `@agentxm/extension-workspace`; this module owns only the registry
6
- * fetch/verify/extract path.
7
- *
8
- * @experimental This API is unstable and may change without notice.
9
- */
10
- import * as Effect from "effect/Effect";
11
- import * as FileSystem from "effect/FileSystem";
12
- import * as Option from "effect/Option";
13
- import * as Path from "effect/Path";
14
- import * as HttpClient from "effect/unstable/http/HttpClient";
15
- import type { Version, VersionRange } from "@agentxm/extension-model/unstable/version-constraints";
16
- import type { ExtensionName, ExtensionType } from "@agentxm/extension-model/unstable/extensions/common";
17
- import type { Handle } from "@agentxm/extension-model/unstable/extensions/handle";
18
- import { ArchiveIntegrityMismatch, type CanonicalDirectoryReplacementError, type MaterializedPackage } from "@agentxm/extension-workspace";
19
- import { CoupledDependencyFailure } from "@agentxm/extension-workspace";
20
- import { type MaterializedTreeInvalid } from "@agentxm/workspace-state";
21
- export interface RegistryPackageMaterializationMessages {
22
- readonly integrityMismatchDetail: string;
23
- }
24
- export interface MaterializeRegistryPackageArgs<E = never> {
25
- readonly baseDir: string;
26
- /**
27
- * Canonical installed path for this extension. Bytes always land in a sibling
28
- * staging directory first and are swapped in after validation.
29
- */
30
- readonly destinationPath: string;
31
- readonly sourceLocation: URL;
32
- readonly owner: Handle;
33
- readonly type: ExtensionType;
34
- readonly name: ExtensionName;
35
- readonly version: Version | VersionRange;
36
- readonly integrity: Option.Option<string>;
37
- readonly messages: RegistryPackageMaterializationMessages;
38
- readonly validate?: (stagingPath: string) => Effect.Effect<void, E, FileSystem.FileSystem | Path.Path>;
39
- }
40
- /**
41
- * Fetch, verify, and extract a registry package into `destinationPath`.
42
- *
43
- * Always writes. Whether new bytes are needed at all is
44
- * `canReuseInstalledPackage`'s decision, which the caller makes against the
45
- * canonical installed path before choosing a destination.
46
- *
47
- * Registry client and archive-extraction failures travel opaquely as coupled
48
- * dependency failures; the application boundary restores and converts them.
49
- */
50
- export declare const materializeRegistryPackageWithTreeIntegrity: <E = never>(args: MaterializeRegistryPackageArgs<E>) => Effect.Effect<MaterializedPackage, E | CoupledDependencyFailure | ArchiveIntegrityMismatch | CanonicalDirectoryReplacementError | MaterializedTreeInvalid, FileSystem.FileSystem | HttpClient.HttpClient | Path.Path>;
51
- export declare const materializeRegistryPackage: <E = never>(args: MaterializeRegistryPackageArgs<E>) => Effect.Effect<string, CoupledDependencyFailure | ArchiveIntegrityMismatch | CanonicalDirectoryReplacementError | MaterializedTreeInvalid | E, FileSystem.FileSystem | HttpClient.HttpClient | Path.Path>;
52
- //# sourceMappingURL=registry-materialization.d.ts.map