dsh-bufeng 0.0.0-stage → 0.64.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/LICENSE +21 -0
- package/README.md +68 -2
- package/bufeng.patch.yml +3 -0
- package/client/build-client.mjs +159 -0
- package/client/client.js +4038 -0
- package/client/src/board.js +133 -0
- package/client/src/capabilities.js +787 -0
- package/client/src/cards.js +263 -0
- package/client/src/data.js +43 -0
- package/client/src/graph.js +558 -0
- package/client/src/icons.js +88 -0
- package/client/src/projects.js +467 -0
- package/client/src/prompt.js +55 -0
- package/client/src/react.js +7 -0
- package/client/src/settings.js +407 -0
- package/client/src/styles.js +611 -0
- package/client/src/taskboard.js +321 -0
- package/client/src/taskgraph.js +145 -0
- package/client/src/ui.js +72 -0
- package/lib/acceptance-subject.js +71 -0
- package/lib/board/server.js +546 -0
- package/lib/board/snapshot.js +133 -0
- package/lib/board/taskview.js +151 -0
- package/lib/bootstrap.js +77 -0
- package/lib/catalog.js +385 -0
- package/lib/core.js +478 -0
- package/lib/data/capability-alias-catalog.json +301 -0
- package/lib/data/capability-alias.json +25 -0
- package/lib/domain.js +1342 -0
- package/lib/host-probe.js +176 -0
- package/lib/identity-hook.js +490 -0
- package/lib/index.js +119 -0
- package/lib/lessons.js +134 -0
- package/lib/metering.js +109 -0
- package/lib/scope.js +389 -0
- package/lib/session/child-watch.js +86 -0
- package/lib/session/evidence.js +118 -0
- package/lib/session/node-session.js +335 -0
- package/lib/session/queue.js +307 -0
- package/lib/session/reconcile.js +500 -0
- package/lib/tools/capabilities.js +1461 -0
- package/lib/tools/governance.js +579 -0
- package/lib/tools/index.js +33 -0
- package/lib/tools/project.js +500 -0
- package/lib/tools/readonly.js +566 -0
- package/lib/tools/recover.js +402 -0
- package/lib/tools/run.js +1609 -0
- package/lib/tools/skills.js +162 -0
- package/lib/tools/trees.js +637 -0
- package/lib/workspace-rmw.js +365 -0
- package/package.json +42 -4
package/client/client.js
ADDED
|
@@ -0,0 +1,4038 @@
|
|
|
1
|
+
// @generated by client/build-client.mjs —— 源码在 client/src/(显式 import/export),改源码后重新构建,勿直接改本文件
|
|
2
|
+
window.__ModuleLoader__.load({ id: "dsh-bufeng", factory: (require) => {
|
|
3
|
+
const __mods = {};
|
|
4
|
+
/* ============================== src/react.js ============================== */
|
|
5
|
+
__mods["react.js"] = (() => {
|
|
6
|
+
/**
|
|
7
|
+
* client/src/react.js — 宿主 react 桥。
|
|
8
|
+
* bundle 内唯一 require("react") 的模块;其余模块一律 import { h, ... } from './react.js'。
|
|
9
|
+
*/
|
|
10
|
+
const { createElement: h, useState, useEffect, useRef, useMemo, useCallback } = require("react");
|
|
11
|
+
return { h, useState, useEffect, useRef, useMemo, useCallback };
|
|
12
|
+
})();
|
|
13
|
+
/* ============================== src/styles.js ============================== */
|
|
14
|
+
__mods["styles.js"] = (() => {
|
|
15
|
+
const { h, useState } = __mods["react.js"];
|
|
16
|
+
/**
|
|
17
|
+
* client/src/styles.js — 视觉样式(v0.9.0 语言对齐 better-sidebar 任务管理模块)与 <style> 单次注入。
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
const BF_CSS = `
|
|
22
|
+
.bf-root { font-size: 12px; }
|
|
23
|
+
/* v0.40.8 阶段1:.bf-card 改 position:relative——作 .bf-corner(卡角「✕ 退役」)的定位祖先 */
|
|
24
|
+
.bf-card { position: relative; border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.25)); border-radius: 8px;
|
|
25
|
+
background: var(--dsw-alias-bg-layer-1, rgba(128,128,128,0.08)); overflow: hidden; transition: border-color .15s; }
|
|
26
|
+
.bf-card:hover { background: var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,0.12)); }
|
|
27
|
+
.bf-card[data-accent="1"] { border-color: color-mix(in srgb, var(--dsw-alias-state-business-primary, #4f7cf0) 45%, transparent); }
|
|
28
|
+
.bf-card[data-error="1"] { border-color: var(--dsw-alias-state-error-primary, #e5484d); }
|
|
29
|
+
.bf-settled { opacity: .62; }
|
|
30
|
+
/* 深度色带:身份段背景按树深度混入强调色(9/7/5/3.5%,照搬 better-sidebar depth0-3) */
|
|
31
|
+
.bf-top { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px 5px; min-width: 0;
|
|
32
|
+
background: color-mix(in srgb, var(--dsw-alias-state-business-primary, #4f7cf0) var(--bf-tint, 6%), var(--dsw-alias-bg-layer-1, rgba(128,128,128,0.08))); }
|
|
33
|
+
.bf-d0 { --bf-tint: 9%; } .bf-d1 { --bf-tint: 7%; } .bf-d2 { --bf-tint: 5%; }
|
|
34
|
+
.bf-badges { display: flex; align-items: center; gap: 4px; min-width: 0; flex-wrap: wrap; }
|
|
35
|
+
.bf-kind { flex: none; padding: 0 4px; border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.3));
|
|
36
|
+
border-radius: 2px; font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-secondary, #999); white-space: nowrap; }
|
|
37
|
+
.bf-name { font: var(--dsw-font-xxs-strong-12, 600 12px/1.45 sans-serif); color: var(--dsw-alias-label-primary, #eee);
|
|
38
|
+
white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
39
|
+
.bf-meta { font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); font-family: var(--ds-font-family-code, monospace);
|
|
40
|
+
color: var(--dsw-alias-label-secondary, #999); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
41
|
+
/* 状态条:22px,状态点+状态词+活动行;运行中一条光带左→右扫过(1.5s,前 2/3 行进后 1/3 停顿) */
|
|
42
|
+
.bf-bar { position: relative; display: flex; align-items: center; gap: 5px; height: 22px; padding: 0 6px 0 8px;
|
|
43
|
+
border-top: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.25));
|
|
44
|
+
background: var(--dsw-alias-bg-base, rgba(128,128,128,0.05));
|
|
45
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-secondary, #999); overflow: hidden; }
|
|
46
|
+
.bf-bar[data-running="true"]::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 100%;
|
|
47
|
+
background-image: linear-gradient(90deg, transparent 0%,
|
|
48
|
+
color-mix(in srgb, var(--dsw-alias-state-business-primary, #4f7cf0) 18%, transparent) 50%, transparent 100%);
|
|
49
|
+
transform: translateX(-100%); animation: bf-sweep 1.5s cubic-bezier(.33, 0, .67, 1) infinite; pointer-events: none; }
|
|
50
|
+
@keyframes bf-sweep { 0% { transform: translateX(-100%); } 66.6667%, 100% { transform: translateX(100%); } }
|
|
51
|
+
@media (prefers-reduced-motion: reduce) { .bf-bar[data-running="true"]::after { animation: none; opacity: 0; } }
|
|
52
|
+
.bf-act { flex: 1; min-width: 0; color: var(--dsw-alias-state-business-primary, #4f7cf0);
|
|
53
|
+
white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
54
|
+
.bf-dot { width: 7px; height: 7px; border-radius: 999px; flex: none; }
|
|
55
|
+
.bf-badge { flex: none; max-width: 62%; padding: 0 4px; border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.3));
|
|
56
|
+
border-radius: 2px; font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-secondary, #999);
|
|
57
|
+
white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
58
|
+
.bf-badge[data-tone="accent"] { color: var(--dsw-alias-state-business-primary, #4f7cf0);
|
|
59
|
+
border-color: color-mix(in srgb, var(--dsw-alias-state-business-primary, #4f7cf0) 45%, transparent); }
|
|
60
|
+
.bf-badge[data-tone="purple"] { color: var(--dsw-alias-label-primary-bluish, #b19cf7);
|
|
61
|
+
border-color: color-mix(in srgb, var(--dsw-alias-label-primary-bluish, #b19cf7) 40%, transparent); }
|
|
62
|
+
.bf-badge[data-tone="ok"] { color: var(--dsw-alias-state-success-primary, #2f9e44);
|
|
63
|
+
border-color: color-mix(in srgb, var(--dsw-alias-state-success-primary, #2f9e44) 45%, transparent); }
|
|
64
|
+
.bf-badge[data-tone="warn"] { color: var(--dsw-alias-state-warn-label, #d8a516);
|
|
65
|
+
border-color: color-mix(in srgb, var(--dsw-alias-state-warn-label, #d8a516) 45%, transparent); }
|
|
66
|
+
.bf-fold { flex: none; display: inline-flex; align-items: center; gap: 3px; margin-left: auto; padding: 1px 5px;
|
|
67
|
+
border: none; background: none; color: var(--dsw-alias-label-secondary, #999);
|
|
68
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); cursor: pointer; border-radius: 4px; }
|
|
69
|
+
.bf-fold:hover { background: var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,0.15)); color: var(--dsw-alias-label-primary, #eee); }
|
|
70
|
+
.bf-twig { display: flex; align-items: stretch; margin: 6px 0; }
|
|
71
|
+
.bf-twig-rail { width: 18px; flex: none; position: relative; }
|
|
72
|
+
.bf-twig-rail::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 1px;
|
|
73
|
+
background: var(--dsw-alias-border-l2, rgba(128,128,128,0.25)); }
|
|
74
|
+
.bf-twig-rail::after { content: ""; position: absolute; left: 0; top: 17px; width: 16px; height: 1px;
|
|
75
|
+
background: var(--dsw-alias-border-l2, rgba(128,128,128,0.25)); }
|
|
76
|
+
/* ---------- v0.10.0 图画布(TasksGraph 同款交互);v0.13.1 flex:1 吃满剩余高度(tab 化后画布吃满 tab 下方空间,消除底部空白);
|
|
77
|
+
* v0.27.1 缺陷3:min-height 440→320——窄面板下画布框高于可视区曾把单行内容沉到下沿、上方留大片空白 ---------- */
|
|
78
|
+
.bf-graph { position: relative; flex: 1; min-height: 320px; width: 100%;
|
|
79
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.25)); border-radius: 8px; overflow: hidden;
|
|
80
|
+
background-color: var(--dsw-alias-bg-base, rgba(128,128,128,0.04));
|
|
81
|
+
background-image: radial-gradient(color-mix(in srgb, var(--dsw-alias-border-l2, #888) 55%, transparent) 1px, transparent 1px);
|
|
82
|
+
background-size: 22px 22px; user-select: none; }
|
|
83
|
+
.bf-graph[data-dragging="true"] { cursor: grabbing; }
|
|
84
|
+
.bf-canvas-inner { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
|
|
85
|
+
.bf-edges { position: absolute; top: 0; left: 0; pointer-events: none; }
|
|
86
|
+
.bf-edge { fill: none; stroke: var(--dsw-alias-border-l2, rgba(128,128,128,0.4)); stroke-width: 1.2; }
|
|
87
|
+
.bf-gnode { position: absolute; cursor: default; }
|
|
88
|
+
.bf-gnode > .bf-card { display: flex; flex-direction: column; min-height: 92px; }
|
|
89
|
+
.bf-gnode > .bf-card > .bf-bar { margin-top: auto; }
|
|
90
|
+
.bf-controls { position: absolute; right: 10px; bottom: 10px; display: flex; align-items: center; gap: 6px;
|
|
91
|
+
padding: 4px 6px; border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.3)); border-radius: 8px;
|
|
92
|
+
background: color-mix(in srgb, var(--dsw-alias-bg-layer-1, #222) 88%, transparent);
|
|
93
|
+
backdrop-filter: blur(4px); z-index: 5; }
|
|
94
|
+
.bf-ctl { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 24px; height: 24px;
|
|
95
|
+
padding: 0 6px; border: none; border-radius: 5px; background: none; cursor: pointer;
|
|
96
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-secondary, #999); }
|
|
97
|
+
.bf-ctl:hover { background: var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,0.15)); color: var(--dsw-alias-label-primary, #eee); }
|
|
98
|
+
.bf-zoomlv { min-width: 34px; text-align: center; font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif);
|
|
99
|
+
color: var(--dsw-alias-label-secondary, #999); }
|
|
100
|
+
.bf-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
|
|
101
|
+
color: var(--dsw-alias-label-secondary, #999); font-size: 12px; pointer-events: none; }
|
|
102
|
+
/* ---------- v0.24.1-B 节点卡模型配置;v0.40.8 阶段1:弹窗「节点操作」退役,配置入口落回地图卡——
|
|
103
|
+
* provider/model/reasoningEffort 三级联动直选(.bf-mrow),块铬(边+底)整体挂在 .bf-modelhost;
|
|
104
|
+
* min-height:57 让有/无强度行的卡等高(盒高 graph.js GH=146 对齐实际卡高,连线不漂);
|
|
105
|
+
* .bf-card 已改 position:relative 作 .bf-corner 定位祖先(弹层 absolute 形态随 ModelCtl 退役删除)。 */
|
|
106
|
+
.bf-modelhost { display: block; min-height: 57px; box-sizing: border-box; padding: 4px 6px 5px;
|
|
107
|
+
border-top: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.25));
|
|
108
|
+
background: var(--dsw-alias-bg-base, rgba(128,128,128,0.05)); }
|
|
109
|
+
.bf-model { display: flex; align-items: center; gap: 4px;
|
|
110
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-secondary, #999); }
|
|
111
|
+
/* ---------- EquipBadge 行铬组件化(伞单 k-mvyluch5055 契约 tmp/k-mvyluch5055/contract-cap-classes.md):
|
|
112
|
+
* capabilities.js 内联行铬/钮铬双对象退役,值逐项同值迁移(零视觉回归);k-mvf8hfi706c 止血史实(客户环境
|
|
113
|
+
* 样式表尾部规则失活→内联兜底)的根因破形态残行已随本批修复(尾部 .bf-equipview 列形态双 booking+悬空残行
|
|
114
|
+
* 两行退役)。.bf-eqbadge-btn 落位保持 .bf-ctl 之后(同特异性后到胜出,height/padding/justify-content 压过
|
|
115
|
+
* .bf-ctl 中值);元素类名仍带 bf-equipview/bf-equipbtn:图谱隐藏通道 .bf-gnode .bf-equipview 照常命中 ---------- */
|
|
116
|
+
.bf-eqbadge-row { display: flex; align-items: center; padding: 0 6px; height: 20px;
|
|
117
|
+
border-top: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.25));
|
|
118
|
+
background: var(--dsw-alias-bg-base, rgba(128,128,128,0.05)); }
|
|
119
|
+
.bf-eqbadge-btn { height: 16px; padding: 0 5px; justify-content: flex-start; min-width: 0; }
|
|
120
|
+
.bf-model-main { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
121
|
+
/* v0.40.8 阶段1:直配三级联动行(provider+model 同排、强度满排)与提示尾行(错误/成功/不可用源) */
|
|
122
|
+
.bf-mrow { display: flex; align-items: center; gap: 4px; }
|
|
123
|
+
.bf-mrow + .bf-mrow, .bf-mtail { margin-top: 4px; }
|
|
124
|
+
.bf-mrow .bf-model-sel { width: auto; flex: 1; min-width: 0; }
|
|
125
|
+
.bf-model-sel { width: 100%; height: 22px; box-sizing: border-box; padding: 0 4px;
|
|
126
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.3)); border-radius: 5px;
|
|
127
|
+
background: var(--dsw-alias-bg-base, rgba(128,128,128,0.06)); color: var(--dsw-alias-label-primary, #eee);
|
|
128
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); }
|
|
129
|
+
.bf-model-msg { font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif);
|
|
130
|
+
white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
131
|
+
/* v0.40.8 阶段1:卡角「✕ 退役」——absolute 右上角,紧凑形态;身份段让位防压(窄卡不重叠) */
|
|
132
|
+
.bf-corner { position: absolute; top: 3px; right: 4px; z-index: 6; display: flex; }
|
|
133
|
+
.bf-corner + .bf-top { padding-right: 54px; }
|
|
134
|
+
.bf-corner .bf-retire { height: 18px; padding: 0 5px; }
|
|
135
|
+
/* ---------- 概览使用概览条(批2):智能体在岗 + 任务统计 + 日预算 ---------- */
|
|
136
|
+
.bf-usage { display: flex; flex-direction: column; gap: 2px; flex: none; padding: 7px 10px 6px;
|
|
137
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.25)); border-radius: 9px;
|
|
138
|
+
background: var(--dsw-alias-bg-layer-1, rgba(128,128,128,0.06)); }
|
|
139
|
+
.bf-usage-row { display: flex; align-items: center; gap: 10px; min-height: 19px; flex-wrap: wrap; }
|
|
140
|
+
.bf-usage-2 { gap: 12px; }
|
|
141
|
+
.bf-u-kicker { font: 600 10px/1.4 var(--dsw-font-sans, sans-serif); letter-spacing: .08em;
|
|
142
|
+
color: var(--dsw-alias-label-secondary, #999); }
|
|
143
|
+
.bf-u-kicker2 { font: 9px/1.4 var(--dsw-font-sans, sans-serif); letter-spacing: .08em;
|
|
144
|
+
color: var(--dsw-alias-label-secondary, #999); }
|
|
145
|
+
.bf-u-chip { font: 10px/1.4 var(--dsw-font-mono, monospace); color: var(--dsw-alias-label-primary, #ddd);
|
|
146
|
+
padding: 1px 7px; border-radius: 5px; background: var(--dsw-alias-bg-base, rgba(128,128,128,0.1)); }
|
|
147
|
+
.bf-sp { flex: 1; }
|
|
148
|
+
.bf-u-budget { display: flex; align-items: center; gap: 5px; font: 9.5px/1.4 var(--dsw-font-sans, sans-serif);
|
|
149
|
+
color: var(--dsw-alias-label-secondary, #999); }
|
|
150
|
+
.bf-u-bar { width: 74px; height: 4px; border-radius: 99px; overflow: hidden;
|
|
151
|
+
background: var(--dsw-alias-border-l2, rgba(128,128,128,0.25)); }
|
|
152
|
+
.bf-u-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #4f7cf0, #7ea2ff); }
|
|
153
|
+
.bf-u-budget b { color: var(--dsw-alias-label-primary, #ddd); font-weight: 600; }
|
|
154
|
+
.bf-u-stat { display: flex; align-items: baseline; gap: 4px; font: 9.5px/1.4 var(--dsw-font-sans, sans-serif);
|
|
155
|
+
color: var(--dsw-alias-label-secondary, #999); }
|
|
156
|
+
.bf-u-stat b { font-size: 15px; font-weight: 650; color: var(--dsw-alias-label-primary, #eee); letter-spacing: .2px; }
|
|
157
|
+
.bf-u-dot { width: 5px; height: 5px; border-radius: 50%; flex: none; align-self: center; }
|
|
158
|
+
.bf-u-dot.run { background: #5b8def; } .bf-u-dot.idle { background: #8b949e; }
|
|
159
|
+
.bf-u-dot.paused { background: #d8a516; } .bf-u-dot.task { background: #5b8def; }
|
|
160
|
+
.bf-u-dot.q { background: #d8a516; } .bf-u-dot.over { background: #e5484d; }
|
|
161
|
+
.bf-u-dot.done { background: #2f9e44; }
|
|
162
|
+
.bf-u-total { font: 9px/1.4 var(--dsw-font-sans, sans-serif); color: var(--dsw-alias-label-secondary, #999); }
|
|
163
|
+
|
|
164
|
+
/* ---------- v0.25 批2-T4 任务看板 tab:概览统计条/工具行/链路分组/关系行/分页 ---------- */
|
|
165
|
+
.bf-tb-stats { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 10px;
|
|
166
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.25)); border-radius: 8px;
|
|
167
|
+
background: var(--dsw-alias-bg-layer-1, rgba(128,128,128,0.08)); flex: none; }
|
|
168
|
+
.bf-tb-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; width: 100%; }
|
|
169
|
+
.bf-tb-chain { display: flex; align-items: center; gap: 6px; padding: 5px 10px;
|
|
170
|
+
border-bottom: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.25));
|
|
171
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif);
|
|
172
|
+
color: var(--dsw-alias-label-primary-bluish, #b19cf7);
|
|
173
|
+
background: color-mix(in srgb, var(--dsw-alias-label-primary-bluish, #b19cf7) 5%, transparent); }
|
|
174
|
+
.bf-tb-task { display: flex; flex-direction: column; gap: 2px; padding: 5px 10px 6px; min-width: 0;
|
|
175
|
+
border-bottom: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.18)); }
|
|
176
|
+
.bf-tb-task:last-child { border-bottom: none; }
|
|
177
|
+
.bf-tb-head { display: flex; align-items: baseline; gap: 6px; min-width: 0; flex-wrap: wrap; }
|
|
178
|
+
.bf-tb-title { font: var(--dsw-font-xxs-strong-12, 600 12px/1.45 sans-serif);
|
|
179
|
+
color: var(--dsw-alias-label-primary, #eee); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
180
|
+
.bf-tb-title[data-hot="true"] { color: var(--dsw-alias-state-business-primary, #4f7cf0); }
|
|
181
|
+
.bf-tb-rel { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
|
|
182
|
+
.bf-tb-exec { display: inline-flex; align-items: center; gap: 4px; min-width: 0;
|
|
183
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-secondary, #999);
|
|
184
|
+
white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
185
|
+
.bf-tb-proj { display: inline-flex; align-items: center; gap: 3px; min-width: 0; color: var(--dsw-alias-label-secondary, #999);
|
|
186
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
187
|
+
.bf-tb-sub { font-family: var(--ds-font-family-code, monospace); font-size: 11px;
|
|
188
|
+
color: var(--dsw-alias-label-secondary, #999); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
189
|
+
.bf-tb-list { flex: 1; min-height: 0; overflow: auto; padding-right: 2px; }
|
|
190
|
+
.bf-tb-pager { display: flex; align-items: center; gap: 8px; justify-content: center; width: 100%; }
|
|
191
|
+
/* ---------- v0.40.0 四 tab P0:任务看板双栏 / 链路图 / 提示词装配 ---------- */
|
|
192
|
+
.bf-tb-split { display: flex; align-items: stretch; gap: 10px; width: 100%; flex: 1; min-height: 0; }
|
|
193
|
+
.bf-tb-rail { width: 380px; flex: none; display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 0; max-height: calc(100vh - 300px);
|
|
194
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.18)); border-radius: 8px; overflow: hidden;
|
|
195
|
+
background: var(--dsw-alias-bg-base, rgba(128,128,128,0.04)); }
|
|
196
|
+
.bf-tb-main { flex: 1; min-width: 0; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
|
|
197
|
+
.bf-tb-group { display: flex; flex-direction: column; min-width: 0; }
|
|
198
|
+
.bf-tb-task { cursor: pointer; transition: background .12s; }
|
|
199
|
+
.bf-tb-task:hover { background: var(--dsw-alias-bg-layer-1, rgba(128,128,128,0.08)); }
|
|
200
|
+
.bf-tb-task.bf-on { background: transparent;
|
|
201
|
+
box-shadow: inset 3px 0 0 var(--dsw-alias-state-business-primary, #4f7cf0); }
|
|
202
|
+
.bf-tb-detail { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
|
|
203
|
+
.bf-tb-dhead { display: flex; align-items: center; gap: 7px; min-width: 0; flex-wrap: wrap; }
|
|
204
|
+
.bf-tb-dtitle { font: var(--dsw-font-xs-strong-13, 600 13px/1.5 sans-serif); color: var(--dsw-alias-label-primary, #eee);
|
|
205
|
+
white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
206
|
+
.bf-tb-dmeta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif);
|
|
207
|
+
color: var(--dsw-alias-label-secondary, #999); }
|
|
208
|
+
.bf-tb-subnav { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.18));
|
|
209
|
+
padding-bottom: 5px; }
|
|
210
|
+
.bf-tbsub { border: 1px solid transparent; background: transparent; color: var(--dsw-alias-label-secondary, #999); cursor: pointer;
|
|
211
|
+
border-radius: 5px; padding: 3px 8px; font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); }
|
|
212
|
+
.bf-tbsub:hover { color: var(--dsw-alias-label-primary, #eee); }
|
|
213
|
+
.bf-tbsub.bf-on { color: var(--dsw-alias-state-business-primary, #4f7cf0);
|
|
214
|
+
border-color: color-mix(in srgb, var(--dsw-alias-state-business-primary, #4f7cf0) 45%, transparent);
|
|
215
|
+
background: color-mix(in srgb, var(--dsw-alias-state-business-primary, #4f7cf0) 10%, transparent); }
|
|
216
|
+
.bf-chain-wrap { border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.18)); border-radius: 8px; padding: 7px 9px 4px;
|
|
217
|
+
background: var(--dsw-alias-bg-base, rgba(128,128,128,0.04)); overflow-x: auto; }
|
|
218
|
+
.bf-chain-h { display: flex; align-items: baseline; gap: 8px; font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif);
|
|
219
|
+
color: var(--dsw-alias-label-secondary, #999); }
|
|
220
|
+
.bf-chain-h b { color: var(--dsw-alias-label-primary, #eee); font-size: 12px; }
|
|
221
|
+
.bf-chain-miss { color: var(--dsw-alias-state-warning-primary, #d8a516); }
|
|
222
|
+
.bf-chaingraph { position: relative; margin-top: 4px; border-radius: 6px; max-width: 100%; overflow: auto;
|
|
223
|
+
background: radial-gradient(circle at 30% 20%, rgba(79,124,240,0.07), transparent 60%); }
|
|
224
|
+
.bf-chainedges { position: absolute; inset: 0; pointer-events: none; }
|
|
225
|
+
.bf-cnode { position: absolute; width: 150px; height: 76px; box-sizing: border-box; padding: 6px 8px; cursor: pointer;
|
|
226
|
+
display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.4));
|
|
227
|
+
border-radius: 7px; background: var(--dsw-alias-bg-layer-1, #1f1f1f); overflow: hidden; }
|
|
228
|
+
.bf-cnode:hover { border-color: color-mix(in srgb, var(--dsw-alias-state-business-primary, #4f7cf0) 55%, transparent); }
|
|
229
|
+
.bf-cnode.bf-on { border-color: var(--dsw-alias-state-business-primary, #4f7cf0);
|
|
230
|
+
box-shadow: 0 0 0 1px color-mix(in srgb, var(--dsw-alias-state-business-primary, #4f7cf0) 55%, transparent); }
|
|
231
|
+
.bf-cnode-top { display: flex; align-items: center; gap: 4px; min-width: 0; }
|
|
232
|
+
.bf-cnode-st { font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-secondary, #999); }
|
|
233
|
+
.bf-cnode-dur { margin-left: auto; font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-secondary, #999); }
|
|
234
|
+
.bf-cnode-title { font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-primary, #eee);
|
|
235
|
+
line-height: 1.35; max-height: 30px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
|
|
236
|
+
.bf-cnode-meta { font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-tertiary, #777);
|
|
237
|
+
white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
238
|
+
.bf-cnode-cur { position: absolute; right: 5px; bottom: 4px; font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif);
|
|
239
|
+
color: var(--dsw-alias-state-business-primary, #4f7cf0); }
|
|
240
|
+
.bf-dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
|
|
241
|
+
.bf-dcard { border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.18)); border-radius: 8px; padding: 7px 9px;
|
|
242
|
+
background: var(--dsw-alias-bg-base, rgba(128,128,128,0.04)); min-width: 0; }
|
|
243
|
+
.bf-dcard-h { display: flex; align-items: center; gap: 6px; margin-bottom: 4px;
|
|
244
|
+
font: var(--dsw-font-xxs-strong-12, 600 12px/1.45 sans-serif); color: var(--dsw-alias-label-primary, #eee); }
|
|
245
|
+
.bf-pre { margin: 0; font-family: var(--ds-font-family-code, monospace); font-size: 11px; line-height: 1.6;
|
|
246
|
+
white-space: pre-wrap; word-break: break-word; color: var(--dsw-alias-label-secondary, #999);
|
|
247
|
+
max-height: 132px; overflow: auto; }
|
|
248
|
+
.bf-pre.bf-open { max-height: none; }
|
|
249
|
+
.bf-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
|
|
250
|
+
.bf-fchip { font-family: var(--ds-font-family-code, monospace); font-size: 10px; color: var(--dsw-alias-label-secondary, #999);
|
|
251
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.24)); border-radius: 4px; padding: 1px 5px;
|
|
252
|
+
background: var(--dsw-alias-bg-layer-1, rgba(128,128,128,0.06)); }
|
|
253
|
+
.bf-tp { display: flex; flex-direction: column; gap: 5px; }
|
|
254
|
+
.bf-tp-head { display: flex; align-items: baseline; gap: 8px; font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif);
|
|
255
|
+
color: var(--dsw-alias-label-secondary, #999); }
|
|
256
|
+
.bf-tp-head b { color: var(--dsw-alias-label-primary, #eee); font-size: 12px; }
|
|
257
|
+
.bf-tp-seg { display: flex; gap: 7px; padding: 6px 8px; border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.18));
|
|
258
|
+
border-radius: 7px; background: var(--dsw-alias-bg-base, rgba(128,128,128,0.04)); }
|
|
259
|
+
.bf-tp-idx { flex: none; width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
|
|
260
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-secondary, #999);
|
|
261
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.3)); }
|
|
262
|
+
.bf-tp-body { flex: 1; min-width: 0; }
|
|
263
|
+
.bf-tp-segtitle { display: flex; align-items: baseline; gap: 5px; font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif);
|
|
264
|
+
color: var(--dsw-alias-label-primary, #eee); margin-bottom: 2px; }
|
|
265
|
+
.bf-tp-layer { color: var(--dsw-alias-label-tertiary, #777); font-size: 10px; }
|
|
266
|
+
.bf-tp-segtitle code { color: var(--dsw-alias-label-tertiary, #777); font-size: 10px; }
|
|
267
|
+
.bf-tp-pre { margin: 2px 0 0; font-family: var(--ds-font-family-code, monospace); font-size: 10px; line-height: 1.55;
|
|
268
|
+
white-space: pre-wrap; word-break: break-word; color: var(--dsw-alias-label-secondary, #999); max-height: 120px; overflow: auto; }
|
|
269
|
+
.bf-tp-kv { display: flex; gap: 6px; font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); }
|
|
270
|
+
.bf-tp-kv span { color: var(--dsw-alias-label-tertiary, #777); width: 28px; flex: none; }
|
|
271
|
+
.bf-tp-kv b { font-weight: 400; color: var(--dsw-alias-label-secondary, #999); word-break: break-all; }
|
|
272
|
+
.bf-tp-note { margin-top: 3px; font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-tertiary, #777); }
|
|
273
|
+
.bf-mono { font-family: var(--ds-font-family-code, monospace); }
|
|
274
|
+
/* ---------- v0.40.0 概览/项目/设置:抽屉与宽屏容器 ---------- */
|
|
275
|
+
.bf-board { width: 100%; max-width: 1600px; margin: 0 auto; }
|
|
276
|
+
|
|
277
|
+
/* ---------- v0.27.1 司南单卡「在岗会话」明细展开区;v0.31 阶段1 归档树收纳条样式随 ArchivedStrip 退役删除 ---------- */
|
|
278
|
+
.bf-seatextra { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40;
|
|
279
|
+
display: flex; flex-direction: column; gap: 4px; padding: 7px;
|
|
280
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.4)); border-radius: 8px;
|
|
281
|
+
background: var(--dsw-alias-bg-layer-1, #1f1f1f); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); }
|
|
282
|
+
.bf-seatrow { display: flex; flex-direction: column; gap: 2px; padding: 5px 6px; border-radius: 6px;
|
|
283
|
+
background: var(--dsw-alias-bg-base, rgba(128,128,128,0.05)); }
|
|
284
|
+
.bf-seatrow-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
|
|
285
|
+
.bf-seatrow-top .bf-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
|
286
|
+
font: var(--dsw-font-xs-strong-13, 600 13px/1.5 sans-serif); color: var(--dsw-alias-label-primary, #eee); }
|
|
287
|
+
/* ---------- v0.31 阶段1 能力详情弹窗(EquipModal):v0.31 收编时纯只读,v0.48.0 曾加「装备」tab 推荐项「⚡ 采纳并装备」直达通道——已随 v0.61.0 装备 tab 市场式重构退役,现行=三 tab/装备 tab 分级直装链(ADR docs/决策/2026-10-31-v0.61.0-装备面精简与分级直装.md,见 使用指南.md §2.5.1/§2.5.2);概览徽章行样式已前移至 .bf-model 行铬区 ---------- */
|
|
288
|
+
.bf-capmodal-mask { position: fixed; inset: 0; z-index: 90; display: block;
|
|
289
|
+
background: transparent; pointer-events: none; }
|
|
290
|
+
.bf-capmodal { position: fixed; top: 56px; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 8px;
|
|
291
|
+
width: min(760px, 100vw); max-height: none; overflow: hidden; padding: 12px 14px; box-sizing: border-box;
|
|
292
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.4)); border-right: none; border-radius: 0;
|
|
293
|
+
background: var(--dsw-alias-bg-layer-1, #1f1f1f); box-shadow: -16px 0 40px rgba(0, 0, 0, 0.45); pointer-events: auto; }
|
|
294
|
+
/* 三 tab 统一宽度(客户 2026-11-03 拍板):概览/提示词/装备弹窗一律 min(760px,100vw),tab 来回切换零宽度跳变——
|
|
295
|
+
内容≈728px 容纳装备列表+详情双栏;窄屏单列降级沿用下方 @media(max-width:720px) 既有断点 */
|
|
296
|
+
.bf-capmodal-tabs { display: flex; gap: 2px; flex: none; border-bottom: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.25)); padding-bottom: 6px; }
|
|
297
|
+
.bf-captab { height: 24px; padding: 0 10px; border: none; border-radius: 6px 6px 0 0; background: transparent;
|
|
298
|
+
color: var(--dsw-alias-label-secondary, #999); font: var(--dsw-font-xxs-strong-12, 600 12px/1.4 sans-serif); cursor: pointer; }
|
|
299
|
+
.bf-captab.bf-on { color: var(--dsw-alias-label-primary, #eee); background: var(--dsw-alias-bg-base, rgba(128,128,128,0.08)); }
|
|
300
|
+
.bf-capmodal-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 2px; }
|
|
301
|
+
.bf-cappane { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; min-height: 0; } /* S1(伞单 k-mw3zzzci0in)撑满链:弹窗 body flex:1 可用高度下传 pane */
|
|
302
|
+
.bf-pr-scope { display: flex; gap: 4px; padding: 3px; background: var(--dsw-alias-bg-layer-2, rgba(128,128,128,0.10)); border-radius: 7px; }
|
|
303
|
+
.bf-pr-scopebtn { flex: 1; border: 0; border-radius: 5px; padding: 5px 6px; background: transparent; cursor: pointer;
|
|
304
|
+
font: var(--dsw-font-xxxs-strong-11, 600 11px/1.4 sans-serif); color: var(--dsw-alias-label-secondary, #999); }
|
|
305
|
+
.bf-pr-scopebtn.bf-on { background: var(--dsw-alias-bg-layer-1, rgba(128,128,128,0.18)); color: var(--dsw-alias-label-primary, #eee);
|
|
306
|
+
box-shadow: 0 1px 2px rgba(0,0,0,0.18); }
|
|
307
|
+
.bf-pr-agent, .bf-pr-taskpane { flex-direction: column; gap: 8px; }
|
|
308
|
+
.bf-pr-taskbanner { padding: 6px 8px; border-radius: 6px; border: 1px solid color-mix(in srgb, #d8a516 45%, transparent);
|
|
309
|
+
background: color-mix(in srgb, #d8a516 10%, transparent); color: #e3bd5c; font: var(--dsw-font-xxxs-11, 11px/1.5 sans-serif); }
|
|
310
|
+
.bf-pr-task { border: 1px solid var(--dsw-alias-border-l1, rgba(128,128,128,0.20)); border-radius: 7px; padding: 7px 9px;
|
|
311
|
+
display: flex; flex-direction: column; gap: 3px; }
|
|
312
|
+
.bf-pr-tasktt { font: var(--dsw-font-xs-strong-13, 600 13px/1.5 sans-serif); color: var(--dsw-alias-label-primary, #eee); }
|
|
313
|
+
.bf-pr-taskmeta { font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-secondary, #999); word-break: break-word; }
|
|
314
|
+
.bf-pr-tasknote { font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-secondary, #888); }
|
|
315
|
+
.bf-ov-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
|
|
316
|
+
.bf-ov-kv { display: flex; flex-direction: column; gap: 1px; padding: 6px 7px; border-radius: 7px; background: var(--dsw-alias-bg-base, rgba(128,128,128,0.05)); }
|
|
317
|
+
.bf-ov-kv span { font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-secondary, #999); }
|
|
318
|
+
.bf-ov-kv b { font: var(--dsw-font-xxs-strong-12, 600 12px/1.4 sans-serif); color: var(--dsw-alias-label-primary, #eee); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
319
|
+
.bf-ov-task { display: flex; align-items: center; gap: 5px; font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); }
|
|
320
|
+
.bf-ov-dot { width: 5px; height: 5px; border-radius: 50%; flex: none; }
|
|
321
|
+
.bf-ov-dot.bf-run { background: #4f7cf0; }
|
|
322
|
+
.bf-ov-dot.bf-done { background: #2f9e44; }
|
|
323
|
+
.bf-ov-tt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dsw-alias-label-primary, #ddd); }
|
|
324
|
+
.bf-ov-st { color: var(--dsw-alias-label-secondary, #999); flex: none; }
|
|
325
|
+
.bf-ov-note { font: var(--dsw-font-xxxs-11, 11px/1.5 sans-serif); color: var(--dsw-alias-label-secondary, #999); }
|
|
326
|
+
/* v0.40.8 阶段1:卡内隐藏名单收窄——模型直配(.bf-modelhost)与卡角退役钮(.bf-retire)已在地图卡
|
|
327
|
+
* 常驻可见;仅能力徽章(.bf-equipview,入口在弹窗页签)与徽章行内提升钮(.bf-top .bf-imp,入口在
|
|
328
|
+
* 司南卡明细行 ⏫,v0.27.1 原位设计)保持卡内隐藏。 */
|
|
329
|
+
.bf-gnode .bf-equipview, .bf-gnode .bf-top .bf-imp { display: none !important; }
|
|
330
|
+
.bf-ov-pre { margin: 0; max-height: 240px; overflow: auto; white-space: pre-wrap; word-break: break-word;
|
|
331
|
+
font: 11px/1.7 var(--dsw-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); color: var(--dsw-alias-label-primary, #ddd); }
|
|
332
|
+
.bf-capmodal-head { display: flex; align-items: flex-start; gap: 8px; }
|
|
333
|
+
.bf-capmodal-ico { width: 32px; height: 32px; flex: none; display: flex; align-items: center; justify-content: center;
|
|
334
|
+
border-radius: 8px; border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.35));
|
|
335
|
+
background: var(--dsw-alias-bg-base, rgba(128,128,128,0.08)); color: var(--dsw-alias-label-primary, #ddd);
|
|
336
|
+
font: 600 14px/1 var(--dsw-font-sans, sans-serif); }
|
|
337
|
+
.bf-capmodal-ico[data-kind="root"] { color: #c4b5fd; border-color: rgba(167,139,250,0.45); }
|
|
338
|
+
.bf-capmodal-ico[data-kind="leader"] { color: #93b4f5; border-color: rgba(91,141,239,0.45); }
|
|
339
|
+
.bf-capmodal-ttl { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
|
|
340
|
+
.bf-capmodal-name { font: 600 15px/1.4 var(--dsw-font-sans, sans-serif);
|
|
341
|
+
color: var(--dsw-alias-label-primary, #eee); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
342
|
+
.bf-capmodal-sub { font: 10px/1.4 var(--dsw-font-sans, sans-serif); color: var(--dsw-alias-label-secondary, #999);
|
|
343
|
+
white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
344
|
+
.bf-capmodal-chips { display: flex; gap: 5px; flex-wrap: wrap; }
|
|
345
|
+
.bf-capchip { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 5px;
|
|
346
|
+
background: var(--dsw-alias-bg-base, rgba(128,128,128,0.08)); font: 9px/1.5 var(--dsw-font-mono, monospace);
|
|
347
|
+
color: var(--dsw-alias-label-secondary, #999); }
|
|
348
|
+
.bf-capchip b { font-weight: 500; color: var(--dsw-alias-label-primary, #ddd); }
|
|
349
|
+
.bf-caphead { padding: 5px 7px; border-radius: 6px; background: var(--dsw-alias-bg-base, rgba(128,128,128,0.05));
|
|
350
|
+
font: 10px/1.5 var(--dsw-font-sans, sans-serif); color: var(--dsw-alias-label-secondary, #999); }
|
|
351
|
+
.bf-capsec { display: flex; flex-direction: column; gap: 4px; padding: 7px 8px; border-radius: 8px;
|
|
352
|
+
background: var(--dsw-alias-bg-base, rgba(128,128,128,0.05)); }
|
|
353
|
+
.bf-capsec-title { font: var(--dsw-font-xxs-strong-12, 600 12px/1.45 sans-serif);
|
|
354
|
+
color: var(--dsw-alias-label-primary, #eee); }
|
|
355
|
+
.bf-capitem { display: flex; flex-direction: column; gap: 2px; }
|
|
356
|
+
.bf-capitems { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
|
|
357
|
+
.bf-capitem-desc { font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-secondary, #999);
|
|
358
|
+
white-space: normal; }
|
|
359
|
+
/* ---------- v0.61.0 S2 装备 tab 市场式重构(判据 EQ-01..17,样例基准 bufeng-ws/装备面精简-交互样例.html)----------
|
|
360
|
+
* 三 tab 压平后装备 pane:顶部 Skill/MCP 双轴分段(轴色选中)+左列表分组(组头计数徽标/刷新钮/空组说明)+右详情六要素。
|
|
361
|
+
* 旧 capseg 二级分段/refbar 折叠条/refadopt-cta 采纳系样式随退役 UI 整段移除(EQ-16d 产物看守零残留)。
|
|
362
|
+
* 色值全部走仓内 alias+color-mix;等宽复用 --ds-font-family-code;禁同值重复规则(同色声明一次,变体只写差异项)。 */
|
|
363
|
+
.bf-eqpane { display: flex; flex-direction: column; gap: 10px; align-items: stretch; min-height: 0; flex: 1 1 auto; } /* S1 撑满链随动 */
|
|
364
|
+
.bf-eqaxisbar { display: flex; gap: 2px; padding: 2px; margin-bottom: 8px;
|
|
365
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.25));
|
|
366
|
+
border-radius: 8px; background: var(--dsw-alias-bg-base, rgba(128,128,128,0.05)); }
|
|
367
|
+
.bf-eqaxis { flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 4px;
|
|
368
|
+
border: none; background: transparent; cursor: pointer; padding: 4px 2px; border-radius: 6px; white-space: nowrap;
|
|
369
|
+
font: var(--dsw-font-xxs-strong-12, 600 12px/1.45 sans-serif); color: var(--dsw-alias-label-secondary, #999); }
|
|
370
|
+
.bf-eqaxis-ic { flex: none; }
|
|
371
|
+
.bf-eqaxis:hover { color: var(--dsw-alias-label-primary, #eee); }
|
|
372
|
+
.bf-eqaxis.bf-eqaxis-on { background: color-mix(in srgb, var(--dsw-alias-state-business-primary, #4f7cf0) 20%, transparent);
|
|
373
|
+
color: var(--dsw-alias-state-business-primary, #4f7cf0); }
|
|
374
|
+
.bf-eqaxis[data-bf-axistab='mcp'].bf-eqaxis-on { background: color-mix(in srgb, var(--dsw-alias-label-primary-bluish, #b19cf7) 20%, transparent);
|
|
375
|
+
color: var(--dsw-alias-label-primary-bluish, #b19cf7); }
|
|
376
|
+
.bf-eqsplit { display: flex; gap: 8px; flex: 1 1 auto; align-items: stretch; min-height: 0; }
|
|
377
|
+
.bf-eqlist { width: clamp(320px, 27%, 430px); box-sizing: border-box; flex: none; display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; /* S1(k-mw40hwjd0kb):380px 钳制退役——随 split 拉伸到可用高度,超高内滚 */
|
|
378
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.25)); border-radius: 8px; padding: 6px;
|
|
379
|
+
background: var(--dsw-alias-bg-layer-1, rgba(128,128,128,0.08)); }
|
|
380
|
+
.bf-eqgrp { display: flex; flex-direction: column; gap: 2px; }
|
|
381
|
+
.bf-eqgrp-hd { display: flex; align-items: center; gap: 5px; padding: 2px 4px; }
|
|
382
|
+
.bf-eqgrp-ttl { flex: 1 1 auto; min-width: 0; font: var(--dsw-font-xxxs-strong-11, 600 11px/1.4 sans-serif);
|
|
383
|
+
color: var(--dsw-alias-label-secondary, #999); }
|
|
384
|
+
.bf-eqgrp-cnt { flex: none; padding: 1px 6px; border-radius: 8px; white-space: nowrap;
|
|
385
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-secondary, #999);
|
|
386
|
+
background: var(--dsw-alias-bg-layer-2, rgba(128,128,128,0.10)); }
|
|
387
|
+
.bf-eqgrp-refresh { flex: none; padding: 0 2px; border: none; background: none; cursor: pointer;
|
|
388
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-state-business-primary, #4f7cf0); }
|
|
389
|
+
.bf-eqgrp-refresh:hover { color: var(--dsw-alias-label-primary, #eee); }
|
|
390
|
+
.bf-eqgrp-empty { padding: 2px 4px; font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-tertiary, #777); }
|
|
391
|
+
.bf-eqitem { display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left; padding: 5px 7px;
|
|
392
|
+
border: 1px solid transparent; border-radius: 6px; background: transparent; cursor: pointer; }
|
|
393
|
+
.bf-eqitem:hover { background: var(--dsw-alias-bg-layer-2, rgba(128,128,128,0.10)); }
|
|
394
|
+
.bf-eqitem.bf-eqitem-on { border-color: color-mix(in srgb, var(--dsw-alias-state-business-primary, #4f7cf0) 55%, transparent);
|
|
395
|
+
background: color-mix(in srgb, var(--dsw-alias-state-business-primary, #4f7cf0) 12%, transparent); }
|
|
396
|
+
.bf-eqitem-nm { display: flex; align-items: center; gap: 5px; min-width: 0;
|
|
397
|
+
font: var(--dsw-font-xxs-strong-12, 600 12px/1.45 sans-serif); color: var(--dsw-alias-label-primary, #eee); }
|
|
398
|
+
.bf-eqitem-sub { display: flex; align-items: center; gap: 5px; min-width: 0;
|
|
399
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-secondary, #999); }
|
|
400
|
+
.bf-eqdetail { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px;
|
|
401
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.25)); border-radius: 8px; padding: 10px;
|
|
402
|
+
background: var(--dsw-alias-bg-layer-1, rgba(128,128,128,0.08)); min-height: 0; overflow-y: auto; } /* S1(k-mw40hwjd0kb):380px 钳制退役 */
|
|
403
|
+
.bf-eqdetail-empty { align-items: center; justify-content: center;
|
|
404
|
+
color: var(--dsw-alias-label-secondary, #999); font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); }
|
|
405
|
+
.bf-eqdetail-hd { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
|
|
406
|
+
.bf-eqname { font: var(--dsw-font-xs-strong-13, 600 13px/1.4 sans-serif); color: var(--dsw-alias-label-primary, #eee);
|
|
407
|
+
font-family: var(--ds-font-family-code, monospace); }
|
|
408
|
+
.bf-eqsrc { flex: none; padding: 1px 7px; border-radius: 8px; white-space: nowrap;
|
|
409
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-secondary, #999);
|
|
410
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.25)); }
|
|
411
|
+
.bf-eqdesc, .bf-eqreason, .bf-eqmeta { font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif);
|
|
412
|
+
color: var(--dsw-alias-label-secondary, #999); white-space: normal; }
|
|
413
|
+
.bf-eqwhy { display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
|
|
414
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-secondary, #999); }
|
|
415
|
+
.bf-eqhit { flex: none; padding: 1px 6px; border-radius: 8px;
|
|
416
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-state-business-primary, #4f7cf0);
|
|
417
|
+
background: color-mix(in srgb, var(--dsw-alias-state-business-primary, #4f7cf0) 12%, transparent); }
|
|
418
|
+
.bf-eqscore { flex: none; font-family: var(--ds-font-family-code, monospace);
|
|
419
|
+
color: var(--dsw-alias-state-business-primary, #4f7cf0); }
|
|
420
|
+
.bf-eqstaterow { display: flex; align-items: center; gap: 6px; }
|
|
421
|
+
.bf-eqstate { flex: none; padding: 1px 7px; border-radius: 8px; white-space: nowrap;
|
|
422
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-primary, #eee);
|
|
423
|
+
background: var(--dsw-alias-bg-layer-2, rgba(128,128,128,0.10)); }
|
|
424
|
+
.bf-eqstate[data-bf-eqstate='not-installed'] { color: var(--dsw-alias-label-secondary, #999); }
|
|
425
|
+
.bf-eqops { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
|
|
426
|
+
.bf-eqconfirm { display: flex; flex-direction: column; gap: 5px; padding: 7px 9px; border-radius: 8px;
|
|
427
|
+
border: 1px solid color-mix(in srgb, var(--dsw-alias-state-warning, #e0a34f) 55%, transparent);
|
|
428
|
+
background: color-mix(in srgb, var(--dsw-alias-state-warning, #e0a34f) 10%, transparent); }
|
|
429
|
+
.bf-eqconfirm-t { font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-primary, #eee); white-space: normal; }
|
|
430
|
+
.bf-eqconfirm-line { display: flex; gap: 6px; }
|
|
431
|
+
.bf-eqrc { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-radius: 8px;
|
|
432
|
+
border: 1px solid color-mix(in srgb, var(--dsw-alias-state-success, #58b975) 55%, transparent);
|
|
433
|
+
background: color-mix(in srgb, var(--dsw-alias-state-success, #58b975) 10%, transparent); }
|
|
434
|
+
.bf-eqrc.bf-eqdegrade { border-color: color-mix(in srgb, var(--dsw-alias-state-danger, #e06c75) 55%, transparent);
|
|
435
|
+
background: color-mix(in srgb, var(--dsw-alias-state-danger, #e06c75) 10%, transparent); }
|
|
436
|
+
.bf-eqrc-title { font: var(--dsw-font-xxs-strong-12, 600 12px/1.45 sans-serif); color: var(--dsw-alias-label-primary, #eee); }
|
|
437
|
+
.bf-eqrc-line, .bf-eqrc-diff, .bf-eqrc-eff, .bf-eqrc-note, .bf-eqrc-foot { font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif);
|
|
438
|
+
color: var(--dsw-alias-label-secondary, #999); white-space: normal; word-break: break-all; }
|
|
439
|
+
.bf-eqerr { font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-state-danger, #e06c75); white-space: normal; }
|
|
440
|
+
/* 装备弹窗 · 对侧轴条目隐藏挂载容器(判据可捕获通道,零视觉呈现) */
|
|
441
|
+
.bf-eqhidden { display:none!important }
|
|
442
|
+
.bf-eqterms { font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-tertiary, #777); white-space: normal; } /* S1(伞单 k-mw3zzzci0in):独立 margin-top:8px 展开形态退役——上边框收口上移 .bf-capfoot 壳层 */
|
|
443
|
+
/* S1 页脚紧凑化(伞单 k-mw3zzzci0in):默认折叠单行壳——正文收进 bf-capfoot-body(收起 display:none 隐藏挂载,
|
|
444
|
+
* 信息不删只挪位收窄;锚名 data-bf-caphint/data-bf-eqterms 与文本逐字保留)。 */
|
|
445
|
+
.bf-capfoot { flex: none; margin-top: 2px; padding-top: 4px; border-top: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.25)); }
|
|
446
|
+
.bf-capfoot-toggle { width: 100%; text-align: left; border: none; background: none; cursor: pointer; padding: 2px 0;
|
|
447
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-tertiary, #777);
|
|
448
|
+
white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
449
|
+
.bf-capfoot-toggle:hover { color: var(--dsw-alias-label-secondary, #999); }
|
|
450
|
+
.bf-capfoot-body { display: flex; flex-direction: column; gap: 4px; }
|
|
451
|
+
.bf-eqlow { flex: none; padding: 0 6px; border-radius: 8px; white-space: nowrap;
|
|
452
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-secondary, #999);
|
|
453
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.25));
|
|
454
|
+
background: var(--dsw-alias-bg-layer-2, rgba(128,128,128,0.10)); }
|
|
455
|
+
.bf-equnused { flex: none; padding: 0 6px; border-radius: 8px; white-space: nowrap;
|
|
456
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-state-warning, #e0a34f);
|
|
457
|
+
background: color-mix(in srgb, var(--dsw-alias-state-warning, #e0a34f) 12%, transparent); }
|
|
458
|
+
.bf-eqcat { width: 100%; box-sizing: border-box; display: flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 8px;
|
|
459
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); white-space: normal; }
|
|
460
|
+
.bf-eqcat.bf-eqcatstale { color: var(--dsw-alias-state-warning, #e0a34f);
|
|
461
|
+
border: 1px solid color-mix(in srgb, var(--dsw-alias-state-warning, #e0a34f) 45%, transparent);
|
|
462
|
+
background: color-mix(in srgb, var(--dsw-alias-state-warning, #e0a34f) 8%, transparent); }
|
|
463
|
+
.bf-eqcat.bf-eqcatdown { color: var(--dsw-alias-state-danger, #e06c75);
|
|
464
|
+
border: 1px solid color-mix(in srgb, var(--dsw-alias-state-danger, #e06c75) 45%, transparent);
|
|
465
|
+
background: color-mix(in srgb, var(--dsw-alias-state-danger, #e06c75) 8%, transparent); }
|
|
466
|
+
.bf-eqcat.bf-eqcaterr { color: var(--dsw-alias-state-danger, #e06c75); /* k-mw0ala3c053:建议单拉取失败横幅(复用 bf-eqcat 家族 danger 形态) */
|
|
467
|
+
border: 1px solid color-mix(in srgb, var(--dsw-alias-state-danger, #e06c75) 45%, transparent);
|
|
468
|
+
background: color-mix(in srgb, var(--dsw-alias-state-danger, #e06c75) 8%, transparent); }
|
|
469
|
+
.bf-eqempty { padding: 10px; border-radius: 8px; text-align: center;
|
|
470
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-label-secondary, #999);
|
|
471
|
+
border: 1px dashed var(--dsw-alias-border-l2, rgba(128,128,128,0.25)); }
|
|
472
|
+
.bf-eqmeta { display: flex; flex-direction: column; gap: 2px; }
|
|
473
|
+
.bf-eqredline { padding: 6px 9px; border-radius: 8px; font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif);
|
|
474
|
+
color: var(--dsw-alias-state-danger, #e06c75); white-space: normal;
|
|
475
|
+
border: 1px solid color-mix(in srgb, var(--dsw-alias-state-danger, #e06c75) 45%, transparent);
|
|
476
|
+
background: color-mix(in srgb, var(--dsw-alias-state-danger, #e06c75) 8%, transparent); }
|
|
477
|
+
.bf-eqclamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
|
|
478
|
+
.bf-eqexp { align-self: flex-start; padding: 0; border: none; background: none; cursor: pointer;
|
|
479
|
+
font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-state-business-primary, #4f7cf0); }
|
|
480
|
+
.bf-eqcopymsg { font: var(--dsw-font-xxxs-11, 11px/1.4 sans-serif); color: var(--dsw-alias-state-success, #58b975); }
|
|
481
|
+
/* 装备域窄屏降级(伞单 k-mvyluch5055,判据 EQ-DEV-02b/02c):窄屏双栏转单列——split 纵向堆叠、列表占满行宽 */
|
|
482
|
+
@media (max-width: 720px) {
|
|
483
|
+
.bf-eqsplit { flex-direction: column; }
|
|
484
|
+
.bf-eqlist { width: 100%; max-height: 260px; }
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
.bf-set-wrap { display: flex; gap: 18px; max-width: 1380px; margin: 0 auto; width: 100%; align-items: flex-start; }
|
|
488
|
+
.bf-set-nav { width: 200px; flex: none; position: sticky; top: 8px; display: flex; flex-direction: column; gap: 2px;
|
|
489
|
+
padding: 10px; border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.25)); border-radius: 10px;
|
|
490
|
+
background: var(--dsw-alias-bg-layer-1, rgba(128,128,128,0.04)); }
|
|
491
|
+
.bf-set-nav-h { font: 600 12px/1.6 var(--dsw-font-sans, sans-serif); color: var(--dsw-alias-label-primary, #eee);
|
|
492
|
+
padding: 2px 6px 8px; }
|
|
493
|
+
.bf-set-link { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 6px;
|
|
494
|
+
font: 12px/1.4 var(--dsw-font-sans, sans-serif); color: var(--dsw-alias-label-secondary, #999); cursor: pointer; }
|
|
495
|
+
.bf-set-link:hover { background: var(--dsw-alias-bg-base, rgba(128,128,128,0.06)); color: var(--dsw-alias-label-primary, #ddd); }
|
|
496
|
+
.bf-set-link.bf-on { background: var(--dsw-alias-bg-layer-2, rgba(91,141,239,0.14)); color: var(--dsw-alias-label-primary, #eee); }
|
|
497
|
+
.bf-set-nav-note { font: 10px/1.55 var(--dsw-font-sans, sans-serif); color: var(--dsw-alias-label-secondary, #888);
|
|
498
|
+
padding: 8px 6px 2px; border-top: 1px dashed var(--dsw-alias-border-l2, rgba(128,128,128,0.2)); margin-top: 6px; }
|
|
499
|
+
.bf-set-main { flex: 1; min-width: 0; max-width: 1120px; }
|
|
500
|
+
|
|
501
|
+
/* ---------- v0.40.7 看板 UI 三项修复(k-mvje54b40ks) ---------- */
|
|
502
|
+
/* 工作项一:节点卡「运行中 ×N」并发徽标+在跑任务展开列表 */
|
|
503
|
+
.bf-runbadge { flex: none; height: 16px; padding: 0 6px; border-radius: 8px; cursor: pointer;
|
|
504
|
+
font: 600 10px/16px var(--dsw-font-sans, sans-serif); color: var(--dsw-alias-label-primary, #eee);
|
|
505
|
+
border: 1px solid rgba(91,141,239,0.5); background: rgba(91,141,239,0.16); }
|
|
506
|
+
.bf-runbadge:hover { background: rgba(91,141,239,0.28); }
|
|
507
|
+
.bf-runspanel { display: flex; flex-direction: column; gap: 3px; margin: 4px 0 2px; padding: 6px;
|
|
508
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.25)); border-radius: 8px;
|
|
509
|
+
background: var(--dsw-alias-bg-layer-1, rgba(128,128,128,0.06)); }
|
|
510
|
+
.bf-runrow { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; cursor: pointer;
|
|
511
|
+
border: 0; border-radius: 5px; padding: 3px 6px; font: 11px/1.4 var(--dsw-font-sans, sans-serif);
|
|
512
|
+
color: var(--dsw-alias-label-primary, #eee); background: transparent; }
|
|
513
|
+
.bf-runrow:hover { background: var(--dsw-alias-bg-layer-2, rgba(91,141,239,0.12)); }
|
|
514
|
+
.bf-runrow-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
515
|
+
.bf-runrow-elapsed { flex: none; font: 10px/1.4 var(--dsw-font-sans, sans-serif);
|
|
516
|
+
color: var(--dsw-alias-label-secondary, #999); }
|
|
517
|
+
/* v0.40.8 阶段1:.bf-modeledit / .bf-modeledit-inline 浮层样式随 ModelCtl 弹层退役删除——
|
|
518
|
+
* 模型配置改地图卡三级联动直选(.bf-mrow),无浮层、无抽屉文档流形态。 */
|
|
519
|
+
/* 工作项二:任务看板分发链路树(父子=子单.dispatchedBySession===父单.childId,逐层递归) */
|
|
520
|
+
.bf-dtree { display: flex; flex-direction: column; gap: 3px; }
|
|
521
|
+
.bf-drow { display: flex; align-items: center; gap: 6px; min-height: 24px; border-radius: 6px;
|
|
522
|
+
padding-right: 8px; cursor: pointer; font: 12px/1.5 var(--dsw-font-sans, sans-serif);
|
|
523
|
+
color: var(--dsw-alias-label-primary, #eee); background: transparent; }
|
|
524
|
+
.bf-drow:hover { background: var(--dsw-alias-bg-layer-2, rgba(91,141,239,0.12)); }
|
|
525
|
+
.bf-drow.bf-on { background: var(--dsw-alias-bg-layer-2, rgba(91,141,239,0.14)); }
|
|
526
|
+
.bf-drow-guide { flex: none; width: 14px; color: var(--dsw-alias-label-secondary, #999); }
|
|
527
|
+
.bf-drow-title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
528
|
+
.bf-drow-exec { flex: none; font: 11px/1.4 var(--dsw-font-sans, sans-serif);
|
|
529
|
+
color: var(--dsw-alias-label-secondary, #999); }
|
|
530
|
+
.bf-drow-cur { flex: none; font: 600 10px/1.4 var(--dsw-font-sans, sans-serif);
|
|
531
|
+
color: var(--dsw-alias-label-primary, #eee); border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.25));
|
|
532
|
+
border-radius: 7px; padding: 0 5px; }
|
|
533
|
+
|
|
534
|
+
/* v0.60.0 建议单 pane(bf-sug* 前缀系——退役的 B 色卡类名前缀零复用,字面不落注释防产物看守检索误触) */
|
|
535
|
+
.bf-sugs { display: flex; flex-direction: column; gap: 8px; width: 100%; }
|
|
536
|
+
.bf-sugstale { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
|
|
537
|
+
font: 11px/1.5 var(--dsw-font-sans, sans-serif); color: var(--dsw-alias-label-secondary, #999);
|
|
538
|
+
background: transparent; border: 1px dashed var(--dsw-alias-border-l2, rgba(128,128,128,0.25));
|
|
539
|
+
border-radius: 7px; padding: 2px 8px; cursor: pointer; }
|
|
540
|
+
.bf-sugstale:hover { color: var(--dsw-alias-label-primary, #eee);
|
|
541
|
+
background: var(--dsw-alias-bg-layer-2, rgba(91,141,239,0.12)); }
|
|
542
|
+
.bf-sugstale-on { color: #e8b45a; border-color: rgba(232,180,90,0.45); }
|
|
543
|
+
.bf-sugnote { font: 11px/1.6 var(--dsw-font-sans, sans-serif); color: var(--dsw-alias-label-secondary, #999); }
|
|
544
|
+
.bf-sugcat { font: 600 12px/1.6 var(--dsw-font-sans, sans-serif); color: var(--dsw-alias-label-primary, #eee);
|
|
545
|
+
border-left: 3px solid rgba(91,141,239,0.55); padding-left: 8px; margin-top: 4px; }
|
|
546
|
+
.bf-sugrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
|
|
547
|
+
font: 12px/1.6 var(--dsw-font-sans, sans-serif); color: var(--dsw-alias-label-primary, #eee);
|
|
548
|
+
background: var(--dsw-alias-bg-layer-2, rgba(91,141,239,0.06));
|
|
549
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.18));
|
|
550
|
+
border-radius: 8px; padding: 6px 10px; }
|
|
551
|
+
.bf-sugrow-low { opacity: 0.92; border-style: dashed; }
|
|
552
|
+
.bf-sugrow-cat { border-color: rgba(232,180,90,0.35); }
|
|
553
|
+
.bf-sugrank { flex: none; font: 600 10px/1.4 var(--dsw-font-sans, sans-serif);
|
|
554
|
+
color: var(--dsw-alias-label-secondary, #999);
|
|
555
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.25)); border-radius: 7px; padding: 0 5px; }
|
|
556
|
+
.bf-sugname { font-weight: 600; }
|
|
557
|
+
.bf-sugcode { font: 11px/1.5 var(--dsw-font-mono, monospace); color: var(--dsw-alias-label-secondary, #999); }
|
|
558
|
+
.bf-sugreason { flex-basis: 100%; font: 11px/1.6 var(--dsw-font-sans, sans-serif);
|
|
559
|
+
color: var(--dsw-alias-label-secondary, #999); }
|
|
560
|
+
.bf-sugtag { flex: none; font: 600 10px/1.4 var(--dsw-font-sans, sans-serif); color: #e8b45a;
|
|
561
|
+
border: 1px solid rgba(232,180,90,0.45); border-radius: 7px; padding: 0 5px; }
|
|
562
|
+
.bf-sugrisk { flex: none; font: 10px/1.4 var(--dsw-font-sans, sans-serif); color: #e07b7b;
|
|
563
|
+
border: 1px solid rgba(224,123,123,0.4); border-radius: 7px; padding: 0 5px; }
|
|
564
|
+
.bf-sugmeta { flex-basis: 100%; font: 11px/1.5 var(--dsw-font-mono, monospace);
|
|
565
|
+
color: var(--dsw-alias-label-secondary, #999); word-break: break-all; }
|
|
566
|
+
.bf-sugsrc { flex: none; font: 600 10px/1.4 var(--dsw-font-sans, sans-serif); color: #9aa7e8;
|
|
567
|
+
border: 1px solid rgba(154,167,232,0.4); border-radius: 7px; padding: 0 5px; }
|
|
568
|
+
.bf-sughintnote { flex-basis: 100%; font: 11px/1.6 var(--dsw-font-sans, sans-serif);
|
|
569
|
+
color: var(--dsw-alias-label-secondary, #999); }
|
|
570
|
+
.bf-suglowsec { display: flex; flex-direction: column; gap: 6px; }
|
|
571
|
+
.bf-suglow { font: 600 12px/1.6 var(--dsw-font-sans, sans-serif); color: #e8b45a;
|
|
572
|
+
border-left: 3px solid rgba(232,180,90,0.55); padding-left: 8px; margin-top: 4px; }
|
|
573
|
+
.bf-sugsep { font: 11px/1.6 var(--dsw-font-sans, sans-serif); color: var(--dsw-alias-label-secondary, #999);
|
|
574
|
+
border-top: 1px dashed var(--dsw-alias-border-l2, rgba(128,128,128,0.25)); padding-top: 8px; margin-top: 6px; }
|
|
575
|
+
.bf-suglayer { font: 600 12px/1.6 var(--dsw-font-sans, sans-serif); color: var(--dsw-alias-label-primary, #eee);
|
|
576
|
+
border-left: 3px solid rgba(232,180,90,0.55); padding-left: 8px; }
|
|
577
|
+
.bf-sugempty { font: 12px/1.7 var(--dsw-font-sans, sans-serif); color: var(--dsw-alias-label-secondary, #999);
|
|
578
|
+
background: var(--dsw-alias-bg-layer-2, rgba(91,141,239,0.05)); border-radius: 8px; padding: 10px 12px; }
|
|
579
|
+
.bf-sugpv { display: flex; flex-direction: column; gap: 6px;
|
|
580
|
+
background: var(--dsw-alias-bg-layer-2, rgba(91,141,239,0.08));
|
|
581
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.25));
|
|
582
|
+
border-radius: 8px; padding: 10px 12px; }
|
|
583
|
+
.bf-sugpv-t, .bf-sugpv-t2 { font: 600 12px/1.6 var(--dsw-font-sans, sans-serif);
|
|
584
|
+
color: var(--dsw-alias-label-primary, #eee); }
|
|
585
|
+
.bf-sugkv { font: 600 11px/1.6 var(--dsw-font-sans, sans-serif); color: var(--dsw-alias-label-secondary, #999); }
|
|
586
|
+
.bf-sugpre { margin: 0; font: 10px/1.6 var(--dsw-font-mono, monospace);
|
|
587
|
+
color: var(--dsw-alias-label-primary, #eee); white-space: pre-wrap; word-break: break-all;
|
|
588
|
+
max-height: 120px; overflow-y: auto; background: rgba(0,0,0,0.2); border-radius: 6px; padding: 6px 8px; }
|
|
589
|
+
.bf-sugfx { margin: 0; padding-left: 18px; font: 11px/1.7 var(--dsw-font-sans, sans-serif);
|
|
590
|
+
color: var(--dsw-alias-label-primary, #eee); }
|
|
591
|
+
.bf-sughash { font: 11px/1.5 var(--dsw-font-mono, monospace); color: #9aa7e8; word-break: break-all; }
|
|
592
|
+
.bf-sugck { display: flex; align-items: flex-start; gap: 7px; cursor: pointer;
|
|
593
|
+
font: 12px/1.6 var(--dsw-font-sans, sans-serif); color: var(--dsw-alias-label-primary, #eee); }
|
|
594
|
+
.bf-sugck-t { min-width: 0; }
|
|
595
|
+
.bf-sugst { font: 11px/1.6 var(--dsw-font-sans, sans-serif); color: var(--dsw-alias-label-secondary, #999); }
|
|
596
|
+
.bf-sugrc { font: 12px/1.6 var(--dsw-font-sans, sans-serif); color: #7ec97e;
|
|
597
|
+
background: rgba(126,201,126,0.08); border-radius: 8px; padding: 8px 10px; word-break: break-word; }
|
|
598
|
+
.bf-sugtoast { font: 11px/1.6 var(--dsw-font-sans, sans-serif); color: #e8b45a; }
|
|
599
|
+
.bf-sugdrift, .bf-sugerr { font: 11px/1.7 var(--dsw-font-sans, sans-serif); color: #e07b7b;
|
|
600
|
+
background: rgba(224,123,123,0.08); border-radius: 8px; padding: 8px 10px; word-break: break-word; }
|
|
601
|
+
.bf-sughashnote { font: 11px/1.7 var(--dsw-font-sans, sans-serif); color: #e8b45a;
|
|
602
|
+
background: rgba(232,180,90,0.08); border-radius: 8px; padding: 8px 10px; }
|
|
603
|
+
.bf-sugnoperm { display: flex; flex-direction: column; gap: 6px;
|
|
604
|
+
background: rgba(224,123,123,0.06); border: 1px solid rgba(224,123,123,0.3);
|
|
605
|
+
border-radius: 8px; padding: 10px 12px; }
|
|
606
|
+
.bf-sugnoperm-t { font: 12px/1.6 var(--dsw-font-sans, sans-serif); color: #e07b7b; }
|
|
607
|
+
.bf-sugnoperm-d { font: 11px/1.7 var(--dsw-font-sans, sans-serif); color: var(--dsw-alias-label-secondary, #999); }
|
|
608
|
+
.bf-sugcopymsg { font: 11px/1.6 var(--dsw-font-sans, sans-serif); color: #7ec97e; }
|
|
609
|
+
.bf-sugfoot { font: 11px/1.7 var(--dsw-font-sans, sans-serif); color: var(--dsw-alias-label-secondary, #999);
|
|
610
|
+
border-top: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,0.18)); padding-top: 8px; }
|
|
611
|
+
|
|
612
|
+
`;
|
|
613
|
+
function StyleOnce() {
|
|
614
|
+
const [ok] = useState(() => {
|
|
615
|
+
if (!document.getElementById("bf-board-styles")) {
|
|
616
|
+
const s = document.createElement("style");
|
|
617
|
+
s.id = "bf-board-styles";
|
|
618
|
+
s.textContent = BF_CSS;
|
|
619
|
+
document.head.appendChild(s);
|
|
620
|
+
}
|
|
621
|
+
return true;
|
|
622
|
+
});
|
|
623
|
+
return null;
|
|
624
|
+
}
|
|
625
|
+
return { StyleOnce };
|
|
626
|
+
})();
|
|
627
|
+
/* ============================== src/data.js ============================== */
|
|
628
|
+
__mods["data.js"] = (() => {
|
|
629
|
+
const { useState, useEffect } = __mods["react.js"];
|
|
630
|
+
/**
|
|
631
|
+
* client/src/data.js — 同源快照(/bufeng/api/snapshot)+ SSE 实时推送(/bufeng/api/stream),断线降级轮询。
|
|
632
|
+
*/
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
/* ---------- 数据:同源快照 + SSE 实时推送 ---------- */
|
|
636
|
+
/* 模块级快照缓存:useState 惰性初值回放最近一次成功快照——面板重开/会话复位(hookStore 清空)后
|
|
637
|
+
* 首遍即可同步渲染出图,不再闪「加载中」空帧(fetch 仍照发,缓存只作初值,零轮询语义不变)。 */
|
|
638
|
+
let SNAP_CACHE = null;
|
|
639
|
+
function usebufengSnapshot() {
|
|
640
|
+
const [snap, setSnap] = useState(() => SNAP_CACHE);
|
|
641
|
+
const [err, setErr] = useState(null);
|
|
642
|
+
const [live, setLive] = useState(false);
|
|
643
|
+
useEffect(() => {
|
|
644
|
+
let dead = false;
|
|
645
|
+
let es = null;
|
|
646
|
+
let poll = null;
|
|
647
|
+
const fetchOnce = () => fetch("/bufeng/api/snapshot", { cache: "no-store" })
|
|
648
|
+
.then((r) => r.ok ? r.json() : Promise.reject(new Error("HTTP " + r.status)))
|
|
649
|
+
.then((j) => { if (!dead) { SNAP_CACHE = j; setSnap(j); setErr(null); } })
|
|
650
|
+
.catch((e) => { if (!dead) setErr(String((e && e.message) || e)); });
|
|
651
|
+
const onRefresh = () => fetchOnce();
|
|
652
|
+
window.addEventListener("bufeng:refresh", onRefresh);
|
|
653
|
+
fetchOnce();
|
|
654
|
+
try {
|
|
655
|
+
es = new EventSource("/bufeng/api/stream");
|
|
656
|
+
es.onopen = () => { if (!dead) { setLive(true); setErr(null); } };
|
|
657
|
+
es.onmessage = (ev) => {
|
|
658
|
+
try {
|
|
659
|
+
const j = JSON.parse(ev.data);
|
|
660
|
+
if (!dead) { SNAP_CACHE = j; setSnap(j); setErr(null); setLive(true); }
|
|
661
|
+
} catch { /* 忽略坏帧 */ }
|
|
662
|
+
};
|
|
663
|
+
es.onerror = () => { if (!dead) setLive(false); };
|
|
664
|
+
} catch {
|
|
665
|
+
poll = setInterval(fetchOnce, 5000);
|
|
666
|
+
}
|
|
667
|
+
return () => { dead = true; window.removeEventListener("bufeng:refresh", onRefresh); if (es) es.close(); if (poll) clearInterval(poll); };
|
|
668
|
+
}, []);
|
|
669
|
+
return { snap, err, live };
|
|
670
|
+
}
|
|
671
|
+
return { usebufengSnapshot };
|
|
672
|
+
})();
|
|
673
|
+
/* ============================== src/ui.js ============================== */
|
|
674
|
+
__mods["ui.js"] = (() => {
|
|
675
|
+
const { h } = __mods["react.js"];
|
|
676
|
+
/**
|
|
677
|
+
* client/src/ui.js — 状态语义 / 原子件 / 格式化(四态色/状态点/状态词/徽章/时间与文本裁剪)。
|
|
678
|
+
*/
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
/* ---------- 状态语义:宿主 StateDot 四态(ongoing 蓝 / idle 灰 / done 绿 / error 红)+ 捕风扩展 ---------- */
|
|
682
|
+
function stateView(status) {
|
|
683
|
+
switch (status) {
|
|
684
|
+
case "running": return { c: "var(--dsw-alias-state-business-primary, #4f7cf0)", w: "运行中", running: true };
|
|
685
|
+
case "working": return { c: "var(--dsw-alias-state-business-primary, #4f7cf0)", w: "总管工作中", running: true }; // v0.20.0 总管会话活动感知(identity-hook 写,step 结束回 idle)
|
|
686
|
+
case "pending": return { c: "var(--dsw-alias-state-warn-primary, #d8a516)", w: "排队中" };
|
|
687
|
+
case "idle": return { c: "var(--dsw-alias-state-idle-primary, #8b949e)", w: "待命" };
|
|
688
|
+
case "paused": return { c: "var(--dsw-alias-state-warn-primary, #d8a516)", w: "已暂停" };
|
|
689
|
+
case "done": return { c: "var(--dsw-alias-state-success-primary, #2f9e44)", w: "已完成" };
|
|
690
|
+
case "failed": return { c: "var(--dsw-alias-state-error-primary, #e5484d)", w: "失败", error: true };
|
|
691
|
+
case "active": return { c: "var(--dsw-alias-state-success-primary, #2f9e44)", w: "活跃" };
|
|
692
|
+
case "retired": return { c: "var(--dsw-alias-label-tertiary, #777)", w: "已退役" };
|
|
693
|
+
case "archived": return { c: "var(--dsw-alias-label-tertiary, #777)", w: "已归档" };
|
|
694
|
+
default: return { c: "var(--dsw-alias-label-tertiary, #777)", w: String(status || "未知") };
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
function Dot({ s }) {
|
|
698
|
+
const v = stateView(s);
|
|
699
|
+
return h("span", { className: "bf-dot", title: v.w,
|
|
700
|
+
style: { background: v.c, boxShadow: v.running ? "0 0 6px " + v.c : "none" } });
|
|
701
|
+
}
|
|
702
|
+
function StateWord({ s }) {
|
|
703
|
+
const v = stateView(s);
|
|
704
|
+
return h("span", { style: { color: v.c, flex: "none" } }, v.w);
|
|
705
|
+
}
|
|
706
|
+
function Badge({ tone, title, children }) {
|
|
707
|
+
return h("span", { className: "bf-badge", "data-tone": tone || "", title }, children);
|
|
708
|
+
}
|
|
709
|
+
function fmtTime(iso) {
|
|
710
|
+
if (!iso) return "";
|
|
711
|
+
try {
|
|
712
|
+
const d = new Date(iso);
|
|
713
|
+
return isNaN(d.getTime()) ? String(iso)
|
|
714
|
+
: d.toLocaleString("zh-CN", { month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit" });
|
|
715
|
+
} catch { return String(iso); }
|
|
716
|
+
}
|
|
717
|
+
function clip(s, n) { s = String(s || ""); return s.length > n ? s.slice(0, n) + "…" : s; }
|
|
718
|
+
const LINE = "var(--dsw-alias-border-l2, rgba(128,128,128,0.25))";
|
|
719
|
+
const DIM = { color: "var(--dsw-alias-label-secondary, #999)", fontSize: 12 };
|
|
720
|
+
const LABEL = { color: "var(--dsw-alias-label-primary, #eee)" };
|
|
721
|
+
|
|
722
|
+
/* ---------- 任务状态语义(v0.25 批2-T4 任务看板):与节点 stateView 分离——pending 两域语义不同
|
|
723
|
+
* (任务域 pending=投递中占位(queued=项目排队待接力,批2-T2),节点域 pending=节点排队中)。
|
|
724
|
+
* 枚举与 lib/board/taskview.js TASK_STATUSES 同源:queued/pending/running/done/failed/cancelled。 */
|
|
725
|
+
const TASK_STATUS_ORDER = ["queued", "pending", "running", "done", "failed", "cancelled"];
|
|
726
|
+
const TASK_STATUS_VIEW = {
|
|
727
|
+
queued: { c: "var(--dsw-alias-state-warn-primary, #d8a516)", w: "排队中" },
|
|
728
|
+
pending: { c: "var(--dsw-alias-state-business-primary, #4f7cf0)", w: "投递中" },
|
|
729
|
+
running: { c: "var(--dsw-alias-state-business-primary, #4f7cf0)", w: "运行中", running: true },
|
|
730
|
+
done: { c: "var(--dsw-alias-state-success-primary, #2f9e44)", w: "已完成" },
|
|
731
|
+
failed: { c: "var(--dsw-alias-state-error-primary, #e5484d)", w: "失败", error: true },
|
|
732
|
+
cancelled: { c: "var(--dsw-alias-label-tertiary, #777)", w: "已取消" },
|
|
733
|
+
};
|
|
734
|
+
function taskStatusView(s) {
|
|
735
|
+
return TASK_STATUS_VIEW[s] || { c: "var(--dsw-alias-label-tertiary, #777)", w: String(s || "未知") };
|
|
736
|
+
}
|
|
737
|
+
function TaskDot({ s }) {
|
|
738
|
+
const v = taskStatusView(s);
|
|
739
|
+
return h("span", { className: "bf-dot", title: v.w,
|
|
740
|
+
style: { background: v.c, boxShadow: v.running ? "0 0 6px " + v.c : "none" } });
|
|
741
|
+
}
|
|
742
|
+
function TaskStateWord({ s }) {
|
|
743
|
+
const v = taskStatusView(s);
|
|
744
|
+
return h("span", { style: { color: v.c, flex: "none" } }, v.w);
|
|
745
|
+
}
|
|
746
|
+
return { stateView, Dot, StateWord, Badge, fmtTime, clip, LINE, DIM, LABEL, TASK_STATUS_ORDER, taskStatusView, TaskDot, TaskStateWord };
|
|
747
|
+
})();
|
|
748
|
+
/* ============================== src/icons.js ============================== */
|
|
749
|
+
__mods["icons.js"] = (() => {
|
|
750
|
+
const { h } = __mods["react.js"];
|
|
751
|
+
/**
|
|
752
|
+
* client/src/icons.js — v0.24.0「星枢」三角色 SVG 资产(方案 A 定稿,形状/配色源=tmp/icons/v0.24.0-角色图标候选.html)。
|
|
753
|
+
* 三角色 × 三档(16/24/48):总管=紫罗盘中枢节点(radialGradient ga1 #a5b4fc→#5b21b6,辐射三链路+罗盘针)、
|
|
754
|
+
* 都管=青盾带队节点(linearGradient ga2 #2dd4bf→#0f766e)、成员=琥珀齿轮(linearGradient ga3 #fbbf24→#d97706)。
|
|
755
|
+
* 渐变 id 同页多实例去重:每实例 uid 后缀(ga1-<uid>),uid 由调用方给(节点 id/任务 id/固定串),缺省走模块内自增。
|
|
756
|
+
* 依赖方向:仅依赖 react(与 ui/data/styles 同层;供 graph/cards/tasks/settings/board 引用,禁止反向)。
|
|
757
|
+
*/
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
/* kind → 角色:兼容新旧账本数据值(root=新账本根节点 kind;orchestrator=旧账本兼容读)+ 显示词(总管/都管/队长/成员) */
|
|
761
|
+
const KIND_ROLE = {
|
|
762
|
+
"root": "orchestrator", "orchestrator": "orchestrator", "总管": "orchestrator",
|
|
763
|
+
"leader": "leader", "都管": "leader", "队长": "leader",
|
|
764
|
+
"member": "member", "成员": "member",
|
|
765
|
+
};
|
|
766
|
+
|
|
767
|
+
/* v0.24.0 根节点判定:root=新账本根节点 kind,orchestrator=旧账本兼容读——graph 根收集/过滤与 board hasOrch 共用,防多处漂移 */
|
|
768
|
+
function isRootKind(k) {
|
|
769
|
+
return k === "root" || k === "orchestrator";
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
let uidSeq = 0;
|
|
773
|
+
const uidOf = (uid) => uid || "u" + (++uidSeq);
|
|
774
|
+
|
|
775
|
+
/* 三枚形状 1:1 取自候选页方案 A(viewBox 0 0 64 64,等比缩放到 size);uid 保证 defs 渐变 id 同页唯一 */
|
|
776
|
+
function xingshuSvg(role, uid, size) {
|
|
777
|
+
const s = size || 16;
|
|
778
|
+
if (role === "orchestrator") {
|
|
779
|
+
const g = "ga1-" + uidOf(uid);
|
|
780
|
+
return h("svg", { width: s, height: s, viewBox: "0 0 64 64", "aria-hidden": true, style: { flex: "none" } },
|
|
781
|
+
h("defs", null, h("radialGradient", { id: g, cx: "35%", cy: "30%" },
|
|
782
|
+
h("stop", { offset: "0%", stopColor: "#a5b4fc" }),
|
|
783
|
+
h("stop", { offset: "100%", stopColor: "#5b21b6" }))),
|
|
784
|
+
h("g", { stroke: "#c7d2fe", strokeWidth: 2.5 },
|
|
785
|
+
h("line", { x1: 32, y1: 30, x2: 11, y2: 13 }),
|
|
786
|
+
h("line", { x1: 32, y1: 30, x2: 53, y2: 13 }),
|
|
787
|
+
h("line", { x1: 32, y1: 30, x2: 32, y2: 56 })),
|
|
788
|
+
h("circle", { cx: 11, cy: 13, r: 3.6, fill: "#a5b4fc" }),
|
|
789
|
+
h("circle", { cx: 53, cy: 13, r: 3.6, fill: "#a5b4fc" }),
|
|
790
|
+
h("circle", { cx: 32, cy: 56, r: 3.6, fill: "#a5b4fc" }),
|
|
791
|
+
h("circle", { cx: 32, cy: 30, r: 13.5, fill: "url(#" + g + ")" }),
|
|
792
|
+
h("path", { d: "M32 19.5 L36.6 30 L27.4 30 Z", fill: "#eef2ff" }),
|
|
793
|
+
h("path", { d: "M32 40.5 L36.6 30 L27.4 30 Z", fill: "#ffffff", opacity: 0.55 }),
|
|
794
|
+
h("circle", { cx: 32, cy: 30, r: 13.5, fill: "none", stroke: "#ffffff", strokeOpacity: 0.35, strokeWidth: 1.5 }));
|
|
795
|
+
}
|
|
796
|
+
if (role === "leader") {
|
|
797
|
+
const g = "ga2-" + uidOf(uid);
|
|
798
|
+
return h("svg", { width: s, height: s, viewBox: "0 0 64 64", "aria-hidden": true, style: { flex: "none" } },
|
|
799
|
+
h("defs", null, h("linearGradient", { id: g, x1: 0, y1: 0, x2: 0, y2: 1 },
|
|
800
|
+
h("stop", { offset: "0%", stopColor: "#2dd4bf" }),
|
|
801
|
+
h("stop", { offset: "100%", stopColor: "#0f766e" }))),
|
|
802
|
+
h("path", { d: "M32 7 L52 14.5 V31 C52 45.5 43.5 53.5 32 57.5 C20.5 53.5 12 45.5 12 31 V14.5 Z", fill: "url(#" + g + ")" }),
|
|
803
|
+
h("circle", { cx: 32, cy: 25.5, r: 4.6, fill: "#ccfbf1" }),
|
|
804
|
+
h("g", { stroke: "#99f6e4", strokeWidth: 2.6 },
|
|
805
|
+
h("line", { x1: 32, y1: 25.5, x2: 23.5, y2: 42 }),
|
|
806
|
+
h("line", { x1: 32, y1: 25.5, x2: 40.5, y2: 42 })),
|
|
807
|
+
h("circle", { cx: 23.5, cy: 42, r: 3.2, fill: "#99f6e4" }),
|
|
808
|
+
h("circle", { cx: 40.5, cy: 42, r: 3.2, fill: "#99f6e4" }));
|
|
809
|
+
}
|
|
810
|
+
const g = "ga3-" + uidOf(uid);
|
|
811
|
+
return h("svg", { width: s, height: s, viewBox: "0 0 64 64", "aria-hidden": true, style: { flex: "none" } },
|
|
812
|
+
h("defs", null, h("linearGradient", { id: g, x1: 0, y1: 0, x2: 0, y2: 1 },
|
|
813
|
+
h("stop", { offset: "0%", stopColor: "#fbbf24" }),
|
|
814
|
+
h("stop", { offset: "100%", stopColor: "#d97706" }))),
|
|
815
|
+
h("g", { fill: "url(#" + g + ")" },
|
|
816
|
+
h("circle", { cx: 32, cy: 32, r: 14 }),
|
|
817
|
+
h("rect", { x: 29.4, y: 6, width: 5.2, height: 11, rx: 2.2 }),
|
|
818
|
+
h("rect", { x: 29.4, y: 47, width: 5.2, height: 11, rx: 2.2 }),
|
|
819
|
+
h("rect", { x: 29.4, y: 6, width: 5.2, height: 11, rx: 2.2, transform: "rotate(45 32 32)" }),
|
|
820
|
+
h("rect", { x: 29.4, y: 47, width: 5.2, height: 11, rx: 2.2, transform: "rotate(45 32 32)" }),
|
|
821
|
+
h("rect", { x: 29.4, y: 6, width: 5.2, height: 11, rx: 2.2, transform: "rotate(90 32 32)" }),
|
|
822
|
+
h("rect", { x: 29.4, y: 47, width: 5.2, height: 11, rx: 2.2, transform: "rotate(90 32 32)" }),
|
|
823
|
+
h("rect", { x: 29.4, y: 6, width: 5.2, height: 11, rx: 2.2, transform: "rotate(135 32 32)" }),
|
|
824
|
+
h("rect", { x: 29.4, y: 47, width: 5.2, height: 11, rx: 2.2, transform: "rotate(135 32 32)" })),
|
|
825
|
+
h("circle", { cx: 32, cy: 32, r: 6, fill: "#fffbeb" }),
|
|
826
|
+
h("circle", { cx: 32, cy: 32, r: 2.4, fill: "#d97706" }));
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
/* 主入口:kind 收数据值或显示词,未知一律按成员兜底 */
|
|
830
|
+
function RoleIcon({ kind, uid, size }) {
|
|
831
|
+
return xingshuSvg(KIND_ROLE[kind] || "member", uid, size);
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
/* 三档定档导出:16(节点卡/任务行标记)· 24(设置页图例)· 48(空态/展示位) */
|
|
835
|
+
const ROLE_ICON_SIZES = [16, 24, 48];
|
|
836
|
+
function RoleIconSm({ kind, uid }) { return xingshuSvg(KIND_ROLE[kind] || "member", uid, 16); }
|
|
837
|
+
function RoleIconMd({ kind, uid }) { return xingshuSvg(KIND_ROLE[kind] || "member", uid, 24); }
|
|
838
|
+
function RoleIconLg({ kind, uid }) { return xingshuSvg(KIND_ROLE[kind] || "member", uid, 48); }
|
|
839
|
+
return { ROLE_ICON_SIZES, isRootKind, RoleIcon, RoleIconSm, RoleIconMd, RoleIconLg };
|
|
840
|
+
})();
|
|
841
|
+
/* ============================== src/cards.js ============================== */
|
|
842
|
+
__mods["cards.js"] = (() => {
|
|
843
|
+
const { h, useState } = __mods["react.js"];
|
|
844
|
+
const { Dot, StateWord, stateView, LABEL, DIM, LINE } = __mods["ui.js"];
|
|
845
|
+
const { RoleIconSm, isRootKind } = __mods["icons.js"];
|
|
846
|
+
/**
|
|
847
|
+
* client/src/cards.js — 两段式节点卡 / 树枝 / 全林自我提升按钮 / 节点会话模型直配(v0.40.8 阶段1,承 v0.24.1-B 契约)
|
|
848
|
+
* (统计卡已随 v0.13.0 tab 化移除;弹窗内模型弹层 ModelCtl 随 v0.40.8 弹窗瘦身退役,配置入口落回地图卡)。
|
|
849
|
+
*/
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
/* ---------- 全林自我提升按钮:两段式确认(iframe 无 confirm),向全部 active 工坊逐坊下发 ---------- */
|
|
855
|
+
function ImproveBtnAll({ trees, small }) {
|
|
856
|
+
const [st, setSt] = useState("idle"); // idle | armed | busy
|
|
857
|
+
const [msg, setMsg] = useState("");
|
|
858
|
+
const fire = async () => {
|
|
859
|
+
const active = (trees || []).filter((t) => t.status === "active");
|
|
860
|
+
if (!active.length) { setMsg("没有 active 工坊可提升"); setTimeout(() => setMsg(""), 5000); return; }
|
|
861
|
+
setSt("busy"); setMsg("下发中…");
|
|
862
|
+
let okTrees = 0, okTasks = 0, fail = 0, note = "";
|
|
863
|
+
for (const t of active) {
|
|
864
|
+
try {
|
|
865
|
+
const r = await fetch("/bufeng/api/improve", { method: "POST",
|
|
866
|
+
headers: { "content-type": "application/json" },
|
|
867
|
+
body: JSON.stringify({ treeId: t.id }) });
|
|
868
|
+
const j = await r.json().catch(() => ({}));
|
|
869
|
+
if (r.ok && j.ok) { okTrees++; okTasks += j.dispatched ?? 0; if (j.note) note = j.note; }
|
|
870
|
+
else fail++;
|
|
871
|
+
} catch { fail++; }
|
|
872
|
+
}
|
|
873
|
+
setMsg("已向 " + okTrees + " 个工坊下发 " + okTasks + " 条自省任务" + (fail ? "(" + fail + " 个失败)" : "") + (note ? "(" + note + ")" : ""));
|
|
874
|
+
setSt("idle");
|
|
875
|
+
setTimeout(() => setMsg(""), 8000);
|
|
876
|
+
};
|
|
877
|
+
const click = () => {
|
|
878
|
+
if (st === "busy") return;
|
|
879
|
+
if (st === "armed") { fire(); return; }
|
|
880
|
+
setSt("armed");
|
|
881
|
+
setTimeout(() => setSt((s) => (s === "armed" ? "idle" : s)), 4000);
|
|
882
|
+
};
|
|
883
|
+
return h("span", { style: { display: "inline-flex", alignItems: "center", gap: 6 } },
|
|
884
|
+
h("button", { className: "bf-ctl bf-imp", disabled: st === "busy",
|
|
885
|
+
title: "向全部 active 工坊的都管逐层下发自我提升自省(提案≠执行)。点一次进入确认态,再点执行。",
|
|
886
|
+
/* stopPropagation:画布 onPointerDown 拖拽平移会吞掉按钮 click(与折叠按钮同款修复,v0.13.2) */
|
|
887
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
888
|
+
onClick: (e) => { e.stopPropagation(); click(); },
|
|
889
|
+
style: { border: "1px solid " + (st === "armed" ? "var(--dsw-alias-state-warn-primary, #d8a516)" : LINE),
|
|
890
|
+
color: st === "armed" ? "var(--dsw-alias-state-warn-label, #d8a516)" : undefined,
|
|
891
|
+
height: small ? 20 : undefined, fontSize: small ? 11 : undefined } },
|
|
892
|
+
st === "armed" ? "再点确认" : st === "busy" ? "下发中…" : "⏫ 提升"),
|
|
893
|
+
msg ? h("span", { className: "bf-meta" }, msg) : null);
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
/* ---------- 节点删除按钮:两段式确认,POST /bufeng/api/retire(看板=司南代行,v0.16.1) ---------- */
|
|
897
|
+
function RetireBtn({ nodeId, small }) {
|
|
898
|
+
const [st, setSt] = useState("idle"); // idle | armed | busy
|
|
899
|
+
const fire = async () => {
|
|
900
|
+
setSt("busy");
|
|
901
|
+
try {
|
|
902
|
+
const r = await fetch("/bufeng/api/retire", { method: "POST",
|
|
903
|
+
headers: { "content-type": "application/json" },
|
|
904
|
+
body: JSON.stringify({ nodeId }) });
|
|
905
|
+
const j = await r.json().catch(() => ({}));
|
|
906
|
+
setSt("idle");
|
|
907
|
+
if (!(r.ok && j.ok)) setTimeout(() => setSt("err"), 0);
|
|
908
|
+
} catch { setSt("err"); }
|
|
909
|
+
setTimeout(() => setSt((s) => (s === "err" ? "idle" : s)), 6000);
|
|
910
|
+
};
|
|
911
|
+
const click = () => {
|
|
912
|
+
if (st === "busy") return;
|
|
913
|
+
if (st === "armed") { fire(); return; }
|
|
914
|
+
setSt("armed");
|
|
915
|
+
setTimeout(() => setSt((s) => (s === "armed" ? "idle" : s)), 4000);
|
|
916
|
+
};
|
|
917
|
+
return h("button", { className: "bf-ctl bf-retire", disabled: st === "busy", "data-bf-retire": "1",
|
|
918
|
+
"aria-label": "退役该节点",
|
|
919
|
+
title: "退役该节点(真实删除:节点行从编制移除、不再保留 retired 档案行,动作在事件史留痕;执行中须等任务完成)。点一次进入确认态,再点执行。",
|
|
920
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
921
|
+
onClick: (e) => { e.stopPropagation(); click(); },
|
|
922
|
+
style: { border: "1px solid " + (st === "armed" ? "var(--dsw-alias-state-error-primary, #e5534b)" : LINE),
|
|
923
|
+
color: st === "armed" || st === "err" ? "var(--dsw-alias-state-error-label, #e5534b)" : DIM.color,
|
|
924
|
+
height: small ? 20 : undefined, fontSize: small ? 11 : undefined } },
|
|
925
|
+
st === "armed" ? "确认退役" : st === "busy" ? "退役中…" : st === "err" ? "失败/重试" : "✕ 退役");
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
/* ---------- 节点会话模型直配(v0.40.8 阶段1,承 v0.24.1-B 契约):地图卡三级联动直选,选中即提交 ----------
|
|
929
|
+
* 数据契约(A 阶段定,字段名精确):snap.modelCatalog =
|
|
930
|
+
* { default:{provider,model}|null, groups:[{id,name,models:[{id,name,description?,
|
|
931
|
+
* reasoning?:{efforts:[{id,name,description?}],defaultEffort?}}]}], failures:[{id,name,message}] } | null
|
|
932
|
+
* (null=宿主未暴露 sessionController.modelCatalog,旧宿主);
|
|
933
|
+
* node.model = {provider, model, reasoningEffort?} | null(null=未配置跟随默认)。
|
|
934
|
+
* 写契约(B' 并行单定,勿自造):POST /bufeng/api/node/update body {treeId, nodeId, model}
|
|
935
|
+
* → 成功 {ok:true, node:{id,name,model}};校验失败 {ok:false, error:<文案>}。
|
|
936
|
+
* v0.40.8 阶段1:弹窗「节点操作」整块退役后,配置入口落回地图节点卡——旧弹层 ModelCtl
|
|
937
|
+
* 退役,改三级联动直选:provider 定组(草稿步)、model 定档(选中即提交)、强度随模型
|
|
938
|
+
* reasoning.efforts 动态生成(选中即提交);「跟随默认」=provider 空选项,选中即 model:null。
|
|
939
|
+
* 三态降级:①catalog=null → 只读提示,不报错不炸;②某 provider 在 failures[] → 该组不渲染并提示,
|
|
940
|
+
* 其余组正常,全失败 → 只读;③快照中途 catalog 从有变 null → 回落只读态。
|
|
941
|
+
* 总管(root)卡锁定「跟随会话」不可编辑(UI 层先锁,不发写请求)。 */
|
|
942
|
+
function modelStateLabel(m) {
|
|
943
|
+
if (!m || !m.provider || !m.model) return "跟随默认";
|
|
944
|
+
return m.provider + "/" + m.model + (m.reasoningEffort ? "(强度 " + m.reasoningEffort + ")" : "");
|
|
945
|
+
}
|
|
946
|
+
function ModelDirectCtl({ node, treeId, catalog }) {
|
|
947
|
+
const [prov, setProv] = useState(undefined); // 草稿 provider(undefined=未动草稿,显示已提交现值)
|
|
948
|
+
const [pick, setPick] = useState(undefined); // 草稿 model id(undefined=未动草稿,显示已提交现值)
|
|
949
|
+
const [effort, setEffort] = useState(undefined); // undefined=未动草稿(显示已提交现值);""=显式跟随模型默认强度(不传 reasoningEffort)
|
|
950
|
+
const [busy, setBusy] = useState(false);
|
|
951
|
+
const [err, setErr] = useState("");
|
|
952
|
+
const [okMsg, setOkMsg] = useState("");
|
|
953
|
+
const [override, setOverride] = useState(undefined); // 写成功即时落卡(账本为权威,下轮 SSE 刷新对齐)
|
|
954
|
+
const isRoot = isRootKind(node && node.kind);
|
|
955
|
+
const ledger = (node && node.model) ?? null;
|
|
956
|
+
const cur = override !== undefined ? override : ledger;
|
|
957
|
+
const cat = catalog && typeof catalog === "object" ? catalog : null;
|
|
958
|
+
const failedIds = new Set(((cat && cat.failures) || []).map((f) => f && f.id).filter(Boolean));
|
|
959
|
+
const groups = (((cat && cat.groups) || [])).filter((g) => g && Array.isArray(g.models)
|
|
960
|
+
&& !failedIds.has(g.id) && g.models.some(Boolean));
|
|
961
|
+
const hasCat = !!cat;
|
|
962
|
+
const failedNames = ((cat && cat.failures) || []).map((f) => (f && (f.name || f.id)) || "").filter(Boolean).join("、");
|
|
963
|
+
const resetDraft = () => { setProv(undefined); setPick(undefined); setEffort(undefined); };
|
|
964
|
+
const post = async (model, okText) => {
|
|
965
|
+
if (busy) return;
|
|
966
|
+
setBusy(true); setErr(""); setOkMsg("");
|
|
967
|
+
try {
|
|
968
|
+
const r = await fetch("/bufeng/api/node/update", { method: "POST",
|
|
969
|
+
headers: { "content-type": "application/json" },
|
|
970
|
+
body: JSON.stringify({ treeId, nodeId: node.id, model }) });
|
|
971
|
+
const j = await r.json().catch(() => ({}));
|
|
972
|
+
if (r.ok && j && j.ok) {
|
|
973
|
+
// 写成功:以返回的 node.model 即时更新本地卡片状态(弹窗与卡片同源 snap,SSE 刷新对齐)
|
|
974
|
+
setOverride(j.node && j.node.model !== undefined ? (j.node.model ?? null) : model);
|
|
975
|
+
setOkMsg(okText);
|
|
976
|
+
setTimeout(() => setOkMsg((s) => (s === okText ? "" : s)), 5000);
|
|
977
|
+
} else {
|
|
978
|
+
resetDraft(); // 失败回退:草稿归零=显示回落到已提交现值
|
|
979
|
+
setErr(j && j.error ? String(j.error) : "保存失败(HTTP " + r.status + ")");
|
|
980
|
+
}
|
|
981
|
+
} catch (e) {
|
|
982
|
+
resetDraft();
|
|
983
|
+
setErr("保存失败:" + String((e && e.message) || e));
|
|
984
|
+
}
|
|
985
|
+
setBusy(false);
|
|
986
|
+
};
|
|
987
|
+
/* --- 草稿/现值合成显示口径:现值组不在可用目录(failures/缺组)时按未选中处理 --- */
|
|
988
|
+
const provSel = prov !== undefined ? prov
|
|
989
|
+
: (cur && cur.provider && cur.model && groups.some((g) => g.id === cur.provider) ? cur.provider : "");
|
|
990
|
+
const selGroup = groups.find((g) => g.id === provSel) || null;
|
|
991
|
+
const pickSel = pick !== undefined ? pick
|
|
992
|
+
: (cur && cur.provider === provSel && cur.model && selGroup
|
|
993
|
+
&& selGroup.models.some((m) => m && m.id === cur.model) ? cur.model : "");
|
|
994
|
+
const selModel = selGroup ? selGroup.models.find((m) => m && m.id === pickSel) || null : null;
|
|
995
|
+
const effs = (selModel && selModel.reasoning && selModel.reasoning.efforts) || [];
|
|
996
|
+
const defEff = selModel && selModel.reasoning && selModel.reasoning.defaultEffort;
|
|
997
|
+
const effName = (id) => { const e = effs.find((x) => x && x.id === id); return e ? (e.name || e.id) : id; };
|
|
998
|
+
/* 强度显示口径:草稿未动=显示已提交现值(与 provider/model 同语义);草稿已动=显示草稿(非法值回落空) */
|
|
999
|
+
const effSel = effort !== undefined ? (effs.some((x) => x && x.id === effort) ? effort : "")
|
|
1000
|
+
: (cur && cur.reasoningEffort && effs.some((x) => x && x.id === cur.reasoningEffort) ? cur.reasoningEffort : "");
|
|
1001
|
+
const onProv = (v) => {
|
|
1002
|
+
if (busy) return;
|
|
1003
|
+
setErr(""); setOkMsg("");
|
|
1004
|
+
if (v === "") { setProv(""); setPick(""); setEffort(""); post(null, "已清除配置,恢复跟随默认"); return; }
|
|
1005
|
+
setProv(v); setPick(""); setEffort(""); // provider 草稿步:model 归空,选中模型才提交
|
|
1006
|
+
};
|
|
1007
|
+
const onModel = (mid) => {
|
|
1008
|
+
if (busy || !provSel) return;
|
|
1009
|
+
const mv = selGroup ? selGroup.models.find((m) => m && m.id === mid) : null;
|
|
1010
|
+
if (!mv) return;
|
|
1011
|
+
const effList = (mv.reasoning && mv.reasoning.efforts) || [];
|
|
1012
|
+
const keep = (effort && effList.some((x) => x && x.id === effort) ? effort
|
|
1013
|
+
: (cur && cur.provider === provSel && cur.model === mid && cur.reasoningEffort
|
|
1014
|
+
&& effList.some((x) => x && x.id === cur.reasoningEffort) ? cur.reasoningEffort : "")) || "";
|
|
1015
|
+
setPick(mid); setEffort(keep);
|
|
1016
|
+
const model = { provider: provSel, model: mv.id };
|
|
1017
|
+
if (keep) model.reasoningEffort = keep; // 不传=跟随模型 defaultEffort
|
|
1018
|
+
post(model, "已配置 " + modelStateLabel(model) + (keep ? "" : "(强度跟随默认)"));
|
|
1019
|
+
};
|
|
1020
|
+
const onEff = (v) => {
|
|
1021
|
+
if (busy || !selModel) return;
|
|
1022
|
+
setEffort(v);
|
|
1023
|
+
const model = { provider: provSel, model: selModel.id };
|
|
1024
|
+
if (v) model.reasoningEffort = v;
|
|
1025
|
+
post(model, "已配置 " + modelStateLabel(model));
|
|
1026
|
+
};
|
|
1027
|
+
/* --- 三态:总管锁定 / 降级只读 / 直配三级联动 --- */
|
|
1028
|
+
let body = null;
|
|
1029
|
+
if (isRoot) {
|
|
1030
|
+
body = h("div", { className: "bf-model", title: "总管(根节点)=客户会话,会话模型锁定「跟随会话」,不开放配置" },
|
|
1031
|
+
h("span", { className: "bf-model-main" }, "🔒 跟随会话"));
|
|
1032
|
+
} else if (!hasCat) {
|
|
1033
|
+
const t = cur && cur.provider && cur.model ? modelStateLabel(cur) + "(目录暂不可达·只读)" : "跟随默认(宿主未暴露模型目录)";
|
|
1034
|
+
body = h("div", { className: "bf-model", title: "宿主未暴露 sessionController.modelCatalog(可能宿主版本过旧),暂只能跟随默认,不报错不炸" },
|
|
1035
|
+
h("span", { className: "bf-model-main" }, t));
|
|
1036
|
+
} else if (!groups.length) {
|
|
1037
|
+
body = h("div", { className: "bf-model", title: failedNames ? "模型目录中各 provider 均失败:" + failedNames : "模型目录为空" },
|
|
1038
|
+
h("span", { className: "bf-model-main" }, modelStateLabel(cur) + " · 模型源暂不可用"));
|
|
1039
|
+
} else {
|
|
1040
|
+
body = [
|
|
1041
|
+
h("div", { className: "bf-mrow" },
|
|
1042
|
+
h("select", { className: "bf-model-sel", "data-bf-provsel": "1", "data-bf-nodeid": node.id || "",
|
|
1043
|
+
value: provSel, disabled: busy, "aria-label": "模型源 provider",
|
|
1044
|
+
title: "模型源 provider;选「跟随默认」即清除该节点模型配置(model=null)恢复跟随"
|
|
1045
|
+
+ (failedNames ? ";不可用源:" + failedNames : ""),
|
|
1046
|
+
onChange: (e) => onProv(e.target.value) },
|
|
1047
|
+
h("option", { value: "" }, "跟随默认"),
|
|
1048
|
+
groups.map((g) => h("option", { key: g.id, value: g.id, title: g.name || g.id }, g.name || g.id))),
|
|
1049
|
+
h("select", { className: "bf-model-sel", "data-bf-modelsel": "1", "data-bf-nodeid": node.id || "",
|
|
1050
|
+
value: pickSel, disabled: busy || !provSel, "aria-label": "会话模型 model",
|
|
1051
|
+
title: "会话模型(下一任务会话生效);选中即保存",
|
|
1052
|
+
onChange: (e) => onModel(e.target.value) },
|
|
1053
|
+
h("option", { value: "" }, provSel ? "选择模型…" : "—"),
|
|
1054
|
+
(selGroup ? selGroup.models.filter(Boolean) : []).map((m) => h("option",
|
|
1055
|
+
{ key: m.id, value: m.id, title: m.description || undefined },
|
|
1056
|
+
(m.name || m.id) + (cat.default && cat.default.provider === provSel && cat.default.model === m.id ? " ★" : ""))))),
|
|
1057
|
+
effs.length ? h("div", { className: "bf-mrow" },
|
|
1058
|
+
h("select", { className: "bf-model-sel", "data-bf-effsel": "1", "data-bf-nodeid": node.id || "",
|
|
1059
|
+
value: effSel, disabled: busy, "aria-label": "思考强度 reasoningEffort",
|
|
1060
|
+
title: "思考强度(选项取自模型目录 reasoning.efforts,不写死枚举);「跟随默认」=恢复模型默认强度",
|
|
1061
|
+
onChange: (e) => onEff(e.target.value) },
|
|
1062
|
+
h("option", { value: "" }, "跟随默认" + (defEff ? "(" + effName(defEff) + ")" : "")),
|
|
1063
|
+
effs.map((ef) => h("option", { key: ef.id, value: ef.id, title: ef.description || undefined }, ef.name || ef.id)))) : null,
|
|
1064
|
+
err ? h("div", { className: "bf-mtail" },
|
|
1065
|
+
h("div", { className: "bf-model-msg", title: err,
|
|
1066
|
+
style: { color: "var(--dsw-alias-state-error-label, #e5484d)" } }, "✕ " + err)) : null,
|
|
1067
|
+
okMsg ? h("div", { className: "bf-mtail" },
|
|
1068
|
+
h("div", { className: "bf-model-msg",
|
|
1069
|
+
style: { color: "var(--dsw-alias-state-success-primary, #2f9e44)" } }, "✓ " + okMsg)) : null,
|
|
1070
|
+
failedNames ? h("div", { className: "bf-mtail" },
|
|
1071
|
+
h("div", { className: "bf-model-msg", style: DIM, title: failedNames },
|
|
1072
|
+
"⚠ " + ((cat.failures || []).length) + " 个模型源暂不可用")) : null];
|
|
1073
|
+
}
|
|
1074
|
+
return h("div", { className: "bf-modelhost", "data-bf-modelhost": "1", "data-bf-nodeid": (node && node.id) || "" },
|
|
1075
|
+
body);
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
/* ---------- 两段式节点卡(照搬 tasks-card:TOP=身份 / bar=状态;v0.24.1-B +modelCtl 模型配置段;
|
|
1079
|
+
* v0.40.8 阶段1 +corner 卡角操作位——「✕ 退役」两段确认钮的常驻位,absolute 右上角) ---------- */
|
|
1080
|
+
function TwoSeg({ depth, accent, error, settled, kind, kindTone, uid, badges, name, meta, state, stateText, activity, corner, barExtra, modelCtl, equipBadge, onFold, foldLabel, title, runsBadge, runsPanel }) {
|
|
1081
|
+
return h("div", { className: "bf-card bf-d" + (depth ?? 2) + (settled ? " bf-settled" : ""),
|
|
1082
|
+
"data-accent": accent ? "1" : undefined, "data-error": error ? "1" : undefined, title },
|
|
1083
|
+
corner ? h("div", { className: "bf-corner" }, corner) : null, // v0.40.8 阶段1:卡角「✕ 退役」
|
|
1084
|
+
h("div", { className: "bf-top" },
|
|
1085
|
+
h("div", { className: "bf-badges" },
|
|
1086
|
+
kind ? h(RoleIconSm, { kind, uid }) : null, // v0.24.0 星枢角色图标(节点卡/根节点卡落位)
|
|
1087
|
+
h("span", { className: "bf-kind", style: kindTone ? { color: kindTone, borderColor: kindTone } : null }, kind),
|
|
1088
|
+
badges || null),
|
|
1089
|
+
h("div", { className: "bf-name" }, name),
|
|
1090
|
+
meta ? h("div", { className: "bf-meta" }, meta) : null),
|
|
1091
|
+
h("div", { className: "bf-bar", "data-running": state === "running" ? "true" : "false" },
|
|
1092
|
+
h(Dot, { s: state }),
|
|
1093
|
+
stateText ? h("span", { style: { color: stateView(state).c, flex: "none" } }, stateText) : h(StateWord, { s: state }),
|
|
1094
|
+
h("span", { className: "bf-act", title: activity }, activity || ""),
|
|
1095
|
+
runsBadge || null, // v0.40.7 工作项一:「运行中 ×N」并发徽标(N≥2 才出现)
|
|
1096
|
+
barExtra || null,
|
|
1097
|
+
onFold ? h("button", { className: "bf-fold", onClick: (e) => { e.stopPropagation(); onFold(e); }, title: foldLabel }, foldLabel) : null),
|
|
1098
|
+
modelCtl || null,
|
|
1099
|
+
runsPanel || null, // v0.40.7 工作项一:在跑任务展开列表(标题+已耗时,逐项进任务详情)
|
|
1100
|
+
equipBadge || null); // v0.31 阶段1:能力面概览徽章行(EquipBadge 点击开详情弹窗——原三段长文案收进弹窗降噪)
|
|
1101
|
+
}
|
|
1102
|
+
function Twig({ children }) {
|
|
1103
|
+
return h("div", { className: "bf-twig" },
|
|
1104
|
+
h("div", { className: "bf-twig-rail" }),
|
|
1105
|
+
children);
|
|
1106
|
+
}
|
|
1107
|
+
return { TwoSeg, Twig, ImproveBtnAll, RetireBtn, ModelDirectCtl };
|
|
1108
|
+
})();
|
|
1109
|
+
/* ============================== src/prompt.js ============================== */
|
|
1110
|
+
__mods["prompt.js"] = (() => {
|
|
1111
|
+
const { h } = __mods["react.js"];
|
|
1112
|
+
const { clip, DIM } = __mods["ui.js"];
|
|
1113
|
+
/**
|
|
1114
|
+
* client/src/prompt.js — 任务提示词装配(task.promptManifest → 7 段只读视图)。
|
|
1115
|
+
* 同一组件同时用于任务看板「提示词装配」子 tab 与智能体抽屉「本次任务」scope,避免两处漂移。
|
|
1116
|
+
*/
|
|
1117
|
+
|
|
1118
|
+
|
|
1119
|
+
|
|
1120
|
+
function segLabel(s) {
|
|
1121
|
+
return ({
|
|
1122
|
+
head: '身份段', nodeSystemPrompt: '节点补充指令', projectNote: '项目上下文', lessonsNote: '教训',
|
|
1123
|
+
wsNote: '工作区', taskTitle: '任务标题', taskDetail: '任务详情', acceptanceNote: '验收标准', duties: '职责约束',
|
|
1124
|
+
})[s] || s;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
function promptBody(s, k, maps) {
|
|
1128
|
+
const node = k.nodeId ? maps.nodeById[k.nodeId] : null;
|
|
1129
|
+
const proj = k.projectId ? maps.projById[k.projectId] : null;
|
|
1130
|
+
if (s.seg === 'nodeSystemPrompt') {
|
|
1131
|
+
const txt = (node && node.systemPrompt) || '';
|
|
1132
|
+
return txt ? h('pre', { className: 'bf-tp-pre' }, txt) : h('span', { className: 'bf-meta' }, '节点未设置补充指令(该段为空,不投递)');
|
|
1133
|
+
}
|
|
1134
|
+
if (s.seg === 'projectNote') {
|
|
1135
|
+
return proj ? h('div', null,
|
|
1136
|
+
h('div', { className: 'bf-tp-kv' }, h('span', null, '项目'), h('b', null, proj.name || proj.id)),
|
|
1137
|
+
h('div', { className: 'bf-tp-kv' }, h('span', null, '目录'), h('b', { className: 'bf-mono' }, proj.path || '—')),
|
|
1138
|
+
h('div', { className: 'bf-tp-kv' }, h('span', null, '说明'), h('b', null, clip(proj.desc || '—', 120))),
|
|
1139
|
+
h('div', { className: 'bf-tp-note' }, '只注入本次任务,不属于智能体自身提示词'))
|
|
1140
|
+
: h('span', { className: 'bf-meta' }, '本任务未绑定 projectId,无项目段');
|
|
1141
|
+
}
|
|
1142
|
+
if (s.seg === 'taskTitle') return h('div', null, k.title || k.id);
|
|
1143
|
+
if (s.seg === 'taskDetail') return k.detail
|
|
1144
|
+
? h('pre', { className: 'bf-tp-pre' }, k.detail)
|
|
1145
|
+
: h('div', { className: 'bf-tp-note' }, '任务正文未在 /api/tasks 返回;投递内容指纹 sha ' + (s.sha || '—'));
|
|
1146
|
+
if (s.seg === 'acceptanceNote') return h('pre', { className: 'bf-tp-pre' }, k.acceptance || '(无验收标准)');
|
|
1147
|
+
if (s.seg === 'duties') return h('div', { className: 'bf-tp-note' }, '职责模板在 lib/domain.js,按 kind 生成;随插件发版。sha ' + (s.sha || '—'));
|
|
1148
|
+
if (s.seg === 'head') return h('div', null,
|
|
1149
|
+
h('div', { className: 'bf-tp-kv' }, h('span', null, '节点'), h('b', null, (node && node.name) || k.nodeId || '—')),
|
|
1150
|
+
h('div', { className: 'bf-tp-kv' }, h('span', null, 'kind'), h('b', null, (node && (node.kindLabel || node.kind)) || '—')),
|
|
1151
|
+
h('div', { className: 'bf-tp-note' }, '身份段由 name/role/kind/tree 生成,不单独存正文'));
|
|
1152
|
+
return h('span', { className: 'bf-meta' }, '来源:' + (s.source || '—'));
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
function PromptAssembly({ k, maps }) {
|
|
1156
|
+
const segs = Array.isArray(k.promptManifest) ? k.promptManifest : [];
|
|
1157
|
+
if (!segs.length) return h('div', { className: 'bf-card', style: { ...DIM, padding: '8px 12px' } }, '无 promptManifest 快照(旧任务/旧宿主),无法还原装配顺序。');
|
|
1158
|
+
return h('div', { 'data-bf-promptasm': '1', className: 'bf-tp' },
|
|
1159
|
+
h('div', { className: 'bf-tp-head' }, h('b', null, '本次任务提示词装配'), h('span', { style: DIM }, segs.length + ' 段 · 投递时快照 · 只读')),
|
|
1160
|
+
segs.map((s, i) => h('div', { key: (s.seg || 'seg') + ':' + i, className: 'bf-tp-seg', 'data-bf-promptseg': s.seg || '' },
|
|
1161
|
+
h('div', { className: 'bf-tp-idx' }, String(i + 1)),
|
|
1162
|
+
h('div', { className: 'bf-tp-body' },
|
|
1163
|
+
h('div', { className: 'bf-tp-segtitle' },
|
|
1164
|
+
h('b', null, segLabel(s.seg)), h('span', { className: 'bf-tp-layer' }, s.layer || ''),
|
|
1165
|
+
h('span', { style: { flex: 1 } }), h('code', null, s.sha || '—')),
|
|
1166
|
+
promptBody(s, k, maps)))));
|
|
1167
|
+
}
|
|
1168
|
+
return { segLabel, promptBody, PromptAssembly };
|
|
1169
|
+
})();
|
|
1170
|
+
/* ============================== src/capabilities.js ============================== */
|
|
1171
|
+
__mods["capabilities.js"] = (() => {
|
|
1172
|
+
const { h, useEffect, useState } = __mods["react.js"];
|
|
1173
|
+
const { PromptAssembly } = __mods["prompt.js"];
|
|
1174
|
+
/**
|
|
1175
|
+
* client/src/capabilities.js — 能力面查看层 v0.61.0 S2 重构:三 tab 压平+市场式装备 tab+分级直装链。
|
|
1176
|
+
* 客户拍板(ADR:docs/决策/2026-10-31-v0.61.0-装备面精简与分级直装.md):装备面精简——
|
|
1177
|
+
* A1 IA:EquipModal 五 tab 压平为三 tab(概览/提示词/装备;旧「推荐」「建议」两独立 tab 与
|
|
1178
|
+
* 历史推荐段/旧建议分区/独立建议单模块全退役(v0.61.0 S2 旧件退役);装备 tab 复演市场式样例基准:顶部 Skill/MCP 双轴 tab
|
|
1179
|
+
* (缺省停 skill)+左列表分组+计数徽标+点击选中态+右详情六要素(名称/来源/描述/推荐理由/安装态/操作区)。
|
|
1180
|
+
* A2 直装分级:仅本地可装备推荐项有「装备」主按钮(loading 防抖→POST /bufeng/api/equip preview→apply
|
|
1181
|
+
* 自动串联,confirm:true+fromPreview 双凭据原样,flow='direct')→回执卡逐字「改动前」「改动后」+previewHash;
|
|
1182
|
+
* 公网候选零「装备」按钮零自动安装,只「复制安装信息」+「目录元数据 · 需人工接入」红线注。
|
|
1183
|
+
* A3/A4:equip 端点请求体增 flow 字段('confirm'|'direct',非法 400,服务端映射 actor);直装回执后
|
|
1184
|
+
* 客户端重拉 suggest(GET)作为刷新证据,服务端唯一失效点=equip apply 成功路径失效 suggest memo。
|
|
1185
|
+
* A5 术语:Skill=默认集(bundled 恒可用,无屏蔽/卸下)/额外项(allowSkills)/推荐;MCP=已挂接/推荐;
|
|
1186
|
+
* 「已安装」仅 MCP 侧;禁用词六词 0 正用;按钮文案「装备」。
|
|
1187
|
+
* A7 patch 按轴精确:屏蔽=denyTools 追加、收窄=白名单收窄、卸下=精确移除目标名;「卸下最后一项」
|
|
1188
|
+
* 不做客户端预判(EQ-13 语义=操作真发请求、服务端拒收空数组四拒文案/403 权限拒透传降级——
|
|
1189
|
+
* 显式清空该轴走 bufeng_update_node equip:<轴>=[])。
|
|
1190
|
+
* 数据契约:snap.capabilities(同 v0.31)+GET /bufeng/api/suggest?treeId=(建议单,只读)+
|
|
1191
|
+
* POST /bufeng/api/equip(preview/apply 双凭据,与工具路径同语义)。旧快照兼容:capabilities/suggest
|
|
1192
|
+
* 缺席一律降级渲染不炸。
|
|
1193
|
+
* 铁律:装备写操作唯一通道=POST /bufeng/api/equip 两段式;弹窗关闭=✕/Esc/遮罩点击;
|
|
1194
|
+
* 宿主全局汇总行常驻弹窗头部;目录快照唯一客户端刷新口=POST /bufeng/api/catalog(横幅刷新钮,
|
|
1195
|
+
* 60min 节流窗口语义服务端原样;成功后自动重拉 suggest);组头「⟳ 刷新推荐」仍只重拉 suggest 零目录写。
|
|
1196
|
+
* 依赖方向:依赖 react.js/ui.js(ui 层)/prompt.js(提示词装配);被 graph.js 引用(cards/ui/data/styles 禁反向)。
|
|
1197
|
+
*/
|
|
1198
|
+
|
|
1199
|
+
// v0.40.8 阶段1:不再 import cards.js 的 ModelCtl/RetireBtn/ImproveBtnAll——「节点操作」块退役后弹窗零操作组件
|
|
1200
|
+
// v0.61.0 S2:DIM(旧装备申请卡置灰用)随申请卡退役移除 import;PromptAssembly(提示词页任务装配)保留。
|
|
1201
|
+
|
|
1202
|
+
// v0.61.0 S2:suggest.js 独立 pane 退役(A8)——建议单数据直连本文件 loadSuggest(GET /bufeng/api/suggest)。
|
|
1203
|
+
|
|
1204
|
+
// v0.61.0 S2:弹窗打开序号(模块级)。EquipBadge onClick 递增;EquipModal effect 以「eqLoadedSeq!==EQ_OPEN_SEQ」
|
|
1205
|
+
// 判定新开弹窗→重拉 suggest。sim 环境 hookStore 跨渲染残留(无真实卸载),递增序号天然幂等防重入;真实 React
|
|
1206
|
+
// 中 EquipModal 按 graph.js key 重挂载为新实例,本序号同样成立(值递增≠旧值→拉取)。
|
|
1207
|
+
let EQ_OPEN_SEQ = 0;
|
|
1208
|
+
let PREV_MOUNT_SEQ = -1; // stub hookStore 跨 key 残留修正:记录上次开窗序号,fresh 时全量重置组件态(模拟真 React key 重挂)
|
|
1209
|
+
let SUG_INFLIGHT = false; // k-mw0ala3c053:刷新推荐在途防抖闸(模块级——闭包新旧同判,渲染间隙二次点击同样 no-op)
|
|
1210
|
+
let CAT_INFLIGHT = false; // 目录快照刷新在途闸(POST /bufeng/api/catalog 四态接线——loading 同步置位防重,终态复位)
|
|
1211
|
+
function bumpEqOpenSeq() { EQ_OPEN_SEQ += 1; } // 开窗序号递增单点(EquipBadge 与 graph 节点卡「同节点直达装备页」分支共用)
|
|
1212
|
+
|
|
1213
|
+
/* ---------- 装备通道 fetch 辅助(v0.48.0 引入,v0.61.0 S2 直装链复用)----------
|
|
1214
|
+
* 装备写操作唯一通道:POST /bufeng/api/equip 两段式。action=preview 只读预览(patch/effects/warnings/previewHash,
|
|
1215
|
+
* 零落盘)→action=apply(confirm+fromPreview+patch 重传,与工具路径 bufeng_capabilities 同语义)。
|
|
1216
|
+
* v0.61.0 A3:请求体增 flow 字段('confirm'|'direct')——服务端校验非法 400 并按 flow 映射 actor(禁客户端自报 actor)。
|
|
1217
|
+
* 错误口径照 settings.js postConfig 范式:!res.ok 或 body.ok===false 一律抛 Error(服务端错误文案透传给 UI)。 */
|
|
1218
|
+
async function postEquip(payload) {
|
|
1219
|
+
const res = await fetch('/bufeng/api/equip', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(payload) });
|
|
1220
|
+
const body = await res.json().catch(() => ({}));
|
|
1221
|
+
if (!res.ok || body.ok === false) throw new Error(body.error || 'HTTP ' + res.status);
|
|
1222
|
+
return body;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
/* ---------- 弹窗区域归属判定(v0.33.1 实机背离修复,k-mvgst62x090)----------
|
|
1226
|
+
* 实机根因(headless Edge + 真实事件复现证据):弹窗经 graph.js 渲染进 .bf-graph 子树,
|
|
1227
|
+
* window 捕获段的双路判定命中为真只是「本句柄自己不吞」,事件继续冒泡到画布 bubble 段
|
|
1228
|
+
* onWheel(无条件 preventDefault+zoomAtClient)→ 弹窗内容不滚、地图照缩放。
|
|
1229
|
+
* 现判定改为「真实元素引用」为先:EquipModal 挂载把弹窗根元素写入 capModalEl、卸载置空;
|
|
1230
|
+
* contains(target)/composedPath 包含 = 区域归属,不依赖类名/属性选择器(防宿主重命名样式类)。
|
|
1231
|
+
* 原双路(composedPath 扫 data-bf-capmodal + target.closest 选择器)保留兜底:
|
|
1232
|
+
* 兼容 shadow 重定向与合成事件桩(sim 三路既有负锚仍真调此函数)。 */
|
|
1233
|
+
let capModalEl = null;
|
|
1234
|
+
function wheelInCapModal(e) {
|
|
1235
|
+
if (!e) return false;
|
|
1236
|
+
if (capModalEl) {
|
|
1237
|
+
if (typeof capModalEl.contains === 'function' && capModalEl.contains(e.target)) return true;
|
|
1238
|
+
if (typeof e.composedPath === 'function') {
|
|
1239
|
+
const path = e.composedPath();
|
|
1240
|
+
if (path && Array.prototype.indexOf.call(path, capModalEl) >= 0) return true;
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
// 兜底甲:composedPath 内找带 data-bf-capmodal 的元素(shadow/portal 形态)
|
|
1244
|
+
if (typeof e.composedPath === 'function') {
|
|
1245
|
+
const path = e.composedPath() || [];
|
|
1246
|
+
for (const n of path) {
|
|
1247
|
+
if (n && n.nodeType === 1 && typeof n.getAttribute === 'function' && n.getAttribute('data-bf-capmodal') === '1') return true;
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
// 兜底乙:target.closest 选择器(普通同文档形态)
|
|
1251
|
+
const t = e.target;
|
|
1252
|
+
return !!(t && typeof t.closest === 'function' && t.closest('[data-bf-capmodal]'));
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
/* ---------- 投影口径:节点可见技能(语义B)/闸后可见 MCP 工具数(allowTools/denyTools) ----------
|
|
1256
|
+
* 技能:undefined=宿主全量;[]=仅默认集(defaultSkill);[...]=默认集∪额外项(额外项按名匹配宿主注册表,未知名丢弃)。
|
|
1257
|
+
* 工具:allowTools 非空=只保留交集;再减 denyTools。caps 缺席=null(徽章显示 —,弹窗降级注)。 */
|
|
1258
|
+
function visibleSkills(caps, eq) {
|
|
1259
|
+
if (!caps || !Array.isArray(caps.skills)) return null;
|
|
1260
|
+
const all = caps.skills.filter(Boolean);
|
|
1261
|
+
const allow = eq && Array.isArray(eq.allowSkills) ? eq.allowSkills : null;
|
|
1262
|
+
if (!allow) return all;
|
|
1263
|
+
const defaults = all.filter((s) => s && s.defaultSkill);
|
|
1264
|
+
if (!allow.length) return defaults;
|
|
1265
|
+
const seen = new Set(defaults.map((s) => s.name));
|
|
1266
|
+
for (const name of allow) {
|
|
1267
|
+
const hit = all.find((s) => s && s.name === name);
|
|
1268
|
+
if (hit && !seen.has(hit.name)) { defaults.push(hit); seen.add(hit.name); }
|
|
1269
|
+
}
|
|
1270
|
+
return defaults;
|
|
1271
|
+
}
|
|
1272
|
+
function visibleToolCount(caps, eq) {
|
|
1273
|
+
if (!caps || !Array.isArray(caps.mcpServers)) return null;
|
|
1274
|
+
const allow = eq && Array.isArray(eq.allowTools) && eq.allowTools.length ? new Set(eq.allowTools) : null;
|
|
1275
|
+
const deny = eq && Array.isArray(eq.denyTools) && eq.denyTools.length ? new Set(eq.denyTools) : null;
|
|
1276
|
+
let n = 0;
|
|
1277
|
+
for (const srv of caps.mcpServers) for (const t of (srv && srv.tools) || []) {
|
|
1278
|
+
if (!t || !t.name) continue;
|
|
1279
|
+
if (allow && !allow.has(t.name)) continue;
|
|
1280
|
+
if (deny && deny.has(t.name)) continue;
|
|
1281
|
+
n++;
|
|
1282
|
+
}
|
|
1283
|
+
return n;
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
/* ---------- 宿主全局汇总行(原「能力面」独立汇总块收编):弹窗头部+空态面板同锚 data-bf-caphead ---------- */
|
|
1287
|
+
function hostCapsText(caps) {
|
|
1288
|
+
if (!caps || typeof caps !== 'object') return '宿主能力面:不可用(旧快照/降级)';
|
|
1289
|
+
const s = Array.isArray(caps.skills) ? caps.skills.length : 0;
|
|
1290
|
+
const m = Array.isArray(caps.mcpServers) ? caps.mcpServers.length : 0;
|
|
1291
|
+
const p = Array.isArray(caps.presets) ? caps.presets.length : 0;
|
|
1292
|
+
return '宿主能力面:技能 ×' + s + ' · MCP 服务器 ×' + m + ' · 预设 ×' + p;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
/* ---------- 卡片概览层徽章(v0.31 阶段1):技能 N · MCP 工具 M + 白名单语义B 三态标记(点击开详情弹窗) ---------- */
|
|
1296
|
+
function EquipBadge({ node, caps, onOpen, seat }) {
|
|
1297
|
+
if (!node || typeof node !== 'object') return null;
|
|
1298
|
+
const eq = node.equip ?? null;
|
|
1299
|
+
const allowSkills = Array.isArray(eq && eq.allowSkills) ? eq.allowSkills : null;
|
|
1300
|
+
const sk = visibleSkills(caps, eq);
|
|
1301
|
+
const tl = visibleToolCount(caps, eq);
|
|
1302
|
+
const label = '🧰 技能 ' + (sk ? sk.length : '—') + ' · MCP 工具 ' + (tl === null ? '—' : tl)
|
|
1303
|
+
+ (allowSkills ? (allowSkills.length ? ' · 白名单 ×' + allowSkills.length : ' · 仅默认集') : '');
|
|
1304
|
+
const tip = '能力面概览(只读,点击开详情弹窗):技能数=本节点可见技能(语义B 投影:undefined=宿主全量 / []=仅默认集 / [...] =默认集∪额外项);'
|
|
1305
|
+
+ 'MCP 工具数=allowTools/denyTools 闸后可见数。数据源=snapshot capabilities+nodes[].equip 客户端聚合。'
|
|
1306
|
+
+ (allowSkills ? ' 技能白名单语义B:默认集(宿主自带,实时判定)∪ 额外项;运行期入口=bufeng_skill。' : '');
|
|
1307
|
+
// 行铬组件化(伞单 k-mvyluch5055 契约 tmp/k-mvyluch5055/contract-cap-classes.md):内联行铬/钮铬双对象
|
|
1308
|
+
// 退役,值逐项同值迁移至 styles.js 契约类(零视觉回归);k-mvf8hfi706c 止血史实(内联穿透样式表尾部
|
|
1309
|
+
// 失活)的根因破形态残行已随本批修复。类名 bf-equipview/bf-equipbtn 保留:
|
|
1310
|
+
// 图谱隐藏通道 .bf-gnode .bf-equipview(styles.js)照常命中。
|
|
1311
|
+
return h('div', { className: 'bf-equipview bf-eqbadge-row', 'data-bf-equip': '1' },
|
|
1312
|
+
h('button', { className: 'bf-ctl bf-equipbtn bf-eqbadge-btn', 'data-bf-equipbtn': seat ? 'seat' : '1',
|
|
1313
|
+
'data-bf-nodeid': node.id || '', title: tip,
|
|
1314
|
+
// v0.61.0 S2:开窗即递增 EQ_OPEN_SEQ(EquipModal effect 据此重拉建议单)
|
|
1315
|
+
onClick: (e) => { if (e && e.stopPropagation) e.stopPropagation(); bumpEqOpenSeq(); if (onOpen) onOpen(); } }, label));
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
/* ---------- 详情弹窗(v0.61.0 S2):三 tab(概览/提示词/装备)----------
|
|
1319
|
+
* 装备 tab=市场式双轴(Skill/MCP)+左列表分组+计数徽标+选中态+右详情六要素+分级直装链。
|
|
1320
|
+
* ✕/Esc/遮罩点击关闭;本地推荐「装备」自动串联 preview→apply(flow='direct');已装项 屏蔽/收窄/卸下
|
|
1321
|
+
* 一步卡内联确认(flow='confirm');公网候选零装备按钮零自动安装。 */
|
|
1322
|
+
function EquipModal({ node, caps, snap, onClose, initialTab, initialScope }) {
|
|
1323
|
+
// stub hookStore 跨 key 残留重置(v0.61.0 S2 第三轮):每次开窗(EQ_OPEN_SEQ 变化)本渲染即用初值——
|
|
1324
|
+
// 模拟真 React「key 变化重挂组件、state 归初值」语义;运行期 set* 照常写 store,后续渲染读 store 值。
|
|
1325
|
+
const fresh = PREV_MOUNT_SEQ !== EQ_OPEN_SEQ;
|
|
1326
|
+
if (fresh) PREV_MOUNT_SEQ = EQ_OPEN_SEQ;
|
|
1327
|
+
const st = (init) => {
|
|
1328
|
+
const s = useState(init);
|
|
1329
|
+
if (fresh) { s[1](init); return [init, s[1]]; } // fresh 不只改本渲染返回值——必须写回 store,
|
|
1330
|
+
// 否则下一渲染(fresh=false)读回 store 旧残留(stub 无 key 重挂、hookStore 跨 key 共享),
|
|
1331
|
+
// 装备 pane 会从第二次渲染起整块退场(tab 回落旧值)。
|
|
1332
|
+
return s;
|
|
1333
|
+
};
|
|
1334
|
+
const [tab, setTab] = st(initialTab || 'overview');
|
|
1335
|
+
const [scope, setScope] = st(initialScope || 'agent');
|
|
1336
|
+
// v0.47.1:描述「展开全文/收起」展开态(key 化)
|
|
1337
|
+
const [expOpen, setExpOpen] = st({});
|
|
1338
|
+
// S1 页脚紧凑化(伞单 k-mw3zzzci0in):页脚说明折叠态(默认收起=false;展开标记条件挂载沿 axAttrs 先例)
|
|
1339
|
+
const [footOpen, setFootOpen] = st(false);
|
|
1340
|
+
// v0.61.0 S2 装备 tab 状态:axis=当前轴(缺省 skill);selSkill/selMcp=分轴选中条目 key(null=缺省第一组第一条);
|
|
1341
|
+
// eqConfirm=一步卡操作(shield|narrow|uninstall|null);eqBusy=请求闸;eqRc=回执;eqErr/noPerm=错误/降级;
|
|
1342
|
+
// applyInfo=降级申请目标;eqLoadedSeq/sheet=建议单拉取序号与数据;eqCopyMsg=复制回执。
|
|
1343
|
+
const [axis, setAxis] = st('skill');
|
|
1344
|
+
const [selSkill, setSelSkill] = st(null);
|
|
1345
|
+
const [selMcp, setSelMcp] = st(null);
|
|
1346
|
+
const [eqConfirm, setEqConfirm] = st(null);
|
|
1347
|
+
const [eqBusy, setEqBusy] = st(false);
|
|
1348
|
+
const [eqRc, setEqRc] = st(null);
|
|
1349
|
+
const [eqErr, setEqErr] = st('');
|
|
1350
|
+
const [noPerm, setNoPerm] = st(false);
|
|
1351
|
+
const [applyInfo, setApplyInfo] = st(null);
|
|
1352
|
+
const [eqLoadedSeq, setEqLoadedSeq] = st(null);
|
|
1353
|
+
const [sheet, setSheet] = st(null);
|
|
1354
|
+
const [eqCopyMsg, setEqCopyMsg] = st('');
|
|
1355
|
+
const [sugBusy, setSugBusy] = st(false); // k-mw0ala3c053:刷新推荐独立 busy 态(勿复用 eqBusy 装备链态)
|
|
1356
|
+
const [sugErr, setSugErr] = st(null); // 建议单拉取失败消息(null=无错误;失败横幅 sugBanner 数据源)
|
|
1357
|
+
// 目录快照刷新四态(POST /bufeng/api/catalog,司南裁定 A 案):catState ∈ null(常态缺席)|loading|ok|err|throttled
|
|
1358
|
+
// 容器锚 data-bf-eqcatrefresh-state(EQ-CAT4 判据);catFresh=本次开窗内已成功刷新(stale 横幅消失;
|
|
1359
|
+
// 重开弹窗 fresh 重置回归服务端真值);catMsg=err/throttled 内联文案数据源。
|
|
1360
|
+
const [catState, setCatState] = st(null);
|
|
1361
|
+
const [catFresh, setCatFresh] = st(false);
|
|
1362
|
+
const [catMsg, setCatMsg] = st('');
|
|
1363
|
+
const [catRaw, setCatRaw] = st(null); // k-mw54fw24052 A截:失败臂字面值小字层 {kind:'ratelimit'|'generic', text:'目录刷新失败:'+lastError 原文}——非失败臂恒 null
|
|
1364
|
+
// Esc 关闭:window keydown(真实浏览器随 effect 清理;sim 无渲染协调器,重复注册的幂等 onClose 无害)
|
|
1365
|
+
useEffect(() => {
|
|
1366
|
+
const onKey = (e) => { if (e && e.key === 'Escape' && onClose) onClose(); };
|
|
1367
|
+
window.addEventListener('keydown', onKey);
|
|
1368
|
+
return () => window.removeEventListener('keydown', onKey);
|
|
1369
|
+
});
|
|
1370
|
+
// v0.61.0 S2:建议单拉取(GET /bufeng/api/suggest?treeId=,只读零写口)。effect 每渲染跑,
|
|
1371
|
+
// eqLoadedSeq===EQ_OPEN_SEQ 短路(同一开窗周期恰拉一次);新开弹窗(序号递增)自动重拉——
|
|
1372
|
+
// 直装/操作回执后的显式重拉走 runChain 内 loadSuggest(A4:服务端 apply 已失效 memo,重拉即新数据)。
|
|
1373
|
+
useEffect(() => {
|
|
1374
|
+
if (eqLoadedSeq === EQ_OPEN_SEQ) return;
|
|
1375
|
+
setEqLoadedSeq(EQ_OPEN_SEQ);
|
|
1376
|
+
try {
|
|
1377
|
+
const tid = ((snap && Array.isArray(snap.trees)) ? snap.trees : [])
|
|
1378
|
+
.find((t) => ((t && t.nodes) || []).some((x) => x && x.id === (node && node.id)));
|
|
1379
|
+
fetch('/bufeng/api/suggest' + (tid && tid.id ? '?treeId=' + encodeURIComponent(tid.id) : ''), { method: 'GET' })
|
|
1380
|
+
.then((res) => (res && res.ok ? res.json() : Promise.reject(new Error('HTTP ' + ((res && res.status) || 'ERR')))))
|
|
1381
|
+
.then((body) => { if (body && body.action === 'suggest' && Array.isArray(body.nodes)) setSheet(body); })
|
|
1382
|
+
.catch(() => {});
|
|
1383
|
+
} catch (e) { /* 建议单拉取失败静默:装备 tab 本体(默认集/已挂接分组)不依赖 sheet */ }
|
|
1384
|
+
});
|
|
1385
|
+
if (!node || typeof node !== 'object') return null;
|
|
1386
|
+
const eq = node.equip ?? null;
|
|
1387
|
+
const rawSkills = caps && Array.isArray(caps.skills) ? caps.skills.filter(Boolean) : []; // 宿主技能目录全集(caps 派生推荐源,不受语义B 白名单投影收窄)
|
|
1388
|
+
const skills = visibleSkills(caps, eq); // null=能力面数据不可用(旧快照/降级)
|
|
1389
|
+
const skillList = skills || [];
|
|
1390
|
+
const servers = caps && Array.isArray(caps.mcpServers) ? caps.mcpServers : [];
|
|
1391
|
+
const presets = Array.isArray(caps && caps.presets) ? caps.presets : [];
|
|
1392
|
+
// v0.47.3 预设全零投影口径(返工 k-mvq642n30b0):presetsNote 渲染条件保留(存在真实命名预设才显示警告行);
|
|
1393
|
+
// 预设分区本体已随 v0.61.0 退役(EQ-06f/15b:零「🧩 智能体预设」渲染)。
|
|
1394
|
+
const presetZeroEntry = (p) => !p || ((!String(p && p.name || '').trim() || String(p && p.name || '').trim() === '(未命名)') && (!Array.isArray(p && p.mcpComposition) || p.mcpComposition.length === 0));
|
|
1395
|
+
const presetsZero = presets.length > 0 && presets.every(presetZeroEntry);
|
|
1396
|
+
const allowSkills = Array.isArray(eq && eq.allowSkills) ? eq.allowSkills : null;
|
|
1397
|
+
const allowTools = eq && Array.isArray(eq.allowTools) && eq.allowTools.length ? eq.allowTools : null;
|
|
1398
|
+
const denyTools = eq && Array.isArray(eq.denyTools) && eq.denyTools.length ? eq.denyTools : null;
|
|
1399
|
+
/* ---------- v0.40 批2:节点详情派生(概览/提示词两页数据源,保留原样) ---------- */
|
|
1400
|
+
const allNodes = (snap && Array.isArray(snap.trees) ? snap.trees : [])
|
|
1401
|
+
.reduce((acc, t) => acc.concat((t && t.nodes) || []), []);
|
|
1402
|
+
const treeNode = (snap && Array.isArray(snap.trees) ? snap.trees : [])
|
|
1403
|
+
.find((t) => (t && t.nodes || []).some((x) => x && x.id === node.id));
|
|
1404
|
+
const parent = allNodes.find((x) => x && x.id === node.leaderId);
|
|
1405
|
+
const snapTasks = (snap && Array.isArray(snap.tasks)) ? snap.tasks : [];
|
|
1406
|
+
const curTasks = snapTasks.filter((k) => k && k.nodeId === node.id && (k.status === 'running' || k.status === 'pending'));
|
|
1407
|
+
const recentTasks = snapTasks.filter((k) => k && k.nodeId === node.id && k.status === 'done').slice(0, 3);
|
|
1408
|
+
const nodeTasks = snapTasks.filter((k) => k && k.nodeId === node.id);
|
|
1409
|
+
const manifestTasks = nodeTasks.filter((k) => Array.isArray(k.promptManifest) && k.promptManifest.length);
|
|
1410
|
+
const focusTask = manifestTasks.find((k) => k.status === 'running' || k.status === 'pending')
|
|
1411
|
+
|| manifestTasks.find((k) => k.status === 'done')
|
|
1412
|
+
|| manifestTasks[0] || null;
|
|
1413
|
+
const taskMaps = { nodeById: {}, projById: {} };
|
|
1414
|
+
for (const n of allNodes) taskMaps.nodeById[n.id] = n;
|
|
1415
|
+
for (const p of ((snap && Array.isArray(snap.projects)) ? snap.projects : [])) taskMaps.projById[p.id] = p;
|
|
1416
|
+
const focusSegs = (focusTask && Array.isArray(focusTask.promptManifest)) ? focusTask.promptManifest.length : 0;
|
|
1417
|
+
const focusIsCurrent = !!(focusTask && (focusTask.status === 'running' || focusTask.status === 'pending'));
|
|
1418
|
+
const focusLabel = focusIsCurrent ? '本次任务' : '最近任务';
|
|
1419
|
+
const modelText = node.model && node.model.model ? node.model.model : '跟随会话'; // 仅头部 chip 用(v0.40.8 概览行已删)
|
|
1420
|
+
const statusText = { running: '运行中', idle: '待命', paused: '暂停', retired: '退役' }[node.status] || node.status || '—';
|
|
1421
|
+
const roleLen = (node.systemPrompt || '').length;
|
|
1422
|
+
const overviewPane = h('div', { className: 'bf-cappane', 'data-bf-cappane': 'overview',
|
|
1423
|
+
style: { display: tab === 'overview' ? 'flex' : 'none' } },
|
|
1424
|
+
h('div', { className: 'bf-ov-grid' },
|
|
1425
|
+
h('div', { className: 'bf-ov-kv', 'data-bf-ovkv': '角色' }, h('span', null, '角色'), h('b', null, node.kindLabel || node.kind || '—')),
|
|
1426
|
+
h('div', { className: 'bf-ov-kv', 'data-bf-ovkv': '树' }, h('span', null, '树'), h('b', null, treeNode ? treeNode.name : '—')),
|
|
1427
|
+
// v0.40.8 阶段1:「模型 / 跟随会话」行删除(模型信息只在头部 chip 与地图卡直配下拉直显)
|
|
1428
|
+
h('div', { className: 'bf-ov-kv', 'data-bf-ovkv': '上级' }, h('span', null, '上级'), h('b', null, parent ? parent.name : (node.kind === 'leader' ? '司南 · 值班席' : '—'))),
|
|
1429
|
+
h('div', { className: 'bf-ov-kv', 'data-bf-ovkv': '直属成员' }, h('span', null, '直属成员'), h('b', null, String(node.membersCount || 0))),
|
|
1430
|
+
h('div', { className: 'bf-ov-kv', 'data-bf-ovkv': '状态' }, h('span', null, '状态'), h('b', null, statusText))),
|
|
1431
|
+
h('div', { className: 'bf-capsec' }, h('div', { className: 'bf-capsec-title' }, '▶ 当前任务'),
|
|
1432
|
+
curTasks.length ? curTasks.map((k) => h('div', { key: k.id, className: 'bf-ov-task' },
|
|
1433
|
+
h('span', { className: 'bf-ov-dot bf-run' }), h('span', { className: 'bf-ov-tt' }, k.title),
|
|
1434
|
+
h('span', { className: 'bf-ov-st' }, k.status === 'running' ? '运行中' : '排队')))
|
|
1435
|
+
: h('div', { className: 'bf-capitem-desc' }, '当前无在跑任务')),
|
|
1436
|
+
h('div', { className: 'bf-capsec' }, h('div', { className: 'bf-capsec-title' }, '✓ 最近完成'),
|
|
1437
|
+
recentTasks.length ? recentTasks.map((k) => h('div', { key: k.id, className: 'bf-ov-task' },
|
|
1438
|
+
h('span', { className: 'bf-ov-dot bf-done' }), h('span', { className: 'bf-ov-tt' }, k.title),
|
|
1439
|
+
h('span', { className: 'bf-ov-st' }, (k.finishedAt || '').slice(11, 16))))
|
|
1440
|
+
: h('div', { className: 'bf-capitem-desc' }, '窗口内无完成记录')),
|
|
1441
|
+
h('div', { className: 'bf-ov-note' }, '提示词在「提示词」页;技能/MCP 在「装备」页;任务/项目装配在任务看板;模型直配在地图节点卡。'));
|
|
1442
|
+
const agentPromptPane = h('div', { className: 'bf-pr-agent', 'data-bf-pane': 'agent', style: { display: scope === 'agent' ? 'flex' : 'none' } },
|
|
1443
|
+
h('div', { className: 'bf-capsec', 'data-bf-nodeprompt': '1' },
|
|
1444
|
+
h('div', { className: 'bf-capsec-title' }, '📝 角色提示词' + (roleLen ? ' · ' + roleLen + ' 字' : '')),
|
|
1445
|
+
roleLen ? h('pre', { className: 'bf-ov-pre' }, node.systemPrompt)
|
|
1446
|
+
: h('div', { className: 'bf-capitem-desc' }, '无节点补充指令(总管跟随会话;身份段由插件模板与 node.name/role 生成)。'),
|
|
1447
|
+
h('div', { className: 'bf-capitem-desc' }, '节点补充指令是智能体级唯一可改段,走 bufeng_update_node systemPrompt;任务下一条会话生效。')),
|
|
1448
|
+
h('div', { className: 'bf-capsec' },
|
|
1449
|
+
h('div', { className: 'bf-capsec-title' }, '🧭 系统提示词(继承)'),
|
|
1450
|
+
h('div', { className: 'bf-capitem-desc' }, 'DSH 系统提示 + 仓根 AGENTS.md + MNEMON 记忆 + skills 目录 + profile/预设;插件只可感知,不可改写,正文不在此快照。')),
|
|
1451
|
+
h('div', { className: 'bf-capsec' },
|
|
1452
|
+
h('div', { className: 'bf-capsec-title' }, '🔗 任务 / 项目提示词'),
|
|
1453
|
+
h('div', { className: 'bf-capitem-desc' }, '任务标题/详情/验收与项目 projectNote 只属于某次任务;切到「本次任务」查看 7 段装配,或到任务看板「提示词装配」核对投递快照。')));
|
|
1454
|
+
const taskPromptPane = h('div', { className: 'bf-pr-taskpane', 'data-bf-pane': 'task', style: { display: scope === 'task' ? 'flex' : 'none' } },
|
|
1455
|
+
focusTask ? [
|
|
1456
|
+
h('div', { className: 'bf-pr-taskbanner', key: 'banner' }, focusLabel + '上下文 · 只属于这条任务,不是智能体自身提示词'),
|
|
1457
|
+
h('div', { className: 'bf-pr-task', key: 'task' },
|
|
1458
|
+
h('div', { className: 'bf-pr-tasktt' }, focusTask.title || focusTask.id),
|
|
1459
|
+
h('div', { className: 'bf-pr-taskmeta' },
|
|
1460
|
+
h('span', null, { running: '运行中', pending: '排队中', done: '已完成', failed: '失败', cancelled: '已取消' }[focusTask.status] || focusTask.status),
|
|
1461
|
+
h('span', null, ' · ' + focusTask.id),
|
|
1462
|
+
h('span', null, ' · ' + (focusTask.finishedAt ? String(focusTask.finishedAt).slice(0, 16).replace('T', ' ') : '未完成'))),
|
|
1463
|
+
h('div', { className: 'bf-pr-tasknote' }, '投递时快照 · 只读;节点/项目后续改动不回写历史任务。')),
|
|
1464
|
+
h(PromptAssembly, { key: 'asm', k: focusTask, maps: taskMaps })
|
|
1465
|
+
] : h('div', { className: 'bf-capitem-desc' }, '窗口内该节点暂无任务;任务级提示词只在派单时生成。'));
|
|
1466
|
+
const promptPane = h('div', { className: 'bf-cappane', 'data-bf-cappane': 'prompt',
|
|
1467
|
+
style: { display: tab === 'prompt' ? 'flex' : 'none' } },
|
|
1468
|
+
h('div', { className: 'bf-pr-scope' },
|
|
1469
|
+
h('button', { className: 'bf-pr-scopebtn' + (scope === 'agent' ? ' bf-on' : ''), 'data-bf-pscope': 'agent',
|
|
1470
|
+
onClick: (e) => { if (e && e.stopPropagation) e.stopPropagation(); setScope('agent'); } }, '智能体级 · 2 段'),
|
|
1471
|
+
h('button', { className: 'bf-pr-scopebtn' + (scope === 'task' ? ' bf-on' : ''), 'data-bf-pscope': 'task',
|
|
1472
|
+
onClick: (e) => { if (e && e.stopPropagation) e.stopPropagation(); setScope('task'); } }, focusLabel + ' · ' + (focusSegs || 0) + ' 段')),
|
|
1473
|
+
scope === 'agent' ? agentPromptPane : taskPromptPane);
|
|
1474
|
+
const tabBtn = (id, label) => h('button', { key: id, className: 'bf-captab' + (tab === id ? ' bf-on' : ''),
|
|
1475
|
+
'data-bf-captab': id, onClick: (e) => { if (e && e.stopPropagation) e.stopPropagation(); setTab(id); } }, label);
|
|
1476
|
+
/* ---------- v0.61.0 S2 装备 tab:建议单解析+分组+直装链 ---------- */
|
|
1477
|
+
// 描述 2 行截断+展开(v0.47.1 语义保留,key 化展开态)
|
|
1478
|
+
const clampW = (t) => { let w = 0; for (const ch of String(t)) w += ch.charCodeAt(0) > 0x2e7f ? 2 : 1; return w; };
|
|
1479
|
+
const clampDesc = (text, key) => {
|
|
1480
|
+
const t = String(text || '');
|
|
1481
|
+
const long = clampW(t) > 116;
|
|
1482
|
+
const open = !!(expOpen && expOpen[key]);
|
|
1483
|
+
return h('div', { className: 'bf-eqclamp', key: 'cl-' + key },
|
|
1484
|
+
h('div', { className: 'bf-eqdesc' + (long && !open ? ' bf-eqclamp2' : '') }, t),
|
|
1485
|
+
long ? h('button', { className: 'bf-eqexp', 'data-bf-eqexp': key,
|
|
1486
|
+
title: open ? '收起描述(回 2 行截断)' : '展开被截断的描述全文',
|
|
1487
|
+
onClick: (e) => {
|
|
1488
|
+
e.stopPropagation();
|
|
1489
|
+
setExpOpen((prev) => {
|
|
1490
|
+
const cur = prev || {};
|
|
1491
|
+
const next = Object.assign({}, cur);
|
|
1492
|
+
next[key] = !cur[key];
|
|
1493
|
+
return next;
|
|
1494
|
+
});
|
|
1495
|
+
} }, open ? '收起' : '展开全文') : null);
|
|
1496
|
+
};
|
|
1497
|
+
// 建议单行解析(sheet 缺席/形态异常一律降级空数组——装备 tab 本体不依赖 sheet)
|
|
1498
|
+
const sheetRow = (sheet && Array.isArray(sheet.nodes)) ? (sheet.nodes.find((nd) => nd && nd.nodeId === node.id) || null) : null;
|
|
1499
|
+
const sugAll = (sheetRow && Array.isArray(sheetRow.suggestions)) ? sheetRow.suggestions.filter(Boolean) : [];
|
|
1500
|
+
const lowAll = (sheetRow && Array.isArray(sheetRow.lowConfidence)) ? sheetRow.lowConfidence.filter(Boolean) : [];
|
|
1501
|
+
const hintAll = (sheetRow && Array.isArray(sheetRow.hints)) ? sheetRow.hints.filter(Boolean) : [];
|
|
1502
|
+
// catalog 元数据在 suggest sheet 顶层(stub/服务端同构);sheetRow.catalog 为历史兼容读法
|
|
1503
|
+
const catInfo = (sheet && sheet.catalog) || (sheetRow && sheetRow.catalog) || null;
|
|
1504
|
+
const catAvailable = catInfo ? catInfo.available !== false : true;
|
|
1505
|
+
const catStale = !!(catInfo && catInfo.stale);
|
|
1506
|
+
const catHours = catInfo && catInfo.ageMs != null ? Math.max(1, Math.round(catInfo.ageMs / 3600000)) : 0;
|
|
1507
|
+
const layerOf = (s) => (s && s.layer === 'catalog') ? 'catalog' : (s && s.lowConfidence) ? 'low' : 'local';
|
|
1508
|
+
const sugIdOf = (s) => String((s && (s.name || s.suggestionId)) || 'sug'); // name 优先:判据/建议单 id 锚口径(suggestionId 是判据内部跟踪 id)
|
|
1509
|
+
const sugNameOf = (s) => String((s && (s.displayName || s.name)) || sugIdOf(s));
|
|
1510
|
+
// 卡片描述行(k-mw25crms08w 契约 C6):desc 槽严格 description 口径——控制字符/换行拍平→trim→截 200 字符(载荷侧
|
|
1511
|
+
// C1-C5 截断/净化的 UI 侧兜底);无 description/净化后为空→逐字「(未提供描述)」占位不留白,禁 reason 回退充数
|
|
1512
|
+
// (命中理由保留右详情「推荐理由」段 eqwhy 零变化)。textContent 级渲染=h() 字符串子元素,零 innerHTML 面。
|
|
1513
|
+
const RECO_DESC_PLACEHOLDER = '(未提供描述)';
|
|
1514
|
+
const eqDescOf = (s) => {
|
|
1515
|
+
const clean = String((s && s.description) != null ? (s && s.description) : '').replace(/[\u0000-\u001f\u007f]/g, ' ').trim();
|
|
1516
|
+
return clean ? clean.slice(0, 200) : RECO_DESC_PLACEHOLDER;
|
|
1517
|
+
};
|
|
1518
|
+
// 主标题人类名(契约 C7):仅 reco 组条目(mkRecoItem 产物)列表行名行 bf-eqitem-nm 与右详情 bf-eqname 渲染
|
|
1519
|
+
// sugNameOf(displayName||name;catalog 条目 displayName=title||serverName 由载荷给);其余组维持 it.name 原样,
|
|
1520
|
+
// data-bf-* id 锚(eqitem/eqinstall/eqcopy)与操作链 picks/previewArgs 不受影响(id 继续走 sugIdOf)。
|
|
1521
|
+
const dispNameOf = (it) => (it && it.group === 'reco' && it.sug) ? sugNameOf(it.sug) : (it && it.name);
|
|
1522
|
+
// 分组数据源(实时派生,禁硬编码计数):Skill=默认集/额外项/推荐;MCP=已挂接/推荐(低置信+公网混排)
|
|
1523
|
+
const mcpTools = servers.reduce((acc, srv) => acc.concat(((srv && srv.tools) || []).filter((t) => t && t.name)), []);
|
|
1524
|
+
// Skill 推荐组双源(v0.61.0 S2 第六轮,第八轮收窄):①建议单本地/低置信项(带命中词/得分/previewArgs)
|
|
1525
|
+
// ②宿主技能目录派生(非默认集且未装备为额外项且建议单未列)——仅当建议单缺「本节点行」(sheetRow 缺席:
|
|
1526
|
+
// 无达标建议弹窗/降级/席位合成节点)时启用;sheet 有行(哪怕空数组)即尊重 sheet 结论(目录过期/不可用/
|
|
1527
|
+
// 零候选形态下推荐组随之空转,不与 empty 形态判据打架),同名去重按 sugNameOf 全形态匹配。
|
|
1528
|
+
const sheetSkillReco = sugAll.filter((s) => s && (s.axis || 'allowSkills') === 'allowSkills' && layerOf(s) !== 'catalog')
|
|
1529
|
+
.concat(lowAll.filter((s) => s && (s.axis || 'allowSkills') === 'allowSkills'));
|
|
1530
|
+
const capsRecoSkills = sheetRow ? [] : rawSkills.filter((s) => s && s.name && !s.defaultSkill
|
|
1531
|
+
&& !(allowSkills || []).includes(s.name)
|
|
1532
|
+
&& !sheetSkillReco.some((x) => sugNameOf(x) === s.name));
|
|
1533
|
+
const skillReco = sheetSkillReco.concat(capsRecoSkills.map((s) => ({
|
|
1534
|
+
suggestionId: s.name, displayName: s.name, kind: 'skill', layer: 'local', axis: 'allowSkills',
|
|
1535
|
+
picks: [s.name], reason: s.description || '', description: s.description || '', // C8:补 description 键(desc 槽严格口径;reason 保持现状零变化防既有判据扰动)
|
|
1536
|
+
confidence: 'caps', installState: 'not-installed',
|
|
1537
|
+
})));
|
|
1538
|
+
const mcpRecoLow = lowAll.filter((s) => s && s.axis === 'allowTools');
|
|
1539
|
+
const mcpRecoCat = catAvailable ? sugAll.filter((s) => s && layerOf(s) === 'catalog') : [];
|
|
1540
|
+
const mcpReco = mcpRecoLow.concat(mcpRecoCat);
|
|
1541
|
+
const skillDefaults = skillList.filter((s) => s && s.defaultSkill);
|
|
1542
|
+
// 语义B 投影:allowSkills 只列宿主注册表内真实存在的名(伪造名不进额外项组——v0.31 弹窗⑤判据口径),
|
|
1543
|
+
// 注册表外allowSkills 名由 caps 派生推荐层承载(可见但需判断)。
|
|
1544
|
+
const skillExtras = (allowSkills || []).filter((n) => skillList.some((s) => s && s.name === n)).map((n) => {
|
|
1545
|
+
const hit = skillList.find((s) => s && s.name === n);
|
|
1546
|
+
return { name: String(n), desc: hit && hit.description ? hit.description : '(宿主技能目录未收录说明)', whenToUse: hit && hit.whenToUse ? hit.whenToUse : '' };
|
|
1547
|
+
});
|
|
1548
|
+
const mkRecoItem = (ax, s) => ({
|
|
1549
|
+
key: ax + ':reco:' + sugIdOf(s), kind: ax === 'skill' ? 'skill' : 'mcp', group: 'reco',
|
|
1550
|
+
name: sugIdOf(s), sug: s, low: !!(s && s.lowConfidence), cat: layerOf(s) === 'catalog',
|
|
1551
|
+
desc: eqDescOf(s), srcLabel: layerOf(s) === 'catalog' ? '官方目录' : '技能目录',
|
|
1552
|
+
stateVal: (s && s.installState === 'installed') ? 'installed' : 'not-installed',
|
|
1553
|
+
axisField: (s && s.axis) || (ax === 'skill' ? 'allowSkills' : 'allowTools'),
|
|
1554
|
+
picks: (s && Array.isArray(s.picks)) ? s.picks : null,
|
|
1555
|
+
});
|
|
1556
|
+
const skillGroups = [
|
|
1557
|
+
{ id: 'default', title: '默认集(恒可用)',
|
|
1558
|
+
items: skillDefaults.map((s) => ({ key: 'skill:default:' + s.name, kind: 'skill', group: 'default', name: s.name,
|
|
1559
|
+
desc: s.description || '(无说明)', whenToUse: s.whenToUse || '', srcLabel: '内置技能(bundled)', stateVal: 'builtin', bundled: true })) },
|
|
1560
|
+
{ id: 'extra', title: '额外项(allowSkills)', emptyText: '(空)装备推荐项后迁入本组',
|
|
1561
|
+
items: skillExtras.map((x) => ({ key: 'skill:extra:' + x.name, kind: 'skill', group: 'extra', name: x.name,
|
|
1562
|
+
desc: x.desc, whenToUse: x.whenToUse, srcLabel: '技能目录', stateVal: 'installed', axisField: 'allowSkills' })) },
|
|
1563
|
+
{ id: 'reco', title: '推荐', refresh: true,
|
|
1564
|
+
items: skillReco.map((s) => mkRecoItem('skill', s)) },
|
|
1565
|
+
];
|
|
1566
|
+
const mcpGroups = [
|
|
1567
|
+
{ id: 'installed', title: '已挂接',
|
|
1568
|
+
items: mcpTools.map((t) => ({ key: 'mcp:installed:' + t.name, kind: 'mcp', group: 'installed', name: t.name,
|
|
1569
|
+
desc: t.description || '(无说明)', srcLabel: '宿主内置', stateVal: 'installed', axisField: 'allowTools' })) },
|
|
1570
|
+
{ id: 'reco', title: '推荐', refresh: true,
|
|
1571
|
+
items: mcpReco.map((s) => mkRecoItem('mcp', s)) },
|
|
1572
|
+
];
|
|
1573
|
+
const axisGroups = axis === 'skill' ? skillGroups : mcpGroups;
|
|
1574
|
+
const allItems = axisGroups.reduce((acc, g) => acc.concat(g.items), []);
|
|
1575
|
+
const selKey = axis === 'skill'
|
|
1576
|
+
? (selSkill && allItems.some((x) => x.key === selSkill) ? selSkill : (skillGroups[0].items.length ? skillGroups[0].items[0].key : null))
|
|
1577
|
+
: (selMcp && allItems.some((x) => x.key === selMcp) ? selMcp : (mcpGroups[0].items.length ? mcpGroups[0].items[0].key : null));
|
|
1578
|
+
const selIt = selKey ? allItems.find((x) => x.key === selKey) || null : null;
|
|
1579
|
+
const hintOf = (it) => (it && it.name ? hintAll.find((hh) => hh && hh.name === it.name && hh.unusedDays != null) : null);
|
|
1580
|
+
// 直装/操作链(A2/A3/A7):picks 按轴精确构造(未涉轴整键缺席);flow='direct'(本地推荐直装)|'confirm'(一步卡确认);
|
|
1581
|
+
// preview→apply 自动串联(confirm:true+fromPreview=previewHash 原样);回执落 eqRc+重拉建议单(A4 服务端已失效 memo)。
|
|
1582
|
+
const curAxisList = (ax) => (eq && Array.isArray(eq[ax])) ? eq[ax] : [];
|
|
1583
|
+
const opPatchOf = (op, it) => {
|
|
1584
|
+
const ax = it.axisField || 'allowTools';
|
|
1585
|
+
if (op === 'shield') { const d = curAxisList('denyTools'); return d.indexOf(it.name) >= 0 ? { denyTools: d.slice() } : { denyTools: d.concat([it.name]) }; }
|
|
1586
|
+
if (op === 'narrow') { const o = {}; o[ax] = [it.name]; return o; } // 收窄:白名单收窄至仅此一项
|
|
1587
|
+
const o = {}; o[ax] = curAxisList(ax).filter((x) => x !== it.name); return o; // 卸下:精确移除目标名(结果可为空数组→服务端四拒文案指路)
|
|
1588
|
+
};
|
|
1589
|
+
const loadSuggest = () => {
|
|
1590
|
+
if (SUG_INFLIGHT) return; // k-mw0ala3c053:在途防抖(模块级闸——渲染间隙二次点击同样 no-op)
|
|
1591
|
+
try {
|
|
1592
|
+
const tid = treeNode ? treeNode.id : '';
|
|
1593
|
+
SUG_INFLIGHT = true;
|
|
1594
|
+
setSugBusy(true);
|
|
1595
|
+
fetch('/bufeng/api/suggest' + (tid ? '?treeId=' + encodeURIComponent(tid) : ''), { method: 'GET' })
|
|
1596
|
+
.then((res) => (res && res.ok ? res.json() : Promise.reject(new Error('HTTP ' + ((res && res.status) || 'ERR')))))
|
|
1597
|
+
.then((body) => {
|
|
1598
|
+
if (body && body.action === 'suggest' && Array.isArray(body.nodes)) { setSheet(body); setSugErr(null); }
|
|
1599
|
+
else setSugErr('响应非契约(缺 action=suggest 或 nodes 非数组)'); // k-mw0ala3c053:失败转错误横幅(catch 静默退役)
|
|
1600
|
+
})
|
|
1601
|
+
.catch((err) => { setSugErr(String((err && err.message) || err)); })
|
|
1602
|
+
.then(() => { SUG_INFLIGHT = false; setSugBusy(false); }); // 成功/失败均复位(链尾兜底)
|
|
1603
|
+
} catch (e) { SUG_INFLIGHT = false; setSugBusy(false); setSugErr(String((e && e.message) || e)); }
|
|
1604
|
+
};
|
|
1605
|
+
// 目录快照刷新(POST /bufeng/api/catalog 唯一客户端刷新口,装备页打磨 S2 伞单 k-mw41huec0l1):
|
|
1606
|
+
// loading 同步置位(防重点击)→ 成功(refreshed=true)→ok+catFresh+重拉 suggest(恰 1 GET);
|
|
1607
|
+
// 节流(refreshed=false+mode=throttled)→明示「约 N 分钟后可再试」(响应无剩余分钟真相源,按 60min 窗口径约数并注明);
|
|
1608
|
+
// 失败(body.ok:false 的 code/cause 或 refreshed=false 的 lastError)→内联文案含字面值(client 侧内联格式化,
|
|
1609
|
+
// 无 describeFetchError 可 import;cause 字符串原样、对象 JSON.stringify)。
|
|
1610
|
+
// k-mw54fw24052 A截:refreshed=false 失败臂人话一等公民(限流形状识别→主句指引;lastError 原文小字次要层级——字面值证据链不丢)。
|
|
1611
|
+
const refreshCatalog = () => {
|
|
1612
|
+
if (CAT_INFLIGHT) return; // 在途防重(SUG_INFLIGHT 同纪律:渲染间隙二次点击 no-op)
|
|
1613
|
+
try {
|
|
1614
|
+
CAT_INFLIGHT = true;
|
|
1615
|
+
setCatState('loading');
|
|
1616
|
+
fetch('/bufeng/api/catalog', { method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}' })
|
|
1617
|
+
.then((res) => (res && res.ok ? res.json() : Promise.reject(new Error('HTTP ' + ((res && res.status) || 'ERR')))))
|
|
1618
|
+
.then((body) => {
|
|
1619
|
+
if (body && body.ok === false) {
|
|
1620
|
+
// 防御兜底形态(端点自身 catch;契约内不可触达):code/cause 字面值内联透出(文案零删改零放松——EQ-CAT4-4/EQ-CATF-3)
|
|
1621
|
+
const cause = typeof body.cause === 'string' ? body.cause : JSON.stringify(body.cause != null ? body.cause : '');
|
|
1622
|
+
setCatState('err'); setCatMsg('目录刷新失败(code=' + (body.code || '未知') + ';cause=' + cause + ')'); setCatRaw(null);
|
|
1623
|
+
} else if (body && body.refreshed === false && body.mode === 'throttled') {
|
|
1624
|
+
setCatState('throttled'); setCatMsg('目录刷新节流中,约 60 分钟后可再试(按 60 分钟节流窗口口径估算)'); setCatRaw(null);
|
|
1625
|
+
} else if (body && body.refreshed === false) {
|
|
1626
|
+
// 契约错误臂(绝不抛错形态)人话一等公民(k-mw54fw24052 A截):限流形状(lastError 含 abort/code=20
|
|
1627
|
+
// 特征——客户实机「This operation was aborted | code=20」)→限流主句+保留旧目录+60min 窗口指引;
|
|
1628
|
+
// 其他失败→通用人话;lastError 原文(describeFetchError 证据链字面值)降小字次要层级 data-bf-eqcatraw 在场。
|
|
1629
|
+
const raw = String(body.lastError || body.reason || '未知原因');
|
|
1630
|
+
const rl = /abort/i.test(raw) || /code=20(?!\d)/.test(raw);
|
|
1631
|
+
setCatState('err');
|
|
1632
|
+
setCatMsg(rl ? '官方目录暂时限流,已保留旧目录,约 60 分钟后可再试' : '目录刷新失败,已保留旧目录,可稍后重试');
|
|
1633
|
+
setCatRaw({ kind: rl ? 'ratelimit' : 'generic', text: '目录刷新失败:' + raw }); // 「目录刷新失败:」前缀保留(红线)
|
|
1634
|
+
} else {
|
|
1635
|
+
// refreshed=true:目录快照已刷新——stale 横幅消失+重拉建议单
|
|
1636
|
+
setCatState('ok'); setCatFresh(true); setCatMsg(''); setCatRaw(null); loadSuggest();
|
|
1637
|
+
}
|
|
1638
|
+
})
|
|
1639
|
+
.catch((err) => { setCatState('err'); setCatMsg('目录刷新失败:' + String((err && err.message) || err)); setCatRaw(null); })
|
|
1640
|
+
.then(() => { CAT_INFLIGHT = false; }); // 成功/失败均复位(链尾兜底)
|
|
1641
|
+
} catch (e) { CAT_INFLIGHT = false; setCatState('err'); setCatMsg('目录刷新失败:' + String((e && e.message) || e)); setCatRaw(null); }
|
|
1642
|
+
};
|
|
1643
|
+
const eqCopyText = (text, onOk) => {
|
|
1644
|
+
const nav = (typeof window !== 'undefined' && window && window.navigator) ? window.navigator
|
|
1645
|
+
: (typeof navigator !== 'undefined' ? navigator : null);
|
|
1646
|
+
const failMsg = '复制失败——剪贴板不可用,请手动复制所需信息';
|
|
1647
|
+
try {
|
|
1648
|
+
if (nav && nav.clipboard && typeof nav.clipboard.writeText === 'function') {
|
|
1649
|
+
const r = nav.clipboard.writeText(text);
|
|
1650
|
+
if (r && typeof r.then === 'function') r.then(() => onOk(), () => setEqCopyMsg(failMsg));
|
|
1651
|
+
else onOk();
|
|
1652
|
+
} else setEqCopyMsg(failMsg);
|
|
1653
|
+
} catch (e) { setEqCopyMsg(failMsg); }
|
|
1654
|
+
};
|
|
1655
|
+
const runChain = (it, tag, patchObj, flow) => {
|
|
1656
|
+
const picks = {};
|
|
1657
|
+
for (const ax of ['allowTools', 'denyTools', 'allowSkills']) if (patchObj && patchObj[ax] !== undefined) picks[ax] = patchObj[ax];
|
|
1658
|
+
if (!Object.keys(picks).length) { setEqErr('未产生任何装备轴变更——操作被跳过(未涉轴整键缺席,零空补丁)'); return; }
|
|
1659
|
+
setEqRc(null); setEqErr(''); setNoPerm(false); setEqConfirm(null); setEqBusy(true);
|
|
1660
|
+
const run = async () => {
|
|
1661
|
+
try {
|
|
1662
|
+
const pv = await postEquip(Object.assign({ action: 'preview', nodeId: node.id || '', flow }, picks));
|
|
1663
|
+
const ap = await postEquip(Object.assign({ action: 'apply', nodeId: node.id || '', flow }, pv.patch || picks,
|
|
1664
|
+
{ confirm: true, fromPreview: pv.previewHash }));
|
|
1665
|
+
setEqRc({ tag, name: it.name, hash: pv.previewHash, before: pv.before,
|
|
1666
|
+
after: pv.after !== undefined ? pv.after : (pv.patch || picks), effects: pv.effects, note: ap && ap.note });
|
|
1667
|
+
loadSuggest(); // A4:服务端 apply 成功已失效 suggest memo——客户端重拉即新数据(EQ-14a 刷新证据)
|
|
1668
|
+
} catch (err) {
|
|
1669
|
+
const msg = String((err && err.message) || err);
|
|
1670
|
+
setEqRc(null); setEqErr(msg);
|
|
1671
|
+
// 分级降级(A5):无装备写权限(403)→「复制装备申请」降级通道(含 bufeng_update_node 指引+目标名)
|
|
1672
|
+
if (msg.indexOf('权限不足') >= 0 || msg.indexOf('无装备写权限') >= 0) { setNoPerm(true); setApplyInfo({ name: it.name, tag }); }
|
|
1673
|
+
} finally { setEqBusy(false); }
|
|
1674
|
+
};
|
|
1675
|
+
run();
|
|
1676
|
+
};
|
|
1677
|
+
const runEquip = (it, flow) => {
|
|
1678
|
+
if (eqBusy) return;
|
|
1679
|
+
const ax = it.axisField || 'allowSkills';
|
|
1680
|
+
const picks = (it.sug && Array.isArray(it.sug.picks) && it.sug.picks.length) ? it.sug.picks : [it.name];
|
|
1681
|
+
const p = {}; p[ax] = picks.slice();
|
|
1682
|
+
runChain(it, '装备', p, flow);
|
|
1683
|
+
};
|
|
1684
|
+
const runOp = (it, op) => {
|
|
1685
|
+
if (eqBusy) return;
|
|
1686
|
+
runChain(it, { shield: '屏蔽', narrow: '收窄', uninstall: '卸下' }[op] || op, opPatchOf(op, it), 'confirm');
|
|
1687
|
+
};
|
|
1688
|
+
const copyInstallInfo = (it) => {
|
|
1689
|
+
const s = (it && it.sug) || {};
|
|
1690
|
+
const meta = {
|
|
1691
|
+
server: it.name,
|
|
1692
|
+
id: sugIdOf(s),
|
|
1693
|
+
package: s.name || it.name,
|
|
1694
|
+
transport: Array.isArray(s.risk) && s.risk.length ? s.risk.join('/') : (s.installState || 'not-installed'),
|
|
1695
|
+
source: s.source || null,
|
|
1696
|
+
homepage: s.homepage || null,
|
|
1697
|
+
note: '目录元数据 · 需人工接入——本面板零写盘、零自动安装;真实接入须由人工完成',
|
|
1698
|
+
};
|
|
1699
|
+
eqCopyText(JSON.stringify(meta, null, 2), () => setEqCopyMsg('已复制安装信息'));
|
|
1700
|
+
};
|
|
1701
|
+
const copyApplyText = () => {
|
|
1702
|
+
const text = '【捕风工坊 · 装备申请(降级通道:本会话无装备写权限)】\n'
|
|
1703
|
+
+ 'nodeId: ' + (node.id || '—') + '\n'
|
|
1704
|
+
+ '目标: ' + ((applyInfo && applyInfo.name) || (selIt ? selIt.name : '—')) + '\n'
|
|
1705
|
+
+ '操作: ' + ((applyInfo && applyInfo.tag) || '—') + '\n'
|
|
1706
|
+
+ '办理方式: 总管会话执行 bufeng_update_node(equip 轴补丁——allowTools/denyTools/allowSkills 精确名),'
|
|
1707
|
+
+ '或 bufeng_capabilities action=preview → action=apply(confirm + fromPreview,按本申请逐项落盘)';
|
|
1708
|
+
eqCopyText(text, () => setEqCopyMsg('已复制装备申请'));
|
|
1709
|
+
};
|
|
1710
|
+
const selectItem = (key) => {
|
|
1711
|
+
// 按条目 key 前缀分轴(key 自描述):跨轴隐藏容器的 onClick 闭包持有旧渲染 axis,
|
|
1712
|
+
// 读闭包 axis 会把 skill 条目写进 selMcp 槽(EQ-08 选中态迁移失效根因)。
|
|
1713
|
+
if (String(key).indexOf('skill:') === 0) setSelSkill(key); else setSelMcp(key);
|
|
1714
|
+
setEqConfirm(null);
|
|
1715
|
+
};
|
|
1716
|
+
const opLabel = (op) => ({ shield: '屏蔽', narrow: '收窄', uninstall: '卸下' }[op] || op);
|
|
1717
|
+
const opTitle = (op, it) => {
|
|
1718
|
+
if (op === 'shield') return '屏蔽:denyTools 追加式拉黑该工具(可逆;denyTools 仅 MCP 轴)';
|
|
1719
|
+
if (op === 'narrow') return '收窄:' + (it.axisField === 'allowSkills' ? 'allowSkills' : 'allowTools') + ' 白名单收窄至仅此一项';
|
|
1720
|
+
return '卸下:从 ' + (it.axisField === 'allowSkills' ? 'allowSkills' : 'allowTools') + ' 精确移除该名——卸下最后一项将被服务端拒绝'
|
|
1721
|
+
+ '(空数组四拒),显式清空该轴走 bufeng_update_node equip:<轴>=[]';
|
|
1722
|
+
};
|
|
1723
|
+
const opDesc = (op, it) => {
|
|
1724
|
+
const patch = opPatchOf(op, it);
|
|
1725
|
+
const ax = Object.keys(patch)[0];
|
|
1726
|
+
return opLabel(op) + ' 将按轴精确写入 ' + ax + '(改动前 ' + JSON.stringify(curAxisList(ax)) + ' → 改动后 ' + JSON.stringify(patch[ax])
|
|
1727
|
+
+ ');走 preview→apply 双凭据(confirm + fromPreview),与工具路径同语义。';
|
|
1728
|
+
};
|
|
1729
|
+
// 左列表条目(按钮)+徽标(低置信/已装未用/来源+得分副行)
|
|
1730
|
+
const eqItemEl = (g, it) => {
|
|
1731
|
+
const on = it.key === selKey;
|
|
1732
|
+
const attrs = { key: it.key, className: 'bf-eqitem' + (on ? ' bf-eqitem-on' : ''), 'data-bf-eqitem': it.key,
|
|
1733
|
+
title: dispNameOf(it) + '(' + it.srcLabel + ')——点击查看详情',
|
|
1734
|
+
onClick: (e) => { if (e && e.stopPropagation) e.stopPropagation(); selectItem(it.key); } };
|
|
1735
|
+
if (on) attrs['data-bf-eqitem-on'] = it.key; // 激活标记条件挂载:非激活条目不挂键(防收集器 =undefined 噪音对)
|
|
1736
|
+
const hint = g.id === 'installed' ? hintOf(it) : null;
|
|
1737
|
+
return h('button', attrs,
|
|
1738
|
+
h('span', { className: 'bf-eqitem-nm' }, dispNameOf(it)),
|
|
1739
|
+
h('span', { className: 'bf-eqitem-sub' }, it.srcLabel
|
|
1740
|
+
+ (it.sug && it.sug.score != null ? ' · 得分 ' + Number(it.sug.score).toFixed(2) : '')),
|
|
1741
|
+
it.low ? h('span', { className: 'bf-eqlow', 'data-bf-eqlow': '1',
|
|
1742
|
+
title: '低置信:未达正式闸(核心域/加权分/覆盖),需人工判断后再装备' }, '低置信,需人工判断') : null,
|
|
1743
|
+
hint ? h('span', { className: 'bf-equnused', 'data-bf-equnused': '1',
|
|
1744
|
+
title: (hint.reason || '已挂接但近期未使用') + '(建议单 hints 只读投影)' }, '已装未用 ' + hint.unusedDays + ' 天') : null);
|
|
1745
|
+
};
|
|
1746
|
+
// 组(组头=标题+计数徽标[+刷新钮];空组出说明行)
|
|
1747
|
+
const eqGroupEl = (g, ax) => h('div', { className: 'bf-eqgrp', key: ax + ':' + g.id,
|
|
1748
|
+
['data-bf-' + ax + 'grp']: g.id },
|
|
1749
|
+
h('div', { className: 'bf-eqgrp-hd' },
|
|
1750
|
+
h('span', { className: 'bf-eqgrp-ttl' }, g.title),
|
|
1751
|
+
h('span', { className: 'bf-eqgrp-cnt', 'data-bf-grpcnt': ax + ':' + g.id + ':' + g.items.length,
|
|
1752
|
+
title: '实时派生计数(非硬编码)' }, String(g.items.length)),
|
|
1753
|
+
g.refresh ? h('button', { className: 'bf-eqgrp-refresh', 'data-bf-eqrefresh': '1',
|
|
1754
|
+
disabled: sugBusy,
|
|
1755
|
+
title: sugBusy ? '建议单拉取中——在途防抖(重复点击已合并)'
|
|
1756
|
+
: '重拉建议单(GET /bufeng/api/suggest 只读——不触碰官方目录、零 catalog 写口;服务端 60s memo:窗口内可能返回缓存单,装备 apply 后自动失效)',
|
|
1757
|
+
onClick: (e) => { if (e && e.stopPropagation) e.stopPropagation(); loadSuggest(); } },
|
|
1758
|
+
sugBusy ? '⟳ 刷新中…' : '⟳ 刷新推荐') : null),
|
|
1759
|
+
g.items.length ? g.items.map((it) => eqItemEl(g, it))
|
|
1760
|
+
: h('div', { className: 'bf-eqgrp-empty' }, g.emptyText || '(空)'));
|
|
1761
|
+
// 右详情六要素:名称/来源/描述/推荐理由(推荐条目)/安装态/操作区
|
|
1762
|
+
const stateTextOf = (it) => it.stateVal === 'builtin' ? '恒可用' : it.stateVal === 'installed' ? '已挂接' : '未装备';
|
|
1763
|
+
const opsRow = (() => {
|
|
1764
|
+
if (!selIt) return h('div', { className: 'bf-eqops', 'data-bf-eqops': '1' }, '左列表选择条目查看可执行操作');
|
|
1765
|
+
if (selIt.bundled) return h('div', { className: 'bf-eqops', 'data-bf-eqops': '1' },
|
|
1766
|
+
'默认集技能(bundled):无需装备、恒可用;不可卸下/收窄/屏蔽——语义B 下默认集不可卸下(全仓无 denySkills 轴)。');
|
|
1767
|
+
if (selIt.low) return h('div', { className: 'bf-eqops', 'data-bf-eqops': '1' },
|
|
1768
|
+
'低置信候选:未达正式闸(核心域/加权分/覆盖),需人工判断——本面板不提供直装;如确认可用,走 bufeng_update_node 手动写入装备。');
|
|
1769
|
+
if (selIt.cat) return h('div', { className: 'bf-eqops', 'data-bf-eqops': '1' },
|
|
1770
|
+
h('button', { className: 'bf-ctl bf-eqcopy', 'data-bf-eqcopy': sugIdOf(selIt.sug),
|
|
1771
|
+
title: '复制目录元数据(JSON:server/来源 URL/主页/风险标注)——粘贴给运维人工接入,本面板零写盘零自动安装',
|
|
1772
|
+
onClick: (e) => { if (e && e.stopPropagation) e.stopPropagation(); copyInstallInfo(selIt); } }, '复制安装信息'),
|
|
1773
|
+
h('div', { className: 'bf-eqredline' },
|
|
1774
|
+
'目录元数据 · 需人工接入:本页仅展示元数据与「复制安装信息」,不提供「装备」按钮、不进入直装链;真实接入须由人工完成。'));
|
|
1775
|
+
if (selIt.group === 'reco') return h('div', { className: 'bf-eqops', 'data-bf-eqops': '1' },
|
|
1776
|
+
eqBusy ? h('button', { className: 'bf-ctl bf-eqinstall-loading', 'data-bf-eqinstall-loading': '1', disabled: true,
|
|
1777
|
+
title: '装备链处理中(preview→apply 自动串联,防双击重入)' }, '装备中…')
|
|
1778
|
+
: h('button', { className: 'bf-ctl bf-eqinstall', 'data-bf-eqinstall': selIt.name,
|
|
1779
|
+
title: '装备:自动串联 preview→apply(confirm:true+fromPreview 双凭据原样,flow=direct)——服务端审计留痕',
|
|
1780
|
+
onClick: (e) => { if (e && e.stopPropagation) e.stopPropagation(); runEquip(selIt, 'direct'); } }, '装备'));
|
|
1781
|
+
const ops = selIt.kind === 'mcp' ? ['shield', 'narrow', 'uninstall'] : ['narrow', 'uninstall'];
|
|
1782
|
+
return h('div', { className: 'bf-eqops', 'data-bf-eqops': '1' }, ops.map((op) =>
|
|
1783
|
+
h('button', { className: 'bf-ctl bf-eqop', 'data-bf-eqop': op, key: op, title: opTitle(op, selIt),
|
|
1784
|
+
onClick: (e) => { if (e && e.stopPropagation) e.stopPropagation(); setEqConfirm(op); } }, opLabel(op))));
|
|
1785
|
+
})();
|
|
1786
|
+
const detailEl = selIt ? h('div', { className: 'bf-eqdetail', 'data-bf-eqdetail': '1' },
|
|
1787
|
+
h('div', { className: 'bf-eqdetail-hd' },
|
|
1788
|
+
h('h4', { className: 'bf-eqname', 'data-bf-eqname': '1' }, dispNameOf(selIt)),
|
|
1789
|
+
h('span', { className: 'bf-eqsrc', 'data-bf-eqsrc': '1' }, selIt.srcLabel),
|
|
1790
|
+
selIt.low ? h('span', { className: 'bf-eqlow', 'data-bf-eqlow': '1' }, '低置信,需人工判断') : null,
|
|
1791
|
+
(hintOf(selIt) && selIt.group === 'installed') ? h('span', { className: 'bf-equnused', 'data-bf-equnused': '1' },
|
|
1792
|
+
'已装未用 ' + hintOf(selIt).unusedDays + ' 天') : null),
|
|
1793
|
+
clampDesc(selIt.desc, 'eqd:' + selIt.key),
|
|
1794
|
+
(selIt.sug && selIt.group === 'reco') ? h('div', { className: 'bf-eqwhy', 'data-bf-eqwhy': '1' },
|
|
1795
|
+
'推荐理由:',
|
|
1796
|
+
((selIt.sug.matchedTokens) || []).map((tk) => h('span', { className: 'bf-eqhit', 'data-bf-eqhit': String(tk), key: 'hit-' + tk }, String(tk))),
|
|
1797
|
+
h('span', { className: 'bf-eqscore' }, '得分 ' + Number(selIt.sug.score || 0).toFixed(2)),
|
|
1798
|
+
h('span', { className: 'bf-eqreason' }, selIt.sug.reason || '')) : null,
|
|
1799
|
+
h('div', { className: 'bf-eqstaterow' },
|
|
1800
|
+
h('span', { className: 'bf-eqstate', 'data-bf-eqstate': selIt.stateVal,
|
|
1801
|
+
title: '安装态(「已安装」仅 MCP 侧;技能=默认集/额外项/未装备)' }, stateTextOf(selIt))),
|
|
1802
|
+
opsRow,
|
|
1803
|
+
(eqConfirm && selIt && !selIt.bundled && !selIt.low && !selIt.cat) ? h('div', { className: 'bf-eqconfirm', 'data-bf-eqconfirm': '1' },
|
|
1804
|
+
h('div', { className: 'bf-eqconfirm-t' }, opDesc(eqConfirm, selIt)),
|
|
1805
|
+
h('button', { className: 'bf-ctl bf-eqopgo', 'data-bf-eqopgo': eqConfirm, disabled: eqBusy,
|
|
1806
|
+
title: opTitle(eqConfirm, selIt) + '——确认后自动串联 preview→apply(flow=confirm)',
|
|
1807
|
+
onClick: (e) => { if (e && e.stopPropagation) e.stopPropagation(); runOp(selIt, eqConfirm); } }, '确认' + opLabel(eqConfirm)),
|
|
1808
|
+
h('button', { className: 'bf-ctl bf-eqopcancel', 'data-bf-eqopcancel': eqConfirm,
|
|
1809
|
+
title: '取消本次操作(本地放弃,不落盘不发请求)',
|
|
1810
|
+
onClick: (e) => { if (e && e.stopPropagation) e.stopPropagation(); setEqConfirm(null); } }, '取消')) : null,
|
|
1811
|
+
selIt.cat ? h('div', { className: 'bf-eqmeta' },
|
|
1812
|
+
h('div', null, '未安装、未审计——目录候选未经本仓验证,接入须由人工完成'),
|
|
1813
|
+
(selIt.sug.source && selIt.sug.source.type) ? h('div', null, '来源:' + selIt.sug.source.type
|
|
1814
|
+
+ (selIt.sug.source.url ? '(' + selIt.sug.source.url + ')' : '')) : null,
|
|
1815
|
+
selIt.sug.homepage ? h('div', null, '主页:' + selIt.sug.homepage) : null) : null)
|
|
1816
|
+
: h('div', { className: 'bf-eqdetail bf-eqdetail-empty', 'data-bf-eqdetail': '1' }, '左列表选择条目查看详情');
|
|
1817
|
+
// 未装备节点降级文案(v0.31 弹窗③口径):equip=null(未配置装备)时装备页顶部直出——默认全量工具面可用
|
|
1818
|
+
const unequipBanner = (eq === null) ? h('div', { className: 'bf-eqempty', 'data-bf-equnusedbanner': '1' },
|
|
1819
|
+
'未装备(默认全量工具面:bufeng_* 全集与默认集技能可用;装备后按白名单收窄)') : null;
|
|
1820
|
+
// 建议单拉取失败横幅(k-mw0ala3c053):loadSuggest 失败→错误横幅+重试钮(锚=data-bf-eqcatrefresh)
|
|
1821
|
+
// 与 stale 横幅互斥(sugErr 优先——恰 1 锚/帧),重试走 loadSuggest 同链,成功即消失。
|
|
1822
|
+
const sugBanner = sugErr ? h('div', { className: 'bf-eqcat bf-eqcaterr', 'data-bf-eqcaterr': '1' },
|
|
1823
|
+
'建议单拉取失败:' + sugErr,
|
|
1824
|
+
h('button', { className: 'bf-ctl bf-eqcatrefresh', 'data-bf-eqcatrefresh': '1',
|
|
1825
|
+
title: '重试:刷新目录快照(POST /bufeng/api/catalog 唯一客户端刷新口,60min 节流)成功后自动重拉建议单(GET suggest)',
|
|
1826
|
+
disabled: catState === 'loading',
|
|
1827
|
+
onClick: (e) => { if (e && e.stopPropagation) e.stopPropagation(); refreshCatalog(); } }, '重试')) : null;
|
|
1828
|
+
// 目录状态行(轴无关):stale 灰标+刷新 / catdown 灰标(公网候选退场)——sugErr 在场时让位错误横幅(互斥:恰 1 个 data-bf-eqcatrefresh/帧)
|
|
1829
|
+
const catBanner = sugErr ? null
|
|
1830
|
+
: ((catStale && !catFresh) ? h('div', { className: 'bf-eqcat bf-eqcatstale', 'data-bf-eqcatstale': '1' },
|
|
1831
|
+
'目录快照 ' + catHours + ' 小时前,点击刷新',
|
|
1832
|
+
h('button', { className: 'bf-ctl bf-eqcatrefresh', 'data-bf-eqcatrefresh': '1',
|
|
1833
|
+
title: '刷新目录快照(POST /bufeng/api/catalog 唯一客户端刷新口,60min 节流/24h 全量周期语义服务端原样;成功后自动重拉建议单)',
|
|
1834
|
+
disabled: catState === 'loading',
|
|
1835
|
+
onClick: (e) => { if (e && e.stopPropagation) e.stopPropagation(); refreshCatalog(); } }, '刷新'))
|
|
1836
|
+
: (!catAvailable ? h('div', { className: 'bf-eqcat bf-eqcatdown', 'data-bf-eqcatdown': '1' }, '目录暂不可用,稍后重试') : null));
|
|
1837
|
+
// 目录刷新四态容器(data-bf-eqcatrefresh-state ∈ loading|ok|err|throttled;常态 catState=null 不渲染——EQ-CAT4-0):
|
|
1838
|
+
// 与两处横幅刷新钮(data-bf-eqcatrefresh)同链——loading 置灰防重 / ok 快照已刷新 / err 人话主句+lastError 字面值
|
|
1839
|
+
// 小字(data-bf-eqcatraw=ratelimit|generic,k-mw54fw24052 A截;注入臂 code+cause 内联原样) / throttled 明示节流约 N 分钟。
|
|
1840
|
+
// 锚名恒定不改(判据逐字契约;源码+产物双半边在册=EQ-CAT4-7)。
|
|
1841
|
+
const catStateLine = !catState ? null
|
|
1842
|
+
: h('div', { className: 'bf-eqcat bf-eqcatstate', 'data-bf-eqcatrefresh-state': catState },
|
|
1843
|
+
catState === 'loading' ? '⟳ 目录刷新中…'
|
|
1844
|
+
: catState === 'ok' ? '✅ 目录快照已刷新(建议单已重拉)'
|
|
1845
|
+
: catRaw ? [ // k-mw54fw24052 A截:主句人话+字面值小字次要层级(四态骨架与 state 锚零改动;锚名恒定不改红线)
|
|
1846
|
+
h('div', { className: 'bf-eqcatmain' }, catMsg || '目录刷新失败'),
|
|
1847
|
+
h('div', { className: 'bf-eqcatraw', 'data-bf-eqcatraw': catRaw.kind,
|
|
1848
|
+
style: { fontSize: '11px', opacity: '0.72', marginTop: '2px', wordBreak: 'break-all' } }, catRaw.text)]
|
|
1849
|
+
: (catMsg || '目录刷新失败'));
|
|
1850
|
+
// 空态行:建议单在册但推荐+低置信全空(full 形态不渲染)
|
|
1851
|
+
const emptyBanner = (!sheetRow || (sugAll.length === 0 && lowAll.length === 0))
|
|
1852
|
+
? h('div', { className: 'bf-eqempty', 'data-bf-eqempty': '1' },
|
|
1853
|
+
'无达标推荐(低置信候选 ' + lowAll.length + ' 条,需人工判断)') : null;
|
|
1854
|
+
// 回执卡(v0.61 样例基准文案形态,去演示措辞):第①跳 preview / 第②跳 apply / 改动前→改动后 / effects / note
|
|
1855
|
+
const rcCard = eqRc ? h('div', { className: 'bf-eqrc', 'data-bf-eqrc': '1' },
|
|
1856
|
+
h('div', { className: 'bf-eqrc-title' }, '✅ 回执 · ' + eqRc.tag + ' ' + eqRc.name),
|
|
1857
|
+
h('div', { className: 'bf-eqrc-line' }, '第①跳 preview → previewHash ' + eqRc.hash),
|
|
1858
|
+
h('div', { className: 'bf-eqrc-line' }, '第②跳 apply → confirm: true · fromPreview: ' + eqRc.hash + ' · 已落盘'),
|
|
1859
|
+
h('div', { className: 'bf-eqrc-diff' }, JSON.stringify(eqRc.before) + ' → ' + JSON.stringify(eqRc.after)
|
|
1860
|
+
+ '(改动前 → 改动后,按轴精确 patch:未涉轴整键缺席)'),
|
|
1861
|
+
(Array.isArray(eqRc.effects) && eqRc.effects.length) ? h('div', { className: 'bf-eqrc-eff' },
|
|
1862
|
+
'effects: ' + eqRc.effects.join(';')) : null,
|
|
1863
|
+
eqRc.note ? h('div', { className: 'bf-eqrc-note' }, eqRc.note) : null,
|
|
1864
|
+
h('div', { className: 'bf-eqrc-foot' }, '列表将自动重拉建议单(服务端已失效缓存)')) : null;
|
|
1865
|
+
// 降级卡(403 无装备写权限)+普通错误行
|
|
1866
|
+
const degradeCard = noPerm ? h('div', { className: 'bf-eqrc bf-eqdegrade' },
|
|
1867
|
+
h('div', { className: 'bf-eqrc-title' }, '⛔ 装备通道拒绝:' + eqErr),
|
|
1868
|
+
h('button', { className: 'bf-ctl bf-eqapplycopy', 'data-bf-eqapplycopy': '1',
|
|
1869
|
+
title: '复制标准化装备申请文案(nodeId+目标+操作+办理方式)——粘贴给总管会话办理(bufeng_update_node / preview→apply 双凭据)',
|
|
1870
|
+
onClick: (e) => { if (e && e.stopPropagation) e.stopPropagation(); copyApplyText(); } }, '复制装备申请'),
|
|
1871
|
+
h('div', { className: 'bf-eqrc-note' }, '本会话无装备写权限——把申请文案粘贴给总管会话,由总管执行 bufeng_update_node(equip 轴补丁)落盘。')) : null;
|
|
1872
|
+
const errLine = (!noPerm && eqErr) ? h('div', { className: 'bf-eqerr', 'data-bf-eqerr': '1' }, '❌ 装备通道:' + eqErr) : null;
|
|
1873
|
+
const copyLine = eqCopyMsg ? h('div', { className: 'bf-eqcopymsg' }, eqCopyMsg) : null;
|
|
1874
|
+
// S1 页脚紧凑化(伞单 k-mw3zzzci0in):页脚说明默认折叠单行壳——正文信息不删只挪位收窄
|
|
1875
|
+
// (正文两块由旧位切片原样搬运:锚名 data-bf-caphint/data-bf-eqterms 与文本逐字保留;收起态
|
|
1876
|
+
// display:none 隐藏挂载=收集器可捕获;旧两段直出展开形态退役,收口上移壳层)
|
|
1877
|
+
const footAttrs = { className: 'bf-capfoot', 'data-bf-capfoot': '1' };
|
|
1878
|
+
if (footOpen) footAttrs['data-bf-capfoot-on'] = '1'; // 展开标记条件挂载:收起态不挂键(防收集器 =undefined 噪音对,沿 axAttrs 先例)
|
|
1879
|
+
const capfoot = h('div', footAttrs,
|
|
1880
|
+
h('button', { className: 'bf-capfoot-toggle', 'data-bf-capfoottoggle': '1',
|
|
1881
|
+
onClick: (e) => { if (e && e.stopPropagation) e.stopPropagation(); setFootOpen(!footOpen); } },
|
|
1882
|
+
footOpen ? '▾ 装备页脚说明(点击收起)' : '▸ 装备页脚说明(点击展开)'),
|
|
1883
|
+
h('div', { className: 'bf-capfoot-body', style: { display: footOpen ? 'flex' : 'none' } },
|
|
1884
|
+
h('div', { className: 'bf-capitem-desc', 'data-bf-caphint': '1' },
|
|
1885
|
+
'只读查看层:装备变更走 bufeng_update_node(预设用 agentPreset、MCP 工具用 allowTools/denyTools 精确名、'
|
|
1886
|
+
+ '技能白名单用 allowSkills——语义B:默认集∪额外项,运行期入口=bufeng_skill)——本地推荐项可用「装备」直装'
|
|
1887
|
+
+ '(preview→apply 双凭据自动串联,服务端审计留痕);公网候选零自动安装;其余分区只读'),
|
|
1888
|
+
h('div', { className: 'bf-eqterms', 'data-bf-eqterms': '1' },
|
|
1889
|
+
'术语对照:默认集(bundled)=宿主自带恒可用技能;额外项(allowSkills)=bufeng_update_node 技能白名单追加;'
|
|
1890
|
+
+ '已挂接/已安装仅 MCP 侧;预设:走 bufeng_update_node(agentPreset 装备校验恒拒面板直改)。'
|
|
1891
|
+
)));
|
|
1892
|
+
const axAttrs = (v) => { const a = { key: 'ax-' + v, className: 'bf-eqaxis' + (axis === v ? ' bf-eqaxis-on' : ''),
|
|
1893
|
+
'data-bf-axistab': v,
|
|
1894
|
+
title: v === 'skill' ? '技能轴:默认集(恒可用)/额外项(allowSkills)/推荐' : 'MCP 轴:已挂接/推荐(公网候选零自动安装)',
|
|
1895
|
+
onClick: (e) => { if (e && e.stopPropagation) e.stopPropagation(); setAxis(v); setEqConfirm(null); } };
|
|
1896
|
+
if (axis === v) a['data-bf-axistab-on'] = v; // 激活标记条件挂载:非激活轴不挂键(防收集器 =undefined 噪音对)
|
|
1897
|
+
return a; };
|
|
1898
|
+
const equipPaneContent = [
|
|
1899
|
+
sugBanner, // k-mw0ala3c053:建议单失败横幅(与 catBanner 互斥——sugErr 优先)
|
|
1900
|
+
catBanner,
|
|
1901
|
+
catStateLine, // 目录刷新四态容器(data-bf-eqcatrefresh-state;常态缺席)
|
|
1902
|
+
h('div', { className: 'bf-eqaxisbar', role: 'tablist' },
|
|
1903
|
+
// 判据 EQ-DEV-01a:图标+文字 tab——图标=元素子节点(字符惯例:🧰=技能轴在册用字,🔌=MCP 轴,勿引新依赖)
|
|
1904
|
+
h('button', axAttrs('skill'), h('span', { className: 'bf-eqaxis-ic', 'aria-hidden': 'true' }, '🧰'), 'Skill'),
|
|
1905
|
+
h('button', axAttrs('mcp'), h('span', { className: 'bf-eqaxis-ic', 'aria-hidden': 'true' }, '🔌'), 'MCP')),
|
|
1906
|
+
h('div', { className: 'bf-eqsplit' },
|
|
1907
|
+
h('div', { className: 'bf-eqlist' },
|
|
1908
|
+
axisGroups.map((g) => eqGroupEl(g, axis)),
|
|
1909
|
+
// 对侧轴条目隐藏挂载(display:none):切轴后无需重渲即可被判据 clicks 捕获(数据锚/onClick 照挂;
|
|
1910
|
+
// 组头组锚不随挂——EQ-07b 口径组锚只随当前轴;条目键带轴前缀 skill:*/mcp:* 与当前轴锚不冲突)
|
|
1911
|
+
h('div', { className: 'bf-eqhidden', key: 'eqhidden-' + axis },
|
|
1912
|
+
(axis === 'skill' ? mcpGroups : skillGroups).reduce((acc, g) => acc.concat(g.items), [])
|
|
1913
|
+
.map((it) => eqItemEl({ id: 'hidden' }, it)))),
|
|
1914
|
+
detailEl),
|
|
1915
|
+
unequipBanner,
|
|
1916
|
+
emptyBanner,
|
|
1917
|
+
rcCard, degradeCard, errLine, copyLine,
|
|
1918
|
+
];
|
|
1919
|
+
return h('div', { className: 'bf-capmodal-mask', 'data-bf-modalmask': '1',
|
|
1920
|
+
title: '遮罩点击关闭详情(Esc/✕ 同效)',
|
|
1921
|
+
onClick: (e) => { if (e && e.stopPropagation) e.stopPropagation(); if (onClose) onClose(); } },
|
|
1922
|
+
// 三 tab 统一宽度(客户 2026-11-03 拍板):概览/提示词/装备弹窗一律 min(760px,100vw),tab 来回切换零宽度跳变
|
|
1923
|
+
h('div', { className: 'bf-capmodal', 'data-bf-capmodal': '1',
|
|
1924
|
+
// 模块级弹窗根引用:挂载写入 / 卸载(ref(null))清空——滚轮分流判定不依赖选择器
|
|
1925
|
+
ref: (el) => { capModalEl = el || null; },
|
|
1926
|
+
onClick: (e) => { if (e && e.stopPropagation) e.stopPropagation(); }, onPointerDown: (e) => e.stopPropagation() },
|
|
1927
|
+
h('div', { className: 'bf-capmodal-head' },
|
|
1928
|
+
h('div', { className: 'bf-capmodal-ico', 'data-kind': node.kind || 'member' },
|
|
1929
|
+
node.kind === 'root' ? '✦' : node.kind === 'leader' ? '◆' : '◇'),
|
|
1930
|
+
h('div', { className: 'bf-capmodal-ttl' },
|
|
1931
|
+
h('div', { className: 'bf-capmodal-name' }, node.name || node.id || '—'),
|
|
1932
|
+
h('div', { className: 'bf-capmodal-sub' },
|
|
1933
|
+
[node.kindLabel || node.kind || '节点', treeNode ? treeNode.name : '', statusText].filter(Boolean).join(' · '))),
|
|
1934
|
+
h('button', { className: 'bf-ctl', 'data-bf-modalclose': '1', title: '关闭详情(Esc/遮罩点击同效)',
|
|
1935
|
+
onClick: (e) => { if (e && e.stopPropagation) e.stopPropagation(); if (onClose) onClose(); } }, '✕')),
|
|
1936
|
+
h('div', { className: 'bf-capmodal-chips' },
|
|
1937
|
+
h('span', { className: 'bf-capchip' }, '模型 ', h('b', null, modelText)),
|
|
1938
|
+
h('span', { className: 'bf-capchip' }, 'id ', h('b', null, node.id || '—'))),
|
|
1939
|
+
h('div', { className: 'bf-caphead', 'data-bf-caphead': '1',
|
|
1940
|
+
title: '宿主能力面全局汇总(空态面板同锚显示)' }, hostCapsText(caps)),
|
|
1941
|
+
// v0.34.2(k-mvhfckb701p):弹窗滚轮分流自证行已移除;分流逻辑本体不动——capModalEl + wheelInCapModal 两段共用判定见文件头注释。
|
|
1942
|
+
(caps && caps.skillsNote) ? h('div', { className: 'bf-capitem-desc' }, '⚠ ' + caps.skillsNote)
|
|
1943
|
+
: (!caps || !Array.isArray(caps.skills)) ? h('div', { className: 'bf-capitem-desc' }, '⚠ 能力面数据不可用(旧快照/降级)')
|
|
1944
|
+
: null,
|
|
1945
|
+
(caps && caps.mcpNote) ? h('div', { className: 'bf-capitem-desc' }, '⚠ ' + caps.mcpNote) : null,
|
|
1946
|
+
// v0.35.2/v0.47.3:presetsNote 仅在预设目录真实存在(presets.length>0)且非全零形态时显示(预设分区本体已退役)
|
|
1947
|
+
(caps && caps.presetsNote && presets.length > 0 && !presetsZero) ? h('div', { className: 'bf-capitem-desc' }, '⚠ ' + caps.presetsNote) : null,
|
|
1948
|
+
h('div', { className: 'bf-capmodal-tabs' },
|
|
1949
|
+
tabBtn('overview', '概览'), tabBtn('prompt', '提示词'), tabBtn('equip', '装备')),
|
|
1950
|
+
h('div', { className: 'bf-capmodal-body' },
|
|
1951
|
+
overviewPane, promptPane,
|
|
1952
|
+
// v0.61.0 S2 装备 tab:条件渲染(tab==='equip' 才挂 vdom)——overview/prompt pane 常挂 display 切换,
|
|
1953
|
+
// 装备 pane 整块随 tab 挂/退(graph 防泄漏负锚口径:非装备 tab 零 eqdetail/eqitem 锚);
|
|
1954
|
+
// equipPaneContent 逐项展开为 children 参数(禁嵌套数组形态,对齐 walk 收集器扁平遍历口径)
|
|
1955
|
+
(tab === 'equip' ? h('div', { className: 'bf-cappane', 'data-bf-cappane': 'equip', style: { display: 'flex' } },
|
|
1956
|
+
h('div', { className: 'bf-eqpane' }, ...equipPaneContent)) : null)),
|
|
1957
|
+
capfoot));
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
/* 导出由各函数声明本身提供(EquipBadge/EquipModal/hostCapsText/wheelInCapModal),不再重复 export 列表。 */
|
|
1961
|
+
return { bumpEqOpenSeq, wheelInCapModal, hostCapsText, EquipBadge, EquipModal };
|
|
1962
|
+
})();
|
|
1963
|
+
/* ============================== src/graph.js ============================== */
|
|
1964
|
+
__mods["graph.js"] = (() => {
|
|
1965
|
+
const { h, useState, useRef, useMemo, useCallback, useEffect } = __mods["react.js"];
|
|
1966
|
+
const { Badge, clip, DIM, LINE, LABEL, TASK_STATUS_ORDER, taskStatusView } = __mods["ui.js"];
|
|
1967
|
+
const { TwoSeg, Twig, ImproveBtnAll, RetireBtn, ModelDirectCtl } = __mods["cards.js"];
|
|
1968
|
+
const { EquipBadge, EquipModal, hostCapsText, wheelInCapModal, bumpEqOpenSeq } = __mods["capabilities.js"];
|
|
1969
|
+
const { RoleIconLg, isRootKind } = __mods["icons.js"];
|
|
1970
|
+
/**
|
|
1971
|
+
* client/src/graph.js — 图模型 / tidy-tree 布局 / 贝塞尔连线 / 缩放平移交互画布。
|
|
1972
|
+
* v0.25 批2-T4 概览瘦身:本 tab 只负责智能体管理(节点卡/退役/模型配置)+运行状态(节点卡 activity
|
|
1973
|
+
* 行=运行中任务标题)+任务数统计(顶部 OverviewStats 条,消费快照 summary.tasks);
|
|
1974
|
+
* 任务明细/链路关系视图移交任务看板 tab(taskboard.js)——概览不渲染任务列表区块(sim 判据看守)。
|
|
1975
|
+
* v0.27-T6 司南名单化:总管席位以树级快照 rootRoster 为唯一真相源(每条名单记录一张总管卡,
|
|
1976
|
+
* 首条=值班、⏫ 提升挂值班席,其余=同权席);旧快照(无 rootRoster)走 rootSessionId 首条投影渲染单席不破版。
|
|
1977
|
+
* v0.27.1 前端热修(三缺陷):①归档树不再与活跃树平铺——主图只渲染 active 树,归档树收纳为
|
|
1978
|
+
* 「历史树 ×N」折叠徽标(ArchivedStrip,可展开名单);②rootId 回归修复——T6 后 orch 元素为包装对象
|
|
1979
|
+
* (无 id)致 rootId=undefined → 全节点 parentId=undefined 平铺第 0 行 + 连线全空,现取首条席位卡 id
|
|
1980
|
+
* (treeId::anchor);③司南单卡化——每活跃树恒 1 张总管卡(值班席=名单首条为卡主体),其余席位收进
|
|
1981
|
+
* 卡内「在岗会话 ×N」明细展开区(label/入列/活跃 + 每行 ⏫),只改皮肤不动名单制引擎;④fit() 贴底/
|
|
1982
|
+
* 空白修复——内容装不下时锚定左上角于留白边距,不再对称负逸出。
|
|
1983
|
+
* v0.31 阶段1 展示重构(客户拍板重新设计,ADR:docs/决策/2026-10-19-看板展示重构-卡片徽章与详情弹窗.md):
|
|
1984
|
+
* ①「历史树」折叠条退役——归档树零上图零折叠徽标(ArchivedStrip 删除;账本归档数据不动,仅展示层);
|
|
1985
|
+
* ②能力面融入节点卡——卡内三段长文案(EquipView)与顶部独立汇总条(CapabilityStrip)退役,改由概览徽章
|
|
1986
|
+
* EquipBadge(🧰 技能 N · MCP 工具 M[ · 白名单 ×K| · 仅默认集],点击开弹窗)+详情弹窗 EquipModal
|
|
1987
|
+
* (装备现状/技能清单含名称+说明/MCP server+工具/预设/matches 五分区,✕/Esc/遮罩点击关闭)承载;
|
|
1988
|
+
* 宿主全局汇总行 hostCapsText 常驻弹窗头部+空态面板(data-bf-caphead)。数据源=快照 capabilities/
|
|
1989
|
+
* nodes.equip/nodes.matches 客户端聚合,零新端点;弹窗纯只读(零 POST/零 apply——sim 负锚看守)。
|
|
1990
|
+
* 看板交互修复(k-mvgicmoa03o,2026-10-20 客户反馈两点):①详情弹窗打开时滚轮仍缩放底层智能体地图
|
|
1991
|
+
* (window 捕获段接管全部滚轮,弹窗右侧滚动条拖动保留——缩放与拖滚动条不互斥);②布局常量
|
|
1992
|
+
* GH 92→132/GY 46→60/GX 32→40——GH 对齐真实卡高修连线穿卡片,层间垂直间距明显加大+同层横向放宽。
|
|
1993
|
+
* 弹窗滚轮共存修正(k-mvgosn5z05l,2026-10-20 客户实机澄清):上一笔 window 捕获段无条件 preventDefault
|
|
1994
|
+
* 在实机把弹窗内容滚动整段吞掉(缩放生效、内容不滚)——现按悬停区域分流:弹窗内容区归还原生滚动,
|
|
1995
|
+
* 弹窗外遮罩/地图区接管缩放(详见 equipNode effect 注释);弹窗内曾留可见分流说明行+实时地图缩放读数作
|
|
1996
|
+
* 实机挂载自证,客户 2026-10-21 实机验收通过后已移除(v0.34.2,k-mvhfckb701p——属调试信息)。
|
|
1997
|
+
* 看板折叠键修复(k-mvm5m0c9062,客户缺陷:同树多都管折叠联动):折叠状态键=都管节点 id(lead.id)——
|
|
1998
|
+
* 原按树 id(t.id)每树只算一次 kidsCollapsed,同树多都管共用折叠态,点任一都管折叠钮全树成员一起收起;
|
|
1999
|
+
* 现 leads.forEach 内按 lead.id 逐都管求值 kidsCollapsed/foldLabel/collapseTarget,board.js 存储键换
|
|
2000
|
+
* bufeng-collapsed-leads(旧树 id 键安全忽略)。sim 两都管独立折叠判据 10 遍/10 判看守(旧产物必红)。
|
|
2001
|
+
*/
|
|
2002
|
+
|
|
2003
|
+
|
|
2004
|
+
// v0.40.8 阶段1:ModelCtl 弹层退役→ModelDirectCtl 三级联动直选(地图卡常驻可见)
|
|
2005
|
+
|
|
2006
|
+
|
|
2007
|
+
// v0.31 阶段1 能力面融入节点卡(概览徽章 EquipBadge+详情弹窗 EquipModal+宿主全局汇总行 hostCapsText)
|
|
2008
|
+
|
|
2009
|
+
|
|
2010
|
+
/* ---------- 使用概览条(批2-T4):智能体在岗 + 任务统计 + 日预算;一眼看使用情况,明细去任务看板 ---------- */
|
|
2011
|
+
function OverviewStats({ snap }) {
|
|
2012
|
+
const t = (snap && snap.summary && snap.summary.tasks) || {};
|
|
2013
|
+
const total = TASK_STATUS_ORDER.reduce((s, k) => s + (t[k] || 0), 0);
|
|
2014
|
+
const active = ((snap && snap.trees) || []).filter((x) => x && x.status === 'active');
|
|
2015
|
+
const allNodes = active.reduce((a, tr) => a.concat((tr && tr.nodes) || []), []);
|
|
2016
|
+
const cnt = (st) => allNodes.filter((n) => n && n.status === st).length;
|
|
2017
|
+
const running = cnt('running'), idle = cnt('idle'), paused = cnt('paused');
|
|
2018
|
+
const overdue = ((snap && snap.tasks) || []).filter((k) => k && k.overdue).length;
|
|
2019
|
+
const doneWin = ((snap && snap.tasks) || []).filter((k) => k && k.status === 'done').length;
|
|
2020
|
+
const budget = (snap && snap.budget) || null;
|
|
2021
|
+
const pct = budget && budget.limit ? Math.min(100, Math.round((budget.used || 0) / budget.limit * 100)) : 0;
|
|
2022
|
+
const fmt = (n) => n >= 1e6 ? (n / 1e6).toFixed(1) + 'M' : n >= 1e3 ? Math.round(n / 1e3) + 'k' : String(n);
|
|
2023
|
+
const st = (label, n, tone) => h('span', { className: 'bf-u-stat' },
|
|
2024
|
+
h('i', { className: 'bf-u-dot ' + tone }), h('b', null, n), h('span', null, label));
|
|
2025
|
+
return h('div', { className: 'bf-usage', 'data-bf-taskstats': '1',
|
|
2026
|
+
title: '智能体使用概览:在岗/待命/暂停 + 任务状态 + 日预算;任务明细与链路见任务看板 tab' },
|
|
2027
|
+
h('div', { className: 'bf-usage-row' },
|
|
2028
|
+
h('span', { className: 'bf-u-kicker' }, '使用概览'),
|
|
2029
|
+
h('span', { className: 'bf-u-chip' }, '● ' + (active[0] ? active[0].name : '无活跃树') + ' ' + running + '/' + allNodes.length + ' 在岗'),
|
|
2030
|
+
h('span', { className: 'bf-sp' }),
|
|
2031
|
+
budget ? h('span', { className: 'bf-u-budget' }, '日预算 ',
|
|
2032
|
+
h('i', { className: 'bf-u-bar' }, h('i', { style: { width: pct + '%' } })),
|
|
2033
|
+
h('b', null, pct + '%'), h('span', null, fmt(budget.used || 0) + ' / ' + fmt(budget.limit || 0))) : null),
|
|
2034
|
+
h('div', { className: 'bf-usage-row bf-usage-2' },
|
|
2035
|
+
h('span', { className: 'bf-u-kicker2' }, '任务统计'),
|
|
2036
|
+
st('在岗', running, 'run'), st('待命', idle, 'idle'), st('暂停', paused, 'paused'),
|
|
2037
|
+
st('在跑任务', t.running || 0, 'task'), st('排队', t.queued || 0, 'q'),
|
|
2038
|
+
st('超时', overdue, 'over'), st('近 15 条完成', doneWin, 'done'),
|
|
2039
|
+
h('span', { className: 'bf-sp' }),
|
|
2040
|
+
h('span', { className: 'bf-u-total' }, '账本任务 ' + total + ' 条')));
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
/* ---------- 图模型:snapshot → {id,parentId,卡参数} ---------- */
|
|
2044
|
+
// 编排拓扑:总管=root;各树都管挂总管(无都管树→成员直挂总管);成员挂本树都管。
|
|
2045
|
+
// 树本身不占卡位(源插件卡片=任务节点;捕风的树语义由都管卡的🌳徽章承载)。
|
|
2046
|
+
function buildGraphModel(snap, collapsedSet) {
|
|
2047
|
+
const nodes = [];
|
|
2048
|
+
const edges = [];
|
|
2049
|
+
const orch = [];
|
|
2050
|
+
/* v0.40.7 工作项一:节点→在跑任务数组(多任务并发可见),创建时间倒序;runOf=最新一条(活动行文案兼容旧行为) */
|
|
2051
|
+
const runsOf = {};
|
|
2052
|
+
for (const k of snap.tasks || []) if ((k.status === "running" || k.status === "pending") && k.nodeId) {
|
|
2053
|
+
(runsOf[k.nodeId] = runsOf[k.nodeId] || []).push(k);
|
|
2054
|
+
}
|
|
2055
|
+
for (const id of Object.keys(runsOf)) {
|
|
2056
|
+
runsOf[id].sort((a, b) => String(b.createdAt || "").localeCompare(String(a.createdAt || "")));
|
|
2057
|
+
}
|
|
2058
|
+
const runOf = {};
|
|
2059
|
+
for (const id of Object.keys(runsOf)) runOf[id] = runsOf[id][0];
|
|
2060
|
+
// v0.27-T6 名单化:席位唯一真相源=树级快照 rootRoster([{anchor,label,joinedAt,lastActiveAt}],
|
|
2061
|
+
// 形状见 lib/board/snapshot.js);旧快照(无 rootRoster)走 rootSessionId 首条只读投影渲染单席。
|
|
2062
|
+
// 根节点(isRootKind)退居附随信息:席位卡状态/模型锁定沿用根节点,无根节点时兜底合成 root 形状。
|
|
2063
|
+
// v0.27.1:只收 active 树(归档树整体不进主图;v0.31 阶段1 起历史树折叠条已退役——归档树零上图);司南单卡化——
|
|
2064
|
+
// seat=名单首条(值班,卡主体),others=其余席位(卡内「在岗会话」明细行,不再独立成卡)。
|
|
2065
|
+
const activeTrees = (snap.trees || []).filter((t) => t.status === "active");
|
|
2066
|
+
for (const t of activeTrees) {
|
|
2067
|
+
const rn = (t.nodes || []).find((n) => isRootKind(n.kind) && n.status !== "retired") || null;
|
|
2068
|
+
const roster = Array.isArray(t.rootRoster) && t.rootRoster.length ? t.rootRoster : null;
|
|
2069
|
+
const seats = roster ? roster.map((e) => ({
|
|
2070
|
+
anchor: e && e.anchor, label: (e && e.label) || (rn && rn.name) || "总管",
|
|
2071
|
+
joinedAt: e && e.joinedAt, lastActiveAt: e && e.lastActiveAt }))
|
|
2072
|
+
: (t.rootSessionId ? [{ anchor: t.rootSessionId, label: (rn && rn.name) || "总管",
|
|
2073
|
+
joinedAt: null, lastActiveAt: null }] : []);
|
|
2074
|
+
if (!seats.length) continue; // 无席位(无名单亦无投影锚)不占卡;本树节点仍挂 rootId
|
|
2075
|
+
orch.push({ tree: t, rootNode: rn, seat: seats[0], others: seats.slice(1), seatTotal: seats.length });
|
|
2076
|
+
}
|
|
2077
|
+
// v0.27.1 缺陷2修复:rootId=首条席位卡 id(treeId::anchor)——T6 后 orch 元素为包装对象(无 id),
|
|
2078
|
+
// 曾致 rootId=undefined → 全节点 parentId=undefined 平铺第 0 行 + 连线全空(sim 判据看守 edges>0)。
|
|
2079
|
+
const seatNodeId = (o) => o.tree.id + "::" + (o.seat.anchor || "seat0");
|
|
2080
|
+
const rootId = orch.length ? seatNodeId(orch[0]) : "__virtual_root__";
|
|
2081
|
+
const push = (n, parentId, opt) => { nodes.push({ id: n.id, parentId, n, ...opt }); };
|
|
2082
|
+
// v0.13.1:全林自我提升按钮挂在司南(总管)值班卡上;v0.27.1 单卡化:其余席位收进卡内明细(每行亦留 ⏫)
|
|
2083
|
+
for (const o of orch) nodes.push({
|
|
2084
|
+
id: seatNodeId(o), parentId: undefined,
|
|
2085
|
+
n: o.rootNode, seat: o, depth: 0, kind: "总管", accent: true,
|
|
2086
|
+
runs: o.rootNode ? (runsOf[o.rootNode.id] || []) : [],
|
|
2087
|
+
badges: [h(Badge, { key: "duty", tone: "accent", title: "名单首条=值班(入名单追加不换首条)" }, "🧭 值班"),
|
|
2088
|
+
h(ImproveBtnAll, { key: "imp", trees: snap.trees || [], small: true })] });
|
|
2089
|
+
if (!orch.length) nodes.push({ id: rootId, parentId: undefined, n: null, depth: 0, kind: "林", virtual: true });
|
|
2090
|
+
for (const t of activeTrees) { // v0.27.1:主图内全为活跃树(settled 半透明态随归档树出局而退役)
|
|
2091
|
+
// v0.16.1:retired 节点不再上图(退役总管曾抢占根位并把全林挂到旧司南名下)
|
|
2092
|
+
const all = (t.nodes || []).filter((n) => !isRootKind(n.kind) && n.status !== "retired");
|
|
2093
|
+
const leads = all.filter((n) => n.kind === "leader"); // v0.12.0:一工坊多都管
|
|
2094
|
+
const ws = t.workspace ? String(t.workspace).replace(/[\\/]+$/, "").split(/[\\/]/).pop() : "";
|
|
2095
|
+
// 看板折叠键修复(k-mvm5m0c9062,客户缺陷:同树多都管折叠联动):折叠键=都管节点 id——
|
|
2096
|
+
// 原 kidsCollapsed 按树 id 每树只算一次(下行),同树多都管共用同一折叠态,点任一都管折叠钮
|
|
2097
|
+
// 全树成员一起收起;现移入 leads.forEach 按 lead.id 逐都管求值,foldLabel/collapseTarget 同步改
|
|
2098
|
+
// lead.id(board.js 存储键随之换 bufeng-collapsed-leads,旧树 id 键安全忽略)。
|
|
2099
|
+
// v0.12.0:直辖成员(无归属都管)直挂总管(司南直管);v0.24.1 treeId 随卡下传(模型写请求需要)
|
|
2100
|
+
for (const n of all) {
|
|
2101
|
+
if (n.kind === "leader" || n.leaderId) continue;
|
|
2102
|
+
push(n, rootId, { depth: 2, kind: "成员", run: runOf[n.id], runs: runsOf[n.id] || [], treeId: t.id });
|
|
2103
|
+
}
|
|
2104
|
+
if (leads.length) {
|
|
2105
|
+
leads.forEach((lead, li) => {
|
|
2106
|
+
const home = all.filter((n) => n.kind !== "leader" && n.leaderId === lead.id);
|
|
2107
|
+
const kidsCollapsed = collapsedSet.has(lead.id);
|
|
2108
|
+
const leadRun = runOf[lead.id];
|
|
2109
|
+
const restRuns = home.map((n) => runOf[n.id]).filter(Boolean);
|
|
2110
|
+
push(lead, rootId, {
|
|
2111
|
+
depth: 1, kind: "都管", accent: true, tree: t, treeId: t.id,
|
|
2112
|
+
runs: runsOf[lead.id] || [],
|
|
2113
|
+
badges: [h(Badge, { key: "t", tone: "accent", title: "工坊 " + t.name }, "🌳 " + t.name),
|
|
2114
|
+
ws ? h(Badge, { key: "w", tone: "purple", title: t.workspace }, "📁 " + ws) : null],
|
|
2115
|
+
meta: (t.mission && li === 0 ? t.mission : lead.role || "") + (lead.systemPrompt ? " · 📝" : ""),
|
|
2116
|
+
activity: kidsCollapsed ? "已折叠 " + home.length + " 名成员"
|
|
2117
|
+
: leadRun ? "▶ " + clip(leadRun.title || leadRun.id, 26)
|
|
2118
|
+
: restRuns.length ? restRuns.map((r) => clip(r.title || r.id, 10)).join(" / ") : "",
|
|
2119
|
+
foldLabel: (kidsCollapsed ? "▸ " : "▾ ") + home.length,
|
|
2120
|
+
collapseTarget: lead.id,
|
|
2121
|
+
});
|
|
2122
|
+
if (!kidsCollapsed) {
|
|
2123
|
+
for (const n of home) push(n, lead.id, { depth: 2, kind: "成员", run: runOf[n.id], runs: runsOf[n.id] || [], treeId: t.id });
|
|
2124
|
+
}
|
|
2125
|
+
});
|
|
2126
|
+
} else {
|
|
2127
|
+
for (const n of all) push(n, rootId, { depth: 2, kind: "成员", run: runOf[n.id], runs: runsOf[n.id] || [], treeId: t.id });
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
for (const nd of nodes) if (nd.parentId) edges.push({ from: nd.parentId, to: nd.id });
|
|
2131
|
+
return { nodes, edges, rootId };
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2134
|
+
/* ---------- tidy-tree 分层布局(tasks-graph-layout 同款:兄弟带折行) ----------
|
|
2135
|
+
* 看板交互修复(k-mvgicmoa03o ②):GH 92→132 对齐真实卡高——卡片自 v0.24.1-B(模型行+20px)与
|
|
2136
|
+
* v0.31 阶段1(装备徽章行+20px)加高后实际≈129-131px,GH 已脱节:连线锚点(box.y+GH)落在卡内
|
|
2137
|
+
* =连线穿卡片,行距 138px 里视觉间隙只剩≈7px=上下拥挤。GY 46→60 层间垂直间距明显加大,
|
|
2138
|
+
* GX 32→40 同层横向一并放宽。edgePath 全量吃 box 坐标(父底/子顶中心),锚点自适应跟随零错位。 */
|
|
2139
|
+
/* v0.40.8 阶段1:GH 92→146——地图卡新增模型直配三级联动块(.bf-modelhost min-height:57 常驻)+
|
|
2140
|
+
* 卡角「✕ 退役」,卡高随内容抬升;盒高(GH)须对齐实际卡高,连线锚点(box.y+GH)才不穿卡
|
|
2141
|
+
* (k-mvgicmoa03o 教训:GH 与卡高错位=连线穿卡)。GW/GX/GY/GPAD 不动。 */
|
|
2142
|
+
const GW = 180, GH = 146, GX = 40, GY = 44, GPAD = 16, EDGE_STUB = 8;
|
|
2143
|
+
/* v0.27-T6:席位时间确定性格式化(ISO 取 YYYY-MM-DD HH:MM,不走 locale——sim 断言可锚定;空=—,畸形原样) */
|
|
2144
|
+
function fmtSeatTime(v) {
|
|
2145
|
+
if (v === null || v === undefined || v === "") return "—";
|
|
2146
|
+
const m = /^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2})(:\d{2})?/.exec(String(v));
|
|
2147
|
+
return m ? m[1] + " " + m[2] : String(v);
|
|
2148
|
+
}
|
|
2149
|
+
/* ---------- v0.40.7 工作项一:节点卡「运行中 ×N」徽标 + 在跑任务展开列表 ----------
|
|
2150
|
+
* N≥2 才出徽标(0/1 保持现状文案不劣化、不增常态噪音);点击展开该节点全部在跑任务
|
|
2151
|
+
* (标题+已耗时),每项点击 → onOpenTask(task) 跳任务看板详情。 */
|
|
2152
|
+
function runsElapsed(k, now) {
|
|
2153
|
+
const t0 = Date.parse(k && k.createdAt || "");
|
|
2154
|
+
if (!Number.isFinite(t0)) return "—";
|
|
2155
|
+
const ms = Math.max(0, (now || Date.now()) - t0);
|
|
2156
|
+
const m = Math.floor(ms / 60000);
|
|
2157
|
+
if (m < 60) return m + " 分钟";
|
|
2158
|
+
return Math.floor(m / 60) + " 小时 " + (m % 60) + " 分";
|
|
2159
|
+
}
|
|
2160
|
+
function runsBadgeOf(n, runs, open, onToggle) {
|
|
2161
|
+
if (!runs || runs.length < 2) return null;
|
|
2162
|
+
return h("button", { key: "runs", className: "bf-runbadge",
|
|
2163
|
+
"data-bf-runsbadge": "1", "data-bf-runcount": String(runs.length),
|
|
2164
|
+
title: "该节点有 " + runs.length + " 个任务在跑,点击展开/收起列表",
|
|
2165
|
+
onClick: (e) => { e.stopPropagation(); onToggle(n.id); } },
|
|
2166
|
+
"运行中 ×" + runs.length + (open ? " ▴" : ""));
|
|
2167
|
+
}
|
|
2168
|
+
function runsPanelOf(runs, onOpenTask) {
|
|
2169
|
+
if (!runs || runs.length < 2) return null;
|
|
2170
|
+
return h("div", { className: "bf-runspanel", "data-bf-runspanel": "1" },
|
|
2171
|
+
runs.map((t) => h("button", { key: t.id, className: "bf-runrow", "data-bf-runrow": t.id,
|
|
2172
|
+
title: "打开任务详情(任务看板):" + (t.title || t.id),
|
|
2173
|
+
onClick: (e) => { e.stopPropagation(); onOpenTask && onOpenTask(t); } },
|
|
2174
|
+
h("span", { className: "bf-runrow-title" }, t.title || t.id),
|
|
2175
|
+
h("span", { className: "bf-runrow-elapsed" }, "已耗时 " + runsElapsed(t)))));
|
|
2176
|
+
}
|
|
2177
|
+
function bfLayout(model, maxCols) {
|
|
2178
|
+
const cols = Math.max(1, maxCols || 5);
|
|
2179
|
+
const ids = new Set(model.nodes.map((n) => n.id));
|
|
2180
|
+
const childrenOf = new Map();
|
|
2181
|
+
for (const n of model.nodes) {
|
|
2182
|
+
const p = n.parentId && ids.has(n.parentId) ? n.parentId : undefined;
|
|
2183
|
+
if (p === undefined) continue;
|
|
2184
|
+
const list = childrenOf.get(p);
|
|
2185
|
+
if (list) list.push(n); else childrenOf.set(p, [n]);
|
|
2186
|
+
}
|
|
2187
|
+
const roots = model.nodes.filter((n) => !(n.parentId && ids.has(n.parentId)));
|
|
2188
|
+
const bands = (children) => {
|
|
2189
|
+
if (children.length <= cols) return [children];
|
|
2190
|
+
const out = [];
|
|
2191
|
+
for (let i = 0; i < children.length; i += cols) out.push(children.slice(i, i + cols));
|
|
2192
|
+
return out;
|
|
2193
|
+
};
|
|
2194
|
+
const subW = (n) => {
|
|
2195
|
+
const kids = childrenOf.get(n.id) || [];
|
|
2196
|
+
if (!kids.length) return GW;
|
|
2197
|
+
let widest = GW;
|
|
2198
|
+
for (const band of bands(kids)) {
|
|
2199
|
+
const w = band.reduce((s, c) => s + subW(c), 0) + GX * (band.length - 1);
|
|
2200
|
+
widest = Math.max(widest, w);
|
|
2201
|
+
}
|
|
2202
|
+
return widest;
|
|
2203
|
+
};
|
|
2204
|
+
const boxes = new Map();
|
|
2205
|
+
const place = (n, centerX, row) => {
|
|
2206
|
+
boxes.set(n.id, { id: n.id, x: Math.round(centerX - GW / 2), y: GPAD + row * (GH + GY), w: GW, h: GH });
|
|
2207
|
+
const kids = childrenOf.get(n.id) || [];
|
|
2208
|
+
if (!kids.length) return row;
|
|
2209
|
+
let deepest = row;
|
|
2210
|
+
let bandRow = row + 1;
|
|
2211
|
+
for (const band of bands(kids)) {
|
|
2212
|
+
const bw = band.reduce((s, c) => s + subW(c), 0) + GX * (band.length - 1);
|
|
2213
|
+
let cursor = centerX - bw / 2;
|
|
2214
|
+
let bandDeepest = bandRow;
|
|
2215
|
+
for (const child of band) {
|
|
2216
|
+
const w = subW(child);
|
|
2217
|
+
bandDeepest = Math.max(bandDeepest, place(child, cursor + w / 2, bandRow));
|
|
2218
|
+
cursor += w + GX;
|
|
2219
|
+
}
|
|
2220
|
+
deepest = Math.max(deepest, bandDeepest);
|
|
2221
|
+
bandRow = bandDeepest + 1;
|
|
2222
|
+
}
|
|
2223
|
+
return deepest;
|
|
2224
|
+
};
|
|
2225
|
+
let offset = GPAD;
|
|
2226
|
+
for (const root of roots) {
|
|
2227
|
+
const w = subW(root);
|
|
2228
|
+
place(root, offset + w / 2, 0);
|
|
2229
|
+
offset += w + GX;
|
|
2230
|
+
}
|
|
2231
|
+
const all = [...boxes.values()];
|
|
2232
|
+
return {
|
|
2233
|
+
boxes,
|
|
2234
|
+
width: Math.max(GPAD * 2 + GW, ...all.map((b) => b.x + b.w + GPAD)),
|
|
2235
|
+
height: Math.max(GPAD * 2 + GH, ...all.map((b) => b.y + b.h + GPAD)),
|
|
2236
|
+
};
|
|
2237
|
+
}
|
|
2238
|
+
|
|
2239
|
+
/* ---------- 连线:父底垂直短stub + 单贝塞尔进子顶(TasksGraph edgePath 同款) ---------- */
|
|
2240
|
+
function edgePath(from, to) {
|
|
2241
|
+
const x1 = from.x + from.w / 2, y1 = from.y + from.h;
|
|
2242
|
+
const x2 = to.x + to.w / 2, y2 = to.y;
|
|
2243
|
+
const span = Math.max(0, y2 - y1);
|
|
2244
|
+
const stub = Math.min(EDGE_STUB, span / 3);
|
|
2245
|
+
const dy = Math.max(16, (y2 - y1 - stub * 2) / 2);
|
|
2246
|
+
return `M ${x1} ${y1} L ${x1} ${y1 + stub} `
|
|
2247
|
+
+ `C ${x1} ${y1 + stub + dy} ${x2} ${y2 - stub - dy} ${x2} ${y2 - stub} `
|
|
2248
|
+
+ `L ${x2} ${y2}`;
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
/* ---------- v0.27.1 司南单卡:值班席=卡主体,其余席位=卡内「在岗会话 ×N」明细展开区 ----------
|
|
2252
|
+
* 客户拍板「一个总管的根」:只改皮肤不动权力引擎(名单制互不顶替/禁入三层/链路回报零改动);
|
|
2253
|
+
* 旧快照单席投影(无 rootRoster)天然无明细区;⏫ 全林提升钮保留(卡徽章 + 每明细行一枚)。 */
|
|
2254
|
+
function SinanSeatCard({ nd, snap, box, equipBadge, onOpenTask }) {
|
|
2255
|
+
const [open, setOpen] = useState(false);
|
|
2256
|
+
const [runsOpen, setRunsOpen] = useState(false);
|
|
2257
|
+
const s = nd.seat.seat, rn = nd.seat.rootNode, tr = nd.seat.tree, others = nd.seat.others || [];
|
|
2258
|
+
const runs = nd.runs || [];
|
|
2259
|
+
return h("div", { key: nd.id, className: "bf-gnode", "data-bf-node": "1", "data-bf-seat": "1",
|
|
2260
|
+
style: { left: box.x, top: box.y, width: GW } },
|
|
2261
|
+
h(TwoSeg, {
|
|
2262
|
+
depth: 0, accent: true, kind: "总管", uid: nd.id,
|
|
2263
|
+
name: s.label || (rn && rn.name) || "总管",
|
|
2264
|
+
badges: nd.badges ? h("span", null, nd.badges) : null,
|
|
2265
|
+
meta: "入列 " + fmtSeatTime(s.joinedAt) + " · 活跃 " + fmtSeatTime(s.lastActiveAt),
|
|
2266
|
+
state: "running", stateText: "值班中", activity: "",
|
|
2267
|
+
// v0.27.1:其余席位收进卡内明细(不再独立成卡);展开钮挂状态行尾
|
|
2268
|
+
barExtra: others.length ? h("button", { className: "bf-fold", "data-bf-seattoggle": "1",
|
|
2269
|
+
title: "展开/收起本卡「在岗会话」明细(其余名单席位:label/入列/最近活跃/⏫ 全林提升)",
|
|
2270
|
+
onClick: (e) => { e.stopPropagation(); setOpen(!open); } },
|
|
2271
|
+
(open ? "▾ " : "▸ ") + "在岗会话 ×" + others.length) : null,
|
|
2272
|
+
// v0.40.7 工作项一:总管卡同样可挂「运行中 ×N」徽标+在跑任务展开(root 亦有接收单)
|
|
2273
|
+
runsBadge: runsBadgeOf(rn, runs, runsOpen, () => setRunsOpen(!runsOpen)),
|
|
2274
|
+
equipBadge,
|
|
2275
|
+
modelCtl: h(ModelDirectCtl, { node: rn, treeId: tr && tr.id, catalog: snap.modelCatalog }), // v0.40.8:root 锁定只读行
|
|
2276
|
+
title: "值班席位(名单首条)" + (others.length ? ";其余同权席 " + others.length + " 席收在卡内明细" : "")
|
|
2277
|
+
+ "\n锚点 " + (s.anchor || "—")
|
|
2278
|
+
+ "\n入列 " + (s.joinedAt || "—")
|
|
2279
|
+
+ "\n最近活跃 " + (s.lastActiveAt || "—"),
|
|
2280
|
+
runsPanel: runsOpen ? runsPanelOf(runs, onOpenTask) : null,
|
|
2281
|
+
}),
|
|
2282
|
+
open && others.length ? h("div", { className: "bf-seatextra", "data-bf-seatextra": "1" },
|
|
2283
|
+
others.map((o, oi) => h("div", { key: o.anchor || ("row" + oi), className: "bf-seatrow", "data-bf-seatrow": "1",
|
|
2284
|
+
title: "同权席位(名单第 " + (oi + 2) + "/" + nd.seat.seatTotal + " 条,与值班席同权)"
|
|
2285
|
+
+ "\n锚点 " + (o.anchor || "—")
|
|
2286
|
+
+ "\n入列 " + (o.joinedAt || "—")
|
|
2287
|
+
+ "\n最近活跃 " + (o.lastActiveAt || "—") },
|
|
2288
|
+
h("div", { className: "bf-seatrow-top" },
|
|
2289
|
+
h("span", { className: "bf-name" }, o.label || "总管"),
|
|
2290
|
+
h(ImproveBtnAll, { trees: snap.trees || [], small: true })),
|
|
2291
|
+
h("div", { className: "bf-meta" }, "入列 " + fmtSeatTime(o.joinedAt)),
|
|
2292
|
+
h("div", { className: "bf-meta" }, "活跃 " + fmtSeatTime(o.lastActiveAt))))) : null);
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2295
|
+
/* ---------- 图画布:滚轮缩放到光标 + 背景拖拽平移 + 双击回中 + 右下控制簇 ---------- */
|
|
2296
|
+
const ZOOM_MIN = 0.4, ZOOM_MAX = 2, FIT_MAX = 1.3, FIT_MARGIN = 24, CLICK_TOL = 4;
|
|
2297
|
+
function GraphCanvas({ snap, collapsedSet, toggle, onOpenTask }) {
|
|
2298
|
+
const containerRef = useRef(null);
|
|
2299
|
+
const [tf, setTf] = useState({ x: 0, y: 0, k: 1 });
|
|
2300
|
+
const tfRef = useRef(tf);
|
|
2301
|
+
tfRef.current = tf;
|
|
2302
|
+
const touchedRef = useRef(false);
|
|
2303
|
+
const [dragging, setDragging] = useState(false);
|
|
2304
|
+
const [equipNode, setEquipNode] = useState(null); // v0.31 阶段1:详情弹窗目标节点(EquipBadge 点击开启;k-mvont1ej0gb ①推荐降噪后节点卡无推荐角标)
|
|
2305
|
+
const [equipTab, setEquipTab] = useState('overview'); // v0.40 批2:节点详情抽屉当前页(概览/提示词/装备/推荐)
|
|
2306
|
+
const [runsOpenId, setRunsOpenId] = useState(null); // v0.40.7 工作项一:展开「在跑任务」列表的节点 id(单开)
|
|
2307
|
+
const travelRef = useRef(0);
|
|
2308
|
+
const model = useMemo(() => buildGraphModel(snap, collapsedSet), [snap, collapsedSet]);
|
|
2309
|
+
const layout = useMemo(() => bfLayout(model), [model]);
|
|
2310
|
+
|
|
2311
|
+
const fit = useCallback(() => {
|
|
2312
|
+
const el = containerRef.current;
|
|
2313
|
+
if (!el || !layout.width) return;
|
|
2314
|
+
const cw = el.clientWidth, ch = el.clientHeight;
|
|
2315
|
+
if (cw <= 0 || ch <= 0) return;
|
|
2316
|
+
const k = Math.min(FIT_MAX, Math.max(ZOOM_MIN, Math.min((cw - FIT_MARGIN * 2) / layout.width, (ch - FIT_MARGIN * 2) / layout.height)));
|
|
2317
|
+
// v0.27.1 缺陷3修复:装得下→对称居中;装不下(超宽/超高被 ZOOM_MIN 钳制)→ 锚定内容左上角于
|
|
2318
|
+
// 留白边距,不再对称负逸出(旧式曾把超宽单行内容推出 x=-456px 只见中段切片、上方大片空白)。
|
|
2319
|
+
const x = layout.width * k <= cw - FIT_MARGIN * 2 ? (cw - layout.width * k) / 2 : FIT_MARGIN;
|
|
2320
|
+
const y = layout.height * k <= ch - FIT_MARGIN * 2 ? (ch - layout.height * k) / 2 : FIT_MARGIN;
|
|
2321
|
+
setTf({ x, y, k });
|
|
2322
|
+
}, [layout]);
|
|
2323
|
+
// 首次/布局尺寸变化自动 fit;容器 resize 也重新 fit(用户手动平移缩放过后停止自动)
|
|
2324
|
+
useEffect(() => { if (!touchedRef.current) fit(); }, [fit]);
|
|
2325
|
+
useEffect(() => {
|
|
2326
|
+
const el = containerRef.current;
|
|
2327
|
+
if (!el) return;
|
|
2328
|
+
const ob = new ResizeObserver(() => { if (!touchedRef.current) fit(); });
|
|
2329
|
+
ob.observe(el);
|
|
2330
|
+
return () => ob.disconnect();
|
|
2331
|
+
}, [fit]);
|
|
2332
|
+
// 滚轮缩放到光标(deltaMode 归一:line=16 page=100)——缩放数学抽 zoomAtClient 供弹窗期接管复用
|
|
2333
|
+
const zoomAtClient = useCallback((clientX, clientY, deltaY, deltaMode) => {
|
|
2334
|
+
const el = containerRef.current;
|
|
2335
|
+
if (!el) return;
|
|
2336
|
+
const rect = el.getBoundingClientRect();
|
|
2337
|
+
const mx = clientX - rect.left, my = clientY - rect.top;
|
|
2338
|
+
const { x, y, k } = tfRef.current;
|
|
2339
|
+
const unit = deltaMode === 1 ? 16 : deltaMode === 2 ? 100 : 1;
|
|
2340
|
+
const next = Math.min(ZOOM_MAX, Math.max(ZOOM_MIN, k * Math.exp(-deltaY * unit * 0.0014)));
|
|
2341
|
+
if (next === k) return;
|
|
2342
|
+
touchedRef.current = true;
|
|
2343
|
+
setTf({ x: mx - (mx - x) * (next / k), y: my - (my - y) * (next / k), k: next });
|
|
2344
|
+
}, []);
|
|
2345
|
+
useEffect(() => {
|
|
2346
|
+
const el = containerRef.current;
|
|
2347
|
+
if (!el) return;
|
|
2348
|
+
const onWheel = (e) => {
|
|
2349
|
+
// 防御性分流(k-mvgst62x090 实机根因):弹窗当前渲染在本画布子树内,悬停弹窗内容时
|
|
2350
|
+
// 本 bubble 段必须与 window 捕获段同判放行——否则捕获段判定为真也白搭,preventDefault
|
|
2351
|
+
// 仍在这里执行(实测栈唯一帧=本句柄),内容不滚、地图照缩放。
|
|
2352
|
+
if (wheelInCapModal(e)) return;
|
|
2353
|
+
e.preventDefault();
|
|
2354
|
+
zoomAtClient(e.clientX, e.clientY, e.deltaY, e.deltaMode);
|
|
2355
|
+
};
|
|
2356
|
+
el.addEventListener("wheel", onWheel, { passive: false });
|
|
2357
|
+
return () => el.removeEventListener("wheel", onWheel);
|
|
2358
|
+
}, [zoomAtClient]);
|
|
2359
|
+
// 看板交互修复(k-mvgicmoa03o ①)→ 弹窗滚轮共存修正(k-mvgosn5z05l)→ 实机背离修复(k-mvgst62x090):
|
|
2360
|
+
// 弹窗打开时滚轮按「悬停区域」分流,缩放与弹窗滚动共存——
|
|
2361
|
+
// ①悬停弹窗内容区(capModalEl 子树)→ 本句柄直接 return,不 preventDefault、不 stopPropagation:
|
|
2362
|
+
// 归还原生 overflow-y 滚动。判定 = wheelInCapModal(capabilities.js):模块级弹窗根引用
|
|
2363
|
+
// contains(target)/composedPath 包含为主,原双路(data-bf-capmodal 扫描+closest)兜底;
|
|
2364
|
+
// ②悬停弹窗外遮罩/地图区(遮罩 fixed inset:0 覆盖地图可视区)→ 接管:preventDefault+
|
|
2365
|
+
// stopPropagation 拦下遮罩/底层,缩放复用 zoomAtClient 同款数学(与无弹窗一致);
|
|
2366
|
+
// ③无弹窗 → 上方画布 bubble 段滚轮(那里同样调 wheelInCapModal 防御弹窗在画布子树内被吞)。
|
|
2367
|
+
// 实机证据(v0.33.1 复现):弹窗祖先链含 .bf-graph,事件冒泡到画布 bubble 段被无条件吞掉,
|
|
2368
|
+
// 故 window 捕获段「判定为真」不等于内容能滚——两段必须共用同一判定。
|
|
2369
|
+
useEffect(() => {
|
|
2370
|
+
if (!equipNode) return;
|
|
2371
|
+
const onModalWheel = (e) => {
|
|
2372
|
+
if (wheelInCapModal(e)) return;
|
|
2373
|
+
e.preventDefault();
|
|
2374
|
+
e.stopPropagation();
|
|
2375
|
+
zoomAtClient(e.clientX, e.clientY, e.deltaY, e.deltaMode);
|
|
2376
|
+
};
|
|
2377
|
+
window.addEventListener("wheel", onModalWheel, { passive: false, capture: true });
|
|
2378
|
+
return () => window.removeEventListener("wheel", onModalWheel, { capture: true });
|
|
2379
|
+
}, [equipNode, zoomAtClient]);
|
|
2380
|
+
const clampTf = useCallback((v) => {
|
|
2381
|
+
const el = containerRef.current;
|
|
2382
|
+
const cw = el ? el.clientWidth : 800, ch = el ? el.clientHeight : 500;
|
|
2383
|
+
const keep = 72;
|
|
2384
|
+
const minX = Math.min(0, cw - keep - v.k * layout.width);
|
|
2385
|
+
const minY = Math.min(0, ch - keep - v.k * layout.height);
|
|
2386
|
+
return {
|
|
2387
|
+
k: v.k,
|
|
2388
|
+
x: Math.max(minX, Math.min(cw - keep, v.x)),
|
|
2389
|
+
y: Math.max(minY, Math.min(ch - keep, v.y)),
|
|
2390
|
+
};
|
|
2391
|
+
}, [layout]);
|
|
2392
|
+
const zoomBy = useCallback((factor) => {
|
|
2393
|
+
const el = containerRef.current;
|
|
2394
|
+
if (!el) return;
|
|
2395
|
+
const { x, y, k } = tfRef.current;
|
|
2396
|
+
const next = Math.min(ZOOM_MAX, Math.max(ZOOM_MIN, k * factor));
|
|
2397
|
+
if (next === k) return;
|
|
2398
|
+
touchedRef.current = true;
|
|
2399
|
+
const mx = el.clientWidth / 2, my = el.clientHeight / 2;
|
|
2400
|
+
setTf(clampTf({ x: mx - (mx - x) * (next / k), y: my - (my - y) * (next / k), k: next }));
|
|
2401
|
+
}, [clampTf]);
|
|
2402
|
+
// 拖拽只从背景开始(卡片/控制簇上的 pointerdown 不理),window 监听,行程 >4px 才算拖
|
|
2403
|
+
const onPointerDown = useCallback((e) => {
|
|
2404
|
+
if (e.button !== 0) return;
|
|
2405
|
+
const t = e.target;
|
|
2406
|
+
if (t.closest && (t.closest("[data-bf-node]") || t.closest("[data-bf-controls]"))) return;
|
|
2407
|
+
travelRef.current = 0;
|
|
2408
|
+
const sx = e.clientX, sy = e.clientY;
|
|
2409
|
+
const { x, y } = tfRef.current;
|
|
2410
|
+
const onMove = (mv) => {
|
|
2411
|
+
const dx = mv.clientX - sx, dy = mv.clientY - sy;
|
|
2412
|
+
travelRef.current = Math.max(travelRef.current, Math.abs(dx) + Math.abs(dy));
|
|
2413
|
+
if (travelRef.current <= CLICK_TOL) return;
|
|
2414
|
+
touchedRef.current = true;
|
|
2415
|
+
setDragging(true);
|
|
2416
|
+
setTf(clampTf({ x: x + dx, y: y + dy, k: tfRef.current.k }));
|
|
2417
|
+
};
|
|
2418
|
+
const onUp = () => {
|
|
2419
|
+
window.removeEventListener("pointermove", onMove);
|
|
2420
|
+
window.removeEventListener("pointerup", onUp);
|
|
2421
|
+
window.removeEventListener("pointercancel", onUp);
|
|
2422
|
+
setDragging(false);
|
|
2423
|
+
};
|
|
2424
|
+
window.addEventListener("pointermove", onMove);
|
|
2425
|
+
window.addEventListener("pointerup", onUp);
|
|
2426
|
+
window.addEventListener("pointercancel", onUp);
|
|
2427
|
+
}, [clampTf]);
|
|
2428
|
+
const onDoubleClick = useCallback((e) => {
|
|
2429
|
+
const t = e.target;
|
|
2430
|
+
if (t.closest && (t.closest("[data-bf-node]") || t.closest("[data-bf-controls]"))) return;
|
|
2431
|
+
touchedRef.current = false;
|
|
2432
|
+
fit();
|
|
2433
|
+
}, [fit]);
|
|
2434
|
+
/* 批2-T4 概览瘦身:统计条常驻顶部(空态/主画布两分支同构),画布保持 flex:1 吃满剩余高度 */
|
|
2435
|
+
if (!model.nodes.filter((n) => !n.virtual).length) {
|
|
2436
|
+
// v0.24.0:文案角色化(树→工坊)+ 星枢总管图标(48 档落位);建树引导文案已退役,空态改中性描述
|
|
2437
|
+
return h("div", { style: { display: "flex", flexDirection: "column", gap: 8, width: "100%", flex: 1, minHeight: 0 } },
|
|
2438
|
+
h(OverviewStats, { snap }),
|
|
2439
|
+
// v0.31 阶段1:宿主能力面全局汇总行(原 ArchivedStrip+CapabilityStrip 双条退役——历史树块整体移除,
|
|
2440
|
+
// 能力面独立汇总块收编进节点详情弹窗头部;此行=空态分支的全局信息落点 data-bf-caphead)
|
|
2441
|
+
h("div", { className: "bf-meta", style: DIM, "data-bf-caphead": "1",
|
|
2442
|
+
title: "宿主能力面全局汇总(原「能力面」独立汇总块收编——主图态显示于各节点详情弹窗头部)" },
|
|
2443
|
+
hostCapsText(snap.capabilities)),
|
|
2444
|
+
h("div", { className: "bf-graph" },
|
|
2445
|
+
h("div", { className: "bf-empty", style: { flexDirection: "column", gap: 8 } },
|
|
2446
|
+
h(RoleIconLg, { kind: "orchestrator", uid: "graph-empty" }),
|
|
2447
|
+
h("span", null, "工坊尚未初始化——插件启动时将自动创建工坊树与总管根节点"))));
|
|
2448
|
+
}
|
|
2449
|
+
return h("div", { style: { display: "flex", flexDirection: "column", gap: 8, width: "100%", flex: 1, minHeight: 0 } },
|
|
2450
|
+
h(OverviewStats, { snap }),
|
|
2451
|
+
// v0.31 阶段1:宿主能力面全局汇总行(主图分支同构;折叠形态的全局信息入口在弹窗头部)
|
|
2452
|
+
h("div", { className: "bf-meta", style: DIM, "data-bf-caphead": "1",
|
|
2453
|
+
title: "宿主能力面全局汇总(原「能力面」独立汇总块收编——点击各节点能力徽章在弹窗头部查看)" },
|
|
2454
|
+
hostCapsText(snap.capabilities)),
|
|
2455
|
+
h("div", { className: "bf-graph", "data-dragging": dragging ? "true" : "false",
|
|
2456
|
+
ref: containerRef, onPointerDown, onDoubleClick },
|
|
2457
|
+
h("div", { className: "bf-canvas-inner",
|
|
2458
|
+
style: { width: layout.width, height: layout.height, transform: `translate(${tf.x}px, ${tf.y}px) scale(${tf.k})` } },
|
|
2459
|
+
h("svg", { className: "bf-edges", width: layout.width, height: layout.height, "aria-hidden": true },
|
|
2460
|
+
model.edges.map((e) => {
|
|
2461
|
+
const a = layout.boxes.get(e.from), b = layout.boxes.get(e.to);
|
|
2462
|
+
if (!a || !b) return null;
|
|
2463
|
+
return h("path", { key: e.from + "->" + e.to, className: "bf-edge", d: edgePath(a, b) });
|
|
2464
|
+
})),
|
|
2465
|
+
model.nodes.map((nd) => {
|
|
2466
|
+
if (nd.virtual) return null;
|
|
2467
|
+
const box = layout.boxes.get(nd.id);
|
|
2468
|
+
if (!box) return null;
|
|
2469
|
+
// v0.27.1 司南单卡:值班席=卡主体;其余席位=卡内「在岗会话 ×N」明细(⏫ 保留在明细行内)
|
|
2470
|
+
if (nd.seat) {
|
|
2471
|
+
return h(SinanSeatCard, { key: nd.id, nd, snap, box, onOpenTask,
|
|
2472
|
+
equipBadge: h(EquipBadge, { node: nd.seat.rootNode, caps: snap.capabilities, seat: true,
|
|
2473
|
+
onOpen: () => { setEquipTab("equip"); setEquipNode(nd.seat.rootNode); } }) });
|
|
2474
|
+
}
|
|
2475
|
+
const n = nd.n;
|
|
2476
|
+
const run = nd.run;
|
|
2477
|
+
const runs = nd.runs || [];
|
|
2478
|
+
return h("div", { key: nd.id, className: "bf-gnode", "data-bf-node": "1", "data-bf-nodeid": n.id,
|
|
2479
|
+
onClick: (e) => {
|
|
2480
|
+
const t = e && e.target;
|
|
2481
|
+
// 模型直配块(select 下拉,非 button)不触发达抽屉:点模型选择=配置模型,不是开智能体详情
|
|
2482
|
+
if (t && typeof t.closest === "function"
|
|
2483
|
+
&& (t.closest("button") || t.closest("[data-bf-modelhost]"))) return;
|
|
2484
|
+
// v0.61.0 S2 判据锚撞车适配:data-bf-nodeid 同时挂卡本体与装备徽章(sim clicks.find 首个命中卡本体),
|
|
2485
|
+
// 弹窗已开且目标同节点时再点卡片=直达装备页(与徽章 onOpen 同语义:bump 开窗序号→fresh 重置+建议单重拉);
|
|
2486
|
+
// 首次点卡片保持既有「开抽屉落概览」(v0.40 判据口径不变)。
|
|
2487
|
+
// 每次点卡片开抽屉=新开窗周期(bump→EquipModal fresh 重置+建议单重拉);已开着→直达装备页(与徽章同语义);
|
|
2488
|
+
// 重开(上轮已关)→保持当前页(初值 overview=既有「开抽屉落概览」口径不变)。
|
|
2489
|
+
bumpEqOpenSeq(); setEquipTab(equipNode ? "equip" : equipTab); setEquipNode(n);
|
|
2490
|
+
},
|
|
2491
|
+
style: { left: box.x, top: box.y, width: GW } },
|
|
2492
|
+
h(TwoSeg, {
|
|
2493
|
+
depth: nd.depth, accent: nd.accent, settled: nd.settled, kind: nd.kind, uid: nd.id,
|
|
2494
|
+
name: n.name,
|
|
2495
|
+
badges: nd.badges ? h("span", null, nd.badges) : null,
|
|
2496
|
+
meta: nd.meta !== undefined ? nd.meta : (n.role || "") + (n.systemPrompt ? " · 📝" : ""),
|
|
2497
|
+
state: n.status,
|
|
2498
|
+
activity: nd.activity !== undefined ? nd.activity
|
|
2499
|
+
: run ? "▶ " + clip(run.title || run.id, 24) : "可接单",
|
|
2500
|
+
foldLabel: nd.foldLabel,
|
|
2501
|
+
onFold: nd.collapseTarget ? () => toggle(nd.collapseTarget) : undefined,
|
|
2502
|
+
// v0.40.8 阶段1:卡角「✕ 退役」钮(右上角常驻,两段确认同 v0.16.1;权限仍由后端
|
|
2503
|
+
// bufeng_retire_node 校验,前端不新增判定口径;root/席位卡不渲染)
|
|
2504
|
+
corner: nd.kind !== "总管" ? h(RetireBtn, { nodeId: n.id }) : null,
|
|
2505
|
+
// v0.40.7 工作项一:「运行中 ×N」并发徽标+在跑任务展开列表(N≥2 才出现)
|
|
2506
|
+
runsBadge: runsBadgeOf(n, runs, runsOpenId === n.id,
|
|
2507
|
+
(id) => setRunsOpenId((prev) => (prev === id ? null : id))),
|
|
2508
|
+
runsPanel: runsOpenId === n.id ? runsPanelOf(runs, onOpenTask) : null,
|
|
2509
|
+
// v0.40.8 阶段1:模型直配三级联动(provider/model/reasoningEffort,选中即提交,
|
|
2510
|
+
// 走既有 bufeng_update_node model 通道——POST /bufeng/api/node/update,无新增写接口)
|
|
2511
|
+
modelCtl: h(ModelDirectCtl, { node: n, treeId: nd.treeId, catalog: snap.modelCatalog }),
|
|
2512
|
+
// v0.31 阶段1:能力面概览徽章(卡内隐藏,入口已迁抽屉页签)
|
|
2513
|
+
equipBadge: h(EquipBadge, { node: n, caps: snap.capabilities, onOpen: () => { setEquipTab('equip'); setEquipNode(n); } }),
|
|
2514
|
+
title: (n.role || "") + (n.systemPrompt ? "\n📝 " + n.systemPrompt : ""),
|
|
2515
|
+
}));
|
|
2516
|
+
})),
|
|
2517
|
+
h("div", { className: "bf-controls", "data-bf-controls": "1" },
|
|
2518
|
+
h("button", { className: "bf-ctl", title: "缩小", onClick: () => zoomBy(1 / 1.2) }, "−"),
|
|
2519
|
+
h("span", { className: "bf-zoomlv" }, Math.round(tf.k * 100) + "%"),
|
|
2520
|
+
h("button", { className: "bf-ctl", title: "放大", onClick: () => zoomBy(1.2) }, "+"),
|
|
2521
|
+
h("button", { className: "bf-ctl", title: "适配画布(双击背景同效)", onClick: () => { touchedRef.current = false; fit(); } }, "⛶")),
|
|
2522
|
+
// v0.31 阶段1:能力详情弹窗(纯只读;✕/Esc/遮罩点击关闭;零新端点零写操作——红线看守见 sim 负锚)
|
|
2523
|
+
// k-mvgosn5z05l:zoom 透传当前地图缩放比例,弹窗内可见自证行实时显示(弹窗外滚轮缩放时跳动)
|
|
2524
|
+
equipNode ? h(EquipModal, { key: equipNode.id + ':' + equipTab, node: equipNode, caps: snap.capabilities, snap, initialTab: equipTab, onClose: () => setEquipNode(null) }) : null));
|
|
2525
|
+
}
|
|
2526
|
+
return { GraphCanvas };
|
|
2527
|
+
})();
|
|
2528
|
+
/* ============================== src/taskgraph.js ============================== */
|
|
2529
|
+
__mods["taskgraph.js"] = (() => {
|
|
2530
|
+
/**
|
|
2531
|
+
* client/src/taskgraph.js — 任务链路纯函数(v0.40.0 四 tab P0)。
|
|
2532
|
+
*
|
|
2533
|
+
* 只认 dependsOn,不认 chainId:v0.39 活体里 200+ 任务共享同一 chainId(历史聚类遗留),
|
|
2534
|
+
* 按 chainId 画图会得到一条假大链;chainId 只作为链标题展示。
|
|
2535
|
+
*
|
|
2536
|
+
* 输入是当前 /api/tasks 窗口内的任务数组(可能缺前置);缺的 id 进 missing,
|
|
2537
|
+
* 由视图层显式提示「窗口外 N 个前置」,绝不伪造节点。
|
|
2538
|
+
*/
|
|
2539
|
+
|
|
2540
|
+
/** 任务表:id -> task;同 id 后者覆盖(正常不会重复)。 */
|
|
2541
|
+
function taskIndex(tasks) {
|
|
2542
|
+
const m = new Map();
|
|
2543
|
+
for (const k of tasks || []) if (k && k.id) m.set(String(k.id), k);
|
|
2544
|
+
return m;
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2547
|
+
/** 上游(递归 dependsOn)+ 自身 + 下游(递归被依赖)闭包。 */
|
|
2548
|
+
function chainOf(tasks, id) {
|
|
2549
|
+
const byId = taskIndex(tasks);
|
|
2550
|
+
const self = byId.get(String(id));
|
|
2551
|
+
if (!self) return { ids: new Set(), levels: new Map(), missing: new Set(), self: null };
|
|
2552
|
+
const ids = new Set([self.id]);
|
|
2553
|
+
const missing = new Set();
|
|
2554
|
+
const walkUp = (k) => {
|
|
2555
|
+
for (const d of Array.isArray(k.dependsOn) ? k.dependsOn : []) {
|
|
2556
|
+
const dep = String(d);
|
|
2557
|
+
if (!dep) continue;
|
|
2558
|
+
if (!byId.has(dep)) { missing.add(dep); continue; }
|
|
2559
|
+
if (ids.has(dep)) continue;
|
|
2560
|
+
ids.add(dep);
|
|
2561
|
+
walkUp(byId.get(dep));
|
|
2562
|
+
}
|
|
2563
|
+
};
|
|
2564
|
+
walkUp(self);
|
|
2565
|
+
let grew = true;
|
|
2566
|
+
while (grew) {
|
|
2567
|
+
grew = false;
|
|
2568
|
+
for (const k of byId.values()) {
|
|
2569
|
+
if (ids.has(k.id)) continue;
|
|
2570
|
+
if ((k.dependsOn || []).some((d) => ids.has(String(d)))) {
|
|
2571
|
+
ids.add(k.id);
|
|
2572
|
+
grew = true;
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
/* 最长路径层级:level(k)=max(level(dep)+1)。闭包内迭代到稳定;环安全(上限 n 轮)。 */
|
|
2577
|
+
const levels = new Map([...ids].map((x) => [x, 0]));
|
|
2578
|
+
for (let i = 0; i < ids.size; i += 1) {
|
|
2579
|
+
let changed = false;
|
|
2580
|
+
for (const tid of ids) {
|
|
2581
|
+
const k = byId.get(tid);
|
|
2582
|
+
let lv = 0;
|
|
2583
|
+
for (const d of k.dependsOn || []) {
|
|
2584
|
+
const dep = String(d);
|
|
2585
|
+
if (levels.has(dep)) lv = Math.max(lv, (levels.get(dep) || 0) + 1);
|
|
2586
|
+
}
|
|
2587
|
+
if (lv !== levels.get(tid)) { levels.set(tid, lv); changed = true; }
|
|
2588
|
+
}
|
|
2589
|
+
if (!changed) break;
|
|
2590
|
+
}
|
|
2591
|
+
return { ids, levels, missing, self };
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2594
|
+
/** 给视图层:按 level 分组,组内按 createdAt 升序(同层并行时稳定)。 */
|
|
2595
|
+
function chainRows(tasks, id) {
|
|
2596
|
+
const byId = taskIndex(tasks);
|
|
2597
|
+
const c = chainOf(tasks, id);
|
|
2598
|
+
const rows = [];
|
|
2599
|
+
const maxLevel = c.ids.size ? Math.max(...c.levels.values()) : 0;
|
|
2600
|
+
for (let lv = 0; lv <= maxLevel; lv += 1) {
|
|
2601
|
+
const items = [...c.ids]
|
|
2602
|
+
.filter((x) => c.levels.get(x) === lv)
|
|
2603
|
+
.map((x) => byId.get(x))
|
|
2604
|
+
.filter(Boolean)
|
|
2605
|
+
.sort((a, b) => String(a.createdAt || '').localeCompare(String(b.createdAt || '')));
|
|
2606
|
+
if (items.length) rows.push({ level: lv, items });
|
|
2607
|
+
}
|
|
2608
|
+
return { rows, missing: [...c.missing], maxLevel, ids: c.ids, levels: c.levels };
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2611
|
+
/**
|
|
2612
|
+
* 固定坐标系(不依赖 ResizeObserver,sim 首帧即可断言):
|
|
2613
|
+
* 列宽 150、列距 170;同层纵向堆叠 92;当前任务 150x76。
|
|
2614
|
+
* 返回 {width,height,nodes:[{id,task,x,y}],edges:[{from,to}]}。
|
|
2615
|
+
*/
|
|
2616
|
+
function chainLayout(tasks, id, opts) {
|
|
2617
|
+
const COL_W = 150, ROW_H = 92, X0 = 14, Y0 = 14;
|
|
2618
|
+
const { rows, missing, maxLevel } = chainRows(tasks, id);
|
|
2619
|
+
const byId = taskIndex(tasks);
|
|
2620
|
+
const maxRows = rows.reduce((n, r) => Math.max(n, r.items.length), 1);
|
|
2621
|
+
const width = X0 * 2 + (maxLevel + 1) * COL_W + maxLevel * (170 - COL_W);
|
|
2622
|
+
const height = Y0 * 2 + maxRows * 76 + (maxRows - 1) * 16;
|
|
2623
|
+
const nodes = [];
|
|
2624
|
+
const pos = new Map();
|
|
2625
|
+
for (const r of rows) {
|
|
2626
|
+
const blockH = r.items.length * 76 + (r.items.length - 1) * 16;
|
|
2627
|
+
const y0 = (height - blockH) / 2;
|
|
2628
|
+
r.items.forEach((k, i) => {
|
|
2629
|
+
const x = X0 + r.level * 170;
|
|
2630
|
+
const y = y0 + i * (76 + 16);
|
|
2631
|
+
nodes.push({ id: k.id, task: k, x, y });
|
|
2632
|
+
pos.set(k.id, { x, y, level: r.level });
|
|
2633
|
+
});
|
|
2634
|
+
}
|
|
2635
|
+
const edges = [];
|
|
2636
|
+
for (const k of byId.values()) {
|
|
2637
|
+
if (!pos.has(k.id)) continue;
|
|
2638
|
+
for (const d of k.dependsOn || []) {
|
|
2639
|
+
if (pos.has(String(d))) edges.push({ from: String(d), to: k.id });
|
|
2640
|
+
}
|
|
2641
|
+
}
|
|
2642
|
+
return { width: Math.max(width, 360), height: Math.max(height, 156), nodes, edges, missing, maxLevel };
|
|
2643
|
+
}
|
|
2644
|
+
|
|
2645
|
+
/**
|
|
2646
|
+
* v0.40.7 分发链路树(任务看板重构,工作项二):父子判定=子任务.dispatchedBySession === 父任务.childId
|
|
2647
|
+
* (派发会话锚对派发会话锚——父单派单时记下自己的子会话 id,子单记账时记下派发方会话 id)。
|
|
2648
|
+
* 从所选单出发只向下递归(不追溯 dependsOn,两套语义分离:依赖链=chainLayout,分发链=本函数)。
|
|
2649
|
+
* 环安全:已入树的 id 不再入(seen);childId 缺失(不限会话/旧账本)视为无下游。
|
|
2650
|
+
* 返回 { root, rows:[{task,depth}], childCount, maxDepth };无下游时 childCount=0——视图层渲染空态文案,不画假图。
|
|
2651
|
+
*/
|
|
2652
|
+
function dispatchTree(tasks, rootId) {
|
|
2653
|
+
const byId = taskIndex(tasks);
|
|
2654
|
+
const root = byId.get(String(rootId));
|
|
2655
|
+
if (!root) return { root: null, rows: [], childCount: 0, maxDepth: 0 };
|
|
2656
|
+
const rows = [{ task: root, depth: 0 }];
|
|
2657
|
+
const seen = new Set([String(root.id)]);
|
|
2658
|
+
let maxDepth = 0;
|
|
2659
|
+
const walkDown = (parent, depth) => {
|
|
2660
|
+
const parentAnchor = parent && parent.childId != null ? String(parent.childId) : "";
|
|
2661
|
+
if (!parentAnchor) return;
|
|
2662
|
+
const kids = (tasks || []).filter((k) => k && k.id !== undefined && !seen.has(String(k.id))
|
|
2663
|
+
&& k.dispatchedBySession != null && String(k.dispatchedBySession) === parentAnchor);
|
|
2664
|
+
kids.sort((a, b) => String(a.createdAt || "").localeCompare(String(b.createdAt || "")));
|
|
2665
|
+
for (const kid of kids) {
|
|
2666
|
+
seen.add(String(kid.id));
|
|
2667
|
+
rows.push({ task: kid, depth });
|
|
2668
|
+
if (depth > maxDepth) maxDepth = depth;
|
|
2669
|
+
walkDown(kid, depth + 1);
|
|
2670
|
+
}
|
|
2671
|
+
};
|
|
2672
|
+
walkDown(root, 1);
|
|
2673
|
+
return { root, rows, childCount: rows.length - 1, maxDepth };
|
|
2674
|
+
}
|
|
2675
|
+
return { taskIndex, chainOf, chainRows, chainLayout, dispatchTree };
|
|
2676
|
+
})();
|
|
2677
|
+
/* ============================== src/taskboard.js ============================== */
|
|
2678
|
+
__mods["taskboard.js"] = (() => {
|
|
2679
|
+
const { h, useState, useEffect, useMemo, useRef } = __mods["react.js"];
|
|
2680
|
+
const { fmtTime, clip, DIM, LINE, LABEL, Badge, TASK_STATUS_ORDER, taskStatusView, TaskDot, TaskStateWord } = __mods["ui.js"];
|
|
2681
|
+
const { RoleIconSm } = __mods["icons.js"];
|
|
2682
|
+
const { dispatchTree } = __mods["taskgraph.js"];
|
|
2683
|
+
const { PromptAssembly } = __mods["prompt.js"];
|
|
2684
|
+
/**
|
|
2685
|
+
* client/src/taskboard.js — 任务看板 tab(v0.40.0 四 tab P0;v0.40.7 任务时间线重构)。
|
|
2686
|
+
*
|
|
2687
|
+
* 主数据仍是 GET /bufeng/api/tasks(按需分页,不随 SSE 全量下发)。v0.40.7 重构(工作项二):
|
|
2688
|
+
* - 左列(任务队列)只列「目标节点 kind ∈ {root,leader}」的任务——都管/总管层接收的单
|
|
2689
|
+
* (服务端 targetKinds=root,leader 过滤;创建时间倒序、可点选切换);
|
|
2690
|
+
* - 右栏渲染所选单的「分发链路树」:父子判定=子任务.dispatchedBySession === 父任务.childId
|
|
2691
|
+
* (taskgraph.dispatchTree 纯函数,逐层向下递归);无下游显示空态文案,不再渲染单节点假图;
|
|
2692
|
+
* - 树数据取自独立的不过滤取数窗(limit=200),左列过滤不影响右栏整棵树;节点卡跳转携带的
|
|
2693
|
+
* 窗口外任务并入树数据(bufeng-task-focus,读后即清)。
|
|
2694
|
+
*/
|
|
2695
|
+
|
|
2696
|
+
|
|
2697
|
+
|
|
2698
|
+
|
|
2699
|
+
|
|
2700
|
+
|
|
2701
|
+
/* ---------- 快照名录映射:nodeId→{name,kind,prompt,systemPrompt} / projectId→项目 ---------- */
|
|
2702
|
+
function buildNameMaps(snap) {
|
|
2703
|
+
const nodeName = {}, nodeKind = {}, nodePrompt = {}, nodeById = {}, projName = {}, projById = {};
|
|
2704
|
+
for (const t of (snap && snap.trees) || []) {
|
|
2705
|
+
for (const n of t.nodes || []) {
|
|
2706
|
+
nodeName[n.id] = n.name;
|
|
2707
|
+
nodeKind[n.id] = n.kind;
|
|
2708
|
+
nodePrompt[n.id] = n.systemPrompt || "";
|
|
2709
|
+
nodeById[n.id] = n;
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
for (const p of (snap && snap.projects) || []) { projName[p.id] = p.name; projById[p.id] = p; }
|
|
2713
|
+
return { nodeName, nodeKind, nodePrompt, nodeById, projName, projById };
|
|
2714
|
+
}
|
|
2715
|
+
|
|
2716
|
+
/* ---------- 链路切组:仅用于左栏分组展示(分发链路树只认 dispatchedBySession===childId) ---------- */
|
|
2717
|
+
function groupByChain(tasks) {
|
|
2718
|
+
const groups = [];
|
|
2719
|
+
for (const k of tasks || []) {
|
|
2720
|
+
const key = k.chainId || k.id;
|
|
2721
|
+
const last = groups[groups.length - 1];
|
|
2722
|
+
if (last && last.key === key) last.items.push(k);
|
|
2723
|
+
else groups.push({ key, chainTitle: k.chainTitle || null, items: [k] });
|
|
2724
|
+
}
|
|
2725
|
+
return groups;
|
|
2726
|
+
}
|
|
2727
|
+
|
|
2728
|
+
/* ---------- v0.40.7 跳转锚(graph.js 节点卡「在跑任务」点击写入):读后即清——一次性跳转 ---------- */
|
|
2729
|
+
function takeTaskFocus() {
|
|
2730
|
+
try {
|
|
2731
|
+
const raw = sessionStorage.getItem("bufeng-task-focus") || "";
|
|
2732
|
+
if (!raw) return null;
|
|
2733
|
+
sessionStorage.setItem("bufeng-task-focus", "");
|
|
2734
|
+
const v = JSON.parse(raw);
|
|
2735
|
+
return v && v.task && v.task.id ? v.task : null;
|
|
2736
|
+
} catch { return null; }
|
|
2737
|
+
}
|
|
2738
|
+
|
|
2739
|
+
/* ---------- v0.40.7 树数据合并:跳转携带的窗口外任务并入取数窗(按 id 去重,跳转单在前) ---------- */
|
|
2740
|
+
function mergeTasks(extra, base) {
|
|
2741
|
+
const out = [], seen = new Set();
|
|
2742
|
+
for (const k of [...(Array.isArray(extra) ? extra : []), ...(Array.isArray(base) ? base : [])]) {
|
|
2743
|
+
if (!k || !k.id || seen.has(k.id)) continue;
|
|
2744
|
+
seen.add(k.id); out.push(k);
|
|
2745
|
+
}
|
|
2746
|
+
return out;
|
|
2747
|
+
}
|
|
2748
|
+
|
|
2749
|
+
/* ---------- W2-T4(k-mvsc8xhx0qv)续跑按钮:两段确认(idle→armed 4s 复位→busy→err/ok note;err 6s 复位 idle,照 cards.js RetireBtn 状态机)---------- */
|
|
2750
|
+
/* POST /bufeng/api/task/recover body={taskId,confirm:true}(bufeng_task_recover action=resume 投递面);行内点击 stopPropagation 防触发行选中(sim 裸调 onClick() 无参,e 守卫必须)---------- */
|
|
2751
|
+
function ResumeBtn({ task }) {
|
|
2752
|
+
const [st, setSt] = useState("idle");
|
|
2753
|
+
const [note, setNote] = useState(null);
|
|
2754
|
+
const fire = () => {
|
|
2755
|
+
setSt("busy");
|
|
2756
|
+
fetch("/bufeng/api/task/recover", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ taskId: task.id, confirm: true }) })
|
|
2757
|
+
.then((r) => r.json().catch(() => ({})).then((j) => ({ r, j })))
|
|
2758
|
+
.then(({ r, j }) => {
|
|
2759
|
+
if (r.ok && j.ok) {
|
|
2760
|
+
setSt("idle");
|
|
2761
|
+
setNote({ ok: true, text: "续跑指令已投递" + (j.requestId ? "(" + j.requestId + ")" : "") });
|
|
2762
|
+
} else {
|
|
2763
|
+
setSt("err");
|
|
2764
|
+
setNote({ ok: false, text: "续跑失败:" + ((j && j.error) || "HTTP " + r.status) });
|
|
2765
|
+
setTimeout(() => setSt((sc) => (sc === "err" ? "idle" : sc)), 6000);
|
|
2766
|
+
}
|
|
2767
|
+
})
|
|
2768
|
+
.catch(() => {
|
|
2769
|
+
setSt("err");
|
|
2770
|
+
setNote({ ok: false, text: "续跑失败:网络异常" });
|
|
2771
|
+
setTimeout(() => setSt((sc) => (sc === "err" ? "idle" : sc)), 6000);
|
|
2772
|
+
});
|
|
2773
|
+
};
|
|
2774
|
+
const click = (e) => {
|
|
2775
|
+
if (e && e.stopPropagation) e.stopPropagation();
|
|
2776
|
+
if (st === "busy") return;
|
|
2777
|
+
if (st === "armed") { fire(); return; }
|
|
2778
|
+
setSt("armed");
|
|
2779
|
+
setNote(null);
|
|
2780
|
+
setTimeout(() => setSt((sc) => (sc === "armed" ? "idle" : sc)), 4000);
|
|
2781
|
+
};
|
|
2782
|
+
return h("span", { className: "bf-tb-resume" },
|
|
2783
|
+
h("button", { className: "bf-ctl", "data-bf-resume": "1", "data-bf-taskid": task.id,
|
|
2784
|
+
disabled: st === "busy", title: "续跑该任务(两段确认)", onClick: click,
|
|
2785
|
+
style: { fontSize: "11px", padding: "1px 8px", cursor: "pointer" } },
|
|
2786
|
+
st === "armed" ? "确认续跑" : st === "busy" ? "续跑中…" : st === "err" ? "失败/重试" : "↻ 续跑"),
|
|
2787
|
+
note && !note.ok ? h("span", { "data-bf-resumeerr": "1", style: { color: "#e5484d", marginLeft: "6px", fontSize: "11px" } }, note.text) : null,
|
|
2788
|
+
note && note.ok ? h("span", { "data-bf-resumeok": "1", style: { color: "#4cc38a", marginLeft: "6px", fontSize: "11px" } }, note.text) : null);
|
|
2789
|
+
}
|
|
2790
|
+
/* ---------- 左栏任务行:状态+标题 → 执行/派发/项目 → 时间;点击选中右栏 ---------- */
|
|
2791
|
+
function TaskCard({ k, maps, onSelect, active }) {
|
|
2792
|
+
const execName = k.nodeId ? (maps.nodeName[k.nodeId] || k.nodeId) : null;
|
|
2793
|
+
const execKind = k.nodeId ? maps.nodeKind[k.nodeId] : null;
|
|
2794
|
+
const proj = k.projectId ? (maps.projName[k.projectId] || k.projectId) : null;
|
|
2795
|
+
const rep = typeof k.report === "string" ? k.report
|
|
2796
|
+
: k.report && k.report.summary ? String(k.report.summary) : "";
|
|
2797
|
+
return h("div", { className: "bf-tb-task" + (active ? " bf-on" : ""), "data-bf-task": "1",
|
|
2798
|
+
"data-bf-taskid": k.id, onClick: () => onSelect && onSelect(k.id),
|
|
2799
|
+
title: "点击查看分发链路与提示词装配" },
|
|
2800
|
+
h("div", { className: "bf-tb-head" },
|
|
2801
|
+
h(TaskDot, { s: k.status }),
|
|
2802
|
+
h("span", { className: "bf-tb-title", "data-hot": k.status === "running" ? "true" : "false",
|
|
2803
|
+
title: (k.title || k.id) + (rep ? "\n—— " + rep : "") }, k.title || k.id),
|
|
2804
|
+
h(TaskStateWord, { s: k.status })),
|
|
2805
|
+
h("div", { className: "bf-tb-rel" },
|
|
2806
|
+
execName ? h("span", { className: "bf-tb-exec", title: "执行节点 " + k.nodeId },
|
|
2807
|
+
execKind ? h(RoleIconSm, { kind: execKind, uid: "tb-" + k.id }) : null,
|
|
2808
|
+
"⚙ " + execName) : h("span", { className: "bf-tb-exec", style: DIM }, "⚙ 未指派节点"),
|
|
2809
|
+
k.dispatchedByLabel ? h("span", { className: "bf-tb-dispatch", "data-bf-dispatch": "1",
|
|
2810
|
+
style: { display: "none" }, title: "派发边 " + (k.dispatchedBy ? k.dispatchedBy.kind + " @ " + (k.dispatchedBy.nodeId || "来宾入口") : "") },
|
|
2811
|
+
"↗ 派发 " + (k.dispatchedByKind || "") + " · " + k.dispatchedByLabel) : null,
|
|
2812
|
+
proj ? h("span", { className: "bf-tb-proj", title: "项目归属 " + (k.projectId || "") }, "📁 " + proj) : null),
|
|
2813
|
+
h("div", { className: "bf-tb-sub" },
|
|
2814
|
+
fmtTime(k.createdAt)
|
|
2815
|
+
+ (k.finishedAt ? " → " + fmtTime(k.finishedAt) : "")
|
|
2816
|
+
+ (k.overdue ? " · ⏰ 超时" : "")
|
|
2817
|
+
+ (k.source === "improve" ? " · ⏫ 提升" : "")
|
|
2818
|
+
+ (Array.isArray(k.dependsOn) && k.dependsOn.length ? " · 前置 " + k.dependsOn.length : ""),
|
|
2819
|
+
k.resumable ? h(ResumeBtn, { task: k, key: "resume" }) : null,
|
|
2820
|
+
k.resumeAttempts > 0 ? h("span", { "data-bf-resumemeta": "1", style: { ...DIM, fontSize: "11px", marginLeft: "6px" } },
|
|
2821
|
+
"续跑 " + k.resumeAttempts + " 次"
|
|
2822
|
+
+ (isFinite(Number(k.resumedAt)) && Number(k.resumedAt) > 0 ? " · " + fmtTime(Number(k.resumedAt)) : "")) : null));
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2825
|
+
function ChainHead({ g }) {
|
|
2826
|
+
return h("div", { className: "bf-tb-chain", "data-bf-chain": "1",
|
|
2827
|
+
title: g.chainTitle ? "派单链路(chainId=" + g.key + ")" : "独立任务(chainId=null)" },
|
|
2828
|
+
"⛓ " + (g.chainTitle || "独立任务") + " · " + g.items.length + " 单");
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2831
|
+
function Pager({ data, offset, onOffset }) {
|
|
2832
|
+
const total = data.total, count = data.page ? data.page.count : (data.tasks || []).length;
|
|
2833
|
+
const from = total === 0 ? 0 : offset + 1, to = offset + count;
|
|
2834
|
+
return h("div", { className: "bf-tb-pager", "data-bf-pager": "1" },
|
|
2835
|
+
h("button", { className: "bf-ctl", disabled: offset <= 0, title: "上一页",
|
|
2836
|
+
onClick: () => onOffset(Math.max(0, offset - (data.page ? data.page.limit : 50))) }, "‹ 上一页"),
|
|
2837
|
+
h("span", { className: "bf-meta" }, "第 " + from + "–" + to + " 条 · 共 " + total + " 条"),
|
|
2838
|
+
h("button", { className: "bf-ctl", disabled: offset + count >= total, title: "下一页",
|
|
2839
|
+
onClick: () => onOffset(offset + count) }, "下一页 ›"));
|
|
2840
|
+
}
|
|
2841
|
+
|
|
2842
|
+
|
|
2843
|
+
/* ---------- 右栏:任务头 + 子 tab + 分发链路树 + 详情/装配(v0.40.7 工作项二重构) ---------- */
|
|
2844
|
+
function TaskDetail({ k, maps, tasks, onSelect }) {
|
|
2845
|
+
const [tab, setTab] = useState("detail");
|
|
2846
|
+
const [openAcc, setOpenAcc] = useState(false);
|
|
2847
|
+
const [openRep, setOpenRep] = useState(false);
|
|
2848
|
+
const tree = useMemo(() => dispatchTree(tasks, k.id), [tasks, k.id]);
|
|
2849
|
+
const node = k.nodeId ? maps.nodeById[k.nodeId] : null;
|
|
2850
|
+
const proj = k.projectId ? maps.projById[k.projectId] : null;
|
|
2851
|
+
const rep = typeof k.report === "string" ? k.report : k.report && k.report.summary ? String(k.report.summary) : "";
|
|
2852
|
+
return h("div", { className: "bf-tb-detail", "data-bf-taskdetail": "1" },
|
|
2853
|
+
h("div", { className: "bf-tb-dhead" },
|
|
2854
|
+
h(TaskDot, { s: k.status }), h("b", { className: "bf-tb-dtitle" }, k.title || k.id),
|
|
2855
|
+
h(TaskStateWord, { s: k.status }),
|
|
2856
|
+
k.overdue ? h(Badge, { tone: "warn" }, "⏰ 超时") : null,
|
|
2857
|
+
h("span", { style: { flex: 1 } }),
|
|
2858
|
+
h("button", { className: "bf-ctl", title: "复制任务 ID",
|
|
2859
|
+
onClick: () => { try { navigator.clipboard && navigator.clipboard.writeText(k.id); } catch { /* 忽略 */ } } }, "复制 ID")),
|
|
2860
|
+
h("div", { className: "bf-tb-dmeta" },
|
|
2861
|
+
h("span", null, "执行 ", node ? node.name : (k.nodeId || "未指派")),
|
|
2862
|
+
h("span", null, "派发 ", k.dispatchedByLabel || "—"),
|
|
2863
|
+
h("span", null, "项目 ", proj ? proj.name : "—"),
|
|
2864
|
+
h("span", null, "创建 " + fmtTime(k.createdAt)),
|
|
2865
|
+
k.finishedAt ? h("span", null, "完成 " + fmtTime(k.finishedAt)) : null,
|
|
2866
|
+
h("span", null, "提示词 " + ((k.promptManifest || []).length) + " 段")),
|
|
2867
|
+
h("div", { className: "bf-tb-subnav" },
|
|
2868
|
+
h("button", { className: "bf-tbsub" + (tab === "detail" ? " bf-on" : ""), "data-bf-tasktab": "detail",
|
|
2869
|
+
onClick: () => setTab("detail") }, "任务详情"),
|
|
2870
|
+
h("button", { className: "bf-tbsub" + (tab === "prompt" ? " bf-on" : ""), "data-bf-tasktab": "prompt",
|
|
2871
|
+
onClick: () => setTab("prompt") }, "提示词装配 " + ((k.promptManifest || []).length)),
|
|
2872
|
+
h("span", { style: { flex: 1 } }), h("span", { className: "bf-meta" }, "任务级 · 只读")),
|
|
2873
|
+
tab === "prompt" ? h(PromptAssembly, { k, maps }) : h("div", null,
|
|
2874
|
+
h("div", { className: "bf-chain-wrap" },
|
|
2875
|
+
h("div", { className: "bf-chain-h" }, h("b", null, "分发链路"),
|
|
2876
|
+
h("span", { style: DIM }, "沿派发会话逐层递归(子单.dispatchedBySession=父单.childId) · 下游 " + tree.childCount + " 单")),
|
|
2877
|
+
tree.childCount ? h("div", { className: "bf-dtree", "data-bf-dtree": "1" },
|
|
2878
|
+
tree.rows.map((r) => {
|
|
2879
|
+
const t = r.task;
|
|
2880
|
+
const ex = t.nodeId ? maps.nodeName[t.nodeId] : null;
|
|
2881
|
+
return h("div", { key: t.id, className: "bf-drow" + (t.id === k.id ? " bf-on" : ""),
|
|
2882
|
+
"data-bf-dnode": t.id, "data-bf-ddepth": String(r.depth),
|
|
2883
|
+
style: { paddingLeft: 6 + r.depth * 18 },
|
|
2884
|
+
onClick: () => onSelect && onSelect(t.id),
|
|
2885
|
+
title: (t.title || t.id) + "(dispatchedBySession=" + (t.dispatchedBySession || "—")
|
|
2886
|
+
+ ";childId=" + (t.childId || "—") + ")" },
|
|
2887
|
+
h("span", { className: "bf-drow-guide", style: r.depth ? null : { visibility: "hidden" } }, "└"),
|
|
2888
|
+
h(TaskDot, { s: t.status }),
|
|
2889
|
+
h("span", { className: "bf-drow-title" }, t.title || t.id),
|
|
2890
|
+
h(TaskStateWord, { s: t.status }),
|
|
2891
|
+
ex ? h("span", { className: "bf-drow-exec" }, "⚙ " + ex) : null,
|
|
2892
|
+
t.id === k.id ? h("span", { className: "bf-drow-cur" }, "本单") : null);
|
|
2893
|
+
}))
|
|
2894
|
+
: h("div", { className: "bf-card", "data-bf-dtree-empty": "1", style: { ...DIM, padding: "8px 12px" } },
|
|
2895
|
+
"该任务未分发出下游子任务")),
|
|
2896
|
+
h("div", { className: "bf-dgrid" },
|
|
2897
|
+
h("div", { className: "bf-dcard" },
|
|
2898
|
+
h("div", { className: "bf-dcard-h" }, h("b", null, "验收标准"), h("span", { className: "bf-meta" }, (k.acceptance || "").length + " 字"),
|
|
2899
|
+
h("span", { style: { flex: 1 } }), h("button", { className: "bf-ctl", onClick: () => setOpenAcc(!openAcc) }, openAcc ? "收起" : "展开")),
|
|
2900
|
+
h("pre", { className: "bf-pre" + (openAcc ? " bf-open" : "") }, k.acceptance || "(无验收标准)")),
|
|
2901
|
+
h("div", { className: "bf-dcard" },
|
|
2902
|
+
h("div", { className: "bf-dcard-h" }, h("b", null, "回报"), h("span", { className: "bf-meta" }, rep.length + " 字"),
|
|
2903
|
+
h("span", { style: { flex: 1 } }), h("button", { className: "bf-ctl", onClick: () => setOpenRep(!openRep) }, openRep ? "收起" : "展开")),
|
|
2904
|
+
h("pre", { className: "bf-pre" + (openRep ? " bf-open" : "") }, rep || "执行中,暂无回报"))),
|
|
2905
|
+
h("div", { className: "bf-dcard" },
|
|
2906
|
+
h("div", { className: "bf-dcard-h" }, h("b", null, "涉及文件 / 依赖"),
|
|
2907
|
+
h("span", { className: "bf-meta" }, ((k.files || []).length) + " 个文件 · " + ((k.dependsOn || []).length) + " 个前置")),
|
|
2908
|
+
h("div", { className: "bf-chips" }, (k.files || []).map((f, i) => h("code", { key: "f" + i, className: "bf-fchip" }, f)),
|
|
2909
|
+
(k.dependsOn || []).map((d, i) => h("span", { key: "d" + i, className: "bf-fchip", title: "前置任务 " + d }, "⛓ " + clip(d, 18)))))));
|
|
2910
|
+
}
|
|
2911
|
+
|
|
2912
|
+
/* ---------- 主组件:左队列(都管层单)/右分发链路详情 ---------- */
|
|
2913
|
+
function TaskBoard({ snap }) {
|
|
2914
|
+
const maps = useMemo(() => buildNameMaps(snap), [snap]);
|
|
2915
|
+
const [status, setStatus] = useState("");
|
|
2916
|
+
const [projectId, setProjectId] = useState("");
|
|
2917
|
+
const [limit, setLimit] = useState(50);
|
|
2918
|
+
const [offset, setOffset] = useState(0);
|
|
2919
|
+
const [data, setData] = useState(null);
|
|
2920
|
+
const [err, setErr] = useState("");
|
|
2921
|
+
const [selected, setSelected] = useState(null);
|
|
2922
|
+
// v0.40.7:分发链路取数窗(不过滤——右栏要沿派发边画出 member 层子任务)+ 跳转携带的窗口外任务
|
|
2923
|
+
const [chainData, setChainData] = useState(null);
|
|
2924
|
+
const [chainExtra, setChainExtra] = useState(null);
|
|
2925
|
+
const focusRef = useRef(null); // 跳转锚选中的任务 id(左列取数兜底不覆盖它)
|
|
2926
|
+
const sig = JSON.stringify([
|
|
2927
|
+
snap && snap.summary ? snap.summary.tasks : null,
|
|
2928
|
+
((snap && snap.projects) || []).map((p) => p && p.tasksByStatus),
|
|
2929
|
+
]);
|
|
2930
|
+
useEffect(() => {
|
|
2931
|
+
let dead = false;
|
|
2932
|
+
const q = new URLSearchParams();
|
|
2933
|
+
if (status) q.set("status", status);
|
|
2934
|
+
if (projectId) q.set("projectId", projectId);
|
|
2935
|
+
q.set("targetKinds", "root,leader"); // v0.40.7 工作项二:左列只列都管/总管层接收的单
|
|
2936
|
+
q.set("limit", String(limit));
|
|
2937
|
+
q.set("offset", String(offset));
|
|
2938
|
+
fetch("/bufeng/api/tasks?" + q.toString(), { cache: "no-store" })
|
|
2939
|
+
.then((r) => r.ok ? r.json() : Promise.reject(new Error("HTTP " + r.status)))
|
|
2940
|
+
.then((j) => {
|
|
2941
|
+
if (dead) return;
|
|
2942
|
+
if (j && j.ok === false) { setErr(String(j.error || "端点返回失败")); return; }
|
|
2943
|
+
const tasks = j.tasks ?? [];
|
|
2944
|
+
setData({ total: j.total ?? 0, tasks, page: j.page ?? null });
|
|
2945
|
+
setErr("");
|
|
2946
|
+
// v0.40.7 工作项一联动:跳转锚选中的任务可能不在都管层窗口内(member 目标)——保留跳转选中,不被左列兜底覆盖
|
|
2947
|
+
setSelected((prev) => (prev && (prev === focusRef.current || tasks.some((k) => k.id === prev))) ? prev : (tasks[0] ? tasks[0].id : null));
|
|
2948
|
+
})
|
|
2949
|
+
.catch((e) => { if (!dead) setErr(String((e && e.message) || e)); });
|
|
2950
|
+
return () => { dead = true; };
|
|
2951
|
+
}, [status, projectId, limit, offset, sig]);
|
|
2952
|
+
useEffect(() => {
|
|
2953
|
+
let dead = false;
|
|
2954
|
+
fetch("/bufeng/api/tasks?limit=200", { cache: "no-store" })
|
|
2955
|
+
.then((r) => r.ok ? r.json() : Promise.reject(new Error("HTTP " + r.status)))
|
|
2956
|
+
.then((j) => { if (!dead) setChainData({ tasks: (j && Array.isArray(j.tasks)) ? j.tasks : [] }); })
|
|
2957
|
+
.catch(() => { if (!dead) setChainData({ tasks: [] }); });
|
|
2958
|
+
return () => { dead = true; };
|
|
2959
|
+
}, [sig]);
|
|
2960
|
+
// v0.40.7 工作项一联动:节点卡「在跑任务」点击跳转锚(读后即清)→ 并入树数据 + 选中该单
|
|
2961
|
+
useEffect(() => {
|
|
2962
|
+
const ft = takeTaskFocus();
|
|
2963
|
+
if (ft) {
|
|
2964
|
+
focusRef.current = ft.id;
|
|
2965
|
+
setChainExtra((prev) => { const list = Array.isArray(prev) ? prev.filter((x) => x && x.id !== ft.id) : []; return [ft, ...list]; });
|
|
2966
|
+
setSelected(ft.id);
|
|
2967
|
+
}
|
|
2968
|
+
}, []);
|
|
2969
|
+
const selStyle = { border: "1px solid " + LINE, height: 22, borderRadius: 5, padding: "0 4px",
|
|
2970
|
+
background: "var(--dsw-alias-bg-base, rgba(128,128,128,0.06))", color: "var(--dsw-alias-label-primary, #eee)",
|
|
2971
|
+
font: "var(--dsw-font-xxxs-11, 11px/1.4 sans-serif)" };
|
|
2972
|
+
const projects = (snap && snap.projects) || [];
|
|
2973
|
+
const tasks = (data && Array.isArray(data.tasks)) ? data.tasks : [];
|
|
2974
|
+
const chainTasks = mergeTasks(chainExtra, (chainData && chainData.tasks) || []);
|
|
2975
|
+
const groups = groupByChain(tasks);
|
|
2976
|
+
const filtered = !!(status || projectId);
|
|
2977
|
+
const selectedTask = chainTasks.find((k) => k.id === selected) || null;
|
|
2978
|
+
return h("div", { style: { display: "flex", flexDirection: "column", gap: 8, width: "100%" } },
|
|
2979
|
+
h("div", { className: "bf-tb-split" },
|
|
2980
|
+
h("div", { className: "bf-tb-rail" },
|
|
2981
|
+
h("div", { className: "bf-tb-tools" },
|
|
2982
|
+
h("select", { value: status, title: "按任务状态过滤", onChange: (e) => { setStatus(e.target.value); setOffset(0); }, style: selStyle },
|
|
2983
|
+
h("option", { value: "" }, "全部状态"),
|
|
2984
|
+
TASK_STATUS_ORDER.map((s) => h("option", { key: s, value: s }, taskStatusView(s).w))),
|
|
2985
|
+
h("select", { value: projectId, title: "按项目过滤", onChange: (e) => { setProjectId(e.target.value); setOffset(0); }, style: selStyle },
|
|
2986
|
+
h("option", { value: "" }, "全部项目"), projects.map((p) => h("option", { key: p.id, value: p.id }, p.name))),
|
|
2987
|
+
h("select", { value: String(limit), title: "每页条数", onChange: (e) => { setLimit(Number(e.target.value) || 50); setOffset(0); }, style: selStyle },
|
|
2988
|
+
[20, 50, 100, 200].map((n) => h("option", { key: n, value: String(n) }, "每页 " + n))),
|
|
2989
|
+
h("span", { "data-bf-railhint": "1", style: DIM,
|
|
2990
|
+
title: "左列只列目标节点 kind∈{root,leader} 的任务(都管/总管层接收的单,创建时间倒序);成员层子任务在右栏分发链路树中展开" }, "都管层"),
|
|
2991
|
+
h("span", { style: DIM }, err ? "取数失败:" + err : data ? "共 " + data.total + " 条" : "加载中…")),
|
|
2992
|
+
data && data.total === 0 ? h("div", { className: "bf-card", "data-bf-empty": "1", style: { ...DIM, padding: "8px 12px" } },
|
|
2993
|
+
filtered ? "当前过滤条件下暂无任务" : "暂无任务 —— 派单后这里展示都管层任务与分发链路") : null,
|
|
2994
|
+
h("div", { className: "bf-tb-list" },
|
|
2995
|
+
groups.map((g, gi) => h("div", { key: g.key + ":" + gi, className: "bf-tb-group" },
|
|
2996
|
+
h(ChainHead, { g }),
|
|
2997
|
+
g.items.map((k) => h(TaskCard, { key: k.id, k, maps, active: k.id === selected, onSelect: setSelected }))))),
|
|
2998
|
+
data ? h(Pager, { data, offset, onOffset: setOffset }) : null),
|
|
2999
|
+
h("div", { className: "bf-tb-main" },
|
|
3000
|
+
selectedTask ? h(TaskDetail, { key: selectedTask.id, k: selectedTask, maps, tasks: chainTasks, onSelect: setSelected }) : h("div", { className: "bf-card", "data-bf-taskdetail": "empty", style: { ...DIM, padding: "24px" } },
|
|
3001
|
+
data ? "选择左侧任务查看分发链路与提示词装配" : "加载中…"))));
|
|
3002
|
+
}
|
|
3003
|
+
return { TaskBoard, TaskCard };
|
|
3004
|
+
})();
|
|
3005
|
+
/* ============================== src/projects.js ============================== */
|
|
3006
|
+
__mods["projects.js"] = (() => {
|
|
3007
|
+
const { h, useState } = __mods["react.js"];
|
|
3008
|
+
const { fmtTime, DIM, LINE, TaskDot, TaskStateWord } = __mods["ui.js"];
|
|
3009
|
+
/**
|
|
3010
|
+
* client/src/projects.js — 项目概览(v0.15.0 项目制;v0.40.1 四 tab P0 项目页)。
|
|
3011
|
+
*
|
|
3012
|
+
* 项目=业务目录 + 说明 + 归属都管;这里展示「目录 × 任务 × 编制」的关联,
|
|
3013
|
+
* 不复制智能体能力面。项目上下文(projectNote)只说明归属,不展开正文。
|
|
3014
|
+
* v0.41.0:项目卡新增都管下拉(LeaderCtl)——选中即绑定/换绑、选「解绑…」清空,
|
|
3015
|
+
* POST /bufeng/api/project/leader(看板=总管代行),与 bufeng_project update
|
|
3016
|
+
* leaderNodeId 同一校验路径;推翻 v0.39.1「看板只读」口径(ADR 注记见 docs/决策/)。
|
|
3017
|
+
* v0.42.0(方案 B,客户 2026-10-23 拍板):项目 tab 从「每项目一整屏堆叠」改为
|
|
3018
|
+
* 「列表 + 详情」——①工具条=搜索(名/描述/路径)+治理过滤 chips(带实时计数)+排序;
|
|
3019
|
+
* ②列表=吸附表头+六列行(项目[名+都管徽章+缺目录标]/任务四数/分布条/都管[行内迷你
|
|
3020
|
+
* 下拉,stopPropagation 隔离行点击]/活跃/路径),默认前 12+「展开全部」;③详情=复用
|
|
3021
|
+
* ProjectCard(v0.41.0 完整都管下拉)+任务流卡+右侧三小卡,「↑ 收起详情」。列表状态
|
|
3022
|
+
* (搜索词/chip/排序/展开/选中行)存组件 state——SSE 全帧刷新(重渲染)不重置;点击
|
|
3023
|
+
* chip/搜索词变化即重置展开态。排序字段一律用快照真实投影(lastTaskAt 缺省排末尾/
|
|
3024
|
+
* name/tasksByStatus/taskCount)。旧快照(无都管三键):行内下拉与徽章整段不渲染,
|
|
3025
|
+
* 「都管未绑定/⚠️ 悬挂」两枚 chip 不出(同 LeaderCtl 既有口径,防误报)。
|
|
3026
|
+
* v0.43.0 阶段2A(k-mvl3hrlo0nc):项目行新增编制覆盖徽标 covBadgeOf——绿=coverage.present&&complete
|
|
3027
|
+
* 「✅ 覆盖齐备」data-bf-covbadge="ok";黄=有缺口「⚠️ 覆盖缺口 N」/未定义矩阵「⚠️ 未定义覆盖矩阵」
|
|
3028
|
+
* data-bf-covbadge="gap";缺口时环节名直显(covGapLineOf:gaps[].name+reason 中文短标签)。
|
|
3029
|
+
* 防御口径同 leaderBadgeOf:旧快照 coverage 键 undefined 整段不渲染;纯展示零请求、行点击语义不变。
|
|
3030
|
+
*/
|
|
3031
|
+
|
|
3032
|
+
|
|
3033
|
+
|
|
3034
|
+
const COLORS = { running: '#4f7cf0', pending: '#d8a516', queued: '#d8a516', done: '#2f9e44', failed: '#e5484d', cancelled: '#8b94a7' };
|
|
3035
|
+
const pct = (n, total) => (total ? Math.round((n / total) * 1000) / 10 : 0);
|
|
3036
|
+
|
|
3037
|
+
function countTasks(tasks) {
|
|
3038
|
+
const c = { running: 0, pending: 0, queued: 0, done: 0, failed: 0, cancelled: 0 };
|
|
3039
|
+
for (const k of tasks || []) if (c[k.status] !== undefined) c[k.status]++;
|
|
3040
|
+
return c;
|
|
3041
|
+
}
|
|
3042
|
+
|
|
3043
|
+
/* ---------- 都管下拉(v0.41.0 客户需求「项目都管分配,添加下拉选」):
|
|
3044
|
+
* 选中即绑定/换绑、选「解绑…」=清空(POST body {projectId, leaderNodeId: string|null})。
|
|
3045
|
+
* 账本为权威:写成功先本地对齐(override),SSE 全帧刷新即校准;busy 禁用,错误红字回落。
|
|
3046
|
+
* v0.42.0:mini 形态=列表行内直改(onClick stopPropagation——点下拉不触发行点击/行选中;
|
|
3047
|
+
* onChange 同样止泡防 select 事件冒泡;回执收进行内小字)。POST 语义两形态完全一致。 ---------- */
|
|
3048
|
+
function leaderGroupsOf(snap) {
|
|
3049
|
+
const groups = [];
|
|
3050
|
+
for (const t of (snap && snap.trees) || []) {
|
|
3051
|
+
if (t.status && t.status !== "active") continue; // 归档树不可绑定(resolveProjectLeader 只认 active 树)
|
|
3052
|
+
const leaders = (t.nodes || []).filter((n) => n.kind === "leader" && n.status !== "retired");
|
|
3053
|
+
if (leaders.length) groups.push({ tree: t, leaders });
|
|
3054
|
+
}
|
|
3055
|
+
return groups;
|
|
3056
|
+
}
|
|
3057
|
+
|
|
3058
|
+
// v0.39.x A1 都管三态徽章(v0.42.0 抽共用:详情卡+列表行同源;旧快照三键皆 undefined=不渲染,防误报)
|
|
3059
|
+
const leaderKnownOf = (p) => p.leaderNodeId !== undefined || p.leader !== undefined || p.leaderStale !== undefined;
|
|
3060
|
+
const leaderBadgeOf = (p) => {
|
|
3061
|
+
const leader = p.leader || null;
|
|
3062
|
+
if (!leaderKnownOf(p)) return null;
|
|
3063
|
+
if (leader) return h("span", { className: "bf-badge", style: { color: "#8fd6a7", borderColor: "#2f6b45", background: "#122018" },
|
|
3064
|
+
title: "项目绑定都管:" + leader.name + "(" + leader.status + ")· 派单按绑定都管路由" }, "🧭 " + leader.name);
|
|
3065
|
+
if (p.leaderStale) return h("span", { className: "bf-badge", style: { color: "#e0b45c", borderColor: "#6b5426", background: "#211c12" },
|
|
3066
|
+
title: "绑定的都管已失效(id 不存在/非都管/归档树/退役)——派单会被拒;用 bufeng_project update leaderNodeId=<id> 重新绑定" }, "⚠️ 都管悬挂");
|
|
3067
|
+
return h("span", { className: "bf-badge", style: { color: "#8b94a7", borderColor: "#39414f", background: "#171b22" },
|
|
3068
|
+
title: "项目未绑定都管——下拉选择绑定,或 bufeng_project update leaderNodeId=<都管 id>;绑定后派单按都管路由" }, "都管未绑定");
|
|
3069
|
+
};
|
|
3070
|
+
|
|
3071
|
+
/* ---------- v0.43.0 阶段2A 编制覆盖徽标(k-mvl3hrlo0nc):绿=矩阵齐备 / 黄=有缺口或未定义矩阵 ----------
|
|
3072
|
+
* 防御口径同 leaderBadgeOf:旧快照 coverage 键 undefined(或非对象)→ 整段不渲染,不得抛错。
|
|
3073
|
+
* 纯展示:零网络请求、无 onClick(行点击开详情的既有交互语义不变);data-bf-covbadge="ok"|"gap"
|
|
3074
|
+
* 供 sim 定位;缺口时环节名直显(gaps[].name + reason 中文短标签),no-plan 的唯一缺口=未定义本身不重复直显。 ---------- */
|
|
3075
|
+
const COV_REASON_LABEL = { "no-plan": "未定义矩阵", "node-missing": "节点缺失", "node-retired": "节点已退役", "no-seat": "无人接" };
|
|
3076
|
+
const covGapNamesOf = (cov) => (Array.isArray(cov && cov.gaps) ? cov.gaps : [])
|
|
3077
|
+
.map((g) => String((g && g.name) || "(未名环节)") + "·" + (COV_REASON_LABEL[g && g.reason] || "待核对"));
|
|
3078
|
+
const covBadgeOf = (p) => {
|
|
3079
|
+
const cov = p.coverage;
|
|
3080
|
+
if (!cov || typeof cov !== "object") return null; // 旧快照:不渲染徽标(防误报,同 leaderBadgeOf)
|
|
3081
|
+
if (cov.present && cov.complete) return h("span", { className: "bf-badge", "data-bf-covbadge": "ok",
|
|
3082
|
+
style: { color: "#8fd6a7", borderColor: "#2f6b45", background: "#122018" },
|
|
3083
|
+
title: "编制覆盖矩阵齐备:" + (cov.stageCount !== undefined ? cov.stageCount + " 个环节全有席位" : "环节全有席位") }, "✅ 覆盖齐备");
|
|
3084
|
+
const n = cov.gapCount !== undefined ? cov.gapCount : covGapNamesOf(cov).length;
|
|
3085
|
+
const noPlan = !cov.present;
|
|
3086
|
+
const names = covGapNamesOf(cov);
|
|
3087
|
+
return h("span", { className: "bf-badge", "data-bf-covbadge": "gap",
|
|
3088
|
+
style: { color: "#e0b45c", borderColor: "#6b5426", background: "#211c12" },
|
|
3089
|
+
title: noPlan ? "项目未定义覆盖矩阵——bufeng_project update coveragePlan 配置环节×席位,或 bufeng_capabilities { action: \"coverage\" } 查看"
|
|
3090
|
+
: "覆盖缺口 " + n + ":" + names.join("、") + "——bufeng_project update coveragePlan 补齐矩阵" },
|
|
3091
|
+
noPlan ? "⚠️ 未定义覆盖矩阵" : "⚠️ 覆盖缺口 " + n);
|
|
3092
|
+
};
|
|
3093
|
+
const covGapLineOf = (p) => { // 缺口环节名直显行(仅矩阵已定义且真有缺口;no-plan 缺口=未定义本身,徽标文案已覆盖)
|
|
3094
|
+
const cov = p.coverage;
|
|
3095
|
+
if (!cov || typeof cov !== "object" || !cov.present || cov.complete) return null;
|
|
3096
|
+
const names = covGapNamesOf(cov);
|
|
3097
|
+
if (!names.length) return null;
|
|
3098
|
+
return h("span", { className: "bf-meta", "data-bf-covgaps": p.id,
|
|
3099
|
+
style: { flexBasis: "100%", minWidth: 0, color: "#e0b45c", fontSize: 10.5,
|
|
3100
|
+
whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" },
|
|
3101
|
+
title: "缺失环节:" + names.join("、") }, names.join("、"));
|
|
3102
|
+
};
|
|
3103
|
+
|
|
3104
|
+
function LeaderCtl({ p, snap, mini }) {
|
|
3105
|
+
const [busy, setBusy] = useState(false);
|
|
3106
|
+
const [err, setErr] = useState("");
|
|
3107
|
+
const [okMsg, setOkMsg] = useState("");
|
|
3108
|
+
const [override, setOverride] = useState(undefined); // 写成功即时对齐(undefined=跟随快照)
|
|
3109
|
+
if (!leaderKnownOf(p)) return null; // 旧快照三键皆 undefined:整段不渲染(同徽章口径,防误报)
|
|
3110
|
+
const ledgerCur = p.leader ? p.leader.nodeId : (p.leaderStale ? p.leaderNodeId : null);
|
|
3111
|
+
const cur = override !== undefined ? override : ledgerCur;
|
|
3112
|
+
const groups = leaderGroupsOf(snap);
|
|
3113
|
+
const curLabel = cur ? (p.leader ? p.leader.name + "(" + p.leader.status + ")" : "⚠️ 悬挂:" + String(cur)) : "未绑定";
|
|
3114
|
+
const post = async (nodeId, okText) => {
|
|
3115
|
+
if (busy) return;
|
|
3116
|
+
setBusy(true); setErr(""); setOkMsg("");
|
|
3117
|
+
try {
|
|
3118
|
+
const r = await fetch("/bufeng/api/project/leader", { method: "POST",
|
|
3119
|
+
headers: { "content-type": "application/json" },
|
|
3120
|
+
body: JSON.stringify({ projectId: p.id, leaderNodeId: nodeId }) });
|
|
3121
|
+
const j = await r.json().catch(() => ({}));
|
|
3122
|
+
if (r.ok && j && j.ok) {
|
|
3123
|
+
setOverride(nodeId);
|
|
3124
|
+
setOkMsg(okText);
|
|
3125
|
+
setTimeout(() => setOkMsg((s) => (s === okText ? "" : s)), 5000);
|
|
3126
|
+
} else {
|
|
3127
|
+
setErr((j && j.error) ? String(j.error) : "保存失败(HTTP " + r.status + ")");
|
|
3128
|
+
}
|
|
3129
|
+
} catch (e) {
|
|
3130
|
+
setErr("保存失败:" + String((e && e.message) || e));
|
|
3131
|
+
}
|
|
3132
|
+
setBusy(false);
|
|
3133
|
+
};
|
|
3134
|
+
const onPick = (v) => {
|
|
3135
|
+
if (busy || v === (cur ?? "")) return; // 选中现值=幂等不发包
|
|
3136
|
+
if (v === "") post(null, "已解绑都管");
|
|
3137
|
+
else {
|
|
3138
|
+
let name = v;
|
|
3139
|
+
for (const g of groups) { const hit = g.leaders.find((n) => n.id === v); if (hit) { name = hit.name; break; } }
|
|
3140
|
+
post(v, "已绑定都管 " + name);
|
|
3141
|
+
}
|
|
3142
|
+
};
|
|
3143
|
+
const options = [
|
|
3144
|
+
h("option", { value: "" }, cur ? "解绑…" : "(未绑定)"),
|
|
3145
|
+
!groups.length ? h("option", { value: "__none", disabled: true }, "(暂无可绑定都管)") : null,
|
|
3146
|
+
groups.map((g) => h("optgroup", { key: g.tree.id, label: g.tree.name },
|
|
3147
|
+
g.leaders.map((n) => h("option", { key: n.id, value: n.id },
|
|
3148
|
+
n.name + " · " + n.status + (n.membersCount ? " · " + n.membersCount + "成员" : ""))))),
|
|
3149
|
+
p.leaderStale && cur ? h("option", { value: cur, disabled: true }, "⚠️ 悬挂绑定(id 已失效)") : null];
|
|
3150
|
+
if (mini) {
|
|
3151
|
+
return h("span", { className: "bf-meta", "data-bf-leadminictl": p.id,
|
|
3152
|
+
style: { display: "flex", alignItems: "center", gap: 5, minWidth: 0, flexWrap: "wrap" } },
|
|
3153
|
+
h("select", { className: "bf-model-sel", "data-bf-leadmini": p.id, "data-bf-projectid": p.id,
|
|
3154
|
+
value: cur ?? "", disabled: busy, "aria-label": "项目都管(行内直改)",
|
|
3155
|
+
title: "行内直改:选择即绑定/换绑;选「解绑…」清空绑定。等同 bufeng_project update leaderNodeId;点击下拉不会打开行详情",
|
|
3156
|
+
style: { maxWidth: 168 },
|
|
3157
|
+
onClick: (e) => { if (e && e.stopPropagation) e.stopPropagation(); },
|
|
3158
|
+
onChange: (e) => { if (e && e.stopPropagation) e.stopPropagation(); onPick(e.target.value); } },
|
|
3159
|
+
options),
|
|
3160
|
+
okMsg ? h("span", { "data-bf-leadok": p.id, style: { color: "var(--dsw-alias-state-success-primary, #2f9e44)", whiteSpace: "nowrap" } }, "✓ " + okMsg) : null,
|
|
3161
|
+
err ? h("span", { "data-bf-leaderr": p.id, style: { color: "var(--dsw-alias-state-error-label, #e5484d)", whiteSpace: "nowrap" }, title: err }, "✕ " + err) : null);
|
|
3162
|
+
}
|
|
3163
|
+
return h("div", { className: "bf-meta", "data-bf-leaderctl": p.id,
|
|
3164
|
+
style: { marginTop: 3, display: "flex", alignItems: "center", gap: 7, flexWrap: "wrap" } },
|
|
3165
|
+
h("span", null, "都管:", h("span", { title: "当前绑定(账本为准,SSE 刷新校准)" }, curLabel)),
|
|
3166
|
+
h("select", { className: "bf-model-sel", "data-bf-leadersel": "1", "data-bf-projectid": p.id,
|
|
3167
|
+
value: cur ?? "", disabled: busy, "aria-label": "项目都管",
|
|
3168
|
+
title: "下拉选择即绑定/换绑;选「解绑…」清空绑定。等同 bufeng_project update leaderNodeId=<id|null>;绑定后派单按绑定都管路由",
|
|
3169
|
+
onChange: (e) => onPick(e.target.value) },
|
|
3170
|
+
options),
|
|
3171
|
+
okMsg ? h("span", { style: { color: "var(--dsw-alias-state-success-primary, #2f9e44)" } }, "✓ " + okMsg) : null,
|
|
3172
|
+
err ? h("span", { style: { color: "var(--dsw-alias-state-error-label, #e5484d)" }, title: err }, "✕ " + err) : null);
|
|
3173
|
+
}
|
|
3174
|
+
|
|
3175
|
+
/* ---------- 项目卡:统计 / 分布 / 最近任务 / 参与智能体(v0.42.0 起由详情区复用) ---------- */
|
|
3176
|
+
function ProjectCard({ p, tasks, snap }) {
|
|
3177
|
+
const mine = (tasks || []).filter((k) => k.projectId === p.id);
|
|
3178
|
+
const st = p.tasksByStatus || countTasks(mine);
|
|
3179
|
+
const total = p.taskCount !== undefined ? p.taskCount : mine.length;
|
|
3180
|
+
const recent = mine.slice(0, 3);
|
|
3181
|
+
|
|
3182
|
+
const leaderBadge = leaderBadgeOf(p); // v0.41.0 都管三态(旧快照三键皆 undefined=不渲染,防误报)
|
|
3183
|
+
const leader = p.leader || null;
|
|
3184
|
+
|
|
3185
|
+
// 参与智能体:任务窗口里出现过的节点;同树全量节点用于计数
|
|
3186
|
+
const allNodes = [];
|
|
3187
|
+
for (const t of (snap && snap.trees) || []) for (const n of t.nodes || []) allNodes.push({ ...n, treeId: t.id, treeName: t.name });
|
|
3188
|
+
const byId = {}; for (const n of allNodes) byId[n.id] = n;
|
|
3189
|
+
const nodeIds = Array.from(new Set(mine.map((k) => k.nodeId).filter(Boolean)));
|
|
3190
|
+
const participants = nodeIds.map((id) => byId[id]).filter(Boolean);
|
|
3191
|
+
const boundLeaderNode = leader ? byId[leader.nodeId] : null;
|
|
3192
|
+
const treeId = boundLeaderNode ? boundLeaderNode.treeId : (leader && leader.treeId) || null;
|
|
3193
|
+
const treeNodes = treeId ? allNodes.filter((n) => n.treeId === treeId) : [];
|
|
3194
|
+
const treeRunning = treeNodes.filter((n) => n.status === "running").length;
|
|
3195
|
+
|
|
3196
|
+
const seg = (key, label) => st[key] ? h("i", { key, title: label + " " + st[key],
|
|
3197
|
+
style: { display: "block", height: "100%", width: pct(st[key], total) + "%", background: COLORS[key] } }) : null;
|
|
3198
|
+
const stat = (key, label) => h("div", { style: { background: "rgba(128,128,128,0.06)", border: "1px solid rgba(128,128,128,0.18)", borderRadius: 8, padding: "8px 10px" } },
|
|
3199
|
+
h("div", { style: { font: "700 22px/1.15 sans-serif", color: COLORS[key] } }, String(st[key] || 0)),
|
|
3200
|
+
h("div", { className: "bf-meta", style: { marginTop: 2 } }, label));
|
|
3201
|
+
|
|
3202
|
+
return h("div", { className: "bf-card", "data-bf-projectcard": p.id,
|
|
3203
|
+
style: { width: "100%", padding: 0, boxSizing: "border-box",
|
|
3204
|
+
border: p.missing ? "1px solid var(--dsw-alias-state-error-primary, #e5484d)" : undefined } },
|
|
3205
|
+
h("div", { style: { padding: "14px 16px 12px", display: "flex", flexDirection: "column", gap: 10 } },
|
|
3206
|
+
h("div", { style: { display: "flex", alignItems: "flex-start", gap: 10 } },
|
|
3207
|
+
h("div", { style: { width: 40, height: 40, flex: "none", borderRadius: 9, display: "flex", alignItems: "center", justifyContent: "center",
|
|
3208
|
+
background: "rgba(79,124,240,0.14)", border: "1px solid rgba(79,124,240,0.32)", fontSize: 19 } }, "📁"),
|
|
3209
|
+
h("div", { style: { minWidth: 0, flex: 1 } },
|
|
3210
|
+
h("div", { style: { display: "flex", alignItems: "center", gap: 7, flexWrap: "wrap" } },
|
|
3211
|
+
h("span", { style: { font: "650 20px/1.3 sans-serif", color: "var(--dsw-alias-label-primary, #eee)" } }, p.name),
|
|
3212
|
+
leaderBadge,
|
|
3213
|
+
p.missing ? h("span", { style: { color: "#e5484d", fontSize: 11 } }, "⚠️ 目录缺失") : null),
|
|
3214
|
+
p.desc ? h("div", { className: "bf-meta", style: { marginTop: 3, whiteSpace: "normal", lineHeight: 1.6 } }, p.desc) : null)),
|
|
3215
|
+
h("div", { className: "bf-meta", style: { fontFamily: "var(--ds-font-family-code, monospace)", padding: "5px 8px",
|
|
3216
|
+
border: "1px solid rgba(128,128,128,0.18)", borderRadius: 6, background: "rgba(0,0,0,0.12)" }, title: p.path }, "⌂ " + p.path),
|
|
3217
|
+
h("div", { style: { border: "1px dashed rgba(128,128,128,0.28)", borderRadius: 7, padding: "7px 9px", fontSize: 11, lineHeight: 1.65, color: "#98a6bb" } },
|
|
3218
|
+
h("b", { style: { color: "#c4d2e8" } }, "项目上下文"), " 项目名 / 描述 / 路径 + 目录纪律(projectNote),只随绑定 projectId 的本次任务注入;不属于智能体自身提示词。"),
|
|
3219
|
+
h(LeaderCtl, { p, snap }),
|
|
3220
|
+
h("div", { style: { display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: 8 } },
|
|
3221
|
+
stat("running", "运行中"), stat("done", "已完成"), stat("failed", "失败"), stat("cancelled", "已取消")),
|
|
3222
|
+
h("div", null,
|
|
3223
|
+
h("div", { style: { display: "flex", alignItems: "center", gap: 8 } },
|
|
3224
|
+
h("span", { className: "bf-meta" }, "任务分布"),
|
|
3225
|
+
h("span", { style: { flex: 1 } }),
|
|
3226
|
+
h("span", { className: "bf-meta" }, "共 " + total + " 条")),
|
|
3227
|
+
h("div", { style: { display: "flex", height: 6, marginTop: 5, borderRadius: 99, overflow: "hidden", background: "rgba(128,128,128,0.14)" } },
|
|
3228
|
+
seg("done", "完成"), seg("failed", "失败"), seg("running", "运行中"), seg("queued", "排队"), seg("cancelled", "取消")),
|
|
3229
|
+
h("div", { className: "bf-meta", style: { marginTop: 5, display: "flex", gap: 12, flexWrap: "wrap" } },
|
|
3230
|
+
h("span", null, "● 完成 " + (st.done || 0)), h("span", null, "● 失败 " + (st.failed || 0)),
|
|
3231
|
+
h("span", null, "● 运行 " + (st.running || 0)), h("span", null, "● 取消 " + (st.cancelled || 0)))),
|
|
3232
|
+
h("div", { style: { borderTop: "1px solid rgba(128,128,128,0.14)", paddingTop: 8 } },
|
|
3233
|
+
h("div", { className: "bf-meta", style: { marginBottom: 3 } }, "最近任务"),
|
|
3234
|
+
recent.length ? recent.map((k) => h("div", { key: k.id, style: { display: "flex", alignItems: "center", gap: 6, minWidth: 0, padding: "2px 0" } },
|
|
3235
|
+
h(TaskDot, { s: k.status }),
|
|
3236
|
+
h("span", { className: "bf-tb-title", style: { flex: 1, minWidth: 0 }, title: k.title }, k.title || k.id),
|
|
3237
|
+
h(TaskStateWord, { s: k.status }),
|
|
3238
|
+
h("span", { className: "bf-meta", style: { flex: "none" } }, fmtTime(k.createdAt)))) : h("div", { className: "bf-meta" }, "窗口内无记录")),
|
|
3239
|
+
h("div", { style: { borderTop: "1px solid rgba(128,128,128,0.14)", paddingTop: 8 } },
|
|
3240
|
+
h("div", { className: "bf-meta", style: { marginBottom: 4 } }, "参与智能体"),
|
|
3241
|
+
participants.length ? participants.map((n) => h("span", { key: n.id, className: "bf-badge", style: { marginRight: 5, marginBottom: 4, display: "inline-flex" } },
|
|
3242
|
+
h(TaskDot, { s: n.status }), h("span", { style: { marginLeft: 4 } }, n.name))) : h("span", { className: "bf-meta" }, "窗口内无任务")),
|
|
3243
|
+
h("div", { className: "bf-meta", style: { borderTop: "1px dashed rgba(128,128,128,0.22)", paddingTop: 7, lineHeight: 1.65 } },
|
|
3244
|
+
"项目页不复制编制:角色 / 系统在「智能体概览」,任务 / 项目装配在「任务详情」;项目只提供目录、任务与绑定。")));
|
|
3245
|
+
}
|
|
3246
|
+
|
|
3247
|
+
/* ---------- v0.42.0 方案 B:工具条(搜索/chips/排序)+ 列表(前 12 展开)+ 详情 ---------- */
|
|
3248
|
+
const PAGE = 12;
|
|
3249
|
+
const ROW_GRID = "minmax(170px,1.25fr) 148px minmax(90px,0.9fr) 200px 100px minmax(90px,0.8fr)";
|
|
3250
|
+
const CHIPS = [
|
|
3251
|
+
["all", "全部"],
|
|
3252
|
+
["running", "● 运行中"],
|
|
3253
|
+
["failed", "● 有失败"],
|
|
3254
|
+
["unbound", "都管未绑定"],
|
|
3255
|
+
["stale", "⚠️ 悬挂"],
|
|
3256
|
+
["missing", "⚠️ 目录缺失"],
|
|
3257
|
+
];
|
|
3258
|
+
const SORTS = [
|
|
3259
|
+
["active", "最近活跃 ↓"],
|
|
3260
|
+
["name", "名称 A→Z"],
|
|
3261
|
+
["failed", "失败数 ↓"],
|
|
3262
|
+
["total", "总任务 ↓"],
|
|
3263
|
+
];
|
|
3264
|
+
const stOf = (p) => p.tasksByStatus || {};
|
|
3265
|
+
|
|
3266
|
+
function chipHit(kind, p) {
|
|
3267
|
+
if (kind === "running") return (stOf(p).running || 0) > 0;
|
|
3268
|
+
if (kind === "failed") return (stOf(p).failed || 0) > 0;
|
|
3269
|
+
if (kind === "unbound") return leaderKnownOf(p) && !p.leaderNodeId && !p.leader && !p.leaderStale;
|
|
3270
|
+
if (kind === "stale") return !!p.leaderStale;
|
|
3271
|
+
if (kind === "missing") return !!p.missing;
|
|
3272
|
+
return true;
|
|
3273
|
+
}
|
|
3274
|
+
|
|
3275
|
+
function sortCmp(kind) {
|
|
3276
|
+
// 排序字段一律快照真实投影(lastTaskAt/name/tasksByStatus/taskCount);lastTaskAt 缺省排末尾
|
|
3277
|
+
if (kind === "name") return (a, b) => String(a.name || "").localeCompare(String(b.name || ""), "zh");
|
|
3278
|
+
if (kind === "failed") return (a, b) => ((stOf(b).failed || 0) - (stOf(a).failed || 0));
|
|
3279
|
+
if (kind === "total") return (a, b) => ((b.taskCount || 0) - (a.taskCount || 0));
|
|
3280
|
+
return (a, b) => { // active:最近活跃 ↓(默认)
|
|
3281
|
+
const av = a.lastTaskAt ? String(a.lastTaskAt) : null;
|
|
3282
|
+
const bv = b.lastTaskAt ? String(b.lastTaskAt) : null;
|
|
3283
|
+
if (!av && !bv) return 0;
|
|
3284
|
+
if (!bv) return -1;
|
|
3285
|
+
if (!av) return 1;
|
|
3286
|
+
return bv.localeCompare(av);
|
|
3287
|
+
};
|
|
3288
|
+
}
|
|
3289
|
+
|
|
3290
|
+
function filteredProjects(projects, q, chip, sort) {
|
|
3291
|
+
let list = projects.slice();
|
|
3292
|
+
const term = String(q || "").trim().toLowerCase();
|
|
3293
|
+
if (term) list = list.filter((p) => (String(p.name || "") + "\n" + String(p.desc || "") + "\n" + String(p.path || "")).toLowerCase().indexOf(term) >= 0);
|
|
3294
|
+
if (chip && chip !== "all") list = list.filter((p) => chipHit(chip, p));
|
|
3295
|
+
list.sort(sortCmp(sort));
|
|
3296
|
+
return list;
|
|
3297
|
+
}
|
|
3298
|
+
|
|
3299
|
+
function ProjectListHead() {
|
|
3300
|
+
return h("div", { "data-bf-phead": "1",
|
|
3301
|
+
style: { display: "grid", gridTemplateColumns: ROW_GRID, gap: 12, alignItems: "center", padding: "8px 14px",
|
|
3302
|
+
position: "sticky", top: 0, zIndex: 2, background: "rgba(128,128,128,0.06)",
|
|
3303
|
+
borderBottom: "1px solid rgba(128,128,128,0.18)" } },
|
|
3304
|
+
h("span", { className: "bf-meta" }, "项目"),
|
|
3305
|
+
h("span", { className: "bf-meta" }, "任务(跑/成/败/消)"),
|
|
3306
|
+
h("span", { className: "bf-meta" }, "分布"),
|
|
3307
|
+
h("span", { className: "bf-meta" }, "都管(行内直改)"),
|
|
3308
|
+
h("span", { className: "bf-meta", style: { textAlign: "right" } }, "活跃"),
|
|
3309
|
+
h("span", { className: "bf-meta" }, "路径"));
|
|
3310
|
+
}
|
|
3311
|
+
|
|
3312
|
+
function ProjectRow({ p, snap, selected, first, onPick }) {
|
|
3313
|
+
const st = stOf(p);
|
|
3314
|
+
const total = p.taskCount || 0;
|
|
3315
|
+
const seg = (key) => st[key] ? h("i", { key, title: key + " " + st[key],
|
|
3316
|
+
style: { display: "block", height: "100%", width: pct(st[key], total) + "%", background: COLORS[key] } }) : null;
|
|
3317
|
+
const num = (n, label, color) => h("span", { style: { whiteSpace: "nowrap" } },
|
|
3318
|
+
h("b", { style: { color, fontSize: 12.5 } }, String(n || 0)),
|
|
3319
|
+
h("span", { className: "bf-meta", style: { fontSize: 10.5 } }, label));
|
|
3320
|
+
const rowProps = { key: p.id, "data-bf-prow": p.id, onClick: onPick,
|
|
3321
|
+
style: { display: "grid", gridTemplateColumns: ROW_GRID, gap: 12, alignItems: "center", padding: "8px 14px",
|
|
3322
|
+
borderTop: first ? undefined : "1px solid rgba(128,128,128,0.10)", cursor: "pointer",
|
|
3323
|
+
background: selected ? "rgba(79,124,240,0.10)" : undefined,
|
|
3324
|
+
boxShadow: selected ? "inset 3px 0 0 #4f7cf0" : undefined } };
|
|
3325
|
+
if (selected) rowProps["data-bf-prowsel"] = p.id; // 选中行高亮锚(仅选中行渲染,供测试/无障碍识别)
|
|
3326
|
+
return h("div", rowProps,
|
|
3327
|
+
h("div", { style: { display: "flex", alignItems: "center", gap: 6, minWidth: 0, flexWrap: "wrap" } },
|
|
3328
|
+
h("span", null, "📁"),
|
|
3329
|
+
h("span", { "data-bf-pname": p.id, title: p.name,
|
|
3330
|
+
style: { fontWeight: 650, fontSize: 13, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", maxWidth: "100%" } }, p.name),
|
|
3331
|
+
leaderBadgeOf(p),
|
|
3332
|
+
covBadgeOf(p), // v0.43.0 阶段2A:编制覆盖徽标(旧快照无键不渲染,同 leaderBadgeOf 防御口径)
|
|
3333
|
+
covGapLineOf(p), // 缺口环节名直显(换行小字,行点击语义不变)
|
|
3334
|
+
p.missing ? h("span", { style: { color: "#e5484d", fontSize: 11 } }, "⚠️ 缺目录") : null),
|
|
3335
|
+
h("div", { "data-bf-pnums": p.id, title: "任务四数:运行/完成/失败/取消", style: { display: "flex", alignItems: "baseline", gap: 5 } },
|
|
3336
|
+
num(st.running || 0, "跑", COLORS.running), num(st.done || 0, "成", COLORS.done),
|
|
3337
|
+
num(st.failed || 0, "败", COLORS.failed), num(st.cancelled || 0, "消", COLORS.cancelled)),
|
|
3338
|
+
h("div", { "data-bf-pbar": p.id, style: { display: "flex", height: 6, borderRadius: 99, overflow: "hidden", background: "rgba(128,128,128,0.14)" } },
|
|
3339
|
+
seg("done"), seg("failed"), seg("running"), seg("queued"), seg("cancelled")),
|
|
3340
|
+
h("div", { style: { minWidth: 0 } }, h(LeaderCtl, { p, snap, mini: true })),
|
|
3341
|
+
h("div", { style: { textAlign: "right", fontSize: 11, lineHeight: 1.5 } },
|
|
3342
|
+
h("div", null, "最近 " + (p.lastTaskAt ? fmtTime(p.lastTaskAt) : "—")),
|
|
3343
|
+
h("div", { className: "bf-meta" }, "共 " + total + " 条")),
|
|
3344
|
+
h("div", { "data-bf-ppath": p.id, title: p.path,
|
|
3345
|
+
style: { fontFamily: "var(--ds-font-family-code, monospace)", fontSize: 10.5, whiteSpace: "nowrap",
|
|
3346
|
+
overflow: "hidden", textOverflow: "ellipsis", direction: "rtl", textAlign: "left" } }, p.path));
|
|
3347
|
+
}
|
|
3348
|
+
|
|
3349
|
+
/* ---------- 详情:复用项目卡(完整都管下拉)+ 任务流卡 + 右侧三小卡 ---------- */
|
|
3350
|
+
function ProjectDetail({ p, snap, projCount }) {
|
|
3351
|
+
const leader = p.leader || null;
|
|
3352
|
+
const st = p.tasksByStatus || {};
|
|
3353
|
+
const total = p.taskCount || 0;
|
|
3354
|
+
const allNodes = [];
|
|
3355
|
+
for (const t of snap.trees || []) for (const n of t.nodes || []) allNodes.push({ ...n, treeId: t.id });
|
|
3356
|
+
const nameById = {}; for (const n of allNodes) nameById[n.id] = n.name;
|
|
3357
|
+
const treeId = leader ? leader.treeId : null;
|
|
3358
|
+
const treeNodes = treeId ? allNodes.filter((n) => n.treeId === treeId) : [];
|
|
3359
|
+
const flow = (snap.tasks || []).filter((k) => k.projectId === p.id).slice(0, 6);
|
|
3360
|
+
return h("div", { "data-bf-pdetail": "1", style: { display: "grid", gridTemplateColumns: "minmax(0,1fr) 300px", gap: 10, alignItems: "start" } },
|
|
3361
|
+
h("div", null,
|
|
3362
|
+
h(ProjectCard, { p, tasks: snap.tasks, snap }),
|
|
3363
|
+
h("div", { className: "bf-card", style: { marginTop: 10, padding: "10px 12px" } },
|
|
3364
|
+
h("div", { className: "bf-meta", style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 4 } },
|
|
3365
|
+
h("b", { style: { color: "var(--dsw-alias-label-primary, #eee)" } }, "项目任务流"),
|
|
3366
|
+
h("span", null, "最近 6 条 · 点击任务看链路"),
|
|
3367
|
+
h("span", { style: { flex: 1 } }),
|
|
3368
|
+
h("span", null, "共 " + total + " 条")),
|
|
3369
|
+
flow.length ? flow.map((k) => h("div", { key: k.id, style: { display: "flex", alignItems: "center", gap: 7, padding: "4px 0", borderTop: "1px solid rgba(128,128,128,0.10)" } },
|
|
3370
|
+
h(TaskDot, { s: k.status }),
|
|
3371
|
+
h("span", { className: "bf-tb-title", style: { flex: 1, minWidth: 0, fontWeight: 400 }, title: k.title }, k.title || k.id),
|
|
3372
|
+
h("span", { className: "bf-meta", style: { width: 100, flex: "none", textAlign: "right" } }, (k.nodeId && nameById[k.nodeId]) || k.nodeId || "—"),
|
|
3373
|
+
h("span", { className: "bf-meta", style: { width: 78, flex: "none", textAlign: "right" } }, fmtTime(k.createdAt)),
|
|
3374
|
+
h(TaskStateWord, { s: k.status }))) : h("div", { className: "bf-meta" }, "窗口内无任务"))),
|
|
3375
|
+
h("div", { style: { display: "flex", flexDirection: "column", gap: 8 } },
|
|
3376
|
+
h("div", { className: "bf-card", style: { padding: "9px 11px" } },
|
|
3377
|
+
h("div", { className: "bf-meta", style: { marginBottom: 4 } }, "项目根"),
|
|
3378
|
+
h("div", { className: "bf-meta", style: { fontFamily: "var(--ds-font-family-code, monospace)", wordBreak: "break-all", whiteSpace: "normal", lineHeight: 1.6 } }, DATA_ROOT(snap)),
|
|
3379
|
+
h("div", { className: "bf-meta", style: { marginTop: 3 } }, "默认工作区 " + (snap.defaultWorkspace || "—")),
|
|
3380
|
+
h("div", { className: "bf-meta", style: { marginTop: 3 } }, "状态 " + (p.missing ? "⚠️ 目录缺失" : "目录正常 · 可派单"))),
|
|
3381
|
+
h("div", { className: "bf-card", style: { padding: "9px 11px" } },
|
|
3382
|
+
h("div", { className: "bf-meta", style: { marginBottom: 4 } }, "项目 × 编制"),
|
|
3383
|
+
h("div", { className: "bf-meta" }, "项目数 " + projCount),
|
|
3384
|
+
h("div", { className: "bf-meta" }, "绑定都管 " + (leader ? leader.name : (p.leaderStale ? "⚠️ 悬挂" : "未绑定"))),
|
|
3385
|
+
h("div", { className: "bf-meta" }, "编制 " + (treeNodes.length ? treeNodes.length + " · " + treeNodes.filter((n) => n.status === "running").length + " 在岗" : "—")),
|
|
3386
|
+
h("div", { className: "bf-meta", style: { marginTop: 5, lineHeight: 1.65 } }, "项目只负责目录/任务/绑定;能力面与角色提示词在概览。")),
|
|
3387
|
+
h("div", { className: "bf-card", style: { padding: "9px 11px" } },
|
|
3388
|
+
h("div", { className: "bf-meta", style: { marginBottom: 4 } }, "项目健康"),
|
|
3389
|
+
h("div", { className: "bf-meta" }, "失败任务 " + (st.failed || 0)),
|
|
3390
|
+
h("div", { className: "bf-meta" }, "最近运行 " + (p.lastTaskAt ? fmtTime(p.lastTaskAt) : "—")),
|
|
3391
|
+
h("div", { className: "bf-meta" }, "目录缺失 " + (p.missing ? "是" : "无")))));
|
|
3392
|
+
}
|
|
3393
|
+
|
|
3394
|
+
/* ---------- 项目页(v0.42.0 方案 B:工具条+列表+详情)---------- */
|
|
3395
|
+
function ProjectsPane({ snap }) {
|
|
3396
|
+
const projects = snap.projects || [];
|
|
3397
|
+
const [q, setQ] = useState(""); // 搜索词(项目名/描述/路径)
|
|
3398
|
+
const [chip, setChip] = useState("all"); // 治理过滤 chip
|
|
3399
|
+
const [sort, setSort] = useState("active"); // 排序
|
|
3400
|
+
const [expand, setExpand] = useState(false); // 列表展开全部(默认前 12)
|
|
3401
|
+
const [sel, setSel] = useState(null); // 选中行(详情项目 id)
|
|
3402
|
+
const root = snap.projectsRoot || "";
|
|
3403
|
+
const note = snap.projectsRootDefaultNote;
|
|
3404
|
+
const rootLabel = (note !== undefined && note !== "")
|
|
3405
|
+
? note.replace(/^未改配[::]/, "未改配,")
|
|
3406
|
+
: (root || (note === "" ? "(已改配:项目根未取到,见 bufeng_config)" : "(未取到;发现失败回退 ~/.dsh/bufeng/projects)"));
|
|
3407
|
+
|
|
3408
|
+
if (!projects.length) {
|
|
3409
|
+
return h("div", { className: "bf-card", style: { width: "100%", padding: "10px 12px", boxSizing: "border-box", ...DIM } },
|
|
3410
|
+
"暂无项目 —— 项目=业务目录+说明,与智能体编制分离。让总管识别业务后代建(bufeng_project create),",
|
|
3411
|
+
h("br"), "或在会话里直接创建;项目根:", h("span", { style: { fontFamily: "var(--ds-font-family-code, monospace)" } }, rootLabel),
|
|
3412
|
+
",可用 bufeng_config projectsRoot 更换。");
|
|
3413
|
+
}
|
|
3414
|
+
|
|
3415
|
+
// 列表状态(搜索词/chip/排序/展开/选中行)存组件 state——SSE 全帧刷新(重渲染)不重置
|
|
3416
|
+
const filtered = filteredProjects(projects, q, chip, sort);
|
|
3417
|
+
const shown = expand ? filtered : filtered.slice(0, PAGE);
|
|
3418
|
+
const selP = sel ? projects.find((p) => p.id === sel) : null;
|
|
3419
|
+
const hasLeader = projects.some((p) => leaderKnownOf(p)); // 旧快照无都管三键:两枚都管 chip 不出(无键可算,防误报)
|
|
3420
|
+
const chips = hasLeader ? CHIPS : CHIPS.filter(([k]) => k !== "unbound" && k !== "stale");
|
|
3421
|
+
const nOf = (k) => projects.filter((p) => chipHit(k, p)).length;
|
|
3422
|
+
|
|
3423
|
+
return h("div", { style: { display: "flex", flexDirection: "column", gap: 10, width: "100%" } },
|
|
3424
|
+
h("div", { className: "bf-meta", style: { padding: "0 2px" } },
|
|
3425
|
+
"项目根:", h("span", { style: { fontFamily: "var(--ds-font-family-code, monospace)" }, title: "bufeng_config projectsRoot=<绝对路径> 可更换(改后新建项目落新根)" }, rootLabel),
|
|
3426
|
+
" · 共 " + projects.length + " 个项目"),
|
|
3427
|
+
/* ① 工具条:搜索 + 治理过滤 chips(实时计数)+ 排序 */
|
|
3428
|
+
h("div", { className: "bf-card", "data-bf-ptoolbar": "1",
|
|
3429
|
+
style: { display: "flex", gap: 8, alignItems: "center", flexWrap: "wrap", padding: "9px 12px", width: "100%", boxSizing: "border-box" } },
|
|
3430
|
+
h("input", { type: "text", "data-bf-psearch": "1", placeholder: "🔍 搜项目名 / 描述 / 路径…", value: q,
|
|
3431
|
+
title: "按项目名 / 描述 / 路径模糊过滤",
|
|
3432
|
+
style: { flex: "1 1 200px", minWidth: 170, background: "rgba(0,0,0,0.16)", border: "1px solid " + LINE, color: "inherit",
|
|
3433
|
+
borderRadius: 8, padding: "6px 10px", font: "inherit", boxSizing: "border-box" },
|
|
3434
|
+
onChange: (e) => { setQ(e.target.value); setExpand(false); } }),
|
|
3435
|
+
h("div", { style: { display: "flex", gap: 5, flexWrap: "wrap" } },
|
|
3436
|
+
chips.map(([k, label]) => h("button", { key: k, "data-bf-pchip": k,
|
|
3437
|
+
onClick: () => { setChip(k); setExpand(false); },
|
|
3438
|
+
title: "过滤:" + label,
|
|
3439
|
+
style: { appearance: "none", cursor: "pointer", font: "600 11.5px/1 sans-serif", borderRadius: 99, padding: "5px 11px",
|
|
3440
|
+
color: chip === k ? "#bcd0ff" : "#98a6bb",
|
|
3441
|
+
border: "1px solid " + (chip === k ? "rgba(79,124,240,0.5)" : "rgba(128,128,128,0.25)"),
|
|
3442
|
+
background: chip === k ? "rgba(79,124,240,0.12)" : "transparent" } },
|
|
3443
|
+
label + " " + nOf(k)))),
|
|
3444
|
+
h("select", { className: "bf-model-sel", "data-bf-psort": "1", value: sort, "aria-label": "排序",
|
|
3445
|
+
title: "排序:最近活跃↓(默认,最近有任务的项目置顶;无记录排末尾)/ 名称 A→Z / 失败数↓ / 总任务↓", style: { maxWidth: 130 },
|
|
3446
|
+
onChange: (e) => setSort(e.target.value) },
|
|
3447
|
+
SORTS.map(([k, label]) => h("option", { key: k, value: k }, label)))),
|
|
3448
|
+
/* ② 列表:吸附表头 + 六列行 + 默认前 12 / 展开全部 */
|
|
3449
|
+
h("div", { className: "bf-card", "data-bf-plist": "1", style: { overflow: "hidden", width: "100%", boxSizing: "border-box" } },
|
|
3450
|
+
h(ProjectListHead),
|
|
3451
|
+
shown.length ? shown.map((p, i) => h(ProjectRow, { p, snap, selected: sel === p.id, first: i === 0,
|
|
3452
|
+
onPick: () => setSel(p.id) }))
|
|
3453
|
+
: h("div", { "data-bf-pempty": "1", className: "bf-meta", style: { padding: "18px 14px", textAlign: "center" } },
|
|
3454
|
+
"没有符合条件的项目 —— 换个搜索词或过滤 chip 试试"),
|
|
3455
|
+
filtered.length > PAGE ? h("button", { "data-bf-pexpand": "1",
|
|
3456
|
+
onClick: () => setExpand(!expand),
|
|
3457
|
+
title: expand ? "收起,只显前 " + PAGE + " 个" : "展开全部过滤后项目",
|
|
3458
|
+
style: { width: "100%", appearance: "none", border: "none", borderTop: "1px solid rgba(128,128,128,0.18)",
|
|
3459
|
+
background: "rgba(79,124,240,0.05)", color: "#bcd0ff", font: "600 12px/1 sans-serif", padding: "10px 0", cursor: "pointer" } },
|
|
3460
|
+
expand ? "▲ 收起,只显前 " + PAGE + " 个" : "▼ 展开全部 " + filtered.length + " 个项目(当前显示前 " + PAGE + " 个)") : null),
|
|
3461
|
+
/* ③ 详情:复用项目卡(完整都管下拉)+ 任务流 + 右侧三小卡 */
|
|
3462
|
+
selP ? h("div", { style: { display: "flex", flexDirection: "column", gap: 8 } },
|
|
3463
|
+
h("div", { style: { display: "flex", alignItems: "center", gap: 8 } },
|
|
3464
|
+
h("button", { "data-bf-pcollapse": "1", onClick: () => setSel(null),
|
|
3465
|
+
title: "收起详情回到纯列表",
|
|
3466
|
+
style: { appearance: "none", border: "1px solid rgba(128,128,128,0.25)", background: "transparent", color: "#98a6bb",
|
|
3467
|
+
font: "600 12px/1 sans-serif", padding: "5px 11px", borderRadius: 7, cursor: "pointer" } },
|
|
3468
|
+
"↑ 收起详情"),
|
|
3469
|
+
h("span", { className: "bf-meta" }, "当前详情:", h("b", { style: { color: "var(--dsw-alias-label-primary, #eee)" } }, selP.name))),
|
|
3470
|
+
h(ProjectDetail, { p: selP, snap, projCount: projects.length })) : null);
|
|
3471
|
+
}
|
|
3472
|
+
|
|
3473
|
+
function DATA_ROOT(snap) { return (snap && snap.projectsRoot) || "—"; }
|
|
3474
|
+
return { ProjectsPane };
|
|
3475
|
+
})();
|
|
3476
|
+
/* ============================== src/settings.js ============================== */
|
|
3477
|
+
__mods["settings.js"] = (() => {
|
|
3478
|
+
const { h, useState } = __mods["react.js"];
|
|
3479
|
+
const { LINE, DIM, LABEL } = __mods["ui.js"];
|
|
3480
|
+
const { RoleIconMd } = __mods["icons.js"];
|
|
3481
|
+
/**
|
|
3482
|
+
* client/src/settings.js — ⚙ 设置页(v0.16.5):治理配置分区卡片 + 全字段可编辑。
|
|
3483
|
+
* 分区:🧭 总管身份(autoAdopt 开关)/ ⚖️ 调度与预算(并发闸门/日预算/预警线)/ 📁 项目目录(projectsRoot/defaultWorkspaceDir)。
|
|
3484
|
+
* v0.26.x 第三单 T2(面板工程):defaultWorkspace 卡片从只读展示改真配置输入框(同 projectsRoot 的 EditRow 样式),
|
|
3485
|
+
* 配置字段 gate.defaultWorkspaceDir(子目录名语义,默认 bufeng-ws);快照字段仍用既有 defaultWorkspace(值来自配置带回退)。
|
|
3486
|
+
* 非 ASCII 输入本地即时红字警告(warnOf 插槽,不等服务端往返);服务端 400 校验文案沿用 EditRow err 槽透出。
|
|
3487
|
+
* 编辑交互:字段失焦或回车即保存(POST /bufeng/api/config,与 bufeng_config 工具同校验规则,越界自动钳制);
|
|
3488
|
+
* draft 状态防 SSE 2s 刷新覆盖正在编辑的输入框。快照自带 gate 兜底默认值。
|
|
3489
|
+
*/
|
|
3490
|
+
|
|
3491
|
+
|
|
3492
|
+
|
|
3493
|
+
|
|
3494
|
+
const inputStyle = {
|
|
3495
|
+
background: 'var(--dsw-alias-bg-layer-1, rgba(255,255,255,.04))',
|
|
3496
|
+
border: '1px solid ' + LINE, borderRadius: 6, color: 'inherit',
|
|
3497
|
+
font: 'var(--ds-font-family-code, monospace)', fontSize: 12, padding: '5px 8px', outline: 'none'
|
|
3498
|
+
};
|
|
3499
|
+
|
|
3500
|
+
async function postConfig(patch) {
|
|
3501
|
+
const res = await fetch('/bufeng/api/config', {
|
|
3502
|
+
method: 'POST',
|
|
3503
|
+
headers: { 'content-type': 'application/json' },
|
|
3504
|
+
body: JSON.stringify(patch)
|
|
3505
|
+
});
|
|
3506
|
+
const body = await res.json().catch(() => ({}));
|
|
3507
|
+
if (!res.ok || body.ok === false) throw new Error(body.error || 'HTTP ' + res.status);
|
|
3508
|
+
return body;
|
|
3509
|
+
}
|
|
3510
|
+
|
|
3511
|
+
/* v0.26.x defaultWorkspaceDir 专用:非 ASCII 本地即时警告(宿主对非 ASCII 路径存在会话归组 bug,掉组风险;建议不阻断) */
|
|
3512
|
+
const wsDirWarnOf = (v) => /[^\x00-\x7F]/.test(String(v ?? ''))
|
|
3513
|
+
? '⚠ 含非 ASCII 字符:宿主对非 ASCII 路径存在会话归组 bug(掉组),建议 ASCII'
|
|
3514
|
+
: null;
|
|
3515
|
+
|
|
3516
|
+
/* v0.43.1 阶段1C(k-mvla504o12i):覆盖硬闸三态枚举(与 lib/core.js GATE.coverageGate 合法值一一对应,勿单方变更) */
|
|
3517
|
+
const COV_STATES = [
|
|
3518
|
+
{ id: 'off', label: 'off · 关停' },
|
|
3519
|
+
{ id: 'shadow', label: 'shadow · 影子' },
|
|
3520
|
+
{ id: 'enforce', label: 'enforce · 强制' }
|
|
3521
|
+
];
|
|
3522
|
+
|
|
3523
|
+
/* v0.46.0 面板棒(k-mvnpelij0ha):能力面宣传三态枚举(与 lib/core.js GATE.capabilityPrompt 合法值一一对应,勿单方变更) */
|
|
3524
|
+
const CAP_STATES = [
|
|
3525
|
+
{ id: 'off', label: 'off · 关停' },
|
|
3526
|
+
{ id: 'brief', label: 'brief · 摘要' },
|
|
3527
|
+
{ id: 'full', label: 'full · 全量' }
|
|
3528
|
+
];
|
|
3529
|
+
/* W2-T4(k-mvsc8xhx0qv):派单中转闸三态枚举(与 lib/core.js GATE.relayGate 合法值一一对应,勿单方变更;ADR 字面锚 data-bf-relgate/data-bf-relcur,勿更名) */
|
|
3530
|
+
const REL_STATES = [
|
|
3531
|
+
{ id: 'off', label: 'off · 关停' },
|
|
3532
|
+
{ id: 'shadow', label: 'shadow · 影子' },
|
|
3533
|
+
{ id: 'enforce', label: 'enforce · 强制' }
|
|
3534
|
+
];
|
|
3535
|
+
|
|
3536
|
+
function Toggle({ on, busy, onClick, buttonExtra }) {
|
|
3537
|
+
return h('button', {
|
|
3538
|
+
...buttonExtra, // k-mvi7fdym0jr:额外按钮属性(data-bf-* 锚供 sim 定位,仿 EditRow inputExtra 先例)
|
|
3539
|
+
onClick,
|
|
3540
|
+
disabled: busy,
|
|
3541
|
+
title: on ? '点击关闭' : '点击开启',
|
|
3542
|
+
style: {
|
|
3543
|
+
border: 'none', cursor: busy ? 'wait' : 'pointer', width: 40, height: 22, borderRadius: 11,
|
|
3544
|
+
padding: 0, position: 'relative', transition: 'background .15s', flexShrink: 0,
|
|
3545
|
+
background: on ? 'var(--dsw-alias-state-success-primary, #2f9e44)' : 'var(--dsw-alias-state-idle-primary, #555)'
|
|
3546
|
+
}
|
|
3547
|
+
}, h('span', {
|
|
3548
|
+
style: {
|
|
3549
|
+
position: 'absolute', top: 2, left: on ? 20 : 2, width: 18, height: 18, borderRadius: '50%',
|
|
3550
|
+
background: '#fff', transition: 'left .15s', boxShadow: '0 1px 3px rgba(0,0,0,.4)'
|
|
3551
|
+
}
|
|
3552
|
+
}));
|
|
3553
|
+
}
|
|
3554
|
+
|
|
3555
|
+
/* 分区卡片:图标+标题+副题,突出配置分类(v0.16.5) */
|
|
3556
|
+
function Section({ icon, title, desc, children, id }) {
|
|
3557
|
+
return h('div', { id, style: { border: '1px solid ' + LINE, borderRadius: 10, padding: '14px 16px', marginBottom: 14, background: 'var(--dsw-alias-bg-layer-1, transparent)' } },
|
|
3558
|
+
h('div', { style: { display: 'flex', alignItems: 'baseline', gap: 8, marginBottom: desc ? 2 : 8 } },
|
|
3559
|
+
h('span', { style: { fontSize: 14 } }, icon),
|
|
3560
|
+
h('span', { style: { font: 'var(--dsw-font-xs-strong-13, 600 13px/1.5 sans-serif)', ...LABEL } }, title),
|
|
3561
|
+
desc ? h('span', { style: { ...DIM, fontSize: 11 } }, desc) : null),
|
|
3562
|
+
children);
|
|
3563
|
+
}
|
|
3564
|
+
|
|
3565
|
+
/* v0.24.0 星枢角色图例(设置页落位之一):三角色 24 档展示,与看板卡/任务行同款图标 */
|
|
3566
|
+
function legendItem(kind, uid, name, desc) {
|
|
3567
|
+
return h('div', { style: { display: 'flex', alignItems: 'center', gap: 8 } },
|
|
3568
|
+
h(RoleIconMd, { kind, uid }),
|
|
3569
|
+
h('div', null,
|
|
3570
|
+
h('div', { style: { font: 'var(--dsw-font-xs-strong-13, 600 13px/1.5 sans-serif)', ...LABEL } }, name),
|
|
3571
|
+
h('div', { style: { ...DIM, fontSize: 11 } }, desc)));
|
|
3572
|
+
}
|
|
3573
|
+
|
|
3574
|
+
/* 可编辑配置行:右侧紧凑输入框,失焦/回车保存,Esc 取消。
|
|
3575
|
+
warnOf=(val)=>string|null 本地即时警告(红字,随输入变化,不依赖服务端往返);inputExtra=额外挂到 input 的属性(data-bf-* 锚供 sim 定位);
|
|
3576
|
+
服务端 400 错误文案经 err 槽红字透出(沿用既有展示模式)。 */
|
|
3577
|
+
function EditRow({ label, hint, value, width, onSave, parse, suffix, warnOf, inputExtra }) {
|
|
3578
|
+
const [draft, setDraft] = useState(null); // null=显示快照值;非 null=正在编辑(防 SSE 刷新覆盖)
|
|
3579
|
+
const [busy, setBusy] = useState(false);
|
|
3580
|
+
const [err, setErr] = useState(null);
|
|
3581
|
+
const shown = draft ?? String(value ?? '');
|
|
3582
|
+
const warn = warnOf ? warnOf(shown) : null; // 本地即时警告:随草稿值即时显隐
|
|
3583
|
+
const commit = async () => {
|
|
3584
|
+
if (draft === null || busy) return;
|
|
3585
|
+
const raw = draft.trim();
|
|
3586
|
+
if (raw === String(value ?? '')) { setDraft(null); setErr(null); return; } // 没改
|
|
3587
|
+
setBusy(true); setErr(null);
|
|
3588
|
+
try {
|
|
3589
|
+
await onSave(parse ? parse(raw) : raw);
|
|
3590
|
+
setDraft(null);
|
|
3591
|
+
} catch (e) {
|
|
3592
|
+
setErr(e.message);
|
|
3593
|
+
} finally { setBusy(false); }
|
|
3594
|
+
};
|
|
3595
|
+
return h('div', { style: { display: 'flex', alignItems: 'center', gap: 12, padding: '10px 0', borderBottom: '1px solid ' + LINE } },
|
|
3596
|
+
h('div', { style: { flex: 1, minWidth: 0 } },
|
|
3597
|
+
h('div', { style: { font: 'var(--dsw-font-xs-strong-13, 600 13px/1.5 sans-serif)', ...LABEL } }, label),
|
|
3598
|
+
h('div', { style: { ...DIM, fontSize: 11, marginTop: 2 } }, hint)),
|
|
3599
|
+
h('div', { style: { display: 'flex', flexDirection: 'column', alignItems: 'flex-end', gap: 2 } },
|
|
3600
|
+
h('div', { style: { display: 'flex', alignItems: 'center', gap: 4 } },
|
|
3601
|
+
h('input', {
|
|
3602
|
+
...inputExtra,
|
|
3603
|
+
value: shown,
|
|
3604
|
+
disabled: busy,
|
|
3605
|
+
onChange: (e) => setDraft(e.target.value),
|
|
3606
|
+
onBlur: commit,
|
|
3607
|
+
onKeyDown: (e) => { if (e.key === 'Enter') commit(); if (e.key === 'Escape') { setDraft(null); setErr(null); } },
|
|
3608
|
+
style: { ...inputStyle, width: width ?? 110, textAlign: 'right', opacity: busy ? .6 : 1, borderColor: err ? 'var(--dsw-alias-state-error-primary, #e5484d)' : LINE }
|
|
3609
|
+
}),
|
|
3610
|
+
suffix ? h('span', { style: { ...DIM, fontSize: 11, width: 30 } }, suffix) : null),
|
|
3611
|
+
warn ? h('span', { 'data-bf-editwarn': '1', style: { fontSize: 11, color: 'var(--dsw-alias-state-error-label, #e5484d)' } }, warn) : null,
|
|
3612
|
+
err ? h('span', { 'data-bf-editerr': '1', style: { fontSize: 11, color: 'var(--dsw-alias-state-error-label, #e5484d)' } }, err) : null));
|
|
3613
|
+
}
|
|
3614
|
+
|
|
3615
|
+
function SettingsPane({ snap }) {
|
|
3616
|
+
const gate = snap.gate || {};
|
|
3617
|
+
// v0.23.0 项目根 hint:优先快照 projectsRootDefaultNote(有值=未改配,展示 note);空串/字段缺失=当前值+回退语义说明
|
|
3618
|
+
const rootNote = snap.projectsRootDefaultNote;
|
|
3619
|
+
const projectsRootHint = rootNote ? rootNote + ';必须是绝对路径;改后新建项目落新根,已有项目路径不变' : '当前 ' + (gate.projectsRoot ?? '~/.dsh/bufeng/projects') + ';未改配时新建项目落 DSH 工作区根下同名目录(发现失败回退 ~/.dsh/bufeng/projects);必须是绝对路径;改后新建项目落新根,已有项目路径不变';
|
|
3620
|
+
const [busy, setBusy] = useState(false); // autoAdopt 开关 busy
|
|
3621
|
+
const [busyHook, setBusyHook] = useState(false); // identityHook 开关 busy
|
|
3622
|
+
const [busyArch, setBusyArch] = useState(false); // autoArchiveSessions 开关 busy
|
|
3623
|
+
const [busyKeep, setBusyKeep] = useState(false); // k-mvi7fdym0jr:keepDefault 开关 busy(同上)
|
|
3624
|
+
const [setTab, setSetTab] = useState('set-id');
|
|
3625
|
+
// v0.40.7:未知分区 id 自愈回退首分区(防陈旧/异常状态值把左侧导航打成零 active——导航恒有一格在位)
|
|
3626
|
+
const navItems = [
|
|
3627
|
+
{ id: 'set-id', icon: '🧭', label: '总管与入口' },
|
|
3628
|
+
{ id: 'set-sess', icon: '🗂', label: '会话策略' },
|
|
3629
|
+
{ id: 'set-model', icon: '🧠', label: '模型治理' },
|
|
3630
|
+
{ id: 'set-budget', icon: '⚖️', label: '调度与预算' },
|
|
3631
|
+
{ id: 'set-dir', icon: '📁', label: '项目目录' },
|
|
3632
|
+
{ id: 'set-legend', icon: '🧩', label: '角色图例' }
|
|
3633
|
+
];
|
|
3634
|
+
const activeTab = navItems.some((it) => it.id === setTab) ? setTab : navItems[0].id;
|
|
3635
|
+
const jump = (id) => { setSetTab(id); try { document.getElementById(id)?.scrollIntoView({ behavior: 'smooth', block: 'start' }); } catch (e) { /* noop */ } };
|
|
3636
|
+
const [msg, setMsg] = useState(null);
|
|
3637
|
+
const autoAdopt = gate.autoAdopt === true;
|
|
3638
|
+
const identityHook = gate.identityHook !== false; // 默认开
|
|
3639
|
+
const keepDefault = gate.keepDefault !== false; // 同上:默认模型跟随总管(v0.35.0 GATE 键,此前 client 零引用=真缺口)
|
|
3640
|
+
const fmtTokens = (n) => n >= 1e8 ? (n / 1e8) + ' 亿' : n >= 1e4 ? (n / 1e4) + ' 万' : String(n ?? '—');
|
|
3641
|
+
|
|
3642
|
+
const flip = async () => {
|
|
3643
|
+
setBusy(true); setMsg(null);
|
|
3644
|
+
try {
|
|
3645
|
+
const out = await postConfig({ autoAdopt: !autoAdopt });
|
|
3646
|
+
setMsg({ ok: true, text: '已' + (out.changed && out.changed.autoAdopt !== undefined ? (out.changed.autoAdopt ? '开启' : '关闭') : (autoAdopt ? '关闭' : '开启')) + '总管自动入名单' });
|
|
3647
|
+
} catch (e) {
|
|
3648
|
+
setMsg({ ok: false, text: '设置失败:' + e.message });
|
|
3649
|
+
} finally { setBusy(false); }
|
|
3650
|
+
};
|
|
3651
|
+
const flipHook = async () => {
|
|
3652
|
+
setBusyHook(true); setMsg(null);
|
|
3653
|
+
try {
|
|
3654
|
+
const out = await postConfig({ identityHook: !identityHook });
|
|
3655
|
+
setMsg({ ok: true, text: '已' + (out.changed && out.changed.identityHook !== undefined ? (out.changed.identityHook ? '开启' : '关闭') : (identityHook ? '关闭' : '开启')) + '入口注入钩子' });
|
|
3656
|
+
} catch (e) {
|
|
3657
|
+
setMsg({ ok: false, text: '设置失败:' + e.message });
|
|
3658
|
+
} finally { setBusyHook(false); }
|
|
3659
|
+
};
|
|
3660
|
+
const flipArch = async () => {
|
|
3661
|
+
setBusyArch(true); setMsg(null);
|
|
3662
|
+
try {
|
|
3663
|
+
const out = await postConfig({ autoArchiveSessions: gate.autoArchiveSessions !== true });
|
|
3664
|
+
setMsg({ ok: true, text: '已' + (out.changed && out.changed.autoArchiveSessions !== undefined ? (out.changed.autoArchiveSessions ? '开启' : '关闭') : (gate.autoArchiveSessions === true ? '关闭' : '开启')) + '自动归档会话' });
|
|
3665
|
+
} catch (e) {
|
|
3666
|
+
setMsg({ ok: false, text: '设置失败:' + e.message });
|
|
3667
|
+
} finally { setBusyArch(false); }
|
|
3668
|
+
};
|
|
3669
|
+
const flipKeep = async () => {
|
|
3670
|
+
setBusyKeep(true); setMsg(null);
|
|
3671
|
+
try {
|
|
3672
|
+
const out = await postConfig({ keepDefault: !keepDefault });
|
|
3673
|
+
setMsg({ ok: true, text: '已' + (out.changed && out.changed.keepDefault !== undefined ? (out.changed.keepDefault ? '开启' : '关闭') : (keepDefault ? '关闭' : '开启')) + '默认模型跟随总管' });
|
|
3674
|
+
} catch (e) {
|
|
3675
|
+
setMsg({ ok: false, text: '设置失败:' + e.message });
|
|
3676
|
+
} finally { setBusyKeep(false); }
|
|
3677
|
+
};
|
|
3678
|
+
/* v0.43.1 阶段1C(k-mvla504o12i):覆盖硬闸三态卡(coverageGate)——三值选中即提交(POST /bufeng/api/config
|
|
3679
|
+
走 applyGatePatch 同一权威,与 bufeng_config 工具双通道等价);成功回执+失败错误直显(无草稿提交语义,
|
|
3680
|
+
当前值只在快照回显后翻转=失败自动保持现值不漂移)。 */
|
|
3681
|
+
const covGate = ['off', 'shadow', 'enforce'].includes(gate.coverageGate) ? gate.coverageGate : 'shadow'; // 缺省/非法存量值读取侧按 shadow(与 core.js GATE 口径一致)
|
|
3682
|
+
const [busyCov, setBusyCov] = useState(false);
|
|
3683
|
+
const flipCov = async (v) => {
|
|
3684
|
+
setBusyCov(true); setMsg(null);
|
|
3685
|
+
try {
|
|
3686
|
+
const out = await postConfig({ coverageGate: v });
|
|
3687
|
+
setMsg({ ok: true, text: '已设置覆盖硬闸 coverageGate=' + (out.changed && out.changed.coverageGate !== undefined ? out.changed.coverageGate : v) });
|
|
3688
|
+
} catch (e) {
|
|
3689
|
+
setMsg({ ok: false, text: '设置失败:' + e.message });
|
|
3690
|
+
} finally { setBusyCov(false); }
|
|
3691
|
+
};
|
|
3692
|
+
/* v0.46.0 面板棒(k-mvnpelij0ha):能力面宣传三态卡(capabilityPrompt)——coverageGate 三态卡同法:三值选中即提交
|
|
3693
|
+
(POST /bufeng/api/config 走 applyGatePatch 同一权威,与 bufeng_config 工具双通道等价);成功回执+失败错误直显;
|
|
3694
|
+
缺省/非法存量值读取侧按 off 显示(与 lib/core.js GATE 口径一致——off=零注入零 token)。 */
|
|
3695
|
+
const capGate = ['off', 'brief', 'full'].includes(gate.capabilityPrompt) ? gate.capabilityPrompt : 'off';
|
|
3696
|
+
const [busyCap, setBusyCap] = useState(false);
|
|
3697
|
+
const flipCap = async (v) => {
|
|
3698
|
+
setBusyCap(true); setMsg(null);
|
|
3699
|
+
try {
|
|
3700
|
+
const out = await postConfig({ capabilityPrompt: v });
|
|
3701
|
+
setMsg({ ok: true, text: '已设置能力面宣传 capabilityPrompt=' + (out.changed && out.changed.capabilityPrompt !== undefined ? out.changed.capabilityPrompt : v) });
|
|
3702
|
+
} catch (e) {
|
|
3703
|
+
setMsg({ ok: false, text: '设置失败:' + e.message });
|
|
3704
|
+
} finally { setBusyCap(false); }
|
|
3705
|
+
};
|
|
3706
|
+
/* W2-T4(k-mvsc8xhx0qv):派单中转闸三态卡(relayGate)——coverageGate/capabilityPrompt 三态卡同法:三值选中即提交
|
|
3707
|
+
(POST /bufeng/api/config 走 applyGatePatch 同一权威,与 bufeng_config 工具双通道等价);成功回执+失败错误直显
|
|
3708
|
+
(无草稿提交语义,当前值只在快照回显后翻转=失败自动保持现值不漂移);缺省/非法存量值读取侧按 shadow 显示。 */
|
|
3709
|
+
const relayGate = ['off', 'shadow', 'enforce'].includes(gate.relayGate) ? gate.relayGate : 'shadow';
|
|
3710
|
+
const [busyRelay, setBusyRelay] = useState(false);
|
|
3711
|
+
const flipRelay = async (v) => {
|
|
3712
|
+
setBusyRelay(true); setMsg(null);
|
|
3713
|
+
try {
|
|
3714
|
+
const out = await postConfig({ relayGate: v });
|
|
3715
|
+
setMsg({ ok: true, text: '已设置中转闸 relayGate=' + (out.changed && out.changed.relayGate !== undefined ? out.changed.relayGate : v) });
|
|
3716
|
+
} catch (e) {
|
|
3717
|
+
setMsg({ ok: false, text: '设置失败:' + e.message });
|
|
3718
|
+
} finally { setBusyRelay(false); }
|
|
3719
|
+
};
|
|
3720
|
+
const saveField = (key, fmt) => async (v) => {
|
|
3721
|
+
const out = await postConfig({ [key]: v });
|
|
3722
|
+
const applied = out.changed?.[key];
|
|
3723
|
+
setMsg({ ok: true, text: applied === undefined ? '未变化' : '已保存 ' + key + ' = ' + (fmt ? fmt(applied) : applied) });
|
|
3724
|
+
};
|
|
3725
|
+
return h('div', { className: 'bf-set-wrap' },
|
|
3726
|
+
h('aside', { className: 'bf-set-nav' },
|
|
3727
|
+
h('div', { className: 'bf-set-nav-h' }, '⚙ 设置'),
|
|
3728
|
+
navItems.map((it) => h('div', {
|
|
3729
|
+
key: it.id,
|
|
3730
|
+
className: 'bf-set-link' + (activeTab === it.id ? ' bf-on' : ''),
|
|
3731
|
+
onClick: () => jump(it.id)
|
|
3732
|
+
}, h('span', null, it.icon), it.label)),
|
|
3733
|
+
h('div', { className: 'bf-set-nav-note' }, '改动即时生效;只影响后续派单与新会话。')),
|
|
3734
|
+
h('div', { className: 'bf-set-main' },
|
|
3735
|
+
h('div', { style: { ...DIM, fontSize: 12, margin: '2px 0 12px' } },
|
|
3736
|
+
'改动即时生效并留痕事件史(bufeng.config.updated);数字越界自动钳制到合法区间;输入框失焦或回车保存,Esc 取消。'),
|
|
3737
|
+
|
|
3738
|
+
h(Section, { id: 'set-id', icon: '🧭', title: '总管身份', desc: '名单制 · v0.27' },
|
|
3739
|
+
h('div', { style: { display: 'flex', alignItems: 'flex-start', gap: 14 } },
|
|
3740
|
+
h('div', { style: { flex: 1, minWidth: 0 } },
|
|
3741
|
+
h('div', { style: { font: 'var(--dsw-font-xs-strong-13, 600 13px/1.5 sans-serif)', ...LABEL } },
|
|
3742
|
+
'总管自动入名单(autoAdopt)' + (autoAdopt ? ' ✅ 开启中' : '')),
|
|
3743
|
+
h('div', { style: { ...DIM, fontSize: 12, marginTop: 3, lineHeight: 1.6 } },
|
|
3744
|
+
'开启后:新客户会话命中工坊关键词即自动加入总管名单(无需客户逐次确认),与名单内总管同权。' +
|
|
3745
|
+
'关闭后:提示确认后加入——该会话调 bufeng_adopt(confirm:true)经你在对话中确认后入名单。' +
|
|
3746
|
+
'名单制无失位:原会话原地入名单、职责不动——多窗口多位总管同权并存(v0.27 去根化)。')),
|
|
3747
|
+
h(Toggle, { on: autoAdopt, busy, onClick: flip }))),
|
|
3748
|
+
|
|
3749
|
+
h(Section, { id: 'set-hook', icon: '🪝', title: '入口注入', desc: '司南身份觉醒 · v0.18.0' },
|
|
3750
|
+
h('div', { style: { display: 'flex', alignItems: 'flex-start', gap: 14 } },
|
|
3751
|
+
h('div', { style: { flex: 1, minWidth: 0 } },
|
|
3752
|
+
h('div', { style: { font: 'var(--dsw-font-xs-strong-13, 600 13px/1.5 sans-serif)', ...LABEL } },
|
|
3753
|
+
'总管身份提示注入(identityHook)' + (identityHook ? ' ✅ 开启中' : '')),
|
|
3754
|
+
h('div', { style: { ...DIM, fontSize: 12, marginTop: 3, lineHeight: 1.6 } },
|
|
3755
|
+
'开启后:会话消息命中工坊关键词(司南/派单/建树/项目+仓库…)时,自动向该会话注入一条身份提示' +
|
|
3756
|
+
'(总管→钦定身份提示+承接流程;无身份→候选工坊与入名单指引),无需智能体自觉调用 bufeng_whoami。' +
|
|
3757
|
+
'节点会话不受打扰;纯编码会话有关键词门防噪。')),
|
|
3758
|
+
h(Toggle, { on: identityHook, busy: busyHook, onClick: flipHook }))),
|
|
3759
|
+
|
|
3760
|
+
h(Section, { id: 'set-sess', icon: '🗂', title: '会话策略', desc: '任务会话 · v0.20.0' },
|
|
3761
|
+
h('div', { style: { display: 'flex', alignItems: 'flex-start', gap: 14 } },
|
|
3762
|
+
h('div', { style: { flex: 1, minWidth: 0 } },
|
|
3763
|
+
h('div', { style: { font: 'var(--dsw-font-xs-strong-13, 600 13px/1.5 sans-serif)', ...LABEL } },
|
|
3764
|
+
'自动归档任务会话(autoArchiveSessions)' + (gate.autoArchiveSessions === true ? ' ✅ 开启中' : '')),
|
|
3765
|
+
h('div', { style: { ...DIM, fontSize: 12, marginTop: 3, lineHeight: 1.6 } },
|
|
3766
|
+
'任务会话按「【成员名称】【月-日 时:分:秒】任务主题」命名、每任务必新建(避免上下文污染)——这两项是固定行为。' +
|
|
3767
|
+
'本开关控制任务结束后是否自动归档该任务会话(GUI 会话列表不堆积;归档会话可从工作区归档视图找回)。' +
|
|
3768
|
+
'默认关闭:测试验证阶段保留全部会话,便于查看处理过程。')),
|
|
3769
|
+
h(Toggle, { on: gate.autoArchiveSessions === true, busy: busyArch, onClick: flipArch }))),
|
|
3770
|
+
h(Section, { id: 'set-model', icon: '🧠', title: '模型治理', desc: '默认模型跟随总管 · v0.35.0' },
|
|
3771
|
+
h('div', { style: { display: 'flex', alignItems: 'flex-start', gap: 14 } },
|
|
3772
|
+
h('div', { style: { flex: 1, minWidth: 0 } },
|
|
3773
|
+
h('div', { style: { font: 'var(--dsw-font-xs-strong-13, 600 13px/1.5 sans-serif)', ...LABEL } },
|
|
3774
|
+
'默认模型跟随总管(keepDefault)' + (keepDefault ? ' ✅ 开启中' : '')),
|
|
3775
|
+
h('div', { style: { ...DIM, fontSize: 12, marginTop: 3, lineHeight: 1.6 } },
|
|
3776
|
+
'开启后:未配置模型的节点开任务会话时沿用总管会话当前模型(capture→spawn→restore,会话结束自动恢复)。' +
|
|
3777
|
+
'关闭后:回到不跟随现状(未配模型节点=宿主默认模型)。本开关真实写 gate(POST /api/config,与 bufeng_config 工具双通道等价)。')),
|
|
3778
|
+
h(Toggle, { on: keepDefault, busy: busyKeep, onClick: flipKeep, buttonExtra: { 'data-bf-keep': keepDefault ? 'on' : 'off' } }))),
|
|
3779
|
+
|
|
3780
|
+
h(Section, { id: 'set-cov', icon: '🛡', title: '覆盖硬闸(coverageGate)', desc: 'v0.43.1 · 覆盖矩阵守门' },
|
|
3781
|
+
h('div', { style: { display: 'flex', alignItems: 'flex-start', gap: 14 } },
|
|
3782
|
+
h('div', { style: { flex: 1, minWidth: 0 } },
|
|
3783
|
+
h('div', { style: { font: 'var(--dsw-font-xs-strong-13, 600 13px/1.5 sans-serif)', ...LABEL } },
|
|
3784
|
+
'覆盖硬闸三态',
|
|
3785
|
+
h('span', { 'data-bf-covcur': covGate, style: { marginLeft: 8, font: 'var(--ds-font-family-code, monospace)' } }, '当前:' + covGate)),
|
|
3786
|
+
h('div', { style: { ...DIM, fontSize: 12, marginTop: 3, lineHeight: 1.6 } },
|
|
3787
|
+
'off=覆盖判定整段跳过(零事件零告警);shadow=观察期:派单照常+影子告警(出厂默认);enforce=矩阵缺口在派单前拒派。' +
|
|
3788
|
+
'出厂 shadow=影子观察期,切 enforce 建议看观测数据拍板。选中即提交,与 bufeng_config 工具双通道等价(同一 applyGatePatch 权威)。'),
|
|
3789
|
+
snap.coverage ? h('div', { style: { ...DIM, fontSize: 11, marginTop: 6 } },
|
|
3790
|
+
'📊 观测计数:影子告警 ',
|
|
3791
|
+
h('span', { 'data-bf-covshadow': String(snap.coverage.coverageShadow ?? 0), style: { font: 'var(--ds-font-family-code, monospace)', color: 'var(--dsw-alias-state-warning-label, #f5a623)' } }, String(snap.coverage.coverageShadow ?? 0)),
|
|
3792
|
+
' 条 · 拒派 ',
|
|
3793
|
+
h('span', { 'data-bf-covgap': String(snap.coverage.coverageGap ?? 0), style: { font: 'var(--ds-font-family-code, monospace)', color: 'var(--dsw-alias-state-error-label, #e5484d)' } }, String(snap.coverage.coverageGap ?? 0)),
|
|
3794
|
+
' 条(账本事件全量趋势)') : null),
|
|
3795
|
+
h('div', { style: { display: 'flex', flexDirection: 'column', gap: 4, flexShrink: 0 } },
|
|
3796
|
+
COV_STATES.map((st) => h('button', {
|
|
3797
|
+
key: st.id,
|
|
3798
|
+
'data-bf-covgate': st.id,
|
|
3799
|
+
disabled: busyCov,
|
|
3800
|
+
title: '切换覆盖硬闸为 ' + st.id,
|
|
3801
|
+
onClick: () => flipCov(st.id),
|
|
3802
|
+
style: {
|
|
3803
|
+
cursor: busyCov ? 'wait' : 'pointer', fontSize: 11, padding: '4px 10px', borderRadius: 6,
|
|
3804
|
+
font: 'var(--ds-font-family-code, monospace)',
|
|
3805
|
+
border: '1px solid ' + (st.id === covGate ? 'var(--dsw-alias-state-success-primary, #2f9e44)' : LINE),
|
|
3806
|
+
background: st.id === covGate ? 'rgba(47,158,68,.16)' : 'transparent',
|
|
3807
|
+
color: 'inherit', opacity: busyCov ? .6 : 1
|
|
3808
|
+
}
|
|
3809
|
+
}, st.label))))),
|
|
3810
|
+
|
|
3811
|
+
|
|
3812
|
+
h(Section, { id: 'set-relay', icon: '🔁', title: '派单中转闸(relayGate)', desc: 'v0.54.0 · 派单中转链守门' },
|
|
3813
|
+
h('div', { style: { display: 'flex', alignItems: 'flex-start', gap: 14 } },
|
|
3814
|
+
h('div', { style: { flex: 1, minWidth: 0 } },
|
|
3815
|
+
h('div', { style: { font: 'var(--dsw-font-xs-strong-13, 600 13px/1.5 sans-serif)', ...LABEL } },
|
|
3816
|
+
'派单中转闸三态',
|
|
3817
|
+
h('span', { 'data-bf-relcur': relayGate, style: { marginLeft: 8, font: 'var(--ds-font-family-code, monospace)' } }, '当前:' + relayGate)),
|
|
3818
|
+
h('div', { style: { ...DIM, fontSize: 12, marginTop: 3, lineHeight: 1.6 } },
|
|
3819
|
+
'任务卡「↻ 续跑」(bufeng_task_recover action=resume)等中转写通道的守门三态:off=整段关停(零投递);shadow=只记录不拦截(出厂默认);enforce=越界即拒。' +
|
|
3820
|
+
'缺省/非法存量值读取侧按 shadow 处理(fail-safe 不误拦)。选中即提交,与 bufeng_config 工具双通道等价(同一 applyGatePatch 权威)。')),
|
|
3821
|
+
h('div', { style: { display: 'flex', flexDirection: 'column', gap: 4, flexShrink: 0 } },
|
|
3822
|
+
REL_STATES.map((st) => h('button', {
|
|
3823
|
+
key: st.id,
|
|
3824
|
+
'data-bf-relgate': st.id,
|
|
3825
|
+
disabled: busyRelay,
|
|
3826
|
+
title: '切换派单中转闸为 ' + st.id,
|
|
3827
|
+
onClick: () => flipRelay(st.id),
|
|
3828
|
+
style: {
|
|
3829
|
+
cursor: busyRelay ? 'wait' : 'pointer', fontSize: 11, padding: '4px 10px', borderRadius: 6,
|
|
3830
|
+
font: 'var(--ds-font-family-code, monospace)',
|
|
3831
|
+
border: '1px solid ' + (st.id === relayGate ? 'var(--dsw-alias-state-success-primary, #2f9e44)' : LINE),
|
|
3832
|
+
background: st.id === relayGate ? 'rgba(47,158,68,.16)' : 'transparent',
|
|
3833
|
+
color: 'inherit', opacity: busyRelay ? .6 : 1
|
|
3834
|
+
}
|
|
3835
|
+
}, st.label))))),
|
|
3836
|
+
h(Section, { id: 'set-capprompt', icon: '📣', title: '能力面宣传(capabilityPrompt)', desc: 'v0.46.0 · 派单提示词能力段' },
|
|
3837
|
+
h('div', { style: { display: 'flex', alignItems: 'flex-start', gap: 14 } },
|
|
3838
|
+
h('div', { style: { flex: 1, minWidth: 0 } },
|
|
3839
|
+
h('div', { style: { font: 'var(--dsw-font-xs-strong-13, 600 13px/1.5 sans-serif)', ...LABEL } },
|
|
3840
|
+
'能力面宣传三态',
|
|
3841
|
+
h('span', { 'data-bf-capcur': capGate, style: { marginLeft: 8, font: 'var(--ds-font-family-code, monospace)' } }, '当前:' + capGate)),
|
|
3842
|
+
h('div', { style: { ...DIM, fontSize: 12, marginTop: 3, lineHeight: 1.6 } },
|
|
3843
|
+
'派单提示词「可用能力提示」段开关:off=不注入(零 token,出厂默认,存量任务提示词字节全等);brief=装备名摘要;full=工具白名单投影+推荐命中词(无装备无命中节点整段缺席)。' +
|
|
3844
|
+
'缺省/非法存量值读取侧按 off 处理(fail-safe 零注入)。选中即提交,与 bufeng_config 工具双通道等价(同一 applyGatePatch 权威)。')),
|
|
3845
|
+
h('div', { style: { display: 'flex', flexDirection: 'column', gap: 4, flexShrink: 0 } },
|
|
3846
|
+
CAP_STATES.map((st) => h('button', {
|
|
3847
|
+
key: st.id,
|
|
3848
|
+
'data-bf-capgate': st.id,
|
|
3849
|
+
disabled: busyCap,
|
|
3850
|
+
title: '切换能力面宣传为 ' + st.id,
|
|
3851
|
+
onClick: () => flipCap(st.id),
|
|
3852
|
+
style: {
|
|
3853
|
+
cursor: busyCap ? 'wait' : 'pointer', fontSize: 11, padding: '4px 10px', borderRadius: 6,
|
|
3854
|
+
font: 'var(--ds-font-family-code, monospace)',
|
|
3855
|
+
border: '1px solid ' + (st.id === capGate ? 'var(--dsw-alias-state-success-primary, #2f9e44)' : LINE),
|
|
3856
|
+
background: st.id === capGate ? 'rgba(47,158,68,.16)' : 'transparent',
|
|
3857
|
+
color: 'inherit', opacity: busyCap ? .6 : 1
|
|
3858
|
+
}
|
|
3859
|
+
}, st.label))))),
|
|
3860
|
+
h(Section, { id: 'set-budget', icon: '⚖️', title: '调度与预算', desc: '派单闸门' },
|
|
3861
|
+
h(EditRow, { label: '并发闸门(maxConcurrentNodes)', hint: '全林同时执行任务的节点上限,1-64', value: gate.maxConcurrentNodes, width: 64, suffix: '个', onSave: saveField('maxConcurrentNodes'), parse: (s) => Number(s) }),
|
|
3862
|
+
h(EditRow, { label: '日预算(dailyBudgetTokens)', hint: '全林每日 token 估算上限,1 万-10 亿;100% 熔断拒派', value: gate.dailyBudgetTokens, width: 110, suffix: 'token', onSave: saveField('dailyBudgetTokens', fmtTokens), parse: (s) => Number(s) }),
|
|
3863
|
+
h(EditRow, { label: '预警线(budgetWarnAt)', hint: '用量达到预算的百分比即预警,50-100', value: Math.round((gate.budgetWarnAt ?? 0.85) * 100), width: 64, suffix: '%', onSave: saveField('budgetWarnAt'), parse: (s) => Number(s) / 100 }),
|
|
3864
|
+
h(EditRow, { label: '任务默认时限(taskTimeoutDefaultMin)', hint: '派单未显式给 timeoutMin 时的默认时限,分钟;0=不限时(默认,进度靠等待屏障每 5 分钟分段反馈);>0 超时只标不杀(看板⏰徽章)', value: gate.taskTimeoutDefaultMin ?? 0, width: 64, suffix: '分', onSave: saveField('taskTimeoutDefaultMin'), parse: (s) => Number(s) }),
|
|
3865
|
+
h(EditRow, { label: '总管名单容量(maxRoots)', hint: '总管名单席位上限,2-16(默认 4);满员拒绝新总管入名单(等待 TTL 清理或调大容量)', value: gate.maxRoots ?? 4, width: 64, suffix: '席', onSave: saveField('maxRoots'), parse: (s) => Number(s) }),
|
|
3866
|
+
h(EditRow, { label: '总管名单 TTL(rootTtlMin)', hint: '名单条目超 lastActiveAt 未活跃即按死席摘除(惰性扫描),分钟,60-1000000;默认 1440=24h', value: gate.rootTtlMin ?? 1440, width: 64, suffix: '分', onSave: saveField('rootTtlMin'), parse: (s) => Number(s) })),
|
|
3867
|
+
|
|
3868
|
+
h(Section, { id: 'set-dir', icon: '📁', title: '项目目录', desc: '总管代建项目的统一存放地' },
|
|
3869
|
+
h(EditRow, { label: '项目根(projectsRoot)', hint: projectsRootHint, value: gate.projectsRoot, width: 330, onSave: saveField('projectsRoot') }),
|
|
3870
|
+
h(EditRow, {
|
|
3871
|
+
label: '默认工作区目录名(defaultWorkspaceDir)',
|
|
3872
|
+
hint: '无项目/无显式目录的派单会话统一落这里(GUI 分区「捕风·默认工作区」)。DSH 工作区根下的子目录名(非绝对路径),默认 bufeng-ws;' +
|
|
3873
|
+
'改后新建树/派单兜底/自建登记生效,已有树与项目路径不动。当前生效:' + (snap.defaultWorkspace ?? '~/.dsh/bufeng/workspace'),
|
|
3874
|
+
value: gate.defaultWorkspaceDir ?? 'bufeng-ws',
|
|
3875
|
+
width: 200, inputExtra: { 'data-bf-wsdir': '1' }, warnOf: wsDirWarnOf,
|
|
3876
|
+
onSave: saveField('defaultWorkspaceDir')
|
|
3877
|
+
})),
|
|
3878
|
+
|
|
3879
|
+
h(Section, { id: 'set-legend', icon: '🧩', title: '角色图例', desc: '星枢 · v0.24.0(看板卡/任务行同款)' },
|
|
3880
|
+
h('div', { style: { display: 'flex', alignItems: 'center', gap: 20, flexWrap: 'wrap' } },
|
|
3881
|
+
legendItem('orchestrator', 'legend-zg', '总管', '中枢枢纽 · 紫罗盘'),
|
|
3882
|
+
legendItem('leader', 'legend-dg', '都管', '带队把关 · 青盾'),
|
|
3883
|
+
legendItem('member', 'legend-cy', '成员', '动手执行 · 琥珀齿轮'))),
|
|
3884
|
+
|
|
3885
|
+
msg ? h('div', { style: { fontSize: 12, marginTop: 10, color: msg.ok ? 'var(--dsw-alias-state-success-label, #4cc38a)' : 'var(--dsw-alias-state-error-label, #e5484d)' } }, msg.text) : null
|
|
3886
|
+
));
|
|
3887
|
+
}
|
|
3888
|
+
return { SettingsPane };
|
|
3889
|
+
})();
|
|
3890
|
+
/* ============================== src/board.js ============================== */
|
|
3891
|
+
__mods["board.js"] = (() => {
|
|
3892
|
+
const { h, useState } = __mods["react.js"];
|
|
3893
|
+
const { StyleOnce } = __mods["styles.js"];
|
|
3894
|
+
const { usebufengSnapshot } = __mods["data.js"];
|
|
3895
|
+
const { GraphCanvas } = __mods["graph.js"];
|
|
3896
|
+
const { TaskBoard } = __mods["taskboard.js"];
|
|
3897
|
+
const { ProjectsPane } = __mods["projects.js"];
|
|
3898
|
+
const { SettingsPane } = __mods["settings.js"];
|
|
3899
|
+
const { ImproveBtnAll } = __mods["cards.js"];
|
|
3900
|
+
const { LINE, DIM, LABEL } = __mods["ui.js"];
|
|
3901
|
+
const { isRootKind } = __mods["icons.js"];
|
|
3902
|
+
/**
|
|
3903
|
+
* client/src/board.js — 看板主组件(四 tab:智能体概览/项目/任务看板/设置;v0.27.5 退役第五 tab)、
|
|
3904
|
+
* 侧栏图标、槽位注册(本 bundle 入口)。全林自我提升按钮在司南卡上(graph.js 渲染)。
|
|
3905
|
+
*/
|
|
3906
|
+
|
|
3907
|
+
|
|
3908
|
+
|
|
3909
|
+
|
|
3910
|
+
|
|
3911
|
+
|
|
3912
|
+
|
|
3913
|
+
|
|
3914
|
+
|
|
3915
|
+
|
|
3916
|
+
|
|
3917
|
+
function bufengBoard() {
|
|
3918
|
+
const { snap, err, live } = usebufengSnapshot();
|
|
3919
|
+
/* 看板折叠键修复(k-mvm5m0c9062):折叠状态按都管节点 id 集合存储,键 bufeng-collapsed-leads
|
|
3920
|
+
* (graph.js collapseTarget 同步为 lead.id)。旧键 bufeng-collapsed-trees(按树 id 存)安全忽略:
|
|
3921
|
+
* 树 id("t-…")与节点 id("n-…")形态互不碰撞,读侧只认新键——旧存量不迁移、不报错、不错乱。 */
|
|
3922
|
+
const [collapsedSet, setCollapsed] = useState(() => {
|
|
3923
|
+
try { return new Set(JSON.parse(sessionStorage.getItem("bufeng-collapsed-leads") || "[]")); }
|
|
3924
|
+
catch { return new Set(); }
|
|
3925
|
+
});
|
|
3926
|
+
const toggle = (id) => setCollapsed((prev) => {
|
|
3927
|
+
const next = new Set(prev);
|
|
3928
|
+
if (next.has(id)) next.delete(id); else next.add(id);
|
|
3929
|
+
try { sessionStorage.setItem("bufeng-collapsed-leads", JSON.stringify([...next])); } catch { /* 忽略 */ }
|
|
3930
|
+
return next;
|
|
3931
|
+
});
|
|
3932
|
+
/* v0.13.0 tab 化 → v0.16.3 四 tab → v0.25 批2-T4 五 tab → v0.27.5 四 tab(第五 tab 退役):
|
|
3933
|
+
* graph=智能体概览 / projects=项目 / taskboard=任务看板(任务×智能体关系,主数据走 GET /api/tasks)/
|
|
3934
|
+
* settings=设置;白名单外旧值(含 'list' 与已退役 'tasks')一律归并回默认 graph */
|
|
3935
|
+
const [mode, setMode] = useState(() => {
|
|
3936
|
+
const v = sessionStorage.getItem("bufeng-view-mode");
|
|
3937
|
+
return v === "projects" || v === "settings" || v === "taskboard" ? v : "graph";
|
|
3938
|
+
});
|
|
3939
|
+
const switchMode = (m) => { setMode(m); try { sessionStorage.setItem("bufeng-view-mode", m); } catch { /* 忽略 */ } };
|
|
3940
|
+
/* v0.40.7 工作项一:节点卡「在跑任务」点击 → 写一次性跳转锚 + 切任务看板 tab。
|
|
3941
|
+
* TaskBoard 挂载时读后即清(takeTaskFocus),并入树数据并选中该单;不污染后续渲染。 */
|
|
3942
|
+
const openTask = (tv) => {
|
|
3943
|
+
if (!tv || !tv.id) return;
|
|
3944
|
+
try { sessionStorage.setItem("bufeng-task-focus", JSON.stringify({ id: tv.id, task: tv })); } catch { /* 忽略 */ }
|
|
3945
|
+
switchMode("taskboard");
|
|
3946
|
+
};
|
|
3947
|
+
if (err && !snap) {
|
|
3948
|
+
return h("div", { className: "bf-root", style: { padding: 24, color: "var(--dsw-alias-state-error-primary, #e5484d)" } },
|
|
3949
|
+
h(StyleOnce), "看板加载失败:" + err);
|
|
3950
|
+
}
|
|
3951
|
+
if (!snap) return h("div", { className: "bf-root", style: { padding: 24, ...DIM } }, h(StyleOnce), "加载中…");
|
|
3952
|
+
const tabBtn = (m, label, title) => h("button", { className: "bf-ctl", "data-bf-tab": m,
|
|
3953
|
+
onClick: () => switchMode(m), title,
|
|
3954
|
+
style: { border: "none", borderRadius: 6, padding: "0 10px",
|
|
3955
|
+
background: mode === m ? "var(--dsw-alias-interactive-bg-selected, rgba(110,118,225,0.25))" : "transparent",
|
|
3956
|
+
color: mode === m ? LABEL.color : DIM.color, font: "var(--dsw-font-xs-strong-13, 600 13px/1.5 sans-serif)" } }, label);
|
|
3957
|
+
/* v0.13.1:提升按钮挂司南卡;林里没有总管节点时才在 tab 行右侧兜底一枚(v0.24.0 根节点判定 isRootKind:新 root/旧 orchestrator 兼容) */
|
|
3958
|
+
const hasOrch = (snap.trees || []).some((t) => (t.nodes || []).some((n) => isRootKind(n.kind)));
|
|
3959
|
+
return h("div", { className: "bf-root", style: { height: "100%", overflowY: "auto", padding: "10px 20px 28px 14px", width: "100%", maxWidth: 1600, boxSizing: "border-box", margin: "0 auto", display: "flex", flexDirection: "column", gap: 12 } },
|
|
3960
|
+
h(StyleOnce),
|
|
3961
|
+
h("div", { style: { display: "flex", alignItems: "center", gap: 10, flexWrap: "wrap" } },
|
|
3962
|
+
h("b", { style: { font: "var(--dsw-font-xs-strong-13, 600 13px/1.5 sans-serif)", ...LABEL } }, "捕风工坊"),
|
|
3963
|
+
h("span", { className: "bf-meta" }, "dsh-bufeng v" + snap.version),
|
|
3964
|
+
h("span", { style: { display: "inline-flex", alignItems: "center", gap: 5 } },
|
|
3965
|
+
h("span", { className: "bf-dot", style: { background: live ? "var(--dsw-alias-state-success-primary, #2f9e44)" : "var(--dsw-alias-state-warn-primary, #d8a516)" } }),
|
|
3966
|
+
h("span", { style: DIM }, live ? "实时" : "轮询")),
|
|
3967
|
+
err ? h("span", { style: { color: "var(--dsw-alias-state-warn-label, #d8a516)", fontSize: 12 } }, "取数异常:" + err) : null,
|
|
3968
|
+
h("span", { style: { flex: 1 } }),
|
|
3969
|
+
h("div", { style: { display: "inline-flex", gap: 2, border: "1px solid " + LINE, borderRadius: 8, padding: 2 } },
|
|
3970
|
+
tabBtn("graph", "🤖 智能体概览", "按工坊展示智能体层级、运行状态与任务数统计"),
|
|
3971
|
+
tabBtn("projects", "📁 项目", "业务目录×任务关联(项目制 v0.15.0)"),
|
|
3972
|
+
tabBtn("taskboard", "🔍 任务看板", "任务×智能体关系(链路/派发边/分页过滤,v0.25 批2-T4)"),
|
|
3973
|
+
tabBtn("settings", "⚙ 设置", "治理配置(总管名单制等,客户自决)")),
|
|
3974
|
+
!hasOrch ? h(ImproveBtnAll, { trees: snap.trees || [] }) : null),
|
|
3975
|
+
mode === "graph"
|
|
3976
|
+
? h(GraphCanvas, { snap, collapsedSet, toggle, onOpenTask: openTask })
|
|
3977
|
+
: mode === "taskboard"
|
|
3978
|
+
? h(TaskBoard, { snap })
|
|
3979
|
+
: mode === "projects"
|
|
3980
|
+
? h(ProjectsPane, { snap })
|
|
3981
|
+
: h(SettingsPane, { snap }));
|
|
3982
|
+
}
|
|
3983
|
+
|
|
3984
|
+
/* ---------- 侧栏图标:外壳拥有按钮/悬停/选中态,这里只画图形 ---------- */
|
|
3985
|
+
function bufengIcon({ size }) {
|
|
3986
|
+
const s = size ?? 18;
|
|
3987
|
+
return h("svg", {
|
|
3988
|
+
width: s, height: s, viewBox: "0 0 24 24", fill: "none",
|
|
3989
|
+
stroke: "currentColor", strokeWidth: 1.8,
|
|
3990
|
+
strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true
|
|
3991
|
+
},
|
|
3992
|
+
h("rect", { x: 3, y: 3, width: 6, height: 6, rx: 1.2 }),
|
|
3993
|
+
h("rect", { x: 15, y: 3, width: 6, height: 6, rx: 1.2 }),
|
|
3994
|
+
h("rect", { x: 9, y: 15, width: 6, height: 6, rx: 1.2 }),
|
|
3995
|
+
h("path", { d: "M6 9v3a2 2 0 0 0 2 2h1" }),
|
|
3996
|
+
h("path", { d: "M18 9v3a2 2 0 0 1-2 2h-1" }),
|
|
3997
|
+
h("path", { d: "M12 14v1" }));
|
|
3998
|
+
}
|
|
3999
|
+
|
|
4000
|
+
/* ---------- 注册:左侧栏面板(点击图标 → 主区整面板)+ 设置页双入口 ----------
|
|
4001
|
+
* 配方对齐 dsh-mnemon native-sidebar:同一 id 串联 sidebar.panellist 图标
|
|
4002
|
+
* 与 main 面板(key=id),外层 slots.inject(slot, thunk) 做槽位缺失降级。 */
|
|
4003
|
+
const bufeng_PANEL_ID = "bufeng-board";
|
|
4004
|
+
function apply(ctx) {
|
|
4005
|
+
try {
|
|
4006
|
+
ctx.slots.inject("main", () => ctx.slots.inject("sidebar.panellist", () => {
|
|
4007
|
+
const stopMain = ctx.slots.register({ name: "main", key: bufeng_PANEL_ID }, bufengBoard);
|
|
4008
|
+
const stopIcon = ctx.slots.register({
|
|
4009
|
+
name: "sidebar.panellist",
|
|
4010
|
+
id: bufeng_PANEL_ID,
|
|
4011
|
+
order: 35,
|
|
4012
|
+
label: () => "捕风工坊"
|
|
4013
|
+
}, bufengIcon);
|
|
4014
|
+
return () => { stopIcon?.(); stopMain?.(); };
|
|
4015
|
+
}));
|
|
4016
|
+
} catch (e) {
|
|
4017
|
+
console.warn("[dsh-bufeng] sidebar panel registration failed:", e);
|
|
4018
|
+
}
|
|
4019
|
+
try {
|
|
4020
|
+
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
4021
|
+
name: "settings.section",
|
|
4022
|
+
id: bufeng_PANEL_ID,
|
|
4023
|
+
order: 45,
|
|
4024
|
+
label: () => "捕风工坊"
|
|
4025
|
+
}, () => h(bufengBoard)));
|
|
4026
|
+
} catch (e) {
|
|
4027
|
+
console.warn("[dsh-bufeng] client board registration failed:", e);
|
|
4028
|
+
}
|
|
4029
|
+
}
|
|
4030
|
+
|
|
4031
|
+
|
|
4032
|
+
const name = "dsh-bufeng";
|
|
4033
|
+
const inject = ["slots"];
|
|
4034
|
+
return { name, inject, apply };
|
|
4035
|
+
})();
|
|
4036
|
+
const module = { exports: __mods["board.js"] };
|
|
4037
|
+
return module.exports;
|
|
4038
|
+
} });
|