@yankeguo/dsh-client-ui-devlead 0.2.3 → 0.2.5

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/README.md CHANGED
@@ -2,22 +2,27 @@
2
2
 
3
3
  Browser half of the DevLead suite, loaded on the DSH **Web** platform.
4
4
 
5
- - **Off state:** a compact ghost icon in the composer toolbar (`conversation.input.left`) sends
6
- `/devlead on`.
7
- - **On state:** a status strip above the composer (`conversation.input.dock`) shows the switch,
8
- watched/running counts, and the latest retained notification; the switch sends `/devlead off`.
5
+ - **Mode switch (both states):** a compact ghost button in the composer toolbar
6
+ (`conversation.input.left`) shows the users icon plus a visible `DevLead` label and sends
7
+ `/devlead on` while the mode is off and `/devlead off` while it is on. The same button stays
8
+ mounted in both states; while the mode is on it gains the business-accent border and a light
9
+ halo, with the border reserved transparent in the off state so the toolbar never shifts.
10
+ - **On state:** a status strip above the composer (`conversation.input.dock`) shows the brand,
11
+ watched/running counts, and the newest retained notification or mid-turn report (or the help
12
+ hint). Reports show sender, localized kind, and summary/message; the strip is display-only and
13
+ owns no switch.
9
14
  - **Sidebar marks:** enabled Sessions get a shield mark (`sidebar.session.row.trailing`) and a
10
15
  line in the row hover card (`sidebar.session.row.hover`), read from the summary-sized
11
16
  `devLeadMode` projection.
12
17
 
13
- The browser bundle only registers into DSH client slots and sends `/devlead` commands. It has no
14
- custom Remote API, no optimistic state flips, and no direct Host access; all durable state comes
15
- from the `devLead` / `devLeadMode` projections. The locale namespace is `devlead` with `zh` and
16
- `en` dictionaries.
18
+ The browser bundle only registers into DSH client slots and sends `/devlead` commands from the
19
+ toolbar toggle. It has no custom Remote API, no optimistic state flips, and no direct Host access;
20
+ all durable state comes from the `devLead` / `devLeadMode` projections. The locale namespace is
21
+ `devlead` with `zh` and `en` dictionaries.
17
22
 
18
23
  Style injection is reference-counted across **module instances** (`Symbol.for(...)` key on `globalThis`):
19
24
  HMR old/new instances can coexist without an old disposer removing the `<style>` tag a new instance
20
- still uses. The two entry points and `useDevLeadAdmission` have React render tests using
25
+ still uses. The two surfaces and `useDevLeadAdmission` have React render tests using
21
26
  `react-test-renderer` (devDependency only, pure node, no jsdom); the style-tag refcount is covered
22
27
  by a second-module-instance test (`vi.resetModules()` + dynamic import).
23
28
 
@@ -40,8 +45,9 @@ dsh plugin --profile desktop add @yankeguo/dsh-devlead-bundle
40
45
 
41
46
  ## 中文
42
47
 
43
- `@yankeguo/dsh-client-ui-devlead` 是浏览器半边:未开启时的 composer 工具条图标、开启后的
44
- DevLeadBar、侧边栏会话行标记;只读 `devLead`/`devLeadMode` projection 并发送 `/devlead`
45
- 命令。0.2.0 起样式注入用跨模块实例引用计数(HMR 新旧实例交替不误删标签),两个入口与准入
46
- hook 用 `react-test-renderer` 做渲染测试。已知 mark 回填与 blank 行限制见根 README。完整中文文档见
48
+ `@yankeguo/dsh-client-ui-devlead` 是浏览器半边:composer 工具条里两态都存在的 DevLead
49
+ 图标 + 文本开关(关闭态发 `/devlead on`、开启态发 `/devlead off`)、开启后的只读 DevLeadBar 状态条、
50
+ 侧边栏会话行标记;只读 `devLead`/`devLeadMode` projection 并发送 `/devlead` 命令。
51
+ 0.2.0 起样式注入用跨模块实例引用计数(HMR 新旧实例交替不误删标签),组件与准入 hook 用
52
+ `react-test-renderer` 做渲染测试。已知 mark 回填与 blank 行限制见根 README。完整中文文档见
47
53
  [根 README.zh.md](https://github.com/yankeguo/dsh-devlead/blob/main/README.zh.md)与[设计说明](https://github.com/yankeguo/dsh-devlead/blob/main/docs/DESIGN.md)。
package/lib/client.js CHANGED
@@ -38,6 +38,7 @@ window.__ModuleLoader__.load({
38
38
  var DEVLEAD_MODE_PROJECTION_KEY = "devLeadMode";
39
39
  var DEVLEAD_COMMAND_NAME = "devlead";
40
40
  var DEVLEAD_ERROR_EXCERPT_MAX = 240;
41
+ var DEVLEAD_REPORT_KINDS = ["progress", "blocked", "decision", "fyi"];
41
42
 
42
43
  // packages/protocol/src/format.ts
43
44
  var DEVLEAD_TRANSITIONS = [
@@ -86,6 +87,22 @@ window.__ModuleLoader__.load({
86
87
  const suffix = detail === void 0 ? "" : `: ${detail}`;
87
88
  return `${who} \u2014 turn ${notification.turn} ${transitionLabel(notification.transition)}${suffix}`;
88
89
  }
90
+ var REPORT_KIND_LABELS = {
91
+ progress: "progress",
92
+ blocked: "blocked",
93
+ decision: "decision needed",
94
+ fyi: "fyi"
95
+ };
96
+ function isDevLeadReportKind(value) {
97
+ return typeof value === "string" && DEVLEAD_REPORT_KINDS.includes(value);
98
+ }
99
+ function reportLine(report) {
100
+ const title = presentLine(report.senderSessionTitle);
101
+ const who = title === void 0 ? report.senderSessionId : `${title} (${report.senderSessionId})`;
102
+ const detail = presentLine(report.summary) ?? excerptLine(report.message, DEVLEAD_ERROR_EXCERPT_MAX);
103
+ const suffix = detail === void 0 ? "" : `: ${detail}`;
104
+ return `${who} \u2014 report ${REPORT_KIND_LABELS[report.kind]}${suffix}`;
105
+ }
89
106
 
90
107
  // packages/client-ui/src/client/format.ts
91
108
  var TRANSITION_LABEL_KEYS = {
@@ -133,6 +150,132 @@ window.__ModuleLoader__.load({
133
150
  }
134
151
  return { watched: seen.size, running, missing };
135
152
  }
153
+ var REPORT_LABEL_KEYS = {
154
+ progress: "report.kind.progress",
155
+ blocked: "report.kind.blocked",
156
+ decision: "report.kind.decision",
157
+ fyi: "report.kind.fyi"
158
+ };
159
+ function reportLabelKey(kind) {
160
+ return isDevLeadReportKind(kind) ? REPORT_LABEL_KEYS[kind] : "report.kind.unknown";
161
+ }
162
+ function reportSummary(report) {
163
+ const title = typeof report.senderSessionTitle === "string" ? excerptLine(report.senderSessionTitle, DEVLEAD_ERROR_EXCERPT_MAX) : void 0;
164
+ const who = title ?? report.senderSessionId;
165
+ const detail = typeof report.summary === "string" ? excerptLine(report.summary, DEVLEAD_ERROR_EXCERPT_MAX) : typeof report.message === "string" ? excerptLine(report.message, DEVLEAD_ERROR_EXCERPT_MAX) : void 0;
166
+ return {
167
+ tooltip: isDevLeadReportKind(report.kind) ? reportLine(report) : `${who} \u2014 report ${String(report.kind)}`,
168
+ who,
169
+ kind: String(report.kind),
170
+ labelKey: reportLabelKey(report.kind),
171
+ detail,
172
+ at: typeof report.at === "number" ? report.at : 0
173
+ };
174
+ }
175
+ function latestReport(reports) {
176
+ return reports.at(-1) ?? null;
177
+ }
178
+
179
+ // packages/client-ui/src/client/DevLeadBar.tsx
180
+ var import_jsx_runtime = require("react/jsx-runtime");
181
+ function DevLeadBar({
182
+ useProjection,
183
+ useSessions,
184
+ useSessionStatus,
185
+ t
186
+ }) {
187
+ const projection = useProjection(DEVLEAD_PROJECTION_KEY);
188
+ const rows = useSessions((state) => state.byId);
189
+ const statuses = useSessionStatus((current) => current);
190
+ const enabled = projection?.enabled ?? false;
191
+ if (projection === void 0 || !enabled) return null;
192
+ const summary = summarizeWatched(projection.sessions, rows, statuses);
193
+ const latest = latestNotification(projection.notifications);
194
+ const latestRep = latestReport(projection.reports ?? []);
195
+ const showReport = latestRep !== null && (latest === null || latestRep.at >= latest.at);
196
+ const notice = !showReport && latest !== null ? notificationSummary(latest) : null;
197
+ const reportNotice = showReport && latestRep !== null ? reportSummary(latestRep) : null;
198
+ const tooltip = reportNotice?.tooltip ?? notice?.tooltip ?? t("hint.enabled");
199
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
200
+ "div",
201
+ {
202
+ className: "devlead-dock",
203
+ "data-devlead-bar": "true",
204
+ "data-devlead-enabled": "true",
205
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
206
+ "div",
207
+ {
208
+ className: "devlead-bar",
209
+ role: "group",
210
+ "aria-label": t("bar.aria"),
211
+ children: [
212
+ /* @__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 }) }),
213
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-label", children: t("label") }),
214
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "devlead-meta", children: [
215
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-watched", children: t("count.watched", { count: summary.watched }) }),
216
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "devlead-running", children: [
217
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
218
+ "span",
219
+ {
220
+ className: "devlead-dot",
221
+ "data-active": summary.running > 0 ? "true" : "false",
222
+ "aria-hidden": "true"
223
+ }
224
+ ),
225
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: t("count.running", { count: summary.running }) })
226
+ ] }),
227
+ 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 }) })
228
+ ] }),
229
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
230
+ "span",
231
+ {
232
+ className: "devlead-notice",
233
+ role: "status",
234
+ "aria-live": "polite",
235
+ "aria-atomic": "true",
236
+ title: tooltip,
237
+ children: reportNotice !== null ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "devlead-notification", "data-report": "true", children: [
238
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
239
+ "span",
240
+ {
241
+ className: "devlead-notification-dot",
242
+ "data-report-kind": reportNotice.kind,
243
+ "aria-hidden": "true"
244
+ }
245
+ ),
246
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-who", children: reportNotice.who }),
247
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-label", children: t(reportNotice.labelKey) }),
248
+ reportNotice.detail !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-error", children: reportNotice.detail })
249
+ ] }) : notice === null ? (
250
+ // An enabled Session with no retained notification keeps the help
251
+ // hint visible instead of leaving the row visually empty.
252
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-hint", children: t("hint.enabled") })
253
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "devlead-notification", children: [
254
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
255
+ "span",
256
+ {
257
+ className: "devlead-notification-dot",
258
+ "data-transition": notice.transition,
259
+ "aria-hidden": "true"
260
+ }
261
+ ),
262
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-who", children: notice.who }),
263
+ notice.turn > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-turn", children: t("notification.turn", { turn: notice.turn }) }),
264
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-label", children: t(notice.labelKey) }),
265
+ notice.error !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-error", children: notice.error })
266
+ ] })
267
+ }
268
+ )
269
+ ]
270
+ }
271
+ )
272
+ }
273
+ );
274
+ }
275
+
276
+ // packages/client-ui/src/client/DevLeadIconToggle.tsx
277
+ var import_react2 = require("react");
278
+ var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
136
279
 
137
280
  // packages/client-ui/src/client/results.ts
138
281
  function presentMessage(value) {
@@ -172,21 +315,28 @@ window.__ModuleLoader__.load({
172
315
  rejected: "error.fallback.rejected",
173
316
  unexpected: "error.fallback.unknown"
174
317
  };
318
+ var ALREADY_ACTIVE_PREFIX = "Another Session is already in DevLead mode: ";
319
+ var ALREADY_ACTIVE_INSTRUCTION = ". Run /devlead off there first";
320
+ var ALREADY_ACTIVE_ARCHIVED_INSTRUCTION = ". That Session is archived and could not be released automatically;";
321
+ function alreadyActiveDetails(message) {
322
+ if (!message.startsWith(ALREADY_ACTIVE_PREFIX)) return void 0;
323
+ const rest = message.slice(ALREADY_ACTIVE_PREFIX.length);
324
+ const archived = rest.includes(ALREADY_ACTIVE_ARCHIVED_INSTRUCTION);
325
+ const marker = archived ? ALREADY_ACTIVE_ARCHIVED_INSTRUCTION : ALREADY_ACTIVE_INSTRUCTION;
326
+ const end = rest.indexOf(marker);
327
+ if (end <= 0) return void 0;
328
+ const session = rest.slice(0, end).trim();
329
+ return session.length === 0 ? void 0 : { session, archived };
330
+ }
175
331
  function failureMessage(failure, t) {
176
332
  if (failure.kind === "unresolved") return t("error.fallback.unresolved");
177
- return failure.message ?? t(FAILURE_FALLBACK_KEYS[failure.kind]);
178
- }
179
- function failureCopy(failure) {
180
- switch (failure.kind) {
181
- case "transport":
182
- return failure.message === void 0 ? { key: "error.fallback.transport", params: {} } : { key: "error.command", params: { message: failure.message, code: failure.code } };
183
- case "rejected":
184
- return failure.message === void 0 ? { key: "error.fallback.rejected", params: {} } : { key: "error.rejected", params: { message: failure.message } };
185
- case "unexpected":
186
- return failure.message === void 0 ? { key: "error.fallback.unknown", params: {} } : { key: "error.unknown", params: { message: failure.message } };
187
- case "unresolved":
188
- return { key: "error.unresolved", params: { line: failure.line } };
333
+ if (failure.kind === "rejected" && failure.message !== void 0) {
334
+ const active = alreadyActiveDetails(failure.message);
335
+ if (active !== void 0) {
336
+ return t(active.archived ? "error.alreadyActive.archived" : "error.alreadyActive", { session: active.session });
337
+ }
189
338
  }
339
+ return failure.message ?? t(FAILURE_FALLBACK_KEYS[failure.kind]);
190
340
  }
191
341
  function createDevLeadAdmissionGate() {
192
342
  let entered = false;
@@ -240,139 +390,63 @@ window.__ModuleLoader__.load({
240
390
  return { pending: state.pending, failure: state.failure, run };
241
391
  }
242
392
 
243
- // packages/client-ui/src/client/DevLeadBar.tsx
244
- var import_jsx_runtime = require("react/jsx-runtime");
245
- function DevLeadBar({
246
- useProjection,
247
- useSessions,
248
- useSessionStatus,
249
- executeCommand,
250
- t
251
- }) {
252
- const projection = useProjection(DEVLEAD_PROJECTION_KEY);
253
- const rows = useSessions((state) => state.byId);
254
- const statuses = useSessionStatus((current) => current);
255
- const enabled = projection?.enabled ?? false;
256
- const { pending, failure, run } = useDevLeadAdmission(executeCommand, enabled);
257
- if (projection === void 0 || !enabled) return null;
258
- const summary = summarizeWatched(projection.sessions, rows, statuses);
259
- const latest = latestNotification(projection.notifications);
260
- const notice = latest === null ? null : notificationSummary(latest);
261
- const failureLine = failure === null ? null : failureCopy(failure);
262
- const switchTitle = pending ? t("switch.pending") : t("switch.disable");
263
- const toggle = (next) => {
264
- if (next) return;
265
- run(`/${DEVLEAD_COMMAND_NAME} off`);
266
- };
267
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
268
- "div",
269
- {
270
- className: "devlead-dock",
271
- "data-devlead-bar": "true",
272
- "data-devlead-enabled": "true",
273
- "data-devlead-pending": pending ? "true" : "false",
274
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
275
- "div",
276
- {
277
- className: "devlead-bar",
278
- role: "group",
279
- "aria-label": t("bar.aria"),
280
- "aria-busy": pending,
281
- title: t("hint.enabled"),
282
- children: [
283
- /* @__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 }) }),
284
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-label", children: t("label") }),
285
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
286
- import_dsh_client_ui_primitives.Switch,
287
- {
288
- className: "devlead-switch",
289
- checked: true,
290
- disabled: pending,
291
- label: t("switch.aria"),
292
- title: switchTitle,
293
- onChange: toggle
294
- }
295
- ),
296
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "devlead-meta", children: [
297
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-watched", children: t("count.watched", { count: summary.watched }) }),
298
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "devlead-running", children: [
299
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
300
- "span",
301
- {
302
- className: "devlead-dot",
303
- "data-active": summary.running > 0 ? "true" : "false",
304
- "aria-hidden": "true"
305
- }
306
- ),
307
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: t("count.running", { count: summary.running }) })
308
- ] }),
309
- 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 }) })
310
- ] }),
311
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
312
- "span",
313
- {
314
- className: "devlead-notice",
315
- role: "status",
316
- "aria-live": "polite",
317
- "aria-atomic": "true",
318
- title: notice === null ? t("hint.enabled") : notice.tooltip,
319
- children: notice === null ? (
320
- // An enabled Session with no retained notification keeps the help
321
- // hint visible instead of leaving the row visually empty.
322
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-hint", children: t("hint.enabled") })
323
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "devlead-notification", children: [
324
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
325
- "span",
326
- {
327
- className: "devlead-notification-dot",
328
- "data-transition": notice.transition,
329
- "aria-hidden": "true"
330
- }
331
- ),
332
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-who", children: notice.who }),
333
- notice.turn > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-turn", children: t("notification.turn", { turn: notice.turn }) }),
334
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-label", children: t(notice.labelKey) }),
335
- notice.error !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-notification-error", children: notice.error })
336
- ] })
337
- }
338
- ),
339
- failureLine !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-error", role: "alert", children: t(failureLine.key, failureLine.params) })
340
- ]
341
- }
342
- )
343
- }
344
- );
345
- }
346
-
347
393
  // packages/client-ui/src/client/DevLeadIconToggle.tsx
348
- var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
349
394
  var import_jsx_runtime2 = require("react/jsx-runtime");
350
395
  function DevLeadIconToggle({ useProjection, executeCommand, t }) {
351
396
  const projection = useProjection(DEVLEAD_PROJECTION_KEY);
352
397
  const enabled = projection?.enabled ?? false;
353
398
  const { pending, failure, run } = useDevLeadAdmission(executeCommand, enabled);
354
- if (projection === void 0 || enabled) return null;
355
- const label = failure === null ? t("toggle.enable") : t("toggle.failed", { message: failureMessage(failure, t) });
399
+ const [attempt, setAttempt] = (0, import_react2.useState)("on");
400
+ if (projection === void 0) return null;
401
+ const direction = enabled ? "off" : "on";
402
+ const failureText = failure === null ? null : failureMessage(failure, t);
403
+ const actionLabel = enabled ? t("toggle.disable") : t("toggle.enable");
404
+ const failureLabel = failureText === null ? null : t(
405
+ attempt === "off" ? "toggle.failed.disable" : "toggle.failed",
406
+ { message: failureText }
407
+ );
408
+ const label = failureLabel ?? (pending ? t("toggle.pending") : actionLabel);
409
+ const status = failureText === null ? null : t(
410
+ attempt === "off" ? "toggle.failed.status.disable" : "toggle.failed.status",
411
+ { message: failureText }
412
+ );
356
413
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
357
- /* @__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)(
358
- import_dsh_client_ui_primitives2.Button,
414
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
415
+ import_dsh_client_ui_primitives2.Tooltip,
359
416
  {
360
- variant: "ghost",
361
- size: "sm",
362
- className: "devlead-toggle",
363
- "aria-label": label,
364
- "aria-busy": pending,
365
- disabled: pending,
366
- "data-devlead-toggle": "true",
367
- "data-devlead-pending": pending ? "true" : "false",
368
- "data-devlead-failed": failure === null ? "false" : "true",
369
- onClick: () => {
370
- run(`/${DEVLEAD_COMMAND_NAME} on`);
371
- },
372
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.IconUsersOutlineRegular, { size: 16 })
417
+ label,
418
+ side: "top",
419
+ delayMs: 300,
420
+ maxWidth: 300,
421
+ portal: true,
422
+ openOnClick: failure !== null,
423
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
424
+ import_dsh_client_ui_primitives2.Button,
425
+ {
426
+ variant: "ghost",
427
+ size: "sm",
428
+ className: "devlead-toggle",
429
+ "aria-label": label,
430
+ "aria-busy": pending,
431
+ "aria-pressed": enabled,
432
+ disabled: pending,
433
+ "data-devlead-toggle": "true",
434
+ "data-devlead-enabled": enabled ? "true" : "false",
435
+ "data-devlead-pending": pending ? "true" : "false",
436
+ "data-devlead-failed": failure === null ? "false" : "true",
437
+ onClick: () => {
438
+ setAttempt(direction);
439
+ run(`/${DEVLEAD_COMMAND_NAME} ${direction}`);
440
+ },
441
+ children: [
442
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.IconUsersOutlineRegular, { size: 16 }),
443
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "devlead-toggle-label", children: t("toggle.label") })
444
+ ]
445
+ }
446
+ )
373
447
  }
374
- ) }),
375
- /* @__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, t) }) })
448
+ ),
449
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "devlead-sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: status })
376
450
  ] });
377
451
  }
378
452
 
@@ -416,22 +490,29 @@ window.__ModuleLoader__.load({
416
490
  // packages/client-ui/src/client/locales.ts
417
491
  var zh = {
418
492
  "meta.title": "DevLead \u754C\u9762",
419
- "meta.description": "DevLead \u6A21\u5F0F\u7684 Web \u754C\u9762\uFF1A\u8F93\u5165\u6846\u5DE5\u5177\u6761\u5F00\u5173\u3001\u6A21\u5F0F\u5F00\u542F\u540E\u663E\u793A\u7684\u72B6\u6001\u6761\uFF0C\u4EE5\u53CA\u4FA7\u8FB9\u680F\u4E2D\u5DF2\u5F00\u542F\u4F1A\u8BDD\u7684 DevLead \u6807\u8BB0\u3002",
493
+ "meta.description": "DevLead \u6A21\u5F0F\u7684 Web \u754C\u9762\uFF1A\u8F93\u5165\u6846\u5DE5\u5177\u6761\u7684 DevLead \u5F00\u5173\uFF08\u4E24\u6001\u5747\u53EF\u5207\u6362\uFF09\u3001\u6A21\u5F0F\u5F00\u542F\u540E\u663E\u793A\u7684\u72B6\u6001\u6761\uFF0C\u4EE5\u53CA\u4FA7\u8FB9\u680F\u4E2D\u5DF2\u5F00\u542F\u4F1A\u8BDD\u7684 DevLead \u6807\u8BB0\u3002",
420
494
  "bar.aria": "DevLead \u72B6\u6001\u680F",
421
495
  "label": "DevLead",
422
- "switch.aria": "DevLead \u6A21\u5F0F",
423
- "switch.disable": "\u5173\u95ED DevLead \u6A21\u5F0F",
424
- "switch.pending": "\u6B63\u5728\u6267\u884C DevLead \u547D\u4EE4\u2026",
425
- "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",
496
+ "hint.enabled": "DevLead \u5DF2\u5F00\u542F\uFF1A\u88AB\u76D1\u7763\u4F1A\u8BDD\u7684\u8F6E\u6B21\u7ED3\u675F\u4F1A\u901A\u77E5\u5E76\u5524\u9192\u672C\u4F1A\u8BDD\u3002",
426
497
  "count.watched": "\u76D1\u7763 {count} \u4E2A\u4F1A\u8BDD",
427
498
  "count.running": "\u8FD0\u884C\u4E2D {count}",
428
499
  "count.missing": "{count} \u4E2A\u5DF2\u4E0D\u53EF\u7528",
429
500
  "row.mark.aria": "DevLead \u6A21\u5F0F\u5DF2\u542F\u7528",
430
501
  "row.hover.enabled": "DevLead \u6A21\u5F0F\u5DF2\u542F\u7528\uFF1A\u672C\u4F1A\u8BDD\u53EF\u8C03\u5EA6\u5E76\u76D1\u7763\u5176\u4ED6\u4F1A\u8BDD\u3002",
502
+ "toggle.label": "DevLead",
431
503
  "toggle.enable": "\u5F00\u542F DevLead \u6A21\u5F0F",
432
- "toggle.failed": "\u5F00\u542F DevLead \u6A21\u5F0F\u5931\u8D25\uFF1A{message}\uFF08\u60AC\u505C\u67E5\u770B\uFF0C\u53EF\u91CD\u8BD5\uFF09",
504
+ "toggle.disable": "\u5173\u95ED DevLead \u6A21\u5F0F",
505
+ "toggle.pending": "\u6B63\u5728\u6267\u884C DevLead \u547D\u4EE4\u2026",
506
+ "toggle.failed": "\u5F00\u542F DevLead \u6A21\u5F0F\u5931\u8D25\uFF1A{message}",
507
+ "toggle.failed.disable": "\u5173\u95ED DevLead \u6A21\u5F0F\u5931\u8D25\uFF1A{message}",
433
508
  "toggle.failed.status": "\u5F00\u542F DevLead \u6A21\u5F0F\u5931\u8D25\uFF1A{message}",
509
+ "toggle.failed.status.disable": "\u5173\u95ED DevLead \u6A21\u5F0F\u5931\u8D25\uFF1A{message}",
434
510
  "notification.turn": "\u7B2C {turn} \u8F6E",
511
+ "report.kind.progress": "\u8FDB\u5EA6",
512
+ "report.kind.blocked": "\u963B\u585E",
513
+ "report.kind.decision": "\u5F85\u51B3\u7B56",
514
+ "report.kind.fyi": "\u544A\u77E5",
515
+ "report.kind.unknown": "\u62A5\u544A",
435
516
  "transition.completed": "\u5B8C\u6210",
436
517
  "transition.error": "\u5931\u8D25",
437
518
  "transition.blocked": "\u963B\u585E",
@@ -440,10 +521,8 @@ window.__ModuleLoader__.load({
440
521
  "transition.interrupted": "\u5DF2\u4E2D\u65AD",
441
522
  "transition.forked": "\u5DF2\u5206\u53C9",
442
523
  "transition.unknown": "\u672A\u77E5\u72B6\u6001",
443
- "error.command": "\u547D\u4EE4\u5931\u8D25\uFF1A{message}\uFF08{code}\uFF09",
444
- "error.rejected": "\u547D\u4EE4\u88AB\u62D2\u7EDD\uFF1A{message}",
445
- "error.unknown": "\u547D\u4EE4\u6267\u884C\u5931\u8D25\uFF1A{message}",
446
- "error.unresolved": "\u547D\u4EE4\u672A\u6267\u884C\uFF1AHost \u672A\u8BC6\u522B {line}",
524
+ "error.alreadyActive": "\u53E6\u4E00\u4E2A\u4F1A\u8BDD\u5DF2\u5904\u4E8E DevLead \u6A21\u5F0F\uFF1A{session}\u3002\u8BF7\u5148\u5728\u90A3\u91CC\u6267\u884C /devlead off\uFF0C\u518D\u5F00\u542F\u672C\u4F1A\u8BDD\u3002",
525
+ "error.alreadyActive.archived": "\u53E6\u4E00\u4E2A\u4F1A\u8BDD\u5DF2\u5904\u4E8E DevLead \u6A21\u5F0F\uFF1A{session}\u3002\u8BE5\u4F1A\u8BDD\u5DF2\u5F52\u6863\u4E14\u65E0\u6CD5\u81EA\u52A8\u91CA\u653E\uFF1B\u8BF7\u6253\u5F00\u5B83\uFF0C\u6267\u884C /devlead off \u540E\u91CD\u8BD5\u3002",
447
526
  "error.fallback.transport": "\u547D\u4EE4\u5931\u8D25",
448
527
  "error.fallback.rejected": "\u547D\u4EE4\u88AB\u62D2\u7EDD",
449
528
  "error.fallback.unknown": "\u672A\u77E5\u9519\u8BEF",
@@ -451,22 +530,29 @@ window.__ModuleLoader__.load({
451
530
  };
452
531
  var en = {
453
532
  "meta.title": "DevLead UI",
454
- "meta.description": "Web UI for DevLead mode: the composer toolbar switch, the status strip shown while the mode is on, and the DevLead mark on enabled Sessions in the sidebar.",
533
+ "meta.description": "Web UI for DevLead mode: the composer-toolbar toggle that switches the mode on or off, the status strip shown while the mode is on, and the DevLead mark on enabled Sessions in the sidebar.",
455
534
  "bar.aria": "DevLead status bar",
456
535
  "label": "DevLead",
457
- "switch.aria": "DevLead mode",
458
- "switch.disable": "Turn off DevLead mode",
459
- "switch.pending": "Running the DevLead command\u2026",
460
536
  "hint.enabled": "DevLead is on: watched-session turn changes notify and wake this session.",
461
537
  "count.watched": "{count} watched",
462
538
  "count.running": "{count} running",
463
539
  "count.missing": "{count} unavailable",
464
540
  "row.mark.aria": "DevLead mode is on",
465
541
  "row.hover.enabled": "DevLead mode is on: this session can dispatch and watch other Sessions.",
542
+ "toggle.label": "DevLead",
466
543
  "toggle.enable": "Turn on DevLead mode",
467
- "toggle.failed": "Could not turn on DevLead mode: {message} (hover to read, then retry)",
544
+ "toggle.disable": "Turn off DevLead mode",
545
+ "toggle.pending": "Running the DevLead command\u2026",
546
+ "toggle.failed": "Could not turn on DevLead mode: {message}",
547
+ "toggle.failed.disable": "Could not turn off DevLead mode: {message}",
468
548
  "toggle.failed.status": "Could not turn on DevLead mode: {message}",
549
+ "toggle.failed.status.disable": "Could not turn off DevLead mode: {message}",
469
550
  "notification.turn": "turn {turn}",
551
+ "report.kind.progress": "progress",
552
+ "report.kind.blocked": "blocked",
553
+ "report.kind.decision": "decision",
554
+ "report.kind.fyi": "fyi",
555
+ "report.kind.unknown": "report",
470
556
  "transition.completed": "completed",
471
557
  "transition.error": "failed",
472
558
  "transition.blocked": "blocked",
@@ -475,10 +561,8 @@ window.__ModuleLoader__.load({
475
561
  "transition.interrupted": "interrupted",
476
562
  "transition.forked": "forked",
477
563
  "transition.unknown": "unknown state",
478
- "error.command": "Command failed: {message} ({code})",
479
- "error.rejected": "Command rejected: {message}",
480
- "error.unknown": "Command failed: {message}",
481
- "error.unresolved": "Command did not run: the Host did not recognize {line}",
564
+ "error.alreadyActive": "Another Session is already in DevLead mode: {session}. Run /devlead off there first, then enable this Session.",
565
+ "error.alreadyActive.archived": "Another Session is already in DevLead mode: {session}. That Session is archived and could not be released automatically; open it, run /devlead off, then retry.",
482
566
  "error.fallback.transport": "command failed",
483
567
  "error.fallback.rejected": "command rejected",
484
568
  "error.fallback.unknown": "unknown error",
@@ -489,25 +573,82 @@ window.__ModuleLoader__.load({
489
573
  var STYLE_ATTRIBUTE = "data-plugin-css";
490
574
  var STYLE_KEY = "devlead";
491
575
  var styles = `
492
- /* Composer-tool row control: the 28px round glyph seat of the shipped attach
493
- and mode controls, so the off-state entry reads as one of them. */
576
+ /* Composer-tool row control: the users glyph plus a visible DevLead label. It
577
+ keeps the 28px control height of the toolbar and sizes horizontally from its
578
+ content, rather than occupying a fixed square glyph seat. The transparent
579
+ 1px border is part of the base box (with 1px less padding), so enabling the
580
+ accent border changes colour only, never the control's size or the toolbar
581
+ layout. */
494
582
  .devlead-toggle {
495
583
  flex: none;
496
- width: 28px;
584
+ width: auto;
497
585
  height: 28px;
498
- padding: 0;
586
+ padding: 0 9px;
587
+ border: 1px solid transparent;
499
588
  border-radius: 999px;
500
- color: var(--dsw-alias-label-tertiary, GrayText);
589
+ gap: 6px;
590
+ color: var(--dsw-alias-label-secondary, GrayText);
591
+ }
592
+
593
+ .devlead-toggle-label {
594
+ flex: none;
595
+ font-weight: 500;
596
+ white-space: nowrap;
501
597
  }
502
598
 
503
599
  @media (hover: hover) {
504
- .devlead-toggle:hover:not(:disabled) {
505
- color: var(--dsw-alias-label-secondary, GrayText);
600
+ .devlead-toggle:hover:not(:disabled):not([data-devlead-failed="true"]) {
601
+ color: var(--dsw-alias-label-primary, CanvasText);
506
602
  }
507
603
  }
508
604
 
605
+ /* While the mode is on the same button stays in place and reads at full label
606
+ color, with the business accent as a real border plus a very light halo.
607
+ The halo is a box-shadow so it cannot add layout width; the border was
608
+ already reserved (transparent) in the base rule. The failed rule below has
609
+ the same specificity and wins the colour, so an error never leaves a blue
610
+ accent behind. */
611
+ .devlead-toggle[data-devlead-enabled="true"] {
612
+ color: var(--dsw-alias-label-primary, CanvasText);
613
+ border-color: var(--dsw-alias-state-business-primary, #4176e6);
614
+ box-shadow: 0 0 0 2px var(--dsw-alias-state-business-tertiary, rgba(65, 118, 230, 0.12));
615
+ }
616
+
509
617
  .devlead-toggle[data-devlead-failed="true"] {
510
- color: var(--dsw-alias-state-error-primary, #c0392b);
618
+ color: var(--dsw-alias-label-error, #c0392b);
619
+ border-color: var(--dsw-alias-label-error, #c0392b);
620
+ box-shadow: none;
621
+ }
622
+
623
+ /* The shell marks an active toolbar control with a subtle fill; the mode is a
624
+ pressed toggle, not only a colour change, so mirror that affordance. */
625
+ .devlead-toggle[aria-pressed="true"] {
626
+ background: var(--dsw-alias-interactive-bg-hover, rgba(127, 127, 127, 0.12));
627
+ }
628
+
629
+ /* On a narrow viewport the visible label and the stale-watch warning would
630
+ squeeze the composer toolbar and the status notice. The toggle keeps its
631
+ accessible name and icon; the bar keeps the watched/running counts. */
632
+ @media (max-width: 480px) {
633
+ .devlead-toggle {
634
+ padding: 0 7px;
635
+ gap: 0;
636
+ }
637
+
638
+ .devlead-toggle-label,
639
+ .devlead-label,
640
+ .devlead-missing {
641
+ display: none;
642
+ }
643
+
644
+ .devlead-bar {
645
+ gap: 6px;
646
+ padding: 4px 10px;
647
+ }
648
+
649
+ .devlead-meta {
650
+ gap: 6px;
651
+ }
511
652
  }
512
653
 
513
654
  .devlead-dock {
@@ -537,12 +678,14 @@ window.__ModuleLoader__.load({
537
678
  align-items: center;
538
679
  gap: 8px;
539
680
  width: 100%;
681
+ min-width: 0;
540
682
  min-height: 34px;
541
683
  margin: 0 auto;
542
- padding: 4px 6px 4px 12px;
684
+ padding: 4px 12px;
685
+ overflow: hidden;
543
686
  border: 0;
544
687
  --dsw-elevation-stroke-color: var(--dsw-alias-border-l1, rgba(127, 127, 127, 0.24));
545
- border-radius: var(--dsw-radius-md, 10px);
688
+ border-radius: var(--dsw-radius-lg, 12px);
546
689
  box-shadow: var(--dsw-elevation-panel, 0 1px 2px rgba(0, 0, 0, 0.08));
547
690
  color: var(--dsw-alias-label-primary, CanvasText);
548
691
  font-size: 13px;
@@ -575,10 +718,6 @@ window.__ModuleLoader__.load({
575
718
  white-space: nowrap;
576
719
  }
577
720
 
578
- .devlead-switch {
579
- flex: none;
580
- }
581
-
582
721
  .devlead-meta {
583
722
  display: inline-flex;
584
723
  flex: none;
@@ -612,7 +751,7 @@ window.__ModuleLoader__.load({
612
751
  }
613
752
 
614
753
  .devlead-missing {
615
- color: var(--dsw-alias-state-warn-primary, #a15c00);
754
+ color: var(--dsw-alias-label-secondary, GrayText);
616
755
  }
617
756
 
618
757
  /* One stable live region wrapping the hint or the latest-notification chip so
@@ -669,6 +808,18 @@ window.__ModuleLoader__.load({
669
808
  background: var(--dsw-alias-state-warn-primary, #a15c00);
670
809
  }
671
810
 
811
+ .devlead-notification-dot[data-report-kind="progress"] {
812
+ background: var(--dsw-alias-state-success-primary, #2e7d32);
813
+ }
814
+
815
+ .devlead-notification-dot[data-report-kind="blocked"] {
816
+ background: var(--dsw-alias-state-error-primary, #c0392b);
817
+ }
818
+
819
+ .devlead-notification-dot[data-report-kind="decision"] {
820
+ background: var(--dsw-alias-state-warn-primary, #a15c00);
821
+ }
822
+
672
823
  .devlead-notification-who {
673
824
  flex: 0 1 auto;
674
825
  min-width: 0;
@@ -686,19 +837,9 @@ window.__ModuleLoader__.load({
686
837
  flex: 0 1 auto;
687
838
  min-width: 0;
688
839
  overflow: hidden;
689
- color: var(--dsw-alias-state-error-primary, #c0392b);
690
- font-size: 12px;
691
- text-overflow: ellipsis;
692
- }
693
-
694
- .devlead-error {
695
- flex: 0 1 auto;
696
- min-width: 0;
697
- overflow: hidden;
698
- color: var(--dsw-alias-state-error-primary, #c0392b);
840
+ color: var(--dsw-alias-label-error, #c0392b);
699
841
  font-size: 12px;
700
842
  text-overflow: ellipsis;
701
- white-space: nowrap;
702
843
  }
703
844
 
704
845
  /* Visually hidden but announced: the compact toolbar surface has no inline
@@ -793,7 +934,7 @@ window.__ModuleLoader__.load({
793
934
  name: "conversation.input.left",
794
935
  id: "devlead",
795
936
  // No shipped entry occupies this list; the order only sequences additive
796
- // contributions, so the compact switch stays ahead of any later entry.
937
+ // contributions, so the compact toggle stays ahead of any later entry.
797
938
  order: 12,
798
939
  locale: NS,
799
940
  inject: face
@@ -802,10 +943,10 @@ window.__ModuleLoader__.load({
802
943
  name: "conversation.input.dock",
803
944
  id: "devlead",
804
945
  // The shipped context stack orders Todo (0), Goal (10), and Queue (20):
805
- // the DevLead strip sits directly below the goal card.
946
+ // the status strip sits directly below the goal card. It has no injected
947
+ // command face: only the composer-toolbar toggle submits commands.
806
948
  order: 12,
807
- locale: NS,
808
- inject: face
949
+ locale: NS
809
950
  }, DevLeadBar));
810
951
  ctx.slots.inject("sidebar.session.row.trailing", () => ctx.slots.register({
811
952
  name: "sidebar.session.row.trailing",
package/locale/en.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "DevLead UI",
4
- "description": "Web UI for DevLead mode: the composer toolbar switch, the status strip shown while the mode is on, and the DevLead mark on enabled Sessions in the sidebar."
4
+ "description": "Web UI for DevLead mode: the composer-toolbar toggle that switches the mode on or off, the status strip shown while the mode is on, and the DevLead mark on enabled Sessions in the sidebar."
5
5
  }
6
6
  }
package/locale/zh.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "DevLead 界面",
4
- "description": "DevLead 模式的 Web 界面:输入框工具条开关、模式开启后显示的状态条,以及侧边栏中已开启会话的 DevLead 标记。"
4
+ "description": "DevLead 模式的 Web 界面:输入框工具条的 DevLead 开关(两态均可切换)、模式开启后显示的状态条,以及侧边栏中已开启会话的 DevLead 标记。"
5
5
  }
6
6
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yankeguo/dsh-client-ui-devlead",
3
- "version": "0.2.3",
4
- "description": "DevLead surfaces: a compact composer-toolbar switch while off, the full status strip above the composer while the mode is on, and a DevLead mark on the Session's sidebar row.",
3
+ "version": "0.2.5",
4
+ "description": "DevLead surfaces: the composer-toolbar toggle that switches the mode on or off, the status strip above the composer while the mode is on, and a DevLead mark on the Session's sidebar row.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",
@@ -35,7 +35,7 @@
35
35
  "@deepseek-ai/cordis": "~4.1.0"
36
36
  },
37
37
  "dependencies": {
38
- "@yankeguo/dsh-devlead-protocol": "0.2.3"
38
+ "@yankeguo/dsh-devlead-protocol": "0.2.5"
39
39
  },
40
40
  "engines": {
41
41
  "dsh": ">=0.2.2-rc.1 <0.3.0"