dsh-mnemon-source-memory-spaces 0.5.13 → 0.5.15
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/{definitions-C5y84OE6.d.ts → definitions-DwiEZSE_.d.ts} +14 -9
- package/lib/index.d.ts +1 -1
- package/lib/index.js +80 -34
- package/lib/{process-BvrgxPNP.js → process-DIK9NnTg.js} +14 -6
- package/lib/provider-sdk.d.ts +9 -2
- package/lib/provider-sdk.js +2 -2
- package/lib/testing.d.ts +1 -1
- package/package.json +4 -4
|
@@ -9,16 +9,21 @@ interface MemorySpaceAuthority {
|
|
|
9
9
|
list(): MemorySpace[];
|
|
10
10
|
providerConnection(id: string, expectedProviderId?: string): MemoryProviderConnection;
|
|
11
11
|
}
|
|
12
|
+
/** Per-call options of the Native command transport. */
|
|
13
|
+
interface MemorySpaceNativeRunOptions {
|
|
14
|
+
signal?: AbortSignal;
|
|
15
|
+
store?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Output cap for this call, in bytes (default 2 MiB). Raise it only for reads
|
|
18
|
+
* whose size the Store itself bounds, such as a whole-Store dump; Source
|
|
19
|
+
* hosts older than 0.5.14 ignore it and keep the default.
|
|
20
|
+
*/
|
|
21
|
+
maxOutputBytes?: number;
|
|
22
|
+
}
|
|
12
23
|
/** Scoped command transport consumed by the Native Provider. */
|
|
13
24
|
interface MemorySpaceNativeRunner {
|
|
14
|
-
runJson(args: readonly string[], options?:
|
|
15
|
-
|
|
16
|
-
store?: string;
|
|
17
|
-
}): Promise<JsonValue>;
|
|
18
|
-
runText(args: readonly string[], options?: {
|
|
19
|
-
signal?: AbortSignal;
|
|
20
|
-
store?: string;
|
|
21
|
-
}): Promise<string>;
|
|
25
|
+
runJson(args: readonly string[], options?: MemorySpaceNativeRunOptions): Promise<JsonValue>;
|
|
26
|
+
runText(args: readonly string[], options?: MemorySpaceNativeRunOptions): Promise<string>;
|
|
22
27
|
}
|
|
23
28
|
interface MemoryProviderAdapterFactoryContext {
|
|
24
29
|
/** Canonical name; optional while older Source hosts remain supported. */
|
|
@@ -137,4 +142,4 @@ interface MemorySpaceProviderEntry<Config = unknown> {
|
|
|
137
142
|
declare function defineMemorySpaceProvider<Config>(module: MemorySpaceProviderModule<Config>): MemorySpaceProviderModule<Config>;
|
|
138
143
|
declare function defineMemorySpaceProviderDefinition(definition: MemorySpaceProviderDefinition): MemorySpaceProviderDefinition;
|
|
139
144
|
//#endregion
|
|
140
|
-
export { ProviderSpaceStatus as S,
|
|
145
|
+
export { ProviderSpaceStatus as C, ProviderSearchResult as S, MemorySpaceNativeRunner as _, MemorySpaceProviderHost as a, ProviderMemorySpace as b, MemorySpaceProviderRuntimeContext as c, defineMemorySpaceProviderDefinition as d, MemoryProviderAdapter as f, MemorySpaceNativeRunOptions as g, MemorySpaceAuthority as h, MemorySpaceProviderEntry as i, MemorySpaceProviderScoreSemantics as l, MemoryProviderScoreSemantics as m, MemorySpaceProviderDefinition as n, MemorySpaceProviderManifest as o, MemoryProviderAdapterFactoryContext as p, MemorySpaceProviderDisposer as r, MemorySpaceProviderModule as s, MEMORY_SPACE_PROVIDER_API_VERSION as t, defineMemorySpaceProvider as u, NORMALIZED_RELEVANCE_SCORE as v, ProviderScoreSemantics as x, ProviderBodyStatus as y };
|
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, 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 } from "./contracts.js";
|
|
2
|
-
import { i as MemorySpaceProviderEntry } from "./definitions-
|
|
2
|
+
import { i as MemorySpaceProviderEntry } from "./definitions-DwiEZSE_.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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { findMnemonCommand, isMnemonExecutable, resolveMnemonInvocation } from "./native-cli.js";
|
|
2
2
|
import { CATEGORIES as CATEGORIES$1, EDGE_TYPES, INTENTS as INTENTS$1, MNEMON_EMBEDDING_PROTOCOLS, SOURCES as SOURCES$1 } from "./contracts.js";
|
|
3
3
|
import { a as MemoryProviderCatalog, i as EMPTY_MEMORY_PROVIDER_CATALOG, n as PrivateMemorySpaceProviderHost, r as MemoryProviderAdapterRegistry, t as createMemorySpaceProviderPlugin } from "./plugin-DlsNeZbQ.js";
|
|
4
|
-
import {
|
|
4
|
+
import { n as ProcessError, r as runProcess } from "./process-DIK9NnTg.js";
|
|
5
5
|
import { r as defineMemorySpaceProvider } from "./definitions-DfmOqJjR.js";
|
|
6
6
|
import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { homedir, tmpdir } from "node:os";
|
|
@@ -348,6 +348,8 @@ var MemorySpaceRegistry = class MemorySpaceRegistry {
|
|
|
348
348
|
let normalizedService = this.providerCatalog.normalizeService(providerId, service);
|
|
349
349
|
const seen = /* @__PURE__ */ new Set();
|
|
350
350
|
const existing = this.spaces.filter((body) => body.providerId === providerId);
|
|
351
|
+
const existingByExternalId = /* @__PURE__ */ new Map();
|
|
352
|
+
for (const body of existing) if (!existingByExternalId.has(body.externalId)) existingByExternalId.set(body.externalId, body);
|
|
351
353
|
const reservedIds = new Set(this.spaces.filter((body) => body.providerId !== providerId).map((body) => body.id));
|
|
352
354
|
const timestamp = this.now().toISOString();
|
|
353
355
|
const projections = discovered.map((candidate) => {
|
|
@@ -359,7 +361,7 @@ var MemorySpaceRegistry = class MemorySpaceRegistry {
|
|
|
359
361
|
...normalizedService,
|
|
360
362
|
...connection
|
|
361
363
|
});
|
|
362
|
-
const previous =
|
|
364
|
+
const previous = existingByExternalId.get(externalId);
|
|
363
365
|
let id = previous?.id ?? validateMemorySpaceId(`${providerId}-${createHash("sha256").update(externalId).digest("hex").slice(0, 24)}`);
|
|
364
366
|
let suffix = 1;
|
|
365
367
|
while (reservedIds.has(id)) {
|
|
@@ -756,9 +758,10 @@ var MemorySpaceRegistry = class MemorySpaceRegistry {
|
|
|
756
758
|
const timestamp = this.now().toISOString();
|
|
757
759
|
const legacyActive = this.runner.effectiveStore();
|
|
758
760
|
let changed = false;
|
|
761
|
+
const knownIds = new Set(this.spaces.map((body) => body.id));
|
|
759
762
|
for (const entry of readdirSync(this.directory, { withFileTypes: true })) {
|
|
760
763
|
if (!entry.isDirectory() || !ID_PATTERN.test(entry.name) || !existsSync(join(this.directory, entry.name, "mnemon.db"))) continue;
|
|
761
|
-
if (
|
|
764
|
+
if (knownIds.has(entry.name)) continue;
|
|
762
765
|
this.spaces.push({
|
|
763
766
|
id: entry.name,
|
|
764
767
|
name: entry.name,
|
|
@@ -768,6 +771,7 @@ var MemorySpaceRegistry = class MemorySpaceRegistry {
|
|
|
768
771
|
createdAt: timestamp,
|
|
769
772
|
updatedAt: timestamp
|
|
770
773
|
});
|
|
774
|
+
knownIds.add(entry.name);
|
|
771
775
|
changed = true;
|
|
772
776
|
}
|
|
773
777
|
if (changed) this.save();
|
|
@@ -1797,22 +1801,36 @@ var MemorySpacesService = class {
|
|
|
1797
1801
|
}
|
|
1798
1802
|
const { hints, quality } = evaluation;
|
|
1799
1803
|
const selected = recoveryPlan === void 0 ? quality.selected : prioritizeRecoveryEvidence(quality.selected, recoveryPlan);
|
|
1800
|
-
const qualityStats = (
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1804
|
+
const qualityStats = /* @__PURE__ */ new Map();
|
|
1805
|
+
for (const { body } of batches) qualityStats.set(body.id, {
|
|
1806
|
+
policyId: quality.policyId,
|
|
1807
|
+
...quality.fallbackFrom === void 0 ? {} : { fallbackFrom: quality.fallbackFrom },
|
|
1808
|
+
fetched: 0,
|
|
1809
|
+
retained: 0,
|
|
1810
|
+
selected: 0,
|
|
1811
|
+
droppedLowScore: 0,
|
|
1812
|
+
droppedNonPositiveScore: 0,
|
|
1813
|
+
droppedInvalidScore: 0,
|
|
1814
|
+
unscored: 0,
|
|
1815
|
+
unscaled: 0
|
|
1816
|
+
});
|
|
1817
|
+
for (const { candidate, decision } of quality.evaluated) {
|
|
1818
|
+
const stats = qualityStats.get(candidate.memoryBodyId);
|
|
1819
|
+
if (stats === void 0) continue;
|
|
1820
|
+
stats.fetched += 1;
|
|
1821
|
+
if (decision.action === "keep") stats.retained += 1;
|
|
1822
|
+
if (decision.action === "drop") {
|
|
1823
|
+
if (decision.reason === "low-score") stats.droppedLowScore += 1;
|
|
1824
|
+
if (decision.reason === "non-positive-score") stats.droppedNonPositiveScore += 1;
|
|
1825
|
+
if (decision.reason === "invalid-score") stats.droppedInvalidScore += 1;
|
|
1826
|
+
}
|
|
1827
|
+
if (decision.reason === "unscored") stats.unscored += 1;
|
|
1828
|
+
if (decision.reason === "unscaled-score") stats.unscaled += 1;
|
|
1829
|
+
}
|
|
1830
|
+
for (const { candidate } of quality.selected) {
|
|
1831
|
+
const stats = qualityStats.get(candidate.memoryBodyId);
|
|
1832
|
+
if (stats !== void 0) stats.selected += 1;
|
|
1833
|
+
}
|
|
1816
1834
|
return {
|
|
1817
1835
|
query,
|
|
1818
1836
|
mode,
|
|
@@ -1822,7 +1840,7 @@ var MemorySpacesService = class {
|
|
|
1822
1840
|
...decision.normalizedScore === void 0 ? {} : { normalizedScore: decision.normalizedScore }
|
|
1823
1841
|
})),
|
|
1824
1842
|
sources: batches.map((batch) => {
|
|
1825
|
-
const stats = qualityStats(batch.body.id);
|
|
1843
|
+
const stats = qualityStats.get(batch.body.id);
|
|
1826
1844
|
if (batch.source.status === "unavailable" || batch.source.status === "unsupported") return {
|
|
1827
1845
|
...batch.source,
|
|
1828
1846
|
quality: stats
|
|
@@ -2044,13 +2062,21 @@ var MemorySpacesService = class {
|
|
|
2044
2062
|
*/
|
|
2045
2063
|
async rememberMany(requests, signal) {
|
|
2046
2064
|
this.assertWritable();
|
|
2047
|
-
const
|
|
2065
|
+
const destinations = /* @__PURE__ */ new Map();
|
|
2066
|
+
const prepared = requests.map((request) => this.prepareRemember(request, destinations));
|
|
2048
2067
|
const results = new Array(prepared.length);
|
|
2049
2068
|
const groups = /* @__PURE__ */ new Map();
|
|
2050
|
-
for (const [index, entry] of prepared.entries())
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2069
|
+
for (const [index, entry] of prepared.entries()) {
|
|
2070
|
+
const group = groups.get(entry.body.id);
|
|
2071
|
+
if (group === void 0) groups.set(entry.body.id, [{
|
|
2072
|
+
...entry,
|
|
2073
|
+
index
|
|
2074
|
+
}]);
|
|
2075
|
+
else group.push({
|
|
2076
|
+
...entry,
|
|
2077
|
+
index
|
|
2078
|
+
});
|
|
2079
|
+
}
|
|
2054
2080
|
for (const group of groups.values()) {
|
|
2055
2081
|
const body = group[0].body;
|
|
2056
2082
|
const provider = this.providerFor(body);
|
|
@@ -2066,8 +2092,9 @@ var MemorySpacesService = class {
|
|
|
2066
2092
|
providerChanged ||= mutationResultCommitted(result);
|
|
2067
2093
|
}
|
|
2068
2094
|
}
|
|
2095
|
+
const batched = new Set(batch);
|
|
2069
2096
|
for (const entry of group) {
|
|
2070
|
-
if (
|
|
2097
|
+
if (batched.has(entry)) continue;
|
|
2071
2098
|
const result = await provider.remember(body, entry.request, signal);
|
|
2072
2099
|
results[entry.index] = this.annotateResult(result, body);
|
|
2073
2100
|
providerChanged ||= mutationResultCommitted(result);
|
|
@@ -2273,10 +2300,14 @@ var MemorySpacesService = class {
|
|
|
2273
2300
|
return provider;
|
|
2274
2301
|
}
|
|
2275
2302
|
readSpaces(ids) {
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2303
|
+
if (ids === void 0 || ids.length === 0) return this.memorySpaces.active();
|
|
2304
|
+
const requested = [...new Set(ids.map((id) => id.trim()).filter((id) => id !== ""))];
|
|
2305
|
+
const available = /* @__PURE__ */ new Map();
|
|
2306
|
+
for (const body of this.memorySpaces.list()) if (!available.has(body.id)) available.set(body.id, body);
|
|
2307
|
+
return requested.map((id) => {
|
|
2308
|
+
const normalized = validateMemorySpaceId(id);
|
|
2309
|
+
const body = available.get(normalized);
|
|
2310
|
+
if (body === void 0) throw new Error(`unknown memory space: ${normalized}`);
|
|
2280
2311
|
if (!body.active) throw new Error(`memory space is not active for reading: ${id}`);
|
|
2281
2312
|
if (!this.isNativeSpace(body) && !this.memorySpaces.providerServiceEnabled(body.provider.id)) throw new Error(`${body.provider.label} is disabled on the dsh-mnemon page under Plugins`);
|
|
2282
2313
|
return body;
|
|
@@ -2303,8 +2334,10 @@ var MemorySpacesService = class {
|
|
|
2303
2334
|
if (active.length !== 1) throw new Error("memoryBodyId is required when the number of active memory spaces is not exactly one");
|
|
2304
2335
|
return active[0];
|
|
2305
2336
|
}
|
|
2306
|
-
prepareRemember(request) {
|
|
2307
|
-
const
|
|
2337
|
+
prepareRemember(request, destinations) {
|
|
2338
|
+
const key = request.memoryBodyId?.trim() ?? "";
|
|
2339
|
+
const body = destinations?.get(key) ?? this.writeSpace(request.memoryBodyId);
|
|
2340
|
+
destinations?.set(key, body);
|
|
2308
2341
|
const content = required(request.content, "content", 8192);
|
|
2309
2342
|
const importance = memoryInputInteger(request.importance, 3, 1, 5);
|
|
2310
2343
|
const category = allowed(request.category, CATEGORIES$1, "category") ?? "general";
|
|
@@ -2367,6 +2400,18 @@ const EMBEDDING_ENVIRONMENT_KEYS = /* @__PURE__ */ new Set([
|
|
|
2367
2400
|
"MNEMON_EMBED_API_KEY",
|
|
2368
2401
|
"MNEMON_EMBED_PROTOCOL"
|
|
2369
2402
|
]);
|
|
2403
|
+
/**
|
|
2404
|
+
* Explain a CLI call that produced no result. Only a failed launch means the
|
|
2405
|
+
* executable is missing or unusable, so only that case carries the install
|
|
2406
|
+
* hint; a timeout, a cancellation or an oversized output names its own cause.
|
|
2407
|
+
*/
|
|
2408
|
+
function processFailureMessage(error, args) {
|
|
2409
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
2410
|
+
const reason = error instanceof ProcessError ? error.reason : "launch";
|
|
2411
|
+
if (reason === "output-limit") return `mnemon ${args.find((arg) => !arg.startsWith("-")) ?? "command"} stopped: ${detail.replace(/^mnemon /u, "")}`;
|
|
2412
|
+
if (reason !== "launch") return detail;
|
|
2413
|
+
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."}`;
|
|
2414
|
+
}
|
|
2370
2415
|
/** Preserve the Host environment while making saved embedding overrides authoritative. */
|
|
2371
2416
|
function processEnvironment(config) {
|
|
2372
2417
|
if (!config.embedding.enabled) return void 0;
|
|
@@ -2402,7 +2447,8 @@ function createRunner(config, processRunner = runProcess) {
|
|
|
2402
2447
|
const processOptions = {
|
|
2403
2448
|
timeoutMs: config.timeoutMs,
|
|
2404
2449
|
...environment === void 0 ? {} : { env: environment },
|
|
2405
|
-
...options.signal === void 0 ? {} : { signal: options.signal }
|
|
2450
|
+
...options.signal === void 0 ? {} : { signal: options.signal },
|
|
2451
|
+
...options.maxOutputBytes === void 0 ? {} : { maxOutputBytes: options.maxOutputBytes }
|
|
2406
2452
|
};
|
|
2407
2453
|
let result;
|
|
2408
2454
|
try {
|
|
@@ -2412,7 +2458,7 @@ function createRunner(config, processRunner = runProcess) {
|
|
|
2412
2458
|
...invocation.env === void 0 ? {} : { env: invocation.env }
|
|
2413
2459
|
});
|
|
2414
2460
|
} catch (error) {
|
|
2415
|
-
throw new MnemonCliError(
|
|
2461
|
+
throw new MnemonCliError(processFailureMessage(error, args));
|
|
2416
2462
|
}
|
|
2417
2463
|
if (result.exitCode !== 0) {
|
|
2418
2464
|
const detail = result.stderr.trim() || result.stdout.trim() || "no output";
|
|
@@ -4,6 +4,14 @@ import { StringDecoder } from "node:string_decoder";
|
|
|
4
4
|
const NORMALIZED_RELEVANCE_SCORE = Object.freeze({ kind: "normalized-relevance" });
|
|
5
5
|
//#endregion
|
|
6
6
|
//#region src/providers/process.ts
|
|
7
|
+
var ProcessError = class extends Error {
|
|
8
|
+
reason;
|
|
9
|
+
constructor(message, reason) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.reason = reason;
|
|
12
|
+
this.name = "ProcessError";
|
|
13
|
+
}
|
|
14
|
+
};
|
|
7
15
|
const DEFAULT_MAX_OUTPUT_BYTES = 2097152;
|
|
8
16
|
/** Spawn without a shell, with bounded output and cooperative cancellation. */
|
|
9
17
|
const runProcess = (command, args, options) => new Promise((resolve, reject) => {
|
|
@@ -19,7 +27,7 @@ const runProcess = (command, args, options) => new Promise((resolve, reject) =>
|
|
|
19
27
|
...options.cwd === void 0 ? {} : { cwd: options.cwd },
|
|
20
28
|
...options.env === void 0 ? {} : { env: options.env }
|
|
21
29
|
});
|
|
22
|
-
const maxOutputBytes = options.maxOutputBytes ??
|
|
30
|
+
const maxOutputBytes = options.maxOutputBytes ?? 2097152;
|
|
23
31
|
let stdout = "";
|
|
24
32
|
let stderr = "";
|
|
25
33
|
const stdoutDecoder = new StringDecoder("utf8");
|
|
@@ -45,13 +53,13 @@ const runProcess = (command, args, options) => new Promise((resolve, reject) =>
|
|
|
45
53
|
};
|
|
46
54
|
const abort = () => {
|
|
47
55
|
stop();
|
|
48
|
-
finish(
|
|
56
|
+
finish(new ProcessError(`${label} command aborted: ${String(options.signal?.reason ?? "cancelled")}`, "aborted"));
|
|
49
57
|
};
|
|
50
58
|
const append = (target, chunk) => {
|
|
51
59
|
outputBytes += chunk.byteLength;
|
|
52
60
|
if (outputBytes > maxOutputBytes) {
|
|
53
61
|
stop();
|
|
54
|
-
finish(
|
|
62
|
+
finish(new ProcessError(`${label} output exceeded ${maxOutputBytes} bytes`, "output-limit"));
|
|
55
63
|
return;
|
|
56
64
|
}
|
|
57
65
|
if (target === "stdout") stdout += stdoutDecoder.write(chunk);
|
|
@@ -64,7 +72,7 @@ const runProcess = (command, args, options) => new Promise((resolve, reject) =>
|
|
|
64
72
|
append("stderr", chunk);
|
|
65
73
|
});
|
|
66
74
|
child.on("error", (error) => {
|
|
67
|
-
finish(
|
|
75
|
+
finish(new ProcessError(`failed to launch ${label} (${JSON.stringify(command)}): ${error.message}`, "launch"));
|
|
68
76
|
});
|
|
69
77
|
child.on("close", (exitCode) => {
|
|
70
78
|
stdout += stdoutDecoder.end();
|
|
@@ -77,10 +85,10 @@ const runProcess = (command, args, options) => new Promise((resolve, reject) =>
|
|
|
77
85
|
});
|
|
78
86
|
const timeout = setTimeout(() => {
|
|
79
87
|
stop();
|
|
80
|
-
finish(
|
|
88
|
+
finish(new ProcessError(`${label} did not respond within ${options.timeoutMs}ms`, "timeout"));
|
|
81
89
|
}, options.timeoutMs);
|
|
82
90
|
if (options.signal?.aborted === true) abort();
|
|
83
91
|
else options.signal?.addEventListener("abort", abort, { once: true });
|
|
84
92
|
});
|
|
85
93
|
//#endregion
|
|
86
|
-
export { NORMALIZED_RELEVANCE_SCORE as n, runProcess as t };
|
|
94
|
+
export { NORMALIZED_RELEVANCE_SCORE as i, ProcessError as n, runProcess as r, DEFAULT_MAX_OUTPUT_BYTES as t };
|
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 {
|
|
2
|
+
import { C as ProviderSpaceStatus, S as ProviderSearchResult, _ as MemorySpaceNativeRunner, a as MemorySpaceProviderHost, b as ProviderMemorySpace, 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, x as ProviderScoreSemantics, y as ProviderBodyStatus } from "./definitions-DwiEZSE_.js";
|
|
3
3
|
//#region src/providers/http.d.ts
|
|
4
4
|
interface HttpProviderOptions {
|
|
5
5
|
label?: string;
|
|
@@ -50,7 +50,14 @@ interface ProcessOptions {
|
|
|
50
50
|
label?: string | undefined;
|
|
51
51
|
}
|
|
52
52
|
type ProcessRunner = (command: string, args: readonly string[], options: ProcessOptions) => Promise<ProcessResult>;
|
|
53
|
+
/** Why a process did not produce a result, so callers can explain each case differently. */
|
|
54
|
+
type ProcessFailureReason = 'launch' | 'timeout' | 'aborted' | 'output-limit';
|
|
55
|
+
declare class ProcessError extends Error {
|
|
56
|
+
readonly reason: ProcessFailureReason;
|
|
57
|
+
constructor(message: string, reason: ProcessFailureReason);
|
|
58
|
+
}
|
|
59
|
+
declare const DEFAULT_MAX_OUTPUT_BYTES: number;
|
|
53
60
|
/** Spawn without a shell, with bounded output and cooperative cancellation. */
|
|
54
61
|
declare const runProcess: ProcessRunner;
|
|
55
62
|
//#endregion
|
|
56
|
-
export { CATEGORIES, type Category, EDGE_TYPES, type EdgeType, HttpMemoryProvider, HttpProviderOptions, INTENTS, type Insight, type Intent, JsonRequestOptions, type JsonValue, MEMORY_SPACE_PROVIDER_API_VERSION, type MemoryBody, type MemoryBodyProvider, type MemoryBodyStats, type MemoryGraphEdge, type MemoryGraphNode, type MemoryGraphSnapshot, type MemoryListRequest, MemoryProviderAdapter, MemoryProviderAdapterFactoryContext, type MemoryProviderCapabilities, type MemoryProviderConfigField, type MemoryProviderConfigOption, type MemoryProviderConnection, type MemoryProviderConnectionValue, type MemoryProviderDescriptor, type MemoryProviderIcon, type MemoryProviderId, MemoryProviderScoreSemantics, type MemorySpace, MemorySpaceAuthority, MemorySpaceNativeRunner, type MemorySpaceProvider, type MemorySpaceProviderDefinition, type MemorySpaceProviderDisposer, type MemorySpaceProviderEntry, type MemorySpaceProviderHost, type MemorySpaceProviderManifest, type MemorySpaceProviderModule, type MemorySpaceProviderRuntimeContext, type MemorySpaceProviderScoreSemantics, type MemorySpaceStats, NORMALIZED_RELEVANCE_SCORE, type OpenVikingBodyConnection, type OpenVikingSpaceConnection, ProcessOptions, ProcessResult, ProcessRunner, ProviderBodyStatus, ProviderMemorySpace, ProviderScoreSemantics, ProviderSearchResult, ProviderSpaceStatus, type RememberRequest, SOURCES, type SearchRequest, type Source, defineMemorySpaceProvider, defineMemorySpaceProviderDefinition, firstArray, jsonArray, jsonNumber, jsonObject, jsonString, runProcess };
|
|
63
|
+
export { CATEGORIES, type Category, DEFAULT_MAX_OUTPUT_BYTES, EDGE_TYPES, type EdgeType, HttpMemoryProvider, HttpProviderOptions, INTENTS, type Insight, type Intent, JsonRequestOptions, type JsonValue, MEMORY_SPACE_PROVIDER_API_VERSION, type MemoryBody, type MemoryBodyProvider, type MemoryBodyStats, type MemoryGraphEdge, type MemoryGraphNode, type MemoryGraphSnapshot, type MemoryListRequest, MemoryProviderAdapter, MemoryProviderAdapterFactoryContext, type MemoryProviderCapabilities, type MemoryProviderConfigField, type MemoryProviderConfigOption, type MemoryProviderConnection, type MemoryProviderConnectionValue, type MemoryProviderDescriptor, type MemoryProviderIcon, type MemoryProviderId, MemoryProviderScoreSemantics, type MemorySpace, MemorySpaceAuthority, MemorySpaceNativeRunOptions, MemorySpaceNativeRunner, type MemorySpaceProvider, type MemorySpaceProviderDefinition, type MemorySpaceProviderDisposer, type MemorySpaceProviderEntry, type MemorySpaceProviderHost, type MemorySpaceProviderManifest, type MemorySpaceProviderModule, type MemorySpaceProviderRuntimeContext, type MemorySpaceProviderScoreSemantics, type MemorySpaceStats, NORMALIZED_RELEVANCE_SCORE, type OpenVikingBodyConnection, type OpenVikingSpaceConnection, ProcessError, ProcessFailureReason, ProcessOptions, ProcessResult, ProcessRunner, ProviderBodyStatus, ProviderMemorySpace, ProviderScoreSemantics, ProviderSearchResult, ProviderSpaceStatus, type RememberRequest, SOURCES, type SearchRequest, type Source, defineMemorySpaceProvider, defineMemorySpaceProviderDefinition, firstArray, jsonArray, jsonNumber, jsonObject, jsonString, runProcess };
|
package/lib/provider-sdk.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CATEGORIES, EDGE_TYPES, INTENTS, SOURCES } from "./contracts.js";
|
|
2
|
-
import {
|
|
2
|
+
import { i as NORMALIZED_RELEVANCE_SCORE, n as ProcessError, r as runProcess, t as DEFAULT_MAX_OUTPUT_BYTES } from "./process-DIK9NnTg.js";
|
|
3
3
|
import { i as defineMemorySpaceProviderDefinition, r as defineMemorySpaceProvider, t as MEMORY_SPACE_PROVIDER_API_VERSION } from "./definitions-DfmOqJjR.js";
|
|
4
4
|
//#region src/providers/http.ts
|
|
5
5
|
function jsonObject(value) {
|
|
@@ -105,4 +105,4 @@ var HttpMemoryProvider = class {
|
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
107
|
//#endregion
|
|
108
|
-
export { CATEGORIES, EDGE_TYPES, HttpMemoryProvider, INTENTS, MEMORY_SPACE_PROVIDER_API_VERSION, NORMALIZED_RELEVANCE_SCORE, SOURCES, defineMemorySpaceProvider, defineMemorySpaceProviderDefinition, firstArray, jsonArray, jsonNumber, jsonObject, jsonString, runProcess };
|
|
108
|
+
export { CATEGORIES, DEFAULT_MAX_OUTPUT_BYTES, EDGE_TYPES, HttpMemoryProvider, INTENTS, MEMORY_SPACE_PROVIDER_API_VERSION, NORMALIZED_RELEVANCE_SCORE, ProcessError, SOURCES, defineMemorySpaceProvider, defineMemorySpaceProviderDefinition, firstArray, jsonArray, jsonNumber, jsonObject, jsonString, runProcess };
|
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-DwiEZSE_.js";
|
|
3
3
|
//#region src/testing.d.ts
|
|
4
4
|
interface MemorySpaceProviderTest {
|
|
5
5
|
readonly registered: boolean;
|
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.15",
|
|
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.23",
|
|
69
69
|
"dsh-mnemon-provider-byterover": "^0.5.5",
|
|
70
70
|
"dsh-mnemon-provider-hindsight": "^0.5.5",
|
|
71
|
-
"dsh-mnemon-provider-holographic": "^0.5.
|
|
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.8",
|
|
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",
|