@mgamadeus/ddd-agent-sandbox 0.2.4 → 0.2.6
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/README.md +7 -3
- package/dist/i18n-keys.json +1 -1
- package/dist/screen/index.d.ts +30 -10
- package/dist/screen/index.js +50 -8
- package/dist/screen/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -13,14 +13,18 @@ export const sandboxesApi = createSandboxesApi({ baseApi: adminApi, apiPrefix: '
|
|
|
13
13
|
|
|
14
14
|
- `.` — client, endpoint definitions, payload types, a static api for reviews (`createStaticSandboxesApi`).
|
|
15
15
|
- `./screen` — `SandboxesScreen` (list with state, usage, mount, actions), `SandboxDetailScreen` (files with safe
|
|
16
|
-
previews, unsaved changes, processes and jobs, commands, conversations, session log, audit
|
|
16
|
+
previews, unsaved changes, processes and jobs, commands, conversations, session log, audit; the host's loaders
|
|
17
|
+
`loadPdfJs`, `loadCodeHighlighter` and `renderMarkdown` are optional and reach the file preview), `useSandboxActions`
|
|
17
18
|
(start, offload, kill a job, end, reset; forced actions need a reason, a reset the workspace's name).
|
|
18
19
|
- `./i18n-keys.json` — the text manifest (keys, contexts, translator hints) for the host's text export.
|
|
19
20
|
|
|
20
|
-
Peers: `@mgamadeus/ddd-admin-ui` ≥ 0.
|
|
21
|
+
Peers: `@mgamadeus/ddd-admin-ui` ≥ 0.8.0, `@mgamadeus/ddd-web`, `lucide-react`, React 19. The screens need
|
|
21
22
|
`AdminUiProvider` above them and Tailwind scanning `node_modules/@mgamadeus/ddd-agent-sandbox/dist`.
|
|
22
23
|
|
|
23
24
|
File names, command lines and outputs are foreign text: the screens show them as text only; files are served by the
|
|
24
|
-
backend as untrusted content (attachment, sandbox CSP; raster pictures and PDF inline).
|
|
25
|
+
backend as untrusted content (attachment, sandbox CSP; raster pictures and PDF inline). A text file is drawn by its
|
|
26
|
+
name: plain, as a source file (coloured when the host passes `loadCodeHighlighter`; tokens as text nodes) or as
|
|
27
|
+
Markdown (markup only through the host's `renderMarkdown`, which has to be the untrusted pipeline:
|
|
28
|
+
`source => <MarkdownPreview source={source} untrusted />` of `@mgamadeus/ddd-admin-ui/markdown`).
|
|
25
29
|
|
|
26
30
|
MIT
|
package/dist/i18n-keys.json
CHANGED
package/dist/screen/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as _mgamadeus_ddd_admin_ui_logic from '@mgamadeus/ddd-admin-ui/logic';
|
|
|
2
2
|
import { SandboxActionOutcome, SandboxCommandStatus, SandboxState, SandboxCommand, SandboxWorkspace, SandboxesApi, SandboxConversation, SandboxFileEntry } from '../index.js';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
|
-
import { PdfJsLoader } from '@mgamadeus/ddd-admin-ui/files';
|
|
5
|
+
import { FilePreviewLoaders, PdfJsLoader, CodeHighlighterLoader, MarkdownFileRenderer } from '@mgamadeus/ddd-admin-ui/files';
|
|
6
6
|
import '@mgamadeus/ddd-admin-ui/logic/pure';
|
|
7
7
|
|
|
8
8
|
/** `SandboxWorkspace.state`. */
|
|
@@ -47,6 +47,14 @@ declare const sandboxPathCrumbs: (path: string) => {
|
|
|
47
47
|
/** How a file is previewed, from the type the server sent with its bytes. */
|
|
48
48
|
type SandboxPreviewKind = 'image' | 'pdf' | 'text' | 'none';
|
|
49
49
|
declare const sandboxPreviewKindOf: (contentType: string) => SandboxPreviewKind;
|
|
50
|
+
/** How the text of a file is drawn. */
|
|
51
|
+
type SandboxTextView = 'markdown' | 'code' | 'text';
|
|
52
|
+
/**
|
|
53
|
+
* How the text of a file is drawn, by the file's name: the server sends every text as `text/plain`, so the name
|
|
54
|
+
* alone says Markdown (`.md`, `.markdown`) or a source file (the extensions the file blocks of
|
|
55
|
+
* `@mgamadeus/ddd-admin-ui` know a language for). Everything else stays plain text.
|
|
56
|
+
*/
|
|
57
|
+
declare const sandboxTextViewOf: (fileName: string) => SandboxTextView;
|
|
50
58
|
/** The inline text preview of the server stops here; a larger answer was cut. */
|
|
51
59
|
declare const SANDBOX_TEXT_PREVIEW_BYTES: number;
|
|
52
60
|
|
|
@@ -114,7 +122,13 @@ declare const SANDBOX_DETAIL_TABS: readonly [{
|
|
|
114
122
|
readonly context: "sandbox-tab";
|
|
115
123
|
}];
|
|
116
124
|
type SandboxDetailTab = (typeof SANDBOX_DETAIL_TABS)[number]['id'];
|
|
117
|
-
|
|
125
|
+
/**
|
|
126
|
+
* `loadPdfJs`, `loadCodeHighlighter`, `renderMarkdown` (the loaders of the file blocks, each optional): pdf.js for the
|
|
127
|
+
* PDF preview, a highlighter for source files, and the renderer of a Markdown file. A workspace file is untrusted
|
|
128
|
+
* text: the host's `renderMarkdown` uses the untrusted pipeline (`MarkdownPreview untrusted` of
|
|
129
|
+
* `@mgamadeus/ddd-admin-ui/markdown`).
|
|
130
|
+
*/
|
|
131
|
+
interface SandboxDetailScreenProps extends FilePreviewLoaders {
|
|
118
132
|
api: SandboxesApi;
|
|
119
133
|
workspaceKey: string;
|
|
120
134
|
/** The open tab (controlled, e.g. from the URL); without it the screen keeps it. */
|
|
@@ -125,16 +139,15 @@ interface SandboxDetailScreenProps {
|
|
|
125
139
|
headerActions?: ReactNode;
|
|
126
140
|
/** The link of a conversation in the host's agent screens; `null` = no link. */
|
|
127
141
|
buildConversationHref?: (conversation: SandboxConversation) => string | null;
|
|
128
|
-
/** pdf.js of the host for the PDF preview. */
|
|
129
|
-
loadPdfJs?: PdfJsLoader;
|
|
130
142
|
}
|
|
131
143
|
/**
|
|
132
144
|
* One workspace: its facts (state, disk and memory against their limits, mount mode, runner pod, owner) and the tabs
|
|
133
145
|
* Files (read only, the safe preview), Unsaved changes, Processes & jobs (kill), Commands (exit code, duration, output
|
|
134
146
|
* tails), Conversations, Session log and Audit. Start, offload, end and reset (typed name) are audited and refused
|
|
135
|
-
* while a turn runs on the space unless forced with a reason. Everything from the sandbox is shown as text
|
|
147
|
+
* while a turn runs on the space unless forced with a reason. Everything from the sandbox is shown as text; the one
|
|
148
|
+
* exception is a Markdown file when the host passes `renderMarkdown`, whose markup is the host's renderer's.
|
|
136
149
|
*/
|
|
137
|
-
declare const SandboxDetailScreen: ({ api, workspaceKey, tab: controlledTab, onTabChange, backLink, headerActions, buildConversationHref, loadPdfJs, }: SandboxDetailScreenProps) => react.JSX.Element;
|
|
150
|
+
declare const SandboxDetailScreen: ({ api, workspaceKey, tab: controlledTab, onTabChange, backLink, headerActions, buildConversationHref, loadPdfJs, loadCodeHighlighter, renderMarkdown, }: SandboxDetailScreenProps) => react.JSX.Element;
|
|
138
151
|
|
|
139
152
|
interface SandboxFilePreviewProps {
|
|
140
153
|
api: SandboxesApi;
|
|
@@ -142,13 +155,20 @@ interface SandboxFilePreviewProps {
|
|
|
142
155
|
file: SandboxFileEntry;
|
|
143
156
|
/** pdf.js of the host (without it a PDF offers its download only). */
|
|
144
157
|
loadPdfJs?: PdfJsLoader;
|
|
158
|
+
/** A highlighter of the host, loaded on the first source file shown (without it a source file shows plain). */
|
|
159
|
+
loadCodeHighlighter?: CodeHighlighterLoader;
|
|
160
|
+
/** Draws a Markdown file as markup, as untrusted text (without it a Markdown file shows its source). */
|
|
161
|
+
renderMarkdown?: MarkdownFileRenderer;
|
|
145
162
|
}
|
|
146
163
|
/**
|
|
147
164
|
* A file of a workspace, read only, as untrusted content: the server picks the type from the bytes; JPEG, PNG, GIF
|
|
148
165
|
* and WebP draw as `<img>`, PDF on canvases through the host's pdf.js, text as text nodes (the first 256 KB); anything
|
|
149
|
-
* else only downloads.
|
|
166
|
+
* else only downloads. A text the server sent is drawn by the file's name: a source file with the host's highlighter
|
|
167
|
+
* (its tokens as text nodes), a Markdown file through the host's renderer with a switch to its source, everything
|
|
168
|
+
* else plain. The package itself never renders file content as HTML; a host's `renderMarkdown` has to treat the text
|
|
169
|
+
* as untrusted.
|
|
150
170
|
*/
|
|
151
|
-
declare const SandboxFilePreview: ({ api, workspaceKey, file, loadPdfJs }: SandboxFilePreviewProps) => react.JSX.Element;
|
|
171
|
+
declare const SandboxFilePreview: ({ api, workspaceKey, file, loadPdfJs, loadCodeHighlighter, renderMarkdown }: SandboxFilePreviewProps) => react.JSX.Element;
|
|
152
172
|
|
|
153
173
|
/** One action of the sandbox screens. */
|
|
154
174
|
type SandboxActionRequest = {
|
|
@@ -173,5 +193,5 @@ interface SandboxActions {
|
|
|
173
193
|
*/
|
|
174
194
|
declare const useSandboxActions: (api: SandboxesApi) => SandboxActions;
|
|
175
195
|
|
|
176
|
-
export { SANDBOX_ACTION_LABELS, SANDBOX_ACTION_LABEL_CONTEXT, SANDBOX_ACTION_OUTCOME, SANDBOX_CHANGE_LABELS, SANDBOX_CHANGE_LABEL_CONTEXT, SANDBOX_COMMAND_STATE, SANDBOX_DETAIL_TABS, SANDBOX_STATE, SANDBOX_TEXT_PREVIEW_BYTES, SandboxActionsMenu, SandboxDetailScreen, SandboxFilePreview, SandboxMountMode, SandboxUsageBar, SandboxesScreen, formatSandboxBytes, formatSandboxDuration, isSandboxTurnRunningRefusal, sandboxCommandStateOf, sandboxNameOf, sandboxParentPathOf, sandboxPathCrumbs, sandboxPreviewKindOf, sandboxResetPhraseOf, usagePercentOf, useSandboxActions };
|
|
177
|
-
export type { SandboxActionRequest, SandboxActions, SandboxCommandState, SandboxDetailScreenProps, SandboxDetailTab, SandboxFilePreviewProps, SandboxPreviewKind, SandboxesScreenProps };
|
|
196
|
+
export { SANDBOX_ACTION_LABELS, SANDBOX_ACTION_LABEL_CONTEXT, SANDBOX_ACTION_OUTCOME, SANDBOX_CHANGE_LABELS, SANDBOX_CHANGE_LABEL_CONTEXT, SANDBOX_COMMAND_STATE, SANDBOX_DETAIL_TABS, SANDBOX_STATE, SANDBOX_TEXT_PREVIEW_BYTES, SandboxActionsMenu, SandboxDetailScreen, SandboxFilePreview, SandboxMountMode, SandboxUsageBar, SandboxesScreen, formatSandboxBytes, formatSandboxDuration, isSandboxTurnRunningRefusal, sandboxCommandStateOf, sandboxNameOf, sandboxParentPathOf, sandboxPathCrumbs, sandboxPreviewKindOf, sandboxResetPhraseOf, sandboxTextViewOf, usagePercentOf, useSandboxActions };
|
|
197
|
+
export type { SandboxActionRequest, SandboxActions, SandboxCommandState, SandboxDetailScreenProps, SandboxDetailTab, SandboxFilePreviewProps, SandboxPreviewKind, SandboxTextView, SandboxesScreenProps };
|
package/dist/screen/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// src/screen/format.ts
|
|
4
4
|
import { Archive, CircleCheck, CircleDot, CircleX, Clock, Moon, Play, ShieldAlert } from "lucide-react";
|
|
5
|
+
import { extensionOf, filePreviewKind } from "@mgamadeus/ddd-admin-ui/files";
|
|
5
6
|
import { formatUiNumber } from "@mgamadeus/ddd-admin-ui/i18n";
|
|
6
7
|
import { m } from "@mgamadeus/ddd-admin-ui/i18n";
|
|
7
8
|
import { defineStatusMap } from "@mgamadeus/ddd-admin-ui/logic";
|
|
@@ -116,6 +117,10 @@ var sandboxPreviewKindOf = (contentType) => {
|
|
|
116
117
|
if (type === "text/plain") return "text";
|
|
117
118
|
return "none";
|
|
118
119
|
};
|
|
120
|
+
var sandboxTextViewOf = (fileName) => {
|
|
121
|
+
const kind = filePreviewKind({ family: "TEXT", extension: extensionOf(fileName) });
|
|
122
|
+
return kind === "markdown" || kind === "code" ? kind : "text";
|
|
123
|
+
};
|
|
119
124
|
var SANDBOX_TEXT_PREVIEW_BYTES = 256 * 1024;
|
|
120
125
|
|
|
121
126
|
// src/screen/SandboxesScreen.tsx
|
|
@@ -503,8 +508,14 @@ import { Skeleton as Skeleton2 } from "@mgamadeus/ddd-admin-ui/primitives";
|
|
|
503
508
|
import { normalizeDddError as normalizeDddError3 } from "@mgamadeus/ddd-web/contract";
|
|
504
509
|
import { Download } from "lucide-react";
|
|
505
510
|
import { useEffect, useState as useState3 } from "react";
|
|
506
|
-
import {
|
|
507
|
-
|
|
511
|
+
import {
|
|
512
|
+
codeLanguageOfExtension,
|
|
513
|
+
CodePreview,
|
|
514
|
+
extensionOf as extensionOf2,
|
|
515
|
+
MarkdownFilePreview,
|
|
516
|
+
PdfPreview,
|
|
517
|
+
TextPreview
|
|
518
|
+
} from "@mgamadeus/ddd-admin-ui/files";
|
|
508
519
|
import { useTranslate as useTranslate3 } from "@mgamadeus/ddd-admin-ui/i18n";
|
|
509
520
|
import { notify as notify2 } from "@mgamadeus/ddd-admin-ui/logic";
|
|
510
521
|
import { Button as Button2 } from "@mgamadeus/ddd-admin-ui/primitives";
|
|
@@ -521,12 +532,13 @@ var saveBlob = (blob, fileName) => {
|
|
|
521
532
|
link.remove();
|
|
522
533
|
setTimeout(() => URL.revokeObjectURL(url), 1e4);
|
|
523
534
|
};
|
|
524
|
-
var SandboxFilePreview = ({ api, workspaceKey, file, loadPdfJs }) => {
|
|
535
|
+
var SandboxFilePreview = ({ api, workspaceKey, file, loadPdfJs, loadCodeHighlighter, renderMarkdown }) => {
|
|
525
536
|
const { t } = useTranslate3();
|
|
526
537
|
const [requestContent] = api.useSandboxFileContentMutation();
|
|
527
538
|
const [preview, setPreview] = useState3(null);
|
|
528
539
|
const [failed, setFailed] = useState3(null);
|
|
529
540
|
const [downloading, setDownloading] = useState3(false);
|
|
541
|
+
const textView = sandboxTextViewOf(file.name);
|
|
530
542
|
useEffect(() => {
|
|
531
543
|
let cancelled = false;
|
|
532
544
|
let objectUrl = null;
|
|
@@ -564,7 +576,15 @@ var SandboxFilePreview = ({ api, workspaceKey, file, loadPdfJs }) => {
|
|
|
564
576
|
] })
|
|
565
577
|
] }),
|
|
566
578
|
failed ? /* @__PURE__ */ jsx3("p", { className: "text-[13px] text-muted-foreground", children: failed }) : !preview ? /* @__PURE__ */ jsx3(Skeleton, { className: "h-48 w-full rounded-xl" }) : preview.kind === "image" ? /* @__PURE__ */ jsx3("img", { src: preview.url, alt: file.name, className: "max-h-[60vh] max-w-full rounded-lg border object-contain" }) : preview.kind === "pdf" && loadPdfJs ? /* @__PURE__ */ jsx3(PdfPreview, { url: preview.url, fileName: file.name, loadPdfJs }) : preview.kind === "text" ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
567
|
-
/* @__PURE__ */ jsx3(
|
|
579
|
+
textView === "markdown" ? /* @__PURE__ */ jsx3(MarkdownFilePreview, { url: preview.url, fileName: file.name, renderMarkdown, loadCodeHighlighter }) : textView === "code" ? /* @__PURE__ */ jsx3(
|
|
580
|
+
CodePreview,
|
|
581
|
+
{
|
|
582
|
+
url: preview.url,
|
|
583
|
+
fileName: file.name,
|
|
584
|
+
language: codeLanguageOfExtension(extensionOf2(file.name)),
|
|
585
|
+
loadCodeHighlighter
|
|
586
|
+
}
|
|
587
|
+
) : /* @__PURE__ */ jsx3(TextPreview, { url: preview.url, fileName: file.name }),
|
|
568
588
|
preview.size >= SANDBOX_TEXT_PREVIEW_BYTES && /* @__PURE__ */ jsx3("p", { className: "text-xs text-muted-foreground", children: t("Only the beginning of the file is shown; download it for the rest.") })
|
|
569
589
|
] }) : /* @__PURE__ */ jsx3("p", { className: "text-[13px] text-muted-foreground", children: t("No preview for this type (%size%): download it to open it.", { replacements: { size: formatSandboxBytes(file.sizeBytes ?? preview.size) } }) })
|
|
570
590
|
] });
|
|
@@ -585,7 +605,7 @@ var COMMAND_LIMIT = 50;
|
|
|
585
605
|
var LOG_LIMIT = 100;
|
|
586
606
|
var errorText = (error, fallback) => normalizeDddError4(error, fallback).message;
|
|
587
607
|
var UntrustedText = ({ text, className }) => text ? /* @__PURE__ */ jsx4("pre", { className: cn2("max-h-64 overflow-auto rounded-lg bg-muted p-3 font-mono text-xs whitespace-pre-wrap break-all", className), children: text }) : null;
|
|
588
|
-
var FilesTab = ({ api, workspaceKey, loadPdfJs }) => {
|
|
608
|
+
var FilesTab = ({ api, workspaceKey, loadPdfJs, loadCodeHighlighter, renderMarkdown }) => {
|
|
589
609
|
const { t } = useTranslate4();
|
|
590
610
|
const [directory, setDirectory] = useState4("");
|
|
591
611
|
const [openFile, setOpenFile] = useState4(null);
|
|
@@ -643,7 +663,17 @@ var FilesTab = ({ api, workspaceKey, loadPdfJs }) => {
|
|
|
643
663
|
)
|
|
644
664
|
}
|
|
645
665
|
),
|
|
646
|
-
/* @__PURE__ */ jsx4(Card, { children: /* @__PURE__ */ jsx4(CardContent, { className: "pt-6", children: openFile ? /* @__PURE__ */ jsx4(
|
|
666
|
+
/* @__PURE__ */ jsx4(Card, { children: /* @__PURE__ */ jsx4(CardContent, { className: "pt-6", children: openFile ? /* @__PURE__ */ jsx4(
|
|
667
|
+
SandboxFilePreview,
|
|
668
|
+
{
|
|
669
|
+
api,
|
|
670
|
+
workspaceKey,
|
|
671
|
+
file: openFile,
|
|
672
|
+
loadPdfJs,
|
|
673
|
+
loadCodeHighlighter,
|
|
674
|
+
renderMarkdown
|
|
675
|
+
}
|
|
676
|
+
) : /* @__PURE__ */ jsx4("p", { className: "py-10 text-center text-[13px] text-muted-foreground", children: t("Pick a file to see it. Files are shown read only.") }) }) })
|
|
647
677
|
] });
|
|
648
678
|
};
|
|
649
679
|
var ChangesTab = ({ api, workspaceKey }) => {
|
|
@@ -897,7 +927,9 @@ var SandboxDetailScreen = ({
|
|
|
897
927
|
backLink,
|
|
898
928
|
headerActions,
|
|
899
929
|
buildConversationHref,
|
|
900
|
-
loadPdfJs
|
|
930
|
+
loadPdfJs,
|
|
931
|
+
loadCodeHighlighter,
|
|
932
|
+
renderMarkdown
|
|
901
933
|
}) => {
|
|
902
934
|
const { t } = useTranslate4();
|
|
903
935
|
const workspaceQuery = api.useSandboxQuery({ workspaceKey });
|
|
@@ -1011,7 +1043,16 @@ var SandboxDetailScreen = ({
|
|
|
1011
1043
|
tabsLabel: t("Workspace views")
|
|
1012
1044
|
}
|
|
1013
1045
|
),
|
|
1014
|
-
tab === "files" && /* @__PURE__ */ jsx4(
|
|
1046
|
+
tab === "files" && /* @__PURE__ */ jsx4(
|
|
1047
|
+
FilesTab,
|
|
1048
|
+
{
|
|
1049
|
+
api,
|
|
1050
|
+
workspaceKey,
|
|
1051
|
+
loadPdfJs,
|
|
1052
|
+
loadCodeHighlighter,
|
|
1053
|
+
renderMarkdown
|
|
1054
|
+
}
|
|
1055
|
+
),
|
|
1015
1056
|
tab === "changes" && /* @__PURE__ */ jsx4(ChangesTab, { api, workspaceKey }),
|
|
1016
1057
|
tab === "processes" && /* @__PURE__ */ jsx4(ProcessesTab, { api, workspace, killDisabled: busy, onKill: (jobId) => void actions.run({ kind: "kill", workspace, jobId }) }),
|
|
1017
1058
|
tab === "commands" && /* @__PURE__ */ jsx4(CommandsTab, { api, workspaceKey }),
|
|
@@ -1047,6 +1088,7 @@ export {
|
|
|
1047
1088
|
sandboxPathCrumbs,
|
|
1048
1089
|
sandboxPreviewKindOf,
|
|
1049
1090
|
sandboxResetPhraseOf,
|
|
1091
|
+
sandboxTextViewOf,
|
|
1050
1092
|
usagePercentOf,
|
|
1051
1093
|
useSandboxActions
|
|
1052
1094
|
};
|
package/dist/screen/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/screen/format.ts","../../src/screen/SandboxesScreen.tsx","../../src/screen/useSandboxActions.tsx","../../src/screen/SandboxDetailScreen.tsx","../../src/screen/SandboxFilePreview.tsx"],"sourcesContent":["// Labels, states and numbers of the sandbox screens. Pure: no React.\nimport { Archive, CircleCheck, CircleDot, CircleX, Clock, Moon, Play, ShieldAlert } from 'lucide-react';\n\nimport { formatUiNumber } from '@mgamadeus/ddd-admin-ui/i18n';\nimport { m } from '@mgamadeus/ddd-admin-ui/i18n';\nimport { defineStatusMap } from '@mgamadeus/ddd-admin-ui/logic';\nimport type { SandboxActionOutcome, SandboxCommand, SandboxCommandStatus, SandboxState, SandboxWorkspace } from '../types.ts';\n\n/** `SandboxWorkspace.state`. */\nexport const SANDBOX_STATE = defineStatusMap<SandboxState>({\n RUNNING: {\n label: m('Running', { context: 'sandbox-state' }),\n tone: 'success',\n icon: Play,\n description: m('A session is open: commands run and files live on the runner', { context: 'sandbox-state' }),\n },\n IDLE: {\n label: m('Idle', { context: 'sandbox-state' }),\n tone: 'info',\n icon: Moon,\n description: m('The session is open but nothing ran for a while', { context: 'sandbox-state' }),\n },\n OFFLOADED: {\n label: m('Offloaded', { context: 'sandbox-state' }),\n tone: 'neutral',\n icon: Archive,\n description: m('No session: the workspace is saved and starts again on the next command', { context: 'sandbox-state' }),\n },\n}, { context: 'sandbox-state' });\n\n/** `SandboxActionLogEntry.outcome`. */\nexport const SANDBOX_ACTION_OUTCOME = defineStatusMap<SandboxActionOutcome>({\n SUCCEEDED: { label: m('Done', { context: 'sandbox-action-outcome' }), tone: 'success', icon: CircleCheck },\n REFUSED: {\n label: m('Refused', { context: 'sandbox-action-outcome' }),\n tone: 'warning',\n icon: ShieldAlert,\n description: m('Not run: a turn was running, a confirmation or a reason was missing', { context: 'sandbox-action-outcome' }),\n },\n FAILED: { label: m('Failed', { context: 'sandbox-action-outcome' }), tone: 'danger', icon: CircleX },\n}, { context: 'sandbox-action-outcome' });\n\n/**\n * The state of a command: the server's `status`, else derived from the exit code — an exit code\n * is EXITED, none is UNKNOWN (a killed or timed-out command has none either, so it is never shown as running).\n */\nexport type SandboxCommandState = SandboxCommandStatus | 'UNKNOWN';\n\nexport const sandboxCommandStateOf = (command: Pick<SandboxCommand, 'status' | 'exitCode'>): SandboxCommandState => {\n if (command.status) return command.status;\n return command.exitCode === null || command.exitCode === undefined ? 'UNKNOWN' : 'EXITED';\n};\n\n/** `SandboxCommand.status` as a badge (EXITED carries the exit code next to it). */\nexport const SANDBOX_COMMAND_STATE = defineStatusMap<SandboxCommandState>({\n RUNNING: { label: m('Running', { context: 'sandbox-command-state' }), tone: 'info', icon: Play },\n EXITED: { label: m('Exited', { context: 'sandbox-command-state' }), tone: 'neutral', icon: CircleCheck },\n KILLED: {\n label: m('Killed', { context: 'sandbox-command-state' }),\n tone: 'warning',\n icon: CircleX,\n description: m('The command was stopped: its job was killed, the session ended or a limit was hit', { context: 'sandbox-command-state' }),\n },\n TIMED_OUT: {\n label: m('Timed out', { context: 'sandbox-command-state' }),\n tone: 'danger',\n icon: Clock,\n description: m('The runner stopped the command at its time limit', { context: 'sandbox-command-state' }),\n },\n UNKNOWN: {\n label: m('State unknown', { context: 'sandbox-command-state' }),\n tone: 'neutral',\n icon: CircleDot,\n description: m('The server reports no state and no exit code for this command', { context: 'sandbox-command-state' }),\n },\n}, { context: 'sandbox-command-state' });\n\n/** The translation context of `SANDBOX_ACTION_LABELS`. */\nexport const SANDBOX_ACTION_LABEL_CONTEXT = 'sandbox-action';\n\n/** The translation context of `SANDBOX_CHANGE_LABELS`. */\nexport const SANDBOX_CHANGE_LABEL_CONTEXT = 'sandbox-change';\n\n/** The actions of the audit, as the screen names them. */\nexport const SANDBOX_ACTION_LABELS: Readonly<Record<string, string>> = {\n START: m('Start session', { context: 'sandbox-action' }),\n OFFLOAD: m('Offload', { context: 'sandbox-action' }),\n KILL_JOB: m('Kill job', { context: 'sandbox-action' }),\n END: m('End session', { context: 'sandbox-action' }),\n RESET: m('Reset workspace', { context: 'sandbox-action' }),\n};\n\n/** How a drive change of the workspace is named. */\nexport const SANDBOX_CHANGE_LABELS: Readonly<Record<string, string>> = {\n ADDED: m('Added', { context: 'sandbox-change' }),\n MODIFIED: m('Changed', { context: 'sandbox-change' }),\n DELETED: m('Deleted', { context: 'sandbox-change' }),\n RENAMED: m('Renamed', { context: 'sandbox-change' }),\n};\n\n/** The icon of a session log entry: a limit hit is a warning, everything else a dot. */\nexport const sessionEventIconOf = (type: string) => (/EXCEEDED|DENIED|TIMEOUT|OOM|KILLED/i.test(type) ? ShieldAlert : CircleDot);\n\n/** `1.5 GB` in the UI language; `—` for unknown. */\nexport const formatSandboxBytes = (bytes: number | null | undefined): string => {\n if (bytes === null || bytes === undefined || !Number.isFinite(bytes)) return '—';\n const units = ['B', 'KB', 'MB', 'GB', 'TB'];\n let value = bytes;\n let unit = 0;\n while (value >= 1024 && unit < units.length - 1) {\n value /= 1024;\n unit += 1;\n }\n return `${formatUiNumber(value, { maximumFractionDigits: unit === 0 || value >= 100 ? 0 : 1 })} ${units[unit]}`;\n};\n\n/** `850 ms`, `12.4 s`, `3 min 5 s`; `—` for unknown. */\nexport const formatSandboxDuration = (milliseconds: number | null | undefined): string => {\n if (milliseconds === null || milliseconds === undefined || !Number.isFinite(milliseconds)) return '—';\n if (milliseconds < 1000) return `${formatUiNumber(Math.round(milliseconds))} ms`;\n const seconds = milliseconds / 1000;\n if (seconds < 60) return `${formatUiNumber(seconds, { maximumFractionDigits: 1 })} s`;\n const minutes = Math.floor(seconds / 60);\n return `${formatUiNumber(minutes)} min ${formatUiNumber(Math.round(seconds - minutes * 60))} s`;\n};\n\n/** The share of a limit in percent (0–100, rounded), `null` without a limit. */\nexport const usagePercentOf = (used: number | null | undefined, limit: number | null | undefined): number | null =>\n used === null || used === undefined || !limit || limit <= 0 ? null : Math.min(100, Math.max(0, Math.round((used / limit) * 100)));\n\n/** The name a workspace is shown with: its display name, else its key. */\nexport const sandboxNameOf = (workspace: Pick<SandboxWorkspace, 'displayName' | 'workspaceKey'>): string =>\n workspace.displayName?.trim() ? workspace.displayName : workspace.workspaceKey;\n\n/** What a reset asks the reader to type: the display name, or the key without one (the server checks the same). */\nexport const sandboxResetPhraseOf = (workspace: Pick<SandboxWorkspace, 'displayName' | 'workspaceKey'>): string => sandboxNameOf(workspace);\n\n/** Whether an error is the server's \"a turn is running\" refusal (409): the action may be forced with a reason. */\nexport const isSandboxTurnRunningRefusal = (error: unknown): boolean => (error as { status?: unknown } | null)?.status === 409;\n\n/** The parent of a workspace path (`a/b/c` → `a/b`, `a` → `''`). */\nexport const sandboxParentPathOf = (path: string): string => {\n const trimmed = path.replace(/\\/+$/, '');\n const index = trimmed.lastIndexOf('/');\n return index <= 0 ? '' : trimmed.slice(0, index);\n};\n\n/** The crumbs of a workspace directory: root first. */\nexport const sandboxPathCrumbs = (path: string): { name: string; path: string }[] => {\n const parts = path.split('/').filter(part => part !== '');\n return parts.map((name, index) => ({ name, path: parts.slice(0, index + 1).join('/') }));\n};\n\n/** How a file is previewed, from the type the server sent with its bytes. */\nexport type SandboxPreviewKind = 'image' | 'pdf' | 'text' | 'none';\n\nexport const sandboxPreviewKindOf = (contentType: string): SandboxPreviewKind => {\n const type = contentType.split(';')[0]?.trim().toLowerCase() ?? '';\n if (type === 'image/jpeg' || type === 'image/png' || type === 'image/gif' || type === 'image/webp') return 'image';\n if (type === 'application/pdf') return 'pdf';\n if (type === 'text/plain') return 'text';\n return 'none';\n};\n\n/** The inline text preview of the server stops here; a larger answer was cut. */\nexport const SANDBOX_TEXT_PREVIEW_BYTES = 256 * 1024;\n","'use client';\n\nimport { normalizeDddError } from '@mgamadeus/ddd-web/contract';\nimport { Activity, Archive, MoreHorizontal, Play, Power, RefreshCw } from 'lucide-react';\nimport { type ReactNode, useMemo, useState } from 'react';\n\nimport { m } from '@mgamadeus/ddd-admin-ui/i18n';\nimport { useTranslate } from '@mgamadeus/ddd-admin-ui/i18n';\nimport { DateCell } from '@mgamadeus/ddd-admin-ui/list';\nimport { EmptyValue } from '@mgamadeus/ddd-admin-ui/list';\nimport { EntityListBody } from '@mgamadeus/ddd-admin-ui/list';\nimport { EntityListCard } from '@mgamadeus/ddd-admin-ui/list';\nimport type { EntityListColumn } from '@mgamadeus/ddd-admin-ui/list';\nimport { EntityListToolbar } from '@mgamadeus/ddd-admin-ui/list';\nimport { StatusBadge } from '@mgamadeus/ddd-admin-ui/list';\nimport { PageHeader } from '@mgamadeus/ddd-admin-ui/page';\nimport { StatusCallout } from '@mgamadeus/ddd-admin-ui/page';\nimport { Badge } from '@mgamadeus/ddd-admin-ui/primitives';\nimport { Button } from '@mgamadeus/ddd-admin-ui/primitives';\nimport { cn } from '@mgamadeus/ddd-admin-ui/primitives';\nimport { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '@mgamadeus/ddd-admin-ui/primitives';\nimport type { SandboxesApi } from '../api.ts';\nimport { formatSandboxBytes, SANDBOX_STATE, sandboxNameOf, usagePercentOf } from './format.ts';\nimport type { SandboxState, SandboxWorkspace } from '../types.ts';\nimport { useSandboxActions } from './useSandboxActions.tsx';\n\n/** A used / limit pair as a thin bar with its numbers (no bar without a limit). */\nexport const SandboxUsageBar = ({ used, limit, peak }: { used: number | null | undefined; limit: number | null | undefined; peak?: number | null }) => {\n const { t } = useTranslate();\n const percent = usagePercentOf(used, limit);\n const peakPercent = usagePercentOf(peak, limit);\n if (used === null || used === undefined) return <EmptyValue />;\n return (\n <div className=\"min-w-28 space-y-1\">\n <p className=\"text-[12.5px] tabular-nums\">\n {formatSandboxBytes(used)}\n {limit ? <span className=\"text-muted-foreground\"> / {formatSandboxBytes(limit)}</span> : null}\n {peak !== undefined && peak !== null && (\n <span className=\"block text-xs text-muted-foreground\">{t('Peak %size%', { replacements: { size: formatSandboxBytes(peak) } })}</span>\n )}\n </p>\n {percent !== null && (\n <div className=\"relative h-1.5 w-full overflow-hidden rounded-full bg-muted\" role=\"presentation\">\n <div\n className={cn('h-full rounded-full', percent >= 90 ? 'bg-destructive' : percent >= 75 ? 'bg-warning' : 'bg-primary')}\n style={{ width: `${percent}%` }}\n />\n {peakPercent !== null && peakPercent > percent && (\n <div className=\"absolute top-0 h-full w-0.5 bg-foreground/50\" style={{ left: `calc(${peakPercent}% - 1px)` }} />\n )}\n </div>\n )}\n </div>\n );\n};\n\n/** The mount mode and why (FUSE: the drive is mounted; PLAIN: files are copied). */\nexport const SandboxMountMode = ({ workspace }: { workspace: SandboxWorkspace }) => {\n if (!workspace.mountMode) return <EmptyValue />;\n return (\n <span className=\"text-[12.5px]\">\n <Badge variant=\"outline\" className=\"font-mono\">\n {workspace.mountMode}\n </Badge>\n {workspace.mountModeReason && <span className=\"mt-0.5 block max-w-56 truncate text-xs text-muted-foreground\" title={workspace.mountModeReason}>{workspace.mountModeReason}</span>}\n </span>\n );\n};\n\n/** The actions of one workspace as a menu (start, offload, end). */\nexport const SandboxActionsMenu = ({\n workspace,\n onAction,\n disabled = false,\n}: {\n workspace: SandboxWorkspace;\n onAction: (kind: 'start' | 'offload' | 'end') => void;\n disabled?: boolean;\n}) => {\n const { t } = useTranslate();\n const hasSession = workspace.state !== 'OFFLOADED';\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n data-row-action-ignore\n disabled={disabled}\n aria-label={t('Actions for %name%', { replacements: { name: sandboxNameOf(workspace) } })}\n >\n <MoreHorizontal />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"w-48\">\n <DropdownMenuItem onSelect={() => onAction('start')}>\n <Play />\n {hasSession ? t('Warm up session') : t('Start session', { context: 'sandbox-action' })}\n </DropdownMenuItem>\n <DropdownMenuItem disabled={!hasSession} onSelect={() => onAction('offload')}>\n <Archive />\n {t('Offload', { context: 'sandbox-action' })}\n </DropdownMenuItem>\n <DropdownMenuSeparator />\n <DropdownMenuItem variant=\"destructive\" disabled={!hasSession} onSelect={() => onAction('end')}>\n <Power />\n {t('End session', { context: 'sandbox-action' })}\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n\nexport interface SandboxesScreenProps {\n /** `createSandboxesApi(…)` of the host. */\n api: SandboxesApi;\n /** Default \"Sandboxes\". */\n title?: ReactNode;\n description?: ReactNode;\n headerActions?: ReactNode;\n /** Opens a workspace's details (the host's route, e.g. `router.push(…)`). */\n onOpenWorkspace?: (workspaceKey: string) => void;\n}\n\nconst SEARCH_KEYS: readonly (keyof SandboxWorkspace)[] = ['displayName', 'workspaceKey', 'ownerDisplayName', 'runnerPod'];\n\n/**\n * Every agent workspace of the host (one per agent space): state, last activity, disk and memory against their limits,\n * mount mode, runner pod, owner and conversations; start, offload and end per row (audited, refused while a turn runs\n * unless forced with a reason). Needs the Composer package mgamadeus/ddd-agent-sandbox (`SandboxesControllerTrait`).\n */\nexport const SandboxesScreen = ({ api, title, description, headerActions, onOpenWorkspace }: SandboxesScreenProps) => {\n const { t } = useTranslate();\n const listQuery = api.useSandboxesListQuery();\n const actions = useSandboxActions(api);\n const [search, setSearch] = useState('');\n const workspaces = useMemo(() => listQuery.data?.workspaces?.elements ?? [], [listQuery.data]);\n const needle = search.trim().toLocaleLowerCase();\n const shown = useMemo(\n () => (needle === '' ? workspaces : workspaces.filter(workspace => SEARCH_KEYS.some(key => String(workspace[key] ?? '').toLocaleLowerCase().includes(needle)))),\n [workspaces, needle]\n );\n const runningCount = workspaces.filter(workspace => workspace.state === 'RUNNING').length;\n\n const columns: EntityListColumn<SandboxWorkspace>[] = [\n {\n id: 'name',\n header: t('Workspace', { context: 'sandbox' }),\n width: '2fr',\n cell: workspace => (\n <span className=\"min-w-0\">\n <span className=\"block truncate font-semibold\">{sandboxNameOf(workspace)}</span>\n <span className=\"block truncate font-mono text-xs text-muted-foreground\">{workspace.workspaceKey}</span>\n </span>\n ),\n },\n {\n id: 'state',\n header: t('State', { context: 'sandbox' }),\n width: 'content',\n cell: workspace => (\n <span className=\"flex flex-col items-start gap-1\">\n <StatusBadge value={workspace.state as SandboxState} map={SANDBOX_STATE} />\n {workspace.hasLiveTurn && (\n <span className=\"flex items-center gap-1 text-xs text-warning\">\n <Activity className=\"size-3\" />\n {t('Turn running')}\n </span>\n )}\n </span>\n ),\n },\n { id: 'activity', header: t('Last activity'), width: 'content', cell: workspace => <DateCell value={workspace.lastActivityAt} /> },\n { id: 'disk', header: t('Disk', { context: 'sandbox' }), cell: workspace => <SandboxUsageBar used={workspace.diskUsedBytes} limit={workspace.diskQuotaBytes} /> },\n {\n id: 'memory',\n header: t('Memory', { context: 'sandbox' }),\n cell: workspace => <SandboxUsageBar used={workspace.memoryBytes} limit={workspace.memoryLimitBytes} peak={workspace.memoryPeakBytes} />,\n },\n { id: 'mount', header: t('Mount', { context: 'sandbox' }), cell: workspace => <SandboxMountMode workspace={workspace} /> },\n {\n id: 'pod',\n header: t('Runner', { context: 'sandbox' }),\n cell: workspace => (workspace.runnerPod ? <span className=\"font-mono text-xs\">{workspace.runnerPod}</span> : <EmptyValue />),\n },\n { id: 'owner', header: t('Owner', { context: 'sandbox' }), cell: workspace => workspace.ownerDisplayName ?? <EmptyValue /> },\n {\n id: 'conversations',\n header: t('Conversations'),\n width: 'content',\n align: 'end',\n cell: workspace => <span className=\"tabular-nums\">{workspace.conversationCount ?? '—'}</span>,\n },\n {\n id: 'actions',\n header: <span className=\"sr-only\">{t('Actions', { context: 'table-column' })}</span>,\n width: 'content',\n pin: 'end',\n cell: workspace => (\n <SandboxActionsMenu workspace={workspace} disabled={actions.isPending} onAction={kind => void actions.run({ kind, workspace })} />\n ),\n },\n ];\n\n return (\n <div className=\"space-y-6\">\n <PageHeader\n title={title ?? t('Sandboxes')}\n description={\n description ??\n t('The agents’ workspaces: one per agent space. Files and command output are shown as untrusted text, never run.')\n }\n actions={\n <div className=\"flex flex-wrap items-center gap-2\">\n {headerActions}\n <Button type=\"button\" variant=\"outline\" onClick={() => void listQuery.refetch?.()} disabled={listQuery.isFetching}>\n <RefreshCw className={cn(listQuery.isFetching && 'animate-spin')} />\n {t('Refresh')}\n </Button>\n </div>\n }\n />\n {listQuery.data && !listQuery.data.isConfigured ? (\n <StatusCallout\n tone=\"info\"\n title={t('Sandboxes are not set up')}\n description={t('No sandbox runner is configured in this application (AI.Sandbox.runner.host), so there is nothing to show.')}\n />\n ) : (\n <EntityListCard\n label={m('Sandboxes')}\n isRefetching={listQuery.isFetching && !listQuery.isLoading}\n toolbar={\n <EntityListToolbar\n search={{ value: search, onChange: setSearch, placeholder: t('Search name, key, owner or runner…'), 'aria-label': t('Search sandboxes') }}\n trailing={\n workspaces.length > 0 ? (\n <span className=\"text-[12.5px] font-bold text-muted-foreground\">\n {t('{count, plural, one {# running} other {# running}}', { count: runningCount })} ·{' '}\n {t('{count, plural, one {# workspace} other {# workspaces}}', { count: workspaces.length })}\n </span>\n ) : undefined\n }\n />\n }\n >\n <EntityListBody\n displayMode=\"table\"\n columns={columns}\n items={shown}\n getRowKey={workspace => workspace.workspaceKey}\n rowAction={onOpenWorkspace ? workspace => () => onOpenWorkspace(workspace.workspaceKey) : undefined}\n isLoading={listQuery.isLoading}\n emptyMessage={t('No workspace yet: a workspace appears with the first command of an agent space.')}\n noResultsMessage={t('No workspace matches the search.')}\n isSearchActive={needle !== ''}\n onClearSearch={() => setSearch('')}\n loadingMessage={t('Loading the sandboxes')}\n error={listQuery.isError ? normalizeDddError(listQuery.error, t('The sandboxes could not be loaded.')).message : undefined}\n />\n </EntityListCard>\n )}\n {actions.dialog}\n </div>\n );\n};\n","'use client';\n\nimport { normalizeDddError } from '@mgamadeus/ddd-web/contract';\nimport { type ReactNode, useCallback, useState } from 'react';\n\nimport { FormDialog } from '@mgamadeus/ddd-admin-ui/form';\nimport { useTranslate } from '@mgamadeus/ddd-admin-ui/i18n';\nimport { notify } from '@mgamadeus/ddd-admin-ui/logic';\nimport { useConfirm } from '@mgamadeus/ddd-admin-ui/logic';\nimport { Label } from '@mgamadeus/ddd-admin-ui/primitives';\nimport { Textarea } from '@mgamadeus/ddd-admin-ui/primitives';\nimport type { SandboxesApi } from '../api.ts';\nimport { isSandboxTurnRunningRefusal, sandboxNameOf, sandboxResetPhraseOf } from './format.ts';\nimport type { SandboxActionBody, SandboxActionResponse, SandboxWorkspace } from '../types.ts';\n\n/** One action of the sandbox screens. */\nexport type SandboxActionRequest =\n | { kind: 'start' | 'offload' | 'end' | 'reset'; workspace: SandboxWorkspace }\n | { kind: 'kill'; workspace: SandboxWorkspace; jobId: string };\n\nexport interface SandboxActions {\n /** Asks (confirmation, typed name for a reset, a reason while a turn runs), runs it and reports the outcome. */\n run: (request: SandboxActionRequest) => Promise<boolean>;\n /** An action is running. */\n isPending: boolean;\n /** The \"force with a reason\" dialog; render it once in the screen. */\n dialog: ReactNode;\n}\n\nconst MIN_REASON_LENGTH = 3;\n\n/**\n * The actions of the sandbox screens: start, offload, end, reset (typed name) and kill a job. A running turn on the\n * space (`hasLiveTurn`, or the server's 409) asks for a reason and sends the action with `force`; the server audits it.\n */\nexport const useSandboxActions = (api: SandboxesApi): SandboxActions => {\n const { t } = useTranslate();\n const confirm = useConfirm();\n const [runAction, actionState] = api.useSandboxActionMutation();\n const [killJob, killState] = api.useKillSandboxJobMutation();\n const [forceRequest, setForceRequest] = useState<{ request: SandboxActionRequest; extra: SandboxActionBody } | null>(null);\n const [reason, setReason] = useState('');\n const [forcing, setForcing] = useState(false);\n\n const labelOf = useCallback(\n (request: SandboxActionRequest): string => {\n switch (request.kind) {\n case 'start':\n return t('Start session', { context: 'sandbox-action' });\n case 'offload':\n return t('Offload', { context: 'sandbox-action' });\n case 'end':\n return t('End session', { context: 'sandbox-action' });\n case 'reset':\n return t('Reset workspace', { context: 'sandbox-action' });\n case 'kill':\n return t('Kill job', { context: 'sandbox-action' });\n }\n },\n [t]\n );\n\n const send = useCallback(\n async (request: SandboxActionRequest, body: SandboxActionBody): Promise<SandboxActionResponse> =>\n request.kind === 'kill'\n ? killJob({ workspaceKey: request.workspace.workspaceKey, jobId: request.jobId, ...body }).unwrap()\n : runAction({ workspaceKey: request.workspace.workspaceKey, action: request.kind, ...body }).unwrap(),\n [killJob, runAction]\n );\n\n const report = useCallback(\n (request: SandboxActionRequest, response: SandboxActionResponse) => {\n const { actionResult } = response;\n const name = sandboxNameOf(request.workspace);\n if (actionResult.outcome !== 'SUCCEEDED') {\n notify.error(t('%action% did not run for %name%.', { replacements: { action: labelOf(request), name } }));\n return false;\n }\n const offload = actionResult.offloadResult;\n notify.success(\n offload\n ? t('%name% offloaded: %count% changes saved to the drive.', { replacements: { name, count: offload.committedChangeCount } })\n : t('%action%: done for %name%.', { replacements: { action: labelOf(request), name } })\n );\n return true;\n },\n [t, labelOf]\n );\n\n const attempt = useCallback(\n async (request: SandboxActionRequest, body: SandboxActionBody): Promise<boolean> => {\n try {\n return report(request, await send(request, body));\n } catch (error) {\n if (!body.force && isSandboxTurnRunningRefusal(error)) {\n setReason('');\n setForceRequest({ request, extra: body });\n return false;\n }\n notify.error(normalizeDddError(error, t('%action% failed.', { replacements: { action: labelOf(request) } })).message);\n return false;\n }\n },\n [send, report, t, labelOf]\n );\n\n const run = useCallback(\n async (request: SandboxActionRequest): Promise<boolean> => {\n const name = sandboxNameOf(request.workspace);\n const extra: SandboxActionBody = {};\n if (request.kind === 'reset') {\n const phrase = sandboxResetPhraseOf(request.workspace);\n const confirmed = await confirm({\n title: t('Reset the workspace of %name%?', { replacements: { name } }),\n description: t(\n 'Everything on the runner is wiped: local files, installed packages, unsaved changes. Files in the drive stay. The agent starts from an empty workspace next time.'\n ),\n confirmLabel: t('Reset workspace', { context: 'sandbox-action' }),\n confirmVariant: 'destructive',\n requirePhrase: phrase,\n });\n if (!confirmed) return false;\n extra.confirmation = phrase;\n } else if (request.kind === 'offload' || request.kind === 'end' || request.kind === 'kill') {\n const jobId = request.kind === 'kill' ? request.jobId : '';\n const confirmed = await confirm({\n title:\n request.kind === 'offload'\n ? t('Offload %name%?', { replacements: { name } })\n : request.kind === 'end'\n ? t('End the session of %name%?', { replacements: { name } })\n : t('Kill the job %job%?', { replacements: { job: jobId } }),\n description:\n request.kind === 'offload'\n ? t('Unsaved changes are written to the drive, then the session is released. The workspace stays and starts again on the next command.')\n : request.kind === 'end'\n ? t('The session stops now, with every running command. The saved workspace stays; changes not yet in the drive can be lost — offload first to keep them.')\n : t('The job stops at once; its output so far stays in the command history.'),\n confirmLabel: labelOf(request),\n confirmVariant: request.kind === 'offload' ? 'default' : 'destructive',\n });\n if (!confirmed) return false;\n }\n if (request.workspace.hasLiveTurn) {\n setReason('');\n setForceRequest({ request, extra });\n return false;\n }\n return attempt(request, extra);\n },\n [confirm, t, labelOf, attempt]\n );\n\n const dialog = (\n <FormDialog\n open={forceRequest !== null}\n onOpenChange={open => !open && setForceRequest(null)}\n title={forceRequest ? t('%action% while a turn is running?', { replacements: { action: labelOf(forceRequest.request) } }) : ''}\n description={t(\n 'An agent conversation of this space is working right now; the action can break its turn. Say why it must run now — the reason is kept in the audit.'\n )}\n submitLabel={t('Run anyway')}\n pendingLabel={t('Running…')}\n submitVariant=\"destructive\"\n isPending={forcing}\n submitDisabled={reason.trim().length < MIN_REASON_LENGTH}\n onSubmit={async event => {\n event.preventDefault();\n if (!forceRequest) return;\n setForcing(true);\n try {\n const ok = await attempt(forceRequest.request, { ...forceRequest.extra, force: true, reason: reason.trim() });\n if (ok) setForceRequest(null);\n } finally {\n setForcing(false);\n }\n }}\n >\n <div className=\"space-y-2\">\n <Label htmlFor=\"sandbox-force-reason\">{t('Reason', { context: 'sandbox-force' })}</Label>\n <Textarea id=\"sandbox-force-reason\" value={reason} onChange={event => setReason(event.target.value)} rows={3} maxLength={500} />\n </div>\n </FormDialog>\n );\n\n return { run, isPending: actionState.isLoading || killState.isLoading || forcing, dialog };\n};\n","'use client';\n\nimport { normalizeDddError } from '@mgamadeus/ddd-web/contract';\nimport { Archive, ChevronRight, File, Folder, Link2, OctagonX, Play, Power, RefreshCw, RotateCcw } from 'lucide-react';\nimport { type ReactNode, useState } from 'react';\n\nimport type { PdfJsLoader } from '@mgamadeus/ddd-admin-ui/files';\nimport { m } from '@mgamadeus/ddd-admin-ui/i18n';\nimport { useTranslate } from '@mgamadeus/ddd-admin-ui/i18n';\nimport { DateCell } from '@mgamadeus/ddd-admin-ui/list';\nimport { EmptyValue } from '@mgamadeus/ddd-admin-ui/list';\nimport { EntityListBody } from '@mgamadeus/ddd-admin-ui/list';\nimport { EntityListCard } from '@mgamadeus/ddd-admin-ui/list';\nimport type { EntityListColumn } from '@mgamadeus/ddd-admin-ui/list';\nimport { StatusBadge } from '@mgamadeus/ddd-admin-ui/list';\nimport { DefinitionList } from '@mgamadeus/ddd-admin-ui/page';\nimport { PageHeader } from '@mgamadeus/ddd-admin-ui/page';\nimport { SectionHeader } from '@mgamadeus/ddd-admin-ui/page';\nimport { StatusCallout } from '@mgamadeus/ddd-admin-ui/page';\nimport { Badge } from '@mgamadeus/ddd-admin-ui/primitives';\nimport { Button } from '@mgamadeus/ddd-admin-ui/primitives';\nimport { Card, CardContent } from '@mgamadeus/ddd-admin-ui/primitives';\nimport { cn } from '@mgamadeus/ddd-admin-ui/primitives';\nimport { useLinkComponent } from '@mgamadeus/ddd-admin-ui/primitives';\nimport { Skeleton } from '@mgamadeus/ddd-admin-ui/primitives';\nimport type { SandboxesApi } from '../api.ts';\nimport {\n formatSandboxBytes,\n formatSandboxDuration,\n SANDBOX_ACTION_LABELS,\n SANDBOX_ACTION_OUTCOME,\n SANDBOX_CHANGE_LABELS,\n SANDBOX_COMMAND_STATE,\n SANDBOX_STATE,\n sandboxCommandStateOf,\n sandboxNameOf,\n sandboxParentPathOf,\n sandboxPathCrumbs,\n sessionEventIconOf,\n} from './format.ts';\nimport { SandboxFilePreview } from './SandboxFilePreview.tsx';\nimport { SandboxMountMode, SandboxUsageBar } from './SandboxesScreen.tsx';\nimport type {\n SandboxActionLogEntry,\n SandboxActionOutcome,\n SandboxState,\n SandboxCommand,\n SandboxConversation,\n SandboxDriveChange,\n SandboxFileEntry,\n SandboxProcess,\n SandboxWorkspace,\n} from '../types.ts';\nimport { useSandboxActions } from './useSandboxActions.tsx';\n\n/** The tabs of a workspace. */\nexport const SANDBOX_DETAIL_TABS = [\n { id: 'files', label: m('Files', { context: 'sandbox-tab' }), context: 'sandbox-tab' },\n { id: 'changes', label: m('Unsaved changes', { context: 'sandbox-tab' }), context: 'sandbox-tab' },\n { id: 'processes', label: m('Processes & jobs', { context: 'sandbox-tab' }), context: 'sandbox-tab' },\n { id: 'commands', label: m('Commands', { context: 'sandbox-tab' }), context: 'sandbox-tab' },\n { id: 'conversations', label: m('Conversations', { context: 'sandbox-tab' }), context: 'sandbox-tab' },\n { id: 'events', label: m('Session log', { context: 'sandbox-tab' }), context: 'sandbox-tab' },\n { id: 'audit', label: m('Audit', { context: 'sandbox-tab' }), context: 'sandbox-tab' },\n] as const;\n\nexport type SandboxDetailTab = (typeof SANDBOX_DETAIL_TABS)[number]['id'];\n\nconst COMMAND_LIMIT = 50;\nconst LOG_LIMIT = 100;\n\nconst errorText = (error: unknown, fallback: string) => normalizeDddError(error, fallback).message;\n\n/** Text that came from the sandbox (a command, its output): escaped, preformatted, never interpreted. */\nconst UntrustedText = ({ text, className }: { text: string | null | undefined; className?: string }) =>\n text ? <pre className={cn('max-h-64 overflow-auto rounded-lg bg-muted p-3 font-mono text-xs whitespace-pre-wrap break-all', className)}>{text}</pre> : null;\n\nconst FilesTab = ({ api, workspaceKey, loadPdfJs }: { api: SandboxesApi; workspaceKey: string; loadPdfJs?: PdfJsLoader }) => {\n const { t } = useTranslate();\n const [directory, setDirectory] = useState('');\n const [openFile, setOpenFile] = useState<SandboxFileEntry | null>(null);\n const filesQuery = api.useSandboxFilesQuery({ workspaceKey, path: directory });\n const entries = [...(filesQuery.data?.entries?.elements ?? [])].sort((a, b) =>\n a.type === b.type ? a.name.localeCompare(b.name) : a.type === 'DIRECTORY' ? -1 : b.type === 'DIRECTORY' ? 1 : 0\n );\n const columns: EntityListColumn<SandboxFileEntry>[] = [\n {\n id: 'name',\n header: t('Name', { context: 'sandbox-file' }),\n width: '3fr',\n cell: entry => (\n <span className=\"flex min-w-0 items-center gap-2\">\n {entry.type === 'DIRECTORY' ? <Folder className=\"size-4 shrink-0 text-muted-foreground\" /> : <File className=\"size-4 shrink-0 text-muted-foreground\" />}\n <span className=\"truncate font-mono text-[13px]\">{entry.name}</span>\n {entry.type === 'SYMLINK' && <Badge variant=\"outline\">{t('Link', { context: 'sandbox-file' })}</Badge>}\n </span>\n ),\n },\n { id: 'size', header: t('Size', { context: 'sandbox-file' }), width: 'content', align: 'end', cell: entry => (entry.type === 'DIRECTORY' ? <EmptyValue /> : formatSandboxBytes(entry.sizeBytes)) },\n { id: 'modified', header: t('Modified', { context: 'sandbox-file' }), width: 'content', cell: entry => <DateCell value={entry.modifiedAt} /> },\n ];\n return (\n <div className=\"grid gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]\">\n <EntityListCard\n label={m('Files', { context: 'sandbox-tab' })}\n labelContext=\"sandbox-tab\"\n toolbar={\n <nav aria-label={t('Folder path')} className=\"flex min-w-0 flex-wrap items-center gap-1 px-1 text-[13px]\">\n <button type=\"button\" className=\"rounded px-1 font-semibold hover:bg-muted\" onClick={() => setDirectory('')}>\n {t('Workspace', { context: 'sandbox' })}\n </button>\n {sandboxPathCrumbs(directory).map(crumb => (\n <span key={crumb.path} className=\"flex items-center gap-1\">\n <ChevronRight className=\"size-3.5 text-muted-foreground\" />\n <button type=\"button\" className=\"rounded px-1 font-mono hover:bg-muted\" onClick={() => setDirectory(crumb.path)}>\n {crumb.name}\n </button>\n </span>\n ))}\n </nav>\n }\n >\n <EntityListBody\n displayMode=\"table\"\n columns={columns}\n items={directory === '' ? entries : [{ name: '..', path: sandboxParentPathOf(directory), type: 'DIRECTORY' }, ...entries]}\n getRowKey={entry => `${entry.type}:${entry.path}:${entry.name}`}\n rowAction={entry => () => {\n if (entry.type === 'DIRECTORY') {\n setDirectory(entry.path);\n setOpenFile(null);\n } else {\n setOpenFile(entry);\n }\n }}\n isLoading={filesQuery.isLoading}\n emptyMessage={t('This folder is empty.')}\n loadingMessage={t('Loading files')}\n error={filesQuery.isError ? errorText(filesQuery.error, t('The files could not be loaded.')) : undefined}\n />\n </EntityListCard>\n <Card>\n <CardContent className=\"pt-6\">\n {openFile ? (\n <SandboxFilePreview api={api} workspaceKey={workspaceKey} file={openFile} loadPdfJs={loadPdfJs} />\n ) : (\n <p className=\"py-10 text-center text-[13px] text-muted-foreground\">{t('Pick a file to see it. Files are shown read only.')}</p>\n )}\n </CardContent>\n </Card>\n </div>\n );\n};\n\nconst ChangesTab = ({ api, workspaceKey }: { api: SandboxesApi; workspaceKey: string }) => {\n const { t } = useTranslate();\n const statusQuery = api.useSandboxDriveStatusQuery({ workspaceKey });\n const status = statusQuery.data?.driveStatus;\n const columns: EntityListColumn<SandboxDriveChange>[] = [\n {\n id: 'type',\n header: t('Change', { context: 'sandbox-change' }),\n width: 'content',\n cell: change => <Badge variant=\"outline\">{SANDBOX_CHANGE_LABELS[change.changeType] ? t(SANDBOX_CHANGE_LABELS[change.changeType] ?? '', { context: 'sandbox-change' }) : change.changeType}</Badge>,\n },\n {\n id: 'path',\n header: t('Path', { context: 'sandbox-change' }),\n width: '3fr',\n cell: change => (\n <span className=\"min-w-0 font-mono text-[13px]\">\n {change.previousPath && <span className=\"block truncate text-muted-foreground\">{change.previousPath} →</span>}\n <span className=\"block truncate\">{change.path}</span>\n </span>\n ),\n },\n { id: 'size', header: t('Size', { context: 'sandbox-file' }), width: 'content', align: 'end', cell: change => formatSandboxBytes(change.sizeBytes) },\n ];\n if (status && !status.isDriveWorkspace) {\n return <StatusCallout tone=\"info\" title={t('No drive in this workspace')} description={t('Its files are not synced with a drive, so nothing is pending.')} />;\n }\n return (\n <EntityListCard\n label={m('Unsaved changes', { context: 'sandbox-tab' })}\n labelContext=\"sandbox-tab\"\n toolbar={\n status ? (\n <p className=\"px-1 text-[12.5px] text-muted-foreground\">\n {t('{count, plural, one {# change not yet in the drive} other {# changes not yet in the drive}}', { count: status.pendingChangeCount })}\n {status.lastCommittedAt && (\n <>\n {' · '}\n {t('Last saved')} <DateCell value={status.lastCommittedAt} />\n </>\n )}\n </p>\n ) : undefined\n }\n >\n <EntityListBody\n displayMode=\"table\"\n columns={columns}\n items={status?.changes?.elements ?? []}\n getRowKey={change => `${change.changeType}:${change.previousPath ?? ''}:${change.path}`}\n isLoading={statusQuery.isLoading}\n emptyMessage={t('Everything is saved in the drive.')}\n loadingMessage={t('Loading the changes')}\n error={statusQuery.isError ? errorText(statusQuery.error, t('The changes could not be loaded.')) : undefined}\n />\n </EntityListCard>\n );\n};\n\nconst ProcessesTab = ({\n api,\n workspace,\n onKill,\n killDisabled,\n}: {\n api: SandboxesApi;\n workspace: SandboxWorkspace;\n onKill: (jobId: string) => void;\n killDisabled: boolean;\n}) => {\n const { t } = useTranslate();\n const processesQuery = api.useSandboxProcessesQuery({ workspaceKey: workspace.workspaceKey });\n const columns: EntityListColumn<SandboxProcess>[] = [\n { id: 'pid', header: 'PID', width: 'content', cell: process => <span className=\"font-mono text-xs\">{process.pid}</span> },\n { id: 'command', header: t('Command', { context: 'sandbox' }), width: '3fr', cell: process => <span className=\"block truncate font-mono text-xs\" title={process.command}>{process.command}</span> },\n { id: 'job', header: t('Job', { context: 'sandbox' }), width: 'content', cell: process => (process.jobId ? <span className=\"font-mono text-xs\">{process.jobId}</span> : <EmptyValue />) },\n { id: 'started', header: t('Started', { context: 'sandbox' }), width: 'content', cell: process => <DateCell value={process.startedAt} /> },\n { id: 'cpu', header: 'CPU', width: 'content', align: 'end', cell: process => formatSandboxDuration(process.cpuSeconds === null || process.cpuSeconds === undefined ? null : process.cpuSeconds * 1000) },\n { id: 'memory', header: t('Memory', { context: 'sandbox' }), width: 'content', align: 'end', cell: process => formatSandboxBytes(process.rssBytes) },\n {\n id: 'actions',\n header: <span className=\"sr-only\">{t('Actions', { context: 'table-column' })}</span>,\n width: 'content',\n pin: 'end',\n cell: process =>\n process.jobId ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"text-destructive hover:text-destructive\"\n disabled={killDisabled}\n onClick={() => process.jobId && onKill(process.jobId)}\n >\n <OctagonX />\n {t('Kill job', { context: 'sandbox-action' })}\n </Button>\n ) : null,\n },\n ];\n return (\n <EntityListCard label={m('Processes & jobs', { context: 'sandbox-tab' })} labelContext=\"sandbox-tab\">\n <EntityListBody\n displayMode=\"table\"\n columns={columns}\n items={processesQuery.data?.processes?.elements ?? []}\n getRowKey={process => String(process.pid)}\n isLoading={processesQuery.isLoading}\n emptyMessage={workspace.state === 'OFFLOADED' ? t('No session: nothing runs.') : t('Nothing is running.')}\n loadingMessage={t('Loading the processes')}\n error={processesQuery.isError ? errorText(processesQuery.error, t('The processes could not be loaded.')) : undefined}\n />\n </EntityListCard>\n );\n};\n\nconst CommandsTab = ({ api, workspaceKey }: { api: SandboxesApi; workspaceKey: string }) => {\n const { t } = useTranslate();\n const commandsQuery = api.useSandboxCommandsQuery({ workspaceKey, limit: COMMAND_LIMIT });\n const commands = commandsQuery.data?.commands?.elements ?? [];\n if (commandsQuery.isLoading) return <Skeleton className=\"h-48 w-full rounded-xl\" />;\n if (commandsQuery.isError) return <StatusCallout tone=\"destructive\" title={t('The commands could not be loaded.')} description={errorText(commandsQuery.error, '')} />;\n if (commands.length === 0) return <p className=\"py-10 text-center text-[13px] text-muted-foreground\">{t('No command ran in this session yet.')}</p>;\n return (\n <ol className=\"space-y-3\">\n {commands.map((command: SandboxCommand) => (\n <li key={command.seq} className=\"surface space-y-2 rounded-2xl p-4\">\n <div className=\"flex flex-wrap items-center gap-2 text-[12.5px]\">\n <StatusBadge value={sandboxCommandStateOf(command)} map={SANDBOX_COMMAND_STATE} />\n {sandboxCommandStateOf(command) === 'EXITED' && command.exitCode !== null && command.exitCode !== undefined && (\n <Badge variant={command.exitCode === 0 ? 'outline' : 'destructive'} className=\"font-mono\">\n {t('exit %code%', { context: 'sandbox-command', replacements: { code: String(command.exitCode) } })}\n </Badge>\n )}\n <span className=\"text-muted-foreground\">#{command.seq}</span>\n <DateCell value={command.startedAt} />\n <span className=\"text-muted-foreground\">{formatSandboxDuration(command.durationMs)}</span>\n {command.jobId && <span className=\"font-mono text-xs text-muted-foreground\">{t('job %id%', { replacements: { id: command.jobId } })}</span>}\n {command.isTruncated && <Badge variant=\"outline\">{t('Output cut', { context: 'sandbox-command' })}</Badge>}\n </div>\n <UntrustedText text={command.command} className=\"bg-card\" />\n {command.stdoutTail && (\n <details>\n <summary className=\"cursor-pointer text-xs font-semibold text-muted-foreground\">{t('Output', { context: 'sandbox-command' })}</summary>\n <UntrustedText text={command.stdoutTail} className=\"mt-1\" />\n </details>\n )}\n {command.stderrTail && (\n <details open={command.exitCode !== null && command.exitCode !== undefined && command.exitCode !== 0}>\n <summary className=\"cursor-pointer text-xs font-semibold text-destructive\">{t('Errors', { context: 'sandbox-command' })}</summary>\n <UntrustedText text={command.stderrTail} className=\"mt-1\" />\n </details>\n )}\n </li>\n ))}\n </ol>\n );\n};\n\nconst ConversationsTab = ({\n api,\n workspaceKey,\n buildConversationHref,\n}: {\n api: SandboxesApi;\n workspaceKey: string;\n buildConversationHref?: (conversation: SandboxConversation) => string | null;\n}) => {\n const { t } = useTranslate();\n const Link = useLinkComponent();\n const conversationsQuery = api.useSandboxConversationsQuery({ workspaceKey, limit: LOG_LIMIT });\n const columns: EntityListColumn<SandboxConversation>[] = [\n {\n id: 'id',\n header: t('Conversation'),\n width: 'content',\n cell: conversation => {\n const href = buildConversationHref?.(conversation) ?? null;\n return href ? (\n <Link href={href} className=\"flex items-center gap-1 font-mono text-[13px] text-primary-emphasis underline-offset-2 hover:underline\">\n <Link2 className=\"size-3.5\" />#{conversation.conversationId}\n </Link>\n ) : (\n <span className=\"font-mono text-[13px]\">#{conversation.conversationId}</span>\n );\n },\n },\n { id: 'purpose', header: t('Purpose', { context: 'sandbox-conversation' }), width: '2fr', cell: conversation => conversation.purposeName ?? <EmptyValue /> },\n { id: 'state', header: t('State', { context: 'sandbox' }), width: 'content', cell: conversation => (conversation.runState ? <Badge variant=\"outline\">{conversation.runState}</Badge> : <EmptyValue />) },\n { id: 'updated', header: t('Last change'), width: 'content', cell: conversation => <DateCell value={conversation.updatedAt} /> },\n ];\n return (\n <EntityListCard label={m('Conversations', { context: 'sandbox-tab' })} labelContext=\"sandbox-tab\">\n <EntityListBody\n displayMode=\"table\"\n columns={columns}\n items={conversationsQuery.data?.conversations?.elements ?? []}\n getRowKey={conversation => String(conversation.conversationId)}\n isLoading={conversationsQuery.isLoading}\n emptyMessage={t('No conversation used this workspace yet.')}\n loadingMessage={t('Loading the conversations')}\n error={conversationsQuery.isError ? errorText(conversationsQuery.error, t('The conversations could not be loaded.')) : undefined}\n />\n </EntityListCard>\n );\n};\n\nconst EventsTab = ({ api, workspaceKey }: { api: SandboxesApi; workspaceKey: string }) => {\n const { t } = useTranslate();\n const eventsQuery = api.useSandboxSessionEventsQuery({ workspaceKey, limit: LOG_LIMIT });\n const events = eventsQuery.data?.sessionEvents?.elements ?? [];\n if (eventsQuery.isLoading) return <Skeleton className=\"h-40 w-full rounded-xl\" />;\n if (eventsQuery.isError) return <StatusCallout tone=\"destructive\" title={t('The session log could not be loaded.')} description={errorText(eventsQuery.error, '')} />;\n if (events.length === 0) return <p className=\"py-10 text-center text-[13px] text-muted-foreground\">{t('The session log is empty.')}</p>;\n return (\n <ol className=\"surface space-y-3 rounded-2xl p-4\">\n {events.map((event, index) => {\n const Icon = sessionEventIconOf(event.type);\n return (\n <li key={`${event.occurredAt ?? ''}-${index}`} className=\"flex gap-3 text-[13px]\">\n <Icon className=\"mt-0.5 size-4 shrink-0 text-muted-foreground\" />\n <div className=\"min-w-0\">\n <p>\n <span className=\"font-mono font-semibold\">{event.type}</span> · <DateCell value={event.occurredAt} />\n </p>\n {event.detail && <p className=\"break-words text-muted-foreground\">{event.detail}</p>}\n </div>\n </li>\n );\n })}\n </ol>\n );\n};\n\nconst AuditTab = ({ api, workspaceKey }: { api: SandboxesApi; workspaceKey: string }) => {\n const { t } = useTranslate();\n const auditQuery = api.useSandboxActionLogQuery({ workspaceKey, limit: LOG_LIMIT });\n const columns: EntityListColumn<SandboxActionLogEntry>[] = [\n { id: 'time', header: t('When', { context: 'sandbox-audit' }), width: 'content', cell: entry => <DateCell value={entry.changeHistory?.createdTime ?? null} /> },\n {\n id: 'action',\n header: t('Action', { context: 'sandbox-audit' }),\n width: 'content',\n cell: entry => (\n <span>\n {entry.action === 'KILL_JOB' && entry.jobId\n ? t('Kill job %id%', { context: 'sandbox-action', replacements: { id: entry.jobId } })\n : entry.action && SANDBOX_ACTION_LABELS[entry.action]\n ? t(SANDBOX_ACTION_LABELS[entry.action] ?? '', { context: 'sandbox-action' })\n : (entry.action ?? '—')}\n </span>\n ),\n },\n { id: 'outcome', header: t('Outcome', { context: 'sandbox-audit' }), width: 'content', cell: entry => <StatusBadge value={(entry.outcome ?? null) as SandboxActionOutcome | null} map={SANDBOX_ACTION_OUTCOME} /> },\n { id: 'actor', header: t('By', { context: 'sandbox-audit' }), width: 'content', cell: entry => (entry.actorAccountId ? `#${entry.actorAccountId}` : <EmptyValue />) },\n {\n id: 'reason',\n header: t('Reason', { context: 'sandbox-force' }),\n width: '2fr',\n cell: entry => (\n <span className=\"min-w-0 text-[13px]\">\n {entry.forced && <Badge variant=\"destructive\" className=\"mr-1\">{t('Forced', { context: 'sandbox-audit' })}</Badge>}\n {entry.reason ?? (entry.forced ? '' : <EmptyValue />)}\n {entry.outcomeDetail && <span className=\"block truncate text-xs text-muted-foreground\" title={entry.outcomeDetail}>{entry.outcomeDetail}</span>}\n </span>\n ),\n },\n ];\n return (\n <EntityListCard label={m('Audit', { context: 'sandbox-tab' })} labelContext=\"sandbox-tab\">\n <EntityListBody\n displayMode=\"table\"\n columns={columns}\n items={auditQuery.data?.actionLogEntries?.elements ?? []}\n getRowKey={entry => String(entry.id ?? `${entry.action}-${entry.changeHistory?.createdTime}`)}\n isLoading={auditQuery.isLoading}\n emptyMessage={t('No action on this workspace yet.')}\n loadingMessage={t('Loading the audit')}\n error={auditQuery.isError ? errorText(auditQuery.error, t('The audit could not be loaded.')) : undefined}\n />\n </EntityListCard>\n );\n};\n\nexport interface SandboxDetailScreenProps {\n api: SandboxesApi;\n workspaceKey: string;\n /** The open tab (controlled, e.g. from the URL); without it the screen keeps it. */\n tab?: SandboxDetailTab;\n onTabChange?: (tab: SandboxDetailTab) => void;\n /** A link back (the list), drawn left of the title. */\n backLink?: ReactNode;\n headerActions?: ReactNode;\n /** The link of a conversation in the host's agent screens; `null` = no link. */\n buildConversationHref?: (conversation: SandboxConversation) => string | null;\n /** pdf.js of the host for the PDF preview. */\n loadPdfJs?: PdfJsLoader;\n}\n\n/**\n * One workspace: its facts (state, disk and memory against their limits, mount mode, runner pod, owner) and the tabs\n * Files (read only, the safe preview), Unsaved changes, Processes & jobs (kill), Commands (exit code, duration, output\n * tails), Conversations, Session log and Audit. Start, offload, end and reset (typed name) are audited and refused\n * while a turn runs on the space unless forced with a reason. Everything from the sandbox is shown as text.\n */\nexport const SandboxDetailScreen = ({\n api,\n workspaceKey,\n tab: controlledTab,\n onTabChange,\n backLink,\n headerActions,\n buildConversationHref,\n loadPdfJs,\n}: SandboxDetailScreenProps) => {\n const { t } = useTranslate();\n const workspaceQuery = api.useSandboxQuery({ workspaceKey });\n const actions = useSandboxActions(api);\n const [ownTab, setOwnTab] = useState<SandboxDetailTab>('files');\n const tab = controlledTab ?? ownTab;\n const selectTab = (next: SandboxDetailTab) => {\n if (onTabChange) onTabChange(next);\n else setOwnTab(next);\n };\n const workspace = workspaceQuery.data?.workspace;\n\n if (workspaceQuery.isLoading) {\n return (\n <div className=\"space-y-4\">\n <Skeleton className=\"h-12 w-80\" />\n <Skeleton className=\"h-32 w-full rounded-2xl\" />\n </div>\n );\n }\n if (!workspace) {\n return (\n <div className=\"space-y-4\">\n <PageHeader title={workspaceKey} leading={backLink} />\n <StatusCallout\n tone=\"destructive\"\n title={t('This workspace was not found.')}\n description={workspaceQuery.isError ? errorText(workspaceQuery.error, t('The workspace could not be loaded.')) : undefined}\n />\n </div>\n );\n }\n\n const hasSession = workspace.state !== 'OFFLOADED';\n const busy = actions.isPending;\n return (\n <div className=\"space-y-6\">\n <PageHeader\n leading={backLink}\n title={sandboxNameOf(workspace)}\n description={<span className=\"font-mono text-xs\">{workspace.workspaceKey}</span>}\n actions={\n <div className=\"flex flex-wrap items-center gap-2\">\n {headerActions}\n <Button type=\"button\" variant=\"outline\" onClick={() => void workspaceQuery.refetch?.()} disabled={workspaceQuery.isFetching}>\n <RefreshCw className={cn(workspaceQuery.isFetching && 'animate-spin')} />\n {t('Refresh')}\n </Button>\n <Button type=\"button\" variant=\"outline\" disabled={busy} onClick={() => void actions.run({ kind: 'start', workspace })}>\n <Play />\n {hasSession ? t('Warm up session') : t('Start session', { context: 'sandbox-action' })}\n </Button>\n <Button type=\"button\" variant=\"outline\" disabled={busy || !hasSession} onClick={() => void actions.run({ kind: 'offload', workspace })}>\n <Archive />\n {t('Offload', { context: 'sandbox-action' })}\n </Button>\n <Button type=\"button\" variant=\"outline\" disabled={busy || !hasSession} onClick={() => void actions.run({ kind: 'end', workspace })}>\n <Power />\n {t('End session', { context: 'sandbox-action' })}\n </Button>\n <Button\n type=\"button\"\n variant=\"outline\"\n className=\"border-destructive/40 text-destructive hover:bg-destructive/10 hover:text-destructive\"\n disabled={busy}\n onClick={() => void actions.run({ kind: 'reset', workspace })}\n >\n <RotateCcw />\n {t('Reset workspace', { context: 'sandbox-action' })}\n </Button>\n </div>\n }\n />\n {workspace.hasLiveTurn && (\n <StatusCallout\n tone=\"warning\"\n title={t('A turn is running on this space')}\n description={t('Actions now can break the agent’s work; each asks for a reason, which is kept in the audit.')}\n />\n )}\n <Card>\n <CardContent className=\"pt-6\">\n <DefinitionList\n items={[\n { id: 'state', label: t('State', { context: 'sandbox' }), value: <StatusBadge value={workspace.state as SandboxState} map={SANDBOX_STATE} /> },\n { id: 'activity', label: t('Last activity'), value: <DateCell value={workspace.lastActivityAt} /> },\n { id: 'disk', label: t('Disk', { context: 'sandbox' }), value: <SandboxUsageBar used={workspace.diskUsedBytes} limit={workspace.diskQuotaBytes} /> },\n {\n id: 'memory',\n label: t('Memory', { context: 'sandbox' }),\n value: <SandboxUsageBar used={workspace.memoryBytes} limit={workspace.memoryLimitBytes} peak={workspace.memoryPeakBytes} />,\n },\n { id: 'mount', label: t('Mount', { context: 'sandbox' }), value: <SandboxMountMode workspace={workspace} /> },\n { id: 'pod', label: t('Runner', { context: 'sandbox' }), value: workspace.runnerPod ? <span className=\"font-mono text-xs\">{workspace.runnerPod}</span> : null },\n { id: 'owner', label: t('Owner', { context: 'sandbox' }), value: workspace.ownerDisplayName },\n { id: 'jobs', label: t('Running jobs'), value: workspace.runningJobCount ?? null },\n { id: 'conversations', label: t('Conversations'), value: workspace.conversationCount ?? null },\n ]}\n />\n </CardContent>\n </Card>\n <section className=\"space-y-4\">\n <SectionHeader\n title={t(SANDBOX_DETAIL_TABS.find(item => item.id === tab)?.label ?? '', { context: 'sandbox-tab' })}\n tabs={SANDBOX_DETAIL_TABS}\n activeTab={tab}\n onTabSelect={id => selectTab(id as SandboxDetailTab)}\n tabsLabel={t('Workspace views')}\n />\n {tab === 'files' && <FilesTab api={api} workspaceKey={workspaceKey} loadPdfJs={loadPdfJs} />}\n {tab === 'changes' && <ChangesTab api={api} workspaceKey={workspaceKey} />}\n {tab === 'processes' && (\n <ProcessesTab api={api} workspace={workspace} killDisabled={busy} onKill={jobId => void actions.run({ kind: 'kill', workspace, jobId })} />\n )}\n {tab === 'commands' && <CommandsTab api={api} workspaceKey={workspaceKey} />}\n {tab === 'conversations' && <ConversationsTab api={api} workspaceKey={workspaceKey} buildConversationHref={buildConversationHref} />}\n {tab === 'events' && <EventsTab api={api} workspaceKey={workspaceKey} />}\n {tab === 'audit' && <AuditTab api={api} workspaceKey={workspaceKey} />}\n </section>\n {actions.dialog}\n </div>\n );\n};\n","'use client';\n\nimport { normalizeDddError } from '@mgamadeus/ddd-web/contract';\nimport { Download } from 'lucide-react';\nimport { useEffect, useState } from 'react';\n\nimport { PdfPreview, type PdfJsLoader } from '@mgamadeus/ddd-admin-ui/files';\nimport { TextPreview } from '@mgamadeus/ddd-admin-ui/files';\nimport { useTranslate } from '@mgamadeus/ddd-admin-ui/i18n';\nimport { notify } from '@mgamadeus/ddd-admin-ui/logic';\nimport { Button } from '@mgamadeus/ddd-admin-ui/primitives';\nimport { Skeleton } from '@mgamadeus/ddd-admin-ui/primitives';\nimport type { SandboxesApi } from '../api.ts';\nimport { formatSandboxBytes, SANDBOX_TEXT_PREVIEW_BYTES, type SandboxPreviewKind, sandboxPreviewKindOf } from './format.ts';\nimport type { SandboxFileEntry } from '../types.ts';\n\nexport interface SandboxFilePreviewProps {\n api: SandboxesApi;\n workspaceKey: string;\n file: SandboxFileEntry;\n /** pdf.js of the host (without it a PDF offers its download only). */\n loadPdfJs?: PdfJsLoader;\n}\n\n/** Saves bytes under a name (an object URL and a link; the bytes are never opened). */\nconst saveBlob = (blob: Blob, fileName: string) => {\n const url = URL.createObjectURL(blob);\n const link = document.createElement('a');\n link.href = url;\n link.download = fileName;\n link.rel = 'noopener';\n document.body.append(link);\n link.click();\n link.remove();\n setTimeout(() => URL.revokeObjectURL(url), 10_000);\n};\n\n/**\n * A file of a workspace, read only, as untrusted content: the server picks the type from the bytes; JPEG, PNG, GIF\n * and WebP draw as `<img>`, PDF on canvases through the host's pdf.js, text as text nodes (the first 256 KB); anything\n * else only downloads. Nothing is ever rendered as HTML.\n */\nexport const SandboxFilePreview = ({ api, workspaceKey, file, loadPdfJs }: SandboxFilePreviewProps) => {\n const { t } = useTranslate();\n const [requestContent] = api.useSandboxFileContentMutation();\n const [preview, setPreview] = useState<{ url: string; kind: SandboxPreviewKind; size: number } | null>(null);\n const [failed, setFailed] = useState<string | null>(null);\n const [downloading, setDownloading] = useState(false);\n\n useEffect(() => {\n let cancelled = false;\n let objectUrl: string | null = null;\n setPreview(null);\n setFailed(null);\n void requestContent({ workspaceKey, path: file.path, disposition: 'inline' })\n .unwrap()\n .then(content => {\n if (cancelled) return;\n objectUrl = URL.createObjectURL(content.blob);\n setPreview({ url: objectUrl, kind: sandboxPreviewKindOf(content.contentType || content.blob.type), size: content.blob.size });\n })\n .catch(error => {\n if (!cancelled) setFailed(normalizeDddError(error, t('The file could not be loaded.')).message);\n });\n return () => {\n cancelled = true;\n if (objectUrl) URL.revokeObjectURL(objectUrl);\n };\n }, [requestContent, workspaceKey, file.path, t]);\n\n const download = async () => {\n setDownloading(true);\n try {\n const content = await requestContent({ workspaceKey, path: file.path, disposition: 'attachment' }).unwrap();\n saveBlob(content.blob, content.filename ?? file.name);\n } catch (error) {\n notify.error(normalizeDddError(error, t('%name% could not be downloaded', { replacements: { name: file.name } })).message);\n } finally {\n setDownloading(false);\n }\n };\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <p className=\"min-w-0 truncate font-mono text-[13px]\" title={file.path}>\n {file.path}\n </p>\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={() => void download()} disabled={downloading}>\n <Download />\n {t('Download', { context: 'action' })}\n </Button>\n </div>\n {failed ? (\n <p className=\"text-[13px] text-muted-foreground\">{failed}</p>\n ) : !preview ? (\n <Skeleton className=\"h-48 w-full rounded-xl\" />\n ) : preview.kind === 'image' ? (\n <img src={preview.url} alt={file.name} className=\"max-h-[60vh] max-w-full rounded-lg border object-contain\" />\n ) : preview.kind === 'pdf' && loadPdfJs ? (\n <PdfPreview url={preview.url} fileName={file.name} loadPdfJs={loadPdfJs} />\n ) : preview.kind === 'text' ? (\n <>\n <TextPreview url={preview.url} fileName={file.name} />\n {preview.size >= SANDBOX_TEXT_PREVIEW_BYTES && (\n <p className=\"text-xs text-muted-foreground\">{t('Only the beginning of the file is shown; download it for the rest.')}</p>\n )}\n </>\n ) : (\n <p className=\"text-[13px] text-muted-foreground\">\n {t('No preview for this type (%size%): download it to open it.', { replacements: { size: formatSandboxBytes(file.sizeBytes ?? preview.size) } })}\n </p>\n )}\n </div>\n );\n};\n"],"mappings":";;;AACA,SAAS,SAAS,aAAa,WAAW,SAAS,OAAO,MAAM,MAAM,mBAAmB;AAEzF,SAAS,sBAAsB;AAC/B,SAAS,SAAS;AAClB,SAAS,uBAAuB;AAIzB,IAAM,gBAAgB,gBAA8B;AAAA,EACzD,SAAS;AAAA,IACP,OAAO,EAAE,WAAW,EAAE,SAAS,gBAAgB,CAAC;AAAA,IAChD,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa,EAAE,gEAAgE,EAAE,SAAS,gBAAgB,CAAC;AAAA,EAC7G;AAAA,EACA,MAAM;AAAA,IACJ,OAAO,EAAE,QAAQ,EAAE,SAAS,gBAAgB,CAAC;AAAA,IAC7C,MAAM;AAAA,IACN,MAAM;AAAA,IACN,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AAQ,YAAY,gBAAAA,KAAC,aAAU,KAAU,cAA4B;AAAA,MACrE,QAAQ,WAAW,gBAAAA,KAAC,YAAS,KAAU,cAA4B;AAAA,OACtE;AAAA,IACC,QAAQ;AAAA,KACX;AAEJ;","names":["normalizeDddError","Archive","Play","useState","m","useTranslate","jsx","jsxs","useTranslate","Play","Archive","useState","m","normalizeDddError","normalizeDddError","Archive","Play","Power","RefreshCw","useState","m","useTranslate","DateCell","EmptyValue","EntityListBody","EntityListCard","StatusBadge","PageHeader","StatusCallout","Badge","Button","cn","Skeleton","normalizeDddError","useState","useTranslate","notify","Button","jsx","jsxs","useTranslate","useState","normalizeDddError","notify","Button","Fragment","jsx","jsxs","m","normalizeDddError","cn","useTranslate","useState","Badge","EmptyValue","DateCell","EntityListCard","EntityListBody","StatusCallout","Button","Skeleton","StatusBadge","PageHeader","RefreshCw","Play","Archive","Power"]}
|
|
1
|
+
{"version":3,"sources":["../../src/screen/format.ts","../../src/screen/SandboxesScreen.tsx","../../src/screen/useSandboxActions.tsx","../../src/screen/SandboxDetailScreen.tsx","../../src/screen/SandboxFilePreview.tsx"],"sourcesContent":["// Labels, states and numbers of the sandbox screens. Pure: no React.\nimport { Archive, CircleCheck, CircleDot, CircleX, Clock, Moon, Play, ShieldAlert } from 'lucide-react';\n\nimport { extensionOf, filePreviewKind } from '@mgamadeus/ddd-admin-ui/files';\nimport { formatUiNumber } from '@mgamadeus/ddd-admin-ui/i18n';\nimport { m } from '@mgamadeus/ddd-admin-ui/i18n';\nimport { defineStatusMap } from '@mgamadeus/ddd-admin-ui/logic';\nimport type { SandboxActionOutcome, SandboxCommand, SandboxCommandStatus, SandboxState, SandboxWorkspace } from '../types.ts';\n\n/** `SandboxWorkspace.state`. */\nexport const SANDBOX_STATE = defineStatusMap<SandboxState>({\n RUNNING: {\n label: m('Running', { context: 'sandbox-state' }),\n tone: 'success',\n icon: Play,\n description: m('A session is open: commands run and files live on the runner', { context: 'sandbox-state' }),\n },\n IDLE: {\n label: m('Idle', { context: 'sandbox-state' }),\n tone: 'info',\n icon: Moon,\n description: m('The session is open but nothing ran for a while', { context: 'sandbox-state' }),\n },\n OFFLOADED: {\n label: m('Offloaded', { context: 'sandbox-state' }),\n tone: 'neutral',\n icon: Archive,\n description: m('No session: the workspace is saved and starts again on the next command', { context: 'sandbox-state' }),\n },\n}, { context: 'sandbox-state' });\n\n/** `SandboxActionLogEntry.outcome`. */\nexport const SANDBOX_ACTION_OUTCOME = defineStatusMap<SandboxActionOutcome>({\n SUCCEEDED: { label: m('Done', { context: 'sandbox-action-outcome' }), tone: 'success', icon: CircleCheck },\n REFUSED: {\n label: m('Refused', { context: 'sandbox-action-outcome' }),\n tone: 'warning',\n icon: ShieldAlert,\n description: m('Not run: a turn was running, a confirmation or a reason was missing', { context: 'sandbox-action-outcome' }),\n },\n FAILED: { label: m('Failed', { context: 'sandbox-action-outcome' }), tone: 'danger', icon: CircleX },\n}, { context: 'sandbox-action-outcome' });\n\n/**\n * The state of a command: the server's `status`, else derived from the exit code — an exit code\n * is EXITED, none is UNKNOWN (a killed or timed-out command has none either, so it is never shown as running).\n */\nexport type SandboxCommandState = SandboxCommandStatus | 'UNKNOWN';\n\nexport const sandboxCommandStateOf = (command: Pick<SandboxCommand, 'status' | 'exitCode'>): SandboxCommandState => {\n if (command.status) return command.status;\n return command.exitCode === null || command.exitCode === undefined ? 'UNKNOWN' : 'EXITED';\n};\n\n/** `SandboxCommand.status` as a badge (EXITED carries the exit code next to it). */\nexport const SANDBOX_COMMAND_STATE = defineStatusMap<SandboxCommandState>({\n RUNNING: { label: m('Running', { context: 'sandbox-command-state' }), tone: 'info', icon: Play },\n EXITED: { label: m('Exited', { context: 'sandbox-command-state' }), tone: 'neutral', icon: CircleCheck },\n KILLED: {\n label: m('Killed', { context: 'sandbox-command-state' }),\n tone: 'warning',\n icon: CircleX,\n description: m('The command was stopped: its job was killed, the session ended or a limit was hit', { context: 'sandbox-command-state' }),\n },\n TIMED_OUT: {\n label: m('Timed out', { context: 'sandbox-command-state' }),\n tone: 'danger',\n icon: Clock,\n description: m('The runner stopped the command at its time limit', { context: 'sandbox-command-state' }),\n },\n UNKNOWN: {\n label: m('State unknown', { context: 'sandbox-command-state' }),\n tone: 'neutral',\n icon: CircleDot,\n description: m('The server reports no state and no exit code for this command', { context: 'sandbox-command-state' }),\n },\n}, { context: 'sandbox-command-state' });\n\n/** The translation context of `SANDBOX_ACTION_LABELS`. */\nexport const SANDBOX_ACTION_LABEL_CONTEXT = 'sandbox-action';\n\n/** The translation context of `SANDBOX_CHANGE_LABELS`. */\nexport const SANDBOX_CHANGE_LABEL_CONTEXT = 'sandbox-change';\n\n/** The actions of the audit, as the screen names them. */\nexport const SANDBOX_ACTION_LABELS: Readonly<Record<string, string>> = {\n START: m('Start session', { context: 'sandbox-action' }),\n OFFLOAD: m('Offload', { context: 'sandbox-action' }),\n KILL_JOB: m('Kill job', { context: 'sandbox-action' }),\n END: m('End session', { context: 'sandbox-action' }),\n RESET: m('Reset workspace', { context: 'sandbox-action' }),\n};\n\n/** How a drive change of the workspace is named. */\nexport const SANDBOX_CHANGE_LABELS: Readonly<Record<string, string>> = {\n ADDED: m('Added', { context: 'sandbox-change' }),\n MODIFIED: m('Changed', { context: 'sandbox-change' }),\n DELETED: m('Deleted', { context: 'sandbox-change' }),\n RENAMED: m('Renamed', { context: 'sandbox-change' }),\n};\n\n/** The icon of a session log entry: a limit hit is a warning, everything else a dot. */\nexport const sessionEventIconOf = (type: string) => (/EXCEEDED|DENIED|TIMEOUT|OOM|KILLED/i.test(type) ? ShieldAlert : CircleDot);\n\n/** `1.5 GB` in the UI language; `—` for unknown. */\nexport const formatSandboxBytes = (bytes: number | null | undefined): string => {\n if (bytes === null || bytes === undefined || !Number.isFinite(bytes)) return '—';\n const units = ['B', 'KB', 'MB', 'GB', 'TB'];\n let value = bytes;\n let unit = 0;\n while (value >= 1024 && unit < units.length - 1) {\n value /= 1024;\n unit += 1;\n }\n return `${formatUiNumber(value, { maximumFractionDigits: unit === 0 || value >= 100 ? 0 : 1 })} ${units[unit]}`;\n};\n\n/** `850 ms`, `12.4 s`, `3 min 5 s`; `—` for unknown. */\nexport const formatSandboxDuration = (milliseconds: number | null | undefined): string => {\n if (milliseconds === null || milliseconds === undefined || !Number.isFinite(milliseconds)) return '—';\n if (milliseconds < 1000) return `${formatUiNumber(Math.round(milliseconds))} ms`;\n const seconds = milliseconds / 1000;\n if (seconds < 60) return `${formatUiNumber(seconds, { maximumFractionDigits: 1 })} s`;\n const minutes = Math.floor(seconds / 60);\n return `${formatUiNumber(minutes)} min ${formatUiNumber(Math.round(seconds - minutes * 60))} s`;\n};\n\n/** The share of a limit in percent (0–100, rounded), `null` without a limit. */\nexport const usagePercentOf = (used: number | null | undefined, limit: number | null | undefined): number | null =>\n used === null || used === undefined || !limit || limit <= 0 ? null : Math.min(100, Math.max(0, Math.round((used / limit) * 100)));\n\n/** The name a workspace is shown with: its display name, else its key. */\nexport const sandboxNameOf = (workspace: Pick<SandboxWorkspace, 'displayName' | 'workspaceKey'>): string =>\n workspace.displayName?.trim() ? workspace.displayName : workspace.workspaceKey;\n\n/** What a reset asks the reader to type: the display name, or the key without one (the server checks the same). */\nexport const sandboxResetPhraseOf = (workspace: Pick<SandboxWorkspace, 'displayName' | 'workspaceKey'>): string => sandboxNameOf(workspace);\n\n/** Whether an error is the server's \"a turn is running\" refusal (409): the action may be forced with a reason. */\nexport const isSandboxTurnRunningRefusal = (error: unknown): boolean => (error as { status?: unknown } | null)?.status === 409;\n\n/** The parent of a workspace path (`a/b/c` → `a/b`, `a` → `''`). */\nexport const sandboxParentPathOf = (path: string): string => {\n const trimmed = path.replace(/\\/+$/, '');\n const index = trimmed.lastIndexOf('/');\n return index <= 0 ? '' : trimmed.slice(0, index);\n};\n\n/** The crumbs of a workspace directory: root first. */\nexport const sandboxPathCrumbs = (path: string): { name: string; path: string }[] => {\n const parts = path.split('/').filter(part => part !== '');\n return parts.map((name, index) => ({ name, path: parts.slice(0, index + 1).join('/') }));\n};\n\n/** How a file is previewed, from the type the server sent with its bytes. */\nexport type SandboxPreviewKind = 'image' | 'pdf' | 'text' | 'none';\n\nexport const sandboxPreviewKindOf = (contentType: string): SandboxPreviewKind => {\n const type = contentType.split(';')[0]?.trim().toLowerCase() ?? '';\n if (type === 'image/jpeg' || type === 'image/png' || type === 'image/gif' || type === 'image/webp') return 'image';\n if (type === 'application/pdf') return 'pdf';\n if (type === 'text/plain') return 'text';\n return 'none';\n};\n\n/** How the text of a file is drawn. */\nexport type SandboxTextView = 'markdown' | 'code' | 'text';\n\n/**\n * How the text of a file is drawn, by the file's name: the server sends every text as `text/plain`, so the name\n * alone says Markdown (`.md`, `.markdown`) or a source file (the extensions the file blocks of\n * `@mgamadeus/ddd-admin-ui` know a language for). Everything else stays plain text.\n */\nexport const sandboxTextViewOf = (fileName: string): SandboxTextView => {\n const kind = filePreviewKind({ family: 'TEXT', extension: extensionOf(fileName) });\n return kind === 'markdown' || kind === 'code' ? kind : 'text';\n};\n\n/** The inline text preview of the server stops here; a larger answer was cut. */\nexport const SANDBOX_TEXT_PREVIEW_BYTES = 256 * 1024;\n","'use client';\n\nimport { normalizeDddError } from '@mgamadeus/ddd-web/contract';\nimport { Activity, Archive, MoreHorizontal, Play, Power, RefreshCw } from 'lucide-react';\nimport { type ReactNode, useMemo, useState } from 'react';\n\nimport { m } from '@mgamadeus/ddd-admin-ui/i18n';\nimport { useTranslate } from '@mgamadeus/ddd-admin-ui/i18n';\nimport { DateCell } from '@mgamadeus/ddd-admin-ui/list';\nimport { EmptyValue } from '@mgamadeus/ddd-admin-ui/list';\nimport { EntityListBody } from '@mgamadeus/ddd-admin-ui/list';\nimport { EntityListCard } from '@mgamadeus/ddd-admin-ui/list';\nimport type { EntityListColumn } from '@mgamadeus/ddd-admin-ui/list';\nimport { EntityListToolbar } from '@mgamadeus/ddd-admin-ui/list';\nimport { StatusBadge } from '@mgamadeus/ddd-admin-ui/list';\nimport { PageHeader } from '@mgamadeus/ddd-admin-ui/page';\nimport { StatusCallout } from '@mgamadeus/ddd-admin-ui/page';\nimport { Badge } from '@mgamadeus/ddd-admin-ui/primitives';\nimport { Button } from '@mgamadeus/ddd-admin-ui/primitives';\nimport { cn } from '@mgamadeus/ddd-admin-ui/primitives';\nimport { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '@mgamadeus/ddd-admin-ui/primitives';\nimport type { SandboxesApi } from '../api.ts';\nimport { formatSandboxBytes, SANDBOX_STATE, sandboxNameOf, usagePercentOf } from './format.ts';\nimport type { SandboxState, SandboxWorkspace } from '../types.ts';\nimport { useSandboxActions } from './useSandboxActions.tsx';\n\n/** A used / limit pair as a thin bar with its numbers (no bar without a limit). */\nexport const SandboxUsageBar = ({ used, limit, peak }: { used: number | null | undefined; limit: number | null | undefined; peak?: number | null }) => {\n const { t } = useTranslate();\n const percent = usagePercentOf(used, limit);\n const peakPercent = usagePercentOf(peak, limit);\n if (used === null || used === undefined) return <EmptyValue />;\n return (\n <div className=\"min-w-28 space-y-1\">\n <p className=\"text-[12.5px] tabular-nums\">\n {formatSandboxBytes(used)}\n {limit ? <span className=\"text-muted-foreground\"> / {formatSandboxBytes(limit)}</span> : null}\n {peak !== undefined && peak !== null && (\n <span className=\"block text-xs text-muted-foreground\">{t('Peak %size%', { replacements: { size: formatSandboxBytes(peak) } })}</span>\n )}\n </p>\n {percent !== null && (\n <div className=\"relative h-1.5 w-full overflow-hidden rounded-full bg-muted\" role=\"presentation\">\n <div\n className={cn('h-full rounded-full', percent >= 90 ? 'bg-destructive' : percent >= 75 ? 'bg-warning' : 'bg-primary')}\n style={{ width: `${percent}%` }}\n />\n {peakPercent !== null && peakPercent > percent && (\n <div className=\"absolute top-0 h-full w-0.5 bg-foreground/50\" style={{ left: `calc(${peakPercent}% - 1px)` }} />\n )}\n </div>\n )}\n </div>\n );\n};\n\n/** The mount mode and why (FUSE: the drive is mounted; PLAIN: files are copied). */\nexport const SandboxMountMode = ({ workspace }: { workspace: SandboxWorkspace }) => {\n if (!workspace.mountMode) return <EmptyValue />;\n return (\n <span className=\"text-[12.5px]\">\n <Badge variant=\"outline\" className=\"font-mono\">\n {workspace.mountMode}\n </Badge>\n {workspace.mountModeReason && <span className=\"mt-0.5 block max-w-56 truncate text-xs text-muted-foreground\" title={workspace.mountModeReason}>{workspace.mountModeReason}</span>}\n </span>\n );\n};\n\n/** The actions of one workspace as a menu (start, offload, end). */\nexport const SandboxActionsMenu = ({\n workspace,\n onAction,\n disabled = false,\n}: {\n workspace: SandboxWorkspace;\n onAction: (kind: 'start' | 'offload' | 'end') => void;\n disabled?: boolean;\n}) => {\n const { t } = useTranslate();\n const hasSession = workspace.state !== 'OFFLOADED';\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n data-row-action-ignore\n disabled={disabled}\n aria-label={t('Actions for %name%', { replacements: { name: sandboxNameOf(workspace) } })}\n >\n <MoreHorizontal />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"w-48\">\n <DropdownMenuItem onSelect={() => onAction('start')}>\n <Play />\n {hasSession ? t('Warm up session') : t('Start session', { context: 'sandbox-action' })}\n </DropdownMenuItem>\n <DropdownMenuItem disabled={!hasSession} onSelect={() => onAction('offload')}>\n <Archive />\n {t('Offload', { context: 'sandbox-action' })}\n </DropdownMenuItem>\n <DropdownMenuSeparator />\n <DropdownMenuItem variant=\"destructive\" disabled={!hasSession} onSelect={() => onAction('end')}>\n <Power />\n {t('End session', { context: 'sandbox-action' })}\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n\nexport interface SandboxesScreenProps {\n /** `createSandboxesApi(…)` of the host. */\n api: SandboxesApi;\n /** Default \"Sandboxes\". */\n title?: ReactNode;\n description?: ReactNode;\n headerActions?: ReactNode;\n /** Opens a workspace's details (the host's route, e.g. `router.push(…)`). */\n onOpenWorkspace?: (workspaceKey: string) => void;\n}\n\nconst SEARCH_KEYS: readonly (keyof SandboxWorkspace)[] = ['displayName', 'workspaceKey', 'ownerDisplayName', 'runnerPod'];\n\n/**\n * Every agent workspace of the host (one per agent space): state, last activity, disk and memory against their limits,\n * mount mode, runner pod, owner and conversations; start, offload and end per row (audited, refused while a turn runs\n * unless forced with a reason). Needs the Composer package mgamadeus/ddd-agent-sandbox (`SandboxesControllerTrait`).\n */\nexport const SandboxesScreen = ({ api, title, description, headerActions, onOpenWorkspace }: SandboxesScreenProps) => {\n const { t } = useTranslate();\n const listQuery = api.useSandboxesListQuery();\n const actions = useSandboxActions(api);\n const [search, setSearch] = useState('');\n const workspaces = useMemo(() => listQuery.data?.workspaces?.elements ?? [], [listQuery.data]);\n const needle = search.trim().toLocaleLowerCase();\n const shown = useMemo(\n () => (needle === '' ? workspaces : workspaces.filter(workspace => SEARCH_KEYS.some(key => String(workspace[key] ?? '').toLocaleLowerCase().includes(needle)))),\n [workspaces, needle]\n );\n const runningCount = workspaces.filter(workspace => workspace.state === 'RUNNING').length;\n\n const columns: EntityListColumn<SandboxWorkspace>[] = [\n {\n id: 'name',\n header: t('Workspace', { context: 'sandbox' }),\n width: '2fr',\n cell: workspace => (\n <span className=\"min-w-0\">\n <span className=\"block truncate font-semibold\">{sandboxNameOf(workspace)}</span>\n <span className=\"block truncate font-mono text-xs text-muted-foreground\">{workspace.workspaceKey}</span>\n </span>\n ),\n },\n {\n id: 'state',\n header: t('State', { context: 'sandbox' }),\n width: 'content',\n cell: workspace => (\n <span className=\"flex flex-col items-start gap-1\">\n <StatusBadge value={workspace.state as SandboxState} map={SANDBOX_STATE} />\n {workspace.hasLiveTurn && (\n <span className=\"flex items-center gap-1 text-xs text-warning\">\n <Activity className=\"size-3\" />\n {t('Turn running')}\n </span>\n )}\n </span>\n ),\n },\n { id: 'activity', header: t('Last activity'), width: 'content', cell: workspace => <DateCell value={workspace.lastActivityAt} /> },\n { id: 'disk', header: t('Disk', { context: 'sandbox' }), cell: workspace => <SandboxUsageBar used={workspace.diskUsedBytes} limit={workspace.diskQuotaBytes} /> },\n {\n id: 'memory',\n header: t('Memory', { context: 'sandbox' }),\n cell: workspace => <SandboxUsageBar used={workspace.memoryBytes} limit={workspace.memoryLimitBytes} peak={workspace.memoryPeakBytes} />,\n },\n { id: 'mount', header: t('Mount', { context: 'sandbox' }), cell: workspace => <SandboxMountMode workspace={workspace} /> },\n {\n id: 'pod',\n header: t('Runner', { context: 'sandbox' }),\n cell: workspace => (workspace.runnerPod ? <span className=\"font-mono text-xs\">{workspace.runnerPod}</span> : <EmptyValue />),\n },\n { id: 'owner', header: t('Owner', { context: 'sandbox' }), cell: workspace => workspace.ownerDisplayName ?? <EmptyValue /> },\n {\n id: 'conversations',\n header: t('Conversations'),\n width: 'content',\n align: 'end',\n cell: workspace => <span className=\"tabular-nums\">{workspace.conversationCount ?? '—'}</span>,\n },\n {\n id: 'actions',\n header: <span className=\"sr-only\">{t('Actions', { context: 'table-column' })}</span>,\n width: 'content',\n pin: 'end',\n cell: workspace => (\n <SandboxActionsMenu workspace={workspace} disabled={actions.isPending} onAction={kind => void actions.run({ kind, workspace })} />\n ),\n },\n ];\n\n return (\n <div className=\"space-y-6\">\n <PageHeader\n title={title ?? t('Sandboxes')}\n description={\n description ??\n t('The agents’ workspaces: one per agent space. Files and command output are shown as untrusted text, never run.')\n }\n actions={\n <div className=\"flex flex-wrap items-center gap-2\">\n {headerActions}\n <Button type=\"button\" variant=\"outline\" onClick={() => void listQuery.refetch?.()} disabled={listQuery.isFetching}>\n <RefreshCw className={cn(listQuery.isFetching && 'animate-spin')} />\n {t('Refresh')}\n </Button>\n </div>\n }\n />\n {listQuery.data && !listQuery.data.isConfigured ? (\n <StatusCallout\n tone=\"info\"\n title={t('Sandboxes are not set up')}\n description={t('No sandbox runner is configured in this application (AI.Sandbox.runner.host), so there is nothing to show.')}\n />\n ) : (\n <EntityListCard\n label={m('Sandboxes')}\n isRefetching={listQuery.isFetching && !listQuery.isLoading}\n toolbar={\n <EntityListToolbar\n search={{ value: search, onChange: setSearch, placeholder: t('Search name, key, owner or runner…'), 'aria-label': t('Search sandboxes') }}\n trailing={\n workspaces.length > 0 ? (\n <span className=\"text-[12.5px] font-bold text-muted-foreground\">\n {t('{count, plural, one {# running} other {# running}}', { count: runningCount })} ·{' '}\n {t('{count, plural, one {# workspace} other {# workspaces}}', { count: workspaces.length })}\n </span>\n ) : undefined\n }\n />\n }\n >\n <EntityListBody\n displayMode=\"table\"\n columns={columns}\n items={shown}\n getRowKey={workspace => workspace.workspaceKey}\n rowAction={onOpenWorkspace ? workspace => () => onOpenWorkspace(workspace.workspaceKey) : undefined}\n isLoading={listQuery.isLoading}\n emptyMessage={t('No workspace yet: a workspace appears with the first command of an agent space.')}\n noResultsMessage={t('No workspace matches the search.')}\n isSearchActive={needle !== ''}\n onClearSearch={() => setSearch('')}\n loadingMessage={t('Loading the sandboxes')}\n error={listQuery.isError ? normalizeDddError(listQuery.error, t('The sandboxes could not be loaded.')).message : undefined}\n />\n </EntityListCard>\n )}\n {actions.dialog}\n </div>\n );\n};\n","'use client';\n\nimport { normalizeDddError } from '@mgamadeus/ddd-web/contract';\nimport { type ReactNode, useCallback, useState } from 'react';\n\nimport { FormDialog } from '@mgamadeus/ddd-admin-ui/form';\nimport { useTranslate } from '@mgamadeus/ddd-admin-ui/i18n';\nimport { notify } from '@mgamadeus/ddd-admin-ui/logic';\nimport { useConfirm } from '@mgamadeus/ddd-admin-ui/logic';\nimport { Label } from '@mgamadeus/ddd-admin-ui/primitives';\nimport { Textarea } from '@mgamadeus/ddd-admin-ui/primitives';\nimport type { SandboxesApi } from '../api.ts';\nimport { isSandboxTurnRunningRefusal, sandboxNameOf, sandboxResetPhraseOf } from './format.ts';\nimport type { SandboxActionBody, SandboxActionResponse, SandboxWorkspace } from '../types.ts';\n\n/** One action of the sandbox screens. */\nexport type SandboxActionRequest =\n | { kind: 'start' | 'offload' | 'end' | 'reset'; workspace: SandboxWorkspace }\n | { kind: 'kill'; workspace: SandboxWorkspace; jobId: string };\n\nexport interface SandboxActions {\n /** Asks (confirmation, typed name for a reset, a reason while a turn runs), runs it and reports the outcome. */\n run: (request: SandboxActionRequest) => Promise<boolean>;\n /** An action is running. */\n isPending: boolean;\n /** The \"force with a reason\" dialog; render it once in the screen. */\n dialog: ReactNode;\n}\n\nconst MIN_REASON_LENGTH = 3;\n\n/**\n * The actions of the sandbox screens: start, offload, end, reset (typed name) and kill a job. A running turn on the\n * space (`hasLiveTurn`, or the server's 409) asks for a reason and sends the action with `force`; the server audits it.\n */\nexport const useSandboxActions = (api: SandboxesApi): SandboxActions => {\n const { t } = useTranslate();\n const confirm = useConfirm();\n const [runAction, actionState] = api.useSandboxActionMutation();\n const [killJob, killState] = api.useKillSandboxJobMutation();\n const [forceRequest, setForceRequest] = useState<{ request: SandboxActionRequest; extra: SandboxActionBody } | null>(null);\n const [reason, setReason] = useState('');\n const [forcing, setForcing] = useState(false);\n\n const labelOf = useCallback(\n (request: SandboxActionRequest): string => {\n switch (request.kind) {\n case 'start':\n return t('Start session', { context: 'sandbox-action' });\n case 'offload':\n return t('Offload', { context: 'sandbox-action' });\n case 'end':\n return t('End session', { context: 'sandbox-action' });\n case 'reset':\n return t('Reset workspace', { context: 'sandbox-action' });\n case 'kill':\n return t('Kill job', { context: 'sandbox-action' });\n }\n },\n [t]\n );\n\n const send = useCallback(\n async (request: SandboxActionRequest, body: SandboxActionBody): Promise<SandboxActionResponse> =>\n request.kind === 'kill'\n ? killJob({ workspaceKey: request.workspace.workspaceKey, jobId: request.jobId, ...body }).unwrap()\n : runAction({ workspaceKey: request.workspace.workspaceKey, action: request.kind, ...body }).unwrap(),\n [killJob, runAction]\n );\n\n const report = useCallback(\n (request: SandboxActionRequest, response: SandboxActionResponse) => {\n const { actionResult } = response;\n const name = sandboxNameOf(request.workspace);\n if (actionResult.outcome !== 'SUCCEEDED') {\n notify.error(t('%action% did not run for %name%.', { replacements: { action: labelOf(request), name } }));\n return false;\n }\n const offload = actionResult.offloadResult;\n notify.success(\n offload\n ? t('%name% offloaded: %count% changes saved to the drive.', { replacements: { name, count: offload.committedChangeCount } })\n : t('%action%: done for %name%.', { replacements: { action: labelOf(request), name } })\n );\n return true;\n },\n [t, labelOf]\n );\n\n const attempt = useCallback(\n async (request: SandboxActionRequest, body: SandboxActionBody): Promise<boolean> => {\n try {\n return report(request, await send(request, body));\n } catch (error) {\n if (!body.force && isSandboxTurnRunningRefusal(error)) {\n setReason('');\n setForceRequest({ request, extra: body });\n return false;\n }\n notify.error(normalizeDddError(error, t('%action% failed.', { replacements: { action: labelOf(request) } })).message);\n return false;\n }\n },\n [send, report, t, labelOf]\n );\n\n const run = useCallback(\n async (request: SandboxActionRequest): Promise<boolean> => {\n const name = sandboxNameOf(request.workspace);\n const extra: SandboxActionBody = {};\n if (request.kind === 'reset') {\n const phrase = sandboxResetPhraseOf(request.workspace);\n const confirmed = await confirm({\n title: t('Reset the workspace of %name%?', { replacements: { name } }),\n description: t(\n 'Everything on the runner is wiped: local files, installed packages, unsaved changes. Files in the drive stay. The agent starts from an empty workspace next time.'\n ),\n confirmLabel: t('Reset workspace', { context: 'sandbox-action' }),\n confirmVariant: 'destructive',\n requirePhrase: phrase,\n });\n if (!confirmed) return false;\n extra.confirmation = phrase;\n } else if (request.kind === 'offload' || request.kind === 'end' || request.kind === 'kill') {\n const jobId = request.kind === 'kill' ? request.jobId : '';\n const confirmed = await confirm({\n title:\n request.kind === 'offload'\n ? t('Offload %name%?', { replacements: { name } })\n : request.kind === 'end'\n ? t('End the session of %name%?', { replacements: { name } })\n : t('Kill the job %job%?', { replacements: { job: jobId } }),\n description:\n request.kind === 'offload'\n ? t('Unsaved changes are written to the drive, then the session is released. The workspace stays and starts again on the next command.')\n : request.kind === 'end'\n ? t('The session stops now, with every running command. The saved workspace stays; changes not yet in the drive can be lost — offload first to keep them.')\n : t('The job stops at once; its output so far stays in the command history.'),\n confirmLabel: labelOf(request),\n confirmVariant: request.kind === 'offload' ? 'default' : 'destructive',\n });\n if (!confirmed) return false;\n }\n if (request.workspace.hasLiveTurn) {\n setReason('');\n setForceRequest({ request, extra });\n return false;\n }\n return attempt(request, extra);\n },\n [confirm, t, labelOf, attempt]\n );\n\n const dialog = (\n <FormDialog\n open={forceRequest !== null}\n onOpenChange={open => !open && setForceRequest(null)}\n title={forceRequest ? t('%action% while a turn is running?', { replacements: { action: labelOf(forceRequest.request) } }) : ''}\n description={t(\n 'An agent conversation of this space is working right now; the action can break its turn. Say why it must run now — the reason is kept in the audit.'\n )}\n submitLabel={t('Run anyway')}\n pendingLabel={t('Running…')}\n submitVariant=\"destructive\"\n isPending={forcing}\n submitDisabled={reason.trim().length < MIN_REASON_LENGTH}\n onSubmit={async event => {\n event.preventDefault();\n if (!forceRequest) return;\n setForcing(true);\n try {\n const ok = await attempt(forceRequest.request, { ...forceRequest.extra, force: true, reason: reason.trim() });\n if (ok) setForceRequest(null);\n } finally {\n setForcing(false);\n }\n }}\n >\n <div className=\"space-y-2\">\n <Label htmlFor=\"sandbox-force-reason\">{t('Reason', { context: 'sandbox-force' })}</Label>\n <Textarea id=\"sandbox-force-reason\" value={reason} onChange={event => setReason(event.target.value)} rows={3} maxLength={500} />\n </div>\n </FormDialog>\n );\n\n return { run, isPending: actionState.isLoading || killState.isLoading || forcing, dialog };\n};\n","'use client';\n\nimport { normalizeDddError } from '@mgamadeus/ddd-web/contract';\nimport { Archive, ChevronRight, File, Folder, Link2, OctagonX, Play, Power, RefreshCw, RotateCcw } from 'lucide-react';\nimport { type ReactNode, useState } from 'react';\n\nimport type { FilePreviewLoaders } from '@mgamadeus/ddd-admin-ui/files';\nimport { m } from '@mgamadeus/ddd-admin-ui/i18n';\nimport { useTranslate } from '@mgamadeus/ddd-admin-ui/i18n';\nimport { DateCell } from '@mgamadeus/ddd-admin-ui/list';\nimport { EmptyValue } from '@mgamadeus/ddd-admin-ui/list';\nimport { EntityListBody } from '@mgamadeus/ddd-admin-ui/list';\nimport { EntityListCard } from '@mgamadeus/ddd-admin-ui/list';\nimport type { EntityListColumn } from '@mgamadeus/ddd-admin-ui/list';\nimport { StatusBadge } from '@mgamadeus/ddd-admin-ui/list';\nimport { DefinitionList } from '@mgamadeus/ddd-admin-ui/page';\nimport { PageHeader } from '@mgamadeus/ddd-admin-ui/page';\nimport { SectionHeader } from '@mgamadeus/ddd-admin-ui/page';\nimport { StatusCallout } from '@mgamadeus/ddd-admin-ui/page';\nimport { Badge } from '@mgamadeus/ddd-admin-ui/primitives';\nimport { Button } from '@mgamadeus/ddd-admin-ui/primitives';\nimport { Card, CardContent } from '@mgamadeus/ddd-admin-ui/primitives';\nimport { cn } from '@mgamadeus/ddd-admin-ui/primitives';\nimport { useLinkComponent } from '@mgamadeus/ddd-admin-ui/primitives';\nimport { Skeleton } from '@mgamadeus/ddd-admin-ui/primitives';\nimport type { SandboxesApi } from '../api.ts';\nimport {\n formatSandboxBytes,\n formatSandboxDuration,\n SANDBOX_ACTION_LABELS,\n SANDBOX_ACTION_OUTCOME,\n SANDBOX_CHANGE_LABELS,\n SANDBOX_COMMAND_STATE,\n SANDBOX_STATE,\n sandboxCommandStateOf,\n sandboxNameOf,\n sandboxParentPathOf,\n sandboxPathCrumbs,\n sessionEventIconOf,\n} from './format.ts';\nimport { SandboxFilePreview } from './SandboxFilePreview.tsx';\nimport { SandboxMountMode, SandboxUsageBar } from './SandboxesScreen.tsx';\nimport type {\n SandboxActionLogEntry,\n SandboxActionOutcome,\n SandboxState,\n SandboxCommand,\n SandboxConversation,\n SandboxDriveChange,\n SandboxFileEntry,\n SandboxProcess,\n SandboxWorkspace,\n} from '../types.ts';\nimport { useSandboxActions } from './useSandboxActions.tsx';\n\n/** The tabs of a workspace. */\nexport const SANDBOX_DETAIL_TABS = [\n { id: 'files', label: m('Files', { context: 'sandbox-tab' }), context: 'sandbox-tab' },\n { id: 'changes', label: m('Unsaved changes', { context: 'sandbox-tab' }), context: 'sandbox-tab' },\n { id: 'processes', label: m('Processes & jobs', { context: 'sandbox-tab' }), context: 'sandbox-tab' },\n { id: 'commands', label: m('Commands', { context: 'sandbox-tab' }), context: 'sandbox-tab' },\n { id: 'conversations', label: m('Conversations', { context: 'sandbox-tab' }), context: 'sandbox-tab' },\n { id: 'events', label: m('Session log', { context: 'sandbox-tab' }), context: 'sandbox-tab' },\n { id: 'audit', label: m('Audit', { context: 'sandbox-tab' }), context: 'sandbox-tab' },\n] as const;\n\nexport type SandboxDetailTab = (typeof SANDBOX_DETAIL_TABS)[number]['id'];\n\nconst COMMAND_LIMIT = 50;\nconst LOG_LIMIT = 100;\n\nconst errorText = (error: unknown, fallback: string) => normalizeDddError(error, fallback).message;\n\n/** Text that came from the sandbox (a command, its output): escaped, preformatted, never interpreted. */\nconst UntrustedText = ({ text, className }: { text: string | null | undefined; className?: string }) =>\n text ? <pre className={cn('max-h-64 overflow-auto rounded-lg bg-muted p-3 font-mono text-xs whitespace-pre-wrap break-all', className)}>{text}</pre> : null;\n\nconst FilesTab = ({ api, workspaceKey, loadPdfJs, loadCodeHighlighter, renderMarkdown }: { api: SandboxesApi; workspaceKey: string } & FilePreviewLoaders) => {\n const { t } = useTranslate();\n const [directory, setDirectory] = useState('');\n const [openFile, setOpenFile] = useState<SandboxFileEntry | null>(null);\n const filesQuery = api.useSandboxFilesQuery({ workspaceKey, path: directory });\n const entries = [...(filesQuery.data?.entries?.elements ?? [])].sort((a, b) =>\n a.type === b.type ? a.name.localeCompare(b.name) : a.type === 'DIRECTORY' ? -1 : b.type === 'DIRECTORY' ? 1 : 0\n );\n const columns: EntityListColumn<SandboxFileEntry>[] = [\n {\n id: 'name',\n header: t('Name', { context: 'sandbox-file' }),\n width: '3fr',\n cell: entry => (\n <span className=\"flex min-w-0 items-center gap-2\">\n {entry.type === 'DIRECTORY' ? <Folder className=\"size-4 shrink-0 text-muted-foreground\" /> : <File className=\"size-4 shrink-0 text-muted-foreground\" />}\n <span className=\"truncate font-mono text-[13px]\">{entry.name}</span>\n {entry.type === 'SYMLINK' && <Badge variant=\"outline\">{t('Link', { context: 'sandbox-file' })}</Badge>}\n </span>\n ),\n },\n { id: 'size', header: t('Size', { context: 'sandbox-file' }), width: 'content', align: 'end', cell: entry => (entry.type === 'DIRECTORY' ? <EmptyValue /> : formatSandboxBytes(entry.sizeBytes)) },\n { id: 'modified', header: t('Modified', { context: 'sandbox-file' }), width: 'content', cell: entry => <DateCell value={entry.modifiedAt} /> },\n ];\n return (\n <div className=\"grid gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]\">\n <EntityListCard\n label={m('Files', { context: 'sandbox-tab' })}\n labelContext=\"sandbox-tab\"\n toolbar={\n <nav aria-label={t('Folder path')} className=\"flex min-w-0 flex-wrap items-center gap-1 px-1 text-[13px]\">\n <button type=\"button\" className=\"rounded px-1 font-semibold hover:bg-muted\" onClick={() => setDirectory('')}>\n {t('Workspace', { context: 'sandbox' })}\n </button>\n {sandboxPathCrumbs(directory).map(crumb => (\n <span key={crumb.path} className=\"flex items-center gap-1\">\n <ChevronRight className=\"size-3.5 text-muted-foreground\" />\n <button type=\"button\" className=\"rounded px-1 font-mono hover:bg-muted\" onClick={() => setDirectory(crumb.path)}>\n {crumb.name}\n </button>\n </span>\n ))}\n </nav>\n }\n >\n <EntityListBody\n displayMode=\"table\"\n columns={columns}\n items={directory === '' ? entries : [{ name: '..', path: sandboxParentPathOf(directory), type: 'DIRECTORY' }, ...entries]}\n getRowKey={entry => `${entry.type}:${entry.path}:${entry.name}`}\n rowAction={entry => () => {\n if (entry.type === 'DIRECTORY') {\n setDirectory(entry.path);\n setOpenFile(null);\n } else {\n setOpenFile(entry);\n }\n }}\n isLoading={filesQuery.isLoading}\n emptyMessage={t('This folder is empty.')}\n loadingMessage={t('Loading files')}\n error={filesQuery.isError ? errorText(filesQuery.error, t('The files could not be loaded.')) : undefined}\n />\n </EntityListCard>\n <Card>\n <CardContent className=\"pt-6\">\n {openFile ? (\n <SandboxFilePreview\n api={api}\n workspaceKey={workspaceKey}\n file={openFile}\n loadPdfJs={loadPdfJs}\n loadCodeHighlighter={loadCodeHighlighter}\n renderMarkdown={renderMarkdown}\n />\n ) : (\n <p className=\"py-10 text-center text-[13px] text-muted-foreground\">{t('Pick a file to see it. Files are shown read only.')}</p>\n )}\n </CardContent>\n </Card>\n </div>\n );\n};\n\nconst ChangesTab = ({ api, workspaceKey }: { api: SandboxesApi; workspaceKey: string }) => {\n const { t } = useTranslate();\n const statusQuery = api.useSandboxDriveStatusQuery({ workspaceKey });\n const status = statusQuery.data?.driveStatus;\n const columns: EntityListColumn<SandboxDriveChange>[] = [\n {\n id: 'type',\n header: t('Change', { context: 'sandbox-change' }),\n width: 'content',\n cell: change => <Badge variant=\"outline\">{SANDBOX_CHANGE_LABELS[change.changeType] ? t(SANDBOX_CHANGE_LABELS[change.changeType] ?? '', { context: 'sandbox-change' }) : change.changeType}</Badge>,\n },\n {\n id: 'path',\n header: t('Path', { context: 'sandbox-change' }),\n width: '3fr',\n cell: change => (\n <span className=\"min-w-0 font-mono text-[13px]\">\n {change.previousPath && <span className=\"block truncate text-muted-foreground\">{change.previousPath} →</span>}\n <span className=\"block truncate\">{change.path}</span>\n </span>\n ),\n },\n { id: 'size', header: t('Size', { context: 'sandbox-file' }), width: 'content', align: 'end', cell: change => formatSandboxBytes(change.sizeBytes) },\n ];\n if (status && !status.isDriveWorkspace) {\n return <StatusCallout tone=\"info\" title={t('No drive in this workspace')} description={t('Its files are not synced with a drive, so nothing is pending.')} />;\n }\n return (\n <EntityListCard\n label={m('Unsaved changes', { context: 'sandbox-tab' })}\n labelContext=\"sandbox-tab\"\n toolbar={\n status ? (\n <p className=\"px-1 text-[12.5px] text-muted-foreground\">\n {t('{count, plural, one {# change not yet in the drive} other {# changes not yet in the drive}}', { count: status.pendingChangeCount })}\n {status.lastCommittedAt && (\n <>\n {' · '}\n {t('Last saved')} <DateCell value={status.lastCommittedAt} />\n </>\n )}\n </p>\n ) : undefined\n }\n >\n <EntityListBody\n displayMode=\"table\"\n columns={columns}\n items={status?.changes?.elements ?? []}\n getRowKey={change => `${change.changeType}:${change.previousPath ?? ''}:${change.path}`}\n isLoading={statusQuery.isLoading}\n emptyMessage={t('Everything is saved in the drive.')}\n loadingMessage={t('Loading the changes')}\n error={statusQuery.isError ? errorText(statusQuery.error, t('The changes could not be loaded.')) : undefined}\n />\n </EntityListCard>\n );\n};\n\nconst ProcessesTab = ({\n api,\n workspace,\n onKill,\n killDisabled,\n}: {\n api: SandboxesApi;\n workspace: SandboxWorkspace;\n onKill: (jobId: string) => void;\n killDisabled: boolean;\n}) => {\n const { t } = useTranslate();\n const processesQuery = api.useSandboxProcessesQuery({ workspaceKey: workspace.workspaceKey });\n const columns: EntityListColumn<SandboxProcess>[] = [\n { id: 'pid', header: 'PID', width: 'content', cell: process => <span className=\"font-mono text-xs\">{process.pid}</span> },\n { id: 'command', header: t('Command', { context: 'sandbox' }), width: '3fr', cell: process => <span className=\"block truncate font-mono text-xs\" title={process.command}>{process.command}</span> },\n { id: 'job', header: t('Job', { context: 'sandbox' }), width: 'content', cell: process => (process.jobId ? <span className=\"font-mono text-xs\">{process.jobId}</span> : <EmptyValue />) },\n { id: 'started', header: t('Started', { context: 'sandbox' }), width: 'content', cell: process => <DateCell value={process.startedAt} /> },\n { id: 'cpu', header: 'CPU', width: 'content', align: 'end', cell: process => formatSandboxDuration(process.cpuSeconds === null || process.cpuSeconds === undefined ? null : process.cpuSeconds * 1000) },\n { id: 'memory', header: t('Memory', { context: 'sandbox' }), width: 'content', align: 'end', cell: process => formatSandboxBytes(process.rssBytes) },\n {\n id: 'actions',\n header: <span className=\"sr-only\">{t('Actions', { context: 'table-column' })}</span>,\n width: 'content',\n pin: 'end',\n cell: process =>\n process.jobId ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"text-destructive hover:text-destructive\"\n disabled={killDisabled}\n onClick={() => process.jobId && onKill(process.jobId)}\n >\n <OctagonX />\n {t('Kill job', { context: 'sandbox-action' })}\n </Button>\n ) : null,\n },\n ];\n return (\n <EntityListCard label={m('Processes & jobs', { context: 'sandbox-tab' })} labelContext=\"sandbox-tab\">\n <EntityListBody\n displayMode=\"table\"\n columns={columns}\n items={processesQuery.data?.processes?.elements ?? []}\n getRowKey={process => String(process.pid)}\n isLoading={processesQuery.isLoading}\n emptyMessage={workspace.state === 'OFFLOADED' ? t('No session: nothing runs.') : t('Nothing is running.')}\n loadingMessage={t('Loading the processes')}\n error={processesQuery.isError ? errorText(processesQuery.error, t('The processes could not be loaded.')) : undefined}\n />\n </EntityListCard>\n );\n};\n\nconst CommandsTab = ({ api, workspaceKey }: { api: SandboxesApi; workspaceKey: string }) => {\n const { t } = useTranslate();\n const commandsQuery = api.useSandboxCommandsQuery({ workspaceKey, limit: COMMAND_LIMIT });\n const commands = commandsQuery.data?.commands?.elements ?? [];\n if (commandsQuery.isLoading) return <Skeleton className=\"h-48 w-full rounded-xl\" />;\n if (commandsQuery.isError) return <StatusCallout tone=\"destructive\" title={t('The commands could not be loaded.')} description={errorText(commandsQuery.error, '')} />;\n if (commands.length === 0) return <p className=\"py-10 text-center text-[13px] text-muted-foreground\">{t('No command ran in this session yet.')}</p>;\n return (\n <ol className=\"space-y-3\">\n {commands.map((command: SandboxCommand) => (\n <li key={command.seq} className=\"surface space-y-2 rounded-2xl p-4\">\n <div className=\"flex flex-wrap items-center gap-2 text-[12.5px]\">\n <StatusBadge value={sandboxCommandStateOf(command)} map={SANDBOX_COMMAND_STATE} />\n {sandboxCommandStateOf(command) === 'EXITED' && command.exitCode !== null && command.exitCode !== undefined && (\n <Badge variant={command.exitCode === 0 ? 'outline' : 'destructive'} className=\"font-mono\">\n {t('exit %code%', { context: 'sandbox-command', replacements: { code: String(command.exitCode) } })}\n </Badge>\n )}\n <span className=\"text-muted-foreground\">#{command.seq}</span>\n <DateCell value={command.startedAt} />\n <span className=\"text-muted-foreground\">{formatSandboxDuration(command.durationMs)}</span>\n {command.jobId && <span className=\"font-mono text-xs text-muted-foreground\">{t('job %id%', { replacements: { id: command.jobId } })}</span>}\n {command.isTruncated && <Badge variant=\"outline\">{t('Output cut', { context: 'sandbox-command' })}</Badge>}\n </div>\n <UntrustedText text={command.command} className=\"bg-card\" />\n {command.stdoutTail && (\n <details>\n <summary className=\"cursor-pointer text-xs font-semibold text-muted-foreground\">{t('Output', { context: 'sandbox-command' })}</summary>\n <UntrustedText text={command.stdoutTail} className=\"mt-1\" />\n </details>\n )}\n {command.stderrTail && (\n <details open={command.exitCode !== null && command.exitCode !== undefined && command.exitCode !== 0}>\n <summary className=\"cursor-pointer text-xs font-semibold text-destructive\">{t('Errors', { context: 'sandbox-command' })}</summary>\n <UntrustedText text={command.stderrTail} className=\"mt-1\" />\n </details>\n )}\n </li>\n ))}\n </ol>\n );\n};\n\nconst ConversationsTab = ({\n api,\n workspaceKey,\n buildConversationHref,\n}: {\n api: SandboxesApi;\n workspaceKey: string;\n buildConversationHref?: (conversation: SandboxConversation) => string | null;\n}) => {\n const { t } = useTranslate();\n const Link = useLinkComponent();\n const conversationsQuery = api.useSandboxConversationsQuery({ workspaceKey, limit: LOG_LIMIT });\n const columns: EntityListColumn<SandboxConversation>[] = [\n {\n id: 'id',\n header: t('Conversation'),\n width: 'content',\n cell: conversation => {\n const href = buildConversationHref?.(conversation) ?? null;\n return href ? (\n <Link href={href} className=\"flex items-center gap-1 font-mono text-[13px] text-primary-emphasis underline-offset-2 hover:underline\">\n <Link2 className=\"size-3.5\" />#{conversation.conversationId}\n </Link>\n ) : (\n <span className=\"font-mono text-[13px]\">#{conversation.conversationId}</span>\n );\n },\n },\n { id: 'purpose', header: t('Purpose', { context: 'sandbox-conversation' }), width: '2fr', cell: conversation => conversation.purposeName ?? <EmptyValue /> },\n { id: 'state', header: t('State', { context: 'sandbox' }), width: 'content', cell: conversation => (conversation.runState ? <Badge variant=\"outline\">{conversation.runState}</Badge> : <EmptyValue />) },\n { id: 'updated', header: t('Last change'), width: 'content', cell: conversation => <DateCell value={conversation.updatedAt} /> },\n ];\n return (\n <EntityListCard label={m('Conversations', { context: 'sandbox-tab' })} labelContext=\"sandbox-tab\">\n <EntityListBody\n displayMode=\"table\"\n columns={columns}\n items={conversationsQuery.data?.conversations?.elements ?? []}\n getRowKey={conversation => String(conversation.conversationId)}\n isLoading={conversationsQuery.isLoading}\n emptyMessage={t('No conversation used this workspace yet.')}\n loadingMessage={t('Loading the conversations')}\n error={conversationsQuery.isError ? errorText(conversationsQuery.error, t('The conversations could not be loaded.')) : undefined}\n />\n </EntityListCard>\n );\n};\n\nconst EventsTab = ({ api, workspaceKey }: { api: SandboxesApi; workspaceKey: string }) => {\n const { t } = useTranslate();\n const eventsQuery = api.useSandboxSessionEventsQuery({ workspaceKey, limit: LOG_LIMIT });\n const events = eventsQuery.data?.sessionEvents?.elements ?? [];\n if (eventsQuery.isLoading) return <Skeleton className=\"h-40 w-full rounded-xl\" />;\n if (eventsQuery.isError) return <StatusCallout tone=\"destructive\" title={t('The session log could not be loaded.')} description={errorText(eventsQuery.error, '')} />;\n if (events.length === 0) return <p className=\"py-10 text-center text-[13px] text-muted-foreground\">{t('The session log is empty.')}</p>;\n return (\n <ol className=\"surface space-y-3 rounded-2xl p-4\">\n {events.map((event, index) => {\n const Icon = sessionEventIconOf(event.type);\n return (\n <li key={`${event.occurredAt ?? ''}-${index}`} className=\"flex gap-3 text-[13px]\">\n <Icon className=\"mt-0.5 size-4 shrink-0 text-muted-foreground\" />\n <div className=\"min-w-0\">\n <p>\n <span className=\"font-mono font-semibold\">{event.type}</span> · <DateCell value={event.occurredAt} />\n </p>\n {event.detail && <p className=\"break-words text-muted-foreground\">{event.detail}</p>}\n </div>\n </li>\n );\n })}\n </ol>\n );\n};\n\nconst AuditTab = ({ api, workspaceKey }: { api: SandboxesApi; workspaceKey: string }) => {\n const { t } = useTranslate();\n const auditQuery = api.useSandboxActionLogQuery({ workspaceKey, limit: LOG_LIMIT });\n const columns: EntityListColumn<SandboxActionLogEntry>[] = [\n { id: 'time', header: t('When', { context: 'sandbox-audit' }), width: 'content', cell: entry => <DateCell value={entry.changeHistory?.createdTime ?? null} /> },\n {\n id: 'action',\n header: t('Action', { context: 'sandbox-audit' }),\n width: 'content',\n cell: entry => (\n <span>\n {entry.action === 'KILL_JOB' && entry.jobId\n ? t('Kill job %id%', { context: 'sandbox-action', replacements: { id: entry.jobId } })\n : entry.action && SANDBOX_ACTION_LABELS[entry.action]\n ? t(SANDBOX_ACTION_LABELS[entry.action] ?? '', { context: 'sandbox-action' })\n : (entry.action ?? '—')}\n </span>\n ),\n },\n { id: 'outcome', header: t('Outcome', { context: 'sandbox-audit' }), width: 'content', cell: entry => <StatusBadge value={(entry.outcome ?? null) as SandboxActionOutcome | null} map={SANDBOX_ACTION_OUTCOME} /> },\n { id: 'actor', header: t('By', { context: 'sandbox-audit' }), width: 'content', cell: entry => (entry.actorAccountId ? `#${entry.actorAccountId}` : <EmptyValue />) },\n {\n id: 'reason',\n header: t('Reason', { context: 'sandbox-force' }),\n width: '2fr',\n cell: entry => (\n <span className=\"min-w-0 text-[13px]\">\n {entry.forced && <Badge variant=\"destructive\" className=\"mr-1\">{t('Forced', { context: 'sandbox-audit' })}</Badge>}\n {entry.reason ?? (entry.forced ? '' : <EmptyValue />)}\n {entry.outcomeDetail && <span className=\"block truncate text-xs text-muted-foreground\" title={entry.outcomeDetail}>{entry.outcomeDetail}</span>}\n </span>\n ),\n },\n ];\n return (\n <EntityListCard label={m('Audit', { context: 'sandbox-tab' })} labelContext=\"sandbox-tab\">\n <EntityListBody\n displayMode=\"table\"\n columns={columns}\n items={auditQuery.data?.actionLogEntries?.elements ?? []}\n getRowKey={entry => String(entry.id ?? `${entry.action}-${entry.changeHistory?.createdTime}`)}\n isLoading={auditQuery.isLoading}\n emptyMessage={t('No action on this workspace yet.')}\n loadingMessage={t('Loading the audit')}\n error={auditQuery.isError ? errorText(auditQuery.error, t('The audit could not be loaded.')) : undefined}\n />\n </EntityListCard>\n );\n};\n\n/**\n * `loadPdfJs`, `loadCodeHighlighter`, `renderMarkdown` (the loaders of the file blocks, each optional): pdf.js for the\n * PDF preview, a highlighter for source files, and the renderer of a Markdown file. A workspace file is untrusted\n * text: the host's `renderMarkdown` uses the untrusted pipeline (`MarkdownPreview untrusted` of\n * `@mgamadeus/ddd-admin-ui/markdown`).\n */\nexport interface SandboxDetailScreenProps extends FilePreviewLoaders {\n api: SandboxesApi;\n workspaceKey: string;\n /** The open tab (controlled, e.g. from the URL); without it the screen keeps it. */\n tab?: SandboxDetailTab;\n onTabChange?: (tab: SandboxDetailTab) => void;\n /** A link back (the list), drawn left of the title. */\n backLink?: ReactNode;\n headerActions?: ReactNode;\n /** The link of a conversation in the host's agent screens; `null` = no link. */\n buildConversationHref?: (conversation: SandboxConversation) => string | null;\n}\n\n/**\n * One workspace: its facts (state, disk and memory against their limits, mount mode, runner pod, owner) and the tabs\n * Files (read only, the safe preview), Unsaved changes, Processes & jobs (kill), Commands (exit code, duration, output\n * tails), Conversations, Session log and Audit. Start, offload, end and reset (typed name) are audited and refused\n * while a turn runs on the space unless forced with a reason. Everything from the sandbox is shown as text; the one\n * exception is a Markdown file when the host passes `renderMarkdown`, whose markup is the host's renderer's.\n */\nexport const SandboxDetailScreen = ({\n api,\n workspaceKey,\n tab: controlledTab,\n onTabChange,\n backLink,\n headerActions,\n buildConversationHref,\n loadPdfJs,\n loadCodeHighlighter,\n renderMarkdown,\n}: SandboxDetailScreenProps) => {\n const { t } = useTranslate();\n const workspaceQuery = api.useSandboxQuery({ workspaceKey });\n const actions = useSandboxActions(api);\n const [ownTab, setOwnTab] = useState<SandboxDetailTab>('files');\n const tab = controlledTab ?? ownTab;\n const selectTab = (next: SandboxDetailTab) => {\n if (onTabChange) onTabChange(next);\n else setOwnTab(next);\n };\n const workspace = workspaceQuery.data?.workspace;\n\n if (workspaceQuery.isLoading) {\n return (\n <div className=\"space-y-4\">\n <Skeleton className=\"h-12 w-80\" />\n <Skeleton className=\"h-32 w-full rounded-2xl\" />\n </div>\n );\n }\n if (!workspace) {\n return (\n <div className=\"space-y-4\">\n <PageHeader title={workspaceKey} leading={backLink} />\n <StatusCallout\n tone=\"destructive\"\n title={t('This workspace was not found.')}\n description={workspaceQuery.isError ? errorText(workspaceQuery.error, t('The workspace could not be loaded.')) : undefined}\n />\n </div>\n );\n }\n\n const hasSession = workspace.state !== 'OFFLOADED';\n const busy = actions.isPending;\n return (\n <div className=\"space-y-6\">\n <PageHeader\n leading={backLink}\n title={sandboxNameOf(workspace)}\n description={<span className=\"font-mono text-xs\">{workspace.workspaceKey}</span>}\n actions={\n <div className=\"flex flex-wrap items-center gap-2\">\n {headerActions}\n <Button type=\"button\" variant=\"outline\" onClick={() => void workspaceQuery.refetch?.()} disabled={workspaceQuery.isFetching}>\n <RefreshCw className={cn(workspaceQuery.isFetching && 'animate-spin')} />\n {t('Refresh')}\n </Button>\n <Button type=\"button\" variant=\"outline\" disabled={busy} onClick={() => void actions.run({ kind: 'start', workspace })}>\n <Play />\n {hasSession ? t('Warm up session') : t('Start session', { context: 'sandbox-action' })}\n </Button>\n <Button type=\"button\" variant=\"outline\" disabled={busy || !hasSession} onClick={() => void actions.run({ kind: 'offload', workspace })}>\n <Archive />\n {t('Offload', { context: 'sandbox-action' })}\n </Button>\n <Button type=\"button\" variant=\"outline\" disabled={busy || !hasSession} onClick={() => void actions.run({ kind: 'end', workspace })}>\n <Power />\n {t('End session', { context: 'sandbox-action' })}\n </Button>\n <Button\n type=\"button\"\n variant=\"outline\"\n className=\"border-destructive/40 text-destructive hover:bg-destructive/10 hover:text-destructive\"\n disabled={busy}\n onClick={() => void actions.run({ kind: 'reset', workspace })}\n >\n <RotateCcw />\n {t('Reset workspace', { context: 'sandbox-action' })}\n </Button>\n </div>\n }\n />\n {workspace.hasLiveTurn && (\n <StatusCallout\n tone=\"warning\"\n title={t('A turn is running on this space')}\n description={t('Actions now can break the agent’s work; each asks for a reason, which is kept in the audit.')}\n />\n )}\n <Card>\n <CardContent className=\"pt-6\">\n <DefinitionList\n items={[\n { id: 'state', label: t('State', { context: 'sandbox' }), value: <StatusBadge value={workspace.state as SandboxState} map={SANDBOX_STATE} /> },\n { id: 'activity', label: t('Last activity'), value: <DateCell value={workspace.lastActivityAt} /> },\n { id: 'disk', label: t('Disk', { context: 'sandbox' }), value: <SandboxUsageBar used={workspace.diskUsedBytes} limit={workspace.diskQuotaBytes} /> },\n {\n id: 'memory',\n label: t('Memory', { context: 'sandbox' }),\n value: <SandboxUsageBar used={workspace.memoryBytes} limit={workspace.memoryLimitBytes} peak={workspace.memoryPeakBytes} />,\n },\n { id: 'mount', label: t('Mount', { context: 'sandbox' }), value: <SandboxMountMode workspace={workspace} /> },\n { id: 'pod', label: t('Runner', { context: 'sandbox' }), value: workspace.runnerPod ? <span className=\"font-mono text-xs\">{workspace.runnerPod}</span> : null },\n { id: 'owner', label: t('Owner', { context: 'sandbox' }), value: workspace.ownerDisplayName },\n { id: 'jobs', label: t('Running jobs'), value: workspace.runningJobCount ?? null },\n { id: 'conversations', label: t('Conversations'), value: workspace.conversationCount ?? null },\n ]}\n />\n </CardContent>\n </Card>\n <section className=\"space-y-4\">\n <SectionHeader\n title={t(SANDBOX_DETAIL_TABS.find(item => item.id === tab)?.label ?? '', { context: 'sandbox-tab' })}\n tabs={SANDBOX_DETAIL_TABS}\n activeTab={tab}\n onTabSelect={id => selectTab(id as SandboxDetailTab)}\n tabsLabel={t('Workspace views')}\n />\n {tab === 'files' && (\n <FilesTab\n api={api}\n workspaceKey={workspaceKey}\n loadPdfJs={loadPdfJs}\n loadCodeHighlighter={loadCodeHighlighter}\n renderMarkdown={renderMarkdown}\n />\n )}\n {tab === 'changes' && <ChangesTab api={api} workspaceKey={workspaceKey} />}\n {tab === 'processes' && (\n <ProcessesTab api={api} workspace={workspace} killDisabled={busy} onKill={jobId => void actions.run({ kind: 'kill', workspace, jobId })} />\n )}\n {tab === 'commands' && <CommandsTab api={api} workspaceKey={workspaceKey} />}\n {tab === 'conversations' && <ConversationsTab api={api} workspaceKey={workspaceKey} buildConversationHref={buildConversationHref} />}\n {tab === 'events' && <EventsTab api={api} workspaceKey={workspaceKey} />}\n {tab === 'audit' && <AuditTab api={api} workspaceKey={workspaceKey} />}\n </section>\n {actions.dialog}\n </div>\n );\n};\n","'use client';\n\nimport { normalizeDddError } from '@mgamadeus/ddd-web/contract';\nimport { Download } from 'lucide-react';\nimport { useEffect, useState } from 'react';\n\nimport {\n type CodeHighlighterLoader,\n codeLanguageOfExtension,\n CodePreview,\n extensionOf,\n MarkdownFilePreview,\n type MarkdownFileRenderer,\n PdfPreview,\n type PdfJsLoader,\n TextPreview,\n} from '@mgamadeus/ddd-admin-ui/files';\nimport { useTranslate } from '@mgamadeus/ddd-admin-ui/i18n';\nimport { notify } from '@mgamadeus/ddd-admin-ui/logic';\nimport { Button } from '@mgamadeus/ddd-admin-ui/primitives';\nimport { Skeleton } from '@mgamadeus/ddd-admin-ui/primitives';\nimport type { SandboxesApi } from '../api.ts';\nimport { formatSandboxBytes, SANDBOX_TEXT_PREVIEW_BYTES, type SandboxPreviewKind, sandboxPreviewKindOf, sandboxTextViewOf } from './format.ts';\nimport type { SandboxFileEntry } from '../types.ts';\n\nexport interface SandboxFilePreviewProps {\n api: SandboxesApi;\n workspaceKey: string;\n file: SandboxFileEntry;\n /** pdf.js of the host (without it a PDF offers its download only). */\n loadPdfJs?: PdfJsLoader;\n /** A highlighter of the host, loaded on the first source file shown (without it a source file shows plain). */\n loadCodeHighlighter?: CodeHighlighterLoader;\n /** Draws a Markdown file as markup, as untrusted text (without it a Markdown file shows its source). */\n renderMarkdown?: MarkdownFileRenderer;\n}\n\n/** Saves bytes under a name (an object URL and a link; the bytes are never opened). */\nconst saveBlob = (blob: Blob, fileName: string) => {\n const url = URL.createObjectURL(blob);\n const link = document.createElement('a');\n link.href = url;\n link.download = fileName;\n link.rel = 'noopener';\n document.body.append(link);\n link.click();\n link.remove();\n setTimeout(() => URL.revokeObjectURL(url), 10_000);\n};\n\n/**\n * A file of a workspace, read only, as untrusted content: the server picks the type from the bytes; JPEG, PNG, GIF\n * and WebP draw as `<img>`, PDF on canvases through the host's pdf.js, text as text nodes (the first 256 KB); anything\n * else only downloads. A text the server sent is drawn by the file's name: a source file with the host's highlighter\n * (its tokens as text nodes), a Markdown file through the host's renderer with a switch to its source, everything\n * else plain. The package itself never renders file content as HTML; a host's `renderMarkdown` has to treat the text\n * as untrusted.\n */\nexport const SandboxFilePreview = ({ api, workspaceKey, file, loadPdfJs, loadCodeHighlighter, renderMarkdown }: SandboxFilePreviewProps) => {\n const { t } = useTranslate();\n const [requestContent] = api.useSandboxFileContentMutation();\n const [preview, setPreview] = useState<{ url: string; kind: SandboxPreviewKind; size: number } | null>(null);\n const [failed, setFailed] = useState<string | null>(null);\n const [downloading, setDownloading] = useState(false);\n const textView = sandboxTextViewOf(file.name);\n\n useEffect(() => {\n let cancelled = false;\n let objectUrl: string | null = null;\n setPreview(null);\n setFailed(null);\n void requestContent({ workspaceKey, path: file.path, disposition: 'inline' })\n .unwrap()\n .then(content => {\n if (cancelled) return;\n objectUrl = URL.createObjectURL(content.blob);\n setPreview({ url: objectUrl, kind: sandboxPreviewKindOf(content.contentType || content.blob.type), size: content.blob.size });\n })\n .catch(error => {\n if (!cancelled) setFailed(normalizeDddError(error, t('The file could not be loaded.')).message);\n });\n return () => {\n cancelled = true;\n if (objectUrl) URL.revokeObjectURL(objectUrl);\n };\n }, [requestContent, workspaceKey, file.path, t]);\n\n const download = async () => {\n setDownloading(true);\n try {\n const content = await requestContent({ workspaceKey, path: file.path, disposition: 'attachment' }).unwrap();\n saveBlob(content.blob, content.filename ?? file.name);\n } catch (error) {\n notify.error(normalizeDddError(error, t('%name% could not be downloaded', { replacements: { name: file.name } })).message);\n } finally {\n setDownloading(false);\n }\n };\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <p className=\"min-w-0 truncate font-mono text-[13px]\" title={file.path}>\n {file.path}\n </p>\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={() => void download()} disabled={downloading}>\n <Download />\n {t('Download', { context: 'action' })}\n </Button>\n </div>\n {failed ? (\n <p className=\"text-[13px] text-muted-foreground\">{failed}</p>\n ) : !preview ? (\n <Skeleton className=\"h-48 w-full rounded-xl\" />\n ) : preview.kind === 'image' ? (\n <img src={preview.url} alt={file.name} className=\"max-h-[60vh] max-w-full rounded-lg border object-contain\" />\n ) : preview.kind === 'pdf' && loadPdfJs ? (\n <PdfPreview url={preview.url} fileName={file.name} loadPdfJs={loadPdfJs} />\n ) : preview.kind === 'text' ? (\n <>\n {textView === 'markdown' ? (\n <MarkdownFilePreview url={preview.url} fileName={file.name} renderMarkdown={renderMarkdown} loadCodeHighlighter={loadCodeHighlighter} />\n ) : textView === 'code' ? (\n <CodePreview\n url={preview.url}\n fileName={file.name}\n language={codeLanguageOfExtension(extensionOf(file.name))}\n loadCodeHighlighter={loadCodeHighlighter}\n />\n ) : (\n <TextPreview url={preview.url} fileName={file.name} />\n )}\n {preview.size >= SANDBOX_TEXT_PREVIEW_BYTES && (\n <p className=\"text-xs text-muted-foreground\">{t('Only the beginning of the file is shown; download it for the rest.')}</p>\n )}\n </>\n ) : (\n <p className=\"text-[13px] text-muted-foreground\">\n {t('No preview for this type (%size%): download it to open it.', { replacements: { size: formatSandboxBytes(file.sizeBytes ?? preview.size) } })}\n </p>\n )}\n </div>\n );\n};\n"],"mappings":";;;AACA,SAAS,SAAS,aAAa,WAAW,SAAS,OAAO,MAAM,MAAM,mBAAmB;AAEzF,SAAS,aAAa,uBAAuB;AAC7C,SAAS,sBAAsB;AAC/B,SAAS,SAAS;AAClB,SAAS,uBAAuB;AAIzB,IAAM,gBAAgB,gBAA8B;AAAA,EACzD,SAAS;AAAA,IACP,OAAO,EAAE,WAAW,EAAE,SAAS,gBAAgB,CAAC;AAAA,IAChD,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa,EAAE,gEAAgE,EAAE,SAAS,gBAAgB,CAAC;AAAA,EAC7G;AAAA,E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,IACF,GACF,GACF;AAAA,IACA,gBAAAC,MAAC,aAAQ,WAAU,aACjB;AAAA,sBAAAD;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,EAAE,oBAAoB,KAAK,UAAQ,KAAK,OAAO,GAAG,GAAG,SAAS,IAAI,EAAE,SAAS,cAAc,CAAC;AAAA,UACnG,MAAM;AAAA,UACN,WAAW;AAAA,UACX,aAAa,QAAM,UAAU,EAAsB;AAAA,UACnD,WAAW,EAAE,iBAAiB;AAAA;AAAA,MAChC;AAAA,MACC,QAAQ,WACP,gBAAAA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACF;AAAA,MAED,QAAQ,aAAa,gBAAAA,KAAC,cAAW,KAAU,cAA4B;AAAA,MACvE,QAAQ,eACP,gBAAAA,KAAC,gBAAa,KAAU,WAAsB,cAAc,MAAM,QAAQ,WAAS,KAAK,QAAQ,IAAI,EAAE,MAAM,QAAQ,WAAW,MAAM,CAAC,GAAG;AAAA,MAE1I,QAAQ,cAAc,gBAAAA,KAAC,eAAY,KAAU,cAA4B;AAAA,MACzE,QAAQ,mBAAmB,gBAAAA,KAAC,oBAAiB,KAAU,cAA4B,uBAA8C;AAAA,MACjI,QAAQ,YAAY,gBAAAA,KAAC,aAAU,KAAU,cAA4B;AAAA,MACrE,QAAQ,WAAW,gBAAAA,KAAC,YAAS,KAAU,cAA4B;AAAA,OACtE;AAAA,IACC,QAAQ;AAAA,KACX;AAEJ;","names":["normalizeDddError","Archive","Play","useState","m","useTranslate","jsx","jsxs","useTranslate","Play","Archive","useState","m","normalizeDddError","normalizeDddError","Archive","Play","Power","RefreshCw","useState","m","useTranslate","DateCell","EmptyValue","EntityListBody","EntityListCard","StatusBadge","PageHeader","StatusCallout","Badge","Button","cn","Skeleton","normalizeDddError","useState","extensionOf","useTranslate","notify","Button","jsx","jsxs","useTranslate","useState","normalizeDddError","notify","Button","extensionOf","Fragment","jsx","jsxs","m","normalizeDddError","cn","useTranslate","useState","Badge","EmptyValue","DateCell","EntityListCard","EntityListBody","StatusCallout","Button","Skeleton","StatusBadge","PageHeader","RefreshCw","Play","Archive","Power"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mgamadeus/ddd-agent-sandbox",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "React frontend of the agent sandbox for backends built with mgamadeus/ddd (Composer package mgamadeus/ddd-agent-sandbox): the RTK Query client of the sandbox admin routes and the admin screens on the blocks of @mgamadeus/ddd-admin-ui (workspaces, files with safe previews, processes, commands, session log, audit, audited actions).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ddd",
|
|
@@ -47,14 +47,14 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@mgamadeus/ddd-admin-ui": ">=0.
|
|
50
|
+
"@mgamadeus/ddd-admin-ui": ">=0.8.0 <1",
|
|
51
51
|
"@mgamadeus/ddd-web": ">=0.13.0 <1",
|
|
52
52
|
"lucide-react": ">=0.550.0 <2",
|
|
53
53
|
"react": "^19.0.0",
|
|
54
54
|
"react-dom": "^19.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@mgamadeus/ddd-admin-ui": "^0.
|
|
57
|
+
"@mgamadeus/ddd-admin-ui": "^0.8.1",
|
|
58
58
|
"@mgamadeus/ddd-web": "^0.13.0",
|
|
59
59
|
"@reduxjs/toolkit": "^2.13.0",
|
|
60
60
|
"@types/node": "^24.0.0",
|