@eum-agent/web-shell 1.0.1 → 1.2.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/index.js +5 -28
- package/dist/schema.js +0 -24
- package/package.json +4 -4
- package/ui/ui.js +279 -78
package/dist/index.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { Changed, CloseParams, CloseTerminalsParams, CloseTerminalsResult, CreateParams, ListResult, OperationResult, OperationStatusesParams, OperationStatusesResult, RenameParams, RestartParams, RootsResult, TerminalInput, TerminalOpen, TerminalOutput, TerminalReady, TerminalSummary, WorkspaceId } from "./schema.js";
|
|
2
|
+
import nodePath, { dirname } from "node:path";
|
|
2
3
|
import { existsSync } from "node:fs";
|
|
3
4
|
import { userInfo } from "node:os";
|
|
4
5
|
import { fileURLToPath } from "node:url";
|
|
5
6
|
import { z } from "zod";
|
|
6
7
|
import { randomUUID } from "node:crypto";
|
|
7
|
-
import nodePath from "node:path";
|
|
8
8
|
//#region src/output.ts
|
|
9
9
|
const WINDOW = 4194304;
|
|
10
10
|
const BLOCK = 8192;
|
|
11
11
|
const HIGH = 524288;
|
|
12
12
|
const LOW = 131072;
|
|
13
|
-
/** Retains bounded UTF-8 replay and controls each independent consumer's output pressure. */
|
|
14
13
|
function createTerminalOutput(handle, summary, attachments) {
|
|
15
14
|
const chunks = [];
|
|
16
15
|
const observers = /* @__PURE__ */ new Map();
|
|
@@ -135,7 +134,6 @@ function createTerminalOutput(handle, summary, attachments) {
|
|
|
135
134
|
for (const observer of observers.values()) pump(observer);
|
|
136
135
|
});
|
|
137
136
|
return {
|
|
138
|
-
/** Atomically snapshots replay and subscribes one observer, with explicit writer ownership. */
|
|
139
137
|
open(params, context) {
|
|
140
138
|
if (ended || summary.status === "ended") throw new TerminalError("terminal-ended");
|
|
141
139
|
if (summary.status !== "running") throw new TerminalError("terminal-not-running");
|
|
@@ -213,20 +211,17 @@ function createTerminalOutput(handle, summary, attachments) {
|
|
|
213
211
|
});
|
|
214
212
|
}
|
|
215
213
|
},
|
|
216
|
-
/** Removes this observation only; the physical process remains owned by the directory. */
|
|
217
214
|
async close() {
|
|
218
215
|
detach(observer);
|
|
219
216
|
}
|
|
220
217
|
};
|
|
221
218
|
},
|
|
222
|
-
/** Publishes current status to attached consumers without adding replay history. */
|
|
223
219
|
status() {
|
|
224
220
|
for (const observer of observers.values()) send(observer, {
|
|
225
221
|
kind: "status",
|
|
226
222
|
terminal: structuredClone(summary)
|
|
227
223
|
});
|
|
228
224
|
},
|
|
229
|
-
/** Releases replay bytes and attachments after physical process-group cleanup is confirmed. */
|
|
230
225
|
end() {
|
|
231
226
|
ended = true;
|
|
232
227
|
unwatch();
|
|
@@ -245,8 +240,6 @@ function createTerminalOutput(handle, summary, attachments) {
|
|
|
245
240
|
}
|
|
246
241
|
//#endregion
|
|
247
242
|
//#region src/path-semantics.ts
|
|
248
|
-
/** Host path syntax only; resolved object identity remains the platform's responsibility. */
|
|
249
|
-
/** Requires an independent absolute root, excluding Windows drive-relative and root-relative forms. */
|
|
250
243
|
function isFullAbsolute(value, paths = nodePath) {
|
|
251
244
|
if (value.includes("\0") || !paths.isAbsolute(value)) return false;
|
|
252
245
|
if (paths.sep !== "\\") return true;
|
|
@@ -260,7 +253,6 @@ function isFullAbsolute(value, paths = nodePath) {
|
|
|
260
253
|
"?"
|
|
261
254
|
].includes(server) && ![".", ".."].includes(share);
|
|
262
255
|
}
|
|
263
|
-
/** Compares canonical ancestor segments exactly; drive-letter syntax alone is case-insensitive. */
|
|
264
256
|
function containsHostPath(root, value, paths = nodePath) {
|
|
265
257
|
if (!isFullAbsolute(root, paths) || !isFullAbsolute(value, paths)) return false;
|
|
266
258
|
const parts = (path) => {
|
|
@@ -277,13 +269,9 @@ function containsHostPath(root, value, paths = nodePath) {
|
|
|
277
269
|
}
|
|
278
270
|
//#endregion
|
|
279
271
|
//#region src/provider.ts
|
|
280
|
-
/** A bounded business failure without terminal output or raw environment details. */
|
|
281
272
|
var TerminalError = class extends Error {
|
|
282
|
-
/** Stable safe failure category exposed to the client. */
|
|
283
273
|
code;
|
|
284
|
-
/** Generic HTTP-like status used by the host client IO error mapping. */
|
|
285
274
|
status;
|
|
286
|
-
/** Defaults ordinary business conflicts to status 409. */
|
|
287
275
|
constructor(code, status = 409) {
|
|
288
276
|
super(code);
|
|
289
277
|
this.name = "TerminalError";
|
|
@@ -291,7 +279,6 @@ var TerminalError = class extends Error {
|
|
|
291
279
|
this.status = status;
|
|
292
280
|
}
|
|
293
281
|
};
|
|
294
|
-
/** Constructs the owner-held terminal directory and bounded operation facts. */
|
|
295
282
|
function createWebShell(options) {
|
|
296
283
|
const identity = options.roots.availability();
|
|
297
284
|
if (!identity.available) throw new TerminalError("unavailable", 503);
|
|
@@ -465,7 +452,6 @@ function createWebShell(options) {
|
|
|
465
452
|
}));
|
|
466
453
|
};
|
|
467
454
|
return {
|
|
468
|
-
/** Returns current independent workspace roots and physical availability. */
|
|
469
455
|
async roots(workspaceId) {
|
|
470
456
|
current();
|
|
471
457
|
const snapshot = await options.roots.read(workspaceId);
|
|
@@ -479,7 +465,6 @@ function createWebShell(options) {
|
|
|
479
465
|
...!capability.available ? { reason: capability.reason } : !files.available ? { reason: files.reason } : {}
|
|
480
466
|
};
|
|
481
467
|
},
|
|
482
|
-
/** Returns bounded summaries without creating or attaching a terminal. */
|
|
483
468
|
list(workspaceId) {
|
|
484
469
|
current();
|
|
485
470
|
sweep();
|
|
@@ -489,7 +474,6 @@ function createWebShell(options) {
|
|
|
489
474
|
terminals: [...terminals.values()].filter((value) => value.summary.workspaceId === workspaceId).map((value) => structuredClone(value.summary))
|
|
490
475
|
};
|
|
491
476
|
},
|
|
492
|
-
/** Admits once per retained operation ID; connection cancellation does not cancel creation. */
|
|
493
477
|
create(input) {
|
|
494
478
|
const params = CreateParams.parse(input);
|
|
495
479
|
return operation(params.operationId, JSON.stringify(["create", params]), async () => {
|
|
@@ -536,7 +520,6 @@ function createWebShell(options) {
|
|
|
536
520
|
}
|
|
537
521
|
});
|
|
538
522
|
},
|
|
539
|
-
/** Restarts once per operation ID after cleanup; preserves record/cursor and assigns a new runId. */
|
|
540
523
|
restart(input) {
|
|
541
524
|
const params = RestartParams.parse(input);
|
|
542
525
|
return operation(params.operationId, JSON.stringify(["restart", params]), async () => {
|
|
@@ -612,7 +595,6 @@ function createWebShell(options) {
|
|
|
612
595
|
}
|
|
613
596
|
});
|
|
614
597
|
},
|
|
615
|
-
/** Trims one shared title without affecting its process, output or input ownership. */
|
|
616
598
|
rename(input) {
|
|
617
599
|
current();
|
|
618
600
|
const params = RenameParams.parse(input);
|
|
@@ -625,7 +607,6 @@ function createWebShell(options) {
|
|
|
625
607
|
notify(params.workspaceId);
|
|
626
608
|
return structuredClone(terminal.summary);
|
|
627
609
|
},
|
|
628
|
-
/** Attaches one bounded observer; closing it leaves the terminal alive. */
|
|
629
610
|
open(input, context) {
|
|
630
611
|
current();
|
|
631
612
|
if (input.instanceId !== identity.instanceId) throw new TerminalError("context-mismatch");
|
|
@@ -634,7 +615,6 @@ function createWebShell(options) {
|
|
|
634
615
|
if (!terminal.flow) throw new TerminalError("terminal-ended");
|
|
635
616
|
return terminal.flow.open(input, context);
|
|
636
617
|
},
|
|
637
|
-
/** Removes a terminal after confirmed PTY/group cleanup, retaining operation facts and failures. */
|
|
638
618
|
closeTerminal(raw, changed = () => notify(raw.workspaceId)) {
|
|
639
619
|
const input = CloseParams.parse(raw);
|
|
640
620
|
return operation(input.operationId, JSON.stringify(["close", input]), async () => {
|
|
@@ -654,7 +634,6 @@ function createWebShell(options) {
|
|
|
654
634
|
return terminal.summary;
|
|
655
635
|
});
|
|
656
636
|
},
|
|
657
|
-
/** Queries retained execution facts; unknown never replays an operation. */
|
|
658
637
|
operationStatus(input) {
|
|
659
638
|
current();
|
|
660
639
|
sweep();
|
|
@@ -668,7 +647,6 @@ function createWebShell(options) {
|
|
|
668
647
|
status: "unknown"
|
|
669
648
|
};
|
|
670
649
|
},
|
|
671
|
-
/** Stops admission and awaits all late creations and owned physical cleanup. */
|
|
672
650
|
async close() {
|
|
673
651
|
stopped = true;
|
|
674
652
|
await Promise.allSettled([...operations.values()].map((value) => value.promise));
|
|
@@ -681,8 +659,6 @@ function createWebShell(options) {
|
|
|
681
659
|
}
|
|
682
660
|
//#endregion
|
|
683
661
|
//#region src/collections.ts
|
|
684
|
-
/** Bounded terminal collections preserve independent retained physical outcomes. */
|
|
685
|
-
/** Runs owner-bound members in input order; actual oversize results fail only their member. */
|
|
686
662
|
async function terminalCollection(targets, signal, work, maxItemBytes = Math.floor(8380416 / targets.length)) {
|
|
687
663
|
const results = [];
|
|
688
664
|
for (const [index, target] of targets.entries()) {
|
|
@@ -716,8 +692,6 @@ async function terminalCollection(targets, signal, work, maxItemBytes = Math.flo
|
|
|
716
692
|
}
|
|
717
693
|
//#endregion
|
|
718
694
|
//#region src/index.ts
|
|
719
|
-
/** Sessionless host-account terminals; registration exposes no Agent tools or approvals. */
|
|
720
|
-
/** Registers one activation's terminal directory and awaited shutdown drain. */
|
|
721
695
|
function registerWebShell(ctx) {
|
|
722
696
|
let account;
|
|
723
697
|
try {
|
|
@@ -833,7 +807,10 @@ function registerWebShell(ctx) {
|
|
|
833
807
|
open: (params, pipe) => provider.open(params, pipe)
|
|
834
808
|
});
|
|
835
809
|
const module = fileURLToPath(new URL("../ui/ui.js", import.meta.url));
|
|
836
|
-
if (existsSync(module)) ctx.client.
|
|
810
|
+
if (existsSync(module)) ctx.client.registerPackageFiles({
|
|
811
|
+
root: dirname(module),
|
|
812
|
+
entry: "ui.js"
|
|
813
|
+
});
|
|
837
814
|
}
|
|
838
815
|
const plugin = {
|
|
839
816
|
name: "@eum-agent/web-shell",
|
package/dist/schema.js
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
//#region src/schema.ts
|
|
3
|
-
/** WebShell's browser-safe wire contract; the host owns authentication and stream envelopes. */
|
|
4
|
-
/** Explicit workspace identity, independent of a selected chat. */
|
|
5
3
|
const WorkspaceId = z.string().min(1).max(1024).refine((value) => !/[/\\]/u.test(value) && !Array.from(value).some((c) => c.charCodeAt(0) < 32));
|
|
6
|
-
/** Full canonical-root digest. */
|
|
7
4
|
const RootId = z.string().regex(/^[a-f0-9]{64}$/);
|
|
8
|
-
/** Literal relative initial directory, with the empty path selecting its root. */
|
|
9
5
|
const RelativePath = z.string().max(4096).refine((value) => value === "" || value.split("/").every((part) => part !== "" && part !== "." && part !== ".." && !/[\\]/u.test(part) && !Array.from(part).some((c) => c.charCodeAt(0) < 32 || c.charCodeAt(0) === 127)));
|
|
10
|
-
/** Physical terminal dimensions. */
|
|
11
6
|
const Dimension = z.number().int().min(1).max(1e3);
|
|
12
|
-
/** A bounded public diagnostic; never contains output or exception details. */
|
|
13
7
|
const AccessError = z.object({
|
|
14
8
|
code: z.string().max(64),
|
|
15
9
|
message: z.string().max(256)
|
|
16
10
|
}).strict();
|
|
17
|
-
/** State of a retained terminal; runId identifies its current physical PTY, cwd its initial directory. */
|
|
18
11
|
const TerminalSummary = z.object({
|
|
19
12
|
id: z.uuid(),
|
|
20
13
|
runId: z.uuid(),
|
|
@@ -40,7 +33,6 @@ const TerminalSummary = z.object({
|
|
|
40
33
|
cleanupWarnings: z.array(z.string().max(256)).max(32).optional(),
|
|
41
34
|
truncated: z.boolean().optional()
|
|
42
35
|
}).strict();
|
|
43
|
-
/** Independent roots and current host capability. */
|
|
44
36
|
const RootsResult = z.object({
|
|
45
37
|
gatewayId: z.uuid(),
|
|
46
38
|
instanceId: z.uuid(),
|
|
@@ -53,18 +45,15 @@ const RootsResult = z.object({
|
|
|
53
45
|
path: z.string()
|
|
54
46
|
}).strict())
|
|
55
47
|
}).strict();
|
|
56
|
-
/** Workspace terminal directory for this Gateway process. */
|
|
57
48
|
const ListResult = z.object({
|
|
58
49
|
gatewayId: z.uuid(),
|
|
59
50
|
instanceId: z.uuid(),
|
|
60
51
|
terminals: z.array(TerminalSummary).max(48)
|
|
61
52
|
}).strict();
|
|
62
|
-
/** A committed directory mutation; clients reread the matching workspace instead of replaying it. */
|
|
63
53
|
const Changed = z.object({
|
|
64
54
|
instanceId: z.uuid(),
|
|
65
55
|
workspaceId: WorkspaceId
|
|
66
56
|
}).strict();
|
|
67
|
-
/** UUID operation facts retained only within the bounded query window. */
|
|
68
57
|
const OperationResult = z.object({
|
|
69
58
|
operationId: z.uuid(),
|
|
70
59
|
instanceId: z.uuid(),
|
|
@@ -77,7 +66,6 @@ const OperationResult = z.object({
|
|
|
77
66
|
terminal: TerminalSummary.optional(),
|
|
78
67
|
error: AccessError.optional()
|
|
79
68
|
}).strict();
|
|
80
|
-
/** Defaults to workspace HOME; an explicit root/path selects another admitted initial directory. */
|
|
81
69
|
const CreateParams = z.object({
|
|
82
70
|
workspaceId: WorkspaceId,
|
|
83
71
|
rootId: RootId.optional(),
|
|
@@ -86,7 +74,6 @@ const CreateParams = z.object({
|
|
|
86
74
|
rows: Dimension,
|
|
87
75
|
operationId: z.uuid()
|
|
88
76
|
}).strict();
|
|
89
|
-
/** Close selection; endedRunId limits automatic removal to that already ended run. */
|
|
90
77
|
const CloseParams = z.object({
|
|
91
78
|
instanceId: z.uuid(),
|
|
92
79
|
workspaceId: WorkspaceId,
|
|
@@ -94,14 +81,12 @@ const CloseParams = z.object({
|
|
|
94
81
|
operationId: z.uuid(),
|
|
95
82
|
endedRunId: z.uuid().optional()
|
|
96
83
|
}).strict();
|
|
97
|
-
/** Metadata edit for the current Gateway/workspace; names are trimmed, nonblank and single-line. */
|
|
98
84
|
const RenameParams = z.object({
|
|
99
85
|
instanceId: z.uuid(),
|
|
100
86
|
workspaceId: WorkspaceId,
|
|
101
87
|
terminalId: z.uuid(),
|
|
102
88
|
title: z.string().trim().min(1).max(80).refine((value) => !Array.from(value).some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127))
|
|
103
89
|
}).strict();
|
|
104
|
-
/** Restarts a cleaned ended record in its original directory; omitted dimensions retain its size. */
|
|
105
90
|
const RestartParams = z.object({
|
|
106
91
|
instanceId: z.uuid(),
|
|
107
92
|
workspaceId: WorkspaceId,
|
|
@@ -110,12 +95,10 @@ const RestartParams = z.object({
|
|
|
110
95
|
cols: Dimension.optional(),
|
|
111
96
|
rows: Dimension.optional()
|
|
112
97
|
}).strict();
|
|
113
|
-
/** Read-only retained-operation query. */
|
|
114
98
|
const OperationStatusParams = z.object({
|
|
115
99
|
instanceId: z.uuid(),
|
|
116
100
|
operationId: z.uuid()
|
|
117
101
|
}).strict();
|
|
118
|
-
/** One authenticated observation of an existing terminal. */
|
|
119
102
|
const TerminalOpen = z.object({
|
|
120
103
|
instanceId: z.uuid(),
|
|
121
104
|
workspaceId: WorkspaceId,
|
|
@@ -123,7 +106,6 @@ const TerminalOpen = z.object({
|
|
|
123
106
|
cursor: z.number().int().nonnegative().optional(),
|
|
124
107
|
desiredInput: z.boolean()
|
|
125
108
|
}).strict();
|
|
126
|
-
/** Atomic ready metadata preceding any replay or live output. */
|
|
127
109
|
const TerminalReady = z.object({
|
|
128
110
|
terminal: TerminalSummary,
|
|
129
111
|
subscriptionId: z.uuid(),
|
|
@@ -133,7 +115,6 @@ const TerminalReady = z.object({
|
|
|
133
115
|
lastCursor: z.number().int().nonnegative(),
|
|
134
116
|
truncated: z.boolean()
|
|
135
117
|
}).strict();
|
|
136
|
-
/** Control messages are independent of output consumption. */
|
|
137
118
|
const TerminalInput = z.discriminatedUnion("kind", [
|
|
138
119
|
z.object({
|
|
139
120
|
kind: z.literal("write"),
|
|
@@ -152,7 +133,6 @@ const TerminalInput = z.discriminatedUnion("kind", [
|
|
|
152
133
|
cursor: z.number().int().nonnegative()
|
|
153
134
|
}).strict()
|
|
154
135
|
]);
|
|
155
|
-
/** Output blocks and explicit history/control state. */
|
|
156
136
|
const TerminalOutput = z.discriminatedUnion("kind", [
|
|
157
137
|
z.object({
|
|
158
138
|
kind: z.literal("output"),
|
|
@@ -183,7 +163,6 @@ const CloseMember = CloseParams.omit({
|
|
|
183
163
|
instanceId: true,
|
|
184
164
|
workspaceId: true
|
|
185
165
|
});
|
|
186
|
-
/** Independent close intents retain their UUID and normalized input regardless of array position. */
|
|
187
166
|
const CloseTerminalsParams = z.object({
|
|
188
167
|
instanceId: z.uuid(),
|
|
189
168
|
workspaceId: WorkspaceId,
|
|
@@ -203,7 +182,6 @@ const CloseTerminalsParams = z.object({
|
|
|
203
182
|
identities.set(member.operationId, value);
|
|
204
183
|
}
|
|
205
184
|
});
|
|
206
|
-
/** Read-only status collections reject declared response costs before reading any retained fact. */
|
|
207
185
|
const OperationStatusesParams = z.object({
|
|
208
186
|
instanceId: z.uuid(),
|
|
209
187
|
operationIds: z.array(z.uuid()).min(1).max(64),
|
|
@@ -228,9 +206,7 @@ function collectionResult(target) {
|
|
|
228
206
|
error: AccessError
|
|
229
207
|
}).strict()])).max(64) }).strict();
|
|
230
208
|
}
|
|
231
|
-
/** Ordered close outcomes preserve physical failure facts independently. */
|
|
232
209
|
const CloseTerminalsResult = collectionResult(CloseMember);
|
|
233
|
-
/** Ordered retained facts include unknown operations without replaying them. */
|
|
234
210
|
const OperationStatusesResult = collectionResult(z.uuid());
|
|
235
211
|
//#endregion
|
|
236
212
|
export { AccessError, Changed, CloseParams, CloseTerminalsParams, CloseTerminalsResult, CreateParams, Dimension, ListResult, OperationResult, OperationStatusParams, OperationStatusesParams, OperationStatusesResult, RelativePath, RenameParams, RestartParams, RootId, RootsResult, TerminalInput, TerminalOpen, TerminalOutput, TerminalReady, TerminalSummary, WorkspaceId };
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"en-US": "Terminal",
|
|
5
5
|
"zh-CN": "终端"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.0
|
|
7
|
+
"version": "1.2.0",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"description": "Sessionless host-account interactive terminals",
|
|
10
10
|
"license": "MIT",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"lucide-react": "^1.40.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@eum-agent/plugin": "1.0
|
|
31
|
+
"@eum-agent/plugin": "1.2.0",
|
|
32
32
|
"@eum-agent/runtime": "1.0.0",
|
|
33
33
|
"@eum-agent/protocol": "1.0.0",
|
|
34
34
|
"@types/react": "^19.2.18",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"react-dom": "^19.2.0",
|
|
38
38
|
"vite": "^8.2.2",
|
|
39
39
|
"@testing-library/react": "^16.3.3",
|
|
40
|
-
"@eum-agent/infra-local": "1.0
|
|
40
|
+
"@eum-agent/infra-local": "1.2.0"
|
|
41
41
|
},
|
|
42
42
|
"yaoguang": {
|
|
43
43
|
"description": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"dependencies": {},
|
|
48
48
|
"kind": "extension",
|
|
49
49
|
"foundationDependencies": {
|
|
50
|
-
"@eum-agent/infra-local": "1.0
|
|
50
|
+
"@eum-agent/infra-local": "1.2.0"
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
package/ui/ui.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SettingsPreview, useDeviceFonts, useViewRecord } from "@eum-agent/host/framework";
|
|
1
2
|
import { createContext, createElement, forwardRef, useContext, useEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
2
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
//#region ../../../node_modules/.pnpm/@xterm+xterm@6.0.0/node_modules/@xterm/xterm/css/xterm.css?inline
|
|
@@ -10,7 +11,16 @@ var CATALOGUES = {
|
|
|
10
11
|
settingsReadFailed: "Could not read settings in this browser. Defaults are in use.",
|
|
11
12
|
settingsWriteFailed: "Changes are applied but could not be saved in this browser; reloading may lose them.",
|
|
12
13
|
settingsText: "Text display",
|
|
14
|
+
settingsResetAppearance: "Reset appearance",
|
|
15
|
+
settingsPreview: "Preview",
|
|
16
|
+
settingsPreviewInfo: "Preview information",
|
|
17
|
+
settingsPreviewTerminal: "Terminal output",
|
|
18
|
+
settingsPreviewHint: "This fixed sample updates with your font, size and cursor choices, using system fallbacks for missing fonts. It sends no messages and runs no commands.",
|
|
13
19
|
settingsFontFamily: "Font Family",
|
|
20
|
+
settingsFontFamilyDefault: "Terminal default",
|
|
21
|
+
settingsFontMonospace: "System monospace",
|
|
22
|
+
settingsFontDiscoveryFailed: "Could not read device fonts",
|
|
23
|
+
settingsFontDiscoveryUnavailable: "Device fonts unavailable",
|
|
14
24
|
settingsFontFamilyError: "Enter a font family, up to 512 characters.",
|
|
15
25
|
settingsFontSize: "Font size",
|
|
16
26
|
settingsFontSizeError: "Enter a whole number from 8 to 32.",
|
|
@@ -22,6 +32,8 @@ var CATALOGUES = {
|
|
|
22
32
|
settingsCursorUnderline: "Underline",
|
|
23
33
|
settingsCursorBar: "Bar",
|
|
24
34
|
settingsCursorBlink: "Blinking cursor",
|
|
35
|
+
settingsEnabled: "On",
|
|
36
|
+
settingsDisabled: "Off",
|
|
25
37
|
settingsSessions: "Sessions",
|
|
26
38
|
settingsExitBehavior: "Session retention",
|
|
27
39
|
settingsExitKeep: "Keep all",
|
|
@@ -87,7 +99,16 @@ var CATALOGUES = {
|
|
|
87
99
|
settingsReadFailed: "无法读取此浏览器的设置,已使用默认值。",
|
|
88
100
|
settingsWriteFailed: "修改已应用,但无法保存在此浏览器;刷新后可能丢失。",
|
|
89
101
|
settingsText: "文本显示",
|
|
102
|
+
settingsResetAppearance: "恢复外观默认",
|
|
103
|
+
settingsPreview: "预览",
|
|
104
|
+
settingsPreviewInfo: "预览说明",
|
|
105
|
+
settingsPreviewTerminal: "终端输出",
|
|
106
|
+
settingsPreviewHint: "固定示例会随字体、字号和光标设置即时更新,字体缺失时使用系统回退。不会发送消息或执行命令。",
|
|
90
107
|
settingsFontFamily: "字体",
|
|
108
|
+
settingsFontFamilyDefault: "终端默认",
|
|
109
|
+
settingsFontMonospace: "系统等宽",
|
|
110
|
+
settingsFontDiscoveryFailed: "未能读取本机字体",
|
|
111
|
+
settingsFontDiscoveryUnavailable: "当前环境不支持读取字体",
|
|
91
112
|
settingsFontFamilyError: "请输入字体族,最多 512 个字符。",
|
|
92
113
|
settingsFontSize: "字号",
|
|
93
114
|
settingsFontSizeError: "请输入 8 到 32 之间的整数。",
|
|
@@ -99,6 +120,8 @@ var CATALOGUES = {
|
|
|
99
120
|
settingsCursorUnderline: "下划线",
|
|
100
121
|
settingsCursorBar: "竖线",
|
|
101
122
|
settingsCursorBlink: "光标闪烁",
|
|
123
|
+
settingsEnabled: "开启",
|
|
124
|
+
settingsDisabled: "关闭",
|
|
102
125
|
settingsSessions: "会话",
|
|
103
126
|
settingsExitBehavior: "会话保留方案",
|
|
104
127
|
settingsExitKeep: "不移除",
|
|
@@ -16910,6 +16933,7 @@ function createTerminalPreferences(signal) {
|
|
|
16910
16933
|
} catch {
|
|
16911
16934
|
problem = "read";
|
|
16912
16935
|
}
|
|
16936
|
+
let appearanceResetRevision = 0;
|
|
16913
16937
|
const listeners = /* @__PURE__ */ new Set();
|
|
16914
16938
|
let disposed = signal.aborted;
|
|
16915
16939
|
const update = (patch) => {
|
|
@@ -16958,6 +16982,7 @@ function createTerminalPreferences(signal) {
|
|
|
16958
16982
|
return {
|
|
16959
16983
|
getState: () => state,
|
|
16960
16984
|
getProblem: () => problem,
|
|
16985
|
+
getAppearanceResetRevision: () => appearanceResetRevision,
|
|
16961
16986
|
subscribe: (listener) => {
|
|
16962
16987
|
if (disposed) return () => {};
|
|
16963
16988
|
listeners.add(listener);
|
|
@@ -16966,8 +16991,19 @@ function createTerminalPreferences(signal) {
|
|
|
16966
16991
|
};
|
|
16967
16992
|
},
|
|
16968
16993
|
update,
|
|
16969
|
-
reset: () => {
|
|
16970
|
-
|
|
16994
|
+
reset: (scope) => {
|
|
16995
|
+
if (disposed) return;
|
|
16996
|
+
const { fontFamily, fontSize, cursorStyle, cursorBlink, exitBehavior } = DEFAULT_TERMINAL_PREFERENCES;
|
|
16997
|
+
update(scope === "appearance" ? {
|
|
16998
|
+
fontFamily,
|
|
16999
|
+
fontSize,
|
|
17000
|
+
cursorStyle,
|
|
17001
|
+
cursorBlink
|
|
17002
|
+
} : { exitBehavior });
|
|
17003
|
+
if (scope === "appearance") {
|
|
17004
|
+
appearanceResetRevision += 1;
|
|
17005
|
+
for (const listener of listeners) listener();
|
|
17006
|
+
}
|
|
16971
17007
|
},
|
|
16972
17008
|
dispose
|
|
16973
17009
|
};
|
|
@@ -17407,6 +17443,7 @@ function TerminalScreen({ ctx, store, preferences, terminal, visible, renaming,
|
|
|
17407
17443
|
latestTerminal.current = terminal;
|
|
17408
17444
|
const ended = terminal.status === "ended";
|
|
17409
17445
|
const cursor = useRef(0);
|
|
17446
|
+
const restoreReading = useRef(() => {});
|
|
17410
17447
|
const [dimensions, setDimensions] = useState({
|
|
17411
17448
|
cols: terminal.cols,
|
|
17412
17449
|
rows: terminal.rows
|
|
@@ -17485,6 +17522,67 @@ function TerminalScreen({ ctx, store, preferences, terminal, visible, renaming,
|
|
|
17485
17522
|
search.current = void 0;
|
|
17486
17523
|
};
|
|
17487
17524
|
}, [ctx, terminal.id]);
|
|
17525
|
+
useEffect(() => {
|
|
17526
|
+
const xterm = display.current;
|
|
17527
|
+
const container = element.current;
|
|
17528
|
+
if (!xterm || !container) return;
|
|
17529
|
+
const identity = store.get().identity;
|
|
17530
|
+
const scope = identity ? [
|
|
17531
|
+
identity.gatewayId,
|
|
17532
|
+
terminal.workspaceId,
|
|
17533
|
+
terminal.id,
|
|
17534
|
+
terminal.runId,
|
|
17535
|
+
"reading"
|
|
17536
|
+
] : null;
|
|
17537
|
+
const raw = scope ? ctx.viewState.read(scope) : void 0;
|
|
17538
|
+
const saved = raw && typeof raw === "object" ? raw : {};
|
|
17539
|
+
let restoring = saved.following === false && typeof saved.cursor === "number" && typeof saved.distance === "number" && Number.isFinite(saved.distance);
|
|
17540
|
+
let parsed = false;
|
|
17541
|
+
let lastReading;
|
|
17542
|
+
const saveReading = () => {
|
|
17543
|
+
if (!scope || restoring || !parsed) return;
|
|
17544
|
+
if (display.current !== xterm) {
|
|
17545
|
+
if (lastReading) ctx.viewState.write(scope, lastReading);
|
|
17546
|
+
return;
|
|
17547
|
+
}
|
|
17548
|
+
const buffer = xterm.buffer.active;
|
|
17549
|
+
lastReading = {
|
|
17550
|
+
following: buffer.viewportY >= buffer.baseY,
|
|
17551
|
+
distance: Math.max(0, buffer.baseY - buffer.viewportY),
|
|
17552
|
+
cursor: cursor.current
|
|
17553
|
+
};
|
|
17554
|
+
ctx.viewState.write(scope, lastReading);
|
|
17555
|
+
};
|
|
17556
|
+
restoreReading.current = (consumed) => {
|
|
17557
|
+
parsed = true;
|
|
17558
|
+
if (restoring && consumed >= saved.cursor) {
|
|
17559
|
+
xterm.scrollToLine(Math.max(0, xterm.buffer.active.baseY - saved.distance));
|
|
17560
|
+
restoring = false;
|
|
17561
|
+
}
|
|
17562
|
+
saveReading();
|
|
17563
|
+
};
|
|
17564
|
+
const intent = () => {
|
|
17565
|
+
restoring = false;
|
|
17566
|
+
};
|
|
17567
|
+
container.addEventListener("wheel", intent, { passive: true });
|
|
17568
|
+
container.addEventListener("pointerdown", intent);
|
|
17569
|
+
container.addEventListener("keydown", intent);
|
|
17570
|
+
const scrolling = xterm.onScroll(saveReading);
|
|
17571
|
+
return () => {
|
|
17572
|
+
saveReading();
|
|
17573
|
+
restoreReading.current = () => {};
|
|
17574
|
+
scrolling.dispose();
|
|
17575
|
+
container.removeEventListener("wheel", intent);
|
|
17576
|
+
container.removeEventListener("pointerdown", intent);
|
|
17577
|
+
container.removeEventListener("keydown", intent);
|
|
17578
|
+
};
|
|
17579
|
+
}, [
|
|
17580
|
+
ctx,
|
|
17581
|
+
store,
|
|
17582
|
+
terminal.id,
|
|
17583
|
+
terminal.runId,
|
|
17584
|
+
terminal.workspaceId
|
|
17585
|
+
]);
|
|
17488
17586
|
useEffect(() => {
|
|
17489
17587
|
const xterm = display.current;
|
|
17490
17588
|
if (!xterm) return;
|
|
@@ -17581,7 +17679,10 @@ function TerminalScreen({ ctx, store, preferences, terminal, visible, renaming,
|
|
|
17581
17679
|
cursor: cursor.current,
|
|
17582
17680
|
consumed: (value) => {
|
|
17583
17681
|
const current = store.get();
|
|
17584
|
-
if (display.current === xterm && !ctx.signal.aborted && current.workspaceId === observing.workspaceId && current.identity?.instanceId === observing.instanceId && current.terminals.some((terminal) => terminal.id === observing.id))
|
|
17682
|
+
if (display.current === xterm && !ctx.signal.aborted && current.workspaceId === observing.workspaceId && current.identity?.instanceId === observing.instanceId && current.terminals.some((terminal) => terminal.id === observing.id)) {
|
|
17683
|
+
cursor.current = Math.max(cursor.current, value);
|
|
17684
|
+
restoreReading.current(value);
|
|
17685
|
+
}
|
|
17585
17686
|
},
|
|
17586
17687
|
changed: (value) => {
|
|
17587
17688
|
if (applies()) {
|
|
@@ -17784,6 +17885,7 @@ function TerminalScreen({ ctx, store, preferences, terminal, visible, renaming,
|
|
|
17784
17885
|
onClick: () => setPaste(void 0),
|
|
17785
17886
|
children: t("cancel")
|
|
17786
17887
|
}), /* @__PURE__ */ jsx(Button, {
|
|
17888
|
+
variant: "primary",
|
|
17787
17889
|
disabled: !writer || paste.length > 32768,
|
|
17788
17890
|
onClick: () => {
|
|
17789
17891
|
display.current?.paste(paste);
|
|
@@ -17817,6 +17919,7 @@ function TerminalScreen({ ctx, store, preferences, terminal, visible, renaming,
|
|
|
17817
17919
|
onClick: () => setTakeover(false),
|
|
17818
17920
|
children: t("cancel")
|
|
17819
17921
|
}), /* @__PURE__ */ jsx(Button, {
|
|
17922
|
+
variant: "primary",
|
|
17820
17923
|
disabled: !state.online || !connection.current,
|
|
17821
17924
|
onClick: () => {
|
|
17822
17925
|
connection.current?.takeover().catch((error) => setProblem(String(error)));
|
|
@@ -17846,23 +17949,28 @@ function TerminalScreen({ ctx, store, preferences, terminal, visible, renaming,
|
|
|
17846
17949
|
/** Session navigation and terminal observations share the Logo workspace context. */
|
|
17847
17950
|
function ShellPage({ ctx, store, preferences = store.preferences }) {
|
|
17848
17951
|
const state = useSyncExternalStore(store.subscribe, store.get);
|
|
17849
|
-
const [
|
|
17952
|
+
const scope = state.identity && state.workspaceId ? [state.identity.gatewayId, state.workspaceId] : null;
|
|
17953
|
+
const [active, setActive] = useViewRecord(ctx.viewState, scope && [...scope, "active"], "", (value) => typeof value === "string" ? value : "");
|
|
17850
17954
|
const previous = useRef([]);
|
|
17851
|
-
const [query, setQuery] =
|
|
17955
|
+
const [query, setQuery] = useViewRecord(ctx.viewState, scope && [...scope, "filter"], "", (value) => typeof value === "string" ? value : "");
|
|
17852
17956
|
const [drawer, setDrawer] = useState(false);
|
|
17853
17957
|
const [editing, setEditing] = useState([]);
|
|
17854
17958
|
useEffect(() => {
|
|
17855
17959
|
store.reload();
|
|
17856
17960
|
}, [store]);
|
|
17857
17961
|
useEffect(() => {
|
|
17962
|
+
if (!state.roots && state.terminals.length === 0) return;
|
|
17858
17963
|
if (!state.terminals.some((terminal) => terminal.id === active)) {
|
|
17859
17964
|
const index = Math.max(0, previous.current.indexOf(active));
|
|
17860
17965
|
setActive(state.terminals[Math.min(index, state.terminals.length - 1)]?.id ?? "");
|
|
17861
17966
|
}
|
|
17862
17967
|
previous.current = state.terminals.map((terminal) => terminal.id);
|
|
17863
|
-
}, [
|
|
17968
|
+
}, [
|
|
17969
|
+
active,
|
|
17970
|
+
state.terminals,
|
|
17971
|
+
state.roots
|
|
17972
|
+
]);
|
|
17864
17973
|
useEffect(() => {
|
|
17865
|
-
setQuery("");
|
|
17866
17974
|
setDrawer(false);
|
|
17867
17975
|
setEditing([]);
|
|
17868
17976
|
}, [state.workspaceId]);
|
|
@@ -17871,8 +17979,9 @@ function ShellPage({ ctx, store, preferences = store.preferences }) {
|
|
|
17871
17979
|
setActive(state.createdTerminalId);
|
|
17872
17980
|
setQuery("");
|
|
17873
17981
|
setDrawer(false);
|
|
17982
|
+
store.acknowledgeCreatedTerminal(state.createdTerminalId);
|
|
17874
17983
|
}
|
|
17875
|
-
}, [state.createdTerminalId]);
|
|
17984
|
+
}, [state.createdTerminalId, store]);
|
|
17876
17985
|
const { Button, EmptyState, Icon, Input, StatusBarArea } = ctx.ui;
|
|
17877
17986
|
const t = ctx.i18n.t;
|
|
17878
17987
|
const create = () => {
|
|
@@ -18059,7 +18168,9 @@ function ShellPage({ ctx, store, preferences = store.preferences }) {
|
|
|
18059
18168
|
}
|
|
18060
18169
|
//#endregion
|
|
18061
18170
|
//#region ui-src/settings.tsx
|
|
18171
|
+
/** Terminal appearance and session behavior share one browser-local preference store. */
|
|
18062
18172
|
function FontPreference({ ctx, preferences, value }) {
|
|
18173
|
+
const device = useDeviceFonts(ctx.signal, ctx.services.get("native-device-fonts"));
|
|
18063
18174
|
const [draft, setDraft] = useState(value);
|
|
18064
18175
|
useEffect(() => setDraft(value), [value]);
|
|
18065
18176
|
const t = ctx.i18n.t;
|
|
@@ -18068,13 +18179,30 @@ function FontPreference({ ctx, preferences, value }) {
|
|
|
18068
18179
|
label: t("settingsFontFamily"),
|
|
18069
18180
|
error: valid ? void 0 : t("settingsFontFamilyError"),
|
|
18070
18181
|
inline: true,
|
|
18071
|
-
|
|
18182
|
+
className: "settings-field-row flex flex-row flex-wrap items-center justify-between [&>div:nth-child(2)]:ml-auto",
|
|
18183
|
+
children: (binding) => /* @__PURE__ */ jsx(ctx.ui.FontPicker, {
|
|
18072
18184
|
...binding,
|
|
18073
|
-
"
|
|
18185
|
+
className: "w-72 max-w-full",
|
|
18186
|
+
label: t("settingsFontFamily"),
|
|
18187
|
+
onLoadFonts: device.available ? device.load : void 0,
|
|
18188
|
+
loading: device.loading,
|
|
18189
|
+
loadError: device.failed ? t("settingsFontDiscoveryFailed") : void 0,
|
|
18190
|
+
loadUnavailable: !device.available ? t("settingsFontDiscoveryUnavailable") : void 0,
|
|
18191
|
+
options: [
|
|
18192
|
+
...device.options,
|
|
18193
|
+
{
|
|
18194
|
+
value: DEFAULT_TERMINAL_PREFERENCES.fontFamily,
|
|
18195
|
+
label: t("settingsFontFamilyDefault")
|
|
18196
|
+
},
|
|
18197
|
+
{
|
|
18198
|
+
value: "monospace",
|
|
18199
|
+
label: t("settingsFontMonospace")
|
|
18200
|
+
}
|
|
18201
|
+
],
|
|
18074
18202
|
value: draft,
|
|
18075
|
-
|
|
18076
|
-
setDraft(
|
|
18077
|
-
preferences.update({ fontFamily:
|
|
18203
|
+
onValueChange: (value) => {
|
|
18204
|
+
setDraft(value);
|
|
18205
|
+
preferences.update({ fontFamily: value });
|
|
18078
18206
|
}
|
|
18079
18207
|
})
|
|
18080
18208
|
});
|
|
@@ -18088,6 +18216,7 @@ function FontSizePreference({ ctx, preferences, value }) {
|
|
|
18088
18216
|
label: t("settingsFontSize"),
|
|
18089
18217
|
error: valid ? void 0 : t("settingsFontSizeError"),
|
|
18090
18218
|
inline: true,
|
|
18219
|
+
className: "settings-field-row flex flex-row flex-wrap items-center justify-between [&>div:nth-child(2)]:ml-auto",
|
|
18091
18220
|
children: (binding) => /* @__PURE__ */ jsx("div", {
|
|
18092
18221
|
className: "ws-settings-number",
|
|
18093
18222
|
children: /* @__PURE__ */ jsx(ctx.ui.InputNumber, {
|
|
@@ -18108,11 +18237,17 @@ function FontSizePreference({ ctx, preferences, value }) {
|
|
|
18108
18237
|
})
|
|
18109
18238
|
});
|
|
18110
18239
|
}
|
|
18111
|
-
|
|
18240
|
+
function StorageProblem({ ctx, preferences }) {
|
|
18241
|
+
const problem = useSyncExternalStore(preferences.subscribe, preferences.getProblem);
|
|
18242
|
+
return problem ? /* @__PURE__ */ jsx("p", {
|
|
18243
|
+
role: "alert",
|
|
18244
|
+
className: "ws-settings-error",
|
|
18245
|
+
children: ctx.i18n.t(problem === "read" ? "settingsReadFailed" : "settingsWriteFailed")
|
|
18246
|
+
}) : null;
|
|
18247
|
+
}
|
|
18248
|
+
/** Session-retention settings keep their existing system-settings page and storage record. */
|
|
18112
18249
|
function TerminalSettings({ ctx, preferences }) {
|
|
18113
18250
|
const value = useSyncExternalStore(preferences.subscribe, preferences.getState);
|
|
18114
|
-
const problem = useSyncExternalStore(preferences.subscribe, preferences.getProblem);
|
|
18115
|
-
const [reset, setReset] = useState(0);
|
|
18116
18251
|
const t = ctx.i18n.t;
|
|
18117
18252
|
return /* @__PURE__ */ jsxs("div", {
|
|
18118
18253
|
className: "ws-settings",
|
|
@@ -18125,35 +18260,76 @@ function TerminalSettings({ ctx, preferences }) {
|
|
|
18125
18260
|
type: "button",
|
|
18126
18261
|
variant: "text",
|
|
18127
18262
|
className: "min-w-0 text-right",
|
|
18128
|
-
onClick: () =>
|
|
18129
|
-
preferences.reset();
|
|
18130
|
-
setReset((current) => current + 1);
|
|
18131
|
-
},
|
|
18263
|
+
onClick: () => preferences.reset("behavior"),
|
|
18132
18264
|
children: t("settingsReset")
|
|
18133
18265
|
})]
|
|
18134
18266
|
}), /* @__PURE__ */ jsxs("div", {
|
|
18135
18267
|
className: "ws-settings-body @container flex min-h-0 flex-1 flex-col gap-6 px-6 pb-6 pt-1",
|
|
18136
|
-
children: [
|
|
18137
|
-
|
|
18138
|
-
|
|
18139
|
-
|
|
18140
|
-
|
|
18141
|
-
|
|
18142
|
-
|
|
18143
|
-
|
|
18144
|
-
|
|
18145
|
-
|
|
18146
|
-
|
|
18147
|
-
|
|
18148
|
-
|
|
18149
|
-
|
|
18150
|
-
|
|
18151
|
-
|
|
18152
|
-
|
|
18153
|
-
|
|
18154
|
-
|
|
18155
|
-
|
|
18156
|
-
|
|
18268
|
+
children: [/* @__PURE__ */ jsx(StorageProblem, {
|
|
18269
|
+
ctx,
|
|
18270
|
+
preferences
|
|
18271
|
+
}), /* @__PURE__ */ jsx(ctx.ui.SettingsPanel, {
|
|
18272
|
+
title: t("settingsSessions"),
|
|
18273
|
+
children: /* @__PURE__ */ jsx(ctx.ui.SettingsPanel, {
|
|
18274
|
+
title: t("settingsExitBehavior"),
|
|
18275
|
+
level: "field",
|
|
18276
|
+
inline: true,
|
|
18277
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
18278
|
+
className: "ws-settings-choice flex min-w-0 justify-end",
|
|
18279
|
+
children: /* @__PURE__ */ jsx(ctx.ui.Segmented, {
|
|
18280
|
+
label: t("settingsExitBehavior"),
|
|
18281
|
+
value: value.exitBehavior,
|
|
18282
|
+
options: [
|
|
18283
|
+
{
|
|
18284
|
+
value: "keep",
|
|
18285
|
+
label: t("settingsExitKeep")
|
|
18286
|
+
},
|
|
18287
|
+
{
|
|
18288
|
+
value: "on-success",
|
|
18289
|
+
label: t("settingsExitSuccess")
|
|
18290
|
+
},
|
|
18291
|
+
{
|
|
18292
|
+
value: "remove",
|
|
18293
|
+
label: t("settingsExitRemove")
|
|
18294
|
+
}
|
|
18295
|
+
],
|
|
18296
|
+
onSelect: (exitBehavior) => preferences.update({ exitBehavior })
|
|
18297
|
+
})
|
|
18298
|
+
})
|
|
18299
|
+
})
|
|
18300
|
+
})]
|
|
18301
|
+
})]
|
|
18302
|
+
});
|
|
18303
|
+
}
|
|
18304
|
+
/** Appearance content uses the personalization host's title, spacing and scroll container. */
|
|
18305
|
+
function TerminalPersonalization({ ctx, preferences }) {
|
|
18306
|
+
const value = useSyncExternalStore(preferences.subscribe, preferences.getState);
|
|
18307
|
+
const reset = useSyncExternalStore(preferences.subscribe, preferences.getAppearanceResetRevision);
|
|
18308
|
+
const t = ctx.i18n.t;
|
|
18309
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
18310
|
+
className: "ws-personalization @container flex min-w-0 flex-1 flex-col gap-6",
|
|
18311
|
+
children: [
|
|
18312
|
+
/* @__PURE__ */ jsx(StorageProblem, {
|
|
18313
|
+
ctx,
|
|
18314
|
+
preferences
|
|
18315
|
+
}),
|
|
18316
|
+
/* @__PURE__ */ jsxs(ctx.ui.SettingsPanel, {
|
|
18317
|
+
title: t("settingsText"),
|
|
18318
|
+
children: [/* @__PURE__ */ jsx(FontPreference, {
|
|
18319
|
+
ctx,
|
|
18320
|
+
preferences,
|
|
18321
|
+
value: value.fontFamily
|
|
18322
|
+
}, `font-${reset}`), /* @__PURE__ */ jsx(FontSizePreference, {
|
|
18323
|
+
ctx,
|
|
18324
|
+
preferences,
|
|
18325
|
+
value: value.fontSize
|
|
18326
|
+
}, `size-${reset}`)]
|
|
18327
|
+
}),
|
|
18328
|
+
/* @__PURE__ */ jsxs(ctx.ui.SettingsPanel, {
|
|
18329
|
+
title: t("settingsCursor"),
|
|
18330
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
18331
|
+
className: "[&>section]:flex-row [&>section]:flex-wrap [&>section]:items-center [&>section]:justify-between [&>section>div]:ml-auto",
|
|
18332
|
+
children: /* @__PURE__ */ jsx(ctx.ui.SettingsPanel, {
|
|
18157
18333
|
title: t("settingsCursorStyle"),
|
|
18158
18334
|
level: "field",
|
|
18159
18335
|
inline: true,
|
|
@@ -18179,52 +18355,61 @@ function TerminalSettings({ ctx, preferences }) {
|
|
|
18179
18355
|
onSelect: (cursorStyle) => preferences.update({ cursorStyle })
|
|
18180
18356
|
})
|
|
18181
18357
|
})
|
|
18182
|
-
})
|
|
18358
|
+
})
|
|
18359
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
18360
|
+
className: "[&>section]:flex-row [&>section]:flex-wrap [&>section]:items-center [&>section]:justify-between [&>section>div]:ml-auto",
|
|
18361
|
+
children: /* @__PURE__ */ jsx(ctx.ui.SettingsPanel, {
|
|
18183
18362
|
title: t("settingsCursorBlink"),
|
|
18184
18363
|
level: "field",
|
|
18185
18364
|
inline: true,
|
|
18186
18365
|
children: /* @__PURE__ */ jsx("div", {
|
|
18187
18366
|
className: "flex min-w-0 justify-end",
|
|
18188
|
-
children: /* @__PURE__ */ jsx(ctx.ui.Switch, {
|
|
18189
|
-
"aria-label": t("settingsCursorBlink"),
|
|
18190
|
-
checked: value.cursorBlink,
|
|
18191
|
-
onCheckedChange: (cursorBlink) => preferences.update({ cursorBlink })
|
|
18192
|
-
})
|
|
18193
|
-
})
|
|
18194
|
-
})]
|
|
18195
|
-
}),
|
|
18196
|
-
/* @__PURE__ */ jsx(ctx.ui.SettingsPanel, {
|
|
18197
|
-
title: t("settingsSessions"),
|
|
18198
|
-
children: /* @__PURE__ */ jsx(ctx.ui.SettingsPanel, {
|
|
18199
|
-
title: t("settingsExitBehavior"),
|
|
18200
|
-
level: "field",
|
|
18201
|
-
inline: true,
|
|
18202
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
18203
|
-
className: "ws-settings-choice flex min-w-0 justify-end",
|
|
18204
18367
|
children: /* @__PURE__ */ jsx(ctx.ui.Segmented, {
|
|
18205
|
-
label: t("
|
|
18206
|
-
value: value.
|
|
18207
|
-
options: [
|
|
18208
|
-
|
|
18209
|
-
|
|
18210
|
-
|
|
18211
|
-
|
|
18212
|
-
|
|
18213
|
-
|
|
18214
|
-
|
|
18215
|
-
},
|
|
18216
|
-
{
|
|
18217
|
-
value: "remove",
|
|
18218
|
-
label: t("settingsExitRemove")
|
|
18219
|
-
}
|
|
18220
|
-
],
|
|
18221
|
-
onSelect: (exitBehavior) => preferences.update({ exitBehavior })
|
|
18368
|
+
label: t("settingsCursorBlink"),
|
|
18369
|
+
value: value.cursorBlink ? "on" : "off",
|
|
18370
|
+
options: [{
|
|
18371
|
+
value: "on",
|
|
18372
|
+
label: t("settingsEnabled")
|
|
18373
|
+
}, {
|
|
18374
|
+
value: "off",
|
|
18375
|
+
label: t("settingsDisabled")
|
|
18376
|
+
}],
|
|
18377
|
+
onSelect: (next) => preferences.update({ cursorBlink: next === "on" })
|
|
18222
18378
|
})
|
|
18223
18379
|
})
|
|
18224
18380
|
})
|
|
18225
|
-
})
|
|
18226
|
-
|
|
18227
|
-
|
|
18381
|
+
})]
|
|
18382
|
+
}),
|
|
18383
|
+
/* @__PURE__ */ jsxs(SettingsPreview, {
|
|
18384
|
+
title: t("settingsPreview"),
|
|
18385
|
+
infoLabel: t("settingsPreviewInfo"),
|
|
18386
|
+
description: t("settingsPreviewHint"),
|
|
18387
|
+
kind: t("settingsPreviewTerminal"),
|
|
18388
|
+
canvasClassName: "ws-settings-preview",
|
|
18389
|
+
canvasStyle: {
|
|
18390
|
+
fontFamily: terminalFontFamily(value.fontFamily),
|
|
18391
|
+
fontSize: value.fontSize
|
|
18392
|
+
},
|
|
18393
|
+
children: [
|
|
18394
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
|
|
18395
|
+
className: "ws-preview-prompt",
|
|
18396
|
+
children: "➜"
|
|
18397
|
+
}), " ~/yaoguang"] }),
|
|
18398
|
+
/* @__PURE__ */ jsx("div", { children: "$ echo \"Hello, 瑶光\"" }),
|
|
18399
|
+
/* @__PURE__ */ jsx("div", { children: "Hello, 瑶光" }),
|
|
18400
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
18401
|
+
"$",
|
|
18402
|
+
" ",
|
|
18403
|
+
/* @__PURE__ */ jsx("span", {
|
|
18404
|
+
"aria-hidden": "true",
|
|
18405
|
+
className: "ws-preview-cursor",
|
|
18406
|
+
"data-cursor-style": value.cursorStyle,
|
|
18407
|
+
"data-blink": value.cursorBlink
|
|
18408
|
+
})
|
|
18409
|
+
] })
|
|
18410
|
+
]
|
|
18411
|
+
})
|
|
18412
|
+
]
|
|
18228
18413
|
});
|
|
18229
18414
|
}
|
|
18230
18415
|
//#endregion
|
|
@@ -18708,6 +18893,10 @@ function createShellStore(ctx, suppliedPreferences) {
|
|
|
18708
18893
|
},
|
|
18709
18894
|
reload,
|
|
18710
18895
|
reloadWorkspace,
|
|
18896
|
+
/** Consumes a creation focus request once, so remounts restore the saved selection. */
|
|
18897
|
+
acknowledgeCreatedTerminal(id) {
|
|
18898
|
+
if (state.createdTerminalId === id) patch({ createdTerminalId: void 0 });
|
|
18899
|
+
},
|
|
18711
18900
|
recoverRestart,
|
|
18712
18901
|
launcher,
|
|
18713
18902
|
dispose,
|
|
@@ -18811,6 +19000,7 @@ var STYLES = `
|
|
|
18811
19000
|
.ws-page .ws-terminal .xterm .xterm-decoration-overview-ruler{visibility:hidden}
|
|
18812
19001
|
.ws-settings-error{margin:0;color:var(--destructive);font-size:12px;line-height:20px}
|
|
18813
19002
|
.ws-settings{display:flex;flex-direction:column;flex:1;min-width:0;min-height:0}.ws-settings-body{overflow:auto;min-height:0}.ws-settings-choice [data-slot=segmented]{max-width:100%;width:auto;flex-wrap:wrap}
|
|
19003
|
+
.ws-settings-preview{background:#141820;color:#e8ecf2;line-height:1.7;white-space:pre}.ws-preview-prompt{color:#8cccaf}.ws-preview-cursor{display:inline-block;width:.6em;height:1.15em;vertical-align:-.15em;background:currentColor}.ws-preview-cursor[data-cursor-style=bar]{width:2px}.ws-preview-cursor[data-cursor-style=underline]{height:2px;vertical-align:-.15em}.ws-preview-cursor[data-blink=true]{animation:ws-preview-blink 1.2s step-end infinite}@keyframes ws-preview-blink{50%{opacity:0}}@media(prefers-reduced-motion:reduce){.ws-preview-cursor{animation:none!important}}
|
|
18814
19004
|
.ws-settings-number{display:flex;min-width:0;flex-direction:column;align-items:flex-end;gap:.25rem}.ws-settings-number>*{width:9rem;max-width:100%}
|
|
18815
19005
|
.ws-page{height:100%;min-height:0;min-width:0;display:grid;grid-template-columns:288px minmax(0,1fr);overflow:hidden;background:var(--background);color:var(--foreground);position:relative}
|
|
18816
19006
|
.ws-sessions{display:flex;flex-direction:column;min-width:0;min-height:0;background:var(--background);border-inline-end:1px solid var(--border)}
|
|
@@ -18860,6 +19050,17 @@ var register = (ctx) => {
|
|
|
18860
19050
|
preferences
|
|
18861
19051
|
})
|
|
18862
19052
|
});
|
|
19053
|
+
ctx.slots.register("shell.personalization.category", {
|
|
19054
|
+
id: "terminal-personalization",
|
|
19055
|
+
onReset: () => preferences.reset("appearance"),
|
|
19056
|
+
order: 30,
|
|
19057
|
+
label: () => ctx.i18n.t("nav"),
|
|
19058
|
+
icon: "terminal",
|
|
19059
|
+
component: () => /* @__PURE__ */ jsx(TerminalPersonalization, {
|
|
19060
|
+
ctx,
|
|
19061
|
+
preferences
|
|
19062
|
+
})
|
|
19063
|
+
});
|
|
18863
19064
|
ctx.services.provide("web-shell-launcher", store.launcher);
|
|
18864
19065
|
};
|
|
18865
19066
|
//#endregion
|