memorix 1.10.1 → 1.10.3
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 +34 -0
- package/README.md +3 -1
- package/README.zh-CN.md +3 -1
- package/dist/cli/index.js +810 -379
- package/dist/cli/memcode.js +0 -0
- package/dist/index.js +380 -142
- package/dist/maintenance-runner.js +275 -79
- package/dist/media-audio-runner.js +247 -51
- package/dist/media-video-runner.js +274 -78
- package/dist/memcode-runtime/CHANGELOG.md +34 -0
- package/dist/sdk.js +431 -142
- package/dist/types.d.ts +1 -1
- package/dist/vector-backfill-runner.js +274 -78
- package/docs/CONFIGURATION.md +34 -0
- package/docs/DEVELOPMENT.md +3 -4
- package/docs/INTEGRATIONS.md +1 -1
- package/docs/PERFORMANCE.md +23 -0
- package/docs/README.md +3 -2
- package/docs/ROADMAP-1.9.12-2.0.md +2 -2
- package/docs/SETUP.md +19 -4
- 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/agent-integrations.ts +1 -1
- package/src/cli/commands/background.ts +1 -1
- package/src/cli/commands/context.ts +3 -2
- package/src/cli/commands/doctor.ts +9 -0
- package/src/cli/commands/explain.ts +3 -2
- package/src/cli/commands/init.ts +6 -2
- package/src/cli/commands/repair.ts +17 -3
- package/src/cli/commands/setup.ts +9 -6
- package/src/cli/commands/uninstall.ts +15 -0
- package/src/cli/tui/App.tsx +9 -16
- package/src/cli/tui/ConfigureView.tsx +2 -0
- package/src/codegraph/auto-context.ts +1 -1
- package/src/codegraph/store.ts +37 -0
- package/src/codegraph/types.ts +3 -0
- package/src/compact/index-format.ts +1 -1
- package/src/config/dotenv-loader.ts +1 -0
- package/src/config/resolved-config.ts +7 -2
- package/src/config/toml-loader.ts +1 -0
- package/src/config/yaml-loader.ts +4 -2
- package/src/dashboard/server.ts +5 -6
- package/src/hooks/handler.ts +0 -1
- package/src/integrations/registry.ts +2 -1
- package/src/knowledge/context-receipt.ts +6 -3
- package/src/llm/provider.ts +2 -1
- package/src/memory/observations.ts +68 -22
- package/src/multimodal/image-loader.ts +2 -2
- package/src/runtime/open-browser.ts +25 -0
- package/src/search/derived-view-receipt.ts +40 -0
- package/src/search/semantic-index.ts +149 -1
- package/src/server.ts +20 -5
- package/src/store/orama-store.ts +59 -19
- package/src/types.ts +1 -1
- package/src/workspace/mcp-adapters/pi.ts +58 -0
- package/plugins/pi/memorix/skills/memorix-git-memory/SKILL.md +0 -26
- package/plugins/pi/memorix/skills/memorix-memory/SKILL.md +0 -51
- package/plugins/pi/memorix/skills/memorix-mini-skills/SKILL.md +0 -31
- package/plugins/pi/memorix/skills/memorix-orchestrate/SKILL.md +0 -28
- package/plugins/pi/memorix/skills/memorix-reasoning/SKILL.md +0 -30
- package/plugins/pi/memorix/skills/memorix-sessions/SKILL.md +0 -25
- package/plugins/pi/memorix/skills/memorix-troubleshooting/SKILL.md +0 -27
package/dist/index.js
CHANGED
|
@@ -3842,7 +3842,8 @@ function getResolvedConfig(options = {}) {
|
|
|
3842
3842
|
const isRequesty = memoryLlmProvider === "requesty";
|
|
3843
3843
|
const isApiRoute = memoryLlmProvider === "apiroute";
|
|
3844
3844
|
const isCheaperInference = memoryLlmProvider === "cheaperinference";
|
|
3845
|
-
const
|
|
3845
|
+
const isRuncrate = memoryLlmProvider === "runcrate";
|
|
3846
|
+
const usesPresetKeyOnly = isAtlasCloud || isRequesty || isApiRoute || isCheaperInference || isRuncrate;
|
|
3846
3847
|
const memoryLlmApiKey = first(
|
|
3847
3848
|
process.env.MEMORIX_LLM_API_KEY,
|
|
3848
3849
|
process.env.MEMORIX_API_KEY,
|
|
@@ -3850,7 +3851,7 @@ function getResolvedConfig(options = {}) {
|
|
|
3850
3851
|
yaml.llm?.apiKey,
|
|
3851
3852
|
legacy.llm?.apiKey,
|
|
3852
3853
|
// Never borrow another provider's credentials for these gateway presets.
|
|
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,
|
|
3854
|
+
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 : isRuncrate ? process.env.RUNCRATE_API_KEY : process.env.OPENAI_API_KEY,
|
|
3854
3855
|
usesPresetKeyOnly ? void 0 : process.env.ANTHROPIC_API_KEY,
|
|
3855
3856
|
usesPresetKeyOnly ? void 0 : openRouterMemoryLlmApiKey
|
|
3856
3857
|
);
|
|
@@ -3921,6 +3922,7 @@ function getResolvedConfig(options = {}) {
|
|
|
3921
3922
|
codegraph: {
|
|
3922
3923
|
excludePatterns: firstArray(toml.codegraph?.exclude_patterns, yaml.codegraph?.excludePatterns),
|
|
3923
3924
|
maxFileBytes: firstNumber(toml.codegraph?.max_file_bytes, yaml.codegraph?.maxFileBytes),
|
|
3925
|
+
autoRefresh: first(toml.codegraph?.auto_refresh, yaml.codegraph?.autoRefresh, "auto"),
|
|
3924
3926
|
externalContext: first(
|
|
3925
3927
|
normalizeExternalContext(process.env.MEMORIX_CODEGRAPH_EXTERNAL_CONTEXT),
|
|
3926
3928
|
toml.codegraph?.external_context,
|
|
@@ -4035,6 +4037,7 @@ function getEnvSourceNames() {
|
|
|
4035
4037
|
"REQUESTY_API_KEY",
|
|
4036
4038
|
"API_ROUTE_API_KEY",
|
|
4037
4039
|
"CHEAPER_INFERENCE_API_KEY",
|
|
4040
|
+
"RUNCRATE_API_KEY",
|
|
4038
4041
|
"ATLASCLOUD_API_KEY"
|
|
4039
4042
|
].filter((name) => process.env[name]);
|
|
4040
4043
|
}
|
|
@@ -7030,6 +7033,7 @@ var init_provider2 = __esm({
|
|
|
7030
7033
|
requesty: { baseUrl: "https://router.requesty.ai/v1", model: "openai/gpt-4.1-nano" },
|
|
7031
7034
|
apiroute: { baseUrl: "https://global.api-route.com/v1", model: "deepseek-v4.1-flash" },
|
|
7032
7035
|
cheaperinference: { baseUrl: "https://api.cheaperinference.com/v1", model: "gpt-5.4-mini" },
|
|
7036
|
+
runcrate: { baseUrl: "https://api.runcrate.ai/v1", model: "deepseek-ai/DeepSeek-V4.1-Flash" },
|
|
7033
7037
|
atlascloud: { baseUrl: "https://api.atlascloud.ai/v1", model: "deepseek-ai/deepseek-v3.2" },
|
|
7034
7038
|
custom: { baseUrl: "http://localhost:11434/v1", model: "llama3" }
|
|
7035
7039
|
};
|
|
@@ -7808,6 +7812,7 @@ var init_obs_store = __esm({
|
|
|
7808
7812
|
|
|
7809
7813
|
// src/search/semantic-index.ts
|
|
7810
7814
|
import { createHash as createHash4 } from "crypto";
|
|
7815
|
+
import { existsSync as existsSync8 } from "fs";
|
|
7811
7816
|
import { createRequire as createRequire3 } from "module";
|
|
7812
7817
|
import path11 from "path";
|
|
7813
7818
|
function createSemanticIndexProfile(provider2) {
|
|
@@ -7906,17 +7911,80 @@ function queueOperation(key, operation) {
|
|
|
7906
7911
|
writeQueues.set(key, run.catch(() => void 0));
|
|
7907
7912
|
return run;
|
|
7908
7913
|
}
|
|
7914
|
+
function positiveEnvInt(name, fallback) {
|
|
7915
|
+
const value = Number.parseInt(process.env[name] ?? "", 10);
|
|
7916
|
+
return Number.isSafeInteger(value) && value > 0 ? value : fallback;
|
|
7917
|
+
}
|
|
7918
|
+
function semanticWriteBatchSize() {
|
|
7919
|
+
return positiveEnvInt("MEMORIX_SEMANTIC_WRITE_BATCH_SIZE", DEFAULT_WRITE_BATCH_SIZE);
|
|
7920
|
+
}
|
|
7921
|
+
function semanticWriteFlushMs() {
|
|
7922
|
+
return positiveEnvInt("MEMORIX_SEMANTIC_WRITE_FLUSH_MS", DEFAULT_WRITE_FLUSH_MS);
|
|
7923
|
+
}
|
|
7924
|
+
function semanticOptimizeEvery() {
|
|
7925
|
+
return positiveEnvInt("MEMORIX_SEMANTIC_OPTIMIZE_EVERY", DEFAULT_OPTIMIZE_EVERY);
|
|
7926
|
+
}
|
|
7927
|
+
function semanticVersionRetentionMs() {
|
|
7928
|
+
return positiveEnvInt("MEMORIX_SEMANTIC_VERSION_RETENTION_MS", DEFAULT_VERSION_RETENTION_MS);
|
|
7929
|
+
}
|
|
7930
|
+
async function optimizeState(state) {
|
|
7931
|
+
if (!state.table || typeof state.table.optimize !== "function") return;
|
|
7932
|
+
await state.table.optimize({
|
|
7933
|
+
cleanupOlderThan: new Date(Date.now() - semanticVersionRetentionMs()),
|
|
7934
|
+
deleteUnverified: false
|
|
7935
|
+
});
|
|
7936
|
+
}
|
|
7909
7937
|
async function mergeVectors(dataDir, profile, records) {
|
|
7910
7938
|
if (records.length === 0) return;
|
|
7911
7939
|
const state = await getState(dataDir, profile, records);
|
|
7912
7940
|
if (!state?.table) return;
|
|
7913
7941
|
const rows = records.map(toLanceRow);
|
|
7914
7942
|
await state.table.mergeInsert("observation_id").whenMatchedUpdateAll().whenNotMatchedInsertAll().execute(rows);
|
|
7943
|
+
const key = stateKey(dataDir, profile);
|
|
7944
|
+
const mutationCount = (mutationCounts.get(key) ?? 0) + 1;
|
|
7945
|
+
if (mutationCount >= semanticOptimizeEvery()) {
|
|
7946
|
+
mutationCounts.set(key, 0);
|
|
7947
|
+
await optimizeState(state).catch(() => void 0);
|
|
7948
|
+
} else {
|
|
7949
|
+
mutationCounts.set(key, mutationCount);
|
|
7950
|
+
}
|
|
7915
7951
|
void ensureSemanticIndex(dataDir, profile);
|
|
7916
7952
|
}
|
|
7953
|
+
function flushPendingVectorBatch(key) {
|
|
7954
|
+
const pending = pendingVectorBatches.get(key);
|
|
7955
|
+
if (!pending) return Promise.resolve();
|
|
7956
|
+
if (pending.timer) clearTimeout(pending.timer);
|
|
7957
|
+
pendingVectorBatches.delete(key);
|
|
7958
|
+
const records = [...pending.records.values()];
|
|
7959
|
+
const waiters = pending.waiters.splice(0);
|
|
7960
|
+
return queueOperation(key, () => mergeVectors(pending.dataDir, pending.profile, records)).then(() => waiters.forEach((waiter) => waiter.resolve())).catch((error) => {
|
|
7961
|
+
waiters.forEach((waiter) => waiter.reject(error));
|
|
7962
|
+
});
|
|
7963
|
+
}
|
|
7964
|
+
function upsertSemanticVector(dataDir, profile, record80) {
|
|
7965
|
+
const key = stateKey(dataDir, profile);
|
|
7966
|
+
let pending = pendingVectorBatches.get(key);
|
|
7967
|
+
if (!pending) {
|
|
7968
|
+
pending = { dataDir, profile, records: /* @__PURE__ */ new Map(), waiters: [] };
|
|
7969
|
+
pendingVectorBatches.set(key, pending);
|
|
7970
|
+
}
|
|
7971
|
+
pending.records.set(`${record80.projectId}:${record80.observationId}`, record80);
|
|
7972
|
+
const promise = new Promise((resolve5, reject) => pending.waiters.push({ resolve: resolve5, reject }));
|
|
7973
|
+
if (pending.records.size >= semanticWriteBatchSize()) void flushPendingVectorBatch(key);
|
|
7974
|
+
else if (!pending.timer) pending.timer = setTimeout(() => {
|
|
7975
|
+
void flushPendingVectorBatch(key);
|
|
7976
|
+
}, semanticWriteFlushMs());
|
|
7977
|
+
return promise;
|
|
7978
|
+
}
|
|
7917
7979
|
function upsertSemanticVectors(dataDir, profile, records) {
|
|
7918
7980
|
return queueOperation(stateKey(dataDir, profile), () => mergeVectors(dataDir, profile, records));
|
|
7919
7981
|
}
|
|
7982
|
+
async function listSemanticVectorIds(dataDir, profile) {
|
|
7983
|
+
const state = await getState(dataDir, profile);
|
|
7984
|
+
if (!state?.table) return null;
|
|
7985
|
+
const rows = await state.table.query().select(["observation_id"]).toArray();
|
|
7986
|
+
return new Set(rows.map((row) => Number(row.observation_id)).filter(Number.isSafeInteger));
|
|
7987
|
+
}
|
|
7920
7988
|
function resolveIndexThreshold() {
|
|
7921
7989
|
const raw = Number.parseInt(process.env.MEMORIX_SEMANTIC_INDEX_THRESHOLD ?? "", 10);
|
|
7922
7990
|
return Number.isSafeInteger(raw) && raw > 0 ? raw : DEFAULT_INDEX_THRESHOLD;
|
|
@@ -7968,7 +8036,7 @@ async function searchSemanticVectors(options) {
|
|
|
7968
8036
|
distance: Number(row._distance ?? Number.POSITIVE_INFINITY)
|
|
7969
8037
|
})).filter((row) => Number.isFinite(row.distance));
|
|
7970
8038
|
}
|
|
7971
|
-
var SEMANTIC_INDEX_DIR, TABLE_PREFIX, DEFAULT_INDEX_THRESHOLD, MAX_INDEX_PARTITIONS, statePromises, writeQueues, indexBuilds, availability, requireFromHere2;
|
|
8039
|
+
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;
|
|
7972
8040
|
var init_semantic_index = __esm({
|
|
7973
8041
|
"src/search/semantic-index.ts"() {
|
|
7974
8042
|
"use strict";
|
|
@@ -7977,13 +8045,84 @@ var init_semantic_index = __esm({
|
|
|
7977
8045
|
TABLE_PREFIX = "observations_";
|
|
7978
8046
|
DEFAULT_INDEX_THRESHOLD = 1e4;
|
|
7979
8047
|
MAX_INDEX_PARTITIONS = 32;
|
|
8048
|
+
DEFAULT_WRITE_BATCH_SIZE = 100;
|
|
8049
|
+
DEFAULT_WRITE_FLUSH_MS = 50;
|
|
8050
|
+
DEFAULT_OPTIMIZE_EVERY = 20;
|
|
8051
|
+
DEFAULT_VERSION_RETENTION_MS = 24 * 60 * 60 * 1e3;
|
|
7980
8052
|
statePromises = /* @__PURE__ */ new Map();
|
|
7981
8053
|
writeQueues = /* @__PURE__ */ new Map();
|
|
7982
8054
|
indexBuilds = /* @__PURE__ */ new Map();
|
|
8055
|
+
mutationCounts = /* @__PURE__ */ new Map();
|
|
8056
|
+
pendingVectorBatches = /* @__PURE__ */ new Map();
|
|
7983
8057
|
requireFromHere2 = createRequire3(import.meta.url);
|
|
7984
8058
|
}
|
|
7985
8059
|
});
|
|
7986
8060
|
|
|
8061
|
+
// src/memory/secret-filter.ts
|
|
8062
|
+
function applyRedaction(text3) {
|
|
8063
|
+
if (!text3) return text3;
|
|
8064
|
+
let out = text3;
|
|
8065
|
+
out = out.replace(
|
|
8066
|
+
/((?:password|passwd|pwd|secret|token|api[_-]?key|auth[_-]?key|access[_-]?key|private[_-]?key|client[_-]?secret)\s*[:=]\s*["']?)([^\s"',;\n]{6,})/gi,
|
|
8067
|
+
"$1[REDACTED]"
|
|
8068
|
+
);
|
|
8069
|
+
out = out.replace(
|
|
8070
|
+
/(Bearer\s+)([A-Za-z0-9._\-/+]{20,})/g,
|
|
8071
|
+
"$1[REDACTED]"
|
|
8072
|
+
);
|
|
8073
|
+
out = out.replace(/\b(?:ghp|ghs|gho|github_pat)_[A-Za-z0-9]{36,}\b/g, "[REDACTED]");
|
|
8074
|
+
out = out.replace(/\bsk-[A-Za-z0-9T-]{20,}\b/g, "[REDACTED]");
|
|
8075
|
+
out = out.replace(/\beyJ[A-Za-z0-9._-]{40,}\b/g, "[REDACTED]");
|
|
8076
|
+
return out;
|
|
8077
|
+
}
|
|
8078
|
+
function sanitizeCredentials(text3) {
|
|
8079
|
+
return applyRedaction(text3);
|
|
8080
|
+
}
|
|
8081
|
+
function redactCredentials(text3) {
|
|
8082
|
+
return applyRedaction(text3);
|
|
8083
|
+
}
|
|
8084
|
+
var init_secret_filter = __esm({
|
|
8085
|
+
"src/memory/secret-filter.ts"() {
|
|
8086
|
+
"use strict";
|
|
8087
|
+
init_esm_shims();
|
|
8088
|
+
}
|
|
8089
|
+
});
|
|
8090
|
+
|
|
8091
|
+
// src/search/derived-view-receipt.ts
|
|
8092
|
+
function sanitizeDerivedViewFailureReason(reason) {
|
|
8093
|
+
const safe = sanitizeCredentials(reason).replace(/(?:[A-Za-z]:[\\/]|\\\\[^\\/\s]+[\\/]|\/(?:home|Users|tmp|var|private|mnt|workspace|workspaces)\/)[^\s"'<>|]*/gi, "[path]").replace(/\s+/g, " ").trim();
|
|
8094
|
+
return safe.slice(0, 240) || "derived view failed";
|
|
8095
|
+
}
|
|
8096
|
+
function embeddingHealthReceipt(health, embeddingEnabled2) {
|
|
8097
|
+
if (health?.status === "disabled") {
|
|
8098
|
+
return { freshness: "current", rebuildStatus: "disabled" };
|
|
8099
|
+
}
|
|
8100
|
+
if (health?.status === "ready" || embeddingEnabled2) {
|
|
8101
|
+
return { freshness: "current", rebuildStatus: "idle" };
|
|
8102
|
+
}
|
|
8103
|
+
if (health?.status === "degraded") {
|
|
8104
|
+
return {
|
|
8105
|
+
freshness: "stale",
|
|
8106
|
+
rebuildStatus: "failed",
|
|
8107
|
+
...health.failure ? {
|
|
8108
|
+
failureReason: `embedding ${health.failure.kind}; retry in ${health.failure.retryAfterMs}ms`
|
|
8109
|
+
} : { failureReason: "embedding provider degraded" }
|
|
8110
|
+
};
|
|
8111
|
+
}
|
|
8112
|
+
return {
|
|
8113
|
+
freshness: "unknown",
|
|
8114
|
+
rebuildStatus: "unavailable",
|
|
8115
|
+
failureReason: "embedding provider is not initialized"
|
|
8116
|
+
};
|
|
8117
|
+
}
|
|
8118
|
+
var init_derived_view_receipt = __esm({
|
|
8119
|
+
"src/search/derived-view-receipt.ts"() {
|
|
8120
|
+
"use strict";
|
|
8121
|
+
init_esm_shims();
|
|
8122
|
+
init_secret_filter();
|
|
8123
|
+
}
|
|
8124
|
+
});
|
|
8125
|
+
|
|
7987
8126
|
// src/project/aliases.ts
|
|
7988
8127
|
var aliases_exports = {};
|
|
7989
8128
|
__export(aliases_exports, {
|
|
@@ -8592,6 +8731,7 @@ __export(orama_store_exports, {
|
|
|
8592
8731
|
getLastSearchMode: () => getLastSearchMode,
|
|
8593
8732
|
getObservationCount: () => getObservationCount,
|
|
8594
8733
|
getObservationsByIds: () => getObservationsByIds,
|
|
8734
|
+
getPersistentSemanticVectorIds: () => getPersistentSemanticVectorIds,
|
|
8595
8735
|
getSearchDerivedViews: () => getSearchDerivedViews,
|
|
8596
8736
|
getTimeline: () => getTimeline,
|
|
8597
8737
|
getVectorDimensions: () => getVectorDimensions,
|
|
@@ -8604,10 +8744,18 @@ __export(orama_store_exports, {
|
|
|
8604
8744
|
queueSemanticVector: () => queueSemanticVector,
|
|
8605
8745
|
removeObservation: () => removeObservation,
|
|
8606
8746
|
resetDb: () => resetDb,
|
|
8747
|
+
resolveSearchFuzzyTolerance: () => resolveSearchFuzzyTolerance,
|
|
8607
8748
|
searchObservations: () => searchObservations,
|
|
8608
8749
|
updateObservationMetadata: () => updateObservationMetadata
|
|
8609
8750
|
});
|
|
8610
8751
|
import { components, create, insert as insert2, insertMultiple, search, remove as remove2, update, count, getByID } from "@orama/orama";
|
|
8752
|
+
function resolveSearchFuzzyTolerance(query, quality) {
|
|
8753
|
+
if (quality === "fast") return void 0;
|
|
8754
|
+
const characters = [...query];
|
|
8755
|
+
const cjkCount = characters.filter((char) => /[\u3400-\u4dbf\u4e00-\u9fff\u3040-\u30ff\uac00-\ud7af]/u.test(char)).length;
|
|
8756
|
+
if (characters.length > 0 && cjkCount / characters.length > 0.3) return void 0;
|
|
8757
|
+
return query.length > 6 ? 2 : 1;
|
|
8758
|
+
}
|
|
8611
8759
|
function rememberSearchMode(key, value) {
|
|
8612
8760
|
if (!lastSearchModeByProject.has(key) && lastSearchModeByProject.size >= MAX_SEARCH_MODE_KEYS) {
|
|
8613
8761
|
const oldest = lastSearchModeByProject.keys().next().value;
|
|
@@ -8636,14 +8784,16 @@ function getSearchDerivedViews() {
|
|
|
8636
8784
|
generation,
|
|
8637
8785
|
freshness: "unknown",
|
|
8638
8786
|
rebuildStatus: "unavailable",
|
|
8639
|
-
failureReason:
|
|
8787
|
+
failureReason: sanitizeDerivedViewFailureReason(
|
|
8788
|
+
store.getBackendReason?.() ?? "persistent lexical index unavailable"
|
|
8789
|
+
)
|
|
8640
8790
|
};
|
|
8641
8791
|
}
|
|
8642
8792
|
} catch (error) {
|
|
8643
8793
|
views.fts = {
|
|
8644
8794
|
freshness: "unknown",
|
|
8645
8795
|
rebuildStatus: "failed",
|
|
8646
|
-
failureReason: error instanceof Error ? error.message
|
|
8796
|
+
failureReason: sanitizeDerivedViewFailureReason(error instanceof Error ? error.message : String(error))
|
|
8647
8797
|
};
|
|
8648
8798
|
}
|
|
8649
8799
|
} else {
|
|
@@ -8659,18 +8809,12 @@ function getSearchDerivedViews() {
|
|
|
8659
8809
|
rebuildStatus: "unavailable",
|
|
8660
8810
|
failureReason: "Orama index is not initialized"
|
|
8661
8811
|
};
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
}
|
|
8666
|
-
views.embedding = { freshness: "current", rebuildStatus: "idle" };
|
|
8667
|
-
} else {
|
|
8668
|
-
views.embedding = {
|
|
8669
|
-
freshness: "unknown",
|
|
8670
|
-
rebuildStatus: "unavailable",
|
|
8671
|
-
failureReason: "embedding provider is not initialized"
|
|
8672
|
-
};
|
|
8812
|
+
let embeddingHealth;
|
|
8813
|
+
try {
|
|
8814
|
+
embeddingHealth = getEmbeddingRuntimeHealth?.();
|
|
8815
|
+
} catch {
|
|
8673
8816
|
}
|
|
8817
|
+
views.embedding = embeddingHealthReceipt(embeddingHealth, embeddingEnabled);
|
|
8674
8818
|
return views;
|
|
8675
8819
|
}
|
|
8676
8820
|
function rememberSearchDiagnostics(key, value) {
|
|
@@ -8974,12 +9118,16 @@ function getVectorDimensions() {
|
|
|
8974
9118
|
function getActiveSemanticIndexProfile() {
|
|
8975
9119
|
return indexEmbeddingProvider ? createSemanticIndexProfile(indexEmbeddingProvider) : null;
|
|
8976
9120
|
}
|
|
9121
|
+
async function getPersistentSemanticVectorIds(dataDir) {
|
|
9122
|
+
if (!indexEmbeddingProvider) return null;
|
|
9123
|
+
return listSemanticVectorIds(dataDir, createSemanticIndexProfile(indexEmbeddingProvider));
|
|
9124
|
+
}
|
|
8977
9125
|
async function queueSemanticVector(dataDir, record80) {
|
|
8978
9126
|
const provider2 = indexEmbeddingProvider ?? await getEmbeddingProvider();
|
|
8979
9127
|
const profile = provider2 ? createSemanticIndexProfile(provider2) : null;
|
|
8980
9128
|
if (!profile) return;
|
|
8981
9129
|
try {
|
|
8982
|
-
await
|
|
9130
|
+
await upsertSemanticVector(dataDir, profile, record80);
|
|
8983
9131
|
} catch {
|
|
8984
9132
|
}
|
|
8985
9133
|
}
|
|
@@ -9041,6 +9189,7 @@ function isCompatibleCachedVector(vector) {
|
|
|
9041
9189
|
async function attachCachedVectors(database, observations2) {
|
|
9042
9190
|
const semanticDataDir = (await Promise.resolve().then(() => (init_observations(), observations_exports))).getObservationDataDir();
|
|
9043
9191
|
const semanticProfile = getActiveSemanticIndexProfile();
|
|
9192
|
+
const persistedSemanticIds = semanticDataDir && semanticProfile ? await listSemanticVectorIds(semanticDataDir, semanticProfile).catch(() => null) : null;
|
|
9044
9193
|
const batchSize = 200;
|
|
9045
9194
|
for (let start = 0; start < observations2.length; start += batchSize) {
|
|
9046
9195
|
const batch = observations2.slice(start, start + batchSize);
|
|
@@ -9051,7 +9200,7 @@ async function attachCachedVectors(database, observations2) {
|
|
|
9051
9200
|
const vector = cachedVectors[index];
|
|
9052
9201
|
if (!isCompatibleCachedVector(vector)) continue;
|
|
9053
9202
|
const observation = batch[index];
|
|
9054
|
-
if (semanticDataDir && semanticProfile) {
|
|
9203
|
+
if (semanticDataDir && semanticProfile && !persistedSemanticIds?.has(observation.id)) {
|
|
9055
9204
|
semanticRecords.push({
|
|
9056
9205
|
observationId: observation.id,
|
|
9057
9206
|
projectId: observation.projectId,
|
|
@@ -9252,7 +9401,10 @@ async function searchObservations(options) {
|
|
|
9252
9401
|
// Fuzzy tolerance: allow 1-char typos for short queries, 2 for longer
|
|
9253
9402
|
// Fuzzy matching is useful for ordinary recall, but grows sharply with
|
|
9254
9403
|
// corpus size. The fast profile deliberately uses exact lexical matching.
|
|
9255
|
-
...hasQuery
|
|
9404
|
+
...hasQuery ? (() => {
|
|
9405
|
+
const tolerance = resolveSearchFuzzyTolerance(originalQuery, quality);
|
|
9406
|
+
return tolerance === void 0 ? {} : { tolerance };
|
|
9407
|
+
})() : {}
|
|
9256
9408
|
};
|
|
9257
9409
|
let queryVector = null;
|
|
9258
9410
|
let embeddingProviderForSearch = null;
|
|
@@ -9483,14 +9635,16 @@ async function searchObservations(options) {
|
|
|
9483
9635
|
filesModified: doc.filesModified?.split?.("\n") ?? (Array.isArray(doc.filesModified) ? doc.filesModified : [])
|
|
9484
9636
|
});
|
|
9485
9637
|
}
|
|
9638
|
+
const topScore = Math.max(...intermediate.map((entry) => entry.score));
|
|
9639
|
+
const affinityTieWindow = topScore * 0.92;
|
|
9486
9640
|
intermediate = intermediate.map((entry) => {
|
|
9487
9641
|
const memory = memoryContentMap.get(entry.id);
|
|
9488
9642
|
if (!memory) return entry;
|
|
9489
9643
|
const { score: affinityScore } = calculateProjectAffinity(memory, affinityContext);
|
|
9644
|
+
if (entry.score < affinityTieWindow) return entry;
|
|
9490
9645
|
return {
|
|
9491
9646
|
...entry,
|
|
9492
|
-
score: entry.score * affinityScore
|
|
9493
|
-
// Apply affinity as multiplier
|
|
9647
|
+
score: entry.score * (0.98 + affinityScore * 0.02)
|
|
9494
9648
|
};
|
|
9495
9649
|
});
|
|
9496
9650
|
intermediate.sort((a, b) => b.score - a.score);
|
|
@@ -9824,6 +9978,7 @@ var init_orama_store = __esm({
|
|
|
9824
9978
|
init_mini_skills();
|
|
9825
9979
|
init_visibility();
|
|
9826
9980
|
init_provider();
|
|
9981
|
+
init_provider();
|
|
9827
9982
|
init_project_affinity();
|
|
9828
9983
|
init_intent_detector();
|
|
9829
9984
|
init_query_expansion();
|
|
@@ -9831,6 +9986,7 @@ var init_orama_store = __esm({
|
|
|
9831
9986
|
init_timeout();
|
|
9832
9987
|
init_obs_store();
|
|
9833
9988
|
init_semantic_index();
|
|
9989
|
+
init_derived_view_receipt();
|
|
9834
9990
|
db = null;
|
|
9835
9991
|
dbInitPromise = null;
|
|
9836
9992
|
dbGeneration = 0;
|
|
@@ -9955,36 +10111,6 @@ var init_entity_extractor = __esm({
|
|
|
9955
10111
|
}
|
|
9956
10112
|
});
|
|
9957
10113
|
|
|
9958
|
-
// src/memory/secret-filter.ts
|
|
9959
|
-
function applyRedaction(text3) {
|
|
9960
|
-
if (!text3) return text3;
|
|
9961
|
-
let out = text3;
|
|
9962
|
-
out = out.replace(
|
|
9963
|
-
/((?:password|passwd|pwd|secret|token|api[_-]?key|auth[_-]?key|access[_-]?key|private[_-]?key|client[_-]?secret)\s*[:=]\s*["']?)([^\s"',;\n]{6,})/gi,
|
|
9964
|
-
"$1[REDACTED]"
|
|
9965
|
-
);
|
|
9966
|
-
out = out.replace(
|
|
9967
|
-
/(Bearer\s+)([A-Za-z0-9._\-/+]{20,})/g,
|
|
9968
|
-
"$1[REDACTED]"
|
|
9969
|
-
);
|
|
9970
|
-
out = out.replace(/\b(?:ghp|ghs|gho|github_pat)_[A-Za-z0-9]{36,}\b/g, "[REDACTED]");
|
|
9971
|
-
out = out.replace(/\bsk-[A-Za-z0-9T-]{20,}\b/g, "[REDACTED]");
|
|
9972
|
-
out = out.replace(/\beyJ[A-Za-z0-9._-]{40,}\b/g, "[REDACTED]");
|
|
9973
|
-
return out;
|
|
9974
|
-
}
|
|
9975
|
-
function sanitizeCredentials(text3) {
|
|
9976
|
-
return applyRedaction(text3);
|
|
9977
|
-
}
|
|
9978
|
-
function redactCredentials(text3) {
|
|
9979
|
-
return applyRedaction(text3);
|
|
9980
|
-
}
|
|
9981
|
-
var init_secret_filter = __esm({
|
|
9982
|
-
"src/memory/secret-filter.ts"() {
|
|
9983
|
-
"use strict";
|
|
9984
|
-
init_esm_shims();
|
|
9985
|
-
}
|
|
9986
|
-
});
|
|
9987
|
-
|
|
9988
10114
|
// src/runtime/maintenance-jobs.ts
|
|
9989
10115
|
var maintenance_jobs_exports = {};
|
|
9990
10116
|
__export(maintenance_jobs_exports, {
|
|
@@ -10835,7 +10961,7 @@ var init_maintenance_targets = __esm({
|
|
|
10835
10961
|
|
|
10836
10962
|
// src/runtime/isolated-maintenance.ts
|
|
10837
10963
|
import { spawn } from "child_process";
|
|
10838
|
-
import { existsSync as
|
|
10964
|
+
import { existsSync as existsSync9 } from "fs";
|
|
10839
10965
|
import os4 from "os";
|
|
10840
10966
|
import path13 from "path";
|
|
10841
10967
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
@@ -10853,7 +10979,7 @@ function childError(prefix, detail) {
|
|
|
10853
10979
|
}
|
|
10854
10980
|
function isolatedMaintenanceCwd() {
|
|
10855
10981
|
const tmp = os4.tmpdir();
|
|
10856
|
-
return
|
|
10982
|
+
return existsSync9(tmp) ? tmp : process.cwd();
|
|
10857
10983
|
}
|
|
10858
10984
|
function resolveMaintenanceRunnerPath(moduleUrl = import.meta.url) {
|
|
10859
10985
|
const moduleDir = path13.dirname(fileURLToPath2(moduleUrl));
|
|
@@ -10910,7 +11036,7 @@ function collectOutput(stream2, limit2, onOverflow) {
|
|
|
10910
11036
|
async function runMaintenanceInChildProcess(request, options = {}) {
|
|
10911
11037
|
validateRequest(request);
|
|
10912
11038
|
const runnerPath = options.runnerPath ?? resolveMaintenanceRunnerPath();
|
|
10913
|
-
if (!
|
|
11039
|
+
if (!existsSync9(runnerPath)) {
|
|
10914
11040
|
throw new Error(`Maintenance runner is unavailable at ${runnerPath}. Reinstall or rebuild Memorix.`);
|
|
10915
11041
|
}
|
|
10916
11042
|
const timeoutMs = Number.isFinite(options.timeoutMs) ? Math.max(1e3, Math.floor(options.timeoutMs)) : DEFAULT_TIMEOUT_MS;
|
|
@@ -146065,7 +146191,7 @@ __export(video_jobs_exports, {
|
|
|
146065
146191
|
runMiniMaxVideoGenerationJob: () => runMiniMaxVideoGenerationJob
|
|
146066
146192
|
});
|
|
146067
146193
|
import { spawn as spawn2 } from "child_process";
|
|
146068
|
-
import { existsSync as
|
|
146194
|
+
import { existsSync as existsSync10 } from "fs";
|
|
146069
146195
|
import path19 from "path";
|
|
146070
146196
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
146071
146197
|
function safeError2(error) {
|
|
@@ -146313,7 +146439,7 @@ function resolveMediaVideoRunnerPath(moduleUrl = import.meta.url) {
|
|
|
146313
146439
|
}
|
|
146314
146440
|
function launchMediaVideoRunner(request, options = {}) {
|
|
146315
146441
|
const runnerPath = options.runnerPath ?? resolveMediaVideoRunnerPath();
|
|
146316
|
-
if (!
|
|
146442
|
+
if (!existsSync10(runnerPath)) {
|
|
146317
146443
|
return { launched: false, reason: "Media video runner is unavailable until Memorix is built or reinstalled." };
|
|
146318
146444
|
}
|
|
146319
146445
|
try {
|
|
@@ -146358,7 +146484,7 @@ __export(audio_jobs_exports, {
|
|
|
146358
146484
|
transcribeAudio: () => transcribeAudio
|
|
146359
146485
|
});
|
|
146360
146486
|
import { spawn as spawn3 } from "child_process";
|
|
146361
|
-
import { existsSync as
|
|
146487
|
+
import { existsSync as existsSync11 } from "fs";
|
|
146362
146488
|
import path20 from "path";
|
|
146363
146489
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
146364
146490
|
function safeError3(error) {
|
|
@@ -146609,7 +146735,7 @@ function resolveMediaAudioRunnerPath(moduleUrl = import.meta.url) {
|
|
|
146609
146735
|
}
|
|
146610
146736
|
function launchMediaAudioRunner(request, options = {}) {
|
|
146611
146737
|
const runnerPath = options.runnerPath ?? resolveMediaAudioRunnerPath();
|
|
146612
|
-
if (!
|
|
146738
|
+
if (!existsSync11(runnerPath)) return { launched: false, reason: "Audio runner is unavailable until Memorix is built or reinstalled." };
|
|
146613
146739
|
try {
|
|
146614
146740
|
const child = spawn3(process.execPath, [runnerPath, JSON.stringify(request)], {
|
|
146615
146741
|
cwd: request.projectRoot,
|
|
@@ -149022,6 +149148,7 @@ var init_store = __esm({
|
|
|
149022
149148
|
recordCodeStateSnapshot(input) {
|
|
149023
149149
|
const id = randomUUID11();
|
|
149024
149150
|
let snapshot;
|
|
149151
|
+
let compactNeeded = false;
|
|
149025
149152
|
const tx = this.db.transaction(() => {
|
|
149026
149153
|
const previous = this.db.prepare(
|
|
149027
149154
|
"SELECT id, sourceEpoch FROM code_state_snapshots WHERE projectId = ? ORDER BY sourceEpoch DESC LIMIT 1"
|
|
@@ -149065,6 +149192,26 @@ var init_store = __esm({
|
|
|
149065
149192
|
for (const file of snapshotFileRows) {
|
|
149066
149193
|
insertSnapshotFile.run(id, file.projectId, file.id, file.path, file.contentHash);
|
|
149067
149194
|
}
|
|
149195
|
+
const staleSymbolIds = this.db.prepare(
|
|
149196
|
+
"SELECT id FROM code_symbols WHERE projectId = ? AND stale = 1"
|
|
149197
|
+
).all(input.projectId).map((row) => row.id);
|
|
149198
|
+
if (staleSymbolIds.length > 0) {
|
|
149199
|
+
const placeholders = staleSymbolIds.map(() => "?").join(", ");
|
|
149200
|
+
this.db.prepare(
|
|
149201
|
+
`DELETE FROM code_edges WHERE projectId = ? AND (fromSymbolId IN (${placeholders}) OR toSymbolId IN (${placeholders}))`
|
|
149202
|
+
).run(input.projectId, ...staleSymbolIds, ...staleSymbolIds);
|
|
149203
|
+
this.db.prepare("DELETE FROM code_symbols WHERE projectId = ? AND stale = 1").run(input.projectId);
|
|
149204
|
+
compactNeeded = true;
|
|
149205
|
+
}
|
|
149206
|
+
const oldSnapshots = this.db.prepare(
|
|
149207
|
+
"SELECT id FROM code_state_snapshots WHERE projectId = ? ORDER BY sourceEpoch DESC LIMIT -1 OFFSET 2"
|
|
149208
|
+
).all(input.projectId).map((row) => row.id);
|
|
149209
|
+
if (oldSnapshots.length > 0) {
|
|
149210
|
+
const placeholders = oldSnapshots.map(() => "?").join(", ");
|
|
149211
|
+
this.db.prepare(`DELETE FROM code_state_snapshot_files WHERE snapshotId IN (${placeholders})`).run(...oldSnapshots);
|
|
149212
|
+
this.db.prepare(`DELETE FROM code_state_snapshots WHERE id IN (${placeholders})`).run(...oldSnapshots);
|
|
149213
|
+
compactNeeded = true;
|
|
149214
|
+
}
|
|
149068
149215
|
snapshot = {
|
|
149069
149216
|
...input,
|
|
149070
149217
|
id,
|
|
@@ -149073,11 +149220,24 @@ var init_store = __esm({
|
|
|
149073
149220
|
};
|
|
149074
149221
|
});
|
|
149075
149222
|
tx();
|
|
149223
|
+
if (compactNeeded) this.compactStorage();
|
|
149076
149224
|
return snapshot;
|
|
149077
149225
|
}
|
|
149226
|
+
/** Reclaim WAL/free pages after a derived codegraph sweep. */
|
|
149227
|
+
compactStorage() {
|
|
149228
|
+
try {
|
|
149229
|
+
this.db.pragma("wal_checkpoint(TRUNCATE)");
|
|
149230
|
+
} catch {
|
|
149231
|
+
}
|
|
149232
|
+
try {
|
|
149233
|
+
this.db.exec("VACUUM");
|
|
149234
|
+
} catch {
|
|
149235
|
+
}
|
|
149236
|
+
}
|
|
149078
149237
|
status(projectId) {
|
|
149079
149238
|
const files = this.db.prepare(`SELECT COUNT(*) AS count FROM code_files WHERE projectId = ?`).get(projectId).count;
|
|
149080
149239
|
const symbols = this.db.prepare(`SELECT COUNT(*) AS count FROM code_symbols WHERE projectId = ? AND stale = 0`).get(projectId).count;
|
|
149240
|
+
const staleSymbols = this.db.prepare(`SELECT COUNT(*) AS count FROM code_symbols WHERE projectId = ? AND stale = 1`).get(projectId).count;
|
|
149081
149241
|
const edges = this.db.prepare(`SELECT COUNT(*) AS count FROM code_edges WHERE projectId = ?`).get(projectId).count;
|
|
149082
149242
|
const refs = this.db.prepare(`SELECT COUNT(*) AS count FROM observation_code_refs WHERE projectId = ?`).get(projectId).count;
|
|
149083
149243
|
const semanticSymbols = this.db.prepare(`SELECT COUNT(*) AS count FROM code_symbols WHERE projectId = ? AND stale = 0 AND source = 'typescript-compiler'`).get(projectId).count;
|
|
@@ -149085,6 +149245,8 @@ var init_store = __esm({
|
|
|
149085
149245
|
const parserErrors = this.db.prepare(`SELECT COUNT(*) AS count FROM code_files WHERE projectId = ? AND parserError IS NOT NULL`).get(projectId).count;
|
|
149086
149246
|
const latest = this.db.prepare(`SELECT MAX(indexedAt) AS indexedAt FROM code_files WHERE projectId = ?`).get(projectId);
|
|
149087
149247
|
const latestSnapshot = this.latestSnapshot(projectId);
|
|
149248
|
+
const snapshots = this.db.prepare(`SELECT COUNT(*) AS count FROM code_state_snapshots WHERE projectId = ?`).get(projectId).count;
|
|
149249
|
+
const snapshotFiles = this.db.prepare(`SELECT COUNT(*) AS count FROM code_state_snapshot_files WHERE projectId = ?`).get(projectId).count;
|
|
149088
149250
|
return {
|
|
149089
149251
|
provider: "lite",
|
|
149090
149252
|
files,
|
|
@@ -149094,6 +149256,9 @@ var init_store = __esm({
|
|
|
149094
149256
|
semanticSymbols,
|
|
149095
149257
|
semanticEdges,
|
|
149096
149258
|
parserErrors,
|
|
149259
|
+
staleSymbols,
|
|
149260
|
+
snapshots,
|
|
149261
|
+
snapshotFiles,
|
|
149097
149262
|
...latest?.indexedAt ? { indexedAt: latest.indexedAt } : {},
|
|
149098
149263
|
...latestSnapshot ? { latestSnapshot } : {}
|
|
149099
149264
|
};
|
|
@@ -149578,7 +149743,7 @@ __export(lite_provider_exports, {
|
|
|
149578
149743
|
refreshProjectLite: () => refreshProjectLite
|
|
149579
149744
|
});
|
|
149580
149745
|
import { createHash as createHash11 } from "crypto";
|
|
149581
|
-
import { existsSync as
|
|
149746
|
+
import { existsSync as existsSync13, readdirSync as readdirSync2, readFileSync as readFileSync8, statSync as statSync3 } from "fs";
|
|
149582
149747
|
import { join as join4, relative as relative2 } from "path";
|
|
149583
149748
|
function hashText2(text3) {
|
|
149584
149749
|
return createHash11("sha256").update(text3).digest("hex");
|
|
@@ -149596,7 +149761,7 @@ function resolveMaxFileBytes(value) {
|
|
|
149596
149761
|
return Math.max(1, Math.floor(value));
|
|
149597
149762
|
}
|
|
149598
149763
|
function isPythonVirtualenvDir(dir) {
|
|
149599
|
-
return
|
|
149764
|
+
return existsSync13(join4(dir, "pyvenv.cfg"));
|
|
149600
149765
|
}
|
|
149601
149766
|
function walk(root, exclude, maxFiles) {
|
|
149602
149767
|
const out = [];
|
|
@@ -153512,7 +153677,7 @@ __export(vector_backfill_runner_exports, {
|
|
|
153512
153677
|
import { spawn as spawn4 } from "child_process";
|
|
153513
153678
|
import {
|
|
153514
153679
|
closeSync,
|
|
153515
|
-
existsSync as
|
|
153680
|
+
existsSync as existsSync14,
|
|
153516
153681
|
mkdirSync as mkdirSync2,
|
|
153517
153682
|
openSync,
|
|
153518
153683
|
readFileSync as readFileSync9,
|
|
@@ -153640,7 +153805,7 @@ function releaseVectorBackfillLock(lockPath = process.env.MEMORIX_VECTOR_BACKFIL
|
|
|
153640
153805
|
}
|
|
153641
153806
|
function launchDetachedVectorBackfill(request, options = {}) {
|
|
153642
153807
|
const runnerPath = options.runnerPath ?? resolveVectorBackfillRunnerPath();
|
|
153643
|
-
const exists = options.exists ??
|
|
153808
|
+
const exists = options.exists ?? existsSync14;
|
|
153644
153809
|
if (!exists(runnerPath)) return false;
|
|
153645
153810
|
const lock = acquireVectorBackfillLock(request.dataDir, request.projectId, options.lockPath);
|
|
153646
153811
|
if (!lock) return false;
|
|
@@ -153796,10 +153961,22 @@ function resetObservationRuntime() {
|
|
|
153796
153961
|
loadedObservationStore = null;
|
|
153797
153962
|
embeddingWriteMode = "background";
|
|
153798
153963
|
embeddingWorkerProjectRoot = void 0;
|
|
153799
|
-
|
|
153964
|
+
clearVectorMissingIds();
|
|
153800
153965
|
vectorSchemaUpgradePromise = null;
|
|
153801
153966
|
embeddingFailureLogTimestamps.clear();
|
|
153802
153967
|
}
|
|
153968
|
+
function markVectorMissing(observationId2, projectId) {
|
|
153969
|
+
vectorMissingIds.add(observationId2);
|
|
153970
|
+
vectorMissingProjectIds.set(observationId2, projectId);
|
|
153971
|
+
}
|
|
153972
|
+
function clearVectorMissing(observationId2) {
|
|
153973
|
+
vectorMissingIds.delete(observationId2);
|
|
153974
|
+
vectorMissingProjectIds.delete(observationId2);
|
|
153975
|
+
}
|
|
153976
|
+
function clearVectorMissingIds() {
|
|
153977
|
+
vectorMissingIds.clear();
|
|
153978
|
+
vectorMissingProjectIds.clear();
|
|
153979
|
+
}
|
|
153803
153980
|
function logEmbeddingFailureOnce(key, message) {
|
|
153804
153981
|
const now3 = Date.now();
|
|
153805
153982
|
const last = embeddingFailureLogTimestamps.get(key) ?? 0;
|
|
@@ -153919,10 +154096,13 @@ function isVectorCompatibleWithCurrentIndex(embedding) {
|
|
|
153919
154096
|
}
|
|
153920
154097
|
async function upgradeVectorSchemaAfterFirstEmbedding(embedding) {
|
|
153921
154098
|
if (isVectorCompatibleWithCurrentIndex(embedding)) return true;
|
|
153922
|
-
if (
|
|
154099
|
+
if (!embedding.every(Number.isFinite)) return false;
|
|
153923
154100
|
const targetProjectDir = projectDir;
|
|
153924
154101
|
if (!vectorSchemaUpgradePromise) {
|
|
153925
|
-
vectorSchemaUpgradePromise =
|
|
154102
|
+
vectorSchemaUpgradePromise = getDb().then(async () => {
|
|
154103
|
+
if (getVectorDimensions() === null && observations.length > 0) await reindexObservations();
|
|
154104
|
+
return projectDir === targetProjectDir && isVectorCompatibleWithCurrentIndex(embedding);
|
|
154105
|
+
}).catch(() => false).finally(() => {
|
|
153926
154106
|
vectorSchemaUpgradePromise = null;
|
|
153927
154107
|
});
|
|
153928
154108
|
}
|
|
@@ -153962,9 +154142,9 @@ async function initObservations(dir, options = {}) {
|
|
|
153962
154142
|
}
|
|
153963
154143
|
function scheduleObservationEmbedding(input) {
|
|
153964
154144
|
const { observationId: observationId2, projectId, searchableText, doc } = input;
|
|
153965
|
-
|
|
154145
|
+
markVectorMissing(observationId2, projectId);
|
|
153966
154146
|
if (isEmbeddingExplicitlyDisabled()) {
|
|
153967
|
-
|
|
154147
|
+
clearVectorMissing(observationId2);
|
|
153968
154148
|
return;
|
|
153969
154149
|
}
|
|
153970
154150
|
if (embeddingWriteMode === "deferred") {
|
|
@@ -153999,13 +154179,13 @@ function scheduleObservationEmbedding(input) {
|
|
|
153999
154179
|
vector: embedding
|
|
154000
154180
|
});
|
|
154001
154181
|
}
|
|
154002
|
-
|
|
154182
|
+
clearVectorMissing(observationId2);
|
|
154003
154183
|
} catch {
|
|
154004
154184
|
console.error(`[memorix] Embedding index update failed for obs-${observationId2} (kept in backfill queue)`);
|
|
154005
154185
|
queueVectorBackfill(projectId);
|
|
154006
154186
|
}
|
|
154007
154187
|
} else if (isEmbeddingExplicitlyDisabled()) {
|
|
154008
|
-
|
|
154188
|
+
clearVectorMissing(observationId2);
|
|
154009
154189
|
} else {
|
|
154010
154190
|
queueVectorBackfill(projectId);
|
|
154011
154191
|
logEmbeddingFailureOnce(
|
|
@@ -154565,7 +154745,7 @@ async function reindexObservations() {
|
|
|
154565
154745
|
if (observations.length === 0) return 0;
|
|
154566
154746
|
await resetDb();
|
|
154567
154747
|
searchIndexPrepared = false;
|
|
154568
|
-
|
|
154748
|
+
clearVectorMissingIds();
|
|
154569
154749
|
let embeddings = observations.map(() => null);
|
|
154570
154750
|
const provider2 = await getEmbeddingProvider();
|
|
154571
154751
|
const canBatchEmbedAtStartup = provider2 !== null && !provider2.name.startsWith("api-");
|
|
@@ -154630,7 +154810,7 @@ async function reindexObservations() {
|
|
|
154630
154810
|
};
|
|
154631
154811
|
await insertObservation(doc);
|
|
154632
154812
|
if (!compatibleEmbedding && !isEmbeddingExplicitlyDisabled()) {
|
|
154633
|
-
|
|
154813
|
+
markVectorMissing(obs.id, obs.projectId);
|
|
154634
154814
|
}
|
|
154635
154815
|
count2++;
|
|
154636
154816
|
} catch (err) {
|
|
@@ -154647,7 +154827,17 @@ async function prepareSearchIndex(options = {}) {
|
|
|
154647
154827
|
if (!isEmbeddingExplicitlyDisabled()) {
|
|
154648
154828
|
const store = getObservationStore();
|
|
154649
154829
|
const projects = await store.listProjectIds?.() ?? [];
|
|
154650
|
-
|
|
154830
|
+
await getDb({ allowNetworkProbe: false }).catch(() => void 0);
|
|
154831
|
+
const persistedIds = projectDir ? await getPersistentSemanticVectorIds(projectDir).catch(() => null) : null;
|
|
154832
|
+
for (const projectId of projects) {
|
|
154833
|
+
const projectObservations = await store.loadByProject(projectId);
|
|
154834
|
+
for (const observation of projectObservations) {
|
|
154835
|
+
if (!persistedIds?.has(observation.id)) markVectorMissing(observation.id, observation.projectId);
|
|
154836
|
+
}
|
|
154837
|
+
if (projectObservations.some((observation) => !persistedIds?.has(observation.id))) {
|
|
154838
|
+
queueVectorBackfill(projectId);
|
|
154839
|
+
}
|
|
154840
|
+
}
|
|
154651
154841
|
}
|
|
154652
154842
|
return 0;
|
|
154653
154843
|
}
|
|
@@ -154659,14 +154849,15 @@ async function prepareSearchIndex(options = {}) {
|
|
|
154659
154849
|
return 0;
|
|
154660
154850
|
}
|
|
154661
154851
|
const hydratedProjectDir = projectDir;
|
|
154662
|
-
const queueMissingVectors = () => {
|
|
154663
|
-
if (projectDir !== hydratedProjectDir) return;
|
|
154664
|
-
|
|
154852
|
+
const queueMissingVectors = async () => {
|
|
154853
|
+
if (!hydratedProjectDir || projectDir !== hydratedProjectDir) return;
|
|
154854
|
+
clearVectorMissingIds();
|
|
154665
154855
|
if (!isEmbeddingExplicitlyDisabled()) {
|
|
154856
|
+
const persistedSemanticIds = await getPersistentSemanticVectorIds(hydratedProjectDir).catch(() => null);
|
|
154666
154857
|
const projectsWithMissingVectors = /* @__PURE__ */ new Set();
|
|
154667
154858
|
for (const obs of observations) {
|
|
154668
|
-
if (!hasObservationVector(obs.projectId, obs.id)) {
|
|
154669
|
-
|
|
154859
|
+
if (!hasObservationVector(obs.projectId, obs.id) && !persistedSemanticIds?.has(obs.id)) {
|
|
154860
|
+
markVectorMissing(obs.id, obs.projectId);
|
|
154670
154861
|
projectsWithMissingVectors.add(obs.projectId);
|
|
154671
154862
|
}
|
|
154672
154863
|
}
|
|
@@ -154675,15 +154866,18 @@ async function prepareSearchIndex(options = {}) {
|
|
|
154675
154866
|
};
|
|
154676
154867
|
const cacheHydration = getDeferredCachedVectorHydration();
|
|
154677
154868
|
if (cacheHydration) {
|
|
154678
|
-
void cacheHydration.
|
|
154869
|
+
void cacheHydration.then(queueMissingVectors, queueMissingVectors).catch(() => void 0);
|
|
154679
154870
|
} else {
|
|
154680
|
-
queueMissingVectors();
|
|
154871
|
+
await queueMissingVectors();
|
|
154681
154872
|
}
|
|
154682
154873
|
searchIndexPrepared = true;
|
|
154683
154874
|
return count2;
|
|
154684
154875
|
}
|
|
154685
154876
|
function getVectorMissingIds(projectId) {
|
|
154686
154877
|
if (!projectId) return [...vectorMissingIds];
|
|
154878
|
+
if (!corpusLoaded) {
|
|
154879
|
+
return [...vectorMissingIds].filter((id) => vectorMissingProjectIds.get(id) === projectId);
|
|
154880
|
+
}
|
|
154687
154881
|
const observationById = new Map(observations.map((observation) => [observation.id, observation]));
|
|
154688
154882
|
return [...vectorMissingIds].filter((id) => observationById.get(id)?.projectId === projectId);
|
|
154689
154883
|
}
|
|
@@ -154721,7 +154915,8 @@ async function backfillVectorEmbeddings(options = {}) {
|
|
|
154721
154915
|
return { attempted: 0, succeeded: 0, failed: 0 };
|
|
154722
154916
|
}
|
|
154723
154917
|
vectorBackfillRunning = true;
|
|
154724
|
-
const
|
|
154918
|
+
const sourceObservations = corpusLoaded ? observations : options.projectId ? await getObservationStore().loadByProject(options.projectId, { status: "active" }) : await getObservationStore().loadAll();
|
|
154919
|
+
const observationById = new Map(sourceObservations.map((observation) => [observation.id, observation]));
|
|
154725
154920
|
const limit2 = Number.isFinite(options.limit) ? Math.max(1, Math.floor(options.limit)) : Number.POSITIVE_INFINITY;
|
|
154726
154921
|
const ids = [...vectorMissingIds].filter((id) => !options.projectId || observationById.get(id)?.projectId === options.projectId).slice(0, limit2);
|
|
154727
154922
|
let succeeded = 0;
|
|
@@ -154734,7 +154929,7 @@ async function backfillVectorEmbeddings(options = {}) {
|
|
|
154734
154929
|
for (const id of ids) {
|
|
154735
154930
|
const observation = observationById.get(id);
|
|
154736
154931
|
if (!observation) {
|
|
154737
|
-
|
|
154932
|
+
clearVectorMissing(id);
|
|
154738
154933
|
continue;
|
|
154739
154934
|
}
|
|
154740
154935
|
candidates.push({
|
|
@@ -154752,7 +154947,7 @@ async function backfillVectorEmbeddings(options = {}) {
|
|
|
154752
154947
|
const provider2 = await getEmbeddingProvider();
|
|
154753
154948
|
if (!provider2) {
|
|
154754
154949
|
if (isEmbeddingExplicitlyDisabled()) {
|
|
154755
|
-
for (const candidate of candidates)
|
|
154950
|
+
for (const candidate of candidates) clearVectorMissing(candidate.id);
|
|
154756
154951
|
} else {
|
|
154757
154952
|
recordFailure("embedding provider unavailable");
|
|
154758
154953
|
failed += candidates.length;
|
|
@@ -154829,7 +155024,7 @@ async function backfillVectorEmbeddings(options = {}) {
|
|
|
154829
155024
|
vector: embedding
|
|
154830
155025
|
});
|
|
154831
155026
|
}
|
|
154832
|
-
|
|
155027
|
+
clearVectorMissing(id);
|
|
154833
155028
|
succeeded++;
|
|
154834
155029
|
} catch (error) {
|
|
154835
155030
|
recordFailure(vectorBackfillError(error));
|
|
@@ -154854,7 +155049,7 @@ async function backfillVectorEmbeddings(options = {}) {
|
|
|
154854
155049
|
...lastFailure ? { lastError: lastFailure } : {}
|
|
154855
155050
|
};
|
|
154856
155051
|
}
|
|
154857
|
-
var observations, nextId, projectDir, searchIndexPrepared, embeddingWriteMode, embeddingWorkerProjectRoot, corpusLoaded, largeCorpusLazyMode, loadedObservationStore, DEFAULT_ORAMA_HYDRATION_THRESHOLD, vectorMissingIds, vectorBackfillRunning, vectorSchemaUpgradePromise, lastVectorBackfill, embeddingFailureLogTimestamps, EMBEDDING_FAILURE_LOG_COOLDOWN_MS, MAX_EMBEDDING_FAILURE_KEYS;
|
|
155052
|
+
var observations, nextId, projectDir, searchIndexPrepared, embeddingWriteMode, embeddingWorkerProjectRoot, corpusLoaded, largeCorpusLazyMode, loadedObservationStore, DEFAULT_ORAMA_HYDRATION_THRESHOLD, vectorMissingIds, vectorMissingProjectIds, vectorBackfillRunning, vectorSchemaUpgradePromise, lastVectorBackfill, embeddingFailureLogTimestamps, EMBEDDING_FAILURE_LOG_COOLDOWN_MS, MAX_EMBEDDING_FAILURE_KEYS;
|
|
154858
155053
|
var init_observations = __esm({
|
|
154859
155054
|
"src/memory/observations.ts"() {
|
|
154860
155055
|
"use strict";
|
|
@@ -154879,6 +155074,7 @@ var init_observations = __esm({
|
|
|
154879
155074
|
loadedObservationStore = null;
|
|
154880
155075
|
DEFAULT_ORAMA_HYDRATION_THRESHOLD = 1e4;
|
|
154881
155076
|
vectorMissingIds = /* @__PURE__ */ new Set();
|
|
155077
|
+
vectorMissingProjectIds = /* @__PURE__ */ new Map();
|
|
154882
155078
|
vectorBackfillRunning = false;
|
|
154883
155079
|
vectorSchemaUpgradePromise = null;
|
|
154884
155080
|
lastVectorBackfill = null;
|
|
@@ -158614,7 +158810,7 @@ var init_sanitizer = __esm({
|
|
|
158614
158810
|
});
|
|
158615
158811
|
|
|
158616
158812
|
// src/workspace/applier.ts
|
|
158617
|
-
import { existsSync as
|
|
158813
|
+
import { existsSync as existsSync15, mkdirSync as mkdirSync3, copyFileSync, writeFileSync as writeFileSync3, unlinkSync as unlinkSync2, renameSync } from "fs";
|
|
158618
158814
|
import { dirname } from "path";
|
|
158619
158815
|
var WorkspaceSyncApplier;
|
|
158620
158816
|
var init_applier = __esm({
|
|
@@ -158645,7 +158841,7 @@ var init_applier = __esm({
|
|
|
158645
158841
|
for (const file of files) {
|
|
158646
158842
|
try {
|
|
158647
158843
|
const dir = dirname(file.filePath);
|
|
158648
|
-
if (!
|
|
158844
|
+
if (!existsSync15(dir)) {
|
|
158649
158845
|
mkdirSync3(dir, { recursive: true });
|
|
158650
158846
|
}
|
|
158651
158847
|
} catch (err) {
|
|
@@ -158654,7 +158850,7 @@ var init_applier = __esm({
|
|
|
158654
158850
|
}
|
|
158655
158851
|
}
|
|
158656
158852
|
for (const file of files) {
|
|
158657
|
-
if (
|
|
158853
|
+
if (existsSync15(file.filePath)) {
|
|
158658
158854
|
try {
|
|
158659
158855
|
const backupPath = file.filePath + `.backup-${Date.now()}`;
|
|
158660
158856
|
copyFileSync(file.filePath, backupPath);
|
|
@@ -158705,7 +158901,7 @@ var init_applier = __esm({
|
|
|
158705
158901
|
cleanBackups(backups) {
|
|
158706
158902
|
for (const backup of backups) {
|
|
158707
158903
|
try {
|
|
158708
|
-
if (
|
|
158904
|
+
if (existsSync15(backup.backupPath)) {
|
|
158709
158905
|
unlinkSync2(backup.backupPath);
|
|
158710
158906
|
}
|
|
158711
158907
|
} catch {
|
|
@@ -158717,7 +158913,7 @@ var init_applier = __esm({
|
|
|
158717
158913
|
});
|
|
158718
158914
|
|
|
158719
158915
|
// src/workspace/engine.ts
|
|
158720
|
-
import { readFileSync as readFileSync10, readdirSync as readdirSync3, existsSync as
|
|
158916
|
+
import { readFileSync as readFileSync10, readdirSync as readdirSync3, existsSync as existsSync16, cpSync, mkdirSync as mkdirSync4 } from "fs";
|
|
158721
158917
|
import { join as join19 } from "path";
|
|
158722
158918
|
import { homedir as homedir21 } from "os";
|
|
158723
158919
|
var WorkspaceSyncEngine;
|
|
@@ -158797,7 +158993,7 @@ var init_engine4 = __esm({
|
|
|
158797
158993
|
}
|
|
158798
158994
|
const merged = /* @__PURE__ */ new Map();
|
|
158799
158995
|
for (const path38 of pathsToCheck) {
|
|
158800
|
-
if (
|
|
158996
|
+
if (existsSync16(path38)) {
|
|
158801
158997
|
try {
|
|
158802
158998
|
const content = readFileSync10(path38, "utf-8");
|
|
158803
158999
|
const servers = adapter.parse(content);
|
|
@@ -158851,7 +159047,7 @@ var init_engine4 = __esm({
|
|
|
158851
159047
|
const adapter = this.adapters.get(target);
|
|
158852
159048
|
const configPath = adapter.getConfigPath(this.projectRoot);
|
|
158853
159049
|
let configContent;
|
|
158854
|
-
if (target === "antigravity" &&
|
|
159050
|
+
if (target === "antigravity" && existsSync16(configPath)) {
|
|
158855
159051
|
try {
|
|
158856
159052
|
const existing = JSON.parse(readFileSync10(configPath, "utf-8"));
|
|
158857
159053
|
const generated = JSON.parse(adapter.generate(result.mcpServers.scanned));
|
|
@@ -158927,13 +159123,13 @@ var init_engine4 = __esm({
|
|
|
158927
159123
|
join19(home, dir)
|
|
158928
159124
|
];
|
|
158929
159125
|
for (const skillsRoot of paths) {
|
|
158930
|
-
if (!
|
|
159126
|
+
if (!existsSync16(skillsRoot)) continue;
|
|
158931
159127
|
try {
|
|
158932
159128
|
const entries = readdirSync3(skillsRoot, { withFileTypes: true });
|
|
158933
159129
|
for (const entry of entries) {
|
|
158934
159130
|
if (!entry.isDirectory()) continue;
|
|
158935
159131
|
const skillMd = join19(skillsRoot, entry.name, "SKILL.md");
|
|
158936
|
-
if (!
|
|
159132
|
+
if (!existsSync16(skillMd)) continue;
|
|
158937
159133
|
let description = "";
|
|
158938
159134
|
try {
|
|
158939
159135
|
const content = readFileSync10(skillMd, "utf-8");
|
|
@@ -158982,7 +159178,7 @@ var init_engine4 = __esm({
|
|
|
158982
159178
|
for (const skill2 of skills) {
|
|
158983
159179
|
if (skill2.sourceAgent === target) continue;
|
|
158984
159180
|
const dest = join19(targetDir, skill2.name);
|
|
158985
|
-
if (
|
|
159181
|
+
if (existsSync16(dest)) {
|
|
158986
159182
|
skipped.push(`${skill2.name} (already exists in ${target})`);
|
|
158987
159183
|
continue;
|
|
158988
159184
|
}
|
|
@@ -158998,7 +159194,7 @@ var init_engine4 = __esm({
|
|
|
158998
159194
|
scanWorkflows() {
|
|
158999
159195
|
const workflows = [];
|
|
159000
159196
|
const wfDir = join19(this.projectRoot, ".windsurf", "workflows");
|
|
159001
|
-
if (!
|
|
159197
|
+
if (!existsSync16(wfDir)) return workflows;
|
|
159002
159198
|
try {
|
|
159003
159199
|
const files = readdirSync3(wfDir).filter((f3) => f3.endsWith(".md"));
|
|
159004
159200
|
for (const file of files) {
|
|
@@ -160444,7 +160640,7 @@ var init_request_context = __esm({
|
|
|
160444
160640
|
function getMcpServerInfo() {
|
|
160445
160641
|
return {
|
|
160446
160642
|
name: "memorix",
|
|
160447
|
-
version: true ? "1.10.
|
|
160643
|
+
version: true ? "1.10.3" : "1.0.1"
|
|
160448
160644
|
};
|
|
160449
160645
|
}
|
|
160450
160646
|
function createMcpDiscoverResult(capabilities, serverInfo) {
|
|
@@ -160512,7 +160708,7 @@ __export(behavior_exports, {
|
|
|
160512
160708
|
getBehaviorConfig: () => getBehaviorConfig,
|
|
160513
160709
|
resetBehaviorConfigCache: () => resetBehaviorConfigCache
|
|
160514
160710
|
});
|
|
160515
|
-
import { existsSync as
|
|
160711
|
+
import { existsSync as existsSync17, readFileSync as readFileSync11 } from "fs";
|
|
160516
160712
|
import { homedir as homedir22 } from "os";
|
|
160517
160713
|
function isSessionInject(value) {
|
|
160518
160714
|
return value === "full" || value === "minimal" || value === "silent";
|
|
@@ -160523,7 +160719,7 @@ function isFormationMode(value) {
|
|
|
160523
160719
|
function legacyBehavior(homeDir) {
|
|
160524
160720
|
const configPath = getLegacyConfigJsonPath(homeDir);
|
|
160525
160721
|
try {
|
|
160526
|
-
if (!
|
|
160722
|
+
if (!existsSync17(configPath)) return {};
|
|
160527
160723
|
const parsed = JSON.parse(readFileSync11(configPath, "utf-8"));
|
|
160528
160724
|
return parsed.behavior && typeof parsed.behavior === "object" && !Array.isArray(parsed.behavior) ? parsed.behavior : {};
|
|
160529
160725
|
} catch {
|
|
@@ -161969,11 +162165,11 @@ __export(current_facts_exports, {
|
|
|
161969
162165
|
formatGitFact: () => formatGitFact
|
|
161970
162166
|
});
|
|
161971
162167
|
import { execFileSync } from "child_process";
|
|
161972
|
-
import { existsSync as
|
|
162168
|
+
import { existsSync as existsSync18, readFileSync as readFileSync12 } from "fs";
|
|
161973
162169
|
import path29 from "path";
|
|
161974
162170
|
function readTextIfExists(filePath) {
|
|
161975
162171
|
try {
|
|
161976
|
-
if (!
|
|
162172
|
+
if (!existsSync18(filePath)) return null;
|
|
161977
162173
|
return readFileSync12(filePath, "utf8");
|
|
161978
162174
|
} catch {
|
|
161979
162175
|
return null;
|
|
@@ -162264,7 +162460,7 @@ __export(external_provider_exports, {
|
|
|
162264
162460
|
runExternalCodeGraphLifecycle: () => runExternalCodeGraphLifecycle
|
|
162265
162461
|
});
|
|
162266
162462
|
import { spawn as spawn5 } from "child_process";
|
|
162267
|
-
import { existsSync as
|
|
162463
|
+
import { existsSync as existsSync19, readFileSync as readFileSync13 } from "fs";
|
|
162268
162464
|
import { delimiter, dirname as dirname2, extname, isAbsolute as isAbsolute3, join as join20, relative as relative4, resolve as resolve3, sep } from "path";
|
|
162269
162465
|
function boundedTimeout(value) {
|
|
162270
162466
|
if (!Number.isFinite(value)) return DEFAULT_EXTERNAL_CODEGRAPH_TIMEOUT_MS;
|
|
@@ -162301,13 +162497,13 @@ function resolveCommandCandidates(command) {
|
|
|
162301
162497
|
}
|
|
162302
162498
|
function resolveLaunch(command) {
|
|
162303
162499
|
for (const candidate of resolveCommandCandidates(command)) {
|
|
162304
|
-
if (!
|
|
162500
|
+
if (!existsSync19(candidate)) continue;
|
|
162305
162501
|
const extension3 = extname(candidate).toLowerCase();
|
|
162306
162502
|
if (extension3 === ".cmd") {
|
|
162307
162503
|
const bundleRoot = resolve3(dirname2(candidate), "..");
|
|
162308
162504
|
const node = join20(bundleRoot, "node.exe");
|
|
162309
162505
|
const entry = join20(bundleRoot, "lib", "dist", "bin", "codegraph.js");
|
|
162310
|
-
if (
|
|
162506
|
+
if (existsSync19(node) && existsSync19(entry)) {
|
|
162311
162507
|
return { executable: node, prefixArgs: ["--liftoff-only", entry] };
|
|
162312
162508
|
}
|
|
162313
162509
|
try {
|
|
@@ -162316,7 +162512,7 @@ function resolveLaunch(command) {
|
|
|
162316
162512
|
if (match2?.[1]) {
|
|
162317
162513
|
const base = dirname2(candidate).endsWith(sep) ? dirname2(candidate) : dirname2(candidate) + sep;
|
|
162318
162514
|
const entry2 = resolve3(match2[1].replace(/%(?:~)?dp0%?/gi, base));
|
|
162319
|
-
if (
|
|
162515
|
+
if (existsSync19(entry2)) return { executable: process.execPath, prefixArgs: [entry2] };
|
|
162320
162516
|
}
|
|
162321
162517
|
} catch {
|
|
162322
162518
|
}
|
|
@@ -162464,7 +162660,7 @@ async function inspectExternalCodeGraph(input) {
|
|
|
162464
162660
|
const health2 = { state: "disabled", reason: "External CodeGraph is disabled by configuration." };
|
|
162465
162661
|
return { health: health2, quality: providerQuality({ mode, health: health2 }) };
|
|
162466
162662
|
}
|
|
162467
|
-
if (!
|
|
162663
|
+
if (!existsSync19(join20(input.projectRoot, ".codegraph"))) {
|
|
162468
162664
|
const health2 = { state: "not-detected", reason: "No local .codegraph index is present for this project." };
|
|
162469
162665
|
return { health: health2, quality: providerQuality({ mode, health: health2 }) };
|
|
162470
162666
|
}
|
|
@@ -162500,7 +162696,7 @@ async function runExternalCodeGraphLifecycle(input) {
|
|
|
162500
162696
|
};
|
|
162501
162697
|
}
|
|
162502
162698
|
const indexPath = join20(input.projectRoot, ".codegraph");
|
|
162503
|
-
if (input.action === "sync" && !
|
|
162699
|
+
if (input.action === "sync" && !existsSync19(indexPath)) {
|
|
162504
162700
|
const health = { state: "not-detected", reason: "No local .codegraph index is present for this project." };
|
|
162505
162701
|
return {
|
|
162506
162702
|
action: input.action,
|
|
@@ -162510,7 +162706,7 @@ async function runExternalCodeGraphLifecycle(input) {
|
|
|
162510
162706
|
quality: providerQuality({ mode, health })
|
|
162511
162707
|
};
|
|
162512
162708
|
}
|
|
162513
|
-
if (input.action === "init" &&
|
|
162709
|
+
if (input.action === "init" && existsSync19(indexPath)) {
|
|
162514
162710
|
const inspected2 = await inspectExternalCodeGraph(input);
|
|
162515
162711
|
return {
|
|
162516
162712
|
action: input.action,
|
|
@@ -163272,13 +163468,13 @@ function buildCodeGraphDerivedView(input) {
|
|
|
163272
163468
|
...snapshot.sourceEpoch !== void 0 ? { generation: snapshot.sourceEpoch } : {},
|
|
163273
163469
|
freshness: snapshot.incomplete ? "stale" : "current",
|
|
163274
163470
|
rebuildStatus: snapshot.incomplete ? "failed" : "idle",
|
|
163275
|
-
...snapshot.incomplete ? { failureReason: "latest CodeGraph snapshot is incomplete" } : externalFailure && provider2?.external.reason ? { failureReason: provider2.external.reason
|
|
163471
|
+
...snapshot.incomplete ? { failureReason: "latest CodeGraph snapshot is incomplete" } : externalFailure && provider2?.external.reason ? { failureReason: sanitizeDerivedViewFailureReason(provider2.external.reason) } : {}
|
|
163276
163472
|
};
|
|
163277
163473
|
}
|
|
163278
163474
|
return {
|
|
163279
163475
|
freshness: "unknown",
|
|
163280
163476
|
rebuildStatus: externalFailure ? "failed" : "unavailable",
|
|
163281
|
-
...provider2?.external.reason ? { failureReason: provider2.external.reason
|
|
163477
|
+
...provider2?.external.reason ? { failureReason: sanitizeDerivedViewFailureReason(provider2.external.reason) } : { failureReason: "CodeGraph snapshot is not initialized" }
|
|
163282
163478
|
};
|
|
163283
163479
|
}
|
|
163284
163480
|
function buildBoundedContextReceipt(input) {
|
|
@@ -163308,6 +163504,7 @@ var init_context_receipt = __esm({
|
|
|
163308
163504
|
"src/knowledge/context-receipt.ts"() {
|
|
163309
163505
|
"use strict";
|
|
163310
163506
|
init_esm_shims();
|
|
163507
|
+
init_derived_view_receipt();
|
|
163311
163508
|
}
|
|
163312
163509
|
});
|
|
163313
163510
|
|
|
@@ -163924,7 +164121,7 @@ __export(auto_context_exports, {
|
|
|
163924
164121
|
formatAutoProjectContextSummary: () => formatAutoProjectContextSummary,
|
|
163925
164122
|
formatLegacyAutoProjectContextPrompt: () => formatLegacyAutoProjectContextPrompt
|
|
163926
164123
|
});
|
|
163927
|
-
import { existsSync as
|
|
164124
|
+
import { existsSync as existsSync20, statSync as statSync5 } from "fs";
|
|
163928
164125
|
import path30 from "path";
|
|
163929
164126
|
function activeProjectObservations(observations2, projectId) {
|
|
163930
164127
|
return observations2.filter((obs) => obs.projectId === projectId && (obs.status ?? "active") === "active");
|
|
@@ -163982,12 +164179,12 @@ function decideRefresh(input) {
|
|
|
163982
164179
|
return { performed: false, reason: "fresh-enough", message: "Existing project scan is fresh enough." };
|
|
163983
164180
|
}
|
|
163984
164181
|
async function buildAutoProjectContext(input) {
|
|
163985
|
-
const refreshMode = input.refresh ?? "auto";
|
|
163986
164182
|
const now3 = input.now ?? /* @__PURE__ */ new Date();
|
|
163987
164183
|
const task = input.task?.trim();
|
|
163988
164184
|
const lens = resolveTaskLens(task);
|
|
163989
164185
|
const continuationRequested = input.continuation === "always" || input.continuation !== "never" && isContinuationTask(task);
|
|
163990
164186
|
const codegraphConfig = getResolvedConfig({ projectRoot: input.project.rootPath }).codegraph;
|
|
164187
|
+
const refreshMode = input.refresh ?? codegraphConfig.autoRefresh ?? "auto";
|
|
163991
164188
|
const exclude = input.exclude ?? codegraphConfig.excludePatterns;
|
|
163992
164189
|
const maxFileBytes = input.maxFileBytes ?? codegraphConfig.maxFileBytes;
|
|
163993
164190
|
const store = new CodeGraphStore();
|
|
@@ -164299,7 +164496,7 @@ function existingLensCandidates(rootPath, lens) {
|
|
|
164299
164496
|
for (const candidate of lensPathCandidates(lens)) {
|
|
164300
164497
|
const absolute = path30.join(rootPath, candidate);
|
|
164301
164498
|
try {
|
|
164302
|
-
if (!
|
|
164499
|
+
if (!existsSync20(absolute)) continue;
|
|
164303
164500
|
const stat5 = statSync5(absolute);
|
|
164304
164501
|
if (stat5.isFile()) out.push(candidate);
|
|
164305
164502
|
if (stat5.isDirectory()) out.push(candidate.replace(/\\/g, "/"));
|
|
@@ -164823,7 +165020,7 @@ var engine_exports2 = {};
|
|
|
164823
165020
|
__export(engine_exports2, {
|
|
164824
165021
|
SkillsEngine: () => SkillsEngine
|
|
164825
165022
|
});
|
|
164826
|
-
import { existsSync as
|
|
165023
|
+
import { existsSync as existsSync21, readFileSync as readFileSync14, writeFileSync as writeFileSync4, mkdirSync as mkdirSync5, readdirSync as readdirSync4 } from "fs";
|
|
164827
165024
|
import { join as join21 } from "path";
|
|
164828
165025
|
import { homedir as homedir23 } from "os";
|
|
164829
165026
|
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;
|
|
@@ -164904,7 +165101,7 @@ var init_engine5 = __esm({
|
|
|
164904
165101
|
paths.push(join21(home, dir));
|
|
164905
165102
|
}
|
|
164906
165103
|
for (const skillsRoot of paths) {
|
|
164907
|
-
if (!
|
|
165104
|
+
if (!existsSync21(skillsRoot)) continue;
|
|
164908
165105
|
try {
|
|
164909
165106
|
const entries = readdirSync4(skillsRoot, { withFileTypes: true });
|
|
164910
165107
|
for (const entry of entries) {
|
|
@@ -164912,7 +165109,7 @@ var init_engine5 = __esm({
|
|
|
164912
165109
|
const name = entry.name;
|
|
164913
165110
|
if (seen.has(name)) continue;
|
|
164914
165111
|
const skillMd = join21(skillsRoot, name, "SKILL.md");
|
|
164915
|
-
if (!
|
|
165112
|
+
if (!existsSync21(skillMd)) continue;
|
|
164916
165113
|
try {
|
|
164917
165114
|
const content = readFileSync14(skillMd, "utf-8");
|
|
164918
165115
|
const description = this.parseDescription(content);
|
|
@@ -166491,6 +166688,30 @@ var init_export_import = __esm({
|
|
|
166491
166688
|
}
|
|
166492
166689
|
});
|
|
166493
166690
|
|
|
166691
|
+
// src/runtime/open-browser.ts
|
|
166692
|
+
import { spawn as spawn6 } from "child_process";
|
|
166693
|
+
function resolveLocalBrowserCommand(target, platform = process.platform) {
|
|
166694
|
+
const url = new URL(target);
|
|
166695
|
+
if (url.protocol !== "http:" || !LOCAL_HTTP_HOSTS.has(url.hostname) || !url.port || url.username || url.password) {
|
|
166696
|
+
throw new Error("Only unauthenticated loopback HTTP URLs can be opened automatically");
|
|
166697
|
+
}
|
|
166698
|
+
return platform === "win32" ? { command: "explorer.exe", args: [url.toString()] } : platform === "darwin" ? { command: "open", args: [url.toString()] } : { command: "xdg-open", args: [url.toString()] };
|
|
166699
|
+
}
|
|
166700
|
+
function openLocalBrowser(target) {
|
|
166701
|
+
const { command, args } = resolveLocalBrowserCommand(target);
|
|
166702
|
+
const child = spawn6(command, args, { detached: true, stdio: "ignore", windowsHide: true });
|
|
166703
|
+
child.once("error", () => void 0);
|
|
166704
|
+
child.unref();
|
|
166705
|
+
}
|
|
166706
|
+
var LOCAL_HTTP_HOSTS;
|
|
166707
|
+
var init_open_browser = __esm({
|
|
166708
|
+
"src/runtime/open-browser.ts"() {
|
|
166709
|
+
"use strict";
|
|
166710
|
+
init_esm_shims();
|
|
166711
|
+
LOCAL_HTTP_HOSTS = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "[::1]"]);
|
|
166712
|
+
}
|
|
166713
|
+
});
|
|
166714
|
+
|
|
166494
166715
|
// src/memory/cleanup.ts
|
|
166495
166716
|
function isLowQualityObservation(title) {
|
|
166496
166717
|
return LOW_QUALITY_PATTERNS.some((pattern) => pattern.test(title.trim()));
|
|
@@ -167499,7 +167720,6 @@ __export(server_exports, {
|
|
|
167499
167720
|
import { createServer } from "http";
|
|
167500
167721
|
import { promises as fs19 } from "fs";
|
|
167501
167722
|
import path32 from "path";
|
|
167502
|
-
import { exec } from "child_process";
|
|
167503
167723
|
function sendJson(res, data, status = 200) {
|
|
167504
167724
|
res.writeHead(status, {
|
|
167505
167725
|
"Content-Type": "application/json; charset=utf-8"
|
|
@@ -167936,7 +168156,7 @@ async function handleApi(req, res, dataDir, projectId, projectName, baseDir, pro
|
|
|
167936
168156
|
}
|
|
167937
168157
|
case "/config": {
|
|
167938
168158
|
const os6 = await import("os");
|
|
167939
|
-
const { existsSync:
|
|
168159
|
+
const { existsSync: existsSync24 } = await import("fs");
|
|
167940
168160
|
const { join: join26 } = await import("path");
|
|
167941
168161
|
const configProjectRoot = effectiveProjectRoot;
|
|
167942
168162
|
const resolved = getResolvedConfig({ projectRoot: configProjectRoot });
|
|
@@ -167964,7 +168184,7 @@ async function handleApi(req, res, dataDir, projectId, projectName, baseDir, pro
|
|
|
167964
168184
|
if (fpath === null) {
|
|
167965
168185
|
files[key] = { exists: false, path: "unavailable", unavailable: true };
|
|
167966
168186
|
} else {
|
|
167967
|
-
files[key] = { exists:
|
|
168187
|
+
files[key] = { exists: existsSync24(fpath), path: fpath };
|
|
167968
168188
|
}
|
|
167969
168189
|
}
|
|
167970
168190
|
} catch {
|
|
@@ -167989,7 +168209,8 @@ async function handleApi(req, res, dataDir, projectId, projectName, baseDir, pro
|
|
|
167989
168209
|
...resolved.memory.llm.provider === "openrouter" || resolved.memory.llm.baseUrl?.includes("openrouter.ai") ? ["OPENROUTER_API_KEY"] : [],
|
|
167990
168210
|
...resolved.memory.llm.provider === "requesty" ? ["REQUESTY_API_KEY"] : [],
|
|
167991
168211
|
...resolved.memory.llm.provider === "apiroute" ? ["API_ROUTE_API_KEY"] : [],
|
|
167992
|
-
...resolved.memory.llm.provider === "cheaperinference" ? ["CHEAPER_INFERENCE_API_KEY"] : []
|
|
168212
|
+
...resolved.memory.llm.provider === "cheaperinference" ? ["CHEAPER_INFERENCE_API_KEY"] : [],
|
|
168213
|
+
...resolved.memory.llm.provider === "runcrate" ? ["RUNCRATE_API_KEY"] : []
|
|
167993
168214
|
];
|
|
167994
168215
|
if (llmKey) {
|
|
167995
168216
|
const src = resolveDashboardKeySource({ value: llmKey, envKeys: memoryKeyEnv, configSource });
|
|
@@ -168204,9 +168425,10 @@ async function serveStatic(req, res, staticDir) {
|
|
|
168204
168425
|
}
|
|
168205
168426
|
}
|
|
168206
168427
|
function openBrowser(url) {
|
|
168207
|
-
|
|
168208
|
-
|
|
168209
|
-
}
|
|
168428
|
+
try {
|
|
168429
|
+
openLocalBrowser(url);
|
|
168430
|
+
} catch {
|
|
168431
|
+
}
|
|
168210
168432
|
}
|
|
168211
168433
|
function parseJsonField(value, fallback) {
|
|
168212
168434
|
if (typeof value !== "string") return value ?? fallback;
|
|
@@ -168442,6 +168664,7 @@ var init_server = __esm({
|
|
|
168442
168664
|
"src/dashboard/server.ts"() {
|
|
168443
168665
|
"use strict";
|
|
168444
168666
|
init_esm_shims();
|
|
168667
|
+
init_open_browser();
|
|
168445
168668
|
init_persistence();
|
|
168446
168669
|
init_obs_store();
|
|
168447
168670
|
init_session_store();
|
|
@@ -168776,7 +168999,7 @@ var init_task_graph = __esm({
|
|
|
168776
168999
|
|
|
168777
169000
|
// src/orchestrate/context-collector.ts
|
|
168778
169001
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
168779
|
-
import { readFileSync as readFileSync15, existsSync as
|
|
169002
|
+
import { readFileSync as readFileSync15, existsSync as existsSync22 } from "fs";
|
|
168780
169003
|
import { join as join22 } from "path";
|
|
168781
169004
|
function normalizeEntryLimit(value, fallback) {
|
|
168782
169005
|
if (!Number.isSafeInteger(value) || value < 1) return fallback;
|
|
@@ -168853,7 +169076,7 @@ function collectFileTree(projectDir2, maxEntries) {
|
|
|
168853
169076
|
function collectDependencies(projectDir2) {
|
|
168854
169077
|
try {
|
|
168855
169078
|
const pkgPath = join22(projectDir2, "package.json");
|
|
168856
|
-
if (!
|
|
169079
|
+
if (!existsSync22(pkgPath)) return "";
|
|
168857
169080
|
const pkg = JSON.parse(readFileSync15(pkgPath, "utf-8"));
|
|
168858
169081
|
const parts = [];
|
|
168859
169082
|
if (pkg.dependencies && Object.keys(pkg.dependencies).length > 0) {
|
|
@@ -169575,7 +169798,7 @@ async function analyzeImage(input) {
|
|
|
169575
169798
|
const config = getLLMConfig();
|
|
169576
169799
|
if (!OPENAI_COMPATIBLE_PROVIDERS.has(config.provider)) {
|
|
169577
169800
|
throw new Error(
|
|
169578
|
-
`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.`
|
|
169801
|
+
`Image analysis requires an OpenAI-compatible provider (openai, openrouter, requesty, apiroute, cheaperinference, runcrate, or custom). Current provider "${config.provider}" uses a different API shape. Set MEMORIX_LLM_PROVIDER=openai or configure an OpenAI-compatible base URL.`
|
|
169579
169802
|
);
|
|
169580
169803
|
}
|
|
169581
169804
|
const bytes = decodeBase64ImagePayload(input.base64, MAX_VISION_IMAGE_BYTES);
|
|
@@ -169614,7 +169837,7 @@ var init_image_loader = __esm({
|
|
|
169614
169837
|
init_provider2();
|
|
169615
169838
|
init_secret_filter();
|
|
169616
169839
|
init_image_payload();
|
|
169617
|
-
OPENAI_COMPATIBLE_PROVIDERS = /* @__PURE__ */ new Set(["openai", "openrouter", "requesty", "apiroute", "cheaperinference", "custom"]);
|
|
169840
|
+
OPENAI_COMPATIBLE_PROVIDERS = /* @__PURE__ */ new Set(["openai", "openrouter", "requesty", "apiroute", "cheaperinference", "runcrate", "custom"]);
|
|
169618
169841
|
MAX_VISION_PROMPT_CHARS = 12e3;
|
|
169619
169842
|
MAX_VISION_DESCRIPTION_CHARS = 12e3;
|
|
169620
169843
|
MAX_VISION_LABELS = 50;
|
|
@@ -171674,11 +171897,11 @@ __export(hooks_path_exports, {
|
|
|
171674
171897
|
resolveGitDir: () => resolveGitDir,
|
|
171675
171898
|
resolveHooksDir: () => resolveHooksDir
|
|
171676
171899
|
});
|
|
171677
|
-
import { existsSync as
|
|
171900
|
+
import { existsSync as existsSync23, readFileSync as readFileSync16, statSync as statSync6, mkdirSync as mkdirSync6 } from "fs";
|
|
171678
171901
|
import path35 from "path";
|
|
171679
171902
|
function resolveGitDir(projectRoot) {
|
|
171680
171903
|
const dotGit = path35.join(projectRoot, ".git");
|
|
171681
|
-
if (!
|
|
171904
|
+
if (!existsSync23(dotGit)) return null;
|
|
171682
171905
|
const stat5 = statSync6(dotGit);
|
|
171683
171906
|
if (stat5.isDirectory()) {
|
|
171684
171907
|
return dotGit;
|
|
@@ -171690,7 +171913,7 @@ function resolveGitDir(projectRoot) {
|
|
|
171690
171913
|
if (match2) {
|
|
171691
171914
|
const gitdir = match2[1].trim();
|
|
171692
171915
|
const resolved = path35.isAbsolute(gitdir) ? gitdir : path35.resolve(projectRoot, gitdir);
|
|
171693
|
-
if (
|
|
171916
|
+
if (existsSync23(resolved)) {
|
|
171694
171917
|
return resolved;
|
|
171695
171918
|
}
|
|
171696
171919
|
}
|
|
@@ -172898,7 +173121,18 @@ _Search mode: ${result.receipt.mode}_`;
|
|
|
172898
173121
|
text: text3
|
|
172899
173122
|
}
|
|
172900
173123
|
],
|
|
172901
|
-
|
|
173124
|
+
// Clients that surface only structuredContent (e.g. Claude Code) must
|
|
173125
|
+
// still see the results, not just the retrieval diagnostics.
|
|
173126
|
+
structuredContent: {
|
|
173127
|
+
results: result.entries.map((entry) => ({
|
|
173128
|
+
ref: formatEntryRef(entry),
|
|
173129
|
+
title: entry.title,
|
|
173130
|
+
type: entry.type,
|
|
173131
|
+
time: entry.time,
|
|
173132
|
+
tokens: entry.tokens
|
|
173133
|
+
})),
|
|
173134
|
+
retrieval: result.receipt
|
|
173135
|
+
}
|
|
172902
173136
|
};
|
|
172903
173137
|
}, { loadCorpus: false });
|
|
172904
173138
|
}
|
|
@@ -172948,7 +173182,7 @@ _Search mode: ${result.receipt.mode}_`;
|
|
|
172948
173182
|
inputSchema: {
|
|
172949
173183
|
task: z627.string().optional().describe("Current coding task or question"),
|
|
172950
173184
|
taskId: z627.string().max(120).optional().describe("Optional task continuity ledger id to include in the brief"),
|
|
172951
|
-
refresh: z627.enum(["auto", "always", "never"]).optional().
|
|
173185
|
+
refresh: z627.enum(["auto", "always", "never"]).optional().describe(
|
|
172952
173186
|
"Code Memory refresh policy. auto refreshes only when missing or stale."
|
|
172953
173187
|
),
|
|
172954
173188
|
format: z627.enum(["prompt", "summary", "json", "receipt"]).optional().default("prompt").describe(
|
|
@@ -173004,7 +173238,7 @@ _Search mode: ${result.receipt.mode}_`;
|
|
|
173004
173238
|
task,
|
|
173005
173239
|
taskId,
|
|
173006
173240
|
agent,
|
|
173007
|
-
refresh
|
|
173241
|
+
...refresh ? { refresh } : {},
|
|
173008
173242
|
reader: getObservationReader(),
|
|
173009
173243
|
enqueueRefresh: () => {
|
|
173010
173244
|
enqueueCodegraphRefresh2({
|
|
@@ -174966,9 +175200,12 @@ ${s2.instruction}`.toLowerCase();
|
|
|
174966
175200
|
}
|
|
174967
175201
|
} catch {
|
|
174968
175202
|
}
|
|
175203
|
+
const card = lines.filter(Boolean).join("\n");
|
|
174969
175204
|
return {
|
|
174970
|
-
content: [{ type: "text", text:
|
|
174971
|
-
structuredContent
|
|
175205
|
+
content: [{ type: "text", text: card }],
|
|
175206
|
+
// Clients that surface only structuredContent (e.g. Claude Code) must
|
|
175207
|
+
// still see the session card, not just the binding receipt.
|
|
175208
|
+
structuredContent: { card, binding: bindingReceipt }
|
|
174972
175209
|
};
|
|
174973
175210
|
}
|
|
174974
175211
|
);
|
|
@@ -175194,9 +175431,9 @@ ${json2}
|
|
|
175194
175431
|
req.end();
|
|
175195
175432
|
});
|
|
175196
175433
|
const projectUrl = `${url}?project=${encodeURIComponent(project.id)}`;
|
|
175197
|
-
const { exec
|
|
175434
|
+
const { exec } = await import("child_process");
|
|
175198
175435
|
const cmd = process.platform === "win32" ? `start "" "${projectUrl}"` : process.platform === "darwin" ? `open "${projectUrl}"` : `xdg-open "${projectUrl}"`;
|
|
175199
|
-
|
|
175436
|
+
exec(cmd, { windowsHide: true }, () => {
|
|
175200
175437
|
});
|
|
175201
175438
|
return {
|
|
175202
175439
|
content: [{
|
|
@@ -175245,9 +175482,9 @@ ${json2}
|
|
|
175245
175482
|
req.end();
|
|
175246
175483
|
});
|
|
175247
175484
|
const projectUrl = `${url}?project=${encodeURIComponent(project.id)}`;
|
|
175248
|
-
const { exec
|
|
175485
|
+
const { exec } = await import("child_process");
|
|
175249
175486
|
const cmd = process.platform === "win32" ? `start "" "${projectUrl}"` : process.platform === "darwin" ? `open "${projectUrl}"` : `xdg-open "${projectUrl}"`;
|
|
175250
|
-
|
|
175487
|
+
exec(cmd, { windowsHide: true }, () => {
|
|
175251
175488
|
});
|
|
175252
175489
|
return {
|
|
175253
175490
|
content: [{ type: "text", text: `Dashboard is already running at ${url}. Switched to project: ${project.name} (${project.id}).` }]
|
|
@@ -176398,10 +176635,10 @@ Preview: ${analysis.description.slice(0, 300)}${analysis.description.length > 30
|
|
|
176398
176635
|
const { ensureHooksDir: ensureHooksDir2 } = await Promise.resolve().then(() => (init_hooks_path(), hooks_path_exports));
|
|
176399
176636
|
const resolved = ensureHooksDir2(project.rootPath);
|
|
176400
176637
|
if (resolved) {
|
|
176401
|
-
const { existsSync:
|
|
176638
|
+
const { existsSync: existsSync24, readFileSync: readFileSync17, writeFileSync: writeFileSync5, chmodSync } = await import("fs");
|
|
176402
176639
|
const { hookPath } = resolved;
|
|
176403
176640
|
const HOOK_MARKER = "# [memorix-git-hook]";
|
|
176404
|
-
const needsInstall = !
|
|
176641
|
+
const needsInstall = !existsSync24(hookPath) || !readFileSync17(hookPath, "utf-8").includes(HOOK_MARKER);
|
|
176405
176642
|
if (needsInstall) {
|
|
176406
176643
|
const hookScript = `#!/bin/sh
|
|
176407
176644
|
${HOOK_MARKER}
|
|
@@ -176410,7 +176647,7 @@ if command -v memorix >/dev/null 2>&1; then
|
|
|
176410
176647
|
memorix ingest commit --auto >/dev/null 2>&1 &
|
|
176411
176648
|
fi
|
|
176412
176649
|
`;
|
|
176413
|
-
if (
|
|
176650
|
+
if (existsSync24(hookPath)) {
|
|
176414
176651
|
const existing = readFileSync17(hookPath, "utf-8");
|
|
176415
176652
|
writeFileSync5(hookPath, existing.trimEnd() + `
|
|
176416
176653
|
|
|
@@ -176576,6 +176813,7 @@ var init_server2 = __esm({
|
|
|
176576
176813
|
init_graph_scope();
|
|
176577
176814
|
init_visibility();
|
|
176578
176815
|
init_engine3();
|
|
176816
|
+
init_index_format();
|
|
176579
176817
|
init_graph_context();
|
|
176580
176818
|
init_detector();
|
|
176581
176819
|
init_launch_root();
|
|
@@ -177181,7 +177419,7 @@ var init_serve_shared = __esm({
|
|
|
177181
177419
|
|
|
177182
177420
|
// src/cli/version.ts
|
|
177183
177421
|
function getCliVersion() {
|
|
177184
|
-
return true ? "1.10.
|
|
177422
|
+
return true ? "1.10.3" : pkg.version;
|
|
177185
177423
|
}
|
|
177186
177424
|
var init_version3 = __esm({
|
|
177187
177425
|
"src/cli/version.ts"() {
|