@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.
- package/README.md +13 -12
- package/dist/antigravity-hook.js +1 -1
- package/dist/antigravity-statusline.js +1 -1
- package/dist/antigravity-stop-hook.js +1 -1
- package/dist/claude-hook.js +1 -1
- package/dist/claude-sessionstart-hook.js +79 -88
- package/dist/claude-stop-hook.js +1 -1
- package/dist/cline.js +79 -88
- package/dist/codebuddy-hook.js +1 -1
- package/dist/codebuddy-sessionstart-hook.js +79 -88
- package/dist/codebuddy-stop-hook.js +1 -1
- package/dist/codex-hook.js +1 -1
- package/dist/codex-sessionstart-hook.js +79 -88
- package/dist/codex-stop-hook.js +1 -1
- package/dist/copilot-hook.js +1 -1
- package/dist/copilot-sessionstart-hook.js +79 -88
- package/dist/copilot-stop-hook.js +1 -1
- package/dist/cursor-hook.js +1 -1
- package/dist/cursor-sessionstart-hook.js +79 -88
- package/dist/cursor-stop-hook.js +1 -1
- package/dist/daemon-start.js +1 -1
- package/dist/dcode-hook.js +1 -1
- package/dist/dcode-sessionstart-hook.js +79 -88
- package/dist/dcode-stop-hook.js +1 -1
- package/dist/deepen.js +1 -1
- package/dist/devin-hook.js +1 -1
- package/dist/devin-sessionstart-hook.js +79 -88
- package/dist/devin-stop-hook.js +1 -1
- package/dist/droid-hook.js +1 -1
- package/dist/droid-sessionstart-hook.js +79 -88
- package/dist/droid-stop-hook.js +1 -1
- package/dist/dsh.js +79 -88
- package/dist/grok-hook.js +1 -1
- package/dist/grok-sessionstart-hook.js +79 -88
- package/dist/grok-stop-hook.js +1 -1
- package/dist/hindsight-seed.js +1 -1
- package/dist/index.js +79 -88
- package/dist/installer.js +1 -1
- package/dist/kilo.js +79 -88
- package/dist/kimi-hook.js +1 -1
- package/dist/kimi-sessionstart-hook.js +79 -88
- package/dist/kimi-stop-hook.js +1 -1
- package/dist/mcp-server.js +1 -1
- package/dist/opencode2.js +79 -88
- package/dist/pi.js +79 -88
- package/dist/prime-agent.js +79 -88
- package/dist/qwen-hook.js +1 -1
- package/dist/qwen-sessionstart-hook.js +79 -88
- package/dist/qwen-stop-hook.js +1 -1
- package/dist/status.js +1 -1
- package/dist/traecode-hook.js +1 -1
- package/dist/traecode-sessionstart-hook.js +79 -88
- package/dist/traecode-stop-hook.js +1 -1
- package/dist/workbuddy-hook.js +1 -1
- package/dist/workbuddy-sessionstart-hook.js +79 -88
- package/dist/workbuddy-stop-hook.js +1 -1
- package/dist/zcode-hook.js +1 -1
- package/dist/zcode-sessionstart-hook.js +79 -88
- package/dist/zcode-stop-hook.js +1 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/skill/SKILL.md +3 -3
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.
|
|
659
|
+
var version = "0.8.6";
|
|
660
660
|
|
|
661
661
|
// src/core/util.ts
|
|
662
662
|
import { accessSync, constants, statSync as statSync2 } from "fs";
|
|
@@ -17449,97 +17449,88 @@ function surveyAttempts(file3, sha) {
|
|
|
17449
17449
|
async function startCodebaseSurvey(repoDir, opts = {}) {
|
|
17450
17450
|
try {
|
|
17451
17451
|
const spawnFn = opts.spawn ?? realSpawn5;
|
|
17452
|
-
const resolveBin = opts.resolveBin ?? ((
|
|
17452
|
+
const resolveBin = opts.resolveBin ?? ((bin2) => binOnPath(bin2, { exts: [".exe"] }));
|
|
17453
17453
|
const mcpServerPath = opts.mcpServerPath ?? join11(dirname7(fileURLToPath4(import.meta.url)), "mcp-server.js");
|
|
17454
|
-
const
|
|
17455
|
-
const
|
|
17456
|
-
|
|
17457
|
-
"
|
|
17458
|
-
|
|
17459
|
-
|
|
17460
|
-
|
|
17461
|
-
|
|
17462
|
-
|
|
17463
|
-
|
|
17464
|
-
|
|
17465
|
-
|
|
17466
|
-
|
|
17467
|
-
|
|
17468
|
-
|
|
17469
|
-
|
|
17470
|
-
|
|
17471
|
-
|
|
17472
|
-
|
|
17473
|
-
|
|
17474
|
-
|
|
17475
|
-
|
|
17476
|
-
|
|
17477
|
-
|
|
17478
|
-
|
|
17479
|
-
|
|
17480
|
-
|
|
17481
|
-
|
|
17482
|
-
|
|
17483
|
-
|
|
17484
|
-
|
|
17485
|
-
|
|
17486
|
-
|
|
17487
|
-
|
|
17488
|
-
|
|
17489
|
-
|
|
17490
|
-
|
|
17491
|
-
|
|
17492
|
-
|
|
17493
|
-
|
|
17494
|
-
|
|
17495
|
-
|
|
17496
|
-
|
|
17497
|
-
|
|
17498
|
-
|
|
17499
|
-
|
|
17500
|
-
|
|
17501
|
-
|
|
17502
|
-
|
|
17503
|
-
|
|
17504
|
-
|
|
17505
|
-
|
|
17506
|
-
|
|
17507
|
-
|
|
17508
|
-
|
|
17509
|
-
detached: true,
|
|
17510
|
-
stdio: "ignore",
|
|
17511
|
-
windowsHide: true,
|
|
17512
|
-
env: { ...plan.env, [SURVEY_SPEC_ENV]: JSON.stringify(spec) }
|
|
17513
|
-
});
|
|
17514
|
-
let spawned = false;
|
|
17515
|
-
child.on("error", (e) => {
|
|
17516
|
-
if (spawned) return;
|
|
17517
|
-
log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
|
|
17518
|
-
releaseLease(lease);
|
|
17519
|
-
resolve4(false);
|
|
17520
|
-
});
|
|
17521
|
-
child.once("spawn", () => {
|
|
17522
|
-
spawned = true;
|
|
17523
|
-
child.unref();
|
|
17524
|
-
if (opts.sha) {
|
|
17525
|
-
try {
|
|
17526
|
-
writeFileSync3(
|
|
17527
|
-
attemptsFile,
|
|
17528
|
-
JSON.stringify({ sha: opts.sha, attempts: attempts + 1 }),
|
|
17529
|
-
{ mode: 384 }
|
|
17530
|
-
);
|
|
17531
|
-
} catch {
|
|
17532
|
-
}
|
|
17533
|
-
}
|
|
17534
|
-
resolve4(true);
|
|
17535
|
-
});
|
|
17536
|
-
} 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;
|
|
17537
17509
|
log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
|
|
17538
17510
|
releaseLease(lease);
|
|
17539
17511
|
resolve4(false);
|
|
17540
|
-
}
|
|
17541
|
-
|
|
17542
|
-
|
|
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
|
+
});
|
|
17543
17534
|
} catch {
|
|
17544
17535
|
}
|
|
17545
17536
|
return false;
|
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.
|
|
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.
|
|
659
|
+
var version = "0.8.6";
|
|
660
660
|
|
|
661
661
|
// src/core/util.ts
|
|
662
662
|
import { accessSync, constants, statSync as statSync2 } from "fs";
|
|
@@ -17449,97 +17449,88 @@ function surveyAttempts(file3, sha) {
|
|
|
17449
17449
|
async function startCodebaseSurvey(repoDir, opts = {}) {
|
|
17450
17450
|
try {
|
|
17451
17451
|
const spawnFn = opts.spawn ?? realSpawn5;
|
|
17452
|
-
const resolveBin = opts.resolveBin ?? ((
|
|
17452
|
+
const resolveBin = opts.resolveBin ?? ((bin2) => binOnPath(bin2, { exts: [".exe"] }));
|
|
17453
17453
|
const mcpServerPath = opts.mcpServerPath ?? join11(dirname7(fileURLToPath4(import.meta.url)), "mcp-server.js");
|
|
17454
|
-
const
|
|
17455
|
-
const
|
|
17456
|
-
|
|
17457
|
-
"
|
|
17458
|
-
|
|
17459
|
-
|
|
17460
|
-
|
|
17461
|
-
|
|
17462
|
-
|
|
17463
|
-
|
|
17464
|
-
|
|
17465
|
-
|
|
17466
|
-
|
|
17467
|
-
|
|
17468
|
-
|
|
17469
|
-
|
|
17470
|
-
|
|
17471
|
-
|
|
17472
|
-
|
|
17473
|
-
|
|
17474
|
-
|
|
17475
|
-
|
|
17476
|
-
|
|
17477
|
-
|
|
17478
|
-
|
|
17479
|
-
|
|
17480
|
-
|
|
17481
|
-
|
|
17482
|
-
|
|
17483
|
-
|
|
17484
|
-
|
|
17485
|
-
|
|
17486
|
-
|
|
17487
|
-
|
|
17488
|
-
|
|
17489
|
-
|
|
17490
|
-
|
|
17491
|
-
|
|
17492
|
-
|
|
17493
|
-
|
|
17494
|
-
|
|
17495
|
-
|
|
17496
|
-
|
|
17497
|
-
|
|
17498
|
-
|
|
17499
|
-
|
|
17500
|
-
|
|
17501
|
-
|
|
17502
|
-
|
|
17503
|
-
|
|
17504
|
-
|
|
17505
|
-
|
|
17506
|
-
|
|
17507
|
-
|
|
17508
|
-
|
|
17509
|
-
detached: true,
|
|
17510
|
-
stdio: "ignore",
|
|
17511
|
-
windowsHide: true,
|
|
17512
|
-
env: { ...plan.env, [SURVEY_SPEC_ENV]: JSON.stringify(spec) }
|
|
17513
|
-
});
|
|
17514
|
-
let spawned = false;
|
|
17515
|
-
child.on("error", (e) => {
|
|
17516
|
-
if (spawned) return;
|
|
17517
|
-
log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
|
|
17518
|
-
releaseLease(lease);
|
|
17519
|
-
resolve4(false);
|
|
17520
|
-
});
|
|
17521
|
-
child.once("spawn", () => {
|
|
17522
|
-
spawned = true;
|
|
17523
|
-
child.unref();
|
|
17524
|
-
if (opts.sha) {
|
|
17525
|
-
try {
|
|
17526
|
-
writeFileSync3(
|
|
17527
|
-
attemptsFile,
|
|
17528
|
-
JSON.stringify({ sha: opts.sha, attempts: attempts + 1 }),
|
|
17529
|
-
{ mode: 384 }
|
|
17530
|
-
);
|
|
17531
|
-
} catch {
|
|
17532
|
-
}
|
|
17533
|
-
}
|
|
17534
|
-
resolve4(true);
|
|
17535
|
-
});
|
|
17536
|
-
} 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;
|
|
17537
17509
|
log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
|
|
17538
17510
|
releaseLease(lease);
|
|
17539
17511
|
resolve4(false);
|
|
17540
|
-
}
|
|
17541
|
-
|
|
17542
|
-
|
|
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
|
+
});
|
|
17543
17534
|
} catch {
|
|
17544
17535
|
}
|
|
17545
17536
|
return false;
|
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.
|
|
660
|
+
var version = "0.8.6";
|
|
661
661
|
|
|
662
662
|
// src/core/util.ts
|
|
663
663
|
import { accessSync, constants, statSync as statSync2 } from "fs";
|
|
@@ -673,7 +673,7 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
|
|
|
673
673
|
}
|
|
674
674
|
|
|
675
675
|
// package.json
|
|
676
|
-
var version = "0.8.
|
|
676
|
+
var version = "0.8.6";
|
|
677
677
|
|
|
678
678
|
// src/core/util.ts
|
|
679
679
|
import { accessSync, constants, statSync as statSync2 } from "fs";
|
|
@@ -2864,97 +2864,88 @@ function surveyAttempts(file, sha) {
|
|
|
2864
2864
|
async function startCodebaseSurvey(repoDir, opts = {}) {
|
|
2865
2865
|
try {
|
|
2866
2866
|
const spawnFn = opts.spawn ?? realSpawn4;
|
|
2867
|
-
const resolveBin = opts.resolveBin ?? ((
|
|
2867
|
+
const resolveBin = opts.resolveBin ?? ((bin2) => binOnPath(bin2, { exts: [".exe"] }));
|
|
2868
2868
|
const mcpServerPath = opts.mcpServerPath ?? join13(dirname8(fileURLToPath3(import.meta.url)), "mcp-server.js");
|
|
2869
|
-
const
|
|
2870
|
-
const
|
|
2871
|
-
|
|
2872
|
-
"
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
detached: true,
|
|
2925
|
-
stdio: "ignore",
|
|
2926
|
-
windowsHide: true,
|
|
2927
|
-
env: { ...plan.env, [SURVEY_SPEC_ENV]: JSON.stringify(spec) }
|
|
2928
|
-
});
|
|
2929
|
-
let spawned = false;
|
|
2930
|
-
child.on("error", (e) => {
|
|
2931
|
-
if (spawned) return;
|
|
2932
|
-
log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
|
|
2933
|
-
releaseLease(lease);
|
|
2934
|
-
resolve4(false);
|
|
2935
|
-
});
|
|
2936
|
-
child.once("spawn", () => {
|
|
2937
|
-
spawned = true;
|
|
2938
|
-
child.unref();
|
|
2939
|
-
if (opts.sha) {
|
|
2940
|
-
try {
|
|
2941
|
-
writeFileSync3(
|
|
2942
|
-
attemptsFile,
|
|
2943
|
-
JSON.stringify({ sha: opts.sha, attempts: attempts + 1 }),
|
|
2944
|
-
{ mode: 384 }
|
|
2945
|
-
);
|
|
2946
|
-
} catch {
|
|
2947
|
-
}
|
|
2948
|
-
}
|
|
2949
|
-
resolve4(true);
|
|
2950
|
-
});
|
|
2951
|
-
} catch (e) {
|
|
2869
|
+
const harness = opts.harness ?? "claude-code";
|
|
2870
|
+
const name = resolveAgentBin(harness, opts.claudeBin);
|
|
2871
|
+
if (!name) {
|
|
2872
|
+
log.info("survey", `${harness}: no headless survey for this agent, skipping the survey`);
|
|
2873
|
+
return false;
|
|
2874
|
+
}
|
|
2875
|
+
const bin = resolveBin(name);
|
|
2876
|
+
if (!bin) {
|
|
2877
|
+
log.info("survey", `${harness}: ${name} not found, skipping the survey`);
|
|
2878
|
+
return false;
|
|
2879
|
+
}
|
|
2880
|
+
if (harness === "opencode" && !(opts.opencodeDefinesAgent ?? opencodeCanDefineSurveyAgent)(bin)) {
|
|
2881
|
+
log.info("survey", `${harness}: ${bin} cannot define the survey agent, skipping the survey`);
|
|
2882
|
+
return false;
|
|
2883
|
+
}
|
|
2884
|
+
const plan = buildSurveyPlan(harness, bin, repoDir, {
|
|
2885
|
+
model: opts.model,
|
|
2886
|
+
budgetUsd: opts.budgetUsd,
|
|
2887
|
+
mcpServerPath
|
|
2888
|
+
});
|
|
2889
|
+
const { cfg, bankId } = resolveHostConfig(harness, repoDir);
|
|
2890
|
+
if (cfg.disabled) return false;
|
|
2891
|
+
const key = createHash4("sha256").update(JSON.stringify([cfg.apiUrl.replace(/\/+$/, ""), cfg.apiToken ?? "", bankId])).digest("hex");
|
|
2892
|
+
const leaseDir = opts.lease?.dir ?? join13(tmpdir3(), "hindsight-coding-agent", "surveys");
|
|
2893
|
+
const lease = acquireLease(leaseDir, key, opts.lease?.staleMs ?? LEASE_STALE_MS);
|
|
2894
|
+
if (!lease) return false;
|
|
2895
|
+
const attemptsFile = join13(
|
|
2896
|
+
leaseDir,
|
|
2897
|
+
`attempts-${createHash4("sha256").update(JSON.stringify([key, repoDir])).digest("hex")}.json`
|
|
2898
|
+
);
|
|
2899
|
+
const attempts = opts.sha ? surveyAttempts(attemptsFile, opts.sha) : 0;
|
|
2900
|
+
if (attempts >= SURVEY_MAX_ATTEMPTS) {
|
|
2901
|
+
log.info("survey", `${attempts} surveys already launched at ${opts.sha}, skipping`);
|
|
2902
|
+
releaseLease(lease);
|
|
2903
|
+
return false;
|
|
2904
|
+
}
|
|
2905
|
+
const spec = {
|
|
2906
|
+
lease,
|
|
2907
|
+
bin: plan.bin,
|
|
2908
|
+
args: plan.args,
|
|
2909
|
+
...opts.lease?.heartbeatMs ? { heartbeatMs: opts.lease.heartbeatMs } : {}
|
|
2910
|
+
};
|
|
2911
|
+
const supervisorPath = opts.supervisorPath ?? join13(dirname8(fileURLToPath3(import.meta.url)), "survey-supervisor.js");
|
|
2912
|
+
return await new Promise((resolve4) => {
|
|
2913
|
+
try {
|
|
2914
|
+
const child = spawnFn("node", [supervisorPath], {
|
|
2915
|
+
cwd: repoDir,
|
|
2916
|
+
detached: true,
|
|
2917
|
+
stdio: "ignore",
|
|
2918
|
+
windowsHide: true,
|
|
2919
|
+
env: { ...plan.env, [SURVEY_SPEC_ENV]: JSON.stringify(spec) }
|
|
2920
|
+
});
|
|
2921
|
+
let spawned = false;
|
|
2922
|
+
child.on("error", (e) => {
|
|
2923
|
+
if (spawned) return;
|
|
2952
2924
|
log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
|
|
2953
2925
|
releaseLease(lease);
|
|
2954
2926
|
resolve4(false);
|
|
2955
|
-
}
|
|
2956
|
-
|
|
2957
|
-
|
|
2927
|
+
});
|
|
2928
|
+
child.once("spawn", () => {
|
|
2929
|
+
spawned = true;
|
|
2930
|
+
child.unref();
|
|
2931
|
+
if (opts.sha) {
|
|
2932
|
+
try {
|
|
2933
|
+
writeFileSync3(
|
|
2934
|
+
attemptsFile,
|
|
2935
|
+
JSON.stringify({ sha: opts.sha, attempts: attempts + 1 }),
|
|
2936
|
+
{ mode: 384 }
|
|
2937
|
+
);
|
|
2938
|
+
} catch {
|
|
2939
|
+
}
|
|
2940
|
+
}
|
|
2941
|
+
resolve4(true);
|
|
2942
|
+
});
|
|
2943
|
+
} catch (e) {
|
|
2944
|
+
log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
|
|
2945
|
+
releaseLease(lease);
|
|
2946
|
+
resolve4(false);
|
|
2947
|
+
}
|
|
2948
|
+
});
|
|
2958
2949
|
} catch {
|
|
2959
2950
|
}
|
|
2960
2951
|
return false;
|
package/dist/kimi-stop-hook.js
CHANGED
|
@@ -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.
|
|
636
|
+
var version = "0.8.6";
|
|
637
637
|
|
|
638
638
|
// src/core/util.ts
|
|
639
639
|
import { accessSync, constants, statSync as statSync2 } from "fs";
|
package/dist/mcp-server.js
CHANGED
|
@@ -32025,7 +32025,7 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
|
|
|
32025
32025
|
}
|
|
32026
32026
|
|
|
32027
32027
|
// package.json
|
|
32028
|
-
var version2 = "0.8.
|
|
32028
|
+
var version2 = "0.8.6";
|
|
32029
32029
|
|
|
32030
32030
|
// src/core/util.ts
|
|
32031
32031
|
import { accessSync, constants, statSync as statSync2 } from "fs";
|