haansi 0.1.112 → 0.1.114
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/haansi.js +228 -19
- package/package.json +1 -1
package/dist/haansi.js
CHANGED
|
@@ -95,7 +95,7 @@ var require_package = __commonJS({
|
|
|
95
95
|
"package.json"(exports2, module2) {
|
|
96
96
|
module2.exports = {
|
|
97
97
|
name: "haansi",
|
|
98
|
-
version: "0.1.
|
|
98
|
+
version: "0.1.114",
|
|
99
99
|
description: "Haansi CLI - Session collector and MCP server for Claude Code & OpenAI Codex",
|
|
100
100
|
bin: {
|
|
101
101
|
haansi: "./dist/haansi.js"
|
|
@@ -19663,6 +19663,42 @@ var init_exclusions = __esm({
|
|
|
19663
19663
|
"owner/repo, as in repo_conventions; unique with the org."
|
|
19664
19664
|
]
|
|
19665
19665
|
}),
|
|
19666
|
+
...exchangeExclusions(INTEL, "repo_convention_proposal_runs", {
|
|
19667
|
+
repository: [
|
|
19668
|
+
"join-key",
|
|
19669
|
+
"owner/repo a run was asked for, as in repo_conventions; NULL for the daily run."
|
|
19670
|
+
],
|
|
19671
|
+
trigger: ["operational", "Closed CHECK vocabulary (schedule, request)."],
|
|
19672
|
+
skipped_reason: [
|
|
19673
|
+
"operational",
|
|
19674
|
+
"Closed CHECK vocabulary (no_model, no_github)."
|
|
19675
|
+
]
|
|
19676
|
+
}),
|
|
19677
|
+
...exchangeExclusions(INTEL, "repo_convention_proposal_inputs", {
|
|
19678
|
+
repository: [
|
|
19679
|
+
"join-key",
|
|
19680
|
+
"owner/repo, as in repo_conventions; the primary key with the org."
|
|
19681
|
+
],
|
|
19682
|
+
input_key: [
|
|
19683
|
+
"not-personal",
|
|
19684
|
+
"sha256 hex of an input's name (file path, or CI check and target); no plaintext."
|
|
19685
|
+
],
|
|
19686
|
+
fingerprint: [
|
|
19687
|
+
"not-personal",
|
|
19688
|
+
"sha256 hex of what was sent to the model, or the commit SHA last read; no plaintext."
|
|
19689
|
+
]
|
|
19690
|
+
}),
|
|
19691
|
+
...exchangeExclusions(INTEL, "repo_convention_checks", {
|
|
19692
|
+
repository: [
|
|
19693
|
+
"join-key",
|
|
19694
|
+
"owner/repo the check covered, as in repo_conventions; matched by equality."
|
|
19695
|
+
],
|
|
19696
|
+
trigger: ["operational", "Closed CHECK vocabulary (schedule, request)."],
|
|
19697
|
+
skipped_reason: [
|
|
19698
|
+
"operational",
|
|
19699
|
+
"Closed CHECK vocabulary (no_model, no_github)."
|
|
19700
|
+
]
|
|
19701
|
+
}),
|
|
19666
19702
|
...exchangeExclusions(INTEL, "attempt_rule_configs", {
|
|
19667
19703
|
config: [
|
|
19668
19704
|
"operational",
|
|
@@ -26935,6 +26971,26 @@ var init_table_registry = __esm({
|
|
|
26935
26971
|
entry("intelligence", INTELLIGENCE_DB, "repo_convention_skills", "direct", {
|
|
26936
26972
|
scopingColumn: "organization_id"
|
|
26937
26973
|
}),
|
|
26974
|
+
// The proposer's runs and what it last sent per input (repo-conventions/004).
|
|
26975
|
+
entry(
|
|
26976
|
+
"intelligence",
|
|
26977
|
+
INTELLIGENCE_DB,
|
|
26978
|
+
"repo_convention_proposal_runs",
|
|
26979
|
+
"direct",
|
|
26980
|
+
{ scopingColumn: "organization_id" }
|
|
26981
|
+
),
|
|
26982
|
+
entry(
|
|
26983
|
+
"intelligence",
|
|
26984
|
+
INTELLIGENCE_DB,
|
|
26985
|
+
"repo_convention_proposal_inputs",
|
|
26986
|
+
"direct",
|
|
26987
|
+
{ scopingColumn: "organization_id" }
|
|
26988
|
+
),
|
|
26989
|
+
// Freshness checks of a repository's approved conventions
|
|
26990
|
+
// (repo-conventions/005).
|
|
26991
|
+
entry("intelligence", INTELLIGENCE_DB, "repo_convention_checks", "direct", {
|
|
26992
|
+
scopingColumn: "organization_id"
|
|
26993
|
+
}),
|
|
26938
26994
|
// "Mine more tasks" requests the outcome ledger polls (outcome-ledger/058).
|
|
26939
26995
|
entry("intelligence", INTELLIGENCE_DB, "replay_mining_requests", "direct", {
|
|
26940
26996
|
scopingColumn: "organization_id"
|
|
@@ -86726,6 +86782,9 @@ function unreachable(checks) {
|
|
|
86726
86782
|
const down = checks.filter((c) => !c.ok);
|
|
86727
86783
|
return down.length ? down.map((c) => `${c.name} (${c.reason ?? "no answer"})`).join(", ") : null;
|
|
86728
86784
|
}
|
|
86785
|
+
function agentLoadsMachineServers(agentCmd) {
|
|
86786
|
+
return /(^|[\s/"'])claude(\s|$)/.test(agentCmd) && !/--strict-mcp-config(?![\w-])/.test(agentCmd);
|
|
86787
|
+
}
|
|
86729
86788
|
function agentCannotCallHaansi(agentCmd) {
|
|
86730
86789
|
if (!/(^|[\s/"'])claude(\s|$)/.test(agentCmd)) return null;
|
|
86731
86790
|
if (/--dangerously-skip-permissions|bypassPermissions/.test(agentCmd))
|
|
@@ -87075,6 +87134,11 @@ function haansiServersDown(output) {
|
|
|
87075
87134
|
if (!servers) return null;
|
|
87076
87135
|
return servers.filter((s) => s.name.startsWith("haansi-") && s.status !== "connected").map((s) => `${s.name}: ${s.status}`);
|
|
87077
87136
|
}
|
|
87137
|
+
function haansiServersLoaded(output) {
|
|
87138
|
+
const servers = mcpServersOf(output);
|
|
87139
|
+
if (!servers) return null;
|
|
87140
|
+
return servers.filter((s) => s.name.startsWith("haansi-") && s.status === "connected").map((s) => s.name);
|
|
87141
|
+
}
|
|
87078
87142
|
function agentFailureLines(output, max2, scrub) {
|
|
87079
87143
|
const out = [];
|
|
87080
87144
|
for (const raw of output.trim().split(/\r?\n/)) {
|
|
@@ -88032,6 +88096,11 @@ function renderTemplate(template, vars) {
|
|
|
88032
88096
|
function judgeChange(diff) {
|
|
88033
88097
|
return clip(diff, MAX_CHANGE_CHARS);
|
|
88034
88098
|
}
|
|
88099
|
+
function baselineText(baseline) {
|
|
88100
|
+
if (baseline === null || baseline === void 0)
|
|
88101
|
+
return "(not run alongside this one: judge from the material and the change alone)";
|
|
88102
|
+
return baseline || "(it changed nothing)";
|
|
88103
|
+
}
|
|
88035
88104
|
function parseJudgement(text, returnedIds) {
|
|
88036
88105
|
const match = /\{[\s\S]*\}/.exec(text);
|
|
88037
88106
|
if (!match) return null;
|
|
@@ -88095,6 +88164,8 @@ async function judgeUse(deps, input) {
|
|
|
88095
88164
|
task: input.card,
|
|
88096
88165
|
returned: clip(returned || "(only ids came back)", returnedChars),
|
|
88097
88166
|
change: clip(input.change || "(no change)", changeChars),
|
|
88167
|
+
// Shares the change's budget: they are read side by side.
|
|
88168
|
+
baseline: clip(baselineText(input.baseline), changeChars),
|
|
88098
88169
|
verdict_file: verdictFile
|
|
88099
88170
|
})
|
|
88100
88171
|
].join("\n"),
|
|
@@ -88529,7 +88600,7 @@ function typeEnd(text, i, stops, bodyBrace) {
|
|
|
88529
88600
|
return text.length;
|
|
88530
88601
|
}
|
|
88531
88602
|
function capSignature(text) {
|
|
88532
|
-
const lines = text.trim().split("\n").map((l) => l.replace(/\s+$/, ""));
|
|
88603
|
+
const lines = text.trim().split("\n").map((l) => l.replace(/\s+$/, "")).filter((l) => l !== "");
|
|
88533
88604
|
let out = lines.slice(0, MAX_SIGNATURE_LINES).join("\n");
|
|
88534
88605
|
let cut2 = lines.length > MAX_SIGNATURE_LINES;
|
|
88535
88606
|
if (out.length > MAX_SIGNATURE_CHARS) {
|
|
@@ -88574,7 +88645,7 @@ function signatureOf(source, name) {
|
|
|
88574
88645
|
}
|
|
88575
88646
|
return capSignature(text.slice(start, end));
|
|
88576
88647
|
}
|
|
88577
|
-
const type = new RegExp(`${lead}(type\\s+${n})\\b`).exec(text);
|
|
88648
|
+
const type = new RegExp(`${lead}(type\\s+${n})\\b(?=\\s*[=<])`).exec(text);
|
|
88578
88649
|
if (type) {
|
|
88579
88650
|
const start = type.index + type[0].length - type[2].length - type[1].length;
|
|
88580
88651
|
const end = typeEnd(text, type.index + type[0].length, ";", false);
|
|
@@ -89115,6 +89186,73 @@ var init_replay_lang = __esm({
|
|
|
89115
89186
|
}
|
|
89116
89187
|
});
|
|
89117
89188
|
|
|
89189
|
+
// src/commands/replay-spec-gaps.ts
|
|
89190
|
+
function testKeysOf(source, path2) {
|
|
89191
|
+
const lang = adapterFor(path2);
|
|
89192
|
+
if (!lang) return [];
|
|
89193
|
+
const out = /* @__PURE__ */ new Set();
|
|
89194
|
+
const add = (re) => {
|
|
89195
|
+
for (const m of source.matchAll(re)) out.add(m[1]);
|
|
89196
|
+
};
|
|
89197
|
+
if (lang.id === "js") {
|
|
89198
|
+
add(new RegExp(String.raw`[{,]\s*(${IDENT3})\s*\??:`, "g"));
|
|
89199
|
+
} else {
|
|
89200
|
+
add(new RegExp(String.raw`[(,]\s*(${IDENT3})\s*=(?!=)`, "g"));
|
|
89201
|
+
add(new RegExp(String.raw`["'](${IDENT3})["']\s*:`, "g"));
|
|
89202
|
+
}
|
|
89203
|
+
add(
|
|
89204
|
+
new RegExp(String.raw`(?<!(?:^|[^A-Za-z0-9_$])[0-9]+)\.\s*(${IDENT3})`, "g")
|
|
89205
|
+
);
|
|
89206
|
+
return [...out];
|
|
89207
|
+
}
|
|
89208
|
+
function wordsOf2(text) {
|
|
89209
|
+
return new Set(text.match(new RegExp(IDENT3, "g")) ?? []);
|
|
89210
|
+
}
|
|
89211
|
+
async function specGapsOf(show, grep, task, prompt2) {
|
|
89212
|
+
const shown = wordsOf2(prompt2);
|
|
89213
|
+
const candidates = /* @__PURE__ */ new Set();
|
|
89214
|
+
for (const file2 of task.testFiles) {
|
|
89215
|
+
const source = await show(task.targetSha, file2);
|
|
89216
|
+
if (source === null) continue;
|
|
89217
|
+
for (const key of testKeysOf(source, file2))
|
|
89218
|
+
if (!shown.has(key)) candidates.add(key);
|
|
89219
|
+
}
|
|
89220
|
+
const asked = [...candidates].sort().slice(0, MAX_GAP_CANDIDATES);
|
|
89221
|
+
if (!asked.length) return [];
|
|
89222
|
+
const found = await grep(task.baseSha, asked);
|
|
89223
|
+
return asked.filter((n) => !found.has(n)).slice(0, MAX_GAPS);
|
|
89224
|
+
}
|
|
89225
|
+
function gitGrepNames(run3) {
|
|
89226
|
+
return async (sha, names) => {
|
|
89227
|
+
const found = /* @__PURE__ */ new Set();
|
|
89228
|
+
for (const name of names) {
|
|
89229
|
+
const res = await run3([
|
|
89230
|
+
"grep",
|
|
89231
|
+
"-q",
|
|
89232
|
+
"-w",
|
|
89233
|
+
"-I",
|
|
89234
|
+
"-F",
|
|
89235
|
+
"-e",
|
|
89236
|
+
name,
|
|
89237
|
+
sha,
|
|
89238
|
+
"--"
|
|
89239
|
+
]).catch(() => null);
|
|
89240
|
+
if (!res || res.code !== 1) found.add(name);
|
|
89241
|
+
}
|
|
89242
|
+
return found;
|
|
89243
|
+
};
|
|
89244
|
+
}
|
|
89245
|
+
var MAX_GAP_CANDIDATES, MAX_GAPS, IDENT3;
|
|
89246
|
+
var init_replay_spec_gaps = __esm({
|
|
89247
|
+
"src/commands/replay-spec-gaps.ts"() {
|
|
89248
|
+
"use strict";
|
|
89249
|
+
init_replay_lang();
|
|
89250
|
+
MAX_GAP_CANDIDATES = 200;
|
|
89251
|
+
MAX_GAPS = 20;
|
|
89252
|
+
IDENT3 = String.raw`[A-Za-z_][A-Za-z0-9_]*`;
|
|
89253
|
+
}
|
|
89254
|
+
});
|
|
89255
|
+
|
|
89118
89256
|
// src/commands/replay-interface.ts
|
|
89119
89257
|
async function firstAt(show, sha, paths) {
|
|
89120
89258
|
for (const path2 of paths) {
|
|
@@ -89197,16 +89335,25 @@ function interfaceSection(entries) {
|
|
|
89197
89335
|
];
|
|
89198
89336
|
const where = `\`${e.path}\`${e.newFile ? " (a new file)" : ""}`;
|
|
89199
89337
|
const declared = e.names.filter((n) => e.signatures?.[n]);
|
|
89338
|
+
const types2 = Object.entries(e.types ?? {});
|
|
89339
|
+
const fence = adapterFor(e.path)?.fence ?? "ts";
|
|
89200
89340
|
return [
|
|
89201
89341
|
`- ${where}${what.length ? `: ${what.join(", ")}` : ""}`,
|
|
89202
89342
|
// As the target declares each: its shape, never its body.
|
|
89203
89343
|
...declared.flatMap((n) => [
|
|
89204
89344
|
"",
|
|
89205
|
-
...fenced(e.signatures[n],
|
|
89206
|
-
(l) => ` ${l}`
|
|
89207
|
-
)
|
|
89345
|
+
...fenced(e.signatures[n], fence).map((l) => ` ${l}`)
|
|
89208
89346
|
]),
|
|
89209
|
-
...declared.length ? [""] : []
|
|
89347
|
+
...declared.length ? [""] : [],
|
|
89348
|
+
// The shapes those declarations name, as the module declares them.
|
|
89349
|
+
...types2.length ? [
|
|
89350
|
+
" The types these use, declared in the same module:",
|
|
89351
|
+
...types2.flatMap(([, sig]) => [
|
|
89352
|
+
"",
|
|
89353
|
+
...fenced(sig, fence).map((l) => ` ${l}`)
|
|
89354
|
+
]),
|
|
89355
|
+
""
|
|
89356
|
+
] : []
|
|
89210
89357
|
];
|
|
89211
89358
|
}),
|
|
89212
89359
|
""
|
|
@@ -89374,16 +89521,38 @@ function cappedTitles(titles) {
|
|
|
89374
89521
|
}
|
|
89375
89522
|
return { shown, more: titles.length - shown.length };
|
|
89376
89523
|
}
|
|
89524
|
+
function typeNamesIn(declaration) {
|
|
89525
|
+
return [...new Set(declaration.match(/\b[A-Z][A-Za-z0-9_]*\b/g) ?? [])];
|
|
89526
|
+
}
|
|
89377
89527
|
async function withSignatures(show, targetSha, entries) {
|
|
89378
89528
|
const out = [];
|
|
89379
89529
|
for (const e of entries) {
|
|
89380
89530
|
const source = e.names.length ? await show(targetSha, e.path) : null;
|
|
89531
|
+
const lang = adapterFor(e.path);
|
|
89381
89532
|
const signatures = {};
|
|
89382
89533
|
for (const n of e.names) {
|
|
89383
|
-
const sig = source === null ? null :
|
|
89534
|
+
const sig = source === null ? null : lang?.signatureOf(source, n) ?? null;
|
|
89384
89535
|
if (sig) signatures[n] = sig;
|
|
89385
89536
|
}
|
|
89386
|
-
|
|
89537
|
+
const types2 = {};
|
|
89538
|
+
if (source !== null && lang) {
|
|
89539
|
+
const queue = Object.values(signatures).flatMap(typeNamesIn);
|
|
89540
|
+
const seen = new Set(e.names);
|
|
89541
|
+
while (queue.length && Object.keys(types2).length < MAX_TYPE_DECLARATIONS) {
|
|
89542
|
+
const name = queue.shift();
|
|
89543
|
+
if (seen.has(name)) continue;
|
|
89544
|
+
seen.add(name);
|
|
89545
|
+
const sig = lang.signatureOf(source, name);
|
|
89546
|
+
if (!sig) continue;
|
|
89547
|
+
types2[name] = sig;
|
|
89548
|
+
queue.push(...typeNamesIn(sig));
|
|
89549
|
+
}
|
|
89550
|
+
}
|
|
89551
|
+
out.push({
|
|
89552
|
+
...e,
|
|
89553
|
+
...Object.keys(signatures).length ? { signatures } : {},
|
|
89554
|
+
...Object.keys(types2).length ? { types: types2 } : {}
|
|
89555
|
+
});
|
|
89387
89556
|
}
|
|
89388
89557
|
return out;
|
|
89389
89558
|
}
|
|
@@ -89456,7 +89625,7 @@ function baseNameOf(path2) {
|
|
|
89456
89625
|
const name = /\.py$/.test(file2) ? file2.replace(/\.py$/, "").replace(/^test_(?=.)|(?<=.)_test$/, "") : file2.replace(/\.[cm]?[jt]sx?$/, "").replace(/\.(?:test|spec)$/, "");
|
|
89457
89626
|
return (name === "index" || name === "__init__") && parts.length ? parts[parts.length - 1] : name;
|
|
89458
89627
|
}
|
|
89459
|
-
var MAX_TITLES, MAX_TITLE_CHARS, MAX_FAILING_PATHS, MAX_HOP_MODULES, norm;
|
|
89628
|
+
var MAX_TITLES, MAX_TITLE_CHARS, MAX_FAILING_PATHS, MAX_TYPE_DECLARATIONS, MAX_HOP_MODULES, norm;
|
|
89460
89629
|
var init_replay_spec = __esm({
|
|
89461
89630
|
"src/commands/replay-spec.ts"() {
|
|
89462
89631
|
"use strict";
|
|
@@ -89466,6 +89635,7 @@ var init_replay_spec = __esm({
|
|
|
89466
89635
|
MAX_TITLES = 40;
|
|
89467
89636
|
MAX_TITLE_CHARS = 4e3;
|
|
89468
89637
|
MAX_FAILING_PATHS = 12;
|
|
89638
|
+
MAX_TYPE_DECLARATIONS = 8;
|
|
89469
89639
|
MAX_HOP_MODULES = 24;
|
|
89470
89640
|
norm = (s) => s.replace(/\s+/g, " ").trim();
|
|
89471
89641
|
}
|
|
@@ -89791,12 +89961,12 @@ function haansiSection(tools, hint = null) {
|
|
|
89791
89961
|
"",
|
|
89792
89962
|
"These MCP servers hold what your organization learned before this task began. They are read-only here.",
|
|
89793
89963
|
"",
|
|
89794
|
-
"
|
|
89964
|
+
"Work on the task first, as you would without them: read the code and make your change. Then, before you finish, check your work against them, and change it where they show something wrong, missing or already tried. Search again whenever you get stuck:",
|
|
89795
89965
|
"",
|
|
89796
|
-
"- Repository conventions:
|
|
89966
|
+
"- Repository conventions: get_conventions with the files you changed: the repository's approved conventions (rules this codebase follows) that apply to them.",
|
|
89797
89967
|
"- Past fixes: search_solutions with a sentence about the problem (its error line in error, failing tests in failing_tests, the files you expect to change in files, identifiers in names), then get_solution to read the matching results in full.",
|
|
89798
89968
|
"- Team procedures: match_playbook with the task, and search_skills; get_skill loads one.",
|
|
89799
|
-
"- Earlier attempts at the same code: get_prior_attempts with the files you
|
|
89969
|
+
"- Earlier attempts at the same code: get_prior_attempts with the files you changed.",
|
|
89800
89970
|
"- Incidents like this one: search_prior_incidents.",
|
|
89801
89971
|
"- Recent work, conventions and shared answers: search_digests, search_guides and search_exchange.",
|
|
89802
89972
|
"",
|
|
@@ -89953,6 +90123,14 @@ async function runStoredReplays(options, deps) {
|
|
|
89953
90123
|
throw new Error(
|
|
89954
90124
|
`No test command: pass --test-cmd, or set one for ${repository} in Haansi.`
|
|
89955
90125
|
);
|
|
90126
|
+
for (const [flag, cmd] of [
|
|
90127
|
+
["--agent-cmd", options.agentCmd],
|
|
90128
|
+
["--judge-cmd", options.judgeCmd ?? ""]
|
|
90129
|
+
])
|
|
90130
|
+
if (cmd && agentLoadsMachineServers(cmd))
|
|
90131
|
+
deps.log(
|
|
90132
|
+
`${flag} runs Claude Code without --strict-mcp-config: it also loads the MCP servers set up on this machine. Add --strict-mcp-config so each arm and judge gets only its own servers.`
|
|
90133
|
+
);
|
|
89956
90134
|
if (set2.tasks.length === 0) {
|
|
89957
90135
|
deps.log(
|
|
89958
90136
|
`No replay tasks for ${repository} yet: they need a card (replay task cards on for the organization).`
|
|
@@ -89995,7 +90173,9 @@ async function runStoredReplays(options, deps) {
|
|
|
89995
90173
|
(t) => states.get(t.taskId) === "valid" && t.testFiles.length > 0 && t.testFiles.every(safeTestFile) && SHA.test(t.baseSha) && SHA.test(t.targetSha)
|
|
89996
90174
|
);
|
|
89997
90175
|
const notValid = mine.length - valid.length;
|
|
89998
|
-
const arms = options.arms
|
|
90176
|
+
const arms = [...options.arms].sort(
|
|
90177
|
+
(a, b) => Number(a !== "baseline") - Number(b !== "baseline")
|
|
90178
|
+
);
|
|
89999
90179
|
let judgePrompt;
|
|
90000
90180
|
const promptForJudge = async () => {
|
|
90001
90181
|
if (judgePrompt === void 0)
|
|
@@ -90032,6 +90212,19 @@ async function runStoredReplays(options, deps) {
|
|
|
90032
90212
|
targetSha: task.targetSha,
|
|
90033
90213
|
testFiles: task.testFiles
|
|
90034
90214
|
}).catch(() => []);
|
|
90215
|
+
if (!named.length && task.baseSha && task.targetSha)
|
|
90216
|
+
task.specGaps = await specGapsOf(
|
|
90217
|
+
deps.showFile,
|
|
90218
|
+
gitGrepNames(
|
|
90219
|
+
(args) => (deps.gitStdout ?? deps.git)(args, deps.repoDir)
|
|
90220
|
+
),
|
|
90221
|
+
{
|
|
90222
|
+
baseSha: task.baseSha,
|
|
90223
|
+
targetSha: task.targetSha,
|
|
90224
|
+
testFiles: task.testFiles
|
|
90225
|
+
},
|
|
90226
|
+
cardPrompt(task, null)
|
|
90227
|
+
).catch(() => []);
|
|
90035
90228
|
if (named.length && task.baseSha)
|
|
90036
90229
|
task.failingPaths = await failingPathsOf(
|
|
90037
90230
|
deps.showFile,
|
|
@@ -90124,7 +90317,12 @@ async function runStoredReplays(options, deps) {
|
|
|
90124
90317
|
deps.log(
|
|
90125
90318
|
`\u2026 ${label}: the tests use ${task.testInterface.length} module(s) the start lacks; named in the prompt`
|
|
90126
90319
|
);
|
|
90320
|
+
if (task.specGaps?.length)
|
|
90321
|
+
deps.log(
|
|
90322
|
+
`\u2026 ${label}: the tests rely on ${task.specGaps.length} name(s) the prompt and the start never have: ${task.specGaps.join(", ")}`
|
|
90323
|
+
);
|
|
90127
90324
|
let targetSent = false;
|
|
90325
|
+
let baselineChange = null;
|
|
90128
90326
|
for (const arm of arms) {
|
|
90129
90327
|
if (!options.force && alreadyMeasured(
|
|
90130
90328
|
task.measured,
|
|
@@ -90187,6 +90385,7 @@ async function runStoredReplays(options, deps) {
|
|
|
90187
90385
|
changed = await changedFiles(deps, dir, task.baseSha);
|
|
90188
90386
|
agentDiff = await agentDiffOf(deps, dir, task.baseSha);
|
|
90189
90387
|
if (arm === "haansi") change = judgeChange(agentDiff);
|
|
90388
|
+
else baselineChange = judgeChange(agentDiff);
|
|
90190
90389
|
},
|
|
90191
90390
|
{
|
|
90192
90391
|
HAANSI_REPLAY_MCP_CONFIG: configPath,
|
|
@@ -90210,6 +90409,7 @@ async function runStoredReplays(options, deps) {
|
|
|
90210
90409
|
card: cardPrompt(task, null),
|
|
90211
90410
|
calls,
|
|
90212
90411
|
change,
|
|
90412
|
+
baseline: baselineChange,
|
|
90213
90413
|
prompt: await promptForJudge()
|
|
90214
90414
|
})
|
|
90215
90415
|
};
|
|
@@ -90288,7 +90488,8 @@ async function runStoredReplays(options, deps) {
|
|
|
90288
90488
|
configFingerprint,
|
|
90289
90489
|
errors: options.noDiffs ? null : r.errors ?? [],
|
|
90290
90490
|
testCounts: r.testCounts ?? [],
|
|
90291
|
-
usage: r.usage ?? []
|
|
90491
|
+
usage: r.usage ?? [],
|
|
90492
|
+
specGaps: task.specGaps ? task.specGaps.length : null
|
|
90292
90493
|
});
|
|
90293
90494
|
if (sendTarget) targetSent = true;
|
|
90294
90495
|
deps.log(
|
|
@@ -90345,6 +90546,7 @@ var init_replay_tasks = __esm({
|
|
|
90345
90546
|
init_replay();
|
|
90346
90547
|
init_replay_scale();
|
|
90347
90548
|
init_replay_codex();
|
|
90549
|
+
init_replay_spec_gaps();
|
|
90348
90550
|
init_replay_interface();
|
|
90349
90551
|
init_replay_spec();
|
|
90350
90552
|
init_replay_context();
|
|
@@ -90362,7 +90564,7 @@ var init_replay_tasks = __esm({
|
|
|
90362
90564
|
"bug-fix": "For a failing test, search with its name and the error line, and ask get_prior_attempts with the failing test files and the files they import.",
|
|
90363
90565
|
feature: "Ask with the modules and names under 'What the tests use'."
|
|
90364
90566
|
};
|
|
90365
|
-
FEATURE_MIN_FILE_RECALL = 0.
|
|
90567
|
+
FEATURE_MIN_FILE_RECALL = 0.4;
|
|
90366
90568
|
share2 = (part, whole) => whole === 0 ? null : Math.round(part / whole * 1e3) / 1e3;
|
|
90367
90569
|
pct = (v) => v === null ? "n/a" : `${Math.round(v * 100)}%`;
|
|
90368
90570
|
}
|
|
@@ -90394,7 +90596,7 @@ function parseReplayArgs(argv) {
|
|
|
90394
90596
|
testCmd: "",
|
|
90395
90597
|
setupCmd: null,
|
|
90396
90598
|
repoCommands: false,
|
|
90397
|
-
attempts:
|
|
90599
|
+
attempts: 2,
|
|
90398
90600
|
arms: [...ARMS],
|
|
90399
90601
|
limit: null,
|
|
90400
90602
|
// 20 minutes an attempt: the longest replays (90 min) were stuck.
|
|
@@ -90641,6 +90843,13 @@ async function replayArm(deps, options, task, arm, promptOf, inspect, agentEnv =
|
|
|
90641
90843
|
`Haansi's servers did not load for the agent (${down.join(", ")}); not graded, run it again`
|
|
90642
90844
|
);
|
|
90643
90845
|
}
|
|
90846
|
+
if (arm === "baseline") {
|
|
90847
|
+
const loaded = haansiServersLoaded(agent.output) ?? [];
|
|
90848
|
+
if (loaded.length)
|
|
90849
|
+
throw new Error(
|
|
90850
|
+
`the baseline's agent loaded Haansi's servers (${loaded.join(", ")}): it did not run without Haansi; not graded. Add --strict-mcp-config to a Claude Code command.`
|
|
90851
|
+
);
|
|
90852
|
+
}
|
|
90644
90853
|
const uses = toolUsesOf(agent.output);
|
|
90645
90854
|
if (uses) deps.log(`\u2026 ${label}: tools used: ${toolUsesLine(uses)}`);
|
|
90646
90855
|
const gradeSha = task.testNames?.length ? task.baseSha : task.targetSha;
|
|
@@ -91019,7 +91228,7 @@ var init_replay = __esm({
|
|
|
91019
91228
|
OUTPUT_HEAD_CHARS = 4e4;
|
|
91020
91229
|
OUTPUT_TAIL_CHARS = 2e5;
|
|
91021
91230
|
USAGE2 = `Usage: haansi replay run --agent-cmd "<cmd>" --test-cmd "<cmd>"
|
|
91022
|
-
[--setup-cmd "<cmd>"] [--attempts
|
|
91231
|
+
[--setup-cmd "<cmd>"] [--attempts 2] [--arms baseline,haansi] [--limit n]
|
|
91023
91232
|
[--timeout-min 20] [--agent-name <name>] [--model <name>]
|
|
91024
91233
|
[--judge-cmd "<cmd>"]
|
|
91025
91234
|
[--run-ref <url>] [--dry-run] [--repo-commands] [--no-diffs]
|
|
@@ -91085,7 +91294,7 @@ Run from a clone of the repository. Example (GitHub Actions):
|
|
|
91085
91294
|
haansi replay run --setup-cmd 'npm ci' \\
|
|
91086
91295
|
--container node:22 --container-env ANTHROPIC_API_KEY \\
|
|
91087
91296
|
--container-setup 'npm install -g haansi @anthropic-ai/claude-code' \\
|
|
91088
|
-
--agent-cmd 'claude -p "$HAANSI_REPLAY_PROMPT" --output-format stream-json --verbose --permission-mode acceptEdits --mcp-config "$HAANSI_REPLAY_MCP_CONFIG" --allowedTools mcp__haansi-solutions,mcp__haansi-exchange,mcp__haansi-digests,mcp__haansi-onboarding,mcp__haansi-skills,mcp__haansi-incidents' \\
|
|
91297
|
+
--agent-cmd 'claude -p "$HAANSI_REPLAY_PROMPT" --output-format stream-json --verbose --permission-mode acceptEdits --mcp-config "$HAANSI_REPLAY_MCP_CONFIG" --strict-mcp-config --allowedTools mcp__haansi-solutions,mcp__haansi-exchange,mcp__haansi-digests,mcp__haansi-onboarding,mcp__haansi-skills,mcp__haansi-incidents' \\
|
|
91089
91298
|
--test-cmd 'npx vitest run $HAANSI_REPLAY_TEST_FILES -t "$HAANSI_REPLAY_TEST_PATTERN"' \\
|
|
91090
91299
|
--agent-name claude-code --model claude-sonnet-5-5`;
|
|
91091
91300
|
}
|