@edihasaj/recall 1.0.9 → 1.0.11
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 +15 -1
- package/dist/{chunk-TGWUGUVH.js → chunk-3IF7HONQ.js} +20 -8
- package/dist/chunk-3IF7HONQ.js.map +1 -0
- package/dist/{chunk-QAFWA4U6.js → chunk-6B5OQLIE.js} +6 -4
- package/dist/chunk-6B5OQLIE.js.map +1 -0
- package/dist/{chunk-YC64D4QN.js → chunk-D57YOEJH.js} +2 -2
- package/dist/{chunk-SGL4ZDGZ.js → chunk-WVVH7AVR.js} +3 -3
- package/dist/{cleanup-OJBSLUMO.js → cleanup-MDEYU6TC.js} +4 -2
- package/dist/cli.js +182 -48
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +4 -4
- package/dist/{dispatcher-IIFTDIOW.js → dispatcher-PNYGUIKO.js} +2 -2
- package/dist/mcp.js +3 -3
- package/dist/{tasks-UEROYP6D.js → tasks-RR4E4JAG.js} +4 -2
- package/package.json +1 -1
- package/dist/chunk-QAFWA4U6.js.map +0 -1
- package/dist/chunk-TGWUGUVH.js.map +0 -1
- /package/dist/{chunk-YC64D4QN.js.map → chunk-D57YOEJH.js.map} +0 -0
- /package/dist/{chunk-SGL4ZDGZ.js.map → chunk-WVVH7AVR.js.map} +0 -0
- /package/dist/{cleanup-OJBSLUMO.js.map → cleanup-MDEYU6TC.js.map} +0 -0
- /package/dist/{dispatcher-IIFTDIOW.js.map → dispatcher-PNYGUIKO.js.map} +0 -0
- /package/dist/{tasks-UEROYP6D.js.map → tasks-RR4E4JAG.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
readCodexSessionStartInputFromStdin,
|
|
24
24
|
readCodexToolInputFromStdin,
|
|
25
25
|
restoreBackup
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-6B5OQLIE.js";
|
|
27
27
|
import {
|
|
28
28
|
RECALL_DB_USER_VERSION,
|
|
29
29
|
closeDb,
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
summarizeValueRetrievalEval,
|
|
70
70
|
togglePolicy,
|
|
71
71
|
writeRepoContextArtifact
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-D57YOEJH.js";
|
|
73
73
|
import {
|
|
74
74
|
autoResolveContradictions,
|
|
75
75
|
computeAllHealthScores,
|
|
@@ -87,7 +87,7 @@ import {
|
|
|
87
87
|
recordAudit,
|
|
88
88
|
resolveContradiction,
|
|
89
89
|
rollbackMemory
|
|
90
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-3IF7HONQ.js";
|
|
91
91
|
import "./chunk-TYXRTMDK.js";
|
|
92
92
|
import "./chunk-FHEH6QDU.js";
|
|
93
93
|
import "./chunk-CW3XJDH7.js";
|
|
@@ -140,7 +140,7 @@ import {
|
|
|
140
140
|
// src/cli.ts
|
|
141
141
|
import { Command } from "commander";
|
|
142
142
|
import { resolve as resolve8 } from "path";
|
|
143
|
-
import { writeFileSync as writeFileSync7, readFileSync as readFileSync8, realpathSync as
|
|
143
|
+
import { writeFileSync as writeFileSync7, readFileSync as readFileSync8, realpathSync as realpathSync3 } from "fs";
|
|
144
144
|
import { join as join12 } from "path";
|
|
145
145
|
|
|
146
146
|
// src/ump/serve.ts
|
|
@@ -498,7 +498,7 @@ async function joinTeam(config, teamId) {
|
|
|
498
498
|
// src/setup/local.ts
|
|
499
499
|
import { existsSync as existsSync6 } from "fs";
|
|
500
500
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
501
|
-
import { dirname as dirname5, join as join7, resolve as resolve4 } from "path";
|
|
501
|
+
import { basename, dirname as dirname5, join as join7, resolve as resolve4 } from "path";
|
|
502
502
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
503
503
|
|
|
504
504
|
// src/agents/claude-code.ts
|
|
@@ -914,8 +914,11 @@ function checkClaudeCodeMemoryOverride(options = {}) {
|
|
|
914
914
|
import {
|
|
915
915
|
existsSync as existsSync2,
|
|
916
916
|
mkdirSync as mkdirSync2,
|
|
917
|
+
readdirSync,
|
|
917
918
|
readFileSync as readFileSync2,
|
|
919
|
+
realpathSync as realpathSync2,
|
|
918
920
|
renameSync as renameSync2,
|
|
921
|
+
statSync,
|
|
919
922
|
writeFileSync as writeFileSync2
|
|
920
923
|
} from "fs";
|
|
921
924
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
@@ -930,6 +933,77 @@ var MANAGED_HOOK_TAG = "recall:managed:codex";
|
|
|
930
933
|
var DEFAULT_MIN_CODEX_HOOKS_VERSION = "0.115.0";
|
|
931
934
|
var configPath2 = () => join2(resolveUserHomeDir(), ...CODEX_CONFIG_RELATIVE_PATH);
|
|
932
935
|
var hooksJsonPath = () => join2(resolveUserHomeDir(), ...CODEX_HOOKS_RELATIVE_PATH);
|
|
936
|
+
var CODEX_HOME_IGNORED_SUFFIXES = [".bak", ".backup", ".old", ".orig", ".tmp"];
|
|
937
|
+
function expandHomePath(raw, home) {
|
|
938
|
+
const trimmed = raw.trim();
|
|
939
|
+
if (!trimmed) return "";
|
|
940
|
+
if (trimmed === "~") return home;
|
|
941
|
+
if (trimmed.startsWith("~/")) return join2(home, trimmed.slice(2));
|
|
942
|
+
return resolve2(trimmed);
|
|
943
|
+
}
|
|
944
|
+
function looksLikeCodexHome(dir) {
|
|
945
|
+
return existsSync2(join2(dir, "config.toml")) || existsSync2(join2(dir, "auth.json")) || existsSync2(join2(dir, "sessions"));
|
|
946
|
+
}
|
|
947
|
+
function resolveCodexHomes(options = {}) {
|
|
948
|
+
const env = options.env ?? process.env;
|
|
949
|
+
const home = options.home ?? resolveUserHomeDir();
|
|
950
|
+
const explicit = env.RECALL_CODEX_HOMES?.trim();
|
|
951
|
+
if (explicit) {
|
|
952
|
+
return dedupeByRealPath(
|
|
953
|
+
explicit.split(/[:,]/).map((entry) => expandHomePath(entry, home)).filter(Boolean)
|
|
954
|
+
);
|
|
955
|
+
}
|
|
956
|
+
const primary = env.CODEX_HOME?.trim() ? expandHomePath(env.CODEX_HOME, home) : join2(home, ".codex");
|
|
957
|
+
const discovered = [];
|
|
958
|
+
try {
|
|
959
|
+
for (const entry of readdirSync(home, { withFileTypes: true })) {
|
|
960
|
+
if (!entry.name.startsWith(".codex-")) continue;
|
|
961
|
+
if (CODEX_HOME_IGNORED_SUFFIXES.some((suffix) => entry.name.endsWith(suffix))) continue;
|
|
962
|
+
const candidate = join2(home, entry.name);
|
|
963
|
+
if (!statSync(candidate, { throwIfNoEntry: false })?.isDirectory()) continue;
|
|
964
|
+
if (!looksLikeCodexHome(candidate)) continue;
|
|
965
|
+
discovered.push(candidate);
|
|
966
|
+
}
|
|
967
|
+
} catch {
|
|
968
|
+
}
|
|
969
|
+
discovered.sort();
|
|
970
|
+
return dedupeByRealPath([primary, ...discovered]);
|
|
971
|
+
}
|
|
972
|
+
function resolveCodexHookTargets(options = {}) {
|
|
973
|
+
const seen = /* @__PURE__ */ new Set();
|
|
974
|
+
const targets = [];
|
|
975
|
+
for (const home of resolveCodexHomes(options)) {
|
|
976
|
+
const configPathValue = join2(home, "config.toml");
|
|
977
|
+
let key = configPathValue;
|
|
978
|
+
try {
|
|
979
|
+
key = realpathSync2(configPathValue);
|
|
980
|
+
} catch {
|
|
981
|
+
}
|
|
982
|
+
if (seen.has(key)) continue;
|
|
983
|
+
seen.add(key);
|
|
984
|
+
targets.push({
|
|
985
|
+
home,
|
|
986
|
+
configPath: configPathValue,
|
|
987
|
+
hooksPath: join2(home, "hooks.json")
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
return targets;
|
|
991
|
+
}
|
|
992
|
+
function dedupeByRealPath(paths) {
|
|
993
|
+
const seen = /* @__PURE__ */ new Set();
|
|
994
|
+
const out = [];
|
|
995
|
+
for (const path of paths) {
|
|
996
|
+
let key = path;
|
|
997
|
+
try {
|
|
998
|
+
key = realpathSync2(path);
|
|
999
|
+
} catch {
|
|
1000
|
+
}
|
|
1001
|
+
if (seen.has(key)) continue;
|
|
1002
|
+
seen.add(key);
|
|
1003
|
+
out.push(path);
|
|
1004
|
+
}
|
|
1005
|
+
return out;
|
|
1006
|
+
}
|
|
933
1007
|
var codexAdapter = {
|
|
934
1008
|
name: "codex",
|
|
935
1009
|
configPath: configPath2,
|
|
@@ -1247,7 +1321,15 @@ function readCodexHooksJson(targetPath) {
|
|
|
1247
1321
|
}
|
|
1248
1322
|
return { raw, parsed };
|
|
1249
1323
|
}
|
|
1250
|
-
function
|
|
1324
|
+
function resolveWriteTarget(targetPath) {
|
|
1325
|
+
try {
|
|
1326
|
+
return realpathSync2(targetPath);
|
|
1327
|
+
} catch {
|
|
1328
|
+
return targetPath;
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
function writeJsonFile(rawTargetPath, previousRaw, value) {
|
|
1332
|
+
const targetPath = resolveWriteTarget(rawTargetPath);
|
|
1251
1333
|
const parentDir = dirname2(targetPath);
|
|
1252
1334
|
mkdirSync2(parentDir, { recursive: true });
|
|
1253
1335
|
if (previousRaw != null) {
|
|
@@ -1365,7 +1447,8 @@ function hasUnmanagedNotify(content) {
|
|
|
1365
1447
|
function renderTomlStringArray(values) {
|
|
1366
1448
|
return `[${values.map((value) => JSON.stringify(value)).join(", ")}]`;
|
|
1367
1449
|
}
|
|
1368
|
-
function writeConfigFile(
|
|
1450
|
+
function writeConfigFile(rawConfigPath, previousRaw, nextRaw) {
|
|
1451
|
+
const configPathValue = resolveWriteTarget(rawConfigPath);
|
|
1369
1452
|
const parentDir = dirname2(configPathValue);
|
|
1370
1453
|
mkdirSync2(parentDir, { recursive: true });
|
|
1371
1454
|
if (previousRaw != null) {
|
|
@@ -2114,6 +2197,7 @@ function setupAgent(agent, options) {
|
|
|
2114
2197
|
configPath: hookConfigPath,
|
|
2115
2198
|
dryRun: options.dryRun,
|
|
2116
2199
|
paths: options.paths,
|
|
2200
|
+
scope: options.scope,
|
|
2117
2201
|
uninstallHooks: options.uninstallHooks,
|
|
2118
2202
|
promptInjection: options.promptInjection
|
|
2119
2203
|
});
|
|
@@ -2183,12 +2267,20 @@ function configureMcp(agent, options) {
|
|
|
2183
2267
|
if (options.scope === "project") {
|
|
2184
2268
|
return skipped("project-scoped Codex MCP not supported by Codex CLI");
|
|
2185
2269
|
}
|
|
2270
|
+
const targets = resolveCodexHookTargets();
|
|
2186
2271
|
if (options.dryRun) {
|
|
2187
|
-
return ok("would configure global Codex MCP server");
|
|
2272
|
+
return ok(describeCodexTargets("would configure global Codex MCP server", targets));
|
|
2188
2273
|
}
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2274
|
+
for (const target of targets) {
|
|
2275
|
+
const env = { ...process.env, CODEX_HOME: target.home };
|
|
2276
|
+
tryRun(options.runner, "codex", ["mcp", "remove", "recall"], { env });
|
|
2277
|
+
options.runner(
|
|
2278
|
+
"codex",
|
|
2279
|
+
["mcp", "add", "recall", "--", options.paths.runtimeNodePath, options.paths.runtimeMcpPath],
|
|
2280
|
+
{ env }
|
|
2281
|
+
);
|
|
2282
|
+
}
|
|
2283
|
+
return ok(describeCodexTargets("configured global Codex MCP server", targets));
|
|
2192
2284
|
}
|
|
2193
2285
|
if (!hasCommand("claude")) return skipped("claude not found on PATH");
|
|
2194
2286
|
const claudeScope = options.scope === "project" ? "project" : "user";
|
|
@@ -2200,20 +2292,35 @@ function configureMcp(agent, options) {
|
|
|
2200
2292
|
return ok(`configured ${claudeScope} Claude MCP server`);
|
|
2201
2293
|
}
|
|
2202
2294
|
function configureHooks(agent, options) {
|
|
2295
|
+
const codexTargets = agent === "codex" ? options.scope === "project" ? [{
|
|
2296
|
+
home: dirname5(options.configPath),
|
|
2297
|
+
configPath: options.configPath,
|
|
2298
|
+
hooksPath: join7(dirname5(options.configPath), "hooks.json")
|
|
2299
|
+
}] : resolveCodexHookTargets() : [];
|
|
2203
2300
|
if (options.dryRun) {
|
|
2204
|
-
|
|
2205
|
-
|
|
2301
|
+
const base = options.uninstallHooks ? `would remove hooks from ${options.configPath}` : `would install hooks into ${options.configPath}${options.promptInjection === false ? " (prompt injection opt-out)" : ""}`;
|
|
2302
|
+
return ok(agent === "codex" ? describeCodexTargets(base, codexTargets) : base);
|
|
2303
|
+
}
|
|
2304
|
+
if (agent === "codex") {
|
|
2305
|
+
const results = codexTargets.map(
|
|
2306
|
+
(target) => options.uninstallHooks ? uninstallCodexHooks({ configPath: target.configPath, hooksPath: target.hooksPath }) : installCodexHooks({
|
|
2307
|
+
configPath: target.configPath,
|
|
2308
|
+
hooksPath: target.hooksPath,
|
|
2309
|
+
cliPath: options.paths.runtimeCliPath,
|
|
2310
|
+
nodePath: options.paths.runtimeNodePath,
|
|
2311
|
+
promptInjection: options.promptInjection
|
|
2312
|
+
})
|
|
2206
2313
|
);
|
|
2314
|
+
const failed2 = results.filter((entry) => !entry.ok);
|
|
2315
|
+
const headline = failed2.length > 0 ? failed2[0].message : results[0]?.message ?? "no Codex home found";
|
|
2316
|
+
return {
|
|
2317
|
+
enabled: true,
|
|
2318
|
+
ok: failed2.length === 0 && results.length > 0,
|
|
2319
|
+
message: describeCodexTargets(headline, codexTargets)
|
|
2320
|
+
};
|
|
2207
2321
|
}
|
|
2208
|
-
const
|
|
2209
|
-
const result = agent === "claude-code" ? options.uninstallHooks ? uninstallClaudeCodeHooks({ configPath: options.configPath }) : installClaudeCodeHooks({
|
|
2210
|
-
configPath: options.configPath,
|
|
2211
|
-
cliPath: options.paths.runtimeCliPath,
|
|
2212
|
-
nodePath: options.paths.runtimeNodePath,
|
|
2213
|
-
promptInjection: options.promptInjection
|
|
2214
|
-
}) : options.uninstallHooks ? uninstallCodexHooks({ configPath: options.configPath, hooksPath: codexHooksPath }) : installCodexHooks({
|
|
2322
|
+
const result = options.uninstallHooks ? uninstallClaudeCodeHooks({ configPath: options.configPath }) : installClaudeCodeHooks({
|
|
2215
2323
|
configPath: options.configPath,
|
|
2216
|
-
hooksPath: codexHooksPath,
|
|
2217
2324
|
cliPath: options.paths.runtimeCliPath,
|
|
2218
2325
|
nodePath: options.paths.runtimeNodePath,
|
|
2219
2326
|
promptInjection: options.promptInjection
|
|
@@ -2224,6 +2331,11 @@ function configureHooks(agent, options) {
|
|
|
2224
2331
|
message: result.message
|
|
2225
2332
|
};
|
|
2226
2333
|
}
|
|
2334
|
+
function describeCodexTargets(message, targets) {
|
|
2335
|
+
if (targets.length <= 1) return message;
|
|
2336
|
+
const names = targets.map((target) => basename(target.home)).join(", ");
|
|
2337
|
+
return `${message} across ${targets.length} Codex homes (${names})`;
|
|
2338
|
+
}
|
|
2227
2339
|
function resolveTargetAgents(target) {
|
|
2228
2340
|
if (target && target.length > 0) {
|
|
2229
2341
|
return [...new Set(target)];
|
|
@@ -2245,12 +2357,12 @@ function resolveHookConfigPath(agent, scope, cwd) {
|
|
|
2245
2357
|
}
|
|
2246
2358
|
return agent === "codex" ? join7(resolveUserHomeDir(), ".codex", "config.toml") : join7(resolveUserHomeDir(), ".claude", "settings.json");
|
|
2247
2359
|
}
|
|
2248
|
-
function defaultRunner(command, args) {
|
|
2249
|
-
execFileSync3(command, args, stdioOpts());
|
|
2360
|
+
function defaultRunner(command, args, options) {
|
|
2361
|
+
execFileSync3(command, args, { ...stdioOpts(), ...options?.env ? { env: options.env } : {} });
|
|
2250
2362
|
}
|
|
2251
|
-
function tryRun(runner, command, args) {
|
|
2363
|
+
function tryRun(runner, command, args, options) {
|
|
2252
2364
|
try {
|
|
2253
|
-
runner(command, args);
|
|
2365
|
+
runner(command, args, options);
|
|
2254
2366
|
} catch {
|
|
2255
2367
|
return;
|
|
2256
2368
|
}
|
|
@@ -2273,7 +2385,7 @@ import { fileURLToPath as fileURLToPath5 } from "url";
|
|
|
2273
2385
|
|
|
2274
2386
|
// src/doctor/report.ts
|
|
2275
2387
|
import { existsSync as existsSync9, readFileSync as readFileSync6 } from "fs";
|
|
2276
|
-
import { join as join10 } from "path";
|
|
2388
|
+
import { basename as basename2, join as join10 } from "path";
|
|
2277
2389
|
import Database from "better-sqlite3";
|
|
2278
2390
|
|
|
2279
2391
|
// src/daemon/launchd.ts
|
|
@@ -2572,10 +2684,19 @@ function installSystemdUnit(opts = {}) {
|
|
|
2572
2684
|
mkdirSync6(cfg.logDir, { recursive: true });
|
|
2573
2685
|
writeFileSync6(cfg.unitPath, renderUnit(cfg), { mode: 384 });
|
|
2574
2686
|
chmodSync2(cfg.unitPath, 384);
|
|
2575
|
-
|
|
2576
|
-
systemctl(["--user", "enable", "--now", `${cfg.label}.service`]);
|
|
2687
|
+
for (const args of systemdInstallCommands(cfg.label)) systemctl(args);
|
|
2577
2688
|
return getSystemdStatus(cfg.label);
|
|
2578
2689
|
}
|
|
2690
|
+
function systemdInstallCommands(label = DEFAULT_LABEL2) {
|
|
2691
|
+
const service = `${label}.service`;
|
|
2692
|
+
return [
|
|
2693
|
+
["--user", "daemon-reload"],
|
|
2694
|
+
["--user", "enable", service],
|
|
2695
|
+
// `enable --now` leaves an already-active process untouched. Restart so a
|
|
2696
|
+
// package upgrade actually runs the newly installed daemon code.
|
|
2697
|
+
["--user", "restart", service]
|
|
2698
|
+
];
|
|
2699
|
+
}
|
|
2579
2700
|
function uninstallSystemdUnit(label = DEFAULT_LABEL2) {
|
|
2580
2701
|
assertLinux();
|
|
2581
2702
|
const cfg = resolveConfig2({ label });
|
|
@@ -3048,9 +3169,9 @@ function inspectClaudeCodeInstall(home) {
|
|
|
3048
3169
|
notes
|
|
3049
3170
|
};
|
|
3050
3171
|
}
|
|
3051
|
-
function
|
|
3052
|
-
const configPath3 = join10(
|
|
3053
|
-
const hooksPath = join10(
|
|
3172
|
+
function inspectCodexHome(codexHome) {
|
|
3173
|
+
const configPath3 = join10(codexHome, "config.toml");
|
|
3174
|
+
const hooksPath = join10(codexHome, "hooks.json");
|
|
3054
3175
|
const detected = existsSync9(configPath3) || hasCommand("codex");
|
|
3055
3176
|
const notes = [];
|
|
3056
3177
|
let mcp = false;
|
|
@@ -3070,18 +3191,31 @@ function inspectCodexInstall(home) {
|
|
|
3070
3191
|
);
|
|
3071
3192
|
}
|
|
3072
3193
|
if (!featureFlagSet) notes.push("hooks = true (or legacy codex_hooks = true) missing from [features]");
|
|
3073
|
-
if (!managedHooksJson) notes.push(
|
|
3194
|
+
if (!managedHooksJson) notes.push(`No Recall-managed entries in ${hooksPath}`);
|
|
3074
3195
|
} else if (detected) {
|
|
3075
3196
|
notes.push("Codex CLI detected but config.toml missing");
|
|
3076
3197
|
}
|
|
3198
|
+
return { codexHome, configPath: configPath3, hooksPath, detected, mcp, hooks, legacy_notify_bridge, notes };
|
|
3199
|
+
}
|
|
3200
|
+
function inspectCodexInstall(home) {
|
|
3201
|
+
const homes = resolveCodexHomes({ home });
|
|
3202
|
+
const entries = homes.map((codexHome) => inspectCodexHome(codexHome));
|
|
3203
|
+
const primary = entries[0];
|
|
3204
|
+
const detected = entries.some((entry) => entry.detected);
|
|
3205
|
+
const notes = [...primary.notes];
|
|
3206
|
+
for (const entry of entries.slice(1)) {
|
|
3207
|
+
for (const note of entry.notes) {
|
|
3208
|
+
notes.push(`${basename2(entry.codexHome)}: ${note}`);
|
|
3209
|
+
}
|
|
3210
|
+
}
|
|
3077
3211
|
return {
|
|
3078
3212
|
agent: "codex",
|
|
3079
3213
|
detected,
|
|
3080
|
-
mcp,
|
|
3081
|
-
hooks,
|
|
3082
|
-
legacy_notify_bridge,
|
|
3083
|
-
config_path:
|
|
3084
|
-
hook_path: hooksPath,
|
|
3214
|
+
mcp: entries.every((entry) => entry.mcp),
|
|
3215
|
+
hooks: entries.every((entry) => entry.hooks),
|
|
3216
|
+
legacy_notify_bridge: entries.some((entry) => entry.legacy_notify_bridge),
|
|
3217
|
+
config_path: primary.configPath,
|
|
3218
|
+
hook_path: primary.hooksPath,
|
|
3085
3219
|
notes
|
|
3086
3220
|
};
|
|
3087
3221
|
}
|
|
@@ -3183,7 +3317,7 @@ import { execFileSync as execFileSync6 } from "child_process";
|
|
|
3183
3317
|
import {
|
|
3184
3318
|
existsSync as existsSync10,
|
|
3185
3319
|
readFileSync as readFileSync7,
|
|
3186
|
-
readdirSync,
|
|
3320
|
+
readdirSync as readdirSync2,
|
|
3187
3321
|
rmSync as rmSync4,
|
|
3188
3322
|
rmdirSync
|
|
3189
3323
|
} from "fs";
|
|
@@ -3498,7 +3632,7 @@ function failed(category, target, error) {
|
|
|
3498
3632
|
}
|
|
3499
3633
|
function removeDirectoryIfEmpty(path) {
|
|
3500
3634
|
try {
|
|
3501
|
-
if (
|
|
3635
|
+
if (readdirSync2(path).length === 0) rmdirSync(path);
|
|
3502
3636
|
} catch {
|
|
3503
3637
|
}
|
|
3504
3638
|
}
|
|
@@ -3707,14 +3841,14 @@ function safeHookAction(event, action) {
|
|
|
3707
3841
|
} catch (error) {
|
|
3708
3842
|
let logPath = "~/.recall/logs/hook-errors.log";
|
|
3709
3843
|
try {
|
|
3710
|
-
const { appendFileSync, mkdirSync: mkdirSync7, statSync, renameSync: renameSync4, rmSync: rmSync5 } = await import("fs");
|
|
3844
|
+
const { appendFileSync, mkdirSync: mkdirSync7, statSync: statSync2, renameSync: renameSync4, rmSync: rmSync5 } = await import("fs");
|
|
3711
3845
|
const { homedir: homedir5 } = await import("os");
|
|
3712
3846
|
const dir = join12(homedir5(), ".recall", "logs");
|
|
3713
3847
|
mkdirSync7(dir, { recursive: true });
|
|
3714
3848
|
logPath = join12(dir, "hook-errors.log");
|
|
3715
3849
|
try {
|
|
3716
3850
|
const maxBytes = parseInt(process.env.RECALL_HOOK_LOG_MAX_BYTES ?? String(1024 * 1024), 10);
|
|
3717
|
-
if (maxBytes > 0 &&
|
|
3851
|
+
if (maxBytes > 0 && statSync2(logPath).size >= maxBytes) {
|
|
3718
3852
|
const rotated = `${logPath}.1`;
|
|
3719
3853
|
try {
|
|
3720
3854
|
rmSync5(rotated, { force: true });
|
|
@@ -4814,7 +4948,7 @@ graphCmd.command("query <query...>").description("Run graph-aware retrieval for
|
|
|
4814
4948
|
});
|
|
4815
4949
|
var maintenanceCmd = program.command("maintenance").description("Inspect and manage the delegated maintenance task queue");
|
|
4816
4950
|
maintenanceCmd.command("stats").description("Show backlog counts, completion stats, and mean latency").action(async () => {
|
|
4817
|
-
const { getTaskStats } = await import("./tasks-
|
|
4951
|
+
const { getTaskStats } = await import("./tasks-RR4E4JAG.js");
|
|
4818
4952
|
const db = initDb();
|
|
4819
4953
|
const stats = getTaskStats(db);
|
|
4820
4954
|
console.log(`Total tasks: ${stats.total}`);
|
|
@@ -4840,7 +4974,7 @@ maintenanceCmd.command("stats").description("Show backlog counts, completion sta
|
|
|
4840
4974
|
}
|
|
4841
4975
|
});
|
|
4842
4976
|
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) => {
|
|
4843
|
-
const { listTasks } = await import("./tasks-
|
|
4977
|
+
const { listTasks } = await import("./tasks-RR4E4JAG.js");
|
|
4844
4978
|
const db = initDb();
|
|
4845
4979
|
const tasks = listTasks(db, {
|
|
4846
4980
|
status: opts.status,
|
|
@@ -4862,7 +4996,7 @@ maintenanceCmd.command("list").description("List tasks (default: pending)").opti
|
|
|
4862
4996
|
}
|
|
4863
4997
|
});
|
|
4864
4998
|
maintenanceCmd.command("drop").description("Delete a task by id (or id prefix)").argument("<task-id>", "Task id or prefix").action(async (taskIdArg) => {
|
|
4865
|
-
const { deleteTask, listTasks } = await import("./tasks-
|
|
4999
|
+
const { deleteTask, listTasks } = await import("./tasks-RR4E4JAG.js");
|
|
4866
5000
|
const db = initDb();
|
|
4867
5001
|
const all = listTasks(db, { limit: 1e4 });
|
|
4868
5002
|
const matches = all.filter((t) => t.id === taskIdArg || t.id.startsWith(taskIdArg));
|
|
@@ -4968,8 +5102,8 @@ credentialsCmd.command("clear").description("Remove provider credentials from th
|
|
|
4968
5102
|
else console.log(`No ${provider} credentials found in Keychain.`);
|
|
4969
5103
|
});
|
|
4970
5104
|
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) => {
|
|
4971
|
-
const { dispatchPendingTasks, formatDispatchReport, buildPrompt } = await import("./dispatcher-
|
|
4972
|
-
const { listTasks } = await import("./tasks-
|
|
5105
|
+
const { dispatchPendingTasks, formatDispatchReport, buildPrompt } = await import("./dispatcher-PNYGUIKO.js");
|
|
5106
|
+
const { listTasks } = await import("./tasks-RR4E4JAG.js");
|
|
4973
5107
|
const db = initDb();
|
|
4974
5108
|
if (opts.preview) {
|
|
4975
5109
|
const pending = listTasks(db, {
|
|
@@ -5026,7 +5160,7 @@ ${p.prompt.max_output_tokens}
|
|
|
5026
5160
|
console.log(formatDispatchReport(report));
|
|
5027
5161
|
});
|
|
5028
5162
|
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) => {
|
|
5029
|
-
const { runDeterministicCleanup, formatCleanupReport, revertCleanupRun, listCleanupRuns } = await import("./cleanup-
|
|
5163
|
+
const { runDeterministicCleanup, formatCleanupReport, revertCleanupRun, listCleanupRuns } = await import("./cleanup-MDEYU6TC.js");
|
|
5030
5164
|
const db = initDb();
|
|
5031
5165
|
if (opts.list) {
|
|
5032
5166
|
const runs = listCleanupRuns(db);
|
|
@@ -5283,7 +5417,7 @@ function findByPrefix(db, prefix) {
|
|
|
5283
5417
|
function isDirectCliInvocation(moduleUrl, argvPath) {
|
|
5284
5418
|
if (!argvPath) return false;
|
|
5285
5419
|
try {
|
|
5286
|
-
return
|
|
5420
|
+
return realpathSync3(fileURLToPath5(moduleUrl)) === realpathSync3(argvPath);
|
|
5287
5421
|
} catch {
|
|
5288
5422
|
return false;
|
|
5289
5423
|
}
|