@agentxm/extension-lifecycle 0.28.11 → 0.28.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolving what a `<type> update` selector names.
|
|
3
|
+
*
|
|
4
|
+
* A person narrows a configured sweep two ways: a positional that may be an
|
|
5
|
+
* installed name or a source, and repeated `--name` filters that may be exact
|
|
6
|
+
* names or globs. Deciding which configured entries those name is update's
|
|
7
|
+
* own question — it re-reads the configured entries, re-resolves their
|
|
8
|
+
* declared sources, and compares origins — so it is settled here, beside the
|
|
9
|
+
* sweep it narrows, rather than by whichever surface parsed the flags.
|
|
10
|
+
*
|
|
11
|
+
* A selector that matches nothing is a settled answer, not a failure: the
|
|
12
|
+
* sweep reports it as nothing to advance, in the same shape as a workspace
|
|
13
|
+
* with nothing configured.
|
|
14
|
+
*
|
|
15
|
+
* @experimental This API is unstable and may change without notice.
|
|
16
|
+
*/
|
|
17
|
+
import * as Effect from "effect/Effect";
|
|
18
|
+
import * as Option from "effect/Option";
|
|
19
|
+
import { extensionTypeSentenceLabels, extensionTypePluralSentenceLabels, parseSourceQualifiedRegistrySourcePatternParts, toExtensionTypePlural, } from "@agentxm/extension-model/unstable/extensions";
|
|
20
|
+
import { isCatalogExtensionType } from "@agentxm/extension-model/unstable/extension-types";
|
|
21
|
+
import { SourceHostProviders, resolveInstalledIdentifierNameOrInput, resolveSource, } from "@agentxm/extension-sources";
|
|
22
|
+
import { WorkspaceRecords, configuredRowsByName, enabledConfiguredEntries, } from "@agentxm/workspace-state";
|
|
23
|
+
import { expandGlobs } from "../glob.js";
|
|
24
|
+
/** The flag spelling reported when a `--name` filter matches nothing. */
|
|
25
|
+
export const UPDATE_NAME_FILTER_FLAG = "--name";
|
|
26
|
+
const sourceMatchesEntrySource = (sourceValue, entrySource) => Effect.gen(function* () {
|
|
27
|
+
if (entrySource === undefined)
|
|
28
|
+
return false;
|
|
29
|
+
const requestedRegistry = parseSourceQualifiedRegistrySourcePatternParts(sourceValue);
|
|
30
|
+
const configuredRegistry = parseSourceQualifiedRegistrySourcePatternParts(entrySource);
|
|
31
|
+
if (requestedRegistry !== undefined || configuredRegistry !== undefined) {
|
|
32
|
+
return (requestedRegistry !== undefined &&
|
|
33
|
+
configuredRegistry !== undefined &&
|
|
34
|
+
requestedRegistry.sourceName === configuredRegistry.sourceName &&
|
|
35
|
+
requestedRegistry.owner === configuredRegistry.owner &&
|
|
36
|
+
requestedRegistry.type === configuredRegistry.type &&
|
|
37
|
+
requestedRegistry.name === configuredRegistry.name);
|
|
38
|
+
}
|
|
39
|
+
const sources = yield* SourceHostProviders;
|
|
40
|
+
const sourceArgResult = yield* Effect.result(resolveSource(sourceValue));
|
|
41
|
+
if (sourceArgResult._tag === "Failure") {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
const entrySourceResult = yield* Effect.result(resolveSource(entrySource));
|
|
45
|
+
if (entrySourceResult._tag === "Failure") {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
return sources.origin(entrySourceResult.success) === sources.origin(sourceArgResult.success);
|
|
49
|
+
});
|
|
50
|
+
const filterBySource = (entries, sourceValue, sourceMayMatchName) => Effect.gen(function* () {
|
|
51
|
+
const nameMatchedEntries = sourceMayMatchName
|
|
52
|
+
? entries.filter(([name]) => name === sourceValue)
|
|
53
|
+
: [];
|
|
54
|
+
if (nameMatchedEntries.length > 0) {
|
|
55
|
+
return nameMatchedEntries;
|
|
56
|
+
}
|
|
57
|
+
const sourceMatches = yield* Effect.forEach(entries, (entry) => Effect.map(sourceMatchesEntrySource(sourceValue, entry[1]), (matches) => matches ? Option.some(entry) : Option.none()), { concurrency: "unbounded" });
|
|
58
|
+
return sourceMatches.filter(Option.isSome).map((match) => match.value);
|
|
59
|
+
});
|
|
60
|
+
const filterByNameFilters = (entries, nameFilters, resourceType) => Effect.gen(function* () {
|
|
61
|
+
if (nameFilters.length === 0) {
|
|
62
|
+
return entries;
|
|
63
|
+
}
|
|
64
|
+
// A container has no per-type lock map of its own, so a bare name cannot
|
|
65
|
+
// be resolved to an installed identifier for it; the filter then matches
|
|
66
|
+
// the spelling the person gave, which is what identifier resolution
|
|
67
|
+
// returns for an unresolvable name anyway.
|
|
68
|
+
const resolvedNameFilters = yield* Effect.forEach(nameFilters, (name) => name.includes("*") || !isCatalogExtensionType(resourceType)
|
|
69
|
+
? Effect.succeed(name)
|
|
70
|
+
: resolveInstalledIdentifierNameOrInput({
|
|
71
|
+
input: name,
|
|
72
|
+
resourceType,
|
|
73
|
+
}));
|
|
74
|
+
const allNames = entries.map(([name]) => name);
|
|
75
|
+
const matchedNames = expandGlobs(resolvedNameFilters, allNames);
|
|
76
|
+
const matchedSet = new Set(matchedNames);
|
|
77
|
+
return entries.filter(([name]) => matchedSet.has(name));
|
|
78
|
+
});
|
|
79
|
+
/**
|
|
80
|
+
* Resolve a selector against the type's configured, enabled entries.
|
|
81
|
+
*
|
|
82
|
+
* Returns `All` when no selector was given, so a workspace with nothing
|
|
83
|
+
* configured still reports through the sweep's own "no configured …" message
|
|
84
|
+
* rather than a selector no-op.
|
|
85
|
+
*/
|
|
86
|
+
export const resolveConfiguredUpdateSelection = Effect.fn("UpdateExtensions.resolveSelection")(function* (selector) {
|
|
87
|
+
if (Option.isNone(selector.source) && selector.nameFilters.length === 0) {
|
|
88
|
+
return { _tag: "All" };
|
|
89
|
+
}
|
|
90
|
+
const records = yield* WorkspaceRecords;
|
|
91
|
+
const configured = yield* records
|
|
92
|
+
.rows(selector.resourceType)
|
|
93
|
+
.pipe(Effect.map(configuredRowsByName));
|
|
94
|
+
const entries = enabledConfiguredEntries(configured).map(([name, entry]) => [name, entry.source]);
|
|
95
|
+
const sourceValue = Option.getOrUndefined(selector.source);
|
|
96
|
+
const sourceMayMatchName = selector.sourceMayMatchName ?? true;
|
|
97
|
+
const sourceFiltered = sourceValue === undefined
|
|
98
|
+
? entries
|
|
99
|
+
: yield* filterBySource(entries, sourceValue, sourceMayMatchName);
|
|
100
|
+
if (sourceValue !== undefined && sourceFiltered.length === 0) {
|
|
101
|
+
const label = extensionTypeSentenceLabels[selector.resourceType];
|
|
102
|
+
return {
|
|
103
|
+
_tag: "NoMatch",
|
|
104
|
+
message: `No installed ${label} matched "${sourceValue}"${sourceMayMatchName ? " as a name or source" : " as a source"}.`,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const nameFiltered = yield* filterByNameFilters(sourceFiltered, selector.nameFilters, selector.resourceType);
|
|
108
|
+
if (selector.nameFilters.length > 0 && nameFiltered.length === 0) {
|
|
109
|
+
const pluralLabel = extensionTypePluralSentenceLabels[toExtensionTypePlural(selector.resourceType)];
|
|
110
|
+
return {
|
|
111
|
+
_tag: "NoMatch",
|
|
112
|
+
message: `No installed ${pluralLabel} match the ${UPDATE_NAME_FILTER_FLAG} filter.`,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
_tag: "Names",
|
|
117
|
+
names: nameFiltered.map(([name]) => name),
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
//# sourceMappingURL=selector.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrapping a targeted update in one atomic ownership transition.
|
|
3
|
+
*
|
|
4
|
+
* A targeted update moves a declaration whose ownership the workspace already
|
|
5
|
+
* settled. Between settling that ownership and applying the advance, the
|
|
6
|
+
* workspace could change underneath: a Pack could be installed, removed, or
|
|
7
|
+
* re-accepted, or the direct declaration could gain or lose a constraint. So
|
|
8
|
+
* the step rechecks the ownership fingerprint under the transition before it
|
|
9
|
+
* writes anything, and validates the ownership it must leave behind before it
|
|
10
|
+
* commits. A context that moved resolves as a stale candidate — a blocked
|
|
11
|
+
* outcome a person reruns — rather than as an error, because nothing is wrong
|
|
12
|
+
* except that the answer is out of date.
|
|
13
|
+
*
|
|
14
|
+
* @experimental This API is unstable and may change without notice.
|
|
15
|
+
*/
|
|
16
|
+
import * as Effect from "effect/Effect";
|
|
17
|
+
import type * as Path from "effect/Path";
|
|
18
|
+
import type * as FileSystem from "effect/FileSystem";
|
|
19
|
+
import { type Plan } from "@agentxm/workspace-operations";
|
|
20
|
+
import { WorkspaceMutations } from "@agentxm/workspace-state";
|
|
21
|
+
import type { WorkspaceTransactionScope } from "@agentxm/workspace-transactions";
|
|
22
|
+
import { type TargetedUpdateContext, type TargetedUpdateContextFailure } from "@agentxm/extension-resolution";
|
|
23
|
+
import type { InstallStepRequirements } from "../install/vocabulary.js";
|
|
24
|
+
export declare const TARGETED_UPDATE_STALE_DETAIL = "The targeted update ownership context became stale before apply.";
|
|
25
|
+
export declare const wrapTargetedUpdatePlan: (args: {
|
|
26
|
+
readonly plan: Plan<InstallStepRequirements>;
|
|
27
|
+
readonly context: TargetedUpdateContext;
|
|
28
|
+
readonly explicitRange?: string;
|
|
29
|
+
}) => Effect.Effect<Plan<InstallStepRequirements>, TargetedUpdateContextFailure, WorkspaceMutations | WorkspaceTransactionScope | FileSystem.FileSystem | Path.Path>;
|
|
30
|
+
//# sourceMappingURL=targeted-plan.d.ts.map
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrapping a targeted update in one atomic ownership transition.
|
|
3
|
+
*
|
|
4
|
+
* A targeted update moves a declaration whose ownership the workspace already
|
|
5
|
+
* settled. Between settling that ownership and applying the advance, the
|
|
6
|
+
* workspace could change underneath: a Pack could be installed, removed, or
|
|
7
|
+
* re-accepted, or the direct declaration could gain or lose a constraint. So
|
|
8
|
+
* the step rechecks the ownership fingerprint under the transition before it
|
|
9
|
+
* writes anything, and validates the ownership it must leave behind before it
|
|
10
|
+
* commits. A context that moved resolves as a stale candidate — a blocked
|
|
11
|
+
* outcome a person reruns — rather than as an error, because nothing is wrong
|
|
12
|
+
* except that the answer is out of date.
|
|
13
|
+
*
|
|
14
|
+
* @experimental This API is unstable and may change without notice.
|
|
15
|
+
*/
|
|
16
|
+
import * as Effect from "effect/Effect";
|
|
17
|
+
import { operationPresentation, } from "@agentxm/workspace-operations";
|
|
18
|
+
import { WorkspaceMutations } from "@agentxm/workspace-state";
|
|
19
|
+
import { resolveTargetedUpdateContext, } from "@agentxm/extension-resolution";
|
|
20
|
+
import { ExtensionLifecycleFailed } from "../errors.js";
|
|
21
|
+
import { buildAtomicPackGraphStep } from "../packs/graph-transition.js";
|
|
22
|
+
export const TARGETED_UPDATE_STALE_DETAIL = "The targeted update ownership context became stale before apply.";
|
|
23
|
+
const same = (left, right) => JSON.stringify(left) === JSON.stringify(right);
|
|
24
|
+
const validatePostcondition = (args) => {
|
|
25
|
+
if (args.explicitRange === undefined) {
|
|
26
|
+
return args.actual.fingerprint === args.expected.fingerprint
|
|
27
|
+
? Effect.void
|
|
28
|
+
: Effect.fail(new ExtensionLifecycleFailed({
|
|
29
|
+
category: "internal",
|
|
30
|
+
detail: "Targeted update changed desired ownership or owning pack evidence",
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
const expectedPublic = args.expected.public;
|
|
34
|
+
const actualPublic = args.actual.public;
|
|
35
|
+
const preserved = actualPublic.blocker === undefined &&
|
|
36
|
+
actualPublic.ownership === expectedPublic.ownership &&
|
|
37
|
+
actualPublic.activation === expectedPublic.activation &&
|
|
38
|
+
actualPublic.authority === expectedPublic.authority &&
|
|
39
|
+
actualPublic.direct?.source === expectedPublic.direct?.source &&
|
|
40
|
+
actualPublic.direct?.enabled === expectedPublic.direct?.enabled &&
|
|
41
|
+
actualPublic.direct?.constraint === args.explicitRange &&
|
|
42
|
+
actualPublic.effectiveConstraint === expectedPublic.effectiveConstraint &&
|
|
43
|
+
same(actualPublic.packs, expectedPublic.packs) &&
|
|
44
|
+
same(actualPublic.memberClosure, expectedPublic.memberClosure) &&
|
|
45
|
+
args.actual.packEvidenceFingerprint === args.expected.packEvidenceFingerprint;
|
|
46
|
+
return preserved
|
|
47
|
+
? Effect.void
|
|
48
|
+
: Effect.fail(new ExtensionLifecycleFailed({
|
|
49
|
+
category: "internal",
|
|
50
|
+
detail: "Targeted update did not preserve its desired ownership postcondition",
|
|
51
|
+
}));
|
|
52
|
+
};
|
|
53
|
+
export const wrapTargetedUpdatePlan = (args) => Effect.gen(function* () {
|
|
54
|
+
const workspace = yield* WorkspaceMutations;
|
|
55
|
+
const children = args.plan.jobs.flatMap((job) => job.steps.map((step) => ({
|
|
56
|
+
step,
|
|
57
|
+
coverage: args.context.public.target.type === "knowledge" ? "ineligible" : "eligible",
|
|
58
|
+
})));
|
|
59
|
+
const firstArtifact = children.find((child) => child.step.artifact !== undefined)?.step
|
|
60
|
+
.artifact;
|
|
61
|
+
const artifact = firstArtifact ?? {
|
|
62
|
+
path: args.context.public.target.fqn,
|
|
63
|
+
scope: workspace.scope,
|
|
64
|
+
change: "updated",
|
|
65
|
+
};
|
|
66
|
+
const builtStep = yield* buildAtomicPackGraphStep({
|
|
67
|
+
label: args.context.public.target.fqn,
|
|
68
|
+
message: `Updated ${args.context.public.target.fqn}`,
|
|
69
|
+
artifact,
|
|
70
|
+
children,
|
|
71
|
+
reportUnchangedWhenChildrenUnchanged: true,
|
|
72
|
+
preTransition: resolveTargetedUpdateContext({
|
|
73
|
+
target: args.context.public.target,
|
|
74
|
+
...(args.explicitRange === undefined ? {} : { explicitRange: args.explicitRange }),
|
|
75
|
+
}).pipe(Effect.flatMap((fresh) => fresh.fingerprint === args.context.fingerprint
|
|
76
|
+
? Effect.void
|
|
77
|
+
: Effect.fail(new ExtensionLifecycleFailed({
|
|
78
|
+
category: "conflict",
|
|
79
|
+
detail: TARGETED_UPDATE_STALE_DETAIL,
|
|
80
|
+
})))),
|
|
81
|
+
validate: resolveTargetedUpdateContext({
|
|
82
|
+
target: args.context.public.target,
|
|
83
|
+
...(args.explicitRange === undefined ? {} : { explicitRange: args.explicitRange }),
|
|
84
|
+
}).pipe(Effect.flatMap((actual) => validatePostcondition({
|
|
85
|
+
expected: args.context,
|
|
86
|
+
actual,
|
|
87
|
+
...(args.explicitRange === undefined ? {} : { explicitRange: args.explicitRange }),
|
|
88
|
+
}))),
|
|
89
|
+
});
|
|
90
|
+
// Ownership-context staleness resolves as typed blocking rather than as a
|
|
91
|
+
// step failure, so the operation terminates blocked/stale-candidate.
|
|
92
|
+
const graphStep = builtStep.readiness === "error"
|
|
93
|
+
? builtStep
|
|
94
|
+
: {
|
|
95
|
+
...builtStep,
|
|
96
|
+
run: builtStep.run.pipe(Effect.catch((error) => error.category === "conflict" && error.detail === TARGETED_UPDATE_STALE_DETAIL
|
|
97
|
+
? Effect.succeed({
|
|
98
|
+
result: "error",
|
|
99
|
+
message: TARGETED_UPDATE_STALE_DETAIL,
|
|
100
|
+
error,
|
|
101
|
+
blocking: { class: "stale-candidate" },
|
|
102
|
+
})
|
|
103
|
+
: Effect.fail(error))),
|
|
104
|
+
};
|
|
105
|
+
return {
|
|
106
|
+
...args.plan,
|
|
107
|
+
name: `Update ${args.context.public.target.fqn}`,
|
|
108
|
+
description: args.plan.description,
|
|
109
|
+
presentation: operationPresentation({ imperative: "update", past: "Updated", gerund: "Updating" }, args.context.public.target.type),
|
|
110
|
+
jobs: [{ concurrency: 1, steps: [graphStep] }],
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
//# sourceMappingURL=targeted-plan.js.map
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Advancing what the workspace already accepted.
|
|
3
|
+
*
|
|
4
|
+
* Update is one use case with two shapes of request. A person can name one
|
|
5
|
+
* extension by its Registry identity, or ask the workspace to sweep every
|
|
6
|
+
* configured entry — optionally narrowed to one type, or to a selection of
|
|
7
|
+
* installed names. Both shapes answer the same question: within the intent
|
|
8
|
+
* the workspace recorded, is there a newer version its source is willing to
|
|
9
|
+
* offer, and may this workspace accept it?
|
|
10
|
+
*
|
|
11
|
+
* Everything that decides the answer lives here. A named update is classified
|
|
12
|
+
* against the desired graph first, so a refusal is reported before any
|
|
13
|
+
* Registry is contacted: an extension the workspace never asked for is not
|
|
14
|
+
* installed on its behalf, a Pack-owned member is not forked into direct
|
|
15
|
+
* intent, and a bundled or workspace-authored source is never replaced from
|
|
16
|
+
* the Registry. A sweep resolves each configured entry independently, so one
|
|
17
|
+
* unreachable source blocks one unit rather than the operation.
|
|
18
|
+
*
|
|
19
|
+
* `prepare` settles all of it and writes nothing: it produces either a frozen
|
|
20
|
+
* execution candidate or the settled reason there is nothing to execute.
|
|
21
|
+
* `previewOrApply` resolves that same candidate, so the preview a person
|
|
22
|
+
* reads and the apply that follows describe one decision.
|
|
23
|
+
*
|
|
24
|
+
* @experimental This API is unstable and may change without notice.
|
|
25
|
+
*/
|
|
26
|
+
import * as Effect from "effect/Effect";
|
|
27
|
+
import type * as FileSystem from "effect/FileSystem";
|
|
28
|
+
import * as Option from "effect/Option";
|
|
29
|
+
import type * as Path from "effect/Path";
|
|
30
|
+
import type * as Scope from "effect/Scope";
|
|
31
|
+
import type * as HttpClient from "effect/unstable/http/HttpClient";
|
|
32
|
+
import { HookManager, KnowledgeManager, McpServerManager, PackManager, RuleManager, SkillManager, SubagentManager } from "@agentxm/extension-materialization";
|
|
33
|
+
import { ReleaseAgePosture, type ExtensionResolutionFailed, type ReleaseAgeOperationEvidence, type TargetedUpdateContext, type TargetedUpdatePublicContext } from "@agentxm/extension-resolution";
|
|
34
|
+
import { SourceHostProviders, WorkspaceCatalog, type SourceResolutionFailure } from "@agentxm/extension-sources";
|
|
35
|
+
import { type CandidateFingerprintFailed, type ExecutionCandidate, type OperationResolution, type PlanExecution } from "@agentxm/workspace-operations";
|
|
36
|
+
import { WorkspaceRecords, type AcceptedCanonicalRefError, type ConfiguredAgentOutcomesProvider, type LockfileValidationError } from "@agentxm/workspace-state";
|
|
37
|
+
import type { WorkspaceTransactionScope } from "@agentxm/workspace-transactions";
|
|
38
|
+
import { ExtensionLifecycleFailed } from "../errors.js";
|
|
39
|
+
import type { InstallStepRequirements } from "../install/vocabulary.js";
|
|
40
|
+
import type { StepFailureConversion } from "../step-failure-conversion.js";
|
|
41
|
+
import { blockerClass } from "./blockers.js";
|
|
42
|
+
import { type WorkspaceUpdatableType } from "./configured.js";
|
|
43
|
+
import { type ConfiguredUpdateSelector } from "./selector.js";
|
|
44
|
+
/** Advance one extension the person named by its Registry identity. */
|
|
45
|
+
export interface TargetedUpdateRequest {
|
|
46
|
+
readonly kind: "targeted";
|
|
47
|
+
/** The Registry FQN, optionally carrying a version range. */
|
|
48
|
+
readonly source: string;
|
|
49
|
+
/** Whether prompts may be asked while the plan is built. */
|
|
50
|
+
readonly nonInteractive: boolean;
|
|
51
|
+
}
|
|
52
|
+
/** Sweep the configured entries, optionally narrowed by type and selection. */
|
|
53
|
+
export interface ConfiguredUpdateRequest {
|
|
54
|
+
readonly kind: "configured";
|
|
55
|
+
/** Restrict the sweep to one extension type. */
|
|
56
|
+
readonly type: Option.Option<WorkspaceUpdatableType>;
|
|
57
|
+
/**
|
|
58
|
+
* A selector to resolve against the type's configured entries; omit to
|
|
59
|
+
* sweep every entry. Resolving it is part of settling the request, so a
|
|
60
|
+
* selector that matches nothing settles as nothing to advance.
|
|
61
|
+
*/
|
|
62
|
+
readonly selector?: ConfiguredUpdateSelector;
|
|
63
|
+
readonly planName: string;
|
|
64
|
+
readonly planDescription: Option.Option<string>;
|
|
65
|
+
readonly nonInteractive: boolean;
|
|
66
|
+
}
|
|
67
|
+
/** Everything `axm update` and every `<type> update` can ask for. */
|
|
68
|
+
export type UpdateRequest = TargetedUpdateRequest | ConfiguredUpdateRequest;
|
|
69
|
+
/** What every step in an update may require when it runs. */
|
|
70
|
+
export type UpdateRequirements = InstallStepRequirements;
|
|
71
|
+
/** The seven manager services a planned update may reach for. */
|
|
72
|
+
type UpdateManagers = SkillManager | SubagentManager | RuleManager | HookManager | KnowledgeManager | McpServerManager | PackManager;
|
|
73
|
+
/** What an update outcome is about: one extension type, or several. */
|
|
74
|
+
export type UpdateSubjectType = WorkspaceUpdatableType | "mixed";
|
|
75
|
+
/** A settled update that has work to execute. */
|
|
76
|
+
export interface PlannedUpdateCandidate {
|
|
77
|
+
readonly outcome: "planned";
|
|
78
|
+
/** The type this advance is about, or `mixed` when a sweep spans types. */
|
|
79
|
+
readonly subjectType: UpdateSubjectType;
|
|
80
|
+
readonly execution: ExecutionCandidate<UpdateRequirements>;
|
|
81
|
+
/**
|
|
82
|
+
* The installed names a sweep's selector resolved to; absent when the sweep
|
|
83
|
+
* was not narrowed. A rerun that must reproduce this exact settlement names
|
|
84
|
+
* these rather than the selector that found them.
|
|
85
|
+
*/
|
|
86
|
+
readonly selectedNames?: ReadonlyArray<string>;
|
|
87
|
+
/** Release-age evidence resolution collected before the plan existed. */
|
|
88
|
+
readonly releaseAge?: ReleaseAgeOperationEvidence;
|
|
89
|
+
/** The ownership context a targeted update was classified against. */
|
|
90
|
+
readonly targetedContext?: TargetedUpdatePublicContext;
|
|
91
|
+
readonly fingerprintedContext?: TargetedUpdateContext;
|
|
92
|
+
}
|
|
93
|
+
/** A settled update that is refused, with the fact that refuses it. */
|
|
94
|
+
export interface BlockedUpdateCandidate {
|
|
95
|
+
readonly outcome: "blocked";
|
|
96
|
+
readonly name: string;
|
|
97
|
+
readonly detail: string;
|
|
98
|
+
readonly subject: string;
|
|
99
|
+
readonly subjectType: WorkspaceUpdatableType;
|
|
100
|
+
readonly blockingClass: ReturnType<typeof blockerClass>;
|
|
101
|
+
/** The classified blocker, which the application renders recovery from. */
|
|
102
|
+
readonly reference?: string;
|
|
103
|
+
readonly releaseAge?: ReleaseAgeOperationEvidence;
|
|
104
|
+
readonly targetedContext?: TargetedUpdatePublicContext;
|
|
105
|
+
}
|
|
106
|
+
/** A settled update whose current version is preserved by release-age policy. */
|
|
107
|
+
export interface PreservedUpdateCandidate {
|
|
108
|
+
readonly outcome: "preserved";
|
|
109
|
+
readonly name: string;
|
|
110
|
+
readonly description: string;
|
|
111
|
+
readonly subjectType: WorkspaceUpdatableType;
|
|
112
|
+
readonly releaseAge: ReleaseAgeOperationEvidence;
|
|
113
|
+
readonly targetedContext?: TargetedUpdatePublicContext;
|
|
114
|
+
}
|
|
115
|
+
/** A settled sweep that found nothing configured to advance. */
|
|
116
|
+
export interface NothingConfiguredUpdateCandidate {
|
|
117
|
+
readonly outcome: "nothing-configured";
|
|
118
|
+
readonly message: string;
|
|
119
|
+
readonly subjectType: UpdateSubjectType;
|
|
120
|
+
readonly planDescription: Option.Option<string>;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* A settled update: every decision is made and nothing is written. Three of
|
|
124
|
+
* the four shapes carry no plan because there is nothing to execute — the
|
|
125
|
+
* reason itself is the outcome.
|
|
126
|
+
*/
|
|
127
|
+
export type UpdateCandidate = PlannedUpdateCandidate | BlockedUpdateCandidate | PreservedUpdateCandidate | NothingConfiguredUpdateCandidate;
|
|
128
|
+
/**
|
|
129
|
+
* Every failure settling an update can surface before anything is written:
|
|
130
|
+
* the feature's own refusal and the fingerprint a frozen candidate could not
|
|
131
|
+
* take; the resolution policy's refusal of a named or configured entry;
|
|
132
|
+
* whatever routing a declared source locator and reaching its Registry
|
|
133
|
+
* surfaced; everything reading settings, the lockfile, and the accepted
|
|
134
|
+
* canonical resolution behind one entry can produce; and the lockfile-health
|
|
135
|
+
* probe an update consults before it decides anything.
|
|
136
|
+
*/
|
|
137
|
+
export type UpdateFailure = ExtensionLifecycleFailed | CandidateFingerprintFailed | ExtensionResolutionFailed | SourceResolutionFailure | AcceptedCanonicalRefError | LockfileValidationError;
|
|
138
|
+
/** Everything settling an update reads before it freezes a candidate. */
|
|
139
|
+
export type PrepareUpdateRequirements = UpdateRequirements | UpdateManagers | ConfiguredAgentOutcomesProvider | StepFailureConversion | FileSystem.FileSystem | Path.Path | HttpClient.HttpClient | Scope.Scope | ReleaseAgePosture | SourceHostProviders | WorkspaceCatalog | WorkspaceRecords | WorkspaceTransactionScope;
|
|
140
|
+
/**
|
|
141
|
+
* Settle an update: read the request, decide what may advance, and freeze
|
|
142
|
+
* either the execution candidate or the reason there is nothing to execute.
|
|
143
|
+
*/
|
|
144
|
+
export declare const prepareUpdate: (request: UpdateRequest) => Effect.Effect<UpdateCandidate, UpdateFailure, PrepareUpdateRequirements>;
|
|
145
|
+
/**
|
|
146
|
+
* Preview or apply a settled update, resolving to one operation outcome.
|
|
147
|
+
*
|
|
148
|
+
* A sweep that found nothing configured has no operation to resolve: the
|
|
149
|
+
* application reports it as the no-op it is, so this takes only the
|
|
150
|
+
* candidates that do describe an operation.
|
|
151
|
+
*/
|
|
152
|
+
export declare const previewOrApplyUpdate: (candidate: Exclude<UpdateCandidate, NothingConfiguredUpdateCandidate>, execution: PlanExecution) => Effect.Effect<OperationResolution<never>, import("@agentxm/workspace-state").WorkspaceSettingsReadFailure | import("@agentxm/workspace-operations").ApprovalRecoveryMissing | import("@agentxm/workspace-operations").PlanInteractionFailed | import("@agentxm/workspace-transactions").WorkspaceTransitionAcquireFailure, ConfiguredAgentOutcomesProvider | import("@agentxm/workspace-transactions").FootprintRecorder | import("@agentxm/workspace-operations").OperationJournal | import("@agentxm/workspace-operations").ResolvePlanInteraction | InstallStepRequirements>;
|
|
153
|
+
/**
|
|
154
|
+
* The ownership context an outcome reports: a stale-candidate outcome says
|
|
155
|
+
* nothing moved, whatever the classification said before the transition.
|
|
156
|
+
*/
|
|
157
|
+
export declare const contextForResolution: (context: TargetedUpdatePublicContext, resolution: OperationResolution) => TargetedUpdatePublicContext;
|
|
158
|
+
/** The update use case: settle a request, then preview or apply it. */
|
|
159
|
+
export declare const UpdateExtensions: {
|
|
160
|
+
readonly prepare: (request: UpdateRequest) => Effect.Effect<UpdateCandidate, UpdateFailure, PrepareUpdateRequirements>;
|
|
161
|
+
readonly previewOrApply: (candidate: Exclude<UpdateCandidate, NothingConfiguredUpdateCandidate>, execution: PlanExecution) => Effect.Effect<OperationResolution<never>, import("@agentxm/workspace-state").WorkspaceSettingsReadFailure | import("@agentxm/workspace-operations").ApprovalRecoveryMissing | import("@agentxm/workspace-operations").PlanInteractionFailed | import("@agentxm/workspace-transactions").WorkspaceTransitionAcquireFailure, ConfiguredAgentOutcomesProvider | import("@agentxm/workspace-transactions").FootprintRecorder | import("@agentxm/workspace-operations").OperationJournal | import("@agentxm/workspace-operations").ResolvePlanInteraction | InstallStepRequirements>;
|
|
162
|
+
};
|
|
163
|
+
export {};
|
|
164
|
+
//# sourceMappingURL=update-extensions.d.ts.map
|