@koda-sl/baker-bridge 0.197.0-dev.77001dfac → 0.198.0-dev.193925706
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 +4 -0
- package/dist/review/digest.d.ts +1 -8
- package/dist/review/digest.d.ts.map +1 -1
- package/dist/review/digest.js +98 -49
- package/dist/review/digest.js.map +1 -1
- package/dist/review/digest.test.js +160 -34
- package/dist/review/digest.test.js.map +1 -1
- package/dist/review/evidence.js +1 -1
- package/dist/review/evidence.js.map +1 -1
- package/dist/review/transcripts.d.ts +2 -1
- package/dist/review/transcripts.d.ts.map +1 -1
- package/dist/review/transcripts.js +2 -1
- package/dist/review/transcripts.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1056,6 +1056,10 @@ Two of the files are easy to underrate:
|
|
|
1056
1056
|
turn ended inside it. And the same tool and input answering two ways is listed
|
|
1057
1057
|
as flaky, which a reader going forward through a transcript cannot see: by the
|
|
1058
1058
|
time the retry succeeds, the failure reads as a mistake that was corrected.
|
|
1059
|
+
Two attempts count only when nothing in their thread wrote to the workspace
|
|
1060
|
+
between them, in the order the calls ran, subagents included — an edit, a
|
|
1061
|
+
writing shell command or `baker` call; never one a guard refused — because a
|
|
1062
|
+
check that passes after a fix is the fix working.
|
|
1059
1063
|
|
|
1060
1064
|
The digest is also **posted to Convex before the reviewer reads it**, via
|
|
1061
1065
|
`POST /api/chat/review-digest`, and kept on the review row as one stored blob.
|
package/dist/review/digest.d.ts
CHANGED
|
@@ -442,9 +442,6 @@ export type DebugLogLine = {
|
|
|
442
442
|
session?: string;
|
|
443
443
|
kind?: string;
|
|
444
444
|
argv?: string[];
|
|
445
|
-
/** `agent`, `tooling:<script>` (a hook, the watcher, a check) or `other`; absent before the CLI recorded it. */
|
|
446
|
-
caller?: string;
|
|
447
|
-
threadId?: string;
|
|
448
445
|
cwd?: string;
|
|
449
446
|
method?: string;
|
|
450
447
|
url?: string;
|
|
@@ -459,10 +456,6 @@ export type DebugLogLine = {
|
|
|
459
456
|
export type CliInvocation = {
|
|
460
457
|
session: string;
|
|
461
458
|
argv: string[];
|
|
462
|
-
/** Who ran it, as the CLI recorded it. See `DebugLogLine.caller`. */
|
|
463
|
-
caller?: string;
|
|
464
|
-
/** The chat thread whose turn ran it, when one did. */
|
|
465
|
-
threadId?: string;
|
|
466
459
|
verb?: string;
|
|
467
460
|
/** When it started, by the sandbox clock the transcript is stamped with too. */
|
|
468
461
|
startedAt?: string;
|
|
@@ -493,7 +486,7 @@ export type CliInvocation = {
|
|
|
493
486
|
* and without both numbers a finding about "the CLI returns too much" cannot say
|
|
494
487
|
* which layer to fix.
|
|
495
488
|
*/
|
|
496
|
-
export declare function buildCliDigest(lines: readonly DebugLogLine[]
|
|
489
|
+
export declare function buildCliDigest(lines: readonly DebugLogLine[]): CliInvocation[];
|
|
497
490
|
/** Parse any of the sandbox's JSONL records, tolerating a half-written last line. */
|
|
498
491
|
export declare function parseJsonl<T>(body: string): T[];
|
|
499
492
|
export type VerifyTimings = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"digest.d.ts","sourceRoot":"","sources":["../../src/review/digest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"digest.d.ts","sourceRoot":"","sources":["../../src/review/digest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAWH,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE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,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAChD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF,wBAAgB,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa,CAerE;AAaD,wBAAgB,WAAW,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAuF5D;AAOD,wBAAgB,WAAW,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAmF5D;AA0BD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CA+E/D;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAiB5D;AAMD,wBAAgB,YAAY,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CA+D7D;AAMD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAwBjE;AAED,wBAAgB,SAAS,CAAC,WAAW,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,CAqBvE;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,GAAG,MAAM,CAyBlE"}
|
package/dist/review/digest.js
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
import { createHash } from "node:crypto";
|
|
19
19
|
import { imageSize } from "image-size";
|
|
20
20
|
import { parse } from "unbash";
|
|
21
|
+
import { reviewBashPolicy } from "./shell-policy.js";
|
|
21
22
|
/** Parse a `.jsonl` body, dropping lines that are not JSON rather than failing. */
|
|
22
23
|
export function parseTranscript(body) {
|
|
23
24
|
const out = [];
|
|
@@ -718,12 +719,15 @@ function isCompactBoundary(line) {
|
|
|
718
719
|
/**
|
|
719
720
|
* A compaction replaced the history the last request carried, so its context is
|
|
720
721
|
* no baseline for the next one: what that request carries first stays `unmeasured`.
|
|
722
|
+
*
|
|
723
|
+
* The turn it happened in is marked only for the main context: a subagent that
|
|
724
|
+
* ran out of its own is not the conversation running out.
|
|
721
725
|
*/
|
|
722
726
|
function absorbCompaction(acc, line) {
|
|
723
727
|
const cost = documentCostOf(acc, line.threadId, line.agentId);
|
|
724
728
|
cost.contextAfter = undefined;
|
|
725
729
|
cost.resultTokensSince = 0;
|
|
726
|
-
const turn = line
|
|
730
|
+
const turn = isSubagentLine(line) ? undefined : currentTurn(acc);
|
|
727
731
|
if (turn) {
|
|
728
732
|
turn.compacted = true;
|
|
729
733
|
}
|
|
@@ -1144,7 +1148,7 @@ export function buildTranscriptDigest(lines, cli = []) {
|
|
|
1144
1148
|
.slice(0, 15),
|
|
1145
1149
|
failures: aggregateFailures(acc.toolCalls, acc.failureMessages, acc.cliFailures),
|
|
1146
1150
|
unplacedCliFailures: unplacedCliFailures.map(describeCliFailure),
|
|
1147
|
-
flaky: findFlakyCalls(acc.toolCalls),
|
|
1151
|
+
flaky: findFlakyCalls(acc.toolCalls, acc.commands),
|
|
1148
1152
|
introspectionCalls: acc.toolCalls.filter((call) => call.bakerVerb?.startsWith("baker schema") || /--help\b/.test(call.summary)),
|
|
1149
1153
|
hooks: [...acc.hooks.values()].sort((a, b) => b.fired - a.fired),
|
|
1150
1154
|
guards: acc.guards,
|
|
@@ -1197,6 +1201,67 @@ function aggregateFailures(calls, messages, cliFailures) {
|
|
|
1197
1201
|
}
|
|
1198
1202
|
return [...map.values()].sort((a, b) => b.calls - a.calls);
|
|
1199
1203
|
}
|
|
1204
|
+
/** Tools that change the workspace whatever their input. */
|
|
1205
|
+
const EDITING_TOOLS = new Set(["Write", "Edit", "MultiEdit", "NotebookEdit"]);
|
|
1206
|
+
/** A `baker` invocation at a command position, with every bare word after it: its family, verbs and the like. */
|
|
1207
|
+
const BAKER_WORDS = new RegExp(String.raw `(?:^|[;&|(\n])\s*(?:${COMMAND_WRAPPER}\s+)*baker((?:\s+[a-z0-9-]+)*)`, "gi");
|
|
1208
|
+
/**
|
|
1209
|
+
* The words that make a `baker` call a read. Any other call may write — `baker
|
|
1210
|
+
* canvas set` rewrites a canvas file — so a call is a read only when it says so.
|
|
1211
|
+
*/
|
|
1212
|
+
const BAKER_READ_WORDS = new Set([
|
|
1213
|
+
"schema",
|
|
1214
|
+
"list",
|
|
1215
|
+
"get",
|
|
1216
|
+
"search",
|
|
1217
|
+
"show",
|
|
1218
|
+
"query",
|
|
1219
|
+
"read",
|
|
1220
|
+
"describe",
|
|
1221
|
+
"status",
|
|
1222
|
+
"view",
|
|
1223
|
+
"validate",
|
|
1224
|
+
"catalog",
|
|
1225
|
+
"performance",
|
|
1226
|
+
"--help",
|
|
1227
|
+
"-h",
|
|
1228
|
+
]);
|
|
1229
|
+
/** Whether a shell command runs a `baker` call that is not a known read. */
|
|
1230
|
+
function runsWritingBaker(command) {
|
|
1231
|
+
return [...beforeHeredoc(command).matchAll(BAKER_WORDS)].some((match) => {
|
|
1232
|
+
const words = (match[1] ?? "").trim().toLowerCase().split(/\s+/);
|
|
1233
|
+
return !words.some((word) => BAKER_READ_WORDS.has(word));
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1236
|
+
/**
|
|
1237
|
+
* Whether a call may have changed what the next one sees: an editing tool, a
|
|
1238
|
+
* shell command that is not a pure read by the review's own shell allowlist, or
|
|
1239
|
+
* a `baker` call that writes. A call a guard refused never ran, so it changed nothing.
|
|
1240
|
+
*/
|
|
1241
|
+
function changesWorkspace(call, commands) {
|
|
1242
|
+
if (call.failureClass === "refused") {
|
|
1243
|
+
return false;
|
|
1244
|
+
}
|
|
1245
|
+
if (EDITING_TOOLS.has(call.tool)) {
|
|
1246
|
+
return true;
|
|
1247
|
+
}
|
|
1248
|
+
const command = call.tool === "Bash" ? commands.get(call.toolUseId) : undefined;
|
|
1249
|
+
return command !== undefined && (!reviewBashPolicy(command).allowed || runsWritingBaker(command));
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* The calls in the order they ran. A subagent's transcript is read after its
|
|
1253
|
+
* parent's whole file, so the order they were read in puts its calls after the
|
|
1254
|
+
* parent's retry; each call takes the time it was asked for, or the last one
|
|
1255
|
+
* read before it when it carries none.
|
|
1256
|
+
*/
|
|
1257
|
+
function inExecutionOrder(calls) {
|
|
1258
|
+
let last = Number.NEGATIVE_INFINITY;
|
|
1259
|
+
const stamped = calls.map((call, at) => {
|
|
1260
|
+
last = stampOf(call.requestedAt) ?? last;
|
|
1261
|
+
return { call, time: last, at };
|
|
1262
|
+
});
|
|
1263
|
+
return stamped.sort((a, b) => a.time - b.time || a.at - b.at).map((entry) => entry.call);
|
|
1264
|
+
}
|
|
1200
1265
|
/**
|
|
1201
1266
|
* Calls that answered two ways for one input.
|
|
1202
1267
|
*
|
|
@@ -1204,17 +1269,32 @@ function aggregateFailures(calls, messages, cliFailures) {
|
|
|
1204
1269
|
* changed nothing and got a different answer is the definition of flaky, and
|
|
1205
1270
|
* separating it from an ordinary repeat is the whole point — one says "give the
|
|
1206
1271
|
* agent a batch primitive", the other says "this thing is unreliable".
|
|
1272
|
+
*
|
|
1273
|
+
* "Changed nothing" is checked, not assumed: a check that failed, was answered
|
|
1274
|
+
* with edits and then passed is the edits working, so a pair of attempts counts
|
|
1275
|
+
* only when no call in their thread wrote anything between them, in the order
|
|
1276
|
+
* the calls ran.
|
|
1207
1277
|
*/
|
|
1208
|
-
function findFlakyCalls(
|
|
1278
|
+
function findFlakyCalls(read, commands) {
|
|
1279
|
+
const calls = inExecutionOrder(read);
|
|
1209
1280
|
const groups = new Map();
|
|
1210
|
-
|
|
1281
|
+
calls.forEach((call, at) => {
|
|
1211
1282
|
const key = `${call.tool}\u0000${call.inputKey}`;
|
|
1212
|
-
groups.set(key, [...(groups.get(key) ?? []),
|
|
1213
|
-
}
|
|
1283
|
+
groups.set(key, [...(groups.get(key) ?? []), at]);
|
|
1284
|
+
});
|
|
1285
|
+
const changedBetween = (from, to) => {
|
|
1286
|
+
const thread = calls[from]?.threadId;
|
|
1287
|
+
return calls.slice(from + 1, to).some((call) => call.threadId === thread && changesWorkspace(call, commands));
|
|
1288
|
+
};
|
|
1214
1289
|
const out = [];
|
|
1215
|
-
for (const
|
|
1290
|
+
for (const positions of groups.values()) {
|
|
1291
|
+
const group = positions.map((at) => calls[at]);
|
|
1216
1292
|
const failures = group.filter((call) => call.isError);
|
|
1217
|
-
|
|
1293
|
+
const twoAnswers = positions.some((at, i) => {
|
|
1294
|
+
const next = positions[i + 1];
|
|
1295
|
+
return next !== undefined && calls[at]?.isError !== calls[next]?.isError && !changedBetween(at, next);
|
|
1296
|
+
});
|
|
1297
|
+
if (!twoAnswers) {
|
|
1218
1298
|
continue;
|
|
1219
1299
|
}
|
|
1220
1300
|
const first = group[0];
|
|
@@ -1418,12 +1498,6 @@ function absorbInvocation(entry, line) {
|
|
|
1418
1498
|
if (line.ts !== undefined) {
|
|
1419
1499
|
entry.startedAt = line.ts;
|
|
1420
1500
|
}
|
|
1421
|
-
if (typeof line.caller === "string") {
|
|
1422
|
-
entry.caller = line.caller;
|
|
1423
|
-
}
|
|
1424
|
-
if (typeof line.threadId === "string") {
|
|
1425
|
-
entry.threadId = line.threadId;
|
|
1426
|
-
}
|
|
1427
1501
|
const verb = bakerVerbOf(`baker ${line.argv.join(" ")}`);
|
|
1428
1502
|
if (verb) {
|
|
1429
1503
|
entry.verb = verb;
|
|
@@ -1490,7 +1564,7 @@ const DEBUG_LINE_HANDLERS = {
|
|
|
1490
1564
|
* and without both numbers a finding about "the CLI returns too much" cannot say
|
|
1491
1565
|
* which layer to fix.
|
|
1492
1566
|
*/
|
|
1493
|
-
export function buildCliDigest(lines
|
|
1567
|
+
export function buildCliDigest(lines) {
|
|
1494
1568
|
const bySession = new Map();
|
|
1495
1569
|
for (const line of lines) {
|
|
1496
1570
|
const session = line.session ?? "unknown";
|
|
@@ -1501,9 +1575,7 @@ export function buildCliDigest(lines, threadIds) {
|
|
|
1501
1575
|
}
|
|
1502
1576
|
DEBUG_LINE_HANDLERS[line.kind ?? ""]?.(entry, line);
|
|
1503
1577
|
}
|
|
1504
|
-
|
|
1505
|
-
// not this Session's. One made for no thread (the watcher) stays, under its caller.
|
|
1506
|
-
return [...bySession.values()].filter((entry) => threadIds === undefined || entry.threadId === undefined || threadIds.includes(entry.threadId));
|
|
1578
|
+
return [...bySession.values()];
|
|
1507
1579
|
}
|
|
1508
1580
|
/** Parse any of the sandbox's JSONL records, tolerating a half-written last line. */
|
|
1509
1581
|
export function parseJsonl(body) {
|
|
@@ -1903,14 +1975,6 @@ export function renderUserFacing(digest) {
|
|
|
1903
1975
|
.join("\n"),
|
|
1904
1976
|
].join("\n");
|
|
1905
1977
|
}
|
|
1906
|
-
const AGENT_CALLER = "agent";
|
|
1907
|
-
const UNRECORDED_CALLER = "unknown";
|
|
1908
|
-
/** Every caller, the agent always first (even with no call) and calls logged before callers were recorded last. */
|
|
1909
|
-
function callersInOrder(invocations) {
|
|
1910
|
-
const callers = new Set([AGENT_CALLER, ...invocations.map((invocation) => invocation.caller ?? UNRECORDED_CALLER)]);
|
|
1911
|
-
const rank = (caller) => (caller === AGENT_CALLER ? 0 : caller === UNRECORDED_CALLER ? 2 : 1);
|
|
1912
|
-
return [...callers].sort((a, b) => rank(a) - rank(b));
|
|
1913
|
-
}
|
|
1914
1978
|
export function renderCli(invocations) {
|
|
1915
1979
|
return [
|
|
1916
1980
|
"# `baker` invocations",
|
|
@@ -1919,30 +1983,15 @@ export function renderCli(invocations) {
|
|
|
1919
1983
|
"A large response with a small printed size is a payload problem;",
|
|
1920
1984
|
"a large printed size is a projection problem. They need different fixes.",
|
|
1921
1985
|
"",
|
|
1922
|
-
"
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1986
|
+
table(["argv", "exit", "ms", "http calls", "response bytes", "printed bytes"], invocations.map((invocation) => [
|
|
1987
|
+
invocation.argv.join(" "),
|
|
1988
|
+
invocation.exitCode ?? "",
|
|
1989
|
+
invocation.durationMs ?? "",
|
|
1990
|
+
invocation.httpCalls.length,
|
|
1991
|
+
invocation.responseBytes,
|
|
1992
|
+
invocation.printedBytes,
|
|
1993
|
+
])),
|
|
1926
1994
|
"",
|
|
1927
|
-
...callersInOrder(invocations).flatMap((caller) => {
|
|
1928
|
-
const ran = invocations.filter((invocation) => (invocation.caller ?? UNRECORDED_CALLER) === caller);
|
|
1929
|
-
if (ran.length === 0) {
|
|
1930
|
-
return [`## ${caller} (0)`, "", "No `baker` call ran in the agent's own shell.", ""];
|
|
1931
|
-
}
|
|
1932
|
-
return [
|
|
1933
|
-
`## ${caller} (${ran.length})`,
|
|
1934
|
-
"",
|
|
1935
|
-
table(["argv", "exit", "ms", "http calls", "response bytes", "printed bytes"], ran.map((invocation) => [
|
|
1936
|
-
invocation.argv.join(" "),
|
|
1937
|
-
invocation.exitCode ?? "",
|
|
1938
|
-
invocation.durationMs ?? "",
|
|
1939
|
-
invocation.httpCalls.length,
|
|
1940
|
-
invocation.responseBytes,
|
|
1941
|
-
invocation.printedBytes,
|
|
1942
|
-
])),
|
|
1943
|
-
"",
|
|
1944
|
-
];
|
|
1945
|
-
}),
|
|
1946
1995
|
].join("\n");
|
|
1947
1996
|
}
|
|
1948
1997
|
export function renderVerify(summary) {
|