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.
- package/CHANGELOG.md +31 -1
- package/README.md +2 -0
- package/README.zh-CN.md +2 -0
- package/dist/cli/index.js +720 -142
- package/dist/index.d.ts +46 -0
- package/dist/index.js +426 -67
- package/dist/maintenance-runner.js +199 -5
- package/dist/media-audio-runner.js +199 -5
- package/dist/media-video-runner.js +199 -5
- package/dist/memcode/index.js +124 -8
- package/dist/memcode-runtime/CHANGELOG.md +31 -1
- package/dist/sdk.js +425 -66
- package/dist/vector-backfill-runner.js +199 -5
- package/docs/1.2.0-EVALUATION-HARNESS.md +106 -0
- package/docs/1.3-MEMORY-ARCHITECTURE.md +31 -0
- package/docs/API_REFERENCE.md +19 -0
- package/docs/CONFIGURATION.md +25 -0
- package/docs/DEVELOPMENT.md +17 -3
- package/docs/INTEGRATIONS.md +25 -0
- package/docs/PERFORMANCE.md +21 -6
- package/docs/README.md +4 -4
- package/docs/ROADMAP-1.9.12-2.0.md +99 -7
- package/package.json +3 -1
- package/plugins/antigravity/memorix/plugin.json +1 -1
- package/plugins/claude/memorix/.claude-plugin/plugin.json +1 -1
- package/plugins/codebuddy/memorix/.codebuddy-plugin/plugin.json +1 -1
- package/plugins/codex/memorix/.codex-plugin/plugin.json +1 -1
- package/plugins/copilot/memorix/plugin.json +1 -1
- package/plugins/gemini/memorix/gemini-extension.json +1 -1
- package/plugins/hermes/memorix/plugin.yaml +1 -1
- package/plugins/omp/memorix/package.json +1 -1
- package/plugins/openclaw/memorix/.codex-plugin/plugin.json +1 -1
- package/plugins/pi/memorix/package.json +1 -1
- package/server.json +2 -2
- package/src/cli/commands/agent-integrations.ts +164 -7
- package/src/cli/commands/init.ts +6 -2
- package/src/cli/commands/memory.ts +1 -1
- package/src/cli/commands/serve-http.ts +30 -1
- package/src/cli/commands/setup.ts +5 -21
- package/src/cli/tui/ConfigureView.tsx +2 -0
- package/src/codegraph/auto-context.ts +22 -0
- package/src/codegraph/context-pack.ts +19 -0
- package/src/compact/engine.ts +54 -2
- package/src/config/dotenv-loader.ts +1 -0
- package/src/config/resolved-config.ts +5 -2
- package/src/config/yaml-loader.ts +2 -2
- package/src/dashboard/server.ts +3 -0
- package/src/evaluation/context-task-matrix.ts +247 -0
- package/src/evaluation/context-task-runner.ts +175 -0
- package/src/integrations/registry.ts +191 -4
- package/src/knowledge/context-assembly.ts +46 -2
- package/src/knowledge/context-receipt.ts +32 -0
- package/src/knowledge/workset.ts +43 -3
- package/src/llm/provider.ts +2 -1
- package/src/multimodal/image-loader.ts +2 -2
- package/src/search/derived-view-receipt.ts +22 -0
- package/src/server/request-context.ts +96 -0
- package/src/server.ts +16 -4
- package/src/store/orama-store.ts +116 -0
|
@@ -3395,7 +3395,8 @@ function getResolvedConfig(options = {}) {
|
|
|
3395
3395
|
const isAtlasCloud = memoryLlmProvider === "atlascloud";
|
|
3396
3396
|
const isRequesty = memoryLlmProvider === "requesty";
|
|
3397
3397
|
const isApiRoute = memoryLlmProvider === "apiroute";
|
|
3398
|
-
const
|
|
3398
|
+
const isCheaperInference = memoryLlmProvider === "cheaperinference";
|
|
3399
|
+
const usesPresetKeyOnly = isAtlasCloud || isRequesty || isApiRoute || isCheaperInference;
|
|
3399
3400
|
const memoryLlmApiKey = first(
|
|
3400
3401
|
process.env.MEMORIX_LLM_API_KEY,
|
|
3401
3402
|
process.env.MEMORIX_API_KEY,
|
|
@@ -3403,7 +3404,7 @@ function getResolvedConfig(options = {}) {
|
|
|
3403
3404
|
yaml.llm?.apiKey,
|
|
3404
3405
|
legacy.llm?.apiKey,
|
|
3405
3406
|
// Never borrow another provider's credentials for these gateway presets.
|
|
3406
|
-
isAtlasCloud ? process.env.ATLASCLOUD_API_KEY : isRequesty ? process.env.REQUESTY_API_KEY : isApiRoute ? process.env.API_ROUTE_API_KEY : process.env.OPENAI_API_KEY,
|
|
3407
|
+
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,
|
|
3407
3408
|
usesPresetKeyOnly ? void 0 : process.env.ANTHROPIC_API_KEY,
|
|
3408
3409
|
usesPresetKeyOnly ? void 0 : openRouterMemoryLlmApiKey
|
|
3409
3410
|
);
|
|
@@ -3587,6 +3588,7 @@ function getEnvSourceNames() {
|
|
|
3587
3588
|
"OPENROUTER_API_KEY",
|
|
3588
3589
|
"REQUESTY_API_KEY",
|
|
3589
3590
|
"API_ROUTE_API_KEY",
|
|
3591
|
+
"CHEAPER_INFERENCE_API_KEY",
|
|
3590
3592
|
"ATLASCLOUD_API_KEY"
|
|
3591
3593
|
].filter((name) => process.env[name]);
|
|
3592
3594
|
}
|
|
@@ -6581,6 +6583,7 @@ var init_provider2 = __esm({
|
|
|
6581
6583
|
openrouter: { baseUrl: "https://openrouter.ai/api/v1", model: "openai/gpt-4.1-nano" },
|
|
6582
6584
|
requesty: { baseUrl: "https://router.requesty.ai/v1", model: "openai/gpt-4.1-nano" },
|
|
6583
6585
|
apiroute: { baseUrl: "https://global.api-route.com/v1", model: "deepseek-v4.1-flash" },
|
|
6586
|
+
cheaperinference: { baseUrl: "https://api.cheaperinference.com/v1", model: "gpt-5.4-mini" },
|
|
6584
6587
|
atlascloud: { baseUrl: "https://api.atlascloud.ai/v1", model: "deepseek-ai/deepseek-v3.2" },
|
|
6585
6588
|
custom: { baseUrl: "http://localhost:11434/v1", model: "llama3" }
|
|
6586
6589
|
};
|
|
@@ -8139,9 +8142,11 @@ __export(orama_store_exports, {
|
|
|
8139
8142
|
getActiveSemanticIndexProfile: () => getActiveSemanticIndexProfile,
|
|
8140
8143
|
getDb: () => getDb,
|
|
8141
8144
|
getDeferredCachedVectorHydration: () => getDeferredCachedVectorHydration,
|
|
8145
|
+
getLastSearchDiagnostics: () => getLastSearchDiagnostics,
|
|
8142
8146
|
getLastSearchMode: () => getLastSearchMode,
|
|
8143
8147
|
getObservationCount: () => getObservationCount,
|
|
8144
8148
|
getObservationsByIds: () => getObservationsByIds,
|
|
8149
|
+
getSearchDerivedViews: () => getSearchDerivedViews,
|
|
8145
8150
|
getTimeline: () => getTimeline,
|
|
8146
8151
|
getVectorDimensions: () => getVectorDimensions,
|
|
8147
8152
|
hasObservationVector: () => hasObservationVector,
|
|
@@ -8168,6 +8173,68 @@ function rememberSearchMode(key, value) {
|
|
|
8168
8173
|
function getLastSearchMode(projectId) {
|
|
8169
8174
|
return lastSearchModeByProject.get(projectId ?? SEARCH_MODE_DEFAULT_KEY) ?? "fulltext";
|
|
8170
8175
|
}
|
|
8176
|
+
function getLastSearchDiagnostics(projectId) {
|
|
8177
|
+
const diagnostics = lastSearchDiagnosticsByProject.get(projectId ?? SEARCH_MODE_DEFAULT_KEY);
|
|
8178
|
+
return diagnostics ? { ...diagnostics } : void 0;
|
|
8179
|
+
}
|
|
8180
|
+
function getSearchDerivedViews() {
|
|
8181
|
+
const views = {};
|
|
8182
|
+
const store = getOptionalObservationStore();
|
|
8183
|
+
if (store) {
|
|
8184
|
+
try {
|
|
8185
|
+
const generation = store.getGeneration();
|
|
8186
|
+
if (store.hasLexicalIndex?.()) {
|
|
8187
|
+
views.fts = { generation, freshness: "current", rebuildStatus: "idle" };
|
|
8188
|
+
} else {
|
|
8189
|
+
views.fts = {
|
|
8190
|
+
generation,
|
|
8191
|
+
freshness: "unknown",
|
|
8192
|
+
rebuildStatus: "unavailable",
|
|
8193
|
+
failureReason: store.getBackendReason?.() ?? "persistent lexical index unavailable"
|
|
8194
|
+
};
|
|
8195
|
+
}
|
|
8196
|
+
} catch (error) {
|
|
8197
|
+
views.fts = {
|
|
8198
|
+
freshness: "unknown",
|
|
8199
|
+
rebuildStatus: "failed",
|
|
8200
|
+
failureReason: error instanceof Error ? error.message.slice(0, 240) : String(error).slice(0, 240)
|
|
8201
|
+
};
|
|
8202
|
+
}
|
|
8203
|
+
} else {
|
|
8204
|
+
views.fts = {
|
|
8205
|
+
freshness: "unknown",
|
|
8206
|
+
rebuildStatus: "unavailable",
|
|
8207
|
+
failureReason: "observation store is not initialized"
|
|
8208
|
+
};
|
|
8209
|
+
}
|
|
8210
|
+
views.orama = db ? { generation: dbGeneration, freshness: "current", rebuildStatus: "idle" } : {
|
|
8211
|
+
generation: dbGeneration,
|
|
8212
|
+
freshness: "unknown",
|
|
8213
|
+
rebuildStatus: "unavailable",
|
|
8214
|
+
failureReason: "Orama index is not initialized"
|
|
8215
|
+
};
|
|
8216
|
+
const configuredEmbeddingMode = process.env.MEMORIX_EMBEDDING?.trim().toLowerCase();
|
|
8217
|
+
if (configuredEmbeddingMode === "off") {
|
|
8218
|
+
views.embedding = { freshness: "current", rebuildStatus: "disabled" };
|
|
8219
|
+
} else if (embeddingEnabled) {
|
|
8220
|
+
views.embedding = { freshness: "current", rebuildStatus: "idle" };
|
|
8221
|
+
} else {
|
|
8222
|
+
views.embedding = {
|
|
8223
|
+
freshness: "unknown",
|
|
8224
|
+
rebuildStatus: "unavailable",
|
|
8225
|
+
failureReason: "embedding provider is not initialized"
|
|
8226
|
+
};
|
|
8227
|
+
}
|
|
8228
|
+
return views;
|
|
8229
|
+
}
|
|
8230
|
+
function rememberSearchDiagnostics(key, value) {
|
|
8231
|
+
if (!lastSearchDiagnosticsByProject.has(key) && lastSearchDiagnosticsByProject.size >= MAX_SEARCH_MODE_KEYS) {
|
|
8232
|
+
const oldest = lastSearchDiagnosticsByProject.keys().next().value;
|
|
8233
|
+
if (oldest !== void 0) lastSearchDiagnosticsByProject.delete(oldest);
|
|
8234
|
+
}
|
|
8235
|
+
lastSearchDiagnosticsByProject.delete(key);
|
|
8236
|
+
lastSearchDiagnosticsByProject.set(key, value);
|
|
8237
|
+
}
|
|
8171
8238
|
function getOptionalObservationStore() {
|
|
8172
8239
|
try {
|
|
8173
8240
|
return getObservationStore();
|
|
@@ -8450,6 +8517,7 @@ async function resetDb() {
|
|
|
8450
8517
|
indexEmbeddingProvider = null;
|
|
8451
8518
|
deferredCachedVectorHydration = null;
|
|
8452
8519
|
lastSearchModeByProject.clear();
|
|
8520
|
+
lastSearchDiagnosticsByProject.clear();
|
|
8453
8521
|
}
|
|
8454
8522
|
function isEmbeddingEnabled() {
|
|
8455
8523
|
return embeddingEnabled;
|
|
@@ -8667,6 +8735,7 @@ async function removeObservation(oramaId) {
|
|
|
8667
8735
|
await remove2(database, oramaId);
|
|
8668
8736
|
}
|
|
8669
8737
|
async function searchObservations(options) {
|
|
8738
|
+
const searchStartedAt = Date.now();
|
|
8670
8739
|
const perf = !!process.env.MEMORIX_PERF;
|
|
8671
8740
|
const t0 = perf ? performance.now() : 0;
|
|
8672
8741
|
const mark = (label) => {
|
|
@@ -8742,6 +8811,8 @@ async function searchObservations(options) {
|
|
|
8742
8811
|
let queryVector = null;
|
|
8743
8812
|
let embeddingProviderForSearch = null;
|
|
8744
8813
|
let embeddingUnavailable = false;
|
|
8814
|
+
let fallbackUsed = false;
|
|
8815
|
+
let fallbackReason;
|
|
8745
8816
|
if (quality !== "fast" && embeddingEnabled && hasQuery && tier !== "fast") {
|
|
8746
8817
|
try {
|
|
8747
8818
|
const provider2 = await getEmbeddingProvider();
|
|
@@ -8750,6 +8821,8 @@ async function searchObservations(options) {
|
|
|
8750
8821
|
const activeVectorDimensions = getVectorDimensions();
|
|
8751
8822
|
if (activeVectorDimensions !== null && provider2.dimensions !== activeVectorDimensions) {
|
|
8752
8823
|
embeddingUnavailable = true;
|
|
8824
|
+
fallbackUsed = true;
|
|
8825
|
+
fallbackReason = "embedding dimension mismatch; lexical search used";
|
|
8753
8826
|
rememberSearchMode(
|
|
8754
8827
|
modeKey,
|
|
8755
8828
|
`fulltext (embedding dimension mismatch: provider ${provider2.dimensions}d vs index ${activeVectorDimensions}d)`
|
|
@@ -8791,9 +8864,13 @@ async function searchObservations(options) {
|
|
|
8791
8864
|
}
|
|
8792
8865
|
} else {
|
|
8793
8866
|
embeddingUnavailable = true;
|
|
8867
|
+
fallbackUsed = true;
|
|
8868
|
+
fallbackReason = "embedding provider unavailable; lexical search used";
|
|
8794
8869
|
}
|
|
8795
8870
|
} catch (error) {
|
|
8796
8871
|
embeddingUnavailable = true;
|
|
8872
|
+
fallbackUsed = true;
|
|
8873
|
+
fallbackReason = "embedding failed or timed out; lexical search used";
|
|
8797
8874
|
rememberSearchMode(modeKey, "fulltext (embedding unavailable)");
|
|
8798
8875
|
console.error("[memorix] Embedding failed or timed out, falling back to fulltext search");
|
|
8799
8876
|
}
|
|
@@ -8843,6 +8920,8 @@ async function searchObservations(options) {
|
|
|
8843
8920
|
similarity: 0.25
|
|
8844
8921
|
};
|
|
8845
8922
|
rememberSearchMode(modeKey, "vector-only (hybrid empty fallback)");
|
|
8923
|
+
fallbackUsed = true;
|
|
8924
|
+
fallbackReason = "hybrid search returned no results; vector-only fallback used";
|
|
8846
8925
|
results = await search(database, vectorOnlyParams);
|
|
8847
8926
|
} catch {
|
|
8848
8927
|
}
|
|
@@ -9116,6 +9195,7 @@ async function searchObservations(options) {
|
|
|
9116
9195
|
mark(`rerank(skipped,tier=${tier})`);
|
|
9117
9196
|
}
|
|
9118
9197
|
let entries = intermediate.map(({ rawTime: _, _isCommandLog: _c, ...rest }) => rest);
|
|
9198
|
+
const candidateCount = entries.length;
|
|
9119
9199
|
for (const hit of results.hits) {
|
|
9120
9200
|
const doc = hit.document;
|
|
9121
9201
|
if (canReadObservation(doc, options.reader, projectIds ?? void 0)) rememberObservationDoc(doc);
|
|
@@ -9158,9 +9238,22 @@ async function searchObservations(options) {
|
|
|
9158
9238
|
}
|
|
9159
9239
|
}
|
|
9160
9240
|
}
|
|
9241
|
+
const beforeTokenBudget = entries.length;
|
|
9161
9242
|
if (options.maxTokens && options.maxTokens > 0) {
|
|
9162
9243
|
entries = applyTokenBudget(entries, options.maxTokens);
|
|
9163
9244
|
}
|
|
9245
|
+
rememberSearchDiagnostics(modeKey, {
|
|
9246
|
+
version: "1",
|
|
9247
|
+
mode: getLastSearchMode(options.projectId),
|
|
9248
|
+
rawCandidateCount: results.hits.length,
|
|
9249
|
+
candidateCount,
|
|
9250
|
+
selectedCount: entries.length,
|
|
9251
|
+
omittedCount: Math.max(0, candidateCount - entries.length),
|
|
9252
|
+
omittedByTokenBudget: Math.max(0, beforeTokenBudget - entries.length),
|
|
9253
|
+
fallbackUsed,
|
|
9254
|
+
...fallbackReason ? { fallbackReason } : {},
|
|
9255
|
+
elapsedMs: Math.max(0, Date.now() - searchStartedAt)
|
|
9256
|
+
});
|
|
9164
9257
|
if (options.trackAccess !== false) {
|
|
9165
9258
|
const returnedKeys = new Set(entries.map((entry) => makeEntryKey(entry.projectId, entry.id)));
|
|
9166
9259
|
const hitDocs = results.hits.map((hit) => ({ id: hit.id, doc: hit.document })).filter(({ doc }) => returnedKeys.has(makeEntryKey(doc.projectId, doc.observationId)));
|
|
@@ -9276,7 +9369,7 @@ function formatTime(isoDate) {
|
|
|
9276
9369
|
return isoDate;
|
|
9277
9370
|
}
|
|
9278
9371
|
}
|
|
9279
|
-
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;
|
|
9372
|
+
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;
|
|
9280
9373
|
var init_orama_store = __esm({
|
|
9281
9374
|
"src/store/orama-store.ts"() {
|
|
9282
9375
|
"use strict";
|
|
@@ -9302,6 +9395,7 @@ var init_orama_store = __esm({
|
|
|
9302
9395
|
NON_CJK_HYBRID_SIMILARITY = 0.45;
|
|
9303
9396
|
CJK_RUN = /[\u3400-\u4dbf\u4e00-\u9fff\u3040-\u30ff\uac00-\ud7af]+/gu;
|
|
9304
9397
|
lastSearchModeByProject = /* @__PURE__ */ new Map();
|
|
9398
|
+
lastSearchDiagnosticsByProject = /* @__PURE__ */ new Map();
|
|
9305
9399
|
SEARCH_MODE_DEFAULT_KEY = "__global__";
|
|
9306
9400
|
MAX_SEARCH_MODE_KEYS = 4096;
|
|
9307
9401
|
COMMAND_LOG_TITLE = /^(Ran:|Command:|Executed:)\s/i;
|
|
@@ -33616,6 +33710,25 @@ var init_models_generated = __esm({
|
|
|
33616
33710
|
}
|
|
33617
33711
|
},
|
|
33618
33712
|
"minimax": {
|
|
33713
|
+
"MiniMax-M3.1-Flash": {
|
|
33714
|
+
id: "MiniMax-M3.1-Flash",
|
|
33715
|
+
name: "MiniMax-M3.1-Flash",
|
|
33716
|
+
api: "anthropic-messages",
|
|
33717
|
+
provider: "minimax",
|
|
33718
|
+
baseUrl: "https://api.minimax.io/anthropic",
|
|
33719
|
+
compat: { "forceAdaptiveThinking": true },
|
|
33720
|
+
reasoning: true,
|
|
33721
|
+
thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
|
|
33722
|
+
input: ["text", "image", "video"],
|
|
33723
|
+
cost: {
|
|
33724
|
+
input: 0.15,
|
|
33725
|
+
output: 0.6,
|
|
33726
|
+
cacheRead: 0.015,
|
|
33727
|
+
cacheWrite: 0
|
|
33728
|
+
},
|
|
33729
|
+
contextWindow: 1e6,
|
|
33730
|
+
maxTokens: 524288
|
|
33731
|
+
},
|
|
33619
33732
|
"MiniMax-M2.7": {
|
|
33620
33733
|
id: "MiniMax-M2.7",
|
|
33621
33734
|
name: "MiniMax-M2.7",
|
|
@@ -33656,6 +33769,7 @@ var init_models_generated = __esm({
|
|
|
33656
33769
|
api: "anthropic-messages",
|
|
33657
33770
|
provider: "minimax",
|
|
33658
33771
|
baseUrl: "https://api.minimax.io/anthropic",
|
|
33772
|
+
compat: { "forceAdaptiveThinking": true },
|
|
33659
33773
|
reasoning: true,
|
|
33660
33774
|
input: ["text", "image", "video"],
|
|
33661
33775
|
cost: {
|
|
@@ -33665,10 +33779,29 @@ var init_models_generated = __esm({
|
|
|
33665
33779
|
cacheWrite: 0
|
|
33666
33780
|
},
|
|
33667
33781
|
contextWindow: 1e6,
|
|
33668
|
-
maxTokens:
|
|
33782
|
+
maxTokens: 524288
|
|
33669
33783
|
}
|
|
33670
33784
|
},
|
|
33671
33785
|
"minimax-cn": {
|
|
33786
|
+
"MiniMax-M3.1-Flash": {
|
|
33787
|
+
id: "MiniMax-M3.1-Flash",
|
|
33788
|
+
name: "MiniMax-M3.1-Flash",
|
|
33789
|
+
api: "anthropic-messages",
|
|
33790
|
+
provider: "minimax-cn",
|
|
33791
|
+
baseUrl: "https://api.minimaxi.com/anthropic",
|
|
33792
|
+
compat: { "forceAdaptiveThinking": true },
|
|
33793
|
+
reasoning: true,
|
|
33794
|
+
thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
|
|
33795
|
+
input: ["text", "image", "video"],
|
|
33796
|
+
cost: {
|
|
33797
|
+
input: 0.15,
|
|
33798
|
+
output: 0.6,
|
|
33799
|
+
cacheRead: 0.015,
|
|
33800
|
+
cacheWrite: 0
|
|
33801
|
+
},
|
|
33802
|
+
contextWindow: 1e6,
|
|
33803
|
+
maxTokens: 524288
|
|
33804
|
+
},
|
|
33672
33805
|
"MiniMax-M2.7": {
|
|
33673
33806
|
id: "MiniMax-M2.7",
|
|
33674
33807
|
name: "MiniMax-M2.7",
|
|
@@ -33709,6 +33842,7 @@ var init_models_generated = __esm({
|
|
|
33709
33842
|
api: "anthropic-messages",
|
|
33710
33843
|
provider: "minimax-cn",
|
|
33711
33844
|
baseUrl: "https://api.minimaxi.com/anthropic",
|
|
33845
|
+
compat: { "forceAdaptiveThinking": true },
|
|
33712
33846
|
reasoning: true,
|
|
33713
33847
|
input: ["text", "image", "video"],
|
|
33714
33848
|
cost: {
|
|
@@ -33718,7 +33852,7 @@ var init_models_generated = __esm({
|
|
|
33718
33852
|
cacheWrite: 0
|
|
33719
33853
|
},
|
|
33720
33854
|
contextWindow: 1e6,
|
|
33721
|
-
maxTokens:
|
|
33855
|
+
maxTokens: 524288
|
|
33722
33856
|
}
|
|
33723
33857
|
},
|
|
33724
33858
|
"mistral": {
|
|
@@ -36839,6 +36973,24 @@ var init_models_generated = __esm({
|
|
|
36839
36973
|
}
|
|
36840
36974
|
},
|
|
36841
36975
|
"openrouter": {
|
|
36976
|
+
"minimax/minimax-m3.1-flash:free": {
|
|
36977
|
+
id: "minimax/minimax-m3.1-flash:free",
|
|
36978
|
+
name: "MiniMax: MiniMax M3.1 Flash (free)",
|
|
36979
|
+
api: "openai-completions",
|
|
36980
|
+
provider: "openrouter",
|
|
36981
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
36982
|
+
reasoning: true,
|
|
36983
|
+
thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
|
|
36984
|
+
input: ["text", "image"],
|
|
36985
|
+
cost: {
|
|
36986
|
+
input: 0,
|
|
36987
|
+
output: 0,
|
|
36988
|
+
cacheRead: 0,
|
|
36989
|
+
cacheWrite: 0
|
|
36990
|
+
},
|
|
36991
|
+
contextWindow: 1e6,
|
|
36992
|
+
maxTokens: 524288
|
|
36993
|
+
},
|
|
36842
36994
|
"ai21/jamba-large-1.7": {
|
|
36843
36995
|
id: "ai21/jamba-large-1.7",
|
|
36844
36996
|
name: "AI21: Jamba Large 1.7",
|
|
@@ -45540,6 +45692,14 @@ var init_models_generated = __esm({
|
|
|
45540
45692
|
}
|
|
45541
45693
|
});
|
|
45542
45694
|
|
|
45695
|
+
// packages/ai/dist/minimax-models.js
|
|
45696
|
+
var init_minimax_models = __esm({
|
|
45697
|
+
"packages/ai/dist/minimax-models.js"() {
|
|
45698
|
+
"use strict";
|
|
45699
|
+
init_esm_shims();
|
|
45700
|
+
}
|
|
45701
|
+
});
|
|
45702
|
+
|
|
45543
45703
|
// packages/ai/dist/models.js
|
|
45544
45704
|
function calculateCost(model, usage) {
|
|
45545
45705
|
usage.cost.input = model.cost.input / 1e6 * usage.input;
|
|
@@ -45586,6 +45746,8 @@ var init_models2 = __esm({
|
|
|
45586
45746
|
"use strict";
|
|
45587
45747
|
init_esm_shims();
|
|
45588
45748
|
init_models_generated();
|
|
45749
|
+
init_minimax_models();
|
|
45750
|
+
init_minimax_models();
|
|
45589
45751
|
modelRegistry = /* @__PURE__ */ new Map();
|
|
45590
45752
|
for (const [provider2, models] of Object.entries(MODELS)) {
|
|
45591
45753
|
const providerModels = /* @__PURE__ */ new Map();
|
|
@@ -53539,6 +53701,25 @@ function buildParams2(model, context, isOAuthToken2, options) {
|
|
|
53539
53701
|
params.tool_choice = options.toolChoice;
|
|
53540
53702
|
}
|
|
53541
53703
|
}
|
|
53704
|
+
return normalizeMiniMaxParams(model, params, options);
|
|
53705
|
+
}
|
|
53706
|
+
function normalizeMiniMaxParams(model, params, options) {
|
|
53707
|
+
if (model.provider !== "minimax" && model.provider !== "minimax-cn")
|
|
53708
|
+
return params;
|
|
53709
|
+
if (params.model === "MiniMax-M3.1-Flash") {
|
|
53710
|
+
const effort = params.output_config?.effort ?? options?.effort ?? "max";
|
|
53711
|
+
const normalized = { ...params, thinking: { type: "adaptive" } };
|
|
53712
|
+
normalized.output_config = {
|
|
53713
|
+
...params.output_config,
|
|
53714
|
+
effort: ["low", "medium", "high", "xhigh", "max"].includes(effort) ? effort : "max"
|
|
53715
|
+
};
|
|
53716
|
+
delete normalized.service_tier;
|
|
53717
|
+
delete normalized.reasoning_split;
|
|
53718
|
+
return normalized;
|
|
53719
|
+
}
|
|
53720
|
+
if (params.model === "MiniMax-M3" && params.thinking) {
|
|
53721
|
+
return { ...params, thinking: { type: params.thinking.type === "disabled" ? "disabled" : "adaptive" } };
|
|
53722
|
+
}
|
|
53542
53723
|
return params;
|
|
53543
53724
|
}
|
|
53544
53725
|
function normalizeToolCallId(id) {
|
|
@@ -53845,6 +54026,7 @@ var init_anthropic = __esm({
|
|
|
53845
54026
|
if (nextParams !== void 0) {
|
|
53846
54027
|
params = nextParams;
|
|
53847
54028
|
}
|
|
54029
|
+
params = normalizeMiniMaxParams(model, params, options);
|
|
53848
54030
|
const requestOptions = {
|
|
53849
54031
|
...options?.signal ? { signal: options.signal } : {},
|
|
53850
54032
|
...options?.timeoutMs !== void 0 ? { timeout: options.timeoutMs } : {},
|
|
@@ -136615,6 +136797,18 @@ var init_openai_completions = __esm({
|
|
|
136615
136797
|
if (nextParams !== void 0) {
|
|
136616
136798
|
params = nextParams;
|
|
136617
136799
|
}
|
|
136800
|
+
if (model.provider === "openrouter" && new URL(model.baseUrl).hostname === "openrouter.ai" && params.model === "minimax/minimax-m3.1-flash:free") {
|
|
136801
|
+
const flash = params;
|
|
136802
|
+
const effort = flash.reasoning?.effort ?? "max";
|
|
136803
|
+
flash.reasoning = {
|
|
136804
|
+
...flash.reasoning,
|
|
136805
|
+
enabled: true,
|
|
136806
|
+
effort: ["low", "medium", "high", "xhigh", "max"].includes(effort) ? effort : "max"
|
|
136807
|
+
};
|
|
136808
|
+
delete flash.reasoning_effort;
|
|
136809
|
+
delete flash.reasoning_split;
|
|
136810
|
+
delete flash.service_tier;
|
|
136811
|
+
}
|
|
136618
136812
|
const requestOptions = {
|
|
136619
136813
|
...options?.signal ? { signal: options.signal } : {},
|
|
136620
136814
|
...options?.timeoutMs !== void 0 ? { timeout: options.timeoutMs } : {},
|