dsh-leader-agent 0.3.1 → 0.4.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/.agents/skills/e2e-scenarios/SKILL.md +63 -0
- package/.agents/skills/leader-mode/playbooks/program.md +1 -1
- package/README.md +4 -4
- package/README_ZH.md +4 -4
- package/lib/client.js +510 -149
- package/package.json +2 -2
- package/src/client/{worker-report-styles.js → agent-bubble-styles.js} +28 -28
- package/src/client/agent-bubble-view.js +142 -0
- package/src/client/board-projection.js +39 -0
- package/src/client/board-styles.js +25 -1
- package/src/client/board.js +27 -1
- package/src/client/bubble-clock.js +30 -0
- package/src/client/card-links-editor.js +1 -1
- package/src/client/icons.js +16 -15
- package/src/client/index.js +30 -20
- package/src/client/markdown.js +1 -1
- package/src/client/project-panel.js +97 -18
- package/src/client/project-section.js +26 -16
- package/src/client/session-completion.js +89 -0
- package/src/client/session-watermark.js +70 -23
- package/src/client/worker-report-avatar.js +1 -1
- package/src/client/worker-report-definition.js +3 -2
- package/src/client/worker-report-view.js +22 -156
- package/src/client/worker-task-definition.js +72 -0
- package/src/client/worker-task-styles.js +97 -0
- package/src/client/worker-task-view.js +84 -0
- package/src/host/dispatch.js +26 -21
- package/src/host/message.js +0 -25
- package/src/host/projects/service.js +49 -37
- package/src/host/tools/message-worker.js +7 -7
- package/src/host/worker-sessions.js +71 -11
- package/src/host/worker-transcript.js +5 -4
- package/src/shared/message-text.js +64 -0
- package/src/shared/worker-report.js +6 -41
- package/src/shared/worker-task.js +33 -0
package/lib/client.js
CHANGED
|
@@ -51,6 +51,45 @@ module.exports = __toCommonJS(index_exports);
|
|
|
51
51
|
// src/client/board.js
|
|
52
52
|
var import_react7 = require("react");
|
|
53
53
|
|
|
54
|
+
// src/client/session-watermark.js
|
|
55
|
+
var SESSION_WATERMARK_BASE = 5;
|
|
56
|
+
var SESSION_WATERMARK_AUTO_MAX = 50;
|
|
57
|
+
function watermarkRows(rows, watermark) {
|
|
58
|
+
const visible = rows.slice(0, Math.max(0, watermark));
|
|
59
|
+
return { rows: visible, hiddenCount: rows.length - visible.length };
|
|
60
|
+
}
|
|
61
|
+
function requiredWatermark(rows, currentSessionId) {
|
|
62
|
+
let required = 0;
|
|
63
|
+
for (let index = 0; index < rows.length; index += 1) {
|
|
64
|
+
const position = index + 1;
|
|
65
|
+
if (position > SESSION_WATERMARK_AUTO_MAX) break;
|
|
66
|
+
const row = rows[index];
|
|
67
|
+
const current2 = currentSessionId !== void 0 && row?.id === currentSessionId;
|
|
68
|
+
if (row?.running === true || row?.completed === true || current2) required = position;
|
|
69
|
+
}
|
|
70
|
+
return required;
|
|
71
|
+
}
|
|
72
|
+
function foldRows(rows, watermark, { pageSize, baseline = pageSize, noun }) {
|
|
73
|
+
const limit = Math.max(baseline, watermark);
|
|
74
|
+
const visible = watermarkRows(rows, limit);
|
|
75
|
+
return {
|
|
76
|
+
...visible,
|
|
77
|
+
expanded: visible.hiddenCount === 0 && limit > baseline,
|
|
78
|
+
expandLabel: `\u5C55\u5F00\u5176\u4F59 ${visible.hiddenCount} \u4E2A${noun}`
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function nextRowWatermark(hiddenCount, visibleCount, pageSize) {
|
|
82
|
+
if (hiddenCount <= pageSize) return Infinity;
|
|
83
|
+
return visibleCount + pageSize;
|
|
84
|
+
}
|
|
85
|
+
function nextWatermark(hiddenCount, visibleCount, pageSize = SESSION_WATERMARK_BASE) {
|
|
86
|
+
return nextRowWatermark(hiddenCount, visibleCount, pageSize);
|
|
87
|
+
}
|
|
88
|
+
function foldSessions(rows, storedWatermark, currentSessionId, pageSize = SESSION_WATERMARK_BASE) {
|
|
89
|
+
const baseline = Math.max(pageSize, requiredWatermark(rows, currentSessionId));
|
|
90
|
+
return foldRows(rows, Math.max(baseline, storedWatermark), { pageSize, baseline, noun: "\u4F1A\u8BDD" });
|
|
91
|
+
}
|
|
92
|
+
|
|
54
93
|
// src/client/board-projection.js
|
|
55
94
|
var STALLED_THRESHOLD_MS = 24 * 60 * 60 * 1e3;
|
|
56
95
|
var SLOT_STATES = Object.freeze([
|
|
@@ -171,6 +210,13 @@ function sortDoneCards(cards) {
|
|
|
171
210
|
return (left.number ?? 0) - (right.number ?? 0);
|
|
172
211
|
});
|
|
173
212
|
}
|
|
213
|
+
var DONE_PAGE_SIZE = 30;
|
|
214
|
+
function foldDoneCards(cards, watermark) {
|
|
215
|
+
return foldRows(cards, watermark, { pageSize: DONE_PAGE_SIZE, noun: "\u5361\u7247" });
|
|
216
|
+
}
|
|
217
|
+
function nextDoneWatermark(hiddenCount, visibleCount) {
|
|
218
|
+
return nextRowWatermark(hiddenCount, visibleCount, DONE_PAGE_SIZE);
|
|
219
|
+
}
|
|
174
220
|
function mergeCardUpdate(cards, updated) {
|
|
175
221
|
if (updated === null || typeof updated !== "object") return cards;
|
|
176
222
|
return cards.map((card) => card.id === updated.id ? updated : card);
|
|
@@ -553,19 +599,17 @@ var GLYPHS = {
|
|
|
553
599
|
{ d: "M2.55911 7.93683C2.67584 7.49906 3.07229 7.19446 3.52536 7.19446H13.6491C14.3061 7.19446 14.7846 7.81725 14.6153 8.45209L13.4411 12.856C13.3244 13.2938 12.9279 13.5984 12.4748 13.5984H2.35113C1.69411 13.5984 1.21562 12.9756 1.38489 12.3407L2.55911 7.93683Z" }
|
|
554
600
|
]
|
|
555
601
|
},
|
|
556
|
-
|
|
602
|
+
// 应用格子:项目行首是 leader 会话的入口,用它替代目录图标——目录图标与宿主
|
|
603
|
+
// 工作区树同形,「项目」和「工作区」在侧边栏里分不开。路径原样取自宿主
|
|
604
|
+
// `apps-add-outline`(三格加一个「+」),三个 rect 折成等价 path,形状与宿主一致。
|
|
605
|
+
// 「+」与分区标题右侧的添加项目按钮同形,是有意接受的:这里只作入口标识,不加动作。
|
|
606
|
+
"apps-add-outline": {
|
|
557
607
|
size: 16,
|
|
558
608
|
paths: [
|
|
559
|
-
{ d: "
|
|
560
|
-
{ d: "M3.
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
"folder-open": {
|
|
564
|
-
size: 16,
|
|
565
|
-
paths: [
|
|
566
|
-
{ d: "M2.55912 7.93683C2.67584 7.49906 3.0723 7.19446 3.52536 7.19446H13.6491C14.3061 7.19446 14.7846 7.81725 14.6153 8.45209L13.4411 12.856C13.3244 13.2938 12.9279 13.5984 12.4748 13.5984H2.35113C1.69411 13.5984 1.21562 12.9756 1.38489 12.3407L2.55912 7.93683Z", fill: true, opacity: 0.16 },
|
|
567
|
-
{ d: "M13.6491 6.69446C14.6346 6.69453 15.3522 7.62895 15.0983 8.58118L13.9245 12.9845C13.7494 13.6412 13.1539 14.0988 12.4743 14.0988H2.35126C1.36574 14.0988 0.648153 13.1643 0.902044 12.212L2.07587 7.80774C2.25102 7.15128 2.84567 6.69455 3.52509 6.69446H13.6491ZM3.52509 7.69446C3.29865 7.69455 3.10004 7.84674 3.04169 8.06555L1.86786 12.4698C1.78345 12.7872 2.02285 13.0988 2.35126 13.0988H12.4743C12.7007 13.0988 12.8992 12.9463 12.9577 12.7277L14.1325 8.32336C14.2171 8.00598 13.9776 7.69453 13.6491 7.69446H3.52509Z", fill: true },
|
|
568
|
-
{ d: "M4.7666 1.90137C5.13227 1.90144 5.48571 2.03525 5.75977 2.27734L7.27246 3.61328C7.36379 3.69382 7.48174 3.73828 7.60352 3.73828H12.3994C13.2276 3.73841 13.8993 4.41005 13.8994 5.23828V6.7168C13.8183 6.70327 13.735 6.69436 13.6494 6.69434H12.8994V5.23828C12.8993 4.96233 12.6754 4.73841 12.3994 4.73828H7.60352C7.23781 4.73828 6.88446 4.60438 6.61035 4.3623L5.09766 3.02637C5.00636 2.94576 4.88838 2.90144 4.7666 2.90137H2.0498C1.77366 2.90137 1.5498 3.12523 1.5498 3.40137V9.78223L0.902344 12.2119C0.648452 13.1642 1.36604 14.0986 2.35156 14.0986H2.0498C1.2214 14.0986 0.549838 13.427 0.549805 12.5986V3.40137C0.549805 2.57294 1.22138 1.90137 2.0498 1.90137H4.7666Z", fill: true }
|
|
609
|
+
{ d: "M3.25 2.25h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1Z" },
|
|
610
|
+
{ d: "M3.25 9.75h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1Z" },
|
|
611
|
+
{ d: "M10.75 9.75h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1Z" },
|
|
612
|
+
{ d: "M11.75 1.75v5M9.25 4.25h5" }
|
|
569
613
|
]
|
|
570
614
|
},
|
|
571
615
|
"triangle-right-fill": {
|
|
@@ -1884,7 +1928,8 @@ var STYLE_TEXT2 = `
|
|
|
1884
1928
|
.dsh-leader-agent-board-done-title {
|
|
1885
1929
|
flex: 1;
|
|
1886
1930
|
min-width: 0;
|
|
1887
|
-
|
|
1931
|
+
/* \u4E0E\u5361\u53F7\u540C\u5B57\u53F7\uFF1A\u5B8C\u6210\u533A\u662F\u5386\u53F2\u6D4F\u89C8\uFF0C\u5B57\u53F7\u4E0D\u8BE5\u6BD4\u5361\u53F7\u66F4\u62A2\u773C */
|
|
1932
|
+
font-size: 11px;
|
|
1888
1933
|
line-height: 20px;
|
|
1889
1934
|
color: var(--dsw-alias-label-tertiary);
|
|
1890
1935
|
overflow: hidden;
|
|
@@ -1954,6 +1999,29 @@ var STYLE_TEXT2 = `
|
|
|
1954
1999
|
color: var(--dsw-alias-label-tertiary);
|
|
1955
2000
|
}
|
|
1956
2001
|
|
|
2002
|
+
/* \u300C\u5C55\u5F00\u5176\u4F59 / \u6536\u8D77\u300D\uFF1A\u5916\u89C2\u7167\u5BBF\u4E3B\u5DE5\u4F5C\u533A\u6811\u7684 overflow \u6309\u94AE\uFF0812px\u3001\u4E09\u7EA7\u6807\u7B7E\u8272\u3001
|
|
2003
|
+
\u7B49\u5BBD\u884C\u9AD8\uFF0C\u60AC\u505C\u63D0\u4EAE\u5230\u4E8C\u7EA7\u8272\uFF09\uFF0C\u5DE6\u5185\u8FB9\u8DDD\u4E0E done \u884C\u5361\u9762\u5BF9\u9F50 */
|
|
2004
|
+
.dsh-leader-agent-board-done-more {
|
|
2005
|
+
box-sizing: border-box;
|
|
2006
|
+
width: 100%;
|
|
2007
|
+
height: 28px;
|
|
2008
|
+
padding: 0 10px;
|
|
2009
|
+
border: 0;
|
|
2010
|
+
border-radius: var(--dsw-radius-sm);
|
|
2011
|
+
background: transparent;
|
|
2012
|
+
color: var(--dsw-alias-label-tertiary);
|
|
2013
|
+
font-size: 12px;
|
|
2014
|
+
line-height: 28px;
|
|
2015
|
+
text-align: left;
|
|
2016
|
+
cursor: pointer;
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
@media (hover: hover) {
|
|
2020
|
+
.dsh-leader-agent-board-done-more:hover {
|
|
2021
|
+
color: var(--dsw-alias-label-secondary);
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
|
|
1957
2025
|
/* \u9AA8\u67B6\u4E0E\u7A7A\u6001 */
|
|
1958
2026
|
.dsh-leader-agent-board-skeleton {
|
|
1959
2027
|
height: 64px;
|
|
@@ -2838,6 +2906,7 @@ function BoardPanel({ sessionId, getSessions, getUiWorkspace, useSessionStatus,
|
|
|
2838
2906
|
const [loaded, setLoaded] = (0, import_react7.useState)(false);
|
|
2839
2907
|
const [detail, setDetail] = (0, import_react7.useState)(null);
|
|
2840
2908
|
const [doneOpen, setDoneOpen] = (0, import_react7.useState)(false);
|
|
2909
|
+
const [doneWatermark, setDoneWatermark] = (0, import_react7.useState)(0);
|
|
2841
2910
|
const [now, setNow] = (0, import_react7.useState)(() => Date.now());
|
|
2842
2911
|
(0, import_react7.useEffect)(() => {
|
|
2843
2912
|
ensureBoardStyles();
|
|
@@ -2924,6 +2993,7 @@ function BoardPanel({ sessionId, getSessions, getUiWorkspace, useSessionStatus,
|
|
|
2924
2993
|
),
|
|
2925
2994
|
done: sortDoneCards(cardList.filter((card) => card.status === "done"))
|
|
2926
2995
|
}), [cardList, states]);
|
|
2996
|
+
const doneFold = foldDoneCards(done, doneWatermark);
|
|
2927
2997
|
const openSession = (0, import_react7.useCallback)((targetSessionId) => {
|
|
2928
2998
|
const uiWorkspace = getUiWorkspace?.();
|
|
2929
2999
|
if (uiWorkspace === void 0 || uiWorkspace === null) return;
|
|
@@ -3053,7 +3123,7 @@ function BoardPanel({ sessionId, getSessions, getUiWorkspace, useSessionStatus,
|
|
|
3053
3123
|
doneOpen ? (0, import_react7.createElement)(
|
|
3054
3124
|
"div",
|
|
3055
3125
|
{ className: "dsh-leader-agent-board-group" },
|
|
3056
|
-
|
|
3126
|
+
doneFold.rows.map((card) => (0, import_react7.createElement)(BoardCard, {
|
|
3057
3127
|
key: card.id,
|
|
3058
3128
|
card,
|
|
3059
3129
|
states,
|
|
@@ -3062,7 +3132,26 @@ function BoardPanel({ sessionId, getSessions, getUiWorkspace, useSessionStatus,
|
|
|
3062
3132
|
t,
|
|
3063
3133
|
onOpenDetail: openDetail,
|
|
3064
3134
|
onOpenSession: openSession
|
|
3065
|
-
}))
|
|
3135
|
+
})),
|
|
3136
|
+
doneFold.hiddenCount === 0 && !doneFold.expanded ? null : (0, import_react7.createElement)(
|
|
3137
|
+
"button",
|
|
3138
|
+
{
|
|
3139
|
+
type: "button",
|
|
3140
|
+
className: "dsh-leader-agent-board-done-more",
|
|
3141
|
+
"aria-expanded": doneFold.expanded,
|
|
3142
|
+
onClick: () => {
|
|
3143
|
+
if (doneFold.expanded) {
|
|
3144
|
+
setDoneWatermark(0);
|
|
3145
|
+
return;
|
|
3146
|
+
}
|
|
3147
|
+
setDoneWatermark((value) => nextDoneWatermark(
|
|
3148
|
+
doneFold.hiddenCount,
|
|
3149
|
+
Math.max(value, done.length - doneFold.hiddenCount)
|
|
3150
|
+
));
|
|
3151
|
+
}
|
|
3152
|
+
},
|
|
3153
|
+
doneFold.expanded ? "\u6536\u8D77" : doneFold.expandLabel
|
|
3154
|
+
)
|
|
3066
3155
|
) : null
|
|
3067
3156
|
) : null
|
|
3068
3157
|
),
|
|
@@ -3595,37 +3684,6 @@ function moveProjectBefore(projects, activeId, anchorId) {
|
|
|
3595
3684
|
return list;
|
|
3596
3685
|
}
|
|
3597
3686
|
|
|
3598
|
-
// src/client/session-watermark.js
|
|
3599
|
-
var SESSION_WATERMARK_BASE = 5;
|
|
3600
|
-
var SESSION_WATERMARK_AUTO_MAX = 50;
|
|
3601
|
-
function watermarkRows(rows, watermark) {
|
|
3602
|
-
const visible = rows.slice(0, Math.max(0, watermark));
|
|
3603
|
-
return { rows: visible, hiddenCount: rows.length - visible.length };
|
|
3604
|
-
}
|
|
3605
|
-
function requiredWatermark(rows) {
|
|
3606
|
-
let required = 0;
|
|
3607
|
-
for (let index = 0; index < rows.length; index += 1) {
|
|
3608
|
-
const position = index + 1;
|
|
3609
|
-
if (position > SESSION_WATERMARK_AUTO_MAX) break;
|
|
3610
|
-
if (rows[index]?.running === true) required = position;
|
|
3611
|
-
}
|
|
3612
|
-
return required;
|
|
3613
|
-
}
|
|
3614
|
-
function nextWatermark(hiddenCount, watermark) {
|
|
3615
|
-
if (hiddenCount <= SESSION_WATERMARK_BASE) return Infinity;
|
|
3616
|
-
return watermark + SESSION_WATERMARK_BASE;
|
|
3617
|
-
}
|
|
3618
|
-
function foldSessions(rows, storedWatermark) {
|
|
3619
|
-
const baseline = Math.max(SESSION_WATERMARK_BASE, requiredWatermark(rows));
|
|
3620
|
-
const watermark = Math.max(baseline, storedWatermark);
|
|
3621
|
-
const visible = watermarkRows(rows, watermark);
|
|
3622
|
-
return {
|
|
3623
|
-
...visible,
|
|
3624
|
-
expanded: visible.hiddenCount === 0 && watermark > baseline,
|
|
3625
|
-
expandLabel: `\u5C55\u5F00\u5176\u4F59 ${visible.hiddenCount} \u4E2A\u4F1A\u8BDD`
|
|
3626
|
-
};
|
|
3627
|
-
}
|
|
3628
|
-
|
|
3629
3687
|
// src/client/project-section.js
|
|
3630
3688
|
var STYLE_ID3 = "dsh-leader-agent-project-section";
|
|
3631
3689
|
var STYLE_TEXT3 = `
|
|
@@ -3759,9 +3817,10 @@ var STYLE_TEXT3 = `
|
|
|
3759
3817
|
font-size: 14px;
|
|
3760
3818
|
line-height: 20px;
|
|
3761
3819
|
}
|
|
3762
|
-
/* \u884C\u9996\u69FD\u4F4D\uFF1A\u9ED8\u8BA4\
|
|
3763
|
-
\u91CC\u9762\u7684\u56FE\u6807\u4E0E\u52A0\u8F7D\u5708\u90FD\u662F SVG\uFF1A\u4E0D\u628A\u8FD9\u5C42\u6491\u6210 flex \u7684\u8BDD\
|
|
3764
|
-
\u6BD4\u884C\u4E2D\u5FC3\u9AD8 1.5px\uFF0834px \u884C\u5B9E\u6D4B\uFF09\u3002
|
|
3820
|
+
/* \u884C\u9996\u69FD\u4F4D\uFF1A\u9ED8\u8BA4\u5E94\u7528\u683C\u5B50\u56FE\u6807\uFF08\u9879\u76EE\u884C\u5C31\u662F leader \u4F1A\u8BDD\u7684\u5165\u53E3\uFF09\uFF0C\u60AC\u505C\u6574\u884C\u65F6\u6362\u6210\u5C55\u5F00\u7BAD\u5934
|
|
3821
|
+
\uFF08\u4E0E\u5B98\u65B9\u5DE5\u4F5C\u533A\u884C\u540C\u6B3E\uFF09\u3002\u91CC\u9762\u7684\u56FE\u6807\u4E0E\u52A0\u8F7D\u5708\u90FD\u662F SVG\uFF1A\u4E0D\u628A\u8FD9\u5C42\u6491\u6210 flex \u7684\u8BDD\uFF0C
|
|
3822
|
+
SVG \u6309\u884C\u76D2\u57FA\u7EBF\u6392\uFF0C\u5708\u4F1A\u6BD4\u884C\u4E2D\u5FC3\u9AD8 1.5px\uFF0834px \u884C\u5B9E\u6D4B\uFF09\u3002\u7C7B\u540D\u6CBF\u7528 -folder \u540E\u7F00\uFF1A
|
|
3823
|
+
\u69FD\u4F4D\u4F4D\u7F6E\u4E0E\u5BBF\u4E3B\u5DE5\u4F5C\u533A\u884C\u7684\u76EE\u5F55\u56FE\u6807\u540C\u6E90\uFF0C\u6539\u5B57\u5F62\u4E0D\u6539\u69FD\u4F4D\u3002 */
|
|
3765
3824
|
.dsh-leader-agent-project-lead-folder {
|
|
3766
3825
|
display: inline-flex;
|
|
3767
3826
|
align-items: center;
|
|
@@ -3780,7 +3839,7 @@ var STYLE_TEXT3 = `
|
|
|
3780
3839
|
color: var(--dsw-alias-label-tertiary);
|
|
3781
3840
|
cursor: pointer;
|
|
3782
3841
|
}
|
|
3783
|
-
/* \u884C\u9996\u52A0\u8F7D\u5708\uFF1A\u672C\u7EC4\u6709\u6D3B\u52A8\u65F6\u66FF\u6362\
|
|
3842
|
+
/* \u884C\u9996\u52A0\u8F7D\u5708\uFF1A\u672C\u7EC4\u6709\u6D3B\u52A8\u65F6\u66FF\u6362\u884C\u9996\u56FE\u6807\uFF08\u5C3A\u5BF8\u4E0E\u4F4D\u7F6E\u4ECD\u5360\u884C\u9996\u69FD\u4F4D\uFF09\u3002\u6536\u8D77\u65F6
|
|
3784
3843
|
\u4EFB\u4E00\u4F1A\u8BDD\u884C\u5728\u8DD1\u3001\u6216 leader \u81EA\u5DF1\u5728\u8DD1\uFF1B\u5C55\u5F00\u540E\u53EA\u5269 leader\u2014\u2014\u5176\u5B83\u4F1A\u8BDD\u884C\u81EA\u5DF1\u5E26
|
|
3785
3844
|
spinner\uFF0C\u4E0D\u91CD\u590D\u753B\u540C\u4E00\u4E2A\u72B6\u6001\u3002\u60AC\u505C\u89C4\u5219\u5BF9\u69FD\u4F4D\u5BB9\u5668\u751F\u6548\uFF0C\u7BAD\u5934\u7167\u5E38\u76D6\u4F4F\u5B83\u3002
|
|
3786
3845
|
\u5708\u672C\u8EAB\u662F\u5BBF\u4E3B\u7684 StateDot\uFF08state: 'ongoing'\uFF09\uFF1A\u8F68\u9053\u3001\u547C\u5438\u5F27\u30011.5s \u5468\u671F\u4E0E\u9875\u9762
|
|
@@ -3971,9 +4030,10 @@ var STYLE_TEXT3 = `
|
|
|
3971
4030
|
.dsh-leader-agent-session-row[data-selected='true'] {
|
|
3972
4031
|
background: var(--dsw-alias-interactive-bg-hover);
|
|
3973
4032
|
}
|
|
3974
|
-
/* \u72B6\u6001\u4F4D\uFF1A\u5C3A\u5BF8\u7167\u5B98\u65B9\u4F1A\u8BDD\u884C\u7684 slot\uFF0816\xD720\uFF09\u3002\u5B98\u65B9\u5728\u8FD9\u91CC\u653E\
|
|
3975
|
-
\
|
|
3976
|
-
\
|
|
4033
|
+
/* \u72B6\u6001\u4F4D\uFF1A\u5C3A\u5BF8\u7167\u5B98\u65B9\u4F1A\u8BDD\u884C\u7684 slot\uFF0816\xD720\uFF09\u3002\u5B98\u65B9\u5728\u8FD9\u91CC\u653E\u72B6\u6001\u70B9\u6216\u52A0\u8F7D\u5668\uFF0C\u6211\u4EEC\u5206
|
|
4034
|
+
\u4E24\u6863\uFF1A\u8FD0\u884C\u4E2D\u653E\u52A0\u8F7D\u5708\uFF0C\u8DD1\u5B8C\u4E14\u672A\u88AB\u67E5\u770B\u653E done \u7EFF\u70B9\u2014\u2014\u540C\u4E00\u4E2A StateDot \u7EC4\u4EF6\u3001\u540C
|
|
4035
|
+
\u9ED8\u8BA4\u5C3A\u5BF8\u3002\u5B98\u65B9\u7684\u5F85\u4EA4\u4E92\u6A59\u70B9\u4E0E\u5B50\u4F1A\u8BDD\u6863\u6765\u81EA ui-session \u7684\u8FDB\u7A0B\u5185\u6295\u5F71\uFF0C\u4E0D\u5BF9\u63D2\u4EF6
|
|
4036
|
+
\u516C\u5F00\uFF0C\u8FD9\u4E24\u6863\u65E0\u4ECE\u8868\u8FBE\u3002 */
|
|
3977
4037
|
.dsh-leader-agent-session-status {
|
|
3978
4038
|
flex: none;
|
|
3979
4039
|
width: 16px;
|
|
@@ -4323,7 +4383,7 @@ function ProjectRow(props) {
|
|
|
4323
4383
|
leaderRunning: isLeaderRunning(project, sessionRows, archivedSessionIds)
|
|
4324
4384
|
});
|
|
4325
4385
|
const [watermark, setWatermark] = (0, import_react9.useState)(0);
|
|
4326
|
-
const folded = foldSessions(childSessions, watermark);
|
|
4386
|
+
const folded = foldSessions(childSessions, watermark, currentSessionId);
|
|
4327
4387
|
const menuItems = buildProjectMenuItems(project, {
|
|
4328
4388
|
onRename: () => setRenaming(true),
|
|
4329
4389
|
onReplace,
|
|
@@ -4388,7 +4448,7 @@ function ProjectRow(props) {
|
|
|
4388
4448
|
(0, import_react9.createElement)(
|
|
4389
4449
|
"span",
|
|
4390
4450
|
{ className: "dsh-leader-agent-project-lead-folder" },
|
|
4391
|
-
leadActivity ? (0, import_react9.createElement)(import_dsh_client_ui_primitives2.StateDot, { state: "ongoing" }) : productIcon(
|
|
4451
|
+
leadActivity ? (0, import_react9.createElement)(import_dsh_client_ui_primitives2.StateDot, { state: "ongoing" }) : productIcon("apps-add-outline", { size: 16 })
|
|
4392
4452
|
),
|
|
4393
4453
|
(0, import_react9.createElement)(
|
|
4394
4454
|
"span",
|
|
@@ -4569,12 +4629,13 @@ function SessionRow(props) {
|
|
|
4569
4629
|
"data-selected": selected ? "true" : void 0,
|
|
4570
4630
|
"aria-current": selected ? "page" : void 0,
|
|
4571
4631
|
onClick: () => onOpenSession(row.id),
|
|
4572
|
-
|
|
4632
|
+
// 行没有官方那套悬停卡,完成状态拼进行标题里当唯一提示。
|
|
4633
|
+
title: `${row.displayTitle ?? row.title ?? row.id}${row.completed === true ? " \xB7 \u5DF2\u5B8C\u6210\uFF0C\u5F85\u67E5\u770B" : ""}`
|
|
4573
4634
|
},
|
|
4574
4635
|
(0, import_react9.createElement)(
|
|
4575
4636
|
"span",
|
|
4576
4637
|
{ className: "dsh-leader-agent-session-status" },
|
|
4577
|
-
row.running ? (0, import_react9.createElement)(import_dsh_client_ui_primitives2.StateDot, { state: "ongoing" }) : null
|
|
4638
|
+
row.running ? (0, import_react9.createElement)(import_dsh_client_ui_primitives2.StateDot, { state: "ongoing" }) : row.completed === true ? (0, import_react9.createElement)(import_dsh_client_ui_primitives2.StateDot, { state: "done" }) : null
|
|
4578
4639
|
),
|
|
4579
4640
|
(0, import_react9.createElement)(
|
|
4580
4641
|
"span",
|
|
@@ -4603,6 +4664,51 @@ function SessionRow(props) {
|
|
|
4603
4664
|
);
|
|
4604
4665
|
}
|
|
4605
4666
|
|
|
4667
|
+
// src/client/session-completion.js
|
|
4668
|
+
function isMainView(row) {
|
|
4669
|
+
return (row?.retainedBy?.mainView ?? 0) > 0;
|
|
4670
|
+
}
|
|
4671
|
+
function createSessionCompletionTracker() {
|
|
4672
|
+
const running = /* @__PURE__ */ new Map();
|
|
4673
|
+
const unread = /* @__PURE__ */ new Set();
|
|
4674
|
+
return {
|
|
4675
|
+
/**
|
|
4676
|
+
* 喂入一次会话列表快照并重算完成未读集合。
|
|
4677
|
+
*
|
|
4678
|
+
* @param {object} snapshot - `sessions.list` 快照(`ids` / `byId` / `phase`)
|
|
4679
|
+
* @returns {Set<string>} 完成未读的会话 id 集合
|
|
4680
|
+
*/
|
|
4681
|
+
update(snapshot) {
|
|
4682
|
+
const byId = snapshot?.byId ?? {};
|
|
4683
|
+
for (const id of snapshot?.ids ?? Object.keys(byId)) {
|
|
4684
|
+
const row = byId[id];
|
|
4685
|
+
if (row === void 0) continue;
|
|
4686
|
+
const next = row.running === true;
|
|
4687
|
+
const previous = running.get(id);
|
|
4688
|
+
if (previous === void 0) {
|
|
4689
|
+
running.set(id, next);
|
|
4690
|
+
} else if (previous !== next) {
|
|
4691
|
+
running.set(id, next);
|
|
4692
|
+
if (next) unread.delete(id);
|
|
4693
|
+
else if (!isMainView(row)) unread.add(id);
|
|
4694
|
+
}
|
|
4695
|
+
}
|
|
4696
|
+
for (const [id, row] of Object.entries(byId)) {
|
|
4697
|
+
if (isMainView(row)) unread.delete(id);
|
|
4698
|
+
}
|
|
4699
|
+
if (snapshot?.phase === "ready") {
|
|
4700
|
+
for (const id of running.keys()) {
|
|
4701
|
+
if (!Object.hasOwn(byId, id)) {
|
|
4702
|
+
running.delete(id);
|
|
4703
|
+
unread.delete(id);
|
|
4704
|
+
}
|
|
4705
|
+
}
|
|
4706
|
+
}
|
|
4707
|
+
return unread;
|
|
4708
|
+
}
|
|
4709
|
+
};
|
|
4710
|
+
}
|
|
4711
|
+
|
|
4606
4712
|
// src/client/toast.js
|
|
4607
4713
|
var HOLD_MS = 4e3;
|
|
4608
4714
|
var FADE_MS = 1e3;
|
|
@@ -5021,6 +5127,10 @@ function ProjectPanel(props) {
|
|
|
5021
5127
|
void refresh();
|
|
5022
5128
|
void refreshSessionIndex();
|
|
5023
5129
|
}), [refresh, refreshSessionIndex]);
|
|
5130
|
+
const sessionsRef = (0, import_react11.useRef)(getSessions);
|
|
5131
|
+
sessionsRef.current = getSessions;
|
|
5132
|
+
const refreshIndexRef = (0, import_react11.useRef)(refreshSessionIndex);
|
|
5133
|
+
refreshIndexRef.current = refreshSessionIndex;
|
|
5024
5134
|
(0, import_react11.useEffect)(() => {
|
|
5025
5135
|
const tick = () => {
|
|
5026
5136
|
if (document.visibilityState === "visible") void refresh();
|
|
@@ -5033,13 +5143,16 @@ function ProjectPanel(props) {
|
|
|
5033
5143
|
};
|
|
5034
5144
|
}, [refresh]);
|
|
5035
5145
|
(0, import_react11.useEffect)(() => {
|
|
5036
|
-
const sessions = getSessions?.();
|
|
5037
|
-
if (sessions?.list?.subscribe === void 0) return void 0;
|
|
5038
5146
|
let pending = null;
|
|
5147
|
+
let unsubscribe = null;
|
|
5039
5148
|
let lastCurrent;
|
|
5040
5149
|
let primed = false;
|
|
5150
|
+
const completion = createSessionCompletionTracker();
|
|
5041
5151
|
const sync = () => {
|
|
5152
|
+
const sessions = sessionsRef.current?.();
|
|
5153
|
+
if (sessions?.list?.getSnapshot === void 0) return;
|
|
5042
5154
|
const snapshot = sessions.list.getSnapshot();
|
|
5155
|
+
const completed = completion.update(snapshot);
|
|
5043
5156
|
const rows = {};
|
|
5044
5157
|
for (const [id, row] of Object.entries(snapshot.byId ?? {})) {
|
|
5045
5158
|
rows[id] = {
|
|
@@ -5048,7 +5161,8 @@ function ProjectPanel(props) {
|
|
|
5048
5161
|
displayTitle: row.displayTitle,
|
|
5049
5162
|
running: row.running,
|
|
5050
5163
|
origin: row.origin,
|
|
5051
|
-
blank: row.blank
|
|
5164
|
+
blank: row.blank,
|
|
5165
|
+
completed: completed.has(id)
|
|
5052
5166
|
};
|
|
5053
5167
|
}
|
|
5054
5168
|
setSessionRows(rows);
|
|
@@ -5062,22 +5176,41 @@ function ProjectPanel(props) {
|
|
|
5062
5176
|
clearTimeout(pending);
|
|
5063
5177
|
pending = null;
|
|
5064
5178
|
}
|
|
5065
|
-
void
|
|
5179
|
+
void refreshIndexRef.current();
|
|
5066
5180
|
return;
|
|
5067
5181
|
}
|
|
5068
5182
|
if (pending !== null) clearTimeout(pending);
|
|
5069
5183
|
pending = setTimeout(() => {
|
|
5070
5184
|
pending = null;
|
|
5071
|
-
void
|
|
5185
|
+
void refreshIndexRef.current();
|
|
5072
5186
|
}, 1e3);
|
|
5073
5187
|
};
|
|
5074
5188
|
sync();
|
|
5075
|
-
|
|
5189
|
+
let retryTimer = null;
|
|
5190
|
+
const attach = () => {
|
|
5191
|
+
const sessions = sessionsRef.current?.();
|
|
5192
|
+
if (sessions?.list?.subscribe === void 0) return false;
|
|
5193
|
+
sync();
|
|
5194
|
+
unsubscribe = sessions.list.subscribe(sync);
|
|
5195
|
+
return true;
|
|
5196
|
+
};
|
|
5197
|
+
if (!attach()) {
|
|
5198
|
+
const deadline = Date.now() + 1e4;
|
|
5199
|
+
retryTimer = setInterval(() => {
|
|
5200
|
+
if (!attach() && Date.now() < deadline) return;
|
|
5201
|
+
clearInterval(retryTimer);
|
|
5202
|
+
retryTimer = null;
|
|
5203
|
+
if (unsubscribe === null) {
|
|
5204
|
+
console.error("dsh-leader-agent: 10 \u79D2\u5185\u6CA1\u6709\u7B49\u5230\u4F1A\u8BDD\u5217\u8868\u670D\u52A1\uFF0C\u9879\u76EE\u533A\u5757\u5C06\u6CA1\u6709\u8FD0\u884C\u6001\u4E0E\u4F1A\u8BDD\u884C");
|
|
5205
|
+
}
|
|
5206
|
+
}, 500);
|
|
5207
|
+
}
|
|
5076
5208
|
return () => {
|
|
5077
|
-
unsubscribe();
|
|
5209
|
+
unsubscribe?.();
|
|
5210
|
+
if (retryTimer !== null) clearInterval(retryTimer);
|
|
5078
5211
|
if (pending !== null) clearTimeout(pending);
|
|
5079
5212
|
};
|
|
5080
|
-
}, [
|
|
5213
|
+
}, []);
|
|
5081
5214
|
(0, import_react11.useEffect)(() => {
|
|
5082
5215
|
let unsubscribe = null;
|
|
5083
5216
|
const attach = () => {
|
|
@@ -5457,11 +5590,19 @@ function ProjectPanel(props) {
|
|
|
5457
5590
|
function findSidebarRoot(anchor) {
|
|
5458
5591
|
let node = anchor.parentElement;
|
|
5459
5592
|
while (node !== null) {
|
|
5460
|
-
if (node.querySelector("
|
|
5593
|
+
if (node.querySelector("nav") !== null) return node;
|
|
5461
5594
|
node = node.parentElement;
|
|
5462
5595
|
}
|
|
5463
5596
|
return null;
|
|
5464
5597
|
}
|
|
5598
|
+
function placementSpot(root, nav) {
|
|
5599
|
+
if (nav.parentElement === root) {
|
|
5600
|
+
return { parent: root, before: nav.nextElementSibling };
|
|
5601
|
+
}
|
|
5602
|
+
const region = nav.nextElementSibling;
|
|
5603
|
+
if (region === null) return null;
|
|
5604
|
+
return { parent: region, before: region.firstElementChild };
|
|
5605
|
+
}
|
|
5465
5606
|
function SidebarPlacement(props) {
|
|
5466
5607
|
const anchorRef = (0, import_react11.useRef)(null);
|
|
5467
5608
|
const [container, setContainer] = (0, import_react11.useState)(null);
|
|
@@ -5470,12 +5611,14 @@ function SidebarPlacement(props) {
|
|
|
5470
5611
|
if (anchor === null) return void 0;
|
|
5471
5612
|
const root = findSidebarRoot(anchor);
|
|
5472
5613
|
if (root === null) return void 0;
|
|
5473
|
-
const nav = root.querySelector("
|
|
5614
|
+
const nav = root.querySelector("nav");
|
|
5474
5615
|
if (nav === null) return void 0;
|
|
5616
|
+
const spot = placementSpot(root, nav);
|
|
5617
|
+
if (spot === null) return void 0;
|
|
5475
5618
|
const host = document.createElement("div");
|
|
5476
5619
|
host.setAttribute("data-dsh-leader-agent-projects", "");
|
|
5477
5620
|
host.style.flex = "none";
|
|
5478
|
-
|
|
5621
|
+
spot.parent.insertBefore(host, spot.before);
|
|
5479
5622
|
setContainer(host);
|
|
5480
5623
|
return () => {
|
|
5481
5624
|
host.remove();
|
|
@@ -5838,14 +5981,7 @@ function ToastOverlay() {
|
|
|
5838
5981
|
);
|
|
5839
5982
|
}
|
|
5840
5983
|
|
|
5841
|
-
// src/shared/
|
|
5842
|
-
var WORKER_REPORT_SOURCE_KIND = "dsh-leader-agent/worker-report";
|
|
5843
|
-
function workerReportBody(state) {
|
|
5844
|
-
if (state === null || typeof state !== "object") return "";
|
|
5845
|
-
const report = state.report;
|
|
5846
|
-
if (typeof report === "string" && report !== "") return report;
|
|
5847
|
-
return typeof state.text === "string" ? state.text : "";
|
|
5848
|
-
}
|
|
5984
|
+
// src/shared/message-text.js
|
|
5849
5985
|
var BLOCK_MARKERS = [
|
|
5850
5986
|
/^#{1,6}[ \t]/m,
|
|
5851
5987
|
// 标题
|
|
@@ -5860,18 +5996,31 @@ var BLOCK_MARKERS = [
|
|
|
5860
5996
|
/^[ \t]*(?:-{3,}|\*{3,}|_{3,})[ \t]*$/m
|
|
5861
5997
|
// 水平线
|
|
5862
5998
|
];
|
|
5999
|
+
function messageText(content, separator = "\n") {
|
|
6000
|
+
if (!Array.isArray(content)) return "";
|
|
6001
|
+
return content.filter((block) => block !== null && typeof block === "object" && !Array.isArray(block) && block.type === "text" && typeof block.text === "string").map((block) => block.text).join(separator).trim();
|
|
6002
|
+
}
|
|
6003
|
+
function bubbleFormat(text) {
|
|
6004
|
+
if (typeof text !== "string" || text === "") return "text";
|
|
6005
|
+
if (!text.includes("\n")) return "markdown";
|
|
6006
|
+
if (text.includes("\n\n")) return "markdown";
|
|
6007
|
+
return BLOCK_MARKERS.some((marker) => marker.test(text)) ? "markdown" : "text";
|
|
6008
|
+
}
|
|
6009
|
+
|
|
6010
|
+
// src/shared/worker-report.js
|
|
6011
|
+
var WORKER_REPORT_SOURCE_KIND = "dsh-leader-agent/worker-report";
|
|
6012
|
+
function workerReportBody(state) {
|
|
6013
|
+
if (state === null || typeof state !== "object") return "";
|
|
6014
|
+
const report = state.report;
|
|
6015
|
+
if (typeof report === "string" && report !== "") return report;
|
|
6016
|
+
return typeof state.text === "string" ? state.text : "";
|
|
6017
|
+
}
|
|
5863
6018
|
function workerReportFormat(state) {
|
|
5864
6019
|
if (state === null || typeof state !== "object") return "text";
|
|
5865
6020
|
if (state.outcome === "failed") return "text";
|
|
5866
6021
|
const report = state.report;
|
|
5867
6022
|
if (typeof report !== "string" || report === "") return "text";
|
|
5868
|
-
|
|
5869
|
-
if (report.includes("\n\n")) return "markdown";
|
|
5870
|
-
return BLOCK_MARKERS.some((marker) => marker.test(report)) ? "markdown" : "text";
|
|
5871
|
-
}
|
|
5872
|
-
function workerReportText(content) {
|
|
5873
|
-
if (!Array.isArray(content)) return "";
|
|
5874
|
-
return content.filter((block) => isRecord(block) && block.type === "text" && typeof block.text === "string").map((block) => block.text).join("\n").trim();
|
|
6023
|
+
return bubbleFormat(report);
|
|
5875
6024
|
}
|
|
5876
6025
|
function isRecord(value) {
|
|
5877
6026
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
@@ -5908,7 +6057,7 @@ var workerReportDefinition = {
|
|
|
5908
6057
|
seq: event.seq,
|
|
5909
6058
|
time: event.time,
|
|
5910
6059
|
messageId: String(event.data.id),
|
|
5911
|
-
text:
|
|
6060
|
+
text: messageText(event.data.content),
|
|
5912
6061
|
name: source.name,
|
|
5913
6062
|
childSessionId: source.childSessionId,
|
|
5914
6063
|
// 最后一次回报的内容:界面渲染它,协议字段(子会话 id、状态、下一步)
|
|
@@ -5939,6 +6088,9 @@ var workerReportDefinition = {
|
|
|
5939
6088
|
};
|
|
5940
6089
|
|
|
5941
6090
|
// src/client/worker-report-view.js
|
|
6091
|
+
var import_react16 = require("react");
|
|
6092
|
+
|
|
6093
|
+
// src/client/agent-bubble-view.js
|
|
5942
6094
|
var import_react15 = require("react");
|
|
5943
6095
|
|
|
5944
6096
|
// node_modules/minidenticons/minidenticons.js
|
|
@@ -6078,10 +6230,10 @@ function agentAvatarDataUri(name) {
|
|
|
6078
6230
|
return `data:image/svg+xml,${encodeURIComponent(withBackground)}`;
|
|
6079
6231
|
}
|
|
6080
6232
|
|
|
6081
|
-
// src/client/
|
|
6082
|
-
var STYLE_ID6 = "dsh-leader-agent-
|
|
6233
|
+
// src/client/agent-bubble-styles.js
|
|
6234
|
+
var STYLE_ID6 = "dsh-leader-agent-agent-bubble";
|
|
6083
6235
|
var STYLE_TEXT6 = `
|
|
6084
|
-
.dsh-leader-agent-
|
|
6236
|
+
.dsh-leader-agent-agent-bubble {
|
|
6085
6237
|
display: flex;
|
|
6086
6238
|
flex-direction: column;
|
|
6087
6239
|
align-items: flex-start;
|
|
@@ -6089,20 +6241,20 @@ var STYLE_TEXT6 = `
|
|
|
6089
6241
|
width: 100%;
|
|
6090
6242
|
}
|
|
6091
6243
|
|
|
6092
|
-
.dsh-leader-agent-
|
|
6244
|
+
.dsh-leader-agent-agent-bubble__identity {
|
|
6093
6245
|
display: flex;
|
|
6094
6246
|
align-items: center;
|
|
6095
6247
|
gap: 6px;
|
|
6096
6248
|
}
|
|
6097
6249
|
|
|
6098
|
-
.dsh-leader-agent-
|
|
6250
|
+
.dsh-leader-agent-agent-bubble__avatar {
|
|
6099
6251
|
width: 20px;
|
|
6100
6252
|
height: 20px;
|
|
6101
6253
|
border-radius: 5px;
|
|
6102
6254
|
flex-shrink: 0;
|
|
6103
6255
|
}
|
|
6104
6256
|
|
|
6105
|
-
.dsh-leader-agent-
|
|
6257
|
+
.dsh-leader-agent-agent-bubble__name {
|
|
6106
6258
|
font-size: 12px;
|
|
6107
6259
|
font-weight: 500;
|
|
6108
6260
|
color: var(--dsw-alias-label-secondary);
|
|
@@ -6113,14 +6265,14 @@ var STYLE_TEXT6 = `
|
|
|
6113
6265
|
font-family: inherit;
|
|
6114
6266
|
}
|
|
6115
6267
|
|
|
6116
|
-
.dsh-leader-agent-
|
|
6268
|
+
.dsh-leader-agent-agent-bubble__name:hover {
|
|
6117
6269
|
color: var(--dsw-alias-label-primary);
|
|
6118
6270
|
text-decoration: underline;
|
|
6119
6271
|
}
|
|
6120
6272
|
|
|
6121
|
-
.dsh-leader-agent-
|
|
6273
|
+
.dsh-leader-agent-agent-bubble__bubble {
|
|
6122
6274
|
/* \u884C\u9AD8\u53D6 compact \u53D8\u4F53\u7684\u503C\uFF0C\u4E0E MarkdownText \u5185\u90E8\u6392\u7248\u4E00\u81F4\uFF0C\u5426\u5219\u6298\u53E0\u6C34\u4F4D\u4F1A\u5DEE\u534A\u884C */
|
|
6123
|
-
--dsh-leader-agent-
|
|
6275
|
+
--dsh-leader-agent-bubble-line: calc(20px + var(--dsh-content-font-delta-secondary, 0px));
|
|
6124
6276
|
box-sizing: border-box;
|
|
6125
6277
|
display: flex;
|
|
6126
6278
|
flex-direction: column;
|
|
@@ -6135,12 +6287,12 @@ var STYLE_TEXT6 = `
|
|
|
6135
6287
|
border-radius: var(--dsw-radius-xl);
|
|
6136
6288
|
padding: 10px 16px 12px;
|
|
6137
6289
|
font-size: var(--dsh-content-font-size, 14px);
|
|
6138
|
-
line-height: var(--dsh-leader-agent-
|
|
6290
|
+
line-height: var(--dsh-leader-agent-bubble-line);
|
|
6139
6291
|
color: var(--dsw-alias-label-primary);
|
|
6140
6292
|
word-break: break-word;
|
|
6141
6293
|
}
|
|
6142
6294
|
|
|
6143
|
-
.dsh-leader-agent-
|
|
6295
|
+
.dsh-leader-agent-agent-bubble__content {
|
|
6144
6296
|
/* flex \u5BB9\u5668\u91CC align-items: flex-start \u4F1A\u8BA9\u5B50\u9879\u6309\u5185\u5BB9\u6536\u7F29\uFF0C\u663E\u5F0F\u6491\u6EE1\u624D\u4E0D\u4F1A\u63D0\u524D\u6362\u884C */
|
|
6145
6297
|
width: 100%;
|
|
6146
6298
|
}
|
|
@@ -6148,30 +6300,30 @@ var STYLE_TEXT6 = `
|
|
|
6148
6300
|
/* \u540C card-detail-text\uFF1Acompact \u53D8\u4F53\u628A\u6B63\u6587\u538B\u6210\u4E09\u7EA7\u6807\u7B7E\u8272\u3001\u94FE\u63A5\u53D8\u6210 inherit\u3002
|
|
6149
6301
|
\u5BB9\u5668\u7C7B + data-markdown-variant \u662F (0,2,0)\uFF0C\u538B\u8FC7 .compact \u7684 (0,1,0)\uFF1B
|
|
6150
6302
|
\u94FE\u63A5\u5230 (0,2,1)\uFF0C\u538B\u8FC7 .compact a \u7684 (0,1,1)\u2014\u2014\u7279\u5F02\u6027\u66F4\u9AD8\uFF0C\u4E0D\u9760\u6CE8\u5165\u987A\u5E8F\u3002 */
|
|
6151
|
-
.dsh-leader-agent-
|
|
6303
|
+
.dsh-leader-agent-agent-bubble__bubble [data-markdown-variant='compact'] {
|
|
6152
6304
|
color: var(--dsw-alias-label-primary);
|
|
6153
6305
|
}
|
|
6154
6306
|
|
|
6155
|
-
.dsh-leader-agent-
|
|
6307
|
+
.dsh-leader-agent-agent-bubble__bubble [data-markdown-variant='compact'] a {
|
|
6156
6308
|
color: var(--dsw-alias-link);
|
|
6157
6309
|
}
|
|
6158
6310
|
|
|
6159
|
-
/* \
|
|
6160
|
-
\
|
|
6161
|
-
.dsh-leader-agent-
|
|
6311
|
+
/* \u7EAF\u6587\u672C\u6B63\u6587\uFF1Aworker \u56DE\u62A5\u7684\u65E7\u6D88\u606F\uFF08\u6CA1\u6709 report\uFF0C\u56DE\u9000\u6574\u6761\u901A\u77E5\u6B63\u6587\uFF09\u4E0E\u5931\u8D25\u539F\u56E0\u8D70\u8FD9\u91CC\u3002
|
|
6312
|
+
\u9010\u884C\u5185\u5BB9\u4EA4\u7ED9 Markdown \u4F1A\u88AB\u8F6F\u6362\u884C\u6298\u6210\u4E00\u6BB5\u3002 */
|
|
6313
|
+
.dsh-leader-agent-agent-bubble__plain {
|
|
6162
6314
|
white-space: pre-wrap;
|
|
6163
6315
|
}
|
|
6164
6316
|
|
|
6165
|
-
/* \u9ED8\u8BA4\u53EA\u9732\u4E24\u884C\
|
|
6317
|
+
/* \u9ED8\u8BA4\u53EA\u9732\u4E24\u884C\uFF1A\u4E00\u6B21\u56DE\u62A5\u52A8\u8F84\u4E00\u5C4F\uFF0C\u5148\u7ED9\u6458\u8981\uFF0C\u7EC6\u8282\u6309\u9700\u5C55\u5F00\u3002
|
|
6166
6318
|
\u6B63\u6587\u662F\u5757\u7EA7\u5143\u7D20\uFF08\u6BB5\u843D\u3001\u5217\u8868\u3001\u4EE3\u7801\u5757\uFF09\uFF0Cline-clamp \u53EA\u80FD\u622A\u7EAF\u6587\u672C\u884C\uFF1B\u6309\u884C\u9AD8\u7B97
|
|
6167
6319
|
max-height \u624D\u5BF9\u5757\u7EA7\u5185\u5BB9\u751F\u6548\u3002\u591A\u51FA\u7684 4px \u662F compact \u6BB5\u843D\u7684\u4E0A\u8FB9\u8DDD\uFF0C\u4E0D\u52A0\u4F1A\u628A\u7B2C\u4E8C\u884C
|
|
6168
6320
|
\u7684\u4E0B\u7F18\u88C1\u6389\u3002\u88C1\u526A\u53EA\u843D\u5728\u6B63\u6587\u5C42\uFF0C\u6C14\u6CE1\u5185\u7684\u5C55\u5F00\u6309\u94AE\u4E0D\u8DDF\u7740\u88AB\u622A\u3002 */
|
|
6169
|
-
.dsh-leader-agent-
|
|
6170
|
-
max-height: calc(2 * var(--dsh-leader-agent-
|
|
6321
|
+
.dsh-leader-agent-agent-bubble__content[data-collapsed='true'] {
|
|
6322
|
+
max-height: calc(2 * var(--dsh-leader-agent-bubble-line) + 4px);
|
|
6171
6323
|
overflow: hidden;
|
|
6172
6324
|
}
|
|
6173
6325
|
|
|
6174
|
-
.dsh-leader-agent-
|
|
6326
|
+
.dsh-leader-agent-agent-bubble__toggle {
|
|
6175
6327
|
align-self: flex-start;
|
|
6176
6328
|
padding: 0 2px;
|
|
6177
6329
|
border: none;
|
|
@@ -6183,23 +6335,23 @@ var STYLE_TEXT6 = `
|
|
|
6183
6335
|
cursor: pointer;
|
|
6184
6336
|
}
|
|
6185
6337
|
|
|
6186
|
-
.dsh-leader-agent-
|
|
6338
|
+
.dsh-leader-agent-agent-bubble__toggle:hover {
|
|
6187
6339
|
color: var(--dsw-alias-label-secondary);
|
|
6188
6340
|
}
|
|
6189
6341
|
|
|
6190
|
-
.dsh-leader-agent-
|
|
6342
|
+
.dsh-leader-agent-agent-bubble__meta {
|
|
6191
6343
|
display: flex;
|
|
6192
6344
|
align-items: center;
|
|
6193
6345
|
gap: 6px;
|
|
6194
6346
|
padding-left: 2px;
|
|
6195
6347
|
}
|
|
6196
6348
|
|
|
6197
|
-
.dsh-leader-agent-
|
|
6349
|
+
.dsh-leader-agent-agent-bubble__time {
|
|
6198
6350
|
font-size: 11px;
|
|
6199
6351
|
color: var(--dsw-alias-label-tertiary);
|
|
6200
6352
|
}
|
|
6201
6353
|
|
|
6202
|
-
.dsh-leader-agent-
|
|
6354
|
+
.dsh-leader-agent-agent-bubble__copy {
|
|
6203
6355
|
display: inline-flex;
|
|
6204
6356
|
align-items: center;
|
|
6205
6357
|
justify-content: center;
|
|
@@ -6213,12 +6365,12 @@ var STYLE_TEXT6 = `
|
|
|
6213
6365
|
cursor: pointer;
|
|
6214
6366
|
}
|
|
6215
6367
|
|
|
6216
|
-
.dsh-leader-agent-
|
|
6368
|
+
.dsh-leader-agent-agent-bubble__copy:hover {
|
|
6217
6369
|
background: color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent);
|
|
6218
6370
|
color: var(--dsw-alias-label-secondary);
|
|
6219
6371
|
}
|
|
6220
6372
|
`;
|
|
6221
|
-
function
|
|
6373
|
+
function ensureAgentBubbleStyles() {
|
|
6222
6374
|
if (typeof document === "undefined") return;
|
|
6223
6375
|
if (document.getElementById(STYLE_ID6) !== null) return;
|
|
6224
6376
|
const style = document.createElement("style");
|
|
@@ -6227,8 +6379,8 @@ function ensureWorkerReportStyles() {
|
|
|
6227
6379
|
document.head.append(style);
|
|
6228
6380
|
}
|
|
6229
6381
|
|
|
6230
|
-
// src/client/
|
|
6231
|
-
function
|
|
6382
|
+
// src/client/bubble-clock.js
|
|
6383
|
+
function formatBubbleClock(time) {
|
|
6232
6384
|
const date = new Date(time);
|
|
6233
6385
|
const now = /* @__PURE__ */ new Date();
|
|
6234
6386
|
const clock = `${String(date.getHours()).padStart(2, "0")}:${String(date.getMinutes()).padStart(2, "0")}`;
|
|
@@ -6239,16 +6391,15 @@ function formatReportClock(time) {
|
|
|
6239
6391
|
const md = date.getFullYear() === now.getFullYear() ? day : `${date.getFullYear()}\u5E74${day}`;
|
|
6240
6392
|
return `${md} ${clock}`;
|
|
6241
6393
|
}
|
|
6242
|
-
|
|
6394
|
+
|
|
6395
|
+
// src/client/agent-bubble-view.js
|
|
6396
|
+
function AgentBubble({ name, avatarSeed, openTitle, onOpenName, body, format, time }) {
|
|
6243
6397
|
const [copied, setCopied] = (0, import_react15.useState)(false);
|
|
6244
6398
|
const [expanded, setExpanded] = (0, import_react15.useState)(false);
|
|
6245
6399
|
const [overflowing, setOverflowing] = (0, import_react15.useState)(false);
|
|
6246
6400
|
const bubbleRef = (0, import_react15.useRef)(null);
|
|
6247
|
-
const data = node?.data;
|
|
6248
|
-
const body = data === void 0 ? "" : workerReportBody(data);
|
|
6249
|
-
const markdown = data === void 0 ? false : workerReportFormat(data) === "markdown";
|
|
6250
6401
|
(0, import_react15.useLayoutEffect)(() => {
|
|
6251
|
-
|
|
6402
|
+
ensureAgentBubbleStyles();
|
|
6252
6403
|
const element = bubbleRef.current;
|
|
6253
6404
|
if (element === null || expanded) return void 0;
|
|
6254
6405
|
const measure = () => {
|
|
@@ -6260,7 +6411,6 @@ function WorkerReportView({ node, openSession }) {
|
|
|
6260
6411
|
observer.observe(element);
|
|
6261
6412
|
return () => observer.disconnect();
|
|
6262
6413
|
}, [body, expanded]);
|
|
6263
|
-
if (data === void 0) return null;
|
|
6264
6414
|
const copy = async () => {
|
|
6265
6415
|
try {
|
|
6266
6416
|
await navigator.clipboard.writeText(body);
|
|
@@ -6272,44 +6422,44 @@ function WorkerReportView({ node, openSession }) {
|
|
|
6272
6422
|
};
|
|
6273
6423
|
return (0, import_react15.createElement)(
|
|
6274
6424
|
"div",
|
|
6275
|
-
{ className: "dsh-leader-agent-
|
|
6425
|
+
{ className: "dsh-leader-agent-agent-bubble" },
|
|
6276
6426
|
(0, import_react15.createElement)(
|
|
6277
6427
|
"div",
|
|
6278
|
-
{ className: "dsh-leader-agent-
|
|
6428
|
+
{ className: "dsh-leader-agent-agent-bubble__identity" },
|
|
6279
6429
|
(0, import_react15.createElement)("img", {
|
|
6280
|
-
className: "dsh-leader-agent-
|
|
6281
|
-
src: agentAvatarDataUri(
|
|
6430
|
+
className: "dsh-leader-agent-agent-bubble__avatar",
|
|
6431
|
+
src: agentAvatarDataUri(avatarSeed),
|
|
6282
6432
|
alt: ""
|
|
6283
6433
|
}),
|
|
6284
6434
|
(0, import_react15.createElement)(
|
|
6285
6435
|
"button",
|
|
6286
6436
|
{
|
|
6287
6437
|
type: "button",
|
|
6288
|
-
className: "dsh-leader-agent-
|
|
6289
|
-
title:
|
|
6290
|
-
onClick: () =>
|
|
6438
|
+
className: "dsh-leader-agent-agent-bubble__name",
|
|
6439
|
+
title: openTitle,
|
|
6440
|
+
onClick: () => onOpenName?.()
|
|
6291
6441
|
},
|
|
6292
|
-
|
|
6442
|
+
name
|
|
6293
6443
|
)
|
|
6294
6444
|
),
|
|
6295
6445
|
(0, import_react15.createElement)(
|
|
6296
6446
|
"div",
|
|
6297
|
-
{ className: "dsh-leader-agent-
|
|
6447
|
+
{ className: "dsh-leader-agent-agent-bubble__bubble" },
|
|
6298
6448
|
// 裁剪只发生在正文层:按钮在气泡内、正文外,否则展开开关会跟着两行水位被裁掉
|
|
6299
6449
|
(0, import_react15.createElement)(
|
|
6300
6450
|
"div",
|
|
6301
6451
|
{
|
|
6302
6452
|
ref: bubbleRef,
|
|
6303
|
-
className: "dsh-leader-agent-
|
|
6453
|
+
className: "dsh-leader-agent-agent-bubble__content",
|
|
6304
6454
|
"data-collapsed": expanded ? void 0 : "true"
|
|
6305
6455
|
},
|
|
6306
|
-
markdown ? (0, import_react15.createElement)(Markdown, { source: body }) : (0, import_react15.createElement)("div", { className: "dsh-leader-agent-
|
|
6456
|
+
format === "markdown" ? (0, import_react15.createElement)(Markdown, { source: body }) : (0, import_react15.createElement)("div", { className: "dsh-leader-agent-agent-bubble__plain" }, body)
|
|
6307
6457
|
),
|
|
6308
6458
|
overflowing ? (0, import_react15.createElement)(
|
|
6309
6459
|
"button",
|
|
6310
6460
|
{
|
|
6311
6461
|
type: "button",
|
|
6312
|
-
className: "dsh-leader-agent-
|
|
6462
|
+
className: "dsh-leader-agent-agent-bubble__toggle",
|
|
6313
6463
|
"aria-expanded": expanded,
|
|
6314
6464
|
onClick: () => setExpanded((value) => !value)
|
|
6315
6465
|
},
|
|
@@ -6318,13 +6468,218 @@ function WorkerReportView({ node, openSession }) {
|
|
|
6318
6468
|
),
|
|
6319
6469
|
(0, import_react15.createElement)(
|
|
6320
6470
|
"div",
|
|
6321
|
-
{ className: "dsh-leader-agent-
|
|
6322
|
-
(0, import_react15.createElement)("span", { className: "dsh-leader-agent-
|
|
6471
|
+
{ className: "dsh-leader-agent-agent-bubble__meta" },
|
|
6472
|
+
(0, import_react15.createElement)("span", { className: "dsh-leader-agent-agent-bubble__time" }, formatBubbleClock(time)),
|
|
6323
6473
|
(0, import_react15.createElement)(
|
|
6324
6474
|
"button",
|
|
6325
6475
|
{
|
|
6326
6476
|
type: "button",
|
|
6327
|
-
className: "dsh-leader-agent-
|
|
6477
|
+
className: "dsh-leader-agent-agent-bubble__copy",
|
|
6478
|
+
"aria-label": copied ? "\u5DF2\u590D\u5236" : "\u590D\u5236",
|
|
6479
|
+
title: copied ? "\u5DF2\u590D\u5236" : "\u590D\u5236",
|
|
6480
|
+
onClick: () => {
|
|
6481
|
+
void copy();
|
|
6482
|
+
}
|
|
6483
|
+
},
|
|
6484
|
+
productIcon(copied ? "check-outline" : "copy-outline", { size: 14 })
|
|
6485
|
+
)
|
|
6486
|
+
)
|
|
6487
|
+
);
|
|
6488
|
+
}
|
|
6489
|
+
|
|
6490
|
+
// src/client/worker-report-view.js
|
|
6491
|
+
function WorkerReportView({ node, openSession }) {
|
|
6492
|
+
const data = node?.data;
|
|
6493
|
+
if (data === void 0) return null;
|
|
6494
|
+
return (0, import_react16.createElement)(AgentBubble, {
|
|
6495
|
+
name: data.name,
|
|
6496
|
+
avatarSeed: data.name,
|
|
6497
|
+
openTitle: `\u6253\u5F00 ${data.name} \u7684\u5B50\u4F1A\u8BDD`,
|
|
6498
|
+
onOpenName: () => openSession?.(data.childSessionId),
|
|
6499
|
+
// 旧回报缺 report,回退整条通知正文;失败原因与逐行协议字段走纯文本,
|
|
6500
|
+
// 判据见 workerReportFormat。
|
|
6501
|
+
body: workerReportBody(data),
|
|
6502
|
+
format: workerReportFormat(data),
|
|
6503
|
+
time: data.time
|
|
6504
|
+
});
|
|
6505
|
+
}
|
|
6506
|
+
|
|
6507
|
+
// src/shared/worker-task.js
|
|
6508
|
+
var WORKER_TASK_SOURCE_KIND = "dsh-leader-agent/worker-task";
|
|
6509
|
+
function readWorkerTaskSource(source) {
|
|
6510
|
+
if (source === null || typeof source !== "object" || Array.isArray(source)) return null;
|
|
6511
|
+
if (source.kind !== WORKER_TASK_SOURCE_KIND) return null;
|
|
6512
|
+
const parentSessionId = source.parentSessionId;
|
|
6513
|
+
if (typeof parentSessionId !== "string" || parentSessionId === "") return null;
|
|
6514
|
+
return { parentSessionId };
|
|
6515
|
+
}
|
|
6516
|
+
|
|
6517
|
+
// src/client/worker-task-definition.js
|
|
6518
|
+
var WORKER_TASK_NODE_KIND = "dsh-leader-agent-worker-task";
|
|
6519
|
+
var workerTaskDefinition = {
|
|
6520
|
+
kind: WORKER_TASK_NODE_KIND,
|
|
6521
|
+
target: "chat",
|
|
6522
|
+
match: (event) => {
|
|
6523
|
+
if (event.type !== "user/message") return null;
|
|
6524
|
+
if (event.surfaceOp !== "append") return null;
|
|
6525
|
+
if (readWorkerTaskSource(event.data?.source) === null) return null;
|
|
6526
|
+
return { id: String(event.data.id), role: "start", exclusive: true };
|
|
6527
|
+
},
|
|
6528
|
+
start: (_context, match) => {
|
|
6529
|
+
const event = match.event;
|
|
6530
|
+
if (event.type !== "user/message") throw new Error("leader \u4EFB\u52A1 start \u9700\u8981 user/message \u4E8B\u4EF6");
|
|
6531
|
+
const source = readWorkerTaskSource(event.data.source);
|
|
6532
|
+
if (source === null) throw new Error("leader \u4EFB\u52A1 start \u9700\u8981\u5E26 task \u6807\u8BB0\u7684 source");
|
|
6533
|
+
return {
|
|
6534
|
+
seq: event.seq,
|
|
6535
|
+
time: event.time,
|
|
6536
|
+
messageId: String(event.data.id),
|
|
6537
|
+
text: messageText(event.data.content)
|
|
6538
|
+
};
|
|
6539
|
+
},
|
|
6540
|
+
update: (context) => context.state,
|
|
6541
|
+
buildViewNode: (context) => {
|
|
6542
|
+
if (context.state === void 0) return null;
|
|
6543
|
+
const location = context.start?.location ?? { kind: "unresolved" };
|
|
6544
|
+
return {
|
|
6545
|
+
key: context.key,
|
|
6546
|
+
kind: WORKER_TASK_NODE_KIND,
|
|
6547
|
+
id: context.id,
|
|
6548
|
+
target: "chat",
|
|
6549
|
+
anchorSeq: context.state.seq,
|
|
6550
|
+
location,
|
|
6551
|
+
visibility: "visible",
|
|
6552
|
+
// 分组位置与官方一致:回合的首步开启新 exchange,其余留在 input。
|
|
6553
|
+
// 位置不能省——没有它,节点会落进回合的「过程折叠区」被默认隐藏。
|
|
6554
|
+
groupTree: location.kind === "step" && location.step.step === 1 ? "exchange" : "input",
|
|
6555
|
+
data: context.state
|
|
6556
|
+
};
|
|
6557
|
+
}
|
|
6558
|
+
};
|
|
6559
|
+
|
|
6560
|
+
// src/client/worker-task-view.js
|
|
6561
|
+
var import_react17 = require("react");
|
|
6562
|
+
|
|
6563
|
+
// src/client/worker-task-styles.js
|
|
6564
|
+
var STYLE_ID7 = "dsh-leader-agent-worker-task";
|
|
6565
|
+
var STYLE_TEXT7 = `
|
|
6566
|
+
.dsh-leader-agent-worker-task {
|
|
6567
|
+
display: flex;
|
|
6568
|
+
flex-direction: column;
|
|
6569
|
+
align-items: flex-end;
|
|
6570
|
+
gap: 6px;
|
|
6571
|
+
width: 100%;
|
|
6572
|
+
}
|
|
6573
|
+
|
|
6574
|
+
.dsh-leader-agent-worker-task__bubble {
|
|
6575
|
+
box-sizing: border-box;
|
|
6576
|
+
max-width: min(calc(var(--dsh-chat-content-width, 748px) * 0.702), 82%);
|
|
6577
|
+
/* \u4E0E\u5BBF\u4E3B\u6D88\u606F\u6C14\u6CE1\u540C\u4E00\u6750\u8D28\uFF1A--dsw-specific-bubble \u662F\u4E3B\u9898\u7ED9\u6C14\u6CE1\u7684\u4E13\u5C5E\u5E95\u8272\uFF0C
|
|
6578
|
+
\u81EA\u5DF1\u6309\u524D\u666F\u8272\u6DF7\u4F1A\u504F\u7070\uFF0C\u4E14\u6DF1\u6D45\u4E3B\u9898\u4E0B\u5F3A\u5EA6\u4E0D\u4E00\u81F4\u3002\u7528\u6237\u6C14\u6CE1\u6CA1\u6709\u63CF\u8FB9\u3002 */
|
|
6579
|
+
background: var(--dsw-specific-bubble);
|
|
6580
|
+
border: none;
|
|
6581
|
+
border-radius: var(--dsw-radius-xl);
|
|
6582
|
+
padding: 10px 16px;
|
|
6583
|
+
font-size: var(--dsh-content-font-size, 14px);
|
|
6584
|
+
color: var(--dsw-alias-label-primary);
|
|
6585
|
+
word-break: break-word;
|
|
6586
|
+
}
|
|
6587
|
+
|
|
6588
|
+
/* compact \u53D8\u4F53\u628A\u6B63\u6587\u538B\u6210\u4E09\u7EA7\u6807\u7B7E\u8272\u3001\u94FE\u63A5\u53D8\u6210 inherit\uFF1B\u5BB9\u5668\u5185\u6309\u5C5E\u6027\u94A9\u5B50\u538B\u56DE\u539F\u8272\u3002
|
|
6589
|
+
\u4E0E card-detail-text \u76F8\u540C\uFF1A\u5BB9\u5668\u7C7B + data-markdown-variant \u662F (0,2,0)\uFF0C\u538B\u8FC7
|
|
6590
|
+
.compact \u7684 (0,1,0)\uFF1B\u94FE\u63A5\u5230 (0,2,1)\uFF0C\u538B\u8FC7 .compact a \u7684 (0,1,1)\u3002 */
|
|
6591
|
+
.dsh-leader-agent-worker-task__bubble [data-markdown-variant='compact'] {
|
|
6592
|
+
color: var(--dsw-alias-label-primary);
|
|
6593
|
+
}
|
|
6594
|
+
|
|
6595
|
+
.dsh-leader-agent-worker-task__bubble [data-markdown-variant='compact'] a {
|
|
6596
|
+
color: var(--dsw-alias-link);
|
|
6597
|
+
}
|
|
6598
|
+
|
|
6599
|
+
.dsh-leader-agent-worker-task__meta {
|
|
6600
|
+
display: flex;
|
|
6601
|
+
align-items: center;
|
|
6602
|
+
gap: 6px;
|
|
6603
|
+
padding-right: 2px;
|
|
6604
|
+
}
|
|
6605
|
+
|
|
6606
|
+
.dsh-leader-agent-worker-task__time {
|
|
6607
|
+
font-size: 11px;
|
|
6608
|
+
color: var(--dsw-alias-label-tertiary);
|
|
6609
|
+
}
|
|
6610
|
+
|
|
6611
|
+
.dsh-leader-agent-worker-task__copy {
|
|
6612
|
+
display: inline-flex;
|
|
6613
|
+
align-items: center;
|
|
6614
|
+
justify-content: center;
|
|
6615
|
+
width: 22px;
|
|
6616
|
+
height: 22px;
|
|
6617
|
+
padding: 0;
|
|
6618
|
+
border: none;
|
|
6619
|
+
border-radius: var(--dsw-radius-sm, 6px);
|
|
6620
|
+
background: none;
|
|
6621
|
+
color: var(--dsw-alias-label-tertiary);
|
|
6622
|
+
cursor: pointer;
|
|
6623
|
+
}
|
|
6624
|
+
|
|
6625
|
+
.dsh-leader-agent-worker-task__copy:hover {
|
|
6626
|
+
background: color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent);
|
|
6627
|
+
color: var(--dsw-alias-label-secondary);
|
|
6628
|
+
}
|
|
6629
|
+
`;
|
|
6630
|
+
function ensureWorkerTaskStyles() {
|
|
6631
|
+
if (typeof document === "undefined") return;
|
|
6632
|
+
if (document.getElementById(STYLE_ID7) !== null) return;
|
|
6633
|
+
const style = document.createElement("style");
|
|
6634
|
+
style.id = STYLE_ID7;
|
|
6635
|
+
style.textContent = STYLE_TEXT7;
|
|
6636
|
+
document.head.append(style);
|
|
6637
|
+
}
|
|
6638
|
+
|
|
6639
|
+
// src/client/worker-task-view.js
|
|
6640
|
+
function WorkerTaskView({ node }) {
|
|
6641
|
+
const data = node?.data;
|
|
6642
|
+
const [copied, setCopied] = (0, import_react17.useState)(false);
|
|
6643
|
+
(0, import_react17.useLayoutEffect)(() => {
|
|
6644
|
+
ensureWorkerTaskStyles();
|
|
6645
|
+
}, []);
|
|
6646
|
+
if (data === void 0) return null;
|
|
6647
|
+
const body = typeof data.text === "string" ? data.text : "";
|
|
6648
|
+
const copy = async () => {
|
|
6649
|
+
try {
|
|
6650
|
+
await navigator.clipboard.writeText(body);
|
|
6651
|
+
} catch {
|
|
6652
|
+
return;
|
|
6653
|
+
}
|
|
6654
|
+
setCopied(true);
|
|
6655
|
+
setTimeout(() => setCopied(false), 1500);
|
|
6656
|
+
};
|
|
6657
|
+
return (0, import_react17.createElement)(
|
|
6658
|
+
"div",
|
|
6659
|
+
{ className: "dsh-leader-agent-worker-task" },
|
|
6660
|
+
(0, import_react17.createElement)(
|
|
6661
|
+
"div",
|
|
6662
|
+
{
|
|
6663
|
+
className: "dsh-leader-agent-worker-task__bubble",
|
|
6664
|
+
// 与宿主用户气泡同一标记,便于界面侧把这块内容当消息正文处理。
|
|
6665
|
+
"data-message-bubble": "",
|
|
6666
|
+
// 形态与用户自己的消息一样,只能靠内容判断来源;这两条只做悬停与读屏提示。
|
|
6667
|
+
title: "Leader \u6D3E\u53D1\u7684\u4EFB\u52A1",
|
|
6668
|
+
"aria-label": "Leader \u6D3E\u53D1\u7684\u4EFB\u52A1"
|
|
6669
|
+
},
|
|
6670
|
+
// 与 assistant 内容同套 Markdown:原文直接交给基线 MarkdownText,不补硬换行、
|
|
6671
|
+
// 不做行级改写;单换行按 Markdown 合并。
|
|
6672
|
+
(0, import_react17.createElement)(Markdown, { source: body, variant: "compact" })
|
|
6673
|
+
),
|
|
6674
|
+
(0, import_react17.createElement)(
|
|
6675
|
+
"div",
|
|
6676
|
+
{ className: "dsh-leader-agent-worker-task__meta" },
|
|
6677
|
+
(0, import_react17.createElement)("span", { className: "dsh-leader-agent-worker-task__time" }, formatBubbleClock(data.time)),
|
|
6678
|
+
(0, import_react17.createElement)(
|
|
6679
|
+
"button",
|
|
6680
|
+
{
|
|
6681
|
+
type: "button",
|
|
6682
|
+
className: "dsh-leader-agent-worker-task__copy",
|
|
6328
6683
|
"aria-label": copied ? "\u5DF2\u590D\u5236" : "\u590D\u5236",
|
|
6329
6684
|
title: copied ? "\u5DF2\u590D\u5236" : "\u590D\u5236",
|
|
6330
6685
|
onClick: () => {
|
|
@@ -6401,7 +6756,7 @@ function apply(ctx) {
|
|
|
6401
6756
|
ctx.inject(["uiConversation"], function mountLeaderViewFiber(conversationCtx) {
|
|
6402
6757
|
mountLeaderView(conversationCtx);
|
|
6403
6758
|
mountGuideCard(conversationCtx);
|
|
6404
|
-
|
|
6759
|
+
mountMessageBubbles(conversationCtx);
|
|
6405
6760
|
});
|
|
6406
6761
|
ctx.inject(["remote"], function mountProjectChannel(remoteCtx) {
|
|
6407
6762
|
void mountProjectRemote(remoteCtx).catch((error) => {
|
|
@@ -6428,22 +6783,28 @@ function mountBoardMonitor(ctx) {
|
|
|
6428
6783
|
});
|
|
6429
6784
|
ctx.effect(() => stop, "dsh-leader-agent \u770B\u677F\u76D1\u89C6\u5668");
|
|
6430
6785
|
}
|
|
6431
|
-
function
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6786
|
+
function mountMessageBubbles(ctx) {
|
|
6787
|
+
const bubbles = [
|
|
6788
|
+
{ kind: WORKER_TASK_NODE_KIND, definition: workerTaskDefinition, view: WorkerTaskView, label: "leader \u4EFB\u52A1" },
|
|
6789
|
+
{ kind: WORKER_REPORT_NODE_KIND, definition: workerReportDefinition, view: WorkerReportView, label: "worker \u56DE\u62A5" }
|
|
6790
|
+
];
|
|
6791
|
+
for (const bubble of bubbles) {
|
|
6792
|
+
try {
|
|
6793
|
+
ctx.uiConversation.events.register(bubble.definition);
|
|
6794
|
+
} catch (error) {
|
|
6795
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6796
|
+
ctx.logger?.error?.(`dsh-leader-agent: ${bubble.label}\u8282\u70B9\u6CE8\u518C\u5931\u8D25\uFF1A${message}`);
|
|
6797
|
+
continue;
|
|
6798
|
+
}
|
|
6799
|
+
ctx.effect(() => ctx.slots.inject("conversation.chat.node", () => ctx.slots.register({
|
|
6800
|
+
name: "conversation.chat.node",
|
|
6801
|
+
key: bubble.kind,
|
|
6802
|
+
// `uiWorkspace` 只挂在 web-app bundle 上,写进 inject 的服务缺失会让整个插件
|
|
6803
|
+
// 挂起——惰性获取,点击名字时才取。
|
|
6804
|
+
inject: () => ({
|
|
6805
|
+
openSession: (sessionId) => ctx.get("uiWorkspace")?.openSession(sessionId)
|
|
6806
|
+
})
|
|
6807
|
+
}, bubble.view)), `dsh-leader-agent ${bubble.label}\u6E32\u67D3\u5668`);
|
|
6438
6808
|
}
|
|
6439
|
-
ctx.effect(() => ctx.slots.inject("conversation.chat.node", () => ctx.slots.register({
|
|
6440
|
-
name: "conversation.chat.node",
|
|
6441
|
-
key: WORKER_REPORT_NODE_KIND,
|
|
6442
|
-
// `uiWorkspace` 只挂在 web-app bundle 上,写进 inject 的服务缺失会让整个插件
|
|
6443
|
-
// 挂起——惰性获取,点击名字时才取。
|
|
6444
|
-
inject: () => ({
|
|
6445
|
-
openSession: (sessionId) => ctx.get("uiWorkspace")?.openSession(sessionId)
|
|
6446
|
-
})
|
|
6447
|
-
}, WorkerReportView)), "dsh-leader-agent worker \u56DE\u62A5\u6E32\u67D3\u5668");
|
|
6448
6809
|
}
|
|
6449
6810
|
return module.exports; } });
|