dsh-local-link 0.1.0 → 0.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/CHANGELOG.md +42 -0
- package/README.md +61 -6
- package/cordis.patch.yml +8 -1
- package/docs/ARCHITECTURE.md +71 -8
- package/docs/DIAGNOSTICS.md +1 -1
- package/docs/MOBILE_VIEW.md +73 -0
- package/docs/SECURITY.md +8 -1
- package/docs/images/local-access-devices.jpg +0 -0
- package/docs/images/local-access-diagnostics.jpg +0 -0
- package/docs/images/local-access-qr.jpg +0 -0
- package/docs/images/mobile-chat.png +0 -0
- package/docs/images/mobile-navigation.png +0 -0
- package/docs/images/mobile-session-info.png +0 -0
- package/docs/images/mobile-subagents.png +0 -0
- package/lib/client.js +1305 -51
- package/lib/client.js.map +1 -1
- package/lib/index.d.mts +9 -113
- package/lib/index.mjs +197 -94
- package/package.json +24 -7
package/lib/client.js
CHANGED
|
@@ -28,10 +28,1141 @@ window.__ModuleLoader__.load({
|
|
|
28
28
|
//#endregion
|
|
29
29
|
let react = require("react");
|
|
30
30
|
react = __toESM(react, 1);
|
|
31
|
+
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
32
|
+
//#region src/mobile-dialog.ts
|
|
33
|
+
const FOCUSABLE = [
|
|
34
|
+
"button:not([disabled])",
|
|
35
|
+
"a[href]",
|
|
36
|
+
"input:not([disabled])",
|
|
37
|
+
"select:not([disabled])",
|
|
38
|
+
"textarea:not([disabled])",
|
|
39
|
+
"[tabindex]:not([tabindex=\"-1\"])"
|
|
40
|
+
].join(",");
|
|
41
|
+
/** Focus lifecycle for plugin-owned mobile modal surfaces. */
|
|
42
|
+
function useMobileDialog(open, close) {
|
|
43
|
+
const dialog = (0, react.useRef)(null);
|
|
44
|
+
const closeRef = (0, react.useRef)(close);
|
|
45
|
+
closeRef.current = close;
|
|
46
|
+
(0, react.useEffect)(() => {
|
|
47
|
+
if (!open) return;
|
|
48
|
+
const previous = document.activeElement instanceof HTMLElement ? document.activeElement : void 0;
|
|
49
|
+
const frame = window.requestAnimationFrame(() => {
|
|
50
|
+
(dialog.current?.querySelector(FOCUSABLE) ?? dialog.current)?.focus({ preventScroll: true });
|
|
51
|
+
});
|
|
52
|
+
const onKeyDown = (event) => {
|
|
53
|
+
if (event.key === "Escape") {
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
closeRef.current();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (event.key !== "Tab" || dialog.current === null) return;
|
|
59
|
+
const focusable = [...dialog.current.querySelectorAll(FOCUSABLE)].filter((element) => !element.hidden && element.getClientRects().length > 0);
|
|
60
|
+
if (focusable.length === 0) {
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
dialog.current.focus({ preventScroll: true });
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const first = focusable[0];
|
|
66
|
+
const last = focusable.at(-1);
|
|
67
|
+
if (event.shiftKey && document.activeElement === first) {
|
|
68
|
+
event.preventDefault();
|
|
69
|
+
last?.focus({ preventScroll: true });
|
|
70
|
+
} else if (!event.shiftKey && document.activeElement === last) {
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
first?.focus({ preventScroll: true });
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
window.addEventListener("keydown", onKeyDown);
|
|
76
|
+
return () => {
|
|
77
|
+
window.cancelAnimationFrame(frame);
|
|
78
|
+
window.removeEventListener("keydown", onKeyDown);
|
|
79
|
+
if (previous?.isConnected === true) previous.focus({ preventScroll: true });
|
|
80
|
+
};
|
|
81
|
+
}, [open]);
|
|
82
|
+
return dialog;
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/mobile-subagents.tsx
|
|
86
|
+
const NS$3 = "dsh.localLink";
|
|
87
|
+
const MOBILE_SUBAGENT_DOCK_ID = "dsh-local-link.mobile-subagents";
|
|
88
|
+
const MOBILE_SUBAGENT_OVERLAY_ID = "dsh-local-link.mobile-subagent-sheet";
|
|
89
|
+
const MOBILE_SUBAGENT_LINEAGE_PRIORITY = -100;
|
|
90
|
+
function mobileSubagentProjections(summary) {
|
|
91
|
+
return summary?.projectionValues ?? {};
|
|
92
|
+
}
|
|
93
|
+
/** Compact token count, matching the stock Harness subagent catalog. */
|
|
94
|
+
function formatMobileSubagentTokens(value) {
|
|
95
|
+
const scaled = (next) => next >= 100 ? String(Math.round(next)) : String(Math.round(next * 10) / 10);
|
|
96
|
+
if (value < 1e3) return String(value);
|
|
97
|
+
if (value < 1e6) return `${scaled(value / 1e3)}K`;
|
|
98
|
+
return `${scaled(value / 1e6)}M`;
|
|
99
|
+
}
|
|
100
|
+
/** Sum the four disjoint durable provider-usage buckets used by Harness. */
|
|
101
|
+
function mobileSubagentTokenTotal(usage) {
|
|
102
|
+
return usage === void 0 ? void 0 : usage.uncachedInputTokens + usage.outputTokens + usage.cacheReadTokens + usage.cacheWriteTokens;
|
|
103
|
+
}
|
|
104
|
+
/** Active-turn duration, including settled spans, matching the stock catalog. */
|
|
105
|
+
function mobileSubagentActivityDuration(summary, activity, now) {
|
|
106
|
+
const timing = mobileSubagentProjections(summary).subagentTiming;
|
|
107
|
+
if (timing === void 0) return void 0;
|
|
108
|
+
if (timing.active === void 0) return timing.settledMs;
|
|
109
|
+
const end = activity === "running" ? now : timing.active.through;
|
|
110
|
+
return timing.settledMs + Math.max(0, end - timing.active.since);
|
|
111
|
+
}
|
|
112
|
+
function formatMobileSubagentDuration(ms) {
|
|
113
|
+
const totalSeconds = Math.floor(Math.max(0, ms) / 1e3);
|
|
114
|
+
const seconds = totalSeconds % 60;
|
|
115
|
+
const totalMinutes = Math.floor(totalSeconds / 60);
|
|
116
|
+
const minutes = totalMinutes % 60;
|
|
117
|
+
const totalHours = Math.floor(totalMinutes / 60);
|
|
118
|
+
const hours = totalHours % 24;
|
|
119
|
+
const days = Math.floor(totalHours / 24);
|
|
120
|
+
if (days > 0) return `${days}d ${hours}h`;
|
|
121
|
+
if (totalHours > 0) return `${totalHours}h ${String(minutes).padStart(2, "0")}m`;
|
|
122
|
+
if (totalMinutes > 0) return `${totalMinutes}m ${String(seconds).padStart(2, "0")}s`;
|
|
123
|
+
return `${seconds}s`;
|
|
124
|
+
}
|
|
125
|
+
var MobileSubagentController = class {
|
|
126
|
+
snapshot = Object.freeze({});
|
|
127
|
+
listeners = /* @__PURE__ */ new Set();
|
|
128
|
+
subscribe = (listener) => {
|
|
129
|
+
this.listeners.add(listener);
|
|
130
|
+
return () => this.listeners.delete(listener);
|
|
131
|
+
};
|
|
132
|
+
getSnapshot = () => this.snapshot;
|
|
133
|
+
open(rootSessionId) {
|
|
134
|
+
this.update(Object.freeze({ rootSessionId }));
|
|
135
|
+
}
|
|
136
|
+
close() {
|
|
137
|
+
this.update(Object.freeze({}));
|
|
138
|
+
}
|
|
139
|
+
update(snapshot) {
|
|
140
|
+
if (snapshot.rootSessionId === this.snapshot.rootSessionId) return;
|
|
141
|
+
this.snapshot = snapshot;
|
|
142
|
+
for (const listener of this.listeners) listener();
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
/** Resolve the catalog shown for an ordinary session or its currently opened child. */
|
|
146
|
+
function mobileSubagentRoot(sessionId, summaries) {
|
|
147
|
+
const summary = summaries[sessionId];
|
|
148
|
+
return summary?.origin === "subagent" && summary.parentId !== void 0 ? summary.parentId : sessionId;
|
|
149
|
+
}
|
|
150
|
+
/** Count the uninterrupted subagent-origin tree without creating a second data store. */
|
|
151
|
+
function mobileSubagentMetrics(rootSessionId, summaries) {
|
|
152
|
+
let count = 0;
|
|
153
|
+
let runningCount = 0;
|
|
154
|
+
for (const summary of Object.values(summaries)) {
|
|
155
|
+
if (summary.origin !== "subagent") continue;
|
|
156
|
+
let cursor = summary;
|
|
157
|
+
const visited = /* @__PURE__ */ new Set();
|
|
158
|
+
while (cursor?.origin === "subagent" && cursor.parentId !== void 0 && !visited.has(cursor.id)) {
|
|
159
|
+
visited.add(cursor.id);
|
|
160
|
+
if (cursor.parentId === rootSessionId) {
|
|
161
|
+
count += 1;
|
|
162
|
+
if (summary.running) runningCount += 1;
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
cursor = summaries[cursor.parentId];
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return Object.freeze({
|
|
169
|
+
count,
|
|
170
|
+
runningCount
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
function directCatalogMetrics(rootSessionId, catalogs) {
|
|
174
|
+
const healthy = (catalogs[rootSessionId]?.entries ?? []).filter((entry) => entry.kind === "child");
|
|
175
|
+
return {
|
|
176
|
+
count: healthy.length,
|
|
177
|
+
runningCount: healthy.filter((entry) => entry.activity === "running").length
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function MobileSubagentTrigger({ controller, sessionId, t, useSessions }) {
|
|
181
|
+
const summaries = useSessions((state) => state.byId);
|
|
182
|
+
const catalogs = useSessions((state) => state.subagentsByParent);
|
|
183
|
+
const rootSessionId = mobileSubagentRoot(sessionId, summaries);
|
|
184
|
+
const metrics = (0, react.useMemo)(() => mobileSubagentMetrics(rootSessionId, summaries), [rootSessionId, summaries]);
|
|
185
|
+
const direct = (0, react.useMemo)(() => directCatalogMetrics(rootSessionId, catalogs), [catalogs, rootSessionId]);
|
|
186
|
+
const count = Math.max(metrics.count, direct.count);
|
|
187
|
+
const runningCount = Math.max(metrics.runningCount, direct.runningCount);
|
|
188
|
+
if (count === 0) return null;
|
|
189
|
+
const label = t("mobile.subagents.total", { count });
|
|
190
|
+
const activityLabel = t("mobile.subagents.running", { count: runningCount });
|
|
191
|
+
return /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
192
|
+
"aria-label": `${label}. ${activityLabel}`,
|
|
193
|
+
className: "dllm-subagent-chip",
|
|
194
|
+
size: "md",
|
|
195
|
+
variant: "outline",
|
|
196
|
+
onClick: () => controller.open(rootSessionId)
|
|
197
|
+
}, /* @__PURE__ */ react.default.createElement("span", {
|
|
198
|
+
"aria-hidden": "true",
|
|
199
|
+
className: "dllm-subagent-activity"
|
|
200
|
+
}, /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: runningCount > 0 ? "ongoing" : "done" })), /* @__PURE__ */ react.default.createElement("span", null, label), /* @__PURE__ */ react.default.createElement("span", {
|
|
201
|
+
"aria-hidden": "true",
|
|
202
|
+
className: "dllm-subagent-running"
|
|
203
|
+
}, activityLabel), /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutline14, {
|
|
204
|
+
className: "dllm-subagent-chevron",
|
|
205
|
+
size: 14
|
|
206
|
+
}));
|
|
207
|
+
}
|
|
208
|
+
function MobileLineageTitle({ displayTitle, lineageSessionId, openTitle, useSessions }) {
|
|
209
|
+
const summary = useSessions((state) => state.byId[lineageSessionId]);
|
|
210
|
+
const currentRef = (0, react.useRef)(null);
|
|
211
|
+
(0, react.useEffect)(() => {
|
|
212
|
+
if (summary?.origin === "subagent" && openTitle === void 0) currentRef.current?.scrollIntoView({
|
|
213
|
+
block: "nearest",
|
|
214
|
+
inline: "end"
|
|
215
|
+
});
|
|
216
|
+
}, [
|
|
217
|
+
lineageSessionId,
|
|
218
|
+
openTitle,
|
|
219
|
+
summary?.origin
|
|
220
|
+
]);
|
|
221
|
+
if (summary?.origin !== "subagent") return null;
|
|
222
|
+
if (openTitle !== void 0) return /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
223
|
+
className: "dllm-lineage-title dllm-lineage-ancestor",
|
|
224
|
+
size: "sm",
|
|
225
|
+
variant: "ghost",
|
|
226
|
+
onClick: openTitle
|
|
227
|
+
}, displayTitle);
|
|
228
|
+
return /* @__PURE__ */ react.default.createElement("span", {
|
|
229
|
+
className: "dllm-lineage-current",
|
|
230
|
+
ref: currentRef
|
|
231
|
+
}, /* @__PURE__ */ react.default.createElement("span", { className: "dllm-lineage-title" }, displayTitle));
|
|
232
|
+
}
|
|
233
|
+
function CatalogRows({ actions, catalogs, expanded, level, onOpen, onToggle, parentSessionId, summaries, t, now }) {
|
|
234
|
+
const catalog = catalogs[parentSessionId];
|
|
235
|
+
if (catalog === void 0 || catalog.state === "loading") return /* @__PURE__ */ react.default.createElement("div", { className: "dllm-subagent-state" }, t("mobile.subagents.loading"));
|
|
236
|
+
if (catalog.state === "error") return /* @__PURE__ */ react.default.createElement("div", { className: "dllm-subagent-state dllm-subagent-error" }, /* @__PURE__ */ react.default.createElement("span", null, t("mobile.subagents.error")), /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
237
|
+
size: "sm",
|
|
238
|
+
variant: "outline",
|
|
239
|
+
onClick: () => void actions.refresh(parentSessionId)
|
|
240
|
+
}, t("mobile.subagents.retry")));
|
|
241
|
+
if (catalog.entries.length === 0) return /* @__PURE__ */ react.default.createElement("div", { className: "dllm-subagent-state" }, t("mobile.subagents.empty"));
|
|
242
|
+
return /* @__PURE__ */ react.default.createElement("div", {
|
|
243
|
+
className: "dllm-subagent-tree",
|
|
244
|
+
role: "tree"
|
|
245
|
+
}, catalog.entries.map((entry) => {
|
|
246
|
+
if (entry.kind === "diagnostic") return /* @__PURE__ */ react.default.createElement("div", {
|
|
247
|
+
className: "dllm-subagent-row dllm-subagent-disabled",
|
|
248
|
+
key: entry.id,
|
|
249
|
+
style: { "--dllm-level": level }
|
|
250
|
+
}, /* @__PURE__ */ react.default.createElement("span", { className: "dllm-subagent-row-main" }, /* @__PURE__ */ react.default.createElement("strong", null, t("mobile.subagents.unavailable")), /* @__PURE__ */ react.default.createElement("small", null, entry.reason)));
|
|
251
|
+
const open = expanded.has(entry.id);
|
|
252
|
+
const summary = summaries[entry.id];
|
|
253
|
+
const title = entry.label ?? summary?.displayTitle ?? entry.id;
|
|
254
|
+
const mode = t(entry.mode === "continuable" ? "mobile.subagents.continuable" : "mobile.subagents.oneShot");
|
|
255
|
+
const activity = t(entry.activity === "running" ? "mobile.subagents.active" : "mobile.subagents.inactive");
|
|
256
|
+
const secondary = [
|
|
257
|
+
summary?.title,
|
|
258
|
+
mode,
|
|
259
|
+
activity
|
|
260
|
+
].filter((value) => value !== void 0).join(" · ");
|
|
261
|
+
const totalTokens = mobileSubagentTokenTotal(mobileSubagentProjections(summary).tokenUsage);
|
|
262
|
+
const duration = mobileSubagentActivityDuration(summary, entry.activity, now);
|
|
263
|
+
const address = {
|
|
264
|
+
parentSessionId,
|
|
265
|
+
childSessionId: entry.id,
|
|
266
|
+
mode: entry.mode
|
|
267
|
+
};
|
|
268
|
+
return /* @__PURE__ */ react.default.createElement(react.default.Fragment, { key: entry.id }, /* @__PURE__ */ react.default.createElement("div", {
|
|
269
|
+
className: "dllm-subagent-row",
|
|
270
|
+
role: "treeitem",
|
|
271
|
+
"aria-expanded": entry.hasChildren ? open : void 0,
|
|
272
|
+
style: { "--dllm-level": level }
|
|
273
|
+
}, entry.hasChildren ? /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
274
|
+
"aria-label": open ? t("mobile.subagents.collapse") : t("mobile.subagents.expand"),
|
|
275
|
+
className: "dllm-subagent-expand",
|
|
276
|
+
size: "sm",
|
|
277
|
+
variant: "ghost",
|
|
278
|
+
onClick: () => onToggle(entry.id, !open)
|
|
279
|
+
}, /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutline14, { size: 14 })) : /* @__PURE__ */ react.default.createElement("span", { className: "dllm-subagent-expand-space" }), /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
280
|
+
className: "dllm-subagent-row-main",
|
|
281
|
+
size: "md",
|
|
282
|
+
variant: "ghost",
|
|
283
|
+
onClick: () => onOpen(address)
|
|
284
|
+
}, /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: entry.activity === "running" ? "ongoing" : "done" }), /* @__PURE__ */ react.default.createElement("span", { className: "dllm-subagent-content" }, /* @__PURE__ */ react.default.createElement("strong", null, title), /* @__PURE__ */ react.default.createElement("small", null, secondary)), (totalTokens !== void 0 || duration !== void 0) && /* @__PURE__ */ react.default.createElement("span", { className: "dllm-subagent-metrics" }, totalTokens !== void 0 && /* @__PURE__ */ react.default.createElement("span", null, formatMobileSubagentTokens(totalTokens), " tok"), duration !== void 0 && /* @__PURE__ */ react.default.createElement("span", null, formatMobileSubagentDuration(duration))))), entry.hasChildren && open && /* @__PURE__ */ react.default.createElement(CatalogRows, {
|
|
285
|
+
actions,
|
|
286
|
+
catalogs,
|
|
287
|
+
expanded,
|
|
288
|
+
level: level + 1,
|
|
289
|
+
onOpen,
|
|
290
|
+
onToggle,
|
|
291
|
+
parentSessionId: entry.id,
|
|
292
|
+
summaries,
|
|
293
|
+
t,
|
|
294
|
+
now
|
|
295
|
+
}));
|
|
296
|
+
}));
|
|
297
|
+
}
|
|
298
|
+
function MobileSubagentSheet({ actions, controller, t, useSessions }) {
|
|
299
|
+
const rootSessionId = (0, react.useSyncExternalStore)(controller.subscribe, controller.getSnapshot).rootSessionId;
|
|
300
|
+
const catalogs = useSessions((state) => state.subagentsByParent);
|
|
301
|
+
const summaries = useSessions((state) => state.byId);
|
|
302
|
+
const [expanded, setExpanded] = (0, react.useState)(() => /* @__PURE__ */ new Set());
|
|
303
|
+
const [now, setNow] = (0, react.useState)(() => Date.now());
|
|
304
|
+
const observed = (0, react.useRef)(/* @__PURE__ */ new Set());
|
|
305
|
+
const dialog = useMobileDialog(rootSessionId !== void 0, () => controller.close());
|
|
306
|
+
(0, react.useEffect)(() => {
|
|
307
|
+
if (rootSessionId === void 0) return;
|
|
308
|
+
setExpanded(/* @__PURE__ */ new Set());
|
|
309
|
+
observed.current.add(rootSessionId);
|
|
310
|
+
actions.observe(rootSessionId, true);
|
|
311
|
+
return () => {
|
|
312
|
+
for (const id of observed.current) actions.observe(id, false);
|
|
313
|
+
observed.current.clear();
|
|
314
|
+
};
|
|
315
|
+
}, [actions, rootSessionId]);
|
|
316
|
+
(0, react.useEffect)(() => {
|
|
317
|
+
if (rootSessionId === void 0) return;
|
|
318
|
+
if (![.../* @__PURE__ */ new Set([rootSessionId, ...expanded])].some((parentSessionId) => catalogs[parentSessionId]?.entries.some((entry) => entry.kind === "child" && entry.activity === "running") === true)) return;
|
|
319
|
+
setNow(Date.now());
|
|
320
|
+
const timer = window.setInterval(() => setNow(Date.now()), 1e3);
|
|
321
|
+
return () => window.clearInterval(timer);
|
|
322
|
+
}, [
|
|
323
|
+
catalogs,
|
|
324
|
+
expanded,
|
|
325
|
+
rootSessionId
|
|
326
|
+
]);
|
|
327
|
+
if (rootSessionId === void 0) return null;
|
|
328
|
+
const toggle = (id, open) => {
|
|
329
|
+
const closing = /* @__PURE__ */ new Set();
|
|
330
|
+
if (!open) {
|
|
331
|
+
const visit = (parentSessionId) => {
|
|
332
|
+
if (closing.has(parentSessionId)) return;
|
|
333
|
+
closing.add(parentSessionId);
|
|
334
|
+
for (const entry of catalogs[parentSessionId]?.entries ?? []) if (entry.kind === "child" && observed.current.has(entry.id)) visit(entry.id);
|
|
335
|
+
};
|
|
336
|
+
visit(id);
|
|
337
|
+
for (const closingId of closing) {
|
|
338
|
+
actions.observe(closingId, false);
|
|
339
|
+
observed.current.delete(closingId);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
setExpanded((current) => {
|
|
343
|
+
const next = new Set(current);
|
|
344
|
+
if (open) next.add(id);
|
|
345
|
+
else for (const closingId of closing) next.delete(closingId);
|
|
346
|
+
return next;
|
|
347
|
+
});
|
|
348
|
+
if (open) {
|
|
349
|
+
observed.current.add(id);
|
|
350
|
+
actions.observe(id, true);
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
const open = (address) => {
|
|
354
|
+
actions.open(address);
|
|
355
|
+
controller.close();
|
|
356
|
+
};
|
|
357
|
+
return /* @__PURE__ */ react.default.createElement("div", {
|
|
358
|
+
className: "dllm-subagent-layer",
|
|
359
|
+
role: "presentation"
|
|
360
|
+
}, /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
361
|
+
"aria-label": t("mobile.subagents.close"),
|
|
362
|
+
className: "dllm-subagent-backdrop",
|
|
363
|
+
size: "sm",
|
|
364
|
+
variant: "ghost",
|
|
365
|
+
onClick: () => controller.close()
|
|
366
|
+
}), /* @__PURE__ */ react.default.createElement("section", {
|
|
367
|
+
"aria-label": t("mobile.subagents.title"),
|
|
368
|
+
"aria-modal": "true",
|
|
369
|
+
className: "dllm-subagent-sheet",
|
|
370
|
+
ref: dialog,
|
|
371
|
+
role: "dialog",
|
|
372
|
+
tabIndex: -1
|
|
373
|
+
}, /* @__PURE__ */ react.default.createElement("div", {
|
|
374
|
+
"aria-hidden": "true",
|
|
375
|
+
className: "dllm-subagent-handle"
|
|
376
|
+
}), /* @__PURE__ */ react.default.createElement("header", { className: "dllm-subagent-sheet-header" }, /* @__PURE__ */ react.default.createElement("div", null, /* @__PURE__ */ react.default.createElement("h2", null, t("mobile.subagents.title")), /* @__PURE__ */ react.default.createElement("p", null, t("mobile.subagents.description"))), /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
377
|
+
"aria-label": t("mobile.subagents.close"),
|
|
378
|
+
className: "dllm-subagent-close",
|
|
379
|
+
size: "sm",
|
|
380
|
+
variant: "ghost",
|
|
381
|
+
onClick: () => controller.close()
|
|
382
|
+
}, /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutline16, { size: 16 }))), /* @__PURE__ */ react.default.createElement("div", { className: "dllm-subagent-list" }, /* @__PURE__ */ react.default.createElement(CatalogRows, {
|
|
383
|
+
actions,
|
|
384
|
+
catalogs,
|
|
385
|
+
expanded,
|
|
386
|
+
level: 0,
|
|
387
|
+
onOpen: open,
|
|
388
|
+
onToggle: toggle,
|
|
389
|
+
parentSessionId: rootSessionId,
|
|
390
|
+
summaries,
|
|
391
|
+
t,
|
|
392
|
+
now
|
|
393
|
+
}))));
|
|
394
|
+
}
|
|
395
|
+
const MOBILE_SUBAGENT_STYLES = `
|
|
396
|
+
.dllm-subagent-chip{box-sizing:border-box;display:flex;width:fit-content;max-width:100%;min-height:40px;align-items:center;gap:8px;margin:0 24px 6px;padding:7px 10px;border:var(--dsh-local-link-border-width) solid var(--dsw-alias-border-l2,rgb(127 127 127 / 24%));border-radius:12px;color:var(--dsw-alias-label-primary,inherit);background:var(--dsw-alias-bg-layer-1,rgb(127 127 127 / 8%));font:inherit;font-size:13px;font-weight:600;cursor:pointer}
|
|
397
|
+
.dllm-subagent-chip:hover{background:var(--dsw-alias-interactive-bg-hover,rgb(127 127 127 / 14%))}.dllm-subagent-activity{display:inline-flex;width:10px;height:10px;flex:none;align-items:center;justify-content:center}.dllm-subagent-running{display:inline-flex;align-items:center;color:var(--dsw-alias-label-tertiary,#6b7280);font-size:12px;font-weight:400;white-space:nowrap}.dllm-subagent-running::before{content:"·";margin-right:8px;color:var(--dsw-alias-label-quaternary,var(--dsw-alias-label-tertiary,#6b7280))}.dllm-subagent-chevron{width:14px;height:14px;margin-left:2px}
|
|
398
|
+
.dllm-lineage-title{display:block;max-width:min(42vw,220px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;line-height:20px}.dllm-lineage-ancestor{padding:4px;border:0;border-radius:9px;color:var(--dsw-alias-label-tertiary,inherit);background:transparent;font-family:inherit;font-weight:400;cursor:pointer}.dllm-lineage-ancestor:hover{background:var(--dsw-alias-interactive-bg-hover,rgb(127 127 127 / 12%))}.dllm-lineage-current{display:inline-flex;min-width:0;align-items:center;padding:4px;color:var(--dsw-alias-label-primary,inherit);font-weight:500}.dllm-shell header nav:has(.dllm-lineage-title){gap:0!important;overflow-x:auto;overscroll-behavior-inline:contain;scrollbar-width:none}.dllm-shell header nav:has(.dllm-lineage-title)>span{gap:1px!important}.dllm-shell header nav:has(.dllm-lineage-title)>span>button{padding-inline:4px!important;font-size:14px!important;line-height:20px!important}.dllm-shell header nav:has(.dllm-lineage-title)::-webkit-scrollbar{display:none}
|
|
399
|
+
.dllm-subagent-layer{position:fixed;z-index:110;inset:0;display:flex;align-items:flex-end;pointer-events:auto}.dllm-subagent-backdrop{position:absolute;inset:0;width:auto;height:auto;min-height:0;padding:0;border:0;border-radius:0;background:var(--dsw-alias-bg-mask-1,rgb(15 23 42 / 48%))!important}
|
|
400
|
+
.dllm-subagent-sheet{position:relative;box-sizing:border-box;display:flex;width:100%;max-height:min(78dvh,720px);flex-direction:column;padding:0 0 env(safe-area-inset-bottom);overflow:hidden;border:var(--dsh-local-link-border-width) solid var(--dsw-alias-border-l2,rgb(127 127 127 / 26%));border-bottom:0;border-radius:22px 22px 0 0;color:var(--dsw-alias-label-primary,inherit);background:var(--dsw-alias-bg-layer-1,#fff);box-shadow:0 -18px 50px rgb(15 23 42 / 22%)}
|
|
401
|
+
.dllm-subagent-handle{width:38px;height:4px;margin:9px auto 4px;border-radius:999px;background:var(--dsw-alias-border-l2,rgb(127 127 127 / 30%))}.dllm-subagent-sheet-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:12px 18px 14px;border-bottom:var(--dsh-local-link-border-width) solid var(--dsw-alias-border-l2,rgb(127 127 127 / 18%))}.dllm-subagent-sheet-header h2{margin:0;font-size:18px;line-height:24px}.dllm-subagent-sheet-header p{margin:3px 0 0;color:var(--dsw-alias-label-tertiary,#6b7280);font-size:12px;line-height:18px}.dllm-subagent-close{display:grid;width:40px;height:40px;flex:0 0 auto;padding:0;place-items:center;border:0;border-radius:10px;color:inherit;background:transparent}.dllm-subagent-close svg{width:16px;height:16px}
|
|
402
|
+
.dllm-subagent-list{min-height:120px;overflow:auto;padding:8px 10px 16px;overscroll-behavior:contain}.dllm-subagent-tree{display:flex;flex-direction:column}.dllm-subagent-row{display:flex;min-height:54px;align-items:center;padding-left:calc(var(--dllm-level) * 14px);border-bottom:var(--dsh-local-link-border-width) solid var(--dsw-alias-border-l2,rgb(127 127 127 / 13%))}.dllm-subagent-expand,.dllm-subagent-expand-space{display:grid;width:36px;height:44px;flex:0 0 auto;place-items:center}.dllm-subagent-expand{padding:0;border:0;color:inherit;background:transparent}.dllm-subagent-expand svg{width:14px;height:14px;transition:transform 120ms ease}.dllm-subagent-row[aria-expanded=true]>.dllm-subagent-expand svg{transform:rotate(90deg)}
|
|
403
|
+
.dllm-subagent-row-main{display:flex;min-width:0;height:auto;flex:1;align-items:flex-start;gap:8px;padding:7px 8px;text-align:left}.dllm-subagent-row-main>[data-state]{flex:none;margin-top:4px}.dllm-subagent-content{display:flex;min-width:0;flex:1;flex-direction:column}.dllm-subagent-content strong,.dllm-subagent-content small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dllm-subagent-content strong{font-size:13px;font-weight:500;line-height:18px}.dllm-subagent-content small,.dllm-subagent-metrics{color:var(--dsw-alias-label-tertiary,#6b7280);font-size:11px;line-height:16px}.dllm-subagent-metrics{display:grid;flex:none;grid-template-rows:18px 16px;text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}.dllm-subagent-disabled{opacity:.68}.dllm-subagent-state{display:flex;min-height:120px;align-items:center;justify-content:center;gap:10px;color:var(--dsw-alias-label-tertiary,#6b7280);font-size:13px}.dllm-subagent-error{color:var(--dsw-alias-status-danger,#dc2626)}
|
|
404
|
+
@media(prefers-reduced-motion:reduce){.dllm-subagent-expand svg{transition:none!important}}
|
|
405
|
+
`;
|
|
406
|
+
function applyMobileSubagents(ctx) {
|
|
407
|
+
const controller = new MobileSubagentController();
|
|
408
|
+
const actions = {
|
|
409
|
+
observe: (parentSessionId, open) => ctx.sessions.setSubagentCatalogOpen(parentSessionId, open),
|
|
410
|
+
open: (address) => ctx.sessions.openSubagent(address),
|
|
411
|
+
refresh: (parentSessionId) => ctx.sessions.refreshSubagents(parentSessionId)
|
|
412
|
+
};
|
|
413
|
+
ctx.effect(() => ctx.slots.inject("conversation.input.dock", () => ctx.slots.register({
|
|
414
|
+
name: "conversation.input.dock",
|
|
415
|
+
id: MOBILE_SUBAGENT_DOCK_ID,
|
|
416
|
+
order: 30,
|
|
417
|
+
locale: NS$3
|
|
418
|
+
}, (props) => /* @__PURE__ */ react.default.createElement(MobileSubagentTrigger, {
|
|
419
|
+
...props,
|
|
420
|
+
controller
|
|
421
|
+
}))), "dsh-local-link: mobile subagent dock");
|
|
422
|
+
ctx.effect(() => ctx.slots.inject("shell.overlay", () => ctx.slots.register({
|
|
423
|
+
name: "shell.overlay",
|
|
424
|
+
id: MOBILE_SUBAGENT_OVERLAY_ID,
|
|
425
|
+
order: 30,
|
|
426
|
+
locale: NS$3
|
|
427
|
+
}, (props) => /* @__PURE__ */ react.default.createElement(MobileSubagentSheet, {
|
|
428
|
+
...props,
|
|
429
|
+
actions,
|
|
430
|
+
controller
|
|
431
|
+
}))), "dsh-local-link: mobile subagent sheet");
|
|
432
|
+
ctx.effect(() => ctx.slots.inject("conversation.session.header.lineage", () => ctx.slots.register({
|
|
433
|
+
name: "conversation.session.header.lineage",
|
|
434
|
+
priority: MOBILE_SUBAGENT_LINEAGE_PRIORITY,
|
|
435
|
+
locale: NS$3
|
|
436
|
+
}, (props) => /* @__PURE__ */ react.default.createElement(MobileLineageTitle, props))), "dsh-local-link: compact mobile lineage title");
|
|
437
|
+
}
|
|
438
|
+
//#endregion
|
|
439
|
+
//#region src/mobile-session-info.tsx
|
|
440
|
+
const NS$2 = "dsh.localLink";
|
|
441
|
+
const MOBILE_SESSION_INFO_TRIGGER_ID = "dsh-local-link.mobile-session-info";
|
|
442
|
+
const MOBILE_SESSION_INFO_OVERLAY_ID = "dsh-local-link.mobile-session-info-drawer";
|
|
443
|
+
const MOBILE_AGENT_PRESET_PRIORITY = -100;
|
|
444
|
+
const MOBILE_SESSION_LOG_PRIORITY = -100;
|
|
445
|
+
const MOBILE_STATS_PRIORITY = -100;
|
|
446
|
+
var MobileSessionInfoController = class {
|
|
447
|
+
snapshot = Object.freeze({ open: false });
|
|
448
|
+
listeners = /* @__PURE__ */ new Set();
|
|
449
|
+
modelSubscriptions = /* @__PURE__ */ new Map();
|
|
450
|
+
modelResolver;
|
|
451
|
+
subscribe = (listener) => {
|
|
452
|
+
this.listeners.add(listener);
|
|
453
|
+
return () => this.listeners.delete(listener);
|
|
454
|
+
};
|
|
455
|
+
getSnapshot = () => this.snapshot;
|
|
456
|
+
attachModelResolver(resolver) {
|
|
457
|
+
this.modelResolver = resolver;
|
|
458
|
+
for (const [listener, subscription] of this.modelSubscriptions) {
|
|
459
|
+
subscription.unsubscribe?.();
|
|
460
|
+
subscription.unsubscribe = this.modelDirectory(subscription.sessionId)?.store.subscribe(listener);
|
|
461
|
+
listener();
|
|
462
|
+
}
|
|
463
|
+
return () => {
|
|
464
|
+
if (this.modelResolver !== resolver) return;
|
|
465
|
+
this.modelResolver = void 0;
|
|
466
|
+
for (const [listener, subscription] of this.modelSubscriptions) {
|
|
467
|
+
subscription.unsubscribe?.();
|
|
468
|
+
subscription.unsubscribe = void 0;
|
|
469
|
+
listener();
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
subscribeModel(sessionId, listener) {
|
|
474
|
+
const subscription = {
|
|
475
|
+
sessionId,
|
|
476
|
+
unsubscribe: this.modelDirectory(sessionId)?.store.subscribe(listener)
|
|
477
|
+
};
|
|
478
|
+
this.modelSubscriptions.set(listener, subscription);
|
|
479
|
+
return () => {
|
|
480
|
+
subscription.unsubscribe?.();
|
|
481
|
+
this.modelSubscriptions.delete(listener);
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
getModel(sessionId) {
|
|
485
|
+
return currentModelName(this.modelDirectory(sessionId)?.store.getSnapshot());
|
|
486
|
+
}
|
|
487
|
+
open() {
|
|
488
|
+
this.update(true);
|
|
489
|
+
}
|
|
490
|
+
close() {
|
|
491
|
+
this.update(false);
|
|
492
|
+
}
|
|
493
|
+
reportModel(sessionId, model) {
|
|
494
|
+
if (this.snapshot.modelSessionId === sessionId && this.snapshot.model === model) return;
|
|
495
|
+
this.snapshot = Object.freeze(model === void 0 ? {
|
|
496
|
+
open: this.snapshot.open,
|
|
497
|
+
modelSessionId: sessionId
|
|
498
|
+
} : {
|
|
499
|
+
open: this.snapshot.open,
|
|
500
|
+
modelSessionId: sessionId,
|
|
501
|
+
model
|
|
502
|
+
});
|
|
503
|
+
for (const listener of this.listeners) listener();
|
|
504
|
+
}
|
|
505
|
+
update(open) {
|
|
506
|
+
if (open === this.snapshot.open) return;
|
|
507
|
+
this.snapshot = Object.freeze({
|
|
508
|
+
...this.snapshot,
|
|
509
|
+
open
|
|
510
|
+
});
|
|
511
|
+
for (const listener of this.listeners) listener();
|
|
512
|
+
}
|
|
513
|
+
modelDirectory(sessionId) {
|
|
514
|
+
try {
|
|
515
|
+
return this.modelResolver?.directoryFor(sessionId);
|
|
516
|
+
} catch {
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
function mobilePresetLabel(preset, t) {
|
|
522
|
+
if (preset === void 0) return t("mobile.sessionInfo.notRecorded");
|
|
523
|
+
switch (preset) {
|
|
524
|
+
case "standard": return t("mobile.sessionInfo.preset.standard");
|
|
525
|
+
case "code": return t("mobile.sessionInfo.preset.code");
|
|
526
|
+
case "minimal": return t("mobile.sessionInfo.preset.minimal");
|
|
527
|
+
case "cordis": return t("mobile.sessionInfo.preset.cordis");
|
|
528
|
+
default: return preset;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
function recordOf(value) {
|
|
532
|
+
return typeof value === "object" && value !== null ? value : void 0;
|
|
533
|
+
}
|
|
534
|
+
function finiteNumber(value) {
|
|
535
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
536
|
+
}
|
|
537
|
+
function formatSessionTokens(value) {
|
|
538
|
+
const scaled = (n) => n >= 100 ? String(Math.round(n)) : String(Math.round(n * 10) / 10);
|
|
539
|
+
if (value < 1e3) return String(value);
|
|
540
|
+
if (value < 1e6) return `${scaled(value / 1e3)}K`;
|
|
541
|
+
return `${scaled(value / 1e6)}M`;
|
|
542
|
+
}
|
|
543
|
+
function formatSessionDuration(ms) {
|
|
544
|
+
const seconds = ms / 1e3;
|
|
545
|
+
if (seconds < 60) return `${Math.round(seconds * 10) / 10}s`;
|
|
546
|
+
const whole = Math.round(seconds);
|
|
547
|
+
return `${Math.floor(whole / 60)}m${whole % 60}s`;
|
|
548
|
+
}
|
|
549
|
+
function contextOccupancy(value) {
|
|
550
|
+
const pressure = recordOf(value);
|
|
551
|
+
const usedTokens = finiteNumber(pressure?.projectedTokens) ?? finiteNumber(pressure?.pressureTokens);
|
|
552
|
+
const contextWindow = finiteNumber(pressure?.contextWindow);
|
|
553
|
+
if (usedTokens === void 0 || contextWindow === void 0 || contextWindow <= 0) return void 0;
|
|
554
|
+
return {
|
|
555
|
+
percent: Math.min(100, Math.round(usedTokens / contextWindow * 100)),
|
|
556
|
+
usedTokens,
|
|
557
|
+
contextWindow
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
function contextBreakdown(value) {
|
|
561
|
+
const breakdown = recordOf(value);
|
|
562
|
+
const systemTokens = finiteNumber(breakdown?.systemTokens);
|
|
563
|
+
const toolsTokens = finiteNumber(breakdown?.toolsTokens);
|
|
564
|
+
const messageTokens = finiteNumber(breakdown?.messageTokens);
|
|
565
|
+
if (systemTokens === void 0 || toolsTokens === void 0 || messageTokens === void 0) return void 0;
|
|
566
|
+
return {
|
|
567
|
+
systemTokens,
|
|
568
|
+
toolsTokens,
|
|
569
|
+
messageTokens
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
function permissionName(value) {
|
|
573
|
+
const selection = recordOf(value);
|
|
574
|
+
const currentValue = typeof selection?.currentValue === "string" ? selection.currentValue : void 0;
|
|
575
|
+
if (currentValue === void 0 || !Array.isArray(selection?.options)) return void 0;
|
|
576
|
+
const name = recordOf(selection.options.find((option) => recordOf(option)?.value === currentValue))?.name;
|
|
577
|
+
return typeof name === "string" ? name : currentValue;
|
|
578
|
+
}
|
|
579
|
+
function permissionValue(value) {
|
|
580
|
+
const selection = recordOf(value);
|
|
581
|
+
return typeof selection?.currentValue === "string" ? selection.currentValue : void 0;
|
|
582
|
+
}
|
|
583
|
+
function currentModelName(value) {
|
|
584
|
+
const directory = recordOf(value);
|
|
585
|
+
const current = recordOf(directory?.current);
|
|
586
|
+
const providerId = typeof current?.provider === "string" ? current.provider : void 0;
|
|
587
|
+
const modelId = typeof current?.model === "string" ? current.model : void 0;
|
|
588
|
+
if (modelId === void 0) return void 0;
|
|
589
|
+
if (!Array.isArray(directory?.groups)) return modelId;
|
|
590
|
+
const group = directory.groups.map(recordOf).find((candidate) => candidate?.id === providerId);
|
|
591
|
+
if (!Array.isArray(group?.models)) return modelId;
|
|
592
|
+
const model = group.models.map(recordOf).find((candidate) => candidate?.id === modelId);
|
|
593
|
+
return typeof model?.name === "string" ? model.name : modelId;
|
|
594
|
+
}
|
|
595
|
+
function lastUsedModel(snapshot) {
|
|
596
|
+
for (let index = snapshot.nodes.length - 1; index >= 0; index -= 1) {
|
|
597
|
+
const node = snapshot.nodes[index];
|
|
598
|
+
if (node?.kind !== "assistant") continue;
|
|
599
|
+
const identity = node.requestConfig ?? node.provenance;
|
|
600
|
+
if (identity?.model === void 0) continue;
|
|
601
|
+
return identity.provider.length > 0 ? `${identity.provider} · ${identity.model}` : identity.model;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
function sessionStats(value) {
|
|
605
|
+
const stats = recordOf(value);
|
|
606
|
+
const entries = [
|
|
607
|
+
"turns",
|
|
608
|
+
"steps",
|
|
609
|
+
"llmMs",
|
|
610
|
+
"toolMs",
|
|
611
|
+
"ttftMs",
|
|
612
|
+
"ttftSteps",
|
|
613
|
+
"decodeMs",
|
|
614
|
+
"decodeTokens"
|
|
615
|
+
].map((key) => finiteNumber(stats?.[key]));
|
|
616
|
+
if (entries.some((entry) => entry === void 0)) return void 0;
|
|
617
|
+
const [turns, steps, llmMs, toolMs, ttftMs, ttftSteps, decodeMs, decodeTokens] = entries;
|
|
618
|
+
return {
|
|
619
|
+
turns,
|
|
620
|
+
steps,
|
|
621
|
+
llmMs,
|
|
622
|
+
toolMs,
|
|
623
|
+
ttftMs,
|
|
624
|
+
ttftSteps,
|
|
625
|
+
decodeMs,
|
|
626
|
+
decodeTokens
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
function tokenUsage(value) {
|
|
630
|
+
const usage = recordOf(value);
|
|
631
|
+
const uncachedInputTokens = finiteNumber(usage?.uncachedInputTokens);
|
|
632
|
+
const outputTokens = finiteNumber(usage?.outputTokens);
|
|
633
|
+
const cacheReadTokens = finiteNumber(usage?.cacheReadTokens);
|
|
634
|
+
const cacheWriteTokens = finiteNumber(usage?.cacheWriteTokens);
|
|
635
|
+
if (uncachedInputTokens === void 0 || outputTokens === void 0 || cacheReadTokens === void 0 || cacheWriteTokens === void 0) return void 0;
|
|
636
|
+
return {
|
|
637
|
+
uncachedInputTokens,
|
|
638
|
+
outputTokens,
|
|
639
|
+
cacheReadTokens,
|
|
640
|
+
cacheWriteTokens
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
function sessionStatLines(projections, t) {
|
|
644
|
+
const stats = sessionStats(projections.sessionStats);
|
|
645
|
+
const usage = tokenUsage(projections.tokenUsage);
|
|
646
|
+
const lines = [];
|
|
647
|
+
if (stats !== void 0 && stats.steps > 0) {
|
|
648
|
+
lines.push(t("mobile.sessionInfo.stats.counts", {
|
|
649
|
+
turns: stats.turns,
|
|
650
|
+
steps: stats.steps
|
|
651
|
+
}));
|
|
652
|
+
const durations = [];
|
|
653
|
+
if (stats.llmMs > 0) durations.push(t("mobile.sessionInfo.stats.llm", { duration: formatSessionDuration(stats.llmMs) }));
|
|
654
|
+
if (stats.toolMs > 0) durations.push(t("mobile.sessionInfo.stats.tools", { duration: formatSessionDuration(stats.toolMs) }));
|
|
655
|
+
if (durations.length > 0) lines.push(durations.join(" · "));
|
|
656
|
+
const speeds = [];
|
|
657
|
+
if (stats.ttftSteps > 0) speeds.push(t("mobile.sessionInfo.stats.ttft", { duration: formatSessionDuration(stats.ttftMs / stats.ttftSteps) }));
|
|
658
|
+
if (stats.decodeMs > 0) speeds.push(t("mobile.sessionInfo.stats.throughput", { throughput: formatSessionTokens(stats.decodeTokens / (stats.decodeMs / 1e3)) }));
|
|
659
|
+
if (speeds.length > 0) lines.push(speeds.join(" · "));
|
|
660
|
+
}
|
|
661
|
+
if (usage !== void 0) {
|
|
662
|
+
const input = usage.uncachedInputTokens + usage.cacheReadTokens + usage.cacheWriteTokens;
|
|
663
|
+
if (input > 0 || usage.outputTokens > 0) {
|
|
664
|
+
if (input > 0) lines.push(t("mobile.sessionInfo.stats.cache", { percent: Math.round(usage.cacheReadTokens / input * 100) }));
|
|
665
|
+
lines.push(t("mobile.sessionInfo.stats.tokens", {
|
|
666
|
+
input: formatSessionTokens(input),
|
|
667
|
+
output: formatSessionTokens(usage.outputTokens)
|
|
668
|
+
}));
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
return lines;
|
|
672
|
+
}
|
|
673
|
+
function ContextRing({ occupancy }) {
|
|
674
|
+
const radius = 5.5;
|
|
675
|
+
const circumference = 2 * Math.PI * radius;
|
|
676
|
+
return /* @__PURE__ */ react.default.createElement("svg", {
|
|
677
|
+
"aria-hidden": "true",
|
|
678
|
+
className: "dllm-context-ring",
|
|
679
|
+
viewBox: "0 0 14 14"
|
|
680
|
+
}, /* @__PURE__ */ react.default.createElement("circle", {
|
|
681
|
+
className: "dllm-context-ring-track",
|
|
682
|
+
cx: "7",
|
|
683
|
+
cy: "7",
|
|
684
|
+
r: radius
|
|
685
|
+
}), /* @__PURE__ */ react.default.createElement("circle", {
|
|
686
|
+
className: "dllm-context-ring-fill",
|
|
687
|
+
cx: "7",
|
|
688
|
+
cy: "7",
|
|
689
|
+
r: radius,
|
|
690
|
+
strokeDasharray: circumference,
|
|
691
|
+
strokeDashoffset: circumference * (1 - occupancy.percent / 100),
|
|
692
|
+
transform: "rotate(-90 7 7)"
|
|
693
|
+
}));
|
|
694
|
+
}
|
|
695
|
+
const permissionShieldOutline = "M8.20554 0.899994L14.7901 3.36857V7.01026C14.7901 12 11.0466 14.2103 8.20554 15.3C5.36446 14.2103 1.62012 12 1.62012 7.01026V3.36857L8.20554 0.899994Z";
|
|
696
|
+
function PermissionGlyph({ value }) {
|
|
697
|
+
if (value === "read-only") return /* @__PURE__ */ react.default.createElement("svg", {
|
|
698
|
+
"aria-hidden": "true",
|
|
699
|
+
viewBox: "0 0 16 16"
|
|
700
|
+
}, /* @__PURE__ */ react.default.createElement("path", {
|
|
701
|
+
d: permissionShieldOutline,
|
|
702
|
+
fill: "none",
|
|
703
|
+
stroke: "currentColor",
|
|
704
|
+
strokeLinejoin: "round",
|
|
705
|
+
strokeWidth: "1.31831"
|
|
706
|
+
}), /* @__PURE__ */ react.default.createElement("path", {
|
|
707
|
+
d: "M12.1654 5.7552L8.9447 9.41475C8.73044 9.65816 8.53628 9.8804 8.35774 10.0423C8.1713 10.2114 7.94235 10.3717 7.64016 10.4254C7.48207 10.4535 7.32 10.4552 7.16151 10.4294C6.85843 10.3801 6.62728 10.2223 6.43836 10.0559C6.25752 9.89653 6.06037 9.67732 5.84264 9.43705L4.72925 8.20897L5.63557 7.38707L6.74897 8.61594C6.98603 8.87755 7.12974 9.03533 7.24673 9.13839C7.31033 9.19443 7.34485 9.21476 7.35823 9.22122C7.38068 9.22484 7.40352 9.22515 7.42593 9.22122C7.40522 9.22502 7.42893 9.23294 7.53583 9.136C7.65132 9.03126 7.79316 8.87139 8.02643 8.60638L11.2479 4.94763L12.1654 5.7552Z",
|
|
708
|
+
fill: "currentColor"
|
|
709
|
+
}));
|
|
710
|
+
if (value === "workspace-write") return /* @__PURE__ */ react.default.createElement("svg", {
|
|
711
|
+
"aria-hidden": "true",
|
|
712
|
+
viewBox: "0 0 16 16"
|
|
713
|
+
}, /* @__PURE__ */ react.default.createElement("path", {
|
|
714
|
+
d: "M8.08887 0.251709C8.20479 0.23085 8.32486 0.241168 8.43652 0.282959L15.0215 2.75171C15.2787 2.84819 15.4492 3.09414 15.4492 3.3689V7.0105C15.4492 7.10986 15.4441 7.2081 15.4414 7.30542C15.0285 7.07175 14.5905 6.87695 14.1309 6.73022V3.82495L8.20508 1.60327L2.2793 3.82495V7.0105C2.27936 9.7171 3.4745 11.5379 5.02734 12.7947C5.01025 12.9942 5 13.1962 5 13.4001C5.00001 13.7617 5.02722 14.1169 5.08008 14.4636C2.91555 13.0393 0.961014 10.752 0.960938 7.0105V3.3689C0.960938 3.09417 1.13146 2.84821 1.38867 2.75171L7.97461 0.282959L8.08887 0.251709Z",
|
|
715
|
+
fill: "currentColor"
|
|
716
|
+
}), /* @__PURE__ */ react.default.createElement("path", {
|
|
717
|
+
d: "M11.3525 5.64688V6.85688H5V5.64688H11.3525ZM9.5824 8.29376V9.50376H5V8.29376H9.5824ZM14.6647 15.6852H10.0338C10.3878 15.3751 10.7567 15.0517 11.0772 14.7706C11.2531 14.6164 11.4144 14.4746 11.5511 14.3547H14.6647V15.6852Z",
|
|
718
|
+
fill: "currentColor"
|
|
719
|
+
}), /* @__PURE__ */ react.default.createElement("path", {
|
|
720
|
+
d: "M8.14852 14.1308L7.33925 15.4976C7.22458 15.6912 7.42245 15.9194 7.63037 15.8333L9.09785 15.2254L15.0399 10.0719L14.0905 8.97733L8.14852 14.1308Z",
|
|
721
|
+
fill: "currentColor"
|
|
722
|
+
}));
|
|
723
|
+
if (value === "danger-full-access") return /* @__PURE__ */ react.default.createElement("svg", {
|
|
724
|
+
"aria-hidden": "true",
|
|
725
|
+
viewBox: "0 0 16 16"
|
|
726
|
+
}, /* @__PURE__ */ react.default.createElement("path", {
|
|
727
|
+
d: permissionShieldOutline,
|
|
728
|
+
fill: "none",
|
|
729
|
+
stroke: "currentColor",
|
|
730
|
+
strokeLinejoin: "round",
|
|
731
|
+
strokeWidth: "1.31831"
|
|
732
|
+
}), /* @__PURE__ */ react.default.createElement("path", {
|
|
733
|
+
d: "M9.10094 4.5V8.75939H7.59888V4.5H9.10094ZM9.10094 9.8114V11.5H7.59888V9.8114H9.10094Z",
|
|
734
|
+
fill: "currentColor"
|
|
735
|
+
}));
|
|
736
|
+
return null;
|
|
737
|
+
}
|
|
738
|
+
function MobileSessionInfoTrigger({ controller, sessionId, t, useSession }) {
|
|
739
|
+
const selectedModel = (0, react.useSyncExternalStore)((listener) => controller.subscribeModel(sessionId, listener), () => controller.getModel(sessionId));
|
|
740
|
+
const usedModel = useSession(lastUsedModel);
|
|
741
|
+
const model = selectedModel ?? usedModel;
|
|
742
|
+
(0, react.useEffect)(() => controller.reportModel(String(sessionId), model), [
|
|
743
|
+
controller,
|
|
744
|
+
model,
|
|
745
|
+
sessionId
|
|
746
|
+
]);
|
|
747
|
+
return /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
748
|
+
"aria-label": t("mobile.sessionInfo.open"),
|
|
749
|
+
className: "dllm-session-info-trigger",
|
|
750
|
+
title: t("mobile.sessionInfo.open"),
|
|
751
|
+
size: "sm",
|
|
752
|
+
variant: "toolbar",
|
|
753
|
+
onClick: () => controller.open()
|
|
754
|
+
}, /* @__PURE__ */ react.default.createElement("svg", {
|
|
755
|
+
"aria-hidden": "true",
|
|
756
|
+
className: "dllm-session-info-glyph",
|
|
757
|
+
viewBox: "0 0 24 24"
|
|
758
|
+
}, /* @__PURE__ */ react.default.createElement("circle", {
|
|
759
|
+
cx: "12",
|
|
760
|
+
cy: "12",
|
|
761
|
+
r: "8.5"
|
|
762
|
+
}), /* @__PURE__ */ react.default.createElement("path", { d: "M12 10.8v5.2M12 8h.01" })));
|
|
763
|
+
}
|
|
764
|
+
function MobileSessionInfoDrawer({ controller, downloads, t, useSessions }) {
|
|
765
|
+
const state = (0, react.useSyncExternalStore)(controller.subscribe, controller.getSnapshot);
|
|
766
|
+
const current = useSessions((snapshot) => snapshot.current);
|
|
767
|
+
const session = useSessions((snapshot) => current === void 0 ? void 0 : snapshot.byId[current]);
|
|
768
|
+
const downloadState = (0, react.useSyncExternalStore)(downloads.store.subscribe, downloads.store.getSnapshot);
|
|
769
|
+
const download = session === void 0 ? void 0 : downloadState.bySession[String(session.id)];
|
|
770
|
+
const downloading = download?.status === "downloading";
|
|
771
|
+
const projections = session?.projectionValues ?? {};
|
|
772
|
+
const occupancy = contextOccupancy(projections.contextPressure);
|
|
773
|
+
const breakdown = contextBreakdown(projections.contextBreakdown);
|
|
774
|
+
const access = permissionName(projections.permissions);
|
|
775
|
+
const accessValue = permissionValue(projections.permissions);
|
|
776
|
+
const model = state.modelSessionId === String(session?.id) ? state.model : void 0;
|
|
777
|
+
const stats = sessionStatLines(projections, t);
|
|
778
|
+
const close = () => {
|
|
779
|
+
if (session !== void 0) downloads.dismiss(session.id);
|
|
780
|
+
controller.close();
|
|
781
|
+
};
|
|
782
|
+
const dialog = useMobileDialog(state.open && session !== void 0, close);
|
|
783
|
+
if (!state.open || session === void 0) return null;
|
|
784
|
+
return /* @__PURE__ */ react.default.createElement("div", { className: "dllm-session-info-layer" }, /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
785
|
+
"aria-label": t("mobile.sessionInfo.close"),
|
|
786
|
+
className: "dllm-session-info-backdrop",
|
|
787
|
+
size: "sm",
|
|
788
|
+
variant: "ghost",
|
|
789
|
+
onClick: close
|
|
790
|
+
}), /* @__PURE__ */ react.default.createElement("aside", {
|
|
791
|
+
"aria-label": t("mobile.sessionInfo.title"),
|
|
792
|
+
"aria-modal": "true",
|
|
793
|
+
className: "dllm-session-info-drawer",
|
|
794
|
+
ref: dialog,
|
|
795
|
+
role: "dialog",
|
|
796
|
+
tabIndex: -1
|
|
797
|
+
}, /* @__PURE__ */ react.default.createElement("header", { className: "dllm-session-info-header" }, /* @__PURE__ */ react.default.createElement("div", null, /* @__PURE__ */ react.default.createElement("small", null, t("mobile.sessionInfo.eyebrow")), /* @__PURE__ */ react.default.createElement("h2", null, session.displayTitle)), /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
798
|
+
"aria-label": t("mobile.sessionInfo.close"),
|
|
799
|
+
size: "sm",
|
|
800
|
+
variant: "ghost",
|
|
801
|
+
onClick: close
|
|
802
|
+
}, /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutline16, { size: 16 }))), /* @__PURE__ */ react.default.createElement("div", { className: "dllm-session-info-body" }, occupancy !== void 0 && /* @__PURE__ */ react.default.createElement("section", { className: "dllm-session-info-card dllm-session-context-card" }, /* @__PURE__ */ react.default.createElement("div", { className: "dllm-session-info-row" }, /* @__PURE__ */ react.default.createElement(ContextRing, { occupancy }), /* @__PURE__ */ react.default.createElement("div", null, /* @__PURE__ */ react.default.createElement("small", null, t("mobile.sessionInfo.context")), /* @__PURE__ */ react.default.createElement("strong", null, occupancy.percent, "% · ", formatSessionTokens(occupancy.usedTokens), " / ", formatSessionTokens(occupancy.contextWindow)))), breakdown !== void 0 && breakdown.systemTokens + breakdown.toolsTokens + breakdown.messageTokens > 0 && /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("div", {
|
|
803
|
+
className: "dllm-context-breakdown-bar",
|
|
804
|
+
"aria-hidden": "true"
|
|
805
|
+
}, /* @__PURE__ */ react.default.createElement("span", {
|
|
806
|
+
className: "dllm-context-segment dllm-context-system",
|
|
807
|
+
style: { width: `${occupancy.percent * breakdown.systemTokens / (breakdown.systemTokens + breakdown.toolsTokens + breakdown.messageTokens)}%` }
|
|
808
|
+
}), /* @__PURE__ */ react.default.createElement("span", {
|
|
809
|
+
className: "dllm-context-segment dllm-context-tools",
|
|
810
|
+
style: { width: `${occupancy.percent * breakdown.toolsTokens / (breakdown.systemTokens + breakdown.toolsTokens + breakdown.messageTokens)}%` }
|
|
811
|
+
}), /* @__PURE__ */ react.default.createElement("span", {
|
|
812
|
+
className: "dllm-context-segment dllm-context-messages",
|
|
813
|
+
style: { width: `${occupancy.percent * breakdown.messageTokens / (breakdown.systemTokens + breakdown.toolsTokens + breakdown.messageTokens)}%` }
|
|
814
|
+
})), /* @__PURE__ */ react.default.createElement("div", { className: "dllm-context-breakdown-rows" }, /* @__PURE__ */ react.default.createElement("div", null, /* @__PURE__ */ react.default.createElement("span", null, /* @__PURE__ */ react.default.createElement("i", { className: "dllm-context-swatch dllm-context-system" }), t("mobile.sessionInfo.context.system")), /* @__PURE__ */ react.default.createElement("span", null, "~", formatSessionTokens(breakdown.systemTokens))), /* @__PURE__ */ react.default.createElement("div", null, /* @__PURE__ */ react.default.createElement("span", null, /* @__PURE__ */ react.default.createElement("i", { className: "dllm-context-swatch dllm-context-tools" }), t("mobile.sessionInfo.context.tools")), /* @__PURE__ */ react.default.createElement("span", null, "~", formatSessionTokens(breakdown.toolsTokens))), /* @__PURE__ */ react.default.createElement("div", null, /* @__PURE__ */ react.default.createElement("span", null, /* @__PURE__ */ react.default.createElement("i", { className: "dllm-context-swatch dllm-context-messages" }), t("mobile.sessionInfo.context.messages")), /* @__PURE__ */ react.default.createElement("span", null, "~", formatSessionTokens(breakdown.messageTokens)))))), /* @__PURE__ */ react.default.createElement("section", { className: "dllm-session-info-card dllm-session-properties-card" }, /* @__PURE__ */ react.default.createElement("div", { className: "dllm-session-property" }, /* @__PURE__ */ react.default.createElement("small", null, t("mobile.sessionInfo.model")), /* @__PURE__ */ react.default.createElement("span", null, model ?? t("mobile.sessionInfo.notRecorded"))), /* @__PURE__ */ react.default.createElement("div", { className: "dllm-session-property" }, /* @__PURE__ */ react.default.createElement("small", { className: "dllm-session-property-label" }, /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.IconFolderOpenOutline16, { size: 13 }), t("mobile.sessionInfo.permissions")), /* @__PURE__ */ react.default.createElement("span", { className: "dllm-session-property-value dllm-session-property-access" }, /* @__PURE__ */ react.default.createElement(PermissionGlyph, { value: accessValue }), access ?? t("mobile.sessionInfo.notRecorded"))), /* @__PURE__ */ react.default.createElement("div", { className: "dllm-session-property" }, /* @__PURE__ */ react.default.createElement("small", { className: "dllm-session-property-label" }, /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.IconAgentPresetOutline16, { size: 13 }), t("mobile.sessionInfo.agentPreset")), /* @__PURE__ */ react.default.createElement("span", null, mobilePresetLabel(session.agentPreset, t)))), stats.length > 0 && /* @__PURE__ */ react.default.createElement("section", { className: "dllm-session-info-card dllm-session-stats-card" }, /* @__PURE__ */ react.default.createElement("div", {
|
|
815
|
+
className: "dllm-session-info-icon",
|
|
816
|
+
"aria-hidden": "true"
|
|
817
|
+
}, /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.IconDataOutline16, { size: 15 })), /* @__PURE__ */ react.default.createElement("div", null, /* @__PURE__ */ react.default.createElement("small", null, t("mobile.sessionInfo.statistics")), stats.map((line) => /* @__PURE__ */ react.default.createElement("p", { key: line }, line)))), /* @__PURE__ */ react.default.createElement("section", { className: "dllm-session-info-card dllm-session-log-card" }, /* @__PURE__ */ react.default.createElement("div", {
|
|
818
|
+
className: "dllm-session-info-icon",
|
|
819
|
+
"aria-hidden": "true"
|
|
820
|
+
}, /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.IconDownloadOutline16, { size: 17 })), /* @__PURE__ */ react.default.createElement("div", null, /* @__PURE__ */ react.default.createElement("small", null, t("mobile.sessionInfo.sessionLog")), /* @__PURE__ */ react.default.createElement("p", null, t("mobile.sessionInfo.sessionLogDescription")), download?.status === "error" && /* @__PURE__ */ react.default.createElement("p", { className: "dllm-session-log-error" }, download.error ?? t("mobile.sessionInfo.sessionLogError")), download?.status === "success" && /* @__PURE__ */ react.default.createElement("p", null, t("mobile.sessionInfo.sessionLogReady"))), /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
821
|
+
className: "dllm-session-log-download",
|
|
822
|
+
disabled: downloading,
|
|
823
|
+
size: "sm",
|
|
824
|
+
variant: "outline",
|
|
825
|
+
onClick: () => void downloads.download(session.id)
|
|
826
|
+
}, t(downloading ? "mobile.sessionInfo.sessionLogDownloading" : "mobile.sessionInfo.sessionLogDownload"))))));
|
|
827
|
+
}
|
|
828
|
+
const MOBILE_SESSION_INFO_STYLES = `
|
|
829
|
+
.dllm-session-info-trigger{display:grid;width:44px;height:44px;margin:0;padding:0;place-items:center;border:var(--dsh-local-link-border-width) solid var(--dsw-alias-border-l2,rgb(148 163 184 / 30%));border-radius:12px;color:inherit;background:var(--dsw-alias-bg-layer-1,rgb(255 255 255 / 92%));box-shadow:var(--dsw-shadow-lv3,0 8px 24px rgb(15 23 42 / 14%));cursor:pointer}
|
|
830
|
+
.dllm-session-info-trigger:hover{background:var(--dsw-alias-interactive-bg-hover,rgb(127 127 127 / 18%))}
|
|
831
|
+
.dllm-session-info-glyph{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
|
|
832
|
+
.dllm-session-info-layer{position:fixed;z-index:120;inset:0;display:flex;justify-content:flex-end;pointer-events:auto}.dllm-session-info-backdrop{position:absolute;inset:0;width:auto;height:auto;min-height:0;padding:0;border:0;border-radius:0;background:var(--dsw-alias-bg-mask-1,rgb(15 23 42 / 46%))!important}
|
|
833
|
+
.dllm-session-info-drawer{position:relative;box-sizing:border-box;display:flex;width:var(--dllm-side-drawer-width);height:100dvh;flex-direction:column;padding-top:env(safe-area-inset-top);border-left:var(--dsh-local-link-border-width) solid var(--dsw-alias-border-l2,rgb(127 127 127 / 22%));color:var(--dsw-alias-label-primary,inherit);background:var(--dsw-alias-bg-layer-1,#fff);box-shadow:-18px 0 52px rgb(15 23 42 / 24%);animation:dllm-session-info-in 180ms cubic-bezier(.22,1,.36,1)}
|
|
834
|
+
.dllm-session-info-header{display:flex;min-width:0;align-items:center;justify-content:space-between;gap:12px;padding:18px 16px 14px!important;border-bottom:var(--dsh-local-link-border-width) solid var(--dsw-alias-border-l2,rgb(127 127 127 / 18%))}.dllm-session-info-header>div{min-width:0}.dllm-session-info-header small{color:var(--dsw-alias-label-tertiary,#6b7280);font-size:11px;text-transform:uppercase;letter-spacing:.05em}.dllm-session-info-header h2{margin:3px 0 0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:17px;line-height:23px}.dllm-session-info-header button{display:grid;width:32px;height:32px;flex:none;padding:0;place-items:center;border:0;border-radius:50%;color:var(--dsw-alias-label-secondary,inherit);background:transparent}.dllm-session-info-header button:hover{background:var(--dsw-alias-interactive-bg-hover,rgb(127 127 127 / 14%))}.dllm-session-info-header button>svg{width:16px;height:16px}
|
|
835
|
+
.dllm-session-info-body{display:flex;min-height:0;flex:1;flex-direction:column;gap:8px;padding:12px 12px calc(14px + env(safe-area-inset-bottom));overflow-y:auto}.dllm-session-info-card{display:grid;grid-template-columns:28px minmax(0,1fr);gap:9px;padding:10px;border:var(--dsh-local-link-border-width) solid var(--dsw-alias-border-l2,rgb(127 127 127 / 18%));border-radius:10px;background:color-mix(in srgb,var(--dsw-alias-bg-base,transparent) 62%,transparent)}.dllm-session-info-icon{display:grid;width:24px;height:24px;place-items:center;color:var(--dsw-alias-label-tertiary,#6b7280)}.dllm-session-info-card small{display:block;color:var(--dsw-alias-label-tertiary,#6b7280);font-size:10.5px;line-height:15px}.dllm-session-info-card strong{display:block;margin-top:1px;font-size:13px;font-weight:500;line-height:18px}.dllm-session-info-card p{margin:2px 0 0;color:var(--dsw-alias-label-secondary,#6b7280);font-size:11.5px;line-height:17px}.dllm-session-log-card{grid-template-columns:28px minmax(0,1fr);align-items:start}.dllm-session-log-download{grid-column:2;width:fit-content;margin-top:5px}.dllm-session-log-error{color:var(--dsw-alias-state-error-primary,#dc2626)!important;overflow-wrap:anywhere}
|
|
836
|
+
.dllm-session-context-card{display:block;padding:3px 10px 8px}.dllm-session-info-row{display:grid;min-width:0;grid-template-columns:26px minmax(0,1fr);gap:8px;align-items:center;padding:7px 0}.dllm-session-info-row>div{min-width:0}.dllm-session-info-row strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dllm-context-ring{display:block;width:16px;height:16px;margin:auto;overflow:visible}.dllm-context-ring-track,.dllm-context-ring-fill{fill:none;stroke-width:1.6}.dllm-context-ring-track{stroke:var(--dsw-alias-border-l3,rgb(127 127 127 / 24%))}.dllm-context-ring-fill{stroke:var(--dsw-alias-label-tertiary,#6b7280);stroke-linecap:round}.dllm-context-breakdown-bar{display:flex;height:4px;margin:2px 0 7px;gap:1px;overflow:hidden;border-radius:999px;background:var(--dsw-alias-interactive-bg-hover,rgb(127 127 127 / 12%))}.dllm-context-segment{height:100%;min-width:2px;border-radius:1px;background:var(--meter-tint)}.dllm-context-system{--meter-tint:var(--dsw-static-neutral-bluish-400,#8a94a6)}.dllm-context-tools{--meter-tint:#a78bfa}.dllm-context-messages{--meter-tint:var(--dsw-static-blue-450,#4f8cff)}.dllm-context-breakdown-rows{display:grid;gap:1px}.dllm-context-breakdown-rows>div{display:flex;align-items:center;justify-content:space-between;gap:10px;color:var(--dsw-alias-label-secondary,#6b7280);font-size:10.5px;line-height:16px}.dllm-context-breakdown-rows>div>span:last-child{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary,inherit)}.dllm-context-swatch{display:inline-block;width:7px;height:7px;margin-right:5px;border-radius:2px;background:var(--meter-tint)}.dllm-session-properties-card{display:block;padding:2px 10px}.dllm-session-property{display:grid;grid-template-columns:minmax(92px,38%) minmax(0,1fr);gap:10px;align-items:baseline;padding:7px 0}.dllm-session-property+.dllm-session-property{border-top:var(--dsh-local-link-border-width) solid var(--dsw-alias-border-l2,rgb(127 127 127 / 14%))}.dllm-session-property-label{display:inline-flex!important;min-width:0;align-items:center;gap:5px}.dllm-session-property-label svg{width:13px;height:13px;flex:none}.dllm-session-property span{overflow:hidden;color:var(--dsw-alias-label-primary,inherit);font-size:12px;font-weight:400;line-height:17px;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dllm-session-property-value{display:inline-flex;min-width:0;align-items:center;justify-content:flex-end;gap:5px}.dllm-session-property-access svg{width:14px;height:14px;flex:none}.dllm-session-stats-card p{font-variant-numeric:tabular-nums}.dllm-session-stats-card p:first-of-type{margin-top:2px}
|
|
837
|
+
@keyframes dllm-session-info-in{from{transform:translateX(100%)}to{transform:translateX(0)}}@media(prefers-reduced-motion:reduce){.dllm-session-info-drawer{animation:none!important}}
|
|
838
|
+
`;
|
|
839
|
+
function applyMobileSessionInfo(ctx) {
|
|
840
|
+
const controller = new MobileSessionInfoController();
|
|
841
|
+
ctx.inject(["modelDirectories"], (scope) => {
|
|
842
|
+
const resolver = scope.modelDirectories;
|
|
843
|
+
if (resolver === void 0) return;
|
|
844
|
+
scope.effect(() => controller.attachModelResolver(resolver), "dsh-local-link: current model directory bridge");
|
|
845
|
+
});
|
|
846
|
+
ctx.effect(() => ctx.slots.inject("conversation.session.header.actions", () => ctx.slots.register({
|
|
847
|
+
name: "conversation.session.header.actions",
|
|
848
|
+
id: "agent-preset",
|
|
849
|
+
priority: MOBILE_AGENT_PRESET_PRIORITY
|
|
850
|
+
}, () => null)), "dsh-local-link: move mobile agent preset out of header");
|
|
851
|
+
ctx.effect(() => ctx.slots.inject("conversation.session.header.utilities", () => ctx.slots.register({
|
|
852
|
+
name: "conversation.session.header.utilities",
|
|
853
|
+
id: "session-log-download",
|
|
854
|
+
priority: MOBILE_SESSION_LOG_PRIORITY
|
|
855
|
+
}, () => null)), "dsh-local-link: move mobile session log out of header");
|
|
856
|
+
ctx.effect(() => ctx.slots.inject("conversation.composer.dock", () => ctx.slots.register({
|
|
857
|
+
name: "conversation.composer.dock",
|
|
858
|
+
id: "stats",
|
|
859
|
+
priority: MOBILE_STATS_PRIORITY
|
|
860
|
+
}, () => null)), "dsh-local-link: move mobile session statistics into session info");
|
|
861
|
+
ctx.effect(() => ctx.slots.inject("conversation.session.header.utilities", () => ctx.slots.register({
|
|
862
|
+
name: "conversation.session.header.utilities",
|
|
863
|
+
id: MOBILE_SESSION_INFO_TRIGGER_ID,
|
|
864
|
+
order: 90,
|
|
865
|
+
locale: NS$2
|
|
866
|
+
}, (props) => /* @__PURE__ */ react.default.createElement(MobileSessionInfoTrigger, {
|
|
867
|
+
...props,
|
|
868
|
+
controller
|
|
869
|
+
}))), "dsh-local-link: mobile session info trigger");
|
|
870
|
+
ctx.effect(() => ctx.slots.inject("shell.overlay", () => ctx.slots.register({
|
|
871
|
+
name: "shell.overlay",
|
|
872
|
+
id: MOBILE_SESSION_INFO_OVERLAY_ID,
|
|
873
|
+
order: 40,
|
|
874
|
+
locale: NS$2
|
|
875
|
+
}, (props) => /* @__PURE__ */ react.default.createElement(MobileSessionInfoDrawer, {
|
|
876
|
+
...props,
|
|
877
|
+
controller,
|
|
878
|
+
downloads: ctx.sessionLogDownload
|
|
879
|
+
}))), "dsh-local-link: mobile session info drawer");
|
|
880
|
+
}
|
|
881
|
+
//#endregion
|
|
882
|
+
//#region src/mobile-layout.tsx
|
|
883
|
+
const NS$1 = "dsh.localLink";
|
|
884
|
+
const MOBILE_SETTINGS_PRIORITY = -100;
|
|
885
|
+
const MOBILE_LOCAL_ACCESS_PRIORITY = -100;
|
|
886
|
+
var MobileComposerAutofocusGuard = class {
|
|
887
|
+
selected;
|
|
888
|
+
suppressUntil = 0;
|
|
889
|
+
pointerTarget = null;
|
|
890
|
+
pointerAt = 0;
|
|
891
|
+
constructor(selected) {
|
|
892
|
+
this.selected = selected;
|
|
893
|
+
}
|
|
894
|
+
selectionChanged(selected, now) {
|
|
895
|
+
if (selected === this.selected) return;
|
|
896
|
+
this.selected = selected;
|
|
897
|
+
this.suppressUntil = now + 1200;
|
|
898
|
+
}
|
|
899
|
+
pointerDown(target, now) {
|
|
900
|
+
this.pointerTarget = target;
|
|
901
|
+
this.pointerAt = now;
|
|
902
|
+
}
|
|
903
|
+
shouldBlur(target, now) {
|
|
904
|
+
const intentional = this.pointerTarget === target && now - this.pointerAt <= 700;
|
|
905
|
+
this.pointerTarget = null;
|
|
906
|
+
if (intentional) {
|
|
907
|
+
this.suppressUntil = 0;
|
|
908
|
+
return false;
|
|
909
|
+
}
|
|
910
|
+
if (now > this.suppressUntil) return false;
|
|
911
|
+
this.suppressUntil = 0;
|
|
912
|
+
return true;
|
|
913
|
+
}
|
|
914
|
+
};
|
|
915
|
+
function installMobileComposerAutofocusGuard(ctx) {
|
|
916
|
+
const guard = new MobileComposerAutofocusGuard(ctx.sessions.list.getSnapshot().current);
|
|
917
|
+
const composerInput = (target) => {
|
|
918
|
+
if (!(target instanceof HTMLElement)) return null;
|
|
919
|
+
if (!target.matches("textarea,[contenteditable=\"true\"]")) return null;
|
|
920
|
+
return target.closest(".dllm-main") !== null || document.body.hasAttribute("data-dsh-local-link-mobile") ? target : null;
|
|
921
|
+
};
|
|
922
|
+
const offSessions = ctx.sessions.list.subscribe(() => {
|
|
923
|
+
guard.selectionChanged(ctx.sessions.list.getSnapshot().current, Date.now());
|
|
924
|
+
});
|
|
925
|
+
const onPointerDown = (event) => {
|
|
926
|
+
const target = composerInput(event.target);
|
|
927
|
+
if (target !== null) guard.pointerDown(target, Date.now());
|
|
928
|
+
};
|
|
929
|
+
const onFocusIn = (event) => {
|
|
930
|
+
const target = composerInput(event.target);
|
|
931
|
+
if (target !== null && guard.shouldBlur(target, Date.now())) target.blur();
|
|
932
|
+
};
|
|
933
|
+
document.addEventListener("pointerdown", onPointerDown, true);
|
|
934
|
+
document.addEventListener("focusin", onFocusIn, true);
|
|
935
|
+
return () => {
|
|
936
|
+
offSessions();
|
|
937
|
+
document.removeEventListener("pointerdown", onPointerDown, true);
|
|
938
|
+
document.removeEventListener("focusin", onFocusIn, true);
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
const MOBILE_SIDEBAR_INTERACTIVE_SELECTOR = [
|
|
942
|
+
"button",
|
|
943
|
+
"a",
|
|
944
|
+
"input",
|
|
945
|
+
"textarea",
|
|
946
|
+
"select",
|
|
947
|
+
"[role=\"button\"]",
|
|
948
|
+
"[role=\"menuitem\"]"
|
|
949
|
+
].join(",");
|
|
950
|
+
/**
|
|
951
|
+
* Close the drawer only for a row-selection tap. Harness owns the session
|
|
952
|
+
* overflow button and renders its Menu through a portal; treating that button
|
|
953
|
+
* as a row tap closes the drawer before Rename/Fork/Archive can be selected.
|
|
954
|
+
*/
|
|
955
|
+
function shouldCloseMobileSidebarForElement(target) {
|
|
956
|
+
if (target.closest(MOBILE_SIDEBAR_INTERACTIVE_SELECTOR) !== null) return false;
|
|
957
|
+
const item = target.closest("[role=\"treeitem\"]");
|
|
958
|
+
return item !== null && item.getAttribute("aria-expanded") === null;
|
|
959
|
+
}
|
|
960
|
+
function MobileThemeToggle({ controller, useDarkLabel, useLightLabel }) {
|
|
961
|
+
const dark = (0, react.useSyncExternalStore)(controller.subscribe, controller.getSnapshot).active.colorScheme === "dark";
|
|
962
|
+
const label = dark ? useLightLabel : useDarkLabel;
|
|
963
|
+
return /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
964
|
+
"aria-label": label,
|
|
965
|
+
className: "dllm-theme-button",
|
|
966
|
+
title: label,
|
|
967
|
+
size: "sm",
|
|
968
|
+
variant: "ghost",
|
|
969
|
+
onClick: () => controller.setDark(!dark)
|
|
970
|
+
}, dark ? /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.IconDarkOutline16, { size: 16 }) : /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.IconLightOutline16, { size: 16 }));
|
|
971
|
+
}
|
|
972
|
+
function StockMobileControls({ layout, labels, themeController, useDarkLabel, useLightLabel }) {
|
|
973
|
+
return /* @__PURE__ */ react.default.createElement("div", { className: "dllm-stock-controls" }, /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
974
|
+
"aria-label": labels.openNavigation,
|
|
975
|
+
className: "dllm-stock-menu",
|
|
976
|
+
size: "sm",
|
|
977
|
+
variant: "toolbar",
|
|
978
|
+
onClick: () => layout.toggleSidebar()
|
|
979
|
+
}, /* @__PURE__ */ react.default.createElement("svg", {
|
|
980
|
+
"aria-hidden": "true",
|
|
981
|
+
viewBox: "0 0 24 24"
|
|
982
|
+
}, /* @__PURE__ */ react.default.createElement("path", { d: "M4 7h16M4 12h16M4 17h16" }))), /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
983
|
+
"aria-label": labels.closeOverlay,
|
|
984
|
+
className: "dllm-stock-scrim",
|
|
985
|
+
size: "sm",
|
|
986
|
+
variant: "ghost",
|
|
987
|
+
onClick: () => layout.toggleSidebar()
|
|
988
|
+
}), /* @__PURE__ */ react.default.createElement("div", { className: "dllm-stock-theme" }, /* @__PURE__ */ react.default.createElement(MobileThemeToggle, {
|
|
989
|
+
controller: themeController,
|
|
990
|
+
useDarkLabel,
|
|
991
|
+
useLightLabel
|
|
992
|
+
})));
|
|
993
|
+
}
|
|
994
|
+
const MOBILE_STOCK_LAYOUT_STYLES = `
|
|
995
|
+
body[data-dsh-local-link-mobile]{overflow:hidden}
|
|
996
|
+
body[data-dsh-local-link-mobile] #root>[data-slot="root"]>div:has(>[data-shell-overlay]){--dllm-side-drawer-width:min(88vw,340px);grid-template-columns:minmax(0,1fr)!important}
|
|
997
|
+
body[data-dsh-local-link-mobile] #root>[data-slot="root"]>div:has(>[data-shell-overlay])>:first-child{position:fixed;z-index:70;inset:0 auto 0 0;box-sizing:border-box;width:var(--dllm-side-drawer-width);transform:translateX(0);transition:transform 190ms cubic-bezier(.22,1,.36,1);box-shadow:18px 0 46px rgb(15 23 42 / 18%)}
|
|
998
|
+
body[data-dsh-local-link-mobile] #root>[data-slot="root"]>div:has(>[data-shell-overlay])>:first-child>[data-slot="sidebar"]>*{width:100%!important;height:100%!important}
|
|
999
|
+
body[data-dsh-local-link-mobile] [data-slot="sidebar"] button[class*="_brand"]{flex:0 0 auto!important;inline-size:max-content!important;width:max-content!important;min-width:0!important;max-width:calc(100% - 72px)!important;margin-right:auto!important}
|
|
1000
|
+
body[data-dsh-local-link-mobile] #root>[data-slot="root"]>div[data-sidebar-collapsed]:has(>[data-shell-overlay])>:first-child{transform:translateX(-104%);pointer-events:none}
|
|
1001
|
+
body[data-dsh-local-link-mobile] #root>[data-slot="root"]>div:has(>[data-shell-overlay])>:nth-child(2){grid-column:1;grid-row:1;min-width:0}
|
|
1002
|
+
body[data-dsh-local-link-mobile] #root>[data-slot="root"]>div:has(>[data-shell-overlay])>:nth-child(3){display:none}
|
|
1003
|
+
body[data-dsh-local-link-mobile] #root>[data-slot="root"]>div:has(>[data-shell-overlay])>[data-shell-overlay]{z-index:90}
|
|
1004
|
+
.dllm-stock-controls{position:absolute;inset:0;pointer-events:none}
|
|
1005
|
+
.dllm-stock-menu{position:absolute;top:max(10px,env(safe-area-inset-top));left:max(10px,env(safe-area-inset-left));display:grid;width:44px;height:44px;padding:0;place-items:center;border:var(--dsh-local-link-border-width) solid var(--dsw-alias-border-l2,rgb(148 163 184 / 30%));border-radius:12px;color:inherit;background:var(--dsw-alias-bg-layer-1,rgb(255 255 255 / 92%));box-shadow:var(--dsw-shadow-lv3,0 8px 24px rgb(15 23 42 / 14%));pointer-events:auto;transition:opacity 120ms ease,transform 120ms ease}
|
|
1006
|
+
.dllm-stock-menu svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}
|
|
1007
|
+
body[data-dsh-local-link-mobile] #root>[data-slot="root"]>div:not([data-sidebar-collapsed]):has(>[data-shell-overlay]) .dllm-stock-menu{opacity:0;transform:scale(.9);pointer-events:none}
|
|
1008
|
+
.dllm-stock-scrim{position:absolute;inset:0 0 0 var(--dllm-side-drawer-width);width:auto;height:auto;min-height:0;padding:0;border:0;border-radius:0;background:var(--dsw-alias-bg-mask-1,rgb(15 23 42 / 40%))!important;pointer-events:auto}
|
|
1009
|
+
body[data-dsh-local-link-mobile] #root>[data-slot="root"]>div[data-sidebar-collapsed]:has(>[data-shell-overlay]) .dllm-stock-scrim{opacity:0;pointer-events:none}
|
|
1010
|
+
.dllm-stock-theme{position:absolute;top:calc(env(safe-area-inset-top) + 22px);left:calc(var(--dllm-side-drawer-width) - 76px);display:grid;width:28px;height:28px;place-items:center;pointer-events:auto}
|
|
1011
|
+
.dllm-stock-theme .dllm-theme-button{box-sizing:border-box!important;width:28px!important;min-width:28px!important;max-width:28px!important;height:28px!important;min-height:28px!important;padding:0!important;border-radius:50%!important}
|
|
1012
|
+
body[data-dsh-local-link-mobile] #root>[data-slot="root"]>div[data-sidebar-collapsed]:has(>[data-shell-overlay]) .dllm-stock-theme{display:none}
|
|
1013
|
+
body[data-dsh-local-link-mobile] [data-slot="sidebar.workspaces"] button[aria-label="Add workspace"],body[data-dsh-local-link-mobile] [data-slot="sidebar.workspaces"] button[aria-label="添加工作区"]{display:none!important}
|
|
1014
|
+
body[data-dsh-local-link-mobile] [role="treeitem"][aria-selected="true"]>span:has(button[aria-label]){display:inline-flex!important;margin-left:4px}
|
|
1015
|
+
body[data-dsh-local-link-mobile] [role="treeitem"][aria-selected="true"]>span:has(button[aria-label]) button{width:28px!important;height:28px!important}
|
|
1016
|
+
body[data-dsh-local-link-mobile] [role="tree"]>div:has([role="treeitem"][aria-selected="true"]) [role="treeitem"][aria-expanded]>span:last-child{display:inline-flex!important}
|
|
1017
|
+
body[data-dsh-local-link-mobile] [role="treeitem"][aria-expanded]:has(>span[class*="_folderActive"])>span:last-child{display:inline-flex!important}
|
|
1018
|
+
body[data-dsh-local-link-mobile] header{min-width:0;padding-left:max(58px,env(safe-area-inset-left));padding-right:max(10px,env(safe-area-inset-right))}
|
|
1019
|
+
body[data-dsh-local-link-mobile] textarea,body[data-dsh-local-link-mobile] input{font-size:max(16px,1em)}
|
|
1020
|
+
body[data-dsh-local-link-mobile] [role=tablist]{display:flex;max-width:100%;overflow-x:auto;overscroll-behavior-inline:contain;scrollbar-width:none}
|
|
1021
|
+
body[data-dsh-local-link-mobile] [role=tablist]::-webkit-scrollbar{display:none}body[data-dsh-local-link-mobile] [role=tab]{flex:0 0 auto;min-height:40px;touch-action:manipulation}
|
|
1022
|
+
body[data-dsh-local-link-mobile] header nav:has(.dllm-lineage-title){gap:0!important;overflow-x:auto;overscroll-behavior-inline:contain;scrollbar-width:none}
|
|
1023
|
+
body[data-dsh-local-link-mobile] header nav:has(.dllm-lineage-title)>span{gap:1px!important}
|
|
1024
|
+
body[data-dsh-local-link-mobile] header nav:has(.dllm-lineage-title)>span>button{padding-inline:4px!important;font-size:14px!important;line-height:20px!important}
|
|
1025
|
+
body[data-dsh-local-link-mobile] [data-turn-tail]>div:last-child>button[aria-haspopup=dialog][aria-expanded]{position:relative;box-sizing:border-box;width:28px;max-width:28px;height:28px;overflow:hidden;padding:6px;border:0;border-radius:50%;color:var(--dsw-alias-label-secondary,inherit);font-size:0;line-height:0;text-indent:-9999px;background:var(--dsw-alias-interactive-bg-hover,rgb(127 127 127 / 14%))}
|
|
1026
|
+
body[data-dsh-local-link-mobile] [data-turn-tail]>div:last-child>button[aria-haspopup=dialog][aria-expanded]::before{content:"";display:block;width:16px;height:16px;background:currentColor;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.8 2.4a1.7 1.7 0 0 1 2.4 2.4L6 12l-3 .6.6-3 7.2-7.2Z'/%3E%3Cpath d='m9.8 3.4 2.8 2.8'/%3E%3C/svg%3E") center/16px 16px no-repeat}
|
|
1027
|
+
body[data-dsh-local-link-mobile] [data-cordis-panel]{left:max(12px,env(safe-area-inset-left))!important;right:max(12px,env(safe-area-inset-right))!important;bottom:max(12px,env(safe-area-inset-bottom))!important;width:auto!important;max-width:none!important;max-height:calc(100dvh - max(24px,env(safe-area-inset-top) + env(safe-area-inset-bottom)))!important}
|
|
1028
|
+
body[data-dsh-local-link-mobile] [data-cordis-row]{min-width:0}body[data-dsh-local-link-mobile] [data-cordis-row]>div{min-width:0;flex-wrap:wrap}body[data-dsh-local-link-mobile] [data-cordis-row] span{max-width:100%;white-space:normal;overflow-wrap:anywhere;text-overflow:clip}
|
|
1029
|
+
@media(prefers-reduced-motion:reduce){body[data-dsh-local-link-mobile] #root>[data-slot="root"]>div:has(>[data-shell-overlay])>:first-child{transition:none!important}}
|
|
1030
|
+
${MOBILE_SUBAGENT_STYLES}
|
|
1031
|
+
${MOBILE_SESSION_INFO_STYLES}
|
|
1032
|
+
`;
|
|
1033
|
+
/**
|
|
1034
|
+
* Enhance Harness' shipped responsive AppFrame without claiming its root or
|
|
1035
|
+
* redeclaring its child slots. This is the 3080 path used by the normal client.
|
|
1036
|
+
*/
|
|
1037
|
+
function applyResponsiveMobileEnhancementsBody(ctx) {
|
|
1038
|
+
const themeController = {
|
|
1039
|
+
getSnapshot: () => ctx.theme.getTheme(),
|
|
1040
|
+
subscribe: (listener) => ctx.on("theme/change", () => listener()),
|
|
1041
|
+
setDark: (dark) => ctx.theme.setTheme(dark ? "dark" : "light")
|
|
1042
|
+
};
|
|
1043
|
+
const t = ctx.locale.bind(NS$1);
|
|
1044
|
+
const labels = {
|
|
1045
|
+
closeOverlay: t("mobile.closeOverlay"),
|
|
1046
|
+
openNavigation: t("mobile.openNavigation")
|
|
1047
|
+
};
|
|
1048
|
+
applyMobileSubagents(ctx);
|
|
1049
|
+
applyMobileSessionInfo(ctx);
|
|
1050
|
+
ctx.effect(() => {
|
|
1051
|
+
document.body.dataset.dshLocalLinkMobile = "";
|
|
1052
|
+
const style = document.createElement("style");
|
|
1053
|
+
style.dataset.plugin = "dsh-local-link-mobile-enhancements";
|
|
1054
|
+
style.textContent = MOBILE_STOCK_LAYOUT_STYLES;
|
|
1055
|
+
document.head.append(style);
|
|
1056
|
+
return () => {
|
|
1057
|
+
delete document.body.dataset.dshLocalLinkMobile;
|
|
1058
|
+
style.remove();
|
|
1059
|
+
};
|
|
1060
|
+
}, "dsh-local-link: stock mobile layout styles");
|
|
1061
|
+
ctx.effect(() => ctx.slots.inject("shell.overlay", () => ctx.slots.register({
|
|
1062
|
+
name: "shell.overlay",
|
|
1063
|
+
id: "dsh-local-link-mobile-controls",
|
|
1064
|
+
order: -100
|
|
1065
|
+
}, () => /* @__PURE__ */ react.default.createElement(StockMobileControls, {
|
|
1066
|
+
layout: ctx.layout,
|
|
1067
|
+
labels,
|
|
1068
|
+
themeController,
|
|
1069
|
+
useDarkLabel: t("mobile.useDarkMode"),
|
|
1070
|
+
useLightLabel: t("mobile.useLightMode")
|
|
1071
|
+
}))), "dsh-local-link: stock mobile controls");
|
|
1072
|
+
ctx.effect(() => installMobileComposerAutofocusGuard(ctx), "dsh-local-link: suppress mobile composer autofocus on session change");
|
|
1073
|
+
ctx.effect(() => {
|
|
1074
|
+
const onClick = (event) => {
|
|
1075
|
+
const target = event.target;
|
|
1076
|
+
if (!(target instanceof Element) || !shouldCloseMobileSidebarForElement(target)) return;
|
|
1077
|
+
if ((document.querySelector("[data-shell-overlay]")?.parentElement)?.hasAttribute("data-sidebar-collapsed") !== false) return;
|
|
1078
|
+
window.setTimeout(() => ctx.layout.toggleSidebar(), 0);
|
|
1079
|
+
};
|
|
1080
|
+
document.addEventListener("click", onClick, true);
|
|
1081
|
+
return () => document.removeEventListener("click", onClick, true);
|
|
1082
|
+
}, "dsh-local-link: close stock mobile sidebar after session selection");
|
|
1083
|
+
ctx.effect(() => ctx.slots.inject("sidebar.settings", () => ctx.slots.register({
|
|
1084
|
+
name: "sidebar.settings",
|
|
1085
|
+
priority: MOBILE_SETTINGS_PRIORITY
|
|
1086
|
+
}, () => null)), "dsh-local-link: hide desktop settings entry on mobile");
|
|
1087
|
+
ctx.effect(() => ctx.slots.inject("sidebar.footer.action", () => ctx.slots.register({
|
|
1088
|
+
name: "sidebar.footer.action",
|
|
1089
|
+
id: "local-link-connect",
|
|
1090
|
+
priority: MOBILE_LOCAL_ACCESS_PRIORITY
|
|
1091
|
+
}, () => null)), "dsh-local-link: hide nested local access action on mobile");
|
|
1092
|
+
}
|
|
1093
|
+
const applyResponsiveMobileEnhancements = Object.assign(applyResponsiveMobileEnhancementsBody, { inject: [
|
|
1094
|
+
"slots",
|
|
1095
|
+
"theme",
|
|
1096
|
+
"locale",
|
|
1097
|
+
"sessions",
|
|
1098
|
+
"sessionLogDownload",
|
|
1099
|
+
"layout"
|
|
1100
|
+
] });
|
|
1101
|
+
//#endregion
|
|
31
1102
|
//#region src/locales/en.json
|
|
32
1103
|
var en_default = {
|
|
33
1104
|
nav: "Local access",
|
|
34
1105
|
"footer.trigger": "Local access",
|
|
1106
|
+
"pair.title": "Connecting to DeepSeek Harness",
|
|
1107
|
+
"pair.connecting": "Connecting this device…",
|
|
1108
|
+
"pair.incomplete": "This connection link is incomplete.",
|
|
1109
|
+
"pair.expired": "This QR code expired or was already used.",
|
|
1110
|
+
"pair.failed": "Could not connect this device.",
|
|
1111
|
+
"pair.unreachable": "Could not reach this computer. Check the local network and try again.",
|
|
1112
|
+
"pair.timeout": "Connection timed out. Generate a new code and try again.",
|
|
1113
|
+
"mobile.closeOverlay": "Close panel",
|
|
1114
|
+
"mobile.openNavigation": "Open navigation",
|
|
1115
|
+
"mobile.navigation": "Workspaces and sessions",
|
|
1116
|
+
"mobile.details": "Session details",
|
|
1117
|
+
"mobile.useDarkMode": "Use dark mode",
|
|
1118
|
+
"mobile.useLightMode": "Use light mode",
|
|
1119
|
+
"mobile.sessionInfo.open": "Open session details",
|
|
1120
|
+
"mobile.sessionInfo.close": "Close session details",
|
|
1121
|
+
"mobile.sessionInfo.title": "Session details",
|
|
1122
|
+
"mobile.sessionInfo.eyebrow": "Current session",
|
|
1123
|
+
"mobile.sessionInfo.agentPreset": "Agent preset",
|
|
1124
|
+
"mobile.sessionInfo.context": "Context",
|
|
1125
|
+
"mobile.sessionInfo.context.system": "System prompt",
|
|
1126
|
+
"mobile.sessionInfo.context.tools": "Tools",
|
|
1127
|
+
"mobile.sessionInfo.context.messages": "Messages",
|
|
1128
|
+
"mobile.sessionInfo.model": "Model used",
|
|
1129
|
+
"mobile.sessionInfo.permissions": "Workspace access",
|
|
1130
|
+
"mobile.sessionInfo.statistics": "Session statistics",
|
|
1131
|
+
"mobile.sessionInfo.stats.counts": "{turns} turns · {steps} steps",
|
|
1132
|
+
"mobile.sessionInfo.stats.llm": "LLM {duration}",
|
|
1133
|
+
"mobile.sessionInfo.stats.tools": "Tools {duration}",
|
|
1134
|
+
"mobile.sessionInfo.stats.ttft": "TTFT avg {duration}",
|
|
1135
|
+
"mobile.sessionInfo.stats.throughput": "{throughput} tok/s",
|
|
1136
|
+
"mobile.sessionInfo.stats.cache": "Cache hit {percent}%",
|
|
1137
|
+
"mobile.sessionInfo.stats.tokens": "{input} in · {output} out",
|
|
1138
|
+
"mobile.sessionInfo.sessionLog": "Session log",
|
|
1139
|
+
"mobile.sessionInfo.sessionLogDescription": "Download this session, its sub-sessions, and attachments.",
|
|
1140
|
+
"mobile.sessionInfo.sessionLogDownload": "Download log",
|
|
1141
|
+
"mobile.sessionInfo.sessionLogDownloading": "Preparing…",
|
|
1142
|
+
"mobile.sessionInfo.sessionLogReady": "Download started.",
|
|
1143
|
+
"mobile.sessionInfo.sessionLogError": "Could not export this session.",
|
|
1144
|
+
"mobile.sessionInfo.notRecorded": "Not recorded",
|
|
1145
|
+
"mobile.sessionInfo.preset.standard": "Standard mode",
|
|
1146
|
+
"mobile.sessionInfo.preset.code": "PTC mode",
|
|
1147
|
+
"mobile.sessionInfo.preset.minimal": "Minimal mode",
|
|
1148
|
+
"mobile.sessionInfo.preset.cordis": "Creator mode",
|
|
1149
|
+
"mobile.subagents.title": "Subagents",
|
|
1150
|
+
"mobile.subagents.description": "Open a child agent's conversation.",
|
|
1151
|
+
"mobile.subagents.total": "{count} agents",
|
|
1152
|
+
"mobile.subagents.running": "{count} active",
|
|
1153
|
+
"mobile.subagents.loading": "Loading subagents…",
|
|
1154
|
+
"mobile.subagents.error": "Could not load subagents.",
|
|
1155
|
+
"mobile.subagents.retry": "Retry",
|
|
1156
|
+
"mobile.subagents.empty": "No subagents yet.",
|
|
1157
|
+
"mobile.subagents.unavailable": "Unavailable subagent",
|
|
1158
|
+
"mobile.subagents.continuable": "Continuable",
|
|
1159
|
+
"mobile.subagents.oneShot": "One-shot",
|
|
1160
|
+
"mobile.subagents.active": "Active",
|
|
1161
|
+
"mobile.subagents.inactive": "Inactive",
|
|
1162
|
+
"mobile.subagents.expand": "Expand subagents",
|
|
1163
|
+
"mobile.subagents.collapse": "Collapse subagents",
|
|
1164
|
+
"mobile.subagents.close": "Close subagents",
|
|
1165
|
+
"mobile.subagents.backToParent": "Back to parent session",
|
|
35
1166
|
"connect.title": "Open on another device",
|
|
36
1167
|
"connect.pairedDevices": "Paired devices",
|
|
37
1168
|
"connect.description": "Scan the QR code or copy the one-time link. The device must be on the same local network.",
|
|
@@ -79,6 +1210,66 @@ window.__ModuleLoader__.load({
|
|
|
79
1210
|
var zh_default = {
|
|
80
1211
|
nav: "本地访问",
|
|
81
1212
|
"footer.trigger": "本地访问",
|
|
1213
|
+
"pair.title": "正在连接 DeepSeek Harness",
|
|
1214
|
+
"pair.connecting": "正在连接此设备…",
|
|
1215
|
+
"pair.incomplete": "此连接链接不完整。",
|
|
1216
|
+
"pair.expired": "此二维码已过期或已被使用。",
|
|
1217
|
+
"pair.failed": "无法连接此设备。",
|
|
1218
|
+
"pair.unreachable": "无法访问此计算机。请检查本地网络后重试。",
|
|
1219
|
+
"pair.timeout": "连接超时。请生成新二维码后重试。",
|
|
1220
|
+
"mobile.closeOverlay": "关闭面板",
|
|
1221
|
+
"mobile.openNavigation": "打开导航",
|
|
1222
|
+
"mobile.navigation": "工作区与会话",
|
|
1223
|
+
"mobile.details": "会话详情",
|
|
1224
|
+
"mobile.useDarkMode": "切换到深色模式",
|
|
1225
|
+
"mobile.useLightMode": "切换到浅色模式",
|
|
1226
|
+
"mobile.sessionInfo.open": "打开会话详情",
|
|
1227
|
+
"mobile.sessionInfo.close": "关闭会话详情",
|
|
1228
|
+
"mobile.sessionInfo.title": "会话详情",
|
|
1229
|
+
"mobile.sessionInfo.eyebrow": "当前会话",
|
|
1230
|
+
"mobile.sessionInfo.agentPreset": "Agent 预设",
|
|
1231
|
+
"mobile.sessionInfo.context": "上下文",
|
|
1232
|
+
"mobile.sessionInfo.context.system": "系统提示词",
|
|
1233
|
+
"mobile.sessionInfo.context.tools": "工具",
|
|
1234
|
+
"mobile.sessionInfo.context.messages": "对话消息",
|
|
1235
|
+
"mobile.sessionInfo.model": "已用模型",
|
|
1236
|
+
"mobile.sessionInfo.permissions": "工作区权限",
|
|
1237
|
+
"mobile.sessionInfo.statistics": "会话统计",
|
|
1238
|
+
"mobile.sessionInfo.stats.counts": "{turns} 轮 · {steps} 步",
|
|
1239
|
+
"mobile.sessionInfo.stats.llm": "LLM {duration}",
|
|
1240
|
+
"mobile.sessionInfo.stats.tools": "工具 {duration}",
|
|
1241
|
+
"mobile.sessionInfo.stats.ttft": "平均 TTFT {duration}",
|
|
1242
|
+
"mobile.sessionInfo.stats.throughput": "{throughput} token/秒",
|
|
1243
|
+
"mobile.sessionInfo.stats.cache": "缓存命中 {percent}%",
|
|
1244
|
+
"mobile.sessionInfo.stats.tokens": "输入 {input} · 输出 {output}",
|
|
1245
|
+
"mobile.sessionInfo.sessionLog": "会话日志",
|
|
1246
|
+
"mobile.sessionInfo.sessionLogDescription": "下载此会话、子会话和附件。",
|
|
1247
|
+
"mobile.sessionInfo.sessionLogDownload": "下载日志",
|
|
1248
|
+
"mobile.sessionInfo.sessionLogDownloading": "正在准备…",
|
|
1249
|
+
"mobile.sessionInfo.sessionLogReady": "下载已开始。",
|
|
1250
|
+
"mobile.sessionInfo.sessionLogError": "无法导出此会话。",
|
|
1251
|
+
"mobile.sessionInfo.notRecorded": "未记录",
|
|
1252
|
+
"mobile.sessionInfo.preset.standard": "标准模式",
|
|
1253
|
+
"mobile.sessionInfo.preset.code": "PTC 模式",
|
|
1254
|
+
"mobile.sessionInfo.preset.minimal": "极简模式",
|
|
1255
|
+
"mobile.sessionInfo.preset.cordis": "创造模式",
|
|
1256
|
+
"mobile.subagents.title": "子代理",
|
|
1257
|
+
"mobile.subagents.description": "打开子代理的对话。",
|
|
1258
|
+
"mobile.subagents.total": "{count} 个代理",
|
|
1259
|
+
"mobile.subagents.running": "{count} 个运行中",
|
|
1260
|
+
"mobile.subagents.loading": "正在加载子代理…",
|
|
1261
|
+
"mobile.subagents.error": "无法加载子代理。",
|
|
1262
|
+
"mobile.subagents.retry": "重试",
|
|
1263
|
+
"mobile.subagents.empty": "暂无子代理。",
|
|
1264
|
+
"mobile.subagents.unavailable": "子代理不可用",
|
|
1265
|
+
"mobile.subagents.continuable": "可继续",
|
|
1266
|
+
"mobile.subagents.oneShot": "一次性",
|
|
1267
|
+
"mobile.subagents.active": "运行中",
|
|
1268
|
+
"mobile.subagents.inactive": "未运行",
|
|
1269
|
+
"mobile.subagents.expand": "展开子代理",
|
|
1270
|
+
"mobile.subagents.collapse": "收起子代理",
|
|
1271
|
+
"mobile.subagents.close": "关闭子代理",
|
|
1272
|
+
"mobile.subagents.backToParent": "返回父会话",
|
|
82
1273
|
"connect.title": "在其他设备上打开",
|
|
83
1274
|
"connect.pairedDevices": "已配对设备",
|
|
84
1275
|
"connect.description": "扫描二维码或复制一次性链接。设备必须连接到同一个本地网络。",
|
|
@@ -212,13 +1403,23 @@ window.__ModuleLoader__.load({
|
|
|
212
1403
|
}).catch(() => void 0);
|
|
213
1404
|
}
|
|
214
1405
|
const styles = `
|
|
1406
|
+
:root{--dsh-local-link-border-width:.5px}
|
|
215
1407
|
.dsh-local-link{box-sizing:border-box;width:100%;max-width:760px;padding:4px 4px 32px;color:var(--dsw-alias-label-primary,#16181d)}
|
|
216
1408
|
.dsh-local-link h2{margin:0 0 5px;font-size:20px}.dsh-local-link>p{margin:0;color:var(--dsw-alias-label-secondary,#66707c);line-height:1.5}
|
|
217
|
-
.dsh-local-
|
|
218
|
-
.dsh-local-
|
|
219
|
-
.dsh-local-link__diagnostics
|
|
220
|
-
.dsh-local-
|
|
221
|
-
.dsh-local-link-
|
|
1409
|
+
.dsh-local-link__devices{display:grid;margin-top:12px;border-block:var(--dsh-local-link-border-width) solid var(--dsw-alias-border-l2,var(--dsw-alias-border-subtle,#dce1e8))}.dsh-local-link__devices>p{margin:0;padding:12px 0;color:var(--dsw-alias-label-secondary,#66707c);line-height:1.45}.dsh-local-link__device{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px;padding:8px 0;border-top:var(--dsh-local-link-border-width) solid var(--dsw-alias-border-l2,var(--dsw-alias-border-subtle,#dce1e8))}.dsh-local-link__device:first-child{border-top:0}.dsh-local-link__device-info{display:grid;min-width:0;gap:2px}.dsh-local-link__device-info strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:600 14px/1.25 system-ui}.dsh-local-link__device-info small{overflow:hidden;color:var(--dsw-alias-label-secondary,#66707c);font:12px/1.3 system-ui;text-overflow:ellipsis;white-space:nowrap}.dsh-local-link__device-actions{display:flex;gap:6px}.dsh-local-link__device-editor{display:grid;grid-column:1/-1;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:6px}.dsh-local-link__device-name-input{min-width:0;width:100%}@media(max-width:440px){.dsh-local-link__device{grid-template-columns:minmax(0,1fr) auto;gap:8px}.dsh-local-link__device-actions{gap:4px}.dsh-local-link__device-editor{grid-template-columns:1fr auto}.dsh-local-link__device-name-input{grid-column:1/-1}}
|
|
1410
|
+
.dsh-local-link__diagnostics{margin-top:30px;overflow:hidden;border:1px solid var(--dsw-alias-border-l2,#45484d);border-radius:12px;background:var(--dsw-alias-bg-layer-3,#303236);transition:border-color .16s,background .16s}.dsh-local-link__diagnostics:hover{border-color:var(--dsw-alias-label-dimmed,#74777d)}.dsh-local-link__diagnostics[open]{border-color:var(--dsw-alias-border-l2,#45484d);background:var(--dsw-alias-bg-layer-2,#282a2e)}.dsh-local-link__diagnostics summary{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:14px 16px;box-sizing:border-box;cursor:pointer;list-style:none}.dsh-local-link__diagnostics summary::-webkit-details-marker{display:none}.dsh-local-link__diagnostics summary:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#2878ff);outline-offset:-2px}.dsh-local-link__diagnostics-summary-main,.dsh-local-link__diagnostics-summary-meta{display:flex;align-items:center;min-width:0}.dsh-local-link__diagnostics-summary-main{flex:1;gap:11px}.dsh-local-link__diagnostics-summary-meta{flex:none;gap:12px}.dsh-local-link__diagnostics-icon{display:grid;place-items:center;flex:none;width:34px;height:34px;border-radius:9px;background:color-mix(in srgb,var(--dsw-alias-brand-primary,#2878ff) 14%,transparent);color:var(--dsw-alias-brand-primary,#2878ff)}.dsh-local-link__diagnostics-copy{display:flex;flex:1;flex-direction:column;min-width:0;gap:4px}.dsh-local-link__diagnostics-copy strong{color:var(--dsw-alias-label-primary,#f2f3f5);font:600 15px/1.4 system-ui}.dsh-local-link__diagnostics-copy small{overflow:hidden;color:var(--dsw-alias-label-tertiary,#a6a8ad);font:13px/1.5 system-ui;text-overflow:ellipsis;white-space:nowrap}.dsh-local-link__diagnostics-badge{padding:0;color:var(--dsw-alias-label-tertiary,#a6a8ad);font:400 12px/1.3 system-ui;white-space:nowrap}.dsh-local-link__diagnostics-chevron{flex:none;color:var(--dsw-alias-label-tertiary,#a6a8ad);transition:transform .16s}.dsh-local-link__diagnostics[open] .dsh-local-link__diagnostics-chevron{transform:rotate(180deg)}.dsh-local-link__diagnostics-body{margin:0 16px;padding:12px 0 8px;border-top:1px solid var(--dsw-alias-border-l2,#45484d)}.dsh-local-link__diagnostics-body>p{margin:0 0 12px;color:var(--dsw-alias-label-tertiary,#a6a8ad);font:12px/1.5 system-ui}.dsh-local-link__diagnostics-actions{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:12px}.dsh-local-link__diagnostic-list{display:grid;overflow:hidden;border:1px solid var(--dsw-alias-border-l2,#45484d);border-radius:9px;background:var(--dsw-alias-bg-layer-3,#303236)}.dsh-local-link__diagnostic{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:baseline;gap:8px;padding:8px 10px;border-top:1px solid var(--dsw-alias-border-l2,#45484d);font:12px/1.35 system-ui}.dsh-local-link__diagnostic:first-child{border-top:0}.dsh-local-link__diagnostic-level{width:7px;height:7px;border-radius:50%;background:#6b7280}.dsh-local-link__diagnostic-level--warn{background:#d28b15}.dsh-local-link__diagnostic-level--error{background:#dc4c4c}.dsh-local-link__diagnostic code{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:600 11px/1.3 ui-monospace,SFMono-Regular,Consolas,monospace}.dsh-local-link__diagnostic time{color:var(--dsw-alias-label-tertiary,#a6a8ad);font-size:11px;white-space:nowrap}.dsh-local-link__diagnostic-context{grid-column:2/-1;overflow:hidden;color:var(--dsw-alias-label-tertiary,#a6a8ad);font:11px/1.35 ui-monospace,SFMono-Regular,Consolas,monospace;text-overflow:ellipsis;white-space:nowrap}@media(max-width:540px){.dsh-local-link__diagnostics-copy small{display:none}.dsh-local-link__diagnostics summary{padding-inline:12px}.dsh-local-link__diagnostics-badge{max-width:92px;overflow:hidden;text-overflow:ellipsis}}
|
|
1411
|
+
.dsh-local-link__diagnostics,.dsh-local-link__diagnostic-list{border-width:var(--dsh-local-link-border-width)}.dsh-local-link__diagnostics-body,.dsh-local-link__diagnostic{border-top-width:var(--dsh-local-link-border-width)}
|
|
1412
|
+
.dsh-local-link__diagnostics:hover{border-color:var(--dsw-alias-border-l2,#45484d);background:var(--dsw-alias-bg-layer-2,#282a2e)}
|
|
1413
|
+
.dsh-local-link-footer{position:relative;width:100%;min-width:0}:where(div):has(> .dsh-local-link-footer),:where(div):has(> :where(div) > .dsh-local-link-footer){flex-direction:column;gap:4px}:where(div):has(> .dsh-local-link-footer)>.dsh-local-link-footer+:where(div){margin-block-start:0!important}.dsh-local-link-trigger{box-sizing:border-box;display:flex;align-items:center;justify-content:flex-start;gap:8px;width:calc(100% + 4px);height:42px;margin:0 -2px;padding:0 10px 0 8px;border:0;border-radius:12px;background:transparent;color:var(--dsw-alias-label-primary,#16181d);font:400 14px/22px inherit;cursor:pointer;overflow:hidden}.dsh-local-link-trigger:hover{background:var(--dsw-alias-interactive-bg-hover,#e8ebef)}.dsh-local-link-trigger--rail{justify-content:center;gap:0;width:36px;height:36px;margin:0;padding:0;border-radius:50%}.dsh-local-link-trigger__label{white-space:nowrap;overflow:hidden}
|
|
1414
|
+
.dsh-local-link-popover{position:fixed;z-index:10000;box-sizing:border-box;width:min(360px,calc(100vw - 24px));height:auto;max-height:calc(100vh - 24px);padding:16px;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;border:var(--dsh-local-link-border-width) solid var(--dsw-alias-border-l2,var(--dsw-alias-border-subtle,#dce1e8));border-radius:14px;background:var(--dsw-alias-bg-layer-1,#fff);color:var(--dsw-alias-label-primary,#16181d);box-shadow:0 18px 55px #0004}.dsh-local-link-popover__header{display:flex;align-items:center;justify-content:space-between;gap:12px}.dsh-local-link-popover strong{font-size:15px}.dsh-local-link-popover__manage{flex:none;color:var(--dsw-alias-label-secondary,#66707c)}.dsh-local-link-popover p{margin:8px 0;color:var(--dsw-alias-label-secondary,#66707c);font:13px/1.45 system-ui}.dsh-local-link-popover__content{min-height:336px}.dsh-local-link-popover__qr,.dsh-local-link-popover__qr-placeholder{box-sizing:content-box;display:block;width:200px;height:200px;margin:12px auto 0;padding:7px;border-radius:12px}.dsh-local-link-popover__qr{background:#fff;transition:opacity .2s,filter .2s}.dsh-local-link-popover__qr-placeholder{background:var(--dsw-alias-bg-layer-2,#eef1f5)}.dsh-local-link-popover__loading{text-align:center}.dsh-local-link-popover__qr--expired{opacity:.3;filter:grayscale(1)}.dsh-local-link-popover__link{display:flex;align-items:stretch;min-width:0;height:40px;margin-top:12px;border:var(--dsh-local-link-border-width) solid var(--dsw-alias-border-l2,var(--dsw-alias-border-normal,#cbd2dc));border-radius:10px;overflow:hidden;background:var(--dsw-alias-bg-layer-2,#eef1f5)}.dsh-local-link-popover__link-value{position:relative;display:flex;align-items:center;flex:1;min-width:0;padding:0 8px 0 10px;overflow:hidden;white-space:nowrap;font:11px/1.4 ui-monospace,SFMono-Regular,Consolas,monospace;mask-image:linear-gradient(to right,#000 76%,transparent 98%);-webkit-mask-image:linear-gradient(to right,#000 76%,transparent 98%)}.dsh-local-link-popover__copy{min-width:76px;padding:0 11px;border:0;border-left:var(--dsh-local-link-border-width) solid var(--dsw-alias-border-l2,var(--dsw-alias-border-normal,#cbd2dc));border-radius:0;transition:background .18s,color .18s}.dsh-local-link-popover__copy--copied{background:#16803a22;color:#39a85b}.dsh-local-link-popover__meta{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:9px;color:var(--dsw-alias-label-secondary,#66707c);font:11px/1.35 system-ui}.dsh-local-link-popover__regenerate{display:flex;width:100%;margin-top:10px}.dsh-local-link-popover__error{color:#c53030!important}
|
|
1415
|
+
.dsh-local-link__diagnostic-level{background:var(--dsw-alias-label-tertiary,#6b7280)}
|
|
1416
|
+
.dsh-local-link__diagnostic-level--warn{background:var(--dsw-alias-state-warn-primary,#d28b15)}
|
|
1417
|
+
.dsh-local-link__diagnostic-level--error{background:var(--dsw-alias-state-error-primary,#dc4c4c)}
|
|
1418
|
+
.dsh-local-link-popover{box-shadow:var(--dsw-shadow-lv3,0 18px 55px #0004)}
|
|
1419
|
+
.dsh-local-link-popover__content{min-height:350px}
|
|
1420
|
+
.dsh-local-link-popover__qr{background:var(--dsw-static-neutral-00,#fff)}
|
|
1421
|
+
.dsh-local-link-popover__copy--copied{background:var(--dsw-alias-state-success-tertiary,#16803a22);color:var(--dsw-alias-state-success-primary,#39a85b)}
|
|
1422
|
+
.dsh-local-link-popover__error{color:var(--dsw-alias-state-error-primary,#c53030)!important}
|
|
222
1423
|
`;
|
|
223
1424
|
function LocalLinkFooter({ wide, t, getCurrentSessionId }) {
|
|
224
1425
|
const desktop = desktopOrigin();
|
|
@@ -329,9 +1530,10 @@ window.__ModuleLoader__.load({
|
|
|
329
1530
|
return /* @__PURE__ */ react.default.createElement("div", {
|
|
330
1531
|
className: "dsh-local-link-footer",
|
|
331
1532
|
ref: root
|
|
332
|
-
}, /* @__PURE__ */ react.default.createElement(
|
|
1533
|
+
}, /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
333
1534
|
className: `dsh-local-link-trigger${wide ? "" : " dsh-local-link-trigger--rail"}`,
|
|
334
|
-
|
|
1535
|
+
size: "md",
|
|
1536
|
+
variant: "ghost",
|
|
335
1537
|
title: t("footer.trigger"),
|
|
336
1538
|
"aria-label": t("footer.trigger"),
|
|
337
1539
|
"aria-expanded": open,
|
|
@@ -359,14 +1561,22 @@ window.__ModuleLoader__.load({
|
|
|
359
1561
|
ref: popover,
|
|
360
1562
|
style: popoverPosition ?? { visibility: "hidden" },
|
|
361
1563
|
"aria-label": t("connect.title")
|
|
362
|
-
}, /* @__PURE__ */ react.default.createElement("div", { className: "dsh-local-link-popover__header" }, /* @__PURE__ */ react.default.createElement("strong", null, t("connect.title")), /* @__PURE__ */ react.default.createElement(
|
|
1564
|
+
}, /* @__PURE__ */ react.default.createElement("div", { className: "dsh-local-link-popover__header" }, /* @__PURE__ */ react.default.createElement("strong", null, t("connect.title")), /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
363
1565
|
className: "dsh-local-link-popover__manage",
|
|
364
|
-
|
|
1566
|
+
size: "sm",
|
|
1567
|
+
variant: "ghost",
|
|
365
1568
|
onClick: () => {
|
|
366
1569
|
setOpen(false);
|
|
367
1570
|
openSettingsSection(t("nav"));
|
|
368
1571
|
}
|
|
369
|
-
}, t("connect.pairedDevices"))), /* @__PURE__ */ react.default.createElement("p", null, t("connect.description")),
|
|
1572
|
+
}, t("connect.pairedDevices"))), /* @__PURE__ */ react.default.createElement("p", null, t("connect.description")), /* @__PURE__ */ react.default.createElement("div", {
|
|
1573
|
+
className: "dsh-local-link-popover__content",
|
|
1574
|
+
"aria-busy": pairing === void 0 && !error,
|
|
1575
|
+
"aria-live": "polite"
|
|
1576
|
+
}, !pairing && !error && /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("div", {
|
|
1577
|
+
"aria-hidden": "true",
|
|
1578
|
+
className: "dsh-local-link-popover__qr-placeholder"
|
|
1579
|
+
}), /* @__PURE__ */ react.default.createElement("p", { className: "dsh-local-link-popover__loading" }, t("connect.creating"))), error && /* @__PURE__ */ react.default.createElement("p", { className: "dsh-local-link-popover__error" }, t("connect.error")), pairing && /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("img", {
|
|
370
1580
|
className: `dsh-local-link-popover__qr${remaining === 0 ? " dsh-local-link-popover__qr--expired" : ""}`,
|
|
371
1581
|
src: pairing.qrDataUrl,
|
|
372
1582
|
alt: t("connect.qrAlt")
|
|
@@ -376,16 +1586,18 @@ window.__ModuleLoader__.load({
|
|
|
376
1586
|
}, /* @__PURE__ */ react.default.createElement("code", {
|
|
377
1587
|
className: "dsh-local-link-popover__link-value",
|
|
378
1588
|
title: pairing.url
|
|
379
|
-
}, pairing.url), /* @__PURE__ */ react.default.createElement(
|
|
1589
|
+
}, pairing.url), /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
380
1590
|
className: `dsh-local-link-popover__copy${copyState === "copied" ? " dsh-local-link-popover__copy--copied" : ""}`,
|
|
381
1591
|
disabled: remaining === 0,
|
|
382
|
-
|
|
1592
|
+
size: "md",
|
|
1593
|
+
variant: "ghost",
|
|
383
1594
|
onClick: () => void copyLink()
|
|
384
|
-
}, copyState === "copied" ? t("connect.copied") : t("connect.copy"))), copyState === "error" && /* @__PURE__ */ react.default.createElement("p", { className: "dsh-local-link-popover__error" }, t("connect.copyError")), /* @__PURE__ */ react.default.createElement("div", { className: "dsh-local-link-popover__meta" }, /* @__PURE__ */ react.default.createElement("span", null, t("connect.oneDevice")), /* @__PURE__ */ react.default.createElement("span", null, remaining === 0 ? t("connect.expired") : `${t("connect.expiresIn")} ${formatCountdown(remaining)}`)), /* @__PURE__ */ react.default.createElement(
|
|
1595
|
+
}, copyState === "copied" ? t("connect.copied") : t("connect.copy"))), copyState === "error" && /* @__PURE__ */ react.default.createElement("p", { className: "dsh-local-link-popover__error" }, t("connect.copyError")), /* @__PURE__ */ react.default.createElement("div", { className: "dsh-local-link-popover__meta" }, /* @__PURE__ */ react.default.createElement("span", null, t("connect.oneDevice")), /* @__PURE__ */ react.default.createElement("span", null, remaining === 0 ? t("connect.expired") : `${t("connect.expiresIn")} ${formatCountdown(remaining)}`)), /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
385
1596
|
className: "dsh-local-link-popover__regenerate",
|
|
386
|
-
|
|
1597
|
+
size: "md",
|
|
1598
|
+
variant: "outline",
|
|
387
1599
|
onClick: () => void createLink()
|
|
388
|
-
}, t("connect.regenerate")))));
|
|
1600
|
+
}, t("connect.regenerate"))))));
|
|
389
1601
|
}
|
|
390
1602
|
function LocalLinkSettings({ t }) {
|
|
391
1603
|
const [status, setStatus] = (0, react.useState)();
|
|
@@ -489,9 +1701,10 @@ window.__ModuleLoader__.load({
|
|
|
489
1701
|
className: "dsh-local-link__device",
|
|
490
1702
|
key: device.id,
|
|
491
1703
|
role: "listitem"
|
|
492
|
-
}, editingId === device.id ? /* @__PURE__ */ react.default.createElement("div", { className: "dsh-local-link__device-editor" }, /* @__PURE__ */ react.default.createElement(
|
|
1704
|
+
}, editingId === device.id ? /* @__PURE__ */ react.default.createElement("div", { className: "dsh-local-link__device-editor" }, /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
493
1705
|
autoFocus: true,
|
|
494
1706
|
"aria-label": t("devices.nameLabel"),
|
|
1707
|
+
className: "dsh-local-link__device-name-input",
|
|
495
1708
|
maxLength: 64,
|
|
496
1709
|
value: draftName,
|
|
497
1710
|
onChange: (event) => setDraftName(event.target.value),
|
|
@@ -499,24 +1712,28 @@ window.__ModuleLoader__.load({
|
|
|
499
1712
|
if (event.key === "Enter") rename(device.id);
|
|
500
1713
|
if (event.key === "Escape") setEditingId(void 0);
|
|
501
1714
|
}
|
|
502
|
-
}), /* @__PURE__ */ react.default.createElement(
|
|
1715
|
+
}), /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
503
1716
|
disabled: busyId !== void 0,
|
|
504
|
-
|
|
1717
|
+
size: "sm",
|
|
1718
|
+
variant: "primary",
|
|
505
1719
|
onClick: () => void rename(device.id)
|
|
506
|
-
}, busyId === device.id ? t("devices.saving") : t("devices.save")), /* @__PURE__ */ react.default.createElement(
|
|
1720
|
+
}, busyId === device.id ? t("devices.saving") : t("devices.save")), /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
507
1721
|
disabled: busyId !== void 0,
|
|
508
|
-
|
|
1722
|
+
size: "sm",
|
|
1723
|
+
variant: "ghost",
|
|
509
1724
|
onClick: () => setEditingId(void 0)
|
|
510
|
-
}, t("devices.cancel"))) : /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("div", { className: "dsh-local-link__device-info" }, /* @__PURE__ */ react.default.createElement("strong", null, device.name), /* @__PURE__ */ react.default.createElement("small", null, device.deviceType, " · ", device.browser)), /* @__PURE__ */ react.default.createElement("div", { className: "dsh-local-link__device-actions" }, /* @__PURE__ */ react.default.createElement(
|
|
1725
|
+
}, t("devices.cancel"))) : /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("div", { className: "dsh-local-link__device-info" }, /* @__PURE__ */ react.default.createElement("strong", null, device.name), /* @__PURE__ */ react.default.createElement("small", null, device.deviceType, " · ", device.browser)), /* @__PURE__ */ react.default.createElement("div", { className: "dsh-local-link__device-actions" }, /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
511
1726
|
disabled: busyId !== void 0,
|
|
512
|
-
|
|
1727
|
+
size: "sm",
|
|
1728
|
+
variant: "outline",
|
|
513
1729
|
onClick: () => {
|
|
514
1730
|
setEditingId(device.id);
|
|
515
1731
|
setDraftName(device.name);
|
|
516
1732
|
}
|
|
517
|
-
}, t("devices.rename")), /* @__PURE__ */ react.default.createElement(
|
|
1733
|
+
}, t("devices.rename")), /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
518
1734
|
disabled: busyId !== void 0,
|
|
519
|
-
|
|
1735
|
+
size: "sm",
|
|
1736
|
+
variant: "outline",
|
|
520
1737
|
onClick: () => void revoke(device.id)
|
|
521
1738
|
}, busyId === device.id ? t("devices.revoking") : t("devices.revoke")))))) : /* @__PURE__ */ react.default.createElement("p", null, t("devices.empty"))), /* @__PURE__ */ react.default.createElement("details", { className: "dsh-local-link__diagnostics" }, /* @__PURE__ */ react.default.createElement("summary", null, /* @__PURE__ */ react.default.createElement("span", { className: "dsh-local-link__diagnostics-summary-main" }, /* @__PURE__ */ react.default.createElement("span", {
|
|
522
1739
|
className: "dsh-local-link__diagnostics-icon",
|
|
@@ -530,28 +1747,23 @@ window.__ModuleLoader__.load({
|
|
|
530
1747
|
strokeWidth: "1.8",
|
|
531
1748
|
strokeLinecap: "round",
|
|
532
1749
|
strokeLinejoin: "round"
|
|
533
|
-
}, /* @__PURE__ */ react.default.createElement("path", { d: "M3 12h4l2.2-6 4.2 12 2.1-6H21" }))), /* @__PURE__ */ react.default.createElement("span", { className: "dsh-local-link__diagnostics-copy" }, /* @__PURE__ */ react.default.createElement("strong", null, t("diagnostics.title")), /* @__PURE__ */ react.default.createElement("small", null, t("diagnostics.subtitle")))), /* @__PURE__ */ react.default.createElement("span", { className: "dsh-local-link__diagnostics-summary-meta" }, /* @__PURE__ */ react.default.createElement("span", { className: "dsh-local-link__diagnostics-badge" }, diagnosticsError ? t("diagnostics.unavailable") : diagnostics === void 0 ? t("diagnostics.loading") : `${diagnostics.length} ${t("diagnostics.events")}`), /* @__PURE__ */ react.default.createElement(
|
|
1750
|
+
}, /* @__PURE__ */ react.default.createElement("path", { d: "M3 12h4l2.2-6 4.2 12 2.1-6H21" }))), /* @__PURE__ */ react.default.createElement("span", { className: "dsh-local-link__diagnostics-copy" }, /* @__PURE__ */ react.default.createElement("strong", null, t("diagnostics.title")), /* @__PURE__ */ react.default.createElement("small", null, t("diagnostics.subtitle")))), /* @__PURE__ */ react.default.createElement("span", { className: "dsh-local-link__diagnostics-summary-meta" }, /* @__PURE__ */ react.default.createElement("span", { className: "dsh-local-link__diagnostics-badge" }, diagnosticsError ? t("diagnostics.unavailable") : diagnostics === void 0 ? t("diagnostics.loading") : `${diagnostics.length} ${t("diagnostics.events")}`), /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, {
|
|
534
1751
|
className: "dsh-local-link__diagnostics-chevron",
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
height: "16",
|
|
538
|
-
viewBox: "0 0 24 24",
|
|
539
|
-
fill: "none",
|
|
540
|
-
stroke: "currentColor",
|
|
541
|
-
strokeWidth: "2",
|
|
542
|
-
strokeLinecap: "round",
|
|
543
|
-
strokeLinejoin: "round"
|
|
544
|
-
}, /* @__PURE__ */ react.default.createElement("path", { d: "m6 9 6 6 6-6" })))), /* @__PURE__ */ react.default.createElement("div", { className: "dsh-local-link__diagnostics-body" }, /* @__PURE__ */ react.default.createElement("p", null, t("diagnostics.description")), /* @__PURE__ */ react.default.createElement("div", { className: "dsh-local-link__diagnostics-actions" }, /* @__PURE__ */ react.default.createElement("button", {
|
|
1752
|
+
size: 14
|
|
1753
|
+
}))), /* @__PURE__ */ react.default.createElement("div", { className: "dsh-local-link__diagnostics-body" }, /* @__PURE__ */ react.default.createElement("p", null, t("diagnostics.description")), /* @__PURE__ */ react.default.createElement("div", { className: "dsh-local-link__diagnostics-actions" }, /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
545
1754
|
disabled: diagnosticsBusy,
|
|
546
|
-
|
|
1755
|
+
size: "sm",
|
|
1756
|
+
variant: "outline",
|
|
547
1757
|
onClick: () => void loadDiagnostics()
|
|
548
|
-
}, t("diagnostics.refresh")), /* @__PURE__ */ react.default.createElement(
|
|
1758
|
+
}, t("diagnostics.refresh")), /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
549
1759
|
disabled: diagnosticsBusy || diagnostics === void 0,
|
|
550
|
-
|
|
1760
|
+
size: "sm",
|
|
1761
|
+
variant: "outline",
|
|
551
1762
|
onClick: () => void copyDiagnostics()
|
|
552
|
-
}, reportState === "copied" ? t("diagnostics.copied") : t("diagnostics.copy")), /* @__PURE__ */ react.default.createElement(
|
|
1763
|
+
}, reportState === "copied" ? t("diagnostics.copied") : t("diagnostics.copy")), /* @__PURE__ */ react.default.createElement(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
553
1764
|
disabled: diagnosticsBusy || diagnostics === void 0 || diagnostics.length === 0,
|
|
554
|
-
|
|
1765
|
+
size: "sm",
|
|
1766
|
+
variant: "outline",
|
|
555
1767
|
onClick: () => void clearDiagnostics()
|
|
556
1768
|
}, diagnosticsBusy ? t("diagnostics.clearing") : t("diagnostics.clear"))), reportState === "error" && /* @__PURE__ */ react.default.createElement("p", null, t("diagnostics.copyError")), diagnosticsError ? /* @__PURE__ */ react.default.createElement("p", null, t("diagnostics.error")) : diagnostics === void 0 ? /* @__PURE__ */ react.default.createElement("p", null, t("diagnostics.loading")) : diagnostics.length === 0 ? /* @__PURE__ */ react.default.createElement("p", null, t("diagnostics.empty")) : /* @__PURE__ */ react.default.createElement("div", {
|
|
557
1769
|
className: "dsh-local-link__diagnostic-list",
|
|
@@ -568,26 +1780,66 @@ window.__ModuleLoader__.load({
|
|
|
568
1780
|
title: JSON.stringify(event.context)
|
|
569
1781
|
}, Object.entries(event.context).map(([key, value]) => `${key}=${String(value)}`).join(" · "))))))));
|
|
570
1782
|
}
|
|
1783
|
+
const MOBILE_VIEW_MEDIA_QUERY = "(max-width: 834px)";
|
|
1784
|
+
/**
|
|
1785
|
+
* Mount the mobile root in its own Cordis fiber while the viewport is narrow.
|
|
1786
|
+
* Disposing that fiber retracts every mobile slot contribution atomically and
|
|
1787
|
+
* lets Harness' shipped root win again on wider screens.
|
|
1788
|
+
*/
|
|
1789
|
+
function installResponsiveMobileLayout(media, mount) {
|
|
1790
|
+
let fiber;
|
|
1791
|
+
let disposed = false;
|
|
1792
|
+
let reconciling = false;
|
|
1793
|
+
let requested = media.matches;
|
|
1794
|
+
const reconcile = async () => {
|
|
1795
|
+
if (reconciling || disposed) return;
|
|
1796
|
+
reconciling = true;
|
|
1797
|
+
try {
|
|
1798
|
+
while (!disposed) {
|
|
1799
|
+
if (requested && fiber === void 0) {
|
|
1800
|
+
fiber = mount();
|
|
1801
|
+
continue;
|
|
1802
|
+
}
|
|
1803
|
+
if (!requested && fiber !== void 0) {
|
|
1804
|
+
const mounted = fiber;
|
|
1805
|
+
fiber = void 0;
|
|
1806
|
+
await mounted.dispose();
|
|
1807
|
+
continue;
|
|
1808
|
+
}
|
|
1809
|
+
break;
|
|
1810
|
+
}
|
|
1811
|
+
} finally {
|
|
1812
|
+
reconciling = false;
|
|
1813
|
+
}
|
|
1814
|
+
};
|
|
1815
|
+
const onChange = (event) => {
|
|
1816
|
+
requested = event.matches;
|
|
1817
|
+
reconcile();
|
|
1818
|
+
};
|
|
1819
|
+
media.addEventListener("change", onChange);
|
|
1820
|
+
reconcile();
|
|
1821
|
+
return () => {
|
|
1822
|
+
disposed = true;
|
|
1823
|
+
media.removeEventListener("change", onChange);
|
|
1824
|
+
const mounted = fiber;
|
|
1825
|
+
fiber = void 0;
|
|
1826
|
+
if (mounted !== void 0) mounted.dispose();
|
|
1827
|
+
};
|
|
1828
|
+
}
|
|
571
1829
|
const inject = [
|
|
572
|
-
"connection",
|
|
573
1830
|
"slots",
|
|
1831
|
+
"theme",
|
|
574
1832
|
"locale",
|
|
575
|
-
"sessions"
|
|
1833
|
+
"sessions",
|
|
1834
|
+
"sessionLogDownload",
|
|
1835
|
+
"layout"
|
|
576
1836
|
];
|
|
577
1837
|
function apply(ctx) {
|
|
578
1838
|
ctx.effect(() => ctx.locale.register(NS, {
|
|
579
1839
|
en: en_default,
|
|
580
1840
|
zh: zh_default
|
|
581
1841
|
}), "dsh-local-link: locale dictionaries");
|
|
582
|
-
ctx.effect(() =>
|
|
583
|
-
if (window.__DSH_LOCAL_LINK_AUTHENTICATED__ !== true) return () => void 0;
|
|
584
|
-
const connection = ctx.get("connection");
|
|
585
|
-
const previous = connection.isLoopback;
|
|
586
|
-
connection.isLoopback = true;
|
|
587
|
-
return () => {
|
|
588
|
-
connection.isLoopback = previous;
|
|
589
|
-
};
|
|
590
|
-
}, "dsh-local-link: paired gateway trust hint");
|
|
1842
|
+
ctx.effect(() => installResponsiveMobileLayout(window.matchMedia(MOBILE_VIEW_MEDIA_QUERY), () => ctx.plugin(applyResponsiveMobileEnhancements)), "dsh-local-link: responsive mobile root");
|
|
591
1843
|
ctx.effect(() => {
|
|
592
1844
|
const style = document.createElement("style");
|
|
593
1845
|
style.dataset.plugin = "dsh-local-link";
|
|
@@ -620,8 +1872,10 @@ window.__ModuleLoader__.load({
|
|
|
620
1872
|
}, "dsh-local-link: paired devices settings");
|
|
621
1873
|
}
|
|
622
1874
|
//#endregion
|
|
1875
|
+
exports.MOBILE_VIEW_MEDIA_QUERY = MOBILE_VIEW_MEDIA_QUERY;
|
|
623
1876
|
exports.apply = apply;
|
|
624
1877
|
exports.inject = inject;
|
|
1878
|
+
exports.installResponsiveMobileLayout = installResponsiveMobileLayout;
|
|
625
1879
|
return module.exports;
|
|
626
1880
|
}
|
|
627
1881
|
});
|