1import type { EnvironmentProject } from "@t3tools/client-runtime/state/shell";
2import {
3 CommandId,
4 DEFAULT_PROVIDER_INTERACTION_MODE,
5 DEFAULT_RUNTIME_MODE,
6 MessageId,
7 ProviderInstanceId,
8 ThreadId,
9} from "@t3tools/contracts";
10
11import type { QueuedThreadMessage } from "../../state/thread-outbox-model";
12
13export const SHOWCASE_PENDING_TASK_DEFINITIONS = [
14 {
15 projectId: "t3code",
16 id: "offline-launch-checklist",
17 text: "Ship the offline launch checklist before touchdown ✈️",
18 branch: "feat/offline-launchpad",
19 minutesAgo: 8,
20 },
21 {
22 projectId: "react",
23 id: "train-tunnel-suspense",
24 text: "Polish the Suspense handoff for the train tunnel 🚇",
25 branch: "perf/tunnel-handoff",
26 minutesAgo: 27,
27 },
28] as const;
29
30const FALLBACK_MODEL_SELECTION = {
31 instanceId: ProviderInstanceId.make("codex"),
32 model: "gpt-5.4",
33} as const;
34
35export function buildShowcasePendingTasks(
36 projects: ReadonlyArray<EnvironmentProject>,
37 now: number,
38): ReadonlyArray<QueuedThreadMessage> {
39 return SHOWCASE_PENDING_TASK_DEFINITIONS.flatMap((definition) => {
40 const project = projects.find((candidate) => String(candidate.id) === definition.projectId);
41 if (!project) return [];
42
43 return [
44 {
45 environmentId: project.environmentId,
46 threadId: ThreadId.make(`showcase-pending-${definition.id}`),
47 messageId: MessageId.make(`showcase-pending-message-${definition.id}`),
48 commandId: CommandId.make(`showcase-pending-command-${definition.id}`),
49 text: definition.text,
50 attachments: [],
51 modelSelection: project.defaultModelSelection ?? FALLBACK_MODEL_SELECTION,
52 runtimeMode: DEFAULT_RUNTIME_MODE,
53 interactionMode: DEFAULT_PROVIDER_INTERACTION_MODE,
54 creation: {
55 projectId: project.id,
56 projectTitle: project.title,
57 projectCwd: project.workspaceRoot,
58 workspaceMode: "local" as const,
59 branch: definition.branch,
60 worktreePath: project.workspaceRoot,
61 },
62 createdAt: new Date(now - definition.minutesAgo * 60_000).toISOString(),
63 },
64 ];
65 });
66}