dsh-leader-agent 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.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 +497 -146
- 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 +46 -7
- 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 = () => {
|
|
@@ -5838,14 +5971,7 @@ function ToastOverlay() {
|
|
|
5838
5971
|
);
|
|
5839
5972
|
}
|
|
5840
5973
|
|
|
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
|
-
}
|
|
5974
|
+
// src/shared/message-text.js
|
|
5849
5975
|
var BLOCK_MARKERS = [
|
|
5850
5976
|
/^#{1,6}[ \t]/m,
|
|
5851
5977
|
// 标题
|
|
@@ -5860,18 +5986,31 @@ var BLOCK_MARKERS = [
|
|
|
5860
5986
|
/^[ \t]*(?:-{3,}|\*{3,}|_{3,})[ \t]*$/m
|
|
5861
5987
|
// 水平线
|
|
5862
5988
|
];
|
|
5989
|
+
function messageText(content, separator = "\n") {
|
|
5990
|
+
if (!Array.isArray(content)) return "";
|
|
5991
|
+
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();
|
|
5992
|
+
}
|
|
5993
|
+
function bubbleFormat(text) {
|
|
5994
|
+
if (typeof text !== "string" || text === "") return "text";
|
|
5995
|
+
if (!text.includes("\n")) return "markdown";
|
|
5996
|
+
if (text.includes("\n\n")) return "markdown";
|
|
5997
|
+
return BLOCK_MARKERS.some((marker) => marker.test(text)) ? "markdown" : "text";
|
|
5998
|
+
}
|
|
5999
|
+
|
|
6000
|
+
// src/shared/worker-report.js
|
|
6001
|
+
var WORKER_REPORT_SOURCE_KIND = "dsh-leader-agent/worker-report";
|
|
6002
|
+
function workerReportBody(state) {
|
|
6003
|
+
if (state === null || typeof state !== "object") return "";
|
|
6004
|
+
const report = state.report;
|
|
6005
|
+
if (typeof report === "string" && report !== "") return report;
|
|
6006
|
+
return typeof state.text === "string" ? state.text : "";
|
|
6007
|
+
}
|
|
5863
6008
|
function workerReportFormat(state) {
|
|
5864
6009
|
if (state === null || typeof state !== "object") return "text";
|
|
5865
6010
|
if (state.outcome === "failed") return "text";
|
|
5866
6011
|
const report = state.report;
|
|
5867
6012
|
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();
|
|
6013
|
+
return bubbleFormat(report);
|
|
5875
6014
|
}
|
|
5876
6015
|
function isRecord(value) {
|
|
5877
6016
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
@@ -5908,7 +6047,7 @@ var workerReportDefinition = {
|
|
|
5908
6047
|
seq: event.seq,
|
|
5909
6048
|
time: event.time,
|
|
5910
6049
|
messageId: String(event.data.id),
|
|
5911
|
-
text:
|
|
6050
|
+
text: messageText(event.data.content),
|
|
5912
6051
|
name: source.name,
|
|
5913
6052
|
childSessionId: source.childSessionId,
|
|
5914
6053
|
// 最后一次回报的内容:界面渲染它,协议字段(子会话 id、状态、下一步)
|
|
@@ -5939,6 +6078,9 @@ var workerReportDefinition = {
|
|
|
5939
6078
|
};
|
|
5940
6079
|
|
|
5941
6080
|
// src/client/worker-report-view.js
|
|
6081
|
+
var import_react16 = require("react");
|
|
6082
|
+
|
|
6083
|
+
// src/client/agent-bubble-view.js
|
|
5942
6084
|
var import_react15 = require("react");
|
|
5943
6085
|
|
|
5944
6086
|
// node_modules/minidenticons/minidenticons.js
|
|
@@ -6078,10 +6220,10 @@ function agentAvatarDataUri(name) {
|
|
|
6078
6220
|
return `data:image/svg+xml,${encodeURIComponent(withBackground)}`;
|
|
6079
6221
|
}
|
|
6080
6222
|
|
|
6081
|
-
// src/client/
|
|
6082
|
-
var STYLE_ID6 = "dsh-leader-agent-
|
|
6223
|
+
// src/client/agent-bubble-styles.js
|
|
6224
|
+
var STYLE_ID6 = "dsh-leader-agent-agent-bubble";
|
|
6083
6225
|
var STYLE_TEXT6 = `
|
|
6084
|
-
.dsh-leader-agent-
|
|
6226
|
+
.dsh-leader-agent-agent-bubble {
|
|
6085
6227
|
display: flex;
|
|
6086
6228
|
flex-direction: column;
|
|
6087
6229
|
align-items: flex-start;
|
|
@@ -6089,20 +6231,20 @@ var STYLE_TEXT6 = `
|
|
|
6089
6231
|
width: 100%;
|
|
6090
6232
|
}
|
|
6091
6233
|
|
|
6092
|
-
.dsh-leader-agent-
|
|
6234
|
+
.dsh-leader-agent-agent-bubble__identity {
|
|
6093
6235
|
display: flex;
|
|
6094
6236
|
align-items: center;
|
|
6095
6237
|
gap: 6px;
|
|
6096
6238
|
}
|
|
6097
6239
|
|
|
6098
|
-
.dsh-leader-agent-
|
|
6240
|
+
.dsh-leader-agent-agent-bubble__avatar {
|
|
6099
6241
|
width: 20px;
|
|
6100
6242
|
height: 20px;
|
|
6101
6243
|
border-radius: 5px;
|
|
6102
6244
|
flex-shrink: 0;
|
|
6103
6245
|
}
|
|
6104
6246
|
|
|
6105
|
-
.dsh-leader-agent-
|
|
6247
|
+
.dsh-leader-agent-agent-bubble__name {
|
|
6106
6248
|
font-size: 12px;
|
|
6107
6249
|
font-weight: 500;
|
|
6108
6250
|
color: var(--dsw-alias-label-secondary);
|
|
@@ -6113,14 +6255,14 @@ var STYLE_TEXT6 = `
|
|
|
6113
6255
|
font-family: inherit;
|
|
6114
6256
|
}
|
|
6115
6257
|
|
|
6116
|
-
.dsh-leader-agent-
|
|
6258
|
+
.dsh-leader-agent-agent-bubble__name:hover {
|
|
6117
6259
|
color: var(--dsw-alias-label-primary);
|
|
6118
6260
|
text-decoration: underline;
|
|
6119
6261
|
}
|
|
6120
6262
|
|
|
6121
|
-
.dsh-leader-agent-
|
|
6263
|
+
.dsh-leader-agent-agent-bubble__bubble {
|
|
6122
6264
|
/* \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-
|
|
6265
|
+
--dsh-leader-agent-bubble-line: calc(20px + var(--dsh-content-font-delta-secondary, 0px));
|
|
6124
6266
|
box-sizing: border-box;
|
|
6125
6267
|
display: flex;
|
|
6126
6268
|
flex-direction: column;
|
|
@@ -6135,12 +6277,12 @@ var STYLE_TEXT6 = `
|
|
|
6135
6277
|
border-radius: var(--dsw-radius-xl);
|
|
6136
6278
|
padding: 10px 16px 12px;
|
|
6137
6279
|
font-size: var(--dsh-content-font-size, 14px);
|
|
6138
|
-
line-height: var(--dsh-leader-agent-
|
|
6280
|
+
line-height: var(--dsh-leader-agent-bubble-line);
|
|
6139
6281
|
color: var(--dsw-alias-label-primary);
|
|
6140
6282
|
word-break: break-word;
|
|
6141
6283
|
}
|
|
6142
6284
|
|
|
6143
|
-
.dsh-leader-agent-
|
|
6285
|
+
.dsh-leader-agent-agent-bubble__content {
|
|
6144
6286
|
/* 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
6287
|
width: 100%;
|
|
6146
6288
|
}
|
|
@@ -6148,30 +6290,30 @@ var STYLE_TEXT6 = `
|
|
|
6148
6290
|
/* \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
6291
|
\u5BB9\u5668\u7C7B + data-markdown-variant \u662F (0,2,0)\uFF0C\u538B\u8FC7 .compact \u7684 (0,1,0)\uFF1B
|
|
6150
6292
|
\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-
|
|
6293
|
+
.dsh-leader-agent-agent-bubble__bubble [data-markdown-variant='compact'] {
|
|
6152
6294
|
color: var(--dsw-alias-label-primary);
|
|
6153
6295
|
}
|
|
6154
6296
|
|
|
6155
|
-
.dsh-leader-agent-
|
|
6297
|
+
.dsh-leader-agent-agent-bubble__bubble [data-markdown-variant='compact'] a {
|
|
6156
6298
|
color: var(--dsw-alias-link);
|
|
6157
6299
|
}
|
|
6158
6300
|
|
|
6159
|
-
/* \
|
|
6160
|
-
\
|
|
6161
|
-
.dsh-leader-agent-
|
|
6301
|
+
/* \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
|
|
6302
|
+
\u9010\u884C\u5185\u5BB9\u4EA4\u7ED9 Markdown \u4F1A\u88AB\u8F6F\u6362\u884C\u6298\u6210\u4E00\u6BB5\u3002 */
|
|
6303
|
+
.dsh-leader-agent-agent-bubble__plain {
|
|
6162
6304
|
white-space: pre-wrap;
|
|
6163
6305
|
}
|
|
6164
6306
|
|
|
6165
|
-
/* \u9ED8\u8BA4\u53EA\u9732\u4E24\u884C\
|
|
6307
|
+
/* \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
6308
|
\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
6309
|
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
6310
|
\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-
|
|
6311
|
+
.dsh-leader-agent-agent-bubble__content[data-collapsed='true'] {
|
|
6312
|
+
max-height: calc(2 * var(--dsh-leader-agent-bubble-line) + 4px);
|
|
6171
6313
|
overflow: hidden;
|
|
6172
6314
|
}
|
|
6173
6315
|
|
|
6174
|
-
.dsh-leader-agent-
|
|
6316
|
+
.dsh-leader-agent-agent-bubble__toggle {
|
|
6175
6317
|
align-self: flex-start;
|
|
6176
6318
|
padding: 0 2px;
|
|
6177
6319
|
border: none;
|
|
@@ -6183,23 +6325,23 @@ var STYLE_TEXT6 = `
|
|
|
6183
6325
|
cursor: pointer;
|
|
6184
6326
|
}
|
|
6185
6327
|
|
|
6186
|
-
.dsh-leader-agent-
|
|
6328
|
+
.dsh-leader-agent-agent-bubble__toggle:hover {
|
|
6187
6329
|
color: var(--dsw-alias-label-secondary);
|
|
6188
6330
|
}
|
|
6189
6331
|
|
|
6190
|
-
.dsh-leader-agent-
|
|
6332
|
+
.dsh-leader-agent-agent-bubble__meta {
|
|
6191
6333
|
display: flex;
|
|
6192
6334
|
align-items: center;
|
|
6193
6335
|
gap: 6px;
|
|
6194
6336
|
padding-left: 2px;
|
|
6195
6337
|
}
|
|
6196
6338
|
|
|
6197
|
-
.dsh-leader-agent-
|
|
6339
|
+
.dsh-leader-agent-agent-bubble__time {
|
|
6198
6340
|
font-size: 11px;
|
|
6199
6341
|
color: var(--dsw-alias-label-tertiary);
|
|
6200
6342
|
}
|
|
6201
6343
|
|
|
6202
|
-
.dsh-leader-agent-
|
|
6344
|
+
.dsh-leader-agent-agent-bubble__copy {
|
|
6203
6345
|
display: inline-flex;
|
|
6204
6346
|
align-items: center;
|
|
6205
6347
|
justify-content: center;
|
|
@@ -6213,12 +6355,12 @@ var STYLE_TEXT6 = `
|
|
|
6213
6355
|
cursor: pointer;
|
|
6214
6356
|
}
|
|
6215
6357
|
|
|
6216
|
-
.dsh-leader-agent-
|
|
6358
|
+
.dsh-leader-agent-agent-bubble__copy:hover {
|
|
6217
6359
|
background: color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent);
|
|
6218
6360
|
color: var(--dsw-alias-label-secondary);
|
|
6219
6361
|
}
|
|
6220
6362
|
`;
|
|
6221
|
-
function
|
|
6363
|
+
function ensureAgentBubbleStyles() {
|
|
6222
6364
|
if (typeof document === "undefined") return;
|
|
6223
6365
|
if (document.getElementById(STYLE_ID6) !== null) return;
|
|
6224
6366
|
const style = document.createElement("style");
|
|
@@ -6227,8 +6369,8 @@ function ensureWorkerReportStyles() {
|
|
|
6227
6369
|
document.head.append(style);
|
|
6228
6370
|
}
|
|
6229
6371
|
|
|
6230
|
-
// src/client/
|
|
6231
|
-
function
|
|
6372
|
+
// src/client/bubble-clock.js
|
|
6373
|
+
function formatBubbleClock(time) {
|
|
6232
6374
|
const date = new Date(time);
|
|
6233
6375
|
const now = /* @__PURE__ */ new Date();
|
|
6234
6376
|
const clock = `${String(date.getHours()).padStart(2, "0")}:${String(date.getMinutes()).padStart(2, "0")}`;
|
|
@@ -6239,16 +6381,15 @@ function formatReportClock(time) {
|
|
|
6239
6381
|
const md = date.getFullYear() === now.getFullYear() ? day : `${date.getFullYear()}\u5E74${day}`;
|
|
6240
6382
|
return `${md} ${clock}`;
|
|
6241
6383
|
}
|
|
6242
|
-
|
|
6384
|
+
|
|
6385
|
+
// src/client/agent-bubble-view.js
|
|
6386
|
+
function AgentBubble({ name, avatarSeed, openTitle, onOpenName, body, format, time }) {
|
|
6243
6387
|
const [copied, setCopied] = (0, import_react15.useState)(false);
|
|
6244
6388
|
const [expanded, setExpanded] = (0, import_react15.useState)(false);
|
|
6245
6389
|
const [overflowing, setOverflowing] = (0, import_react15.useState)(false);
|
|
6246
6390
|
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
6391
|
(0, import_react15.useLayoutEffect)(() => {
|
|
6251
|
-
|
|
6392
|
+
ensureAgentBubbleStyles();
|
|
6252
6393
|
const element = bubbleRef.current;
|
|
6253
6394
|
if (element === null || expanded) return void 0;
|
|
6254
6395
|
const measure = () => {
|
|
@@ -6260,7 +6401,6 @@ function WorkerReportView({ node, openSession }) {
|
|
|
6260
6401
|
observer.observe(element);
|
|
6261
6402
|
return () => observer.disconnect();
|
|
6262
6403
|
}, [body, expanded]);
|
|
6263
|
-
if (data === void 0) return null;
|
|
6264
6404
|
const copy = async () => {
|
|
6265
6405
|
try {
|
|
6266
6406
|
await navigator.clipboard.writeText(body);
|
|
@@ -6272,44 +6412,44 @@ function WorkerReportView({ node, openSession }) {
|
|
|
6272
6412
|
};
|
|
6273
6413
|
return (0, import_react15.createElement)(
|
|
6274
6414
|
"div",
|
|
6275
|
-
{ className: "dsh-leader-agent-
|
|
6415
|
+
{ className: "dsh-leader-agent-agent-bubble" },
|
|
6276
6416
|
(0, import_react15.createElement)(
|
|
6277
6417
|
"div",
|
|
6278
|
-
{ className: "dsh-leader-agent-
|
|
6418
|
+
{ className: "dsh-leader-agent-agent-bubble__identity" },
|
|
6279
6419
|
(0, import_react15.createElement)("img", {
|
|
6280
|
-
className: "dsh-leader-agent-
|
|
6281
|
-
src: agentAvatarDataUri(
|
|
6420
|
+
className: "dsh-leader-agent-agent-bubble__avatar",
|
|
6421
|
+
src: agentAvatarDataUri(avatarSeed),
|
|
6282
6422
|
alt: ""
|
|
6283
6423
|
}),
|
|
6284
6424
|
(0, import_react15.createElement)(
|
|
6285
6425
|
"button",
|
|
6286
6426
|
{
|
|
6287
6427
|
type: "button",
|
|
6288
|
-
className: "dsh-leader-agent-
|
|
6289
|
-
title:
|
|
6290
|
-
onClick: () =>
|
|
6428
|
+
className: "dsh-leader-agent-agent-bubble__name",
|
|
6429
|
+
title: openTitle,
|
|
6430
|
+
onClick: () => onOpenName?.()
|
|
6291
6431
|
},
|
|
6292
|
-
|
|
6432
|
+
name
|
|
6293
6433
|
)
|
|
6294
6434
|
),
|
|
6295
6435
|
(0, import_react15.createElement)(
|
|
6296
6436
|
"div",
|
|
6297
|
-
{ className: "dsh-leader-agent-
|
|
6437
|
+
{ className: "dsh-leader-agent-agent-bubble__bubble" },
|
|
6298
6438
|
// 裁剪只发生在正文层:按钮在气泡内、正文外,否则展开开关会跟着两行水位被裁掉
|
|
6299
6439
|
(0, import_react15.createElement)(
|
|
6300
6440
|
"div",
|
|
6301
6441
|
{
|
|
6302
6442
|
ref: bubbleRef,
|
|
6303
|
-
className: "dsh-leader-agent-
|
|
6443
|
+
className: "dsh-leader-agent-agent-bubble__content",
|
|
6304
6444
|
"data-collapsed": expanded ? void 0 : "true"
|
|
6305
6445
|
},
|
|
6306
|
-
markdown ? (0, import_react15.createElement)(Markdown, { source: body }) : (0, import_react15.createElement)("div", { className: "dsh-leader-agent-
|
|
6446
|
+
format === "markdown" ? (0, import_react15.createElement)(Markdown, { source: body }) : (0, import_react15.createElement)("div", { className: "dsh-leader-agent-agent-bubble__plain" }, body)
|
|
6307
6447
|
),
|
|
6308
6448
|
overflowing ? (0, import_react15.createElement)(
|
|
6309
6449
|
"button",
|
|
6310
6450
|
{
|
|
6311
6451
|
type: "button",
|
|
6312
|
-
className: "dsh-leader-agent-
|
|
6452
|
+
className: "dsh-leader-agent-agent-bubble__toggle",
|
|
6313
6453
|
"aria-expanded": expanded,
|
|
6314
6454
|
onClick: () => setExpanded((value) => !value)
|
|
6315
6455
|
},
|
|
@@ -6318,13 +6458,218 @@ function WorkerReportView({ node, openSession }) {
|
|
|
6318
6458
|
),
|
|
6319
6459
|
(0, import_react15.createElement)(
|
|
6320
6460
|
"div",
|
|
6321
|
-
{ className: "dsh-leader-agent-
|
|
6322
|
-
(0, import_react15.createElement)("span", { className: "dsh-leader-agent-
|
|
6461
|
+
{ className: "dsh-leader-agent-agent-bubble__meta" },
|
|
6462
|
+
(0, import_react15.createElement)("span", { className: "dsh-leader-agent-agent-bubble__time" }, formatBubbleClock(time)),
|
|
6323
6463
|
(0, import_react15.createElement)(
|
|
6324
6464
|
"button",
|
|
6325
6465
|
{
|
|
6326
6466
|
type: "button",
|
|
6327
|
-
className: "dsh-leader-agent-
|
|
6467
|
+
className: "dsh-leader-agent-agent-bubble__copy",
|
|
6468
|
+
"aria-label": copied ? "\u5DF2\u590D\u5236" : "\u590D\u5236",
|
|
6469
|
+
title: copied ? "\u5DF2\u590D\u5236" : "\u590D\u5236",
|
|
6470
|
+
onClick: () => {
|
|
6471
|
+
void copy();
|
|
6472
|
+
}
|
|
6473
|
+
},
|
|
6474
|
+
productIcon(copied ? "check-outline" : "copy-outline", { size: 14 })
|
|
6475
|
+
)
|
|
6476
|
+
)
|
|
6477
|
+
);
|
|
6478
|
+
}
|
|
6479
|
+
|
|
6480
|
+
// src/client/worker-report-view.js
|
|
6481
|
+
function WorkerReportView({ node, openSession }) {
|
|
6482
|
+
const data = node?.data;
|
|
6483
|
+
if (data === void 0) return null;
|
|
6484
|
+
return (0, import_react16.createElement)(AgentBubble, {
|
|
6485
|
+
name: data.name,
|
|
6486
|
+
avatarSeed: data.name,
|
|
6487
|
+
openTitle: `\u6253\u5F00 ${data.name} \u7684\u5B50\u4F1A\u8BDD`,
|
|
6488
|
+
onOpenName: () => openSession?.(data.childSessionId),
|
|
6489
|
+
// 旧回报缺 report,回退整条通知正文;失败原因与逐行协议字段走纯文本,
|
|
6490
|
+
// 判据见 workerReportFormat。
|
|
6491
|
+
body: workerReportBody(data),
|
|
6492
|
+
format: workerReportFormat(data),
|
|
6493
|
+
time: data.time
|
|
6494
|
+
});
|
|
6495
|
+
}
|
|
6496
|
+
|
|
6497
|
+
// src/shared/worker-task.js
|
|
6498
|
+
var WORKER_TASK_SOURCE_KIND = "dsh-leader-agent/worker-task";
|
|
6499
|
+
function readWorkerTaskSource(source) {
|
|
6500
|
+
if (source === null || typeof source !== "object" || Array.isArray(source)) return null;
|
|
6501
|
+
if (source.kind !== WORKER_TASK_SOURCE_KIND) return null;
|
|
6502
|
+
const parentSessionId = source.parentSessionId;
|
|
6503
|
+
if (typeof parentSessionId !== "string" || parentSessionId === "") return null;
|
|
6504
|
+
return { parentSessionId };
|
|
6505
|
+
}
|
|
6506
|
+
|
|
6507
|
+
// src/client/worker-task-definition.js
|
|
6508
|
+
var WORKER_TASK_NODE_KIND = "dsh-leader-agent-worker-task";
|
|
6509
|
+
var workerTaskDefinition = {
|
|
6510
|
+
kind: WORKER_TASK_NODE_KIND,
|
|
6511
|
+
target: "chat",
|
|
6512
|
+
match: (event) => {
|
|
6513
|
+
if (event.type !== "user/message") return null;
|
|
6514
|
+
if (event.surfaceOp !== "append") return null;
|
|
6515
|
+
if (readWorkerTaskSource(event.data?.source) === null) return null;
|
|
6516
|
+
return { id: String(event.data.id), role: "start", exclusive: true };
|
|
6517
|
+
},
|
|
6518
|
+
start: (_context, match) => {
|
|
6519
|
+
const event = match.event;
|
|
6520
|
+
if (event.type !== "user/message") throw new Error("leader \u4EFB\u52A1 start \u9700\u8981 user/message \u4E8B\u4EF6");
|
|
6521
|
+
const source = readWorkerTaskSource(event.data.source);
|
|
6522
|
+
if (source === null) throw new Error("leader \u4EFB\u52A1 start \u9700\u8981\u5E26 task \u6807\u8BB0\u7684 source");
|
|
6523
|
+
return {
|
|
6524
|
+
seq: event.seq,
|
|
6525
|
+
time: event.time,
|
|
6526
|
+
messageId: String(event.data.id),
|
|
6527
|
+
text: messageText(event.data.content)
|
|
6528
|
+
};
|
|
6529
|
+
},
|
|
6530
|
+
update: (context) => context.state,
|
|
6531
|
+
buildViewNode: (context) => {
|
|
6532
|
+
if (context.state === void 0) return null;
|
|
6533
|
+
const location = context.start?.location ?? { kind: "unresolved" };
|
|
6534
|
+
return {
|
|
6535
|
+
key: context.key,
|
|
6536
|
+
kind: WORKER_TASK_NODE_KIND,
|
|
6537
|
+
id: context.id,
|
|
6538
|
+
target: "chat",
|
|
6539
|
+
anchorSeq: context.state.seq,
|
|
6540
|
+
location,
|
|
6541
|
+
visibility: "visible",
|
|
6542
|
+
// 分组位置与官方一致:回合的首步开启新 exchange,其余留在 input。
|
|
6543
|
+
// 位置不能省——没有它,节点会落进回合的「过程折叠区」被默认隐藏。
|
|
6544
|
+
groupTree: location.kind === "step" && location.step.step === 1 ? "exchange" : "input",
|
|
6545
|
+
data: context.state
|
|
6546
|
+
};
|
|
6547
|
+
}
|
|
6548
|
+
};
|
|
6549
|
+
|
|
6550
|
+
// src/client/worker-task-view.js
|
|
6551
|
+
var import_react17 = require("react");
|
|
6552
|
+
|
|
6553
|
+
// src/client/worker-task-styles.js
|
|
6554
|
+
var STYLE_ID7 = "dsh-leader-agent-worker-task";
|
|
6555
|
+
var STYLE_TEXT7 = `
|
|
6556
|
+
.dsh-leader-agent-worker-task {
|
|
6557
|
+
display: flex;
|
|
6558
|
+
flex-direction: column;
|
|
6559
|
+
align-items: flex-end;
|
|
6560
|
+
gap: 6px;
|
|
6561
|
+
width: 100%;
|
|
6562
|
+
}
|
|
6563
|
+
|
|
6564
|
+
.dsh-leader-agent-worker-task__bubble {
|
|
6565
|
+
box-sizing: border-box;
|
|
6566
|
+
max-width: min(calc(var(--dsh-chat-content-width, 748px) * 0.702), 82%);
|
|
6567
|
+
/* \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
|
|
6568
|
+
\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 */
|
|
6569
|
+
background: var(--dsw-specific-bubble);
|
|
6570
|
+
border: none;
|
|
6571
|
+
border-radius: var(--dsw-radius-xl);
|
|
6572
|
+
padding: 10px 16px;
|
|
6573
|
+
font-size: var(--dsh-content-font-size, 14px);
|
|
6574
|
+
color: var(--dsw-alias-label-primary);
|
|
6575
|
+
word-break: break-word;
|
|
6576
|
+
}
|
|
6577
|
+
|
|
6578
|
+
/* 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
|
|
6579
|
+
\u4E0E card-detail-text \u76F8\u540C\uFF1A\u5BB9\u5668\u7C7B + data-markdown-variant \u662F (0,2,0)\uFF0C\u538B\u8FC7
|
|
6580
|
+
.compact \u7684 (0,1,0)\uFF1B\u94FE\u63A5\u5230 (0,2,1)\uFF0C\u538B\u8FC7 .compact a \u7684 (0,1,1)\u3002 */
|
|
6581
|
+
.dsh-leader-agent-worker-task__bubble [data-markdown-variant='compact'] {
|
|
6582
|
+
color: var(--dsw-alias-label-primary);
|
|
6583
|
+
}
|
|
6584
|
+
|
|
6585
|
+
.dsh-leader-agent-worker-task__bubble [data-markdown-variant='compact'] a {
|
|
6586
|
+
color: var(--dsw-alias-link);
|
|
6587
|
+
}
|
|
6588
|
+
|
|
6589
|
+
.dsh-leader-agent-worker-task__meta {
|
|
6590
|
+
display: flex;
|
|
6591
|
+
align-items: center;
|
|
6592
|
+
gap: 6px;
|
|
6593
|
+
padding-right: 2px;
|
|
6594
|
+
}
|
|
6595
|
+
|
|
6596
|
+
.dsh-leader-agent-worker-task__time {
|
|
6597
|
+
font-size: 11px;
|
|
6598
|
+
color: var(--dsw-alias-label-tertiary);
|
|
6599
|
+
}
|
|
6600
|
+
|
|
6601
|
+
.dsh-leader-agent-worker-task__copy {
|
|
6602
|
+
display: inline-flex;
|
|
6603
|
+
align-items: center;
|
|
6604
|
+
justify-content: center;
|
|
6605
|
+
width: 22px;
|
|
6606
|
+
height: 22px;
|
|
6607
|
+
padding: 0;
|
|
6608
|
+
border: none;
|
|
6609
|
+
border-radius: var(--dsw-radius-sm, 6px);
|
|
6610
|
+
background: none;
|
|
6611
|
+
color: var(--dsw-alias-label-tertiary);
|
|
6612
|
+
cursor: pointer;
|
|
6613
|
+
}
|
|
6614
|
+
|
|
6615
|
+
.dsh-leader-agent-worker-task__copy:hover {
|
|
6616
|
+
background: color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent);
|
|
6617
|
+
color: var(--dsw-alias-label-secondary);
|
|
6618
|
+
}
|
|
6619
|
+
`;
|
|
6620
|
+
function ensureWorkerTaskStyles() {
|
|
6621
|
+
if (typeof document === "undefined") return;
|
|
6622
|
+
if (document.getElementById(STYLE_ID7) !== null) return;
|
|
6623
|
+
const style = document.createElement("style");
|
|
6624
|
+
style.id = STYLE_ID7;
|
|
6625
|
+
style.textContent = STYLE_TEXT7;
|
|
6626
|
+
document.head.append(style);
|
|
6627
|
+
}
|
|
6628
|
+
|
|
6629
|
+
// src/client/worker-task-view.js
|
|
6630
|
+
function WorkerTaskView({ node }) {
|
|
6631
|
+
const data = node?.data;
|
|
6632
|
+
const [copied, setCopied] = (0, import_react17.useState)(false);
|
|
6633
|
+
(0, import_react17.useLayoutEffect)(() => {
|
|
6634
|
+
ensureWorkerTaskStyles();
|
|
6635
|
+
}, []);
|
|
6636
|
+
if (data === void 0) return null;
|
|
6637
|
+
const body = typeof data.text === "string" ? data.text : "";
|
|
6638
|
+
const copy = async () => {
|
|
6639
|
+
try {
|
|
6640
|
+
await navigator.clipboard.writeText(body);
|
|
6641
|
+
} catch {
|
|
6642
|
+
return;
|
|
6643
|
+
}
|
|
6644
|
+
setCopied(true);
|
|
6645
|
+
setTimeout(() => setCopied(false), 1500);
|
|
6646
|
+
};
|
|
6647
|
+
return (0, import_react17.createElement)(
|
|
6648
|
+
"div",
|
|
6649
|
+
{ className: "dsh-leader-agent-worker-task" },
|
|
6650
|
+
(0, import_react17.createElement)(
|
|
6651
|
+
"div",
|
|
6652
|
+
{
|
|
6653
|
+
className: "dsh-leader-agent-worker-task__bubble",
|
|
6654
|
+
// 与宿主用户气泡同一标记,便于界面侧把这块内容当消息正文处理。
|
|
6655
|
+
"data-message-bubble": "",
|
|
6656
|
+
// 形态与用户自己的消息一样,只能靠内容判断来源;这两条只做悬停与读屏提示。
|
|
6657
|
+
title: "Leader \u6D3E\u53D1\u7684\u4EFB\u52A1",
|
|
6658
|
+
"aria-label": "Leader \u6D3E\u53D1\u7684\u4EFB\u52A1"
|
|
6659
|
+
},
|
|
6660
|
+
// 与 assistant 内容同套 Markdown:原文直接交给基线 MarkdownText,不补硬换行、
|
|
6661
|
+
// 不做行级改写;单换行按 Markdown 合并。
|
|
6662
|
+
(0, import_react17.createElement)(Markdown, { source: body, variant: "compact" })
|
|
6663
|
+
),
|
|
6664
|
+
(0, import_react17.createElement)(
|
|
6665
|
+
"div",
|
|
6666
|
+
{ className: "dsh-leader-agent-worker-task__meta" },
|
|
6667
|
+
(0, import_react17.createElement)("span", { className: "dsh-leader-agent-worker-task__time" }, formatBubbleClock(data.time)),
|
|
6668
|
+
(0, import_react17.createElement)(
|
|
6669
|
+
"button",
|
|
6670
|
+
{
|
|
6671
|
+
type: "button",
|
|
6672
|
+
className: "dsh-leader-agent-worker-task__copy",
|
|
6328
6673
|
"aria-label": copied ? "\u5DF2\u590D\u5236" : "\u590D\u5236",
|
|
6329
6674
|
title: copied ? "\u5DF2\u590D\u5236" : "\u590D\u5236",
|
|
6330
6675
|
onClick: () => {
|
|
@@ -6401,7 +6746,7 @@ function apply(ctx) {
|
|
|
6401
6746
|
ctx.inject(["uiConversation"], function mountLeaderViewFiber(conversationCtx) {
|
|
6402
6747
|
mountLeaderView(conversationCtx);
|
|
6403
6748
|
mountGuideCard(conversationCtx);
|
|
6404
|
-
|
|
6749
|
+
mountMessageBubbles(conversationCtx);
|
|
6405
6750
|
});
|
|
6406
6751
|
ctx.inject(["remote"], function mountProjectChannel(remoteCtx) {
|
|
6407
6752
|
void mountProjectRemote(remoteCtx).catch((error) => {
|
|
@@ -6428,22 +6773,28 @@ function mountBoardMonitor(ctx) {
|
|
|
6428
6773
|
});
|
|
6429
6774
|
ctx.effect(() => stop, "dsh-leader-agent \u770B\u677F\u76D1\u89C6\u5668");
|
|
6430
6775
|
}
|
|
6431
|
-
function
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6776
|
+
function mountMessageBubbles(ctx) {
|
|
6777
|
+
const bubbles = [
|
|
6778
|
+
{ kind: WORKER_TASK_NODE_KIND, definition: workerTaskDefinition, view: WorkerTaskView, label: "leader \u4EFB\u52A1" },
|
|
6779
|
+
{ kind: WORKER_REPORT_NODE_KIND, definition: workerReportDefinition, view: WorkerReportView, label: "worker \u56DE\u62A5" }
|
|
6780
|
+
];
|
|
6781
|
+
for (const bubble of bubbles) {
|
|
6782
|
+
try {
|
|
6783
|
+
ctx.uiConversation.events.register(bubble.definition);
|
|
6784
|
+
} catch (error) {
|
|
6785
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6786
|
+
ctx.logger?.error?.(`dsh-leader-agent: ${bubble.label}\u8282\u70B9\u6CE8\u518C\u5931\u8D25\uFF1A${message}`);
|
|
6787
|
+
continue;
|
|
6788
|
+
}
|
|
6789
|
+
ctx.effect(() => ctx.slots.inject("conversation.chat.node", () => ctx.slots.register({
|
|
6790
|
+
name: "conversation.chat.node",
|
|
6791
|
+
key: bubble.kind,
|
|
6792
|
+
// `uiWorkspace` 只挂在 web-app bundle 上,写进 inject 的服务缺失会让整个插件
|
|
6793
|
+
// 挂起——惰性获取,点击名字时才取。
|
|
6794
|
+
inject: () => ({
|
|
6795
|
+
openSession: (sessionId) => ctx.get("uiWorkspace")?.openSession(sessionId)
|
|
6796
|
+
})
|
|
6797
|
+
}, bubble.view)), `dsh-leader-agent ${bubble.label}\u6E32\u67D3\u5668`);
|
|
6438
6798
|
}
|
|
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
6799
|
}
|
|
6449
6800
|
return module.exports; } });
|