@agentxm/extension-materialization 0.29.2 → 0.30.1
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/hooks/manager.d.ts +0 -5
- package/dist/src/hooks/manager.js +73 -36
- package/dist/src/index.d.ts +1 -6
- package/dist/src/index.js +0 -9
- package/dist/src/knowledge/manager.d.ts +0 -1
- package/dist/src/knowledge/manager.js +36 -29
- package/dist/src/manager-contract.d.ts +16 -18
- package/dist/src/manager-registry.d.ts +2 -3
- package/dist/src/managers.d.ts +22 -3
- package/dist/src/managers.js +0 -13
- package/dist/src/mcps/manager.js +84 -44
- package/dist/src/packs/manager.js +21 -18
- package/dist/src/rules/manager.d.ts +0 -5
- package/dist/src/rules/manager.js +22 -32
- package/dist/src/skills/errors.d.ts +2 -1
- package/dist/src/skills/manager.js +45 -53
- package/dist/src/skills/materialization.d.ts +2 -2
- package/dist/src/skills/skill-artifact.d.ts +5 -1
- package/dist/src/subagents/manager.js +31 -52
- package/dist/src/testing.d.ts +0 -66
- package/dist/src/testing.js +1 -89
- package/package.json +19 -22
- package/dist/src/desired-state/errors.d.ts +0 -22
- package/dist/src/desired-state/errors.js +0 -22
- package/dist/src/desired-state/retained-materialization.d.ts +0 -58
- package/dist/src/desired-state/retained-materialization.js +0 -119
- package/dist/src/extensions/operations.d.ts +0 -252
- package/dist/src/extensions/operations.js +0 -631
- package/dist/src/mcps/authored-materialization.d.ts +0 -28
- package/dist/src/mcps/authored-materialization.js +0 -34
- package/dist/src/mcps/install-operation.d.ts +0 -92
- package/dist/src/mcps/install-operation.js +0 -557
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { usableAcceptedCanonical } from "@agentxm/workspace-state";
|
|
2
|
+
import { LifecyclePostconditionViolated } from "../extensions/errors.js";
|
|
1
3
|
/**
|
|
2
4
|
* Hook manager service.
|
|
3
5
|
*
|
|
@@ -511,13 +513,20 @@ export const HookManagerLive = Layer.effect(HookManager, Effect.gen(function* ()
|
|
|
511
513
|
.map(({ marker }) => marker),
|
|
512
514
|
};
|
|
513
515
|
});
|
|
514
|
-
const makeHookProjectionPlans = () => Effect.gen(function* () {
|
|
516
|
+
const makeHookProjectionPlans = (prospective = []) => Effect.gen(function* () {
|
|
515
517
|
const configuredAgents = yield* ws.getConfiguredAgents();
|
|
516
518
|
const targets = yield* configuredHookWriterTargets(configuredAgents, (configPath) => path.resolve(baseDir, configPath));
|
|
517
519
|
const fallbackTarget = yield* hookFallbackTarget();
|
|
518
520
|
const graph = yield* ws.getDesiredStateGraph();
|
|
519
521
|
const locked = yield* ws.getLockedHooks();
|
|
520
|
-
const
|
|
522
|
+
const retained = yield* selectHookContributors({
|
|
523
|
+
graph: {
|
|
524
|
+
...graph,
|
|
525
|
+
nodes: graph.nodes.filter((node) => node.type !== "hook" || !prospective.some(({ name }) => name === node.name)),
|
|
526
|
+
},
|
|
527
|
+
locked,
|
|
528
|
+
});
|
|
529
|
+
const contributors = [...retained, ...prospective].sort((a, b) => a.marker.localeCompare(b.marker));
|
|
521
530
|
const outcomes = evaluateConfiguredOutcomes({
|
|
522
531
|
configuredAgents,
|
|
523
532
|
targets,
|
|
@@ -590,11 +599,11 @@ export const HookManagerLive = Layer.effect(HookManager, Effect.gen(function* ()
|
|
|
590
599
|
});
|
|
591
600
|
return [...nativePlans, fallbackPlan];
|
|
592
601
|
});
|
|
593
|
-
const configuredAgentOutcomes = (state) => Effect.gen(function* () {
|
|
602
|
+
const configuredAgentOutcomes = (state, proposedGraph) => Effect.gen(function* () {
|
|
594
603
|
const configuredAgents = yield* ws.getConfiguredAgents();
|
|
595
604
|
const targets = yield* configuredHookWriterTargets(configuredAgents, (configPath) => path.resolve(baseDir, configPath));
|
|
596
605
|
const fallbackTarget = yield* hookFallbackTarget();
|
|
597
|
-
const graph = yield* ws.getDesiredStateGraph();
|
|
606
|
+
const graph = proposedGraph ?? (yield* ws.getDesiredStateGraph());
|
|
598
607
|
const locked = yield* ws.getLockedHooks();
|
|
599
608
|
const contributors = yield* selectHookContributors({ graph, locked });
|
|
600
609
|
return evaluateConfiguredOutcomes({
|
|
@@ -625,6 +634,45 @@ export const HookManagerLive = Layer.effect(HookManager, Effect.gen(function* ()
|
|
|
625
634
|
state,
|
|
626
635
|
});
|
|
627
636
|
});
|
|
637
|
+
const prepareProjection = (refs) => Effect.gen(function* () {
|
|
638
|
+
const prepared = yield* Effect.forEach(refs, (ref) => Effect.scoped(Effect.gen(function* () {
|
|
639
|
+
const root = ref.refType === "registry"
|
|
640
|
+
? (yield* sources.fetch(ref)).directory
|
|
641
|
+
: stripFileProtocol(ref.location);
|
|
642
|
+
const manifest = yield* readManifest(root);
|
|
643
|
+
const entrypoint = path.resolve(root, manifest.entrypoint);
|
|
644
|
+
yield* validatePathSafety(path, root, entrypoint);
|
|
645
|
+
if (!(yield* fs.exists(entrypoint)))
|
|
646
|
+
return yield* new HookDefinitionInvalid({
|
|
647
|
+
detail: `Hook entrypoint does not exist: ${manifest.entrypoint}`,
|
|
648
|
+
});
|
|
649
|
+
const canonicalPath = computeExtensionPathsForLayout(path.join, ws.layout, ref, HOOK_EXTENSION_DIR, ref.hook.name).canonicalPath;
|
|
650
|
+
const commandPath = path.relative(baseDir, path.resolve(canonicalPath, manifest.entrypoint));
|
|
651
|
+
return {
|
|
652
|
+
name: ref.hook.name,
|
|
653
|
+
marker: formatFqn({ owner: manifest.owner, type: "hook", name: manifest.name }),
|
|
654
|
+
manifest,
|
|
655
|
+
command: `${interpreterForRuntime(manifest.runtime)} ${commandPath}`,
|
|
656
|
+
treeIntegrity: yield* computeMaterializedTreeIntegrity(root),
|
|
657
|
+
};
|
|
658
|
+
})), { concurrency: 1 });
|
|
659
|
+
const configuredAgents = yield* ws.getConfiguredAgents();
|
|
660
|
+
const targets = yield* configuredHookWriterTargets(configuredAgents, (configPath) => path.resolve(baseDir, configPath));
|
|
661
|
+
const fallbackTarget = yield* hookFallbackTarget();
|
|
662
|
+
return {
|
|
663
|
+
plans: yield* makeHookProjectionPlans(prepared),
|
|
664
|
+
agentOutcomes: evaluateConfiguredOutcomes({
|
|
665
|
+
configuredAgents,
|
|
666
|
+
targets,
|
|
667
|
+
fallbackPath: fallbackTarget.workspaceRelative,
|
|
668
|
+
contributors: prepared,
|
|
669
|
+
state: "projected",
|
|
670
|
+
}),
|
|
671
|
+
acquisitions: prepared.map(({ name, treeIntegrity }) => ({ name, treeIntegrity })),
|
|
672
|
+
};
|
|
673
|
+
}).pipe(Effect.mapError((cause) => cause._tag === "PlatformError"
|
|
674
|
+
? new HookDefinitionInvalid({ detail: "Cannot inspect prepared hook content", cause })
|
|
675
|
+
: cause));
|
|
628
676
|
const projectionPlans = () => makeHookProjectionPlans();
|
|
629
677
|
const applyHookProjections = projectionPlans().pipe(Effect.flatMap(applyProjectionPlans));
|
|
630
678
|
const materializeInstall = Effect.fn("HookManager.materializeInstall")(function* ({ ref }) {
|
|
@@ -705,11 +753,28 @@ export const HookManagerLive = Layer.effect(HookManager, Effect.gen(function* ()
|
|
|
705
753
|
return {
|
|
706
754
|
type: "hook",
|
|
707
755
|
projectionPlans,
|
|
756
|
+
prepareProjection,
|
|
708
757
|
aggregateProjectionObservation: Ref.get(lastProjection),
|
|
709
758
|
configuredAgentOutcomes,
|
|
710
759
|
configuredAgentOutcomesForRef,
|
|
711
760
|
isInstalled: ({ target }) => isObservedInstalled(ws, "hook", target.name).pipe(Effect.withSpan("HookManager.isInstalled")),
|
|
712
761
|
materializeInstall,
|
|
762
|
+
acquireCanonical: materializeInstall,
|
|
763
|
+
materializeRetained: ({ target }) => Effect.gen(function* () {
|
|
764
|
+
const canonical = yield* usableAcceptedCanonical({
|
|
765
|
+
workspace: ws,
|
|
766
|
+
type: "hook",
|
|
767
|
+
name: target.name,
|
|
768
|
+
});
|
|
769
|
+
if (Option.isNone(canonical) || canonical.value.ref.type !== "hook") {
|
|
770
|
+
return yield* new LifecyclePostconditionViolated({
|
|
771
|
+
postcondition: "materialize-observable",
|
|
772
|
+
targetType: "hook",
|
|
773
|
+
targetName: target.name,
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
return yield* materializeInstall({ ref: canonical.value.ref });
|
|
777
|
+
}),
|
|
713
778
|
prepareSourceTransition: ({ ref }) => provide(prepareAcceptedCanonicalTransition({
|
|
714
779
|
workspace: ws,
|
|
715
780
|
type: "hook",
|
|
@@ -734,45 +799,17 @@ export const HookManagerLive = Layer.effect(HookManager, Effect.gen(function* ()
|
|
|
734
799
|
}),
|
|
735
800
|
materializeUninstall,
|
|
736
801
|
materializeDeactivate,
|
|
737
|
-
|
|
738
|
-
const lockEntry = yield* buildLockEntry(ref, materialization);
|
|
739
|
-
if (Option.isNone(lockEntry)) {
|
|
740
|
-
yield* ws.setHookEntry(ref.hook.name, {
|
|
741
|
-
source: "workspace",
|
|
742
|
-
enabled: true,
|
|
743
|
-
});
|
|
744
|
-
return;
|
|
745
|
-
}
|
|
746
|
-
if (lockEntry.value.type === "registry") {
|
|
747
|
-
yield* validateExactResolvedVersion(`hooks.${ref.hook.name}.resolvedVersion`, lockEntry.value.resolvedVersion);
|
|
748
|
-
}
|
|
749
|
-
yield* ws.setHook({
|
|
750
|
-
name: ref.hook.name,
|
|
751
|
-
lockEntry: lockEntry.value,
|
|
752
|
-
versionRange,
|
|
753
|
-
});
|
|
754
|
-
}),
|
|
755
|
-
removeSettingsEntry: Effect.fn("HookManager.removeSettingsEntry")(function* ({ target }) {
|
|
756
|
-
yield* ws.removeHookSettings(target.name);
|
|
757
|
-
}),
|
|
758
|
-
upsertLockfileEntry: Effect.fn("HookManager.upsertLockfileEntry")(function* ({ ref, materialization, }) {
|
|
802
|
+
acceptedResolution: Effect.fn("HookManager.acceptedResolution")(function* ({ ref, materialization, }) {
|
|
759
803
|
const entry = yield* buildLockEntry(ref, materialization);
|
|
760
804
|
if (Option.isNone(entry)) {
|
|
761
|
-
|
|
762
|
-
return;
|
|
805
|
+
return Option.none();
|
|
763
806
|
}
|
|
764
807
|
if (ref.refType === "registry") {
|
|
765
808
|
yield* validateExactResolvedVersion(`hooks.${ref.hook.name}.resolvedVersion`, ref.version);
|
|
766
809
|
}
|
|
767
|
-
|
|
768
|
-
name: ref.hook.name,
|
|
769
|
-
lockEntry: entry.value,
|
|
770
|
-
versionRange: Option.none(),
|
|
771
|
-
});
|
|
772
|
-
}),
|
|
773
|
-
removeLockfileEntry: Effect.fn("HookManager.removeLockfileEntry")(function* ({ target }) {
|
|
774
|
-
yield* ws.removeHookLock(target.name);
|
|
810
|
+
return Option.some({ key: ref.hook.name, entry: entry.value });
|
|
775
811
|
}),
|
|
812
|
+
withdrawnResolutionKeys: ({ target }) => Effect.succeed([target.name]),
|
|
776
813
|
};
|
|
777
814
|
}));
|
|
778
815
|
//# sourceMappingURL=manager.js.map
|
package/dist/src/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
export { NO_MATERIALIZATION_OBSERVATION, type ExtensionManager, type ManagerRequirements, type MaterializationFacts, type MaterializationObservation, } from "./manager-contract.js";
|
|
15
15
|
export { ExtensionManagers, type ExtensionManagersService } from "./manager-registry.js";
|
|
16
|
-
export { HookManager, KnowledgeManager, McpServerManager, PackManager, RuleManager, SkillManager, SubagentManager, type AcquiredContentFacts, type HookManagerService, type HookMaterializationFacts, type KnowledgeManagerService, type KnowledgeMaterializationFacts, type KnowledgeSyncResult, type McpServerMaterializationFacts, type PackMaterializationFacts, type RuleManagerService, type RuleMaterializationFacts, type SkillMaterializationFacts, type SubagentManagerService, type SubagentMaterializationFacts, } from "./managers.js";
|
|
16
|
+
export { HookManager, KnowledgeManager, McpServerManager, PackManager, RuleManager, SkillManager, SubagentManager, type AcquiredContentFacts, type HookManagerService, type PreparedHookProjection, type HookMaterializationFacts, type KnowledgeManagerService, type KnowledgeMaterializationFacts, type KnowledgeSyncResult, type McpServerMaterializationFacts, type McpServerManagerService, type PackMaterializationFacts, type RuleManagerService, type RuleMaterializationFacts, type SkillMaterializationFacts, type SubagentManagerService, type SubagentMaterializationFacts, } from "./managers.js";
|
|
17
17
|
export type { ExtensionManagerFailure, ExtensionMaterializationError } from "./errors.js";
|
|
18
18
|
export { ArchiveIntegrityMismatch, CanonicalPackageProbeFailed, CreateDestinationExists, LifecyclePostconditionViolated, PackageCopyFailed, PackageMaterializationFailed, ScaffoldedExtensionUnresolved, StagedPackageInvalid, type MaterializationError, } from "./extensions/errors.js";
|
|
19
19
|
export { HookDefinitionInvalid, HookInstallStateMissing, type HookManagerError, } from "./hooks/errors.js";
|
|
@@ -23,8 +23,6 @@ export { SubagentContentUnreadable, SubagentDefinitionInvalid, SubagentInstallSt
|
|
|
23
23
|
export { SkillDefinitionInvalid, SkillInstallStateMissing, SkillMaterializationFailed, type SkillManagerError, } from "./skills/errors.js";
|
|
24
24
|
export { PackArchiveFetchFailed, PackDefinitionInvalid, PackInstallStateMissing, PackStagingFailed, type PackManagerError, } from "./packs/errors.js";
|
|
25
25
|
export { KnowledgeDefinitionInvalid, KnowledgeDesiredStateUnreconcilable, KnowledgeInstallStateMissing, KnowledgeIoFailed, KnowledgeObservableContractViolated, KnowledgeResolutionMissing, KnowledgeUnavailable, type KnowledgeManagerError, } from "./knowledge/errors.js";
|
|
26
|
-
export { collectSecretInputNames, deleteMcpSecrets, installMcpServer, readMcpServerManifest, type InstallMcpServerOperation, type InstallMcpServerOperationArgs, type McpSecretDeletionOutcome, type McpServerInstallRequirements, } from "./mcps/install-operation.js";
|
|
27
|
-
export { materializeAuthoredMcpServer } from "./mcps/authored-materialization.js";
|
|
28
26
|
export { NativeMcpEntryRetirementFailed, retireNativeMcpEntry, type NativeMcpEntryRef, } from "./mcps/native-entry.js";
|
|
29
27
|
export { MCP_SECRET_SERVICE, McpSecretStore, mcpSecretAccount, type McpSecretEraseOutcome, type McpSecretIdentity, type McpSecretStoreService, type McpSecretWriteOutcome, } from "./mcps/secret-store.js";
|
|
30
28
|
export { MCP_AGENT_CONFIG_SURFACE, agentConfigTarget, agentConfigTargets, mcpConfigSurface, mcpServerArtifact, mcpServerSourcePath, mcpServerVersion, mcpSettingsTarget, mcpSourceTarget, type AgentMcpConfigOutcome, } from "./mcps/artifact.js";
|
|
@@ -37,8 +35,5 @@ export { shouldReuseCanonicalInstall } from "./extensions/canonical-reuse.js";
|
|
|
37
35
|
export { configuredMcpServersToDiskRefs, configuredPacksToDiskRefs, configuredSkillsToDiskRefs, configuredSubagentsToDiskRefs, } from "./extensions/materializable-from-disk.js";
|
|
38
36
|
export { canReuseExternalPackage, canReuseInstalledPackage, canonicalMaterializationPaths, createCanonicalDirectory, materializeExternalPackage, materializeExternalPackageWithTreeIntegrity, recoverCanonicalDirectory, replaceCanonicalDirectory, replaceCanonicalDirectoryWithInspection, type CanReuseExternalPackageArgs, type CanReuseInstalledPackageArgs, type CanonicalDirectoryInspection, type CanonicalDirectoryReplacementError, type CreateCanonicalDirectoryArgs, type MaterializeExternalPackageArgs, type MaterializedPackage, type RecoverCanonicalDirectoryArgs, type ReplaceCanonicalDirectoryArgs, type ReplaceCanonicalDirectoryWithInspectionArgs, } from "./extensions/canonical-directory.js";
|
|
39
37
|
export { materializeRegistryPackage, materializeRegistryPackageWithTreeIntegrity, type MaterializeRegistryPackageArgs, type RegistryPackageMaterializationMessages, } from "./registry-materialization.js";
|
|
40
|
-
export { buildAuthoredExtensionStep, buildInstallOperation, buildMaterializeOperation, buildNewExtensionStep, buildUninstallOperation, extensionRefLifecycleWarnings, extensionRefRegistryLifecycle, formatPackageUrlParts, targetFromRef, toLabel, toLabelWithCompanions, toStepKey, type AuthoredExtensionOperationArgs, type CallerStepFailure, type InstallOperationArgs, type MaterializeOperationArgs, type NewExtensionOperationArgs, type RecipeRequirements, type StepFailureAdapter, type UninstallOperationArgs, type UninstallRetentionPolicy, type UninstallSettlement, type UnreadablePackageRetirement, } from "./extensions/operations.js";
|
|
41
|
-
export { RetainedContentUnusable } from "./desired-state/errors.js";
|
|
42
|
-
export { collectRetainedMaterializeSteps, type RetainedMaterializeFailure, type RetainedMaterializeRequirements, type RetainedMaterializeSteps, type RunRetainedMcpServerInstall, } from "./desired-state/retained-materialization.js";
|
|
43
38
|
export { projectionErrorToStepFailure } from "./projection-step-failure.js";
|
|
44
39
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.js
CHANGED
|
@@ -28,8 +28,6 @@ export { PackArchiveFetchFailed, PackDefinitionInvalid, PackInstallStateMissing,
|
|
|
28
28
|
export { KnowledgeDefinitionInvalid, KnowledgeDesiredStateUnreconcilable, KnowledgeInstallStateMissing, KnowledgeIoFailed, KnowledgeObservableContractViolated, KnowledgeResolutionMissing, KnowledgeUnavailable, } from "./knowledge/errors.js";
|
|
29
29
|
// MCP server installation: the operation four surfaces share, its credential
|
|
30
30
|
// port, and the artifact/target vocabulary the plan step reports.
|
|
31
|
-
export { collectSecretInputNames, deleteMcpSecrets, installMcpServer, readMcpServerManifest, } from "./mcps/install-operation.js";
|
|
32
|
-
export { materializeAuthoredMcpServer } from "./mcps/authored-materialization.js";
|
|
33
31
|
export { NativeMcpEntryRetirementFailed, retireNativeMcpEntry, } from "./mcps/native-entry.js";
|
|
34
32
|
export { MCP_SECRET_SERVICE, McpSecretStore, mcpSecretAccount, } from "./mcps/secret-store.js";
|
|
35
33
|
export { MCP_AGENT_CONFIG_SURFACE, agentConfigTarget, agentConfigTargets, mcpConfigSurface, mcpServerArtifact, mcpServerSourcePath, mcpServerVersion, mcpSettingsTarget, mcpSourceTarget, } from "./mcps/artifact.js";
|
|
@@ -45,12 +43,5 @@ export { configuredMcpServersToDiskRefs, configuredPacksToDiskRefs, configuredSk
|
|
|
45
43
|
export { canReuseExternalPackage, canReuseInstalledPackage, canonicalMaterializationPaths, createCanonicalDirectory, materializeExternalPackage, materializeExternalPackageWithTreeIntegrity, recoverCanonicalDirectory, replaceCanonicalDirectory, replaceCanonicalDirectoryWithInspection, } from "./extensions/canonical-directory.js";
|
|
46
44
|
// Registry-backed acquisition
|
|
47
45
|
export { materializeRegistryPackage, materializeRegistryPackageWithTreeIntegrity, } from "./registry-materialization.js";
|
|
48
|
-
// Closure recipes
|
|
49
|
-
export { buildAuthoredExtensionStep, buildInstallOperation, buildMaterializeOperation, buildNewExtensionStep, buildUninstallOperation, extensionRefLifecycleWarnings, extensionRefRegistryLifecycle, formatPackageUrlParts, targetFromRef, toLabel, toLabelWithCompanions, toStepKey, } from "./extensions/operations.js";
|
|
50
|
-
// Re-materializing content the workspace already accepted. Both the sync
|
|
51
|
-
// sweep and Pack activation restore retained members, and neither feature may
|
|
52
|
-
// import the other.
|
|
53
|
-
export { RetainedContentUnusable } from "./desired-state/errors.js";
|
|
54
|
-
export { collectRetainedMaterializeSteps, } from "./desired-state/retained-materialization.js";
|
|
55
46
|
export { projectionErrorToStepFailure } from "./projection-step-failure.js";
|
|
56
47
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { usableAcceptedCanonical } from "@agentxm/workspace-state";
|
|
2
|
+
import { LifecyclePostconditionViolated } from "../extensions/errors.js";
|
|
1
3
|
// @effect-diagnostics anyUnknownInErrorContext:off — schema and filesystem errors are swept into KnowledgeIoFailed inside this manager
|
|
2
4
|
/** Lifecycle manager for isolated Open Knowledge Format bundles. */
|
|
3
5
|
import * as Effect from "effect/Effect";
|
|
@@ -628,6 +630,19 @@ export const KnowledgeManagerLive = Layer.effect(KnowledgeManager, Effect.gen(fu
|
|
|
628
630
|
// Deactivation retains canonical content; the caller updates settings
|
|
629
631
|
// first, so re-rendering the whole region drops this bundle's routing.
|
|
630
632
|
const materializeDeactivate = Effect.fn("KnowledgeManager.materializeDeactivate")(() => applyKnowledgeProjection.pipe(Effect.as(withdrawn)));
|
|
633
|
+
const acquireCanonical = Effect.fn("KnowledgeManager.materializeInstall")(function* ({ ref, force }) {
|
|
634
|
+
const relativeLocalSource = ref.refType === "local"
|
|
635
|
+
? makeWorkspaceRelativeSourcePath(path, baseDir, ref.sourcePath ?? stripFileProtocol(ref.location))
|
|
636
|
+
: Option.none();
|
|
637
|
+
if (ref.refType === "local" && Option.isNone(relativeLocalSource)) {
|
|
638
|
+
return yield* new KnowledgeDefinitionInvalid({
|
|
639
|
+
detail: `Local knowledge source must stay within the workspace: ${ref.source.path}`,
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
const prepared = yield* preparePackage(ref, force === true);
|
|
643
|
+
yield* prepared.commit;
|
|
644
|
+
return acquiredFacts(prepared, relativeLocalSource);
|
|
645
|
+
}, Effect.scoped);
|
|
631
646
|
return {
|
|
632
647
|
type: "knowledge",
|
|
633
648
|
projectionPlans,
|
|
@@ -643,19 +658,8 @@ export const KnowledgeManagerLive = Layer.effect(KnowledgeManager, Effect.gen(fu
|
|
|
643
658
|
})),
|
|
644
659
|
install: installAtomically,
|
|
645
660
|
isInstalled: ({ target }) => isObservedInstalled(ws, "knowledge", target.name),
|
|
646
|
-
materializeInstall:
|
|
647
|
-
|
|
648
|
-
? makeWorkspaceRelativeSourcePath(path, baseDir, ref.sourcePath ?? stripFileProtocol(ref.location))
|
|
649
|
-
: Option.none();
|
|
650
|
-
if (ref.refType === "local" && Option.isNone(relativeLocalSource)) {
|
|
651
|
-
return yield* new KnowledgeDefinitionInvalid({
|
|
652
|
-
detail: `Local knowledge source must stay within the workspace: ${ref.source.path}`,
|
|
653
|
-
});
|
|
654
|
-
}
|
|
655
|
-
const prepared = yield* preparePackage(ref, force === true);
|
|
656
|
-
yield* prepared.commit;
|
|
657
|
-
return acquiredFacts(prepared, relativeLocalSource);
|
|
658
|
-
}, Effect.scoped),
|
|
661
|
+
materializeInstall: acquireCanonical,
|
|
662
|
+
acquireCanonical,
|
|
659
663
|
prepareSourceTransition: ({ ref }) => provide(prepareAcceptedCanonicalTransition({
|
|
660
664
|
workspace: ws,
|
|
661
665
|
type: "knowledge",
|
|
@@ -683,27 +687,30 @@ export const KnowledgeManagerLive = Layer.effect(KnowledgeManager, Effect.gen(fu
|
|
|
683
687
|
}),
|
|
684
688
|
materializeUninstall,
|
|
685
689
|
materializeDeactivate,
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
})
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
690
|
+
materializeRetained: ({ target }) => Effect.gen(function* () {
|
|
691
|
+
const canonical = yield* usableAcceptedCanonical({
|
|
692
|
+
workspace: ws,
|
|
693
|
+
type: "knowledge",
|
|
694
|
+
name: target.name,
|
|
695
|
+
});
|
|
696
|
+
if (Option.isNone(canonical) || canonical.value.ref.type !== "knowledge") {
|
|
697
|
+
return yield* new LifecyclePostconditionViolated({
|
|
698
|
+
postcondition: "materialize-observable",
|
|
699
|
+
targetType: "knowledge",
|
|
700
|
+
targetName: target.name,
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
return yield* materializeDeactivate({ target });
|
|
704
|
+
}),
|
|
705
|
+
acceptedResolution: ({ ref, materialization }) => buildLockEntry(ref, materialization).pipe(Effect.flatMap((lockEntry) => {
|
|
695
706
|
if (Option.isNone(lockEntry))
|
|
696
|
-
return
|
|
707
|
+
return Effect.succeed(Option.none());
|
|
697
708
|
const validate = lockEntry.value.type === "registry"
|
|
698
709
|
? validateExactResolvedVersion(`knowledge.${ref.knowledge.name}.resolvedVersion`, lockEntry.value.resolvedVersion)
|
|
699
710
|
: Effect.void;
|
|
700
|
-
return validate.pipe(Effect.
|
|
701
|
-
name: ref.knowledge.name,
|
|
702
|
-
lockEntry: lockEntry.value,
|
|
703
|
-
versionRange: Option.none(),
|
|
704
|
-
})));
|
|
711
|
+
return validate.pipe(Effect.as(Option.some({ key: ref.knowledge.name, entry: lockEntry.value })));
|
|
705
712
|
})),
|
|
706
|
-
|
|
713
|
+
withdrawnResolutionKeys: ({ target }) => Effect.succeed([target.name]),
|
|
707
714
|
};
|
|
708
715
|
}));
|
|
709
716
|
//# sourceMappingURL=manager.js.map
|
|
@@ -20,7 +20,7 @@ import type { ExtensionManagerFailure } from "./errors.js";
|
|
|
20
20
|
import type { NativeWriteAuthority } from "@agentxm/agent-integration";
|
|
21
21
|
import type { ProjectionPlan } from "@agentxm/workspace-projection";
|
|
22
22
|
import type { ExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/extension-ref";
|
|
23
|
-
import type { ExtensionTarget, ExtensionTargetFor } from "@agentxm/workspace-state";
|
|
23
|
+
import type { ExtensionTarget, ExtensionTargetFor, LockEntryByType } from "@agentxm/workspace-state";
|
|
24
24
|
/**
|
|
25
25
|
* The services every manager keeps in `R`: the platform it reads and writes
|
|
26
26
|
* through, the registry transport its acquisition steps use, and the authority
|
|
@@ -107,30 +107,28 @@ export interface ExtensionManager<TRef extends ExtensionRef, TMaterialization ex
|
|
|
107
107
|
readonly materializeUninstall: (args: {
|
|
108
108
|
readonly target: ExtensionTargetFor<TRef>;
|
|
109
109
|
}) => Effect.Effect<TMaterialization, ExtensionManagerFailure, R>;
|
|
110
|
+
/** Acquire canonical content without producing any native agent output. */
|
|
111
|
+
readonly acquireCanonical: ExtensionManager<TRef, TMaterialization, R>["materializeInstall"];
|
|
112
|
+
/** Restore projections from verified retained canonical content, without source resolution. */
|
|
113
|
+
readonly materializeRetained: (args: {
|
|
114
|
+
readonly target: ExtensionTargetFor<TRef>;
|
|
115
|
+
}) => Effect.Effect<TMaterialization, ExtensionManagerFailure, R>;
|
|
110
116
|
/** Remove active projections while retaining canonical managed content. */
|
|
111
117
|
readonly materializeDeactivate: (args: {
|
|
112
118
|
readonly target: ExtensionTargetFor<TRef>;
|
|
113
119
|
}) => Effect.Effect<TMaterialization, ExtensionManagerFailure, R>;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
readonly versionRange: Option.Option<string>;
|
|
117
|
-
/** What `materializeInstall` observed in this closure, when it ran. */
|
|
118
|
-
readonly materialization: Option.Option<TMaterialization>;
|
|
119
|
-
}) => Effect.Effect<void, ExtensionManagerFailure, R>;
|
|
120
|
-
readonly removeSettingsEntry: (args: {
|
|
121
|
-
readonly target: ExtensionTargetFor<TRef>;
|
|
122
|
-
/** What the withdrawal in this closure observed, when one ran. */
|
|
123
|
-
readonly materialization: Option.Option<TMaterialization>;
|
|
124
|
-
}) => Effect.Effect<void, ExtensionManagerFailure, R>;
|
|
125
|
-
readonly upsertLockfileEntry: (args: {
|
|
120
|
+
/** Verified acquisition facts; recording the resolution belongs to reconciliation. */
|
|
121
|
+
readonly acceptedResolution: (args: {
|
|
126
122
|
readonly ref: TRef;
|
|
127
|
-
/** What `materializeInstall` observed in this closure, when it ran. */
|
|
128
123
|
readonly materialization: Option.Option<TMaterialization>;
|
|
129
|
-
}) => Effect.Effect<
|
|
130
|
-
|
|
124
|
+
}) => Effect.Effect<Option.Option<{
|
|
125
|
+
readonly key: string;
|
|
126
|
+
readonly entry: LockEntryByType[TRef["type"]];
|
|
127
|
+
}>, ExtensionManagerFailure, R>;
|
|
128
|
+
/** Accepted keys associated with the withdrawal observed by this adapter. */
|
|
129
|
+
readonly withdrawnResolutionKeys: (args: {
|
|
131
130
|
readonly target: ExtensionTargetFor<TRef>;
|
|
132
|
-
/** What the withdrawal in this closure observed, when one ran. */
|
|
133
131
|
readonly materialization: Option.Option<TMaterialization>;
|
|
134
|
-
}) => Effect.Effect<
|
|
132
|
+
}) => Effect.Effect<ReadonlyArray<string>, ExtensionManagerFailure, R>;
|
|
135
133
|
}
|
|
136
134
|
//# sourceMappingURL=manager-contract.d.ts.map
|
|
@@ -11,11 +11,10 @@
|
|
|
11
11
|
* @experimental This API is unstable and may change without notice.
|
|
12
12
|
*/
|
|
13
13
|
import * as ServiceMap from "effect/Context";
|
|
14
|
-
import type { McpServerExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/mcp-server";
|
|
15
14
|
import type { PackRef } from "@agentxm/extension-model/unstable/extensions/refs/pack";
|
|
16
15
|
import type { SkillExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/skill";
|
|
17
16
|
import type { ExtensionManager, ManagerRequirements } from "./manager-contract.js";
|
|
18
|
-
import type { HookManagerService, KnowledgeManagerService,
|
|
17
|
+
import type { HookManagerService, KnowledgeManagerService, McpServerManagerService, PackMaterializationFacts, RuleManagerService, SkillMaterializationFacts, SubagentManagerService } from "./managers.js";
|
|
19
18
|
/** The manager each extension type is materialized through. */
|
|
20
19
|
export interface ExtensionManagersService {
|
|
21
20
|
readonly skill: ExtensionManager<SkillExtensionRef, SkillMaterializationFacts, ManagerRequirements>;
|
|
@@ -23,7 +22,7 @@ export interface ExtensionManagersService {
|
|
|
23
22
|
readonly rule: RuleManagerService;
|
|
24
23
|
readonly hook: HookManagerService;
|
|
25
24
|
readonly knowledge: KnowledgeManagerService;
|
|
26
|
-
readonly "mcp-server":
|
|
25
|
+
readonly "mcp-server": McpServerManagerService;
|
|
27
26
|
readonly pack: ExtensionManager<PackRef, PackMaterializationFacts, ManagerRequirements>;
|
|
28
27
|
}
|
|
29
28
|
declare const ExtensionManagers_base: ServiceMap.ServiceClass<ExtensionManagers, "@agentxm/extension-materialization/ExtensionManagers", ExtensionManagersService>;
|
package/dist/src/managers.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DesiredStateGraph } from "@agentxm/workspace-state";
|
|
1
2
|
/**
|
|
2
3
|
* Per-extension-type manager service tags and the materialization facts each
|
|
3
4
|
* manager reports.
|
|
@@ -17,7 +18,7 @@ import * as ServiceMap from "effect/Context";
|
|
|
17
18
|
import type { ExtensionManager, ManagerRequirements, MaterializationFacts, MaterializationObservation } from "./manager-contract.js";
|
|
18
19
|
import type { ExtensionManagerFailure } from "./errors.js";
|
|
19
20
|
import type { ProjectionPlan } from "@agentxm/workspace-projection";
|
|
20
|
-
import type { ConfiguredAgentOutcome } from "@agentxm/workspace-state";
|
|
21
|
+
import type { ConfiguredAgentOutcome, McpServerEntry } from "@agentxm/workspace-state";
|
|
21
22
|
import type { WorkspaceTransactionScope } from "@agentxm/workspace-transactions";
|
|
22
23
|
import type { SourceHash } from "@agentxm/extension-model/unstable/sources/source-hash";
|
|
23
24
|
import type { TreeIntegrity } from "@agentxm/workspace-state";
|
|
@@ -83,7 +84,15 @@ export type PackMaterializationFacts = AcquiredContentFacts;
|
|
|
83
84
|
declare const SkillManager_base: ServiceMap.ServiceClass<SkillManager, "@agentxm/extension-materialization/managers/SkillManager", ExtensionManager<SkillExtensionRef, SkillMaterializationFacts, ManagerRequirements>>;
|
|
84
85
|
export declare class SkillManager extends SkillManager_base {
|
|
85
86
|
}
|
|
86
|
-
|
|
87
|
+
export interface McpServerManagerService extends ExtensionManager<McpServerExtensionRef, McpServerMaterializationFacts, ManagerRequirements> {
|
|
88
|
+
readonly configuredAgentOutcomes: (state: "projected" | "current") => Effect.Effect<ReadonlyArray<ConfiguredAgentOutcome>, ExtensionManagerFailure, ManagerRequirements>;
|
|
89
|
+
readonly configuredAgentOutcomesForEntry: (args: {
|
|
90
|
+
readonly name: string;
|
|
91
|
+
readonly entry: McpServerEntry;
|
|
92
|
+
readonly state: "projected" | "current";
|
|
93
|
+
}) => Effect.Effect<ReadonlyArray<ConfiguredAgentOutcome>, ExtensionManagerFailure, ManagerRequirements>;
|
|
94
|
+
}
|
|
95
|
+
declare const McpServerManager_base: ServiceMap.ServiceClass<McpServerManager, "@agentxm/extension-materialization/managers/McpServerManager", McpServerManagerService>;
|
|
87
96
|
export declare class McpServerManager extends McpServerManager_base {
|
|
88
97
|
}
|
|
89
98
|
export interface SubagentManagerService extends ExtensionManager<SubagentExtensionRef, SubagentMaterializationFacts, ManagerRequirements> {
|
|
@@ -102,10 +111,20 @@ export interface RuleManagerService extends ExtensionManager<RuleExtensionRef, R
|
|
|
102
111
|
declare const RuleManager_base: ServiceMap.ServiceClass<RuleManager, "@agentxm/extension-materialization/managers/RuleManager", RuleManagerService>;
|
|
103
112
|
export declare class RuleManager extends RuleManager_base {
|
|
104
113
|
}
|
|
114
|
+
/** Hook contributors verified during preparation, before they enter the lockfile. */
|
|
115
|
+
export interface PreparedHookProjection {
|
|
116
|
+
readonly plans: ReadonlyArray<ProjectionPlan<void, ExtensionManagerFailure, ManagerRequirements>>;
|
|
117
|
+
readonly agentOutcomes: ReadonlyArray<ConfiguredAgentOutcome>;
|
|
118
|
+
readonly acquisitions: ReadonlyArray<{
|
|
119
|
+
readonly name: string;
|
|
120
|
+
readonly treeIntegrity: TreeIntegrity;
|
|
121
|
+
}>;
|
|
122
|
+
}
|
|
105
123
|
export interface HookManagerService extends ExtensionManager<HookExtensionRef, HookMaterializationFacts, ManagerRequirements> {
|
|
124
|
+
readonly prepareProjection: (refs: ReadonlyArray<HookExtensionRef>) => Effect.Effect<PreparedHookProjection, ExtensionManagerFailure, ManagerRequirements>;
|
|
106
125
|
readonly aggregateProjectionObservation: Effect.Effect<MaterializationObservation, ExtensionManagerFailure, ManagerRequirements>;
|
|
107
126
|
readonly projectionPlans: () => Effect.Effect<ReadonlyArray<ProjectionPlan<void, ExtensionManagerFailure, ManagerRequirements>>, ExtensionManagerFailure, ManagerRequirements>;
|
|
108
|
-
readonly configuredAgentOutcomes?: (state: "projected" | "current") => Effect.Effect<ReadonlyArray<ConfiguredAgentOutcome>, ExtensionManagerFailure, ManagerRequirements>;
|
|
127
|
+
readonly configuredAgentOutcomes?: (state: "projected" | "current", proposedGraph?: DesiredStateGraph) => Effect.Effect<ReadonlyArray<ConfiguredAgentOutcome>, ExtensionManagerFailure, ManagerRequirements>;
|
|
109
128
|
readonly configuredAgentOutcomesForRef?: (ref: HookExtensionRef, state: "projected" | "current") => Effect.Effect<ReadonlyArray<ConfiguredAgentOutcome>, ExtensionManagerFailure, ManagerRequirements>;
|
|
110
129
|
}
|
|
111
130
|
declare const HookManager_base: ServiceMap.ServiceClass<HookManager, "@agentxm/extension-materialization/managers/HookManager", HookManagerService>;
|
package/dist/src/managers.js
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Per-extension-type manager service tags and the materialization facts each
|
|
3
|
-
* manager reports.
|
|
4
|
-
*
|
|
5
|
-
* Plan-building features require a manager through its tag without depending
|
|
6
|
-
* on the module that implements it. Every tag pins the facts type its manager
|
|
7
|
-
* carries from a materialization to the settings and lockfile writes that
|
|
8
|
-
* follow it in the same closure, so nothing travels through state the layer
|
|
9
|
-
* keeps alive between calls.
|
|
10
|
-
*
|
|
11
|
-
* @experimental This API is unstable and may change without notice.
|
|
12
|
-
* @packageDocumentation
|
|
13
|
-
*/
|
|
14
1
|
import * as ServiceMap from "effect/Context";
|
|
15
2
|
// -----------------------------------------------------------------------------
|
|
16
3
|
// Service tags
|