@exagone313/dsh-podman 1.2.0 → 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.
- package/dist/card-route.d.ts +8 -0
- package/dist/card-route.js +19 -8
- package/dist/client/ContainerCard.js +147 -110
- package/dist/client/card-protocol.d.ts +4 -0
- package/dist/client/card-protocol.js +34 -0
- package/dist/client/container-card-caches.d.ts +1 -1
- package/dist/client/container-card-caches.js +19 -17
- package/dist/client/container-card-config.d.ts +47 -0
- package/dist/client/container-card-config.js +160 -0
- package/dist/client/container-card-controller.d.ts +35 -3
- package/dist/client/container-card-controller.js +263 -41
- package/dist/client/container-card-create-modal.d.ts +5 -1
- package/dist/client/container-card-create-modal.js +111 -94
- package/dist/client/container-card-defaults.d.ts +16 -0
- package/dist/client/container-card-defaults.js +147 -0
- package/dist/client/container-card-dialog-styles.d.ts +7 -0
- package/dist/client/container-card-dialog-styles.js +70 -0
- package/dist/client/container-card-dialog.d.ts +12 -0
- package/dist/client/container-card-dialog.js +47 -0
- package/dist/client/container-card-directory-styles.d.ts +1 -1
- package/dist/client/container-card-directory-styles.js +5 -5
- package/dist/client/container-card-directory.js +8 -7
- package/dist/client/container-card-edit-modal.d.ts +39 -0
- package/dist/client/container-card-edit-modal.js +29 -0
- package/dist/client/container-card-editors.d.ts +5 -2
- package/dist/client/container-card-editors.js +109 -134
- package/dist/client/container-card-field-styles.d.ts +7 -0
- package/dist/client/container-card-field-styles.js +63 -0
- package/dist/client/container-card-form.d.ts +47 -0
- package/dist/client/container-card-form.js +61 -0
- package/dist/client/container-card-group.d.ts +9 -0
- package/dist/client/container-card-group.js +22 -0
- package/dist/client/container-card-images.d.ts +6 -2
- package/dist/client/container-card-images.js +63 -23
- package/dist/client/container-card-paths.js +43 -52
- package/dist/client/container-card-ports.d.ts +3 -4
- package/dist/client/container-card-ports.js +74 -38
- package/dist/client/container-card-resources.d.ts +38 -0
- package/dist/client/container-card-resources.js +73 -0
- package/dist/client/container-card-row.d.ts +11 -19
- package/dist/client/container-card-row.js +122 -122
- package/dist/client/container-card-secrets.d.ts +31 -3
- package/dist/client/container-card-secrets.js +174 -56
- package/dist/client/container-card-shared.d.ts +173 -6
- package/dist/client/container-card-shared.js +616 -57
- package/dist/client/container-card-status.d.ts +18 -0
- package/dist/client/container-card-status.js +166 -0
- package/dist/client/container-card-styles.d.ts +49 -7
- package/dist/client/container-card-styles.js +396 -40
- package/dist/client/container-card-table-styles.d.ts +15 -0
- package/dist/client/container-card-table-styles.js +237 -0
- package/dist/client/container-card-tabs-styles.d.ts +5 -0
- package/dist/client/container-card-tabs-styles.js +46 -0
- package/dist/client/container-card-toast.d.ts +5 -0
- package/dist/client/container-card-toast.js +10 -0
- package/dist/client/container-card-volumes.d.ts +1 -0
- package/dist/client/container-card-volumes.js +14 -19
- package/dist/client/container-card-workspace.d.ts +8 -12
- package/dist/client/container-card-workspace.js +76 -14
- package/dist/client/index.js +6488 -3474
- package/dist/client/locales.d.ts +10 -1
- package/dist/client/locales.js +268 -114
- package/dist/client/relative-time.d.ts +10 -0
- package/dist/client/relative-time.js +74 -0
- package/dist/client/slot-contract.d.ts +8 -0
- package/dist/client/tool-views.js +1 -1
- package/dist/container-env.js +1 -1
- package/dist/env-rows.d.ts +9 -11
- package/dist/env-rows.js +72 -40
- package/dist/generated/version.d.ts +2 -2
- package/dist/generated/version.js +2 -2
- package/dist/guest-terminal.js +1 -1
- package/dist/mount-enums.d.ts +11 -0
- package/dist/mount-enums.js +60 -0
- package/dist/subprocess.js +1 -1
- package/dist/terminal-sessions.js +2 -2
- package/dist/terminal-shells.js +1 -1
- package/dist/tool-handlers.js +1 -1
- package/dist/workspace-binding.js +2 -2
- package/docs/architecture.md +6 -4
- package/docs/architecture.zh.md +3 -1
- package/docs/configuration.md +28 -25
- package/docs/configuration.zh.md +15 -11
- package/docs/development-prompt.md +9 -7
- package/docs/development-prompt.zh.md +9 -7
- package/docs/development.md +25 -18
- package/docs/development.zh.md +22 -18
- package/docs/install-dsh-and-dsh-podman.md +15 -12
- package/docs/install-dsh-and-dsh-podman.zh.md +15 -9
- package/docs/uninstall.md +2 -0
- package/docs/uninstall.zh.md +2 -0
- package/docs/update.md +2 -0
- package/docs/update.zh.md +2 -0
- package/docs/usage.md +191 -39
- package/docs/usage.zh.md +150 -29
- package/package.json +8 -4
- package/dist/client/container-card-default-env.d.ts +0 -10
- package/dist/client/container-card-default-env.js +0 -69
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Elouan Martinet <exa@elou.world>
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: MIT
|
|
4
|
+
// A relative creation time in the reader's own language. The exact instant
|
|
5
|
+
// stays available beside it — a container field copies it, a build time keeps
|
|
6
|
+
// it as a title tooltip — so this never has to be precise: it names the moment
|
|
7
|
+
// the way a person would ("5 minutes ago", "today", "yesterday").
|
|
8
|
+
const MINUTE = 60_000;
|
|
9
|
+
const HOUR = 60 * MINUTE;
|
|
10
|
+
const DAY = 24 * HOUR;
|
|
11
|
+
const MONTH = 30 * DAY;
|
|
12
|
+
const YEAR = 365 * DAY;
|
|
13
|
+
// Constructing a formatter is the expensive part, so the ones already built are
|
|
14
|
+
// kept per locale. A locale the runtime refuses falls back to its default,
|
|
15
|
+
// which is also what an empty locale asks for.
|
|
16
|
+
const formatters = new Map();
|
|
17
|
+
function formatter(locale) {
|
|
18
|
+
const cached = formatters.get(locale);
|
|
19
|
+
if (cached !== undefined)
|
|
20
|
+
return cached;
|
|
21
|
+
let created;
|
|
22
|
+
try {
|
|
23
|
+
created = new Intl.RelativeTimeFormat(locale === "" ? undefined : locale, {
|
|
24
|
+
numeric: "auto",
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
try {
|
|
29
|
+
created = new Intl.RelativeTimeFormat(undefined, { numeric: "auto" });
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// A runtime without Intl.RelativeTimeFormat at all: the caller shows the
|
|
33
|
+
// raw timestamp rather than a guessed label.
|
|
34
|
+
created = undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (created !== undefined)
|
|
38
|
+
formatters.set(locale, created);
|
|
39
|
+
return created;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The relative creation time of a container, e.g. "5 minutes ago", "today" or
|
|
43
|
+
* "yesterday". A stamp the browser cannot read, and a runtime without
|
|
44
|
+
* {@link Intl.RelativeTimeFormat}, both fall back to the raw value.
|
|
45
|
+
*
|
|
46
|
+
* @param createdAt - the container's timestamp, as the snapshot reported it.
|
|
47
|
+
* @param locale - the plugin's active locale; "" asks for the runtime default.
|
|
48
|
+
* @param now - the current instant, injected for pure rendering.
|
|
49
|
+
*/
|
|
50
|
+
export function relativeTimeLabel(createdAt, locale, now = Date.now()) {
|
|
51
|
+
const at = Date.parse(createdAt);
|
|
52
|
+
if (Number.isNaN(at))
|
|
53
|
+
return createdAt;
|
|
54
|
+
const format = formatter(locale);
|
|
55
|
+
if (format === undefined)
|
|
56
|
+
return createdAt;
|
|
57
|
+
// A clock ahead of this browser must not read as a future creation.
|
|
58
|
+
const elapsed = Math.max(0, now - at);
|
|
59
|
+
// A moment ago is named as today: that is how a creation time reads, and the
|
|
60
|
+
// exact instant still sits beside it.
|
|
61
|
+
if (elapsed < MINUTE)
|
|
62
|
+
return format.format(0, "day");
|
|
63
|
+
if (elapsed < HOUR) {
|
|
64
|
+
return format.format(-Math.floor(elapsed / MINUTE), "minute");
|
|
65
|
+
}
|
|
66
|
+
if (elapsed < DAY)
|
|
67
|
+
return format.format(-Math.floor(elapsed / HOUR), "hour");
|
|
68
|
+
if (elapsed < MONTH)
|
|
69
|
+
return format.format(-Math.floor(elapsed / DAY), "day");
|
|
70
|
+
if (elapsed < YEAR) {
|
|
71
|
+
return format.format(-Math.floor(elapsed / MONTH), "month");
|
|
72
|
+
}
|
|
73
|
+
return format.format(-Math.floor(elapsed / YEAR), "year");
|
|
74
|
+
}
|
|
@@ -121,7 +121,7 @@ function argSummary(args, keys, fallback) {
|
|
|
121
121
|
const value = args[key];
|
|
122
122
|
if (typeof value === "string" && value !== "")
|
|
123
123
|
return firstLine(value);
|
|
124
|
-
// Numeric operands (a
|
|
124
|
+
// Numeric operands (a container port) are JSON numbers, not strings.
|
|
125
125
|
if (typeof value === "number")
|
|
126
126
|
return String(value);
|
|
127
127
|
if (Array.isArray(value) && value.length > 0) {
|
package/dist/container-env.js
CHANGED
|
@@ -18,7 +18,7 @@ export function mergeDefaultEnv(defaults, env) {
|
|
|
18
18
|
continue;
|
|
19
19
|
merged[key] = value;
|
|
20
20
|
}
|
|
21
|
-
return { ...merged, ...
|
|
21
|
+
return { ...merged, ...env };
|
|
22
22
|
}
|
|
23
23
|
// missingDefaultEnv returns the defaults a container does not have yet, so a
|
|
24
24
|
// synchronisation can add exactly those and never overwrite an existing value.
|
package/dist/env-rows.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare function orderedEnvEntries(env: Record<string, string>): [string, string][];
|
|
2
|
+
export declare function orderedEnvRecord(env: Record<string, string>): Record<string, string>;
|
|
3
|
+
export interface EnvEditRow {
|
|
4
|
+
id: number;
|
|
2
5
|
key: string;
|
|
3
6
|
value: string;
|
|
4
7
|
}
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function envKeyAvailable(env: Record<string, string>, key: string): boolean;
|
|
11
|
-
export declare function commitEnvDraft(env: Record<string, string>, draft: EnvDraft): Record<string, string> | undefined;
|
|
12
|
-
export declare function renameEnvKey(env: Record<string, string>, index: number, key: string): Record<string, string>;
|
|
13
|
-
export declare function setEnvValue(env: Record<string, string>, index: number, value: string): Record<string, string>;
|
|
14
|
-
export declare function removeEnvRow(env: Record<string, string>, index: number): Record<string, string>;
|
|
8
|
+
export declare function envEditRows(env: Record<string, string>): EnvEditRow[];
|
|
9
|
+
export declare function emptyEnvRow(): EnvEditRow;
|
|
10
|
+
export declare function envRecordFromRows(rows: readonly EnvEditRow[]): Record<string, string>;
|
|
11
|
+
export declare function conflictingEnvNames(names: readonly string[]): Set<string>;
|
|
12
|
+
export declare function firstDuplicateEnvName(names: readonly string[]): string | undefined;
|
package/dist/env-rows.js
CHANGED
|
@@ -1,52 +1,84 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Elouan Martinet <exa@elou.world>
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: MIT
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
// The environment and secret environment editors' row model, kept out of the
|
|
5
|
+
// components so the rules stay testable: a row owns the draft, so a key that is
|
|
6
|
+
// retyped — emptied, or renamed onto a name already used — keeps its place in
|
|
7
|
+
// the list until the user removes it, and the parent record is derived from the
|
|
8
|
+
// rows whose key is non-empty.
|
|
9
|
+
// The order a container block lists an environment map in: by variable name,
|
|
10
|
+
// case-insensitively and ascending, so a reload of the snapshot never shuffles
|
|
11
|
+
// the rows. The create dialogs seed their draft in it too, so a seeded default
|
|
12
|
+
// reads where the block lists it. It is display-only: an edit keeps the row
|
|
13
|
+
// order the draft is given, so a staged row never moves.
|
|
14
|
+
export function orderedEnvEntries(env) {
|
|
15
|
+
return Object.entries(env).sort(([left], [right]) => {
|
|
16
|
+
const a = left.toLowerCase();
|
|
17
|
+
const b = right.toLowerCase();
|
|
18
|
+
if (a !== b)
|
|
19
|
+
return a < b ? -1 : 1;
|
|
20
|
+
// Two names that differ only by case still read in one fixed order.
|
|
21
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
// orderedEnvRecord is the same order as a fresh record, so a seeded draft lists
|
|
25
|
+
// its rows exactly as the container block shows them.
|
|
26
|
+
export function orderedEnvRecord(env) {
|
|
27
|
+
return Object.fromEntries(orderedEnvEntries(env));
|
|
6
28
|
}
|
|
7
|
-
|
|
8
|
-
|
|
29
|
+
let nextEnvRowId = 0;
|
|
30
|
+
// envEditRows wraps a record's entries for editing, in the order a container
|
|
31
|
+
// block lists them — by variable name, case-insensitively and ascending — each
|
|
32
|
+
// with its own id. This is the one place an editor builds its rows, so the
|
|
33
|
+
// dialog opens in the order the block shows and no later change re-sorts them.
|
|
34
|
+
export function envEditRows(env) {
|
|
35
|
+
return orderedEnvEntries(env).map(([key, value]) => ({
|
|
36
|
+
id: nextEnvRowId++,
|
|
9
37
|
key,
|
|
10
38
|
value,
|
|
11
|
-
pending: false,
|
|
12
39
|
}));
|
|
13
|
-
if (draft !== undefined)
|
|
14
|
-
rows.push({ ...draft, pending: true });
|
|
15
|
-
return rows;
|
|
16
|
-
}
|
|
17
|
-
// Whether a draft's key can become a variable: non-empty and not already used.
|
|
18
|
-
export function envKeyAvailable(env, key) {
|
|
19
|
-
return key !== "" && !Object.prototype.hasOwnProperty.call(env, key);
|
|
20
40
|
}
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (!envKeyAvailable(env, draft.key))
|
|
26
|
-
return undefined;
|
|
27
|
-
return { ...env, [draft.key]: draft.value };
|
|
41
|
+
// emptyEnvRow is the row an editor appends: unnamed and empty, waiting for the
|
|
42
|
+
// name that makes it a variable.
|
|
43
|
+
export function emptyEnvRow() {
|
|
44
|
+
return { id: nextEnvRowId++, key: "", value: "" };
|
|
28
45
|
}
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
return next;
|
|
46
|
+
// envRecordFromRows derives the variables an editor commits from its rows: a
|
|
47
|
+
// row is committed only while its key is non-empty, so a row left unnamed is
|
|
48
|
+
// never applied, and a name two rows repeat commits the last of them while the
|
|
49
|
+
// duplicate check refuses the apply in the meantime.
|
|
50
|
+
export function envRecordFromRows(rows) {
|
|
51
|
+
return Object.fromEntries(rows.filter((row) => row.key !== "").map((row) => [row.key, row.value]));
|
|
37
52
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
53
|
+
// Every name a container's environment will hold, across both the environment
|
|
54
|
+
// variables and the secret environment variables, each editor contributing its
|
|
55
|
+
// rows as they are typed. A name is a conflict when it is empty or when it is
|
|
56
|
+
// listed more than once; both end up refused by the dialog's action, so both
|
|
57
|
+
// groups check the same list.
|
|
58
|
+
export function conflictingEnvNames(names) {
|
|
59
|
+
const seen = new Set();
|
|
60
|
+
const conflicts = new Set();
|
|
61
|
+
for (const name of names) {
|
|
62
|
+
if (name === "")
|
|
63
|
+
conflicts.add(name);
|
|
64
|
+
else if (seen.has(name))
|
|
65
|
+
conflicts.add(name);
|
|
66
|
+
else
|
|
67
|
+
seen.add(name);
|
|
68
|
+
}
|
|
69
|
+
return conflicts;
|
|
44
70
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
71
|
+
// The first name the list repeats, in the order given, or undefined when every
|
|
72
|
+
// name is distinct. An empty name is left to the required-name message, so the
|
|
73
|
+
// duplicate message always names a real variable.
|
|
74
|
+
export function firstDuplicateEnvName(names) {
|
|
75
|
+
const seen = new Set();
|
|
76
|
+
for (const name of names) {
|
|
77
|
+
if (name === "")
|
|
78
|
+
continue;
|
|
79
|
+
if (seen.has(name))
|
|
80
|
+
return name;
|
|
81
|
+
seen.add(name);
|
|
82
|
+
}
|
|
83
|
+
return undefined;
|
|
52
84
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
2
|
-
export declare const GIT_COMMIT = "
|
|
1
|
+
export declare const VERSION = "1.3.0";
|
|
2
|
+
export declare const GIT_COMMIT = "cf0e325";
|
package/dist/guest-terminal.js
CHANGED
|
@@ -96,7 +96,7 @@ export function openGuestTerminal(binding, options) {
|
|
|
96
96
|
call.on("end", () => {
|
|
97
97
|
settle(new Error("terminal stream ended before the process exited"));
|
|
98
98
|
});
|
|
99
|
-
const env = { ...
|
|
99
|
+
const env = { ...options.env };
|
|
100
100
|
if (options.terminalType !== undefined &&
|
|
101
101
|
options.terminalType !== "" &&
|
|
102
102
|
env.TERM === undefined) {
|
package/dist/mount-enums.d.ts
CHANGED
|
@@ -20,3 +20,14 @@ export declare function mountModeToProto(mode: string | undefined): string;
|
|
|
20
20
|
export declare function mountKindFromProto(proto: string | undefined): string | undefined;
|
|
21
21
|
/** The logical mount mode for a proto enum value, or undefined when unspecified. */
|
|
22
22
|
export declare function mountModeFromProto(proto: string | undefined): string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* The logical mount kind for any spelling a decode can produce: the short name,
|
|
25
|
+
* the enum name with or without its MOUNT_KIND_ prefix, its numeric string, or
|
|
26
|
+
* the enum number. An unspecified or unknown kind reads as a project mount.
|
|
27
|
+
*/
|
|
28
|
+
export declare function normalizeMountKind(kind: unknown): string;
|
|
29
|
+
/**
|
|
30
|
+
* The logical mount mode for any spelling a decode can produce, mirroring
|
|
31
|
+
* normalizeMountKind. An unspecified or unknown mode reads as read-write.
|
|
32
|
+
*/
|
|
33
|
+
export declare function normalizeMountMode(mode: unknown): string;
|
package/dist/mount-enums.js
CHANGED
|
@@ -17,6 +17,31 @@ const KIND_FROM_PROTO = {
|
|
|
17
17
|
MOUNT_KIND_VOLUME: "volume",
|
|
18
18
|
MOUNT_KIND_SECRET: "secret",
|
|
19
19
|
};
|
|
20
|
+
// The logical names and the proto enum numbers a mount kind can decode to. A
|
|
21
|
+
// value reaches a layer in one of several spellings — the enum name with or
|
|
22
|
+
// without its MOUNT_KIND_ prefix, the short name, or the number a decoder that
|
|
23
|
+
// renders enums as integers produces — so normalisation is table-driven rather
|
|
24
|
+
// than inferred from which source field happens to be filled.
|
|
25
|
+
const MOUNT_KIND_NAMES = {
|
|
26
|
+
project: "project",
|
|
27
|
+
tmpfs: "tmpfs",
|
|
28
|
+
volume: "volume",
|
|
29
|
+
secret: "secret",
|
|
30
|
+
};
|
|
31
|
+
const MOUNT_KIND_NUMBERS = {
|
|
32
|
+
1: "project",
|
|
33
|
+
2: "tmpfs",
|
|
34
|
+
3: "volume",
|
|
35
|
+
4: "secret",
|
|
36
|
+
};
|
|
37
|
+
const MOUNT_MODE_NAMES = {
|
|
38
|
+
read_only: "read_only",
|
|
39
|
+
read_write: "read_write",
|
|
40
|
+
};
|
|
41
|
+
const MOUNT_MODE_NUMBERS = {
|
|
42
|
+
1: "read_only",
|
|
43
|
+
2: "read_write",
|
|
44
|
+
};
|
|
20
45
|
const MODE_FROM_PROTO = {
|
|
21
46
|
MOUNT_MODE_READ_ONLY: "read_only",
|
|
22
47
|
MOUNT_MODE_READ_WRITE: "read_write",
|
|
@@ -80,3 +105,38 @@ export function mountModeFromProto(proto) {
|
|
|
80
105
|
? MODE_FROM_PROTO[proto]
|
|
81
106
|
: undefined;
|
|
82
107
|
}
|
|
108
|
+
// lookupNormalized resolves a value against one short-name table and one enum
|
|
109
|
+
// number table, accepting either a string (short or prefixed enum name, or a
|
|
110
|
+
// numeric string) or a number. Anything unrecognised uses the fallback, so an
|
|
111
|
+
// unknown enum number can never be read as a different kind by accident.
|
|
112
|
+
function lookupNormalized(value, names, numbers, prefix, fallback) {
|
|
113
|
+
if (typeof value === "number")
|
|
114
|
+
return numbers[value] ?? fallback;
|
|
115
|
+
if (typeof value !== "string")
|
|
116
|
+
return fallback;
|
|
117
|
+
const short = value.startsWith(prefix)
|
|
118
|
+
? value.slice(prefix.length).toLowerCase()
|
|
119
|
+
: value.toLowerCase();
|
|
120
|
+
if (Object.prototype.hasOwnProperty.call(names, short))
|
|
121
|
+
return names[short];
|
|
122
|
+
const numeric = Number(value);
|
|
123
|
+
if (value !== "" && Number.isInteger(numeric)) {
|
|
124
|
+
return numbers[numeric] ?? fallback;
|
|
125
|
+
}
|
|
126
|
+
return fallback;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The logical mount kind for any spelling a decode can produce: the short name,
|
|
130
|
+
* the enum name with or without its MOUNT_KIND_ prefix, its numeric string, or
|
|
131
|
+
* the enum number. An unspecified or unknown kind reads as a project mount.
|
|
132
|
+
*/
|
|
133
|
+
export function normalizeMountKind(kind) {
|
|
134
|
+
return lookupNormalized(kind, MOUNT_KIND_NAMES, MOUNT_KIND_NUMBERS, "MOUNT_KIND_", "project");
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* The logical mount mode for any spelling a decode can produce, mirroring
|
|
138
|
+
* normalizeMountKind. An unspecified or unknown mode reads as read-write.
|
|
139
|
+
*/
|
|
140
|
+
export function normalizeMountMode(mode) {
|
|
141
|
+
return lookupNormalized(mode, MOUNT_MODE_NAMES, MOUNT_MODE_NUMBERS, "MOUNT_MODE_", "read_write");
|
|
142
|
+
}
|
package/dist/subprocess.js
CHANGED
|
@@ -13,7 +13,7 @@ export function createSubprocessProvider(resolver) {
|
|
|
13
13
|
const live = new Set();
|
|
14
14
|
return {
|
|
15
15
|
dispose: () => {
|
|
16
|
-
for (const terminate of
|
|
16
|
+
for (const terminate of Array.from(live))
|
|
17
17
|
terminate();
|
|
18
18
|
},
|
|
19
19
|
// The harness's resolveExecutable carries no cwd, and this provider's
|
|
@@ -224,7 +224,7 @@ export class TerminalSessions {
|
|
|
224
224
|
/** Close every terminal and stop the retention sweep. */
|
|
225
225
|
dispose() {
|
|
226
226
|
clearInterval(this.sweep);
|
|
227
|
-
for (const entry of
|
|
227
|
+
for (const entry of Array.from(this.entries.values())) {
|
|
228
228
|
this.entries.delete(entry.key);
|
|
229
229
|
this.byId.delete(entry.terminalId);
|
|
230
230
|
void entry.terminal.terminate();
|
|
@@ -242,7 +242,7 @@ export class TerminalSessions {
|
|
|
242
242
|
// reap closes terminals no browser has attached for the retention window.
|
|
243
243
|
reap() {
|
|
244
244
|
const cutoff = Date.now() - this.retentionMs;
|
|
245
|
-
for (const entry of
|
|
245
|
+
for (const entry of Array.from(this.entries.values())) {
|
|
246
246
|
if (entry.listener === undefined && entry.lastUsed < cutoff) {
|
|
247
247
|
this.drop(entry.key);
|
|
248
248
|
void entry.terminal.terminate();
|
package/dist/terminal-shells.js
CHANGED
|
@@ -35,7 +35,7 @@ const PROBE_SCRIPT = [
|
|
|
35
35
|
"done",
|
|
36
36
|
"if [ -f /etc/shells ]; then",
|
|
37
37
|
" while IFS= read -r candidate; do",
|
|
38
|
-
' case $candidate in ""
|
|
38
|
+
' case $candidate in ""|#*) continue ;; esac',
|
|
39
39
|
' case $candidate in /*) [ -x "$candidate" ] && printf "%s\\t%s\\n" "${candidate##*/}" "$candidate" ;; esac',
|
|
40
40
|
" done < /etc/shells",
|
|
41
41
|
"fi",
|
package/dist/tool-handlers.js
CHANGED
|
@@ -8,7 +8,7 @@ import { publicContainer, publicDaemon, publicImage, publicMount, publicPublishe
|
|
|
8
8
|
import { portProtocolToProto } from "./publish-port.js";
|
|
9
9
|
import { grpc } from "./grpc/runtime-client.js";
|
|
10
10
|
import { defaultMountMode, mountKindToProto, mountModeToProto, } from "./mount-enums.js";
|
|
11
|
-
import { containerNotFound
|
|
11
|
+
import { containerNotFound } from "./workspace-binding.js";
|
|
12
12
|
// Cap on paths `container_glob` returns, matching the built-in glob tool's
|
|
13
13
|
// default result limit; `--sort=modified` makes the retained head the newest.
|
|
14
14
|
const GLOB_MAX_RESULTS = 100;
|
|
@@ -54,7 +54,7 @@ export class WorkspaceResolver {
|
|
|
54
54
|
// a removed (or recreated) workspace cannot serve stale rows.
|
|
55
55
|
forgetWorkspace(slug) {
|
|
56
56
|
const prefix = `${slug}:`;
|
|
57
|
-
for (const key of
|
|
57
|
+
for (const key of Array.from(this.containerBindings.keys())) {
|
|
58
58
|
if (key.startsWith(prefix))
|
|
59
59
|
this.containerBindings.delete(key);
|
|
60
60
|
}
|
|
@@ -148,7 +148,7 @@ export class WorkspaceResolver {
|
|
|
148
148
|
// creating it once. It deliberately stops at an "ensureContainer + build a
|
|
149
149
|
// binding" step: readiness is per-call, so a credential refresh can never
|
|
150
150
|
// recurse through this path.
|
|
151
|
-
resolveContainerBinding(slug, container, key,
|
|
151
|
+
resolveContainerBinding(slug, container, key, _signal) {
|
|
152
152
|
let entry = this.containerBindings.get(key);
|
|
153
153
|
if (entry === undefined) {
|
|
154
154
|
entry = this.buildContainerBinding(slug, container, key).catch((error) => {
|
package/docs/architecture.md
CHANGED
|
@@ -6,6 +6,8 @@ SPDX-License-Identifier: MIT
|
|
|
6
6
|
|
|
7
7
|
# Architecture
|
|
8
8
|
|
|
9
|
+
English | [中文](architecture.zh.md)
|
|
10
|
+
|
|
9
11
|
dsh-podman has four components:
|
|
10
12
|
|
|
11
13
|
| Component | Runs | What it does |
|
|
@@ -73,10 +75,10 @@ model reads the artifact back with the container file tools instead of a host
|
|
|
73
75
|
path the container cannot reach.
|
|
74
76
|
|
|
75
77
|
A workspace's pod is torn down when its last container is removed, or directly
|
|
76
|
-
through `RemoveWorkspace` (the Podman page's **Remove
|
|
77
|
-
the containers' daemons, removes the pod and its containers, cleans
|
|
78
|
-
directories, and drops the stored workspace. Volumes, secrets, and
|
|
79
|
-
are left untouched.
|
|
78
|
+
through `RemoveWorkspace` (the Podman page's **Remove containers** action),
|
|
79
|
+
which stops the containers' daemons, removes the pod and its containers, cleans
|
|
80
|
+
their socket directories, and drops the stored workspace. Volumes, secrets, and
|
|
81
|
+
project data are left untouched.
|
|
80
82
|
|
|
81
83
|
Beyond project mounts, a container can mount named volumes (prefixed
|
|
82
84
|
`DSH_PODMAN_VOLUME_PREFIX`, default `dsh-podman-`, and auto-created by podman on
|
package/docs/architecture.zh.md
CHANGED
|
@@ -6,6 +6,8 @@ SPDX-License-Identifier: MIT
|
|
|
6
6
|
|
|
7
7
|
# 架构
|
|
8
8
|
|
|
9
|
+
[English](architecture.md) | 中文
|
|
10
|
+
|
|
9
11
|
dsh-podman 由四个组件组成:
|
|
10
12
|
|
|
11
13
|
| 组件 | 运行位置 | 功能 |
|
|
@@ -57,7 +59,7 @@ UUID),因此其容器共享一个网络命名空间。每个工作区都有
|
|
|
57
59
|
`/tmp/dsh-podman/spill/<session>/`——因此模型会用容器文件工具读回该产物,而不是使用容器无法访问的主机路径。
|
|
58
60
|
|
|
59
61
|
工作区的 Pod 会在其最后一个容器被移除时拆除,也可直接通过
|
|
60
|
-
`RemoveWorkspace`(Podman 页面中的
|
|
62
|
+
`RemoveWorkspace`(Podman 页面中的 **移除容器**
|
|
61
63
|
操作)拆除:它会停止各容器的守护进程、移除 Pod 及其容器、清理它们的 socket
|
|
62
64
|
目录,并删除存储的工作区记录。卷、机密和项目数据保持不变。
|
|
63
65
|
|
package/docs/configuration.md
CHANGED
|
@@ -6,6 +6,8 @@ SPDX-License-Identifier: MIT
|
|
|
6
6
|
|
|
7
7
|
# Configuration
|
|
8
8
|
|
|
9
|
+
English | [中文](configuration.zh.md)
|
|
10
|
+
|
|
9
11
|
Environment variables use the `DSH_PODMAN_` prefix and are listed under the
|
|
10
12
|
component that reads them (a variable read by several components appears in each
|
|
11
13
|
of their sections). The plugin also exposes a few **UI settings** on its
|
|
@@ -30,32 +32,33 @@ cordis, then the environment variables below, then built-in defaults.
|
|
|
30
32
|
## Plugin (dsh client) — UI settings
|
|
31
33
|
|
|
32
34
|
Editable on the **dsh-podman** page (sidebar **Plugins** panel → **Installed**;
|
|
33
|
-
the images' Set
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
container
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
35
|
+
the images' **Set default** action and the **Default environment variables**
|
|
36
|
+
section):
|
|
37
|
+
|
|
38
|
+
| Setting | Default | Description |
|
|
39
|
+
| -------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
40
|
+
| `defaultImage` | `archlinux` | Image **short name** used for new workspaces; chosen from base and custom images via the images card's **Set default** action. When it is unset, the card names the effective default instead (the first base image, `archlinux`) |
|
|
41
|
+
| `uiLocale` | `""` | Plugin-managed active locale, written by the browser client so the host can render approval text in the session language (see [Approval](usage.md#approval)); not user-editable |
|
|
42
|
+
| `containerEnv` | `{}` | Default environment used for containers created from now on; see [Default environment variables](#default-environment-variables) |
|
|
43
|
+
|
|
44
|
+
### Default environment variables
|
|
45
|
+
|
|
46
|
+
`containerEnv` is one map of variables used for containers created from now on:
|
|
47
|
+
the default container of a new workspace and every named container. Existing
|
|
48
|
+
containers keep their own environment; a container's own `env` wins per key, and
|
|
49
|
+
a recreate stores exactly the environment it is given, so edit it in the
|
|
50
|
+
workspace and recreate to change or remove a value. The **Add container** and
|
|
51
|
+
**Create container** dialogs open their **Environment variables** group on these
|
|
52
|
+
defaults, so the values a new container inherits are visible; a value left alone
|
|
53
|
+
keeps the default and an edited one becomes part of that container's own
|
|
54
|
+
environment.
|
|
55
|
+
|
|
56
|
+
The Podman page's **Default environment variables** section edits it with the
|
|
57
|
+
same key/value rows a container uses: add or remove variables, then **Save** (or
|
|
51
58
|
**Discard**). **Git identity** fills `GIT_AUTHOR_NAME`, `GIT_AUTHOR_EMAIL`,
|
|
52
|
-
`GIT_COMMITTER_NAME` and `GIT_COMMITTER_EMAIL` from one name and one email
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
existing value; stopped containers are left for their next start. Every
|
|
56
|
-
workspace row offers the same action for its own containers. Reserved
|
|
57
|
-
`DSH_PODMAN*` keys are ignored, and the values are not secret — use `secretEnv`
|
|
58
|
-
for secrets (see [Secrets](usage.md#secrets)).
|
|
59
|
+
`GIT_COMMITTER_NAME` and `GIT_COMMITTER_EMAIL` from one name and one email.
|
|
60
|
+
Reserved `DSH_PODMAN*` keys are ignored, and the values are not secret — use
|
|
61
|
+
`secretEnv` for secrets (see [Secrets](usage.md#secrets)).
|
|
59
62
|
|
|
60
63
|
## Orchestrator (`dsh-podman-orchestrator`)
|
|
61
64
|
|
package/docs/configuration.zh.md
CHANGED
|
@@ -6,6 +6,8 @@ SPDX-License-Identifier: MIT
|
|
|
6
6
|
|
|
7
7
|
# 配置
|
|
8
8
|
|
|
9
|
+
[English](configuration.md) | 中文
|
|
10
|
+
|
|
9
11
|
环境变量使用 `DSH_PODMAN_`
|
|
10
12
|
前缀,并按读取它们的组件分组列出(被多个组件读取的变量会出现在每个组件的对应章节中)。插件还在
|
|
11
13
|
侧边栏 **插件** 面板 → **已安装** 中的 **dsh-podman** 页面中暴露了一些 **UI
|
|
@@ -27,28 +29,30 @@ SPDX-License-Identifier: MIT
|
|
|
27
29
|
|
|
28
30
|
## 插件(dsh 客户端)— UI 设置
|
|
29
31
|
|
|
30
|
-
可在侧边栏 **插件** 面板 → **已安装** 的 **dsh-podman**
|
|
31
|
-
Set
|
|
32
|
+
可在侧边栏 **插件** 面板 → **已安装** 的 **dsh-podman** 页面内编辑(镜像卡片的
|
|
33
|
+
**Set default** 操作和**默认环境变量**区块):
|
|
32
34
|
|
|
33
|
-
| 设置 | 默认值 | 说明
|
|
34
|
-
| -------------- | ----------- |
|
|
35
|
-
| `defaultImage` | `archlinux` |
|
|
36
|
-
| `uiLocale` | `""` | 插件管理的当前语言,由浏览器客户端写入,以便主机以会话语言呈现审批文本(见[审批](usage.zh.md#审批));不可由用户编辑
|
|
37
|
-
| `containerEnv` | `{}` |
|
|
35
|
+
| 设置 | 默认值 | 说明 |
|
|
36
|
+
| -------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
37
|
+
| `defaultImage` | `archlinux` | 用于新工作区的镜像**短名称**;可通过镜像卡片的 **Set default** 操作从基础镜像和自定义镜像中选择。未设置时,卡片会显示实际生效的默认镜像(首个基础镜像 `archlinux`) |
|
|
38
|
+
| `uiLocale` | `""` | 插件管理的当前语言,由浏览器客户端写入,以便主机以会话语言呈现审批文本(见[审批](usage.zh.md#审批));不可由用户编辑 |
|
|
39
|
+
| `containerEnv` | `{}` | 用于此后创建的容器的默认环境变量;见[默认环境变量](#默认环境变量) |
|
|
38
40
|
|
|
39
41
|
### 默认环境变量
|
|
40
42
|
|
|
41
43
|
`containerEnv`
|
|
42
|
-
|
|
44
|
+
是一个用于此后创建的容器的环境变量映射:新工作区的默认容器与每个命名容器都会收到它。已有容器保留各自的环境变量;容器自身的
|
|
43
45
|
`env`
|
|
44
|
-
|
|
46
|
+
按变量逐个优先,而重建容器时会完全采用传入的环境变量,因此请在工作区中编辑它并重建容器,以修改或移除某一项。**添加容器**
|
|
47
|
+
与 **创建容器** 对话框的 **环境变量**
|
|
48
|
+
分组会以这些默认值开头,使新容器将继承的值可见;不改动的值保留默认值,改动过的值成为该容器自身环境变量的一部分。
|
|
45
49
|
|
|
46
50
|
Podman
|
|
47
51
|
页面中的**默认环境变量**区块使用与容器相同的键/值行进行编辑:增删变量后点击**保存**(或**放弃**)。**Git
|
|
48
52
|
身份**用一份姓名与邮箱填入
|
|
49
53
|
`GIT_AUTHOR_NAME`、`GIT_AUTHOR_EMAIL`、`GIT_COMMITTER_NAME` 与
|
|
50
|
-
`GIT_COMMITTER_EMAIL
|
|
51
|
-
|
|
54
|
+
`GIT_COMMITTER_EMAIL`。保留的 `DSH_PODMAN*`
|
|
55
|
+
键会被忽略,且这些值并非机密——机密请使用
|
|
52
56
|
`secretEnv`(见[机密](usage.zh.md#机密))。
|
|
53
57
|
|
|
54
58
|
## Orchestrator(`dsh-podman-orchestrator`)
|