Fetch command output the server left out, for the open row and Copy output

This commit is contained in:
Callum Alpass committed 2026-11-02 23:19:54 +11:00
1 parent 81a1ee942c
commit 3ef67c5b50
5 files changed
+103 -8

No files matched your search

+25 -1
View File
@@ -1,6 +1,6 @@
import { afterEach, describe, expect, test } from "bun:test";
import { withApproval, withQuestion } from "./fixtures.ts";
import { omittedCommand, withApproval, withOmittedOutput, withQuestion } from "./fixtures.ts";
import { loadLayout } from "../../src/layout.ts";
import { fakeSession, renderApp, v2ThreadId } from "./harness.tsx";
@@ -243,6 +243,30 @@ describe("connection", () => {
});
});
describe("command output", () => {
const session = () => fakeSession({ projection: withOmittedOutput(), results: { turnItem: { ...omittedCommand, outputOmitted: false, output: "12 pass\n0 fail" } } });
test("output the server left out loads when the command opens", async () => {
const app = await open({ session: session() });
const row = app.find("bun test");
await app.click(row.x, row.y);
await app.settle(50);
expect(app.calls("turnItem").map((call) => call.args)).toEqual([[omittedCommand.threadId, omittedCommand.id]]);
expect(app.frame()).toContain("12 pass");
});
test("Copy output fetches it first", async () => {
const app = await open({ session: session() });
const row = app.find("bun test");
await app.click(row.x, row.y, 2);
await app.type("copy output");
await app.press("return");
await app.settle(50);
expect(app.calls("turnItem")).toHaveLength(1);
expect(app.hints()).toBe("Copied the output");
});
});
describe("mouse", () => {
test("the header button opens the palette", async () => {
const app = await open();
+30
View File
@@ -31,3 +31,33 @@ export function withQuestion(): OrchestrationV2ThreadProjection {
],
} as unknown as OrchestrationV2ThreadProjection;
}
/** A finished command whose long output the server left out of the thread. */
export const omittedCommand = {
id: "item-cmd",
threadId: v2Projection.thread.id,
runId: null,
nodeId: null,
providerThreadId: null,
providerTurnId: null,
nativeItemRef: null,
parentItemId: null,
ordinal: 0,
status: "completed",
title: null,
startedAt: at,
completedAt: at,
updatedAt: at,
type: "command_execution",
input: "bun test",
outputOmitted: true,
exitCode: 0,
} as const;
export function withOmittedOutput(): OrchestrationV2ThreadProjection {
return {
...v2Projection,
turnItems: [omittedCommand],
visibleTurnItems: [{ position: 0, visibility: "local", sourceThreadId: omittedCommand.threadId, sourceItemId: omittedCommand.id, item: omittedCommand }],
} as unknown as OrchestrationV2ThreadProjection;
}