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
@@ -2112,7 +2112,8 @@ function getResolvedConfig(options = {}) {
2112
2112
  const isAtlasCloud = memoryLlmProvider === "atlascloud";
2113
2113
  const isRequesty = memoryLlmProvider === "requesty";
2114
2114
  const isApiRoute = memoryLlmProvider === "apiroute";
2115
- const usesPresetKeyOnly = isAtlasCloud || isRequesty || isApiRoute;
2115
+ const isCheaperInference = memoryLlmProvider === "cheaperinference";
2116
+ const usesPresetKeyOnly = isAtlasCloud || isRequesty || isApiRoute || isCheaperInference;
2116
2117
  const memoryLlmApiKey = first(
2117
2118
  process.env.MEMORIX_LLM_API_KEY,
2118
2119
  process.env.MEMORIX_API_KEY,
@@ -2120,7 +2121,7 @@ function getResolvedConfig(options = {}) {
2120
2121
  yaml.llm?.apiKey,
2121
2122
  legacy.llm?.apiKey,
2122
2123
  // Never borrow another provider's credentials for these gateway presets.
2123
- isAtlasCloud ? process.env.ATLASCLOUD_API_KEY : isRequesty ? process.env.REQUESTY_API_KEY : isApiRoute ? process.env.API_ROUTE_API_KEY : process.env.OPENAI_API_KEY,
2124
+ 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,
2124
2125
  usesPresetKeyOnly ? void 0 : process.env.ANTHROPIC_API_KEY,
2125
2126
  usesPresetKeyOnly ? void 0 : openRouterMemoryLlmApiKey
2126
2127
  );
@@ -2304,6 +2305,7 @@ function getEnvSourceNames() {
2304
2305
  "OPENROUTER_API_KEY",
2305
2306
  "REQUESTY_API_KEY",
2306
2307
  "API_ROUTE_API_KEY",
2308
+ "CHEAPER_INFERENCE_API_KEY",
2307
2309
  "ATLASCLOUD_API_KEY"
2308
2310
  ].filter((name) => process.env[name]);
2309
2311
  }
@@ -3149,6 +3151,7 @@ var init_provider = __esm({
3149
3151
  openrouter: { baseUrl: "https://openrouter.ai/api/v1", model: "openai/gpt-4.1-nano" },
3150
3152
  requesty: { baseUrl: "https://router.requesty.ai/v1", model: "openai/gpt-4.1-nano" },
3151
3153
  apiroute: { baseUrl: "https://global.api-route.com/v1", model: "deepseek-v4.1-flash" },
3154
+ cheaperinference: { baseUrl: "https://api.cheaperinference.com/v1", model: "gpt-5.4-mini" },
3152
3155
  atlascloud: { baseUrl: "https://api.atlascloud.ai/v1", model: "deepseek-ai/deepseek-v3.2" },
3153
3156
  custom: { baseUrl: "http://localhost:11434/v1", model: "llama3" }
3154
3157
  };
@@ -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;
@@ -33691,6 +33785,25 @@ var init_models_generated = __esm({
33691
33785
  }
33692
33786
  },
33693
33787
  "minimax": {
33788
+ "MiniMax-M3.1-Flash": {
33789
+ id: "MiniMax-M3.1-Flash",
33790
+ name: "MiniMax-M3.1-Flash",
33791
+ api: "anthropic-messages",
33792
+ provider: "minimax",
33793
+ baseUrl: "https://api.minimax.io/anthropic",
33794
+ compat: { "forceAdaptiveThinking": true },
33795
+ reasoning: true,
33796
+ thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
33797
+ input: ["text", "image", "video"],
33798
+ cost: {
33799
+ input: 0.15,
33800
+ output: 0.6,
33801
+ cacheRead: 0.015,
33802
+ cacheWrite: 0
33803
+ },
33804
+ contextWindow: 1e6,
33805
+ maxTokens: 524288
33806
+ },
33694
33807
  "MiniMax-M2.7": {
33695
33808
  id: "MiniMax-M2.7",
33696
33809
  name: "MiniMax-M2.7",
@@ -33731,6 +33844,7 @@ var init_models_generated = __esm({
33731
33844
  api: "anthropic-messages",
33732
33845
  provider: "minimax",
33733
33846
  baseUrl: "https://api.minimax.io/anthropic",
33847
+ compat: { "forceAdaptiveThinking": true },
33734
33848
  reasoning: true,
33735
33849
  input: ["text", "image", "video"],
33736
33850
  cost: {
@@ -33740,10 +33854,29 @@ var init_models_generated = __esm({
33740
33854
  cacheWrite: 0
33741
33855
  },
33742
33856
  contextWindow: 1e6,
33743
- maxTokens: 128e3
33857
+ maxTokens: 524288
33744
33858
  }
33745
33859
  },
33746
33860
  "minimax-cn": {
33861
+ "MiniMax-M3.1-Flash": {
33862
+ id: "MiniMax-M3.1-Flash",
33863
+ name: "MiniMax-M3.1-Flash",
33864
+ api: "anthropic-messages",
33865
+ provider: "minimax-cn",
33866
+ baseUrl: "https://api.minimaxi.com/anthropic",
33867
+ compat: { "forceAdaptiveThinking": true },
33868
+ reasoning: true,
33869
+ thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
33870
+ input: ["text", "image", "video"],
33871
+ cost: {
33872
+ input: 0.15,
33873
+ output: 0.6,
33874
+ cacheRead: 0.015,
33875
+ cacheWrite: 0
33876
+ },
33877
+ contextWindow: 1e6,
33878
+ maxTokens: 524288
33879
+ },
33747
33880
  "MiniMax-M2.7": {
33748
33881
  id: "MiniMax-M2.7",
33749
33882
  name: "MiniMax-M2.7",
@@ -33784,6 +33917,7 @@ var init_models_generated = __esm({
33784
33917
  api: "anthropic-messages",
33785
33918
  provider: "minimax-cn",
33786
33919
  baseUrl: "https://api.minimaxi.com/anthropic",
33920
+ compat: { "forceAdaptiveThinking": true },
33787
33921
  reasoning: true,
33788
33922
  input: ["text", "image", "video"],
33789
33923
  cost: {
@@ -33793,7 +33927,7 @@ var init_models_generated = __esm({
33793
33927
  cacheWrite: 0
33794
33928
  },
33795
33929
  contextWindow: 1e6,
33796
- maxTokens: 128e3
33930
+ maxTokens: 524288
33797
33931
  }
33798
33932
  },
33799
33933
  "mistral": {
@@ -36914,6 +37048,24 @@ var init_models_generated = __esm({
36914
37048
  }
36915
37049
  },
36916
37050
  "openrouter": {
37051
+ "minimax/minimax-m3.1-flash:free": {
37052
+ id: "minimax/minimax-m3.1-flash:free",
37053
+ name: "MiniMax: MiniMax M3.1 Flash (free)",
37054
+ api: "openai-completions",
37055
+ provider: "openrouter",
37056
+ baseUrl: "https://openrouter.ai/api/v1",
37057
+ reasoning: true,
37058
+ thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
37059
+ input: ["text", "image"],
37060
+ cost: {
37061
+ input: 0,
37062
+ output: 0,
37063
+ cacheRead: 0,
37064
+ cacheWrite: 0
37065
+ },
37066
+ contextWindow: 1e6,
37067
+ maxTokens: 524288
37068
+ },
36917
37069
  "ai21/jamba-large-1.7": {
36918
37070
  id: "ai21/jamba-large-1.7",
36919
37071
  name: "AI21: Jamba Large 1.7",
@@ -45615,6 +45767,14 @@ var init_models_generated = __esm({
45615
45767
  }
45616
45768
  });
45617
45769
 
45770
+ // packages/ai/dist/minimax-models.js
45771
+ var init_minimax_models = __esm({
45772
+ "packages/ai/dist/minimax-models.js"() {
45773
+ "use strict";
45774
+ init_esm_shims();
45775
+ }
45776
+ });
45777
+
45618
45778
  // packages/ai/dist/models.js
45619
45779
  function calculateCost(model, usage) {
45620
45780
  usage.cost.input = model.cost.input / 1e6 * usage.input;
@@ -45661,6 +45821,8 @@ var init_models2 = __esm({
45661
45821
  "use strict";
45662
45822
  init_esm_shims();
45663
45823
  init_models_generated();
45824
+ init_minimax_models();
45825
+ init_minimax_models();
45664
45826
  modelRegistry = /* @__PURE__ */ new Map();
45665
45827
  for (const [provider2, models] of Object.entries(MODELS)) {
45666
45828
  const providerModels = /* @__PURE__ */ new Map();
@@ -53614,6 +53776,25 @@ function buildParams2(model, context, isOAuthToken2, options) {
53614
53776
  params.tool_choice = options.toolChoice;
53615
53777
  }
53616
53778
  }
53779
+ return normalizeMiniMaxParams(model, params, options);
53780
+ }
53781
+ function normalizeMiniMaxParams(model, params, options) {
53782
+ if (model.provider !== "minimax" && model.provider !== "minimax-cn")
53783
+ return params;
53784
+ if (params.model === "MiniMax-M3.1-Flash") {
53785
+ const effort = params.output_config?.effort ?? options?.effort ?? "max";
53786
+ const normalized = { ...params, thinking: { type: "adaptive" } };
53787
+ normalized.output_config = {
53788
+ ...params.output_config,
53789
+ effort: ["low", "medium", "high", "xhigh", "max"].includes(effort) ? effort : "max"
53790
+ };
53791
+ delete normalized.service_tier;
53792
+ delete normalized.reasoning_split;
53793
+ return normalized;
53794
+ }
53795
+ if (params.model === "MiniMax-M3" && params.thinking) {
53796
+ return { ...params, thinking: { type: params.thinking.type === "disabled" ? "disabled" : "adaptive" } };
53797
+ }
53617
53798
  return params;
53618
53799
  }
53619
53800
  function normalizeToolCallId(id) {
@@ -53920,6 +54101,7 @@ var init_anthropic = __esm({
53920
54101
  if (nextParams !== void 0) {
53921
54102
  params = nextParams;
53922
54103
  }
54104
+ params = normalizeMiniMaxParams(model, params, options);
53923
54105
  const requestOptions = {
53924
54106
  ...options?.signal ? { signal: options.signal } : {},
53925
54107
  ...options?.timeoutMs !== void 0 ? { timeout: options.timeoutMs } : {},
@@ -136690,6 +136872,18 @@ var init_openai_completions = __esm({
136690
136872
  if (nextParams !== void 0) {
136691
136873
  params = nextParams;
136692
136874
  }
136875
+ if (model.provider === "openrouter" && new URL(model.baseUrl).hostname === "openrouter.ai" && params.model === "minimax/minimax-m3.1-flash:free") {
136876
+ const flash = params;
136877
+ const effort = flash.reasoning?.effort ?? "max";
136878
+ flash.reasoning = {
136879
+ ...flash.reasoning,
136880
+ enabled: true,
136881
+ effort: ["low", "medium", "high", "xhigh", "max"].includes(effort) ? effort : "max"
136882
+ };
136883
+ delete flash.reasoning_effort;
136884
+ delete flash.reasoning_split;
136885
+ delete flash.service_tier;
136886
+ }
136693
136887
  const requestOptions = {
136694
136888
  ...options?.signal ? { signal: options.signal } : {},
136695
136889
  ...options?.timeoutMs !== void 0 ? { timeout: options.timeoutMs } : {},