hacklab 0.10.5 → 0.11.0
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 +13 -11
- package/dist/commands/daemon.d.ts +6 -2
- package/dist/commands/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +12 -8
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/sync.d.ts +1 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +127 -5
- package/dist/commands/sync.js.map +1 -1
- package/dist/daily-sync.d.ts +20 -3
- package/dist/daily-sync.d.ts.map +1 -1
- package/dist/daily-sync.js +154 -44
- package/dist/daily-sync.js.map +1 -1
- package/dist/scanners/incremental.d.ts +144 -0
- package/dist/scanners/incremental.d.ts.map +1 -0
- package/dist/scanners/incremental.js +519 -0
- package/dist/scanners/incremental.js.map +1 -0
- package/dist/scanners/index.d.ts +44 -0
- package/dist/scanners/index.d.ts.map +1 -1
- package/dist/scanners/index.js +160 -126
- package/dist/scanners/index.js.map +1 -1
- package/dist/sync.d.ts +11 -0
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +27 -5
- package/dist/sync.js.map +1 -1
- package/package.json +1 -1
package/dist/daily-sync.js
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import { realpathSync } from 'node:fs';
|
|
3
|
-
import { appendFile, mkdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { appendFile, mkdir, readFile, rm, stat, writeFile, } from 'node:fs/promises';
|
|
4
4
|
import { homedir, platform } from 'node:os';
|
|
5
5
|
import { dirname, join } from 'node:path';
|
|
6
6
|
import { getSessionPath } from './session.js';
|
|
7
|
-
// Sets up (and tears down)
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
// systemd
|
|
7
|
+
// Sets up (and tears down) the two OS-native background jobs: a `hacklab sync
|
|
8
|
+
// --tick` every minute (the incremental one — reads only what the AI tools
|
|
9
|
+
// appended since the last run) and the full `hacklab sync --quiet` once a day
|
|
10
|
+
// (the repair pass, which also re-bases the tick's state). launchd on macOS, a
|
|
11
|
+
// systemd user timer on Linux, Task Scheduler on Windows, and printed
|
|
12
|
+
// instructions when none of those fit. The scheduled command is resolved to an
|
|
13
|
+
// absolute `node <entry>` pair so a scheduler running with a bare PATH
|
|
14
|
+
// (cron/launchd/systemd often have almost none) can launch it without a
|
|
15
|
+
// `hacklab` shim.
|
|
12
16
|
const LAUNCHD_LABEL = 'so.hacklab.sync';
|
|
17
|
+
const LAUNCHD_TICK_LABEL = 'so.hacklab.tick';
|
|
13
18
|
const SYSTEMD_UNIT = 'hacklab-sync';
|
|
19
|
+
const SYSTEMD_TICK_UNIT = 'hacklab-tick';
|
|
14
20
|
const SCHTASKS_TASK = 'hacklab-sync';
|
|
21
|
+
const SCHTASKS_TICK_TASK = 'hacklab-tick';
|
|
15
22
|
/** Run a command without ever rejecting: resolves the exit code (127 when the
|
|
16
23
|
* binary can't even be spawned, e.g. `systemctl` absent). */
|
|
17
24
|
function run(cmd, args, opts = {}) {
|
|
@@ -29,6 +36,25 @@ export function syncLogPath() {
|
|
|
29
36
|
function pausedMarkerPath() {
|
|
30
37
|
return join(dirname(getSessionPath()), 'sync-paused');
|
|
31
38
|
}
|
|
39
|
+
// The tick runs 1440 times a day, so the log has to be bounded even if every
|
|
40
|
+
// one of those runs has something to say.
|
|
41
|
+
export const SYNC_LOG_MAX_BYTES = 1_000_000;
|
|
42
|
+
export const SYNC_LOG_KEEP_LINES = 200;
|
|
43
|
+
/** Cut an oversized sync.log down to its last few hundred lines. Best-effort,
|
|
44
|
+
* and a no-op while the log is small — which is the normal case. */
|
|
45
|
+
export async function trimSyncLog(maxBytes = SYNC_LOG_MAX_BYTES, keepLines = SYNC_LOG_KEEP_LINES) {
|
|
46
|
+
try {
|
|
47
|
+
const path = syncLogPath();
|
|
48
|
+
if ((await stat(path)).size <= maxBytes)
|
|
49
|
+
return;
|
|
50
|
+
const lines = (await readFile(path, 'utf8')).split('\n');
|
|
51
|
+
const kept = lines.slice(-keepLines).join('\n');
|
|
52
|
+
await writeFile(path, kept.endsWith('\n') ? kept : `${kept}\n`, 'utf8');
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// no log yet, or we can't rewrite it — either way, nothing to do
|
|
56
|
+
}
|
|
57
|
+
}
|
|
32
58
|
/** Append a timestamped line to the background-sync log (best-effort). */
|
|
33
59
|
export async function appendSyncLog(line) {
|
|
34
60
|
try {
|
|
@@ -86,8 +112,9 @@ function xmlEscape(s) {
|
|
|
86
112
|
return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
87
113
|
}
|
|
88
114
|
const pad2 = (n) => String(n).padStart(2, '0');
|
|
89
|
-
|
|
90
|
-
|
|
115
|
+
/** The plist skeleton both jobs share — same command shape, different schedule. */
|
|
116
|
+
function launchdDoc(label, cmd, mode, schedule, logPath) {
|
|
117
|
+
const args = [cmd.node, cmd.script, 'sync', mode]
|
|
91
118
|
.map((a) => ` <string>${xmlEscape(a)}</string>`)
|
|
92
119
|
.join('\n');
|
|
93
120
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -95,18 +122,12 @@ export function launchdPlist(cmd, time, logPath) {
|
|
|
95
122
|
<plist version="1.0">
|
|
96
123
|
<dict>
|
|
97
124
|
<key>Label</key>
|
|
98
|
-
<string>${
|
|
125
|
+
<string>${label}</string>
|
|
99
126
|
<key>ProgramArguments</key>
|
|
100
127
|
<array>
|
|
101
128
|
${args}
|
|
102
129
|
</array>
|
|
103
|
-
|
|
104
|
-
<dict>
|
|
105
|
-
<key>Hour</key>
|
|
106
|
-
<integer>${time.hour}</integer>
|
|
107
|
-
<key>Minute</key>
|
|
108
|
-
<integer>${time.minute}</integer>
|
|
109
|
-
</dict>
|
|
130
|
+
${schedule}
|
|
110
131
|
<key>StandardOutPath</key>
|
|
111
132
|
<string>${xmlEscape(logPath)}</string>
|
|
112
133
|
<key>StandardErrorPath</key>
|
|
@@ -117,6 +138,21 @@ ${args}
|
|
|
117
138
|
</plist>
|
|
118
139
|
`;
|
|
119
140
|
}
|
|
141
|
+
export function launchdPlist(cmd, time, logPath) {
|
|
142
|
+
return launchdDoc(LAUNCHD_LABEL, cmd, '--quiet', ` <key>StartCalendarInterval</key>
|
|
143
|
+
<dict>
|
|
144
|
+
<key>Hour</key>
|
|
145
|
+
<integer>${time.hour}</integer>
|
|
146
|
+
<key>Minute</key>
|
|
147
|
+
<integer>${time.minute}</integer>
|
|
148
|
+
</dict>`, logPath);
|
|
149
|
+
}
|
|
150
|
+
/** The minutely tick. StartInterval (not a calendar interval) so launchd just
|
|
151
|
+
* re-runs it every 60s; a tick with nothing to report exits without a request. */
|
|
152
|
+
export function launchdTickPlist(cmd, logPath) {
|
|
153
|
+
return launchdDoc(LAUNCHD_TICK_LABEL, cmd, '--tick', ` <key>StartInterval</key>
|
|
154
|
+
<integer>60</integer>`, logPath);
|
|
155
|
+
}
|
|
120
156
|
export function systemdService(cmd) {
|
|
121
157
|
// Quote node + script so paths with spaces survive systemd's parser.
|
|
122
158
|
return `[Unit]
|
|
@@ -138,6 +174,32 @@ OnCalendar=daily
|
|
|
138
174
|
Persistent=true
|
|
139
175
|
RandomizedDelaySec=3600
|
|
140
176
|
|
|
177
|
+
[Install]
|
|
178
|
+
WantedBy=timers.target
|
|
179
|
+
`;
|
|
180
|
+
}
|
|
181
|
+
export function systemdTickService(cmd) {
|
|
182
|
+
return `[Unit]
|
|
183
|
+
Description=hacklab token tick
|
|
184
|
+
|
|
185
|
+
[Service]
|
|
186
|
+
Type=oneshot
|
|
187
|
+
ExecStart="${cmd.node}" "${cmd.script}" sync --tick
|
|
188
|
+
`;
|
|
189
|
+
}
|
|
190
|
+
export function systemdTickTimer() {
|
|
191
|
+
// OnUnitActiveSec re-arms a minute after each run finishes (so a slow tick
|
|
192
|
+
// can't stack up), OnBootSec gives the desktop a moment to settle first, and
|
|
193
|
+
// AccuracySec lets systemd batch the wakeup with others — a minutely timer is
|
|
194
|
+
// otherwise a needless drain on a laptop.
|
|
195
|
+
return `[Unit]
|
|
196
|
+
Description=hacklab token tick
|
|
197
|
+
|
|
198
|
+
[Timer]
|
|
199
|
+
OnBootSec=2min
|
|
200
|
+
OnUnitActiveSec=1min
|
|
201
|
+
AccuracySec=30s
|
|
202
|
+
|
|
141
203
|
[Install]
|
|
142
204
|
WantedBy=timers.target
|
|
143
205
|
`;
|
|
@@ -147,6 +209,11 @@ WantedBy=timers.target
|
|
|
147
209
|
export function syncWrapperPath() {
|
|
148
210
|
return join(dirname(getSessionPath()), 'hacklab-sync.cmd');
|
|
149
211
|
}
|
|
212
|
+
/** The tick's own wrapper — same pattern, its own file so the two tasks can be
|
|
213
|
+
* created and deleted independently. */
|
|
214
|
+
export function tickWrapperPath() {
|
|
215
|
+
return join(dirname(getSessionPath()), 'hacklab-tick.cmd');
|
|
216
|
+
}
|
|
150
217
|
/** The batch wrapper Task Scheduler runs. schtasks' `/TR` chokes on the nested
|
|
151
218
|
* quotes a full `"node" "script" …` command needs, so we point the task at this
|
|
152
219
|
* one-line .cmd instead and do the quoting here, where plain-batch rules apply.
|
|
@@ -155,6 +222,10 @@ export function syncWrapperPath() {
|
|
|
155
222
|
export function schtasksWrapper(cmd, logPath) {
|
|
156
223
|
return `@echo off\r\n"${cmd.node}" "${cmd.script}" sync --quiet >> "${logPath}" 2>&1\r\n`;
|
|
157
224
|
}
|
|
225
|
+
/** Same wrapper for the minutely tick, logging to the same sync.log. */
|
|
226
|
+
export function schtasksTickWrapper(cmd, logPath) {
|
|
227
|
+
return `@echo off\r\n"${cmd.node}" "${cmd.script}" sync --tick >> "${logPath}" 2>&1\r\n`;
|
|
228
|
+
}
|
|
158
229
|
/** Args for `schtasks /Create`. The `/TR` value is a single pre-quoted path;
|
|
159
230
|
* spawn must run with windowsVerbatimArguments so Node doesn't re-escape it. */
|
|
160
231
|
export function schtasksCreateArgs(wrapperPath, time) {
|
|
@@ -171,35 +242,61 @@ export function schtasksCreateArgs(wrapperPath, time) {
|
|
|
171
242
|
'/F',
|
|
172
243
|
];
|
|
173
244
|
}
|
|
245
|
+
/** Args for `schtasks /Create` for the tick: every minute, forever. */
|
|
246
|
+
export function schtasksTickCreateArgs(wrapperPath) {
|
|
247
|
+
return [
|
|
248
|
+
'/Create',
|
|
249
|
+
'/SC',
|
|
250
|
+
'MINUTE',
|
|
251
|
+
'/MO',
|
|
252
|
+
'1',
|
|
253
|
+
'/TN',
|
|
254
|
+
SCHTASKS_TICK_TASK,
|
|
255
|
+
'/TR',
|
|
256
|
+
`"${wrapperPath}"`,
|
|
257
|
+
'/F',
|
|
258
|
+
];
|
|
259
|
+
}
|
|
174
260
|
// Generic fallback text, reused for both "Linux without a systemd user manager"
|
|
175
261
|
// and "OS we don't auto-schedule on" — so it must not name a specific mechanism.
|
|
176
262
|
export function manualInstructions(cmd) {
|
|
177
263
|
return [
|
|
178
|
-
"Couldn't set up
|
|
179
|
-
'To run it yourself, schedule
|
|
180
|
-
"
|
|
264
|
+
"Couldn't set up the automatic background sync on this system.",
|
|
265
|
+
'To run it yourself, schedule these two commands with cron, a systemd timer,',
|
|
266
|
+
"or your init system's scheduler — the tick every minute, the full sync once",
|
|
267
|
+
'a day:',
|
|
268
|
+
` "${cmd.node}" "${cmd.script}" sync --tick`,
|
|
181
269
|
` "${cmd.node}" "${cmd.script}" sync --quiet`,
|
|
182
270
|
].join('\n');
|
|
183
271
|
}
|
|
272
|
+
function launchAgentPath(label) {
|
|
273
|
+
return join(homedir(), 'Library', 'LaunchAgents', `${label}.plist`);
|
|
274
|
+
}
|
|
275
|
+
/** Write a plist and (re)load it. Unload first so a re-run replaces the agent
|
|
276
|
+
* rather than stacking a second copy. */
|
|
277
|
+
async function loadAgent(path, contents) {
|
|
278
|
+
await mkdir(dirname(path), { recursive: true });
|
|
279
|
+
await writeFile(path, contents, 'utf8');
|
|
280
|
+
await run('launchctl', ['unload', path]);
|
|
281
|
+
return run('launchctl', ['load', '-w', path]);
|
|
282
|
+
}
|
|
184
283
|
async function installLaunchd(cmd, logPath) {
|
|
185
|
-
const plistPath =
|
|
284
|
+
const plistPath = launchAgentPath(LAUNCHD_LABEL);
|
|
186
285
|
// Randomize the time so installs don't all hit the API at the same instant.
|
|
187
286
|
const time = {
|
|
188
287
|
hour: Math.floor(Math.random() * 24),
|
|
189
288
|
minute: Math.floor(Math.random() * 60),
|
|
190
289
|
};
|
|
191
|
-
await
|
|
192
|
-
await
|
|
193
|
-
//
|
|
194
|
-
//
|
|
195
|
-
//
|
|
196
|
-
await run('launchctl', ['unload', plistPath]);
|
|
197
|
-
const loaded = await run('launchctl', ['load', '-w', plistPath]);
|
|
290
|
+
const loaded = await loadAgent(plistPath, launchdPlist(cmd, time, logPath));
|
|
291
|
+
await loadAgent(launchAgentPath(LAUNCHD_TICK_LABEL), launchdTickPlist(cmd, logPath));
|
|
292
|
+
// A plist in ~/Library/LaunchAgents also loads at next login, so even if
|
|
293
|
+
// `load` fails now the agent activates then — report that honestly rather
|
|
294
|
+
// than claiming it's already running.
|
|
198
295
|
return {
|
|
199
296
|
ok: true,
|
|
200
297
|
mechanism: 'launchd',
|
|
201
298
|
detail: loaded === 0
|
|
202
|
-
? `daily around ${pad2(time.hour)}:${pad2(time.minute)} (${plistPath})`
|
|
299
|
+
? `tick every minute, full sync daily around ${pad2(time.hour)}:${pad2(time.minute)} (${plistPath})`
|
|
203
300
|
: `installed (${plistPath}) — activates at next login`,
|
|
204
301
|
};
|
|
205
302
|
}
|
|
@@ -219,18 +316,27 @@ async function installSystemd(cmd) {
|
|
|
219
316
|
await mkdir(dir, { recursive: true });
|
|
220
317
|
await writeFile(join(dir, `${SYSTEMD_UNIT}.service`), systemdService(cmd), 'utf8');
|
|
221
318
|
await writeFile(join(dir, `${SYSTEMD_UNIT}.timer`), systemdTimer(), 'utf8');
|
|
319
|
+
await writeFile(join(dir, `${SYSTEMD_TICK_UNIT}.service`), systemdTickService(cmd), 'utf8');
|
|
320
|
+
await writeFile(join(dir, `${SYSTEMD_TICK_UNIT}.timer`), systemdTickTimer(), 'utf8');
|
|
222
321
|
await run('systemctl', ['--user', 'daemon-reload']);
|
|
223
322
|
await run('systemctl', ['--user', 'enable', '--now', `${SYSTEMD_UNIT}.timer`]);
|
|
323
|
+
await run('systemctl', [
|
|
324
|
+
'--user',
|
|
325
|
+
'enable',
|
|
326
|
+
'--now',
|
|
327
|
+
`${SYSTEMD_TICK_UNIT}.timer`,
|
|
328
|
+
]);
|
|
224
329
|
return {
|
|
225
330
|
ok: true,
|
|
226
331
|
mechanism: 'systemd',
|
|
227
|
-
detail: `systemd user
|
|
332
|
+
detail: `systemd user timers (${SYSTEMD_TICK_UNIT}.timer every minute, ${SYSTEMD_UNIT}.timer daily); logs in journalctl --user -u ${SYSTEMD_UNIT}. To keep them running while logged out: loginctl enable-linger`,
|
|
228
333
|
};
|
|
229
334
|
}
|
|
230
335
|
async function installSchtasks(cmd) {
|
|
231
336
|
const wrapperPath = syncWrapperPath();
|
|
232
337
|
await mkdir(dirname(wrapperPath), { recursive: true });
|
|
233
338
|
await writeFile(wrapperPath, schtasksWrapper(cmd, syncLogPath()), 'utf8');
|
|
339
|
+
await writeFile(tickWrapperPath(), schtasksTickWrapper(cmd, syncLogPath()), 'utf8');
|
|
234
340
|
// Randomize the time so installs don't all hit the API at the same instant.
|
|
235
341
|
const time = {
|
|
236
342
|
hour: Math.floor(Math.random() * 24),
|
|
@@ -249,13 +355,16 @@ async function installSchtasks(cmd) {
|
|
|
249
355
|
instructions: manualInstructions(cmd),
|
|
250
356
|
};
|
|
251
357
|
}
|
|
358
|
+
// The daily job is the one that must exist; a refused minutely task (some
|
|
359
|
+
// policies cap task frequency) costs freshness, not the streak.
|
|
360
|
+
const tick = await run('schtasks', schtasksTickCreateArgs(tickWrapperPath()), { windowsVerbatimArguments: true });
|
|
252
361
|
return {
|
|
253
362
|
ok: true,
|
|
254
363
|
mechanism: 'schtasks',
|
|
255
|
-
detail:
|
|
364
|
+
detail: `${tick === 0 ? 'tick every minute, ' : ''}full sync daily around ${pad2(time.hour)}:${pad2(time.minute)} (Task Scheduler task "${SCHTASKS_TASK}")`,
|
|
256
365
|
};
|
|
257
366
|
}
|
|
258
|
-
/** Install (or refresh)
|
|
367
|
+
/** Install (or refresh) both background jobs (tick + daily) for the current OS. */
|
|
259
368
|
export async function installDailySync() {
|
|
260
369
|
const cmd = resolveSyncCommand();
|
|
261
370
|
try {
|
|
@@ -283,31 +392,32 @@ export async function installDailySync() {
|
|
|
283
392
|
};
|
|
284
393
|
}
|
|
285
394
|
}
|
|
286
|
-
/** Remove
|
|
287
|
-
*
|
|
395
|
+
/** Remove both background jobs. Best-effort and never throws, so it's safe to
|
|
396
|
+
* call from `logout` whether or not they were ever installed. */
|
|
288
397
|
export async function uninstallDailySync() {
|
|
289
398
|
const os = platform();
|
|
290
399
|
try {
|
|
291
400
|
if (os === 'darwin') {
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
|
|
401
|
+
for (const label of [LAUNCHD_LABEL, LAUNCHD_TICK_LABEL]) {
|
|
402
|
+
const plistPath = launchAgentPath(label);
|
|
403
|
+
await run('launchctl', ['unload', plistPath]);
|
|
404
|
+
await rm(plistPath, { force: true });
|
|
405
|
+
}
|
|
295
406
|
}
|
|
296
407
|
else if (os === 'linux') {
|
|
297
|
-
await run('systemctl', [
|
|
298
|
-
'--user',
|
|
299
|
-
'disable',
|
|
300
|
-
'--now',
|
|
301
|
-
`${SYSTEMD_UNIT}.timer`,
|
|
302
|
-
]);
|
|
303
408
|
const dir = join(homedir(), '.config', 'systemd', 'user');
|
|
304
|
-
|
|
305
|
-
|
|
409
|
+
for (const unit of [SYSTEMD_UNIT, SYSTEMD_TICK_UNIT]) {
|
|
410
|
+
await run('systemctl', ['--user', 'disable', '--now', `${unit}.timer`]);
|
|
411
|
+
await rm(join(dir, `${unit}.timer`), { force: true });
|
|
412
|
+
await rm(join(dir, `${unit}.service`), { force: true });
|
|
413
|
+
}
|
|
306
414
|
await run('systemctl', ['--user', 'daemon-reload']);
|
|
307
415
|
}
|
|
308
416
|
else if (os === 'win32') {
|
|
309
417
|
await run('schtasks', ['/Delete', '/TN', SCHTASKS_TASK, '/F']);
|
|
418
|
+
await run('schtasks', ['/Delete', '/TN', SCHTASKS_TICK_TASK, '/F']);
|
|
310
419
|
await rm(syncWrapperPath(), { force: true });
|
|
420
|
+
await rm(tickWrapperPath(), { force: true });
|
|
311
421
|
}
|
|
312
422
|
}
|
|
313
423
|
catch {
|
package/dist/daily-sync.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daily-sync.js","sourceRoot":"","sources":["../src/daily-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC7E,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,6EAA6E;AAC7E,4EAA4E;AAC5E,sEAAsE;AACtE,6EAA6E;AAC7E,0EAA0E;AAE1E,MAAM,aAAa,GAAG,iBAAiB,CAAA;AACvC,MAAM,YAAY,GAAG,cAAc,CAAA;AACnC,MAAM,aAAa,GAAG,cAAc,CAAA;AAQpC;6DAC6D;AAC7D,SAAS,GAAG,CACV,GAAW,EACX,IAAc,EACd,OAA+C,EAAE;IAEjD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE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AACH,CAAC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { type AggregateScan, type ScanResult, type TokensMessages, type Tool, type UsageLine } from './index.js';
|
|
2
|
+
export declare const SCAN_STATE_VERSION = 1;
|
|
3
|
+
/** Where a file's tail-follow stands: what we saw, and how far we read. */
|
|
4
|
+
export type FileState = {
|
|
5
|
+
size: number;
|
|
6
|
+
mtimeMs: number;
|
|
7
|
+
offset: number;
|
|
8
|
+
};
|
|
9
|
+
/** Codex only: the running total a session file has reported so far. */
|
|
10
|
+
export type CodexFileState = {
|
|
11
|
+
maxTotal: number;
|
|
12
|
+
model: string;
|
|
13
|
+
date: string;
|
|
14
|
+
};
|
|
15
|
+
export type HarnessState = {
|
|
16
|
+
/** JSONL harnesses: per-file read cursor, keyed by absolute path. */
|
|
17
|
+
files: Record<string, FileState>;
|
|
18
|
+
/** Codex only: per-file running totals (see codexFileTotals). */
|
|
19
|
+
codexTotals?: Record<string, CodexFileState>;
|
|
20
|
+
/** SQLite harnesses: fingerprints of the db and its -wal. */
|
|
21
|
+
dbMtimeMs?: number;
|
|
22
|
+
walMtimeMs?: number;
|
|
23
|
+
/** "date|model" -> tokens/messages */
|
|
24
|
+
daily: Record<string, TokensMessages>;
|
|
25
|
+
/** "date|hour|model" -> tokens/messages */
|
|
26
|
+
hourly: Record<string, TokensMessages>;
|
|
27
|
+
/** model -> cumulative tokens */
|
|
28
|
+
models: Record<string, number>;
|
|
29
|
+
};
|
|
30
|
+
export type ScanState = {
|
|
31
|
+
version: number;
|
|
32
|
+
harnesses: Record<string, HarnessState>;
|
|
33
|
+
/**
|
|
34
|
+
* Dates whose rows changed since the last accepted upload. Dates, not
|
|
35
|
+
* (harness, date) pairs, because the server reconciles a synced date by
|
|
36
|
+
* deleting this machine's rows for that date that the payload didn't
|
|
37
|
+
* mention — so a date we touch has to go out complete, with every harness's
|
|
38
|
+
* rows for it. Cleared only on a 200, so a failed POST retries next tick.
|
|
39
|
+
*/
|
|
40
|
+
dirty: string[];
|
|
41
|
+
/** Cumulative totals as of the last accepted upload. */
|
|
42
|
+
uploaded: {
|
|
43
|
+
toolTotals: Record<string, number>;
|
|
44
|
+
modelTotals: Record<string, number>;
|
|
45
|
+
};
|
|
46
|
+
/** 429 backoff: ticks before this epoch-ms do nothing. */
|
|
47
|
+
nextAllowedAt?: number;
|
|
48
|
+
/** The last failure written to sync.log, so a stuck tick can't fill it. */
|
|
49
|
+
lastError?: string;
|
|
50
|
+
};
|
|
51
|
+
/** Lives next to the session file, so it honors HACKLAB_SESSION_PATH. */
|
|
52
|
+
export declare function scanStatePath(): string;
|
|
53
|
+
export declare function emptyHarness(): HarnessState;
|
|
54
|
+
export declare function emptyState(): ScanState;
|
|
55
|
+
/**
|
|
56
|
+
* The saved state, or null when there isn't a usable one — missing, corrupt, or
|
|
57
|
+
* written by an older layout. Null means "re-read everything from scratch";
|
|
58
|
+
* callers must treat that rebuild as a baseline, not as new tokens.
|
|
59
|
+
*/
|
|
60
|
+
export declare function loadScanState(): Promise<ScanState | null>;
|
|
61
|
+
/** Persist the state, pruning hourly buckets that fell out of the 90-day window
|
|
62
|
+
* the server keeps (they'd otherwise accumulate forever). Best-effort. */
|
|
63
|
+
export declare function saveScanState(state: ScanState): Promise<void>;
|
|
64
|
+
type Aggregates = {
|
|
65
|
+
daily: Record<string, TokensMessages>;
|
|
66
|
+
hourly: Record<string, TokensMessages>;
|
|
67
|
+
models: Record<string, number>;
|
|
68
|
+
};
|
|
69
|
+
/** A full scanner's result as the maps the state stores. */
|
|
70
|
+
export declare function aggregatesOfResult(result: ScanResult): Aggregates;
|
|
71
|
+
/**
|
|
72
|
+
* Read `[from, to)` and hand back only whole lines. A harness may be mid-append
|
|
73
|
+
* when we look, so the trailing partial line is left for the next tick — that's
|
|
74
|
+
* what the returned offset points at.
|
|
75
|
+
*/
|
|
76
|
+
export declare function readCompleteLines(path: string, from: number, to: number): Promise<{
|
|
77
|
+
text: string;
|
|
78
|
+
offset: number;
|
|
79
|
+
}>;
|
|
80
|
+
export type JsonlSource = {
|
|
81
|
+
tool: Tool;
|
|
82
|
+
files: () => Promise<string[]>;
|
|
83
|
+
parse: (line: string) => UsageLine | null;
|
|
84
|
+
};
|
|
85
|
+
export type CodexSource = {
|
|
86
|
+
files: () => Promise<string[]>;
|
|
87
|
+
/** Session date from the path layout, or null to fall back to the mtime day. */
|
|
88
|
+
dateFor: (path: string) => string | null;
|
|
89
|
+
};
|
|
90
|
+
export type SqliteSource = {
|
|
91
|
+
tool: Tool;
|
|
92
|
+
dbPath: () => string;
|
|
93
|
+
scan: () => Promise<ScanResult>;
|
|
94
|
+
};
|
|
95
|
+
export type TickSources = {
|
|
96
|
+
jsonl: JsonlSource[];
|
|
97
|
+
codex: CodexSource;
|
|
98
|
+
sqlite: SqliteSource[];
|
|
99
|
+
};
|
|
100
|
+
/** The real harnesses. Injectable so the tick can be tested against a tmp dir. */
|
|
101
|
+
export declare function defaultSources(): TickSources;
|
|
102
|
+
export type TickOutcome = {
|
|
103
|
+
state: ScanState;
|
|
104
|
+
/** Did anything on disk move? (If not, the state file isn't worth rewriting.) */
|
|
105
|
+
changed: boolean;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* One incremental pass over every harness. `prev` is the saved state, or null
|
|
109
|
+
* for a cold start — in which case this reads everything and marks nothing
|
|
110
|
+
* dirty: those tokens are already on the server (the daily job put them there),
|
|
111
|
+
* and re-uploading every date would only invite the reconcile to prune rows
|
|
112
|
+
* this scan can't see (Cursor's, above all).
|
|
113
|
+
*/
|
|
114
|
+
export declare function runTick(prev: ScanState | null, sources?: TickSources): Promise<TickOutcome>;
|
|
115
|
+
/** Cumulative per-tool and per-model totals for this machine. */
|
|
116
|
+
export declare function cumulativeTotals(state: ScanState): {
|
|
117
|
+
toolTotals: Record<string, number>;
|
|
118
|
+
modelTotals: Record<string, number>;
|
|
119
|
+
};
|
|
120
|
+
export declare function sameTotals(a: Record<string, number>, b: Record<string, number>): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* What a tick uploads: cumulative tool/model totals (the server diffs those
|
|
123
|
+
* against its own per-machine snapshot) plus the daily and hourly rows for the
|
|
124
|
+
* dirty dates only.
|
|
125
|
+
*
|
|
126
|
+
* Every harness's rows go out for a dirty date, including Cursor's — which the
|
|
127
|
+
* tick never scans, and carries over from the last full scan instead. The
|
|
128
|
+
* server reconciles a date by deleting this machine's rows for it that the
|
|
129
|
+
* payload didn't mention, so a date has to be reported complete or the harnesses
|
|
130
|
+
* left out of it lose that day.
|
|
131
|
+
*/
|
|
132
|
+
export declare function tickPayload(state: ScanState): AggregateScan;
|
|
133
|
+
/** Called on a 200: the dirty dates are on the server now. */
|
|
134
|
+
export declare function markUploaded(state: ScanState): void;
|
|
135
|
+
/**
|
|
136
|
+
* Rebuild the whole state from a full scan's results — the self-healing half of
|
|
137
|
+
* the design. Whatever the tick's tail-follow got wrong (a rotated log, a
|
|
138
|
+
* mid-file model switch, a Codex date guessed from an mtime) is corrected here,
|
|
139
|
+
* so incremental drift can never outlive a day. Best-effort: a state we failed
|
|
140
|
+
* to rebuild costs a tick, never the sync that just succeeded.
|
|
141
|
+
*/
|
|
142
|
+
export declare function rebuildScanState(results: ScanResult[], sources?: TickSources): Promise<void>;
|
|
143
|
+
export {};
|
|
144
|
+
//# sourceMappingURL=incremental.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"incremental.d.ts","sourceRoot":"","sources":["../../src/scanners/incremental.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,aAAa,EAalB,KAAK,UAAU,EAGf,KAAK,cAAc,EACnB,KAAK,IAAI,EAET,KAAK,SAAS,EACf,MAAM,YAAY,CAAA;AAiBnB,eAAO,MAAM,kBAAkB,IAAI,CAAA;AAEnC,2EAA2E;AAC3E,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAA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