memorix 1.9.11 → 1.10.0
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 +29 -1
- package/dist/cli/index.js +550 -102
- package/dist/index.d.ts +46 -0
- package/dist/index.js +272 -28
- package/dist/maintenance-runner.js +143 -3
- package/dist/media-audio-runner.js +143 -3
- package/dist/media-video-runner.js +143 -3
- package/dist/memcode/index.js +124 -8
- package/dist/memcode-runtime/CHANGELOG.md +29 -1
- package/dist/sdk.js +270 -26
- package/dist/vector-backfill-runner.js +143 -3
- package/docs/1.2.0-EVALUATION-HARNESS.md +88 -0
- package/docs/1.3-MEMORY-ARCHITECTURE.md +31 -0
- package/docs/API_REFERENCE.md +19 -0
- package/docs/DEVELOPMENT.md +16 -3
- package/docs/INTEGRATIONS.md +25 -0
- package/docs/PERFORMANCE.md +21 -6
- package/docs/README.md +5 -4
- package/docs/ROADMAP-1.9.12-2.0.md +722 -0
- package/package.json +4 -2
- 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/memory.ts +1 -1
- package/src/cli/commands/serve-http.ts +30 -1
- package/src/cli/commands/setup.ts +5 -21
- package/src/cli/update-checker.ts +2 -1
- package/src/codegraph/auto-context.ts +5 -0
- package/src/codegraph/context-pack.ts +4 -0
- package/src/compact/engine.ts +43 -2
- 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 +33 -2
- package/src/knowledge/workset.ts +35 -3
- package/src/server/request-context.ts +96 -0
- package/src/server.ts +16 -4
- package/src/store/orama-store.ts +54 -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.0" : pkg.version;
|
|
3236
3236
|
}
|
|
3237
3237
|
var init_version = __esm({
|
|
3238
3238
|
"src/cli/version.ts"() {
|
|
@@ -52019,6 +52019,25 @@ var init_models_generated = __esm({
|
|
|
52019
52019
|
}
|
|
52020
52020
|
},
|
|
52021
52021
|
"minimax": {
|
|
52022
|
+
"MiniMax-M3.1-Flash": {
|
|
52023
|
+
id: "MiniMax-M3.1-Flash",
|
|
52024
|
+
name: "MiniMax-M3.1-Flash",
|
|
52025
|
+
api: "anthropic-messages",
|
|
52026
|
+
provider: "minimax",
|
|
52027
|
+
baseUrl: "https://api.minimax.io/anthropic",
|
|
52028
|
+
compat: { "forceAdaptiveThinking": true },
|
|
52029
|
+
reasoning: true,
|
|
52030
|
+
thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
|
|
52031
|
+
input: ["text", "image", "video"],
|
|
52032
|
+
cost: {
|
|
52033
|
+
input: 0.15,
|
|
52034
|
+
output: 0.6,
|
|
52035
|
+
cacheRead: 0.015,
|
|
52036
|
+
cacheWrite: 0
|
|
52037
|
+
},
|
|
52038
|
+
contextWindow: 1e6,
|
|
52039
|
+
maxTokens: 524288
|
|
52040
|
+
},
|
|
52022
52041
|
"MiniMax-M2.7": {
|
|
52023
52042
|
id: "MiniMax-M2.7",
|
|
52024
52043
|
name: "MiniMax-M2.7",
|
|
@@ -52059,6 +52078,7 @@ var init_models_generated = __esm({
|
|
|
52059
52078
|
api: "anthropic-messages",
|
|
52060
52079
|
provider: "minimax",
|
|
52061
52080
|
baseUrl: "https://api.minimax.io/anthropic",
|
|
52081
|
+
compat: { "forceAdaptiveThinking": true },
|
|
52062
52082
|
reasoning: true,
|
|
52063
52083
|
input: ["text", "image", "video"],
|
|
52064
52084
|
cost: {
|
|
@@ -52068,10 +52088,29 @@ var init_models_generated = __esm({
|
|
|
52068
52088
|
cacheWrite: 0
|
|
52069
52089
|
},
|
|
52070
52090
|
contextWindow: 1e6,
|
|
52071
|
-
maxTokens:
|
|
52091
|
+
maxTokens: 524288
|
|
52072
52092
|
}
|
|
52073
52093
|
},
|
|
52074
52094
|
"minimax-cn": {
|
|
52095
|
+
"MiniMax-M3.1-Flash": {
|
|
52096
|
+
id: "MiniMax-M3.1-Flash",
|
|
52097
|
+
name: "MiniMax-M3.1-Flash",
|
|
52098
|
+
api: "anthropic-messages",
|
|
52099
|
+
provider: "minimax-cn",
|
|
52100
|
+
baseUrl: "https://api.minimaxi.com/anthropic",
|
|
52101
|
+
compat: { "forceAdaptiveThinking": true },
|
|
52102
|
+
reasoning: true,
|
|
52103
|
+
thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
|
|
52104
|
+
input: ["text", "image", "video"],
|
|
52105
|
+
cost: {
|
|
52106
|
+
input: 0.15,
|
|
52107
|
+
output: 0.6,
|
|
52108
|
+
cacheRead: 0.015,
|
|
52109
|
+
cacheWrite: 0
|
|
52110
|
+
},
|
|
52111
|
+
contextWindow: 1e6,
|
|
52112
|
+
maxTokens: 524288
|
|
52113
|
+
},
|
|
52075
52114
|
"MiniMax-M2.7": {
|
|
52076
52115
|
id: "MiniMax-M2.7",
|
|
52077
52116
|
name: "MiniMax-M2.7",
|
|
@@ -52112,6 +52151,7 @@ var init_models_generated = __esm({
|
|
|
52112
52151
|
api: "anthropic-messages",
|
|
52113
52152
|
provider: "minimax-cn",
|
|
52114
52153
|
baseUrl: "https://api.minimaxi.com/anthropic",
|
|
52154
|
+
compat: { "forceAdaptiveThinking": true },
|
|
52115
52155
|
reasoning: true,
|
|
52116
52156
|
input: ["text", "image", "video"],
|
|
52117
52157
|
cost: {
|
|
@@ -52121,7 +52161,7 @@ var init_models_generated = __esm({
|
|
|
52121
52161
|
cacheWrite: 0
|
|
52122
52162
|
},
|
|
52123
52163
|
contextWindow: 1e6,
|
|
52124
|
-
maxTokens:
|
|
52164
|
+
maxTokens: 524288
|
|
52125
52165
|
}
|
|
52126
52166
|
},
|
|
52127
52167
|
"mistral": {
|
|
@@ -55242,6 +55282,24 @@ var init_models_generated = __esm({
|
|
|
55242
55282
|
}
|
|
55243
55283
|
},
|
|
55244
55284
|
"openrouter": {
|
|
55285
|
+
"minimax/minimax-m3.1-flash:free": {
|
|
55286
|
+
id: "minimax/minimax-m3.1-flash:free",
|
|
55287
|
+
name: "MiniMax: MiniMax M3.1 Flash (free)",
|
|
55288
|
+
api: "openai-completions",
|
|
55289
|
+
provider: "openrouter",
|
|
55290
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
55291
|
+
reasoning: true,
|
|
55292
|
+
thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
|
|
55293
|
+
input: ["text", "image"],
|
|
55294
|
+
cost: {
|
|
55295
|
+
input: 0,
|
|
55296
|
+
output: 0,
|
|
55297
|
+
cacheRead: 0,
|
|
55298
|
+
cacheWrite: 0
|
|
55299
|
+
},
|
|
55300
|
+
contextWindow: 1e6,
|
|
55301
|
+
maxTokens: 524288
|
|
55302
|
+
},
|
|
55245
55303
|
"ai21/jamba-large-1.7": {
|
|
55246
55304
|
id: "ai21/jamba-large-1.7",
|
|
55247
55305
|
name: "AI21: Jamba Large 1.7",
|
|
@@ -63943,6 +64001,14 @@ var init_models_generated = __esm({
|
|
|
63943
64001
|
}
|
|
63944
64002
|
});
|
|
63945
64003
|
|
|
64004
|
+
// packages/ai/dist/minimax-models.js
|
|
64005
|
+
var init_minimax_models = __esm({
|
|
64006
|
+
"packages/ai/dist/minimax-models.js"() {
|
|
64007
|
+
"use strict";
|
|
64008
|
+
init_esm_shims();
|
|
64009
|
+
}
|
|
64010
|
+
});
|
|
64011
|
+
|
|
63946
64012
|
// packages/ai/dist/models.js
|
|
63947
64013
|
function calculateCost(model, usage3) {
|
|
63948
64014
|
usage3.cost.input = model.cost.input / 1e6 * usage3.input;
|
|
@@ -63989,6 +64055,8 @@ var init_models3 = __esm({
|
|
|
63989
64055
|
"use strict";
|
|
63990
64056
|
init_esm_shims();
|
|
63991
64057
|
init_models_generated();
|
|
64058
|
+
init_minimax_models();
|
|
64059
|
+
init_minimax_models();
|
|
63992
64060
|
modelRegistry = /* @__PURE__ */ new Map();
|
|
63993
64061
|
for (const [provider2, models2] of Object.entries(MODELS)) {
|
|
63994
64062
|
const providerModels = /* @__PURE__ */ new Map();
|
|
@@ -71942,6 +72010,25 @@ function buildParams2(model, context, isOAuthToken2, options) {
|
|
|
71942
72010
|
params.tool_choice = options.toolChoice;
|
|
71943
72011
|
}
|
|
71944
72012
|
}
|
|
72013
|
+
return normalizeMiniMaxParams(model, params, options);
|
|
72014
|
+
}
|
|
72015
|
+
function normalizeMiniMaxParams(model, params, options) {
|
|
72016
|
+
if (model.provider !== "minimax" && model.provider !== "minimax-cn")
|
|
72017
|
+
return params;
|
|
72018
|
+
if (params.model === "MiniMax-M3.1-Flash") {
|
|
72019
|
+
const effort = params.output_config?.effort ?? options?.effort ?? "max";
|
|
72020
|
+
const normalized = { ...params, thinking: { type: "adaptive" } };
|
|
72021
|
+
normalized.output_config = {
|
|
72022
|
+
...params.output_config,
|
|
72023
|
+
effort: ["low", "medium", "high", "xhigh", "max"].includes(effort) ? effort : "max"
|
|
72024
|
+
};
|
|
72025
|
+
delete normalized.service_tier;
|
|
72026
|
+
delete normalized.reasoning_split;
|
|
72027
|
+
return normalized;
|
|
72028
|
+
}
|
|
72029
|
+
if (params.model === "MiniMax-M3" && params.thinking) {
|
|
72030
|
+
return { ...params, thinking: { type: params.thinking.type === "disabled" ? "disabled" : "adaptive" } };
|
|
72031
|
+
}
|
|
71945
72032
|
return params;
|
|
71946
72033
|
}
|
|
71947
72034
|
function normalizeToolCallId(id) {
|
|
@@ -72248,6 +72335,7 @@ var init_anthropic = __esm({
|
|
|
72248
72335
|
if (nextParams !== void 0) {
|
|
72249
72336
|
params = nextParams;
|
|
72250
72337
|
}
|
|
72338
|
+
params = normalizeMiniMaxParams(model, params, options);
|
|
72251
72339
|
const requestOptions = {
|
|
72252
72340
|
...options?.signal ? { signal: options.signal } : {},
|
|
72253
72341
|
...options?.timeoutMs !== void 0 ? { timeout: options.timeoutMs } : {},
|
|
@@ -94349,7 +94437,7 @@ var require_websocket = __commonJS({
|
|
|
94349
94437
|
var http3 = __require("http");
|
|
94350
94438
|
var net = __require("net");
|
|
94351
94439
|
var tls = __require("tls");
|
|
94352
|
-
var { randomBytes: randomBytes3, createHash:
|
|
94440
|
+
var { randomBytes: randomBytes3, createHash: createHash30 } = __require("crypto");
|
|
94353
94441
|
var { Duplex, Readable: Readable3 } = __require("stream");
|
|
94354
94442
|
var { URL: URL2 } = __require("url");
|
|
94355
94443
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
@@ -95017,7 +95105,7 @@ var require_websocket = __commonJS({
|
|
|
95017
95105
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
95018
95106
|
return;
|
|
95019
95107
|
}
|
|
95020
|
-
const digest2 =
|
|
95108
|
+
const digest2 = createHash30("sha1").update(key + GUID).digest("base64");
|
|
95021
95109
|
if (res.headers["sec-websocket-accept"] !== digest2) {
|
|
95022
95110
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
95023
95111
|
return;
|
|
@@ -95389,7 +95477,7 @@ var require_websocket_server = __commonJS({
|
|
|
95389
95477
|
var EventEmitter2 = __require("events");
|
|
95390
95478
|
var http3 = __require("http");
|
|
95391
95479
|
var { Duplex } = __require("stream");
|
|
95392
|
-
var { createHash:
|
|
95480
|
+
var { createHash: createHash30 } = __require("crypto");
|
|
95393
95481
|
var extension3 = require_extension();
|
|
95394
95482
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
95395
95483
|
var subprotocol2 = require_subprotocol();
|
|
@@ -95696,7 +95784,7 @@ var require_websocket_server = __commonJS({
|
|
|
95696
95784
|
);
|
|
95697
95785
|
}
|
|
95698
95786
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
95699
|
-
const digest2 =
|
|
95787
|
+
const digest2 = createHash30("sha1").update(key + GUID).digest("base64");
|
|
95700
95788
|
const headers = [
|
|
95701
95789
|
"HTTP/1.1 101 Switching Protocols",
|
|
95702
95790
|
"Upgrade: websocket",
|
|
@@ -170881,6 +170969,18 @@ var init_openai_completions = __esm({
|
|
|
170881
170969
|
if (nextParams !== void 0) {
|
|
170882
170970
|
params = nextParams;
|
|
170883
170971
|
}
|
|
170972
|
+
if (model.provider === "openrouter" && new URL(model.baseUrl).hostname === "openrouter.ai" && params.model === "minimax/minimax-m3.1-flash:free") {
|
|
170973
|
+
const flash = params;
|
|
170974
|
+
const effort = flash.reasoning?.effort ?? "max";
|
|
170975
|
+
flash.reasoning = {
|
|
170976
|
+
...flash.reasoning,
|
|
170977
|
+
enabled: true,
|
|
170978
|
+
effort: ["low", "medium", "high", "xhigh", "max"].includes(effort) ? effort : "max"
|
|
170979
|
+
};
|
|
170980
|
+
delete flash.reasoning_effort;
|
|
170981
|
+
delete flash.reasoning_split;
|
|
170982
|
+
delete flash.service_tier;
|
|
170983
|
+
}
|
|
170884
170984
|
const requestOptions = {
|
|
170885
170985
|
...options?.signal ? { signal: options.signal } : {},
|
|
170886
170986
|
...options?.timeoutMs !== void 0 ? { timeout: options.timeoutMs } : {},
|
|
@@ -187700,6 +187800,7 @@ __export(orama_store_exports, {
|
|
|
187700
187800
|
getActiveSemanticIndexProfile: () => getActiveSemanticIndexProfile,
|
|
187701
187801
|
getDb: () => getDb,
|
|
187702
187802
|
getDeferredCachedVectorHydration: () => getDeferredCachedVectorHydration,
|
|
187803
|
+
getLastSearchDiagnostics: () => getLastSearchDiagnostics,
|
|
187703
187804
|
getLastSearchMode: () => getLastSearchMode,
|
|
187704
187805
|
getObservationCount: () => getObservationCount2,
|
|
187705
187806
|
getObservationsByIds: () => getObservationsByIds,
|
|
@@ -187728,6 +187829,18 @@ function rememberSearchMode(key, value) {
|
|
|
187728
187829
|
function getLastSearchMode(projectId) {
|
|
187729
187830
|
return lastSearchModeByProject.get(projectId ?? SEARCH_MODE_DEFAULT_KEY) ?? "fulltext";
|
|
187730
187831
|
}
|
|
187832
|
+
function getLastSearchDiagnostics(projectId) {
|
|
187833
|
+
const diagnostics = lastSearchDiagnosticsByProject.get(projectId ?? SEARCH_MODE_DEFAULT_KEY);
|
|
187834
|
+
return diagnostics ? { ...diagnostics } : void 0;
|
|
187835
|
+
}
|
|
187836
|
+
function rememberSearchDiagnostics(key, value) {
|
|
187837
|
+
if (!lastSearchDiagnosticsByProject.has(key) && lastSearchDiagnosticsByProject.size >= MAX_SEARCH_MODE_KEYS) {
|
|
187838
|
+
const oldest = lastSearchDiagnosticsByProject.keys().next().value;
|
|
187839
|
+
if (oldest !== void 0) lastSearchDiagnosticsByProject.delete(oldest);
|
|
187840
|
+
}
|
|
187841
|
+
lastSearchDiagnosticsByProject.delete(key);
|
|
187842
|
+
lastSearchDiagnosticsByProject.set(key, value);
|
|
187843
|
+
}
|
|
187731
187844
|
function getOptionalObservationStore() {
|
|
187732
187845
|
try {
|
|
187733
187846
|
return getObservationStore();
|
|
@@ -188010,6 +188123,7 @@ async function resetDb() {
|
|
|
188010
188123
|
indexEmbeddingProvider = null;
|
|
188011
188124
|
deferredCachedVectorHydration = null;
|
|
188012
188125
|
lastSearchModeByProject.clear();
|
|
188126
|
+
lastSearchDiagnosticsByProject.clear();
|
|
188013
188127
|
}
|
|
188014
188128
|
function isEmbeddingEnabled() {
|
|
188015
188129
|
return embeddingEnabled;
|
|
@@ -188227,6 +188341,7 @@ async function removeObservation(oramaId) {
|
|
|
188227
188341
|
await remove4(database, oramaId);
|
|
188228
188342
|
}
|
|
188229
188343
|
async function searchObservations(options) {
|
|
188344
|
+
const searchStartedAt = Date.now();
|
|
188230
188345
|
const perf = !!process.env.MEMORIX_PERF;
|
|
188231
188346
|
const t0 = perf ? performance.now() : 0;
|
|
188232
188347
|
const mark = (label) => {
|
|
@@ -188302,6 +188417,8 @@ async function searchObservations(options) {
|
|
|
188302
188417
|
let queryVector = null;
|
|
188303
188418
|
let embeddingProviderForSearch = null;
|
|
188304
188419
|
let embeddingUnavailable = false;
|
|
188420
|
+
let fallbackUsed = false;
|
|
188421
|
+
let fallbackReason;
|
|
188305
188422
|
if (quality !== "fast" && embeddingEnabled && hasQuery && tier !== "fast") {
|
|
188306
188423
|
try {
|
|
188307
188424
|
const provider2 = await getEmbeddingProvider();
|
|
@@ -188310,6 +188427,8 @@ async function searchObservations(options) {
|
|
|
188310
188427
|
const activeVectorDimensions = getVectorDimensions();
|
|
188311
188428
|
if (activeVectorDimensions !== null && provider2.dimensions !== activeVectorDimensions) {
|
|
188312
188429
|
embeddingUnavailable = true;
|
|
188430
|
+
fallbackUsed = true;
|
|
188431
|
+
fallbackReason = "embedding dimension mismatch; lexical search used";
|
|
188313
188432
|
rememberSearchMode(
|
|
188314
188433
|
modeKey,
|
|
188315
188434
|
`fulltext (embedding dimension mismatch: provider ${provider2.dimensions}d vs index ${activeVectorDimensions}d)`
|
|
@@ -188351,9 +188470,13 @@ async function searchObservations(options) {
|
|
|
188351
188470
|
}
|
|
188352
188471
|
} else {
|
|
188353
188472
|
embeddingUnavailable = true;
|
|
188473
|
+
fallbackUsed = true;
|
|
188474
|
+
fallbackReason = "embedding provider unavailable; lexical search used";
|
|
188354
188475
|
}
|
|
188355
188476
|
} catch (error40) {
|
|
188356
188477
|
embeddingUnavailable = true;
|
|
188478
|
+
fallbackUsed = true;
|
|
188479
|
+
fallbackReason = "embedding failed or timed out; lexical search used";
|
|
188357
188480
|
rememberSearchMode(modeKey, "fulltext (embedding unavailable)");
|
|
188358
188481
|
console.error("[memorix] Embedding failed or timed out, falling back to fulltext search");
|
|
188359
188482
|
}
|
|
@@ -188403,6 +188526,8 @@ async function searchObservations(options) {
|
|
|
188403
188526
|
similarity: 0.25
|
|
188404
188527
|
};
|
|
188405
188528
|
rememberSearchMode(modeKey, "vector-only (hybrid empty fallback)");
|
|
188529
|
+
fallbackUsed = true;
|
|
188530
|
+
fallbackReason = "hybrid search returned no results; vector-only fallback used";
|
|
188406
188531
|
results = await search2(database, vectorOnlyParams);
|
|
188407
188532
|
} catch {
|
|
188408
188533
|
}
|
|
@@ -188676,6 +188801,7 @@ async function searchObservations(options) {
|
|
|
188676
188801
|
mark(`rerank(skipped,tier=${tier})`);
|
|
188677
188802
|
}
|
|
188678
188803
|
let entries = intermediate.map(({ rawTime: _5, _isCommandLog: _c, ...rest }) => rest);
|
|
188804
|
+
const candidateCount = entries.length;
|
|
188679
188805
|
for (const hit of results.hits) {
|
|
188680
188806
|
const doc = hit.document;
|
|
188681
188807
|
if (canReadObservation(doc, options.reader, projectIds ?? void 0)) rememberObservationDoc(doc);
|
|
@@ -188718,9 +188844,22 @@ async function searchObservations(options) {
|
|
|
188718
188844
|
}
|
|
188719
188845
|
}
|
|
188720
188846
|
}
|
|
188847
|
+
const beforeTokenBudget = entries.length;
|
|
188721
188848
|
if (options.maxTokens && options.maxTokens > 0) {
|
|
188722
188849
|
entries = applyTokenBudget(entries, options.maxTokens);
|
|
188723
188850
|
}
|
|
188851
|
+
rememberSearchDiagnostics(modeKey, {
|
|
188852
|
+
version: "1",
|
|
188853
|
+
mode: getLastSearchMode(options.projectId),
|
|
188854
|
+
rawCandidateCount: results.hits.length,
|
|
188855
|
+
candidateCount,
|
|
188856
|
+
selectedCount: entries.length,
|
|
188857
|
+
omittedCount: Math.max(0, candidateCount - entries.length),
|
|
188858
|
+
omittedByTokenBudget: Math.max(0, beforeTokenBudget - entries.length),
|
|
188859
|
+
fallbackUsed,
|
|
188860
|
+
...fallbackReason ? { fallbackReason } : {},
|
|
188861
|
+
elapsedMs: Math.max(0, Date.now() - searchStartedAt)
|
|
188862
|
+
});
|
|
188724
188863
|
if (options.trackAccess !== false) {
|
|
188725
188864
|
const returnedKeys = new Set(entries.map((entry) => makeEntryKey(entry.projectId, entry.id)));
|
|
188726
188865
|
const hitDocs = results.hits.map((hit) => ({ id: hit.id, doc: hit.document })).filter(({ doc }) => returnedKeys.has(makeEntryKey(doc.projectId, doc.observationId)));
|
|
@@ -188836,7 +188975,7 @@ function formatTime(isoDate) {
|
|
|
188836
188975
|
return isoDate;
|
|
188837
188976
|
}
|
|
188838
188977
|
}
|
|
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;
|
|
188978
|
+
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
188979
|
var init_orama_store = __esm({
|
|
188841
188980
|
"src/store/orama-store.ts"() {
|
|
188842
188981
|
"use strict";
|
|
@@ -188863,6 +189002,7 @@ var init_orama_store = __esm({
|
|
|
188863
189002
|
NON_CJK_HYBRID_SIMILARITY = 0.45;
|
|
188864
189003
|
CJK_RUN = /[\u3400-\u4dbf\u4e00-\u9fff\u3040-\u30ff\uac00-\ud7af]+/gu;
|
|
188865
189004
|
lastSearchModeByProject = /* @__PURE__ */ new Map();
|
|
189005
|
+
lastSearchDiagnosticsByProject = /* @__PURE__ */ new Map();
|
|
188866
189006
|
SEARCH_MODE_DEFAULT_KEY = "__global__";
|
|
188867
189007
|
MAX_SEARCH_MODE_KEYS = 4096;
|
|
188868
189008
|
COMMAND_LOG_TITLE2 = /^(Ran:|Command:|Executed:)\s/i;
|
|
@@ -189240,6 +189380,7 @@ function normalizeMemoryBrowseQuery(query) {
|
|
|
189240
189380
|
return broadMemoryRequests.has(compact) ? "" : query;
|
|
189241
189381
|
}
|
|
189242
189382
|
async function compactSearch(options, surface = "mcp") {
|
|
189383
|
+
const startedAt = Date.now();
|
|
189243
189384
|
await ensureFreshIndex({ loadCorpus: false });
|
|
189244
189385
|
const searchOptions = { ...options, query: normalizeMemoryBrowseQuery(options.query) };
|
|
189245
189386
|
let entries = (await searchObservations(searchOptions)).map(
|
|
@@ -189293,7 +189434,25 @@ This project does have stored Memorix memories, but none matched the current que
|
|
|
189293
189434
|
}
|
|
189294
189435
|
}
|
|
189295
189436
|
const totalTokens = countTextTokens(formatted);
|
|
189296
|
-
|
|
189437
|
+
const diagnostics = getLastSearchDiagnostics(options.projectId);
|
|
189438
|
+
return {
|
|
189439
|
+
entries,
|
|
189440
|
+
formatted,
|
|
189441
|
+
totalTokens,
|
|
189442
|
+
receipt: {
|
|
189443
|
+
version: "1",
|
|
189444
|
+
mode: getLastSearchMode(options.projectId),
|
|
189445
|
+
resultCount: entries.length,
|
|
189446
|
+
candidateCount: diagnostics?.candidateCount ?? entries.length,
|
|
189447
|
+
selectedCount: diagnostics?.selectedCount ?? entries.length,
|
|
189448
|
+
omittedCount: diagnostics?.omittedCount ?? 0,
|
|
189449
|
+
omittedByTokenBudget: diagnostics?.omittedByTokenBudget ?? 0,
|
|
189450
|
+
fallbackUsed: diagnostics?.fallbackUsed ?? false,
|
|
189451
|
+
...diagnostics?.fallbackReason ? { fallbackReason: diagnostics.fallbackReason } : {},
|
|
189452
|
+
tokenCount: totalTokens,
|
|
189453
|
+
elapsedMs: Math.max(0, Date.now() - startedAt)
|
|
189454
|
+
}
|
|
189455
|
+
};
|
|
189297
189456
|
}
|
|
189298
189457
|
async function compactTimeline(anchorId, projectId, depthBefore = 3, depthAfter = 3, reader2, surface = "mcp") {
|
|
189299
189458
|
const result = await getTimeline(anchorId, projectId, depthBefore, depthAfter, reader2);
|
|
@@ -192611,7 +192770,7 @@ var init_memory3 = __esm({
|
|
|
192611
192770
|
const limit2 = parsePositiveInt(args.limit, 10);
|
|
192612
192771
|
const quality = coerceRetrievalQuality(args.quality);
|
|
192613
192772
|
const result = await compactSearch({ query, limit: limit2, quality, projectId: project.id, reader: reader2 }, "cli");
|
|
192614
|
-
emitResult({ project, entries: result.entries }, result.formatted, asJson);
|
|
192773
|
+
emitResult({ project, entries: result.entries, retrieval: result.receipt }, result.formatted, asJson);
|
|
192615
192774
|
return;
|
|
192616
192775
|
}
|
|
192617
192776
|
case "graph-context": {
|
|
@@ -194672,8 +194831,75 @@ var init_grok = __esm({
|
|
|
194672
194831
|
});
|
|
194673
194832
|
|
|
194674
194833
|
// src/integrations/registry.ts
|
|
194834
|
+
function packageRoot(agent) {
|
|
194835
|
+
return agent === "gemini-cli" ? "plugins/gemini/memorix" : `plugins/${agent}/memorix`;
|
|
194836
|
+
}
|
|
194837
|
+
function capabilityManifest(entry) {
|
|
194838
|
+
const lowerSurfaces = entry.surfaces.map((surface) => surface.toLowerCase());
|
|
194839
|
+
const hasMcp = entry.agent === "grok" || lowerSurfaces.some((surface) => surface.includes("mcp"));
|
|
194840
|
+
const hasHooks = lowerSurfaces.some((surface) => surface.includes("hook"));
|
|
194841
|
+
const hasRules = lowerSurfaces.some((surface) => surface.includes("rule") || surface.includes("steering") || surface.includes("guidance"));
|
|
194842
|
+
const hasSkills = lowerSurfaces.some((surface) => surface.includes("skill"));
|
|
194843
|
+
const hasGuidance = hasRules || lowerSurfaces.some((surface) => surface.includes("agents.md") || surface.includes("context") || surface.includes("gemini"));
|
|
194844
|
+
const supported = hasMcp ? entry.agent === "grok" ? ["http"] : ["stdio", "http"] : [];
|
|
194845
|
+
const defaultTransport = entry.agent === "grok" ? "host-owned" : supported.includes("stdio") ? "stdio" : "none";
|
|
194846
|
+
const generatedBy = [
|
|
194847
|
+
"src/integrations/registry.ts",
|
|
194848
|
+
...hasMcp ? ["src/workspace/mcp-adapters/" + entry.agent + ".ts"] : [],
|
|
194849
|
+
...hasHooks || hasRules || hasSkills ? ["src/hooks/installers/index.ts"] : [],
|
|
194850
|
+
...entry.agent !== "any-mcp" && entry.agent !== "memcode" ? ["src/cli/commands/setup.ts"] : []
|
|
194851
|
+
];
|
|
194852
|
+
const packageFiles = PACKAGE_ENTRIES.has(entry.entry) ? [packageRoot(entry.agent)] : [];
|
|
194853
|
+
const hookFiles = hasHooks ? [entry.agent === "qwen" ? ".qwen/settings.json" : "host hook configuration"] : [];
|
|
194854
|
+
const ruleFiles = hasRules ? ["host rules or steering file"] : [];
|
|
194855
|
+
const skillFiles = hasSkills ? ["official Memorix skills"] : [];
|
|
194856
|
+
const guidanceFiles = hasGuidance ? ["host guidance file"] : [];
|
|
194857
|
+
return {
|
|
194858
|
+
schemaVersion: "1",
|
|
194859
|
+
agent: entry.agent,
|
|
194860
|
+
name: entry.name,
|
|
194861
|
+
transport: {
|
|
194862
|
+
supported,
|
|
194863
|
+
default: defaultTransport,
|
|
194864
|
+
...defaultTransport === "stdio" ? { command: "memorix serve" } : {}
|
|
194865
|
+
},
|
|
194866
|
+
artifacts: { packageFiles, hookFiles, ruleFiles, skillFiles, guidanceFiles },
|
|
194867
|
+
hooks: { supported: hasHooks, events: hasHooks ? [...DEFAULT_HOOK_EVENTS] : [] },
|
|
194868
|
+
scopes: ["project", "global"],
|
|
194869
|
+
lifecycle: {
|
|
194870
|
+
install: true,
|
|
194871
|
+
repair: entry.setup !== false,
|
|
194872
|
+
doctor: entry.setup !== false,
|
|
194873
|
+
uninstall: true
|
|
194874
|
+
},
|
|
194875
|
+
hostCompatibility: {
|
|
194876
|
+
range: entry.agent === "memcode" ? "Memorix runtime" : "unknown",
|
|
194877
|
+
verified: entry.agent === "memcode"
|
|
194878
|
+
},
|
|
194879
|
+
requirements: {
|
|
194880
|
+
projectRoot: entry.agent !== "any-mcp",
|
|
194881
|
+
http: supported.includes("http"),
|
|
194882
|
+
stdio: supported.includes("stdio"),
|
|
194883
|
+
credential: false
|
|
194884
|
+
},
|
|
194885
|
+
source: {
|
|
194886
|
+
registry: "src/integrations/registry.ts",
|
|
194887
|
+
generatedBy,
|
|
194888
|
+
documentation: ["docs/INTEGRATIONS.md", "docs/API_REFERENCE.md"]
|
|
194889
|
+
}
|
|
194890
|
+
};
|
|
194891
|
+
}
|
|
194892
|
+
function isAgentEntry(item) {
|
|
194893
|
+
return item.agent !== "memcode" && item.agent !== "any-mcp";
|
|
194894
|
+
}
|
|
194895
|
+
function getAgentIntegrationEntries() {
|
|
194896
|
+
return MEMORIX_INTEGRATIONS.filter(isAgentEntry);
|
|
194897
|
+
}
|
|
194898
|
+
function getSetupAgentTargets() {
|
|
194899
|
+
return MEMORIX_INTEGRATIONS.filter((item) => isAgentEntry(item) && item.status === "ready" && item.setup !== false).map((item) => item.agent);
|
|
194900
|
+
}
|
|
194675
194901
|
function getSetupIntegrationRows() {
|
|
194676
|
-
return MEMORIX_INTEGRATIONS.filter((item) => item
|
|
194902
|
+
return MEMORIX_INTEGRATIONS.filter((item) => isAgentEntry(item) && item.status === "ready" && item.setup !== false).map((item) => ({
|
|
194677
194903
|
agent: item.agent,
|
|
194678
194904
|
name: item.name,
|
|
194679
194905
|
entry: item.entry,
|
|
@@ -194682,12 +194908,12 @@ function getSetupIntegrationRows() {
|
|
|
194682
194908
|
surfaces: item.surfaces.join(", ")
|
|
194683
194909
|
}));
|
|
194684
194910
|
}
|
|
194685
|
-
var MEMORIX_INTEGRATIONS;
|
|
194911
|
+
var integrationEntries, PACKAGE_ENTRIES, DEFAULT_HOOK_EVENTS, MEMORIX_INTEGRATIONS;
|
|
194686
194912
|
var init_registry2 = __esm({
|
|
194687
194913
|
"src/integrations/registry.ts"() {
|
|
194688
194914
|
"use strict";
|
|
194689
194915
|
init_esm_shims();
|
|
194690
|
-
|
|
194916
|
+
integrationEntries = [
|
|
194691
194917
|
{
|
|
194692
194918
|
agent: "claude",
|
|
194693
194919
|
name: "Claude Code",
|
|
@@ -194730,6 +194956,16 @@ var init_registry2 = __esm({
|
|
|
194730
194956
|
surfaces: ["hooks", "AGENTS.md"],
|
|
194731
194957
|
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
194958
|
},
|
|
194959
|
+
{
|
|
194960
|
+
agent: "qwen",
|
|
194961
|
+
name: "Qwen Code",
|
|
194962
|
+
entry: "official-config",
|
|
194963
|
+
status: "ready",
|
|
194964
|
+
setup: false,
|
|
194965
|
+
install: "memorix hooks install --agent qwen",
|
|
194966
|
+
surfaces: ["hooks", "QWEN.md guidance"],
|
|
194967
|
+
note: "Qwen uses the hook installer lane; it is intentionally excluded from the full setup command until a native MCP/package lane exists."
|
|
194968
|
+
},
|
|
194733
194969
|
{
|
|
194734
194970
|
agent: "cursor",
|
|
194735
194971
|
name: "Cursor",
|
|
@@ -194858,6 +195094,18 @@ var init_registry2 = __esm({
|
|
|
194858
195094
|
surfaces: ["MCP stdio"]
|
|
194859
195095
|
}
|
|
194860
195096
|
];
|
|
195097
|
+
PACKAGE_ENTRIES = /* @__PURE__ */ new Set([
|
|
195098
|
+
"official-plugin",
|
|
195099
|
+
"official-extension",
|
|
195100
|
+
"official-package",
|
|
195101
|
+
"official-bundle",
|
|
195102
|
+
"local-plugin"
|
|
195103
|
+
]);
|
|
195104
|
+
DEFAULT_HOOK_EVENTS = ["session_start", "user_prompt", "post_tool", "pre_compact", "session_end"];
|
|
195105
|
+
MEMORIX_INTEGRATIONS = integrationEntries.map((entry) => ({
|
|
195106
|
+
...entry,
|
|
195107
|
+
capabilities: capabilityManifest(entry)
|
|
195108
|
+
}));
|
|
194861
195109
|
}
|
|
194862
195110
|
});
|
|
194863
195111
|
|
|
@@ -196913,7 +197161,7 @@ __export(setup_exports, {
|
|
|
196913
197161
|
buildSetupPlan: () => buildSetupPlan,
|
|
196914
197162
|
default: () => setup_default,
|
|
196915
197163
|
getMcpAdapter: () => getMcpAdapter,
|
|
196916
|
-
getSetupAgentTargets: () =>
|
|
197164
|
+
getSetupAgentTargets: () => getSetupAgentTargets2,
|
|
196917
197165
|
getSetupIntegrationRows: () => getSetupIntegrationRows2,
|
|
196918
197166
|
installAgentSetup: () => installAgentSetup,
|
|
196919
197167
|
installAntigravityPluginPackage: () => installAntigravityPluginPackage,
|
|
@@ -196937,7 +197185,7 @@ import { copyFile as copyFile2, mkdir as mkdir6, readFile as readFile6, readdir
|
|
|
196937
197185
|
import { homedir as homedir28 } from "os";
|
|
196938
197186
|
import path32 from "path";
|
|
196939
197187
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
196940
|
-
function
|
|
197188
|
+
function getSetupAgentTargets2() {
|
|
196941
197189
|
return [...SUPPORTED_SETUP_AGENTS];
|
|
196942
197190
|
}
|
|
196943
197191
|
function buildSetupPlan(options) {
|
|
@@ -197509,8 +197757,8 @@ async function stripCodeBuddyHookCapture(pluginPath) {
|
|
|
197509
197757
|
}
|
|
197510
197758
|
async function installCodeBuddyPluginPackage(options = {}) {
|
|
197511
197759
|
const home = options.homeDir ?? homedir28();
|
|
197512
|
-
const
|
|
197513
|
-
const source = path32.join(
|
|
197760
|
+
const packageRoot2 = findPackageRoot();
|
|
197761
|
+
const source = path32.join(packageRoot2, "plugins", "codebuddy", "memorix");
|
|
197514
197762
|
if (!existsSync17(source)) throw new Error(`CodeBuddy plugin template not found: ${source}`);
|
|
197515
197763
|
const marketplaceRoot = path32.join(home, ".codebuddy", "memorix-local");
|
|
197516
197764
|
const marketplacePath = path32.join(marketplaceRoot, ".codebuddy-plugin", "marketplace.json");
|
|
@@ -197529,8 +197777,8 @@ async function installCodeBuddyPluginPackage(options = {}) {
|
|
|
197529
197777
|
}
|
|
197530
197778
|
async function installPluginPackage(options) {
|
|
197531
197779
|
const home = options.homeDir ?? homedir28();
|
|
197532
|
-
const
|
|
197533
|
-
const source = path32.join(
|
|
197780
|
+
const packageRoot2 = findPackageRoot();
|
|
197781
|
+
const source = path32.join(packageRoot2, "plugins", options.agent, "memorix");
|
|
197534
197782
|
const includeHooks = options.includeHooks ?? true;
|
|
197535
197783
|
if (!existsSync17(source)) {
|
|
197536
197784
|
throw new Error(`Plugin package template not found: ${source}`);
|
|
@@ -197578,8 +197826,8 @@ async function installPluginPackage(options) {
|
|
|
197578
197826
|
}
|
|
197579
197827
|
async function installGeminiExtensionPackage(options = {}) {
|
|
197580
197828
|
const home = options.homeDir ?? homedir28();
|
|
197581
|
-
const
|
|
197582
|
-
const source = path32.join(
|
|
197829
|
+
const packageRoot2 = findPackageRoot();
|
|
197830
|
+
const source = path32.join(packageRoot2, "plugins", "gemini", "memorix");
|
|
197583
197831
|
if (!existsSync17(source)) {
|
|
197584
197832
|
throw new Error(`Gemini extension template not found: ${source}`);
|
|
197585
197833
|
}
|
|
@@ -197592,8 +197840,8 @@ async function installGeminiExtensionPackage(options = {}) {
|
|
|
197592
197840
|
};
|
|
197593
197841
|
}
|
|
197594
197842
|
async function installAntigravityPluginPackage(options = {}) {
|
|
197595
|
-
const
|
|
197596
|
-
const source = path32.join(
|
|
197843
|
+
const packageRoot2 = findPackageRoot();
|
|
197844
|
+
const source = path32.join(packageRoot2, "plugins", "antigravity", "memorix");
|
|
197597
197845
|
if (!existsSync17(source)) {
|
|
197598
197846
|
throw new Error(`Antigravity plugin template not found: ${source}`);
|
|
197599
197847
|
}
|
|
@@ -197610,8 +197858,8 @@ async function installAntigravityPluginPackage(options = {}) {
|
|
|
197610
197858
|
};
|
|
197611
197859
|
}
|
|
197612
197860
|
async function installPiPackage(options = {}) {
|
|
197613
|
-
const
|
|
197614
|
-
const source = path32.join(
|
|
197861
|
+
const packageRoot2 = findPackageRoot();
|
|
197862
|
+
const source = path32.join(packageRoot2, "plugins", "pi", "memorix");
|
|
197615
197863
|
if (!existsSync17(source)) {
|
|
197616
197864
|
throw new Error(`Pi package template not found: ${source}`);
|
|
197617
197865
|
}
|
|
@@ -197628,8 +197876,8 @@ async function installPiPackage(options = {}) {
|
|
|
197628
197876
|
}
|
|
197629
197877
|
async function installOpenClawBundlePackage(options = {}) {
|
|
197630
197878
|
const home = options.homeDir ?? homedir28();
|
|
197631
|
-
const
|
|
197632
|
-
const source = path32.join(
|
|
197879
|
+
const packageRoot2 = findPackageRoot();
|
|
197880
|
+
const source = path32.join(packageRoot2, "plugins", "openclaw", "memorix");
|
|
197633
197881
|
if (!existsSync17(source)) {
|
|
197634
197882
|
throw new Error(`OpenClaw bundle template not found: ${source}`);
|
|
197635
197883
|
}
|
|
@@ -197644,8 +197892,8 @@ async function installOpenClawBundlePackage(options = {}) {
|
|
|
197644
197892
|
};
|
|
197645
197893
|
}
|
|
197646
197894
|
async function installHermesPluginPackage(options = {}) {
|
|
197647
|
-
const
|
|
197648
|
-
const source = path32.join(
|
|
197895
|
+
const packageRoot2 = findPackageRoot();
|
|
197896
|
+
const source = path32.join(packageRoot2, "plugins", "hermes", "memorix");
|
|
197649
197897
|
if (!existsSync17(source)) {
|
|
197650
197898
|
throw new Error(`Hermes plugin template not found: ${source}`);
|
|
197651
197899
|
}
|
|
@@ -197671,8 +197919,8 @@ async function installHermesPluginPackage(options = {}) {
|
|
|
197671
197919
|
};
|
|
197672
197920
|
}
|
|
197673
197921
|
async function installOmpPackage(options = {}) {
|
|
197674
|
-
const
|
|
197675
|
-
const source = path32.join(
|
|
197922
|
+
const packageRoot2 = findPackageRoot();
|
|
197923
|
+
const source = path32.join(packageRoot2, "plugins", "omp", "memorix");
|
|
197676
197924
|
if (!existsSync17(source)) {
|
|
197677
197925
|
throw new Error(`Oh-my-Pi package template not found: ${source}`);
|
|
197678
197926
|
}
|
|
@@ -198201,26 +198449,7 @@ var init_setup = __esm({
|
|
|
198201
198449
|
OMP_PACKAGE_AGENTS = /* @__PURE__ */ new Set(["omp"]);
|
|
198202
198450
|
CODEBUDDY_PLUGIN_AGENTS = /* @__PURE__ */ new Set(["codebuddy"]);
|
|
198203
198451
|
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
|
-
];
|
|
198452
|
+
SUPPORTED_SETUP_AGENTS = getSetupAgentTargets();
|
|
198224
198453
|
getSetupIntegrationRows2 = getSetupIntegrationRows;
|
|
198225
198454
|
MEMORIX_HTTP_MCP_URL = "http://localhost:3211/mcp";
|
|
198226
198455
|
setup_default = defineCommand({
|
|
@@ -198806,7 +199035,7 @@ function appendLine(lines, candidate2, maxTokens, omitted, omittedKind, selected
|
|
|
198806
199035
|
if (receiptSelection) selected?.push(receiptSelection);
|
|
198807
199036
|
return true;
|
|
198808
199037
|
}
|
|
198809
|
-
omitted.push(omittedKind);
|
|
199038
|
+
omitted.push(receiptSelection?.id ? `${omittedKind}|${receiptSelection.id}` : omittedKind);
|
|
198810
199039
|
return false;
|
|
198811
199040
|
}
|
|
198812
199041
|
function freshnessForMemory(status) {
|
|
@@ -198832,15 +199061,23 @@ function receiptOmissionKind(raw) {
|
|
|
198832
199061
|
}
|
|
198833
199062
|
function receiptOmissions(omitted, hiddenCautionMemoryCount) {
|
|
198834
199063
|
const counts = /* @__PURE__ */ new Map();
|
|
199064
|
+
const samples = /* @__PURE__ */ new Map();
|
|
198835
199065
|
for (const raw of omitted) {
|
|
198836
|
-
const
|
|
199066
|
+
const [omittedKind, sampleId] = raw.split("|", 2);
|
|
199067
|
+
const kind = receiptOmissionKind(omittedKind);
|
|
198837
199068
|
if (!kind || raw.endsWith("-heading")) continue;
|
|
198838
199069
|
counts.set(kind, (counts.get(kind) ?? 0) + 1);
|
|
199070
|
+
if (sampleId) {
|
|
199071
|
+
const values = samples.get(kind) ?? [];
|
|
199072
|
+
if (!values.includes(sampleId) && values.length < 3) values.push(sampleId);
|
|
199073
|
+
samples.set(kind, values);
|
|
199074
|
+
}
|
|
198839
199075
|
}
|
|
198840
199076
|
const receipt = [...counts.entries()].map(([kind, count3]) => ({
|
|
198841
199077
|
kind,
|
|
198842
199078
|
reason: "token-budget",
|
|
198843
|
-
count: count3
|
|
199079
|
+
count: count3,
|
|
199080
|
+
...samples.get(kind)?.length ? { sampleIds: samples.get(kind) } : {}
|
|
198844
199081
|
}));
|
|
198845
199082
|
if (hiddenCautionMemoryCount > 0) {
|
|
198846
199083
|
receipt.push({
|
|
@@ -199549,6 +199786,16 @@ async function buildTaskWorkset(input) {
|
|
|
199549
199786
|
...base,
|
|
199550
199787
|
budget: { maxTokens }
|
|
199551
199788
|
});
|
|
199789
|
+
const omittedReceipt = receiptOmissions(rendered.omittedItems, base.hiddenCautionMemoryCount);
|
|
199790
|
+
const retrieval = {
|
|
199791
|
+
mode: input.retrieval?.mode ?? (input.semanticCode ? "hybrid" : "unknown"),
|
|
199792
|
+
...input.retrieval?.codeProvider || input.providerQuality?.selected ? { codeProvider: input.retrieval?.codeProvider ?? input.providerQuality?.selected } : {},
|
|
199793
|
+
fallbackUsed: Boolean(input.retrieval?.fallbackReason),
|
|
199794
|
+
...input.retrieval?.fallbackReason ? { fallbackReason: input.retrieval.fallbackReason } : {},
|
|
199795
|
+
candidateCount: governed.plan.decisions.length,
|
|
199796
|
+
selectedCount: rendered.selected.length,
|
|
199797
|
+
omittedCount: omittedReceipt.reduce((total, omission) => total + omission.count, 0)
|
|
199798
|
+
};
|
|
199552
199799
|
const receipt = {
|
|
199553
199800
|
version: "1.3",
|
|
199554
199801
|
target: input.deliveryTarget ?? "project-context",
|
|
@@ -199557,8 +199804,9 @@ async function buildTaskWorkset(input) {
|
|
|
199557
199804
|
maxTokens,
|
|
199558
199805
|
tokenCount: rendered.tokenCount
|
|
199559
199806
|
},
|
|
199807
|
+
retrieval,
|
|
199560
199808
|
selected: rendered.selected,
|
|
199561
|
-
omitted:
|
|
199809
|
+
omitted: omittedReceipt,
|
|
199562
199810
|
governance: {
|
|
199563
199811
|
scope: "optional-evidence",
|
|
199564
199812
|
mode: governed.plan.mode,
|
|
@@ -199566,7 +199814,12 @@ async function buildTaskWorkset(input) {
|
|
|
199566
199814
|
kind: decision.candidate.kind,
|
|
199567
199815
|
...decision.candidate.id ? { id: decision.candidate.id } : {},
|
|
199568
199816
|
disposition: decision.disposition,
|
|
199569
|
-
reasons: decision.reasons
|
|
199817
|
+
reasons: decision.reasons,
|
|
199818
|
+
...decision.candidate.freshness ? { freshness: decision.candidate.freshness } : {},
|
|
199819
|
+
...decision.candidate.trust ? { trust: decision.candidate.trust } : {},
|
|
199820
|
+
...decision.candidate.quality ? { quality: decision.candidate.quality } : {},
|
|
199821
|
+
...decision.candidate.conflict ? { conflict: decision.candidate.conflict } : {},
|
|
199822
|
+
...decision.candidate.evidenceCount !== void 0 ? { evidenceCount: decision.candidate.evidenceCount } : {}
|
|
199570
199823
|
})),
|
|
199571
199824
|
cautions: governed.plan.cautions
|
|
199572
199825
|
},
|
|
@@ -202798,6 +203051,11 @@ async function buildAutoProjectContext(input) {
|
|
|
202798
203051
|
...alwaysOn.profile.length > 0 || alwaysOn.state || alwaysOn.durable.length > 0 ? { alwaysOn } : {},
|
|
202799
203052
|
...semanticOutline ? { semanticCode: semanticOutline } : {},
|
|
202800
203053
|
providerQuality: providerQuality2,
|
|
203054
|
+
retrieval: {
|
|
203055
|
+
mode: semanticOutline ? "hybrid" : "lexical",
|
|
203056
|
+
codeProvider: providerQuality2.selected,
|
|
203057
|
+
...externalCaution ? { fallbackReason: externalCaution } : {}
|
|
203058
|
+
},
|
|
202801
203059
|
currentFacts: worksetFactLines(currentFacts),
|
|
202802
203060
|
...continuation ? { continuation } : {},
|
|
202803
203061
|
...continuity ? { continuity } : {},
|
|
@@ -203385,8 +203643,12 @@ function formatContextReceipt(receipt) {
|
|
|
203385
203643
|
`- Target: ${displayTarget(receipt.target)}`,
|
|
203386
203644
|
`- Budget: ${receipt.budget.tokenCount}/${receipt.budget.maxTokens} tokens`,
|
|
203387
203645
|
`- Assembly: ${receipt.elapsedMs} ms`,
|
|
203388
|
-
`- Selected: ${receipt.selected.length} item(s)
|
|
203646
|
+
`- Selected: ${receipt.selected.length} item(s)`,
|
|
203647
|
+
`- Retrieval: ${receipt.retrieval.mode} (${receipt.retrieval.candidateCount} optional candidate(s))`
|
|
203389
203648
|
];
|
|
203649
|
+
if (receipt.retrieval.fallbackUsed) {
|
|
203650
|
+
lines.push(`- Fallback: ${receipt.retrieval.fallbackReason ?? "retrieval fallback used"}`);
|
|
203651
|
+
}
|
|
203390
203652
|
if (receipt.selected.length > 0) {
|
|
203391
203653
|
lines.push("", "Selected evidence");
|
|
203392
203654
|
for (const item of receipt.selected.slice(0, 20)) {
|
|
@@ -203398,14 +203660,17 @@ function formatContextReceipt(receipt) {
|
|
|
203398
203660
|
if (receipt.omitted.length > 0) {
|
|
203399
203661
|
lines.push("", "Withheld by budget");
|
|
203400
203662
|
for (const item of receipt.omitted) {
|
|
203401
|
-
|
|
203663
|
+
const samples = item.sampleIds?.length ? ` [${item.sampleIds.join(", ")}]` : "";
|
|
203664
|
+
lines.push(`- ${item.kind}: ${item.count} item(s) (${item.reason})${samples}`);
|
|
203402
203665
|
}
|
|
203403
203666
|
}
|
|
203404
203667
|
if (receipt.governance?.decisions.length) {
|
|
203405
203668
|
lines.push("", "Optional evidence qualification");
|
|
203406
203669
|
for (const item of receipt.governance.decisions.slice(0, 20)) {
|
|
203407
203670
|
const id = item.id ? ` ${item.id}` : "";
|
|
203408
|
-
|
|
203671
|
+
const qualifiers = [item.quality, item.freshness, item.trust, item.conflict].filter(Boolean).join(", ");
|
|
203672
|
+
const evidence = item.evidenceCount === void 0 ? "" : `, evidence=${item.evidenceCount}`;
|
|
203673
|
+
lines.push(`- ${item.kind}${id}: ${item.disposition} (${item.reasons.join(", ")}${qualifiers ? `; ${qualifiers}${evidence}` : evidence})`);
|
|
203409
203674
|
}
|
|
203410
203675
|
}
|
|
203411
203676
|
if (receipt.scheduledActions.length > 0) {
|
|
@@ -203651,6 +203916,10 @@ async function attachTaskWorkset(input) {
|
|
|
203651
203916
|
startHere: uniq2([...semanticStartHere, ...input.pack.suggestedReads]),
|
|
203652
203917
|
...semanticCode ? { semanticCode } : {},
|
|
203653
203918
|
...input.providerQuality ? { providerQuality: input.providerQuality } : {},
|
|
203919
|
+
retrieval: {
|
|
203920
|
+
mode: semanticCode ? "hybrid" : "unknown",
|
|
203921
|
+
...input.providerQuality?.selected ? { codeProvider: input.providerQuality.selected } : {}
|
|
203922
|
+
},
|
|
203654
203923
|
reliableMemory: input.pack.memories.filter((memory) => memory.status === "current").map((memory) => ({
|
|
203655
203924
|
id: memory.id,
|
|
203656
203925
|
title: memory.title,
|
|
@@ -209408,7 +209677,7 @@ var init_tool_profile = __esm({
|
|
|
209408
209677
|
function getMcpServerInfo() {
|
|
209409
209678
|
return {
|
|
209410
209679
|
name: "memorix",
|
|
209411
|
-
version: true ? "1.
|
|
209680
|
+
version: true ? "1.10.0" : "1.0.1"
|
|
209412
209681
|
};
|
|
209413
209682
|
}
|
|
209414
209683
|
function createMcpDiscoverResult(capabilities, serverInfo) {
|
|
@@ -224018,12 +224287,27 @@ __export(request_context_exports, {
|
|
|
224018
224287
|
ProjectBindingController: () => ProjectBindingController,
|
|
224019
224288
|
createProjectBindingController: () => createProjectBindingController
|
|
224020
224289
|
});
|
|
224290
|
+
import { createHash as createHash21 } from "crypto";
|
|
224021
224291
|
import path40 from "path";
|
|
224022
224292
|
function resolveRoot(projectRoot) {
|
|
224023
224293
|
const value = projectRoot.trim();
|
|
224024
224294
|
if (!value) throw new Error("Project binding requires a non-empty project root");
|
|
224025
224295
|
return path40.resolve(value);
|
|
224026
224296
|
}
|
|
224297
|
+
function hashBindingValue(value) {
|
|
224298
|
+
return `sha256:${createHash21("sha256").update(value).digest("hex")}`;
|
|
224299
|
+
}
|
|
224300
|
+
function remoteHost(remote) {
|
|
224301
|
+
const trimmed = remote.trim();
|
|
224302
|
+
if (!trimmed) return void 0;
|
|
224303
|
+
const scpHost = trimmed.match(/^[^@/\s]+@([^:\s/]+):/);
|
|
224304
|
+
if (scpHost) return scpHost[1].toLowerCase();
|
|
224305
|
+
try {
|
|
224306
|
+
return new URL(trimmed).hostname.toLowerCase() || void 0;
|
|
224307
|
+
} catch {
|
|
224308
|
+
return void 0;
|
|
224309
|
+
}
|
|
224310
|
+
}
|
|
224027
224311
|
function createProjectBindingController(projectRoot) {
|
|
224028
224312
|
return new ProjectBindingController(projectRoot);
|
|
224029
224313
|
}
|
|
@@ -224050,6 +224334,38 @@ var init_request_context = __esm({
|
|
|
224050
224334
|
...actorId ? { actorId } : {}
|
|
224051
224335
|
};
|
|
224052
224336
|
}
|
|
224337
|
+
/**
|
|
224338
|
+
* Return binding diagnostics without exposing local paths or transport IDs.
|
|
224339
|
+
* The hashes let operators compare two surfaces while keeping the receipt
|
|
224340
|
+
* safe to pass through MCP, logs, and agent handoffs.
|
|
224341
|
+
*/
|
|
224342
|
+
receipt(options = {}) {
|
|
224343
|
+
const snapshot = this.snapshot();
|
|
224344
|
+
const handle = options.handle;
|
|
224345
|
+
const handleState = !handle ? "absent" : handle.expiresAt && Date.parse(handle.expiresAt) <= Date.now() ? "expired" : "active";
|
|
224346
|
+
return {
|
|
224347
|
+
version: "1",
|
|
224348
|
+
state: snapshot.projectId ? "resolved" : "unresolved",
|
|
224349
|
+
source: snapshot.source,
|
|
224350
|
+
explicit: snapshot.explicit,
|
|
224351
|
+
...snapshot.projectId ? { projectId: snapshot.projectId } : {},
|
|
224352
|
+
projectRootHash: hashBindingValue(snapshot.projectRoot),
|
|
224353
|
+
...options.dataDir ? { dataDirHash: hashBindingValue(path40.resolve(options.dataDir)) } : {},
|
|
224354
|
+
gitRemote: options.gitRemote?.trim() ? {
|
|
224355
|
+
state: "verified",
|
|
224356
|
+
hash: hashBindingValue(options.gitRemote.trim()),
|
|
224357
|
+
...remoteHost(options.gitRemote) ? { host: remoteHost(options.gitRemote) } : {}
|
|
224358
|
+
} : { state: "unavailable" },
|
|
224359
|
+
handle: {
|
|
224360
|
+
state: handleState,
|
|
224361
|
+
...handle ? { idHash: hashBindingValue(handle.handleId) } : {},
|
|
224362
|
+
...handle?.createdAt ? { createdAt: handle.createdAt } : {},
|
|
224363
|
+
...handle?.lastUsedAt ? { lastUsedAt: handle.lastUsedAt } : {},
|
|
224364
|
+
...handle?.expiresAt ? { expiresAt: handle.expiresAt } : {}
|
|
224365
|
+
},
|
|
224366
|
+
transport: options.transport ?? "unknown"
|
|
224367
|
+
};
|
|
224368
|
+
}
|
|
224053
224369
|
isExplicit() {
|
|
224054
224370
|
return this.current.explicit;
|
|
224055
224371
|
}
|
|
@@ -266190,7 +266506,7 @@ __export(server_exports2, {
|
|
|
266190
266506
|
createMemorixServer: () => createMemorixServer,
|
|
266191
266507
|
shouldAwaitProjectRuntime: () => shouldAwaitProjectRuntime
|
|
266192
266508
|
});
|
|
266193
|
-
import { createHash as
|
|
266509
|
+
import { createHash as createHash22 } from "crypto";
|
|
266194
266510
|
function formatFormationStageDurations(stageDurationsMs) {
|
|
266195
266511
|
const orderedStages = ["extract", "resolve", "evaluate"];
|
|
266196
266512
|
const parts = orderedStages.filter((stage) => stageDurationsMs[stage] !== void 0).map((stage) => `${stage}=${stageDurationsMs[stage]}ms`);
|
|
@@ -266272,7 +266588,7 @@ function coerceObjectArray(val) {
|
|
|
266272
266588
|
return [];
|
|
266273
266589
|
}
|
|
266274
266590
|
function createDeterministicInstanceId(projectId, agentType, agentName) {
|
|
266275
|
-
const digest2 =
|
|
266591
|
+
const digest2 = createHash22("sha256").update(projectId).update("\n").update(agentType).update("\n").update(agentName ?? "").digest("hex").slice(0, 24);
|
|
266276
266592
|
return `auto-${digest2}`;
|
|
266277
266593
|
}
|
|
266278
266594
|
function shouldAwaitProjectRuntime(toolName) {
|
|
@@ -267348,20 +267664,17 @@ Use this as the \`topicKey\` parameter in \`memorix_store\` to enable upsert beh
|
|
|
267348
267664
|
if (duplicate) return duplicate;
|
|
267349
267665
|
}
|
|
267350
267666
|
let text3 = result.formatted;
|
|
267351
|
-
|
|
267352
|
-
const { getLastSearchMode: getLastSearchMode2 } = await Promise.resolve().then(() => (init_orama_store(), orama_store_exports));
|
|
267353
|
-
text3 += `
|
|
267667
|
+
text3 += `
|
|
267354
267668
|
|
|
267355
|
-
_Search mode: ${
|
|
267356
|
-
} catch {
|
|
267357
|
-
}
|
|
267669
|
+
_Search mode: ${result.receipt.mode}_`;
|
|
267358
267670
|
return {
|
|
267359
267671
|
content: [
|
|
267360
267672
|
{
|
|
267361
267673
|
type: "text",
|
|
267362
267674
|
text: text3
|
|
267363
267675
|
}
|
|
267364
|
-
]
|
|
267676
|
+
],
|
|
267677
|
+
structuredContent: { retrieval: result.receipt }
|
|
267365
267678
|
};
|
|
267366
267679
|
}, { loadCorpus: false });
|
|
267367
267680
|
}
|
|
@@ -269346,9 +269659,16 @@ Ensure the path points to a directory containing a .git folder (or a subdirector
|
|
|
269346
269659
|
agent,
|
|
269347
269660
|
reader: getObservationReader()
|
|
269348
269661
|
});
|
|
269662
|
+
const bindingReceipt = projectBinding.receipt({
|
|
269663
|
+
dataDir: projectDir2,
|
|
269664
|
+
transport: options.bindingTransport,
|
|
269665
|
+
gitRemote: project.gitRemote,
|
|
269666
|
+
handle: options.bindingHandle
|
|
269667
|
+
});
|
|
269349
269668
|
const lines = [
|
|
269350
269669
|
`[OK] Session started: ${result.session.id}`,
|
|
269351
269670
|
`Project: ${project.name} (${project.id})`,
|
|
269671
|
+
`Binding: ${bindingReceipt.state} via ${bindingReceipt.source}`,
|
|
269352
269672
|
result.session.agent ? `Agent: ${result.session.agent}` : "",
|
|
269353
269673
|
registeredAgent ? `Agent ID: ${registeredAgent.agent_id} (instance: ${registeredAgent.instance_id})` : "",
|
|
269354
269674
|
!registeredAgent ? "Coordination identity: not joined (memory/session context only)" : "",
|
|
@@ -269423,7 +269743,8 @@ ${s4.instruction}`.toLowerCase();
|
|
|
269423
269743
|
} catch {
|
|
269424
269744
|
}
|
|
269425
269745
|
return {
|
|
269426
|
-
content: [{ type: "text", text: lines.filter(Boolean).join("\n") }]
|
|
269746
|
+
content: [{ type: "text", text: lines.filter(Boolean).join("\n") }],
|
|
269747
|
+
structuredContent: { binding: bindingReceipt }
|
|
269427
269748
|
};
|
|
269428
269749
|
}
|
|
269429
269750
|
);
|
|
@@ -271470,7 +271791,7 @@ function installUpdateInBackground(targetVersion, currentVersion, cache5) {
|
|
|
271470
271791
|
const timeoutMs = parseAutoUpdateTimeoutMs(process.env.MEMORIX_AUTO_UPDATE_TIMEOUT_MS);
|
|
271471
271792
|
const child = execFile3(
|
|
271472
271793
|
npmCmd,
|
|
271473
|
-
["install", "-g", `${PACKAGE_NAME}@${targetVersion}`],
|
|
271794
|
+
["install", "-g", "--ignore-scripts", `${PACKAGE_NAME}@${targetVersion}`],
|
|
271474
271795
|
{ timeout: timeoutMs, windowsHide: true },
|
|
271475
271796
|
async (error40) => {
|
|
271476
271797
|
const failure = error40 ? describeAutoUpdateFailure(error40, timeoutMs) : null;
|
|
@@ -274390,12 +274711,27 @@ var init_serve_http = __esm({
|
|
|
274390
274711
|
const requestedRoot = requestInfo?.headers.get("mcp-project-root") ?? void 0;
|
|
274391
274712
|
const root = persisted?.projectRoot ?? requestedRoot ?? projectRoot;
|
|
274392
274713
|
const dataDir = await resolveModernDataDir(root, persisted);
|
|
274714
|
+
const binding = persisted ?? (() => {
|
|
274715
|
+
const detected = detectorMod.detectProject(root);
|
|
274716
|
+
if (!detected) return void 0;
|
|
274717
|
+
const existing = statelessBindingStore.findByProjectRoot(detected.rootPath);
|
|
274718
|
+
return existing ? statelessBindingStore.touch(existing.handleId) ?? existing : void 0;
|
|
274719
|
+
})();
|
|
274393
274720
|
const runtimeKey = JSON.stringify([dataDir, root]);
|
|
274394
274721
|
return modernRuntimePool.createBridge(runtimeKey, () => withBusinessRuntimeQueue2(async () => {
|
|
274395
274722
|
const lease = acquireDatabase2(dataDir);
|
|
274396
274723
|
try {
|
|
274397
274724
|
const runtime = await createModernMcpRuntime2({
|
|
274398
274725
|
projectRoot: root,
|
|
274726
|
+
bindingTransport: "stateless-http",
|
|
274727
|
+
...binding ? {
|
|
274728
|
+
bindingHandle: {
|
|
274729
|
+
handleId: binding.handleId,
|
|
274730
|
+
createdAt: binding.createdAt,
|
|
274731
|
+
lastUsedAt: binding.lastUsedAt,
|
|
274732
|
+
...binding.expiresAt ? { expiresAt: binding.expiresAt } : {}
|
|
274733
|
+
}
|
|
274734
|
+
} : {},
|
|
274399
274735
|
allowUntrackedFallback: false,
|
|
274400
274736
|
deferProjectInitUntilBound: true,
|
|
274401
274737
|
deferProjectRuntimeInit: true,
|
|
@@ -274594,10 +274930,11 @@ ${stack}` : ""}`);
|
|
|
274594
274930
|
const requestedRoot = typeof req.headers["mcp-project-root"] === "string" ? req.headers["mcp-project-root"] : projectRoot;
|
|
274595
274931
|
const detected = detectorMod.detectProject(requestedRoot);
|
|
274596
274932
|
if (detected) {
|
|
274933
|
+
const bindingDataDir = await persistMod.getProjectDataDir(detected.id);
|
|
274597
274934
|
const binding = statelessBindingStore.findByProjectRoot(detected.rootPath) ?? statelessBindingStore.create({
|
|
274598
274935
|
projectId: detected.id,
|
|
274599
274936
|
projectRoot: detected.rootPath,
|
|
274600
|
-
dataDir:
|
|
274937
|
+
dataDir: bindingDataDir
|
|
274601
274938
|
});
|
|
274602
274939
|
res.setHeader("Mcp-Project-Handle", binding.handleId);
|
|
274603
274940
|
}
|
|
@@ -274696,6 +275033,7 @@ ${stack}` : ""}`);
|
|
|
274696
275033
|
dashboardMode: "control-plane",
|
|
274697
275034
|
dashboardPort: port,
|
|
274698
275035
|
toolProfile,
|
|
275036
|
+
bindingTransport: "legacy-http",
|
|
274699
275037
|
projectBinding: binding
|
|
274700
275038
|
}
|
|
274701
275039
|
));
|
|
@@ -274808,6 +275146,15 @@ ${stack}` : ""}`);
|
|
|
274808
275146
|
rootPath: projectRoot
|
|
274809
275147
|
};
|
|
274810
275148
|
const defaultDataDir = await getProjectDataDir2(defaultProject.id);
|
|
275149
|
+
const dashboardBinding = createProjectBindingController2(defaultProject.rootPath);
|
|
275150
|
+
if (defaultProject.id !== "__unresolved__") {
|
|
275151
|
+
dashboardBinding.recordResolvedProject(defaultProject.id, defaultProject.rootPath);
|
|
275152
|
+
}
|
|
275153
|
+
const dashboardBindingReceipt = dashboardBinding.receipt({
|
|
275154
|
+
dataDir: defaultDataDir,
|
|
275155
|
+
transport: "dashboard",
|
|
275156
|
+
gitRemote: defaultProject.gitRemote
|
|
275157
|
+
});
|
|
274811
275158
|
const baseDir = getBaseDataDir2();
|
|
274812
275159
|
const { createControlPlaneMaintenanceWorker: createControlPlaneMaintenanceWorker2 } = await Promise.resolve().then(() => (init_control_plane_maintenance(), control_plane_maintenance_exports));
|
|
274813
275160
|
const controlPlaneMaintenanceWorker = createControlPlaneMaintenanceWorker2(defaultDataDir, {
|
|
@@ -275676,6 +276023,7 @@ ${stack}` : ""}`);
|
|
|
275676
276023
|
pid: process.pid,
|
|
275677
276024
|
projectId: defaultProject?.id ?? "__unresolved__",
|
|
275678
276025
|
projectName: defaultProject?.name ?? null,
|
|
276026
|
+
binding: dashboardBindingReceipt,
|
|
275679
276027
|
readyAt: httpReadyAt,
|
|
275680
276028
|
memory: {
|
|
275681
276029
|
rss: memory.rss,
|
|
@@ -276293,7 +276641,7 @@ var init_merge = __esm({
|
|
|
276293
276641
|
});
|
|
276294
276642
|
|
|
276295
276643
|
// src/sync/journal.ts
|
|
276296
|
-
import { createHash as
|
|
276644
|
+
import { createHash as createHash23 } from "crypto";
|
|
276297
276645
|
function nowIso() {
|
|
276298
276646
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
276299
276647
|
}
|
|
@@ -276305,7 +276653,7 @@ function deriveSyncKey(obs, originDevice) {
|
|
|
276305
276653
|
function contentHash(obs) {
|
|
276306
276654
|
const { id: _id, writeGeneration: _wg, ...rest } = obs;
|
|
276307
276655
|
const stable = stableJson(rest);
|
|
276308
|
-
return
|
|
276656
|
+
return createHash23("sha256").update(stable).digest("hex");
|
|
276309
276657
|
}
|
|
276310
276658
|
function stableJson(value) {
|
|
276311
276659
|
if (Array.isArray(value)) return `[${value.map(stableJson).join(",")}]`;
|
|
@@ -276428,9 +276776,9 @@ var init_policy2 = __esm({
|
|
|
276428
276776
|
});
|
|
276429
276777
|
|
|
276430
276778
|
// src/sync/namespace.ts
|
|
276431
|
-
import { createHash as
|
|
276779
|
+
import { createHash as createHash24 } from "crypto";
|
|
276432
276780
|
function syncNamespace(projectId) {
|
|
276433
|
-
return `project-${
|
|
276781
|
+
return `project-${createHash24("sha256").update(projectId).digest("hex").slice(0, 32)}`;
|
|
276434
276782
|
}
|
|
276435
276783
|
function userSyncNamespace(env3 = process.env) {
|
|
276436
276784
|
const override = env3.MEMORIX_SYNC_USER_NAMESPACE?.trim();
|
|
@@ -276456,7 +276804,7 @@ var init_namespace = __esm({
|
|
|
276456
276804
|
});
|
|
276457
276805
|
|
|
276458
276806
|
// src/sync/engine.ts
|
|
276459
|
-
import { createHash as
|
|
276807
|
+
import { createHash as createHash25 } from "crypto";
|
|
276460
276808
|
async function runSync(store2, remote, opts) {
|
|
276461
276809
|
const report = {
|
|
276462
276810
|
remote: remote.kind,
|
|
@@ -276660,7 +277008,7 @@ async function recordConcurrentConflict(store2, report, local, incoming, localRo
|
|
|
276660
277008
|
const incomingWins = compareVersion(incoming.version, { revision: local.revision, writer: local.writer }) > 0;
|
|
276661
277009
|
const loser = incomingWins ? { revision: local.revision, writer: local.writer } : incoming.version;
|
|
276662
277010
|
const loserRow = incomingWins ? localRow : incoming.row;
|
|
276663
|
-
const id =
|
|
277011
|
+
const id = createHash25("sha256").update(`${store2.projectId()}|${incoming.syncKey}|${local.revision}|${local.writer}|${incoming.version.revision}|${incoming.version.writer}`).digest("hex");
|
|
276664
277012
|
await store2.recordConflict({
|
|
276665
277013
|
id,
|
|
276666
277014
|
projectId: store2.projectId(),
|
|
@@ -279557,10 +279905,10 @@ __export(handler_exports, {
|
|
|
279557
279905
|
resetCooldowns: () => resetCooldowns,
|
|
279558
279906
|
runHook: () => runHook
|
|
279559
279907
|
});
|
|
279560
|
-
import { createHash as
|
|
279908
|
+
import { createHash as createHash26 } from "crypto";
|
|
279561
279909
|
function deriveHookActorId(input) {
|
|
279562
279910
|
const material = `${input.agent ?? "unknown"}\0${input.sessionId ?? "unknown"}`;
|
|
279563
|
-
return `hook:${
|
|
279911
|
+
return `hook:${createHash26("sha256").update(material).digest("hex").slice(0, 24)}`;
|
|
279564
279912
|
}
|
|
279565
279913
|
function classifyTool(input) {
|
|
279566
279914
|
if (input.event === "post_edit") return "file_modify";
|
|
@@ -281525,10 +281873,10 @@ var init_ingest = __esm({
|
|
|
281525
281873
|
});
|
|
281526
281874
|
|
|
281527
281875
|
// src/media/embedding.ts
|
|
281528
|
-
import { createHash as
|
|
281876
|
+
import { createHash as createHash27 } from "crypto";
|
|
281529
281877
|
function profileKey(provider2, asset) {
|
|
281530
281878
|
const identity = `${provider2.name}\0${provider2.dimensions}\0${asset.kind}`;
|
|
281531
|
-
return `media:${
|
|
281879
|
+
return `media:${createHash27("sha256").update(identity).digest("hex").slice(0, 20)}`;
|
|
281532
281880
|
}
|
|
281533
281881
|
function supportsAsset(provider2, asset) {
|
|
281534
281882
|
return !!provider2.embedInput && (provider2.supportedModalities?.includes(asset.kind) ?? false);
|
|
@@ -283147,7 +283495,7 @@ import { mkdir as mkdir9, readFile as readFile10, writeFile as writeFile10 } fro
|
|
|
283147
283495
|
import { basename as basename5, dirname as dirname8, resolve as resolve7 } from "path";
|
|
283148
283496
|
import { homedir as homedir36 } from "os";
|
|
283149
283497
|
function requestedAgents(agent) {
|
|
283150
|
-
const all =
|
|
283498
|
+
const all = getAgentIntegrationEntries().map((entry) => entry.agent);
|
|
283151
283499
|
if (!agent || agent === "all") return all;
|
|
283152
283500
|
return all.includes(agent) ? [agent] : [];
|
|
283153
283501
|
}
|
|
@@ -283170,8 +283518,99 @@ function worstStatus(statuses) {
|
|
|
283170
283518
|
if (statuses.includes("ok")) return "ok";
|
|
283171
283519
|
return "skipped";
|
|
283172
283520
|
}
|
|
283521
|
+
function capabilityParity(agent, projectRoot, scope, mcp, guidance, plugin) {
|
|
283522
|
+
const manifest = getAgentIntegrationEntries().find((entry) => entry.agent === agent)?.capabilities;
|
|
283523
|
+
if (!manifest) {
|
|
283524
|
+
return {
|
|
283525
|
+
manifestVersion: "1",
|
|
283526
|
+
expectedTransports: [],
|
|
283527
|
+
defaultTransport: "none",
|
|
283528
|
+
observedTransports: [],
|
|
283529
|
+
expectedArtifacts: [],
|
|
283530
|
+
artifactStatus: {},
|
|
283531
|
+
artifactChecks: [],
|
|
283532
|
+
lifecycle: { install: false, repair: false, doctor: false, uninstall: false },
|
|
283533
|
+
status: "missing",
|
|
283534
|
+
issues: ["manifest-missing"],
|
|
283535
|
+
source: {
|
|
283536
|
+
registry: "src/integrations/registry.ts",
|
|
283537
|
+
generatedBy: [],
|
|
283538
|
+
documentation: []
|
|
283539
|
+
}
|
|
283540
|
+
};
|
|
283541
|
+
}
|
|
283542
|
+
const expectedArtifacts = [
|
|
283543
|
+
...manifest.artifacts.packageFiles.length > 0 ? ["package"] : [],
|
|
283544
|
+
...manifest.artifacts.hookFiles.length > 0 ? ["hooks"] : [],
|
|
283545
|
+
...manifest.artifacts.ruleFiles.length > 0 ? ["rules"] : [],
|
|
283546
|
+
...manifest.artifacts.skillFiles.length > 0 ? ["skills"] : [],
|
|
283547
|
+
...manifest.artifacts.guidanceFiles.length > 0 ? ["guidance"] : []
|
|
283548
|
+
];
|
|
283549
|
+
const artifactStatus = {};
|
|
283550
|
+
if (manifest.transport.supported.length > 0) artifactStatus.mcp = mcp.status;
|
|
283551
|
+
if (manifest.artifacts.packageFiles.length > 0) artifactStatus.package = plugin.status;
|
|
283552
|
+
if (manifest.artifacts.hookFiles.length > 0) {
|
|
283553
|
+
artifactStatus.hooks = plugin.checks.length > 0 ? plugin.status : "skipped";
|
|
283554
|
+
}
|
|
283555
|
+
if (manifest.artifacts.ruleFiles.length > 0 || manifest.artifacts.guidanceFiles.length > 0) {
|
|
283556
|
+
artifactStatus.guidance = guidance.status;
|
|
283557
|
+
}
|
|
283558
|
+
if (manifest.artifacts.skillFiles.length > 0) {
|
|
283559
|
+
artifactStatus.skills = plugin.checks.length > 0 ? plugin.status : "skipped";
|
|
283560
|
+
}
|
|
283561
|
+
const artifactChecks = [];
|
|
283562
|
+
for (const check2 of guidance.checks) {
|
|
283563
|
+
if (check2.scope === "local") continue;
|
|
283564
|
+
const kind = manifest.artifacts.ruleFiles.length > 0 ? "rules" : "guidance";
|
|
283565
|
+
artifactChecks.push({
|
|
283566
|
+
kind,
|
|
283567
|
+
scope: check2.scope,
|
|
283568
|
+
path: check2.path,
|
|
283569
|
+
exists: check2.exists,
|
|
283570
|
+
status: check2.status
|
|
283571
|
+
});
|
|
283572
|
+
}
|
|
283573
|
+
if (manifest.hooks.supported) {
|
|
283574
|
+
const artifactScopes = requestedGuidanceScopes(scope).filter((value) => value !== "local");
|
|
283575
|
+
for (const artifactScope of artifactScopes) {
|
|
283576
|
+
const path50 = artifactScope === "project" ? getProjectConfigPath(agent, projectRoot) : getGlobalConfigPath(agent);
|
|
283577
|
+
if (!path50) continue;
|
|
283578
|
+
const exists3 = existsSync31(path50);
|
|
283579
|
+
artifactChecks.push({
|
|
283580
|
+
kind: "hooks",
|
|
283581
|
+
scope: artifactScope,
|
|
283582
|
+
path: path50,
|
|
283583
|
+
exists: exists3,
|
|
283584
|
+
status: exists3 ? "ok" : "missing"
|
|
283585
|
+
});
|
|
283586
|
+
}
|
|
283587
|
+
}
|
|
283588
|
+
const observedTransports = [...new Set(mcp.checks.map((check2) => check2.server?.transport).filter((transport) => transport === "stdio" || transport === "http"))];
|
|
283589
|
+
const parityStatuses = [
|
|
283590
|
+
...Object.values(artifactStatus),
|
|
283591
|
+
...artifactChecks.map((check2) => check2.status)
|
|
283592
|
+
];
|
|
283593
|
+
const issues = Object.entries(artifactStatus).filter(([, status]) => status === "missing" || status === "repairable").map(([kind, status]) => `${kind}-${status}`);
|
|
283594
|
+
issues.push(...artifactChecks.filter((check2) => check2.status === "missing" || check2.status === "repairable").map((check2) => `${check2.kind}-${check2.scope}-${check2.status}`));
|
|
283595
|
+
if (manifest.transport.supported.length > 0 && mcp.status === "skipped") {
|
|
283596
|
+
issues.push("transport-not-checked");
|
|
283597
|
+
}
|
|
283598
|
+
return {
|
|
283599
|
+
manifestVersion: manifest.schemaVersion,
|
|
283600
|
+
expectedTransports: [...manifest.transport.supported],
|
|
283601
|
+
defaultTransport: manifest.transport.default,
|
|
283602
|
+
observedTransports,
|
|
283603
|
+
expectedArtifacts,
|
|
283604
|
+
artifactStatus,
|
|
283605
|
+
artifactChecks,
|
|
283606
|
+
lifecycle: { ...manifest.lifecycle },
|
|
283607
|
+
status: worstStatus(parityStatuses),
|
|
283608
|
+
issues: unique2(issues),
|
|
283609
|
+
source: manifest.source
|
|
283610
|
+
};
|
|
283611
|
+
}
|
|
283173
283612
|
function isMcpConfigAgent(agent) {
|
|
283174
|
-
return agent !== "pi" && agent !== "grok";
|
|
283613
|
+
return agent !== "pi" && agent !== "grok" && agent !== "qwen";
|
|
283175
283614
|
}
|
|
283176
283615
|
function isActionableMcpRepairIssue(issue2) {
|
|
283177
283616
|
return issue2 !== "memorix-server-missing";
|
|
@@ -283891,11 +284330,15 @@ async function inspectAgentIntegrations(options = {}) {
|
|
|
283891
284330
|
const agents = requestedAgents(options.agent);
|
|
283892
284331
|
const entries = [];
|
|
283893
284332
|
for (const agent of agents) {
|
|
284333
|
+
const mcp = await inspectMcp(agent, projectRoot, scope);
|
|
284334
|
+
const guidance = await inspectGuidance(agent, projectRoot, scope);
|
|
284335
|
+
const plugin = await inspectPlugin(agent, scope);
|
|
283894
284336
|
entries.push({
|
|
283895
284337
|
agent,
|
|
283896
|
-
|
|
283897
|
-
|
|
283898
|
-
|
|
284338
|
+
capability: capabilityParity(agent, projectRoot, scope, mcp, guidance, plugin),
|
|
284339
|
+
mcp,
|
|
284340
|
+
guidance,
|
|
284341
|
+
plugin
|
|
283899
284342
|
});
|
|
283900
284343
|
}
|
|
283901
284344
|
const entryStatuses = entries.map((entry) => worstStatus([entry.mcp.status, entry.guidance.status, entry.plugin.status]));
|
|
@@ -283922,6 +284365,10 @@ function formatAgentIntegrationReport(report) {
|
|
|
283922
284365
|
for (const entry of report.entries) {
|
|
283923
284366
|
const status = worstStatus([entry.mcp.status, entry.guidance.status, entry.plugin.status]);
|
|
283924
284367
|
lines.push(`${entry.agent}: ${status}`);
|
|
284368
|
+
const expected = entry.capability.expectedArtifacts.length > 0 ? entry.capability.expectedArtifacts.join(", ") : "none";
|
|
284369
|
+
const observed = entry.capability.observedTransports.length > 0 ? entry.capability.observedTransports.join(", ") : "none";
|
|
284370
|
+
lines.push(` Capability: v${entry.capability.manifestVersion}; transport=${entry.capability.defaultTransport}; observed=${observed}; artifacts=${expected}; parity=${entry.capability.status}`);
|
|
284371
|
+
if (entry.capability.issues.length > 0) lines.push(` Capability parity: ${entry.capability.issues.join(", ")}`);
|
|
283925
284372
|
if (entry.mcp.issues.length > 0) lines.push(` MCP: ${entry.mcp.issues.join(", ")}`);
|
|
283926
284373
|
if (entry.guidance.issues.length > 0) lines.push(` Guidance: ${entry.guidance.issues.join(", ")}`);
|
|
283927
284374
|
const hookTrustPending = entry.plugin.issues.includes("codex-hook-trust-pending");
|
|
@@ -284063,6 +284510,7 @@ var init_agent_integrations = __esm({
|
|
|
284063
284510
|
init_installers();
|
|
284064
284511
|
init_setup();
|
|
284065
284512
|
init_version();
|
|
284513
|
+
init_registry2();
|
|
284066
284514
|
GUIDANCE_AGENTS = /* @__PURE__ */ new Set([
|
|
284067
284515
|
"claude",
|
|
284068
284516
|
"codex",
|
|
@@ -287555,12 +288003,12 @@ var init_permission = __esm({
|
|
|
287555
288003
|
});
|
|
287556
288004
|
|
|
287557
288005
|
// src/orchestrate/effect-ledger.ts
|
|
287558
|
-
import { createHash as
|
|
288006
|
+
import { createHash as createHash28, randomUUID as randomUUID22 } from "crypto";
|
|
287559
288007
|
function fingerprintEffectInput(input) {
|
|
287560
288008
|
if (input === void 0) return void 0;
|
|
287561
288009
|
try {
|
|
287562
288010
|
const safe = sanitizeCredentials(JSON.stringify(input));
|
|
287563
|
-
return
|
|
288011
|
+
return createHash28("sha256").update(safe).digest("hex").slice(0, 24);
|
|
287564
288012
|
} catch {
|
|
287565
288013
|
return void 0;
|
|
287566
288014
|
}
|
|
@@ -287687,7 +288135,7 @@ var init_effect_ledger = __esm({
|
|
|
287687
288135
|
});
|
|
287688
288136
|
|
|
287689
288137
|
// src/orchestrate/memorix-bridge.ts
|
|
287690
|
-
import { createHash as
|
|
288138
|
+
import { createHash as createHash29 } from "crypto";
|
|
287691
288139
|
async function getStoreObservation() {
|
|
287692
288140
|
if (!_storeObservation) {
|
|
287693
288141
|
const mod = await Promise.resolve().then(() => (init_observations(), observations_exports));
|
|
@@ -287703,7 +288151,7 @@ async function getSearchObservations() {
|
|
|
287703
288151
|
return _searchObservations;
|
|
287704
288152
|
}
|
|
287705
288153
|
function automaticActorId(...parts) {
|
|
287706
|
-
return `orchestrator:${
|
|
288154
|
+
return `orchestrator:${createHash29("sha256").update(parts.join("\0")).digest("hex").slice(0, 24)}`;
|
|
287707
288155
|
}
|
|
287708
288156
|
function isEligibleAutomaticLesson(entry) {
|
|
287709
288157
|
return entry.admissionState !== "candidate" && entry.admissionState !== "ephemeral";
|
|
@@ -287850,7 +288298,7 @@ function sanitizeErrorPattern(text3) {
|
|
|
287850
288298
|
}
|
|
287851
288299
|
function hashErrorPattern(errorOutput) {
|
|
287852
288300
|
const sanitized = sanitizeErrorPattern(errorOutput).slice(0, 500);
|
|
287853
|
-
return
|
|
288301
|
+
return createHash29("sha256").update(sanitized).digest("hex").slice(0, 12);
|
|
287854
288302
|
}
|
|
287855
288303
|
function sleep6(ms2) {
|
|
287856
288304
|
return new Promise((resolve9) => setTimeout(() => resolve9([]), ms2));
|
|
@@ -293737,27 +294185,27 @@ function ensureMemorixPackageRoot(startDir = dirname(fileURLToPath2(import.meta.
|
|
|
293737
294185
|
if (process.env.MEMORIX_PACKAGE_ROOT) {
|
|
293738
294186
|
return process.env.MEMORIX_PACKAGE_ROOT;
|
|
293739
294187
|
}
|
|
293740
|
-
const
|
|
293741
|
-
if (
|
|
293742
|
-
process.env.MEMORIX_PACKAGE_ROOT =
|
|
294188
|
+
const packageRoot2 = findMemorixPackageRoot(startDir);
|
|
294189
|
+
if (packageRoot2) {
|
|
294190
|
+
process.env.MEMORIX_PACKAGE_ROOT = packageRoot2;
|
|
293743
294191
|
}
|
|
293744
|
-
return
|
|
294192
|
+
return packageRoot2;
|
|
293745
294193
|
}
|
|
293746
|
-
function ensureBundledMemcodePackageDir(
|
|
294194
|
+
function ensureBundledMemcodePackageDir(packageRoot2) {
|
|
293747
294195
|
if (process.env.MEMCODE_PACKAGE_DIR || process.env.PI_PACKAGE_DIR) {
|
|
293748
294196
|
return;
|
|
293749
294197
|
}
|
|
293750
|
-
const bundledRuntimeDir = join(
|
|
294198
|
+
const bundledRuntimeDir = join(packageRoot2, "dist", "memcode-runtime");
|
|
293751
294199
|
if (existsSync(join(bundledRuntimeDir, "package.json"))) {
|
|
293752
294200
|
process.env.MEMCODE_PACKAGE_DIR = bundledRuntimeDir;
|
|
293753
294201
|
}
|
|
293754
294202
|
}
|
|
293755
294203
|
async function importBundledMemcode(startDir = dirname(fileURLToPath2(import.meta.url))) {
|
|
293756
|
-
const
|
|
293757
|
-
if (
|
|
293758
|
-
const bundledEntry = join(
|
|
294204
|
+
const packageRoot2 = ensureMemorixPackageRoot(startDir);
|
|
294205
|
+
if (packageRoot2) {
|
|
294206
|
+
const bundledEntry = join(packageRoot2, "dist", "memcode", "index.js");
|
|
293759
294207
|
if (existsSync(bundledEntry)) {
|
|
293760
|
-
ensureBundledMemcodePackageDir(
|
|
294208
|
+
ensureBundledMemcodePackageDir(packageRoot2);
|
|
293761
294209
|
return import(pathToFileURL(bundledEntry).href);
|
|
293762
294210
|
}
|
|
293763
294211
|
}
|