@edihasaj/recall 0.9.6 → 0.9.8
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/README.md +24 -0
- package/dist/{chunk-BZF6TLQ3.js → chunk-4PK3YODK.js} +2 -2
- package/dist/{chunk-LLIYJ6CD.js → chunk-DUTMCVI6.js} +4 -4
- package/dist/{chunk-KDQYI5UT.js → chunk-GJKKJYFT.js} +3 -3
- package/dist/{chunk-G2OSUUTC.js → chunk-MZWZKD5S.js} +3 -3
- package/dist/{chunk-UDMQCRTL.js → chunk-O3E7BFYL.js} +20 -5
- package/dist/{chunk-UDMQCRTL.js.map → chunk-O3E7BFYL.js.map} +1 -1
- package/dist/{chunk-BMZ2NRLH.js → chunk-PFQSIYBM.js} +7 -7
- package/dist/{chunk-NMFI3TIF.js → chunk-PI6SYBQR.js} +6 -6
- package/dist/{chunk-QEYL4ZNZ.js → chunk-Q45VSX2J.js} +2 -2
- package/dist/{chunk-LXJWMIBR.js → chunk-U6FQSWUL.js} +2 -2
- package/dist/{chunk-IWKO72WH.js → chunk-WZWXYBP6.js} +16 -1
- package/dist/chunk-WZWXYBP6.js.map +1 -0
- package/dist/{cleanup-QIYS3OCH.js → cleanup-E7TX5RAW.js} +5 -5
- package/dist/cli.js +466 -63
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +10 -10
- package/dist/{dispatcher-VRR44JFE.js → dispatcher-CWKRKVT4.js} +5 -5
- package/dist/{embeddings-FEYQRSRV.js → embeddings-ER6YQSRM.js} +3 -3
- package/dist/{ingest-N6XSNRQH.js → ingest-S2KB2EY6.js} +4 -4
- package/dist/{keychain-PA25RZXE.js → keychain-5KXUHKMF.js} +4 -2
- package/dist/mcp.js +8 -8
- package/dist/{memory-value-X76RRECS.js → memory-value-NM24LKJY.js} +5 -5
- package/dist/{quality-5TZ3B4LR.js → quality-74KRD5CP.js} +6 -6
- package/dist/retrieval-E5LOMDYJ.js +13 -0
- package/dist/{tasks-UEJORN2X.js → tasks-Y6HOLQTQ.js} +5 -5
- package/package.json +1 -1
- package/dist/chunk-IWKO72WH.js.map +0 -1
- package/dist/retrieval-IRYNANIM.js +0 -13
- /package/dist/{chunk-BZF6TLQ3.js.map → chunk-4PK3YODK.js.map} +0 -0
- /package/dist/{chunk-LLIYJ6CD.js.map → chunk-DUTMCVI6.js.map} +0 -0
- /package/dist/{chunk-KDQYI5UT.js.map → chunk-GJKKJYFT.js.map} +0 -0
- /package/dist/{chunk-G2OSUUTC.js.map → chunk-MZWZKD5S.js.map} +0 -0
- /package/dist/{chunk-BMZ2NRLH.js.map → chunk-PFQSIYBM.js.map} +0 -0
- /package/dist/{chunk-NMFI3TIF.js.map → chunk-PI6SYBQR.js.map} +0 -0
- /package/dist/{chunk-QEYL4ZNZ.js.map → chunk-Q45VSX2J.js.map} +0 -0
- /package/dist/{chunk-LXJWMIBR.js.map → chunk-U6FQSWUL.js.map} +0 -0
- /package/dist/{cleanup-QIYS3OCH.js.map → cleanup-E7TX5RAW.js.map} +0 -0
- /package/dist/{dispatcher-VRR44JFE.js.map → dispatcher-CWKRKVT4.js.map} +0 -0
- /package/dist/{embeddings-FEYQRSRV.js.map → embeddings-ER6YQSRM.js.map} +0 -0
- /package/dist/{ingest-N6XSNRQH.js.map → ingest-S2KB2EY6.js.map} +0 -0
- /package/dist/{keychain-PA25RZXE.js.map → keychain-5KXUHKMF.js.map} +0 -0
- /package/dist/{memory-value-X76RRECS.js.map → memory-value-NM24LKJY.js.map} +0 -0
- /package/dist/{quality-5TZ3B4LR.js.map → quality-74KRD5CP.js.map} +0 -0
- /package/dist/{retrieval-IRYNANIM.js.map → retrieval-E5LOMDYJ.js.map} +0 -0
- /package/dist/{tasks-UEJORN2X.js.map → tasks-Y6HOLQTQ.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -23,15 +23,17 @@ import {
|
|
|
23
23
|
readCodexSessionStartInputFromStdin,
|
|
24
24
|
readCodexToolInputFromStdin,
|
|
25
25
|
restoreBackup
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-PI6SYBQR.js";
|
|
27
27
|
import {
|
|
28
28
|
RECALL_DB_USER_VERSION,
|
|
29
|
+
closeDb,
|
|
29
30
|
compileContext,
|
|
30
31
|
compileContextHybrid,
|
|
31
32
|
computeMetrics,
|
|
32
33
|
createActivityEvent,
|
|
33
34
|
createPolicy,
|
|
34
35
|
deletePolicy,
|
|
36
|
+
discoverLocalRepos,
|
|
35
37
|
endEvalSession,
|
|
36
38
|
evaluatePolicy,
|
|
37
39
|
exportClaude,
|
|
@@ -43,6 +45,7 @@ import {
|
|
|
43
45
|
formatValueRetrievalEvalReport,
|
|
44
46
|
getDbPath,
|
|
45
47
|
getDbUserVersion,
|
|
48
|
+
getRepoContextArtifactPath,
|
|
46
49
|
getSignalStats,
|
|
47
50
|
inferRepoSlugFromPath,
|
|
48
51
|
initDb,
|
|
@@ -66,7 +69,7 @@ import {
|
|
|
66
69
|
summarizeValueRetrievalEval,
|
|
67
70
|
togglePolicy,
|
|
68
71
|
writeRepoContextArtifact
|
|
69
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-O3E7BFYL.js";
|
|
70
73
|
import {
|
|
71
74
|
autoResolveContradictions,
|
|
72
75
|
computeAllHealthScores,
|
|
@@ -84,8 +87,8 @@ import {
|
|
|
84
87
|
recordAudit,
|
|
85
88
|
resolveContradiction,
|
|
86
89
|
rollbackMemory
|
|
87
|
-
} from "./chunk-
|
|
88
|
-
import "./chunk-
|
|
90
|
+
} from "./chunk-DUTMCVI6.js";
|
|
91
|
+
import "./chunk-GJKKJYFT.js";
|
|
89
92
|
import "./chunk-FHEH6QDU.js";
|
|
90
93
|
import "./chunk-CW3XJDH7.js";
|
|
91
94
|
import "./chunk-PUMEMKGF.js";
|
|
@@ -99,7 +102,7 @@ import {
|
|
|
99
102
|
listRepos,
|
|
100
103
|
queryMemories,
|
|
101
104
|
rejectMemory
|
|
102
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-4PK3YODK.js";
|
|
103
106
|
import {
|
|
104
107
|
atomicWriteUtf8File,
|
|
105
108
|
bootstrapEmbeddings,
|
|
@@ -114,13 +117,15 @@ import {
|
|
|
114
117
|
searchMemoryFtsIndex,
|
|
115
118
|
semanticSearch,
|
|
116
119
|
verifyEmbeddings
|
|
117
|
-
} from "./chunk-
|
|
120
|
+
} from "./chunk-U6FQSWUL.js";
|
|
118
121
|
import {
|
|
122
|
+
deleteApiKey,
|
|
123
|
+
hasKeychainApiKey,
|
|
119
124
|
init_keychain,
|
|
120
125
|
init_outbound_url,
|
|
121
126
|
keychain_exports,
|
|
122
127
|
normalizeSyncRemoteUrl
|
|
123
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-WZWXYBP6.js";
|
|
124
129
|
import "./chunk-EAFRT7RX.js";
|
|
125
130
|
import {
|
|
126
131
|
eq,
|
|
@@ -134,9 +139,9 @@ import {
|
|
|
134
139
|
|
|
135
140
|
// src/cli.ts
|
|
136
141
|
import { Command } from "commander";
|
|
137
|
-
import { resolve as
|
|
138
|
-
import { writeFileSync as writeFileSync7, readFileSync as
|
|
139
|
-
import { join as
|
|
142
|
+
import { resolve as resolve8 } from "path";
|
|
143
|
+
import { writeFileSync as writeFileSync7, readFileSync as readFileSync8 } from "fs";
|
|
144
|
+
import { join as join12 } from "path";
|
|
140
145
|
|
|
141
146
|
// src/ump/serve.ts
|
|
142
147
|
import {
|
|
@@ -2228,17 +2233,50 @@ import { join as join10 } from "path";
|
|
|
2228
2233
|
import Database from "better-sqlite3";
|
|
2229
2234
|
|
|
2230
2235
|
// src/daemon/launchd.ts
|
|
2231
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync5, rmSync as rmSync2, writeFileSync as writeFileSync5 } from "fs";
|
|
2236
|
+
import { chmodSync, existsSync as existsSync7, mkdirSync as mkdirSync5, rmSync as rmSync2, writeFileSync as writeFileSync5 } from "fs";
|
|
2232
2237
|
import { homedir as homedir2 } from "os";
|
|
2233
2238
|
import { dirname as dirname6, join as join8, resolve as resolve5 } from "path";
|
|
2234
2239
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
2240
|
+
|
|
2241
|
+
// src/daemon/provider-env.ts
|
|
2242
|
+
var DAEMON_PROVIDER_ENV_KEYS = [
|
|
2243
|
+
"OPENAI_API_KEY",
|
|
2244
|
+
"ANTHROPIC_API_KEY",
|
|
2245
|
+
"AZURE_OPENAI_ENDPOINT",
|
|
2246
|
+
"AZURE_OPENAI_DEPLOYMENT",
|
|
2247
|
+
"AZURE_OPENAI_API_VERSION",
|
|
2248
|
+
"AZURE_OPENAI_API_KEY"
|
|
2249
|
+
];
|
|
2250
|
+
function resolveDaemonProviderEnvironment(current, installed = {}) {
|
|
2251
|
+
const resolved = {};
|
|
2252
|
+
for (const key of DAEMON_PROVIDER_ENV_KEYS) {
|
|
2253
|
+
const value = current[key] ?? installed[key];
|
|
2254
|
+
if (value && value.trim().length > 0) {
|
|
2255
|
+
resolved[key] = value;
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
return resolved;
|
|
2259
|
+
}
|
|
2260
|
+
function readDaemonProviderEnvironment(environment) {
|
|
2261
|
+
const installed = {};
|
|
2262
|
+
for (const key of DAEMON_PROVIDER_ENV_KEYS) {
|
|
2263
|
+
const value = environment[key];
|
|
2264
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
2265
|
+
installed[key] = value;
|
|
2266
|
+
}
|
|
2267
|
+
}
|
|
2268
|
+
return installed;
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2271
|
+
// src/daemon/launchd.ts
|
|
2235
2272
|
var DEFAULT_LABEL = "com.recall.daemon";
|
|
2236
2273
|
function installLaunchAgent(opts = {}) {
|
|
2237
2274
|
assertDarwin();
|
|
2238
2275
|
const cfg = resolveConfig(opts);
|
|
2239
2276
|
mkdirSync5(dirname6(cfg.plistPath), { recursive: true });
|
|
2240
2277
|
mkdirSync5(dirname6(cfg.stdoutPath), { recursive: true });
|
|
2241
|
-
writeFileSync5(cfg.plistPath, renderPlist(cfg));
|
|
2278
|
+
writeFileSync5(cfg.plistPath, renderPlist(cfg), { mode: 384 });
|
|
2279
|
+
chmodSync(cfg.plistPath, 384);
|
|
2242
2280
|
tryRun2("launchctl", ["bootout", domainTarget(), cfg.plistPath]);
|
|
2243
2281
|
execFileSync4("launchctl", ["bootstrap", domainTarget(), cfg.plistPath], stdioOpts2());
|
|
2244
2282
|
execFileSync4("launchctl", ["enable", `${domainTarget()}/${cfg.label}`], stdioOpts2());
|
|
@@ -2334,6 +2372,7 @@ function resolveConfig(opts) {
|
|
|
2334
2372
|
);
|
|
2335
2373
|
const plistPath = join8(home, "Library", "LaunchAgents", `${label}.plist`);
|
|
2336
2374
|
const logDir = join8(dataDir, "logs");
|
|
2375
|
+
const installed = readInstalledConfig(plistPath);
|
|
2337
2376
|
return {
|
|
2338
2377
|
label,
|
|
2339
2378
|
port,
|
|
@@ -2347,7 +2386,11 @@ function resolveConfig(opts) {
|
|
|
2347
2386
|
repoRoots: opts.repoRoots ?? process.env.RECALL_REPO_ROOTS,
|
|
2348
2387
|
embeddingProvider: opts.embeddingProvider ?? process.env.RECALL_EMBEDDING_PROVIDER,
|
|
2349
2388
|
embeddingDims: opts.embeddingDims ?? process.env.RECALL_EMBEDDING_DIMS,
|
|
2350
|
-
embeddingsDisabled: opts.embeddingsDisabled ?? process.env.RECALL_EMBEDDINGS_DISABLED
|
|
2389
|
+
embeddingsDisabled: opts.embeddingsDisabled ?? process.env.RECALL_EMBEDDINGS_DISABLED,
|
|
2390
|
+
providerEnvironment: resolveDaemonProviderEnvironment(
|
|
2391
|
+
process.env,
|
|
2392
|
+
installed?.providerEnvironment
|
|
2393
|
+
)
|
|
2351
2394
|
};
|
|
2352
2395
|
}
|
|
2353
2396
|
function renderPlist(cfg) {
|
|
@@ -2359,8 +2402,11 @@ function renderPlist(cfg) {
|
|
|
2359
2402
|
...cfg.repoRoots ? { RECALL_REPO_ROOTS: cfg.repoRoots } : {},
|
|
2360
2403
|
...cfg.embeddingProvider ? { RECALL_EMBEDDING_PROVIDER: cfg.embeddingProvider } : {},
|
|
2361
2404
|
...cfg.embeddingDims ? { RECALL_EMBEDDING_DIMS: cfg.embeddingDims } : {},
|
|
2362
|
-
...cfg.embeddingsDisabled ? { RECALL_EMBEDDINGS_DISABLED: cfg.embeddingsDisabled } : {}
|
|
2405
|
+
...cfg.embeddingsDisabled ? { RECALL_EMBEDDINGS_DISABLED: cfg.embeddingsDisabled } : {},
|
|
2406
|
+
...cfg.providerEnvironment
|
|
2363
2407
|
};
|
|
2408
|
+
const environmentXml = Object.entries(env).map(([key, value]) => ` <key>${escapeXml(key)}</key>
|
|
2409
|
+
<string>${escapeXml(value)}</string>`).join("\n");
|
|
2364
2410
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
2365
2411
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
2366
2412
|
<plist version="1.0">
|
|
@@ -2374,23 +2420,8 @@ function renderPlist(cfg) {
|
|
|
2374
2420
|
</array>
|
|
2375
2421
|
<key>EnvironmentVariables</key>
|
|
2376
2422
|
<dict>
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
<key>RECALL_PORT</key>
|
|
2380
|
-
<string>${escapeXml(env.RECALL_PORT)}</string>
|
|
2381
|
-
<key>RECALL_MAINTENANCE_INTERVAL_SECONDS</key>
|
|
2382
|
-
<string>${escapeXml(env.RECALL_MAINTENANCE_INTERVAL_SECONDS)}</string>
|
|
2383
|
-
<key>RECALL_DATA_DIR</key>
|
|
2384
|
-
<string>${escapeXml(env.RECALL_DATA_DIR)}</string>
|
|
2385
|
-
${env.RECALL_REPO_ROOTS ? ` <key>RECALL_REPO_ROOTS</key>
|
|
2386
|
-
<string>${escapeXml(env.RECALL_REPO_ROOTS)}</string>
|
|
2387
|
-
` : ""}${env.RECALL_EMBEDDING_PROVIDER ? ` <key>RECALL_EMBEDDING_PROVIDER</key>
|
|
2388
|
-
<string>${escapeXml(env.RECALL_EMBEDDING_PROVIDER)}</string>
|
|
2389
|
-
` : ""}${env.RECALL_EMBEDDING_DIMS ? ` <key>RECALL_EMBEDDING_DIMS</key>
|
|
2390
|
-
<string>${escapeXml(env.RECALL_EMBEDDING_DIMS)}</string>
|
|
2391
|
-
` : ""}${env.RECALL_EMBEDDINGS_DISABLED ? ` <key>RECALL_EMBEDDINGS_DISABLED</key>
|
|
2392
|
-
<string>${escapeXml(env.RECALL_EMBEDDINGS_DISABLED)}</string>
|
|
2393
|
-
` : ""} </dict>
|
|
2423
|
+
${environmentXml}
|
|
2424
|
+
</dict>
|
|
2394
2425
|
<key>RunAtLoad</key>
|
|
2395
2426
|
<true/>
|
|
2396
2427
|
<key>KeepAlive</key>
|
|
@@ -2456,6 +2487,9 @@ function readInstalledConfig(plistPath) {
|
|
|
2456
2487
|
embeddingProvider: parsed?.EnvironmentVariables?.RECALL_EMBEDDING_PROVIDER,
|
|
2457
2488
|
embeddingDims: parsed?.EnvironmentVariables?.RECALL_EMBEDDING_DIMS,
|
|
2458
2489
|
embeddingsDisabled: parsed?.EnvironmentVariables?.RECALL_EMBEDDINGS_DISABLED,
|
|
2490
|
+
providerEnvironment: readDaemonProviderEnvironment(
|
|
2491
|
+
parsed?.EnvironmentVariables ?? {}
|
|
2492
|
+
),
|
|
2459
2493
|
stdoutPath: parsed?.StandardOutPath,
|
|
2460
2494
|
stderrPath: parsed?.StandardErrorPath
|
|
2461
2495
|
};
|
|
@@ -2481,7 +2515,7 @@ function assertDarwin() {
|
|
|
2481
2515
|
}
|
|
2482
2516
|
|
|
2483
2517
|
// src/daemon/systemd.ts
|
|
2484
|
-
import { existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as readFileSync5, rmSync as rmSync3, writeFileSync as writeFileSync6 } from "fs";
|
|
2518
|
+
import { chmodSync as chmodSync2, existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as readFileSync5, rmSync as rmSync3, writeFileSync as writeFileSync6 } from "fs";
|
|
2485
2519
|
import { homedir as homedir3 } from "os";
|
|
2486
2520
|
import { dirname as dirname7, join as join9, resolve as resolve6 } from "path";
|
|
2487
2521
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
@@ -2492,7 +2526,8 @@ function installSystemdUnit(opts = {}) {
|
|
|
2492
2526
|
const cfg = resolveConfig2(opts);
|
|
2493
2527
|
mkdirSync6(dirname7(cfg.unitPath), { recursive: true });
|
|
2494
2528
|
mkdirSync6(cfg.logDir, { recursive: true });
|
|
2495
|
-
writeFileSync6(cfg.unitPath, renderUnit(cfg));
|
|
2529
|
+
writeFileSync6(cfg.unitPath, renderUnit(cfg), { mode: 384 });
|
|
2530
|
+
chmodSync2(cfg.unitPath, 384);
|
|
2496
2531
|
systemctl(["--user", "daemon-reload"]);
|
|
2497
2532
|
systemctl(["--user", "enable", "--now", `${cfg.label}.service`]);
|
|
2498
2533
|
return getSystemdStatus(cfg.label);
|
|
@@ -2584,6 +2619,7 @@ function resolveConfig2(opts) {
|
|
|
2584
2619
|
const configHome = process.env.XDG_CONFIG_HOME ?? join9(home, ".config");
|
|
2585
2620
|
const unitPath = join9(configHome, "systemd", "user", `${label}.service`);
|
|
2586
2621
|
const logDir = join9(dataDir, "logs");
|
|
2622
|
+
const installed = readInstalledConfig2(unitPath);
|
|
2587
2623
|
return {
|
|
2588
2624
|
label,
|
|
2589
2625
|
port,
|
|
@@ -2596,7 +2632,11 @@ function resolveConfig2(opts) {
|
|
|
2596
2632
|
repoRoots: opts.repoRoots ?? process.env.RECALL_REPO_ROOTS,
|
|
2597
2633
|
embeddingProvider: opts.embeddingProvider ?? process.env.RECALL_EMBEDDING_PROVIDER,
|
|
2598
2634
|
embeddingDims: opts.embeddingDims ?? process.env.RECALL_EMBEDDING_DIMS,
|
|
2599
|
-
embeddingsDisabled: opts.embeddingsDisabled ?? process.env.RECALL_EMBEDDINGS_DISABLED
|
|
2635
|
+
embeddingsDisabled: opts.embeddingsDisabled ?? process.env.RECALL_EMBEDDINGS_DISABLED,
|
|
2636
|
+
providerEnvironment: resolveDaemonProviderEnvironment(
|
|
2637
|
+
process.env,
|
|
2638
|
+
installed?.providerEnvironment
|
|
2639
|
+
)
|
|
2600
2640
|
};
|
|
2601
2641
|
}
|
|
2602
2642
|
function defaultDaemonScript() {
|
|
@@ -2614,6 +2654,9 @@ function renderUnit(cfg) {
|
|
|
2614
2654
|
if (cfg.embeddingProvider) envLines.push(`Environment=RECALL_EMBEDDING_PROVIDER=${cfg.embeddingProvider}`);
|
|
2615
2655
|
if (cfg.embeddingDims) envLines.push(`Environment=RECALL_EMBEDDING_DIMS=${cfg.embeddingDims}`);
|
|
2616
2656
|
if (cfg.embeddingsDisabled) envLines.push(`Environment=RECALL_EMBEDDINGS_DISABLED=${cfg.embeddingsDisabled}`);
|
|
2657
|
+
for (const [key, value] of Object.entries(cfg.providerEnvironment)) {
|
|
2658
|
+
envLines.push(`Environment="${key}=${escapeSystemdValue(value)}"`);
|
|
2659
|
+
}
|
|
2617
2660
|
return `[Unit]
|
|
2618
2661
|
Description=Recall local daemon
|
|
2619
2662
|
After=network.target
|
|
@@ -2634,10 +2677,7 @@ function readInstalledConfig2(unitPath) {
|
|
|
2634
2677
|
try {
|
|
2635
2678
|
const raw = readFileSync5(unitPath, "utf8");
|
|
2636
2679
|
const exec = raw.match(/^ExecStart=(.+)$/m)?.[1]?.trim().split(/\s+/);
|
|
2637
|
-
const env =
|
|
2638
|
-
for (const m of raw.matchAll(/^Environment=([^=]+)=(.+)$/gm)) {
|
|
2639
|
-
defineOwn(env, m[1], m[2]);
|
|
2640
|
-
}
|
|
2680
|
+
const env = parseSystemdEnvironment(raw);
|
|
2641
2681
|
return {
|
|
2642
2682
|
nodePath: exec?.[0],
|
|
2643
2683
|
daemonScript: exec?.[1],
|
|
@@ -2647,12 +2687,30 @@ function readInstalledConfig2(unitPath) {
|
|
|
2647
2687
|
repoRoots: env.RECALL_REPO_ROOTS,
|
|
2648
2688
|
embeddingProvider: env.RECALL_EMBEDDING_PROVIDER,
|
|
2649
2689
|
embeddingDims: env.RECALL_EMBEDDING_DIMS,
|
|
2650
|
-
embeddingsDisabled: env.RECALL_EMBEDDINGS_DISABLED
|
|
2690
|
+
embeddingsDisabled: env.RECALL_EMBEDDINGS_DISABLED,
|
|
2691
|
+
providerEnvironment: readDaemonProviderEnvironment(env)
|
|
2651
2692
|
};
|
|
2652
2693
|
} catch {
|
|
2653
2694
|
return null;
|
|
2654
2695
|
}
|
|
2655
2696
|
}
|
|
2697
|
+
function parseSystemdEnvironment(raw) {
|
|
2698
|
+
const environment = {};
|
|
2699
|
+
for (const match of raw.matchAll(/^Environment=(?:"([^=]+)=(.*)"|([^=]+)=(.*))$/gm)) {
|
|
2700
|
+
const key = match[1] ?? match[3];
|
|
2701
|
+
const value = match[2] != null ? unescapeSystemdValue(match[2]) : match[4];
|
|
2702
|
+
if (key && value != null) {
|
|
2703
|
+
defineOwn(environment, key, value);
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
return environment;
|
|
2707
|
+
}
|
|
2708
|
+
function escapeSystemdValue(value) {
|
|
2709
|
+
return value.replaceAll("\\", "\\\\").replaceAll('"', '\\"').replaceAll("%", "%%");
|
|
2710
|
+
}
|
|
2711
|
+
function unescapeSystemdValue(value) {
|
|
2712
|
+
return value.replaceAll("%%", "%").replaceAll('\\"', '"').replaceAll("\\\\", "\\");
|
|
2713
|
+
}
|
|
2656
2714
|
function systemctl(args) {
|
|
2657
2715
|
execFileSync5("systemctl", args, { stdio: "pipe" });
|
|
2658
2716
|
}
|
|
@@ -3067,6 +3125,19 @@ function formatDoctorReport(report) {
|
|
|
3067
3125
|
return lines.join("\n");
|
|
3068
3126
|
}
|
|
3069
3127
|
|
|
3128
|
+
// src/data/purge.ts
|
|
3129
|
+
import { execFileSync as execFileSync6 } from "child_process";
|
|
3130
|
+
import {
|
|
3131
|
+
existsSync as existsSync10,
|
|
3132
|
+
readFileSync as readFileSync7,
|
|
3133
|
+
readdirSync,
|
|
3134
|
+
rmSync as rmSync4,
|
|
3135
|
+
rmdirSync
|
|
3136
|
+
} from "fs";
|
|
3137
|
+
import { homedir as homedir4 } from "os";
|
|
3138
|
+
import { dirname as dirname8, join as join11, parse, resolve as resolve7 } from "path";
|
|
3139
|
+
init_keychain();
|
|
3140
|
+
|
|
3070
3141
|
// src/daemon/service.ts
|
|
3071
3142
|
var isLinux = process.platform === "linux";
|
|
3072
3143
|
var isDarwin = process.platform === "darwin";
|
|
@@ -3104,6 +3175,281 @@ function defaultServiceLabel() {
|
|
|
3104
3175
|
return isLinux ? "recall-daemon" : "com.recall.daemon";
|
|
3105
3176
|
}
|
|
3106
3177
|
|
|
3178
|
+
// src/data/purge.ts
|
|
3179
|
+
var GENERATED_CONTEXT_MARKER = "<!-- Auto-generated by Recall. Do not edit manually. -->";
|
|
3180
|
+
var PROVIDERS = [
|
|
3181
|
+
"openai",
|
|
3182
|
+
"anthropic",
|
|
3183
|
+
"azure-openai"
|
|
3184
|
+
];
|
|
3185
|
+
function resolveRecallDataDir(options = {}) {
|
|
3186
|
+
const home = resolve7(options.homeDir ?? homedir4());
|
|
3187
|
+
return resolve7(options.dataDir ?? process.env.RECALL_DATA_DIR ?? join11(home, ".recall"));
|
|
3188
|
+
}
|
|
3189
|
+
function purgeLocalData(options = {}) {
|
|
3190
|
+
const dryRun = options.dryRun ?? false;
|
|
3191
|
+
const home = resolve7(options.homeDir ?? homedir4());
|
|
3192
|
+
const dataDir = resolveRecallDataDir({ dataDir: options.dataDir, homeDir: home });
|
|
3193
|
+
assertSafeDataDir(dataDir, home);
|
|
3194
|
+
const repoRoots = options.repoRoots ?? configuredRepoRoots(home);
|
|
3195
|
+
const actions = [];
|
|
3196
|
+
const contextPaths = findGeneratedContextArtifacts(repoRoots);
|
|
3197
|
+
if (options.keepIntegrations) {
|
|
3198
|
+
actions.push({
|
|
3199
|
+
category: "integration",
|
|
3200
|
+
target: "agent hooks, rules, and MCP registrations",
|
|
3201
|
+
status: "retained",
|
|
3202
|
+
detail: "--keep-integrations"
|
|
3203
|
+
});
|
|
3204
|
+
actions.push({
|
|
3205
|
+
category: "service",
|
|
3206
|
+
target: defaultServiceLabel(),
|
|
3207
|
+
status: "retained",
|
|
3208
|
+
detail: "--keep-integrations"
|
|
3209
|
+
});
|
|
3210
|
+
} else if (dryRun) {
|
|
3211
|
+
actions.push(...plannedIntegrationActions(repoRoots));
|
|
3212
|
+
} else {
|
|
3213
|
+
actions.push(...removeIntegrations(repoRoots));
|
|
3214
|
+
actions.push(removeDaemonService());
|
|
3215
|
+
}
|
|
3216
|
+
for (const provider of PROVIDERS) {
|
|
3217
|
+
if (dryRun) {
|
|
3218
|
+
actions.push({
|
|
3219
|
+
category: "credential",
|
|
3220
|
+
target: `macOS Keychain ${provider}`,
|
|
3221
|
+
status: "planned"
|
|
3222
|
+
});
|
|
3223
|
+
continue;
|
|
3224
|
+
}
|
|
3225
|
+
const present = hasKeychainApiKey(provider);
|
|
3226
|
+
const removed = present ? deleteApiKey(provider) : false;
|
|
3227
|
+
actions.push({
|
|
3228
|
+
category: "credential",
|
|
3229
|
+
target: `macOS Keychain ${provider}`,
|
|
3230
|
+
status: removed ? "removed" : present ? "failed" : "absent",
|
|
3231
|
+
detail: present && !removed ? "credential still present" : void 0
|
|
3232
|
+
});
|
|
3233
|
+
}
|
|
3234
|
+
for (const contextPath of contextPaths) {
|
|
3235
|
+
if (dryRun) {
|
|
3236
|
+
actions.push({
|
|
3237
|
+
category: "artifact",
|
|
3238
|
+
target: contextPath,
|
|
3239
|
+
status: "planned"
|
|
3240
|
+
});
|
|
3241
|
+
continue;
|
|
3242
|
+
}
|
|
3243
|
+
try {
|
|
3244
|
+
rmSync4(contextPath, { force: true });
|
|
3245
|
+
removeDirectoryIfEmpty(dirname8(contextPath));
|
|
3246
|
+
actions.push({
|
|
3247
|
+
category: "artifact",
|
|
3248
|
+
target: contextPath,
|
|
3249
|
+
status: "removed"
|
|
3250
|
+
});
|
|
3251
|
+
} catch (error) {
|
|
3252
|
+
actions.push(failed("artifact", contextPath, error));
|
|
3253
|
+
}
|
|
3254
|
+
}
|
|
3255
|
+
if (dryRun) {
|
|
3256
|
+
actions.push({
|
|
3257
|
+
category: "data",
|
|
3258
|
+
target: dataDir,
|
|
3259
|
+
status: existsSync10(dataDir) ? "planned" : "absent",
|
|
3260
|
+
detail: "database, WAL, backups, logs, caches, models, and sync state"
|
|
3261
|
+
});
|
|
3262
|
+
} else {
|
|
3263
|
+
try {
|
|
3264
|
+
closeDb();
|
|
3265
|
+
const existed = existsSync10(dataDir);
|
|
3266
|
+
rmSync4(dataDir, { recursive: true, force: true });
|
|
3267
|
+
actions.push({
|
|
3268
|
+
category: "data",
|
|
3269
|
+
target: dataDir,
|
|
3270
|
+
status: existed ? "removed" : "absent",
|
|
3271
|
+
detail: "database, WAL, backups, logs, caches, models, and sync state"
|
|
3272
|
+
});
|
|
3273
|
+
} catch (error) {
|
|
3274
|
+
actions.push(failed("data", dataDir, error));
|
|
3275
|
+
}
|
|
3276
|
+
}
|
|
3277
|
+
return {
|
|
3278
|
+
dry_run: dryRun,
|
|
3279
|
+
data_dir: dataDir,
|
|
3280
|
+
integrations_retained: options.keepIntegrations ?? false,
|
|
3281
|
+
actions,
|
|
3282
|
+
failures: actions.filter((action) => action.status === "failed").length
|
|
3283
|
+
};
|
|
3284
|
+
}
|
|
3285
|
+
function assertSafeDataDir(dataDir, home) {
|
|
3286
|
+
const root = parse(dataDir).root;
|
|
3287
|
+
if (dataDir === root || dataDir === home) {
|
|
3288
|
+
throw new Error(`Refusing unsafe Recall data directory: ${dataDir}`);
|
|
3289
|
+
}
|
|
3290
|
+
}
|
|
3291
|
+
function configuredRepoRoots(home) {
|
|
3292
|
+
const configured = process.env.RECALL_REPO_ROOTS?.split(",").map((value) => value.trim()).filter(Boolean);
|
|
3293
|
+
return configured?.length ? configured.map((value) => resolve7(value)) : [join11(home, "Projects")];
|
|
3294
|
+
}
|
|
3295
|
+
function findGeneratedContextArtifacts(repoRoots) {
|
|
3296
|
+
const paths = /* @__PURE__ */ new Set();
|
|
3297
|
+
for (const repo of discoverLocalRepos(repoRoots)) {
|
|
3298
|
+
const candidate = getRepoContextArtifactPath(repo.repo_path);
|
|
3299
|
+
if (isGeneratedContext(candidate)) paths.add(candidate);
|
|
3300
|
+
}
|
|
3301
|
+
const cwdCandidate = getRepoContextArtifactPath(process.cwd());
|
|
3302
|
+
if (isGeneratedContext(cwdCandidate)) paths.add(cwdCandidate);
|
|
3303
|
+
return [...paths].sort();
|
|
3304
|
+
}
|
|
3305
|
+
function isGeneratedContext(path) {
|
|
3306
|
+
if (!existsSync10(path)) return false;
|
|
3307
|
+
try {
|
|
3308
|
+
return readFileSync7(path, "utf8").startsWith(GENERATED_CONTEXT_MARKER);
|
|
3309
|
+
} catch {
|
|
3310
|
+
return false;
|
|
3311
|
+
}
|
|
3312
|
+
}
|
|
3313
|
+
function plannedIntegrationActions(repoRoots) {
|
|
3314
|
+
const actions = [
|
|
3315
|
+
planned("service", defaultServiceLabel()),
|
|
3316
|
+
planned("integration", "Claude Code hooks, memory override, and Recall MCP"),
|
|
3317
|
+
planned("integration", "Codex hooks and Recall MCP")
|
|
3318
|
+
];
|
|
3319
|
+
for (const agent of listAgentNames().filter(isHooklessAgent)) {
|
|
3320
|
+
actions.push(planned("integration", `${agent} Recall MCP and managed rules`));
|
|
3321
|
+
}
|
|
3322
|
+
for (const repo of discoverLocalRepos(repoRoots)) {
|
|
3323
|
+
actions.push(planned("integration", `${repo.repo_path} managed Recall rules`));
|
|
3324
|
+
}
|
|
3325
|
+
return actions;
|
|
3326
|
+
}
|
|
3327
|
+
function removeIntegrations(repoRoots) {
|
|
3328
|
+
const actions = [];
|
|
3329
|
+
actions.push(fromInstallResult(
|
|
3330
|
+
"Claude Code hooks",
|
|
3331
|
+
uninstallClaudeCodeHooks()
|
|
3332
|
+
));
|
|
3333
|
+
actions.push(fromInstallResult(
|
|
3334
|
+
"Claude Code memory override",
|
|
3335
|
+
uninstallClaudeCodeMemoryOverride()
|
|
3336
|
+
));
|
|
3337
|
+
actions.push(fromInstallResult("Codex hooks", uninstallCodexHooks()));
|
|
3338
|
+
actions.push(removeCliMcp("claude", ["mcp", "remove", "recall", "-s", "user"]));
|
|
3339
|
+
actions.push(removeCliMcp("codex", ["mcp", "remove", "recall"]));
|
|
3340
|
+
const hookless = listAgentNames().filter(isHooklessAgent);
|
|
3341
|
+
for (const name of hookless) {
|
|
3342
|
+
const adapter = resolveAdapter(name);
|
|
3343
|
+
if (adapter.removeMcpFallback) {
|
|
3344
|
+
actions.push(fromInstallResult(
|
|
3345
|
+
`${name} Recall MCP`,
|
|
3346
|
+
adapter.removeMcpFallback()
|
|
3347
|
+
));
|
|
3348
|
+
}
|
|
3349
|
+
if (adapter.rulesScope === "global" && adapter.uninstallRules) {
|
|
3350
|
+
actions.push(fromInstallResult(
|
|
3351
|
+
`${name} managed rules`,
|
|
3352
|
+
adapter.uninstallRules()
|
|
3353
|
+
));
|
|
3354
|
+
}
|
|
3355
|
+
}
|
|
3356
|
+
for (const repo of discoverLocalRepos(repoRoots)) {
|
|
3357
|
+
for (const name of hookless) {
|
|
3358
|
+
const adapter = resolveAdapter(name);
|
|
3359
|
+
if (adapter.rulesScope !== "project" || !adapter.uninstallRules) continue;
|
|
3360
|
+
actions.push(fromInstallResult(
|
|
3361
|
+
`${name} managed rules in ${repo.repo_path}`,
|
|
3362
|
+
adapter.uninstallRules({ cwd: repo.repo_path })
|
|
3363
|
+
));
|
|
3364
|
+
}
|
|
3365
|
+
actions.push(removeCliMcp(
|
|
3366
|
+
"claude",
|
|
3367
|
+
["mcp", "remove", "recall", "-s", "project"],
|
|
3368
|
+
repo.repo_path
|
|
3369
|
+
));
|
|
3370
|
+
}
|
|
3371
|
+
return actions;
|
|
3372
|
+
}
|
|
3373
|
+
function removeCliMcp(command, args, cwd) {
|
|
3374
|
+
const target = `${command} Recall MCP${cwd ? ` in ${cwd}` : ""}`;
|
|
3375
|
+
try {
|
|
3376
|
+
execFileSync6(command, ["mcp", "get", "recall"], {
|
|
3377
|
+
cwd,
|
|
3378
|
+
stdio: "ignore",
|
|
3379
|
+
timeout: 1e4
|
|
3380
|
+
});
|
|
3381
|
+
} catch {
|
|
3382
|
+
return {
|
|
3383
|
+
category: "integration",
|
|
3384
|
+
target,
|
|
3385
|
+
status: "absent",
|
|
3386
|
+
detail: "not registered or CLI unavailable"
|
|
3387
|
+
};
|
|
3388
|
+
}
|
|
3389
|
+
try {
|
|
3390
|
+
execFileSync6(command, args, {
|
|
3391
|
+
cwd,
|
|
3392
|
+
stdio: "ignore",
|
|
3393
|
+
timeout: 1e4
|
|
3394
|
+
});
|
|
3395
|
+
return { category: "integration", target, status: "removed" };
|
|
3396
|
+
} catch (error) {
|
|
3397
|
+
return {
|
|
3398
|
+
category: "integration",
|
|
3399
|
+
target,
|
|
3400
|
+
status: "failed",
|
|
3401
|
+
detail: error instanceof Error ? error.message : "MCP removal failed"
|
|
3402
|
+
};
|
|
3403
|
+
}
|
|
3404
|
+
}
|
|
3405
|
+
function removeDaemonService() {
|
|
3406
|
+
const label = defaultServiceLabel();
|
|
3407
|
+
if (process.platform !== "darwin" && process.platform !== "linux") {
|
|
3408
|
+
return {
|
|
3409
|
+
category: "service",
|
|
3410
|
+
target: label,
|
|
3411
|
+
status: "absent",
|
|
3412
|
+
detail: `unsupported platform ${process.platform}`
|
|
3413
|
+
};
|
|
3414
|
+
}
|
|
3415
|
+
try {
|
|
3416
|
+
const status = uninstallService(label);
|
|
3417
|
+
return {
|
|
3418
|
+
category: "service",
|
|
3419
|
+
target: label,
|
|
3420
|
+
status: status.installed || status.loaded ? "failed" : "removed",
|
|
3421
|
+
detail: status.installed || status.loaded ? "service still reports installed or loaded" : void 0
|
|
3422
|
+
};
|
|
3423
|
+
} catch (error) {
|
|
3424
|
+
return failed("service", label, error);
|
|
3425
|
+
}
|
|
3426
|
+
}
|
|
3427
|
+
function planned(category, target) {
|
|
3428
|
+
return { category, target, status: "planned" };
|
|
3429
|
+
}
|
|
3430
|
+
function fromInstallResult(target, result) {
|
|
3431
|
+
return {
|
|
3432
|
+
category: "integration",
|
|
3433
|
+
target,
|
|
3434
|
+
status: result.ok ? result.changed ? "removed" : "absent" : "failed",
|
|
3435
|
+
detail: result.message
|
|
3436
|
+
};
|
|
3437
|
+
}
|
|
3438
|
+
function failed(category, target, error) {
|
|
3439
|
+
return {
|
|
3440
|
+
category,
|
|
3441
|
+
target,
|
|
3442
|
+
status: "failed",
|
|
3443
|
+
detail: error instanceof Error ? error.message : String(error)
|
|
3444
|
+
};
|
|
3445
|
+
}
|
|
3446
|
+
function removeDirectoryIfEmpty(path) {
|
|
3447
|
+
try {
|
|
3448
|
+
if (readdirSync(path).length === 0) rmdirSync(path);
|
|
3449
|
+
} catch {
|
|
3450
|
+
}
|
|
3451
|
+
}
|
|
3452
|
+
|
|
3107
3453
|
// src/cli.ts
|
|
3108
3454
|
var require2 = createRequire(import.meta.url);
|
|
3109
3455
|
var pkg = require2("../package.json");
|
|
@@ -3199,6 +3545,33 @@ dbCmd.command("restore <date>").description("Restore the local database from a d
|
|
|
3199
3545
|
}
|
|
3200
3546
|
console.log(`Restored ${result.from} -> ${result.to}`);
|
|
3201
3547
|
});
|
|
3548
|
+
var dataCmd = program.command("data").description("Manage all local Recall data");
|
|
3549
|
+
dataCmd.command("purge").description("Permanently erase local Recall data, credentials, exports, and integrations").option("--dry-run", "Show what would be erased without changing anything").option("--yes", "Confirm permanent erasure without an interactive prompt").option("--json", "Emit a stable JSON result").option("--keep-integrations", "Keep daemon, hooks, rules, and MCP registrations").option("--data-dir <dir>", "Override the Recall data directory").action(async (opts) => {
|
|
3550
|
+
if (!opts.dryRun && !opts.yes) {
|
|
3551
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
3552
|
+
console.error("Refusing to purge without --yes in non-interactive mode.");
|
|
3553
|
+
process.exitCode = 2;
|
|
3554
|
+
return;
|
|
3555
|
+
}
|
|
3556
|
+
const confirmed = await confirmLocalDataPurge();
|
|
3557
|
+
if (!confirmed) {
|
|
3558
|
+
console.error("Aborted local data purge.");
|
|
3559
|
+
process.exitCode = 1;
|
|
3560
|
+
return;
|
|
3561
|
+
}
|
|
3562
|
+
}
|
|
3563
|
+
const result = purgeLocalData({
|
|
3564
|
+
dataDir: opts.dataDir,
|
|
3565
|
+
dryRun: opts.dryRun,
|
|
3566
|
+
keepIntegrations: opts.keepIntegrations
|
|
3567
|
+
});
|
|
3568
|
+
if (opts.json) {
|
|
3569
|
+
console.log(JSON.stringify(result, null, 2));
|
|
3570
|
+
} else {
|
|
3571
|
+
printLocalDataPurgeResult(result);
|
|
3572
|
+
}
|
|
3573
|
+
if (result.failures > 0) process.exitCode = 1;
|
|
3574
|
+
});
|
|
3202
3575
|
var setupCmd = program.command("setup").description("Setup Recall for local use");
|
|
3203
3576
|
setupCmd.option("--app-path <path>", "Override Recall.app path", "/Applications/Recall.app").option("--hooks-only", "Install hooks only").option("--mcp-only", "Install MCP wiring only").option("--agent <agent>", "Restrict setup to a single agent (repeatable)", collectAgents, []).option("--uninstall-hooks", "Remove Recall-managed hooks while leaving MCP configured").option("--dry-run", "Show planned setup changes without writing").option("--scope <scope>", "Hook config scope: global or project", "global").option("--no-prompt-injection", "Opt out of per-prompt memory injection (writes RECALL_HOOK_INJECT_PROMPT=false inline into the agent hook command)").option("--no-claude-md", "Skip installing the managed CLAUDE.md memory-override block for Claude Code (the block stops Claude's built-in auto-memory from racing Recall)").option("--yes", "Skip confirmation prompt").action(async (opts) => {
|
|
3204
3577
|
if (!opts.yes && !opts.dryRun) {
|
|
@@ -3278,17 +3651,17 @@ function safeHookAction(event, action) {
|
|
|
3278
3651
|
} catch (error) {
|
|
3279
3652
|
let logPath = "~/.recall/logs/hook-errors.log";
|
|
3280
3653
|
try {
|
|
3281
|
-
const { appendFileSync, mkdirSync: mkdirSync7, statSync, renameSync: renameSync4, rmSync:
|
|
3282
|
-
const { homedir:
|
|
3283
|
-
const dir =
|
|
3654
|
+
const { appendFileSync, mkdirSync: mkdirSync7, statSync, renameSync: renameSync4, rmSync: rmSync5 } = await import("fs");
|
|
3655
|
+
const { homedir: homedir5 } = await import("os");
|
|
3656
|
+
const dir = join12(homedir5(), ".recall", "logs");
|
|
3284
3657
|
mkdirSync7(dir, { recursive: true });
|
|
3285
|
-
logPath =
|
|
3658
|
+
logPath = join12(dir, "hook-errors.log");
|
|
3286
3659
|
try {
|
|
3287
3660
|
const maxBytes = parseInt(process.env.RECALL_HOOK_LOG_MAX_BYTES ?? String(1024 * 1024), 10);
|
|
3288
3661
|
if (maxBytes > 0 && statSync(logPath).size >= maxBytes) {
|
|
3289
3662
|
const rotated = `${logPath}.1`;
|
|
3290
3663
|
try {
|
|
3291
|
-
|
|
3664
|
+
rmSync5(rotated, { force: true });
|
|
3292
3665
|
} catch {
|
|
3293
3666
|
}
|
|
3294
3667
|
renameSync4(logPath, rotated);
|
|
@@ -3439,7 +3812,7 @@ program.command("ump").description("Serve the Universal Memory Protocol (UMP) ov
|
|
|
3439
3812
|
});
|
|
3440
3813
|
program.command("scan").description("Scan a repository and bootstrap memories").argument("[path]", "Repository path", ".").option("-s, --session <id>", "Session ID").action((path, opts) => {
|
|
3441
3814
|
const db = initDb();
|
|
3442
|
-
const repoPath =
|
|
3815
|
+
const repoPath = resolve8(path);
|
|
3443
3816
|
const ids = scanAndStore(db, repoPath);
|
|
3444
3817
|
const artifact = writeRepoContextArtifact(db, {
|
|
3445
3818
|
repo: inferRepoSlugFromPath(repoPath),
|
|
@@ -3685,7 +4058,7 @@ program.command("export").description("Export memories as markdown instruction f
|
|
|
3685
4058
|
console.error(`Could not resolve local repo path for ${opts.repo}`);
|
|
3686
4059
|
process.exit(1);
|
|
3687
4060
|
}
|
|
3688
|
-
content =
|
|
4061
|
+
content = readFileSync8(artifact.output_path, "utf-8");
|
|
3689
4062
|
if (!opts.output) {
|
|
3690
4063
|
console.log(content);
|
|
3691
4064
|
return;
|
|
@@ -3704,7 +4077,7 @@ program.command("export").description("Export memories as markdown instruction f
|
|
|
3704
4077
|
});
|
|
3705
4078
|
program.command("publish").description("Write repo-local .recall/context.md for the current repo").argument("[path]", "Repository path", ".").action((path) => {
|
|
3706
4079
|
const db = initDb();
|
|
3707
|
-
const repoPath =
|
|
4080
|
+
const repoPath = resolve8(path);
|
|
3708
4081
|
const artifact = writeRepoContextArtifact(db, {
|
|
3709
4082
|
repo: inferRepoSlugFromPath(repoPath),
|
|
3710
4083
|
repo_path: repoPath
|
|
@@ -3833,7 +4206,7 @@ evalCmd.command("value-retrieval").description("Run retrieval eval cases synthes
|
|
|
3833
4206
|
});
|
|
3834
4207
|
let snapshot = null;
|
|
3835
4208
|
if (opts.snapshot) {
|
|
3836
|
-
const { computeQualityReport, recordQualitySnapshot } = await import("./quality-
|
|
4209
|
+
const { computeQualityReport, recordQualitySnapshot } = await import("./quality-74KRD5CP.js");
|
|
3837
4210
|
const qualityReport = computeQualityReport(db, { sinceIso: report.since });
|
|
3838
4211
|
snapshot = recordQualitySnapshot(
|
|
3839
4212
|
db,
|
|
@@ -4325,7 +4698,7 @@ graphCmd.command("stats").description("Show entity/relation counts").action(asyn
|
|
|
4325
4698
|
});
|
|
4326
4699
|
graphCmd.command("backfill").description("Run the heuristic extractor over every active memory (idempotent)").option("--repo <repo>", "Limit to a single repo").option("--limit <n>", "Cap rows processed", "10000").option("--rebuild", "Clear all existing entities/relations first, then re-extract").action(async (opts) => {
|
|
4327
4700
|
const db = initDb();
|
|
4328
|
-
const { ingestMemoryHeuristic } = await import("./ingest-
|
|
4701
|
+
const { ingestMemoryHeuristic } = await import("./ingest-S2KB2EY6.js");
|
|
4329
4702
|
if (opts.rebuild) {
|
|
4330
4703
|
const { clearGraph } = await import("./store-5C7ZKKZF.js");
|
|
4331
4704
|
clearGraph(db);
|
|
@@ -4368,8 +4741,8 @@ graphCmd.command("entities").description("List entities").option("--repo <repo>"
|
|
|
4368
4741
|
});
|
|
4369
4742
|
graphCmd.command("query <query...>").description("Run graph-aware retrieval for a query").option("--repo <repo>", "Restrict to repo").option("--hops <n>", "Graph hops", "2").option("--limit <n>", "Max hits", "10").action(async (queryTokens, opts) => {
|
|
4370
4743
|
const db = initDb();
|
|
4371
|
-
const { graphQuery } = await import("./retrieval-
|
|
4372
|
-
const { loadEmbeddingConfigFromEnv: loadEmbeddingConfigFromEnv2 } = await import("./embeddings-
|
|
4744
|
+
const { graphQuery } = await import("./retrieval-E5LOMDYJ.js");
|
|
4745
|
+
const { loadEmbeddingConfigFromEnv: loadEmbeddingConfigFromEnv2 } = await import("./embeddings-ER6YQSRM.js");
|
|
4373
4746
|
const embeddingConfig = loadEmbeddingConfigFromEnv2();
|
|
4374
4747
|
const result = await graphQuery(db, queryTokens.join(" "), embeddingConfig, {
|
|
4375
4748
|
repo: opts.repo,
|
|
@@ -4385,7 +4758,7 @@ graphCmd.command("query <query...>").description("Run graph-aware retrieval for
|
|
|
4385
4758
|
});
|
|
4386
4759
|
var maintenanceCmd = program.command("maintenance").description("Inspect and manage the delegated maintenance task queue");
|
|
4387
4760
|
maintenanceCmd.command("stats").description("Show backlog counts, completion stats, and mean latency").action(async () => {
|
|
4388
|
-
const { getTaskStats } = await import("./tasks-
|
|
4761
|
+
const { getTaskStats } = await import("./tasks-Y6HOLQTQ.js");
|
|
4389
4762
|
const db = initDb();
|
|
4390
4763
|
const stats = getTaskStats(db);
|
|
4391
4764
|
console.log(`Total tasks: ${stats.total}`);
|
|
@@ -4411,7 +4784,7 @@ maintenanceCmd.command("stats").description("Show backlog counts, completion sta
|
|
|
4411
4784
|
}
|
|
4412
4785
|
});
|
|
4413
4786
|
maintenanceCmd.command("list").description("List tasks (default: pending)").option("-s, --status <status>", "pending|claimed|completed|abandoned", "pending").option("-k, --kind <kind>", "Filter by kind").option("-r, --repo <repo>", "Filter by repo").option("-n, --limit <n>", "Max entries", "20").action(async (opts) => {
|
|
4414
|
-
const { listTasks } = await import("./tasks-
|
|
4787
|
+
const { listTasks } = await import("./tasks-Y6HOLQTQ.js");
|
|
4415
4788
|
const db = initDb();
|
|
4416
4789
|
const tasks = listTasks(db, {
|
|
4417
4790
|
status: opts.status,
|
|
@@ -4433,7 +4806,7 @@ maintenanceCmd.command("list").description("List tasks (default: pending)").opti
|
|
|
4433
4806
|
}
|
|
4434
4807
|
});
|
|
4435
4808
|
maintenanceCmd.command("drop").description("Delete a task by id (or id prefix)").argument("<task-id>", "Task id or prefix").action(async (taskIdArg) => {
|
|
4436
|
-
const { deleteTask, listTasks } = await import("./tasks-
|
|
4809
|
+
const { deleteTask, listTasks } = await import("./tasks-Y6HOLQTQ.js");
|
|
4437
4810
|
const db = initDb();
|
|
4438
4811
|
const all = listTasks(db, { limit: 1e4 });
|
|
4439
4812
|
const matches = all.filter((t) => t.id === taskIdArg || t.id.startsWith(taskIdArg));
|
|
@@ -4452,7 +4825,7 @@ maintenanceCmd.command("drop").description("Delete a task by id (or id prefix)")
|
|
|
4452
4825
|
});
|
|
4453
4826
|
var credentialsCmd = maintenanceCmd.command("credentials").description("Manage LLM provider API keys in macOS Keychain (env fallback on other platforms)");
|
|
4454
4827
|
credentialsCmd.command("list", { isDefault: true }).description("Show which providers have credentials available").action(async () => {
|
|
4455
|
-
const { listCredentials } = await import("./keychain-
|
|
4828
|
+
const { listCredentials } = await import("./keychain-5KXUHKMF.js");
|
|
4456
4829
|
const creds = listCredentials();
|
|
4457
4830
|
if (creds.length === 0) {
|
|
4458
4831
|
console.log("No API keys configured. Set one with:");
|
|
@@ -4466,7 +4839,7 @@ credentialsCmd.command("list", { isDefault: true }).description("Show which prov
|
|
|
4466
4839
|
}
|
|
4467
4840
|
});
|
|
4468
4841
|
credentialsCmd.command("set").description("Store credentials for an LLM provider in the macOS Keychain").argument("<provider>", "openai|anthropic|azure").argument("[key]", "API key (prompts via stdin if omitted; required for openai/anthropic and for azure unless --stdin-json is used)").option("--endpoint <url>", "Azure OpenAI resource endpoint (e.g. https://myresource.openai.azure.com)").option("--deployment <name>", "Azure OpenAI deployment name").option("--api-version <version>", "Azure OpenAI api-version (e.g. 2024-10-21)").option("--stdin-json", "Read the azure config (endpoint/deployment/api_version/key) as a JSON object from stdin").action(async (providerArg, keyArg, opts) => {
|
|
4469
|
-
const { setApiKey, setAzureConfig } = await import("./keychain-
|
|
4842
|
+
const { setApiKey, setAzureConfig } = await import("./keychain-5KXUHKMF.js");
|
|
4470
4843
|
const provider = providerArg === "azure" ? "azure-openai" : providerArg;
|
|
4471
4844
|
if (provider === "openai" || provider === "anthropic") {
|
|
4472
4845
|
const key = keyArg ?? await readStdinKey();
|
|
@@ -4528,19 +4901,19 @@ credentialsCmd.command("set").description("Store credentials for an LLM provider
|
|
|
4528
4901
|
process.exit(1);
|
|
4529
4902
|
});
|
|
4530
4903
|
credentialsCmd.command("clear").description("Remove provider credentials from the macOS Keychain").argument("<provider>", "openai|anthropic|azure").action(async (providerArg) => {
|
|
4531
|
-
const { deleteApiKey } = await import("./keychain-
|
|
4904
|
+
const { deleteApiKey: deleteApiKey2 } = await import("./keychain-5KXUHKMF.js");
|
|
4532
4905
|
const provider = providerArg === "azure" ? "azure-openai" : providerArg;
|
|
4533
4906
|
if (provider !== "openai" && provider !== "anthropic" && provider !== "azure-openai") {
|
|
4534
4907
|
console.error(`Provider must be "openai", "anthropic", or "azure", got "${providerArg}".`);
|
|
4535
4908
|
process.exit(1);
|
|
4536
4909
|
}
|
|
4537
|
-
const removed =
|
|
4910
|
+
const removed = deleteApiKey2(provider);
|
|
4538
4911
|
if (removed) console.log(`Removed ${provider} credentials from Keychain.`);
|
|
4539
4912
|
else console.log(`No ${provider} credentials found in Keychain.`);
|
|
4540
4913
|
});
|
|
4541
4914
|
maintenanceCmd.command("dispatch").description("Run the daemon-owned dispatcher once against pending maintenance tasks (requires a configured LLM provider)").option("--provider <provider>", "openai|anthropic|azure-openai (defaults to whichever is configured)").option("--model <model>", "Model override").option("--kind <kind>", "Restrict to a single task kind (repeatable)", (value, acc = []) => [...acc, value], []).option("--repo <repo>", "Restrict to a single repo").option("--max <n>", "Max tasks to run this round", "5").option("--dry-run", "Show which tasks would be dispatched; do not call the LLM").option("--preview", "Show the actual prompts that would be sent (no provider needed; no LLM call)").option("--json", "Emit the raw JSON report").action(async (opts) => {
|
|
4542
|
-
const { dispatchPendingTasks, formatDispatchReport, buildPrompt } = await import("./dispatcher-
|
|
4543
|
-
const { listTasks } = await import("./tasks-
|
|
4915
|
+
const { dispatchPendingTasks, formatDispatchReport, buildPrompt } = await import("./dispatcher-CWKRKVT4.js");
|
|
4916
|
+
const { listTasks } = await import("./tasks-Y6HOLQTQ.js");
|
|
4544
4917
|
const db = initDb();
|
|
4545
4918
|
if (opts.preview) {
|
|
4546
4919
|
const pending = listTasks(db, {
|
|
@@ -4597,7 +4970,7 @@ ${p.prompt.max_output_tokens}
|
|
|
4597
4970
|
console.log(formatDispatchReport(report));
|
|
4598
4971
|
});
|
|
4599
4972
|
maintenanceCmd.command("cleanup").description("Run deterministic, LLM-free cleanup for duplicate, low-quality, stale, and mis-scoped memories").option("--apply", "Persist changes (default is dry-run)").option("--only <action>", "Restrict to one action: dedupe_exact_merge|reject_fragment_candidate|promote_repeat_correction|suppress_unproductive_command|globalize_cross_repo|reject_test_fixture_repo|reject_invalid_scope|reject_generic_scanned_tooling").option("--revert <run-id>", "Revert a previous cleanup run (id or 8-char prefix)").option("--list", "List recent cleanup runs").option("--json", "Emit the raw JSON report").action(async (opts) => {
|
|
4600
|
-
const { runDeterministicCleanup, formatCleanupReport, revertCleanupRun, listCleanupRuns } = await import("./cleanup-
|
|
4973
|
+
const { runDeterministicCleanup, formatCleanupReport, revertCleanupRun, listCleanupRuns } = await import("./cleanup-E7TX5RAW.js");
|
|
4601
4974
|
const db = initDb();
|
|
4602
4975
|
if (opts.list) {
|
|
4603
4976
|
const runs = listCleanupRuns(db);
|
|
@@ -4651,7 +5024,7 @@ maintenanceCmd.command("quality").description("Show injection outcome distributi
|
|
|
4651
5024
|
recordQualitySnapshot,
|
|
4652
5025
|
listQualitySnapshots,
|
|
4653
5026
|
diffQualitySnapshots
|
|
4654
|
-
} = await import("./quality-
|
|
5027
|
+
} = await import("./quality-74KRD5CP.js");
|
|
4655
5028
|
const db = initDb();
|
|
4656
5029
|
if (opts.history) {
|
|
4657
5030
|
const snaps = listQualitySnapshots(db);
|
|
@@ -4712,7 +5085,7 @@ maintenanceCmd.command("value-backfill").description("Backfill memory value even
|
|
|
4712
5085
|
const {
|
|
4713
5086
|
backfillMemoryValueEvents,
|
|
4714
5087
|
formatMemoryValueBackfillReport
|
|
4715
|
-
} = await import("./memory-value-
|
|
5088
|
+
} = await import("./memory-value-NM24LKJY.js");
|
|
4716
5089
|
const db = initDb();
|
|
4717
5090
|
const report = backfillMemoryValueEvents(db, {
|
|
4718
5091
|
sinceIso: opts.since,
|
|
@@ -4808,6 +5181,36 @@ async function confirmSetupWrite(scope) {
|
|
|
4808
5181
|
rl.close();
|
|
4809
5182
|
}
|
|
4810
5183
|
}
|
|
5184
|
+
async function confirmLocalDataPurge() {
|
|
5185
|
+
const { createInterface } = await import("readline/promises");
|
|
5186
|
+
const rl = createInterface({
|
|
5187
|
+
input: process.stdin,
|
|
5188
|
+
output: process.stdout
|
|
5189
|
+
});
|
|
5190
|
+
try {
|
|
5191
|
+
console.log(
|
|
5192
|
+
"This permanently erases Recall databases, backups, logs, model caches, Keychain credentials, generated repo context, daemon service, hooks, rules, and MCP registrations."
|
|
5193
|
+
);
|
|
5194
|
+
const answer = await rl.question('Type "PURGE" to continue: ');
|
|
5195
|
+
return answer.trim() === "PURGE";
|
|
5196
|
+
} finally {
|
|
5197
|
+
rl.close();
|
|
5198
|
+
}
|
|
5199
|
+
}
|
|
5200
|
+
function printLocalDataPurgeResult(result) {
|
|
5201
|
+
console.log(result.dry_run ? "Recall local data purge plan:" : "Recall local data purge:");
|
|
5202
|
+
for (const action of result.actions) {
|
|
5203
|
+
const detail = action.detail ? ` (${action.detail})` : "";
|
|
5204
|
+
console.log(` ${action.status.padEnd(8)} ${action.target}${detail}`);
|
|
5205
|
+
}
|
|
5206
|
+
if (result.dry_run) {
|
|
5207
|
+
console.log("No changes made. Run with --yes to permanently erase these items.");
|
|
5208
|
+
} else if (result.failures === 0) {
|
|
5209
|
+
console.log("Local Recall data erased.");
|
|
5210
|
+
} else {
|
|
5211
|
+
console.error(`Purge incomplete: ${result.failures} action(s) failed.`);
|
|
5212
|
+
}
|
|
5213
|
+
}
|
|
4811
5214
|
function findByPrefix(db, prefix) {
|
|
4812
5215
|
const exact = getMemory(db, prefix);
|
|
4813
5216
|
if (exact) return exact;
|