@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/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.
|
|
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 ?? ((
|
|
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
|
|
17452
|
-
const
|
|
17453
|
-
|
|
17454
|
-
"
|
|
17455
|
-
|
|
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
|
-
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.
|
|
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 ?? ((
|
|
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
|
|
17441
|
-
const
|
|
17442
|
-
|
|
17443
|
-
"
|
|
17444
|
-
|
|
17445
|
-
|
|
17446
|
-
|
|
17447
|
-
|
|
17448
|
-
|
|
17449
|
-
|
|
17450
|
-
|
|
17451
|
-
|
|
17452
|
-
|
|
17453
|
-
|
|
17454
|
-
|
|
17455
|
-
|
|
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
|
-
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/prime-agent.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.
|
|
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 ?? ((
|
|
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
|
|
17441
|
-
const
|
|
17442
|
-
|
|
17443
|
-
"
|
|
17444
|
-
|
|
17445
|
-
|
|
17446
|
-
|
|
17447
|
-
|
|
17448
|
-
|
|
17449
|
-
|
|
17450
|
-
|
|
17451
|
-
|
|
17452
|
-
|
|
17453
|
-
|
|
17454
|
-
|
|
17455
|
-
|
|
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
|
-
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.
|
|
660
|
+
var version = "0.8.6";
|
|
661
661
|
|
|
662
662
|
// src/core/util.ts
|
|
663
663
|
import { accessSync, constants, statSync as statSync2 } from "fs";
|