@nodii/dev 0.6.210 → 0.6.212

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
@@ -164,23 +164,29 @@ Every heavy command a lane runs waits for one machine-wide heavy slot (MW2-51, K
164
164
  nodii-dev heavy run -- pnpm -r typecheck
165
165
  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
+ nodii-dev heavy run --tighten memory=40 -- true # refused (exit 75) unless 40 GB is available
167
168
  nodii-dev heavy status
168
169
  ```
169
170
 
170
- - Slots are sized (v27, hub-401). A light job takes one of `LIGHT_SLOTS` light slots beside the heavy ones, under `LIGHT_MIN_AVAIL_GB` (default: the heavy floor) and with no stagger. The machine's measured limits file sizes the pool (K02-4): without `LIGHT_SLOTS` there is no light pool and every job takes a heavy slot. A light job is a test run naming at most `LIGHT_MAX_TEST_FILES` (20) test files (`bun test a.test.ts`, `vitest run x.spec.ts`, optionally piped to tail, head, grep or tee), as `test affected --run` sends for a small change. `--size light` or `HEAVY_SIZE=light` on anything else is refused and takes a heavy slot. Everything else, and every landing, takes a heavy slot. The floor's one-job-alone exception counts both pools, so a light job beside running heavy jobs waits for its floor. Light locks live in `/tmp/nodii-heavy-slots/light`, which older copies never touch.
171
- - The queue is `heavy-slot` v27, shipped in this package (`src/heavy-slot.sh`, run by bash 3.2 or later). It carries v23's rules: a slot cap, a memory floor, a stagger between admissions, a landing reserve that only a push may use, FIFO order, reclaiming dead holders, and pass-through for teardowns (`compose down`, `stack:down`), a single `pnpm validate:<name>`, and a command that already holds a slot (K02-6). It refuses dev servers (K02-7). A foreground `docker compose up` never exits, so it never takes a slot either.
172
- - Limits come from `~/.config/nodii-resources/limits.env`, re-read on every admission: `HEAVY_SLOTS`, `HEAVY_MIN_AVAIL_GB`, `HEAVY_STAGGER_SEC`, `HEAVY_LANDING_RESERVE`, `HEAVY_RECLAIM_MIN`, `LIGHT_SLOTS`, `LIGHT_MIN_AVAIL_GB` and `LIGHT_MAX_TEST_FILES`. The script header (`src/heavy-slot.sh`) gives the schema and the defaults. Locks live in `/tmp/nodii-heavy-slots`, the same directory v23 copies use, so every copy counts against the same slots.
173
- - When no heavy job holds a slot, waiting can free no memory, so one job is admitted even under the floor, with a warning. The floor still holds every job beside it.
174
- - A waiting job prints its queue place and its wait when it starts waiting and once a minute after. It never gives up, so the queue never times out a gate.
175
- - **No nested queuing (NODII-DEV-CLI-86).** A job that holds a slot sees `NODII_HEAVY_SLOT=<n>` (`light/<n>` for a light slot). Heavy work inside it (another `heavy run`, `lane check`'s gates, a reviewer) runs in that same slot and never queues for a second one. A marker naming a slot that is no longer held queues for a slot of its own.
171
+ - **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.
172
+ - **The floor file.** The floor, the class peaks, the ceilings (3 heavy slots, one of them only for a push forced heavy; 8 light slots) and the 10 s stagger live in `/etc/nodii/floor.env`. It counts only when root owns it and `/etc/nodii`, neither is group- or world-writable, and the lanes' user cannot write it; else the shipped defaults hold, and `heavy status` says why. Only the machine owner installs or changes it, with their password (`sudo install -d -o root -g wheel -m 755 /etc/nodii && sudo install -o root -g wheel -m 644 floor.env /etc/nodii/floor.env`). No variable moves it or the slot directory: `NODII_RESOURCE_LIMITS`, `HEAVY_SLOT_DIR`, `NODII_HEAVY_SLOT`, `NODII_HEAVY_SLOT_HELD` and `HEAVY_LANDING` are gone. `~/.config/nodii-resources/limits.env` keeps only the coordinator's `LANE_CAP`, `STACK_CAP`, `LIGHT_LANE_CAP` and `DEV_SERVER_CAP`.
173
+ - `--tighten memory=GB|swap=GB|disk=GB` (repeatable, or a comma list) makes one call stricter than the floor; a figure that would loosen it exits 2 (`USAGE`). `lane launch` and `lane resume` take it too.
174
+ - **Only end-to-end work is heavy** (the operator, 23 Nov about 20:05 IST: "NOTHING but E2E tests should require a heavy slot"). A heavy slot is for end-to-end, real-stack and browser-flow work: Playwright, Cypress and other browser drivers, an `e2e`, `integration`, real-stack or stack script, an image build and a detached stack start. Everything else (typecheck, lint, unit tests, `git push`) takes one of the light slots, under the light floor (5 GB) and with no stagger. `--size heavy` makes any job heavy; `--size light` never makes end-to-end work light. Light locks live in `/tmp/nodii-heavy-slots/light`.
175
+ - The queue is `heavy-slot` v29, shipped in this package (`src/heavy-slot.sh`, run by bash 3.2 or later): a slot cap, the floor, a stagger between admissions, a landing reserve only a push may use, FIFO order, reclaiming dead holders, and pass-through for teardowns (`compose down`, `stack:down`) and a single `pnpm validate:<name>`. It refuses dev servers (K02-7). A foreground `docker compose up` never exits, so it never takes a slot either. Locks live in `/tmp/nodii-heavy-slots`, the directory every older copy uses.
176
+ - A job waiting for a slot (above the floor) prints its queue place and its wait when it starts waiting and once a minute after.
177
+ - **No nested queuing (NODII-DEV-CLI-86, v29).** A `heavy run` whose process tree runs under a slot's holder runs in that slot and never queues for a second one (`lane check`'s gates, a reviewer, a push's hooks). It says so (`[heavy-slot] nested in slot N`). Nesting is proven by the process tree, never by a variable.
178
+ - **Every decision is logged.** Each admission, with the readings it was made on, and each refusal goes to `~/.config/nodii-resources/admissions.jsonl`. `heavy status` prints the floor file, memory available and after reservations, swap used and disk free beside the floor, each class's floor and peak, the ceilings, the held slots and the last hour's admissions, flagging any admission under the floor.
179
+ - `lane launch` and `lane resume` read the floor first, before the coordinator, the governor, the cap and the account; `--preflight-only` then stops before anything is created or resumed.
176
180
  - **Orphaned slots are reclaimed (NODII-DEV-CLI-86).** A slot records its lane, the agent session that took it, the job's worktree and its process group. A slot's holder (the `heavy run` that started the job) checks its own slot once a minute, and reclaims it only when all of these hold:
177
- - it has been held at least `HEAVY_RECLAIM_MIN` minutes (default 10; 0 turns the reclaim off);
181
+ - it has been held at least 10 minutes;
178
182
  - Dev reports its lane down (`nodii-dev heavy lane-state <key>`: liveness `orphan` or `ended`, or status `stopped` or `non_issue`);
179
183
  - the agent session that took it is gone;
180
184
  - no `claude` or `codex` process works in the job's worktree.
181
185
 
182
186
  It then stops its own job's process tree and logs the reclaim (slot, lane, time held and why) to `/tmp/nodii-heavy-slots/reclaim.log`. `heavy status` shows each slot's lane, marks a reclaim candidate and lists the last reclaims. No session ever signals another session's processes (MW2-49): a waiter only waits. A slot taken outside a lane, or held by a pre-v26 copy, is never reclaimed this way; a check that can't tell (Dev unreachable, no `lsof`) keeps the slot.
183
- - It can't be skipped. In a lane, the safety hook (`hook safety-pre`) refuses an unqueued heavy command and prints the same command with `nodii-dev heavy run --` in front of each heavy part. `lane check --gate` and `receipt write --run` queue every gate themselves, `lane check` runs each reviewer under a slot (its timeout starts once the slot is granted), and `lane closeout` pushes through the landing reserve.
187
+ - It can't be skipped. In a lane, the safety hook (`hook safety-pre`) refuses an unqueued heavy command (`SAFETY_HEAVY_UNQUEUED`) and prints the same command with `nodii-dev heavy run --` in front of each heavy part. Only the installed queue queues: a file named `heavy-slot.sh`, run directly or by a shell, is no queue, so its job is judged as if run bare. design-system's surface-gen check (`node infra/code-connect/surface-gen.mjs check`) is heavy.
188
+ - Every-page checks run in CI only (DEV-PROCESS-2, hub-650). In a lane, the hook refuses with `SAFETY_CI_ONLY`, naming the pull-request check that covers it: `nodii-dev surface generate --all --check` (also through `npx @nodii/dev`, `pnpm dlx` or an env prefix) and any surface-gen check run with `CI=` set, bare or queued, are covered by "Generated pages match their Surfaces" (job `surface-gen-equal`); `pnpm verify:frame-conformance` and `pnpm verify:frame-conformance:gate`, with or without `--touched`, bare or queued, by "Frame conformance for touched pages" (job `frame-conformance`). `surface generate --all --write` and `nodii-dev heavy run -- node infra/code-connect/surface-gen.mjs check` (no `CI=`) stay allowed.
189
+ - `lane check --gate` and `receipt write --run` queue every gate themselves, `lane check` runs each reviewer under a slot (its timeout starts once the slot is granted), and `lane closeout` pushes through the landing reserve.
184
190
  - `[TOOL GAP hub-86]` MW5-19 places this helper as the `heavy-slot` util. It ships here until the util pipeline exists.
185
191
 
186
192
  ## Figma REST reads: one queue, two retries, one cache (cli-170)
@@ -382,14 +388,14 @@ nodii-dev figma scope set CHANGE_SET --scope KIND:ID [--scope ...]
382
388
  nodii-dev figma publish-plan FILE_KEY
383
389
  nodii-dev figma check FILE_KEY
384
390
  nodii-dev figma log-write CHANGE_SET --tool TOOL --nodes NODE[,NODE]
385
- nodii-dev figma submit CHANGE_SET --file SUBMISSION.json
391
+ nodii-dev figma submit CHANGE_SET --file SUBMISSION.json [--code-pr OWNER/REPO#N]
386
392
  nodii-dev figma apply CHANGE_SET --figma-version VERSION
387
393
  nodii-dev figma published FILE_KEY|CHANGE_SET --figma-version VERSION
388
394
  nodii-dev figma abandon CHANGE_SET
389
395
  nodii-dev figma withdraw CHANGE_SET # take back a submit before anything is decided
390
396
  nodii-dev figma split CHANGE_SET --nodes NODE[,NODE] --title TEXT # move written nodes to a new set
391
397
  nodii-dev figma restore CHANGE_SET --lane KEY|--holder AGENT_ID --reason TEXT # staff or Steward: undo a sweep's abandon (MW8-4.3)
392
- nodii-dev figma resubmit CHANGE_SET PAYLOAD.json # round 2: re-submit every rejected item
398
+ nodii-dev figma resubmit CHANGE_SET PAYLOAD.json [--code-pr OWNER/REPO#N] # round 2: re-submit every rejected item
393
399
  nodii-dev figma changeset show CHANGE_SET # items, variants, round, decision, comment
394
400
  nodii-dev figma release FILE_KEY
395
401
 
@@ -591,6 +597,32 @@ outside its item (the CLI lists each item and the variants outside it). When
591
597
  Figma can't answer that check, Dev refuses with `503 FIGMA_UNAVAILABLE`; the CLI
592
598
  says when to retry (`details.retryAfter` seconds).
593
599
 
600
+ **Images and the code PR (hub-558).** `figma submit`, `figma resubmit`
601
+ and `figma submit --dry-run` upload every variant's after and before PNG to the
602
+ set first (`POST /api/v1/design/change-sets/:id/images`, one PNG per request, 4 in
603
+ flight, each PNG sent once by its sha256) and send `afterImageId` /
604
+ `beforeImageId` in place of inline base64. A variant in the file carries either
605
+ `afterPngBase64` or `afterImageId` (likewise `beforePngBase64` or
606
+ `beforeImageId`); the CLI turns the first into the second, so a file may also
607
+ name images already uploaded. Each node's `afterSha256` stays in
608
+ `evidence.nodes`. All three commands take `--code-pr OWNER/REPO#N`, sent as
609
+ `codePr { repo, number }`; the flag wins over a `codePr` in the file, and the CLI
610
+ says so. A change set needs its code pull request, drafted and adoptable
611
+ (MW8-5.2, "No change set without adoptable code"). For example:
612
+
613
+ ```
614
+ nodii-dev figma submit CS-12 --file SUBMIT.json --code-pr nodii-ai/nodii-frontend#123
615
+ nodii-dev figma resubmit CS-12 PAYLOAD.json --code-pr nodii-ai/nodii-frontend#123
616
+ nodii-dev figma submit CS-12 --file SUBMIT.json --code-pr nodii-ai/nodii-frontend#123 --dry-run
617
+ ```
618
+
619
+ ```json
620
+ { "variants": [
621
+ { "nodeId": "1:3", "name": "Button / Tonal", "context": "The Tonal fill", "afterPngBase64": "..." },
622
+ { "nodeId": "1:4", "name": "Button / Ghost", "context": "The Ghost fill", "afterImageId": "IMG-ID" }
623
+ ] }
624
+ ```
625
+
594
626
  A change set changes only what was asked (MW6-22). Every removal of a
595
627
  control, action, data, role view, metric, section or page, and every component
596
628
  swap, is a line in `writeUp` or in the item's `context`, and quotes the
@@ -700,8 +732,10 @@ instruction or rule the person gives about how work is done with
700
732
  `nodii-dev ruling file --text - <<'EOF'` (the exact words on stdin, the
701
733
  heredoc's closing newline dropped) or `--text '<their exact words>'` in
702
734
  single quotes, in that turn. `ruling file` sends the words only when they are
703
- an exact substring of this session's own turn (`CLAUDE_SESSION_ID` or
704
- `CLAUDE_CODE_SESSION_ID`) recorded in the last 30 minutes, byte for byte or
735
+ an exact substring of this session's own turn recorded in the last 30 minutes.
736
+ The command matches the hook's session ID using `CODEX_SESSION_ID` or
737
+ `CODEX_THREAD_ID` for Codex, or `CLAUDE_SESSION_ID` or
738
+ `CLAUDE_CODE_SESSION_ID` for Claude. The text must match byte for byte or
705
739
  with surrounding whitespace trimmed; otherwise, or with no session id, it
706
740
  refuses `RULING_NOT_TYPED`, exits 2 and sends nothing. Words shorter than 3
707
741
  words or 12 characters, or longer than 4000 characters, are `USAGE`. Dev
@@ -808,12 +842,13 @@ nodii-dev lane message TO --body TEXT|--body-file FILE [--issue ISSUE]
808
842
  nodii-dev lane inbox [KEY] [--all]
809
843
  # lane-to-lane messaging (NODII-DEV-CLI-191); see "Lane messages"
810
844
  nodii-dev coordinator items [--machine NAME|ID]
811
- nodii-dev lane resume --host-lost [--min-free-gb N] [--stagger-seconds N]
845
+ nodii-dev lane resume --host-lost [--tighten READING=GB]
812
846
  # after a reboot (coordinator): resume every host_lost lane
813
847
  # on this machine in priority order, each under its own
814
- # key, agent, worktree and branch. Stops at the memory floor
815
- # (default 4 GiB, 15 s between lanes); run it again to carry
816
- # on (AGENT-HARNESS-67)
848
+ # key, agent, worktree and branch. Waits the floor file's
849
+ # stagger between lanes and stops with MACHINE_UNDER_FLOOR
850
+ # (exit 75) when the machine's floor refuses the next one;
851
+ # run it again to carry on (AGENT-HARNESS-67, DEV-PROCESS-2)
817
852
  nodii-dev lane transfer KEY --reason TEXT [--to-agent ID]
818
853
  # move a host_lost lane to the recovering agent on this
819
854
  # machine under a fresh run (AGENT-HARNESS-67)
package/dist/cli.js CHANGED
@@ -260,7 +260,7 @@ Usage: nodii-dev <command> [options] [--json]
260
260
  figma lane-reads-script --nodes ID[,ID]
261
261
  # prints the read-only use_figma script that gathers the nodes for --lane-reads
262
262
  figma check|log-write|submit|apply|abandon|release
263
- figma submit CHANGE_SET --file SUBMIT.json [--sync] [--dry-run] [--lane-reads FILE]
263
+ figma submit CHANGE_SET --file SUBMIT.json [--sync] [--dry-run] [--lane-reads FILE] [--code-pr OWNER/REPO#N]
264
264
  # --dry-run (submit and resubmit) runs Dev's dry run of the
265
265
  # submit gate on the same body, as design check --change-set; never writes
266
266
  # --lane-reads (submit, resubmit, --dry-run): Dev runs the gate on your MCP and
@@ -268,8 +268,13 @@ Usage: nodii-dev <command> [options] [--json]
268
268
  # reads over 1 MB go up to the set in chunks first (hub-310), and a chunk
269
269
  # that drops is sent again; the dry run of a submit past 300 node ids
270
270
  # runs in parts and reports once
271
- # SUBMIT.json: { figmaVersion, writeUp, items: [{ figmaNodeId, change, context,
272
- # variants: [{ nodeId, name, context, afterPngBase64 }] }] } (DEC-0204);
271
+ # --code-pr OWNER/REPO#N: the code PR the change set ships with (MW8-5.2: no change set without adoptable code), sent as
272
+ # codePr { repo, number } (the flag wins over a codePr in the file)
273
+ # Images: each afterPngBase64 / beforePngBase64 is uploaded to the set one
274
+ # PNG per request first (hub-558) and the submit, resubmit and dry
275
+ # run send afterImageId / beforeImageId; a file may carry those ids itself
276
+ # SUBMIT.json: { figmaVersion, writeUp, codePr?: { repo, number }, items: [{ figmaNodeId, change, context,
277
+ # variants: [{ nodeId, name, context, afterPngBase64 | afterImageId, beforePngBase64? }] }] } (DEC-0204);
273
278
  # a missing writeUp, context or variant name, or an item with no variants,
274
279
  # is refused before Dev is called (writeUp <= 2000, context <= 500, name <= 120;
275
280
  # never a bare node id). Each removal or swap line in writeUp or an item's
@@ -305,7 +310,7 @@ Usage: nodii-dev <command> [options] [--json]
305
310
  # removedNodeIds); Dev takes each as gone when your reads list it in gone and
306
311
  # its /nodes entry is null or the empty ghost Figma answers for a deleted
307
312
  # component or variant
308
- figma resubmit CHANGE_SET PAYLOAD.json [--sync] [--dry-run] [--lane-reads FILE]
313
+ figma resubmit CHANGE_SET PAYLOAD.json [--sync] [--dry-run] [--lane-reads FILE] [--code-pr OWNER/REPO#N]
309
314
  # holder re-submits every rejected item: applying -> in_review, round + 1;
310
315
  # each item needs context, each variant name and context; writeUp optional
311
316
  figma changeset show CHANGE_SET # write-up, items, context, variants, round, decision and comment (with the previous round's)
@@ -326,8 +331,8 @@ Usage: nodii-dev <command> [options] [--json]
326
331
  # one line asking the session to file the person's rules verbatim, and shows
327
332
  # a steward session its unread lane messages from its local inbox (MW1-115)
328
333
  ruling file --text TEXT # file the person's exact words, typed this turn, as a ruling (MW1-115): Dev
329
- # records them with person, session and time; words this session's prompt hook
330
- # did not see typed, or no session id, are refused (RULING_NOT_TYPED) and nothing
334
+ # records them with person, session and time. The Codex or Claude session ID
335
+ # must match its prompt hook's record. Unverified words are refused (RULING_NOT_TYPED) and nothing
331
336
  # is sent; fewer than 3 words or 12 characters, or over 4000, is USAGE. --text -
332
337
  # reads the exact words from stdin (a quoted heredoc). Binds nothing until sorted
333
338
  # and uploaded
@@ -448,8 +453,14 @@ Usage: nodii-dev <command> [options] [--json]
448
453
  --class long|short|no-build # MW1-38.3 class, weighed against the account's MW1-38.2 band
449
454
  [--base NAME=REF] [--worktree NAME=PATH] [--owned-path NAME=PATH]
450
455
  [--route /app/... ...] [--figma FILE_KEY[=COMPONENT_SET_KEY[,KEY]]] [--notes TEXT]
451
- [--narrowing-note TEXT --narrowing-remainder DESTINATION]
456
+ [--narrowing-note TEXT --narrowing-remainder DESTINATION] [--preflight-only] [--tighten READING=GB]
452
457
  # authoritative preflight, one worktree per repo, watched launch
458
+ # --preflight-only (DEV-PROCESS-2) reads the machine's floor first (before the
459
+ # governor, the cap and the account), then runs the preflight and creates
460
+ # nothing; under the floor it exits 75 with MACHINE_UNDER_FLOOR, naming the
461
+ # reading, the figure and the five largest holders of memory. --tighten
462
+ # memory=GB|swap=GB|disk=GB makes this one call stricter (refused if it would
463
+ # loosen: the floor is 10 GB available, 24 GB swap used, 15 GB disk free)
453
464
  # --subagents defaults to 4 (0 to 100; 0 is none). Default shape: fewer
454
465
  # lanes, with subagents fanned out inside each (MW1-38.15). Dev clamps a new
455
466
  # lane's quota to 2 or 1 in the two_builds or one_build usage band and the
@@ -529,20 +540,31 @@ Usage: nodii-dev <command> [options] [--json]
529
540
  # A failure main already has is a baseline (MW2-21): failed files rerun alone, and
530
541
  # those the branch did not change rerun at the merge base (cached per base); it
531
542
  # passes, naming "red on main at SHA", when every failure is main's
532
- heavy run [--size light|heavy] -- <command...>
543
+ heavy run [--size light|heavy] [--tighten READING=GB] -- <command...>
533
544
  # run heavy work (tests, typecheck, build, gate, git push, image build,
534
- # detached stack start) under one machine-wide slot (MW2-51): waits in FIFO
535
- # order, printing its place and wait, while slots are full, memory is under
536
- # the floor or the stagger runs; never times out. Limits: ~/.config/
537
- # nodii-resources/limits.env. A push uses the landing reserve. The job sees
538
- # NODII_HEAVY_SLOT=<n>; heavy work inside it (a heavy run, lane check's gates)
539
- # runs in that slot and never queues for a second (K02-6). A slot held
540
- # HEAVY_RECLAIM_MIN (10) whose lane is down in Dev and whose agent is gone is
541
- # reclaimed and logged. A lane's safety hook refuses unqueued heavy work.
542
- # A test run naming at most LIGHT_MAX_TEST_FILES test files takes a light
543
- # slot (many in parallel, low memory floor, no stagger); --size light asks for one
544
- heavy status # limits, available memory, the slots held (with lane and reclaim candidates)
545
- # and the queues
545
+ # detached stack start) under one machine-wide slot (MW2-51, DEV-PROCESS-2).
546
+ # It reads the machine's floor first: available memory after running jobs'
547
+ # reserved peaks (7 GB heavy, 1 GB light, less use) at least 10 GB (5 for a
548
+ # light job), swap used at most 24 GB, disk free at least 15 GB. Under it the
549
+ # job exits 75 at once with MACHINE_UNDER_FLOOR, naming the reading, the
550
+ # figure and the five largest holders of memory: never queued, no exception
551
+ # for a lone job or a push. Above it, it waits in FIFO order while the slots
552
+ # are full or the 10 s stagger runs, and reads the floor again when a slot is
553
+ # free. Floor, peaks and ceilings (3 heavy slots, one only for a push; 8
554
+ # light) come from root-owned /etc/nodii/floor.env, else shipped defaults;
555
+ # no variable changes them. --tighten memory=GB|swap=GB|disk=GB makes this
556
+ # one call stricter (a figure that would loosen the floor exits 2). A heavy
557
+ # run under a slot's holder (its process tree) runs in that slot (K02-6).
558
+ # Only end-to-end, real-stack and browser work takes a heavy slot;
559
+ # typecheck, lint, unit tests and a push take a light one (--size heavy
560
+ # forces heavy). A slot held 10 min whose lane is down in Dev and whose
561
+ # agent is gone is reclaimed and logged. In a lane the safety hook
562
+ # refuses unqueued heavy work (SAFETY_HEAVY_UNQUEUED; a heavy-slot.sh copy is
563
+ # no queue) and every-page checks, CI only (SAFETY_CI_ONLY)
564
+ heavy status # the floor file, memory available and after reservations, swap used and
565
+ # disk free beside the floor, each class's floor and peak, the ceilings,
566
+ # the slots held (with lane and reclaim candidates), the queues and the last
567
+ # hour's admissions (any under the floor is flagged)
546
568
  heavy lane-state <lane-key> # up|down|unknown: Dev's view of a slot's lane, as the reclaim reads it
547
569
  sync pending [--discard FILE --reason TEXT]
548
570
  # send the lane records queued while Dev was down (MW1-64); --discard drops
@@ -557,7 +579,8 @@ Usage: nodii-dev <command> [options] [--json]
557
579
  # and slot; its coordinator's lane close needs this record (LANE_NOT_FINISHED)
558
580
  lane subagent-quota <key> <n> # coordinator assigns 0-100 subagent slots
559
581
  lane cap <machine> <n> [--confirm-raise --reason TEXT]
560
- # coordinator declares the machine's lane cap, at least every 60 minutes;
582
+ # coordinator declares the machine's lane cap; it holds while the machine's
583
+ # watchdog reports in and lapses once Dev's last report is 10 minutes old;
561
584
  # a raise needs a yes and a reason (MW1-38.10, MW1-38.13)
562
585
  lane heartbeat|resume|land|verify|prioritize|deprioritize|stop <key>
563
586
  lane verify <key> --dev-check REF [--checks FILE]
@@ -660,11 +683,15 @@ Usage: nodii-dev <command> [options] [--json]
660
683
  # on to deploy and the dev check. Unless NODII_DEV_SAME_SESSION_RESUME=0, a resume
661
684
  # continues the dead run's own session when this machine has its log, with a
662
685
  # short prompt instead of the Freeze; with =0 it starts fresh as before
663
- lane resume --host-lost [--min-free-gb N] [--stagger-seconds N]
686
+ lane resume <key> --preflight-only [--tighten READING=GB]
687
+ # DEV-PROCESS-2: the machine's floor first, as lane launch --preflight-only;
688
+ # then reads the lane and resumes nothing
689
+ lane resume --host-lost [--tighten READING=GB]
664
690
  # coordinator, after a reboot: resume every host_lost lane on this machine
665
691
  # in priority order under its own key, agent, worktree and branch. No
666
- # amendment or override. Stops at the memory floor (default 4 GiB); run
667
- # it again to carry on
692
+ # amendment or override. Waits the floor file's stagger between lanes and
693
+ # reads the machine floor before each; under it, stops (MACHINE_UNDER_FLOOR,
694
+ # exit 75) and holds the rest; run it again to carry on
668
695
  lane transfer <key> --reason TEXT [--to-agent ID]
669
696
  # move a host_lost lane to the recovering agent (this config's, or ID), which
670
697
  # must be a fresh agent named lane-<key> on the same machine: a fresh run,
@@ -821,7 +848,7 @@ Refusals of leeway, the coordinator's items, lane finish, lane resume, the manag
821
848
  HARNESS_SETTINGS_INVALID .claude/settings.json or .codex/hooks.json is not valid JSON. Next: repair the file, then run harness update
822
849
  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
823
850
  VERSION_BELOW_FLOOR Dev refuses an agent's write from a CLI below its version floor (HTTP 426); the message names the floor and this version. Next: run nodii-dev harness update, then retry
824
- RULING_NOT_TYPED ruling file --text was given words this session's prompt hook did not see typed in its current turn (within 30 minutes), or the command names no session (CLAUDE_SESSION_ID or CLAUDE_CODE_SESSION_ID); nothing was sent. Next: file only the person's exact words, in the turn they typed them
851
+ RULING_NOT_TYPED ruling file --text was given words this session's prompt hook did not see typed in its current turn (within 30 minutes), or there is no Codex or Claude session ID; nothing was sent. Next: file only the person's exact words, in the turn they typed them
825
852
 
826
853
  Run a command with --help or see the package README for all flags.`;
827
854
 
@@ -1770,7 +1797,7 @@ export async function main(argv = process.argv.slice(2)) {
1770
1797
  const dryRun = async (id, text, file, { split = false } = {}) => {
1771
1798
  const laneReads = f["lane-reads"] ? await readLaneReads(f["lane-reads"]) : undefined;
1772
1799
  const result = await designCheckChangeSet(undefined, { "change-set": id, ...(text ? { file } : {}), ...(f["figma-version"] ? { "figma-version": f["figma-version"] } : {}), ...(f.sync ? { sync: true } : {}), ...(f.async ? { async: true } : {}) },
1773
- { read: async () => text, split, ...(laneReads ? { laneReads } : {}) }).catch((error) => { throw laneReadsRefusal(error); });
1800
+ { read: async () => text, split, ...(laneReads ? { laneReads } : {}), ...(f["code-pr"] !== undefined ? { codePr: f["code-pr"] } : {}) }).catch((error) => { throw laneReadsRefusal(error); });
1774
1801
  emit(result.payload, json, result.human);
1775
1802
  if (result.exitCode) {
1776
1803
  if (!json) console.error(`DS_CONFORMANCE_FAILED: ${result.payload.data.findings.length} finding(s)`);
@@ -1794,7 +1821,7 @@ export async function main(argv = process.argv.slice(2)) {
1794
1821
  const payload = f.file ? JSON.parse(await readFile(f.file, "utf8")) : { figmaVersion: requireFlag(f, "figma-version") };
1795
1822
  // A 200 carries top-level warnings (STALE_FIGMA_VERSION): print them.
1796
1823
  const laneReads = f["lane-reads"] ? await readLaneReads(f["lane-reads"]) : undefined;
1797
- return emit(await figmaSubmit(rest[0], payload, { sync: submitMode(f), file: f.file || "the submit (no --file)", ...(laneReads ? { laneReads } : {}) }), json, (p) =>
1824
+ return emit(await figmaSubmit(rest[0], payload, { sync: submitMode(f), file: f.file || "the submit (no --file)", ...(laneReads ? { laneReads } : {}), ...(f["code-pr"] !== undefined ? { codePr: f["code-pr"] } : {}) }), json, (p) =>
1798
1825
  [JSON.stringify(p.data, null, 2), ...conformanceLines({ warnings: p.warnings })].join("\n"));
1799
1826
  }
1800
1827
  if (action === "file") {
@@ -1906,7 +1933,7 @@ export async function main(argv = process.argv.slice(2)) {
1906
1933
  );
1907
1934
  }
1908
1935
  if (action === "resubmit")
1909
- return emit(await figmaResubmit(rest[0], rest[1], { sync: submitMode(f), ...(f["lane-reads"] ? { laneReads: await readLaneReads(f["lane-reads"]) } : {}) }), json, (p) =>
1936
+ return emit(await figmaResubmit(rest[0], rest[1], { sync: submitMode(f), ...(f["code-pr"] !== undefined ? { codePr: f["code-pr"] } : {}), ...(f["lane-reads"] ? { laneReads: await readLaneReads(f["lane-reads"]) } : {}) }), json, (p) =>
1910
1937
  [`Re-submitted ${rest[0]}; it is ${p.data.state}.`, figmaChangeSetText(p.data), ...conformanceLines({ warnings: p.warnings })].join("\n"));
1911
1938
  if (action === "changeset") {
1912
1939
  if (rest[0] === "list") {
@@ -28,6 +28,7 @@ import {
28
28
  DEFAULT_DOMAINS, boardCommand, coordinatorHome, heavyQueue, laneDomain, laneProcesses, liveChangeSets, machineLanes, readCoordinatorSettings,
29
29
  } from "./coordinator-board.js";
30
30
  import { governorMachineId } from "./governor.js";
31
+ import { checkFloor } from "./machine-floor.js";
31
32
  import { excludedProfiles } from "./accounts.js";
32
33
  import { envAssignment, execLine, installNote, installSupervised, lingerLine, logsDir, supervisedDirs, unitActive, unitPath, unitText } from "./systemd.js";
33
34
 
@@ -74,32 +75,34 @@ async function writeJson(path, value) {
74
75
 
75
76
  // ---- Shared reads -------------------------------------------------------------
76
77
 
77
- /** Machine guards for a resume (the prototype's numbers, measured on this Mac, 12 Nov). */
78
- export async function machineGuards({ execute = execFile, load = loadavg, os = platform(), read = readFile } = {}) {
79
- let freePercent = null;
80
- if (os === "linux") {
81
- // Linux has no memory_pressure: what a new process can have is MemAvailable.
82
- try {
83
- const meminfo = await read("/proc/meminfo", "utf8");
84
- const kb = (name) => Number(meminfo.match(new RegExp(`^${name}:\\s+(\\d+) kB`, "m"))?.[1] ?? NaN);
85
- freePercent = Math.round((kb("MemAvailable") / kb("MemTotal")) * 100);
86
- } catch {}
87
- } else {
88
- try { freePercent = Number((await execute("memory_pressure", [], { timeout: 15_000 })).stdout.match(/free percentage:\s*(\d+)/i)?.[1] ?? NaN); } catch {}
78
+ /**
79
+ * Machine guards for a resume. Memory, swap and disk are the machine floor (DEV-PROCESS-2: one floor, read by every
80
+ * job, launch, resume and keepalive, kind "keepalive"); the load and the lane processes are the prototype's (12 Nov).
81
+ * A floor that cannot be read is a failing floor: the keepalive never resumes on a reading it does not have.
82
+ */
83
+ export async function machineGuards({ execute = execFile, load = loadavg, os = platform(), floor = checkFloor } = {}) {
84
+ let floorVerdict;
85
+ try {
86
+ const verdict = await floor({ kind: "keepalive", what: "keepalive", log: "refusals", os });
87
+ floorVerdict = { ok: Boolean(verdict?.ok), failing: verdict?.failing ?? [], readings: verdict?.readings ?? null };
88
+ } catch (error) {
89
+ floorVerdict = { ok: false, failing: [`the machine floor could not be read (${error?.code ? `${error.code}: ` : ""}${error?.message ?? error})`], readings: null };
89
90
  }
90
91
  let laneProcesses = null;
91
92
  try { laneProcesses = (await execute("ps", ["-axo", "command="], { maxBuffer: 32 * 1024 * 1024 })).stdout.split("\n").filter((l) => /^claude --print\b/.test(l)).length; } catch {}
92
- return { load15: Math.round(load()[2]), freePercent: Number.isFinite(freePercent) ? freePercent : null, laneProcesses };
93
+ return { load15: Math.round(load()[2]), floor: floorVerdict, laneProcesses };
93
94
  }
94
95
 
95
- /** Whether a resume may run now. Priority lanes get more room, as on 12 Nov. */
96
+ /** Whether a resume may run now. The floor has no exemption; priority lanes get more room on load and the hold only. */
96
97
  export function resumeAllowed(guards, { priority, hold = false }) {
97
98
  // hub-242: the cap is the machine's declared lane cap (Dev's laneCapState), never a fixed number.
98
99
  if (guards.laneProcesses !== null) {
99
100
  if (!Number.isFinite(guards.laneCap)) return { ok: false, reason: "the machine's declared lane cap could not be read" };
100
101
  if (guards.laneProcesses >= guards.laneCap) return { ok: false, reason: `${guards.laneProcesses} lane processes (declared cap ${guards.laneCap})` };
101
102
  }
102
- if (guards.freePercent !== null && guards.freePercent < (priority ? 25 : 20)) return { ok: false, reason: `memory ${guards.freePercent}% free` };
103
+ // DEV-PROCESS-2: the machine floor, for priority lanes too. Guards without a floor reading are refused.
104
+ if (!guards.floor) return { ok: false, reason: "MACHINE_UNDER_FLOOR: the machine floor was not read" };
105
+ if (!guards.floor.ok) return { ok: false, reason: `MACHINE_UNDER_FLOOR: ${guards.floor.failing.join("; ") || "under the machine floor"}` };
103
106
  if (guards.load15 >= (priority ? 100 : 60)) return { ok: false, reason: `load ${guards.load15}` };
104
107
  if (hold && !priority) return { ok: false, reason: "keepalive hold" };
105
108
  return { ok: true };
@@ -681,14 +684,15 @@ export async function installWatch({
681
684
  const { watchdogPath } = await import("./watchdog.js");
682
685
  const { logs, ...installed } = await installSupervised({
683
686
  home, execute, activate: WATCH_SERVICE, errorCode: "WATCH_INSTALL_FAILED",
684
- build: ({ logs: dir }) => [{ name: WATCH_SERVICE, contents: watchUnit({ runtime, entry, config: resolve(configFile), log: join(dir, "coordinator-watch.log"), path: watchdogPath(env.PATH, runtime) }) }],
687
+ build: ({ logs: dir }) => [{ name: WATCH_SERVICE, contents: watchUnit({ runtime, entry, config: resolve(configFile), log: join(dir, "coordinator-watch.log"), path: watchdogPath(env.PATH, runtime, home) }) }],
685
688
  });
686
689
  return { ...installed, log: join(logs, "coordinator-watch.log") };
687
690
  }
688
691
  const log = watchLogPath(home, os);
689
692
  const plistPath = join(home, "Library", "LaunchAgents", `${WATCH_LABEL}.plist`);
690
693
  // launchd's PATH is bare: give the daemon the tools it calls (git, gh, node, security).
691
- const path = [dirname(runtime), "/opt/homebrew/bin", "/usr/local/bin", "/usr/bin", "/bin", "/usr/sbin", "/sbin"].join(":");
694
+ const { watchdogPath } = await import("./watchdog.js");
695
+ const path = watchdogPath(["/opt/homebrew/bin", "/usr/local/bin", env.PATH].filter(Boolean).join(":"), runtime, home);
692
696
  const contents = watchPlist({ runtime, entry, config: resolve(configFile), log, path });
693
697
  await mkdir(dirname(log), { recursive: true, mode: 0o700 });
694
698
  await mkdir(dirname(plistPath), { recursive: true });
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.210";
7
+ export const VERSION = "0.6.212";
8
8
  export const configPath = () =>
9
9
  process.env.NODII_DEV_CONFIG_PATH ??
10
10
  join(homedir(), ".config/nodii-dev/config.json");
package/dist/design.js CHANGED
@@ -9,7 +9,7 @@
9
9
  import { readFile } from "node:fs/promises";
10
10
  import { CliError, devRequest } from "./core.js";
11
11
  import { FIGMA_API, figmaRest } from "./figma-rest.js";
12
- import { conformanceLines, figmaConformance, figmaFileKey, laneReadsBody, submitMode, surfacesCheck } from "./figma.js";
12
+ import { conformanceLines, figmaConformance, figmaFileKey, laneReadsBody, submitMode, surfacesCheck, uploadSubmitImages, withCodePr } from "./figma.js";
13
13
  import { checkConformance, neededMains, VERSION as CHECK_VERSION } from "./vendor/ds-conformance.mjs";
14
14
 
15
15
  // The Figma nodes endpoint takes many ids per call; keep URLs well short of limits.
@@ -468,7 +468,7 @@ function mergedReports(reports) {
468
468
  * plus the submit-time guards against the set's items: IMAGE_NOT_TRUECOLOR
469
469
  * refuses; STALE_FIGMA_VERSION is a warning. Changes no state.
470
470
  */
471
- export async function designCheckChangeSet(target, flags, { request = devRequest, send, progress, read = (f) => readFile(f, "utf8"), laneReads, split = false } = {}) {
471
+ export async function designCheckChangeSet(target, flags, { request = devRequest, send, progress, read = (f) => readFile(f, "utf8"), laneReads, split = false, codePr } = {}) {
472
472
  const id = flags["change-set"];
473
473
  // On the lane's reads too Dev runs the dry run as a job (hub-448); --sync sends the plain call.
474
474
  const sync = submitMode(flags);
@@ -488,6 +488,9 @@ export async function designCheckChangeSet(target, flags, { request = devRequest
488
488
  if (!body || typeof body !== "object" || Array.isArray(body)) throw new CliError("USAGE", `${flags.file}: expected the submit body, a JSON object`, 2);
489
489
  }
490
490
  if (flags["figma-version"]) body = { ...body, figmaVersion: String(flags["figma-version"]) };
491
+ // hub-558: images go up one by one and the body names them; --code-pr rides in the body.
492
+ body = withCodePr(body, codePr, { ...(progress ? { progress } : {}) });
493
+ body = await uploadSubmitImages(id, body, { request, ...(progress ? { progress } : {}) });
491
494
  // hub-310: large reads go up once, in chunks, and every run names them.
492
495
  if (laneReads) body = { ...body, ...(await laneReadsBody(id, laneReads, { request, ...(progress ? { progress } : {}) })) };
493
496
  // A submit body past the dry run's node limit runs in parts, each under it;
package/dist/figma.js CHANGED
@@ -392,6 +392,87 @@ export function submitEvidence(body, set) {
392
392
  };
393
393
  }
394
394
 
395
+ const IMAGE_UPLOAD_CONCURRENCY = 4;
396
+
397
+ /**
398
+ * Uploads every inline PNG of a submit or re-submit body to the set, one per
399
+ * request (POST /design/change-sets/:id/images), and returns a NEW body whose
400
+ * variants carry afterImageId / beforeImageId instead of the base64
401
+ * (hub-558: 392 inline 2x PNGs are ~65 MB, over Dev's body limit and
402
+ * the edge's timer). The same PNG (same sha256) uploads once. The submit's
403
+ * evidence declares each after image's hash, so the hash of every after PNG is
404
+ * put in evidence.nodes here, before the base64 is gone.
405
+ */
406
+ export async function uploadSubmitImages(id, body, { request = devRequest, progress = stderrLine, concurrency = IMAGE_UPLOAD_CONCURRENCY, wait = delay, attempts = 3 } = {}) {
407
+ const unique = new Map();
408
+ for (const item of body?.items ?? [])
409
+ for (const variant of item.variants ?? [])
410
+ for (const key of ["afterPngBase64", "beforePngBase64"])
411
+ if (variant[key]) {
412
+ const sha = pngSha256(variant[key]);
413
+ if (!unique.has(sha)) unique.set(sha, variant[key]);
414
+ }
415
+ if (unique.size === 0) return body;
416
+ const path = `/api/v1/design/change-sets/${encode(id)}/images`;
417
+ const ids = new Map();
418
+ const queue = [...unique.entries()];
419
+ let done = 0;
420
+ const send = async (pngBase64) => {
421
+ for (let attempt = 1; ; attempt += 1) {
422
+ try {
423
+ return await request("POST", path, { pngBase64 });
424
+ } catch (error) {
425
+ if (!TRANSIENT.has(error?.code) || attempt >= attempts) throw error;
426
+ await wait(attempt * 2_000);
427
+ }
428
+ }
429
+ };
430
+ const worker = async () => {
431
+ for (let next = queue.shift(); next; next = queue.shift()) {
432
+ const [sha, pngBase64] = next;
433
+ const imageId = (await send(pngBase64)).data?.id;
434
+ if (!imageId) throw new CliError("IMAGE_UPLOAD_FAILED", `Dev stored an image for ${id} but named no id for it`, 1);
435
+ ids.set(sha, imageId);
436
+ done += 1;
437
+ progress(`submit images: ${done} of ${unique.size} uploaded to ${id}`);
438
+ }
439
+ };
440
+ await Promise.all(Array.from({ length: Math.min(concurrency, unique.size) }, worker));
441
+ const declared = [];
442
+ const items = (body.items ?? []).map((item) => ({
443
+ ...item,
444
+ variants: (item.variants ?? []).map(({ afterPngBase64, beforePngBase64, ...variant }) => {
445
+ if (afterPngBase64) {
446
+ const sha = pngSha256(afterPngBase64);
447
+ declared.push({ nodeId: variant.nodeId, afterSha256: sha });
448
+ variant.afterImageId = ids.get(sha);
449
+ }
450
+ if (beforePngBase64) variant.beforeImageId = ids.get(pngSha256(beforePngBase64));
451
+ return variant;
452
+ }),
453
+ }));
454
+ return { ...body, items, evidence: { ...(body.evidence ?? {}), nodes: [...declared, ...(body.evidence?.nodes ?? [])] } };
455
+ }
456
+
457
+ // MW8-5.2: "No change set without adoptable code." A change set MUST NOT be submitted without its code pull
458
+ // request, drafted and adoptable (operator, 15 Nov 2026); --code-pr is how a submit names it.
459
+ /** `--code-pr owner/name#123` as Dev's codePr: { repo, number }; anything else is a USAGE error. */
460
+ export function parseCodePr(value) {
461
+ const match = typeof value === "string" ? /^([A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+)#([1-9][0-9]*)$/.exec(value) : null;
462
+ if (!match) throw new CliError("USAGE", `--code-pr takes OWNER/REPO#NUMBER, e.g. --code-pr nodii-ai/nodii-frontend#123 (got ${value === true ? "no value" : JSON.stringify(value)})`, 2);
463
+ return { repo: match[1], number: Number(match[2]) };
464
+ }
465
+
466
+ /** The body with the --code-pr flag's value as codePr; the flag wins over the file's, and says so. */
467
+ export function withCodePr(body, flag, { progress = stderrLine } = {}) {
468
+ if (flag === undefined) return body;
469
+ const codePr = parseCodePr(flag);
470
+ const had = body?.codePr;
471
+ if (had && (had.repo !== codePr.repo || had.number !== codePr.number))
472
+ progress(`--code-pr ${codePr.repo}#${codePr.number} replaces the file's codePr ${had.repo}#${had.number}`);
473
+ return { ...body, codePr };
474
+ }
475
+
395
476
  /** A submit or re-submit, async unless `sync`; a gateway timeout is checked against the set, not resent. */
396
477
  async function submitCall(id, kind, body, { sync = false, request = devRequest, progress = stderrLine, ...job } = {}) {
397
478
  const path = `/api/v1/design/change-sets/${encode(id)}/${kind}`;
@@ -406,7 +487,7 @@ async function submitCall(id, kind, body, { sync = false, request = devRequest,
406
487
  }
407
488
  }
408
489
 
409
- export async function figmaResubmit(id, file, { request = devRequest, read = (f) => readFile(f, "utf8"), laneReads, ...options } = {}) {
490
+ export async function figmaResubmit(id, file, { request = devRequest, read = (f) => readFile(f, "utf8"), laneReads, codePr, ...options } = {}) {
410
491
  if (!id || !file) throw new CliError("USAGE", "figma resubmit CHANGE_SET PAYLOAD.json", 2);
411
492
  let text;
412
493
  try {
@@ -414,8 +495,10 @@ export async function figmaResubmit(id, file, { request = devRequest, read = (f)
414
495
  } catch (error) {
415
496
  throw new CliError("USAGE", `cannot read ${file}: ${error.message}`, 2);
416
497
  }
417
- const body = assertContext(resubmitPayload(text, file), { resubmit: true, file });
498
+ const checked = assertContext(resubmitPayload(text, file), { resubmit: true, file });
499
+ const flagged = withCodePr(checked, codePr, { ...(options.progress ? { progress: options.progress } : {}) });
418
500
  try {
501
+ const body = await uploadSubmitImages(id, flagged, { request, ...(options.progress ? { progress: options.progress } : {}) });
419
502
  // On the lane's reads Dev runs the gate as a submit job too (hub-448), so
420
503
  // they go async like any re-submit; --sync still sends the plain call.
421
504
  const reads = await laneReadsBody(id, laneReads, { request, ...(options.progress ? { progress: options.progress } : {}) });
@@ -801,13 +884,16 @@ export function checkSubmitPayload(payload, file = "the submit body") {
801
884
  return assertContext(payload, { file });
802
885
  }
803
886
 
804
- export async function figmaSubmit(id, payload, { request = devRequest, file = "the submit body", laneReads, progress, ...options } = {}) {
887
+ export async function figmaSubmit(id, payload, { request = devRequest, file = "the submit body", laneReads, codePr, progress, ...options } = {}) {
805
888
  checkSubmitPayload(payload, file);
889
+ const flagged = withCodePr(payload, codePr, { ...(progress ? { progress } : {}) });
806
890
  // On the lane's reads Dev runs the gate as a submit job too (hub-448), so
807
891
  // they go async like any submit; --sync still sends the plain call.
808
892
  const reads = await laneReadsBody(id, laneReads, { request, ...(progress ? { progress } : {}) });
893
+ // The images go up once, here: submitCall's gateway-timeout path never sends the body again.
894
+ const sent = await uploadSubmitImages(id, flagged, { request, ...(progress ? { progress } : {}) });
809
895
  return changeSetCall(id, (method, path, body) => submitCall(id, "submit", body, { request, ...options, ...(progress ? { progress } : {}) }))(
810
- "POST", `/api/v1/design/change-sets/${encode(id)}/submit`, { ...payload, ...reads }).catch((error) => {
896
+ "POST", `/api/v1/design/change-sets/${encode(id)}/submit`, { ...sent, ...reads }).catch((error) => {
811
897
  throw laneReadsRefusal(error);
812
898
  });
813
899
  }
package/dist/flags.js CHANGED
@@ -32,6 +32,8 @@ export const COMMAND_FLAGS = {
32
32
  "machine", "coordinator-run", "machine-id", "repo", "branch", "base", "worktree", "owned-path",
33
33
  "figma", "route", "runtime", "issue", "done-check", "kind", "side", "profile", "class", "model",
34
34
  "subagents", "notes", "narrowing-note", "narrowing-remainder", "heartbeat-seconds",
35
+ // DEV-PROCESS-2: the drill's tools.
36
+ "preflight-only", "tighten",
35
37
  ],
36
38
  "lane amend": ["objective", "scope", "rules", "reason"],
37
39
  "lane fold": ["versions", "summary", "reason"],
@@ -52,7 +54,7 @@ export const COMMAND_FLAGS = {
52
54
  // O3 items 9 and 12 (DEC-0569, MW1-115): --text and --scratch are the new flags.
53
55
  "ruling file": ["text"],
54
56
  "steward register": ["focus", "repos", "side", "key", "scratch"],
55
- "lane resume": ["override", "reason", "host-lost", "min-free-gb", "stagger-seconds", "profile", "class", "if-changed", "ungated"],
57
+ "lane resume": ["override", "reason", "host-lost", "profile", "class", "if-changed", "ungated", "preflight-only", "tighten"],
56
58
  "lane transfer": ["reason", "to-agent"],
57
59
  "inbox ack": ["note"],
58
60
  "lane stop": ["reason", "sweeper", "no-closeout", "no-closeout-push", "launched-in-error", "replaced-by"],
@@ -84,8 +86,8 @@ export const COMMAND_FLAGS = {
84
86
  "request file": ["from", "to", "kind", "summary", "spec", "spec-file", "required-capability", "target-artifact-type", "target-artifact-id"],
85
87
  "docs upload": ["class", "change-class", "pending", "decision", "meaning-unchanged", "conformance-ref", "base", "no-embed", ...WAIT],
86
88
  "docs ratify": ["domain", "decision", ...WAIT],
87
- "figma submit": ["file", "figma-version", ...SUBMIT_MODE, "dry-run", "lane-reads"],
88
- "figma resubmit": [...SUBMIT_MODE, "dry-run", "lane-reads"],
89
+ "figma submit": ["file", "figma-version", ...SUBMIT_MODE, "dry-run", "lane-reads", "code-pr"],
90
+ "figma resubmit": [...SUBMIT_MODE, "dry-run", "lane-reads", "code-pr"],
89
91
  "figma withdraw": ["items", "reason", "lane-reads", "removed-nodes"],
90
92
  "figma split": ["nodes", "title"],
91
93
  "figma restore": ["lane", "holder", "reason"],