dsh-mnemon-source-memory-spaces 0.5.19 → 0.5.21

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.
@@ -1,8 +1,5 @@
1
1
  import { spawn } from "node:child_process";
2
2
  import { StringDecoder } from "node:string_decoder";
3
- //#region src/providers/adapter.ts
4
- const NORMALIZED_RELEVANCE_SCORE = Object.freeze({ kind: "normalized-relevance" });
5
- //#endregion
6
3
  //#region src/providers/process.ts
7
4
  var ProcessError = class extends Error {
8
5
  reason;
@@ -91,4 +88,7 @@ const runProcess = (command, args, options) => new Promise((resolve, reject) =>
91
88
  else options.signal?.addEventListener("abort", abort, { once: true });
92
89
  });
93
90
  //#endregion
94
- export { NORMALIZED_RELEVANCE_SCORE as i, ProcessError as n, runProcess as r, DEFAULT_MAX_OUTPUT_BYTES as t };
91
+ //#region src/providers/adapter.ts
92
+ const NORMALIZED_RELEVANCE_SCORE = Object.freeze({ kind: "normalized-relevance" });
93
+ //#endregion
94
+ export { runProcess as i, DEFAULT_MAX_OUTPUT_BYTES as n, ProcessError as r, NORMALIZED_RELEVANCE_SCORE as t };
package/lib/client.js CHANGED
@@ -4258,7 +4258,8 @@ window.__ModuleLoader__.load({
4258
4258
  setOutcome({
4259
4259
  content: candidate,
4260
4260
  action: response.action,
4261
- summary: response.summary
4261
+ summary: response.summary,
4262
+ unembedded: (response.unembedded ?? []).length > 0
4262
4263
  });
4263
4264
  props.onMutate();
4264
4265
  } catch (reason) {
@@ -4288,7 +4289,8 @@ window.__ModuleLoader__.load({
4288
4289
  setOutcome({
4289
4290
  content: candidate,
4290
4291
  action: typeof response.action === "string" ? response.action : "stored",
4291
- summary: typeof response.summary === "string" ? response.summary : ""
4292
+ summary: typeof response.summary === "string" ? response.summary : "",
4293
+ unembedded: response.embedded === false
4292
4294
  });
4293
4295
  props.onMutate();
4294
4296
  } catch (reason) {
@@ -4330,6 +4332,7 @@ window.__ModuleLoader__.load({
4330
4332
  action: outcome.action,
4331
4333
  summary: outcome.summary,
4332
4334
  error: outcome.error,
4335
+ unembedded: outcome.unembedded,
4333
4336
  onView: props.onView
4334
4337
  })
4335
4338
  ]
@@ -519,9 +519,38 @@ interface MnemonEmbeddingStatus {
519
519
  model: string;
520
520
  /** Protocol Mnemon resolved for the embedding endpoint; omitted when the CLI does not report one. */
521
521
  protocol?: string;
522
+ /** Across the spaces in `spaces` that could be counted; 0 when no space has a database. */
522
523
  totalInsights: number;
523
524
  embedded: number;
524
525
  coverage: string;
526
+ /** Each Mnemon Native space with a database, as `mnemon --store <id> embed --status` counts it (#392). */
527
+ spaces?: MnemonEmbeddingSpaceStatus[];
528
+ }
529
+ /** One Mnemon Native space's vector coverage. */
530
+ interface MnemonEmbeddingSpaceStatus {
531
+ memoryBodyId: string;
532
+ name: string;
533
+ active: boolean;
534
+ totalInsights: number;
535
+ embedded: number;
536
+ coverage: string;
537
+ /** Why the space could not be counted; its counts are then 0 and stay out of the total. */
538
+ error?: string;
539
+ }
540
+ /** What one fill of a Mnemon Native space's missing vectors did (#392). */
541
+ interface MnemonEmbeddingFill {
542
+ memoryBodyId: string;
543
+ /** Vectors the fill wrote. */
544
+ filled: number;
545
+ /** Memories of the space still without a vector when it stopped. */
546
+ remaining: number;
547
+ /** The embedding model Mnemon used. */
548
+ model: string;
549
+ /**
550
+ * Why it stopped while memories remain: its minute ran out (`time`), or a step wrote no vector,
551
+ * so the embedding service returned none for the memories left (`refused`).
552
+ */
553
+ stopped?: 'time' | 'refused';
525
554
  }
526
555
  /** Domain status only; workbench/lifecycle status belongs to the default adapter. */
527
556
  interface MemorySpacesStatus {
@@ -603,4 +632,4 @@ type MemoryBodyView = MemorySpaceView;
603
632
  /** @deprecated Use OpenVikingSpaceConnection. The wire shape is unchanged. */
604
633
  type OpenVikingBodyConnection = OpenVikingSpaceConnection;
605
634
  //#endregion
606
- export { 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, type 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, MemorySpaceRediscovery, MemorySpaceRediscoveryResult, 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 };
635
+ export { 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, type 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, MemorySpaceRediscovery, MemorySpaceRediscoveryResult, MemorySpaceStats, MemorySpaceView, MemorySpaceWriteScope, MemorySpaceWriteScopeRequest, MemorySpacesStatus, MnemonEmbeddingConfig, MnemonEmbeddingFill, MnemonEmbeddingProtocol, MnemonEmbeddingSpaceStatus, MnemonEmbeddingStatus, OpenVikingBodyConnection, OpenVikingSpaceConnection, PreparedMemoryPlacement, RecallQualityConfig, RecallQualityStats, RecallRelevanceTier, RememberRequest, ResolvedMemoryPersistenceStrategy, ResolvedMnemonEmbeddingConfig, ResolvedRecallQualityConfig, SOURCES, SearchRequest, Source, UpdateMemoryBodyRequest, UpdateMemoryProviderServiceRequest, UpdateMemorySpaceRequest, normalizeEntityKey };
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
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, MemorySpaceRediscovery, MemorySpaceRediscoveryResult, 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";
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, MemorySpaceRediscovery, MemorySpaceRediscoveryResult, MemorySpaceStats, MemorySpaceView, MemorySpaceWriteScope, MemorySpaceWriteScopeRequest, MemorySpacesStatus, MnemonEmbeddingConfig, MnemonEmbeddingFill, MnemonEmbeddingProtocol, MnemonEmbeddingSpaceStatus, MnemonEmbeddingStatus, OpenVikingBodyConnection, OpenVikingSpaceConnection, PreparedMemoryPlacement, RecallQualityConfig, RecallQualityStats, RecallRelevanceTier, RememberRequest, ResolvedMemoryPersistenceStrategy, ResolvedMnemonEmbeddingConfig, ResolvedRecallQualityConfig, SOURCES, SearchRequest, Source, UpdateMemoryBodyRequest, UpdateMemoryProviderServiceRequest, UpdateMemorySpaceRequest, normalizeEntityKey } from "./contracts.js";
2
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";
@@ -59,4 +59,4 @@ declare function resolveMemorySpaceProviderEntries(ctx: Context, declarations: r
59
59
  declare function installMemorySpaces(ctx: Context, entries: readonly MemorySpaceProviderEntry[], options?: InstallMemorySpacesOptions): Promise<void>;
60
60
  declare function apply(ctx: Context, config?: Config): Promise<void>;
61
61
  //#endregion
62
- export { type AutomaticMemoryPlacementRequest, type CATEGORIES, type Category, Config, type CreateMemoryBodyRequest, type CreateMemorySpaceRequest, type DEFAULT_EMBEDDING_ENDPOINT, type DEFAULT_EMBEDDING_MODEL, type DEFAULT_EMBEDDING_PROTOCOL, type EDGE_TYPES, type EMBEDDING_PROTOCOL_AUTO, type EMBEDDING_PROTOCOL_OLLAMA, type EMBEDDING_PROTOCOL_OPENAI, type EdgeType, type EntityMemoriesView, type EntityRelatedView, type EntityView, type INTENTS, type Insight, InstallMemorySpacesOptions, type Intent, type JsonValue, type LlmMemoryPlacementSelection, type MNEMON_EMBEDDING_PROTOCOLS, type MemoryBody, type MemoryBodyCatalog, type MemoryBodyMetadataMaintenanceResult, type MemoryBodyMetadataSample, type MemoryBodyMetadataUpdate, type MemoryBodyProvider, type MemoryBodyStats, type MemoryBodyView, type MemoryGraphEdge, type MemoryGraphNode, type MemoryGraphSnapshot, type MemoryListRequest, type MemoryListView, type MemoryPersistenceStrategy, type MemoryPlacementCandidate, type MemoryPlacementCapability, type MemoryPlacementDecision, type MemoryPlacementPreference, type MemoryPlacementRules, type MemoryProviderCapabilities, type MemoryProviderConfigField, type MemoryProviderConfigOption, type MemoryProviderConnection, type MemoryProviderConnectionValue, type MemoryProviderDescriptor, type MemoryProviderIcon, type MemoryProviderId, type MemoryProviderRuntimeStatus, type MemoryProviderServiceCatalog, type MemoryProviderServiceView, type MemoryReadMode, type MemoryReadSource, type MemoryReadStatus, type MemorySpace, type MemorySpaceCatalog, type MemorySpaceMetadataMaintenanceResult, type MemorySpaceMetadataSample, type MemorySpaceMetadataUpdate, type MemorySpaceProvider, MemorySpaceProviderDeclaration, MemorySpaceProviderDeclarationSchema, type MemorySpaceRediscovery, type MemorySpaceRediscoveryResult, type MemorySpaceStats, type MemorySpaceView, type MemorySpaceWriteScope, type MemorySpaceWriteScopeRequest, type MemorySpacesStatus, type MnemonEmbeddingConfig, type MnemonEmbeddingProtocol, type MnemonEmbeddingStatus, type OpenVikingBodyConnection, type OpenVikingSpaceConnection, type PreparedMemoryPlacement, type RecallQualityConfig, type RecallQualityStats, type RecallRelevanceTier, type RememberRequest, type ResolvedMemoryPersistenceStrategy, type ResolvedMnemonEmbeddingConfig, type ResolvedRecallQualityConfig, type SOURCES, type SearchRequest, type Source, type UpdateMemoryBodyRequest, type UpdateMemoryProviderServiceRequest, type UpdateMemorySpaceRequest, apply, inject, installMemorySpaces, memoryPlugin, name, type normalizeEntityKey, resolveEmbedding, resolveMemorySpaceProviderEntries, resolvePersistenceStrategy, resolveRecallQuality };
62
+ export { type AutomaticMemoryPlacementRequest, type CATEGORIES, type Category, Config, type CreateMemoryBodyRequest, type CreateMemorySpaceRequest, type DEFAULT_EMBEDDING_ENDPOINT, type DEFAULT_EMBEDDING_MODEL, type DEFAULT_EMBEDDING_PROTOCOL, type EDGE_TYPES, type EMBEDDING_PROTOCOL_AUTO, type EMBEDDING_PROTOCOL_OLLAMA, type EMBEDDING_PROTOCOL_OPENAI, type EdgeType, type EntityMemoriesView, type EntityRelatedView, type EntityView, type INTENTS, type Insight, InstallMemorySpacesOptions, type Intent, type JsonValue, type LlmMemoryPlacementSelection, type MNEMON_EMBEDDING_PROTOCOLS, type MemoryBody, type MemoryBodyCatalog, type MemoryBodyMetadataMaintenanceResult, type MemoryBodyMetadataSample, type MemoryBodyMetadataUpdate, type MemoryBodyProvider, type MemoryBodyStats, type MemoryBodyView, type MemoryGraphEdge, type MemoryGraphNode, type MemoryGraphSnapshot, type MemoryListRequest, type MemoryListView, type MemoryPersistenceStrategy, type MemoryPlacementCandidate, type MemoryPlacementCapability, type MemoryPlacementDecision, type MemoryPlacementPreference, type MemoryPlacementRules, type MemoryProviderCapabilities, type MemoryProviderConfigField, type MemoryProviderConfigOption, type MemoryProviderConnection, type MemoryProviderConnectionValue, type MemoryProviderDescriptor, type MemoryProviderIcon, type MemoryProviderId, type MemoryProviderRuntimeStatus, type MemoryProviderServiceCatalog, type MemoryProviderServiceView, type MemoryReadMode, type MemoryReadSource, type MemoryReadStatus, type MemorySpace, type MemorySpaceCatalog, type MemorySpaceMetadataMaintenanceResult, type MemorySpaceMetadataSample, type MemorySpaceMetadataUpdate, type MemorySpaceProvider, MemorySpaceProviderDeclaration, MemorySpaceProviderDeclarationSchema, type MemorySpaceRediscovery, type MemorySpaceRediscoveryResult, type MemorySpaceStats, type MemorySpaceView, type MemorySpaceWriteScope, type MemorySpaceWriteScopeRequest, type MemorySpacesStatus, type MnemonEmbeddingConfig, type MnemonEmbeddingFill, type MnemonEmbeddingProtocol, type MnemonEmbeddingSpaceStatus, type MnemonEmbeddingStatus, type OpenVikingBodyConnection, type OpenVikingSpaceConnection, type PreparedMemoryPlacement, type RecallQualityConfig, type RecallQualityStats, type RecallRelevanceTier, type RememberRequest, type ResolvedMemoryPersistenceStrategy, type ResolvedMnemonEmbeddingConfig, type ResolvedRecallQualityConfig, type SOURCES, type SearchRequest, type Source, type UpdateMemoryBodyRequest, type UpdateMemoryProviderServiceRequest, type UpdateMemorySpaceRequest, apply, inject, installMemorySpaces, memoryPlugin, name, type normalizeEntityKey, resolveEmbedding, resolveMemorySpaceProviderEntries, resolvePersistenceStrategy, resolveRecallQuality };
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, normalizeEntityKey } 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 { n as ProcessError, r as runProcess } from "./process-DIK9NnTg.js";
4
+ import { i as runProcess, r as ProcessError } from "./adapter-D-BnWkko.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";
@@ -43,6 +43,7 @@ function modelSpaceCatalog(catalog) {
43
43
  function modelStatus(status) {
44
44
  const active = status.memoryBodies.filter((body) => body.active && body.providerEnabled !== false);
45
45
  const unhealthy = active.filter((body) => !body.healthy);
46
+ const summed = active.filter((body) => body.healthy && body.stats !== void 0);
46
47
  const relevantProviders = status.providerServices?.filter((provider) => provider.enabled || provider.configured || provider.memoryBodyCount > 0 || provider.status === "unhealthy") ?? [];
47
48
  const providers = relevantProviders.slice(0, 16);
48
49
  const providerReady = status.commandFound === true || (status.providerServices ?? []).some((provider) => provider.enabled && provider.configured);
@@ -73,6 +74,8 @@ function modelStatus(status) {
73
74
  })),
74
75
  omittedProviderCount: Math.max(0, relevantProviders.length - providers.length),
75
76
  ...status.stats === void 0 ? {} : { aggregate: {
77
+ scope: "Sums over the active, healthy Memory Spaces whose Provider reports statistics (spaces); the others add nothing. totalInsights counts live memories, and deletedInsights the forgotten ones a Provider keeps, as Mnemon Native does.",
78
+ spaces: summed.length,
76
79
  totalInsights: status.stats.totalInsights,
77
80
  deletedInsights: status.stats.deletedInsights,
78
81
  edgeCount: status.stats.edgeCount,
@@ -1103,6 +1106,132 @@ var MemorySpaceRegistry = class MemorySpaceRegistry {
1103
1106
  }
1104
1107
  };
1105
1108
  //#endregion
1109
+ //#region src/runner.ts
1110
+ var MnemonCliError = class extends Error {
1111
+ reason;
1112
+ constructor(message, reason) {
1113
+ super(message);
1114
+ this.reason = reason;
1115
+ this.name = "MnemonCliError";
1116
+ }
1117
+ };
1118
+ const EMBEDDING_ENVIRONMENT_KEYS = /* @__PURE__ */ new Set([
1119
+ "MNEMON_EMBED_ENDPOINT",
1120
+ "MNEMON_EMBED_MODEL",
1121
+ "MNEMON_EMBED_API_KEY",
1122
+ "MNEMON_EMBED_PROTOCOL"
1123
+ ]);
1124
+ /**
1125
+ * Explain a CLI call that produced no result. Only a failed launch means the
1126
+ * executable is missing or unusable, so only that case carries the install
1127
+ * hint; a timeout, a cancellation or an oversized output names its own cause.
1128
+ */
1129
+ function processFailureMessage(error, args) {
1130
+ const detail = error instanceof Error ? error.message : String(error);
1131
+ const reason = error instanceof ProcessError ? error.reason : "launch";
1132
+ const command = args.find((arg) => !arg.startsWith("-"));
1133
+ if (reason === "output-limit") return `mnemon ${command ?? "command"} stopped: ${detail.replace(/^mnemon /u, "")}`;
1134
+ if (reason === "timeout" && command !== void 0) return detail.replace(/^mnemon /u, `mnemon ${command} `);
1135
+ if (reason !== "launch") return detail;
1136
+ 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."}`;
1137
+ }
1138
+ /** Preserve the Host environment while making saved embedding overrides authoritative. */
1139
+ function processEnvironment(config) {
1140
+ if (!config.embedding.enabled) return void 0;
1141
+ return {
1142
+ ...Object.fromEntries(Object.entries(process.env).filter(([key]) => !EMBEDDING_ENVIRONMENT_KEYS.has(key.toUpperCase()))),
1143
+ MNEMON_EMBED_ENDPOINT: config.embedding.endpoint,
1144
+ MNEMON_EMBED_MODEL: config.embedding.model,
1145
+ MNEMON_EMBED_API_KEY: config.embedding.apiKey,
1146
+ ...config.embedding.protocol === "auto" ? {} : { MNEMON_EMBED_PROTOCOL: config.embedding.protocol }
1147
+ };
1148
+ }
1149
+ function createRunner(config, processRunner = runProcess) {
1150
+ const currentCommand = () => findMnemonCommand(config) ?? config.cliPath ?? "mnemon";
1151
+ const globalArgs = (store) => {
1152
+ const args = ["--data-dir", effectiveDataDir()];
1153
+ if (store !== void 0) args.push("--store", store);
1154
+ else if (config.store !== void 0) args.push("--store", config.store);
1155
+ return args;
1156
+ };
1157
+ const effectiveDataDir = () => config.dataDir;
1158
+ const persistedStore = () => {
1159
+ const active = join(effectiveDataDir(), "active");
1160
+ if (existsSync(active)) try {
1161
+ const value = readFileSync(active, "utf8").trim();
1162
+ if (/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(value)) return value;
1163
+ } catch {}
1164
+ return "default";
1165
+ };
1166
+ const launch = async (args, options = {}) => {
1167
+ if (options.signal?.aborted === true) throw new MnemonCliError(`mnemon command aborted: ${String(options.signal.reason ?? "cancelled")}`, "aborted");
1168
+ if (options.database !== void 0 && !existsSync(options.database)) throw new MnemonCliError(`mnemon ${args.find((arg) => !arg.startsWith("-")) ?? "command"}: no database at ${options.database}`, "no-database");
1169
+ const argv = options.globalFlags === false ? [...args] : [...globalArgs(options.store), ...args];
1170
+ const environment = processEnvironment(config);
1171
+ const processOptions = {
1172
+ timeoutMs: options.timeoutMs ?? config.timeoutMs,
1173
+ ...environment === void 0 ? {} : { env: environment },
1174
+ ...options.signal === void 0 ? {} : { signal: options.signal },
1175
+ ...options.maxOutputBytes === void 0 ? {} : { maxOutputBytes: options.maxOutputBytes }
1176
+ };
1177
+ let result;
1178
+ try {
1179
+ const invocation = resolveMnemonInvocation(currentCommand(), argv, environment);
1180
+ result = await processRunner(invocation.command, invocation.args, {
1181
+ ...processOptions,
1182
+ ...invocation.env === void 0 ? {} : { env: invocation.env }
1183
+ });
1184
+ } catch (error) {
1185
+ throw new MnemonCliError(processFailureMessage(error, args), error instanceof ProcessError ? error.reason : "launch");
1186
+ }
1187
+ if (result.exitCode !== 0) {
1188
+ const detail = result.stderr.trim() || result.stdout.trim() || "no output";
1189
+ throw new MnemonCliError(`mnemon ${args.join(" ")} exited ${String(result.exitCode)}: ${detail}`);
1190
+ }
1191
+ return result.stdout;
1192
+ };
1193
+ const execute = (args, options = {}) => {
1194
+ return withMemoryStorageLock(effectiveDataDir(), () => launch(args, options));
1195
+ };
1196
+ return {
1197
+ get command() {
1198
+ return currentCommand();
1199
+ },
1200
+ get commandFound() {
1201
+ const found = findMnemonCommand(config);
1202
+ return found !== void 0 && isMnemonExecutable(found);
1203
+ },
1204
+ async runJson(args, options) {
1205
+ const stdout = await execute(args, options);
1206
+ try {
1207
+ return JSON.parse(stdout);
1208
+ } catch {
1209
+ throw new MnemonCliError(`mnemon ${args.join(" ")} returned invalid JSON`);
1210
+ }
1211
+ },
1212
+ runText: execute,
1213
+ runTextBatch(commands) {
1214
+ return withMemoryStorageLock(effectiveDataDir(), async () => {
1215
+ const outputs = [];
1216
+ for (const command of commands) outputs.push(await launch(command.args, command.options));
1217
+ return outputs;
1218
+ });
1219
+ },
1220
+ effectiveDataDir() {
1221
+ return effectiveDataDir();
1222
+ },
1223
+ persistedStore() {
1224
+ return persistedStore();
1225
+ },
1226
+ effectiveStore() {
1227
+ if (config.store !== void 0) return config.store;
1228
+ const fromEnvironment = process.env.MNEMON_STORE?.trim();
1229
+ if (fromEnvironment !== void 0 && fromEnvironment !== "") return fromEnvironment;
1230
+ return persistedStore();
1231
+ }
1232
+ };
1233
+ }
1234
+ //#endregion
1106
1235
  //#region src/provider-placement.ts
1107
1236
  const CAPABILITY_LABELS = {
1108
1237
  graph: "typed graph",
@@ -1749,6 +1878,41 @@ function mutationResultCompletion(result) {
1749
1878
  function mutationResultCommitted(result) {
1750
1879
  return mutationResultCompletion(result) === "committed";
1751
1880
  }
1881
+ /** One `mnemon embed --status` answer, strictly validated. */
1882
+ function embeddingCounts(value) {
1883
+ const output = record(value);
1884
+ const available = output?.embedding_available ?? output?.ollama_available;
1885
+ const model = text(output?.model)?.trim();
1886
+ const protocol = text(output?.protocol)?.trim();
1887
+ const totalInsights = number(output?.total_insights);
1888
+ const embedded = number(output?.embedded);
1889
+ const coverage = text(output?.coverage)?.trim();
1890
+ if (typeof available !== "boolean" || model === void 0 || model === "" || model.length > 200 || /[\u0000-\u001f\u007f]/u.test(model) || !Number.isInteger(totalInsights) || totalInsights < 0 || !Number.isInteger(embedded) || embedded < 0 || embedded > totalInsights || coverage === void 0 || !/^(?:100|\d{1,2})%$/u.test(coverage)) throw new Error("mnemon embed --status returned an invalid response");
1891
+ return {
1892
+ available,
1893
+ model,
1894
+ totalInsights,
1895
+ embedded,
1896
+ coverage,
1897
+ ...protocol !== void 0 && protocol.length <= 32 && !/[\u0000-\u001f\u007f]/u.test(protocol) ? { protocol } : {}
1898
+ };
1899
+ }
1900
+ /** How long one fill of a space's vectors may run, and the longest step of it that holds the storage lock (#392). */
1901
+ const EMBED_FILL_BUDGET_MS = 6e4;
1902
+ const EMBED_FILL_STEP_MS = 1e4;
1903
+ /** A whole percent, as Mnemon writes it, that reads 100% only when every memory has its vector. */
1904
+ function coveragePercent(embedded, total) {
1905
+ return total === 0 ? "0%" : `${Math.floor(embedded * 100 / total)}%`;
1906
+ }
1907
+ /** Mnemon's reason for a failed call, without the usage it prints after its `Error:` line. */
1908
+ function cliReason(error) {
1909
+ const detail = error instanceof Error ? error.message : String(error);
1910
+ return /\bError: ([^\n]+)/u.exec(detail)?.[1]?.trim() ?? detail.split("\n")[0].trim();
1911
+ }
1912
+ /** Whether a CLI call failed for this cause. */
1913
+ function cliFailure(error, reason) {
1914
+ return error instanceof MnemonCliError && error.reason === reason;
1915
+ }
1752
1916
  var MemorySpacesService = class {
1753
1917
  runner;
1754
1918
  config;
@@ -1973,23 +2137,137 @@ var MemorySpacesService = class {
1973
2137
  ...version === void 0 ? {} : { version }
1974
2138
  };
1975
2139
  }
1976
- /** Probe the effective Mnemon embedding runtime and its default Store coverage. */
2140
+ /**
2141
+ * Probe Mnemon's embedding runtime, and count the vectors of every Mnemon Native space:
2142
+ * `mnemon embed --status` counts only one Store, so a full count for it could read as the
2143
+ * health of every space while another one lacked vectors (#392).
2144
+ */
1977
2145
  async embeddingStatus(signal) {
1978
- const output = record(await this.runner.runJson(["embed", "--status"], signal === void 0 ? {} : { signal }));
1979
- const available = output?.embedding_available ?? output?.ollama_available;
1980
- const model = text(output?.model)?.trim();
1981
- const protocol = text(output?.protocol)?.trim();
1982
- const totalInsights = number(output?.total_insights);
1983
- const embedded = number(output?.embedded);
1984
- const coverage = text(output?.coverage)?.trim();
1985
- if (typeof available !== "boolean" || model === void 0 || model === "" || model.length > 200 || /[\u0000-\u001f\u007f]/u.test(model) || !Number.isInteger(totalInsights) || totalInsights < 0 || !Number.isInteger(embedded) || embedded < 0 || embedded > totalInsights || coverage === void 0 || !/^(?:100|\d{1,2})%$/u.test(coverage)) throw new Error("mnemon embed --status returned an invalid response");
2146
+ const native = this.memorySpaces.list().filter((body) => this.isNativeSpace(body) && existsSync(body.dbPath));
2147
+ let runtime;
2148
+ const spaces = [];
2149
+ for (const body of native) {
2150
+ const space = {
2151
+ memoryBodyId: body.id,
2152
+ name: body.name,
2153
+ active: body.active
2154
+ };
2155
+ try {
2156
+ const counts = embeddingCounts(await this.runner.runJson(["embed", "--status"], {
2157
+ store: body.id,
2158
+ database: body.dbPath,
2159
+ ...signal === void 0 ? {} : { signal }
2160
+ }));
2161
+ runtime ??= counts;
2162
+ spaces.push({
2163
+ ...space,
2164
+ totalInsights: counts.totalInsights,
2165
+ embedded: counts.embedded,
2166
+ coverage: coveragePercent(counts.embedded, counts.totalInsights)
2167
+ });
2168
+ } catch (error) {
2169
+ if (signal?.aborted === true) throw error;
2170
+ if (cliFailure(error, "no-database")) continue;
2171
+ spaces.push({
2172
+ ...space,
2173
+ totalInsights: 0,
2174
+ embedded: 0,
2175
+ coverage: "0%",
2176
+ error: cliReason(error)
2177
+ });
2178
+ }
2179
+ }
2180
+ runtime ??= await this.embeddingRuntime(signal);
2181
+ const counted = spaces.filter((space) => space.error === void 0);
2182
+ const totalInsights = counted.reduce((sum, space) => sum + space.totalInsights, 0);
2183
+ const embedded = counted.reduce((sum, space) => sum + space.embedded, 0);
1986
2184
  return {
1987
- available,
1988
- model,
2185
+ ...runtime,
1989
2186
  totalInsights,
1990
2187
  embedded,
1991
- coverage,
1992
- ...protocol !== void 0 && protocol.length <= 32 && !/[\u0000-\u001f\u007f]/u.test(protocol) ? { protocol } : {}
2188
+ coverage: coveragePercent(embedded, totalInsights),
2189
+ spaces
2190
+ };
2191
+ }
2192
+ /** Mnemon's embedding runtime, asked in a scratch data directory: no space could be counted, and Mnemon creates the Store it opens. */
2193
+ async embeddingRuntime(signal) {
2194
+ const directory = mkdtempSync(join(tmpdir(), "dsh-mnemon-embedding-"));
2195
+ try {
2196
+ return embeddingCounts(await this.runner.runJson([
2197
+ "--data-dir",
2198
+ directory,
2199
+ "embed",
2200
+ "--status"
2201
+ ], {
2202
+ globalFlags: false,
2203
+ ...signal === void 0 ? {} : { signal }
2204
+ }));
2205
+ } catch (error) {
2206
+ throw new Error(cliReason(error), { cause: error });
2207
+ } finally {
2208
+ rmSync(directory, {
2209
+ recursive: true,
2210
+ force: true
2211
+ });
2212
+ }
2213
+ }
2214
+ /**
2215
+ * Fill in the vectors a Mnemon Native space lacks, through the Host's own data directory and
2216
+ * embedding settings, which a terminal `mnemon embed --all` may not share (#392). Mnemon fills at
2217
+ * most 100 a call and keeps the vectors it wrote when a call is stopped, so the fill goes in steps
2218
+ * no longer than one CLI call, letting other memory work take the storage lock between them,
2219
+ * until none is missing, a step writes none, or a minute is up.
2220
+ */
2221
+ async embedMissing(memoryBodyId, signal) {
2222
+ this.assertWritable();
2223
+ const body = this.memorySpaces.get(validateMemorySpaceId(memoryBodyId));
2224
+ if (!this.isNativeSpace(body)) throw new Error(`${body.provider.label} keeps no Mnemon vectors to fill in`);
2225
+ const options = {
2226
+ store: body.id,
2227
+ database: body.dbPath,
2228
+ ...signal === void 0 ? {} : { signal }
2229
+ };
2230
+ const failed = (error) => new Error(cliFailure(error, "no-database") ? `Memory Space ${body.name} has no database` : cliReason(error), { cause: error });
2231
+ const count = async () => {
2232
+ try {
2233
+ return embeddingCounts(await this.runner.runJson(["embed", "--status"], options));
2234
+ } catch (error) {
2235
+ throw failed(error);
2236
+ }
2237
+ };
2238
+ const step = Math.min(this.config.timeoutMs, EMBED_FILL_STEP_MS);
2239
+ const deadline = Date.now() + EMBED_FILL_BUDGET_MS;
2240
+ const first = await count();
2241
+ let last = first;
2242
+ let stopped;
2243
+ while (last.embedded < last.totalInsights) {
2244
+ if (Date.now() + step > deadline) {
2245
+ stopped = "time";
2246
+ break;
2247
+ }
2248
+ try {
2249
+ await this.runner.runText(["embed", "--all"], {
2250
+ ...options,
2251
+ timeoutMs: step
2252
+ });
2253
+ } catch (error) {
2254
+ if (!cliFailure(error, "timeout")) throw failed(error);
2255
+ }
2256
+ const next = await count();
2257
+ const progressed = next.embedded > last.embedded;
2258
+ last = next;
2259
+ if (!progressed) {
2260
+ stopped = "refused";
2261
+ break;
2262
+ }
2263
+ }
2264
+ const remaining = last.totalInsights - last.embedded;
2265
+ return {
2266
+ memoryBodyId: body.id,
2267
+ filled: Math.max(0, last.embedded - first.embedded),
2268
+ remaining,
2269
+ model: last.model,
2270
+ ...remaining > 0 && stopped !== void 0 ? { stopped } : {}
1993
2271
  };
1994
2272
  }
1995
2273
  async status(signal) {
@@ -3061,129 +3339,6 @@ var MemorySpacesService = class {
3061
3339
  }
3062
3340
  };
3063
3341
  //#endregion
3064
- //#region src/runner.ts
3065
- var MnemonCliError = class extends Error {
3066
- constructor(message) {
3067
- super(message);
3068
- this.name = "MnemonCliError";
3069
- }
3070
- };
3071
- const EMBEDDING_ENVIRONMENT_KEYS = /* @__PURE__ */ new Set([
3072
- "MNEMON_EMBED_ENDPOINT",
3073
- "MNEMON_EMBED_MODEL",
3074
- "MNEMON_EMBED_API_KEY",
3075
- "MNEMON_EMBED_PROTOCOL"
3076
- ]);
3077
- /**
3078
- * Explain a CLI call that produced no result. Only a failed launch means the
3079
- * executable is missing or unusable, so only that case carries the install
3080
- * hint; a timeout, a cancellation or an oversized output names its own cause.
3081
- */
3082
- function processFailureMessage(error, args) {
3083
- const detail = error instanceof Error ? error.message : String(error);
3084
- const reason = error instanceof ProcessError ? error.reason : "launch";
3085
- const command = args.find((arg) => !arg.startsWith("-"));
3086
- if (reason === "output-limit") return `mnemon ${command ?? "command"} stopped: ${detail.replace(/^mnemon /u, "")}`;
3087
- if (reason === "timeout" && command !== void 0) return detail.replace(/^mnemon /u, `mnemon ${command} `);
3088
- if (reason !== "launch") return detail;
3089
- 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."}`;
3090
- }
3091
- /** Preserve the Host environment while making saved embedding overrides authoritative. */
3092
- function processEnvironment(config) {
3093
- if (!config.embedding.enabled) return void 0;
3094
- return {
3095
- ...Object.fromEntries(Object.entries(process.env).filter(([key]) => !EMBEDDING_ENVIRONMENT_KEYS.has(key.toUpperCase()))),
3096
- MNEMON_EMBED_ENDPOINT: config.embedding.endpoint,
3097
- MNEMON_EMBED_MODEL: config.embedding.model,
3098
- MNEMON_EMBED_API_KEY: config.embedding.apiKey,
3099
- ...config.embedding.protocol === "auto" ? {} : { MNEMON_EMBED_PROTOCOL: config.embedding.protocol }
3100
- };
3101
- }
3102
- function createRunner(config, processRunner = runProcess) {
3103
- const currentCommand = () => findMnemonCommand(config) ?? config.cliPath ?? "mnemon";
3104
- const globalArgs = (store) => {
3105
- const args = ["--data-dir", effectiveDataDir()];
3106
- if (store !== void 0) args.push("--store", store);
3107
- else if (config.store !== void 0) args.push("--store", config.store);
3108
- return args;
3109
- };
3110
- const effectiveDataDir = () => config.dataDir;
3111
- const persistedStore = () => {
3112
- const active = join(effectiveDataDir(), "active");
3113
- if (existsSync(active)) try {
3114
- const value = readFileSync(active, "utf8").trim();
3115
- if (/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(value)) return value;
3116
- } catch {}
3117
- return "default";
3118
- };
3119
- const launch = async (args, options = {}) => {
3120
- if (options.signal?.aborted === true) throw new MnemonCliError(`mnemon command aborted: ${String(options.signal.reason ?? "cancelled")}`);
3121
- const argv = options.globalFlags === false ? [...args] : [...globalArgs(options.store), ...args];
3122
- const environment = processEnvironment(config);
3123
- const processOptions = {
3124
- timeoutMs: config.timeoutMs,
3125
- ...environment === void 0 ? {} : { env: environment },
3126
- ...options.signal === void 0 ? {} : { signal: options.signal },
3127
- ...options.maxOutputBytes === void 0 ? {} : { maxOutputBytes: options.maxOutputBytes }
3128
- };
3129
- let result;
3130
- try {
3131
- const invocation = resolveMnemonInvocation(currentCommand(), argv, environment);
3132
- result = await processRunner(invocation.command, invocation.args, {
3133
- ...processOptions,
3134
- ...invocation.env === void 0 ? {} : { env: invocation.env }
3135
- });
3136
- } catch (error) {
3137
- throw new MnemonCliError(processFailureMessage(error, args));
3138
- }
3139
- if (result.exitCode !== 0) {
3140
- const detail = result.stderr.trim() || result.stdout.trim() || "no output";
3141
- throw new MnemonCliError(`mnemon ${args.join(" ")} exited ${String(result.exitCode)}: ${detail}`);
3142
- }
3143
- return result.stdout;
3144
- };
3145
- const execute = (args, options = {}) => {
3146
- return withMemoryStorageLock(effectiveDataDir(), () => launch(args, options));
3147
- };
3148
- return {
3149
- get command() {
3150
- return currentCommand();
3151
- },
3152
- get commandFound() {
3153
- const found = findMnemonCommand(config);
3154
- return found !== void 0 && isMnemonExecutable(found);
3155
- },
3156
- async runJson(args, options) {
3157
- const stdout = await execute(args, options);
3158
- try {
3159
- return JSON.parse(stdout);
3160
- } catch {
3161
- throw new MnemonCliError(`mnemon ${args.join(" ")} returned invalid JSON`);
3162
- }
3163
- },
3164
- runText: execute,
3165
- runTextBatch(commands) {
3166
- return withMemoryStorageLock(effectiveDataDir(), async () => {
3167
- const outputs = [];
3168
- for (const command of commands) outputs.push(await launch(command.args, command.options));
3169
- return outputs;
3170
- });
3171
- },
3172
- effectiveDataDir() {
3173
- return effectiveDataDir();
3174
- },
3175
- persistedStore() {
3176
- return persistedStore();
3177
- },
3178
- effectiveStore() {
3179
- if (config.store !== void 0) return config.store;
3180
- const fromEnvironment = process.env.MNEMON_STORE?.trim();
3181
- if (fromEnvironment !== void 0 && fromEnvironment !== "") return fromEnvironment;
3182
- return persistedStore();
3183
- }
3184
- };
3185
- }
3186
- //#endregion
3187
3342
  //#region src/config.ts
3188
3343
  const MemorySpacesConfig = z.object({
3189
3344
  dataDir: z.string(),
@@ -3427,6 +3582,28 @@ function placementDecision(value) {
3427
3582
  ...memoryInputText(input.subagentProvider, "placement decision subagentProvider", 500, false) === void 0 ? {} : { subagentProvider: memoryInputText(input.subagentProvider, "placement decision subagentProvider", 500, false) }
3428
3583
  };
3429
3584
  }
3585
+ /**
3586
+ * Why this turn's View cannot forget from a Memory Space it does not read (#390). The View is
3587
+ * pinned for the turn, so switching a space on reaches a forget from the next turn only, and
3588
+ * whether a space is on stays the user's choice.
3589
+ */
3590
+ function outsideView(service, memoryBodyId) {
3591
+ const catalog = service.spaceDirectory();
3592
+ const body = catalog.items.find((candidate) => candidate.id === memoryBodyId);
3593
+ if (body === void 0) return `Memory Space ${JSON.stringify(memoryBodyId)} does not exist`;
3594
+ const space = `Memory Space ${JSON.stringify(memoryBodyId)} (${body.name})`;
3595
+ if (!body.active) return `${space} is switched off, so this turn's View does not read it and cannot forget from it. Whether it is on is the user's choice, on the Memory Spaces page; once it is on, a forget there works from the next turn`;
3596
+ if (body.providerEnabled === false) return `${space} uses ${body.provider.label}, which is turned off on the dsh-mnemon page under Plugins`;
3597
+ const provider = catalog.providers.find((candidate) => candidate.id === body.provider.id);
3598
+ if (provider?.serviceConfigured === false) return `${space} uses ${body.provider.label}, which is not available here${(provider.typeId ?? provider.id) === "mnemon-native" ? ": the Mnemon CLI is not installed" : ""}`;
3599
+ return `${space} was switched on after this turn began, so this turn's View does not read it yet; a forget there works from the next turn`;
3600
+ }
3601
+ /** The switched-off spaces a forget cannot reach this turn, named only when there are some (#390). */
3602
+ function switchedOffSpaces(service) {
3603
+ const off = service.spaceDirectory().items.filter((body) => !body.active);
3604
+ if (off.length === 0) return "";
3605
+ return `. Switched-off spaces (${off.slice(0, 5).map((body) => JSON.stringify(body.name)).join(", ")}${off.length > 5 ? ` and ${off.length - 5} more` : ""}) are outside this View; one the user switches on is read from the next turn`;
3606
+ }
3430
3607
  function managementResult(service, value) {
3431
3608
  return {
3432
3609
  revision: service.memoryRevision(),
@@ -3483,6 +3660,7 @@ async function manageMemorySpaces(service, request) {
3483
3660
  }
3484
3661
  if (!request.confirmed) throw new Error("Memory Spaces management mutation requires explicit confirmation");
3485
3662
  switch (request.operation) {
3663
+ case "embedding-fill": return managementResult(service, await service.embedMissing(memoryInputText(input.memoryBodyId, "memoryBodyId", 300), request.signal));
3486
3664
  case "provider-service-update": {
3487
3665
  const providerId = memoryInputText(input.providerId, "providerId", 128);
3488
3666
  await service.updateProviderService(providerId, scalarRecord(input.settings, "settings") ?? {}, memoryInputStringArray(input.clearSecrets, "clearSecrets", 100) ?? [], input.enabled === void 0 ? true : input.enabled === true, request.signal);
@@ -4033,8 +4211,10 @@ function createMemorySpacesSource(providerSnapshot, config = {}) {
4033
4211
  result = await service.link(sourceId, targetId, edge, weight, memoryInputText(input.reason, "reason", 1e3, false), request.signal, bodyId);
4034
4212
  } else if (request.offer.sourceActionId === "forget") {
4035
4213
  const id = memoryInputText(input.id, "id", 2e3);
4214
+ const named = memoryInputText(input.memoryBodyId, "memoryBodyId", 300, false);
4215
+ if (named !== void 0 && !allowedBodies.includes(named)) throw new Error(outsideView(service, named));
4036
4216
  bodyId = await admittedOwner(id);
4037
- 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");
4217
+ 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${switchedOffSpaces(service)}`);
4038
4218
  result = await service.forget(id, request.signal, bodyId);
4039
4219
  } else throw new Error(`unsupported Memory Spaces action: ${request.offer.sourceActionId}`);
4040
4220
  return createMemoryMutationReceipt(request.view.id, request.offer.id, context.sourceInstanceKey, service.memoryRevision(), {
@@ -1,5 +1,5 @@
1
1
  import { CATEGORIES, EDGE_TYPES, INTENTS, SOURCES } from "./contracts.js";
2
- import { i as NORMALIZED_RELEVANCE_SCORE, n as ProcessError, r as runProcess, t as DEFAULT_MAX_OUTPUT_BYTES } from "./process-DIK9NnTg.js";
2
+ import { i as runProcess, n as DEFAULT_MAX_OUTPUT_BYTES, r as ProcessError, t as NORMALIZED_RELEVANCE_SCORE } from "./adapter-D-BnWkko.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) {
@@ -26,6 +26,10 @@ export interface MemorySpacesPageClient {
26
26
  summary: string;
27
27
  action: string;
28
28
  memoryBodyIds: string[];
29
+ unembedded?: Array<{
30
+ memoryBodyId?: string;
31
+ id?: string;
32
+ }>;
29
33
  }>;
30
34
  forget(id: string, memoryBodyId?: string): Promise<Record<string, unknown>>;
31
35
  createBody(request: CreateMemorySpaceRequest): Promise<MemorySpace>;
@@ -525,9 +525,38 @@ export interface MnemonEmbeddingStatus {
525
525
  model: string;
526
526
  /** Protocol Mnemon resolved for the embedding endpoint; omitted when the CLI does not report one. */
527
527
  protocol?: string;
528
+ /** Across the spaces in `spaces` that could be counted; 0 when no space has a database. */
528
529
  totalInsights: number;
529
530
  embedded: number;
530
531
  coverage: string;
532
+ /** Each Mnemon Native space with a database, as `mnemon --store <id> embed --status` counts it (#392). */
533
+ spaces?: MnemonEmbeddingSpaceStatus[];
534
+ }
535
+ /** One Mnemon Native space's vector coverage. */
536
+ export interface MnemonEmbeddingSpaceStatus {
537
+ memoryBodyId: string;
538
+ name: string;
539
+ active: boolean;
540
+ totalInsights: number;
541
+ embedded: number;
542
+ coverage: string;
543
+ /** Why the space could not be counted; its counts are then 0 and stay out of the total. */
544
+ error?: string;
545
+ }
546
+ /** What one fill of a Mnemon Native space's missing vectors did (#392). */
547
+ export interface MnemonEmbeddingFill {
548
+ memoryBodyId: string;
549
+ /** Vectors the fill wrote. */
550
+ filled: number;
551
+ /** Memories of the space still without a vector when it stopped. */
552
+ remaining: number;
553
+ /** The embedding model Mnemon used. */
554
+ model: string;
555
+ /**
556
+ * Why it stopped while memories remain: its minute ran out (`time`), or a step wrote no vector,
557
+ * so the embedding service returned none for the memories left (`refused`).
558
+ */
559
+ stopped?: 'time' | 'refused';
531
560
  }
532
561
  /** Domain status only; workbench/lifecycle status belongs to the default adapter. */
533
562
  export interface MemorySpacesStatus {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mnemon-source-memory-spaces",
3
- "version": "0.5.19",
3
+ "version": "0.5.21",
4
4
  "description": "Memory Spaces Source and its private Provider SDK.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -55,17 +55,16 @@
55
55
  },
56
56
  "peerDependencies": {
57
57
  "@deepseek-ai/cordis": "^4.0.1",
58
- "@deepseek-ai/dsh-client-ui-primitives": "^0.1.7-rc.2 || ^0.2.0-rc.1",
59
58
  "dsh-mnemon": "^0.5.19",
60
59
  "react": "^18.2.0"
61
60
  },
62
61
  "devDependencies": {
63
- "@deepseek-ai/dsh-client-ui-primitives": "0.1.7-rc.2",
62
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.1",
64
63
  "@testing-library/react": "^16.3.0",
65
64
  "@types/node": "^22.0.0",
66
65
  "@types/react": "^18.3.0",
67
66
  "@types/react-dom": "^18.3.0",
68
- "dsh-mnemon": "^0.5.29",
67
+ "dsh-mnemon": "^0.5.31",
69
68
  "dsh-mnemon-provider-byterover": "^0.5.5",
70
69
  "dsh-mnemon-provider-hindsight": "^0.5.6",
71
70
  "dsh-mnemon-provider-holographic": "^0.5.6",
@@ -98,9 +97,9 @@
98
97
  "micromark-util-sanitize-uri": "^2.0.1",
99
98
  "micromark-util-symbol": "^2.0.1",
100
99
  "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",
100
+ "@deepseek-ai/dsh-client-store": "0.2.1-rc.1",
101
+ "@deepseek-ai/dsh-util-code-language": "0.2.1-rc.1",
102
+ "@deepseek-ai/dsh-util-workspace-path": "0.2.1-rc.1",
104
103
  "diff": "^9.0.0",
105
104
  "immer": "^10.1.1",
106
105
  "simple-icons": "16.31.0",