@burdenoff/microfe-sandbox 2026.608.1 → 2026.611.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/generated/wspace-operations.js +108 -48
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.js.map +1 -1
- package/dist/sandbox/components/SandboxScriptRunnerPanel.js +241 -0
- package/dist/sandbox/components/SandboxScriptRunnerPanel.js.map +1 -0
- package/dist/sandbox/pages/SandboxDetailPage.js +80 -75
- package/dist/sandbox/pages/SandboxDetailPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { Badge as e, Button as t, Card as n, CardContent as r } from "./ui.js";
|
|
2
|
+
import { tWithFallback as i } from "../utils/i18n.js";
|
|
3
|
+
import { usePromoteSandboxScriptRunMutation as a, useRunSandboxScriptMutation as o, useSandboxScriptRunsQuery as s } from "../../generated/wspace-operations.js";
|
|
4
|
+
import { useCallback as c, useEffect as l, useMemo as u, useState as d } from "react";
|
|
5
|
+
import { AlertCircle as f, ArrowUpCircle as p, CheckCircle2 as m, Loader2 as h, Play as g, ShieldCheck as _, Terminal as v, XCircle as y } from "lucide-react";
|
|
6
|
+
import { useSearchParams as b } from "react-router-dom";
|
|
7
|
+
import { useI18n as x } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
8
|
+
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
9
|
+
//#region src/sandbox/components/SandboxScriptRunnerPanel.tsx
|
|
10
|
+
var w = [
|
|
11
|
+
"bash",
|
|
12
|
+
"sh",
|
|
13
|
+
"python",
|
|
14
|
+
"node"
|
|
15
|
+
];
|
|
16
|
+
function T(e) {
|
|
17
|
+
if (!e) return "";
|
|
18
|
+
try {
|
|
19
|
+
return atob(e);
|
|
20
|
+
} catch {
|
|
21
|
+
return e;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function E({ sandbox: m, workspaceId: E }) {
|
|
25
|
+
let { t: k } = x(), A = (e, t) => i(k, e, t), [j, M] = b(), [N, P] = d(() => T(j.get("script"))), [F, I] = d("bash"), [L, R] = d(""), [z, B] = d(null), V = m.status === "RUNNING", { data: H, refetch: U } = s({
|
|
26
|
+
variables: {
|
|
27
|
+
sandboxId: m.id,
|
|
28
|
+
context: { workspaceId: E }
|
|
29
|
+
},
|
|
30
|
+
skip: !E,
|
|
31
|
+
fetchPolicy: "cache-and-network"
|
|
32
|
+
}), [W, { loading: G, error: K }] = o(), [q, { loading: J }] = a(), Y = u(() => H?.sandboxScriptRuns ?? [], [H]), X = Y.find((e) => e.id === z) ?? Y[0] ?? null;
|
|
33
|
+
l(() => {
|
|
34
|
+
if (j.get("script")) {
|
|
35
|
+
let e = new URLSearchParams(j);
|
|
36
|
+
e.delete("script"), M(e, { replace: !0 });
|
|
37
|
+
}
|
|
38
|
+
}, []);
|
|
39
|
+
let Z = c(async () => {
|
|
40
|
+
if (!(!N.trim() || !V)) try {
|
|
41
|
+
let e = (await W({ variables: { input: {
|
|
42
|
+
sandboxId: m.id,
|
|
43
|
+
script: N,
|
|
44
|
+
interpreter: F,
|
|
45
|
+
label: L.trim() || null,
|
|
46
|
+
context: { workspaceId: E }
|
|
47
|
+
} } })).data?.runSandboxScript;
|
|
48
|
+
e && B(e.id), await U();
|
|
49
|
+
} catch {}
|
|
50
|
+
}, [
|
|
51
|
+
N,
|
|
52
|
+
V,
|
|
53
|
+
W,
|
|
54
|
+
m.id,
|
|
55
|
+
F,
|
|
56
|
+
L,
|
|
57
|
+
E,
|
|
58
|
+
U
|
|
59
|
+
]), Q = c(async (e) => {
|
|
60
|
+
try {
|
|
61
|
+
await q({ variables: {
|
|
62
|
+
id: e,
|
|
63
|
+
note: null,
|
|
64
|
+
context: { workspaceId: E }
|
|
65
|
+
} }), await U();
|
|
66
|
+
} catch {}
|
|
67
|
+
}, [
|
|
68
|
+
q,
|
|
69
|
+
E,
|
|
70
|
+
U
|
|
71
|
+
]);
|
|
72
|
+
return /* @__PURE__ */ S(n, { children: /* @__PURE__ */ C(r, {
|
|
73
|
+
className: "p-5",
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ S("div", {
|
|
76
|
+
className: "mb-4 flex items-center justify-between",
|
|
77
|
+
children: /* @__PURE__ */ C("h3", {
|
|
78
|
+
className: "flex items-center gap-2 font-semibold",
|
|
79
|
+
children: [/* @__PURE__ */ S("div", {
|
|
80
|
+
className: "rounded-lg bg-primary/10 p-1.5",
|
|
81
|
+
children: /* @__PURE__ */ S(v, {
|
|
82
|
+
size: 14,
|
|
83
|
+
className: "text-primary"
|
|
84
|
+
})
|
|
85
|
+
}), A("sandbox.detail.scriptRunner.title", "Script Runner")]
|
|
86
|
+
})
|
|
87
|
+
}),
|
|
88
|
+
/* @__PURE__ */ S("p", {
|
|
89
|
+
className: "mb-3 text-sm text-muted-foreground",
|
|
90
|
+
children: A("sandbox.detail.scriptRunner.subtitle", "Run an AI-generated script in this isolated sandbox and review the output before promoting it to the real target.")
|
|
91
|
+
}),
|
|
92
|
+
!V && /* @__PURE__ */ C("div", {
|
|
93
|
+
className: "mb-3 flex items-center gap-2 rounded-lg bg-amber-500/10 px-3 py-2 text-sm text-amber-600",
|
|
94
|
+
children: [/* @__PURE__ */ S(f, { size: 14 }), A("sandbox.detail.scriptRunner.notRunning", "The sandbox must be running to execute a script.")]
|
|
95
|
+
}),
|
|
96
|
+
/* @__PURE__ */ C("div", {
|
|
97
|
+
className: "space-y-3",
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ C("div", {
|
|
100
|
+
className: "flex flex-wrap items-center gap-2",
|
|
101
|
+
children: [/* @__PURE__ */ S("select", {
|
|
102
|
+
value: F,
|
|
103
|
+
onChange: (e) => I(e.target.value),
|
|
104
|
+
className: "rounded-lg border bg-background px-2 py-1 font-mono text-xs",
|
|
105
|
+
children: w.map((e) => /* @__PURE__ */ S("option", {
|
|
106
|
+
value: e,
|
|
107
|
+
children: e
|
|
108
|
+
}, e))
|
|
109
|
+
}), /* @__PURE__ */ S("input", {
|
|
110
|
+
value: L,
|
|
111
|
+
onChange: (e) => R(e.target.value),
|
|
112
|
+
placeholder: A("sandbox.detail.scriptRunner.labelPlaceholder", "Label (optional)"),
|
|
113
|
+
className: "flex-1 rounded-lg border bg-background px-2 py-1 text-xs"
|
|
114
|
+
})]
|
|
115
|
+
}),
|
|
116
|
+
/* @__PURE__ */ S("textarea", {
|
|
117
|
+
value: N,
|
|
118
|
+
onChange: (e) => P(e.target.value),
|
|
119
|
+
spellCheck: !1,
|
|
120
|
+
placeholder: A("sandbox.detail.scriptRunner.placeholder", "# Paste the AI-generated script here, then Run to test it in the sandbox"),
|
|
121
|
+
className: "h-40 w-full resize-y rounded-lg border bg-background p-3 font-mono text-xs"
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ S("div", {
|
|
124
|
+
className: "flex justify-end",
|
|
125
|
+
children: /* @__PURE__ */ C(t, {
|
|
126
|
+
onClick: () => void Z(),
|
|
127
|
+
disabled: !V || G || !N.trim(),
|
|
128
|
+
children: [G ? /* @__PURE__ */ S(h, {
|
|
129
|
+
size: 14,
|
|
130
|
+
className: "animate-spin"
|
|
131
|
+
}) : /* @__PURE__ */ S(g, { size: 14 }), A("sandbox.detail.scriptRunner.run", "Run in sandbox")]
|
|
132
|
+
})
|
|
133
|
+
}),
|
|
134
|
+
K && /* @__PURE__ */ C("div", {
|
|
135
|
+
className: "flex items-center gap-2 rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",
|
|
136
|
+
children: [/* @__PURE__ */ S(y, { size: 14 }), K.message]
|
|
137
|
+
})
|
|
138
|
+
]
|
|
139
|
+
}),
|
|
140
|
+
X && /* @__PURE__ */ S("div", {
|
|
141
|
+
className: "mt-4",
|
|
142
|
+
children: /* @__PURE__ */ S(O, {
|
|
143
|
+
run: X,
|
|
144
|
+
tr: A
|
|
145
|
+
})
|
|
146
|
+
}),
|
|
147
|
+
Y.length > 0 && /* @__PURE__ */ C("div", {
|
|
148
|
+
className: "mt-4",
|
|
149
|
+
children: [/* @__PURE__ */ S("h4", {
|
|
150
|
+
className: "mb-2 text-xs font-semibold uppercase text-muted-foreground",
|
|
151
|
+
children: A("sandbox.detail.scriptRunner.history", "Run history")
|
|
152
|
+
}), /* @__PURE__ */ S("ul", {
|
|
153
|
+
className: "divide-y rounded-lg border",
|
|
154
|
+
children: Y.map((n) => /* @__PURE__ */ C("li", {
|
|
155
|
+
className: "flex items-center gap-3 px-3 py-2 text-sm",
|
|
156
|
+
children: [
|
|
157
|
+
/* @__PURE__ */ S(D, {
|
|
158
|
+
status: n.status,
|
|
159
|
+
exitCode: n.exitCode,
|
|
160
|
+
tr: A
|
|
161
|
+
}),
|
|
162
|
+
/* @__PURE__ */ C("button", {
|
|
163
|
+
type: "button",
|
|
164
|
+
onClick: () => B(n.id),
|
|
165
|
+
className: "min-w-0 flex-1 truncate text-left hover:underline",
|
|
166
|
+
children: [
|
|
167
|
+
/* @__PURE__ */ S("span", {
|
|
168
|
+
className: "font-mono text-xs",
|
|
169
|
+
children: n.interpreter
|
|
170
|
+
}),
|
|
171
|
+
n.label ? ` · ${n.label}` : "",
|
|
172
|
+
/* @__PURE__ */ S("span", {
|
|
173
|
+
className: "ml-1 text-xs text-muted-foreground",
|
|
174
|
+
children: new Date(n.createdAt).toLocaleString()
|
|
175
|
+
})
|
|
176
|
+
]
|
|
177
|
+
}),
|
|
178
|
+
n.promotedAt ? /* @__PURE__ */ C(e, {
|
|
179
|
+
className: "shrink-0 gap-1 bg-green-500/10 text-green-600",
|
|
180
|
+
children: [/* @__PURE__ */ S(_, { size: 12 }), A("sandbox.detail.scriptRunner.promoted", "Promoted")]
|
|
181
|
+
}) : n.status === "succeeded" && /* @__PURE__ */ C(t, {
|
|
182
|
+
variant: "outline",
|
|
183
|
+
onClick: () => void Q(n.id),
|
|
184
|
+
disabled: J,
|
|
185
|
+
className: "shrink-0",
|
|
186
|
+
title: A("sandbox.detail.scriptRunner.promoteTitle", "Sign off this reviewed run for the real target"),
|
|
187
|
+
children: [/* @__PURE__ */ S(p, { size: 12 }), A("sandbox.detail.scriptRunner.promote", "Promote")]
|
|
188
|
+
})
|
|
189
|
+
]
|
|
190
|
+
}, n.id))
|
|
191
|
+
})]
|
|
192
|
+
})
|
|
193
|
+
]
|
|
194
|
+
}) });
|
|
195
|
+
}
|
|
196
|
+
function D({ status: t, exitCode: n, tr: r }) {
|
|
197
|
+
return t === "running" ? /* @__PURE__ */ C(e, {
|
|
198
|
+
className: "gap-1 bg-blue-500/10 text-blue-600",
|
|
199
|
+
children: [/* @__PURE__ */ S(h, {
|
|
200
|
+
size: 12,
|
|
201
|
+
className: "animate-spin"
|
|
202
|
+
}), r("sandbox.detail.scriptRunner.status.running", "Running")]
|
|
203
|
+
}) : t === "succeeded" ? /* @__PURE__ */ C(e, {
|
|
204
|
+
className: "gap-1 bg-green-500/10 text-green-600",
|
|
205
|
+
children: [/* @__PURE__ */ S(m, { size: 12 }), r("sandbox.detail.scriptRunner.status.succeeded", "Succeeded")]
|
|
206
|
+
}) : /* @__PURE__ */ C(e, {
|
|
207
|
+
className: "gap-1 bg-destructive/10 text-destructive",
|
|
208
|
+
children: [/* @__PURE__ */ S(y, { size: 12 }), t === "error" ? r("sandbox.detail.scriptRunner.status.error", "Error") : `${r("sandbox.detail.scriptRunner.status.failed", "Failed")}${n == null ? "" : ` (${n})`}`]
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
function O({ run: e, tr: t }) {
|
|
212
|
+
return /* @__PURE__ */ C("div", {
|
|
213
|
+
className: "rounded-lg border bg-muted/30 p-3",
|
|
214
|
+
children: [
|
|
215
|
+
/* @__PURE__ */ C("div", {
|
|
216
|
+
className: "mb-2 flex items-center gap-2 text-xs text-muted-foreground",
|
|
217
|
+
children: [/* @__PURE__ */ S(D, {
|
|
218
|
+
status: e.status,
|
|
219
|
+
exitCode: e.exitCode,
|
|
220
|
+
tr: t
|
|
221
|
+
}), e.durationMs != null && /* @__PURE__ */ C("span", { children: [e.durationMs, " ms"] })]
|
|
222
|
+
}),
|
|
223
|
+
e.stdout && /* @__PURE__ */ S("pre", {
|
|
224
|
+
className: "max-h-64 overflow-auto whitespace-pre-wrap break-words font-mono text-xs",
|
|
225
|
+
children: e.stdout
|
|
226
|
+
}),
|
|
227
|
+
e.stderr && /* @__PURE__ */ S("pre", {
|
|
228
|
+
className: "mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-words font-mono text-xs text-destructive",
|
|
229
|
+
children: e.stderr
|
|
230
|
+
}),
|
|
231
|
+
!e.stdout && !e.stderr && /* @__PURE__ */ S("p", {
|
|
232
|
+
className: "text-xs text-muted-foreground",
|
|
233
|
+
children: t("sandbox.detail.scriptRunner.noOutput", "(no output)")
|
|
234
|
+
})
|
|
235
|
+
]
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
//#endregion
|
|
239
|
+
export { E as SandboxScriptRunnerPanel };
|
|
240
|
+
|
|
241
|
+
//# sourceMappingURL=SandboxScriptRunnerPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SandboxScriptRunnerPanel.js","names":[],"sources":["../../../src/sandbox/components/SandboxScriptRunnerPanel.tsx"],"sourcesContent":["import { useState, useEffect, useCallback, useMemo } from 'react';\nimport { useSearchParams } from 'react-router-dom';\nimport {\n Terminal,\n Play,\n Loader2,\n CheckCircle2,\n XCircle,\n AlertCircle,\n ArrowUpCircle,\n ShieldCheck,\n} from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\n\nimport { Button, Card, CardContent, Badge } from './ui';\nimport { tWithFallback } from '../utils/i18n';\nimport {\n useSandboxScriptRunsQuery,\n useRunSandboxScriptMutation,\n usePromoteSandboxScriptRunMutation,\n type SandboxScriptRunFieldsFragment,\n} from '../../generated/wspace-operations';\n\nconst INTERPRETERS = ['bash', 'sh', 'python', 'node'] as const;\n\nfunction decodeSeed(raw: string | null): string {\n if (!raw) return '';\n try {\n // Accept base64 (used by deep-links, e.g. the assistant's \"Send to Sandbox\") or plain text.\n return atob(raw);\n } catch {\n return raw;\n }\n}\n\n/**\n * SandboxScriptRunnerPanel — the sandbox-safe-execution review surface. Paste (or deep-link in via\n * `?script=<base64>`) an AI-generated script, run it inside this isolated sandbox, and review the\n * captured stdout/stderr/exit code. Each run is recorded; a run that succeeded can be promoted to the\n * real target, which stamps the sign-off onto the same record. The sandbox must be running.\n */\nexport function SandboxScriptRunnerPanel({\n sandbox,\n workspaceId,\n}: {\n sandbox: { id: string; status?: string | null };\n workspaceId: string;\n}): React.ReactElement {\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => tWithFallback(t, key, fallback);\n const [searchParams, setSearchParams] = useSearchParams();\n\n const [script, setScript] = useState<string>(() => decodeSeed(searchParams.get('script')));\n const [interpreter, setInterpreter] = useState<(typeof INTERPRETERS)[number]>('bash');\n const [label, setLabel] = useState('');\n const [activeRunId, setActiveRunId] = useState<string | null>(null);\n\n const isRunning = sandbox.status === 'RUNNING';\n\n const { data, refetch } = useSandboxScriptRunsQuery({\n variables: { sandboxId: sandbox.id, context: { workspaceId } },\n skip: !workspaceId,\n fetchPolicy: 'cache-and-network',\n });\n const [runScript, { loading: running, error: runError }] = useRunSandboxScriptMutation();\n const [promote, { loading: promoting }] = usePromoteSandboxScriptRunMutation();\n\n const runs = useMemo<SandboxScriptRunFieldsFragment[]>(\n () => data?.sandboxScriptRuns ?? [],\n [data]\n );\n const activeRun = runs.find((r) => r.id === activeRunId) ?? runs[0] ?? null;\n\n // One-shot: if we were deep-linked with a script, clear it from the URL so a refresh doesn't re-seed.\n useEffect(() => {\n if (searchParams.get('script')) {\n const next = new URLSearchParams(searchParams);\n next.delete('script');\n setSearchParams(next, { replace: true });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleRun = useCallback(async () => {\n if (!script.trim() || !isRunning) return;\n try {\n const res = await runScript({\n variables: {\n input: {\n sandboxId: sandbox.id,\n script,\n interpreter,\n label: label.trim() || null,\n context: { workspaceId },\n },\n },\n });\n const created = res.data?.runSandboxScript;\n if (created) setActiveRunId(created.id);\n await refetch();\n } catch {\n // surfaced via runError below\n }\n }, [script, isRunning, runScript, sandbox.id, interpreter, label, workspaceId, refetch]);\n\n const handlePromote = useCallback(\n async (runId: string) => {\n try {\n await promote({ variables: { id: runId, note: null, context: { workspaceId } } });\n await refetch();\n } catch {\n // surfaced inline on the run row via refetch\n }\n },\n [promote, workspaceId, refetch]\n );\n\n return (\n <Card>\n <CardContent className=\"p-5\">\n <div className=\"mb-4 flex items-center justify-between\">\n <h3 className=\"flex items-center gap-2 font-semibold\">\n <div className=\"rounded-lg bg-primary/10 p-1.5\">\n <Terminal size={14} className=\"text-primary\" />\n </div>\n {tr('sandbox.detail.scriptRunner.title', 'Script Runner')}\n </h3>\n </div>\n <p className=\"mb-3 text-sm text-muted-foreground\">\n {tr(\n 'sandbox.detail.scriptRunner.subtitle',\n 'Run an AI-generated script in this isolated sandbox and review the output before promoting it to the real target.'\n )}\n </p>\n\n {!isRunning && (\n <div className=\"mb-3 flex items-center gap-2 rounded-lg bg-amber-500/10 px-3 py-2 text-sm text-amber-600\">\n <AlertCircle size={14} />\n {tr(\n 'sandbox.detail.scriptRunner.notRunning',\n 'The sandbox must be running to execute a script.'\n )}\n </div>\n )}\n\n <div className=\"space-y-3\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <select\n value={interpreter}\n onChange={(e) => setInterpreter(e.target.value as (typeof INTERPRETERS)[number])}\n className=\"rounded-lg border bg-background px-2 py-1 font-mono text-xs\"\n >\n {INTERPRETERS.map((i) => (\n <option key={i} value={i}>\n {i}\n </option>\n ))}\n </select>\n <input\n value={label}\n onChange={(e) => setLabel(e.target.value)}\n placeholder={tr('sandbox.detail.scriptRunner.labelPlaceholder', 'Label (optional)')}\n className=\"flex-1 rounded-lg border bg-background px-2 py-1 text-xs\"\n />\n </div>\n <textarea\n value={script}\n onChange={(e) => setScript(e.target.value)}\n spellCheck={false}\n placeholder={tr(\n 'sandbox.detail.scriptRunner.placeholder',\n '# Paste the AI-generated script here, then Run to test it in the sandbox'\n )}\n className=\"h-40 w-full resize-y rounded-lg border bg-background p-3 font-mono text-xs\"\n />\n <div className=\"flex justify-end\">\n <Button\n onClick={() => void handleRun()}\n disabled={!isRunning || running || !script.trim()}\n >\n {running ? <Loader2 size={14} className=\"animate-spin\" /> : <Play size={14} />}\n {tr('sandbox.detail.scriptRunner.run', 'Run in sandbox')}\n </Button>\n </div>\n {runError && (\n <div className=\"flex items-center gap-2 rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive\">\n <XCircle size={14} />\n {runError.message}\n </div>\n )}\n </div>\n\n {activeRun && (\n <div className=\"mt-4\">\n <RunOutput run={activeRun} tr={tr} />\n </div>\n )}\n\n {runs.length > 0 && (\n <div className=\"mt-4\">\n <h4 className=\"mb-2 text-xs font-semibold uppercase text-muted-foreground\">\n {tr('sandbox.detail.scriptRunner.history', 'Run history')}\n </h4>\n <ul className=\"divide-y rounded-lg border\">\n {runs.map((r) => (\n <li key={r.id} className=\"flex items-center gap-3 px-3 py-2 text-sm\">\n <RunStatusBadge status={r.status} exitCode={r.exitCode} tr={tr} />\n <button\n type=\"button\"\n onClick={() => setActiveRunId(r.id)}\n className=\"min-w-0 flex-1 truncate text-left hover:underline\"\n >\n <span className=\"font-mono text-xs\">{r.interpreter}</span>\n {r.label ? ` · ${r.label}` : ''}\n <span className=\"ml-1 text-xs text-muted-foreground\">\n {new Date(r.createdAt as unknown as string).toLocaleString()}\n </span>\n </button>\n {r.promotedAt ? (\n <Badge className=\"shrink-0 gap-1 bg-green-500/10 text-green-600\">\n <ShieldCheck size={12} />\n {tr('sandbox.detail.scriptRunner.promoted', 'Promoted')}\n </Badge>\n ) : (\n r.status === 'succeeded' && (\n <Button\n variant=\"outline\"\n onClick={() => void handlePromote(r.id)}\n disabled={promoting}\n className=\"shrink-0\"\n title={tr(\n 'sandbox.detail.scriptRunner.promoteTitle',\n 'Sign off this reviewed run for the real target'\n )}\n >\n <ArrowUpCircle size={12} />\n {tr('sandbox.detail.scriptRunner.promote', 'Promote')}\n </Button>\n )\n )}\n </li>\n ))}\n </ul>\n </div>\n )}\n </CardContent>\n </Card>\n );\n}\n\nfunction RunStatusBadge({\n status,\n exitCode,\n tr,\n}: {\n status: string;\n exitCode?: number | null;\n tr: (k: string, f: string) => string;\n}): React.ReactElement {\n if (status === 'running') {\n return (\n <Badge className=\"gap-1 bg-blue-500/10 text-blue-600\">\n <Loader2 size={12} className=\"animate-spin\" />\n {tr('sandbox.detail.scriptRunner.status.running', 'Running')}\n </Badge>\n );\n }\n if (status === 'succeeded') {\n return (\n <Badge className=\"gap-1 bg-green-500/10 text-green-600\">\n <CheckCircle2 size={12} />\n {tr('sandbox.detail.scriptRunner.status.succeeded', 'Succeeded')}\n </Badge>\n );\n }\n return (\n <Badge className=\"gap-1 bg-destructive/10 text-destructive\">\n <XCircle size={12} />\n {status === 'error'\n ? tr('sandbox.detail.scriptRunner.status.error', 'Error')\n : `${tr('sandbox.detail.scriptRunner.status.failed', 'Failed')}${\n exitCode != null ? ` (${exitCode})` : ''\n }`}\n </Badge>\n );\n}\n\nfunction RunOutput({\n run,\n tr,\n}: {\n run: SandboxScriptRunFieldsFragment;\n tr: (k: string, f: string) => string;\n}): React.ReactElement {\n return (\n <div className=\"rounded-lg border bg-muted/30 p-3\">\n <div className=\"mb-2 flex items-center gap-2 text-xs text-muted-foreground\">\n <RunStatusBadge status={run.status} exitCode={run.exitCode} tr={tr} />\n {run.durationMs != null && <span>{run.durationMs} ms</span>}\n </div>\n {run.stdout && (\n <pre className=\"max-h-64 overflow-auto whitespace-pre-wrap break-words font-mono text-xs\">\n {run.stdout}\n </pre>\n )}\n {run.stderr && (\n <pre className=\"mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-words font-mono text-xs text-destructive\">\n {run.stderr}\n </pre>\n )}\n {!run.stdout && !run.stderr && (\n <p className=\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