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
@@ -2407,7 +2407,8 @@ function getResolvedConfig(options = {}) {
2407
2407
  const isAtlasCloud = memoryLlmProvider === "atlascloud";
2408
2408
  const isRequesty = memoryLlmProvider === "requesty";
2409
2409
  const isApiRoute = memoryLlmProvider === "apiroute";
2410
- const usesPresetKeyOnly = isAtlasCloud || isRequesty || isApiRoute;
2410
+ const isCheaperInference = memoryLlmProvider === "cheaperinference";
2411
+ const usesPresetKeyOnly = isAtlasCloud || isRequesty || isApiRoute || isCheaperInference;
2411
2412
  const memoryLlmApiKey = first(
2412
2413
  process.env.MEMORIX_LLM_API_KEY,
2413
2414
  process.env.MEMORIX_API_KEY,
@@ -2415,7 +2416,7 @@ function getResolvedConfig(options = {}) {
2415
2416
  yaml.llm?.apiKey,
2416
2417
  legacy.llm?.apiKey,
2417
2418
  // Never borrow another provider's credentials for these gateway presets.
2418
- isAtlasCloud ? process.env.ATLASCLOUD_API_KEY : isRequesty ? process.env.REQUESTY_API_KEY : isApiRoute ? process.env.API_ROUTE_API_KEY : process.env.OPENAI_API_KEY,
2419
+ 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,
2419
2420
  usesPresetKeyOnly ? void 0 : process.env.ANTHROPIC_API_KEY,
2420
2421
  usesPresetKeyOnly ? void 0 : openRouterMemoryLlmApiKey
2421
2422
  );
@@ -2599,6 +2600,7 @@ function getEnvSourceNames() {
2599
2600
  "OPENROUTER_API_KEY",
2600
2601
  "REQUESTY_API_KEY",
2601
2602
  "API_ROUTE_API_KEY",
2603
+ "CHEAPER_INFERENCE_API_KEY",
2602
2604
  "ATLASCLOUD_API_KEY"
2603
2605
  ].filter((name) => process.env[name]);
2604
2606
  }
@@ -5593,6 +5595,7 @@ var init_provider2 = __esm({
5593
5595
  openrouter: { baseUrl: "https://openrouter.ai/api/v1", model: "openai/gpt-4.1-nano" },
5594
5596
  requesty: { baseUrl: "https://router.requesty.ai/v1", model: "openai/gpt-4.1-nano" },
5595
5597
  apiroute: { baseUrl: "https://global.api-route.com/v1", model: "deepseek-v4.1-flash" },
5598
+ cheaperinference: { baseUrl: "https://api.cheaperinference.com/v1", model: "gpt-5.4-mini" },
5596
5599
  atlascloud: { baseUrl: "https://api.atlascloud.ai/v1", model: "deepseek-ai/deepseek-v3.2" },
5597
5600
  custom: { baseUrl: "http://localhost:11434/v1", model: "llama3" }
5598
5601
  };
@@ -7151,9 +7154,11 @@ __export(orama_store_exports, {
7151
7154
  getActiveSemanticIndexProfile: () => getActiveSemanticIndexProfile,
7152
7155
  getDb: () => getDb,
7153
7156
  getDeferredCachedVectorHydration: () => getDeferredCachedVectorHydration,
7157
+ getLastSearchDiagnostics: () => getLastSearchDiagnostics,
7154
7158
  getLastSearchMode: () => getLastSearchMode,
7155
7159
  getObservationCount: () => getObservationCount,
7156
7160
  getObservationsByIds: () => getObservationsByIds,
7161
+ getSearchDerivedViews: () => getSearchDerivedViews,
7157
7162
  getTimeline: () => getTimeline,
7158
7163
  getVectorDimensions: () => getVectorDimensions,
7159
7164
  hasObservationVector: () => hasObservationVector,
@@ -7180,6 +7185,68 @@ function rememberSearchMode(key, value) {
7180
7185
  function getLastSearchMode(projectId) {
7181
7186
  return lastSearchModeByProject.get(projectId ?? SEARCH_MODE_DEFAULT_KEY) ?? "fulltext";
7182
7187
  }
7188
+ function getLastSearchDiagnostics(projectId) {
7189
+ const diagnostics = lastSearchDiagnosticsByProject.get(projectId ?? SEARCH_MODE_DEFAULT_KEY);
7190
+ return diagnostics ? { ...diagnostics } : void 0;
7191
+ }
7192
+ function getSearchDerivedViews() {
7193
+ const views = {};
7194
+ const store = getOptionalObservationStore();
7195
+ if (store) {
7196
+ try {
7197
+ const generation = store.getGeneration();
7198
+ if (store.hasLexicalIndex?.()) {
7199
+ views.fts = { generation, freshness: "current", rebuildStatus: "idle" };
7200
+ } else {
7201
+ views.fts = {
7202
+ generation,
7203
+ freshness: "unknown",
7204
+ rebuildStatus: "unavailable",
7205
+ failureReason: store.getBackendReason?.() ?? "persistent lexical index unavailable"
7206
+ };
7207
+ }
7208
+ } catch (error) {
7209
+ views.fts = {
7210
+ freshness: "unknown",
7211
+ rebuildStatus: "failed",
7212
+ failureReason: error instanceof Error ? error.message.slice(0, 240) : String(error).slice(0, 240)
7213
+ };
7214
+ }
7215
+ } else {
7216
+ views.fts = {
7217
+ freshness: "unknown",
7218
+ rebuildStatus: "unavailable",
7219
+ failureReason: "observation store is not initialized"
7220
+ };
7221
+ }
7222
+ views.orama = db ? { generation: dbGeneration, freshness: "current", rebuildStatus: "idle" } : {
7223
+ generation: dbGeneration,
7224
+ freshness: "unknown",
7225
+ rebuildStatus: "unavailable",
7226
+ failureReason: "Orama index is not initialized"
7227
+ };
7228
+ const configuredEmbeddingMode = process.env.MEMORIX_EMBEDDING?.trim().toLowerCase();
7229
+ if (configuredEmbeddingMode === "off") {
7230
+ views.embedding = { freshness: "current", rebuildStatus: "disabled" };
7231
+ } else if (embeddingEnabled) {
7232
+ views.embedding = { freshness: "current", rebuildStatus: "idle" };
7233
+ } else {
7234
+ views.embedding = {
7235
+ freshness: "unknown",
7236
+ rebuildStatus: "unavailable",
7237
+ failureReason: "embedding provider is not initialized"
7238
+ };
7239
+ }
7240
+ return views;
7241
+ }
7242
+ function rememberSearchDiagnostics(key, value) {
7243
+ if (!lastSearchDiagnosticsByProject.has(key) && lastSearchDiagnosticsByProject.size >= MAX_SEARCH_MODE_KEYS) {
7244
+ const oldest = lastSearchDiagnosticsByProject.keys().next().value;
7245
+ if (oldest !== void 0) lastSearchDiagnosticsByProject.delete(oldest);
7246
+ }
7247
+ lastSearchDiagnosticsByProject.delete(key);
7248
+ lastSearchDiagnosticsByProject.set(key, value);
7249
+ }
7183
7250
  function getOptionalObservationStore() {
7184
7251
  try {
7185
7252
  return getObservationStore();
@@ -7462,6 +7529,7 @@ async function resetDb() {
7462
7529
  indexEmbeddingProvider = null;
7463
7530
  deferredCachedVectorHydration = null;
7464
7531
  lastSearchModeByProject.clear();
7532
+ lastSearchDiagnosticsByProject.clear();
7465
7533
  }
7466
7534
  function isEmbeddingEnabled() {
7467
7535
  return embeddingEnabled;
@@ -7679,6 +7747,7 @@ async function removeObservation(oramaId) {
7679
7747
  await remove2(database, oramaId);
7680
7748
  }
7681
7749
  async function searchObservations(options) {
7750
+ const searchStartedAt = Date.now();
7682
7751
  const perf = !!process.env.MEMORIX_PERF;
7683
7752
  const t0 = perf ? performance.now() : 0;
7684
7753
  const mark = (label) => {
@@ -7754,6 +7823,8 @@ async function searchObservations(options) {
7754
7823
  let queryVector = null;
7755
7824
  let embeddingProviderForSearch = null;
7756
7825
  let embeddingUnavailable = false;
7826
+ let fallbackUsed = false;
7827
+ let fallbackReason;
7757
7828
  if (quality !== "fast" && embeddingEnabled && hasQuery && tier !== "fast") {
7758
7829
  try {
7759
7830
  const provider2 = await getEmbeddingProvider();
@@ -7762,6 +7833,8 @@ async function searchObservations(options) {
7762
7833
  const activeVectorDimensions = getVectorDimensions();
7763
7834
  if (activeVectorDimensions !== null && provider2.dimensions !== activeVectorDimensions) {
7764
7835
  embeddingUnavailable = true;
7836
+ fallbackUsed = true;
7837
+ fallbackReason = "embedding dimension mismatch; lexical search used";
7765
7838
  rememberSearchMode(
7766
7839
  modeKey,
7767
7840
  `fulltext (embedding dimension mismatch: provider ${provider2.dimensions}d vs index ${activeVectorDimensions}d)`
@@ -7803,9 +7876,13 @@ async function searchObservations(options) {
7803
7876
  }
7804
7877
  } else {
7805
7878
  embeddingUnavailable = true;
7879
+ fallbackUsed = true;
7880
+ fallbackReason = "embedding provider unavailable; lexical search used";
7806
7881
  }
7807
7882
  } catch (error) {
7808
7883
  embeddingUnavailable = true;
7884
+ fallbackUsed = true;
7885
+ fallbackReason = "embedding failed or timed out; lexical search used";
7809
7886
  rememberSearchMode(modeKey, "fulltext (embedding unavailable)");
7810
7887
  console.error("[memorix] Embedding failed or timed out, falling back to fulltext search");
7811
7888
  }
@@ -7855,6 +7932,8 @@ async function searchObservations(options) {
7855
7932
  similarity: 0.25
7856
7933
  };
7857
7934
  rememberSearchMode(modeKey, "vector-only (hybrid empty fallback)");
7935
+ fallbackUsed = true;
7936
+ fallbackReason = "hybrid search returned no results; vector-only fallback used";
7858
7937
  results = await search(database, vectorOnlyParams);
7859
7938
  } catch {
7860
7939
  }
@@ -8128,6 +8207,7 @@ async function searchObservations(options) {
8128
8207
  mark(`rerank(skipped,tier=${tier})`);
8129
8208
  }
8130
8209
  let entries = intermediate.map(({ rawTime: _, _isCommandLog: _c, ...rest }) => rest);
8210
+ const candidateCount = entries.length;
8131
8211
  for (const hit of results.hits) {
8132
8212
  const doc = hit.document;
8133
8213
  if (canReadObservation(doc, options.reader, projectIds ?? void 0)) rememberObservationDoc(doc);
@@ -8170,9 +8250,22 @@ async function searchObservations(options) {
8170
8250
  }
8171
8251
  }
8172
8252
  }
8253
+ const beforeTokenBudget = entries.length;
8173
8254
  if (options.maxTokens && options.maxTokens > 0) {
8174
8255
  entries = applyTokenBudget(entries, options.maxTokens);
8175
8256
  }
8257
+ rememberSearchDiagnostics(modeKey, {
8258
+ version: "1",
8259
+ mode: getLastSearchMode(options.projectId),
8260
+ rawCandidateCount: results.hits.length,
8261
+ candidateCount,
8262
+ selectedCount: entries.length,
8263
+ omittedCount: Math.max(0, candidateCount - entries.length),
8264
+ omittedByTokenBudget: Math.max(0, beforeTokenBudget - entries.length),
8265
+ fallbackUsed,
8266
+ ...fallbackReason ? { fallbackReason } : {},
8267
+ elapsedMs: Math.max(0, Date.now() - searchStartedAt)
8268
+ });
8176
8269
  if (options.trackAccess !== false) {
8177
8270
  const returnedKeys = new Set(entries.map((entry) => makeEntryKey(entry.projectId, entry.id)));
8178
8271
  const hitDocs = results.hits.map((hit) => ({ id: hit.id, doc: hit.document })).filter(({ doc }) => returnedKeys.has(makeEntryKey(doc.projectId, doc.observationId)));
@@ -8288,7 +8381,7 @@ function formatTime(isoDate) {
8288
8381
  return isoDate;
8289
8382
  }
8290
8383
  }
8291
- 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_TITLE, COMMAND_STYLE_TITLE, COMMAND_LIKE_QUERY2, COMMAND_INTENT_QUERY, NATURAL_LANGUAGE_MARKERS;
8384
+ 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_TITLE, COMMAND_STYLE_TITLE, COMMAND_LIKE_QUERY2, COMMAND_INTENT_QUERY, NATURAL_LANGUAGE_MARKERS;
8292
8385
  var init_orama_store = __esm({
8293
8386
  "src/store/orama-store.ts"() {
8294
8387
  "use strict";
@@ -8314,6 +8407,7 @@ var init_orama_store = __esm({
8314
8407
  NON_CJK_HYBRID_SIMILARITY = 0.45;
8315
8408
  CJK_RUN = /[\u3400-\u4dbf\u4e00-\u9fff\u3040-\u30ff\uac00-\ud7af]+/gu;
8316
8409
  lastSearchModeByProject = /* @__PURE__ */ new Map();
8410
+ lastSearchDiagnosticsByProject = /* @__PURE__ */ new Map();
8317
8411
  SEARCH_MODE_DEFAULT_KEY = "__global__";
8318
8412
  MAX_SEARCH_MODE_KEYS = 4096;
8319
8413
  COMMAND_LOG_TITLE = /^(Ran:|Command:|Executed:)\s/i;
@@ -33661,6 +33755,25 @@ var init_models_generated = __esm({
33661
33755
  }
33662
33756
  },
33663
33757
  "minimax": {
33758
+ "MiniMax-M3.1-Flash": {
33759
+ id: "MiniMax-M3.1-Flash",
33760
+ name: "MiniMax-M3.1-Flash",
33761
+ api: "anthropic-messages",
33762
+ provider: "minimax",
33763
+ baseUrl: "https://api.minimax.io/anthropic",
33764
+ compat: { "forceAdaptiveThinking": true },
33765
+ reasoning: true,
33766
+ thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
33767
+ input: ["text", "image", "video"],
33768
+ cost: {
33769
+ input: 0.15,
33770
+ output: 0.6,
33771
+ cacheRead: 0.015,
33772
+ cacheWrite: 0
33773
+ },
33774
+ contextWindow: 1e6,
33775
+ maxTokens: 524288
33776
+ },
33664
33777
  "MiniMax-M2.7": {
33665
33778
  id: "MiniMax-M2.7",
33666
33779
  name: "MiniMax-M2.7",
@@ -33701,6 +33814,7 @@ var init_models_generated = __esm({
33701
33814
  api: "anthropic-messages",
33702
33815
  provider: "minimax",
33703
33816
  baseUrl: "https://api.minimax.io/anthropic",
33817
+ compat: { "forceAdaptiveThinking": true },
33704
33818
  reasoning: true,
33705
33819
  input: ["text", "image", "video"],
33706
33820
  cost: {
@@ -33710,10 +33824,29 @@ var init_models_generated = __esm({
33710
33824
  cacheWrite: 0
33711
33825
  },
33712
33826
  contextWindow: 1e6,
33713
- maxTokens: 128e3
33827
+ maxTokens: 524288
33714
33828
  }
33715
33829
  },
33716
33830
  "minimax-cn": {
33831
+ "MiniMax-M3.1-Flash": {
33832
+ id: "MiniMax-M3.1-Flash",
33833
+ name: "MiniMax-M3.1-Flash",
33834
+ api: "anthropic-messages",
33835
+ provider: "minimax-cn",
33836
+ baseUrl: "https://api.minimaxi.com/anthropic",
33837
+ compat: { "forceAdaptiveThinking": true },
33838
+ reasoning: true,
33839
+ thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
33840
+ input: ["text", "image", "video"],
33841
+ cost: {
33842
+ input: 0.15,
33843
+ output: 0.6,
33844
+ cacheRead: 0.015,
33845
+ cacheWrite: 0
33846
+ },
33847
+ contextWindow: 1e6,
33848
+ maxTokens: 524288
33849
+ },
33717
33850
  "MiniMax-M2.7": {
33718
33851
  id: "MiniMax-M2.7",
33719
33852
  name: "MiniMax-M2.7",
@@ -33754,6 +33887,7 @@ var init_models_generated = __esm({
33754
33887
  api: "anthropic-messages",
33755
33888
  provider: "minimax-cn",
33756
33889
  baseUrl: "https://api.minimaxi.com/anthropic",
33890
+ compat: { "forceAdaptiveThinking": true },
33757
33891
  reasoning: true,
33758
33892
  input: ["text", "image", "video"],
33759
33893
  cost: {
@@ -33763,7 +33897,7 @@ var init_models_generated = __esm({
33763
33897
  cacheWrite: 0
33764
33898
  },
33765
33899
  contextWindow: 1e6,
33766
- maxTokens: 128e3
33900
+ maxTokens: 524288
33767
33901
  }
33768
33902
  },
33769
33903
  "mistral": {
@@ -36884,6 +37018,24 @@ var init_models_generated = __esm({
36884
37018
  }
36885
37019
  },
36886
37020
  "openrouter": {
37021
+ "minimax/minimax-m3.1-flash:free": {
37022
+ id: "minimax/minimax-m3.1-flash:free",
37023
+ name: "MiniMax: MiniMax M3.1 Flash (free)",
37024
+ api: "openai-completions",
37025
+ provider: "openrouter",
37026
+ baseUrl: "https://openrouter.ai/api/v1",
37027
+ reasoning: true,
37028
+ thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
37029
+ input: ["text", "image"],
37030
+ cost: {
37031
+ input: 0,
37032
+ output: 0,
37033
+ cacheRead: 0,
37034
+ cacheWrite: 0
37035
+ },
37036
+ contextWindow: 1e6,
37037
+ maxTokens: 524288
37038
+ },
36887
37039
  "ai21/jamba-large-1.7": {
36888
37040
  id: "ai21/jamba-large-1.7",
36889
37041
  name: "AI21: Jamba Large 1.7",
@@ -45585,6 +45737,14 @@ var init_models_generated = __esm({
45585
45737
  }
45586
45738
  });
45587
45739
 
45740
+ // packages/ai/dist/minimax-models.js
45741
+ var init_minimax_models = __esm({
45742
+ "packages/ai/dist/minimax-models.js"() {
45743
+ "use strict";
45744
+ init_esm_shims();
45745
+ }
45746
+ });
45747
+
45588
45748
  // packages/ai/dist/models.js
45589
45749
  function calculateCost(model, usage) {
45590
45750
  usage.cost.input = model.cost.input / 1e6 * usage.input;
@@ -45631,6 +45791,8 @@ var init_models2 = __esm({
45631
45791
  "use strict";
45632
45792
  init_esm_shims();
45633
45793
  init_models_generated();
45794
+ init_minimax_models();
45795
+ init_minimax_models();
45634
45796
  modelRegistry = /* @__PURE__ */ new Map();
45635
45797
  for (const [provider2, models] of Object.entries(MODELS)) {
45636
45798
  const providerModels = /* @__PURE__ */ new Map();
@@ -53584,6 +53746,25 @@ function buildParams2(model, context, isOAuthToken2, options) {
53584
53746
  params.tool_choice = options.toolChoice;
53585
53747
  }
53586
53748
  }
53749
+ return normalizeMiniMaxParams(model, params, options);
53750
+ }
53751
+ function normalizeMiniMaxParams(model, params, options) {
53752
+ if (model.provider !== "minimax" && model.provider !== "minimax-cn")
53753
+ return params;
53754
+ if (params.model === "MiniMax-M3.1-Flash") {
53755
+ const effort = params.output_config?.effort ?? options?.effort ?? "max";
53756
+ const normalized = { ...params, thinking: { type: "adaptive" } };
53757
+ normalized.output_config = {
53758
+ ...params.output_config,
53759
+ effort: ["low", "medium", "high", "xhigh", "max"].includes(effort) ? effort : "max"
53760
+ };
53761
+ delete normalized.service_tier;
53762
+ delete normalized.reasoning_split;
53763
+ return normalized;
53764
+ }
53765
+ if (params.model === "MiniMax-M3" && params.thinking) {
53766
+ return { ...params, thinking: { type: params.thinking.type === "disabled" ? "disabled" : "adaptive" } };
53767
+ }
53587
53768
  return params;
53588
53769
  }
53589
53770
  function normalizeToolCallId(id) {
@@ -53890,6 +54071,7 @@ var init_anthropic = __esm({
53890
54071
  if (nextParams !== void 0) {
53891
54072
  params = nextParams;
53892
54073
  }
54074
+ params = normalizeMiniMaxParams(model, params, options);
53893
54075
  const requestOptions = {
53894
54076
  ...options?.signal ? { signal: options.signal } : {},
53895
54077
  ...options?.timeoutMs !== void 0 ? { timeout: options.timeoutMs } : {},
@@ -136660,6 +136842,18 @@ var init_openai_completions = __esm({
136660
136842
  if (nextParams !== void 0) {
136661
136843
  params = nextParams;
136662
136844
  }
136845
+ if (model.provider === "openrouter" && new URL(model.baseUrl).hostname === "openrouter.ai" && params.model === "minimax/minimax-m3.1-flash:free") {
136846
+ const flash = params;
136847
+ const effort = flash.reasoning?.effort ?? "max";
136848
+ flash.reasoning = {
136849
+ ...flash.reasoning,
136850
+ enabled: true,
136851
+ effort: ["low", "medium", "high", "xhigh", "max"].includes(effort) ? effort : "max"
136852
+ };
136853
+ delete flash.reasoning_effort;
136854
+ delete flash.reasoning_split;
136855
+ delete flash.service_tier;
136856
+ }
136663
136857
  const requestOptions = {
136664
136858
  ...options?.signal ? { signal: options.signal } : {},
136665
136859
  ...options?.timeoutMs !== void 0 ? { timeout: options.timeoutMs } : {},
@@ -76066,6 +76066,25 @@ var init_models_generated = __esm({
76066
76066
  }
76067
76067
  },
76068
76068
  "minimax": {
76069
+ "MiniMax-M3.1-Flash": {
76070
+ id: "MiniMax-M3.1-Flash",
76071
+ name: "MiniMax-M3.1-Flash",
76072
+ api: "anthropic-messages",
76073
+ provider: "minimax",
76074
+ baseUrl: "https://api.minimax.io/anthropic",
76075
+ compat: { "forceAdaptiveThinking": true },
76076
+ reasoning: true,
76077
+ thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
76078
+ input: ["text", "image", "video"],
76079
+ cost: {
76080
+ input: 0.15,
76081
+ output: 0.6,
76082
+ cacheRead: 0.015,
76083
+ cacheWrite: 0
76084
+ },
76085
+ contextWindow: 1e6,
76086
+ maxTokens: 524288
76087
+ },
76069
76088
  "MiniMax-M2.7": {
76070
76089
  id: "MiniMax-M2.7",
76071
76090
  name: "MiniMax-M2.7",
@@ -76106,6 +76125,7 @@ var init_models_generated = __esm({
76106
76125
  api: "anthropic-messages",
76107
76126
  provider: "minimax",
76108
76127
  baseUrl: "https://api.minimax.io/anthropic",
76128
+ compat: { "forceAdaptiveThinking": true },
76109
76129
  reasoning: true,
76110
76130
  input: ["text", "image", "video"],
76111
76131
  cost: {
@@ -76115,10 +76135,29 @@ var init_models_generated = __esm({
76115
76135
  cacheWrite: 0
76116
76136
  },
76117
76137
  contextWindow: 1e6,
76118
- maxTokens: 128e3
76138
+ maxTokens: 524288
76119
76139
  }
76120
76140
  },
76121
76141
  "minimax-cn": {
76142
+ "MiniMax-M3.1-Flash": {
76143
+ id: "MiniMax-M3.1-Flash",
76144
+ name: "MiniMax-M3.1-Flash",
76145
+ api: "anthropic-messages",
76146
+ provider: "minimax-cn",
76147
+ baseUrl: "https://api.minimaxi.com/anthropic",
76148
+ compat: { "forceAdaptiveThinking": true },
76149
+ reasoning: true,
76150
+ thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
76151
+ input: ["text", "image", "video"],
76152
+ cost: {
76153
+ input: 0.15,
76154
+ output: 0.6,
76155
+ cacheRead: 0.015,
76156
+ cacheWrite: 0
76157
+ },
76158
+ contextWindow: 1e6,
76159
+ maxTokens: 524288
76160
+ },
76122
76161
  "MiniMax-M2.7": {
76123
76162
  id: "MiniMax-M2.7",
76124
76163
  name: "MiniMax-M2.7",
@@ -76159,6 +76198,7 @@ var init_models_generated = __esm({
76159
76198
  api: "anthropic-messages",
76160
76199
  provider: "minimax-cn",
76161
76200
  baseUrl: "https://api.minimaxi.com/anthropic",
76201
+ compat: { "forceAdaptiveThinking": true },
76162
76202
  reasoning: true,
76163
76203
  input: ["text", "image", "video"],
76164
76204
  cost: {
@@ -76168,7 +76208,7 @@ var init_models_generated = __esm({
76168
76208
  cacheWrite: 0
76169
76209
  },
76170
76210
  contextWindow: 1e6,
76171
- maxTokens: 128e3
76211
+ maxTokens: 524288
76172
76212
  }
76173
76213
  },
76174
76214
  "mistral": {
@@ -79289,6 +79329,24 @@ var init_models_generated = __esm({
79289
79329
  }
79290
79330
  },
79291
79331
  "openrouter": {
79332
+ "minimax/minimax-m3.1-flash:free": {
79333
+ id: "minimax/minimax-m3.1-flash:free",
79334
+ name: "MiniMax: MiniMax M3.1 Flash (free)",
79335
+ api: "openai-completions",
79336
+ provider: "openrouter",
79337
+ baseUrl: "https://openrouter.ai/api/v1",
79338
+ reasoning: true,
79339
+ thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
79340
+ input: ["text", "image"],
79341
+ cost: {
79342
+ input: 0,
79343
+ output: 0,
79344
+ cacheRead: 0,
79345
+ cacheWrite: 0
79346
+ },
79347
+ contextWindow: 1e6,
79348
+ maxTokens: 524288
79349
+ },
79292
79350
  "ai21/jamba-large-1.7": {
79293
79351
  id: "ai21/jamba-large-1.7",
79294
79352
  name: "AI21: Jamba Large 1.7",
@@ -87990,6 +88048,25 @@ var init_models_generated = __esm({
87990
88048
  }
87991
88049
  });
87992
88050
 
88051
+ // packages/ai/dist/minimax-models.js
88052
+ function isLegacyMiniMaxTextModel(model) {
88053
+ let host;
88054
+ try {
88055
+ host = new URL(model.baseUrl).hostname;
88056
+ } catch {
88057
+ return false;
88058
+ }
88059
+ const direct = (model.provider === "minimax" || model.provider === "minimax-cn") && (host === "api.minimax.io" || host === "api.minimaxi.com");
88060
+ const gateway = model.provider === "openrouter" && host === "openrouter.ai" || (model.provider === "opencode" || model.provider === "opencode-go") && host === "opencode.ai";
88061
+ return (direct || gateway) && /^(?:minimax\/)?(?:minimax-(?:01|m[12](?:[.\-][^/:]*)?)|m2-her)(?::[^/]*)?$/i.test(model.id);
88062
+ }
88063
+ var init_minimax_models = __esm({
88064
+ "packages/ai/dist/minimax-models.js"() {
88065
+ "use strict";
88066
+ init_esm_shims();
88067
+ }
88068
+ });
88069
+
87993
88070
  // packages/ai/dist/models.js
87994
88071
  function getModel(provider, modelId) {
87995
88072
  const providerModels = modelRegistry.get(provider);
@@ -87998,9 +88075,13 @@ function getModel(provider, modelId) {
87998
88075
  function getProviders() {
87999
88076
  return Array.from(modelRegistry.keys());
88000
88077
  }
88001
- function getModels(provider) {
88078
+ function getModels(provider, options2 = {}) {
88002
88079
  const models = modelRegistry.get(provider);
88003
- return models ? Array.from(models.values()) : [];
88080
+ const available = (models ? Array.from(models.values()) : []).filter((model) => options2.includeLegacy || !isLegacyMiniMaxTextModel(model));
88081
+ if (provider === "minimax" || provider === "minimax-cn") {
88082
+ available.sort((a, b) => Number(b.id === "MiniMax-M3.1-Flash") - Number(a.id === "MiniMax-M3.1-Flash"));
88083
+ }
88084
+ return available;
88004
88085
  }
88005
88086
  function calculateCost(model, usage) {
88006
88087
  usage.cost.input = model.cost.input / 1e6 * usage.input;
@@ -88052,6 +88133,8 @@ var init_models2 = __esm({
88052
88133
  "use strict";
88053
88134
  init_esm_shims();
88054
88135
  init_models_generated();
88136
+ init_minimax_models();
88137
+ init_minimax_models();
88055
88138
  modelRegistry = /* @__PURE__ */ new Map();
88056
88139
  for (const [provider, models] of Object.entries(MODELS)) {
88057
88140
  const providerModels = /* @__PURE__ */ new Map();
@@ -95998,6 +96081,25 @@ function buildParams2(model, context, isOAuthToken2, options2) {
95998
96081
  params.tool_choice = options2.toolChoice;
95999
96082
  }
96000
96083
  }
96084
+ return normalizeMiniMaxParams(model, params, options2);
96085
+ }
96086
+ function normalizeMiniMaxParams(model, params, options2) {
96087
+ if (model.provider !== "minimax" && model.provider !== "minimax-cn")
96088
+ return params;
96089
+ if (params.model === "MiniMax-M3.1-Flash") {
96090
+ const effort = params.output_config?.effort ?? options2?.effort ?? "max";
96091
+ const normalized = { ...params, thinking: { type: "adaptive" } };
96092
+ normalized.output_config = {
96093
+ ...params.output_config,
96094
+ effort: ["low", "medium", "high", "xhigh", "max"].includes(effort) ? effort : "max"
96095
+ };
96096
+ delete normalized.service_tier;
96097
+ delete normalized.reasoning_split;
96098
+ return normalized;
96099
+ }
96100
+ if (params.model === "MiniMax-M3" && params.thinking) {
96101
+ return { ...params, thinking: { type: params.thinking.type === "disabled" ? "disabled" : "adaptive" } };
96102
+ }
96001
96103
  return params;
96002
96104
  }
96003
96105
  function normalizeToolCallId(id) {
@@ -96304,6 +96406,7 @@ var init_anthropic = __esm({
96304
96406
  if (nextParams !== void 0) {
96305
96407
  params = nextParams;
96306
96408
  }
96409
+ params = normalizeMiniMaxParams(model, params, options2);
96307
96410
  const requestOptions = {
96308
96411
  ...options2?.signal ? { signal: options2.signal } : {},
96309
96412
  ...options2?.timeoutMs !== void 0 ? { timeout: options2.timeoutMs } : {},
@@ -179087,6 +179190,18 @@ var init_openai_completions = __esm({
179087
179190
  if (nextParams !== void 0) {
179088
179191
  params = nextParams;
179089
179192
  }
179193
+ if (model.provider === "openrouter" && new URL(model.baseUrl).hostname === "openrouter.ai" && params.model === "minimax/minimax-m3.1-flash:free") {
179194
+ const flash = params;
179195
+ const effort = flash.reasoning?.effort ?? "max";
179196
+ flash.reasoning = {
179197
+ ...flash.reasoning,
179198
+ enabled: true,
179199
+ effort: ["low", "medium", "high", "xhigh", "max"].includes(effort) ? effort : "max"
179200
+ };
179201
+ delete flash.reasoning_effort;
179202
+ delete flash.reasoning_split;
179203
+ delete flash.service_tier;
179204
+ }
179090
179205
  const requestOptions = {
179091
179206
  ...options2?.signal ? { signal: options2.signal } : {},
179092
179207
  ...options2?.timeoutMs !== void 0 ? { timeout: options2.timeoutMs } : {},
@@ -221057,6 +221172,7 @@ __export(dist_exports, {
221057
221172
  getProviders: () => getProviders,
221058
221173
  getSupportedThinkingLevels: () => getSupportedThinkingLevels,
221059
221174
  isContextOverflow: () => isContextOverflow,
221175
+ isLegacyMiniMaxTextModel: () => isLegacyMiniMaxTextModel,
221060
221176
  modelsAreEqual: () => modelsAreEqual,
221061
221177
  parseJsonWithRepair: () => parseJsonWithRepair,
221062
221178
  parseStreamingJson: () => parseStreamingJson,
@@ -256945,7 +257061,7 @@ var ModelRegistry = class _ModelRegistry {
256945
257061
  /** Load built-in models and apply provider/model overrides */
256946
257062
  loadBuiltInModels(overrides, modelOverrides) {
256947
257063
  return getProviders().flatMap((provider) => {
256948
- const models = getModels(provider);
257064
+ const models = getModels(provider, { includeLegacy: true });
256949
257065
  const providerOverride = overrides.get(provider);
256950
257066
  const perModelOverrides = modelOverrides.get(provider);
256951
257067
  return models.map((m2) => {
@@ -257117,7 +257233,7 @@ File: ${modelsJsonPath}`
257117
257233
  * This is a fast check that doesn't refresh OAuth tokens.
257118
257234
  */
257119
257235
  getAvailable() {
257120
- return this.models.filter((m2) => this.hasConfiguredAuth(m2));
257236
+ return this.models.filter((m2) => !isLegacyMiniMaxTextModel(m2) && this.hasConfiguredAuth(m2));
257121
257237
  }
257122
257238
  /**
257123
257239
  * Find a model by provider and ID.
@@ -274653,8 +274769,8 @@ var defaultModelPerProvider = {
274653
274769
  zai: "glm-5.1",
274654
274770
  "zai-coding-cn": "glm-5.1",
274655
274771
  mistral: "devstral-medium-latest",
274656
- minimax: "MiniMax-M2.7",
274657
- "minimax-cn": "MiniMax-M2.7",
274772
+ minimax: "MiniMax-M3.1-Flash",
274773
+ "minimax-cn": "MiniMax-M3.1-Flash",
274658
274774
  moonshotai: "kimi-k2.6",
274659
274775
  "moonshotai-cn": "kimi-k2.6",
274660
274776
  huggingface: "moonshotai/Kimi-K2.6",
@@ -2,10 +2,40 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- ## Unreleased (1.9.x)
5
+ ## Unreleased
6
6
 
7
7
  No unreleased changes.
8
8
 
9
+ ## [1.10.1] - 2026-10-23
10
+
11
+ ### Added
12
+ - **Cheaper Inference memory preset** -- optional background memory LLM
13
+ processing through an OpenAI-compatible endpoint, with an isolated
14
+ `CHEAPER_INFERENCE_API_KEY`, CLI/TUI setup and bilingual configuration
15
+ guidance.
16
+ - **Derived-view receipts** -- context and search receipts now expose
17
+ privacy-safe FTS, Orama, embedding, and CodeGraph freshness, generation,
18
+ rebuild status, and bounded failure reasons.
19
+
20
+ ## [1.10.0] - 2026-10-23
21
+
22
+ ### Added
23
+ - **Measured context evaluation** -- adds a reproducible 20-case runtime matrix
24
+ covering continuity, retrieval, safety, runtime binding, and integration
25
+ parity, with token, latency, RSS, fallback, degraded, and review-cost metrics.
26
+ - **Large-store release gates** -- records and verifies 40k and 100k local
27
+ capacity baselines across SDK, HTTP MCP, hooks, SQLite persistence, and SDK
28
+ reopen paths.
29
+
30
+ ### Changed
31
+ - **Retrieval receipts** -- compact search, MCP search, and CLI JSON search now
32
+ expose request-level candidate, selected, omitted, token-budget, and fallback
33
+ diagnostics while keeping query text, raw memory content, and local paths out
34
+ of the receipt.
35
+ - **1.10 development contract** -- documents memory ownership, runtime binding,
36
+ adapter parity, and the measured context baseline as maintained acceptance
37
+ surfaces.
38
+
9
39
  ## [1.9.12] - 2026-10-17
10
40
 
11
41
  ### Fixed