@exagone313/dsh-podman 1.2.1 → 1.3.0

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 (94) hide show
  1. package/dist/card-route.d.ts +8 -0
  2. package/dist/card-route.js +19 -8
  3. package/dist/client/ContainerCard.js +147 -110
  4. package/dist/client/card-protocol.d.ts +4 -0
  5. package/dist/client/card-protocol.js +34 -0
  6. package/dist/client/container-card-caches.d.ts +1 -1
  7. package/dist/client/container-card-caches.js +19 -17
  8. package/dist/client/container-card-config.d.ts +47 -0
  9. package/dist/client/container-card-config.js +160 -0
  10. package/dist/client/container-card-controller.d.ts +35 -3
  11. package/dist/client/container-card-controller.js +263 -41
  12. package/dist/client/container-card-create-modal.d.ts +5 -1
  13. package/dist/client/container-card-create-modal.js +111 -94
  14. package/dist/client/container-card-defaults.d.ts +16 -0
  15. package/dist/client/container-card-defaults.js +147 -0
  16. package/dist/client/container-card-dialog-styles.d.ts +7 -0
  17. package/dist/client/container-card-dialog-styles.js +70 -0
  18. package/dist/client/container-card-dialog.d.ts +12 -0
  19. package/dist/client/container-card-dialog.js +47 -0
  20. package/dist/client/container-card-directory-styles.d.ts +1 -1
  21. package/dist/client/container-card-directory-styles.js +5 -5
  22. package/dist/client/container-card-directory.js +8 -7
  23. package/dist/client/container-card-edit-modal.d.ts +39 -0
  24. package/dist/client/container-card-edit-modal.js +29 -0
  25. package/dist/client/container-card-editors.d.ts +5 -2
  26. package/dist/client/container-card-editors.js +109 -134
  27. package/dist/client/container-card-field-styles.d.ts +7 -0
  28. package/dist/client/container-card-field-styles.js +63 -0
  29. package/dist/client/container-card-form.d.ts +47 -0
  30. package/dist/client/container-card-form.js +61 -0
  31. package/dist/client/container-card-group.d.ts +9 -0
  32. package/dist/client/container-card-group.js +22 -0
  33. package/dist/client/container-card-images.d.ts +6 -2
  34. package/dist/client/container-card-images.js +63 -23
  35. package/dist/client/container-card-paths.js +43 -52
  36. package/dist/client/container-card-ports.d.ts +3 -4
  37. package/dist/client/container-card-ports.js +74 -38
  38. package/dist/client/container-card-resources.d.ts +38 -0
  39. package/dist/client/container-card-resources.js +73 -0
  40. package/dist/client/container-card-row.d.ts +11 -19
  41. package/dist/client/container-card-row.js +122 -122
  42. package/dist/client/container-card-secrets.d.ts +31 -3
  43. package/dist/client/container-card-secrets.js +174 -56
  44. package/dist/client/container-card-shared.d.ts +173 -6
  45. package/dist/client/container-card-shared.js +616 -57
  46. package/dist/client/container-card-status.d.ts +18 -0
  47. package/dist/client/container-card-status.js +166 -0
  48. package/dist/client/container-card-styles.d.ts +49 -7
  49. package/dist/client/container-card-styles.js +396 -40
  50. package/dist/client/container-card-table-styles.d.ts +15 -0
  51. package/dist/client/container-card-table-styles.js +237 -0
  52. package/dist/client/container-card-tabs-styles.d.ts +5 -0
  53. package/dist/client/container-card-tabs-styles.js +46 -0
  54. package/dist/client/container-card-toast.d.ts +5 -0
  55. package/dist/client/container-card-toast.js +10 -0
  56. package/dist/client/container-card-volumes.d.ts +1 -0
  57. package/dist/client/container-card-volumes.js +14 -19
  58. package/dist/client/container-card-workspace.d.ts +8 -12
  59. package/dist/client/container-card-workspace.js +76 -14
  60. package/dist/client/index.js +6488 -3474
  61. package/dist/client/locales.d.ts +10 -1
  62. package/dist/client/locales.js +268 -114
  63. package/dist/client/relative-time.d.ts +10 -0
  64. package/dist/client/relative-time.js +74 -0
  65. package/dist/client/slot-contract.d.ts +8 -0
  66. package/dist/client/tool-views.js +1 -1
  67. package/dist/container-env.js +1 -1
  68. package/dist/env-rows.d.ts +9 -11
  69. package/dist/env-rows.js +72 -40
  70. package/dist/generated/version.d.ts +2 -2
  71. package/dist/generated/version.js +2 -2
  72. package/dist/guest-terminal.js +1 -1
  73. package/dist/mount-enums.d.ts +11 -0
  74. package/dist/mount-enums.js +60 -0
  75. package/dist/subprocess.js +1 -1
  76. package/dist/terminal-sessions.js +2 -2
  77. package/dist/terminal-shells.js +1 -1
  78. package/dist/tool-handlers.js +1 -1
  79. package/dist/workspace-binding.js +2 -2
  80. package/docs/architecture.md +4 -4
  81. package/docs/architecture.zh.md +1 -1
  82. package/docs/configuration.md +26 -25
  83. package/docs/configuration.zh.md +13 -11
  84. package/docs/development-prompt.md +7 -7
  85. package/docs/development-prompt.zh.md +7 -7
  86. package/docs/development.md +20 -16
  87. package/docs/development.zh.md +17 -16
  88. package/docs/install-dsh-and-dsh-podman.md +13 -12
  89. package/docs/install-dsh-and-dsh-podman.zh.md +13 -9
  90. package/docs/usage.md +189 -39
  91. package/docs/usage.zh.md +148 -29
  92. package/package.json +5 -1
  93. package/dist/client/container-card-default-env.d.ts +0 -10
  94. package/dist/client/container-card-default-env.js +0 -69
@@ -0,0 +1,237 @@
1
+ // SPDX-FileCopyrightText: 2026 Elouan Martinet <exa@elou.world>
2
+ //
3
+ // SPDX-License-Identifier: MIT
4
+ // The class on a card that owns a responsive table or block list (an image
5
+ // group, the status list, a workspace's containers). The card itself carries no
6
+ // containment, so its own box stays the plain card every other tab draws, and it
7
+ // start-aligns, so no flex or grid parent can stretch it to a taller sibling's
8
+ // height: the card is always exactly its content plus its own padding.
9
+ export const TABLE_CARD_CLASS = "dsh-podman-table-card";
10
+ // The class on that card's own content wrapper, under its title row. The wrapper
11
+ // is the containment context for the content below it, so the content reacts to
12
+ // the width it is actually given: a narrow desktop pane behaves exactly like a
13
+ // phone, while a viewport media query would not. Keeping the containment here
14
+ // means the card's own box can never be sized by it.
15
+ export const TABLE_CARD_CONTENT_CLASS = "dsh-podman-table-card-content";
16
+ // The class on a responsive table itself.
17
+ export const TABLE_CLASS = "dsh-podman-table";
18
+ // The class on one labelled line inside a row that is a block rather than one
19
+ // cell per field (an image's facts). On a wide card the label sits beside its
20
+ // value; the container query below stacks them on a narrow one.
21
+ export const FIELD_ROW_CLASS = "dsh-podman-field-row";
22
+ // The class on one mount row, in the container view's block and in the Mounts
23
+ // editor alike. It is that row's own containment context, so its fields react to
24
+ // the width the row is actually given and the two places stack identically, even
25
+ // where no card provides the context.
26
+ export const MOUNT_ROW_CLASS = "dsh-podman-mount-row";
27
+ // The class on a mount row's Kind field. It hugs its chip while the row has
28
+ // room; the container query below gives it a full line of its own once the row
29
+ // is narrow, the way every field beside it wraps there.
30
+ export const MOUNT_KIND_CLASS = "dsh-podman-mount-kind";
31
+ // The class on that field's value line, the line holding the chip. It reserves
32
+ // the height an input's line occupies beside it, so the chip sits on the input
33
+ // line while the label above keeps the labels' line; the container query below
34
+ // drops the reservation once the field has a line of its own.
35
+ export const MOUNT_KIND_VALUE_CLASS = "dsh-podman-mount-kind-value";
36
+ // The class on one labelled field of a mount row, in the container view's block
37
+ // and in the Mounts editor alike. It shares the row's line while there is room
38
+ // and takes a full line of its own on a narrow row, so the fields stack the
39
+ // same way wherever the row is rendered.
40
+ export const MOUNT_FIELD_CLASS = "dsh-podman-mount-field";
41
+ // The class the Destination field of a mount row adds to its own field class.
42
+ // The destination is the row's longest value, so on a wide row it takes a
43
+ // larger share of the free space than the fields beside it instead of leaving
44
+ // that space unused; the container query below still gives it a full line of
45
+ // its own on a narrow row through its field class.
46
+ export const MOUNT_DESTINATION_CLASS = "dsh-podman-mount-destination";
47
+ // The class on a field row's own trailing actions (removing a mount, a PATH
48
+ // entry or a port; attaching a secret). On a narrow row it claims the row's full
49
+ // width, so the actions read as the row's own footer rather than as a stray
50
+ // control beside a field.
51
+ export const MOUNT_ACTIONS_CLASS = "dsh-podman-mount-actions";
52
+ // The class on a group that lists shared rows: a container block's field group,
53
+ // and the editor that changes the same list. The marker is what a list needs —
54
+ // its rows already carry the mount row class wherever they render — for the
55
+ // container query below to separate its consecutive rows, in the container view
56
+ // and in an editor alike, and a future list gets the same hairlines by putting
57
+ // this marker on the wrapper that holds its rows. The marker is also the
58
+ // containment context for those rows, so the rule resolves in a dialog portaled
59
+ // outside every card, where no card is left to measure.
60
+ export const ROW_LIST_CLASS = "dsh-podman-row-list";
61
+ // Wide panes show the header row and print every field as its own column;
62
+ // narrow ones hide the header and print each cell's own label above its value,
63
+ // taken from the cell's data-label attribute. Nothing scrolls sideways: value
64
+ // cells may break anywhere.
65
+ //
66
+ // The card is a flex item of the tab panel, and the harness's plugin page stacks
67
+ // that panel in a flex too: a parent with the default `align-items: stretch`
68
+ // would give the card a taller sibling's height, so the card start-aligns in
69
+ // whatever box it lands in and measures its own content. The full width is
70
+ // stated because a start-aligned item in a column flex container (where the
71
+ // cross axis is the inline one) would otherwise shrink to its content, and the
72
+ // box is border-box so that width still contains the card's own padding and
73
+ // hairline.
74
+ export const TABLE_STYLES = `
75
+ .dsh-podman-table-card {
76
+ align-self: start;
77
+ box-sizing: border-box;
78
+ width: 100%;
79
+ }
80
+ .dsh-podman-table-card-content {
81
+ container-type: inline-size;
82
+ }
83
+ .dsh-podman-table {
84
+ width: 100%;
85
+ border-collapse: collapse;
86
+ }
87
+ .dsh-podman-table th,
88
+ .dsh-podman-table td {
89
+ padding: 12px 12px 12px 0;
90
+ text-align: left;
91
+ vertical-align: top;
92
+ overflow-wrap: anywhere;
93
+ }
94
+ .dsh-podman-table th:last-child,
95
+ .dsh-podman-table td:last-child {
96
+ padding-right: 0;
97
+ }
98
+ .dsh-podman-table thead th {
99
+ padding-top: 0;
100
+ padding-bottom: 8px;
101
+ font-size: 12px;
102
+ font-weight: 500;
103
+ line-height: 18px;
104
+ color: var(--dsw-alias-label-tertiary);
105
+ }
106
+ .dsh-podman-table tbody tr + tr > td {
107
+ border-top: 0.5px solid var(--dsw-alias-border-l2);
108
+ }
109
+ .dsh-podman-field-row {
110
+ display: flex;
111
+ flex-wrap: wrap;
112
+ gap: 2px 8px;
113
+ font-size: 13px;
114
+ line-height: 20px;
115
+ }
116
+ .dsh-podman-mount-row {
117
+ container-type: inline-size;
118
+ }
119
+ /* One labelled field of a mount row shares the line while there is room; the
120
+ container query below gives it a line of its own on a narrow row. */
121
+ .dsh-podman-mount-field {
122
+ flex: 1 1 160px;
123
+ }
124
+ /* The Destination field grows twice as much as the fields beside it and starts
125
+ from a wider basis, so a wide row spends its free space on the destination
126
+ instead of leaving it unused. It keeps width: 100% on its input and carries
127
+ no cap. */
128
+ .dsh-podman-mount-destination {
129
+ flex: 2 1 240px;
130
+ }
131
+ /* The Kind field's value line reserves the line an input occupies beside it —
132
+ 32px of control box plus its 0.5px stroke on each side — so the chip centres
133
+ on the inputs' line instead of hugging the top of the row. */
134
+ .dsh-podman-mount-kind-value {
135
+ min-height: 33px;
136
+ }
137
+ /* The list is its own containment context, so the query below resolves against
138
+ the width its rows are given even when the list renders in a dialog portaled
139
+ to the body, which no card wraps and which would otherwise leave the rows
140
+ with nothing to measure. Because the list spans the same width its rows had,
141
+ every other query still measures what it measured before. */
142
+ .dsh-podman-row-list {
143
+ container-type: inline-size;
144
+ }
145
+ @container (max-width: 560px) {
146
+ .dsh-podman-table,
147
+ .dsh-podman-table tbody,
148
+ .dsh-podman-table tr,
149
+ .dsh-podman-table td {
150
+ display: block;
151
+ }
152
+ .dsh-podman-table thead {
153
+ display: none;
154
+ }
155
+ .dsh-podman-table tbody tr {
156
+ padding: 12px 0;
157
+ }
158
+ .dsh-podman-table tbody tr + tr {
159
+ border-top: 0.5px solid var(--dsw-alias-border-l2);
160
+ }
161
+ .dsh-podman-table tbody tr + tr > td {
162
+ border-top: 0;
163
+ }
164
+ .dsh-podman-table td {
165
+ padding: 0 0 8px;
166
+ }
167
+ .dsh-podman-table td:last-child {
168
+ padding-bottom: 0;
169
+ }
170
+ .dsh-podman-table td::before {
171
+ content: attr(data-label);
172
+ display: block;
173
+ font-size: 12px;
174
+ line-height: 18px;
175
+ color: var(--dsw-alias-label-tertiary);
176
+ }
177
+ /* A field line whose label sits beside its value on a wide card stacks the
178
+ label above the value once the card is narrow. */
179
+ .dsh-podman-field-row {
180
+ flex-direction: column;
181
+ gap: 0;
182
+ }
183
+ /* A mount row's Kind field stops hugging its chip and takes a line of its
184
+ own, like the fields beside it. Its flex basis is auto, so the width is
185
+ what gives the field that line. */
186
+ .dsh-podman-mount-kind {
187
+ width: 100%;
188
+ }
189
+ /* The Kind field now owns its line: with no input beside it to align with,
190
+ its value line drops the height it reserved, so a stacked chip leaves no
191
+ empty space under itself. */
192
+ .dsh-podman-mount-kind-value {
193
+ min-height: 0;
194
+ }
195
+ /* Every other field of a mount row — the Destination included — takes a full
196
+ line of its own too, so the label always reads above its value on a narrow
197
+ row. */
198
+ .dsh-podman-mount-field,
199
+ .dsh-podman-mount-destination {
200
+ flex-basis: 100%;
201
+ }
202
+ /* A mount row's actions become that row's own full-width footer. */
203
+ .dsh-podman-mount-actions {
204
+ flex-basis: 100%;
205
+ width: 100%;
206
+ }
207
+ /* Consecutive rows of one list — a container block's field group and the
208
+ editor that changes the same list — take a hairline once they stack. Side
209
+ by side on a wide pane the gap alone separates them, which is why the rule
210
+ lives in this query alone, and the padding above each ruled row keeps the
211
+ line in the gap instead of against the row it introduces. A group's label,
212
+ its empty-state line and its own add controls carry no row class, so they
213
+ never take a rule of their own. */
214
+ .dsh-podman-row-list > .dsh-podman-mount-row + .dsh-podman-mount-row {
215
+ border-top: 0.5px solid var(--dsw-alias-border-l2);
216
+ /* The margin adds to the list's own gap, so the ruled row sits further from
217
+ the row above it than from the one below: the line reads as the boundary
218
+ of the row it introduces rather than as that row's top edge. */
219
+ margin-top: 4px;
220
+ padding-top: 8px;
221
+ }
222
+ }
223
+ `;
224
+ /** Inject the responsive table's stylesheet for the owning plugin lifetime. */
225
+ export function installTableStyles(ctx) {
226
+ if (typeof document === "undefined")
227
+ return;
228
+ ctx.effect(() => {
229
+ const tag = document.createElement("style");
230
+ tag.dataset.plugin = "@exagone313/dsh-podman";
231
+ tag.textContent = TABLE_STYLES;
232
+ document.head.appendChild(tag);
233
+ return () => {
234
+ tag.remove();
235
+ };
236
+ }, "podman: table styles");
237
+ }
@@ -0,0 +1,5 @@
1
+ import type { Context as ClientContext } from "@deepseek-ai/cordis";
2
+ export declare const TABS_CLASS = "dsh-podman-tabs";
3
+ export declare const TABS_STYLES = "\n.dsh-podman-tabs.dsh-podman-tabs {\n display: flex;\n flex-wrap: wrap;\n gap: 4px;\n}\n.dsh-podman-tabs.dsh-podman-tabs > [role=\"tab\"] {\n flex: 1 1 100px;\n min-width: 0;\n padding: 0 8px;\n font-size: 13px;\n white-space: nowrap;\n}\n.dsh-podman-tabs.dsh-podman-tabs > span[aria-hidden=\"true\"] {\n display: none;\n}\n.dsh-podman-tabs.dsh-podman-tabs > [role=\"tab\"][aria-selected=\"true\"] {\n background: var(--dsw-alias-bg-layer-3);\n box-shadow: inset 0 0 0 0.5px var(--dsw-alias-border-l3);\n}\n";
4
+ /** Inject the tab strip's stylesheet for the owning plugin lifetime. */
5
+ export declare function installTabsStyles(ctx: ClientContext): void;
@@ -0,0 +1,46 @@
1
+ // SPDX-FileCopyrightText: 2026 Elouan Martinet <exa@elou.world>
2
+ //
3
+ // SPDX-License-Identifier: MIT
4
+ // The class passed to SegmentedTabs for the settings page's tab strip. The
5
+ // primitive lays its tabs out as an equal-column grid, which cannot wrap; this
6
+ // class turns the same tablist into a wrapping flex strip instead, so all five
7
+ // tabs stay visible at phone width without scrolling: each tab keeps a 100px
8
+ // basis and grows to share its line. The primitive's sliding indicator is
9
+ // absolute inside the strip (it cannot follow a wrapped tab), so it is dropped
10
+ // and the selected tab carries its own fill.
11
+ export const TABS_CLASS = "dsh-podman-tabs";
12
+ export const TABS_STYLES = `
13
+ .dsh-podman-tabs.dsh-podman-tabs {
14
+ display: flex;
15
+ flex-wrap: wrap;
16
+ gap: 4px;
17
+ }
18
+ .dsh-podman-tabs.dsh-podman-tabs > [role="tab"] {
19
+ flex: 1 1 100px;
20
+ min-width: 0;
21
+ padding: 0 8px;
22
+ font-size: 13px;
23
+ white-space: nowrap;
24
+ }
25
+ .dsh-podman-tabs.dsh-podman-tabs > span[aria-hidden="true"] {
26
+ display: none;
27
+ }
28
+ .dsh-podman-tabs.dsh-podman-tabs > [role="tab"][aria-selected="true"] {
29
+ background: var(--dsw-alias-bg-layer-3);
30
+ box-shadow: inset 0 0 0 0.5px var(--dsw-alias-border-l3);
31
+ }
32
+ `;
33
+ /** Inject the tab strip's stylesheet for the owning plugin lifetime. */
34
+ export function installTabsStyles(ctx) {
35
+ if (typeof document === "undefined")
36
+ return;
37
+ ctx.effect(() => {
38
+ const tag = document.createElement("style");
39
+ tag.dataset.plugin = "@exagone313/dsh-podman";
40
+ tag.textContent = TABS_STYLES;
41
+ document.head.appendChild(tag);
42
+ return () => {
43
+ tag.remove();
44
+ };
45
+ }, "podman: tab strip styles");
46
+ }
@@ -0,0 +1,5 @@
1
+ import { type ContainerCardFace } from "./container-card-controller.js";
2
+ import { type InjectFace, type PropsRuntime } from "@deepseek-ai/dsh-client-ui-slots";
3
+ import { type ReactNode } from "react";
4
+ export type ContainerCardToastProps = PropsRuntime<"shell.overlay"> & InjectFace<ContainerCardFace>;
5
+ export declare function ContainerCardToast(props: ContainerCardToastProps): ReactNode;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { IconWarningOutlineRegular, Toast, } from "@deepseek-ai/dsh-client-ui-primitives";
3
+ export function ContainerCardToast(props) {
4
+ const toast = props.useContainerCard((state) => state.toast);
5
+ if (toast === null)
6
+ return null;
7
+ return (_jsx(Toast
8
+ // A new report remounts the banner, which restarts its hold.
9
+ , { text: toast.text, icon: toast.kind === "error" ? _jsx(IconWarningOutlineRegular, {}) : undefined, onDone: props.dismissToast }, `podman-card-toast-${String(toast.seq)}`));
10
+ }
@@ -7,6 +7,7 @@ export declare function VolumesSection(props: {
7
7
  }[];
8
8
  busy: boolean;
9
9
  writable: boolean;
10
+ pendingActions: readonly string[];
10
11
  onCreate: (name: string) => void;
11
12
  onRemove: (name: string) => void;
12
13
  }): ReactNode;
@@ -2,14 +2,15 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
2
2
  // SPDX-FileCopyrightText: 2026 Elouan Martinet <exa@elou.world>
3
3
  //
4
4
  // SPDX-License-Identifier: MIT
5
- import { ConfirmButton, Field, namePattern, sanitizeName, } from "./container-card-shared.js";
6
- import { hint, sectionTitle, wsBody } from "./container-card-styles.js";
7
- import { Button, DisclosureRow, Input, Modal, } from "@deepseek-ai/dsh-client-ui-primitives";
5
+ import { ConfirmButton, countLabel, Field, namePattern, } from "./container-card-shared.js";
6
+ import { CardGroup } from "./container-card-group.js";
7
+ import { scopedActionKey } from "./card-protocol.js";
8
+ import { cardList, cardRow, containerNameHeading, hint, rowActions, rowDivider, rowMain, } from "./container-card-styles.js";
9
+ import { Button, Input, Modal } from "@deepseek-ai/dsh-client-ui-primitives";
8
10
  import { useId, useState } from "react";
9
11
  export function VolumesSection(props) {
10
- const { t, volumes, busy, writable, onCreate, onRemove } = props;
12
+ const { t, volumes, busy, writable, pendingActions, onCreate, onRemove } = props;
11
13
  const [open, setOpen] = useState(false);
12
- const [openVolume, setOpenVolume] = useState(null);
13
14
  const [name, setName] = useState("");
14
15
  const volumeId = useId();
15
16
  const canCreate = namePattern.test(name);
@@ -20,22 +21,16 @@ export function VolumesSection(props) {
20
21
  setName("");
21
22
  setOpen(false);
22
23
  };
23
- return (_jsxs("section", { children: [_jsxs("div", { style: {
24
- display: "flex",
25
- flexWrap: "wrap",
26
- alignItems: "center",
27
- gap: "8px",
28
- }, children: [_jsx("div", { style: { ...sectionTitle, flex: 1 }, children: t("volumesTitle") }), _jsx(Button, { variant: "outline", size: "sm", disabled: !writable || busy, onClick: () => setOpen(true), children: t("createVolume") })] }), volumes.length === 0 ? _jsx("p", { style: hint, children: t("none") }) : (volumes.map((volume) => (_jsx(DisclosureRow, { icon: _jsx("span", {}), title: volume.name, open: openVolume === volume.name, expandable: true, onToggle: () => setOpenVolume(openVolume === volume.name ? null : volume.name), children: _jsx("div", { style: wsBody, children: _jsx("div", { style: {
29
- display: "flex",
30
- flexWrap: "wrap",
31
- alignItems: "center",
32
- gap: "8px",
33
- }, children: _jsx(ConfirmButton, { t: t, label: t("removeVolume"), title: t("confirmTitle"), description: t("confirmRemoveVolume", {
34
- volume: volume.name,
35
- }), disabled: busy, onConfirm: () => onRemove(volume.name) }) }) }) }, volume.name)))), _jsx(Modal, { open: open, onClose: () => setOpen(false), title: t("volumesTitle"), 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: !canCreate, onClick: submit, children: t("createVolume") })] }), children: _jsxs(Field, { label: t("volumeName"), htmlFor: volumeId, children: [_jsx(Input, { id: volumeId, value: name, disabled: !writable || busy, autoFocus: true, onChange: (event) => setName(sanitizeName(event.target.value)), onKeyDown: (event) => {
24
+ return (_jsxs(CardGroup, { title: t("volumesTitle"), summary: countLabel(t, volumes.length, "countVolumeOne", "countVolumeMany"), hasContent: volumes.length > 0, action: _jsx(Button, { variant: "primary", size: "sm", disabled: !writable || busy, onClick: () => setOpen(true), children: t("createVolume") }), children: [volumes.length === 0
25
+ ? _jsx("p", { style: { ...hint, margin: 0 }, children: t("noVolumes") })
26
+ : (_jsx("div", { style: cardList, children: volumes.map((volume, index) => (_jsxs("div", { style: index === volumes.length - 1
27
+ ? cardRow
28
+ : { ...cardRow, ...rowDivider }, children: [_jsx("div", { style: rowMain, children: _jsx("span", { style: containerNameHeading, children: volume.name }) }), _jsx("div", { style: rowActions, children: _jsx(ConfirmButton, { t: t, destructive: true, label: t("removeVolume"), title: t("removeVolumeTitle"), description: t("confirmRemoveVolume", {
29
+ volume: volume.name,
30
+ }), confirmLabel: t("removeVolumeTitle"), pending: pendingActions.includes(scopedActionKey("volume_remove", volume.name)), onConfirm: () => onRemove(volume.name) }) })] }, volume.name))) })), _jsx(Modal, { open: open, onClose: () => setOpen(false), title: t("volumesTitle"), 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: !canCreate, onClick: submit, children: t("createVolume") })] }), children: _jsxs(Field, { label: t("volumeName"), htmlFor: volumeId, children: [_jsx(Input, { id: volumeId, value: name, disabled: !writable || busy, autoFocus: true, onChange: (event) => setName(event.target.value), onKeyDown: (event) => {
36
31
  if (event.key === "Enter")
37
32
  submit();
38
33
  } }), name !== "" && !namePattern.test(name)
39
- ? _jsx("p", { style: { ...hint, margin: 0 }, children: t("invalidName") })
34
+ ? (_jsx("p", { style: { ...hint, margin: 0 }, role: "alert", children: t("invalidName") }))
40
35
  : null] }) })] }));
41
36
  }
@@ -1,4 +1,4 @@
1
- import { type ContainerCreateConfig, type ContainerView, type ImageView, type MountInput, type WorkspaceView } from "./container-card-controller.js";
1
+ import { type ContainerConfig, type ContainerCreateConfig, type ContainerView, type ImageView, type WorkspaceView } from "./container-card-controller.js";
2
2
  import { type DirectoryPickerFace } from "./directory-picker.js";
3
3
  import type { Translate } from "./locales.js";
4
4
  import { type ReactNode } from "react";
@@ -14,23 +14,19 @@ export declare function WorkspaceSection(props: {
14
14
  name: string;
15
15
  }[];
16
16
  busy: boolean;
17
+ writable: boolean;
18
+ locale: string;
19
+ pendingActions: readonly string[];
17
20
  defaultImage: string;
21
+ defaultEnv: Record<string, string>;
18
22
  projectsRoot: string;
19
23
  directoryPicker?: DirectoryPickerFace;
20
24
  onRemove: (workspace: string, container: string) => void;
25
+ onRecreate: (workspace: string, container: string, image: string) => void;
21
26
  onRemoveWorkspace: (workspace: string) => void;
22
- onRecreate: (workspace: string, container: string, image: string, env?: Record<string, string>) => void;
23
27
  onCreate: (workspace: WorkspaceView, config?: ContainerCreateConfig) => void;
28
+ onCreateSecret: (name: string, length?: number, charset?: string) => void;
24
29
  onStartContainer: (workspace: WorkspaceView, container: string, config?: ContainerCreateConfig) => void;
25
- onAddContainerMount: (workspace: string, container: string, mount: MountInput) => void;
26
- onRemoveContainerMount: (workspace: string, container: string, mount: MountInput) => void;
27
- onUpdateContainerMount: (workspace: string, container: string, mount: MountInput) => void;
28
- onSetContainerPaths: (workspace: string, container: string, paths: readonly string[]) => void;
29
- onAddContainerSecret: (workspace: string, container: string, envVar: string, secret: string) => void;
30
- onRemoveContainerSecret: (workspace: string, container: string, envVar: string) => void;
31
- onPublishContainerPort: (workspace: string, container: string, port: number, suggestedHostPort?: number) => void;
32
- onUnpublishContainerPort: (workspace: string, container: string, port: number, protocol: string) => void;
30
+ onApplyContainerConfig: (workspace: string, container: string, base: ContainerConfig, next: ContainerConfig) => void;
33
31
  gatewayUnavailable: boolean;
34
- onSyncDefaults: (workspace: string) => void;
35
- defaultEnvCount: number;
36
32
  }): ReactNode;
@@ -1,24 +1,86 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // SPDX-FileCopyrightText: 2026 Elouan Martinet <exa@elou.world>
3
3
  //
4
4
  // SPDX-License-Identifier: MIT
5
+ // One workspace card in the Workspaces tab: the workspace's name, its one
6
+ // running/stopped status phrase, a copy button for its ID, its own actions, and
7
+ // its containers as stacked blocks. A workspace with no container still offers
8
+ // the one action that creates its default container, reads muted, and states the
9
+ // greyed zero it holds.
5
10
  import { ContainerRow, CreateContainerModal } from "./container-card-row.js";
6
- import { ConfirmButton, containerStateDot } from "./container-card-shared.js";
7
- import { greyId, hint, wsBody } from "./container-card-styles.js";
8
- import { Button, DisclosureRow, StateDot, } from "@deepseek-ai/dsh-client-ui-primitives";
9
- import { useState } from "react";
11
+ import { countLabel } from "./container-card-shared.js";
12
+ import { scopedActionKey } from "./card-protocol.js";
13
+ import { TABLE_CARD_CLASS, TABLE_CARD_CONTENT_CLASS, } from "./container-card-table-styles.js";
14
+ import { actionRow, card, cardContent, cardList, cardTitle, destructiveAction, headerRule, rowActions, rowMain, rowName, statusMuted, workspaceStatus, } from "./container-card-styles.js";
15
+ import { Button, IconCheckOutlineRegular, IconCopyOutlineRegular, RiskConfirmation, Tooltip, writeClipboard, } from "@deepseek-ai/dsh-client-ui-primitives";
16
+ import { useEffect, useId, useRef, useState } from "react";
17
+ // The workspace's ID, copied on demand instead of printed as a bare UUID: a
18
+ // discreet icon button whose tooltip names the action and whose check confirms
19
+ // the write.
20
+ function CopyWorkspaceId(props) {
21
+ const { t, id } = props;
22
+ const [copied, setCopied] = useState(false);
23
+ const resetTimer = useRef();
24
+ const copy = () => {
25
+ void writeClipboard(id).then((ok) => {
26
+ if (!ok)
27
+ return;
28
+ setCopied(true);
29
+ if (resetTimer.current !== undefined)
30
+ clearTimeout(resetTimer.current);
31
+ resetTimer.current = setTimeout(() => setCopied(false), 1500);
32
+ });
33
+ };
34
+ // The reset timer is cancelled on unmount, so it cannot fire against an
35
+ // unmounted component.
36
+ useEffect(() => () => {
37
+ if (resetTimer.current !== undefined)
38
+ clearTimeout(resetTimer.current);
39
+ }, []);
40
+ const label = copied ? t("copied") : t("copyWorkspaceId");
41
+ return (_jsx(Tooltip, { label: label, children: _jsx(Button, { variant: "ghost", size: "sm", icon: copied ? _jsx(IconCheckOutlineRegular, {}) : _jsx(IconCopyOutlineRegular, {}), "aria-label": label, disabled: id === "", onClick: copy }) }));
42
+ }
10
43
  export function WorkspaceSection(props) {
11
- const { t, workspace, containers, images, volumes, secrets, busy, defaultImage, projectsRoot, directoryPicker, onRemove, onRemoveWorkspace, onRecreate, onCreate, onStartContainer, onAddContainerMount, onRemoveContainerMount, onUpdateContainerMount, onSetContainerPaths, onAddContainerSecret, onRemoveContainerSecret, onPublishContainerPort, onUnpublishContainerPort, gatewayUnavailable, onSyncDefaults, defaultEnvCount, } = props;
12
- const [open, setOpen] = useState(false);
44
+ const { t, workspace, containers, images, volumes, secrets, busy, writable, locale, pendingActions, defaultImage, defaultEnv, projectsRoot, directoryPicker, onRemove, onRecreate, onRemoveWorkspace, onCreate, onCreateSecret, onStartContainer, onApplyContainerConfig, gatewayUnavailable, } = props;
13
45
  const [createOpen, setCreateOpen] = useState(null);
46
+ const [removeWorkspaceOpen, setRemoveWorkspaceOpen] = useState(false);
47
+ const [removeWorkspaceAcknowledged, setRemoveWorkspaceAcknowledged] = useState(false);
48
+ const headingId = useId();
49
+ const removeWorkspacePending = pendingActions.includes(scopedActionKey("workspace_remove", workspace.workspaceSlug));
14
50
  const hasContainer = containers.length > 0;
15
- return (_jsxs(DisclosureRow, { icon: hasContainer
16
- ? _jsx(StateDot, { state: containerStateDot(containers[0]?.status ?? "") })
17
- : _jsx("span", {}), title: workspace.projectName, open: open, expandable: true, onToggle: () => setOpen(!open), children: [_jsxs("div", { style: wsBody, children: [_jsx("code", { style: greyId, children: workspace.workspaceSlug }), !hasContainer
18
- ? (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [_jsx("p", { style: { ...hint, margin: 0 }, children: t("noContainers") }), _jsx("div", { children: _jsx(Button, { variant: "outline", size: "sm", disabled: busy, onClick: () => setCreateOpen("default"), children: t("createContainer") }) })] }))
19
- : (_jsxs(_Fragment, { children: [containers.map((container) => (_jsx(ContainerRow, { t: t, container: container, images: images, volumes: volumes, secrets: secrets, busy: busy, onRemove: onRemove, onRecreate: onRecreate, onAddContainerMount: onAddContainerMount, onRemoveContainerMount: onRemoveContainerMount, onUpdateContainerMount: onUpdateContainerMount, onSetContainerPaths: onSetContainerPaths, projectName: workspace.projectName, projectsRoot: projectsRoot, directoryPicker: directoryPicker, onAddContainerSecret: onAddContainerSecret, onRemoveContainerSecret: onRemoveContainerSecret, onPublishContainerPort: onPublishContainerPort, onUnpublishContainerPort: onUnpublishContainerPort, gatewayUnavailable: gatewayUnavailable }, container.containerName))), _jsx("div", { children: _jsx(Button, { variant: "outline", size: "sm", disabled: busy, onClick: () => setCreateOpen("named"), children: t("addContainer") }) })] })), _jsxs("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: [_jsx(ConfirmButton, { t: t, label: t("applyDefaults"), title: t("confirmTitle"), description: t("confirmApplyDefaults"), disabled: busy || defaultEnvCount === 0, onConfirm: () => onSyncDefaults(workspace.workspaceSlug) }), _jsx(ConfirmButton, { t: t, label: t("removePod"), title: t("confirmTitle"), description: t("confirmRemovePod", {
20
- workspace: workspace.projectName,
21
- }), disabled: busy, onConfirm: () => onRemoveWorkspace(workspace.workspaceSlug) })] })] }), _jsx(CreateContainerModal, { t: t, workspace: workspace, images: images, volumes: volumes, secrets: secrets, busy: busy, defaultImage: defaultImage, projectsRoot: projectsRoot, directoryPicker: directoryPicker, named: createOpen === "named", existing: containers.map((container) => container.containerName), open: createOpen !== null, onClose: () => setCreateOpen(null), onCreate: (container, config) => {
51
+ // The header states one phrase: how many containers run and how many are
52
+ // stopped, with the stopped half greyed, or the greyed zero when the
53
+ // workspace holds nothing yet.
54
+ const running = containers.filter((container) => container.status === "running").length;
55
+ const stopped = containers.length - running;
56
+ return (_jsxs("section", { style: card, className: TABLE_CARD_CLASS, "aria-labelledby": headingId, children: [_jsxs("div", { style: hasContainer ? { ...actionRow, ...headerRule } : actionRow, children: [_jsxs("div", { style: rowMain, children: [_jsx("h3", { id: headingId, style: hasContainer ? { ...cardTitle, ...rowName } : {
57
+ ...cardTitle,
58
+ ...rowName,
59
+ color: "var(--dsw-alias-label-tertiary)",
60
+ }, children: workspace.projectName }), _jsx(CopyWorkspaceId, { t: t, id: workspace.workspaceSlug }), _jsxs("span", { style: hasContainer ? workspaceStatus : {
61
+ ...workspaceStatus,
62
+ ...statusMuted,
63
+ }, children: [running > 0
64
+ ? countLabel(t, running, "countRunningContainerOne", "countRunningContainerMany")
65
+ : null, running > 0 && stopped > 0 ? " · " : null, stopped > 0
66
+ ? (_jsx("span", { style: statusMuted, children: countLabel(t, stopped, "countStoppedContainerOne", "countStoppedContainerMany") }))
67
+ : null, hasContainer ? null : (_jsx("span", { style: statusMuted, children: countLabel(t, 0, "countContainerOne", "countContainerMany") }))] })] }), _jsxs("div", { style: rowActions, children: [_jsx(Button, { variant: "primary", size: "sm", disabled: busy, onClick: () => setCreateOpen(hasContainer ? "named" : "default"), children: hasContainer ? t("addContainer") : t("createContainer") }), hasContainer
68
+ ? (_jsx(Button, { variant: "outline", size: "sm", disabled: removeWorkspacePending, style: destructiveAction, onClick: () => {
69
+ setRemoveWorkspaceAcknowledged(false);
70
+ setRemoveWorkspaceOpen(true);
71
+ }, children: removeWorkspacePending ? t("busy") : t("removeWorkspace") }))
72
+ : null] })] }), hasContainer
73
+ ? (_jsx("div", { className: TABLE_CARD_CONTENT_CLASS, style: cardContent, children: _jsx("div", { style: cardList, children: containers.map((container, index) => (_jsx(ContainerRow, { t: t, container: container, images: images, volumes: volumes, secrets: secrets, pendingActions: pendingActions, locale: locale, last: index === containers.length - 1, writable: writable, onRemove: onRemove, onRecreate: onRecreate, onCreateSecret: onCreateSecret, onApplyContainerConfig: onApplyContainerConfig, projectName: workspace.projectName, projectsRoot: projectsRoot, directoryPicker: directoryPicker, gatewayUnavailable: gatewayUnavailable }, container.containerName))) }) }))
74
+ : null, _jsx(RiskConfirmation, { open: removeWorkspaceOpen, title: t("removeWorkspace"), description: t("confirmRemoveWorkspace", {
75
+ workspace: workspace.projectName,
76
+ }), acknowledgeLabel: t("acknowledgeRemoveWorkspace"), cancelLabel: t("cancel"), closeLabel: t("cancel"), confirmLabel: t("removeWorkspace"), acknowledged: removeWorkspaceAcknowledged, disabled: removeWorkspacePending, onAcknowledgedChange: setRemoveWorkspaceAcknowledged, onCancel: () => {
77
+ setRemoveWorkspaceAcknowledged(false);
78
+ setRemoveWorkspaceOpen(false);
79
+ }, onConfirm: () => {
80
+ setRemoveWorkspaceAcknowledged(false);
81
+ setRemoveWorkspaceOpen(false);
82
+ onRemoveWorkspace(workspace.workspaceSlug);
83
+ } }), _jsx(CreateContainerModal, { t: t, workspace: workspace, images: images, volumes: volumes, secrets: secrets, busy: busy, writable: writable, defaultImage: defaultImage, defaultEnv: defaultEnv, projectsRoot: projectsRoot, directoryPicker: directoryPicker, named: createOpen === "named", existing: containers.map((container) => container.containerName), gatewayUnavailable: gatewayUnavailable, open: createOpen !== null, onClose: () => setCreateOpen(null), onCreateSecret: onCreateSecret, onCreate: (container, config) => {
22
84
  if (createOpen === "named") {
23
85
  onStartContainer(workspace, container, config);
24
86
  }