Live status pinned above the composer
This commit is contained in:
1 parent
3a7c183e1c
commit
bb6d67ec1b
6 files changed
+83
-21
No files matched your search
+18
-1
@@ -1,6 +1,6 @@
|
||||
import { afterEach, describe, expect, test } from "bun:test";
|
||||
|
||||
import { omittedCommand, withApproval, withCompletedTurn, withOmittedOutput, withQuestion } from "./fixtures.ts";
|
||||
import { omittedCommand, withApproval, withCompletedTurn, withOmittedOutput, withQuestion, withWorking } from "./fixtures.ts";
|
||||
import { loadLayout } from "../../src/layout.ts";
|
||||
import { fakeSession, renderApp, v2ThreadId } from "./harness.tsx";
|
||||
|
||||
@@ -163,6 +163,23 @@ describe("a finished turn", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("live status", () => {
|
||||
test("while working, one status line sits above the composer and none in the timeline", async () => {
|
||||
const app = await open({ session: fakeSession({ projection: withWorking() }) });
|
||||
const frame = app.frame();
|
||||
expect(frame).toMatch(/[⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏] Working for /);
|
||||
expect(frame.split("Working for")).toHaveLength(2);
|
||||
expect(frame).not.toContain("◐");
|
||||
const lines = frame.split("\n");
|
||||
const status = lines.findIndex((line) => line.includes("Working for"));
|
||||
const composer = lines.findIndex((line) => line.includes("Press i to type"));
|
||||
expect(status).toBeGreaterThan(-1);
|
||||
expect(status).toBeLessThan(composer);
|
||||
// The live tool itself stays a timeline row.
|
||||
expect(frame).toContain("Running bun");
|
||||
});
|
||||
});
|
||||
|
||||
describe("approvals", () => {
|
||||
test("the request shows in the composer's place, with its buttons, and not in the timeline", async () => {
|
||||
const app = await open({ session: fakeSession({ projection: withApproval() }) });
|
||||
|
||||
@@ -130,6 +130,35 @@ export function withCompletedTurn(): OrchestrationV2ThreadProjection {
|
||||
} as unknown as OrchestrationV2ThreadProjection;
|
||||
}
|
||||
|
||||
/** A thread mid-run, with a command under way. */
|
||||
export function withWorking(): OrchestrationV2ThreadProjection {
|
||||
const base = {
|
||||
threadId: v2Projection.thread.id,
|
||||
runId: "run-1",
|
||||
nodeId: null,
|
||||
providerThreadId: null,
|
||||
providerTurnId: null,
|
||||
nativeItemRef: null,
|
||||
parentItemId: null,
|
||||
title: null,
|
||||
};
|
||||
const turnItems = [
|
||||
{ ...base, id: "item-user", ordinal: 0, status: "completed", startedAt: at, completedAt: at, updatedAt: at, type: "user_message", createdBy: "user", creationSource: "web", messageId: "msg-user-1", inputIntent: "turn_start", text: "Run the tests", attachments: [] },
|
||||
{ ...base, id: "item-cmd", ordinal: 1, status: "running", startedAt: after(10), completedAt: null, updatedAt: after(10), type: "command_execution", input: "bun test", output: "" },
|
||||
];
|
||||
return {
|
||||
...v2Projection,
|
||||
runs: [
|
||||
{ id: "run-1", threadId: v2Projection.thread.id, ordinal: 1, providerInstanceId: "codex", modelSelection: { instanceId: "codex", model: "gpt-5.4" }, providerThreadId: null, userMessageId: "msg-user-1", rootNodeId: null, activeAttemptId: null, status: "running", requestedAt: at, startedAt: at, completedAt: null, checkpointId: null, contextHandoffId: null },
|
||||
],
|
||||
messages: [
|
||||
{ createdBy: "user", creationSource: "web", id: "msg-user-1", threadId: v2Projection.thread.id, runId: "run-1", nodeId: null, role: "user", text: "Run the tests", attachments: [], streaming: false, createdAt: at, updatedAt: at },
|
||||
],
|
||||
turnItems,
|
||||
visibleTurnItems: turnItems.map((item, position) => ({ position, visibility: "local", sourceThreadId: v2Projection.thread.id, sourceItemId: item.id, item })),
|
||||
} as unknown as OrchestrationV2ThreadProjection;
|
||||
}
|
||||
|
||||
export function withOmittedOutput(): OrchestrationV2ThreadProjection {
|
||||
return {
|
||||
...v2Projection,
|
||||
|
||||
Reference in new issue
Block a user