@tokenfactory/acc-runner 0.25.0 → 0.27.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 +77 -4
- package/package.json +1 -1
- package/dist/anthropic-auth.d.ts +0 -53
- package/dist/anthropic-auth.d.ts.map +0 -1
- package/dist/anthropic-auth.js +0 -89
- package/dist/anthropic-auth.js.map +0 -1
- package/dist/bin-resolve.d.ts +0 -16
- package/dist/bin-resolve.d.ts.map +0 -1
- package/dist/bin-resolve.js +0 -35
- package/dist/bin-resolve.js.map +0 -1
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -128
- package/dist/cli.js.map +0 -1
- package/dist/config.d.ts +0 -121
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -396
- package/dist/config.js.map +0 -1
- package/dist/cost-pricing.d.ts +0 -130
- package/dist/cost-pricing.d.ts.map +0 -1
- package/dist/cost-pricing.js +0 -191
- package/dist/cost-pricing.js.map +0 -1
- package/dist/doctor.d.ts +0 -37
- package/dist/doctor.d.ts.map +0 -1
- package/dist/doctor.js +0 -658
- package/dist/doctor.js.map +0 -1
- package/dist/failure-classifier.d.ts +0 -112
- package/dist/failure-classifier.d.ts.map +0 -1
- package/dist/failure-classifier.js +0 -353
- package/dist/failure-classifier.js.map +0 -1
- package/dist/gh.d.ts +0 -22
- package/dist/gh.d.ts.map +0 -1
- package/dist/gh.js +0 -48
- package/dist/gh.js.map +0 -1
- package/dist/git.d.ts +0 -50
- package/dist/git.d.ts.map +0 -1
- package/dist/git.js +0 -127
- package/dist/git.js.map +0 -1
- package/dist/github-client.d.ts +0 -133
- package/dist/github-client.d.ts.map +0 -1
- package/dist/github-client.js +0 -234
- package/dist/github-client.js.map +0 -1
- package/dist/keychain.d.ts +0 -21
- package/dist/keychain.d.ts.map +0 -1
- package/dist/keychain.js +0 -45
- package/dist/keychain.js.map +0 -1
- package/dist/login.d.ts +0 -12
- package/dist/login.d.ts.map +0 -1
- package/dist/login.js +0 -133
- package/dist/login.js.map +0 -1
- package/dist/logout.d.ts +0 -2
- package/dist/logout.d.ts.map +0 -1
- package/dist/logout.js +0 -31
- package/dist/logout.js.map +0 -1
- package/dist/mcp-spawn.d.ts +0 -30
- package/dist/mcp-spawn.d.ts.map +0 -1
- package/dist/mcp-spawn.js +0 -145
- package/dist/mcp-spawn.js.map +0 -1
- package/dist/messaging.d.ts +0 -49
- package/dist/messaging.d.ts.map +0 -1
- package/dist/messaging.js +0 -36
- package/dist/messaging.js.map +0 -1
- package/dist/pkg-version.d.ts +0 -3
- package/dist/pkg-version.d.ts.map +0 -1
- package/dist/pkg-version.js +0 -20
- package/dist/pkg-version.js.map +0 -1
- package/dist/profiles/designer-prompt.d.ts +0 -18
- package/dist/profiles/designer-prompt.d.ts.map +0 -1
- package/dist/profiles/designer-prompt.js +0 -172
- package/dist/profiles/designer-prompt.js.map +0 -1
- package/dist/profiles/developer-prompt.d.ts +0 -24
- package/dist/profiles/developer-prompt.d.ts.map +0 -1
- package/dist/profiles/developer-prompt.js +0 -24
- package/dist/profiles/developer-prompt.js.map +0 -1
- package/dist/profiles/manager-prompt.d.ts +0 -34
- package/dist/profiles/manager-prompt.d.ts.map +0 -1
- package/dist/profiles/manager-prompt.js +0 -93
- package/dist/profiles/manager-prompt.js.map +0 -1
- package/dist/profiles/tester-prompt.d.ts +0 -28
- package/dist/profiles/tester-prompt.d.ts.map +0 -1
- package/dist/profiles/tester-prompt.js +0 -165
- package/dist/profiles/tester-prompt.js.map +0 -1
- package/dist/prompt.d.ts +0 -38
- package/dist/prompt.d.ts.map +0 -1
- package/dist/prompt.js +0 -78
- package/dist/prompt.js.map +0 -1
- package/dist/runtime/cache-dir.d.ts +0 -2
- package/dist/runtime/cache-dir.d.ts.map +0 -1
- package/dist/runtime/cache-dir.js +0 -15
- package/dist/runtime/cache-dir.js.map +0 -1
- package/dist/runtime/conflict-resolver.d.ts +0 -65
- package/dist/runtime/conflict-resolver.d.ts.map +0 -1
- package/dist/runtime/conflict-resolver.js +0 -477
- package/dist/runtime/conflict-resolver.js.map +0 -1
- package/dist/runtime/expand-args.d.ts +0 -28
- package/dist/runtime/expand-args.d.ts.map +0 -1
- package/dist/runtime/expand-args.js +0 -50
- package/dist/runtime/expand-args.js.map +0 -1
- package/dist/runtime/locks.d.ts +0 -21
- package/dist/runtime/locks.d.ts.map +0 -1
- package/dist/runtime/locks.js +0 -97
- package/dist/runtime/locks.js.map +0 -1
- package/dist/runtime/provision-mutex.d.ts +0 -37
- package/dist/runtime/provision-mutex.d.ts.map +0 -1
- package/dist/runtime/provision-mutex.js +0 -67
- package/dist/runtime/provision-mutex.js.map +0 -1
- package/dist/runtime/quarantine.d.ts +0 -26
- package/dist/runtime/quarantine.d.ts.map +0 -1
- package/dist/runtime/quarantine.js +0 -50
- package/dist/runtime/quarantine.js.map +0 -1
- package/dist/runtime/resolution-integrity.d.ts +0 -86
- package/dist/runtime/resolution-integrity.d.ts.map +0 -1
- package/dist/runtime/resolution-integrity.js +0 -248
- package/dist/runtime/resolution-integrity.js.map +0 -1
- package/dist/runtime/reviewer.d.ts +0 -81
- package/dist/runtime/reviewer.d.ts.map +0 -1
- package/dist/runtime/reviewer.js +0 -374
- package/dist/runtime/reviewer.js.map +0 -1
- package/dist/runtime/rework.d.ts +0 -48
- package/dist/runtime/rework.d.ts.map +0 -1
- package/dist/runtime/rework.js +0 -136
- package/dist/runtime/rework.js.map +0 -1
- package/dist/runtime/singleton.d.ts +0 -47
- package/dist/runtime/singleton.d.ts.map +0 -1
- package/dist/runtime/singleton.js +0 -200
- package/dist/runtime/singleton.js.map +0 -1
- package/dist/runtime/version-drift.d.ts +0 -31
- package/dist/runtime/version-drift.d.ts.map +0 -1
- package/dist/runtime/version-drift.js +0 -114
- package/dist/runtime/version-drift.js.map +0 -1
- package/dist/runtime/worktree.d.ts +0 -74
- package/dist/runtime/worktree.d.ts.map +0 -1
- package/dist/runtime/worktree.js +0 -206
- package/dist/runtime/worktree.js.map +0 -1
- package/dist/secrets/inject.d.ts +0 -70
- package/dist/secrets/inject.d.ts.map +0 -1
- package/dist/secrets/inject.js +0 -102
- package/dist/secrets/inject.js.map +0 -1
- package/dist/supabase.d.ts +0 -4
- package/dist/supabase.d.ts.map +0 -1
- package/dist/supabase.js +0 -36
- package/dist/supabase.js.map +0 -1
- package/dist/task-runner.d.ts +0 -313
- package/dist/task-runner.d.ts.map +0 -1
- package/dist/task-runner.js +0 -1766
- package/dist/task-runner.js.map +0 -1
- package/dist/token-provider.d.ts +0 -50
- package/dist/token-provider.d.ts.map +0 -1
- package/dist/token-provider.js +0 -177
- package/dist/token-provider.js.map +0 -1
- package/dist/types.d.ts +0 -120
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -16
- package/dist/types.js.map +0 -1
- package/dist/version-check.d.ts +0 -17
- package/dist/version-check.d.ts.map +0 -1
- package/dist/version-check.js +0 -56
- package/dist/version-check.js.map +0 -1
- package/dist/watch.d.ts +0 -295
- package/dist/watch.d.ts.map +0 -1
- package/dist/watch.js +0 -1532
- package/dist/watch.js.map +0 -1
package/dist/watch.d.ts
DELETED
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
import type { RealtimeChannel } from "@supabase/supabase-js";
|
|
2
|
-
import { type RunnerConfig } from "./config.js";
|
|
3
|
-
import { type TokenProvider } from "./token-provider.js";
|
|
4
|
-
import { type RunnerSupabaseClient } from "./supabase.js";
|
|
5
|
-
import { runTask, type RunTaskController } from "./task-runner.js";
|
|
6
|
-
import { type ReviewAssignment, type ReviewerOutcome } from "./runtime/reviewer.js";
|
|
7
|
-
import { type SingletonLock } from "./runtime/singleton.js";
|
|
8
|
-
import type { StoredSession } from "./types.js";
|
|
9
|
-
export declare class RefreshReuseDetectedError extends Error {
|
|
10
|
-
constructor(message: string);
|
|
11
|
-
}
|
|
12
|
-
export type HeartbeatErrorKind = "auth" | "dns" | "tls" | "reset" | "timeout" | "network" | "unknown";
|
|
13
|
-
/**
|
|
14
|
-
* v0.6.0: classify the heartbeat RPC error so we (a) emit a useful
|
|
15
|
-
* stderr line for the operator and (b) only attempt a JWT refresh
|
|
16
|
-
* when the failure shape actually implies an auth problem. Refreshing
|
|
17
|
-
* on a transient network blip just burns the refresh-token rotation
|
|
18
|
-
* chain and surfaces a confusing "refresh failed" line on top of the
|
|
19
|
-
* real underlying network error.
|
|
20
|
-
*/
|
|
21
|
-
export declare function classifyHeartbeatError(err: {
|
|
22
|
-
message?: string | null;
|
|
23
|
-
code?: string | null;
|
|
24
|
-
} | null | undefined): HeartbeatErrorKind;
|
|
25
|
-
/** Pick the next inter-heartbeat delay from the backoff ladder. Caller
|
|
26
|
-
* passes the number of consecutive failures (1 → first retry). The
|
|
27
|
-
* return is at least baseMs so a tighter operator-configured cadence
|
|
28
|
-
* is never slowed by the backoff scheme. */
|
|
29
|
-
export declare function nextHeartbeatDelayMs(consecutiveFailures: number, baseMs: number): number;
|
|
30
|
-
export interface WatchOptions {
|
|
31
|
-
/** Override heartbeat interval (ms). Defaults to 4000. */
|
|
32
|
-
heartbeatMs?: number;
|
|
33
|
-
/** Override polling interval (ms). Defaults to 30000. */
|
|
34
|
-
pollMs?: number;
|
|
35
|
-
/**
|
|
36
|
-
* v0.62 (T-62-1): periodic full-claim-scan cadence (ms). The scan lists
|
|
37
|
-
* ALL assigned+queued tasks for this runner (epoch watermark) and enqueues
|
|
38
|
-
* any the delta-poll watermark has skipped — the safety net for a realtime
|
|
39
|
-
* `task_assigned` broadcast missed by a stale subscription. Defaults to
|
|
40
|
-
* 180000 (3 min). Tests set a tiny value to observe self-recovery without
|
|
41
|
-
* real-time waits.
|
|
42
|
-
*/
|
|
43
|
-
claimScanIntervalMs?: number;
|
|
44
|
-
/**
|
|
45
|
-
* v0.65 (T-65-2): periodic review-scan cadence (ms). The review twin of
|
|
46
|
-
* claimScanIntervalMs. Lists ALL pending reviews assigned to this runner
|
|
47
|
-
* (epoch watermark) via `list_assigned_pending_reviews` and enqueues any the
|
|
48
|
-
* realtime `review_assigned` broadcast missed (stale subscription) — the
|
|
49
|
-
* safety net that stops a review stranding in acc.review_queue (PR #544's
|
|
50
|
-
* review stranded 16h last cycle). Defaults to DEFAULT_CLAIM_SCAN_INTERVAL_MS
|
|
51
|
-
* (3 min). Tests set a tiny value to observe self-recovery without real-time
|
|
52
|
-
* waits. Knob: `review_scan_interval_ms`.
|
|
53
|
-
*/
|
|
54
|
-
reviewScanIntervalMs?: number;
|
|
55
|
-
/**
|
|
56
|
-
* v0.73 (T-73-2, G-M): claim-loop watchdog staleness threshold (ms). A task
|
|
57
|
-
* that stays assigned-but-unclaimed for this runner longer than this — while
|
|
58
|
-
* heartbeats succeed — trips the watchdog into a single-flight resubscribe +
|
|
59
|
-
* claim scan (the same recovery a terminal channel status triggers). Defaults
|
|
60
|
-
* to 90000 (90s, < the server's 300s rescue grace). Tests set a tiny value to
|
|
61
|
-
* observe the self-heal without real-time waits. Knob: `claim_watchdog_stale_ms`.
|
|
62
|
-
*/
|
|
63
|
-
claimWatchdogStaleMs?: number;
|
|
64
|
-
/**
|
|
65
|
-
* v0.73 (T-73-2, G-M): claim-loop watchdog re-evaluation cadence (ms). How
|
|
66
|
-
* often the watchdog lists its own assigned+queued tasks to age them against
|
|
67
|
-
* claimWatchdogStaleMs. Defaults to 30000 (30s). Tests set a large value so
|
|
68
|
-
* only the `claimWatchdogOnce()` hook drives it deterministically.
|
|
69
|
-
*/
|
|
70
|
-
claimWatchdogCheckMs?: number;
|
|
71
|
-
/** Returns a controller for tests; production wiring uses the default. */
|
|
72
|
-
taskRunnerFactory?: typeof runTask;
|
|
73
|
-
/** v0.6.2: review handler injection for tests. Defaults to runReview. */
|
|
74
|
-
reviewerFactory?: (assignment: ReviewAssignment, deps: {
|
|
75
|
-
supabase: RunnerSupabaseClient;
|
|
76
|
-
}) => Promise<ReviewerOutcome>;
|
|
77
|
-
/**
|
|
78
|
-
* v0.10 T-49-2: max tasks this runner may execute in parallel. Each
|
|
79
|
-
* concurrent task runs in an isolated git worktree so there is zero
|
|
80
|
-
* file bleed between them. The database-side `claim_task_with_locks`
|
|
81
|
-
* RPC provides a second layer: it rejects a claim when the task's file
|
|
82
|
-
* scope overlaps another in-flight task.
|
|
83
|
-
*
|
|
84
|
-
* Defaults to 2 (the v0.10 autonomous-dispatch default). Set to 1 to
|
|
85
|
-
* restore the strict serial v0.9 behaviour.
|
|
86
|
-
*/
|
|
87
|
-
concurrencyLimit?: number;
|
|
88
|
-
/**
|
|
89
|
-
* v0.12.0 (T-52-7): idle TTL in ms. Overrides ACC_RUNNER_IDLE_TTL_MIN
|
|
90
|
-
* for tests. null/undefined falls back to the env var; when neither is
|
|
91
|
-
* set the idle-TTL machinery is never armed (desktop default — byte-
|
|
92
|
-
* identical v0.11 behaviour).
|
|
93
|
-
*/
|
|
94
|
-
idleTtlMs?: number | null;
|
|
95
|
-
/** v0.12.0 (T-52-7): idle-check cadence override for tests. */
|
|
96
|
-
idleCheckMs?: number;
|
|
97
|
-
/** v0.12.0 (T-52-7): exit hook for tests. Defaults to process.exit. */
|
|
98
|
-
exit?: (code: number) => void;
|
|
99
|
-
/**
|
|
100
|
-
* v0.56 (T-56-1): backoff applied when a capacity_exhausted result
|
|
101
|
-
* carries no parseable reset time. Defaults to 30 min; tests set a tiny
|
|
102
|
-
* value to observe the pause→resume cycle without real-time waits.
|
|
103
|
-
*/
|
|
104
|
-
capacityBackoffMs?: number;
|
|
105
|
-
/**
|
|
106
|
-
* v0.56 (T-56-1): max jitter added to the resume instant. Defaults to
|
|
107
|
-
* 15s; tests set 0 for deterministic timing.
|
|
108
|
-
*/
|
|
109
|
-
resumeJitterMs?: number;
|
|
110
|
-
/**
|
|
111
|
-
* v0.14.0 (T-54-2, GA-3): acquire the single-instance lock on the repo
|
|
112
|
-
* path before starting. Defaults to true for real runs and false when a
|
|
113
|
-
* taskRunnerFactory is injected (tests) so parallel test workers don't
|
|
114
|
-
* fight over a shared machine-wide lock. Set explicitly to exercise the
|
|
115
|
-
* guard.
|
|
116
|
-
*/
|
|
117
|
-
enforceSingleton?: boolean;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* v0.12.0 (T-52-7): resolve ACC_RUNNER_IDLE_TTL_MIN into ms. Returns null
|
|
121
|
-
* (TTL disabled) when unset; warns and returns null on junk so a typo'd
|
|
122
|
-
* env never strands a container in "never exits" mode silently.
|
|
123
|
-
*/
|
|
124
|
-
export declare function resolveIdleTtlMs(env?: NodeJS.ProcessEnv): number | null;
|
|
125
|
-
export interface WatchHandle {
|
|
126
|
-
stop(): Promise<void>;
|
|
127
|
-
/** Test hook: forces one polling pass and resolves when it finishes. */
|
|
128
|
-
pollOnce(): Promise<void>;
|
|
129
|
-
/**
|
|
130
|
-
* v0.62 (T-62-1) test hook: forces one periodic full claim scan and
|
|
131
|
-
* resolves when it finishes. Production drives this from the scan timer.
|
|
132
|
-
*/
|
|
133
|
-
claimScanOnce(): Promise<void>;
|
|
134
|
-
/**
|
|
135
|
-
* v0.65 (T-65-2) test hook: forces one periodic full review scan and
|
|
136
|
-
* resolves when it finishes. Production drives this from the review-scan
|
|
137
|
-
* timer.
|
|
138
|
-
*/
|
|
139
|
-
reviewScanOnce(): Promise<void>;
|
|
140
|
-
/**
|
|
141
|
-
* v0.73 (T-73-2, G-M) test hook: forces one claim-loop watchdog evaluation
|
|
142
|
-
* and resolves when it finishes. Production drives this from the watchdog
|
|
143
|
-
* timer.
|
|
144
|
-
*/
|
|
145
|
-
claimWatchdogOnce(): Promise<void>;
|
|
146
|
-
/** v0.10 T-49-2: number of tasks currently executing. Useful for tests. */
|
|
147
|
-
runningCount(): number;
|
|
148
|
-
}
|
|
149
|
-
type ReviewerFactory = (assignment: ReviewAssignment, deps: {
|
|
150
|
-
supabase: RunnerSupabaseClient;
|
|
151
|
-
}) => Promise<ReviewerOutcome>;
|
|
152
|
-
interface WatchState {
|
|
153
|
-
cfg: RunnerConfig;
|
|
154
|
-
session: StoredSession;
|
|
155
|
-
/** v0.12.0 (T-52-7): session persistence backend (keychain or env). */
|
|
156
|
-
tokenProvider: TokenProvider;
|
|
157
|
-
supabase: RunnerSupabaseClient;
|
|
158
|
-
channel: RealtimeChannel;
|
|
159
|
-
heartbeatTimer: NodeJS.Timeout;
|
|
160
|
-
refreshTimer: NodeJS.Timeout;
|
|
161
|
-
pollTimer: NodeJS.Timeout;
|
|
162
|
-
/** v0.62 (T-62-1): periodic full-claim-scan timer (realtime-miss safety net). */
|
|
163
|
-
claimScanTimer: NodeJS.Timeout;
|
|
164
|
-
/** v0.62 (T-62-1): full-claim-scan cadence (ms); from WatchOptions, default 3 min. */
|
|
165
|
-
claimScanIntervalMs: number;
|
|
166
|
-
/** v0.62 (T-62-1): single-flight guard so a slow scan can't overlap itself. */
|
|
167
|
-
claimScanning: boolean;
|
|
168
|
-
/** v0.65 (T-65-2): periodic review-scan timer (realtime-miss safety net). */
|
|
169
|
-
reviewScanTimer: NodeJS.Timeout;
|
|
170
|
-
/** v0.65 (T-65-2): review-scan cadence (ms); from WatchOptions, default 3 min. */
|
|
171
|
-
reviewScanIntervalMs: number;
|
|
172
|
-
/** v0.65 (T-65-2): single-flight guard so a slow review scan can't overlap. */
|
|
173
|
-
reviewScanning: boolean;
|
|
174
|
-
/**
|
|
175
|
-
* v0.73 (T-73-2, G-M): claim-loop watchdog. `claimWatchdogTimer` re-evaluates
|
|
176
|
-
* the runner's assigned-but-unclaimed work every `claimWatchdogCheckMs`;
|
|
177
|
-
* `claimWatchdogStaleMs` is the wedge threshold. `claimWatchdogSince` maps a
|
|
178
|
-
* task id → the epoch-ms instant it was FIRST observed assigned-to-me-but-not-
|
|
179
|
-
* claimed (dropped the moment it leaves the assigned+queued set). `claimWatchdog-
|
|
180
|
-
* Checking` is the single-flight guard so a slow scan can't overlap itself.
|
|
181
|
-
*/
|
|
182
|
-
claimWatchdogTimer: NodeJS.Timeout;
|
|
183
|
-
claimWatchdogStaleMs: number;
|
|
184
|
-
claimWatchdogSince: Map<string, number>;
|
|
185
|
-
claimWatchdogChecking: boolean;
|
|
186
|
-
/**
|
|
187
|
-
* v0.68 (T-68-1): realtime channel-health recovery. The `.subscribe`
|
|
188
|
-
* status callback previously handled ONLY `SUBSCRIBED`; a `CHANNEL_ERROR`
|
|
189
|
-
* / `TIMED_OUT` / `CLOSED` left the channel silently dead until token
|
|
190
|
-
* expiry or a manual restart, so dispatched tasks/reviews stopped being
|
|
191
|
-
* claimed (the stale-subscription root cause). These fields drive a
|
|
192
|
-
* single-flight, backed-off resubscribe on a terminal channel status.
|
|
193
|
-
*/
|
|
194
|
-
resubscribing: boolean;
|
|
195
|
-
resubscribeAttempts: number;
|
|
196
|
-
resubscribeTimer: NodeJS.Timeout | null;
|
|
197
|
-
/**
|
|
198
|
-
* v0.10 T-49-2: replaces the v0.9 `current: RunTaskController | null`
|
|
199
|
-
* so multiple tasks can execute concurrently in isolated worktrees.
|
|
200
|
-
* Keyed by task_id so cancellation and the quarantine handler can
|
|
201
|
-
* target a specific task without iterating.
|
|
202
|
-
*/
|
|
203
|
-
running: Map<string, RunTaskController>;
|
|
204
|
-
/**
|
|
205
|
-
* v0.10 T-49-2: max concurrent tasks. Sourced from
|
|
206
|
-
* WatchOptions.concurrencyLimit; defaults to 2. Each in-flight task
|
|
207
|
-
* occupies one slot; pump() stops launching when running.size reaches
|
|
208
|
-
* the limit.
|
|
209
|
-
*/
|
|
210
|
-
concurrencyLimit: number;
|
|
211
|
-
queue: string[];
|
|
212
|
-
/** Every task_id we've ever enqueued in this process — Realtime OR poll. */
|
|
213
|
-
seen: Set<string>;
|
|
214
|
-
pumping: boolean;
|
|
215
|
-
stopped: boolean;
|
|
216
|
-
heartbeatFailures: number;
|
|
217
|
-
refreshing: Promise<boolean> | null;
|
|
218
|
-
/** Updated_at watermark for the next poll. Initialised at process boot. */
|
|
219
|
-
pollSince: string;
|
|
220
|
-
polling: boolean;
|
|
221
|
-
/**
|
|
222
|
-
* v0.6.2 (v0.12-REVIEW-LOCAL) review queue + bookkeeping. Separate
|
|
223
|
-
* from the task queue: a review for the same task that already ran
|
|
224
|
-
* here is still a different unit of work, and the migration's
|
|
225
|
-
* `review_id` is a uuid so deduplication is per-review not per-task.
|
|
226
|
-
*/
|
|
227
|
-
reviewQueue: ReviewAssignment[];
|
|
228
|
-
seenReviews: Set<string>;
|
|
229
|
-
reviewPumping: boolean;
|
|
230
|
-
runReview: ReviewerFactory;
|
|
231
|
-
/**
|
|
232
|
-
* v0.48: in-memory quarantine flag. Loaded from the quarantine file at
|
|
233
|
-
* startup and set immediately when a classified machine-level failure
|
|
234
|
-
* is detected. Checked synchronously in pump() to avoid an async hop
|
|
235
|
-
* that would break the test timing invariant.
|
|
236
|
-
*/
|
|
237
|
-
quarantined: boolean;
|
|
238
|
-
/**
|
|
239
|
-
* v0.49 T-49-6: task ids that have already consumed their one-shot
|
|
240
|
-
* auth_expired token-refresh retry. A transient auth_expired (token
|
|
241
|
-
* lapsed mid-task) triggers a single JWT refresh before quarantine;
|
|
242
|
-
* if the refresh recovers, the runner stays online. A second
|
|
243
|
-
* auth_expired on the same task (refresh didn't actually fix it)
|
|
244
|
-
* falls straight through to quarantine instead of looping refreshes.
|
|
245
|
-
*/
|
|
246
|
-
authRetriedTasks: Set<string>;
|
|
247
|
-
/**
|
|
248
|
-
* v0.12.0 (T-52-7): idle TTL. null = disabled (desktop default).
|
|
249
|
-
* lastActivityMs is touched on every enqueue, task completion, and
|
|
250
|
-
* review completion; the idle timer compares it against idleTtlMs
|
|
251
|
-
* only while no work is queued or in flight.
|
|
252
|
-
*/
|
|
253
|
-
idleTtlMs: number | null;
|
|
254
|
-
lastActivityMs: number;
|
|
255
|
-
idleTimer: NodeJS.Timeout | null;
|
|
256
|
-
/** Guards the idle-exit sequence against double-firing. */
|
|
257
|
-
idleExiting: boolean;
|
|
258
|
-
/**
|
|
259
|
-
* v0.56 (T-56-1): the task runner factory, stashed so the capacity
|
|
260
|
-
* pause/resume helpers can re-drive poll + pump without threading the
|
|
261
|
-
* factory through pumpReviews and the resume timer.
|
|
262
|
-
*/
|
|
263
|
-
taskRunnerFactory: typeof runTask;
|
|
264
|
-
/**
|
|
265
|
-
* v0.56 (T-56-1): capacity pause. While true, pump() and pumpReviews()
|
|
266
|
-
* refuse to claim — the Claude account is out of session/usage capacity.
|
|
267
|
-
* Tasks already in flight finish (or themselves report capacity); queued
|
|
268
|
-
* work stays queued until resume. Heartbeats continue throughout so the
|
|
269
|
-
* board shows the runner online-but-paused rather than crashed.
|
|
270
|
-
*/
|
|
271
|
-
pausedCapacity: boolean;
|
|
272
|
-
/** Epoch ms the runner intends to resume at (null when not paused). */
|
|
273
|
-
pausedUntil: number | null;
|
|
274
|
-
/** Resume timer; cleared on stop() and on re-pause. */
|
|
275
|
-
pauseTimer: NodeJS.Timeout | null;
|
|
276
|
-
/**
|
|
277
|
-
* v0.56 (T-56-1): single-probe clamp. Set on resume so the runner claims
|
|
278
|
-
* exactly ONE task to confirm the window reopened before unleashing full
|
|
279
|
-
* concurrency (and before resuming reviews). Cleared by the first
|
|
280
|
-
* non-capacity completion, or immediately if there is no task to probe.
|
|
281
|
-
*/
|
|
282
|
-
capacityProbe: boolean;
|
|
283
|
-
/** v0.56 (T-56-1): backoff + jitter knobs (overridable for tests). */
|
|
284
|
-
capacityBackoffMs: number;
|
|
285
|
-
resumeJitterMs: number;
|
|
286
|
-
/**
|
|
287
|
-
* v0.14.0 (T-54-2): the single-instance lock held for cfg.repoPath, or
|
|
288
|
-
* null when enforcement is off (tests). Released in stop().
|
|
289
|
-
*/
|
|
290
|
-
singletonLock: SingletonLock | null;
|
|
291
|
-
}
|
|
292
|
-
export declare function resubscribeChannel(state: WatchState, factory: typeof runTask): Promise<void>;
|
|
293
|
-
export declare function watchCommand(options?: WatchOptions): Promise<WatchHandle>;
|
|
294
|
-
export {};
|
|
295
|
-
//# sourceMappingURL=watch.d.ts.map
|
package/dist/watch.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file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