@agentxm/extension-lifecycle 0.28.12 → 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.
- package/dist/src/activation/display-paths.d.ts +25 -0
- package/dist/src/activation/display-paths.js +25 -0
- package/dist/src/activation/errors.d.ts +16 -0
- package/dist/src/activation/errors.js +7 -0
- package/dist/src/activation/set-activation.d.ts +134 -0
- package/dist/src/activation/set-activation.js +772 -0
- package/dist/src/demote/demote-to-external-source.d.ts +82 -0
- package/dist/src/demote/demote-to-external-source.js +233 -0
- package/dist/src/errors.d.ts +0 -8
- package/dist/src/errors.js +0 -8
- package/dist/src/glob.d.ts +35 -0
- package/dist/src/glob.js +75 -0
- package/dist/src/hooks/configured-agent-outcomes-provider.d.ts +7 -3
- package/dist/src/hooks/configured-agent-outcomes-provider.js +11 -4
- package/dist/src/hooks/install/plan.d.ts +45 -0
- package/dist/src/hooks/install/plan.js +224 -0
- package/dist/src/hooks/uninstall/plan.d.ts +20 -0
- package/dist/src/hooks/uninstall/plan.js +77 -0
- package/dist/src/index.d.ts +48 -16
- package/dist/src/index.js +60 -17
- package/dist/src/install/aggregate-projection-step.d.ts +16 -0
- package/dist/src/install/aggregate-projection-step.js +49 -0
- package/dist/src/install/configured.d.ts +65 -0
- package/dist/src/install/configured.js +406 -0
- package/dist/src/install/inline-mcp-operation.d.ts +4 -0
- package/dist/src/install/inline-mcp-operation.js +25 -0
- package/dist/src/install/install-extensions.d.ts +110 -0
- package/dist/src/install/install-extensions.js +282 -0
- package/dist/src/install/per-type-install.d.ts +12 -0
- package/dist/src/install/per-type-install.js +12 -0
- package/dist/src/install/registry-install-target.d.ts +35 -0
- package/dist/src/install/registry-install-target.js +66 -0
- package/dist/src/install/registry-login-suggestion.d.ts +21 -0
- package/dist/src/install/registry-login-suggestion.js +34 -0
- package/dist/src/install/registry-source-resolution.d.ts +54 -0
- package/dist/src/install/registry-source-resolution.js +216 -0
- package/dist/src/install/root-intent.d.ts +19 -0
- package/dist/src/install/root-intent.js +122 -0
- package/dist/src/install/selection-interaction.d.ts +46 -0
- package/dist/src/install/selection-interaction.js +22 -0
- package/dist/src/install/vocabulary.d.ts +143 -0
- package/dist/src/install/vocabulary.js +29 -0
- package/dist/src/knowledge/install/plan.d.ts +35 -0
- package/dist/src/knowledge/install/plan.js +128 -0
- package/dist/src/knowledge/uninstall/plan.d.ts +23 -0
- package/dist/src/knowledge/uninstall/plan.js +140 -0
- package/dist/src/live.d.ts +4 -11
- package/dist/src/live.js +4 -11
- package/dist/src/mcps/install/plan.d.ts +65 -0
- package/dist/src/mcps/install/plan.js +301 -0
- package/dist/src/mcps/operations/disable.d.ts +5 -3
- package/dist/src/mcps/operations/disable.js +6 -4
- package/dist/src/mcps/operations/enable.d.ts +5 -3
- package/dist/src/mcps/operations/enable.js +8 -6
- package/dist/src/mcps/operations/sync-outcome.d.ts +1 -1
- package/dist/src/mcps/operations/uninstall.d.ts +5 -3
- package/dist/src/mcps/operations/uninstall.js +4 -4
- package/dist/src/mcps/uninstall/plan.d.ts +24 -0
- package/dist/src/mcps/uninstall/plan.js +109 -0
- package/dist/src/packs/artifact.d.ts +21 -0
- package/dist/src/packs/artifact.js +32 -0
- package/dist/src/packs/constraint-gate.d.ts +30 -0
- package/dist/src/packs/constraint-gate.js +76 -0
- package/dist/src/packs/expansion.d.ts +13 -14
- package/dist/src/packs/expansion.js +1 -2
- package/dist/src/packs/graph-transition.d.ts +64 -0
- package/dist/src/packs/graph-transition.js +219 -0
- package/dist/src/packs/install/plan.d.ts +95 -0
- package/dist/src/packs/install/plan.js +845 -0
- package/dist/src/packs/member-install-step.d.ts +29 -0
- package/dist/src/packs/member-install-step.js +156 -0
- package/dist/src/packs/operations/install.d.ts +3 -3
- package/dist/src/packs/operations/install.js +5 -5
- package/dist/src/packs/promote-authored-pack.d.ts +86 -0
- package/dist/src/packs/promote-authored-pack.js +239 -0
- package/dist/src/packs/resolved-dependency.d.ts +9 -26
- package/dist/src/packs/resolved-dependency.js +8 -20
- package/dist/src/packs/uninstall/plan.d.ts +66 -0
- package/dist/src/packs/uninstall/plan.js +344 -0
- package/dist/src/packs/uninstall/readiness.d.ts +50 -0
- package/dist/src/packs/uninstall/readiness.js +130 -0
- package/dist/src/publisher-binding.d.ts +8 -40
- package/dist/src/publisher-binding.js +8 -46
- package/dist/src/rules/install/plan.d.ts +35 -0
- package/dist/src/rules/install/plan.js +133 -0
- package/dist/src/rules/uninstall/plan.d.ts +19 -0
- package/dist/src/rules/uninstall/plan.js +54 -0
- package/dist/src/skills/install/bundled.d.ts +73 -0
- package/dist/src/skills/install/bundled.js +244 -0
- package/dist/src/skills/install/plan.d.ts +72 -0
- package/dist/src/skills/install/plan.js +429 -0
- package/dist/src/skills/install/selection.d.ts +26 -0
- package/dist/src/skills/install/selection.js +41 -0
- package/dist/src/skills/install/source.d.ts +21 -0
- package/dist/src/skills/install/source.js +76 -0
- package/dist/src/skills/operations/disable.d.ts +3 -2
- package/dist/src/skills/operations/disable.js +7 -11
- package/dist/src/skills/operations/enable.d.ts +3 -2
- package/dist/src/skills/operations/enable.js +6 -8
- package/dist/src/skills/operations/install.d.ts +4 -4
- package/dist/src/skills/operations/install.js +13 -12
- package/dist/src/skills/uninstall/plan.d.ts +23 -0
- package/dist/src/skills/uninstall/plan.js +165 -0
- package/dist/src/skills/utils.js +1 -1
- package/dist/src/step-failure-conversion.d.ts +44 -0
- package/dist/src/step-failure-conversion.js +26 -0
- package/dist/src/step-failure.d.ts +29 -0
- package/dist/src/step-failure.js +130 -0
- package/dist/src/subagents/install/plan.d.ts +49 -0
- package/dist/src/subagents/install/plan.js +270 -0
- package/dist/src/subagents/install/selection.d.ts +26 -0
- package/dist/src/subagents/install/selection.js +37 -0
- package/dist/src/subagents/install/source.d.ts +18 -0
- package/dist/src/subagents/install/source.js +72 -0
- package/dist/src/subagents/operations/disable.d.ts +5 -3
- package/dist/src/subagents/operations/disable.js +5 -3
- package/dist/src/subagents/operations/enable.d.ts +5 -3
- package/dist/src/subagents/operations/enable.js +17 -12
- package/dist/src/subagents/uninstall/plan.d.ts +20 -0
- package/dist/src/subagents/uninstall/plan.js +142 -0
- package/dist/src/test-packages.d.ts +34 -0
- package/dist/src/test-packages.js +111 -0
- package/dist/src/test-registry.d.ts +78 -0
- package/dist/src/test-registry.js +223 -0
- package/dist/src/testing.d.ts +108 -0
- package/dist/src/testing.js +241 -0
- package/dist/src/uninstall/retention-policy.d.ts +21 -0
- package/dist/src/uninstall/retention-policy.js +28 -0
- package/dist/src/uninstall/root-intent.d.ts +17 -0
- package/dist/src/uninstall/root-intent.js +101 -0
- package/dist/src/uninstall/uninstall-extensions.d.ts +61 -0
- package/dist/src/uninstall/uninstall-extensions.js +127 -0
- package/dist/src/uninstall/vocabulary.d.ts +40 -0
- package/dist/src/uninstall/vocabulary.js +14 -0
- package/dist/src/update/atomicity.d.ts +22 -0
- package/dist/src/update/atomicity.js +23 -0
- package/dist/src/update/blockers.d.ts +31 -0
- package/dist/src/update/blockers.js +78 -0
- package/dist/src/update/configured.d.ts +78 -0
- package/dist/src/update/configured.js +546 -0
- package/dist/src/update/root-request.d.ts +39 -0
- package/dist/src/update/root-request.js +117 -0
- package/dist/src/update/selective/plan.d.ts +45 -0
- package/dist/src/update/selective/plan.js +61 -0
- package/dist/src/update/selective/requirements.d.ts +17 -0
- package/dist/src/update/selective/requirements.js +14 -0
- package/dist/src/update/selective/selection.d.ts +63 -0
- package/dist/src/update/selective/selection.js +85 -0
- package/dist/src/update/selective/skills.d.ts +55 -0
- package/dist/src/update/selective/skills.js +596 -0
- package/dist/src/update/selective/subagents.d.ts +52 -0
- package/dist/src/update/selective/subagents.js +331 -0
- package/dist/src/update/selective/use-case.d.ts +121 -0
- package/dist/src/update/selective/use-case.js +28 -0
- package/dist/src/update/selective/vocabulary.d.ts +43 -0
- package/dist/src/update/selective/vocabulary.js +28 -0
- package/dist/src/update/selector.d.ts +72 -0
- package/dist/src/update/selector.js +120 -0
- package/dist/src/update/targeted-plan.d.ts +30 -0
- package/dist/src/update/targeted-plan.js +113 -0
- package/dist/src/update/update-extensions.d.ts +164 -0
- package/dist/src/update/update-extensions.js +579 -0
- package/dist/src/workspace-paths.d.ts +31 -0
- package/dist/src/workspace-paths.js +46 -0
- package/package.json +22 -12
- package/dist/src/configured-entry-resolution.d.ts +0 -111
- package/dist/src/configured-entry-resolution.js +0 -731
- package/dist/src/failure-adapter.d.ts +0 -35
- package/dist/src/failure-adapter.js +0 -23
- package/dist/src/hooks/manager.d.ts +0 -15
- package/dist/src/hooks/manager.js +0 -769
- package/dist/src/internal/fs-helpers.d.ts +0 -12
- package/dist/src/internal/fs-helpers.js +0 -13
- package/dist/src/internal/integrity.d.ts +0 -13
- package/dist/src/internal/integrity.js +0 -17
- package/dist/src/knowledge/manager.d.ts +0 -11
- package/dist/src/knowledge/manager.js +0 -711
- package/dist/src/mcps/manager.d.ts +0 -16
- package/dist/src/mcps/manager.js +0 -247
- package/dist/src/mcps/operations/artifact.d.ts +0 -24
- package/dist/src/mcps/operations/artifact.js +0 -74
- package/dist/src/mcps/operations/install.d.ts +0 -78
- package/dist/src/mcps/operations/install.js +0 -596
- package/dist/src/packs/dependency-resolution.d.ts +0 -65
- package/dist/src/packs/dependency-resolution.js +0 -414
- package/dist/src/packs/manager.d.ts +0 -16
- package/dist/src/packs/manager.js +0 -181
- package/dist/src/registry-materialization.d.ts +0 -52
- package/dist/src/registry-materialization.js +0 -72
- package/dist/src/release-age-posture.d.ts +0 -23
- package/dist/src/release-age-posture.js +0 -15
- package/dist/src/resolution-timeout.d.ts +0 -5
- package/dist/src/resolution-timeout.js +0 -11
- package/dist/src/rules/manager.d.ts +0 -20
- package/dist/src/rules/manager.js +0 -480
- package/dist/src/skills/manager.d.ts +0 -18
- package/dist/src/skills/manager.js +0 -346
- package/dist/src/skills/materialization.d.ts +0 -54
- package/dist/src/skills/materialization.js +0 -158
- package/dist/src/skills/operations/source-hash.d.ts +0 -2
- package/dist/src/skills/operations/source-hash.js +0 -6
- package/dist/src/subagents/manager.d.ts +0 -18
- package/dist/src/subagents/manager.js +0 -722
- package/dist/src/workflows/install-command/workflow.d.ts +0 -56
- package/dist/src/workflows/install-command/workflow.js +0 -46
- package/dist/src/workflows/uninstall-command/workflow.d.ts +0 -42
- package/dist/src/workflows/uninstall-command/workflow.js +0 -29
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One member of a pack graph transition.
|
|
3
|
+
*
|
|
4
|
+
* A member is acquired without writing its own settings entry — the pack's
|
|
5
|
+
* dependency map already declares it — and without validating its observable
|
|
6
|
+
* projection on its own, because the enclosing transition renders every
|
|
7
|
+
* shared aggregate once at the end.
|
|
8
|
+
*
|
|
9
|
+
* @experimental This API is unstable and may change without notice.
|
|
10
|
+
*/
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
12
|
+
import { HookManager, KnowledgeManager, RuleManager, SkillManager, SubagentManager } from "@agentxm/extension-materialization";
|
|
13
|
+
import type { HookExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/hook";
|
|
14
|
+
import type { KnowledgeExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/knowledge";
|
|
15
|
+
import type { McpServerExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/mcp-server";
|
|
16
|
+
import type { RuleExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/rule";
|
|
17
|
+
import type { SkillExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/skill";
|
|
18
|
+
import type { SubagentExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/subagent";
|
|
19
|
+
import type { PlannedJobStep } from "@agentxm/workspace-operations";
|
|
20
|
+
import { WorkspaceMutations } from "@agentxm/workspace-state";
|
|
21
|
+
import type { InstallStepRequirements } from "../install/vocabulary.js";
|
|
22
|
+
export type PackMemberRef = SkillExtensionRef | McpServerExtensionRef | SubagentExtensionRef | RuleExtensionRef | HookExtensionRef | KnowledgeExtensionRef;
|
|
23
|
+
/** Build the install closure for one pack member. */
|
|
24
|
+
export declare const buildPackMemberInstallStep: (args: {
|
|
25
|
+
readonly ref: PackMemberRef;
|
|
26
|
+
readonly graphComplete: boolean;
|
|
27
|
+
readonly nonInteractive: boolean;
|
|
28
|
+
}) => Effect.Effect<PlannedJobStep<InstallStepRequirements>, never, HookManager | KnowledgeManager | RuleManager | SkillManager | SubagentManager | WorkspaceMutations>;
|
|
29
|
+
//# sourceMappingURL=member-install-step.d.ts.map
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One member of a pack graph transition.
|
|
3
|
+
*
|
|
4
|
+
* A member is acquired without writing its own settings entry — the pack's
|
|
5
|
+
* dependency map already declares it — and without validating its observable
|
|
6
|
+
* projection on its own, because the enclosing transition renders every
|
|
7
|
+
* shared aggregate once at the end.
|
|
8
|
+
*
|
|
9
|
+
* @experimental This API is unstable and may change without notice.
|
|
10
|
+
*/
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
12
|
+
import * as Option from "effect/Option";
|
|
13
|
+
import { HookManager, KnowledgeManager, NO_MATERIALIZATION_OBSERVATION, RuleManager, SkillManager, SubagentManager, buildInstallOperation, extensionRefLifecycleWarnings, extensionRefRegistryLifecycle, installMcpServer, toLabelWithCompanions, } from "@agentxm/extension-materialization";
|
|
14
|
+
import { WorkspaceMutations } from "@agentxm/workspace-state";
|
|
15
|
+
import { lifecycleStepFailure } from "../step-failure.js";
|
|
16
|
+
import { registrySourceArtifact } from "./artifact.js";
|
|
17
|
+
const registrySourceArtifactWithCoverage = (args) => Effect.gen(function* () {
|
|
18
|
+
const artifact = registrySourceArtifact(args);
|
|
19
|
+
const materialization = yield* args.materialization;
|
|
20
|
+
return { ...artifact, agents: materialization.agents };
|
|
21
|
+
});
|
|
22
|
+
/** Build the install closure for one pack member. */
|
|
23
|
+
export const buildPackMemberInstallStep = Effect.fn("InstallExtensions.buildPackMemberInstallStep")(function* (args) {
|
|
24
|
+
const ws = yield* WorkspaceMutations;
|
|
25
|
+
const ref = args.ref;
|
|
26
|
+
if (ref.type === "skill") {
|
|
27
|
+
const skillManager = yield* SkillManager;
|
|
28
|
+
return buildInstallOperation(skillManager, {
|
|
29
|
+
toStepFailure: lifecycleStepFailure,
|
|
30
|
+
ref,
|
|
31
|
+
versionRange: Option.none(),
|
|
32
|
+
skipSettings: true,
|
|
33
|
+
deferObservableValidation: true,
|
|
34
|
+
installedBefore: args.graphComplete
|
|
35
|
+
? skillManager.isInstalled({ target: { type: "skill", name: ref.skill.name } })
|
|
36
|
+
: Effect.succeed(false),
|
|
37
|
+
buildArtifact: ({ installedBefore, materialization }) => registrySourceArtifactWithCoverage({
|
|
38
|
+
ref,
|
|
39
|
+
scope: ws.scope,
|
|
40
|
+
installedBefore,
|
|
41
|
+
materialization: Effect.succeed(Option.match(materialization, {
|
|
42
|
+
onNone: () => NO_MATERIALIZATION_OBSERVATION,
|
|
43
|
+
onSome: (facts) => facts.observation,
|
|
44
|
+
})),
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (ref.type === "mcp-server") {
|
|
49
|
+
const base = {
|
|
50
|
+
key: `mcp-server:${ref.server.name}`,
|
|
51
|
+
label: toLabelWithCompanions({ type: "mcp-server", name: ref.server.name }, ref.refType === "registry" ? ref.packages : []),
|
|
52
|
+
run: installMcpServer({
|
|
53
|
+
name: "install-mcp-server",
|
|
54
|
+
args: {
|
|
55
|
+
ref,
|
|
56
|
+
nonInteractive: args.nonInteractive,
|
|
57
|
+
force: false,
|
|
58
|
+
versionRange: Option.none(),
|
|
59
|
+
skipSettings: Option.some(true),
|
|
60
|
+
strictAgentSync: Option.some(true),
|
|
61
|
+
env: Option.none(),
|
|
62
|
+
},
|
|
63
|
+
}).pipe(Effect.mapError(lifecycleStepFailure)),
|
|
64
|
+
};
|
|
65
|
+
const warnings = extensionRefLifecycleWarnings(ref);
|
|
66
|
+
const registryLifecycle = extensionRefRegistryLifecycle(ref);
|
|
67
|
+
return warnings.length === 0
|
|
68
|
+
? {
|
|
69
|
+
...base,
|
|
70
|
+
readiness: "ready",
|
|
71
|
+
...(registryLifecycle === undefined ? {} : { registryLifecycle }),
|
|
72
|
+
}
|
|
73
|
+
: {
|
|
74
|
+
...base,
|
|
75
|
+
readiness: "warn",
|
|
76
|
+
warnMessage: warnings.join("; "),
|
|
77
|
+
...(registryLifecycle === undefined ? {} : { registryLifecycle }),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
if (ref.type === "subagent") {
|
|
81
|
+
const subagentManager = yield* SubagentManager;
|
|
82
|
+
return buildInstallOperation(subagentManager, {
|
|
83
|
+
toStepFailure: lifecycleStepFailure,
|
|
84
|
+
ref,
|
|
85
|
+
versionRange: Option.none(),
|
|
86
|
+
skipSettings: true,
|
|
87
|
+
deferObservableValidation: true,
|
|
88
|
+
installedBefore: args.graphComplete
|
|
89
|
+
? subagentManager.isInstalled({ target: { type: "subagent", name: ref.subagent.name } })
|
|
90
|
+
: Effect.succeed(false),
|
|
91
|
+
buildArtifact: ({ installedBefore, materialization }) => registrySourceArtifactWithCoverage({
|
|
92
|
+
ref,
|
|
93
|
+
scope: ws.scope,
|
|
94
|
+
installedBefore,
|
|
95
|
+
materialization: Effect.succeed(Option.match(materialization, {
|
|
96
|
+
onNone: () => NO_MATERIALIZATION_OBSERVATION,
|
|
97
|
+
onSome: (facts) => facts.observation,
|
|
98
|
+
})),
|
|
99
|
+
}),
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
if (ref.type === "rule") {
|
|
103
|
+
const ruleManager = yield* RuleManager;
|
|
104
|
+
return buildInstallOperation(ruleManager, {
|
|
105
|
+
toStepFailure: lifecycleStepFailure,
|
|
106
|
+
ref,
|
|
107
|
+
versionRange: Option.none(),
|
|
108
|
+
skipSettings: true,
|
|
109
|
+
skipProjections: true,
|
|
110
|
+
deferObservableValidation: true,
|
|
111
|
+
installedBefore: args.graphComplete
|
|
112
|
+
? ruleManager.isInstalled({ target: { type: "rule", name: ref.rule.name } })
|
|
113
|
+
: Effect.succeed(false),
|
|
114
|
+
buildArtifact: ({ installedBefore }) => registrySourceArtifactWithCoverage({
|
|
115
|
+
ref,
|
|
116
|
+
scope: ws.scope,
|
|
117
|
+
installedBefore,
|
|
118
|
+
materialization: ruleManager.aggregateProjectionObservation,
|
|
119
|
+
}),
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
if (ref.type === "hook") {
|
|
123
|
+
const hookManager = yield* HookManager;
|
|
124
|
+
return buildInstallOperation(hookManager, {
|
|
125
|
+
toStepFailure: lifecycleStepFailure,
|
|
126
|
+
ref,
|
|
127
|
+
versionRange: Option.none(),
|
|
128
|
+
skipSettings: true,
|
|
129
|
+
skipProjections: true,
|
|
130
|
+
deferObservableValidation: true,
|
|
131
|
+
installedBefore: args.graphComplete
|
|
132
|
+
? hookManager.isInstalled({ target: { type: "hook", name: ref.hook.name } })
|
|
133
|
+
: Effect.succeed(false),
|
|
134
|
+
buildArtifact: ({ installedBefore }) => registrySourceArtifactWithCoverage({
|
|
135
|
+
ref,
|
|
136
|
+
scope: ws.scope,
|
|
137
|
+
installedBefore,
|
|
138
|
+
materialization: hookManager.aggregateProjectionObservation,
|
|
139
|
+
}),
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
const knowledgeManager = yield* KnowledgeManager;
|
|
143
|
+
return buildInstallOperation(knowledgeManager, {
|
|
144
|
+
toStepFailure: lifecycleStepFailure,
|
|
145
|
+
ref,
|
|
146
|
+
versionRange: Option.none(),
|
|
147
|
+
skipSettings: true,
|
|
148
|
+
skipProjections: true,
|
|
149
|
+
deferObservableValidation: true,
|
|
150
|
+
installedBefore: args.graphComplete
|
|
151
|
+
? knowledgeManager.isInstalled({ target: { type: "knowledge", name: ref.knowledge.name } })
|
|
152
|
+
: Effect.succeed(false),
|
|
153
|
+
buildArtifact: ({ installedBefore }) => Effect.succeed(registrySourceArtifact({ ref, scope: ws.scope, installedBefore })),
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
//# sourceMappingURL=member-install-step.js.map
|
|
@@ -13,11 +13,11 @@ import type { Handle } from "@agentxm/extension-model/unstable/extensions/handle
|
|
|
13
13
|
import type { Version } from "@agentxm/extension-model/unstable/version-constraints";
|
|
14
14
|
import type { PackRef } from "@agentxm/extension-model/unstable/extensions/refs/pack";
|
|
15
15
|
import { SourceHostProviders } from "@agentxm/extension-sources";
|
|
16
|
-
import {
|
|
16
|
+
import { StepFailureConversion } from "../../step-failure-conversion.js";
|
|
17
17
|
import type { OperationHandler } from "@agentxm/workspace-operations";
|
|
18
18
|
import type { Operation } from "@agentxm/workspace-operations";
|
|
19
19
|
import { WorkspaceMutations } from "@agentxm/workspace-state";
|
|
20
|
-
import {
|
|
20
|
+
import type { ResolvedPackDependencyMap } from "@agentxm/extension-resolution";
|
|
21
21
|
/**
|
|
22
22
|
* Args for the install pack operation.
|
|
23
23
|
*/
|
|
@@ -63,5 +63,5 @@ export type InstallPackOperation = Operation<"install-pack", InstallPackOperatio
|
|
|
63
63
|
* source-qualified acquired pack location, then records
|
|
64
64
|
* the pack in settings and lockfile.
|
|
65
65
|
*/
|
|
66
|
-
export declare const installPack: OperationHandler<InstallPackOperation, WorkspaceMutations | SourceHostProviders | FileSystem.FileSystem | Path.Path |
|
|
66
|
+
export declare const installPack: OperationHandler<InstallPackOperation, WorkspaceMutations | SourceHostProviders | FileSystem.FileSystem | Path.Path | StepFailureConversion>;
|
|
67
67
|
//# sourceMappingURL=install.d.ts.map
|
|
@@ -11,16 +11,16 @@ import * as Path from "effect/Path";
|
|
|
11
11
|
import * as Effect from "effect/Effect";
|
|
12
12
|
import * as Schema from "effect/Schema";
|
|
13
13
|
import { decodeExtensionNameSync } from "@agentxm/extension-model/unstable/extensions";
|
|
14
|
-
import { recoverCanonicalDirectory, replaceCanonicalDirectory } from "@agentxm/extension-
|
|
14
|
+
import { recoverCanonicalDirectory, replaceCanonicalDirectory, } from "@agentxm/extension-materialization";
|
|
15
15
|
import { validateExactResolvedVersion } from "@agentxm/workspace-state";
|
|
16
16
|
import { SourceHostProviders } from "@agentxm/extension-sources";
|
|
17
17
|
import { ExtensionLifecycleFailed } from "../../errors.js";
|
|
18
|
-
import {
|
|
18
|
+
import { StepFailureConversion, } from "../../step-failure-conversion.js";
|
|
19
19
|
import { WorkspaceMutations } from "@agentxm/workspace-state";
|
|
20
|
-
import { copyExtensionDirectory } from "@agentxm/extension-
|
|
20
|
+
import { copyExtensionDirectory } from "@agentxm/extension-materialization";
|
|
21
21
|
import { computePackPathsForLayout } from "@agentxm/workspace-state";
|
|
22
22
|
import { PACK_MANIFEST_FILENAME, PackManifestSchema, } from "@agentxm/extension-model/unstable/packs/manifest-schema";
|
|
23
|
-
import { validateExactPackDependencyVersions
|
|
23
|
+
import { validateExactPackDependencyVersions } from "../resolved-dependency.js";
|
|
24
24
|
import { computePackManifestContentIdentity } from "@agentxm/workspace-state";
|
|
25
25
|
import { computeMaterializedTreeIntegrity } from "@agentxm/workspace-state";
|
|
26
26
|
const collectMissingResolvedDependencies = (manifest, op) => {
|
|
@@ -45,7 +45,7 @@ const collectMissingResolvedDependencies = (manifest, op) => {
|
|
|
45
45
|
* the pack in settings and lockfile.
|
|
46
46
|
*/
|
|
47
47
|
export const installPack = (op) => Effect.gen(function* () {
|
|
48
|
-
const adapter = yield*
|
|
48
|
+
const adapter = yield* StepFailureConversion;
|
|
49
49
|
return yield* runInstallPack(op, adapter);
|
|
50
50
|
});
|
|
51
51
|
const runInstallPack = (op, adapter) => Effect.gen(function* () {
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unpacking a Pack: promoting its members to direct declarations.
|
|
3
|
+
*
|
|
4
|
+
* A Pack owns the declarations of everything it brings in. Unpacking hands
|
|
5
|
+
* that ownership to the workspace: every member the Pack contributed becomes
|
|
6
|
+
* a direct settings declaration carrying the member's own accepted source and
|
|
7
|
+
* activation, and the Pack declaration itself goes away. Nothing is
|
|
8
|
+
* re-resolved and nothing is re-acquired — the accepted resolutions the Pack
|
|
9
|
+
* already established are exactly what the direct declarations inherit.
|
|
10
|
+
*
|
|
11
|
+
* Membership has to be provable before any of it happens: an incomplete Pack
|
|
12
|
+
* graph, a Pack that is not configured, or a member whose accepted identity
|
|
13
|
+
* cannot be read stops the operation rather than leaving the workspace half
|
|
14
|
+
* promoted. The promotion and the Pack's removal are one atomic graph
|
|
15
|
+
* transition validated against the desired state it must leave behind.
|
|
16
|
+
*
|
|
17
|
+
* A member that is already declared directly keeps the declaration it has:
|
|
18
|
+
* unpacking grants ownership, it does not overwrite intent a person expressed.
|
|
19
|
+
*
|
|
20
|
+
* @experimental This API is unstable and may change without notice.
|
|
21
|
+
*/
|
|
22
|
+
import * as Effect from "effect/Effect";
|
|
23
|
+
import * as Path from "effect/Path";
|
|
24
|
+
import { PackManager } from "@agentxm/extension-materialization";
|
|
25
|
+
import { type ExecutionCandidate, type PlanExecution } from "@agentxm/workspace-operations";
|
|
26
|
+
import { WorkspaceMutations, type DesiredExtensionNode } from "@agentxm/workspace-state";
|
|
27
|
+
import { ExtensionLifecycleFailed } from "../errors.js";
|
|
28
|
+
import type { InstallStepRequirements } from "../install/vocabulary.js";
|
|
29
|
+
/** Which configured Pack is being unpacked. */
|
|
30
|
+
export interface PromoteAuthoredPackRequest {
|
|
31
|
+
/** The configured Pack's installed name. */
|
|
32
|
+
readonly name: string;
|
|
33
|
+
}
|
|
34
|
+
/** What every step in this transition may require when it runs. */
|
|
35
|
+
export type PromoteAuthoredPackRequirements = InstallStepRequirements;
|
|
36
|
+
/** One member the transition promotes, and how it was declared before. */
|
|
37
|
+
export interface PromotedPackMember {
|
|
38
|
+
readonly type: DesiredExtensionNode["type"];
|
|
39
|
+
readonly name: string;
|
|
40
|
+
/** True when the workspace already declared this member directly. */
|
|
41
|
+
readonly alreadyDirect: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A settled unpack: membership is proven, every member's accepted identity is
|
|
45
|
+
* readable, and nothing is written.
|
|
46
|
+
*/
|
|
47
|
+
export interface PromoteAuthoredPackCandidate {
|
|
48
|
+
/** The Pack's desired-state identity, as the transition reports it. */
|
|
49
|
+
readonly packIdentity: string;
|
|
50
|
+
readonly packName: string;
|
|
51
|
+
readonly members: ReadonlyArray<PromotedPackMember>;
|
|
52
|
+
readonly execution: ExecutionCandidate<PromoteAuthoredPackRequirements>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Every failure settling an unpack can surface before anything is written:
|
|
56
|
+
* the feature's own refusals plus whatever reading the desired graph, the
|
|
57
|
+
* accepted identities, and the transition it composes surfaced.
|
|
58
|
+
*/
|
|
59
|
+
export type PromoteAuthoredPackFailure = Effect.Error<ReturnType<typeof settleUnpack>>;
|
|
60
|
+
/** Everything settling an unpack reads before it freezes a candidate. */
|
|
61
|
+
export type PreparePromoteAuthoredPackRequirements = Effect.Services<ReturnType<typeof settleUnpack>>;
|
|
62
|
+
/**
|
|
63
|
+
* Settle an unpack: prove the graph is complete and the Pack is configured,
|
|
64
|
+
* read every member's accepted identity, and freeze the atomic transition
|
|
65
|
+
* that promotes the members and removes the Pack.
|
|
66
|
+
*/
|
|
67
|
+
declare const settleUnpack: (request: PromoteAuthoredPackRequest) => Effect.Effect<{
|
|
68
|
+
packIdentity: string;
|
|
69
|
+
packName: string;
|
|
70
|
+
members: {
|
|
71
|
+
type: "mcp-server" | "skill" | "subagent" | "rule" | "hook" | "knowledge" | "pack";
|
|
72
|
+
name: string;
|
|
73
|
+
alreadyDirect: boolean;
|
|
74
|
+
}[];
|
|
75
|
+
execution: ExecutionCandidate<InstallStepRequirements, never>;
|
|
76
|
+
}, ExtensionLifecycleFailed | import("@agentxm/workspace-state").PathTraversalDetected | import("@agentxm/workspace-state").SettingsIoError | import("@agentxm/workspace-state").SettingsParseError | import("@agentxm/workspace-state").SettingsDecodeError | import("@agentxm/workspace-state").LockfileIoError | import("@agentxm/workspace-state").LockfileParseError | import("@agentxm/workspace-state").LockfileDecodeError | import("@agentxm/workspace-state").LockfileVersionUnsupported | import("@agentxm/workspace-state").WorkspaceRootEscape | import("@agentxm/workspace-state").LockfileValidationError | import("@agentxm/workspace-state").LockEntrySourceMissing | import("@agentxm/workspace-state").LockEntryUrlInvalid | import("@agentxm/workspace-state").LockEntryNameInvalid | import("@agentxm/workspace-state").LockEntryEndpointConflict | import("@agentxm/workspace-state").LockEntrySourceTypeConflict | import("@agentxm/workspace-state").AcceptedResolutionMissing | import("@agentxm/workspace-state").InlineExtensionSourceMissing | import("@agentxm/workspace-state").PackageContentHashFailed | import("@agentxm/workspace-state").WorkspaceSourceInvalid | import("@agentxm/workspace-operations").CandidateFingerprintFailed, import("effect/FileSystem").FileSystem | Path.Path | WorkspaceMutations | import("@agentxm/workspace-state").ConfiguredAgentOutcomesProvider | PackManager>;
|
|
77
|
+
export declare const preparePromoteAuthoredPack: (request: PromoteAuthoredPackRequest) => Effect.Effect<PromoteAuthoredPackCandidate, PromoteAuthoredPackFailure, PreparePromoteAuthoredPackRequirements>;
|
|
78
|
+
/** Preview or apply a settled unpack, resolving to one operation outcome. */
|
|
79
|
+
export declare const previewOrApplyPromoteAuthoredPack: (candidate: PromoteAuthoredPackCandidate, execution: PlanExecution) => Effect.Effect<import("@agentxm/workspace-operations").OperationResolution<never>, import("@agentxm/workspace-state").WorkspaceSettingsReadFailure | import("@agentxm/workspace-operations").ApprovalRecoveryMissing | import("@agentxm/workspace-operations").PlanInteractionFailed | import("@agentxm/workspace-transactions").WorkspaceTransitionAcquireFailure, import("@agentxm/workspace-state").ConfiguredAgentOutcomesProvider | import("@agentxm/workspace-transactions").FootprintRecorder | import("@agentxm/workspace-operations").OperationJournal | import("@agentxm/workspace-operations").ResolvePlanInteraction | InstallStepRequirements>;
|
|
80
|
+
/** The unpack use case: settle a request, then preview or apply it. */
|
|
81
|
+
export declare const PromoteAuthoredPack: {
|
|
82
|
+
readonly prepare: (request: PromoteAuthoredPackRequest) => Effect.Effect<PromoteAuthoredPackCandidate, PromoteAuthoredPackFailure, PreparePromoteAuthoredPackRequirements>;
|
|
83
|
+
readonly previewOrApply: (candidate: PromoteAuthoredPackCandidate, execution: PlanExecution) => Effect.Effect<import("@agentxm/workspace-operations").OperationResolution<never>, import("@agentxm/workspace-state").WorkspaceSettingsReadFailure | import("@agentxm/workspace-operations").ApprovalRecoveryMissing | import("@agentxm/workspace-operations").PlanInteractionFailed | import("@agentxm/workspace-transactions").WorkspaceTransitionAcquireFailure, import("@agentxm/workspace-state").ConfiguredAgentOutcomesProvider | import("@agentxm/workspace-transactions").FootprintRecorder | import("@agentxm/workspace-operations").OperationJournal | import("@agentxm/workspace-operations").ResolvePlanInteraction | InstallStepRequirements>;
|
|
84
|
+
};
|
|
85
|
+
export {};
|
|
86
|
+
//# sourceMappingURL=promote-authored-pack.d.ts.map
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unpacking a Pack: promoting its members to direct declarations.
|
|
3
|
+
*
|
|
4
|
+
* A Pack owns the declarations of everything it brings in. Unpacking hands
|
|
5
|
+
* that ownership to the workspace: every member the Pack contributed becomes
|
|
6
|
+
* a direct settings declaration carrying the member's own accepted source and
|
|
7
|
+
* activation, and the Pack declaration itself goes away. Nothing is
|
|
8
|
+
* re-resolved and nothing is re-acquired — the accepted resolutions the Pack
|
|
9
|
+
* already established are exactly what the direct declarations inherit.
|
|
10
|
+
*
|
|
11
|
+
* Membership has to be provable before any of it happens: an incomplete Pack
|
|
12
|
+
* graph, a Pack that is not configured, or a member whose accepted identity
|
|
13
|
+
* cannot be read stops the operation rather than leaving the workspace half
|
|
14
|
+
* promoted. The promotion and the Pack's removal are one atomic graph
|
|
15
|
+
* transition validated against the desired state it must leave behind.
|
|
16
|
+
*
|
|
17
|
+
* A member that is already declared directly keeps the declaration it has:
|
|
18
|
+
* unpacking grants ownership, it does not overwrite intent a person expressed.
|
|
19
|
+
*
|
|
20
|
+
* @experimental This API is unstable and may change without notice.
|
|
21
|
+
*/
|
|
22
|
+
import * as Effect from "effect/Effect";
|
|
23
|
+
import * as Option from "effect/Option";
|
|
24
|
+
import * as Path from "effect/Path";
|
|
25
|
+
import { PackManager, buildUninstallOperation, } from "@agentxm/extension-materialization";
|
|
26
|
+
import { operationPresentation, prepareExecutionCandidate, resolveExecutionCandidate, } from "@agentxm/workspace-operations";
|
|
27
|
+
import { WorkspaceMutations, usableAcceptedCanonical, } from "@agentxm/workspace-state";
|
|
28
|
+
import { ExtensionLifecycleFailed } from "../errors.js";
|
|
29
|
+
import { lifecycleStepFailure } from "../step-failure.js";
|
|
30
|
+
import { buildAtomicPackGraphStep, validatePackGraphPostcondition } from "./graph-transition.js";
|
|
31
|
+
// -----------------------------------------------------------------------------
|
|
32
|
+
// Promotion
|
|
33
|
+
// -----------------------------------------------------------------------------
|
|
34
|
+
/**
|
|
35
|
+
* The Pack is leaving, so nothing it owned is retained on its account. The
|
|
36
|
+
* members it contributed are retained by their own direct declarations, which
|
|
37
|
+
* this same transition writes.
|
|
38
|
+
*/
|
|
39
|
+
const neverRetain = {
|
|
40
|
+
isRequiredByInstalledPack: () => Effect.succeed(false),
|
|
41
|
+
};
|
|
42
|
+
const reconcileSuggestion = (packIdentity) => ({
|
|
43
|
+
description: "Preview workspace reconciliation before unpacking.",
|
|
44
|
+
cmd: `axm sync ${packIdentity} --preview`,
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* Write the member's own declaration: the source and activation it already
|
|
48
|
+
* has under the Pack become the direct declaration it keeps without it.
|
|
49
|
+
*/
|
|
50
|
+
const promoteToDirectSettings = (ws, node) => {
|
|
51
|
+
const entry = { source: node.source, enabled: node.enabled };
|
|
52
|
+
const run = (() => {
|
|
53
|
+
switch (node.type) {
|
|
54
|
+
case "skill":
|
|
55
|
+
return ws.setSkillEntry(node.name, entry);
|
|
56
|
+
case "mcp-server":
|
|
57
|
+
return ws.setMcpServerEntry(node.name, { ...entry, env: {} });
|
|
58
|
+
case "subagent":
|
|
59
|
+
return ws.setSubagentEntry(node.name, entry);
|
|
60
|
+
case "rule":
|
|
61
|
+
return ws.setRuleEntry(node.name, entry);
|
|
62
|
+
case "hook":
|
|
63
|
+
return ws.setHookEntry(node.name, entry);
|
|
64
|
+
case "knowledge":
|
|
65
|
+
return ws.setKnowledgeEntry(node.name, entry);
|
|
66
|
+
case "pack":
|
|
67
|
+
return Effect.fail(new ExtensionLifecycleFailed({
|
|
68
|
+
category: "validation",
|
|
69
|
+
detail: `Nested pack member "${node.name}" cannot be unpacked`,
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
})();
|
|
73
|
+
return {
|
|
74
|
+
readiness: "ready",
|
|
75
|
+
label: node.name,
|
|
76
|
+
run: run.pipe(Effect.mapError(lifecycleStepFailure), Effect.as({
|
|
77
|
+
result: "success",
|
|
78
|
+
message: `Promoted ${node.type} ${node.name}`,
|
|
79
|
+
})),
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
/** The workspace-relative settings file the promoted declarations land in. */
|
|
83
|
+
const settingsDisplayPath = (path, ws) => path.relative(ws.baseDir, ws.layout.settingsPath);
|
|
84
|
+
/** The workspace-relative canonical location the removed Pack occupied. */
|
|
85
|
+
const packDisplayPath = (path, ws, node) => node.identity.startsWith("workspace:") && ws.layout.scope === "project"
|
|
86
|
+
? path.join(path.relative(ws.baseDir, ws.layout.authoredRoot("pack")), node.name)
|
|
87
|
+
: path.join(path.relative(ws.baseDir, ws.layout.acquiredRoot), node.identity.startsWith("workspace:")
|
|
88
|
+
? node.identity.slice("workspace:".length)
|
|
89
|
+
: node.identity);
|
|
90
|
+
// -----------------------------------------------------------------------------
|
|
91
|
+
// prepare
|
|
92
|
+
// -----------------------------------------------------------------------------
|
|
93
|
+
/**
|
|
94
|
+
* Settle an unpack: prove the graph is complete and the Pack is configured,
|
|
95
|
+
* read every member's accepted identity, and freeze the atomic transition
|
|
96
|
+
* that promotes the members and removes the Pack.
|
|
97
|
+
*/
|
|
98
|
+
const settleUnpack = Effect.fn("PromoteAuthoredPack.prepare")(function* (request) {
|
|
99
|
+
const ws = yield* WorkspaceMutations;
|
|
100
|
+
const packManager = yield* PackManager;
|
|
101
|
+
const path = yield* Path.Path;
|
|
102
|
+
const graph = yield* ws.getDesiredStateGraph();
|
|
103
|
+
if (!graph.complete) {
|
|
104
|
+
return yield* new ExtensionLifecycleFailed({
|
|
105
|
+
category: "validation",
|
|
106
|
+
detail: `Cannot unpack "${request.name}" while the desired pack graph is incomplete`,
|
|
107
|
+
suggestions: graph.problems.map((problem) => ({
|
|
108
|
+
description: `Resolve ${problem.type} before unpacking.`,
|
|
109
|
+
})),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
const packNode = graph.nodes.find((node) => node.type === "pack" && node.name === request.name);
|
|
113
|
+
if (packNode === undefined || packNode.type !== "pack") {
|
|
114
|
+
return yield* new ExtensionLifecycleFailed({
|
|
115
|
+
category: "not_found",
|
|
116
|
+
detail: `Pack "${request.name}" is not configured`,
|
|
117
|
+
suggestions: [{ description: "Install the pack first.", cmd: "axm packs install <source>" }],
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
const acceptedRefFor = Effect.fn("PromoteAuthoredPack.acceptedRef")(function* (node) {
|
|
121
|
+
const canonical = yield* usableAcceptedCanonical({
|
|
122
|
+
workspace: ws,
|
|
123
|
+
type: node.type,
|
|
124
|
+
name: node.name,
|
|
125
|
+
});
|
|
126
|
+
if (Option.isNone(canonical)) {
|
|
127
|
+
return yield* new ExtensionLifecycleFailed({
|
|
128
|
+
category: "not_found",
|
|
129
|
+
detail: `Accepted ${node.type} identity for "${node.name}" is unavailable`,
|
|
130
|
+
suggestions: [reconcileSuggestion(packNode.identity)],
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return canonical.value.ref;
|
|
134
|
+
});
|
|
135
|
+
const packRef = yield* acceptedRefFor(packNode);
|
|
136
|
+
if (packRef.type !== "pack") {
|
|
137
|
+
return yield* new ExtensionLifecycleFailed({
|
|
138
|
+
category: "not_found",
|
|
139
|
+
detail: `Accepted pack identity for "${request.name}" is invalid`,
|
|
140
|
+
suggestions: [reconcileSuggestion(packNode.identity)],
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
const memberNodes = graph.nodes.filter((node) => node.type !== "pack" &&
|
|
144
|
+
node.origins.some((origin) => origin.type === "pack" && origin.pack === packNode.identity));
|
|
145
|
+
const promotions = yield* Effect.forEach(memberNodes, Effect.fn("PromoteAuthoredPack.member")(function* (node) {
|
|
146
|
+
const ref = yield* acceptedRefFor(node);
|
|
147
|
+
if (ref.type === "pack") {
|
|
148
|
+
return yield* new ExtensionLifecycleFailed({
|
|
149
|
+
category: "not_found",
|
|
150
|
+
detail: `Accepted ${node.type} identity for "${node.name}" is invalid`,
|
|
151
|
+
suggestions: [reconcileSuggestion(packNode.identity)],
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
return node;
|
|
155
|
+
}), { concurrency: "unbounded" });
|
|
156
|
+
const promotionSteps = promotions.map((node) => {
|
|
157
|
+
// A declaration a person already wrote outranks the promotion: the
|
|
158
|
+
// member is theirs to own, on the terms they chose.
|
|
159
|
+
if (node.origins.some((origin) => origin.type === "settings")) {
|
|
160
|
+
return {
|
|
161
|
+
readiness: "ready",
|
|
162
|
+
label: node.name,
|
|
163
|
+
run: Effect.succeed({
|
|
164
|
+
result: "success",
|
|
165
|
+
message: "already directly configured",
|
|
166
|
+
}),
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
if (node.source === undefined) {
|
|
170
|
+
return {
|
|
171
|
+
readiness: "error",
|
|
172
|
+
errorMessage: "Inline MCP configuration has no Pack source.",
|
|
173
|
+
label: node.name,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
return promoteToDirectSettings(ws, node);
|
|
177
|
+
});
|
|
178
|
+
const uninstallPackStep = buildUninstallOperation(packManager, neverRetain, {
|
|
179
|
+
toStepFailure: lifecycleStepFailure,
|
|
180
|
+
target: { type: "pack", owner: packRef.owner, name: packRef.pack.name },
|
|
181
|
+
});
|
|
182
|
+
const artifactTargets = [
|
|
183
|
+
...promotions.map((node) => ({
|
|
184
|
+
path: `${settingsDisplayPath(path, ws)}#${node.type}.${node.name}`,
|
|
185
|
+
change: "updated",
|
|
186
|
+
})),
|
|
187
|
+
{ path: packDisplayPath(path, ws, packNode), change: "removed" },
|
|
188
|
+
];
|
|
189
|
+
const graphStep = yield* buildAtomicPackGraphStep({
|
|
190
|
+
label: packNode.identity,
|
|
191
|
+
message: `Unpacked ${packNode.identity} into ${promotions.length} direct declaration${promotions.length === 1 ? "" : "s"}`,
|
|
192
|
+
artifact: {
|
|
193
|
+
path: "pack provenance",
|
|
194
|
+
scope: ws.scope,
|
|
195
|
+
change: "updated",
|
|
196
|
+
fileCount: promotions.length + 1,
|
|
197
|
+
targets: artifactTargets,
|
|
198
|
+
},
|
|
199
|
+
children: [...promotionSteps, uninstallPackStep].map((step) => ({
|
|
200
|
+
step,
|
|
201
|
+
coverage: "ineligible",
|
|
202
|
+
})),
|
|
203
|
+
validate: validatePackGraphPostcondition({
|
|
204
|
+
requiredMembers: promotions.flatMap((node) => node.type === "pack"
|
|
205
|
+
? []
|
|
206
|
+
: [{ type: node.type, name: node.name, direct: true, enabled: node.enabled }]),
|
|
207
|
+
absent: [{ type: "pack", name: packNode.name }],
|
|
208
|
+
}),
|
|
209
|
+
});
|
|
210
|
+
const plan = {
|
|
211
|
+
_tag: "Plan",
|
|
212
|
+
name: "Unpack pack",
|
|
213
|
+
description: Option.some(`Unpack ${request.name} into direct settings entries`),
|
|
214
|
+
presentation: operationPresentation({ imperative: "unpack", past: "Unpacked", gerund: "Unpacking" }, "pack"),
|
|
215
|
+
jobs: [{ concurrency: 1, steps: [graphStep] }],
|
|
216
|
+
};
|
|
217
|
+
return {
|
|
218
|
+
packIdentity: packNode.identity,
|
|
219
|
+
packName: packNode.name,
|
|
220
|
+
members: promotions.map((node) => ({
|
|
221
|
+
type: node.type,
|
|
222
|
+
name: node.name,
|
|
223
|
+
alreadyDirect: node.origins.some((origin) => origin.type === "settings"),
|
|
224
|
+
})),
|
|
225
|
+
execution: yield* prepareExecutionCandidate(plan),
|
|
226
|
+
};
|
|
227
|
+
});
|
|
228
|
+
export const preparePromoteAuthoredPack = settleUnpack;
|
|
229
|
+
// -----------------------------------------------------------------------------
|
|
230
|
+
// previewOrApply
|
|
231
|
+
// -----------------------------------------------------------------------------
|
|
232
|
+
/** Preview or apply a settled unpack, resolving to one operation outcome. */
|
|
233
|
+
export const previewOrApplyPromoteAuthoredPack = (candidate, execution) => resolveExecutionCandidate(candidate.execution, execution);
|
|
234
|
+
/** The unpack use case: settle a request, then preview or apply it. */
|
|
235
|
+
export const PromoteAuthoredPack = {
|
|
236
|
+
prepare: preparePromoteAuthoredPack,
|
|
237
|
+
previewOrApply: previewOrApplyPromoteAuthoredPack,
|
|
238
|
+
};
|
|
239
|
+
//# sourceMappingURL=promote-authored-pack.js.map
|
|
@@ -1,29 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pack lock-entry validation over the resolved dependency map: the map's
|
|
3
|
+
* shape belongs to `@agentxm/extension-resolution`; refusing an inexact
|
|
4
|
+
* version before a lock entry is written is the pack manager's obligation.
|
|
5
|
+
*
|
|
6
|
+
* @experimental This API is unstable and may change without notice.
|
|
7
|
+
*/
|
|
1
8
|
import * as Effect from "effect/Effect";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
export declare const ResolvedPackDependencySchema: Schema.Union<readonly [Schema.Struct<{
|
|
5
|
-
readonly source: Schema.Literal<"registry">;
|
|
6
|
-
readonly version: Schema.brand<Schema.String, "Version">;
|
|
7
|
-
readonly publisherBindingId: Schema.NonEmptyString;
|
|
8
|
-
readonly integrity: Schema.String;
|
|
9
|
-
}>, Schema.Struct<{
|
|
10
|
-
readonly source: Schema.Literal<"workspace">;
|
|
11
|
-
readonly version: Schema.brand<Schema.String, "Version">;
|
|
12
|
-
readonly sourceIdentity: Schema.String;
|
|
13
|
-
readonly contentIdentity: Schema.brand<Schema.String, "SourceHash">;
|
|
14
|
-
}>]>;
|
|
15
|
-
export type ResolvedPackDependency = typeof ResolvedPackDependencySchema.Type;
|
|
16
|
-
export declare const ResolvedPackDependencyMapSchema: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{
|
|
17
|
-
readonly source: Schema.Literal<"registry">;
|
|
18
|
-
readonly version: Schema.brand<Schema.String, "Version">;
|
|
19
|
-
readonly publisherBindingId: Schema.NonEmptyString;
|
|
20
|
-
readonly integrity: Schema.String;
|
|
21
|
-
}>, Schema.Struct<{
|
|
22
|
-
readonly source: Schema.Literal<"workspace">;
|
|
23
|
-
readonly version: Schema.brand<Schema.String, "Version">;
|
|
24
|
-
readonly sourceIdentity: Schema.String;
|
|
25
|
-
readonly contentIdentity: Schema.brand<Schema.String, "SourceHash">;
|
|
26
|
-
}>]>>;
|
|
27
|
-
export type ResolvedPackDependencyMap = typeof ResolvedPackDependencyMapSchema.Type;
|
|
9
|
+
import { PackDefinitionInvalid } from "@agentxm/extension-materialization";
|
|
10
|
+
import type { ResolvedPackDependencyMap } from "@agentxm/extension-resolution";
|
|
28
11
|
export declare const validateExactPackDependencyVersions: (field: string, resolved: ResolvedPackDependencyMap) => Effect.Effect<void, PackDefinitionInvalid, never>;
|
|
29
12
|
//# sourceMappingURL=resolved-dependency.d.ts.map
|
|
@@ -1,26 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pack lock-entry validation over the resolved dependency map: the map's
|
|
3
|
+
* shape belongs to `@agentxm/extension-resolution`; refusing an inexact
|
|
4
|
+
* version before a lock entry is written is the pack manager's obligation.
|
|
5
|
+
*
|
|
6
|
+
* @experimental This API is unstable and may change without notice.
|
|
7
|
+
*/
|
|
1
8
|
import * as Effect from "effect/Effect";
|
|
2
9
|
import * as Schema from "effect/Schema";
|
|
3
|
-
import { PackDefinitionInvalid } from "@agentxm/extension-
|
|
4
|
-
import { ExtensionFqnSchema } from "@agentxm/extension-model/unstable/extensions";
|
|
5
|
-
import { SourceHashSchema } from "@agentxm/extension-model/unstable/sources/source-hash";
|
|
10
|
+
import { PackDefinitionInvalid } from "@agentxm/extension-materialization";
|
|
6
11
|
import { VersionSchema } from "@agentxm/extension-model/unstable/version-constraints";
|
|
7
|
-
const ResolvedRegistryDependencySchema = Schema.Struct({
|
|
8
|
-
source: Schema.Literal("registry"),
|
|
9
|
-
version: VersionSchema,
|
|
10
|
-
publisherBindingId: Schema.NonEmptyString,
|
|
11
|
-
integrity: Schema.String,
|
|
12
|
-
});
|
|
13
|
-
const ResolvedWorkspaceDependencySchema = Schema.Struct({
|
|
14
|
-
source: Schema.Literal("workspace"),
|
|
15
|
-
version: VersionSchema,
|
|
16
|
-
sourceIdentity: Schema.String,
|
|
17
|
-
contentIdentity: SourceHashSchema,
|
|
18
|
-
});
|
|
19
|
-
export const ResolvedPackDependencySchema = Schema.Union([
|
|
20
|
-
ResolvedRegistryDependencySchema,
|
|
21
|
-
ResolvedWorkspaceDependencySchema,
|
|
22
|
-
]);
|
|
23
|
-
export const ResolvedPackDependencyMapSchema = Schema.Record(ExtensionFqnSchema, ResolvedPackDependencySchema);
|
|
24
12
|
export const validateExactPackDependencyVersions = (field, resolved) => Effect.forEach(Object.entries(resolved), ([fqn, value]) => Schema.decodeUnknownEffect(VersionSchema)(value.version).pipe(Effect.mapError((cause) => new PackDefinitionInvalid({
|
|
25
13
|
detail: `Pack dependency ${field}.${fqn}.version must be an exact semver value`,
|
|
26
14
|
cause,
|