@runtypelabs/cli 2.59.0 → 2.59.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-0-T9NWjH.js +3899 -0
- package/dist/chunk-0x7UKC1U.js +17 -0
- package/dist/chunk-2ySxXtcg.js +418 -0
- package/dist/chunk-3An_BRHv.js +501 -0
- package/dist/chunk-6uTxgdiY.js +16218 -0
- package/dist/chunk-87nRnNRG.js +1363 -0
- package/dist/chunk-B3wo8uRx.js +322 -0
- package/dist/chunk-BGp3ZdBy.js +560 -0
- package/dist/chunk-BJQv9Elp.js +107 -0
- package/dist/chunk-BOpO6xE-.js +6053 -0
- package/dist/chunk-BQXXCL8B.js +102 -0
- package/dist/chunk-BV-8isOd.js +34 -0
- package/dist/chunk-BVMhjGVe.js +826 -0
- package/dist/chunk-BW2fg46T.js +141 -0
- package/dist/chunk-BWJdY5Ag.js +36 -0
- package/dist/chunk-BYJOrLhh.js +302 -0
- package/dist/chunk-BYab8EVL.js +127 -0
- package/dist/chunk-BfEKvp7h.js +82 -0
- package/dist/chunk-BhgLSfH6.js +1123 -0
- package/dist/chunk-BirUxTtH.js +296 -0
- package/dist/chunk-BmB6UVZ9.js +1559 -0
- package/dist/chunk-BnWhIqW1.js +109 -0
- package/dist/chunk-Bpfnfk0t.js +123 -0
- package/dist/chunk-BrhgdnM3.js +108 -0
- package/dist/chunk-Bt0XAgX5.js +327 -0
- package/dist/chunk-Bu0FJr6S.js +84 -0
- package/dist/chunk-BvEoKpN3.js +255 -0
- package/dist/chunk-BxNJgYbE.js +28 -0
- package/dist/chunk-C1OFhd7F.js +6131 -0
- package/dist/chunk-C7e7WwbU.js +331 -0
- package/dist/chunk-CDTYP6bN.js +558 -0
- package/dist/chunk-CGDQoqDC.js +24 -0
- package/dist/chunk-CJraEBVd.js +127 -0
- package/dist/chunk-CQrNhOtv.js +40 -0
- package/dist/chunk-CW6AzBH6.js +128 -0
- package/dist/chunk-CXgL4w-9.js +317 -0
- package/dist/chunk-CZrqoPyf.js +233 -0
- package/dist/chunk-CcFCyqbB.js +83 -0
- package/dist/chunk-CdaIvO-y.js +485 -0
- package/dist/chunk-CehSXtgK.js +624 -0
- package/dist/chunk-Ciqkop65.js +218 -0
- package/dist/chunk-CoAWdSiE.js +43 -0
- package/dist/chunk-Crb4y7t4.js +830 -0
- package/dist/chunk-CrlqIfmb.js +337 -0
- package/dist/chunk-Cs4pwCQ-.js +324 -0
- package/dist/chunk-CwM_9y01.js +519 -0
- package/dist/chunk-CyRbIJg8.js +440 -0
- package/dist/chunk-D0OHsyMy.js +212 -0
- package/dist/chunk-D3y2bURs.js +1347 -0
- package/dist/chunk-D4_mJk03.js +2338 -0
- package/dist/chunk-D6C8rned.js +578 -0
- package/dist/chunk-D9ZbUnks.js +11 -0
- package/dist/chunk-DEPmLshX.js +834 -0
- package/dist/chunk-DFj1UPB2.js +330 -0
- package/dist/chunk-DGdFdZVf.js +197 -0
- package/dist/chunk-DGv7X9S_.js +63 -0
- package/dist/chunk-DJQ47WYZ.js +664 -0
- package/dist/chunk-DJw3O61j.js +1974 -0
- package/dist/chunk-DK4FbWVK.js +100 -0
- package/dist/chunk-DSRYhUus.js +993 -0
- package/dist/chunk-DajZ9Eg4.js +299 -0
- package/dist/chunk-Df4dunvU.js +195 -0
- package/dist/chunk-DjNTPhfO.js +481 -0
- package/dist/chunk-Dn8eaJuu.js +1042 -0
- package/dist/chunk-DwDWqSxM.js +637 -0
- package/dist/chunk-Dz7cEtxl.js +84 -0
- package/dist/chunk-E_0bgjrS.js +359 -0
- package/dist/chunk-KPYN2vUp.js +776 -0
- package/dist/chunk-KcqPQJBi.js +86 -0
- package/dist/chunk-N9H0JnoG.js +349 -0
- package/dist/chunk-NONFcXkn.js +728 -0
- package/dist/chunk-PrFjcpmH.js +256 -0
- package/dist/chunk-QSfNYiw9.js +11 -0
- package/dist/chunk-R265bzj9.js +226 -0
- package/dist/chunk-X9V_r6jM.js +166 -0
- package/dist/chunk-ZBtPUtyA.js +55 -0
- package/dist/chunk-ZCTfmOs7.js +4939 -0
- package/dist/chunk-h6oavj0t.js +97 -0
- package/dist/chunk-i7DwkvvD.js +42 -0
- package/dist/chunk-mG-4eZ6S.js +203 -0
- package/dist/chunk-o0ygUbCf.js +313 -0
- package/dist/chunk-ucu5lrDZ.js +5715 -0
- package/dist/index.js +11367 -73764
- package/package.json +6 -6
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { t as ModelPicker } from "./chunk-CrlqIfmb.js";
|
|
3
|
+
import { MarathonApp } from "./chunk-C1OFhd7F.js";
|
|
4
|
+
import { useEffect, useRef, useState } from "react";
|
|
5
|
+
import { Box, Text, useApp, useInput, useStdout } from "ink";
|
|
6
|
+
import { theme } from "@runtypelabs/ink-components";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { AnimatedVariant, StartupGridIconCompactLightInverted } from "@runtypelabs/terminal-animations";
|
|
9
|
+
// src/ink/marathon/MarathonStartupShell.tsx
|
|
10
|
+
const SCROLL_HINT = "↑↓ Enter 1-3";
|
|
11
|
+
const PROMPT_COLUMN_MAX = 68;
|
|
12
|
+
const MIN_HOLD_MS = 1500;
|
|
13
|
+
const FADE_DURATION_MS = 260;
|
|
14
|
+
const STARTUP_BACKGROUND_VARIANTS = ["vector3d-ghost-wave", "vector3d-ghost-box-drift"];
|
|
15
|
+
function shortenPath(filePath, maxLength) {
|
|
16
|
+
if (filePath.length <= maxLength) return filePath;
|
|
17
|
+
const normalizedSegments = filePath.split("/").filter(Boolean);
|
|
18
|
+
if (normalizedSegments.length === 0) return filePath.slice(0, maxLength);
|
|
19
|
+
const tail = normalizedSegments.slice(-3).join("/");
|
|
20
|
+
if (tail.length + 4 <= maxLength) return `.../${tail}`;
|
|
21
|
+
return `...${filePath.slice(-(maxLength - 3))}`;
|
|
22
|
+
}
|
|
23
|
+
function singularize(countText, singular, plural) {
|
|
24
|
+
const count = Number.parseInt(countText, 10);
|
|
25
|
+
if (Number.isNaN(count)) return `${countText} ${plural}`;
|
|
26
|
+
return `${count} ${count === 1 ? singular : plural}`;
|
|
27
|
+
}
|
|
28
|
+
function buildPromptShellModel(prompt, columnWidth) {
|
|
29
|
+
const detailMap = /* @__PURE__ */ new Map();
|
|
30
|
+
for (const line of prompt.summaryLines) {
|
|
31
|
+
const separatorIndex = line.indexOf(":");
|
|
32
|
+
if (separatorIndex === -1) continue;
|
|
33
|
+
const key = line.slice(0, separatorIndex).trim();
|
|
34
|
+
const value = line.slice(separatorIndex + 1).trim();
|
|
35
|
+
detailMap.set(key, value);
|
|
36
|
+
}
|
|
37
|
+
const task = detailMap.get("Task");
|
|
38
|
+
const filePath = detailMap.get("State file");
|
|
39
|
+
const status = detailMap.get("Status");
|
|
40
|
+
const sessions = detailMap.get("Sessions");
|
|
41
|
+
const cost = detailMap.get("Cost");
|
|
42
|
+
return {
|
|
43
|
+
heading: prompt.title === "Found a saved marathon session to resume." ? "Resume latest marathon" : "Saved marathon found",
|
|
44
|
+
task,
|
|
45
|
+
filePath: filePath ? shortenPath(filePath, Math.max(28, columnWidth - 8)) : void 0,
|
|
46
|
+
metaLine: [
|
|
47
|
+
status,
|
|
48
|
+
sessions ? singularize(sessions, "session", "sessions") : void 0,
|
|
49
|
+
cost
|
|
50
|
+
].filter((part) => Boolean(part)).join(" · ")
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function MarathonStartupShell({ startupRef, marathonAppProps, version }) {
|
|
54
|
+
const { exit } = useApp();
|
|
55
|
+
const { stdout } = useStdout();
|
|
56
|
+
const mountedAtRef = useRef(Date.now());
|
|
57
|
+
const promptResolverRef = useRef(null);
|
|
58
|
+
const modelResolverRef = useRef(null);
|
|
59
|
+
const playbookConfirmResolverRef = useRef(null);
|
|
60
|
+
const appReadyResolverRef = useRef(null);
|
|
61
|
+
const dismissResolverRef = useRef(null);
|
|
62
|
+
const transitionPromiseRef = useRef(null);
|
|
63
|
+
const latestAppPropsRef = useRef(marathonAppProps);
|
|
64
|
+
const [statusMessage, setStatusMessage] = useState("preparing marathon");
|
|
65
|
+
const [scene, setScene] = useState("splash");
|
|
66
|
+
const [transition, setTransition] = useState(null);
|
|
67
|
+
const [prompt, setPrompt] = useState(null);
|
|
68
|
+
const [modelChoices, setModelChoices] = useState(null);
|
|
69
|
+
const [currentModel, setCurrentModel] = useState("default");
|
|
70
|
+
const [playbookConfirm, setPlaybookConfirm] = useState(null);
|
|
71
|
+
const [selectedPromptIndex, setSelectedPromptIndex] = useState(0);
|
|
72
|
+
const [backgroundVariantId] = useState(() => STARTUP_BACKGROUND_VARIANTS[Math.floor(Math.random() * STARTUP_BACKGROUND_VARIANTS.length)]);
|
|
73
|
+
latestAppPropsRef.current = marathonAppProps;
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (scene !== "app" || !appReadyResolverRef.current) return;
|
|
76
|
+
const resolve = appReadyResolverRef.current;
|
|
77
|
+
appReadyResolverRef.current = null;
|
|
78
|
+
resolve();
|
|
79
|
+
}, [scene]);
|
|
80
|
+
const beginTransition = (target) => {
|
|
81
|
+
if (transitionPromiseRef.current) return transitionPromiseRef.current;
|
|
82
|
+
if (target === "app" && !latestAppPropsRef.current) throw new Error("Cannot complete startup before marathon app props are ready.");
|
|
83
|
+
const promise = new Promise((resolve) => {
|
|
84
|
+
globalThis.setTimeout(() => {
|
|
85
|
+
setPrompt(null);
|
|
86
|
+
setModelChoices(null);
|
|
87
|
+
setTransition({
|
|
88
|
+
startedAt: Date.now(),
|
|
89
|
+
target
|
|
90
|
+
});
|
|
91
|
+
globalThis.setTimeout(() => {
|
|
92
|
+
if (target === "app") {
|
|
93
|
+
setTransition(null);
|
|
94
|
+
setScene("app");
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
dismissResolverRef.current?.();
|
|
98
|
+
dismissResolverRef.current = null;
|
|
99
|
+
exit();
|
|
100
|
+
}, FADE_DURATION_MS);
|
|
101
|
+
if (target === "app") appReadyResolverRef.current = () => {
|
|
102
|
+
transitionPromiseRef.current = null;
|
|
103
|
+
resolve();
|
|
104
|
+
};
|
|
105
|
+
else dismissResolverRef.current = () => {
|
|
106
|
+
transitionPromiseRef.current = null;
|
|
107
|
+
resolve();
|
|
108
|
+
};
|
|
109
|
+
}, Math.max(0, MIN_HOLD_MS - (Date.now() - mountedAtRef.current)));
|
|
110
|
+
});
|
|
111
|
+
transitionPromiseRef.current = promise;
|
|
112
|
+
return promise;
|
|
113
|
+
};
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
startupRef.current = {
|
|
116
|
+
setStatus: (message) => {
|
|
117
|
+
setStatusMessage(message);
|
|
118
|
+
},
|
|
119
|
+
requestStateChoice: async (nextPrompt) => {
|
|
120
|
+
setModelChoices(null);
|
|
121
|
+
setPrompt(nextPrompt);
|
|
122
|
+
setSelectedPromptIndex(0);
|
|
123
|
+
return new Promise((resolve) => {
|
|
124
|
+
promptResolverRef.current = resolve;
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
requestModelChoice: async (nextCurrentModel, models) => {
|
|
128
|
+
setPrompt(null);
|
|
129
|
+
setPlaybookConfirm(null);
|
|
130
|
+
setCurrentModel(nextCurrentModel);
|
|
131
|
+
setModelChoices(models);
|
|
132
|
+
return new Promise((resolve) => {
|
|
133
|
+
modelResolverRef.current = resolve;
|
|
134
|
+
});
|
|
135
|
+
},
|
|
136
|
+
requestPlaybookModelConfirm: async (playbookName, milestoneModels) => {
|
|
137
|
+
setPrompt(null);
|
|
138
|
+
setModelChoices(null);
|
|
139
|
+
const names = Object.keys(milestoneModels);
|
|
140
|
+
setPlaybookConfirm({
|
|
141
|
+
name: playbookName,
|
|
142
|
+
milestoneModels: { ...milestoneModels },
|
|
143
|
+
originalModels: { ...milestoneModels },
|
|
144
|
+
milestoneNames: names,
|
|
145
|
+
selectedIndex: names.length
|
|
146
|
+
});
|
|
147
|
+
return new Promise((resolve) => {
|
|
148
|
+
playbookConfirmResolverRef.current = resolve;
|
|
149
|
+
});
|
|
150
|
+
},
|
|
151
|
+
completeStartup: () => beginTransition("app"),
|
|
152
|
+
dismiss: () => beginTransition("exit")
|
|
153
|
+
};
|
|
154
|
+
return () => {
|
|
155
|
+
startupRef.current = null;
|
|
156
|
+
};
|
|
157
|
+
}, [startupRef]);
|
|
158
|
+
useInput((input, key) => {
|
|
159
|
+
if (key.ctrl && input === "c") {
|
|
160
|
+
process.kill(process.pid, "SIGINT");
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (!prompt || transition || modelChoices || playbookConfirm) return;
|
|
164
|
+
if (key.upArrow || input === "k") {
|
|
165
|
+
setSelectedPromptIndex((current) => (current - 1 + prompt.choices.length) % prompt.choices.length);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (key.downArrow || input === "j") {
|
|
169
|
+
setSelectedPromptIndex((current) => (current + 1) % prompt.choices.length);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (key.return) {
|
|
173
|
+
const choice = prompt.choices[selectedPromptIndex];
|
|
174
|
+
if (choice) {
|
|
175
|
+
promptResolverRef.current?.(choice.value);
|
|
176
|
+
promptResolverRef.current = null;
|
|
177
|
+
setPrompt(null);
|
|
178
|
+
}
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (/^[1-9]$/.test(input)) {
|
|
182
|
+
const numericIndex = Number(input) - 1;
|
|
183
|
+
const choice = prompt.choices[numericIndex];
|
|
184
|
+
if (choice) {
|
|
185
|
+
setSelectedPromptIndex(numericIndex);
|
|
186
|
+
promptResolverRef.current?.(choice.value);
|
|
187
|
+
promptResolverRef.current = null;
|
|
188
|
+
setPrompt(null);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}, { isActive: scene !== "app" && !playbookConfirm && !modelChoices });
|
|
192
|
+
useInput((input, key) => {
|
|
193
|
+
if (key.ctrl && input === "c") {
|
|
194
|
+
process.kill(process.pid, "SIGINT");
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (!playbookConfirm) return;
|
|
198
|
+
const hasEdits = JSON.stringify(playbookConfirm.milestoneModels) !== JSON.stringify(playbookConfirm.originalModels);
|
|
199
|
+
const actionCount = hasEdits ? 3 : 2;
|
|
200
|
+
const totalItems = playbookConfirm.milestoneNames.length + actionCount;
|
|
201
|
+
if (key.upArrow || input === "k") {
|
|
202
|
+
setPlaybookConfirm((prev) => prev ? {
|
|
203
|
+
...prev,
|
|
204
|
+
selectedIndex: (prev.selectedIndex - 1 + totalItems) % totalItems
|
|
205
|
+
} : null);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
if (key.downArrow || input === "j") {
|
|
209
|
+
setPlaybookConfirm((prev) => prev ? {
|
|
210
|
+
...prev,
|
|
211
|
+
selectedIndex: (prev.selectedIndex + 1) % totalItems
|
|
212
|
+
} : null);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (key.return) {
|
|
216
|
+
const idx = playbookConfirm.selectedIndex;
|
|
217
|
+
const milestoneCount = playbookConfirm.milestoneNames.length;
|
|
218
|
+
if (idx < milestoneCount) {
|
|
219
|
+
const milestone = playbookConfirm.milestoneNames[idx];
|
|
220
|
+
playbookConfirmResolverRef.current?.({
|
|
221
|
+
action: "edit",
|
|
222
|
+
milestoneModels: playbookConfirm.milestoneModels,
|
|
223
|
+
editMilestone: milestone
|
|
224
|
+
});
|
|
225
|
+
playbookConfirmResolverRef.current = null;
|
|
226
|
+
setPlaybookConfirm(null);
|
|
227
|
+
} else {
|
|
228
|
+
const actionIndex = idx - milestoneCount;
|
|
229
|
+
if (actionIndex === 0) {
|
|
230
|
+
playbookConfirmResolverRef.current?.({
|
|
231
|
+
action: "confirm",
|
|
232
|
+
milestoneModels: playbookConfirm.milestoneModels
|
|
233
|
+
});
|
|
234
|
+
playbookConfirmResolverRef.current = null;
|
|
235
|
+
setPlaybookConfirm(null);
|
|
236
|
+
} else if (actionIndex === 1) {
|
|
237
|
+
playbookConfirmResolverRef.current?.({ action: "override" });
|
|
238
|
+
playbookConfirmResolverRef.current = null;
|
|
239
|
+
setPlaybookConfirm(null);
|
|
240
|
+
} else if (actionIndex === 2 && hasEdits) setPlaybookConfirm((prev) => prev ? {
|
|
241
|
+
...prev,
|
|
242
|
+
milestoneModels: { ...prev.originalModels },
|
|
243
|
+
selectedIndex: prev.milestoneNames.length
|
|
244
|
+
} : null);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}, { isActive: scene !== "app" && !!playbookConfirm });
|
|
248
|
+
const terminalWidth = stdout?.columns ?? 120;
|
|
249
|
+
const terminalRows = stdout?.rows ?? 40;
|
|
250
|
+
const promptColumnWidth = Math.max(44, Math.min(PROMPT_COLUMN_MAX, terminalWidth - 14));
|
|
251
|
+
const promptShellModel = prompt ? buildPromptShellModel(prompt, promptColumnWidth) : null;
|
|
252
|
+
const selectedChoice = prompt?.choices[selectedPromptIndex];
|
|
253
|
+
const contentWidth = prompt || modelChoices || playbookConfirm ? promptColumnWidth : void 0;
|
|
254
|
+
if (scene === "app" && marathonAppProps) return /* @__PURE__ */ jsx(MarathonApp, { ...marathonAppProps });
|
|
255
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
256
|
+
width: terminalWidth,
|
|
257
|
+
height: terminalRows,
|
|
258
|
+
backgroundColor: theme.background,
|
|
259
|
+
children: [
|
|
260
|
+
/* @__PURE__ */ jsx(Box, {
|
|
261
|
+
position: "absolute",
|
|
262
|
+
width: terminalWidth,
|
|
263
|
+
height: terminalRows,
|
|
264
|
+
overflow: "hidden",
|
|
265
|
+
children: /* @__PURE__ */ jsx(AnimatedVariant, {
|
|
266
|
+
variantId: backgroundVariantId,
|
|
267
|
+
width: terminalWidth,
|
|
268
|
+
height: terminalRows,
|
|
269
|
+
autoplay: !modelChoices && !playbookConfirm
|
|
270
|
+
})
|
|
271
|
+
}),
|
|
272
|
+
/* @__PURE__ */ jsx(Box, {
|
|
273
|
+
position: "absolute",
|
|
274
|
+
width: terminalWidth,
|
|
275
|
+
height: terminalRows,
|
|
276
|
+
alignItems: "flex-start",
|
|
277
|
+
justifyContent: "flex-start",
|
|
278
|
+
paddingX: 1,
|
|
279
|
+
paddingY: 1,
|
|
280
|
+
children: /* @__PURE__ */ jsx(StartupGridIconCompactLightInverted, { autoplay: false })
|
|
281
|
+
}),
|
|
282
|
+
version && /* @__PURE__ */ jsx(Box, {
|
|
283
|
+
position: "absolute",
|
|
284
|
+
width: terminalWidth,
|
|
285
|
+
height: terminalRows,
|
|
286
|
+
alignItems: "flex-end",
|
|
287
|
+
justifyContent: "flex-end",
|
|
288
|
+
paddingX: 2,
|
|
289
|
+
paddingY: 1,
|
|
290
|
+
children: /* @__PURE__ */ jsxs(Text, {
|
|
291
|
+
color: theme.border,
|
|
292
|
+
children: ["v", version]
|
|
293
|
+
})
|
|
294
|
+
}),
|
|
295
|
+
/* @__PURE__ */ jsx(Box, {
|
|
296
|
+
width: terminalWidth,
|
|
297
|
+
height: terminalRows,
|
|
298
|
+
flexDirection: "column",
|
|
299
|
+
justifyContent: "center",
|
|
300
|
+
alignItems: "center",
|
|
301
|
+
children: /* @__PURE__ */ jsxs(Box, {
|
|
302
|
+
flexDirection: "column",
|
|
303
|
+
alignItems: prompt || modelChoices || playbookConfirm ? "stretch" : "center",
|
|
304
|
+
backgroundColor: theme.background,
|
|
305
|
+
paddingX: 2,
|
|
306
|
+
paddingY: 1,
|
|
307
|
+
children: [
|
|
308
|
+
!prompt && !modelChoices && !playbookConfirm && /* @__PURE__ */ jsx(Text, {
|
|
309
|
+
color: theme.textMuted,
|
|
310
|
+
children: statusMessage
|
|
311
|
+
}),
|
|
312
|
+
playbookConfirm && !modelChoices && (() => {
|
|
313
|
+
const milestoneCount = playbookConfirm.milestoneNames.length;
|
|
314
|
+
const actions = [
|
|
315
|
+
"Confirm",
|
|
316
|
+
"Use single model instead",
|
|
317
|
+
...JSON.stringify(playbookConfirm.milestoneModels) !== JSON.stringify(playbookConfirm.originalModels) ? ["Discard changes"] : []
|
|
318
|
+
];
|
|
319
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
320
|
+
width: contentWidth,
|
|
321
|
+
flexDirection: "column",
|
|
322
|
+
marginTop: 1,
|
|
323
|
+
children: [
|
|
324
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
325
|
+
bold: true,
|
|
326
|
+
color: theme.text,
|
|
327
|
+
children: ["Playbook: ", playbookConfirm.name]
|
|
328
|
+
}),
|
|
329
|
+
/* @__PURE__ */ jsx(Box, {
|
|
330
|
+
marginTop: 1,
|
|
331
|
+
flexDirection: "column",
|
|
332
|
+
children: playbookConfirm.milestoneNames.map((milestone, i) => {
|
|
333
|
+
const isSelected = i === playbookConfirm.selectedIndex;
|
|
334
|
+
const model = playbookConfirm.milestoneModels[milestone];
|
|
335
|
+
const wasEdited = model !== playbookConfirm.originalModels[milestone];
|
|
336
|
+
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
337
|
+
/* @__PURE__ */ jsx(Text, {
|
|
338
|
+
color: isSelected ? theme.accent : theme.textSubtle,
|
|
339
|
+
children: isSelected ? "› " : " "
|
|
340
|
+
}),
|
|
341
|
+
/* @__PURE__ */ jsx(Text, {
|
|
342
|
+
color: isSelected ? theme.text : theme.textSubtle,
|
|
343
|
+
bold: isSelected,
|
|
344
|
+
children: milestone.padEnd(16)
|
|
345
|
+
}),
|
|
346
|
+
/* @__PURE__ */ jsx(Text, {
|
|
347
|
+
color: isSelected ? theme.accent : theme.textMuted,
|
|
348
|
+
children: model
|
|
349
|
+
}),
|
|
350
|
+
wasEdited && /* @__PURE__ */ jsx(Text, {
|
|
351
|
+
color: theme.textSubtle,
|
|
352
|
+
children: " (edited)"
|
|
353
|
+
})
|
|
354
|
+
] }, milestone);
|
|
355
|
+
})
|
|
356
|
+
}),
|
|
357
|
+
/* @__PURE__ */ jsx(Box, {
|
|
358
|
+
marginTop: 1,
|
|
359
|
+
flexDirection: "column",
|
|
360
|
+
children: actions.map((label, ai) => {
|
|
361
|
+
const isSelected = playbookConfirm.selectedIndex === milestoneCount + ai;
|
|
362
|
+
return /* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Text, {
|
|
363
|
+
color: isSelected ? theme.accent : theme.textSubtle,
|
|
364
|
+
children: isSelected ? "› " : " "
|
|
365
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
366
|
+
color: isSelected ? theme.text : theme.textSubtle,
|
|
367
|
+
bold: isSelected,
|
|
368
|
+
children: label
|
|
369
|
+
})] }, label);
|
|
370
|
+
})
|
|
371
|
+
}),
|
|
372
|
+
/* @__PURE__ */ jsx(Box, {
|
|
373
|
+
marginTop: 1,
|
|
374
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
375
|
+
color: theme.border,
|
|
376
|
+
children: "↑↓ navigate · Enter select"
|
|
377
|
+
})
|
|
378
|
+
})
|
|
379
|
+
]
|
|
380
|
+
});
|
|
381
|
+
})(),
|
|
382
|
+
modelChoices && /* @__PURE__ */ jsx(Box, {
|
|
383
|
+
width: contentWidth,
|
|
384
|
+
flexDirection: "column",
|
|
385
|
+
marginTop: 1,
|
|
386
|
+
children: /* @__PURE__ */ jsx(ModelPicker, {
|
|
387
|
+
currentModel,
|
|
388
|
+
models: modelChoices,
|
|
389
|
+
onSelect: (model) => {
|
|
390
|
+
modelResolverRef.current?.(model);
|
|
391
|
+
modelResolverRef.current = null;
|
|
392
|
+
setCurrentModel(model);
|
|
393
|
+
setModelChoices(null);
|
|
394
|
+
},
|
|
395
|
+
onCancel: () => {
|
|
396
|
+
modelResolverRef.current?.(currentModel);
|
|
397
|
+
modelResolverRef.current = null;
|
|
398
|
+
setModelChoices(null);
|
|
399
|
+
}
|
|
400
|
+
})
|
|
401
|
+
}),
|
|
402
|
+
prompt && /* @__PURE__ */ jsxs(Box, {
|
|
403
|
+
width: contentWidth,
|
|
404
|
+
flexDirection: "column",
|
|
405
|
+
marginTop: 1,
|
|
406
|
+
children: [
|
|
407
|
+
/* @__PURE__ */ jsx(Text, {
|
|
408
|
+
bold: true,
|
|
409
|
+
color: theme.text,
|
|
410
|
+
children: promptShellModel?.heading
|
|
411
|
+
}),
|
|
412
|
+
promptShellModel?.task && /* @__PURE__ */ jsxs(Box, {
|
|
413
|
+
marginTop: 1,
|
|
414
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
415
|
+
color: theme.textSubtle,
|
|
416
|
+
children: "task "
|
|
417
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
418
|
+
color: theme.text,
|
|
419
|
+
children: promptShellModel.task
|
|
420
|
+
})]
|
|
421
|
+
}),
|
|
422
|
+
promptShellModel?.filePath && /* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Text, {
|
|
423
|
+
color: theme.textSubtle,
|
|
424
|
+
children: "state "
|
|
425
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
426
|
+
color: theme.textSubtle,
|
|
427
|
+
children: promptShellModel.filePath
|
|
428
|
+
})] }),
|
|
429
|
+
promptShellModel?.metaLine && /* @__PURE__ */ jsx(Box, {
|
|
430
|
+
marginTop: 1,
|
|
431
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
432
|
+
color: theme.textSubtle,
|
|
433
|
+
children: promptShellModel.metaLine
|
|
434
|
+
})
|
|
435
|
+
}),
|
|
436
|
+
/* @__PURE__ */ jsx(Box, {
|
|
437
|
+
marginTop: 1,
|
|
438
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
439
|
+
color: theme.textSubtle,
|
|
440
|
+
children: prompt.hint
|
|
441
|
+
})
|
|
442
|
+
}),
|
|
443
|
+
/* @__PURE__ */ jsx(Box, {
|
|
444
|
+
flexDirection: "column",
|
|
445
|
+
marginTop: 1,
|
|
446
|
+
children: prompt.choices.map((choice, index) => {
|
|
447
|
+
const isSelected = index === selectedPromptIndex;
|
|
448
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
449
|
+
marginTop: index === 0 ? 0 : 1,
|
|
450
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
451
|
+
color: isSelected ? theme.accent : theme.textSubtle,
|
|
452
|
+
bold: isSelected,
|
|
453
|
+
children: isSelected ? "› " : " "
|
|
454
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
455
|
+
color: isSelected ? theme.text : theme.textSubtle,
|
|
456
|
+
bold: isSelected,
|
|
457
|
+
children: `${index + 1} ${choice.label}`
|
|
458
|
+
})]
|
|
459
|
+
}, choice.value);
|
|
460
|
+
})
|
|
461
|
+
}),
|
|
462
|
+
selectedChoice && /* @__PURE__ */ jsx(Box, {
|
|
463
|
+
marginTop: 1,
|
|
464
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
465
|
+
color: theme.textSubtle,
|
|
466
|
+
children: selectedChoice.description
|
|
467
|
+
})
|
|
468
|
+
}),
|
|
469
|
+
/* @__PURE__ */ jsx(Box, {
|
|
470
|
+
marginTop: 1,
|
|
471
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
472
|
+
color: theme.border,
|
|
473
|
+
children: SCROLL_HINT
|
|
474
|
+
})
|
|
475
|
+
})
|
|
476
|
+
]
|
|
477
|
+
})
|
|
478
|
+
]
|
|
479
|
+
})
|
|
480
|
+
})
|
|
481
|
+
]
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
export { MarathonStartupShell };
|
|
485
|
+
|