memorix 1.9.12 → 1.10.1

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 (59) hide show
  1. package/CHANGELOG.md +31 -1
  2. package/README.md +2 -0
  3. package/README.zh-CN.md +2 -0
  4. package/dist/cli/index.js +720 -142
  5. package/dist/index.d.ts +46 -0
  6. package/dist/index.js +426 -67
  7. package/dist/maintenance-runner.js +199 -5
  8. package/dist/media-audio-runner.js +199 -5
  9. package/dist/media-video-runner.js +199 -5
  10. package/dist/memcode/index.js +124 -8
  11. package/dist/memcode-runtime/CHANGELOG.md +31 -1
  12. package/dist/sdk.js +425 -66
  13. package/dist/vector-backfill-runner.js +199 -5
  14. package/docs/1.2.0-EVALUATION-HARNESS.md +106 -0
  15. package/docs/1.3-MEMORY-ARCHITECTURE.md +31 -0
  16. package/docs/API_REFERENCE.md +19 -0
  17. package/docs/CONFIGURATION.md +25 -0
  18. package/docs/DEVELOPMENT.md +17 -3
  19. package/docs/INTEGRATIONS.md +25 -0
  20. package/docs/PERFORMANCE.md +21 -6
  21. package/docs/README.md +4 -4
  22. package/docs/ROADMAP-1.9.12-2.0.md +99 -7
  23. package/package.json +3 -1
  24. package/plugins/antigravity/memorix/plugin.json +1 -1
  25. package/plugins/claude/memorix/.claude-plugin/plugin.json +1 -1
  26. package/plugins/codebuddy/memorix/.codebuddy-plugin/plugin.json +1 -1
  27. package/plugins/codex/memorix/.codex-plugin/plugin.json +1 -1
  28. package/plugins/copilot/memorix/plugin.json +1 -1
  29. package/plugins/gemini/memorix/gemini-extension.json +1 -1
  30. package/plugins/hermes/memorix/plugin.yaml +1 -1
  31. package/plugins/omp/memorix/package.json +1 -1
  32. package/plugins/openclaw/memorix/.codex-plugin/plugin.json +1 -1
  33. package/plugins/pi/memorix/package.json +1 -1
  34. package/server.json +2 -2
  35. package/src/cli/commands/agent-integrations.ts +164 -7
  36. package/src/cli/commands/init.ts +6 -2
  37. package/src/cli/commands/memory.ts +1 -1
  38. package/src/cli/commands/serve-http.ts +30 -1
  39. package/src/cli/commands/setup.ts +5 -21
  40. package/src/cli/tui/ConfigureView.tsx +2 -0
  41. package/src/codegraph/auto-context.ts +22 -0
  42. package/src/codegraph/context-pack.ts +19 -0
  43. package/src/compact/engine.ts +54 -2
  44. package/src/config/dotenv-loader.ts +1 -0
  45. package/src/config/resolved-config.ts +5 -2
  46. package/src/config/yaml-loader.ts +2 -2
  47. package/src/dashboard/server.ts +3 -0
  48. package/src/evaluation/context-task-matrix.ts +247 -0
  49. package/src/evaluation/context-task-runner.ts +175 -0
  50. package/src/integrations/registry.ts +191 -4
  51. package/src/knowledge/context-assembly.ts +46 -2
  52. package/src/knowledge/context-receipt.ts +32 -0
  53. package/src/knowledge/workset.ts +43 -3
  54. package/src/llm/provider.ts +2 -1
  55. package/src/multimodal/image-loader.ts +2 -2
  56. package/src/search/derived-view-receipt.ts +22 -0
  57. package/src/server/request-context.ts +96 -0
  58. package/src/server.ts +16 -4
  59. package/src/store/orama-store.ts +116 -0
package/dist/index.js CHANGED
@@ -3841,7 +3841,8 @@ function getResolvedConfig(options = {}) {
3841
3841
  const isAtlasCloud = memoryLlmProvider === "atlascloud";
3842
3842
  const isRequesty = memoryLlmProvider === "requesty";
3843
3843
  const isApiRoute = memoryLlmProvider === "apiroute";
3844
- const usesPresetKeyOnly = isAtlasCloud || isRequesty || isApiRoute;
3844
+ const isCheaperInference = memoryLlmProvider === "cheaperinference";
3845
+ const usesPresetKeyOnly = isAtlasCloud || isRequesty || isApiRoute || isCheaperInference;
3845
3846
  const memoryLlmApiKey = first(
3846
3847
  process.env.MEMORIX_LLM_API_KEY,
3847
3848
  process.env.MEMORIX_API_KEY,
@@ -3849,7 +3850,7 @@ function getResolvedConfig(options = {}) {
3849
3850
  yaml.llm?.apiKey,
3850
3851
  legacy.llm?.apiKey,
3851
3852
  // Never borrow another provider's credentials for these gateway presets.
3852
- isAtlasCloud ? process.env.ATLASCLOUD_API_KEY : isRequesty ? process.env.REQUESTY_API_KEY : isApiRoute ? process.env.API_ROUTE_API_KEY : process.env.OPENAI_API_KEY,
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,
3853
3854
  usesPresetKeyOnly ? void 0 : process.env.ANTHROPIC_API_KEY,
3854
3855
  usesPresetKeyOnly ? void 0 : openRouterMemoryLlmApiKey
3855
3856
  );
@@ -4033,6 +4034,7 @@ function getEnvSourceNames() {
4033
4034
  "OPENROUTER_API_KEY",
4034
4035
  "REQUESTY_API_KEY",
4035
4036
  "API_ROUTE_API_KEY",
4037
+ "CHEAPER_INFERENCE_API_KEY",
4036
4038
  "ATLASCLOUD_API_KEY"
4037
4039
  ].filter((name) => process.env[name]);
4038
4040
  }
@@ -7027,6 +7029,7 @@ var init_provider2 = __esm({
7027
7029
  openrouter: { baseUrl: "https://openrouter.ai/api/v1", model: "openai/gpt-4.1-nano" },
7028
7030
  requesty: { baseUrl: "https://router.requesty.ai/v1", model: "openai/gpt-4.1-nano" },
7029
7031
  apiroute: { baseUrl: "https://global.api-route.com/v1", model: "deepseek-v4.1-flash" },
7032
+ cheaperinference: { baseUrl: "https://api.cheaperinference.com/v1", model: "gpt-5.4-mini" },
7030
7033
  atlascloud: { baseUrl: "https://api.atlascloud.ai/v1", model: "deepseek-ai/deepseek-v3.2" },
7031
7034
  custom: { baseUrl: "http://localhost:11434/v1", model: "llama3" }
7032
7035
  };
@@ -8585,9 +8588,11 @@ __export(orama_store_exports, {
8585
8588
  getActiveSemanticIndexProfile: () => getActiveSemanticIndexProfile,
8586
8589
  getDb: () => getDb,
8587
8590
  getDeferredCachedVectorHydration: () => getDeferredCachedVectorHydration,
8591
+ getLastSearchDiagnostics: () => getLastSearchDiagnostics,
8588
8592
  getLastSearchMode: () => getLastSearchMode,
8589
8593
  getObservationCount: () => getObservationCount,
8590
8594
  getObservationsByIds: () => getObservationsByIds,
8595
+ getSearchDerivedViews: () => getSearchDerivedViews,
8591
8596
  getTimeline: () => getTimeline,
8592
8597
  getVectorDimensions: () => getVectorDimensions,
8593
8598
  hasObservationVector: () => hasObservationVector,
@@ -8614,6 +8619,68 @@ function rememberSearchMode(key, value) {
8614
8619
  function getLastSearchMode(projectId) {
8615
8620
  return lastSearchModeByProject.get(projectId ?? SEARCH_MODE_DEFAULT_KEY) ?? "fulltext";
8616
8621
  }
8622
+ function getLastSearchDiagnostics(projectId) {
8623
+ const diagnostics = lastSearchDiagnosticsByProject.get(projectId ?? SEARCH_MODE_DEFAULT_KEY);
8624
+ return diagnostics ? { ...diagnostics } : void 0;
8625
+ }
8626
+ function getSearchDerivedViews() {
8627
+ const views = {};
8628
+ const store = getOptionalObservationStore();
8629
+ if (store) {
8630
+ try {
8631
+ const generation = store.getGeneration();
8632
+ if (store.hasLexicalIndex?.()) {
8633
+ views.fts = { generation, freshness: "current", rebuildStatus: "idle" };
8634
+ } else {
8635
+ views.fts = {
8636
+ generation,
8637
+ freshness: "unknown",
8638
+ rebuildStatus: "unavailable",
8639
+ failureReason: store.getBackendReason?.() ?? "persistent lexical index unavailable"
8640
+ };
8641
+ }
8642
+ } catch (error) {
8643
+ views.fts = {
8644
+ freshness: "unknown",
8645
+ rebuildStatus: "failed",
8646
+ failureReason: error instanceof Error ? error.message.slice(0, 240) : String(error).slice(0, 240)
8647
+ };
8648
+ }
8649
+ } else {
8650
+ views.fts = {
8651
+ freshness: "unknown",
8652
+ rebuildStatus: "unavailable",
8653
+ failureReason: "observation store is not initialized"
8654
+ };
8655
+ }
8656
+ views.orama = db ? { generation: dbGeneration, freshness: "current", rebuildStatus: "idle" } : {
8657
+ generation: dbGeneration,
8658
+ freshness: "unknown",
8659
+ rebuildStatus: "unavailable",
8660
+ failureReason: "Orama index is not initialized"
8661
+ };
8662
+ const configuredEmbeddingMode = process.env.MEMORIX_EMBEDDING?.trim().toLowerCase();
8663
+ if (configuredEmbeddingMode === "off") {
8664
+ views.embedding = { freshness: "current", rebuildStatus: "disabled" };
8665
+ } else if (embeddingEnabled) {
8666
+ views.embedding = { freshness: "current", rebuildStatus: "idle" };
8667
+ } else {
8668
+ views.embedding = {
8669
+ freshness: "unknown",
8670
+ rebuildStatus: "unavailable",
8671
+ failureReason: "embedding provider is not initialized"
8672
+ };
8673
+ }
8674
+ return views;
8675
+ }
8676
+ function rememberSearchDiagnostics(key, value) {
8677
+ if (!lastSearchDiagnosticsByProject.has(key) && lastSearchDiagnosticsByProject.size >= MAX_SEARCH_MODE_KEYS) {
8678
+ const oldest = lastSearchDiagnosticsByProject.keys().next().value;
8679
+ if (oldest !== void 0) lastSearchDiagnosticsByProject.delete(oldest);
8680
+ }
8681
+ lastSearchDiagnosticsByProject.delete(key);
8682
+ lastSearchDiagnosticsByProject.set(key, value);
8683
+ }
8617
8684
  function getOptionalObservationStore() {
8618
8685
  try {
8619
8686
  return getObservationStore();
@@ -8896,6 +8963,7 @@ async function resetDb() {
8896
8963
  indexEmbeddingProvider = null;
8897
8964
  deferredCachedVectorHydration = null;
8898
8965
  lastSearchModeByProject.clear();
8966
+ lastSearchDiagnosticsByProject.clear();
8899
8967
  }
8900
8968
  function isEmbeddingEnabled() {
8901
8969
  return embeddingEnabled;
@@ -9113,6 +9181,7 @@ async function removeObservation(oramaId) {
9113
9181
  await remove2(database, oramaId);
9114
9182
  }
9115
9183
  async function searchObservations(options) {
9184
+ const searchStartedAt = Date.now();
9116
9185
  const perf = !!process.env.MEMORIX_PERF;
9117
9186
  const t0 = perf ? performance.now() : 0;
9118
9187
  const mark = (label) => {
@@ -9188,6 +9257,8 @@ async function searchObservations(options) {
9188
9257
  let queryVector = null;
9189
9258
  let embeddingProviderForSearch = null;
9190
9259
  let embeddingUnavailable = false;
9260
+ let fallbackUsed = false;
9261
+ let fallbackReason;
9191
9262
  if (quality !== "fast" && embeddingEnabled && hasQuery && tier !== "fast") {
9192
9263
  try {
9193
9264
  const provider2 = await getEmbeddingProvider();
@@ -9196,6 +9267,8 @@ async function searchObservations(options) {
9196
9267
  const activeVectorDimensions = getVectorDimensions();
9197
9268
  if (activeVectorDimensions !== null && provider2.dimensions !== activeVectorDimensions) {
9198
9269
  embeddingUnavailable = true;
9270
+ fallbackUsed = true;
9271
+ fallbackReason = "embedding dimension mismatch; lexical search used";
9199
9272
  rememberSearchMode(
9200
9273
  modeKey,
9201
9274
  `fulltext (embedding dimension mismatch: provider ${provider2.dimensions}d vs index ${activeVectorDimensions}d)`
@@ -9237,9 +9310,13 @@ async function searchObservations(options) {
9237
9310
  }
9238
9311
  } else {
9239
9312
  embeddingUnavailable = true;
9313
+ fallbackUsed = true;
9314
+ fallbackReason = "embedding provider unavailable; lexical search used";
9240
9315
  }
9241
9316
  } catch (error) {
9242
9317
  embeddingUnavailable = true;
9318
+ fallbackUsed = true;
9319
+ fallbackReason = "embedding failed or timed out; lexical search used";
9243
9320
  rememberSearchMode(modeKey, "fulltext (embedding unavailable)");
9244
9321
  console.error("[memorix] Embedding failed or timed out, falling back to fulltext search");
9245
9322
  }
@@ -9289,6 +9366,8 @@ async function searchObservations(options) {
9289
9366
  similarity: 0.25
9290
9367
  };
9291
9368
  rememberSearchMode(modeKey, "vector-only (hybrid empty fallback)");
9369
+ fallbackUsed = true;
9370
+ fallbackReason = "hybrid search returned no results; vector-only fallback used";
9292
9371
  results = await search(database, vectorOnlyParams);
9293
9372
  } catch {
9294
9373
  }
@@ -9562,6 +9641,7 @@ async function searchObservations(options) {
9562
9641
  mark(`rerank(skipped,tier=${tier})`);
9563
9642
  }
9564
9643
  let entries = intermediate.map(({ rawTime: _, _isCommandLog: _c, ...rest }) => rest);
9644
+ const candidateCount = entries.length;
9565
9645
  for (const hit of results.hits) {
9566
9646
  const doc = hit.document;
9567
9647
  if (canReadObservation(doc, options.reader, projectIds ?? void 0)) rememberObservationDoc(doc);
@@ -9604,9 +9684,22 @@ async function searchObservations(options) {
9604
9684
  }
9605
9685
  }
9606
9686
  }
9687
+ const beforeTokenBudget = entries.length;
9607
9688
  if (options.maxTokens && options.maxTokens > 0) {
9608
9689
  entries = applyTokenBudget(entries, options.maxTokens);
9609
9690
  }
9691
+ rememberSearchDiagnostics(modeKey, {
9692
+ version: "1",
9693
+ mode: getLastSearchMode(options.projectId),
9694
+ rawCandidateCount: results.hits.length,
9695
+ candidateCount,
9696
+ selectedCount: entries.length,
9697
+ omittedCount: Math.max(0, candidateCount - entries.length),
9698
+ omittedByTokenBudget: Math.max(0, beforeTokenBudget - entries.length),
9699
+ fallbackUsed,
9700
+ ...fallbackReason ? { fallbackReason } : {},
9701
+ elapsedMs: Math.max(0, Date.now() - searchStartedAt)
9702
+ });
9610
9703
  if (options.trackAccess !== false) {
9611
9704
  const returnedKeys = new Set(entries.map((entry) => makeEntryKey(entry.projectId, entry.id)));
9612
9705
  const hitDocs = results.hits.map((hit) => ({ id: hit.id, doc: hit.document })).filter(({ doc }) => returnedKeys.has(makeEntryKey(doc.projectId, doc.observationId)));
@@ -9722,7 +9815,7 @@ function formatTime(isoDate) {
9722
9815
  return isoDate;
9723
9816
  }
9724
9817
  }
9725
- var db, dbInitPromise, dbGeneration, embeddingEnabled, embeddingDimensions, indexEmbeddingProvider, deferredCachedVectorHydration, NON_CJK_HYBRID_SIMILARITY, CJK_RUN, lastSearchModeByProject, SEARCH_MODE_DEFAULT_KEY, MAX_SEARCH_MODE_KEYS, COMMAND_LOG_TITLE2, COMMAND_STYLE_TITLE, COMMAND_LIKE_QUERY2, COMMAND_INTENT_QUERY, NATURAL_LANGUAGE_MARKERS;
9818
+ var db, dbInitPromise, dbGeneration, embeddingEnabled, embeddingDimensions, indexEmbeddingProvider, deferredCachedVectorHydration, NON_CJK_HYBRID_SIMILARITY, CJK_RUN, lastSearchModeByProject, lastSearchDiagnosticsByProject, SEARCH_MODE_DEFAULT_KEY, MAX_SEARCH_MODE_KEYS, COMMAND_LOG_TITLE2, COMMAND_STYLE_TITLE, COMMAND_LIKE_QUERY2, COMMAND_INTENT_QUERY, NATURAL_LANGUAGE_MARKERS;
9726
9819
  var init_orama_store = __esm({
9727
9820
  "src/store/orama-store.ts"() {
9728
9821
  "use strict";
@@ -9748,6 +9841,7 @@ var init_orama_store = __esm({
9748
9841
  NON_CJK_HYBRID_SIMILARITY = 0.45;
9749
9842
  CJK_RUN = /[\u3400-\u4dbf\u4e00-\u9fff\u3040-\u30ff\uac00-\ud7af]+/gu;
9750
9843
  lastSearchModeByProject = /* @__PURE__ */ new Map();
9844
+ lastSearchDiagnosticsByProject = /* @__PURE__ */ new Map();
9751
9845
  SEARCH_MODE_DEFAULT_KEY = "__global__";
9752
9846
  MAX_SEARCH_MODE_KEYS = 4096;
9753
9847
  COMMAND_LOG_TITLE2 = /^(Ran:|Command:|Executed:)\s/i;
@@ -35484,6 +35578,25 @@ var init_models_generated = __esm({
35484
35578
  }
35485
35579
  },
35486
35580
  "minimax": {
35581
+ "MiniMax-M3.1-Flash": {
35582
+ id: "MiniMax-M3.1-Flash",
35583
+ name: "MiniMax-M3.1-Flash",
35584
+ api: "anthropic-messages",
35585
+ provider: "minimax",
35586
+ baseUrl: "https://api.minimax.io/anthropic",
35587
+ compat: { "forceAdaptiveThinking": true },
35588
+ reasoning: true,
35589
+ thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
35590
+ input: ["text", "image", "video"],
35591
+ cost: {
35592
+ input: 0.15,
35593
+ output: 0.6,
35594
+ cacheRead: 0.015,
35595
+ cacheWrite: 0
35596
+ },
35597
+ contextWindow: 1e6,
35598
+ maxTokens: 524288
35599
+ },
35487
35600
  "MiniMax-M2.7": {
35488
35601
  id: "MiniMax-M2.7",
35489
35602
  name: "MiniMax-M2.7",
@@ -35524,6 +35637,7 @@ var init_models_generated = __esm({
35524
35637
  api: "anthropic-messages",
35525
35638
  provider: "minimax",
35526
35639
  baseUrl: "https://api.minimax.io/anthropic",
35640
+ compat: { "forceAdaptiveThinking": true },
35527
35641
  reasoning: true,
35528
35642
  input: ["text", "image", "video"],
35529
35643
  cost: {
@@ -35533,10 +35647,29 @@ var init_models_generated = __esm({
35533
35647
  cacheWrite: 0
35534
35648
  },
35535
35649
  contextWindow: 1e6,
35536
- maxTokens: 128e3
35650
+ maxTokens: 524288
35537
35651
  }
35538
35652
  },
35539
35653
  "minimax-cn": {
35654
+ "MiniMax-M3.1-Flash": {
35655
+ id: "MiniMax-M3.1-Flash",
35656
+ name: "MiniMax-M3.1-Flash",
35657
+ api: "anthropic-messages",
35658
+ provider: "minimax-cn",
35659
+ baseUrl: "https://api.minimaxi.com/anthropic",
35660
+ compat: { "forceAdaptiveThinking": true },
35661
+ reasoning: true,
35662
+ thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
35663
+ input: ["text", "image", "video"],
35664
+ cost: {
35665
+ input: 0.15,
35666
+ output: 0.6,
35667
+ cacheRead: 0.015,
35668
+ cacheWrite: 0
35669
+ },
35670
+ contextWindow: 1e6,
35671
+ maxTokens: 524288
35672
+ },
35540
35673
  "MiniMax-M2.7": {
35541
35674
  id: "MiniMax-M2.7",
35542
35675
  name: "MiniMax-M2.7",
@@ -35577,6 +35710,7 @@ var init_models_generated = __esm({
35577
35710
  api: "anthropic-messages",
35578
35711
  provider: "minimax-cn",
35579
35712
  baseUrl: "https://api.minimaxi.com/anthropic",
35713
+ compat: { "forceAdaptiveThinking": true },
35580
35714
  reasoning: true,
35581
35715
  input: ["text", "image", "video"],
35582
35716
  cost: {
@@ -35586,7 +35720,7 @@ var init_models_generated = __esm({
35586
35720
  cacheWrite: 0
35587
35721
  },
35588
35722
  contextWindow: 1e6,
35589
- maxTokens: 128e3
35723
+ maxTokens: 524288
35590
35724
  }
35591
35725
  },
35592
35726
  "mistral": {
@@ -38707,6 +38841,24 @@ var init_models_generated = __esm({
38707
38841
  }
38708
38842
  },
38709
38843
  "openrouter": {
38844
+ "minimax/minimax-m3.1-flash:free": {
38845
+ id: "minimax/minimax-m3.1-flash:free",
38846
+ name: "MiniMax: MiniMax M3.1 Flash (free)",
38847
+ api: "openai-completions",
38848
+ provider: "openrouter",
38849
+ baseUrl: "https://openrouter.ai/api/v1",
38850
+ reasoning: true,
38851
+ thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
38852
+ input: ["text", "image"],
38853
+ cost: {
38854
+ input: 0,
38855
+ output: 0,
38856
+ cacheRead: 0,
38857
+ cacheWrite: 0
38858
+ },
38859
+ contextWindow: 1e6,
38860
+ maxTokens: 524288
38861
+ },
38710
38862
  "ai21/jamba-large-1.7": {
38711
38863
  id: "ai21/jamba-large-1.7",
38712
38864
  name: "AI21: Jamba Large 1.7",
@@ -47408,6 +47560,14 @@ var init_models_generated = __esm({
47408
47560
  }
47409
47561
  });
47410
47562
 
47563
+ // packages/ai/dist/minimax-models.js
47564
+ var init_minimax_models = __esm({
47565
+ "packages/ai/dist/minimax-models.js"() {
47566
+ "use strict";
47567
+ init_esm_shims();
47568
+ }
47569
+ });
47570
+
47411
47571
  // packages/ai/dist/models.js
47412
47572
  function calculateCost(model, usage) {
47413
47573
  usage.cost.input = model.cost.input / 1e6 * usage.input;
@@ -47454,6 +47614,8 @@ var init_models2 = __esm({
47454
47614
  "use strict";
47455
47615
  init_esm_shims();
47456
47616
  init_models_generated();
47617
+ init_minimax_models();
47618
+ init_minimax_models();
47457
47619
  modelRegistry = /* @__PURE__ */ new Map();
47458
47620
  for (const [provider2, models] of Object.entries(MODELS)) {
47459
47621
  const providerModels = /* @__PURE__ */ new Map();
@@ -55407,6 +55569,25 @@ function buildParams2(model, context, isOAuthToken2, options) {
55407
55569
  params.tool_choice = options.toolChoice;
55408
55570
  }
55409
55571
  }
55572
+ return normalizeMiniMaxParams(model, params, options);
55573
+ }
55574
+ function normalizeMiniMaxParams(model, params, options) {
55575
+ if (model.provider !== "minimax" && model.provider !== "minimax-cn")
55576
+ return params;
55577
+ if (params.model === "MiniMax-M3.1-Flash") {
55578
+ const effort = params.output_config?.effort ?? options?.effort ?? "max";
55579
+ const normalized = { ...params, thinking: { type: "adaptive" } };
55580
+ normalized.output_config = {
55581
+ ...params.output_config,
55582
+ effort: ["low", "medium", "high", "xhigh", "max"].includes(effort) ? effort : "max"
55583
+ };
55584
+ delete normalized.service_tier;
55585
+ delete normalized.reasoning_split;
55586
+ return normalized;
55587
+ }
55588
+ if (params.model === "MiniMax-M3" && params.thinking) {
55589
+ return { ...params, thinking: { type: params.thinking.type === "disabled" ? "disabled" : "adaptive" } };
55590
+ }
55410
55591
  return params;
55411
55592
  }
55412
55593
  function normalizeToolCallId(id) {
@@ -55713,6 +55894,7 @@ var init_anthropic = __esm({
55713
55894
  if (nextParams !== void 0) {
55714
55895
  params = nextParams;
55715
55896
  }
55897
+ params = normalizeMiniMaxParams(model, params, options);
55716
55898
  const requestOptions = {
55717
55899
  ...options?.signal ? { signal: options.signal } : {},
55718
55900
  ...options?.timeoutMs !== void 0 ? { timeout: options.timeoutMs } : {},
@@ -77814,7 +77996,7 @@ var require_websocket = __commonJS({
77814
77996
  var http3 = __require("http");
77815
77997
  var net = __require("net");
77816
77998
  var tls = __require("tls");
77817
- var { randomBytes: randomBytes2, createHash: createHash20 } = __require("crypto");
77999
+ var { randomBytes: randomBytes2, createHash: createHash21 } = __require("crypto");
77818
78000
  var { Duplex, Readable: Readable2 } = __require("stream");
77819
78001
  var { URL: URL2 } = __require("url");
77820
78002
  var PerMessageDeflate2 = require_permessage_deflate();
@@ -78482,7 +78664,7 @@ var require_websocket = __commonJS({
78482
78664
  abortHandshake(websocket, socket, "Invalid Upgrade header");
78483
78665
  return;
78484
78666
  }
78485
- const digest2 = createHash20("sha1").update(key + GUID).digest("base64");
78667
+ const digest2 = createHash21("sha1").update(key + GUID).digest("base64");
78486
78668
  if (res.headers["sec-websocket-accept"] !== digest2) {
78487
78669
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
78488
78670
  return;
@@ -78854,7 +79036,7 @@ var require_websocket_server = __commonJS({
78854
79036
  var EventEmitter2 = __require("events");
78855
79037
  var http3 = __require("http");
78856
79038
  var { Duplex } = __require("stream");
78857
- var { createHash: createHash20 } = __require("crypto");
79039
+ var { createHash: createHash21 } = __require("crypto");
78858
79040
  var extension3 = require_extension();
78859
79041
  var PerMessageDeflate2 = require_permessage_deflate();
78860
79042
  var subprotocol2 = require_subprotocol();
@@ -79161,7 +79343,7 @@ var require_websocket_server = __commonJS({
79161
79343
  );
79162
79344
  }
79163
79345
  if (this._state > RUNNING) return abortHandshake(socket, 503);
79164
- const digest2 = createHash20("sha1").update(key + GUID).digest("base64");
79346
+ const digest2 = createHash21("sha1").update(key + GUID).digest("base64");
79165
79347
  const headers = [
79166
79348
  "HTTP/1.1 101 Switching Protocols",
79167
79349
  "Upgrade: websocket",
@@ -138483,6 +138665,18 @@ var init_openai_completions = __esm({
138483
138665
  if (nextParams !== void 0) {
138484
138666
  params = nextParams;
138485
138667
  }
138668
+ if (model.provider === "openrouter" && new URL(model.baseUrl).hostname === "openrouter.ai" && params.model === "minimax/minimax-m3.1-flash:free") {
138669
+ const flash = params;
138670
+ const effort = flash.reasoning?.effort ?? "max";
138671
+ flash.reasoning = {
138672
+ ...flash.reasoning,
138673
+ enabled: true,
138674
+ effort: ["low", "medium", "high", "xhigh", "max"].includes(effort) ? effort : "max"
138675
+ };
138676
+ delete flash.reasoning_effort;
138677
+ delete flash.reasoning_split;
138678
+ delete flash.service_tier;
138679
+ }
138486
138680
  const requestOptions = {
138487
138681
  ...options?.signal ? { signal: options.signal } : {},
138488
138682
  ...options?.timeoutMs !== void 0 ? { timeout: options.timeoutMs } : {},
@@ -155522,6 +155716,7 @@ function normalizeMemoryBrowseQuery(query) {
155522
155716
  return broadMemoryRequests.has(compact) ? "" : query;
155523
155717
  }
155524
155718
  async function compactSearch(options, surface = "mcp") {
155719
+ const startedAt = Date.now();
155525
155720
  await ensureFreshIndex({ loadCorpus: false });
155526
155721
  const searchOptions = { ...options, query: normalizeMemoryBrowseQuery(options.query) };
155527
155722
  let entries = (await searchObservations(searchOptions)).map(
@@ -155575,7 +155770,34 @@ This project does have stored Memorix memories, but none matched the current que
155575
155770
  }
155576
155771
  }
155577
155772
  const totalTokens = countTextTokens(formatted);
155578
- return { entries, formatted, totalTokens };
155773
+ const diagnostics = getLastSearchDiagnostics(options.projectId);
155774
+ const derivedViews = getSearchDerivedViews();
155775
+ if (diagnostics?.fallbackUsed && diagnostics.fallbackReason) {
155776
+ derivedViews.embedding = {
155777
+ freshness: "stale",
155778
+ rebuildStatus: "failed",
155779
+ failureReason: diagnostics.fallbackReason
155780
+ };
155781
+ }
155782
+ return {
155783
+ entries,
155784
+ formatted,
155785
+ totalTokens,
155786
+ receipt: {
155787
+ version: "1",
155788
+ mode: getLastSearchMode(options.projectId),
155789
+ resultCount: entries.length,
155790
+ candidateCount: diagnostics?.candidateCount ?? entries.length,
155791
+ selectedCount: diagnostics?.selectedCount ?? entries.length,
155792
+ omittedCount: diagnostics?.omittedCount ?? 0,
155793
+ omittedByTokenBudget: diagnostics?.omittedByTokenBudget ?? 0,
155794
+ fallbackUsed: diagnostics?.fallbackUsed ?? false,
155795
+ ...diagnostics?.fallbackReason ? { fallbackReason: diagnostics.fallbackReason } : {},
155796
+ derivedViews,
155797
+ tokenCount: totalTokens,
155798
+ elapsedMs: Math.max(0, Date.now() - startedAt)
155799
+ }
155800
+ };
155579
155801
  }
155580
155802
  async function compactTimeline(anchorId, projectId, depthBefore = 3, depthAfter = 3, reader2, surface = "mcp") {
155581
155803
  const result = await getTimeline(anchorId, projectId, depthBefore, depthAfter, reader2);
@@ -160102,12 +160324,27 @@ var init_surfaced_registry = __esm({
160102
160324
  });
160103
160325
 
160104
160326
  // src/server/request-context.ts
160327
+ import { createHash as createHash18 } from "crypto";
160105
160328
  import path28 from "path";
160106
160329
  function resolveRoot(projectRoot) {
160107
160330
  const value = projectRoot.trim();
160108
160331
  if (!value) throw new Error("Project binding requires a non-empty project root");
160109
160332
  return path28.resolve(value);
160110
160333
  }
160334
+ function hashBindingValue(value) {
160335
+ return `sha256:${createHash18("sha256").update(value).digest("hex")}`;
160336
+ }
160337
+ function remoteHost(remote) {
160338
+ const trimmed = remote.trim();
160339
+ if (!trimmed) return void 0;
160340
+ const scpHost = trimmed.match(/^[^@/\s]+@([^:\s/]+):/);
160341
+ if (scpHost) return scpHost[1].toLowerCase();
160342
+ try {
160343
+ return new URL(trimmed).hostname.toLowerCase() || void 0;
160344
+ } catch {
160345
+ return void 0;
160346
+ }
160347
+ }
160111
160348
  function createProjectBindingController(projectRoot) {
160112
160349
  return new ProjectBindingController(projectRoot);
160113
160350
  }
@@ -160134,6 +160371,38 @@ var init_request_context = __esm({
160134
160371
  ...actorId ? { actorId } : {}
160135
160372
  };
160136
160373
  }
160374
+ /**
160375
+ * Return binding diagnostics without exposing local paths or transport IDs.
160376
+ * The hashes let operators compare two surfaces while keeping the receipt
160377
+ * safe to pass through MCP, logs, and agent handoffs.
160378
+ */
160379
+ receipt(options = {}) {
160380
+ const snapshot = this.snapshot();
160381
+ const handle = options.handle;
160382
+ const handleState = !handle ? "absent" : handle.expiresAt && Date.parse(handle.expiresAt) <= Date.now() ? "expired" : "active";
160383
+ return {
160384
+ version: "1",
160385
+ state: snapshot.projectId ? "resolved" : "unresolved",
160386
+ source: snapshot.source,
160387
+ explicit: snapshot.explicit,
160388
+ ...snapshot.projectId ? { projectId: snapshot.projectId } : {},
160389
+ projectRootHash: hashBindingValue(snapshot.projectRoot),
160390
+ ...options.dataDir ? { dataDirHash: hashBindingValue(path28.resolve(options.dataDir)) } : {},
160391
+ gitRemote: options.gitRemote?.trim() ? {
160392
+ state: "verified",
160393
+ hash: hashBindingValue(options.gitRemote.trim()),
160394
+ ...remoteHost(options.gitRemote) ? { host: remoteHost(options.gitRemote) } : {}
160395
+ } : { state: "unavailable" },
160396
+ handle: {
160397
+ state: handleState,
160398
+ ...handle ? { idHash: hashBindingValue(handle.handleId) } : {},
160399
+ ...handle?.createdAt ? { createdAt: handle.createdAt } : {},
160400
+ ...handle?.lastUsedAt ? { lastUsedAt: handle.lastUsedAt } : {},
160401
+ ...handle?.expiresAt ? { expiresAt: handle.expiresAt } : {}
160402
+ },
160403
+ transport: options.transport ?? "unknown"
160404
+ };
160405
+ }
160137
160406
  isExplicit() {
160138
160407
  return this.current.explicit;
160139
160408
  }
@@ -160175,7 +160444,7 @@ var init_request_context = __esm({
160175
160444
  function getMcpServerInfo() {
160176
160445
  return {
160177
160446
  name: "memorix",
160178
- version: true ? "1.9.12" : "1.0.1"
160447
+ version: true ? "1.10.1" : "1.0.1"
160179
160448
  };
160180
160449
  }
160181
160450
  function createMcpDiscoverResult(capabilities, serverInfo) {
@@ -160865,7 +161134,7 @@ function appendLine(lines, candidate, maxTokens, omitted, omittedKind, selected,
160865
161134
  if (receiptSelection) selected?.push(receiptSelection);
160866
161135
  return true;
160867
161136
  }
160868
- omitted.push(omittedKind);
161137
+ omitted.push(receiptSelection?.id ? `${omittedKind}|${receiptSelection.id}` : omittedKind);
160869
161138
  return false;
160870
161139
  }
160871
161140
  function freshnessForMemory(status) {
@@ -160891,15 +161160,23 @@ function receiptOmissionKind(raw) {
160891
161160
  }
160892
161161
  function receiptOmissions(omitted, hiddenCautionMemoryCount) {
160893
161162
  const counts = /* @__PURE__ */ new Map();
161163
+ const samples = /* @__PURE__ */ new Map();
160894
161164
  for (const raw of omitted) {
160895
- const kind = receiptOmissionKind(raw);
161165
+ const [omittedKind, sampleId] = raw.split("|", 2);
161166
+ const kind = receiptOmissionKind(omittedKind);
160896
161167
  if (!kind || raw.endsWith("-heading")) continue;
160897
161168
  counts.set(kind, (counts.get(kind) ?? 0) + 1);
161169
+ if (sampleId) {
161170
+ const values = samples.get(kind) ?? [];
161171
+ if (!values.includes(sampleId) && values.length < 3) values.push(sampleId);
161172
+ samples.set(kind, values);
161173
+ }
160898
161174
  }
160899
161175
  const receipt = [...counts.entries()].map(([kind, count2]) => ({
160900
161176
  kind,
160901
161177
  reason: "token-budget",
160902
- count: count2
161178
+ count: count2,
161179
+ ...samples.get(kind)?.length ? { sampleIds: samples.get(kind) } : {}
160903
161180
  }));
160904
161181
  if (hiddenCautionMemoryCount > 0) {
160905
161182
  receipt.push({
@@ -161608,6 +161885,21 @@ async function buildTaskWorkset(input) {
161608
161885
  ...base,
161609
161886
  budget: { maxTokens }
161610
161887
  });
161888
+ const omittedReceipt = receiptOmissions(rendered.omittedItems, base.hiddenCautionMemoryCount);
161889
+ const derivedViews = {
161890
+ ...getSearchDerivedViews(),
161891
+ ...input.retrieval?.derivedViews ?? {}
161892
+ };
161893
+ const retrieval = {
161894
+ mode: input.retrieval?.mode ?? (input.semanticCode ? "hybrid" : "unknown"),
161895
+ ...input.retrieval?.codeProvider || input.providerQuality?.selected ? { codeProvider: input.retrieval?.codeProvider ?? input.providerQuality?.selected } : {},
161896
+ fallbackUsed: Boolean(input.retrieval?.fallbackReason),
161897
+ ...input.retrieval?.fallbackReason ? { fallbackReason: input.retrieval.fallbackReason } : {},
161898
+ candidateCount: governed.plan.decisions.length,
161899
+ selectedCount: rendered.selected.length,
161900
+ omittedCount: omittedReceipt.reduce((total, omission) => total + omission.count, 0),
161901
+ derivedViews
161902
+ };
161611
161903
  const receipt = {
161612
161904
  version: "1.3",
161613
161905
  target: input.deliveryTarget ?? "project-context",
@@ -161616,8 +161908,9 @@ async function buildTaskWorkset(input) {
161616
161908
  maxTokens,
161617
161909
  tokenCount: rendered.tokenCount
161618
161910
  },
161911
+ retrieval,
161619
161912
  selected: rendered.selected,
161620
- omitted: receiptOmissions(rendered.omittedItems, base.hiddenCautionMemoryCount),
161913
+ omitted: omittedReceipt,
161621
161914
  governance: {
161622
161915
  scope: "optional-evidence",
161623
161916
  mode: governed.plan.mode,
@@ -161625,7 +161918,12 @@ async function buildTaskWorkset(input) {
161625
161918
  kind: decision.candidate.kind,
161626
161919
  ...decision.candidate.id ? { id: decision.candidate.id } : {},
161627
161920
  disposition: decision.disposition,
161628
- reasons: decision.reasons
161921
+ reasons: decision.reasons,
161922
+ ...decision.candidate.freshness ? { freshness: decision.candidate.freshness } : {},
161923
+ ...decision.candidate.trust ? { trust: decision.candidate.trust } : {},
161924
+ ...decision.candidate.quality ? { quality: decision.candidate.quality } : {},
161925
+ ...decision.candidate.conflict ? { conflict: decision.candidate.conflict } : {},
161926
+ ...decision.candidate.evidenceCount !== void 0 ? { evidenceCount: decision.candidate.evidenceCount } : {}
161629
161927
  })),
161630
161928
  cautions: governed.plan.cautions
161631
161929
  },
@@ -161659,6 +161957,7 @@ var init_workset = __esm({
161659
161957
  init_workflows2();
161660
161958
  init_long_term();
161661
161959
  init_governor();
161960
+ init_orama_store();
161662
161961
  CONTINUATION_DETAIL_TOKEN_BUDGET = 20;
161663
161962
  }
161664
161963
  });
@@ -162958,12 +163257,66 @@ var init_project_context = __esm({
162958
163257
  }
162959
163258
  });
162960
163259
 
163260
+ // src/knowledge/context-receipt.ts
163261
+ var context_receipt_exports = {};
163262
+ __export(context_receipt_exports, {
163263
+ buildBoundedContextReceipt: () => buildBoundedContextReceipt,
163264
+ buildCodeGraphDerivedView: () => buildCodeGraphDerivedView
163265
+ });
163266
+ function buildCodeGraphDerivedView(input) {
163267
+ const provider2 = input.providerQuality;
163268
+ const snapshot = input.snapshot;
163269
+ const externalFailure = provider2?.external.state !== void 0 && !["ready", "disabled", "not-detected"].includes(provider2.external.state);
163270
+ if (snapshot?.id) {
163271
+ return {
163272
+ ...snapshot.sourceEpoch !== void 0 ? { generation: snapshot.sourceEpoch } : {},
163273
+ freshness: snapshot.incomplete ? "stale" : "current",
163274
+ rebuildStatus: snapshot.incomplete ? "failed" : "idle",
163275
+ ...snapshot.incomplete ? { failureReason: "latest CodeGraph snapshot is incomplete" } : externalFailure && provider2?.external.reason ? { failureReason: provider2.external.reason.slice(0, 240) } : {}
163276
+ };
163277
+ }
163278
+ return {
163279
+ freshness: "unknown",
163280
+ rebuildStatus: externalFailure ? "failed" : "unavailable",
163281
+ ...provider2?.external.reason ? { failureReason: provider2.external.reason.slice(0, 240) } : { failureReason: "CodeGraph snapshot is not initialized" }
163282
+ };
163283
+ }
163284
+ function buildBoundedContextReceipt(input) {
163285
+ const provider2 = input.providerQuality ?? input.workset.provenance.codeProvider;
163286
+ return {
163287
+ schemaVersion: "1",
163288
+ task: input.workset.task,
163289
+ brief: input.workset.prompt,
163290
+ receipt: input.workset.receipt,
163291
+ code: {
163292
+ selected: provider2?.selected ?? "lite",
163293
+ quality: provider2?.selectedQuality ?? "heuristic",
163294
+ externalState: provider2?.external.state ?? "not-detected",
163295
+ ...input.workset.provenance.snapshotId ? { snapshotId: input.workset.provenance.snapshotId } : {}
163296
+ },
163297
+ ...input.workset.agentLoadout ? { loadout: input.workset.agentLoadout } : {},
163298
+ ...input.workset.continuity ? {
163299
+ continuity: {
163300
+ taskId: input.workset.continuity.taskId,
163301
+ status: input.workset.continuity.status,
163302
+ outcome: input.workset.continuity.outcome
163303
+ }
163304
+ } : {}
163305
+ };
163306
+ }
163307
+ var init_context_receipt = __esm({
163308
+ "src/knowledge/context-receipt.ts"() {
163309
+ "use strict";
163310
+ init_esm_shims();
163311
+ }
163312
+ });
163313
+
162961
163314
  // src/store/compaction-checkpoint-store.ts
162962
163315
  var compaction_checkpoint_store_exports = {};
162963
163316
  __export(compaction_checkpoint_store_exports, {
162964
163317
  CompactionCheckpointStore: () => CompactionCheckpointStore
162965
163318
  });
162966
- import { createHash as createHash18, randomUUID as randomUUID16 } from "crypto";
163319
+ import { createHash as createHash19, randomUUID as randomUUID16 } from "crypto";
162967
163320
  function optionalText7(value) {
162968
163321
  return typeof value === "string" && value ? value : void 0;
162969
163322
  }
@@ -163005,7 +163358,7 @@ function sourceKeyFor(input, summary) {
163005
163358
  input.tokensBefore ?? "",
163006
163359
  input.firstKeptEntryId ?? ""
163007
163360
  ].join("\0");
163008
- return `derived:${createHash18("sha256").update(material).digest("hex").slice(0, 32)}`;
163361
+ return `derived:${createHash19("sha256").update(material).digest("hex").slice(0, 32)}`;
163009
163362
  }
163010
163363
  function rowToCheckpoint(row) {
163011
163364
  return {
@@ -163844,6 +164197,23 @@ async function buildAutoProjectContext(input) {
163844
164197
  ...alwaysOn.profile.length > 0 || alwaysOn.state || alwaysOn.durable.length > 0 ? { alwaysOn } : {},
163845
164198
  ...semanticOutline ? { semanticCode: semanticOutline } : {},
163846
164199
  providerQuality: providerQuality2,
164200
+ retrieval: {
164201
+ mode: semanticOutline ? "hybrid" : "lexical",
164202
+ codeProvider: providerQuality2.selected,
164203
+ ...externalCaution ? { fallbackReason: externalCaution } : {},
164204
+ derivedViews: {
164205
+ graph: buildCodeGraphDerivedView({
164206
+ providerQuality: providerQuality2,
164207
+ ...latestSnapshot ? {
164208
+ snapshot: {
164209
+ id: latestSnapshot.id,
164210
+ sourceEpoch: latestSnapshot.sourceEpoch,
164211
+ incomplete: latestSnapshot.completeness.skippedOversizedFiles > 0 || (latestSnapshot.completeness.unreadableFiles ?? 0) > 0 || latestSnapshot.completeness.removalScanDeferred
164212
+ }
164213
+ } : {}
164214
+ })
164215
+ }
164216
+ },
163847
164217
  currentFacts: worksetFactLines(currentFacts),
163848
164218
  ...continuation ? { continuation } : {},
163849
164219
  ...continuity ? { continuity } : {},
@@ -164172,47 +164542,13 @@ var init_auto_context = __esm({
164172
164542
  init_long_term();
164173
164543
  init_visibility();
164174
164544
  init_session_store();
164545
+ init_context_receipt();
164175
164546
  init_task_lens();
164176
164547
  DEFAULT_MAX_AGE_MS = 10 * 60 * 1e3;
164177
164548
  COMPACT_CHECKPOINT_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
164178
164549
  }
164179
164550
  });
164180
164551
 
164181
- // src/knowledge/context-receipt.ts
164182
- var context_receipt_exports = {};
164183
- __export(context_receipt_exports, {
164184
- buildBoundedContextReceipt: () => buildBoundedContextReceipt
164185
- });
164186
- function buildBoundedContextReceipt(input) {
164187
- const provider2 = input.providerQuality ?? input.workset.provenance.codeProvider;
164188
- return {
164189
- schemaVersion: "1",
164190
- task: input.workset.task,
164191
- brief: input.workset.prompt,
164192
- receipt: input.workset.receipt,
164193
- code: {
164194
- selected: provider2?.selected ?? "lite",
164195
- quality: provider2?.selectedQuality ?? "heuristic",
164196
- externalState: provider2?.external.state ?? "not-detected",
164197
- ...input.workset.provenance.snapshotId ? { snapshotId: input.workset.provenance.snapshotId } : {}
164198
- },
164199
- ...input.workset.agentLoadout ? { loadout: input.workset.agentLoadout } : {},
164200
- ...input.workset.continuity ? {
164201
- continuity: {
164202
- taskId: input.workset.continuity.taskId,
164203
- status: input.workset.continuity.status,
164204
- outcome: input.workset.continuity.outcome
164205
- }
164206
- } : {}
164207
- };
164208
- }
164209
- var init_context_receipt = __esm({
164210
- "src/knowledge/context-receipt.ts"() {
164211
- "use strict";
164212
- init_esm_shims();
164213
- }
164214
- });
164215
-
164216
164552
  // src/codegraph/context-pack.ts
164217
164553
  var context_pack_exports = {};
164218
164554
  __export(context_pack_exports, {
@@ -164389,6 +164725,22 @@ async function attachTaskWorkset(input) {
164389
164725
  startHere: uniq2([...semanticStartHere, ...input.pack.suggestedReads]),
164390
164726
  ...semanticCode ? { semanticCode } : {},
164391
164727
  ...input.providerQuality ? { providerQuality: input.providerQuality } : {},
164728
+ retrieval: {
164729
+ mode: semanticCode ? "hybrid" : "unknown",
164730
+ ...input.providerQuality?.selected ? { codeProvider: input.providerQuality.selected } : {},
164731
+ derivedViews: {
164732
+ graph: buildCodeGraphDerivedView({
164733
+ providerQuality: input.providerQuality,
164734
+ ...input.snapshot ? {
164735
+ snapshot: {
164736
+ id: input.snapshot.id,
164737
+ sourceEpoch: input.snapshot.sourceEpoch,
164738
+ incomplete: input.snapshot.incomplete
164739
+ }
164740
+ } : {}
164741
+ })
164742
+ }
164743
+ },
164392
164744
  reliableMemory: input.pack.memories.filter((memory) => memory.status === "current").map((memory) => ({
164393
164745
  id: memory.id,
164394
164746
  title: memory.title,
@@ -164459,6 +164811,7 @@ var init_context_pack = __esm({
164459
164811
  "use strict";
164460
164812
  init_esm_shims();
164461
164813
  init_freshness2();
164814
+ init_context_receipt();
164462
164815
  init_workset();
164463
164816
  init_exclude3();
164464
164817
  init_semantic_context();
@@ -167635,7 +167988,8 @@ async function handleApi(req, res, dataDir, projectId, projectName, baseDir, pro
167635
167988
  "ANTHROPIC_API_KEY",
167636
167989
  ...resolved.memory.llm.provider === "openrouter" || resolved.memory.llm.baseUrl?.includes("openrouter.ai") ? ["OPENROUTER_API_KEY"] : [],
167637
167990
  ...resolved.memory.llm.provider === "requesty" ? ["REQUESTY_API_KEY"] : [],
167638
- ...resolved.memory.llm.provider === "apiroute" ? ["API_ROUTE_API_KEY"] : []
167991
+ ...resolved.memory.llm.provider === "apiroute" ? ["API_ROUTE_API_KEY"] : [],
167992
+ ...resolved.memory.llm.provider === "cheaperinference" ? ["CHEAPER_INFERENCE_API_KEY"] : []
167639
167993
  ];
167640
167994
  if (llmKey) {
167641
167995
  const src = resolveDashboardKeySource({ value: llmKey, envKeys: memoryKeyEnv, configSource });
@@ -169221,7 +169575,7 @@ async function analyzeImage(input) {
169221
169575
  const config = getLLMConfig();
169222
169576
  if (!OPENAI_COMPATIBLE_PROVIDERS.has(config.provider)) {
169223
169577
  throw new Error(
169224
- `Image analysis requires an OpenAI-compatible provider (openai, openrouter, requesty, apiroute, or custom). Current provider "${config.provider}" uses a different API shape. Set MEMORIX_LLM_PROVIDER=openai or configure an OpenAI-compatible base URL.`
169578
+ `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.`
169225
169579
  );
169226
169580
  }
169227
169581
  const bytes = decodeBase64ImagePayload(input.base64, MAX_VISION_IMAGE_BYTES);
@@ -169260,7 +169614,7 @@ var init_image_loader = __esm({
169260
169614
  init_provider2();
169261
169615
  init_secret_filter();
169262
169616
  init_image_payload();
169263
- OPENAI_COMPATIBLE_PROVIDERS = /* @__PURE__ */ new Set(["openai", "openrouter", "requesty", "apiroute", "custom"]);
169617
+ OPENAI_COMPATIBLE_PROVIDERS = /* @__PURE__ */ new Set(["openai", "openrouter", "requesty", "apiroute", "cheaperinference", "custom"]);
169264
169618
  MAX_VISION_PROMPT_CHARS = 12e3;
169265
169619
  MAX_VISION_DESCRIPTION_CHARS = 12e3;
169266
169620
  MAX_VISION_LABELS = 50;
@@ -171374,7 +171728,7 @@ __export(server_exports2, {
171374
171728
  createMemorixServer: () => createMemorixServer,
171375
171729
  shouldAwaitProjectRuntime: () => shouldAwaitProjectRuntime
171376
171730
  });
171377
- import { createHash as createHash19 } from "crypto";
171731
+ import { createHash as createHash20 } from "crypto";
171378
171732
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
171379
171733
  import { z as z627 } from "zod";
171380
171734
  function formatFormationStageDurations(stageDurationsMs) {
@@ -171458,7 +171812,7 @@ function coerceObjectArray(val) {
171458
171812
  return [];
171459
171813
  }
171460
171814
  function createDeterministicInstanceId(projectId, agentType, agentName) {
171461
- const digest2 = createHash19("sha256").update(projectId).update("\n").update(agentType).update("\n").update(agentName ?? "").digest("hex").slice(0, 24);
171815
+ const digest2 = createHash20("sha256").update(projectId).update("\n").update(agentType).update("\n").update(agentName ?? "").digest("hex").slice(0, 24);
171462
171816
  return `auto-${digest2}`;
171463
171817
  }
171464
171818
  function shouldAwaitProjectRuntime(toolName) {
@@ -172534,20 +172888,17 @@ Use this as the \`topicKey\` parameter in \`memorix_store\` to enable upsert beh
172534
172888
  if (duplicate) return duplicate;
172535
172889
  }
172536
172890
  let text3 = result.formatted;
172537
- try {
172538
- const { getLastSearchMode: getLastSearchMode2 } = await Promise.resolve().then(() => (init_orama_store(), orama_store_exports));
172539
- text3 += `
172891
+ text3 += `
172540
172892
 
172541
- _Search mode: ${getLastSearchMode2(project.id)}_`;
172542
- } catch {
172543
- }
172893
+ _Search mode: ${result.receipt.mode}_`;
172544
172894
  return {
172545
172895
  content: [
172546
172896
  {
172547
172897
  type: "text",
172548
172898
  text: text3
172549
172899
  }
172550
- ]
172900
+ ],
172901
+ structuredContent: { retrieval: result.receipt }
172551
172902
  };
172552
172903
  }, { loadCorpus: false });
172553
172904
  }
@@ -174532,9 +174883,16 @@ Ensure the path points to a directory containing a .git folder (or a subdirector
174532
174883
  agent,
174533
174884
  reader: getObservationReader()
174534
174885
  });
174886
+ const bindingReceipt = projectBinding.receipt({
174887
+ dataDir: projectDir2,
174888
+ transport: options.bindingTransport,
174889
+ gitRemote: project.gitRemote,
174890
+ handle: options.bindingHandle
174891
+ });
174535
174892
  const lines = [
174536
174893
  `[OK] Session started: ${result.session.id}`,
174537
174894
  `Project: ${project.name} (${project.id})`,
174895
+ `Binding: ${bindingReceipt.state} via ${bindingReceipt.source}`,
174538
174896
  result.session.agent ? `Agent: ${result.session.agent}` : "",
174539
174897
  registeredAgent ? `Agent ID: ${registeredAgent.agent_id} (instance: ${registeredAgent.instance_id})` : "",
174540
174898
  !registeredAgent ? "Coordination identity: not joined (memory/session context only)" : "",
@@ -174609,7 +174967,8 @@ ${s2.instruction}`.toLowerCase();
174609
174967
  } catch {
174610
174968
  }
174611
174969
  return {
174612
- content: [{ type: "text", text: lines.filter(Boolean).join("\n") }]
174970
+ content: [{ type: "text", text: lines.filter(Boolean).join("\n") }],
174971
+ structuredContent: { binding: bindingReceipt }
174613
174972
  };
174614
174973
  }
174615
174974
  );
@@ -176822,7 +177181,7 @@ var init_serve_shared = __esm({
176822
177181
 
176823
177182
  // src/cli/version.ts
176824
177183
  function getCliVersion() {
176825
- return true ? "1.9.12" : pkg.version;
177184
+ return true ? "1.10.1" : pkg.version;
176826
177185
  }
176827
177186
  var init_version3 = __esm({
176828
177187
  "src/cli/version.ts"() {