Changed files under each reply, with a turn footer

This commit is contained in:
Callum Alpass committed 2026-11-03 00:46:30 +11:00
1 parent b70099f23f
commit 49b04f9012
6 files changed
+215 -9

No files matched your search

+53
View File
@@ -4,6 +4,8 @@ import * as DateTime from "effect/DateTime";
import { v2Projection } from "../../vendor/t3code/packages/client-runtime/src/state/orchestrationV2TestFixtures.ts";
const at = DateTime.makeUnsafe("2026-06-20T00:00:00.000Z");
/** `seconds` after the fixture's start. */
const after = (seconds: number) => DateTime.makeUnsafe(DateTime.toEpochMillis(at) + seconds * 1_000);
/** The thread with a command waiting for approval. */
export function withApproval(supportsFeedback = false): OrchestrationV2ThreadProjection {
@@ -54,6 +56,57 @@ export const omittedCommand = {
exitCode: 0,
} as const;
/** A finished turn: one prompt, one reply 3m 12s later, and a checkpoint of three changed files. */
export function withCompletedTurn(): 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: "Do the thing", attachments: [] },
{ ...base, id: "item-edit", ordinal: 1, status: "completed", startedAt: after(60), completedAt: after(65), updatedAt: after(65), type: "file_change", fileName: "src/index.ts", additions: 30, deletions: 5 },
{ ...base, id: "item-assistant", ordinal: 2, status: "completed", startedAt: after(192), completedAt: after(192), updatedAt: after(192), type: "assistant_message", messageId: "msg-assistant-1", text: "Done — the thing is done.", streaming: false },
];
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: "completed", requestedAt: at, startedAt: at, completedAt: after(192), checkpointId: "checkpoint-1", contextHandoffId: null },
],
messages: [
{ createdBy: "user", creationSource: "web", id: "msg-user-1", threadId: v2Projection.thread.id, runId: "run-1", nodeId: null, role: "user", text: "Do the thing", attachments: [], streaming: false, createdAt: at, updatedAt: at },
{ createdBy: "user", creationSource: "web", id: "msg-assistant-1", threadId: v2Projection.thread.id, runId: "run-1", nodeId: null, role: "assistant", text: "Done — the thing is done.", attachments: [], streaming: false, createdAt: after(192), updatedAt: after(192) },
],
checkpoints: [
{
id: "checkpoint-1",
threadId: v2Projection.thread.id,
scopeId: "scope-1",
runId: "run-1",
nodeId: null,
parentCheckpointId: null,
ordinalWithinScope: 0,
appRunOrdinal: 1,
ref: "refs/t3/checkpoint-1",
status: "ready",
files: [
{ path: "src/index.ts", kind: "modified", additions: 30, deletions: 5 },
{ path: "src/util.ts", kind: "modified", additions: 10, deletions: 2 },
{ path: "README.md", kind: "modified", additions: 2, deletions: 0 },
],
capturedAt: after(192),
},
],
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,