@exagone313/dsh-podman 0.2.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +41 -0
  3. package/README.zh.md +41 -0
  4. package/cordis.patch.yml +17 -0
  5. package/dist/approval-reasons.d.ts +129 -0
  6. package/dist/approval-reasons.js +253 -0
  7. package/dist/approval-reasons.test.d.ts +1 -0
  8. package/dist/approval-reasons.test.js +115 -0
  9. package/dist/approval.d.ts +29 -0
  10. package/dist/approval.js +412 -0
  11. package/dist/approval.test.d.ts +1 -0
  12. package/dist/approval.test.js +462 -0
  13. package/dist/card-route.d.ts +15 -0
  14. package/dist/card-route.js +478 -0
  15. package/dist/card-route.test.d.ts +1 -0
  16. package/dist/card-route.test.js +181 -0
  17. package/dist/card-test-support.d.ts +15 -0
  18. package/dist/card-test-support.js +160 -0
  19. package/dist/client/ContainerCard.d.ts +6 -0
  20. package/dist/client/ContainerCard.js +79 -0
  21. package/dist/client/card-client.d.ts +6 -0
  22. package/dist/client/card-client.js +47 -0
  23. package/dist/client/card-protocol.d.ts +101 -0
  24. package/dist/client/card-protocol.js +10 -0
  25. package/dist/client/container-card-caches.d.ts +10 -0
  26. package/dist/client/container-card-caches.js +31 -0
  27. package/dist/client/container-card-controller.d.ts +107 -0
  28. package/dist/client/container-card-controller.js +207 -0
  29. package/dist/client/container-card-create-modal.d.ts +24 -0
  30. package/dist/client/container-card-create-modal.js +109 -0
  31. package/dist/client/container-card-directory-styles.d.ts +5 -0
  32. package/dist/client/container-card-directory-styles.js +246 -0
  33. package/dist/client/container-card-directory.d.ts +12 -0
  34. package/dist/client/container-card-directory.js +144 -0
  35. package/dist/client/container-card-editors.d.ts +30 -0
  36. package/dist/client/container-card-editors.js +116 -0
  37. package/dist/client/container-card-images.d.ts +37 -0
  38. package/dist/client/container-card-images.js +35 -0
  39. package/dist/client/container-card-paths.d.ts +20 -0
  40. package/dist/client/container-card-paths.js +88 -0
  41. package/dist/client/container-card-row.d.ts +30 -0
  42. package/dist/client/container-card-row.js +54 -0
  43. package/dist/client/container-card-secrets.d.ts +21 -0
  44. package/dist/client/container-card-secrets.js +71 -0
  45. package/dist/client/container-card-shared.d.ts +55 -0
  46. package/dist/client/container-card-shared.js +152 -0
  47. package/dist/client/container-card-styles.d.ts +21 -0
  48. package/dist/client/container-card-styles.js +143 -0
  49. package/dist/client/container-card-volumes.d.ts +12 -0
  50. package/dist/client/container-card-volumes.js +37 -0
  51. package/dist/client/container-card-workspace.d.ts +31 -0
  52. package/dist/client/container-card-workspace.js +24 -0
  53. package/dist/client/directory-picker.d.ts +12 -0
  54. package/dist/client/directory-picker.js +30 -0
  55. package/dist/client/index.d.ts +5 -0
  56. package/dist/client/index.js +4419 -0
  57. package/dist/client/locales.d.ts +9 -0
  58. package/dist/client/locales.js +370 -0
  59. package/dist/client/read-only-approval.d.ts +8 -0
  60. package/dist/client/read-only-approval.js +63 -0
  61. package/dist/client/slot-contract.d.ts +12 -0
  62. package/dist/client/slot-contract.js +4 -0
  63. package/dist/client/terminal-styles.d.ts +5 -0
  64. package/dist/client/terminal-styles.js +31 -0
  65. package/dist/client/tool-views.d.ts +8 -0
  66. package/dist/client/tool-views.js +241 -0
  67. package/dist/containers.test.d.ts +1 -0
  68. package/dist/containers.test.js +443 -0
  69. package/dist/daemons.test.d.ts +1 -0
  70. package/dist/daemons.test.js +153 -0
  71. package/dist/fs-provider.d.ts +23 -0
  72. package/dist/fs-provider.js +184 -0
  73. package/dist/fs-provider.test.d.ts +1 -0
  74. package/dist/fs-provider.test.js +260 -0
  75. package/dist/generated/version.d.ts +2 -0
  76. package/dist/generated/version.js +6 -0
  77. package/dist/grpc/proto/dshctl/v1/control.proto +133 -0
  78. package/dist/grpc/proto/dshguest/v1/guest.proto +79 -0
  79. package/dist/grpc/runtime-client.d.ts +5 -0
  80. package/dist/grpc/runtime-client.js +43 -0
  81. package/dist/guest-rpc.d.ts +62 -0
  82. package/dist/guest-rpc.js +391 -0
  83. package/dist/images.test.d.ts +1 -0
  84. package/dist/images.test.js +79 -0
  85. package/dist/index.d.ts +22 -0
  86. package/dist/index.js +140 -0
  87. package/dist/misc.test.d.ts +1 -0
  88. package/dist/misc.test.js +141 -0
  89. package/dist/mount-enums.d.ts +22 -0
  90. package/dist/mount-enums.js +81 -0
  91. package/dist/mount-input.d.ts +14 -0
  92. package/dist/mount-input.js +64 -0
  93. package/dist/mounts.test.d.ts +1 -0
  94. package/dist/mounts.test.js +408 -0
  95. package/dist/output-reader.d.ts +34 -0
  96. package/dist/output-reader.js +87 -0
  97. package/dist/paths.test.d.ts +1 -0
  98. package/dist/paths.test.js +74 -0
  99. package/dist/preferences.d.ts +6 -0
  100. package/dist/preferences.js +27 -0
  101. package/dist/project-path.d.ts +6 -0
  102. package/dist/project-path.js +73 -0
  103. package/dist/project-path.test.d.ts +1 -0
  104. package/dist/project-path.test.js +52 -0
  105. package/dist/prompts.d.ts +13 -0
  106. package/dist/prompts.js +149 -0
  107. package/dist/public.d.ts +4 -0
  108. package/dist/public.js +63 -0
  109. package/dist/read-only-shell.d.ts +14 -0
  110. package/dist/read-only-shell.js +150 -0
  111. package/dist/read-only-shell.test.d.ts +1 -0
  112. package/dist/read-only-shell.test.js +127 -0
  113. package/dist/secrets.test.d.ts +1 -0
  114. package/dist/secrets.test.js +181 -0
  115. package/dist/settings-commands.test.d.ts +1 -0
  116. package/dist/settings-commands.test.js +549 -0
  117. package/dist/settings-create.test.d.ts +1 -0
  118. package/dist/settings-create.test.js +394 -0
  119. package/dist/settings-mounts.test.d.ts +1 -0
  120. package/dist/settings-mounts.test.js +467 -0
  121. package/dist/settings-paths.test.d.ts +1 -0
  122. package/dist/settings-paths.test.js +65 -0
  123. package/dist/settings-schema.d.ts +14 -0
  124. package/dist/settings-schema.js +14 -0
  125. package/dist/settings-workspaces.test.d.ts +1 -0
  126. package/dist/settings-workspaces.test.js +265 -0
  127. package/dist/spill-store.d.ts +17 -0
  128. package/dist/spill-store.js +54 -0
  129. package/dist/spill-store.test.d.ts +1 -0
  130. package/dist/spill-store.test.js +59 -0
  131. package/dist/subprocess.d.ts +9 -0
  132. package/dist/subprocess.js +369 -0
  133. package/dist/subprocess.test.d.ts +1 -0
  134. package/dist/subprocess.test.js +234 -0
  135. package/dist/test-support.d.ts +328 -0
  136. package/dist/test-support.js +437 -0
  137. package/dist/tool-defs.d.ts +26 -0
  138. package/dist/tool-defs.js +188 -0
  139. package/dist/tool-handlers.d.ts +2 -0
  140. package/dist/tool-handlers.js +546 -0
  141. package/dist/tool-params.d.ts +803 -0
  142. package/dist/tool-params.js +494 -0
  143. package/dist/tool-schemas.d.ts +2 -0
  144. package/dist/tool-schemas.js +5 -0
  145. package/dist/tool-views.d.ts +2 -0
  146. package/dist/tool-views.js +56 -0
  147. package/dist/views.test.d.ts +1 -0
  148. package/dist/views.test.js +23 -0
  149. package/dist/volumes.test.d.ts +1 -0
  150. package/dist/volumes.test.js +40 -0
  151. package/dist/workspace-binding.d.ts +40 -0
  152. package/dist/workspace-binding.js +275 -0
  153. package/dist/workspace-binding.test.d.ts +1 -0
  154. package/dist/workspace-binding.test.js +337 -0
  155. package/docs/architecture.md +173 -0
  156. package/docs/architecture.zh.md +129 -0
  157. package/docs/configuration.md +160 -0
  158. package/docs/configuration.zh.md +147 -0
  159. package/docs/development.md +142 -0
  160. package/docs/development.zh.md +135 -0
  161. package/docs/install-dsh-and-dsh-podman.md +165 -0
  162. package/docs/install-dsh-and-dsh-podman.zh.md +145 -0
  163. package/docs/usage.md +393 -0
  164. package/docs/usage.zh.md +315 -0
  165. package/package.json +119 -0
@@ -0,0 +1,144 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DIRECTORY_CLASS } from "./container-card-directory-styles.js";
3
+ import { confineToRoot, crumbLabel, rootCrumbs, } from "../project-path.js";
4
+ import { Button, IconCheckOutline16, IconChevronRightOutline14, IconFolderClose16, IconFolderOpen16, Modal, } from "@deepseek-ai/dsh-client-ui-primitives";
5
+ import { useEffect, useRef, useState } from "react";
6
+ // How long a listing may take before the browser admits it is still loading.
7
+ const SLOW_SCAN_DELAY_MS = 300;
8
+ // The directory browser a project mount path is chosen with. Its layout mirrors
9
+ // dsh's own directory browser — a 680x500 dialog with two Miller columns,
10
+ // chevron breadcrumbs and 28px folder rows — and it lists through the harness's
11
+ // own host-side picker, never a container or the orchestrator. It is confined
12
+ // to the projects root: the breadcrumb trail starts there, the browser never
13
+ // navigates above it, and so it can only ever produce a path a project mount
14
+ // accepts.
15
+ export function DirectoryPickerModal(props) {
16
+ const { t, open, root, start, picker, onSelect, onClose } = props;
17
+ const [path, setPath] = useState(() => confineToRoot(root, start));
18
+ const [level, setLevel] = useState(undefined);
19
+ const [selected, setSelected] = useState(null);
20
+ const [child, setChild] = useState(undefined);
21
+ const [showHidden, setShowHidden] = useState(false);
22
+ const [error, setError] = useState("");
23
+ const [busy, setBusy] = useState(false);
24
+ const [slow, setSlow] = useState(false);
25
+ // The locale binding is read through a ref so a new function identity per
26
+ // render cannot restart a listing.
27
+ const tRef = useRef(t);
28
+ tRef.current = t;
29
+ const trailRef = useRef(null);
30
+ // Every open starts at the field's value (clamped to the projects root).
31
+ useEffect(() => {
32
+ if (!open)
33
+ return;
34
+ setPath(confineToRoot(root, start));
35
+ setSelected(null);
36
+ setShowHidden(false);
37
+ }, [open, root, start]);
38
+ useEffect(() => {
39
+ if (!open)
40
+ return;
41
+ const controller = new AbortController();
42
+ let cancelled = false;
43
+ setBusy(true);
44
+ setSlow(false);
45
+ const timer = setTimeout(() => {
46
+ if (!cancelled)
47
+ setSlow(true);
48
+ }, SLOW_SCAN_DELAY_MS);
49
+ picker
50
+ .list(path, controller.signal)
51
+ .then((listing) => {
52
+ if (cancelled)
53
+ return;
54
+ setLevel(toLevel(listing));
55
+ setError("");
56
+ })
57
+ .catch((failure) => {
58
+ if (cancelled)
59
+ return;
60
+ const code = failure?.code;
61
+ setLevel(undefined);
62
+ setError(code === "directory-picker/unavailable"
63
+ ? tRef.current("browseUnavailable")
64
+ : tRef.current("browseError"));
65
+ })
66
+ .finally(() => {
67
+ if (cancelled)
68
+ return;
69
+ clearTimeout(timer);
70
+ setSlow(false);
71
+ setBusy(false);
72
+ });
73
+ return () => {
74
+ cancelled = true;
75
+ clearTimeout(timer);
76
+ controller.abort();
77
+ };
78
+ }, [open, path, picker]);
79
+ useEffect(() => {
80
+ if (!open || selected === null) {
81
+ setChild(undefined);
82
+ return;
83
+ }
84
+ const controller = new AbortController();
85
+ let cancelled = false;
86
+ setBusy(true);
87
+ picker
88
+ .list(selected.path, controller.signal)
89
+ .then((listing) => {
90
+ if (!cancelled)
91
+ setChild(toLevel(listing));
92
+ })
93
+ .catch(() => {
94
+ if (!cancelled)
95
+ setChild(undefined);
96
+ })
97
+ .finally(() => {
98
+ if (!cancelled)
99
+ setBusy(false);
100
+ });
101
+ return () => {
102
+ cancelled = true;
103
+ controller.abort();
104
+ };
105
+ }, [open, selected, picker]);
106
+ // Selecting previews the directory; the right pane lists its children.
107
+ const select = (entry) => {
108
+ setSelected(entry);
109
+ };
110
+ // A click in the preview pane descends one level, exactly like the built-in
111
+ // browser: the previewed directory becomes the listed level and the clicked
112
+ // entry becomes the new selection.
113
+ const advance = (entry) => {
114
+ if (selected !== null)
115
+ setPath(selected.path);
116
+ setSelected(entry);
117
+ };
118
+ const navigate = (target) => {
119
+ setPath(confineToRoot(root, target));
120
+ setSelected(null);
121
+ };
122
+ // Keep the deepest crumb in view, like the built-in browser.
123
+ useEffect(() => {
124
+ const trail = trailRef.current;
125
+ if (trail !== null)
126
+ trail.scrollLeft = trail.scrollWidth;
127
+ }, [path, open]);
128
+ const crumbs = rootCrumbs(root, path);
129
+ const visible = (entries) => entries.filter((entry) => showHidden || !entry.hidden);
130
+ const truncated = level?.truncated === true || child?.truncated === true;
131
+ return (_jsx(Modal, { open: open, onClose: onClose, title: t("browseTitle"), className: DIRECTORY_CLASS, headless: true, children: _jsxs("div", { className: "dsh-podman-directory-scope", children: [_jsxs("div", { className: "dsh-podman-directory-header", children: [_jsx("h2", { className: "dsh-podman-directory-title", children: t("browseTitle") }), _jsx("div", { className: "dsh-podman-directory-crumbbar", children: _jsxs("nav", { ref: trailRef, className: "dsh-podman-directory-crumbs", "aria-label": t("browseTitle"), children: [_jsx("span", { className: "dsh-podman-directory-crumbseat", children: _jsx("button", { type: "button", className: "dsh-podman-directory-crumb", disabled: busy, onClick: () => navigate(root), children: crumbLabel(root) }) }), crumbs.map((crumb) => (_jsxs("span", { className: "dsh-podman-directory-crumbseat", children: [_jsx(IconChevronRightOutline14, { size: 12, className: "dsh-podman-directory-crumbchevron" }), _jsx("button", { type: "button", className: "dsh-podman-directory-crumb", disabled: busy, onClick: () => navigate(crumb), children: crumbLabel(crumb) })] }, crumb)))] }) })] }), _jsxs("div", { className: "dsh-podman-directory-content", children: [_jsxs("div", { className: "dsh-podman-directory-miller", children: [_jsx("ul", { className: "dsh-podman-directory-column", children: (level?.entries ?? []).length === 0 ? null : (visible(level?.entries ?? []).map((entry) => (_jsx(DirectoryRow, { entry: entry, selected: selected?.path === entry.path, busy: busy, onPick: select }, entry.path)))) }), selected === null ? null : (_jsxs(_Fragment, { children: [_jsx("span", { className: "dsh-podman-directory-divider" }), _jsx("ul", { className: "dsh-podman-directory-column", children: visible(child?.entries ?? []).map((entry) => (_jsx(DirectoryRow, { entry: entry, selected: false, busy: busy, onPick: advance }, entry.path))) })] }))] }), error === "" ? null : (_jsx("p", { className: "dsh-podman-directory-error", role: "alert", children: error })), error === "" && truncated ? (_jsx("p", { className: "dsh-podman-directory-status", role: "status", children: t("browseTruncated") })) : null, slow ? (_jsx("span", { className: "dsh-podman-directory-loading", role: "status", children: t("browseLoading") })) : null] }), _jsxs("div", { className: "dsh-podman-directory-footer", children: [_jsxs("button", { type: "button", className: "dsh-podman-directory-toggle", "aria-pressed": showHidden, disabled: busy, onClick: () => setShowHidden((previous) => !previous), children: [t("browseHidden"), showHidden ? _jsx(IconCheckOutline16, { size: 14 }) : null] }), _jsx("span", { className: "dsh-podman-directory-gap" }), _jsx(Button, { variant: "outline", className: "dsh-podman-directory-action", disabled: busy, onClick: onClose, children: t("cancel") }), _jsx(Button, { variant: "primary", className: "dsh-podman-directory-action", disabled: busy || error !== "", onClick: () => onSelect(selected?.path ?? path), children: t("browseSelect") })] })] }) }));
132
+ }
133
+ function DirectoryRow(props) {
134
+ const { entry, selected, busy, onPick } = props;
135
+ return (_jsx("li", { className: "dsh-podman-directory-seat", children: _jsxs("button", { type: "button", className: selected
136
+ ? "dsh-podman-directory-row dsh-podman-directory-row-selected"
137
+ : "dsh-podman-directory-row", "aria-current": selected ? true : undefined, disabled: busy, onClick: () => onPick(entry), children: [selected ? (_jsx(IconFolderOpen16, { size: 16, className: "dsh-podman-directory-rowicon-selected" })) : (_jsx(IconFolderClose16, { size: 16, className: "dsh-podman-directory-rowicon" })), _jsx("span", { className: "dsh-podman-directory-rowname", children: entry.name }), _jsx(IconChevronRightOutline14, { size: 12, className: "dsh-podman-directory-rowchevron" })] }) }));
138
+ }
139
+ function toLevel(listing) {
140
+ return {
141
+ entries: listing.entries ?? [],
142
+ truncated: listing.truncated === true,
143
+ };
144
+ }
@@ -0,0 +1,30 @@
1
+ import { type MountInput } from "./container-card-controller.js";
2
+ import { type DirectoryPickerFace } from "./directory-picker.js";
3
+ import { type ContainerPluginKey } from "./locales.js";
4
+ import { type ReactNode } from "react";
5
+ export declare function EnvEditor(props: {
6
+ t: (key: ContainerPluginKey) => string;
7
+ env: Record<string, string>;
8
+ busy: boolean;
9
+ onChange: (env: Record<string, string>) => void;
10
+ }): ReactNode;
11
+ export declare function MountsEditor(props: {
12
+ t: (key: ContainerPluginKey) => string;
13
+ mounts: readonly MountInput[];
14
+ volumes: readonly {
15
+ name: string;
16
+ }[];
17
+ secrets: readonly {
18
+ name: string;
19
+ }[];
20
+ busy: boolean;
21
+ enabled: boolean;
22
+ projectsRoot: string;
23
+ directoryPicker?: DirectoryPickerFace;
24
+ confirmRemove?: boolean;
25
+ modeControl?: "remount" | "select";
26
+ primaryProject?: string;
27
+ onAdd: (mount: MountInput) => void;
28
+ onRemove: (mount: MountInput) => void;
29
+ onUpdate?: (mount: MountInput, index: number) => void;
30
+ }): ReactNode;
@@ -0,0 +1,116 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // SPDX-FileCopyrightText: 2026 Elouan Martinet <exa@elou.world>
3
+ //
4
+ // SPDX-License-Identifier: MIT
5
+ import { ConfirmButton, Field, emptyMount, mountLabel } from "./container-card-shared.js";
6
+ import { greyId, imageSelect } from "./container-card-styles.js";
7
+ import { DirectoryPickerModal } from "./container-card-directory.js";
8
+ import { forcedMountMode } from "../mount-enums.js";
9
+ import { hostPathForProjectName, projectNameFromHostPath } from "../project-path.js";
10
+ import { Button, Input, Modal } from "@deepseek-ai/dsh-client-ui-primitives";
11
+ import { useId, useState } from "react";
12
+ export function EnvEditor(props) {
13
+ const { t, env, busy, onChange } = props;
14
+ const entries = Object.entries(env);
15
+ const updateKey = (oldKey, key, value) => {
16
+ const next = {};
17
+ for (const [k, v] of entries) {
18
+ if (k !== oldKey)
19
+ next[k] = v;
20
+ }
21
+ next[key] = value;
22
+ onChange(next);
23
+ };
24
+ const updateValue = (key, value) => {
25
+ onChange({ ...env, [key]: value });
26
+ };
27
+ const remove = (key) => {
28
+ const next = { ...env };
29
+ delete next[key];
30
+ onChange(next);
31
+ };
32
+ const add = () => {
33
+ onChange({ ...env, "": "" });
34
+ };
35
+ return (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [entries.map(([key, value]) => (_jsxs("div", { style: {
36
+ display: "flex",
37
+ flexWrap: "wrap",
38
+ alignItems: "center",
39
+ gap: "8px",
40
+ }, children: [_jsx(Input, { value: key, disabled: busy, placeholder: t("envKey"), "aria-label": t("envKey"), onChange: (event) => updateKey(key, event.target.value, value), style: { width: "160px" } }), _jsx(Input, { value: value, disabled: busy, placeholder: t("envValue"), "aria-label": t("envValue"), onChange: (event) => updateValue(key, event.target.value), style: { width: "200px" } }), _jsx(Button, { variant: "outline", size: "sm", disabled: busy, onClick: () => remove(key), children: t("removeEnv") })] }, key))), _jsx("div", { children: _jsx(Button, { variant: "outline", size: "sm", disabled: busy, onClick: add, children: t("addEnv") }) })] }));
41
+ }
42
+ export function MountsEditor(props) {
43
+ const { t, mounts, volumes, secrets, busy, enabled, projectsRoot, directoryPicker, confirmRemove, modeControl = "remount", primaryProject = "", onAdd, onRemove, onUpdate, } = props;
44
+ const [adding, setAdding] = useState(false);
45
+ const [browsing, setBrowsing] = useState(false);
46
+ const [browseError, setBrowseError] = useState("");
47
+ const [draft, setDraft] = useState(emptyMount());
48
+ const mountKindId = useId();
49
+ const mountProjectId = useId();
50
+ const mountDestinationId = useId();
51
+ const mountModeId = useId();
52
+ const mountVolumeId = useId();
53
+ const mountSecretId = useId();
54
+ const updateDraft = (patch) => {
55
+ setDraft((prev) => ({ ...prev, ...patch }));
56
+ };
57
+ const canAdd = draft.kind === "project"
58
+ ? draft.project.trim() !== ""
59
+ : draft.kind === "volume"
60
+ ? draft.volume !== ""
61
+ : draft.kind === "secret"
62
+ ? draft.secret !== ""
63
+ : true;
64
+ const openAdd = () => {
65
+ setDraft(emptyMount());
66
+ setBrowseError("");
67
+ setAdding(true);
68
+ };
69
+ const submit = () => {
70
+ if (!canAdd)
71
+ return;
72
+ onAdd(draft);
73
+ setAdding(false);
74
+ };
75
+ const kindField = draft.kind === "tmpfs" ? (_jsx(Field, { label: t("mountDestination"), htmlFor: mountDestinationId, children: _jsx(Input, { id: mountDestinationId, value: draft.destination, disabled: busy, onChange: (event) => updateDraft({ destination: event.target.value }) }) })) : draft.kind === "volume" ? (_jsxs(_Fragment, { children: [_jsx(Field, { label: t("mountVolume"), htmlFor: mountVolumeId, children: _jsxs("select", { id: mountVolumeId, style: imageSelect, value: draft.volume, disabled: busy, onChange: (event) => updateDraft({ volume: event.target.value }), children: [volumes.length === 0 ? (_jsx("option", { value: "", children: t("none") })) : null, volumes.map((volume) => (_jsx("option", { value: volume.name, children: volume.name }, volume.name)))] }) }), _jsx(Field, { label: t("mountDestination"), htmlFor: mountDestinationId, children: _jsx(Input, { id: mountDestinationId, value: draft.destination, disabled: busy, onChange: (event) => updateDraft({ destination: event.target.value }) }) }), _jsx(Field, { label: t("mountMode"), htmlFor: mountModeId, children: _jsxs("select", { id: mountModeId, style: imageSelect, value: draft.mode, disabled: busy, onChange: (event) => updateDraft({ mode: event.target.value }), children: [_jsx("option", { value: "read_only", children: t("readOnly") }), _jsx("option", { value: "read_write", children: t("readWrite") })] }) })] })) : draft.kind === "secret" ? (_jsxs(_Fragment, { children: [_jsx(Field, { label: t("mountSecret"), htmlFor: mountSecretId, children: _jsxs("select", { id: mountSecretId, style: imageSelect, value: draft.secret, disabled: busy, onChange: (event) => updateDraft({ secret: event.target.value }), children: [secrets.length === 0 ? (_jsx("option", { value: "", children: t("none") })) : null, secrets.map((secret) => (_jsx("option", { value: secret.name, children: secret.name }, secret.name)))] }) }), _jsx(Field, { label: t("mountDestination"), htmlFor: mountDestinationId, children: _jsx(Input, { id: mountDestinationId, value: draft.destination, disabled: busy, onChange: (event) => updateDraft({ destination: event.target.value }) }) })] })) : (_jsxs(_Fragment, { children: [_jsx(Field, { label: t("mountProjectPath"), htmlFor: mountProjectId, children: _jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [_jsx(Input, { id: mountProjectId, value: draft.project, disabled: busy, onChange: (event) => updateDraft({ project: event.target.value }) }), directoryPicker !== undefined ? (_jsx(Button, { variant: "outline", size: "sm", disabled: busy, onClick: () => {
76
+ setBrowseError("");
77
+ setBrowsing(true);
78
+ }, children: t("browse") })) : null] }) }), browseError === "" ? null : (_jsx("p", { style: { margin: 0, fontSize: "13px" }, role: "alert", children: browseError })), _jsx(Field, { label: t("mountMode"), htmlFor: mountModeId, children: _jsxs("select", { id: mountModeId, style: imageSelect, value: draft.mode, disabled: busy, onChange: (event) => updateDraft({ mode: event.target.value }), children: [_jsx("option", { value: "read_only", children: t("readOnly") }), _jsx("option", { value: "read_write", children: t("readWrite") })] }) })] }));
79
+ return (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [mounts.map((mount, index) => {
80
+ const nextMode = mount.mode === "read_write" ? "read_only" : "read_write";
81
+ const forced = forcedMountMode(mount.kind);
82
+ const editable = mount.kind === "project" || mount.kind === "volume";
83
+ const removable = mount.kind !== "project" ||
84
+ primaryProject === "" ||
85
+ mount.project !== primaryProject;
86
+ return (_jsxs("div", { style: {
87
+ display: "flex",
88
+ flexWrap: "wrap",
89
+ alignItems: "center",
90
+ gap: "8px",
91
+ }, children: [_jsx("code", { style: {
92
+ ...greyId,
93
+ flex: 1,
94
+ fontSize: "13px",
95
+ color: "var(--dsw-alias-label-primary)",
96
+ }, children: mountLabel(t, mount, modeControl !== "select") }), modeControl === "select" && (editable || forced !== undefined) ? (_jsx("select", { style: imageSelect, value: forced ?? mount.mode, disabled: !enabled || forced !== undefined, "aria-label": t("mountMode"), onChange: (event) => onUpdate?.({ ...mount, mode: event.target.value }, index), children: forced !== undefined ? (_jsx("option", { value: forced, children: forced === "read_write" ? t("readWrite") : t("readOnly") })) : (_jsxs(_Fragment, { children: [_jsx("option", { value: "read_only", children: t("readOnly") }), _jsx("option", { value: "read_write", children: t("readWrite") })] })) })) : null, modeControl === "remount" && editable && onUpdate !== undefined && (_jsx(ConfirmButton, { t: t, label: nextMode === "read_only"
97
+ ? t("remountReadOnly")
98
+ : t("remountReadWrite"), title: t("confirmTitle"), description: nextMode === "read_only"
99
+ ? t("confirmRemountReadOnly")
100
+ : t("confirmRemountReadWrite"), disabled: !enabled, onConfirm: () => onUpdate({ ...mount, mode: nextMode }, index) })), removable &&
101
+ (confirmRemove ? (_jsx(ConfirmButton, { t: t, label: t("remove"), title: t("confirmTitle"), description: t("confirmRemoveMount"), disabled: !enabled, onConfirm: () => onRemove(mount) })) : (_jsx(Button, { variant: "outline", size: "sm", disabled: !enabled, onClick: () => onRemove(mount), children: t("remove") })))] }, mountLabel(t, mount)));
102
+ }), _jsx("div", { children: _jsx(Button, { variant: "outline", size: "sm", disabled: !enabled, onClick: openAdd, children: t("addMount") }) }), _jsx(Modal, { open: adding, onClose: () => setAdding(false), title: t("addMount"), closeLabel: t("cancel"), footer: _jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", size: "sm", onClick: () => setAdding(false), children: t("cancel") }), _jsx(Button, { variant: "primary", size: "sm", disabled: busy || !canAdd, onClick: submit, children: t("addMount") })] }), children: _jsxs("div", { style: {
103
+ display: "flex",
104
+ flexDirection: "column",
105
+ gap: "12px",
106
+ }, children: [_jsx(Field, { label: t("mountKind"), htmlFor: mountKindId, children: _jsxs("select", { id: mountKindId, style: imageSelect, value: draft.kind, disabled: busy, onChange: (event) => setDraft(emptyMount(event.target.value)), children: [_jsx("option", { value: "project", children: t("mountProject") }), _jsx("option", { value: "tmpfs", children: "tmpfs" }), _jsx("option", { value: "volume", children: t("mountVolume") }), _jsx("option", { value: "secret", children: t("mountSecret") })] }) }), kindField] }) }), directoryPicker === undefined ? null : (_jsx(DirectoryPickerModal, { t: t, open: browsing, root: projectsRoot, start: hostPathForProjectName(projectsRoot, draft.project), picker: directoryPicker, onSelect: (path) => {
107
+ const project = projectNameFromHostPath(projectsRoot, path);
108
+ if (project === undefined) {
109
+ setBrowseError(t("browseOutsideRoot"));
110
+ return;
111
+ }
112
+ updateDraft({ project });
113
+ setBrowseError("");
114
+ setBrowsing(false);
115
+ }, onClose: () => setBrowsing(false) }))] }));
116
+ }
@@ -0,0 +1,37 @@
1
+ import { type ImageView } from "./container-card-controller.js";
2
+ import { type ContainerPluginKey } from "./locales.js";
3
+ import { type ReactNode } from "react";
4
+ export declare function ImageItem(props: {
5
+ t: (key: ContainerPluginKey) => string;
6
+ image: ImageView;
7
+ busy: boolean;
8
+ defaultImage: string;
9
+ onRemove: (imageId: string) => void;
10
+ onRebuild: (imageId: string) => void;
11
+ onSetDefault: (imageId: string) => void;
12
+ }): ReactNode;
13
+ export declare function BaseImageRow(props: {
14
+ t: (key: ContainerPluginKey) => string;
15
+ image: ImageView;
16
+ busy: boolean;
17
+ defaultImage: string;
18
+ onRebuild: (name: string) => void;
19
+ onPull: (name: string) => void;
20
+ onSetDefault: (imageId: string) => void;
21
+ }): ReactNode;
22
+ export declare function ImageBuildModal(props: {
23
+ t: (key: ContainerPluginKey) => string;
24
+ images: readonly {
25
+ imageId: string;
26
+ isBase: boolean;
27
+ }[];
28
+ open: boolean;
29
+ imageId: string;
30
+ parent: string;
31
+ packages: readonly string[];
32
+ onImageId: (value: string) => void;
33
+ onParent: (value: string) => void;
34
+ onPackages: (tags: string[]) => void;
35
+ onClose: () => void;
36
+ onBuild: () => void;
37
+ }): ReactNode;
@@ -0,0 +1,35 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // SPDX-FileCopyrightText: 2026 Elouan Martinet <exa@elou.world>
3
+ //
4
+ // SPDX-License-Identifier: MIT
5
+ import { Chip, ConfirmButton, Field, TagInput, imageIdPattern, sanitizeImageId, } from "./container-card-shared.js";
6
+ import { actions, hint, imageSelect, tableStyle, tdStyle, thStyle, wsBody, } from "./container-card-styles.js";
7
+ import { Button, DisclosureRow, Input, Modal } from "@deepseek-ai/dsh-client-ui-primitives";
8
+ import { useId, useState } from "react";
9
+ export function ImageItem(props) {
10
+ const { t, image, busy, defaultImage, onRemove, onRebuild, onSetDefault } = props;
11
+ const [open, setOpen] = useState(false);
12
+ return (_jsx(DisclosureRow, { icon: _jsx("span", {}), title: image.imageId, open: open, expandable: true, onToggle: () => setOpen(!open), children: _jsxs("div", { style: wsBody, children: [_jsx("table", { style: tableStyle, children: _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("th", { style: thStyle, scope: "row", children: t("parent") }), _jsx("td", { style: tdStyle, children: image.parent })] }), _jsxs("tr", { children: [_jsx("th", { style: thStyle, scope: "row", children: t("imageTag") }), _jsx("td", { style: tdStyle, children: image.imageTag })] }), _jsxs("tr", { children: [_jsx("th", { style: thStyle, scope: "row", children: t("builtAt") }), _jsx("td", { style: tdStyle, children: image.builtAt })] }), _jsxs("tr", { children: [_jsx("th", { style: thStyle, scope: "row", children: t("packages") }), _jsx("td", { style: tdStyle, children: image.packages.length === 0 ? (t("none")) : (_jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "6px" }, children: image.packages.map((pkg) => (_jsx(Chip, { t: t, label: pkg }, pkg))) })) })] })] }) }), _jsxs("div", { style: actions, children: [_jsx(ConfirmButton, { t: t, label: t("rebuildImage"), title: t("confirmTitle"), description: t("confirmRebuildImage"), disabled: busy, onConfirm: () => onRebuild(image.imageId) }), _jsx(ConfirmButton, { t: t, label: t("removeImage"), title: t("confirmTitle"), description: t("confirmRemoveImage"), disabled: busy, onConfirm: () => onRemove(image.imageId) }), _jsx(Button, { variant: "outline", size: "sm", disabled: busy || image.imageId === defaultImage, onClick: () => onSetDefault(image.imageId), children: t("setDefaultImage") })] })] }) }));
13
+ }
14
+ export function BaseImageRow(props) {
15
+ const { t, image, busy, defaultImage, onRebuild, onPull, onSetDefault } = props;
16
+ const [open, setOpen] = useState(false);
17
+ const pull = image.basePublic && (image.status === "missing" || image.status === "pulled");
18
+ const build = !image.basePublic && image.status === "missing";
19
+ const rebuild = !image.basePublic && image.status === "built";
20
+ return (_jsx(DisclosureRow, { icon: _jsx("span", {}), title: image.imageId, open: open, expandable: true, onToggle: () => setOpen(!open), children: _jsxs("div", { style: wsBody, children: [_jsx("table", { style: tableStyle, children: _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("th", { style: thStyle, scope: "row", children: t("primitive") }), _jsx("td", { style: tdStyle, children: image.primitive })] }), _jsxs("tr", { children: [_jsx("th", { style: thStyle, scope: "row", children: t("packageManager") }), _jsx("td", { style: tdStyle, children: image.packageManager })] }), _jsxs("tr", { children: [_jsx("th", { style: thStyle, scope: "row", children: t("status") }), _jsx("td", { style: tdStyle, children: image.status })] }), _jsxs("tr", { children: [_jsx("th", { style: thStyle, scope: "row", children: t("builtAt") }), _jsx("td", { style: tdStyle, children: image.builtAt === "" ? t("none") : image.builtAt })] }), _jsxs("tr", { children: [_jsx("th", { style: thStyle, scope: "row", children: t("packages") }), _jsx("td", { style: tdStyle, children: image.packages.length === 0 ? (t("none")) : (_jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "6px" }, children: image.packages.map((pkg) => (_jsx(Chip, { t: t, label: pkg }, pkg))) })) })] })] }) }), _jsxs("div", { style: actions, children: [pull ? (_jsx(Button, { variant: "outline", size: "sm", disabled: busy, onClick: () => onPull(image.imageId), children: t("pullImage") })) : null, build ? (_jsx(Button, { variant: "outline", size: "sm", disabled: busy, onClick: () => onRebuild(image.imageId), children: t("build") })) : null, rebuild ? (_jsx(Button, { variant: "outline", size: "sm", disabled: busy, onClick: () => onRebuild(image.imageId), children: t("rebuildImage") })) : null, _jsx(Button, { variant: "outline", size: "sm", disabled: busy || image.imageId === defaultImage, onClick: () => onSetDefault(image.imageId), children: t("setDefaultImage") })] })] }) }));
21
+ }
22
+ export function ImageBuildModal(props) {
23
+ const { t, images, open, imageId, parent, packages, onImageId, onParent, onPackages, onClose, onBuild, } = props;
24
+ const canBuild = imageIdPattern.test(imageId) && parent.trim() !== "";
25
+ const imageIdLabel = useId();
26
+ const parentLabel = useId();
27
+ const packagesLabel = useId();
28
+ const baseImages = images.filter((image) => image.isBase);
29
+ const customImages = images.filter((image) => !image.isBase);
30
+ return (_jsx(Modal, { open: open, onClose: onClose, title: t("buildImageTitle"), closeLabel: t("cancel"), footer: _jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", size: "sm", onClick: onClose, children: t("cancel") }), _jsx(Button, { variant: "primary", size: "sm", disabled: !canBuild, onClick: onBuild, children: t("buildImage") })] }), children: _jsxs("div", { style: {
31
+ display: "flex",
32
+ flexDirection: "column",
33
+ gap: "12px",
34
+ }, children: [_jsxs(Field, { label: t("imageId"), htmlFor: imageIdLabel, children: [_jsx(Input, { id: imageIdLabel, value: imageId, onChange: (event) => onImageId(sanitizeImageId(event.target.value)) }), imageId !== "" && !imageIdPattern.test(imageId) ? (_jsx("p", { style: { ...hint, margin: 0 }, children: t("invalidImageId") })) : null] }), _jsx(Field, { label: t("parent"), htmlFor: parentLabel, children: _jsxs("select", { id: parentLabel, style: imageSelect, value: parent, onChange: (event) => onParent(event.target.value), children: [_jsx("option", { value: "", children: t("selectImage") }), baseImages.map((image) => (_jsx("option", { value: image.imageId, children: image.imageId }, image.imageId))), customImages.map((image) => (_jsx("option", { value: image.imageId, children: image.imageId }, image.imageId)))] }) }), _jsx(Field, { label: t("packages"), htmlFor: packagesLabel, children: _jsx(TagInput, { id: packagesLabel, t: t, value: packages, onChange: onPackages }) })] }) }));
35
+ }
@@ -0,0 +1,20 @@
1
+ import { type ContainerPluginKey } from "./locales.js";
2
+ import { type ReactNode } from "react";
3
+ export interface PathEntry {
4
+ id: number;
5
+ path: string;
6
+ }
7
+ export declare function pathEntries(paths: readonly string[]): PathEntry[];
8
+ export declare function PathsList(props: {
9
+ t: (key: ContainerPluginKey) => string;
10
+ entries: readonly PathEntry[];
11
+ busy: boolean;
12
+ onChange: (entries: PathEntry[]) => void;
13
+ }): ReactNode;
14
+ export declare function PathsEditor(props: {
15
+ t: (key: ContainerPluginKey) => string;
16
+ paths: readonly string[];
17
+ busy: boolean;
18
+ enabled: boolean;
19
+ onApply: (paths: string[]) => void;
20
+ }): ReactNode;
@@ -0,0 +1,88 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // SPDX-FileCopyrightText: 2026 Elouan Martinet <exa@elou.world>
3
+ //
4
+ // SPDX-License-Identifier: MIT
5
+ import { Field } from "./container-card-shared.js";
6
+ import { greyId, hint } from "./container-card-styles.js";
7
+ import { Button, Input, Modal } from "@deepseek-ai/dsh-client-ui-primitives";
8
+ import { useId, useState } from "react";
9
+ let nextPathId = 0;
10
+ // pathEntries wraps a stored PATH list for editing.
11
+ export function pathEntries(paths) {
12
+ return paths.map((path) => ({ id: nextPathId++, path }));
13
+ }
14
+ // The row keeps the handle, the path, and the three controls on one line; the
15
+ // controls are compact symbols, so their meaning lives in the title and the
16
+ // accessible name instead of a label.
17
+ const pathRow = {
18
+ display: "flex",
19
+ alignItems: "center",
20
+ gap: "6px",
21
+ };
22
+ const pathInput = {
23
+ flex: 1,
24
+ minWidth: "120px",
25
+ };
26
+ const rowButton = {
27
+ padding: 0,
28
+ minWidth: "28px",
29
+ };
30
+ const dragHandle = {
31
+ cursor: "grab",
32
+ background: "none",
33
+ border: "none",
34
+ padding: 0,
35
+ color: "var(--dsw-alias-label-tertiary)",
36
+ };
37
+ // PathsList edits one ordered PATH-addition list: add (prepends), reorder by
38
+ // dragging the handle or with the move buttons, edit in place, and remove. It
39
+ // is controlled: every change reports the whole list through onChange.
40
+ export function PathsList(props) {
41
+ const { t, entries, busy, onChange } = props;
42
+ const [draft, setDraft] = useState("");
43
+ const [dragIndex, setDragIndex] = useState(null);
44
+ const addId = useId();
45
+ const move = (from, to) => {
46
+ if (from === to || to < 0 || to >= entries.length)
47
+ return;
48
+ const next = [...entries];
49
+ const [item] = next.splice(from, 1);
50
+ next.splice(to, 0, item);
51
+ onChange(next);
52
+ };
53
+ const add = () => {
54
+ const path = draft.trim();
55
+ if (path === "")
56
+ return;
57
+ onChange([{ id: nextPathId++, path }, ...entries]);
58
+ setDraft("");
59
+ };
60
+ const update = (index, path) => {
61
+ onChange(entries.map((entry, at) => (at === index ? { ...entry, path } : entry)));
62
+ };
63
+ return (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [_jsx(Field, { label: t("addPath"), htmlFor: addId, children: _jsxs("div", { style: { ...pathRow, gap: "8px" }, children: [_jsx(Input, { id: addId, value: draft, disabled: busy, onChange: (event) => setDraft(event.target.value), style: pathInput }), _jsx(Button, { variant: "outline", size: "sm", disabled: busy || draft.trim() === "", onClick: add, children: t("add") })] }) }), entries.length === 0 ? (_jsx("p", { style: { ...hint, margin: 0 }, children: t("noPaths") })) : (entries.map((entry, index) => (_jsxs("div", { style: pathRow, children: [_jsx("button", { type: "button", title: t("dragToReorder"), "aria-label": t("dragToReorder"), draggable: !busy, onDragStart: () => setDragIndex(index), onDragOver: (event) => event.preventDefault(), onDrop: () => {
64
+ if (dragIndex !== null)
65
+ move(dragIndex, index);
66
+ setDragIndex(null);
67
+ }, style: dragHandle, children: "\u2261" }), _jsx(Input, { value: entry.path, disabled: busy, onChange: (event) => update(index, event.target.value), style: pathInput }), _jsx(Button, { variant: "outline", size: "sm", title: t("moveUp"), "aria-label": t("moveUp"), disabled: busy || index === 0, onClick: () => move(index, index - 1), style: rowButton, children: "\u2191" }), _jsx(Button, { variant: "outline", size: "sm", title: t("moveDown"), "aria-label": t("moveDown"), disabled: busy || index === entries.length - 1, onClick: () => move(index, index + 1), style: rowButton, children: "\u2193" }), _jsx(Button, { variant: "outline", size: "sm", title: t("remove"), "aria-label": t("remove"), disabled: busy, onClick: () => onChange(entries.filter((_, at) => at !== index)), style: rowButton, children: "\u00D7" })] }, entry.id))))] }));
68
+ }
69
+ // PathsEditor shows the container's ordered PATH additions and edits them in a
70
+ // modal around PathsList. Apply sends the whole list at once.
71
+ export function PathsEditor(props) {
72
+ const { t, paths, busy, enabled, onApply } = props;
73
+ const [open, setOpen] = useState(false);
74
+ const [draft, setDraft] = useState([]);
75
+ const openEditor = () => {
76
+ setDraft(pathEntries(paths));
77
+ setOpen(true);
78
+ };
79
+ const apply = () => {
80
+ onApply(draft.map((entry) => entry.path));
81
+ setOpen(false);
82
+ };
83
+ return (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [paths.length === 0 ? (_jsx("p", { style: { ...hint, margin: 0 }, children: t("noPaths") })) : (paths.map((path) => (_jsx("code", { style: {
84
+ ...greyId,
85
+ fontSize: "13px",
86
+ color: "var(--dsw-alias-label-primary)",
87
+ }, children: path }, path)))), _jsx("div", { children: _jsx(Button, { variant: "outline", size: "sm", disabled: !enabled, onClick: openEditor, children: t("editPaths") }) }), _jsx(Modal, { open: open, onClose: () => setOpen(false), title: t("pathsTitle"), closeLabel: t("cancel"), footer: _jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", size: "sm", onClick: () => setOpen(false), children: t("cancel") }), _jsx(Button, { variant: "primary", size: "sm", disabled: busy, onClick: apply, children: t("apply") })] }), children: _jsx(PathsList, { t: t, entries: draft, busy: busy, onChange: setDraft }) })] }));
88
+ }
@@ -0,0 +1,30 @@
1
+ import { type ContainerView, type MountInput } from "./container-card-controller.js";
2
+ import { type DirectoryPickerFace } from "./directory-picker.js";
3
+ import { type ContainerPluginKey } from "./locales.js";
4
+ import { type ReactNode } from "react";
5
+ export declare function ContainerRow(props: {
6
+ t: (key: ContainerPluginKey) => string;
7
+ container: ContainerView;
8
+ images: readonly {
9
+ imageId: string;
10
+ }[];
11
+ volumes: readonly {
12
+ name: string;
13
+ }[];
14
+ secrets: readonly {
15
+ name: string;
16
+ }[];
17
+ busy: boolean;
18
+ onRemove: (workspace: string) => void;
19
+ onRecreate: (workspace: string, image: string, env?: Record<string, string>) => void;
20
+ onAddContainerMount: (workspace: string, container: string, mount: MountInput) => void;
21
+ onRemoveContainerMount: (workspace: string, container: string, mount: MountInput) => void;
22
+ onUpdateContainerMount: (workspace: string, container: string, mount: MountInput) => void;
23
+ onSetContainerPaths: (workspace: string, container: string, paths: readonly string[]) => void;
24
+ onAddContainerSecret: (workspace: string, envVar: string, secret: string) => void;
25
+ onRemoveContainerSecret: (workspace: string, envVar: string) => void;
26
+ projectName: string;
27
+ projectsRoot: string;
28
+ directoryPicker?: DirectoryPickerFace;
29
+ }): ReactNode;
30
+ export { CreateContainerModal } from "./container-card-create-modal.js";
@@ -0,0 +1,54 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { EnvEditor, MountsEditor } from "./container-card-editors.js";
3
+ import { PathsEditor } from "./container-card-paths.js";
4
+ import { ConfirmButton, mountViewToInput } from "./container-card-shared.js";
5
+ import { actions, containerHeader, containerRow, greyId, imageSelect, tableStyle, tdStyle, thStyle, wsBody, } from "./container-card-styles.js";
6
+ import { Button, DisclosureRow, Input, Pill } from "@deepseek-ai/dsh-client-ui-primitives";
7
+ import { useState } from "react";
8
+ export function ContainerRow(props) {
9
+ const { t, container, images, volumes, secrets, busy, onRemove, onRecreate, onAddContainerMount, onRemoveContainerMount, onUpdateContainerMount, onSetContainerPaths, onAddContainerSecret, onRemoveContainerSecret, projectName, projectsRoot, directoryPicker, } = props;
10
+ const [selected, setSelected] = useState(container.imageId);
11
+ const [env, setEnv] = useState(container.env);
12
+ const [envOpen, setEnvOpen] = useState(false);
13
+ const [mountOpen, setMountOpen] = useState(false);
14
+ const [pathOpen, setPathOpen] = useState(false);
15
+ const [secretOpen, setSecretOpen] = useState(false);
16
+ const [attachSecret, setAttachSecret] = useState("");
17
+ const [attachVar, setAttachVar] = useState("");
18
+ const enabled = container.workspaceSlug !== "" && !busy;
19
+ const projects = container.mounts
20
+ .map((mount) => mount.projectName)
21
+ .join(", ");
22
+ const envEntries = Object.entries(container.env);
23
+ const secretEntries = Object.entries(container.secretEnv);
24
+ const attach = () => {
25
+ const envVar = attachVar.trim();
26
+ if (envVar === "" || attachSecret === "")
27
+ return;
28
+ onAddContainerSecret(container.workspaceSlug, envVar, attachSecret);
29
+ setAttachVar("");
30
+ };
31
+ return (_jsxs("div", { style: containerRow, children: [_jsxs("div", { style: containerHeader, children: [_jsx("strong", { style: { color: "var(--dsw-alias-label-primary)" }, children: container.containerName }), _jsx(Pill, { children: container.status })] }), _jsx("table", { style: tableStyle, children: _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("th", { style: thStyle, scope: "row", children: t("image") }), _jsx("td", { style: tdStyle, children: container.imageId })] }), _jsxs("tr", { children: [_jsx("th", { style: thStyle, scope: "row", children: t("created") }), _jsx("td", { style: tdStyle, children: container.createdAt })] }), projects !== "" ? (_jsxs("tr", { children: [_jsx("th", { style: thStyle, scope: "row", children: t("projects") }), _jsx("td", { style: tdStyle, children: projects })] })) : null, envEntries.length > 0 ? (_jsxs("tr", { children: [_jsx("th", { style: thStyle, scope: "row", children: t("env") }), _jsx("td", { style: tdStyle, children: envEntries.map(([key]) => key).join(", ") })] })) : null, secretEntries.length > 0 ? (_jsxs("tr", { children: [_jsx("th", { style: thStyle, scope: "row", children: t("secretEnv") }), _jsx("td", { style: tdStyle, children: secretEntries
32
+ .map(([envVar, secretName]) => `${envVar}=${secretName}`)
33
+ .join(", ") })] })) : null] }) }), _jsxs("div", { style: actions, children: [_jsx(ConfirmButton, { t: t, label: t("remove"), title: t("confirmTitle"), description: t("confirmRemoveContainer"), disabled: !enabled, onConfirm: () => onRemove(container.workspaceSlug) }), _jsx(ConfirmButton, { t: t, label: t("recreate"), title: t("confirmTitle"), description: t("confirmRecreate"), disabled: !enabled, onConfirm: () => onRecreate(container.workspaceSlug, "", env) }), _jsxs("select", { style: imageSelect, value: selected, disabled: !enabled, onChange: (event) => setSelected(event.target.value), "aria-label": t("recreateWithImage"), children: [container.imageId === "" ? (_jsx("option", { value: "", children: t("none") })) : null, images.map((image) => (_jsx("option", { value: image.imageId, children: image.imageId }, image.imageId)))] }), _jsx(ConfirmButton, { t: t, label: t("recreateWithImage"), title: t("confirmTitle"), description: t("confirmRecreate"), disabled: !enabled || selected === "", onConfirm: () => onRecreate(container.workspaceSlug, selected, env) })] }), _jsx(DisclosureRow, { icon: _jsx("span", {}), title: t("envTitle"), open: envOpen, expandable: true, onToggle: () => setEnvOpen(!envOpen), children: _jsx("div", { style: wsBody, children: _jsx(EnvEditor, { t: t, env: env, busy: busy, onChange: setEnv }) }) }), _jsx(DisclosureRow, { icon: _jsx("span", {}), title: t("mountsTitle"), open: mountOpen, expandable: true, onToggle: () => setMountOpen(!mountOpen), children: _jsx("div", { style: wsBody, children: _jsx(MountsEditor, { t: t, mounts: container.mounts.map(mountViewToInput), volumes: volumes, secrets: secrets, busy: busy, enabled: enabled, projectsRoot: projectsRoot, directoryPicker: directoryPicker, confirmRemove: true, primaryProject: container.containerName === "default" ? projectName : "", onUpdate: (mount) => onUpdateContainerMount(container.workspaceSlug, container.containerName, mount), onRemove: (mount) => onRemoveContainerMount(container.workspaceSlug, container.containerName, mount), onAdd: (mount) => onAddContainerMount(container.workspaceSlug, container.containerName, mount) }) }) }), _jsx(DisclosureRow, { icon: _jsx("span", {}), title: t("pathsTitle"), open: pathOpen, expandable: true, onToggle: () => setPathOpen(!pathOpen), children: _jsx("div", { style: wsBody, children: _jsx(PathsEditor, { t: t, paths: container.paths, busy: busy, enabled: enabled, onApply: (paths) => onSetContainerPaths(container.workspaceSlug, container.containerName, paths) }) }) }), _jsx(DisclosureRow, { icon: _jsx("span", {}), title: t("containerSecretsTitle"), open: secretOpen, expandable: true, onToggle: () => setSecretOpen(!secretOpen), children: _jsxs("div", { style: wsBody, children: [secretEntries.map(([envVar, secretName]) => (_jsxs("div", { style: {
34
+ display: "flex",
35
+ flexWrap: "wrap",
36
+ alignItems: "center",
37
+ gap: "8px",
38
+ }, children: [_jsxs("code", { style: {
39
+ ...greyId,
40
+ flex: 1,
41
+ fontSize: "13px",
42
+ color: "var(--dsw-alias-label-primary)",
43
+ }, children: [envVar, "=", secretName] }), _jsx(ConfirmButton, { t: t, label: t("detachSecret"), title: t("confirmTitle"), description: t("confirmDetachSecret"), disabled: busy, onConfirm: () => onRemoveContainerSecret(container.workspaceSlug, envVar) })] }, envVar))), _jsxs("div", { style: {
44
+ display: "flex",
45
+ flexWrap: "wrap",
46
+ alignItems: "center",
47
+ gap: "8px",
48
+ paddingTop: "8px",
49
+ }, children: [_jsxs("select", { style: imageSelect, value: attachSecret, disabled: !enabled, onChange: (event) => setAttachSecret(event.target.value), "aria-label": t("attachSecret"), children: [secrets.length === 0 ? (_jsx("option", { value: "", children: t("none") })) : null, secrets.map((secret) => (_jsx("option", { value: secret.name, children: secret.name }, secret.name)))] }), _jsx(Input, { value: attachVar, disabled: !enabled, placeholder: t("secretEnvName"), onChange: (event) => setAttachVar(event.target.value), onKeyDown: (event) => {
50
+ if (event.key === "Enter")
51
+ attach();
52
+ }, style: { width: "200px" } }), _jsx(Button, { variant: "outline", size: "sm", disabled: !enabled || attachVar.trim() === "" || attachSecret === "", onClick: attach, children: t("attachSecret") })] })] }) })] }));
53
+ }
54
+ export { CreateContainerModal } from "./container-card-create-modal.js";
@@ -0,0 +1,21 @@
1
+ import { type ContainerPluginKey } from "./locales.js";
2
+ import { type ReactNode } from "react";
3
+ export declare function SecretRow(props: {
4
+ t: (key: ContainerPluginKey) => string;
5
+ name: string;
6
+ busy: boolean;
7
+ writable: boolean;
8
+ onSet: (name: string, value: string) => void;
9
+ onRemove: (name: string) => void;
10
+ }): ReactNode;
11
+ export declare function SecretsSection(props: {
12
+ t: (key: ContainerPluginKey) => string;
13
+ secrets: readonly {
14
+ name: string;
15
+ }[];
16
+ busy: boolean;
17
+ writable: boolean;
18
+ onCreate: (name: string, length?: number, charset?: string) => void;
19
+ onRemove: (name: string) => void;
20
+ onSet: (name: string, value: string) => void;
21
+ }): ReactNode;