@nodii/dev 0.6.217 → 0.6.218
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/core.js +1 -1
- package/dist/governor.js +14 -5
- package/dist/lanes.js +1 -1
- package/package.json +1 -1
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.218";
|
|
8
8
|
export const configPath = () =>
|
|
9
9
|
process.env.NODII_DEV_CONFIG_PATH ??
|
|
10
10
|
join(homedir(), ".config/nodii-dev/config.json");
|
package/dist/governor.js
CHANGED
|
@@ -78,10 +78,15 @@ export function governorLines(g) {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
/** Throw the governor's refusal, as Dev would, before a launch reaches Dev. */
|
|
81
|
-
export function assertGovernorOpen(g) {
|
|
81
|
+
export function assertGovernorOpen(g, { resume = false } = {}) {
|
|
82
82
|
if (g.state !== "refused") return;
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
// A resume is never held here by GOVERNOR_STUCK: resuming a stuck lane is
|
|
84
|
+
// how the stuck count drains, and only Dev knows whether this lane is in the
|
|
85
|
+
// stuck set. Dev's resume gate decides that one (operator, 27 Nov).
|
|
86
|
+
const refusals = (g.refusals ?? []).filter((r) => !(resume && r.code === "GOVERNOR_STUCK"));
|
|
87
|
+
if (g.refusals?.length && refusals.length === 0) return;
|
|
88
|
+
const code = refusals[0]?.code ?? "GOVERNOR_REFUSED";
|
|
89
|
+
throw new CliError(code, governorLines({ ...g, refusals }).join("\n"), 1, { governor: g });
|
|
85
90
|
}
|
|
86
91
|
|
|
87
92
|
// --- the Bash commands the hook governs --------------------------------------
|
|
@@ -132,8 +137,12 @@ export async function governorPreToolUse(payload, deps = {}) {
|
|
|
132
137
|
} catch (error) {
|
|
133
138
|
return { deny: `nodii-dev governor: the governor could not be read (${error?.message ?? String(error)}), so this ${what} is blocked. Launches fail closed (hub-232); reads and close-outs still run.` };
|
|
134
139
|
}
|
|
135
|
-
if (g.state === "refused")
|
|
136
|
-
|
|
140
|
+
if (g.state === "refused") {
|
|
141
|
+
// A resume is left to Dev's own gate on GOVERNOR_STUCK (see assertGovernorOpen).
|
|
142
|
+
const refusals = (g.refusals ?? []).filter((r) => !(what !== "launch" && r.code === "GOVERNOR_STUCK"));
|
|
143
|
+
if (refusals.length || !g.refusals?.length)
|
|
144
|
+
return { deny: `nodii-dev governor: ${what} refused.\n${governorLines({ ...g, refusals }).join("\n")}` };
|
|
145
|
+
}
|
|
137
146
|
return { context: governorLines(g).join("\n") };
|
|
138
147
|
}
|
|
139
148
|
|
package/dist/lanes.js
CHANGED
|
@@ -1183,7 +1183,7 @@ export async function laneCommand(action, args, flags, deps = {}) {
|
|
|
1183
1183
|
const lane = (await request("GET", `/api/v1/lanes/${encode(id)}`)).data;
|
|
1184
1184
|
if (lane?.machineId) governor = await readGovernor(lane.machineId, { request });
|
|
1185
1185
|
} catch {}
|
|
1186
|
-
if (governor) assertGovernorOpen(governor);
|
|
1186
|
+
if (governor) assertGovernorOpen(governor, { resume: true });
|
|
1187
1187
|
}
|
|
1188
1188
|
}
|
|
1189
1189
|
// NODII-DEV-CLI-191: --if-changed resumes only when a blocker's real state
|