dsh-multi-chat 0.4.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.
@@ -0,0 +1,755 @@
1
+ window.__ModuleLoader__.load({
2
+ id: "@deepseek-ai/dsh-client-ui-multi-wall",
3
+ factory: (require) => {
4
+ var module = { exports: {} };
5
+ var exports = module.exports;
6
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
+ let _deepseek_ai_dsh_client_runtime_client = require("@deepseek-ai/dsh-client-runtime/client");
8
+ let react = require("react");
9
+ let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
10
+ let react_jsx_runtime = require("react/jsx-runtime");
11
+ //#region src/client/locales.ts
12
+ /** `multiWall` namespace dictionaries. */
13
+ /** Simplified Chinese dictionary (the key-set source of truth). */
14
+ const zh = {
15
+ "toggle": "多窗口",
16
+ "toggle.aria": "打开或关闭多窗口",
17
+ "view.multiWall": "多窗口墙",
18
+ "overlay.title": "多窗口墙",
19
+ "overlay.close": "关闭",
20
+ "scan": "发现实例",
21
+ "scan.from": "起始端口",
22
+ "scan.to": "结束端口",
23
+ "create": "新建窗口",
24
+ "create.done": "已创建 :{port}",
25
+ "create.failed": "创建失败:{error}",
26
+ "create.unknown": "未知原因",
27
+ "exit": "退出",
28
+ "exit.aria": "退出多窗口墙,返回对话",
29
+ "link": "手机访问",
30
+ "link.aria": "获取手机访问链接",
31
+ "link.fetching": "正在获取链接…",
32
+ "link.none": "未检测到局域网地址",
33
+ "link.copy": "复制链接",
34
+ "link.copied": "已复制",
35
+ "link.hint": "提示:{hint}",
36
+ "link.reachable": "手机在同一网络时可用:{urls}",
37
+ "link.unreachable": "当前实例仅绑定本机,手机无法访问。{hint}",
38
+ "link.token": "口令:{token}",
39
+ "columns": "列数",
40
+ "columns.auto": "自动",
41
+ "refresh": "全部刷新",
42
+ "openTab": "新标签页打开",
43
+ "reload": "重新加载",
44
+ "remove": "从视图移除",
45
+ "stop": "关闭实例",
46
+ "stop.confirm": "确定关闭?",
47
+ "stop.self": "即将关闭当前实例(本页面将断开)",
48
+ "stop.done": "已关闭 :{port}",
49
+ "stop.failed": "关闭 :{port} 失败:{error}",
50
+ "zoom": "放大",
51
+ "loading": "加载中",
52
+ "empty": "没有检测到 DSH 实例",
53
+ "empty.hint": "先启动若干 dsh web --port <n> 实例,再点击「发现实例」或手动添加端口。",
54
+ "status.scanning": "扫描 {from}–{to} …",
55
+ "status.found": "发现 {count} 个实例:{ports}",
56
+ "status.none": "区间 {from}–{to} 未发现 DSH 实例",
57
+ "status.refreshed": "已刷新全部窗口"
58
+ };
59
+ /** English dictionary, checked complete against the zh key set. */
60
+ const en = {
61
+ "toggle": "Multi-Window",
62
+ "toggle.aria": "Toggle multi-window",
63
+ "view.multiWall": "Multi-Window Wall",
64
+ "overlay.title": "Multi-Window Wall",
65
+ "overlay.close": "Close",
66
+ "scan": "Discover",
67
+ "scan.from": "Start port",
68
+ "scan.to": "End port",
69
+ "create": "New window",
70
+ "create.done": "Created :{port}",
71
+ "create.failed": "Create failed: {error}",
72
+ "create.unknown": "unknown reason",
73
+ "exit": "Exit",
74
+ "exit.aria": "Exit the wall and return to chat",
75
+ "link": "Phone access",
76
+ "link.aria": "Get phone access link",
77
+ "link.fetching": "Fetching link…",
78
+ "link.none": "No LAN address detected",
79
+ "link.copy": "Copy link",
80
+ "link.copied": "Copied",
81
+ "link.hint": "Hint: {hint}",
82
+ "link.reachable": "Reachable on the same network: {urls}",
83
+ "link.unreachable": "This instance binds loopback only; phones cannot reach it. {hint}",
84
+ "link.token": "Token: {token}",
85
+ "columns": "Columns",
86
+ "columns.auto": "Auto",
87
+ "refresh": "Refresh all",
88
+ "openTab": "Open in new tab",
89
+ "reload": "Reload",
90
+ "remove": "Remove from view",
91
+ "stop": "Stop instance",
92
+ "stop.confirm": "Confirm stop?",
93
+ "stop.self": "Stopping the current instance (this page will disconnect)",
94
+ "stop.done": "Stopped :{port}",
95
+ "stop.failed": "Failed to stop :{port}: {error}",
96
+ "zoom": "Zoom",
97
+ "loading": "Loading",
98
+ "empty": "No DSH instances found",
99
+ "empty.hint": "Start a few `dsh web --port <n>` instances first, then click \"Discover\" or add a port manually.",
100
+ "status.scanning": "Scanning {from}–{to} …",
101
+ "status.found": "Found {count} instance(s): {ports}",
102
+ "status.none": "No DSH instances in {from}–{to}",
103
+ "status.refreshed": "Refreshed all windows"
104
+ };
105
+ //#endregion
106
+ //#region src/client/store.ts
107
+ /**
108
+ * Wall store: which instances are shown and the grid columns. The ports list
109
+ * is the wall's whole business state — discovery writes it, removal filters
110
+ * it, and the grid renders from it. Open/closed is NOT stored here: the wall
111
+ * is a `conversation.view` ring entry, so the active view (chat store's
112
+ * `view` field) decides whether it renders.
113
+ */
114
+ /**
115
+ * Create the wall store handle. Persisted under `dsh.multi-wall` so the port
116
+ * set and column choice survive view switches and reloads.
117
+ * @returns the store handle (spec + type + identity + factory in one).
118
+ */
119
+ function createWallStore() {
120
+ return (0, _deepseek_ai_dsh_client_runtime_client.defineStore)({
121
+ init: () => ({
122
+ ports: [],
123
+ columns: "auto"
124
+ }),
125
+ persist: "dsh.multi-wall",
126
+ actions: {
127
+ setPorts: (d, ports) => {
128
+ d.ports = ports;
129
+ },
130
+ addPort: (d, port) => {
131
+ if (!d.ports.includes(port)) d.ports = [...d.ports, port];
132
+ },
133
+ removePort: (d, port) => {
134
+ d.ports = d.ports.filter((p) => p !== port);
135
+ },
136
+ setColumns: (d, columns) => {
137
+ d.columns = columns;
138
+ }
139
+ }
140
+ });
141
+ }
142
+ //#endregion
143
+ //#region src/client/wall-injected.ts
144
+ /**
145
+ * Build the probe face bound to this origin's /multi/api routes.
146
+ * @param mount - the API base path ('' at the root, '/multi' when mounted).
147
+ * @returns the injected callbacks.
148
+ */
149
+ function createWallInjected(mount = "") {
150
+ const base = mount.replace(/\/+$/, "");
151
+ return {
152
+ discover: async () => {
153
+ const res = await fetch(`${base}/multi/api/ports`);
154
+ if (!res.ok) return [];
155
+ return ((await res.json()).ports ?? []).filter((p) => p.alive).map((p) => p.port);
156
+ },
157
+ probe: async (ports) => {
158
+ const res = await fetch(`${base}/multi/api/status?ports=${ports.join(",")}`);
159
+ if (!res.ok) return [];
160
+ return (await res.json()).ports ?? [];
161
+ },
162
+ stop: async (port) => {
163
+ const res = await fetch(`${base}/multi/api/stop?port=${port}`, { method: "POST" });
164
+ if (!res.ok) return {
165
+ port,
166
+ ok: false,
167
+ error: `HTTP ${res.status}`
168
+ };
169
+ return (await res.json()).ports?.[0] ?? {
170
+ port,
171
+ ok: false,
172
+ error: "no result"
173
+ };
174
+ },
175
+ create: async () => {
176
+ const res = await fetch(`${base}/multi/api/create`, { method: "POST" });
177
+ if (!res.ok) return {
178
+ ok: false,
179
+ error: `HTTP ${res.status}`
180
+ };
181
+ const text = await res.text();
182
+ let data;
183
+ try {
184
+ data = JSON.parse(text);
185
+ } catch {
186
+ const snippet = text.trim().slice(0, 120);
187
+ return {
188
+ ok: false,
189
+ error: `invalid response: ${snippet === "" ? "<empty body>" : snippet}`
190
+ };
191
+ }
192
+ if (data.ok === true) return data.port !== void 0 ? {
193
+ ok: true,
194
+ port: data.port
195
+ } : {
196
+ ok: false,
197
+ error: "no port in response"
198
+ };
199
+ return {
200
+ ok: false,
201
+ ...typeof data.error === "string" ? { error: data.error } : { error: "server returned no reason" }
202
+ };
203
+ },
204
+ link: async () => {
205
+ const data = await (await fetch(`${base}/multi/api/link`)).json().catch(() => ({}));
206
+ return {
207
+ port: data.port ?? 0,
208
+ host: data.host ?? "unknown",
209
+ lan: data.lan ?? [],
210
+ reachable: data.reachable === true,
211
+ ...typeof data.gatewayPort === "number" ? { gatewayPort: data.gatewayPort } : {},
212
+ ...typeof data.token === "string" ? { token: data.token } : {},
213
+ ...typeof data.hint === "string" ? { hint: data.hint } : {}
214
+ };
215
+ }
216
+ };
217
+ }
218
+ //#endregion
219
+ //#region C:/Users/ASUS/AppData/Roaming/npm/node_modules/@deepseek-ai/dsh/node_modules/clsx/dist/clsx.mjs
220
+ function r(e) {
221
+ var t, f, n = "";
222
+ if ("string" == typeof e || "number" == typeof e) n += e;
223
+ else if ("object" == typeof e) if (Array.isArray(e)) {
224
+ var o = e.length;
225
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
226
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
227
+ return n;
228
+ }
229
+ function clsx() {
230
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
231
+ return n;
232
+ }
233
+ //#endregion
234
+ //#region \0dsh-css:D:\2026AppDev\dsh-plugins-multi-task\harness-src\packages\client\ui-multi-wall\src\client\WallView.module.css.mjs
235
+ const css$1 = "[data-conversation-scroll]:has([data-wall-view]) [data-composer-seat]{display:none}.ouhzTG_wall{background:var(--dsw-alias-bg-base);min-width:0;min-height:0;color:var(--dsw-alias-label-primary);flex-direction:column;flex:1;display:flex}.ouhzTG_toolbar{border-bottom:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);flex-wrap:wrap;flex:none;align-items:center;gap:12px;padding:8px 14px;display:flex}.ouhzTG_title{font-size:14px;font-weight:600}.ouhzTG_linkBar{border-bottom:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);flex-wrap:wrap;flex:none;align-items:center;gap:10px;padding:6px 14px;display:flex}.ouhzTG_linkText{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;flex:1;min-width:160px;font-size:12px}.ouhzTG_status{color:var(--dsw-alias-label-secondary);flex:1;min-width:120px;font-size:12px}.ouhzTG_controls{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.ouhzTG_field{color:var(--dsw-alias-label-secondary);align-items:center;gap:6px;font-size:12px;display:inline-flex}.ouhzTG_field>span{width:76px}.ouhzTG_grid{flex:1;grid-auto-rows:minmax(280px,1fr);align-content:start;gap:8px;padding:8px;display:grid;overflow:auto}.ouhzTG_grid[data-cols=auto]{grid-template-columns:repeat(auto-fit,minmax(280px,1fr))}.ouhzTG_grid[data-cols=\"1\"]{grid-template-columns:1fr}.ouhzTG_grid[data-cols=\"2\"]{grid-template-columns:repeat(2,1fr)}.ouhzTG_grid[data-cols=\"3\"]{grid-template-columns:repeat(3,1fr)}.ouhzTG_grid[data-cols=\"4\"]{grid-template-columns:repeat(4,1fr)}.ouhzTG_grid[data-cols=\"6\"]{grid-template-columns:repeat(6,1fr)}.ouhzTG_pane{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);border-radius:8px;flex-direction:column;min-width:0;min-height:0;display:flex;overflow:hidden}.ouhzTG_pane.ouhzTG_zoomed{grid-area:1/1/-1/-1}.ouhzTG_paneHead{border-bottom:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);flex:none;align-items:center;gap:8px;padding:4px 8px;display:flex}.ouhzTG_dot{flex:none}.ouhzTG_paneTitle{text-overflow:ellipsis;white-space:nowrap;font-size:12px;overflow:hidden}.ouhzTG_paneActions{flex:none;gap:2px;margin-left:auto;display:flex}.ouhzTG_action{color:var(--dsw-alias-label-secondary);cursor:pointer;white-space:nowrap;background:0 0;border:none;border-radius:4px;padding:2px 6px;line-height:1}.ouhzTG_action:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.ouhzTG_action.ouhzTG_danger:hover{color:var(--dsw-static-amber-600)}.ouhzTG_action.ouhzTG_danger.ouhzTG_confirm{background:var(--dsw-static-amber-500);color:var(--dsw-static-neutral-00);padding:2px 8px;font-size:11px}.ouhzTG_action.ouhzTG_danger.ouhzTG_confirm:hover{background:var(--dsw-static-amber-600);color:var(--dsw-static-neutral-00)}.ouhzTG_paneBody{flex:1;min-height:0;position:relative}.ouhzTG_paneBody iframe{border:none;width:100%;height:100%;display:block}.ouhzTG_empty{color:var(--dsw-alias-label-secondary);flex-direction:column;grid-column:1/-1;justify-content:center;align-items:center;gap:6px;display:flex}.ouhzTG_empty .ouhzTG_hint{font-size:12px}";
236
+ const tagId$1 = "@deepseek-ai/dsh-client-ui-multi-wall/WallView.module.css";
237
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
238
+ const tag = document.createElement("style");
239
+ tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-multi-wall";
240
+ tag.dataset.pluginCss = tagId$1;
241
+ tag.textContent = css$1;
242
+ document.head.appendChild(tag);
243
+ }
244
+ var WallView_module_css_default = {
245
+ "hint": "ouhzTG_hint",
246
+ "empty": "ouhzTG_empty",
247
+ "title": "ouhzTG_title",
248
+ "dot": "ouhzTG_dot",
249
+ "confirm": "ouhzTG_confirm",
250
+ "wall": "ouhzTG_wall",
251
+ "pane": "ouhzTG_pane",
252
+ "field": "ouhzTG_field",
253
+ "linkBar": "ouhzTG_linkBar",
254
+ "paneBody": "ouhzTG_paneBody",
255
+ "controls": "ouhzTG_controls",
256
+ "linkText": "ouhzTG_linkText",
257
+ "status": "ouhzTG_status",
258
+ "paneActions": "ouhzTG_paneActions",
259
+ "grid": "ouhzTG_grid",
260
+ "zoomed": "ouhzTG_zoomed",
261
+ "paneHead": "ouhzTG_paneHead",
262
+ "action": "ouhzTG_action",
263
+ "paneTitle": "ouhzTG_paneTitle",
264
+ "danger": "ouhzTG_danger",
265
+ "toolbar": "ouhzTG_toolbar"
266
+ };
267
+ //#endregion
268
+ //#region src/client/WallView.tsx
269
+ /**
270
+ * WallView: the multi-window wall as a `conversation.view` ring entry. When
271
+ * the header's "多窗口墙" tab is selected, the right panel swaps from the
272
+ * chat to this view — a toolbar plus a grid of iframes, one pane per running
273
+ * DSH instance (127.0.0.1:<port>). Pure additive UI; no existing slot is
274
+ * replaced.
275
+ *
276
+ * Recursion guard: panes embed `?multi-wall=embed` (the embedded page
277
+ * registers no wall UI). The serving instance is itself a pane, so the user
278
+ * can watch — or stop — the very instance they are in.
279
+ *
280
+ * Live data channels: the store owns ports/columns; discovery writes
281
+ * `setPorts` from /multi/api/ports (same-origin, served by the node half);
282
+ * per-pane liveness arrives from /multi/api/status polls. Components never
283
+ * see ctx — the fetch helpers are injected through the registration.
284
+ */
285
+ /** Grid column presets, driven by the toolbar menu. 'auto' fills the row. */
286
+ const COLUMN_PRESETS = [
287
+ "auto",
288
+ "1",
289
+ "2",
290
+ "3",
291
+ "4",
292
+ "6"
293
+ ];
294
+ /** Embed flag appended to every pane URL; such pages register no wall UI. */
295
+ const EMBED_FLAG = "multi-wall=embed";
296
+ /**
297
+ * One pane: header (port, liveness dot, zoom/refresh/open/stop/remove) plus
298
+ * the embedded original DSH UI.
299
+ */
300
+ function WallPane(props) {
301
+ const { port, alive, zoomed, stopping, onZoom, onStop, onRemove, t } = props;
302
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
303
+ className: clsx(WallView_module_css_default.pane, zoomed && WallView_module_css_default.zoomed),
304
+ "data-port": port,
305
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
306
+ className: WallView_module_css_default.paneHead,
307
+ children: [
308
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, {
309
+ state: alive ? "done" : "warning",
310
+ size: 8,
311
+ className: WallView_module_css_default.dot
312
+ }),
313
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
314
+ className: WallView_module_css_default.paneTitle,
315
+ children: ["127.0.0.1:", port]
316
+ }),
317
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
318
+ className: WallView_module_css_default.paneActions,
319
+ children: [
320
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
321
+ type: "button",
322
+ className: WallView_module_css_default.action,
323
+ title: t("zoom"),
324
+ onClick: onZoom,
325
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFullscreenOutline16, { size: 14 })
326
+ }),
327
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
328
+ type: "button",
329
+ className: WallView_module_css_default.action,
330
+ title: t("reload"),
331
+ onClick: (e) => {
332
+ e.currentTarget.closest("section")?.querySelector("iframe")?.contentWindow?.location.reload();
333
+ },
334
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutline16, { size: 14 })
335
+ }),
336
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
337
+ type: "button",
338
+ className: WallView_module_css_default.action,
339
+ title: t("openTab"),
340
+ onClick: () => {
341
+ window.open(`http://127.0.0.1:${port}/`, "_blank");
342
+ },
343
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRightUpOutline16, { size: 14 })
344
+ }),
345
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
346
+ type: "button",
347
+ className: clsx(WallView_module_css_default.action, WallView_module_css_default.danger, stopping && WallView_module_css_default.confirm),
348
+ title: t("stop"),
349
+ onClick: onStop,
350
+ children: stopping ? t("stop.confirm") : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconStopFill16, { size: 14 })
351
+ }),
352
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
353
+ type: "button",
354
+ className: WallView_module_css_default.action,
355
+ title: t("remove"),
356
+ onClick: onRemove,
357
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutline16, { size: 14 })
358
+ })
359
+ ]
360
+ })
361
+ ]
362
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
363
+ className: WallView_module_css_default.paneBody,
364
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("iframe", {
365
+ title: `DSH :${port}`,
366
+ src: `http://127.0.0.1:${port}/?${EMBED_FLAG}`,
367
+ loading: "lazy"
368
+ })
369
+ })]
370
+ });
371
+ }
372
+ /**
373
+ * Render the wall: toolbar plus the horizontally-filled pane grid. Discovery
374
+ * runs on mount and liveness polls every 5s; the store's persisted ports
375
+ * survive view switches and reloads.
376
+ * @param props - composed slot props.
377
+ * @returns the wall surface.
378
+ */
379
+ function WallView({ useStore, actions, discover, probe, stop, create, link, t }) {
380
+ const ports = useStore((s) => s.ports);
381
+ const columns = useStore((s) => s.columns);
382
+ const [alive, setAlive] = (0, react.useState)({});
383
+ const [zoomedPort, setZoomedPort] = (0, react.useState)(null);
384
+ const [confirmingStop, setConfirmingStop] = (0, react.useState)(null);
385
+ const [scanFrom, setScanFrom] = (0, react.useState)(3070);
386
+ const [scanTo, setScanTo] = (0, react.useState)(3110);
387
+ const [colsMenuOpen, setColsMenuOpen] = (0, react.useState)(false);
388
+ const [creating, setCreating] = (0, react.useState)(false);
389
+ const [linkOpen, setLinkOpen] = (0, react.useState)(false);
390
+ const [linkInfo, setLinkInfo] = (0, react.useState)(null);
391
+ const [linkCopied, setLinkCopied] = (0, react.useState)(false);
392
+ const [status, setStatus] = (0, react.useState)("");
393
+ const aliveRef = (0, react.useRef)({});
394
+ aliveRef.current = alive;
395
+ (0, react.useEffect)(() => {
396
+ discover().then((found) => {
397
+ if (found.length > 0) actions.setPorts(found);
398
+ setStatus(found.length > 0 ? t("status.found").replace("{count}", String(found.length)).replace("{ports}", found.join(", ")) : "");
399
+ });
400
+ const timer = setInterval(() => {
401
+ if (ports.length === 0) return;
402
+ probe(ports).then((rows) => {
403
+ const next = {};
404
+ for (const row of rows) next[row.port] = row.alive;
405
+ setAlive(next);
406
+ });
407
+ }, 5e3);
408
+ return () => {
409
+ clearInterval(timer);
410
+ };
411
+ }, []);
412
+ const handleStop = async (port) => {
413
+ if (confirmingStop !== port) {
414
+ setConfirmingStop(port);
415
+ return;
416
+ }
417
+ setConfirmingStop(null);
418
+ const result = await stop(port);
419
+ if (result.ok) {
420
+ actions.removePort(port);
421
+ setAlive((current) => ({
422
+ ...current,
423
+ [port]: false
424
+ }));
425
+ setStatus(t("stop.done").replace("{port}", String(port)));
426
+ } else setStatus(t("stop.failed").replace("{port}", String(port)).replace("{error}", result.error ?? ""));
427
+ };
428
+ const runDiscovery = async () => {
429
+ setStatus(t("status.scanning").replace("{from}", String(scanFrom)).replace("{to}", String(scanTo)));
430
+ const found = await discover();
431
+ if (found.length === 0) {
432
+ setStatus(t("status.none").replace("{from}", String(scanFrom)).replace("{to}", String(scanTo)));
433
+ return;
434
+ }
435
+ actions.setPorts(found);
436
+ setStatus(t("status.found").replace("{count}", String(found.length)).replace("{ports}", found.join(", ")));
437
+ };
438
+ const handleCreate = async () => {
439
+ setCreating(true);
440
+ setStatus("");
441
+ try {
442
+ const result = await create();
443
+ if (result.ok && result.port !== void 0) {
444
+ actions.addPort(result.port);
445
+ setAlive((current) => ({
446
+ ...current,
447
+ [result.port]: true
448
+ }));
449
+ setStatus(t("create.done").replace("{port}", String(result.port)));
450
+ } else setStatus(t("create.failed").replace("{error}", result.error ?? t("create.unknown")));
451
+ } catch (error) {
452
+ setStatus(t("create.failed").replace("{error}", error instanceof Error ? error.message : String(error)));
453
+ } finally {
454
+ setCreating(false);
455
+ }
456
+ };
457
+ const exitWall = () => {
458
+ document.querySelector("[role=\"tablist\"] [role=\"tab\"]")?.click();
459
+ };
460
+ const handleLink = async () => {
461
+ if (linkInfo === null) {
462
+ setStatus(t("link.fetching"));
463
+ setLinkInfo(await link());
464
+ }
465
+ setLinkOpen(true);
466
+ setLinkCopied(false);
467
+ setStatus("");
468
+ };
469
+ const copyFirstLink = async () => {
470
+ if (linkInfo === null || linkInfo.lan.length === 0) return;
471
+ try {
472
+ await navigator.clipboard.writeText(linkInfo.lan[0] ?? "");
473
+ setLinkCopied(true);
474
+ } catch {
475
+ setLinkCopied(false);
476
+ }
477
+ };
478
+ const shown = ports;
479
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
480
+ className: WallView_module_css_default.wall,
481
+ role: "region",
482
+ "aria-label": t("overlay.title"),
483
+ "data-wall-view": "",
484
+ children: [
485
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
486
+ className: WallView_module_css_default.toolbar,
487
+ children: [
488
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
489
+ className: WallView_module_css_default.title,
490
+ children: t("overlay.title")
491
+ }),
492
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
493
+ className: WallView_module_css_default.status,
494
+ children: status
495
+ }),
496
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
497
+ className: WallView_module_css_default.controls,
498
+ children: [
499
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
500
+ className: WallView_module_css_default.field,
501
+ children: [t("scan.from"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
502
+ type: "number",
503
+ value: scanFrom,
504
+ onChange: (e) => setScanFrom(Number(e.target.value))
505
+ })]
506
+ }),
507
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
508
+ className: WallView_module_css_default.field,
509
+ children: [t("scan.to"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
510
+ type: "number",
511
+ value: scanTo,
512
+ onChange: (e) => setScanTo(Number(e.target.value))
513
+ })]
514
+ }),
515
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
516
+ variant: "toolbar",
517
+ size: "sm",
518
+ onClick: () => {
519
+ runDiscovery();
520
+ },
521
+ children: t("scan")
522
+ }),
523
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
524
+ variant: "toolbar",
525
+ size: "sm",
526
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlusOutline16, { size: 14 }),
527
+ disabled: creating,
528
+ onClick: () => {
529
+ handleCreate();
530
+ },
531
+ children: t("create")
532
+ }),
533
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
534
+ open: colsMenuOpen,
535
+ anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
536
+ variant: "toolbar",
537
+ size: "sm",
538
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRightUpOutline16, { size: 14 }),
539
+ onClick: () => {
540
+ setColsMenuOpen(true);
541
+ },
542
+ children: columns === "auto" ? t("columns.auto") : columns
543
+ }),
544
+ items: COLUMN_PRESETS.map((c) => ({
545
+ id: c,
546
+ label: c === "auto" ? t("columns.auto") : c
547
+ })),
548
+ selectedId: columns,
549
+ onSelect: (id) => {
550
+ actions.setColumns(id);
551
+ setColsMenuOpen(false);
552
+ },
553
+ onClose: () => {
554
+ setColsMenuOpen(false);
555
+ },
556
+ compact: true
557
+ }),
558
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
559
+ variant: "toolbar",
560
+ size: "sm",
561
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutline14, { size: 14 }),
562
+ onClick: () => {
563
+ document.querySelectorAll(`.${WallView_module_css_default.paneBody} iframe`).forEach((f) => {
564
+ f.contentWindow?.location.reload();
565
+ });
566
+ setStatus(t("status.refreshed"));
567
+ },
568
+ children: t("refresh")
569
+ }),
570
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
571
+ variant: "toolbar",
572
+ size: "sm",
573
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconGlobeOutline14, { size: 14 }),
574
+ "aria-label": t("link.aria"),
575
+ onClick: () => {
576
+ handleLink();
577
+ },
578
+ children: t("link")
579
+ }),
580
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
581
+ variant: "toolbar",
582
+ size: "sm",
583
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutline16, { size: 14 }),
584
+ "aria-label": t("exit.aria"),
585
+ title: t("exit"),
586
+ onClick: () => {
587
+ exitWall();
588
+ },
589
+ children: t("exit")
590
+ })
591
+ ]
592
+ })
593
+ ]
594
+ }),
595
+ linkOpen && linkInfo !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
596
+ className: WallView_module_css_default.linkBar,
597
+ children: [linkInfo.reachable ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
598
+ className: WallView_module_css_default.linkText,
599
+ children: [t("link.reachable").replace("{urls}", linkInfo.lan.join(" ")), linkInfo.token !== void 0 && linkInfo.token !== "" ? ` ${t("link.token").replace("{token}", linkInfo.token)}` : ""]
600
+ }), linkInfo.lan.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
601
+ variant: "outline",
602
+ size: "sm",
603
+ onClick: () => {
604
+ copyFirstLink();
605
+ },
606
+ children: linkCopied ? t("link.copied") : t("link.copy")
607
+ })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
608
+ className: WallView_module_css_default.linkText,
609
+ children: t("link.unreachable").replace("{hint}", linkInfo.hint ?? "")
610
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
611
+ variant: "ghost",
612
+ size: "sm",
613
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutline16, { size: 14 }),
614
+ onClick: () => {
615
+ setLinkOpen(false);
616
+ },
617
+ children: t("overlay.close")
618
+ })]
619
+ }),
620
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
621
+ className: WallView_module_css_default.grid,
622
+ "data-cols": columns,
623
+ children: [shown.map((port) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WallPane, {
624
+ port,
625
+ alive: aliveRef.current[port] ?? true,
626
+ zoomed: zoomedPort === port,
627
+ stopping: confirmingStop === port,
628
+ onZoom: () => setZoomedPort(zoomedPort === port ? null : port),
629
+ onStop: () => {
630
+ handleStop(port);
631
+ },
632
+ onRemove: () => {
633
+ setConfirmingStop(null);
634
+ actions.removePort(port);
635
+ },
636
+ t
637
+ }, port)), shown.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
638
+ className: WallView_module_css_default.empty,
639
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("empty") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
640
+ className: WallView_module_css_default.hint,
641
+ children: t("empty.hint")
642
+ })]
643
+ })]
644
+ })
645
+ ]
646
+ });
647
+ }
648
+ //#endregion
649
+ //#region \0dsh-css:D:\2026AppDev\dsh-plugins-multi-task\harness-src\packages\client\ui-multi-wall\src\client\WallToggle.module.css.mjs
650
+ const css = ".bmjS6q_row{box-sizing:border-box;width:calc(100% + 8px);height:34px;color:var(--dsw-alias-label-secondary);cursor:pointer;font:inherit;background:0 0;border:none;border-radius:12px;align-items:center;gap:8px;margin:4px -4px;padding:6px 2px 6px 10px;display:flex;overflow:hidden}.bmjS6q_row:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.bmjS6q_label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}";
651
+ const tagId = "@deepseek-ai/dsh-client-ui-multi-wall/WallToggle.module.css";
652
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
653
+ const tag = document.createElement("style");
654
+ tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-multi-wall";
655
+ tag.dataset.pluginCss = tagId;
656
+ tag.textContent = css;
657
+ document.head.appendChild(tag);
658
+ }
659
+ var WallToggle_module_css_default = {
660
+ "label": "bmjS6q_label",
661
+ "row": "bmjS6q_row"
662
+ };
663
+ //#endregion
664
+ //#region src/client/WallToggle.tsx
665
+ /**
666
+ * WallToggle: the sidebar-foot shortcut. Clicking it opens the wall view —
667
+ * the `conversation.view` ring switches to the 'multi-wall' entry, which the
668
+ * header renders as the "多窗口墙" tab. The click is a plain user-equivalent
669
+ * activation: it finds the header's view-ring tab for this plugin's label and
670
+ * clicks it, so the official view-ring state machine (the chat store's active
671
+ * view field) performs the switch. No store is declared: the ring decides
672
+ * what renders, so this row owns no state.
673
+ *
674
+ * Session-scoped by design: the view ring (and its header tabs) only renders
675
+ * with an active session, so the shortcut is inert on the empty-hero screen —
676
+ * the user first opens or creates a session (the official flow), after which
677
+ * the tab is present and the click lands.
678
+ */
679
+ /**
680
+ * Render the wall shortcut row (icon; label only in the wide column).
681
+ * @param props - composed slot props.
682
+ * @returns the shortcut row.
683
+ */
684
+ function WallToggle({ wide, t }) {
685
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
686
+ type: "button",
687
+ className: WallToggle_module_css_default.row,
688
+ "aria-label": t("toggle.aria"),
689
+ title: t("toggle"),
690
+ onClick: () => {
691
+ const label = t("view.multiWall");
692
+ Array.from(document.querySelectorAll("[role=\"tab\"]")).find((el) => el.textContent?.trim() === label)?.click();
693
+ },
694
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFullscreenOutline16, { size: wide ? 16 : 18 }), wide && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
695
+ className: WallToggle_module_css_default.label,
696
+ children: t("toggle")
697
+ })]
698
+ });
699
+ }
700
+ //#endregion
701
+ //#region src/client/index.ts
702
+ /** Dictionary namespace owned by this plugin. */
703
+ const NS = "multiWall";
704
+ /** Required services: slots for both registrations, locale for copy. */
705
+ const inject = ["slots", "locale"];
706
+ /**
707
+ * Whether this page is an embedded wall pane. Panes load
708
+ * `?multi-wall=embed`; such pages register no wall UI at all, which stops a
709
+ * wall inside a wall (the pane would otherwise recursively embed the
710
+ * serving instance).
711
+ * @returns true when the query flag is present.
712
+ */
713
+ function isEmbeddedPane() {
714
+ return new URLSearchParams(window.location.search).has("multi-wall");
715
+ }
716
+ /**
717
+ * Client plugin body: register the dictionaries, the view-ring entry (the
718
+ * wall), and the sidebar footer shortcut. Embedded panes register nothing.
719
+ * @param ctx - client root context.
720
+ */
721
+ function apply(ctx) {
722
+ if (isEmbeddedPane()) return;
723
+ ctx.effect(() => ctx.locale.register(NS, {
724
+ zh,
725
+ en
726
+ }), "ui-multi-wall: dictionaries");
727
+ const t = ctx.locale.bind(NS);
728
+ const wallStore = createWallStore();
729
+ ctx.slots.inject("conversation.view", () => ctx.slots.register({
730
+ name: "conversation.view",
731
+ id: "multi-wall",
732
+ order: 20,
733
+ label: () => t("view.multiWall"),
734
+ locale: NS,
735
+ store: wallStore,
736
+ inject: () => createWallInjected()
737
+ }, WallView));
738
+ ctx.slots.inject("sidebar.footer.action", () => ctx.slots.register({
739
+ name: "sidebar.footer.action",
740
+ id: "multi-wall",
741
+ order: 10,
742
+ locale: NS
743
+ }, WallToggle));
744
+ }
745
+ //#endregion
746
+ exports.WallToggle = WallToggle;
747
+ exports.WallView = WallView;
748
+ exports.apply = apply;
749
+ exports.createWallStore = createWallStore;
750
+ exports.inject = inject;
751
+ return module.exports;
752
+ }
753
+ });
754
+
755
+ //# sourceMappingURL=client.js.map