dsh-mnemon 0.2.15 → 0.3.0
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/README.md +18 -11
- package/README.zh-CN.md +18 -11
- package/SECURITY.md +12 -5
- package/lib/client.js +256 -24
- package/lib/contracts.js +36 -0
- package/lib/extension-sdk.js +238 -0
- package/lib/index.js +2230 -2993
- package/lib/kernel.js +1126 -0
- package/lib/layers/documents.js +31 -0
- package/lib/layers/memory-spaces.js +34 -0
- package/lib/layers/runtime.js +27 -0
- package/lib/provider-sdk.js +2 -0
- package/lib/registry-B9SdBRLo.js +2423 -0
- package/lib/strategy-default-three-tier.js +99 -0
- package/lib/strategy-sdk.js +56 -0
- package/lib/types/packages/contracts/src/index.d.ts +221 -0
- package/lib/types/packages/extension-sdk/src/index.d.ts +54 -0
- package/lib/types/packages/kernel/src/access.d.ts +14 -0
- package/lib/types/packages/kernel/src/catalog.d.ts +42 -0
- package/lib/types/packages/kernel/src/index.d.ts +5 -0
- package/lib/types/packages/kernel/src/kernel.d.ts +46 -0
- package/lib/types/packages/kernel/src/topology.d.ts +25 -0
- package/lib/types/packages/kernel/src/view.d.ts +78 -0
- package/lib/types/packages/layer-documents/src/index.d.ts +4 -0
- package/lib/types/packages/layer-memory-spaces/src/index.d.ts +4 -0
- package/lib/types/packages/layer-runtime/src/index.d.ts +4 -0
- package/lib/types/packages/provider-sdk/src/index.d.ts +19 -0
- package/lib/types/packages/strategy-default-three-tier/src/index.d.ts +7 -0
- package/lib/types/packages/strategy-sdk/src/index.d.ts +35 -0
- package/lib/types/{client → src/client}/api.d.ts +2 -1
- package/lib/types/{client → src/client}/locales.d.ts +34 -0
- package/lib/types/{contracts.d.ts → src/contracts.d.ts} +3 -0
- package/lib/types/{documents.d.ts → src/documents.d.ts} +7 -2
- package/lib/types/src/guidance.d.ts +23 -0
- package/lib/types/{index.d.ts → src/index.d.ts} +3 -1
- package/lib/types/{lifecycle.d.ts → src/lifecycle.d.ts} +5 -9
- package/lib/types/{live-runtime.d.ts → src/live-runtime.d.ts} +30 -3
- package/lib/types/{memory-bodies.d.ts → src/memory-bodies.d.ts} +3 -0
- package/lib/types/src/memory-receipts.d.ts +21 -0
- package/lib/types/src/memory-system/access.d.ts +2 -0
- package/lib/types/src/memory-system/catalog.d.ts +2 -0
- package/lib/types/src/memory-system/contracts.d.ts +2 -0
- package/lib/types/src/memory-system/defaults.d.ts +6 -0
- package/lib/types/src/memory-system/index.d.ts +7 -0
- package/lib/types/src/memory-system/kernel.d.ts +2 -0
- package/lib/types/src/memory-system/topology.d.ts +2 -0
- package/lib/types/src/memory-system/view.d.ts +2 -0
- package/lib/types/src/memory-view.d.ts +15 -0
- package/lib/types/src/provider-sdk.d.ts +4 -0
- package/lib/types/src/providers/memory-system.d.ts +6 -0
- package/lib/types/src/providers/registry.d.ts +23 -0
- package/lib/types/{runtime-memory.d.ts → src/runtime-memory.d.ts} +29 -3
- package/lib/types/src/search-tokens.d.ts +5 -0
- package/lib/types/{service.d.ts → src/service.d.ts} +9 -1
- package/lib/types/{shared → src/shared}/contracts.d.ts +25 -0
- package/lib/types/{subagent.d.ts → src/subagent.d.ts} +29 -19
- package/lib/types/{tools.d.ts → src/tools.d.ts} +2 -9
- package/package.json +45 -9
- package/lib/types/guidance.d.ts +0 -11
- /package/lib/types/{activity.d.ts → src/activity.d.ts} +0 -0
- /package/lib/types/{channels.d.ts → src/channels.d.ts} +0 -0
- /package/lib/types/{client → src/client}/GlobalLocationSetting.d.ts +0 -0
- /package/lib/types/{client → src/client}/MnemonDialog.d.ts +0 -0
- /package/lib/types/{client → src/client}/MnemonLogo.d.ts +0 -0
- /package/lib/types/{client → src/client}/MnemonPackSection.d.ts +0 -0
- /package/lib/types/{client → src/client}/MnemonSaveAction.d.ts +0 -0
- /package/lib/types/{client → src/client}/MnemonSettingsCard.d.ts +0 -0
- /package/lib/types/{client → src/client}/MnemonTurnTail.d.ts +0 -0
- /package/lib/types/{client → src/client}/MnemonView.d.ts +0 -0
- /package/lib/types/{client → src/client}/MnemonViewAppearance.d.ts +0 -0
- /package/lib/types/{client → src/client}/ProviderIcon.d.ts +0 -0
- /package/lib/types/{client → src/client}/ProviderSettingsSection.d.ts +0 -0
- /package/lib/types/{client → src/client}/anchor.d.ts +0 -0
- /package/lib/types/{client → src/client}/dsh-compat.d.ts +0 -0
- /package/lib/types/{client → src/client}/index.d.ts +0 -0
- /package/lib/types/{client → src/client}/settings.d.ts +0 -0
- /package/lib/types/{client → src/client}/sidebar-entry.d.ts +0 -0
- /package/lib/types/{client → src/client}/use-request-version.d.ts +0 -0
- /package/lib/types/{client → src/client}/workspace-controller.d.ts +0 -0
- /package/lib/types/{client → src/client}/workspace-mount.d.ts +0 -0
- /package/lib/types/{commands.d.ts → src/commands.d.ts} +0 -0
- /package/lib/types/{config-values.d.ts → src/config-values.d.ts} +0 -0
- /package/lib/types/{config.d.ts → src/config.d.ts} +0 -0
- /package/lib/types/{pack.d.ts → src/pack.d.ts} +0 -0
- /package/lib/types/{process.d.ts → src/process.d.ts} +0 -0
- /package/lib/types/{provider-placement.d.ts → src/provider-placement.d.ts} +0 -0
- /package/lib/types/{providers → src/providers}/byterover.d.ts +0 -0
- /package/lib/types/{providers → src/providers}/catalog.d.ts +0 -0
- /package/lib/types/{providers → src/providers}/hindsight.d.ts +0 -0
- /package/lib/types/{providers → src/providers}/holographic.d.ts +0 -0
- /package/lib/types/{providers → src/providers}/honcho.d.ts +0 -0
- /package/lib/types/{providers → src/providers}/http.d.ts +0 -0
- /package/lib/types/{providers → src/providers}/mem0.d.ts +0 -0
- /package/lib/types/{providers → src/providers}/openviking.d.ts +0 -0
- /package/lib/types/{providers → src/providers}/provider.d.ts +0 -0
- /package/lib/types/{providers → src/providers}/retaindb.d.ts +0 -0
- /package/lib/types/{providers → src/providers}/supermemory.d.ts +0 -0
- /package/lib/types/{recall-quality → src/recall-quality}/contracts.d.ts +0 -0
- /package/lib/types/{recall-quality → src/recall-quality}/engine.d.ts +0 -0
- /package/lib/types/{recall-quality → src/recall-quality}/index.d.ts +0 -0
- /package/lib/types/{recall-quality → src/recall-quality}/policies.d.ts +0 -0
- /package/lib/types/{recall-quality → src/recall-quality}/registry.d.ts +0 -0
- /package/lib/types/{review-activity.d.ts → src/review-activity.d.ts} +0 -0
- /package/lib/types/{rpc.d.ts → src/rpc.d.ts} +0 -0
- /package/lib/types/{runner.d.ts → src/runner.d.ts} +0 -0
- /package/lib/types/{settings.d.ts → src/settings.d.ts} +0 -0
- /package/lib/types/{storage-scope.d.ts → src/storage-scope.d.ts} +0 -0
- /package/lib/types/{version-updates.d.ts → src/version-updates.d.ts} +0 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { RUNTIME_MEMORY_LAYER } from "./layers/runtime.js";
|
|
2
|
+
import { DOCUMENTS_MEMORY_LAYER } from "./layers/documents.js";
|
|
3
|
+
import { MEMORY_SPACES_LAYER } from "./layers/memory-spaces.js";
|
|
4
|
+
import { participationChannel } from "./kernel.js";
|
|
5
|
+
//#region packages/strategy-default-three-tier/src/index.ts
|
|
6
|
+
const BUILTIN_MEMORY_LAYERS = [
|
|
7
|
+
RUNTIME_MEMORY_LAYER,
|
|
8
|
+
DOCUMENTS_MEMORY_LAYER,
|
|
9
|
+
MEMORY_SPACES_LAYER
|
|
10
|
+
];
|
|
11
|
+
const DEFAULT_LAYER_PARTICIPATION = Object.freeze({
|
|
12
|
+
recall: "automatic",
|
|
13
|
+
write: "automatic",
|
|
14
|
+
projection: "automatic",
|
|
15
|
+
maintenance: "automatic"
|
|
16
|
+
});
|
|
17
|
+
function topologyLayer(id) {
|
|
18
|
+
return {
|
|
19
|
+
id,
|
|
20
|
+
enabled: true,
|
|
21
|
+
participation: { ...DEFAULT_LAYER_PARTICIPATION },
|
|
22
|
+
adapterIds: []
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const DEFAULT_THREE_TIER_TOPOLOGY = Object.freeze({
|
|
26
|
+
id: "default-three-tier",
|
|
27
|
+
strategyId: "default-three-tier",
|
|
28
|
+
layers: Object.freeze([
|
|
29
|
+
topologyLayer("runtime"),
|
|
30
|
+
topologyLayer("documents"),
|
|
31
|
+
topologyLayer("memory-spaces")
|
|
32
|
+
])
|
|
33
|
+
});
|
|
34
|
+
function accepts(layer, request) {
|
|
35
|
+
if (!layer.enabled) return false;
|
|
36
|
+
const mode = layer.participation[participationChannel(request.capability)];
|
|
37
|
+
if (mode === "off") return false;
|
|
38
|
+
if (request.trigger !== "manual" && mode !== "automatic") return false;
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
const DEFAULT_THREE_TIER_STRATEGY = {
|
|
42
|
+
descriptor: {
|
|
43
|
+
id: "default-three-tier",
|
|
44
|
+
version: "1",
|
|
45
|
+
label: "Default three-tier strategy",
|
|
46
|
+
description: "Routes explicit operations to compatible enabled layers in stable topology order.",
|
|
47
|
+
hooks: [
|
|
48
|
+
"placement",
|
|
49
|
+
"retrieval-planning",
|
|
50
|
+
"projection",
|
|
51
|
+
"maintenance"
|
|
52
|
+
],
|
|
53
|
+
deterministic: true
|
|
54
|
+
},
|
|
55
|
+
propose(request, context) {
|
|
56
|
+
const candidates = request.candidateLayerIds === void 0 ? void 0 : new Set(request.candidateLayerIds);
|
|
57
|
+
const adapters = request.adapterIds === void 0 ? void 0 : new Set(request.adapterIds);
|
|
58
|
+
const descriptors = new Map(context.catalog.layers.map((layer) => [layer.id, layer]));
|
|
59
|
+
const steps = [];
|
|
60
|
+
for (const layer of context.topology.layers) {
|
|
61
|
+
const descriptor = descriptors.get(layer.id);
|
|
62
|
+
if (descriptor === void 0 || !descriptor.capabilities.includes(request.capability)) continue;
|
|
63
|
+
if (candidates !== void 0 && !candidates.has(layer.id)) continue;
|
|
64
|
+
if (!accepts(layer, request)) continue;
|
|
65
|
+
const selectedAdapters = adapters === void 0 ? layer.adapterIds : layer.adapterIds.filter((id) => adapters.has(id));
|
|
66
|
+
if (selectedAdapters.length === 0) steps.push({
|
|
67
|
+
layerId: layer.id,
|
|
68
|
+
capability: request.capability,
|
|
69
|
+
...request.input === void 0 ? {} : { input: request.input }
|
|
70
|
+
});
|
|
71
|
+
else steps.push(...selectedAdapters.map((adapterId) => ({
|
|
72
|
+
layerId: layer.id,
|
|
73
|
+
adapterId,
|
|
74
|
+
capability: request.capability,
|
|
75
|
+
...request.input === void 0 ? {} : { input: request.input }
|
|
76
|
+
})));
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
strategyId: this.descriptor.id,
|
|
80
|
+
strategyVersion: this.descriptor.version,
|
|
81
|
+
reason: steps.length === 0 ? `No enabled layer accepts ${request.capability} for a ${request.trigger} operation.` : `Selected ${steps.length} compatible step${steps.length === 1 ? "" : "s"} from the active three-tier topology.`,
|
|
82
|
+
steps
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
function registerDefaultMemorySystem(catalog, layers = {}) {
|
|
87
|
+
const disposers = [...BUILTIN_MEMORY_LAYERS.map((descriptor) => catalog.registerLayer({
|
|
88
|
+
descriptor: {
|
|
89
|
+
...descriptor,
|
|
90
|
+
capabilities: [...descriptor.capabilities]
|
|
91
|
+
},
|
|
92
|
+
...layers[descriptor.id]
|
|
93
|
+
})), catalog.registerStrategy(DEFAULT_THREE_TIER_STRATEGY)];
|
|
94
|
+
return () => {
|
|
95
|
+
for (const dispose of disposers.reverse()) dispose();
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
export { BUILTIN_MEMORY_LAYERS, DEFAULT_LAYER_PARTICIPATION, DEFAULT_THREE_TIER_STRATEGY, DEFAULT_THREE_TIER_TOPOLOGY, registerDefaultMemorySystem };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//#region packages/strategy-sdk/src/index.ts
|
|
2
|
+
const MEMORY_STRATEGY_PLUGIN_API_VERSION = "dsh-mnemon/v1alpha1";
|
|
3
|
+
/** Define an immutable, declarative strategy package; the Kernel remains authoritative. */
|
|
4
|
+
function defineMemoryStrategyPlugin(plugin) {
|
|
5
|
+
if (plugin.manifest.apiVersion !== "dsh-mnemon/v1alpha1") throw new Error(`unsupported memory strategy plugin API: ${plugin.manifest.apiVersion}`);
|
|
6
|
+
if (plugin.manifest.kind !== "MemoryStrategyPlugin") throw new Error("memory strategy plugin kind must be MemoryStrategyPlugin");
|
|
7
|
+
if (plugin.manifest.metadata.id !== plugin.strategy.descriptor.id || plugin.manifest.metadata.version !== plugin.strategy.descriptor.version) throw new Error("memory strategy plugin manifest does not match its strategy identity");
|
|
8
|
+
if (!Number.isInteger(plugin.manifest.permissions.maxSteps) || plugin.manifest.permissions.maxSteps < 1 || plugin.manifest.permissions.maxSteps > 100) throw new Error("memory strategy plugin maxSteps must be an integer within 1..100");
|
|
9
|
+
const manifest = Object.freeze({
|
|
10
|
+
...plugin.manifest,
|
|
11
|
+
metadata: Object.freeze({ ...plugin.manifest.metadata }),
|
|
12
|
+
permissions: Object.freeze({
|
|
13
|
+
...plugin.manifest.permissions,
|
|
14
|
+
layerIds: Object.freeze([...new Set(plugin.manifest.permissions.layerIds)]),
|
|
15
|
+
adapterIds: Object.freeze([...new Set(plugin.manifest.permissions.adapterIds)]),
|
|
16
|
+
capabilities: Object.freeze([...new Set(plugin.manifest.permissions.capabilities)])
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
const allowedLayers = new Set(manifest.permissions.layerIds);
|
|
20
|
+
const allowedAdapters = new Set(manifest.permissions.adapterIds);
|
|
21
|
+
const allowedCapabilities = new Set(manifest.permissions.capabilities);
|
|
22
|
+
const propose = plugin.strategy.propose.bind(plugin.strategy);
|
|
23
|
+
const strategy = Object.freeze({
|
|
24
|
+
descriptor: Object.freeze({
|
|
25
|
+
...plugin.strategy.descriptor,
|
|
26
|
+
hooks: Object.freeze([...plugin.strategy.descriptor.hooks])
|
|
27
|
+
}),
|
|
28
|
+
async propose(request, context) {
|
|
29
|
+
if (!allowedCapabilities.has(request.capability)) throw new Error(`memory strategy plugin is not permitted to use ${request.capability}`);
|
|
30
|
+
const proposal = await propose(request, context);
|
|
31
|
+
if (proposal.steps.length > manifest.permissions.maxSteps) throw new Error(`memory strategy plugin proposed ${proposal.steps.length} steps; manifest allows ${manifest.permissions.maxSteps}`);
|
|
32
|
+
for (const step of proposal.steps) {
|
|
33
|
+
if (!allowedLayers.has(step.layerId)) throw new Error(`memory strategy plugin is not permitted to use layer ${step.layerId}`);
|
|
34
|
+
if (!allowedCapabilities.has(step.capability)) throw new Error(`memory strategy plugin is not permitted to use ${step.capability}`);
|
|
35
|
+
if (step.adapterId !== void 0 && !allowedAdapters.has(step.adapterId)) throw new Error(`memory strategy plugin is not permitted to use adapter ${step.adapterId}`);
|
|
36
|
+
}
|
|
37
|
+
return proposal;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return Object.freeze({
|
|
41
|
+
manifest,
|
|
42
|
+
strategy
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/** Deterministic replay primitive for generated and hand-written strategies. */
|
|
46
|
+
async function replayMemoryStrategy(strategy, cases) {
|
|
47
|
+
for (const replay of cases) {
|
|
48
|
+
const proposal = await strategy.propose(replay.request, replay.descriptor);
|
|
49
|
+
await replay.assert(proposal);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function defineMemoryStrategy(strategy) {
|
|
53
|
+
return strategy;
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { MEMORY_STRATEGY_PLUGIN_API_VERSION, defineMemoryStrategy, defineMemoryStrategyPlugin, replayMemoryStrategy };
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/** JSON values are the only values allowed to cross a Mnemon plugin boundary. */
|
|
2
|
+
export type MemoryJsonPrimitive = string | number | boolean | null;
|
|
3
|
+
export type MemoryJsonValue = MemoryJsonPrimitive | MemoryJsonValue[] | {
|
|
4
|
+
[key: string]: MemoryJsonValue;
|
|
5
|
+
};
|
|
6
|
+
export declare const BUILTIN_MEMORY_LAYER_IDS: readonly ["runtime", "documents", "memory-spaces"];
|
|
7
|
+
export type BuiltinMemoryLayerId = typeof BUILTIN_MEMORY_LAYER_IDS[number];
|
|
8
|
+
export type MemoryLayerId = string;
|
|
9
|
+
export declare const MEMORY_CAPABILITIES: readonly ["status", "project", "recall", "search", "read", "browse", "write", "archive", "graph", "related", "link", "forget", "maintain", "export", "import"];
|
|
10
|
+
export type MemoryCapability = typeof MEMORY_CAPABILITIES[number];
|
|
11
|
+
export declare const MEMORY_STRATEGY_HOOKS: readonly ["admission", "placement", "retrieval-planning", "quality-fusion", "projection", "promotion-demotion", "retention", "maintenance"];
|
|
12
|
+
export type MemoryStrategyHook = typeof MEMORY_STRATEGY_HOOKS[number];
|
|
13
|
+
export type MemoryParticipationMode = 'off' | 'manual' | 'automatic';
|
|
14
|
+
export type MemoryParticipationChannel = 'recall' | 'write' | 'projection' | 'maintenance';
|
|
15
|
+
export interface MemoryLayerParticipation {
|
|
16
|
+
recall: MemoryParticipationMode;
|
|
17
|
+
write: MemoryParticipationMode;
|
|
18
|
+
projection: MemoryParticipationMode;
|
|
19
|
+
maintenance: MemoryParticipationMode;
|
|
20
|
+
}
|
|
21
|
+
export interface MemoryLayerDescriptor {
|
|
22
|
+
id: MemoryLayerId;
|
|
23
|
+
label: string;
|
|
24
|
+
description: string;
|
|
25
|
+
/** Stable semantic role. Several implementations may eventually satisfy one role. */
|
|
26
|
+
role: string;
|
|
27
|
+
order: number;
|
|
28
|
+
capabilities: MemoryCapability[];
|
|
29
|
+
}
|
|
30
|
+
export type MemoryAdapterLocality = 'local' | 'remote' | 'hybrid';
|
|
31
|
+
export type MemoryAdapterScope = 'global' | 'workspace' | 'custom' | 'provider-owned';
|
|
32
|
+
export interface MemoryAdapterDescriptor {
|
|
33
|
+
id: string;
|
|
34
|
+
label: string;
|
|
35
|
+
description: string;
|
|
36
|
+
locality: MemoryAdapterLocality;
|
|
37
|
+
scopes: MemoryAdapterScope[];
|
|
38
|
+
capabilities: MemoryCapability[];
|
|
39
|
+
configNamespace?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface MemoryStrategyDescriptor {
|
|
42
|
+
id: string;
|
|
43
|
+
version: string;
|
|
44
|
+
label: string;
|
|
45
|
+
description: string;
|
|
46
|
+
hooks: MemoryStrategyHook[];
|
|
47
|
+
deterministic: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface MemoryCatalogSnapshot {
|
|
50
|
+
generation: number;
|
|
51
|
+
layers: MemoryLayerDescriptor[];
|
|
52
|
+
adapters: MemoryAdapterDescriptor[];
|
|
53
|
+
strategies: MemoryStrategyDescriptor[];
|
|
54
|
+
}
|
|
55
|
+
export interface MemoryTopologyLayer {
|
|
56
|
+
id: MemoryLayerId;
|
|
57
|
+
enabled: boolean;
|
|
58
|
+
participation: MemoryLayerParticipation;
|
|
59
|
+
adapterIds: string[];
|
|
60
|
+
}
|
|
61
|
+
export interface MemoryTopologyDefinition {
|
|
62
|
+
id: string;
|
|
63
|
+
strategyId: string;
|
|
64
|
+
layers: MemoryTopologyLayer[];
|
|
65
|
+
}
|
|
66
|
+
export interface MemoryTopologySnapshot extends MemoryTopologyDefinition {
|
|
67
|
+
generation: number;
|
|
68
|
+
catalogGeneration: number;
|
|
69
|
+
createdAt: string;
|
|
70
|
+
}
|
|
71
|
+
export type MemoryOperationTrigger = 'manual' | 'automatic' | 'system';
|
|
72
|
+
export interface MemoryOperationScope {
|
|
73
|
+
storage: 'global' | 'workspace' | 'custom';
|
|
74
|
+
workspaceId?: string;
|
|
75
|
+
sessionId?: string;
|
|
76
|
+
agentId?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface MemoryOperationBudget {
|
|
79
|
+
maxSteps?: number;
|
|
80
|
+
maxResults?: number;
|
|
81
|
+
maxTokens?: number;
|
|
82
|
+
timeoutMs?: number;
|
|
83
|
+
}
|
|
84
|
+
export interface MemoryPlanRequest {
|
|
85
|
+
operation: string;
|
|
86
|
+
capability: MemoryCapability;
|
|
87
|
+
trigger: MemoryOperationTrigger;
|
|
88
|
+
scope: MemoryOperationScope;
|
|
89
|
+
candidateLayerIds?: MemoryLayerId[];
|
|
90
|
+
adapterIds?: string[];
|
|
91
|
+
budget?: MemoryOperationBudget;
|
|
92
|
+
input?: MemoryJsonValue;
|
|
93
|
+
}
|
|
94
|
+
export interface MemoryPlanStepProposal {
|
|
95
|
+
layerId: MemoryLayerId;
|
|
96
|
+
capability: MemoryCapability;
|
|
97
|
+
adapterId?: string;
|
|
98
|
+
input?: MemoryJsonValue;
|
|
99
|
+
}
|
|
100
|
+
export interface MemoryPlanProposal {
|
|
101
|
+
strategyId: string;
|
|
102
|
+
strategyVersion: string;
|
|
103
|
+
reason: string;
|
|
104
|
+
steps: MemoryPlanStepProposal[];
|
|
105
|
+
}
|
|
106
|
+
export interface MemoryPlanStep extends MemoryPlanStepProposal {
|
|
107
|
+
id: string;
|
|
108
|
+
participation: MemoryParticipationChannel;
|
|
109
|
+
}
|
|
110
|
+
export interface MemoryPlan {
|
|
111
|
+
id: string;
|
|
112
|
+
topologyId: string;
|
|
113
|
+
topologyGeneration: number;
|
|
114
|
+
catalogGeneration: number;
|
|
115
|
+
guardGeneration: number;
|
|
116
|
+
strategyId: string;
|
|
117
|
+
strategyVersion: string;
|
|
118
|
+
operation: string;
|
|
119
|
+
capability: MemoryCapability;
|
|
120
|
+
trigger: MemoryOperationTrigger;
|
|
121
|
+
scope: MemoryOperationScope;
|
|
122
|
+
/** Canonical JSON request approved by Guards and proposed against by the Strategy. */
|
|
123
|
+
request: MemoryPlanRequest;
|
|
124
|
+
/** SHA-256 of the canonical request, used to bind execution to that exact request. */
|
|
125
|
+
requestDigest: string;
|
|
126
|
+
reason: string;
|
|
127
|
+
createdAt: string;
|
|
128
|
+
budget: MemoryOperationBudget;
|
|
129
|
+
steps: MemoryPlanStep[];
|
|
130
|
+
}
|
|
131
|
+
export type MemoryGuardDecision = {
|
|
132
|
+
kind: 'allow';
|
|
133
|
+
} | {
|
|
134
|
+
kind: 'deny';
|
|
135
|
+
reason: string;
|
|
136
|
+
};
|
|
137
|
+
export type MemoryReceiptStatus = 'succeeded' | 'partial' | 'failed' | 'cancelled';
|
|
138
|
+
export type MemoryReceiptStepStatus = 'succeeded' | 'failed' | 'cancelled';
|
|
139
|
+
export interface MemoryReceiptStep {
|
|
140
|
+
stepId: string;
|
|
141
|
+
layerId: MemoryLayerId;
|
|
142
|
+
adapterId?: string;
|
|
143
|
+
status: MemoryReceiptStepStatus;
|
|
144
|
+
startedAt: string;
|
|
145
|
+
finishedAt: string;
|
|
146
|
+
output?: MemoryJsonValue;
|
|
147
|
+
error?: string;
|
|
148
|
+
}
|
|
149
|
+
export interface MemoryReceipt {
|
|
150
|
+
id: string;
|
|
151
|
+
planId: string;
|
|
152
|
+
topologyId: string;
|
|
153
|
+
topologyGeneration: number;
|
|
154
|
+
catalogGeneration: number;
|
|
155
|
+
guardGeneration: number;
|
|
156
|
+
strategyId: string;
|
|
157
|
+
strategyVersion: string;
|
|
158
|
+
operation: string;
|
|
159
|
+
capability: MemoryCapability;
|
|
160
|
+
status: MemoryReceiptStatus;
|
|
161
|
+
startedAt: string;
|
|
162
|
+
finishedAt: string;
|
|
163
|
+
steps: MemoryReceiptStep[];
|
|
164
|
+
}
|
|
165
|
+
export interface MemoryMigrationLineageEndpoint {
|
|
166
|
+
layerId: MemoryLayerId;
|
|
167
|
+
reference: string;
|
|
168
|
+
digest: string;
|
|
169
|
+
}
|
|
170
|
+
/** Auditable proof that one exact source item reached one committed destination. */
|
|
171
|
+
export interface MemoryMigrationLineage {
|
|
172
|
+
source: MemoryMigrationLineageEndpoint;
|
|
173
|
+
destination: MemoryMigrationLineageEndpoint;
|
|
174
|
+
}
|
|
175
|
+
export interface MemorySystemDescriptor {
|
|
176
|
+
catalog: MemoryCatalogSnapshot;
|
|
177
|
+
topology: MemoryTopologySnapshot;
|
|
178
|
+
}
|
|
179
|
+
export declare const MEMORY_SOURCE_MODES: readonly ["eager", "routed"];
|
|
180
|
+
export type MemorySourceMode = typeof MEMORY_SOURCE_MODES[number];
|
|
181
|
+
export interface MemoryTurnViewSource {
|
|
182
|
+
layerId: MemoryLayerId;
|
|
183
|
+
revision: string;
|
|
184
|
+
mode: MemorySourceMode;
|
|
185
|
+
digest: string;
|
|
186
|
+
/** Exact eager content or one compact routed cover; never a child catalog. */
|
|
187
|
+
wake: string;
|
|
188
|
+
}
|
|
189
|
+
/** Immutable Source-generation snapshot pinned by one or more user turns. */
|
|
190
|
+
export interface MemoryTurnView {
|
|
191
|
+
id: string;
|
|
192
|
+
createdAt: string;
|
|
193
|
+
topologyId: string;
|
|
194
|
+
catalogGeneration: number;
|
|
195
|
+
topologyGeneration: number;
|
|
196
|
+
guardGeneration: number;
|
|
197
|
+
sources: MemoryTurnViewSource[];
|
|
198
|
+
digest: string;
|
|
199
|
+
}
|
|
200
|
+
/** Compatibility name for the v0.3 pre-release API. */
|
|
201
|
+
export type MemoryView = MemoryTurnView;
|
|
202
|
+
/** Compatibility name for the v0.3 pre-release API. */
|
|
203
|
+
export type MemoryViewSource = MemoryTurnViewSource;
|
|
204
|
+
export interface MemoryWakeSection {
|
|
205
|
+
layerId: MemoryLayerId;
|
|
206
|
+
mode: MemorySourceMode;
|
|
207
|
+
text: string;
|
|
208
|
+
}
|
|
209
|
+
export interface MemoryWake {
|
|
210
|
+
viewId: string;
|
|
211
|
+
viewDigest: string;
|
|
212
|
+
text: string;
|
|
213
|
+
sections: MemoryWakeSection[];
|
|
214
|
+
}
|
|
215
|
+
export interface MemoryTurnContext {
|
|
216
|
+
turnId: string;
|
|
217
|
+
viewId: string;
|
|
218
|
+
viewDigest: string;
|
|
219
|
+
scope: MemoryOperationScope;
|
|
220
|
+
startedAt: string;
|
|
221
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { MemoryAdapterRegistration, MemoryCatalog, MemoryLayerRegistration, MemoryStrategyRegistration } from '../../kernel/src/catalog.ts';
|
|
2
|
+
import type { MemoryGuardRegistration, MemoryKernel } from '../../kernel/src/kernel.ts';
|
|
3
|
+
import type { MemorySource, MemoryTurnViewManager } from '../../kernel/src/view.ts';
|
|
4
|
+
export interface MemoryExtensionDescriptor {
|
|
5
|
+
id: string;
|
|
6
|
+
version: string;
|
|
7
|
+
label: string;
|
|
8
|
+
description: string;
|
|
9
|
+
}
|
|
10
|
+
export interface MemoryExtension {
|
|
11
|
+
descriptor: MemoryExtensionDescriptor;
|
|
12
|
+
layers?: readonly MemoryLayerRegistration[];
|
|
13
|
+
adapters?: readonly MemoryAdapterRegistration[];
|
|
14
|
+
strategies?: readonly MemoryStrategyRegistration[];
|
|
15
|
+
/** Trusted, query-independent Sources for extension Layers. */
|
|
16
|
+
sources?: readonly MemorySource[];
|
|
17
|
+
/** Guards can only deny; strategies and data-plane executors cannot bypass them. */
|
|
18
|
+
guards?: readonly MemoryGuardRegistration[];
|
|
19
|
+
}
|
|
20
|
+
export interface MemoryBootAttachment {
|
|
21
|
+
bindKernel(kernel: MemoryKernel): void;
|
|
22
|
+
bindTurnViews(manager: MemoryTurnViewManager): void;
|
|
23
|
+
dispose(): void;
|
|
24
|
+
release(): void;
|
|
25
|
+
}
|
|
26
|
+
/** Compatibility name for the v0.3 pre-release API. */
|
|
27
|
+
export type MemoryExtensionAttachment = MemoryBootAttachment;
|
|
28
|
+
/**
|
|
29
|
+
* Minimal Boot assembler for one Host. It applies the same captured extension
|
|
30
|
+
* set to every runtime graph while each graph owns its Catalog, Kernel, and
|
|
31
|
+
* TurnView state. Cordis remains responsible for lifecycle and isolation.
|
|
32
|
+
*/
|
|
33
|
+
export declare class MemoryBoot {
|
|
34
|
+
private readonly extensions;
|
|
35
|
+
private readonly targets;
|
|
36
|
+
register(extension: MemoryExtension): () => void;
|
|
37
|
+
attach(catalog: MemoryCatalog): MemoryBootAttachment;
|
|
38
|
+
descriptors(): MemoryExtensionDescriptor[];
|
|
39
|
+
private apply;
|
|
40
|
+
private applyChecked;
|
|
41
|
+
/** Remove one global extension from every live graph, or restore it everywhere. */
|
|
42
|
+
private unregister;
|
|
43
|
+
}
|
|
44
|
+
/** Compatibility name for the v0.3 pre-release API. */
|
|
45
|
+
export { MemoryBoot as MemoryExtensionHost };
|
|
46
|
+
export declare function defineMemoryExtension<T extends MemoryExtension>(extension: T): T;
|
|
47
|
+
/** Process-global Boot, allowing extensions to contribute before the DSH Host mounts. */
|
|
48
|
+
export declare const memoryBoot: MemoryBoot;
|
|
49
|
+
/** Compatibility name for the v0.3 pre-release API. */
|
|
50
|
+
export declare const memoryExtensions: MemoryBoot;
|
|
51
|
+
export declare function registerMemoryExtension(extension: MemoryExtension): () => void;
|
|
52
|
+
export type { MemoryAdapterRegistration, MemoryLayerRegistration, MemoryStrategyRegistration } from '../../kernel/src/catalog.ts';
|
|
53
|
+
export type { MemoryGuardRegistration } from '../../kernel/src/kernel.ts';
|
|
54
|
+
export type { MemorySource } from '../../kernel/src/view.ts';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { MemoryCapability, MemoryOperationTrigger, MemoryParticipationChannel, MemoryParticipationMode, MemoryTopologyLayer } from '../../contracts/src/index.ts';
|
|
2
|
+
export declare function participationChannel(capability: MemoryCapability): MemoryParticipationChannel;
|
|
3
|
+
export interface MemoryParticipationDecision {
|
|
4
|
+
allowed: boolean;
|
|
5
|
+
layerId: string;
|
|
6
|
+
capability: MemoryCapability;
|
|
7
|
+
trigger: MemoryOperationTrigger;
|
|
8
|
+
channel: MemoryParticipationChannel;
|
|
9
|
+
mode: MemoryParticipationMode;
|
|
10
|
+
reason?: string;
|
|
11
|
+
}
|
|
12
|
+
/** Evaluate one topology boundary without invoking strategy or data-plane code. */
|
|
13
|
+
export declare function decideMemoryLayerParticipation(layer: MemoryTopologyLayer, capability: MemoryCapability, trigger: MemoryOperationTrigger): MemoryParticipationDecision;
|
|
14
|
+
export declare function assertMemoryLayerParticipation(layer: MemoryTopologyLayer, capability: MemoryCapability, trigger: MemoryOperationTrigger): MemoryParticipationDecision;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { MemoryAdapterDescriptor, MemoryCatalogSnapshot, MemoryJsonValue, MemoryLayerDescriptor, MemoryPlanRequest, MemoryPlanProposal, MemoryPlanStep, MemoryStrategyDescriptor, MemoryTopologySnapshot } from '../../contracts/src/index.ts';
|
|
2
|
+
export interface MemoryLayerExecutionContext {
|
|
3
|
+
planId: string;
|
|
4
|
+
topology: MemoryTopologySnapshot;
|
|
5
|
+
request: MemoryPlanRequest;
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
}
|
|
8
|
+
export interface MemoryLayerRegistration {
|
|
9
|
+
descriptor: MemoryLayerDescriptor;
|
|
10
|
+
execute?(step: MemoryPlanStep, context: MemoryLayerExecutionContext): Promise<MemoryJsonValue>;
|
|
11
|
+
}
|
|
12
|
+
export interface MemoryAdapterRegistration {
|
|
13
|
+
descriptor: MemoryAdapterDescriptor;
|
|
14
|
+
}
|
|
15
|
+
export interface MemoryStrategyContext {
|
|
16
|
+
catalog: MemoryCatalogSnapshot;
|
|
17
|
+
topology: MemoryTopologySnapshot;
|
|
18
|
+
}
|
|
19
|
+
export interface MemoryStrategyRegistration {
|
|
20
|
+
descriptor: MemoryStrategyDescriptor;
|
|
21
|
+
propose(request: MemoryPlanRequest, context: MemoryStrategyContext): MemoryPlanProposal | Promise<MemoryPlanProposal>;
|
|
22
|
+
}
|
|
23
|
+
export type MemoryCatalogListener = (snapshot: MemoryCatalogSnapshot) => void;
|
|
24
|
+
/** Host-global contribution directory. Registrations are owned by their caller's lifecycle. */
|
|
25
|
+
export declare class MemoryCatalog {
|
|
26
|
+
private readonly layers;
|
|
27
|
+
private readonly adapters;
|
|
28
|
+
private readonly strategies;
|
|
29
|
+
private readonly listeners;
|
|
30
|
+
private currentGeneration;
|
|
31
|
+
get generation(): number;
|
|
32
|
+
registerLayer(registration: MemoryLayerRegistration): () => void;
|
|
33
|
+
registerAdapter(registration: MemoryAdapterRegistration): () => void;
|
|
34
|
+
registerStrategy(registration: MemoryStrategyRegistration): () => void;
|
|
35
|
+
layer(id: string): MemoryLayerRegistration | undefined;
|
|
36
|
+
adapter(id: string): MemoryAdapterRegistration | undefined;
|
|
37
|
+
strategy(id: string): MemoryStrategyRegistration | undefined;
|
|
38
|
+
snapshot(): MemoryCatalogSnapshot;
|
|
39
|
+
subscribe(listener: MemoryCatalogListener): () => void;
|
|
40
|
+
private register;
|
|
41
|
+
private changed;
|
|
42
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { MemoryCatalog } from './catalog.ts';
|
|
2
|
+
import type { MemoryCapability, MemoryGuardDecision, MemoryOperationTrigger, MemoryPlan, MemoryPlanRequest, MemoryReceipt, MemorySystemDescriptor } from '../../contracts/src/index.ts';
|
|
3
|
+
import { type MemoryParticipationDecision } from './access.ts';
|
|
4
|
+
import type { MemoryTopologyManager } from './topology.ts';
|
|
5
|
+
export interface MemoryGuardContext {
|
|
6
|
+
descriptor: MemorySystemDescriptor;
|
|
7
|
+
}
|
|
8
|
+
export interface MemoryGuardRegistration {
|
|
9
|
+
id: string;
|
|
10
|
+
decide(request: MemoryPlanRequest, context: MemoryGuardContext): MemoryGuardDecision | Promise<MemoryGuardDecision>;
|
|
11
|
+
}
|
|
12
|
+
export interface MemoryReceiptSink {
|
|
13
|
+
append(receipt: MemoryReceipt): void | Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export interface MemoryKernelOptions {
|
|
16
|
+
now?: () => Date;
|
|
17
|
+
id?: () => string;
|
|
18
|
+
receiptSink?: MemoryReceiptSink;
|
|
19
|
+
}
|
|
20
|
+
/** Plans and executes bounded operations without granting strategies direct data-plane access. */
|
|
21
|
+
export declare class MemoryKernel {
|
|
22
|
+
readonly catalog: MemoryCatalog;
|
|
23
|
+
readonly topology: MemoryTopologyManager;
|
|
24
|
+
private readonly guards;
|
|
25
|
+
private currentGuardGeneration;
|
|
26
|
+
private readonly now;
|
|
27
|
+
private readonly id;
|
|
28
|
+
private readonly receiptSinks;
|
|
29
|
+
private readonly issuedPlans;
|
|
30
|
+
constructor(catalog: MemoryCatalog, topology: MemoryTopologyManager, options?: MemoryKernelOptions);
|
|
31
|
+
get guardGeneration(): number;
|
|
32
|
+
registerReceiptSink(sink: MemoryReceiptSink): () => void;
|
|
33
|
+
descriptor(): MemorySystemDescriptor;
|
|
34
|
+
participation(layerId: string, capability: MemoryCapability, trigger: MemoryOperationTrigger): MemoryParticipationDecision;
|
|
35
|
+
allows(layerId: string, capability: MemoryCapability, trigger: MemoryOperationTrigger): boolean;
|
|
36
|
+
assertParticipation(layerId: string, capability: MemoryCapability, trigger: MemoryOperationTrigger): MemoryParticipationDecision;
|
|
37
|
+
registerGuard(guard: MemoryGuardRegistration): () => void;
|
|
38
|
+
plan(request: MemoryPlanRequest): Promise<MemoryPlan>;
|
|
39
|
+
execute(plan: MemoryPlan, request: MemoryPlanRequest, signal?: AbortSignal): Promise<MemoryReceipt>;
|
|
40
|
+
run(request: MemoryPlanRequest, signal?: AbortSignal): Promise<{
|
|
41
|
+
plan: MemoryPlan;
|
|
42
|
+
receipt: MemoryReceipt;
|
|
43
|
+
}>;
|
|
44
|
+
private validateStep;
|
|
45
|
+
private rememberPlan;
|
|
46
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { MemoryCatalog } from './catalog.ts';
|
|
2
|
+
import type { MemoryLayerParticipation, MemoryTopologyDefinition, MemoryTopologySnapshot } from '../../contracts/src/index.ts';
|
|
3
|
+
export type MemoryTopologyListener = (next: MemoryTopologySnapshot, previous: MemoryTopologySnapshot | undefined) => void;
|
|
4
|
+
/** Atomic, versioned topology state. Per-operation callers pin one returned snapshot. */
|
|
5
|
+
export declare class MemoryTopologyManager {
|
|
6
|
+
private readonly catalog;
|
|
7
|
+
private readonly now;
|
|
8
|
+
private current?;
|
|
9
|
+
private currentGeneration;
|
|
10
|
+
private readonly listeners;
|
|
11
|
+
private readonly unsubscribeCatalog;
|
|
12
|
+
constructor(catalog: MemoryCatalog, initial: MemoryTopologyDefinition, now?: () => Date);
|
|
13
|
+
snapshot(): MemoryTopologySnapshot;
|
|
14
|
+
replace(definition: MemoryTopologyDefinition): MemoryTopologySnapshot;
|
|
15
|
+
configureLayer(id: string, patch: {
|
|
16
|
+
enabled?: boolean;
|
|
17
|
+
participation?: Partial<MemoryLayerParticipation>;
|
|
18
|
+
adapterIds?: string[];
|
|
19
|
+
}): MemoryTopologySnapshot;
|
|
20
|
+
subscribe(listener: MemoryTopologyListener): () => void;
|
|
21
|
+
/** Stop following Catalog changes while preserving this generation for pinned operations. */
|
|
22
|
+
dispose(): void;
|
|
23
|
+
private reconcileCatalog;
|
|
24
|
+
private validate;
|
|
25
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { MemoryJsonValue, MemoryOperationScope, MemoryReceipt, MemorySourceMode, MemoryTurnContext, MemoryTurnView, MemoryWake } from '../../contracts/src/index.ts';
|
|
2
|
+
import type { MemoryKernel } from './kernel.ts';
|
|
3
|
+
export interface MemorySourceSnapshot {
|
|
4
|
+
/** Changes whenever the source's recall authority or Wake projection changes. */
|
|
5
|
+
revision: string;
|
|
6
|
+
/** Exact eager content or one compact routed cover. */
|
|
7
|
+
wake: string;
|
|
8
|
+
/** Host-only JSON authority. It is digest-bound and never rendered into Wake. */
|
|
9
|
+
state?: MemoryJsonValue;
|
|
10
|
+
}
|
|
11
|
+
export interface MemorySourceContext {
|
|
12
|
+
catalogGeneration: number;
|
|
13
|
+
topologyGeneration: number;
|
|
14
|
+
guardGeneration: number;
|
|
15
|
+
scope?: MemoryOperationScope;
|
|
16
|
+
}
|
|
17
|
+
/** Trusted source adapter. It snapshots authority without receiving a Strategy. */
|
|
18
|
+
export interface MemorySource {
|
|
19
|
+
layerId: string;
|
|
20
|
+
mode: MemorySourceMode;
|
|
21
|
+
snapshot(context: MemorySourceContext): MemorySourceSnapshot | Promise<MemorySourceSnapshot>;
|
|
22
|
+
}
|
|
23
|
+
export interface MemoryTurnViewManagerOptions {
|
|
24
|
+
now?: () => Date;
|
|
25
|
+
maxViews?: number;
|
|
26
|
+
maxWakeCharacters?: number;
|
|
27
|
+
maxCoverCharacters?: number;
|
|
28
|
+
}
|
|
29
|
+
/** Compatibility name for the v0.3 pre-release API. */
|
|
30
|
+
export type MemoryViewManagerOptions = MemoryTurnViewManagerOptions;
|
|
31
|
+
/**
|
|
32
|
+
* Owns immutable Source snapshots and turn pins. Source state is Host-only;
|
|
33
|
+
* Wake is a separately budgeted projection and never defines recall authority.
|
|
34
|
+
*/
|
|
35
|
+
export declare class MemoryTurnViewManager {
|
|
36
|
+
readonly kernel: Pick<MemoryKernel, 'descriptor' | 'guardGeneration'>;
|
|
37
|
+
private readonly sources;
|
|
38
|
+
private sourceGeneration;
|
|
39
|
+
private readonly views;
|
|
40
|
+
private readonly turns;
|
|
41
|
+
private readonly pendingReceipts;
|
|
42
|
+
private current;
|
|
43
|
+
private readonly currentByScope;
|
|
44
|
+
private readonly publishing;
|
|
45
|
+
private failure;
|
|
46
|
+
private readonly now;
|
|
47
|
+
private readonly maxViews;
|
|
48
|
+
private readonly maxWakeCharacters;
|
|
49
|
+
private readonly maxCoverCharacters;
|
|
50
|
+
constructor(kernel: Pick<MemoryKernel, 'descriptor' | 'guardGeneration'>, sources?: Iterable<MemorySource>, options?: MemoryTurnViewManagerOptions);
|
|
51
|
+
registerSource(source: MemorySource): () => void;
|
|
52
|
+
/** Validate every automatic project-capable Layer before a runtime graph becomes live. */
|
|
53
|
+
assertSourcesReady(): void;
|
|
54
|
+
latest(): MemoryTurnView | undefined;
|
|
55
|
+
get(viewId: string): MemoryTurnView | undefined;
|
|
56
|
+
/** Read digest-bound recall authority. This state is never rendered into Wake. */
|
|
57
|
+
sourceState(viewId: string, layerId: string): MemoryJsonValue | undefined;
|
|
58
|
+
lastFailure(): string | undefined;
|
|
59
|
+
pendingReceiptCount(): number;
|
|
60
|
+
apply(receipt: MemoryReceipt): boolean;
|
|
61
|
+
beginTurn(turnId: string, scope: MemoryOperationScope): Promise<MemoryTurnContext>;
|
|
62
|
+
turn(turnId: string): MemoryTurnContext | undefined;
|
|
63
|
+
activeTurn(agentId: string): MemoryTurnContext | undefined;
|
|
64
|
+
endTurn(turnId: string): boolean;
|
|
65
|
+
wake(viewId: string): MemoryWake;
|
|
66
|
+
/** Compile and publish a candidate. On failure, preserve the last valid scoped View. */
|
|
67
|
+
reconcile(scope?: MemoryOperationScope): Promise<MemoryTurnView>;
|
|
68
|
+
/** Strict publication API used by tests, diagnostics, and initial startup. */
|
|
69
|
+
publish(scope?: MemoryOperationScope): Promise<MemoryTurnView>;
|
|
70
|
+
private buildCandidate;
|
|
71
|
+
private normalizeSource;
|
|
72
|
+
private renderWake;
|
|
73
|
+
private requireStoredView;
|
|
74
|
+
private rememberScopeCurrent;
|
|
75
|
+
private collect;
|
|
76
|
+
}
|
|
77
|
+
/** Compatibility name for the v0.3 pre-release API. */
|
|
78
|
+
export { MemoryTurnViewManager as MemoryViewManager };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MemoryLayerDescriptor } from '../../contracts/src/index.ts';
|
|
2
|
+
import type { MemoryCatalog, MemoryLayerRegistration } from '../../kernel/src/index.ts';
|
|
3
|
+
export declare const DOCUMENTS_MEMORY_LAYER: Readonly<MemoryLayerDescriptor>;
|
|
4
|
+
export declare function registerDocumentsMemoryLayer(catalog: MemoryCatalog, registration?: Omit<MemoryLayerRegistration, 'descriptor'>): () => void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MemoryLayerDescriptor } from '../../contracts/src/index.ts';
|
|
2
|
+
import type { MemoryCatalog, MemoryLayerRegistration } from '../../kernel/src/index.ts';
|
|
3
|
+
export declare const MEMORY_SPACES_LAYER: Readonly<MemoryLayerDescriptor>;
|
|
4
|
+
export declare function registerMemorySpacesLayer(catalog: MemoryCatalog, registration?: Omit<MemoryLayerRegistration, 'descriptor'>): () => void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MemoryLayerDescriptor } from '../../contracts/src/index.ts';
|
|
2
|
+
import type { MemoryCatalog, MemoryLayerRegistration } from '../../kernel/src/index.ts';
|
|
3
|
+
export declare const RUNTIME_MEMORY_LAYER: Readonly<MemoryLayerDescriptor>;
|
|
4
|
+
export declare function registerRuntimeMemoryLayer(catalog: MemoryCatalog, registration?: Omit<MemoryLayerRegistration, 'descriptor'>): () => void;
|