@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.
- package/LICENSE +21 -0
- package/README.md +41 -0
- package/README.zh.md +41 -0
- package/cordis.patch.yml +17 -0
- package/dist/approval-reasons.d.ts +129 -0
- package/dist/approval-reasons.js +253 -0
- package/dist/approval-reasons.test.d.ts +1 -0
- package/dist/approval-reasons.test.js +115 -0
- package/dist/approval.d.ts +29 -0
- package/dist/approval.js +412 -0
- package/dist/approval.test.d.ts +1 -0
- package/dist/approval.test.js +462 -0
- package/dist/card-route.d.ts +15 -0
- package/dist/card-route.js +478 -0
- package/dist/card-route.test.d.ts +1 -0
- package/dist/card-route.test.js +181 -0
- package/dist/card-test-support.d.ts +15 -0
- package/dist/card-test-support.js +160 -0
- package/dist/client/ContainerCard.d.ts +6 -0
- package/dist/client/ContainerCard.js +79 -0
- package/dist/client/card-client.d.ts +6 -0
- package/dist/client/card-client.js +47 -0
- package/dist/client/card-protocol.d.ts +101 -0
- package/dist/client/card-protocol.js +10 -0
- package/dist/client/container-card-caches.d.ts +10 -0
- package/dist/client/container-card-caches.js +31 -0
- package/dist/client/container-card-controller.d.ts +107 -0
- package/dist/client/container-card-controller.js +207 -0
- package/dist/client/container-card-create-modal.d.ts +24 -0
- package/dist/client/container-card-create-modal.js +109 -0
- package/dist/client/container-card-directory-styles.d.ts +5 -0
- package/dist/client/container-card-directory-styles.js +246 -0
- package/dist/client/container-card-directory.d.ts +12 -0
- package/dist/client/container-card-directory.js +144 -0
- package/dist/client/container-card-editors.d.ts +30 -0
- package/dist/client/container-card-editors.js +116 -0
- package/dist/client/container-card-images.d.ts +37 -0
- package/dist/client/container-card-images.js +35 -0
- package/dist/client/container-card-paths.d.ts +20 -0
- package/dist/client/container-card-paths.js +88 -0
- package/dist/client/container-card-row.d.ts +30 -0
- package/dist/client/container-card-row.js +54 -0
- package/dist/client/container-card-secrets.d.ts +21 -0
- package/dist/client/container-card-secrets.js +71 -0
- package/dist/client/container-card-shared.d.ts +55 -0
- package/dist/client/container-card-shared.js +152 -0
- package/dist/client/container-card-styles.d.ts +21 -0
- package/dist/client/container-card-styles.js +143 -0
- package/dist/client/container-card-volumes.d.ts +12 -0
- package/dist/client/container-card-volumes.js +37 -0
- package/dist/client/container-card-workspace.d.ts +31 -0
- package/dist/client/container-card-workspace.js +24 -0
- package/dist/client/directory-picker.d.ts +12 -0
- package/dist/client/directory-picker.js +30 -0
- package/dist/client/index.d.ts +5 -0
- package/dist/client/index.js +4419 -0
- package/dist/client/locales.d.ts +9 -0
- package/dist/client/locales.js +370 -0
- package/dist/client/read-only-approval.d.ts +8 -0
- package/dist/client/read-only-approval.js +63 -0
- package/dist/client/slot-contract.d.ts +12 -0
- package/dist/client/slot-contract.js +4 -0
- package/dist/client/terminal-styles.d.ts +5 -0
- package/dist/client/terminal-styles.js +31 -0
- package/dist/client/tool-views.d.ts +8 -0
- package/dist/client/tool-views.js +241 -0
- package/dist/containers.test.d.ts +1 -0
- package/dist/containers.test.js +443 -0
- package/dist/daemons.test.d.ts +1 -0
- package/dist/daemons.test.js +153 -0
- package/dist/fs-provider.d.ts +23 -0
- package/dist/fs-provider.js +184 -0
- package/dist/fs-provider.test.d.ts +1 -0
- package/dist/fs-provider.test.js +260 -0
- package/dist/generated/version.d.ts +2 -0
- package/dist/generated/version.js +6 -0
- package/dist/grpc/proto/dshctl/v1/control.proto +133 -0
- package/dist/grpc/proto/dshguest/v1/guest.proto +79 -0
- package/dist/grpc/runtime-client.d.ts +5 -0
- package/dist/grpc/runtime-client.js +43 -0
- package/dist/guest-rpc.d.ts +62 -0
- package/dist/guest-rpc.js +391 -0
- package/dist/images.test.d.ts +1 -0
- package/dist/images.test.js +79 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +140 -0
- package/dist/misc.test.d.ts +1 -0
- package/dist/misc.test.js +141 -0
- package/dist/mount-enums.d.ts +22 -0
- package/dist/mount-enums.js +81 -0
- package/dist/mount-input.d.ts +14 -0
- package/dist/mount-input.js +64 -0
- package/dist/mounts.test.d.ts +1 -0
- package/dist/mounts.test.js +408 -0
- package/dist/output-reader.d.ts +34 -0
- package/dist/output-reader.js +87 -0
- package/dist/paths.test.d.ts +1 -0
- package/dist/paths.test.js +74 -0
- package/dist/preferences.d.ts +6 -0
- package/dist/preferences.js +27 -0
- package/dist/project-path.d.ts +6 -0
- package/dist/project-path.js +73 -0
- package/dist/project-path.test.d.ts +1 -0
- package/dist/project-path.test.js +52 -0
- package/dist/prompts.d.ts +13 -0
- package/dist/prompts.js +149 -0
- package/dist/public.d.ts +4 -0
- package/dist/public.js +63 -0
- package/dist/read-only-shell.d.ts +14 -0
- package/dist/read-only-shell.js +150 -0
- package/dist/read-only-shell.test.d.ts +1 -0
- package/dist/read-only-shell.test.js +127 -0
- package/dist/secrets.test.d.ts +1 -0
- package/dist/secrets.test.js +181 -0
- package/dist/settings-commands.test.d.ts +1 -0
- package/dist/settings-commands.test.js +549 -0
- package/dist/settings-create.test.d.ts +1 -0
- package/dist/settings-create.test.js +394 -0
- package/dist/settings-mounts.test.d.ts +1 -0
- package/dist/settings-mounts.test.js +467 -0
- package/dist/settings-paths.test.d.ts +1 -0
- package/dist/settings-paths.test.js +65 -0
- package/dist/settings-schema.d.ts +14 -0
- package/dist/settings-schema.js +14 -0
- package/dist/settings-workspaces.test.d.ts +1 -0
- package/dist/settings-workspaces.test.js +265 -0
- package/dist/spill-store.d.ts +17 -0
- package/dist/spill-store.js +54 -0
- package/dist/spill-store.test.d.ts +1 -0
- package/dist/spill-store.test.js +59 -0
- package/dist/subprocess.d.ts +9 -0
- package/dist/subprocess.js +369 -0
- package/dist/subprocess.test.d.ts +1 -0
- package/dist/subprocess.test.js +234 -0
- package/dist/test-support.d.ts +328 -0
- package/dist/test-support.js +437 -0
- package/dist/tool-defs.d.ts +26 -0
- package/dist/tool-defs.js +188 -0
- package/dist/tool-handlers.d.ts +2 -0
- package/dist/tool-handlers.js +546 -0
- package/dist/tool-params.d.ts +803 -0
- package/dist/tool-params.js +494 -0
- package/dist/tool-schemas.d.ts +2 -0
- package/dist/tool-schemas.js +5 -0
- package/dist/tool-views.d.ts +2 -0
- package/dist/tool-views.js +56 -0
- package/dist/views.test.d.ts +1 -0
- package/dist/views.test.js +23 -0
- package/dist/volumes.test.d.ts +1 -0
- package/dist/volumes.test.js +40 -0
- package/dist/workspace-binding.d.ts +40 -0
- package/dist/workspace-binding.js +275 -0
- package/dist/workspace-binding.test.d.ts +1 -0
- package/dist/workspace-binding.test.js +337 -0
- package/docs/architecture.md +173 -0
- package/docs/architecture.zh.md +129 -0
- package/docs/configuration.md +160 -0
- package/docs/configuration.zh.md +147 -0
- package/docs/development.md +142 -0
- package/docs/development.zh.md +135 -0
- package/docs/install-dsh-and-dsh-podman.md +165 -0
- package/docs/install-dsh-and-dsh-podman.zh.md +145 -0
- package/docs/usage.md +393 -0
- package/docs/usage.zh.md +315 -0
- package/package.json +119 -0
|
@@ -0,0 +1,241 @@
|
|
|
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 { useState } from "react";
|
|
6
|
+
import { DisclosureRow, IconApiOutline14, IconArchiveOutline20, IconBrowseOutline16, IconDataOutline16, IconEditOutline16, IconFolderOpenOutline16, IconLinkOutline16, IconPlayOutline16, IconPlusOutline16, IconRefreshOutline16, IconSearchOutline16, IconSparkle16, IconStopFill16, IconTrashOutline16, StateDot, TerminalBlock, } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
7
|
+
import { TERMINAL_CLASS } from "./terminal-styles.js";
|
|
8
|
+
const TOOL_PRESENTATION = {
|
|
9
|
+
container_bash: { titleKey: "toolTitle_container_bash", icon: _jsx(IconApiOutline14, { size: 14 }), summaryKeys: ["description", "command"] },
|
|
10
|
+
container_exec: { titleKey: "toolTitle_container_exec", icon: _jsx(IconApiOutline14, { size: 14 }), summaryKeys: ["description", "argv"] },
|
|
11
|
+
container_read: { titleKey: "toolTitle_container_read", icon: _jsx(IconBrowseOutline16, { size: 14 }), summaryKeys: ["file_path"] },
|
|
12
|
+
container_write: { titleKey: "toolTitle_container_write", icon: _jsx(IconEditOutline16, { size: 14 }), summaryKeys: ["file_path"] },
|
|
13
|
+
container_edit: { titleKey: "toolTitle_container_edit", icon: _jsx(IconEditOutline16, { size: 14 }), summaryKeys: ["file_path"] },
|
|
14
|
+
container_glob: { titleKey: "toolTitle_container_glob", icon: _jsx(IconSearchOutline16, { size: 14 }), summaryKeys: ["pattern"] },
|
|
15
|
+
container_grep: { titleKey: "toolTitle_container_grep", icon: _jsx(IconSearchOutline16, { size: 14 }), summaryKeys: ["pattern"] },
|
|
16
|
+
container_list: { titleKey: "toolTitle_container_list", icon: _jsx(IconDataOutline16, { size: 14 }), summaryKeys: [] },
|
|
17
|
+
container_start: { titleKey: "toolTitle_container_start", icon: _jsx(IconPlayOutline16, { size: 14 }), summaryKeys: ["container", "image"] },
|
|
18
|
+
container_recreate: { titleKey: "toolTitle_container_recreate", icon: _jsx(IconRefreshOutline16, { size: 14 }), summaryKeys: ["container", "image"] },
|
|
19
|
+
container_remove: { titleKey: "toolTitle_container_remove", icon: _jsx(IconTrashOutline16, { size: 14 }), summaryKeys: ["container"] },
|
|
20
|
+
container_mount_list: { titleKey: "toolTitle_container_mount_list", icon: _jsx(IconFolderOpenOutline16, { size: 14 }), summaryKeys: ["container"] },
|
|
21
|
+
container_mount_add: { titleKey: "toolTitle_container_mount_add", icon: _jsx(IconFolderOpenOutline16, { size: 14 }), summaryKeys: ["container", "kind"] },
|
|
22
|
+
container_mount_remove: { titleKey: "toolTitle_container_mount_remove", icon: _jsx(IconTrashOutline16, { size: 14 }), summaryKeys: ["container"] },
|
|
23
|
+
container_mount_update: { titleKey: "toolTitle_container_mount_update", icon: _jsx(IconRefreshOutline16, { size: 14 }), summaryKeys: ["container", "mode"] },
|
|
24
|
+
container_path_set: { titleKey: "toolTitle_container_path_set", icon: _jsx(IconEditOutline16, { size: 14 }), summaryKeys: ["container"] },
|
|
25
|
+
container_path_add: { titleKey: "toolTitle_container_path_add", icon: _jsx(IconPlusOutline16, { size: 14 }), summaryKeys: ["container", "path"] },
|
|
26
|
+
container_path_remove: { titleKey: "toolTitle_container_path_remove", icon: _jsx(IconTrashOutline16, { size: 14 }), summaryKeys: ["container", "path"] },
|
|
27
|
+
container_secret_add: { titleKey: "toolTitle_container_secret_add", icon: _jsx(IconLinkOutline16, { size: 14 }), summaryKeys: ["container", "env"] },
|
|
28
|
+
container_secret_remove: { titleKey: "toolTitle_container_secret_remove", icon: _jsx(IconLinkOutline16, { size: 14 }), summaryKeys: ["container", "env"] },
|
|
29
|
+
image_list: { titleKey: "toolTitle_image_list", icon: _jsx(IconArchiveOutline20, { size: 14 }), summaryKeys: [] },
|
|
30
|
+
image_get: { titleKey: "toolTitle_image_get", icon: _jsx(IconArchiveOutline20, { size: 14 }), summaryKeys: ["imageId"] },
|
|
31
|
+
image_build: { titleKey: "toolTitle_image_build", icon: _jsx(IconPlusOutline16, { size: 14 }), summaryKeys: ["imageId", "parent"] },
|
|
32
|
+
image_rebuild: { titleKey: "toolTitle_image_rebuild", icon: _jsx(IconRefreshOutline16, { size: 14 }), summaryKeys: ["imageId"] },
|
|
33
|
+
image_rebuild_all: { titleKey: "toolTitle_image_rebuild_all", icon: _jsx(IconRefreshOutline16, { size: 14 }), summaryKeys: [] },
|
|
34
|
+
image_remove: { titleKey: "toolTitle_image_remove", icon: _jsx(IconTrashOutline16, { size: 14 }), summaryKeys: ["imageId"] },
|
|
35
|
+
volume_list: { titleKey: "toolTitle_volume_list", icon: _jsx(IconDataOutline16, { size: 14 }), summaryKeys: [] },
|
|
36
|
+
volume_create: { titleKey: "toolTitle_volume_create", icon: _jsx(IconPlusOutline16, { size: 14 }), summaryKeys: ["name"] },
|
|
37
|
+
volume_remove: { titleKey: "toolTitle_volume_remove", icon: _jsx(IconTrashOutline16, { size: 14 }), summaryKeys: ["name"] },
|
|
38
|
+
secret_list: { titleKey: "toolTitle_secret_list", icon: _jsx(IconLinkOutline16, { size: 14 }), summaryKeys: [] },
|
|
39
|
+
secret_create: { titleKey: "toolTitle_secret_create", icon: _jsx(IconPlusOutline16, { size: 14 }), summaryKeys: ["name"] },
|
|
40
|
+
secret_remove: { titleKey: "toolTitle_secret_remove", icon: _jsx(IconTrashOutline16, { size: 14 }), summaryKeys: ["name"] },
|
|
41
|
+
daemon_start: { titleKey: "toolTitle_daemon_start", icon: _jsx(IconPlayOutline16, { size: 14 }), summaryKeys: ["name"] },
|
|
42
|
+
daemon_list: { titleKey: "toolTitle_daemon_list", icon: _jsx(IconPlayOutline16, { size: 14 }), summaryKeys: ["container"] },
|
|
43
|
+
daemon_logs: { titleKey: "toolTitle_daemon_logs", icon: _jsx(IconBrowseOutline16, { size: 14 }), summaryKeys: ["name"] },
|
|
44
|
+
daemon_restart: { titleKey: "toolTitle_daemon_restart", icon: _jsx(IconRefreshOutline16, { size: 14 }), summaryKeys: ["name"] },
|
|
45
|
+
daemon_stop: { titleKey: "toolTitle_daemon_stop", icon: _jsx(IconStopFill16, { size: 14 }), summaryKeys: ["name"] },
|
|
46
|
+
};
|
|
47
|
+
/** The wire tool names this package owns a row for. */
|
|
48
|
+
export const TOOL_VIEW_KEYS = Object.keys(TOOL_PRESENTATION);
|
|
49
|
+
const sepStyle = {
|
|
50
|
+
flex: "none",
|
|
51
|
+
width: "2px",
|
|
52
|
+
height: "2px",
|
|
53
|
+
borderRadius: "1px",
|
|
54
|
+
margin: "0 8px",
|
|
55
|
+
background: "var(--dsw-alias-label-caption)",
|
|
56
|
+
};
|
|
57
|
+
const summaryStyle = {
|
|
58
|
+
flex: "1 1 auto",
|
|
59
|
+
minWidth: 0,
|
|
60
|
+
overflow: "hidden",
|
|
61
|
+
textOverflow: "ellipsis",
|
|
62
|
+
whiteSpace: "nowrap",
|
|
63
|
+
fontSize: "14px",
|
|
64
|
+
lineHeight: "24px",
|
|
65
|
+
color: "var(--dsw-alias-label-tertiary)",
|
|
66
|
+
};
|
|
67
|
+
const errorSummaryStyle = {
|
|
68
|
+
...summaryStyle,
|
|
69
|
+
color: "var(--dsw-alias-state-error-primary)",
|
|
70
|
+
};
|
|
71
|
+
const bodyStyle = {
|
|
72
|
+
margin: 0,
|
|
73
|
+
padding: "8px 10px",
|
|
74
|
+
maxHeight: "320px",
|
|
75
|
+
overflow: "auto",
|
|
76
|
+
fontFamily: "var(--dsw-font-mono, monospace)",
|
|
77
|
+
fontSize: "12px",
|
|
78
|
+
lineHeight: 1.5,
|
|
79
|
+
whiteSpace: "pre-wrap",
|
|
80
|
+
wordBreak: "break-word",
|
|
81
|
+
background: "var(--dsw-alias-bg-layer-3)",
|
|
82
|
+
border: "1px solid var(--dsw-alias-border-l2)",
|
|
83
|
+
borderRadius: "8px",
|
|
84
|
+
};
|
|
85
|
+
const errorBodyStyle = {
|
|
86
|
+
...bodyStyle,
|
|
87
|
+
color: "var(--dsw-alias-state-error-primary)",
|
|
88
|
+
};
|
|
89
|
+
function firstLine(text) {
|
|
90
|
+
const newline = text.indexOf("\n");
|
|
91
|
+
return newline === -1 ? text : text.slice(0, newline);
|
|
92
|
+
}
|
|
93
|
+
function parseArgs(argsRaw) {
|
|
94
|
+
try {
|
|
95
|
+
const parsed = JSON.parse(argsRaw);
|
|
96
|
+
return typeof parsed === "object" && parsed !== null
|
|
97
|
+
? parsed
|
|
98
|
+
: {};
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return {};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function argSummary(args, keys, fallback) {
|
|
105
|
+
for (const key of keys) {
|
|
106
|
+
const value = args[key];
|
|
107
|
+
if (typeof value === "string" && value !== "")
|
|
108
|
+
return firstLine(value);
|
|
109
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
110
|
+
return firstLine(value.map((item) => String(item)).join(" "));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return fallback;
|
|
114
|
+
}
|
|
115
|
+
function resultText(block) {
|
|
116
|
+
if (!("kind" in block))
|
|
117
|
+
return null;
|
|
118
|
+
const parts = [];
|
|
119
|
+
for (const item of block.content) {
|
|
120
|
+
parts.push(item.type === "text" ? item.text : JSON.stringify(item, null, 2));
|
|
121
|
+
}
|
|
122
|
+
if (parts.length === 0 && block.error !== undefined) {
|
|
123
|
+
parts.push(`${block.error.name}: ${block.error.code}`);
|
|
124
|
+
}
|
|
125
|
+
return parts.join("\n") || null;
|
|
126
|
+
}
|
|
127
|
+
// Command results are JSON `{exitCode, signal, stdout, stderr}`; show the
|
|
128
|
+
// streams rather than the raw envelope when that shape is recognised.
|
|
129
|
+
function prettyOutput(text) {
|
|
130
|
+
if (text === null)
|
|
131
|
+
return null;
|
|
132
|
+
try {
|
|
133
|
+
const data = JSON.parse(text);
|
|
134
|
+
if (typeof data === "object" && data !== null) {
|
|
135
|
+
const record = data;
|
|
136
|
+
if ("stdout" in record || "stderr" in record) {
|
|
137
|
+
return [record.stdout, record.stderr]
|
|
138
|
+
.filter((value) => typeof value === "string" && value !== "")
|
|
139
|
+
.join("");
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
// Not JSON: fall through to the raw text.
|
|
145
|
+
}
|
|
146
|
+
return text;
|
|
147
|
+
}
|
|
148
|
+
function terminalCard(toolName, args, block, cwd) {
|
|
149
|
+
if (toolName !== "container_bash" && toolName !== "container_exec")
|
|
150
|
+
return null;
|
|
151
|
+
const command = toolName === "container_bash"
|
|
152
|
+
? typeof args.command === "string"
|
|
153
|
+
? args.command
|
|
154
|
+
: ""
|
|
155
|
+
: Array.isArray(args.argv)
|
|
156
|
+
? args.argv.map((word) => String(word)).join(" ")
|
|
157
|
+
: "";
|
|
158
|
+
const workdir = typeof args.workdir === "string" && args.workdir !== ""
|
|
159
|
+
? args.workdir
|
|
160
|
+
: undefined;
|
|
161
|
+
const base = {
|
|
162
|
+
command,
|
|
163
|
+
cwd: workdir ?? cwd,
|
|
164
|
+
running: !("kind" in block),
|
|
165
|
+
};
|
|
166
|
+
if (!("kind" in block))
|
|
167
|
+
return base;
|
|
168
|
+
// A failed call keeps the generic error path (red summary + red body).
|
|
169
|
+
if (block.isError)
|
|
170
|
+
return null;
|
|
171
|
+
const text = resultText(block);
|
|
172
|
+
if (text === null)
|
|
173
|
+
return null;
|
|
174
|
+
try {
|
|
175
|
+
const data = JSON.parse(text);
|
|
176
|
+
if (typeof data !== "object" || data === null)
|
|
177
|
+
return null;
|
|
178
|
+
const record = data;
|
|
179
|
+
const output = [record.stdout, record.stderr]
|
|
180
|
+
.filter((value) => typeof value === "string" && value !== "")
|
|
181
|
+
.join("");
|
|
182
|
+
const signal = typeof record.signal === "string" && record.signal !== ""
|
|
183
|
+
? record.signal
|
|
184
|
+
: undefined;
|
|
185
|
+
return {
|
|
186
|
+
...base,
|
|
187
|
+
output,
|
|
188
|
+
...(signal !== undefined
|
|
189
|
+
? { signal }
|
|
190
|
+
: { exitCode: typeof record.exitCode === "number" ? record.exitCode : 0 }),
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// Terminal card copy, mirroring ui-tool's terminalBlockLabels; `copy`, `copied`
|
|
198
|
+
// and `collapse` resolve from the shared common vocabulary.
|
|
199
|
+
function terminalLabels(t) {
|
|
200
|
+
return {
|
|
201
|
+
signal: (signal) => t("terminalSignal", { signal }),
|
|
202
|
+
exitCode: (code) => t("terminalExitCode", { code }),
|
|
203
|
+
running: t("terminalRunning"),
|
|
204
|
+
failed: t("terminalFailed"),
|
|
205
|
+
done: t("terminalDone"),
|
|
206
|
+
copy: t("copy"),
|
|
207
|
+
copied: t("copied"),
|
|
208
|
+
noOutput: t("terminalNoOutput"),
|
|
209
|
+
collapseAria: t("terminalCollapseAria"),
|
|
210
|
+
collapse: t("collapse"),
|
|
211
|
+
expandAria: (hidden) => t("terminalExpandAria", { n: hidden }),
|
|
212
|
+
expand: (hidden) => t("terminalExpandRest", { n: hidden }),
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
/** Render one podman tool call as an icon-titled, expandable row. */
|
|
216
|
+
export function PodmanToolRow({ toolName, block, cwd, home, inspect, t, }) {
|
|
217
|
+
const presentation = TOOL_PRESENTATION[toolName];
|
|
218
|
+
const title = presentation === undefined ? toolName : t(presentation.titleKey);
|
|
219
|
+
const settled = "kind" in block;
|
|
220
|
+
const argsRaw = ((settled ? block.call?.argsRaw : block.argsRaw) ?? "");
|
|
221
|
+
const args = parseArgs(argsRaw);
|
|
222
|
+
const terminal = terminalCard(toolName, args, block, cwd);
|
|
223
|
+
const state = !settled
|
|
224
|
+
? "running"
|
|
225
|
+
: block.error?.code === "interrupted"
|
|
226
|
+
? "stopped"
|
|
227
|
+
: block.isError
|
|
228
|
+
? "error"
|
|
229
|
+
: "done";
|
|
230
|
+
const output = prettyOutput(resultText(block));
|
|
231
|
+
const failureLine = state === "error" && output !== null && output !== ""
|
|
232
|
+
? firstLine(output)
|
|
233
|
+
: null;
|
|
234
|
+
const summary = failureLine ??
|
|
235
|
+
argSummary(args, presentation?.summaryKeys ?? [], firstLine(argsRaw) || block.callId);
|
|
236
|
+
const [expanded, setExpanded] = useState(false);
|
|
237
|
+
const expandable = terminal !== null || (output !== null && output !== "");
|
|
238
|
+
const leading = state === "error" ? (_jsx(StateDot, { state: "error" })) : state === "stopped" ? (_jsx(StateDot, { state: "warning" })) : (presentation?.icon ?? _jsx(IconSparkle16, { size: 14 }));
|
|
239
|
+
void inspect;
|
|
240
|
+
return (_jsx(DisclosureRow, { icon: leading, title: title, open: expanded && expandable, expandable: expandable, onToggle: () => setExpanded((value) => !value), expandOnRowClick: true, keepContentWhenOpen: true, collapsedContent: _jsxs(_Fragment, { children: [_jsx("span", { style: sepStyle, "aria-hidden": true }), _jsx("span", { style: failureLine !== null ? errorSummaryStyle : summaryStyle, children: summary })] }), children: terminal !== null ? (_jsx(TerminalBlock, { command: terminal.command, cwd: terminal.cwd, home: home, output: terminal.output, exitCode: terminal.exitCode, signal: terminal.signal, running: terminal.running, maxLines: Infinity, className: TERMINAL_CLASS, labels: terminalLabels(t) })) : expandable ? (_jsx("pre", { style: state === "error" ? errorBodyStyle : bodyStyle, children: output })) : null }));
|
|
241
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|