@vectorize-io/hindsight-coding-agents 0.8.4 → 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 +85 -88
  7. package/dist/claude-stop-hook.js +1 -1
  8. package/dist/cline.js +86 -89
  9. package/dist/codebuddy-hook.js +1 -1
  10. package/dist/codebuddy-sessionstart-hook.js +85 -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 +85 -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 +85 -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 +85 -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 +85 -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 +85 -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 +85 -88
  31. package/dist/droid-stop-hook.js +1 -1
  32. package/dist/dsh.js +86 -89
  33. package/dist/grok-hook.js +1 -1
  34. package/dist/grok-sessionstart-hook.js +85 -88
  35. package/dist/grok-stop-hook.js +1 -1
  36. package/dist/hindsight-seed.js +1 -1
  37. package/dist/index.js +86 -89
  38. package/dist/installer.js +1 -1
  39. package/dist/kilo.js +86 -89
  40. package/dist/kimi-hook.js +1 -1
  41. package/dist/kimi-sessionstart-hook.js +85 -88
  42. package/dist/kimi-stop-hook.js +1 -1
  43. package/dist/mcp-server.js +1 -1
  44. package/dist/opencode2.js +86 -89
  45. package/dist/pi.js +86 -89
  46. package/dist/prime-agent.js +86 -89
  47. package/dist/qwen-hook.js +1 -1
  48. package/dist/qwen-sessionstart-hook.js +85 -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 +85 -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 +85 -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 +85 -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
@@ -633,7 +633,7 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
633
633
  }
634
634
 
635
635
  // package.json
636
- var version = "0.8.4";
636
+ var version = "0.8.6";
637
637
 
638
638
  // src/core/util.ts
639
639
  import { accessSync, constants, statSync as statSync2 } from "fs";
@@ -416,7 +416,7 @@ var PLUGIN_GOVERNED_BANK_FIELDS = [
416
416
  ];
417
417
 
418
418
  // package.json
419
- var version = "0.8.4";
419
+ var version = "0.8.6";
420
420
 
421
421
  // src/core/util.ts
422
422
  import { accessSync, constants, statSync as statSync2 } from "fs";
package/dist/index.js CHANGED
@@ -656,7 +656,7 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
656
656
  }
657
657
 
658
658
  // package.json
659
- var version = "0.8.4";
659
+ var version = "0.8.6";
660
660
 
661
661
  // src/core/util.ts
662
662
  import { accessSync, constants, statSync as statSync2 } from "fs";
@@ -17322,6 +17322,8 @@ function resolveAgentBin(harness, claudeBin) {
17322
17322
  return process.env.HINDSIGHT_ANTIGRAVITY_BIN || "agy";
17323
17323
  case "opencode":
17324
17324
  return process.env.HINDSIGHT_OPENCODE_BIN || "opencode";
17325
+ default:
17326
+ return void 0;
17325
17327
  }
17326
17328
  }
17327
17329
  function opencodeCanDefineSurveyAgent(bin) {
@@ -17350,7 +17352,10 @@ var SURVEY_DISALLOWED_TOOLS = [
17350
17352
  var tomlValue = (value) => stringify({ v: value }).slice("v = ".length).trim();
17351
17353
  function buildSurveyPlan(harness, bin, repoDir, opts) {
17352
17354
  const env = {
17353
- ...process.env,
17355
+ // Terminal managers name the user's pane in env vars and hook the agent's Stop: inherited,
17356
+ // they made the survey's run look like the user's, so Orca closed the pane and Herdr rebound
17357
+ // it to the survey's session (#6075).
17358
+ ...Object.fromEntries(Object.entries(process.env).filter(([k]) => !/^(ORCA|HERDR)_/.test(k))),
17354
17359
  // Anti-recursion: the survey's own agent session must not fire our hooks (session-start,
17355
17360
  // UserPromptSubmit/BeforeAgent, Stop/SessionEnd) or re-seed — see the HINDSIGHT_DISABLE_HOOKS
17356
17361
  // guard in hook.ts / retain-hook.ts / session-start.ts / runtime.ts.
@@ -17444,96 +17449,88 @@ function surveyAttempts(file3, sha) {
17444
17449
  async function startCodebaseSurvey(repoDir, opts = {}) {
17445
17450
  try {
17446
17451
  const spawnFn = opts.spawn ?? realSpawn5;
17447
- const resolveBin = opts.resolveBin ?? ((bin) => binOnPath(bin, { exts: [".exe"] }));
17452
+ const resolveBin = opts.resolveBin ?? ((bin2) => binOnPath(bin2, { exts: [".exe"] }));
17448
17453
  const mcpServerPath = opts.mcpServerPath ?? join11(dirname7(fileURLToPath4(import.meta.url)), "mcp-server.js");
17449
- const preferred = opts.harness ?? "claude-code";
17450
- const order = [
17451
- preferred,
17452
- "claude-code",
17453
- "codex",
17454
- "antigravity-cli",
17455
- "opencode"
17456
- ];
17457
- const seen = /* @__PURE__ */ new Set();
17458
- for (const harness of order) {
17459
- if (seen.has(harness)) continue;
17460
- seen.add(harness);
17461
- const name = resolveAgentBin(harness, opts.claudeBin);
17462
- const bin = resolveBin(name);
17463
- if (!bin) {
17464
- log.info("survey", `${harness}: ${name} not found, trying the next agent`);
17465
- continue;
17466
- }
17467
- if (harness === "opencode" && !(opts.opencodeDefinesAgent ?? opencodeCanDefineSurveyAgent)(bin)) {
17468
- log.info("survey", `${harness}: ${bin} cannot define the survey agent, trying the next`);
17469
- continue;
17470
- }
17471
- const plan = buildSurveyPlan(harness, bin, repoDir, {
17472
- model: opts.model,
17473
- budgetUsd: opts.budgetUsd,
17474
- mcpServerPath
17475
- });
17476
- const { cfg, bankId } = resolveHostConfig(harness, repoDir);
17477
- if (cfg.disabled) return false;
17478
- const key = createHash3("sha256").update(JSON.stringify([cfg.apiUrl.replace(/\/+$/, ""), cfg.apiToken ?? "", bankId])).digest("hex");
17479
- const leaseDir = opts.lease?.dir ?? join11(tmpdir2(), "hindsight-coding-agent", "surveys");
17480
- const lease = acquireLease(leaseDir, key, opts.lease?.staleMs ?? LEASE_STALE_MS);
17481
- if (!lease) return false;
17482
- const attemptsFile = join11(
17483
- leaseDir,
17484
- `attempts-${createHash3("sha256").update(JSON.stringify([key, repoDir])).digest("hex")}.json`
17485
- );
17486
- const attempts = opts.sha ? surveyAttempts(attemptsFile, opts.sha) : 0;
17487
- if (attempts >= SURVEY_MAX_ATTEMPTS) {
17488
- log.info("survey", `${attempts} surveys already launched at ${opts.sha}, skipping`);
17489
- releaseLease(lease);
17490
- return false;
17491
- }
17492
- const spec = {
17493
- lease,
17494
- bin: plan.bin,
17495
- args: plan.args,
17496
- ...opts.lease?.heartbeatMs ? { heartbeatMs: opts.lease.heartbeatMs } : {}
17497
- };
17498
- const supervisorPath = opts.supervisorPath ?? join11(dirname7(fileURLToPath4(import.meta.url)), "survey-supervisor.js");
17499
- return await new Promise((resolve4) => {
17500
- try {
17501
- const child = spawnFn("node", [supervisorPath], {
17502
- cwd: repoDir,
17503
- detached: true,
17504
- stdio: "ignore",
17505
- windowsHide: true,
17506
- env: { ...plan.env, [SURVEY_SPEC_ENV]: JSON.stringify(spec) }
17507
- });
17508
- let spawned = false;
17509
- child.on("error", (e) => {
17510
- if (spawned) return;
17511
- log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
17512
- releaseLease(lease);
17513
- resolve4(false);
17514
- });
17515
- child.once("spawn", () => {
17516
- spawned = true;
17517
- child.unref();
17518
- if (opts.sha) {
17519
- try {
17520
- writeFileSync3(
17521
- attemptsFile,
17522
- JSON.stringify({ sha: opts.sha, attempts: attempts + 1 }),
17523
- { mode: 384 }
17524
- );
17525
- } catch {
17526
- }
17527
- }
17528
- resolve4(true);
17529
- });
17530
- } catch (e) {
17454
+ const harness = opts.harness ?? "claude-code";
17455
+ const name = resolveAgentBin(harness, opts.claudeBin);
17456
+ if (!name) {
17457
+ log.info("survey", `${harness}: no headless survey for this agent, skipping the survey`);
17458
+ return false;
17459
+ }
17460
+ const bin = resolveBin(name);
17461
+ if (!bin) {
17462
+ log.info("survey", `${harness}: ${name} not found, skipping the survey`);
17463
+ return false;
17464
+ }
17465
+ if (harness === "opencode" && !(opts.opencodeDefinesAgent ?? opencodeCanDefineSurveyAgent)(bin)) {
17466
+ log.info("survey", `${harness}: ${bin} cannot define the survey agent, skipping the survey`);
17467
+ return false;
17468
+ }
17469
+ const plan = buildSurveyPlan(harness, bin, repoDir, {
17470
+ model: opts.model,
17471
+ budgetUsd: opts.budgetUsd,
17472
+ mcpServerPath
17473
+ });
17474
+ const { cfg, bankId } = resolveHostConfig(harness, repoDir);
17475
+ if (cfg.disabled) return false;
17476
+ const key = createHash3("sha256").update(JSON.stringify([cfg.apiUrl.replace(/\/+$/, ""), cfg.apiToken ?? "", bankId])).digest("hex");
17477
+ const leaseDir = opts.lease?.dir ?? join11(tmpdir2(), "hindsight-coding-agent", "surveys");
17478
+ const lease = acquireLease(leaseDir, key, opts.lease?.staleMs ?? LEASE_STALE_MS);
17479
+ if (!lease) return false;
17480
+ const attemptsFile = join11(
17481
+ leaseDir,
17482
+ `attempts-${createHash3("sha256").update(JSON.stringify([key, repoDir])).digest("hex")}.json`
17483
+ );
17484
+ const attempts = opts.sha ? surveyAttempts(attemptsFile, opts.sha) : 0;
17485
+ if (attempts >= SURVEY_MAX_ATTEMPTS) {
17486
+ log.info("survey", `${attempts} surveys already launched at ${opts.sha}, skipping`);
17487
+ releaseLease(lease);
17488
+ return false;
17489
+ }
17490
+ const spec = {
17491
+ lease,
17492
+ bin: plan.bin,
17493
+ args: plan.args,
17494
+ ...opts.lease?.heartbeatMs ? { heartbeatMs: opts.lease.heartbeatMs } : {}
17495
+ };
17496
+ const supervisorPath = opts.supervisorPath ?? join11(dirname7(fileURLToPath4(import.meta.url)), "survey-supervisor.js");
17497
+ return await new Promise((resolve4) => {
17498
+ try {
17499
+ const child = spawnFn("node", [supervisorPath], {
17500
+ cwd: repoDir,
17501
+ detached: true,
17502
+ stdio: "ignore",
17503
+ windowsHide: true,
17504
+ env: { ...plan.env, [SURVEY_SPEC_ENV]: JSON.stringify(spec) }
17505
+ });
17506
+ let spawned = false;
17507
+ child.on("error", (e) => {
17508
+ if (spawned) return;
17531
17509
  log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
17532
17510
  releaseLease(lease);
17533
17511
  resolve4(false);
17534
- }
17535
- });
17536
- }
17512
+ });
17513
+ child.once("spawn", () => {
17514
+ spawned = true;
17515
+ child.unref();
17516
+ if (opts.sha) {
17517
+ try {
17518
+ writeFileSync3(
17519
+ attemptsFile,
17520
+ JSON.stringify({ sha: opts.sha, attempts: attempts + 1 }),
17521
+ { mode: 384 }
17522
+ );
17523
+ } catch {
17524
+ }
17525
+ }
17526
+ resolve4(true);
17527
+ });
17528
+ } catch (e) {
17529
+ log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
17530
+ releaseLease(lease);
17531
+ resolve4(false);
17532
+ }
17533
+ });
17537
17534
  } catch {
17538
17535
  }
17539
17536
  return false;
@@ -18911,7 +18908,7 @@ var RuntimeCore = class {
18911
18908
  }
18912
18909
  if (output.context) blocks.push(output.context);
18913
18910
  if (output.notice) {
18914
- const preview = output.notice.replace(/\s+/g, " ").trim().slice(0, 140);
18911
+ const preview = output.notice.replace(/\x1b\[[0-9;]*m/g, "").replace(/\s+/g, " ").trim().slice(0, 140);
18915
18912
  log.info(this.harness, "reflect goal", { preview });
18916
18913
  this.notify?.("Hindsight \xB7 recalled past decisions", preview);
18917
18914
  }
package/dist/installer.js CHANGED
@@ -2217,7 +2217,7 @@ var PAGE_TAXONOMY = [
2217
2217
  var PAGE_NAMES = PAGE_TAXONOMY.map((page) => page.name);
2218
2218
 
2219
2219
  // package.json
2220
- var version = "0.8.4";
2220
+ var version = "0.8.6";
2221
2221
 
2222
2222
  // src/core/util.ts
2223
2223
  import { accessSync, constants, statSync as statSync2 } from "fs";
package/dist/kilo.js CHANGED
@@ -656,7 +656,7 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
656
656
  }
657
657
 
658
658
  // package.json
659
- var version = "0.8.4";
659
+ var version = "0.8.6";
660
660
 
661
661
  // src/core/util.ts
662
662
  import { accessSync, constants, statSync as statSync2 } from "fs";
@@ -17322,6 +17322,8 @@ function resolveAgentBin(harness, claudeBin) {
17322
17322
  return process.env.HINDSIGHT_ANTIGRAVITY_BIN || "agy";
17323
17323
  case "opencode":
17324
17324
  return process.env.HINDSIGHT_OPENCODE_BIN || "opencode";
17325
+ default:
17326
+ return void 0;
17325
17327
  }
17326
17328
  }
17327
17329
  function opencodeCanDefineSurveyAgent(bin) {
@@ -17350,7 +17352,10 @@ var SURVEY_DISALLOWED_TOOLS = [
17350
17352
  var tomlValue = (value) => stringify({ v: value }).slice("v = ".length).trim();
17351
17353
  function buildSurveyPlan(harness, bin, repoDir, opts) {
17352
17354
  const env = {
17353
- ...process.env,
17355
+ // Terminal managers name the user's pane in env vars and hook the agent's Stop: inherited,
17356
+ // they made the survey's run look like the user's, so Orca closed the pane and Herdr rebound
17357
+ // it to the survey's session (#6075).
17358
+ ...Object.fromEntries(Object.entries(process.env).filter(([k]) => !/^(ORCA|HERDR)_/.test(k))),
17354
17359
  // Anti-recursion: the survey's own agent session must not fire our hooks (session-start,
17355
17360
  // UserPromptSubmit/BeforeAgent, Stop/SessionEnd) or re-seed — see the HINDSIGHT_DISABLE_HOOKS
17356
17361
  // guard in hook.ts / retain-hook.ts / session-start.ts / runtime.ts.
@@ -17444,96 +17449,88 @@ function surveyAttempts(file3, sha) {
17444
17449
  async function startCodebaseSurvey(repoDir, opts = {}) {
17445
17450
  try {
17446
17451
  const spawnFn = opts.spawn ?? realSpawn5;
17447
- const resolveBin = opts.resolveBin ?? ((bin) => binOnPath(bin, { exts: [".exe"] }));
17452
+ const resolveBin = opts.resolveBin ?? ((bin2) => binOnPath(bin2, { exts: [".exe"] }));
17448
17453
  const mcpServerPath = opts.mcpServerPath ?? join11(dirname7(fileURLToPath4(import.meta.url)), "mcp-server.js");
17449
- const preferred = opts.harness ?? "claude-code";
17450
- const order = [
17451
- preferred,
17452
- "claude-code",
17453
- "codex",
17454
- "antigravity-cli",
17455
- "opencode"
17456
- ];
17457
- const seen = /* @__PURE__ */ new Set();
17458
- for (const harness of order) {
17459
- if (seen.has(harness)) continue;
17460
- seen.add(harness);
17461
- const name = resolveAgentBin(harness, opts.claudeBin);
17462
- const bin = resolveBin(name);
17463
- if (!bin) {
17464
- log.info("survey", `${harness}: ${name} not found, trying the next agent`);
17465
- continue;
17466
- }
17467
- if (harness === "opencode" && !(opts.opencodeDefinesAgent ?? opencodeCanDefineSurveyAgent)(bin)) {
17468
- log.info("survey", `${harness}: ${bin} cannot define the survey agent, trying the next`);
17469
- continue;
17470
- }
17471
- const plan = buildSurveyPlan(harness, bin, repoDir, {
17472
- model: opts.model,
17473
- budgetUsd: opts.budgetUsd,
17474
- mcpServerPath
17475
- });
17476
- const { cfg, bankId } = resolveHostConfig(harness, repoDir);
17477
- if (cfg.disabled) return false;
17478
- const key = createHash3("sha256").update(JSON.stringify([cfg.apiUrl.replace(/\/+$/, ""), cfg.apiToken ?? "", bankId])).digest("hex");
17479
- const leaseDir = opts.lease?.dir ?? join11(tmpdir2(), "hindsight-coding-agent", "surveys");
17480
- const lease = acquireLease(leaseDir, key, opts.lease?.staleMs ?? LEASE_STALE_MS);
17481
- if (!lease) return false;
17482
- const attemptsFile = join11(
17483
- leaseDir,
17484
- `attempts-${createHash3("sha256").update(JSON.stringify([key, repoDir])).digest("hex")}.json`
17485
- );
17486
- const attempts = opts.sha ? surveyAttempts(attemptsFile, opts.sha) : 0;
17487
- if (attempts >= SURVEY_MAX_ATTEMPTS) {
17488
- log.info("survey", `${attempts} surveys already launched at ${opts.sha}, skipping`);
17489
- releaseLease(lease);
17490
- return false;
17491
- }
17492
- const spec = {
17493
- lease,
17494
- bin: plan.bin,
17495
- args: plan.args,
17496
- ...opts.lease?.heartbeatMs ? { heartbeatMs: opts.lease.heartbeatMs } : {}
17497
- };
17498
- const supervisorPath = opts.supervisorPath ?? join11(dirname7(fileURLToPath4(import.meta.url)), "survey-supervisor.js");
17499
- return await new Promise((resolve4) => {
17500
- try {
17501
- const child = spawnFn("node", [supervisorPath], {
17502
- cwd: repoDir,
17503
- detached: true,
17504
- stdio: "ignore",
17505
- windowsHide: true,
17506
- env: { ...plan.env, [SURVEY_SPEC_ENV]: JSON.stringify(spec) }
17507
- });
17508
- let spawned = false;
17509
- child.on("error", (e) => {
17510
- if (spawned) return;
17511
- log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
17512
- releaseLease(lease);
17513
- resolve4(false);
17514
- });
17515
- child.once("spawn", () => {
17516
- spawned = true;
17517
- child.unref();
17518
- if (opts.sha) {
17519
- try {
17520
- writeFileSync3(
17521
- attemptsFile,
17522
- JSON.stringify({ sha: opts.sha, attempts: attempts + 1 }),
17523
- { mode: 384 }
17524
- );
17525
- } catch {
17526
- }
17527
- }
17528
- resolve4(true);
17529
- });
17530
- } catch (e) {
17454
+ const harness = opts.harness ?? "claude-code";
17455
+ const name = resolveAgentBin(harness, opts.claudeBin);
17456
+ if (!name) {
17457
+ log.info("survey", `${harness}: no headless survey for this agent, skipping the survey`);
17458
+ return false;
17459
+ }
17460
+ const bin = resolveBin(name);
17461
+ if (!bin) {
17462
+ log.info("survey", `${harness}: ${name} not found, skipping the survey`);
17463
+ return false;
17464
+ }
17465
+ if (harness === "opencode" && !(opts.opencodeDefinesAgent ?? opencodeCanDefineSurveyAgent)(bin)) {
17466
+ log.info("survey", `${harness}: ${bin} cannot define the survey agent, skipping the survey`);
17467
+ return false;
17468
+ }
17469
+ const plan = buildSurveyPlan(harness, bin, repoDir, {
17470
+ model: opts.model,
17471
+ budgetUsd: opts.budgetUsd,
17472
+ mcpServerPath
17473
+ });
17474
+ const { cfg, bankId } = resolveHostConfig(harness, repoDir);
17475
+ if (cfg.disabled) return false;
17476
+ const key = createHash3("sha256").update(JSON.stringify([cfg.apiUrl.replace(/\/+$/, ""), cfg.apiToken ?? "", bankId])).digest("hex");
17477
+ const leaseDir = opts.lease?.dir ?? join11(tmpdir2(), "hindsight-coding-agent", "surveys");
17478
+ const lease = acquireLease(leaseDir, key, opts.lease?.staleMs ?? LEASE_STALE_MS);
17479
+ if (!lease) return false;
17480
+ const attemptsFile = join11(
17481
+ leaseDir,
17482
+ `attempts-${createHash3("sha256").update(JSON.stringify([key, repoDir])).digest("hex")}.json`
17483
+ );
17484
+ const attempts = opts.sha ? surveyAttempts(attemptsFile, opts.sha) : 0;
17485
+ if (attempts >= SURVEY_MAX_ATTEMPTS) {
17486
+ log.info("survey", `${attempts} surveys already launched at ${opts.sha}, skipping`);
17487
+ releaseLease(lease);
17488
+ return false;
17489
+ }
17490
+ const spec = {
17491
+ lease,
17492
+ bin: plan.bin,
17493
+ args: plan.args,
17494
+ ...opts.lease?.heartbeatMs ? { heartbeatMs: opts.lease.heartbeatMs } : {}
17495
+ };
17496
+ const supervisorPath = opts.supervisorPath ?? join11(dirname7(fileURLToPath4(import.meta.url)), "survey-supervisor.js");
17497
+ return await new Promise((resolve4) => {
17498
+ try {
17499
+ const child = spawnFn("node", [supervisorPath], {
17500
+ cwd: repoDir,
17501
+ detached: true,
17502
+ stdio: "ignore",
17503
+ windowsHide: true,
17504
+ env: { ...plan.env, [SURVEY_SPEC_ENV]: JSON.stringify(spec) }
17505
+ });
17506
+ let spawned = false;
17507
+ child.on("error", (e) => {
17508
+ if (spawned) return;
17531
17509
  log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
17532
17510
  releaseLease(lease);
17533
17511
  resolve4(false);
17534
- }
17535
- });
17536
- }
17512
+ });
17513
+ child.once("spawn", () => {
17514
+ spawned = true;
17515
+ child.unref();
17516
+ if (opts.sha) {
17517
+ try {
17518
+ writeFileSync3(
17519
+ attemptsFile,
17520
+ JSON.stringify({ sha: opts.sha, attempts: attempts + 1 }),
17521
+ { mode: 384 }
17522
+ );
17523
+ } catch {
17524
+ }
17525
+ }
17526
+ resolve4(true);
17527
+ });
17528
+ } catch (e) {
17529
+ log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
17530
+ releaseLease(lease);
17531
+ resolve4(false);
17532
+ }
17533
+ });
17537
17534
  } catch {
17538
17535
  }
17539
17536
  return false;
@@ -18911,7 +18908,7 @@ var RuntimeCore = class {
18911
18908
  }
18912
18909
  if (output.context) blocks.push(output.context);
18913
18910
  if (output.notice) {
18914
- const preview = output.notice.replace(/\s+/g, " ").trim().slice(0, 140);
18911
+ const preview = output.notice.replace(/\x1b\[[0-9;]*m/g, "").replace(/\s+/g, " ").trim().slice(0, 140);
18915
18912
  log.info(this.harness, "reflect goal", { preview });
18916
18913
  this.notify?.("Hindsight \xB7 recalled past decisions", preview);
18917
18914
  }
package/dist/kimi-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.4";
660
+ var version = "0.8.6";
661
661
 
662
662
  // src/core/util.ts
663
663
  import { accessSync, constants, statSync as statSync2 } from "fs";