dsh-mnemon-source-memory-spaces 0.5.16 → 0.5.17
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/lib/client.js +4 -1
- package/lib/contracts.d.ts +7 -0
- package/lib/{definitions-BcYzE092.d.ts → definitions-CtjNSwBS.d.ts} +6 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +82 -30
- package/lib/provider-sdk.d.ts +1 -1
- package/lib/testing.d.ts +1 -1
- package/lib/types/contracts.d.ts +7 -0
- package/package.json +3 -3
package/lib/client.js
CHANGED
|
@@ -4476,7 +4476,10 @@ window.__ModuleLoader__.load({
|
|
|
4476
4476
|
limit,
|
|
4477
4477
|
view
|
|
4478
4478
|
})),
|
|
4479
|
-
search: (request) => client.read("search", input(
|
|
4479
|
+
search: (request) => client.read("search", input({
|
|
4480
|
+
...request,
|
|
4481
|
+
inspect: true
|
|
4482
|
+
})),
|
|
4480
4483
|
related: (id, memoryBodyId) => client.read("related", input({
|
|
4481
4484
|
id,
|
|
4482
4485
|
memoryBodyId
|
package/lib/contracts.d.ts
CHANGED
|
@@ -272,6 +272,13 @@ interface SearchRequest {
|
|
|
272
272
|
source?: Source;
|
|
273
273
|
intent?: Intent;
|
|
274
274
|
memoryBodyIds?: string[];
|
|
275
|
+
/**
|
|
276
|
+
* A look at the memory rather than a use of it, such as the Memory System's
|
|
277
|
+
* own searches. Providers that record reads, as access counts or a query
|
|
278
|
+
* log, leave it out, and may answer from a snapshot that lags a write still
|
|
279
|
+
* in flight; a check that must see a write leaves the flag unset.
|
|
280
|
+
*/
|
|
281
|
+
inspect?: boolean;
|
|
275
282
|
}
|
|
276
283
|
interface RememberRequest {
|
|
277
284
|
content: string;
|
|
@@ -92,6 +92,12 @@ interface MemoryProviderAdapter {
|
|
|
92
92
|
entityIndex?(body: MemorySpace, signal?: AbortSignal): Promise<ProviderEntityIndex>;
|
|
93
93
|
/** Persist an ordered host-authorized batch and return one receipt per request. */
|
|
94
94
|
rememberMany?(body: MemorySpace, requests: readonly RememberRequest[], signal?: AbortSignal): Promise<JsonValue[]>;
|
|
95
|
+
/**
|
|
96
|
+
* Optional exact read: the memory this space holds under `id`, or undefined
|
|
97
|
+
* when it holds none. With it an action can name a memory by id that the
|
|
98
|
+
* current View has not returned, such as an Agent forgetting what it wrote.
|
|
99
|
+
*/
|
|
100
|
+
get?(body: MemorySpace, id: string, signal?: AbortSignal): Promise<Insight | undefined>;
|
|
95
101
|
related?(body: MemorySpace, id: string, depth: number, edge?: EdgeType, signal?: AbortSignal): Promise<Insight[]>;
|
|
96
102
|
link?(body: MemorySpace, sourceId: string, targetId: string, type: EdgeType, weight: number, reason?: string, signal?: AbortSignal): Promise<JsonValue>;
|
|
97
103
|
forget?(body: MemorySpace, id: string, signal?: AbortSignal): Promise<JsonValue>;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AutomaticMemoryPlacementRequest, CATEGORIES, Category, CreateMemoryBodyRequest, CreateMemorySpaceRequest, DEFAULT_EMBEDDING_ENDPOINT, DEFAULT_EMBEDDING_MODEL, DEFAULT_EMBEDDING_PROTOCOL, EDGE_TYPES, EMBEDDING_PROTOCOL_AUTO, EMBEDDING_PROTOCOL_OLLAMA, EMBEDDING_PROTOCOL_OPENAI, EdgeType, EntityMemoriesView, EntityRelatedView, EntityView, INTENTS, Insight, Intent, JsonValue, LlmMemoryPlacementSelection, MNEMON_EMBEDDING_PROTOCOLS, MemoryBody, MemoryBodyCatalog, MemoryBodyMetadataMaintenanceResult, MemoryBodyMetadataSample, MemoryBodyMetadataUpdate, MemoryBodyProvider, MemoryBodyStats, MemoryBodyView, MemoryGraphEdge, MemoryGraphNode, MemoryGraphSnapshot, MemoryListRequest, MemoryListView, MemoryPersistenceStrategy, MemoryPlacementCandidate, MemoryPlacementCapability, MemoryPlacementDecision, MemoryPlacementPreference, MemoryPlacementRules, MemoryProviderCapabilities, MemoryProviderConfigField, MemoryProviderConfigOption, MemoryProviderConnection, MemoryProviderConnectionValue, MemoryProviderDescriptor, MemoryProviderIcon, MemoryProviderId, MemoryProviderRuntimeStatus, MemoryProviderServiceCatalog, MemoryProviderServiceView, MemoryReadMode, MemoryReadSource, MemoryReadStatus, MemorySpace, MemorySpaceCatalog, MemorySpaceMetadataMaintenanceResult, MemorySpaceMetadataSample, MemorySpaceMetadataUpdate, MemorySpaceProvider, MemorySpaceStats, MemorySpaceView, MemorySpaceWriteScope, MemorySpaceWriteScopeRequest, MemorySpacesStatus, MnemonEmbeddingConfig, MnemonEmbeddingProtocol, MnemonEmbeddingStatus, OpenVikingBodyConnection, OpenVikingSpaceConnection, PreparedMemoryPlacement, RecallQualityConfig, RecallQualityStats, RecallRelevanceTier, RememberRequest, ResolvedMemoryPersistenceStrategy, ResolvedMnemonEmbeddingConfig, ResolvedRecallQualityConfig, SOURCES, SearchRequest, Source, UpdateMemoryBodyRequest, UpdateMemoryProviderServiceRequest, UpdateMemorySpaceRequest, normalizeEntityKey } from "./contracts.js";
|
|
2
|
-
import { i as MemorySpaceProviderEntry } from "./definitions-
|
|
2
|
+
import { i as MemorySpaceProviderEntry } from "./definitions-CtjNSwBS.js";
|
|
3
3
|
import z from "@deepseek-ai/schemastery";
|
|
4
4
|
import { Context } from "@deepseek-ai/cordis";
|
|
5
5
|
//#region src/config.d.ts
|
package/lib/index.js
CHANGED
|
@@ -45,8 +45,11 @@ function modelStatus(status) {
|
|
|
45
45
|
const unhealthy = active.filter((body) => !body.healthy);
|
|
46
46
|
const relevantProviders = status.providerServices?.filter((provider) => provider.enabled || provider.configured || provider.memoryBodyCount > 0 || provider.status === "unhealthy") ?? [];
|
|
47
47
|
const providers = relevantProviders.slice(0, 16);
|
|
48
|
+
const providerReady = status.commandFound === true || (status.providerServices ?? []).some((provider) => provider.enabled && provider.configured);
|
|
49
|
+
const notice = status.memoryBodies.length > 0 ? void 0 : providerReady ? "No Memory Space exists yet, so durable memory has nowhere to go and a full MEMORY.md archives to a local file. Create and activate a Memory Space to keep durable memory." : "No Memory Space exists, and none can be created until a memory Provider is ready, so durable memory has nowhere to go and a full MEMORY.md archives to a local file. Install the Mnemon CLI for Mnemon Native, or connect another Provider on the dsh-mnemon page under Plugins, then create and activate a Memory Space.";
|
|
48
50
|
return {
|
|
49
51
|
healthy: status.healthy && unhealthy.length === 0,
|
|
52
|
+
...notice === void 0 ? {} : { notice },
|
|
50
53
|
...status.error === void 0 ? {} : { error: boundedToolText(status.error, 1e3) },
|
|
51
54
|
...status.version === void 0 ? {} : { version: boundedToolText(status.version, 120) },
|
|
52
55
|
commandFound: status.commandFound,
|
|
@@ -1633,7 +1636,8 @@ var MemorySpacesService = class {
|
|
|
1633
1636
|
const all = this.memorySpaces.list();
|
|
1634
1637
|
const serviceItems = this.memorySpaces.providerServices().items;
|
|
1635
1638
|
const enabled = new Set(serviceItems.filter((service) => service.enabled).map((service) => service.providerId));
|
|
1636
|
-
const
|
|
1639
|
+
const commandFound = this.runner.commandFound;
|
|
1640
|
+
const active = all.filter((body) => body.active && (this.isNativeSpace(body) ? commandFound : enabled.has(body.provider.id))).sort((left, right) => left.id.localeCompare(right.id));
|
|
1637
1641
|
const spaces = [...all].sort((left, right) => left.id.localeCompare(right.id)).map((body) => ({
|
|
1638
1642
|
id: body.id,
|
|
1639
1643
|
name: body.name,
|
|
@@ -1648,13 +1652,16 @@ var MemorySpacesService = class {
|
|
|
1648
1652
|
enabled: service.enabled,
|
|
1649
1653
|
configured: service.configured
|
|
1650
1654
|
})).sort((left, right) => left.providerId.localeCompare(right.providerId));
|
|
1655
|
+
const revision = createHash("sha256").update(JSON.stringify({
|
|
1656
|
+
bodies: spaces,
|
|
1657
|
+
services,
|
|
1658
|
+
...commandFound ? {} : { nativeUnavailable: true }
|
|
1659
|
+
})).digest("hex");
|
|
1651
1660
|
return {
|
|
1652
1661
|
all,
|
|
1653
1662
|
active,
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
services
|
|
1657
|
-
})).digest("hex")
|
|
1663
|
+
providerReady: this.memorySpaces.defaultProviderId() !== void 0,
|
|
1664
|
+
revision
|
|
1658
1665
|
};
|
|
1659
1666
|
}
|
|
1660
1667
|
/** Return a usable system snapshot without waiting for any Provider I/O. */
|
|
@@ -1842,7 +1849,8 @@ var MemorySpacesService = class {
|
|
|
1842
1849
|
limit: preparedPolicy.candidateLimit,
|
|
1843
1850
|
...category === void 0 ? {} : { category },
|
|
1844
1851
|
...source === void 0 ? {} : { source },
|
|
1845
|
-
...intent === void 0 ? {} : { intent }
|
|
1852
|
+
...intent === void 0 ? {} : { intent },
|
|
1853
|
+
...request.inspect === true ? { inspect: true } : {}
|
|
1846
1854
|
};
|
|
1847
1855
|
let batches = await Promise.all(spaces.map(async (body) => {
|
|
1848
1856
|
if (!body.provider.capabilities.search) return {
|
|
@@ -1906,7 +1914,8 @@ var MemorySpacesService = class {
|
|
|
1906
1914
|
const recovered = await this.providerFor(batch.body).search(batch.body, {
|
|
1907
1915
|
query: recoveryPlan.query,
|
|
1908
1916
|
mode: "keyword",
|
|
1909
|
-
limit: Math.min(limit, preparedPolicy.candidateLimit)
|
|
1917
|
+
limit: Math.min(limit, preparedPolicy.candidateLimit),
|
|
1918
|
+
...request.inspect === true ? { inspect: true } : {}
|
|
1910
1919
|
}, signal);
|
|
1911
1920
|
const admitted = recovered.results.some((insight) => recoveryMatchCount(insight.content, recoveryPlan) >= recoveryPlan.requiredMatches);
|
|
1912
1921
|
const results = mergeRecoveryResults(batch.result.results, recovered.results, recoveryPlan, preparedPolicy.candidateLimit);
|
|
@@ -2197,7 +2206,8 @@ var MemorySpacesService = class {
|
|
|
2197
2206
|
query: selected,
|
|
2198
2207
|
intent: "ENTITY",
|
|
2199
2208
|
limit: memoryInputInteger(limit, 20, 1, 50),
|
|
2200
|
-
memoryBodyIds: readableIds
|
|
2209
|
+
memoryBodyIds: readableIds,
|
|
2210
|
+
inspect: true
|
|
2201
2211
|
}, combined, { exclude: carrying });
|
|
2202
2212
|
combined?.throwIfAborted();
|
|
2203
2213
|
return {
|
|
@@ -2394,6 +2404,24 @@ var MemorySpacesService = class {
|
|
|
2394
2404
|
}
|
|
2395
2405
|
return results;
|
|
2396
2406
|
}
|
|
2407
|
+
/**
|
|
2408
|
+
* The memories held under an exact id among the given spaces that can be
|
|
2409
|
+
* read now, asked of the Providers that can look ids up.
|
|
2410
|
+
*/
|
|
2411
|
+
async locate(id, memoryBodyIds, signal) {
|
|
2412
|
+
const exact = required(id, "id", 2e3);
|
|
2413
|
+
const readable = new Map(this.memorySpaces.active().filter((body) => this.isNativeSpace(body) || this.memorySpaces.providerServiceEnabled(body.provider.id)).map((body) => [body.id, body]));
|
|
2414
|
+
const found = [];
|
|
2415
|
+
for (const memoryBodyId of new Set(memoryBodyIds)) {
|
|
2416
|
+
const body = readable.get(memoryBodyId);
|
|
2417
|
+
if (body === void 0) continue;
|
|
2418
|
+
const provider = this.providerFor(body);
|
|
2419
|
+
if (provider.get === void 0) continue;
|
|
2420
|
+
const insight = await provider.get(body, exact, signal);
|
|
2421
|
+
if (insight !== void 0 && insight.id === exact) found.push(this.annotate(insight, body));
|
|
2422
|
+
}
|
|
2423
|
+
return found;
|
|
2424
|
+
}
|
|
2397
2425
|
async related(id, depth = 2, edge, signal, memoryBodyId) {
|
|
2398
2426
|
const body = this.readSpace(memoryBodyId);
|
|
2399
2427
|
const selectedEdge = allowed(edge, EDGE_TYPES, "edge");
|
|
@@ -2700,7 +2728,9 @@ const EMBEDDING_ENVIRONMENT_KEYS = /* @__PURE__ */ new Set([
|
|
|
2700
2728
|
function processFailureMessage(error, args) {
|
|
2701
2729
|
const detail = error instanceof Error ? error.message : String(error);
|
|
2702
2730
|
const reason = error instanceof ProcessError ? error.reason : "launch";
|
|
2703
|
-
|
|
2731
|
+
const command = args.find((arg) => !arg.startsWith("-"));
|
|
2732
|
+
if (reason === "output-limit") return `mnemon ${command ?? "command"} stopped: ${detail.replace(/^mnemon /u, "")}`;
|
|
2733
|
+
if (reason === "timeout" && command !== void 0) return detail.replace(/^mnemon /u, `mnemon ${command} `);
|
|
2704
2734
|
if (reason !== "launch") return detail;
|
|
2705
2735
|
return `${detail}. ${process.platform === "win32" ? "Install the official Mnemon Windows release, ensure mnemon.exe is on PATH or under %LOCALAPPDATA%\\Programs\\mnemon, or set MNEMON_CLI_PATH or mnemon.cliPath to its absolute path." : "Install Mnemon and ensure \"mnemon\" is on PATH, or set MNEMON_CLI_PATH or mnemon.cliPath."}`;
|
|
2706
2736
|
}
|
|
@@ -3075,7 +3105,8 @@ async function manageMemorySpaces(service, request) {
|
|
|
3075
3105
|
...memoryInputText(input.category, "category", 30, false) === void 0 ? {} : { category: memoryInputText(input.category, "category", 30, false) },
|
|
3076
3106
|
...memoryInputText(input.source, "source", 30, false) === void 0 ? {} : { source: memoryInputText(input.source, "source", 30, false) },
|
|
3077
3107
|
...memoryInputText(input.intent, "intent", 30, false) === void 0 ? {} : { intent: memoryInputText(input.intent, "intent", 30, false) },
|
|
3078
|
-
...memoryInputStringArray(input.memoryBodyIds, "memoryBodyIds", 1e4) === void 0 ? {} : { memoryBodyIds: memoryInputStringArray(input.memoryBodyIds, "memoryBodyIds", 1e4) }
|
|
3108
|
+
...memoryInputStringArray(input.memoryBodyIds, "memoryBodyIds", 1e4) === void 0 ? {} : { memoryBodyIds: memoryInputStringArray(input.memoryBodyIds, "memoryBodyIds", 1e4) },
|
|
3109
|
+
...input.inspect === true ? { inspect: true } : {}
|
|
3079
3110
|
}, request.signal));
|
|
3080
3111
|
case "related": return managementResult(service, await service.related(memoryInputText(input.id, "id", 2e3), memoryInputInteger(input.depth, 2, 1, 5), memoryInputText(input.edge, "edge", 30, false), request.signal, memoryInputText(input.memoryBodyId, "memoryBodyId", 300, false)));
|
|
3081
3112
|
case "body-reconnect": return managementResult(service, await service.reconnectSpace(memoryInputText(input.memoryBodyId, "memoryBodyId", 300), request.signal));
|
|
@@ -3353,6 +3384,34 @@ function createMemorySpacesSource(providerSnapshot, config = {}) {
|
|
|
3353
3384
|
admittedByView.set(viewId, current);
|
|
3354
3385
|
while (admittedByView.size > 128) admittedByView.delete(admittedByView.keys().next().value);
|
|
3355
3386
|
};
|
|
3387
|
+
/**
|
|
3388
|
+
* The Memory Space an exact id belongs to, for an action or traversal that
|
|
3389
|
+
* names a memory by id. Evidence this View returned decides first, as
|
|
3390
|
+
* before. Otherwise the Providers that can look an id up are asked among
|
|
3391
|
+
* the spaces in `scope`, and a found memory is admitted to this View. An
|
|
3392
|
+
* Agent can so forget what it just wrote, and a delegated worker can act on
|
|
3393
|
+
* an id from its parent's turn (#337). A Provider that cannot look ids up
|
|
3394
|
+
* keeps to evidence: its own call may reach beyond the space named.
|
|
3395
|
+
*/
|
|
3396
|
+
const ownerOf = async (viewId, id, requestedSpace, scope, signal) => {
|
|
3397
|
+
const entries = admittedByView.get(viewId);
|
|
3398
|
+
if (requestedSpace !== void 0) {
|
|
3399
|
+
if (entries?.has(requestedSpace + "/" + id) === true) return requestedSpace;
|
|
3400
|
+
} else {
|
|
3401
|
+
const owners = [...entries?.entries() ?? []].filter(([reference]) => reference.endsWith("/" + id)).map(([, owner]) => owner);
|
|
3402
|
+
if (owners.length > 0) return owners.length === 1 ? owners[0] : void 0;
|
|
3403
|
+
}
|
|
3404
|
+
const candidates = requestedSpace === void 0 ? scope : scope.includes(requestedSpace) ? [requestedSpace] : [];
|
|
3405
|
+
if (candidates.length === 0) return void 0;
|
|
3406
|
+
const found = await service.locate(id, candidates, signal);
|
|
3407
|
+
const owners = [...new Set(found.flatMap((item) => item.memoryBodyId === void 0 ? [] : [item.memoryBodyId]))];
|
|
3408
|
+
if (owners.length !== 1) return void 0;
|
|
3409
|
+
admit(viewId, [{
|
|
3410
|
+
id,
|
|
3411
|
+
memoryBodyId: owners[0]
|
|
3412
|
+
}]);
|
|
3413
|
+
return owners[0];
|
|
3414
|
+
};
|
|
3356
3415
|
const evidence = (request, items, unavailable) => {
|
|
3357
3416
|
const catalog = request.route.sourceRouteId === "inspect";
|
|
3358
3417
|
let remaining = request.route.maxCharacters ?? 16e3;
|
|
@@ -3410,15 +3469,15 @@ function createMemorySpacesSource(providerSnapshot, config = {}) {
|
|
|
3410
3469
|
};
|
|
3411
3470
|
return {
|
|
3412
3471
|
facts(request) {
|
|
3413
|
-
const { active, revision } = sourceState(request.scope);
|
|
3472
|
+
const { active, providerReady, revision } = sourceState(request.scope);
|
|
3414
3473
|
const routeIds = [
|
|
3415
3474
|
"inspect",
|
|
3416
3475
|
...active.some((body) => body.provider.capabilities.search) ? ["recall"] : [],
|
|
3417
3476
|
...active.some((body) => body.provider.capabilities.related) ? ["related"] : []
|
|
3418
3477
|
];
|
|
3419
3478
|
const actionIds = service.config.writeEnabled ? [
|
|
3420
|
-
"manage-spaces",
|
|
3421
|
-
...canRemember ? ["remember"] : [],
|
|
3479
|
+
...providerReady ? ["manage-spaces"] : [],
|
|
3480
|
+
...canRemember && providerReady ? ["remember"] : [],
|
|
3422
3481
|
...active.some((body) => body.provider.capabilities.link) ? ["link"] : [],
|
|
3423
3482
|
...active.some((body) => body.provider.capabilities.forget) ? ["forget"] : []
|
|
3424
3483
|
] : [];
|
|
@@ -3439,7 +3498,8 @@ function createMemorySpacesSource(providerSnapshot, config = {}) {
|
|
|
3439
3498
|
actionIds,
|
|
3440
3499
|
hints: {
|
|
3441
3500
|
activeCount: active.length,
|
|
3442
|
-
providerCount: new Set(active.map((body) => body.provider.id)).size
|
|
3501
|
+
providerCount: new Set(active.map((body) => body.provider.id)).size,
|
|
3502
|
+
archivableCount: active.filter((body) => body.provider.capabilities.remember && body.provider.capabilities.forget && body.provider.capabilities.writeMode === "exact").length
|
|
3443
3503
|
}
|
|
3444
3504
|
};
|
|
3445
3505
|
},
|
|
@@ -3523,10 +3583,8 @@ function createMemorySpacesSource(providerSnapshot, config = {}) {
|
|
|
3523
3583
|
if (request.route.sourceRouteId === "related") {
|
|
3524
3584
|
const id = memoryInputText(input.id, "id", 2e3);
|
|
3525
3585
|
const requestedSpace = memoryInputText(input.memoryBodyId, "memoryBodyId", 300, false);
|
|
3526
|
-
const
|
|
3527
|
-
|
|
3528
|
-
const owner = requestedSpace === void 0 ? owners.length === 1 ? owners[0] : void 0 : admitted?.get(requestedSpace + "/" + id);
|
|
3529
|
-
if (owner === void 0) throw new Error("related-memory traversal requires evidence already admitted by this View");
|
|
3586
|
+
const owner = await ownerOf(request.view.id, id, requestedSpace, allowedBodies, request.signal);
|
|
3587
|
+
if (owner === void 0) throw new Error("related-memory traversal requires evidence already admitted by this View, or an id found in a Memory Space it can read");
|
|
3530
3588
|
if (!allowedBodies.includes(owner)) throw new Error("related-memory owner is outside this View ReadGrant");
|
|
3531
3589
|
const edge = memoryInputText(input.edge, "edge", 30, false);
|
|
3532
3590
|
if (edge !== void 0 && !EDGES.has(edge)) throw new Error(`unsupported edge: ${edge}`);
|
|
@@ -3543,13 +3601,7 @@ function createMemorySpacesSource(providerSnapshot, config = {}) {
|
|
|
3543
3601
|
const allowedBodies = grantIds(grant);
|
|
3544
3602
|
const created = createdByView.get(request.view.id) ?? /* @__PURE__ */ new Set();
|
|
3545
3603
|
const writableBodies = writeBodies(request.view.id, grant);
|
|
3546
|
-
const admittedOwner = (id) =>
|
|
3547
|
-
const requestedSpace = memoryInputText(input.memoryBodyId, "memoryBodyId", 300, false);
|
|
3548
|
-
const entries = admittedByView.get(request.view.id);
|
|
3549
|
-
if (requestedSpace !== void 0) return entries?.get(requestedSpace + "/" + id);
|
|
3550
|
-
const owners = [...entries?.entries() ?? []].filter(([reference]) => reference.endsWith("/" + id)).map(([, owner]) => owner);
|
|
3551
|
-
return owners.length === 1 ? owners[0] : void 0;
|
|
3552
|
-
};
|
|
3604
|
+
const admittedOwner = (id) => ownerOf(request.view.id, id, memoryInputText(input.memoryBodyId, "memoryBodyId", 300, false), allowedBodies, request.signal);
|
|
3553
3605
|
let result;
|
|
3554
3606
|
let bodyId;
|
|
3555
3607
|
if (request.offer.sourceActionId === "manage-spaces") {
|
|
@@ -3616,9 +3668,9 @@ function createMemorySpacesSource(providerSnapshot, config = {}) {
|
|
|
3616
3668
|
} else if (request.offer.sourceActionId === "link") {
|
|
3617
3669
|
const sourceId = memoryInputText(input.sourceId, "sourceId", 2e3);
|
|
3618
3670
|
const targetId = memoryInputText(input.targetId, "targetId", 2e3);
|
|
3619
|
-
const sourceSpace = admittedOwner(sourceId);
|
|
3620
|
-
const targetSpace = admittedOwner(targetId);
|
|
3621
|
-
if (sourceSpace === void 0 || targetSpace === void 0 || sourceSpace !== targetSpace || !allowedBodies.includes(sourceSpace)) throw new Error("link requires two evidence items admitted by this View from the same Memory Space");
|
|
3671
|
+
const sourceSpace = await admittedOwner(sourceId);
|
|
3672
|
+
const targetSpace = await admittedOwner(targetId);
|
|
3673
|
+
if (sourceSpace === void 0 || targetSpace === void 0 || sourceSpace !== targetSpace || !allowedBodies.includes(sourceSpace)) throw new Error("link requires two evidence items admitted by this View from the same Memory Space, or two ids found in one Memory Space it can read");
|
|
3622
3674
|
bodyId = sourceSpace;
|
|
3623
3675
|
const edge = memoryInputText(input.type, "type", 30, false);
|
|
3624
3676
|
if (edge !== void 0 && !EDGES.has(edge)) throw new Error(`unsupported edge: ${edge}`);
|
|
@@ -3626,8 +3678,8 @@ function createMemorySpacesSource(providerSnapshot, config = {}) {
|
|
|
3626
3678
|
result = await service.link(sourceId, targetId, edge, weight, memoryInputText(input.reason, "reason", 1e3, false), request.signal, bodyId);
|
|
3627
3679
|
} else if (request.offer.sourceActionId === "forget") {
|
|
3628
3680
|
const id = memoryInputText(input.id, "id", 2e3);
|
|
3629
|
-
bodyId = admittedOwner(id);
|
|
3630
|
-
if (bodyId === void 0 || !allowedBodies.includes(bodyId)) throw new Error("forget requires evidence already admitted by this View");
|
|
3681
|
+
bodyId = await admittedOwner(id);
|
|
3682
|
+
if (bodyId === void 0 || !allowedBodies.includes(bodyId)) throw new Error("forget requires evidence already admitted by this View, or an id found in one Memory Space it can read; name the space (memoryBodyId) when several hold it");
|
|
3631
3683
|
result = await service.forget(id, request.signal, bodyId);
|
|
3632
3684
|
} else throw new Error(`unsupported Memory Spaces action: ${request.offer.sourceActionId}`);
|
|
3633
3685
|
return createMemoryMutationReceipt(request.view.id, request.offer.id, context.sourceInstanceKey, service.memoryRevision(), {
|
package/lib/provider-sdk.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CATEGORIES, Category, EDGE_TYPES, EdgeType, INTENTS, Insight, Intent, JsonValue, MemoryBody, MemoryBodyProvider, MemoryBodyStats, MemoryGraphEdge, MemoryGraphNode, MemoryGraphSnapshot, MemoryListRequest, MemoryProviderCapabilities, MemoryProviderConfigField, MemoryProviderConfigOption, MemoryProviderConnection, MemoryProviderConnectionValue, MemoryProviderDescriptor, MemoryProviderIcon, MemoryProviderId, MemorySpace, MemorySpaceProvider, MemorySpaceStats, OpenVikingBodyConnection, OpenVikingSpaceConnection, RememberRequest, SOURCES, SearchRequest, Source } from "./contracts.js";
|
|
2
|
-
import { C as ProviderSearchResult, S as ProviderScoreSemantics, _ as MemorySpaceNativeRunner, a as MemorySpaceProviderHost, b as ProviderEntityIndex, c as MemorySpaceProviderRuntimeContext, d as defineMemorySpaceProviderDefinition, f as MemoryProviderAdapter, g as MemorySpaceNativeRunOptions, h as MemorySpaceAuthority, i as MemorySpaceProviderEntry, l as MemorySpaceProviderScoreSemantics, m as MemoryProviderScoreSemantics, n as MemorySpaceProviderDefinition, o as MemorySpaceProviderManifest, p as MemoryProviderAdapterFactoryContext, r as MemorySpaceProviderDisposer, s as MemorySpaceProviderModule, t as MEMORY_SPACE_PROVIDER_API_VERSION, u as defineMemorySpaceProvider, v as NORMALIZED_RELEVANCE_SCORE, w as ProviderSpaceStatus, x as ProviderMemorySpace, y as ProviderBodyStatus } from "./definitions-
|
|
2
|
+
import { C as ProviderSearchResult, S as ProviderScoreSemantics, _ as MemorySpaceNativeRunner, a as MemorySpaceProviderHost, b as ProviderEntityIndex, c as MemorySpaceProviderRuntimeContext, d as defineMemorySpaceProviderDefinition, f as MemoryProviderAdapter, g as MemorySpaceNativeRunOptions, h as MemorySpaceAuthority, i as MemorySpaceProviderEntry, l as MemorySpaceProviderScoreSemantics, m as MemoryProviderScoreSemantics, n as MemorySpaceProviderDefinition, o as MemorySpaceProviderManifest, p as MemoryProviderAdapterFactoryContext, r as MemorySpaceProviderDisposer, s as MemorySpaceProviderModule, t as MEMORY_SPACE_PROVIDER_API_VERSION, u as defineMemorySpaceProvider, v as NORMALIZED_RELEVANCE_SCORE, w as ProviderSpaceStatus, x as ProviderMemorySpace, y as ProviderBodyStatus } from "./definitions-CtjNSwBS.js";
|
|
3
3
|
//#region src/providers/http.d.ts
|
|
4
4
|
interface HttpProviderOptions {
|
|
5
5
|
label?: string;
|
package/lib/testing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MemoryProviderConnection, MemoryProviderDescriptor, MemorySpace } from "./contracts.js";
|
|
2
|
-
import { f as MemoryProviderAdapter, h as MemorySpaceAuthority, o as MemorySpaceProviderManifest, p as MemoryProviderAdapterFactoryContext, s as MemorySpaceProviderModule } from "./definitions-
|
|
2
|
+
import { f as MemoryProviderAdapter, h as MemorySpaceAuthority, o as MemorySpaceProviderManifest, p as MemoryProviderAdapterFactoryContext, s as MemorySpaceProviderModule } from "./definitions-CtjNSwBS.js";
|
|
3
3
|
//#region src/testing.d.ts
|
|
4
4
|
interface MemorySpaceProviderTest {
|
|
5
5
|
readonly registered: boolean;
|
package/lib/types/contracts.d.ts
CHANGED
|
@@ -278,6 +278,13 @@ export interface SearchRequest {
|
|
|
278
278
|
source?: Source;
|
|
279
279
|
intent?: Intent;
|
|
280
280
|
memoryBodyIds?: string[];
|
|
281
|
+
/**
|
|
282
|
+
* A look at the memory rather than a use of it, such as the Memory System's
|
|
283
|
+
* own searches. Providers that record reads, as access counts or a query
|
|
284
|
+
* log, leave it out, and may answer from a snapshot that lags a write still
|
|
285
|
+
* in flight; a check that must see a write leaves the flag unset.
|
|
286
|
+
*/
|
|
287
|
+
inspect?: boolean;
|
|
281
288
|
}
|
|
282
289
|
export interface RememberRequest {
|
|
283
290
|
content: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mnemon-source-memory-spaces",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.17",
|
|
4
4
|
"description": "Memory Spaces Source and its private Provider SDK.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -65,13 +65,13 @@
|
|
|
65
65
|
"@types/node": "^22.0.0",
|
|
66
66
|
"@types/react": "^18.3.0",
|
|
67
67
|
"@types/react-dom": "^18.3.0",
|
|
68
|
-
"dsh-mnemon": "^0.5.
|
|
68
|
+
"dsh-mnemon": "^0.5.25",
|
|
69
69
|
"dsh-mnemon-provider-byterover": "^0.5.5",
|
|
70
70
|
"dsh-mnemon-provider-hindsight": "^0.5.5",
|
|
71
71
|
"dsh-mnemon-provider-holographic": "^0.5.6",
|
|
72
72
|
"dsh-mnemon-provider-honcho": "^0.5.5",
|
|
73
73
|
"dsh-mnemon-provider-mem0": "^0.5.5",
|
|
74
|
-
"dsh-mnemon-provider-mnemon-native": "^0.5.
|
|
74
|
+
"dsh-mnemon-provider-mnemon-native": "^0.5.9",
|
|
75
75
|
"dsh-mnemon-provider-openviking": "^0.5.7",
|
|
76
76
|
"dsh-mnemon-provider-retaindb": "^0.5.5",
|
|
77
77
|
"dsh-mnemon-provider-supermemory": "^0.5.5",
|