@nodii/dev 0.6.210 → 0.6.211
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 +23 -14
- package/dist/cli.js +43 -21
- package/dist/coordinator-watch.js +21 -17
- package/dist/core.js +1 -1
- package/dist/flags.js +3 -1
- package/dist/floor.env +15 -0
- package/dist/harness.js +5 -1
- package/dist/heavy-slot.sh +138 -143
- package/dist/heavy.js +140 -5
- package/dist/lanes.js +51 -33
- package/dist/machine-floor.js +526 -0
- package/dist/review.js +4 -3
- package/dist/rulings.js +8 -9
- package/dist/safety.js +6 -2
- package/dist/session-kind.js +1 -1
- package/dist/starting.js +12 -0
- package/dist/watchdog.js +21 -16
- package/package.json +1 -1
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
|
-
-
|
|
171
|
-
- The
|
|
172
|
-
-
|
|
173
|
-
-
|
|
174
|
-
-
|
|
175
|
-
-
|
|
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
|
|
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.
|
|
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)
|
|
@@ -700,8 +706,10 @@ instruction or rule the person gives about how work is done with
|
|
|
700
706
|
`nodii-dev ruling file --text - <<'EOF'` (the exact words on stdin, the
|
|
701
707
|
heredoc's closing newline dropped) or `--text '<their exact words>'` in
|
|
702
708
|
single quotes, in that turn. `ruling file` sends the words only when they are
|
|
703
|
-
an exact substring of this session's own turn
|
|
704
|
-
|
|
709
|
+
an exact substring of this session's own turn recorded in the last 30 minutes.
|
|
710
|
+
The command matches the hook's session ID using `CODEX_SESSION_ID` or
|
|
711
|
+
`CODEX_THREAD_ID` for Codex, or `CLAUDE_SESSION_ID` or
|
|
712
|
+
`CLAUDE_CODE_SESSION_ID` for Claude. The text must match byte for byte or
|
|
705
713
|
with surrounding whitespace trimmed; otherwise, or with no session id, it
|
|
706
714
|
refuses `RULING_NOT_TYPED`, exits 2 and sends nothing. Words shorter than 3
|
|
707
715
|
words or 12 characters, or longer than 4000 characters, are `USAGE`. Dev
|
|
@@ -808,12 +816,13 @@ nodii-dev lane message TO --body TEXT|--body-file FILE [--issue ISSUE]
|
|
|
808
816
|
nodii-dev lane inbox [KEY] [--all]
|
|
809
817
|
# lane-to-lane messaging (NODII-DEV-CLI-191); see "Lane messages"
|
|
810
818
|
nodii-dev coordinator items [--machine NAME|ID]
|
|
811
|
-
nodii-dev lane resume --host-lost [--
|
|
819
|
+
nodii-dev lane resume --host-lost [--tighten READING=GB]
|
|
812
820
|
# after a reboot (coordinator): resume every host_lost lane
|
|
813
821
|
# on this machine in priority order, each under its own
|
|
814
|
-
# key, agent, worktree and branch.
|
|
815
|
-
#
|
|
816
|
-
#
|
|
822
|
+
# key, agent, worktree and branch. Waits the floor file's
|
|
823
|
+
# stagger between lanes and stops with MACHINE_UNDER_FLOOR
|
|
824
|
+
# (exit 75) when the machine's floor refuses the next one;
|
|
825
|
+
# run it again to carry on (AGENT-HARNESS-67, DEV-PROCESS-2)
|
|
817
826
|
nodii-dev lane transfer KEY --reason TEXT [--to-agent ID]
|
|
818
827
|
# move a host_lost lane to the recovering agent on this
|
|
819
828
|
# machine under a fresh run (AGENT-HARNESS-67)
|
package/dist/cli.js
CHANGED
|
@@ -326,8 +326,8 @@ Usage: nodii-dev <command> [options] [--json]
|
|
|
326
326
|
# one line asking the session to file the person's rules verbatim, and shows
|
|
327
327
|
# a steward session its unread lane messages from its local inbox (MW1-115)
|
|
328
328
|
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
|
|
330
|
-
#
|
|
329
|
+
# records them with person, session and time. The Codex or Claude session ID
|
|
330
|
+
# must match its prompt hook's record. Unverified words are refused (RULING_NOT_TYPED) and nothing
|
|
331
331
|
# is sent; fewer than 3 words or 12 characters, or over 4000, is USAGE. --text -
|
|
332
332
|
# reads the exact words from stdin (a quoted heredoc). Binds nothing until sorted
|
|
333
333
|
# and uploaded
|
|
@@ -448,8 +448,14 @@ Usage: nodii-dev <command> [options] [--json]
|
|
|
448
448
|
--class long|short|no-build # MW1-38.3 class, weighed against the account's MW1-38.2 band
|
|
449
449
|
[--base NAME=REF] [--worktree NAME=PATH] [--owned-path NAME=PATH]
|
|
450
450
|
[--route /app/... ...] [--figma FILE_KEY[=COMPONENT_SET_KEY[,KEY]]] [--notes TEXT]
|
|
451
|
-
[--narrowing-note TEXT --narrowing-remainder DESTINATION]
|
|
451
|
+
[--narrowing-note TEXT --narrowing-remainder DESTINATION] [--preflight-only] [--tighten READING=GB]
|
|
452
452
|
# authoritative preflight, one worktree per repo, watched launch
|
|
453
|
+
# --preflight-only (DEV-PROCESS-2) reads the machine's floor first (before the
|
|
454
|
+
# governor, the cap and the account), then runs the preflight and creates
|
|
455
|
+
# nothing; under the floor it exits 75 with MACHINE_UNDER_FLOOR, naming the
|
|
456
|
+
# reading, the figure and the five largest holders of memory. --tighten
|
|
457
|
+
# memory=GB|swap=GB|disk=GB makes this one call stricter (refused if it would
|
|
458
|
+
# loosen: the floor is 10 GB available, 24 GB swap used, 15 GB disk free)
|
|
453
459
|
# --subagents defaults to 4 (0 to 100; 0 is none). Default shape: fewer
|
|
454
460
|
# lanes, with subagents fanned out inside each (MW1-38.15). Dev clamps a new
|
|
455
461
|
# lane's quota to 2 or 1 in the two_builds or one_build usage band and the
|
|
@@ -529,20 +535,31 @@ Usage: nodii-dev <command> [options] [--json]
|
|
|
529
535
|
# A failure main already has is a baseline (MW2-21): failed files rerun alone, and
|
|
530
536
|
# those the branch did not change rerun at the merge base (cached per base); it
|
|
531
537
|
# passes, naming "red on main at SHA", when every failure is main's
|
|
532
|
-
heavy run [--size light|heavy] -- <command...>
|
|
538
|
+
heavy run [--size light|heavy] [--tighten READING=GB] -- <command...>
|
|
533
539
|
# run heavy work (tests, typecheck, build, gate, git push, image build,
|
|
534
|
-
# detached stack start) under one machine-wide slot (MW2-51)
|
|
535
|
-
#
|
|
536
|
-
#
|
|
537
|
-
#
|
|
538
|
-
#
|
|
539
|
-
#
|
|
540
|
-
#
|
|
541
|
-
#
|
|
542
|
-
#
|
|
543
|
-
#
|
|
544
|
-
|
|
545
|
-
#
|
|
540
|
+
# detached stack start) under one machine-wide slot (MW2-51, DEV-PROCESS-2).
|
|
541
|
+
# It reads the machine's floor first: available memory after running jobs'
|
|
542
|
+
# reserved peaks (7 GB heavy, 1 GB light, less use) at least 10 GB (5 for a
|
|
543
|
+
# light job), swap used at most 24 GB, disk free at least 15 GB. Under it the
|
|
544
|
+
# job exits 75 at once with MACHINE_UNDER_FLOOR, naming the reading, the
|
|
545
|
+
# figure and the five largest holders of memory: never queued, no exception
|
|
546
|
+
# for a lone job or a push. Above it, it waits in FIFO order while the slots
|
|
547
|
+
# are full or the 10 s stagger runs, and reads the floor again when a slot is
|
|
548
|
+
# free. Floor, peaks and ceilings (3 heavy slots, one only for a push; 8
|
|
549
|
+
# light) come from root-owned /etc/nodii/floor.env, else shipped defaults;
|
|
550
|
+
# no variable changes them. --tighten memory=GB|swap=GB|disk=GB makes this
|
|
551
|
+
# one call stricter (a figure that would loosen the floor exits 2). A heavy
|
|
552
|
+
# run under a slot's holder (its process tree) runs in that slot (K02-6).
|
|
553
|
+
# Only end-to-end, real-stack and browser work takes a heavy slot;
|
|
554
|
+
# typecheck, lint, unit tests and a push take a light one (--size heavy
|
|
555
|
+
# forces heavy). A slot held 10 min whose lane is down in Dev and whose
|
|
556
|
+
# agent is gone is reclaimed and logged. In a lane the safety hook
|
|
557
|
+
# refuses unqueued heavy work (SAFETY_HEAVY_UNQUEUED; a heavy-slot.sh copy is
|
|
558
|
+
# no queue) and every-page checks, CI only (SAFETY_CI_ONLY)
|
|
559
|
+
heavy status # the floor file, memory available and after reservations, swap used and
|
|
560
|
+
# disk free beside the floor, each class's floor and peak, the ceilings,
|
|
561
|
+
# the slots held (with lane and reclaim candidates), the queues and the last
|
|
562
|
+
# hour's admissions (any under the floor is flagged)
|
|
546
563
|
heavy lane-state <lane-key> # up|down|unknown: Dev's view of a slot's lane, as the reclaim reads it
|
|
547
564
|
sync pending [--discard FILE --reason TEXT]
|
|
548
565
|
# send the lane records queued while Dev was down (MW1-64); --discard drops
|
|
@@ -557,7 +574,8 @@ Usage: nodii-dev <command> [options] [--json]
|
|
|
557
574
|
# and slot; its coordinator's lane close needs this record (LANE_NOT_FINISHED)
|
|
558
575
|
lane subagent-quota <key> <n> # coordinator assigns 0-100 subagent slots
|
|
559
576
|
lane cap <machine> <n> [--confirm-raise --reason TEXT]
|
|
560
|
-
# coordinator declares the machine's lane cap
|
|
577
|
+
# coordinator declares the machine's lane cap; it holds while the machine's
|
|
578
|
+
# watchdog reports in and lapses once Dev's last report is 10 minutes old;
|
|
561
579
|
# a raise needs a yes and a reason (MW1-38.10, MW1-38.13)
|
|
562
580
|
lane heartbeat|resume|land|verify|prioritize|deprioritize|stop <key>
|
|
563
581
|
lane verify <key> --dev-check REF [--checks FILE]
|
|
@@ -660,11 +678,15 @@ Usage: nodii-dev <command> [options] [--json]
|
|
|
660
678
|
# on to deploy and the dev check. Unless NODII_DEV_SAME_SESSION_RESUME=0, a resume
|
|
661
679
|
# continues the dead run's own session when this machine has its log, with a
|
|
662
680
|
# short prompt instead of the Freeze; with =0 it starts fresh as before
|
|
663
|
-
lane resume
|
|
681
|
+
lane resume <key> --preflight-only [--tighten READING=GB]
|
|
682
|
+
# DEV-PROCESS-2: the machine's floor first, as lane launch --preflight-only;
|
|
683
|
+
# then reads the lane and resumes nothing
|
|
684
|
+
lane resume --host-lost [--tighten READING=GB]
|
|
664
685
|
# coordinator, after a reboot: resume every host_lost lane on this machine
|
|
665
686
|
# in priority order under its own key, agent, worktree and branch. No
|
|
666
|
-
# amendment or override.
|
|
667
|
-
#
|
|
687
|
+
# amendment or override. Waits the floor file's stagger between lanes and
|
|
688
|
+
# reads the machine floor before each; under it, stops (MACHINE_UNDER_FLOOR,
|
|
689
|
+
# exit 75) and holds the rest; run it again to carry on
|
|
668
690
|
lane transfer <key> --reason TEXT [--to-agent ID]
|
|
669
691
|
# move a host_lost lane to the recovering agent (this config's, or ID), which
|
|
670
692
|
# must be a fresh agent named lane-<key> on the same machine: a fresh run,
|
|
@@ -821,7 +843,7 @@ Refusals of leeway, the coordinator's items, lane finish, lane resume, the manag
|
|
|
821
843
|
HARNESS_SETTINGS_INVALID .claude/settings.json or .codex/hooks.json is not valid JSON. Next: repair the file, then run harness update
|
|
822
844
|
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
845
|
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
|
|
846
|
+
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
847
|
|
|
826
848
|
Run a command with --help or see the package README for all flags.`;
|
|
827
849
|
|
|
@@ -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
|
-
/**
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
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]),
|
|
93
|
+
return { load15: Math.round(load()[2]), floor: floorVerdict, laneProcesses };
|
|
93
94
|
}
|
|
94
95
|
|
|
95
|
-
/** Whether a resume may run now.
|
|
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
|
-
|
|
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
|
|
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.
|
|
7
|
+
export const VERSION = "0.6.211";
|
|
8
8
|
export const configPath = () =>
|
|
9
9
|
process.env.NODII_DEV_CONFIG_PATH ??
|
|
10
10
|
join(homedir(), ".config/nodii-dev/config.json");
|
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", "
|
|
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"],
|
package/dist/floor.env
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# The machine's floor (DEV-PROCESS-2), shipped with @nodii/dev. Installed by the machine owner, with their password:
|
|
2
|
+
# sudo install -d -o root -g wheel -m 755 /etc/nodii
|
|
3
|
+
# sudo install -o root -g wheel -m 644 "$(npm root -g)/@nodii/dev/dist/floor.env" /etc/nodii/floor.env
|
|
4
|
+
# heavy-slot.sh and every lane launch, resume and keepalive read it only while root owns it and /etc/nodii and
|
|
5
|
+
# neither is group- or world-writable; else the same shipped defaults hold (machine-floor.js DEFAULTS).
|
|
6
|
+
MIN_AVAIL_GB=10 # available memory, after running jobs' reserved peaks, for a heavy check, launch or resume
|
|
7
|
+
LIGHT_MIN_AVAIL_GB=5 # the same for a light check (typecheck, lint, unit tests, a push)
|
|
8
|
+
MAX_SWAP_GB=24 # swap used, at most
|
|
9
|
+
MIN_DISK_GB=15 # disk free on /, at least
|
|
10
|
+
HEAVY_PEAK_GB=7 # what a running heavy job holds back, less what it uses
|
|
11
|
+
LIGHT_PEAK_GB=1 # what a running light job holds back, less what it uses
|
|
12
|
+
HEAVY_SLOTS=3 # heavy jobs at once, machine-wide
|
|
13
|
+
LANDING_RESERVE=1 # of them, slots only a push may use
|
|
14
|
+
LIGHT_SLOTS=8 # light jobs at once (everything but end-to-end, real-stack and browser work)
|
|
15
|
+
STAGGER_SEC=10 # gap between two admissions while another job runs
|
package/dist/harness.js
CHANGED
|
@@ -11,7 +11,7 @@ import { fileURLToPath } from "node:url";
|
|
|
11
11
|
import { promisify } from "node:util";
|
|
12
12
|
import { CliError, devRequest, query } from "./core.js";
|
|
13
13
|
import { classifyClaudeManaged, claudeManagedSettingsPath, managedClaudeHookBundle, managedHookBundle, nodiiCommandArgs, refreshManagedDispatchers, writeManagedClaudeHookBundle, writeManagedHookBundle } from "./managed-hooks.js";
|
|
14
|
-
import { heartbeatSettingsSnippet } from "./hooks.js";
|
|
14
|
+
import { heartbeatSettingsSnippet, settingsSnippet } from "./hooks.js";
|
|
15
15
|
import { nudgeSettingsSnippet } from "./nudges.js";
|
|
16
16
|
import { toolingDocsSettingsSnippet } from "./tooling-docs.js";
|
|
17
17
|
import { codexSafetyHooksSnippet, regroundingHooksSnippet, safetySettingsSnippet } from "./safety.js";
|
|
@@ -202,6 +202,10 @@ export function withSafetyHooks(harness) {
|
|
|
202
202
|
let hooks = addHookEntries(parsed.hooks, safetySettingsSnippet().hooks);
|
|
203
203
|
hooks = addHookEntries(hooks, regroundingHooksSnippet().hooks);
|
|
204
204
|
hooks = addHookEntries(hooks, heartbeatSettingsSnippet().hooks);
|
|
205
|
+
// Dev's generated settings may predate write logging. Keep the executable
|
|
206
|
+
// Figma post hook in every installed harness so lane writes reach their
|
|
207
|
+
// change set even while the methodology payload catches up.
|
|
208
|
+
hooks = addHookEntries(hooks, { PostToolUse: settingsSnippet().hooks.PostToolUse });
|
|
205
209
|
hooks = addHookEntries(hooks, nudgeSettingsSnippet().hooks);
|
|
206
210
|
hooks = addHookEntries(hooks, toolingDocsSettingsSnippet().hooks);
|
|
207
211
|
assertNodiiHooks(hooks, ".claude/settings.json");
|