dsh-claude-project-ui 0.4.3 → 0.5.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 +100 -0
- package/README.md +259 -61
- package/THIRD_PARTY_NOTICES.md +71 -0
- package/docs/about-drafts.md +27 -55
- package/docs/dsh-threads-baseline.md +119 -0
- package/docs/optional-threads-0.4.4.md +139 -0
- package/docs/store-copy-0.4.4.md +86 -0
- package/docs/two-installs-problem.md +256 -0
- package/docs/vendoring-feasibility.md +179 -0
- package/package.json +54 -5
- package/src/client.js +4689 -9
- package/src/config.js +3 -0
- package/src/index.js +276 -3
- package/src/threads-install.js +174 -0
- package/src/threads-probe.js +255 -0
- package/src/threads-vendor.js +123 -0
- package/vendor/dsh-threads/CHANGELOG.md +174 -0
- package/vendor/dsh-threads/LICENSE +21 -0
- package/vendor/dsh-threads/README.en.md +113 -0
- package/vendor/dsh-threads/README.md +113 -0
- package/vendor/dsh-threads/VENDORED.md +66 -0
- package/vendor/dsh-threads/cordis.patch.yml +6 -0
- package/vendor/dsh-threads/dist/client.js +4260 -0
- package/vendor/dsh-threads/dist/index.js +2773 -0
- package/vendor/dsh-threads/icon.svg +1 -0
- package/vendor/dsh-threads/locale/en.json +6 -0
- package/vendor/dsh-threads/locale/zh.json +6 -0
- package/vendor/dsh-threads/package.json +122 -0
package/src/client.js
CHANGED
|
@@ -28,14 +28,4359 @@ window.__ModuleLoader__.load({
|
|
|
28
28
|
ReactDOM = null;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
// ===== BEGIN VENDORED @kyf-eng/dsh-threads client — generated by scripts/sync-client.mjs, do not edit =====
|
|
32
|
+
//
|
|
33
|
+
// verbatim copy of the upstream bundle's factory body: the loader evaluates one
|
|
34
|
+
// script per package, so this is the only way to ship both halves together.
|
|
35
|
+
// Re-run: npm run sync-client (when vendor/dsh-threads/ is updated).
|
|
36
|
+
function loadVendoredThreadsClient(require) {
|
|
37
|
+
var module = { exports: {} };
|
|
38
|
+
var exports = module.exports;
|
|
39
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
40
|
+
let react = require("react");
|
|
41
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
43
|
+
let react_dom = require("react-dom");
|
|
44
|
+
// src/client/api.ts
|
|
45
|
+
/**
|
|
46
|
+
* Host route, relative to the page like DSH's own Connection calls: on Desktop the page is
|
|
47
|
+
* dsh-app://app/ and the shell forwards it to the Host with its cookie; on Web it is same-origin.
|
|
48
|
+
* Must match RPC_PATH in src/rpc.ts.
|
|
49
|
+
*/
|
|
50
|
+
const RPC_URL = "api/dsh-threads";
|
|
51
|
+
let localeOf = () => void 0;
|
|
52
|
+
/** Every host call carries the page's language, so the host's own text follows it (src/messages.ts). */
|
|
53
|
+
function sendLocaleToHost(read) {
|
|
54
|
+
localeOf = read;
|
|
55
|
+
return () => {
|
|
56
|
+
localeOf = () => void 0;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function pageLocale() {
|
|
60
|
+
try {
|
|
61
|
+
return localeOf();
|
|
62
|
+
} catch {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async function callHost(method, payload = {}) {
|
|
67
|
+
const response = await fetch(RPC_URL, {
|
|
68
|
+
method: "POST",
|
|
69
|
+
headers: { "content-type": "application/json" },
|
|
70
|
+
body: JSON.stringify({
|
|
71
|
+
method,
|
|
72
|
+
payload,
|
|
73
|
+
locale: pageLocale()
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
const body = await response.json().catch(() => ({}));
|
|
77
|
+
if (!response.ok) throw new Error((body.error ?? `HTTP ${response.status}`).replace(/^(Project|Thread)?Error: /, ""));
|
|
78
|
+
return body.result;
|
|
79
|
+
}
|
|
80
|
+
let state = {
|
|
81
|
+
status: "idle",
|
|
82
|
+
projects: [],
|
|
83
|
+
error: null
|
|
84
|
+
};
|
|
85
|
+
const listeners$2 = /* @__PURE__ */ new Set();
|
|
86
|
+
let inflight = null;
|
|
87
|
+
function publish$1(next) {
|
|
88
|
+
state = next;
|
|
89
|
+
for (const listener of listeners$2) listener();
|
|
90
|
+
}
|
|
91
|
+
const projectsStore = {
|
|
92
|
+
getSnapshot: () => state,
|
|
93
|
+
subscribe(listener) {
|
|
94
|
+
listeners$2.add(listener);
|
|
95
|
+
return () => {
|
|
96
|
+
listeners$2.delete(listener);
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
/** Reload from the host; concurrent calls share one request. */
|
|
100
|
+
refresh() {
|
|
101
|
+
if (inflight !== null) return inflight;
|
|
102
|
+
if (state.status === "idle") publish$1({
|
|
103
|
+
...state,
|
|
104
|
+
status: "loading"
|
|
105
|
+
});
|
|
106
|
+
inflight = callHost("projects.list").then((projects) => publish$1({
|
|
107
|
+
status: "ready",
|
|
108
|
+
projects,
|
|
109
|
+
error: null
|
|
110
|
+
})).catch((error) => publish$1({
|
|
111
|
+
...state,
|
|
112
|
+
status: "error",
|
|
113
|
+
error: error instanceof Error ? error.message : String(error)
|
|
114
|
+
})).finally(() => {
|
|
115
|
+
inflight = null;
|
|
116
|
+
});
|
|
117
|
+
return inflight;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Reload the list after a mutation changed it. A `projects.list` already in flight was computed
|
|
122
|
+
* before the mutation, so it must settle first: publishing it afterwards would show the
|
|
123
|
+
* pre-mutation list (a deleted project back, a created one missing) until something else reloads.
|
|
124
|
+
*/
|
|
125
|
+
async function refreshProjects() {
|
|
126
|
+
const stale = inflight;
|
|
127
|
+
if (stale !== null) await stale.catch(() => {});
|
|
128
|
+
await projectsStore.refresh();
|
|
129
|
+
}
|
|
130
|
+
function useProjects() {
|
|
131
|
+
return (0, react.useSyncExternalStore)(projectsStore.subscribe, projectsStore.getSnapshot);
|
|
132
|
+
}
|
|
133
|
+
// src/client/chat.ts
|
|
134
|
+
const NOTICE_NODE = "dsh-threads-notice";
|
|
135
|
+
const OPENED_KEY = "dsh-threads-opened";
|
|
136
|
+
const COMMAND_NODE = "dsh-threads-command";
|
|
137
|
+
const isAppend = (event) => event.surfaceOp === "append";
|
|
138
|
+
const ROLES = /* @__PURE__ */ new Set([
|
|
139
|
+
"brief",
|
|
140
|
+
"reply",
|
|
141
|
+
"reminder",
|
|
142
|
+
"report"
|
|
143
|
+
]);
|
|
144
|
+
function isCard(value) {
|
|
145
|
+
const card = value;
|
|
146
|
+
return typeof card === "object" && card !== null && typeof card.threadId === "string" && typeof card.n === "number" && typeof card.title === "string";
|
|
147
|
+
}
|
|
148
|
+
const noticeDefinition = {
|
|
149
|
+
kind: NOTICE_NODE,
|
|
150
|
+
target: "chat",
|
|
151
|
+
match: (event) => {
|
|
152
|
+
if (event.type !== "user/message" || !isAppend(event) || event.data.source?.kind !== "dsh-threads") return null;
|
|
153
|
+
return {
|
|
154
|
+
id: String(event.data.id),
|
|
155
|
+
role: "start",
|
|
156
|
+
exclusive: true
|
|
157
|
+
};
|
|
158
|
+
},
|
|
159
|
+
start: (_context, match) => {
|
|
160
|
+
const { event } = match;
|
|
161
|
+
const source = event.data.source ?? {};
|
|
162
|
+
const content = Array.isArray(event.data.content) ? event.data.content : [];
|
|
163
|
+
return {
|
|
164
|
+
seq: event.seq,
|
|
165
|
+
time: event.time,
|
|
166
|
+
role: ROLES.has(source.role) ? source.role : null,
|
|
167
|
+
wake: typeof source.wake === "boolean" ? source.wake : null,
|
|
168
|
+
threads: Array.isArray(source.threads) ? source.threads.filter(isCard) : [],
|
|
169
|
+
summary: typeof source.summary === "string" ? source.summary : "",
|
|
170
|
+
text: content.find((block) => block.type === "text")?.text ?? ""
|
|
171
|
+
};
|
|
172
|
+
},
|
|
173
|
+
update: (context) => context.state,
|
|
174
|
+
buildViewNode: (context) => {
|
|
175
|
+
if (context.state === void 0) return null;
|
|
176
|
+
const { seq, ...data } = context.state;
|
|
177
|
+
return {
|
|
178
|
+
key: context.key,
|
|
179
|
+
kind: NOTICE_NODE,
|
|
180
|
+
id: context.id,
|
|
181
|
+
target: "chat",
|
|
182
|
+
anchorSeq: seq,
|
|
183
|
+
location: context.start?.location ?? context.matches?.[0]?.location ?? { kind: "unresolved" },
|
|
184
|
+
visibility: "visible",
|
|
185
|
+
groupTree: data.wake === true ? "input" : "turn",
|
|
186
|
+
data
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
const openedDefinition = {
|
|
191
|
+
kind: OPENED_KEY,
|
|
192
|
+
match: (event) => {
|
|
193
|
+
if (event.type === "turn/start") return {
|
|
194
|
+
id: String(event.data.turn),
|
|
195
|
+
role: "start"
|
|
196
|
+
};
|
|
197
|
+
if (event.type === "tool/call" || event.type === "tool/result" && isAppend(event)) return {
|
|
198
|
+
id: String(event.data.turn),
|
|
199
|
+
role: "update"
|
|
200
|
+
};
|
|
201
|
+
return null;
|
|
202
|
+
},
|
|
203
|
+
start: (_context, match) => {
|
|
204
|
+
if (match.event.type !== "turn/start") throw new Error("dsh-threads-opened start requires turn/start");
|
|
205
|
+
return {
|
|
206
|
+
turn: match.event.data.turn,
|
|
207
|
+
calls: /* @__PURE__ */ new Set(),
|
|
208
|
+
opened: []
|
|
209
|
+
};
|
|
210
|
+
},
|
|
211
|
+
update: (context, match) => {
|
|
212
|
+
const state = context.state;
|
|
213
|
+
if (state === void 0) return state;
|
|
214
|
+
const { event } = match;
|
|
215
|
+
if (event.type === "tool/call") {
|
|
216
|
+
if (event.data.name !== "thread_open") return state;
|
|
217
|
+
return {
|
|
218
|
+
...state,
|
|
219
|
+
calls: /* @__PURE__ */ new Set([...state.calls, String(event.data.callId)])
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
if (event.type !== "tool/result") return state;
|
|
223
|
+
if (!state.calls.has(String(event.data.message?.source?.callId))) return state;
|
|
224
|
+
const meta = event.data.meta;
|
|
225
|
+
if (!isCard(meta) || state.opened.some((card) => card.threadId === meta.threadId)) return state;
|
|
226
|
+
return {
|
|
227
|
+
...state,
|
|
228
|
+
opened: [...state.opened, {
|
|
229
|
+
threadId: meta.threadId,
|
|
230
|
+
n: meta.n,
|
|
231
|
+
title: meta.title
|
|
232
|
+
}]
|
|
233
|
+
};
|
|
234
|
+
},
|
|
235
|
+
buildLocationData: (context, scope, previous) => {
|
|
236
|
+
const state = context.state;
|
|
237
|
+
if (scope !== "turn" || state === void 0 || state.opened.length === 0) return null;
|
|
238
|
+
if (previous?.kind === "turn" && previous.turn === state.turn && previous.key === "dsh-threads-opened" && previous.value?.opened === state.opened) return previous;
|
|
239
|
+
return {
|
|
240
|
+
kind: "turn",
|
|
241
|
+
turn: state.turn,
|
|
242
|
+
key: OPENED_KEY,
|
|
243
|
+
value: { opened: state.opened }
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
/** `/thread stop <n>`, `/thread cleanup [confirm]` and a bare `/thread` open no thread. */
|
|
248
|
+
function opensThread(args) {
|
|
249
|
+
const text = typeof args === "string" ? args.trim() : "";
|
|
250
|
+
return text.length > 0 && !/^(stop|cleanup)(\s|$)/.test(text);
|
|
251
|
+
}
|
|
252
|
+
/** The thread number in `/thread`'s own success reply (src/messages.ts `commandOpened`). */
|
|
253
|
+
function openedNumber(text) {
|
|
254
|
+
const match = typeof text === "string" ? /#(\d+)/.exec(text) : null;
|
|
255
|
+
return match === null ? null : Number(match[1]);
|
|
256
|
+
}
|
|
257
|
+
const threadCommandDefinition = {
|
|
258
|
+
kind: COMMAND_NODE,
|
|
259
|
+
target: "chat",
|
|
260
|
+
match: (event) => {
|
|
261
|
+
if (event.type === "command/run" && event.data.name === "thread") return {
|
|
262
|
+
id: String(event.data.commandId),
|
|
263
|
+
role: "start"
|
|
264
|
+
};
|
|
265
|
+
if (event.type === "command/done") return {
|
|
266
|
+
id: String(event.data.commandId),
|
|
267
|
+
role: "update"
|
|
268
|
+
};
|
|
269
|
+
return null;
|
|
270
|
+
},
|
|
271
|
+
start: (_context, match) => {
|
|
272
|
+
if (match.event.type !== "command/run") throw new Error("dsh-threads-command start requires command/run");
|
|
273
|
+
return {
|
|
274
|
+
opens: opensThread(match.event.data.args),
|
|
275
|
+
n: null,
|
|
276
|
+
doneSeq: null
|
|
277
|
+
};
|
|
278
|
+
},
|
|
279
|
+
update: (context, match) => {
|
|
280
|
+
const state = context.state;
|
|
281
|
+
const { event } = match;
|
|
282
|
+
if (state === void 0 || !state.opens || event.type !== "command/done" || event.data.kind !== "success") return state;
|
|
283
|
+
const n = openedNumber(event.data.text);
|
|
284
|
+
return n === null ? state : {
|
|
285
|
+
...state,
|
|
286
|
+
n,
|
|
287
|
+
doneSeq: event.seq
|
|
288
|
+
};
|
|
289
|
+
},
|
|
290
|
+
buildViewNode: (context) => {
|
|
291
|
+
const state = context.state;
|
|
292
|
+
if (state === void 0 || state.n === null || state.doneSeq === null) return null;
|
|
293
|
+
const data = { n: state.n };
|
|
294
|
+
return {
|
|
295
|
+
key: context.key,
|
|
296
|
+
kind: COMMAND_NODE,
|
|
297
|
+
id: context.id,
|
|
298
|
+
target: "chat",
|
|
299
|
+
anchorSeq: state.doneSeq,
|
|
300
|
+
location: context.start?.location ?? context.matches?.[0]?.location ?? { kind: "unresolved" },
|
|
301
|
+
visibility: "visible",
|
|
302
|
+
data
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
// src/client/icons.tsx
|
|
307
|
+
function Svg$2({ size = 16, children, ...rest }) {
|
|
308
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
309
|
+
width: size,
|
|
310
|
+
height: size,
|
|
311
|
+
viewBox: "0 0 24 24",
|
|
312
|
+
fill: "none",
|
|
313
|
+
stroke: "currentColor",
|
|
314
|
+
strokeWidth: 1.6,
|
|
315
|
+
strokeLinecap: "round",
|
|
316
|
+
strokeLinejoin: "round",
|
|
317
|
+
"aria-hidden": "true",
|
|
318
|
+
...rest,
|
|
319
|
+
children
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
function ProjectsIcon(props) {
|
|
323
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Svg$2, {
|
|
324
|
+
...props,
|
|
325
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3.5 7.5a2 2 0 0 1 2-2h3.6l2 2h7.4a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2z" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M8 13h8M8 16h5" })]
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
function FolderIcon(props) {
|
|
329
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Svg$2, {
|
|
330
|
+
...props,
|
|
331
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3.5 7.5a2 2 0 0 1 2-2h3.6l2 2h7.4a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2z" })
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
function PlusIcon(props) {
|
|
335
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Svg$2, {
|
|
336
|
+
...props,
|
|
337
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 5v14M5 12h14" })
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
function ThreadsIcon(props) {
|
|
341
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Svg$2, {
|
|
342
|
+
...props,
|
|
343
|
+
children: [
|
|
344
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
345
|
+
cx: "6",
|
|
346
|
+
cy: "6",
|
|
347
|
+
r: "2.2"
|
|
348
|
+
}),
|
|
349
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
350
|
+
cx: "18",
|
|
351
|
+
cy: "12",
|
|
352
|
+
r: "2.2"
|
|
353
|
+
}),
|
|
354
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
355
|
+
cx: "6",
|
|
356
|
+
cy: "18",
|
|
357
|
+
r: "2.2"
|
|
358
|
+
}),
|
|
359
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M8.2 6h2.8a4 4 0 0 1 4 4v0M8.2 18h2.8a4 4 0 0 0 4-4v0" })
|
|
360
|
+
]
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
function SearchIcon(props) {
|
|
364
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Svg$2, {
|
|
365
|
+
...props,
|
|
366
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
367
|
+
cx: "11",
|
|
368
|
+
cy: "11",
|
|
369
|
+
r: "6.5"
|
|
370
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m20 20-4.2-4.2" })]
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* The icons a project can wear (Claude lets a project pick one). Ids are stored on the project;
|
|
375
|
+
* an unknown id falls back to the folder.
|
|
376
|
+
*/
|
|
377
|
+
const PROJECT_ICON_PATHS = {
|
|
378
|
+
folder: "M3.5 7.5a2 2 0 0 1 2-2h3.6l2 2h7.4a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2z",
|
|
379
|
+
scale: "M12 4.5v15M8 19.5h8M5 7.5h14M5 7.5l-2.5 5.5a2.5 2.5 0 0 0 5 0zM19 7.5l-2.5 5.5a2.5 2.5 0 0 0 5 0zM12 4.5v.01",
|
|
380
|
+
code: "m9 7.5-4.5 4.5 4.5 4.5M15 7.5l4.5 4.5-4.5 4.5",
|
|
381
|
+
terminal: "M4 5.5h16v13H4zM7.5 10l2.5 2-2.5 2M12.5 14.5h4",
|
|
382
|
+
rocket: "M12 3c3 2.2 4.8 5.7 4.8 9.6L15 16H9l-1.8-3.4C7.2 8.7 9 5.2 12 3zM12 9.3v.01M9 16l-2.2 4M15 16l2.2 4M12 16v3.5",
|
|
383
|
+
book: "M6.5 4H18v14H7a2 2 0 0 0-2 2V5.5A1.5 1.5 0 0 1 6.5 4zM5 20a2 2 0 0 1 2-2h11v2.5H7a2 2 0 0 1-2-2",
|
|
384
|
+
flask: "M9.5 3.5h5M10.5 3.5v5.7L5.4 18.1a1.6 1.6 0 0 0 1.4 2.4h10.4a1.6 1.6 0 0 0 1.4-2.4l-5.1-8.9V3.5M7.6 14.5h8.8",
|
|
385
|
+
globe: "M12 3.5a8.5 8.5 0 1 0 0 17 8.5 8.5 0 0 0 0-17zM3.5 12h17M12 3.5c2.6 2.8 2.6 14.2 0 17M12 3.5c-2.6 2.8-2.6 14.2 0 17",
|
|
386
|
+
palette: "M12 3.5a8.5 8.5 0 1 0 0 17c1.2 0 1.8-.9 1.4-2l-.4-1a2 2 0 0 1 1.9-2.6H17a3.5 3.5 0 0 0 3.5-3.5c0-4.4-3.8-7.9-8.5-7.9zM7.8 11.5v.01M10 7.6v.01M14.6 7.6v.01",
|
|
387
|
+
star: "m12 3.8 2.5 5.1 5.6.8-4 3.9 1 5.6-5.1-2.6-5.1 2.6 1-5.6-4-3.9 5.6-.8z",
|
|
388
|
+
bolt: "M13 3 5 13.5h6L10 21l8-10.5h-6z",
|
|
389
|
+
chart: "M4 20h16M7 16.5v-5M12 16.5V8M17 16.5V5",
|
|
390
|
+
shield: "M12 3.5 5 6.2v5.6c0 4.1 2.9 7.5 7 8.7 4.1-1.2 7-4.6 7-8.7V6.2z",
|
|
391
|
+
cube: "m12 3.5 8 4.5v8l-8 4.5-8-4.5V8zM4 8l8 4.5L20 8M12 12.5v8",
|
|
392
|
+
layers: "m12 4 8.5 4.5L12 13 3.5 8.5zM3.5 12.5 12 17l8.5-4.5M3.5 16.5 12 21l8.5-4.5",
|
|
393
|
+
leaf: "M5 19c0-8.6 5.2-14 14-14 0 8.8-5.4 14-14 14zM5 19l8-8",
|
|
394
|
+
heart: "M12 20s-7.5-4.6-7.5-10.2A4.2 4.2 0 0 1 12 7.4a4.2 4.2 0 0 1 7.5 2.4C19.5 15.4 12 20 12 20z",
|
|
395
|
+
music: "M9 17.5v-12l10-2v12M9 17.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0zM19 15.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0z",
|
|
396
|
+
camera: "M4 8.5h3.5L9 6h6l1.5 2.5H20v10H4zM12 10.2a3 3 0 1 0 0 6 3 3 0 0 0 0-6z",
|
|
397
|
+
gamepad: "M7 8h10a4 4 0 0 1 4 4v1.6a2.9 2.9 0 0 1-5.2 1.7L14.6 14H9.4l-1.2 1.3A2.9 2.9 0 0 1 3 13.6V12a4 4 0 0 1 4-4zM7.5 10.3v3M6 11.8h3M15.6 11.2v.01M17.4 12.8v.01",
|
|
398
|
+
briefcase: "M4 8h16v11H4zM9 8V5.5h6V8M4 13h16",
|
|
399
|
+
bulb: "M9.5 18h5M10.5 21h3M12 3.5a5.5 5.5 0 0 0-3.2 10c.7.5 1.2 1.3 1.2 2.2v.3h4v-.3c0-.9.5-1.7 1.2-2.2A5.5 5.5 0 0 0 12 3.5z",
|
|
400
|
+
compass: "M12 3.5a8.5 8.5 0 1 0 0 17 8.5 8.5 0 0 0 0-17zM15.5 8.5l-2 5-5 2 2-5z",
|
|
401
|
+
target: "M12 3.5a8.5 8.5 0 1 0 0 17 8.5 8.5 0 0 0 0-17zM12 7.5a4.5 4.5 0 1 0 0 9 4.5 4.5 0 0 0 0-9zM12 11.5v1"
|
|
402
|
+
};
|
|
403
|
+
const PROJECT_ICON_IDS = Object.keys(PROJECT_ICON_PATHS);
|
|
404
|
+
function ProjectIcon({ id, ...props }) {
|
|
405
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Svg$2, {
|
|
406
|
+
...props,
|
|
407
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: PROJECT_ICON_PATHS[id] ?? PROJECT_ICON_PATHS.folder })
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
function BellIcon(props) {
|
|
411
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Svg$2, {
|
|
412
|
+
...props,
|
|
413
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M6 16.5V11a6 6 0 0 1 12 0v5.5l1.5 2h-15zM10 20.5a2 2 0 0 0 4 0" })
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
// src/client/threads.ts
|
|
417
|
+
/** Bumped after any change this browser makes (resolve, reopen), so panes reload. */
|
|
418
|
+
let revision = 0;
|
|
419
|
+
const listeners$1 = /* @__PURE__ */ new Set();
|
|
420
|
+
const threadsRevision = {
|
|
421
|
+
bump() {
|
|
422
|
+
revision += 1;
|
|
423
|
+
for (const listener of listeners$1) listener();
|
|
424
|
+
},
|
|
425
|
+
subscribe(listener) {
|
|
426
|
+
listeners$1.add(listener);
|
|
427
|
+
return () => {
|
|
428
|
+
listeners$1.delete(listener);
|
|
429
|
+
};
|
|
430
|
+
},
|
|
431
|
+
get: () => revision
|
|
432
|
+
};
|
|
433
|
+
function useThreadsRevision() {
|
|
434
|
+
return (0, react.useSyncExternalStore)(threadsRevision.subscribe, threadsRevision.get);
|
|
435
|
+
}
|
|
436
|
+
/** Load a host value, reloading whenever `deps` change; keeps the last value while reloading. */
|
|
437
|
+
/** Requests in flight, so the cards of one conversation refreshing together share one call. */
|
|
438
|
+
const inFlight = /* @__PURE__ */ new Map();
|
|
439
|
+
function sharedCall(method, payload) {
|
|
440
|
+
const key = `${method}\n${JSON.stringify(payload)}`;
|
|
441
|
+
let pending = inFlight.get(key);
|
|
442
|
+
if (pending === void 0) {
|
|
443
|
+
pending = callHost(method, payload).finally(() => inFlight.delete(key));
|
|
444
|
+
inFlight.set(key, pending);
|
|
445
|
+
}
|
|
446
|
+
return pending;
|
|
447
|
+
}
|
|
448
|
+
function useHostValue(method, payload, deps) {
|
|
449
|
+
const [value, setValue] = (0, react.useState)(void 0);
|
|
450
|
+
(0, react.useEffect)(() => {
|
|
451
|
+
if (method === null) {
|
|
452
|
+
setValue(void 0);
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
let live = true;
|
|
456
|
+
sharedCall(method, payload).then((next) => {
|
|
457
|
+
if (live) setValue(next);
|
|
458
|
+
}, () => {});
|
|
459
|
+
return () => {
|
|
460
|
+
live = false;
|
|
461
|
+
};
|
|
462
|
+
}, [method, ...deps]);
|
|
463
|
+
return value;
|
|
464
|
+
}
|
|
465
|
+
const ASK_KINDS = /* @__PURE__ */ new Set([
|
|
466
|
+
"approval",
|
|
467
|
+
"question",
|
|
468
|
+
"plan-review"
|
|
469
|
+
]);
|
|
470
|
+
/** Every session's live state as one string: selectors must return stable values. */
|
|
471
|
+
function liveKey(statuses) {
|
|
472
|
+
const tokens = [];
|
|
473
|
+
for (const [id, status] of statuses) {
|
|
474
|
+
if (status.running === true) tokens.push(`r:${id}`);
|
|
475
|
+
const kind = status.pendingInteraction?.kind;
|
|
476
|
+
if (kind !== void 0 && ASK_KINDS.has(kind)) tokens.push(`a:${id}:${kind}`);
|
|
477
|
+
}
|
|
478
|
+
return tokens.sort().join(",");
|
|
479
|
+
}
|
|
480
|
+
function parseLive(key) {
|
|
481
|
+
const running = /* @__PURE__ */ new Set();
|
|
482
|
+
const asking = /* @__PURE__ */ new Map();
|
|
483
|
+
for (const token of key.split(",")) if (token.startsWith("r:")) running.add(token.slice(2));
|
|
484
|
+
else if (token.startsWith("a:")) {
|
|
485
|
+
const at = token.lastIndexOf(":");
|
|
486
|
+
asking.set(token.slice(2, at), token.slice(at + 1));
|
|
487
|
+
}
|
|
488
|
+
return {
|
|
489
|
+
running,
|
|
490
|
+
asking
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
/** Live state of every session, re-rendering only when it changes; `key` also serves as a reload dependency. */
|
|
494
|
+
function useLive(useSessionStatus) {
|
|
495
|
+
const key = useSessionStatus(liveKey);
|
|
496
|
+
return (0, react.useMemo)(() => ({
|
|
497
|
+
...parseLive(key),
|
|
498
|
+
key
|
|
499
|
+
}), [key]);
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Sort threads into the list's sections, newest activity first, keeping those whose number,
|
|
503
|
+
* title or latest summary contains `query`. `stateOf` is glyphState with the live running set.
|
|
504
|
+
*/
|
|
505
|
+
function groupThreads(threads, stateOf, query = "") {
|
|
506
|
+
const needle = query.trim().toLowerCase().replace(/^#/, "");
|
|
507
|
+
const matches = (thread) => needle.length === 0 || String(thread.n) === needle || thread.title.toLowerCase().includes(needle) || (thread.lastReport?.summary.toLowerCase().includes(needle) ?? false);
|
|
508
|
+
const groups = {
|
|
509
|
+
waiting: [],
|
|
510
|
+
running: [],
|
|
511
|
+
idle: [],
|
|
512
|
+
resolved: [],
|
|
513
|
+
archived: []
|
|
514
|
+
};
|
|
515
|
+
const newestFirst = [...threads].filter(matches).sort((a, b) => b.updatedAt.localeCompare(a.updatedAt) || b.n - a.n);
|
|
516
|
+
for (const thread of newestFirst) {
|
|
517
|
+
if (thread.archived) {
|
|
518
|
+
groups.archived.push(thread);
|
|
519
|
+
continue;
|
|
520
|
+
}
|
|
521
|
+
const state = stateOf(thread);
|
|
522
|
+
(state === "waiting" ? groups.waiting : state === "running" || state === "queued" ? groups.running : state === "resolved" ? groups.resolved : groups.idle).push(thread);
|
|
523
|
+
}
|
|
524
|
+
return groups;
|
|
525
|
+
}
|
|
526
|
+
/** Right-sidebar resource address of a thread's conversation. */
|
|
527
|
+
const THREAD_ADDRESS = "dsh-resource://dsh-threads/session/";
|
|
528
|
+
function threadAddress(threadId) {
|
|
529
|
+
return `${THREAD_ADDRESS}${encodeURIComponent(threadId)}`;
|
|
530
|
+
}
|
|
531
|
+
function parseThreadAddress(value) {
|
|
532
|
+
let url;
|
|
533
|
+
try {
|
|
534
|
+
url = new URL(value);
|
|
535
|
+
} catch {
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
if (url.protocol !== "dsh-resource:" || url.hostname.toLowerCase() !== "dsh-threads") return void 0;
|
|
539
|
+
const parts = url.pathname.split("/").filter(Boolean);
|
|
540
|
+
if (parts.length !== 2 || parts[0] !== "session" || parts[1] === void 0) return void 0;
|
|
541
|
+
try {
|
|
542
|
+
return decodeURIComponent(parts[1]);
|
|
543
|
+
} catch {
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
const THREAD_ADDRESS_PATTERN = `${THREAD_ADDRESS}**`;
|
|
548
|
+
// src/client/kinds.ts
|
|
549
|
+
const SIDEBAR_STYLE_ID = "@kyf-eng/dsh-threads/sidebar";
|
|
550
|
+
let kinds = {
|
|
551
|
+
threads: /* @__PURE__ */ new Set(),
|
|
552
|
+
mains: /* @__PURE__ */ new Map(),
|
|
553
|
+
hiddenWorkspaces: /* @__PURE__ */ new Set()
|
|
554
|
+
};
|
|
555
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
556
|
+
const rowSelector = (kind, id) => `[data-row-key="${kind}:${id.replace(/["\\]/g, "\\$&")}"]`;
|
|
557
|
+
/** The "Projects" section's rows: active projects, pinned first, then by latest activity. */
|
|
558
|
+
function sidebarProjects(projects) {
|
|
559
|
+
return projects.filter((project) => !project.archived).sort((a, b) => a.pinned !== b.pinned ? a.pinned ? -1 : 1 : b.lastActivity.localeCompare(a.lastActivity));
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Workspaces to drop from DSH's list: those holding a project session and no other session DSH
|
|
563
|
+
* would show. DSH's own rule (`sessionVisible` in dsh-client-ui-workspace) skips unknown, blank
|
|
564
|
+
* (unless current), subagent and archived sessions.
|
|
565
|
+
*/
|
|
566
|
+
function projectOnlyWorkspaces(workspaces, sessions, archived, projectSessions, current) {
|
|
567
|
+
const shown = (id) => {
|
|
568
|
+
const session = sessions[id];
|
|
569
|
+
return session !== void 0 && session.origin !== "subagent" && (session.blank !== true || id === current) && !archived.has(id);
|
|
570
|
+
};
|
|
571
|
+
return workspaces.filter((workspace) => workspace.sessionIds.some((id) => projectSessions.has(id)) && workspace.sessionIds.every((id) => projectSessions.has(id) || !shown(id))).map((workspace) => workspace.workspaceId);
|
|
572
|
+
}
|
|
573
|
+
/** The generated rule hiding project sessions and project-only workspaces in DSH's list. */
|
|
574
|
+
function sidebarCss(next) {
|
|
575
|
+
const hidden = [...[...next.threads, ...next.mains.keys()].map((id) => rowSelector("session", id)), ...[...next.hiddenWorkspaces].flatMap((id) => [rowSelector("workspace", id), rowSelector("overflow", id)])];
|
|
576
|
+
return hidden.length === 0 ? "" : `${hidden.join(",")}{display:none!important}`;
|
|
577
|
+
}
|
|
578
|
+
function writeSidebarCss(next) {
|
|
579
|
+
if (typeof document === "undefined") return;
|
|
580
|
+
let tag = document.querySelector(`style[data-plugin-css="${SIDEBAR_STYLE_ID}"]`);
|
|
581
|
+
if (tag === null) {
|
|
582
|
+
tag = document.createElement("style");
|
|
583
|
+
tag.dataset.plugin = "@kyf-eng/dsh-threads";
|
|
584
|
+
tag.dataset.pluginCss = SIDEBAR_STYLE_ID;
|
|
585
|
+
document.head.appendChild(tag);
|
|
586
|
+
}
|
|
587
|
+
tag.textContent = sidebarCss(next);
|
|
588
|
+
}
|
|
589
|
+
function publish(next) {
|
|
590
|
+
kinds = next;
|
|
591
|
+
writeSidebarCss(next);
|
|
592
|
+
for (const listener of listeners) listener();
|
|
593
|
+
}
|
|
594
|
+
/** How long after a session stops the host has surely settled its thread record. */
|
|
595
|
+
const SETTLE_MS = 1500;
|
|
596
|
+
/**
|
|
597
|
+
* Reload on start, after this browser changes something, and when any session starts or stops.
|
|
598
|
+
* A thread's record settles on the host just after its session stops, so views that reloaded on
|
|
599
|
+
* the stop itself may still see it running; when a session stops, every thread view (they all
|
|
600
|
+
* follow `threadsRevision`) reloads once more a moment later.
|
|
601
|
+
*/
|
|
602
|
+
function syncKinds(status) {
|
|
603
|
+
let disposed = false;
|
|
604
|
+
let pending;
|
|
605
|
+
let settle;
|
|
606
|
+
const load = async () => {
|
|
607
|
+
const next = await callHost("sessions.kinds").catch(() => void 0);
|
|
608
|
+
if (!disposed && next !== void 0) publish({
|
|
609
|
+
...kinds,
|
|
610
|
+
threads: new Set(next.threads),
|
|
611
|
+
mains: new Map(next.mains.map(({ id, ...main }) => [id, main]))
|
|
612
|
+
});
|
|
613
|
+
};
|
|
614
|
+
const schedule = () => {
|
|
615
|
+
if (pending !== void 0) clearTimeout(pending);
|
|
616
|
+
pending = setTimeout(() => {
|
|
617
|
+
load();
|
|
618
|
+
}, 300);
|
|
619
|
+
};
|
|
620
|
+
let running = /* @__PURE__ */ new Set();
|
|
621
|
+
const offStatus = status?.subscribe(() => {
|
|
622
|
+
const next = new Set([...status.getSnapshot()].filter(([, state]) => state.running === true).map(([id]) => id));
|
|
623
|
+
const stopped = [...running].some((id) => !next.has(id));
|
|
624
|
+
const changed = stopped || [...next].some((id) => !running.has(id));
|
|
625
|
+
running = next;
|
|
626
|
+
if (!changed) return;
|
|
627
|
+
schedule();
|
|
628
|
+
if (stopped) {
|
|
629
|
+
if (settle !== void 0) clearTimeout(settle);
|
|
630
|
+
settle = setTimeout(() => threadsRevision.bump(), SETTLE_MS);
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
const offRevision = threadsRevision.subscribe(schedule);
|
|
634
|
+
load();
|
|
635
|
+
return () => {
|
|
636
|
+
disposed = true;
|
|
637
|
+
if (pending !== void 0) clearTimeout(pending);
|
|
638
|
+
if (settle !== void 0) clearTimeout(settle);
|
|
639
|
+
offStatus?.();
|
|
640
|
+
offRevision();
|
|
641
|
+
document.querySelector(`style[data-plugin-css="${SIDEBAR_STYLE_ID}"]`)?.remove();
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
/** Set by the sidebar's projects section, which reads DSH's workspace and session lists. */
|
|
645
|
+
function setHiddenWorkspaces(ids) {
|
|
646
|
+
if (ids.length === kinds.hiddenWorkspaces.size && ids.every((id) => kinds.hiddenWorkspaces.has(id))) return;
|
|
647
|
+
publish({
|
|
648
|
+
...kinds,
|
|
649
|
+
hiddenWorkspaces: new Set(ids)
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
/** Thread counts and states per main conversation, for the sidebar's project rows. */
|
|
653
|
+
function useKinds() {
|
|
654
|
+
return (0, react.useSyncExternalStore)((listener) => {
|
|
655
|
+
listeners.add(listener);
|
|
656
|
+
return () => {
|
|
657
|
+
listeners.delete(listener);
|
|
658
|
+
};
|
|
659
|
+
}, () => kinds);
|
|
660
|
+
}
|
|
661
|
+
// src/client/notify.ts
|
|
662
|
+
/** Whether a project at `level` wants to hear that this session finished. */
|
|
663
|
+
function wantsNotification(level, kind, waiting) {
|
|
664
|
+
switch (level) {
|
|
665
|
+
case "all": return true;
|
|
666
|
+
case "attention": return kind === "main" || waiting;
|
|
667
|
+
case "waiting": return waiting;
|
|
668
|
+
case "none": return false;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
const ASK_KEYS$1 = {
|
|
672
|
+
approval: "ask.approval",
|
|
673
|
+
question: "ask.question",
|
|
674
|
+
"plan-review": "ask.planReview"
|
|
675
|
+
};
|
|
676
|
+
const STATUS_KEYS$1 = {
|
|
677
|
+
done: "status.done",
|
|
678
|
+
blocked: "status.blocked",
|
|
679
|
+
needs_decision: "status.needsDecision",
|
|
680
|
+
failed: "status.failed",
|
|
681
|
+
"no-report": "status.noReport",
|
|
682
|
+
stopped: "status.stopped"
|
|
683
|
+
};
|
|
684
|
+
function message(target, t, asking) {
|
|
685
|
+
const title = target.kind === "main" ? target.projectTitle : `${target.projectTitle} · #${target.n} ${target.title}`;
|
|
686
|
+
if (asking !== void 0) return {
|
|
687
|
+
title,
|
|
688
|
+
body: t(ASK_KEYS$1[asking])
|
|
689
|
+
};
|
|
690
|
+
if (target.kind === "main") return {
|
|
691
|
+
title: target.projectTitle,
|
|
692
|
+
body: t("notifyMsg.main", { text: target.text || "…" })
|
|
693
|
+
};
|
|
694
|
+
if (target.waiting) return {
|
|
695
|
+
title,
|
|
696
|
+
body: t("notifyMsg.waiting", { text: target.text || "…" })
|
|
697
|
+
};
|
|
698
|
+
const status = t(STATUS_KEYS$1[target.status ?? "no-report"] ?? "status.noReport");
|
|
699
|
+
return {
|
|
700
|
+
title,
|
|
701
|
+
body: target.text.length > 0 ? t("notifyMsg.finished", {
|
|
702
|
+
status,
|
|
703
|
+
text: target.text
|
|
704
|
+
}) : status
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
const inBackground = () => typeof document === "undefined" || document.visibilityState !== "visible" || !document.hasFocus();
|
|
708
|
+
function startNotifications(deps) {
|
|
709
|
+
const { status } = deps;
|
|
710
|
+
if (status === void 0 || typeof Notification === "undefined") return () => {};
|
|
711
|
+
let running = /* @__PURE__ */ new Set();
|
|
712
|
+
let asking = /* @__PURE__ */ new Map();
|
|
713
|
+
let finished = /* @__PURE__ */ new Set();
|
|
714
|
+
/** Sessions that started waiting on the user since the last batch. */
|
|
715
|
+
let started = /* @__PURE__ */ new Map();
|
|
716
|
+
let pending;
|
|
717
|
+
let disposed = false;
|
|
718
|
+
const flush = async () => {
|
|
719
|
+
const asks = started;
|
|
720
|
+
const ids = [.../* @__PURE__ */ new Set([...finished, ...asks.keys()])];
|
|
721
|
+
finished = /* @__PURE__ */ new Set();
|
|
722
|
+
started = /* @__PURE__ */ new Map();
|
|
723
|
+
if (ids.length === 0 || !inBackground()) return;
|
|
724
|
+
const wanted = (await callHost("notifications.describe", { ids }).catch(() => [])).filter((target) => wantsNotification(target.level, target.kind, target.waiting || asks.has(target.sessionId)));
|
|
725
|
+
if (disposed || wanted.length === 0) return;
|
|
726
|
+
if (Notification.permission === "default") await Notification.requestPermission().catch(() => "denied");
|
|
727
|
+
if (Notification.permission !== "granted") return;
|
|
728
|
+
for (const target of wanted) {
|
|
729
|
+
const { title, body } = message(target, deps.t, asks.get(target.sessionId));
|
|
730
|
+
const shown = new Notification(title, {
|
|
731
|
+
body,
|
|
732
|
+
tag: `dsh-threads:${target.sessionId}`
|
|
733
|
+
});
|
|
734
|
+
shown.onclick = () => {
|
|
735
|
+
window.focus();
|
|
736
|
+
deps.openSession(target.mainSessionId);
|
|
737
|
+
if (target.kind === "thread") deps.openThread(target.sessionId);
|
|
738
|
+
shown.close();
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
const off = status.subscribe(() => {
|
|
743
|
+
const next = parseLive(liveKey(status.getSnapshot()));
|
|
744
|
+
for (const id of running) if (!next.running.has(id)) finished.add(id);
|
|
745
|
+
for (const [id, kind] of next.asking) if (!asking.has(id)) started.set(id, kind);
|
|
746
|
+
running = next.running;
|
|
747
|
+
asking = next.asking;
|
|
748
|
+
if (finished.size === 0 && started.size === 0) return;
|
|
749
|
+
if (pending !== void 0) clearTimeout(pending);
|
|
750
|
+
pending = setTimeout(() => {
|
|
751
|
+
flush();
|
|
752
|
+
}, 600);
|
|
753
|
+
});
|
|
754
|
+
const first = parseLive(liveKey(status.getSnapshot()));
|
|
755
|
+
running = first.running;
|
|
756
|
+
asking = first.asking;
|
|
757
|
+
return () => {
|
|
758
|
+
disposed = true;
|
|
759
|
+
if (pending !== void 0) clearTimeout(pending);
|
|
760
|
+
off();
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
// src/client/glyphs.tsx
|
|
764
|
+
/** The one place thread data turns into a state mark. */
|
|
765
|
+
function glyphState(thread, running = false, asking = false) {
|
|
766
|
+
if (asking) return "waiting";
|
|
767
|
+
if (running || thread.status === "running" || thread.status === "starting") return "running";
|
|
768
|
+
if (thread.status === "failed") return "failed";
|
|
769
|
+
if (thread.resolved) return "resolved";
|
|
770
|
+
if (thread.archived === true) return "done";
|
|
771
|
+
if (thread.stopped) return "done";
|
|
772
|
+
return reportGlyph(thread.lastReport?.status);
|
|
773
|
+
}
|
|
774
|
+
/** For card data that carries only the report status (`done`, `needs_decision`, `no-report`, …). */
|
|
775
|
+
function reportGlyph(status) {
|
|
776
|
+
if (status === "needs_decision" || status === "blocked") return "waiting";
|
|
777
|
+
if (status === "failed") return "failed";
|
|
778
|
+
return "done";
|
|
779
|
+
}
|
|
780
|
+
function Svg$1({ children, ...rest }) {
|
|
781
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
782
|
+
width: 16,
|
|
783
|
+
height: 16,
|
|
784
|
+
viewBox: "0 0 24 24",
|
|
785
|
+
fill: "none",
|
|
786
|
+
stroke: "currentColor",
|
|
787
|
+
strokeWidth: 1.8,
|
|
788
|
+
strokeLinecap: "round",
|
|
789
|
+
strokeLinejoin: "round",
|
|
790
|
+
"aria-hidden": "true",
|
|
791
|
+
...rest,
|
|
792
|
+
children
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
/** Raised hand (path from Lucide, ISC). */
|
|
796
|
+
function HandIcon(props) {
|
|
797
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Svg$1, {
|
|
798
|
+
...props,
|
|
799
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M18 11V6a2 2 0 0 0-4 0M14 10V4a2 2 0 0 0-4 0v2M10 10.5V6a2 2 0 0 0-4 0v8" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-6-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.83L7 15" })]
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
function ThreadGlyph({ state, label }) {
|
|
803
|
+
const common = {
|
|
804
|
+
className: `dsht-glyph dsht-glyph-${state}`,
|
|
805
|
+
title: label,
|
|
806
|
+
role: label === void 0 ? void 0 : "img",
|
|
807
|
+
"aria-label": label
|
|
808
|
+
};
|
|
809
|
+
switch (state) {
|
|
810
|
+
case "running": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
811
|
+
...common,
|
|
812
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "dsht-pulse" })
|
|
813
|
+
});
|
|
814
|
+
case "waiting": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
815
|
+
...common,
|
|
816
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HandIcon, {})
|
|
817
|
+
});
|
|
818
|
+
case "failed": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
819
|
+
...common,
|
|
820
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Svg$1, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
821
|
+
cx: "12",
|
|
822
|
+
cy: "12",
|
|
823
|
+
r: "8.5"
|
|
824
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m9 9 6 6M15 9l-6 6" })] })
|
|
825
|
+
});
|
|
826
|
+
case "resolved": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
827
|
+
...common,
|
|
828
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Svg$1, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
829
|
+
cx: "12",
|
|
830
|
+
cy: "12",
|
|
831
|
+
r: "8.5"
|
|
832
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m8.5 12.2 2.4 2.4 4.6-4.9" })] })
|
|
833
|
+
});
|
|
834
|
+
case "queued": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
835
|
+
...common,
|
|
836
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Svg$1, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
837
|
+
cx: "12",
|
|
838
|
+
cy: "12",
|
|
839
|
+
r: "8.5"
|
|
840
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 7.5V12l3 2" })] })
|
|
841
|
+
});
|
|
842
|
+
case "done": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
843
|
+
...common,
|
|
844
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Svg$1, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
845
|
+
cx: "12",
|
|
846
|
+
cy: "12",
|
|
847
|
+
r: "6.5"
|
|
848
|
+
}) })
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
// src/client/ui.tsx
|
|
853
|
+
function Svg({ children, size = 14, ...rest }) {
|
|
854
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
855
|
+
width: size,
|
|
856
|
+
height: size,
|
|
857
|
+
viewBox: "0 0 24 24",
|
|
858
|
+
fill: "none",
|
|
859
|
+
stroke: "currentColor",
|
|
860
|
+
strokeWidth: 1.8,
|
|
861
|
+
strokeLinecap: "round",
|
|
862
|
+
strokeLinejoin: "round",
|
|
863
|
+
"aria-hidden": "true",
|
|
864
|
+
...rest,
|
|
865
|
+
children
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
function ChevronIcon() {
|
|
869
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Svg, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m9.5 6 6 6-6 6" }) });
|
|
870
|
+
}
|
|
871
|
+
/** "↳": replies under a message, as in Claude's "↰ 2 条回复". */
|
|
872
|
+
function RepliesIcon() {
|
|
873
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Svg, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M6 4.5v7a3 3 0 0 0 3 3h9.5M15 11l3.5 3.5L15 18" }) });
|
|
874
|
+
}
|
|
875
|
+
function BranchIcon() {
|
|
876
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Svg, { children: [
|
|
877
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
878
|
+
cx: "6.5",
|
|
879
|
+
cy: "5.5",
|
|
880
|
+
r: "2"
|
|
881
|
+
}),
|
|
882
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
883
|
+
cx: "6.5",
|
|
884
|
+
cy: "18.5",
|
|
885
|
+
r: "2"
|
|
886
|
+
}),
|
|
887
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
888
|
+
cx: "17.5",
|
|
889
|
+
cy: "7.5",
|
|
890
|
+
r: "2"
|
|
891
|
+
}),
|
|
892
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M6.5 7.5v9M17.5 9.5c0 4-5 3.5-9.6 7.4" })
|
|
893
|
+
] });
|
|
894
|
+
}
|
|
895
|
+
function StartIcon() {
|
|
896
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Svg, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M9 7 4.5 11.5 9 16" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4.5 11.5h10a5 5 0 0 0 5-5V5" })] });
|
|
897
|
+
}
|
|
898
|
+
function CheckIcon() {
|
|
899
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Svg, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m5.5 12.5 4 4 9-9.5" }) });
|
|
900
|
+
}
|
|
901
|
+
function ReopenIcon() {
|
|
902
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Svg, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4.5 12a7.5 7.5 0 1 0 2.2-5.3L4.5 9" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4.5 4.5V9H9" })] });
|
|
903
|
+
}
|
|
904
|
+
function ExpandIcon() {
|
|
905
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Svg, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M14 4.5h5.5V10M10 19.5H4.5V14M19.5 4.5 13 11M4.5 19.5 11 13" }) });
|
|
906
|
+
}
|
|
907
|
+
function StopIcon() {
|
|
908
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Svg, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
909
|
+
x: "6.5",
|
|
910
|
+
y: "6.5",
|
|
911
|
+
width: "11",
|
|
912
|
+
height: "11",
|
|
913
|
+
rx: "2"
|
|
914
|
+
}) });
|
|
915
|
+
}
|
|
916
|
+
/** Archive box (paths from Lucide, ISC). */
|
|
917
|
+
function ArchiveIcon() {
|
|
918
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Svg, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
919
|
+
x: "3",
|
|
920
|
+
y: "4",
|
|
921
|
+
width: "18",
|
|
922
|
+
height: "5",
|
|
923
|
+
rx: "1"
|
|
924
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M5 9v9a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9M10 13h4" })] });
|
|
925
|
+
}
|
|
926
|
+
function CloseIcon() {
|
|
927
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Svg, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m7 7 10 10M17 7 7 17" }) });
|
|
928
|
+
}
|
|
929
|
+
const KINDS = {
|
|
930
|
+
md: "doc",
|
|
931
|
+
mdx: "doc",
|
|
932
|
+
txt: "doc",
|
|
933
|
+
rst: "doc",
|
|
934
|
+
doc: "doc",
|
|
935
|
+
docx: "doc",
|
|
936
|
+
pdf: "doc",
|
|
937
|
+
ts: "code",
|
|
938
|
+
tsx: "code",
|
|
939
|
+
js: "code",
|
|
940
|
+
jsx: "code",
|
|
941
|
+
mjs: "code",
|
|
942
|
+
cjs: "code",
|
|
943
|
+
py: "code",
|
|
944
|
+
go: "code",
|
|
945
|
+
rs: "code",
|
|
946
|
+
java: "code",
|
|
947
|
+
kt: "code",
|
|
948
|
+
swift: "code",
|
|
949
|
+
c: "code",
|
|
950
|
+
h: "code",
|
|
951
|
+
cpp: "code",
|
|
952
|
+
cs: "code",
|
|
953
|
+
rb: "code",
|
|
954
|
+
php: "code",
|
|
955
|
+
css: "code",
|
|
956
|
+
scss: "code",
|
|
957
|
+
html: "code",
|
|
958
|
+
vue: "code",
|
|
959
|
+
svelte: "code",
|
|
960
|
+
sh: "code",
|
|
961
|
+
sql: "code",
|
|
962
|
+
json: "data",
|
|
963
|
+
yml: "data",
|
|
964
|
+
yaml: "data",
|
|
965
|
+
toml: "data",
|
|
966
|
+
csv: "data",
|
|
967
|
+
xml: "data",
|
|
968
|
+
lock: "data",
|
|
969
|
+
env: "data"
|
|
970
|
+
};
|
|
971
|
+
function fileKind(path) {
|
|
972
|
+
const name = path.split(/[\\/]/).pop() ?? path;
|
|
973
|
+
const dot = name.lastIndexOf(".");
|
|
974
|
+
return dot < 0 ? "other" : KINDS[name.slice(dot + 1).toLowerCase()] ?? "other";
|
|
975
|
+
}
|
|
976
|
+
function FileIcon({ kind }) {
|
|
977
|
+
if (kind === "code") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Svg, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m9 8-4 4 4 4M15 8l4 4-4 4" }) });
|
|
978
|
+
if (kind === "data") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Svg, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M9 4.5c-2 0-2.5 1-2.5 2.5v2.5c0 1.2-.8 2.5-2 2.5 1.2 0 2 1.3 2 2.5V17c0 1.5.5 2.5 2.5 2.5M15 4.5c2 0 2.5 1 2.5 2.5v2.5c0 1.2.8 2.5 2 2.5-1.2 0-2 1.3-2 2.5V17c0 1.5-.5 2.5-2.5 2.5" }) });
|
|
979
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Svg, { children: [
|
|
980
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M14 3.5H7.5a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2V8z" }),
|
|
981
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M14 3.5V8h4.5" }),
|
|
982
|
+
kind === "doc" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M8.5 12.5h7M8.5 15.5h5" }) : null
|
|
983
|
+
] });
|
|
984
|
+
}
|
|
985
|
+
/** A changed file, with Claude's colored type icon (documents green, code blue, data amber). */
|
|
986
|
+
function FileChip({ path }) {
|
|
987
|
+
const kind = fileKind(path);
|
|
988
|
+
const name = path.split(/[\\/]/).pop() ?? path;
|
|
989
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
990
|
+
className: `dsht-chip dsht-file dsht-file-${kind}`,
|
|
991
|
+
title: path,
|
|
992
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FileIcon, { kind }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
993
|
+
className: "dsht-chip-text",
|
|
994
|
+
children: name
|
|
995
|
+
})]
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
function BranchChip({ branch, removed }) {
|
|
999
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1000
|
+
className: `dsht-chip dsht-branch${removed === true ? " dsht-branch-removed" : ""}`,
|
|
1001
|
+
title: branch,
|
|
1002
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BranchIcon, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1003
|
+
className: "dsht-chip-text dsht-mono",
|
|
1004
|
+
children: branch
|
|
1005
|
+
})]
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
function Pill({ children, onClick, primary, disabled, icon, label }) {
|
|
1009
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1010
|
+
type: "button",
|
|
1011
|
+
className: `dsht-pill${primary === true ? " dsht-pill-primary" : ""}${children === void 0 ? " dsht-pill-icon" : ""}`,
|
|
1012
|
+
disabled,
|
|
1013
|
+
"aria-label": label,
|
|
1014
|
+
title: label,
|
|
1015
|
+
onClick: (event) => {
|
|
1016
|
+
event.stopPropagation();
|
|
1017
|
+
onClick();
|
|
1018
|
+
},
|
|
1019
|
+
children: [icon, children]
|
|
1020
|
+
});
|
|
1021
|
+
}
|
|
1022
|
+
/** Small label above a group of items ("建议的讨论串", "↳ 2 条回复"). */
|
|
1023
|
+
function CardHead({ icon, children, trailing }) {
|
|
1024
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1025
|
+
className: "dsht-head-label",
|
|
1026
|
+
children: [
|
|
1027
|
+
icon,
|
|
1028
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children }),
|
|
1029
|
+
trailing === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1030
|
+
className: "dsht-head-trailing",
|
|
1031
|
+
children: trailing
|
|
1032
|
+
})
|
|
1033
|
+
]
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1036
|
+
/**
|
|
1037
|
+
* One thread, as Claude draws it in a conversation: the whole item opens the thread; a thread
|
|
1038
|
+
* waiting on the user also shows an explicit "查看讨论串" pill.
|
|
1039
|
+
*/
|
|
1040
|
+
function ThreadItem(props) {
|
|
1041
|
+
const { n, title, state, status, summary, decision, decisionLabel, files, branch, stateLabel, openLabel, onOpen, compact } = props;
|
|
1042
|
+
const waiting = state === "waiting";
|
|
1043
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1044
|
+
className: `dsht-item dsht-item-${state}${compact === true ? " dsht-item-compact" : ""}`,
|
|
1045
|
+
role: "button",
|
|
1046
|
+
tabIndex: 0,
|
|
1047
|
+
onClick: onOpen,
|
|
1048
|
+
onKeyDown: (event) => {
|
|
1049
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
1050
|
+
event.preventDefault();
|
|
1051
|
+
onOpen();
|
|
1052
|
+
}
|
|
1053
|
+
},
|
|
1054
|
+
children: [
|
|
1055
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadGlyph, {
|
|
1056
|
+
state,
|
|
1057
|
+
label: stateLabel
|
|
1058
|
+
}),
|
|
1059
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1060
|
+
className: "dsht-item-body",
|
|
1061
|
+
children: [
|
|
1062
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1063
|
+
className: "dsht-item-title",
|
|
1064
|
+
children: [
|
|
1065
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1066
|
+
className: "dsht-item-n",
|
|
1067
|
+
children: ["#", n]
|
|
1068
|
+
}),
|
|
1069
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1070
|
+
className: "dsht-item-name",
|
|
1071
|
+
children: title
|
|
1072
|
+
}),
|
|
1073
|
+
status === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1074
|
+
className: "dsht-item-status",
|
|
1075
|
+
children: status
|
|
1076
|
+
})
|
|
1077
|
+
]
|
|
1078
|
+
}),
|
|
1079
|
+
compact === true || decision === void 0 || decision.length === 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1080
|
+
className: "dsht-item-decision",
|
|
1081
|
+
children: [decisionLabel === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: decisionLabel }), decision]
|
|
1082
|
+
}),
|
|
1083
|
+
compact === true || summary === void 0 || summary.length === 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1084
|
+
className: "dsht-item-summary",
|
|
1085
|
+
children: summary
|
|
1086
|
+
}),
|
|
1087
|
+
(files?.length ?? 0) === 0 && branch === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1088
|
+
className: "dsht-chips",
|
|
1089
|
+
children: [branch === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BranchChip, { branch }), files?.map((file) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FileChip, { path: file }, file))]
|
|
1090
|
+
})
|
|
1091
|
+
]
|
|
1092
|
+
}),
|
|
1093
|
+
waiting ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pill, {
|
|
1094
|
+
onClick: onOpen,
|
|
1095
|
+
children: openLabel
|
|
1096
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1097
|
+
className: "dsht-item-chevron",
|
|
1098
|
+
"aria-hidden": "true",
|
|
1099
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChevronIcon, {})
|
|
1100
|
+
})
|
|
1101
|
+
]
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
// src/client/ProposalsDock.tsx
|
|
1105
|
+
function ProposalsDock({ sessionId, useSessionStatus, t }) {
|
|
1106
|
+
const revision = useThreadsRevision();
|
|
1107
|
+
const runningKey = useSessionStatus((statuses) => [...statuses].filter(([, state]) => state.running === true).map(([id]) => id).sort().join(","));
|
|
1108
|
+
const proposals = useHostValue(sessionId === void 0 ? null : "proposals.list", { mainSessionId: sessionId }, [
|
|
1109
|
+
sessionId,
|
|
1110
|
+
runningKey,
|
|
1111
|
+
revision
|
|
1112
|
+
]);
|
|
1113
|
+
const [busy, setBusy] = (0, react.useState)(false);
|
|
1114
|
+
const [error, setError] = (0, react.useState)(null);
|
|
1115
|
+
if (sessionId === void 0 || proposals === void 0 || proposals.length === 0) return null;
|
|
1116
|
+
const pending = proposals.filter((p) => p.state === "pending");
|
|
1117
|
+
const act = async (method, ids) => {
|
|
1118
|
+
setBusy(true);
|
|
1119
|
+
setError(null);
|
|
1120
|
+
try {
|
|
1121
|
+
await callHost(method, {
|
|
1122
|
+
mainSessionId: sessionId,
|
|
1123
|
+
ids
|
|
1124
|
+
});
|
|
1125
|
+
threadsRevision.bump();
|
|
1126
|
+
} catch (failure) {
|
|
1127
|
+
setError(failure instanceof Error ? failure.message : String(failure));
|
|
1128
|
+
} finally {
|
|
1129
|
+
setBusy(false);
|
|
1130
|
+
}
|
|
1131
|
+
};
|
|
1132
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1133
|
+
className: "dsht-card dsht-proposals",
|
|
1134
|
+
children: [
|
|
1135
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardHead, {
|
|
1136
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadsIcon, { size: 14 }),
|
|
1137
|
+
children: t("proposals.title")
|
|
1138
|
+
}),
|
|
1139
|
+
error === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1140
|
+
className: "dsht-error dsht-proposal-error",
|
|
1141
|
+
role: "alert",
|
|
1142
|
+
children: error
|
|
1143
|
+
}),
|
|
1144
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1145
|
+
className: "dsht-proposal-list",
|
|
1146
|
+
children: proposals.map((proposal) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1147
|
+
className: `dsht-proposal${proposal.state === "queued" ? " dsht-proposal-queued" : ""}`,
|
|
1148
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1149
|
+
className: "dsht-proposal-body",
|
|
1150
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1151
|
+
className: "dsht-proposal-title",
|
|
1152
|
+
children: [proposal.title, proposal.worktree ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1153
|
+
className: "dsht-tag",
|
|
1154
|
+
title: t("proposals.worktree"),
|
|
1155
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BranchIcon, {}), t("proposals.worktree")]
|
|
1156
|
+
}) : null]
|
|
1157
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1158
|
+
className: "dsht-proposal-task",
|
|
1159
|
+
children: proposal.state === "queued" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadGlyph, { state: "queued" }), t("proposals.queued")] }) : proposal.task.split("\n", 1)[0]
|
|
1160
|
+
})]
|
|
1161
|
+
}), proposal.state === "pending" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1162
|
+
className: "dsht-proposal-actions",
|
|
1163
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pill, {
|
|
1164
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CloseIcon, {}),
|
|
1165
|
+
label: t("proposals.dismissOne"),
|
|
1166
|
+
disabled: busy,
|
|
1167
|
+
onClick: () => {
|
|
1168
|
+
act("proposals.dismiss", [proposal.id]);
|
|
1169
|
+
}
|
|
1170
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pill, {
|
|
1171
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StartIcon, {}),
|
|
1172
|
+
label: t("proposals.startOne"),
|
|
1173
|
+
disabled: busy,
|
|
1174
|
+
onClick: () => {
|
|
1175
|
+
act("proposals.start", [proposal.id]);
|
|
1176
|
+
}
|
|
1177
|
+
})]
|
|
1178
|
+
}) : null]
|
|
1179
|
+
}, proposal.id))
|
|
1180
|
+
}),
|
|
1181
|
+
pending.length === 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1182
|
+
className: "dsht-card-foot",
|
|
1183
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pill, {
|
|
1184
|
+
disabled: busy,
|
|
1185
|
+
onClick: () => {
|
|
1186
|
+
act("proposals.dismiss", pending.map((p) => p.id));
|
|
1187
|
+
},
|
|
1188
|
+
children: t("proposals.dismiss")
|
|
1189
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pill, {
|
|
1190
|
+
primary: true,
|
|
1191
|
+
disabled: busy,
|
|
1192
|
+
onClick: () => {
|
|
1193
|
+
act("proposals.start", pending.map((p) => p.id));
|
|
1194
|
+
},
|
|
1195
|
+
children: t("proposals.start", { count: pending.length })
|
|
1196
|
+
})]
|
|
1197
|
+
})
|
|
1198
|
+
]
|
|
1199
|
+
});
|
|
1200
|
+
}
|
|
1201
|
+
// src/client/ThreadCards.tsx
|
|
1202
|
+
const STATUS_KEYS = {
|
|
1203
|
+
done: "status.done",
|
|
1204
|
+
blocked: "status.blocked",
|
|
1205
|
+
needs_decision: "status.needsDecision",
|
|
1206
|
+
failed: "status.failed",
|
|
1207
|
+
"no-report": "status.noReport",
|
|
1208
|
+
stopped: "status.stopped"
|
|
1209
|
+
};
|
|
1210
|
+
/** Threads that wait on the user lead a report card. */
|
|
1211
|
+
function waitingFirst(cards) {
|
|
1212
|
+
const waiting = (card) => reportGlyph(card.status) === "waiting" ? 0 : 1;
|
|
1213
|
+
return [...cards].sort((a, b) => waiting(a) - waiting(b));
|
|
1214
|
+
}
|
|
1215
|
+
/** conversation.chat.node renderer for NOTICE_NODE. */
|
|
1216
|
+
function NoticeCard({ node, sessionId, useSessionStatus, t, openThread }) {
|
|
1217
|
+
const { role, threads, summary, text } = node.data;
|
|
1218
|
+
const [expanded, setExpanded] = (0, react.useState)(false);
|
|
1219
|
+
if (role === "report" && threads.length > 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReportCard, {
|
|
1220
|
+
cards: threads,
|
|
1221
|
+
sessionId,
|
|
1222
|
+
useSessionStatus,
|
|
1223
|
+
t,
|
|
1224
|
+
openThread
|
|
1225
|
+
});
|
|
1226
|
+
const card = threads[0];
|
|
1227
|
+
const heading = role === "brief" ? t("notice.brief") : role === "reply" ? t("notice.reply") : role === "reminder" ? t("notice.reminder") : summary;
|
|
1228
|
+
const body = text.split("\n").filter((line, index) => !(index === 0 && line.startsWith("["))).join("\n").trim();
|
|
1229
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1230
|
+
className: "dsht-card dsht-brief",
|
|
1231
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(CardHead, {
|
|
1232
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadsIcon, { size: 14 }),
|
|
1233
|
+
trailing: card?.branch === void 0 ? void 0 : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1234
|
+
className: "dsht-mono",
|
|
1235
|
+
children: card.branch
|
|
1236
|
+
}),
|
|
1237
|
+
children: [heading, card === void 0 ? "" : ` · #${card.n} ${card.title}`]
|
|
1238
|
+
}), body.length === 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1239
|
+
type: "button",
|
|
1240
|
+
className: `dsht-brief-text${expanded ? "" : " dsht-clamped"}`,
|
|
1241
|
+
"aria-expanded": expanded,
|
|
1242
|
+
onClick: () => setExpanded(!expanded),
|
|
1243
|
+
children: body
|
|
1244
|
+
})]
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* A report as delivered (its summary, files and branch), with each thread's current state, as
|
|
1249
|
+
* Claude's cards stay live: a thread resolved since then no longer shows a raised hand.
|
|
1250
|
+
*/
|
|
1251
|
+
function ReportCard({ cards, sessionId, useSessionStatus, t, openThread }) {
|
|
1252
|
+
const revision = useThreadsRevision();
|
|
1253
|
+
const live = useLive(useSessionStatus);
|
|
1254
|
+
const threads = useHostValue("threads.list", { mainSessionId: sessionId }, [
|
|
1255
|
+
sessionId,
|
|
1256
|
+
live.key,
|
|
1257
|
+
revision
|
|
1258
|
+
]);
|
|
1259
|
+
const byId = new Map((threads ?? []).map((thread) => [thread.id, thread]));
|
|
1260
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1261
|
+
className: "dsht-card",
|
|
1262
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardHead, {
|
|
1263
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadsIcon, { size: 14 }),
|
|
1264
|
+
children: t("notice.report", { count: cards.length })
|
|
1265
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1266
|
+
className: "dsht-items",
|
|
1267
|
+
children: waitingFirst(cards).map((card) => {
|
|
1268
|
+
const thread = byId.get(card.threadId);
|
|
1269
|
+
const state = thread === void 0 ? reportGlyph(card.status) : glyphState(thread, live.running.has(card.threadId), live.asking.has(card.threadId));
|
|
1270
|
+
const status = state === "running" ? t("status.running") : state === "resolved" ? t("list.resolved") : t(STATUS_KEYS[thread?.stopped === true ? "stopped" : thread?.lastReport?.status ?? card.status ?? "no-report"] ?? "status.noReport");
|
|
1271
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadItem, {
|
|
1272
|
+
n: card.n,
|
|
1273
|
+
title: card.title,
|
|
1274
|
+
state,
|
|
1275
|
+
status,
|
|
1276
|
+
summary: card.summary,
|
|
1277
|
+
decision: state === "waiting" ? card.decision : void 0,
|
|
1278
|
+
decisionLabel: t("card.decision"),
|
|
1279
|
+
files: card.files,
|
|
1280
|
+
branch: card.branch,
|
|
1281
|
+
openLabel: t("card.open"),
|
|
1282
|
+
onOpen: () => openThread(card.threadId)
|
|
1283
|
+
}, card.threadId);
|
|
1284
|
+
})
|
|
1285
|
+
})]
|
|
1286
|
+
});
|
|
1287
|
+
}
|
|
1288
|
+
/** One thread a turn or a command opened, with its live state; the report card carries the details. */
|
|
1289
|
+
function OpenedItem({ card, thread, live, t, openThread }) {
|
|
1290
|
+
const state = thread === void 0 ? "running" : glyphState(thread, live.running.has(card.threadId), live.asking.has(card.threadId));
|
|
1291
|
+
const report = thread?.lastReport ?? null;
|
|
1292
|
+
const status = state === "running" ? t("status.running") : state === "resolved" ? t("list.resolved") : thread?.stopped === true ? t("status.stopped") : report === null ? void 0 : t(STATUS_KEYS[report.status] ?? "status.noReport");
|
|
1293
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadItem, {
|
|
1294
|
+
compact: true,
|
|
1295
|
+
n: card.n,
|
|
1296
|
+
title: card.title,
|
|
1297
|
+
state,
|
|
1298
|
+
status,
|
|
1299
|
+
files: state === "running" ? void 0 : report?.changedFiles.slice(0, 2),
|
|
1300
|
+
branch: thread?.worktree?.branch ?? card.branch,
|
|
1301
|
+
openLabel: t("card.open"),
|
|
1302
|
+
onOpen: () => openThread(card.threadId)
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
/** conversation.chat.turnTail entry: the threads this turn opened ("↳ N 条回复"), with live state. */
|
|
1306
|
+
function TurnThreadsCard({ turn, sessionId, useSessionStatus, t, openThread }) {
|
|
1307
|
+
const opened = turn.data.get("dsh-threads-opened")?.opened ?? [];
|
|
1308
|
+
const revision = useThreadsRevision();
|
|
1309
|
+
const live = useLive(useSessionStatus);
|
|
1310
|
+
const threads = useHostValue(opened.length === 0 ? null : "threads.list", { mainSessionId: sessionId }, [
|
|
1311
|
+
sessionId,
|
|
1312
|
+
live.key,
|
|
1313
|
+
revision
|
|
1314
|
+
]);
|
|
1315
|
+
if (opened.length === 0) return null;
|
|
1316
|
+
const byId = new Map((threads ?? []).map((thread) => [thread.id, thread]));
|
|
1317
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1318
|
+
className: "dsht-card dsht-replies",
|
|
1319
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardHead, {
|
|
1320
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RepliesIcon, {}),
|
|
1321
|
+
children: t("card.replies", { count: opened.length })
|
|
1322
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1323
|
+
className: "dsht-items",
|
|
1324
|
+
children: opened.map((card) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OpenedItem, {
|
|
1325
|
+
card,
|
|
1326
|
+
thread: byId.get(card.threadId),
|
|
1327
|
+
live,
|
|
1328
|
+
t,
|
|
1329
|
+
openThread
|
|
1330
|
+
}, card.threadId))
|
|
1331
|
+
})]
|
|
1332
|
+
});
|
|
1333
|
+
}
|
|
1334
|
+
/** conversation.chat.node renderer for COMMAND_NODE: the thread a `/thread <task>` command opened. */
|
|
1335
|
+
function CommandThreadCard({ node, sessionId, useSessionStatus, t, openThread }) {
|
|
1336
|
+
const revision = useThreadsRevision();
|
|
1337
|
+
const live = useLive(useSessionStatus);
|
|
1338
|
+
const thread = useHostValue("threads.list", { mainSessionId: sessionId }, [
|
|
1339
|
+
sessionId,
|
|
1340
|
+
live.key,
|
|
1341
|
+
revision
|
|
1342
|
+
])?.find((candidate) => candidate.n === node.data.n);
|
|
1343
|
+
if (thread === void 0) return null;
|
|
1344
|
+
const card = {
|
|
1345
|
+
threadId: thread.id,
|
|
1346
|
+
n: thread.n,
|
|
1347
|
+
title: thread.title
|
|
1348
|
+
};
|
|
1349
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1350
|
+
className: "dsht-card dsht-replies",
|
|
1351
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1352
|
+
className: "dsht-items",
|
|
1353
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OpenedItem, {
|
|
1354
|
+
card,
|
|
1355
|
+
thread,
|
|
1356
|
+
live,
|
|
1357
|
+
t,
|
|
1358
|
+
openThread
|
|
1359
|
+
})
|
|
1360
|
+
})
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
// src/client/locale.ts
|
|
1364
|
+
/** Locale namespace for every string this plugin shows. */
|
|
1365
|
+
const NS = "dshThreads";
|
|
1366
|
+
const zh = {
|
|
1367
|
+
"panel": "项目",
|
|
1368
|
+
"page.title": "项目",
|
|
1369
|
+
"page.new": "新建项目",
|
|
1370
|
+
"page.newFrom": "用已有工作区新建",
|
|
1371
|
+
"page.search": "搜索项目…",
|
|
1372
|
+
"page.sortBy": "排序方式",
|
|
1373
|
+
"page.sort.activity": "最近活动",
|
|
1374
|
+
"page.sort.created": "创建时间",
|
|
1375
|
+
"page.sort.title": "名称",
|
|
1376
|
+
"page.empty": "还没有项目。一个项目 = 一个文件夹 + 一个主对话,主对话可以把任务派给讨论串。点\"新建项目\",或者在左侧会话的\"…\"菜单里选\"设为项目\"。",
|
|
1377
|
+
"page.noMatch": "没有匹配的项目。",
|
|
1378
|
+
"page.loadFailed": "读取项目失败:{error}",
|
|
1379
|
+
"page.retry": "重试",
|
|
1380
|
+
"page.archived": "已归档 · {count}",
|
|
1381
|
+
"card.threads": "{count} 个讨论串",
|
|
1382
|
+
"card.running": "{count} 个运行中",
|
|
1383
|
+
"menu.more": "更多操作",
|
|
1384
|
+
"menu.pin": "置顶",
|
|
1385
|
+
"menu.unpin": "取消置顶",
|
|
1386
|
+
"menu.notify": "通知",
|
|
1387
|
+
"menu.settings": "设置",
|
|
1388
|
+
"menu.archive": "归档",
|
|
1389
|
+
"menu.unarchive": "取消归档",
|
|
1390
|
+
"menu.delete": "删除",
|
|
1391
|
+
"notify.all": "所有新消息",
|
|
1392
|
+
"notify.all.hint": "包含每个讨论串的回报",
|
|
1393
|
+
"notify.all.short": "全部",
|
|
1394
|
+
"notify.attention": "主对话与需要你处理的",
|
|
1395
|
+
"notify.attention.hint": "主对话的回复,以及等你决定的讨论串",
|
|
1396
|
+
"notify.attention.short": "主对话",
|
|
1397
|
+
"notify.waiting": "仅需要你处理的",
|
|
1398
|
+
"notify.waiting.hint": "只在讨论串等你决定时",
|
|
1399
|
+
"notify.waiting.short": "需处理",
|
|
1400
|
+
"notify.none": "无",
|
|
1401
|
+
"notify.none.hint": "不发通知",
|
|
1402
|
+
"notify.none.short": "关",
|
|
1403
|
+
"delete.title": "删除项目「{title}」?",
|
|
1404
|
+
"delete.description": "只删除项目记录。主对话和讨论串会保留为普通会话。",
|
|
1405
|
+
"delete.confirm": "删除",
|
|
1406
|
+
"common.cancel": "取消",
|
|
1407
|
+
"common.close": "关闭",
|
|
1408
|
+
"new.title": "新建项目",
|
|
1409
|
+
"new.name": "名称",
|
|
1410
|
+
"new.namePlaceholder": "例如:Vetoarc",
|
|
1411
|
+
"new.folder": "文件夹",
|
|
1412
|
+
"new.recent": "最近的文件夹",
|
|
1413
|
+
"new.chooseFolder": "选择文件夹…",
|
|
1414
|
+
"new.change": "更改",
|
|
1415
|
+
"new.pathPlaceholder": "/Users/me/code/app",
|
|
1416
|
+
"new.pathHint": "写文件夹的完整路径;还不是工作区的话会自动添加。",
|
|
1417
|
+
"new.pathOnly": "这里打不开文件夹选择器:直接写完整路径,或从「最近的文件夹」里选。",
|
|
1418
|
+
"new.create": "新建项目",
|
|
1419
|
+
"new.failed": "创建失败:{error}",
|
|
1420
|
+
"new.pickFailed": "没能打开文件夹选择器:{error}",
|
|
1421
|
+
"settings.title": "项目设置",
|
|
1422
|
+
"settings.general": "通用",
|
|
1423
|
+
"settings.memory": "记忆",
|
|
1424
|
+
"settings.nameIcon": "名称和图标",
|
|
1425
|
+
"settings.chooseIcon": "选择图标",
|
|
1426
|
+
"settings.goal": "目标",
|
|
1427
|
+
"settings.goalHint": "你希望协调者努力实现的结果。只加进主对话的系统提示。",
|
|
1428
|
+
"settings.goalPlaceholder": "例如:把整个 API 的 p95 延迟降到 200 毫秒以内",
|
|
1429
|
+
"settings.folder": "文件夹",
|
|
1430
|
+
"settings.folderHint": "主对话和讨论串都在这个文件夹里工作。",
|
|
1431
|
+
"settings.instructions": "项目说明",
|
|
1432
|
+
"settings.instructionsHint": "会加进主对话和所有讨论串的系统提示,例如代码规范、回复语言、要避开的目录。",
|
|
1433
|
+
"settings.instructionsPlaceholder": "例如:用中文回复;不要改 vendor/ 下的文件;提交信息用 Conventional Commits。",
|
|
1434
|
+
"settings.saveFailed": "保存失败:{error}",
|
|
1435
|
+
"settings.closeAgain": "再关一次会放弃还没保存的修改。",
|
|
1436
|
+
"settings.usage": "使用情况",
|
|
1437
|
+
"settings.models": "模型",
|
|
1438
|
+
"settings.mainModel": "协调器模型",
|
|
1439
|
+
"settings.mainModelHint": "主对话用的模型,负责管理和开讨论串。",
|
|
1440
|
+
"settings.mainEffort": "协调器思考强度",
|
|
1441
|
+
"settings.mainEffortHint": "主对话管理和开讨论串时的思考强度。",
|
|
1442
|
+
"settings.threadModel": "讨论串模型",
|
|
1443
|
+
"settings.threadModelHint": "新讨论串默认用的模型。",
|
|
1444
|
+
"settings.threadEffort": "讨论串思考强度",
|
|
1445
|
+
"settings.threadEffortHint": "新讨论串默认的思考强度。",
|
|
1446
|
+
"settings.default": "默认({name})",
|
|
1447
|
+
"settings.loadingModels": "读取模型…",
|
|
1448
|
+
"usage.hint": "主对话和每个讨论串用掉的 token,来自 DSH 的用量统计(不含费用)。输入包括缓存读写。",
|
|
1449
|
+
"usage.loading": "正在统计…",
|
|
1450
|
+
"usage.session": "会话",
|
|
1451
|
+
"usage.input": "输入",
|
|
1452
|
+
"usage.output": "输出",
|
|
1453
|
+
"usage.main": "主对话",
|
|
1454
|
+
"notifyMsg.main": "主对话回复了:{text}",
|
|
1455
|
+
"notifyMsg.waiting": "等你决定:{text}",
|
|
1456
|
+
"notifyMsg.finished": "{status}:{text}",
|
|
1457
|
+
"menu.makeProject": "设为项目",
|
|
1458
|
+
"time.justNow": "刚刚",
|
|
1459
|
+
"time.minutes": "{count} 分钟前",
|
|
1460
|
+
"time.hours": "{count} 小时前",
|
|
1461
|
+
"time.days": "{count} 天前",
|
|
1462
|
+
"tab.title": "讨论串",
|
|
1463
|
+
"tab.description": "主对话开出的讨论串",
|
|
1464
|
+
"tab.thread": "讨论串",
|
|
1465
|
+
"pane.resolve": "标记已解决",
|
|
1466
|
+
"pane.reopen": "重新打开",
|
|
1467
|
+
"pane.openMain": "在主区域打开",
|
|
1468
|
+
"pane.stop": "停止",
|
|
1469
|
+
"pane.archive": "归档",
|
|
1470
|
+
"pane.unarchive": "取消归档",
|
|
1471
|
+
"pane.archived": "已归档",
|
|
1472
|
+
"list.title": "讨论串",
|
|
1473
|
+
"list.search": "搜索讨论串",
|
|
1474
|
+
"list.noMatch": "没有匹配的讨论串。",
|
|
1475
|
+
"list.waiting": "等待您处理",
|
|
1476
|
+
"list.waitingEmpty": "决策、审阅和权限请求。",
|
|
1477
|
+
"list.running": "运行中",
|
|
1478
|
+
"list.idle": "空闲",
|
|
1479
|
+
"list.resolvedSection": "已解决",
|
|
1480
|
+
"list.resolvedEmpty": "已完成的讨论串。",
|
|
1481
|
+
"list.archivedSection": "已归档",
|
|
1482
|
+
"list.files": "改动了 {count} 个文件",
|
|
1483
|
+
"ask.approval": "等你批准一项操作",
|
|
1484
|
+
"ask.question": "等你回答一个问题",
|
|
1485
|
+
"ask.planReview": "等你确认计划",
|
|
1486
|
+
"list.notProject": "当前对话不是项目,没有讨论串。可以在左侧会话的\"…\"菜单里选\"设为项目\"。",
|
|
1487
|
+
"list.resolved": "已解决",
|
|
1488
|
+
"header.threads": "讨论串 · {count}",
|
|
1489
|
+
"header.running": "{count} 个运行中",
|
|
1490
|
+
"header.waiting": "{count} 个等你回复",
|
|
1491
|
+
"header.backToMain": "回到主对话",
|
|
1492
|
+
"resolved.notice": "此讨论串已解决。",
|
|
1493
|
+
"resolved.hint": "请重新打开以发送更多消息。",
|
|
1494
|
+
"resolved.reopen": "重新打开",
|
|
1495
|
+
"card.open": "查看讨论串",
|
|
1496
|
+
"card.replies": "{count} 条回复",
|
|
1497
|
+
"card.decision": "等你决定:",
|
|
1498
|
+
"notice.report": "讨论串回报 · {count}",
|
|
1499
|
+
"notice.brief": "来自主对话的任务",
|
|
1500
|
+
"notice.reply": "主对话追加的指令",
|
|
1501
|
+
"notice.reminder": "提醒回报",
|
|
1502
|
+
"status.done": "已完成",
|
|
1503
|
+
"status.blocked": "受阻",
|
|
1504
|
+
"status.needsDecision": "待你决定",
|
|
1505
|
+
"status.failed": "失败",
|
|
1506
|
+
"status.noReport": "没有回报",
|
|
1507
|
+
"status.running": "运行中",
|
|
1508
|
+
"status.stopped": "已停止",
|
|
1509
|
+
"proposals.title": "建议的讨论串",
|
|
1510
|
+
"proposals.start": "开始 {count} 个讨论串",
|
|
1511
|
+
"proposals.dismiss": "都不要",
|
|
1512
|
+
"proposals.queued": "排队中 · 有讨论串结束后自动开始",
|
|
1513
|
+
"proposals.startOne": "开始这个讨论串",
|
|
1514
|
+
"proposals.dismissOne": "不要这个",
|
|
1515
|
+
"proposals.worktree": "独立 worktree",
|
|
1516
|
+
"badge.waiting": "{count} 个讨论串在等你回复",
|
|
1517
|
+
"badge.running": "{count} 个讨论串运行中",
|
|
1518
|
+
"side.title": "项目",
|
|
1519
|
+
"side.more": "展开其余 {count} 个",
|
|
1520
|
+
"side.less": "收起",
|
|
1521
|
+
"side.empty": "新建一个项目",
|
|
1522
|
+
"side.mainRunning": "主对话运行中"
|
|
1523
|
+
};
|
|
1524
|
+
const en = {
|
|
1525
|
+
"panel": "Projects",
|
|
1526
|
+
"page.title": "Projects",
|
|
1527
|
+
"page.new": "New project",
|
|
1528
|
+
"page.newFrom": "New from a workspace",
|
|
1529
|
+
"page.search": "Search projects…",
|
|
1530
|
+
"page.sortBy": "Sort by",
|
|
1531
|
+
"page.sort.activity": "Recent activity",
|
|
1532
|
+
"page.sort.created": "Date created",
|
|
1533
|
+
"page.sort.title": "Name",
|
|
1534
|
+
"page.empty": "No projects yet. A project is one folder and one main conversation that can hand tasks to threads. Choose \"New project\", or \"Make project\" in a conversation's \"…\" menu.",
|
|
1535
|
+
"page.noMatch": "No matching projects.",
|
|
1536
|
+
"page.loadFailed": "Could not load projects: {error}",
|
|
1537
|
+
"page.retry": "Retry",
|
|
1538
|
+
"page.archived": "Archived · {count}",
|
|
1539
|
+
"card.threads": "{count} threads",
|
|
1540
|
+
"card.running": "{count} running",
|
|
1541
|
+
"menu.more": "More actions",
|
|
1542
|
+
"menu.pin": "Pin",
|
|
1543
|
+
"menu.unpin": "Unpin",
|
|
1544
|
+
"menu.notify": "Notifications",
|
|
1545
|
+
"menu.settings": "Settings",
|
|
1546
|
+
"menu.archive": "Archive",
|
|
1547
|
+
"menu.unarchive": "Unarchive",
|
|
1548
|
+
"menu.delete": "Delete",
|
|
1549
|
+
"notify.all": "All new messages",
|
|
1550
|
+
"notify.all.hint": "Including every thread's report",
|
|
1551
|
+
"notify.all.short": "All",
|
|
1552
|
+
"notify.attention": "Main conversation and what needs you",
|
|
1553
|
+
"notify.attention.hint": "Main conversation replies and threads waiting for you",
|
|
1554
|
+
"notify.attention.short": "Main",
|
|
1555
|
+
"notify.waiting": "Only what needs you",
|
|
1556
|
+
"notify.waiting.hint": "Only when a thread waits for your decision",
|
|
1557
|
+
"notify.waiting.short": "Needs you",
|
|
1558
|
+
"notify.none": "None",
|
|
1559
|
+
"notify.none.hint": "No notifications",
|
|
1560
|
+
"notify.none.short": "Off",
|
|
1561
|
+
"delete.title": "Delete project \"{title}\"?",
|
|
1562
|
+
"delete.description": "Only the project record is deleted. Its main conversation and threads stay as ordinary conversations.",
|
|
1563
|
+
"delete.confirm": "Delete",
|
|
1564
|
+
"common.cancel": "Cancel",
|
|
1565
|
+
"common.close": "Close",
|
|
1566
|
+
"new.title": "New project",
|
|
1567
|
+
"new.name": "Name",
|
|
1568
|
+
"new.namePlaceholder": "e.g. Vetoarc",
|
|
1569
|
+
"new.folder": "Folder",
|
|
1570
|
+
"new.recent": "Recent folders",
|
|
1571
|
+
"new.chooseFolder": "Choose a folder…",
|
|
1572
|
+
"new.change": "Change",
|
|
1573
|
+
"new.pathPlaceholder": "/Users/me/code/app",
|
|
1574
|
+
"new.pathHint": "The folder's full path; it is added as a workspace if it is not one yet.",
|
|
1575
|
+
"new.pathOnly": "No folder picker here: type the full path, or pick one of the recent folders.",
|
|
1576
|
+
"new.create": "Create project",
|
|
1577
|
+
"new.failed": "Could not create the project: {error}",
|
|
1578
|
+
"new.pickFailed": "Could not open the folder picker: {error}",
|
|
1579
|
+
"settings.title": "Project settings",
|
|
1580
|
+
"settings.general": "General",
|
|
1581
|
+
"settings.memory": "Memory",
|
|
1582
|
+
"settings.nameIcon": "Name and icon",
|
|
1583
|
+
"settings.chooseIcon": "Choose an icon",
|
|
1584
|
+
"settings.goal": "Goal",
|
|
1585
|
+
"settings.goalHint": "The outcome you want the coordinator to work towards. Only the main conversation sees it.",
|
|
1586
|
+
"settings.goalPlaceholder": "e.g. Bring the whole API's p95 latency under 200 ms",
|
|
1587
|
+
"settings.folder": "Folder",
|
|
1588
|
+
"settings.folderHint": "The main conversation and its threads work in this folder.",
|
|
1589
|
+
"settings.instructions": "Project instructions",
|
|
1590
|
+
"settings.instructionsHint": "Added to the system prompt of the main conversation and every thread: code style, reply language, folders to leave alone.",
|
|
1591
|
+
"settings.instructionsPlaceholder": "e.g. Reply in English; do not touch vendor/; use Conventional Commits.",
|
|
1592
|
+
"settings.saveFailed": "Could not save: {error}",
|
|
1593
|
+
"settings.closeAgain": "Close again to leave without saving.",
|
|
1594
|
+
"settings.usage": "Usage",
|
|
1595
|
+
"settings.models": "Models",
|
|
1596
|
+
"settings.mainModel": "Coordinator model",
|
|
1597
|
+
"settings.mainModelHint": "The model of the main conversation, which manages and opens threads.",
|
|
1598
|
+
"settings.mainEffort": "Coordinator thinking",
|
|
1599
|
+
"settings.mainEffortHint": "How hard the main conversation thinks while managing threads.",
|
|
1600
|
+
"settings.threadModel": "Thread model",
|
|
1601
|
+
"settings.threadModelHint": "The default model of new threads.",
|
|
1602
|
+
"settings.threadEffort": "Thread thinking",
|
|
1603
|
+
"settings.threadEffortHint": "The default thinking strength of new threads.",
|
|
1604
|
+
"settings.default": "Default ({name})",
|
|
1605
|
+
"settings.loadingModels": "Loading models…",
|
|
1606
|
+
"usage.hint": "Tokens used by the main conversation and each thread, from DSH's usage counters (no cost). Input includes cache reads and writes.",
|
|
1607
|
+
"usage.loading": "Counting…",
|
|
1608
|
+
"usage.session": "Conversation",
|
|
1609
|
+
"usage.input": "Input",
|
|
1610
|
+
"usage.output": "Output",
|
|
1611
|
+
"usage.main": "Main conversation",
|
|
1612
|
+
"notifyMsg.main": "Main conversation replied: {text}",
|
|
1613
|
+
"notifyMsg.waiting": "Waiting for you: {text}",
|
|
1614
|
+
"notifyMsg.finished": "{status}: {text}",
|
|
1615
|
+
"menu.makeProject": "Make project",
|
|
1616
|
+
"time.justNow": "just now",
|
|
1617
|
+
"time.minutes": "{count} min ago",
|
|
1618
|
+
"time.hours": "{count} h ago",
|
|
1619
|
+
"time.days": "{count} d ago",
|
|
1620
|
+
"tab.title": "Threads",
|
|
1621
|
+
"tab.description": "Threads opened by the main conversation",
|
|
1622
|
+
"tab.thread": "Thread",
|
|
1623
|
+
"pane.resolve": "Mark resolved",
|
|
1624
|
+
"pane.reopen": "Reopen",
|
|
1625
|
+
"pane.openMain": "Open in main view",
|
|
1626
|
+
"pane.stop": "Stop",
|
|
1627
|
+
"pane.archive": "Archive",
|
|
1628
|
+
"pane.unarchive": "Unarchive",
|
|
1629
|
+
"pane.archived": "Archived",
|
|
1630
|
+
"list.title": "Threads",
|
|
1631
|
+
"list.search": "Search threads",
|
|
1632
|
+
"list.noMatch": "No matching threads.",
|
|
1633
|
+
"list.waiting": "Waiting for you",
|
|
1634
|
+
"list.waitingEmpty": "Decisions, reviews and permission requests.",
|
|
1635
|
+
"list.running": "Running",
|
|
1636
|
+
"list.idle": "Idle",
|
|
1637
|
+
"list.resolvedSection": "Resolved",
|
|
1638
|
+
"list.resolvedEmpty": "Finished threads.",
|
|
1639
|
+
"list.archivedSection": "Archived",
|
|
1640
|
+
"list.files": "{count} files changed",
|
|
1641
|
+
"ask.approval": "Waiting for your approval",
|
|
1642
|
+
"ask.question": "Waiting for your answer",
|
|
1643
|
+
"ask.planReview": "Waiting for you to review a plan",
|
|
1644
|
+
"list.notProject": "This conversation is not a project, so it has no threads. Choose \"Make project\" in its \"…\" menu.",
|
|
1645
|
+
"list.resolved": "resolved",
|
|
1646
|
+
"header.threads": "Threads · {count}",
|
|
1647
|
+
"header.running": "{count} running",
|
|
1648
|
+
"header.waiting": "{count} waiting for you",
|
|
1649
|
+
"header.backToMain": "Back to main conversation",
|
|
1650
|
+
"resolved.notice": "This thread is resolved. ",
|
|
1651
|
+
"resolved.hint": "Reopen it to send more messages.",
|
|
1652
|
+
"resolved.reopen": "Reopen",
|
|
1653
|
+
"card.open": "Open thread",
|
|
1654
|
+
"card.replies": "{count} replies",
|
|
1655
|
+
"card.decision": "Waiting for you: ",
|
|
1656
|
+
"notice.report": "Thread reports · {count}",
|
|
1657
|
+
"notice.brief": "Task from the main conversation",
|
|
1658
|
+
"notice.reply": "Follow-up from the main conversation",
|
|
1659
|
+
"notice.reminder": "Report reminder",
|
|
1660
|
+
"status.done": "done",
|
|
1661
|
+
"status.blocked": "blocked",
|
|
1662
|
+
"status.needsDecision": "needs your decision",
|
|
1663
|
+
"status.failed": "failed",
|
|
1664
|
+
"status.noReport": "no report",
|
|
1665
|
+
"status.running": "running",
|
|
1666
|
+
"status.stopped": "stopped",
|
|
1667
|
+
"proposals.title": "Suggested threads",
|
|
1668
|
+
"proposals.start": "Start {count} threads",
|
|
1669
|
+
"proposals.dismiss": "Dismiss all",
|
|
1670
|
+
"proposals.queued": "Queued · starts when a running thread finishes",
|
|
1671
|
+
"proposals.startOne": "Start this thread",
|
|
1672
|
+
"proposals.dismissOne": "Dismiss",
|
|
1673
|
+
"proposals.worktree": "Own worktree",
|
|
1674
|
+
"badge.waiting": "{count} thread(s) waiting for you",
|
|
1675
|
+
"badge.running": "{count} thread(s) running",
|
|
1676
|
+
"side.title": "Projects",
|
|
1677
|
+
"side.more": "Show {count} more",
|
|
1678
|
+
"side.less": "Show less",
|
|
1679
|
+
"side.empty": "Create a project",
|
|
1680
|
+
"side.mainRunning": "Main conversation running"
|
|
1681
|
+
};
|
|
1682
|
+
/** Relative time like "3 天前", from an ISO timestamp. */
|
|
1683
|
+
function relativeTime(t, iso, now = Date.now()) {
|
|
1684
|
+
const minutes = Math.floor((now - Date.parse(iso)) / 6e4);
|
|
1685
|
+
if (!Number.isFinite(minutes) || minutes < 1) return t("time.justNow");
|
|
1686
|
+
if (minutes < 60) return t("time.minutes", { count: minutes });
|
|
1687
|
+
const hours = Math.floor(minutes / 60);
|
|
1688
|
+
if (hours < 24) return t("time.hours", { count: hours });
|
|
1689
|
+
return t("time.days", { count: Math.floor(hours / 24) });
|
|
1690
|
+
}
|
|
1691
|
+
// src/client/MakeProjectMenuItem.tsx
|
|
1692
|
+
/** "设为项目" in a session's "…" menu; hidden for threads and sessions that already are projects. */
|
|
1693
|
+
function MakeProjectMenuItem({ sessionId, displayTitle, useMenuOpenState, t, showProjects }) {
|
|
1694
|
+
const [, setMenuOpen] = useMenuOpenState();
|
|
1695
|
+
const [eligible, setEligible] = (0, react.useState)(false);
|
|
1696
|
+
const [error, setError] = (0, react.useState)(null);
|
|
1697
|
+
const [busy, setBusy] = (0, react.useState)(false);
|
|
1698
|
+
(0, react.useEffect)(() => {
|
|
1699
|
+
let live = true;
|
|
1700
|
+
callHost("sessions.role", { id: sessionId }).then((role) => {
|
|
1701
|
+
if (live) setEligible(role.project === null && !role.thread);
|
|
1702
|
+
}, () => {
|
|
1703
|
+
if (live) setEligible(false);
|
|
1704
|
+
});
|
|
1705
|
+
return () => {
|
|
1706
|
+
live = false;
|
|
1707
|
+
};
|
|
1708
|
+
}, [sessionId]);
|
|
1709
|
+
if (!eligible) return null;
|
|
1710
|
+
const run = () => {
|
|
1711
|
+
if (busy) return;
|
|
1712
|
+
setBusy(true);
|
|
1713
|
+
setError(null);
|
|
1714
|
+
callHost("projects.create", {
|
|
1715
|
+
title: displayTitle,
|
|
1716
|
+
fromSessionId: sessionId
|
|
1717
|
+
}).then(() => {
|
|
1718
|
+
threadsRevision.bump();
|
|
1719
|
+
return refreshProjects();
|
|
1720
|
+
}).then(() => {
|
|
1721
|
+
setMenuOpen(false);
|
|
1722
|
+
showProjects();
|
|
1723
|
+
}).catch((failure) => setError(failure instanceof Error ? failure.message : String(failure))).finally(() => setBusy(false));
|
|
1724
|
+
};
|
|
1725
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [error === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1726
|
+
className: "dsht-error dsht-menu-message",
|
|
1727
|
+
role: "alert",
|
|
1728
|
+
children: error
|
|
1729
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MenuItemButton, {
|
|
1730
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProjectsIcon, { size: 16 }),
|
|
1731
|
+
disabled: busy,
|
|
1732
|
+
onSelect: run,
|
|
1733
|
+
children: t("menu.makeProject")
|
|
1734
|
+
})] });
|
|
1735
|
+
}
|
|
1736
|
+
// src/client/picker.ts
|
|
1737
|
+
/**
|
|
1738
|
+
* Whether a failed `uiWorkspace.pickDirectory()` means this deployment has no native folder
|
|
1739
|
+
* chooser (Web, where folders are browsed in-page), so the dialog should offer the path field
|
|
1740
|
+
* instead of an error.
|
|
1741
|
+
*
|
|
1742
|
+
* DSH's typed error is `directory-picker/unavailable`. DSH Web 0.2.1-rc.5 answers with a plain
|
|
1743
|
+
* Error instead: `directoryPicker.pick needs the native capability; the composed picker serves
|
|
1744
|
+
* "browse"`. Only these two shapes count: any other failure (a 503 "Service Unavailable", say)
|
|
1745
|
+
* is a real error and must reach the user.
|
|
1746
|
+
*/
|
|
1747
|
+
function pickerUnavailable(failure) {
|
|
1748
|
+
if (String(failure?.code ?? "").includes("unavailable")) return true;
|
|
1749
|
+
const message = failure instanceof Error ? failure.message : String(failure);
|
|
1750
|
+
return /directory-picker\/unavailable|needs the native capability/i.test(message);
|
|
1751
|
+
}
|
|
1752
|
+
// src/client/NewProjectDialog.tsx
|
|
1753
|
+
const basename = (path) => path.split(/[\\/]/).filter((part) => part.length > 0).pop() ?? path;
|
|
1754
|
+
function NewProjectDialog({ open, initialFolder, onClose, onCreated, workspaces, pickFolder, t }) {
|
|
1755
|
+
const [title, setTitle] = (0, react.useState)("");
|
|
1756
|
+
/** The user typed the name; picking a folder no longer overwrites it. */
|
|
1757
|
+
const [named, setNamed] = (0, react.useState)(false);
|
|
1758
|
+
const [folder, setFolder] = (0, react.useState)(null);
|
|
1759
|
+
const [typing, setTyping] = (0, react.useState)(false);
|
|
1760
|
+
/** The folder picker does not exist in this deployment, so the path field is the only way in. */
|
|
1761
|
+
const [typedOnly, setTypedOnly] = (0, react.useState)(false);
|
|
1762
|
+
const [recentOpen, setRecentOpen] = (0, react.useState)(false);
|
|
1763
|
+
const [error, setError] = (0, react.useState)(null);
|
|
1764
|
+
const [busy, setBusy] = (0, react.useState)(false);
|
|
1765
|
+
/** An IME candidate window is open; Enter belongs to it, not to the form. */
|
|
1766
|
+
const composing = (0, react.useRef)(false);
|
|
1767
|
+
/**
|
|
1768
|
+
* Bumped by every opening and by a dismissal while `projects.create` is in flight. A create that
|
|
1769
|
+
* returns to a different generation was abandoned: it neither navigates nor touches the dialog,
|
|
1770
|
+
* even when the dialog has been opened again in the meantime.
|
|
1771
|
+
*/
|
|
1772
|
+
const generation = (0, react.useRef)(0);
|
|
1773
|
+
(0, react.useEffect)(() => {
|
|
1774
|
+
if (!open) return;
|
|
1775
|
+
setFolder(initialFolder ?? null);
|
|
1776
|
+
setTitle(initialFolder === null || initialFolder === void 0 ? "" : basename(initialFolder));
|
|
1777
|
+
setNamed(false);
|
|
1778
|
+
setTyping(false);
|
|
1779
|
+
setTypedOnly(false);
|
|
1780
|
+
setRecentOpen(false);
|
|
1781
|
+
setError(null);
|
|
1782
|
+
setBusy(false);
|
|
1783
|
+
composing.current = false;
|
|
1784
|
+
generation.current += 1;
|
|
1785
|
+
}, [open, initialFolder]);
|
|
1786
|
+
const choose = (path) => {
|
|
1787
|
+
setFolder(path);
|
|
1788
|
+
if (!named) setTitle(basename(path));
|
|
1789
|
+
};
|
|
1790
|
+
const pick = async () => {
|
|
1791
|
+
if (busy) return;
|
|
1792
|
+
setError(null);
|
|
1793
|
+
let picked;
|
|
1794
|
+
try {
|
|
1795
|
+
picked = await pickFolder();
|
|
1796
|
+
} catch (failure) {
|
|
1797
|
+
setError(t("new.pickFailed", { error: failure instanceof Error ? failure.message : String(failure) }));
|
|
1798
|
+
return;
|
|
1799
|
+
}
|
|
1800
|
+
if (picked === "unavailable") {
|
|
1801
|
+
setTypedOnly(true);
|
|
1802
|
+
setTyping(true);
|
|
1803
|
+
} else if (picked !== null) choose(picked);
|
|
1804
|
+
};
|
|
1805
|
+
const folderPath = (folder ?? "").trim();
|
|
1806
|
+
/** A typed folder still names the project after its basename, exactly like a picked one. */
|
|
1807
|
+
const effectiveTitle = title.trim().length > 0 ? title.trim() : named ? "" : basename(folderPath);
|
|
1808
|
+
const ready = folderPath.length > 0 && effectiveTitle.length > 0;
|
|
1809
|
+
const close = () => {
|
|
1810
|
+
if (busy) generation.current += 1;
|
|
1811
|
+
setRecentOpen(false);
|
|
1812
|
+
onClose();
|
|
1813
|
+
};
|
|
1814
|
+
const submit = async () => {
|
|
1815
|
+
if (!ready || busy || composing.current) return;
|
|
1816
|
+
setBusy(true);
|
|
1817
|
+
setError(null);
|
|
1818
|
+
const mine = generation.current;
|
|
1819
|
+
try {
|
|
1820
|
+
const project = await callHost("projects.create", {
|
|
1821
|
+
title: effectiveTitle,
|
|
1822
|
+
folder: folderPath
|
|
1823
|
+
});
|
|
1824
|
+
await refreshProjects();
|
|
1825
|
+
if (generation.current !== mine) return;
|
|
1826
|
+
setBusy(false);
|
|
1827
|
+
setRecentOpen(false);
|
|
1828
|
+
onClose();
|
|
1829
|
+
onCreated(project);
|
|
1830
|
+
} catch (failure) {
|
|
1831
|
+
if (generation.current !== mine) return;
|
|
1832
|
+
setBusy(false);
|
|
1833
|
+
setError(t("new.failed", { error: failure instanceof Error ? failure.message : String(failure) }));
|
|
1834
|
+
}
|
|
1835
|
+
};
|
|
1836
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
|
|
1837
|
+
open,
|
|
1838
|
+
onClose: close,
|
|
1839
|
+
title: t("new.title"),
|
|
1840
|
+
headless: true,
|
|
1841
|
+
className: "dsht-dialog dsht-np",
|
|
1842
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1843
|
+
className: "dsht-np-body",
|
|
1844
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
1845
|
+
className: "dsht-np-form",
|
|
1846
|
+
"aria-busy": busy,
|
|
1847
|
+
onSubmit: (event) => {
|
|
1848
|
+
event.preventDefault();
|
|
1849
|
+
submit();
|
|
1850
|
+
},
|
|
1851
|
+
children: [
|
|
1852
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1853
|
+
className: "dsht-dialog-head",
|
|
1854
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
|
|
1855
|
+
className: "dsht-dialog-title",
|
|
1856
|
+
children: t("new.title")
|
|
1857
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1858
|
+
type: "button",
|
|
1859
|
+
className: "dsht-icon-button",
|
|
1860
|
+
"aria-label": t("common.close"),
|
|
1861
|
+
title: t("common.close"),
|
|
1862
|
+
onClick: close,
|
|
1863
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CloseIcon, {})
|
|
1864
|
+
})]
|
|
1865
|
+
}),
|
|
1866
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
1867
|
+
className: "dsht-np-field",
|
|
1868
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1869
|
+
className: "dsht-np-label",
|
|
1870
|
+
children: t("new.name")
|
|
1871
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1872
|
+
className: "dsht-np-input",
|
|
1873
|
+
value: title,
|
|
1874
|
+
placeholder: t("new.namePlaceholder"),
|
|
1875
|
+
maxLength: 60,
|
|
1876
|
+
"data-modal-autofocus": true,
|
|
1877
|
+
onChange: (event) => {
|
|
1878
|
+
setTitle(event.target.value);
|
|
1879
|
+
setNamed(event.target.value.length > 0);
|
|
1880
|
+
},
|
|
1881
|
+
onCompositionStart: () => {
|
|
1882
|
+
composing.current = true;
|
|
1883
|
+
},
|
|
1884
|
+
onCompositionEnd: () => {
|
|
1885
|
+
composing.current = false;
|
|
1886
|
+
}
|
|
1887
|
+
})]
|
|
1888
|
+
}),
|
|
1889
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1890
|
+
className: "dsht-np-field",
|
|
1891
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1892
|
+
className: "dsht-np-label-row",
|
|
1893
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1894
|
+
className: "dsht-np-label",
|
|
1895
|
+
children: t("new.folder")
|
|
1896
|
+
}), workspaces.length === 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
|
|
1897
|
+
open: recentOpen,
|
|
1898
|
+
onClose: () => setRecentOpen(false),
|
|
1899
|
+
align: "end",
|
|
1900
|
+
portal: true,
|
|
1901
|
+
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1902
|
+
type: "button",
|
|
1903
|
+
className: "dsht-np-link",
|
|
1904
|
+
onClick: () => setRecentOpen(!recentOpen),
|
|
1905
|
+
children: [t("new.recent"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { size: 14 })]
|
|
1906
|
+
}),
|
|
1907
|
+
children: workspaces.map((workspace) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MenuItemButton, {
|
|
1908
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FolderIcon, { size: 16 }),
|
|
1909
|
+
onSelect: () => {
|
|
1910
|
+
choose(workspace.path);
|
|
1911
|
+
setTyping(false);
|
|
1912
|
+
setTypedOnly(false);
|
|
1913
|
+
setRecentOpen(false);
|
|
1914
|
+
},
|
|
1915
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1916
|
+
className: "dsht-menu-two",
|
|
1917
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: workspace.title }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1918
|
+
className: "dsht-menu-sub",
|
|
1919
|
+
children: workspace.path
|
|
1920
|
+
})]
|
|
1921
|
+
})
|
|
1922
|
+
}, workspace.workspaceId))
|
|
1923
|
+
})]
|
|
1924
|
+
}), typing ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1925
|
+
className: "dsht-np-input dsht-mono",
|
|
1926
|
+
value: folder ?? "",
|
|
1927
|
+
placeholder: t("new.pathPlaceholder"),
|
|
1928
|
+
spellCheck: false,
|
|
1929
|
+
autoCapitalize: "off",
|
|
1930
|
+
autoCorrect: "off",
|
|
1931
|
+
onChange: (event) => setFolder(event.target.value),
|
|
1932
|
+
onCompositionStart: () => {
|
|
1933
|
+
composing.current = true;
|
|
1934
|
+
},
|
|
1935
|
+
onCompositionEnd: () => {
|
|
1936
|
+
composing.current = false;
|
|
1937
|
+
},
|
|
1938
|
+
onBlur: () => {
|
|
1939
|
+
if (!named && (folder ?? "").trim().length > 0) setTitle(basename(folder ?? ""));
|
|
1940
|
+
}
|
|
1941
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1942
|
+
className: "dsht-hint",
|
|
1943
|
+
children: typedOnly ? t("new.pathOnly") : t("new.pathHint")
|
|
1944
|
+
})] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1945
|
+
type: "button",
|
|
1946
|
+
className: `dsht-np-folder${folder === null ? " dsht-np-folder-empty" : ""}`,
|
|
1947
|
+
onClick: () => {
|
|
1948
|
+
pick();
|
|
1949
|
+
},
|
|
1950
|
+
children: [
|
|
1951
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FolderIcon, { size: 18 }),
|
|
1952
|
+
folder === null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1953
|
+
className: "dsht-np-folder-text",
|
|
1954
|
+
children: t("new.chooseFolder")
|
|
1955
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1956
|
+
className: "dsht-np-folder-text",
|
|
1957
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1958
|
+
className: "dsht-np-folder-name",
|
|
1959
|
+
children: basename(folder)
|
|
1960
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1961
|
+
className: "dsht-np-folder-path",
|
|
1962
|
+
children: folder
|
|
1963
|
+
})]
|
|
1964
|
+
}),
|
|
1965
|
+
folder === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1966
|
+
className: "dsht-np-change",
|
|
1967
|
+
children: t("new.change")
|
|
1968
|
+
})
|
|
1969
|
+
]
|
|
1970
|
+
})]
|
|
1971
|
+
}),
|
|
1972
|
+
error === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1973
|
+
className: "dsht-error",
|
|
1974
|
+
children: error
|
|
1975
|
+
}),
|
|
1976
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1977
|
+
className: "dsht-dialog-actions",
|
|
1978
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
1979
|
+
variant: "ghost",
|
|
1980
|
+
type: "button",
|
|
1981
|
+
onClick: close,
|
|
1982
|
+
children: t("common.cancel")
|
|
1983
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
1984
|
+
variant: "primary",
|
|
1985
|
+
type: "submit",
|
|
1986
|
+
disabled: busy || !ready,
|
|
1987
|
+
children: t("new.create")
|
|
1988
|
+
})]
|
|
1989
|
+
})
|
|
1990
|
+
]
|
|
1991
|
+
})
|
|
1992
|
+
})
|
|
1993
|
+
});
|
|
1994
|
+
}
|
|
1995
|
+
// src/client/closeGate.ts
|
|
1996
|
+
function createCloseGate() {
|
|
1997
|
+
let attempts = 0;
|
|
1998
|
+
let waiting = null;
|
|
1999
|
+
return {
|
|
2000
|
+
request() {
|
|
2001
|
+
if (waiting !== null) {
|
|
2002
|
+
waiting = null;
|
|
2003
|
+
return "leave";
|
|
2004
|
+
}
|
|
2005
|
+
attempts += 1;
|
|
2006
|
+
waiting = attempts;
|
|
2007
|
+
return attempts;
|
|
2008
|
+
},
|
|
2009
|
+
current: (attempt) => waiting === attempt,
|
|
2010
|
+
reset() {
|
|
2011
|
+
waiting = null;
|
|
2012
|
+
}
|
|
2013
|
+
};
|
|
2014
|
+
}
|
|
2015
|
+
// src/client/ProjectModels.tsx
|
|
2016
|
+
const DEFAULT = "default";
|
|
2017
|
+
const key = (provider, model) => `${provider}\u0000${model}`;
|
|
2018
|
+
function findModel(catalog, choice) {
|
|
2019
|
+
if (catalog === void 0) return void 0;
|
|
2020
|
+
const target = choice ?? catalog.default;
|
|
2021
|
+
return catalog.groups.find((group) => group.id === target.provider)?.models.find((model) => model.id === target.model);
|
|
2022
|
+
}
|
|
2023
|
+
/** A menu dressed as a select box, as DSH's own settings do it (there is no Select primitive). */
|
|
2024
|
+
function SelectMenu({ value, label, items, onSelect, disabled }) {
|
|
2025
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
2026
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
|
|
2027
|
+
open,
|
|
2028
|
+
onClose: () => setOpen(false),
|
|
2029
|
+
align: "end",
|
|
2030
|
+
portal: true,
|
|
2031
|
+
selection: "check",
|
|
2032
|
+
selectedId: value,
|
|
2033
|
+
items,
|
|
2034
|
+
onSelect: (id) => {
|
|
2035
|
+
setOpen(false);
|
|
2036
|
+
onSelect(id);
|
|
2037
|
+
},
|
|
2038
|
+
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
2039
|
+
type: "button",
|
|
2040
|
+
className: "dsht-select-box",
|
|
2041
|
+
disabled,
|
|
2042
|
+
"aria-haspopup": "menu",
|
|
2043
|
+
"aria-expanded": open,
|
|
2044
|
+
onClick: () => setOpen(!open),
|
|
2045
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2046
|
+
className: "dsht-select-box-text",
|
|
2047
|
+
children: label
|
|
2048
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { size: 14 })]
|
|
2049
|
+
})
|
|
2050
|
+
});
|
|
2051
|
+
}
|
|
2052
|
+
function ModelPair({ choice, catalog, modelTitle, modelHint, effortTitle, effortHint, onChange, t }) {
|
|
2053
|
+
const defaultModel = findModel(catalog, null);
|
|
2054
|
+
const model = findModel(catalog, choice);
|
|
2055
|
+
const modelItems = [{
|
|
2056
|
+
id: DEFAULT,
|
|
2057
|
+
label: t("settings.default", { name: defaultModel?.name ?? catalog?.default.model ?? "…" })
|
|
2058
|
+
}, ...(catalog?.groups ?? []).flatMap((group) => [
|
|
2059
|
+
{
|
|
2060
|
+
type: "separator",
|
|
2061
|
+
id: `sep:${group.id}`
|
|
2062
|
+
},
|
|
2063
|
+
{
|
|
2064
|
+
type: "label",
|
|
2065
|
+
id: `label:${group.id}`,
|
|
2066
|
+
text: group.name
|
|
2067
|
+
},
|
|
2068
|
+
...group.models.map((item) => ({
|
|
2069
|
+
id: key(group.id, item.id),
|
|
2070
|
+
label: item.name
|
|
2071
|
+
}))
|
|
2072
|
+
])];
|
|
2073
|
+
const modelValue = choice === null ? DEFAULT : key(choice.provider, choice.model);
|
|
2074
|
+
const modelLabel = choice === null ? t("settings.default", { name: defaultModel?.name ?? catalog?.default.model ?? "…" }) : model?.name ?? choice.model;
|
|
2075
|
+
const efforts = model?.reasoning?.efforts ?? [];
|
|
2076
|
+
const effortDefault = efforts.find((effort) => effort.id === (choice === null ? catalog?.default.reasoningEffort : model?.reasoning?.defaultEffort));
|
|
2077
|
+
const effortItems = [{
|
|
2078
|
+
id: DEFAULT,
|
|
2079
|
+
label: t("settings.default", { name: effortDefault?.name ?? "—" })
|
|
2080
|
+
}, ...efforts.map((effort) => ({
|
|
2081
|
+
id: effort.id,
|
|
2082
|
+
label: effort.name
|
|
2083
|
+
}))];
|
|
2084
|
+
const effortValue = choice?.reasoningEffort ?? DEFAULT;
|
|
2085
|
+
const effortLabel = choice?.reasoningEffort === void 0 ? t("settings.default", { name: effortDefault?.name ?? "—" }) : efforts.find((effort) => effort.id === choice.reasoningEffort)?.name ?? choice.reasoningEffort;
|
|
2086
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2087
|
+
className: "dsht-setting-row",
|
|
2088
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2089
|
+
className: "dsht-setting-text",
|
|
2090
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2091
|
+
className: "dsht-setting-title",
|
|
2092
|
+
children: t(modelTitle)
|
|
2093
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2094
|
+
className: "dsht-setting-hint",
|
|
2095
|
+
children: t(modelHint)
|
|
2096
|
+
})]
|
|
2097
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectMenu, {
|
|
2098
|
+
value: modelValue,
|
|
2099
|
+
label: catalog === void 0 ? t("settings.loadingModels") : modelLabel,
|
|
2100
|
+
items: modelItems,
|
|
2101
|
+
disabled: catalog === void 0,
|
|
2102
|
+
onSelect: (id) => {
|
|
2103
|
+
if (id === DEFAULT) return onChange(null);
|
|
2104
|
+
const [provider, modelId] = id.split("\0");
|
|
2105
|
+
if (provider !== void 0 && modelId !== void 0) onChange({
|
|
2106
|
+
provider,
|
|
2107
|
+
model: modelId
|
|
2108
|
+
});
|
|
2109
|
+
}
|
|
2110
|
+
})]
|
|
2111
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2112
|
+
className: "dsht-setting-row",
|
|
2113
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2114
|
+
className: "dsht-setting-text",
|
|
2115
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2116
|
+
className: "dsht-setting-title",
|
|
2117
|
+
children: t(effortTitle)
|
|
2118
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2119
|
+
className: "dsht-setting-hint",
|
|
2120
|
+
children: t(effortHint)
|
|
2121
|
+
})]
|
|
2122
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectMenu, {
|
|
2123
|
+
value: effortValue,
|
|
2124
|
+
label: effortLabel,
|
|
2125
|
+
items: effortItems,
|
|
2126
|
+
disabled: catalog === void 0 || choice === null || efforts.length === 0,
|
|
2127
|
+
onSelect: (id) => {
|
|
2128
|
+
if (choice === null) return;
|
|
2129
|
+
const { reasoningEffort: _previous, ...rest } = choice;
|
|
2130
|
+
onChange(id === DEFAULT ? rest : {
|
|
2131
|
+
...rest,
|
|
2132
|
+
reasoningEffort: id
|
|
2133
|
+
});
|
|
2134
|
+
}
|
|
2135
|
+
})]
|
|
2136
|
+
})] });
|
|
2137
|
+
}
|
|
2138
|
+
/** The four model rows; each change saves at once (the coordinator model applies to the main conversation). */
|
|
2139
|
+
function ModelSettings({ project, open, save, t }) {
|
|
2140
|
+
const catalog = useHostValue(open ? "models.catalog" : null, {}, [open]);
|
|
2141
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2142
|
+
className: "dsht-setting-group",
|
|
2143
|
+
children: [
|
|
2144
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2145
|
+
className: "dsht-setting-group-title",
|
|
2146
|
+
children: t("settings.models")
|
|
2147
|
+
}),
|
|
2148
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelPair, {
|
|
2149
|
+
choice: project.mainModel,
|
|
2150
|
+
catalog,
|
|
2151
|
+
t,
|
|
2152
|
+
modelTitle: "settings.mainModel",
|
|
2153
|
+
modelHint: "settings.mainModelHint",
|
|
2154
|
+
effortTitle: "settings.mainEffort",
|
|
2155
|
+
effortHint: "settings.mainEffortHint",
|
|
2156
|
+
onChange: (next) => {
|
|
2157
|
+
save({ mainModel: next });
|
|
2158
|
+
}
|
|
2159
|
+
}),
|
|
2160
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelPair, {
|
|
2161
|
+
choice: project.threadModel,
|
|
2162
|
+
catalog,
|
|
2163
|
+
t,
|
|
2164
|
+
modelTitle: "settings.threadModel",
|
|
2165
|
+
modelHint: "settings.threadModelHint",
|
|
2166
|
+
effortTitle: "settings.threadEffort",
|
|
2167
|
+
effortHint: "settings.threadEffortHint",
|
|
2168
|
+
onChange: (next) => {
|
|
2169
|
+
save({ threadModel: next });
|
|
2170
|
+
}
|
|
2171
|
+
})
|
|
2172
|
+
]
|
|
2173
|
+
});
|
|
2174
|
+
}
|
|
2175
|
+
function tokens(value) {
|
|
2176
|
+
if (value >= 1e6) return `${(value / 1e6).toFixed(value >= 1e7 ? 0 : 1)}M`;
|
|
2177
|
+
if (value >= 1e3) return `${(value / 1e3).toFixed(value >= 1e4 ? 0 : 1)}K`;
|
|
2178
|
+
return String(value);
|
|
2179
|
+
}
|
|
2180
|
+
/** "使用情况": tokens of the main conversation and every thread, read from DSH's usage projections. */
|
|
2181
|
+
function UsageSection({ project, t }) {
|
|
2182
|
+
const usage = useHostValue("projects.usage", { id: project.id }, [project.id]);
|
|
2183
|
+
if (usage === void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2184
|
+
className: "dsht-setting-hint dsht-usage-loading",
|
|
2185
|
+
children: t("usage.loading")
|
|
2186
|
+
});
|
|
2187
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2188
|
+
className: "dsht-setting-block",
|
|
2189
|
+
children: [
|
|
2190
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2191
|
+
className: "dsht-setting-hint",
|
|
2192
|
+
children: t("usage.hint")
|
|
2193
|
+
}),
|
|
2194
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2195
|
+
className: "dsht-usage-total",
|
|
2196
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2197
|
+
className: "dsht-usage-figure",
|
|
2198
|
+
children: tokens(usage.total.input)
|
|
2199
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2200
|
+
className: "dsht-setting-hint",
|
|
2201
|
+
children: t("usage.input")
|
|
2202
|
+
})] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2203
|
+
className: "dsht-usage-figure",
|
|
2204
|
+
children: tokens(usage.total.output)
|
|
2205
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2206
|
+
className: "dsht-setting-hint",
|
|
2207
|
+
children: t("usage.output")
|
|
2208
|
+
})] })]
|
|
2209
|
+
}),
|
|
2210
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("table", {
|
|
2211
|
+
className: "dsht-usage-table",
|
|
2212
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
|
|
2213
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: t("usage.session") }),
|
|
2214
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: t("usage.input") }),
|
|
2215
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: t("usage.output") })
|
|
2216
|
+
] }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { children: usage.rows.map((row) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
|
|
2217
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: row.kind === "main" ? t("usage.main") : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2218
|
+
className: "dsht-item-n",
|
|
2219
|
+
children: ["#", row.n]
|
|
2220
|
+
}), row.title] }) }),
|
|
2221
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: tokens(row.input) }),
|
|
2222
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: tokens(row.output) })
|
|
2223
|
+
] }, row.sessionId)) })]
|
|
2224
|
+
})
|
|
2225
|
+
]
|
|
2226
|
+
});
|
|
2227
|
+
}
|
|
2228
|
+
// src/client/ProjectSettings.tsx
|
|
2229
|
+
const GOAL_MAX = 8e3;
|
|
2230
|
+
const MEMORY_MAX = 4e3;
|
|
2231
|
+
const SECTIONS = [
|
|
2232
|
+
{
|
|
2233
|
+
id: "general",
|
|
2234
|
+
label: "settings.general",
|
|
2235
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSettingsOutlineRegular, { size: 16 })
|
|
2236
|
+
},
|
|
2237
|
+
{
|
|
2238
|
+
id: "memory",
|
|
2239
|
+
label: "settings.memory",
|
|
2240
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProjectIcon, {
|
|
2241
|
+
id: "book",
|
|
2242
|
+
size: 16
|
|
2243
|
+
})
|
|
2244
|
+
},
|
|
2245
|
+
{
|
|
2246
|
+
id: "usage",
|
|
2247
|
+
label: "settings.usage",
|
|
2248
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProjectIcon, {
|
|
2249
|
+
id: "chart",
|
|
2250
|
+
size: 16
|
|
2251
|
+
})
|
|
2252
|
+
}
|
|
2253
|
+
];
|
|
2254
|
+
function ProjectSettings({ project, open, onClose, t }) {
|
|
2255
|
+
const [section, setSection] = (0, react.useState)("general");
|
|
2256
|
+
const [title, setTitle] = (0, react.useState)("");
|
|
2257
|
+
const [goal, setGoal] = (0, react.useState)("");
|
|
2258
|
+
const [memory, setMemory] = (0, react.useState)("");
|
|
2259
|
+
const [picking, setPicking] = (0, react.useState)(false);
|
|
2260
|
+
const [error, setError] = (0, react.useState)(null);
|
|
2261
|
+
/** Decides which close attempt's save may still close the dialog (closeGate.ts). */
|
|
2262
|
+
const [gate] = (0, react.useState)(createCloseGate);
|
|
2263
|
+
(0, react.useEffect)(() => {
|
|
2264
|
+
gate.reset();
|
|
2265
|
+
}, [
|
|
2266
|
+
gate,
|
|
2267
|
+
title,
|
|
2268
|
+
goal,
|
|
2269
|
+
memory
|
|
2270
|
+
]);
|
|
2271
|
+
(0, react.useEffect)(() => {
|
|
2272
|
+
if (!open || project === null) return;
|
|
2273
|
+
gate.reset();
|
|
2274
|
+
setTitle(project.title);
|
|
2275
|
+
setGoal(project.goal);
|
|
2276
|
+
setMemory(project.instructions);
|
|
2277
|
+
setPicking(false);
|
|
2278
|
+
setError(null);
|
|
2279
|
+
}, [open, project?.id]);
|
|
2280
|
+
if (project === null) return null;
|
|
2281
|
+
/** @returns whether everything is saved, so closing can wait for it instead of losing the error. */
|
|
2282
|
+
const save = async (patch) => {
|
|
2283
|
+
if (!Object.entries(patch).some(([key, value]) => JSON.stringify(project[key]) !== JSON.stringify(value))) return true;
|
|
2284
|
+
setError(null);
|
|
2285
|
+
try {
|
|
2286
|
+
await callHost("projects.update", {
|
|
2287
|
+
id: project.id,
|
|
2288
|
+
...patch
|
|
2289
|
+
});
|
|
2290
|
+
await refreshProjects();
|
|
2291
|
+
return true;
|
|
2292
|
+
} catch (failure) {
|
|
2293
|
+
setError(t("settings.saveFailed", { error: failure instanceof Error ? failure.message : String(failure) }));
|
|
2294
|
+
return false;
|
|
2295
|
+
}
|
|
2296
|
+
};
|
|
2297
|
+
const close = () => {
|
|
2298
|
+
const attempt = gate.request();
|
|
2299
|
+
if (attempt === "leave") {
|
|
2300
|
+
onClose();
|
|
2301
|
+
return;
|
|
2302
|
+
}
|
|
2303
|
+
save({
|
|
2304
|
+
title: title.trim().length > 0 ? title : project.title,
|
|
2305
|
+
goal,
|
|
2306
|
+
instructions: memory
|
|
2307
|
+
}).then((saved) => {
|
|
2308
|
+
if (!gate.current(attempt)) return;
|
|
2309
|
+
if (saved) {
|
|
2310
|
+
gate.reset();
|
|
2311
|
+
onClose();
|
|
2312
|
+
} else setError((current) => current === null ? null : `${current} ${t("settings.closeAgain")}`);
|
|
2313
|
+
});
|
|
2314
|
+
};
|
|
2315
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
|
|
2316
|
+
open,
|
|
2317
|
+
onClose: close,
|
|
2318
|
+
title: t("settings.title"),
|
|
2319
|
+
headless: true,
|
|
2320
|
+
className: "dsht-dialog dsht-settings",
|
|
2321
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2322
|
+
className: "dsht-settings-layout",
|
|
2323
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("nav", {
|
|
2324
|
+
className: "dsht-settings-nav",
|
|
2325
|
+
"aria-label": t("settings.title"),
|
|
2326
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2327
|
+
className: "dsht-settings-nav-title",
|
|
2328
|
+
children: t("settings.title")
|
|
2329
|
+
}), SECTIONS.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
2330
|
+
type: "button",
|
|
2331
|
+
className: `dsht-settings-nav-item${section === item.id ? " is-active" : ""}`,
|
|
2332
|
+
"aria-current": section === item.id ? "page" : void 0,
|
|
2333
|
+
onClick: () => setSection(item.id),
|
|
2334
|
+
children: [item.icon, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t(item.label) })]
|
|
2335
|
+
}, item.id))]
|
|
2336
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2337
|
+
className: "dsht-settings-main",
|
|
2338
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2339
|
+
className: "dsht-settings-head",
|
|
2340
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
|
|
2341
|
+
className: "dsht-dialog-title",
|
|
2342
|
+
children: t(SECTIONS.find((item) => item.id === section)?.label ?? "settings.general")
|
|
2343
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2344
|
+
type: "button",
|
|
2345
|
+
className: "dsht-icon-button",
|
|
2346
|
+
"aria-label": t("common.close"),
|
|
2347
|
+
title: t("common.close"),
|
|
2348
|
+
onClick: close,
|
|
2349
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CloseIcon, {})
|
|
2350
|
+
})]
|
|
2351
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2352
|
+
className: "dsht-settings-body",
|
|
2353
|
+
children: [error === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2354
|
+
className: "dsht-error",
|
|
2355
|
+
children: error
|
|
2356
|
+
}), section === "general" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
2357
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2358
|
+
className: "dsht-setting-row",
|
|
2359
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2360
|
+
className: "dsht-setting-text",
|
|
2361
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2362
|
+
className: "dsht-setting-title",
|
|
2363
|
+
children: t("settings.nameIcon")
|
|
2364
|
+
})
|
|
2365
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2366
|
+
className: "dsht-name-field",
|
|
2367
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2368
|
+
type: "button",
|
|
2369
|
+
className: "dsht-icon-pick",
|
|
2370
|
+
"aria-label": t("settings.chooseIcon"),
|
|
2371
|
+
title: t("settings.chooseIcon"),
|
|
2372
|
+
"aria-expanded": picking,
|
|
2373
|
+
onClick: () => setPicking(!picking),
|
|
2374
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProjectIcon, {
|
|
2375
|
+
id: project.icon,
|
|
2376
|
+
size: 18
|
|
2377
|
+
})
|
|
2378
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
2379
|
+
className: "dsht-name-input",
|
|
2380
|
+
value: title,
|
|
2381
|
+
maxLength: 60,
|
|
2382
|
+
onChange: (event) => setTitle(event.target.value),
|
|
2383
|
+
onBlur: () => {
|
|
2384
|
+
if (title.trim().length > 0) save({ title });
|
|
2385
|
+
}
|
|
2386
|
+
})]
|
|
2387
|
+
})]
|
|
2388
|
+
}),
|
|
2389
|
+
picking ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2390
|
+
className: "dsht-icon-grid",
|
|
2391
|
+
role: "listbox",
|
|
2392
|
+
"aria-label": t("settings.chooseIcon"),
|
|
2393
|
+
children: PROJECT_ICON_IDS.map((id) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2394
|
+
type: "button",
|
|
2395
|
+
role: "option",
|
|
2396
|
+
"aria-selected": project.icon === id,
|
|
2397
|
+
className: `dsht-icon-cell${project.icon === id ? " is-active" : ""}`,
|
|
2398
|
+
onClick: () => {
|
|
2399
|
+
save({ icon: id });
|
|
2400
|
+
setPicking(false);
|
|
2401
|
+
},
|
|
2402
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProjectIcon, {
|
|
2403
|
+
id,
|
|
2404
|
+
size: 18
|
|
2405
|
+
})
|
|
2406
|
+
}, id))
|
|
2407
|
+
}) : null,
|
|
2408
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2409
|
+
className: "dsht-setting-block",
|
|
2410
|
+
children: [
|
|
2411
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2412
|
+
className: "dsht-setting-title",
|
|
2413
|
+
children: t("settings.goal")
|
|
2414
|
+
}),
|
|
2415
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2416
|
+
className: "dsht-setting-hint",
|
|
2417
|
+
children: t("settings.goalHint")
|
|
2418
|
+
}),
|
|
2419
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
2420
|
+
className: "dsht-setting-textarea",
|
|
2421
|
+
value: goal,
|
|
2422
|
+
maxLength: GOAL_MAX,
|
|
2423
|
+
placeholder: t("settings.goalPlaceholder"),
|
|
2424
|
+
onChange: (event) => setGoal(event.target.value),
|
|
2425
|
+
onBlur: () => {
|
|
2426
|
+
save({ goal });
|
|
2427
|
+
}
|
|
2428
|
+
}),
|
|
2429
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2430
|
+
className: "dsht-counter",
|
|
2431
|
+
children: [
|
|
2432
|
+
goal.length.toLocaleString(),
|
|
2433
|
+
" / ",
|
|
2434
|
+
GOAL_MAX.toLocaleString()
|
|
2435
|
+
]
|
|
2436
|
+
})
|
|
2437
|
+
]
|
|
2438
|
+
}),
|
|
2439
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelSettings, {
|
|
2440
|
+
project,
|
|
2441
|
+
open,
|
|
2442
|
+
save,
|
|
2443
|
+
t
|
|
2444
|
+
}),
|
|
2445
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2446
|
+
className: "dsht-setting-block",
|
|
2447
|
+
children: [
|
|
2448
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2449
|
+
className: "dsht-setting-title",
|
|
2450
|
+
children: t("settings.folder")
|
|
2451
|
+
}),
|
|
2452
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2453
|
+
className: "dsht-setting-hint",
|
|
2454
|
+
children: t("settings.folderHint")
|
|
2455
|
+
}),
|
|
2456
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2457
|
+
className: "dsht-setting-path dsht-mono",
|
|
2458
|
+
title: project.folder,
|
|
2459
|
+
children: project.folder
|
|
2460
|
+
})
|
|
2461
|
+
]
|
|
2462
|
+
})
|
|
2463
|
+
] }) : section === "usage" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UsageSection, {
|
|
2464
|
+
project,
|
|
2465
|
+
t
|
|
2466
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2467
|
+
className: "dsht-setting-block",
|
|
2468
|
+
children: [
|
|
2469
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2470
|
+
className: "dsht-setting-title",
|
|
2471
|
+
children: t("settings.instructions")
|
|
2472
|
+
}),
|
|
2473
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2474
|
+
className: "dsht-setting-hint",
|
|
2475
|
+
children: t("settings.instructionsHint")
|
|
2476
|
+
}),
|
|
2477
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
2478
|
+
className: "dsht-setting-textarea dsht-setting-textarea-tall",
|
|
2479
|
+
value: memory,
|
|
2480
|
+
maxLength: MEMORY_MAX,
|
|
2481
|
+
placeholder: t("settings.instructionsPlaceholder"),
|
|
2482
|
+
onChange: (event) => setMemory(event.target.value),
|
|
2483
|
+
onBlur: () => {
|
|
2484
|
+
save({ instructions: memory });
|
|
2485
|
+
}
|
|
2486
|
+
}),
|
|
2487
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2488
|
+
className: "dsht-counter",
|
|
2489
|
+
children: [
|
|
2490
|
+
memory.length.toLocaleString(),
|
|
2491
|
+
" / ",
|
|
2492
|
+
MEMORY_MAX.toLocaleString()
|
|
2493
|
+
]
|
|
2494
|
+
})
|
|
2495
|
+
]
|
|
2496
|
+
})]
|
|
2497
|
+
})]
|
|
2498
|
+
})]
|
|
2499
|
+
})
|
|
2500
|
+
});
|
|
2501
|
+
}
|
|
2502
|
+
// src/client/ProjectActions.tsx
|
|
2503
|
+
const NOTIFY_LEVELS = [
|
|
2504
|
+
"all",
|
|
2505
|
+
"attention",
|
|
2506
|
+
"waiting",
|
|
2507
|
+
"none"
|
|
2508
|
+
];
|
|
2509
|
+
/** The actions, plus the dialogs they open (render `dialogs` once next to the menus). */
|
|
2510
|
+
function useProjectActions({ projects, t, pinSession, afterArchive }) {
|
|
2511
|
+
const [settingsId, setSettingsId] = (0, react.useState)(null);
|
|
2512
|
+
const [deleting, setDeleting] = (0, react.useState)(null);
|
|
2513
|
+
const [error, setError] = (0, react.useState)(null);
|
|
2514
|
+
const run = async (action) => {
|
|
2515
|
+
setError(null);
|
|
2516
|
+
try {
|
|
2517
|
+
await action();
|
|
2518
|
+
} catch (failure) {
|
|
2519
|
+
setError(failure instanceof Error ? failure.message : String(failure));
|
|
2520
|
+
} finally {
|
|
2521
|
+
threadsRevision.bump();
|
|
2522
|
+
await refreshProjects();
|
|
2523
|
+
}
|
|
2524
|
+
};
|
|
2525
|
+
const actions = {
|
|
2526
|
+
togglePin: (project) => run(async () => {
|
|
2527
|
+
await callHost("projects.pin", {
|
|
2528
|
+
id: project.id,
|
|
2529
|
+
pinned: !project.pinned
|
|
2530
|
+
});
|
|
2531
|
+
await pinSession(project.mainSessionId, !project.pinned).catch(() => {});
|
|
2532
|
+
}),
|
|
2533
|
+
setNotify: (project, notify) => run(() => callHost("projects.update", {
|
|
2534
|
+
id: project.id,
|
|
2535
|
+
notify
|
|
2536
|
+
})),
|
|
2537
|
+
openSettings: (project) => setSettingsId(project.id),
|
|
2538
|
+
toggleArchive: (project) => run(async () => {
|
|
2539
|
+
await callHost(project.archived ? "projects.unarchive" : "projects.archive", { id: project.id });
|
|
2540
|
+
if (afterArchive !== void 0) setTimeout(afterArchive, 120);
|
|
2541
|
+
}),
|
|
2542
|
+
askDelete: (project) => setDeleting(project)
|
|
2543
|
+
};
|
|
2544
|
+
const remove = (project) => run(async () => {
|
|
2545
|
+
setDeleting(null);
|
|
2546
|
+
await callHost("projects.remove", { id: project.id });
|
|
2547
|
+
if (project.pinned) await pinSession(project.mainSessionId, false).catch(() => {});
|
|
2548
|
+
});
|
|
2549
|
+
return {
|
|
2550
|
+
actions,
|
|
2551
|
+
dialogs: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProjectSettings, {
|
|
2552
|
+
project: projects.find((p) => p.id === settingsId) ?? null,
|
|
2553
|
+
open: settingsId !== null,
|
|
2554
|
+
onClose: () => setSettingsId(null),
|
|
2555
|
+
t
|
|
2556
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
|
|
2557
|
+
open: deleting !== null,
|
|
2558
|
+
onClose: () => setDeleting(null),
|
|
2559
|
+
title: deleting === null ? "" : t("delete.title", { title: deleting.title }),
|
|
2560
|
+
description: t("delete.description"),
|
|
2561
|
+
closeLabel: t("common.close"),
|
|
2562
|
+
footer: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2563
|
+
className: "dsht-buttons",
|
|
2564
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
2565
|
+
variant: "ghost",
|
|
2566
|
+
onClick: () => setDeleting(null),
|
|
2567
|
+
children: t("common.cancel")
|
|
2568
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
2569
|
+
variant: "primary",
|
|
2570
|
+
className: "dsht-danger",
|
|
2571
|
+
onClick: () => {
|
|
2572
|
+
if (deleting !== null) remove(deleting);
|
|
2573
|
+
},
|
|
2574
|
+
children: t("delete.confirm")
|
|
2575
|
+
})]
|
|
2576
|
+
})
|
|
2577
|
+
})] }),
|
|
2578
|
+
error
|
|
2579
|
+
};
|
|
2580
|
+
}
|
|
2581
|
+
const SHORTCUTS = {
|
|
2582
|
+
p: "pin",
|
|
2583
|
+
s: "settings",
|
|
2584
|
+
a: "archive",
|
|
2585
|
+
d: "delete"
|
|
2586
|
+
};
|
|
2587
|
+
/** The "⋮" button and its menu. */
|
|
2588
|
+
function ProjectMenu({ project, actions, t, onOpenChange }) {
|
|
2589
|
+
const [open, setOpenState] = (0, react.useState)(false);
|
|
2590
|
+
const setOpen = (next) => {
|
|
2591
|
+
setOpenState(next);
|
|
2592
|
+
onOpenChange?.(next);
|
|
2593
|
+
};
|
|
2594
|
+
const act = (id) => {
|
|
2595
|
+
setOpen(false);
|
|
2596
|
+
if (id === "pin") actions.togglePin(project);
|
|
2597
|
+
else if (id === "settings") actions.openSettings(project);
|
|
2598
|
+
else if (id === "archive") actions.toggleArchive(project);
|
|
2599
|
+
else if (id === "delete") actions.askDelete(project);
|
|
2600
|
+
else if (id.startsWith("notify:")) actions.setNotify(project, id.slice(7));
|
|
2601
|
+
};
|
|
2602
|
+
(0, react.useEffect)(() => {
|
|
2603
|
+
if (!open) return;
|
|
2604
|
+
const onKey = (event) => {
|
|
2605
|
+
if (event.metaKey || event.ctrlKey || event.altKey) return;
|
|
2606
|
+
const target = event.target;
|
|
2607
|
+
if (target instanceof HTMLElement && (target.isContentEditable || target.closest("input,textarea,select,[contenteditable=\"true\"]") !== null)) return;
|
|
2608
|
+
const id = SHORTCUTS[event.key.toLowerCase()];
|
|
2609
|
+
if (id === void 0 || id === "pin" && project.archived) return;
|
|
2610
|
+
event.preventDefault();
|
|
2611
|
+
event.stopPropagation();
|
|
2612
|
+
act(id);
|
|
2613
|
+
};
|
|
2614
|
+
document.addEventListener("keydown", onKey, true);
|
|
2615
|
+
return () => document.removeEventListener("keydown", onKey, true);
|
|
2616
|
+
}, [open, project]);
|
|
2617
|
+
const narrow = typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(max-width: 767px)").matches;
|
|
2618
|
+
const notifyLabel = (level) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2619
|
+
className: "dsht-menu-two",
|
|
2620
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t(`notify.${level}`) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2621
|
+
className: "dsht-menu-sub",
|
|
2622
|
+
children: t(`notify.${level}.hint`)
|
|
2623
|
+
})]
|
|
2624
|
+
});
|
|
2625
|
+
const notifyItems = narrow ? [{
|
|
2626
|
+
type: "label",
|
|
2627
|
+
id: "notify-heading",
|
|
2628
|
+
text: t("menu.notify")
|
|
2629
|
+
}, ...NOTIFY_LEVELS.map((level) => ({
|
|
2630
|
+
id: `notify:${level}`,
|
|
2631
|
+
icon: project.notify === level ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCheckOutlineRegular, { size: 16 }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "dsht-menu-icon-space" }),
|
|
2632
|
+
label: notifyLabel(level)
|
|
2633
|
+
}))] : [{
|
|
2634
|
+
id: "notify",
|
|
2635
|
+
label: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2636
|
+
className: "dsht-menu-aside-row",
|
|
2637
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("menu.notify") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2638
|
+
className: "dsht-menu-aside",
|
|
2639
|
+
children: t(`notify.${project.notify}.short`)
|
|
2640
|
+
})]
|
|
2641
|
+
}),
|
|
2642
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BellIcon, { size: 16 }),
|
|
2643
|
+
submenu: NOTIFY_LEVELS.map((level) => ({
|
|
2644
|
+
id: `notify:${level}`,
|
|
2645
|
+
icon: project.notify === level ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCheckOutlineRegular, { size: 16 }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "dsht-menu-icon-space" }),
|
|
2646
|
+
label: notifyLabel(level)
|
|
2647
|
+
}))
|
|
2648
|
+
}];
|
|
2649
|
+
const items = [
|
|
2650
|
+
...project.archived ? [] : [{
|
|
2651
|
+
id: "pin",
|
|
2652
|
+
label: project.pinned ? t("menu.unpin") : t("menu.pin"),
|
|
2653
|
+
icon: project.pinned ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPinFillRegular, { size: 16 }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPinOutlineRegular, { size: 16 }),
|
|
2654
|
+
shortcut: { keys: ["P"] }
|
|
2655
|
+
}],
|
|
2656
|
+
...notifyItems,
|
|
2657
|
+
{
|
|
2658
|
+
id: "settings",
|
|
2659
|
+
label: t("menu.settings"),
|
|
2660
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSettingsOutlineRegular, { size: 16 }),
|
|
2661
|
+
shortcut: { keys: ["S"] }
|
|
2662
|
+
},
|
|
2663
|
+
{
|
|
2664
|
+
type: "separator",
|
|
2665
|
+
id: "separator"
|
|
2666
|
+
},
|
|
2667
|
+
{
|
|
2668
|
+
id: "archive",
|
|
2669
|
+
label: project.archived ? t("menu.unarchive") : t("menu.archive"),
|
|
2670
|
+
icon: project.archived ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconUnarchiveOutlineRegular, { size: 16 }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconArchiveOutlineRegular, { size: 16 }),
|
|
2671
|
+
shortcut: { keys: ["A"] }
|
|
2672
|
+
},
|
|
2673
|
+
{
|
|
2674
|
+
id: "delete",
|
|
2675
|
+
label: t("menu.delete"),
|
|
2676
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconTrashOutlineRegular, { size: 16 }),
|
|
2677
|
+
danger: true,
|
|
2678
|
+
shortcut: { keys: ["D"] }
|
|
2679
|
+
}
|
|
2680
|
+
];
|
|
2681
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
|
|
2682
|
+
open,
|
|
2683
|
+
onClose: () => setOpen(false),
|
|
2684
|
+
align: "end",
|
|
2685
|
+
portal: true,
|
|
2686
|
+
items,
|
|
2687
|
+
onSelect: act,
|
|
2688
|
+
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2689
|
+
type: "button",
|
|
2690
|
+
className: "dsht-icon-button",
|
|
2691
|
+
"aria-label": t("menu.more"),
|
|
2692
|
+
title: t("menu.more"),
|
|
2693
|
+
"aria-haspopup": "menu",
|
|
2694
|
+
"aria-expanded": open,
|
|
2695
|
+
onClick: () => setOpen(!open),
|
|
2696
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEllipsisOutlineRegular, { size: 16 })
|
|
2697
|
+
})
|
|
2698
|
+
});
|
|
2699
|
+
}
|
|
2700
|
+
// src/client/ProjectsPage.tsx
|
|
2701
|
+
const SORT_LABELS = {
|
|
2702
|
+
activity: "page.sort.activity",
|
|
2703
|
+
created: "page.sort.created",
|
|
2704
|
+
title: "page.sort.title"
|
|
2705
|
+
};
|
|
2706
|
+
const sameList = (a, b) => a.length === b.length && a.every((item, index) => item.workspaceId === b[index]?.workspaceId && item.title === b[index]?.title);
|
|
2707
|
+
function sortProjects(projects, sort) {
|
|
2708
|
+
const key = (p) => sort === "created" ? p.createdAt : p.lastActivity;
|
|
2709
|
+
return [...projects].sort((a, b) => {
|
|
2710
|
+
if (a.pinned !== b.pinned) return a.pinned ? -1 : 1;
|
|
2711
|
+
if (sort === "title") return a.title.localeCompare(b.title);
|
|
2712
|
+
return key(b).localeCompare(key(a));
|
|
2713
|
+
});
|
|
2714
|
+
}
|
|
2715
|
+
function ProjectsPage({ t, useWorkspaces, useSessionStatus, openSession, pinSession, pickFolder, showProjects }) {
|
|
2716
|
+
const { status, projects, error } = useProjects();
|
|
2717
|
+
const [query, setQuery] = (0, react.useState)("");
|
|
2718
|
+
const [sort, setSort] = (0, react.useState)("activity");
|
|
2719
|
+
const [sortOpen, setSortOpen] = (0, react.useState)(false);
|
|
2720
|
+
const [newOpen, setNewOpen] = (0, react.useState)(false);
|
|
2721
|
+
const [creating, setCreating] = (0, react.useState)(null);
|
|
2722
|
+
const [showArchived, setShowArchived] = (0, react.useState)(false);
|
|
2723
|
+
const { actions, dialogs, error: actionError } = useProjectActions({
|
|
2724
|
+
projects,
|
|
2725
|
+
t,
|
|
2726
|
+
pinSession,
|
|
2727
|
+
afterArchive: showProjects
|
|
2728
|
+
});
|
|
2729
|
+
const workspaces = useWorkspaces((snapshot) => snapshot.items, sameList);
|
|
2730
|
+
const runningKey = useSessionStatus((statuses) => [...statuses].filter(([, state]) => state.running).map(([id]) => id).sort().join(","));
|
|
2731
|
+
(0, react.useEffect)(() => {
|
|
2732
|
+
projectsStore.refresh();
|
|
2733
|
+
}, [runningKey]);
|
|
2734
|
+
const { active, archived } = (0, react.useMemo)(() => {
|
|
2735
|
+
const needle = query.trim().toLowerCase();
|
|
2736
|
+
const sorted = sortProjects(needle.length === 0 ? projects : projects.filter((p) => p.title.toLowerCase().includes(needle) || p.folder.toLowerCase().includes(needle)), sort);
|
|
2737
|
+
return {
|
|
2738
|
+
active: sorted.filter((p) => !p.archived),
|
|
2739
|
+
archived: sorted.filter((p) => p.archived)
|
|
2740
|
+
};
|
|
2741
|
+
}, [
|
|
2742
|
+
projects,
|
|
2743
|
+
query,
|
|
2744
|
+
sort
|
|
2745
|
+
]);
|
|
2746
|
+
const newFromItems = [{
|
|
2747
|
+
type: "label",
|
|
2748
|
+
id: "from",
|
|
2749
|
+
text: t("page.newFrom")
|
|
2750
|
+
}, ...workspaces.map((workspace) => ({
|
|
2751
|
+
id: workspace.workspaceId,
|
|
2752
|
+
label: workspace.title,
|
|
2753
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FolderIcon, { size: 16 })
|
|
2754
|
+
}))];
|
|
2755
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2756
|
+
className: "dsht-page",
|
|
2757
|
+
children: [
|
|
2758
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2759
|
+
className: "dsht-inner",
|
|
2760
|
+
children: [
|
|
2761
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2762
|
+
className: "dsht-head",
|
|
2763
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
|
|
2764
|
+
className: "dsht-title",
|
|
2765
|
+
children: t("page.title")
|
|
2766
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2767
|
+
className: "dsht-actions",
|
|
2768
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
|
|
2769
|
+
open: sortOpen,
|
|
2770
|
+
onClose: () => setSortOpen(false),
|
|
2771
|
+
align: "end",
|
|
2772
|
+
portal: true,
|
|
2773
|
+
selection: "check",
|
|
2774
|
+
selectedId: sort,
|
|
2775
|
+
items: [
|
|
2776
|
+
"activity",
|
|
2777
|
+
"created",
|
|
2778
|
+
"title"
|
|
2779
|
+
].map((id) => ({
|
|
2780
|
+
id,
|
|
2781
|
+
label: t(SORT_LABELS[id])
|
|
2782
|
+
})),
|
|
2783
|
+
onSelect: (id) => {
|
|
2784
|
+
setSort(id);
|
|
2785
|
+
setSortOpen(false);
|
|
2786
|
+
},
|
|
2787
|
+
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
2788
|
+
type: "button",
|
|
2789
|
+
className: "dsht-select-button",
|
|
2790
|
+
"aria-haspopup": "menu",
|
|
2791
|
+
"aria-expanded": sortOpen,
|
|
2792
|
+
onClick: () => setSortOpen(!sortOpen),
|
|
2793
|
+
children: [
|
|
2794
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2795
|
+
className: "dsht-select-label",
|
|
2796
|
+
children: t("page.sortBy")
|
|
2797
|
+
}),
|
|
2798
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t(SORT_LABELS[sort]) }),
|
|
2799
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { size: 14 })
|
|
2800
|
+
]
|
|
2801
|
+
})
|
|
2802
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2803
|
+
className: "dsht-split",
|
|
2804
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
2805
|
+
variant: "primary",
|
|
2806
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PlusIcon, { size: 14 }),
|
|
2807
|
+
onClick: () => setCreating({ folder: null }),
|
|
2808
|
+
children: t("page.new")
|
|
2809
|
+
}), workspaces.length === 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
|
|
2810
|
+
open: newOpen,
|
|
2811
|
+
onClose: () => setNewOpen(false),
|
|
2812
|
+
align: "end",
|
|
2813
|
+
portal: true,
|
|
2814
|
+
items: newFromItems,
|
|
2815
|
+
onSelect: (id) => {
|
|
2816
|
+
setNewOpen(false);
|
|
2817
|
+
const workspace = workspaces.find((item) => item.workspaceId === id);
|
|
2818
|
+
if (workspace !== void 0) setCreating({ folder: workspace.path });
|
|
2819
|
+
},
|
|
2820
|
+
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
2821
|
+
variant: "primary",
|
|
2822
|
+
className: "dsht-split-more",
|
|
2823
|
+
"aria-label": t("page.newFrom"),
|
|
2824
|
+
"aria-haspopup": "menu",
|
|
2825
|
+
"aria-expanded": newOpen,
|
|
2826
|
+
onClick: () => setNewOpen(!newOpen),
|
|
2827
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { size: 14 })
|
|
2828
|
+
})
|
|
2829
|
+
})]
|
|
2830
|
+
})]
|
|
2831
|
+
})]
|
|
2832
|
+
}),
|
|
2833
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2834
|
+
className: "dsht-search",
|
|
2835
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchIcon, { size: 16 }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
2836
|
+
className: "dsht-text",
|
|
2837
|
+
value: query,
|
|
2838
|
+
placeholder: t("page.search"),
|
|
2839
|
+
onChange: (event) => setQuery(event.target.value)
|
|
2840
|
+
})]
|
|
2841
|
+
}),
|
|
2842
|
+
status === "error" && error !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2843
|
+
className: "dsht-error",
|
|
2844
|
+
role: "alert",
|
|
2845
|
+
children: [t("page.loadFailed", { error }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2846
|
+
type: "button",
|
|
2847
|
+
className: "dsht-retry",
|
|
2848
|
+
onClick: () => {
|
|
2849
|
+
projectsStore.refresh();
|
|
2850
|
+
},
|
|
2851
|
+
children: t("page.retry")
|
|
2852
|
+
})]
|
|
2853
|
+
}) : null,
|
|
2854
|
+
actionError === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2855
|
+
className: "dsht-error",
|
|
2856
|
+
children: actionError
|
|
2857
|
+
}),
|
|
2858
|
+
active.length === 0 ? status === "ready" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2859
|
+
className: "dsht-empty",
|
|
2860
|
+
children: projects.length === 0 ? t("page.empty") : t("page.noMatch")
|
|
2861
|
+
}) : null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2862
|
+
className: "dsht-grid",
|
|
2863
|
+
children: active.map((project) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProjectCard, {
|
|
2864
|
+
project,
|
|
2865
|
+
actions,
|
|
2866
|
+
openSession,
|
|
2867
|
+
t
|
|
2868
|
+
}, project.id))
|
|
2869
|
+
}),
|
|
2870
|
+
archived.length === 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
2871
|
+
className: "dsht-archived",
|
|
2872
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
2873
|
+
type: "button",
|
|
2874
|
+
className: "dsht-archived-toggle",
|
|
2875
|
+
"aria-expanded": showArchived,
|
|
2876
|
+
onClick: () => setShowArchived(!showArchived),
|
|
2877
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, {
|
|
2878
|
+
size: 14,
|
|
2879
|
+
className: showArchived ? "" : "dsht-rotate"
|
|
2880
|
+
}), t("page.archived", { count: archived.length })]
|
|
2881
|
+
}), showArchived ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2882
|
+
className: "dsht-grid",
|
|
2883
|
+
children: archived.map((project) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProjectCard, {
|
|
2884
|
+
project,
|
|
2885
|
+
actions,
|
|
2886
|
+
openSession,
|
|
2887
|
+
t
|
|
2888
|
+
}, project.id))
|
|
2889
|
+
}) : null]
|
|
2890
|
+
})
|
|
2891
|
+
]
|
|
2892
|
+
}),
|
|
2893
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NewProjectDialog, {
|
|
2894
|
+
open: creating !== null,
|
|
2895
|
+
initialFolder: creating?.folder ?? null,
|
|
2896
|
+
onClose: () => setCreating(null),
|
|
2897
|
+
onCreated: (project) => {
|
|
2898
|
+
threadsRevision.bump();
|
|
2899
|
+
openSession(project.mainSessionId);
|
|
2900
|
+
},
|
|
2901
|
+
workspaces,
|
|
2902
|
+
pickFolder,
|
|
2903
|
+
t
|
|
2904
|
+
}),
|
|
2905
|
+
dialogs
|
|
2906
|
+
]
|
|
2907
|
+
});
|
|
2908
|
+
}
|
|
2909
|
+
function ProjectCard({ project, actions, openSession, t }) {
|
|
2910
|
+
const [menuOpen, setMenuOpen] = (0, react.useState)(false);
|
|
2911
|
+
const open = () => {
|
|
2912
|
+
if (!project.archived) openSession(project.mainSessionId);
|
|
2913
|
+
};
|
|
2914
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2915
|
+
className: `dsht-project${menuOpen ? " is-menu-open" : ""}${project.archived ? " is-archived" : ""}`,
|
|
2916
|
+
role: "button",
|
|
2917
|
+
tabIndex: 0,
|
|
2918
|
+
onClick: open,
|
|
2919
|
+
onKeyDown: (event) => {
|
|
2920
|
+
if (event.key === "Enter" && event.target === event.currentTarget) open();
|
|
2921
|
+
},
|
|
2922
|
+
children: [
|
|
2923
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2924
|
+
className: "dsht-project-top",
|
|
2925
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2926
|
+
className: "dsht-project-icon",
|
|
2927
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProjectIcon, {
|
|
2928
|
+
id: project.icon,
|
|
2929
|
+
size: 16
|
|
2930
|
+
})
|
|
2931
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2932
|
+
className: "dsht-project-tools",
|
|
2933
|
+
onClick: (event) => event.stopPropagation(),
|
|
2934
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProjectMenu, {
|
|
2935
|
+
project,
|
|
2936
|
+
actions,
|
|
2937
|
+
t,
|
|
2938
|
+
onOpenChange: setMenuOpen
|
|
2939
|
+
})
|
|
2940
|
+
})]
|
|
2941
|
+
}),
|
|
2942
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2943
|
+
className: "dsht-project-title",
|
|
2944
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2945
|
+
className: "dsht-project-name",
|
|
2946
|
+
children: project.title
|
|
2947
|
+
}), project.pinned ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPinFillRegular, {
|
|
2948
|
+
size: 14,
|
|
2949
|
+
className: "dsht-pin-on"
|
|
2950
|
+
}) : null]
|
|
2951
|
+
}),
|
|
2952
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2953
|
+
className: "dsht-project-meta",
|
|
2954
|
+
children: [
|
|
2955
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: relativeTime(t, project.lastActivity) }),
|
|
2956
|
+
project.threads > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("card.threads", { count: project.threads }) }) : null,
|
|
2957
|
+
project.running > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2958
|
+
className: "dsht-running",
|
|
2959
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "dsht-pulse" }), t("card.running", { count: project.running })]
|
|
2960
|
+
}) : null
|
|
2961
|
+
]
|
|
2962
|
+
})
|
|
2963
|
+
]
|
|
2964
|
+
});
|
|
2965
|
+
}
|
|
2966
|
+
// src/client/resolved.ts
|
|
2967
|
+
const RESOLVED_KIND = "dsh-threads-resolved";
|
|
2968
|
+
/**
|
|
2969
|
+
* Keep one published interaction per resolved thread, re-reading the host list on start,
|
|
2970
|
+
* after this browser resolves or reopens a thread, and whenever a session starts or stops.
|
|
2971
|
+
*/
|
|
2972
|
+
function syncResolved(publish, status) {
|
|
2973
|
+
const active = /* @__PURE__ */ new Map();
|
|
2974
|
+
let disposed = false;
|
|
2975
|
+
let pending;
|
|
2976
|
+
const sync = async () => {
|
|
2977
|
+
const ids = new Set(await callHost("threads.resolved").catch(() => [...active.keys()]));
|
|
2978
|
+
if (disposed) return;
|
|
2979
|
+
for (const [id, unpublish] of active) if (!ids.has(id)) {
|
|
2980
|
+
unpublish();
|
|
2981
|
+
active.delete(id);
|
|
2982
|
+
}
|
|
2983
|
+
for (const id of ids) if (!active.has(id)) active.set(id, publish({
|
|
2984
|
+
key: `${RESOLVED_KIND}:${id}`,
|
|
2985
|
+
sessionId: id,
|
|
2986
|
+
kind: RESOLVED_KIND
|
|
2987
|
+
}, () => {}));
|
|
2988
|
+
};
|
|
2989
|
+
const schedule = () => {
|
|
2990
|
+
if (pending !== void 0) clearTimeout(pending);
|
|
2991
|
+
pending = setTimeout(() => {
|
|
2992
|
+
sync();
|
|
2993
|
+
}, 150);
|
|
2994
|
+
};
|
|
2995
|
+
let runningKey = "";
|
|
2996
|
+
const offStatus = status?.subscribe(() => {
|
|
2997
|
+
const next = [...status.getSnapshot()].filter(([, state]) => state.running === true).map(([id]) => id).sort().join(",");
|
|
2998
|
+
if (next !== runningKey) {
|
|
2999
|
+
runningKey = next;
|
|
3000
|
+
schedule();
|
|
3001
|
+
}
|
|
3002
|
+
});
|
|
3003
|
+
const offRevision = threadsRevision.subscribe(schedule);
|
|
3004
|
+
sync();
|
|
3005
|
+
return () => {
|
|
3006
|
+
disposed = true;
|
|
3007
|
+
if (pending !== void 0) clearTimeout(pending);
|
|
3008
|
+
offStatus?.();
|
|
3009
|
+
offRevision();
|
|
3010
|
+
for (const unpublish of active.values()) unpublish();
|
|
3011
|
+
active.clear();
|
|
3012
|
+
};
|
|
3013
|
+
}
|
|
3014
|
+
async function setThreadResolved(threadId, resolved) {
|
|
3015
|
+
await callHost(resolved ? "threads.resolve" : "threads.reopen", { id: threadId });
|
|
3016
|
+
threadsRevision.bump();
|
|
3017
|
+
}
|
|
3018
|
+
async function setThreadArchived(threadId, archived) {
|
|
3019
|
+
await callHost(archived ? "threads.archive" : "threads.unarchive", { id: threadId });
|
|
3020
|
+
threadsRevision.bump();
|
|
3021
|
+
refreshProjects();
|
|
3022
|
+
}
|
|
3023
|
+
async function stopThread(threadId) {
|
|
3024
|
+
await callHost("threads.stop", { id: threadId });
|
|
3025
|
+
threadsRevision.bump();
|
|
3026
|
+
}
|
|
3027
|
+
// src/client/SidebarProjects.tsx
|
|
3028
|
+
let anchor = null;
|
|
3029
|
+
const anchorListeners = /* @__PURE__ */ new Set();
|
|
3030
|
+
function setAnchor(next) {
|
|
3031
|
+
if (next?.nav === anchor?.nav && next?.wide === anchor?.wide) return;
|
|
3032
|
+
anchor = next;
|
|
3033
|
+
for (const listener of anchorListeners) listener();
|
|
3034
|
+
}
|
|
3035
|
+
const subscribeAnchor = (listener) => {
|
|
3036
|
+
anchorListeners.add(listener);
|
|
3037
|
+
return () => {
|
|
3038
|
+
anchorListeners.delete(listener);
|
|
3039
|
+
};
|
|
3040
|
+
};
|
|
3041
|
+
/** For our "Projects" panel icon, which DSH renders inside the sidebar's panel <nav> (16px wide, 18px as a rail). */
|
|
3042
|
+
function useSidebarAnchor(size) {
|
|
3043
|
+
const ref = (0, react.useRef)(null);
|
|
3044
|
+
(0, react.useLayoutEffect)(() => {
|
|
3045
|
+
const nav = ref.current?.closest("nav");
|
|
3046
|
+
if (!(nav instanceof HTMLElement)) return;
|
|
3047
|
+
setAnchor({
|
|
3048
|
+
nav,
|
|
3049
|
+
wide: size < 18
|
|
3050
|
+
});
|
|
3051
|
+
return () => {
|
|
3052
|
+
if (anchor?.nav === nav) setAnchor(null);
|
|
3053
|
+
};
|
|
3054
|
+
}, [size]);
|
|
3055
|
+
return ref;
|
|
3056
|
+
}
|
|
3057
|
+
/** The session DSH highlights: the one its main view holds, unless a panel is open. */
|
|
3058
|
+
function useCurrentSession(props) {
|
|
3059
|
+
const panelActive = props.usePanelInfo((info) => info.activePanelId !== null);
|
|
3060
|
+
const held = props.useSessions((list) => Object.entries(list.byId).find(([, session]) => (session?.retainedBy?.mainView ?? 0) > 0)?.[0]);
|
|
3061
|
+
return panelActive ? void 0 : held;
|
|
3062
|
+
}
|
|
3063
|
+
/** Keep DSH's workspace list free of workspaces that would show nothing but project sessions. */
|
|
3064
|
+
function useHideProjectWorkspaces(props) {
|
|
3065
|
+
const { mains, threads } = useKinds();
|
|
3066
|
+
const workspaces = props.useWorkspaces((snapshot) => snapshot.items);
|
|
3067
|
+
const archived = props.useWorkspaces((snapshot) => snapshot.archivedSessionIds);
|
|
3068
|
+
const sessions = props.useSessions((list) => list.byId);
|
|
3069
|
+
const current = useCurrentSession(props);
|
|
3070
|
+
(0, react.useEffect)(() => {
|
|
3071
|
+
setHiddenWorkspaces(projectOnlyWorkspaces(workspaces, sessions, new Set(archived ?? []), /* @__PURE__ */ new Set([...mains.keys(), ...threads]), current));
|
|
3072
|
+
}, [
|
|
3073
|
+
workspaces,
|
|
3074
|
+
archived,
|
|
3075
|
+
sessions,
|
|
3076
|
+
mains,
|
|
3077
|
+
threads,
|
|
3078
|
+
current
|
|
3079
|
+
]);
|
|
3080
|
+
}
|
|
3081
|
+
/**
|
|
3082
|
+
* The `shell.overlay` entry: keeps the section's container right after the panel <nav>, and the
|
|
3083
|
+
* workspace list free of project-only workspaces.
|
|
3084
|
+
*/
|
|
3085
|
+
function SidebarProjectsHost(props) {
|
|
3086
|
+
useHideProjectWorkspaces(props);
|
|
3087
|
+
const current = (0, react.useSyncExternalStore)(subscribeAnchor, () => anchor);
|
|
3088
|
+
const [container, setContainer] = (0, react.useState)(null);
|
|
3089
|
+
(0, react.useLayoutEffect)(() => {
|
|
3090
|
+
if (current === null || !current.wide) {
|
|
3091
|
+
setContainer(null);
|
|
3092
|
+
return;
|
|
3093
|
+
}
|
|
3094
|
+
const element = document.createElement("div");
|
|
3095
|
+
element.className = "dsht-side";
|
|
3096
|
+
current.nav.after(element);
|
|
3097
|
+
setContainer(element);
|
|
3098
|
+
return () => {
|
|
3099
|
+
element.remove();
|
|
3100
|
+
};
|
|
3101
|
+
}, [current]);
|
|
3102
|
+
return container === null ? null : (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarProjects, { ...props }), container);
|
|
3103
|
+
}
|
|
3104
|
+
const COLLAPSED_KEY = "dsh-threads.sidebar.projects.collapsed";
|
|
3105
|
+
function readCollapsed() {
|
|
3106
|
+
try {
|
|
3107
|
+
return localStorage.getItem(COLLAPSED_KEY) === "1";
|
|
3108
|
+
} catch {
|
|
3109
|
+
return false;
|
|
3110
|
+
}
|
|
3111
|
+
}
|
|
3112
|
+
function SidebarProjects({ t, useWorkspaces, useSessions, useSessionStatus, usePanelInfo, openSession, pinSession, pickFolder, selectPanel, closePhoneDrawer }) {
|
|
3113
|
+
const { projects } = useProjects();
|
|
3114
|
+
const { mains } = useKinds();
|
|
3115
|
+
const [collapsed, setCollapsed] = (0, react.useState)(readCollapsed);
|
|
3116
|
+
const [expanded, setExpanded] = (0, react.useState)(false);
|
|
3117
|
+
const [creating, setCreating] = (0, react.useState)(false);
|
|
3118
|
+
const [menuFor, setMenuFor] = (0, react.useState)(null);
|
|
3119
|
+
const openPanelId = usePanelInfo((info) => info.activePanelId);
|
|
3120
|
+
const { actions, dialogs, error } = useProjectActions({
|
|
3121
|
+
projects,
|
|
3122
|
+
t,
|
|
3123
|
+
pinSession,
|
|
3124
|
+
afterArchive: openPanelId === null ? void 0 : () => selectPanel(openPanelId)
|
|
3125
|
+
});
|
|
3126
|
+
const workspaces = useWorkspaces((snapshot) => snapshot.items, sameList);
|
|
3127
|
+
const live = useLive(useSessionStatus);
|
|
3128
|
+
const currentId = useCurrentSession({
|
|
3129
|
+
useSessions,
|
|
3130
|
+
usePanelInfo
|
|
3131
|
+
});
|
|
3132
|
+
(0, react.useEffect)(() => {
|
|
3133
|
+
projectsStore.refresh();
|
|
3134
|
+
}, [live.key]);
|
|
3135
|
+
const toggle = () => {
|
|
3136
|
+
const next = !collapsed;
|
|
3137
|
+
setCollapsed(next);
|
|
3138
|
+
try {
|
|
3139
|
+
localStorage.setItem(COLLAPSED_KEY, next ? "1" : "0");
|
|
3140
|
+
} catch {}
|
|
3141
|
+
};
|
|
3142
|
+
const rows = sidebarProjects(projects);
|
|
3143
|
+
const shown = expanded ? rows : rows.slice(0, 8);
|
|
3144
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
3145
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3146
|
+
className: "dsht-side-head",
|
|
3147
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
3148
|
+
type: "button",
|
|
3149
|
+
className: "dsht-side-label",
|
|
3150
|
+
"aria-expanded": !collapsed,
|
|
3151
|
+
onClick: toggle,
|
|
3152
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("side.title") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, {
|
|
3153
|
+
size: 14,
|
|
3154
|
+
className: collapsed ? "dsht-rotate" : void 0
|
|
3155
|
+
})]
|
|
3156
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3157
|
+
type: "button",
|
|
3158
|
+
className: "dsht-side-icon",
|
|
3159
|
+
"aria-label": t("page.new"),
|
|
3160
|
+
title: t("page.new"),
|
|
3161
|
+
onClick: () => setCreating(true),
|
|
3162
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PlusIcon, { size: 16 })
|
|
3163
|
+
})]
|
|
3164
|
+
}),
|
|
3165
|
+
collapsed ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3166
|
+
className: "dsht-side-list",
|
|
3167
|
+
role: "tree",
|
|
3168
|
+
"aria-label": t("side.title"),
|
|
3169
|
+
children: [
|
|
3170
|
+
rows.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3171
|
+
type: "button",
|
|
3172
|
+
className: "dsht-side-more",
|
|
3173
|
+
onClick: () => setCreating(true),
|
|
3174
|
+
children: t("side.empty")
|
|
3175
|
+
}) : shown.map((project) => {
|
|
3176
|
+
const selected = currentId === project.mainSessionId;
|
|
3177
|
+
const threads = mains.get(project.mainSessionId)?.threads ?? project.threads;
|
|
3178
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3179
|
+
role: "treeitem",
|
|
3180
|
+
"aria-selected": selected,
|
|
3181
|
+
tabIndex: 0,
|
|
3182
|
+
className: `dsht-side-row${selected ? " is-selected" : ""}${menuFor === project.id ? " is-menu-open" : ""}`,
|
|
3183
|
+
onClick: () => {
|
|
3184
|
+
openSession(project.mainSessionId);
|
|
3185
|
+
closePhoneDrawer();
|
|
3186
|
+
},
|
|
3187
|
+
onKeyDown: (event) => {
|
|
3188
|
+
if (event.key === "Enter" && event.target === event.currentTarget) {
|
|
3189
|
+
openSession(project.mainSessionId);
|
|
3190
|
+
closePhoneDrawer();
|
|
3191
|
+
}
|
|
3192
|
+
},
|
|
3193
|
+
children: [
|
|
3194
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3195
|
+
className: "dsht-side-slot",
|
|
3196
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RowMark, {
|
|
3197
|
+
project,
|
|
3198
|
+
main: mains.get(project.mainSessionId),
|
|
3199
|
+
live,
|
|
3200
|
+
t
|
|
3201
|
+
})
|
|
3202
|
+
}),
|
|
3203
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3204
|
+
className: "dsht-side-title",
|
|
3205
|
+
children: project.title
|
|
3206
|
+
}),
|
|
3207
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
3208
|
+
className: "dsht-side-meta",
|
|
3209
|
+
children: [project.pinned ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPinFillRegular, { size: 14 }) : null, threads > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: ["↳ ", threads] }) : null]
|
|
3210
|
+
}),
|
|
3211
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3212
|
+
className: "dsht-side-actions",
|
|
3213
|
+
onClick: (event) => event.stopPropagation(),
|
|
3214
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProjectMenu, {
|
|
3215
|
+
project,
|
|
3216
|
+
actions,
|
|
3217
|
+
t,
|
|
3218
|
+
onOpenChange: (open) => setMenuFor(open ? project.id : null)
|
|
3219
|
+
})
|
|
3220
|
+
})
|
|
3221
|
+
]
|
|
3222
|
+
}, project.id);
|
|
3223
|
+
}),
|
|
3224
|
+
rows.length > 8 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3225
|
+
type: "button",
|
|
3226
|
+
className: "dsht-side-more",
|
|
3227
|
+
onClick: () => setExpanded(!expanded),
|
|
3228
|
+
children: expanded ? t("side.less") : t("side.more", { count: rows.length - 8 })
|
|
3229
|
+
}) : null,
|
|
3230
|
+
error === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3231
|
+
className: "dsht-error dsht-side-error",
|
|
3232
|
+
role: "alert",
|
|
3233
|
+
children: error
|
|
3234
|
+
})
|
|
3235
|
+
]
|
|
3236
|
+
}),
|
|
3237
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NewProjectDialog, {
|
|
3238
|
+
open: creating,
|
|
3239
|
+
initialFolder: null,
|
|
3240
|
+
onClose: () => setCreating(false),
|
|
3241
|
+
onCreated: (project) => {
|
|
3242
|
+
threadsRevision.bump();
|
|
3243
|
+
openSession(project.mainSessionId);
|
|
3244
|
+
},
|
|
3245
|
+
workspaces,
|
|
3246
|
+
pickFolder,
|
|
3247
|
+
t
|
|
3248
|
+
}),
|
|
3249
|
+
dialogs
|
|
3250
|
+
] });
|
|
3251
|
+
}
|
|
3252
|
+
/**
|
|
3253
|
+
* A raised hand when the main conversation or a thread waits on the user (a decision, an approval,
|
|
3254
|
+
* a question), a breathing dot while anything runs, else the project's icon.
|
|
3255
|
+
*/
|
|
3256
|
+
function RowMark({ project, main, live, t }) {
|
|
3257
|
+
const asking = [project.mainSessionId, ...main?.threadIds ?? []].filter((id) => live.asking.has(id)).length;
|
|
3258
|
+
const waiting = (main?.waiting ?? 0) + asking;
|
|
3259
|
+
const threadsRunning = main?.running ?? project.running;
|
|
3260
|
+
if (waiting > 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadGlyph, {
|
|
3261
|
+
state: "waiting",
|
|
3262
|
+
label: t("badge.waiting", { count: waiting })
|
|
3263
|
+
});
|
|
3264
|
+
if (threadsRunning > 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadGlyph, {
|
|
3265
|
+
state: "running",
|
|
3266
|
+
label: t("badge.running", { count: threadsRunning })
|
|
3267
|
+
});
|
|
3268
|
+
if (live.running.has(project.mainSessionId)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadGlyph, {
|
|
3269
|
+
state: "running",
|
|
3270
|
+
label: t("side.mainRunning")
|
|
3271
|
+
});
|
|
3272
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3273
|
+
className: "dsht-row-icon",
|
|
3274
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProjectIcon, {
|
|
3275
|
+
id: project.icon,
|
|
3276
|
+
size: 14
|
|
3277
|
+
})
|
|
3278
|
+
});
|
|
3279
|
+
}
|
|
3280
|
+
// src/client/styles.ts
|
|
3281
|
+
const STYLE_ID = "@kyf-eng/dsh-threads/styles";
|
|
3282
|
+
const css = `
|
|
3283
|
+
/* Fixed colors can live on :root. Tokens built from DSH's theme variables must be computed where
|
|
3284
|
+
those are defined (DSH sets them on body, not :root), so they are declared on body and again on
|
|
3285
|
+
our own elements, which may sit in a differently themed subtree. */
|
|
3286
|
+
:root{
|
|
3287
|
+
--dsht-folder:#5b8def;
|
|
3288
|
+
--dsht-waiting:#e9a23b;
|
|
3289
|
+
--dsht-success:#2ea56f;
|
|
3290
|
+
--dsht-branch:#8a63d2;
|
|
3291
|
+
--dsht-file-doc:#2ea56f;
|
|
3292
|
+
--dsht-file-code:#4a8cf0;
|
|
3293
|
+
--dsht-file-data:#d9a13b;
|
|
3294
|
+
--dsht-ease:cubic-bezier(.2,.7,.2,1);
|
|
3295
|
+
}
|
|
3296
|
+
body,[class*="dsht-"]{
|
|
3297
|
+
--dsht-running:var(--dsw-alias-state-business-primary,#4d6bfe);
|
|
3298
|
+
--dsht-line:color-mix(in srgb,var(--dsw-alias-label-primary) 10%,transparent);
|
|
3299
|
+
--dsht-hover:color-mix(in srgb,var(--dsw-alias-label-primary) 4.5%,transparent);
|
|
3300
|
+
--dsht-press:color-mix(in srgb,var(--dsw-alias-label-primary) 8%,transparent);
|
|
3301
|
+
--dsht-fill:color-mix(in srgb,var(--dsw-alias-label-primary) 10%,transparent);
|
|
3302
|
+
--dsht-line-strong:color-mix(in srgb,var(--dsw-alias-label-primary) 15%,transparent);
|
|
3303
|
+
--dsht-line-hover:color-mix(in srgb,var(--dsw-alias-label-primary) 24%,transparent);
|
|
3304
|
+
--dsht-field:color-mix(in srgb,var(--dsw-alias-label-primary) 3%,transparent);
|
|
3305
|
+
--dsht-ring-soft:color-mix(in srgb,var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary,#4d6bfe)) 18%,transparent);
|
|
3306
|
+
--dsht-ring:var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary,#4d6bfe));
|
|
3307
|
+
}
|
|
3308
|
+
|
|
3309
|
+
/* State marks (glyphs.tsx) */
|
|
3310
|
+
.dsht-glyph{flex:none;display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;color:var(--dsw-alias-label-tertiary)}
|
|
3311
|
+
.dsht-glyph svg{width:16px;height:16px}
|
|
3312
|
+
.dsht-glyph-waiting{color:var(--dsht-waiting)}
|
|
3313
|
+
.dsht-glyph-failed{color:var(--dsw-alias-state-error-primary,#e5484d)}
|
|
3314
|
+
.dsht-glyph-resolved{color:var(--dsht-success)}
|
|
3315
|
+
/* Running: the dot itself breathes, dim to bright and back, in place (no spreading ring). */
|
|
3316
|
+
.dsht-pulse{width:8px;height:8px;border-radius:50%;background:var(--dsht-running);animation:dsht-breathe 1.6s ease-in-out infinite}
|
|
3317
|
+
@keyframes dsht-breathe{0%,100%{opacity:.35}50%{opacity:1}}
|
|
3318
|
+
@media (prefers-reduced-motion:reduce){.dsht-pulse{animation:none;opacity:.8}}
|
|
3319
|
+
|
|
3320
|
+
/* Kit (ui.tsx) */
|
|
3321
|
+
.dsht-mono{font-family:var(--dsw-font-family-mono,ui-monospace,SFMono-Regular,Menlo,monospace);font-size:.94em}
|
|
3322
|
+
.dsht-chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:2px}
|
|
3323
|
+
.dsht-chip{box-sizing:border-box;display:inline-flex;align-items:center;gap:5px;max-width:240px;height:22px;padding:0 8px 0 6px;border:1px solid var(--dsht-line);border-radius:6px;background:color-mix(in srgb,var(--dsw-alias-label-primary) 2.5%,transparent);font-size:12px;line-height:20px;color:var(--dsw-alias-label-secondary)}
|
|
3324
|
+
.dsht-chip svg{flex:none}
|
|
3325
|
+
.dsht-chip-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
3326
|
+
.dsht-file-doc svg{color:var(--dsht-file-doc)}
|
|
3327
|
+
.dsht-file-code svg{color:var(--dsht-file-code)}
|
|
3328
|
+
.dsht-file-data svg{color:var(--dsht-file-data)}
|
|
3329
|
+
.dsht-file-other svg{color:var(--dsw-alias-label-tertiary)}
|
|
3330
|
+
.dsht-branch{border-color:color-mix(in srgb,var(--dsht-branch) 28%,transparent);background:color-mix(in srgb,var(--dsht-branch) 9%,transparent);color:var(--dsw-alias-label-primary)}
|
|
3331
|
+
.dsht-branch svg{color:var(--dsht-branch)}
|
|
3332
|
+
.dsht-branch-removed{opacity:.55;text-decoration:line-through}
|
|
3333
|
+
.dsht-tag{display:inline-flex;align-items:center;gap:3px;margin-left:8px;padding:0 6px;height:18px;border-radius:5px;background:color-mix(in srgb,var(--dsht-branch) 10%,transparent);color:var(--dsht-branch);font-size:11px;font-weight:500;vertical-align:1px}
|
|
3334
|
+
.dsht-pill{box-sizing:border-box;flex:none;display:inline-flex;align-items:center;justify-content:center;gap:5px;height:26px;padding:0 10px;border:0;border-radius:8px;background:var(--dsht-fill);color:var(--dsw-alias-label-primary);font:inherit;font-size:12.5px;font-weight:500;white-space:nowrap;cursor:pointer;transition:background .15s var(--dsht-ease),opacity .15s var(--dsht-ease)}
|
|
3335
|
+
.dsht-pill:hover{background:color-mix(in srgb,var(--dsw-alias-label-primary) 16%,transparent)}
|
|
3336
|
+
.dsht-pill:focus-visible{outline:2px solid var(--dsht-ring);outline-offset:1px}
|
|
3337
|
+
.dsht-pill:disabled{opacity:.45;cursor:default}
|
|
3338
|
+
.dsht-pill-primary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-base)}
|
|
3339
|
+
.dsht-pill-primary:hover{background:var(--dsw-alias-label-primary);opacity:.88}
|
|
3340
|
+
.dsht-pill-icon{width:26px;padding:0;background:transparent;color:var(--dsw-alias-label-secondary)}
|
|
3341
|
+
.dsht-pill-icon:hover{background:var(--dsht-press);color:var(--dsw-alias-label-primary)}
|
|
3342
|
+
.dsht-head-label{display:flex;align-items:center;gap:6px;padding:6px 10px 4px;font-size:12px;line-height:17px;color:var(--dsw-alias-label-tertiary)}
|
|
3343
|
+
.dsht-head-label svg{flex:none}
|
|
3344
|
+
.dsht-head-trailing{margin-left:auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
3345
|
+
|
|
3346
|
+
/* A thread, wherever it appears */
|
|
3347
|
+
.dsht-items{display:flex;flex-direction:column;gap:2px}
|
|
3348
|
+
.dsht-item{position:relative;display:flex;align-items:flex-start;gap:10px;padding:9px 10px;border-radius:10px;cursor:pointer;outline:none;transition:background .15s var(--dsht-ease)}
|
|
3349
|
+
.dsht-item:hover{background:var(--dsht-hover)}
|
|
3350
|
+
.dsht-item:focus-visible{box-shadow:inset 0 0 0 2px var(--dsht-ring)}
|
|
3351
|
+
.dsht-item>.dsht-glyph{margin-top:2px}
|
|
3352
|
+
.dsht-item-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
|
|
3353
|
+
.dsht-item-title{display:flex;align-items:baseline;gap:6px;min-width:0;font-size:13.5px;line-height:20px;color:var(--dsw-alias-label-primary)}
|
|
3354
|
+
.dsht-item-n{flex:none;margin-right:4px;color:var(--dsw-alias-label-tertiary);font-weight:400;font-variant-numeric:tabular-nums}
|
|
3355
|
+
.dsht-item-title .dsht-item-n{margin-right:0}
|
|
3356
|
+
.dsht-item-name{min-width:0;font-weight:550;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
3357
|
+
.dsht-item-status{flex:none;font-size:12px;color:var(--dsw-alias-label-tertiary)}
|
|
3358
|
+
.dsht-item-status::before{content:"·";margin-right:6px}
|
|
3359
|
+
.dsht-item-summary{font-size:12.5px;line-height:18px;color:var(--dsw-alias-label-secondary);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}
|
|
3360
|
+
.dsht-item-decision{padding:6px 9px;border-radius:8px;background:color-mix(in srgb,var(--dsht-waiting) 11%,transparent);font-size:12.5px;line-height:18px;color:var(--dsw-alias-label-primary);overflow-wrap:anywhere}
|
|
3361
|
+
.dsht-item-decision b{font-weight:550;color:var(--dsht-waiting)}
|
|
3362
|
+
.dsht-item-chevron{flex:none;align-self:center;display:inline-flex;color:var(--dsw-alias-label-tertiary);opacity:0;transform:translateX(-2px);transition:opacity .15s var(--dsht-ease),transform .15s var(--dsht-ease)}
|
|
3363
|
+
.dsht-item:hover .dsht-item-chevron,.dsht-item:focus-visible .dsht-item-chevron{opacity:1;transform:none}
|
|
3364
|
+
.dsht-item>.dsht-pill{align-self:center}
|
|
3365
|
+
.dsht-item-compact{align-items:center;padding:7px 10px}
|
|
3366
|
+
.dsht-item-compact>.dsht-glyph{margin-top:0}
|
|
3367
|
+
.dsht-item-compact .dsht-item-body{flex-direction:row;align-items:center;gap:10px}
|
|
3368
|
+
.dsht-item-compact .dsht-item-title{flex:0 1 auto;min-width:0}
|
|
3369
|
+
.dsht-item-compact .dsht-chips{flex:0 1 auto;min-width:0;margin-top:0;flex-wrap:nowrap;overflow:hidden}
|
|
3370
|
+
|
|
3371
|
+
/* Cards in the transcript and above the composer */
|
|
3372
|
+
.dsht-card{box-sizing:border-box;max-width:640px;margin:8px 0;padding:4px;border:1px solid var(--dsht-line);border-radius:14px;background:var(--dsw-alias-bg-layer-1);box-shadow:0 1px 2px rgba(0,0,0,.04);font-size:13px}
|
|
3373
|
+
.dsht-replies{margin-top:10px;width:fit-content;min-width:min(100%,300px)}
|
|
3374
|
+
.dsht-card-foot{display:flex;justify-content:flex-end;gap:6px;margin-top:2px;padding:8px 8px 6px;border-top:1px solid var(--dsht-line)}
|
|
3375
|
+
.dsht-brief{padding-bottom:8px}
|
|
3376
|
+
.dsht-brief-text{display:block;width:100%;padding:2px 10px;border:0;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:13px;line-height:20px;text-align:left;white-space:pre-wrap;overflow-wrap:anywhere;cursor:pointer;border-radius:8px}
|
|
3377
|
+
.dsht-brief-text:focus-visible{outline:2px solid var(--dsht-ring)}
|
|
3378
|
+
.dsht-clamped{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
|
|
3379
|
+
|
|
3380
|
+
/* Proposals */
|
|
3381
|
+
.dsht-proposals{max-width:none;margin:0 0 8px}
|
|
3382
|
+
.dsht-proposal-list{display:flex;flex-direction:column;gap:2px}
|
|
3383
|
+
.dsht-proposal{display:flex;align-items:center;gap:8px;padding:8px 6px 8px 10px;border-radius:10px;transition:background .15s var(--dsht-ease)}
|
|
3384
|
+
.dsht-proposal:hover{background:var(--dsht-hover)}
|
|
3385
|
+
.dsht-proposal-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
|
|
3386
|
+
.dsht-proposal-title{font-size:13.5px;line-height:20px;font-weight:550;color:var(--dsw-alias-label-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
3387
|
+
.dsht-proposal-task{display:flex;align-items:center;gap:6px;font-size:12.5px;line-height:18px;color:var(--dsw-alias-label-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
3388
|
+
.dsht-proposal-task .dsht-glyph,.dsht-proposal-task .dsht-glyph svg{width:14px;height:14px}
|
|
3389
|
+
.dsht-proposal-actions{display:flex;gap:2px;flex:none}
|
|
3390
|
+
.dsht-proposal-actions .dsht-pill-icon:first-child{opacity:0;transition:opacity .15s var(--dsht-ease)}
|
|
3391
|
+
.dsht-proposal:hover .dsht-proposal-actions .dsht-pill-icon:first-child,.dsht-proposal-actions .dsht-pill-icon:first-child:focus-visible{opacity:1}
|
|
3392
|
+
.dsht-proposal-queued .dsht-proposal-title{color:var(--dsw-alias-label-secondary)}
|
|
3393
|
+
|
|
3394
|
+
/* Thread pane (right sidebar) */
|
|
3395
|
+
.dsht-chat{display:flex;flex-direction:column;height:100%;min-height:0}
|
|
3396
|
+
.dsht-chat-body{flex:1;min-height:0;display:flex;flex-direction:column}
|
|
3397
|
+
.dsht-pane-head{display:flex;align-items:center;gap:10px;min-height:48px;padding:6px 10px 6px 14px;border-bottom:1px solid var(--dsht-line);flex:none}
|
|
3398
|
+
.dsht-pane-text{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
|
|
3399
|
+
.dsht-pane-title{font-size:13.5px;line-height:19px;font-weight:600;color:var(--dsw-alias-label-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
3400
|
+
.dsht-pane-title .dsht-item-n{margin-right:6px}
|
|
3401
|
+
.dsht-pane-meta{display:flex;align-items:center;gap:8px;min-width:0;font-size:12px;line-height:17px;color:var(--dsw-alias-label-tertiary)}
|
|
3402
|
+
.dsht-pane-meta>span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
3403
|
+
.dsht-pane-meta .dsht-chip{height:20px}
|
|
3404
|
+
.dsht-pane-actions{display:flex;gap:4px;flex:none}
|
|
3405
|
+
.dsht-pane-actions .dsht-pill{background:transparent;color:var(--dsw-alias-label-secondary)}
|
|
3406
|
+
.dsht-pane-actions .dsht-pill:hover{background:var(--dsht-press);color:var(--dsw-alias-label-primary)}
|
|
3407
|
+
.dsht-resolved{box-sizing:border-box;display:flex;align-items:center;gap:10px;width:100%;margin:0 auto 12px;padding:10px 10px 10px 14px;border:1px solid var(--dsht-line);border-radius:16px;background:var(--dsw-alias-bg-layer-1);box-shadow:0 1px 2px rgba(0,0,0,.04);font-size:13px;line-height:19px}
|
|
3408
|
+
.dsht-resolved-text{flex:1;min-width:0;color:var(--dsw-alias-label-tertiary)}
|
|
3409
|
+
.dsht-resolved-text b{margin-right:4px;font-weight:550;color:var(--dsw-alias-label-primary)}
|
|
3410
|
+
|
|
3411
|
+
/* Thread list tab */
|
|
3412
|
+
.dsht-tab{padding:12px;font-size:13px;line-height:1.6;color:var(--dsw-alias-label-secondary)}
|
|
3413
|
+
.dsht-list{box-sizing:border-box;display:flex;flex-direction:column;gap:14px;height:100%;min-height:0;overflow-y:auto;padding:8px 10px 16px}
|
|
3414
|
+
.dsht-list-top{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:30px;padding:0 2px 0 8px}
|
|
3415
|
+
.dsht-list-title{font-size:15px;font-weight:600;color:var(--dsw-alias-label-primary)}
|
|
3416
|
+
.dsht-list-tools{display:flex;align-items:center;gap:2px}
|
|
3417
|
+
.dsht-list-search{box-sizing:border-box;height:32px;margin:-6px 4px 0;padding:0 11px;border:1px solid var(--dsht-line-strong);border-radius:9px;background:var(--dsht-field);color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;outline:none;transition:border-color .15s var(--dsht-ease),box-shadow .15s var(--dsht-ease)}
|
|
3418
|
+
.dsht-list-search:focus{border-color:var(--dsht-ring);box-shadow:0 0 0 3px var(--dsht-ring-soft)}
|
|
3419
|
+
.dsht-section{display:flex;flex-direction:column;gap:4px}
|
|
3420
|
+
.dsht-section-head{display:flex;align-items:center;gap:6px;align-self:flex-start;padding:2px 8px;border:0;border-radius:6px;background:transparent;color:var(--dsw-alias-label-tertiary);font:inherit;font-size:12.5px;line-height:20px;cursor:pointer}
|
|
3421
|
+
.dsht-section-head:not(:disabled):hover{color:var(--dsw-alias-label-secondary)}
|
|
3422
|
+
.dsht-section-head:disabled{cursor:default}
|
|
3423
|
+
.dsht-section-head svg{transform:rotate(-90deg);transition:transform .15s var(--dsht-ease)}
|
|
3424
|
+
.dsht-section-head.is-open svg{transform:rotate(90deg)}
|
|
3425
|
+
.dsht-section-empty{margin:2px 4px 0;padding:22px 14px;border:1px dashed var(--dsht-line-strong);border-radius:12px;text-align:center;font-size:13px;color:var(--dsw-alias-label-tertiary)}
|
|
3426
|
+
.dsht-rows{display:flex;flex-direction:column;gap:2px}
|
|
3427
|
+
.dsht-row{display:flex;align-items:flex-start;gap:10px;padding:9px 10px;border-radius:10px;cursor:pointer;outline:none;transition:background .15s var(--dsht-ease)}
|
|
3428
|
+
.dsht-row:hover{background:var(--dsht-hover)}
|
|
3429
|
+
.dsht-row:focus-visible{box-shadow:inset 0 0 0 2px var(--dsht-ring)}
|
|
3430
|
+
.dsht-row>.dsht-glyph{margin-top:2px}
|
|
3431
|
+
.dsht-row-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:6px}
|
|
3432
|
+
.dsht-row-top{display:flex;align-items:baseline;gap:10px;min-width:0}
|
|
3433
|
+
.dsht-row-title{flex:1;min-width:0;font-size:13.5px;font-weight:550;line-height:20px;color:var(--dsw-alias-label-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
3434
|
+
.dsht-row-title .dsht-item-n{margin-right:6px}
|
|
3435
|
+
.dsht-row-time{flex:none;font-size:12px;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums}
|
|
3436
|
+
.dsht-row-decision{padding:6px 9px;border-radius:8px;background:color-mix(in srgb,var(--dsht-waiting) 11%,transparent);font-size:12.5px;line-height:18px;color:var(--dsw-alias-label-primary);overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
|
|
3437
|
+
.dsht-row-chips{display:flex;flex-wrap:wrap;gap:6px}
|
|
3438
|
+
.dsht-count{border-radius:999px;padding:0 9px 0 7px;font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-secondary)}
|
|
3439
|
+
.dsht-section-archived .dsht-row{opacity:.72}
|
|
3440
|
+
|
|
3441
|
+
.dsht-error{font-size:13px;line-height:19px;color:var(--dsw-alias-state-error-primary);overflow-wrap:anywhere}
|
|
3442
|
+
.dsht-retry{display:inline-flex;align-items:center;gap:4px;margin-left:8px;padding:0 7px;height:22px;border:1px solid var(--dsht-line-strong);border-radius:6px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:12px;cursor:pointer;vertical-align:1px}
|
|
3443
|
+
.dsht-retry:hover,.dsht-retry:focus-visible{background:var(--dsht-hover);color:var(--dsw-alias-label-primary)}
|
|
3444
|
+
.dsht-retry:focus-visible{outline:2px solid var(--dsht-ring);outline-offset:1px}
|
|
3445
|
+
.dsht-side-error{padding:6px 8px 2px;font-size:12px;line-height:17px}
|
|
3446
|
+
.dsht-menu-message{padding:6px 10px;max-width:260px;font-size:12.5px;line-height:18px}
|
|
3447
|
+
.dsht-proposal-error{padding:2px 10px 6px;font-size:12.5px;line-height:18px}
|
|
3448
|
+
.dsht-hint{font-size:12px;line-height:17px;color:var(--dsw-alias-label-tertiary)}
|
|
3449
|
+
.dsht-buttons{display:flex;justify-content:flex-end;gap:8px}
|
|
3450
|
+
.dsht-danger.dsht-danger{background:var(--dsw-alias-state-error-primary,#e5484d);color:#fff}
|
|
3451
|
+
.dsht-icon-button{width:28px;height:28px;padding:0;border:0;border-radius:8px;background:transparent;color:var(--dsw-alias-label-tertiary);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:background .15s var(--dsht-ease),color .15s var(--dsht-ease)}
|
|
3452
|
+
.dsht-icon-button:hover,.dsht-icon-button:focus-visible,.dsht-icon-button[aria-expanded="true"]{background:var(--dsht-press);color:var(--dsw-alias-label-primary)}
|
|
3453
|
+
.dsht-icon-button:focus-visible{outline:2px solid var(--dsht-ring);outline-offset:-2px}
|
|
3454
|
+
|
|
3455
|
+
/* Menus (Menu items with two lines, or a value on the right) */
|
|
3456
|
+
.dsht-menu-two{display:flex;flex-direction:column;gap:1px;min-width:0;text-align:left}
|
|
3457
|
+
.dsht-menu-sub{max-width:320px;font-size:11.5px;line-height:16px;color:var(--dsw-alias-label-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
3458
|
+
.dsht-menu-aside-row{display:flex;align-items:center;justify-content:space-between;gap:18px;width:100%}
|
|
3459
|
+
.dsht-menu-aside{font-size:12px;color:var(--dsw-alias-label-tertiary)}
|
|
3460
|
+
.dsht-menu-icon-space{display:inline-block;width:16px;height:16px}
|
|
3461
|
+
|
|
3462
|
+
/* Dialogs: headless Modals; a doubled class beats the Modal defaults, as DSH's own dialogs do */
|
|
3463
|
+
.dsht-dialog.dsht-dialog{gap:0;padding:0;overflow:hidden}
|
|
3464
|
+
.dsht-dialog-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
|
|
3465
|
+
.dsht-dialog-title{margin:0;font-size:18px;line-height:26px;font-weight:600;letter-spacing:-.01em;color:var(--dsw-alias-label-primary)}
|
|
3466
|
+
.dsht-dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:4px}
|
|
3467
|
+
.dsht-np.dsht-np{width:min(480px,100%)}
|
|
3468
|
+
/* The modal's only child is this wrapper (a form inside it holds the fields): dsh-web-mobile's
|
|
3469
|
+
sheet heuristic keys on [aria-modal] > :first-child > :last-child > button, so keeping the
|
|
3470
|
+
buttons one level deeper keeps this dialog in the host's normal centred-card branch. */
|
|
3471
|
+
.dsht-np-body{display:flex;flex-direction:column;min-height:0;overflow-y:auto;padding:22px 24px 20px;overscroll-behavior:contain}
|
|
3472
|
+
.dsht-np-form{display:flex;flex-direction:column;gap:18px;min-width:0}
|
|
3473
|
+
.dsht-np-field{display:flex;flex-direction:column;gap:8px}
|
|
3474
|
+
.dsht-np-label-row{display:flex;align-items:center;justify-content:space-between;gap:8px}
|
|
3475
|
+
.dsht-np-label{font-size:13px;line-height:18px;font-weight:500;color:var(--dsw-alias-label-secondary)}
|
|
3476
|
+
.dsht-np-input{box-sizing:border-box;width:100%;height:42px;padding:0 14px;border:1px solid var(--dsht-line-strong);border-radius:10px;background:var(--dsht-field);color:var(--dsw-alias-label-primary);font:inherit;font-size:14px;outline:none;transition:border-color .15s var(--dsht-ease),box-shadow .15s var(--dsht-ease)}
|
|
3477
|
+
.dsht-np-input::placeholder{color:var(--dsw-alias-label-tertiary)}
|
|
3478
|
+
.dsht-np-input:focus{border-color:var(--dsht-ring);box-shadow:0 0 0 3px var(--dsht-ring-soft)}
|
|
3479
|
+
.dsht-np-link{display:inline-flex;align-items:center;gap:3px;padding:2px 6px;border:0;border-radius:6px;background:transparent;color:var(--dsw-alias-label-tertiary);font:inherit;font-size:12.5px;cursor:pointer}
|
|
3480
|
+
.dsht-np-link:hover,.dsht-np-link:focus-visible{background:var(--dsht-hover);color:var(--dsw-alias-label-primary)}
|
|
3481
|
+
.dsht-np-folder{box-sizing:border-box;display:flex;align-items:center;gap:12px;width:100%;min-height:58px;padding:10px 14px;border:1px solid var(--dsht-line-strong);border-radius:12px;background:var(--dsht-field);color:var(--dsw-alias-label-secondary);font:inherit;text-align:left;cursor:pointer;transition:background .15s var(--dsht-ease),border-color .15s var(--dsht-ease)}
|
|
3482
|
+
.dsht-np-folder:hover{background:var(--dsht-hover);border-color:var(--dsht-line-hover)}
|
|
3483
|
+
.dsht-np-folder:focus-visible{outline:2px solid var(--dsht-ring);outline-offset:1px}
|
|
3484
|
+
.dsht-np-folder>svg{flex:none;color:var(--dsht-folder)}
|
|
3485
|
+
.dsht-np-folder-empty{justify-content:center;border-style:dashed}
|
|
3486
|
+
.dsht-np-folder-text{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px;font-size:14px}
|
|
3487
|
+
.dsht-np-folder-empty .dsht-np-folder-text{flex:0 1 auto}
|
|
3488
|
+
.dsht-np-folder-name{font-weight:550;color:var(--dsw-alias-label-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
3489
|
+
.dsht-np-folder-path{font-size:12px;color:var(--dsw-alias-label-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
3490
|
+
.dsht-np-change{flex:none;font-size:12.5px;color:var(--dsw-alias-label-tertiary)}
|
|
3491
|
+
|
|
3492
|
+
/* Projects page */
|
|
3493
|
+
.dsht-page{box-sizing:border-box;height:100%;overflow:auto;padding:calc(var(--dsh-frame-top-clearance,0px) + 36px) 40px 48px;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-base)}
|
|
3494
|
+
.dsht-inner{max-width:1040px;margin:0 auto;display:flex;flex-direction:column;gap:18px}
|
|
3495
|
+
.dsht-head{display:flex;align-items:center;justify-content:space-between;gap:16px}
|
|
3496
|
+
.dsht-title{margin:0;font-size:28px;line-height:36px;font-weight:600;letter-spacing:-.015em}
|
|
3497
|
+
.dsht-actions{display:flex;gap:8px;align-items:center;flex:none}
|
|
3498
|
+
.dsht-select-button{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 10px;border:1px solid var(--dsht-line-strong);border-radius:9px;background:var(--dsht-field);color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;cursor:pointer;transition:background .15s var(--dsht-ease)}
|
|
3499
|
+
.dsht-select-button:hover,.dsht-select-button[aria-expanded="true"]{background:var(--dsht-hover)}
|
|
3500
|
+
.dsht-select-label{color:var(--dsw-alias-label-tertiary)}
|
|
3501
|
+
.dsht-split{display:inline-flex;align-items:stretch}
|
|
3502
|
+
.dsht-split>button:first-child{border-top-right-radius:0;border-bottom-right-radius:0}
|
|
3503
|
+
.dsht-split-more.dsht-split-more{margin-left:1px;padding-left:8px;padding-right:8px;border-top-left-radius:0;border-bottom-left-radius:0}
|
|
3504
|
+
.dsht-text{box-sizing:border-box;width:100%;height:34px;padding:0 10px;border:1px solid var(--dsht-line-strong);border-radius:9px;background:var(--dsht-field);color:inherit;font:inherit;font-size:13px;transition:border-color .15s var(--dsht-ease)}
|
|
3505
|
+
.dsht-text:hover{border-color:var(--dsht-line-hover)}
|
|
3506
|
+
.dsht-text:focus-visible{outline:none;border-color:var(--dsht-ring);box-shadow:0 0 0 3px var(--dsht-ring-soft)}
|
|
3507
|
+
.dsht-search{position:relative}
|
|
3508
|
+
.dsht-search svg{position:absolute;left:12px;top:11px;color:var(--dsw-alias-label-tertiary)}
|
|
3509
|
+
.dsht-search .dsht-text{padding-left:36px;height:40px;border-radius:11px}
|
|
3510
|
+
.dsht-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:12px}
|
|
3511
|
+
.dsht-project{position:relative;box-sizing:border-box;display:flex;flex-direction:column;gap:8px;min-height:118px;padding:14px 12px 16px 16px;border:1px solid var(--dsht-line);border-radius:16px;background:var(--dsw-alias-bg-layer-1);box-shadow:0 1px 2px rgba(0,0,0,.04);cursor:pointer;outline:none;transition:border-color .15s var(--dsht-ease),box-shadow .2s var(--dsht-ease),transform .2s var(--dsht-ease)}
|
|
3512
|
+
.dsht-project:hover{border-color:var(--dsht-line-hover);box-shadow:0 6px 20px rgba(0,0,0,.08);transform:translateY(-1px)}
|
|
3513
|
+
.dsht-project:focus-visible{outline:2px solid var(--dsht-ring);outline-offset:-2px}
|
|
3514
|
+
.dsht-project.is-archived{cursor:default;opacity:.72}
|
|
3515
|
+
.dsht-project.is-archived:hover{transform:none;box-shadow:0 1px 2px rgba(0,0,0,.04)}
|
|
3516
|
+
.dsht-project-top{display:flex;align-items:flex-start;justify-content:space-between;gap:8px;margin-bottom:4px}
|
|
3517
|
+
.dsht-project-icon{width:30px;height:30px;border-radius:9px;display:inline-flex;align-items:center;justify-content:center;background:var(--dsht-fill);color:var(--dsw-alias-label-secondary)}
|
|
3518
|
+
.dsht-project-tools{display:flex;opacity:0;transition:opacity .15s var(--dsht-ease)}
|
|
3519
|
+
.dsht-project-tools .dsht-icon-button svg{transform:rotate(90deg)}
|
|
3520
|
+
.dsht-project:hover .dsht-project-tools,.dsht-project:focus-within .dsht-project-tools,.dsht-project.is-menu-open .dsht-project-tools{opacity:1}
|
|
3521
|
+
.dsht-project-title{display:flex;align-items:center;gap:6px;min-width:0;padding-right:4px;font-size:15px;line-height:21px;font-weight:600}
|
|
3522
|
+
.dsht-project-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
3523
|
+
.dsht-pin-on{flex:none;color:var(--dsht-running)}
|
|
3524
|
+
.dsht-project-meta{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px;font-size:12px;line-height:17px;color:var(--dsw-alias-label-tertiary)}
|
|
3525
|
+
.dsht-running{display:inline-flex;align-items:center;gap:5px;color:var(--dsht-running)}
|
|
3526
|
+
.dsht-empty{padding:56px 24px;text-align:center;font-size:13px;line-height:20px;color:var(--dsw-alias-label-tertiary);border:1px dashed var(--dsht-line-strong);border-radius:16px}
|
|
3527
|
+
.dsht-archived{display:flex;flex-direction:column;gap:12px;margin-top:8px}
|
|
3528
|
+
.dsht-archived-toggle{align-self:flex-start;display:inline-flex;align-items:center;gap:6px;padding:4px 8px 4px 6px;border:0;border-radius:8px;background:transparent;color:var(--dsw-alias-label-tertiary);font:inherit;font-size:13px;cursor:pointer}
|
|
3529
|
+
.dsht-archived-toggle:hover,.dsht-archived-toggle:focus-visible{background:var(--dsht-hover);color:var(--dsw-alias-label-primary)}
|
|
3530
|
+
.dsht-rotate{transform:rotate(-90deg)}
|
|
3531
|
+
.dsht-row-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;color:var(--dsw-alias-label-tertiary)}
|
|
3532
|
+
|
|
3533
|
+
/* Sidebar "Projects" section (SidebarProjects.tsx), measured against DSH's own workspace list:
|
|
3534
|
+
36px section header in tertiary 14px text, 32px rows with a 16px leading cell.
|
|
3535
|
+
DSH 0.2.2 narrowed the sidebar's inline padding from 12px to 8px and moved the difference into
|
|
3536
|
+
its rows (--dsh-sidebar-row-padding 12px, --dsh-sidebar-label-gap 6px). The calc()s below follow
|
|
3537
|
+
the host's variables, with the 0.2.1 values as fallbacks, so the icons, titles and the "+" line up
|
|
3538
|
+
with the workspace list on both. */
|
|
3539
|
+
.dsht-panel-icon{display:inline-flex}
|
|
3540
|
+
.dsht-side{flex:none;display:flex;flex-direction:column;min-height:0;max-height:42%;margin-bottom:4px}
|
|
3541
|
+
.dsht-side-head{box-sizing:border-box;flex:none;display:flex;align-items:center;gap:4px;height:36px;margin:2px calc(8px - var(--dsh-sidebar-inline-padding,12px)) 4px 0;padding-left:calc(var(--dsh-sidebar-row-padding,5px) - 1px);color:var(--dsw-alias-label-tertiary)}
|
|
3542
|
+
.dsht-side-label{flex:1;min-width:0;display:inline-flex;align-items:center;gap:4px;height:28px;padding:0;border:0;background:none;color:inherit;font:inherit;font-size:14px;line-height:20px;text-align:left;cursor:pointer}
|
|
3543
|
+
.dsht-side-label svg{flex:none;opacity:0;transition:opacity .12s var(--dsht-ease),transform .15s var(--dsht-ease)}
|
|
3544
|
+
.dsht-side-head:hover .dsht-side-label svg,.dsht-side-label:focus-visible svg,.dsht-side-label svg.dsht-rotate{opacity:1}
|
|
3545
|
+
.dsht-side-label:focus-visible,.dsht-side-icon:focus-visible,.dsht-side-more:focus-visible{outline:2px solid var(--dsht-ring);outline-offset:-2px;border-radius:var(--dsw-radius-sm,6px)}
|
|
3546
|
+
.dsht-side-icon{flex:none;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:0;border-radius:var(--dsw-radius-sm,6px);background:none;color:var(--dsw-alias-label-secondary);cursor:pointer}
|
|
3547
|
+
.dsht-side-icon:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
3548
|
+
.dsht-side-list{display:flex;flex-direction:column;min-height:0;overflow-y:auto}
|
|
3549
|
+
.dsht-side-row{box-sizing:border-box;flex:none;display:flex;align-items:center;height:32px;padding:0 calc(20px - var(--dsh-sidebar-inline-padding,12px));border-radius:var(--dsw-radius-md,10px);color:var(--dsw-alias-label-primary);cursor:pointer;user-select:none}
|
|
3550
|
+
.dsht-side-row:hover,.dsht-side-row.is-selected,.dsht-side-row.is-menu-open{background:var(--dsw-alias-interactive-bg-hover)}
|
|
3551
|
+
.dsht-side-row:focus-visible{outline:2px solid var(--dsht-ring);outline-offset:-2px}
|
|
3552
|
+
.dsht-side-slot{flex:none;display:inline-flex;align-items:center;justify-content:center;width:16px;height:20px;color:var(--dsw-alias-label-tertiary)}
|
|
3553
|
+
.dsht-side-title{flex:1;min-width:0;margin:0 6px 0 var(--dsh-sidebar-label-gap,4px);font-size:14px;line-height:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
3554
|
+
.dsht-side-meta{flex:none;display:inline-flex;align-items:center;gap:6px;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:16px;font-variant-numeric:tabular-nums}
|
|
3555
|
+
.dsht-side-actions{flex:none;display:none;margin-right:-4px}
|
|
3556
|
+
.dsht-side-actions .dsht-icon-button{width:24px;height:24px;border-radius:6px}
|
|
3557
|
+
.dsht-side-row:hover .dsht-side-meta,.dsht-side-row.is-menu-open .dsht-side-meta{display:none}
|
|
3558
|
+
.dsht-side-row:hover .dsht-side-actions,.dsht-side-row.is-menu-open .dsht-side-actions{display:inline-flex}
|
|
3559
|
+
.dsht-side-more{box-sizing:border-box;flex:none;display:flex;align-items:center;height:32px;padding:0 8px 0 calc(36px - var(--dsh-sidebar-inline-padding,12px) + var(--dsh-sidebar-label-gap,4px));border:0;border-radius:var(--dsw-radius-md,10px);background:none;color:var(--dsw-alias-label-tertiary);font:inherit;font-size:13px;text-align:left;cursor:pointer}
|
|
3560
|
+
.dsht-side-more:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}
|
|
3561
|
+
|
|
3562
|
+
/* Project settings */
|
|
3563
|
+
.dsht-settings.dsht-settings{width:min(820px,100%);height:min(620px,100dvh - 48px)}
|
|
3564
|
+
.dsht-settings-layout{display:flex;height:100%;min-height:0}
|
|
3565
|
+
.dsht-settings-nav{box-sizing:border-box;flex:none;width:200px;padding:18px 10px;display:flex;flex-direction:column;gap:2px;border-right:1px solid var(--dsht-line);background:var(--dsht-field)}
|
|
3566
|
+
.dsht-settings-nav-title{padding:2px 10px 12px;font-size:13px;color:var(--dsw-alias-label-tertiary)}
|
|
3567
|
+
.dsht-settings-nav-item{display:flex;align-items:center;gap:10px;height:34px;padding:0 10px;border:0;border-radius:9px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:14px;text-align:left;cursor:pointer;transition:background .15s var(--dsht-ease)}
|
|
3568
|
+
.dsht-settings-nav-item:hover,.dsht-settings-nav-item:focus-visible{background:var(--dsht-hover);color:var(--dsw-alias-label-primary)}
|
|
3569
|
+
.dsht-settings-nav-item.is-active{background:var(--dsht-press);color:var(--dsw-alias-label-primary);font-weight:550}
|
|
3570
|
+
.dsht-settings-main{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column}
|
|
3571
|
+
.dsht-settings-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:18px 18px 6px 32px}
|
|
3572
|
+
.dsht-settings-body{flex:1;min-height:0;overflow:auto;display:flex;flex-direction:column;padding:4px 32px 28px}
|
|
3573
|
+
.dsht-setting-row{display:flex;align-items:center;justify-content:space-between;gap:24px;padding:16px 0;border-bottom:1px solid var(--dsht-line)}
|
|
3574
|
+
.dsht-setting-text{min-width:0;display:flex;flex-direction:column;gap:3px}
|
|
3575
|
+
.dsht-setting-title{font-size:14px;line-height:20px;font-weight:500;color:var(--dsw-alias-label-primary)}
|
|
3576
|
+
.dsht-setting-hint{font-size:12.5px;line-height:18px;color:var(--dsw-alias-label-tertiary)}
|
|
3577
|
+
.dsht-setting-block{display:flex;flex-direction:column;gap:4px;padding:16px 0;border-bottom:1px solid var(--dsht-line)}
|
|
3578
|
+
.dsht-setting-textarea{box-sizing:border-box;width:100%;min-height:112px;margin-top:8px;padding:10px 12px;border:1px solid var(--dsht-line-strong);border-radius:10px;background:var(--dsht-field);color:inherit;font:inherit;font-size:13.5px;line-height:20px;resize:vertical;outline:none;transition:border-color .15s var(--dsht-ease),box-shadow .15s var(--dsht-ease)}
|
|
3579
|
+
.dsht-setting-textarea::placeholder{color:var(--dsw-alias-label-tertiary)}
|
|
3580
|
+
.dsht-setting-textarea:focus{border-color:var(--dsht-ring);box-shadow:0 0 0 3px var(--dsht-ring-soft)}
|
|
3581
|
+
.dsht-setting-textarea-tall{min-height:240px}
|
|
3582
|
+
.dsht-counter{align-self:flex-end;font-size:12px;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums}
|
|
3583
|
+
.dsht-setting-group{display:flex;flex-direction:column;padding-top:20px}
|
|
3584
|
+
.dsht-setting-group-title{padding-bottom:2px;font-size:15px;line-height:22px;font-weight:600;color:var(--dsw-alias-label-primary)}
|
|
3585
|
+
.dsht-select-box{box-sizing:border-box;flex:none;display:inline-flex;align-items:center;justify-content:space-between;gap:10px;width:248px;height:38px;padding:0 12px;border:1px solid var(--dsht-line-strong);border-radius:10px;background:var(--dsht-field);color:var(--dsw-alias-label-primary);font:inherit;font-size:13.5px;text-align:left;cursor:pointer;transition:background .15s var(--dsht-ease),border-color .15s var(--dsht-ease)}
|
|
3586
|
+
.dsht-select-box:hover:enabled,.dsht-select-box[aria-expanded="true"]{background:var(--dsht-hover);border-color:var(--dsht-line-hover)}
|
|
3587
|
+
.dsht-select-box:disabled{cursor:default;color:var(--dsw-alias-label-tertiary)}
|
|
3588
|
+
.dsht-select-box svg{flex:none;color:var(--dsw-alias-label-tertiary)}
|
|
3589
|
+
.dsht-select-box-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
3590
|
+
.dsht-usage-loading{padding:16px 0}
|
|
3591
|
+
.dsht-usage-total{display:flex;gap:40px;margin:14px 0 6px}
|
|
3592
|
+
.dsht-usage-total>div{display:flex;flex-direction:column;gap:2px}
|
|
3593
|
+
.dsht-usage-figure{font-size:24px;line-height:30px;font-weight:600;font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary)}
|
|
3594
|
+
.dsht-usage-table{width:100%;margin-top:10px;border-collapse:collapse;font-size:13px}
|
|
3595
|
+
.dsht-usage-table th{padding:8px 0;border-bottom:1px solid var(--dsht-line);font-weight:500;font-size:12px;color:var(--dsw-alias-label-tertiary);text-align:right}
|
|
3596
|
+
.dsht-usage-table td{padding:9px 0;border-bottom:1px solid var(--dsht-line);text-align:right;font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-secondary)}
|
|
3597
|
+
.dsht-usage-table th:first-child,.dsht-usage-table td:first-child{text-align:left;color:var(--dsw-alias-label-primary)}
|
|
3598
|
+
.dsht-usage-table td:first-child .dsht-item-n{margin-right:6px}
|
|
3599
|
+
.dsht-setting-path{box-sizing:border-box;margin-top:8px;padding:9px 12px;border:1px solid var(--dsht-line);border-radius:10px;background:var(--dsht-field);font-size:12.5px;color:var(--dsw-alias-label-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
3600
|
+
.dsht-name-field{display:flex;align-items:center;flex:none;width:min(340px,100%);height:40px;border:1px solid var(--dsht-line-strong);border-radius:10px;background:var(--dsht-field);overflow:hidden;transition:border-color .15s var(--dsht-ease),box-shadow .15s var(--dsht-ease)}
|
|
3601
|
+
.dsht-name-field:focus-within{border-color:var(--dsht-ring);box-shadow:0 0 0 3px var(--dsht-ring-soft)}
|
|
3602
|
+
.dsht-icon-pick{flex:none;display:inline-flex;align-items:center;justify-content:center;width:40px;height:100%;border:0;border-right:1px solid var(--dsht-line);background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer}
|
|
3603
|
+
.dsht-icon-pick:hover,.dsht-icon-pick[aria-expanded="true"]{background:var(--dsht-hover);color:var(--dsw-alias-label-primary)}
|
|
3604
|
+
.dsht-name-input{flex:1;min-width:0;height:100%;padding:0 12px;border:0;background:transparent;color:inherit;font:inherit;font-size:14px;outline:none}
|
|
3605
|
+
.dsht-icon-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(40px,1fr));gap:6px;margin:12px 0 4px;padding:12px;border:1px solid var(--dsht-line);border-radius:12px;background:var(--dsht-field)}
|
|
3606
|
+
.dsht-icon-cell{display:inline-flex;align-items:center;justify-content:center;height:40px;border:0;border-radius:9px;background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer;transition:background .15s var(--dsht-ease)}
|
|
3607
|
+
.dsht-icon-cell:hover,.dsht-icon-cell:focus-visible{background:var(--dsht-hover);color:var(--dsw-alias-label-primary)}
|
|
3608
|
+
.dsht-icon-cell.is-active{background:var(--dsht-press);color:var(--dsw-alias-label-primary);box-shadow:inset 0 0 0 1.5px var(--dsht-ring)}
|
|
3609
|
+
|
|
3610
|
+
/* dsh-web-mobile (the phone layout plugin) floats a back button over the top-left corner of the
|
|
3611
|
+
main panel (10,12, 38x38) up to 1023px on coarse pointers, so the page needs top clearance
|
|
3612
|
+
there. Only where that plugin is running, which its frame marker says: a narrow Desktop window
|
|
3613
|
+
or a touch tablet without it has no such button and keeps the normal top padding. */
|
|
3614
|
+
@media (max-width:1023px) and (pointer:coarse),(max-width:767px){
|
|
3615
|
+
html:has([data-mobile-nav="frame"]) .dsht-page{padding-top:calc(var(--dsh-frame-top-clearance,0px) + 58px)}
|
|
3616
|
+
}
|
|
3617
|
+
|
|
3618
|
+
/* Narrow windows and phones: every plugin surface stays inside the viewport, scrolls there, and
|
|
3619
|
+
(with the touch rules below) is thumb-sized. dsh-web-mobile also turns its own dialogs into
|
|
3620
|
+
sheets; ours stay centred cards. */
|
|
3621
|
+
@media (max-width:767px){
|
|
3622
|
+
.dsht-page{padding:calc(var(--dsh-frame-top-clearance,0px) + 36px) 16px calc(28px + env(safe-area-inset-bottom,0px))}
|
|
3623
|
+
.dsht-inner{gap:14px}
|
|
3624
|
+
.dsht-head{flex-direction:column;align-items:stretch;gap:12px}
|
|
3625
|
+
.dsht-title{font-size:24px;line-height:30px}
|
|
3626
|
+
.dsht-actions{width:100%;gap:8px}
|
|
3627
|
+
.dsht-select-button{flex:1 1 45%;justify-content:space-between;height:38px;min-width:0}
|
|
3628
|
+
.dsht-split{flex:1 1 45%;min-width:0}
|
|
3629
|
+
.dsht-split>button:first-child{flex:1;justify-content:center}
|
|
3630
|
+
.dsht-search .dsht-text{height:42px;font-size:16px}
|
|
3631
|
+
.dsht-search svg{top:13px}
|
|
3632
|
+
.dsht-grid{grid-template-columns:1fr}
|
|
3633
|
+
.dsht-project{min-height:0;padding:12px 12px 14px 14px}
|
|
3634
|
+
.dsht-project-tools{opacity:1}
|
|
3635
|
+
.dsht-empty{padding:40px 18px}
|
|
3636
|
+
.dsht-card{max-width:none}
|
|
3637
|
+
|
|
3638
|
+
/* New project dialog: host centres a min(380px,100%) card on phones; the body scrolls
|
|
3639
|
+
when the keyboard shrinks the viewport, and the actions get full-width targets. */
|
|
3640
|
+
.dsht-np.dsht-np{width:calc(100vw - 24px);max-width:min(480px,calc(100vw - 24px))}
|
|
3641
|
+
.dsht-np-body{padding:18px 16px 16px;max-height:calc(var(--dsh-web-mobile-vh,100dvh) - 96px)}
|
|
3642
|
+
.dsht-np-form{gap:16px}
|
|
3643
|
+
.dsht-np-field{gap:7px}
|
|
3644
|
+
.dsht-np-input{height:44px;font-size:16px}
|
|
3645
|
+
.dsht-np-folder{min-height:56px;padding:10px 12px;gap:10px}
|
|
3646
|
+
.dsht-np-folder-name{font-size:15px}
|
|
3647
|
+
.dsht-np-folder-path{font-size:12px}
|
|
3648
|
+
.dsht-dialog-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:0}
|
|
3649
|
+
.dsht-dialog-actions>button{width:100%;height:44px;justify-content:center}
|
|
3650
|
+
|
|
3651
|
+
/* Project settings: one column, scrolling body, stacked title/control rows. */
|
|
3652
|
+
.dsht-settings.dsht-settings{width:calc(100vw - 24px);height:min(720px,calc(var(--dsh-web-mobile-vh,100dvh) - 24px))}
|
|
3653
|
+
.dsht-settings-layout{flex-direction:column;min-height:0}
|
|
3654
|
+
.dsht-settings-nav{width:auto;flex:none;flex-direction:row;gap:2px;overflow-x:auto;border-right:0;border-bottom:1px solid var(--dsht-line);padding:8px 10px;scrollbar-width:none}
|
|
3655
|
+
.dsht-settings-nav-title{display:none}
|
|
3656
|
+
.dsht-settings-nav-item{flex:none;height:38px;padding:0 12px}
|
|
3657
|
+
.dsht-settings-main{min-height:0}
|
|
3658
|
+
/* The active tab already names the section; keep the header row for its close button only. */
|
|
3659
|
+
.dsht-settings-head{justify-content:flex-end;padding:8px 12px 0}
|
|
3660
|
+
.dsht-settings-head .dsht-dialog-title{display:none}
|
|
3661
|
+
/* Menus opened from the plugin (recent folders, project actions) size to their content;
|
|
3662
|
+
a long folder path made them wider than the viewport and pushed the left edge offscreen. */
|
|
3663
|
+
.dsht-menu-two,.dsht-menu-sub{max-width:calc(100vw - 96px)}
|
|
3664
|
+
.dsht-settings-body{padding:4px 14px calc(20px + env(safe-area-inset-bottom,0px))}
|
|
3665
|
+
.dsht-setting-row{flex-direction:column;align-items:stretch;gap:10px;padding:14px 0}
|
|
3666
|
+
.dsht-setting-block{padding:14px 0}
|
|
3667
|
+
.dsht-name-field{width:100%}
|
|
3668
|
+
.dsht-select-box{width:100%}
|
|
3669
|
+
.dsht-setting-textarea{font-size:16px}
|
|
3670
|
+
.dsht-usage-total{gap:22px;flex-wrap:wrap}
|
|
3671
|
+
.dsht-usage-table{font-size:12px}
|
|
3672
|
+
.dsht-icon-grid{grid-template-columns:repeat(auto-fill,minmax(44px,1fr))}
|
|
3673
|
+
|
|
3674
|
+
/* Thread list and thread pane: the pane header's title, chips and three action buttons do not
|
|
3675
|
+
fit one 390px row, so the actions move under the title instead of squeezing it to "#1 重构…". */
|
|
3676
|
+
.dsht-list{padding-bottom:calc(16px + env(safe-area-inset-bottom,0px))}
|
|
3677
|
+
.dsht-pane-head{flex-wrap:wrap;row-gap:6px;padding:8px 10px;min-height:0}
|
|
3678
|
+
.dsht-pane-text{flex:1 1 calc(100% - 32px)}
|
|
3679
|
+
.dsht-pane-title{font-size:14px;line-height:20px}
|
|
3680
|
+
.dsht-pane-meta{font-size:11.5px;line-height:16px}
|
|
3681
|
+
.dsht-pane-actions{flex:1 1 100%;justify-content:flex-end;gap:6px}
|
|
3682
|
+
.dsht-pane-actions .dsht-pill{height:34px}
|
|
3683
|
+
}
|
|
3684
|
+
|
|
3685
|
+
/* Touch devices have no hover: a control that only faded in on hover could never be reached. */
|
|
3686
|
+
@media (hover:none){
|
|
3687
|
+
.dsht-project-tools{opacity:1}
|
|
3688
|
+
.dsht-side-actions{display:inline-flex}
|
|
3689
|
+
.dsht-side-label svg{opacity:1}
|
|
3690
|
+
.dsht-proposal-actions .dsht-pill-icon:first-child{opacity:1}
|
|
3691
|
+
.dsht-item-chevron{opacity:1;transform:none}
|
|
3692
|
+
}
|
|
3693
|
+
/* Thumb-sized targets on touch screens (the desktop sizes are pointer-sized by design). */
|
|
3694
|
+
@media (pointer:coarse){
|
|
3695
|
+
.dsht-icon-button{width:32px;height:32px}
|
|
3696
|
+
.dsht-pill{height:34px}
|
|
3697
|
+
.dsht-side-row{height:40px}
|
|
3698
|
+
.dsht-side-icon{width:32px;height:32px}
|
|
3699
|
+
.dsht-side-actions .dsht-icon-button{width:32px;height:32px}
|
|
3700
|
+
.dsht-np-link{min-height:32px;padding:4px 8px}
|
|
3701
|
+
.dsht-settings-nav-item{height:40px}
|
|
3702
|
+
.dsht-section-head{min-height:32px}
|
|
3703
|
+
.dsht-row{min-height:44px}
|
|
3704
|
+
.dsht-item{min-height:44px}
|
|
3705
|
+
}
|
|
3706
|
+
/* Short landscape (e.g. 667x375): the drawer does not scroll, and the host's own flex box already
|
|
3707
|
+
squeezes the workspace area to zero there. Keep this section small but usable — the header plus
|
|
3708
|
+
about one row, with the list scrolling internally — instead of letting it eat the drawer. */
|
|
3709
|
+
@media (pointer:coarse) and (max-height:520px){
|
|
3710
|
+
.dsht-side{flex:0 1 auto;min-height:76px;max-height:120px;overflow:hidden}
|
|
3711
|
+
.dsht-side-list{flex:1 1 auto}
|
|
3712
|
+
}
|
|
3713
|
+
`;
|
|
3714
|
+
/** Add the stylesheet; returns a disposer that removes it. */
|
|
3715
|
+
function injectStyles() {
|
|
3716
|
+
if (typeof document === "undefined") return () => {};
|
|
3717
|
+
if (document.querySelector(`style[data-plugin-css="${STYLE_ID}"]`) !== null) return () => {};
|
|
3718
|
+
const tag = document.createElement("style");
|
|
3719
|
+
tag.dataset.plugin = "@kyf-eng/dsh-threads";
|
|
3720
|
+
tag.dataset.pluginCss = STYLE_ID;
|
|
3721
|
+
tag.textContent = css;
|
|
3722
|
+
document.head.appendChild(tag);
|
|
3723
|
+
return () => {
|
|
3724
|
+
tag.remove();
|
|
3725
|
+
};
|
|
3726
|
+
}
|
|
3727
|
+
// src/client/ThreadChatTab.tsx
|
|
3728
|
+
/** Session-scoped child slot this tab declares; only the declaring entry may render it. */
|
|
3729
|
+
const THREAD_CONVERSATION_SLOT = "dsh-threads.chat.conversation";
|
|
3730
|
+
function ThreadChatTab({ useTabInfo, useResource, SessionProvider, renderSlot, useSessionStatus, t, openSession }) {
|
|
3731
|
+
const { tab } = useTabInfo();
|
|
3732
|
+
const threadId = parseThreadAddress(tab.contentId);
|
|
3733
|
+
const resource = useResource(tab.contentId);
|
|
3734
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3735
|
+
className: "dsht-chat",
|
|
3736
|
+
"data-dsh-threads-chat": "",
|
|
3737
|
+
children: [threadId === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadPaneHeader, {
|
|
3738
|
+
threadId,
|
|
3739
|
+
useSessionStatus,
|
|
3740
|
+
t,
|
|
3741
|
+
openSession
|
|
3742
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3743
|
+
className: "dsht-chat-body",
|
|
3744
|
+
children: resource.value === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SessionProvider, {
|
|
3745
|
+
session: resource.value.reference,
|
|
3746
|
+
children: renderSlot(THREAD_CONVERSATION_SLOT, {})
|
|
3747
|
+
})
|
|
3748
|
+
})]
|
|
3749
|
+
});
|
|
3750
|
+
}
|
|
3751
|
+
function ThreadPaneHeader({ threadId, useSessionStatus, t, openSession }) {
|
|
3752
|
+
const live = useLive(useSessionStatus);
|
|
3753
|
+
const running = live.running.has(threadId);
|
|
3754
|
+
const revision = useThreadsRevision();
|
|
3755
|
+
const thread = useHostValue("threads.get", { id: threadId }, [
|
|
3756
|
+
threadId,
|
|
3757
|
+
running,
|
|
3758
|
+
revision
|
|
3759
|
+
]);
|
|
3760
|
+
const [busy, setBusy] = (0, react.useState)(false);
|
|
3761
|
+
if (thread === void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "dsht-pane-head" });
|
|
3762
|
+
const act = (action) => {
|
|
3763
|
+
setBusy(true);
|
|
3764
|
+
action().catch(() => {}).finally(() => setBusy(false));
|
|
3765
|
+
};
|
|
3766
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3767
|
+
className: "dsht-pane-head",
|
|
3768
|
+
children: [
|
|
3769
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadGlyph, { state: glyphState(thread, running, live.asking.has(threadId)) }),
|
|
3770
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3771
|
+
className: "dsht-pane-text",
|
|
3772
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3773
|
+
className: "dsht-pane-title",
|
|
3774
|
+
title: thread.title,
|
|
3775
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
3776
|
+
className: "dsht-item-n",
|
|
3777
|
+
children: ["#", thread.n]
|
|
3778
|
+
}), thread.title]
|
|
3779
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3780
|
+
className: "dsht-pane-meta",
|
|
3781
|
+
children: [
|
|
3782
|
+
thread.projectTitle === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: thread.projectTitle }),
|
|
3783
|
+
thread.archived ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("pane.archived") }) : null,
|
|
3784
|
+
thread.worktree === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BranchChip, {
|
|
3785
|
+
branch: thread.worktree.branch,
|
|
3786
|
+
removed: thread.worktree.removed
|
|
3787
|
+
})
|
|
3788
|
+
]
|
|
3789
|
+
})]
|
|
3790
|
+
}),
|
|
3791
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3792
|
+
className: "dsht-pane-actions",
|
|
3793
|
+
children: [running ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pill, {
|
|
3794
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StopIcon, {}),
|
|
3795
|
+
disabled: busy,
|
|
3796
|
+
onClick: () => act(() => stopThread(threadId)),
|
|
3797
|
+
children: t("pane.stop")
|
|
3798
|
+
}) : thread.archived ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pill, {
|
|
3799
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ArchiveIcon, {}),
|
|
3800
|
+
disabled: busy,
|
|
3801
|
+
onClick: () => act(() => setThreadArchived(threadId, false)),
|
|
3802
|
+
children: t("pane.unarchive")
|
|
3803
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pill, {
|
|
3804
|
+
icon: thread.resolved ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReopenIcon, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckIcon, {}),
|
|
3805
|
+
disabled: busy,
|
|
3806
|
+
onClick: () => act(() => setThreadResolved(threadId, !thread.resolved)),
|
|
3807
|
+
children: thread.resolved ? t("pane.reopen") : t("pane.resolve")
|
|
3808
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pill, {
|
|
3809
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ArchiveIcon, {}),
|
|
3810
|
+
label: t("pane.archive"),
|
|
3811
|
+
disabled: busy,
|
|
3812
|
+
onClick: () => act(() => setThreadArchived(threadId, true))
|
|
3813
|
+
})] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pill, {
|
|
3814
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ExpandIcon, {}),
|
|
3815
|
+
onClick: () => openSession(threadId),
|
|
3816
|
+
children: t("pane.openMain")
|
|
3817
|
+
})]
|
|
3818
|
+
})
|
|
3819
|
+
]
|
|
3820
|
+
});
|
|
3821
|
+
}
|
|
3822
|
+
/** The embedded Conversation for the thread the tab's SessionProvider supplies. */
|
|
3823
|
+
function ThreadConversation({ sessionId, useSession, useConversation, useSessions, renderFactorySlot }) {
|
|
3824
|
+
const session = useSession((value) => value);
|
|
3825
|
+
const active = useConversation((value) => value.activeTargets.size > 0) || !session.blank && !session.awaitingFirstTurn || session.running;
|
|
3826
|
+
const summaryBlank = useSessions((state) => state.byId[sessionId]?.blank);
|
|
3827
|
+
return renderFactorySlot("conversation.content", {
|
|
3828
|
+
variant: "embedded",
|
|
3829
|
+
phase: !active && session.openState === "loading" && summaryBlank !== true ? "settling" : "active",
|
|
3830
|
+
hero: false
|
|
3831
|
+
}, { slots: { views: FixedChatConversationView } });
|
|
3832
|
+
}
|
|
3833
|
+
function FixedChatConversationView(props) {
|
|
3834
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: props.renderSlot("conversation.session", { view: "chat" }) });
|
|
3835
|
+
}
|
|
3836
|
+
/** Replaces the composer of a resolved thread (conversation.composer chain). */
|
|
3837
|
+
function ResolvedComposer({ sessionId, t }) {
|
|
3838
|
+
const [busy, setBusy] = (0, react.useState)(false);
|
|
3839
|
+
const [error, setError] = (0, react.useState)(null);
|
|
3840
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3841
|
+
className: "dsht-resolved",
|
|
3842
|
+
children: [
|
|
3843
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadGlyph, { state: "resolved" }),
|
|
3844
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
3845
|
+
className: "dsht-resolved-text",
|
|
3846
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: t("resolved.notice") }), error ?? t("resolved.hint")]
|
|
3847
|
+
}),
|
|
3848
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pill, {
|
|
3849
|
+
disabled: busy,
|
|
3850
|
+
onClick: () => {
|
|
3851
|
+
setBusy(true);
|
|
3852
|
+
setError(null);
|
|
3853
|
+
setThreadResolved(sessionId, false).catch((failure) => setError(failure instanceof Error ? failure.message : String(failure))).finally(() => setBusy(false));
|
|
3854
|
+
},
|
|
3855
|
+
children: t("resolved.reopen")
|
|
3856
|
+
})
|
|
3857
|
+
]
|
|
3858
|
+
});
|
|
3859
|
+
}
|
|
3860
|
+
// src/client/ThreadsList.tsx
|
|
3861
|
+
/** What the list says a thread waits for while it holds an approval, a question or a plan. */
|
|
3862
|
+
const ASK_KEYS = {
|
|
3863
|
+
approval: "ask.approval",
|
|
3864
|
+
question: "ask.question",
|
|
3865
|
+
"plan-review": "ask.planReview"
|
|
3866
|
+
};
|
|
3867
|
+
const stateIn = (live) => (thread) => glyphState(thread, live.running.has(thread.id), live.asking.has(thread.id));
|
|
3868
|
+
/** The project main conversation a session belongs to (itself, or the main of its thread). */
|
|
3869
|
+
function useProjectMain(sessionId, revision) {
|
|
3870
|
+
const role = useHostValue(sessionId === void 0 ? null : "sessions.role", { id: sessionId }, [sessionId, revision]);
|
|
3871
|
+
return {
|
|
3872
|
+
role,
|
|
3873
|
+
mainSessionId: role?.project?.mainSessionId
|
|
3874
|
+
};
|
|
3875
|
+
}
|
|
3876
|
+
function useThreads(mainSessionId, liveKey, revision) {
|
|
3877
|
+
return useHostValue(mainSessionId === void 0 ? null : "threads.list", { mainSessionId }, [
|
|
3878
|
+
mainSessionId,
|
|
3879
|
+
liveKey,
|
|
3880
|
+
revision
|
|
3881
|
+
]);
|
|
3882
|
+
}
|
|
3883
|
+
/**
|
|
3884
|
+
* The right-sidebar threads list, after Claude's threads panel: a title with search, then
|
|
3885
|
+
* sections (waiting for you, running, idle, resolved, archived) with counts, each foldable.
|
|
3886
|
+
* "Waiting" and "resolved" always show, with a dashed placeholder when empty.
|
|
3887
|
+
*/
|
|
3888
|
+
function ThreadsListTab({ sessionId, useSessionStatus, t, openThread, openSession }) {
|
|
3889
|
+
const revision = useThreadsRevision();
|
|
3890
|
+
const { role, mainSessionId } = useProjectMain(sessionId, revision);
|
|
3891
|
+
const live = useLive(useSessionStatus);
|
|
3892
|
+
const threads = useThreads(mainSessionId, live.key, revision);
|
|
3893
|
+
const [query, setQuery] = (0, react.useState)(null);
|
|
3894
|
+
const [folded, setFolded] = (0, react.useState)({ archived: true });
|
|
3895
|
+
if (role === void 0) return null;
|
|
3896
|
+
if (role.project === null) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3897
|
+
className: "dsht-tab",
|
|
3898
|
+
children: t("list.notProject")
|
|
3899
|
+
});
|
|
3900
|
+
const stateOf = stateIn(live);
|
|
3901
|
+
const groups = groupThreads(threads ?? [], stateOf, query ?? "");
|
|
3902
|
+
const searching = (query ?? "").trim().length > 0;
|
|
3903
|
+
const nothing = searching && Object.values(groups).every((list) => list.length === 0);
|
|
3904
|
+
const section = (id, label, list, empty) => {
|
|
3905
|
+
if (list.length === 0 && (empty === void 0 || searching)) return null;
|
|
3906
|
+
const open = list.length > 0 && folded[id] !== true;
|
|
3907
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
3908
|
+
className: `dsht-section dsht-section-${id}`,
|
|
3909
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
3910
|
+
type: "button",
|
|
3911
|
+
className: `dsht-section-head${open ? " is-open" : ""}`,
|
|
3912
|
+
"aria-expanded": open,
|
|
3913
|
+
disabled: list.length === 0,
|
|
3914
|
+
onClick: () => setFolded((current) => ({
|
|
3915
|
+
...current,
|
|
3916
|
+
[id]: open
|
|
3917
|
+
})),
|
|
3918
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
3919
|
+
label,
|
|
3920
|
+
" · ",
|
|
3921
|
+
list.length
|
|
3922
|
+
] }), list.length === 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChevronIcon, {})]
|
|
3923
|
+
}), list.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3924
|
+
className: "dsht-section-empty",
|
|
3925
|
+
children: empty
|
|
3926
|
+
}) : open ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3927
|
+
className: "dsht-rows",
|
|
3928
|
+
children: list.map((thread) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadRow, {
|
|
3929
|
+
thread,
|
|
3930
|
+
state: stateOf(thread),
|
|
3931
|
+
asking: live.asking.get(thread.id),
|
|
3932
|
+
t,
|
|
3933
|
+
onOpen: () => openThread(thread.id)
|
|
3934
|
+
}, thread.id))
|
|
3935
|
+
}) : null]
|
|
3936
|
+
}, id);
|
|
3937
|
+
};
|
|
3938
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3939
|
+
className: "dsht-list",
|
|
3940
|
+
children: [
|
|
3941
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3942
|
+
className: "dsht-list-top",
|
|
3943
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3944
|
+
className: "dsht-list-title",
|
|
3945
|
+
children: t("list.title")
|
|
3946
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3947
|
+
className: "dsht-list-tools",
|
|
3948
|
+
children: [role.thread ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
3949
|
+
size: "sm",
|
|
3950
|
+
variant: "ghost",
|
|
3951
|
+
onClick: () => openSession(role.project.mainSessionId),
|
|
3952
|
+
children: t("header.backToMain")
|
|
3953
|
+
}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pill, {
|
|
3954
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchIcon, { size: 15 }),
|
|
3955
|
+
label: t("list.search"),
|
|
3956
|
+
onClick: () => setQuery((current) => current === null ? "" : null)
|
|
3957
|
+
})]
|
|
3958
|
+
})]
|
|
3959
|
+
}),
|
|
3960
|
+
query === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
3961
|
+
className: "dsht-list-search",
|
|
3962
|
+
autoFocus: true,
|
|
3963
|
+
value: query,
|
|
3964
|
+
placeholder: t("list.search"),
|
|
3965
|
+
"aria-label": t("list.search"),
|
|
3966
|
+
onChange: (event) => setQuery(event.target.value),
|
|
3967
|
+
onKeyDown: (event) => {
|
|
3968
|
+
if (event.key === "Escape") setQuery(null);
|
|
3969
|
+
}
|
|
3970
|
+
}),
|
|
3971
|
+
threads === void 0 ? null : nothing ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3972
|
+
className: "dsht-tab",
|
|
3973
|
+
children: t("list.noMatch")
|
|
3974
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
3975
|
+
section("waiting", t("list.waiting"), groups.waiting, t("list.waitingEmpty")),
|
|
3976
|
+
section("running", t("list.running"), groups.running),
|
|
3977
|
+
section("idle", t("list.idle"), groups.idle),
|
|
3978
|
+
section("resolved", t("list.resolvedSection"), groups.resolved, t("list.resolvedEmpty")),
|
|
3979
|
+
section("archived", t("list.archivedSection"), groups.archived)
|
|
3980
|
+
] })
|
|
3981
|
+
]
|
|
3982
|
+
});
|
|
3983
|
+
}
|
|
3984
|
+
/** One thread in the list: state mark, number and title, time; what it waits on; its files and branch. */
|
|
3985
|
+
function ThreadRow({ thread, state, asking, t, onOpen }) {
|
|
3986
|
+
const report = thread.lastReport;
|
|
3987
|
+
const files = report?.changedFiles ?? [];
|
|
3988
|
+
const branch = thread.worktree === null || thread.worktree.removed ? void 0 : thread.worktree.branch;
|
|
3989
|
+
const decision = asking !== void 0 ? t(ASK_KEYS[asking]) : state === "waiting" ? report?.decisions[0] ?? report?.summary : void 0;
|
|
3990
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3991
|
+
className: `dsht-row dsht-row-${state}`,
|
|
3992
|
+
role: "button",
|
|
3993
|
+
tabIndex: 0,
|
|
3994
|
+
onClick: onOpen,
|
|
3995
|
+
onKeyDown: (event) => {
|
|
3996
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
3997
|
+
event.preventDefault();
|
|
3998
|
+
onOpen();
|
|
3999
|
+
}
|
|
4000
|
+
},
|
|
4001
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadGlyph, { state }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4002
|
+
className: "dsht-row-body",
|
|
4003
|
+
children: [
|
|
4004
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4005
|
+
className: "dsht-row-top",
|
|
4006
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
4007
|
+
className: "dsht-row-title",
|
|
4008
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
4009
|
+
className: "dsht-item-n",
|
|
4010
|
+
children: ["#", thread.n]
|
|
4011
|
+
}), thread.title]
|
|
4012
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4013
|
+
className: "dsht-row-time",
|
|
4014
|
+
children: relativeTime(t, thread.updatedAt)
|
|
4015
|
+
})]
|
|
4016
|
+
}),
|
|
4017
|
+
decision === void 0 || decision.length === 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4018
|
+
className: "dsht-row-decision",
|
|
4019
|
+
children: decision
|
|
4020
|
+
}),
|
|
4021
|
+
files.length === 0 && branch === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4022
|
+
className: "dsht-row-chips",
|
|
4023
|
+
children: [files.length === 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
4024
|
+
className: "dsht-chip dsht-count",
|
|
4025
|
+
title: files.join("\n"),
|
|
4026
|
+
"aria-label": t("list.files", { count: files.length }),
|
|
4027
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FileIcon, { kind: "doc" }), files.length]
|
|
4028
|
+
}), branch === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BranchChip, { branch })]
|
|
4029
|
+
})
|
|
4030
|
+
]
|
|
4031
|
+
})]
|
|
4032
|
+
});
|
|
4033
|
+
}
|
|
4034
|
+
/** Conversation header: "讨论串 · N" in a project main conversation, "主对话" in a thread. */
|
|
4035
|
+
function ThreadsHeaderAction({ sessionId, useSessionStatus, t, openThreadsList, openSession }) {
|
|
4036
|
+
const revision = useThreadsRevision();
|
|
4037
|
+
const { role, mainSessionId } = useProjectMain(sessionId, revision);
|
|
4038
|
+
const isMain = mainSessionId !== void 0 && mainSessionId === sessionId;
|
|
4039
|
+
const live = useLive(useSessionStatus);
|
|
4040
|
+
const threads = useThreads(isMain ? mainSessionId : void 0, live.key, revision);
|
|
4041
|
+
if (role === void 0 || role.project === null) return null;
|
|
4042
|
+
if (role.thread) {
|
|
4043
|
+
const main = role.project.mainSessionId;
|
|
4044
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
4045
|
+
size: "sm",
|
|
4046
|
+
variant: "ghost",
|
|
4047
|
+
onClick: () => openSession(main),
|
|
4048
|
+
children: t("header.backToMain")
|
|
4049
|
+
});
|
|
4050
|
+
}
|
|
4051
|
+
if (!isMain) return null;
|
|
4052
|
+
const count = threads?.filter((thread) => !thread.archived).length ?? 0;
|
|
4053
|
+
const active = threads?.filter((thread) => thread.status === "running" || thread.status === "starting").length ?? 0;
|
|
4054
|
+
const waiting = threads?.filter((thread) => stateIn(live)(thread) === "waiting").length ?? 0;
|
|
4055
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
4056
|
+
size: "sm",
|
|
4057
|
+
variant: "ghost",
|
|
4058
|
+
icon: waiting > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadGlyph, { state: "waiting" }) : active > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadGlyph, { state: "running" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadsIcon, { size: 14 }),
|
|
4059
|
+
onClick: openThreadsList,
|
|
4060
|
+
children: [t("header.threads", { count }), waiting > 0 ? ` · ${t("header.waiting", { count: waiting })}` : active > 0 ? ` · ${t("header.running", { count: active })}` : ""]
|
|
4061
|
+
});
|
|
4062
|
+
}
|
|
4063
|
+
// src/client/index.tsx
|
|
4064
|
+
/** Sidebar entry id and `main` panel key. */
|
|
4065
|
+
const PANEL_ID = "dsh-threads-projects";
|
|
4066
|
+
/** Right-sidebar tab types: the thread list (kind `dsh-threads`) and one thread's conversation. */
|
|
4067
|
+
const LIST_TAB_ID = "@kyf-eng/dsh-threads";
|
|
4068
|
+
const LIST_TAB_KIND = "dsh-threads";
|
|
4069
|
+
const CHAT_TAB_ID = "@kyf-eng/dsh-threads/chat";
|
|
4070
|
+
const CHAT_TAB_KIND = "dsh-threads.chat";
|
|
4071
|
+
const inject = [
|
|
4072
|
+
"slots",
|
|
4073
|
+
"locale",
|
|
4074
|
+
"layout",
|
|
4075
|
+
"uiWorkspace",
|
|
4076
|
+
"workspaces",
|
|
4077
|
+
"sessions",
|
|
4078
|
+
"resources",
|
|
4079
|
+
"sidebarRight",
|
|
4080
|
+
"sidebarRightTabs",
|
|
4081
|
+
"uiSession",
|
|
4082
|
+
"uiConversation"
|
|
4083
|
+
];
|
|
4084
|
+
function PanelIcon({ size }) {
|
|
4085
|
+
const ref = useSidebarAnchor(size);
|
|
4086
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4087
|
+
ref,
|
|
4088
|
+
className: "dsht-panel-icon",
|
|
4089
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProjectsIcon, { size })
|
|
4090
|
+
});
|
|
4091
|
+
}
|
|
4092
|
+
function waitForAbort(signal) {
|
|
4093
|
+
if (signal.aborted) return Promise.resolve();
|
|
4094
|
+
return new Promise((resolve) => signal.addEventListener("abort", () => resolve(), { once: true }));
|
|
4095
|
+
}
|
|
4096
|
+
function apply(root) {
|
|
4097
|
+
const ctx = root;
|
|
4098
|
+
ctx.effect(() => injectStyles(), "dsh-threads: styles");
|
|
4099
|
+
ctx.effect(() => ctx.locale.register(NS, {
|
|
4100
|
+
zh,
|
|
4101
|
+
en
|
|
4102
|
+
}), "dsh-threads: locale");
|
|
4103
|
+
const t = ctx.locale.bind(NS);
|
|
4104
|
+
ctx.effect(() => sendLocaleToHost(() => ctx.locale.getLocale().active), "dsh-threads: host locale");
|
|
4105
|
+
ctx.on("locale/change", () => {
|
|
4106
|
+
callHost("ping").catch(() => {});
|
|
4107
|
+
});
|
|
4108
|
+
const openSession = (sessionId) => ctx.uiWorkspace.openSession(sessionId);
|
|
4109
|
+
const pinSession = (sessionId, pinned) => pinned ? ctx.workspaces.pinSession(sessionId) : ctx.workspaces.unpinSession(sessionId);
|
|
4110
|
+
const showProjects = () => ctx.layout.selectPanel(PANEL_ID);
|
|
4111
|
+
const closePhoneDrawer = () => {
|
|
4112
|
+
const frame = document.querySelector("[data-mobile-nav=\"frame\"]");
|
|
4113
|
+
if (frame === null || frame.hasAttribute("data-sidebar-collapsed")) return;
|
|
4114
|
+
ctx.layout.toggleSidebar();
|
|
4115
|
+
};
|
|
4116
|
+
const pickFolder = async () => {
|
|
4117
|
+
const desktop = globalThis.__DSH_DIRECTORY_PICKER__;
|
|
4118
|
+
if (desktop !== void 0) return desktop.pick();
|
|
4119
|
+
try {
|
|
4120
|
+
return await ctx.uiWorkspace.pickDirectory();
|
|
4121
|
+
} catch (error) {
|
|
4122
|
+
if (pickerUnavailable(error)) return "unavailable";
|
|
4123
|
+
throw error;
|
|
4124
|
+
}
|
|
4125
|
+
};
|
|
4126
|
+
const openThread = (threadId) => ctx.sidebarRight.openResource(threadAddress(threadId), { kind: CHAT_TAB_KIND });
|
|
4127
|
+
const openThreadsList = () => ctx.sidebarRight.openTab(LIST_TAB_KIND);
|
|
4128
|
+
ctx.slots.inject("main", () => ctx.slots.register({
|
|
4129
|
+
name: "main",
|
|
4130
|
+
key: PANEL_ID,
|
|
4131
|
+
locale: NS,
|
|
4132
|
+
inject: () => ({
|
|
4133
|
+
openSession,
|
|
4134
|
+
pinSession,
|
|
4135
|
+
pickFolder,
|
|
4136
|
+
showProjects
|
|
4137
|
+
})
|
|
4138
|
+
}, ProjectsPage));
|
|
4139
|
+
ctx.slots.inject("sidebar.panellist", () => ctx.slots.register({
|
|
4140
|
+
name: "sidebar.panellist",
|
|
4141
|
+
id: PANEL_ID,
|
|
4142
|
+
order: 20,
|
|
4143
|
+
locale: NS,
|
|
4144
|
+
label: () => t("panel")
|
|
4145
|
+
}, PanelIcon));
|
|
4146
|
+
ctx.slots.inject("shell.overlay", () => ctx.slots.register({
|
|
4147
|
+
name: "shell.overlay",
|
|
4148
|
+
id: "dsh-threads-sidebar-projects",
|
|
4149
|
+
locale: NS,
|
|
4150
|
+
inject: () => ({
|
|
4151
|
+
openSession,
|
|
4152
|
+
pinSession,
|
|
4153
|
+
pickFolder,
|
|
4154
|
+
selectPanel: (panelId) => ctx.layout.selectPanel(panelId),
|
|
4155
|
+
closePhoneDrawer
|
|
4156
|
+
})
|
|
4157
|
+
}, SidebarProjectsHost));
|
|
4158
|
+
ctx.slots.inject("sidebar.workspaces.session.menu.item", () => ctx.slots.register({
|
|
4159
|
+
name: "sidebar.workspaces.session.menu.item",
|
|
4160
|
+
id: "dsh-threads-make-project",
|
|
4161
|
+
order: 150,
|
|
4162
|
+
locale: NS,
|
|
4163
|
+
inject: () => ({ showProjects })
|
|
4164
|
+
}, MakeProjectMenuItem));
|
|
4165
|
+
ctx.effect(() => ctx.resources.register({
|
|
4166
|
+
protocol: "dsh-threads",
|
|
4167
|
+
async *open(address, { signal }) {
|
|
4168
|
+
const threadId = parseThreadAddress(address);
|
|
4169
|
+
if (threadId === void 0) throw new Error(`dsh-threads: invalid thread address "${address}"`);
|
|
4170
|
+
if (signal.aborted) return;
|
|
4171
|
+
const reference = ctx.sessions.retain(threadId, {
|
|
4172
|
+
source: "dshThreads",
|
|
4173
|
+
signal
|
|
4174
|
+
});
|
|
4175
|
+
try {
|
|
4176
|
+
yield {
|
|
4177
|
+
ok: true,
|
|
4178
|
+
value: {
|
|
4179
|
+
threadId,
|
|
4180
|
+
reference
|
|
4181
|
+
}
|
|
4182
|
+
};
|
|
4183
|
+
await waitForAbort(signal);
|
|
4184
|
+
} finally {
|
|
4185
|
+
reference.release();
|
|
4186
|
+
}
|
|
4187
|
+
}
|
|
4188
|
+
}), "dsh-threads: thread resources");
|
|
4189
|
+
ctx.effect(() => ctx.sidebarRightTabs.register({
|
|
4190
|
+
id: CHAT_TAB_ID,
|
|
4191
|
+
kind: CHAT_TAB_KIND,
|
|
4192
|
+
patterns: [THREAD_ADDRESS_PATTERN],
|
|
4193
|
+
canOpen: (address) => parseThreadAddress(address) !== void 0,
|
|
4194
|
+
title: (address) => {
|
|
4195
|
+
const id = parseThreadAddress(address);
|
|
4196
|
+
return (id === void 0 ? void 0 : ctx.sessions.list.getSnapshot().byId[id]?.displayTitle) ?? t("tab.thread");
|
|
4197
|
+
}
|
|
4198
|
+
}), "dsh-threads: thread tab type");
|
|
4199
|
+
ctx.slots.inject("sidebar.right.pane.tab", () => ctx.slots.register({
|
|
4200
|
+
name: "sidebar.right.pane.tab",
|
|
4201
|
+
key: CHAT_TAB_ID,
|
|
4202
|
+
locale: NS,
|
|
4203
|
+
inject: () => ({ openSession }),
|
|
4204
|
+
children: { [THREAD_CONVERSATION_SLOT]: {
|
|
4205
|
+
kind: "single",
|
|
4206
|
+
scope: "session"
|
|
4207
|
+
} }
|
|
4208
|
+
}, ThreadChatTab));
|
|
4209
|
+
ctx.slots.inject(THREAD_CONVERSATION_SLOT, () => ctx.slots.register({ name: THREAD_CONVERSATION_SLOT }, ThreadConversation));
|
|
4210
|
+
ctx.effect(() => ctx.sidebarRightTabs.register({
|
|
4211
|
+
id: LIST_TAB_ID,
|
|
4212
|
+
kind: LIST_TAB_KIND,
|
|
4213
|
+
title: () => t("tab.title"),
|
|
4214
|
+
guide: [{
|
|
4215
|
+
id: "open",
|
|
4216
|
+
order: 70,
|
|
4217
|
+
title: () => t("tab.title"),
|
|
4218
|
+
description: () => t("tab.description")
|
|
4219
|
+
}]
|
|
4220
|
+
}), "dsh-threads: thread list tab type");
|
|
4221
|
+
ctx.slots.inject("sidebar.right.pane.tab", () => ctx.slots.register({
|
|
4222
|
+
name: "sidebar.right.pane.tab",
|
|
4223
|
+
key: LIST_TAB_ID,
|
|
4224
|
+
locale: NS,
|
|
4225
|
+
inject: (sessionId) => ({
|
|
4226
|
+
sessionId,
|
|
4227
|
+
openThread,
|
|
4228
|
+
openSession
|
|
4229
|
+
})
|
|
4230
|
+
}, ThreadsListTab));
|
|
4231
|
+
ctx.slots.inject("conversation.session.header.actions", () => ctx.slots.register({
|
|
4232
|
+
name: "conversation.session.header.actions",
|
|
4233
|
+
id: "dsh-threads",
|
|
4234
|
+
order: 15,
|
|
4235
|
+
locale: NS,
|
|
4236
|
+
inject: () => ({
|
|
4237
|
+
openThreadsList,
|
|
4238
|
+
openSession
|
|
4239
|
+
})
|
|
4240
|
+
}, ThreadsHeaderAction));
|
|
4241
|
+
ctx.uiConversation.events.register(noticeDefinition);
|
|
4242
|
+
ctx.uiConversation.events.register(openedDefinition);
|
|
4243
|
+
ctx.uiConversation.events.register(threadCommandDefinition);
|
|
4244
|
+
ctx.slots.inject("conversation.chat.node", () => ctx.slots.register({
|
|
4245
|
+
name: "conversation.chat.node",
|
|
4246
|
+
key: NOTICE_NODE,
|
|
4247
|
+
locale: NS,
|
|
4248
|
+
inject: () => ({ openThread })
|
|
4249
|
+
}, NoticeCard));
|
|
4250
|
+
ctx.slots.inject("conversation.chat.node", () => ctx.slots.register({
|
|
4251
|
+
name: "conversation.chat.node",
|
|
4252
|
+
key: COMMAND_NODE,
|
|
4253
|
+
locale: NS,
|
|
4254
|
+
inject: () => ({ openThread })
|
|
4255
|
+
}, CommandThreadCard));
|
|
4256
|
+
ctx.slots.inject("conversation.chat.turnTail", () => ctx.slots.register({
|
|
4257
|
+
name: "conversation.chat.turnTail",
|
|
4258
|
+
id: OPENED_KEY,
|
|
4259
|
+
order: 25,
|
|
4260
|
+
locale: NS,
|
|
4261
|
+
inject: (sessionId) => ({
|
|
4262
|
+
sessionId,
|
|
4263
|
+
openThread
|
|
4264
|
+
})
|
|
4265
|
+
}, TurnThreadsCard));
|
|
4266
|
+
ctx.slots.inject("conversation.input.dock", () => ctx.slots.register({
|
|
4267
|
+
name: "conversation.input.dock",
|
|
4268
|
+
id: "dsh-threads-proposals",
|
|
4269
|
+
order: 15,
|
|
4270
|
+
locale: NS,
|
|
4271
|
+
inject: (sessionId) => ({ sessionId })
|
|
4272
|
+
}, ProposalsDock));
|
|
4273
|
+
ctx.effect(() => syncKinds(ctx.uiSession.sessionStatus), "dsh-threads: session kinds");
|
|
4274
|
+
ctx.effect(() => startNotifications({
|
|
4275
|
+
status: ctx.uiSession.sessionStatus,
|
|
4276
|
+
openSession,
|
|
4277
|
+
openThread,
|
|
4278
|
+
t
|
|
4279
|
+
}), "dsh-threads: notifications");
|
|
4280
|
+
const publishResolved = ctx.uiSession.registerPendingInteraction(() => 0);
|
|
4281
|
+
ctx.effect(() => syncResolved(publishResolved, ctx.uiSession.sessionStatus), "dsh-threads: resolved threads");
|
|
4282
|
+
ctx.slots.inject("conversation.composer", () => ctx.slots.register({
|
|
4283
|
+
name: "conversation.composer",
|
|
4284
|
+
select: ({ pendingInteraction }) => pendingInteraction?.kind === "dsh-threads-resolved" ? pendingInteraction : null,
|
|
4285
|
+
locale: NS
|
|
4286
|
+
}, ResolvedComposer));
|
|
4287
|
+
}
|
|
4288
|
+
exports.apply = apply;
|
|
4289
|
+
exports.inject = inject;
|
|
4290
|
+
|
|
4291
|
+
return module.exports;
|
|
4292
|
+
}
|
|
4293
|
+
// ===== END VENDORED @kyf-eng/dsh-threads client =====
|
|
4294
|
+
|
|
4295
|
+
// ---------- vendored discussion threads: the gate ----------
|
|
4296
|
+
//
|
|
4297
|
+
// vendor/dsh-threads/ carries the upstream browser half; it is mounted here,
|
|
4298
|
+
// inside OUR bundle, because a package can only expose one client entry
|
|
4299
|
+
// (docs/vendoring-feasibility.md). Mounting it next to the real package would
|
|
4300
|
+
// register the same slots twice, so the host decides who owns the thread half
|
|
4301
|
+
// (src/threads-vendor.js) and this side only follows the answer:
|
|
4302
|
+
// "vendored" → mount, anything else — including "could not read" — → stay out.
|
|
4303
|
+
//
|
|
4304
|
+
// The answer is read asynchronously and our own surfaces do not wait for it:
|
|
4305
|
+
// a slow or missing route must never cost the project board, only the
|
|
4306
|
+
// optional thread tabs.
|
|
4307
|
+
const THREADS_OWNER_ROUTE = "/project-hub/runtime";
|
|
4308
|
+
/** One attempt per page load; a later snapshot cannot resurrect a decided role. */
|
|
4309
|
+
let vendoredThreadsMounted = false;
|
|
4310
|
+
|
|
4311
|
+
/**
|
|
4312
|
+
* Whether this page may mount the vendored threads half.
|
|
4313
|
+
*
|
|
4314
|
+
* Only an explicit "vendored" mounts it: "upstream", "unknown" and "the host
|
|
4315
|
+
* did not answer" all mean "not ours". Double registration is the failure this
|
|
4316
|
+
* whole switch exists to prevent, so the default is to stay out.
|
|
4317
|
+
*/
|
|
4318
|
+
function shouldMountThreads(owner) {
|
|
4319
|
+
return owner === "vendored";
|
|
4320
|
+
}
|
|
4321
|
+
|
|
4322
|
+
/** The host's answer for "who owns the thread half", or null. */
|
|
4323
|
+
async function readThreadsOwner() {
|
|
4324
|
+
const abort = typeof AbortController === "function" ? new AbortController() : null;
|
|
4325
|
+
const timer = abort === null ? null : setTimeout(() => abort.abort(), 2500);
|
|
4326
|
+
try {
|
|
4327
|
+
const response = await fetch(THREADS_OWNER_ROUTE, {
|
|
4328
|
+
method: "GET",
|
|
4329
|
+
headers: { accept: "application/json" },
|
|
4330
|
+
...(abort === null ? {} : { signal: abort.signal })
|
|
4331
|
+
});
|
|
4332
|
+
if (!response.ok) return null;
|
|
4333
|
+
const body = await response.json();
|
|
4334
|
+
const owner = body?.threads?.owner;
|
|
4335
|
+
return typeof owner === "string" && owner.length > 0 ? owner : null;
|
|
4336
|
+
} catch {
|
|
4337
|
+
return null;
|
|
4338
|
+
} finally {
|
|
4339
|
+
if (timer !== null) clearTimeout(timer);
|
|
4340
|
+
}
|
|
4341
|
+
}
|
|
4342
|
+
|
|
4343
|
+
/**
|
|
4344
|
+
* Mount the vendored threads half when — and only when — it is ours to mount.
|
|
4345
|
+
*
|
|
4346
|
+
* Never throws: a bundle that cannot start the thread tabs must still leave
|
|
4347
|
+
* the project board working, which is the whole point of carrying both.
|
|
4348
|
+
*/
|
|
4349
|
+
function mountVendoredThreads(ctx) {
|
|
4350
|
+
if (vendoredThreadsMounted) return;
|
|
4351
|
+
vendoredThreadsMounted = true;
|
|
4352
|
+
readThreadsOwner().then(
|
|
4353
|
+
(owner) => {
|
|
4354
|
+
if (!shouldMountThreads(owner)) {
|
|
4355
|
+
warn(
|
|
4356
|
+
"discussion threads are not ours to mount (" + (owner === null ? "the host did not say" : owner) + "); leaving the thread tabs to whoever owns them"
|
|
4357
|
+
);
|
|
4358
|
+
return;
|
|
4359
|
+
}
|
|
4360
|
+
try {
|
|
4361
|
+
loadVendoredThreadsClient(require).apply(ctx);
|
|
4362
|
+
} catch (error) {
|
|
4363
|
+
warn("the vendored dsh-threads did not mount", error);
|
|
4364
|
+
}
|
|
4365
|
+
},
|
|
4366
|
+
(error) => warn("could not read who owns the discussion threads", error)
|
|
4367
|
+
);
|
|
4368
|
+
}
|
|
4369
|
+
|
|
4370
|
+
|
|
31
4371
|
// ---------- routes, slots, storage keys ----------
|
|
32
4372
|
const ROUTE = "/project-hub/board";
|
|
33
4373
|
const FOLDERS_ROUTE = "/project-hub/folders";
|
|
34
4374
|
const SETTINGS_ROUTE = "/project-hub/settings";
|
|
4375
|
+
const THREADS_INSTALL_ROUTE = "/project-hub/threads-install";
|
|
35
4376
|
const TAB_ID = "project-hub";
|
|
36
4377
|
const TAB_KIND = "project-hub";
|
|
37
4378
|
const TAB_ICON = "▤";
|
|
38
4379
|
const SETTINGS_SECTION_ID = "project-folders";
|
|
4380
|
+
/** shell.overlay id; prefixed so it can never collide with another bundle. */
|
|
4381
|
+
const OVERLAY_ID = "project-hub-folders";
|
|
4382
|
+
/** The dsh-threads release this plugin was verified against (host: src/threads-probe.js). */
|
|
4383
|
+
const THREADS_BASELINE = "0.2.0";
|
|
39
4384
|
/** Marks a button this plugin injected into foreign DOM; also the idempotency check. */
|
|
40
4385
|
const INJECT_ATTR = "data-project-hub-more";
|
|
41
4386
|
/** Locale namespace registered with the DSH locale service. */
|
|
@@ -69,6 +4414,27 @@ window.__ModuleLoader__.load({
|
|
|
69
4414
|
"board.loading": "读取中…",
|
|
70
4415
|
"board.failed": "读取失败:{error}",
|
|
71
4416
|
"board.empty": "还没有 dsh-threads 项目",
|
|
4417
|
+
"board.noThreads.title": "未检测到 @kyf-eng/dsh-threads",
|
|
4418
|
+
"board.noThreads.body": "讨论串和任务由 dsh-threads 提供:装上它,这里才会显示讨论串、任务和项目卡片。",
|
|
4419
|
+
"board.noThreads.works": "现在就能用:知识库(kb_*)、上下文简报(context_brief 或 /hub brief)、项目文件夹与辅助文件夹挂载、/hub 命令。",
|
|
4420
|
+
"board.noThreads.hint": "安装:在 DSH 的插件市场里搜索 @kyf-eng/dsh-threads 安装,然后完全退出 DSH 再启动。",
|
|
4421
|
+
"board.noThreads.leftover": "磁盘上还有 {count} 条它留下的项目记录,看板先不显示;装回 dsh-threads 后它们会重新出现。",
|
|
4422
|
+
"board.install.button": "一键安装 dsh-threads(钉版 {tag})",
|
|
4423
|
+
"board.install.confirm": "确认安装:会写入本机 profile「{profile}」,由 DSH 自己完成安装与失败回滚",
|
|
4424
|
+
"board.install.enableButton": "包已经在了,一键启用",
|
|
4425
|
+
"board.install.running": "安装中…(可能要几十秒,别关页面)",
|
|
4426
|
+
"board.install.applied": "装好了:dsh-threads 已加载,看板马上刷新。",
|
|
4427
|
+
"board.install.restart": "已写入 profile,DSH 需要重启一次才生效。",
|
|
4428
|
+
"board.install.skip": "已经装过 dsh-threads 了,跳过这一步。",
|
|
4429
|
+
"board.install.failed": "安装没成功:{error}",
|
|
4430
|
+
"board.install.buildBlocked": "pnpm 拦下了安装脚本 {list}:到 profile 的 pnpm-workspace.yaml 里 allowBuilds 放行,再点一次。",
|
|
4431
|
+
"board.install.pnpmMissing": "这台机器找不到 pnpm:先装 pnpm,再点一次。",
|
|
4432
|
+
"board.install.manual": "也可以手动装:{command}",
|
|
4433
|
+
"board.install.manualMarket": "这个 profile(桌面版)只能从 DSH 的插件市场装,或点上面的按钮。",
|
|
4434
|
+
"board.install.copy": "复制安装命令",
|
|
4435
|
+
"board.install.copied": "已复制",
|
|
4436
|
+
"board.install.configured": "profile 里已经配置好了,重启 DSH 后生效。",
|
|
4437
|
+
"board.versionWarn": "已安装的 dsh-threads 是 {version};本插件只在 {baseline} 上验证过,行为可能不同(不阻断使用)。",
|
|
72
4438
|
"board.section.others": "其他项目 · {count}",
|
|
73
4439
|
"board.section.all": "项目 · {count}",
|
|
74
4440
|
"board.expand": "展开",
|
|
@@ -168,6 +4534,27 @@ window.__ModuleLoader__.load({
|
|
|
168
4534
|
"board.loading": "Loading…",
|
|
169
4535
|
"board.failed": "Could not load: {error}",
|
|
170
4536
|
"board.empty": "No dsh-threads projects yet",
|
|
4537
|
+
"board.noThreads.title": "@kyf-eng/dsh-threads not detected",
|
|
4538
|
+
"board.noThreads.body": "Threads and tasks come from dsh-threads: install it and this page shows your threads, tasks and project cards.",
|
|
4539
|
+
"board.noThreads.works": "Works right now: the knowledge base (kb_*), the context brief (context_brief or /hub brief), project folders and extra-folder mounts, and the /hub command.",
|
|
4540
|
+
"board.noThreads.hint": "To install: search @kyf-eng/dsh-threads in the DSH plugin market, install it, then quit DSH completely and start it again.",
|
|
4541
|
+
"board.noThreads.leftover": "{count} project records it left on disk are not shown on the board; they reappear once dsh-threads is installed again.",
|
|
4542
|
+
"board.install.button": "Install dsh-threads (pinned {tag})",
|
|
4543
|
+
"board.install.confirm": "Confirm: writes into this machine's profile \"{profile}\"; DSH runs the install and rolls it back if it fails",
|
|
4544
|
+
"board.install.enableButton": "The package is here — enable it",
|
|
4545
|
+
"board.install.running": "Installing… (may take a while; keep this page open)",
|
|
4546
|
+
"board.install.applied": "Installed: dsh-threads is live, refreshing the board.",
|
|
4547
|
+
"board.install.restart": "Saved to the profile; DSH has to restart once to apply it.",
|
|
4548
|
+
"board.install.skip": "dsh-threads is already installed — nothing to do.",
|
|
4549
|
+
"board.install.failed": "Install did not finish: {error}",
|
|
4550
|
+
"board.install.buildBlocked": "pnpm blocked the install scripts {list}: allow them under allowBuilds in the profile's pnpm-workspace.yaml, then click again.",
|
|
4551
|
+
"board.install.pnpmMissing": "pnpm is not available on this machine: install pnpm, then click again.",
|
|
4552
|
+
"board.install.manual": "Or install it by hand: {command}",
|
|
4553
|
+
"board.install.manualMarket": "This profile (Desktop) can only be installed from DSH's plugin market, or with the button above.",
|
|
4554
|
+
"board.install.copy": "Copy install command",
|
|
4555
|
+
"board.install.copied": "Copied",
|
|
4556
|
+
"board.install.configured": "The profile is already configured; restart DSH to apply it.",
|
|
4557
|
+
"board.versionWarn": "Installed dsh-threads is {version}; this plugin was verified on {baseline} only, so behaviour may differ (nothing is blocked).",
|
|
171
4558
|
"board.section.others": "Other projects · {count}",
|
|
172
4559
|
"board.section.all": "Projects · {count}",
|
|
173
4560
|
"board.expand": "Expand",
|
|
@@ -513,7 +4900,108 @@ window.__ModuleLoader__.load({
|
|
|
513
4900
|
}
|
|
514
4901
|
|
|
515
4902
|
function emptyBoard() {
|
|
516
|
-
|
|
4903
|
+
// `threads: null` means "the host did not say" — the shell must not claim
|
|
4904
|
+
// dsh-threads is missing before the first snapshot arrives. `install` is the
|
|
4905
|
+
// same kind of unknown: null means no opinion, so no button is drawn.
|
|
4906
|
+
return { projects: [], workspaces: [], currentProjectId: null, sandbox: { available: false }, threads: null, install: null };
|
|
4907
|
+
}
|
|
4908
|
+
|
|
4909
|
+
/**
|
|
4910
|
+
* What the "dsh-threads is missing" notice should offer.
|
|
4911
|
+
*
|
|
4912
|
+
* The host decides (src/threads-install.js) and the panel only draws it: three
|
|
4913
|
+
* modes, and a click is possible only when DSH's plugin manager is reachable
|
|
4914
|
+
* and work is left. `command` is the terminal fallback and is deliberately
|
|
4915
|
+
* null on Desktop, whose profile the installed CLI refuses to manage — there
|
|
4916
|
+
* the market or the button are the only paths, and the copy button is not
|
|
4917
|
+
* offered at all instead of offering a command that cannot work.
|
|
4918
|
+
*/
|
|
4919
|
+
function installView(install) {
|
|
4920
|
+
const block = install !== null && typeof install === "object" ? install : null;
|
|
4921
|
+
if (block === null) {
|
|
4922
|
+
return { known: false, mode: null, available: false, canClick: false, needsEnable: false, command: null, profile: null, tag: null };
|
|
4923
|
+
}
|
|
4924
|
+
const mode = block.mode === "install" || block.mode === "enable" || block.mode === "done" ? block.mode : null;
|
|
4925
|
+
return {
|
|
4926
|
+
known: mode !== null,
|
|
4927
|
+
mode,
|
|
4928
|
+
available: block.available === true,
|
|
4929
|
+
canClick: mode !== null && mode !== "done" && block.available === true,
|
|
4930
|
+
needsEnable: mode === "enable",
|
|
4931
|
+
command: typeof block.command === "string" && block.command.length > 0 ? block.command : null,
|
|
4932
|
+
profile: typeof block.profile === "string" && block.profile.length > 0 ? block.profile : null,
|
|
4933
|
+
tag: typeof block.tag === "string" && block.tag.length > 0 ? block.tag : null
|
|
4934
|
+
};
|
|
4935
|
+
}
|
|
4936
|
+
|
|
4937
|
+
/**
|
|
4938
|
+
* One line for a failed install. The two failures a user can actually act on
|
|
4939
|
+
* get their own sentence; everything else shows DSH's own message, which is
|
|
4940
|
+
* already specific ("pnpm exited 1", "incompatible DSH version", ...).
|
|
4941
|
+
*/
|
|
4942
|
+
function installFailureText(t, outcome) {
|
|
4943
|
+
const kind = typeof outcome?.kind === "string" ? outcome.kind : "";
|
|
4944
|
+
if (kind === "build-blocked") {
|
|
4945
|
+
const list = Array.isArray(outcome?.pendingBuilds) ? outcome.pendingBuilds.join(", ") : "";
|
|
4946
|
+
return t("board.install.buildBlocked", { list: list.length > 0 ? list : "?" });
|
|
4947
|
+
}
|
|
4948
|
+
if (kind === "pnpm-missing") return t("board.install.pnpmMissing");
|
|
4949
|
+
const message = typeof outcome?.message === "string" && outcome.message.length > 0 ? outcome.message : "";
|
|
4950
|
+
const code = typeof outcome?.code === "string" && outcome.code.length > 0 ? outcome.code : "";
|
|
4951
|
+
return t("board.install.failed", { error: message.length > 0 ? message : code.length > 0 ? code : "unknown" });
|
|
4952
|
+
}
|
|
4953
|
+
|
|
4954
|
+
/** POST the one install. `ok: false` is an answer (with a code), not a transport error. */
|
|
4955
|
+
function postThreadsInstall() {
|
|
4956
|
+
return fetch(THREADS_INSTALL_ROUTE, {
|
|
4957
|
+
method: "POST",
|
|
4958
|
+
headers: { "content-type": "application/json", "x-project-hub": "1" },
|
|
4959
|
+
body: "{}"
|
|
4960
|
+
})
|
|
4961
|
+
.then((response) => response.json())
|
|
4962
|
+
.then((json) => {
|
|
4963
|
+
if (json === null || typeof json !== "object") throw new Error("install route returned nothing");
|
|
4964
|
+
return json;
|
|
4965
|
+
});
|
|
4966
|
+
}
|
|
4967
|
+
|
|
4968
|
+
/**
|
|
4969
|
+
* The version remark, or null when there is nothing honest to say.
|
|
4970
|
+
*
|
|
4971
|
+
* Only a version the host actually read counts: `version === null` means
|
|
4972
|
+
* "could not tell", and guessing there would put a scary line above a board
|
|
4973
|
+
* that works. A different version is a heads-up, never a refusal — the board
|
|
4974
|
+
* renders underneath it as usual.
|
|
4975
|
+
*/
|
|
4976
|
+
function threadsVersionWarning(threads) {
|
|
4977
|
+
if (threads === null || typeof threads !== "object") return null;
|
|
4978
|
+
if (threads.installed !== true) return null;
|
|
4979
|
+
const version = typeof threads.version === "string" && threads.version.length > 0 ? threads.version : null;
|
|
4980
|
+
if (version === null || version === THREADS_BASELINE) return null;
|
|
4981
|
+
return version;
|
|
4982
|
+
}
|
|
4983
|
+
|
|
4984
|
+
/**
|
|
4985
|
+
* Which of three board states a snapshot is in.
|
|
4986
|
+
*
|
|
4987
|
+
* "no-threads" dsh-threads is not installed in this host process. The plain
|
|
4988
|
+
* "no projects yet" line would be a lie here: the user has
|
|
4989
|
+
* nothing to create, the provider is simply absent.
|
|
4990
|
+
* "no-projects" dsh-threads is installed and no project exists yet — the one
|
|
4991
|
+
* state where "no dsh-threads projects yet" is accurate.
|
|
4992
|
+
* "board" render the normal cards.
|
|
4993
|
+
*
|
|
4994
|
+
* A host that reports no `threads` field (an older build, or the first
|
|
4995
|
+
* snapshot) falls back to counting projects, so the panel never announces
|
|
4996
|
+
* "not installed" without evidence.
|
|
4997
|
+
*/
|
|
4998
|
+
function boardState(data) {
|
|
4999
|
+
const projects = data !== null && typeof data === "object" && Array.isArray(data.projects) ? data.projects.length : 0;
|
|
5000
|
+
const threads = data !== null && typeof data === "object" ? data.threads : null;
|
|
5001
|
+
const installed =
|
|
5002
|
+
threads !== null && typeof threads === "object" && typeof threads.installed === "boolean" ? threads.installed : null;
|
|
5003
|
+
if (installed === false) return "no-threads";
|
|
5004
|
+
return projects > 0 ? "board" : "no-projects";
|
|
517
5005
|
}
|
|
518
5006
|
|
|
519
5007
|
/**
|
|
@@ -542,7 +5030,12 @@ window.__ModuleLoader__.load({
|
|
|
542
5030
|
projects: Array.isArray(json.projects) ? json.projects : [],
|
|
543
5031
|
workspaces: Array.isArray(json.workspaces) ? json.workspaces : [],
|
|
544
5032
|
currentProjectId: typeof json.currentProjectId === "string" ? json.currentProjectId : null,
|
|
545
|
-
sandbox: json.sandbox && typeof json.sandbox === "object" ? json.sandbox : { available: false }
|
|
5033
|
+
sandbox: json.sandbox && typeof json.sandbox === "object" ? json.sandbox : { available: false },
|
|
5034
|
+
// Whether the optional provider is installed; null when the host did
|
|
5035
|
+
// not say (boardState() then decides from the project count alone).
|
|
5036
|
+
threads: json.threads && typeof json.threads === "object" ? json.threads : null,
|
|
5037
|
+
// The optional second install: what the missing-provider notice offers.
|
|
5038
|
+
install: json.install && typeof json.install === "object" ? json.install : null
|
|
546
5039
|
};
|
|
547
5040
|
boardCache.data = data;
|
|
548
5041
|
boardCache.at = Date.now();
|
|
@@ -998,6 +5491,20 @@ window.__ModuleLoader__.load({
|
|
|
998
5491
|
taskSubject: { flex: "1 1 auto", minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
|
|
999
5492
|
subLabel: { fontSize: 11, opacity: 0.5, margin: "12px 0 4px", letterSpacing: "0.02em" },
|
|
1000
5493
|
emptyLine: { fontSize: 12, opacity: 0.42, padding: "2px " + SPACE + "px" },
|
|
5494
|
+
// The "provider missing" notice: a block, not a one-line empty state, because
|
|
5495
|
+
// it has to say what still works and how to fix it.
|
|
5496
|
+
notice: {
|
|
5497
|
+
margin: "8px 0 4px",
|
|
5498
|
+
padding: "10px 12px",
|
|
5499
|
+
border: "1px solid " + BORDER_STRONG,
|
|
5500
|
+
borderLeft: "3px solid #E08A2E",
|
|
5501
|
+
borderRadius: 6,
|
|
5502
|
+
fontSize: 12,
|
|
5503
|
+
lineHeight: 1.6
|
|
5504
|
+
},
|
|
5505
|
+
noticeTitle: { fontWeight: 600, marginBottom: 4 },
|
|
5506
|
+
noticeBody: { opacity: 0.78 },
|
|
5507
|
+
noticeHint: { opacity: 0.6, fontSize: 11, marginTop: 6 },
|
|
1001
5508
|
input: {
|
|
1002
5509
|
flex: "1 1 auto",
|
|
1003
5510
|
minWidth: 0,
|
|
@@ -2009,6 +6516,127 @@ window.__ModuleLoader__.load({
|
|
|
2009
6516
|
);
|
|
2010
6517
|
}
|
|
2011
6518
|
|
|
6519
|
+
/**
|
|
6520
|
+
* The "dsh-threads is not installed" notice (panel state one of three).
|
|
6521
|
+
*
|
|
6522
|
+
* It replaces the empty line, never the whole page: the ⚙ settings, the
|
|
6523
|
+
* workspace list on the settings page and every `/hub` command keep working
|
|
6524
|
+
* without the provider, and the note says so instead of hiding it.
|
|
6525
|
+
*/
|
|
6526
|
+
function NoThreadsNotice(props) {
|
|
6527
|
+
const t = props.t;
|
|
6528
|
+
const leftover = Number(props.projects) > 0 ? Math.trunc(Number(props.projects)) : 0;
|
|
6529
|
+
const view = installView(props.install);
|
|
6530
|
+
// idle -> confirm (a write into the user's profile deserves one) -> running -> done|failed.
|
|
6531
|
+
const [phase, setPhase] = React.useState("idle");
|
|
6532
|
+
const [outcome, setOutcome] = React.useState(null);
|
|
6533
|
+
const [copied, setCopied] = React.useState(false);
|
|
6534
|
+
React.useEffect(() => {
|
|
6535
|
+
if (!copied) return undefined;
|
|
6536
|
+
const timer = setTimeout(() => setCopied(false), 1200);
|
|
6537
|
+
return () => clearTimeout(timer);
|
|
6538
|
+
}, [copied]);
|
|
6539
|
+
|
|
6540
|
+
const run = () => {
|
|
6541
|
+
setPhase("running");
|
|
6542
|
+
postThreadsInstall().then(
|
|
6543
|
+
(result) => {
|
|
6544
|
+
setOutcome(result);
|
|
6545
|
+
setPhase(result?.ok === true ? "done" : "failed");
|
|
6546
|
+
// Refresh now for the restart case, and once more for the live one: the
|
|
6547
|
+
// provider's domain handle appears on the next sweep, not on the install.
|
|
6548
|
+
if (typeof props.onChanged === "function") props.onChanged();
|
|
6549
|
+
setTimeout(() => {
|
|
6550
|
+
if (typeof props.onChanged === "function") props.onChanged();
|
|
6551
|
+
}, 1500);
|
|
6552
|
+
},
|
|
6553
|
+
(error) => {
|
|
6554
|
+
setOutcome({ ok: false, code: "request-failed", message: messageOf(error) });
|
|
6555
|
+
setPhase("failed");
|
|
6556
|
+
}
|
|
6557
|
+
);
|
|
6558
|
+
};
|
|
6559
|
+
|
|
6560
|
+
const copy = () => {
|
|
6561
|
+
if (view.command === null) return;
|
|
6562
|
+
try {
|
|
6563
|
+
const clipboard = typeof navigator !== "undefined" ? navigator.clipboard : undefined;
|
|
6564
|
+
if (clipboard && typeof clipboard.writeText === "function") {
|
|
6565
|
+
clipboard.writeText(view.command).then(() => setCopied(true), () => setCopied(false));
|
|
6566
|
+
return;
|
|
6567
|
+
}
|
|
6568
|
+
} catch (error) {
|
|
6569
|
+
warn("clipboard unavailable", error);
|
|
6570
|
+
}
|
|
6571
|
+
setCopied(false);
|
|
6572
|
+
};
|
|
6573
|
+
|
|
6574
|
+
// no-api is not a failure with an error message: this host simply has no
|
|
6575
|
+
// plugin manager, and the manual path below is the whole answer.
|
|
6576
|
+
const status =
|
|
6577
|
+
phase === "done" && outcome?.ok === true
|
|
6578
|
+
? outcome.restartRequired === true
|
|
6579
|
+
? t("board.install.restart")
|
|
6580
|
+
: outcome.action === "skip"
|
|
6581
|
+
? t("board.install.skip")
|
|
6582
|
+
: t("board.install.applied")
|
|
6583
|
+
: phase === "failed" && outcome?.code !== "no-api"
|
|
6584
|
+
? installFailureText(t, outcome)
|
|
6585
|
+
: null;
|
|
6586
|
+
|
|
6587
|
+
const label =
|
|
6588
|
+
phase === "confirm"
|
|
6589
|
+
? t("board.install.confirm", { profile: view.profile ?? "?" })
|
|
6590
|
+
: view.needsEnable
|
|
6591
|
+
? t("board.install.enableButton")
|
|
6592
|
+
: t("board.install.button", { tag: view.tag ?? "" });
|
|
6593
|
+
const copyLabel = copied ? t("board.install.copied") : t("board.install.copy");
|
|
6594
|
+
|
|
6595
|
+
return h(
|
|
6596
|
+
"div",
|
|
6597
|
+
{ style: S.notice, role: "note" },
|
|
6598
|
+
h("div", { style: S.noticeTitle }, t("board.noThreads.title")),
|
|
6599
|
+
h("div", { style: S.noticeBody }, t("board.noThreads.body")),
|
|
6600
|
+
h("div", { style: S.noticeBody }, t("board.noThreads.works")),
|
|
6601
|
+
// The provider is configured but not loaded: nothing to install, one restart.
|
|
6602
|
+
view.mode === "done" ? h("div", { style: S.noticeHint }, t("board.install.configured")) : null,
|
|
6603
|
+
view.canClick
|
|
6604
|
+
? h(
|
|
6605
|
+
"div",
|
|
6606
|
+
{ style: { marginTop: 10 } },
|
|
6607
|
+
h(
|
|
6608
|
+
"button",
|
|
6609
|
+
{
|
|
6610
|
+
type: "button",
|
|
6611
|
+
style: S.button,
|
|
6612
|
+
disabled: phase === "running",
|
|
6613
|
+
onClick: () => {
|
|
6614
|
+
if (phase === "running") return;
|
|
6615
|
+
if (phase === "confirm") run();
|
|
6616
|
+
else setPhase("confirm");
|
|
6617
|
+
}
|
|
6618
|
+
},
|
|
6619
|
+
phase === "running" ? t("board.install.running") : label
|
|
6620
|
+
)
|
|
6621
|
+
)
|
|
6622
|
+
: null,
|
|
6623
|
+
status === null ? null : h("div", { style: S.noticeBody }, status),
|
|
6624
|
+
// The fallback that always works: the exact pinned command on CLI profiles,
|
|
6625
|
+
// and on Desktop the market — the installed CLI refuses that profile.
|
|
6626
|
+
view.command !== null
|
|
6627
|
+
? h(
|
|
6628
|
+
"div",
|
|
6629
|
+
{ style: S.noticeHint },
|
|
6630
|
+
t("board.install.manual", { command: view.command }),
|
|
6631
|
+
h("button", { type: "button", style: S.ghost, onClick: copy }, copyLabel)
|
|
6632
|
+
)
|
|
6633
|
+
: view.profile === "desktop"
|
|
6634
|
+
? h("div", { style: S.noticeHint }, t("board.install.manualMarket"))
|
|
6635
|
+
: h("div", { style: S.noticeHint }, t("board.noThreads.hint")),
|
|
6636
|
+
leftover > 0 ? h("div", { style: S.noticeHint }, t("board.noThreads.leftover", { count: leftover })) : null
|
|
6637
|
+
);
|
|
6638
|
+
}
|
|
6639
|
+
|
|
2012
6640
|
// ---------- project board tab ----------
|
|
2013
6641
|
function BoardTab() {
|
|
2014
6642
|
const t = useT();
|
|
@@ -2019,6 +6647,9 @@ window.__ModuleLoader__.load({
|
|
|
2019
6647
|
const data = board.data;
|
|
2020
6648
|
const grouped = sortProjects(data.projects, data.currentProjectId, settings.sort);
|
|
2021
6649
|
const total = data.projects.length;
|
|
6650
|
+
// Three states, not two: see boardState(). Loading and error keep priority.
|
|
6651
|
+
const state = boardState(data);
|
|
6652
|
+
const versionWarning = threadsVersionWarning(data.threads);
|
|
2022
6653
|
const now = Date.now();
|
|
2023
6654
|
|
|
2024
6655
|
const sectionLabel =
|
|
@@ -2053,9 +6684,24 @@ window.__ModuleLoader__.load({
|
|
|
2053
6684
|
"div",
|
|
2054
6685
|
{ style: S.body },
|
|
2055
6686
|
board.error !== null ? h("div", { style: S.error }, t("board.failed", { error: board.error })) : null,
|
|
6687
|
+
versionWarning === null
|
|
6688
|
+
? null
|
|
6689
|
+
: h("div", { style: S.warn }, t("board.versionWarn", { version: versionWarning, baseline: THREADS_BASELINE })),
|
|
2056
6690
|
board.loading && total === 0 ? h("div", { style: S.emptyLine }, t("board.loading")) : null,
|
|
2057
|
-
!board.loading && board.error === null &&
|
|
2058
|
-
|
|
6691
|
+
!board.loading && board.error === null && state === "no-threads"
|
|
6692
|
+
? h(NoThreadsNotice, {
|
|
6693
|
+
t,
|
|
6694
|
+
projects: data.threads === null ? 0 : data.threads.projects,
|
|
6695
|
+
// Whether one click can install the provider, and what to paste
|
|
6696
|
+
// instead when this host cannot (src/threads-install.js).
|
|
6697
|
+
install: data.install,
|
|
6698
|
+
onChanged: board.refresh
|
|
6699
|
+
})
|
|
6700
|
+
: null,
|
|
6701
|
+
!board.loading && board.error === null && state === "no-projects"
|
|
6702
|
+
? h("div", { style: S.emptyLine }, t("board.empty"))
|
|
6703
|
+
: null,
|
|
6704
|
+
state === "board" && grouped.current !== null
|
|
2059
6705
|
? h(ProjectCard, {
|
|
2060
6706
|
project: grouped.current,
|
|
2061
6707
|
current: true,
|
|
@@ -2066,8 +6712,8 @@ window.__ModuleLoader__.load({
|
|
|
2066
6712
|
onChanged: board.refresh
|
|
2067
6713
|
})
|
|
2068
6714
|
: null,
|
|
2069
|
-
total > 0 ? h(SectionBar, { label: sectionLabel }) : null,
|
|
2070
|
-
grouped.others.map((project, index) =>
|
|
6715
|
+
state === "board" && total > 0 ? h(SectionBar, { label: sectionLabel }) : null,
|
|
6716
|
+
(state === "board" ? grouped.others : []).map((project, index) =>
|
|
2071
6717
|
h(ProjectCard, {
|
|
2072
6718
|
key: project.id,
|
|
2073
6719
|
project,
|
|
@@ -2747,7 +7393,7 @@ window.__ModuleLoader__.load({
|
|
|
2747
7393
|
)
|
|
2748
7394
|
);
|
|
2749
7395
|
slots.inject("shell.overlay", () =>
|
|
2750
|
-
slots.register({ name: "shell.overlay", id:
|
|
7396
|
+
slots.register({ name: "shell.overlay", id: OVERLAY_ID, order: 40 }, Overlay)
|
|
2751
7397
|
);
|
|
2752
7398
|
} catch (error) {
|
|
2753
7399
|
warn("the board surfaces did not mount", error);
|
|
@@ -2765,6 +7411,11 @@ window.__ModuleLoader__.load({
|
|
|
2765
7411
|
} catch (error) {
|
|
2766
7412
|
warn("the dsh-threads injection did not mount", error);
|
|
2767
7413
|
}
|
|
7414
|
+
|
|
7415
|
+
// Entry D: the thread half itself (vendor/dsh-threads). Last on purpose —
|
|
7416
|
+
// the board has to exist before the threads UI that fills it, and this one
|
|
7417
|
+
// waits for the host's verdict on who owns it.
|
|
7418
|
+
mountVendoredThreads(ctx);
|
|
2768
7419
|
}
|
|
2769
7420
|
|
|
2770
7421
|
return {
|
|
@@ -2774,7 +7425,25 @@ window.__ModuleLoader__.load({
|
|
|
2774
7425
|
// panel follows the app language: the web client always provides it
|
|
2775
7426
|
// (dsh-client-locale), and a profile without it simply does not mount this
|
|
2776
7427
|
// half instead of silently ignoring the app language setting.
|
|
2777
|
-
|
|
7428
|
+
// Union of the two halves now that they share one bundle: ours
|
|
7429
|
+
// (locale / slots / the right sidebar) and everything the vendored threads
|
|
7430
|
+
// half reads (layout, workspace, sessions, resources, uiSession,
|
|
7431
|
+
// uiConversation). Declaring them together is the price of one entry point;
|
|
7432
|
+
// a client that lacks one of them mounts neither half, exactly as it would
|
|
7433
|
+
// have mounted no upstream threads tab before.
|
|
7434
|
+
inject: [
|
|
7435
|
+
"locale",
|
|
7436
|
+
"slots",
|
|
7437
|
+
"sidebarRightTabs",
|
|
7438
|
+
"sidebarRight",
|
|
7439
|
+
"layout",
|
|
7440
|
+
"uiWorkspace",
|
|
7441
|
+
"workspaces",
|
|
7442
|
+
"sessions",
|
|
7443
|
+
"resources",
|
|
7444
|
+
"uiSession",
|
|
7445
|
+
"uiConversation"
|
|
7446
|
+
],
|
|
2778
7447
|
apply,
|
|
2779
7448
|
/**
|
|
2780
7449
|
* Test-only surface. The browser half is one self-contained bundle (the
|
|
@@ -2805,13 +7474,24 @@ window.__ModuleLoader__.load({
|
|
|
2805
7474
|
langStore,
|
|
2806
7475
|
dialogStore,
|
|
2807
7476
|
emptyBoard,
|
|
7477
|
+
boardState,
|
|
7478
|
+
threadsVersionWarning,
|
|
7479
|
+
installView,
|
|
7480
|
+
installFailureText,
|
|
7481
|
+
THREADS_BASELINE,
|
|
2808
7482
|
pickFolderFrom,
|
|
2809
7483
|
pickerAvailableFrom,
|
|
2810
7484
|
pickFolder,
|
|
2811
7485
|
pickerAvailable,
|
|
2812
7486
|
INJECT_ATTR,
|
|
2813
7487
|
TAB_ID,
|
|
2814
|
-
|
|
7488
|
+
OVERLAY_ID,
|
|
7489
|
+
SETTINGS_SECTION_ID,
|
|
7490
|
+
NS,
|
|
7491
|
+
// The vendored threads gate: the host names the owner, this half obeys.
|
|
7492
|
+
THREADS_OWNER_ROUTE,
|
|
7493
|
+
readThreadsOwner,
|
|
7494
|
+
shouldMountThreads
|
|
2815
7495
|
}
|
|
2816
7496
|
};
|
|
2817
7497
|
}
|