The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { presentThreadShell } from "@t3tools/client-runtime/state/shell"; |
| 2 | import type { |
| 3 | EnvironmentId, |
| 4 | ThreadId, |
| 5 | ProjectId, |
| 6 | ModelSelection, |
| 7 | RuntimeMode, |
| 8 | ProviderInteractionMode, |
| 9 | } from "@t3tools/contracts"; |
| 10 | import * as DateTime from "effect/DateTime"; |
| 11 | import { msg } from "gt-react-native"; |
| 12 | |
| 13 | import { m, type MessageResolver } from "../../i18n/messages"; |
| 14 | |
| 15 | export function draftThreadShell( |
| 16 | input: { |
| 17 | readonly environmentId: EnvironmentId; |
| 18 | readonly threadId: ThreadId; |
| 19 | readonly projectId: ProjectId; |
| 20 | readonly modelSelection: ModelSelection; |
| 21 | readonly runtimeMode: RuntimeMode; |
| 22 | readonly interactionMode: ProviderInteractionMode; |
| 23 | readonly branch: string | null; |
| 24 | readonly worktreePath: string | null; |
| 25 | readonly createdAt: string; |
| 26 | }, |
| 27 | resolve: MessageResolver = m, |
| 28 | ) { |
| 29 | const timestamp = DateTime.makeUnsafe(input.createdAt); |
| 30 | return presentThreadShell(input.environmentId, { |
| 31 | id: input.threadId, |
| 32 | projectId: input.projectId, |
| 33 | title: resolve(msg("New thread")), |
| 34 | providerInstanceId: input.modelSelection.instanceId, |
| 35 | modelSelection: input.modelSelection, |
| 36 | runtimeMode: input.runtimeMode, |
| 37 | interactionMode: input.interactionMode, |
| 38 | branch: input.branch, |
| 39 | pullRequests: [], |
| 40 | worktreePath: input.worktreePath, |
| 41 | linkedPullRequest: null, |
| 42 | branchPullRequest: null, |
| 43 | lineage: { rootThreadId: input.threadId, parentThreadId: null, relationshipToParent: null }, |
| 44 | forkedFrom: null, |
| 45 | createdBy: "user", |
| 46 | creationSource: "mobile", |
| 47 | activeProviderThreadId: null, |
| 48 | latestRunId: null, |
| 49 | activeRunId: null, |
| 50 | status: "idle", |
| 51 | pendingRuntimeRequest: null, |
| 52 | latestVisibleMessage: null, |
| 53 | latestUserMessageAt: timestamp, |
| 54 | hasActionableProposedPlan: false, |
| 55 | itemCount: 0, |
| 56 | visibleItemCount: 0, |
| 57 | createdAt: timestamp, |
| 58 | updatedAt: timestamp, |
| 59 | archivedAt: null, |
| 60 | settledOverride: null, |
| 61 | settledAt: null, |
| 62 | unsettledAt: null, |
| 63 | snoozedUntil: null, |
| 64 | snoozedAt: null, |
| 65 | pinnedAt: null, |
| 66 | pinOrderKey: null, |
| 67 | activeOrderKey: null, |
| 68 | deletedAt: null, |
| 69 | }); |
| 70 | } |