@nodii/dev 0.6.68 → 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/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 } : 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
- return `${ref}: 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.` : ""}`;
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
  }
@@ -30,7 +30,7 @@
30
30
  // it until it returns [] (each round can reveal instances inside slot
31
31
  // content).
32
32
 
33
- export const VERSION = "1.0.11";
33
+ export const VERSION = "1.0.12";
34
34
 
35
35
  /** @typedef {{ nodeId: string, check: string, detail: string }} Finding */
36
36
  /**
@@ -828,8 +828,13 @@ export function checkConformance({
828
828
  // notFromLibrary: local parts and hand-drawn stand-ins, off the library.
829
829
  if (!library && own) {
830
830
  if (n.type === "COMPONENT" || n.type === "COMPONENT_SET") {
831
+ // A submitted variant is its own root, so its set is not in the
832
+ // walked tree; Figma's components map still names the set.
831
833
  const setName =
832
- n.type === "COMPONENT" ? a.parent.get(n.id)?.name : null;
834
+ n.type === "COMPONENT"
835
+ ? (a.parent.get(n.id)?.name ??
836
+ a.componentSets[a.components[n.id]?.componentSetId]?.name)
837
+ : null;
833
838
  if (!SURFACE_NAME.test(n.name) && !SURFACE_NAME.test(setName ?? ""))
834
839
  push(
835
840
  findings,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodii/dev",
3
- "version": "0.6.68",
3
+ "version": "0.6.70",
4
4
  "description": "Agent CLI for Nodii Dev, reached through the platform edge",
5
5
  "type": "module",
6
6
  "bin": {
@@ -20,6 +20,8 @@
20
20
  "format": "git diff --check",
21
21
  "test": "node --test test/*.test.js",
22
22
  "pack:smoke": "node scripts/pack-smoke.mjs",
23
+ "edge-routes:refresh": "node scripts/edge-routes.mjs",
24
+ "edge-routes:check": "node scripts/edge-routes.mjs --check",
23
25
  "openapi:snapshot": "node scripts/openapi-snapshot.mjs",
24
26
  "openapi:ad-era": "node scripts/ad-era-openapi-snapshot.mjs",
25
27
  "openapi:watchdog": "node scripts/watchdog-openapi-snapshot.mjs"