@vectorize-io/hindsight-coding-agents 0.8.5 → 0.8.6

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.
Files changed (62) hide show
  1. package/README.md +13 -12
  2. package/dist/antigravity-hook.js +1 -1
  3. package/dist/antigravity-statusline.js +1 -1
  4. package/dist/antigravity-stop-hook.js +1 -1
  5. package/dist/claude-hook.js +1 -1
  6. package/dist/claude-sessionstart-hook.js +79 -88
  7. package/dist/claude-stop-hook.js +1 -1
  8. package/dist/cline.js +79 -88
  9. package/dist/codebuddy-hook.js +1 -1
  10. package/dist/codebuddy-sessionstart-hook.js +79 -88
  11. package/dist/codebuddy-stop-hook.js +1 -1
  12. package/dist/codex-hook.js +1 -1
  13. package/dist/codex-sessionstart-hook.js +79 -88
  14. package/dist/codex-stop-hook.js +1 -1
  15. package/dist/copilot-hook.js +1 -1
  16. package/dist/copilot-sessionstart-hook.js +79 -88
  17. package/dist/copilot-stop-hook.js +1 -1
  18. package/dist/cursor-hook.js +1 -1
  19. package/dist/cursor-sessionstart-hook.js +79 -88
  20. package/dist/cursor-stop-hook.js +1 -1
  21. package/dist/daemon-start.js +1 -1
  22. package/dist/dcode-hook.js +1 -1
  23. package/dist/dcode-sessionstart-hook.js +79 -88
  24. package/dist/dcode-stop-hook.js +1 -1
  25. package/dist/deepen.js +1 -1
  26. package/dist/devin-hook.js +1 -1
  27. package/dist/devin-sessionstart-hook.js +79 -88
  28. package/dist/devin-stop-hook.js +1 -1
  29. package/dist/droid-hook.js +1 -1
  30. package/dist/droid-sessionstart-hook.js +79 -88
  31. package/dist/droid-stop-hook.js +1 -1
  32. package/dist/dsh.js +79 -88
  33. package/dist/grok-hook.js +1 -1
  34. package/dist/grok-sessionstart-hook.js +79 -88
  35. package/dist/grok-stop-hook.js +1 -1
  36. package/dist/hindsight-seed.js +1 -1
  37. package/dist/index.js +79 -88
  38. package/dist/installer.js +1 -1
  39. package/dist/kilo.js +79 -88
  40. package/dist/kimi-hook.js +1 -1
  41. package/dist/kimi-sessionstart-hook.js +79 -88
  42. package/dist/kimi-stop-hook.js +1 -1
  43. package/dist/mcp-server.js +1 -1
  44. package/dist/opencode2.js +79 -88
  45. package/dist/pi.js +79 -88
  46. package/dist/prime-agent.js +79 -88
  47. package/dist/qwen-hook.js +1 -1
  48. package/dist/qwen-sessionstart-hook.js +79 -88
  49. package/dist/qwen-stop-hook.js +1 -1
  50. package/dist/status.js +1 -1
  51. package/dist/traecode-hook.js +1 -1
  52. package/dist/traecode-sessionstart-hook.js +79 -88
  53. package/dist/traecode-stop-hook.js +1 -1
  54. package/dist/workbuddy-hook.js +1 -1
  55. package/dist/workbuddy-sessionstart-hook.js +79 -88
  56. package/dist/workbuddy-stop-hook.js +1 -1
  57. package/dist/zcode-hook.js +1 -1
  58. package/dist/zcode-sessionstart-hook.js +79 -88
  59. package/dist/zcode-stop-hook.js +1 -1
  60. package/package.json +1 -1
  61. package/plugin.json +1 -1
  62. package/skill/SKILL.md +3 -3
package/dist/opencode2.js CHANGED
@@ -15167,7 +15167,7 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
15167
15167
  }
15168
15168
 
15169
15169
  // package.json
15170
- var version2 = "0.8.5";
15170
+ var version2 = "0.8.6";
15171
15171
 
15172
15172
  // src/core/util.ts
15173
15173
  import { accessSync, constants, statSync as statSync2 } from "fs";
@@ -17446,97 +17446,88 @@ function surveyAttempts(file3, sha) {
17446
17446
  async function startCodebaseSurvey(repoDir, opts = {}) {
17447
17447
  try {
17448
17448
  const spawnFn = opts.spawn ?? realSpawn5;
17449
- const resolveBin = opts.resolveBin ?? ((bin) => binOnPath(bin, { exts: [".exe"] }));
17449
+ const resolveBin = opts.resolveBin ?? ((bin2) => binOnPath(bin2, { exts: [".exe"] }));
17450
17450
  const mcpServerPath = opts.mcpServerPath ?? join11(dirname7(fileURLToPath4(import.meta.url)), "mcp-server.js");
17451
- const preferred = opts.harness ?? "claude-code";
17452
- const order = [
17453
- preferred,
17454
- "claude-code",
17455
- "codex",
17456
- "antigravity-cli",
17457
- "opencode"
17458
- ];
17459
- const seen = /* @__PURE__ */ new Set();
17460
- for (const harness of order) {
17461
- if (seen.has(harness)) continue;
17462
- seen.add(harness);
17463
- const name = resolveAgentBin(harness, opts.claudeBin);
17464
- if (!name) continue;
17465
- const bin = resolveBin(name);
17466
- if (!bin) {
17467
- log.info("survey", `${harness}: ${name} not found, trying the next agent`);
17468
- continue;
17469
- }
17470
- if (harness === "opencode" && !(opts.opencodeDefinesAgent ?? opencodeCanDefineSurveyAgent)(bin)) {
17471
- log.info("survey", `${harness}: ${bin} cannot define the survey agent, trying the next`);
17472
- continue;
17473
- }
17474
- const plan = buildSurveyPlan(harness, bin, repoDir, {
17475
- model: opts.model,
17476
- budgetUsd: opts.budgetUsd,
17477
- mcpServerPath
17478
- });
17479
- const { cfg, bankId } = resolveHostConfig(harness, repoDir);
17480
- if (cfg.disabled) return false;
17481
- const key = createHash3("sha256").update(JSON.stringify([cfg.apiUrl.replace(/\/+$/, ""), cfg.apiToken ?? "", bankId])).digest("hex");
17482
- const leaseDir = opts.lease?.dir ?? join11(tmpdir2(), "hindsight-coding-agent", "surveys");
17483
- const lease = acquireLease(leaseDir, key, opts.lease?.staleMs ?? LEASE_STALE_MS);
17484
- if (!lease) return false;
17485
- const attemptsFile = join11(
17486
- leaseDir,
17487
- `attempts-${createHash3("sha256").update(JSON.stringify([key, repoDir])).digest("hex")}.json`
17488
- );
17489
- const attempts = opts.sha ? surveyAttempts(attemptsFile, opts.sha) : 0;
17490
- if (attempts >= SURVEY_MAX_ATTEMPTS) {
17491
- log.info("survey", `${attempts} surveys already launched at ${opts.sha}, skipping`);
17492
- releaseLease(lease);
17493
- return false;
17494
- }
17495
- const spec = {
17496
- lease,
17497
- bin: plan.bin,
17498
- args: plan.args,
17499
- ...opts.lease?.heartbeatMs ? { heartbeatMs: opts.lease.heartbeatMs } : {}
17500
- };
17501
- const supervisorPath = opts.supervisorPath ?? join11(dirname7(fileURLToPath4(import.meta.url)), "survey-supervisor.js");
17502
- return await new Promise((resolve4) => {
17503
- try {
17504
- const child = spawnFn("node", [supervisorPath], {
17505
- cwd: repoDir,
17506
- detached: true,
17507
- stdio: "ignore",
17508
- windowsHide: true,
17509
- env: { ...plan.env, [SURVEY_SPEC_ENV]: JSON.stringify(spec) }
17510
- });
17511
- let spawned = false;
17512
- child.on("error", (e) => {
17513
- if (spawned) return;
17514
- log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
17515
- releaseLease(lease);
17516
- resolve4(false);
17517
- });
17518
- child.once("spawn", () => {
17519
- spawned = true;
17520
- child.unref();
17521
- if (opts.sha) {
17522
- try {
17523
- writeFileSync3(
17524
- attemptsFile,
17525
- JSON.stringify({ sha: opts.sha, attempts: attempts + 1 }),
17526
- { mode: 384 }
17527
- );
17528
- } catch {
17529
- }
17530
- }
17531
- resolve4(true);
17532
- });
17533
- } catch (e) {
17451
+ const harness = opts.harness ?? "claude-code";
17452
+ const name = resolveAgentBin(harness, opts.claudeBin);
17453
+ if (!name) {
17454
+ log.info("survey", `${harness}: no headless survey for this agent, skipping the survey`);
17455
+ return false;
17456
+ }
17457
+ const bin = resolveBin(name);
17458
+ if (!bin) {
17459
+ log.info("survey", `${harness}: ${name} not found, skipping the survey`);
17460
+ return false;
17461
+ }
17462
+ if (harness === "opencode" && !(opts.opencodeDefinesAgent ?? opencodeCanDefineSurveyAgent)(bin)) {
17463
+ log.info("survey", `${harness}: ${bin} cannot define the survey agent, skipping the survey`);
17464
+ return false;
17465
+ }
17466
+ const plan = buildSurveyPlan(harness, bin, repoDir, {
17467
+ model: opts.model,
17468
+ budgetUsd: opts.budgetUsd,
17469
+ mcpServerPath
17470
+ });
17471
+ const { cfg, bankId } = resolveHostConfig(harness, repoDir);
17472
+ if (cfg.disabled) return false;
17473
+ const key = createHash3("sha256").update(JSON.stringify([cfg.apiUrl.replace(/\/+$/, ""), cfg.apiToken ?? "", bankId])).digest("hex");
17474
+ const leaseDir = opts.lease?.dir ?? join11(tmpdir2(), "hindsight-coding-agent", "surveys");
17475
+ const lease = acquireLease(leaseDir, key, opts.lease?.staleMs ?? LEASE_STALE_MS);
17476
+ if (!lease) return false;
17477
+ const attemptsFile = join11(
17478
+ leaseDir,
17479
+ `attempts-${createHash3("sha256").update(JSON.stringify([key, repoDir])).digest("hex")}.json`
17480
+ );
17481
+ const attempts = opts.sha ? surveyAttempts(attemptsFile, opts.sha) : 0;
17482
+ if (attempts >= SURVEY_MAX_ATTEMPTS) {
17483
+ log.info("survey", `${attempts} surveys already launched at ${opts.sha}, skipping`);
17484
+ releaseLease(lease);
17485
+ return false;
17486
+ }
17487
+ const spec = {
17488
+ lease,
17489
+ bin: plan.bin,
17490
+ args: plan.args,
17491
+ ...opts.lease?.heartbeatMs ? { heartbeatMs: opts.lease.heartbeatMs } : {}
17492
+ };
17493
+ const supervisorPath = opts.supervisorPath ?? join11(dirname7(fileURLToPath4(import.meta.url)), "survey-supervisor.js");
17494
+ return await new Promise((resolve4) => {
17495
+ try {
17496
+ const child = spawnFn("node", [supervisorPath], {
17497
+ cwd: repoDir,
17498
+ detached: true,
17499
+ stdio: "ignore",
17500
+ windowsHide: true,
17501
+ env: { ...plan.env, [SURVEY_SPEC_ENV]: JSON.stringify(spec) }
17502
+ });
17503
+ let spawned = false;
17504
+ child.on("error", (e) => {
17505
+ if (spawned) return;
17534
17506
  log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
17535
17507
  releaseLease(lease);
17536
17508
  resolve4(false);
17537
- }
17538
- });
17539
- }
17509
+ });
17510
+ child.once("spawn", () => {
17511
+ spawned = true;
17512
+ child.unref();
17513
+ if (opts.sha) {
17514
+ try {
17515
+ writeFileSync3(
17516
+ attemptsFile,
17517
+ JSON.stringify({ sha: opts.sha, attempts: attempts + 1 }),
17518
+ { mode: 384 }
17519
+ );
17520
+ } catch {
17521
+ }
17522
+ }
17523
+ resolve4(true);
17524
+ });
17525
+ } catch (e) {
17526
+ log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
17527
+ releaseLease(lease);
17528
+ resolve4(false);
17529
+ }
17530
+ });
17540
17531
  } catch {
17541
17532
  }
17542
17533
  return false;
package/dist/pi.js CHANGED
@@ -15167,7 +15167,7 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
15167
15167
  }
15168
15168
 
15169
15169
  // package.json
15170
- var version2 = "0.8.5";
15170
+ var version2 = "0.8.6";
15171
15171
 
15172
15172
  // src/core/util.ts
15173
15173
  import { accessSync, constants, statSync as statSync2 } from "fs";
@@ -17435,97 +17435,88 @@ function surveyAttempts(file2, sha) {
17435
17435
  async function startCodebaseSurvey(repoDir, opts = {}) {
17436
17436
  try {
17437
17437
  const spawnFn = opts.spawn ?? realSpawn5;
17438
- const resolveBin = opts.resolveBin ?? ((bin) => binOnPath(bin, { exts: [".exe"] }));
17438
+ const resolveBin = opts.resolveBin ?? ((bin2) => binOnPath(bin2, { exts: [".exe"] }));
17439
17439
  const mcpServerPath = opts.mcpServerPath ?? join11(dirname7(fileURLToPath4(import.meta.url)), "mcp-server.js");
17440
- const preferred = opts.harness ?? "claude-code";
17441
- const order = [
17442
- preferred,
17443
- "claude-code",
17444
- "codex",
17445
- "antigravity-cli",
17446
- "opencode"
17447
- ];
17448
- const seen = /* @__PURE__ */ new Set();
17449
- for (const harness of order) {
17450
- if (seen.has(harness)) continue;
17451
- seen.add(harness);
17452
- const name = resolveAgentBin(harness, opts.claudeBin);
17453
- if (!name) continue;
17454
- const bin = resolveBin(name);
17455
- if (!bin) {
17456
- log.info("survey", `${harness}: ${name} not found, trying the next agent`);
17457
- continue;
17458
- }
17459
- if (harness === "opencode" && !(opts.opencodeDefinesAgent ?? opencodeCanDefineSurveyAgent)(bin)) {
17460
- log.info("survey", `${harness}: ${bin} cannot define the survey agent, trying the next`);
17461
- continue;
17462
- }
17463
- const plan = buildSurveyPlan(harness, bin, repoDir, {
17464
- model: opts.model,
17465
- budgetUsd: opts.budgetUsd,
17466
- mcpServerPath
17467
- });
17468
- const { cfg, bankId } = resolveHostConfig(harness, repoDir);
17469
- if (cfg.disabled) return false;
17470
- const key = createHash3("sha256").update(JSON.stringify([cfg.apiUrl.replace(/\/+$/, ""), cfg.apiToken ?? "", bankId])).digest("hex");
17471
- const leaseDir = opts.lease?.dir ?? join11(tmpdir2(), "hindsight-coding-agent", "surveys");
17472
- const lease = acquireLease(leaseDir, key, opts.lease?.staleMs ?? LEASE_STALE_MS);
17473
- if (!lease) return false;
17474
- const attemptsFile = join11(
17475
- leaseDir,
17476
- `attempts-${createHash3("sha256").update(JSON.stringify([key, repoDir])).digest("hex")}.json`
17477
- );
17478
- const attempts = opts.sha ? surveyAttempts(attemptsFile, opts.sha) : 0;
17479
- if (attempts >= SURVEY_MAX_ATTEMPTS) {
17480
- log.info("survey", `${attempts} surveys already launched at ${opts.sha}, skipping`);
17481
- releaseLease(lease);
17482
- return false;
17483
- }
17484
- const spec = {
17485
- lease,
17486
- bin: plan.bin,
17487
- args: plan.args,
17488
- ...opts.lease?.heartbeatMs ? { heartbeatMs: opts.lease.heartbeatMs } : {}
17489
- };
17490
- const supervisorPath = opts.supervisorPath ?? join11(dirname7(fileURLToPath4(import.meta.url)), "survey-supervisor.js");
17491
- return await new Promise((resolve4) => {
17492
- try {
17493
- const child = spawnFn("node", [supervisorPath], {
17494
- cwd: repoDir,
17495
- detached: true,
17496
- stdio: "ignore",
17497
- windowsHide: true,
17498
- env: { ...plan.env, [SURVEY_SPEC_ENV]: JSON.stringify(spec) }
17499
- });
17500
- let spawned = false;
17501
- child.on("error", (e) => {
17502
- if (spawned) return;
17503
- log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
17504
- releaseLease(lease);
17505
- resolve4(false);
17506
- });
17507
- child.once("spawn", () => {
17508
- spawned = true;
17509
- child.unref();
17510
- if (opts.sha) {
17511
- try {
17512
- writeFileSync3(
17513
- attemptsFile,
17514
- JSON.stringify({ sha: opts.sha, attempts: attempts + 1 }),
17515
- { mode: 384 }
17516
- );
17517
- } catch {
17518
- }
17519
- }
17520
- resolve4(true);
17521
- });
17522
- } catch (e) {
17440
+ const harness = opts.harness ?? "claude-code";
17441
+ const name = resolveAgentBin(harness, opts.claudeBin);
17442
+ if (!name) {
17443
+ log.info("survey", `${harness}: no headless survey for this agent, skipping the survey`);
17444
+ return false;
17445
+ }
17446
+ const bin = resolveBin(name);
17447
+ if (!bin) {
17448
+ log.info("survey", `${harness}: ${name} not found, skipping the survey`);
17449
+ return false;
17450
+ }
17451
+ if (harness === "opencode" && !(opts.opencodeDefinesAgent ?? opencodeCanDefineSurveyAgent)(bin)) {
17452
+ log.info("survey", `${harness}: ${bin} cannot define the survey agent, skipping the survey`);
17453
+ return false;
17454
+ }
17455
+ const plan = buildSurveyPlan(harness, bin, repoDir, {
17456
+ model: opts.model,
17457
+ budgetUsd: opts.budgetUsd,
17458
+ mcpServerPath
17459
+ });
17460
+ const { cfg, bankId } = resolveHostConfig(harness, repoDir);
17461
+ if (cfg.disabled) return false;
17462
+ const key = createHash3("sha256").update(JSON.stringify([cfg.apiUrl.replace(/\/+$/, ""), cfg.apiToken ?? "", bankId])).digest("hex");
17463
+ const leaseDir = opts.lease?.dir ?? join11(tmpdir2(), "hindsight-coding-agent", "surveys");
17464
+ const lease = acquireLease(leaseDir, key, opts.lease?.staleMs ?? LEASE_STALE_MS);
17465
+ if (!lease) return false;
17466
+ const attemptsFile = join11(
17467
+ leaseDir,
17468
+ `attempts-${createHash3("sha256").update(JSON.stringify([key, repoDir])).digest("hex")}.json`
17469
+ );
17470
+ const attempts = opts.sha ? surveyAttempts(attemptsFile, opts.sha) : 0;
17471
+ if (attempts >= SURVEY_MAX_ATTEMPTS) {
17472
+ log.info("survey", `${attempts} surveys already launched at ${opts.sha}, skipping`);
17473
+ releaseLease(lease);
17474
+ return false;
17475
+ }
17476
+ const spec = {
17477
+ lease,
17478
+ bin: plan.bin,
17479
+ args: plan.args,
17480
+ ...opts.lease?.heartbeatMs ? { heartbeatMs: opts.lease.heartbeatMs } : {}
17481
+ };
17482
+ const supervisorPath = opts.supervisorPath ?? join11(dirname7(fileURLToPath4(import.meta.url)), "survey-supervisor.js");
17483
+ return await new Promise((resolve4) => {
17484
+ try {
17485
+ const child = spawnFn("node", [supervisorPath], {
17486
+ cwd: repoDir,
17487
+ detached: true,
17488
+ stdio: "ignore",
17489
+ windowsHide: true,
17490
+ env: { ...plan.env, [SURVEY_SPEC_ENV]: JSON.stringify(spec) }
17491
+ });
17492
+ let spawned = false;
17493
+ child.on("error", (e) => {
17494
+ if (spawned) return;
17523
17495
  log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
17524
17496
  releaseLease(lease);
17525
17497
  resolve4(false);
17526
- }
17527
- });
17528
- }
17498
+ });
17499
+ child.once("spawn", () => {
17500
+ spawned = true;
17501
+ child.unref();
17502
+ if (opts.sha) {
17503
+ try {
17504
+ writeFileSync3(
17505
+ attemptsFile,
17506
+ JSON.stringify({ sha: opts.sha, attempts: attempts + 1 }),
17507
+ { mode: 384 }
17508
+ );
17509
+ } catch {
17510
+ }
17511
+ }
17512
+ resolve4(true);
17513
+ });
17514
+ } catch (e) {
17515
+ log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
17516
+ releaseLease(lease);
17517
+ resolve4(false);
17518
+ }
17519
+ });
17529
17520
  } catch {
17530
17521
  }
17531
17522
  return false;
@@ -15167,7 +15167,7 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
15167
15167
  }
15168
15168
 
15169
15169
  // package.json
15170
- var version2 = "0.8.5";
15170
+ var version2 = "0.8.6";
15171
15171
 
15172
15172
  // src/core/util.ts
15173
15173
  import { accessSync, constants, statSync as statSync2 } from "fs";
@@ -17435,97 +17435,88 @@ function surveyAttempts(file2, sha) {
17435
17435
  async function startCodebaseSurvey(repoDir, opts = {}) {
17436
17436
  try {
17437
17437
  const spawnFn = opts.spawn ?? realSpawn5;
17438
- const resolveBin = opts.resolveBin ?? ((bin) => binOnPath(bin, { exts: [".exe"] }));
17438
+ const resolveBin = opts.resolveBin ?? ((bin2) => binOnPath(bin2, { exts: [".exe"] }));
17439
17439
  const mcpServerPath = opts.mcpServerPath ?? join11(dirname7(fileURLToPath4(import.meta.url)), "mcp-server.js");
17440
- const preferred = opts.harness ?? "claude-code";
17441
- const order = [
17442
- preferred,
17443
- "claude-code",
17444
- "codex",
17445
- "antigravity-cli",
17446
- "opencode"
17447
- ];
17448
- const seen = /* @__PURE__ */ new Set();
17449
- for (const harness of order) {
17450
- if (seen.has(harness)) continue;
17451
- seen.add(harness);
17452
- const name = resolveAgentBin(harness, opts.claudeBin);
17453
- if (!name) continue;
17454
- const bin = resolveBin(name);
17455
- if (!bin) {
17456
- log.info("survey", `${harness}: ${name} not found, trying the next agent`);
17457
- continue;
17458
- }
17459
- if (harness === "opencode" && !(opts.opencodeDefinesAgent ?? opencodeCanDefineSurveyAgent)(bin)) {
17460
- log.info("survey", `${harness}: ${bin} cannot define the survey agent, trying the next`);
17461
- continue;
17462
- }
17463
- const plan = buildSurveyPlan(harness, bin, repoDir, {
17464
- model: opts.model,
17465
- budgetUsd: opts.budgetUsd,
17466
- mcpServerPath
17467
- });
17468
- const { cfg, bankId } = resolveHostConfig(harness, repoDir);
17469
- if (cfg.disabled) return false;
17470
- const key = createHash3("sha256").update(JSON.stringify([cfg.apiUrl.replace(/\/+$/, ""), cfg.apiToken ?? "", bankId])).digest("hex");
17471
- const leaseDir = opts.lease?.dir ?? join11(tmpdir2(), "hindsight-coding-agent", "surveys");
17472
- const lease = acquireLease(leaseDir, key, opts.lease?.staleMs ?? LEASE_STALE_MS);
17473
- if (!lease) return false;
17474
- const attemptsFile = join11(
17475
- leaseDir,
17476
- `attempts-${createHash3("sha256").update(JSON.stringify([key, repoDir])).digest("hex")}.json`
17477
- );
17478
- const attempts = opts.sha ? surveyAttempts(attemptsFile, opts.sha) : 0;
17479
- if (attempts >= SURVEY_MAX_ATTEMPTS) {
17480
- log.info("survey", `${attempts} surveys already launched at ${opts.sha}, skipping`);
17481
- releaseLease(lease);
17482
- return false;
17483
- }
17484
- const spec = {
17485
- lease,
17486
- bin: plan.bin,
17487
- args: plan.args,
17488
- ...opts.lease?.heartbeatMs ? { heartbeatMs: opts.lease.heartbeatMs } : {}
17489
- };
17490
- const supervisorPath = opts.supervisorPath ?? join11(dirname7(fileURLToPath4(import.meta.url)), "survey-supervisor.js");
17491
- return await new Promise((resolve4) => {
17492
- try {
17493
- const child = spawnFn("node", [supervisorPath], {
17494
- cwd: repoDir,
17495
- detached: true,
17496
- stdio: "ignore",
17497
- windowsHide: true,
17498
- env: { ...plan.env, [SURVEY_SPEC_ENV]: JSON.stringify(spec) }
17499
- });
17500
- let spawned = false;
17501
- child.on("error", (e) => {
17502
- if (spawned) return;
17503
- log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
17504
- releaseLease(lease);
17505
- resolve4(false);
17506
- });
17507
- child.once("spawn", () => {
17508
- spawned = true;
17509
- child.unref();
17510
- if (opts.sha) {
17511
- try {
17512
- writeFileSync3(
17513
- attemptsFile,
17514
- JSON.stringify({ sha: opts.sha, attempts: attempts + 1 }),
17515
- { mode: 384 }
17516
- );
17517
- } catch {
17518
- }
17519
- }
17520
- resolve4(true);
17521
- });
17522
- } catch (e) {
17440
+ const harness = opts.harness ?? "claude-code";
17441
+ const name = resolveAgentBin(harness, opts.claudeBin);
17442
+ if (!name) {
17443
+ log.info("survey", `${harness}: no headless survey for this agent, skipping the survey`);
17444
+ return false;
17445
+ }
17446
+ const bin = resolveBin(name);
17447
+ if (!bin) {
17448
+ log.info("survey", `${harness}: ${name} not found, skipping the survey`);
17449
+ return false;
17450
+ }
17451
+ if (harness === "opencode" && !(opts.opencodeDefinesAgent ?? opencodeCanDefineSurveyAgent)(bin)) {
17452
+ log.info("survey", `${harness}: ${bin} cannot define the survey agent, skipping the survey`);
17453
+ return false;
17454
+ }
17455
+ const plan = buildSurveyPlan(harness, bin, repoDir, {
17456
+ model: opts.model,
17457
+ budgetUsd: opts.budgetUsd,
17458
+ mcpServerPath
17459
+ });
17460
+ const { cfg, bankId } = resolveHostConfig(harness, repoDir);
17461
+ if (cfg.disabled) return false;
17462
+ const key = createHash3("sha256").update(JSON.stringify([cfg.apiUrl.replace(/\/+$/, ""), cfg.apiToken ?? "", bankId])).digest("hex");
17463
+ const leaseDir = opts.lease?.dir ?? join11(tmpdir2(), "hindsight-coding-agent", "surveys");
17464
+ const lease = acquireLease(leaseDir, key, opts.lease?.staleMs ?? LEASE_STALE_MS);
17465
+ if (!lease) return false;
17466
+ const attemptsFile = join11(
17467
+ leaseDir,
17468
+ `attempts-${createHash3("sha256").update(JSON.stringify([key, repoDir])).digest("hex")}.json`
17469
+ );
17470
+ const attempts = opts.sha ? surveyAttempts(attemptsFile, opts.sha) : 0;
17471
+ if (attempts >= SURVEY_MAX_ATTEMPTS) {
17472
+ log.info("survey", `${attempts} surveys already launched at ${opts.sha}, skipping`);
17473
+ releaseLease(lease);
17474
+ return false;
17475
+ }
17476
+ const spec = {
17477
+ lease,
17478
+ bin: plan.bin,
17479
+ args: plan.args,
17480
+ ...opts.lease?.heartbeatMs ? { heartbeatMs: opts.lease.heartbeatMs } : {}
17481
+ };
17482
+ const supervisorPath = opts.supervisorPath ?? join11(dirname7(fileURLToPath4(import.meta.url)), "survey-supervisor.js");
17483
+ return await new Promise((resolve4) => {
17484
+ try {
17485
+ const child = spawnFn("node", [supervisorPath], {
17486
+ cwd: repoDir,
17487
+ detached: true,
17488
+ stdio: "ignore",
17489
+ windowsHide: true,
17490
+ env: { ...plan.env, [SURVEY_SPEC_ENV]: JSON.stringify(spec) }
17491
+ });
17492
+ let spawned = false;
17493
+ child.on("error", (e) => {
17494
+ if (spawned) return;
17523
17495
  log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
17524
17496
  releaseLease(lease);
17525
17497
  resolve4(false);
17526
- }
17527
- });
17528
- }
17498
+ });
17499
+ child.once("spawn", () => {
17500
+ spawned = true;
17501
+ child.unref();
17502
+ if (opts.sha) {
17503
+ try {
17504
+ writeFileSync3(
17505
+ attemptsFile,
17506
+ JSON.stringify({ sha: opts.sha, attempts: attempts + 1 }),
17507
+ { mode: 384 }
17508
+ );
17509
+ } catch {
17510
+ }
17511
+ }
17512
+ resolve4(true);
17513
+ });
17514
+ } catch (e) {
17515
+ log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
17516
+ releaseLease(lease);
17517
+ resolve4(false);
17518
+ }
17519
+ });
17529
17520
  } catch {
17530
17521
  }
17531
17522
  return false;
package/dist/qwen-hook.js CHANGED
@@ -657,7 +657,7 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
657
657
  }
658
658
 
659
659
  // package.json
660
- var version = "0.8.5";
660
+ var version = "0.8.6";
661
661
 
662
662
  // src/core/util.ts
663
663
  import { accessSync, constants, statSync as statSync2 } from "fs";