@eum-agent/web-shell 1.0.0 → 1.0.1
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 +68 -12
- package/dist/schema.js +55 -1
- package/package.json +4 -4
- package/ui/ui.js +147 -9
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Changed, CloseParams, CreateParams, ListResult, OperationResult,
|
|
1
|
+
import { Changed, CloseParams, CloseTerminalsParams, CloseTerminalsResult, CreateParams, ListResult, OperationResult, OperationStatusesParams, OperationStatusesResult, RenameParams, RestartParams, RootsResult, TerminalInput, TerminalOpen, TerminalOutput, TerminalReady, TerminalSummary, WorkspaceId } from "./schema.js";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { userInfo } from "node:os";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
@@ -635,7 +635,7 @@ function createWebShell(options) {
|
|
|
635
635
|
return terminal.flow.open(input, context);
|
|
636
636
|
},
|
|
637
637
|
/** Removes a terminal after confirmed PTY/group cleanup, retaining operation facts and failures. */
|
|
638
|
-
closeTerminal(raw) {
|
|
638
|
+
closeTerminal(raw, changed = () => notify(raw.workspaceId)) {
|
|
639
639
|
const input = CloseParams.parse(raw);
|
|
640
640
|
return operation(input.operationId, JSON.stringify(["close", input]), async () => {
|
|
641
641
|
if (input.instanceId !== identity.instanceId) throw new TerminalError("context-mismatch");
|
|
@@ -645,12 +645,12 @@ function createWebShell(options) {
|
|
|
645
645
|
if (input.endedRunId !== void 0) {
|
|
646
646
|
if (terminal.summary.status !== "ended" || terminal.summary.runId !== input.endedRunId) throw new TerminalError("terminal-run-changed");
|
|
647
647
|
terminals.delete(terminal.summary.id);
|
|
648
|
-
|
|
648
|
+
changed();
|
|
649
649
|
return terminal.summary;
|
|
650
650
|
}
|
|
651
651
|
await finish(terminal);
|
|
652
652
|
terminals.delete(terminal.summary.id);
|
|
653
|
-
|
|
653
|
+
changed();
|
|
654
654
|
return terminal.summary;
|
|
655
655
|
});
|
|
656
656
|
},
|
|
@@ -680,6 +680,41 @@ function createWebShell(options) {
|
|
|
680
680
|
};
|
|
681
681
|
}
|
|
682
682
|
//#endregion
|
|
683
|
+
//#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
|
+
async function terminalCollection(targets, signal, work, maxItemBytes = Math.floor(8380416 / targets.length)) {
|
|
687
|
+
const results = [];
|
|
688
|
+
for (const [index, target] of targets.entries()) {
|
|
689
|
+
signal.throwIfAborted();
|
|
690
|
+
try {
|
|
691
|
+
const value = await work(target);
|
|
692
|
+
signal.throwIfAborted();
|
|
693
|
+
const member = {
|
|
694
|
+
index,
|
|
695
|
+
target,
|
|
696
|
+
ok: true,
|
|
697
|
+
value
|
|
698
|
+
};
|
|
699
|
+
if (new TextEncoder().encode(JSON.stringify(member)).byteLength > maxItemBytes) throw new TerminalError("read-limit", 413);
|
|
700
|
+
results.push(member);
|
|
701
|
+
} catch (error) {
|
|
702
|
+
signal.throwIfAborted();
|
|
703
|
+
const code = error instanceof TerminalError ? error.code : "terminal-request-failed";
|
|
704
|
+
results.push({
|
|
705
|
+
index,
|
|
706
|
+
target,
|
|
707
|
+
ok: false,
|
|
708
|
+
error: {
|
|
709
|
+
code,
|
|
710
|
+
message: code
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
return { results };
|
|
716
|
+
}
|
|
717
|
+
//#endregion
|
|
683
718
|
//#region src/index.ts
|
|
684
719
|
/** Sessionless host-account terminals; registration exposes no Agent tools or approvals. */
|
|
685
720
|
/** Registers one activation's terminal directory and awaited shutdown drain. */
|
|
@@ -757,16 +792,37 @@ function registerWebShell(ctx) {
|
|
|
757
792
|
handle: (params) => provider.rename(params)
|
|
758
793
|
});
|
|
759
794
|
ctx.client.registerMethod({
|
|
760
|
-
name: "
|
|
761
|
-
params:
|
|
762
|
-
result:
|
|
763
|
-
handle: (params) =>
|
|
795
|
+
name: "closeTerminals",
|
|
796
|
+
params: CloseTerminalsParams,
|
|
797
|
+
result: CloseTerminalsResult,
|
|
798
|
+
handle: async (params) => {
|
|
799
|
+
let dirty = false;
|
|
800
|
+
try {
|
|
801
|
+
return await terminalCollection(params.items, ctx.signal, (item) => provider.closeTerminal({
|
|
802
|
+
instanceId: params.instanceId,
|
|
803
|
+
workspaceId: params.workspaceId,
|
|
804
|
+
...item
|
|
805
|
+
}, () => {
|
|
806
|
+
dirty = true;
|
|
807
|
+
}));
|
|
808
|
+
} finally {
|
|
809
|
+
if (dirty) try {
|
|
810
|
+
changed.emit({
|
|
811
|
+
instanceId: params.instanceId,
|
|
812
|
+
workspaceId: params.workspaceId
|
|
813
|
+
});
|
|
814
|
+
} catch {}
|
|
815
|
+
}
|
|
816
|
+
}
|
|
764
817
|
});
|
|
765
818
|
ctx.client.registerMethod({
|
|
766
|
-
name: "
|
|
767
|
-
params:
|
|
768
|
-
result:
|
|
769
|
-
handle: (params) => provider.operationStatus(
|
|
819
|
+
name: "operationStatuses",
|
|
820
|
+
params: OperationStatusesParams,
|
|
821
|
+
result: OperationStatusesResult,
|
|
822
|
+
handle: (params) => terminalCollection(params.operationIds, ctx.signal, (operationId) => provider.operationStatus({
|
|
823
|
+
instanceId: params.instanceId,
|
|
824
|
+
operationId
|
|
825
|
+
}), params.maxItemBytes)
|
|
770
826
|
});
|
|
771
827
|
ctx.client.registerStream({
|
|
772
828
|
name: "terminal",
|
package/dist/schema.js
CHANGED
|
@@ -178,5 +178,59 @@ const TerminalOutput = z.discriminatedUnion("kind", [
|
|
|
178
178
|
error: AccessError
|
|
179
179
|
}).strict()
|
|
180
180
|
]);
|
|
181
|
+
const encodedBytes = (value) => new TextEncoder().encode(JSON.stringify(value)).byteLength;
|
|
182
|
+
const CloseMember = CloseParams.omit({
|
|
183
|
+
instanceId: true,
|
|
184
|
+
workspaceId: true
|
|
185
|
+
});
|
|
186
|
+
/** Independent close intents retain their UUID and normalized input regardless of array position. */
|
|
187
|
+
const CloseTerminalsParams = z.object({
|
|
188
|
+
instanceId: z.uuid(),
|
|
189
|
+
workspaceId: WorkspaceId,
|
|
190
|
+
items: z.array(CloseMember).min(1).max(48)
|
|
191
|
+
}).strict().superRefine((input, ctx) => {
|
|
192
|
+
if (encodedBytes(input) * 2 > 8388608) ctx.addIssue({
|
|
193
|
+
code: "custom",
|
|
194
|
+
message: "Terminal input exceeds its byte budget"
|
|
195
|
+
});
|
|
196
|
+
const identities = /* @__PURE__ */ new Map();
|
|
197
|
+
for (const member of input.items) {
|
|
198
|
+
const value = JSON.stringify(member);
|
|
199
|
+
if (identities.has(member.operationId) && identities.get(member.operationId) !== value) ctx.addIssue({
|
|
200
|
+
code: "custom",
|
|
201
|
+
message: "Operation identity has conflicting members"
|
|
202
|
+
});
|
|
203
|
+
identities.set(member.operationId, value);
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
/** Read-only status collections reject declared response costs before reading any retained fact. */
|
|
207
|
+
const OperationStatusesParams = z.object({
|
|
208
|
+
instanceId: z.uuid(),
|
|
209
|
+
operationIds: z.array(z.uuid()).min(1).max(64),
|
|
210
|
+
maxItemBytes: z.number().int().min(1).max(8388608).default(262144),
|
|
211
|
+
maxTotalBytes: z.number().int().min(1).max(8388608).default(8388608)
|
|
212
|
+
}).strict().superRefine((input, ctx) => {
|
|
213
|
+
if (encodedBytes(input) * 2 > 8388608 || input.operationIds.length * input.maxItemBytes + 8192 > input.maxTotalBytes || input.operationIds.some((id) => encodedBytes(id) + 4096 > input.maxItemBytes)) ctx.addIssue({
|
|
214
|
+
code: "custom",
|
|
215
|
+
message: "Terminal collection exceeds its byte budget"
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
function collectionResult(target) {
|
|
219
|
+
return z.object({ results: z.array(z.discriminatedUnion("ok", [z.object({
|
|
220
|
+
index: z.number().int().nonnegative(),
|
|
221
|
+
target,
|
|
222
|
+
ok: z.literal(true),
|
|
223
|
+
value: OperationResult
|
|
224
|
+
}).strict(), z.object({
|
|
225
|
+
index: z.number().int().nonnegative(),
|
|
226
|
+
target,
|
|
227
|
+
ok: z.literal(false),
|
|
228
|
+
error: AccessError
|
|
229
|
+
}).strict()])).max(64) }).strict();
|
|
230
|
+
}
|
|
231
|
+
/** Ordered close outcomes preserve physical failure facts independently. */
|
|
232
|
+
const CloseTerminalsResult = collectionResult(CloseMember);
|
|
233
|
+
/** Ordered retained facts include unknown operations without replaying them. */
|
|
234
|
+
const OperationStatusesResult = collectionResult(z.uuid());
|
|
181
235
|
//#endregion
|
|
182
|
-
export { AccessError, Changed, CloseParams, CreateParams, Dimension, ListResult, OperationResult, OperationStatusParams, RelativePath, RenameParams, RestartParams, RootId, RootsResult, TerminalInput, TerminalOpen, TerminalOutput, TerminalReady, TerminalSummary, WorkspaceId };
|
|
236
|
+
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.0.1",
|
|
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.0.1",
|
|
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.0.1"
|
|
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.0.1"
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
package/ui/ui.js
CHANGED
|
@@ -443,7 +443,8 @@ function SessionRow({ ctx, store, terminal, selected, online, select, onEditingC
|
|
|
443
443
|
className: "ws-row-actions",
|
|
444
444
|
children: [/* @__PURE__ */ jsx(Button, {
|
|
445
445
|
variant: "ghost",
|
|
446
|
-
|
|
446
|
+
size: "sm",
|
|
447
|
+
className: "ws-row-action ws-row-edit",
|
|
447
448
|
"aria-label": `${t("rename")} ${title}`,
|
|
448
449
|
disabled: !online || closing,
|
|
449
450
|
onClick: () => {
|
|
@@ -455,7 +456,8 @@ function SessionRow({ ctx, store, terminal, selected, online, select, onEditingC
|
|
|
455
456
|
children: /* @__PURE__ */ jsx(Icon, { name: "pencil" })
|
|
456
457
|
}), /* @__PURE__ */ jsx(Button, {
|
|
457
458
|
variant: "ghost",
|
|
458
|
-
|
|
459
|
+
size: "sm",
|
|
460
|
+
className: "ws-row-action ws-row-close",
|
|
459
461
|
"aria-label": `${t("close")} ${title}`,
|
|
460
462
|
disabled: !online || closing || terminal.status === "closing",
|
|
461
463
|
onClick: () => {
|
|
@@ -470,7 +472,7 @@ function SessionRow({ ctx, store, terminal, selected, online, select, onEditingC
|
|
|
470
472
|
children: closing || terminal.status === "closing" ? /* @__PURE__ */ jsx("span", {
|
|
471
473
|
"aria-hidden": "true",
|
|
472
474
|
children: "…"
|
|
473
|
-
}) : /* @__PURE__ */ jsx(X$1, { size:
|
|
475
|
+
}) : /* @__PURE__ */ jsx(X$1, { size: 16 })
|
|
474
476
|
})]
|
|
475
477
|
})] }), error && /* @__PURE__ */ jsx("span", {
|
|
476
478
|
role: "alert",
|
|
@@ -17057,7 +17059,8 @@ object({
|
|
|
17057
17059
|
rows: Dimension,
|
|
17058
17060
|
operationId: uuid()
|
|
17059
17061
|
}).strict();
|
|
17060
|
-
|
|
17062
|
+
/** Close selection; endedRunId limits automatic removal to that already ended run. */
|
|
17063
|
+
var CloseParams = object({
|
|
17061
17064
|
instanceId: uuid(),
|
|
17062
17065
|
workspaceId: WorkspaceId,
|
|
17063
17066
|
terminalId: uuid(),
|
|
@@ -17078,7 +17081,8 @@ object({
|
|
|
17078
17081
|
cols: Dimension.optional(),
|
|
17079
17082
|
rows: Dimension.optional()
|
|
17080
17083
|
}).strict();
|
|
17081
|
-
|
|
17084
|
+
/** Read-only retained-operation query. */
|
|
17085
|
+
var OperationStatusParams = object({
|
|
17082
17086
|
instanceId: uuid(),
|
|
17083
17087
|
operationId: uuid()
|
|
17084
17088
|
}).strict();
|
|
@@ -17141,6 +17145,58 @@ discriminatedUnion("kind", [
|
|
|
17141
17145
|
error: AccessError
|
|
17142
17146
|
}).strict()
|
|
17143
17147
|
]);
|
|
17148
|
+
var encodedBytes = (value) => new TextEncoder().encode(JSON.stringify(value)).byteLength;
|
|
17149
|
+
var CloseMember = CloseParams.omit({
|
|
17150
|
+
instanceId: true,
|
|
17151
|
+
workspaceId: true
|
|
17152
|
+
});
|
|
17153
|
+
object({
|
|
17154
|
+
instanceId: uuid(),
|
|
17155
|
+
workspaceId: WorkspaceId,
|
|
17156
|
+
items: array(CloseMember).min(1).max(48)
|
|
17157
|
+
}).strict().superRefine((input, ctx) => {
|
|
17158
|
+
if (encodedBytes(input) * 2 > 8388608) ctx.addIssue({
|
|
17159
|
+
code: "custom",
|
|
17160
|
+
message: "Terminal input exceeds its byte budget"
|
|
17161
|
+
});
|
|
17162
|
+
const identities = /* @__PURE__ */ new Map();
|
|
17163
|
+
for (const member of input.items) {
|
|
17164
|
+
const value = JSON.stringify(member);
|
|
17165
|
+
if (identities.has(member.operationId) && identities.get(member.operationId) !== value) ctx.addIssue({
|
|
17166
|
+
code: "custom",
|
|
17167
|
+
message: "Operation identity has conflicting members"
|
|
17168
|
+
});
|
|
17169
|
+
identities.set(member.operationId, value);
|
|
17170
|
+
}
|
|
17171
|
+
});
|
|
17172
|
+
object({
|
|
17173
|
+
instanceId: uuid(),
|
|
17174
|
+
operationIds: array(uuid()).min(1).max(64),
|
|
17175
|
+
maxItemBytes: number().int().min(1).max(8388608).default(262144),
|
|
17176
|
+
maxTotalBytes: number().int().min(1).max(8388608).default(8388608)
|
|
17177
|
+
}).strict().superRefine((input, ctx) => {
|
|
17178
|
+
if (encodedBytes(input) * 2 > 8388608 || input.operationIds.length * input.maxItemBytes + 8192 > input.maxTotalBytes || input.operationIds.some((id) => encodedBytes(id) + 4096 > input.maxItemBytes)) ctx.addIssue({
|
|
17179
|
+
code: "custom",
|
|
17180
|
+
message: "Terminal collection exceeds its byte budget"
|
|
17181
|
+
});
|
|
17182
|
+
});
|
|
17183
|
+
function collectionResult(target) {
|
|
17184
|
+
return object({ results: array(discriminatedUnion("ok", [object({
|
|
17185
|
+
index: number().int().nonnegative(),
|
|
17186
|
+
target,
|
|
17187
|
+
ok: literal(true),
|
|
17188
|
+
value: OperationResult
|
|
17189
|
+
}).strict(), object({
|
|
17190
|
+
index: number().int().nonnegative(),
|
|
17191
|
+
target,
|
|
17192
|
+
ok: literal(false),
|
|
17193
|
+
error: AccessError
|
|
17194
|
+
}).strict()])).max(64) }).strict();
|
|
17195
|
+
}
|
|
17196
|
+
/** Ordered close outcomes preserve physical failure facts independently. */
|
|
17197
|
+
var CloseTerminalsResult = collectionResult(CloseMember);
|
|
17198
|
+
/** Ordered retained facts include unknown operations without replaying them. */
|
|
17199
|
+
var OperationStatusesResult = collectionResult(uuid());
|
|
17144
17200
|
//#endregion
|
|
17145
17201
|
//#region ui-src/terminal.ts
|
|
17146
17202
|
/** Consumes output through xterm callbacks before acknowledging it; disconnect never closes the PTY. */
|
|
@@ -18172,6 +18228,87 @@ function TerminalSettings({ ctx, preferences }) {
|
|
|
18172
18228
|
});
|
|
18173
18229
|
}
|
|
18174
18230
|
//#endregion
|
|
18231
|
+
//#region ui-src/collections.ts
|
|
18232
|
+
/** Coalesces one activation and exact shared instance/workspace; mutation UUIDs remain unchanged. */
|
|
18233
|
+
function createTerminalCollections(ctx) {
|
|
18234
|
+
let groups = /* @__PURE__ */ new Map();
|
|
18235
|
+
let scheduled = false;
|
|
18236
|
+
const dispatch = async (group, intents) => {
|
|
18237
|
+
try {
|
|
18238
|
+
ctx.signal.throwIfAborted();
|
|
18239
|
+
const raw = await ctx.invoke(group.method === "close" ? "closeTerminals" : "operationStatuses", {
|
|
18240
|
+
instanceId: group.instanceId,
|
|
18241
|
+
...group.workspaceId === void 0 ? {} : { workspaceId: group.workspaceId },
|
|
18242
|
+
[group.method === "close" ? "items" : "operationIds"]: intents.map((intent) => intent.target)
|
|
18243
|
+
});
|
|
18244
|
+
ctx.signal.throwIfAborted();
|
|
18245
|
+
const result = (group.method === "close" ? CloseTerminalsResult : OperationStatusesResult).parse(raw);
|
|
18246
|
+
if (result.results.length !== intents.length || result.results.some((member, index) => member.index !== index || JSON.stringify(member.target) !== JSON.stringify(intents[index]?.target))) throw new Error("Terminal collection returned unexpected members");
|
|
18247
|
+
for (const [index, intent] of intents.entries()) {
|
|
18248
|
+
const member = result.results[index];
|
|
18249
|
+
if (member.ok) intent.resolve(member.value);
|
|
18250
|
+
else intent.reject(Object.assign(new Error(member.error.message), member.error));
|
|
18251
|
+
}
|
|
18252
|
+
} catch (error) {
|
|
18253
|
+
for (const intent of intents) intent.reject(error);
|
|
18254
|
+
}
|
|
18255
|
+
};
|
|
18256
|
+
return (method, params) => {
|
|
18257
|
+
ctx.signal.throwIfAborted();
|
|
18258
|
+
const { instanceId, workspaceId, target } = method === "close" ? (() => {
|
|
18259
|
+
const input = CloseParams.parse(params);
|
|
18260
|
+
return {
|
|
18261
|
+
instanceId: input.instanceId,
|
|
18262
|
+
workspaceId: input.workspaceId,
|
|
18263
|
+
target: {
|
|
18264
|
+
terminalId: input.terminalId,
|
|
18265
|
+
operationId: input.operationId,
|
|
18266
|
+
...input.endedRunId ? { endedRunId: input.endedRunId } : {}
|
|
18267
|
+
}
|
|
18268
|
+
};
|
|
18269
|
+
})() : (() => {
|
|
18270
|
+
const input = OperationStatusParams.parse(params);
|
|
18271
|
+
return {
|
|
18272
|
+
instanceId: input.instanceId,
|
|
18273
|
+
workspaceId: void 0,
|
|
18274
|
+
target: input.operationId
|
|
18275
|
+
};
|
|
18276
|
+
})();
|
|
18277
|
+
const key = JSON.stringify([
|
|
18278
|
+
method,
|
|
18279
|
+
instanceId,
|
|
18280
|
+
workspaceId
|
|
18281
|
+
]);
|
|
18282
|
+
const group = groups.get(key) ?? {
|
|
18283
|
+
method,
|
|
18284
|
+
instanceId,
|
|
18285
|
+
workspaceId,
|
|
18286
|
+
intents: []
|
|
18287
|
+
};
|
|
18288
|
+
groups.set(key, group);
|
|
18289
|
+
const result = new Promise((resolve, reject) => {
|
|
18290
|
+
group.intents.push({
|
|
18291
|
+
target,
|
|
18292
|
+
resolve,
|
|
18293
|
+
reject
|
|
18294
|
+
});
|
|
18295
|
+
});
|
|
18296
|
+
if (!scheduled) {
|
|
18297
|
+
scheduled = true;
|
|
18298
|
+
queueMicrotask(() => {
|
|
18299
|
+
scheduled = false;
|
|
18300
|
+
const ready = groups;
|
|
18301
|
+
groups = /* @__PURE__ */ new Map();
|
|
18302
|
+
for (const group of ready.values()) {
|
|
18303
|
+
const size = group.method === "close" ? 48 : 31;
|
|
18304
|
+
for (let offset = 0; offset < group.intents.length; offset += size) dispatch(group, group.intents.slice(offset, offset + size));
|
|
18305
|
+
}
|
|
18306
|
+
});
|
|
18307
|
+
}
|
|
18308
|
+
return result;
|
|
18309
|
+
};
|
|
18310
|
+
}
|
|
18311
|
+
//#endregion
|
|
18175
18312
|
//#region ui-src/store.ts
|
|
18176
18313
|
/**
|
|
18177
18314
|
* Follows the optional global workspace store for one browser activation.
|
|
@@ -18180,6 +18317,7 @@ function TerminalSettings({ ctx, preferences }) {
|
|
|
18180
18317
|
* Supplied preferences remain caller-owned; otherwise this store disposes its own preference store.
|
|
18181
18318
|
*/
|
|
18182
18319
|
function createShellStore(ctx, suppliedPreferences) {
|
|
18320
|
+
const collection = createTerminalCollections(ctx);
|
|
18183
18321
|
const preferences = suppliedPreferences ?? createTerminalPreferences(ctx.signal);
|
|
18184
18322
|
let state = {
|
|
18185
18323
|
online: ctx.gateway.connection.status === "online",
|
|
@@ -18435,7 +18573,7 @@ function createShellStore(ctx, suppliedPreferences) {
|
|
|
18435
18573
|
patch({ problem: void 0 });
|
|
18436
18574
|
const operationId = ctx.uuid();
|
|
18437
18575
|
try {
|
|
18438
|
-
const result = OperationResult.parse(await
|
|
18576
|
+
const result = OperationResult.parse(await collection("close", {
|
|
18439
18577
|
instanceId: terminal.instanceId,
|
|
18440
18578
|
workspaceId: terminal.workspaceId,
|
|
18441
18579
|
terminalId: terminal.id,
|
|
@@ -18499,7 +18637,7 @@ function createShellStore(ctx, suppliedPreferences) {
|
|
|
18499
18637
|
status: "pending"
|
|
18500
18638
|
} });
|
|
18501
18639
|
try {
|
|
18502
|
-
const result = OperationResult.parse(await
|
|
18640
|
+
const result = OperationResult.parse(await collection("operationStatus", {
|
|
18503
18641
|
instanceId: identity.instanceId,
|
|
18504
18642
|
operationId: operation.operationId
|
|
18505
18643
|
}));
|
|
@@ -18581,7 +18719,7 @@ function createShellStore(ctx, suppliedPreferences) {
|
|
|
18581
18719
|
if (!state.identity || !state.unknownOperation) return;
|
|
18582
18720
|
const version = generation;
|
|
18583
18721
|
try {
|
|
18584
|
-
const result = OperationResult.parse(await
|
|
18722
|
+
const result = OperationResult.parse(await collection("operationStatus", {
|
|
18585
18723
|
instanceId: state.identity.instanceId,
|
|
18586
18724
|
operationId: state.unknownOperation
|
|
18587
18725
|
}));
|
|
@@ -18678,7 +18816,7 @@ var STYLES = `
|
|
|
18678
18816
|
.ws-sessions{display:flex;flex-direction:column;min-width:0;min-height:0;background:var(--background);border-inline-end:1px solid var(--border)}
|
|
18679
18817
|
.ws-session-heading{display:flex;align-items:center;gap:12px;height:56px;padding:0 12px;margin-bottom:8px}.ws-session-heading h1{margin:0;flex:1;font-size:14px;font-weight:600;line-height:20px}.ws-page .ws-icon-button{height:30px;width:30px;min-width:30px;padding:0;flex-shrink:0;color:var(--muted-foreground)}.ws-icon-button svg{width:17px;height:17px}.ws-icon-button:hover{color:var(--foreground)}
|
|
18680
18818
|
.ws-session-search{display:flex;align-items:center;gap:7px;margin:0 12px 12px;padding:0 9px;height:32px;border:1px solid var(--border);border-radius:6px;background:var(--card);color:var(--muted-foreground)}.ws-session-search:focus-within{border-color:var(--primary)}.ws-session-search>svg{width:15px;height:15px;flex-shrink:0}.ws-page .ws-session-search input{border:0;box-shadow:none;background:transparent;min-width:0;height:30px;padding:0;font-size:12px}.ws-session-search input:focus-visible{outline:none;box-shadow:none}
|
|
18681
|
-
.ws-session-list{flex:1;min-height:0;overflow:auto;padding:0 12px 8px}.ws-session-row{position:relative;display:flex;align-items:center;gap:9px;min-height:45px;width:100%;margin:2px 0;padding:0 7px 0 12px;border-radius:var(--radius-control);text-align:left}.ws-session-row:hover{background:var(--muted)}.ws-session-row[aria-current=page],.ws-session-row.ws-selected{background:var(--accent-selected)}.ws-session-row svg{width:16px;height:16px;flex-shrink:0;color:var(--muted-foreground)}.ws-session-row span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;line-height:20px}.ws-session-select{flex:1;min-width:0;display:flex;align-items:center;gap:9px;height:45px;text-align:left;justify-content:flex-start}.ws-session-select>span{flex:1}.ws-row-actions{display:flex;gap:1px;align-items:center;flex-shrink:0}.ws-page .ws-row-
|
|
18819
|
+
.ws-session-list{flex:1;min-height:0;overflow:auto;padding:0 12px 8px}.ws-session-row{position:relative;display:flex;align-items:center;gap:9px;min-height:45px;width:100%;margin:2px 0;padding:0 7px 0 12px;border-radius:var(--radius-control);text-align:left}.ws-session-row:hover{background:var(--muted)}.ws-session-row[aria-current=page],.ws-session-row.ws-selected{background:var(--accent-selected)}.ws-session-row svg{width:16px;height:16px;flex-shrink:0;color:var(--muted-foreground)}.ws-session-row span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;line-height:20px}.ws-session-select{flex:1;min-width:0;display:flex;align-items:center;gap:9px;height:45px;text-align:left;justify-content:flex-start}.ws-session-select>span{flex:1}.ws-row-actions{display:flex;gap:1px;align-items:center;flex-shrink:0}.ws-page .ws-row-action{aspect-ratio:1;padding:0;color:var(--muted-foreground)}.ws-row-action:hover{color:var(--foreground)}.ws-row-actions svg{width:16px;height:16px}.ws-row-edit{opacity:0}.ws-session-row:hover .ws-row-edit,.ws-session-row:focus-within .ws-row-edit,.ws-selected .ws-row-edit{opacity:1}.ws-page .ws-row-close:hover{color:var(--destructive)}.ws-row-editor{display:flex;align-items:center;gap:2px;min-width:0;width:100%;min-height:45px}.ws-row-editor input{min-width:0;height:30px;font-size:13px}.ws-row-error{flex-basis:100%;color:var(--destructive);font-size:11px;padding:0 0 8px;white-space:normal!important}.ws-session-row:has(.ws-row-error){flex-wrap:wrap}
|
|
18682
18820
|
.ws-sidebar-empty{padding:28px 12px;text-align:center;color:var(--muted-foreground);font-size:12px;display:flex;flex-direction:column;gap:12px;align-items:center}.ws-workbench{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden;background:#141820}.ws-screen{display:flex;flex-direction:column;flex:1;min-width:0;min-height:0;position:relative}.ws-screen[hidden]{display:none}.ws-terminal-header{min-height:64px;height:64px;flex-shrink:0;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 16px;background:var(--background);border-bottom:1px solid var(--border)}.ws-terminal-heading{display:flex;align-items:center;gap:8px;min-width:0}.ws-terminal-heading h2{margin:0;font-size:16px;font-weight:500;line-height:24px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ws-terminal-body{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}.ws-viewport{flex:1;min-height:0;min-width:0;display:flex;padding:18px 22px;overflow:hidden;background:#141820}.ws-terminal{flex:1;min-height:0;min-width:0;padding:0;background:#141820;color:#e8ecf2;overflow:hidden}.ws-terminal .xterm{height:100%}.ws-terminal.ws-disabled{filter:grayscale(1);opacity:.6}.ws-page .ws-terminal.ws-no-input .xterm .xterm-rows .xterm-cursor{animation:none!important;background-color:transparent!important;color:inherit!important;outline:none!important;box-shadow:none!important;border-bottom-color:transparent!important}.ws-page .ws-terminal.ws-no-input .xterm .xterm-rows .xterm-cursor::before,.ws-page .ws-terminal.ws-no-input .xterm .xterm-rows .xterm-cursor::after{display:none!important}
|
|
18683
18821
|
|
|
18684
18822
|
.ws-find{position:absolute;right:16px;top:74px;z-index:5;width:min(390px,calc(100% - 32px));display:flex;align-items:center;gap:4px;padding:8px;border:1px solid var(--border);border-radius:8px;background:var(--background);color:var(--foreground);box-shadow:0 8px 28px #0005}.ws-find input{min-width:0;flex:1;height:30px;font-size:12px}.ws-find-result{font-size:11px;color:var(--muted-foreground);white-space:nowrap;min-width:30px;text-align:center}.ws-page .ws-find .ws-icon-button{height:26px;width:26px;min-width:26px}.ws-find svg{height:14px;width:14px}.ws-list-toggle,.ws-scrim{display:none}.ws-paste textarea{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;min-height:120px;width:100%}.ws-paste p{font-size:13px;color:var(--muted-foreground)}
|