chat-recall 0.7.10 → 0.7.12
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/dist/auto-update.d.ts +31 -0
- package/dist/auto-update.d.ts.map +1 -1
- package/dist/auto-update.js +81 -15
- package/dist/auto-update.js.map +1 -1
- package/dist/cli.js +241 -29
- package/dist/cli.js.map +1 -1
- package/dist/mcp-relay.js +1 -1
- package/dist/mcp.js +235 -27
- package/dist/scan-worker.d.ts.map +1 -1
- package/dist/scan-worker.js +199 -100
- package/dist/scan-worker.js.map +1 -1
- package/dist/sync-client.js +2 -2
- package/dist/sync-client.js.map +1 -1
- package/dist/watch.js +241 -28
- package/package.json +1 -1
package/dist/watch.js
CHANGED
|
@@ -194,8 +194,15 @@ var init_claude_prompt_origin = __esm({
|
|
|
194
194
|
INJECTED_PREFIXES = [
|
|
195
195
|
["<task-notification", "task-notification"],
|
|
196
196
|
["<agent-message", "peer"],
|
|
197
|
+
["<cross-session-message", "peer"],
|
|
198
|
+
["[Cross-session delivery notice]", "peer"],
|
|
197
199
|
["Another Claude session sent a message:", "peer"],
|
|
198
|
-
["Stop hook feedback:", "hook"]
|
|
200
|
+
["Stop hook feedback:", "hook"],
|
|
201
|
+
["<bash-stdout>", "command-output"],
|
|
202
|
+
["<bash-stderr>", "command-output"],
|
|
203
|
+
["<local-command-stdout>", "command-output"],
|
|
204
|
+
["<local-command-stderr>", "command-output"],
|
|
205
|
+
["<<autonomous-loop", "meta"]
|
|
199
206
|
];
|
|
200
207
|
}
|
|
201
208
|
});
|
|
@@ -6449,7 +6456,11 @@ __export(raw_exports, {
|
|
|
6449
6456
|
gzipContainer: () => gzipContainer,
|
|
6450
6457
|
mapContainerText: () => mapContainerText,
|
|
6451
6458
|
parseOpenCodeDumpText: () => parseOpenCodeDumpText,
|
|
6452
|
-
parseTranscriptFromContainer: () => parseTranscriptFromContainer
|
|
6459
|
+
parseTranscriptFromContainer: () => parseTranscriptFromContainer,
|
|
6460
|
+
redactContainer: () => redactContainer,
|
|
6461
|
+
redactJsonLine: () => redactJsonLine,
|
|
6462
|
+
repairContainer: () => repairContainer,
|
|
6463
|
+
repairRedactedJsonl: () => repairRedactedJsonl
|
|
6453
6464
|
});
|
|
6454
6465
|
import { gzipSync, gunzipSync } from "zlib";
|
|
6455
6466
|
import { createHash } from "crypto";
|
|
@@ -6490,6 +6501,134 @@ function gunzipContainer(gz) {
|
|
|
6490
6501
|
function mapContainerText(c, fn) {
|
|
6491
6502
|
return { ...c, files: c.files.map((f) => ({ name: f.name, text: fn(f.text) })) };
|
|
6492
6503
|
}
|
|
6504
|
+
function repairRedactedJsonl(text) {
|
|
6505
|
+
let repaired = 0;
|
|
6506
|
+
const parts = [];
|
|
6507
|
+
let copied = 0;
|
|
6508
|
+
let at = text.indexOf("[REDACTED:");
|
|
6509
|
+
while (at >= 0) {
|
|
6510
|
+
const start = text.lastIndexOf("\n", at) + 1;
|
|
6511
|
+
let end = text.indexOf("\n", at);
|
|
6512
|
+
if (end < 0)
|
|
6513
|
+
end = text.length;
|
|
6514
|
+
const fixed = repairLine(text.slice(start, end));
|
|
6515
|
+
if (fixed !== null) {
|
|
6516
|
+
parts.push(text.slice(copied, start), fixed);
|
|
6517
|
+
copied = end;
|
|
6518
|
+
repaired++;
|
|
6519
|
+
}
|
|
6520
|
+
at = text.indexOf("[REDACTED:", end);
|
|
6521
|
+
}
|
|
6522
|
+
if (repaired === 0)
|
|
6523
|
+
return { text, repaired: 0 };
|
|
6524
|
+
parts.push(text.slice(copied));
|
|
6525
|
+
return { text: parts.join(""), repaired };
|
|
6526
|
+
}
|
|
6527
|
+
function parseError(line) {
|
|
6528
|
+
try {
|
|
6529
|
+
JSON.parse(line);
|
|
6530
|
+
return null;
|
|
6531
|
+
} catch (e) {
|
|
6532
|
+
const m = /position (\d+)/.exec(e instanceof Error ? e.message : "");
|
|
6533
|
+
return m ? Number(m[1]) : line.length;
|
|
6534
|
+
}
|
|
6535
|
+
}
|
|
6536
|
+
function repairLine(line) {
|
|
6537
|
+
if (!line.includes("[REDACTED:") || parseError(line) === null)
|
|
6538
|
+
return null;
|
|
6539
|
+
let out = line.replace(/(?<!\\)((?:\\\\)*)\\(\[REDACTED:)/g, "$1$2");
|
|
6540
|
+
for (let attempt = 0; attempt < 64; attempt++) {
|
|
6541
|
+
const at = parseError(out);
|
|
6542
|
+
if (at === null)
|
|
6543
|
+
return out;
|
|
6544
|
+
let site = -1;
|
|
6545
|
+
for (const m of out.matchAll(MARKER_QUOTE)) {
|
|
6546
|
+
const q = m.index + m[0].length - 1;
|
|
6547
|
+
if (q < at)
|
|
6548
|
+
site = q;
|
|
6549
|
+
}
|
|
6550
|
+
if (site < 0)
|
|
6551
|
+
return null;
|
|
6552
|
+
out = out.slice(0, site) + "\\" + out.slice(site);
|
|
6553
|
+
}
|
|
6554
|
+
return null;
|
|
6555
|
+
}
|
|
6556
|
+
function redactJsonLine(line, redact) {
|
|
6557
|
+
if (!line.includes('"'))
|
|
6558
|
+
return redact(line);
|
|
6559
|
+
try {
|
|
6560
|
+
JSON.parse(line);
|
|
6561
|
+
} catch {
|
|
6562
|
+
return redact(line);
|
|
6563
|
+
}
|
|
6564
|
+
const decoded = mapJsonStrings(line, redact, true);
|
|
6565
|
+
const out = redact(decoded);
|
|
6566
|
+
try {
|
|
6567
|
+
JSON.parse(out);
|
|
6568
|
+
return out;
|
|
6569
|
+
} catch {
|
|
6570
|
+
return mapJsonStrings(decoded, redact, false);
|
|
6571
|
+
}
|
|
6572
|
+
}
|
|
6573
|
+
function mapJsonStrings(line, fn, escapedOnly) {
|
|
6574
|
+
let out = "";
|
|
6575
|
+
let i = 0;
|
|
6576
|
+
for (; ; ) {
|
|
6577
|
+
const q = line.indexOf('"', i);
|
|
6578
|
+
if (q < 0)
|
|
6579
|
+
return out + line.slice(i);
|
|
6580
|
+
let j = q + 1;
|
|
6581
|
+
while (j < line.length) {
|
|
6582
|
+
const c = line.charCodeAt(j);
|
|
6583
|
+
if (c === 92)
|
|
6584
|
+
j += 2;
|
|
6585
|
+
else if (c === 34)
|
|
6586
|
+
break;
|
|
6587
|
+
else
|
|
6588
|
+
j++;
|
|
6589
|
+
}
|
|
6590
|
+
const token = line.slice(q, j + 1);
|
|
6591
|
+
out += line.slice(i, q);
|
|
6592
|
+
i = j + 1;
|
|
6593
|
+
const body = token.slice(1, -1);
|
|
6594
|
+
const escaped = body.includes("\\");
|
|
6595
|
+
if (escapedOnly && !escaped) {
|
|
6596
|
+
out += token;
|
|
6597
|
+
continue;
|
|
6598
|
+
}
|
|
6599
|
+
let value = body;
|
|
6600
|
+
if (escaped) {
|
|
6601
|
+
try {
|
|
6602
|
+
value = JSON.parse(token);
|
|
6603
|
+
} catch {
|
|
6604
|
+
out += token;
|
|
6605
|
+
continue;
|
|
6606
|
+
}
|
|
6607
|
+
}
|
|
6608
|
+
const next = fn(value);
|
|
6609
|
+
out += next === value ? token : JSON.stringify(next);
|
|
6610
|
+
}
|
|
6611
|
+
}
|
|
6612
|
+
function redactContainer(c, redact) {
|
|
6613
|
+
return {
|
|
6614
|
+
...c,
|
|
6615
|
+
files: c.files.map((f) => ({
|
|
6616
|
+
name: f.name,
|
|
6617
|
+
text: f.name.endsWith(".jsonl") ? f.text.split("\n").map((l) => l ? redactJsonLine(l, redact) : l).join("\n") : redact(f.text)
|
|
6618
|
+
}))
|
|
6619
|
+
};
|
|
6620
|
+
}
|
|
6621
|
+
function repairContainer(c) {
|
|
6622
|
+
let repaired = 0;
|
|
6623
|
+
const files = c.files.map((f) => {
|
|
6624
|
+
if (!f.name.endsWith(".jsonl"))
|
|
6625
|
+
return f;
|
|
6626
|
+
const r = repairRedactedJsonl(f.text);
|
|
6627
|
+
repaired += r.repaired;
|
|
6628
|
+
return r.repaired > 0 ? { name: f.name, text: r.text } : f;
|
|
6629
|
+
});
|
|
6630
|
+
return repaired > 0 ? { container: { ...c, files }, repaired } : { container: c, repaired: 0 };
|
|
6631
|
+
}
|
|
6493
6632
|
function subagentKind(id) {
|
|
6494
6633
|
return id.includes("acompact") ? "compact" : id.includes("aside_question") ? "aside" : id.includes("explore") || /^agent-a[0-9a-f]{16,}$/i.test(id) ? "explore" : "other";
|
|
6495
6634
|
}
|
|
@@ -6660,6 +6799,7 @@ function requireFs() {
|
|
|
6660
6799
|
function requirePath() {
|
|
6661
6800
|
return pathMod;
|
|
6662
6801
|
}
|
|
6802
|
+
var MARKER_QUOTE;
|
|
6663
6803
|
var init_raw = __esm({
|
|
6664
6804
|
"../engine/dist/transcript/raw.js"() {
|
|
6665
6805
|
"use strict";
|
|
@@ -6667,6 +6807,7 @@ var init_raw = __esm({
|
|
|
6667
6807
|
init_claude();
|
|
6668
6808
|
init_codex();
|
|
6669
6809
|
init_from_events();
|
|
6810
|
+
MARKER_QUOTE = /\[REDACTED:[A-Za-z0-9_-]+\]"/g;
|
|
6670
6811
|
}
|
|
6671
6812
|
});
|
|
6672
6813
|
|
|
@@ -7329,7 +7470,7 @@ var init_session_sentiment = __esm({
|
|
|
7329
7470
|
DIRECTIVE_HEAD = /^(?:please\s+)?(?:use|implement|build|make|add|create|fix|remove|delete|update|refactor|run|deploy|push|merge|test|check|investigate|find|search|show|list|generate|set\s+up|ensure)\b/i;
|
|
7330
7471
|
CLARIFY_PHRASES = /\b(?:wdym|what do you mean|explain|clarify|what is|what's|huh\??|i don'?t understand)\b/i;
|
|
7331
7472
|
FRUSTRATED_PHRASES = /\b(?:why (?:the )?(?:fuck|hell)|wtf|are you (?:kidding|serious)|stop slacking|stop making|why did you|why didn'?t you|i (?:fucking )?(?:asked|told you)|are you (?:listening|even)|come\s*on|just\s+do)\b/i;
|
|
7332
|
-
MARKERS_VERSION =
|
|
7473
|
+
MARKERS_VERSION = 3;
|
|
7333
7474
|
}
|
|
7334
7475
|
});
|
|
7335
7476
|
|
|
@@ -12163,7 +12304,13 @@ function redactSecrets(text, opts = {}) {
|
|
|
12163
12304
|
return whole;
|
|
12164
12305
|
if (opts.count)
|
|
12165
12306
|
opts.count.redactions++;
|
|
12166
|
-
|
|
12307
|
+
let last = args.length - 1;
|
|
12308
|
+
if (typeof args[last] === "object")
|
|
12309
|
+
last--;
|
|
12310
|
+
const source = args[last];
|
|
12311
|
+
const secretStart = args[last - 1] + whole.length - secret.length;
|
|
12312
|
+
const head = escapeHead(source, secretStart, secret.length);
|
|
12313
|
+
return whole.slice(0, whole.length - secret.length + head) + `[REDACTED:${r.label}]` + escapeKept(whole, whole.length);
|
|
12167
12314
|
});
|
|
12168
12315
|
}
|
|
12169
12316
|
const ctx = findContextualSecrets(out);
|
|
@@ -12171,10 +12318,25 @@ function redactSecrets(text, opts = {}) {
|
|
|
12171
12318
|
const { start, end } = ctx[i];
|
|
12172
12319
|
if (opts.count)
|
|
12173
12320
|
opts.count.redactions++;
|
|
12174
|
-
|
|
12321
|
+
const head = escapeHead(out, start, end - start);
|
|
12322
|
+
out = out.slice(0, start + head) + "[REDACTED:secret-context]" + escapeKept(out, end) + out.slice(end);
|
|
12175
12323
|
}
|
|
12176
12324
|
return out;
|
|
12177
12325
|
}
|
|
12326
|
+
function escapeKept(text, end) {
|
|
12327
|
+
let run = 0;
|
|
12328
|
+
while (run < end && text.charCodeAt(end - 1 - run) === 92)
|
|
12329
|
+
run++;
|
|
12330
|
+
return run % 2 === 1 ? "\\" : "";
|
|
12331
|
+
}
|
|
12332
|
+
function escapeHead(text, start, length) {
|
|
12333
|
+
let run = 0;
|
|
12334
|
+
while (run < start && text.charCodeAt(start - 1 - run) === 92)
|
|
12335
|
+
run++;
|
|
12336
|
+
if (run % 2 === 0)
|
|
12337
|
+
return 0;
|
|
12338
|
+
return Math.min(text[start] === "u" ? 5 : 1, length);
|
|
12339
|
+
}
|
|
12178
12340
|
function maskSecret(s) {
|
|
12179
12341
|
if (!s)
|
|
12180
12342
|
return "";
|
|
@@ -12281,7 +12443,12 @@ var init_secret_redactor = __esm({
|
|
|
12281
12443
|
// userinfo URL walked through in cleartext — and a `jdbc:postgresql://…`
|
|
12282
12444
|
// prefix broke the \b anchor for the one family it did cover. Any scheme
|
|
12283
12445
|
// followed by userinfo is a credential, so match the shape, not a list.
|
|
12284
|
-
|
|
12446
|
+
//
|
|
12447
|
+
// A quote in userinfo is percent-encoded, so neither part takes a `"`. The
|
|
12448
|
+
// sync redacts JSONL text, and a match that ran on through `","is_error":`
|
|
12449
|
+
// to a later `@` replaced JSON structure: 4 lines on one machine stopped
|
|
12450
|
+
// parsing, and their records were dropped.
|
|
12451
|
+
{ label: "url-password", secret: 1, pattern: /\b[a-zA-Z][a-zA-Z0-9+.-]{1,31}:\/\/[^:@\s/"]{1,64}:([^@\s/"]{1,256})(?=@)/g },
|
|
12285
12452
|
// Bare AWS secret-access-key VALUE: EXACTLY 40 base64 chars, word-bounded,
|
|
12286
12453
|
// containing upper+lower+digit. This is the gitleaks heuristic — the mixed-case
|
|
12287
12454
|
// requirement excludes 40-char lowercase-hex git SHAs, and the exact-40 bound
|
|
@@ -13315,6 +13482,10 @@ __export(transcript_exports, {
|
|
|
13315
13482
|
parseTranscript: () => parseTranscript,
|
|
13316
13483
|
parseTranscriptFromContainer: () => parseTranscriptFromContainer,
|
|
13317
13484
|
readShadowContainer: () => readShadowContainer,
|
|
13485
|
+
redactContainer: () => redactContainer,
|
|
13486
|
+
redactJsonLine: () => redactJsonLine,
|
|
13487
|
+
repairContainer: () => repairContainer,
|
|
13488
|
+
repairRedactedJsonl: () => repairRedactedJsonl,
|
|
13318
13489
|
seedShadow: () => seedShadow,
|
|
13319
13490
|
shadowFileFor: () => shadowFileFor,
|
|
13320
13491
|
shadowRoot: () => shadowRoot,
|
|
@@ -18202,7 +18373,7 @@ var init_sync_fields = __esm({
|
|
|
18202
18373
|
import { existsSync as existsSync39, mkdirSync as mkdirSync8, openSync as openSync8, writeFileSync as writeFileSync7, readFileSync as readFileSync31, rmSync as rmSync4, statSync as statSync35, closeSync as closeSync8 } from "fs";
|
|
18203
18374
|
import { dirname as dirname17, join as join40 } from "path";
|
|
18204
18375
|
function acquireIndexLock(opts) {
|
|
18205
|
-
const lockPath = lockFilePath();
|
|
18376
|
+
const lockPath = lockFilePath(opts.file);
|
|
18206
18377
|
mkdirSync8(dirname17(lockPath), { recursive: true });
|
|
18207
18378
|
if (existsSync39(lockPath)) {
|
|
18208
18379
|
if (!stealStaleLock(lockPath, opts.staleAfterMs ?? 10 * 6e4)) {
|
|
@@ -18244,8 +18415,8 @@ function acquireIndexLock(opts) {
|
|
|
18244
18415
|
}
|
|
18245
18416
|
};
|
|
18246
18417
|
}
|
|
18247
|
-
function lockFilePath() {
|
|
18248
|
-
return join40(getIndexDir(),
|
|
18418
|
+
function lockFilePath(file = ".compact.lock") {
|
|
18419
|
+
return join40(getIndexDir(), file);
|
|
18249
18420
|
}
|
|
18250
18421
|
function stealStaleLock(lockPath, staleAfterMs) {
|
|
18251
18422
|
try {
|
|
@@ -18312,7 +18483,7 @@ var init_http = __esm({
|
|
|
18312
18483
|
CLI_VERSION = JSON.parse(readFileSync32(new URL("../package.json", import.meta.url), "utf-8")).version || CLI_VERSION;
|
|
18313
18484
|
} catch {
|
|
18314
18485
|
try {
|
|
18315
|
-
if (true) CLI_VERSION = "0.7.
|
|
18486
|
+
if (true) CLI_VERSION = "0.7.12";
|
|
18316
18487
|
} catch {
|
|
18317
18488
|
}
|
|
18318
18489
|
}
|
|
@@ -18806,7 +18977,7 @@ var init_telemetry = __esm({
|
|
|
18806
18977
|
init_sync_client();
|
|
18807
18978
|
cliVersion = () => {
|
|
18808
18979
|
try {
|
|
18809
|
-
return true ? "0.7.
|
|
18980
|
+
return true ? "0.7.12" : "dev";
|
|
18810
18981
|
} catch {
|
|
18811
18982
|
return "dev";
|
|
18812
18983
|
}
|
|
@@ -19021,6 +19192,8 @@ var init_client_events = __esm({
|
|
|
19021
19192
|
// src/auto-update.ts
|
|
19022
19193
|
var auto_update_exports = {};
|
|
19023
19194
|
__export(auto_update_exports, {
|
|
19195
|
+
LOCKED_REASON: () => LOCKED_REASON,
|
|
19196
|
+
STOPPING_REASON: () => STOPPING_REASON,
|
|
19024
19197
|
clearUpdateFailures: () => clearUpdateFailures,
|
|
19025
19198
|
compareVersions: () => compareVersions,
|
|
19026
19199
|
executeAutoUpdate: () => executeAutoUpdate,
|
|
@@ -19032,8 +19205,10 @@ __export(auto_update_exports, {
|
|
|
19032
19205
|
planAutoUpdate: () => planAutoUpdate,
|
|
19033
19206
|
readUpdateState: () => readUpdateState,
|
|
19034
19207
|
resolveNpm: () => resolveNpm,
|
|
19208
|
+
restartCommand: () => restartCommand,
|
|
19035
19209
|
runAutoUpdate: () => runAutoUpdate,
|
|
19036
19210
|
runningPrefix: () => runningPrefix,
|
|
19211
|
+
stopAutoUpdates: () => stopAutoUpdates,
|
|
19037
19212
|
sweepStaleStaging: () => sweepStaleStaging,
|
|
19038
19213
|
tarballUrl: () => tarballUrl
|
|
19039
19214
|
});
|
|
@@ -19129,6 +19304,10 @@ async function executeAutoUpdate(plan, deps) {
|
|
|
19129
19304
|
};
|
|
19130
19305
|
const tgz = join41(dir, "chat-recall.tgz");
|
|
19131
19306
|
writeFileSync8(tgz, buf);
|
|
19307
|
+
if (deps.stopping?.()) {
|
|
19308
|
+
discardStaging();
|
|
19309
|
+
return { updated: false, reason: STOPPING_REASON };
|
|
19310
|
+
}
|
|
19132
19311
|
try {
|
|
19133
19312
|
deps.install(tgz);
|
|
19134
19313
|
} catch (e) {
|
|
@@ -19143,9 +19322,11 @@ async function executeAutoUpdate(plan, deps) {
|
|
|
19143
19322
|
reason: `install reported success but ${landed} is still on disk (wanted ${plan.to}) \u2014 the package that runs is not the one npm wrote. Reinstall by hand: npm install -g ${plan.url}`
|
|
19144
19323
|
};
|
|
19145
19324
|
}
|
|
19146
|
-
|
|
19147
|
-
|
|
19148
|
-
|
|
19325
|
+
if (!deps.stopping?.()) {
|
|
19326
|
+
try {
|
|
19327
|
+
deps.restart(deps.platform ?? process.platform);
|
|
19328
|
+
} catch {
|
|
19329
|
+
}
|
|
19149
19330
|
}
|
|
19150
19331
|
return { updated: true, reason: `updated ${plan.from} \u2192 ${plan.to}`, from: plan.from, to: plan.to };
|
|
19151
19332
|
}
|
|
@@ -19204,10 +19385,18 @@ function realInstall(tgz) {
|
|
|
19204
19385
|
npmInstall(npm, ["install", "-g", "--prefix", join41(homedir15(), ".local"), tgz]);
|
|
19205
19386
|
}
|
|
19206
19387
|
}
|
|
19388
|
+
function acquireUpdateLock() {
|
|
19389
|
+
return acquireIndexLock({ kind: "auto-update", file: ".update.lock", staleAfterMs: 10 * 6e4 });
|
|
19390
|
+
}
|
|
19391
|
+
function restartCommand(platform2) {
|
|
19392
|
+
if (platform2 === "linux") return { cmd: "systemctl --user --no-block restart chat-recall-watch.service" };
|
|
19393
|
+
if (platform2 === "darwin") return { cmd: "launchctl kickstart -k gui/$(id -u)/com.chat-recall.watch", shell: "/bin/bash" };
|
|
19394
|
+
if (platform2 === "win32") return { cmd: "schtasks /End /TN chat-recall-watch & schtasks /Run /TN chat-recall-watch" };
|
|
19395
|
+
return null;
|
|
19396
|
+
}
|
|
19207
19397
|
function realRestart(platform2) {
|
|
19208
|
-
|
|
19209
|
-
|
|
19210
|
-
else if (platform2 === "win32") execSync2("schtasks /End /TN chat-recall-watch & schtasks /Run /TN chat-recall-watch", { stdio: "ignore" });
|
|
19398
|
+
const c = restartCommand(platform2);
|
|
19399
|
+
if (c) execSync2(c.cmd, { stdio: "ignore", ...c.shell ? { shell: c.shell } : {} });
|
|
19211
19400
|
}
|
|
19212
19401
|
function updateStatePath() {
|
|
19213
19402
|
const dir = process.env.CHAT_RECALL_DATA_DIR || join41(homedir15(), ".chat-recall");
|
|
@@ -19240,6 +19429,9 @@ function noteUpdateFailure(target) {
|
|
|
19240
19429
|
function clearUpdateFailures() {
|
|
19241
19430
|
writeUpdateState({});
|
|
19242
19431
|
}
|
|
19432
|
+
function stopAutoUpdates() {
|
|
19433
|
+
stopRequested = true;
|
|
19434
|
+
}
|
|
19243
19435
|
async function runAutoUpdate(base2, authHeaders, ownVersion3, deps) {
|
|
19244
19436
|
let caps;
|
|
19245
19437
|
try {
|
|
@@ -19266,12 +19458,28 @@ async function runAutoUpdate(base2, authHeaders, ownVersion3, deps) {
|
|
|
19266
19458
|
if (target && hasGivenUpOn(target)) {
|
|
19267
19459
|
return { updated: false, reason: `gave up installing ${plan.to} after ${GIVE_UP_AFTER} failed attempts \u2014 run \`npm install -g chat-recall\` by hand` };
|
|
19268
19460
|
}
|
|
19269
|
-
const
|
|
19270
|
-
|
|
19271
|
-
|
|
19272
|
-
|
|
19273
|
-
|
|
19274
|
-
|
|
19461
|
+
const stopping = deps?.stopping ?? (() => stopRequested);
|
|
19462
|
+
if (stopping()) return { updated: false, reason: STOPPING_REASON };
|
|
19463
|
+
const lock = (deps?.acquireLock ?? acquireUpdateLock)();
|
|
19464
|
+
if (!lock) return { updated: false, reason: LOCKED_REASON };
|
|
19465
|
+
let result;
|
|
19466
|
+
try {
|
|
19467
|
+
const onDisk = (deps?.onDisk ?? installedVersion)();
|
|
19468
|
+
if (onDisk && plan.to && compareVersions(onDisk, plan.to) >= 0) {
|
|
19469
|
+
return { updated: false, reason: `already current: ${onDisk} is on disk` };
|
|
19470
|
+
}
|
|
19471
|
+
result = await executeAutoUpdate(plan, {
|
|
19472
|
+
download: deps?.download ?? realDownload,
|
|
19473
|
+
install: deps?.install ?? realInstall,
|
|
19474
|
+
restart: deps?.restart ?? realRestart,
|
|
19475
|
+
platform: deps?.platform,
|
|
19476
|
+
verify: deps?.verify,
|
|
19477
|
+
stopping
|
|
19478
|
+
});
|
|
19479
|
+
} finally {
|
|
19480
|
+
lock.release();
|
|
19481
|
+
}
|
|
19482
|
+
if (result.reason === STOPPING_REASON) return result;
|
|
19275
19483
|
if (!result.updated) {
|
|
19276
19484
|
const failures = target ? noteUpdateFailure(target) : 1;
|
|
19277
19485
|
if (failures <= GIVE_UP_AFTER) {
|
|
@@ -19287,14 +19495,18 @@ async function runAutoUpdate(base2, authHeaders, ownVersion3, deps) {
|
|
|
19287
19495
|
}
|
|
19288
19496
|
return result;
|
|
19289
19497
|
}
|
|
19290
|
-
var tarballUrl, GIVE_UP_AFTER, reportedStandingSkip;
|
|
19498
|
+
var tarballUrl, GIVE_UP_AFTER, reportedStandingSkip, STOPPING_REASON, LOCKED_REASON, stopRequested;
|
|
19291
19499
|
var init_auto_update = __esm({
|
|
19292
19500
|
"src/auto-update.ts"() {
|
|
19293
19501
|
"use strict";
|
|
19294
19502
|
init_http();
|
|
19503
|
+
init_index_lock();
|
|
19295
19504
|
tarballUrl = (base2, version) => `${base2.replace(/\/+$/, "")}/install/${version ? `chat-recall-${version}.tgz` : "chat-recall.tgz"}`;
|
|
19296
19505
|
GIVE_UP_AFTER = 3;
|
|
19297
19506
|
reportedStandingSkip = /* @__PURE__ */ new Set();
|
|
19507
|
+
STOPPING_REASON = "not installed: this process is shutting down";
|
|
19508
|
+
LOCKED_REASON = "another process is installing an update";
|
|
19509
|
+
stopRequested = false;
|
|
19298
19510
|
}
|
|
19299
19511
|
});
|
|
19300
19512
|
|
|
@@ -20698,7 +20910,7 @@ async function buildConversationSync(ref, mtime, opts = {}) {
|
|
|
20698
20910
|
} else {
|
|
20699
20911
|
try {
|
|
20700
20912
|
const count2 = { redactions: 0 };
|
|
20701
|
-
const redacted =
|
|
20913
|
+
const redacted = redactContainer(container, (t) => redactSecrets(t, { force: true, count: count2 }));
|
|
20702
20914
|
count.redactions += count2.redactions;
|
|
20703
20915
|
const { gz, size } = gzipContainer(redacted);
|
|
20704
20916
|
if (gz.length <= 8 * 1024 * 1024) {
|
|
@@ -20898,7 +21110,7 @@ var init_sync_client = __esm({
|
|
|
20898
21110
|
ownVersion = JSON.parse(readFileSync35(join42(dir, "../package.json"), "utf-8")).version || ownVersion;
|
|
20899
21111
|
} catch {
|
|
20900
21112
|
try {
|
|
20901
|
-
if (true) ownVersion = "0.7.
|
|
21113
|
+
if (true) ownVersion = "0.7.12";
|
|
20902
21114
|
} catch {
|
|
20903
21115
|
}
|
|
20904
21116
|
}
|
|
@@ -24035,7 +24247,7 @@ try {
|
|
|
24035
24247
|
ownVersion2 = JSON.parse(readFileSync39(join48(dir, "../package.json"), "utf-8")).version || ownVersion2;
|
|
24036
24248
|
} catch {
|
|
24037
24249
|
try {
|
|
24038
|
-
if (true) ownVersion2 = "0.7.
|
|
24250
|
+
if (true) ownVersion2 = "0.7.12";
|
|
24039
24251
|
} catch {
|
|
24040
24252
|
}
|
|
24041
24253
|
}
|
|
@@ -24420,7 +24632,7 @@ async function runCollectorMigration(opts) {
|
|
|
24420
24632
|
init_sync_ledger();
|
|
24421
24633
|
init_collector_health();
|
|
24422
24634
|
import { existsSync as existsSync50, readFileSync as readFileSync45, statSync as statSync45 } from "fs";
|
|
24423
|
-
var CLI_VERSION3 = true ? "0.7.
|
|
24635
|
+
var CLI_VERSION3 = true ? "0.7.12" : "0.0.0";
|
|
24424
24636
|
var DEBOUNCE_MS = 5e3;
|
|
24425
24637
|
var PLANS_DIR = claudeBackend.plansDir();
|
|
24426
24638
|
var TASKS_DIR = claudeBackend.tasksDir();
|
|
@@ -24976,6 +25188,7 @@ if (CODE_INDEX_ON) setTimeout(() => {
|
|
|
24976
25188
|
}, 15e4);
|
|
24977
25189
|
function shutdown(signal) {
|
|
24978
25190
|
daemonLog.info(`Received ${signal}, shutting down...`);
|
|
25191
|
+
stopAutoUpdates();
|
|
24979
25192
|
try {
|
|
24980
25193
|
flushLedger();
|
|
24981
25194
|
} catch (e) {
|