@nodii/dev 0.6.69 → 0.6.70
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 +11 -0
- package/dist/cli.js +6 -0
- package/dist/core.js +1 -1
- package/dist/flags.js +1 -1
- package/dist/lanes.js +38 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -441,6 +441,17 @@ nodii-dev lane resume --host-lost [--min-free-gb N] [--stagger-seconds N]
|
|
|
441
441
|
nodii-dev lane transfer KEY --reason TEXT [--to-agent ID]
|
|
442
442
|
# move a host_lost lane to the recovering agent on this
|
|
443
443
|
# machine under a fresh run (AGENT-HARNESS-67)
|
|
444
|
+
nodii-dev lane resume KEY --profile PATH --class long|short|no-build
|
|
445
|
+
# coordinator or staff (MW1-38.5): start the fresh run on
|
|
446
|
+
# another registered account, read fresh first. The lane
|
|
447
|
+
# keeps its key, branch, worktree, slot and history; Dev
|
|
448
|
+
# records both accounts on the run and in the audit log.
|
|
449
|
+
# Refused with LANE_PROCESS_LIVE while its process is live,
|
|
450
|
+
# ACCOUNT_BAND_REFUSED if the account's band doesn't admit
|
|
451
|
+
# the class, ACCOUNT_LIMIT_UNAVAILABLE for an unregistered,
|
|
452
|
+
# offline or unread account, and LANE_ALREADY_ON_ACCOUNT. A
|
|
453
|
+
# lane stopped by two deaths moves off an exhausted account
|
|
454
|
+
# with no amendment or override, and its death count restarts
|
|
444
455
|
nodii-dev lane resume KEY [--override --reason TEXT]
|
|
445
456
|
# --override (coordinator): resume a lane the two-identical-
|
|
446
457
|
# deaths rule stopped; Dev refuses it with
|
package/dist/cli.js
CHANGED
|
@@ -282,6 +282,12 @@ Usage: nodii-dev <command> [options] [--json]
|
|
|
282
282
|
# its last death; the reason is kept on the new run. Any resume is
|
|
283
283
|
# refused (LANE_PROCESS_LIVE) while the lane has a running run or a
|
|
284
284
|
# fresh lane-agent heartbeat since the death: one process per lane
|
|
285
|
+
lane resume <key> --profile PATH --class long|short|no-build
|
|
286
|
+
# coordinator or staff (MW1-38.5): start the fresh run on another registered
|
|
287
|
+
# account. Dev refuses it while the process is live (LANE_PROCESS_LIVE), or if the
|
|
288
|
+
# account's band doesn't admit the class (ACCOUNT_BAND_REFUSED). The lane keeps its
|
|
289
|
+
# key, branch, worktree, slot and history. A lane stopped by two deaths moves off
|
|
290
|
+
# an exhausted account with no amendment or override
|
|
285
291
|
lane resume --host-lost [--min-free-gb N] [--stagger-seconds N]
|
|
286
292
|
# coordinator, after a reboot: resume every host_lost lane on this machine
|
|
287
293
|
# in priority order under its own key, agent, worktree and branch. No
|
package/dist/core.js
CHANGED
|
@@ -4,7 +4,7 @@ import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
|
4
4
|
import { homedir, platform } from "node:os";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
|
|
7
|
-
export const VERSION = "0.6.
|
|
7
|
+
export const VERSION = "0.6.70";
|
|
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
|
@@ -33,7 +33,7 @@ export const COMMAND_FLAGS = {
|
|
|
33
33
|
"lane evidence": ["pr", "commit", "figma", "deploy", "dev-check"],
|
|
34
34
|
"lane done-check": ["evidence"],
|
|
35
35
|
"lane heartbeat": ["note"],
|
|
36
|
-
"lane resume": ["override", "reason", "host-lost", "min-free-gb", "stagger-seconds"],
|
|
36
|
+
"lane resume": ["override", "reason", "host-lost", "min-free-gb", "stagger-seconds", "profile", "class"],
|
|
37
37
|
"lane transfer": ["reason", "to-agent"],
|
|
38
38
|
"lane stop": ["reason"],
|
|
39
39
|
"lane land": [],
|
package/dist/lanes.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { execFile } from "node:child_process";
|
|
2
2
|
import { readFile, realpath, writeFile } from "node:fs/promises";
|
|
3
|
+
import { isAbsolute } from "node:path";
|
|
3
4
|
import { promisify } from "node:util";
|
|
5
|
+
import { coordinatorMachineId, listAccounts, profilePath, reportUsage } from "./accounts.js";
|
|
4
6
|
import { CliError, encode, devRequest, query, readConfig, requireFlag } from "./core.js";
|
|
5
7
|
import { launchRecovery } from "./runtime-launcher.js";
|
|
6
8
|
import { recordReviewReceipt, reviewCommitContext } from "./safety.js";
|
|
@@ -316,9 +318,28 @@ const positiveNumber = (value, flag, fallback) => {
|
|
|
316
318
|
* memory shows, and the run stops at the memory floor: the lanes it holds stay
|
|
317
319
|
* host_lost, so running it again carries on.
|
|
318
320
|
*/
|
|
321
|
+
// MW1-38.1: read the limits a move depends on: the account it goes to, and the
|
|
322
|
+
// others of that runtime, one of which is the account it leaves. A failed read
|
|
323
|
+
// is not fatal: Dev refuses a missing or stale reading on the new account and
|
|
324
|
+
// names the command that fixes it.
|
|
325
|
+
async function refreshMoveAccounts(profile, { request, config }) {
|
|
326
|
+
try {
|
|
327
|
+
const machineId = await coordinatorMachineId({ request, config });
|
|
328
|
+
const accounts = await listAccounts(machineId, { request });
|
|
329
|
+
const target = accounts.find((account) => account.profile === profile);
|
|
330
|
+
if (!target) return;
|
|
331
|
+
const others = accounts.filter((account) => account.runtime === target.runtime && account !== target);
|
|
332
|
+
await reportUsage(others, { request });
|
|
333
|
+
// The move is about to spend this account, so an opted-in Codex account may probe.
|
|
334
|
+
await reportUsage([target], { request, probe: true });
|
|
335
|
+
} catch {}
|
|
336
|
+
}
|
|
337
|
+
|
|
319
338
|
async function resumeHostLost(flags, deps, { request, config }) {
|
|
320
339
|
if (flags.override || flags.reason !== undefined)
|
|
321
340
|
throw new CliError("USAGE", "lane resume --host-lost needs no --override: a restart is not a death.", 2);
|
|
341
|
+
if (flags.profile !== undefined || flags.class !== undefined)
|
|
342
|
+
throw new CliError("USAGE", "lane resume --host-lost resumes each lane on its own account; move one with lane resume <key> --profile PATH --class CLASS.", 2);
|
|
322
343
|
const floor = positiveNumber(flags["min-free-gb"], "--min-free-gb", HOST_LOST_MIN_FREE_GB) * GIB;
|
|
323
344
|
const stagger = positiveNumber(flags["stagger-seconds"], "--stagger-seconds", HOST_LOST_STAGGER_SECONDS) * 1000;
|
|
324
345
|
const { memory = availableMemoryBytes, sleep = (ms) => new Promise((done) => setTimeout(done, ms)) } = deps;
|
|
@@ -364,7 +385,7 @@ async function resumeHostLost(flags, deps, { request, config }) {
|
|
|
364
385
|
}
|
|
365
386
|
|
|
366
387
|
export async function laneCommand(action, args, flags, deps = {}) {
|
|
367
|
-
const { request = devRequest, config = readConfig, gitContext = inferGitContext, commitsOf = branchCommits, read = (path) => readFile(path, "utf8"), reviewContext = reviewCommitContext, reviewReceipt = recordReviewReceipt, picker = pickDocuments, warm = warmPicker, firstPickTimeoutMs = PICKER_FIRST_PICK_TIMEOUT_MS, timings = { record: recordPickTiming, read: readPickTimings }, changedPaths = laneChangedPaths, gatherTimeoutMs = GATHER_TIMEOUT_MS, deadline: outerDeadline, storeFreeze = storeGatherFreeze, launch = launchRecovery, rebind = rebindLaneConfig, catalog = loadDsCatalog, pickLock = withPickLock, check: checkDeps = {} } = deps;
|
|
388
|
+
const { request = devRequest, config = readConfig, refreshAccounts = refreshMoveAccounts, gitContext = inferGitContext, commitsOf = branchCommits, read = (path) => readFile(path, "utf8"), reviewContext = reviewCommitContext, reviewReceipt = recordReviewReceipt, picker = pickDocuments, warm = warmPicker, firstPickTimeoutMs = PICKER_FIRST_PICK_TIMEOUT_MS, timings = { record: recordPickTiming, read: readPickTimings }, changedPaths = laneChangedPaths, gatherTimeoutMs = GATHER_TIMEOUT_MS, deadline: outerDeadline, storeFreeze = storeGatherFreeze, launch = launchRecovery, rebind = rebindLaneConfig, catalog = loadDsCatalog, pickLock = withPickLock, check: checkDeps = {} } = deps;
|
|
368
389
|
if (action === "resume" && flags["host-lost"]) {
|
|
369
390
|
if (args[0]) throw new CliError("USAGE", "lane resume --host-lost takes no <key>: it resumes every host_lost lane on this machine.", 2);
|
|
370
391
|
return resumeHostLost(flags, deps, { request, config });
|
|
@@ -854,10 +875,23 @@ export async function laneCommand(action, args, flags, deps = {}) {
|
|
|
854
875
|
const overrideReason = typeof flags.reason === "string" ? flags.reason.trim() : "";
|
|
855
876
|
if (flags.override && !overrideReason) throw new CliError("USAGE", "--reason needs TEXT: why resuming the amended lane is safe.", 2);
|
|
856
877
|
if (overrideReason.length > 2_000) throw new CliError("USAGE", `--reason is ${overrideReason.length} characters; Dev keeps at most 2,000.`, 2);
|
|
878
|
+
// NODII-DEV-CLI-53 (MW1-38.5): --profile starts the run on another registered
|
|
879
|
+
// account. Dev keeps no class for a lane, so it is named here, as at launch.
|
|
880
|
+
if ((flags.profile === undefined) !== (flags.class === undefined))
|
|
881
|
+
throw new CliError("USAGE", "lane resume --profile PATH and --class long|short|no-build go together.", 2);
|
|
882
|
+
let move = {};
|
|
883
|
+
if (flags.profile !== undefined) {
|
|
884
|
+
const profile = typeof flags.profile === "string" ? profilePath(flags.profile.trim()) : "";
|
|
885
|
+
if (!isAbsolute(profile)) throw new CliError("USAGE", "--profile must be an absolute runtime profile path.", 2);
|
|
886
|
+
const workClass = { long: "long", short: "short", "no-build": "no_build" }[flags.class];
|
|
887
|
+
if (!workClass) throw new CliError("USAGE", "--class must be long, short or no-build (a one-file fix, a publish or verify relaunch, or an evidence-only step).", 2);
|
|
888
|
+
await refreshAccounts(profile, { request, config });
|
|
889
|
+
move = { profile, workClass };
|
|
890
|
+
}
|
|
857
891
|
const payload = await request(
|
|
858
892
|
"POST",
|
|
859
893
|
`/api/v1/lanes/${encode(id)}/resume`,
|
|
860
|
-
flags.override ? { override: true, reason: overrideReason, ...via }
|
|
894
|
+
{ ...(flags.override ? { override: true, reason: overrideReason } : {}), ...move, ...via },
|
|
861
895
|
);
|
|
862
896
|
const launched = await launchReserved(payload);
|
|
863
897
|
return {
|
|
@@ -870,7 +904,8 @@ export async function laneCommand(action, args, flags, deps = {}) {
|
|
|
870
904
|
? `${next.side}/${next.step}`
|
|
871
905
|
: "the lane's next unfinished step";
|
|
872
906
|
const override = response.data.run.resumeOverrideReason;
|
|
873
|
-
|
|
907
|
+
const moved = response.data.accountMove;
|
|
908
|
+
return `${ref}: ${moved ? `moved from the account at ${moved.fromProfile ?? "an unrecorded profile"} to ${moved.toProfile}; ` : ""}resumed fresh run ${runId} as PID ${launched.pid}; continuing ${continuation} from ${checkpoint}.${override ? ` Override past the two-deaths stop recorded ("${override}"); the death count restarts.` : ""}`;
|
|
874
909
|
},
|
|
875
910
|
};
|
|
876
911
|
}
|