@agentxm/extension-lifecycle 0.29.4 → 0.30.2
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/set-activation.d.ts +22 -40
- package/dist/src/activation/set-activation.js +191 -336
- package/dist/src/demote/demote-to-external-source.d.ts +1 -1
- package/dist/src/demote/demote-to-external-source.js +53 -24
- package/dist/src/hooks/install/plan.js +6 -3
- package/dist/src/hooks/uninstall/plan.js +4 -3
- package/dist/src/index.d.ts +1 -5
- package/dist/src/index.js +1 -4
- package/dist/src/install/install-extensions.d.ts +5 -5
- package/dist/src/install/install-extensions.js +2 -1
- package/dist/src/install/root-intent.d.ts +2 -2
- package/dist/src/install/vocabulary.d.ts +5 -4
- package/dist/src/knowledge/install/plan.js +2 -1
- package/dist/src/knowledge/uninstall/plan.js +4 -3
- package/dist/src/mcps/install/plan.d.ts +1 -1
- package/dist/src/mcps/install/plan.js +59 -3
- package/dist/src/mcps/operations/uninstall.js +2 -1
- package/dist/src/mcps/uninstall/plan.js +13 -4
- package/dist/src/packs/graph-transition.d.ts +0 -25
- package/dist/src/packs/graph-transition.js +0 -101
- package/dist/src/packs/install/plan.d.ts +0 -13
- package/dist/src/packs/install/plan.js +12 -9
- package/dist/src/packs/member-install-step.js +8 -21
- package/dist/src/packs/promote-authored-pack.js +6 -3
- package/dist/src/packs/uninstall/plan.js +53 -21
- package/dist/src/rules/install/plan.js +6 -3
- package/dist/src/rules/uninstall/plan.js +4 -3
- package/dist/src/skills/application/index.d.ts +42 -0
- package/dist/src/skills/application/index.js +37 -0
- package/dist/src/skills/domain/selection.d.ts +22 -0
- package/dist/src/skills/domain/selection.js +18 -0
- package/dist/src/skills/install/artifact.d.ts +4 -0
- package/dist/src/skills/install/artifact.js +29 -0
- package/dist/src/skills/install/bundled.js +4 -4
- package/dist/src/skills/install/plan.d.ts +15 -4
- package/dist/src/skills/install/plan.js +114 -97
- package/dist/src/skills/uninstall/plan.js +13 -5
- package/dist/src/step-failure.js +12 -0
- package/dist/src/subagents/application/index.d.ts +42 -0
- package/dist/src/subagents/application/index.js +37 -0
- package/dist/src/subagents/domain/selection.d.ts +22 -0
- package/dist/src/subagents/domain/selection.js +18 -0
- package/dist/src/subagents/install/plan.d.ts +2 -2
- package/dist/src/subagents/install/plan.js +4 -4
- package/dist/src/subagents/operations/enable.js +1 -3
- package/dist/src/subagents/uninstall/plan.js +5 -4
- package/dist/src/testing.d.ts +3 -2
- package/dist/src/testing.js +9 -6
- package/dist/src/uninstall/root-intent.d.ts +2 -1
- package/dist/src/uninstall/root-intent.js +1 -0
- package/dist/src/uninstall/undesired-target.d.ts +26 -0
- package/dist/src/uninstall/undesired-target.js +56 -0
- package/dist/src/uninstall/uninstall-extensions.d.ts +1 -1
- package/dist/src/uninstall/uninstall-extensions.js +103 -3
- package/dist/src/update/root-request.d.ts +2 -2
- package/dist/src/update/selective/plan.d.ts +2 -3
- package/dist/src/update/selective/plan.js +2 -2
- package/dist/src/update/selective/requirements.d.ts +2 -6
- package/dist/src/update/selective/requirements.js +1 -3
- package/dist/src/update/selective/selection.js +1 -1
- package/dist/src/update/selective/skills.d.ts +2 -4
- package/dist/src/update/selective/skills.js +22 -27
- package/dist/src/update/selective/subagents.d.ts +2 -3
- package/dist/src/update/selective/subagents.js +11 -9
- package/dist/src/update/selective/use-case.d.ts +7 -7
- package/dist/src/update/selective/vocabulary.d.ts +1 -1
- package/dist/src/update/selector.js +1 -1
- package/dist/src/update/targeted-plan.js +4 -2
- package/dist/src/workspace-paths.d.ts +0 -6
- package/dist/src/workspace-paths.js +0 -10
- package/package.json +30 -24
- package/dist/src/glob.d.ts +0 -35
- package/dist/src/glob.js +0 -75
- package/dist/src/install/selection-interaction.d.ts +0 -46
- package/dist/src/install/selection-interaction.js +0 -22
- package/dist/src/skills/install/selection.d.ts +0 -26
- package/dist/src/skills/install/selection.js +0 -41
- package/dist/src/skills/operations/install-result.d.ts +0 -33
- package/dist/src/skills/operations/install-result.js +0 -10
- package/dist/src/skills/operations/install.d.ts +0 -67
- package/dist/src/skills/operations/install.js +0 -591
- package/dist/src/subagents/install/selection.d.ts +0 -26
- package/dist/src/subagents/install/selection.js +0 -37
- package/dist/src/uninstall/retention-policy.d.ts +0 -21
- package/dist/src/uninstall/retention-policy.js +0 -28
|
@@ -69,7 +69,7 @@ declare const settleDemotion: (request: DemoteRequest) => Effect.Effect<{
|
|
|
69
69
|
fqn: string;
|
|
70
70
|
authoredPath: string;
|
|
71
71
|
execution: ExecutionCandidate<InstallStepRequirements, never>;
|
|
72
|
-
}, ExtensionLifecycleFailed | import("@agentxm/workspace-state").PathTraversalDetected | import("@agentxm/extension-sources").SourceSyntaxInvalid | import("@agentxm/extension-sources").SourceHostNotConfigured | import("@agentxm/extension-sources").SourceNotResolvable | import("@agentxm/extension-sources").SourceNetworkFailure | import("@agentxm/extension-sources").GitOperationFailed | import("@agentxm/extension-sources").WorkspaceCatalogUnavailable | import("@agentxm/extension-sources").AxmSkillGateUnavailable | import("@agentxm/registry-client").RegistryProblem | import("@agentxm/registry-client").RegistryRequestFailed | import("@agentxm/registry-client").RegistryOperationFailed | import("@agentxm/workspace-state").LockfileIoError | import("@agentxm/workspace-state").LockfileParseError | import("@agentxm/workspace-state").LockfileDecodeError | import("@agentxm/workspace-state").LockfileVersionUnsupported | WorkspaceSettingsReadFailure | 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/extension-model/unstable/extensions").FqnInvalidError | import("@agentxm/extension-resolution").ExtensionResolutionFailed | import("@agentxm/workspace-operations").CandidateFingerprintFailed, FileSystem.FileSystem | Path.Path | WorkspaceMutations | import("@agentxm/workspace-state").ConfiguredAgentOutcomesProvider | ExtensionManagers | import("
|
|
72
|
+
}, ExtensionLifecycleFailed | import("@agentxm/workspace-state").PathTraversalDetected | import("@agentxm/extension-sources").SourceSyntaxInvalid | import("@agentxm/extension-sources").SourceHostNotConfigured | import("@agentxm/extension-sources").SourceNotResolvable | import("@agentxm/extension-sources").SourceNetworkFailure | import("@agentxm/extension-sources").GitOperationFailed | import("@agentxm/extension-sources").WorkspaceCatalogUnavailable | import("@agentxm/extension-sources").AxmSkillGateUnavailable | import("@agentxm/registry-client").RegistryProblem | import("@agentxm/registry-client").RegistryRequestFailed | import("@agentxm/registry-client").RegistryOperationFailed | import("@agentxm/workspace-state").LockfileIoError | import("@agentxm/workspace-state").LockfileParseError | import("@agentxm/workspace-state").LockfileDecodeError | import("@agentxm/workspace-state").LockfileVersionUnsupported | WorkspaceSettingsReadFailure | 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/extension-model/unstable/extensions").FqnInvalidError | import("@agentxm/extension-resolution").ExtensionResolutionFailed | import("@agentxm/workspace-operations").CandidateFingerprintFailed, FileSystem.FileSystem | Path.Path | WorkspaceMutations | import("effect/unstable/http/HttpClient").HttpClient | import("@agentxm/workspace-state").ConfiguredAgentOutcomesProvider | ExtensionManagers | import("@agentxm/extension-resolution").ReleaseAgePosture | import("effect/Scope").Scope | import("@agentxm/extension-sources").SourceHostProviders | import("@agentxm/extension-sources").WorkspaceCatalog>;
|
|
73
73
|
export declare const prepareDemote: (request: DemoteRequest) => Effect.Effect<DemoteCandidate, DemoteFailure, PrepareDemoteRequirements>;
|
|
74
74
|
/** Preview or apply a settled demotion, resolving to one operation outcome. */
|
|
75
75
|
export declare const previewOrApplyDemote: (candidate: DemoteCandidate, execution: PlanExecution) => Effect.Effect<import("@agentxm/workspace-operations").OperationResolution<never>, 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>;
|
|
@@ -20,7 +20,8 @@ import * as Effect from "effect/Effect";
|
|
|
20
20
|
import * as FileSystem from "effect/FileSystem";
|
|
21
21
|
import * as Option from "effect/Option";
|
|
22
22
|
import * as Path from "effect/Path";
|
|
23
|
-
import { ExtensionManagers
|
|
23
|
+
import { ExtensionManagers } from "@agentxm/extension-materialization";
|
|
24
|
+
import { buildInstallOperation } from "@agentxm/workspace-reconciliation";
|
|
24
25
|
import { formatFqn, parseFqn, } from "@agentxm/extension-model/unstable/extensions";
|
|
25
26
|
import { isWorkspaceSourceLocator } from "@agentxm/extension-model/unstable/sources/workspace";
|
|
26
27
|
import { makeConfiguredReleaseAgeEvaluation, resolveConfiguredHook, resolveConfiguredKnowledge, resolveConfiguredMcpServer, resolveConfiguredPack, resolveConfiguredRule, resolveConfiguredSkill, resolveConfiguredSubagent, } from "@agentxm/extension-resolution";
|
|
@@ -88,7 +89,7 @@ const restoreDisabledState = (ws, type, name) => {
|
|
|
88
89
|
// -----------------------------------------------------------------------------
|
|
89
90
|
/**
|
|
90
91
|
* Resolve the replacement package from its new source and compose the install
|
|
91
|
-
* that replaces the authored content. `
|
|
92
|
+
* that replaces the authored content. `sourceReplacements` is the one
|
|
92
93
|
* place source authority is deliberately overridden, and it is named here so
|
|
93
94
|
* no other route can reach it by accident.
|
|
94
95
|
*/
|
|
@@ -98,43 +99,71 @@ const replacementStep = Effect.fn("Demote.replacementStep")(function* (type, nam
|
|
|
98
99
|
// The one place source authority is deliberately overridden.
|
|
99
100
|
const common = {
|
|
100
101
|
toStepFailure: lifecycleStepFailure,
|
|
101
|
-
|
|
102
|
+
sourceReplacements: [{ type, name }],
|
|
102
103
|
};
|
|
103
104
|
switch (type) {
|
|
104
105
|
case "skill":
|
|
105
|
-
return
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
return yield* Effect.gen(function* () {
|
|
107
|
+
const resolved = yield* resolveConfiguredSkill(name, source, evaluation);
|
|
108
|
+
return buildInstallOperation(managers.skill, {
|
|
109
|
+
...common,
|
|
110
|
+
...resolved,
|
|
111
|
+
declaration: { name, versionRange: resolved.versionRange },
|
|
112
|
+
});
|
|
108
113
|
});
|
|
109
114
|
case "mcp-server":
|
|
110
|
-
return
|
|
111
|
-
|
|
112
|
-
|
|
115
|
+
return yield* Effect.gen(function* () {
|
|
116
|
+
const resolved = yield* resolveConfiguredMcpServer(name, source, evaluation);
|
|
117
|
+
return buildInstallOperation(managers["mcp-server"], {
|
|
118
|
+
...common,
|
|
119
|
+
...resolved,
|
|
120
|
+
declaration: { name, versionRange: resolved.versionRange },
|
|
121
|
+
});
|
|
113
122
|
});
|
|
114
123
|
case "subagent":
|
|
115
|
-
return
|
|
116
|
-
|
|
117
|
-
|
|
124
|
+
return yield* Effect.gen(function* () {
|
|
125
|
+
const resolved = yield* resolveConfiguredSubagent(name, source, evaluation);
|
|
126
|
+
return buildInstallOperation(managers.subagent, {
|
|
127
|
+
...common,
|
|
128
|
+
...resolved,
|
|
129
|
+
declaration: { name, versionRange: resolved.versionRange },
|
|
130
|
+
});
|
|
118
131
|
});
|
|
119
132
|
case "rule":
|
|
120
|
-
return
|
|
121
|
-
|
|
122
|
-
|
|
133
|
+
return yield* Effect.gen(function* () {
|
|
134
|
+
const resolved = yield* resolveConfiguredRule(name, source, evaluation);
|
|
135
|
+
return buildInstallOperation(managers.rule, {
|
|
136
|
+
...common,
|
|
137
|
+
...resolved,
|
|
138
|
+
declaration: { name, versionRange: resolved.versionRange },
|
|
139
|
+
});
|
|
123
140
|
});
|
|
124
141
|
case "hook":
|
|
125
|
-
return
|
|
126
|
-
|
|
127
|
-
|
|
142
|
+
return yield* Effect.gen(function* () {
|
|
143
|
+
const resolved = yield* resolveConfiguredHook(name, source, evaluation);
|
|
144
|
+
return buildInstallOperation(managers.hook, {
|
|
145
|
+
...common,
|
|
146
|
+
...resolved,
|
|
147
|
+
declaration: { name, versionRange: resolved.versionRange },
|
|
148
|
+
});
|
|
128
149
|
});
|
|
129
150
|
case "knowledge":
|
|
130
|
-
return
|
|
131
|
-
|
|
132
|
-
|
|
151
|
+
return yield* Effect.gen(function* () {
|
|
152
|
+
const resolved = yield* resolveConfiguredKnowledge(name, source, evaluation);
|
|
153
|
+
return buildInstallOperation(managers.knowledge, {
|
|
154
|
+
...common,
|
|
155
|
+
...resolved,
|
|
156
|
+
declaration: { name, versionRange: resolved.versionRange },
|
|
157
|
+
});
|
|
133
158
|
});
|
|
134
159
|
case "pack":
|
|
135
|
-
return
|
|
136
|
-
|
|
137
|
-
|
|
160
|
+
return yield* Effect.gen(function* () {
|
|
161
|
+
const resolved = yield* resolveConfiguredPack(name, source, evaluation);
|
|
162
|
+
return buildInstallOperation(managers.pack, {
|
|
163
|
+
...common,
|
|
164
|
+
...resolved,
|
|
165
|
+
declaration: { name, versionRange: resolved.versionRange },
|
|
166
|
+
});
|
|
138
167
|
});
|
|
139
168
|
}
|
|
140
169
|
});
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import * as Effect from "effect/Effect";
|
|
11
11
|
import * as Option from "effect/Option";
|
|
12
|
-
import { HookManager
|
|
12
|
+
import { HookManager } from "@agentxm/extension-materialization";
|
|
13
|
+
import { buildInstallOperation } from "@agentxm/workspace-reconciliation";
|
|
13
14
|
import { parseSourceQualifiedRegistrySourcePatternParts, } from "@agentxm/extension-model/unstable/extensions";
|
|
14
15
|
import { HOOK_EXTENSION_DIR } from "@agentxm/extension-model/unstable/hooks/manifest-schema";
|
|
15
16
|
import { SourceHostProviders, resolveSource } from "@agentxm/extension-sources";
|
|
@@ -137,8 +138,10 @@ export const planHookInstall = Effect.fn("InstallExtensions.planHooks")(function
|
|
|
137
138
|
const operation = buildInstallOperation(hookManager, {
|
|
138
139
|
toStepFailure: lifecycleStepFailure,
|
|
139
140
|
ref,
|
|
140
|
-
versionRange,
|
|
141
|
-
|
|
141
|
+
declaration: { name: ref.hook.name, versionRange },
|
|
142
|
+
...(deferProjections
|
|
143
|
+
? { enclosingClosure: { projections: [ref.type], postconditions: [] } }
|
|
144
|
+
: {}),
|
|
142
145
|
installedBefore: Effect.succeed(installedBefore),
|
|
143
146
|
message: `Installed ${ref.hook.name}`,
|
|
144
147
|
buildArtifact: ({ installedBefore }) => Effect.gen(function* () {
|
|
@@ -9,11 +9,12 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import * as Effect from "effect/Effect";
|
|
11
11
|
import * as Option from "effect/Option";
|
|
12
|
-
import { HookManager
|
|
12
|
+
import { HookManager } from "@agentxm/extension-materialization";
|
|
13
|
+
import { buildUninstallOperation } from "@agentxm/workspace-reconciliation";
|
|
13
14
|
import { WorkspaceMutations, acquiredExtensionDisplayPathFromLockEntry, } from "@agentxm/workspace-state";
|
|
14
15
|
import { lifecycleStepFailure } from "../../step-failure.js";
|
|
15
16
|
import { installRefused } from "../../install/vocabulary.js";
|
|
16
|
-
import { makeWorkspaceRetentionPolicy } from "
|
|
17
|
+
import { makeWorkspaceRetentionPolicy } from "@agentxm/workspace-reconciliation";
|
|
17
18
|
import { workspaceCanonicalRoot, workspaceLockfilePath, workspaceSettingsPath, } from "../../workspace-paths.js";
|
|
18
19
|
const hookUninstallArtifactTargets = (entry, retained, targetName, scope) => {
|
|
19
20
|
if (Option.isNone(entry))
|
|
@@ -47,7 +48,7 @@ export const parseHookUninstallRequest = Effect.fn("UninstallExtensions.parseHoo
|
|
|
47
48
|
export const planHookUninstall = Effect.fn("UninstallExtensions.planHooks")(function* (intent) {
|
|
48
49
|
const ws = yield* WorkspaceMutations;
|
|
49
50
|
const hookManager = yield* HookManager;
|
|
50
|
-
const retentionPolicy = makeWorkspaceRetentionPolicy(ws);
|
|
51
|
+
const retentionPolicy = makeWorkspaceRetentionPolicy(ws, lifecycleStepFailure);
|
|
51
52
|
const steps = yield* Effect.forEach(intent.targets, (target) => Effect.gen(function* () {
|
|
52
53
|
const lockEntry = yield* ws
|
|
53
54
|
.getLockedHookEntry(target.name)
|
package/dist/src/index.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export type { SetActivationExecutionFailure } from "./activation/errors.js";
|
|
|
15
15
|
export { PUBLISHER_CHANGE_CONDITION_ID, publisherChangeRiskCondition, withPublisherTrust, withPublisherTrustConditions, } from "./publisher-binding.js";
|
|
16
16
|
export { InstallExtensions, prepareInstallExtensions, previewOrApplyInstallExtensions, type InstallDiagnostics, type InstallExtensionsCandidate, type InstallExtensionsFailure, type InstallExtensionsRequest, type InstallSubject, } from "./install/install-extensions.js";
|
|
17
17
|
export { installRefused, type HookInstallIntent, type InstallStepRequirements, type KnowledgeInstallIntent, type McpServerInstallIntent, type PackInstallIntent, type PackRecoveryDependencyResolver, type PrepareInstallRequirements, type ResolveInstallRequirements, type RuleInstallIntent, type SkillInstallIntent, type SubagentInstallIntent, } from "./install/vocabulary.js";
|
|
18
|
-
export { ExtensionSelectionCancelled, ExtensionSelectionInteraction, type ExtensionSelectionFailure, type ExtensionSelectionInteractionService, } from "./install/selection-interaction.js";
|
|
19
18
|
export { resolveRootInstallIntent, rootInstallableTypeSegments, RootInstallableTypeSegmentSchema, type RootInstallIntent, type RootInstallableType, type RootInstallableTypeSegment, } from "./install/root-intent.js";
|
|
20
19
|
export { installCommandFor, perTypeInstallPluralSegments } from "./install/per-type-install.js";
|
|
21
20
|
export { buildConfiguredInstallPlan, buildConfiguredPackInstallPlan, type ConfiguredInstallPlanResult, type ConfiguredInstallRequirements, type ConfiguredInstallableType, } from "./install/configured.js";
|
|
@@ -30,17 +29,14 @@ export { planRuleInstall } from "./rules/install/plan.js";
|
|
|
30
29
|
export { planSkillInstall } from "./skills/install/plan.js";
|
|
31
30
|
export { planSubagentInstall } from "./subagents/install/plan.js";
|
|
32
31
|
export { BUNDLED_AXM_SKILL_AUTHORED_BLOCKER, BundledAxmSkillAsset, bundledAxmSkillCanonicalPath, inspectBundledAxmSkillReadiness, installBundledAxmSkill, type BundledAxmSkillAssetService, type BundledAxmSkillReadiness, type BundledAxmSkillSourceFile, } from "./skills/install/bundled.js";
|
|
33
|
-
export {
|
|
32
|
+
export { validatePackGraphPostcondition } from "./packs/graph-transition.js";
|
|
34
33
|
export { buildPackMemberInstallStep, type PackMemberRef } from "./packs/member-install-step.js";
|
|
35
34
|
export { configuredPackConstraintBlockPlan, prospectivePackConstraintProblems, relevantPackConstraintProblems, } from "./packs/constraint-gate.js";
|
|
36
35
|
export { UninstallExtensions, prepareUninstallExtensions, previewOrApplyUninstallExtensions, type PrepareUninstallRequirements, type UninstallExtensionsCandidate, type UninstallExtensionsFailure, type UninstallExtensionsRequest, } from "./uninstall/uninstall-extensions.js";
|
|
37
36
|
export { resolveRootUninstallIntent, rootUninstallableTypeSegments, type RootUninstallIntent, type RootUninstallableType, } from "./uninstall/root-intent.js";
|
|
38
|
-
export { exclusiveMemberRetentionPolicy, makeWorkspaceRetentionPolicy, } from "./uninstall/retention-policy.js";
|
|
39
37
|
export { PACK_UNINSTALL_GRAPH_BLOCKER_ID, packUninstallRecoveryIdentifiers, planPackUninstallGraphReadiness, type PackRetirement, type PackUninstallGraphReadiness, } from "./packs/uninstall/readiness.js";
|
|
40
38
|
export { type PackUninstallIntent, type PackUninstallRequirements, type ResolvedPackUninstallTarget, } from "./packs/uninstall/plan.js";
|
|
41
39
|
export { getSkillDisplayName } from "./skills/utils.js";
|
|
42
|
-
export { gitHostedSkillArtifactSource, installSkill, type InstallSkillOperation, type InstallSkillOperationArgs, } from "./skills/operations/install.js";
|
|
43
|
-
export type { InstallResult } from "./skills/operations/install-result.js";
|
|
44
40
|
export { enableSkill, type EnableSkillOperation } from "./skills/operations/enable.js";
|
|
45
41
|
export { disableSkill, type DisableSkillOperation } from "./skills/operations/disable.js";
|
|
46
42
|
export { uninstallMcpServer, type UninstallMcpServerOperation, type UninstallMcpServerOperationArgs, } from "./mcps/operations/uninstall.js";
|
package/dist/src/index.js
CHANGED
|
@@ -17,7 +17,6 @@ export { PUBLISHER_CHANGE_CONDITION_ID, publisherChangeRiskCondition, withPublis
|
|
|
17
17
|
// already declares, as one use case behind every command spelling.
|
|
18
18
|
export { InstallExtensions, prepareInstallExtensions, previewOrApplyInstallExtensions, } from "./install/install-extensions.js";
|
|
19
19
|
export { installRefused, } from "./install/vocabulary.js";
|
|
20
|
-
export { ExtensionSelectionCancelled, ExtensionSelectionInteraction, } from "./install/selection-interaction.js";
|
|
21
20
|
export { resolveRootInstallIntent, rootInstallableTypeSegments, RootInstallableTypeSegmentSchema, } from "./install/root-intent.js";
|
|
22
21
|
export { installCommandFor, perTypeInstallPluralSegments } from "./install/per-type-install.js";
|
|
23
22
|
export { buildConfiguredInstallPlan, buildConfiguredPackInstallPlan, } from "./install/configured.js";
|
|
@@ -35,18 +34,16 @@ export { planSubagentInstall } from "./subagents/install/plan.js";
|
|
|
35
34
|
// The bundled official AXM skill, and the asset port the application fills.
|
|
36
35
|
export { BUNDLED_AXM_SKILL_AUTHORED_BLOCKER, BundledAxmSkillAsset, bundledAxmSkillCanonicalPath, inspectBundledAxmSkillReadiness, installBundledAxmSkill, } from "./skills/install/bundled.js";
|
|
37
36
|
// Pack graph transitions: the atomic step and its desired-state predicate.
|
|
38
|
-
export {
|
|
37
|
+
export { validatePackGraphPostcondition } from "./packs/graph-transition.js";
|
|
39
38
|
export { buildPackMemberInstallStep } from "./packs/member-install-step.js";
|
|
40
39
|
export { configuredPackConstraintBlockPlan, prospectivePackConstraintProblems, relevantPackConstraintProblems, } from "./packs/constraint-gate.js";
|
|
41
40
|
// Uninstall: withdrawing extensions, as one use case behind every spelling.
|
|
42
41
|
export { UninstallExtensions, prepareUninstallExtensions, previewOrApplyUninstallExtensions, } from "./uninstall/uninstall-extensions.js";
|
|
43
42
|
export { resolveRootUninstallIntent, rootUninstallableTypeSegments, } from "./uninstall/root-intent.js";
|
|
44
|
-
export { exclusiveMemberRetentionPolicy, makeWorkspaceRetentionPolicy, } from "./uninstall/retention-policy.js";
|
|
45
43
|
export { PACK_UNINSTALL_GRAPH_BLOCKER_ID, packUninstallRecoveryIdentifiers, planPackUninstallGraphReadiness, } from "./packs/uninstall/readiness.js";
|
|
46
44
|
export {} from "./packs/uninstall/plan.js";
|
|
47
45
|
// Skill lifecycle operations
|
|
48
46
|
export { getSkillDisplayName } from "./skills/utils.js";
|
|
49
|
-
export { gitHostedSkillArtifactSource, installSkill, } from "./skills/operations/install.js";
|
|
50
47
|
export { enableSkill } from "./skills/operations/enable.js";
|
|
51
48
|
export { disableSkill } from "./skills/operations/disable.js";
|
|
52
49
|
// MCP server lifecycle operations. Installation itself is a materialization
|
|
@@ -23,8 +23,8 @@ import type { ExtensionResolutionFailed } from "@agentxm/extension-resolution";
|
|
|
23
23
|
import type { ExtensionLifecycleFailed } from "../errors.js";
|
|
24
24
|
import { BundledAxmSkillAsset } from "../skills/install/bundled.js";
|
|
25
25
|
import { type ConfiguredInstallRequirements } from "./configured.js";
|
|
26
|
-
import type
|
|
27
|
-
import {
|
|
26
|
+
import { SkillSelectionInteraction, type SkillSelectionFailure } from "../skills/application/index.js";
|
|
27
|
+
import { SubagentSelectionInteraction, type SubagentSelectionFailure } from "../subagents/application/index.js";
|
|
28
28
|
import { type InstallExecutionFailure, type InstallStepRequirements, type PrepareInstallRequirements } from "./vocabulary.js";
|
|
29
29
|
/**
|
|
30
30
|
* What the request installs: the extensions the workspace already declares,
|
|
@@ -91,9 +91,9 @@ export interface InstallExtensionsCandidate {
|
|
|
91
91
|
* A configured entry's resolution refusal travels with its own category and
|
|
92
92
|
* sentence rather than as this feature's generic refusal.
|
|
93
93
|
*/
|
|
94
|
-
export type InstallExtensionsFailure = ExtensionLifecycleFailed | ExtensionResolutionFailed |
|
|
94
|
+
export type InstallExtensionsFailure = ExtensionLifecycleFailed | ExtensionResolutionFailed | SkillSelectionFailure | SubagentSelectionFailure | InstallExecutionFailure;
|
|
95
95
|
/** Settle an install without writing anything. */
|
|
96
|
-
export declare const prepareInstallExtensions: (request: InstallExtensionsRequest) => Effect.Effect<InstallExtensionsCandidate, InstallExtensionsFailure, PrepareInstallRequirements | ConfiguredInstallRequirements |
|
|
96
|
+
export declare const prepareInstallExtensions: (request: InstallExtensionsRequest) => Effect.Effect<InstallExtensionsCandidate, InstallExtensionsFailure, PrepareInstallRequirements | ConfiguredInstallRequirements | SkillSelectionInteraction | SubagentSelectionInteraction | BundledAxmSkillAsset>;
|
|
97
97
|
/**
|
|
98
98
|
* Everything resolving a settled install writes through: the candidate's own
|
|
99
99
|
* step requirements plus the operation boundary that presents, journals, and
|
|
@@ -104,7 +104,7 @@ export type ResolveInstallExtensionsRequirements = PrepareInstallRequirements |
|
|
|
104
104
|
export declare const previewOrApplyInstallExtensions: (candidate: InstallExtensionsCandidate, execution: PlanExecution) => Effect.Effect<OperationResolution, InstallExtensionsFailure, ResolveInstallExtensionsRequirements>;
|
|
105
105
|
/** The install use case: settle a request, then preview or apply it. */
|
|
106
106
|
export declare const InstallExtensions: {
|
|
107
|
-
readonly prepare: (request: InstallExtensionsRequest) => Effect.Effect<InstallExtensionsCandidate, InstallExtensionsFailure, PrepareInstallRequirements | ConfiguredInstallRequirements |
|
|
107
|
+
readonly prepare: (request: InstallExtensionsRequest) => Effect.Effect<InstallExtensionsCandidate, InstallExtensionsFailure, PrepareInstallRequirements | ConfiguredInstallRequirements | SkillSelectionInteraction | SubagentSelectionInteraction | BundledAxmSkillAsset>;
|
|
108
108
|
readonly previewOrApply: (candidate: InstallExtensionsCandidate, execution: PlanExecution) => Effect.Effect<OperationResolution, InstallExtensionsFailure, ResolveInstallExtensionsRequirements>;
|
|
109
109
|
};
|
|
110
110
|
//# sourceMappingURL=install-extensions.d.ts.map
|
|
@@ -31,7 +31,8 @@ import { BundledAxmSkillAsset, planBundledAxmSkillInstall } from "../skills/inst
|
|
|
31
31
|
import { buildConfiguredInstallPlan } from "./configured.js";
|
|
32
32
|
import { formatRegistryProbe } from "./registry-source-resolution.js";
|
|
33
33
|
import { resolveRootInstallIntent } from "./root-intent.js";
|
|
34
|
-
import {
|
|
34
|
+
import { SkillSelectionInteraction, } from "../skills/application/index.js";
|
|
35
|
+
import { SubagentSelectionInteraction, } from "../subagents/application/index.js";
|
|
35
36
|
import { installRefused, } from "./vocabulary.js";
|
|
36
37
|
const EMPTY_DIAGNOSTICS = { resolutionLines: [], companionPackages: [] };
|
|
37
38
|
const emptyPlan = (request) => ({
|
|
@@ -2,8 +2,8 @@ import * as Effect from "effect/Effect";
|
|
|
2
2
|
import * as Schema from "effect/Schema";
|
|
3
3
|
import type { ExtensionLifecycleFailed } from "../errors.js";
|
|
4
4
|
import { type InstallableExtensionType } from "@agentxm/extension-model/unstable/extensions/installable-types";
|
|
5
|
-
export declare const rootInstallableTypeSegments: readonly ("knowledge" | "rules" | "hooks" | "
|
|
6
|
-
export declare const RootInstallableTypeSegmentSchema: Schema.Literals<readonly ("knowledge" | "rules" | "hooks" | "
|
|
5
|
+
export declare const rootInstallableTypeSegments: readonly ("knowledge" | "rules" | "hooks" | "skills" | "subagents" | "packs" | "mcps")[];
|
|
6
|
+
export declare const RootInstallableTypeSegmentSchema: Schema.Literals<readonly ("knowledge" | "rules" | "hooks" | "skills" | "subagents" | "packs" | "mcps")[]>;
|
|
7
7
|
export type RootInstallableTypeSegment = typeof RootInstallableTypeSegmentSchema.Type;
|
|
8
8
|
export type RootInstallableType = InstallableExtensionType;
|
|
9
9
|
export interface RootInstallIntent {
|
|
@@ -15,7 +15,8 @@ import type * as Path from "effect/Path";
|
|
|
15
15
|
import type * as Scope from "effect/Scope";
|
|
16
16
|
import type * as HttpClient from "effect/unstable/http/HttpClient";
|
|
17
17
|
import type { NativeWriteAuthority } from "@agentxm/agent-integration";
|
|
18
|
-
import type { ManagerRequirements, McpSecretStore
|
|
18
|
+
import type { ManagerRequirements, McpSecretStore } from "@agentxm/extension-materialization";
|
|
19
|
+
import type { RecipeRequirements } from "@agentxm/workspace-reconciliation";
|
|
19
20
|
import type { ExtensionName } from "@agentxm/extension-model/unstable/extensions";
|
|
20
21
|
import type { HookExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/hook";
|
|
21
22
|
import type { KnowledgeExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/knowledge";
|
|
@@ -29,8 +30,8 @@ import type { VersionRange } from "@agentxm/extension-model/unstable/version-con
|
|
|
29
30
|
import type { ExtensionResolutionFailed, PackDependencyRefResolver } from "@agentxm/extension-resolution";
|
|
30
31
|
import type { SourceHostProviders, WorkspaceCatalog } from "@agentxm/extension-sources";
|
|
31
32
|
import type { ApprovalRecoveryMissing, CandidateFingerprintFailed, OperationJournal, PlanInteractionFailed, ResolvePlanInteraction } from "@agentxm/workspace-operations";
|
|
32
|
-
import type { CodingAgentRepository } from "@agentxm/workspace-projection";
|
|
33
|
-
import type { AcceptedCanonicalRefError, ConfiguredAgentOutcomesProvider, LockfileValidationError, WorkspaceMutations, WorkspaceSettingsReadFailure, WorkspaceStateReadFailure } from "@agentxm/workspace-state";
|
|
33
|
+
import type { CodingAgentRepository, WorkspaceInvariantFacts } from "@agentxm/workspace-projection";
|
|
34
|
+
import type { AcceptedCanonicalRefError, ConfiguredAgentOutcomesProvider, LockfileValidationError, LockfileReader, WorkspaceMutations, WorkspaceSettingsReadFailure, WorkspaceStateReadFailure } from "@agentxm/workspace-state";
|
|
34
35
|
import type { FootprintRecorder, WorkspaceTransactionScope, WorkspaceTransitionAcquireFailure } from "@agentxm/workspace-transactions";
|
|
35
36
|
import { ExtensionLifecycleFailed } from "../errors.js";
|
|
36
37
|
/**
|
|
@@ -41,7 +42,7 @@ import { ExtensionLifecycleFailed } from "../errors.js";
|
|
|
41
42
|
* composed once at the application's runtime boundary; nothing is captured
|
|
42
43
|
* into a step's closure on the way, and no failure adapter is among them.
|
|
43
44
|
*/
|
|
44
|
-
export type InstallStepRequirements = ManagerRequirements | RecipeRequirements | McpSecretStore | CodingAgentRepository | WorkspaceMutations | NativeWriteAuthority;
|
|
45
|
+
export type InstallStepRequirements = ManagerRequirements | RecipeRequirements | McpSecretStore | CodingAgentRepository | LockfileReader | WorkspaceInvariantFacts | WorkspaceMutations | NativeWriteAuthority;
|
|
45
46
|
/**
|
|
46
47
|
* What routing a source locator, probing configured registries, and reading
|
|
47
48
|
* what a source contains all need.
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import * as Effect from "effect/Effect";
|
|
11
11
|
import * as Option from "effect/Option";
|
|
12
|
-
import { KnowledgeManager
|
|
12
|
+
import { KnowledgeManager } from "@agentxm/extension-materialization";
|
|
13
|
+
import { extensionRefLifecycleWarnings, extensionRefRegistryLifecycle, targetFromRef, toLabelWithCompanions, toStepKey, } from "@agentxm/workspace-reconciliation";
|
|
13
14
|
import { parseSourceQualifiedRegistrySourcePatternParts, } from "@agentxm/extension-model/unstable/extensions";
|
|
14
15
|
import { SourceHostProviders, resolveSource } from "@agentxm/extension-sources";
|
|
15
16
|
import { operationPresentation, } from "@agentxm/workspace-operations";
|
|
@@ -12,14 +12,15 @@ import * as Effect from "effect/Effect";
|
|
|
12
12
|
import * as FileSystem from "effect/FileSystem";
|
|
13
13
|
import * as Option from "effect/Option";
|
|
14
14
|
import * as Path from "effect/Path";
|
|
15
|
-
import { KnowledgeManager, KnowledgeUnavailable
|
|
15
|
+
import { KnowledgeManager, KnowledgeUnavailable } from "@agentxm/extension-materialization";
|
|
16
|
+
import { buildUninstallOperation } from "@agentxm/workspace-reconciliation";
|
|
16
17
|
import { makeWorkspaceRelativePath } from "@agentxm/extension-model/unstable/path-types";
|
|
17
18
|
import { resolveInstructionsConfig } from "@agentxm/workspace-projection";
|
|
18
19
|
import { WorkspaceMutations, acceptedCanonicalObservation, computeExtensionPathsForLayout, extensionPathSourceFromLockEntry, } from "@agentxm/workspace-state";
|
|
19
20
|
import { ExtensionLifecycleFailed } from "../../errors.js";
|
|
20
21
|
import { lifecycleStepFailure } from "../../step-failure.js";
|
|
21
22
|
import { installRefused } from "../../install/vocabulary.js";
|
|
22
|
-
import { makeWorkspaceRetentionPolicy } from "
|
|
23
|
+
import { makeWorkspaceRetentionPolicy } from "@agentxm/workspace-reconciliation";
|
|
23
24
|
const lockCanonicalRoot = (path, layout, locked) => computeExtensionPathsForLayout(path.join, layout, extensionPathSourceFromLockEntry(locked), "knowledge", locked.workspaceName).canonicalPath;
|
|
24
25
|
/** Settle whether this Knowledge bundle has anything to remove. */
|
|
25
26
|
export const parseKnowledgeUninstallRequest = Effect.fn("UninstallExtensions.parseKnowledgeRequest")(function* (selector) {
|
|
@@ -107,7 +108,7 @@ const inspectOwnership = Effect.fn("UninstallExtensions.inspectKnowledgeOwnershi
|
|
|
107
108
|
export const planKnowledgeUninstall = Effect.fn("UninstallExtensions.planKnowledge")(function* (intent) {
|
|
108
109
|
const ws = yield* WorkspaceMutations;
|
|
109
110
|
const manager = yield* KnowledgeManager;
|
|
110
|
-
const retentionPolicy = makeWorkspaceRetentionPolicy(ws);
|
|
111
|
+
const retentionPolicy = makeWorkspaceRetentionPolicy(ws, lifecycleStepFailure);
|
|
111
112
|
/** The accepted ownership fact, not on-disk presence, decides removability. */
|
|
112
113
|
const isAcceptedTargetPresent = (target) => Effect.gen(function* () {
|
|
113
114
|
const graph = yield* ws.getDesiredStateGraph();
|
|
@@ -14,7 +14,7 @@ import { type ExtensionName, type Handle } from "@agentxm/extension-model/unstab
|
|
|
14
14
|
import type { McpServerExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/mcp-server";
|
|
15
15
|
import type { RegistrySource } from "@agentxm/extension-model/unstable/sources/types";
|
|
16
16
|
import { type Plan } from "@agentxm/workspace-operations";
|
|
17
|
-
import
|
|
17
|
+
import { ExtensionLifecycleFailed } from "../../errors.js";
|
|
18
18
|
import { type InstallStepRequirements, type McpServerInstallIntent, type ResolveInstallRequirements } from "../../install/vocabulary.js";
|
|
19
19
|
/** An MCP install request after grammar parsing, before anything is discovered. */
|
|
20
20
|
export interface ParsedMcpServerInstallRequest {
|
|
@@ -9,16 +9,21 @@
|
|
|
9
9
|
* @experimental This API is unstable and may change without notice.
|
|
10
10
|
*/
|
|
11
11
|
import * as Effect from "effect/Effect";
|
|
12
|
+
import * as FileSystem from "effect/FileSystem";
|
|
13
|
+
import * as Path from "effect/Path";
|
|
12
14
|
import * as Option from "effect/Option";
|
|
13
15
|
import * as Result from "effect/Result";
|
|
14
16
|
import * as Schema from "effect/Schema";
|
|
15
|
-
import { installMcpServer } from "@agentxm/
|
|
17
|
+
import { installMcpServer, readMcpServerManifest } from "@agentxm/workspace-reconciliation";
|
|
18
|
+
import { materializeRegistryPackage } from "@agentxm/extension-materialization";
|
|
19
|
+
import { validateManifestMcpServerTargets } from "@agentxm/agent-integration";
|
|
16
20
|
import { CONFIGURABLE_AGENTS_BY_ID, } from "@agentxm/extension-model/unstable/agent-capabilities";
|
|
17
21
|
import { ExtensionNameSchema, } from "@agentxm/extension-model/unstable/extensions";
|
|
18
22
|
import { intersectVersionConstraints } from "@agentxm/extension-model/unstable/version-constraints";
|
|
19
23
|
import { SourceHostProviders, resolveSource } from "@agentxm/extension-sources";
|
|
20
24
|
import { operationPresentation } from "@agentxm/workspace-operations";
|
|
21
25
|
import { WorkspaceMutations, mcpRegistryResolutionKey } from "@agentxm/workspace-state";
|
|
26
|
+
import { ExtensionLifecycleFailed } from "../../errors.js";
|
|
22
27
|
import { lifecycleStepFailure } from "../../step-failure.js";
|
|
23
28
|
import { registryLoginSuggestions } from "../../install/registry-login-suggestion.js";
|
|
24
29
|
import { parseRegistryInstallTarget } from "../../install/registry-install-target.js";
|
|
@@ -267,6 +272,58 @@ export const planMcpServerInstall = Effect.fn("InstallExtensions.planMcpServer")
|
|
|
267
272
|
});
|
|
268
273
|
}
|
|
269
274
|
}
|
|
275
|
+
yield* Effect.scoped(Effect.gen(function* () {
|
|
276
|
+
const fs = yield* FileSystem.FileSystem;
|
|
277
|
+
const path = yield* Path.Path;
|
|
278
|
+
const ref = intent.ref;
|
|
279
|
+
// Inspect verified package bytes outside the workspace. A fresh install
|
|
280
|
+
// has no canonical manifest for the usual projection inspection to read.
|
|
281
|
+
const manifestPath = ref.refType === "registry"
|
|
282
|
+
? yield* Effect.gen(function* () {
|
|
283
|
+
const scratch = yield* fs.makeTempDirectoryScoped({ prefix: "axm-mcp-preflight-" });
|
|
284
|
+
return yield* materializeRegistryPackage({
|
|
285
|
+
baseDir: scratch,
|
|
286
|
+
destinationPath: path.join(scratch, "package"),
|
|
287
|
+
sourceLocation: ref.source.location,
|
|
288
|
+
owner: ref.owner,
|
|
289
|
+
type: "mcp-server",
|
|
290
|
+
name: ref.name,
|
|
291
|
+
version: ref.version,
|
|
292
|
+
integrity: ref.integrity,
|
|
293
|
+
messages: {
|
|
294
|
+
integrityMismatchDetail: `Integrity mismatch for ${ref.name}@${ref.version}`,
|
|
295
|
+
},
|
|
296
|
+
});
|
|
297
|
+
})
|
|
298
|
+
: ref.location;
|
|
299
|
+
const manifest = yield* readMcpServerManifest(manifestPath);
|
|
300
|
+
if (Option.isNone(manifest)) {
|
|
301
|
+
return yield* installRefused({
|
|
302
|
+
category: "validation",
|
|
303
|
+
detail: `Cannot read MCP manifest for ${intent.localName}`,
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
const entries = yield* ws.getConfiguredMcpServerEntries();
|
|
307
|
+
yield* validateManifestMcpServerTargets({
|
|
308
|
+
manifest: manifest.value,
|
|
309
|
+
agentIds: yield* ws.getConfiguredAgents(),
|
|
310
|
+
scope: ws.scope,
|
|
311
|
+
serverName: intent.localName,
|
|
312
|
+
values: { ...entries[intent.localName]?.env, ...intent.env },
|
|
313
|
+
enabled: entries[intent.localName]?.enabled ?? true,
|
|
314
|
+
}).pipe(Effect.mapError((cause) => installRefused({
|
|
315
|
+
category: "conflict",
|
|
316
|
+
detail: cause.reason,
|
|
317
|
+
recover: "Use an MCP package whose transport and symbolic inputs are supported by every configured reader of the shared target.",
|
|
318
|
+
cause,
|
|
319
|
+
})));
|
|
320
|
+
})).pipe(Effect.mapError((cause) => cause instanceof ExtensionLifecycleFailed
|
|
321
|
+
? cause
|
|
322
|
+
: installRefused({
|
|
323
|
+
category: "validation",
|
|
324
|
+
detail: `Cannot inspect MCP package ${intent.localName}`,
|
|
325
|
+
cause,
|
|
326
|
+
})));
|
|
270
327
|
return {
|
|
271
328
|
_tag: "Plan",
|
|
272
329
|
name: "Install MCP server",
|
|
@@ -287,8 +344,7 @@ export const planMcpServerInstall = Effect.fn("InstallExtensions.planMcpServer")
|
|
|
287
344
|
localName: intent.localName,
|
|
288
345
|
nonInteractive: intent.nonInteractive,
|
|
289
346
|
force: intent.force,
|
|
290
|
-
versionRange: intent.versionRange,
|
|
291
|
-
skipSettings: Option.none(),
|
|
347
|
+
declaration: { name: intent.localName, versionRange: intent.versionRange },
|
|
292
348
|
env: Option.some(intent.env ?? {}),
|
|
293
349
|
},
|
|
294
350
|
}).pipe(Effect.mapError(lifecycleStepFailure)),
|
|
@@ -18,7 +18,8 @@ import { appendWarningsToMessage } from "@agentxm/workspace-operations";
|
|
|
18
18
|
import { WorkspaceMutations } from "@agentxm/workspace-state";
|
|
19
19
|
import { removeIfExists } from "@agentxm/workspace-state";
|
|
20
20
|
import { acceptedCanonicalObservation, acceptedLockedCanonicalPath, removableAcceptedCanonicalPath, } from "@agentxm/workspace-state";
|
|
21
|
-
import { agentConfigTarget,
|
|
21
|
+
import { agentConfigTarget, mcpServerArtifact, mcpSettingsTarget, McpSecretStore, } from "@agentxm/extension-materialization";
|
|
22
|
+
import { collectSecretInputNames, deleteMcpSecrets, readMcpServerManifest, } from "@agentxm/workspace-reconciliation";
|
|
22
23
|
import { StepFailureConversion, withAdaptedStepFailures } from "../../step-failure-conversion.js";
|
|
23
24
|
import { ExtensionLifecycleFailed } from "../../errors.js";
|
|
24
25
|
const REQUIRED_AGENT_IDS = new Set([
|
|
@@ -13,11 +13,13 @@ import * as Effect from "effect/Effect";
|
|
|
13
13
|
import * as FileSystem from "effect/FileSystem";
|
|
14
14
|
import * as Option from "effect/Option";
|
|
15
15
|
import * as Path from "effect/Path";
|
|
16
|
-
import { McpServerManager,
|
|
16
|
+
import { McpServerManager, mcpServerArtifact, mcpSourceTarget, } from "@agentxm/extension-materialization";
|
|
17
|
+
import { collectSecretInputNames, deleteMcpSecrets, readMcpServerManifest, } from "@agentxm/workspace-reconciliation";
|
|
18
|
+
import { buildUninstallOperation } from "@agentxm/workspace-reconciliation";
|
|
17
19
|
import { appendWarningsToMessage, } from "@agentxm/workspace-operations";
|
|
18
20
|
import { WorkspaceMutations, acceptedLockedCanonicalPath, } from "@agentxm/workspace-state";
|
|
19
21
|
import { lifecycleStepFailure } from "../../step-failure.js";
|
|
20
|
-
import { makeWorkspaceRetentionPolicy } from "
|
|
22
|
+
import { makeWorkspaceRetentionPolicy } from "@agentxm/workspace-reconciliation";
|
|
21
23
|
import { workspaceLockfilePath, workspaceSettingsPath } from "../../workspace-paths.js";
|
|
22
24
|
/** One local connection name is removed at a time. */
|
|
23
25
|
export const parseMcpServerUninstallRequest = (selector) => ({
|
|
@@ -28,7 +30,7 @@ export const planMcpServerUninstall = Effect.fn("UninstallExtensions.planMcpServ
|
|
|
28
30
|
const ws = yield* WorkspaceMutations;
|
|
29
31
|
const mcpServerManager = yield* McpServerManager;
|
|
30
32
|
const path = yield* Path.Path;
|
|
31
|
-
const retentionPolicy = makeWorkspaceRetentionPolicy(ws);
|
|
33
|
+
const retentionPolicy = makeWorkspaceRetentionPolicy(ws, lifecycleStepFailure);
|
|
32
34
|
const steps = intent.targets.map((target) => {
|
|
33
35
|
const step = buildUninstallOperation(mcpServerManager, retentionPolicy, {
|
|
34
36
|
toStepFailure: lifecycleStepFailure,
|
|
@@ -63,7 +65,14 @@ export const planMcpServerUninstall = Effect.fn("UninstallExtensions.planMcpServ
|
|
|
63
65
|
onNone: () => new Set(),
|
|
64
66
|
onSome: collectSecretInputNames,
|
|
65
67
|
});
|
|
66
|
-
const
|
|
68
|
+
const remaining = yield* ws
|
|
69
|
+
.getDesiredStateGraph()
|
|
70
|
+
.pipe(Effect.mapError(lifecycleStepFailure));
|
|
71
|
+
const remainsDesired = remaining.nodes.some((node) => node.type === "mcp-server" && node.name === target.name);
|
|
72
|
+
const secretDeletionWarnings = unchanged ||
|
|
73
|
+
remainsDesired ||
|
|
74
|
+
desiredNode === undefined ||
|
|
75
|
+
desiredNode.authority === "inline"
|
|
67
76
|
? []
|
|
68
77
|
: (yield* deleteMcpSecrets({
|
|
69
78
|
scopeRoot: path.resolve(ws.baseDir),
|
|
@@ -11,32 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import * as Effect from "effect/Effect";
|
|
13
13
|
import { WorkspaceMutations, type DesiredExtensionNode } from "@agentxm/workspace-state";
|
|
14
|
-
import { type JobStepArtifact, type PlannedJobStep } from "@agentxm/workspace-operations";
|
|
15
14
|
import type { ExtensionLifecycleFailed } from "../errors.js";
|
|
16
|
-
import { type LifecycleStepFailure } from "../step-failure.js";
|
|
17
|
-
import { type InstallStepRequirements } from "../install/vocabulary.js";
|
|
18
|
-
export interface AtomicPackGraphChild {
|
|
19
|
-
readonly step: PlannedJobStep<InstallStepRequirements>;
|
|
20
|
-
readonly coverage: "eligible" | "ineligible";
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* What a pack transition checks before it writes and after it commits. The
|
|
24
|
-
* checks are the planner's, so their failure family and their requirements
|
|
25
|
-
* travel with them rather than being fixed here.
|
|
26
|
-
*/
|
|
27
|
-
export interface AtomicPackGraphStepArgs<E extends LifecycleStepFailure, R> {
|
|
28
|
-
readonly label: string;
|
|
29
|
-
readonly message: string;
|
|
30
|
-
readonly artifact: JobStepArtifact;
|
|
31
|
-
readonly children: ReadonlyArray<AtomicPackGraphChild>;
|
|
32
|
-
readonly reportUnchangedWhenChildrenUnchanged?: boolean;
|
|
33
|
-
/** A stale-candidate check that runs under the transition, before any write. */
|
|
34
|
-
readonly preTransition?: Effect.Effect<void, E, R>;
|
|
35
|
-
/** The desired-graph predicate the committed transition must satisfy. */
|
|
36
|
-
readonly validate: Effect.Effect<void, E, R>;
|
|
37
|
-
}
|
|
38
|
-
/** Wrap a pack transition's children in one workspace transaction. */
|
|
39
|
-
export declare const buildAtomicPackGraphStep: <E extends LifecycleStepFailure, R>(args: AtomicPackGraphStepArgs<E, R>) => Effect.Effect<PlannedJobStep<InstallStepRequirements | R>>;
|
|
40
15
|
interface RequiredPack {
|
|
41
16
|
readonly name: string;
|
|
42
17
|
readonly identity: string;
|