Repository navigation
Expand file tree
/
Copy pathdraft-thread-shell.ts
More file actions
64 lines (63 loc) · 1.86 KB
/
Copy pathdraft-thread-shell.ts
File metadata and controls
64 lines (63 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import { presentThreadShell } from "@t3tools/client-runtime/state/shell";
import type {
EnvironmentId,
ThreadId,
ProjectId,
ModelSelection,
RuntimeMode,
ProviderInteractionMode,
} from "@t3tools/contracts";
import * as DateTime from "effect/DateTime";
export function draftThreadShell(input: {
readonly environmentId: EnvironmentId;
readonly threadId: ThreadId;
readonly projectId: ProjectId;
readonly modelSelection: ModelSelection;
readonly runtimeMode: RuntimeMode;
readonly interactionMode: ProviderInteractionMode;
readonly branch: string | null;
readonly worktreePath: string | null;
readonly createdAt: string;
}) {
const timestamp = DateTime.makeUnsafe(input.createdAt);
return presentThreadShell(input.environmentId, {
id: input.threadId,
projectId: input.projectId,
title: "New thread",
providerInstanceId: input.modelSelection.instanceId,
modelSelection: input.modelSelection,
runtimeMode: input.runtimeMode,
interactionMode: input.interactionMode,
branch: input.branch,
pullRequests: [],
worktreePath: input.worktreePath,
linkedPullRequest: null,
branchPullRequest: null,
lineage: { rootThreadId: input.threadId, parentThreadId: null, relationshipToParent: null },
forkedFrom: null,
createdBy: "user",
creationSource: "mobile",
activeProviderThreadId: null,
latestRunId: null,
activeRunId: null,
status: "idle",
pendingRuntimeRequest: null,
latestVisibleMessage: null,
latestUserMessageAt: timestamp,
hasActionableProposedPlan: false,
itemCount: 0,
visibleItemCount: 0,
createdAt: timestamp,
updatedAt: timestamp,
archivedAt: null,
settledOverride: null,
settledAt: null,
unsettledAt: null,
snoozedUntil: null,
snoozedAt: null,
pinnedAt: null,
pinOrderKey: null,
activeOrderKey: null,
deletedAt: null,
});
}