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
package/dist/cli/index.js
CHANGED
|
@@ -3232,7 +3232,7 @@ ${import_picocolors.default.gray(m3)} ${s4}
|
|
|
3232
3232
|
|
|
3233
3233
|
// src/cli/version.ts
|
|
3234
3234
|
function getCliVersion() {
|
|
3235
|
-
return true ? "1.
|
|
3235
|
+
return true ? "1.10.1" : pkg.version;
|
|
3236
3236
|
}
|
|
3237
3237
|
var init_version = __esm({
|
|
3238
3238
|
"src/cli/version.ts"() {
|
|
@@ -22145,7 +22145,8 @@ function getResolvedConfig(options = {}) {
|
|
|
22145
22145
|
const isAtlasCloud = memoryLlmProvider === "atlascloud";
|
|
22146
22146
|
const isRequesty = memoryLlmProvider === "requesty";
|
|
22147
22147
|
const isApiRoute = memoryLlmProvider === "apiroute";
|
|
22148
|
-
const
|
|
22148
|
+
const isCheaperInference = memoryLlmProvider === "cheaperinference";
|
|
22149
|
+
const usesPresetKeyOnly = isAtlasCloud || isRequesty || isApiRoute || isCheaperInference;
|
|
22149
22150
|
const memoryLlmApiKey = first(
|
|
22150
22151
|
process.env.MEMORIX_LLM_API_KEY,
|
|
22151
22152
|
process.env.MEMORIX_API_KEY,
|
|
@@ -22153,7 +22154,7 @@ function getResolvedConfig(options = {}) {
|
|
|
22153
22154
|
yaml.llm?.apiKey,
|
|
22154
22155
|
legacy.llm?.apiKey,
|
|
22155
22156
|
// Never borrow another provider's credentials for these gateway presets.
|
|
22156
|
-
isAtlasCloud ? process.env.ATLASCLOUD_API_KEY : isRequesty ? process.env.REQUESTY_API_KEY : isApiRoute ? process.env.API_ROUTE_API_KEY : process.env.OPENAI_API_KEY,
|
|
22157
|
+
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,
|
|
22157
22158
|
usesPresetKeyOnly ? void 0 : process.env.ANTHROPIC_API_KEY,
|
|
22158
22159
|
usesPresetKeyOnly ? void 0 : openRouterMemoryLlmApiKey
|
|
22159
22160
|
);
|
|
@@ -22337,6 +22338,7 @@ function getEnvSourceNames() {
|
|
|
22337
22338
|
"OPENROUTER_API_KEY",
|
|
22338
22339
|
"REQUESTY_API_KEY",
|
|
22339
22340
|
"API_ROUTE_API_KEY",
|
|
22341
|
+
"CHEAPER_INFERENCE_API_KEY",
|
|
22340
22342
|
"ATLASCLOUD_API_KEY"
|
|
22341
22343
|
].filter((name) => process.env[name]);
|
|
22342
22344
|
}
|
|
@@ -25331,6 +25333,7 @@ var init_provider2 = __esm({
|
|
|
25331
25333
|
openrouter: { baseUrl: "https://openrouter.ai/api/v1", model: "openai/gpt-4.1-nano" },
|
|
25332
25334
|
requesty: { baseUrl: "https://router.requesty.ai/v1", model: "openai/gpt-4.1-nano" },
|
|
25333
25335
|
apiroute: { baseUrl: "https://global.api-route.com/v1", model: "deepseek-v4.1-flash" },
|
|
25336
|
+
cheaperinference: { baseUrl: "https://api.cheaperinference.com/v1", model: "gpt-5.4-mini" },
|
|
25334
25337
|
atlascloud: { baseUrl: "https://api.atlascloud.ai/v1", model: "deepseek-ai/deepseek-v3.2" },
|
|
25335
25338
|
custom: { baseUrl: "http://localhost:11434/v1", model: "llama3" }
|
|
25336
25339
|
};
|
|
@@ -52019,6 +52022,25 @@ var init_models_generated = __esm({
|
|
|
52019
52022
|
}
|
|
52020
52023
|
},
|
|
52021
52024
|
"minimax": {
|
|
52025
|
+
"MiniMax-M3.1-Flash": {
|
|
52026
|
+
id: "MiniMax-M3.1-Flash",
|
|
52027
|
+
name: "MiniMax-M3.1-Flash",
|
|
52028
|
+
api: "anthropic-messages",
|
|
52029
|
+
provider: "minimax",
|
|
52030
|
+
baseUrl: "https://api.minimax.io/anthropic",
|
|
52031
|
+
compat: { "forceAdaptiveThinking": true },
|
|
52032
|
+
reasoning: true,
|
|
52033
|
+
thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
|
|
52034
|
+
input: ["text", "image", "video"],
|
|
52035
|
+
cost: {
|
|
52036
|
+
input: 0.15,
|
|
52037
|
+
output: 0.6,
|
|
52038
|
+
cacheRead: 0.015,
|
|
52039
|
+
cacheWrite: 0
|
|
52040
|
+
},
|
|
52041
|
+
contextWindow: 1e6,
|
|
52042
|
+
maxTokens: 524288
|
|
52043
|
+
},
|
|
52022
52044
|
"MiniMax-M2.7": {
|
|
52023
52045
|
id: "MiniMax-M2.7",
|
|
52024
52046
|
name: "MiniMax-M2.7",
|
|
@@ -52059,6 +52081,7 @@ var init_models_generated = __esm({
|
|
|
52059
52081
|
api: "anthropic-messages",
|
|
52060
52082
|
provider: "minimax",
|
|
52061
52083
|
baseUrl: "https://api.minimax.io/anthropic",
|
|
52084
|
+
compat: { "forceAdaptiveThinking": true },
|
|
52062
52085
|
reasoning: true,
|
|
52063
52086
|
input: ["text", "image", "video"],
|
|
52064
52087
|
cost: {
|
|
@@ -52068,10 +52091,29 @@ var init_models_generated = __esm({
|
|
|
52068
52091
|
cacheWrite: 0
|
|
52069
52092
|
},
|
|
52070
52093
|
contextWindow: 1e6,
|
|
52071
|
-
maxTokens:
|
|
52094
|
+
maxTokens: 524288
|
|
52072
52095
|
}
|
|
52073
52096
|
},
|
|
52074
52097
|
"minimax-cn": {
|
|
52098
|
+
"MiniMax-M3.1-Flash": {
|
|
52099
|
+
id: "MiniMax-M3.1-Flash",
|
|
52100
|
+
name: "MiniMax-M3.1-Flash",
|
|
52101
|
+
api: "anthropic-messages",
|
|
52102
|
+
provider: "minimax-cn",
|
|
52103
|
+
baseUrl: "https://api.minimaxi.com/anthropic",
|
|
52104
|
+
compat: { "forceAdaptiveThinking": true },
|
|
52105
|
+
reasoning: true,
|
|
52106
|
+
thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
|
|
52107
|
+
input: ["text", "image", "video"],
|
|
52108
|
+
cost: {
|
|
52109
|
+
input: 0.15,
|
|
52110
|
+
output: 0.6,
|
|
52111
|
+
cacheRead: 0.015,
|
|
52112
|
+
cacheWrite: 0
|
|
52113
|
+
},
|
|
52114
|
+
contextWindow: 1e6,
|
|
52115
|
+
maxTokens: 524288
|
|
52116
|
+
},
|
|
52075
52117
|
"MiniMax-M2.7": {
|
|
52076
52118
|
id: "MiniMax-M2.7",
|
|
52077
52119
|
name: "MiniMax-M2.7",
|
|
@@ -52112,6 +52154,7 @@ var init_models_generated = __esm({
|
|
|
52112
52154
|
api: "anthropic-messages",
|
|
52113
52155
|
provider: "minimax-cn",
|
|
52114
52156
|
baseUrl: "https://api.minimaxi.com/anthropic",
|
|
52157
|
+
compat: { "forceAdaptiveThinking": true },
|
|
52115
52158
|
reasoning: true,
|
|
52116
52159
|
input: ["text", "image", "video"],
|
|
52117
52160
|
cost: {
|
|
@@ -52121,7 +52164,7 @@ var init_models_generated = __esm({
|
|
|
52121
52164
|
cacheWrite: 0
|
|
52122
52165
|
},
|
|
52123
52166
|
contextWindow: 1e6,
|
|
52124
|
-
maxTokens:
|
|
52167
|
+
maxTokens: 524288
|
|
52125
52168
|
}
|
|
52126
52169
|
},
|
|
52127
52170
|
"mistral": {
|
|
@@ -55242,6 +55285,24 @@ var init_models_generated = __esm({
|
|
|
55242
55285
|
}
|
|
55243
55286
|
},
|
|
55244
55287
|
"openrouter": {
|
|
55288
|
+
"minimax/minimax-m3.1-flash:free": {
|
|
55289
|
+
id: "minimax/minimax-m3.1-flash:free",
|
|
55290
|
+
name: "MiniMax: MiniMax M3.1 Flash (free)",
|
|
55291
|
+
api: "openai-completions",
|
|
55292
|
+
provider: "openrouter",
|
|
55293
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
55294
|
+
reasoning: true,
|
|
55295
|
+
thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
|
|
55296
|
+
input: ["text", "image"],
|
|
55297
|
+
cost: {
|
|
55298
|
+
input: 0,
|
|
55299
|
+
output: 0,
|
|
55300
|
+
cacheRead: 0,
|
|
55301
|
+
cacheWrite: 0
|
|
55302
|
+
},
|
|
55303
|
+
contextWindow: 1e6,
|
|
55304
|
+
maxTokens: 524288
|
|
55305
|
+
},
|
|
55245
55306
|
"ai21/jamba-large-1.7": {
|
|
55246
55307
|
id: "ai21/jamba-large-1.7",
|
|
55247
55308
|
name: "AI21: Jamba Large 1.7",
|
|
@@ -63943,6 +64004,14 @@ var init_models_generated = __esm({
|
|
|
63943
64004
|
}
|
|
63944
64005
|
});
|
|
63945
64006
|
|
|
64007
|
+
// packages/ai/dist/minimax-models.js
|
|
64008
|
+
var init_minimax_models = __esm({
|
|
64009
|
+
"packages/ai/dist/minimax-models.js"() {
|
|
64010
|
+
"use strict";
|
|
64011
|
+
init_esm_shims();
|
|
64012
|
+
}
|
|
64013
|
+
});
|
|
64014
|
+
|
|
63946
64015
|
// packages/ai/dist/models.js
|
|
63947
64016
|
function calculateCost(model, usage3) {
|
|
63948
64017
|
usage3.cost.input = model.cost.input / 1e6 * usage3.input;
|
|
@@ -63989,6 +64058,8 @@ var init_models3 = __esm({
|
|
|
63989
64058
|
"use strict";
|
|
63990
64059
|
init_esm_shims();
|
|
63991
64060
|
init_models_generated();
|
|
64061
|
+
init_minimax_models();
|
|
64062
|
+
init_minimax_models();
|
|
63992
64063
|
modelRegistry = /* @__PURE__ */ new Map();
|
|
63993
64064
|
for (const [provider2, models2] of Object.entries(MODELS)) {
|
|
63994
64065
|
const providerModels = /* @__PURE__ */ new Map();
|
|
@@ -71942,6 +72013,25 @@ function buildParams2(model, context, isOAuthToken2, options) {
|
|
|
71942
72013
|
params.tool_choice = options.toolChoice;
|
|
71943
72014
|
}
|
|
71944
72015
|
}
|
|
72016
|
+
return normalizeMiniMaxParams(model, params, options);
|
|
72017
|
+
}
|
|
72018
|
+
function normalizeMiniMaxParams(model, params, options) {
|
|
72019
|
+
if (model.provider !== "minimax" && model.provider !== "minimax-cn")
|
|
72020
|
+
return params;
|
|
72021
|
+
if (params.model === "MiniMax-M3.1-Flash") {
|
|
72022
|
+
const effort = params.output_config?.effort ?? options?.effort ?? "max";
|
|
72023
|
+
const normalized = { ...params, thinking: { type: "adaptive" } };
|
|
72024
|
+
normalized.output_config = {
|
|
72025
|
+
...params.output_config,
|
|
72026
|
+
effort: ["low", "medium", "high", "xhigh", "max"].includes(effort) ? effort : "max"
|
|
72027
|
+
};
|
|
72028
|
+
delete normalized.service_tier;
|
|
72029
|
+
delete normalized.reasoning_split;
|
|
72030
|
+
return normalized;
|
|
72031
|
+
}
|
|
72032
|
+
if (params.model === "MiniMax-M3" && params.thinking) {
|
|
72033
|
+
return { ...params, thinking: { type: params.thinking.type === "disabled" ? "disabled" : "adaptive" } };
|
|
72034
|
+
}
|
|
71945
72035
|
return params;
|
|
71946
72036
|
}
|
|
71947
72037
|
function normalizeToolCallId(id) {
|
|
@@ -72248,6 +72338,7 @@ var init_anthropic = __esm({
|
|
|
72248
72338
|
if (nextParams !== void 0) {
|
|
72249
72339
|
params = nextParams;
|
|
72250
72340
|
}
|
|
72341
|
+
params = normalizeMiniMaxParams(model, params, options);
|
|
72251
72342
|
const requestOptions = {
|
|
72252
72343
|
...options?.signal ? { signal: options.signal } : {},
|
|
72253
72344
|
...options?.timeoutMs !== void 0 ? { timeout: options.timeoutMs } : {},
|
|
@@ -94349,7 +94440,7 @@ var require_websocket = __commonJS({
|
|
|
94349
94440
|
var http3 = __require("http");
|
|
94350
94441
|
var net = __require("net");
|
|
94351
94442
|
var tls = __require("tls");
|
|
94352
|
-
var { randomBytes: randomBytes3, createHash:
|
|
94443
|
+
var { randomBytes: randomBytes3, createHash: createHash30 } = __require("crypto");
|
|
94353
94444
|
var { Duplex, Readable: Readable3 } = __require("stream");
|
|
94354
94445
|
var { URL: URL2 } = __require("url");
|
|
94355
94446
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
@@ -95017,7 +95108,7 @@ var require_websocket = __commonJS({
|
|
|
95017
95108
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
95018
95109
|
return;
|
|
95019
95110
|
}
|
|
95020
|
-
const digest2 =
|
|
95111
|
+
const digest2 = createHash30("sha1").update(key + GUID).digest("base64");
|
|
95021
95112
|
if (res.headers["sec-websocket-accept"] !== digest2) {
|
|
95022
95113
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
95023
95114
|
return;
|
|
@@ -95389,7 +95480,7 @@ var require_websocket_server = __commonJS({
|
|
|
95389
95480
|
var EventEmitter2 = __require("events");
|
|
95390
95481
|
var http3 = __require("http");
|
|
95391
95482
|
var { Duplex } = __require("stream");
|
|
95392
|
-
var { createHash:
|
|
95483
|
+
var { createHash: createHash30 } = __require("crypto");
|
|
95393
95484
|
var extension3 = require_extension();
|
|
95394
95485
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
95395
95486
|
var subprotocol2 = require_subprotocol();
|
|
@@ -95696,7 +95787,7 @@ var require_websocket_server = __commonJS({
|
|
|
95696
95787
|
);
|
|
95697
95788
|
}
|
|
95698
95789
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
95699
|
-
const digest2 =
|
|
95790
|
+
const digest2 = createHash30("sha1").update(key + GUID).digest("base64");
|
|
95700
95791
|
const headers = [
|
|
95701
95792
|
"HTTP/1.1 101 Switching Protocols",
|
|
95702
95793
|
"Upgrade: websocket",
|
|
@@ -170881,6 +170972,18 @@ var init_openai_completions = __esm({
|
|
|
170881
170972
|
if (nextParams !== void 0) {
|
|
170882
170973
|
params = nextParams;
|
|
170883
170974
|
}
|
|
170975
|
+
if (model.provider === "openrouter" && new URL(model.baseUrl).hostname === "openrouter.ai" && params.model === "minimax/minimax-m3.1-flash:free") {
|
|
170976
|
+
const flash = params;
|
|
170977
|
+
const effort = flash.reasoning?.effort ?? "max";
|
|
170978
|
+
flash.reasoning = {
|
|
170979
|
+
...flash.reasoning,
|
|
170980
|
+
enabled: true,
|
|
170981
|
+
effort: ["low", "medium", "high", "xhigh", "max"].includes(effort) ? effort : "max"
|
|
170982
|
+
};
|
|
170983
|
+
delete flash.reasoning_effort;
|
|
170984
|
+
delete flash.reasoning_split;
|
|
170985
|
+
delete flash.service_tier;
|
|
170986
|
+
}
|
|
170884
170987
|
const requestOptions = {
|
|
170885
170988
|
...options?.signal ? { signal: options.signal } : {},
|
|
170886
170989
|
...options?.timeoutMs !== void 0 ? { timeout: options.timeoutMs } : {},
|
|
@@ -187700,9 +187803,11 @@ __export(orama_store_exports, {
|
|
|
187700
187803
|
getActiveSemanticIndexProfile: () => getActiveSemanticIndexProfile,
|
|
187701
187804
|
getDb: () => getDb,
|
|
187702
187805
|
getDeferredCachedVectorHydration: () => getDeferredCachedVectorHydration,
|
|
187806
|
+
getLastSearchDiagnostics: () => getLastSearchDiagnostics,
|
|
187703
187807
|
getLastSearchMode: () => getLastSearchMode,
|
|
187704
187808
|
getObservationCount: () => getObservationCount2,
|
|
187705
187809
|
getObservationsByIds: () => getObservationsByIds,
|
|
187810
|
+
getSearchDerivedViews: () => getSearchDerivedViews,
|
|
187706
187811
|
getTimeline: () => getTimeline,
|
|
187707
187812
|
getVectorDimensions: () => getVectorDimensions,
|
|
187708
187813
|
hasObservationVector: () => hasObservationVector,
|
|
@@ -187728,6 +187833,68 @@ function rememberSearchMode(key, value) {
|
|
|
187728
187833
|
function getLastSearchMode(projectId) {
|
|
187729
187834
|
return lastSearchModeByProject.get(projectId ?? SEARCH_MODE_DEFAULT_KEY) ?? "fulltext";
|
|
187730
187835
|
}
|
|
187836
|
+
function getLastSearchDiagnostics(projectId) {
|
|
187837
|
+
const diagnostics = lastSearchDiagnosticsByProject.get(projectId ?? SEARCH_MODE_DEFAULT_KEY);
|
|
187838
|
+
return diagnostics ? { ...diagnostics } : void 0;
|
|
187839
|
+
}
|
|
187840
|
+
function getSearchDerivedViews() {
|
|
187841
|
+
const views = {};
|
|
187842
|
+
const store2 = getOptionalObservationStore();
|
|
187843
|
+
if (store2) {
|
|
187844
|
+
try {
|
|
187845
|
+
const generation = store2.getGeneration();
|
|
187846
|
+
if (store2.hasLexicalIndex?.()) {
|
|
187847
|
+
views.fts = { generation, freshness: "current", rebuildStatus: "idle" };
|
|
187848
|
+
} else {
|
|
187849
|
+
views.fts = {
|
|
187850
|
+
generation,
|
|
187851
|
+
freshness: "unknown",
|
|
187852
|
+
rebuildStatus: "unavailable",
|
|
187853
|
+
failureReason: store2.getBackendReason?.() ?? "persistent lexical index unavailable"
|
|
187854
|
+
};
|
|
187855
|
+
}
|
|
187856
|
+
} catch (error40) {
|
|
187857
|
+
views.fts = {
|
|
187858
|
+
freshness: "unknown",
|
|
187859
|
+
rebuildStatus: "failed",
|
|
187860
|
+
failureReason: error40 instanceof Error ? error40.message.slice(0, 240) : String(error40).slice(0, 240)
|
|
187861
|
+
};
|
|
187862
|
+
}
|
|
187863
|
+
} else {
|
|
187864
|
+
views.fts = {
|
|
187865
|
+
freshness: "unknown",
|
|
187866
|
+
rebuildStatus: "unavailable",
|
|
187867
|
+
failureReason: "observation store is not initialized"
|
|
187868
|
+
};
|
|
187869
|
+
}
|
|
187870
|
+
views.orama = db ? { generation: dbGeneration, freshness: "current", rebuildStatus: "idle" } : {
|
|
187871
|
+
generation: dbGeneration,
|
|
187872
|
+
freshness: "unknown",
|
|
187873
|
+
rebuildStatus: "unavailable",
|
|
187874
|
+
failureReason: "Orama index is not initialized"
|
|
187875
|
+
};
|
|
187876
|
+
const configuredEmbeddingMode = process.env.MEMORIX_EMBEDDING?.trim().toLowerCase();
|
|
187877
|
+
if (configuredEmbeddingMode === "off") {
|
|
187878
|
+
views.embedding = { freshness: "current", rebuildStatus: "disabled" };
|
|
187879
|
+
} else if (embeddingEnabled) {
|
|
187880
|
+
views.embedding = { freshness: "current", rebuildStatus: "idle" };
|
|
187881
|
+
} else {
|
|
187882
|
+
views.embedding = {
|
|
187883
|
+
freshness: "unknown",
|
|
187884
|
+
rebuildStatus: "unavailable",
|
|
187885
|
+
failureReason: "embedding provider is not initialized"
|
|
187886
|
+
};
|
|
187887
|
+
}
|
|
187888
|
+
return views;
|
|
187889
|
+
}
|
|
187890
|
+
function rememberSearchDiagnostics(key, value) {
|
|
187891
|
+
if (!lastSearchDiagnosticsByProject.has(key) && lastSearchDiagnosticsByProject.size >= MAX_SEARCH_MODE_KEYS) {
|
|
187892
|
+
const oldest = lastSearchDiagnosticsByProject.keys().next().value;
|
|
187893
|
+
if (oldest !== void 0) lastSearchDiagnosticsByProject.delete(oldest);
|
|
187894
|
+
}
|
|
187895
|
+
lastSearchDiagnosticsByProject.delete(key);
|
|
187896
|
+
lastSearchDiagnosticsByProject.set(key, value);
|
|
187897
|
+
}
|
|
187731
187898
|
function getOptionalObservationStore() {
|
|
187732
187899
|
try {
|
|
187733
187900
|
return getObservationStore();
|
|
@@ -188010,6 +188177,7 @@ async function resetDb() {
|
|
|
188010
188177
|
indexEmbeddingProvider = null;
|
|
188011
188178
|
deferredCachedVectorHydration = null;
|
|
188012
188179
|
lastSearchModeByProject.clear();
|
|
188180
|
+
lastSearchDiagnosticsByProject.clear();
|
|
188013
188181
|
}
|
|
188014
188182
|
function isEmbeddingEnabled() {
|
|
188015
188183
|
return embeddingEnabled;
|
|
@@ -188227,6 +188395,7 @@ async function removeObservation(oramaId) {
|
|
|
188227
188395
|
await remove4(database, oramaId);
|
|
188228
188396
|
}
|
|
188229
188397
|
async function searchObservations(options) {
|
|
188398
|
+
const searchStartedAt = Date.now();
|
|
188230
188399
|
const perf = !!process.env.MEMORIX_PERF;
|
|
188231
188400
|
const t0 = perf ? performance.now() : 0;
|
|
188232
188401
|
const mark = (label) => {
|
|
@@ -188302,6 +188471,8 @@ async function searchObservations(options) {
|
|
|
188302
188471
|
let queryVector = null;
|
|
188303
188472
|
let embeddingProviderForSearch = null;
|
|
188304
188473
|
let embeddingUnavailable = false;
|
|
188474
|
+
let fallbackUsed = false;
|
|
188475
|
+
let fallbackReason;
|
|
188305
188476
|
if (quality !== "fast" && embeddingEnabled && hasQuery && tier !== "fast") {
|
|
188306
188477
|
try {
|
|
188307
188478
|
const provider2 = await getEmbeddingProvider();
|
|
@@ -188310,6 +188481,8 @@ async function searchObservations(options) {
|
|
|
188310
188481
|
const activeVectorDimensions = getVectorDimensions();
|
|
188311
188482
|
if (activeVectorDimensions !== null && provider2.dimensions !== activeVectorDimensions) {
|
|
188312
188483
|
embeddingUnavailable = true;
|
|
188484
|
+
fallbackUsed = true;
|
|
188485
|
+
fallbackReason = "embedding dimension mismatch; lexical search used";
|
|
188313
188486
|
rememberSearchMode(
|
|
188314
188487
|
modeKey,
|
|
188315
188488
|
`fulltext (embedding dimension mismatch: provider ${provider2.dimensions}d vs index ${activeVectorDimensions}d)`
|
|
@@ -188351,9 +188524,13 @@ async function searchObservations(options) {
|
|
|
188351
188524
|
}
|
|
188352
188525
|
} else {
|
|
188353
188526
|
embeddingUnavailable = true;
|
|
188527
|
+
fallbackUsed = true;
|
|
188528
|
+
fallbackReason = "embedding provider unavailable; lexical search used";
|
|
188354
188529
|
}
|
|
188355
188530
|
} catch (error40) {
|
|
188356
188531
|
embeddingUnavailable = true;
|
|
188532
|
+
fallbackUsed = true;
|
|
188533
|
+
fallbackReason = "embedding failed or timed out; lexical search used";
|
|
188357
188534
|
rememberSearchMode(modeKey, "fulltext (embedding unavailable)");
|
|
188358
188535
|
console.error("[memorix] Embedding failed or timed out, falling back to fulltext search");
|
|
188359
188536
|
}
|
|
@@ -188403,6 +188580,8 @@ async function searchObservations(options) {
|
|
|
188403
188580
|
similarity: 0.25
|
|
188404
188581
|
};
|
|
188405
188582
|
rememberSearchMode(modeKey, "vector-only (hybrid empty fallback)");
|
|
188583
|
+
fallbackUsed = true;
|
|
188584
|
+
fallbackReason = "hybrid search returned no results; vector-only fallback used";
|
|
188406
188585
|
results = await search2(database, vectorOnlyParams);
|
|
188407
188586
|
} catch {
|
|
188408
188587
|
}
|
|
@@ -188676,6 +188855,7 @@ async function searchObservations(options) {
|
|
|
188676
188855
|
mark(`rerank(skipped,tier=${tier})`);
|
|
188677
188856
|
}
|
|
188678
188857
|
let entries = intermediate.map(({ rawTime: _5, _isCommandLog: _c, ...rest }) => rest);
|
|
188858
|
+
const candidateCount = entries.length;
|
|
188679
188859
|
for (const hit of results.hits) {
|
|
188680
188860
|
const doc = hit.document;
|
|
188681
188861
|
if (canReadObservation(doc, options.reader, projectIds ?? void 0)) rememberObservationDoc(doc);
|
|
@@ -188718,9 +188898,22 @@ async function searchObservations(options) {
|
|
|
188718
188898
|
}
|
|
188719
188899
|
}
|
|
188720
188900
|
}
|
|
188901
|
+
const beforeTokenBudget = entries.length;
|
|
188721
188902
|
if (options.maxTokens && options.maxTokens > 0) {
|
|
188722
188903
|
entries = applyTokenBudget(entries, options.maxTokens);
|
|
188723
188904
|
}
|
|
188905
|
+
rememberSearchDiagnostics(modeKey, {
|
|
188906
|
+
version: "1",
|
|
188907
|
+
mode: getLastSearchMode(options.projectId),
|
|
188908
|
+
rawCandidateCount: results.hits.length,
|
|
188909
|
+
candidateCount,
|
|
188910
|
+
selectedCount: entries.length,
|
|
188911
|
+
omittedCount: Math.max(0, candidateCount - entries.length),
|
|
188912
|
+
omittedByTokenBudget: Math.max(0, beforeTokenBudget - entries.length),
|
|
188913
|
+
fallbackUsed,
|
|
188914
|
+
...fallbackReason ? { fallbackReason } : {},
|
|
188915
|
+
elapsedMs: Math.max(0, Date.now() - searchStartedAt)
|
|
188916
|
+
});
|
|
188724
188917
|
if (options.trackAccess !== false) {
|
|
188725
188918
|
const returnedKeys = new Set(entries.map((entry) => makeEntryKey(entry.projectId, entry.id)));
|
|
188726
188919
|
const hitDocs = results.hits.map((hit) => ({ id: hit.id, doc: hit.document })).filter(({ doc }) => returnedKeys.has(makeEntryKey(doc.projectId, doc.observationId)));
|
|
@@ -188836,7 +189029,7 @@ function formatTime(isoDate) {
|
|
|
188836
189029
|
return isoDate;
|
|
188837
189030
|
}
|
|
188838
189031
|
}
|
|
188839
|
-
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;
|
|
189032
|
+
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;
|
|
188840
189033
|
var init_orama_store = __esm({
|
|
188841
189034
|
"src/store/orama-store.ts"() {
|
|
188842
189035
|
"use strict";
|
|
@@ -188863,6 +189056,7 @@ var init_orama_store = __esm({
|
|
|
188863
189056
|
NON_CJK_HYBRID_SIMILARITY = 0.45;
|
|
188864
189057
|
CJK_RUN = /[\u3400-\u4dbf\u4e00-\u9fff\u3040-\u30ff\uac00-\ud7af]+/gu;
|
|
188865
189058
|
lastSearchModeByProject = /* @__PURE__ */ new Map();
|
|
189059
|
+
lastSearchDiagnosticsByProject = /* @__PURE__ */ new Map();
|
|
188866
189060
|
SEARCH_MODE_DEFAULT_KEY = "__global__";
|
|
188867
189061
|
MAX_SEARCH_MODE_KEYS = 4096;
|
|
188868
189062
|
COMMAND_LOG_TITLE2 = /^(Ran:|Command:|Executed:)\s/i;
|
|
@@ -189240,6 +189434,7 @@ function normalizeMemoryBrowseQuery(query) {
|
|
|
189240
189434
|
return broadMemoryRequests.has(compact) ? "" : query;
|
|
189241
189435
|
}
|
|
189242
189436
|
async function compactSearch(options, surface = "mcp") {
|
|
189437
|
+
const startedAt = Date.now();
|
|
189243
189438
|
await ensureFreshIndex({ loadCorpus: false });
|
|
189244
189439
|
const searchOptions = { ...options, query: normalizeMemoryBrowseQuery(options.query) };
|
|
189245
189440
|
let entries = (await searchObservations(searchOptions)).map(
|
|
@@ -189293,7 +189488,34 @@ This project does have stored Memorix memories, but none matched the current que
|
|
|
189293
189488
|
}
|
|
189294
189489
|
}
|
|
189295
189490
|
const totalTokens = countTextTokens(formatted);
|
|
189296
|
-
|
|
189491
|
+
const diagnostics = getLastSearchDiagnostics(options.projectId);
|
|
189492
|
+
const derivedViews = getSearchDerivedViews();
|
|
189493
|
+
if (diagnostics?.fallbackUsed && diagnostics.fallbackReason) {
|
|
189494
|
+
derivedViews.embedding = {
|
|
189495
|
+
freshness: "stale",
|
|
189496
|
+
rebuildStatus: "failed",
|
|
189497
|
+
failureReason: diagnostics.fallbackReason
|
|
189498
|
+
};
|
|
189499
|
+
}
|
|
189500
|
+
return {
|
|
189501
|
+
entries,
|
|
189502
|
+
formatted,
|
|
189503
|
+
totalTokens,
|
|
189504
|
+
receipt: {
|
|
189505
|
+
version: "1",
|
|
189506
|
+
mode: getLastSearchMode(options.projectId),
|
|
189507
|
+
resultCount: entries.length,
|
|
189508
|
+
candidateCount: diagnostics?.candidateCount ?? entries.length,
|
|
189509
|
+
selectedCount: diagnostics?.selectedCount ?? entries.length,
|
|
189510
|
+
omittedCount: diagnostics?.omittedCount ?? 0,
|
|
189511
|
+
omittedByTokenBudget: diagnostics?.omittedByTokenBudget ?? 0,
|
|
189512
|
+
fallbackUsed: diagnostics?.fallbackUsed ?? false,
|
|
189513
|
+
...diagnostics?.fallbackReason ? { fallbackReason: diagnostics.fallbackReason } : {},
|
|
189514
|
+
derivedViews,
|
|
189515
|
+
tokenCount: totalTokens,
|
|
189516
|
+
elapsedMs: Math.max(0, Date.now() - startedAt)
|
|
189517
|
+
}
|
|
189518
|
+
};
|
|
189297
189519
|
}
|
|
189298
189520
|
async function compactTimeline(anchorId, projectId, depthBefore = 3, depthAfter = 3, reader2, surface = "mcp") {
|
|
189299
189521
|
const result = await getTimeline(anchorId, projectId, depthBefore, depthAfter, reader2);
|
|
@@ -192611,7 +192833,7 @@ var init_memory3 = __esm({
|
|
|
192611
192833
|
const limit2 = parsePositiveInt(args.limit, 10);
|
|
192612
192834
|
const quality = coerceRetrievalQuality(args.quality);
|
|
192613
192835
|
const result = await compactSearch({ query, limit: limit2, quality, projectId: project.id, reader: reader2 }, "cli");
|
|
192614
|
-
emitResult({ project, entries: result.entries }, result.formatted, asJson);
|
|
192836
|
+
emitResult({ project, entries: result.entries, retrieval: result.receipt }, result.formatted, asJson);
|
|
192615
192837
|
return;
|
|
192616
192838
|
}
|
|
192617
192839
|
case "graph-context": {
|
|
@@ -193168,6 +193390,8 @@ function buildInitTomlConfig(options) {
|
|
|
193168
193390
|
lines.push('# model = "openai/gpt-4o-mini"');
|
|
193169
193391
|
} else if (options.llmProvider === "apiroute") {
|
|
193170
193392
|
lines.push('model = "deepseek-v4.1-flash"');
|
|
193393
|
+
} else if (options.llmProvider === "cheaperinference") {
|
|
193394
|
+
lines.push('model = "gpt-5.4-mini"');
|
|
193171
193395
|
} else if (options.llmProvider === "atlascloud") {
|
|
193172
193396
|
lines.push('model = "deepseek-ai/deepseek-v3.2"');
|
|
193173
193397
|
}
|
|
@@ -193304,6 +193528,7 @@ var init_init = __esm({
|
|
|
193304
193528
|
{ value: "openrouter", label: "OpenRouter", hint: "multi-provider" },
|
|
193305
193529
|
{ value: "requesty", label: "Requesty", hint: "multi-provider" },
|
|
193306
193530
|
{ value: "apiroute", label: "API Route", hint: "multi-provider" },
|
|
193531
|
+
{ value: "cheaperinference", label: "Cheaper Inference", hint: "multi-provider" },
|
|
193307
193532
|
{ value: "atlascloud", label: "Atlas Cloud", hint: "DeepSeek V3.2" },
|
|
193308
193533
|
{ value: "custom", label: "Custom", hint: "OpenAI-compatible endpoint" }
|
|
193309
193534
|
]
|
|
@@ -193358,7 +193583,7 @@ var init_init = __esm({
|
|
|
193358
193583
|
];
|
|
193359
193584
|
if (llmProvider !== "none") {
|
|
193360
193585
|
envLines.push("# LLM API key");
|
|
193361
|
-
if (llmProvider === "openai" || llmProvider === "custom" || llmProvider === "atlascloud" || llmProvider === "apiroute") {
|
|
193586
|
+
if (llmProvider === "openai" || llmProvider === "custom" || llmProvider === "atlascloud" || llmProvider === "apiroute" || llmProvider === "cheaperinference") {
|
|
193362
193587
|
envLines.push("MEMORIX_LLM_API_KEY=sk-your-key-here");
|
|
193363
193588
|
} else if (llmProvider === "anthropic") {
|
|
193364
193589
|
envLines.push("MEMORIX_LLM_API_KEY=sk-ant-your-key-here");
|
|
@@ -193394,6 +193619,7 @@ var init_init = __esm({
|
|
|
193394
193619
|
envLines.push("# OPENROUTER_API_KEY=sk-or-...");
|
|
193395
193620
|
envLines.push("# REQUESTY_API_KEY=rqsty-...");
|
|
193396
193621
|
envLines.push("# API_ROUTE_API_KEY=sk-...");
|
|
193622
|
+
envLines.push("# CHEAPER_INFERENCE_API_KEY=ci_live_...");
|
|
193397
193623
|
envLines.push("");
|
|
193398
193624
|
mkdirSync3(targetDir, { recursive: true });
|
|
193399
193625
|
writeFileSync3(targetPath, tomlContent, "utf-8");
|
|
@@ -194672,8 +194898,75 @@ var init_grok = __esm({
|
|
|
194672
194898
|
});
|
|
194673
194899
|
|
|
194674
194900
|
// src/integrations/registry.ts
|
|
194901
|
+
function packageRoot(agent) {
|
|
194902
|
+
return agent === "gemini-cli" ? "plugins/gemini/memorix" : `plugins/${agent}/memorix`;
|
|
194903
|
+
}
|
|
194904
|
+
function capabilityManifest(entry) {
|
|
194905
|
+
const lowerSurfaces = entry.surfaces.map((surface) => surface.toLowerCase());
|
|
194906
|
+
const hasMcp = entry.agent === "grok" || lowerSurfaces.some((surface) => surface.includes("mcp"));
|
|
194907
|
+
const hasHooks = lowerSurfaces.some((surface) => surface.includes("hook"));
|
|
194908
|
+
const hasRules = lowerSurfaces.some((surface) => surface.includes("rule") || surface.includes("steering") || surface.includes("guidance"));
|
|
194909
|
+
const hasSkills = lowerSurfaces.some((surface) => surface.includes("skill"));
|
|
194910
|
+
const hasGuidance = hasRules || lowerSurfaces.some((surface) => surface.includes("agents.md") || surface.includes("context") || surface.includes("gemini"));
|
|
194911
|
+
const supported = hasMcp ? entry.agent === "grok" ? ["http"] : ["stdio", "http"] : [];
|
|
194912
|
+
const defaultTransport = entry.agent === "grok" ? "host-owned" : supported.includes("stdio") ? "stdio" : "none";
|
|
194913
|
+
const generatedBy = [
|
|
194914
|
+
"src/integrations/registry.ts",
|
|
194915
|
+
...hasMcp ? ["src/workspace/mcp-adapters/" + entry.agent + ".ts"] : [],
|
|
194916
|
+
...hasHooks || hasRules || hasSkills ? ["src/hooks/installers/index.ts"] : [],
|
|
194917
|
+
...entry.agent !== "any-mcp" && entry.agent !== "memcode" ? ["src/cli/commands/setup.ts"] : []
|
|
194918
|
+
];
|
|
194919
|
+
const packageFiles = PACKAGE_ENTRIES.has(entry.entry) ? [packageRoot(entry.agent)] : [];
|
|
194920
|
+
const hookFiles = hasHooks ? [entry.agent === "qwen" ? ".qwen/settings.json" : "host hook configuration"] : [];
|
|
194921
|
+
const ruleFiles = hasRules ? ["host rules or steering file"] : [];
|
|
194922
|
+
const skillFiles = hasSkills ? ["official Memorix skills"] : [];
|
|
194923
|
+
const guidanceFiles = hasGuidance ? ["host guidance file"] : [];
|
|
194924
|
+
return {
|
|
194925
|
+
schemaVersion: "1",
|
|
194926
|
+
agent: entry.agent,
|
|
194927
|
+
name: entry.name,
|
|
194928
|
+
transport: {
|
|
194929
|
+
supported,
|
|
194930
|
+
default: defaultTransport,
|
|
194931
|
+
...defaultTransport === "stdio" ? { command: "memorix serve" } : {}
|
|
194932
|
+
},
|
|
194933
|
+
artifacts: { packageFiles, hookFiles, ruleFiles, skillFiles, guidanceFiles },
|
|
194934
|
+
hooks: { supported: hasHooks, events: hasHooks ? [...DEFAULT_HOOK_EVENTS] : [] },
|
|
194935
|
+
scopes: ["project", "global"],
|
|
194936
|
+
lifecycle: {
|
|
194937
|
+
install: true,
|
|
194938
|
+
repair: entry.setup !== false,
|
|
194939
|
+
doctor: entry.setup !== false,
|
|
194940
|
+
uninstall: true
|
|
194941
|
+
},
|
|
194942
|
+
hostCompatibility: {
|
|
194943
|
+
range: entry.agent === "memcode" ? "Memorix runtime" : "unknown",
|
|
194944
|
+
verified: entry.agent === "memcode"
|
|
194945
|
+
},
|
|
194946
|
+
requirements: {
|
|
194947
|
+
projectRoot: entry.agent !== "any-mcp",
|
|
194948
|
+
http: supported.includes("http"),
|
|
194949
|
+
stdio: supported.includes("stdio"),
|
|
194950
|
+
credential: false
|
|
194951
|
+
},
|
|
194952
|
+
source: {
|
|
194953
|
+
registry: "src/integrations/registry.ts",
|
|
194954
|
+
generatedBy,
|
|
194955
|
+
documentation: ["docs/INTEGRATIONS.md", "docs/API_REFERENCE.md"]
|
|
194956
|
+
}
|
|
194957
|
+
};
|
|
194958
|
+
}
|
|
194959
|
+
function isAgentEntry(item) {
|
|
194960
|
+
return item.agent !== "memcode" && item.agent !== "any-mcp";
|
|
194961
|
+
}
|
|
194962
|
+
function getAgentIntegrationEntries() {
|
|
194963
|
+
return MEMORIX_INTEGRATIONS.filter(isAgentEntry);
|
|
194964
|
+
}
|
|
194965
|
+
function getSetupAgentTargets() {
|
|
194966
|
+
return MEMORIX_INTEGRATIONS.filter((item) => isAgentEntry(item) && item.status === "ready" && item.setup !== false).map((item) => item.agent);
|
|
194967
|
+
}
|
|
194675
194968
|
function getSetupIntegrationRows() {
|
|
194676
|
-
return MEMORIX_INTEGRATIONS.filter((item) => item
|
|
194969
|
+
return MEMORIX_INTEGRATIONS.filter((item) => isAgentEntry(item) && item.status === "ready" && item.setup !== false).map((item) => ({
|
|
194677
194970
|
agent: item.agent,
|
|
194678
194971
|
name: item.name,
|
|
194679
194972
|
entry: item.entry,
|
|
@@ -194682,12 +194975,12 @@ function getSetupIntegrationRows() {
|
|
|
194682
194975
|
surfaces: item.surfaces.join(", ")
|
|
194683
194976
|
}));
|
|
194684
194977
|
}
|
|
194685
|
-
var MEMORIX_INTEGRATIONS;
|
|
194978
|
+
var integrationEntries, PACKAGE_ENTRIES, DEFAULT_HOOK_EVENTS, MEMORIX_INTEGRATIONS;
|
|
194686
194979
|
var init_registry2 = __esm({
|
|
194687
194980
|
"src/integrations/registry.ts"() {
|
|
194688
194981
|
"use strict";
|
|
194689
194982
|
init_esm_shims();
|
|
194690
|
-
|
|
194983
|
+
integrationEntries = [
|
|
194691
194984
|
{
|
|
194692
194985
|
agent: "claude",
|
|
194693
194986
|
name: "Claude Code",
|
|
@@ -194730,6 +195023,16 @@ var init_registry2 = __esm({
|
|
|
194730
195023
|
surfaces: ["hooks", "AGENTS.md"],
|
|
194731
195024
|
note: "Writes ~/.grok/hooks/memorix.json and leaves Grok MCP host-owned by default. Pass --mcp http to write [mcp_servers.memorix] in Grok config.toml."
|
|
194732
195025
|
},
|
|
195026
|
+
{
|
|
195027
|
+
agent: "qwen",
|
|
195028
|
+
name: "Qwen Code",
|
|
195029
|
+
entry: "official-config",
|
|
195030
|
+
status: "ready",
|
|
195031
|
+
setup: false,
|
|
195032
|
+
install: "memorix hooks install --agent qwen",
|
|
195033
|
+
surfaces: ["hooks", "QWEN.md guidance"],
|
|
195034
|
+
note: "Qwen uses the hook installer lane; it is intentionally excluded from the full setup command until a native MCP/package lane exists."
|
|
195035
|
+
},
|
|
194733
195036
|
{
|
|
194734
195037
|
agent: "cursor",
|
|
194735
195038
|
name: "Cursor",
|
|
@@ -194858,6 +195161,18 @@ var init_registry2 = __esm({
|
|
|
194858
195161
|
surfaces: ["MCP stdio"]
|
|
194859
195162
|
}
|
|
194860
195163
|
];
|
|
195164
|
+
PACKAGE_ENTRIES = /* @__PURE__ */ new Set([
|
|
195165
|
+
"official-plugin",
|
|
195166
|
+
"official-extension",
|
|
195167
|
+
"official-package",
|
|
195168
|
+
"official-bundle",
|
|
195169
|
+
"local-plugin"
|
|
195170
|
+
]);
|
|
195171
|
+
DEFAULT_HOOK_EVENTS = ["session_start", "user_prompt", "post_tool", "pre_compact", "session_end"];
|
|
195172
|
+
MEMORIX_INTEGRATIONS = integrationEntries.map((entry) => ({
|
|
195173
|
+
...entry,
|
|
195174
|
+
capabilities: capabilityManifest(entry)
|
|
195175
|
+
}));
|
|
194861
195176
|
}
|
|
194862
195177
|
});
|
|
194863
195178
|
|
|
@@ -196913,7 +197228,7 @@ __export(setup_exports, {
|
|
|
196913
197228
|
buildSetupPlan: () => buildSetupPlan,
|
|
196914
197229
|
default: () => setup_default,
|
|
196915
197230
|
getMcpAdapter: () => getMcpAdapter,
|
|
196916
|
-
getSetupAgentTargets: () =>
|
|
197231
|
+
getSetupAgentTargets: () => getSetupAgentTargets2,
|
|
196917
197232
|
getSetupIntegrationRows: () => getSetupIntegrationRows2,
|
|
196918
197233
|
installAgentSetup: () => installAgentSetup,
|
|
196919
197234
|
installAntigravityPluginPackage: () => installAntigravityPluginPackage,
|
|
@@ -196937,7 +197252,7 @@ import { copyFile as copyFile2, mkdir as mkdir6, readFile as readFile6, readdir
|
|
|
196937
197252
|
import { homedir as homedir28 } from "os";
|
|
196938
197253
|
import path32 from "path";
|
|
196939
197254
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
196940
|
-
function
|
|
197255
|
+
function getSetupAgentTargets2() {
|
|
196941
197256
|
return [...SUPPORTED_SETUP_AGENTS];
|
|
196942
197257
|
}
|
|
196943
197258
|
function buildSetupPlan(options) {
|
|
@@ -197509,8 +197824,8 @@ async function stripCodeBuddyHookCapture(pluginPath) {
|
|
|
197509
197824
|
}
|
|
197510
197825
|
async function installCodeBuddyPluginPackage(options = {}) {
|
|
197511
197826
|
const home = options.homeDir ?? homedir28();
|
|
197512
|
-
const
|
|
197513
|
-
const source = path32.join(
|
|
197827
|
+
const packageRoot2 = findPackageRoot();
|
|
197828
|
+
const source = path32.join(packageRoot2, "plugins", "codebuddy", "memorix");
|
|
197514
197829
|
if (!existsSync17(source)) throw new Error(`CodeBuddy plugin template not found: ${source}`);
|
|
197515
197830
|
const marketplaceRoot = path32.join(home, ".codebuddy", "memorix-local");
|
|
197516
197831
|
const marketplacePath = path32.join(marketplaceRoot, ".codebuddy-plugin", "marketplace.json");
|
|
@@ -197529,8 +197844,8 @@ async function installCodeBuddyPluginPackage(options = {}) {
|
|
|
197529
197844
|
}
|
|
197530
197845
|
async function installPluginPackage(options) {
|
|
197531
197846
|
const home = options.homeDir ?? homedir28();
|
|
197532
|
-
const
|
|
197533
|
-
const source = path32.join(
|
|
197847
|
+
const packageRoot2 = findPackageRoot();
|
|
197848
|
+
const source = path32.join(packageRoot2, "plugins", options.agent, "memorix");
|
|
197534
197849
|
const includeHooks = options.includeHooks ?? true;
|
|
197535
197850
|
if (!existsSync17(source)) {
|
|
197536
197851
|
throw new Error(`Plugin package template not found: ${source}`);
|
|
@@ -197578,8 +197893,8 @@ async function installPluginPackage(options) {
|
|
|
197578
197893
|
}
|
|
197579
197894
|
async function installGeminiExtensionPackage(options = {}) {
|
|
197580
197895
|
const home = options.homeDir ?? homedir28();
|
|
197581
|
-
const
|
|
197582
|
-
const source = path32.join(
|
|
197896
|
+
const packageRoot2 = findPackageRoot();
|
|
197897
|
+
const source = path32.join(packageRoot2, "plugins", "gemini", "memorix");
|
|
197583
197898
|
if (!existsSync17(source)) {
|
|
197584
197899
|
throw new Error(`Gemini extension template not found: ${source}`);
|
|
197585
197900
|
}
|
|
@@ -197592,8 +197907,8 @@ async function installGeminiExtensionPackage(options = {}) {
|
|
|
197592
197907
|
};
|
|
197593
197908
|
}
|
|
197594
197909
|
async function installAntigravityPluginPackage(options = {}) {
|
|
197595
|
-
const
|
|
197596
|
-
const source = path32.join(
|
|
197910
|
+
const packageRoot2 = findPackageRoot();
|
|
197911
|
+
const source = path32.join(packageRoot2, "plugins", "antigravity", "memorix");
|
|
197597
197912
|
if (!existsSync17(source)) {
|
|
197598
197913
|
throw new Error(`Antigravity plugin template not found: ${source}`);
|
|
197599
197914
|
}
|
|
@@ -197610,8 +197925,8 @@ async function installAntigravityPluginPackage(options = {}) {
|
|
|
197610
197925
|
};
|
|
197611
197926
|
}
|
|
197612
197927
|
async function installPiPackage(options = {}) {
|
|
197613
|
-
const
|
|
197614
|
-
const source = path32.join(
|
|
197928
|
+
const packageRoot2 = findPackageRoot();
|
|
197929
|
+
const source = path32.join(packageRoot2, "plugins", "pi", "memorix");
|
|
197615
197930
|
if (!existsSync17(source)) {
|
|
197616
197931
|
throw new Error(`Pi package template not found: ${source}`);
|
|
197617
197932
|
}
|
|
@@ -197628,8 +197943,8 @@ async function installPiPackage(options = {}) {
|
|
|
197628
197943
|
}
|
|
197629
197944
|
async function installOpenClawBundlePackage(options = {}) {
|
|
197630
197945
|
const home = options.homeDir ?? homedir28();
|
|
197631
|
-
const
|
|
197632
|
-
const source = path32.join(
|
|
197946
|
+
const packageRoot2 = findPackageRoot();
|
|
197947
|
+
const source = path32.join(packageRoot2, "plugins", "openclaw", "memorix");
|
|
197633
197948
|
if (!existsSync17(source)) {
|
|
197634
197949
|
throw new Error(`OpenClaw bundle template not found: ${source}`);
|
|
197635
197950
|
}
|
|
@@ -197644,8 +197959,8 @@ async function installOpenClawBundlePackage(options = {}) {
|
|
|
197644
197959
|
};
|
|
197645
197960
|
}
|
|
197646
197961
|
async function installHermesPluginPackage(options = {}) {
|
|
197647
|
-
const
|
|
197648
|
-
const source = path32.join(
|
|
197962
|
+
const packageRoot2 = findPackageRoot();
|
|
197963
|
+
const source = path32.join(packageRoot2, "plugins", "hermes", "memorix");
|
|
197649
197964
|
if (!existsSync17(source)) {
|
|
197650
197965
|
throw new Error(`Hermes plugin template not found: ${source}`);
|
|
197651
197966
|
}
|
|
@@ -197671,8 +197986,8 @@ async function installHermesPluginPackage(options = {}) {
|
|
|
197671
197986
|
};
|
|
197672
197987
|
}
|
|
197673
197988
|
async function installOmpPackage(options = {}) {
|
|
197674
|
-
const
|
|
197675
|
-
const source = path32.join(
|
|
197989
|
+
const packageRoot2 = findPackageRoot();
|
|
197990
|
+
const source = path32.join(packageRoot2, "plugins", "omp", "memorix");
|
|
197676
197991
|
if (!existsSync17(source)) {
|
|
197677
197992
|
throw new Error(`Oh-my-Pi package template not found: ${source}`);
|
|
197678
197993
|
}
|
|
@@ -198201,26 +198516,7 @@ var init_setup = __esm({
|
|
|
198201
198516
|
OMP_PACKAGE_AGENTS = /* @__PURE__ */ new Set(["omp"]);
|
|
198202
198517
|
CODEBUDDY_PLUGIN_AGENTS = /* @__PURE__ */ new Set(["codebuddy"]);
|
|
198203
198518
|
PACKAGE_OWNED_INTEGRATION_AGENTS = /* @__PURE__ */ new Set(["codex", "codebuddy", "antigravity", "openclaw", "hermes", "omp"]);
|
|
198204
|
-
SUPPORTED_SETUP_AGENTS =
|
|
198205
|
-
"claude",
|
|
198206
|
-
"codex",
|
|
198207
|
-
"codebuddy",
|
|
198208
|
-
"opencode",
|
|
198209
|
-
"cursor",
|
|
198210
|
-
"windsurf",
|
|
198211
|
-
"copilot",
|
|
198212
|
-
"gemini-cli",
|
|
198213
|
-
"antigravity",
|
|
198214
|
-
"openclaw",
|
|
198215
|
-
"hermes",
|
|
198216
|
-
"omp",
|
|
198217
|
-
"kiro",
|
|
198218
|
-
"trae",
|
|
198219
|
-
"dsh",
|
|
198220
|
-
"workbuddy",
|
|
198221
|
-
"pi",
|
|
198222
|
-
"grok"
|
|
198223
|
-
];
|
|
198519
|
+
SUPPORTED_SETUP_AGENTS = getSetupAgentTargets();
|
|
198224
198520
|
getSetupIntegrationRows2 = getSetupIntegrationRows;
|
|
198225
198521
|
MEMORIX_HTTP_MCP_URL = "http://localhost:3211/mcp";
|
|
198226
198522
|
setup_default = defineCommand({
|
|
@@ -198806,7 +199102,7 @@ function appendLine(lines, candidate2, maxTokens, omitted, omittedKind, selected
|
|
|
198806
199102
|
if (receiptSelection) selected?.push(receiptSelection);
|
|
198807
199103
|
return true;
|
|
198808
199104
|
}
|
|
198809
|
-
omitted.push(omittedKind);
|
|
199105
|
+
omitted.push(receiptSelection?.id ? `${omittedKind}|${receiptSelection.id}` : omittedKind);
|
|
198810
199106
|
return false;
|
|
198811
199107
|
}
|
|
198812
199108
|
function freshnessForMemory(status) {
|
|
@@ -198832,15 +199128,23 @@ function receiptOmissionKind(raw) {
|
|
|
198832
199128
|
}
|
|
198833
199129
|
function receiptOmissions(omitted, hiddenCautionMemoryCount) {
|
|
198834
199130
|
const counts = /* @__PURE__ */ new Map();
|
|
199131
|
+
const samples = /* @__PURE__ */ new Map();
|
|
198835
199132
|
for (const raw of omitted) {
|
|
198836
|
-
const
|
|
199133
|
+
const [omittedKind, sampleId] = raw.split("|", 2);
|
|
199134
|
+
const kind = receiptOmissionKind(omittedKind);
|
|
198837
199135
|
if (!kind || raw.endsWith("-heading")) continue;
|
|
198838
199136
|
counts.set(kind, (counts.get(kind) ?? 0) + 1);
|
|
199137
|
+
if (sampleId) {
|
|
199138
|
+
const values = samples.get(kind) ?? [];
|
|
199139
|
+
if (!values.includes(sampleId) && values.length < 3) values.push(sampleId);
|
|
199140
|
+
samples.set(kind, values);
|
|
199141
|
+
}
|
|
198839
199142
|
}
|
|
198840
199143
|
const receipt = [...counts.entries()].map(([kind, count3]) => ({
|
|
198841
199144
|
kind,
|
|
198842
199145
|
reason: "token-budget",
|
|
198843
|
-
count: count3
|
|
199146
|
+
count: count3,
|
|
199147
|
+
...samples.get(kind)?.length ? { sampleIds: samples.get(kind) } : {}
|
|
198844
199148
|
}));
|
|
198845
199149
|
if (hiddenCautionMemoryCount > 0) {
|
|
198846
199150
|
receipt.push({
|
|
@@ -199549,6 +199853,21 @@ async function buildTaskWorkset(input) {
|
|
|
199549
199853
|
...base,
|
|
199550
199854
|
budget: { maxTokens }
|
|
199551
199855
|
});
|
|
199856
|
+
const omittedReceipt = receiptOmissions(rendered.omittedItems, base.hiddenCautionMemoryCount);
|
|
199857
|
+
const derivedViews = {
|
|
199858
|
+
...getSearchDerivedViews(),
|
|
199859
|
+
...input.retrieval?.derivedViews ?? {}
|
|
199860
|
+
};
|
|
199861
|
+
const retrieval = {
|
|
199862
|
+
mode: input.retrieval?.mode ?? (input.semanticCode ? "hybrid" : "unknown"),
|
|
199863
|
+
...input.retrieval?.codeProvider || input.providerQuality?.selected ? { codeProvider: input.retrieval?.codeProvider ?? input.providerQuality?.selected } : {},
|
|
199864
|
+
fallbackUsed: Boolean(input.retrieval?.fallbackReason),
|
|
199865
|
+
...input.retrieval?.fallbackReason ? { fallbackReason: input.retrieval.fallbackReason } : {},
|
|
199866
|
+
candidateCount: governed.plan.decisions.length,
|
|
199867
|
+
selectedCount: rendered.selected.length,
|
|
199868
|
+
omittedCount: omittedReceipt.reduce((total, omission) => total + omission.count, 0),
|
|
199869
|
+
derivedViews
|
|
199870
|
+
};
|
|
199552
199871
|
const receipt = {
|
|
199553
199872
|
version: "1.3",
|
|
199554
199873
|
target: input.deliveryTarget ?? "project-context",
|
|
@@ -199557,8 +199876,9 @@ async function buildTaskWorkset(input) {
|
|
|
199557
199876
|
maxTokens,
|
|
199558
199877
|
tokenCount: rendered.tokenCount
|
|
199559
199878
|
},
|
|
199879
|
+
retrieval,
|
|
199560
199880
|
selected: rendered.selected,
|
|
199561
|
-
omitted:
|
|
199881
|
+
omitted: omittedReceipt,
|
|
199562
199882
|
governance: {
|
|
199563
199883
|
scope: "optional-evidence",
|
|
199564
199884
|
mode: governed.plan.mode,
|
|
@@ -199566,7 +199886,12 @@ async function buildTaskWorkset(input) {
|
|
|
199566
199886
|
kind: decision.candidate.kind,
|
|
199567
199887
|
...decision.candidate.id ? { id: decision.candidate.id } : {},
|
|
199568
199888
|
disposition: decision.disposition,
|
|
199569
|
-
reasons: decision.reasons
|
|
199889
|
+
reasons: decision.reasons,
|
|
199890
|
+
...decision.candidate.freshness ? { freshness: decision.candidate.freshness } : {},
|
|
199891
|
+
...decision.candidate.trust ? { trust: decision.candidate.trust } : {},
|
|
199892
|
+
...decision.candidate.quality ? { quality: decision.candidate.quality } : {},
|
|
199893
|
+
...decision.candidate.conflict ? { conflict: decision.candidate.conflict } : {},
|
|
199894
|
+
...decision.candidate.evidenceCount !== void 0 ? { evidenceCount: decision.candidate.evidenceCount } : {}
|
|
199570
199895
|
})),
|
|
199571
199896
|
cautions: governed.plan.cautions
|
|
199572
199897
|
},
|
|
@@ -199600,6 +199925,7 @@ var init_workset = __esm({
|
|
|
199600
199925
|
init_workflows2();
|
|
199601
199926
|
init_long_term();
|
|
199602
199927
|
init_governor();
|
|
199928
|
+
init_orama_store();
|
|
199603
199929
|
CONTINUATION_DETAIL_TOKEN_BUDGET = 20;
|
|
199604
199930
|
}
|
|
199605
199931
|
});
|
|
@@ -201912,6 +202238,60 @@ var init_session = __esm({
|
|
|
201912
202238
|
}
|
|
201913
202239
|
});
|
|
201914
202240
|
|
|
202241
|
+
// src/knowledge/context-receipt.ts
|
|
202242
|
+
var context_receipt_exports = {};
|
|
202243
|
+
__export(context_receipt_exports, {
|
|
202244
|
+
buildBoundedContextReceipt: () => buildBoundedContextReceipt,
|
|
202245
|
+
buildCodeGraphDerivedView: () => buildCodeGraphDerivedView
|
|
202246
|
+
});
|
|
202247
|
+
function buildCodeGraphDerivedView(input) {
|
|
202248
|
+
const provider2 = input.providerQuality;
|
|
202249
|
+
const snapshot = input.snapshot;
|
|
202250
|
+
const externalFailure = provider2?.external.state !== void 0 && !["ready", "disabled", "not-detected"].includes(provider2.external.state);
|
|
202251
|
+
if (snapshot?.id) {
|
|
202252
|
+
return {
|
|
202253
|
+
...snapshot.sourceEpoch !== void 0 ? { generation: snapshot.sourceEpoch } : {},
|
|
202254
|
+
freshness: snapshot.incomplete ? "stale" : "current",
|
|
202255
|
+
rebuildStatus: snapshot.incomplete ? "failed" : "idle",
|
|
202256
|
+
...snapshot.incomplete ? { failureReason: "latest CodeGraph snapshot is incomplete" } : externalFailure && provider2?.external.reason ? { failureReason: provider2.external.reason.slice(0, 240) } : {}
|
|
202257
|
+
};
|
|
202258
|
+
}
|
|
202259
|
+
return {
|
|
202260
|
+
freshness: "unknown",
|
|
202261
|
+
rebuildStatus: externalFailure ? "failed" : "unavailable",
|
|
202262
|
+
...provider2?.external.reason ? { failureReason: provider2.external.reason.slice(0, 240) } : { failureReason: "CodeGraph snapshot is not initialized" }
|
|
202263
|
+
};
|
|
202264
|
+
}
|
|
202265
|
+
function buildBoundedContextReceipt(input) {
|
|
202266
|
+
const provider2 = input.providerQuality ?? input.workset.provenance.codeProvider;
|
|
202267
|
+
return {
|
|
202268
|
+
schemaVersion: "1",
|
|
202269
|
+
task: input.workset.task,
|
|
202270
|
+
brief: input.workset.prompt,
|
|
202271
|
+
receipt: input.workset.receipt,
|
|
202272
|
+
code: {
|
|
202273
|
+
selected: provider2?.selected ?? "lite",
|
|
202274
|
+
quality: provider2?.selectedQuality ?? "heuristic",
|
|
202275
|
+
externalState: provider2?.external.state ?? "not-detected",
|
|
202276
|
+
...input.workset.provenance.snapshotId ? { snapshotId: input.workset.provenance.snapshotId } : {}
|
|
202277
|
+
},
|
|
202278
|
+
...input.workset.agentLoadout ? { loadout: input.workset.agentLoadout } : {},
|
|
202279
|
+
...input.workset.continuity ? {
|
|
202280
|
+
continuity: {
|
|
202281
|
+
taskId: input.workset.continuity.taskId,
|
|
202282
|
+
status: input.workset.continuity.status,
|
|
202283
|
+
outcome: input.workset.continuity.outcome
|
|
202284
|
+
}
|
|
202285
|
+
} : {}
|
|
202286
|
+
};
|
|
202287
|
+
}
|
|
202288
|
+
var init_context_receipt = __esm({
|
|
202289
|
+
"src/knowledge/context-receipt.ts"() {
|
|
202290
|
+
"use strict";
|
|
202291
|
+
init_esm_shims();
|
|
202292
|
+
}
|
|
202293
|
+
});
|
|
202294
|
+
|
|
201915
202295
|
// src/store/compaction-checkpoint-store.ts
|
|
201916
202296
|
var compaction_checkpoint_store_exports = {};
|
|
201917
202297
|
__export(compaction_checkpoint_store_exports, {
|
|
@@ -202798,6 +203178,23 @@ async function buildAutoProjectContext(input) {
|
|
|
202798
203178
|
...alwaysOn.profile.length > 0 || alwaysOn.state || alwaysOn.durable.length > 0 ? { alwaysOn } : {},
|
|
202799
203179
|
...semanticOutline ? { semanticCode: semanticOutline } : {},
|
|
202800
203180
|
providerQuality: providerQuality2,
|
|
203181
|
+
retrieval: {
|
|
203182
|
+
mode: semanticOutline ? "hybrid" : "lexical",
|
|
203183
|
+
codeProvider: providerQuality2.selected,
|
|
203184
|
+
...externalCaution ? { fallbackReason: externalCaution } : {},
|
|
203185
|
+
derivedViews: {
|
|
203186
|
+
graph: buildCodeGraphDerivedView({
|
|
203187
|
+
providerQuality: providerQuality2,
|
|
203188
|
+
...latestSnapshot ? {
|
|
203189
|
+
snapshot: {
|
|
203190
|
+
id: latestSnapshot.id,
|
|
203191
|
+
sourceEpoch: latestSnapshot.sourceEpoch,
|
|
203192
|
+
incomplete: latestSnapshot.completeness.skippedOversizedFiles > 0 || (latestSnapshot.completeness.unreadableFiles ?? 0) > 0 || latestSnapshot.completeness.removalScanDeferred
|
|
203193
|
+
}
|
|
203194
|
+
} : {}
|
|
203195
|
+
})
|
|
203196
|
+
}
|
|
203197
|
+
},
|
|
202801
203198
|
currentFacts: worksetFactLines(currentFacts),
|
|
202802
203199
|
...continuation ? { continuation } : {},
|
|
202803
203200
|
...continuity ? { continuity } : {},
|
|
@@ -203126,47 +203523,13 @@ var init_auto_context = __esm({
|
|
|
203126
203523
|
init_long_term();
|
|
203127
203524
|
init_visibility();
|
|
203128
203525
|
init_session_store();
|
|
203526
|
+
init_context_receipt();
|
|
203129
203527
|
init_task_lens();
|
|
203130
203528
|
DEFAULT_MAX_AGE_MS = 10 * 60 * 1e3;
|
|
203131
203529
|
COMPACT_CHECKPOINT_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
203132
203530
|
}
|
|
203133
203531
|
});
|
|
203134
203532
|
|
|
203135
|
-
// src/knowledge/context-receipt.ts
|
|
203136
|
-
var context_receipt_exports = {};
|
|
203137
|
-
__export(context_receipt_exports, {
|
|
203138
|
-
buildBoundedContextReceipt: () => buildBoundedContextReceipt
|
|
203139
|
-
});
|
|
203140
|
-
function buildBoundedContextReceipt(input) {
|
|
203141
|
-
const provider2 = input.providerQuality ?? input.workset.provenance.codeProvider;
|
|
203142
|
-
return {
|
|
203143
|
-
schemaVersion: "1",
|
|
203144
|
-
task: input.workset.task,
|
|
203145
|
-
brief: input.workset.prompt,
|
|
203146
|
-
receipt: input.workset.receipt,
|
|
203147
|
-
code: {
|
|
203148
|
-
selected: provider2?.selected ?? "lite",
|
|
203149
|
-
quality: provider2?.selectedQuality ?? "heuristic",
|
|
203150
|
-
externalState: provider2?.external.state ?? "not-detected",
|
|
203151
|
-
...input.workset.provenance.snapshotId ? { snapshotId: input.workset.provenance.snapshotId } : {}
|
|
203152
|
-
},
|
|
203153
|
-
...input.workset.agentLoadout ? { loadout: input.workset.agentLoadout } : {},
|
|
203154
|
-
...input.workset.continuity ? {
|
|
203155
|
-
continuity: {
|
|
203156
|
-
taskId: input.workset.continuity.taskId,
|
|
203157
|
-
status: input.workset.continuity.status,
|
|
203158
|
-
outcome: input.workset.continuity.outcome
|
|
203159
|
-
}
|
|
203160
|
-
} : {}
|
|
203161
|
-
};
|
|
203162
|
-
}
|
|
203163
|
-
var init_context_receipt = __esm({
|
|
203164
|
-
"src/knowledge/context-receipt.ts"() {
|
|
203165
|
-
"use strict";
|
|
203166
|
-
init_esm_shims();
|
|
203167
|
-
}
|
|
203168
|
-
});
|
|
203169
|
-
|
|
203170
203533
|
// src/cli/fallback-budget.ts
|
|
203171
203534
|
import { createHash as createHash18 } from "crypto";
|
|
203172
203535
|
function fallbackRequestKey(projectId, task) {
|
|
@@ -203385,8 +203748,21 @@ function formatContextReceipt(receipt) {
|
|
|
203385
203748
|
`- Target: ${displayTarget(receipt.target)}`,
|
|
203386
203749
|
`- Budget: ${receipt.budget.tokenCount}/${receipt.budget.maxTokens} tokens`,
|
|
203387
203750
|
`- Assembly: ${receipt.elapsedMs} ms`,
|
|
203388
|
-
`- Selected: ${receipt.selected.length} item(s)
|
|
203751
|
+
`- Selected: ${receipt.selected.length} item(s)`,
|
|
203752
|
+
`- Retrieval: ${receipt.retrieval.mode} (${receipt.retrieval.candidateCount} optional candidate(s))`
|
|
203389
203753
|
];
|
|
203754
|
+
if (receipt.retrieval.fallbackUsed) {
|
|
203755
|
+
lines.push(`- Fallback: ${receipt.retrieval.fallbackReason ?? "retrieval fallback used"}`);
|
|
203756
|
+
}
|
|
203757
|
+
if (receipt.retrieval.derivedViews) {
|
|
203758
|
+
lines.push("", "Derived views");
|
|
203759
|
+
for (const [name, view] of Object.entries(receipt.retrieval.derivedViews)) {
|
|
203760
|
+
if (!view) continue;
|
|
203761
|
+
const generation = view.generation === void 0 ? "" : `, generation=${view.generation}`;
|
|
203762
|
+
const reason = view.failureReason ? `, reason=${view.failureReason}` : "";
|
|
203763
|
+
lines.push(`- ${name}: ${view.freshness}/${view.rebuildStatus}${generation}${reason}`);
|
|
203764
|
+
}
|
|
203765
|
+
}
|
|
203390
203766
|
if (receipt.selected.length > 0) {
|
|
203391
203767
|
lines.push("", "Selected evidence");
|
|
203392
203768
|
for (const item of receipt.selected.slice(0, 20)) {
|
|
@@ -203398,14 +203774,17 @@ function formatContextReceipt(receipt) {
|
|
|
203398
203774
|
if (receipt.omitted.length > 0) {
|
|
203399
203775
|
lines.push("", "Withheld by budget");
|
|
203400
203776
|
for (const item of receipt.omitted) {
|
|
203401
|
-
|
|
203777
|
+
const samples = item.sampleIds?.length ? ` [${item.sampleIds.join(", ")}]` : "";
|
|
203778
|
+
lines.push(`- ${item.kind}: ${item.count} item(s) (${item.reason})${samples}`);
|
|
203402
203779
|
}
|
|
203403
203780
|
}
|
|
203404
203781
|
if (receipt.governance?.decisions.length) {
|
|
203405
203782
|
lines.push("", "Optional evidence qualification");
|
|
203406
203783
|
for (const item of receipt.governance.decisions.slice(0, 20)) {
|
|
203407
203784
|
const id = item.id ? ` ${item.id}` : "";
|
|
203408
|
-
|
|
203785
|
+
const qualifiers = [item.quality, item.freshness, item.trust, item.conflict].filter(Boolean).join(", ");
|
|
203786
|
+
const evidence = item.evidenceCount === void 0 ? "" : `, evidence=${item.evidenceCount}`;
|
|
203787
|
+
lines.push(`- ${item.kind}${id}: ${item.disposition} (${item.reasons.join(", ")}${qualifiers ? `; ${qualifiers}${evidence}` : evidence})`);
|
|
203409
203788
|
}
|
|
203410
203789
|
}
|
|
203411
203790
|
if (receipt.scheduledActions.length > 0) {
|
|
@@ -203651,6 +204030,22 @@ async function attachTaskWorkset(input) {
|
|
|
203651
204030
|
startHere: uniq2([...semanticStartHere, ...input.pack.suggestedReads]),
|
|
203652
204031
|
...semanticCode ? { semanticCode } : {},
|
|
203653
204032
|
...input.providerQuality ? { providerQuality: input.providerQuality } : {},
|
|
204033
|
+
retrieval: {
|
|
204034
|
+
mode: semanticCode ? "hybrid" : "unknown",
|
|
204035
|
+
...input.providerQuality?.selected ? { codeProvider: input.providerQuality.selected } : {},
|
|
204036
|
+
derivedViews: {
|
|
204037
|
+
graph: buildCodeGraphDerivedView({
|
|
204038
|
+
providerQuality: input.providerQuality,
|
|
204039
|
+
...input.snapshot ? {
|
|
204040
|
+
snapshot: {
|
|
204041
|
+
id: input.snapshot.id,
|
|
204042
|
+
sourceEpoch: input.snapshot.sourceEpoch,
|
|
204043
|
+
incomplete: input.snapshot.incomplete
|
|
204044
|
+
}
|
|
204045
|
+
} : {}
|
|
204046
|
+
})
|
|
204047
|
+
}
|
|
204048
|
+
},
|
|
203654
204049
|
reliableMemory: input.pack.memories.filter((memory) => memory.status === "current").map((memory) => ({
|
|
203655
204050
|
id: memory.id,
|
|
203656
204051
|
title: memory.title,
|
|
@@ -203721,6 +204116,7 @@ var init_context_pack = __esm({
|
|
|
203721
204116
|
"use strict";
|
|
203722
204117
|
init_esm_shims();
|
|
203723
204118
|
init_freshness2();
|
|
204119
|
+
init_context_receipt();
|
|
203724
204120
|
init_workset();
|
|
203725
204121
|
init_exclude3();
|
|
203726
204122
|
init_semantic_context();
|
|
@@ -209408,7 +209804,7 @@ var init_tool_profile = __esm({
|
|
|
209408
209804
|
function getMcpServerInfo() {
|
|
209409
209805
|
return {
|
|
209410
209806
|
name: "memorix",
|
|
209411
|
-
version: true ? "1.
|
|
209807
|
+
version: true ? "1.10.1" : "1.0.1"
|
|
209412
209808
|
};
|
|
209413
209809
|
}
|
|
209414
209810
|
function createMcpDiscoverResult(capabilities, serverInfo) {
|
|
@@ -224018,12 +224414,27 @@ __export(request_context_exports, {
|
|
|
224018
224414
|
ProjectBindingController: () => ProjectBindingController,
|
|
224019
224415
|
createProjectBindingController: () => createProjectBindingController
|
|
224020
224416
|
});
|
|
224417
|
+
import { createHash as createHash21 } from "crypto";
|
|
224021
224418
|
import path40 from "path";
|
|
224022
224419
|
function resolveRoot(projectRoot) {
|
|
224023
224420
|
const value = projectRoot.trim();
|
|
224024
224421
|
if (!value) throw new Error("Project binding requires a non-empty project root");
|
|
224025
224422
|
return path40.resolve(value);
|
|
224026
224423
|
}
|
|
224424
|
+
function hashBindingValue(value) {
|
|
224425
|
+
return `sha256:${createHash21("sha256").update(value).digest("hex")}`;
|
|
224426
|
+
}
|
|
224427
|
+
function remoteHost(remote) {
|
|
224428
|
+
const trimmed = remote.trim();
|
|
224429
|
+
if (!trimmed) return void 0;
|
|
224430
|
+
const scpHost = trimmed.match(/^[^@/\s]+@([^:\s/]+):/);
|
|
224431
|
+
if (scpHost) return scpHost[1].toLowerCase();
|
|
224432
|
+
try {
|
|
224433
|
+
return new URL(trimmed).hostname.toLowerCase() || void 0;
|
|
224434
|
+
} catch {
|
|
224435
|
+
return void 0;
|
|
224436
|
+
}
|
|
224437
|
+
}
|
|
224027
224438
|
function createProjectBindingController(projectRoot) {
|
|
224028
224439
|
return new ProjectBindingController(projectRoot);
|
|
224029
224440
|
}
|
|
@@ -224050,6 +224461,38 @@ var init_request_context = __esm({
|
|
|
224050
224461
|
...actorId ? { actorId } : {}
|
|
224051
224462
|
};
|
|
224052
224463
|
}
|
|
224464
|
+
/**
|
|
224465
|
+
* Return binding diagnostics without exposing local paths or transport IDs.
|
|
224466
|
+
* The hashes let operators compare two surfaces while keeping the receipt
|
|
224467
|
+
* safe to pass through MCP, logs, and agent handoffs.
|
|
224468
|
+
*/
|
|
224469
|
+
receipt(options = {}) {
|
|
224470
|
+
const snapshot = this.snapshot();
|
|
224471
|
+
const handle = options.handle;
|
|
224472
|
+
const handleState = !handle ? "absent" : handle.expiresAt && Date.parse(handle.expiresAt) <= Date.now() ? "expired" : "active";
|
|
224473
|
+
return {
|
|
224474
|
+
version: "1",
|
|
224475
|
+
state: snapshot.projectId ? "resolved" : "unresolved",
|
|
224476
|
+
source: snapshot.source,
|
|
224477
|
+
explicit: snapshot.explicit,
|
|
224478
|
+
...snapshot.projectId ? { projectId: snapshot.projectId } : {},
|
|
224479
|
+
projectRootHash: hashBindingValue(snapshot.projectRoot),
|
|
224480
|
+
...options.dataDir ? { dataDirHash: hashBindingValue(path40.resolve(options.dataDir)) } : {},
|
|
224481
|
+
gitRemote: options.gitRemote?.trim() ? {
|
|
224482
|
+
state: "verified",
|
|
224483
|
+
hash: hashBindingValue(options.gitRemote.trim()),
|
|
224484
|
+
...remoteHost(options.gitRemote) ? { host: remoteHost(options.gitRemote) } : {}
|
|
224485
|
+
} : { state: "unavailable" },
|
|
224486
|
+
handle: {
|
|
224487
|
+
state: handleState,
|
|
224488
|
+
...handle ? { idHash: hashBindingValue(handle.handleId) } : {},
|
|
224489
|
+
...handle?.createdAt ? { createdAt: handle.createdAt } : {},
|
|
224490
|
+
...handle?.lastUsedAt ? { lastUsedAt: handle.lastUsedAt } : {},
|
|
224491
|
+
...handle?.expiresAt ? { expiresAt: handle.expiresAt } : {}
|
|
224492
|
+
},
|
|
224493
|
+
transport: options.transport ?? "unknown"
|
|
224494
|
+
};
|
|
224495
|
+
}
|
|
224053
224496
|
isExplicit() {
|
|
224054
224497
|
return this.current.explicit;
|
|
224055
224498
|
}
|
|
@@ -225689,7 +226132,8 @@ async function handleApi(req, res, dataDir, projectId, projectName, baseDir, pro
|
|
|
225689
226132
|
"ANTHROPIC_API_KEY",
|
|
225690
226133
|
...resolved.memory.llm.provider === "openrouter" || resolved.memory.llm.baseUrl?.includes("openrouter.ai") ? ["OPENROUTER_API_KEY"] : [],
|
|
225691
226134
|
...resolved.memory.llm.provider === "requesty" ? ["REQUESTY_API_KEY"] : [],
|
|
225692
|
-
...resolved.memory.llm.provider === "apiroute" ? ["API_ROUTE_API_KEY"] : []
|
|
226135
|
+
...resolved.memory.llm.provider === "apiroute" ? ["API_ROUTE_API_KEY"] : [],
|
|
226136
|
+
...resolved.memory.llm.provider === "cheaperinference" ? ["CHEAPER_INFERENCE_API_KEY"] : []
|
|
225693
226137
|
];
|
|
225694
226138
|
if (llmKey) {
|
|
225695
226139
|
const src2 = resolveDashboardKeySource({ value: llmKey, envKeys: memoryKeyEnv, configSource });
|
|
@@ -266081,7 +266525,7 @@ async function analyzeImage(input) {
|
|
|
266081
266525
|
const config2 = getLLMConfig();
|
|
266082
266526
|
if (!OPENAI_COMPATIBLE_PROVIDERS.has(config2.provider)) {
|
|
266083
266527
|
throw new Error(
|
|
266084
|
-
`Image analysis requires an OpenAI-compatible provider (openai, openrouter, requesty, apiroute, or custom). Current provider "${config2.provider}" uses a different API shape. Set MEMORIX_LLM_PROVIDER=openai or configure an OpenAI-compatible base URL.`
|
|
266528
|
+
`Image analysis requires an OpenAI-compatible provider (openai, openrouter, requesty, apiroute, cheaperinference, or custom). Current provider "${config2.provider}" uses a different API shape. Set MEMORIX_LLM_PROVIDER=openai or configure an OpenAI-compatible base URL.`
|
|
266085
266529
|
);
|
|
266086
266530
|
}
|
|
266087
266531
|
const bytes = decodeBase64ImagePayload(input.base64, MAX_VISION_IMAGE_BYTES);
|
|
@@ -266120,7 +266564,7 @@ var init_image_loader = __esm({
|
|
|
266120
266564
|
init_provider2();
|
|
266121
266565
|
init_secret_filter();
|
|
266122
266566
|
init_image_payload();
|
|
266123
|
-
OPENAI_COMPATIBLE_PROVIDERS = /* @__PURE__ */ new Set(["openai", "openrouter", "requesty", "apiroute", "custom"]);
|
|
266567
|
+
OPENAI_COMPATIBLE_PROVIDERS = /* @__PURE__ */ new Set(["openai", "openrouter", "requesty", "apiroute", "cheaperinference", "custom"]);
|
|
266124
266568
|
MAX_VISION_PROMPT_CHARS = 12e3;
|
|
266125
266569
|
MAX_VISION_DESCRIPTION_CHARS = 12e3;
|
|
266126
266570
|
MAX_VISION_LABELS = 50;
|
|
@@ -266190,7 +266634,7 @@ __export(server_exports2, {
|
|
|
266190
266634
|
createMemorixServer: () => createMemorixServer,
|
|
266191
266635
|
shouldAwaitProjectRuntime: () => shouldAwaitProjectRuntime
|
|
266192
266636
|
});
|
|
266193
|
-
import { createHash as
|
|
266637
|
+
import { createHash as createHash22 } from "crypto";
|
|
266194
266638
|
function formatFormationStageDurations(stageDurationsMs) {
|
|
266195
266639
|
const orderedStages = ["extract", "resolve", "evaluate"];
|
|
266196
266640
|
const parts = orderedStages.filter((stage) => stageDurationsMs[stage] !== void 0).map((stage) => `${stage}=${stageDurationsMs[stage]}ms`);
|
|
@@ -266272,7 +266716,7 @@ function coerceObjectArray(val) {
|
|
|
266272
266716
|
return [];
|
|
266273
266717
|
}
|
|
266274
266718
|
function createDeterministicInstanceId(projectId, agentType, agentName) {
|
|
266275
|
-
const digest2 =
|
|
266719
|
+
const digest2 = createHash22("sha256").update(projectId).update("\n").update(agentType).update("\n").update(agentName ?? "").digest("hex").slice(0, 24);
|
|
266276
266720
|
return `auto-${digest2}`;
|
|
266277
266721
|
}
|
|
266278
266722
|
function shouldAwaitProjectRuntime(toolName) {
|
|
@@ -267348,20 +267792,17 @@ Use this as the \`topicKey\` parameter in \`memorix_store\` to enable upsert beh
|
|
|
267348
267792
|
if (duplicate) return duplicate;
|
|
267349
267793
|
}
|
|
267350
267794
|
let text3 = result.formatted;
|
|
267351
|
-
|
|
267352
|
-
const { getLastSearchMode: getLastSearchMode2 } = await Promise.resolve().then(() => (init_orama_store(), orama_store_exports));
|
|
267353
|
-
text3 += `
|
|
267795
|
+
text3 += `
|
|
267354
267796
|
|
|
267355
|
-
_Search mode: ${
|
|
267356
|
-
} catch {
|
|
267357
|
-
}
|
|
267797
|
+
_Search mode: ${result.receipt.mode}_`;
|
|
267358
267798
|
return {
|
|
267359
267799
|
content: [
|
|
267360
267800
|
{
|
|
267361
267801
|
type: "text",
|
|
267362
267802
|
text: text3
|
|
267363
267803
|
}
|
|
267364
|
-
]
|
|
267804
|
+
],
|
|
267805
|
+
structuredContent: { retrieval: result.receipt }
|
|
267365
267806
|
};
|
|
267366
267807
|
}, { loadCorpus: false });
|
|
267367
267808
|
}
|
|
@@ -269346,9 +269787,16 @@ Ensure the path points to a directory containing a .git folder (or a subdirector
|
|
|
269346
269787
|
agent,
|
|
269347
269788
|
reader: getObservationReader()
|
|
269348
269789
|
});
|
|
269790
|
+
const bindingReceipt = projectBinding.receipt({
|
|
269791
|
+
dataDir: projectDir2,
|
|
269792
|
+
transport: options.bindingTransport,
|
|
269793
|
+
gitRemote: project.gitRemote,
|
|
269794
|
+
handle: options.bindingHandle
|
|
269795
|
+
});
|
|
269349
269796
|
const lines = [
|
|
269350
269797
|
`[OK] Session started: ${result.session.id}`,
|
|
269351
269798
|
`Project: ${project.name} (${project.id})`,
|
|
269799
|
+
`Binding: ${bindingReceipt.state} via ${bindingReceipt.source}`,
|
|
269352
269800
|
result.session.agent ? `Agent: ${result.session.agent}` : "",
|
|
269353
269801
|
registeredAgent ? `Agent ID: ${registeredAgent.agent_id} (instance: ${registeredAgent.instance_id})` : "",
|
|
269354
269802
|
!registeredAgent ? "Coordination identity: not joined (memory/session context only)" : "",
|
|
@@ -269423,7 +269871,8 @@ ${s4.instruction}`.toLowerCase();
|
|
|
269423
269871
|
} catch {
|
|
269424
269872
|
}
|
|
269425
269873
|
return {
|
|
269426
|
-
content: [{ type: "text", text: lines.filter(Boolean).join("\n") }]
|
|
269874
|
+
content: [{ type: "text", text: lines.filter(Boolean).join("\n") }],
|
|
269875
|
+
structuredContent: { binding: bindingReceipt }
|
|
269427
269876
|
};
|
|
269428
269877
|
}
|
|
269429
269878
|
);
|
|
@@ -274390,12 +274839,27 @@ var init_serve_http = __esm({
|
|
|
274390
274839
|
const requestedRoot = requestInfo?.headers.get("mcp-project-root") ?? void 0;
|
|
274391
274840
|
const root = persisted?.projectRoot ?? requestedRoot ?? projectRoot;
|
|
274392
274841
|
const dataDir = await resolveModernDataDir(root, persisted);
|
|
274842
|
+
const binding = persisted ?? (() => {
|
|
274843
|
+
const detected = detectorMod.detectProject(root);
|
|
274844
|
+
if (!detected) return void 0;
|
|
274845
|
+
const existing = statelessBindingStore.findByProjectRoot(detected.rootPath);
|
|
274846
|
+
return existing ? statelessBindingStore.touch(existing.handleId) ?? existing : void 0;
|
|
274847
|
+
})();
|
|
274393
274848
|
const runtimeKey = JSON.stringify([dataDir, root]);
|
|
274394
274849
|
return modernRuntimePool.createBridge(runtimeKey, () => withBusinessRuntimeQueue2(async () => {
|
|
274395
274850
|
const lease = acquireDatabase2(dataDir);
|
|
274396
274851
|
try {
|
|
274397
274852
|
const runtime = await createModernMcpRuntime2({
|
|
274398
274853
|
projectRoot: root,
|
|
274854
|
+
bindingTransport: "stateless-http",
|
|
274855
|
+
...binding ? {
|
|
274856
|
+
bindingHandle: {
|
|
274857
|
+
handleId: binding.handleId,
|
|
274858
|
+
createdAt: binding.createdAt,
|
|
274859
|
+
lastUsedAt: binding.lastUsedAt,
|
|
274860
|
+
...binding.expiresAt ? { expiresAt: binding.expiresAt } : {}
|
|
274861
|
+
}
|
|
274862
|
+
} : {},
|
|
274399
274863
|
allowUntrackedFallback: false,
|
|
274400
274864
|
deferProjectInitUntilBound: true,
|
|
274401
274865
|
deferProjectRuntimeInit: true,
|
|
@@ -274594,10 +275058,11 @@ ${stack}` : ""}`);
|
|
|
274594
275058
|
const requestedRoot = typeof req.headers["mcp-project-root"] === "string" ? req.headers["mcp-project-root"] : projectRoot;
|
|
274595
275059
|
const detected = detectorMod.detectProject(requestedRoot);
|
|
274596
275060
|
if (detected) {
|
|
275061
|
+
const bindingDataDir = await persistMod.getProjectDataDir(detected.id);
|
|
274597
275062
|
const binding = statelessBindingStore.findByProjectRoot(detected.rootPath) ?? statelessBindingStore.create({
|
|
274598
275063
|
projectId: detected.id,
|
|
274599
275064
|
projectRoot: detected.rootPath,
|
|
274600
|
-
dataDir:
|
|
275065
|
+
dataDir: bindingDataDir
|
|
274601
275066
|
});
|
|
274602
275067
|
res.setHeader("Mcp-Project-Handle", binding.handleId);
|
|
274603
275068
|
}
|
|
@@ -274696,6 +275161,7 @@ ${stack}` : ""}`);
|
|
|
274696
275161
|
dashboardMode: "control-plane",
|
|
274697
275162
|
dashboardPort: port,
|
|
274698
275163
|
toolProfile,
|
|
275164
|
+
bindingTransport: "legacy-http",
|
|
274699
275165
|
projectBinding: binding
|
|
274700
275166
|
}
|
|
274701
275167
|
));
|
|
@@ -274808,6 +275274,15 @@ ${stack}` : ""}`);
|
|
|
274808
275274
|
rootPath: projectRoot
|
|
274809
275275
|
};
|
|
274810
275276
|
const defaultDataDir = await getProjectDataDir2(defaultProject.id);
|
|
275277
|
+
const dashboardBinding = createProjectBindingController2(defaultProject.rootPath);
|
|
275278
|
+
if (defaultProject.id !== "__unresolved__") {
|
|
275279
|
+
dashboardBinding.recordResolvedProject(defaultProject.id, defaultProject.rootPath);
|
|
275280
|
+
}
|
|
275281
|
+
const dashboardBindingReceipt = dashboardBinding.receipt({
|
|
275282
|
+
dataDir: defaultDataDir,
|
|
275283
|
+
transport: "dashboard",
|
|
275284
|
+
gitRemote: defaultProject.gitRemote
|
|
275285
|
+
});
|
|
274811
275286
|
const baseDir = getBaseDataDir2();
|
|
274812
275287
|
const { createControlPlaneMaintenanceWorker: createControlPlaneMaintenanceWorker2 } = await Promise.resolve().then(() => (init_control_plane_maintenance(), control_plane_maintenance_exports));
|
|
274813
275288
|
const controlPlaneMaintenanceWorker = createControlPlaneMaintenanceWorker2(defaultDataDir, {
|
|
@@ -275676,6 +276151,7 @@ ${stack}` : ""}`);
|
|
|
275676
276151
|
pid: process.pid,
|
|
275677
276152
|
projectId: defaultProject?.id ?? "__unresolved__",
|
|
275678
276153
|
projectName: defaultProject?.name ?? null,
|
|
276154
|
+
binding: dashboardBindingReceipt,
|
|
275679
276155
|
readyAt: httpReadyAt,
|
|
275680
276156
|
memory: {
|
|
275681
276157
|
rss: memory.rss,
|
|
@@ -276293,7 +276769,7 @@ var init_merge = __esm({
|
|
|
276293
276769
|
});
|
|
276294
276770
|
|
|
276295
276771
|
// src/sync/journal.ts
|
|
276296
|
-
import { createHash as
|
|
276772
|
+
import { createHash as createHash23 } from "crypto";
|
|
276297
276773
|
function nowIso() {
|
|
276298
276774
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
276299
276775
|
}
|
|
@@ -276305,7 +276781,7 @@ function deriveSyncKey(obs, originDevice) {
|
|
|
276305
276781
|
function contentHash(obs) {
|
|
276306
276782
|
const { id: _id, writeGeneration: _wg, ...rest } = obs;
|
|
276307
276783
|
const stable = stableJson(rest);
|
|
276308
|
-
return
|
|
276784
|
+
return createHash23("sha256").update(stable).digest("hex");
|
|
276309
276785
|
}
|
|
276310
276786
|
function stableJson(value) {
|
|
276311
276787
|
if (Array.isArray(value)) return `[${value.map(stableJson).join(",")}]`;
|
|
@@ -276428,9 +276904,9 @@ var init_policy2 = __esm({
|
|
|
276428
276904
|
});
|
|
276429
276905
|
|
|
276430
276906
|
// src/sync/namespace.ts
|
|
276431
|
-
import { createHash as
|
|
276907
|
+
import { createHash as createHash24 } from "crypto";
|
|
276432
276908
|
function syncNamespace(projectId) {
|
|
276433
|
-
return `project-${
|
|
276909
|
+
return `project-${createHash24("sha256").update(projectId).digest("hex").slice(0, 32)}`;
|
|
276434
276910
|
}
|
|
276435
276911
|
function userSyncNamespace(env3 = process.env) {
|
|
276436
276912
|
const override = env3.MEMORIX_SYNC_USER_NAMESPACE?.trim();
|
|
@@ -276456,7 +276932,7 @@ var init_namespace = __esm({
|
|
|
276456
276932
|
});
|
|
276457
276933
|
|
|
276458
276934
|
// src/sync/engine.ts
|
|
276459
|
-
import { createHash as
|
|
276935
|
+
import { createHash as createHash25 } from "crypto";
|
|
276460
276936
|
async function runSync(store2, remote, opts) {
|
|
276461
276937
|
const report = {
|
|
276462
276938
|
remote: remote.kind,
|
|
@@ -276660,7 +277136,7 @@ async function recordConcurrentConflict(store2, report, local, incoming, localRo
|
|
|
276660
277136
|
const incomingWins = compareVersion(incoming.version, { revision: local.revision, writer: local.writer }) > 0;
|
|
276661
277137
|
const loser = incomingWins ? { revision: local.revision, writer: local.writer } : incoming.version;
|
|
276662
277138
|
const loserRow = incomingWins ? localRow : incoming.row;
|
|
276663
|
-
const id =
|
|
277139
|
+
const id = createHash25("sha256").update(`${store2.projectId()}|${incoming.syncKey}|${local.revision}|${local.writer}|${incoming.version.revision}|${incoming.version.writer}`).digest("hex");
|
|
276664
277140
|
await store2.recordConflict({
|
|
276665
277141
|
id,
|
|
276666
277142
|
projectId: store2.projectId(),
|
|
@@ -279557,10 +280033,10 @@ __export(handler_exports, {
|
|
|
279557
280033
|
resetCooldowns: () => resetCooldowns,
|
|
279558
280034
|
runHook: () => runHook
|
|
279559
280035
|
});
|
|
279560
|
-
import { createHash as
|
|
280036
|
+
import { createHash as createHash26 } from "crypto";
|
|
279561
280037
|
function deriveHookActorId(input) {
|
|
279562
280038
|
const material = `${input.agent ?? "unknown"}\0${input.sessionId ?? "unknown"}`;
|
|
279563
|
-
return `hook:${
|
|
280039
|
+
return `hook:${createHash26("sha256").update(material).digest("hex").slice(0, 24)}`;
|
|
279564
280040
|
}
|
|
279565
280041
|
function classifyTool(input) {
|
|
279566
280042
|
if (input.event === "post_edit") return "file_modify";
|
|
@@ -281525,10 +282001,10 @@ var init_ingest = __esm({
|
|
|
281525
282001
|
});
|
|
281526
282002
|
|
|
281527
282003
|
// src/media/embedding.ts
|
|
281528
|
-
import { createHash as
|
|
282004
|
+
import { createHash as createHash27 } from "crypto";
|
|
281529
282005
|
function profileKey(provider2, asset) {
|
|
281530
282006
|
const identity = `${provider2.name}\0${provider2.dimensions}\0${asset.kind}`;
|
|
281531
|
-
return `media:${
|
|
282007
|
+
return `media:${createHash27("sha256").update(identity).digest("hex").slice(0, 20)}`;
|
|
281532
282008
|
}
|
|
281533
282009
|
function supportsAsset(provider2, asset) {
|
|
281534
282010
|
return !!provider2.embedInput && (provider2.supportedModalities?.includes(asset.kind) ?? false);
|
|
@@ -283147,7 +283623,7 @@ import { mkdir as mkdir9, readFile as readFile10, writeFile as writeFile10 } fro
|
|
|
283147
283623
|
import { basename as basename5, dirname as dirname8, resolve as resolve7 } from "path";
|
|
283148
283624
|
import { homedir as homedir36 } from "os";
|
|
283149
283625
|
function requestedAgents(agent) {
|
|
283150
|
-
const all =
|
|
283626
|
+
const all = getAgentIntegrationEntries().map((entry) => entry.agent);
|
|
283151
283627
|
if (!agent || agent === "all") return all;
|
|
283152
283628
|
return all.includes(agent) ? [agent] : [];
|
|
283153
283629
|
}
|
|
@@ -283170,8 +283646,99 @@ function worstStatus(statuses) {
|
|
|
283170
283646
|
if (statuses.includes("ok")) return "ok";
|
|
283171
283647
|
return "skipped";
|
|
283172
283648
|
}
|
|
283649
|
+
function capabilityParity(agent, projectRoot, scope, mcp, guidance, plugin) {
|
|
283650
|
+
const manifest = getAgentIntegrationEntries().find((entry) => entry.agent === agent)?.capabilities;
|
|
283651
|
+
if (!manifest) {
|
|
283652
|
+
return {
|
|
283653
|
+
manifestVersion: "1",
|
|
283654
|
+
expectedTransports: [],
|
|
283655
|
+
defaultTransport: "none",
|
|
283656
|
+
observedTransports: [],
|
|
283657
|
+
expectedArtifacts: [],
|
|
283658
|
+
artifactStatus: {},
|
|
283659
|
+
artifactChecks: [],
|
|
283660
|
+
lifecycle: { install: false, repair: false, doctor: false, uninstall: false },
|
|
283661
|
+
status: "missing",
|
|
283662
|
+
issues: ["manifest-missing"],
|
|
283663
|
+
source: {
|
|
283664
|
+
registry: "src/integrations/registry.ts",
|
|
283665
|
+
generatedBy: [],
|
|
283666
|
+
documentation: []
|
|
283667
|
+
}
|
|
283668
|
+
};
|
|
283669
|
+
}
|
|
283670
|
+
const expectedArtifacts = [
|
|
283671
|
+
...manifest.artifacts.packageFiles.length > 0 ? ["package"] : [],
|
|
283672
|
+
...manifest.artifacts.hookFiles.length > 0 ? ["hooks"] : [],
|
|
283673
|
+
...manifest.artifacts.ruleFiles.length > 0 ? ["rules"] : [],
|
|
283674
|
+
...manifest.artifacts.skillFiles.length > 0 ? ["skills"] : [],
|
|
283675
|
+
...manifest.artifacts.guidanceFiles.length > 0 ? ["guidance"] : []
|
|
283676
|
+
];
|
|
283677
|
+
const artifactStatus = {};
|
|
283678
|
+
if (manifest.transport.supported.length > 0) artifactStatus.mcp = mcp.status;
|
|
283679
|
+
if (manifest.artifacts.packageFiles.length > 0) artifactStatus.package = plugin.status;
|
|
283680
|
+
if (manifest.artifacts.hookFiles.length > 0) {
|
|
283681
|
+
artifactStatus.hooks = plugin.checks.length > 0 ? plugin.status : "skipped";
|
|
283682
|
+
}
|
|
283683
|
+
if (manifest.artifacts.ruleFiles.length > 0 || manifest.artifacts.guidanceFiles.length > 0) {
|
|
283684
|
+
artifactStatus.guidance = guidance.status;
|
|
283685
|
+
}
|
|
283686
|
+
if (manifest.artifacts.skillFiles.length > 0) {
|
|
283687
|
+
artifactStatus.skills = plugin.checks.length > 0 ? plugin.status : "skipped";
|
|
283688
|
+
}
|
|
283689
|
+
const artifactChecks = [];
|
|
283690
|
+
for (const check2 of guidance.checks) {
|
|
283691
|
+
if (check2.scope === "local") continue;
|
|
283692
|
+
const kind = manifest.artifacts.ruleFiles.length > 0 ? "rules" : "guidance";
|
|
283693
|
+
artifactChecks.push({
|
|
283694
|
+
kind,
|
|
283695
|
+
scope: check2.scope,
|
|
283696
|
+
path: check2.path,
|
|
283697
|
+
exists: check2.exists,
|
|
283698
|
+
status: check2.status
|
|
283699
|
+
});
|
|
283700
|
+
}
|
|
283701
|
+
if (manifest.hooks.supported) {
|
|
283702
|
+
const artifactScopes = requestedGuidanceScopes(scope).filter((value) => value !== "local");
|
|
283703
|
+
for (const artifactScope of artifactScopes) {
|
|
283704
|
+
const path50 = artifactScope === "project" ? getProjectConfigPath(agent, projectRoot) : getGlobalConfigPath(agent);
|
|
283705
|
+
if (!path50) continue;
|
|
283706
|
+
const exists3 = existsSync31(path50);
|
|
283707
|
+
artifactChecks.push({
|
|
283708
|
+
kind: "hooks",
|
|
283709
|
+
scope: artifactScope,
|
|
283710
|
+
path: path50,
|
|
283711
|
+
exists: exists3,
|
|
283712
|
+
status: exists3 ? "ok" : "missing"
|
|
283713
|
+
});
|
|
283714
|
+
}
|
|
283715
|
+
}
|
|
283716
|
+
const observedTransports = [...new Set(mcp.checks.map((check2) => check2.server?.transport).filter((transport) => transport === "stdio" || transport === "http"))];
|
|
283717
|
+
const parityStatuses = [
|
|
283718
|
+
...Object.values(artifactStatus),
|
|
283719
|
+
...artifactChecks.map((check2) => check2.status)
|
|
283720
|
+
];
|
|
283721
|
+
const issues = Object.entries(artifactStatus).filter(([, status]) => status === "missing" || status === "repairable").map(([kind, status]) => `${kind}-${status}`);
|
|
283722
|
+
issues.push(...artifactChecks.filter((check2) => check2.status === "missing" || check2.status === "repairable").map((check2) => `${check2.kind}-${check2.scope}-${check2.status}`));
|
|
283723
|
+
if (manifest.transport.supported.length > 0 && mcp.status === "skipped") {
|
|
283724
|
+
issues.push("transport-not-checked");
|
|
283725
|
+
}
|
|
283726
|
+
return {
|
|
283727
|
+
manifestVersion: manifest.schemaVersion,
|
|
283728
|
+
expectedTransports: [...manifest.transport.supported],
|
|
283729
|
+
defaultTransport: manifest.transport.default,
|
|
283730
|
+
observedTransports,
|
|
283731
|
+
expectedArtifacts,
|
|
283732
|
+
artifactStatus,
|
|
283733
|
+
artifactChecks,
|
|
283734
|
+
lifecycle: { ...manifest.lifecycle },
|
|
283735
|
+
status: worstStatus(parityStatuses),
|
|
283736
|
+
issues: unique2(issues),
|
|
283737
|
+
source: manifest.source
|
|
283738
|
+
};
|
|
283739
|
+
}
|
|
283173
283740
|
function isMcpConfigAgent(agent) {
|
|
283174
|
-
return agent !== "pi" && agent !== "grok";
|
|
283741
|
+
return agent !== "pi" && agent !== "grok" && agent !== "qwen";
|
|
283175
283742
|
}
|
|
283176
283743
|
function isActionableMcpRepairIssue(issue2) {
|
|
283177
283744
|
return issue2 !== "memorix-server-missing";
|
|
@@ -283891,11 +284458,15 @@ async function inspectAgentIntegrations(options = {}) {
|
|
|
283891
284458
|
const agents = requestedAgents(options.agent);
|
|
283892
284459
|
const entries = [];
|
|
283893
284460
|
for (const agent of agents) {
|
|
284461
|
+
const mcp = await inspectMcp(agent, projectRoot, scope);
|
|
284462
|
+
const guidance = await inspectGuidance(agent, projectRoot, scope);
|
|
284463
|
+
const plugin = await inspectPlugin(agent, scope);
|
|
283894
284464
|
entries.push({
|
|
283895
284465
|
agent,
|
|
283896
|
-
|
|
283897
|
-
|
|
283898
|
-
|
|
284466
|
+
capability: capabilityParity(agent, projectRoot, scope, mcp, guidance, plugin),
|
|
284467
|
+
mcp,
|
|
284468
|
+
guidance,
|
|
284469
|
+
plugin
|
|
283899
284470
|
});
|
|
283900
284471
|
}
|
|
283901
284472
|
const entryStatuses = entries.map((entry) => worstStatus([entry.mcp.status, entry.guidance.status, entry.plugin.status]));
|
|
@@ -283922,6 +284493,10 @@ function formatAgentIntegrationReport(report) {
|
|
|
283922
284493
|
for (const entry of report.entries) {
|
|
283923
284494
|
const status = worstStatus([entry.mcp.status, entry.guidance.status, entry.plugin.status]);
|
|
283924
284495
|
lines.push(`${entry.agent}: ${status}`);
|
|
284496
|
+
const expected = entry.capability.expectedArtifacts.length > 0 ? entry.capability.expectedArtifacts.join(", ") : "none";
|
|
284497
|
+
const observed = entry.capability.observedTransports.length > 0 ? entry.capability.observedTransports.join(", ") : "none";
|
|
284498
|
+
lines.push(` Capability: v${entry.capability.manifestVersion}; transport=${entry.capability.defaultTransport}; observed=${observed}; artifacts=${expected}; parity=${entry.capability.status}`);
|
|
284499
|
+
if (entry.capability.issues.length > 0) lines.push(` Capability parity: ${entry.capability.issues.join(", ")}`);
|
|
283925
284500
|
if (entry.mcp.issues.length > 0) lines.push(` MCP: ${entry.mcp.issues.join(", ")}`);
|
|
283926
284501
|
if (entry.guidance.issues.length > 0) lines.push(` Guidance: ${entry.guidance.issues.join(", ")}`);
|
|
283927
284502
|
const hookTrustPending = entry.plugin.issues.includes("codex-hook-trust-pending");
|
|
@@ -284063,6 +284638,7 @@ var init_agent_integrations = __esm({
|
|
|
284063
284638
|
init_installers();
|
|
284064
284639
|
init_setup();
|
|
284065
284640
|
init_version();
|
|
284641
|
+
init_registry2();
|
|
284066
284642
|
GUIDANCE_AGENTS = /* @__PURE__ */ new Set([
|
|
284067
284643
|
"claude",
|
|
284068
284644
|
"codex",
|
|
@@ -287555,12 +288131,12 @@ var init_permission = __esm({
|
|
|
287555
288131
|
});
|
|
287556
288132
|
|
|
287557
288133
|
// src/orchestrate/effect-ledger.ts
|
|
287558
|
-
import { createHash as
|
|
288134
|
+
import { createHash as createHash28, randomUUID as randomUUID22 } from "crypto";
|
|
287559
288135
|
function fingerprintEffectInput(input) {
|
|
287560
288136
|
if (input === void 0) return void 0;
|
|
287561
288137
|
try {
|
|
287562
288138
|
const safe = sanitizeCredentials(JSON.stringify(input));
|
|
287563
|
-
return
|
|
288139
|
+
return createHash28("sha256").update(safe).digest("hex").slice(0, 24);
|
|
287564
288140
|
} catch {
|
|
287565
288141
|
return void 0;
|
|
287566
288142
|
}
|
|
@@ -287687,7 +288263,7 @@ var init_effect_ledger = __esm({
|
|
|
287687
288263
|
});
|
|
287688
288264
|
|
|
287689
288265
|
// src/orchestrate/memorix-bridge.ts
|
|
287690
|
-
import { createHash as
|
|
288266
|
+
import { createHash as createHash29 } from "crypto";
|
|
287691
288267
|
async function getStoreObservation() {
|
|
287692
288268
|
if (!_storeObservation) {
|
|
287693
288269
|
const mod = await Promise.resolve().then(() => (init_observations(), observations_exports));
|
|
@@ -287703,7 +288279,7 @@ async function getSearchObservations() {
|
|
|
287703
288279
|
return _searchObservations;
|
|
287704
288280
|
}
|
|
287705
288281
|
function automaticActorId(...parts) {
|
|
287706
|
-
return `orchestrator:${
|
|
288282
|
+
return `orchestrator:${createHash29("sha256").update(parts.join("\0")).digest("hex").slice(0, 24)}`;
|
|
287707
288283
|
}
|
|
287708
288284
|
function isEligibleAutomaticLesson(entry) {
|
|
287709
288285
|
return entry.admissionState !== "candidate" && entry.admissionState !== "ephemeral";
|
|
@@ -287850,7 +288426,7 @@ function sanitizeErrorPattern(text3) {
|
|
|
287850
288426
|
}
|
|
287851
288427
|
function hashErrorPattern(errorOutput) {
|
|
287852
288428
|
const sanitized = sanitizeErrorPattern(errorOutput).slice(0, 500);
|
|
287853
|
-
return
|
|
288429
|
+
return createHash29("sha256").update(sanitized).digest("hex").slice(0, 12);
|
|
287854
288430
|
}
|
|
287855
288431
|
function sleep6(ms2) {
|
|
287856
288432
|
return new Promise((resolve9) => setTimeout(() => resolve9([]), ms2));
|
|
@@ -290330,6 +290906,7 @@ function ConfigureView({ onBack }) {
|
|
|
290330
290906
|
{ key: "openrouter", label: "OpenRouter", hint: "multi-provider" },
|
|
290331
290907
|
{ key: "requesty", label: "Requesty", hint: "multi-provider" },
|
|
290332
290908
|
{ key: "apiroute", label: "API Route", hint: "multi-provider" },
|
|
290909
|
+
{ key: "cheaperinference", label: "Cheaper Inference", hint: "multi-provider" },
|
|
290333
290910
|
{ key: "atlascloud", label: "Atlas Cloud", hint: "DeepSeek V3.2" },
|
|
290334
290911
|
{ key: "custom", label: "Custom endpoint", hint: "OpenAI-compatible" },
|
|
290335
290912
|
{ key: "disable", label: "Disable LLM", hint: "free heuristic mode", color: COLORS.warning },
|
|
@@ -290625,6 +291202,7 @@ function getDefaultModel(provider2) {
|
|
|
290625
291202
|
if (provider2 === "openrouter") return "openai/gpt-4o-mini";
|
|
290626
291203
|
if (provider2 === "requesty") return "openai/gpt-4o-mini";
|
|
290627
291204
|
if (provider2 === "apiroute") return "deepseek-v4.1-flash";
|
|
291205
|
+
if (provider2 === "cheaperinference") return "gpt-5.4-mini";
|
|
290628
291206
|
if (provider2 === "atlascloud") return "deepseek-ai/deepseek-v3.2";
|
|
290629
291207
|
return "gpt-4o-mini";
|
|
290630
291208
|
}
|
|
@@ -293737,27 +294315,27 @@ function ensureMemorixPackageRoot(startDir = dirname(fileURLToPath2(import.meta.
|
|
|
293737
294315
|
if (process.env.MEMORIX_PACKAGE_ROOT) {
|
|
293738
294316
|
return process.env.MEMORIX_PACKAGE_ROOT;
|
|
293739
294317
|
}
|
|
293740
|
-
const
|
|
293741
|
-
if (
|
|
293742
|
-
process.env.MEMORIX_PACKAGE_ROOT =
|
|
294318
|
+
const packageRoot2 = findMemorixPackageRoot(startDir);
|
|
294319
|
+
if (packageRoot2) {
|
|
294320
|
+
process.env.MEMORIX_PACKAGE_ROOT = packageRoot2;
|
|
293743
294321
|
}
|
|
293744
|
-
return
|
|
294322
|
+
return packageRoot2;
|
|
293745
294323
|
}
|
|
293746
|
-
function ensureBundledMemcodePackageDir(
|
|
294324
|
+
function ensureBundledMemcodePackageDir(packageRoot2) {
|
|
293747
294325
|
if (process.env.MEMCODE_PACKAGE_DIR || process.env.PI_PACKAGE_DIR) {
|
|
293748
294326
|
return;
|
|
293749
294327
|
}
|
|
293750
|
-
const bundledRuntimeDir = join(
|
|
294328
|
+
const bundledRuntimeDir = join(packageRoot2, "dist", "memcode-runtime");
|
|
293751
294329
|
if (existsSync(join(bundledRuntimeDir, "package.json"))) {
|
|
293752
294330
|
process.env.MEMCODE_PACKAGE_DIR = bundledRuntimeDir;
|
|
293753
294331
|
}
|
|
293754
294332
|
}
|
|
293755
294333
|
async function importBundledMemcode(startDir = dirname(fileURLToPath2(import.meta.url))) {
|
|
293756
|
-
const
|
|
293757
|
-
if (
|
|
293758
|
-
const bundledEntry = join(
|
|
294334
|
+
const packageRoot2 = ensureMemorixPackageRoot(startDir);
|
|
294335
|
+
if (packageRoot2) {
|
|
294336
|
+
const bundledEntry = join(packageRoot2, "dist", "memcode", "index.js");
|
|
293759
294337
|
if (existsSync(bundledEntry)) {
|
|
293760
|
-
ensureBundledMemcodePackageDir(
|
|
294338
|
+
ensureBundledMemcodePackageDir(packageRoot2);
|
|
293761
294339
|
return import(pathToFileURL(bundledEntry).href);
|
|
293762
294340
|
}
|
|
293763
294341
|
}
|