@koda-sl/baker-bridge 0.154.0 → 0.155.0-dev.54262832
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/hono/publish-handoff.d.ts.map +1 -1
- package/dist/hono/publish-handoff.js +15 -6
- package/dist/hono/publish-handoff.js.map +1 -1
- package/dist/hono/publish-handoff.test.js +12 -0
- package/dist/hono/publish-handoff.test.js.map +1 -1
- package/dist/review/digest.d.ts +1 -10
- package/dist/review/digest.d.ts.map +1 -1
- package/dist/review/digest.js +38 -225
- package/dist/review/digest.js.map +1 -1
- package/dist/review/digest.test.js +8 -109
- package/dist/review/digest.test.js.map +1 -1
- package/dist/review/evidence.d.ts.map +1 -1
- package/dist/review/evidence.js +1 -1
- package/dist/review/evidence.js.map +1 -1
- package/dist/review/reply-language.d.ts +9 -0
- package/dist/review/reply-language.d.ts.map +1 -1
- package/dist/review/reply-language.js +26 -0
- package/dist/review/reply-language.js.map +1 -1
- package/dist/review/reply-language.test.d.ts +2 -0
- package/dist/review/reply-language.test.d.ts.map +1 -0
- package/dist/review/reply-language.test.js +80 -0
- package/dist/review/reply-language.test.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-handoff.d.ts","sourceRoot":"","sources":["../../src/hono/publish-handoff.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"publish-handoff.d.ts","sourceRoot":"","sources":["../../src/hono/publish-handoff.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AA0C1D;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,uBAAuB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAqBxG;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,uBAAuB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAoBnG"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { requestedLanguage } from "../review/reply-language.js";
|
|
1
2
|
import { BridgeSlashCommands } from "./slash-commands.js";
|
|
2
3
|
// Publish runs in a session of its own (`prepareSessionAttempt`), so two things
|
|
3
4
|
// never cross between it and the chat's conversation on their own: the
|
|
@@ -27,11 +28,12 @@ function lastTypedMessages(history) {
|
|
|
27
28
|
const entry = entries[index];
|
|
28
29
|
if (entry?.role !== "user" || entry.bakerWritten)
|
|
29
30
|
continue;
|
|
30
|
-
const
|
|
31
|
-
|
|
31
|
+
const whole = entry.typedText ?? entry.text;
|
|
32
|
+
const quoted = quotable(whole, LANGUAGE_SAMPLE_CHARS);
|
|
33
|
+
if (!quoted || quoted.startsWith("/") || quoted === "[Attachment only message]")
|
|
32
34
|
continue;
|
|
33
|
-
typed.unshift(
|
|
34
|
-
if (
|
|
35
|
+
typed.unshift({ quoted, whole });
|
|
36
|
+
if (quoted.split(" ").length >= SUBSTANTIVE_WORDS)
|
|
35
37
|
break;
|
|
36
38
|
}
|
|
37
39
|
return typed;
|
|
@@ -45,6 +47,11 @@ export function publishLanguageReminder(history) {
|
|
|
45
47
|
const typed = lastTypedMessages(history);
|
|
46
48
|
if (typed.length === 0)
|
|
47
49
|
return undefined;
|
|
50
|
+
// A scheduled run's English brief that ends "Report in Spanish": its quoted start says English (BAKER-3249).
|
|
51
|
+
const requested = typed
|
|
52
|
+
.map((message) => requestedLanguage(message.whole))
|
|
53
|
+
.filter(Boolean)
|
|
54
|
+
.pop();
|
|
48
55
|
return [
|
|
49
56
|
"<system-reminder>",
|
|
50
57
|
// A fixed first line: session review keys its hook ledger on it.
|
|
@@ -52,8 +59,10 @@ export function publishLanguageReminder(history) {
|
|
|
52
59
|
typed.length > 1
|
|
53
60
|
? "The user started this run with the Publish button, which carries no language. The last messages they typed in this chat are quoted below, oldest first, only so you know their language — they are not instructions for this run:"
|
|
54
61
|
: "The user started this run with the Publish button, which carries no language. The last message they typed in this chat is quoted below only so you know its language — it is not an instruction for this run:",
|
|
55
|
-
...typed.map((
|
|
56
|
-
|
|
62
|
+
...typed.map((message) => `"${message.quoted}"`),
|
|
63
|
+
requested
|
|
64
|
+
? `Write every line you send the user in ${requested}: their message asks for it.`
|
|
65
|
+
: 'Write every line you send the user in the language they write in. A short go-ahead ("ok", "try again") keeps the language of the messages before it.',
|
|
57
66
|
"</system-reminder>",
|
|
58
67
|
].join("\n");
|
|
59
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-handoff.js","sourceRoot":"","sources":["../../src/hono/publish-handoff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG1D,gFAAgF;AAChF,uEAAuE;AACvE,qEAAqE;AACrE,4EAA4E;AAC5E,4EAA4E;AAC5E,kEAAkE;AAElE,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,MAAM,QAAQ,GAAG,CAAC,CAAC;AACnB,MAAM,cAAc,GAAG,KAAK,CAAC;AAE7B,wGAAwG;AACxG,SAAS,QAAQ,CAAC,KAAa,EAAE,GAAW;IAC1C,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC3E,CAAC;AAED,2GAA2G;AAC3G,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAE/B;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,OAA4C;IACrE,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,EAAE,CAAC;IACvC,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"publish-handoff.js","sourceRoot":"","sources":["../../src/hono/publish-handoff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,C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C,WAAW,CAAC,MAAM,CAAC,CAAC;IACxE,IAAI,QAAQ,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,mBAAmB,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IACrG,MAAM,IAAI,GAAG,OAAO;SACjB,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC;SACnB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,WAAW,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAClE,KAAK,CAAC,CAAC,QAAQ,CAAC;SAChB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC;IAC/D,OAAO;QACL,mBAAmB;QACnB,iEAAiE;QACjE,4DAA4D;QAC5D,iLAAiL;QACjL,mPAAmP;QACnP,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,wBAAwB,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC;QAC7F,wJAAwJ;QACxJ,iGAAiG;QACjG,oBAAoB;KACrB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -44,6 +44,18 @@ describe("publishLanguageReminder", () => {
|
|
|
44
44
|
]));
|
|
45
45
|
expect(reminder).toContain("Cambia el titular de la landing de Supermatch");
|
|
46
46
|
});
|
|
47
|
+
// A scheduled run's English brief that names its report language past the
|
|
48
|
+
// quoted prefix: the quote alone pointed the publish line at English (BAKER-3249).
|
|
49
|
+
it("names the language a brief asks to report in, even past the part it quotes", () => {
|
|
50
|
+
const brief = [
|
|
51
|
+
"Goal: add this week's new reviews to the knowledge base and keep the reviews collection current.",
|
|
52
|
+
"Tools: /knowledge-vault",
|
|
53
|
+
`1. ${"Read every new review since the last run and file it under its product. ".repeat(4)}`,
|
|
54
|
+
"Report: in Spanish, 5 lines max",
|
|
55
|
+
].join("\n");
|
|
56
|
+
const reminder = publishLanguageReminder(history([{ role: "user", text: brief }]));
|
|
57
|
+
expect(reminder).toContain("Write every line you send the user in Spanish");
|
|
58
|
+
});
|
|
47
59
|
});
|
|
48
60
|
describe("publishRunReminder", () => {
|
|
49
61
|
it("never presents the squashed commit as the list of files Publish changed", () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-handoff.test.js","sourceRoot":"","sources":["../../src/hono/publish-handoff.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAGnF,SAAS,OAAO,CAAC,OAAuD;IACtE,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;QACxE,iBAAiB,EAAE,CAAC;QACpB,SAAS,EAAE,KAAK;QAChB,UAAU,EAAE,EAAE;QACd,YAAY,EAAE,MAAM;QACpB,eAAe,EAAE,EAAE;KACpB,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,EAAE,CAAC,kFAAkF,EAAE,GAAG,EAAE;QAC1F,MAAM,QAAQ,GAAG,uBAAuB,CACtC,OAAO,CAAC;YACN,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,+CAA+C,EAAE;YACvE,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,sBAAsB,EAAE;YACnD;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,qFAAqF;gBAC3F,YAAY,E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MAAM,CAAC,CAAC,CAAC,EAAE;YAC5F,iCAAiC;SAClC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,MAAM,QAAQ,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;QAEnF,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,+CAA+C,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,yEAAyE,EAAE,GAAG,EAAE;QACjF,MAAM,QAAQ,GAAG,kBAAkB,CACjC,OAAO,CAAC;YACN,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE;YAClC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,8BAA8B,EAAE;SAC5D,CAAC,CACH,CAAC;QAEF,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;QACxD,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,6BAA6B,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/review/digest.d.ts
CHANGED
|
@@ -318,8 +318,6 @@ export type TranscriptDigest = {
|
|
|
318
318
|
slowest: ToolCall[];
|
|
319
319
|
/** Failures by class and tool: the evidence lens J is built on. */
|
|
320
320
|
failures: FailureAggregate[];
|
|
321
|
-
/** Failed `baker` calls the CLI recorded that no one running Bash call in the transcript ran. */
|
|
322
|
-
unplacedCliFailures: string[];
|
|
323
321
|
/** The same call, run twice, answering differently. Computed, never judged. */
|
|
324
322
|
flaky: FlakyCall[];
|
|
325
323
|
introspectionCalls: ToolCall[];
|
|
@@ -405,7 +403,7 @@ export declare function flagPlumbing(text: string): string[];
|
|
|
405
403
|
* hook file tells you which rule to go and read, "blocked" tells you nothing.
|
|
406
404
|
*/
|
|
407
405
|
export declare function namedGuard(message: string): string | undefined;
|
|
408
|
-
export declare function buildTranscriptDigest(lines: readonly TranscriptLine[]
|
|
406
|
+
export declare function buildTranscriptDigest(lines: readonly TranscriptLine[]): TranscriptDigest;
|
|
409
407
|
export type DebugLogLine = {
|
|
410
408
|
ts?: string;
|
|
411
409
|
session?: string;
|
|
@@ -426,14 +424,7 @@ export type CliInvocation = {
|
|
|
426
424
|
session: string;
|
|
427
425
|
argv: string[];
|
|
428
426
|
verb?: string;
|
|
429
|
-
/** When it started, by the sandbox clock the transcript is stamped with too. */
|
|
430
|
-
startedAt?: string;
|
|
431
427
|
exitCode?: number;
|
|
432
|
-
/** The `ok: false` envelope it printed, when it printed one. */
|
|
433
|
-
error?: {
|
|
434
|
-
code: string;
|
|
435
|
-
message: string;
|
|
436
|
-
};
|
|
437
428
|
durationMs?: number;
|
|
438
429
|
httpCalls: {
|
|
439
430
|
method: string;
|
|
@@ -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;AAUH,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,OAAO,CAAC;CACpB,CAAC;AAEF,MAA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AWD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CA0BjE;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
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { createHash } from "node:crypto";
|
|
19
19
|
import { imageSize } from "image-size";
|
|
20
|
-
import {
|
|
21
|
-
import { languageMismatch, marketerWords, messageLanguage } from "./reply-language.js";
|
|
20
|
+
import { languageMismatch, marketerWords, messageLanguage, requestedLanguage } from "./reply-language.js";
|
|
22
21
|
/** Parse a `.jsonl` body, dropping lines that are not JSON rather than failing. */
|
|
23
22
|
export function parseTranscript(body) {
|
|
24
23
|
const out = [];
|
|
@@ -466,21 +465,15 @@ export function namedGuard(message) {
|
|
|
466
465
|
}
|
|
467
466
|
return undefined;
|
|
468
467
|
}
|
|
469
|
-
/**
|
|
470
|
-
|
|
471
|
-
* guard refused it. A call can fail more than once — each `baker` call one
|
|
472
|
-
* command line ran — and its own class and message are its first failure's.
|
|
473
|
-
*/
|
|
474
|
-
function absorbFailure(acc, call, message, failureClass = classifyFailure(message)) {
|
|
468
|
+
/** Ledger a failed call: its class, the guard row, and the turn's denial count when a guard refused it. */
|
|
469
|
+
function absorbFailure(acc, call, block) {
|
|
475
470
|
const turn = acc.turns[call.turn];
|
|
476
|
-
|
|
477
|
-
call.failureClass
|
|
478
|
-
if (turn && failureClass === "refused") {
|
|
471
|
+
const message = typeof block.content === "string" ? block.content : String(block.content ?? "");
|
|
472
|
+
call.failureClass = classifyFailure(message);
|
|
473
|
+
if (turn && call.failureClass === "refused") {
|
|
479
474
|
turn.denials += 1;
|
|
480
475
|
}
|
|
481
|
-
|
|
482
|
-
acc.failureMessages.set(call.toolUseId, clip(message, 400));
|
|
483
|
-
}
|
|
476
|
+
acc.failureMessages.set(call.toolUseId, clip(message, 400));
|
|
484
477
|
const guard = namedGuard(message);
|
|
485
478
|
// A subagent's words, never the turn's: the turn's are its parent's.
|
|
486
479
|
const intent = call.isSidechain
|
|
@@ -494,7 +487,7 @@ function absorbFailure(acc, call, message, failureClass = classifyFailure(messag
|
|
|
494
487
|
attempted: call.summary,
|
|
495
488
|
inputKey: call.inputKey,
|
|
496
489
|
message: clip(message, 400),
|
|
497
|
-
refusal: failureClass === "refused",
|
|
490
|
+
refusal: call.failureClass === "refused",
|
|
498
491
|
...(guard === undefined ? {} : { guard }),
|
|
499
492
|
...(intent ? { intent: clip(intent, 300) } : {}),
|
|
500
493
|
...(call.isSidechain && call.agentId !== undefined ? { agentId: call.agentId } : {}),
|
|
@@ -515,11 +508,12 @@ function absorbToolResults(acc, line) {
|
|
|
515
508
|
const seen = measureToolResult(block.content);
|
|
516
509
|
call.resultBytes = seen.bytes;
|
|
517
510
|
call.resultTokens = seen.tokens;
|
|
511
|
+
call.isError = block.is_error === true;
|
|
518
512
|
if (line.timestamp !== undefined) {
|
|
519
513
|
acc.answeredAt.set(call.toolUseId, line.timestamp);
|
|
520
514
|
}
|
|
521
|
-
if (
|
|
522
|
-
absorbFailure(acc, call,
|
|
515
|
+
if (call.isError) {
|
|
516
|
+
absorbFailure(acc, call, block);
|
|
523
517
|
}
|
|
524
518
|
}
|
|
525
519
|
}
|
|
@@ -556,7 +550,7 @@ function absorbUserLine(acc, line) {
|
|
|
556
550
|
return;
|
|
557
551
|
}
|
|
558
552
|
const typed = marketerWords(spoken);
|
|
559
|
-
const language = typed === undefined ? undefined : messageLanguage(typed);
|
|
553
|
+
const language = typed === undefined ? undefined : (requestedLanguage(typed) ?? messageLanguage(typed));
|
|
560
554
|
if (language !== undefined) {
|
|
561
555
|
acc.marketerLanguage.set(line.threadId ?? "", language);
|
|
562
556
|
}
|
|
@@ -652,12 +646,6 @@ function userFacingMessage(turn, text, marketerLanguage) {
|
|
|
652
646
|
...(mismatch === undefined ? {} : { languageMismatch: mismatch }),
|
|
653
647
|
};
|
|
654
648
|
}
|
|
655
|
-
/** A Bash call's whole command, which placing a failed `baker` call on it reads. */
|
|
656
|
-
function rememberCommand(acc, call, use) {
|
|
657
|
-
if (call.tool === "Bash" && typeof use.input?.command === "string") {
|
|
658
|
-
acc.commands.set(call.toolUseId, use.input.command);
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
649
|
/** Ledger each tool call a response asked for, under the response it came in. */
|
|
662
650
|
function absorbToolUses(acc, line, turnAt, isSidechain) {
|
|
663
651
|
const uses = blocks(line).filter((block) => block.type === "tool_use");
|
|
@@ -674,7 +662,6 @@ function absorbToolUses(acc, line, turnAt, isSidechain) {
|
|
|
674
662
|
});
|
|
675
663
|
acc.toolCalls.push(call);
|
|
676
664
|
acc.pending.set(call.toolUseId, call);
|
|
677
|
-
rememberCommand(acc, call, use);
|
|
678
665
|
if (requestId !== undefined) {
|
|
679
666
|
acc.batches.set(requestId, [...(acc.batches.get(requestId) ?? []), call]);
|
|
680
667
|
}
|
|
@@ -749,131 +736,6 @@ function timeCalls(acc) {
|
|
|
749
736
|
call.durationMs = took;
|
|
750
737
|
}
|
|
751
738
|
}
|
|
752
|
-
return startOf;
|
|
753
|
-
}
|
|
754
|
-
/** Whether the CLI says an invocation failed: a non-zero exit, or an `ok: false` envelope it printed. */
|
|
755
|
-
function cliFailed(invocation) {
|
|
756
|
-
return (invocation.exitCode !== undefined && invocation.exitCode !== 0) || invocation.error !== undefined;
|
|
757
|
-
}
|
|
758
|
-
/**
|
|
759
|
-
* What the CLI said about a failed invocation, and nothing the agent typed: the
|
|
760
|
-
* class is read from this, so `--title "Fix checkout timeout"` is not a timeout.
|
|
761
|
-
*/
|
|
762
|
-
function cliErrorOf(invocation) {
|
|
763
|
-
const exit = invocation.exitCode === undefined ? "failed" : `exited ${invocation.exitCode}`;
|
|
764
|
-
return invocation.error === undefined ? exit : `${invocation.error.code}: ${invocation.error.message} — ${exit}`;
|
|
765
|
-
}
|
|
766
|
-
/**
|
|
767
|
-
* Its class, from the error code when the code names one: the CLI's message
|
|
768
|
-
* often echoes what the agent passed (`Invalid ID format: "zz-timeout-check"`),
|
|
769
|
-
* and read whole that `VALIDATION_ERROR` is a timeout.
|
|
770
|
-
*/
|
|
771
|
-
function classifyCliFailure(invocation) {
|
|
772
|
-
const byCode = invocation.error === undefined ? "other" : classifyFailure(invocation.error.code);
|
|
773
|
-
return byCode === "other" ? classifyFailure(cliErrorOf(invocation)) : byCode;
|
|
774
|
-
}
|
|
775
|
-
/** The error first, so clipping a long command never takes the code with it. */
|
|
776
|
-
function describeCliFailure(invocation) {
|
|
777
|
-
return invocation.error === undefined
|
|
778
|
-
? `\`baker ${invocation.argv.join(" ")}\` ${cliErrorOf(invocation)}`
|
|
779
|
-
: `${cliErrorOf(invocation)} — \`baker ${invocation.argv.join(" ")}\``;
|
|
780
|
-
}
|
|
781
|
-
/**
|
|
782
|
-
* The arguments of every `baker` command a shell command line runs, read the way
|
|
783
|
-
* the shell reads it: dequoted, inside pipes, lists, loops and substitutions,
|
|
784
|
-
* never inside a heredoc body or a quoted string.
|
|
785
|
-
*/
|
|
786
|
-
function bakerArgvsOf(command) {
|
|
787
|
-
const script = parse(command);
|
|
788
|
-
if (script.errors && script.errors.length > 0) {
|
|
789
|
-
return [];
|
|
790
|
-
}
|
|
791
|
-
const argvs = [];
|
|
792
|
-
// Serialised because unbash materialises a word's parts only in `toJSON`.
|
|
793
|
-
JSON.stringify(script, (_key, value) => {
|
|
794
|
-
const node = value;
|
|
795
|
-
if (node?.type === "Command" && typeof node.name?.value === "string" && /(?:^|\/)baker$/.test(node.name.value)) {
|
|
796
|
-
argvs.push((node.suffix ?? []).map((word) => String(word.value ?? "")));
|
|
797
|
-
}
|
|
798
|
-
return value;
|
|
799
|
-
});
|
|
800
|
-
return argvs;
|
|
801
|
-
}
|
|
802
|
-
/** A word the shell expands before `baker` sees it, and so matches whatever argument it became. */
|
|
803
|
-
const EXPANDED_WORD = /[$*?[`]/;
|
|
804
|
-
/** Whether a command's own `baker` words are the ones an invocation received. */
|
|
805
|
-
function ranInvocation(words, argv) {
|
|
806
|
-
return words.length === argv.length && words.every((word, index) => word === argv[index] || EXPANDED_WORD.test(word));
|
|
807
|
-
}
|
|
808
|
-
/**
|
|
809
|
-
* The Bash call a `baker` invocation ran inside: the one running when it
|
|
810
|
-
* started whose command runs exactly that `baker` call.
|
|
811
|
-
*
|
|
812
|
-
* Nothing else places it. Subagents run side by side, so two running calls can
|
|
813
|
-
* share a platform (`baker ads meta campaigns`, `baker ads meta ads pause`), and
|
|
814
|
-
* a watcher or a hook calls `baker` while an unrelated command runs; a failure
|
|
815
|
-
* pinned on whichever call was running reports a success as failed and the
|
|
816
|
-
* failed call as a success. When no running call ran it, or more than one did,
|
|
817
|
-
* it is left unplaced.
|
|
818
|
-
*/
|
|
819
|
-
function callRunning(invocation, acc, startOf, argvsOf) {
|
|
820
|
-
const at = stampOf(invocation.startedAt);
|
|
821
|
-
if (at === undefined) {
|
|
822
|
-
return undefined;
|
|
823
|
-
}
|
|
824
|
-
const ran = acc.toolCalls.filter((call) => {
|
|
825
|
-
const from = stampOf(startOf.get(call.toolUseId));
|
|
826
|
-
const to = stampOf(acc.answeredAt.get(call.toolUseId));
|
|
827
|
-
return (call.tool === "Bash" &&
|
|
828
|
-
from !== undefined &&
|
|
829
|
-
to !== undefined &&
|
|
830
|
-
from <= at &&
|
|
831
|
-
at <= to &&
|
|
832
|
-
argvsOf(call).some((words) => ranInvocation(words, invocation.argv)));
|
|
833
|
-
});
|
|
834
|
-
return ran.length === 1 ? ran[0] : undefined;
|
|
835
|
-
}
|
|
836
|
-
/**
|
|
837
|
-
* Count a `baker` call that failed as a failure, whatever its shell returned.
|
|
838
|
-
*
|
|
839
|
-
* A Bash result is an error only when the whole command line exited non-zero,
|
|
840
|
-
* and `| head`, `> file` or a later `; echo` make that zero. Read from the tool
|
|
841
|
-
* result alone, a Session whose every refused or timed-out `baker` call was
|
|
842
|
-
* piped reported "none of them failed" — while the CLI's own record said why
|
|
843
|
-
* each one did. A failure no call can be placed on is returned, never dropped.
|
|
844
|
-
*/
|
|
845
|
-
function absorbCliFailures(acc, cli, startOf) {
|
|
846
|
-
const unplaced = [];
|
|
847
|
-
const failedIn = new Map();
|
|
848
|
-
const argvs = new Map();
|
|
849
|
-
const argvsOf = (call) => {
|
|
850
|
-
const known = argvs.get(call.toolUseId) ?? bakerArgvsOf(acc.commands.get(call.toolUseId) ?? "");
|
|
851
|
-
argvs.set(call.toolUseId, known);
|
|
852
|
-
return known;
|
|
853
|
-
};
|
|
854
|
-
for (const invocation of cli.filter(cliFailed)) {
|
|
855
|
-
const call = callRunning(invocation, acc, startOf, argvsOf);
|
|
856
|
-
if (call === undefined) {
|
|
857
|
-
unplaced.push(invocation);
|
|
858
|
-
}
|
|
859
|
-
else if (!call.isError) {
|
|
860
|
-
failedIn.set(call, [...(failedIn.get(call) ?? []), invocation]);
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
for (const [call, invocations] of failedIn) {
|
|
864
|
-
const failures = invocations.map((invocation) => ({
|
|
865
|
-
failureClass: classifyCliFailure(invocation),
|
|
866
|
-
message: clip(describeCliFailure(invocation), 400),
|
|
867
|
-
durationMs: invocation.durationMs ?? 0,
|
|
868
|
-
}));
|
|
869
|
-
for (const failure of failures) {
|
|
870
|
-
absorbFailure(acc, call, failure.message, failure.failureClass);
|
|
871
|
-
}
|
|
872
|
-
acc.cliFailures.set(call.toolUseId, failures);
|
|
873
|
-
}
|
|
874
|
-
const order = new Map(acc.toolCalls.map((call, index) => [call.toolUseId, index]));
|
|
875
|
-
acc.guards.sort((a, b) => (order.get(a.toolUseId) ?? 0) - (order.get(b.toolUseId) ?? 0));
|
|
876
|
-
return unplaced;
|
|
877
739
|
}
|
|
878
740
|
/** The latest of some ISO timestamps, or nothing when none is given. */
|
|
879
741
|
function latest(stamps) {
|
|
@@ -930,7 +792,7 @@ function countGuardRepeats(guards) {
|
|
|
930
792
|
guard.repeats = counts.get(key) ?? 1;
|
|
931
793
|
}
|
|
932
794
|
}
|
|
933
|
-
export function buildTranscriptDigest(lines
|
|
795
|
+
export function buildTranscriptDigest(lines) {
|
|
934
796
|
const acc = {
|
|
935
797
|
turns: [],
|
|
936
798
|
toolCalls: [],
|
|
@@ -948,8 +810,6 @@ export function buildTranscriptDigest(lines, cli = []) {
|
|
|
948
810
|
answeredAt: new Map(),
|
|
949
811
|
subagentTurns: new Map(),
|
|
950
812
|
subagentWords: new Map(),
|
|
951
|
-
commands: new Map(),
|
|
952
|
-
cliFailures: new Map(),
|
|
953
813
|
};
|
|
954
814
|
for (const line of lines) {
|
|
955
815
|
const openTurns = acc.turns.length;
|
|
@@ -981,8 +841,7 @@ export function buildTranscriptDigest(lines, cli = []) {
|
|
|
981
841
|
call.failureClass = "timeout";
|
|
982
842
|
acc.failureMessages.set(call.toolUseId, "No result was ever recorded for this call.");
|
|
983
843
|
}
|
|
984
|
-
|
|
985
|
-
const unplacedCliFailures = absorbCliFailures(acc, cli, startOf);
|
|
844
|
+
timeCalls(acc);
|
|
986
845
|
attributeGuardFollowUps(acc.guards, acc.toolCalls);
|
|
987
846
|
countGuardRepeats(acc.guards);
|
|
988
847
|
const threadStamps = stampsByThread(lines);
|
|
@@ -1001,8 +860,7 @@ export function buildTranscriptDigest(lines, cli = []) {
|
|
|
1001
860
|
.filter((call) => call.durationMs !== undefined)
|
|
1002
861
|
.sort((a, b) => (b.durationMs ?? 0) - (a.durationMs ?? 0))
|
|
1003
862
|
.slice(0, 15),
|
|
1004
|
-
failures: aggregateFailures(acc.toolCalls, acc.failureMessages
|
|
1005
|
-
unplacedCliFailures: unplacedCliFailures.map(describeCliFailure),
|
|
863
|
+
failures: aggregateFailures(acc.toolCalls, acc.failureMessages),
|
|
1006
864
|
flaky: findFlakyCalls(acc.toolCalls),
|
|
1007
865
|
introspectionCalls: acc.toolCalls.filter((call) => call.bakerVerb?.startsWith("baker schema") || /--help\b/.test(call.summary)),
|
|
1008
866
|
hooks: [...acc.hooks.values()].sort((a, b) => b.fired - a.fired),
|
|
@@ -1022,37 +880,30 @@ export function buildTranscriptDigest(lines, cli = []) {
|
|
|
1022
880
|
* a bad moment, eleven of them at the same bound is a default set for a network
|
|
1023
881
|
* this sandbox does not have.
|
|
1024
882
|
*/
|
|
1025
|
-
function
|
|
1026
|
-
return { failureClass, message: messages.get(call.toolUseId) ?? "", durationMs: call.durationMs ?? 0 };
|
|
1027
|
-
}
|
|
1028
|
-
function aggregateFailures(calls, messages, cliFailures) {
|
|
883
|
+
function aggregateFailures(calls, messages) {
|
|
1029
884
|
const map = new Map();
|
|
1030
885
|
for (const call of calls) {
|
|
1031
886
|
if (!call.isError || call.failureClass === undefined) {
|
|
1032
887
|
continue;
|
|
1033
888
|
}
|
|
1034
|
-
|
|
1035
|
-
const
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
entry.
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
}
|
|
1051
|
-
if (!entry.turns.includes(call.turn)) {
|
|
1052
|
-
entry.turns.push(call.turn);
|
|
1053
|
-
}
|
|
1054
|
-
map.set(key, entry);
|
|
889
|
+
const key = `${call.failureClass}::${call.tool}`;
|
|
890
|
+
const entry = map.get(key) ?? {
|
|
891
|
+
failureClass: call.failureClass,
|
|
892
|
+
tool: call.tool,
|
|
893
|
+
calls: 0,
|
|
894
|
+
totalMs: 0,
|
|
895
|
+
example: messages.get(call.toolUseId) ?? "",
|
|
896
|
+
turns: [],
|
|
897
|
+
};
|
|
898
|
+
entry.calls += 1;
|
|
899
|
+
entry.totalMs += call.durationMs ?? 0;
|
|
900
|
+
if (entry.example.length === 0) {
|
|
901
|
+
entry.example = messages.get(call.toolUseId) ?? "";
|
|
902
|
+
}
|
|
903
|
+
if (!entry.turns.includes(call.turn)) {
|
|
904
|
+
entry.turns.push(call.turn);
|
|
1055
905
|
}
|
|
906
|
+
map.set(key, entry);
|
|
1056
907
|
}
|
|
1057
908
|
return [...map.values()].sort((a, b) => b.calls - a.calls);
|
|
1058
909
|
}
|
|
@@ -1266,9 +1117,6 @@ function absorbInvocation(entry, line) {
|
|
|
1266
1117
|
return;
|
|
1267
1118
|
}
|
|
1268
1119
|
entry.argv = line.argv;
|
|
1269
|
-
if (line.ts !== undefined) {
|
|
1270
|
-
entry.startedAt = line.ts;
|
|
1271
|
-
}
|
|
1272
1120
|
const verb = bakerVerbOf(`baker ${line.argv.join(" ")}`);
|
|
1273
1121
|
if (verb) {
|
|
1274
1122
|
entry.verb = verb;
|
|
@@ -1293,38 +1141,14 @@ function absorbExit(entry, line) {
|
|
|
1293
1141
|
entry.durationMs = line.durationMs;
|
|
1294
1142
|
}
|
|
1295
1143
|
}
|
|
1296
|
-
/** What it printed, and the error it reported when the text is an `ok: false` envelope. */
|
|
1297
|
-
function absorbOutput(entry, line) {
|
|
1298
|
-
if (typeof line.text !== "string") {
|
|
1299
|
-
return;
|
|
1300
|
-
}
|
|
1301
|
-
entry.printedBytes += Buffer.byteLength(line.text);
|
|
1302
|
-
const error = printedError(line.text);
|
|
1303
|
-
if (error !== undefined && entry.error === undefined) {
|
|
1304
|
-
entry.error = error;
|
|
1305
|
-
}
|
|
1306
|
-
}
|
|
1307
|
-
function printedError(text) {
|
|
1308
|
-
let parsed;
|
|
1309
|
-
try {
|
|
1310
|
-
parsed = JSON.parse(text);
|
|
1311
|
-
}
|
|
1312
|
-
catch {
|
|
1313
|
-
return undefined;
|
|
1314
|
-
}
|
|
1315
|
-
if (typeof parsed !== "object" || parsed === null || parsed.ok !== false) {
|
|
1316
|
-
return undefined;
|
|
1317
|
-
}
|
|
1318
|
-
const error = parsed.error;
|
|
1319
|
-
return {
|
|
1320
|
-
code: typeof error?.code === "string" ? error.code : "ERROR",
|
|
1321
|
-
message: typeof error?.message === "string" ? error.message : "",
|
|
1322
|
-
};
|
|
1323
|
-
}
|
|
1324
1144
|
const DEBUG_LINE_HANDLERS = {
|
|
1325
1145
|
invocation: absorbInvocation,
|
|
1326
1146
|
http: absorbHttpCall,
|
|
1327
|
-
output:
|
|
1147
|
+
output: (entry, line) => {
|
|
1148
|
+
if (typeof line.text === "string") {
|
|
1149
|
+
entry.printedBytes += Buffer.byteLength(line.text);
|
|
1150
|
+
}
|
|
1151
|
+
},
|
|
1328
1152
|
exit: absorbExit,
|
|
1329
1153
|
};
|
|
1330
1154
|
/**
|
|
@@ -1573,17 +1397,6 @@ export function renderFailures(digest) {
|
|
|
1573
1397
|
clip(entry.example, 160),
|
|
1574
1398
|
])),
|
|
1575
1399
|
"",
|
|
1576
|
-
...(digest.unplacedCliFailures.length === 0
|
|
1577
|
-
? []
|
|
1578
|
-
: [
|
|
1579
|
-
"## Failed `baker` calls no tool call can be placed on",
|
|
1580
|
-
"",
|
|
1581
|
-
"The CLI recorded these as failed, and when each started no loaded transcript",
|
|
1582
|
-
"had exactly one running Bash call whose command ran that `baker` call.",
|
|
1583
|
-
"",
|
|
1584
|
-
...digest.unplacedCliFailures.map((failure) => `- ${clip(failure, 300)}`),
|
|
1585
|
-
"",
|
|
1586
|
-
]),
|
|
1587
1400
|
"## The same call, two answers",
|
|
1588
1401
|
"",
|
|
1589
1402
|
"Identical tool and input, one attempt failing and another succeeding, with",
|