@agentxm/extension-materialization 0.28.14-preview.1789139351.5cd4595aa
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/LICENSE +110 -0
- package/README.md +16 -0
- package/dist/src/desired-state/errors.d.ts +22 -0
- package/dist/src/desired-state/errors.js +22 -0
- package/dist/src/desired-state/retained-materialization.d.ts +58 -0
- package/dist/src/desired-state/retained-materialization.js +119 -0
- package/dist/src/errors.d.ts +42 -0
- package/dist/src/errors.js +14 -0
- package/dist/src/extensions/canonical-directory.d.ts +106 -0
- package/dist/src/extensions/canonical-directory.js +210 -0
- package/dist/src/extensions/canonical-reuse.d.ts +43 -0
- package/dist/src/extensions/canonical-reuse.js +38 -0
- package/dist/src/extensions/copy-directory.d.ts +50 -0
- package/dist/src/extensions/copy-directory.js +78 -0
- package/dist/src/extensions/errors.d.ts +97 -0
- package/dist/src/extensions/errors.js +42 -0
- package/dist/src/extensions/materializable-from-disk.d.ts +37 -0
- package/dist/src/extensions/materializable-from-disk.js +89 -0
- package/dist/src/extensions/operations.d.ts +252 -0
- package/dist/src/extensions/operations.js +631 -0
- package/dist/src/hooks/errors.d.ts +33 -0
- package/dist/src/hooks/errors.js +18 -0
- package/dist/src/hooks/manager.d.ts +13 -0
- package/dist/src/hooks/manager.js +778 -0
- package/dist/src/index.d.ts +44 -0
- package/dist/src/index.js +56 -0
- package/dist/src/knowledge/errors.d.ts +75 -0
- package/dist/src/knowledge/errors.js +36 -0
- package/dist/src/knowledge/manager.d.ts +9 -0
- package/dist/src/knowledge/manager.js +709 -0
- package/dist/src/live.d.ts +20 -0
- package/dist/src/live.js +20 -0
- package/dist/src/manager-contract.d.ts +136 -0
- package/dist/src/manager-contract.js +19 -0
- package/dist/src/manager-registry-live.d.ts +11 -0
- package/dist/src/manager-registry-live.js +23 -0
- package/dist/src/manager-registry.d.ts +37 -0
- package/dist/src/manager-registry.js +22 -0
- package/dist/src/managers.d.ts +147 -0
- package/dist/src/managers.js +32 -0
- package/dist/src/mcps/artifact.d.ts +24 -0
- package/dist/src/mcps/artifact.js +74 -0
- package/dist/src/mcps/authored-materialization.d.ts +28 -0
- package/dist/src/mcps/authored-materialization.js +34 -0
- package/dist/src/mcps/errors.d.ts +105 -0
- package/dist/src/mcps/errors.js +40 -0
- package/dist/src/mcps/install-operation.d.ts +92 -0
- package/dist/src/mcps/install-operation.js +557 -0
- package/dist/src/mcps/manager.d.ts +15 -0
- package/dist/src/mcps/manager.js +253 -0
- package/dist/src/mcps/native-entry.d.ts +51 -0
- package/dist/src/mcps/native-entry.js +100 -0
- package/dist/src/mcps/secret-store-live.d.ts +14 -0
- package/dist/src/mcps/secret-store-live.js +58 -0
- package/dist/src/mcps/secret-store.d.ts +55 -0
- package/dist/src/mcps/secret-store.js +33 -0
- package/dist/src/packs/errors.d.ts +50 -0
- package/dist/src/packs/errors.js +24 -0
- package/dist/src/packs/manager.d.ts +16 -0
- package/dist/src/packs/manager.js +189 -0
- package/dist/src/projection-participants-live.d.ts +17 -0
- package/dist/src/projection-participants-live.js +66 -0
- package/dist/src/projection-step-failure.d.ts +19 -0
- package/dist/src/projection-step-failure.js +76 -0
- package/dist/src/registry-materialization.d.ts +52 -0
- package/dist/src/registry-materialization.js +67 -0
- package/dist/src/rules/errors.d.ts +31 -0
- package/dist/src/rules/errors.js +17 -0
- package/dist/src/rules/manager.d.ts +18 -0
- package/dist/src/rules/manager.js +492 -0
- package/dist/src/skills/errors.d.ts +42 -0
- package/dist/src/skills/errors.js +21 -0
- package/dist/src/skills/manager.d.ts +17 -0
- package/dist/src/skills/manager.js +339 -0
- package/dist/src/skills/materialization.d.ts +52 -0
- package/dist/src/skills/materialization.js +168 -0
- package/dist/src/skills/skill-artifact.d.ts +38 -0
- package/dist/src/skills/skill-artifact.js +70 -0
- package/dist/src/skills/source-hash.d.ts +2 -0
- package/dist/src/skills/source-hash.js +6 -0
- package/dist/src/subagents/errors.d.ts +43 -0
- package/dist/src/subagents/errors.js +20 -0
- package/dist/src/subagents/lock-entry-builder.d.ts +20 -0
- package/dist/src/subagents/lock-entry-builder.js +63 -0
- package/dist/src/subagents/manager.d.ts +17 -0
- package/dist/src/subagents/manager.js +736 -0
- package/dist/src/testing.d.ts +87 -0
- package/dist/src/testing.js +116 -0
- package/package.json +70 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-memory materialization doubles for feature tests: a manager whose
|
|
3
|
+
* surfaces are recorded rather than written, a retention policy that never
|
|
4
|
+
* retains, and a structural serialization of a recipe's typed failure into the
|
|
5
|
+
* plan-step vocabulary.
|
|
6
|
+
*
|
|
7
|
+
* These are deliberately behavioural, not mocks of a shape: a test asserts on
|
|
8
|
+
* what the recorder observed, so a contract change that stops calling a
|
|
9
|
+
* surface fails the test rather than passing silently.
|
|
10
|
+
*
|
|
11
|
+
* @experimental This API is unstable and may change without notice.
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
import * as Layer from "effect/Layer";
|
|
15
|
+
import * as Option from "effect/Option";
|
|
16
|
+
import { StepFailure } from "@agentxm/workspace-operations";
|
|
17
|
+
import type { ExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/extension-ref";
|
|
18
|
+
import type { ExtensionTarget } from "@agentxm/workspace-state";
|
|
19
|
+
import type { ExtensionManager, ManagerRequirements, MaterializationFacts } from "./manager-contract.js";
|
|
20
|
+
import type { CallerStepFailure, UninstallRetentionPolicy } from "./extensions/operations.js";
|
|
21
|
+
import { McpSecretStore } from "./mcps/secret-store.js";
|
|
22
|
+
/** The manager surfaces one recipe touched, in the order it touched them. */
|
|
23
|
+
export type RecordedManagerSurface = "materializeInstall" | "materializeUninstall" | "materializeDeactivate" | "upsertSettingsEntry" | "removeSettingsEntry" | "upsertLockfileEntry" | "removeLockfileEntry" | "listMaterializable" | "projectionPlans";
|
|
24
|
+
/** What an in-memory manager observed while a recipe ran against it. */
|
|
25
|
+
export interface RecordedManager<TRef extends ExtensionRef> {
|
|
26
|
+
readonly manager: ExtensionManager<TRef, MaterializationFacts, ManagerRequirements>;
|
|
27
|
+
/** Every surface the recipe touched, in call order. */
|
|
28
|
+
readonly surfaces: ReadonlyArray<RecordedManagerSurface>;
|
|
29
|
+
/** Targets currently declared in the recorder's settings. */
|
|
30
|
+
readonly configured: ReadonlySet<string>;
|
|
31
|
+
/** Targets currently observable as installed. */
|
|
32
|
+
readonly installed: ReadonlySet<string>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A materialization that observed nothing and acquired nothing. It satisfies
|
|
36
|
+
* every per-type facts shape, so a feature test that never asserts on content
|
|
37
|
+
* identity uses one value for any manager.
|
|
38
|
+
*/
|
|
39
|
+
export declare const NO_MATERIALIZATION_FACTS: {
|
|
40
|
+
readonly observation: import("./manager-contract.js").MaterializationObservation;
|
|
41
|
+
readonly treeIntegrity: Option.Option<never>;
|
|
42
|
+
readonly sourceHash: Option.Option<never>;
|
|
43
|
+
readonly acquired: Option.Option<never>;
|
|
44
|
+
readonly removal: Option.Option<never>;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* A manager whose authoritative surfaces are in-memory sets. `materializable`
|
|
48
|
+
* is what `listMaterializable` answers; anything installed through the
|
|
49
|
+
* recorder becomes both configured and observable.
|
|
50
|
+
*/
|
|
51
|
+
export declare const makeRecordedManager: <TRef extends ExtensionRef>(args: {
|
|
52
|
+
readonly type: TRef["type"];
|
|
53
|
+
readonly materializable: ReadonlyArray<TRef>;
|
|
54
|
+
/** Targets already installed and declared before the recipe runs. */
|
|
55
|
+
readonly installed?: ReadonlyArray<string>;
|
|
56
|
+
}) => RecordedManager<TRef>;
|
|
57
|
+
/** A retention policy that never retains a package for an installed Pack. */
|
|
58
|
+
export declare const noUninstallRetention: UninstallRetentionPolicy;
|
|
59
|
+
/** A retention policy that always retains, for the retained-by-pack settlement. */
|
|
60
|
+
export declare const alwaysUninstallRetention: UninstallRetentionPolicy;
|
|
61
|
+
/**
|
|
62
|
+
* A structural serialization of a recipe's typed failure: the producing
|
|
63
|
+
* family's own detail sentence under an `internal` category. Assertions bind
|
|
64
|
+
* to this mapping, not to the application boundary's wording.
|
|
65
|
+
*/
|
|
66
|
+
export declare const structuralStepFailure: <F>(failure: CallerStepFailure<F>) => StepFailure;
|
|
67
|
+
/** A retention target's plan-step identity, for assertions on recorded steps. */
|
|
68
|
+
export declare const recordedTargetName: (target: ExtensionTarget) => string;
|
|
69
|
+
/** What an in-memory credential store recorded, and the layer that backs it. */
|
|
70
|
+
export interface MemoryMcpSecretStore {
|
|
71
|
+
readonly layer: Layer.Layer<McpSecretStore>;
|
|
72
|
+
/** Every account currently holding a value, keyed by account digest. */
|
|
73
|
+
readonly entries: ReadonlyMap<string, string>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* An in-memory credential store for MCP install tests.
|
|
77
|
+
*
|
|
78
|
+
* `failWrites` stands for a keychain that is present but refuses to persist —
|
|
79
|
+
* locked, full, or denied — which is the condition the install reports as a
|
|
80
|
+
* credential action rather than a failed closure.
|
|
81
|
+
*/
|
|
82
|
+
export declare const makeMemoryMcpSecretStore: (options?: {
|
|
83
|
+
readonly failWrites?: boolean;
|
|
84
|
+
/** Values already held, keyed by account digest. */
|
|
85
|
+
readonly initial?: Readonly<Record<string, string>>;
|
|
86
|
+
}) => MemoryMcpSecretStore;
|
|
87
|
+
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-memory materialization doubles for feature tests: a manager whose
|
|
3
|
+
* surfaces are recorded rather than written, a retention policy that never
|
|
4
|
+
* retains, and a structural serialization of a recipe's typed failure into the
|
|
5
|
+
* plan-step vocabulary.
|
|
6
|
+
*
|
|
7
|
+
* These are deliberately behavioural, not mocks of a shape: a test asserts on
|
|
8
|
+
* what the recorder observed, so a contract change that stops calling a
|
|
9
|
+
* surface fails the test rather than passing silently.
|
|
10
|
+
*
|
|
11
|
+
* @experimental This API is unstable and may change without notice.
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
import * as Effect from "effect/Effect";
|
|
15
|
+
import * as Layer from "effect/Layer";
|
|
16
|
+
import * as Option from "effect/Option";
|
|
17
|
+
import { StepFailure } from "@agentxm/workspace-operations";
|
|
18
|
+
import { NO_MATERIALIZATION_OBSERVATION } from "./manager-contract.js";
|
|
19
|
+
import { targetFromRef } from "./extensions/operations.js";
|
|
20
|
+
import { McpSecretStore } from "./mcps/secret-store.js";
|
|
21
|
+
/**
|
|
22
|
+
* A materialization that observed nothing and acquired nothing. It satisfies
|
|
23
|
+
* every per-type facts shape, so a feature test that never asserts on content
|
|
24
|
+
* identity uses one value for any manager.
|
|
25
|
+
*/
|
|
26
|
+
export const NO_MATERIALIZATION_FACTS = {
|
|
27
|
+
observation: NO_MATERIALIZATION_OBSERVATION,
|
|
28
|
+
treeIntegrity: Option.none(),
|
|
29
|
+
sourceHash: Option.none(),
|
|
30
|
+
acquired: Option.none(),
|
|
31
|
+
removal: Option.none(),
|
|
32
|
+
};
|
|
33
|
+
const NO_FACTS = NO_MATERIALIZATION_FACTS;
|
|
34
|
+
/**
|
|
35
|
+
* A manager whose authoritative surfaces are in-memory sets. `materializable`
|
|
36
|
+
* is what `listMaterializable` answers; anything installed through the
|
|
37
|
+
* recorder becomes both configured and observable.
|
|
38
|
+
*/
|
|
39
|
+
export const makeRecordedManager = (args) => {
|
|
40
|
+
const surfaces = [];
|
|
41
|
+
const configured = new Set(args.installed ?? []);
|
|
42
|
+
const installed = new Set(args.installed ?? []);
|
|
43
|
+
const record = (surface, effect) => Effect.sync(() => surfaces.push(surface)).pipe(Effect.andThen(effect));
|
|
44
|
+
const manager = {
|
|
45
|
+
type: args.type,
|
|
46
|
+
isInstalled: ({ target }) => Effect.succeed(installed.has(target.name)),
|
|
47
|
+
materializeInstall: ({ ref }) => record("materializeInstall", Effect.sync(() => {
|
|
48
|
+
installed.add(targetFromRef(ref).name);
|
|
49
|
+
return NO_FACTS;
|
|
50
|
+
})),
|
|
51
|
+
materializeUninstall: ({ target }) => record("materializeUninstall", Effect.sync(() => {
|
|
52
|
+
installed.delete(target.name);
|
|
53
|
+
return NO_FACTS;
|
|
54
|
+
})),
|
|
55
|
+
materializeDeactivate: () => record("materializeDeactivate", Effect.succeed(NO_FACTS)),
|
|
56
|
+
getConfiguredSource: ({ target }) => Effect.succeed(configured.has(target.name) ? Option.some("workspace:") : Option.none()),
|
|
57
|
+
isConfigured: ({ target }) => Effect.succeed(configured.has(target.name)),
|
|
58
|
+
listMaterializable: () => record("listMaterializable", Effect.succeed(args.materializable)),
|
|
59
|
+
upsertSettingsEntry: ({ ref }) => record("upsertSettingsEntry", Effect.sync(() => {
|
|
60
|
+
configured.add(targetFromRef(ref).name);
|
|
61
|
+
})),
|
|
62
|
+
removeSettingsEntry: ({ target }) => record("removeSettingsEntry", Effect.sync(() => {
|
|
63
|
+
configured.delete(target.name);
|
|
64
|
+
})),
|
|
65
|
+
upsertLockfileEntry: () => record("upsertLockfileEntry", Effect.void),
|
|
66
|
+
removeLockfileEntry: () => record("removeLockfileEntry", Effect.void),
|
|
67
|
+
};
|
|
68
|
+
return { manager, surfaces, configured, installed };
|
|
69
|
+
};
|
|
70
|
+
/** A retention policy that never retains a package for an installed Pack. */
|
|
71
|
+
export const noUninstallRetention = {
|
|
72
|
+
isRequiredByInstalledPack: () => Effect.succeed(false),
|
|
73
|
+
};
|
|
74
|
+
/** A retention policy that always retains, for the retained-by-pack settlement. */
|
|
75
|
+
export const alwaysUninstallRetention = {
|
|
76
|
+
isRequiredByInstalledPack: () => Effect.succeed(true),
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* A structural serialization of a recipe's typed failure: the producing
|
|
80
|
+
* family's own detail sentence under an `internal` category. Assertions bind
|
|
81
|
+
* to this mapping, not to the application boundary's wording.
|
|
82
|
+
*/
|
|
83
|
+
export const structuralStepFailure = (failure) => {
|
|
84
|
+
const detail = typeof failure === "object" &&
|
|
85
|
+
failure !== null &&
|
|
86
|
+
"detail" in failure &&
|
|
87
|
+
typeof failure.detail === "string"
|
|
88
|
+
? failure.detail
|
|
89
|
+
: String(failure);
|
|
90
|
+
return new StepFailure({ category: "internal", detail, cause: failure });
|
|
91
|
+
};
|
|
92
|
+
/** A retention target's plan-step identity, for assertions on recorded steps. */
|
|
93
|
+
export const recordedTargetName = (target) => target.name;
|
|
94
|
+
/**
|
|
95
|
+
* An in-memory credential store for MCP install tests.
|
|
96
|
+
*
|
|
97
|
+
* `failWrites` stands for a keychain that is present but refuses to persist —
|
|
98
|
+
* locked, full, or denied — which is the condition the install reports as a
|
|
99
|
+
* credential action rather than a failed closure.
|
|
100
|
+
*/
|
|
101
|
+
export const makeMemoryMcpSecretStore = (options) => {
|
|
102
|
+
const entries = new Map(Object.entries(options?.initial ?? {}));
|
|
103
|
+
const failWrites = options?.failWrites ?? false;
|
|
104
|
+
const service = {
|
|
105
|
+
read: (account) => Effect.sync(() => Option.fromNullOr(entries.get(account) ?? null)),
|
|
106
|
+
write: (account, value) => Effect.sync(() => {
|
|
107
|
+
if (failWrites)
|
|
108
|
+
return "failed";
|
|
109
|
+
entries.set(account, value);
|
|
110
|
+
return "saved";
|
|
111
|
+
}),
|
|
112
|
+
erase: (account) => Effect.sync(() => (entries.delete(account) ? "deleted" : "absent")),
|
|
113
|
+
};
|
|
114
|
+
return { layer: Layer.succeed(McpSecretStore, service), entries };
|
|
115
|
+
};
|
|
116
|
+
//# sourceMappingURL=testing.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": "AgentXM <hello@agentxm.ai> (https://agentxm.ai)",
|
|
3
|
+
"bugs": {
|
|
4
|
+
"url": "https://github.com/agentxm/axm/issues"
|
|
5
|
+
},
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@agentxm/agent-integration": "^0.28.14-preview.1789139351.5cd4595aa",
|
|
8
|
+
"@agentxm/extension-content": "^0.28.14-preview.1789139351.5cd4595aa",
|
|
9
|
+
"@agentxm/extension-model": "^0.28.14-preview.1789139351.5cd4595aa",
|
|
10
|
+
"@agentxm/extension-resolution": "^0.28.14-preview.1789139351.5cd4595aa",
|
|
11
|
+
"@agentxm/extension-sources": "^0.28.14-preview.1789139351.5cd4595aa",
|
|
12
|
+
"@agentxm/registry-client": "^0.28.14-preview.1789139351.5cd4595aa",
|
|
13
|
+
"@agentxm/workspace-operations": "^0.28.14-preview.1789139351.5cd4595aa",
|
|
14
|
+
"@agentxm/workspace-projection": "^0.28.14-preview.1789139351.5cd4595aa",
|
|
15
|
+
"@agentxm/workspace-state": "^0.28.14-preview.1789139351.5cd4595aa",
|
|
16
|
+
"@agentxm/workspace-transactions": "^0.28.14-preview.1789139351.5cd4595aa",
|
|
17
|
+
"@napi-rs/keyring": "^1.3.0",
|
|
18
|
+
"effect": "4.0.0-rc.112"
|
|
19
|
+
},
|
|
20
|
+
"description": "AXM extension materialization: the per-extension-type manager contract and implementations, canonical package staging, registry materialization, and the install/uninstall/authored closure recipes for the axm CLI. Unstable and unsupported — use the axm.sh CLI.",
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@effect/platform-node": "4.0.0-rc.112",
|
|
23
|
+
"@effect/vitest": "4.0.0-rc.112",
|
|
24
|
+
"@typescript/native": "npm:typescript@^7.0.2",
|
|
25
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
26
|
+
"vitest": "^4.1.10",
|
|
27
|
+
"yaml": "^2.9.0"
|
|
28
|
+
},
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=22.19.0"
|
|
31
|
+
},
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"axm-source": "./src/index.ts",
|
|
35
|
+
"default": "./dist/src/index.js",
|
|
36
|
+
"types": "./dist/src/index.d.ts"
|
|
37
|
+
},
|
|
38
|
+
"./live": {
|
|
39
|
+
"axm-source": "./src/live.ts",
|
|
40
|
+
"default": "./dist/src/live.js",
|
|
41
|
+
"types": "./dist/src/live.d.ts"
|
|
42
|
+
},
|
|
43
|
+
"./testing": {
|
|
44
|
+
"axm-source": "./src/testing.ts",
|
|
45
|
+
"default": "./dist/src/testing.js",
|
|
46
|
+
"types": "./dist/src/testing.d.ts"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"files": [
|
|
50
|
+
"dist/src/",
|
|
51
|
+
"!**/*.map"
|
|
52
|
+
],
|
|
53
|
+
"homepage": "https://axm.sh",
|
|
54
|
+
"license": "FSL-1.1-MIT",
|
|
55
|
+
"name": "@agentxm/extension-materialization",
|
|
56
|
+
"nx": {
|
|
57
|
+
"includedScripts": []
|
|
58
|
+
},
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"access": "public"
|
|
61
|
+
},
|
|
62
|
+
"repository": {
|
|
63
|
+
"directory": "packages/core/extension-materialization",
|
|
64
|
+
"type": "git",
|
|
65
|
+
"url": "https://github.com/agentxm/axm.git"
|
|
66
|
+
},
|
|
67
|
+
"sideEffects": false,
|
|
68
|
+
"type": "module",
|
|
69
|
+
"version": "0.28.14-preview.1789139351.5cd4595aa"
|
|
70
|
+
}
|