@koda-sl/baker-bridge 0.192.0-dev.119a96955 → 0.192.0-dev.8d6f5633e
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 +2 -15
- package/dist/broker/baker-api.d.ts +7 -0
- package/dist/broker/baker-api.d.ts.map +1 -1
- package/dist/broker/baker-api.js +6 -1
- package/dist/broker/baker-api.js.map +1 -1
- package/dist/broker/credential-text.d.ts +2 -0
- package/dist/broker/credential-text.d.ts.map +1 -1
- package/dist/broker/credential-text.js.map +1 -1
- package/dist/broker/proxy.d.ts.map +1 -1
- package/dist/broker/proxy.integration.test.js +57 -2
- package/dist/broker/proxy.integration.test.js.map +1 -1
- package/dist/broker/proxy.js +97 -6
- package/dist/broker/proxy.js.map +1 -1
- package/dist/broker/usage-reporter.d.ts +9 -5
- package/dist/broker/usage-reporter.d.ts.map +1 -1
- package/dist/broker/usage-reporter.js +20 -4
- package/dist/broker/usage-reporter.js.map +1 -1
- package/dist/broker/usage-reporter.test.js +42 -3
- package/dist/broker/usage-reporter.test.js.map +1 -1
- package/dist/hono/bridge-job.d.ts.map +1 -1
- package/dist/hono/bridge-job.js +15 -35
- package/dist/hono/bridge-job.js.map +1 -1
- package/dist/hono/bridge-job.test.js +60 -96
- package/dist/hono/bridge-job.test.js.map +1 -1
- package/dist/hono/connection-input.d.ts.map +1 -1
- package/dist/hono/connection-input.js +6 -5
- package/dist/hono/connection-input.js.map +1 -1
- package/dist/hono/progress-note.d.ts +6 -0
- package/dist/hono/progress-note.d.ts.map +1 -0
- package/dist/hono/progress-note.js +25 -0
- package/dist/hono/progress-note.js.map +1 -0
- package/dist/hono/publish-handoff.d.ts +0 -5
- package/dist/hono/publish-handoff.d.ts.map +1 -1
- package/dist/hono/publish-handoff.js +6 -18
- package/dist/hono/publish-handoff.js.map +1 -1
- package/dist/hono/skill-language.d.ts +4 -3
- package/dist/hono/skill-language.d.ts.map +1 -1
- package/dist/hono/skill-language.js +14 -5
- package/dist/hono/skill-language.js.map +1 -1
- package/package.json +1 -1
|
@@ -510,6 +510,49 @@ describe("BridgeJobExecutor", () => {
|
|
|
510
510
|
},
|
|
511
511
|
]);
|
|
512
512
|
});
|
|
513
|
+
it("previews a progress note streamed as thinking, and not the empty reasoning", async () => {
|
|
514
|
+
const previewed = [];
|
|
515
|
+
const relay = { ...recordingRelay(), previewText: (_target, delta) => previewed.push(delta) };
|
|
516
|
+
const executor = createExecutor({
|
|
517
|
+
relay,
|
|
518
|
+
model: "claude-opus-5-5",
|
|
519
|
+
queryResults: [
|
|
520
|
+
scriptedMessages({ type: "stream_event", event: { type: "message_start" } }, {
|
|
521
|
+
type: "stream_event",
|
|
522
|
+
event: { type: "content_block_delta", index: 0, delta: { type: "thinking_delta", thinking: "" } },
|
|
523
|
+
}, {
|
|
524
|
+
type: "stream_event",
|
|
525
|
+
event: {
|
|
526
|
+
type: "content_block_delta",
|
|
527
|
+
index: 1,
|
|
528
|
+
delta: { type: "thinking_delta", thinking: "Found the campaign; checking its budget next." },
|
|
529
|
+
},
|
|
530
|
+
}, resultMessage(0, "session_next")),
|
|
531
|
+
],
|
|
532
|
+
});
|
|
533
|
+
await executor.execute({ threadId: "thread_1", turnId: "turn_1", prompt: "Check it" }, activeControls());
|
|
534
|
+
expect(previewed).toEqual(["Found the campaign; checking its budget next."]);
|
|
535
|
+
});
|
|
536
|
+
it("previews no thinking from a model whose thinking is reasoning, not a note", async () => {
|
|
537
|
+
const previewed = [];
|
|
538
|
+
const relay = { ...recordingRelay(), previewText: (_target, delta) => previewed.push(delta) };
|
|
539
|
+
const executor = createExecutor({
|
|
540
|
+
relay,
|
|
541
|
+
model: "claude-haiku-5-5",
|
|
542
|
+
queryResults: [
|
|
543
|
+
scriptedMessages({ type: "stream_event", event: { type: "message_start" } }, {
|
|
544
|
+
type: "stream_event",
|
|
545
|
+
event: {
|
|
546
|
+
type: "content_block_delta",
|
|
547
|
+
index: 0,
|
|
548
|
+
delta: { type: "thinking_delta", thinking: "The user wants the budget, so first I should look up" },
|
|
549
|
+
},
|
|
550
|
+
}, resultMessage(0, "session_next")),
|
|
551
|
+
],
|
|
552
|
+
});
|
|
553
|
+
await executor.execute({ threadId: "thread_1", turnId: "turn_1", prompt: "Check it" }, activeControls());
|
|
554
|
+
expect(previewed).toEqual([]);
|
|
555
|
+
});
|
|
513
556
|
it("previews a step with the input it streamed, not the empty one it opened with", async () => {
|
|
514
557
|
const relay = recordingRelay();
|
|
515
558
|
const executor = createExecutor({
|
|
@@ -1761,102 +1804,6 @@ describe("BridgeJobExecutor", () => {
|
|
|
1761
1804
|
await executor.execute({ threadId: "thread_skills", turnId: "turn_skills", prompt: "Build a landing", history: history([]) }, activeControls());
|
|
1762
1805
|
expect([...(queryInputs[0]?.options.skills ?? [])].sort()).toEqual(["brand-build", "docx", "landing"]);
|
|
1763
1806
|
});
|
|
1764
|
-
// Publish starts a session of its own, so everything it loads after the shared
|
|
1765
|
-
// system prompt is written to the cache cold. It ran only Bash, Edit and Read in
|
|
1766
|
-
// 52 production publishes: the other skills' listing and the company profile
|
|
1767
|
-
// cost ~6k tokens there and were never used.
|
|
1768
|
-
it("starts a publish told its language with only the publish skill and without the company profile", async () => {
|
|
1769
|
-
const workspace = await mkdtemp(join(tmpdir(), "baker-job-publish-context-"));
|
|
1770
|
-
await writeFile(join(workspace, "CLAUDE.md"), "# Project Instructions\n\n## Client Context\n\nOne client per repo. Everything known about them:\n\n@COMPANY.md\n\n## Rules\n\nStage, don't ask.\n");
|
|
1771
|
-
for (const skill of ["landing", "publish", "docx"]) {
|
|
1772
|
-
await mkdir(join(workspace, ".claude", "skills", skill), { recursive: true });
|
|
1773
|
-
}
|
|
1774
|
-
projectRootMock.value = workspace;
|
|
1775
|
-
const queryInputs = [];
|
|
1776
|
-
const executor = createExecutor({
|
|
1777
|
-
queryInputs,
|
|
1778
|
-
queryResults: [scriptedMessages(resultMessage(0, "session_publish_context"))],
|
|
1779
|
-
});
|
|
1780
|
-
await executor.execute({
|
|
1781
|
-
threadId: "thread_publish_context",
|
|
1782
|
-
turnId: "turn_publish_context",
|
|
1783
|
-
prompt: "/publish",
|
|
1784
|
-
history: history([
|
|
1785
|
-
{
|
|
1786
|
-
role: "user",
|
|
1787
|
-
text: "Crea una landing para la campaña de otoño con el formulario de contacto",
|
|
1788
|
-
createdAt: 1,
|
|
1789
|
-
},
|
|
1790
|
-
]),
|
|
1791
|
-
}, activeControls());
|
|
1792
|
-
const options = queryInputs[0]?.options;
|
|
1793
|
-
expect(options.skills).toEqual(["publish"]);
|
|
1794
|
-
expect(options.settings).toMatchObject({
|
|
1795
|
-
claudeMdExcludes: [join(workspace, "CLAUDE.md"), join(instructionsDirMock.value, "CLAUDE.md")],
|
|
1796
|
-
});
|
|
1797
|
-
});
|
|
1798
|
-
// A publish may edit a landing to get verify green, and the scaffold's hooks
|
|
1799
|
-
// then tell it to spawn `visual-check`; a publish that denied it would be told
|
|
1800
|
-
// to make a call it is sure to have refused.
|
|
1801
|
-
it("leaves the workspace's own subagents spawnable in a publish", async () => {
|
|
1802
|
-
const workspace = await mkdtemp(join(tmpdir(), "baker-job-publish-agents-"));
|
|
1803
|
-
await mkdir(join(workspace, ".claude", "agents"), { recursive: true });
|
|
1804
|
-
await writeFile(join(workspace, ".claude", "agents", "visual-check.md"), "---\nname: visual-check\ndescription: Looks at a page.\n---\n\nLook.\n");
|
|
1805
|
-
projectRootMock.value = workspace;
|
|
1806
|
-
const queryInputs = [];
|
|
1807
|
-
const executor = createExecutor({
|
|
1808
|
-
queryInputs,
|
|
1809
|
-
queryResults: [scriptedMessages(resultMessage(0, "session_publish_agents"))],
|
|
1810
|
-
});
|
|
1811
|
-
await executor.execute({ threadId: "thread_publish_agents", turnId: "turn_publish_agents", prompt: "/publish", history: history([]) }, activeControls());
|
|
1812
|
-
expect(queryInputs[0]?.options.disallowedTools).not.toContain("Agent(visual-check)");
|
|
1813
|
-
});
|
|
1814
|
-
it("resumes a publish that outgrew its window with the same skills and without the company profile", async () => {
|
|
1815
|
-
const workspace = await mkdtemp(join(tmpdir(), "baker-job-publish-resume-context-"));
|
|
1816
|
-
await writeFile(join(workspace, "CLAUDE.md"), "# Project Instructions\n\n## Client Context\n\nOne client per repo. Everything known about them:\n\n@COMPANY.md\n\n## Rules\n\nStage, don't ask.\n");
|
|
1817
|
-
for (const skill of ["landing", "publish", "docx"]) {
|
|
1818
|
-
await mkdir(join(workspace, ".claude", "skills", skill), { recursive: true });
|
|
1819
|
-
}
|
|
1820
|
-
projectRootMock.value = workspace;
|
|
1821
|
-
const queryInputs = [];
|
|
1822
|
-
const executor = createExecutor({
|
|
1823
|
-
queryInputs,
|
|
1824
|
-
queryResults: [
|
|
1825
|
-
contextOverflowQuery({ type: "system", subtype: "init", session_id: "session_publish_resume_live" }, assistantMessage("assistant_publish_resume", "Squashing your work…", "session_publish_resume_live")),
|
|
1826
|
-
scriptedMessages(resultMessage(0.4, "session_publish_resume_live")),
|
|
1827
|
-
],
|
|
1828
|
-
});
|
|
1829
|
-
await executor.execute({
|
|
1830
|
-
threadId: "thread_publish_resume_context",
|
|
1831
|
-
turnId: "turn_publish_resume_context",
|
|
1832
|
-
prompt: "/publish",
|
|
1833
|
-
history: history([
|
|
1834
|
-
{
|
|
1835
|
-
role: "user",
|
|
1836
|
-
text: "Crea una landing para la campaña de otoño con el formulario de contacto",
|
|
1837
|
-
createdAt: 1,
|
|
1838
|
-
},
|
|
1839
|
-
]),
|
|
1840
|
-
}, activeControls());
|
|
1841
|
-
const resumed = queryInputs[1]?.options;
|
|
1842
|
-
expect(resumed.resume).toBe("session_publish_resume_live");
|
|
1843
|
-
expect(resumed.skills).toEqual(["publish"]);
|
|
1844
|
-
expect(resumed.settings).toMatchObject({
|
|
1845
|
-
claudeMdExcludes: [join(workspace, "CLAUDE.md"), join(instructionsDirMock.value, "CLAUDE.md")],
|
|
1846
|
-
});
|
|
1847
|
-
});
|
|
1848
|
-
it("keeps the company profile for a publish Baker could not tell its language", async () => {
|
|
1849
|
-
const workspace = await mkdtemp(join(tmpdir(), "baker-job-publish-profile-"));
|
|
1850
|
-
await writeFile(join(workspace, "CLAUDE.md"), "# Project Instructions\n\n## Client Context\n\nOne client per repo. Everything known about them:\n\n@COMPANY.md\n\n## Rules\n\nStage, don't ask.\n");
|
|
1851
|
-
projectRootMock.value = workspace;
|
|
1852
|
-
const queryInputs = [];
|
|
1853
|
-
const executor = createExecutor({
|
|
1854
|
-
queryInputs,
|
|
1855
|
-
queryResults: [scriptedMessages(resultMessage(0, "session_publish_profile"))],
|
|
1856
|
-
});
|
|
1857
|
-
await executor.execute({ threadId: "thread_publish_profile", turnId: "turn_publish_profile", prompt: "/publish", history: history([]) }, activeControls());
|
|
1858
|
-
expect(queryInputs[0]?.options.settings).toMatchObject({ claudeMdExcludes: [join(workspace, "CLAUDE.md")] });
|
|
1859
|
-
});
|
|
1860
1807
|
it("keeps a typed skill command as the leading token so the SDK runs the skill", async () => {
|
|
1861
1808
|
const workspace = await mkdtemp(join(tmpdir(), "baker-job-skill-command-"));
|
|
1862
1809
|
await mkdir(join(workspace, ".claude", "skills", "audit-google-ads-account"), { recursive: true });
|
|
@@ -5596,6 +5543,23 @@ describe("BridgeJobExecutor review mode", () => {
|
|
|
5596
5543
|
const options = await spanishTurnAfter(apiErrorMessage("a1", "API Error: Server error mid-response. The response above may be incomplete.", "server_error"), assistantMessage("a2", "Ahora reviso el banner de las cuatro landings de verano."));
|
|
5597
5544
|
expect(await contextAfterTool(options, "Read")).toBeUndefined();
|
|
5598
5545
|
});
|
|
5546
|
+
it("names the drift in a progress note Opus 5.5 returned as a thinking block", async () => {
|
|
5547
|
+
const options = await spanishTurnAfter({
|
|
5548
|
+
type: "assistant",
|
|
5549
|
+
uuid: "a1",
|
|
5550
|
+
parent_tool_use_id: null,
|
|
5551
|
+
message: {
|
|
5552
|
+
role: "assistant",
|
|
5553
|
+
model: "claude-opus-5-5",
|
|
5554
|
+
content: [
|
|
5555
|
+
{ type: "thinking", thinking: "", signature: "AAAA" },
|
|
5556
|
+
{ type: "thinking", thinking: "Found the campaign, now checking its budget.", signature: "BBBB" },
|
|
5557
|
+
],
|
|
5558
|
+
stop_reason: "tool_use",
|
|
5559
|
+
},
|
|
5560
|
+
});
|
|
5561
|
+
expect(await contextAfterTool(options, "Read")).toContain("Your last line to the user was not in Spanish.");
|
|
5562
|
+
});
|
|
5599
5563
|
it("names the drift to the main thread, not to a subagent's own tool call", async () => {
|
|
5600
5564
|
const options = await spanishTurnAfter(assistantMessage("a1", "Now the definition, then a live test."));
|
|
5601
5565
|
expect(await contextAfterTool(options, "Read", { agent_id: "agent_1" })).toBeUndefined();
|