@yankeguo/dsh-client-ui-devlead 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/lib/client.js +701 -0
- package/lib/index.js +8 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +47 -3
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Y.-K. Guo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/lib/client.js
ADDED
|
@@ -0,0 +1,701 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "@yankeguo/dsh-client-ui-devlead",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
"use strict";
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
|
|
25
|
+
// packages/client-ui/src/client/index.tsx
|
|
26
|
+
var index_exports = {};
|
|
27
|
+
__export(index_exports, {
|
|
28
|
+
apply: () => apply,
|
|
29
|
+
inject: () => inject
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(index_exports);
|
|
32
|
+
|
|
33
|
+
// packages/client-ui/src/client/DevLeadBar.tsx
|
|
34
|
+
var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
35
|
+
|
|
36
|
+
// packages/protocol/src/types.ts
|
|
37
|
+
var DEVLEAD_PROJECTION_KEY = "devLead";
|
|
38
|
+
|
|
39
|
+
// packages/protocol/src/format.ts
|
|
40
|
+
var DEVLEAD_TRANSITIONS = [
|
|
41
|
+
"completed",
|
|
42
|
+
"error",
|
|
43
|
+
"blocked",
|
|
44
|
+
"aborted",
|
|
45
|
+
"max-tokens",
|
|
46
|
+
"interrupted",
|
|
47
|
+
"forked"
|
|
48
|
+
];
|
|
49
|
+
var TRANSITION_SET = new Set(DEVLEAD_TRANSITIONS);
|
|
50
|
+
function isDevLeadTransition(value) {
|
|
51
|
+
return typeof value === "string" && TRANSITION_SET.has(value);
|
|
52
|
+
}
|
|
53
|
+
var TRANSITION_LABELS = {
|
|
54
|
+
completed: "completed",
|
|
55
|
+
error: "failed",
|
|
56
|
+
blocked: "blocked",
|
|
57
|
+
aborted: "cancelled",
|
|
58
|
+
"max-tokens": "hit the output-token limit",
|
|
59
|
+
interrupted: "interrupted",
|
|
60
|
+
forked: "forked"
|
|
61
|
+
};
|
|
62
|
+
function transitionLabel(transition) {
|
|
63
|
+
return TRANSITION_LABELS[transition];
|
|
64
|
+
}
|
|
65
|
+
function presentLine(value) {
|
|
66
|
+
if (value === void 0) return void 0;
|
|
67
|
+
const trimmed = value.trim();
|
|
68
|
+
return trimmed.length === 0 ? void 0 : trimmed;
|
|
69
|
+
}
|
|
70
|
+
function notificationLine(notification) {
|
|
71
|
+
const title = presentLine(notification.sessionTitle);
|
|
72
|
+
const who = title === void 0 ? notification.sessionId : `${title} (${notification.sessionId})`;
|
|
73
|
+
const error = presentLine(notification.error);
|
|
74
|
+
const detail = error ?? presentLine(notification.summary);
|
|
75
|
+
const suffix = detail === void 0 ? "" : `: ${detail}`;
|
|
76
|
+
return `${who} \u2014 turn ${notification.turn} ${transitionLabel(notification.transition)}${suffix}`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// packages/client-ui/src/client/format.ts
|
|
80
|
+
var TRANSITION_LABEL_KEYS = {
|
|
81
|
+
completed: "transition.completed",
|
|
82
|
+
error: "transition.error",
|
|
83
|
+
blocked: "transition.blocked",
|
|
84
|
+
aborted: "transition.aborted",
|
|
85
|
+
"max-tokens": "transition.max-tokens",
|
|
86
|
+
interrupted: "transition.interrupted",
|
|
87
|
+
forked: "transition.forked"
|
|
88
|
+
};
|
|
89
|
+
function transitionLabelKey(transition) {
|
|
90
|
+
return isDevLeadTransition(transition) ? TRANSITION_LABEL_KEYS[transition] : "transition.unknown";
|
|
91
|
+
}
|
|
92
|
+
function notificationSummary(notification) {
|
|
93
|
+
const rawTitle = typeof notification.sessionTitle === "string" ? notification.sessionTitle.trim() : "";
|
|
94
|
+
const who = rawTitle.length > 0 ? rawTitle : notification.sessionId;
|
|
95
|
+
const turn = Number.isInteger(notification.turn) && notification.turn > 0 ? notification.turn : 0;
|
|
96
|
+
const tooltip = isDevLeadTransition(notification.transition) ? notificationLine(notification) : `${who} \u2014 ${String(notification.transition)}`;
|
|
97
|
+
const rawError = typeof notification.error === "string" ? notification.error.trim() : "";
|
|
98
|
+
return {
|
|
99
|
+
tooltip,
|
|
100
|
+
who,
|
|
101
|
+
turn,
|
|
102
|
+
transition: String(notification.transition),
|
|
103
|
+
labelKey: transitionLabelKey(notification.transition),
|
|
104
|
+
error: rawError.length > 0 ? rawError : void 0
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function latestNotification(notifications) {
|
|
108
|
+
return notifications.at(-1) ?? null;
|
|
109
|
+
}
|
|
110
|
+
function summarizeWatched(watchedSessions, rows, statuses) {
|
|
111
|
+
const seen = /* @__PURE__ */ new Set();
|
|
112
|
+
let running = 0;
|
|
113
|
+
let missing = 0;
|
|
114
|
+
for (const candidate of watchedSessions) {
|
|
115
|
+
if (typeof candidate !== "string" || candidate.length === 0) continue;
|
|
116
|
+
if (seen.has(candidate)) continue;
|
|
117
|
+
seen.add(candidate);
|
|
118
|
+
const row = rows[candidate];
|
|
119
|
+
if (row === void 0) missing += 1;
|
|
120
|
+
const status = statuses?.get(candidate);
|
|
121
|
+
if (status?.running ?? row?.running ?? false) running += 1;
|
|
122
|
+
}
|
|
123
|
+
return { watched: seen.size, running, missing };
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// packages/client-ui/src/client/results.ts
|
|
127
|
+
var REJECTED_FALLBACK = "command rejected";
|
|
128
|
+
var TRANSPORT_FALLBACK = "command failed";
|
|
129
|
+
var UNEXPECTED_FALLBACK = "unknown error";
|
|
130
|
+
var UNRESOLVED_TEXT = "the Host did not recognize the command line";
|
|
131
|
+
function presentMessage(value) {
|
|
132
|
+
if (value === void 0) return void 0;
|
|
133
|
+
const trimmed = value.trim();
|
|
134
|
+
return trimmed.length === 0 ? void 0 : trimmed;
|
|
135
|
+
}
|
|
136
|
+
function commandFailure(result) {
|
|
137
|
+
if (!result.ok) {
|
|
138
|
+
return {
|
|
139
|
+
kind: "transport",
|
|
140
|
+
message: presentMessage(result.error.message) ?? TRANSPORT_FALLBACK,
|
|
141
|
+
code: result.error.code
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
const outcome = result.value?.result;
|
|
145
|
+
if (outcome === void 0 || outcome.kind !== "error") return void 0;
|
|
146
|
+
return { kind: "rejected", message: presentMessage(outcome.text) ?? REJECTED_FALLBACK };
|
|
147
|
+
}
|
|
148
|
+
function unexpectedFailure(error) {
|
|
149
|
+
const message = error instanceof Error ? presentMessage(error.message) : void 0;
|
|
150
|
+
return { kind: "unexpected", message: message ?? UNEXPECTED_FALLBACK };
|
|
151
|
+
}
|
|
152
|
+
async function admitCommand(executeCommand, line) {
|
|
153
|
+
try {
|
|
154
|
+
const result = await executeCommand(line);
|
|
155
|
+
if (result.ok && result.value === void 0) return { kind: "unresolved", line };
|
|
156
|
+
return commandFailure(result);
|
|
157
|
+
} catch (error) {
|
|
158
|
+
return unexpectedFailure(error);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function failureMessage(failure) {
|
|
162
|
+
return failure.kind === "unresolved" ? UNRESOLVED_TEXT : failure.message;
|
|
163
|
+
}
|
|
164
|
+
function failureCopy(failure) {
|
|
165
|
+
switch (failure.kind) {
|
|
166
|
+
case "transport":
|
|
167
|
+
return { key: "error.command", params: { message: failure.message, code: failure.code } };
|
|
168
|
+
case "rejected":
|
|
169
|
+
return { key: "error.rejected", params: { message: failure.message } };
|
|
170
|
+
case "unexpected":
|
|
171
|
+
return { key: "error.unknown", params: { message: failure.message } };
|
|
172
|
+
case "unresolved":
|
|
173
|
+
return { key: "error.unresolved", params: { line: failure.line } };
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
function createDevLeadAdmissionGate() {
|
|
177
|
+
let entered = false;
|
|
178
|
+
return {
|
|
179
|
+
tryEnter: () => {
|
|
180
|
+
if (entered) return false;
|
|
181
|
+
entered = true;
|
|
182
|
+
return true;
|
|
183
|
+
},
|
|
184
|
+
leave: () => {
|
|
185
|
+
entered = false;
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
var DEVLEAD_ADMISSION_IDLE = { pending: false, failure: null };
|
|
190
|
+
function devLeadAdmissionReducer(state, action) {
|
|
191
|
+
switch (action.type) {
|
|
192
|
+
case "begin":
|
|
193
|
+
return state.pending && state.failure === null ? state : { pending: true, failure: null };
|
|
194
|
+
case "settle":
|
|
195
|
+
return state.pending || state.failure !== action.failure ? { pending: false, failure: action.failure } : state;
|
|
196
|
+
case "reset":
|
|
197
|
+
return state.failure === null ? state : { pending: state.pending, failure: null };
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// packages/client-ui/src/client/useDevLeadAdmission.ts
|
|
202
|
+
var import_react = require("react");
|
|
203
|
+
function useDevLeadAdmission(executeCommand, resetKey) {
|
|
204
|
+
const [state, dispatch] = (0, import_react.useReducer)(devLeadAdmissionReducer, DEVLEAD_ADMISSION_IDLE);
|
|
205
|
+
const [gate] = (0, import_react.useState)(createDevLeadAdmissionGate);
|
|
206
|
+
const aliveRef = (0, import_react.useRef)(true);
|
|
207
|
+
(0, import_react.useEffect)(() => {
|
|
208
|
+
aliveRef.current = true;
|
|
209
|
+
return () => {
|
|
210
|
+
aliveRef.current = false;
|
|
211
|
+
};
|
|
212
|
+
}, []);
|
|
213
|
+
(0, import_react.useEffect)(() => {
|
|
214
|
+
dispatch({ type: "reset" });
|
|
215
|
+
}, [resetKey]);
|
|
216
|
+
const run = (line) => {
|
|
217
|
+
if (!gate.tryEnter()) return;
|
|
218
|
+
dispatch({ type: "begin" });
|
|
219
|
+
void admitCommand(executeCommand, line).then((failure) => {
|
|
220
|
+
gate.leave();
|
|
221
|
+
if (!aliveRef.current) return;
|
|
222
|
+
dispatch({ type: "settle", failure: failure ?? null });
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
return { pending: state.pending, failure: state.failure, run };
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// packages/client-ui/src/client/DevLeadBar.tsx
|
|
229
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
230
|
+
function DevLeadBar({
|
|
231
|
+
useProjection,
|
|
232
|
+
useSessions,
|
|
233
|
+
useSessionStatus,
|
|
234
|
+
executeCommand,
|
|
235
|
+
t
|
|
236
|
+
}) {
|
|
237
|
+
const projection = useProjection(DEVLEAD_PROJECTION_KEY);
|
|
238
|
+
const rows = useSessions((state) => state.byId);
|
|
239
|
+
const statuses = useSessionStatus((current) => current);
|
|
240
|
+
const enabled = projection?.enabled ?? false;
|
|
241
|
+
const { pending, failure, run } = useDevLeadAdmission(executeCommand, enabled);
|
|
242
|
+
if (projection === void 0 || !enabled) return null;
|
|
243
|
+
const summary = summarizeWatched(projection.sessions, rows, statuses);
|
|
244
|
+
const latest = latestNotification(projection.notifications);
|
|
245
|
+
const notice = latest === null ? null : notificationSummary(latest);
|
|
246
|
+
const failureLine = failure === null ? null : failureCopy(failure);
|
|
247
|
+
const switchTitle = pending ? t("switch.pending") : t("switch.disable");
|
|
248
|
+
const toggle = (next) => {
|
|
249
|
+
if (next) return;
|
|
250
|
+
run("/devlead off");
|
|
251
|
+
};
|
|
252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
253
|
+
"div",
|
|
254
|
+
{
|
|
255
|
+
className: "devlead-dock",
|
|
256
|
+
"data-devlead-bar": "true",
|
|
257
|
+
"data-devlead-enabled": "true",
|
|
258
|
+
"data-devlead-pending": pending ? "true" : "false",
|
|
259
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
260
|
+
"div",
|
|
261
|
+
{
|
|
262
|
+
className: "devlead-bar",
|
|
263
|
+
role: "group",
|
|
264
|
+
"aria-label": t("bar.aria"),
|
|
265
|
+
"aria-busy": pending,
|
|
266
|
+
title: t("hint.enabled"),
|
|
267
|
+
children: [
|
|
268
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-glyph", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconUsersOutlineRegular, { size: 14 }) }),
|
|
269
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-label", children: t("label") }),
|
|
270
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
271
|
+
import_dsh_client_ui_primitives.Switch,
|
|
272
|
+
{
|
|
273
|
+
className: "devlead-switch",
|
|
274
|
+
checked: true,
|
|
275
|
+
disabled: pending,
|
|
276
|
+
label: t("switch.aria"),
|
|
277
|
+
title: switchTitle,
|
|
278
|
+
onChange: toggle
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "devlead-meta", children: [
|
|
282
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-watched", children: t("count.watched", { count: summary.watched }) }),
|
|
283
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "devlead-running", children: [
|
|
284
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
285
|
+
"span",
|
|
286
|
+
{
|
|
287
|
+
className: "devlead-dot",
|
|
288
|
+
"data-active": summary.running > 0 ? "true" : "false",
|
|
289
|
+
"aria-hidden": "true"
|
|
290
|
+
}
|
|
291
|
+
),
|
|
292
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: t("count.running", { count: summary.running }) })
|
|
293
|
+
] }),
|
|
294
|
+
summary.missing > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-missing", title: t("count.missing", { count: summary.missing }), children: t("count.missing", { count: summary.missing }) })
|
|
295
|
+
] }),
|
|
296
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
297
|
+
"span",
|
|
298
|
+
{
|
|
299
|
+
className: "devlead-notice",
|
|
300
|
+
role: "status",
|
|
301
|
+
"aria-live": "polite",
|
|
302
|
+
"aria-atomic": "true",
|
|
303
|
+
title: notice === null ? t("hint.enabled") : notice.tooltip,
|
|
304
|
+
children: notice === null ? (
|
|
305
|
+
// An enabled Session with no retained notification keeps the help
|
|
306
|
+
// hint visible instead of leaving the row visually empty.
|
|
307
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-hint", children: t("hint.enabled") })
|
|
308
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "devlead-notification", children: [
|
|
309
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
310
|
+
"span",
|
|
311
|
+
{
|
|
312
|
+
className: "devlead-notification-dot",
|
|
313
|
+
"data-transition": notice.transition,
|
|
314
|
+
"aria-hidden": "true"
|
|
315
|
+
}
|
|
316
|
+
),
|
|
317
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-who", children: notice.who }),
|
|
318
|
+
notice.turn > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-turn", children: t("notification.turn", { turn: notice.turn }) }),
|
|
319
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-label", children: t(notice.labelKey) }),
|
|
320
|
+
notice.error !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-error", children: notice.error })
|
|
321
|
+
] })
|
|
322
|
+
}
|
|
323
|
+
),
|
|
324
|
+
failureLine !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-error", role: "alert", children: t(failureLine.key, failureLine.params) })
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
)
|
|
328
|
+
}
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// packages/client-ui/src/client/DevLeadIconToggle.tsx
|
|
333
|
+
var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
334
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
335
|
+
function DevLeadIconToggle({ useProjection, executeCommand, t }) {
|
|
336
|
+
const projection = useProjection(DEVLEAD_PROJECTION_KEY);
|
|
337
|
+
const enabled = projection?.enabled ?? false;
|
|
338
|
+
const { pending, failure, run } = useDevLeadAdmission(executeCommand, enabled);
|
|
339
|
+
if (projection === void 0 || enabled) return null;
|
|
340
|
+
const label = failure === null ? t("toggle.enable") : t("toggle.failed", { message: failureMessage(failure) });
|
|
341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
342
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.Tooltip, { label, side: "top", delayMs: 300, maxWidth: 300, portal: true, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
343
|
+
import_dsh_client_ui_primitives2.Button,
|
|
344
|
+
{
|
|
345
|
+
variant: "ghost",
|
|
346
|
+
size: "sm",
|
|
347
|
+
className: "devlead-toggle",
|
|
348
|
+
"aria-label": label,
|
|
349
|
+
"aria-busy": pending,
|
|
350
|
+
disabled: pending,
|
|
351
|
+
"data-devlead-toggle": "true",
|
|
352
|
+
"data-devlead-pending": pending ? "true" : "false",
|
|
353
|
+
"data-devlead-failed": failure === null ? "false" : "true",
|
|
354
|
+
onClick: () => {
|
|
355
|
+
run("/devlead on");
|
|
356
|
+
},
|
|
357
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.IconUsersOutlineRegular, { size: 16 })
|
|
358
|
+
}
|
|
359
|
+
) }),
|
|
360
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "devlead-sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: failure === null ? null : t("toggle.failed.status", { message: failureMessage(failure) }) })
|
|
361
|
+
] });
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// packages/client-ui/src/client/locales.ts
|
|
365
|
+
var zh = {
|
|
366
|
+
"meta.title": "DevLead \u6A21\u5F0F",
|
|
367
|
+
"meta.description": "\u5728\u8F93\u5165\u6846\u5DE5\u5177\u6761\u4E2D\u5F00\u5173 DevLead \u6A21\u5F0F\uFF1B\u5F00\u542F\u540E\u5728\u8F93\u5165\u6846\u4E0A\u65B9\u663E\u793A\u72B6\u6001\u6761\u3001\u76D1\u7763\u4F1A\u8BDD\u72B6\u6001\u4E0E\u6700\u8FD1\u4E00\u6761\u901A\u77E5\u3002",
|
|
368
|
+
"bar.aria": "DevLead \u72B6\u6001\u680F",
|
|
369
|
+
"label": "DevLead",
|
|
370
|
+
"switch.aria": "DevLead \u6A21\u5F0F",
|
|
371
|
+
"switch.disable": "\u5173\u95ED DevLead \u6A21\u5F0F",
|
|
372
|
+
"switch.pending": "\u6B63\u5728\u6267\u884C DevLead \u547D\u4EE4\u2026",
|
|
373
|
+
"hint.enabled": "DevLead \u5DF2\u5F00\u542F\uFF1A\u5B50\u4F1A\u8BDD\u7684\u8F6E\u6B21\u7ED3\u675F\u4F1A\u901A\u77E5\u5E76\u5524\u9192\u672C\u4F1A\u8BDD\u3002",
|
|
374
|
+
"count.watched": "\u76D1\u7763 {count} \u4E2A\u4F1A\u8BDD",
|
|
375
|
+
"count.running": "\u8FD0\u884C\u4E2D {count}",
|
|
376
|
+
"count.missing": "{count} \u4E2A\u5DF2\u4E0D\u53EF\u7528",
|
|
377
|
+
"toggle.enable": "\u5F00\u542F DevLead \u6A21\u5F0F",
|
|
378
|
+
"toggle.failed": "\u5F00\u542F DevLead \u6A21\u5F0F\u5931\u8D25\uFF1A{message}\uFF08\u60AC\u505C\u67E5\u770B\uFF0C\u53EF\u91CD\u8BD5\uFF09",
|
|
379
|
+
"toggle.failed.status": "\u5F00\u542F DevLead \u6A21\u5F0F\u5931\u8D25\uFF1A{message}",
|
|
380
|
+
"notification.turn": "\u7B2C {turn} \u8F6E",
|
|
381
|
+
"transition.completed": "\u5B8C\u6210",
|
|
382
|
+
"transition.error": "\u5931\u8D25",
|
|
383
|
+
"transition.blocked": "\u963B\u585E",
|
|
384
|
+
"transition.aborted": "\u5DF2\u53D6\u6D88",
|
|
385
|
+
"transition.max-tokens": "\u8D85\u51FA\u8F93\u51FA\u4E0A\u9650",
|
|
386
|
+
"transition.interrupted": "\u5DF2\u4E2D\u65AD",
|
|
387
|
+
"transition.forked": "\u5DF2\u5206\u53C9",
|
|
388
|
+
"transition.unknown": "\u672A\u77E5\u72B6\u6001",
|
|
389
|
+
"error.command": "\u547D\u4EE4\u5931\u8D25\uFF1A{message}\uFF08{code}\uFF09",
|
|
390
|
+
"error.rejected": "\u547D\u4EE4\u88AB\u62D2\u7EDD\uFF1A{message}",
|
|
391
|
+
"error.unknown": "\u547D\u4EE4\u6267\u884C\u5931\u8D25\uFF1A{message}",
|
|
392
|
+
"error.unresolved": "\u547D\u4EE4\u672A\u6267\u884C\uFF1AHost \u672A\u8BC6\u522B {line}"
|
|
393
|
+
};
|
|
394
|
+
var en = {
|
|
395
|
+
"meta.title": "DevLead mode",
|
|
396
|
+
"meta.description": "Toggles DevLead mode from the composer toolbar; once enabled, a status strip above the composer shows watched sessions and the latest notification.",
|
|
397
|
+
"bar.aria": "DevLead status bar",
|
|
398
|
+
"label": "DevLead",
|
|
399
|
+
"switch.aria": "DevLead mode",
|
|
400
|
+
"switch.disable": "Turn off DevLead mode",
|
|
401
|
+
"switch.pending": "Running the DevLead command\u2026",
|
|
402
|
+
"hint.enabled": "DevLead is on: watched-session turn changes notify and wake this session.",
|
|
403
|
+
"count.watched": "{count} watched",
|
|
404
|
+
"count.running": "{count} running",
|
|
405
|
+
"count.missing": "{count} unavailable",
|
|
406
|
+
"toggle.enable": "Turn on DevLead mode",
|
|
407
|
+
"toggle.failed": "Could not turn on DevLead mode: {message} (hover to read, then retry)",
|
|
408
|
+
"toggle.failed.status": "Could not turn on DevLead mode: {message}",
|
|
409
|
+
"notification.turn": "turn {turn}",
|
|
410
|
+
"transition.completed": "completed",
|
|
411
|
+
"transition.error": "failed",
|
|
412
|
+
"transition.blocked": "blocked",
|
|
413
|
+
"transition.aborted": "cancelled",
|
|
414
|
+
"transition.max-tokens": "hit the token limit",
|
|
415
|
+
"transition.interrupted": "interrupted",
|
|
416
|
+
"transition.forked": "forked",
|
|
417
|
+
"transition.unknown": "unknown state",
|
|
418
|
+
"error.command": "Command failed: {message} ({code})",
|
|
419
|
+
"error.rejected": "Command rejected: {message}",
|
|
420
|
+
"error.unknown": "Command failed: {message}",
|
|
421
|
+
"error.unresolved": "Command did not run: the Host did not recognize {line}"
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
// packages/client-ui/src/client/styles.ts
|
|
425
|
+
var STYLE_ATTRIBUTE = "data-plugin-css";
|
|
426
|
+
var STYLE_KEY = "devlead";
|
|
427
|
+
var styles = `
|
|
428
|
+
/* Composer-tool row control: the 28px round glyph seat of the shipped attach
|
|
429
|
+
and mode controls, so the off-state entry reads as one of them. */
|
|
430
|
+
.devlead-toggle {
|
|
431
|
+
flex: none;
|
|
432
|
+
width: 28px;
|
|
433
|
+
height: 28px;
|
|
434
|
+
padding: 0;
|
|
435
|
+
border-radius: 999px;
|
|
436
|
+
color: var(--dsw-alias-label-tertiary, GrayText);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
@media (hover: hover) {
|
|
440
|
+
.devlead-toggle:hover:not(:disabled) {
|
|
441
|
+
color: var(--dsw-alias-label-secondary, GrayText);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
.devlead-toggle[data-devlead-failed="true"] {
|
|
446
|
+
color: var(--dsw-alias-state-error-primary, #c0392b);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.devlead-dock {
|
|
450
|
+
box-sizing: border-box;
|
|
451
|
+
width: calc(
|
|
452
|
+
100% -
|
|
453
|
+
var(--dsh-composer-side-clearance, 16px) -
|
|
454
|
+
var(--dsh-composer-side-clearance, 16px) -
|
|
455
|
+
var(--dsh-composer-dock-inset, 8px) -
|
|
456
|
+
var(--dsh-composer-dock-inset, 8px) -
|
|
457
|
+
var(--dsh-composer-dock-inset, 8px) -
|
|
458
|
+
var(--dsh-composer-dock-inset, 8px)
|
|
459
|
+
);
|
|
460
|
+
max-width: calc(var(--dsh-composer-card-max-width, 952px) - 4 * var(--dsh-composer-dock-inset, 8px));
|
|
461
|
+
margin: 0 auto;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/* Menu-surface card: the composer context-stack geometry and elevation triple
|
|
465
|
+
(stroke + soft light) rather than an extra CSS border, which would double the
|
|
466
|
+
hairline and add layout width; the blur needs the surface on a background
|
|
467
|
+
layer, so it is painted by the pseudo-element behind the content. */
|
|
468
|
+
.devlead-bar {
|
|
469
|
+
position: relative;
|
|
470
|
+
isolation: isolate;
|
|
471
|
+
box-sizing: border-box;
|
|
472
|
+
display: flex;
|
|
473
|
+
align-items: center;
|
|
474
|
+
gap: 8px;
|
|
475
|
+
width: 100%;
|
|
476
|
+
min-height: 34px;
|
|
477
|
+
margin: 0 auto;
|
|
478
|
+
padding: 4px 6px 4px 12px;
|
|
479
|
+
border: 0;
|
|
480
|
+
--dsw-elevation-stroke-color: var(--dsw-alias-border-l1, rgba(127, 127, 127, 0.24));
|
|
481
|
+
border-radius: var(--dsw-radius-md, 10px);
|
|
482
|
+
box-shadow: var(--dsw-elevation-panel, 0 1px 2px rgba(0, 0, 0, 0.08));
|
|
483
|
+
color: var(--dsw-alias-label-primary, CanvasText);
|
|
484
|
+
font-size: 13px;
|
|
485
|
+
line-height: 20px;
|
|
486
|
+
font-family: inherit;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.devlead-bar::before {
|
|
490
|
+
position: absolute;
|
|
491
|
+
z-index: -1;
|
|
492
|
+
inset: 0;
|
|
493
|
+
border-radius: inherit;
|
|
494
|
+
background: var(--dsw-specific-menu, Canvas);
|
|
495
|
+
backdrop-filter: var(--dsw-menu-backdrop-filter, none);
|
|
496
|
+
content: '';
|
|
497
|
+
pointer-events: none;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
.devlead-glyph {
|
|
501
|
+
display: inline-flex;
|
|
502
|
+
flex: none;
|
|
503
|
+
align-items: center;
|
|
504
|
+
color: var(--dsw-alias-label-tertiary, GrayText);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
.devlead-label {
|
|
508
|
+
flex: none;
|
|
509
|
+
font-weight: 500;
|
|
510
|
+
color: var(--dsw-alias-label-primary, CanvasText);
|
|
511
|
+
white-space: nowrap;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
.devlead-switch {
|
|
515
|
+
flex: none;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
.devlead-meta {
|
|
519
|
+
display: inline-flex;
|
|
520
|
+
flex: none;
|
|
521
|
+
align-items: center;
|
|
522
|
+
gap: 10px;
|
|
523
|
+
color: var(--dsw-alias-label-secondary, GrayText);
|
|
524
|
+
font-variant-numeric: tabular-nums;
|
|
525
|
+
white-space: nowrap;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
.devlead-watched {
|
|
529
|
+
flex: none;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
.devlead-running {
|
|
533
|
+
display: inline-flex;
|
|
534
|
+
align-items: center;
|
|
535
|
+
gap: 5px;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
.devlead-dot {
|
|
539
|
+
flex: none;
|
|
540
|
+
width: 6px;
|
|
541
|
+
height: 6px;
|
|
542
|
+
border-radius: 999px;
|
|
543
|
+
background: var(--dsw-alias-label-tertiary, GrayText);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.devlead-dot[data-active="true"] {
|
|
547
|
+
background: var(--dsw-alias-state-success-primary, #2e7d32);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
.devlead-missing {
|
|
551
|
+
color: var(--dsw-alias-state-warn-primary, #a15c00);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/* One stable live region wrapping the hint or the latest-notification chip so
|
|
555
|
+
assistive technology announces a new notification as a content change of an
|
|
556
|
+
existing region, not as a freshly inserted one. */
|
|
557
|
+
.devlead-notice {
|
|
558
|
+
display: inline-flex;
|
|
559
|
+
flex: 1 1 auto;
|
|
560
|
+
align-items: center;
|
|
561
|
+
min-width: 0;
|
|
562
|
+
overflow: hidden;
|
|
563
|
+
white-space: nowrap;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
.devlead-hint {
|
|
567
|
+
flex: 1 1 auto;
|
|
568
|
+
min-width: 0;
|
|
569
|
+
overflow: hidden;
|
|
570
|
+
color: var(--dsw-alias-label-tertiary, GrayText);
|
|
571
|
+
font-size: 12px;
|
|
572
|
+
text-overflow: ellipsis;
|
|
573
|
+
white-space: nowrap;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
.devlead-notification {
|
|
577
|
+
display: inline-flex;
|
|
578
|
+
flex: 1 1 auto;
|
|
579
|
+
align-items: center;
|
|
580
|
+
gap: 6px;
|
|
581
|
+
min-width: 0;
|
|
582
|
+
overflow: hidden;
|
|
583
|
+
color: var(--dsw-alias-label-secondary, GrayText);
|
|
584
|
+
white-space: nowrap;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
.devlead-notification-dot {
|
|
588
|
+
flex: none;
|
|
589
|
+
width: 6px;
|
|
590
|
+
height: 6px;
|
|
591
|
+
border-radius: 999px;
|
|
592
|
+
background: var(--dsw-alias-label-tertiary, GrayText);
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
.devlead-notification-dot[data-transition="completed"] {
|
|
596
|
+
background: var(--dsw-alias-state-success-primary, #2e7d32);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
.devlead-notification-dot[data-transition="error"] {
|
|
600
|
+
background: var(--dsw-alias-state-error-primary, #c0392b);
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
.devlead-notification-dot[data-transition="blocked"],
|
|
604
|
+
.devlead-notification-dot[data-transition="max-tokens"] {
|
|
605
|
+
background: var(--dsw-alias-state-warn-primary, #a15c00);
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
.devlead-notification-who {
|
|
609
|
+
flex: 0 1 auto;
|
|
610
|
+
min-width: 0;
|
|
611
|
+
overflow: hidden;
|
|
612
|
+
color: var(--dsw-alias-label-primary-dimmed, rgba(127, 127, 127, 0.9));
|
|
613
|
+
text-overflow: ellipsis;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
.devlead-notification-turn,
|
|
617
|
+
.devlead-notification-label {
|
|
618
|
+
flex: none;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
.devlead-notification-error {
|
|
622
|
+
flex: 0 1 auto;
|
|
623
|
+
min-width: 0;
|
|
624
|
+
overflow: hidden;
|
|
625
|
+
color: var(--dsw-alias-state-error-primary, #c0392b);
|
|
626
|
+
font-size: 12px;
|
|
627
|
+
text-overflow: ellipsis;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
.devlead-error {
|
|
631
|
+
flex: 0 1 auto;
|
|
632
|
+
min-width: 0;
|
|
633
|
+
overflow: hidden;
|
|
634
|
+
color: var(--dsw-alias-state-error-primary, #c0392b);
|
|
635
|
+
font-size: 12px;
|
|
636
|
+
text-overflow: ellipsis;
|
|
637
|
+
white-space: nowrap;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
/* Visually hidden but announced: the compact toolbar surface has no inline
|
|
641
|
+
error seat, so its failure text is mirrored into a live region through this
|
|
642
|
+
class (the shipped visually-hidden idiom used by the chat surfaces). */
|
|
643
|
+
.devlead-sr-only {
|
|
644
|
+
position: absolute;
|
|
645
|
+
width: 1px;
|
|
646
|
+
height: 1px;
|
|
647
|
+
overflow: hidden;
|
|
648
|
+
clip: rect(0 0 0 0);
|
|
649
|
+
white-space: nowrap;
|
|
650
|
+
}
|
|
651
|
+
`;
|
|
652
|
+
function ensureStyleTag() {
|
|
653
|
+
if (typeof document === "undefined") return () => {
|
|
654
|
+
};
|
|
655
|
+
const existing = document.head.querySelector(`style[${STYLE_ATTRIBUTE}="${STYLE_KEY}"]`);
|
|
656
|
+
if (existing !== null) {
|
|
657
|
+
if (existing.textContent !== styles) existing.textContent = styles;
|
|
658
|
+
return () => {
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
const element = document.createElement("style");
|
|
662
|
+
element.setAttribute(STYLE_ATTRIBUTE, STYLE_KEY);
|
|
663
|
+
element.textContent = styles;
|
|
664
|
+
document.head.appendChild(element);
|
|
665
|
+
return () => {
|
|
666
|
+
element.remove();
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
// packages/client-ui/src/client/index.tsx
|
|
671
|
+
var NS = "devlead";
|
|
672
|
+
var inject = ["slots", "sessions", "remote", "remote.commands", "locale"];
|
|
673
|
+
function apply(ctx) {
|
|
674
|
+
ctx.effect(() => ctx.locale.register(NS, { zh, en }), "devlead: dictionaries");
|
|
675
|
+
ctx.effect(() => ensureStyleTag(), "devlead: styles");
|
|
676
|
+
const face = (sessionId) => ({
|
|
677
|
+
executeCommand: (line) => ctx.remote.commands.execute(sessionId, line, [])
|
|
678
|
+
});
|
|
679
|
+
ctx.slots.inject("conversation.input.left", () => ctx.slots.register({
|
|
680
|
+
name: "conversation.input.left",
|
|
681
|
+
id: "devlead",
|
|
682
|
+
// No shipped entry occupies this list; the order only sequences additive
|
|
683
|
+
// contributions, so the compact switch stays ahead of any later entry.
|
|
684
|
+
order: 12,
|
|
685
|
+
locale: NS,
|
|
686
|
+
inject: face
|
|
687
|
+
}, DevLeadIconToggle));
|
|
688
|
+
ctx.slots.inject("conversation.input.dock", () => ctx.slots.register({
|
|
689
|
+
name: "conversation.input.dock",
|
|
690
|
+
id: "devlead",
|
|
691
|
+
// The shipped context stack orders Todo (0), Goal (10), and Queue (20):
|
|
692
|
+
// the DevLead strip sits directly below the goal card.
|
|
693
|
+
order: 12,
|
|
694
|
+
locale: NS,
|
|
695
|
+
inject: face
|
|
696
|
+
}, DevLeadBar));
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
return module.exports;
|
|
700
|
+
}
|
|
701
|
+
});
|
package/lib/index.js
ADDED
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yankeguo/dsh-client-ui-devlead",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "DevLead surfaces: a compact composer-toolbar switch while off, and the full status strip above the composer while the mode is on.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "lib/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./lib/index.js",
|
|
10
|
+
"./client": "./lib/client.js",
|
|
11
|
+
"./locale/*.json": "./locale/*.json",
|
|
12
|
+
"./package.json": "./package.json"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"lib",
|
|
16
|
+
"locale/*.json"
|
|
17
|
+
],
|
|
18
|
+
"dsh": {
|
|
19
|
+
"client": {
|
|
20
|
+
"inject": [
|
|
21
|
+
"@deepseek-ai/dsh-api-remotes",
|
|
22
|
+
"@deepseek-ai/dsh-api-session-controller",
|
|
23
|
+
"@deepseek-ai/dsh-client-locale",
|
|
24
|
+
"@deepseek-ai/dsh-client-ui-conversation",
|
|
25
|
+
"@deepseek-ai/dsh-client-ui-primitives",
|
|
26
|
+
"@deepseek-ai/dsh-client-ui-renderer",
|
|
27
|
+
"@deepseek-ai/dsh-client-ui-session"
|
|
28
|
+
],
|
|
29
|
+
"platform": "web"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@deepseek-ai/cordis": "~4.1.0"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@yankeguo/dsh-devlead-protocol": "0.1.1"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"dsh": ">=0.2.2-rc.1 <0.3.0"
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "git+https://github.com/yankeguo/dsh-devlead.git",
|
|
47
|
+
"directory": "packages/client-ui"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://github.com/yankeguo/dsh-devlead#readme"
|
|
6
50
|
}
|
package/README.md
DELETED