@nodii/dev 0.6.218 → 0.6.220

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 CHANGED
@@ -166,6 +166,7 @@ nodii-dev heavy run --size light -- bun test tests/unit/money.test.ts
166
166
  nodii-dev heavy run -- git push -u origin HEAD
167
167
  nodii-dev heavy run --tighten memory=40 -- true # refused (exit 75) unless 40 GB is available
168
168
  nodii-dev heavy status
169
+ nodii-dev heavy run --help # prints the usage; takes no slot and runs nothing
169
170
  ```
170
171
 
171
172
  - **The machine's floor (DEV-PROCESS-2).** Every job reads the floor before it queues and again when a slot is free (`src/machine-floor.js`). Available memory, after what running jobs hold back for their peaks, must be at least 10 GB (5 GB for a light job); swap used at most 24 GB; disk free at least 15 GB. A running job holds back its class's peak (7 GB heavy, 1 GB light) less what its process tree uses now. Under the floor a job exits 75 at once with `MACHINE_UNDER_FLOOR`, naming the reading, the figure and the five largest holders of memory. It is never queued and never let through: there is no exception for a lone job, a landing or a push (hub-490). The readings use the system tools' absolute paths (`/usr/bin/vm_stat`, `/usr/sbin/sysctl vm.swapusage`, `/bin/df -Pk /`), on the install's own node.
@@ -843,6 +844,12 @@ nodii-dev lane leeway KEY --blocker ISSUE [--repo NAME] [--parent LEEWAY_ID] --r
843
844
  # ask the machine coordinator for leeway to fix the blocker
844
845
  # instead of ending BLOCKED (MW1-12.6, DEC-0486); the ask
845
846
  # claims the blocker issue for the lane (MW1-21.1)
847
+ nodii-dev lane leeway KEY --reason TEXT
848
+ # DEV-PROCESS-1 item 10 (hub-652): with no --blocker, an ask
849
+ # for extra time on the lane's current step. Dev grants it
850
+ # by rule, within its cap, with no person asked, and the CLI
851
+ # prints the step's new limit. --repo and --parent go with
852
+ # --blocker only
846
853
  nodii-dev lane leeway grant ID [--note TEXT] [--source PATH] [--worktree PATH]
847
854
  nodii-dev lane leeway refuse ID [--note TEXT]
848
855
  # the lane's machine coordinator or staff. The coordinator's grant
@@ -867,6 +874,10 @@ nodii-dev lane resume --host-lost [--tighten READING=GB]
867
874
  nodii-dev lane transfer KEY --reason TEXT [--to-agent ID]
868
875
  # move a host_lost lane to the recovering agent on this
869
876
  # machine under a fresh run (AGENT-HARNESS-67)
877
+ nodii-dev lane resume KEY --class short|no-build
878
+ # DEV-PROCESS-1 item 10: a class with no --profile is sent
879
+ # as the run's work class, which Dev accepts by rule; a
880
+ # --profile still needs its --class
870
881
  nodii-dev lane resume KEY --profile PATH --class long|short|no-build
871
882
  # coordinator or staff (MW1-38.5): start the fresh run on
872
883
  # another registered account, read fresh first. The lane
@@ -878,11 +889,11 @@ nodii-dev lane resume KEY --profile PATH --class long|short|no-build
878
889
  # offline or unread account, and LANE_ALREADY_ON_ACCOUNT. A
879
890
  # lane stopped by two deaths moves off an exhausted account
880
891
  # with no amendment or override, and its death count restarts
881
- # NODII-DEV-CLI-191: any lane resume first reads the
882
- # profiles recorded exhausted (see "Account failures" below).
883
- # A lane on one is moved to another account of its runtime
884
- # whose fresh band admits its class, and the output says so;
885
- # with none it is refused ACCOUNT_EXHAUSTED naming the reset.
892
+ # DEV-PROCESS-1 item 7: a lane on an account Dev has
893
+ # stopped (see "Account failures" below) is moved by Dev to
894
+ # another account of its runtime with headroom, and the
895
+ # output says so; with none Dev refuses ACCOUNT_EXHAUSTED
896
+ # naming the next try and the stated reset.
886
897
  # --profile naming another account goes as before
887
898
  nodii-dev lane resume KEY [--override --reason TEXT]
888
899
  # --override (coordinator): resume a lane the two-identical-
@@ -957,6 +968,29 @@ nodii-dev lane list [--kind KIND] [--status STATUS] [--machine UUID]
957
968
  nodii-dev lane show KEY
958
969
  nodii-dev lane prioritize|deprioritize KEY --reason TEXT
959
970
  nodii-dev lane stop KEY --reason TEXT
971
+ # DEV-PROCESS-1 item 4 (hub-654): also ends every process
972
+ # carrying the lane's key on this machine (its runtime,
973
+ # supervisor, child, nohup, setsid and heavy-slot jobs, and
974
+ # their descendants), found by key, never by cwd; a lane
975
+ # whose key extends this one's, a sibling worktree, the cap
976
+ # keepalive and the watchdog are left running
977
+ nodii-dev lane pause KEY --reason TEXT
978
+ # DEV-PROCESS-1 items 4 and 5 (hub-653, hub-654, MW1-36.6):
979
+ # the machine's coordinator or the operator, no code. Dev
980
+ # records the pause; then every process carrying the lane's
981
+ # key on this machine is stopped with SIGSTOP (its memory
982
+ # and heavy slots stay held). While paused, every resume is
983
+ # refused LANE_PAUSED, the sweep marks it neither Quiet nor
984
+ # Orphan, and no keepalive or host-lost resume starts it;
985
+ # it still counts in the lane cap and as stuck.
986
+ # LANE_SIGNAL_INCOMPLETE: a process did not reach the state
987
+ nodii-dev lane continue KEY
988
+ # clears the pause in Dev and wakes the same processes with
989
+ # SIGCONT
990
+ # Pause, continue and stop are local (MW1-37.3): for a lane
991
+ # Dev places on another machine they are refused
992
+ # COORDINATOR_OTHER_MACHINE, naming that machine, before
993
+ # Dev records anything
960
994
  nodii-dev lane non-issue KEY --reason TEXT --evidence TEXT --reroute KEY[,KEY]|none
961
995
  --branch carried:ISSUE|dropped[:REASON] [--commits SHA[,SHA]]
962
996
  nodii-dev next KEY [--paths A,B] [--components K,L] [--role ROLE]
@@ -1011,8 +1045,9 @@ nodii-dev watchdog sweep # the job's entrypoint; normally
1011
1045
  `nodii-dev harness drill lanes` is the frozen done check of DEV-PROCESS-1,
1012
1046
  Part A. The machine's coordinator runs it, under its own config, from the
1013
1047
  installed release. It is never run by the lane that built it. It runs for
1014
- about an hour, with no model and no typed code, and exits 1 unless checks
1015
- 1 to 12 all hold. It prints every pid, run id and Dev record it reads.
1048
+ about an hour, with no model and no typed code, and exits 1 unless all twelve hold:
1049
+ Bounds, Dead, Stopped, Paused then stopped, Left alone, Named, Not back,
1050
+ Headroom, Waits, By rule, Codes and Publish. It prints every pid, run id and Dev record it reads.
1016
1051
 
1017
1052
  - **Stub lanes.** The drill starts scratch lanes on the `stub` runtime
1018
1053
  (`src/drill-stub.js`). Dev admits them under ruling A: no override, outside
@@ -1034,11 +1069,11 @@ about an hour, with no model and no typed code, and exits 1 unless checks
1034
1069
  stub accounts offline.
1035
1070
  - **Recorded routes.** Every process the drill starts preloads a route
1036
1071
  recorder (`NODE_OPTIONS` for Node, `BUN_OPTIONS` for Bun) that logs method,
1037
- host and path only. Check 11 reads the whole run's routes after every check
1072
+ host and path only. The Codes check reads the whole run's routes after every check
1038
1073
  and the cleanup.
1039
1074
  - **Fixtures** are the planner's, frozen under
1040
1075
  `~/Projects/_handoff/dev-process-2026-11-23/evidence/o1/`. A missing fixture
1041
- fails the check that needs it. Check 10 reads the red run's line
1076
+ fails the check that needs it. The By rule check reads the red run's line
1042
1077
  `check 10 codes: SHORT_CODE EXTRA_CODE` from `o1-red-run.txt`.
1043
1078
  - **Scratch files** go under `~/.nodii/drill/<run>/` and are kept.
1044
1079
  - **Up front and on every exit.** A config whose edge is not dev Dev's is
@@ -1921,8 +1956,9 @@ basis until the MW clause it is drafting is uploaded. The hook's shape follows
1921
1956
  the planner's done-check decisions on that page.
1922
1957
 
1923
1958
  `harness install` and `harness update` (not `--dry-run`) also write a git
1924
- hook, `push-hook.sh` from this package, as both `post-commit` and
1925
- `post-rewrite` in the directory `git rev-parse --git-path hooks` names, so a
1959
+ hook, `push-hook.sh` from this package, as `post-commit`, `post-rewrite`
1960
+ and `post-merge` (git runs `post-merge`, not `post-commit`, after `git merge`
1961
+ makes a merge commit) in the directory `git rev-parse --git-path hooks` names, so a
1926
1962
  `core.hooksPath` is respected. They do this first, from the CLI's own copy,
1927
1963
  so a checkout that cannot reach Dev still gets them. That holds in a lane
1928
1964
  session too: when the lane's own checks refuse the command first (no sign-in,
@@ -1948,6 +1984,12 @@ worker pushes the tip. In the background, the worker:
1948
1984
  - pushes the current branch's tip to `origin`, never with force and never
1949
1985
  `main` or `master`. A commit on a detached HEAD is not pushed: an `INFO`
1950
1986
  line logs it.
1987
+ - pushes through `nodii-dev heavy run` (the `nodii-dev` on PATH), so the push
1988
+ and the repository's `pre-push` gates take a slot and read the machine
1989
+ floor like any push (MW2-51, DEV-PROCESS-2; hub-729). Under the
1990
+ floor (exit 75), or with no `nodii-dev` on PATH, nothing is pushed: it logs
1991
+ `not pushed SHA attempt=N: under the machine floor` (or `no nodii-dev on
1992
+ PATH`) and retries on the schedule below. It never pushes around the queue.
1951
1993
  - first scans the commits not yet on any origin ref with
1952
1994
  `gitleaks git --redact`. A finding means no push, `secret found: RULE FILE
1953
1995
  (commit SHORT)` in the log and the state `push blocked: secret`. gitleaks
@@ -2249,27 +2291,38 @@ which it also ends blocked from the lane's record. Every report carries `exit_co
2249
2291
  `lane_status` evidence. `process.pid` still holds the runtime's own PID, and the
2250
2292
  supervisor appends its report line to `process.log`.
2251
2293
 
2252
- **Account failures (NODII-DEV-CLI-191).** When the newest line the runtime
2253
- itself wrote (not a tool's output) names a usage limit (`Claude AI usage limit
2254
- reached|EPOCH`, `You've hit your limit` or `You've hit your weekly limit`, a
2255
- result record whose `api_error` is `usage_limit_reached`, `5-hour limit reached
2256
- ∙ resets 3pm`, a weekly limit, Codex's `You've hit your usage limit ... try again at|in ...`),
2257
- an auth failure (`OAuth token has expired`, `401`, `authentication_error`,
2258
- `Invalid API key`, `Please run /login`) or a network one (Cloudflare,
2259
- `cf-ray`, `ECONNRESET`, `ETIMEDOUT`, `fetch failed`, `529 Overloaded`), the
2260
- unfinished exit is reported with the fingerprint `lane-account-usage_limit`,
2261
- `lane-account-auth` or `lane-account-network`, and the reason names the kind,
2262
- the reset time and the line. The run's profile (`CLAUDE_CONFIG_DIR` or
2263
- `CODEX_HOME`, else `~/.claude` or `~/.codex`) is recorded exhausted until the
2264
- reset the line gives, else for 5 hours (a limit) or 1 hour (auth, network), in
2265
- `exhausted-accounts.json` in the nodii-dev config directory (beside
2266
- `config.json`). A later, shorter failure never shortens a recorded wait. The
2267
- supervisor does not continue the same session on such a failure. `lane resume`
2268
- reads the file before it asks Dev for a run: a lane whose recorded profile is
2269
- still exhausted moves to another registered account of its runtime on this
2270
- machine whose fresh band admits the lane's class (`ok` for long work), or is
2271
- refused `ACCOUNT_EXHAUSTED` naming the reset; `--profile` naming the exhausted
2272
- profile is refused too.
2294
+ **Account failures (DEV-PROCESS-1 items 6 and 7).** The CLI classifies no
2295
+ ending and reads no log for one. Dev classes each run's ending from the
2296
+ final-record facts below (the runtime's own output and its exit code). An
2297
+ account kind (`weekly_limit`, `codex_usage_limit`, `spend_limit`,
2298
+ `subscription_403`, `auth_expired`, `other_limit`) is an account death: Dev
2299
+ names the death's fingerprint `lane-account-KIND`, puts a stop mark on the
2300
+ account, and tries it again one hour after the death. The stated reset is
2301
+ shown, never used as the wake time. The supervisor prints the ending Dev
2302
+ answered with. It continues the same session only when Dev does not class the
2303
+ turn an account death (`POST /run-endings/classify`). `lane resume` asks Dev,
2304
+ which moves a lane off a stopped account to another of its runtime with
2305
+ headroom, or refuses `ACCOUNT_EXHAUSTED`. Older releases kept their own
2306
+ `exhausted-accounts.json`; this one neither writes nor reads it.
2307
+
2308
+ **Final-record facts (DEV-PROCESS-1 items 3 and 6).** Every exit report, on
2309
+ every path, carries the run's `finalRecord`. It is read from the runtime's own
2310
+ output as it streams, never from the run log, which the lane can write. It
2311
+ holds:
2312
+ - the runtime, its exit code or signal, and `source: "runtime_output"`;
2313
+ - the raw final records, redacted: the last result, the last rate-limit event,
2314
+ the last synthetic assistant message, and Codex's last `turn.failed`,
2315
+ `turn.completed` and error events;
2316
+ - the run's tokens `{input, output, cacheRead, cacheWrite}`, summed from its
2317
+ usage records across same-session continuations (O3 item 2);
2318
+ - the lane worktree's `git {head, branch, dirty, aheadOfBase}` at exit
2319
+ (O3 item 2).
2320
+
2321
+ Dev classifies these facts; the CLI grows no classifier. A report Dev does not
2322
+ answer is tried again for about 10 minutes, and Dev's own answer is final. A
2323
+ run the harness ends on purpose (lane pause, lane stop, a coordinator's end)
2324
+ carries `harnessEnd {by, reason, signal, at}`, which Dev records and does not
2325
+ count as a death.
2273
2326
 
2274
2327
  Before it reports an unfinished exit, the supervisor continues the same session
2275
2328
  (NODII-DEV-CLI-9) unless the lane waits on a typed human gate
package/dist/accounts.js CHANGED
@@ -93,7 +93,7 @@ export async function readClaudeUsage(profile, { credential = claudeCredential,
93
93
  } catch (error) {
94
94
  throw new CliError("ACCOUNT_USAGE_UNAVAILABLE", `Anthropic's usage endpoint was unreachable for ${profile} (${error?.cause?.code ?? error?.name ?? "network error"}).`, 1);
95
95
  }
96
- if (!response.ok) throw new CliError("ACCOUNT_USAGE_UNAVAILABLE", `Anthropic's usage endpoint answered ${response.status} for ${profile}.`, 1);
96
+ if (!response.ok) throw new CliError("ACCOUNT_USAGE_UNAVAILABLE", `Anthropic's usage endpoint answered ${response.status} for ${profile}.`, 1, { httpStatus: response.status });
97
97
  const body = await response.json();
98
98
  const window = (value) => value && typeof value.utilization === "number"
99
99
  ? { utilization: value.utilization, resetsAt: isoOrNull(value.resets_at) }
@@ -224,47 +224,6 @@ async function resolveCodexBin(run = execFile) {
224
224
  catch { return null; }
225
225
  }
226
226
 
227
- // NODII-DEV-CLI-191: a profile whose lane run died on a usage limit, auth
228
- // or the network, until its reset. The lane supervisor writes it (as the
229
- // lane's identity, whose config sits under agents/) and lane resume reads it
230
- // (as the coordinator's), so it lives in the nodii-dev dir both share.
231
- export function exhaustedAccountsPath(path = configPath()) {
232
- const dir = dirname(path);
233
- return join(basename(dir) === "agents" ? dirname(dir) : dir, "exhausted-accounts.json");
234
- }
235
-
236
- async function readExhausted(path, read = readFile) {
237
- try {
238
- const entries = JSON.parse(await read(path, "utf8"));
239
- return entries && typeof entries === "object" && !Array.isArray(entries) ? entries : {};
240
- } catch { return {}; }
241
- }
242
-
243
- const liveOnly = (entries, now) => Object.fromEntries(Object.entries(entries)
244
- .filter(([, entry]) => Date.parse(entry?.until) > now.getTime()));
245
-
246
- /** The profiles recorded exhausted whose reset has not come yet, by profile. */
247
- export async function liveExhaustedAccounts({ path = exhaustedAccountsPath(), now = () => new Date(), read = readFile } = {}) {
248
- return liveOnly(await readExhausted(path, read), now());
249
- }
250
-
251
- /**
252
- * Record a profile exhausted until `entry.until`. A later failure with an
253
- * earlier time never shortens a recorded wait; entries past their time are
254
- * dropped.
255
- */
256
- export async function recordExhaustedAccount(profile, entry, { path = exhaustedAccountsPath(), now = () => new Date() } = {}) {
257
- const key = profilePath(profile);
258
- const entries = liveOnly(await readExhausted(path), now());
259
- const recorded = entries[key];
260
- if (!recorded || Date.parse(entry.until) >= Date.parse(recorded.until)) entries[key] = entry;
261
- await mkdir(dirname(path), { recursive: true, mode: 0o700 });
262
- const temporary = `${path}.tmp-${process.pid}`;
263
- await writeFile(temporary, `${JSON.stringify(entries, null, 2)}\n`, { mode: 0o600 });
264
- await rename(temporary, path);
265
- return entries[key];
266
- }
267
-
268
227
  /**
269
228
  * hub-242: the accounts the operator ruled out for lanes (19 Nov: no lanes on
270
229
  * ~/.claude-naman-sahni-at-nodii). The roster is the operator's call (MW1-38.3),
@@ -290,7 +249,7 @@ const ADMITS = { long: ["ok"], short: ["ok", "warning", "short_only"], no_build:
290
249
  /**
291
250
  * Another registered account of the runtime on this machine whose freshly
292
251
  * read band admits the work class, skipping `from`, the `exclude`d
293
- * (recorded exhausted) profiles and the operator's excluded ones (hub-242); null when none has headroom or the
252
+ * profiles and the operator's excluded ones (hub-242); null when none has headroom or the
294
253
  * accounts cannot be listed.
295
254
  */
296
255
  export async function pickHeadroomAccount({ runtime, from, exclude = [], workClass = "long" }, { request = devRequest, config = readConfig, readers = READERS, home = homedir() } = {}) {
@@ -322,6 +281,16 @@ export async function readStubUsage(profile, { read = readFile, now = () => new
322
281
 
323
282
  const READERS = { claude: readClaudeUsage, codex: readCodexUsage, stub: readStubUsage };
324
283
 
284
+ /**
285
+ * DEV-PROCESS-1 item 8: what a probe that took no reading tells Dev. A 429
286
+ * keeps the account's last reading (Dev shows it with its age); an expired
287
+ * sign-in is named once, for a person, and nothing here signs in or out.
288
+ */
289
+ export function probeOutcome(error, now = new Date()) {
290
+ const status = error?.code === "ACCOUNT_TOKEN_EXPIRED" ? "sign_in_needed" : error?.details?.httpStatus === 429 ? 429 : "unavailable";
291
+ return { status, at: now.toISOString(), message: String(error?.message ?? error).slice(0, 500) };
292
+ }
293
+
325
294
  /** The usage ceiling body Dev stores for one reading. */
326
295
  export function usageReport(reading) {
327
296
  const state = usageState(reading.windows);
@@ -374,7 +343,10 @@ export async function reportUsage(accounts, { request = devRequest, readers = RE
374
343
  await request("POST", `/api/v1/runners/${encode(account.id)}/heartbeat`, {});
375
344
  results.push({ runnerId: account.id, runtime: account.runtime, profile: account.profile, state: body.state, band: usageBand(reading.windows), resetsAt: body.resetsAt, ...reading.windows });
376
345
  } catch (error) {
377
- results.push({ runnerId: account.id, runtime: account.runtime, profile: account.profile, error: { code: error?.code ?? "ACCOUNT_USAGE_UNAVAILABLE", message: error?.message ?? String(error) } });
346
+ // DEV-PROCESS-1 item 8: Dev hears how the probe ended; it keeps the last reading. A Dev without this refuses it, which changes nothing.
347
+ const probeResult = probeOutcome(error);
348
+ await request("POST", `/api/v1/runners/${encode(account.id)}/usage`, { probe: probeResult }).catch(() => {});
349
+ results.push({ runnerId: account.id, runtime: account.runtime, profile: account.profile, probe: probeResult, error: { code: error?.code ?? "ACCOUNT_USAGE_UNAVAILABLE", message: error?.message ?? String(error) } });
378
350
  }
379
351
  }
380
352
  return results;
package/dist/cdp.js CHANGED
@@ -80,11 +80,22 @@ export async function cdpConnect(port = DEFAULT_CDP_PORT, { fetchImpl = fetch, W
80
80
  });
81
81
  const opened = new Set();
82
82
 
83
- /** Opens a background tab of our own and attaches to it. */
83
+ /**
84
+ * Opens a background tab of our own and attaches to it. DEV-PROCESS-1 item
85
+ * 12 (CLI-285, CLI-160): before the page loads, the tab is told it has focus
86
+ * (so Figma's keyboard actions reach it in a background or headless Chrome,
87
+ * without taking the operator's window) and, when Chrome runs headless, it
88
+ * sends the plain Chrome user agent: Figma refuses a HeadlessChrome one.
89
+ */
84
90
  async function openTab(url) {
85
- const { targetId } = await send("Target.createTarget", { url, background: true });
91
+ const { targetId } = await send("Target.createTarget", { url: "about:blank", background: true });
86
92
  opened.add(targetId);
87
93
  const { sessionId } = await send("Target.attachToTarget", { targetId, flatten: true });
94
+ await send("Emulation.setFocusEmulationEnabled", { enabled: true }, sessionId).catch(() => {});
95
+ const agent = (await send("Browser.getVersion").catch(() => ({})))?.userAgent;
96
+ if (typeof agent === "string" && /HeadlessChrome/.test(agent))
97
+ await send("Emulation.setUserAgentOverride", { userAgent: agent.replace(/HeadlessChrome/g, "Chrome") }, sessionId).catch(() => {});
98
+ await send("Page.navigate", { url }, sessionId);
88
99
  const evaluate = async (expression) => {
89
100
  const result = await send("Runtime.evaluate", { expression, returnByValue: true, awaitPromise: true }, sessionId);
90
101
  return result?.result?.value;
@@ -100,6 +111,9 @@ export async function cdpConnect(port = DEFAULT_CDP_PORT, { fetchImpl = fetch, W
100
111
  returnByValue: true,
101
112
  awaitPromise: true,
102
113
  }, sessionId);
114
+ // CLI-115: a page function that throws is an error with its message, never an undefined result.
115
+ if (result?.exceptionDetails)
116
+ throw new CliError("CHROME_CDP_ERROR", `The page threw: ${result.exceptionDetails.exception?.description ?? result.exceptionDetails.text ?? "an exception"}`.slice(0, 500), 1);
103
117
  return result?.result?.value;
104
118
  };
105
119
  const waitFor = async (expression, seconds, { sleep = delay } = {}) => {
package/dist/chrome.js CHANGED
@@ -130,8 +130,10 @@ export async function chromeStart(flags = {}, {
130
130
  if (profileInUse(lines, profile))
131
131
  throw new CliError("CHROME_PROFILE_IN_USE", `A Chrome already runs on ${profile} without DevTools on port ${port}. It was not started by nodii-dev chrome start; quit that window yourself, then run chrome start again.`, 1);
132
132
  await mkdir(profile, { recursive: true, mode: 0o700 });
133
+ // CLI-281 (operator, 22 Nov: "run chrome headless stop focusing my window"): the shared Chrome runs headless,
134
+ // so no lane's tab takes the operator's window; CDP works the same (DEV-PROCESS-1 item 12).
133
135
  const child = spawnImpl(flags.chrome ?? saved.chrome ?? CHROME_APP, [
134
- `--user-data-dir=${profile}`, `--remote-debugging-port=${port}`, "--no-first-run", "--no-default-browser-check",
136
+ `--user-data-dir=${profile}`, `--remote-debugging-port=${port}`, "--no-first-run", "--no-default-browser-check", "--headless=new",
135
137
  ], { detached: true, stdio: "ignore" });
136
138
  child.unref?.();
137
139
  const until = Date.now() + startTimeoutMs;
package/dist/cli.js CHANGED
@@ -149,6 +149,7 @@ import {
149
149
  } from "./runs.js";
150
150
  import { superviseLane } from "./lane-supervisor.js";
151
151
  import { laneLeewayCommand } from "./leeway.js";
152
+ import { lanePauseCommand } from "./lane-pause.js";
152
153
  import { laneDeferCommand, refuseRetiredLaneAsk } from "./lane-asks.js";
153
154
  import { laneInboxCommand, laneMessageCommand } from "./lane-messages.js";
154
155
  import { coordinatorGate, coordinatorItemsCommand, observeLaneItems, resetLaneItemsNotice, takeLaneItemsLine } from "./coordinator-items.js";
@@ -607,6 +608,8 @@ Usage: nodii-dev <command> [options] [--json]
607
608
  # that already holds it and records a wait on it. --repo names the repository
608
609
  # of the fix when the lane does not work in it. The lane keeps working
609
610
  # what is not blocked and starts the fix only after the grant's Delta gather
611
+ lane leeway <key> --reason TEXT # DEV-PROCESS-1 item 10: no blocker is an ask for extra time on the current
612
+ # step; Dev grants it by rule, within its cap, with no person asked
610
613
  lane leeway grant <id> [--note TEXT] [--source PATH] [--worktree PATH]
611
614
  lane leeway refuse <id> [--note TEXT]
612
615
  # the lane's machine coordinator (or staff). The coordinator's grant is
@@ -664,11 +667,10 @@ Usage: nodii-dev <command> [options] [--json]
664
667
  # account's band doesn't admit the class (ACCOUNT_BAND_REFUSED). The lane keeps its
665
668
  # key, branch, worktree, slot and history. A lane stopped by two deaths moves off
666
669
  # an exhausted account with no amendment or override
667
- # NODII-DEV-CLI-191: a run that died on a usage limit, auth or the network is
668
- # reported lane-account-KIND and its profile recorded exhausted until its reset
669
- # (else 5 h for a limit, 1 h otherwise) in exhausted-accounts.json. Any lane resume
670
- # then moves the lane to another account of its runtime with headroom, saying so,
671
- # or refuses ACCOUNT_EXHAUSTED; --profile naming another account still goes
670
+ # DEV-PROCESS-1 items 6 and 7: Dev classes a run's account death from its final
671
+ # record and stops the account for an hour. Any lane resume onto it is moved by
672
+ # Dev to another account of its runtime with headroom, saying so,
673
+ # or refused ACCOUNT_EXHAUSTED; --profile naming another account still goes
672
674
  lane resume <key> [--ungated]
673
675
  # NODII-DEV-CLI-191: a plain resume (also with --profile/--class) of a lane with
674
676
  # waits of its own, or blocked, goes through the --if-changed gate; --ungated (or
@@ -731,6 +733,11 @@ Usage: nodii-dev <command> [options] [--json]
731
733
  lane freeze drop <key> --section SECTION --item ID --reason TEXT
732
734
  lane freeze swap <key> --section SECTION [--item ID] --file VALUE.json --reason TEXT
733
735
  lane freeze show|history <key> # durable compact-safe contract and all versions
736
+ lane pause <key> --reason TEXT # DEV-PROCESS-1: Dev records the lane paused (every resume, keepalive and
737
+ # sweep leaves it alone, LANE_PAUSED), then every process carrying the
738
+ # lane's key on this machine (a child, nohup, setsid and heavy-slot jobs,
739
+ # and their descendants) is stopped with SIGSTOP; its memory stays held
740
+ lane continue <key> # clears the pause in Dev and wakes the same processes with SIGCONT
734
741
  lane stop <key> [<key> ...] --reason TEXT [--sweeper LANE] [--no-closeout] [--no-closeout-push]
735
742
  [--launched-in-error [--replaced-by NEW_KEY]]
736
743
  # hub-400: a lane launched with the wrong brief is stopped, not pivoted;
@@ -844,11 +851,13 @@ Refusals of leeway, the coordinator's items, lane finish, lane resume, the manag
844
851
  MACHINE_REQUIRED The caller coordinates no machine, so Dev cannot tell whose items or leeways to list. Next: pass --machine NAME|ID
845
852
  RESUME_IF_CHANGED_OFF lane resume --if-changed while NODII_DEV_RESUME_IF_CHANGED=0 turns it off. Next: resume without it, as before; unset the variable to turn it back on
846
853
  LANE_MESSAGES_OFF lane message or lane inbox while NODII_DEV_LANE_MESSAGES=0 turns lane messages off. Next: write to the other lane as a comment on its issue, or unset NODII_DEV_LANE_MESSAGES
847
- COORDINATOR_OTHER_MACHINE lane message from a coordinator to a lane Dev places on another machine, or on none (MW1-37.3); nothing is recorded. Next: that machine's coordinator messages it
854
+ COORDINATOR_OTHER_MACHINE lane message from a coordinator to a lane Dev places on another machine, or on none; or lane pause, continue or stop of a lane Dev places on another machine (MW1-37.3). Nothing is recorded. Next: run it on the machine it names
848
855
  ISSUES_GROUP_OFF issues group while NODII_DEV_ISSUES_GROUP=0 turns it off. Next: choose the lane's issue set by hand with issues list, or unset NODII_DEV_ISSUES_GROUP
849
856
  LANE_NOT_FINISHED lane close before the lane's own agent marked the lane finished. Next: the lane runs lane finish KEY --reason TEXT --evidence REF
850
857
  LANE_ALREADY_FINISHED The lane is already marked finished. Next: nothing; its coordinator closes it with lane close
851
- ACCOUNT_EXHAUSTED lane resume would relaunch onto a profile whose last run died on a usage limit, auth or the network, before its recorded reset, and no other account of its runtime has headroom. Next: resume after the reset it names, or move it with lane resume KEY --profile PATH --class CLASS
858
+ LANE_PAUSED lane resume of a lane its coordinator or the operator paused. Next: lane continue KEY, which wakes its processes; never resume a paused lane
859
+ LANE_SIGNAL_INCOMPLETE Dev records the pause or continue, but a process of the lane did not reach that state (or one started meanwhile). Next: run the same lane pause or lane continue again
860
+ ACCOUNT_EXHAUSTED lane resume would relaunch onto an account Dev stopped after an account death, before its next try, and no other account of its runtime has headroom. Next: resume after the reset it names, or move it with lane resume KEY --profile PATH --class CLASS
852
861
  HARNESS_INVALID A managed hook entry is not one nodii-dev command, or Dev's harness cannot take the managed hooks. Next: run harness update, and file the entry as a harness issue
853
862
  HARNESS_SETTINGS_INVALID .claude/settings.json or .codex/hooks.json is not valid JSON. Next: repair the file, then run harness update
854
863
  TOOLING_DOCS_STALE The change touches a tooling file named in nodii.repo.yaml (toolingDocs.tooling) and no docs file (toolingDocs.docs), so hook tooling-docs refuses the push or the pull request (MW1-46.3). Next: update the docs in the same change, or add the commit trailer Docs-unaffected: <reason>; check with repo docs-check
@@ -1439,6 +1448,10 @@ export async function main(argv = process.argv.slice(2)) {
1439
1448
  if (command === "lane" && action === "message") return emitCommand(await laneMessageCommand(rest, f));
1440
1449
  if (command === "lane" && action === "inbox") return emitCommand(await laneInboxCommand(rest, f));
1441
1450
  if (command === "lane" && action === "cap") return emitCommand(await laneCapCommand(rest, f));
1451
+ if (command === "lane" && (action === "pause" || action === "continue")) {
1452
+ if (rest.length !== 1) throw new CliError("USAGE", `lane ${action} takes one lane key, got: ${rest.join(" ") || "none"}.`, 2);
1453
+ return emitCommand(await lanePauseCommand(action, rest[0], f));
1454
+ }
1442
1455
  if (command === "lane" && action === "close") {
1443
1456
  const result = await laneClose(rest[0], f);
1444
1457
  return emit({ data: result.data }, json, result.text);
@@ -133,6 +133,11 @@ async function boardJob(ctx) {
133
133
  /**
134
134
  * apply-watch: when the operator has decided every item of a set, Dev wakes no
135
135
  * one (hub-389). Tell the holder as a fact, once, and resume it if it's down.
136
+ * DEV-PROCESS-1 item 10 (hub-608, CLI-235): the fact goes as a lane message,
137
+ * never an amendment, so it waits on no one and costs the operator no code;
138
+ * the job's state keeps the set told across a watch restart. CLI-227: only a
139
+ * holder lane on this machine is told or resumed; another machine's
140
+ * coordinator tells its own.
136
141
  */
137
142
  async function applyWatchJob(ctx) {
138
143
  const state = ctx.jobState;
@@ -141,10 +146,14 @@ async function applyWatchJob(ctx) {
141
146
  const alive = await ctx.processes();
142
147
  const alerts = [];
143
148
  const done = [];
149
+ const machineId = await ctx.machineId();
150
+ const here = new Map();
144
151
  for (const set of sets) {
152
+ if (!here.has(set.holderLane)) here.set(set.holderLane, (await laneDetail(set.holderLane, ctx.request).catch(() => null))?.machineId === machineId);
153
+ if (!here.get(set.holderLane)) continue;
145
154
  const seen = state.sets[set.id];
146
155
  if (!seen) {
147
- await ctx.amend(set.holderLane, `FACT (coordinator watch, ${ctx.stamp()}): the operator has decided every item of ${set.id} ("${set.title}"), and Dev now shows it applying. Later sets on this file wait behind it (MW8-4.1).`, `fact: ${set.id} decided`);
156
+ await ctx.message(set.holderLane, `FACT (coordinator watch, ${ctx.stamp()}): the operator has decided every item of ${set.id} ("${set.title}"), and Dev now shows it applying. Later sets on this file wait behind it (MW8-4.1).`);
148
157
  state.sets[set.id] = { notedAt: new Date(ctx.now()).toISOString(), lane: set.holderLane };
149
158
  done.push(`${set.id}->${set.holderLane} noted`);
150
159
  }
@@ -159,7 +168,8 @@ async function applyWatchJob(ctx) {
159
168
  }
160
169
  }
161
170
  for (const id of Object.keys(state.sets)) if (!sets.some((set) => set.id === id)) delete state.sets[id];
162
- return { summary: `${sets.length} decided set(s) applying${done.length ? `: ${done.join("; ")}` : ""}`, alerts };
171
+ const others = [...here.values()].filter((onThisMachine) => !onThisMachine).length;
172
+ return { summary: `${sets.length} decided set(s) applying${others ? ` (${others} holder lane(s) on other machines, left to their coordinators)` : ""}${done.length ? `: ${done.join("; ")}` : ""}`, alerts };
163
173
  }
164
174
 
165
175
  /** publish-watch: finished sets (awaiting_publish) are published, by file, through the shared Chrome. */
@@ -199,7 +209,8 @@ async function publishWatchJob(ctx) {
199
209
  * count, and Dev's own stuck flag is not used: it stays set after a lane merges.
200
210
  */
201
211
  export async function realStuck(ctx) {
202
- const lanes = (await machineLanes(await ctx.machineId(), ctx)).filter((lane) => lane.status === "building" && !lane.key.startsWith("steward-"));
212
+ // DEV-PROCESS-1 item 5: a paused lane is left alone: its stopped processes are not down, and Dev refuses its resume LANE_PAUSED.
213
+ const lanes = (await machineLanes(await ctx.machineId(), ctx)).filter((lane) => lane.status === "building" && !lane.key.startsWith("steward-") && !lane.paused);
203
214
  const alive = await ctx.processes();
204
215
  const stuck = [];
205
216
  for (const lane of lanes) {
@@ -279,7 +290,8 @@ async function orphanSlotsJob(ctx) {
279
290
  async function keepaliveJob(ctx) {
280
291
  const settings = await readCoordinatorSettings(ctx.home);
281
292
  const domains = settings.domains ?? DEFAULT_DOMAINS;
282
- const lanes = (await machineLanes(await ctx.machineId(), ctx)).filter((lane) => lane.status === "building" && !lane.key.startsWith("steward-"));
293
+ // DEV-PROCESS-1 item 5: a paused lane is left alone: its stopped processes are not down, and Dev refuses its resume LANE_PAUSED.
294
+ const lanes = (await machineLanes(await ctx.machineId(), ctx)).filter((lane) => lane.status === "building" && !lane.key.startsWith("steward-") && !lane.paused);
283
295
  const alive = await ctx.processes();
284
296
  const state = ctx.jobState;
285
297
  state.blockedResumedAt ??= {};
@@ -376,6 +388,12 @@ export function watchContext({ home = homedir(), request = devRequest, config =
376
388
  await amendLaneCommand(key, { rules, reason });
377
389
  await log?.(`amend ${key}: ${reason}`);
378
390
  },
391
+ // DEV-PROCESS-1 item 10: a fact reaches a lane as a message: it waits on no one.
392
+ message: async (key, body) => {
393
+ const { laneMessageCommand } = await import("./lane-messages.js");
394
+ await laneMessageCommand([key], { body }, { request });
395
+ await log?.(`message ${key}: ${body.slice(0, 80)}`);
396
+ },
379
397
  tryResume: async (key, { priority, ifChanged = false, ungated = false }) => {
380
398
  const hold = await exists(holdPath(home, "keepalive"));
381
399
  const verdict = resumeAllowed(await ctx.guards(), { priority, hold });
package/dist/core.js CHANGED
@@ -4,7 +4,7 @@ import { chmod, lstat, mkdir, readFile, rename, rm, writeFile } from "node:fs/pr
4
4
  import { homedir, platform } from "node:os";
5
5
  import { basename, dirname, join } from "node:path";
6
6
 
7
- export const VERSION = "0.6.218";
7
+ export const VERSION = "0.6.220";
8
8
  export const configPath = () =>
9
9
  process.env.NODII_DEV_CONFIG_PATH ??
10
10
  join(homedir(), ".config/nodii-dev/config.json");
@@ -123,11 +123,13 @@ export async function figmaPublish(file, flags = {}, {
123
123
  request = devRequest, connect = cdpConnect, home = homedir(), env = process.env, sleep = delay,
124
124
  figmaGet, log = (line) => appendFile(publishLogPath(home), `${line}\n`), loadSeconds = 20, portOf,
125
125
  } = {}) {
126
- if (!file) throw new CliError("USAGE", "figma publish FILE_KEY --sets CS-1,CS-2 [--dry-run]", 2);
126
+ if (!file) throw new CliError("USAGE", "figma publish FILE_KEY --sets CS-1,CS-2 [--dry-run] | figma publish FILE_KEY --dry-run", 2);
127
127
  const fileKey = figmaFileKey(file);
128
- const ids = parseSets(flags.sets);
129
128
  const dryRun = Boolean(flags["dry-run"]);
130
- const sets = await finishedSets(fileKey, ids, { request });
129
+ // DEV-PROCESS-1 item 12: a dry run with no --sets lists what the dialog would publish, ticking nothing.
130
+ const listing = dryRun && flags.sets === undefined;
131
+ const ids = listing ? [] : parseSets(flags.sets);
132
+ const sets = listing ? [] : await finishedSets(fileKey, ids, { request });
131
133
  const get = dryRun ? null : (figmaGet ?? figmaClient(figmaToken(env)));
132
134
  const before = get ? await newestVersion(get, fileKey) : null;
133
135
  const port = await (portOf ?? (() => sharedChromePort({ home, request })))();
@@ -148,10 +150,20 @@ export async function figmaPublish(file, flags = {}, {
148
150
  await tab.key("Enter", { keyCode: 13 });
149
151
  if (!(await tab.waitFor(DIALOG_OPEN, 30, { sleep })))
150
152
  throw new CliError("PUBLISH_DIALOG_NOT_FOUND", "Figma's Publish library dialog did not open (nothing to publish, or the file is not a library).", 1);
151
- const synced = await tab.call(DIALOG_SYNC, [sets.flatMap((set) => set.names), true]);
152
- if (synced?.error) throw new CliError("PUBLISH_DIALOG_UNREADABLE", synced.error, 1);
153
+ // CLI-115: a read that returns nothing is refused by name, the dialog cancelled; never a TypeError.
154
+ const unreadable = async (read, what) => {
155
+ if (read && typeof read === "object" && !read.error && Array.isArray(read.rows)) return read;
156
+ await tab.call(CLICK_BUTTON, ["Cancel"]).catch(() => {});
157
+ throw new CliError("PUBLISH_DIALOG_UNREADABLE", `${what}: ${read?.error ?? "the dialog's rows could not be read"}. Nothing was published.`, 1);
158
+ };
159
+ if (listing) {
160
+ const seen = await unreadable(await tab.call(DIALOG_SYNC, [[], false]), "Listing the dialog");
161
+ await tab.call(CLICK_BUTTON, ["Cancel"]);
162
+ return { ...syncReport([], seen.rows, seen.total ?? null), rows: seen.rows.map((row) => row.name) };
163
+ }
164
+ await unreadable(await tab.call(DIALOG_SYNC, [sets.flatMap((set) => set.names), true]), "Setting the rows");
153
165
  // Read it again without touching it: the dialog is what gets published.
154
- const check = await tab.call(DIALOG_SYNC, [[], false]);
166
+ const check = await unreadable(await tab.call(DIALOG_SYNC, [[], false]), "Reading the rows back");
155
167
  const result = syncReport(sets, check.rows, check.total ?? null);
156
168
  if (result.wrong.length) {
157
169
  await tab.call(CLICK_BUTTON, ["Cancel"]);
@@ -189,7 +201,7 @@ export async function figmaPublish(file, flags = {}, {
189
201
  }
190
202
  }
191
203
  }
192
- const data = { fileKey, dryRun, published, version, sets: ids, ...report, recorded, notRecorded };
204
+ const data = { fileKey, dryRun, published, version, sets: ids, ...report, rows: report.rows ?? [...report.ticked, ...report.unticked], recorded, notRecorded };
193
205
  await mkdir(join(home, ".config", "nodii-dev", "coordinator"), { recursive: true, mode: 0o700 }).catch(() => {});
194
206
  await log(JSON.stringify({ at: new Date().toISOString(), ...data })).catch(() => {});
195
207
  return data;
package/dist/flags.js CHANGED
@@ -58,6 +58,8 @@ export const COMMAND_FLAGS = {
58
58
  "lane transfer": ["reason", "to-agent"],
59
59
  "inbox ack": ["note"],
60
60
  "lane stop": ["reason", "sweeper", "no-closeout", "no-closeout-push", "launched-in-error", "replaced-by"],
61
+ "lane pause": ["reason"],
62
+ "lane continue": [],
61
63
  "lane closeout": ["reason"],
62
64
  "lane repo": ["repo", "branch", "worktree", "read-only", "reason"],
63
65
  // MW1-12.6: ask (--blocker, --repo, --reason), grant (--note, --source, --worktree), refuse (--note), list (--machine, --state, --lane, --cursor, --limit).
@@ -207,6 +207,20 @@ while [ $# -gt 0 ]; do
207
207
  --size=*) SIZE="${1#--size=}"; shift;;
208
208
  --tighten) [ $# -ge 2 ] || { echo "usage: nodii-dev heavy run [--size light|heavy] [--tighten READING=GB] -- <command...>" >&2; return 2; }; TIGHTEN="${TIGHTEN:+$TIGHTEN,}$2"; shift 2;;
209
209
  --tighten=*) TIGHTEN="${TIGHTEN:+$TIGHTEN,}${1#--tighten=}"; shift;;
210
+ # The drill's red run (o2-red-run.confirm.md): `heavy run --help` once took a slot and ran `--help` as a command.
211
+ -h|--help) cat <<'USAGE'
212
+ usage: nodii-dev heavy run [--size light|heavy] [--tighten READING=GB] -- <command...>
213
+ nodii-dev heavy status
214
+
215
+ heavy run wait for a slot of the job's size while the machine clears its floor, run the command, release the
216
+ slot when it exits. Under the floor it is refused at once with MACHINE_UNDER_FLOOR (exit 75).
217
+ --size light or heavy. A typecheck, a lint, a unit-test run naming at most 20 test files and a push are
218
+ light; anything else counts heavy (MW2-51). --size heavy forces heavy.
219
+ --tighten memory=GB, swap=GB or disk=GB: make this one call stricter than the floor; a figure that would
220
+ loosen it exits 2.
221
+ heavy status the floor file, the readings beside the floor, the slots held, the queue and the last hour's admissions.
222
+ USAGE
223
+ return 0;;
210
224
  --) shift; break;;
211
225
  *) break;;
212
226
  esac
@@ -160,6 +160,17 @@ export async function takeInboxDelivery(key, { dir = inboxDir(), cap = DELIVERY_
160
160
  ].join("\n");
161
161
  }
162
162
 
163
+ /**
164
+ * A lane's unread messages in this machine's inbox, oldest first, without
165
+ * marking them delivered (DEV-PROCESS-1: a resume gate's look). Empty when lane
166
+ * messages are off.
167
+ */
168
+ export async function unreadInbox(key, { dir = inboxDir(), env = process.env } = {}) {
169
+ if (!key || !laneSwitchOn("laneMessages", env)) return [];
170
+ const marker = await readMarker(key, dir);
171
+ return (await inboxLines(key, dir, marker.offset)).items.map((item) => item.message).filter(Boolean);
172
+ }
173
+
163
174
  /** Stop: a lane session with unread messages is held, and the reason carries them (marked delivered). */
164
175
  export async function inboxStopGate(payload, context, { dir, env = process.env } = {}) {
165
176
  if (!laneSwitchOn("laneMessages", env)) return null;