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/README.md
CHANGED
|
@@ -16,7 +16,7 @@ hacklab daemon
|
|
|
16
16
|
|
|
17
17
|
The script checks for Node 20+ and installs the CLI globally — that's all it
|
|
18
18
|
does. After it, `hacklab` is a real command on your PATH; `join` claims your
|
|
19
|
-
handle and `daemon` schedules the
|
|
19
|
+
handle and `daemon` schedules the background sync. If you already have Node
|
|
20
20
|
(including through a version manager), you can skip the script:
|
|
21
21
|
|
|
22
22
|
```bash
|
|
@@ -36,7 +36,7 @@ irm https://hacklab.so/install.ps1 | iex
|
|
|
36
36
|
|
|
37
37
|
The CLI reads your agents' usage from your Windows home (`%USERPROFILE%\.claude`,
|
|
38
38
|
`.codex`, and Cursor's native tracking DB), and `hacklab daemon` registers the
|
|
39
|
-
|
|
39
|
+
background sync as two Task Scheduler tasks. If you run Claude Code or Codex
|
|
40
40
|
**inside WSL**, install there instead with the `curl … | sh` command above, run
|
|
41
41
|
from your WSL shell.
|
|
42
42
|
|
|
@@ -77,7 +77,7 @@ scan local AI usage → see your rank → sign in with GitHub → claim a userna
|
|
|
77
77
|
6. **Claim** — saves your usage, syncs pinned GitHub projects, and claims
|
|
78
78
|
`hacklab.so/<username>`. Bio and the first drop finish activation in the web
|
|
79
79
|
onboarding flow. Join never schedules anything behind your back — it points
|
|
80
|
-
you at `hacklab daemon` for the
|
|
80
|
+
you at `hacklab daemon` for the background sync.
|
|
81
81
|
7. **Card** — renders the belt, level, rank, and token breakdown directly in the
|
|
82
82
|
terminal. Terminals without inline images get a text version.
|
|
83
83
|
8. **Share** — one optional X prompt. Saying yes saves the image to
|
|
@@ -90,14 +90,16 @@ scan local AI usage → see your rank → sign in with GitHub → claim a userna
|
|
|
90
90
|
finished profile it stops early and points you at `hacklab logout` +
|
|
91
91
|
`hacklab login` to switch accounts.
|
|
92
92
|
- `hacklab sync` — re-scan local AI usage and sync it to your profile.
|
|
93
|
-
- `hacklab daemon` — summon the daemon:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
- `hacklab daemon` — summon the daemon: two OS-native background jobs (launchd on
|
|
94
|
+
macOS, systemd user timers on Linux, Task Scheduler tasks on Windows) so your
|
|
95
|
+
tokens, rank, and streak stay current without you running anything. A **tick
|
|
96
|
+
every minute** reads only what your tools appended since the last run — no
|
|
97
|
+
network call at all on a minute where nothing happened — and a **full sync once
|
|
98
|
+
a day** re-scans everything and repairs whatever the tick missed. No daemon, no
|
|
99
|
+
streak. Re-running it is idempotent; `hacklab daemon off` tears both down, and
|
|
100
|
+
`hacklab logout` removes them too. On a platform we can't schedule (BSD, a
|
|
101
|
+
locked-down box) it prints the commands to schedule yourself instead of
|
|
102
|
+
pretending it worked. `hacklab sync --install-daily` still forwards here.
|
|
101
103
|
- `hacklab whoami` — show who you're logged in as.
|
|
102
104
|
- `hacklab drop "message"` — post a drop to your feed (`-u <url>` to attach a
|
|
103
105
|
link). Human output prints its profile URL; `--json` returns a stable envelope
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `hacklab daemon` — arm the
|
|
2
|
+
* `hacklab daemon` — arm the background sync, as its own explicit step.
|
|
3
3
|
*
|
|
4
|
-
* hacklab daemon summon it (install/refresh the OS-native
|
|
4
|
+
* hacklab daemon summon it (install/refresh the OS-native jobs)
|
|
5
5
|
* hacklab daemon off dismiss it (tear the schedule down)
|
|
6
6
|
*
|
|
7
|
+
* Two cadences, one command: a token tick every minute (incremental — it reads
|
|
8
|
+
* only what your tools appended since the last run) and a full sync once a day
|
|
9
|
+
* that re-scans everything and repairs whatever the tick got wrong.
|
|
10
|
+
*
|
|
7
11
|
* This used to be a side effect of `join` (and a flag on `sync`), which made it
|
|
8
12
|
* invisible: users couldn't tell whether anything was scheduled, and the web
|
|
9
13
|
* onboarding had no step to point at. Now it's a command the onboarding flow
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../../src/commands/daemon.ts"],"names":[],"mappings":"AAUA
|
|
1
|
+
{"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../../src/commands/daemon.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,MAAM,CAAC,IAAI,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAG/D"}
|
package/dist/commands/daemon.js
CHANGED
|
@@ -3,11 +3,15 @@ import { captureEvent } from '../posthog.js';
|
|
|
3
3
|
import { loadSession } from '../session.js';
|
|
4
4
|
import { dim, error, info, success } from '../ui.js';
|
|
5
5
|
/**
|
|
6
|
-
* `hacklab daemon` — arm the
|
|
6
|
+
* `hacklab daemon` — arm the background sync, as its own explicit step.
|
|
7
7
|
*
|
|
8
|
-
* hacklab daemon summon it (install/refresh the OS-native
|
|
8
|
+
* hacklab daemon summon it (install/refresh the OS-native jobs)
|
|
9
9
|
* hacklab daemon off dismiss it (tear the schedule down)
|
|
10
10
|
*
|
|
11
|
+
* Two cadences, one command: a token tick every minute (incremental — it reads
|
|
12
|
+
* only what your tools appended since the last run) and a full sync once a day
|
|
13
|
+
* that re-scans everything and repairs whatever the tick got wrong.
|
|
14
|
+
*
|
|
11
15
|
* This used to be a side effect of `join` (and a flag on `sync`), which made it
|
|
12
16
|
* invisible: users couldn't tell whether anything was scheduled, and the web
|
|
13
17
|
* onboarding had no step to point at. Now it's a command the onboarding flow
|
|
@@ -20,8 +24,8 @@ export async function daemon(args = []) {
|
|
|
20
24
|
return dismiss();
|
|
21
25
|
return summon();
|
|
22
26
|
}
|
|
23
|
-
/** Install (or refresh) the
|
|
24
|
-
*
|
|
27
|
+
/** Install (or refresh) the background sync jobs. Requires a session — they run
|
|
28
|
+
* as this user and upload to their profile. */
|
|
25
29
|
async function summon() {
|
|
26
30
|
const session = await loadSession();
|
|
27
31
|
if (!session) {
|
|
@@ -31,7 +35,7 @@ async function summon() {
|
|
|
31
35
|
}
|
|
32
36
|
const result = await installDailySync();
|
|
33
37
|
if (result.ok) {
|
|
34
|
-
success(`daemon summoned —
|
|
38
|
+
success(`daemon summoned — token tick every minute, full sync daily, via ${result.mechanism}`);
|
|
35
39
|
info(dim(` ${result.detail}`));
|
|
36
40
|
info(dim(` log: ${syncLogPath()}`));
|
|
37
41
|
info(dim(' dismiss it with `hacklab daemon off` (logout removes it too)'));
|
|
@@ -43,8 +47,8 @@ async function summon() {
|
|
|
43
47
|
}
|
|
44
48
|
// Nothing was scheduled: a platform we don't auto-schedule on (e.g. BSD) or a
|
|
45
49
|
// failed scheduler write. Say so plainly and print the copy-paste cron
|
|
46
|
-
//
|
|
47
|
-
error("couldn't schedule the
|
|
50
|
+
// commands — silently reporting success here would cost the user their streak.
|
|
51
|
+
error("couldn't schedule the background sync on this system");
|
|
48
52
|
info(result.instructions);
|
|
49
53
|
await captureEvent(session.handle, 'cli_daily_sync_manual', {
|
|
50
54
|
mechanism: result.mechanism,
|
|
@@ -56,7 +60,7 @@ async function dismiss() {
|
|
|
56
60
|
const session = await loadSession();
|
|
57
61
|
await uninstallDailySync();
|
|
58
62
|
await clearSyncPaused();
|
|
59
|
-
success('daemon dismissed — no more
|
|
63
|
+
success('daemon dismissed — no more background sync');
|
|
60
64
|
info(dim('run `hacklab daemon` to summon it again'));
|
|
61
65
|
await captureEvent(session?.handle, 'cli_daily_sync_removed');
|
|
62
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daemon.js","sourceRoot":"","sources":["../../src/commands/daemon.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,kBAAkB,GACnB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAEpD
|
|
1
|
+
{"version":3,"file":"daemon.js","sourceRoot":"","sources":["../../src/commands/daemon.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,kBAAkB,GACnB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAEpD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAAiB,EAAE;IAC9C,IAAI,IAAI,CAAC,QAAQ,CAAC,KAA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;0EAC0E;AAC1E,KAAK,UAAU,OAAO;IACpB,MAAM,OAAO,GAAG,MAAM,WAAW,EAAE,CAAA;IACnC,MAAM,kBAAkB,EAAE,CAAA;IAC1B,MAAM,eAAe,EAAE,CAAA;IACvB,OAAO,CAAC,4CAA4C,CAAC,CAAA;IACrD,IAAI,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC,CAAA;IACpD,MAAM,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,wBAAwB,CAAC,CAAA;AAC/D,CAAC"}
|
package/dist/commands/sync.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* `hacklab sync` — dispatch on flags:
|
|
3
3
|
* (none) interactive sync (scan, upload, show stats)
|
|
4
4
|
* --install-daily deprecated alias for `hacklab daemon`
|
|
5
|
+
* --tick the every-minute incremental run (usually a no-op)
|
|
5
6
|
* --quiet the unattended daily run (logs to a file, no output)
|
|
6
7
|
*/
|
|
7
8
|
export declare function sync(args?: string[]): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AA+CA;;;;;;GAMG;AACH,wBAAsB,IAAI,CAAC,IAAI,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB7D"}
|
package/dist/commands/sync.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as clack from '@clack/prompts';
|
|
2
|
-
import { appendSyncLog, clearSyncPaused, markSyncPaused, } from '../daily-sync.js';
|
|
2
|
+
import { appendSyncLog, clearSyncPaused, markSyncPaused, readSyncPaused, trimSyncLog, } from '../daily-sync.js';
|
|
3
3
|
import { captureEvent } from '../posthog.js';
|
|
4
4
|
import { loadPromptConsent, parsePromptStatsFlag, resolvePromptConsent, savePromptConsent, } from '../prompt-consent.js';
|
|
5
|
-
import {
|
|
5
|
+
import { cumulativeTotals, loadScanState, markUploaded, rebuildScanState, runTick, sameTotals, saveScanState, tickPayload, } from '../scanners/incremental.js';
|
|
6
|
+
import { collectToolScans, mergeToolScans } from '../scanners/index.js';
|
|
6
7
|
import { loadSessionState } from '../session.js';
|
|
7
|
-
import { checkSession, ensureFreshSession, formatTokens, LOGIN_EXPIRED_MESSAGE, refreshSession, runSync, scanConsentedPromptStats, syncGithubRepos, uploadTokenScan, } from '../sync.js';
|
|
8
|
+
import { checkSession, ensureFreshSession, formatTokens, LOGIN_EXPIRED_MESSAGE, refreshSession, runSync, SyncUploadError, scanConsentedPromptStats, syncGithubRepos, uploadTokenScan, } from '../sync.js';
|
|
8
9
|
import { bold, dim, error, info, success } from '../ui.js';
|
|
9
10
|
import { daemon } from './daemon.js';
|
|
10
11
|
const SESSION_EXPIRED_REASON = 'your hacklab session expired — run `hacklab login`';
|
|
@@ -12,6 +13,7 @@ const SESSION_EXPIRED_REASON = 'your hacklab session expired — run `hacklab lo
|
|
|
12
13
|
* `hacklab sync` — dispatch on flags:
|
|
13
14
|
* (none) interactive sync (scan, upload, show stats)
|
|
14
15
|
* --install-daily deprecated alias for `hacklab daemon`
|
|
16
|
+
* --tick the every-minute incremental run (usually a no-op)
|
|
15
17
|
* --quiet the unattended daily run (logs to a file, no output)
|
|
16
18
|
*/
|
|
17
19
|
export async function sync(args = []) {
|
|
@@ -28,6 +30,8 @@ export async function sync(args = []) {
|
|
|
28
30
|
info(dim('`sync --install-daily` is now `hacklab daemon` — running that.'));
|
|
29
31
|
return daemon();
|
|
30
32
|
}
|
|
33
|
+
if (args.includes('--tick'))
|
|
34
|
+
return tickSync();
|
|
31
35
|
if (args.includes('--quiet'))
|
|
32
36
|
return quietSync();
|
|
33
37
|
return interactiveSync();
|
|
@@ -37,6 +41,11 @@ export async function sync(args = []) {
|
|
|
37
41
|
* Silent by design — everything goes to ~/.hacklab/sync.log. Proactively
|
|
38
42
|
* refreshes a near-expiry session; if the session has truly lapsed it drops a
|
|
39
43
|
* paused marker the next interactive run surfaces, then exits cleanly.
|
|
44
|
+
*
|
|
45
|
+
* It's also the repair pass for the minutely tick: a full stateless scan, so
|
|
46
|
+
* whatever the tick's tail-follow missed or double-counted is corrected here and
|
|
47
|
+
* the tick's state is re-based on the result. Incremental drift therefore can't
|
|
48
|
+
* outlive a day.
|
|
40
49
|
*/
|
|
41
50
|
async function quietSync() {
|
|
42
51
|
const state = await loadSessionState();
|
|
@@ -53,15 +62,18 @@ async function quietSync() {
|
|
|
53
62
|
return;
|
|
54
63
|
}
|
|
55
64
|
const session = await ensureFreshSession(state.session);
|
|
56
|
-
const
|
|
65
|
+
const results = await collectToolScans();
|
|
66
|
+
const scan = mergeToolScans(results);
|
|
57
67
|
// Whatever the user already consented to. The unattended run never asks, so
|
|
58
68
|
// a machine that has never answered uploads token counts only.
|
|
59
69
|
const promptStats = await scanConsentedPromptStats((await loadPromptConsent()) ?? 'none');
|
|
60
70
|
// Upload tokens AND mirror pinned repos together, so the after-refresh retry
|
|
61
71
|
// below does the exact same work as the happy path (no silently-skipped repo
|
|
62
|
-
// sync on a day the session had to be refreshed mid-run).
|
|
72
|
+
// sync on a day the session had to be refreshed mid-run). The state rebuild
|
|
73
|
+
// rides along: everything just went out, so nothing is left dirty.
|
|
63
74
|
const push = async (s) => {
|
|
64
75
|
await uploadTokenScan(s, scan, { promptStats });
|
|
76
|
+
await rebuildScanState(results);
|
|
65
77
|
await syncGithubRepos(s);
|
|
66
78
|
};
|
|
67
79
|
try {
|
|
@@ -92,6 +104,116 @@ async function quietSync() {
|
|
|
92
104
|
await appendSyncLog('paused: session expired');
|
|
93
105
|
}
|
|
94
106
|
}
|
|
107
|
+
/** How long to sit out after a 429 that came without a Retry-After. */
|
|
108
|
+
const DEFAULT_BACKOFF_MS = 15 * 60 * 1000;
|
|
109
|
+
const MAX_BACKOFF_MS = 6 * 60 * 60 * 1000;
|
|
110
|
+
function backoffMs(retryAfter) {
|
|
111
|
+
const seconds = Number(retryAfter);
|
|
112
|
+
if (!Number.isFinite(seconds) || seconds <= 0)
|
|
113
|
+
return DEFAULT_BACKOFF_MS;
|
|
114
|
+
return Math.min(seconds * 1000, MAX_BACKOFF_MS);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Log a tick failure once. A minutely job that keeps hitting the same wall (no
|
|
118
|
+
* network, server down) would otherwise write 1440 identical lines a day, so the
|
|
119
|
+
* first one goes in and the rest are suppressed until something changes.
|
|
120
|
+
*/
|
|
121
|
+
async function logTickError(state, line) {
|
|
122
|
+
if (state.lastError === line)
|
|
123
|
+
return;
|
|
124
|
+
state.lastError = line;
|
|
125
|
+
await appendSyncLog(line);
|
|
126
|
+
}
|
|
127
|
+
/** Pause the background sync, logging it only the first time. */
|
|
128
|
+
async function pauseTick(reason) {
|
|
129
|
+
const alreadyPaused = await readSyncPaused();
|
|
130
|
+
await markSyncPaused(reason);
|
|
131
|
+
if (!alreadyPaused)
|
|
132
|
+
await appendSyncLog(`tick paused: ${reason}`);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* `hacklab sync --tick` — the every-minute run. Where `--quiet` re-scans every
|
|
136
|
+
* log from scratch (~6s and a few hundred MB for a heavy user), this reads only
|
|
137
|
+
* what the AI tools appended since the last tick, and on the overwhelmingly
|
|
138
|
+
* common minute where nothing was appended it exits after a stat walk, without
|
|
139
|
+
* touching the network. Silent unless it uploaded, failed, or got paused: the
|
|
140
|
+
* log has to survive 1440 runs a day.
|
|
141
|
+
*/
|
|
142
|
+
async function tickSync() {
|
|
143
|
+
const saved = await loadScanState();
|
|
144
|
+
// The server asked us to back off — respect it before doing any work at all.
|
|
145
|
+
if (saved?.nextAllowedAt && Date.now() < saved.nextAllowedAt)
|
|
146
|
+
return;
|
|
147
|
+
await trimSyncLog();
|
|
148
|
+
const sessionState = await loadSessionState();
|
|
149
|
+
if (!sessionState.session) {
|
|
150
|
+
// 'missing' is a logged-out machine: nothing to say, every minute.
|
|
151
|
+
if (sessionState.status === 'expired' ||
|
|
152
|
+
sessionState.status === 'invalid') {
|
|
153
|
+
await pauseTick(sessionState.status === 'invalid'
|
|
154
|
+
? 'your hacklab session file is unreadable — run `hacklab login`'
|
|
155
|
+
: SESSION_EXPIRED_REASON);
|
|
156
|
+
}
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const session = await ensureFreshSession(sessionState.session);
|
|
160
|
+
const { state, changed } = await runTick(saved);
|
|
161
|
+
const totals = cumulativeTotals(state);
|
|
162
|
+
if (state.dirty.length === 0 &&
|
|
163
|
+
sameTotals(totals.toolTotals, state.uploaded.toolTotals) &&
|
|
164
|
+
sameTotals(totals.modelTotals, state.uploaded.modelTotals)) {
|
|
165
|
+
// The common case: nothing new to say. Persist only if the walk actually
|
|
166
|
+
// saw something move (a touched file, a re-read harness).
|
|
167
|
+
if (changed)
|
|
168
|
+
await saveScanState(state);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const scan = tickPayload(state);
|
|
172
|
+
const dates = state.dirty.length;
|
|
173
|
+
// No prompt stats and no GitHub mirror: those are the daily job's work, and a
|
|
174
|
+
// minutely run has no business re-reading transcripts. Not interactive either
|
|
175
|
+
// — a background tick isn't user activity.
|
|
176
|
+
try {
|
|
177
|
+
const result = await uploadTokenScan(session, scan);
|
|
178
|
+
markUploaded(state);
|
|
179
|
+
await saveScanState(state);
|
|
180
|
+
await clearSyncPaused();
|
|
181
|
+
await appendSyncLog(`tick: +${formatTokens(Number(result.tokensDelta ?? 0))} tokens (${dates} date${dates === 1 ? '' : 's'})`);
|
|
182
|
+
}
|
|
183
|
+
catch (e) {
|
|
184
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
185
|
+
const status = e instanceof SyncUploadError ? e.status : 0;
|
|
186
|
+
if (status === 429) {
|
|
187
|
+
const wait = backoffMs(e instanceof SyncUploadError ? e.retryAfter : null);
|
|
188
|
+
state.nextAllowedAt = Date.now() + wait;
|
|
189
|
+
await logTickError(state, `tick: rate limited, pausing ${Math.round(wait / 1000)}s`);
|
|
190
|
+
await saveScanState(state);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (message === LOGIN_EXPIRED_MESSAGE) {
|
|
194
|
+
const refreshed = await refreshSession(session);
|
|
195
|
+
if (refreshed) {
|
|
196
|
+
try {
|
|
197
|
+
const result = await uploadTokenScan(refreshed, scan);
|
|
198
|
+
markUploaded(state);
|
|
199
|
+
await saveScanState(state);
|
|
200
|
+
await clearSyncPaused();
|
|
201
|
+
await appendSyncLog(`tick: +${formatTokens(Number(result.tokensDelta ?? 0))} tokens (${dates} dates, after refresh)`);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
// fall through to pause
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
await saveScanState(state);
|
|
209
|
+
await pauseTick(SESSION_EXPIRED_REASON);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
// Dirty dates stay dirty, so the next tick retries them.
|
|
213
|
+
await logTickError(state, `tick error: ${message}`);
|
|
214
|
+
await saveScanState(state);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
95
217
|
async function interactiveSync() {
|
|
96
218
|
const sessionState = await loadSessionState();
|
|
97
219
|
if (!sessionState.session) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AAEvC,OAAO,EACL,aAAa,EACb,eAAe,EACf,cAAc,GACf,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;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AAC,CAAA;IAC5C,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,EAAE,CAAC;QACrD,MAAM,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,WAAW,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAA;QACzE,IAAI,KAAK,CAAC,OAAO,GAAG,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,WAAW,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;QAC7D,IAAI,CAAC,aAAa,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACvC,CAAC;IAED,MAAM,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,oBAAoB,EAAE;QACvD,aAAa,EAAE,WAAW;QAC1B,YAAY,EAAE,UAAU;QACxB,aAAa,EAAE,WAAW;QAC1B,eAAe,EAAE,aAAa;QAC9B,aAAa,EAAE,WAAW;QAC1B,eAAe,EAAE,aAAa;QAC9B,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,KAAK,EAAE,CAAC,CAAC,KAAK;KACf,CAAC,CAAA;IAEF,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAA;AAC7B,CAAC"}
|
package/dist/daily-sync.d.ts
CHANGED
|
@@ -14,6 +14,11 @@ export type InstallResult = {
|
|
|
14
14
|
/** The daily background job writes here; launchd/systemd also point stdout+stderr
|
|
15
15
|
* at it. Lives next to the session file so it honors HACKLAB_SESSION_PATH. */
|
|
16
16
|
export declare function syncLogPath(): string;
|
|
17
|
+
export declare const SYNC_LOG_MAX_BYTES = 1000000;
|
|
18
|
+
export declare const SYNC_LOG_KEEP_LINES = 200;
|
|
19
|
+
/** Cut an oversized sync.log down to its last few hundred lines. Best-effort,
|
|
20
|
+
* and a no-op while the log is small — which is the normal case. */
|
|
21
|
+
export declare function trimSyncLog(maxBytes?: number, keepLines?: number): Promise<void>;
|
|
17
22
|
/** Append a timestamped line to the background-sync log (best-effort). */
|
|
18
23
|
export declare function appendSyncLog(line: string): Promise<void>;
|
|
19
24
|
/** Record that the background sync can't continue (e.g. the session expired), so
|
|
@@ -29,27 +34,39 @@ export declare function launchdPlist(cmd: SyncCommand, time: {
|
|
|
29
34
|
hour: number;
|
|
30
35
|
minute: number;
|
|
31
36
|
}, logPath: string): string;
|
|
37
|
+
/** The minutely tick. StartInterval (not a calendar interval) so launchd just
|
|
38
|
+
* re-runs it every 60s; a tick with nothing to report exits without a request. */
|
|
39
|
+
export declare function launchdTickPlist(cmd: SyncCommand, logPath: string): string;
|
|
32
40
|
export declare function systemdService(cmd: SyncCommand): string;
|
|
33
41
|
export declare function systemdTimer(): string;
|
|
42
|
+
export declare function systemdTickService(cmd: SyncCommand): string;
|
|
43
|
+
export declare function systemdTickTimer(): string;
|
|
34
44
|
/** Where the Windows scheduled task's wrapper batch file lives. Next to the
|
|
35
45
|
* session file so it honors HACKLAB_SESSION_PATH, mirroring syncLogPath(). */
|
|
36
46
|
export declare function syncWrapperPath(): string;
|
|
47
|
+
/** The tick's own wrapper — same pattern, its own file so the two tasks can be
|
|
48
|
+
* created and deleted independently. */
|
|
49
|
+
export declare function tickWrapperPath(): string;
|
|
37
50
|
/** The batch wrapper Task Scheduler runs. schtasks' `/TR` chokes on the nested
|
|
38
51
|
* quotes a full `"node" "script" …` command needs, so we point the task at this
|
|
39
52
|
* one-line .cmd instead and do the quoting here, where plain-batch rules apply.
|
|
40
53
|
* Output is redirected to the same sync.log the job also appends to, so a crash
|
|
41
54
|
* before the CLI's own logging still leaves a trace. */
|
|
42
55
|
export declare function schtasksWrapper(cmd: SyncCommand, logPath: string): string;
|
|
56
|
+
/** Same wrapper for the minutely tick, logging to the same sync.log. */
|
|
57
|
+
export declare function schtasksTickWrapper(cmd: SyncCommand, logPath: string): string;
|
|
43
58
|
/** Args for `schtasks /Create`. The `/TR` value is a single pre-quoted path;
|
|
44
59
|
* spawn must run with windowsVerbatimArguments so Node doesn't re-escape it. */
|
|
45
60
|
export declare function schtasksCreateArgs(wrapperPath: string, time: {
|
|
46
61
|
hour: number;
|
|
47
62
|
minute: number;
|
|
48
63
|
}): string[];
|
|
64
|
+
/** Args for `schtasks /Create` for the tick: every minute, forever. */
|
|
65
|
+
export declare function schtasksTickCreateArgs(wrapperPath: string): string[];
|
|
49
66
|
export declare function manualInstructions(cmd: SyncCommand): string;
|
|
50
|
-
/** Install (or refresh)
|
|
67
|
+
/** Install (or refresh) both background jobs (tick + daily) for the current OS. */
|
|
51
68
|
export declare function installDailySync(): Promise<InstallResult>;
|
|
52
|
-
/** Remove
|
|
53
|
-
*
|
|
69
|
+
/** Remove both background jobs. Best-effort and never throws, so it's safe to
|
|
70
|
+
* call from `logout` whether or not they were ever installed. */
|
|
54
71
|
export declare function uninstallDailySync(): Promise<void>;
|
|
55
72
|
//# sourceMappingURL=daily-sync.d.ts.map
|
package/dist/daily-sync.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daily-sync.d.ts","sourceRoot":"","sources":["../src/daily-sync.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"daily-sync.d.ts","sourceRoot":"","sources":["../src/daily-sync.ts"],"names":[],"mappings":"AA+BA,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAE1D,MAAM,MAAM,aAAa,GACrB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC3E;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,SAAS,EAAE,QAAQ,GAAG,aAAa,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAA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