memorix 1.10.0 → 1.10.2
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 +25 -0
- package/README.md +2 -0
- package/README.zh-CN.md +2 -0
- package/dist/cli/index.js +575 -196
- package/dist/index.js +375 -134
- package/dist/maintenance-runner.js +210 -46
- package/dist/media-audio-runner.js +182 -18
- package/dist/media-video-runner.js +209 -45
- package/dist/memcode-runtime/CHANGELOG.md +25 -0
- package/dist/sdk.js +426 -134
- package/dist/vector-backfill-runner.js +209 -45
- package/docs/1.2.0-EVALUATION-HARNESS.md +18 -0
- package/docs/CONFIGURATION.md +25 -0
- package/docs/DEVELOPMENT.md +3 -3
- package/docs/PERFORMANCE.md +23 -0
- package/docs/README.md +2 -2
- package/docs/ROADMAP-1.9.12-2.0.md +13 -6
- package/package.json +1 -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/__init__.py +1 -2
- 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/init.ts +6 -2
- package/src/cli/commands/repair.ts +17 -3
- package/src/cli/tui/ConfigureView.tsx +2 -0
- package/src/codegraph/auto-context.ts +17 -0
- package/src/codegraph/context-pack.ts +15 -0
- package/src/compact/engine.ts +11 -0
- package/src/compact/index-format.ts +1 -1
- 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/knowledge/context-assembly.ts +13 -0
- package/src/knowledge/context-receipt.ts +35 -0
- package/src/knowledge/workset.ts +8 -0
- package/src/llm/provider.ts +2 -1
- package/src/memory/observations.ts +7 -5
- package/src/multimodal/image-loader.ts +2 -2
- package/src/search/derived-view-receipt.ts +62 -0
- package/src/search/semantic-index.ts +149 -1
- package/src/server.ts +18 -3
- package/src/store/orama-store.ts +80 -2
package/dist/index.js
CHANGED
|
@@ -3841,7 +3841,8 @@ function getResolvedConfig(options = {}) {
|
|
|
3841
3841
|
const isAtlasCloud = memoryLlmProvider === "atlascloud";
|
|
3842
3842
|
const isRequesty = memoryLlmProvider === "requesty";
|
|
3843
3843
|
const isApiRoute = memoryLlmProvider === "apiroute";
|
|
3844
|
-
const
|
|
3844
|
+
const isCheaperInference = memoryLlmProvider === "cheaperinference";
|
|
3845
|
+
const usesPresetKeyOnly = isAtlasCloud || isRequesty || isApiRoute || isCheaperInference;
|
|
3845
3846
|
const memoryLlmApiKey = first(
|
|
3846
3847
|
process.env.MEMORIX_LLM_API_KEY,
|
|
3847
3848
|
process.env.MEMORIX_API_KEY,
|
|
@@ -3849,7 +3850,7 @@ function getResolvedConfig(options = {}) {
|
|
|
3849
3850
|
yaml.llm?.apiKey,
|
|
3850
3851
|
legacy.llm?.apiKey,
|
|
3851
3852
|
// Never borrow another provider's credentials for these gateway presets.
|
|
3852
|
-
isAtlasCloud ? process.env.ATLASCLOUD_API_KEY : isRequesty ? process.env.REQUESTY_API_KEY : isApiRoute ? process.env.API_ROUTE_API_KEY : process.env.OPENAI_API_KEY,
|
|
3853
|
+
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,
|
|
3853
3854
|
usesPresetKeyOnly ? void 0 : process.env.ANTHROPIC_API_KEY,
|
|
3854
3855
|
usesPresetKeyOnly ? void 0 : openRouterMemoryLlmApiKey
|
|
3855
3856
|
);
|
|
@@ -4033,6 +4034,7 @@ function getEnvSourceNames() {
|
|
|
4033
4034
|
"OPENROUTER_API_KEY",
|
|
4034
4035
|
"REQUESTY_API_KEY",
|
|
4035
4036
|
"API_ROUTE_API_KEY",
|
|
4037
|
+
"CHEAPER_INFERENCE_API_KEY",
|
|
4036
4038
|
"ATLASCLOUD_API_KEY"
|
|
4037
4039
|
].filter((name) => process.env[name]);
|
|
4038
4040
|
}
|
|
@@ -7027,6 +7029,7 @@ var init_provider2 = __esm({
|
|
|
7027
7029
|
openrouter: { baseUrl: "https://openrouter.ai/api/v1", model: "openai/gpt-4.1-nano" },
|
|
7028
7030
|
requesty: { baseUrl: "https://router.requesty.ai/v1", model: "openai/gpt-4.1-nano" },
|
|
7029
7031
|
apiroute: { baseUrl: "https://global.api-route.com/v1", model: "deepseek-v4.1-flash" },
|
|
7032
|
+
cheaperinference: { baseUrl: "https://api.cheaperinference.com/v1", model: "gpt-5.4-mini" },
|
|
7030
7033
|
atlascloud: { baseUrl: "https://api.atlascloud.ai/v1", model: "deepseek-ai/deepseek-v3.2" },
|
|
7031
7034
|
custom: { baseUrl: "http://localhost:11434/v1", model: "llama3" }
|
|
7032
7035
|
};
|
|
@@ -7805,6 +7808,7 @@ var init_obs_store = __esm({
|
|
|
7805
7808
|
|
|
7806
7809
|
// src/search/semantic-index.ts
|
|
7807
7810
|
import { createHash as createHash4 } from "crypto";
|
|
7811
|
+
import { existsSync as existsSync8 } from "fs";
|
|
7808
7812
|
import { createRequire as createRequire3 } from "module";
|
|
7809
7813
|
import path11 from "path";
|
|
7810
7814
|
function createSemanticIndexProfile(provider2) {
|
|
@@ -7903,17 +7907,80 @@ function queueOperation(key, operation) {
|
|
|
7903
7907
|
writeQueues.set(key, run.catch(() => void 0));
|
|
7904
7908
|
return run;
|
|
7905
7909
|
}
|
|
7910
|
+
function positiveEnvInt(name, fallback) {
|
|
7911
|
+
const value = Number.parseInt(process.env[name] ?? "", 10);
|
|
7912
|
+
return Number.isSafeInteger(value) && value > 0 ? value : fallback;
|
|
7913
|
+
}
|
|
7914
|
+
function semanticWriteBatchSize() {
|
|
7915
|
+
return positiveEnvInt("MEMORIX_SEMANTIC_WRITE_BATCH_SIZE", DEFAULT_WRITE_BATCH_SIZE);
|
|
7916
|
+
}
|
|
7917
|
+
function semanticWriteFlushMs() {
|
|
7918
|
+
return positiveEnvInt("MEMORIX_SEMANTIC_WRITE_FLUSH_MS", DEFAULT_WRITE_FLUSH_MS);
|
|
7919
|
+
}
|
|
7920
|
+
function semanticOptimizeEvery() {
|
|
7921
|
+
return positiveEnvInt("MEMORIX_SEMANTIC_OPTIMIZE_EVERY", DEFAULT_OPTIMIZE_EVERY);
|
|
7922
|
+
}
|
|
7923
|
+
function semanticVersionRetentionMs() {
|
|
7924
|
+
return positiveEnvInt("MEMORIX_SEMANTIC_VERSION_RETENTION_MS", DEFAULT_VERSION_RETENTION_MS);
|
|
7925
|
+
}
|
|
7926
|
+
async function optimizeState(state) {
|
|
7927
|
+
if (!state.table || typeof state.table.optimize !== "function") return;
|
|
7928
|
+
await state.table.optimize({
|
|
7929
|
+
cleanupOlderThan: new Date(Date.now() - semanticVersionRetentionMs()),
|
|
7930
|
+
deleteUnverified: false
|
|
7931
|
+
});
|
|
7932
|
+
}
|
|
7906
7933
|
async function mergeVectors(dataDir, profile, records) {
|
|
7907
7934
|
if (records.length === 0) return;
|
|
7908
7935
|
const state = await getState(dataDir, profile, records);
|
|
7909
7936
|
if (!state?.table) return;
|
|
7910
7937
|
const rows = records.map(toLanceRow);
|
|
7911
7938
|
await state.table.mergeInsert("observation_id").whenMatchedUpdateAll().whenNotMatchedInsertAll().execute(rows);
|
|
7939
|
+
const key = stateKey(dataDir, profile);
|
|
7940
|
+
const mutationCount = (mutationCounts.get(key) ?? 0) + 1;
|
|
7941
|
+
if (mutationCount >= semanticOptimizeEvery()) {
|
|
7942
|
+
mutationCounts.set(key, 0);
|
|
7943
|
+
await optimizeState(state).catch(() => void 0);
|
|
7944
|
+
} else {
|
|
7945
|
+
mutationCounts.set(key, mutationCount);
|
|
7946
|
+
}
|
|
7912
7947
|
void ensureSemanticIndex(dataDir, profile);
|
|
7913
7948
|
}
|
|
7949
|
+
function flushPendingVectorBatch(key) {
|
|
7950
|
+
const pending = pendingVectorBatches.get(key);
|
|
7951
|
+
if (!pending) return Promise.resolve();
|
|
7952
|
+
if (pending.timer) clearTimeout(pending.timer);
|
|
7953
|
+
pendingVectorBatches.delete(key);
|
|
7954
|
+
const records = [...pending.records.values()];
|
|
7955
|
+
const waiters = pending.waiters.splice(0);
|
|
7956
|
+
return queueOperation(key, () => mergeVectors(pending.dataDir, pending.profile, records)).then(() => waiters.forEach((waiter) => waiter.resolve())).catch((error) => {
|
|
7957
|
+
waiters.forEach((waiter) => waiter.reject(error));
|
|
7958
|
+
});
|
|
7959
|
+
}
|
|
7960
|
+
function upsertSemanticVector(dataDir, profile, record80) {
|
|
7961
|
+
const key = stateKey(dataDir, profile);
|
|
7962
|
+
let pending = pendingVectorBatches.get(key);
|
|
7963
|
+
if (!pending) {
|
|
7964
|
+
pending = { dataDir, profile, records: /* @__PURE__ */ new Map(), waiters: [] };
|
|
7965
|
+
pendingVectorBatches.set(key, pending);
|
|
7966
|
+
}
|
|
7967
|
+
pending.records.set(`${record80.projectId}:${record80.observationId}`, record80);
|
|
7968
|
+
const promise = new Promise((resolve5, reject) => pending.waiters.push({ resolve: resolve5, reject }));
|
|
7969
|
+
if (pending.records.size >= semanticWriteBatchSize()) void flushPendingVectorBatch(key);
|
|
7970
|
+
else if (!pending.timer) pending.timer = setTimeout(() => {
|
|
7971
|
+
void flushPendingVectorBatch(key);
|
|
7972
|
+
}, semanticWriteFlushMs());
|
|
7973
|
+
return promise;
|
|
7974
|
+
}
|
|
7914
7975
|
function upsertSemanticVectors(dataDir, profile, records) {
|
|
7915
7976
|
return queueOperation(stateKey(dataDir, profile), () => mergeVectors(dataDir, profile, records));
|
|
7916
7977
|
}
|
|
7978
|
+
async function listSemanticVectorIds(dataDir, profile) {
|
|
7979
|
+
const state = await getState(dataDir, profile);
|
|
7980
|
+
if (!state?.table) return null;
|
|
7981
|
+
const rows = await state.table.query().select(["observation_id"]).toArray();
|
|
7982
|
+
return new Set(rows.map((row) => Number(row.observation_id)).filter(Number.isSafeInteger));
|
|
7983
|
+
}
|
|
7917
7984
|
function resolveIndexThreshold() {
|
|
7918
7985
|
const raw = Number.parseInt(process.env.MEMORIX_SEMANTIC_INDEX_THRESHOLD ?? "", 10);
|
|
7919
7986
|
return Number.isSafeInteger(raw) && raw > 0 ? raw : DEFAULT_INDEX_THRESHOLD;
|
|
@@ -7965,7 +8032,7 @@ async function searchSemanticVectors(options) {
|
|
|
7965
8032
|
distance: Number(row._distance ?? Number.POSITIVE_INFINITY)
|
|
7966
8033
|
})).filter((row) => Number.isFinite(row.distance));
|
|
7967
8034
|
}
|
|
7968
|
-
var SEMANTIC_INDEX_DIR, TABLE_PREFIX, DEFAULT_INDEX_THRESHOLD, MAX_INDEX_PARTITIONS, statePromises, writeQueues, indexBuilds, availability, requireFromHere2;
|
|
8035
|
+
var SEMANTIC_INDEX_DIR, TABLE_PREFIX, DEFAULT_INDEX_THRESHOLD, MAX_INDEX_PARTITIONS, DEFAULT_WRITE_BATCH_SIZE, DEFAULT_WRITE_FLUSH_MS, DEFAULT_OPTIMIZE_EVERY, DEFAULT_VERSION_RETENTION_MS, statePromises, writeQueues, indexBuilds, mutationCounts, pendingVectorBatches, availability, requireFromHere2;
|
|
7969
8036
|
var init_semantic_index = __esm({
|
|
7970
8037
|
"src/search/semantic-index.ts"() {
|
|
7971
8038
|
"use strict";
|
|
@@ -7974,13 +8041,84 @@ var init_semantic_index = __esm({
|
|
|
7974
8041
|
TABLE_PREFIX = "observations_";
|
|
7975
8042
|
DEFAULT_INDEX_THRESHOLD = 1e4;
|
|
7976
8043
|
MAX_INDEX_PARTITIONS = 32;
|
|
8044
|
+
DEFAULT_WRITE_BATCH_SIZE = 100;
|
|
8045
|
+
DEFAULT_WRITE_FLUSH_MS = 50;
|
|
8046
|
+
DEFAULT_OPTIMIZE_EVERY = 20;
|
|
8047
|
+
DEFAULT_VERSION_RETENTION_MS = 24 * 60 * 60 * 1e3;
|
|
7977
8048
|
statePromises = /* @__PURE__ */ new Map();
|
|
7978
8049
|
writeQueues = /* @__PURE__ */ new Map();
|
|
7979
8050
|
indexBuilds = /* @__PURE__ */ new Map();
|
|
8051
|
+
mutationCounts = /* @__PURE__ */ new Map();
|
|
8052
|
+
pendingVectorBatches = /* @__PURE__ */ new Map();
|
|
7980
8053
|
requireFromHere2 = createRequire3(import.meta.url);
|
|
7981
8054
|
}
|
|
7982
8055
|
});
|
|
7983
8056
|
|
|
8057
|
+
// src/memory/secret-filter.ts
|
|
8058
|
+
function applyRedaction(text3) {
|
|
8059
|
+
if (!text3) return text3;
|
|
8060
|
+
let out = text3;
|
|
8061
|
+
out = out.replace(
|
|
8062
|
+
/((?:password|passwd|pwd|secret|token|api[_-]?key|auth[_-]?key|access[_-]?key|private[_-]?key|client[_-]?secret)\s*[:=]\s*["']?)([^\s"',;\n]{6,})/gi,
|
|
8063
|
+
"$1[REDACTED]"
|
|
8064
|
+
);
|
|
8065
|
+
out = out.replace(
|
|
8066
|
+
/(Bearer\s+)([A-Za-z0-9._\-/+]{20,})/g,
|
|
8067
|
+
"$1[REDACTED]"
|
|
8068
|
+
);
|
|
8069
|
+
out = out.replace(/\b(?:ghp|ghs|gho|github_pat)_[A-Za-z0-9]{36,}\b/g, "[REDACTED]");
|
|
8070
|
+
out = out.replace(/\bsk-[A-Za-z0-9T-]{20,}\b/g, "[REDACTED]");
|
|
8071
|
+
out = out.replace(/\beyJ[A-Za-z0-9._-]{40,}\b/g, "[REDACTED]");
|
|
8072
|
+
return out;
|
|
8073
|
+
}
|
|
8074
|
+
function sanitizeCredentials(text3) {
|
|
8075
|
+
return applyRedaction(text3);
|
|
8076
|
+
}
|
|
8077
|
+
function redactCredentials(text3) {
|
|
8078
|
+
return applyRedaction(text3);
|
|
8079
|
+
}
|
|
8080
|
+
var init_secret_filter = __esm({
|
|
8081
|
+
"src/memory/secret-filter.ts"() {
|
|
8082
|
+
"use strict";
|
|
8083
|
+
init_esm_shims();
|
|
8084
|
+
}
|
|
8085
|
+
});
|
|
8086
|
+
|
|
8087
|
+
// src/search/derived-view-receipt.ts
|
|
8088
|
+
function sanitizeDerivedViewFailureReason(reason) {
|
|
8089
|
+
const safe = sanitizeCredentials(reason).replace(/(?:[A-Za-z]:[\\/]|\\\\[^\\/\s]+[\\/]|\/(?:home|Users|tmp|var|private|mnt|workspace|workspaces)\/)[^\s"'<>|]*/gi, "[path]").replace(/\s+/g, " ").trim();
|
|
8090
|
+
return safe.slice(0, 240) || "derived view failed";
|
|
8091
|
+
}
|
|
8092
|
+
function embeddingHealthReceipt(health, embeddingEnabled2) {
|
|
8093
|
+
if (health?.status === "disabled") {
|
|
8094
|
+
return { freshness: "current", rebuildStatus: "disabled" };
|
|
8095
|
+
}
|
|
8096
|
+
if (health?.status === "ready" || embeddingEnabled2) {
|
|
8097
|
+
return { freshness: "current", rebuildStatus: "idle" };
|
|
8098
|
+
}
|
|
8099
|
+
if (health?.status === "degraded") {
|
|
8100
|
+
return {
|
|
8101
|
+
freshness: "stale",
|
|
8102
|
+
rebuildStatus: "failed",
|
|
8103
|
+
...health.failure ? {
|
|
8104
|
+
failureReason: `embedding ${health.failure.kind}; retry in ${health.failure.retryAfterMs}ms`
|
|
8105
|
+
} : { failureReason: "embedding provider degraded" }
|
|
8106
|
+
};
|
|
8107
|
+
}
|
|
8108
|
+
return {
|
|
8109
|
+
freshness: "unknown",
|
|
8110
|
+
rebuildStatus: "unavailable",
|
|
8111
|
+
failureReason: "embedding provider is not initialized"
|
|
8112
|
+
};
|
|
8113
|
+
}
|
|
8114
|
+
var init_derived_view_receipt = __esm({
|
|
8115
|
+
"src/search/derived-view-receipt.ts"() {
|
|
8116
|
+
"use strict";
|
|
8117
|
+
init_esm_shims();
|
|
8118
|
+
init_secret_filter();
|
|
8119
|
+
}
|
|
8120
|
+
});
|
|
8121
|
+
|
|
7984
8122
|
// src/project/aliases.ts
|
|
7985
8123
|
var aliases_exports = {};
|
|
7986
8124
|
__export(aliases_exports, {
|
|
@@ -8589,6 +8727,8 @@ __export(orama_store_exports, {
|
|
|
8589
8727
|
getLastSearchMode: () => getLastSearchMode,
|
|
8590
8728
|
getObservationCount: () => getObservationCount,
|
|
8591
8729
|
getObservationsByIds: () => getObservationsByIds,
|
|
8730
|
+
getPersistentSemanticVectorIds: () => getPersistentSemanticVectorIds,
|
|
8731
|
+
getSearchDerivedViews: () => getSearchDerivedViews,
|
|
8592
8732
|
getTimeline: () => getTimeline,
|
|
8593
8733
|
getVectorDimensions: () => getVectorDimensions,
|
|
8594
8734
|
hasObservationVector: () => hasObservationVector,
|
|
@@ -8619,6 +8759,52 @@ function getLastSearchDiagnostics(projectId) {
|
|
|
8619
8759
|
const diagnostics = lastSearchDiagnosticsByProject.get(projectId ?? SEARCH_MODE_DEFAULT_KEY);
|
|
8620
8760
|
return diagnostics ? { ...diagnostics } : void 0;
|
|
8621
8761
|
}
|
|
8762
|
+
function getSearchDerivedViews() {
|
|
8763
|
+
const views = {};
|
|
8764
|
+
const store = getOptionalObservationStore();
|
|
8765
|
+
if (store) {
|
|
8766
|
+
try {
|
|
8767
|
+
const generation = store.getGeneration();
|
|
8768
|
+
if (store.hasLexicalIndex?.()) {
|
|
8769
|
+
views.fts = { generation, freshness: "current", rebuildStatus: "idle" };
|
|
8770
|
+
} else {
|
|
8771
|
+
views.fts = {
|
|
8772
|
+
generation,
|
|
8773
|
+
freshness: "unknown",
|
|
8774
|
+
rebuildStatus: "unavailable",
|
|
8775
|
+
failureReason: sanitizeDerivedViewFailureReason(
|
|
8776
|
+
store.getBackendReason?.() ?? "persistent lexical index unavailable"
|
|
8777
|
+
)
|
|
8778
|
+
};
|
|
8779
|
+
}
|
|
8780
|
+
} catch (error) {
|
|
8781
|
+
views.fts = {
|
|
8782
|
+
freshness: "unknown",
|
|
8783
|
+
rebuildStatus: "failed",
|
|
8784
|
+
failureReason: sanitizeDerivedViewFailureReason(error instanceof Error ? error.message : String(error))
|
|
8785
|
+
};
|
|
8786
|
+
}
|
|
8787
|
+
} else {
|
|
8788
|
+
views.fts = {
|
|
8789
|
+
freshness: "unknown",
|
|
8790
|
+
rebuildStatus: "unavailable",
|
|
8791
|
+
failureReason: "observation store is not initialized"
|
|
8792
|
+
};
|
|
8793
|
+
}
|
|
8794
|
+
views.orama = db ? { generation: dbGeneration, freshness: "current", rebuildStatus: "idle" } : {
|
|
8795
|
+
generation: dbGeneration,
|
|
8796
|
+
freshness: "unknown",
|
|
8797
|
+
rebuildStatus: "unavailable",
|
|
8798
|
+
failureReason: "Orama index is not initialized"
|
|
8799
|
+
};
|
|
8800
|
+
let embeddingHealth;
|
|
8801
|
+
try {
|
|
8802
|
+
embeddingHealth = getEmbeddingRuntimeHealth?.();
|
|
8803
|
+
} catch {
|
|
8804
|
+
}
|
|
8805
|
+
views.embedding = embeddingHealthReceipt(embeddingHealth, embeddingEnabled);
|
|
8806
|
+
return views;
|
|
8807
|
+
}
|
|
8622
8808
|
function rememberSearchDiagnostics(key, value) {
|
|
8623
8809
|
if (!lastSearchDiagnosticsByProject.has(key) && lastSearchDiagnosticsByProject.size >= MAX_SEARCH_MODE_KEYS) {
|
|
8624
8810
|
const oldest = lastSearchDiagnosticsByProject.keys().next().value;
|
|
@@ -8920,12 +9106,16 @@ function getVectorDimensions() {
|
|
|
8920
9106
|
function getActiveSemanticIndexProfile() {
|
|
8921
9107
|
return indexEmbeddingProvider ? createSemanticIndexProfile(indexEmbeddingProvider) : null;
|
|
8922
9108
|
}
|
|
9109
|
+
async function getPersistentSemanticVectorIds(dataDir) {
|
|
9110
|
+
if (!indexEmbeddingProvider) return null;
|
|
9111
|
+
return listSemanticVectorIds(dataDir, createSemanticIndexProfile(indexEmbeddingProvider));
|
|
9112
|
+
}
|
|
8923
9113
|
async function queueSemanticVector(dataDir, record80) {
|
|
8924
9114
|
const provider2 = indexEmbeddingProvider ?? await getEmbeddingProvider();
|
|
8925
9115
|
const profile = provider2 ? createSemanticIndexProfile(provider2) : null;
|
|
8926
9116
|
if (!profile) return;
|
|
8927
9117
|
try {
|
|
8928
|
-
await
|
|
9118
|
+
await upsertSemanticVector(dataDir, profile, record80);
|
|
8929
9119
|
} catch {
|
|
8930
9120
|
}
|
|
8931
9121
|
}
|
|
@@ -8987,6 +9177,7 @@ function isCompatibleCachedVector(vector) {
|
|
|
8987
9177
|
async function attachCachedVectors(database, observations2) {
|
|
8988
9178
|
const semanticDataDir = (await Promise.resolve().then(() => (init_observations(), observations_exports))).getObservationDataDir();
|
|
8989
9179
|
const semanticProfile = getActiveSemanticIndexProfile();
|
|
9180
|
+
const persistedSemanticIds = semanticDataDir && semanticProfile ? await listSemanticVectorIds(semanticDataDir, semanticProfile).catch(() => null) : null;
|
|
8990
9181
|
const batchSize = 200;
|
|
8991
9182
|
for (let start = 0; start < observations2.length; start += batchSize) {
|
|
8992
9183
|
const batch = observations2.slice(start, start + batchSize);
|
|
@@ -8997,7 +9188,7 @@ async function attachCachedVectors(database, observations2) {
|
|
|
8997
9188
|
const vector = cachedVectors[index];
|
|
8998
9189
|
if (!isCompatibleCachedVector(vector)) continue;
|
|
8999
9190
|
const observation = batch[index];
|
|
9000
|
-
if (semanticDataDir && semanticProfile) {
|
|
9191
|
+
if (semanticDataDir && semanticProfile && !persistedSemanticIds?.has(observation.id)) {
|
|
9001
9192
|
semanticRecords.push({
|
|
9002
9193
|
observationId: observation.id,
|
|
9003
9194
|
projectId: observation.projectId,
|
|
@@ -9770,6 +9961,7 @@ var init_orama_store = __esm({
|
|
|
9770
9961
|
init_mini_skills();
|
|
9771
9962
|
init_visibility();
|
|
9772
9963
|
init_provider();
|
|
9964
|
+
init_provider();
|
|
9773
9965
|
init_project_affinity();
|
|
9774
9966
|
init_intent_detector();
|
|
9775
9967
|
init_query_expansion();
|
|
@@ -9777,6 +9969,7 @@ var init_orama_store = __esm({
|
|
|
9777
9969
|
init_timeout();
|
|
9778
9970
|
init_obs_store();
|
|
9779
9971
|
init_semantic_index();
|
|
9972
|
+
init_derived_view_receipt();
|
|
9780
9973
|
db = null;
|
|
9781
9974
|
dbInitPromise = null;
|
|
9782
9975
|
dbGeneration = 0;
|
|
@@ -9901,36 +10094,6 @@ var init_entity_extractor = __esm({
|
|
|
9901
10094
|
}
|
|
9902
10095
|
});
|
|
9903
10096
|
|
|
9904
|
-
// src/memory/secret-filter.ts
|
|
9905
|
-
function applyRedaction(text3) {
|
|
9906
|
-
if (!text3) return text3;
|
|
9907
|
-
let out = text3;
|
|
9908
|
-
out = out.replace(
|
|
9909
|
-
/((?:password|passwd|pwd|secret|token|api[_-]?key|auth[_-]?key|access[_-]?key|private[_-]?key|client[_-]?secret)\s*[:=]\s*["']?)([^\s"',;\n]{6,})/gi,
|
|
9910
|
-
"$1[REDACTED]"
|
|
9911
|
-
);
|
|
9912
|
-
out = out.replace(
|
|
9913
|
-
/(Bearer\s+)([A-Za-z0-9._\-/+]{20,})/g,
|
|
9914
|
-
"$1[REDACTED]"
|
|
9915
|
-
);
|
|
9916
|
-
out = out.replace(/\b(?:ghp|ghs|gho|github_pat)_[A-Za-z0-9]{36,}\b/g, "[REDACTED]");
|
|
9917
|
-
out = out.replace(/\bsk-[A-Za-z0-9T-]{20,}\b/g, "[REDACTED]");
|
|
9918
|
-
out = out.replace(/\beyJ[A-Za-z0-9._-]{40,}\b/g, "[REDACTED]");
|
|
9919
|
-
return out;
|
|
9920
|
-
}
|
|
9921
|
-
function sanitizeCredentials(text3) {
|
|
9922
|
-
return applyRedaction(text3);
|
|
9923
|
-
}
|
|
9924
|
-
function redactCredentials(text3) {
|
|
9925
|
-
return applyRedaction(text3);
|
|
9926
|
-
}
|
|
9927
|
-
var init_secret_filter = __esm({
|
|
9928
|
-
"src/memory/secret-filter.ts"() {
|
|
9929
|
-
"use strict";
|
|
9930
|
-
init_esm_shims();
|
|
9931
|
-
}
|
|
9932
|
-
});
|
|
9933
|
-
|
|
9934
10097
|
// src/runtime/maintenance-jobs.ts
|
|
9935
10098
|
var maintenance_jobs_exports = {};
|
|
9936
10099
|
__export(maintenance_jobs_exports, {
|
|
@@ -10781,7 +10944,7 @@ var init_maintenance_targets = __esm({
|
|
|
10781
10944
|
|
|
10782
10945
|
// src/runtime/isolated-maintenance.ts
|
|
10783
10946
|
import { spawn } from "child_process";
|
|
10784
|
-
import { existsSync as
|
|
10947
|
+
import { existsSync as existsSync9 } from "fs";
|
|
10785
10948
|
import os4 from "os";
|
|
10786
10949
|
import path13 from "path";
|
|
10787
10950
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
@@ -10799,7 +10962,7 @@ function childError(prefix, detail) {
|
|
|
10799
10962
|
}
|
|
10800
10963
|
function isolatedMaintenanceCwd() {
|
|
10801
10964
|
const tmp = os4.tmpdir();
|
|
10802
|
-
return
|
|
10965
|
+
return existsSync9(tmp) ? tmp : process.cwd();
|
|
10803
10966
|
}
|
|
10804
10967
|
function resolveMaintenanceRunnerPath(moduleUrl = import.meta.url) {
|
|
10805
10968
|
const moduleDir = path13.dirname(fileURLToPath2(moduleUrl));
|
|
@@ -10856,7 +11019,7 @@ function collectOutput(stream2, limit2, onOverflow) {
|
|
|
10856
11019
|
async function runMaintenanceInChildProcess(request, options = {}) {
|
|
10857
11020
|
validateRequest(request);
|
|
10858
11021
|
const runnerPath = options.runnerPath ?? resolveMaintenanceRunnerPath();
|
|
10859
|
-
if (!
|
|
11022
|
+
if (!existsSync9(runnerPath)) {
|
|
10860
11023
|
throw new Error(`Maintenance runner is unavailable at ${runnerPath}. Reinstall or rebuild Memorix.`);
|
|
10861
11024
|
}
|
|
10862
11025
|
const timeoutMs = Number.isFinite(options.timeoutMs) ? Math.max(1e3, Math.floor(options.timeoutMs)) : DEFAULT_TIMEOUT_MS;
|
|
@@ -146011,7 +146174,7 @@ __export(video_jobs_exports, {
|
|
|
146011
146174
|
runMiniMaxVideoGenerationJob: () => runMiniMaxVideoGenerationJob
|
|
146012
146175
|
});
|
|
146013
146176
|
import { spawn as spawn2 } from "child_process";
|
|
146014
|
-
import { existsSync as
|
|
146177
|
+
import { existsSync as existsSync10 } from "fs";
|
|
146015
146178
|
import path19 from "path";
|
|
146016
146179
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
146017
146180
|
function safeError2(error) {
|
|
@@ -146259,7 +146422,7 @@ function resolveMediaVideoRunnerPath(moduleUrl = import.meta.url) {
|
|
|
146259
146422
|
}
|
|
146260
146423
|
function launchMediaVideoRunner(request, options = {}) {
|
|
146261
146424
|
const runnerPath = options.runnerPath ?? resolveMediaVideoRunnerPath();
|
|
146262
|
-
if (!
|
|
146425
|
+
if (!existsSync10(runnerPath)) {
|
|
146263
146426
|
return { launched: false, reason: "Media video runner is unavailable until Memorix is built or reinstalled." };
|
|
146264
146427
|
}
|
|
146265
146428
|
try {
|
|
@@ -146304,7 +146467,7 @@ __export(audio_jobs_exports, {
|
|
|
146304
146467
|
transcribeAudio: () => transcribeAudio
|
|
146305
146468
|
});
|
|
146306
146469
|
import { spawn as spawn3 } from "child_process";
|
|
146307
|
-
import { existsSync as
|
|
146470
|
+
import { existsSync as existsSync11 } from "fs";
|
|
146308
146471
|
import path20 from "path";
|
|
146309
146472
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
146310
146473
|
function safeError3(error) {
|
|
@@ -146555,7 +146718,7 @@ function resolveMediaAudioRunnerPath(moduleUrl = import.meta.url) {
|
|
|
146555
146718
|
}
|
|
146556
146719
|
function launchMediaAudioRunner(request, options = {}) {
|
|
146557
146720
|
const runnerPath = options.runnerPath ?? resolveMediaAudioRunnerPath();
|
|
146558
|
-
if (!
|
|
146721
|
+
if (!existsSync11(runnerPath)) return { launched: false, reason: "Audio runner is unavailable until Memorix is built or reinstalled." };
|
|
146559
146722
|
try {
|
|
146560
146723
|
const child = spawn3(process.execPath, [runnerPath, JSON.stringify(request)], {
|
|
146561
146724
|
cwd: request.projectRoot,
|
|
@@ -149524,7 +149687,7 @@ __export(lite_provider_exports, {
|
|
|
149524
149687
|
refreshProjectLite: () => refreshProjectLite
|
|
149525
149688
|
});
|
|
149526
149689
|
import { createHash as createHash11 } from "crypto";
|
|
149527
|
-
import { existsSync as
|
|
149690
|
+
import { existsSync as existsSync13, readdirSync as readdirSync2, readFileSync as readFileSync8, statSync as statSync3 } from "fs";
|
|
149528
149691
|
import { join as join4, relative as relative2 } from "path";
|
|
149529
149692
|
function hashText2(text3) {
|
|
149530
149693
|
return createHash11("sha256").update(text3).digest("hex");
|
|
@@ -149542,7 +149705,7 @@ function resolveMaxFileBytes(value) {
|
|
|
149542
149705
|
return Math.max(1, Math.floor(value));
|
|
149543
149706
|
}
|
|
149544
149707
|
function isPythonVirtualenvDir(dir) {
|
|
149545
|
-
return
|
|
149708
|
+
return existsSync13(join4(dir, "pyvenv.cfg"));
|
|
149546
149709
|
}
|
|
149547
149710
|
function walk(root, exclude, maxFiles) {
|
|
149548
149711
|
const out = [];
|
|
@@ -153458,7 +153621,7 @@ __export(vector_backfill_runner_exports, {
|
|
|
153458
153621
|
import { spawn as spawn4 } from "child_process";
|
|
153459
153622
|
import {
|
|
153460
153623
|
closeSync,
|
|
153461
|
-
existsSync as
|
|
153624
|
+
existsSync as existsSync14,
|
|
153462
153625
|
mkdirSync as mkdirSync2,
|
|
153463
153626
|
openSync,
|
|
153464
153627
|
readFileSync as readFileSync9,
|
|
@@ -153586,7 +153749,7 @@ function releaseVectorBackfillLock(lockPath = process.env.MEMORIX_VECTOR_BACKFIL
|
|
|
153586
153749
|
}
|
|
153587
153750
|
function launchDetachedVectorBackfill(request, options = {}) {
|
|
153588
153751
|
const runnerPath = options.runnerPath ?? resolveVectorBackfillRunnerPath();
|
|
153589
|
-
const exists = options.exists ??
|
|
153752
|
+
const exists = options.exists ?? existsSync14;
|
|
153590
153753
|
if (!exists(runnerPath)) return false;
|
|
153591
153754
|
const lock = acquireVectorBackfillLock(request.dataDir, request.projectId, options.lockPath);
|
|
153592
153755
|
if (!lock) return false;
|
|
@@ -154605,13 +154768,14 @@ async function prepareSearchIndex(options = {}) {
|
|
|
154605
154768
|
return 0;
|
|
154606
154769
|
}
|
|
154607
154770
|
const hydratedProjectDir = projectDir;
|
|
154608
|
-
const queueMissingVectors = () => {
|
|
154609
|
-
if (projectDir !== hydratedProjectDir) return;
|
|
154771
|
+
const queueMissingVectors = async () => {
|
|
154772
|
+
if (!hydratedProjectDir || projectDir !== hydratedProjectDir) return;
|
|
154610
154773
|
vectorMissingIds.clear();
|
|
154611
154774
|
if (!isEmbeddingExplicitlyDisabled()) {
|
|
154775
|
+
const persistedSemanticIds = await getPersistentSemanticVectorIds(hydratedProjectDir).catch(() => null);
|
|
154612
154776
|
const projectsWithMissingVectors = /* @__PURE__ */ new Set();
|
|
154613
154777
|
for (const obs of observations) {
|
|
154614
|
-
if (!hasObservationVector(obs.projectId, obs.id)) {
|
|
154778
|
+
if (!hasObservationVector(obs.projectId, obs.id) && !persistedSemanticIds?.has(obs.id)) {
|
|
154615
154779
|
vectorMissingIds.add(obs.id);
|
|
154616
154780
|
projectsWithMissingVectors.add(obs.projectId);
|
|
154617
154781
|
}
|
|
@@ -154621,9 +154785,9 @@ async function prepareSearchIndex(options = {}) {
|
|
|
154621
154785
|
};
|
|
154622
154786
|
const cacheHydration = getDeferredCachedVectorHydration();
|
|
154623
154787
|
if (cacheHydration) {
|
|
154624
|
-
void cacheHydration.
|
|
154788
|
+
void cacheHydration.then(queueMissingVectors, queueMissingVectors).catch(() => void 0);
|
|
154625
154789
|
} else {
|
|
154626
|
-
queueMissingVectors();
|
|
154790
|
+
await queueMissingVectors();
|
|
154627
154791
|
}
|
|
154628
154792
|
searchIndexPrepared = true;
|
|
154629
154793
|
return count2;
|
|
@@ -155717,6 +155881,14 @@ This project does have stored Memorix memories, but none matched the current que
|
|
|
155717
155881
|
}
|
|
155718
155882
|
const totalTokens = countTextTokens(formatted);
|
|
155719
155883
|
const diagnostics = getLastSearchDiagnostics(options.projectId);
|
|
155884
|
+
const derivedViews = getSearchDerivedViews();
|
|
155885
|
+
if (diagnostics?.fallbackUsed && diagnostics.fallbackReason) {
|
|
155886
|
+
derivedViews.embedding = {
|
|
155887
|
+
freshness: "stale",
|
|
155888
|
+
rebuildStatus: "failed",
|
|
155889
|
+
failureReason: diagnostics.fallbackReason
|
|
155890
|
+
};
|
|
155891
|
+
}
|
|
155720
155892
|
return {
|
|
155721
155893
|
entries,
|
|
155722
155894
|
formatted,
|
|
@@ -155731,6 +155903,7 @@ This project does have stored Memorix memories, but none matched the current que
|
|
|
155731
155903
|
omittedByTokenBudget: diagnostics?.omittedByTokenBudget ?? 0,
|
|
155732
155904
|
fallbackUsed: diagnostics?.fallbackUsed ?? false,
|
|
155733
155905
|
...diagnostics?.fallbackReason ? { fallbackReason: diagnostics.fallbackReason } : {},
|
|
155906
|
+
derivedViews,
|
|
155734
155907
|
tokenCount: totalTokens,
|
|
155735
155908
|
elapsedMs: Math.max(0, Date.now() - startedAt)
|
|
155736
155909
|
}
|
|
@@ -158551,7 +158724,7 @@ var init_sanitizer = __esm({
|
|
|
158551
158724
|
});
|
|
158552
158725
|
|
|
158553
158726
|
// src/workspace/applier.ts
|
|
158554
|
-
import { existsSync as
|
|
158727
|
+
import { existsSync as existsSync15, mkdirSync as mkdirSync3, copyFileSync, writeFileSync as writeFileSync3, unlinkSync as unlinkSync2, renameSync } from "fs";
|
|
158555
158728
|
import { dirname } from "path";
|
|
158556
158729
|
var WorkspaceSyncApplier;
|
|
158557
158730
|
var init_applier = __esm({
|
|
@@ -158582,7 +158755,7 @@ var init_applier = __esm({
|
|
|
158582
158755
|
for (const file of files) {
|
|
158583
158756
|
try {
|
|
158584
158757
|
const dir = dirname(file.filePath);
|
|
158585
|
-
if (!
|
|
158758
|
+
if (!existsSync15(dir)) {
|
|
158586
158759
|
mkdirSync3(dir, { recursive: true });
|
|
158587
158760
|
}
|
|
158588
158761
|
} catch (err) {
|
|
@@ -158591,7 +158764,7 @@ var init_applier = __esm({
|
|
|
158591
158764
|
}
|
|
158592
158765
|
}
|
|
158593
158766
|
for (const file of files) {
|
|
158594
|
-
if (
|
|
158767
|
+
if (existsSync15(file.filePath)) {
|
|
158595
158768
|
try {
|
|
158596
158769
|
const backupPath = file.filePath + `.backup-${Date.now()}`;
|
|
158597
158770
|
copyFileSync(file.filePath, backupPath);
|
|
@@ -158642,7 +158815,7 @@ var init_applier = __esm({
|
|
|
158642
158815
|
cleanBackups(backups) {
|
|
158643
158816
|
for (const backup of backups) {
|
|
158644
158817
|
try {
|
|
158645
|
-
if (
|
|
158818
|
+
if (existsSync15(backup.backupPath)) {
|
|
158646
158819
|
unlinkSync2(backup.backupPath);
|
|
158647
158820
|
}
|
|
158648
158821
|
} catch {
|
|
@@ -158654,7 +158827,7 @@ var init_applier = __esm({
|
|
|
158654
158827
|
});
|
|
158655
158828
|
|
|
158656
158829
|
// src/workspace/engine.ts
|
|
158657
|
-
import { readFileSync as readFileSync10, readdirSync as readdirSync3, existsSync as
|
|
158830
|
+
import { readFileSync as readFileSync10, readdirSync as readdirSync3, existsSync as existsSync16, cpSync, mkdirSync as mkdirSync4 } from "fs";
|
|
158658
158831
|
import { join as join19 } from "path";
|
|
158659
158832
|
import { homedir as homedir21 } from "os";
|
|
158660
158833
|
var WorkspaceSyncEngine;
|
|
@@ -158734,7 +158907,7 @@ var init_engine4 = __esm({
|
|
|
158734
158907
|
}
|
|
158735
158908
|
const merged = /* @__PURE__ */ new Map();
|
|
158736
158909
|
for (const path38 of pathsToCheck) {
|
|
158737
|
-
if (
|
|
158910
|
+
if (existsSync16(path38)) {
|
|
158738
158911
|
try {
|
|
158739
158912
|
const content = readFileSync10(path38, "utf-8");
|
|
158740
158913
|
const servers = adapter.parse(content);
|
|
@@ -158788,7 +158961,7 @@ var init_engine4 = __esm({
|
|
|
158788
158961
|
const adapter = this.adapters.get(target);
|
|
158789
158962
|
const configPath = adapter.getConfigPath(this.projectRoot);
|
|
158790
158963
|
let configContent;
|
|
158791
|
-
if (target === "antigravity" &&
|
|
158964
|
+
if (target === "antigravity" && existsSync16(configPath)) {
|
|
158792
158965
|
try {
|
|
158793
158966
|
const existing = JSON.parse(readFileSync10(configPath, "utf-8"));
|
|
158794
158967
|
const generated = JSON.parse(adapter.generate(result.mcpServers.scanned));
|
|
@@ -158864,13 +159037,13 @@ var init_engine4 = __esm({
|
|
|
158864
159037
|
join19(home, dir)
|
|
158865
159038
|
];
|
|
158866
159039
|
for (const skillsRoot of paths) {
|
|
158867
|
-
if (!
|
|
159040
|
+
if (!existsSync16(skillsRoot)) continue;
|
|
158868
159041
|
try {
|
|
158869
159042
|
const entries = readdirSync3(skillsRoot, { withFileTypes: true });
|
|
158870
159043
|
for (const entry of entries) {
|
|
158871
159044
|
if (!entry.isDirectory()) continue;
|
|
158872
159045
|
const skillMd = join19(skillsRoot, entry.name, "SKILL.md");
|
|
158873
|
-
if (!
|
|
159046
|
+
if (!existsSync16(skillMd)) continue;
|
|
158874
159047
|
let description = "";
|
|
158875
159048
|
try {
|
|
158876
159049
|
const content = readFileSync10(skillMd, "utf-8");
|
|
@@ -158919,7 +159092,7 @@ var init_engine4 = __esm({
|
|
|
158919
159092
|
for (const skill2 of skills) {
|
|
158920
159093
|
if (skill2.sourceAgent === target) continue;
|
|
158921
159094
|
const dest = join19(targetDir, skill2.name);
|
|
158922
|
-
if (
|
|
159095
|
+
if (existsSync16(dest)) {
|
|
158923
159096
|
skipped.push(`${skill2.name} (already exists in ${target})`);
|
|
158924
159097
|
continue;
|
|
158925
159098
|
}
|
|
@@ -158935,7 +159108,7 @@ var init_engine4 = __esm({
|
|
|
158935
159108
|
scanWorkflows() {
|
|
158936
159109
|
const workflows = [];
|
|
158937
159110
|
const wfDir = join19(this.projectRoot, ".windsurf", "workflows");
|
|
158938
|
-
if (!
|
|
159111
|
+
if (!existsSync16(wfDir)) return workflows;
|
|
158939
159112
|
try {
|
|
158940
159113
|
const files = readdirSync3(wfDir).filter((f3) => f3.endsWith(".md"));
|
|
158941
159114
|
for (const file of files) {
|
|
@@ -160381,7 +160554,7 @@ var init_request_context = __esm({
|
|
|
160381
160554
|
function getMcpServerInfo() {
|
|
160382
160555
|
return {
|
|
160383
160556
|
name: "memorix",
|
|
160384
|
-
version: true ? "1.10.
|
|
160557
|
+
version: true ? "1.10.2" : "1.0.1"
|
|
160385
160558
|
};
|
|
160386
160559
|
}
|
|
160387
160560
|
function createMcpDiscoverResult(capabilities, serverInfo) {
|
|
@@ -160449,7 +160622,7 @@ __export(behavior_exports, {
|
|
|
160449
160622
|
getBehaviorConfig: () => getBehaviorConfig,
|
|
160450
160623
|
resetBehaviorConfigCache: () => resetBehaviorConfigCache
|
|
160451
160624
|
});
|
|
160452
|
-
import { existsSync as
|
|
160625
|
+
import { existsSync as existsSync17, readFileSync as readFileSync11 } from "fs";
|
|
160453
160626
|
import { homedir as homedir22 } from "os";
|
|
160454
160627
|
function isSessionInject(value) {
|
|
160455
160628
|
return value === "full" || value === "minimal" || value === "silent";
|
|
@@ -160460,7 +160633,7 @@ function isFormationMode(value) {
|
|
|
160460
160633
|
function legacyBehavior(homeDir) {
|
|
160461
160634
|
const configPath = getLegacyConfigJsonPath(homeDir);
|
|
160462
160635
|
try {
|
|
160463
|
-
if (!
|
|
160636
|
+
if (!existsSync17(configPath)) return {};
|
|
160464
160637
|
const parsed = JSON.parse(readFileSync11(configPath, "utf-8"));
|
|
160465
160638
|
return parsed.behavior && typeof parsed.behavior === "object" && !Array.isArray(parsed.behavior) ? parsed.behavior : {};
|
|
160466
160639
|
} catch {
|
|
@@ -161823,6 +161996,10 @@ async function buildTaskWorkset(input) {
|
|
|
161823
161996
|
budget: { maxTokens }
|
|
161824
161997
|
});
|
|
161825
161998
|
const omittedReceipt = receiptOmissions(rendered.omittedItems, base.hiddenCautionMemoryCount);
|
|
161999
|
+
const derivedViews = {
|
|
162000
|
+
...getSearchDerivedViews(),
|
|
162001
|
+
...input.retrieval?.derivedViews ?? {}
|
|
162002
|
+
};
|
|
161826
162003
|
const retrieval = {
|
|
161827
162004
|
mode: input.retrieval?.mode ?? (input.semanticCode ? "hybrid" : "unknown"),
|
|
161828
162005
|
...input.retrieval?.codeProvider || input.providerQuality?.selected ? { codeProvider: input.retrieval?.codeProvider ?? input.providerQuality?.selected } : {},
|
|
@@ -161830,7 +162007,8 @@ async function buildTaskWorkset(input) {
|
|
|
161830
162007
|
...input.retrieval?.fallbackReason ? { fallbackReason: input.retrieval.fallbackReason } : {},
|
|
161831
162008
|
candidateCount: governed.plan.decisions.length,
|
|
161832
162009
|
selectedCount: rendered.selected.length,
|
|
161833
|
-
omittedCount: omittedReceipt.reduce((total, omission) => total + omission.count, 0)
|
|
162010
|
+
omittedCount: omittedReceipt.reduce((total, omission) => total + omission.count, 0),
|
|
162011
|
+
derivedViews
|
|
161834
162012
|
};
|
|
161835
162013
|
const receipt = {
|
|
161836
162014
|
version: "1.3",
|
|
@@ -161889,6 +162067,7 @@ var init_workset = __esm({
|
|
|
161889
162067
|
init_workflows2();
|
|
161890
162068
|
init_long_term();
|
|
161891
162069
|
init_governor();
|
|
162070
|
+
init_orama_store();
|
|
161892
162071
|
CONTINUATION_DETAIL_TOKEN_BUDGET = 20;
|
|
161893
162072
|
}
|
|
161894
162073
|
});
|
|
@@ -161900,11 +162079,11 @@ __export(current_facts_exports, {
|
|
|
161900
162079
|
formatGitFact: () => formatGitFact
|
|
161901
162080
|
});
|
|
161902
162081
|
import { execFileSync } from "child_process";
|
|
161903
|
-
import { existsSync as
|
|
162082
|
+
import { existsSync as existsSync18, readFileSync as readFileSync12 } from "fs";
|
|
161904
162083
|
import path29 from "path";
|
|
161905
162084
|
function readTextIfExists(filePath) {
|
|
161906
162085
|
try {
|
|
161907
|
-
if (!
|
|
162086
|
+
if (!existsSync18(filePath)) return null;
|
|
161908
162087
|
return readFileSync12(filePath, "utf8");
|
|
161909
162088
|
} catch {
|
|
161910
162089
|
return null;
|
|
@@ -162195,7 +162374,7 @@ __export(external_provider_exports, {
|
|
|
162195
162374
|
runExternalCodeGraphLifecycle: () => runExternalCodeGraphLifecycle
|
|
162196
162375
|
});
|
|
162197
162376
|
import { spawn as spawn5 } from "child_process";
|
|
162198
|
-
import { existsSync as
|
|
162377
|
+
import { existsSync as existsSync19, readFileSync as readFileSync13 } from "fs";
|
|
162199
162378
|
import { delimiter, dirname as dirname2, extname, isAbsolute as isAbsolute3, join as join20, relative as relative4, resolve as resolve3, sep } from "path";
|
|
162200
162379
|
function boundedTimeout(value) {
|
|
162201
162380
|
if (!Number.isFinite(value)) return DEFAULT_EXTERNAL_CODEGRAPH_TIMEOUT_MS;
|
|
@@ -162232,13 +162411,13 @@ function resolveCommandCandidates(command) {
|
|
|
162232
162411
|
}
|
|
162233
162412
|
function resolveLaunch(command) {
|
|
162234
162413
|
for (const candidate of resolveCommandCandidates(command)) {
|
|
162235
|
-
if (!
|
|
162414
|
+
if (!existsSync19(candidate)) continue;
|
|
162236
162415
|
const extension3 = extname(candidate).toLowerCase();
|
|
162237
162416
|
if (extension3 === ".cmd") {
|
|
162238
162417
|
const bundleRoot = resolve3(dirname2(candidate), "..");
|
|
162239
162418
|
const node = join20(bundleRoot, "node.exe");
|
|
162240
162419
|
const entry = join20(bundleRoot, "lib", "dist", "bin", "codegraph.js");
|
|
162241
|
-
if (
|
|
162420
|
+
if (existsSync19(node) && existsSync19(entry)) {
|
|
162242
162421
|
return { executable: node, prefixArgs: ["--liftoff-only", entry] };
|
|
162243
162422
|
}
|
|
162244
162423
|
try {
|
|
@@ -162247,7 +162426,7 @@ function resolveLaunch(command) {
|
|
|
162247
162426
|
if (match2?.[1]) {
|
|
162248
162427
|
const base = dirname2(candidate).endsWith(sep) ? dirname2(candidate) : dirname2(candidate) + sep;
|
|
162249
162428
|
const entry2 = resolve3(match2[1].replace(/%(?:~)?dp0%?/gi, base));
|
|
162250
|
-
if (
|
|
162429
|
+
if (existsSync19(entry2)) return { executable: process.execPath, prefixArgs: [entry2] };
|
|
162251
162430
|
}
|
|
162252
162431
|
} catch {
|
|
162253
162432
|
}
|
|
@@ -162395,7 +162574,7 @@ async function inspectExternalCodeGraph(input) {
|
|
|
162395
162574
|
const health2 = { state: "disabled", reason: "External CodeGraph is disabled by configuration." };
|
|
162396
162575
|
return { health: health2, quality: providerQuality({ mode, health: health2 }) };
|
|
162397
162576
|
}
|
|
162398
|
-
if (!
|
|
162577
|
+
if (!existsSync19(join20(input.projectRoot, ".codegraph"))) {
|
|
162399
162578
|
const health2 = { state: "not-detected", reason: "No local .codegraph index is present for this project." };
|
|
162400
162579
|
return { health: health2, quality: providerQuality({ mode, health: health2 }) };
|
|
162401
162580
|
}
|
|
@@ -162431,7 +162610,7 @@ async function runExternalCodeGraphLifecycle(input) {
|
|
|
162431
162610
|
};
|
|
162432
162611
|
}
|
|
162433
162612
|
const indexPath = join20(input.projectRoot, ".codegraph");
|
|
162434
|
-
if (input.action === "sync" && !
|
|
162613
|
+
if (input.action === "sync" && !existsSync19(indexPath)) {
|
|
162435
162614
|
const health = { state: "not-detected", reason: "No local .codegraph index is present for this project." };
|
|
162436
162615
|
return {
|
|
162437
162616
|
action: input.action,
|
|
@@ -162441,7 +162620,7 @@ async function runExternalCodeGraphLifecycle(input) {
|
|
|
162441
162620
|
quality: providerQuality({ mode, health })
|
|
162442
162621
|
};
|
|
162443
162622
|
}
|
|
162444
|
-
if (input.action === "init" &&
|
|
162623
|
+
if (input.action === "init" && existsSync19(indexPath)) {
|
|
162445
162624
|
const inspected2 = await inspectExternalCodeGraph(input);
|
|
162446
162625
|
return {
|
|
162447
162626
|
action: input.action,
|
|
@@ -163188,6 +163367,61 @@ var init_project_context = __esm({
|
|
|
163188
163367
|
}
|
|
163189
163368
|
});
|
|
163190
163369
|
|
|
163370
|
+
// src/knowledge/context-receipt.ts
|
|
163371
|
+
var context_receipt_exports = {};
|
|
163372
|
+
__export(context_receipt_exports, {
|
|
163373
|
+
buildBoundedContextReceipt: () => buildBoundedContextReceipt,
|
|
163374
|
+
buildCodeGraphDerivedView: () => buildCodeGraphDerivedView
|
|
163375
|
+
});
|
|
163376
|
+
function buildCodeGraphDerivedView(input) {
|
|
163377
|
+
const provider2 = input.providerQuality;
|
|
163378
|
+
const snapshot = input.snapshot;
|
|
163379
|
+
const externalFailure = provider2?.external.state !== void 0 && !["ready", "disabled", "not-detected"].includes(provider2.external.state);
|
|
163380
|
+
if (snapshot?.id) {
|
|
163381
|
+
return {
|
|
163382
|
+
...snapshot.sourceEpoch !== void 0 ? { generation: snapshot.sourceEpoch } : {},
|
|
163383
|
+
freshness: snapshot.incomplete ? "stale" : "current",
|
|
163384
|
+
rebuildStatus: snapshot.incomplete ? "failed" : "idle",
|
|
163385
|
+
...snapshot.incomplete ? { failureReason: "latest CodeGraph snapshot is incomplete" } : externalFailure && provider2?.external.reason ? { failureReason: sanitizeDerivedViewFailureReason(provider2.external.reason) } : {}
|
|
163386
|
+
};
|
|
163387
|
+
}
|
|
163388
|
+
return {
|
|
163389
|
+
freshness: "unknown",
|
|
163390
|
+
rebuildStatus: externalFailure ? "failed" : "unavailable",
|
|
163391
|
+
...provider2?.external.reason ? { failureReason: sanitizeDerivedViewFailureReason(provider2.external.reason) } : { failureReason: "CodeGraph snapshot is not initialized" }
|
|
163392
|
+
};
|
|
163393
|
+
}
|
|
163394
|
+
function buildBoundedContextReceipt(input) {
|
|
163395
|
+
const provider2 = input.providerQuality ?? input.workset.provenance.codeProvider;
|
|
163396
|
+
return {
|
|
163397
|
+
schemaVersion: "1",
|
|
163398
|
+
task: input.workset.task,
|
|
163399
|
+
brief: input.workset.prompt,
|
|
163400
|
+
receipt: input.workset.receipt,
|
|
163401
|
+
code: {
|
|
163402
|
+
selected: provider2?.selected ?? "lite",
|
|
163403
|
+
quality: provider2?.selectedQuality ?? "heuristic",
|
|
163404
|
+
externalState: provider2?.external.state ?? "not-detected",
|
|
163405
|
+
...input.workset.provenance.snapshotId ? { snapshotId: input.workset.provenance.snapshotId } : {}
|
|
163406
|
+
},
|
|
163407
|
+
...input.workset.agentLoadout ? { loadout: input.workset.agentLoadout } : {},
|
|
163408
|
+
...input.workset.continuity ? {
|
|
163409
|
+
continuity: {
|
|
163410
|
+
taskId: input.workset.continuity.taskId,
|
|
163411
|
+
status: input.workset.continuity.status,
|
|
163412
|
+
outcome: input.workset.continuity.outcome
|
|
163413
|
+
}
|
|
163414
|
+
} : {}
|
|
163415
|
+
};
|
|
163416
|
+
}
|
|
163417
|
+
var init_context_receipt = __esm({
|
|
163418
|
+
"src/knowledge/context-receipt.ts"() {
|
|
163419
|
+
"use strict";
|
|
163420
|
+
init_esm_shims();
|
|
163421
|
+
init_derived_view_receipt();
|
|
163422
|
+
}
|
|
163423
|
+
});
|
|
163424
|
+
|
|
163191
163425
|
// src/store/compaction-checkpoint-store.ts
|
|
163192
163426
|
var compaction_checkpoint_store_exports = {};
|
|
163193
163427
|
__export(compaction_checkpoint_store_exports, {
|
|
@@ -163801,7 +164035,7 @@ __export(auto_context_exports, {
|
|
|
163801
164035
|
formatAutoProjectContextSummary: () => formatAutoProjectContextSummary,
|
|
163802
164036
|
formatLegacyAutoProjectContextPrompt: () => formatLegacyAutoProjectContextPrompt
|
|
163803
164037
|
});
|
|
163804
|
-
import { existsSync as
|
|
164038
|
+
import { existsSync as existsSync20, statSync as statSync5 } from "fs";
|
|
163805
164039
|
import path30 from "path";
|
|
163806
164040
|
function activeProjectObservations(observations2, projectId) {
|
|
163807
164041
|
return observations2.filter((obs) => obs.projectId === projectId && (obs.status ?? "active") === "active");
|
|
@@ -164077,7 +164311,19 @@ async function buildAutoProjectContext(input) {
|
|
|
164077
164311
|
retrieval: {
|
|
164078
164312
|
mode: semanticOutline ? "hybrid" : "lexical",
|
|
164079
164313
|
codeProvider: providerQuality2.selected,
|
|
164080
|
-
...externalCaution ? { fallbackReason: externalCaution } : {}
|
|
164314
|
+
...externalCaution ? { fallbackReason: externalCaution } : {},
|
|
164315
|
+
derivedViews: {
|
|
164316
|
+
graph: buildCodeGraphDerivedView({
|
|
164317
|
+
providerQuality: providerQuality2,
|
|
164318
|
+
...latestSnapshot ? {
|
|
164319
|
+
snapshot: {
|
|
164320
|
+
id: latestSnapshot.id,
|
|
164321
|
+
sourceEpoch: latestSnapshot.sourceEpoch,
|
|
164322
|
+
incomplete: latestSnapshot.completeness.skippedOversizedFiles > 0 || (latestSnapshot.completeness.unreadableFiles ?? 0) > 0 || latestSnapshot.completeness.removalScanDeferred
|
|
164323
|
+
}
|
|
164324
|
+
} : {}
|
|
164325
|
+
})
|
|
164326
|
+
}
|
|
164081
164327
|
},
|
|
164082
164328
|
currentFacts: worksetFactLines(currentFacts),
|
|
164083
164329
|
...continuation ? { continuation } : {},
|
|
@@ -164164,7 +164410,7 @@ function existingLensCandidates(rootPath, lens) {
|
|
|
164164
164410
|
for (const candidate of lensPathCandidates(lens)) {
|
|
164165
164411
|
const absolute = path30.join(rootPath, candidate);
|
|
164166
164412
|
try {
|
|
164167
|
-
if (!
|
|
164413
|
+
if (!existsSync20(absolute)) continue;
|
|
164168
164414
|
const stat5 = statSync5(absolute);
|
|
164169
164415
|
if (stat5.isFile()) out.push(candidate);
|
|
164170
164416
|
if (stat5.isDirectory()) out.push(candidate.replace(/\\/g, "/"));
|
|
@@ -164407,47 +164653,13 @@ var init_auto_context = __esm({
|
|
|
164407
164653
|
init_long_term();
|
|
164408
164654
|
init_visibility();
|
|
164409
164655
|
init_session_store();
|
|
164656
|
+
init_context_receipt();
|
|
164410
164657
|
init_task_lens();
|
|
164411
164658
|
DEFAULT_MAX_AGE_MS = 10 * 60 * 1e3;
|
|
164412
164659
|
COMPACT_CHECKPOINT_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
164413
164660
|
}
|
|
164414
164661
|
});
|
|
164415
164662
|
|
|
164416
|
-
// src/knowledge/context-receipt.ts
|
|
164417
|
-
var context_receipt_exports = {};
|
|
164418
|
-
__export(context_receipt_exports, {
|
|
164419
|
-
buildBoundedContextReceipt: () => buildBoundedContextReceipt
|
|
164420
|
-
});
|
|
164421
|
-
function buildBoundedContextReceipt(input) {
|
|
164422
|
-
const provider2 = input.providerQuality ?? input.workset.provenance.codeProvider;
|
|
164423
|
-
return {
|
|
164424
|
-
schemaVersion: "1",
|
|
164425
|
-
task: input.workset.task,
|
|
164426
|
-
brief: input.workset.prompt,
|
|
164427
|
-
receipt: input.workset.receipt,
|
|
164428
|
-
code: {
|
|
164429
|
-
selected: provider2?.selected ?? "lite",
|
|
164430
|
-
quality: provider2?.selectedQuality ?? "heuristic",
|
|
164431
|
-
externalState: provider2?.external.state ?? "not-detected",
|
|
164432
|
-
...input.workset.provenance.snapshotId ? { snapshotId: input.workset.provenance.snapshotId } : {}
|
|
164433
|
-
},
|
|
164434
|
-
...input.workset.agentLoadout ? { loadout: input.workset.agentLoadout } : {},
|
|
164435
|
-
...input.workset.continuity ? {
|
|
164436
|
-
continuity: {
|
|
164437
|
-
taskId: input.workset.continuity.taskId,
|
|
164438
|
-
status: input.workset.continuity.status,
|
|
164439
|
-
outcome: input.workset.continuity.outcome
|
|
164440
|
-
}
|
|
164441
|
-
} : {}
|
|
164442
|
-
};
|
|
164443
|
-
}
|
|
164444
|
-
var init_context_receipt = __esm({
|
|
164445
|
-
"src/knowledge/context-receipt.ts"() {
|
|
164446
|
-
"use strict";
|
|
164447
|
-
init_esm_shims();
|
|
164448
|
-
}
|
|
164449
|
-
});
|
|
164450
|
-
|
|
164451
164663
|
// src/codegraph/context-pack.ts
|
|
164452
164664
|
var context_pack_exports = {};
|
|
164453
164665
|
__export(context_pack_exports, {
|
|
@@ -164626,7 +164838,19 @@ async function attachTaskWorkset(input) {
|
|
|
164626
164838
|
...input.providerQuality ? { providerQuality: input.providerQuality } : {},
|
|
164627
164839
|
retrieval: {
|
|
164628
164840
|
mode: semanticCode ? "hybrid" : "unknown",
|
|
164629
|
-
...input.providerQuality?.selected ? { codeProvider: input.providerQuality.selected } : {}
|
|
164841
|
+
...input.providerQuality?.selected ? { codeProvider: input.providerQuality.selected } : {},
|
|
164842
|
+
derivedViews: {
|
|
164843
|
+
graph: buildCodeGraphDerivedView({
|
|
164844
|
+
providerQuality: input.providerQuality,
|
|
164845
|
+
...input.snapshot ? {
|
|
164846
|
+
snapshot: {
|
|
164847
|
+
id: input.snapshot.id,
|
|
164848
|
+
sourceEpoch: input.snapshot.sourceEpoch,
|
|
164849
|
+
incomplete: input.snapshot.incomplete
|
|
164850
|
+
}
|
|
164851
|
+
} : {}
|
|
164852
|
+
})
|
|
164853
|
+
}
|
|
164630
164854
|
},
|
|
164631
164855
|
reliableMemory: input.pack.memories.filter((memory) => memory.status === "current").map((memory) => ({
|
|
164632
164856
|
id: memory.id,
|
|
@@ -164698,6 +164922,7 @@ var init_context_pack = __esm({
|
|
|
164698
164922
|
"use strict";
|
|
164699
164923
|
init_esm_shims();
|
|
164700
164924
|
init_freshness2();
|
|
164925
|
+
init_context_receipt();
|
|
164701
164926
|
init_workset();
|
|
164702
164927
|
init_exclude3();
|
|
164703
164928
|
init_semantic_context();
|
|
@@ -164709,7 +164934,7 @@ var engine_exports2 = {};
|
|
|
164709
164934
|
__export(engine_exports2, {
|
|
164710
164935
|
SkillsEngine: () => SkillsEngine
|
|
164711
164936
|
});
|
|
164712
|
-
import { existsSync as
|
|
164937
|
+
import { existsSync as existsSync21, readFileSync as readFileSync14, writeFileSync as writeFileSync4, mkdirSync as mkdirSync5, readdirSync as readdirSync4 } from "fs";
|
|
164713
164938
|
import { join as join21 } from "path";
|
|
164714
164939
|
import { homedir as homedir23 } from "os";
|
|
164715
164940
|
var SKILLS_DIRS, SKILL_WORTHY_TYPES, MIN_OBS_FOR_SKILL, MIN_SCORE_FOR_SKILL, LOW_SIGNAL_TITLE_PATTERNS, LOW_SIGNAL_ENTITY_PATTERNS, COMMAND_TRACE_PATTERNS2, SkillsEngine;
|
|
@@ -164790,7 +165015,7 @@ var init_engine5 = __esm({
|
|
|
164790
165015
|
paths.push(join21(home, dir));
|
|
164791
165016
|
}
|
|
164792
165017
|
for (const skillsRoot of paths) {
|
|
164793
|
-
if (!
|
|
165018
|
+
if (!existsSync21(skillsRoot)) continue;
|
|
164794
165019
|
try {
|
|
164795
165020
|
const entries = readdirSync4(skillsRoot, { withFileTypes: true });
|
|
164796
165021
|
for (const entry of entries) {
|
|
@@ -164798,7 +165023,7 @@ var init_engine5 = __esm({
|
|
|
164798
165023
|
const name = entry.name;
|
|
164799
165024
|
if (seen.has(name)) continue;
|
|
164800
165025
|
const skillMd = join21(skillsRoot, name, "SKILL.md");
|
|
164801
|
-
if (!
|
|
165026
|
+
if (!existsSync21(skillMd)) continue;
|
|
164802
165027
|
try {
|
|
164803
165028
|
const content = readFileSync14(skillMd, "utf-8");
|
|
164804
165029
|
const description = this.parseDescription(content);
|
|
@@ -167822,7 +168047,7 @@ async function handleApi(req, res, dataDir, projectId, projectName, baseDir, pro
|
|
|
167822
168047
|
}
|
|
167823
168048
|
case "/config": {
|
|
167824
168049
|
const os6 = await import("os");
|
|
167825
|
-
const { existsSync:
|
|
168050
|
+
const { existsSync: existsSync24 } = await import("fs");
|
|
167826
168051
|
const { join: join26 } = await import("path");
|
|
167827
168052
|
const configProjectRoot = effectiveProjectRoot;
|
|
167828
168053
|
const resolved = getResolvedConfig({ projectRoot: configProjectRoot });
|
|
@@ -167850,7 +168075,7 @@ async function handleApi(req, res, dataDir, projectId, projectName, baseDir, pro
|
|
|
167850
168075
|
if (fpath === null) {
|
|
167851
168076
|
files[key] = { exists: false, path: "unavailable", unavailable: true };
|
|
167852
168077
|
} else {
|
|
167853
|
-
files[key] = { exists:
|
|
168078
|
+
files[key] = { exists: existsSync24(fpath), path: fpath };
|
|
167854
168079
|
}
|
|
167855
168080
|
}
|
|
167856
168081
|
} catch {
|
|
@@ -167874,7 +168099,8 @@ async function handleApi(req, res, dataDir, projectId, projectName, baseDir, pro
|
|
|
167874
168099
|
"ANTHROPIC_API_KEY",
|
|
167875
168100
|
...resolved.memory.llm.provider === "openrouter" || resolved.memory.llm.baseUrl?.includes("openrouter.ai") ? ["OPENROUTER_API_KEY"] : [],
|
|
167876
168101
|
...resolved.memory.llm.provider === "requesty" ? ["REQUESTY_API_KEY"] : [],
|
|
167877
|
-
...resolved.memory.llm.provider === "apiroute" ? ["API_ROUTE_API_KEY"] : []
|
|
168102
|
+
...resolved.memory.llm.provider === "apiroute" ? ["API_ROUTE_API_KEY"] : [],
|
|
168103
|
+
...resolved.memory.llm.provider === "cheaperinference" ? ["CHEAPER_INFERENCE_API_KEY"] : []
|
|
167878
168104
|
];
|
|
167879
168105
|
if (llmKey) {
|
|
167880
168106
|
const src = resolveDashboardKeySource({ value: llmKey, envKeys: memoryKeyEnv, configSource });
|
|
@@ -168661,7 +168887,7 @@ var init_task_graph = __esm({
|
|
|
168661
168887
|
|
|
168662
168888
|
// src/orchestrate/context-collector.ts
|
|
168663
168889
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
168664
|
-
import { readFileSync as readFileSync15, existsSync as
|
|
168890
|
+
import { readFileSync as readFileSync15, existsSync as existsSync22 } from "fs";
|
|
168665
168891
|
import { join as join22 } from "path";
|
|
168666
168892
|
function normalizeEntryLimit(value, fallback) {
|
|
168667
168893
|
if (!Number.isSafeInteger(value) || value < 1) return fallback;
|
|
@@ -168738,7 +168964,7 @@ function collectFileTree(projectDir2, maxEntries) {
|
|
|
168738
168964
|
function collectDependencies(projectDir2) {
|
|
168739
168965
|
try {
|
|
168740
168966
|
const pkgPath = join22(projectDir2, "package.json");
|
|
168741
|
-
if (!
|
|
168967
|
+
if (!existsSync22(pkgPath)) return "";
|
|
168742
168968
|
const pkg = JSON.parse(readFileSync15(pkgPath, "utf-8"));
|
|
168743
168969
|
const parts = [];
|
|
168744
168970
|
if (pkg.dependencies && Object.keys(pkg.dependencies).length > 0) {
|
|
@@ -169460,7 +169686,7 @@ async function analyzeImage(input) {
|
|
|
169460
169686
|
const config = getLLMConfig();
|
|
169461
169687
|
if (!OPENAI_COMPATIBLE_PROVIDERS.has(config.provider)) {
|
|
169462
169688
|
throw new Error(
|
|
169463
|
-
`Image analysis requires an OpenAI-compatible provider (openai, openrouter, requesty, apiroute, or custom). Current provider "${config.provider}" uses a different API shape. Set MEMORIX_LLM_PROVIDER=openai or configure an OpenAI-compatible base URL.`
|
|
169689
|
+
`Image analysis requires an OpenAI-compatible provider (openai, openrouter, requesty, apiroute, cheaperinference, or custom). Current provider "${config.provider}" uses a different API shape. Set MEMORIX_LLM_PROVIDER=openai or configure an OpenAI-compatible base URL.`
|
|
169464
169690
|
);
|
|
169465
169691
|
}
|
|
169466
169692
|
const bytes = decodeBase64ImagePayload(input.base64, MAX_VISION_IMAGE_BYTES);
|
|
@@ -169499,7 +169725,7 @@ var init_image_loader = __esm({
|
|
|
169499
169725
|
init_provider2();
|
|
169500
169726
|
init_secret_filter();
|
|
169501
169727
|
init_image_payload();
|
|
169502
|
-
OPENAI_COMPATIBLE_PROVIDERS = /* @__PURE__ */ new Set(["openai", "openrouter", "requesty", "apiroute", "custom"]);
|
|
169728
|
+
OPENAI_COMPATIBLE_PROVIDERS = /* @__PURE__ */ new Set(["openai", "openrouter", "requesty", "apiroute", "cheaperinference", "custom"]);
|
|
169503
169729
|
MAX_VISION_PROMPT_CHARS = 12e3;
|
|
169504
169730
|
MAX_VISION_DESCRIPTION_CHARS = 12e3;
|
|
169505
169731
|
MAX_VISION_LABELS = 50;
|
|
@@ -171559,11 +171785,11 @@ __export(hooks_path_exports, {
|
|
|
171559
171785
|
resolveGitDir: () => resolveGitDir,
|
|
171560
171786
|
resolveHooksDir: () => resolveHooksDir
|
|
171561
171787
|
});
|
|
171562
|
-
import { existsSync as
|
|
171788
|
+
import { existsSync as existsSync23, readFileSync as readFileSync16, statSync as statSync6, mkdirSync as mkdirSync6 } from "fs";
|
|
171563
171789
|
import path35 from "path";
|
|
171564
171790
|
function resolveGitDir(projectRoot) {
|
|
171565
171791
|
const dotGit = path35.join(projectRoot, ".git");
|
|
171566
|
-
if (!
|
|
171792
|
+
if (!existsSync23(dotGit)) return null;
|
|
171567
171793
|
const stat5 = statSync6(dotGit);
|
|
171568
171794
|
if (stat5.isDirectory()) {
|
|
171569
171795
|
return dotGit;
|
|
@@ -171575,7 +171801,7 @@ function resolveGitDir(projectRoot) {
|
|
|
171575
171801
|
if (match2) {
|
|
171576
171802
|
const gitdir = match2[1].trim();
|
|
171577
171803
|
const resolved = path35.isAbsolute(gitdir) ? gitdir : path35.resolve(projectRoot, gitdir);
|
|
171578
|
-
if (
|
|
171804
|
+
if (existsSync23(resolved)) {
|
|
171579
171805
|
return resolved;
|
|
171580
171806
|
}
|
|
171581
171807
|
}
|
|
@@ -172783,7 +173009,18 @@ _Search mode: ${result.receipt.mode}_`;
|
|
|
172783
173009
|
text: text3
|
|
172784
173010
|
}
|
|
172785
173011
|
],
|
|
172786
|
-
|
|
173012
|
+
// Clients that surface only structuredContent (e.g. Claude Code) must
|
|
173013
|
+
// still see the results, not just the retrieval diagnostics.
|
|
173014
|
+
structuredContent: {
|
|
173015
|
+
results: result.entries.map((entry) => ({
|
|
173016
|
+
ref: formatEntryRef(entry),
|
|
173017
|
+
title: entry.title,
|
|
173018
|
+
type: entry.type,
|
|
173019
|
+
time: entry.time,
|
|
173020
|
+
tokens: entry.tokens
|
|
173021
|
+
})),
|
|
173022
|
+
retrieval: result.receipt
|
|
173023
|
+
}
|
|
172787
173024
|
};
|
|
172788
173025
|
}, { loadCorpus: false });
|
|
172789
173026
|
}
|
|
@@ -174851,9 +175088,12 @@ ${s2.instruction}`.toLowerCase();
|
|
|
174851
175088
|
}
|
|
174852
175089
|
} catch {
|
|
174853
175090
|
}
|
|
175091
|
+
const card = lines.filter(Boolean).join("\n");
|
|
174854
175092
|
return {
|
|
174855
|
-
content: [{ type: "text", text:
|
|
174856
|
-
structuredContent
|
|
175093
|
+
content: [{ type: "text", text: card }],
|
|
175094
|
+
// Clients that surface only structuredContent (e.g. Claude Code) must
|
|
175095
|
+
// still see the session card, not just the binding receipt.
|
|
175096
|
+
structuredContent: { card, binding: bindingReceipt }
|
|
174857
175097
|
};
|
|
174858
175098
|
}
|
|
174859
175099
|
);
|
|
@@ -176283,10 +176523,10 @@ Preview: ${analysis.description.slice(0, 300)}${analysis.description.length > 30
|
|
|
176283
176523
|
const { ensureHooksDir: ensureHooksDir2 } = await Promise.resolve().then(() => (init_hooks_path(), hooks_path_exports));
|
|
176284
176524
|
const resolved = ensureHooksDir2(project.rootPath);
|
|
176285
176525
|
if (resolved) {
|
|
176286
|
-
const { existsSync:
|
|
176526
|
+
const { existsSync: existsSync24, readFileSync: readFileSync17, writeFileSync: writeFileSync5, chmodSync } = await import("fs");
|
|
176287
176527
|
const { hookPath } = resolved;
|
|
176288
176528
|
const HOOK_MARKER = "# [memorix-git-hook]";
|
|
176289
|
-
const needsInstall = !
|
|
176529
|
+
const needsInstall = !existsSync24(hookPath) || !readFileSync17(hookPath, "utf-8").includes(HOOK_MARKER);
|
|
176290
176530
|
if (needsInstall) {
|
|
176291
176531
|
const hookScript = `#!/bin/sh
|
|
176292
176532
|
${HOOK_MARKER}
|
|
@@ -176295,7 +176535,7 @@ if command -v memorix >/dev/null 2>&1; then
|
|
|
176295
176535
|
memorix ingest commit --auto >/dev/null 2>&1 &
|
|
176296
176536
|
fi
|
|
176297
176537
|
`;
|
|
176298
|
-
if (
|
|
176538
|
+
if (existsSync24(hookPath)) {
|
|
176299
176539
|
const existing = readFileSync17(hookPath, "utf-8");
|
|
176300
176540
|
writeFileSync5(hookPath, existing.trimEnd() + `
|
|
176301
176541
|
|
|
@@ -176461,6 +176701,7 @@ var init_server2 = __esm({
|
|
|
176461
176701
|
init_graph_scope();
|
|
176462
176702
|
init_visibility();
|
|
176463
176703
|
init_engine3();
|
|
176704
|
+
init_index_format();
|
|
176464
176705
|
init_graph_context();
|
|
176465
176706
|
init_detector();
|
|
176466
176707
|
init_launch_root();
|
|
@@ -177066,7 +177307,7 @@ var init_serve_shared = __esm({
|
|
|
177066
177307
|
|
|
177067
177308
|
// src/cli/version.ts
|
|
177068
177309
|
function getCliVersion() {
|
|
177069
|
-
return true ? "1.10.
|
|
177310
|
+
return true ? "1.10.2" : pkg.version;
|
|
177070
177311
|
}
|
|
177071
177312
|
var init_version3 = __esm({
|
|
177072
177313
|
"src/cli/version.ts"() {
|