memorix 1.10.2 → 1.10.3

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.
Files changed (66) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +3 -1
  3. package/README.zh-CN.md +3 -1
  4. package/dist/cli/index.js +397 -215
  5. package/dist/cli/memcode.js +0 -0
  6. package/dist/index.js +150 -38
  7. package/dist/maintenance-runner.js +108 -22
  8. package/dist/media-audio-runner.js +108 -22
  9. package/dist/media-video-runner.js +108 -22
  10. package/dist/memcode-runtime/CHANGELOG.md +20 -0
  11. package/dist/sdk.js +149 -37
  12. package/dist/types.d.ts +1 -1
  13. package/dist/vector-backfill-runner.js +108 -22
  14. package/docs/CONFIGURATION.md +34 -0
  15. package/docs/DEVELOPMENT.md +1 -1
  16. package/docs/INTEGRATIONS.md +1 -1
  17. package/docs/README.md +2 -1
  18. package/docs/ROADMAP-1.9.12-2.0.md +1 -1
  19. package/docs/SETUP.md +19 -4
  20. package/package.json +1 -1
  21. package/plugins/antigravity/memorix/plugin.json +1 -1
  22. package/plugins/claude/memorix/.claude-plugin/plugin.json +1 -1
  23. package/plugins/codebuddy/memorix/.codebuddy-plugin/plugin.json +1 -1
  24. package/plugins/codex/memorix/.codex-plugin/plugin.json +1 -1
  25. package/plugins/copilot/memorix/plugin.json +1 -1
  26. package/plugins/gemini/memorix/gemini-extension.json +1 -1
  27. package/plugins/hermes/memorix/plugin.yaml +1 -1
  28. package/plugins/omp/memorix/package.json +1 -1
  29. package/plugins/openclaw/memorix/.codex-plugin/plugin.json +1 -1
  30. package/plugins/pi/memorix/package.json +1 -1
  31. package/server.json +2 -2
  32. package/src/cli/commands/agent-integrations.ts +1 -1
  33. package/src/cli/commands/background.ts +1 -1
  34. package/src/cli/commands/context.ts +3 -2
  35. package/src/cli/commands/doctor.ts +9 -0
  36. package/src/cli/commands/explain.ts +3 -2
  37. package/src/cli/commands/init.ts +6 -2
  38. package/src/cli/commands/setup.ts +9 -6
  39. package/src/cli/commands/uninstall.ts +15 -0
  40. package/src/cli/tui/App.tsx +9 -16
  41. package/src/cli/tui/ConfigureView.tsx +2 -0
  42. package/src/codegraph/auto-context.ts +1 -1
  43. package/src/codegraph/store.ts +37 -0
  44. package/src/codegraph/types.ts +3 -0
  45. package/src/config/dotenv-loader.ts +1 -0
  46. package/src/config/resolved-config.ts +7 -2
  47. package/src/config/toml-loader.ts +1 -0
  48. package/src/config/yaml-loader.ts +4 -2
  49. package/src/dashboard/server.ts +5 -6
  50. package/src/hooks/handler.ts +0 -1
  51. package/src/integrations/registry.ts +2 -1
  52. package/src/llm/provider.ts +2 -1
  53. package/src/memory/observations.ts +61 -17
  54. package/src/multimodal/image-loader.ts +2 -2
  55. package/src/runtime/open-browser.ts +25 -0
  56. package/src/server.ts +2 -2
  57. package/src/store/orama-store.ts +27 -3
  58. package/src/types.ts +1 -1
  59. package/src/workspace/mcp-adapters/pi.ts +58 -0
  60. package/plugins/pi/memorix/skills/memorix-git-memory/SKILL.md +0 -26
  61. package/plugins/pi/memorix/skills/memorix-memory/SKILL.md +0 -51
  62. package/plugins/pi/memorix/skills/memorix-mini-skills/SKILL.md +0 -31
  63. package/plugins/pi/memorix/skills/memorix-orchestrate/SKILL.md +0 -28
  64. package/plugins/pi/memorix/skills/memorix-reasoning/SKILL.md +0 -30
  65. package/plugins/pi/memorix/skills/memorix-sessions/SKILL.md +0 -25
  66. package/plugins/pi/memorix/skills/memorix-troubleshooting/SKILL.md +0 -27
File without changes
package/dist/index.js CHANGED
@@ -3842,7 +3842,8 @@ function getResolvedConfig(options = {}) {
3842
3842
  const isRequesty = memoryLlmProvider === "requesty";
3843
3843
  const isApiRoute = memoryLlmProvider === "apiroute";
3844
3844
  const isCheaperInference = memoryLlmProvider === "cheaperinference";
3845
- const usesPresetKeyOnly = isAtlasCloud || isRequesty || isApiRoute || isCheaperInference;
3845
+ const isRuncrate = memoryLlmProvider === "runcrate";
3846
+ const usesPresetKeyOnly = isAtlasCloud || isRequesty || isApiRoute || isCheaperInference || isRuncrate;
3846
3847
  const memoryLlmApiKey = first(
3847
3848
  process.env.MEMORIX_LLM_API_KEY,
3848
3849
  process.env.MEMORIX_API_KEY,
@@ -3850,7 +3851,7 @@ function getResolvedConfig(options = {}) {
3850
3851
  yaml.llm?.apiKey,
3851
3852
  legacy.llm?.apiKey,
3852
3853
  // Never borrow another provider's credentials for these gateway presets.
3853
- isAtlasCloud ? process.env.ATLASCLOUD_API_KEY : isRequesty ? process.env.REQUESTY_API_KEY : isApiRoute ? process.env.API_ROUTE_API_KEY : isCheaperInference ? process.env.CHEAPER_INFERENCE_API_KEY : process.env.OPENAI_API_KEY,
3854
+ isAtlasCloud ? process.env.ATLASCLOUD_API_KEY : isRequesty ? process.env.REQUESTY_API_KEY : isApiRoute ? process.env.API_ROUTE_API_KEY : isCheaperInference ? process.env.CHEAPER_INFERENCE_API_KEY : isRuncrate ? process.env.RUNCRATE_API_KEY : process.env.OPENAI_API_KEY,
3854
3855
  usesPresetKeyOnly ? void 0 : process.env.ANTHROPIC_API_KEY,
3855
3856
  usesPresetKeyOnly ? void 0 : openRouterMemoryLlmApiKey
3856
3857
  );
@@ -3921,6 +3922,7 @@ function getResolvedConfig(options = {}) {
3921
3922
  codegraph: {
3922
3923
  excludePatterns: firstArray(toml.codegraph?.exclude_patterns, yaml.codegraph?.excludePatterns),
3923
3924
  maxFileBytes: firstNumber(toml.codegraph?.max_file_bytes, yaml.codegraph?.maxFileBytes),
3925
+ autoRefresh: first(toml.codegraph?.auto_refresh, yaml.codegraph?.autoRefresh, "auto"),
3924
3926
  externalContext: first(
3925
3927
  normalizeExternalContext(process.env.MEMORIX_CODEGRAPH_EXTERNAL_CONTEXT),
3926
3928
  toml.codegraph?.external_context,
@@ -4035,6 +4037,7 @@ function getEnvSourceNames() {
4035
4037
  "REQUESTY_API_KEY",
4036
4038
  "API_ROUTE_API_KEY",
4037
4039
  "CHEAPER_INFERENCE_API_KEY",
4040
+ "RUNCRATE_API_KEY",
4038
4041
  "ATLASCLOUD_API_KEY"
4039
4042
  ].filter((name) => process.env[name]);
4040
4043
  }
@@ -7030,6 +7033,7 @@ var init_provider2 = __esm({
7030
7033
  requesty: { baseUrl: "https://router.requesty.ai/v1", model: "openai/gpt-4.1-nano" },
7031
7034
  apiroute: { baseUrl: "https://global.api-route.com/v1", model: "deepseek-v4.1-flash" },
7032
7035
  cheaperinference: { baseUrl: "https://api.cheaperinference.com/v1", model: "gpt-5.4-mini" },
7036
+ runcrate: { baseUrl: "https://api.runcrate.ai/v1", model: "deepseek-ai/DeepSeek-V4.1-Flash" },
7033
7037
  atlascloud: { baseUrl: "https://api.atlascloud.ai/v1", model: "deepseek-ai/deepseek-v3.2" },
7034
7038
  custom: { baseUrl: "http://localhost:11434/v1", model: "llama3" }
7035
7039
  };
@@ -8740,10 +8744,18 @@ __export(orama_store_exports, {
8740
8744
  queueSemanticVector: () => queueSemanticVector,
8741
8745
  removeObservation: () => removeObservation,
8742
8746
  resetDb: () => resetDb,
8747
+ resolveSearchFuzzyTolerance: () => resolveSearchFuzzyTolerance,
8743
8748
  searchObservations: () => searchObservations,
8744
8749
  updateObservationMetadata: () => updateObservationMetadata
8745
8750
  });
8746
8751
  import { components, create, insert as insert2, insertMultiple, search, remove as remove2, update, count, getByID } from "@orama/orama";
8752
+ function resolveSearchFuzzyTolerance(query, quality) {
8753
+ if (quality === "fast") return void 0;
8754
+ const characters = [...query];
8755
+ const cjkCount = characters.filter((char) => /[\u3400-\u4dbf\u4e00-\u9fff\u3040-\u30ff\uac00-\ud7af]/u.test(char)).length;
8756
+ if (characters.length > 0 && cjkCount / characters.length > 0.3) return void 0;
8757
+ return query.length > 6 ? 2 : 1;
8758
+ }
8747
8759
  function rememberSearchMode(key, value) {
8748
8760
  if (!lastSearchModeByProject.has(key) && lastSearchModeByProject.size >= MAX_SEARCH_MODE_KEYS) {
8749
8761
  const oldest = lastSearchModeByProject.keys().next().value;
@@ -9389,7 +9401,10 @@ async function searchObservations(options) {
9389
9401
  // Fuzzy tolerance: allow 1-char typos for short queries, 2 for longer
9390
9402
  // Fuzzy matching is useful for ordinary recall, but grows sharply with
9391
9403
  // corpus size. The fast profile deliberately uses exact lexical matching.
9392
- ...hasQuery && quality !== "fast" ? { tolerance: originalQuery.length > 6 ? 2 : 1 } : {}
9404
+ ...hasQuery ? (() => {
9405
+ const tolerance = resolveSearchFuzzyTolerance(originalQuery, quality);
9406
+ return tolerance === void 0 ? {} : { tolerance };
9407
+ })() : {}
9393
9408
  };
9394
9409
  let queryVector = null;
9395
9410
  let embeddingProviderForSearch = null;
@@ -9620,14 +9635,16 @@ async function searchObservations(options) {
9620
9635
  filesModified: doc.filesModified?.split?.("\n") ?? (Array.isArray(doc.filesModified) ? doc.filesModified : [])
9621
9636
  });
9622
9637
  }
9638
+ const topScore = Math.max(...intermediate.map((entry) => entry.score));
9639
+ const affinityTieWindow = topScore * 0.92;
9623
9640
  intermediate = intermediate.map((entry) => {
9624
9641
  const memory = memoryContentMap.get(entry.id);
9625
9642
  if (!memory) return entry;
9626
9643
  const { score: affinityScore } = calculateProjectAffinity(memory, affinityContext);
9644
+ if (entry.score < affinityTieWindow) return entry;
9627
9645
  return {
9628
9646
  ...entry,
9629
- score: entry.score * affinityScore
9630
- // Apply affinity as multiplier
9647
+ score: entry.score * (0.98 + affinityScore * 0.02)
9631
9648
  };
9632
9649
  });
9633
9650
  intermediate.sort((a, b) => b.score - a.score);
@@ -149131,6 +149148,7 @@ var init_store = __esm({
149131
149148
  recordCodeStateSnapshot(input) {
149132
149149
  const id = randomUUID11();
149133
149150
  let snapshot;
149151
+ let compactNeeded = false;
149134
149152
  const tx = this.db.transaction(() => {
149135
149153
  const previous = this.db.prepare(
149136
149154
  "SELECT id, sourceEpoch FROM code_state_snapshots WHERE projectId = ? ORDER BY sourceEpoch DESC LIMIT 1"
@@ -149174,6 +149192,26 @@ var init_store = __esm({
149174
149192
  for (const file of snapshotFileRows) {
149175
149193
  insertSnapshotFile.run(id, file.projectId, file.id, file.path, file.contentHash);
149176
149194
  }
149195
+ const staleSymbolIds = this.db.prepare(
149196
+ "SELECT id FROM code_symbols WHERE projectId = ? AND stale = 1"
149197
+ ).all(input.projectId).map((row) => row.id);
149198
+ if (staleSymbolIds.length > 0) {
149199
+ const placeholders = staleSymbolIds.map(() => "?").join(", ");
149200
+ this.db.prepare(
149201
+ `DELETE FROM code_edges WHERE projectId = ? AND (fromSymbolId IN (${placeholders}) OR toSymbolId IN (${placeholders}))`
149202
+ ).run(input.projectId, ...staleSymbolIds, ...staleSymbolIds);
149203
+ this.db.prepare("DELETE FROM code_symbols WHERE projectId = ? AND stale = 1").run(input.projectId);
149204
+ compactNeeded = true;
149205
+ }
149206
+ const oldSnapshots = this.db.prepare(
149207
+ "SELECT id FROM code_state_snapshots WHERE projectId = ? ORDER BY sourceEpoch DESC LIMIT -1 OFFSET 2"
149208
+ ).all(input.projectId).map((row) => row.id);
149209
+ if (oldSnapshots.length > 0) {
149210
+ const placeholders = oldSnapshots.map(() => "?").join(", ");
149211
+ this.db.prepare(`DELETE FROM code_state_snapshot_files WHERE snapshotId IN (${placeholders})`).run(...oldSnapshots);
149212
+ this.db.prepare(`DELETE FROM code_state_snapshots WHERE id IN (${placeholders})`).run(...oldSnapshots);
149213
+ compactNeeded = true;
149214
+ }
149177
149215
  snapshot = {
149178
149216
  ...input,
149179
149217
  id,
@@ -149182,11 +149220,24 @@ var init_store = __esm({
149182
149220
  };
149183
149221
  });
149184
149222
  tx();
149223
+ if (compactNeeded) this.compactStorage();
149185
149224
  return snapshot;
149186
149225
  }
149226
+ /** Reclaim WAL/free pages after a derived codegraph sweep. */
149227
+ compactStorage() {
149228
+ try {
149229
+ this.db.pragma("wal_checkpoint(TRUNCATE)");
149230
+ } catch {
149231
+ }
149232
+ try {
149233
+ this.db.exec("VACUUM");
149234
+ } catch {
149235
+ }
149236
+ }
149187
149237
  status(projectId) {
149188
149238
  const files = this.db.prepare(`SELECT COUNT(*) AS count FROM code_files WHERE projectId = ?`).get(projectId).count;
149189
149239
  const symbols = this.db.prepare(`SELECT COUNT(*) AS count FROM code_symbols WHERE projectId = ? AND stale = 0`).get(projectId).count;
149240
+ const staleSymbols = this.db.prepare(`SELECT COUNT(*) AS count FROM code_symbols WHERE projectId = ? AND stale = 1`).get(projectId).count;
149190
149241
  const edges = this.db.prepare(`SELECT COUNT(*) AS count FROM code_edges WHERE projectId = ?`).get(projectId).count;
149191
149242
  const refs = this.db.prepare(`SELECT COUNT(*) AS count FROM observation_code_refs WHERE projectId = ?`).get(projectId).count;
149192
149243
  const semanticSymbols = this.db.prepare(`SELECT COUNT(*) AS count FROM code_symbols WHERE projectId = ? AND stale = 0 AND source = 'typescript-compiler'`).get(projectId).count;
@@ -149194,6 +149245,8 @@ var init_store = __esm({
149194
149245
  const parserErrors = this.db.prepare(`SELECT COUNT(*) AS count FROM code_files WHERE projectId = ? AND parserError IS NOT NULL`).get(projectId).count;
149195
149246
  const latest = this.db.prepare(`SELECT MAX(indexedAt) AS indexedAt FROM code_files WHERE projectId = ?`).get(projectId);
149196
149247
  const latestSnapshot = this.latestSnapshot(projectId);
149248
+ const snapshots = this.db.prepare(`SELECT COUNT(*) AS count FROM code_state_snapshots WHERE projectId = ?`).get(projectId).count;
149249
+ const snapshotFiles = this.db.prepare(`SELECT COUNT(*) AS count FROM code_state_snapshot_files WHERE projectId = ?`).get(projectId).count;
149197
149250
  return {
149198
149251
  provider: "lite",
149199
149252
  files,
@@ -149203,6 +149256,9 @@ var init_store = __esm({
149203
149256
  semanticSymbols,
149204
149257
  semanticEdges,
149205
149258
  parserErrors,
149259
+ staleSymbols,
149260
+ snapshots,
149261
+ snapshotFiles,
149206
149262
  ...latest?.indexedAt ? { indexedAt: latest.indexedAt } : {},
149207
149263
  ...latestSnapshot ? { latestSnapshot } : {}
149208
149264
  };
@@ -153905,10 +153961,22 @@ function resetObservationRuntime() {
153905
153961
  loadedObservationStore = null;
153906
153962
  embeddingWriteMode = "background";
153907
153963
  embeddingWorkerProjectRoot = void 0;
153908
- vectorMissingIds.clear();
153964
+ clearVectorMissingIds();
153909
153965
  vectorSchemaUpgradePromise = null;
153910
153966
  embeddingFailureLogTimestamps.clear();
153911
153967
  }
153968
+ function markVectorMissing(observationId2, projectId) {
153969
+ vectorMissingIds.add(observationId2);
153970
+ vectorMissingProjectIds.set(observationId2, projectId);
153971
+ }
153972
+ function clearVectorMissing(observationId2) {
153973
+ vectorMissingIds.delete(observationId2);
153974
+ vectorMissingProjectIds.delete(observationId2);
153975
+ }
153976
+ function clearVectorMissingIds() {
153977
+ vectorMissingIds.clear();
153978
+ vectorMissingProjectIds.clear();
153979
+ }
153912
153980
  function logEmbeddingFailureOnce(key, message) {
153913
153981
  const now3 = Date.now();
153914
153982
  const last = embeddingFailureLogTimestamps.get(key) ?? 0;
@@ -154028,10 +154096,13 @@ function isVectorCompatibleWithCurrentIndex(embedding) {
154028
154096
  }
154029
154097
  async function upgradeVectorSchemaAfterFirstEmbedding(embedding) {
154030
154098
  if (isVectorCompatibleWithCurrentIndex(embedding)) return true;
154031
- if (getVectorDimensions() !== null || !embedding.every(Number.isFinite)) return false;
154099
+ if (!embedding.every(Number.isFinite)) return false;
154032
154100
  const targetProjectDir = projectDir;
154033
154101
  if (!vectorSchemaUpgradePromise) {
154034
- vectorSchemaUpgradePromise = reindexObservations().then(() => projectDir === targetProjectDir && isVectorCompatibleWithCurrentIndex(embedding)).catch(() => false).finally(() => {
154102
+ vectorSchemaUpgradePromise = getDb().then(async () => {
154103
+ if (getVectorDimensions() === null && observations.length > 0) await reindexObservations();
154104
+ return projectDir === targetProjectDir && isVectorCompatibleWithCurrentIndex(embedding);
154105
+ }).catch(() => false).finally(() => {
154035
154106
  vectorSchemaUpgradePromise = null;
154036
154107
  });
154037
154108
  }
@@ -154071,9 +154142,9 @@ async function initObservations(dir, options = {}) {
154071
154142
  }
154072
154143
  function scheduleObservationEmbedding(input) {
154073
154144
  const { observationId: observationId2, projectId, searchableText, doc } = input;
154074
- vectorMissingIds.add(observationId2);
154145
+ markVectorMissing(observationId2, projectId);
154075
154146
  if (isEmbeddingExplicitlyDisabled()) {
154076
- vectorMissingIds.delete(observationId2);
154147
+ clearVectorMissing(observationId2);
154077
154148
  return;
154078
154149
  }
154079
154150
  if (embeddingWriteMode === "deferred") {
@@ -154108,13 +154179,13 @@ function scheduleObservationEmbedding(input) {
154108
154179
  vector: embedding
154109
154180
  });
154110
154181
  }
154111
- vectorMissingIds.delete(observationId2);
154182
+ clearVectorMissing(observationId2);
154112
154183
  } catch {
154113
154184
  console.error(`[memorix] Embedding index update failed for obs-${observationId2} (kept in backfill queue)`);
154114
154185
  queueVectorBackfill(projectId);
154115
154186
  }
154116
154187
  } else if (isEmbeddingExplicitlyDisabled()) {
154117
- vectorMissingIds.delete(observationId2);
154188
+ clearVectorMissing(observationId2);
154118
154189
  } else {
154119
154190
  queueVectorBackfill(projectId);
154120
154191
  logEmbeddingFailureOnce(
@@ -154674,7 +154745,7 @@ async function reindexObservations() {
154674
154745
  if (observations.length === 0) return 0;
154675
154746
  await resetDb();
154676
154747
  searchIndexPrepared = false;
154677
- vectorMissingIds.clear();
154748
+ clearVectorMissingIds();
154678
154749
  let embeddings = observations.map(() => null);
154679
154750
  const provider2 = await getEmbeddingProvider();
154680
154751
  const canBatchEmbedAtStartup = provider2 !== null && !provider2.name.startsWith("api-");
@@ -154739,7 +154810,7 @@ async function reindexObservations() {
154739
154810
  };
154740
154811
  await insertObservation(doc);
154741
154812
  if (!compatibleEmbedding && !isEmbeddingExplicitlyDisabled()) {
154742
- vectorMissingIds.add(obs.id);
154813
+ markVectorMissing(obs.id, obs.projectId);
154743
154814
  }
154744
154815
  count2++;
154745
154816
  } catch (err) {
@@ -154756,7 +154827,17 @@ async function prepareSearchIndex(options = {}) {
154756
154827
  if (!isEmbeddingExplicitlyDisabled()) {
154757
154828
  const store = getObservationStore();
154758
154829
  const projects = await store.listProjectIds?.() ?? [];
154759
- for (const projectId of projects) queueVectorBackfill(projectId);
154830
+ await getDb({ allowNetworkProbe: false }).catch(() => void 0);
154831
+ const persistedIds = projectDir ? await getPersistentSemanticVectorIds(projectDir).catch(() => null) : null;
154832
+ for (const projectId of projects) {
154833
+ const projectObservations = await store.loadByProject(projectId);
154834
+ for (const observation of projectObservations) {
154835
+ if (!persistedIds?.has(observation.id)) markVectorMissing(observation.id, observation.projectId);
154836
+ }
154837
+ if (projectObservations.some((observation) => !persistedIds?.has(observation.id))) {
154838
+ queueVectorBackfill(projectId);
154839
+ }
154840
+ }
154760
154841
  }
154761
154842
  return 0;
154762
154843
  }
@@ -154770,13 +154851,13 @@ async function prepareSearchIndex(options = {}) {
154770
154851
  const hydratedProjectDir = projectDir;
154771
154852
  const queueMissingVectors = async () => {
154772
154853
  if (!hydratedProjectDir || projectDir !== hydratedProjectDir) return;
154773
- vectorMissingIds.clear();
154854
+ clearVectorMissingIds();
154774
154855
  if (!isEmbeddingExplicitlyDisabled()) {
154775
154856
  const persistedSemanticIds = await getPersistentSemanticVectorIds(hydratedProjectDir).catch(() => null);
154776
154857
  const projectsWithMissingVectors = /* @__PURE__ */ new Set();
154777
154858
  for (const obs of observations) {
154778
154859
  if (!hasObservationVector(obs.projectId, obs.id) && !persistedSemanticIds?.has(obs.id)) {
154779
- vectorMissingIds.add(obs.id);
154860
+ markVectorMissing(obs.id, obs.projectId);
154780
154861
  projectsWithMissingVectors.add(obs.projectId);
154781
154862
  }
154782
154863
  }
@@ -154794,6 +154875,9 @@ async function prepareSearchIndex(options = {}) {
154794
154875
  }
154795
154876
  function getVectorMissingIds(projectId) {
154796
154877
  if (!projectId) return [...vectorMissingIds];
154878
+ if (!corpusLoaded) {
154879
+ return [...vectorMissingIds].filter((id) => vectorMissingProjectIds.get(id) === projectId);
154880
+ }
154797
154881
  const observationById = new Map(observations.map((observation) => [observation.id, observation]));
154798
154882
  return [...vectorMissingIds].filter((id) => observationById.get(id)?.projectId === projectId);
154799
154883
  }
@@ -154831,7 +154915,8 @@ async function backfillVectorEmbeddings(options = {}) {
154831
154915
  return { attempted: 0, succeeded: 0, failed: 0 };
154832
154916
  }
154833
154917
  vectorBackfillRunning = true;
154834
- const observationById = new Map(observations.map((observation) => [observation.id, observation]));
154918
+ const sourceObservations = corpusLoaded ? observations : options.projectId ? await getObservationStore().loadByProject(options.projectId, { status: "active" }) : await getObservationStore().loadAll();
154919
+ const observationById = new Map(sourceObservations.map((observation) => [observation.id, observation]));
154835
154920
  const limit2 = Number.isFinite(options.limit) ? Math.max(1, Math.floor(options.limit)) : Number.POSITIVE_INFINITY;
154836
154921
  const ids = [...vectorMissingIds].filter((id) => !options.projectId || observationById.get(id)?.projectId === options.projectId).slice(0, limit2);
154837
154922
  let succeeded = 0;
@@ -154844,7 +154929,7 @@ async function backfillVectorEmbeddings(options = {}) {
154844
154929
  for (const id of ids) {
154845
154930
  const observation = observationById.get(id);
154846
154931
  if (!observation) {
154847
- vectorMissingIds.delete(id);
154932
+ clearVectorMissing(id);
154848
154933
  continue;
154849
154934
  }
154850
154935
  candidates.push({
@@ -154862,7 +154947,7 @@ async function backfillVectorEmbeddings(options = {}) {
154862
154947
  const provider2 = await getEmbeddingProvider();
154863
154948
  if (!provider2) {
154864
154949
  if (isEmbeddingExplicitlyDisabled()) {
154865
- for (const candidate of candidates) vectorMissingIds.delete(candidate.id);
154950
+ for (const candidate of candidates) clearVectorMissing(candidate.id);
154866
154951
  } else {
154867
154952
  recordFailure("embedding provider unavailable");
154868
154953
  failed += candidates.length;
@@ -154939,7 +155024,7 @@ async function backfillVectorEmbeddings(options = {}) {
154939
155024
  vector: embedding
154940
155025
  });
154941
155026
  }
154942
- vectorMissingIds.delete(id);
155027
+ clearVectorMissing(id);
154943
155028
  succeeded++;
154944
155029
  } catch (error) {
154945
155030
  recordFailure(vectorBackfillError(error));
@@ -154964,7 +155049,7 @@ async function backfillVectorEmbeddings(options = {}) {
154964
155049
  ...lastFailure ? { lastError: lastFailure } : {}
154965
155050
  };
154966
155051
  }
154967
- var observations, nextId, projectDir, searchIndexPrepared, embeddingWriteMode, embeddingWorkerProjectRoot, corpusLoaded, largeCorpusLazyMode, loadedObservationStore, DEFAULT_ORAMA_HYDRATION_THRESHOLD, vectorMissingIds, vectorBackfillRunning, vectorSchemaUpgradePromise, lastVectorBackfill, embeddingFailureLogTimestamps, EMBEDDING_FAILURE_LOG_COOLDOWN_MS, MAX_EMBEDDING_FAILURE_KEYS;
155052
+ var observations, nextId, projectDir, searchIndexPrepared, embeddingWriteMode, embeddingWorkerProjectRoot, corpusLoaded, largeCorpusLazyMode, loadedObservationStore, DEFAULT_ORAMA_HYDRATION_THRESHOLD, vectorMissingIds, vectorMissingProjectIds, vectorBackfillRunning, vectorSchemaUpgradePromise, lastVectorBackfill, embeddingFailureLogTimestamps, EMBEDDING_FAILURE_LOG_COOLDOWN_MS, MAX_EMBEDDING_FAILURE_KEYS;
154968
155053
  var init_observations = __esm({
154969
155054
  "src/memory/observations.ts"() {
154970
155055
  "use strict";
@@ -154989,6 +155074,7 @@ var init_observations = __esm({
154989
155074
  loadedObservationStore = null;
154990
155075
  DEFAULT_ORAMA_HYDRATION_THRESHOLD = 1e4;
154991
155076
  vectorMissingIds = /* @__PURE__ */ new Set();
155077
+ vectorMissingProjectIds = /* @__PURE__ */ new Map();
154992
155078
  vectorBackfillRunning = false;
154993
155079
  vectorSchemaUpgradePromise = null;
154994
155080
  lastVectorBackfill = null;
@@ -160554,7 +160640,7 @@ var init_request_context = __esm({
160554
160640
  function getMcpServerInfo() {
160555
160641
  return {
160556
160642
  name: "memorix",
160557
- version: true ? "1.10.2" : "1.0.1"
160643
+ version: true ? "1.10.3" : "1.0.1"
160558
160644
  };
160559
160645
  }
160560
160646
  function createMcpDiscoverResult(capabilities, serverInfo) {
@@ -164093,12 +164179,12 @@ function decideRefresh(input) {
164093
164179
  return { performed: false, reason: "fresh-enough", message: "Existing project scan is fresh enough." };
164094
164180
  }
164095
164181
  async function buildAutoProjectContext(input) {
164096
- const refreshMode = input.refresh ?? "auto";
164097
164182
  const now3 = input.now ?? /* @__PURE__ */ new Date();
164098
164183
  const task = input.task?.trim();
164099
164184
  const lens = resolveTaskLens(task);
164100
164185
  const continuationRequested = input.continuation === "always" || input.continuation !== "never" && isContinuationTask(task);
164101
164186
  const codegraphConfig = getResolvedConfig({ projectRoot: input.project.rootPath }).codegraph;
164187
+ const refreshMode = input.refresh ?? codegraphConfig.autoRefresh ?? "auto";
164102
164188
  const exclude = input.exclude ?? codegraphConfig.excludePatterns;
164103
164189
  const maxFileBytes = input.maxFileBytes ?? codegraphConfig.maxFileBytes;
164104
164190
  const store = new CodeGraphStore();
@@ -166602,6 +166688,30 @@ var init_export_import = __esm({
166602
166688
  }
166603
166689
  });
166604
166690
 
166691
+ // src/runtime/open-browser.ts
166692
+ import { spawn as spawn6 } from "child_process";
166693
+ function resolveLocalBrowserCommand(target, platform = process.platform) {
166694
+ const url = new URL(target);
166695
+ if (url.protocol !== "http:" || !LOCAL_HTTP_HOSTS.has(url.hostname) || !url.port || url.username || url.password) {
166696
+ throw new Error("Only unauthenticated loopback HTTP URLs can be opened automatically");
166697
+ }
166698
+ return platform === "win32" ? { command: "explorer.exe", args: [url.toString()] } : platform === "darwin" ? { command: "open", args: [url.toString()] } : { command: "xdg-open", args: [url.toString()] };
166699
+ }
166700
+ function openLocalBrowser(target) {
166701
+ const { command, args } = resolveLocalBrowserCommand(target);
166702
+ const child = spawn6(command, args, { detached: true, stdio: "ignore", windowsHide: true });
166703
+ child.once("error", () => void 0);
166704
+ child.unref();
166705
+ }
166706
+ var LOCAL_HTTP_HOSTS;
166707
+ var init_open_browser = __esm({
166708
+ "src/runtime/open-browser.ts"() {
166709
+ "use strict";
166710
+ init_esm_shims();
166711
+ LOCAL_HTTP_HOSTS = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "[::1]"]);
166712
+ }
166713
+ });
166714
+
166605
166715
  // src/memory/cleanup.ts
166606
166716
  function isLowQualityObservation(title) {
166607
166717
  return LOW_QUALITY_PATTERNS.some((pattern) => pattern.test(title.trim()));
@@ -167610,7 +167720,6 @@ __export(server_exports, {
167610
167720
  import { createServer } from "http";
167611
167721
  import { promises as fs19 } from "fs";
167612
167722
  import path32 from "path";
167613
- import { exec } from "child_process";
167614
167723
  function sendJson(res, data, status = 200) {
167615
167724
  res.writeHead(status, {
167616
167725
  "Content-Type": "application/json; charset=utf-8"
@@ -168100,7 +168209,8 @@ async function handleApi(req, res, dataDir, projectId, projectName, baseDir, pro
168100
168209
  ...resolved.memory.llm.provider === "openrouter" || resolved.memory.llm.baseUrl?.includes("openrouter.ai") ? ["OPENROUTER_API_KEY"] : [],
168101
168210
  ...resolved.memory.llm.provider === "requesty" ? ["REQUESTY_API_KEY"] : [],
168102
168211
  ...resolved.memory.llm.provider === "apiroute" ? ["API_ROUTE_API_KEY"] : [],
168103
- ...resolved.memory.llm.provider === "cheaperinference" ? ["CHEAPER_INFERENCE_API_KEY"] : []
168212
+ ...resolved.memory.llm.provider === "cheaperinference" ? ["CHEAPER_INFERENCE_API_KEY"] : [],
168213
+ ...resolved.memory.llm.provider === "runcrate" ? ["RUNCRATE_API_KEY"] : []
168104
168214
  ];
168105
168215
  if (llmKey) {
168106
168216
  const src = resolveDashboardKeySource({ value: llmKey, envKeys: memoryKeyEnv, configSource });
@@ -168315,9 +168425,10 @@ async function serveStatic(req, res, staticDir) {
168315
168425
  }
168316
168426
  }
168317
168427
  function openBrowser(url) {
168318
- const cmd = process.platform === "win32" ? `start "" "${url}"` : process.platform === "darwin" ? `open "${url}"` : `xdg-open "${url}"`;
168319
- exec(cmd, { windowsHide: true }, () => {
168320
- });
168428
+ try {
168429
+ openLocalBrowser(url);
168430
+ } catch {
168431
+ }
168321
168432
  }
168322
168433
  function parseJsonField(value, fallback) {
168323
168434
  if (typeof value !== "string") return value ?? fallback;
@@ -168553,6 +168664,7 @@ var init_server = __esm({
168553
168664
  "src/dashboard/server.ts"() {
168554
168665
  "use strict";
168555
168666
  init_esm_shims();
168667
+ init_open_browser();
168556
168668
  init_persistence();
168557
168669
  init_obs_store();
168558
168670
  init_session_store();
@@ -169686,7 +169798,7 @@ async function analyzeImage(input) {
169686
169798
  const config = getLLMConfig();
169687
169799
  if (!OPENAI_COMPATIBLE_PROVIDERS.has(config.provider)) {
169688
169800
  throw new Error(
169689
- `Image analysis requires an OpenAI-compatible provider (openai, openrouter, requesty, apiroute, cheaperinference, or custom). Current provider "${config.provider}" uses a different API shape. Set MEMORIX_LLM_PROVIDER=openai or configure an OpenAI-compatible base URL.`
169801
+ `Image analysis requires an OpenAI-compatible provider (openai, openrouter, requesty, apiroute, cheaperinference, runcrate, or custom). Current provider "${config.provider}" uses a different API shape. Set MEMORIX_LLM_PROVIDER=openai or configure an OpenAI-compatible base URL.`
169690
169802
  );
169691
169803
  }
169692
169804
  const bytes = decodeBase64ImagePayload(input.base64, MAX_VISION_IMAGE_BYTES);
@@ -169725,7 +169837,7 @@ var init_image_loader = __esm({
169725
169837
  init_provider2();
169726
169838
  init_secret_filter();
169727
169839
  init_image_payload();
169728
- OPENAI_COMPATIBLE_PROVIDERS = /* @__PURE__ */ new Set(["openai", "openrouter", "requesty", "apiroute", "cheaperinference", "custom"]);
169840
+ OPENAI_COMPATIBLE_PROVIDERS = /* @__PURE__ */ new Set(["openai", "openrouter", "requesty", "apiroute", "cheaperinference", "runcrate", "custom"]);
169729
169841
  MAX_VISION_PROMPT_CHARS = 12e3;
169730
169842
  MAX_VISION_DESCRIPTION_CHARS = 12e3;
169731
169843
  MAX_VISION_LABELS = 50;
@@ -173070,7 +173182,7 @@ _Search mode: ${result.receipt.mode}_`;
173070
173182
  inputSchema: {
173071
173183
  task: z627.string().optional().describe("Current coding task or question"),
173072
173184
  taskId: z627.string().max(120).optional().describe("Optional task continuity ledger id to include in the brief"),
173073
- refresh: z627.enum(["auto", "always", "never"]).optional().default("auto").describe(
173185
+ refresh: z627.enum(["auto", "always", "never"]).optional().describe(
173074
173186
  "Code Memory refresh policy. auto refreshes only when missing or stale."
173075
173187
  ),
173076
173188
  format: z627.enum(["prompt", "summary", "json", "receipt"]).optional().default("prompt").describe(
@@ -173126,7 +173238,7 @@ _Search mode: ${result.receipt.mode}_`;
173126
173238
  task,
173127
173239
  taskId,
173128
173240
  agent,
173129
- refresh: refresh ?? "auto",
173241
+ ...refresh ? { refresh } : {},
173130
173242
  reader: getObservationReader(),
173131
173243
  enqueueRefresh: () => {
173132
173244
  enqueueCodegraphRefresh2({
@@ -175319,9 +175431,9 @@ ${json2}
175319
175431
  req.end();
175320
175432
  });
175321
175433
  const projectUrl = `${url}?project=${encodeURIComponent(project.id)}`;
175322
- const { exec: exec2 } = await import("child_process");
175434
+ const { exec } = await import("child_process");
175323
175435
  const cmd = process.platform === "win32" ? `start "" "${projectUrl}"` : process.platform === "darwin" ? `open "${projectUrl}"` : `xdg-open "${projectUrl}"`;
175324
- exec2(cmd, { windowsHide: true }, () => {
175436
+ exec(cmd, { windowsHide: true }, () => {
175325
175437
  });
175326
175438
  return {
175327
175439
  content: [{
@@ -175370,9 +175482,9 @@ ${json2}
175370
175482
  req.end();
175371
175483
  });
175372
175484
  const projectUrl = `${url}?project=${encodeURIComponent(project.id)}`;
175373
- const { exec: exec2 } = await import("child_process");
175485
+ const { exec } = await import("child_process");
175374
175486
  const cmd = process.platform === "win32" ? `start "" "${projectUrl}"` : process.platform === "darwin" ? `open "${projectUrl}"` : `xdg-open "${projectUrl}"`;
175375
- exec2(cmd, { windowsHide: true }, () => {
175487
+ exec(cmd, { windowsHide: true }, () => {
175376
175488
  });
175377
175489
  return {
175378
175490
  content: [{ type: "text", text: `Dashboard is already running at ${url}. Switched to project: ${project.name} (${project.id}).` }]
@@ -177307,7 +177419,7 @@ var init_serve_shared = __esm({
177307
177419
 
177308
177420
  // src/cli/version.ts
177309
177421
  function getCliVersion() {
177310
- return true ? "1.10.2" : pkg.version;
177422
+ return true ? "1.10.3" : pkg.version;
177311
177423
  }
177312
177424
  var init_version3 = __esm({
177313
177425
  "src/cli/version.ts"() {