@yankeguo/dsh-client-ui-devlead 0.2.4 → 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 +5 -3
- package/lib/client.js +122 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,10 +5,12 @@ Browser half of the DevLead suite, loaded on the DSH **Web** platform.
|
|
|
5
5
|
- **Mode switch (both states):** a compact ghost button in the composer toolbar
|
|
6
6
|
(`conversation.input.left`) shows the users icon plus a visible `DevLead` label and sends
|
|
7
7
|
`/devlead on` while the mode is off and `/devlead off` while it is on. The same button stays
|
|
8
|
-
mounted in both states
|
|
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.
|
|
9
10
|
- **On state:** a status strip above the composer (`conversation.input.dock`) shows the brand,
|
|
10
|
-
watched/running counts, and the
|
|
11
|
-
display-only and
|
|
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.
|
|
12
14
|
- **Sidebar marks:** enabled Sessions get a shield mark (`sidebar.session.row.trailing`) and a
|
|
13
15
|
line in the row hover card (`sidebar.session.row.hover`), read from the summary-sized
|
|
14
16
|
`devLeadMode` projection.
|
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,31 @@ 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
|
+
}
|
|
136
178
|
|
|
137
179
|
// packages/client-ui/src/client/DevLeadBar.tsx
|
|
138
180
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -149,7 +191,11 @@ window.__ModuleLoader__.load({
|
|
|
149
191
|
if (projection === void 0 || !enabled) return null;
|
|
150
192
|
const summary = summarizeWatched(projection.sessions, rows, statuses);
|
|
151
193
|
const latest = latestNotification(projection.notifications);
|
|
152
|
-
const
|
|
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");
|
|
153
199
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
154
200
|
"div",
|
|
155
201
|
{
|
|
@@ -187,8 +233,20 @@ window.__ModuleLoader__.load({
|
|
|
187
233
|
role: "status",
|
|
188
234
|
"aria-live": "polite",
|
|
189
235
|
"aria-atomic": "true",
|
|
190
|
-
title:
|
|
191
|
-
children:
|
|
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 ? (
|
|
192
250
|
// An enabled Session with no retained notification keeps the help
|
|
193
251
|
// hint visible instead of leaving the row visually empty.
|
|
194
252
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "devlead-hint", children: t("hint.enabled") })
|
|
@@ -257,8 +315,27 @@ window.__ModuleLoader__.load({
|
|
|
257
315
|
rejected: "error.fallback.rejected",
|
|
258
316
|
unexpected: "error.fallback.unknown"
|
|
259
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
|
+
}
|
|
260
331
|
function failureMessage(failure, t) {
|
|
261
332
|
if (failure.kind === "unresolved") return t("error.fallback.unresolved");
|
|
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
|
+
}
|
|
338
|
+
}
|
|
262
339
|
return failure.message ?? t(FAILURE_FALLBACK_KEYS[failure.kind]);
|
|
263
340
|
}
|
|
264
341
|
function createDevLeadAdmissionGate() {
|
|
@@ -431,6 +508,11 @@ window.__ModuleLoader__.load({
|
|
|
431
508
|
"toggle.failed.status": "\u5F00\u542F DevLead \u6A21\u5F0F\u5931\u8D25\uFF1A{message}",
|
|
432
509
|
"toggle.failed.status.disable": "\u5173\u95ED DevLead \u6A21\u5F0F\u5931\u8D25\uFF1A{message}",
|
|
433
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",
|
|
434
516
|
"transition.completed": "\u5B8C\u6210",
|
|
435
517
|
"transition.error": "\u5931\u8D25",
|
|
436
518
|
"transition.blocked": "\u963B\u585E",
|
|
@@ -439,6 +521,8 @@ window.__ModuleLoader__.load({
|
|
|
439
521
|
"transition.interrupted": "\u5DF2\u4E2D\u65AD",
|
|
440
522
|
"transition.forked": "\u5DF2\u5206\u53C9",
|
|
441
523
|
"transition.unknown": "\u672A\u77E5\u72B6\u6001",
|
|
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",
|
|
442
526
|
"error.fallback.transport": "\u547D\u4EE4\u5931\u8D25",
|
|
443
527
|
"error.fallback.rejected": "\u547D\u4EE4\u88AB\u62D2\u7EDD",
|
|
444
528
|
"error.fallback.unknown": "\u672A\u77E5\u9519\u8BEF",
|
|
@@ -464,6 +548,11 @@ window.__ModuleLoader__.load({
|
|
|
464
548
|
"toggle.failed.status": "Could not turn on DevLead mode: {message}",
|
|
465
549
|
"toggle.failed.status.disable": "Could not turn off DevLead mode: {message}",
|
|
466
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",
|
|
467
556
|
"transition.completed": "completed",
|
|
468
557
|
"transition.error": "failed",
|
|
469
558
|
"transition.blocked": "blocked",
|
|
@@ -472,6 +561,8 @@ window.__ModuleLoader__.load({
|
|
|
472
561
|
"transition.interrupted": "interrupted",
|
|
473
562
|
"transition.forked": "forked",
|
|
474
563
|
"transition.unknown": "unknown state",
|
|
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.",
|
|
475
566
|
"error.fallback.transport": "command failed",
|
|
476
567
|
"error.fallback.rejected": "command rejected",
|
|
477
568
|
"error.fallback.unknown": "unknown error",
|
|
@@ -484,12 +575,16 @@ window.__ModuleLoader__.load({
|
|
|
484
575
|
var styles = `
|
|
485
576
|
/* Composer-tool row control: the users glyph plus a visible DevLead label. It
|
|
486
577
|
keeps the 28px control height of the toolbar and sizes horizontally from its
|
|
487
|
-
content, rather than occupying a fixed square glyph seat.
|
|
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. */
|
|
488
582
|
.devlead-toggle {
|
|
489
583
|
flex: none;
|
|
490
584
|
width: auto;
|
|
491
585
|
height: 28px;
|
|
492
|
-
padding: 0
|
|
586
|
+
padding: 0 9px;
|
|
587
|
+
border: 1px solid transparent;
|
|
493
588
|
border-radius: 999px;
|
|
494
589
|
gap: 6px;
|
|
495
590
|
color: var(--dsw-alias-label-secondary, GrayText);
|
|
@@ -508,13 +603,21 @@ window.__ModuleLoader__.load({
|
|
|
508
603
|
}
|
|
509
604
|
|
|
510
605
|
/* While the mode is on the same button stays in place and reads at full label
|
|
511
|
-
color
|
|
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. */
|
|
512
611
|
.devlead-toggle[data-devlead-enabled="true"] {
|
|
513
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));
|
|
514
615
|
}
|
|
515
616
|
|
|
516
617
|
.devlead-toggle[data-devlead-failed="true"] {
|
|
517
618
|
color: var(--dsw-alias-label-error, #c0392b);
|
|
619
|
+
border-color: var(--dsw-alias-label-error, #c0392b);
|
|
620
|
+
box-shadow: none;
|
|
518
621
|
}
|
|
519
622
|
|
|
520
623
|
/* The shell marks an active toolbar control with a subtle fill; the mode is a
|
|
@@ -528,7 +631,7 @@ window.__ModuleLoader__.load({
|
|
|
528
631
|
accessible name and icon; the bar keeps the watched/running counts. */
|
|
529
632
|
@media (max-width: 480px) {
|
|
530
633
|
.devlead-toggle {
|
|
531
|
-
padding: 0
|
|
634
|
+
padding: 0 7px;
|
|
532
635
|
gap: 0;
|
|
533
636
|
}
|
|
534
637
|
|
|
@@ -705,6 +808,18 @@ window.__ModuleLoader__.load({
|
|
|
705
808
|
background: var(--dsw-alias-state-warn-primary, #a15c00);
|
|
706
809
|
}
|
|
707
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
|
+
|
|
708
823
|
.devlead-notification-who {
|
|
709
824
|
flex: 0 1 auto;
|
|
710
825
|
min-width: 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yankeguo/dsh-client-ui-devlead",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
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",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@deepseek-ai/cordis": "~4.1.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@yankeguo/dsh-devlead-protocol": "0.2.
|
|
38
|
+
"@yankeguo/dsh-devlead-protocol": "0.2.5"
|
|
39
39
|
},
|
|
40
40
|
"engines": {
|
|
41
41
|
"dsh": ">=0.2.2-rc.1 <0.3.0"
|