harnessed 4.36.0 → 4.37.0

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/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { existsSync, mkdirSync, renameSync, writeFileSync, readFileSync, readdirSync, realpathSync, mkdtempSync, utimesSync, rmSync, statSync } from 'fs';
2
+ import { existsSync, mkdirSync, renameSync, writeFileSync, readFileSync, readdirSync, realpathSync, mkdtempSync, utimesSync, rmSync, statSync, appendFileSync } from 'fs';
3
3
  import { homedir, tmpdir } from 'os';
4
4
  import { join, resolve, dirname, basename, sep, isAbsolute, win32, posix, relative } from 'path';
5
5
  import { Type } from '@sinclair/typebox';
@@ -38,7 +38,7 @@ var init_package = __esm({
38
38
  "package.json"() {
39
39
  package_default = {
40
40
  name: "harnessed",
41
- version: "4.36.0",
41
+ version: "4.37.0",
42
42
  description: "AI coding harness package manager + composition orchestrator",
43
43
  type: "module",
44
44
  license: "Apache-2.0",
@@ -3125,11 +3125,11 @@ function isComplete(output) {
3125
3125
  if (succeeded) return true;
3126
3126
  return extractPromise(env.text ?? env.result ?? "") === "COMPLETE";
3127
3127
  }
3128
- async function ralphLoopWrap(spawn6, maxIter) {
3128
+ async function ralphLoopWrap(spawn7, maxIter) {
3129
3129
  let last = "";
3130
3130
  let sessionId;
3131
3131
  for (let i = 0; i < maxIter; i++) {
3132
- last = await spawn6(sessionId, (id) => {
3132
+ last = await spawn7(sessionId, (id) => {
3133
3133
  sessionId = id;
3134
3134
  });
3135
3135
  if (isComplete(last)) return last;
@@ -3220,6 +3220,164 @@ var init_scale = __esm({
3220
3220
  execp = promisify(exec);
3221
3221
  }
3222
3222
  });
3223
+ function extractVerifyBinary(verifyCmd, fallback) {
3224
+ const token = verifyCmd?.trim().split(/\s+/)[0];
3225
+ if (token && BARE_BIN_RE.test(token) && !NON_COMPONENT_TOKENS.has(token)) return token;
3226
+ if (BARE_BIN_RE.test(fallback) && !NON_COMPONENT_TOKENS.has(fallback)) return fallback;
3227
+ return null;
3228
+ }
3229
+ function realRun(finder, bin) {
3230
+ try {
3231
+ if (typeof spawnSync !== "function") return null;
3232
+ const r = spawnSync(finder, [bin], { encoding: "utf8" });
3233
+ if (!r || r.error) return null;
3234
+ return { status: r.status, stdout: r.stdout ?? "" };
3235
+ } catch {
3236
+ return null;
3237
+ }
3238
+ }
3239
+ function binaryOnPath(bin, deps) {
3240
+ const platform = process.platform;
3241
+ const run = realRun;
3242
+ const finder = platform === "win32" ? "where" : "which";
3243
+ const r = run(finder, bin);
3244
+ if (!r || r.status !== 0) return false;
3245
+ return r.stdout.trim().length > 0;
3246
+ }
3247
+ var NON_COMPONENT_TOKENS, BARE_BIN_RE;
3248
+ var init_binaryProbe = __esm({
3249
+ "src/installers/lib/binaryProbe.ts"() {
3250
+ NON_COMPONENT_TOKENS = /* @__PURE__ */ new Set([
3251
+ "test",
3252
+ "grep",
3253
+ "ls",
3254
+ "cat",
3255
+ "echo",
3256
+ "command",
3257
+ "sh",
3258
+ "bash",
3259
+ "[",
3260
+ "npx",
3261
+ "npm",
3262
+ "node",
3263
+ "corepack",
3264
+ "pnpm",
3265
+ "yarn",
3266
+ "bun",
3267
+ "git",
3268
+ "claude",
3269
+ "codex"
3270
+ ]);
3271
+ BARE_BIN_RE = /^[A-Za-z0-9][\w.@-]*$/;
3272
+ }
3273
+ });
3274
+
3275
+ // src/checkpoint/codegraphInit.ts
3276
+ var codegraphInit_exports = {};
3277
+ __export(codegraphInit_exports, {
3278
+ ensureCodegraphIgnored: () => ensureCodegraphIgnored,
3279
+ maybeInitCodeGraph: () => maybeInitCodeGraph
3280
+ });
3281
+ function claimPath(cwd) {
3282
+ const key = createHash("sha1").update(resolve(cwd)).digest("hex").slice(0, 16);
3283
+ return join(harnessedSubdir("codegraph-init"), `${key}.claim`);
3284
+ }
3285
+ function realClaim(cwd) {
3286
+ const path = claimPath(cwd);
3287
+ const stamp = (/* @__PURE__ */ new Date()).toISOString();
3288
+ try {
3289
+ mkdirSync(dirname(path), { recursive: true });
3290
+ } catch {
3291
+ return false;
3292
+ }
3293
+ try {
3294
+ writeFileSync(path, stamp, { flag: "wx" });
3295
+ return true;
3296
+ } catch {
3297
+ try {
3298
+ if (Date.now() - statSync(path).mtimeMs < STALE_CLAIM_MS) return false;
3299
+ writeFileSync(path, stamp);
3300
+ return true;
3301
+ } catch {
3302
+ return false;
3303
+ }
3304
+ }
3305
+ }
3306
+ function realLaunch(cwd) {
3307
+ if (typeof spawn !== "function") return;
3308
+ const win = process.platform === "win32";
3309
+ const child = win ? spawn("cmd.exe", ["/d", "/s", "/c", "codegraph", "init"], {
3310
+ cwd,
3311
+ stdio: "ignore",
3312
+ windowsHide: true
3313
+ }) : spawn("codegraph", ["init"], { cwd, stdio: "ignore", detached: true });
3314
+ child.on("error", () => {
3315
+ });
3316
+ child.unref();
3317
+ }
3318
+ function ignoresCodegraph(body) {
3319
+ for (const raw of body.split(/\r?\n/)) {
3320
+ const line = raw.trim();
3321
+ if (line === "" || line.startsWith("#") || line.startsWith("!")) continue;
3322
+ if (line.replace(/^\//, "").replace(/\/$/, "") === ".codegraph") return true;
3323
+ }
3324
+ return false;
3325
+ }
3326
+ function ensureCodegraphIgnored(cwd) {
3327
+ const path = join(cwd, ".gitignore");
3328
+ try {
3329
+ if (!existsSync(path)) {
3330
+ writeFileSync(path, `${IGNORE_LINE}
3331
+ `);
3332
+ return "created";
3333
+ }
3334
+ const body = readFileSync(path, "utf8");
3335
+ if (ignoresCodegraph(body)) return "already";
3336
+ appendFileSync(path, `${body.endsWith("\n") || body === "" ? "" : "\n"}${IGNORE_LINE}
3337
+ `);
3338
+ return "appended";
3339
+ } catch {
3340
+ return "error";
3341
+ }
3342
+ }
3343
+ function maybeInitCodeGraph(overrides = {}) {
3344
+ const cwd = overrides.cwd ?? process.cwd();
3345
+ const hasIndex = overrides.hasIndex ?? ((c) => existsSync(join(c, ".codegraph")));
3346
+ const hasBinary = overrides.hasBinary ?? (() => binaryOnPath("codegraph"));
3347
+ const claim = overrides.claim ?? realClaim;
3348
+ const launch = overrides.launch ?? realLaunch;
3349
+ const note2 = overrides.note ?? ((m) => {
3350
+ console.error(m);
3351
+ });
3352
+ if (hasIndex(cwd)) return "index-present";
3353
+ if (!hasBinary()) return "no-binary";
3354
+ if (!claim(cwd)) return "already-claimed";
3355
+ try {
3356
+ launch(cwd);
3357
+ } catch (e) {
3358
+ note2(`[harnessed] codegraph init could not be started (ignored): ${e.message}`);
3359
+ return "launch-failed";
3360
+ }
3361
+ note2(
3362
+ `[harnessed] codegraph init started in the background for ${cwd} \u2014 the next task gets a semantic index (first-time only; upstream's watcher keeps it fresh).`
3363
+ );
3364
+ const ignored = ensureCodegraphIgnored(cwd);
3365
+ if (ignored === "appended" || ignored === "created") {
3366
+ note2(
3367
+ `[harnessed] appended \`${IGNORE_LINE}\` to ${join(cwd, ".gitignore")} \u2014 the index is a SQLite DB, and an unignored one gets swept into the next \`git add -A\`.`
3368
+ );
3369
+ }
3370
+ return "launched";
3371
+ }
3372
+ var STALE_CLAIM_MS, IGNORE_LINE;
3373
+ var init_codegraphInit = __esm({
3374
+ "src/checkpoint/codegraphInit.ts"() {
3375
+ init_binaryProbe();
3376
+ init_harnessedRoot();
3377
+ STALE_CLAIM_MS = 30 * 6e4;
3378
+ IGNORE_LINE = ".codegraph/";
3379
+ }
3380
+ });
3223
3381
 
3224
3382
  // src/checkpoint/learnings.ts
3225
3383
  var learnings_exports = {};
@@ -3802,6 +3960,13 @@ async function runCheckpointComplete(sub, opts, deps = defaultRunDeps) {
3802
3960
  lastTask: opts.summary ?? `phase ${sub} complete`,
3803
3961
  transitionWorkflowComplete: allResolved
3804
3962
  });
3963
+ if (allResolved && afterMark?.phase === "task") {
3964
+ try {
3965
+ const { maybeInitCodeGraph: maybeInitCodeGraph2 } = await Promise.resolve().then(() => (init_codegraphInit(), codegraphInit_exports));
3966
+ maybeInitCodeGraph2({ note: (m) => deps.error(m) });
3967
+ } catch {
3968
+ }
3969
+ }
3805
3970
  if (allResolved && afterMark) {
3806
3971
  const { captureWorkflowLearnings: captureWorkflowLearnings2 } = await Promise.resolve().then(() => (init_learnings(), learnings_exports));
3807
3972
  const captured = await captureWorkflowLearnings2(afterMark.sub_progress ?? [], sub);
@@ -4053,8 +4218,8 @@ function compute(d) {
4053
4218
  }
4054
4219
  const gitFirst = d.where("git")[0];
4055
4220
  if (gitFirst && /git\.exe$/i.test(gitFirst)) {
4056
- const root = dirname8(dirname8(gitFirst));
4057
- for (const cand of [join19(root, "bin", "bash.exe"), join19(root, "usr", "bin", "bash.exe")]) {
4221
+ const root = dirname9(dirname9(gitFirst));
4222
+ for (const cand of [join20(root, "bin", "bash.exe"), join20(root, "usr", "bin", "bash.exe")]) {
4058
4223
  if (d.exists(cand) && usable(cand)) return { path: cand, source: "git-derived", wslOnPath };
4059
4224
  }
4060
4225
  }
@@ -4062,13 +4227,13 @@ function compute(d) {
4062
4227
  d.env.ProgramFiles,
4063
4228
  d.env.ProgramW6432,
4064
4229
  d.env["ProgramFiles(x86)"],
4065
- d.env.LOCALAPPDATA ? join19(d.env.LOCALAPPDATA, "Programs") : void 0
4230
+ d.env.LOCALAPPDATA ? join20(d.env.LOCALAPPDATA, "Programs") : void 0
4066
4231
  ];
4067
4232
  for (const base of bases) {
4068
4233
  if (!base) continue;
4069
4234
  for (const cand of [
4070
- join19(base, "Git", "bin", "bash.exe"),
4071
- join19(base, "Git", "usr", "bin", "bash.exe")
4235
+ join20(base, "Git", "bin", "bash.exe"),
4236
+ join20(base, "Git", "usr", "bin", "bash.exe")
4072
4237
  ]) {
4073
4238
  if (d.exists(cand) && usable(cand))
4074
4239
  return { path: cand, source: "standard-location", wslOnPath };
@@ -4081,10 +4246,10 @@ function compute(d) {
4081
4246
  }
4082
4247
  return { path: "bash", source: "path-fallback" };
4083
4248
  }
4084
- var dirname8, join19, WSL_STUB_RE, cache2;
4249
+ var dirname9, join20, WSL_STUB_RE, cache2;
4085
4250
  var init_resolveBash = __esm({
4086
4251
  "src/installers/lib/resolveBash.ts"() {
4087
- ({ dirname: dirname8, join: join19 } = win32);
4252
+ ({ dirname: dirname9, join: join20 } = win32);
4088
4253
  WSL_STUB_RE = /[\\/](windows[\\/](system32|sysnative|syswow64)|microsoft[\\/]windowsapps)[\\/]bash\.exe$/i;
4089
4254
  cache2 = null;
4090
4255
  }
@@ -4802,7 +4967,7 @@ var check_bun_exports = {};
4802
4967
  __export(check_bun_exports, {
4803
4968
  checkBun: () => checkBun
4804
4969
  });
4805
- function realRun(finder) {
4970
+ function realRun2(finder) {
4806
4971
  try {
4807
4972
  if (typeof spawnSync !== "function") return null;
4808
4973
  const r = spawnSync(finder, ["bun"], { encoding: "utf8" });
@@ -4814,7 +4979,7 @@ function realRun(finder) {
4814
4979
  }
4815
4980
  function checkBun(deps) {
4816
4981
  const platform = deps?.platform ?? process.platform;
4817
- const run = deps?.run ?? realRun;
4982
+ const run = deps?.run ?? realRun2;
4818
4983
  const finder = platform === "win32" ? "where" : "which";
4819
4984
  const r = run(finder);
4820
4985
  if (r && r.status === 0 && r.stdout.trim().length > 0) {
@@ -5630,6 +5795,62 @@ var init_check_stale_hooks = __esm({
5630
5795
  }
5631
5796
  });
5632
5797
 
5798
+ // src/cli/lib/probe-chrome-devtools.ts
5799
+ async function probeOne2(fn, onFault) {
5800
+ try {
5801
+ return await fn();
5802
+ } catch {
5803
+ onFault();
5804
+ return false;
5805
+ }
5806
+ }
5807
+ async function probeChromeDevtools(deps = {}) {
5808
+ const d = { ...DEFAULT_DEPS, ...deps };
5809
+ let unknown = false;
5810
+ const fault = () => {
5811
+ unknown = true;
5812
+ };
5813
+ const ecc = await probeOne2(() => d.pluginRegistered(ECC_PLUGIN_NAME), fault);
5814
+ const standalonePlugin = await probeOne2(() => d.pluginRegistered(CHROME_DEVTOOLS_MCP_NAME), fault);
5815
+ const standaloneStdio = await probeOne2(
5816
+ () => d.mcpServerRegistered(CHROME_DEVTOOLS_MCP_NAME),
5817
+ fault
5818
+ );
5819
+ const providers = [];
5820
+ if (ecc) providers.push("ecc plugin");
5821
+ if (standalonePlugin) providers.push(`${CHROME_DEVTOOLS_MCP_NAME}@claude-plugins-official plugin`);
5822
+ if (standaloneStdio) providers.push(`${CHROME_DEVTOOLS_MCP_NAME} stdio MCP server`);
5823
+ return { ecc, standalonePlugin, standaloneStdio, unknown, providers };
5824
+ }
5825
+ function chromeDevtoolsAvailable(p7) {
5826
+ return p7.providers.length > 0 || p7.unknown;
5827
+ }
5828
+ async function isChromeDevtoolsAvailable(deps) {
5829
+ return chromeDevtoolsAvailable(await probeChromeDevtools(deps));
5830
+ }
5831
+ function chromeDevtoolsFactSource(p7) {
5832
+ if (p7.providers.length > 0) {
5833
+ return `chrome-devtools provider registered: ${p7.providers.join(" + ")}`;
5834
+ }
5835
+ if (p7.unknown) {
5836
+ return `chrome-devtools provider probe FAULTED (unreadable plugin registry / MCP config) \u2014 availability unknown, reported true so the perf / a11y / memory diagnostic lane is never silently deleted (ADR-0029 fail-soft). To make it definite, ${CHROME_DEVTOOLS_ENABLE_PATHS}`;
5837
+ }
5838
+ return `NO chrome-devtools provider registered \u2014 the verify-qa \`05-perf-a11y-diagnostic\` lane (perf / a11y / memory, judgments.web-testing-routing.chrome-devtools-mcp-diagnostic.fires) will NOT run. To turn it on, ${CHROME_DEVTOOLS_ENABLE_PATHS}`;
5839
+ }
5840
+ var CHROME_DEVTOOLS_MCP_NAME, ECC_PLUGIN_NAME, CHROME_DEVTOOLS_ENABLE_PATHS, DEFAULT_DEPS;
5841
+ var init_probe_chrome_devtools = __esm({
5842
+ "src/cli/lib/probe-chrome-devtools.ts"() {
5843
+ init_readClaudeConfig();
5844
+ CHROME_DEVTOOLS_MCP_NAME = "chrome-devtools-mcp";
5845
+ ECC_PLUGIN_NAME = "ecc";
5846
+ CHROME_DEVTOOLS_ENABLE_PATHS = "enable EITHER provider: (1) install the ecc plugin (`harnessed install ecc` \u2014 chrome-devtools is its only default MCP connector), OR (2) self-install the standalone server (`claude mcp add chrome-devtools-mcp`, manifests/optional/chrome-devtools-mcp.yaml). Install exactly ONE \u2014 both at once creates same-name dual-prefix tool-call ambiguity (the doctor `ecc` check warns on the leftover).";
5847
+ DEFAULT_DEPS = {
5848
+ pluginRegistered: isPluginRegistered,
5849
+ mcpServerRegistered: isMcpServerRegistered
5850
+ };
5851
+ }
5852
+ });
5853
+
5633
5854
  // src/cli/lib/check-ecc.ts
5634
5855
  var check_ecc_exports = {};
5635
5856
  __export(check_ecc_exports, {
@@ -5644,7 +5865,8 @@ async function pathExists(p7) {
5644
5865
  }
5645
5866
  }
5646
5867
  async function checkEcc() {
5647
- const ccInstalled = await isPluginRegistered("ecc");
5868
+ const cdt = await probeChromeDevtools();
5869
+ const ccInstalled = cdt.ecc;
5648
5870
  const codexHome = join(homedir(), ".codex");
5649
5871
  const codexPresent = await pathExists(join(codexHome, "config.toml"));
5650
5872
  const codexInstalled = codexPresent && await pathExists(join(codexHome, ".cache", "ecc", ".git"));
@@ -5653,11 +5875,11 @@ async function checkEcc() {
5653
5875
  if (ccInstalled) {
5654
5876
  const leftovers = [];
5655
5877
  const fixes = [];
5656
- if (await isPluginRegistered("chrome-devtools-mcp")) {
5878
+ if (cdt.standalonePlugin) {
5657
5879
  leftovers.push("official chrome-devtools-mcp@claude-plugins-official plugin still enabled");
5658
5880
  fixes.push("`claude plugin uninstall chrome-devtools-mcp@claude-plugins-official`");
5659
5881
  }
5660
- if (await isMcpServerRegistered("chrome-devtools-mcp")) {
5882
+ if (cdt.standaloneStdio) {
5661
5883
  leftovers.push("chrome-devtools-mcp stdio entry still registered in mcpServers");
5662
5884
  fixes.push("`claude mcp remove chrome-devtools-mcp`");
5663
5885
  }
@@ -5671,10 +5893,11 @@ async function checkEcc() {
5671
5893
  }
5672
5894
  }
5673
5895
  if (!ccInstalled && !codexInstalled) {
5896
+ const cdtPart = cdt.unknown ? " Separately, the chrome-devtools provider probe FAULTED (unreadable plugin registry / MCP config) \u2014 availability unknown, so the perf / a11y / memory diagnostic lane is left ON (fail-soft)." : cdt.providers.length > 0 ? ` chrome-devtools is still covered by the standalone provider (${cdt.providers.join(" + ")}).` : ` NOTE: chrome-devtools now has ZERO providers, so the perf / a11y / memory diagnostic lane (verify-qa \`05-perf-a11y-diagnostic\`) will not run \u2014 ${CHROME_DEVTOOLS_ENABLE_PATHS}`;
5674
5897
  return {
5675
5898
  name: NAME2,
5676
5899
  status: "pass",
5677
- message: `not installed (${ccPart}; ${codexPart}) \u2014 optional enhancement: \`harnessed install ecc\` unlocks finer-grained orchestration (per-language review/build expert routing etc.) at a ~20k+ tokens/session static-listing cost (ECC-side scale, not harnessed)`
5900
+ message: `not installed (${ccPart}; ${codexPart}) \u2014 optional enhancement: \`harnessed install ecc\` unlocks finer-grained orchestration (per-language review/build expert routing etc.) at a ~20k+ tokens/session static-listing cost (ECC-side scale, not harnessed).${cdtPart}`
5678
5901
  };
5679
5902
  }
5680
5903
  return {
@@ -5686,7 +5909,7 @@ async function checkEcc() {
5686
5909
  var NAME2;
5687
5910
  var init_check_ecc = __esm({
5688
5911
  "src/cli/lib/check-ecc.ts"() {
5689
- init_readClaudeConfig();
5912
+ init_probe_chrome_devtools();
5690
5913
  NAME2 = "ecc";
5691
5914
  }
5692
5915
  });
@@ -6002,6 +6225,21 @@ function buildDefaultGateContext(task, stage) {
6002
6225
  // extraction → eval threw undefined-variable → ADR 0029 fail-soft fired the
6003
6226
  // 4-specialist multispec team on EVERY verify. Opt-in via --context.
6004
6227
  is_critical_release: false,
6228
+ // chrome-devtools MCP provider availability — the BARE identifier read by
6229
+ // judgments.web-testing-routing.chrome-devtools-mcp-diagnostic.fires, so it
6230
+ // MUST be declared here (an absent bare variable throws → ADR-0038
6231
+ // fail-closed would delete the lane on a machine that HAS a provider).
6232
+ //
6233
+ // Seeded TRUE = "unknown", not "measured". This builder is synchronous and
6234
+ // the real answer needs async fs probes (~/.claude/plugins/installed_plugins.json
6235
+ // + the harness mcpServers config), so the honest default is the fail-soft
6236
+ // direction documented in src/cli/lib/probe-chrome-devtools.ts: a value we
6237
+ // could not measure must never silently REMOVE a declared capability
6238
+ // (src/workflow/skipGate.ts invariant). The measured value arrives through
6239
+ // `harnessed facts <master>` (deterministically derived, auto-filled) →
6240
+ // `harnessed gates --context-file`, and through `harnessed run`'s awaited
6241
+ // probe overlay.
6242
+ chrome_devtools_available: true,
6005
6243
  phase: {
6006
6244
  stage,
6007
6245
  // T2.1 OQ2(c) — withdrawn: gated stage-routing.verify-paranoid-critical,
@@ -6798,57 +7036,6 @@ var init_ccHookAdd2 = __esm({
6798
7036
  };
6799
7037
  }
6800
7038
  });
6801
- function extractVerifyBinary(verifyCmd, fallback) {
6802
- const token = verifyCmd?.trim().split(/\s+/)[0];
6803
- if (token && BARE_BIN_RE.test(token) && !NON_COMPONENT_TOKENS.has(token)) return token;
6804
- if (BARE_BIN_RE.test(fallback) && !NON_COMPONENT_TOKENS.has(fallback)) return fallback;
6805
- return null;
6806
- }
6807
- function realRun2(finder, bin) {
6808
- try {
6809
- if (typeof spawnSync !== "function") return null;
6810
- const r = spawnSync(finder, [bin], { encoding: "utf8" });
6811
- if (!r || r.error) return null;
6812
- return { status: r.status, stdout: r.stdout ?? "" };
6813
- } catch {
6814
- return null;
6815
- }
6816
- }
6817
- function binaryOnPath(bin, deps) {
6818
- const platform = process.platform;
6819
- const run = realRun2;
6820
- const finder = platform === "win32" ? "where" : "which";
6821
- const r = run(finder, bin);
6822
- if (!r || r.status !== 0) return false;
6823
- return r.stdout.trim().length > 0;
6824
- }
6825
- var NON_COMPONENT_TOKENS, BARE_BIN_RE;
6826
- var init_binaryProbe = __esm({
6827
- "src/installers/lib/binaryProbe.ts"() {
6828
- NON_COMPONENT_TOKENS = /* @__PURE__ */ new Set([
6829
- "test",
6830
- "grep",
6831
- "ls",
6832
- "cat",
6833
- "echo",
6834
- "command",
6835
- "sh",
6836
- "bash",
6837
- "[",
6838
- "npx",
6839
- "npm",
6840
- "node",
6841
- "corepack",
6842
- "pnpm",
6843
- "yarn",
6844
- "bun",
6845
- "git",
6846
- "claude",
6847
- "codex"
6848
- ]);
6849
- BARE_BIN_RE = /^[A-Za-z0-9][\w.@-]*$/;
6850
- }
6851
- });
6852
7039
  function evalClause(clause, home) {
6853
7040
  const m = clause.match(CLAUSE_RE);
6854
7041
  if (!m?.[1] || !m[2]) return null;
@@ -6999,10 +7186,10 @@ async function spawnCmd(ctx, cmd, args, timeoutMs, opts) {
6999
7186
  child.stderr?.setEncoding("utf8").on("data", (chunk) => {
7000
7187
  stderr += chunk;
7001
7188
  });
7002
- return await new Promise((resolve23) => {
7189
+ return await new Promise((resolve24) => {
7003
7190
  const timer = setTimeout(() => {
7004
7191
  child.kill("SIGKILL");
7005
- resolve23({
7192
+ resolve24({
7006
7193
  ok: false,
7007
7194
  phase: "spawn",
7008
7195
  error: {
@@ -7023,7 +7210,7 @@ async function spawnCmd(ctx, cmd, args, timeoutMs, opts) {
7023
7210
  child.on("error", (err2) => {
7024
7211
  clearTimeout(timer);
7025
7212
  const bashMissing = triedBash && err2.code === "ENOENT";
7026
- resolve23({
7213
+ resolve24({
7027
7214
  ok: false,
7028
7215
  phase: "spawn",
7029
7216
  error: {
@@ -7038,7 +7225,7 @@ async function spawnCmd(ctx, cmd, args, timeoutMs, opts) {
7038
7225
  });
7039
7226
  child.on("close", (code) => {
7040
7227
  clearTimeout(timer);
7041
- resolve23({ ok: true, exitCode: code ?? -1, stdout: stdout2, stderr });
7228
+ resolve24({ ok: true, exitCode: code ?? -1, stdout: stdout2, stderr });
7042
7229
  });
7043
7230
  });
7044
7231
  }
@@ -7239,7 +7426,7 @@ var init_idempotent = __esm({
7239
7426
  }
7240
7427
  });
7241
7428
  function runHarnessArgs(bin, args, cwd, timeoutMs = 15e3) {
7242
- return new Promise((resolve23) => {
7429
+ return new Promise((resolve24) => {
7243
7430
  const isWin = process.platform === "win32";
7244
7431
  const stdio = ["ignore", "pipe", "pipe"];
7245
7432
  const child = isWin ? spawn("cmd.exe", ["/c", bin, ...args], { cwd, windowsHide: true, stdio }) : spawn(bin, args, { cwd, shell: false, stdio });
@@ -7253,17 +7440,17 @@ function runHarnessArgs(bin, args, cwd, timeoutMs = 15e3) {
7253
7440
  });
7254
7441
  const timer = setTimeout(() => {
7255
7442
  child.kill("SIGKILL");
7256
- resolve23({ exitCode: -1, stdout: stdout2, stderr: `${stderr}[timeout after ${timeoutMs}ms]` });
7443
+ resolve24({ exitCode: -1, stdout: stdout2, stderr: `${stderr}[timeout after ${timeoutMs}ms]` });
7257
7444
  }, timeoutMs);
7258
7445
  child.on("error", (e) => {
7259
7446
  clearTimeout(timer);
7260
7447
  const enoent = e.code === "ENOENT";
7261
7448
  const msg = enoent && bin === "codex" ? "codex CLI not found on PATH \u2014 install Codex CLI or re-run setup on the claude platform" : e.message;
7262
- resolve23({ exitCode: -1, stdout: stdout2, stderr: `${stderr}${msg}` });
7449
+ resolve24({ exitCode: -1, stdout: stdout2, stderr: `${stderr}${msg}` });
7263
7450
  });
7264
7451
  child.on("close", (code) => {
7265
7452
  clearTimeout(timer);
7266
- resolve23({ exitCode: code ?? -1, stdout: stdout2, stderr });
7453
+ resolve24({ exitCode: code ?? -1, stdout: stdout2, stderr });
7267
7454
  });
7268
7455
  });
7269
7456
  }
@@ -7519,7 +7706,7 @@ var init_packSkillAudit = __esm({
7519
7706
  }
7520
7707
  });
7521
7708
  function gitRevParseHead(cwd, timeoutMs = 1e4) {
7522
- return new Promise((resolve23) => {
7709
+ return new Promise((resolve24) => {
7523
7710
  const isWin = process.platform === "win32";
7524
7711
  const child = isWin ? spawn("cmd.exe", ["/c", "git", "rev-parse", "HEAD"], { cwd, windowsHide: true }) : spawn("git", ["rev-parse", "HEAD"], { cwd, shell: false });
7525
7712
  let stdout2 = "";
@@ -7528,15 +7715,15 @@ function gitRevParseHead(cwd, timeoutMs = 1e4) {
7528
7715
  });
7529
7716
  const timer = setTimeout(() => {
7530
7717
  child.kill("SIGKILL");
7531
- resolve23({ sha: "", exit: -1 });
7718
+ resolve24({ sha: "", exit: -1 });
7532
7719
  }, timeoutMs);
7533
7720
  child.on("error", () => {
7534
7721
  clearTimeout(timer);
7535
- resolve23({ sha: "", exit: -1 });
7722
+ resolve24({ sha: "", exit: -1 });
7536
7723
  });
7537
7724
  child.on("close", (code) => {
7538
7725
  clearTimeout(timer);
7539
- resolve23({ sha: stdout2.trim(), exit: code ?? -1 });
7726
+ resolve24({ sha: stdout2.trim(), exit: code ?? -1 });
7540
7727
  });
7541
7728
  });
7542
7729
  }
@@ -10044,7 +10231,7 @@ function renderHumanTable(records) {
10044
10231
  }
10045
10232
  }
10046
10233
  function pipeToJq(filterExpr, lines) {
10047
- return new Promise((resolve23, reject) => {
10234
+ return new Promise((resolve24, reject) => {
10048
10235
  const child = spawn("jq", [filterExpr], {
10049
10236
  stdio: ["pipe", "inherit", "inherit"],
10050
10237
  windowsHide: true
@@ -10053,12 +10240,12 @@ function pipeToJq(filterExpr, lines) {
10053
10240
  const e = err2;
10054
10241
  if (e.code === "ENOENT") {
10055
10242
  console.error(t("audit_log.jq_missing"));
10056
- resolve23(1);
10243
+ resolve24(1);
10057
10244
  } else {
10058
10245
  reject(err2);
10059
10246
  }
10060
10247
  });
10061
- child.on("close", (code) => resolve23(code ?? 0));
10248
+ child.on("close", (code) => resolve24(code ?? 0));
10062
10249
  child.stdin.write(lines.join("\n"));
10063
10250
  child.stdin.end();
10064
10251
  });
@@ -11012,6 +11199,7 @@ init_runDeps();
11012
11199
  init_exprBuilder();
11013
11200
  init_judgmentResolver();
11014
11201
  init_gates();
11202
+ init_probe_chrome_devtools();
11015
11203
  var VALID_MASTERS2 = new Set(GATE_MASTERS);
11016
11204
  function deriveGitFacts(run) {
11017
11205
  let lines = 0;
@@ -11155,7 +11343,7 @@ function buildFactsEnvelope(master, gatedNames, derived) {
11155
11343
  usage: `Fill every null in \`facts\` with your honest judgement (leave a fact null to accept harnessed's default), write that object to a file, then run: harnessed gates ${master} --task "<locked spec>" --context-file <path>. The output of this command can be passed back verbatim \u2014 the envelope is unwrapped automatically.`
11156
11344
  };
11157
11345
  }
11158
- async function runFactsPlan(master, raw, deps = defaultRunDeps, gitRun = defaultGitRun) {
11346
+ async function runFactsPlan(master, raw, deps = defaultRunDeps, gitRun = defaultGitRun, probeCdt = () => probeChromeDevtools()) {
11159
11347
  if (!VALID_MASTERS2.has(master)) {
11160
11348
  deps.error(
11161
11349
  `error: unknown master '${master}'. Expected one of: ${[...GATE_MASTERS].join(", ")}.`
@@ -11182,6 +11370,7 @@ async function runFactsPlan(master, raw, deps = defaultRunDeps, gitRun = default
11182
11370
  return;
11183
11371
  }
11184
11372
  const git = deriveGitFacts(gitRun);
11373
+ const cdt = await probeCdt();
11185
11374
  const derived = {
11186
11375
  // `harnessed gates` seeds phase.stage from the master argument, so facts MUST
11187
11376
  // report the same thing: deriving a stage from the ledger instead could hand
@@ -11198,6 +11387,13 @@ async function runFactsPlan(master, raw, deps = defaultRunDeps, gitRun = default
11198
11387
  "phase.files_touched": {
11199
11388
  value: git.files_touched,
11200
11389
  source: "git diff --name-only + --cached --name-only (unique paths; null when no repo / clean tree)"
11390
+ },
11391
+ // Root-flat (bare identifier), sister src/workflow/schema/phaseFactContext.ts.
11392
+ // `source` doubles as the SKIP REASON: when no provider is registered it
11393
+ // names BOTH enable paths, so losing the diagnostic lane is never silent.
11394
+ chrome_devtools_available: {
11395
+ value: chromeDevtoolsAvailable(cdt),
11396
+ source: chromeDevtoolsFactSource(cdt)
11201
11397
  }
11202
11398
  };
11203
11399
  const envelope = buildFactsEnvelope(master, gated, derived);
@@ -13304,6 +13500,7 @@ function extractMatchedTriggers(userText, overrides) {
13304
13500
 
13305
13501
  // src/cli/run.ts
13306
13502
  init_gateContext();
13503
+ init_probe_chrome_devtools();
13307
13504
  var PACKAGE_ROOT2 = getAssetsRoot();
13308
13505
  var WORKFLOWS_DIR2 = join(PACKAGE_ROOT2, "workflows");
13309
13506
  var _autoChainCache = null;
@@ -13361,6 +13558,12 @@ function registerRun(program2) {
13361
13558
  const stage = name.includes("-") ? name.split("-")[0] ?? "" : name;
13362
13559
  const gateContext = {
13363
13560
  ...buildDefaultGateContext(task, stage),
13561
+ // buildDefaultGateContext is synchronous and can only seed the fail-soft
13562
+ // "unknown = available" default for chrome_devtools_available. This is the
13563
+ // runtime path that actually evaluates the verify/qa phase-05 gate, so
13564
+ // overlay the MEASURED value (never throws; unknown still resolves true —
13565
+ // see src/cli/lib/probe-chrome-devtools.ts).
13566
+ chrome_devtools_available: await isChromeDevtoolsAvailable(),
13364
13567
  ...raw.model ? { modelOverride: raw.model } : {},
13365
13568
  ...raw.maxIterations ? { maxIterations: raw.maxIterations } : {},
13366
13569
  ...raw.staged ? { staged: true } : {},
@@ -13862,7 +14065,7 @@ var V3_4_3_SIGNATURE_MASTER_RX = /\*\*Preferred path\*\*[\s\S]*dispatch to the p
13862
14065
  function shouldOverwriteFile(content) {
13863
14066
  return HARNESSED_MARKER_RX2.test(content) || V3_4_3_SIGNATURE_SUB_RX.test(content) || V3_4_3_SIGNATURE_MASTER_RX.test(content);
13864
14067
  }
13865
- async function writeAllCommands(slashNames, commandsDir, rolePrompts, capabilities, installedPlugins, installedUserSkills, writer, fileExists2 = existsSync, readFileSync21 = (p7) => readFileSync(p7, "utf8")) {
14068
+ async function writeAllCommands(slashNames, commandsDir, rolePrompts, capabilities, installedPlugins, installedUserSkills, writer, fileExists2 = existsSync, readFileSync22 = (p7) => readFileSync(p7, "utf8")) {
13866
14069
  const results = [];
13867
14070
  const aggregatedWarnings = /* @__PURE__ */ new Set();
13868
14071
  for (const name of slashNames) {
@@ -13881,7 +14084,7 @@ async function writeAllCommands(slashNames, commandsDir, rolePrompts, capabiliti
13881
14084
  if (fileExists2(path)) {
13882
14085
  let existing = "";
13883
14086
  try {
13884
- existing = readFileSync21(path);
14087
+ existing = readFileSync22(path);
13885
14088
  } catch {
13886
14089
  existing = "";
13887
14090
  }
@@ -14994,7 +15197,7 @@ var uninstallNpmCli = async (ctx) => {
14994
15197
  const m = install.cmd.match(/npm\s+(?:install|i)\s+(?:-g\s+)?(\S+)/);
14995
15198
  const pkg = m?.[1] ?? ctx.manifest.metadata.upstream.source;
14996
15199
  const isWin = process.platform === "win32";
14997
- const result = await new Promise((resolve23) => {
15200
+ const result = await new Promise((resolve24) => {
14998
15201
  const child = isWin ? spawn("cmd.exe", ["/c", "npm", "uninstall", "-g", pkg], { windowsHide: true }) : spawn("npm", ["uninstall", "-g", pkg], { shell: false });
14999
15202
  let stderr = "";
15000
15203
  child.stderr?.setEncoding("utf8").on("data", (c) => {
@@ -15002,15 +15205,15 @@ var uninstallNpmCli = async (ctx) => {
15002
15205
  });
15003
15206
  const timer = setTimeout(() => {
15004
15207
  child.kill("SIGKILL");
15005
- resolve23({ exitCode: -1, stderr: `${stderr}[timeout]` });
15208
+ resolve24({ exitCode: -1, stderr: `${stderr}[timeout]` });
15006
15209
  }, 3e4);
15007
15210
  child.on("error", (e) => {
15008
15211
  clearTimeout(timer);
15009
- resolve23({ exitCode: -1, stderr: e.message });
15212
+ resolve24({ exitCode: -1, stderr: e.message });
15010
15213
  });
15011
15214
  child.on("close", (code) => {
15012
15215
  clearTimeout(timer);
15013
- resolve23({ exitCode: code ?? -1, stderr });
15216
+ resolve24({ exitCode: code ?? -1, stderr });
15014
15217
  });
15015
15218
  });
15016
15219
  if (result.exitCode !== 0) {