dsh-mnemon-source-memory-spaces 0.5.9 → 0.5.11

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.
@@ -19,7 +19,7 @@ interface MemoryProviderConfigField {
19
19
  label: string;
20
20
  /** Optional Host-provided translation key; clients fall back to label. */
21
21
  i18nKey?: string;
22
- /** Service fields are configured once in Settings; memory fields belong to each Memory Space. */
22
+ /** Service fields are configured once on the dsh-mnemon page under Plugins; memory fields belong to each Memory Space. */
23
23
  scope: 'service' | 'memory';
24
24
  /** A reusable local data location presented with the same default/custom scope UI as Mnemon Native. */
25
25
  role?: 'global-location';
@@ -60,6 +60,8 @@ interface MemoryPersistenceStrategy {
60
60
  interface ResolvedMemoryPersistenceStrategy {
61
61
  mode: 'manual' | 'automatic';
62
62
  providerId: MemoryProviderId;
63
+ /** Set when no provider was chosen; manual mode then uses whichever provider is ready. */
64
+ providerDefaulted?: true;
63
65
  prompt: string;
64
66
  rules: {
65
67
  allowedProviderIds: MemoryProviderId[];
package/lib/index.d.ts CHANGED
@@ -1,6 +1,6 @@
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
2
  import { i as MemorySpaceProviderEntry } from "./definitions-C5y84OE6.js";
3
- import z from "schemastery";
3
+ import z from "@deepseek-ai/schemastery";
4
4
  import { Context } from "@deepseek-ai/cordis";
5
5
  //#region src/config.d.ts
6
6
  interface MemorySpacesConfig {
package/lib/index.js CHANGED
@@ -5,8 +5,8 @@ import { t as runProcess } from "./process-BvrgxPNP.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";
8
- import { basename, dirname, isAbsolute, join, resolve } from "node:path";
9
- import z from "schemastery";
8
+ import { basename, dirname, isAbsolute, join } from "node:path";
9
+ import z from "@deepseek-ai/schemastery";
10
10
  import { createMemoryMutationReceipt, defineMemoryPlugin, defineMemorySource, installMemory, memoryConfigurationDigest, memoryInputInteger, memoryInputRecord, memoryInputStringArray, memoryInputText, truncateMemoryText, withMemoryStorageLock } from "dsh-mnemon/extension-sdk";
11
11
  import { createHash, randomUUID } from "node:crypto";
12
12
  import { COMPOSABLE_MEMORY_API_VERSION } from "dsh-mnemon/contracts";
@@ -273,17 +273,6 @@ var MemorySpaceRegistry = class MemorySpaceRegistry {
273
273
  if (body === void 0) throw new Error(`unknown memory space: ${normalized}`);
274
274
  return body;
275
275
  }
276
- openVikingConnection(id) {
277
- const connection = this.providerConnection(id, "openviking");
278
- return {
279
- endpoint: String(connection.endpoint ?? ""),
280
- targetUri: String(connection.targetUri ?? ""),
281
- apiKey: String(connection.apiKey ?? ""),
282
- account: String(connection.account ?? ""),
283
- user: String(connection.user ?? ""),
284
- actorPeerId: String(connection.actorPeerId ?? "")
285
- };
286
- }
287
276
  providerConnection(id, expectedProviderId) {
288
277
  this.refreshIfChanged();
289
278
  const normalized = validateMemorySpaceId(id);
@@ -308,6 +297,15 @@ var MemorySpaceRegistry = class MemorySpaceRegistry {
308
297
  providerServiceEnabled(providerId) {
309
298
  return this.isNative(providerId) ? this.runner.commandFound : this.providerServiceConfigured(providerId) && this.serviceEnabled[providerId] === true;
310
299
  }
300
+ /**
301
+ * The provider used when none is named: Mnemon Native while its CLI is
302
+ * available, which keeps the long-standing default, otherwise the first
303
+ * other provider, in catalog order, that can take writes now.
304
+ */
305
+ defaultProviderId() {
306
+ const ready = this.providerCatalog.providers.filter((provider) => this.providerServiceEnabled(provider.id));
307
+ return (ready.find((provider) => this.isNative(provider.id)) ?? ready[0])?.id;
308
+ }
311
309
  providerServices(options = {}) {
312
310
  this.refreshIfChanged();
313
311
  const providers = this.providerCatalog.providers.filter((provider) => (provider.typeId ?? provider.id) !== "mnemon-native");
@@ -430,7 +428,8 @@ var MemorySpaceRegistry = class MemorySpaceRegistry {
430
428
  const description = requiredText(request.description, "description", 1e3);
431
429
  if (request.placement !== void 0 && placement === void 0) throw new Error("automatic provider placement must be resolved before creating a Memory Space");
432
430
  if (placement !== void 0 && request.providerId !== void 0 && request.providerId !== placement.providerId) throw new Error("resolved provider placement conflicts with providerId");
433
- const providerId = placement?.providerId ?? request.providerId ?? "mnemon-native";
431
+ const providerId = placement?.providerId ?? request.providerId ?? this.defaultProviderId();
432
+ if (providerId === void 0) throw new Error("No memory provider is ready: install the Mnemon CLI to use Mnemon Native, or connect another provider on the dsh-mnemon page under Plugins");
434
433
  if (!this.providerCatalog.has(providerId)) throw new Error(`unsupported memory provider: ${String(providerId)}`);
435
434
  const normalizedPlacement = placement === void 0 ? void 0 : normalizePlacementDecision(placement, providerId, this.providerCatalog);
436
435
  if (placement !== void 0 && normalizedPlacement === void 0) throw new Error("resolved provider placement is invalid");
@@ -447,7 +446,7 @@ var MemorySpaceRegistry = class MemorySpaceRegistry {
447
446
  this.services[providerId] = this.providerCatalog.normalizeService(providerId, split.service, this.services[providerId] ?? {});
448
447
  this.serviceEnabled[providerId] = true;
449
448
  }
450
- if (!this.providerServiceEnabled(providerId)) throw new Error(`${this.providerCatalog.descriptor(providerId).label} service is not enabled; enable it in Settings first`);
449
+ if (!this.providerServiceEnabled(providerId)) throw new Error(`${this.providerCatalog.descriptor(providerId).label} service is not enabled; enable it on the dsh-mnemon page under Plugins first`);
451
450
  connection = this.providerCatalog.normalizeMemory(providerId, split.memory);
452
451
  this.providerCatalog.normalize(providerId, {
453
452
  ...this.services[providerId],
@@ -502,7 +501,7 @@ var MemorySpaceRegistry = class MemorySpaceRegistry {
502
501
  this.services[current.providerId] = this.providerCatalog.normalizeService(current.providerId, split.service, this.services[current.providerId] ?? {}, clearSecrets);
503
502
  this.serviceEnabled[current.providerId] = true;
504
503
  }
505
- if (!this.providerServiceEnabled(current.providerId)) throw new Error(`${this.providerCatalog.descriptor(current.providerId).label} service is not enabled; enable it in Settings first`);
504
+ if (!this.providerServiceEnabled(current.providerId)) throw new Error(`${this.providerCatalog.descriptor(current.providerId).label} service is not enabled; enable it on the dsh-mnemon page under Plugins first`);
506
505
  connection = this.providerCatalog.normalizeMemory(current.providerId, split.memory, previousConnection);
507
506
  this.providerCatalog.normalize(current.providerId, {
508
507
  ...this.services[current.providerId],
@@ -1286,11 +1285,6 @@ function insightColor(category) {
1286
1285
  if (category === "context") return "#f39c12";
1287
1286
  return "#6574d9";
1288
1287
  }
1289
- function boundedInteger(value, fallback, min, max) {
1290
- if (value === void 0) return fallback;
1291
- if (!Number.isInteger(value) || value < min || value > max) throw new Error(`value must be an integer within ${min}..${max}`);
1292
- return value;
1293
- }
1294
1288
  function required(value, label, max) {
1295
1289
  const normalized = value.trim();
1296
1290
  if (normalized === "") throw new Error(`${label} is required`);
@@ -1376,8 +1370,6 @@ var MemorySpacesService = class {
1376
1370
  recallQualityPolicyRegistry;
1377
1371
  providerCatalog;
1378
1372
  memorySpaces;
1379
- /** @deprecated Use memorySpaces. Both names share the same registry authority. */
1380
- memoryBodies;
1381
1373
  providers;
1382
1374
  recallQualityPolicy;
1383
1375
  spacesInFlight;
@@ -1400,7 +1392,6 @@ var MemorySpacesService = class {
1400
1392
  this.recallQualityPolicyRegistry = recallQualityPolicyRegistry;
1401
1393
  this.providerCatalog = providerCatalog;
1402
1394
  this.memorySpaces = memorySpaces === void 0 ? new MemorySpaceRegistry(runner, true, () => /* @__PURE__ */ new Date(), providerCatalog) : providerCatalog === EMPTY_MEMORY_PROVIDER_CATALOG ? memorySpaces : memorySpaces.withProviderCatalog(providerCatalog);
1403
- this.memoryBodies = this.memorySpaces;
1404
1395
  this.recallQualityPolicy = recallQualityPolicyRegistry.resolve(config.recallQuality.policy);
1405
1396
  this.providers = providerAdapterRegistry.create({
1406
1397
  memorySpaces: this.memorySpaces,
@@ -1440,7 +1431,7 @@ var MemorySpacesService = class {
1440
1431
  let status;
1441
1432
  if (!(body.providerEnabled !== false)) status = {
1442
1433
  healthy: false,
1443
- error: `${body.provider.label} is disabled in Settings`
1434
+ error: `${body.provider.label} is disabled on the dsh-mnemon page under Plugins`
1444
1435
  };
1445
1436
  else try {
1446
1437
  status = await this.providerFor(body).status(body, signal);
@@ -1483,11 +1474,11 @@ var MemorySpacesService = class {
1483
1474
  items,
1484
1475
  providers: this.providerCatalog.providers.map((provider) => ({
1485
1476
  ...provider,
1486
- serviceConfigured: (provider.typeId ?? provider.id) === "mnemon-native" || enabled.has(provider.id)
1477
+ serviceConfigured: (provider.typeId ?? provider.id) === "mnemon-native" ? this.runner.commandFound : enabled.has(provider.id)
1487
1478
  })),
1488
1479
  persistenceStrategy: {
1489
1480
  mode: this.config.persistenceStrategy.mode,
1490
- providerId: this.config.persistenceStrategy.providerId,
1481
+ providerId: this.persistenceProviderId() ?? this.config.persistenceStrategy.providerId,
1491
1482
  prompt: this.config.persistenceStrategy.prompt,
1492
1483
  rules: { ...this.config.persistenceStrategy.rules }
1493
1484
  },
@@ -1586,9 +1577,9 @@ var MemorySpacesService = class {
1586
1577
  };
1587
1578
  }
1588
1579
  async status(signal) {
1589
- const hasNativeSpace = this.memorySpaces.list().some((body) => this.isNativeSpace(body));
1580
+ const nativeInUse = this.runner.commandFound || this.memorySpaces.list().some((body) => this.isNativeSpace(body));
1590
1581
  let versionError;
1591
- const [catalog, rawVersion] = await Promise.all([this.spaces(signal), hasNativeSpace ? this.runner.runText(["--version"], signal === void 0 ? { globalFlags: false } : {
1582
+ const [catalog, rawVersion] = await Promise.all([this.spaces(signal), nativeInUse ? this.runner.runText(["--version"], signal === void 0 ? { globalFlags: false } : {
1592
1583
  signal,
1593
1584
  globalFlags: false
1594
1585
  }).catch((error) => {
@@ -1630,7 +1621,6 @@ var MemorySpacesService = class {
1630
1621
  providerServices
1631
1622
  };
1632
1623
  try {
1633
- if (versionError !== void 0) throw versionError;
1634
1624
  const healthySpaces = active.filter((body) => body.healthy && body.stats !== void 0);
1635
1625
  const topEntities = /* @__PURE__ */ new Map();
1636
1626
  const byCategory = {};
@@ -1651,13 +1641,13 @@ var MemorySpacesService = class {
1651
1641
  })).sort((left, right) => right.count - left.count),
1652
1642
  ...active.length === 1 ? { dbPath: active[0].dbPath } : {}
1653
1643
  };
1654
- const failed = active.filter((body) => !body.healthy);
1644
+ const errors = [...versionError === void 0 ? [] : [versionError instanceof Error ? versionError.message : String(versionError)], ...active.filter((body) => !body.healthy).map((body) => `${body.name}: ${body.error ?? "unavailable"}`)];
1655
1645
  return {
1656
1646
  healthy: true,
1657
1647
  ...base,
1658
1648
  ...rawVersion === void 0 ? {} : { version: rawVersion.trim().replace(/^mnemon version\s+/i, "") },
1659
1649
  stats,
1660
- ...failed.length === 0 ? {} : { error: failed.map((body) => `${body.name}: ${body.error ?? "unavailable"}`).join("; ") }
1650
+ ...errors.length === 0 ? {} : { error: errors.join("; ") }
1661
1651
  };
1662
1652
  } catch (error) {
1663
1653
  return {
@@ -1671,7 +1661,7 @@ var MemorySpacesService = class {
1671
1661
  const body = this.memorySpaces.list().find((candidate) => candidate.id === id);
1672
1662
  if (body === void 0) throw new Error(`unknown memory space: ${id}`);
1673
1663
  if (!this.isNativeSpace(body)) {
1674
- if (!this.memorySpaces.providerServiceEnabled(body.provider.id)) throw new Error(`${body.provider.label} is disabled in Settings`);
1664
+ if (!this.memorySpaces.providerServiceEnabled(body.provider.id)) throw new Error(`${body.provider.label} is disabled on the dsh-mnemon page under Plugins`);
1675
1665
  }
1676
1666
  const provider = this.providerFor(body);
1677
1667
  provider.invalidateStatus?.(body.id);
@@ -1685,7 +1675,7 @@ var MemorySpacesService = class {
1685
1675
  }
1686
1676
  async search(request, signal) {
1687
1677
  const query = required(request.query, "query", 2e3);
1688
- const limit = boundedInteger(request.limit, this.config.defaultRecallLimit, 1, 50);
1678
+ const limit = memoryInputInteger(request.limit, this.config.defaultRecallLimit, 1, 50);
1689
1679
  const qualityContext = {
1690
1680
  requestedLimit: limit,
1691
1681
  config: this.config.recallQuality
@@ -1939,7 +1929,7 @@ var MemorySpacesService = class {
1939
1929
  const query = rawQuery.toLocaleLowerCase();
1940
1930
  if (rawQuery.length > 500) throw new Error("query is too long (max 500 characters)");
1941
1931
  const category = allowed(request.category, CATEGORIES$1, "category");
1942
- const limit = boundedInteger(request.limit, 200, 1, 1e3);
1932
+ const limit = memoryInputInteger(request.limit, 200, 1, 1e3);
1943
1933
  const spaces = this.readSpaces(request.memoryBodyIds);
1944
1934
  const batches = await Promise.all(spaces.map(async (body) => {
1945
1935
  const mode = body.provider.capabilities.browse ? "enumerable" : body.provider.capabilities.search ? "query-only" : "unsupported";
@@ -2015,7 +2005,7 @@ var MemorySpacesService = class {
2015
2005
  insights: readableIds.length === 0 ? [] : (await this.search({
2016
2006
  query: selected,
2017
2007
  intent: "ENTITY",
2018
- limit: boundedInteger(limit, 20, 1, 50),
2008
+ limit: memoryInputInteger(limit, 20, 1, 50),
2019
2009
  memoryBodyIds: readableIds
2020
2010
  }, signal)).results,
2021
2011
  sources
@@ -2072,7 +2062,7 @@ var MemorySpacesService = class {
2072
2062
  const selectedEdge = allowed(edge, EDGE_TYPES, "edge");
2073
2063
  const provider = this.providerFor(body);
2074
2064
  if (provider.related === void 0 || !body.provider.capabilities.related) throw new Error(`${body.provider.label} does not support related-memory traversal`);
2075
- return (await provider.related(body, required(id, "id", 2e3), boundedInteger(depth, 2, 1, 5), selectedEdge, signal)).map((entry) => this.annotate(entry, body));
2065
+ return (await provider.related(body, required(id, "id", 2e3), memoryInputInteger(depth, 2, 1, 5), selectedEdge, signal)).map((entry) => this.annotate(entry, body));
2076
2066
  }
2077
2067
  async link(sourceId, targetId, type = "semantic", weight = .5, reason, signal, memoryBodyId) {
2078
2068
  this.assertWritable();
@@ -2114,11 +2104,12 @@ var MemorySpacesService = class {
2114
2104
  }) {
2115
2105
  const strategy = this.config.persistenceStrategy;
2116
2106
  if (strategy.mode === "manual") {
2117
- const connection = strategy.providerConnections[strategy.providerId];
2107
+ const providerId = this.persistenceProviderId();
2108
+ const connection = providerId === void 0 ? void 0 : strategy.providerConnections[providerId];
2118
2109
  return this.createSpace({
2119
2110
  ...body,
2120
- providerId: strategy.providerId,
2121
- ...this.isNativeProvider(strategy.providerId) || connection === void 0 ? {} : { connection }
2111
+ ...providerId === void 0 ? {} : { providerId },
2112
+ ...providerId === void 0 || this.isNativeProvider(providerId) || connection === void 0 ? {} : { connection }
2122
2113
  }, signal);
2123
2114
  }
2124
2115
  const request = {
@@ -2138,6 +2129,11 @@ var MemorySpacesService = class {
2138
2129
  }, delegation);
2139
2130
  return this.createSpace(request, signal, decision);
2140
2131
  }
2132
+ /** A chosen provider stays fixed; the built-in default follows whichever provider is ready. */
2133
+ persistenceProviderId() {
2134
+ const strategy = this.config.persistenceStrategy;
2135
+ return strategy.providerDefaulted === true ? this.memorySpaces.defaultProviderId() : strategy.providerId;
2136
+ }
2141
2137
  async updateProviderService(providerId, settings, clearSecrets = [], enabled = true, signal) {
2142
2138
  this.assertWritable();
2143
2139
  if (this.isNativeProvider(providerId)) throw new Error("Mnemon Native service settings are managed by the native configuration");
@@ -2263,7 +2259,7 @@ var MemorySpacesService = class {
2263
2259
  return [...new Set(ids.map((id) => id.trim()).filter((id) => id !== ""))].map((id) => {
2264
2260
  const body = this.memorySpaces.get(id);
2265
2261
  if (!body.active) throw new Error(`memory space is not active for reading: ${id}`);
2266
- if (!this.isNativeSpace(body) && !this.memorySpaces.providerServiceEnabled(body.provider.id)) throw new Error(`${body.provider.label} is disabled in Settings`);
2262
+ 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`);
2267
2263
  return body;
2268
2264
  });
2269
2265
  }
@@ -2271,7 +2267,7 @@ var MemorySpacesService = class {
2271
2267
  if (id !== void 0 && id.trim() !== "") {
2272
2268
  const body = this.memorySpaces.get(id);
2273
2269
  if (!body.active) throw new Error(`memory space is not active for reading: ${body.id}`);
2274
- if (!this.isNativeSpace(body) && !this.memorySpaces.providerServiceEnabled(body.provider.id)) throw new Error(`${body.provider.label} is disabled in Settings`);
2270
+ 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`);
2275
2271
  return body;
2276
2272
  }
2277
2273
  const active = this.memorySpaces.active();
@@ -2281,7 +2277,7 @@ var MemorySpacesService = class {
2281
2277
  writeSpace(id) {
2282
2278
  if (id !== void 0 && id.trim() !== "") {
2283
2279
  const body = this.memorySpaces.get(id);
2284
- if (!this.isNativeSpace(body) && !this.memorySpaces.providerServiceEnabled(body.provider.id)) throw new Error(`${body.provider.label} is disabled in Settings`);
2280
+ 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`);
2285
2281
  return body;
2286
2282
  }
2287
2283
  const active = this.memorySpaces.active();
@@ -2291,7 +2287,7 @@ var MemorySpacesService = class {
2291
2287
  prepareRemember(request) {
2292
2288
  const body = this.writeSpace(request.memoryBodyId);
2293
2289
  const content = required(request.content, "content", 8192);
2294
- const importance = boundedInteger(request.importance, 3, 1, 5);
2290
+ const importance = memoryInputInteger(request.importance, 3, 1, 5);
2295
2291
  const category = allowed(request.category, CATEGORIES$1, "category") ?? "general";
2296
2292
  const source = allowed(request.source, SOURCES$1, "source") ?? "user";
2297
2293
  const tags = commaList(request.tags, "tags", 20)?.split(",");
@@ -2337,60 +2333,13 @@ var MemorySpacesService = class {
2337
2333
  assertWritable() {
2338
2334
  if (!this.config.writeEnabled) throw new Error("dsh-mnemon is configured read-only (writeEnabled: false)");
2339
2335
  }
2340
- /** @deprecated Use spaces. */
2341
- bodies(...args) {
2342
- return this.spaces(...args);
2343
- }
2344
- /** @deprecated Use spaceDirectory. */
2345
- bodyDirectory(...args) {
2346
- return this.spaceDirectory(...args);
2347
- }
2348
- /** @deprecated Use reconnectSpace. */
2349
- reconnectBody(...args) {
2350
- return this.reconnectSpace(...args);
2351
- }
2352
- /** @deprecated Use prepareSpacePlacement. */
2353
- prepareBodyPlacement(...args) {
2354
- return this.prepareSpacePlacement(...args);
2355
- }
2356
- /** @deprecated Use createSpace. */
2357
- createBody(...args) {
2358
- return this.createSpace(...args);
2359
- }
2360
- /** @deprecated Use createSpaceForPersistence. */
2361
- createBodyForPersistence(...args) {
2362
- return this.createSpaceForPersistence(...args);
2363
- }
2364
- /** @deprecated Use updateSpace. */
2365
- updateBody(...args) {
2366
- return this.updateSpace(...args);
2367
- }
2368
- /** @deprecated Use updateSpaceMetadata. */
2369
- updateBodyMetadata(...args) {
2370
- return this.updateSpaceMetadata(...args);
2371
- }
2372
- /** @deprecated Use deleteSpace. */
2373
- deleteBody(...args) {
2374
- return this.deleteSpace(...args);
2375
- }
2376
- /** @deprecated Use mergeSpaces. */
2377
- mergeBodies(...args) {
2378
- return this.mergeSpaces(...args);
2379
- }
2380
2336
  };
2381
2337
  //#endregion
2382
2338
  //#region src/runner.ts
2383
- function expandHome(path) {
2384
- return path === "~" ? homedir() : path.startsWith("~/") || path.startsWith("~\\") ? join(homedir(), path.slice(2)) : path;
2385
- }
2386
2339
  var MnemonCliError = class extends Error {
2387
- exitCode;
2388
- stderr;
2389
- constructor(message, exitCode = null, stderr = "") {
2340
+ constructor(message) {
2390
2341
  super(message);
2391
2342
  this.name = "MnemonCliError";
2392
- this.exitCode = exitCode;
2393
- this.stderr = stderr;
2394
2343
  }
2395
2344
  };
2396
2345
  const EMBEDDING_ENVIRONMENT_KEYS = /* @__PURE__ */ new Set([
@@ -2410,20 +2359,15 @@ function processEnvironment(config) {
2410
2359
  ...config.embedding.protocol === "auto" ? {} : { MNEMON_EMBED_PROTOCOL: config.embedding.protocol }
2411
2360
  };
2412
2361
  }
2413
- function createRunner(config, processRunner = runProcess, workspaceRoot) {
2362
+ function createRunner(config, processRunner = runProcess) {
2414
2363
  const currentCommand = () => findMnemonCommand(config) ?? config.cliPath ?? "mnemon";
2415
2364
  const globalArgs = (store) => {
2416
- const args = [];
2417
- if (config.storageScope !== "global" || config.dataDir !== void 0) args.push("--data-dir", effectiveDataDir());
2365
+ const args = ["--data-dir", effectiveDataDir()];
2418
2366
  if (store !== void 0) args.push("--store", store);
2419
2367
  else if (config.store !== void 0) args.push("--store", config.store);
2420
2368
  return args;
2421
2369
  };
2422
- const effectiveDataDir = () => {
2423
- if (config.storageScope === "workspace") return resolve(workspaceRoot ?? process.cwd(), ".mnemon");
2424
- if (config.storageScope === "custom") return expandHome(config.dataDir);
2425
- return expandHome(process.env.MNEMON_DATA_DIR?.trim() || "~/.mnemon");
2426
- };
2370
+ const effectiveDataDir = () => config.dataDir;
2427
2371
  const persistedStore = () => {
2428
2372
  const active = join(effectiveDataDir(), "active");
2429
2373
  if (existsSync(active)) try {
@@ -2454,7 +2398,7 @@ function createRunner(config, processRunner = runProcess, workspaceRoot) {
2454
2398
  }
2455
2399
  if (result.exitCode !== 0) {
2456
2400
  const detail = result.stderr.trim() || result.stdout.trim() || "no output";
2457
- throw new MnemonCliError(`mnemon ${args.join(" ")} exited ${String(result.exitCode)}: ${detail}`, result.exitCode, result.stderr);
2401
+ throw new MnemonCliError(`mnemon ${args.join(" ")} exited ${String(result.exitCode)}: ${detail}`);
2458
2402
  }
2459
2403
  return result.stdout;
2460
2404
  };
@@ -2469,7 +2413,6 @@ function createRunner(config, processRunner = runProcess, workspaceRoot) {
2469
2413
  const found = findMnemonCommand(config);
2470
2414
  return found !== void 0 && isMnemonExecutable(found);
2471
2415
  },
2472
- config,
2473
2416
  async runJson(args, options) {
2474
2417
  const stdout = await execute(args, options);
2475
2418
  try {
@@ -2486,9 +2429,6 @@ function createRunner(config, processRunner = runProcess, workspaceRoot) {
2486
2429
  return outputs;
2487
2430
  });
2488
2431
  },
2489
- withExclusive(operation) {
2490
- return withMemoryStorageLock(effectiveDataDir(), operation);
2491
- },
2492
2432
  effectiveDataDir() {
2493
2433
  return effectiveDataDir();
2494
2434
  },
@@ -2561,6 +2501,7 @@ function resolvePersistenceStrategy(value) {
2561
2501
  return {
2562
2502
  mode,
2563
2503
  providerId,
2504
+ ...value?.providerId === void 0 ? { providerDefaulted: true } : {},
2564
2505
  prompt,
2565
2506
  rules: {
2566
2507
  allowedProviderIds,
@@ -3365,7 +3306,6 @@ function createMemorySpacesSource(providerSnapshot, config = {}) {
3365
3306
  }
3366
3307
  });
3367
3308
  }
3368
- /** Empty template; actual installations must provide explicit Provider children. */
3369
3309
  //#endregion
3370
3310
  //#region src/index.ts
3371
3311
  const name = "dsh-mnemon-source-memory-spaces";
@@ -3377,8 +3317,8 @@ const memoryPlugin = defineMemoryPlugin({
3377
3317
  "zh-CN": "记忆空间"
3378
3318
  },
3379
3319
  description: {
3380
- en: "Durable evidence backed by explicitly configured Provider children.",
3381
- "zh-CN": "由显式配置的 Provider 子插件承载的长期证据。"
3320
+ en: "Provider-backed durable evidence recalled on demand across tasks and sessions.",
3321
+ "zh-CN": "由 Provider 支撑的持久证据,按需跨任务与会话召回。"
3382
3322
  },
3383
3323
  roles: ["source"],
3384
3324
  provides: [{ id: "source" }, { id: "source.durable-evidence" }]
@@ -3392,27 +3332,25 @@ const Config = z.intersect([MemorySpacesConfig, z.object({ providers: z.array(z.
3392
3332
  function sourceInstanceId(ctx, explicit) {
3393
3333
  const configured = explicit?.trim();
3394
3334
  if (configured !== void 0 && configured !== "") return configured;
3395
- const located = (typeof ctx.get === "function" ? ctx.get("loader", false) : void 0)?.locate(ctx.fiber)?.trim();
3335
+ const located = ctx.get("loader", false)?.locate(ctx.fiber)?.trim();
3396
3336
  if (located !== void 0 && located !== "") return located;
3397
- const entryId = ctx.fiber.entry?.options?.id;
3398
- if (typeof entryId === "string" && entryId.trim() !== "") return entryId.trim();
3399
3337
  throw new Error("Memory Spaces requires a stable Loader Entry id; pass instanceId for a direct mount");
3400
3338
  }
3401
3339
  function importedProviderModule(loader, value, specifier) {
3402
- const unwrapped = loader.unwrapExports?.(value) ?? (typeof value === "object" && value !== null && "default" in value ? value.default : value);
3340
+ const unwrapped = loader.unwrapExports(value);
3403
3341
  if (typeof unwrapped !== "object" || unwrapped === null) throw new Error(`Memory Space Provider module ${specifier} did not export a typed child module`);
3404
3342
  return defineMemorySpaceProvider(unwrapped);
3405
3343
  }
3406
3344
  /** Resolve only the explicitly listed children; no dependency scanning occurs. */
3407
3345
  async function resolveMemorySpaceProviderEntries(ctx, declarations) {
3408
3346
  if (declarations.length === 0) throw new Error("Memory Spaces requires at least one explicit Provider child");
3409
- const loader = typeof ctx.get === "function" ? ctx.get("loader", false) : void 0;
3347
+ const loader = ctx.get("loader", false);
3410
3348
  const entries = [];
3411
3349
  const instanceIds = /* @__PURE__ */ new Set();
3412
3350
  for (const declaration of declarations) {
3413
3351
  const use = (typeof declaration === "string" ? declaration : declaration.use).trim();
3414
3352
  if (use === "") throw new Error("Memory Space Provider declaration use is required");
3415
- if (loader?.import === void 0) throw new Error("cannot resolve installed Memory Space Provider module without the DSH Loader: " + use);
3353
+ if (loader === void 0) throw new Error("cannot resolve installed Memory Space Provider module without the DSH Loader: " + use);
3416
3354
  const module = importedProviderModule(loader, await loader.import(use), use);
3417
3355
  const entry = {
3418
3356
  instanceId: typeof declaration === "string" ? module.id : declaration.instanceId?.trim() || module.id,
@@ -36,6 +36,7 @@ export declare function ExplorePage(props: {
36
36
  seed: string;
37
37
  writeEnabled: boolean;
38
38
  onForget: (insight: Insight) => Promise<void>;
39
+ onRevealElement?(element: HTMLElement): void;
39
40
  }): JSX.Element;
40
41
  export declare function EntitiesPage(props: {
41
42
  client: MemorySpacesPageClient;
@@ -1,6 +1,5 @@
1
1
  import type { MemoryProviderConfigField, MemoryProviderDescriptor } from '../contracts.ts';
2
2
  import type { MnemonTranslate } from 'dsh-mnemon/client';
3
- export declare function providerDisplayLabel(_providerId: string, label: string): string;
4
3
  export declare function providerSummary(t: MnemonTranslate, provider: MemoryProviderDescriptor): string;
5
4
  export declare function providerFieldLabel(t: MnemonTranslate, field: MemoryProviderConfigField): string;
6
5
  export declare function providerOptionLabel(t: MnemonTranslate, option: NonNullable<MemoryProviderConfigField['options']>[number]): string;
@@ -25,7 +25,7 @@ export interface MemoryProviderConfigField {
25
25
  label: string;
26
26
  /** Optional Host-provided translation key; clients fall back to label. */
27
27
  i18nKey?: string;
28
- /** Service fields are configured once in Settings; memory fields belong to each Memory Space. */
28
+ /** Service fields are configured once on the dsh-mnemon page under Plugins; memory fields belong to each Memory Space. */
29
29
  scope: 'service' | 'memory';
30
30
  /** A reusable local data location presented with the same default/custom scope UI as Mnemon Native. */
31
31
  role?: 'global-location';
@@ -66,6 +66,8 @@ export interface MemoryPersistenceStrategy {
66
66
  export interface ResolvedMemoryPersistenceStrategy {
67
67
  mode: 'manual' | 'automatic';
68
68
  providerId: MemoryProviderId;
69
+ /** Set when no provider was chosen; manual mode then uses whichever provider is ready. */
70
+ providerDefaulted?: true;
69
71
  prompt: string;
70
72
  rules: {
71
73
  allowedProviderIds: MemoryProviderId[];
package/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Memory Spaces",
4
+ "description": "Provider-backed durable evidence recalled on demand across tasks and sessions."
5
+ }
6
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "记忆空间",
4
+ "description": "由 Provider 支撑的持久证据,按需跨任务与会话召回。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mnemon-source-memory-spaces",
3
- "version": "0.5.9",
3
+ "version": "0.5.11",
4
4
  "description": "Memory Spaces Source and its private Provider SDK.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -17,6 +17,7 @@
17
17
  "default": "./lib/provider-sdk.js"
18
18
  },
19
19
  "./package.json": "./package.json",
20
+ "./locale/*.json": "./locale/*.json",
20
21
  "./testing": {
21
22
  "types": "./lib/testing.d.ts",
22
23
  "default": "./lib/testing.js"
@@ -39,6 +40,7 @@
39
40
  },
40
41
  "files": [
41
42
  "lib",
43
+ "locale",
42
44
  "README.md",
43
45
  "presentation"
44
46
  ],
@@ -49,29 +51,30 @@
49
51
  "verify": "pnpm typecheck && pnpm test && pnpm build"
50
52
  },
51
53
  "dependencies": {
52
- "schemastery": "^3.18.0"
54
+ "@deepseek-ai/schemastery": "^3.18.4"
53
55
  },
54
56
  "peerDependencies": {
55
57
  "@deepseek-ai/cordis": "^4.0.1",
58
+ "@deepseek-ai/dsh-client-ui-primitives": "^0.1.7-rc.2",
56
59
  "dsh-mnemon": "^0.5.1",
57
60
  "react": "^18.2.0"
58
61
  },
59
62
  "devDependencies": {
60
- "@deepseek-ai/dsh-client-ui-primitives": "0.1.5-rc.1",
63
+ "@deepseek-ai/dsh-client-ui-primitives": "0.1.7-rc.2",
61
64
  "@testing-library/react": "^16.3.0",
62
65
  "@types/node": "^22.0.0",
63
66
  "@types/react": "^18.3.0",
64
67
  "@types/react-dom": "^18.3.0",
65
- "dsh-mnemon": "^0.5.14",
66
- "dsh-mnemon-provider-byterover": "^0.5.4",
67
- "dsh-mnemon-provider-hindsight": "^0.5.4",
68
- "dsh-mnemon-provider-holographic": "^0.5.4",
69
- "dsh-mnemon-provider-honcho": "^0.5.4",
70
- "dsh-mnemon-provider-mem0": "^0.5.4",
71
- "dsh-mnemon-provider-mnemon-native": "^0.5.5",
72
- "dsh-mnemon-provider-openviking": "^0.5.6",
73
- "dsh-mnemon-provider-retaindb": "^0.5.4",
74
- "dsh-mnemon-provider-supermemory": "^0.5.4",
68
+ "dsh-mnemon": "^0.5.17",
69
+ "dsh-mnemon-provider-byterover": "^0.5.5",
70
+ "dsh-mnemon-provider-hindsight": "^0.5.5",
71
+ "dsh-mnemon-provider-holographic": "^0.5.5",
72
+ "dsh-mnemon-provider-honcho": "^0.5.5",
73
+ "dsh-mnemon-provider-mem0": "^0.5.5",
74
+ "dsh-mnemon-provider-mnemon-native": "^0.5.6",
75
+ "dsh-mnemon-provider-openviking": "^0.5.7",
76
+ "dsh-mnemon-provider-retaindb": "^0.5.5",
77
+ "dsh-mnemon-provider-supermemory": "^0.5.5",
75
78
  "jsdom": "^26.0.0",
76
79
  "react": "^18.2.0",
77
80
  "react-dom": "^18.2.0",
@@ -94,7 +97,14 @@
94
97
  "micromark-util-classify-character": "^2.0.1",
95
98
  "micromark-util-sanitize-uri": "^2.0.1",
96
99
  "micromark-util-symbol": "^2.0.1",
97
- "shiki": "^4.3.1"
100
+ "shiki": "^4.3.1",
101
+ "@deepseek-ai/dsh-client-store": "0.1.7-rc.2",
102
+ "@deepseek-ai/dsh-util-code-language": "0.1.7-rc.2",
103
+ "@deepseek-ai/dsh-util-workspace-path": "0.1.7-rc.2",
104
+ "diff": "^9.0.0",
105
+ "immer": "^10.1.1",
106
+ "simple-icons": "16.31.0",
107
+ "zustand": "~4.4.7"
98
108
  },
99
109
  "peerDependenciesMeta": {
100
110
  "react": {
@@ -103,9 +113,6 @@
103
113
  },
104
114
  "dsh": {
105
115
  "client": {
106
- "inject": [
107
- "slots"
108
- ],
109
116
  "platform": "web",
110
117
  "external": [
111
118
  "dsh-mnemon/client"