@nodii/dev 0.6.184 → 0.6.185

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
@@ -749,6 +749,16 @@ nodii-dev lane resume KEY [--override --reason TEXT]
749
749
  # running run or a lane-agent heartbeat since the death
750
750
  # that is not yet old enough to be dead: one process per
751
751
  # lane (the coordinator's own heartbeats do not count)
752
+ nodii-dev lane resume KEY [--ungated]
753
+ # NODII-DEV-CLI-191: a plain resume (with or without
754
+ # --profile/--class) of a lane with waits of its own, or
755
+ # whose liveness is blocked, goes through the same gate as
756
+ # --if-changed, and prints how to pass --ungated when it is
757
+ # refused. --ungated (or --override with its reason) resumes
758
+ # it anyway, on purpose; apply-watch's resume of a decided
759
+ # set's holder and the watchdog's resume-due resume pass it.
760
+ # A lane with no waits (killed mid-work) resumes with no
761
+ # gate. Off with NODII_DEV_RESUME_IF_CHANGED=0.
752
762
  nodii-dev lane resume KEY --if-changed
753
763
  # On unless NODII_DEV_RESUME_IF_CHANGED=0 (see "Lane feature
754
764
  # switches"); off, it refuses RESUME_IF_CHANGED_OFF.
@@ -762,9 +772,11 @@ nodii-dev lane resume KEY --if-changed
762
772
  # be read (gh or Dev failed) is no change: it prints
763
773
  # BLOCKERS_UNREADABLE, exits 0 and records nothing. A
764
774
  # resume carries the gate's reason as data.resumeGate.
765
- # A run that ends BLOCKED records its fingerprint as the
766
- # baseline, so its own last heartbeat (new waits) or a
767
- # leeway it acknowledged is not a change. A superseded lane (every
775
+ # A run that ends BLOCKED, or any exit 0 that leaves the
776
+ # lane with waits of its own (not an account death or a
777
+ # kill), records its fingerprint as the baseline, so its
778
+ # own last heartbeat (new waits) or a leeway it
779
+ # acknowledged is not a change. A superseded lane (every
768
780
  # issue it holds closed) is refused as LANE_DEAD with the
769
781
  # evidence; nothing stops it here (the coordinator ends it by
770
782
  # the MW1-28 exit that fits). A
@@ -2066,13 +2078,39 @@ set to exactly `0` turns one off.
2066
2078
  | Variable | Feature (on by default) | With `=0` |
2067
2079
  |---|---|---|
2068
2080
  | `NODII_DEV_BLOCKED_NOT_EXIT` | BLOCKED is not an exit: only a typed human gate ends a run early | A BLOCKED lane ends its run as before, except where leeway covers it (MW1-12.6) |
2069
- | `NODII_DEV_RESUME_IF_CHANGED` | `lane resume --if-changed` | Refused `RESUME_IF_CHANGED_OFF`; resume without it |
2081
+ | `NODII_DEV_RESUME_IF_CHANGED` | `lane resume --if-changed`, and the same gate on a plain resume of a lane that waits | Refused `RESUME_IF_CHANGED_OFF`; a plain resume is never gated |
2070
2082
  | `NODII_DEV_SAME_SESSION_RESUME` | A resume continues the dead run's own session with a short prompt | A resume starts a fresh session with the Freeze |
2071
2083
  | `NODII_DEV_SUBAGENT_BUDGET` | The subagent budget line in the launch brief, gather's next step and the resume prompt | No line |
2072
2084
  | `NODII_DEV_ISSUES_GROUP` | `issues group` | Refused `ISSUES_GROUP_OFF` |
2073
2085
  | `NODII_DEV_LANE_MESSAGES` | `lane message`, `lane inbox` and their delivery by the Stop hook, `hook nudge-pre` and the supervisor | Refused `LANE_MESSAGES_OFF`; no hook delivers from an inbox file |
2074
2086
  | `NODII_DEV_STOP_ONLY_HEARTBEAT` | The harness beats a lane on `Stop` only; the supervisor and `hook nudge-pre` beat it while it acts | The harness's `hook lane-heartbeat` runs on every tool call and on `Stop`, as before |
2075
2087
 
2088
+ ### Plugins and connectors a lane run keeps (NODII-DEV-CLI-191)
2089
+
2090
+ A Claude lane run starts with only the user-level plugins and connectors that
2091
+ its scope uses. On 19 Nov, about 9k tokens of a lane's first call were synced
2092
+ plugins and claude.ai connectors that no lane used: marketing and design
2093
+ skills, Slack, Gmail and Canva servers, GitHub, and Microsoft 365. The machine
2094
+ coordinator allowed launches to turn these off (a8, 19 Nov 2026), with the
2095
+ list derived from each lane's own scope rather than fixed.
2096
+
2097
+ `lane launch`, `lane resume` and a same-session continuation:
2098
+ - read the profile's synced plugins (`plugins/synced/*/*/.claude-plugin/plugin.json`);
2099
+ - turn off every one the lane doesn't keep, with
2100
+ `--settings {"enabledPlugins":{"<name>@synced":false}}`.
2101
+
2102
+ What a lane keeps depends on whether its scope reaches Figma. It does when the
2103
+ lane has a Figma scope, holds `design-system` or `nodii-frontend`, or its
2104
+ objective or notes name Figma, Surfaces, the design system, change sets or Code
2105
+ Connect.
2106
+ - **A lane that reaches Figma** keeps the `figma` and `design` plugins and the
2107
+ claude.ai connectors, which include the Figma MCP.
2108
+ - **Any other lane** also runs with `ENABLE_CLAUDEAI_MCP_SERVERS=false`.
2109
+
2110
+ Browser tools and repository skills are not synced plugins and are never
2111
+ touched. Each run writes what it turned off as the first line of its
2112
+ `process.log`. `NODII_DEV_PLUGIN_TRIM=0` keeps everything on.
2113
+
2076
2114
  ### Lane messages (NODII-DEV-CLI-191)
2077
2115
 
2078
2116
  MW1-12.11. On unless `NODII_DEV_LANE_MESSAGES=0` (see "Lane feature switches").
package/dist/cli.js CHANGED
@@ -606,6 +606,10 @@ Usage: nodii-dev <command> [options] [--json]
606
606
  # (else 5 h for a limit, 1 h otherwise) in exhausted-accounts.json. Any lane resume
607
607
  # then moves the lane to another account of its runtime with headroom, saying so,
608
608
  # or refuses ACCOUNT_EXHAUSTED; --profile naming another account still goes
609
+ lane resume <key> [--ungated]
610
+ # NODII-DEV-CLI-191: a plain resume (also with --profile/--class) of a lane with
611
+ # waits of its own, or blocked, goes through the --if-changed gate; --ungated (or
612
+ # --override --reason) resumes it anyway. A lane with no waits resumes as before
609
613
  lane resume <key> --if-changed
610
614
  # On unless NODII_DEV_RESUME_IF_CHANGED=0; with =0 it refuses
611
615
  # RESUME_IF_CHANGED_OFF and resumes nothing. On:
@@ -141,7 +141,7 @@ async function applyWatchJob(ctx) {
141
141
  done.push(`${set.id}->${set.holderLane} noted`);
142
142
  }
143
143
  if (alive.get(set.holderLane) === false) {
144
- const why = await ctx.tryResume(set.holderLane, { priority: true });
144
+ const why = await ctx.tryResume(set.holderLane, { priority: true, ungated: true });
145
145
  done.push(`${set.holderLane} ${why}`);
146
146
  }
147
147
  const noted = Date.parse(state.sets[set.id].notedAt);
@@ -344,7 +344,7 @@ export function watchContext({ home = homedir(), request = devRequest, config =
344
344
  await amendLaneCommand(key, { rules, reason });
345
345
  await log?.(`amend ${key}: ${reason}`);
346
346
  },
347
- tryResume: async (key, { priority, ifChanged = false }) => {
347
+ tryResume: async (key, { priority, ifChanged = false, ungated = false }) => {
348
348
  const hold = await exists(holdPath(home, "keepalive"));
349
349
  const verdict = resumeAllowed(await ctx.guards(), { priority, hold });
350
350
  if (!verdict.ok) return `not resumed: ${verdict.reason}`;
@@ -352,7 +352,9 @@ export function watchContext({ home = homedir(), request = devRequest, config =
352
352
  // allowed lane accounts in order (settings.keepaliveProfiles: the account
353
353
  // roster is the operator's call, MW1-38.3, so it is configuration).
354
354
  const settings = await readCoordinatorSettings(home);
355
- const gate = ifChanged ? { "if-changed": true } : {};
355
+ // A resume the caller knows is due (a set it holds was decided) passes
356
+ // --ungated: that change is not in the blocker fingerprint (NODII-DEV-CLI-191).
357
+ const gate = ifChanged ? { "if-changed": true } : ungated ? { ungated: true } : {};
356
358
  const attempts = [{ ...gate }, ...(settings.keepaliveProfiles ?? []).map((p) => ({ ...gate, profile: p.profile, class: p.class ?? "short" }))];
357
359
  let last = "LANE_RESUME_FAILED";
358
360
  for (const flags of attempts) {
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.184";
7
+ export const VERSION = "0.6.185";
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
@@ -52,7 +52,7 @@ export const COMMAND_FLAGS = {
52
52
  "lane cap": ["confirm-raise", "reason"],
53
53
  "lane heartbeat": ["note", "waiting-on"],
54
54
  "lane waits": ["machine"],
55
- "lane resume": ["override", "reason", "host-lost", "min-free-gb", "stagger-seconds", "profile", "class", "if-changed"],
55
+ "lane resume": ["override", "reason", "host-lost", "min-free-gb", "stagger-seconds", "profile", "class", "if-changed", "ungated"],
56
56
  "lane transfer": ["reason", "to-agent"],
57
57
  "inbox ack": ["note"],
58
58
  "lane stop": ["reason", "sweeper", "no-closeout", "no-closeout-push", "launched-in-error", "replaced-by"],
@@ -480,6 +480,13 @@ export async function reportLaneExit({ runId, laneKey, exitCode, signal, worktre
480
480
  ...(logTail ? { logTail: logTail.slice(-50_000) } : {}),
481
481
  };
482
482
  }
483
+ // NODII-DEV-CLI-191 (19 Nov after-measurement): a run that chose to end
484
+ // (exit 0, no account death) while its lane waits on something of its own
485
+ // leaves the same baseline as a blocked one, so a plain resume finds
486
+ // nothing changed. gen-90-dev, READY and waiting on the operator, was
487
+ // resumed three times in ten minutes without one. A kill mid-work records nothing.
488
+ if (outcome !== "blocked" && clean && !accountFailure && (lane?.waits?.length ?? 0) > 0)
489
+ await recordBaseline(laneKey, lane, { request }).catch(() => {});
483
490
  try {
484
491
  await send(request, `/api/v1/runs/${encode(runId)}/${outcome === "process_exit" ? "process-exit" : "end"}`, body);
485
492
  } catch (error) {
package/dist/lanes.js CHANGED
@@ -12,7 +12,7 @@ import { recordReviewReceipt, reviewCommitContext } from "./safety.js";
12
12
  import { GATHER_TIMEOUT_MS, PICKER_FIRST_PICK_TIMEOUT_MS, agentFallbackReason, gatherDeadline, gatherText, pickDocuments, pickerModelName, pickTimingLine, pickTimingStats, readPickTimings, recordPickTiming, warmPicker, withPickLock } from "./gather.js";
13
13
  import { storeGatherFreeze } from "./freeze.js";
14
14
  import { doneCheckRecorded, fixableBlocker, subagentBudgetLine } from "./lane-supervisor.js";
15
- import { assertLaneSwitchOn } from "./lane-switches.js";
15
+ import { assertLaneSwitchOn, laneSwitchOn } from "./lane-switches.js";
16
16
  import { STEWARD_DONE_CHECK, stewardObjective } from "./session-kind.js";
17
17
  import { availableMemoryBytes } from "./host.js";
18
18
  import { assertNothingPending, devDown, queuePending, receiptEvidenceBody, signedBuiltAck } from "./receipt.js";
@@ -1157,9 +1157,23 @@ export async function laneCommand(action, args, flags, deps = {}) {
1157
1157
  // evidence and stopped by nothing here: MW1-28 names a lane's exits, and
1158
1158
  // the coordinator ends it by one of them. A landed lane goes on to deploy.
1159
1159
  let gate = null;
1160
- if (flags["if-changed"] !== undefined) {
1160
+ if (flags["if-changed"] !== undefined && flags.ungated !== undefined)
1161
+ throw new CliError("USAGE", "lane resume takes --if-changed or --ungated, not both.", 2);
1162
+ if (flags["if-changed"] !== undefined)
1161
1163
  assertLaneSwitchOn("resumeIfChanged", "RESUME_IF_CHANGED_OFF", "lane resume --if-changed", "Resume the lane without it, as before.", deps.env ?? process.env);
1162
- const lane = (await request("GET", `/api/v1/lanes/${encode(id)}`)).data;
1164
+ // NODII-DEV-CLI-191 (19 Nov after-measurement): a plain resume of a lane
1165
+ // that waits on something of its own (or is blocked) is gated the same
1166
+ // way, the rule keepalive applies. A hand-written account mover resumed
1167
+ // gen-90-dev three times in ten minutes while it waited on the operator.
1168
+ // --ungated (or --override with its reason) resumes it anyway, on purpose;
1169
+ // a lane with no waits resumes as before.
1170
+ const gateLane = flags["if-changed"] !== undefined
1171
+ ? (await request("GET", `/api/v1/lanes/${encode(id)}`)).data
1172
+ : flags.ungated === undefined && !flags.override && laneSwitchOn("resumeIfChanged", deps.env ?? process.env)
1173
+ ? await request("GET", `/api/v1/lanes/${encode(id)}`).then((response) => response.data, () => null).then((lane) => (lane && (lane.liveness === "blocked" || (lane.waits?.length ?? 0) > 0) ? lane : null))
1174
+ : null;
1175
+ if (gateLane) {
1176
+ const lane = gateLane;
1163
1177
  gate = await resumeGate(lane, {
1164
1178
  ...defaultReaders({ request }),
1165
1179
  store: deps.resumeStore ?? fingerprintStore(join(recoveryStateRoot(), "resume-fingerprints.json")),
@@ -1169,7 +1183,8 @@ export async function laneCommand(action, args, flags, deps = {}) {
1169
1183
  const data = { resumed: false, code: gate.code, reason: gate.reason, parts: gate.parts ?? [], dead: gate.dead ?? null };
1170
1184
  // MW1-28: a lane keeps its slot until on_dev or non_issue, or until a staff person stops it.
1171
1185
  const next = gate.code === "LANE_DEAD" ? ` MW1-28 is its only way out: a staff person may stop it citing this evidence (\`nodii-dev lane stop ${ref} --reason TEXT\`), or its investigation records non_issue (MW1-28.1).` : "";
1172
- return { payload: { data }, human: () => `${ref}: not resumed (${gate.code}): ${gate.reason}.${next}` };
1186
+ const ungated = flags["if-changed"] === undefined ? ` It waits on ${(lane.waits ?? []).map((wait) => wait.targetRef).filter(Boolean).join(", ") || "its blockers"}; to resume it anyway, on purpose, run lane resume ${ref} --ungated.` : "";
1187
+ return { payload: { data }, human: () => `${ref}: not resumed (${gate.code}): ${gate.reason}.${next}${ungated}` };
1173
1188
  }
1174
1189
  }
1175
1190
  const payload = await request(
@@ -0,0 +1,77 @@
1
+ import { readdir, readFile } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+
4
+ /**
5
+ * NODII-DEV-CLI-191 change (8): what a lane's first call carries. Measured on
6
+ * 19 Nov over 308 lane runs, about 9k tokens of it were user-level plugins and
7
+ * connectors no lane uses: the synced marketing and design skills with their
8
+ * Slack, Gmail and Canva servers, the GitHub server, and the claude.ai
9
+ * connectors (Microsoft 365, Docs, Drive). The machine coordinator allowed a
10
+ * launch to turn them off (a8, 19 Nov 2026, 18:52Z), derived from the lane's
11
+ * own scope, never a fixed list: a lane with a Figma boundary keeps Figma.
12
+ * Browser tools and repository skills are not synced plugins and are never
13
+ * touched. NODII_DEV_PLUGIN_TRIM=0 keeps everything on.
14
+ */
15
+ export const PLUGIN_TRIM_VARIABLE = "NODII_DEV_PLUGIN_TRIM";
16
+
17
+ // The design repositories hold Surfaces and Code Connect, read through Figma.
18
+ const FIGMA_REPOS = new Set(["design-system", "nodii-frontend"]);
19
+ const FIGMA_TEXT = /\b(figma|surfaces?|design[- ]system|change[- ]sets?|code connect)\b/i;
20
+ // What a Figma lane keeps: the Figma plugin, and the design plugin beside it.
21
+ const FIGMA_PLUGINS = new Set(["figma", "design"]);
22
+
23
+ /** Whether the lane's scope reaches Figma: a Figma scope, a design repository, or an objective that names it. */
24
+ export function laneNeedsFigma({ repos = [], figmaScopes = [], text = "" } = {}) {
25
+ if (figmaScopes?.length) return true;
26
+ if (repos.some((repo) => FIGMA_REPOS.has(repo))) return true;
27
+ return FIGMA_TEXT.test(String(text ?? ""));
28
+ }
29
+
30
+ /** The synced plugins in a Claude profile, by their own names (plugins/synced/<org>/<dir>/.claude-plugin/plugin.json). */
31
+ export async function syncedPlugins(profileHome) {
32
+ const root = join(profileHome, "plugins", "synced");
33
+ const names = new Set();
34
+ let orgs = [];
35
+ try { orgs = await readdir(root, { withFileTypes: true }); } catch { return []; }
36
+ for (const org of orgs.filter((entry) => entry.isDirectory())) {
37
+ let dirs = [];
38
+ try { dirs = await readdir(join(root, org.name), { withFileTypes: true }); } catch { continue; }
39
+ for (const dir of dirs.filter((entry) => entry.isDirectory())) {
40
+ try {
41
+ const { name } = JSON.parse(await readFile(join(root, org.name, dir.name, ".claude-plugin", "plugin.json"), "utf8"));
42
+ if (typeof name === "string" && /^[\w.-]+$/.test(name)) names.add(name);
43
+ } catch {}
44
+ }
45
+ }
46
+ return [...names].sort();
47
+ }
48
+
49
+ /**
50
+ * What to turn off for this run, or null: every synced plugin the lane's
51
+ * scope doesn't keep (`name@synced: false` in --settings), and the claude.ai
52
+ * connectors for a lane with no Figma boundary (ENABLE_CLAUDEAI_MCP_SERVERS).
53
+ */
54
+ export function pluginTrim({ plugins = [], needsFigma = false, env = process.env } = {}) {
55
+ if (env?.[PLUGIN_TRIM_VARIABLE] === "0") return null;
56
+ const keep = needsFigma ? FIGMA_PLUGINS : new Set();
57
+ const off = plugins.filter((name) => !keep.has(name)).sort();
58
+ const connectorsOff = !needsFigma;
59
+ if (!off.length && !connectorsOff) return null;
60
+ const parts = [
61
+ ...(off.length ? [`plugins ${off.join(", ")}`] : []),
62
+ ...(connectorsOff ? ["the claude.ai connectors"] : []),
63
+ ];
64
+ return {
65
+ off,
66
+ connectorsOff,
67
+ settings: { enabledPlugins: Object.fromEntries(off.map((name) => [`${name}@synced`, false])) },
68
+ env: connectorsOff ? { ENABLE_CLAUDEAI_MCP_SERVERS: "false" } : {},
69
+ note: `nodii-dev: turned off for this run: ${parts.join("; ")} (not in this lane's scope; ${PLUGIN_TRIM_VARIABLE}=0 keeps everything on).`,
70
+ };
71
+ }
72
+
73
+ /** The trim for a lane run, from its profile's synced plugins and its scope. */
74
+ export async function laneTrim({ runtime, profileHome, scope, env = process.env, read = syncedPlugins } = {}) {
75
+ if (runtime !== "claude" || !profileHome || env?.[PLUGIN_TRIM_VARIABLE] === "0") return null;
76
+ return pluginTrim({ plugins: await read(profileHome).catch(() => []), needsFigma: laneNeedsFigma(scope), env });
77
+ }
@@ -7,6 +7,7 @@ import { configPath } from "./core.js";
7
7
  import { laneConfigName } from "./lane-env.js";
8
8
  import { recordWatchedRun } from "./watchdog.js";
9
9
  import { laneSwitchOn } from "./lane-switches.js";
10
+ import { laneTrim } from "./plugin-trim.js";
10
11
  import { continuationInvocation, continueTaskMessage, sessionIdFromLog, subagentBudgetLine } from "./lane-supervisor.js";
11
12
 
12
13
  const RUNTIMES = new Set(["codex", "claude"]);
@@ -268,14 +269,24 @@ export function buildRecoveryPrompt(data) {
268
269
  }
269
270
 
270
271
  /** Build an allowlisted, fresh headless runtime invocation. No prompt is put in argv. */
271
- export function buildRecoveryInvocation(data, { env = process.env, home = homedir() } = {}) {
272
+ export function buildRecoveryInvocation(data, { env = process.env, home = homedir(), trim = null } = {}) {
272
273
  const { runId, laneKey, runtime, model, cwd, addDirs } = validateData(data);
273
274
  const devConfigPath = laneConfig(data?.launch?.devConfigPath, laneKey, "launch.devConfigPath");
274
- return buildInvocation({ runId, laneKey, runtime, model, cwd, addDirs, profileHome: data.launch.profileHome, devConfigPath }, { env, home });
275
+ return buildInvocation({ runId, laneKey, runtime, model, cwd, addDirs, profileHome: data.launch.profileHome, devConfigPath, trim }, { env, home });
276
+ }
277
+
278
+ /** NODII-DEV-CLI-191 change (8): a recovered lane's scope, from its Freeze and its record. */
279
+ export function recoveryScope(data) {
280
+ const freeze = data?.recovery?.freeze ?? {};
281
+ const repos = (freeze.boundaries?.repos ?? data?.lane?.repositories ?? []).map((r) => (typeof r === "string" ? r : r?.repo)).filter(Boolean);
282
+ const text = [freeze.objective?.ask, ...(freeze.objective?.laneNotes ?? []), data?.lane?.title, data?.lane?.objective].filter(Boolean).join("\n");
283
+ return { repos, figmaScopes: data?.lane?.figmaScopes ?? freeze.boundaries?.figmaScopes ?? [], text };
275
284
  }
276
285
 
277
286
  function buildInvocation(options, { env = process.env, home = homedir() } = {}) {
278
- const { runId, laneKey, runtime, model, cwd, addDirs, profileHome, devConfigPath } = options;
287
+ const { runId, laneKey, runtime, model, cwd, addDirs, profileHome, devConfigPath, trim = null } = options;
288
+ // NODII-DEV-CLI-191 change (8): plugins and connectors outside the lane's scope stay off.
289
+ const trimmed = runtime === "claude" && trim ? trim : null;
279
290
  // A headless lane has nobody to approve a tool call, so it runs in the
280
291
  // operator-approved headless lane mode: no permission prompts, under the
281
292
  // lane's own profile, with the harness safety hooks as the guard (they
@@ -284,18 +295,21 @@ function buildInvocation(options, { env = process.env, home = homedir() } = {})
284
295
  const args = runtime === "codex"
285
296
  ? ["exec", "--json", "--dangerously-bypass-approvals-and-sandbox", "--cd", cwd, "--model", model, ...addDirs.flatMap((path) => ["--add-dir", path]), "-"]
286
297
  // Claude Code refuses --print with stream-json unless --verbose is set.
287
- : ["--print", "--output-format", "stream-json", "--verbose", "--dangerously-skip-permissions", "--model", model, ...addDirs.flatMap((path) => ["--add-dir", path])];
298
+ : ["--print", "--output-format", "stream-json", "--verbose", "--dangerously-skip-permissions", "--model", model, ...addDirs.flatMap((path) => ["--add-dir", path]),
299
+ ...(trimmed?.off.length ? ["--settings", JSON.stringify(trimmed.settings)] : [])];
288
300
  return {
289
301
  command: runtime,
290
302
  args,
291
303
  cwd,
292
304
  env: {
293
305
  ...env,
306
+ ...(trimmed?.env ?? {}),
294
307
  NODII_DEV_RUN_ID: runId,
295
308
  NODII_DEV_LANE_KEY: laneKey,
296
309
  NODII_DEV_CONFIG_PATH: devConfigPath,
297
310
  ...profileVariable(runtime, profileHome, home),
298
311
  },
312
+ ...(trimmed ? { trim: trimmed } : {}),
299
313
  };
300
314
  }
301
315
 
@@ -338,6 +352,8 @@ async function launchDetached({ invocation, prompt, runId, laneKey, devConfigPat
338
352
  const log = await fs.open(logPath, "a", 0o600);
339
353
  try {
340
354
  await fs.chmod(logPath, 0o600);
355
+ // The run says what it turned off, first in its own log.
356
+ if (invocation.trim?.note) await log.write?.(`${invocation.trim.note}\n`);
341
357
  } catch (error) {
342
358
  await closeQuietly(log);
343
359
  throw error;
@@ -438,7 +454,8 @@ export async function launchRuntime(options, {
438
454
  supervisorEntry,
439
455
  } = {}) {
440
456
  const launch = validateLaunch(options);
441
- const invocation = buildInvocation(launch, { env, home });
457
+ const trim = await laneTrim({ runtime: launch.runtime, profileHome: launch.profileHome ?? join(home, ".claude"), scope: options.scope, env });
458
+ const invocation = buildInvocation({ ...launch, trim }, { env, home });
442
459
  return launchDetached({ invocation, prompt: launch.prompt, ...launch }, {
443
460
  spawnImpl,
444
461
  fs,
@@ -470,7 +487,8 @@ export async function launchRecovery(payload, {
470
487
  const { runId, laneKey, addDirs, runtime } = validateData(data);
471
488
  const devConfigPath = laneConfig(data?.launch?.devConfigPath, laneKey, "launch.devConfigPath");
472
489
  const root = stateRoot ?? recoveryStateRoot(devConfigPath);
473
- const fresh = buildRecoveryInvocation(data, { env, home });
490
+ const trim = await laneTrim({ runtime, profileHome: data.launch.profileHome ?? join(home, ".claude"), scope: recoveryScope(data), env });
491
+ const fresh = buildRecoveryInvocation(data, { env, home, trim });
474
492
  // NODII-DEV-CLI-191: continue the dead run's own session when its log
475
493
  // names one and the lane stays on the same account (a session lives in its
476
494
  // profile); otherwise start fresh with the Freeze. Ratified (18 Nov): on
package/dist/starting.js CHANGED
@@ -698,6 +698,8 @@ export async function launchLaneCommand(key, flags, {
698
698
  // NODII-DEV-CLI-191: the brief names the subagent budget.
699
699
  prompt: [payload.data.brief, subagentBudgetLine(payload.data.lane?.subagentQuota ?? body.subagentQuota)].filter(Boolean).join("\n\n"),
700
700
  runId: payload.data.run.id,
701
+ // NODII-DEV-CLI-191 change (8): the plugins and connectors this lane keeps follow its scope.
702
+ scope: { repos: repositories.map(({ repo }) => repo), figmaScopes: body.figmaScopes ?? [], text: [payload.data.brief, body.objective].filter(Boolean).join("\n") },
701
703
  });
702
704
  } catch (error) {
703
705
  try {
package/dist/surface.js CHANGED
@@ -34,7 +34,13 @@ import { MIN_FIGMA_INTERVAL_MS, figmaRest } from "./figma-rest.js";
34
34
  import { createRenderer } from "./vendor/render-templates.mjs";
35
35
 
36
36
  /** Bumped whenever the emitted code changes shape for the same inputs. */
37
- export const GENERATOR_FORMAT = 42;
37
+ export const GENERATOR_FORMAT = 43;
38
+ /**
39
+ * DS parts that are an item of their parent's own list or grid, so they take no sizing
40
+ * wrapper: a Detail Section / Row's facts are the section grid's cells, a Right Pane / Row
41
+ * is a <dt>/<dd> pair in its section's <dl> (CLI-210), a Timeline / Entry is an <li> (CLI-167).
42
+ */
43
+ const UNWRAPPED_PARTS = new Set(["Detail Section / Row", "Right Pane / Row", "Timeline / Entry"]);
38
44
  export const TREE_DIR = "docs/figma-ux-ds/figma/surface-trees";
39
45
  export const GENERATED_SUFFIX = ".surface.generated.tsx";
40
46
  /** Where every generated product page lives, as a git glob (NODII-DEV-CLI-77). */
@@ -1209,6 +1215,10 @@ function liftRecordData(code, node, ctx, path, scope = scopeName(node)) {
1209
1215
  // A tone the page leaves out is the component's own default (neutral, or no dot; hub-477).
1210
1216
  if (value) next = next.replace(value[0], `${attr}={${TONE_ATTR.has(attr) ? (lifted.push(attr), optionalMark(ctx, at, attr)) : lift(at, attr)}}`);
1211
1217
  }
1218
+ // A chip's tone is the record's, beside its label: a "Key missing" card must not show
1219
+ // the frame's green (NODII-DEV-CLI-239).
1220
+ const chipTone = /(\bchip=\{\{[^{}]*?\btone:\s*)"(?:[^"\\\n]|\\.)*"/.exec(next);
1221
+ if (chipTone) next = next.replace(chipTone[0], `${chipTone[1]}${lift(at, "chipTone")}`);
1212
1222
  if (tag !== "MetricFilterCard") return next;
1213
1223
  // A card already lifted (content two slots deep passes through here twice) keeps its
1214
1224
  // one selected: a second would fail jsx-no-duplicate-props (tic-page-queues-c, 19 Nov).
@@ -2484,8 +2494,9 @@ function emitNode(node, ctx) {
2484
2494
  // not a layout box: a wrapper would turn the entire row into one grid cell.
2485
2495
  // A Right Pane / Row is a <dt>/<dd> pair inside its Section's <dl>: a
2486
2496
  // wrapper would put the pair a level below the list (axe dlitem;
2487
- // NODII-DEV-CLI-210).
2488
- const sizing = ctx.bare || node.instance.set === "Detail Section / Row" || node.instance.set === "Right Pane / Row" ? [] : sizeClasses(node, parent, false);
2497
+ // NODII-DEV-CLI-210). A Timeline / Entry is the <li> of the Timeline's <ol>: a
2498
+ // wrapper would leave a <div> between them (axe list, listitem; NODII-DEV-CLI-167).
2499
+ const sizing = ctx.bare || UNWRAPPED_PARTS.has(node.instance.set) ? [] : sizeClasses(node, parent, false);
2489
2500
  // A data slot passed straight to a prop is that prop (`trailing={<>{trailing}</>}` → `trailing={trailing}`).
2490
2501
  let own = rendered.code.trim().replace(/=\{<>\{([a-z][A-Za-z0-9]*)\}<\/>\}/g, "={$1}");
2491
2502
  // The toolbar owns table rendering, so its template does not emit this slot.
@@ -2695,7 +2706,31 @@ function emitChildren(children, emitOne, ctx) {
2695
2706
  }
2696
2707
  }
2697
2708
  flush();
2698
- return out;
2709
+ return pairLabelledControls(out);
2710
+ }
2711
+
2712
+ const LABEL_FOR = /<Label\b[^>]*?\bhtmlFor=\{([A-Za-z_$][\w$]*)\}/;
2713
+ const LABELLED_CONTROL = /<(?:Checkbox|Switch|RadioGroupItem)(?=[\s/>])/;
2714
+ /**
2715
+ * A DS Label beside its control names it: the Label template emits htmlFor={x}, so the
2716
+ * Checkbox, Switch or RadioGroupItem next to it (in the same container, with no id of its
2717
+ * own) takes id={x}. Without it the label isn't tied to the control and the control has
2718
+ * no accessible name (DESIGN-SYSTEM-817). Each label names the one control beside it.
2719
+ */
2720
+ function pairLabelledControls(codes) {
2721
+ const labelOf = codes.map((c) => LABEL_FOR.exec(c ?? "")?.[1] ?? null);
2722
+ const used = new Set();
2723
+ return codes.map((code, i) => {
2724
+ const control = code ? LABELLED_CONTROL.exec(code) : null;
2725
+ if (!control || LABEL_FOR.test(code)) return code;
2726
+ const open = code.slice(control.index, control.index + openTagEnd(code.slice(control.index)) + 1);
2727
+ if (/\sid=/.test(open)) return code;
2728
+ const at = [i + 1, i - 1].find((j) => labelOf[j] && !used.has(j));
2729
+ if (at === undefined) return code;
2730
+ used.add(at);
2731
+ const end = control.index + control[0].length;
2732
+ return `${code.slice(0, end)} id={${labelOf[at]}}${code.slice(end)}`;
2733
+ });
2699
2734
  }
2700
2735
 
2701
2736
  /** What the DescriptionList template emits for one field: one DescriptionItem in its list. */
package/dist/watchdog.js CHANGED
@@ -255,7 +255,8 @@ export async function sweepWatchdog({
255
255
  refreshUsage = refreshMachineUsage,
256
256
  closeout = laneCloseout,
257
257
  saveReminder = saveLaneCapReminder,
258
- resumeLane = (key, deps) => laneCommand("resume", [key], {}, deps),
258
+ // Dev marked it resume-due (its wait cleared), so the blocker gate is not asked again.
259
+ resumeLane = (key, deps) => laneCommand("resume", [key], { ungated: true }, deps),
259
260
  } = {}) {
260
261
  const loaded = records ? { records, errors: [] } : await loadRecords();
261
262
  const facts = await collect(loaded.records, { errors: [...loaded.errors] });
@@ -572,8 +573,11 @@ export async function watchdogCommand(action, flags, dependencies = {}) {
572
573
  // the service manager records the failure (systemd's Result) and `doctor`
573
574
  // reports it; errors in its other jobs are recorded and do not fail it.
574
575
  const unreported = data.errors.filter((error) => SWEEP_FATAL_KINDS.has(error.kind)).length;
576
+ // NODII-DEV-CLI-191 (10): the daemon prints this every minute into
577
+ // watchdog.log; every dead run the registry holds was 1.7 MB a line (19 Nov).
578
+ const { deadRuns, ...rest } = data;
575
579
  return {
576
- payload: { data },
580
+ payload: { data: { ...rest, deadRunCount: deadRuns?.length ?? 0 } },
577
581
  human: `Watchdog sweep: ${data.orphanedRuns.length} orphaned run(s), ${data.unwatchedRuns.length} unwatched run(s), ${data.staleSockets.length} stale socket(s), ${data.unpushedWorktrees.length} unpushed worktree(s), ${data.errors.length} error(s)${unreported ? `, ${unreported} of them leaving Dev without a run's state` : ""}.`,
578
582
  ...(unreported ? { exitCode: 1 } : {}),
579
583
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodii/dev",
3
- "version": "0.6.184",
3
+ "version": "0.6.185",
4
4
  "description": "Agent CLI for Nodii Dev, reached through the platform edge",
5
5
  "type": "module",
6
6
  "bin": {