chat-recall 0.7.78 → 0.7.79
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/cli.js +7 -5
- package/dist/mcp.js +7 -5
- package/dist/service-installer.d.ts +8 -0
- package/dist/service-installer.d.ts.map +1 -1
- package/dist/service-installer.js +13 -5
- package/dist/service-installer.js.map +1 -1
- package/dist/session-watch-ignore.d.ts +22 -0
- package/dist/session-watch-ignore.d.ts.map +1 -0
- package/dist/session-watch-ignore.js +43 -0
- package/dist/session-watch-ignore.js.map +1 -0
- package/dist/watch.js +101 -78
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -40387,6 +40387,7 @@ var service_installer_exports = {};
|
|
|
40387
40387
|
__export(service_installer_exports, {
|
|
40388
40388
|
ServiceInstallError: () => ServiceInstallError,
|
|
40389
40389
|
WATCH_HEAP_MB: () => WATCH_HEAP_MB,
|
|
40390
|
+
WATCH_SEMI_SPACE_MB: () => WATCH_SEMI_SPACE_MB,
|
|
40390
40391
|
installService: () => installService,
|
|
40391
40392
|
isServiceRunning: () => isServiceRunning,
|
|
40392
40393
|
platformName: () => platformName,
|
|
@@ -40498,7 +40499,7 @@ function renderSystemdUnit(watchJs, node, logFile) {
|
|
|
40498
40499
|
// base64 payloads); V8's default old-space on a big-RAM box is ~4GB and
|
|
40499
40500
|
// GC only gets aggressive near the ceiling — observed as a multi-GB RSS
|
|
40500
40501
|
// sawtooth. The ceiling below is measured, not guessed: see WATCH_HEAP_MB.
|
|
40501
|
-
`ExecStart=${node} --max-old-space-size=${WATCH_HEAP_MB} --expose-gc ${watchJs}`,
|
|
40502
|
+
`ExecStart=${node} --max-old-space-size=${WATCH_HEAP_MB} --max-semi-space-size=${WATCH_SEMI_SPACE_MB} --expose-gc ${watchJs}`,
|
|
40502
40503
|
// ALWAYS: the collector never ends its own work, so any exit systemd did
|
|
40503
40504
|
// not ask for is a fault. Under on-failure a clean exit left it dead: on
|
|
40504
40505
|
// 2026-09-16 the unit went "inactive (dead) … status=0/SUCCESS" and stayed
|
|
@@ -40578,7 +40579,7 @@ function renderLaunchdPlist(watchJs, node, logFile, label = "com.chat-recall.wat
|
|
|
40578
40579
|
'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">',
|
|
40579
40580
|
'<plist version="1.0"><dict>',
|
|
40580
40581
|
` <key>Label</key><string>${label}</string>`,
|
|
40581
|
-
` <key>ProgramArguments</key><array><string>${node}</string><string>--max-old-space-size=${WATCH_HEAP_MB}</string><string>--expose-gc</string><string>${watchJs}</string></array>`,
|
|
40582
|
+
` <key>ProgramArguments</key><array><string>${node}</string><string>--max-old-space-size=${WATCH_HEAP_MB}</string><string>--max-semi-space-size=${WATCH_SEMI_SPACE_MB}</string><string>--expose-gc</string><string>${watchJs}</string></array>`,
|
|
40582
40583
|
" <key>RunAtLoad</key><true/>",
|
|
40583
40584
|
" <key>KeepAlive</key><true/>",
|
|
40584
40585
|
` <key>StandardOutPath</key><string>${logFile}</string>`,
|
|
@@ -40589,7 +40590,7 @@ function renderLaunchdPlist(watchJs, node, logFile, label = "com.chat-recall.wat
|
|
|
40589
40590
|
}
|
|
40590
40591
|
function installWindowsTask(watchJs, node, logFile) {
|
|
40591
40592
|
const taskName = "chat-recall-watch";
|
|
40592
|
-
const tr = `cmd /c \\"\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} \\"${watchJs}\\" >> \\"${logFile}\\" 2>&1\\"`;
|
|
40593
|
+
const tr = `cmd /c \\"\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} --max-semi-space-size=${WATCH_SEMI_SPACE_MB} \\"${watchJs}\\" >> \\"${logFile}\\" 2>&1\\"`;
|
|
40593
40594
|
try {
|
|
40594
40595
|
execSync5(`schtasks /create /tn "${taskName}" /tr "${tr}" /sc onlogon /rl LIMITED /f`, { stdio: "inherit" });
|
|
40595
40596
|
try {
|
|
@@ -40602,7 +40603,7 @@ function installWindowsTask(watchJs, node, logFile) {
|
|
|
40602
40603
|
return { definitionPath: null, logFile };
|
|
40603
40604
|
}
|
|
40604
40605
|
function renderWindowsTaskCommand(watchJs, node, taskName = "chat-recall-watch", logFile) {
|
|
40605
|
-
const tr = logFile ? `cmd /c \\"\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} \\"${watchJs}\\" >> \\"${logFile}\\" 2>&1\\"` : `\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} \\"${watchJs}\\"`;
|
|
40606
|
+
const tr = logFile ? `cmd /c \\"\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} --max-semi-space-size=${WATCH_SEMI_SPACE_MB} \\"${watchJs}\\" >> \\"${logFile}\\" 2>&1\\"` : `\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} --max-semi-space-size=${WATCH_SEMI_SPACE_MB} \\"${watchJs}\\"`;
|
|
40606
40607
|
return `schtasks /create /tn "${taskName}" /tr "${tr}" /sc onlogon /rl LIMITED /f`;
|
|
40607
40608
|
}
|
|
40608
40609
|
function uninstallService() {
|
|
@@ -40653,11 +40654,12 @@ function platformName() {
|
|
|
40653
40654
|
if (process.platform === "win32") return "Scheduled Task";
|
|
40654
40655
|
return process.platform;
|
|
40655
40656
|
}
|
|
40656
|
-
var WATCH_HEAP_MB, ServiceInstallError;
|
|
40657
|
+
var WATCH_HEAP_MB, WATCH_SEMI_SPACE_MB, ServiceInstallError;
|
|
40657
40658
|
var init_service_installer = __esm({
|
|
40658
40659
|
"src/service-installer.ts"() {
|
|
40659
40660
|
"use strict";
|
|
40660
40661
|
WATCH_HEAP_MB = 640;
|
|
40662
|
+
WATCH_SEMI_SPACE_MB = 2;
|
|
40661
40663
|
ServiceInstallError = class extends Error {
|
|
40662
40664
|
hint;
|
|
40663
40665
|
constructor(message, hint) {
|
package/dist/mcp.js
CHANGED
|
@@ -33290,6 +33290,7 @@ var service_installer_exports = {};
|
|
|
33290
33290
|
__export(service_installer_exports, {
|
|
33291
33291
|
ServiceInstallError: () => ServiceInstallError,
|
|
33292
33292
|
WATCH_HEAP_MB: () => WATCH_HEAP_MB,
|
|
33293
|
+
WATCH_SEMI_SPACE_MB: () => WATCH_SEMI_SPACE_MB,
|
|
33293
33294
|
installService: () => installService,
|
|
33294
33295
|
isServiceRunning: () => isServiceRunning,
|
|
33295
33296
|
platformName: () => platformName,
|
|
@@ -33401,7 +33402,7 @@ function renderSystemdUnit(watchJs, node, logFile) {
|
|
|
33401
33402
|
// base64 payloads); V8's default old-space on a big-RAM box is ~4GB and
|
|
33402
33403
|
// GC only gets aggressive near the ceiling — observed as a multi-GB RSS
|
|
33403
33404
|
// sawtooth. The ceiling below is measured, not guessed: see WATCH_HEAP_MB.
|
|
33404
|
-
`ExecStart=${node} --max-old-space-size=${WATCH_HEAP_MB} --expose-gc ${watchJs}`,
|
|
33405
|
+
`ExecStart=${node} --max-old-space-size=${WATCH_HEAP_MB} --max-semi-space-size=${WATCH_SEMI_SPACE_MB} --expose-gc ${watchJs}`,
|
|
33405
33406
|
// ALWAYS: the collector never ends its own work, so any exit systemd did
|
|
33406
33407
|
// not ask for is a fault. Under on-failure a clean exit left it dead: on
|
|
33407
33408
|
// 2026-09-16 the unit went "inactive (dead) … status=0/SUCCESS" and stayed
|
|
@@ -33481,7 +33482,7 @@ function renderLaunchdPlist(watchJs, node, logFile, label = "com.chat-recall.wat
|
|
|
33481
33482
|
'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">',
|
|
33482
33483
|
'<plist version="1.0"><dict>',
|
|
33483
33484
|
` <key>Label</key><string>${label}</string>`,
|
|
33484
|
-
` <key>ProgramArguments</key><array><string>${node}</string><string>--max-old-space-size=${WATCH_HEAP_MB}</string><string>--expose-gc</string><string>${watchJs}</string></array>`,
|
|
33485
|
+
` <key>ProgramArguments</key><array><string>${node}</string><string>--max-old-space-size=${WATCH_HEAP_MB}</string><string>--max-semi-space-size=${WATCH_SEMI_SPACE_MB}</string><string>--expose-gc</string><string>${watchJs}</string></array>`,
|
|
33485
33486
|
" <key>RunAtLoad</key><true/>",
|
|
33486
33487
|
" <key>KeepAlive</key><true/>",
|
|
33487
33488
|
` <key>StandardOutPath</key><string>${logFile}</string>`,
|
|
@@ -33492,7 +33493,7 @@ function renderLaunchdPlist(watchJs, node, logFile, label = "com.chat-recall.wat
|
|
|
33492
33493
|
}
|
|
33493
33494
|
function installWindowsTask(watchJs, node, logFile) {
|
|
33494
33495
|
const taskName = "chat-recall-watch";
|
|
33495
|
-
const tr = `cmd /c \\"\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} \\"${watchJs}\\" >> \\"${logFile}\\" 2>&1\\"`;
|
|
33496
|
+
const tr = `cmd /c \\"\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} --max-semi-space-size=${WATCH_SEMI_SPACE_MB} \\"${watchJs}\\" >> \\"${logFile}\\" 2>&1\\"`;
|
|
33496
33497
|
try {
|
|
33497
33498
|
execSync5(`schtasks /create /tn "${taskName}" /tr "${tr}" /sc onlogon /rl LIMITED /f`, { stdio: "inherit" });
|
|
33498
33499
|
try {
|
|
@@ -33505,7 +33506,7 @@ function installWindowsTask(watchJs, node, logFile) {
|
|
|
33505
33506
|
return { definitionPath: null, logFile };
|
|
33506
33507
|
}
|
|
33507
33508
|
function renderWindowsTaskCommand(watchJs, node, taskName = "chat-recall-watch", logFile) {
|
|
33508
|
-
const tr = logFile ? `cmd /c \\"\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} \\"${watchJs}\\" >> \\"${logFile}\\" 2>&1\\"` : `\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} \\"${watchJs}\\"`;
|
|
33509
|
+
const tr = logFile ? `cmd /c \\"\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} --max-semi-space-size=${WATCH_SEMI_SPACE_MB} \\"${watchJs}\\" >> \\"${logFile}\\" 2>&1\\"` : `\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} --max-semi-space-size=${WATCH_SEMI_SPACE_MB} \\"${watchJs}\\"`;
|
|
33509
33510
|
return `schtasks /create /tn "${taskName}" /tr "${tr}" /sc onlogon /rl LIMITED /f`;
|
|
33510
33511
|
}
|
|
33511
33512
|
function uninstallService() {
|
|
@@ -33556,11 +33557,12 @@ function platformName() {
|
|
|
33556
33557
|
if (process.platform === "win32") return "Scheduled Task";
|
|
33557
33558
|
return process.platform;
|
|
33558
33559
|
}
|
|
33559
|
-
var WATCH_HEAP_MB, ServiceInstallError;
|
|
33560
|
+
var WATCH_HEAP_MB, WATCH_SEMI_SPACE_MB, ServiceInstallError;
|
|
33560
33561
|
var init_service_installer = __esm({
|
|
33561
33562
|
"src/service-installer.ts"() {
|
|
33562
33563
|
"use strict";
|
|
33563
33564
|
WATCH_HEAP_MB = 640;
|
|
33565
|
+
WATCH_SEMI_SPACE_MB = 2;
|
|
33564
33566
|
ServiceInstallError = class extends Error {
|
|
33565
33567
|
hint;
|
|
33566
33568
|
constructor(message, hint) {
|
|
@@ -12,6 +12,14 @@ export type Platform = 'linux' | 'darwin' | 'win32' | 'other';
|
|
|
12
12
|
* The value is exported so the unit tests assert it instead of a stale literal.
|
|
13
13
|
*/
|
|
14
14
|
export declare const WATCH_HEAP_MB = 640;
|
|
15
|
+
/**
|
|
16
|
+
* Largest size of one half of the young generation, in MiB.
|
|
17
|
+
*
|
|
18
|
+
* The young generation of the idle daemon was 64 MiB committed with 6 MiB in
|
|
19
|
+
* use, and a fresh process that scanned the session folders held 159 MiB of V8
|
|
20
|
+
* memory for 17 MiB of live objects. With this flag the same scan held 57 MiB.
|
|
21
|
+
*/
|
|
22
|
+
export declare const WATCH_SEMI_SPACE_MB = 2;
|
|
15
23
|
export interface ServicePaths {
|
|
16
24
|
/** Absolute path to the unit/plist/task definition (or null on Windows). */
|
|
17
25
|
definitionPath: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file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M;CAI3C"}
|
|
@@ -27,6 +27,14 @@ import { fileURLToPath } from 'url';
|
|
|
27
27
|
* The value is exported so the unit tests assert it instead of a stale literal.
|
|
28
28
|
*/
|
|
29
29
|
export const WATCH_HEAP_MB = 640;
|
|
30
|
+
/**
|
|
31
|
+
* Largest size of one half of the young generation, in MiB.
|
|
32
|
+
*
|
|
33
|
+
* The young generation of the idle daemon was 64 MiB committed with 6 MiB in
|
|
34
|
+
* use, and a fresh process that scanned the session folders held 159 MiB of V8
|
|
35
|
+
* memory for 17 MiB of live objects. With this flag the same scan held 57 MiB.
|
|
36
|
+
*/
|
|
37
|
+
export const WATCH_SEMI_SPACE_MB = 2;
|
|
30
38
|
/** Resolve the watch.js entry next to this file and the log file path. */
|
|
31
39
|
function resolveDaemonPaths() {
|
|
32
40
|
const watchJs = fileURLToPath(new URL('./watch.js', import.meta.url));
|
|
@@ -169,7 +177,7 @@ export function renderSystemdUnit(watchJs, node, logFile) {
|
|
|
169
177
|
// base64 payloads); V8's default old-space on a big-RAM box is ~4GB and
|
|
170
178
|
// GC only gets aggressive near the ceiling — observed as a multi-GB RSS
|
|
171
179
|
// sawtooth. The ceiling below is measured, not guessed: see WATCH_HEAP_MB.
|
|
172
|
-
`ExecStart=${node} --max-old-space-size=${WATCH_HEAP_MB} --expose-gc ${watchJs}`,
|
|
180
|
+
`ExecStart=${node} --max-old-space-size=${WATCH_HEAP_MB} --max-semi-space-size=${WATCH_SEMI_SPACE_MB} --expose-gc ${watchJs}`,
|
|
173
181
|
// ALWAYS: the collector never ends its own work, so any exit systemd did
|
|
174
182
|
// not ask for is a fault. Under on-failure a clean exit left it dead: on
|
|
175
183
|
// 2026-09-16 the unit went "inactive (dead) … status=0/SUCCESS" and stayed
|
|
@@ -243,7 +251,7 @@ export function renderLaunchdPlist(watchJs, node, logFile, label = 'com.chat-rec
|
|
|
243
251
|
'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">',
|
|
244
252
|
'<plist version="1.0"><dict>',
|
|
245
253
|
` <key>Label</key><string>${label}</string>`,
|
|
246
|
-
` <key>ProgramArguments</key><array><string>${node}</string><string>--max-old-space-size=${WATCH_HEAP_MB}</string><string>--expose-gc</string><string>${watchJs}</string></array>`,
|
|
254
|
+
` <key>ProgramArguments</key><array><string>${node}</string><string>--max-old-space-size=${WATCH_HEAP_MB}</string><string>--max-semi-space-size=${WATCH_SEMI_SPACE_MB}</string><string>--expose-gc</string><string>${watchJs}</string></array>`,
|
|
247
255
|
' <key>RunAtLoad</key><true/>',
|
|
248
256
|
' <key>KeepAlive</key><true/>',
|
|
249
257
|
` <key>StandardOutPath</key><string>${logFile}</string>`,
|
|
@@ -261,7 +269,7 @@ function installWindowsTask(watchJs, node, logFile) {
|
|
|
261
269
|
//
|
|
262
270
|
// schtasks /tr cannot express redirection itself, so wrap in cmd /c. The
|
|
263
271
|
// whole thing is one /tr argument, hence the escaped quotes.
|
|
264
|
-
const tr = `cmd /c \\"\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} \\"${watchJs}\\" >> \\"${logFile}\\" 2>&1\\"`;
|
|
272
|
+
const tr = `cmd /c \\"\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} --max-semi-space-size=${WATCH_SEMI_SPACE_MB} \\"${watchJs}\\" >> \\"${logFile}\\" 2>&1\\"`;
|
|
265
273
|
try {
|
|
266
274
|
execSync(`schtasks /create /tn "${taskName}" /tr "${tr}" /sc onlogon /rl LIMITED /f`, { stdio: 'inherit' });
|
|
267
275
|
// Start now too (best-effort — starts next logon if /run unsupported).
|
|
@@ -278,8 +286,8 @@ function installWindowsTask(watchJs, node, logFile) {
|
|
|
278
286
|
/** Render the schtasks /create command (pure — no exec). */
|
|
279
287
|
export function renderWindowsTaskCommand(watchJs, node, taskName = 'chat-recall-watch', logFile) {
|
|
280
288
|
const tr = logFile
|
|
281
|
-
? `cmd /c \\"\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} \\"${watchJs}\\" >> \\"${logFile}\\" 2>&1\\"`
|
|
282
|
-
: `\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} \\"${watchJs}\\"`;
|
|
289
|
+
? `cmd /c \\"\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} --max-semi-space-size=${WATCH_SEMI_SPACE_MB} \\"${watchJs}\\" >> \\"${logFile}\\" 2>&1\\"`
|
|
290
|
+
: `\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} --max-semi-space-size=${WATCH_SEMI_SPACE_MB} \\"${watchJs}\\"`;
|
|
283
291
|
return `schtasks /create /tn "${taskName}" /tr "${tr}" /sc onlogon /rl LIMITED /f`;
|
|
284
292
|
}
|
|
285
293
|
/**
|
|
@@ -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,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAIpC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC;
|
|
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,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,IA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O,gBAAgB,CAAC;IAC1D,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IACpD,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO;QAAE,OAAO,gBAAgB,CAAC;IAC1D,OAAO,OAAO,CAAC,QAAQ,CAAC;AAC1B,CAAC;AAED,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,IAAI,CAAU;IACd,YAAY,OAAe,EAAE,IAAa;QACxC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Stats } from 'node:fs';
|
|
2
|
+
/**
|
|
3
|
+
* True for a folder below a project folder of a Claude home.
|
|
4
|
+
*
|
|
5
|
+
* A Claude session is the file `<root>/<project>/<id>.jsonl`. The folders below
|
|
6
|
+
* a project folder hold subagent transcripts, tool results and workflow
|
|
7
|
+
* journals, and none of them is a session. On a machine with 3,445 folders
|
|
8
|
+
* under its project roots, watching them cost 3,069 inotify watches and about
|
|
9
|
+
* 80 MB of anonymous memory in a fresh process.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isBelowProjectFolder(dir: string, roots: readonly string[]): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The `ignored` rule of the sessions watcher.
|
|
14
|
+
*
|
|
15
|
+
* A root and a project folder are always watched: a new session is a file that
|
|
16
|
+
* appears directly in a project folder, and a new project is a new folder in a
|
|
17
|
+
* root. A transcript older than the window gets no watch of its own; the
|
|
18
|
+
* heartbeat sync selects files by mtime and picks it up when it is written
|
|
19
|
+
* again.
|
|
20
|
+
*/
|
|
21
|
+
export declare function sessionWatchIgnored(roots: readonly string[], windowMs: number, now?: () => number): (p: string, stats?: Stats) => boolean;
|
|
22
|
+
//# sourceMappingURL=session-watch-ignore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-watch-ignore.d.ts","sourceRoot":"","sources":["../src/session-watch-ignore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,KAAK,EAAE,MAAM,SAAS,CAAC;AAG/C;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAMnF;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,QAAQ,EAAE,MAAM,EAChB,GAAG,GAAE,MAAM,MAAiB,GAC3B,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,KAAK,OAAO,CAUvC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { statSync } from 'node:fs';
|
|
2
|
+
import { basename, sep } from 'node:path';
|
|
3
|
+
/**
|
|
4
|
+
* True for a folder below a project folder of a Claude home.
|
|
5
|
+
*
|
|
6
|
+
* A Claude session is the file `<root>/<project>/<id>.jsonl`. The folders below
|
|
7
|
+
* a project folder hold subagent transcripts, tool results and workflow
|
|
8
|
+
* journals, and none of them is a session. On a machine with 3,445 folders
|
|
9
|
+
* under its project roots, watching them cost 3,069 inotify watches and about
|
|
10
|
+
* 80 MB of anonymous memory in a fresh process.
|
|
11
|
+
*/
|
|
12
|
+
export function isBelowProjectFolder(dir, roots) {
|
|
13
|
+
for (const root of roots) {
|
|
14
|
+
if (!dir.startsWith(root + sep))
|
|
15
|
+
continue;
|
|
16
|
+
return dir.slice(root.length + 1).split(sep).length >= 2;
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The `ignored` rule of the sessions watcher.
|
|
22
|
+
*
|
|
23
|
+
* A root and a project folder are always watched: a new session is a file that
|
|
24
|
+
* appears directly in a project folder, and a new project is a new folder in a
|
|
25
|
+
* root. A transcript older than the window gets no watch of its own; the
|
|
26
|
+
* heartbeat sync selects files by mtime and picks it up when it is written
|
|
27
|
+
* again.
|
|
28
|
+
*/
|
|
29
|
+
export function sessionWatchIgnored(roots, windowMs, now = Date.now) {
|
|
30
|
+
return (p, stats) => {
|
|
31
|
+
if (/agent-/.test(p) || /^\./.test(basename(p)))
|
|
32
|
+
return true;
|
|
33
|
+
// stats is absent for some entries during the initial scan; stat then, so
|
|
34
|
+
// the decision is never "unknown means watch it".
|
|
35
|
+
const st = stats ?? statSync(p, { throwIfNoEntry: false });
|
|
36
|
+
if (!st)
|
|
37
|
+
return false;
|
|
38
|
+
if (st.isDirectory())
|
|
39
|
+
return isBelowProjectFolder(p, roots);
|
|
40
|
+
return st.mtimeMs < now() - windowMs;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=session-watch-ignore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-watch-ignore.js","sourceRoot":"","sources":["../src/session-watch-ignore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAc,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAE1C;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAW,EAAE,KAAwB;IACxE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,GAAG,GAAG,CAAC;YAAE,SAAS;QAC1C,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAwB,EACxB,QAAgB,EAChB,MAAoB,IAAI,CAAC,GAAG;IAE5B,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;QAClB,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;QAC7D,0EAA0E;QAC1E,kDAAkD;QAClD,MAAM,EAAE,GAAG,KAAK,IAAI,QAAQ,CAAC,CAAC,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;QAC3D,IAAI,CAAC,EAAE;YAAE,OAAO,KAAK,CAAC;QACtB,IAAI,EAAE,CAAC,WAAW,EAAE;YAAE,OAAO,oBAAoB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QAC5D,OAAO,EAAE,CAAC,OAAO,GAAG,GAAG,EAAE,GAAG,QAAQ,CAAC;IACvC,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/watch.js
CHANGED
|
@@ -2846,7 +2846,7 @@ var require_transport = __commonJS({
|
|
|
2846
2846
|
"use strict";
|
|
2847
2847
|
var { createRequire: createRequire4 } = __require("module");
|
|
2848
2848
|
var getCallers = require_caller();
|
|
2849
|
-
var { join: join61, isAbsolute: isAbsolute5, sep:
|
|
2849
|
+
var { join: join61, isAbsolute: isAbsolute5, sep: sep6 } = __require("node:path");
|
|
2850
2850
|
var sleep = require_atomic_sleep();
|
|
2851
2851
|
var onExit = require_on_exit_leak_free();
|
|
2852
2852
|
var ThreadStream = require_thread_stream();
|
|
@@ -2954,7 +2954,7 @@ var require_transport = __commonJS({
|
|
|
2954
2954
|
let fixTarget2;
|
|
2955
2955
|
for (const filePath of callers) {
|
|
2956
2956
|
try {
|
|
2957
|
-
const context = filePath === "node:repl" ? process.cwd() +
|
|
2957
|
+
const context = filePath === "node:repl" ? process.cwd() + sep6 : filePath;
|
|
2958
2958
|
fixTarget2 = createRequire4(context).resolve(origin);
|
|
2959
2959
|
break;
|
|
2960
2960
|
} catch (err) {
|
|
@@ -23773,10 +23773,10 @@ var require_resolve_block_map = __commonJS({
|
|
|
23773
23773
|
let offset = bm.offset;
|
|
23774
23774
|
let commentEnd = null;
|
|
23775
23775
|
for (const collItem of bm.items) {
|
|
23776
|
-
const { start, key: key2, sep:
|
|
23776
|
+
const { start, key: key2, sep: sep6, value } = collItem;
|
|
23777
23777
|
const keyProps = resolveProps.resolveProps(start, {
|
|
23778
23778
|
indicator: "explicit-key-ind",
|
|
23779
|
-
next: key2 ??
|
|
23779
|
+
next: key2 ?? sep6?.[0],
|
|
23780
23780
|
offset,
|
|
23781
23781
|
onError,
|
|
23782
23782
|
parentIndent: bm.indent,
|
|
@@ -23790,7 +23790,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
23790
23790
|
else if ("indent" in key2 && key2.indent !== bm.indent)
|
|
23791
23791
|
onError(offset, "BAD_INDENT", startColMsg);
|
|
23792
23792
|
}
|
|
23793
|
-
if (!keyProps.anchor && !keyProps.tag && !
|
|
23793
|
+
if (!keyProps.anchor && !keyProps.tag && !sep6) {
|
|
23794
23794
|
commentEnd = keyProps.end;
|
|
23795
23795
|
if (keyProps.comment) {
|
|
23796
23796
|
if (map.comment)
|
|
@@ -23814,7 +23814,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
23814
23814
|
ctx.atKey = false;
|
|
23815
23815
|
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
|
23816
23816
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
23817
|
-
const valueProps = resolveProps.resolveProps(
|
|
23817
|
+
const valueProps = resolveProps.resolveProps(sep6 ?? [], {
|
|
23818
23818
|
indicator: "map-value-ind",
|
|
23819
23819
|
next: value,
|
|
23820
23820
|
offset: keyNode.range[2],
|
|
@@ -23830,7 +23830,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
23830
23830
|
if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
|
|
23831
23831
|
onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
|
|
23832
23832
|
}
|
|
23833
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset,
|
|
23833
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep6, null, valueProps, onError);
|
|
23834
23834
|
if (ctx.schema.compat)
|
|
23835
23835
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
|
|
23836
23836
|
offset = valueNode.range[2];
|
|
@@ -23921,7 +23921,7 @@ var require_resolve_end = __commonJS({
|
|
|
23921
23921
|
let comment = "";
|
|
23922
23922
|
if (end) {
|
|
23923
23923
|
let hasSpace = false;
|
|
23924
|
-
let
|
|
23924
|
+
let sep6 = "";
|
|
23925
23925
|
for (const token of end) {
|
|
23926
23926
|
const { source, type } = token;
|
|
23927
23927
|
switch (type) {
|
|
@@ -23935,13 +23935,13 @@ var require_resolve_end = __commonJS({
|
|
|
23935
23935
|
if (!comment)
|
|
23936
23936
|
comment = cb;
|
|
23937
23937
|
else
|
|
23938
|
-
comment +=
|
|
23939
|
-
|
|
23938
|
+
comment += sep6 + cb;
|
|
23939
|
+
sep6 = "";
|
|
23940
23940
|
break;
|
|
23941
23941
|
}
|
|
23942
23942
|
case "newline":
|
|
23943
23943
|
if (comment)
|
|
23944
|
-
|
|
23944
|
+
sep6 += source;
|
|
23945
23945
|
hasSpace = true;
|
|
23946
23946
|
break;
|
|
23947
23947
|
default:
|
|
@@ -23984,18 +23984,18 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
23984
23984
|
let offset = fc.offset + fc.start.source.length;
|
|
23985
23985
|
for (let i = 0; i < fc.items.length; ++i) {
|
|
23986
23986
|
const collItem = fc.items[i];
|
|
23987
|
-
const { start, key: key2, sep:
|
|
23987
|
+
const { start, key: key2, sep: sep6, value } = collItem;
|
|
23988
23988
|
const props = resolveProps.resolveProps(start, {
|
|
23989
23989
|
flow: fcName,
|
|
23990
23990
|
indicator: "explicit-key-ind",
|
|
23991
|
-
next: key2 ??
|
|
23991
|
+
next: key2 ?? sep6?.[0],
|
|
23992
23992
|
offset,
|
|
23993
23993
|
onError,
|
|
23994
23994
|
parentIndent: fc.indent,
|
|
23995
23995
|
startOnNewline: false
|
|
23996
23996
|
});
|
|
23997
23997
|
if (!props.found) {
|
|
23998
|
-
if (!props.anchor && !props.tag && !
|
|
23998
|
+
if (!props.anchor && !props.tag && !sep6 && !value) {
|
|
23999
23999
|
if (i === 0 && props.comma)
|
|
24000
24000
|
onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
24001
24001
|
else if (i < fc.items.length - 1)
|
|
@@ -24049,8 +24049,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
24049
24049
|
}
|
|
24050
24050
|
}
|
|
24051
24051
|
}
|
|
24052
|
-
if (!isMap2 && !
|
|
24053
|
-
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end,
|
|
24052
|
+
if (!isMap2 && !sep6 && !props.found) {
|
|
24053
|
+
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep6, null, props, onError);
|
|
24054
24054
|
coll.items.push(valueNode);
|
|
24055
24055
|
offset = valueNode.range[2];
|
|
24056
24056
|
if (isBlock(value))
|
|
@@ -24062,7 +24062,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
24062
24062
|
if (isBlock(key2))
|
|
24063
24063
|
onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
24064
24064
|
ctx.atKey = false;
|
|
24065
|
-
const valueProps = resolveProps.resolveProps(
|
|
24065
|
+
const valueProps = resolveProps.resolveProps(sep6 ?? [], {
|
|
24066
24066
|
flow: fcName,
|
|
24067
24067
|
indicator: "map-value-ind",
|
|
24068
24068
|
next: value,
|
|
@@ -24073,8 +24073,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
24073
24073
|
});
|
|
24074
24074
|
if (valueProps.found) {
|
|
24075
24075
|
if (!isMap2 && !props.found && ctx.options.strict) {
|
|
24076
|
-
if (
|
|
24077
|
-
for (const st of
|
|
24076
|
+
if (sep6)
|
|
24077
|
+
for (const st of sep6) {
|
|
24078
24078
|
if (st === valueProps.found)
|
|
24079
24079
|
break;
|
|
24080
24080
|
if (st.type === "newline") {
|
|
@@ -24091,7 +24091,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
24091
24091
|
else
|
|
24092
24092
|
onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
24093
24093
|
}
|
|
24094
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end,
|
|
24094
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep6, null, valueProps, onError) : null;
|
|
24095
24095
|
if (valueNode) {
|
|
24096
24096
|
if (isBlock(value))
|
|
24097
24097
|
onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
@@ -24271,7 +24271,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
24271
24271
|
chompStart = i + 1;
|
|
24272
24272
|
}
|
|
24273
24273
|
let value = "";
|
|
24274
|
-
let
|
|
24274
|
+
let sep6 = "";
|
|
24275
24275
|
let prevMoreIndented = false;
|
|
24276
24276
|
for (let i = 0; i < contentStart; ++i)
|
|
24277
24277
|
value += lines[i][0].slice(trimIndent) + "\n";
|
|
@@ -24288,24 +24288,24 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
24288
24288
|
indent = "";
|
|
24289
24289
|
}
|
|
24290
24290
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
24291
|
-
value +=
|
|
24292
|
-
|
|
24291
|
+
value += sep6 + indent.slice(trimIndent) + content;
|
|
24292
|
+
sep6 = "\n";
|
|
24293
24293
|
} else if (indent.length > trimIndent || content[0] === " ") {
|
|
24294
|
-
if (
|
|
24295
|
-
|
|
24296
|
-
else if (!prevMoreIndented &&
|
|
24297
|
-
|
|
24298
|
-
value +=
|
|
24299
|
-
|
|
24294
|
+
if (sep6 === " ")
|
|
24295
|
+
sep6 = "\n";
|
|
24296
|
+
else if (!prevMoreIndented && sep6 === "\n")
|
|
24297
|
+
sep6 = "\n\n";
|
|
24298
|
+
value += sep6 + indent.slice(trimIndent) + content;
|
|
24299
|
+
sep6 = "\n";
|
|
24300
24300
|
prevMoreIndented = true;
|
|
24301
24301
|
} else if (content === "") {
|
|
24302
|
-
if (
|
|
24302
|
+
if (sep6 === "\n")
|
|
24303
24303
|
value += "\n";
|
|
24304
24304
|
else
|
|
24305
|
-
|
|
24305
|
+
sep6 = "\n";
|
|
24306
24306
|
} else {
|
|
24307
|
-
value +=
|
|
24308
|
-
|
|
24307
|
+
value += sep6 + content;
|
|
24308
|
+
sep6 = " ";
|
|
24309
24309
|
prevMoreIndented = false;
|
|
24310
24310
|
}
|
|
24311
24311
|
}
|
|
@@ -24488,25 +24488,25 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
24488
24488
|
trimBoth = /^[ \t]+|[ \t]+$/g;
|
|
24489
24489
|
}
|
|
24490
24490
|
let res = match[1].replace(trimEnd, "");
|
|
24491
|
-
let
|
|
24491
|
+
let sep6 = " ";
|
|
24492
24492
|
let pos = line.lastIndex;
|
|
24493
24493
|
while (match = line.exec(source)) {
|
|
24494
24494
|
const lm = match[1].replace(trimBoth, "");
|
|
24495
24495
|
if (lm === "") {
|
|
24496
|
-
if (
|
|
24497
|
-
res +=
|
|
24496
|
+
if (sep6 === "\n")
|
|
24497
|
+
res += sep6;
|
|
24498
24498
|
else
|
|
24499
|
-
|
|
24499
|
+
sep6 = "\n";
|
|
24500
24500
|
} else {
|
|
24501
|
-
res +=
|
|
24502
|
-
|
|
24501
|
+
res += sep6 + lm;
|
|
24502
|
+
sep6 = " ";
|
|
24503
24503
|
}
|
|
24504
24504
|
pos = line.lastIndex;
|
|
24505
24505
|
}
|
|
24506
24506
|
const last = /[ \t]*(.*)/sy;
|
|
24507
24507
|
last.lastIndex = pos;
|
|
24508
24508
|
match = last.exec(source);
|
|
24509
|
-
return res +
|
|
24509
|
+
return res + sep6 + (match?.[1] ?? "");
|
|
24510
24510
|
}
|
|
24511
24511
|
function doubleQuotedValue(source, onError) {
|
|
24512
24512
|
let res = "";
|
|
@@ -25316,14 +25316,14 @@ var require_cst_stringify = __commonJS({
|
|
|
25316
25316
|
}
|
|
25317
25317
|
}
|
|
25318
25318
|
}
|
|
25319
|
-
function stringifyItem({ start, key: key2, sep:
|
|
25319
|
+
function stringifyItem({ start, key: key2, sep: sep6, value }) {
|
|
25320
25320
|
let res = "";
|
|
25321
25321
|
for (const st of start)
|
|
25322
25322
|
res += st.source;
|
|
25323
25323
|
if (key2)
|
|
25324
25324
|
res += stringifyToken(key2);
|
|
25325
|
-
if (
|
|
25326
|
-
for (const st of
|
|
25325
|
+
if (sep6)
|
|
25326
|
+
for (const st of sep6)
|
|
25327
25327
|
res += st.source;
|
|
25328
25328
|
if (value)
|
|
25329
25329
|
res += stringifyToken(value);
|
|
@@ -26490,18 +26490,18 @@ var require_parser = __commonJS({
|
|
|
26490
26490
|
if (this.type === "map-value-ind") {
|
|
26491
26491
|
const prev = getPrevProps(this.peek(2));
|
|
26492
26492
|
const start = getFirstKeyStartProps(prev);
|
|
26493
|
-
let
|
|
26493
|
+
let sep6;
|
|
26494
26494
|
if (scalar.end) {
|
|
26495
|
-
|
|
26496
|
-
|
|
26495
|
+
sep6 = scalar.end;
|
|
26496
|
+
sep6.push(this.sourceToken);
|
|
26497
26497
|
delete scalar.end;
|
|
26498
26498
|
} else
|
|
26499
|
-
|
|
26499
|
+
sep6 = [this.sourceToken];
|
|
26500
26500
|
const map = {
|
|
26501
26501
|
type: "block-map",
|
|
26502
26502
|
offset: scalar.offset,
|
|
26503
26503
|
indent: scalar.indent,
|
|
26504
|
-
items: [{ start, key: scalar, sep:
|
|
26504
|
+
items: [{ start, key: scalar, sep: sep6 }]
|
|
26505
26505
|
};
|
|
26506
26506
|
this.onKeyLine = true;
|
|
26507
26507
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -26654,15 +26654,15 @@ var require_parser = __commonJS({
|
|
|
26654
26654
|
} else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
26655
26655
|
const start2 = getFirstKeyStartProps(it.start);
|
|
26656
26656
|
const key2 = it.key;
|
|
26657
|
-
const
|
|
26658
|
-
|
|
26657
|
+
const sep6 = it.sep;
|
|
26658
|
+
sep6.push(this.sourceToken);
|
|
26659
26659
|
delete it.key;
|
|
26660
26660
|
delete it.sep;
|
|
26661
26661
|
this.stack.push({
|
|
26662
26662
|
type: "block-map",
|
|
26663
26663
|
offset: this.offset,
|
|
26664
26664
|
indent: this.indent,
|
|
26665
|
-
items: [{ start: start2, key: key2, sep:
|
|
26665
|
+
items: [{ start: start2, key: key2, sep: sep6 }]
|
|
26666
26666
|
});
|
|
26667
26667
|
} else if (start.length > 0) {
|
|
26668
26668
|
it.sep = it.sep.concat(start, this.sourceToken);
|
|
@@ -26856,13 +26856,13 @@ var require_parser = __commonJS({
|
|
|
26856
26856
|
const prev = getPrevProps(parent);
|
|
26857
26857
|
const start = getFirstKeyStartProps(prev);
|
|
26858
26858
|
fixFlowSeqItems(fc);
|
|
26859
|
-
const
|
|
26860
|
-
|
|
26859
|
+
const sep6 = fc.end.splice(1, fc.end.length);
|
|
26860
|
+
sep6.push(this.sourceToken);
|
|
26861
26861
|
const map = {
|
|
26862
26862
|
type: "block-map",
|
|
26863
26863
|
offset: fc.offset,
|
|
26864
26864
|
indent: fc.indent,
|
|
26865
|
-
items: [{ start, key: fc, sep:
|
|
26865
|
+
items: [{ start, key: fc, sep: sep6 }]
|
|
26866
26866
|
};
|
|
26867
26867
|
this.onKeyLine = true;
|
|
26868
26868
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -33519,6 +33519,31 @@ var init_daemon_log = __esm({
|
|
|
33519
33519
|
}
|
|
33520
33520
|
});
|
|
33521
33521
|
|
|
33522
|
+
// src/session-watch-ignore.ts
|
|
33523
|
+
import { statSync as statSync47 } from "node:fs";
|
|
33524
|
+
import { basename as basename26, sep as sep4 } from "node:path";
|
|
33525
|
+
function isBelowProjectFolder(dir, roots) {
|
|
33526
|
+
for (const root of roots) {
|
|
33527
|
+
if (!dir.startsWith(root + sep4)) continue;
|
|
33528
|
+
return dir.slice(root.length + 1).split(sep4).length >= 2;
|
|
33529
|
+
}
|
|
33530
|
+
return false;
|
|
33531
|
+
}
|
|
33532
|
+
function sessionWatchIgnored(roots, windowMs, now = Date.now) {
|
|
33533
|
+
return (p, stats) => {
|
|
33534
|
+
if (/agent-/.test(p) || /^\./.test(basename26(p))) return true;
|
|
33535
|
+
const st = stats ?? statSync47(p, { throwIfNoEntry: false });
|
|
33536
|
+
if (!st) return false;
|
|
33537
|
+
if (st.isDirectory()) return isBelowProjectFolder(p, roots);
|
|
33538
|
+
return st.mtimeMs < now() - windowMs;
|
|
33539
|
+
};
|
|
33540
|
+
}
|
|
33541
|
+
var init_session_watch_ignore = __esm({
|
|
33542
|
+
"src/session-watch-ignore.ts"() {
|
|
33543
|
+
"use strict";
|
|
33544
|
+
}
|
|
33545
|
+
});
|
|
33546
|
+
|
|
33522
33547
|
// src/self-restart.ts
|
|
33523
33548
|
import { spawn as spawn2 } from "child_process";
|
|
33524
33549
|
import { readFileSync as readFileSync48 } from "fs";
|
|
@@ -33600,10 +33625,10 @@ var init_self_restart = __esm({
|
|
|
33600
33625
|
});
|
|
33601
33626
|
|
|
33602
33627
|
// src/log-rotate.ts
|
|
33603
|
-
import { statSync as
|
|
33628
|
+
import { statSync as statSync48, copyFileSync as copyFileSync3, truncateSync } from "fs";
|
|
33604
33629
|
function rotateLogIfLarge(logPath, maxBytes = LOG_MAX_BYTES) {
|
|
33605
33630
|
try {
|
|
33606
|
-
const size =
|
|
33631
|
+
const size = statSync48(logPath).size;
|
|
33607
33632
|
if (size < maxBytes) return { rotated: false, sizeBefore: 0 };
|
|
33608
33633
|
copyFileSync3(logPath, `${logPath}.1`);
|
|
33609
33634
|
truncateSync(logPath, 0);
|
|
@@ -33674,7 +33699,7 @@ __export(shadow_prune_exports, {
|
|
|
33674
33699
|
DEFAULT_MAX_TOTAL_BYTES: () => DEFAULT_MAX_TOTAL_BYTES,
|
|
33675
33700
|
pruneShadow: () => pruneShadow
|
|
33676
33701
|
});
|
|
33677
|
-
import { readdirSync as readdirSync34, statSync as
|
|
33702
|
+
import { readdirSync as readdirSync34, statSync as statSync49, unlinkSync as unlinkSync3 } from "fs";
|
|
33678
33703
|
import { join as join56 } from "path";
|
|
33679
33704
|
function listShadows(isFullyAcked) {
|
|
33680
33705
|
const out = [];
|
|
@@ -33699,7 +33724,7 @@ function listShadows(isFullyAcked) {
|
|
|
33699
33724
|
const path = join56(dir, name);
|
|
33700
33725
|
let st;
|
|
33701
33726
|
try {
|
|
33702
|
-
st =
|
|
33727
|
+
st = statSync49(path);
|
|
33703
33728
|
} catch {
|
|
33704
33729
|
continue;
|
|
33705
33730
|
}
|
|
@@ -33814,7 +33839,7 @@ var init_code_intel = __esm({
|
|
|
33814
33839
|
});
|
|
33815
33840
|
|
|
33816
33841
|
// ../engine/dist/core/companions.js
|
|
33817
|
-
import { existsSync as existsSync50, mkdirSync as mkdirSync17, statSync as
|
|
33842
|
+
import { existsSync as existsSync50, mkdirSync as mkdirSync17, statSync as statSync50, chmodSync as chmodSync5, unlinkSync as unlinkSync4, renameSync as renameSync5, createWriteStream as createWriteStream2, readFileSync as readFileSync49, writeFileSync as writeFileSync17 } from "node:fs";
|
|
33818
33843
|
import { homedir as homedir20 } from "node:os";
|
|
33819
33844
|
import { join as join57 } from "node:path";
|
|
33820
33845
|
import { execSync as execSync3 } from "node:child_process";
|
|
@@ -33865,7 +33890,7 @@ function checkCodeindexStatus() {
|
|
|
33865
33890
|
status.installed = true;
|
|
33866
33891
|
status.path = foundPath;
|
|
33867
33892
|
try {
|
|
33868
|
-
status.size =
|
|
33893
|
+
status.size = statSync50(foundPath).size;
|
|
33869
33894
|
} catch {
|
|
33870
33895
|
}
|
|
33871
33896
|
try {
|
|
@@ -34078,7 +34103,7 @@ __export(collector_exports, {
|
|
|
34078
34103
|
import { spawn as spawn3 } from "node:child_process";
|
|
34079
34104
|
import { execSync as execSync4 } from "node:child_process";
|
|
34080
34105
|
import { readFileSync as readFileSync50 } from "node:fs";
|
|
34081
|
-
import { join as join58, basename as
|
|
34106
|
+
import { join as join58, basename as basename27 } from "node:path";
|
|
34082
34107
|
async function resolveCodeindexBin(autoInstall = true) {
|
|
34083
34108
|
let st = checkCodeindexStatus();
|
|
34084
34109
|
if (!st.installed && autoInstall)
|
|
@@ -34459,7 +34484,7 @@ async function collectCode(opts) {
|
|
|
34459
34484
|
file,
|
|
34460
34485
|
line: null,
|
|
34461
34486
|
rule: "god_module",
|
|
34462
|
-
title: `God module ${
|
|
34487
|
+
title: `God module ${basename27(file)}`,
|
|
34463
34488
|
snippet: `fan-in ${m.fan_in}, fan-out ${m.fan_out}`,
|
|
34464
34489
|
why: FINDING_WHY.coupling,
|
|
34465
34490
|
agentPrompt: couplingPrompt(file, m.fan_in ?? 0, m.fan_out ?? 0, Math.round((m.instability ?? 0) * 100) / 100)
|
|
@@ -34627,7 +34652,7 @@ async function collectCode(opts) {
|
|
|
34627
34652
|
file,
|
|
34628
34653
|
line: v.line ?? null,
|
|
34629
34654
|
rule: v.violation_type ?? "manifest_violation",
|
|
34630
|
-
title: `${v.violation_type} in ${
|
|
34655
|
+
title: `${v.violation_type} in ${basename27(file)}`,
|
|
34631
34656
|
snippet: v.description ?? "",
|
|
34632
34657
|
why: FINDING_WHY.manifest,
|
|
34633
34658
|
agentPrompt: manifestPrompt(v.violation_type ?? "", file, v.line ?? null, v.description ?? "")
|
|
@@ -35015,6 +35040,7 @@ var service_installer_exports = {};
|
|
|
35015
35040
|
__export(service_installer_exports, {
|
|
35016
35041
|
ServiceInstallError: () => ServiceInstallError,
|
|
35017
35042
|
WATCH_HEAP_MB: () => WATCH_HEAP_MB,
|
|
35043
|
+
WATCH_SEMI_SPACE_MB: () => WATCH_SEMI_SPACE_MB,
|
|
35018
35044
|
installService: () => installService,
|
|
35019
35045
|
isServiceRunning: () => isServiceRunning,
|
|
35020
35046
|
platformName: () => platformName,
|
|
@@ -35126,7 +35152,7 @@ function renderSystemdUnit(watchJs, node, logFile) {
|
|
|
35126
35152
|
// base64 payloads); V8's default old-space on a big-RAM box is ~4GB and
|
|
35127
35153
|
// GC only gets aggressive near the ceiling — observed as a multi-GB RSS
|
|
35128
35154
|
// sawtooth. The ceiling below is measured, not guessed: see WATCH_HEAP_MB.
|
|
35129
|
-
`ExecStart=${node} --max-old-space-size=${WATCH_HEAP_MB} --expose-gc ${watchJs}`,
|
|
35155
|
+
`ExecStart=${node} --max-old-space-size=${WATCH_HEAP_MB} --max-semi-space-size=${WATCH_SEMI_SPACE_MB} --expose-gc ${watchJs}`,
|
|
35130
35156
|
// ALWAYS: the collector never ends its own work, so any exit systemd did
|
|
35131
35157
|
// not ask for is a fault. Under on-failure a clean exit left it dead: on
|
|
35132
35158
|
// 2026-09-16 the unit went "inactive (dead) … status=0/SUCCESS" and stayed
|
|
@@ -35206,7 +35232,7 @@ function renderLaunchdPlist(watchJs, node, logFile, label = "com.chat-recall.wat
|
|
|
35206
35232
|
'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">',
|
|
35207
35233
|
'<plist version="1.0"><dict>',
|
|
35208
35234
|
` <key>Label</key><string>${label}</string>`,
|
|
35209
|
-
` <key>ProgramArguments</key><array><string>${node}</string><string>--max-old-space-size=${WATCH_HEAP_MB}</string><string>--expose-gc</string><string>${watchJs}</string></array>`,
|
|
35235
|
+
` <key>ProgramArguments</key><array><string>${node}</string><string>--max-old-space-size=${WATCH_HEAP_MB}</string><string>--max-semi-space-size=${WATCH_SEMI_SPACE_MB}</string><string>--expose-gc</string><string>${watchJs}</string></array>`,
|
|
35210
35236
|
" <key>RunAtLoad</key><true/>",
|
|
35211
35237
|
" <key>KeepAlive</key><true/>",
|
|
35212
35238
|
` <key>StandardOutPath</key><string>${logFile}</string>`,
|
|
@@ -35217,7 +35243,7 @@ function renderLaunchdPlist(watchJs, node, logFile, label = "com.chat-recall.wat
|
|
|
35217
35243
|
}
|
|
35218
35244
|
function installWindowsTask(watchJs, node, logFile) {
|
|
35219
35245
|
const taskName = "chat-recall-watch";
|
|
35220
|
-
const tr = `cmd /c \\"\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} \\"${watchJs}\\" >> \\"${logFile}\\" 2>&1\\"`;
|
|
35246
|
+
const tr = `cmd /c \\"\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} --max-semi-space-size=${WATCH_SEMI_SPACE_MB} \\"${watchJs}\\" >> \\"${logFile}\\" 2>&1\\"`;
|
|
35221
35247
|
try {
|
|
35222
35248
|
execSync5(`schtasks /create /tn "${taskName}" /tr "${tr}" /sc onlogon /rl LIMITED /f`, { stdio: "inherit" });
|
|
35223
35249
|
try {
|
|
@@ -35230,7 +35256,7 @@ function installWindowsTask(watchJs, node, logFile) {
|
|
|
35230
35256
|
return { definitionPath: null, logFile };
|
|
35231
35257
|
}
|
|
35232
35258
|
function renderWindowsTaskCommand(watchJs, node, taskName = "chat-recall-watch", logFile) {
|
|
35233
|
-
const tr = logFile ? `cmd /c \\"\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} \\"${watchJs}\\" >> \\"${logFile}\\" 2>&1\\"` : `\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} \\"${watchJs}\\"`;
|
|
35259
|
+
const tr = logFile ? `cmd /c \\"\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} --max-semi-space-size=${WATCH_SEMI_SPACE_MB} \\"${watchJs}\\" >> \\"${logFile}\\" 2>&1\\"` : `\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} --max-semi-space-size=${WATCH_SEMI_SPACE_MB} \\"${watchJs}\\"`;
|
|
35234
35260
|
return `schtasks /create /tn "${taskName}" /tr "${tr}" /sc onlogon /rl LIMITED /f`;
|
|
35235
35261
|
}
|
|
35236
35262
|
function uninstallService() {
|
|
@@ -35281,11 +35307,12 @@ function platformName() {
|
|
|
35281
35307
|
if (process.platform === "win32") return "Scheduled Task";
|
|
35282
35308
|
return process.platform;
|
|
35283
35309
|
}
|
|
35284
|
-
var WATCH_HEAP_MB, ServiceInstallError;
|
|
35310
|
+
var WATCH_HEAP_MB, WATCH_SEMI_SPACE_MB, ServiceInstallError;
|
|
35285
35311
|
var init_service_installer = __esm({
|
|
35286
35312
|
"src/service-installer.ts"() {
|
|
35287
35313
|
"use strict";
|
|
35288
35314
|
WATCH_HEAP_MB = 640;
|
|
35315
|
+
WATCH_SEMI_SPACE_MB = 2;
|
|
35289
35316
|
ServiceInstallError = class extends Error {
|
|
35290
35317
|
hint;
|
|
35291
35318
|
constructor(message, hint) {
|
|
@@ -35303,10 +35330,10 @@ __export(indexer_exports, {
|
|
|
35303
35330
|
noteSyncOutcome: () => noteSyncOutcome
|
|
35304
35331
|
});
|
|
35305
35332
|
import chokidar from "chokidar";
|
|
35306
|
-
import { dirname as dirname25,
|
|
35333
|
+
import { dirname as dirname25, join as join60, resolve as resolve2, sep as sep5 } from "path";
|
|
35307
35334
|
import { homedir as homedir22 } from "os";
|
|
35308
35335
|
import { spawn as spawn4 } from "node:child_process";
|
|
35309
|
-
import { existsSync as existsSync52, readFileSync as readFileSync52
|
|
35336
|
+
import { existsSync as existsSync52, readFileSync as readFileSync52 } from "fs";
|
|
35310
35337
|
async function shipToServer(trigger) {
|
|
35311
35338
|
if (syncInFlight) return;
|
|
35312
35339
|
syncInFlight = true;
|
|
@@ -35530,13 +35557,13 @@ function discoverWorkspaces() {
|
|
|
35530
35557
|
}
|
|
35531
35558
|
}).filter(([p]) => isCodeWorkspace(p)).sort((a, b) => b[1] - a[1]);
|
|
35532
35559
|
const roots = candidates2.map(([p]) => p);
|
|
35533
|
-
const notAnAncestor = ([p]) => !roots.some((other) => other !== p && other.startsWith(p.endsWith(
|
|
35560
|
+
const notAnAncestor = ([p]) => !roots.some((other) => other !== p && other.startsWith(p.endsWith(sep5) ? p : p + sep5));
|
|
35534
35561
|
return candidates2.filter(notAnAncestor).slice(0, CODE_INDEX_MAX).map(([p]) => p);
|
|
35535
35562
|
}
|
|
35536
35563
|
function isCodeWorkspace(p) {
|
|
35537
35564
|
try {
|
|
35538
35565
|
const resolved = resolve2(p);
|
|
35539
|
-
if (resolved ===
|
|
35566
|
+
if (resolved === sep5 || resolved === homedir22() || dirname25(resolved) === resolved) return false;
|
|
35540
35567
|
} catch {
|
|
35541
35568
|
return false;
|
|
35542
35569
|
}
|
|
@@ -35711,6 +35738,7 @@ var init_indexer = __esm({
|
|
|
35711
35738
|
init_code_index_cursor();
|
|
35712
35739
|
init_tick_queue();
|
|
35713
35740
|
init_daemon_log();
|
|
35741
|
+
init_session_watch_ignore();
|
|
35714
35742
|
init_telemetry();
|
|
35715
35743
|
init_self_restart();
|
|
35716
35744
|
init_log_rotate();
|
|
@@ -35748,12 +35776,7 @@ var init_indexer = __esm({
|
|
|
35748
35776
|
WATCH_WINDOW_MS = Math.max(1, Number(process.env.CHAT_RECALL_WATCH_WINDOW_DAYS) || 14) * 24 * 60 * 60 * 1e3;
|
|
35749
35777
|
CLAUDE_SESSION_ROOTS = claudeProjectDirs();
|
|
35750
35778
|
sessionWatcher = watchWithFallback("sessions", CLAUDE_SESSION_ROOTS.map((root) => `${root}/**/*.jsonl`), {
|
|
35751
|
-
ignored: (
|
|
35752
|
-
if (/agent-/.test(p) || /^\./.test(basename27(p))) return true;
|
|
35753
|
-
const st = stats ?? statSync50(p, { throwIfNoEntry: false });
|
|
35754
|
-
if (!st || st.isDirectory()) return false;
|
|
35755
|
-
return st.mtimeMs < Date.now() - WATCH_WINDOW_MS;
|
|
35756
|
-
},
|
|
35779
|
+
ignored: sessionWatchIgnored(CLAUDE_SESSION_ROOTS, WATCH_WINDOW_MS),
|
|
35757
35780
|
interval: 5e3
|
|
35758
35781
|
});
|
|
35759
35782
|
plansWatcher = chokidar.watch(`${PLANS_DIR}/*.md`, {
|