@yankeguo/dsh-client-ui-devlead 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/lib/client.js +591 -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,591 @@
|
|
|
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_react = require("react");
|
|
35
|
+
var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
36
|
+
|
|
37
|
+
// packages/protocol/src/format.ts
|
|
38
|
+
var DEVLEAD_TRANSITIONS = [
|
|
39
|
+
"completed",
|
|
40
|
+
"error",
|
|
41
|
+
"blocked",
|
|
42
|
+
"aborted",
|
|
43
|
+
"max-tokens",
|
|
44
|
+
"interrupted",
|
|
45
|
+
"forked"
|
|
46
|
+
];
|
|
47
|
+
function isDevLeadTransition(value) {
|
|
48
|
+
return typeof value === "string" && DEVLEAD_TRANSITIONS.includes(value);
|
|
49
|
+
}
|
|
50
|
+
var TRANSITION_LABELS = {
|
|
51
|
+
completed: "completed",
|
|
52
|
+
error: "failed",
|
|
53
|
+
blocked: "blocked",
|
|
54
|
+
aborted: "cancelled",
|
|
55
|
+
"max-tokens": "hit the output-token limit",
|
|
56
|
+
interrupted: "interrupted",
|
|
57
|
+
forked: "forked"
|
|
58
|
+
};
|
|
59
|
+
function transitionLabel(transition) {
|
|
60
|
+
return TRANSITION_LABELS[transition];
|
|
61
|
+
}
|
|
62
|
+
function notificationLine(notification) {
|
|
63
|
+
const who = notification.sessionTitle === void 0 ? notification.sessionId : `${notification.sessionTitle} (${notification.sessionId})`;
|
|
64
|
+
const error = notification.error === void 0 ? "" : `: ${notification.error}`;
|
|
65
|
+
const summary = notification.error === void 0 && notification.summary !== void 0 ? `: ${notification.summary}` : "";
|
|
66
|
+
return `${who} \u2014 turn ${notification.turn} ${transitionLabel(notification.transition)}${error}${summary}`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// packages/client-ui/src/client/format.ts
|
|
70
|
+
function transitionLabelKey(transition) {
|
|
71
|
+
switch (transition) {
|
|
72
|
+
case "completed":
|
|
73
|
+
return "transition.completed";
|
|
74
|
+
case "error":
|
|
75
|
+
return "transition.error";
|
|
76
|
+
case "blocked":
|
|
77
|
+
return "transition.blocked";
|
|
78
|
+
case "aborted":
|
|
79
|
+
return "transition.aborted";
|
|
80
|
+
case "max-tokens":
|
|
81
|
+
return "transition.max-tokens";
|
|
82
|
+
case "interrupted":
|
|
83
|
+
return "transition.interrupted";
|
|
84
|
+
case "forked":
|
|
85
|
+
return "transition.forked";
|
|
86
|
+
default:
|
|
87
|
+
return "transition.unknown";
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function notificationSummary(notification) {
|
|
91
|
+
const rawTitle = typeof notification.sessionTitle === "string" ? notification.sessionTitle.trim() : "";
|
|
92
|
+
const who = rawTitle.length > 0 ? rawTitle : notification.sessionId;
|
|
93
|
+
const turn = Number.isInteger(notification.turn) && notification.turn > 0 ? notification.turn : 0;
|
|
94
|
+
const tooltip = isDevLeadTransition(notification.transition) ? notificationLine(notification) : `${who} \u2014 ${String(notification.transition)}`;
|
|
95
|
+
const rawError = typeof notification.error === "string" ? notification.error.trim() : "";
|
|
96
|
+
return {
|
|
97
|
+
tooltip,
|
|
98
|
+
who,
|
|
99
|
+
turn,
|
|
100
|
+
transition: String(notification.transition),
|
|
101
|
+
labelKey: transitionLabelKey(notification.transition),
|
|
102
|
+
error: rawError.length > 0 ? rawError : void 0
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function latestNotification(notifications) {
|
|
106
|
+
return notifications.at(-1) ?? null;
|
|
107
|
+
}
|
|
108
|
+
function summarizeWatched(watchedSessions, rows, statuses) {
|
|
109
|
+
const seen = /* @__PURE__ */ new Set();
|
|
110
|
+
let running = 0;
|
|
111
|
+
let missing = 0;
|
|
112
|
+
for (const candidate of watchedSessions) {
|
|
113
|
+
if (typeof candidate !== "string" || candidate.length === 0) continue;
|
|
114
|
+
if (seen.has(candidate)) continue;
|
|
115
|
+
seen.add(candidate);
|
|
116
|
+
const row = rows[candidate];
|
|
117
|
+
if (row === void 0) missing += 1;
|
|
118
|
+
const status = statuses?.get(candidate);
|
|
119
|
+
if (status?.running ?? row?.running ?? false) running += 1;
|
|
120
|
+
}
|
|
121
|
+
return { watched: seen.size, running, missing };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// packages/client-ui/src/client/results.ts
|
|
125
|
+
var REJECTED_FALLBACK = "command rejected";
|
|
126
|
+
var UNEXPECTED_FALLBACK = "unknown error";
|
|
127
|
+
function commandFailure(result) {
|
|
128
|
+
if (!result.ok) {
|
|
129
|
+
return { kind: "transport", message: result.error.message, code: result.error.code };
|
|
130
|
+
}
|
|
131
|
+
const outcome = result.value?.result;
|
|
132
|
+
if (outcome === void 0 || outcome.kind !== "error") return void 0;
|
|
133
|
+
return { kind: "rejected", message: outcome.text ?? REJECTED_FALLBACK };
|
|
134
|
+
}
|
|
135
|
+
function unexpectedFailure(error) {
|
|
136
|
+
return { kind: "unexpected", message: error instanceof Error ? error.message : UNEXPECTED_FALLBACK };
|
|
137
|
+
}
|
|
138
|
+
async function admitCommand(executeCommand, line) {
|
|
139
|
+
try {
|
|
140
|
+
return commandFailure(await executeCommand(line));
|
|
141
|
+
} catch (error) {
|
|
142
|
+
return unexpectedFailure(error);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function failureMessage(failure) {
|
|
146
|
+
return failure.message;
|
|
147
|
+
}
|
|
148
|
+
function failureCopy(failure) {
|
|
149
|
+
switch (failure.kind) {
|
|
150
|
+
case "transport":
|
|
151
|
+
return { key: "error.command", params: { message: failure.message, code: failure.code } };
|
|
152
|
+
case "rejected":
|
|
153
|
+
return { key: "error.rejected", params: { message: failure.message } };
|
|
154
|
+
case "unexpected":
|
|
155
|
+
return { key: "error.unknown", params: { message: failure.message } };
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// packages/client-ui/src/client/DevLeadBar.tsx
|
|
160
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
161
|
+
function DevLeadBar({
|
|
162
|
+
useProjection,
|
|
163
|
+
useSessions,
|
|
164
|
+
useSessionStatus,
|
|
165
|
+
executeCommand,
|
|
166
|
+
t
|
|
167
|
+
}) {
|
|
168
|
+
const projection = useProjection("devLead");
|
|
169
|
+
const rows = useSessions((state) => state.byId);
|
|
170
|
+
const statuses = useSessionStatus((current) => current);
|
|
171
|
+
const enabled = projection?.enabled ?? false;
|
|
172
|
+
const [pending, setPending] = (0, import_react.useState)(false);
|
|
173
|
+
const [failure, setFailure] = (0, import_react.useState)(null);
|
|
174
|
+
const pendingRef = (0, import_react.useRef)(false);
|
|
175
|
+
(0, import_react.useEffect)(() => {
|
|
176
|
+
setFailure(null);
|
|
177
|
+
}, [enabled]);
|
|
178
|
+
if (projection === void 0 || !enabled) return null;
|
|
179
|
+
const summary = summarizeWatched(projection.sessions, rows, statuses);
|
|
180
|
+
const latest = latestNotification(projection.notifications);
|
|
181
|
+
const notice = latest === null ? null : notificationSummary(latest);
|
|
182
|
+
const failureLine = failure === null ? null : failureCopy(failure);
|
|
183
|
+
const switchTitle = pending ? t("switch.pending") : t("switch.disable");
|
|
184
|
+
const toggle = (next) => {
|
|
185
|
+
if (next || pendingRef.current) return;
|
|
186
|
+
pendingRef.current = true;
|
|
187
|
+
setPending(true);
|
|
188
|
+
setFailure(null);
|
|
189
|
+
void admitCommand(executeCommand, "/devlead off").then((rejected) => {
|
|
190
|
+
pendingRef.current = false;
|
|
191
|
+
setPending(false);
|
|
192
|
+
if (rejected !== void 0) setFailure(rejected);
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
196
|
+
"div",
|
|
197
|
+
{
|
|
198
|
+
className: "devlead-dock",
|
|
199
|
+
"data-devlead-bar": "true",
|
|
200
|
+
"data-devlead-enabled": "true",
|
|
201
|
+
"data-devlead-pending": pending ? "true" : "false",
|
|
202
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
203
|
+
"div",
|
|
204
|
+
{
|
|
205
|
+
className: "devlead-bar",
|
|
206
|
+
role: "group",
|
|
207
|
+
"aria-label": t("bar.aria"),
|
|
208
|
+
"aria-busy": pending,
|
|
209
|
+
title: t("hint.enabled"),
|
|
210
|
+
children: [
|
|
211
|
+
/* @__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 }) }),
|
|
212
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-label", children: t("label") }),
|
|
213
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
214
|
+
import_dsh_client_ui_primitives.Switch,
|
|
215
|
+
{
|
|
216
|
+
className: "devlead-switch",
|
|
217
|
+
checked: true,
|
|
218
|
+
disabled: pending,
|
|
219
|
+
label: t("switch.aria"),
|
|
220
|
+
title: switchTitle,
|
|
221
|
+
onChange: toggle
|
|
222
|
+
}
|
|
223
|
+
),
|
|
224
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "devlead-meta", children: [
|
|
225
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-watched", children: t("count.watched", { count: summary.watched }) }),
|
|
226
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "devlead-running", children: [
|
|
227
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
228
|
+
"span",
|
|
229
|
+
{
|
|
230
|
+
className: "devlead-dot",
|
|
231
|
+
"data-active": summary.running > 0 ? "true" : "false",
|
|
232
|
+
"aria-hidden": "true"
|
|
233
|
+
}
|
|
234
|
+
),
|
|
235
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: t("count.running", { count: summary.running }) })
|
|
236
|
+
] }),
|
|
237
|
+
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 }) })
|
|
238
|
+
] }),
|
|
239
|
+
notice === null ? (
|
|
240
|
+
// An enabled Session with no retained notification keeps the help
|
|
241
|
+
// hint visible instead of leaving the row visually empty.
|
|
242
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-hint", title: t("hint.enabled"), children: t("hint.enabled") })
|
|
243
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "devlead-notification", title: notice.tooltip, children: [
|
|
244
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
245
|
+
"span",
|
|
246
|
+
{
|
|
247
|
+
className: "devlead-notification-dot",
|
|
248
|
+
"data-transition": notice.transition,
|
|
249
|
+
"aria-hidden": "true"
|
|
250
|
+
}
|
|
251
|
+
),
|
|
252
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-who", children: notice.who }),
|
|
253
|
+
notice.turn > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-turn", children: t("notification.turn", { turn: notice.turn }) }),
|
|
254
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-label", children: t(notice.labelKey) }),
|
|
255
|
+
notice.error !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-error", children: notice.error })
|
|
256
|
+
] }),
|
|
257
|
+
failureLine !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-error", role: "alert", children: t(failureLine.key, failureLine.params) })
|
|
258
|
+
]
|
|
259
|
+
}
|
|
260
|
+
)
|
|
261
|
+
}
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// packages/client-ui/src/client/DevLeadIconToggle.tsx
|
|
266
|
+
var import_react2 = require("react");
|
|
267
|
+
var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
268
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
269
|
+
function DevLeadIconToggle({ useProjection, executeCommand, t }) {
|
|
270
|
+
const projection = useProjection("devLead");
|
|
271
|
+
const enabled = projection?.enabled ?? false;
|
|
272
|
+
const [pending, setPending] = (0, import_react2.useState)(false);
|
|
273
|
+
const [failure, setFailure] = (0, import_react2.useState)(null);
|
|
274
|
+
const pendingRef = (0, import_react2.useRef)(false);
|
|
275
|
+
(0, import_react2.useEffect)(() => {
|
|
276
|
+
setFailure(null);
|
|
277
|
+
}, [enabled]);
|
|
278
|
+
if (projection === void 0 || enabled) return null;
|
|
279
|
+
const enable = () => {
|
|
280
|
+
if (pendingRef.current) return;
|
|
281
|
+
pendingRef.current = true;
|
|
282
|
+
setPending(true);
|
|
283
|
+
setFailure(null);
|
|
284
|
+
void admitCommand(executeCommand, "/devlead on").then((rejected) => {
|
|
285
|
+
pendingRef.current = false;
|
|
286
|
+
setPending(false);
|
|
287
|
+
if (rejected !== void 0) setFailure(rejected);
|
|
288
|
+
});
|
|
289
|
+
};
|
|
290
|
+
const label = failure === null ? t("toggle.enable") : t("toggle.failed", { message: failureMessage(failure) });
|
|
291
|
+
return /* @__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)(
|
|
292
|
+
import_dsh_client_ui_primitives2.Button,
|
|
293
|
+
{
|
|
294
|
+
variant: "ghost",
|
|
295
|
+
size: "sm",
|
|
296
|
+
className: "devlead-toggle",
|
|
297
|
+
"aria-label": label,
|
|
298
|
+
disabled: pending,
|
|
299
|
+
"data-devlead-toggle": "true",
|
|
300
|
+
"data-devlead-pending": pending ? "true" : "false",
|
|
301
|
+
"data-devlead-failed": failure === null ? "false" : "true",
|
|
302
|
+
onClick: enable,
|
|
303
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.IconUsersOutlineRegular, { size: 16, "aria-hidden": "true" })
|
|
304
|
+
}
|
|
305
|
+
) });
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// packages/client-ui/src/client/locales.ts
|
|
309
|
+
var zh = {
|
|
310
|
+
"meta.title": "DevLead \u6A21\u5F0F",
|
|
311
|
+
"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",
|
|
312
|
+
"bar.aria": "DevLead \u72B6\u6001\u680F",
|
|
313
|
+
"label": "DevLead",
|
|
314
|
+
"switch.aria": "DevLead \u6A21\u5F0F",
|
|
315
|
+
"switch.disable": "\u5173\u95ED DevLead \u6A21\u5F0F",
|
|
316
|
+
"switch.pending": "\u6B63\u5728\u6267\u884C DevLead \u547D\u4EE4\u2026",
|
|
317
|
+
"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",
|
|
318
|
+
"count.watched": "\u76D1\u7763 {count} \u4E2A\u4F1A\u8BDD",
|
|
319
|
+
"count.running": "\u8FD0\u884C\u4E2D {count}",
|
|
320
|
+
"count.missing": "{count} \u4E2A\u5DF2\u4E0D\u53EF\u7528",
|
|
321
|
+
"toggle.enable": "\u5F00\u542F DevLead \u6A21\u5F0F",
|
|
322
|
+
"toggle.failed": "\u5F00\u542F DevLead \u6A21\u5F0F\u5931\u8D25\uFF1A{message}\uFF08\u60AC\u505C\u67E5\u770B\uFF0C\u53EF\u91CD\u8BD5\uFF09",
|
|
323
|
+
"notification.turn": "\u7B2C {turn} \u8F6E",
|
|
324
|
+
"transition.completed": "\u5B8C\u6210",
|
|
325
|
+
"transition.error": "\u5931\u8D25",
|
|
326
|
+
"transition.blocked": "\u963B\u585E",
|
|
327
|
+
"transition.aborted": "\u5DF2\u53D6\u6D88",
|
|
328
|
+
"transition.max-tokens": "\u8D85\u51FA\u8F93\u51FA\u4E0A\u9650",
|
|
329
|
+
"transition.interrupted": "\u5DF2\u4E2D\u65AD",
|
|
330
|
+
"transition.forked": "\u5DF2\u5206\u53C9",
|
|
331
|
+
"transition.unknown": "\u672A\u77E5\u72B6\u6001",
|
|
332
|
+
"error.command": "\u547D\u4EE4\u5931\u8D25\uFF1A{message}\uFF08{code}\uFF09",
|
|
333
|
+
"error.rejected": "\u547D\u4EE4\u88AB\u62D2\u7EDD\uFF1A{message}",
|
|
334
|
+
"error.unknown": "\u547D\u4EE4\u6267\u884C\u5931\u8D25\uFF1A{message}"
|
|
335
|
+
};
|
|
336
|
+
var en = {
|
|
337
|
+
"meta.title": "DevLead mode",
|
|
338
|
+
"meta.description": "Toggles DevLead mode from the composer toolbar; once enabled, a status strip above the composer shows watched sessions and the latest notification.",
|
|
339
|
+
"bar.aria": "DevLead status bar",
|
|
340
|
+
"label": "DevLead",
|
|
341
|
+
"switch.aria": "DevLead mode",
|
|
342
|
+
"switch.disable": "Turn off DevLead mode",
|
|
343
|
+
"switch.pending": "Running the DevLead command\u2026",
|
|
344
|
+
"hint.enabled": "DevLead is on: watched-session turn changes notify and wake this session.",
|
|
345
|
+
"count.watched": "{count} watched",
|
|
346
|
+
"count.running": "{count} running",
|
|
347
|
+
"count.missing": "{count} unavailable",
|
|
348
|
+
"toggle.enable": "Turn on DevLead mode",
|
|
349
|
+
"toggle.failed": "Could not turn on DevLead mode: {message} (hover to read, then retry)",
|
|
350
|
+
"notification.turn": "turn {turn}",
|
|
351
|
+
"transition.completed": "completed",
|
|
352
|
+
"transition.error": "failed",
|
|
353
|
+
"transition.blocked": "blocked",
|
|
354
|
+
"transition.aborted": "cancelled",
|
|
355
|
+
"transition.max-tokens": "hit the token limit",
|
|
356
|
+
"transition.interrupted": "interrupted",
|
|
357
|
+
"transition.forked": "forked",
|
|
358
|
+
"transition.unknown": "unknown state",
|
|
359
|
+
"error.command": "Command failed: {message} ({code})",
|
|
360
|
+
"error.rejected": "Command rejected: {message}",
|
|
361
|
+
"error.unknown": "Command failed: {message}"
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
// packages/client-ui/src/client/styles.ts
|
|
365
|
+
var STYLE_ATTRIBUTE = "data-plugin-css";
|
|
366
|
+
var STYLE_KEY = "devlead";
|
|
367
|
+
var styles = `
|
|
368
|
+
.devlead-toggle {
|
|
369
|
+
flex: none;
|
|
370
|
+
color: var(--dsw-alias-label-tertiary, GrayText);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
@media (hover: hover) {
|
|
374
|
+
.devlead-toggle:hover:not(:disabled) {
|
|
375
|
+
color: var(--dsw-alias-label-secondary, GrayText);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.devlead-toggle[data-devlead-failed="true"] {
|
|
380
|
+
color: var(--dsw-alias-state-error-primary, #c0392b);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.devlead-dock {
|
|
384
|
+
box-sizing: border-box;
|
|
385
|
+
width: calc(
|
|
386
|
+
100% -
|
|
387
|
+
var(--dsh-composer-side-clearance, 16px) -
|
|
388
|
+
var(--dsh-composer-side-clearance, 16px) -
|
|
389
|
+
var(--dsh-composer-dock-inset, 4px) -
|
|
390
|
+
var(--dsh-composer-dock-inset, 4px) -
|
|
391
|
+
var(--dsh-composer-dock-inset, 4px) -
|
|
392
|
+
var(--dsh-composer-dock-inset, 4px)
|
|
393
|
+
);
|
|
394
|
+
max-width: calc(var(--dsh-composer-card-max-width, 960px) - 4 * var(--dsh-composer-dock-inset, 4px));
|
|
395
|
+
margin: 0 auto;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.devlead-bar {
|
|
399
|
+
position: relative;
|
|
400
|
+
box-sizing: border-box;
|
|
401
|
+
display: flex;
|
|
402
|
+
align-items: center;
|
|
403
|
+
gap: 8px;
|
|
404
|
+
width: 100%;
|
|
405
|
+
min-height: 34px;
|
|
406
|
+
margin: 0 auto;
|
|
407
|
+
padding: 4px 6px 4px 12px;
|
|
408
|
+
border: 1px solid var(--dsw-alias-border-l1, rgba(127, 127, 127, 0.24));
|
|
409
|
+
border-radius: var(--dsw-radius-md, 10px);
|
|
410
|
+
background: var(--dsw-specific-menu, Canvas);
|
|
411
|
+
box-shadow: var(--dsw-elevation-panel, 0 1px 2px rgba(0, 0, 0, 0.08));
|
|
412
|
+
color: var(--dsw-alias-label-primary, CanvasText);
|
|
413
|
+
font-size: 13px;
|
|
414
|
+
line-height: 20px;
|
|
415
|
+
font-family: inherit;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.devlead-glyph {
|
|
419
|
+
display: inline-flex;
|
|
420
|
+
flex: none;
|
|
421
|
+
align-items: center;
|
|
422
|
+
color: var(--dsw-alias-label-tertiary, GrayText);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.devlead-label {
|
|
426
|
+
flex: none;
|
|
427
|
+
font-weight: 500;
|
|
428
|
+
color: var(--dsw-alias-label-primary, CanvasText);
|
|
429
|
+
white-space: nowrap;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
.devlead-switch {
|
|
433
|
+
flex: none;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.devlead-meta {
|
|
437
|
+
display: inline-flex;
|
|
438
|
+
flex: none;
|
|
439
|
+
align-items: center;
|
|
440
|
+
gap: 10px;
|
|
441
|
+
color: var(--dsw-alias-label-secondary, GrayText);
|
|
442
|
+
font-variant-numeric: tabular-nums;
|
|
443
|
+
white-space: nowrap;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.devlead-watched {
|
|
447
|
+
flex: none;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.devlead-running {
|
|
451
|
+
display: inline-flex;
|
|
452
|
+
align-items: center;
|
|
453
|
+
gap: 5px;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.devlead-dot {
|
|
457
|
+
flex: none;
|
|
458
|
+
width: 6px;
|
|
459
|
+
height: 6px;
|
|
460
|
+
border-radius: 999px;
|
|
461
|
+
background: var(--dsw-alias-label-tertiary, GrayText);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.devlead-dot[data-active="true"] {
|
|
465
|
+
background: var(--dsw-alias-state-success-primary, #2e7d32);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.devlead-missing {
|
|
469
|
+
color: var(--dsw-alias-state-warn-primary, #a15c00);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
.devlead-hint {
|
|
473
|
+
flex: 1 1 auto;
|
|
474
|
+
min-width: 0;
|
|
475
|
+
overflow: hidden;
|
|
476
|
+
color: var(--dsw-alias-label-tertiary, GrayText);
|
|
477
|
+
font-size: 12px;
|
|
478
|
+
text-overflow: ellipsis;
|
|
479
|
+
white-space: nowrap;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.devlead-notification {
|
|
483
|
+
display: inline-flex;
|
|
484
|
+
flex: 1 1 auto;
|
|
485
|
+
align-items: center;
|
|
486
|
+
gap: 6px;
|
|
487
|
+
min-width: 0;
|
|
488
|
+
overflow: hidden;
|
|
489
|
+
color: var(--dsw-alias-label-secondary, GrayText);
|
|
490
|
+
white-space: nowrap;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.devlead-notification-dot {
|
|
494
|
+
flex: none;
|
|
495
|
+
width: 6px;
|
|
496
|
+
height: 6px;
|
|
497
|
+
border-radius: 999px;
|
|
498
|
+
background: var(--dsw-alias-label-tertiary, GrayText);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
.devlead-notification-dot[data-transition="completed"] {
|
|
502
|
+
background: var(--dsw-alias-state-success-primary, #2e7d32);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
.devlead-notification-dot[data-transition="error"] {
|
|
506
|
+
background: var(--dsw-alias-state-error-primary, #c0392b);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
.devlead-notification-dot[data-transition="blocked"],
|
|
510
|
+
.devlead-notification-dot[data-transition="max-tokens"] {
|
|
511
|
+
background: var(--dsw-alias-state-warn-primary, #a15c00);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
.devlead-notification-who {
|
|
515
|
+
flex: 0 1 auto;
|
|
516
|
+
min-width: 0;
|
|
517
|
+
overflow: hidden;
|
|
518
|
+
color: var(--dsw-alias-label-primary-dimmed, rgba(127, 127, 127, 0.9));
|
|
519
|
+
text-overflow: ellipsis;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
.devlead-notification-turn,
|
|
523
|
+
.devlead-notification-label {
|
|
524
|
+
flex: none;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.devlead-notification-error {
|
|
528
|
+
flex: 0 1 auto;
|
|
529
|
+
min-width: 0;
|
|
530
|
+
overflow: hidden;
|
|
531
|
+
color: var(--dsw-alias-state-error-primary, #c0392b);
|
|
532
|
+
font-size: 12px;
|
|
533
|
+
text-overflow: ellipsis;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
.devlead-error {
|
|
537
|
+
flex: 0 1 auto;
|
|
538
|
+
min-width: 0;
|
|
539
|
+
overflow: hidden;
|
|
540
|
+
color: var(--dsw-alias-state-error-primary, #c0392b);
|
|
541
|
+
font-size: 12px;
|
|
542
|
+
text-overflow: ellipsis;
|
|
543
|
+
white-space: nowrap;
|
|
544
|
+
}
|
|
545
|
+
`;
|
|
546
|
+
function ensureStyleTag() {
|
|
547
|
+
if (typeof document === "undefined") return () => {
|
|
548
|
+
};
|
|
549
|
+
const existing = document.head.querySelector(`style[${STYLE_ATTRIBUTE}="${STYLE_KEY}"]`);
|
|
550
|
+
if (existing !== null) {
|
|
551
|
+
if (existing.textContent !== styles) existing.textContent = styles;
|
|
552
|
+
return () => {
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
const element = document.createElement("style");
|
|
556
|
+
element.setAttribute(STYLE_ATTRIBUTE, STYLE_KEY);
|
|
557
|
+
element.textContent = styles;
|
|
558
|
+
document.head.appendChild(element);
|
|
559
|
+
return () => {
|
|
560
|
+
element.remove();
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
// packages/client-ui/src/client/index.tsx
|
|
565
|
+
var NS = "devlead";
|
|
566
|
+
var inject = ["slots", "sessions", "remote", "remote.commands", "locale"];
|
|
567
|
+
function apply(ctx) {
|
|
568
|
+
ctx.effect(() => ctx.locale.register(NS, { zh, en }), "devlead: dictionaries");
|
|
569
|
+
ctx.effect(() => ensureStyleTag(), "devlead: styles");
|
|
570
|
+
const face = (sessionId) => ({
|
|
571
|
+
executeCommand: (line) => ctx.remote.commands.execute(sessionId, line, [])
|
|
572
|
+
});
|
|
573
|
+
ctx.slots.inject("conversation.input.left", () => ctx.slots.register({
|
|
574
|
+
name: "conversation.input.left",
|
|
575
|
+
id: "devlead",
|
|
576
|
+
order: 12,
|
|
577
|
+
locale: NS,
|
|
578
|
+
inject: face
|
|
579
|
+
}, DevLeadIconToggle));
|
|
580
|
+
ctx.slots.inject("conversation.input.dock", () => ctx.slots.register({
|
|
581
|
+
name: "conversation.input.dock",
|
|
582
|
+
id: "devlead",
|
|
583
|
+
order: 12,
|
|
584
|
+
locale: NS,
|
|
585
|
+
inject: face
|
|
586
|
+
}, DevLeadBar));
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
return module.exports;
|
|
590
|
+
}
|
|
591
|
+
});
|
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.0",
|
|
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.0"
|
|
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