Open History to see the last commit
1import type {
2 ModelSelection,
3 OrchestrationV2ThreadShell,
4 ProjectId,
5 RuntimeMode,
6 ThreadId,
7 ThreadLinkedPullRequest,
8 ThreadPullRequestLink,
9} from "@t3tools/contracts";
10import * as DateTime from "effect/DateTime";
11
12/** The thread fields pull request tests set; timestamps are ISO strings. */
13export interface PullRequestTestThread {
14 readonly id: ThreadId;
15 readonly projectId: ProjectId;
16 readonly title: string;
17 readonly modelSelection: ModelSelection;
18 readonly runtimeMode: RuntimeMode;
19 readonly interactionMode: OrchestrationV2ThreadShell["interactionMode"];
20 readonly branch: string | null;
21 readonly worktreePath: string | null;
22 readonly pullRequests: ReadonlyArray<ThreadPullRequestLink>;
23 readonly linkedPullRequest?: ThreadLinkedPullRequest | null;
24 readonly branchPullRequest?: ThreadLinkedPullRequest | null;
25 readonly latestUserMessageAt: string | null;
26 readonly createdAt: string;
27 readonly updatedAt: string;
28 readonly archivedAt: string | null;
29 readonly settledOverride: OrchestrationV2ThreadShell["settledOverride"];
30 readonly settledAt: string | null;
31}
32
33export function v2PullRequestThread(thread: PullRequestTestThread): OrchestrationV2ThreadShell {
34 return {
35 id: thread.id,
36 projectId: thread.projectId,
37 title: thread.title,
38 providerInstanceId: thread.modelSelection.instanceId,
39 modelSelection: thread.modelSelection,
40 runtimeMode: thread.runtimeMode,
41 interactionMode: thread.interactionMode,
42 branch: thread.branch,
43 worktreePath: thread.worktreePath,
44 pullRequests: thread.pullRequests,
45 linkedPullRequest: thread.linkedPullRequest,
46 branchPullRequest: thread.branchPullRequest,
47 createdBy: "user",
48 creationSource: "web",
49 activeProviderThreadId: null,
50 lineage: { rootThreadId: thread.id, parentThreadId: null, relationshipToParent: null },
51 forkedFrom: null,
52 latestRunId: null,
53 activeRunId: null,
54 status: "idle",
55 pendingRuntimeRequest: null,
56 latestVisibleMessage: null,
57 latestUserMessageAt: thread.latestUserMessageAt
58 ? DateTime.makeUnsafe(thread.latestUserMessageAt)
59 : null,
60 hasActionableProposedPlan: false,
61 itemCount: 0,
62 visibleItemCount: 0,
63 createdAt: DateTime.makeUnsafe(thread.createdAt),
64 updatedAt: DateTime.makeUnsafe(thread.updatedAt),
65 archivedAt: thread.archivedAt ? DateTime.makeUnsafe(thread.archivedAt) : null,
66 settledOverride: thread.settledOverride,
67 settledAt: thread.settledAt ? DateTime.makeUnsafe(thread.settledAt) : null,
68 deletedAt: null,
69 };
70}