chat-recall 0.6.1 → 0.6.4
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 +27 -18
- package/dist/cli.js +1397 -2308
- package/dist/cli.js.map +1 -1
- package/dist/conformant-server.d.ts +18 -1
- package/dist/conformant-server.d.ts.map +1 -1
- package/dist/conformant-server.js +7 -2
- package/dist/conformant-server.js.map +1 -1
- package/dist/install-skills.d.ts +1 -2
- package/dist/install-skills.d.ts.map +1 -1
- package/dist/install-skills.js +11 -12
- package/dist/install-skills.js.map +1 -1
- package/dist/intent-drain.d.ts +34 -0
- package/dist/intent-drain.d.ts.map +1 -1
- package/dist/intent-drain.js +87 -24
- package/dist/intent-drain.js.map +1 -1
- package/dist/mcp-relay.js +1 -1
- package/dist/mcp.js +847 -1720
- package/dist/scan-worker.js +448 -1039
- package/dist/service-installer.d.ts +17 -0
- package/dist/service-installer.d.ts.map +1 -1
- package/dist/service-installer.js +76 -2
- package/dist/service-installer.js.map +1 -1
- package/dist/sync-client.d.ts.map +1 -1
- package/dist/sync-client.js +30 -5
- package/dist/sync-client.js.map +1 -1
- package/dist/watch.js +1325 -1927
- package/package.json +15 -6
|
@@ -11,6 +11,23 @@ export declare function isServiceRunning(): boolean;
|
|
|
11
11
|
* Install + start the per-user background service. Returns the paths written
|
|
12
12
|
* (for status messaging) or throws on platform/manager failure.
|
|
13
13
|
*/
|
|
14
|
+
/**
|
|
15
|
+
* Rewrite the service definition when the installed one no longer matches what
|
|
16
|
+
* this version renders.
|
|
17
|
+
*
|
|
18
|
+
* WHY THIS IS NOT JUST installService(). That runs only when someone types
|
|
19
|
+
* `chat-recall watch --install-service`. An upgrade never rewrote the unit, so
|
|
20
|
+
* every supervision fix shipped to nobody: machines installed before it kept
|
|
21
|
+
* the old file, including the start limiter that lets systemd abandon a
|
|
22
|
+
* crash-looping collector permanently. The daemon calls this on startup, and a
|
|
23
|
+
* daemon start is what an upgrade produces, so the fix arrives with the code
|
|
24
|
+
* that needs it.
|
|
25
|
+
*
|
|
26
|
+
* Compares the rendered text and returns false when it already matches, so the
|
|
27
|
+
* common path writes nothing and restarts nothing. Best-effort by contract: a
|
|
28
|
+
* collector that cannot rewrite its own unit must keep collecting.
|
|
29
|
+
*/
|
|
30
|
+
export declare function refreshServiceDefinition(): boolean;
|
|
14
31
|
export declare function installService(): ServicePaths;
|
|
15
32
|
/** Render the systemd --user unit file body (pure — no FS, no exec). */
|
|
16
33
|
export declare function renderSystemdUnit(watchJs: string, node: string, logFile: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-installer.d.ts","sourceRoot":"","sources":["../src/service-installer.ts"],"names":[],"mappings":"AAiBA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;AAE9D,MAAM,WAAW,YAAY;IAC3B,4EAA4E;IAC5E,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;CACjB;AAiBD,0EAA0E;AAC1E,wBAAgB,gBAAgB,IAAI,OAAO,CAe1C;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,YAAY,CAiB7C;AAsBD,wEAAwE;AACxE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"service-installer.d.ts","sourceRoot":"","sources":["../src/service-installer.ts"],"names":[],"mappings":"AAiBA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;AAE9D,MAAM,WAAW,YAAY;IAC3B,4EAA4E;IAC5E,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;CACjB;AAiBD,0EAA0E;AAC1E,wBAAgB,gBAAgB,IAAI,OAAO,CAe1C;AAED;;;GAGG;AACH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CA2BlD;AAED,wBAAgB,cAAc,IAAI,YAAY,CAiB7C;AAsBD,wEAAwE;AACxE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CA6CxF;AAmBD,6DAA6D;AAC7D,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,SAA0B,GAAG,MAAM,CAa1H;AAuBD,4DAA4D;AAC5D,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,SAAsB,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAKhI;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAoB1C;AAED,kDAAkD;AAClD,wBAAgB,YAAY,IAAI,MAAM,CAKrC;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;gBACF,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAI3C"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* service survives `npm prefix` moves better than relying on PATH at boot.
|
|
11
11
|
*/
|
|
12
12
|
import { execSync } from 'child_process';
|
|
13
|
-
import { existsSync, mkdirSync, rmSync, writeFileSync } from 'fs';
|
|
13
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'fs';
|
|
14
14
|
import { homedir } from 'os';
|
|
15
15
|
import { join } from 'path';
|
|
16
16
|
import { fileURLToPath } from 'url';
|
|
@@ -53,6 +53,55 @@ export function isServiceRunning() {
|
|
|
53
53
|
* Install + start the per-user background service. Returns the paths written
|
|
54
54
|
* (for status messaging) or throws on platform/manager failure.
|
|
55
55
|
*/
|
|
56
|
+
/**
|
|
57
|
+
* Rewrite the service definition when the installed one no longer matches what
|
|
58
|
+
* this version renders.
|
|
59
|
+
*
|
|
60
|
+
* WHY THIS IS NOT JUST installService(). That runs only when someone types
|
|
61
|
+
* `chat-recall watch --install-service`. An upgrade never rewrote the unit, so
|
|
62
|
+
* every supervision fix shipped to nobody: machines installed before it kept
|
|
63
|
+
* the old file, including the start limiter that lets systemd abandon a
|
|
64
|
+
* crash-looping collector permanently. The daemon calls this on startup, and a
|
|
65
|
+
* daemon start is what an upgrade produces, so the fix arrives with the code
|
|
66
|
+
* that needs it.
|
|
67
|
+
*
|
|
68
|
+
* Compares the rendered text and returns false when it already matches, so the
|
|
69
|
+
* common path writes nothing and restarts nothing. Best-effort by contract: a
|
|
70
|
+
* collector that cannot rewrite its own unit must keep collecting.
|
|
71
|
+
*/
|
|
72
|
+
export function refreshServiceDefinition() {
|
|
73
|
+
if (process.platform !== 'linux')
|
|
74
|
+
return false; // launchd/schtasks refresh on reinstall
|
|
75
|
+
try {
|
|
76
|
+
const { watchJs, node, logFile } = resolveDaemonPaths();
|
|
77
|
+
const unitPath = join(homedir(), '.config', 'systemd', 'user', 'chat-recall-watch.service');
|
|
78
|
+
if (!existsSync(unitPath))
|
|
79
|
+
return false; // not service-managed; nothing to refresh
|
|
80
|
+
const current = readFileSync(unitPath, 'utf8');
|
|
81
|
+
// ONLY refresh the unit this build is actually installed as. A daemon run
|
|
82
|
+
// straight out of a checkout would otherwise rewrite ExecStart to its own
|
|
83
|
+
// path and take over the user's service — which is exactly what happened
|
|
84
|
+
// while testing this: the unit ended up pointing at a worktree instead of
|
|
85
|
+
// the installed CLI. Supervision settings are worth refreshing; which
|
|
86
|
+
// binary the service runs is the installer's decision, not a running
|
|
87
|
+
// process's.
|
|
88
|
+
if (!current.includes(watchJs))
|
|
89
|
+
return false;
|
|
90
|
+
const wanted = renderSystemdUnit(watchJs, node, logFile);
|
|
91
|
+
if (readFileSync(unitPath, 'utf8') === wanted)
|
|
92
|
+
return false;
|
|
93
|
+
writeFileSync(unitPath, wanted);
|
|
94
|
+
// daemon-reload only. Restarting here would kill the process that is
|
|
95
|
+
// running this code, and the new unit applies on the next start anyway --
|
|
96
|
+
// which for a crash-looping daemon is seconds away, and is exactly the
|
|
97
|
+
// case this fixes.
|
|
98
|
+
execSync('systemctl --user daemon-reload', { stdio: 'ignore' });
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
56
105
|
export function installService() {
|
|
57
106
|
const { watchJs, node, logFile, dataDir } = resolveDaemonPaths();
|
|
58
107
|
mkdirSync(dataDir, { recursive: true });
|
|
@@ -93,7 +142,15 @@ function installSystemd(watchJs, node, logFile) {
|
|
|
93
142
|
/** Render the systemd --user unit file body (pure — no FS, no exec). */
|
|
94
143
|
export function renderSystemdUnit(watchJs, node, logFile) {
|
|
95
144
|
return [
|
|
96
|
-
'[Unit]', 'Description=chat-recall live indexer (sessions → local index, optional server sync)', 'After=default.target',
|
|
145
|
+
'[Unit]', 'Description=chat-recall live indexer (sessions → local index, optional server sync)', 'After=default.target',
|
|
146
|
+
// NEVER STOP RETRYING, and it must be in [Unit] — systemd reads the start
|
|
147
|
+
// limiter there and ignores it under [Service], silently. The default gives
|
|
148
|
+
// up after a burst and leaves the unit dead until a human notices: 53
|
|
149
|
+
// restarts here, then "Start request repeated too quickly", then twelve
|
|
150
|
+
// hours with nothing collected and nothing said. A collector that stops
|
|
151
|
+
// forever after a crash loop is worse than one that keeps crashing.
|
|
152
|
+
// 0 disables the limiter, so RestartSec below is the only pacing.
|
|
153
|
+
'StartLimitIntervalSec=0', '',
|
|
97
154
|
'[Service]',
|
|
98
155
|
// Bounded heap: the daemon does bursty batch work (transcript parse,
|
|
99
156
|
// base64 payloads); V8's default old-space on a big-RAM box is ~4GB and
|
|
@@ -102,6 +159,23 @@ export function renderSystemdUnit(watchJs, node, logFile) {
|
|
|
102
159
|
// largest transcripts.
|
|
103
160
|
`ExecStart=${node} --max-old-space-size=1536 ${watchJs}`,
|
|
104
161
|
'Restart=on-failure', 'RestartSec=10', 'Nice=10',
|
|
162
|
+
// NEVER STOP RETRYING. systemd's default start limiter gives up after a
|
|
163
|
+
// burst of restarts and leaves the unit dead until a human notices. On a
|
|
164
|
+
// developer machine here that was 53 restarts, then
|
|
165
|
+
//
|
|
166
|
+
// chat-recall-watch.service: Start request repeated too quickly.
|
|
167
|
+
// Failed to start chat-recall-watch.service
|
|
168
|
+
//
|
|
169
|
+
// and twelve hours with nothing collected and nothing said. A collector
|
|
170
|
+
// that stops forever after a crash loop is worse than one that keeps
|
|
171
|
+
// crashing: the user is told nothing and their history silently ends.
|
|
172
|
+
// 0 disables the limiter, so RestartSec above is the only pacing.
|
|
173
|
+
// A bounded cgroup, so a leak becomes a restart rather than a machine that
|
|
174
|
+
// swaps. MemoryHigh throttles and reclaims first; MemoryMax is the kill.
|
|
175
|
+
// --max-old-space-size bounds the V8 heap and NOT Buffers, and the observed
|
|
176
|
+
// peak was 2.1 GB RSS against a 1536 MB heap cap, so only a cgroup limit
|
|
177
|
+
// bounds the external half.
|
|
178
|
+
'MemoryAccounting=yes', 'MemoryHigh=1G', 'MemoryMax=2G',
|
|
105
179
|
// JOURNAL, not append:. The file version had no rotation and nothing to
|
|
106
180
|
// give it any: systemd holds the fd open, so the daemon cannot rename or
|
|
107
181
|
// truncate its own log without leaving systemd writing into a hole. It
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-installer.js","sourceRoot":"","sources":["../src/service-installer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"service-installer.js","sourceRoot":"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O,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-client.d.ts","sourceRoot":"","sources":["../src/sync-client.ts"],"names":[],"mappings":"AAyCA,OAAO,EAAoF,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"sync-client.d.ts","sourceRoot":"","sources":["../src/sync-client.ts"],"names":[],"mappings":"AAyCA,OAAO,EAAoF,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAUrL,OAAO,EAA+B,KAAK,UAAU,EAAE,MAAM,0CAA0C,CAAC;AA2ExG,yDAAyD;AACzD,wBAAgB,YAAY,CAAC,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAI7E;AAgBD,wEAAwE;AACxE,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAGvD;AAED,MAAM,MAAM,YAAY,GACpB,cAAc,GAAG,kBAAkB,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GACpE,KAAK,GAAG,SAAS,GAAG,oBAAoB,GAAG,cAAc,GAAG,OAAO,CAAC;AAExE;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,YAAY,CAqBtE;AAOD,OAAO,4CAA4C,CAAC;AAMpD,MAAM,WAAW,WAAW;IAAG,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;CAAE;AAElE;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,WAAW,GAAG,IAAI,CAoBpD;AAED,wBAAgB,kBAAkB,IAAI,WAAW,EAAE,CAelD;AAwGD,wBAAgB,+BAA+B,IAAI,IAAI,CAEtD;AAuBD,UAAU,gBAAgB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;;;GAQG;AACH;;;;yCAIyC;AACzC,MAAM,WAAW,QAAQ;IAAG,OAAO,EAAE,gBAAgB,GAAG,QAAQ,GAAG,WAAW,CAAA;CAAE;AAEhF,wBAAgB,UAAU,CAAC,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,CAAC,IAAI,QAAQ,CAElE;AAED,wBAAsB,eAAe,CAAC,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAO,GAAG,OAAO,CAAC,UAAU,GAAG,QAAQ,CAAC,CA4C/G"}
|
package/dist/sync-client.js
CHANGED
|
@@ -47,7 +47,6 @@ import { getDataDir } from '@chat-recall/engine/core/paths.js';
|
|
|
47
47
|
import { listAvailableBackends } from '@chat-recall/engine/core/tool-backend.js';
|
|
48
48
|
import { parseTranscript, trimTranscriptForSync, TRANSCRIPT_VERSION, gzipContainer, mapContainerText, buildRawContainer, containerSrcHash, parseTranscriptFromContainer, updateShadow } from '@chat-recall/engine/transcript/index.js';
|
|
49
49
|
import { parseClaudeTranscriptText } from '@chat-recall/engine/transcript/claude.js';
|
|
50
|
-
import { parseGeminiTranscriptText } from '@chat-recall/engine/transcript/gemini.js';
|
|
51
50
|
import { parseCodexTranscriptText } from '@chat-recall/engine/transcript/codex.js';
|
|
52
51
|
import { getBackendForId, getBackend } from '@chat-recall/engine/core/tool-backend.js';
|
|
53
52
|
import { fileURLToPath } from 'node:url';
|
|
@@ -1300,7 +1299,12 @@ async function syncToTargetInScope(cred, opts = {}) {
|
|
|
1300
1299
|
// POST (e.g. one session's findings — the server replaces a session's
|
|
1301
1300
|
// findings wholesale, so splitting a session across two batches would
|
|
1302
1301
|
// lose the first half).
|
|
1303
|
-
|
|
1302
|
+
// `barrier` runs before this batcher's POST is queued, and is how a batch that
|
|
1303
|
+
// DEPENDS on another batch having landed gets that guarantee. submit() does
|
|
1304
|
+
// not await the request — it awaits a free pool slot and returns with the POST
|
|
1305
|
+
// still in flight — so draining A before B only orders the enqueue, never the
|
|
1306
|
+
// arrival.
|
|
1307
|
+
const makeBatcher = (field, maxItems, flatten = false, onFlush, barrier) => {
|
|
1304
1308
|
let batch = [];
|
|
1305
1309
|
let batchBytes = 0;
|
|
1306
1310
|
return {
|
|
@@ -1320,6 +1324,10 @@ async function syncToTargetInScope(cred, opts = {}) {
|
|
|
1320
1324
|
async drain() {
|
|
1321
1325
|
if (batch.length === 0)
|
|
1322
1326
|
return;
|
|
1327
|
+
// Before the rows are handed to the pool, not after: once submitted they
|
|
1328
|
+
// race everything already in flight.
|
|
1329
|
+
if (barrier)
|
|
1330
|
+
await barrier();
|
|
1323
1331
|
const rows = flatten ? batch.flat() : batch;
|
|
1324
1332
|
const bytes = batchBytes;
|
|
1325
1333
|
batch = [];
|
|
@@ -1445,7 +1453,26 @@ async function syncToTargetInScope(cred, opts = {}) {
|
|
|
1445
1453
|
const kgTripleBatch = makeBatcher('kg_triples', 1000);
|
|
1446
1454
|
// Secret findings ship per-session as a GROUP (flatten=true) — the server
|
|
1447
1455
|
// replaces a session's findings wholesale, so they must land in one POST.
|
|
1448
|
-
|
|
1456
|
+
//
|
|
1457
|
+
// The barrier is load-bearing, and it is a SILENT DATA-LOSS fix. The server
|
|
1458
|
+
// drops a finding whose session has no row yet (routes/sync.ts) — deliberately,
|
|
1459
|
+
// because secret_findings carries a restrictive author_visibility policy and
|
|
1460
|
+
// the insert would 42501 and fail the whole ingest. It logs and continues.
|
|
1461
|
+
//
|
|
1462
|
+
// Findings and session rows travel in separate batches, and submit() returns
|
|
1463
|
+
// with the POST still in flight, so on a session's FIRST sync the finding
|
|
1464
|
+
// could arrive before the session existed and be discarded. Sync is
|
|
1465
|
+
// watermark-based, so that session is rarely shipped again: the one session
|
|
1466
|
+
// where a key was pasted is exactly the one whose finding is lost, for good,
|
|
1467
|
+
// and the security view then answers "no leaked secrets detected".
|
|
1468
|
+
//
|
|
1469
|
+
// Reproduced by running the same fixture twice: first run "1 secret findings
|
|
1470
|
+
// sent" and the server holds 0; second run, session already present, the
|
|
1471
|
+
// server holds 1.
|
|
1472
|
+
//
|
|
1473
|
+
// The barrier also covers the mid-walk flush at the 200 cap, which the
|
|
1474
|
+
// end-of-run drain order could not.
|
|
1475
|
+
const findingsBatch = makeBatcher('findings', 200, true, undefined, () => drainInflight());
|
|
1449
1476
|
// External detectors (gitleaks/trufflehog) are OPT-IN and default OFF:
|
|
1450
1477
|
// isSecretScannerAvailable() returns false unless CHAT_RECALL_EXTERNAL_SCANNERS
|
|
1451
1478
|
// is set AND a binary is on PATH. Resolved once (each check spawns `which`).
|
|
@@ -2491,8 +2518,6 @@ function parseTailMessages(tool, text) {
|
|
|
2491
2518
|
return [];
|
|
2492
2519
|
if (tool === 'claude')
|
|
2493
2520
|
return parseClaudeTranscriptText(text);
|
|
2494
|
-
if (tool === 'gemini')
|
|
2495
|
-
return parseGeminiTranscriptText(text);
|
|
2496
2521
|
if (tool === 'codex')
|
|
2497
2522
|
return parseCodexTranscriptText(text);
|
|
2498
2523
|
return [];
|