@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,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Installing Open Knowledge Format bundles.
|
|
3
|
+
*
|
|
4
|
+
* A bundle becomes discoverable through the shared discovery region, so
|
|
5
|
+
* several bundles in one operation defer that render until every contributor
|
|
6
|
+
* has landed.
|
|
7
|
+
*
|
|
8
|
+
* @experimental This API is unstable and may change without notice.
|
|
9
|
+
*/
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
import * as Option from "effect/Option";
|
|
12
|
+
import { KnowledgeManager, extensionRefLifecycleWarnings, extensionRefRegistryLifecycle, targetFromRef, toLabelWithCompanions, toStepKey, } from "@agentxm/extension-materialization";
|
|
13
|
+
import { parseSourceQualifiedRegistrySourcePatternParts, } from "@agentxm/extension-model/unstable/extensions";
|
|
14
|
+
import { SourceHostProviders, resolveSource } from "@agentxm/extension-sources";
|
|
15
|
+
import { operationPresentation, } from "@agentxm/workspace-operations";
|
|
16
|
+
import { applyPlannedProjections } from "@agentxm/workspace-projection";
|
|
17
|
+
import { lifecycleStepFailure } from "../../step-failure.js";
|
|
18
|
+
import { registryLoginSuggestions } from "../../install/registry-login-suggestion.js";
|
|
19
|
+
import { installRefused, } from "../../install/vocabulary.js";
|
|
20
|
+
/** Read the knowledge source grammar: which owner, which names, which range. */
|
|
21
|
+
export const parseKnowledgeInstallRequest = Effect.fn("InstallExtensions.parseKnowledgeRequest")(function* (source) {
|
|
22
|
+
const input = source.trim();
|
|
23
|
+
const parsed = parseSourceQualifiedRegistrySourcePatternParts(input);
|
|
24
|
+
const resolved = yield* resolveSource(input).pipe(Effect.mapError((cause) => installRefused({
|
|
25
|
+
category: "validation",
|
|
26
|
+
detail: `Invalid knowledge source: ${cause.message}`,
|
|
27
|
+
cause,
|
|
28
|
+
})));
|
|
29
|
+
return {
|
|
30
|
+
source: resolved,
|
|
31
|
+
names: parsed?.type === "knowledge" && parsed.name !== undefined ? [parsed.name] : [],
|
|
32
|
+
owner: parsed?.type === "knowledge"
|
|
33
|
+
? Option.some(parsed.owner)
|
|
34
|
+
: resolved.type === "registry"
|
|
35
|
+
? resolved.owner
|
|
36
|
+
: Option.none(),
|
|
37
|
+
versionRange: resolved.type === "registry" && parsed?.type === "knowledge"
|
|
38
|
+
? Option.fromUndefinedOr(parsed.versionRange)
|
|
39
|
+
: Option.none(),
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
/** Discover the knowledge bundles the parsed source offers. */
|
|
43
|
+
export const discoverKnowledgeRefs = Effect.fn("InstallExtensions.discoverKnowledge")(function* (request) {
|
|
44
|
+
const sources = yield* SourceHostProviders;
|
|
45
|
+
return yield* sources
|
|
46
|
+
.find(request.source, {
|
|
47
|
+
names: request.names,
|
|
48
|
+
type: "knowledge",
|
|
49
|
+
owner: request.owner,
|
|
50
|
+
versionRange: request.versionRange,
|
|
51
|
+
})
|
|
52
|
+
.pipe(Effect.mapError((cause) => installRefused({
|
|
53
|
+
category: "network",
|
|
54
|
+
detail: "Knowledge bundles could not be discovered from the source",
|
|
55
|
+
cause,
|
|
56
|
+
})), Effect.map((refs) => refs.filter((ref) => ref.type === "knowledge")));
|
|
57
|
+
});
|
|
58
|
+
/** Settle which knowledge bundles this request installs, or refuse when none matched. */
|
|
59
|
+
export const finalizeKnowledgeInstallIntent = Effect.fn("InstallExtensions.finalizeKnowledgeIntent")(function* (request, refs) {
|
|
60
|
+
if (refs.length === 0) {
|
|
61
|
+
const suggestions = request.source.type === "registry"
|
|
62
|
+
? yield* registryLoginSuggestions([request.source.location.href])
|
|
63
|
+
: [];
|
|
64
|
+
return yield* installRefused({
|
|
65
|
+
category: "not_found",
|
|
66
|
+
detail: "No knowledge bundles found in source",
|
|
67
|
+
suggestions,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
refs: refs.map((ref) => ({
|
|
72
|
+
ref,
|
|
73
|
+
versionRange: ref.refType === "registry" ? request.versionRange : Option.none(),
|
|
74
|
+
})),
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
/** The closures a settled knowledge intent becomes. */
|
|
78
|
+
export const planKnowledgeInstall = Effect.fn("InstallExtensions.planKnowledge")(function* (intent) {
|
|
79
|
+
const manager = yield* KnowledgeManager;
|
|
80
|
+
const deferProjections = intent.deferProjections === true || intent.refs.length > 1;
|
|
81
|
+
const memberSteps = intent.refs.map(({ ref, versionRange }) => {
|
|
82
|
+
const target = targetFromRef(ref);
|
|
83
|
+
const packages = ref.refType === "registry" ? ref.packages : [];
|
|
84
|
+
const base = {
|
|
85
|
+
key: toStepKey(target),
|
|
86
|
+
label: toLabelWithCompanions(target, packages),
|
|
87
|
+
run: manager.install({ ref, versionRange, deferProjection: deferProjections }).pipe(Effect.mapError(lifecycleStepFailure), Effect.as({
|
|
88
|
+
result: "success",
|
|
89
|
+
message: `Installed ${ref.knowledge.name}`,
|
|
90
|
+
})),
|
|
91
|
+
};
|
|
92
|
+
const warnings = extensionRefLifecycleWarnings(ref);
|
|
93
|
+
const registryLifecycle = extensionRefRegistryLifecycle(ref);
|
|
94
|
+
return warnings.length === 0
|
|
95
|
+
? {
|
|
96
|
+
...base,
|
|
97
|
+
readiness: "ready",
|
|
98
|
+
...(registryLifecycle === undefined ? {} : { registryLifecycle }),
|
|
99
|
+
}
|
|
100
|
+
: {
|
|
101
|
+
...base,
|
|
102
|
+
readiness: "warn",
|
|
103
|
+
warnMessage: warnings.join("; "),
|
|
104
|
+
...(registryLifecycle === undefined ? {} : { registryLifecycle }),
|
|
105
|
+
};
|
|
106
|
+
});
|
|
107
|
+
const projectionSteps = deferProjections && intent.deferProjections !== true
|
|
108
|
+
? [
|
|
109
|
+
{
|
|
110
|
+
key: "projection:knowledge:discovery-region",
|
|
111
|
+
label: "knowledge projection",
|
|
112
|
+
readiness: "ready",
|
|
113
|
+
run: applyPlannedProjections(manager).pipe(Effect.mapError(lifecycleStepFailure), Effect.as({
|
|
114
|
+
result: "success",
|
|
115
|
+
message: "Rendered installed Knowledge bundles from the complete contributor set",
|
|
116
|
+
})),
|
|
117
|
+
},
|
|
118
|
+
]
|
|
119
|
+
: [];
|
|
120
|
+
return {
|
|
121
|
+
_tag: "Plan",
|
|
122
|
+
name: "Install knowledge",
|
|
123
|
+
description: Option.some("Install Open Knowledge Format bundle"),
|
|
124
|
+
presentation: operationPresentation({ imperative: "install", past: "Installed", gerund: "Installing" }, "knowledge"),
|
|
125
|
+
jobs: [{ concurrency: 1, steps: [...memberSteps, ...projectionSteps] }],
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
//# sourceMappingURL=plan.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Uninstalling a Knowledge bundle.
|
|
3
|
+
*
|
|
4
|
+
* Canonical Knowledge content that AXM never accepted ownership of belongs to
|
|
5
|
+
* whoever put it there. A removal that would delete such content is refused
|
|
6
|
+
* and says how to take ownership instead, so an unowned surface is preserved
|
|
7
|
+
* rather than silently destroyed.
|
|
8
|
+
*
|
|
9
|
+
* @experimental This API is unstable and may change without notice.
|
|
10
|
+
*/
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
12
|
+
import * as FileSystem from "effect/FileSystem";
|
|
13
|
+
import * as Path from "effect/Path";
|
|
14
|
+
import { KnowledgeManager } from "@agentxm/extension-materialization";
|
|
15
|
+
import type { Plan } from "@agentxm/workspace-operations";
|
|
16
|
+
import { ExtensionLifecycleFailed } from "../../errors.js";
|
|
17
|
+
import { type InstallStepRequirements } from "../../install/vocabulary.js";
|
|
18
|
+
import type { KnowledgeUninstallIntent } from "../../uninstall/vocabulary.js";
|
|
19
|
+
/** Settle whether this Knowledge bundle has anything to remove. */
|
|
20
|
+
export declare const parseKnowledgeUninstallRequest: (selector: string) => Effect.Effect<KnowledgeUninstallIntent, ExtensionLifecycleFailed, InstallStepRequirements | KnowledgeManager | FileSystem.FileSystem | Path.Path>;
|
|
21
|
+
/** The closures a settled Knowledge removal becomes. */
|
|
22
|
+
export declare const planKnowledgeUninstall: (intent: KnowledgeUninstallIntent) => Effect.Effect<Plan<InstallStepRequirements>, ExtensionLifecycleFailed, InstallStepRequirements | KnowledgeManager | FileSystem.FileSystem | Path.Path>;
|
|
23
|
+
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Uninstalling a Knowledge bundle.
|
|
3
|
+
*
|
|
4
|
+
* Canonical Knowledge content that AXM never accepted ownership of belongs to
|
|
5
|
+
* whoever put it there. A removal that would delete such content is refused
|
|
6
|
+
* and says how to take ownership instead, so an unowned surface is preserved
|
|
7
|
+
* rather than silently destroyed.
|
|
8
|
+
*
|
|
9
|
+
* @experimental This API is unstable and may change without notice.
|
|
10
|
+
*/
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
12
|
+
import * as FileSystem from "effect/FileSystem";
|
|
13
|
+
import * as Option from "effect/Option";
|
|
14
|
+
import * as Path from "effect/Path";
|
|
15
|
+
import { KnowledgeManager, KnowledgeUnavailable, buildUninstallOperation, } from "@agentxm/extension-materialization";
|
|
16
|
+
import { makeWorkspaceRelativePath } from "@agentxm/extension-model/unstable/path-types";
|
|
17
|
+
import { resolveInstructionsConfig } from "@agentxm/workspace-projection";
|
|
18
|
+
import { WorkspaceMutations, acceptedCanonicalObservation, computeExtensionPathsForLayout, extensionPathSourceFromLockEntry, } from "@agentxm/workspace-state";
|
|
19
|
+
import { ExtensionLifecycleFailed } from "../../errors.js";
|
|
20
|
+
import { lifecycleStepFailure } from "../../step-failure.js";
|
|
21
|
+
import { installRefused } from "../../install/vocabulary.js";
|
|
22
|
+
import { makeWorkspaceRetentionPolicy } from "../../uninstall/retention-policy.js";
|
|
23
|
+
const lockCanonicalRoot = (path, layout, locked) => computeExtensionPathsForLayout(path.join, layout, extensionPathSourceFromLockEntry(locked), "knowledge", locked.workspaceName).canonicalPath;
|
|
24
|
+
/** Settle whether this Knowledge bundle has anything to remove. */
|
|
25
|
+
export const parseKnowledgeUninstallRequest = Effect.fn("UninstallExtensions.parseKnowledgeRequest")(function* (selector) {
|
|
26
|
+
const ws = yield* WorkspaceMutations;
|
|
27
|
+
const manager = yield* KnowledgeManager;
|
|
28
|
+
const fs = yield* FileSystem.FileSystem;
|
|
29
|
+
const path = yield* Path.Path;
|
|
30
|
+
const target = { type: "knowledge", name: selector.trim() };
|
|
31
|
+
return yield* Effect.gen(function* () {
|
|
32
|
+
const configured = manager.getConfiguredSource === undefined
|
|
33
|
+
? Option.none()
|
|
34
|
+
: yield* manager.getConfiguredSource({ target });
|
|
35
|
+
const installed = yield* manager.isInstalled({ target });
|
|
36
|
+
const locked = yield* ws.getLockedKnowledgeEntry(target.name);
|
|
37
|
+
const authoredPackagePresent = ws.layout.scope === "project" &&
|
|
38
|
+
(yield* fs.exists(path.join(ws.layout.authoredRoot("knowledge"), target.name)));
|
|
39
|
+
if (Option.isNone(configured) && Option.isNone(locked) && authoredPackagePresent) {
|
|
40
|
+
return { targets: [] };
|
|
41
|
+
}
|
|
42
|
+
if (Option.isNone(configured) && Option.isNone(locked) && !installed) {
|
|
43
|
+
return { targets: [] };
|
|
44
|
+
}
|
|
45
|
+
return { targets: [target] };
|
|
46
|
+
}).pipe(Effect.mapError((cause) => installRefused({
|
|
47
|
+
category: "internal",
|
|
48
|
+
detail: `Knowledge bundle "${target.name}" declaration could not be read`,
|
|
49
|
+
cause,
|
|
50
|
+
})));
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Whether AXM has an accepted ownership fact for the content it would delete,
|
|
54
|
+
* and whether the managed instructions target it would rewrite is inside the
|
|
55
|
+
* workspace at all.
|
|
56
|
+
*/
|
|
57
|
+
const inspectOwnership = Effect.fn("UninstallExtensions.inspectKnowledgeOwnership")(function* (target) {
|
|
58
|
+
const ws = yield* WorkspaceMutations;
|
|
59
|
+
const path = yield* Path.Path;
|
|
60
|
+
return yield* Effect.gen(function* () {
|
|
61
|
+
const configured = yield* ws.getConfiguredKnowledgeEntries();
|
|
62
|
+
const locked = yield* ws.getLockedKnowledgeEntry(target.name);
|
|
63
|
+
const graph = yield* ws.getDesiredStateGraph();
|
|
64
|
+
const desired = graph.nodes.find((node) => node.type === "knowledge" && node.name === target.name);
|
|
65
|
+
const acceptedObservation = desired === undefined
|
|
66
|
+
? Option.none()
|
|
67
|
+
: yield* acceptedCanonicalObservation({
|
|
68
|
+
workspace: ws,
|
|
69
|
+
type: "knowledge",
|
|
70
|
+
name: target.name,
|
|
71
|
+
});
|
|
72
|
+
const expectedCanonicalPath = Option.match(acceptedObservation, {
|
|
73
|
+
onNone: () => Option.isSome(locked) ? lockCanonicalRoot(path, ws.layout, locked.value) : undefined,
|
|
74
|
+
onSome: (accepted) => accepted.observation.path,
|
|
75
|
+
});
|
|
76
|
+
const inventory = yield* ws.records.getExtensionInventory("knowledge", {});
|
|
77
|
+
const actualPaths = inventory.items
|
|
78
|
+
.filter((item) => item.name === target.name)
|
|
79
|
+
.flatMap((item) => item.paths.map((itemPath) => path.resolve(ws.baseDir, itemPath)));
|
|
80
|
+
const normalizedExpected = expectedCanonicalPath === undefined ? undefined : path.resolve(expectedCanonicalPath);
|
|
81
|
+
const workspaceOwned = desired?.identity.startsWith("workspace:") === true;
|
|
82
|
+
const hasAcceptedOwnership = workspaceOwned || Option.isSome(locked);
|
|
83
|
+
const settingsPresent = configured[target.name] !== undefined;
|
|
84
|
+
const instructionsConfig = yield* ws.getInstructionsConfig();
|
|
85
|
+
const resolvedInstructions = resolveInstructionsConfig(Option.match(instructionsConfig, {
|
|
86
|
+
onNone: () => undefined,
|
|
87
|
+
onSome: (value) => (value === false ? undefined : value),
|
|
88
|
+
}));
|
|
89
|
+
const instructionRelative = makeWorkspaceRelativePath(path, ws.baseDir, resolvedInstructions.fileName);
|
|
90
|
+
const ownershipBlocker = actualPaths.length === 0 || (hasAcceptedOwnership && normalizedExpected !== undefined)
|
|
91
|
+
? undefined
|
|
92
|
+
: settingsPresent && !workspaceOwned
|
|
93
|
+
? `Cannot uninstall Knowledge bundle "${target.name}": canonical Knowledge content is present, but its accepted resolution is missing. AXM will preserve the unowned canonical surface. Run \`axm adopt <extension>\` to transfer it into AXM ownership, or leave it for its current owner.`
|
|
94
|
+
: `Cannot uninstall Knowledge bundle "${target.name}": canonical Knowledge content has no accepted AXM ownership fact. AXM will preserve the unowned canonical surface. Run \`axm adopt <extension>\` to transfer it into AXM ownership, or leave it for its current owner.`;
|
|
95
|
+
const blocker = ownershipBlocker ??
|
|
96
|
+
(Option.isNone(instructionRelative)
|
|
97
|
+
? `Cannot uninstall Knowledge bundle "${target.name}": the managed instructions target is outside the workspace. Configure a workspace-relative instructions target and retry.`
|
|
98
|
+
: undefined);
|
|
99
|
+
return { target, ...(blocker === undefined ? {} : { blocker }) };
|
|
100
|
+
}).pipe(Effect.mapError((cause) => installRefused({
|
|
101
|
+
category: "internal",
|
|
102
|
+
detail: `Knowledge ownership for "${target.name}" could not be inspected`,
|
|
103
|
+
cause,
|
|
104
|
+
})));
|
|
105
|
+
});
|
|
106
|
+
/** The closures a settled Knowledge removal becomes. */
|
|
107
|
+
export const planKnowledgeUninstall = Effect.fn("UninstallExtensions.planKnowledge")(function* (intent) {
|
|
108
|
+
const ws = yield* WorkspaceMutations;
|
|
109
|
+
const manager = yield* KnowledgeManager;
|
|
110
|
+
const retentionPolicy = makeWorkspaceRetentionPolicy(ws);
|
|
111
|
+
/** The accepted ownership fact, not on-disk presence, decides removability. */
|
|
112
|
+
const isAcceptedTargetPresent = (target) => Effect.gen(function* () {
|
|
113
|
+
const graph = yield* ws.getDesiredStateGraph();
|
|
114
|
+
const desired = graph.nodes.find((node) => node.type === "knowledge" && node.name === target.name);
|
|
115
|
+
const locked = yield* ws.getLockedKnowledgeEntry(target.name);
|
|
116
|
+
return desired?.identity.startsWith("workspace:") === true || Option.isSome(locked);
|
|
117
|
+
}).pipe(Effect.mapError((cause) => new KnowledgeUnavailable({
|
|
118
|
+
detail: `Accepted ownership for Knowledge bundle "${target.name}" could not be read`,
|
|
119
|
+
cause,
|
|
120
|
+
})));
|
|
121
|
+
const ownership = yield* Effect.forEach(intent.targets, inspectOwnership);
|
|
122
|
+
const steps = ownership.map((entry) => {
|
|
123
|
+
if (entry.blocker !== undefined) {
|
|
124
|
+
return {
|
|
125
|
+
key: `knowledge:${entry.target.name}`,
|
|
126
|
+
readiness: "error",
|
|
127
|
+
label: entry.target.name,
|
|
128
|
+
errorMessage: entry.blocker,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
return buildUninstallOperation({ ...manager, isInstalled: () => isAcceptedTargetPresent(entry.target) }, retentionPolicy, { target: entry.target, toStepFailure: lifecycleStepFailure });
|
|
132
|
+
});
|
|
133
|
+
return {
|
|
134
|
+
_tag: "Plan",
|
|
135
|
+
name: "Uninstall knowledge",
|
|
136
|
+
description: Option.some("Uninstall Open Knowledge Format bundle"),
|
|
137
|
+
jobs: [{ concurrency: 1, steps }],
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
//# sourceMappingURL=plan.js.map
|
package/dist/src/live.d.ts
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Environment-backed layers of the extension-lifecycle feature: the
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Environment-backed layers of the extension-lifecycle feature: the
|
|
3
|
+
* hook-backed configured-agent-outcomes provider. The per-extension-type
|
|
4
|
+
* manager implementations and their projection-participant registration live
|
|
5
|
+
* in `@agentxm/extension-materialization/live`.
|
|
6
6
|
*
|
|
7
7
|
* @experimental All exports from this module are unstable and may change without notice.
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
|
-
export { HookManagerLive } from "./hooks/manager.js";
|
|
11
10
|
export { HookConfiguredAgentOutcomesProviderLive } from "./hooks/configured-agent-outcomes-provider.js";
|
|
12
|
-
export { RuleManagerLive } from "./rules/manager.js";
|
|
13
|
-
export { SkillManagerLive } from "./skills/manager.js";
|
|
14
|
-
export { SubagentManagerLive } from "./subagents/manager.js";
|
|
15
|
-
export { McpServerManagerLive } from "./mcps/manager.js";
|
|
16
|
-
export { PackManagerLive } from "./packs/manager.js";
|
|
17
|
-
export { KnowledgeManagerLive } from "./knowledge/manager.js";
|
|
18
11
|
//# sourceMappingURL=live.d.ts.map
|
package/dist/src/live.js
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Environment-backed layers of the extension-lifecycle feature: the
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Environment-backed layers of the extension-lifecycle feature: the
|
|
3
|
+
* hook-backed configured-agent-outcomes provider. The per-extension-type
|
|
4
|
+
* manager implementations and their projection-participant registration live
|
|
5
|
+
* in `@agentxm/extension-materialization/live`.
|
|
6
6
|
*
|
|
7
7
|
* @experimental All exports from this module are unstable and may change without notice.
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
|
-
export { HookManagerLive } from "./hooks/manager.js";
|
|
11
10
|
export { HookConfiguredAgentOutcomesProviderLive } from "./hooks/configured-agent-outcomes-provider.js";
|
|
12
|
-
export { RuleManagerLive } from "./rules/manager.js";
|
|
13
|
-
export { SkillManagerLive } from "./skills/manager.js";
|
|
14
|
-
export { SubagentManagerLive } from "./subagents/manager.js";
|
|
15
|
-
export { McpServerManagerLive } from "./mcps/manager.js";
|
|
16
|
-
export { PackManagerLive } from "./packs/manager.js";
|
|
17
|
-
export { KnowledgeManagerLive } from "./knowledge/manager.js";
|
|
18
11
|
//# sourceMappingURL=live.js.map
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Installing an MCP connection from the registry.
|
|
3
|
+
*
|
|
4
|
+
* An MCP server is acquired once and referenced by a local connection name, so
|
|
5
|
+
* this decides who owns that name, which version constraint every origin
|
|
6
|
+
* referencing the same server agrees on, and whether the selected workspace
|
|
7
|
+
* scope can hold an MCP configuration at all.
|
|
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 { type ExtensionName, type Handle } from "@agentxm/extension-model/unstable/extensions";
|
|
14
|
+
import type { McpServerExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/mcp-server";
|
|
15
|
+
import type { RegistrySource } from "@agentxm/extension-model/unstable/sources/types";
|
|
16
|
+
import { type Plan } from "@agentxm/workspace-operations";
|
|
17
|
+
import type { ExtensionLifecycleFailed } from "../../errors.js";
|
|
18
|
+
import { type InstallStepRequirements, type McpServerInstallIntent, type ResolveInstallRequirements } from "../../install/vocabulary.js";
|
|
19
|
+
/** An MCP install request after grammar parsing, before anything is discovered. */
|
|
20
|
+
export interface ParsedMcpServerInstallRequest {
|
|
21
|
+
readonly owner: Handle;
|
|
22
|
+
readonly serverName: ExtensionName;
|
|
23
|
+
readonly localName: ExtensionName;
|
|
24
|
+
readonly versionRange: Option.Option<string>;
|
|
25
|
+
readonly resolvedInput: string;
|
|
26
|
+
readonly force: boolean;
|
|
27
|
+
readonly nonInteractive: boolean;
|
|
28
|
+
readonly env: Readonly<Record<string, string>>;
|
|
29
|
+
}
|
|
30
|
+
/** One MCP registry lookup, with the constraint every origin agrees on. */
|
|
31
|
+
export interface McpServerInstallSourceRequest {
|
|
32
|
+
readonly source: RegistrySource;
|
|
33
|
+
readonly owner: Handle;
|
|
34
|
+
readonly serverName: ExtensionName;
|
|
35
|
+
readonly versionRange: Option.Option<string>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Decode repeated `--env KEY=VALUE` inputs into a record. Later occurrences of
|
|
39
|
+
* the same key win. Registry installs resolve declared inputs by name, so a
|
|
40
|
+
* bare `KEY` (passthrough from the ambient environment, as `axm mcps add`
|
|
41
|
+
* allows) is refused here rather than silently resolving to nothing.
|
|
42
|
+
*/
|
|
43
|
+
export declare const parseMcpEnvInputs: (env: ReadonlyArray<string>) => Effect.Effect<Readonly<Record<string, string>>, ExtensionLifecycleFailed>;
|
|
44
|
+
/** What an MCP install command supplies before anything is parsed. */
|
|
45
|
+
export interface McpServerInstallArgs {
|
|
46
|
+
readonly source: string;
|
|
47
|
+
readonly localName: Option.Option<string>;
|
|
48
|
+
readonly env: ReadonlyArray<string>;
|
|
49
|
+
readonly force: boolean;
|
|
50
|
+
readonly nonInteractive: boolean;
|
|
51
|
+
}
|
|
52
|
+
/** Read the MCP source grammar and settle the local connection name. */
|
|
53
|
+
export declare const parseMcpServerInstallRequest: (args: McpServerInstallArgs) => Effect.Effect<ParsedMcpServerInstallRequest, ExtensionLifecycleFailed, ResolveInstallRequirements>;
|
|
54
|
+
/**
|
|
55
|
+
* Decide which local name may own the connection and which version constraint
|
|
56
|
+
* every origin referencing the same registry server can agree on.
|
|
57
|
+
*/
|
|
58
|
+
export declare const resolveMcpServerSourceRequest: (request: ParsedMcpServerInstallRequest) => Effect.Effect<McpServerInstallSourceRequest, ExtensionLifecycleFailed, ResolveInstallRequirements>;
|
|
59
|
+
/** Discover the MCP server the resolved request names. */
|
|
60
|
+
export declare const discoverMcpServerRefs: (request: McpServerInstallSourceRequest) => Effect.Effect<ReadonlyArray<McpServerExtensionRef>, ExtensionLifecycleFailed, ResolveInstallRequirements>;
|
|
61
|
+
/** Settle the connection this request installs, or refuse when nothing matched. */
|
|
62
|
+
export declare const finalizeMcpServerInstallIntent: (request: ParsedMcpServerInstallRequest, refs: ReadonlyArray<McpServerExtensionRef>) => Effect.Effect<McpServerInstallIntent, ExtensionLifecycleFailed, ResolveInstallRequirements>;
|
|
63
|
+
/** The closure a settled MCP intent becomes. */
|
|
64
|
+
export declare const planMcpServerInstall: (intent: McpServerInstallIntent) => Effect.Effect<Plan<InstallStepRequirements>, ExtensionLifecycleFailed, InstallStepRequirements>;
|
|
65
|
+
//# sourceMappingURL=plan.d.ts.map
|