dsh-mnemon 0.4.7 → 0.5.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 +10 -20
- package/README.zh-CN.md +10 -20
- package/SECURITY.md +8 -8
- package/cordis.patch.yml +42 -0
- package/lib/client.js +2360 -6843
- package/lib/contracts.js +16 -17
- package/lib/core.js +11 -0
- package/lib/definitions-j0FLgE0-.js +251 -0
- package/lib/extension-sdk.js +93 -229
- package/lib/index.js +3730 -6330
- package/lib/runtime-AtIOTeP1.js +1316 -0
- package/lib/storage-lock-Bqrhkyag.js +20 -0
- package/lib/testing.js +231 -0
- package/lib/types/src/client/extension-sdk.d.ts +10 -0
- package/lib/types/src/client/index.d.ts +1 -0
- package/lib/types/src/client/locales.d.ts +84 -0
- package/lib/types/src/client/page-client.d.ts +15 -0
- package/lib/types/src/client/page-kit.d.ts +40 -0
- package/lib/types/src/client/source-contracts.d.ts +46 -0
- package/lib/types/src/client/source-pages.d.ts +83 -0
- package/lib/types/src/core/contracts/index.d.ts +40 -0
- package/lib/types/src/core/contracts/plugin.d.ts +32 -0
- package/lib/types/src/core/contracts/view.d.ts +416 -0
- package/lib/types/src/core/definitions.d.ts +16 -0
- package/lib/types/src/core/plugin.d.ts +6 -0
- package/lib/types/src/{config-values.d.ts → host/config-values.d.ts} +7 -7
- package/lib/types/src/{config.d.ts → host/config.d.ts} +4 -1
- package/lib/types/src/{shared → host}/display-mode.d.ts +1 -1
- package/lib/types/src/host/plugin.d.ts +8 -0
- package/lib/types/src/host/protocol.d.ts +549 -0
- package/lib/types/src/host/view-protocol.d.ts +123 -0
- package/lib/types/src/index.d.ts +2 -21
- package/lib/types/src/sdk/index.d.ts +9 -0
- package/lib/types/src/sdk/input.d.ts +11 -0
- package/lib/types/src/sdk/install.d.ts +7 -0
- package/lib/types/src/sdk/service.d.ts +31 -0
- package/lib/types/src/sdk/storage-lock.d.ts +6 -0
- package/lib/types/src/sdk/strategy-configuration.d.ts +31 -0
- package/lib/types/src/sdk/testing.d.ts +70 -0
- package/package.json +46 -35
- package/lib/kernel.js +0 -1173
- package/lib/layers/documents.js +0 -31
- package/lib/layers/memory-spaces.js +0 -34
- package/lib/layers/runtime.js +0 -27
- package/lib/provider-sdk.js +0 -2
- package/lib/registry-B9SdBRLo.js +0 -2423
- package/lib/strategy-default-three-tier.js +0 -99
- package/lib/strategy-sdk.js +0 -56
- package/lib/types/packages/contracts/src/index.d.ts +0 -221
- package/lib/types/packages/extension-sdk/src/index.d.ts +0 -54
- package/lib/types/packages/kernel/src/access.d.ts +0 -14
- package/lib/types/packages/kernel/src/catalog.d.ts +0 -42
- package/lib/types/packages/kernel/src/index.d.ts +0 -5
- package/lib/types/packages/kernel/src/kernel.d.ts +0 -46
- package/lib/types/packages/kernel/src/topology.d.ts +0 -25
- package/lib/types/packages/kernel/src/view.d.ts +0 -89
- package/lib/types/packages/layer-documents/src/index.d.ts +0 -4
- package/lib/types/packages/layer-memory-spaces/src/index.d.ts +0 -4
- package/lib/types/packages/layer-runtime/src/index.d.ts +0 -4
- package/lib/types/packages/provider-sdk/src/index.d.ts +0 -19
- package/lib/types/packages/strategy-default-three-tier/src/index.d.ts +0 -7
- package/lib/types/packages/strategy-sdk/src/index.d.ts +0 -35
- package/lib/types/src/activity.d.ts +0 -16
- package/lib/types/src/agent-memory-turn.d.ts +0 -42
- package/lib/types/src/channels.d.ts +0 -1
- package/lib/types/src/client/GlobalLocationSetting.d.ts +0 -19
- package/lib/types/src/client/MnemonPackSection.d.ts +0 -13
- package/lib/types/src/client/MnemonSaveAction.d.ts +0 -13
- package/lib/types/src/client/MnemonSettingsCard.d.ts +0 -16
- package/lib/types/src/client/MnemonTurnTail.d.ts +0 -21
- package/lib/types/src/client/MnemonView.d.ts +0 -26
- package/lib/types/src/client/ProviderIcon.d.ts +0 -8
- package/lib/types/src/client/ProviderSettingsSection.d.ts +0 -16
- package/lib/types/src/client/anchor.d.ts +0 -27
- package/lib/types/src/client/api.d.ts +0 -83
- package/lib/types/src/client/better-sidebar.d.ts +0 -13
- package/lib/types/src/client/dsh-compat.d.ts +0 -51
- package/lib/types/src/client/settings.d.ts +0 -23
- package/lib/types/src/client/sidebar-entry.d.ts +0 -5
- package/lib/types/src/client/subagent-token-usage.d.ts +0 -23
- package/lib/types/src/client/workspace-controller.d.ts +0 -14
- package/lib/types/src/client/workspace-mount.d.ts +0 -20
- package/lib/types/src/commands.d.ts +0 -13
- package/lib/types/src/contracts.d.ts +0 -316
- package/lib/types/src/documents.d.ts +0 -77
- package/lib/types/src/git-branch.d.ts +0 -6
- package/lib/types/src/guidance.d.ts +0 -29
- package/lib/types/src/lifecycle.d.ts +0 -80
- package/lib/types/src/live-runtime.d.ts +0 -92
- package/lib/types/src/memory-bodies.d.ts +0 -57
- package/lib/types/src/memory-receipts.d.ts +0 -21
- package/lib/types/src/memory-system/access.d.ts +0 -2
- package/lib/types/src/memory-system/catalog.d.ts +0 -2
- package/lib/types/src/memory-system/contracts.d.ts +0 -2
- package/lib/types/src/memory-system/defaults.d.ts +0 -6
- package/lib/types/src/memory-system/index.d.ts +0 -7
- package/lib/types/src/memory-system/kernel.d.ts +0 -2
- package/lib/types/src/memory-system/topology.d.ts +0 -2
- package/lib/types/src/memory-system/view.d.ts +0 -2
- package/lib/types/src/memory-view.d.ts +0 -21
- package/lib/types/src/pack.d.ts +0 -29
- package/lib/types/src/process.d.ts +0 -16
- package/lib/types/src/provider-placement.d.ts +0 -26
- package/lib/types/src/provider-sdk.d.ts +0 -4
- package/lib/types/src/providers/byterover.d.ts +0 -32
- package/lib/types/src/providers/catalog.d.ts +0 -23
- package/lib/types/src/providers/hindsight.d.ts +0 -20
- package/lib/types/src/providers/holographic.d.ts +0 -23
- package/lib/types/src/providers/honcho.d.ts +0 -18
- package/lib/types/src/providers/http.d.ts +0 -32
- package/lib/types/src/providers/mem0.d.ts +0 -18
- package/lib/types/src/providers/memory-system.d.ts +0 -6
- package/lib/types/src/providers/openviking.d.ts +0 -32
- package/lib/types/src/providers/provider.d.ts +0 -46
- package/lib/types/src/providers/registry.d.ts +0 -23
- package/lib/types/src/providers/retaindb.d.ts +0 -17
- package/lib/types/src/providers/supermemory.d.ts +0 -17
- package/lib/types/src/recall-quality/contracts.d.ts +0 -32
- package/lib/types/src/recall-quality/engine.d.ts +0 -13
- package/lib/types/src/recall-quality/index.d.ts +0 -4
- package/lib/types/src/recall-quality/policies.d.ts +0 -5
- package/lib/types/src/recall-quality/registry.d.ts +0 -10
- package/lib/types/src/review-activity.d.ts +0 -19
- package/lib/types/src/rpc.d.ts +0 -22
- package/lib/types/src/runner.d.ts +0 -41
- package/lib/types/src/runtime-memory.d.ts +0 -90
- package/lib/types/src/search-tokens.d.ts +0 -5
- package/lib/types/src/service.d.ts +0 -113
- package/lib/types/src/session-events.d.ts +0 -8
- package/lib/types/src/settings.d.ts +0 -6
- package/lib/types/src/shared/contracts.d.ts +0 -1008
- package/lib/types/src/storage-scope.d.ts +0 -12
- package/lib/types/src/subagent-token-usage.d.ts +0 -53
- package/lib/types/src/subagent.d.ts +0 -124
- package/lib/types/src/tools.d.ts +0 -10
- package/lib/types/src/version-updates.d.ts +0 -37
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
//#region src/sdk/storage-lock.ts
|
|
3
|
+
const queues = /* @__PURE__ */ new Map();
|
|
4
|
+
/**
|
|
5
|
+
* Serialize in-process work on one local storage root, including work from
|
|
6
|
+
* independently loaded plugins. File locks still own cross-process safety.
|
|
7
|
+
* Callers must not acquire the same root recursively.
|
|
8
|
+
*/
|
|
9
|
+
function withMemoryStorageLock(directory, operation) {
|
|
10
|
+
const key = resolve(directory);
|
|
11
|
+
const result = (queues.get(key) ?? Promise.resolve()).then(operation);
|
|
12
|
+
const settled = result.then(() => {}, () => {});
|
|
13
|
+
queues.set(key, settled);
|
|
14
|
+
settled.then(() => {
|
|
15
|
+
if (queues.get(key) === settled) queues.delete(key);
|
|
16
|
+
});
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { withMemoryStorageLock as t };
|
package/lib/testing.js
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { t as provideMemoryRuntime } from "./runtime-AtIOTeP1.js";
|
|
2
|
+
import { DEFAULT_MEMORY_VIEW_BUDGET } from "./contracts.js";
|
|
3
|
+
import { c as jsonClone } from "./definitions-j0FLgE0-.js";
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
5
|
+
import { Context } from "@deepseek-ai/cordis";
|
|
6
|
+
//#region src/sdk/testing.ts
|
|
7
|
+
/**
|
|
8
|
+
* A test fixture, not a production service or a second Loader. It mounts real
|
|
9
|
+
* Cordis Fibers against the same Runtime/compiler used by the Host. The small
|
|
10
|
+
* Loader identity adapter supplies only stable Entry ids for installMemory.
|
|
11
|
+
* No built-in Source, Provider, database, browser, or private binding is needed.
|
|
12
|
+
*/
|
|
13
|
+
var MemoryCompositionRunner = class {
|
|
14
|
+
context = new Context();
|
|
15
|
+
#runtime = provideMemoryRuntime(this.context);
|
|
16
|
+
#generations;
|
|
17
|
+
#entryIds = /* @__PURE__ */ new WeakMap();
|
|
18
|
+
#entries = /* @__PURE__ */ new Map();
|
|
19
|
+
#turns = /* @__PURE__ */ new Set();
|
|
20
|
+
#beginnings = /* @__PURE__ */ new Set();
|
|
21
|
+
#closed = false;
|
|
22
|
+
#closing;
|
|
23
|
+
constructor(options = {}) {
|
|
24
|
+
this.context.provide("loader", {
|
|
25
|
+
locate: (fiber) => this.#entryIds.get(fiber),
|
|
26
|
+
import: (specifier) => import(specifier),
|
|
27
|
+
unwrapExports: (module) => module.default ?? module
|
|
28
|
+
});
|
|
29
|
+
const { sourceConfiguration, sourceCapabilities, ...selection } = options;
|
|
30
|
+
this.#generations = this.#runtime.attachGeneration({
|
|
31
|
+
...selection,
|
|
32
|
+
...sourceConfiguration === void 0 ? {} : { sourceConfiguration: (source) => sourceConfiguration(Object.freeze({
|
|
33
|
+
sourceInstanceKey: source.instanceKey,
|
|
34
|
+
manifest: source.definition.manifest,
|
|
35
|
+
provenance: source.provenance
|
|
36
|
+
})) },
|
|
37
|
+
...sourceCapabilities === void 0 ? {} : { sourceCapabilities: (source) => sourceCapabilities(Object.freeze({
|
|
38
|
+
sourceInstanceKey: source.instanceKey,
|
|
39
|
+
manifest: source.definition.manifest,
|
|
40
|
+
provenance: source.provenance
|
|
41
|
+
})) }
|
|
42
|
+
}).host;
|
|
43
|
+
}
|
|
44
|
+
async mount(plugin, entry) {
|
|
45
|
+
this.#assertOpen();
|
|
46
|
+
const id = entry.instanceId.trim();
|
|
47
|
+
if (id === "" || this.#entries.has(id)) throw new Error(`duplicate or empty test Entry id: ${id}`);
|
|
48
|
+
const boundPlugin = {
|
|
49
|
+
...plugin,
|
|
50
|
+
apply: (ctx, config) => {
|
|
51
|
+
this.#entryIds.set(ctx.fiber, id);
|
|
52
|
+
return plugin.apply(ctx, config);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const fiber = this.context.plugin(boundPlugin, entry.config);
|
|
56
|
+
this.#entries.set(id, fiber);
|
|
57
|
+
try {
|
|
58
|
+
await fiber.await();
|
|
59
|
+
this.#assertOpen();
|
|
60
|
+
} catch (error) {
|
|
61
|
+
if (this.#entries.get(id) === fiber) this.#entries.delete(id);
|
|
62
|
+
await fiber.dispose();
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
return async () => {
|
|
66
|
+
if (this.#entries.get(id) !== fiber) return;
|
|
67
|
+
this.#entries.delete(id);
|
|
68
|
+
await fiber.dispose();
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
async beginTurn(request = {}, signal) {
|
|
72
|
+
this.#assertOpen();
|
|
73
|
+
signal?.throwIfAborted();
|
|
74
|
+
const budget = { ...request.budget ?? DEFAULT_MEMORY_VIEW_BUDGET };
|
|
75
|
+
const lease = this.#generations.acquire();
|
|
76
|
+
const controller = new AbortController();
|
|
77
|
+
const abort = () => controller.abort(signal.reason);
|
|
78
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
79
|
+
this.#beginnings.add(controller);
|
|
80
|
+
try {
|
|
81
|
+
const view = await lease.generation.compose({
|
|
82
|
+
scope: request.scope ?? { storage: "custom" },
|
|
83
|
+
scenario: request.scenario ?? "plugin-test",
|
|
84
|
+
budget
|
|
85
|
+
}, controller.signal);
|
|
86
|
+
this.#assertOpen();
|
|
87
|
+
let active = true;
|
|
88
|
+
const assertActive = () => {
|
|
89
|
+
this.#assertOpen();
|
|
90
|
+
if (!active) throw new Error("Memory test turn is released");
|
|
91
|
+
};
|
|
92
|
+
const release = () => {
|
|
93
|
+
if (!active) return;
|
|
94
|
+
active = false;
|
|
95
|
+
this.#turns.delete(release);
|
|
96
|
+
lease.release();
|
|
97
|
+
};
|
|
98
|
+
this.#turns.add(release);
|
|
99
|
+
return Object.freeze({
|
|
100
|
+
view,
|
|
101
|
+
executeRoute: async (routeId, input, signal) => {
|
|
102
|
+
assertActive();
|
|
103
|
+
const operation = this.#generations.acquire(lease.id);
|
|
104
|
+
try {
|
|
105
|
+
return await operation.generation.executeRoute(view, routeId, input, signal, budget);
|
|
106
|
+
} finally {
|
|
107
|
+
operation.release();
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
executeAction: async (offerId, input, authorize, signal) => {
|
|
111
|
+
assertActive();
|
|
112
|
+
const operation = this.#generations.acquire(lease.id);
|
|
113
|
+
try {
|
|
114
|
+
return await operation.generation.executeAction(view, offerId, input, authorize, signal);
|
|
115
|
+
} finally {
|
|
116
|
+
operation.release();
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
release
|
|
120
|
+
});
|
|
121
|
+
} catch (error) {
|
|
122
|
+
lease.release();
|
|
123
|
+
throw error;
|
|
124
|
+
} finally {
|
|
125
|
+
signal?.removeEventListener("abort", abort);
|
|
126
|
+
this.#beginnings.delete(controller);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
inspect() {
|
|
130
|
+
return jsonClone(this.#generations.inspect(), "memory test diagnostics");
|
|
131
|
+
}
|
|
132
|
+
async managementCatalog(scope = { storage: "custom" }) {
|
|
133
|
+
this.#assertOpen();
|
|
134
|
+
const lease = this.#generations.acquire();
|
|
135
|
+
try {
|
|
136
|
+
return await lease.generation.managementCatalog(scope);
|
|
137
|
+
} finally {
|
|
138
|
+
lease.release();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/** Exercise the public protocol, including rejected confirmation/revision cases. */
|
|
142
|
+
async executeManagement(request) {
|
|
143
|
+
this.#assertOpen();
|
|
144
|
+
const lease = this.#generations.acquire();
|
|
145
|
+
try {
|
|
146
|
+
return await lease.generation.executeManagement(request);
|
|
147
|
+
} finally {
|
|
148
|
+
lease.release();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/** Same scoped management contract a Source page receives, backed by real generations. */
|
|
152
|
+
async managementClient(sourceInstanceKey, scopeValue = { storage: "custom" }) {
|
|
153
|
+
const scope = structuredClone(scopeValue);
|
|
154
|
+
const instance = (await this.managementCatalog(scope)).sources.find((source) => source.sourceInstanceKey === sourceInstanceKey);
|
|
155
|
+
if (instance === void 0) throw new Error(`No managed test Source: ${sourceInstanceKey}`);
|
|
156
|
+
let revision = instance.revision;
|
|
157
|
+
const execute = async (mode, operation, input, options) => {
|
|
158
|
+
const result = await this.executeManagement({
|
|
159
|
+
sourceInstanceKey,
|
|
160
|
+
scope,
|
|
161
|
+
mode,
|
|
162
|
+
operation,
|
|
163
|
+
input,
|
|
164
|
+
confirmed: options?.confirmed === true,
|
|
165
|
+
...mode === "read" ? {} : { expectedRevision: options?.expectedRevision ?? revision }
|
|
166
|
+
});
|
|
167
|
+
revision = result.revision;
|
|
168
|
+
return result;
|
|
169
|
+
};
|
|
170
|
+
return {
|
|
171
|
+
sourceInstanceKey,
|
|
172
|
+
get revision() {
|
|
173
|
+
return revision;
|
|
174
|
+
},
|
|
175
|
+
read: (operation, input = null) => execute("read", operation, input),
|
|
176
|
+
mutate: (operation, input, options) => execute("mutate", operation, input, options)
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
dispose() {
|
|
180
|
+
if (this.#closing !== void 0) return this.#closing;
|
|
181
|
+
this.#closed = true;
|
|
182
|
+
for (const controller of this.#beginnings) controller.abort(/* @__PURE__ */ new Error("MemoryCompositionRunner is disposed"));
|
|
183
|
+
for (const release of this.#turns) release();
|
|
184
|
+
this.#closing = (async () => {
|
|
185
|
+
const failures = [];
|
|
186
|
+
for (const fiber of [...this.#entries.values()].reverse()) try {
|
|
187
|
+
await fiber.dispose();
|
|
188
|
+
} catch (error) {
|
|
189
|
+
failures.push(error);
|
|
190
|
+
}
|
|
191
|
+
this.#entries.clear();
|
|
192
|
+
try {
|
|
193
|
+
await this.context.fiber.dispose();
|
|
194
|
+
} catch (error) {
|
|
195
|
+
failures.push(error);
|
|
196
|
+
}
|
|
197
|
+
if (failures.length > 0) throw new AggregateError(failures, "MemoryCompositionRunner cleanup failed");
|
|
198
|
+
})();
|
|
199
|
+
return this.#closing;
|
|
200
|
+
}
|
|
201
|
+
#assertOpen() {
|
|
202
|
+
if (this.#closed) throw new Error("MemoryCompositionRunner is disposed");
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Evaluate a trusted, already-built DSH Client artifact in a test. Dependencies
|
|
207
|
+
* are explicit (normally the test's React and UI primitives), so no production
|
|
208
|
+
* Loader, global registry, source alias, or second copy of React is required.
|
|
209
|
+
* This is a test fixture, not another Client Loader implementation.
|
|
210
|
+
*/
|
|
211
|
+
function loadMemoryClientArtifact(path, dependencies) {
|
|
212
|
+
let declaration;
|
|
213
|
+
const loader = { load(value) {
|
|
214
|
+
if (declaration !== void 0 || value === void 0 || typeof value.id !== "string" || typeof value.factory !== "function") throw new Error("Expected exactly one DSH Client artifact declaration");
|
|
215
|
+
declaration = value;
|
|
216
|
+
} };
|
|
217
|
+
const actualWindow = globalThis.window ?? {};
|
|
218
|
+
const window = new Proxy(actualWindow, { get(target, key) {
|
|
219
|
+
if (key === "__ModuleLoader__") return loader;
|
|
220
|
+
const value = Reflect.get(target, key, target);
|
|
221
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
222
|
+
} });
|
|
223
|
+
new Function("window", readFileSync(path, "utf8"))(window);
|
|
224
|
+
if (declaration === void 0) throw new Error("No DSH Client declaration in artifact");
|
|
225
|
+
return declaration.factory((id) => {
|
|
226
|
+
if (!Object.hasOwn(dependencies, id)) throw new Error(`Missing Client test dependency: ${id}`);
|
|
227
|
+
return dependencies[id];
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
//#endregion
|
|
231
|
+
export { DEFAULT_MEMORY_VIEW_BUDGET, MemoryCompositionRunner, loadMemoryClientArtifact };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { installMemorySourceUI, memorySourcePageEntryId, MNEMON_SOURCE_PAGE_SLOT, MNEMON_SOURCE_CONFIGURATION_MUTATE, MNEMON_SOURCE_CONFIGURATION_READ, type MemorySourcePageComponent, type MemorySourcePageDefinition, type MemorySourcePageProps, type MemorySourceUIContribution, type MemorySourceUIContext, type MemorySourcePageNavigation, } from './source-pages.tsx';
|
|
2
|
+
export type { MnemonSourceManagementClient, MemorySourcePageInstance } from './source-contracts.ts';
|
|
3
|
+
export * from './page-kit.tsx';
|
|
4
|
+
export * from './page-client.tsx';
|
|
5
|
+
export { MnemonDialog, type MnemonDialogProps } from './MnemonDialog.tsx';
|
|
6
|
+
export { MnemonLogo } from './MnemonLogo.tsx';
|
|
7
|
+
export { useRequestVersion } from './use-request-version.ts';
|
|
8
|
+
export { appearanceClass } from './view-styles.ts';
|
|
9
|
+
export { translateEn, translateZh, type MnemonKey, type MnemonTranslate } from './locales.ts';
|
|
10
|
+
export { IconChevronLeftOutline14 } from '@deepseek-ai/dsh-client-ui-primitives';
|
|
@@ -10,6 +10,10 @@ export declare const zh: {
|
|
|
10
10
|
'category.context': string;
|
|
11
11
|
'category.general': string;
|
|
12
12
|
'nav.aria': string;
|
|
13
|
+
'nav.group.system': string;
|
|
14
|
+
'nav.group.storage': string;
|
|
15
|
+
'nav.group.tools': string;
|
|
16
|
+
'nav.group.sources': string;
|
|
13
17
|
'nav.memory.aria': string;
|
|
14
18
|
'nav.overview': string;
|
|
15
19
|
'nav.bodies': string;
|
|
@@ -53,6 +57,34 @@ export declare const zh: {
|
|
|
53
57
|
'workspace.selectedRoot': string;
|
|
54
58
|
'workspace.effectiveRoot': string;
|
|
55
59
|
'workspace.align': string;
|
|
60
|
+
'sourcePage.instance': string;
|
|
61
|
+
'sourcePage.instanceAria': string;
|
|
62
|
+
'sourcePage.summaryAria': string;
|
|
63
|
+
'sourcePage.package': string;
|
|
64
|
+
'sourcePage.availability': string;
|
|
65
|
+
'sourcePage.availability.ready': string;
|
|
66
|
+
'sourcePage.availability.degraded': string;
|
|
67
|
+
'sourcePage.availability.unavailable': string;
|
|
68
|
+
'sourcePage.role': string;
|
|
69
|
+
'sourcePage.revision': string;
|
|
70
|
+
'sourcePage.permissions': string;
|
|
71
|
+
'sourcePage.diagnostics': string;
|
|
72
|
+
'sourcePage.configuration': string;
|
|
73
|
+
'sourcePage.configurationDescription': string;
|
|
74
|
+
'sourcePage.configLoading': string;
|
|
75
|
+
'sourcePage.configSave': string;
|
|
76
|
+
'sourcePage.configSaving': string;
|
|
77
|
+
'sourcePage.configSaved': string;
|
|
78
|
+
'sourcePage.secretPlaceholder': string;
|
|
79
|
+
'sourcePage.unavailable': string;
|
|
80
|
+
'sourcePage.unavailableDescription': string;
|
|
81
|
+
'telemetry.aria': string;
|
|
82
|
+
'telemetry.title': string;
|
|
83
|
+
'telemetry.memories': string;
|
|
84
|
+
'telemetry.graph': string;
|
|
85
|
+
'telemetry.entities': string;
|
|
86
|
+
'telemetry.spaces': string;
|
|
87
|
+
'sidebar.activeSpaces': string;
|
|
56
88
|
'overview.title': string;
|
|
57
89
|
'overview.description': string;
|
|
58
90
|
'overview.pageDescription': string;
|
|
@@ -689,6 +721,16 @@ export declare const zh: {
|
|
|
689
721
|
'config.topologyEnabled': string;
|
|
690
722
|
'config.topologyDisabled': string;
|
|
691
723
|
'config.topologyLayerToggle': string;
|
|
724
|
+
'config.enhancementsTitle': string;
|
|
725
|
+
'config.enhancementsDescription': string;
|
|
726
|
+
'config.enhancementCapture': string;
|
|
727
|
+
'config.enhancementCaptureHint': string;
|
|
728
|
+
'config.enhancementLightContext': string;
|
|
729
|
+
'config.enhancementLightContextHint': string;
|
|
730
|
+
'config.enhancementScoped': string;
|
|
731
|
+
'config.enhancementScopedHint': string;
|
|
732
|
+
'config.enhancementsFailed': string;
|
|
733
|
+
'config.enhancementsRefreshFailed': string;
|
|
692
734
|
'layers.runtimeLabel': string;
|
|
693
735
|
'layers.runtimeDescription': string;
|
|
694
736
|
'layers.documentsLabel': string;
|
|
@@ -891,6 +933,10 @@ export declare const en: {
|
|
|
891
933
|
'category.context': string;
|
|
892
934
|
'category.general': string;
|
|
893
935
|
'nav.aria': string;
|
|
936
|
+
'nav.group.system': string;
|
|
937
|
+
'nav.group.storage': string;
|
|
938
|
+
'nav.group.tools': string;
|
|
939
|
+
'nav.group.sources': string;
|
|
894
940
|
'nav.memory.aria': string;
|
|
895
941
|
'nav.overview': string;
|
|
896
942
|
'nav.bodies': string;
|
|
@@ -934,6 +980,34 @@ export declare const en: {
|
|
|
934
980
|
'workspace.selectedRoot': string;
|
|
935
981
|
'workspace.effectiveRoot': string;
|
|
936
982
|
'workspace.align': string;
|
|
983
|
+
'sourcePage.instance': string;
|
|
984
|
+
'sourcePage.instanceAria': string;
|
|
985
|
+
'sourcePage.summaryAria': string;
|
|
986
|
+
'sourcePage.package': string;
|
|
987
|
+
'sourcePage.availability': string;
|
|
988
|
+
'sourcePage.availability.ready': string;
|
|
989
|
+
'sourcePage.availability.degraded': string;
|
|
990
|
+
'sourcePage.availability.unavailable': string;
|
|
991
|
+
'sourcePage.role': string;
|
|
992
|
+
'sourcePage.revision': string;
|
|
993
|
+
'sourcePage.permissions': string;
|
|
994
|
+
'sourcePage.diagnostics': string;
|
|
995
|
+
'sourcePage.configuration': string;
|
|
996
|
+
'sourcePage.configurationDescription': string;
|
|
997
|
+
'sourcePage.configLoading': string;
|
|
998
|
+
'sourcePage.configSave': string;
|
|
999
|
+
'sourcePage.configSaving': string;
|
|
1000
|
+
'sourcePage.configSaved': string;
|
|
1001
|
+
'sourcePage.secretPlaceholder': string;
|
|
1002
|
+
'sourcePage.unavailable': string;
|
|
1003
|
+
'sourcePage.unavailableDescription': string;
|
|
1004
|
+
'telemetry.aria': string;
|
|
1005
|
+
'telemetry.title': string;
|
|
1006
|
+
'telemetry.memories': string;
|
|
1007
|
+
'telemetry.graph': string;
|
|
1008
|
+
'telemetry.entities': string;
|
|
1009
|
+
'telemetry.spaces': string;
|
|
1010
|
+
'sidebar.activeSpaces': string;
|
|
937
1011
|
'overview.title': string;
|
|
938
1012
|
'overview.description': string;
|
|
939
1013
|
'overview.pageDescription': string;
|
|
@@ -1570,6 +1644,16 @@ export declare const en: {
|
|
|
1570
1644
|
'config.topologyEnabled': string;
|
|
1571
1645
|
'config.topologyDisabled': string;
|
|
1572
1646
|
'config.topologyLayerToggle': string;
|
|
1647
|
+
'config.enhancementsTitle': string;
|
|
1648
|
+
'config.enhancementsDescription': string;
|
|
1649
|
+
'config.enhancementCapture': string;
|
|
1650
|
+
'config.enhancementCaptureHint': string;
|
|
1651
|
+
'config.enhancementLightContext': string;
|
|
1652
|
+
'config.enhancementLightContextHint': string;
|
|
1653
|
+
'config.enhancementScoped': string;
|
|
1654
|
+
'config.enhancementScopedHint': string;
|
|
1655
|
+
'config.enhancementsFailed': string;
|
|
1656
|
+
'config.enhancementsRefreshFailed': string;
|
|
1573
1657
|
'layers.runtimeLabel': string;
|
|
1574
1658
|
'layers.runtimeDescription': string;
|
|
1575
1659
|
'layers.documentsLabel': string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { JSX, ReactNode } from 'react';
|
|
2
|
+
import type { MemoryJsonValue } from "../core/contracts/index.js";
|
|
3
|
+
import type { MnemonSourceManagementClient } from './source-contracts.ts';
|
|
4
|
+
/** Optional default presentation kit; custom pages may use their own UI. */
|
|
5
|
+
export declare function MemorySourcePageFrame(props: {
|
|
6
|
+
locale: string;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}): JSX.Element;
|
|
9
|
+
/** Track revisions returned by reads as well as writes; never retry a conflict. */
|
|
10
|
+
export declare function createMemorySourcePageClient(management: MnemonSourceManagementClient): {
|
|
11
|
+
canAssist: (operation: string) => boolean;
|
|
12
|
+
assist: <T>(operation: string, input: MemoryJsonValue, confirmed: boolean) => Promise<T>;
|
|
13
|
+
read: <T>(operation: string, input?: MemoryJsonValue) => Promise<T>;
|
|
14
|
+
mutate: <T>(operation: string, input: MemoryJsonValue, confirmed: true) => Promise<T>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import { type MnemonTranslate } from './locales.ts';
|
|
3
|
+
import { type MnemonDialogProps } from './MnemonDialog.tsx';
|
|
4
|
+
export declare const I18nContext: import("react").Context<MnemonTranslate>;
|
|
5
|
+
export declare const LocaleContext: import("react").Context<string>;
|
|
6
|
+
export declare function useT(): MnemonTranslate;
|
|
7
|
+
export declare function useLocale(): string;
|
|
8
|
+
export declare function humanBytes(bytes: number): string;
|
|
9
|
+
export declare function message(error: unknown): string;
|
|
10
|
+
export declare function parseBranchesInput(raw: string): string[] | undefined;
|
|
11
|
+
export declare function short(value: string, max: number): string;
|
|
12
|
+
export declare function PageHeader(props: {
|
|
13
|
+
title: string;
|
|
14
|
+
description: string;
|
|
15
|
+
meta?: string;
|
|
16
|
+
loadingLabel?: string;
|
|
17
|
+
action?: JSX.Element;
|
|
18
|
+
}): JSX.Element;
|
|
19
|
+
export declare function PageSpinner({ label }: {
|
|
20
|
+
label: string;
|
|
21
|
+
}): JSX.Element;
|
|
22
|
+
export declare function SectionSpinner({ label }: {
|
|
23
|
+
label: string;
|
|
24
|
+
}): JSX.Element;
|
|
25
|
+
export declare function ProgressiveFooter(props: {
|
|
26
|
+
visible: number;
|
|
27
|
+
total: number;
|
|
28
|
+
pageSize: number;
|
|
29
|
+
compact?: boolean;
|
|
30
|
+
onMore: () => void;
|
|
31
|
+
}): JSX.Element | null;
|
|
32
|
+
/** DSH-style action dialog shared by Sidebar add/write flows. */
|
|
33
|
+
export declare function SidebarModal(props: Omit<MnemonDialogProps, 'closeLabel'>): JSX.Element;
|
|
34
|
+
export declare function EmptyState(props: {
|
|
35
|
+
glyph: string;
|
|
36
|
+
title: string;
|
|
37
|
+
children: string;
|
|
38
|
+
}): JSX.Element;
|
|
39
|
+
export declare const memoryPageStyles: Readonly<Record<string, string>>;
|
|
40
|
+
export declare const memorySidebarStyles: Readonly<Record<string, string>>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { MemoryJsonValue, MemorySourceManagementInstance, MemorySourceManagementResult } from "../core/contracts/index.js";
|
|
2
|
+
/** Instance- and scope-bound capability; never the Host's raw transport. */
|
|
3
|
+
export interface MnemonSourceManagementClient {
|
|
4
|
+
readonly sourceInstanceKey: string;
|
|
5
|
+
readonly revision: string;
|
|
6
|
+
/** Optional workflows advertised and authorized by the Host for this exact instance. */
|
|
7
|
+
readonly assistance?: {
|
|
8
|
+
readonly operations: readonly string[];
|
|
9
|
+
execute(operation: string, input: MemoryJsonValue, options: {
|
|
10
|
+
expectedRevision: string;
|
|
11
|
+
confirmed: boolean;
|
|
12
|
+
}): Promise<MemorySourceManagementResult>;
|
|
13
|
+
};
|
|
14
|
+
read(operation: string, input?: MemoryJsonValue): Promise<MemorySourceManagementResult>;
|
|
15
|
+
mutate(operation: string, input: MemoryJsonValue, options: {
|
|
16
|
+
expectedRevision?: string;
|
|
17
|
+
confirmed: true;
|
|
18
|
+
}): Promise<MemorySourceManagementResult>;
|
|
19
|
+
}
|
|
20
|
+
/** Browser metadata is display-only; the Host validates capability identifiers. */
|
|
21
|
+
export type MemorySourcePageInstance = Omit<MemorySourceManagementInstance, 'capabilities'> & {
|
|
22
|
+
capabilities: readonly string[];
|
|
23
|
+
};
|
|
24
|
+
export interface MemorySourcePageProps {
|
|
25
|
+
/** Type-level presentation identity; never a Client or Host Fiber uid. */
|
|
26
|
+
sourceTypeId: string;
|
|
27
|
+
/** Selected Host instance in the current authenticated scope. */
|
|
28
|
+
sourceInstanceKey?: string;
|
|
29
|
+
sourceInstances: readonly MemorySourcePageInstance[];
|
|
30
|
+
/** Present only while the selected Host instance remains visible. */
|
|
31
|
+
management?: MnemonSourceManagementClient;
|
|
32
|
+
/** Presentation hint only; the Host still authenticates every mutation. */
|
|
33
|
+
writable?: boolean;
|
|
34
|
+
sessionId?: string;
|
|
35
|
+
workspaceId?: string;
|
|
36
|
+
locale: string;
|
|
37
|
+
/** Opaque navigation data owned by this Source page. */
|
|
38
|
+
navigationInput?: MemoryJsonValue;
|
|
39
|
+
onRefresh?(): void;
|
|
40
|
+
/** Optional, Source-bound product preferences; no raw settings service or secrets. */
|
|
41
|
+
preferences?: {
|
|
42
|
+
value: MemoryJsonValue;
|
|
43
|
+
writable: boolean;
|
|
44
|
+
replace(value: MemoryJsonValue): Promise<void>;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { MemorySourcePageProps } from './source-contracts.ts';
|
|
3
|
+
export type { MemorySourcePageProps } from './source-contracts.ts';
|
|
4
|
+
export declare const MNEMON_SOURCE_PAGE_SLOT: "mnemon.source.page";
|
|
5
|
+
/** Conventional operations used by Mnemon's descriptor-driven Source page. */
|
|
6
|
+
export declare const MNEMON_SOURCE_CONFIGURATION_READ: "configuration";
|
|
7
|
+
export declare const MNEMON_SOURCE_CONFIGURATION_MUTATE: "configuration";
|
|
8
|
+
export type MemorySourcePageComponent = (props: MemorySourcePageProps) => ReactNode;
|
|
9
|
+
/** The existing DSH Slot capability narrowed to this one child Slot. */
|
|
10
|
+
export interface MemorySourceUIContext {
|
|
11
|
+
locale?: {
|
|
12
|
+
bind(namespace: 'mnemon'): import('./locales.ts').MnemonTranslate;
|
|
13
|
+
};
|
|
14
|
+
slots: {
|
|
15
|
+
inject(name: typeof MNEMON_SOURCE_PAGE_SLOT, setup: () => () => void): () => void;
|
|
16
|
+
register(options: {
|
|
17
|
+
name: typeof MNEMON_SOURCE_PAGE_SLOT;
|
|
18
|
+
id: string;
|
|
19
|
+
order: number;
|
|
20
|
+
label: string | (() => string);
|
|
21
|
+
priority?: number;
|
|
22
|
+
}, component: MemorySourcePageComponent): () => void;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
interface MemorySourcePageDirectoryContext {
|
|
26
|
+
locale?: {
|
|
27
|
+
getSnapshot(): unknown;
|
|
28
|
+
subscribe(listener: () => void): () => void;
|
|
29
|
+
};
|
|
30
|
+
slots: {
|
|
31
|
+
getVersion(name: typeof MNEMON_SOURCE_PAGE_SLOT): number;
|
|
32
|
+
entriesOfSlot(name: typeof MNEMON_SOURCE_PAGE_SLOT): readonly {
|
|
33
|
+
options: {
|
|
34
|
+
id?: string;
|
|
35
|
+
label?: string | (() => string);
|
|
36
|
+
order?: number;
|
|
37
|
+
};
|
|
38
|
+
component?: unknown;
|
|
39
|
+
}[];
|
|
40
|
+
subscribe(name: typeof MNEMON_SOURCE_PAGE_SLOT, listener: () => void): () => void;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export interface MemorySourcePageNavigation {
|
|
44
|
+
/** Let the Host retain a compact page header while scrolling in a sidebar. */
|
|
45
|
+
stickyHeader?: boolean;
|
|
46
|
+
group?: 'storage' | 'tools' | 'sources';
|
|
47
|
+
primary?: boolean;
|
|
48
|
+
glyph?: string;
|
|
49
|
+
detail?: string | (() => string);
|
|
50
|
+
}
|
|
51
|
+
export interface MemorySourcePageDefinition {
|
|
52
|
+
id: string;
|
|
53
|
+
label: string | (() => string);
|
|
54
|
+
order?: number;
|
|
55
|
+
component: MemorySourcePageComponent;
|
|
56
|
+
navigation?: MemorySourcePageNavigation;
|
|
57
|
+
}
|
|
58
|
+
export interface MemorySourceUIContribution {
|
|
59
|
+
sourceTypeId: string;
|
|
60
|
+
pages: readonly MemorySourcePageDefinition[];
|
|
61
|
+
}
|
|
62
|
+
export interface MemorySourcePageEntry {
|
|
63
|
+
id: string;
|
|
64
|
+
sourceTypeId: string;
|
|
65
|
+
pageId: string;
|
|
66
|
+
label: string;
|
|
67
|
+
order: number;
|
|
68
|
+
navigation?: Omit<MemorySourcePageNavigation, 'detail'> & {
|
|
69
|
+
detail?: string;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export interface MemorySourcePageDirectory {
|
|
73
|
+
getSnapshot(): readonly MemorySourcePageEntry[];
|
|
74
|
+
subscribe(listener: () => void): () => void;
|
|
75
|
+
}
|
|
76
|
+
export declare function memorySourcePageEntryId(sourceTypeId: string, pageId: string): string;
|
|
77
|
+
/**
|
|
78
|
+
* Thin Client-Fiber adapter over the DSH child Slot. It creates no service or
|
|
79
|
+
* registry: `slots.inject/register` own declaration waiting and disposal.
|
|
80
|
+
*/
|
|
81
|
+
export declare function installMemorySourceUI(ctx: MemorySourceUIContext, contribution: MemorySourceUIContribution): () => void;
|
|
82
|
+
/** Stable uSES directory over the Slot ledger; no parallel page registry. */
|
|
83
|
+
export declare function createMemorySourcePageDirectory(ctx: MemorySourcePageDirectoryContext): MemorySourcePageDirectory;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Metadata, operation inputs and protocol results use JSON-safe values. */
|
|
2
|
+
export type MemoryJsonPrimitive = string | number | boolean | null;
|
|
3
|
+
export type MemoryJsonValue = MemoryJsonPrimitive | MemoryJsonValue[] | {
|
|
4
|
+
[key: string]: MemoryJsonValue;
|
|
5
|
+
};
|
|
6
|
+
export declare const MEMORY_CAPABILITIES: readonly ["status", "project", "recall", "search", "read", "browse", "write", "archive", "graph", "related", "link", "forget", "maintain", "export", "import"];
|
|
7
|
+
export type MemoryCapability = typeof MEMORY_CAPABILITIES[number];
|
|
8
|
+
export interface MemoryOperationScope {
|
|
9
|
+
storage: 'global' | 'workspace' | 'custom';
|
|
10
|
+
workspaceId?: string;
|
|
11
|
+
sessionId?: string;
|
|
12
|
+
agentId?: string;
|
|
13
|
+
}
|
|
14
|
+
export type MemoryReceiptStatus = 'succeeded' | 'partial' | 'failed' | 'cancelled';
|
|
15
|
+
export interface MemoryMigrationLineageEndpoint {
|
|
16
|
+
layerId: string;
|
|
17
|
+
reference: string;
|
|
18
|
+
digest: string;
|
|
19
|
+
}
|
|
20
|
+
/** Auditable proof that one exact source item reached one committed destination. */
|
|
21
|
+
export interface MemoryMigrationLineage {
|
|
22
|
+
source: MemoryMigrationLineageEndpoint;
|
|
23
|
+
destination: MemoryMigrationLineageEndpoint;
|
|
24
|
+
}
|
|
25
|
+
export declare const MEMORY_SOURCE_MODES: readonly ["eager", "routed"];
|
|
26
|
+
export type MemorySourceMode = typeof MEMORY_SOURCE_MODES[number];
|
|
27
|
+
export interface MemoryWakeSection {
|
|
28
|
+
layerId: string;
|
|
29
|
+
mode: MemorySourceMode;
|
|
30
|
+
text: string;
|
|
31
|
+
}
|
|
32
|
+
export interface MemoryWake {
|
|
33
|
+
viewId: string;
|
|
34
|
+
viewDigest: string;
|
|
35
|
+
text: string;
|
|
36
|
+
sections: MemoryWakeSection[];
|
|
37
|
+
guidance?: import('./view.ts').MemoryViewGuidance;
|
|
38
|
+
}
|
|
39
|
+
export * from './plugin.ts';
|
|
40
|
+
export * from './view.ts';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Declarative identity and graph relations shared by every Mnemon plugin. */
|
|
2
|
+
export declare const MEMORY_PLUGIN_API_VERSION: "dsh-mnemon/plugin/v1";
|
|
3
|
+
export type MemoryPluginRole = 'source' | 'strategy' | 'strategy-extension';
|
|
4
|
+
export interface MemoryPluginLocalizedText {
|
|
5
|
+
en: string;
|
|
6
|
+
'zh-CN': string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A capability is a graph edge, not a runtime permission. Multiple plugins may
|
|
10
|
+
* provide the same capability unless the capability is explicitly exclusive.
|
|
11
|
+
*/
|
|
12
|
+
export interface MemoryPluginProvidedCapability {
|
|
13
|
+
id: string;
|
|
14
|
+
exclusive?: true;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* JSON-safe module export named `memoryPlugin`.
|
|
18
|
+
*
|
|
19
|
+
* Source and Strategy are contribution roles of one peer plugin model. The
|
|
20
|
+
* descriptor is available before activation, so a Host can explain and verify
|
|
21
|
+
* dependencies without executing the plugin. Core remains the sole View
|
|
22
|
+
* compiler; a plugin never publishes a View directly.
|
|
23
|
+
*/
|
|
24
|
+
export interface MemoryPluginDescriptor {
|
|
25
|
+
apiVersion: typeof MEMORY_PLUGIN_API_VERSION;
|
|
26
|
+
packageName: string;
|
|
27
|
+
label: MemoryPluginLocalizedText;
|
|
28
|
+
description: MemoryPluginLocalizedText;
|
|
29
|
+
roles: MemoryPluginRole[];
|
|
30
|
+
provides: MemoryPluginProvidedCapability[];
|
|
31
|
+
requires?: string[];
|
|
32
|
+
}
|