skill-evolution 0.0.0-stage → 0.1.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/client.js ADDED
@@ -0,0 +1,2136 @@
1
+ // DSH 自进化 · Web GUI 客户端(对齐 DSH 原生设置页设计语言)
2
+ //
3
+ // 视觉规范:
4
+ // - 页面容器 max-width 720px,标题 20/500,正文 14/20,说明 12/18 secondary
5
+ // - 设置行 padding 16px 0 + .5px 分割线,末行去边框;按钮为透明底 + .5px 描边 + 6px 圆角
6
+ // - 颜色一律取自宿主 --dsw-alias-* token(跟随明暗主题),无自定义字体族与硬编码颜色
7
+ // - 开关 36×20、role="switch" + aria-checked,与宿主内置开关一致
8
+ // - 挂载位置:sidebar.panellist (order: 15) + main(完整工作台)+ settings.section(引擎参数)
9
+
10
+ window.__ModuleLoader__.load({
11
+ id: 'skill-evolution',
12
+ factory: (require) => {
13
+ const React = require('react');
14
+ const { useState, useEffect, useCallback } = React;
15
+ const h = React.createElement;
16
+
17
+ const API_BASE = '/dsh-evolution/api';
18
+
19
+ async function api(endpoint, options = {}) {
20
+ const token = new URLSearchParams(window.location.search).get('token');
21
+ const res = await fetch(`${API_BASE}${endpoint}`, {
22
+ ...options,
23
+ headers: { 'Content-Type': 'application/json', ...(token ? { Authorization: `Bearer ${token}` } : {}), ...options.headers },
24
+ });
25
+ const data = await res.json().catch(() => ({}));
26
+ if (!res.ok || data.ok === false) {
27
+ throw new Error(data.error || `HTTP ${res.status}`);
28
+ }
29
+ return data;
30
+ }
31
+
32
+ // ---------- 1. 模块级单例状态中心(跨槽位同步)----------
33
+ const EvolutionStore = {
34
+ data: null,
35
+ error: null,
36
+ loading: true,
37
+ listeners: new Set(),
38
+ timer: null,
39
+ inflight: null,
40
+
41
+ notify() {
42
+ for (const fn of this.listeners) {
43
+ try { fn(); } catch { /* ignore */ }
44
+ }
45
+ },
46
+
47
+ async fetchNow() {
48
+ if (this.inflight) return this.inflight;
49
+ this.inflight = (async () => {
50
+ try {
51
+ const res = await api('/status');
52
+ this.data = res;
53
+ this.error = null;
54
+ } catch (e) {
55
+ this.error = String(e.message || e);
56
+ } finally {
57
+ this.loading = false;
58
+ this.inflight = null;
59
+ this.notify();
60
+ }
61
+ })();
62
+ return this.inflight;
63
+ },
64
+
65
+ subscribe(fn) {
66
+ this.listeners.add(fn);
67
+ if (this.listeners.size === 1) {
68
+ this.fetchNow();
69
+ this.timer = setInterval(() => this.fetchNow(), 6000);
70
+ }
71
+ return () => {
72
+ this.listeners.delete(fn);
73
+ if (this.listeners.size === 0 && this.timer) {
74
+ clearInterval(this.timer);
75
+ this.timer = null;
76
+ }
77
+ };
78
+ },
79
+ };
80
+
81
+ function useSnapshot() {
82
+ const [, setTick] = useState(0);
83
+ useEffect(() => EvolutionStore.subscribe(() => setTick((t) => t + 1)), []);
84
+ return {
85
+ data: EvolutionStore.data,
86
+ error: EvolutionStore.error,
87
+ loading: EvolutionStore.loading,
88
+ reload: () => EvolutionStore.fetchNow(),
89
+ };
90
+ }
91
+
92
+ // ---------- 2. 极简方形几何图标 ----------
93
+ function SvgIcon({ d, size = 15 }) {
94
+ return h(
95
+ 'svg',
96
+ {
97
+ width: size,
98
+ height: size,
99
+ viewBox: '0 0 24 24',
100
+ fill: 'none',
101
+ stroke: 'currentColor',
102
+ strokeWidth: 1.5,
103
+ strokeLinecap: 'round',
104
+ strokeLinejoin: 'round',
105
+ style: { flexShrink: 0 },
106
+ },
107
+ ...(Array.isArray(d) ? d : [d]).map((p, i) => h('path', { key: i, d: p })),
108
+ );
109
+ }
110
+
111
+ const ICONS = {
112
+ refresh: ['M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8', 'M3 3v5h5', 'M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16', 'M16 16h5v5'],
113
+ check: 'M20 6 9 17l-5-5',
114
+ spark: ['M12 3v4', 'M12 17v4', 'M3 12h4', 'M17 12h4', 'M5.6 5.6l2.8 2.8', 'M15.6 15.6l2.8 2.8', 'M18.4 5.6l-2.8 2.8', 'M8.4 15.6l-2.8 2.8'],
115
+ x: ['M18 6 6 18', 'M6 6l12 12'],
116
+ undo: ['M3 7v6h6', 'M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13'],
117
+ pin: ['M12 17v5', 'M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16h14v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 1 1 0 0 0 1-1V4a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1 1 1 0 0 1 1 1z'],
118
+ play: 'M6 4l14 8-14 8V4z',
119
+ search: ['M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16z', 'm21 21-4.3-4.3'],
120
+ code: ['m16 18 6-6-6-6', 'm8 6-6 6 6 6'],
121
+ arrowRight: ['M5 12h14', 'm13 6 6 6-6 6'],
122
+ };
123
+
124
+ // ---------- 3. 顶层受控表单组件(防重渲染失焦)----------
125
+ function SettingField({ label, hint, children }) {
126
+ return h(
127
+ 'div',
128
+ { className: 'evo-field' },
129
+ h(
130
+ 'div',
131
+ { className: 'evo-field-main' },
132
+ h('div', { className: 'evo-field-label' }, label),
133
+ hint ? h('div', { className: 'evo-field-hint' }, hint) : null,
134
+ ),
135
+ h('div', { className: 'evo-field-control' }, children),
136
+ );
137
+ }
138
+
139
+ function NativeSwitch({ checked, disabled, label, onChange }) {
140
+ return h(
141
+ 'button',
142
+ {
143
+ type: 'button',
144
+ role: 'switch',
145
+ 'aria-checked': checked ? 'true' : 'false',
146
+ 'aria-label': label,
147
+ className: 'evo-switch',
148
+ disabled,
149
+ onClick: () => onChange(!checked),
150
+ },
151
+ h('span', { className: 'evo-thumb', 'aria-hidden': 'true' }),
152
+ );
153
+ }
154
+
155
+ function SettingNumberInput({ value, min, max, step = 1, onChange }) {
156
+ const [raw, setRaw] = useState(String(value ?? ''));
157
+ useEffect(() => {
158
+ setRaw(String(value ?? ''));
159
+ }, [value]);
160
+ return h('input', {
161
+ type: 'number',
162
+ className: 'evo-input evo-input-num',
163
+ min,
164
+ max,
165
+ step,
166
+ value: raw,
167
+ onChange: (e) => {
168
+ const txt = e.target.value;
169
+ setRaw(txt);
170
+ const n = Number(txt);
171
+ if (txt !== '' && !Number.isNaN(n)) onChange(n);
172
+ },
173
+ onBlur: () => {
174
+ let n = Number(raw);
175
+ if (raw === '' || Number.isNaN(n)) n = min ?? 0;
176
+ if (min !== undefined) n = Math.max(min, n);
177
+ if (max !== undefined) n = Math.min(max, n);
178
+ setRaw(String(n));
179
+ onChange(n);
180
+ },
181
+ });
182
+ }
183
+
184
+ // ---------- 4. 源码与 SHA-256 Diff 查看器(按需展开)----------
185
+ function CodePreview({ frontmatter, body }) {
186
+ const lines = String(body || '').split('\n');
187
+ return h(
188
+ 'div',
189
+ { className: 'evo-code-box' },
190
+ frontmatter && Object.keys(frontmatter).length
191
+ ? h(
192
+ 'div',
193
+ { className: 'evo-code-fm' },
194
+ Object.entries(frontmatter).map(([k, v]) =>
195
+ h(
196
+ 'span',
197
+ { key: k, className: 'evo-code-fm-item' },
198
+ h('strong', null, `${k}: `),
199
+ typeof v === 'object' ? JSON.stringify(v) : String(v),
200
+ ),
201
+ ),
202
+ )
203
+ : null,
204
+ h(
205
+ 'pre',
206
+ { className: 'evo-code-pre' },
207
+ lines.map((line, i) =>
208
+ h(
209
+ 'div',
210
+ { key: i, className: 'evo-code-line' },
211
+ h('span', { className: 'evo-code-num' }, String(i + 1).padStart(2, '0')),
212
+ h('span', { className: 'evo-code-txt' }, line || ' '),
213
+ ),
214
+ ),
215
+ ),
216
+ );
217
+ }
218
+
219
+ function FileDiffTable({ beforeFiles = [], afterFiles = [] }) {
220
+ const mapB = new Map((beforeFiles || []).map((f) => [f.relPath, f]));
221
+ const mapA = new Map((afterFiles || []).map((f) => [f.relPath, f]));
222
+ const allPaths = Array.from(new Set([...mapB.keys(), ...mapA.keys()])).sort();
223
+ if (!allPaths.length) return h('div', { className: 'evo-field-hint' }, '无文件快照差异');
224
+
225
+ return h(
226
+ 'table',
227
+ { className: 'evo-table' },
228
+ h(
229
+ 'thead',
230
+ null,
231
+ h(
232
+ 'tr',
233
+ null,
234
+ h('th', null, '状态'),
235
+ h('th', null, '文件'),
236
+ h('th', null, '修改前 SHA'),
237
+ h('th', null, '修改后 SHA'),
238
+ h('th', { style: { textAlign: 'right' } }, '字节'),
239
+ ),
240
+ ),
241
+ h(
242
+ 'tbody',
243
+ null,
244
+ allPaths.map((p) => {
245
+ const b = mapB.get(p);
246
+ const a = mapA.get(p);
247
+ const status = !b ? '新增' : !a ? '移除' : b.sha === a.sha ? '未变' : '修改';
248
+ return h(
249
+ 'tr',
250
+ { key: p },
251
+ h('td', { className: 'evo-mono' }, status),
252
+ h('td', { className: 'evo-mono' }, p),
253
+ h('td', { className: 'evo-mono evo-muted' }, b ? b.sha.slice(0, 10) : '—'),
254
+ h('td', { className: 'evo-mono' }, a ? a.sha.slice(0, 10) : '—'),
255
+ h('td', { className: 'evo-mono', style: { textAlign: 'right' } }, a ? `${a.size}` : b ? `-${b.size}` : '0'),
256
+ );
257
+ }),
258
+ ),
259
+ );
260
+ }
261
+
262
+ // ---------- 5. 极简瑞士风待审草稿卡(保留全部简报、节点插想法、后果对比与批示功能)----------
263
+ function SwissDraftCard({ draft, onRefine, onPromote, onDiscard, busyKey, defaultOpen = false }) {
264
+ const [showSource, setShowSource] = useState(false);
265
+ const [collapsed, setCollapsed] = useState(!defaultOpen);
266
+ const [selectedStep, setSelectedStep] = useState(null);
267
+ const [selectedPills, setSelectedPills] = useState([]);
268
+ const [comment, setComment] = useState('');
269
+
270
+ const isBusy = busyKey === `draft:${draft.name}`;
271
+ const b = draft.briefing || {};
272
+ const steps =
273
+ Array.isArray(b.stepsZh) && b.stepsZh.length
274
+ ? b.stepsZh
275
+ : Array.isArray(b.keyRules) && b.keyRules.length
276
+ ? b.keyRules
277
+ : ['读取上下文并按标准顺序排查', '执行最小化修改并验证真实结果'];
278
+ const pitfalls = Array.isArray(b.pitfallsZh) ? b.pitfallsZh : [];
279
+
280
+ const QUICK_IDEAS = [
281
+ { id: 'ok', label: '直接同意入库', text: '同意采纳:当前提炼的步骤与防坑规则准确,直接入库' },
282
+ { id: 'backup', label: '+ 修改前先备份', text: '补充要求:修改任何文件或配置前必须先创建备份' },
283
+ { id: 'readonly', label: '+ 先只读诊断', text: '补充要求:必须先通过只读命令确认根因证据再修改' },
284
+ { id: 'concise', label: '+ 精简冗余步骤', text: '精简描述,只保留最核心的可执行命令与判断条件' },
285
+ ];
286
+
287
+ const togglePill = (item) => {
288
+ setSelectedPills((prev) =>
289
+ prev.includes(item.text) ? prev.filter((x) => x !== item.text) : [...prev, item.text],
290
+ );
291
+ };
292
+
293
+ const handleStepClick = (idx, text) => {
294
+ setSelectedStep(idx);
295
+ const tag = `[针对步骤 0${idx + 1}(${String(text).replace(/^\d+\.\s*/, '').slice(0, 14)}…)调整]:`;
296
+ if (!comment.includes(tag)) {
297
+ setComment((prev) => (prev ? `${prev};${tag}` : tag));
298
+ }
299
+ };
300
+
301
+ const finalDirective = [...selectedPills, comment.trim()].filter(Boolean).join(';');
302
+
303
+ // 折叠态:一行摘要 + 快选动作,避免一屏塞满 16 张全展开卡
304
+ if (collapsed) {
305
+ return h(
306
+ 'article',
307
+ { className: 'evo-draft evo-draft-compact' },
308
+ h(
309
+ 'div',
310
+ { className: 'evo-compact-row' },
311
+ h(
312
+ 'span',
313
+ { className: 'evo-badge' + (draft.isPatch ? ' evo-badge-info' : '') },
314
+ draft.isPatch ? '补丁草稿' : '新技能',
315
+ ),
316
+ h('span', { className: 'evo-compact-name' }, b.titleZh || draft.name),
317
+ h('span', { className: 'evo-compact-sum' }, b.whatItIs || draft.description || ''),
318
+ h(
319
+ 'div',
320
+ { className: 'evo-compact-actions' },
321
+ h(
322
+ 'button',
323
+ { type: 'button', className: 'evo-link-btn', onClick: () => setCollapsed(false) },
324
+ '展开审阅',
325
+ ),
326
+ h(
327
+ 'button',
328
+ {
329
+ type: 'button',
330
+ className: 'evo-btn',
331
+ disabled: isBusy,
332
+ onClick: () => onPromote(draft.name, '同意采纳:按当前草稿直接入库', false),
333
+ },
334
+ h(SvgIcon, { d: ICONS.check, size: 14 }),
335
+ '采纳',
336
+ ),
337
+ h(
338
+ 'button',
339
+ {
340
+ type: 'button',
341
+ className: 'evo-btn danger',
342
+ disabled: isBusy,
343
+ onClick: () => onDiscard(draft.name, '快速驳回'),
344
+ },
345
+ '驳回',
346
+ ),
347
+ ),
348
+ ),
349
+ );
350
+ }
351
+
352
+ return h(
353
+ 'article',
354
+ { className: 'evo-draft' },
355
+ // 顶栏:草稿类型徽章 + 技能标识 + 源码切换
356
+ h(
357
+ 'div',
358
+ { className: 'evo-draft-kicker' },
359
+ h(
360
+ 'span',
361
+ { className: 'evo-badge' + (draft.isPatch ? ' evo-badge-info' : '') },
362
+ draft.isPatch ? '补丁草稿' : '新技能',
363
+ ),
364
+ h('span', { className: 'evo-kicker evo-mono' }, draft.name),
365
+ draft.resources?.length
366
+ ? h('span', { className: 'evo-kicker' }, `含 ${draft.resources.length} 个引用文件`)
367
+ : null,
368
+ h(
369
+ 'button',
370
+ {
371
+ type: 'button',
372
+ className: 'evo-link-btn',
373
+ onClick: () => setShowSource((v) => !v),
374
+ },
375
+ h(SvgIcon, { d: ICONS.code, size: 13 }),
376
+ showSource ? '返回中文简报' : '查看 SKILL.md 源码',
377
+ ),
378
+ ),
379
+
380
+ // 标题与核心中文解释
381
+ h(
382
+ 'div',
383
+ { className: 'evo-draft-main' },
384
+ h('h3', { className: 'evo-draft-title' }, b.titleZh || draft.name),
385
+ h('p', { className: 'evo-draft-summary' }, b.whatItIs || draft.description || '(无摘要)'),
386
+ b.triggerZh
387
+ ? h(
388
+ 'div',
389
+ { className: 'evo-trigger-line' },
390
+ h('span', { className: 'evo-kicker' }, '触发场景'),
391
+ h('span', null, b.triggerZh),
392
+ )
393
+ : null,
394
+ ),
395
+
396
+ // 源码视图 vs 瑞士网格简报视图
397
+ showSource
398
+ ? h(CodePreview, { frontmatter: draft.frontmatter, body: draft.body })
399
+ : h(
400
+ React.Fragment,
401
+ null,
402
+ // 共用 1px 细线的步骤网格(点击任一步骤即可定点插入想法)
403
+ h(
404
+ 'div',
405
+ { className: 'evo-steps-grid' },
406
+ steps.slice(0, 4).map((st, idx) =>
407
+ h(
408
+ 'div',
409
+ {
410
+ key: idx,
411
+ className: 'evo-step-cell' + (selectedStep === idx ? ' on' : ''),
412
+ onClick: () => handleStepClick(idx, st),
413
+ title: '点击针对此步骤插入您的修改想法',
414
+ },
415
+ h(
416
+ 'div',
417
+ { className: 'evo-step-top' },
418
+ h('span', { className: 'evo-step-label' }, `步骤 ${idx + 1}`),
419
+ h('span', { className: 'evo-step-add' }, '+ 插入想法'),
420
+ ),
421
+ h('div', { className: 'evo-step-body' }, String(st).replace(/^\d+\.\s*/, '')),
422
+ ),
423
+ ),
424
+ ),
425
+
426
+ // 避坑护栏(极简横条)
427
+ pitfalls.length
428
+ ? h(
429
+ 'div',
430
+ { className: 'evo-pitfalls' },
431
+ h('span', { className: 'evo-kicker', style: { flex: 'none' } }, '防坑规则'),
432
+ h(
433
+ 'div',
434
+ { className: 'evo-pitfalls-list' },
435
+ pitfalls.map((p, i) => h('span', { key: i, className: 'evo-pitfall-item' }, `· ${p}`)),
436
+ ),
437
+ )
438
+ : null,
439
+
440
+ // 同意 vs 驳回 二栏极简后果对照
441
+ h(
442
+ 'div',
443
+ { className: 'evo-outcomes' },
444
+ h(
445
+ 'div',
446
+ { className: 'evo-outcome-cell' },
447
+ h('span', { className: 'evo-kicker evo-ok-label' }, '同意后'),
448
+ h('p', null, b.ifApprove || '写入正式技能库并即时热更新生效,随时可通过 SHA-256 账本回滚。'),
449
+ ),
450
+ h(
451
+ 'div',
452
+ { className: 'evo-outcome-cell' },
453
+ h('span', { className: 'evo-kicker' }, '驳回后'),
454
+ h('p', null, b.ifReject || '安全销毁该暂存草稿,正式技能库保持 0 改动。'),
455
+ ),
456
+ ),
457
+ ),
458
+
459
+ // AI 上次修订汇报(如有)
460
+ b.aiAnalysis
461
+ ? h(
462
+ 'div',
463
+ { className: 'evo-ai-note' },
464
+ h('span', { className: 'evo-kicker' }, 'AI 修订说明'),
465
+ h('span', null, b.aiAnalysis),
466
+ )
467
+ : null,
468
+
469
+ // 底部单行极简批示与操作栏
470
+ h(
471
+ 'div',
472
+ { className: 'evo-draft-foot' },
473
+ h(
474
+ 'div',
475
+ { className: 'evo-pills-row' },
476
+ h('span', { className: 'evo-kicker', style: { flex: 'none' } }, '审阅批示'),
477
+ QUICK_IDEAS.map((item) => {
478
+ const active = selectedPills.includes(item.text);
479
+ return h(
480
+ 'button',
481
+ {
482
+ key: item.id,
483
+ type: 'button',
484
+ className: 'evo-pill',
485
+ 'aria-pressed': active ? 'true' : 'false',
486
+ onClick: () => togglePill(item),
487
+ },
488
+ item.label,
489
+ );
490
+ }),
491
+ ),
492
+ h(
493
+ 'div',
494
+ { className: 'evo-action-row' },
495
+ h('input', {
496
+ type: 'text',
497
+ className: 'evo-input evo-directive-input',
498
+ placeholder: '输入您的批示或想法(必填:可点选上方快捷胶囊或点击步骤格子定点插入)…',
499
+ value: comment,
500
+ onChange: (e) => setComment(e.target.value),
501
+ }),
502
+ h(
503
+ 'button',
504
+ {
505
+ type: 'button',
506
+ className: 'evo-btn ghost',
507
+ disabled: isBusy || !finalDirective,
508
+ onClick: () => onRefine(draft.name, finalDirective),
509
+ title: '让 AI 先按您的想法修改草稿并预览',
510
+ },
511
+ isBusy ? '处理中…' : 'AI 微调预览',
512
+ ),
513
+ h(
514
+ 'button',
515
+ {
516
+ type: 'button',
517
+ className: 'evo-btn primary',
518
+ disabled: isBusy || !finalDirective,
519
+ onClick: () =>
520
+ onPromote(
521
+ draft.name,
522
+ finalDirective,
523
+ Boolean(comment.trim() || selectedPills.some((x) => !x.startsWith('同意采纳:当前'))),
524
+ ),
525
+ },
526
+ h(SvgIcon, { d: ICONS.check, size: 13 }),
527
+ isBusy ? '入库中…' : '采纳并入库',
528
+ ),
529
+ h(
530
+ 'button',
531
+ {
532
+ type: 'button',
533
+ className: 'evo-btn ghost danger',
534
+ disabled: isBusy,
535
+ onClick: () => onDiscard(draft.name, finalDirective || '人工审阅驳回'),
536
+ },
537
+ h(SvgIcon, { d: ICONS.x, size: 13 }),
538
+ '驳回',
539
+ ),
540
+ ),
541
+ ),
542
+ );
543
+ }
544
+
545
+ // ---------- 6. 正式技能行与账本行 ----------
546
+ function SwissSkillRow({ skill, onPin, onDisown, busyKey }) {
547
+ const [open, setOpen] = useState(false);
548
+ const [detail, setDetail] = useState(null);
549
+ const isBusy = busyKey === `skill:${skill.name}`;
550
+
551
+ const toggleOpen = async () => {
552
+ if (open) {
553
+ setOpen(false);
554
+ return;
555
+ }
556
+ setOpen(true);
557
+ if (!detail) {
558
+ try {
559
+ const r = await api(`/skill/${encodeURIComponent(skill.name)}`);
560
+ setDetail(r.skill);
561
+ } catch { /* ignore */ }
562
+ }
563
+ };
564
+
565
+ const stateLabel =
566
+ { active: '活跃', stale: '陈旧', archived: '归档' }[skill.state] || skill.state || '活跃';
567
+
568
+ return h(
569
+ 'div',
570
+ { className: 'evo-row-card' },
571
+ h(
572
+ 'div',
573
+ { className: 'evo-row-line' },
574
+ h(
575
+ 'div',
576
+ { className: 'evo-row-main' },
577
+ h(
578
+ 'div',
579
+ { className: 'evo-row-title-line' },
580
+ h('button', { type: 'button', className: 'evo-row-name', onClick: toggleOpen }, skill.name),
581
+ h('span', { className: 'evo-badge' }, stateLabel),
582
+ skill.pinned ? h('span', { className: 'evo-badge' }, '已固定') : null,
583
+ h('span', { className: 'evo-row-meta' }, `使用 ${skill.useCount || 0} 次`),
584
+ ),
585
+ h('span', { className: 'evo-row-desc' }, skill.description || '—'),
586
+ ),
587
+ h(
588
+ 'div',
589
+ { className: 'evo-row-end' },
590
+ h(
591
+ 'button',
592
+ {
593
+ type: 'button',
594
+ className: 'evo-ibtn' + (skill.pinned ? ' on' : ''),
595
+ disabled: isBusy,
596
+ title: skill.pinned ? '取消固定' : '固定技能(豁免自动归档与合并)',
597
+ 'aria-label': skill.pinned ? '取消固定' : '固定技能',
598
+ onClick: () => onPin(skill.name, !skill.pinned),
599
+ },
600
+ h(SvgIcon, { d: ICONS.pin, size: 14 }),
601
+ ),
602
+ h(
603
+ 'button',
604
+ {
605
+ type: 'button',
606
+ className: 'evo-link-btn',
607
+ onClick: toggleOpen,
608
+ },
609
+ open ? '收起' : '详情',
610
+ ),
611
+ skill.createdBy === 'agent'
612
+ ? h(
613
+ 'button',
614
+ {
615
+ type: 'button',
616
+ className: 'evo-link-btn',
617
+ disabled: isBusy,
618
+ onClick: () => onDisown(skill.name),
619
+ },
620
+ '脱离',
621
+ )
622
+ : null,
623
+ ),
624
+ ),
625
+ open && detail
626
+ ? h(
627
+ 'div',
628
+ { className: 'evo-drawer' },
629
+ h(CodePreview, { frontmatter: detail.frontmatter, body: detail.body }),
630
+ )
631
+ : null,
632
+ );
633
+ }
634
+
635
+ function SwissLedgerRow({ entry, onRollback, busyKey }) {
636
+ const [open, setOpen] = useState(false);
637
+ const isBusy = busyKey === `rb:${entry.id}`;
638
+ const ts = entry.ts ? new Date(entry.ts).toLocaleString('zh-CN', { hour12: false }) : '';
639
+ const canRollback =
640
+ entry.action !== 'rollback' &&
641
+ entry.action !== 'draft_discard' &&
642
+ !String(entry.action || '').startsWith('draft_');
643
+
644
+ const actionLabel =
645
+ {
646
+ promote: '入库',
647
+ rollback: '回滚',
648
+ draft_discard: '驳回草稿',
649
+ draft_add_reference: '新增引用',
650
+ draft_update: '更新草稿',
651
+ adopt: '纳管',
652
+ pin: '固定',
653
+ disown: '脱离',
654
+ consolidate: '建伞合并',
655
+ tidy: '整理',
656
+ }[entry.action] || String(entry.action || '').toUpperCase();
657
+
658
+ return h(
659
+ 'div',
660
+ { className: 'evo-row-card' },
661
+ h(
662
+ 'div',
663
+ { className: 'evo-row-line' },
664
+ h(
665
+ 'div',
666
+ { className: 'evo-row-main' },
667
+ h(
668
+ 'div',
669
+ { className: 'evo-row-title-line' },
670
+ h('span', { className: 'evo-row-meta' }, actionLabel),
671
+ h('span', { className: 'evo-row-name' }, entry.target),
672
+ h('span', { className: 'evo-mono evo-muted' }, entry.id.slice(0, 8)),
673
+ ),
674
+ h(
675
+ 'span',
676
+ { className: 'evo-row-desc' },
677
+ entry.extra?.userComment
678
+ ? `批示:${entry.extra.userComment}`
679
+ : entry.extra?.rationale || `${entry.beforeFiles || 0} → ${entry.afterFiles || 0} 个文件`,
680
+ ),
681
+ ),
682
+ h(
683
+ 'div',
684
+ { className: 'evo-row-end' },
685
+ h('span', { className: 'evo-row-meta' }, ts),
686
+ h(
687
+ 'button',
688
+ { type: 'button', className: 'evo-link-btn', onClick: () => setOpen((v) => !v) },
689
+ open ? '收起' : 'SHA 差异',
690
+ ),
691
+ canRollback
692
+ ? h(
693
+ 'button',
694
+ {
695
+ type: 'button',
696
+ className: 'evo-btn',
697
+ disabled: isBusy,
698
+ onClick: () => onRollback(entry.id, entry.target),
699
+ },
700
+ h(SvgIcon, { d: ICONS.undo, size: 14 }),
701
+ isBusy ? '回滚中…' : '回滚',
702
+ )
703
+ : null,
704
+ ),
705
+ ),
706
+ open
707
+ ? h(
708
+ 'div',
709
+ { className: 'evo-drawer' },
710
+ h(FileDiffTable, {
711
+ beforeFiles: entry.before?.files || [],
712
+ afterFiles: entry.after?.files || [],
713
+ }),
714
+ )
715
+ : null,
716
+ );
717
+ }
718
+
719
+ // ---------- 7. 设置面板 ----------
720
+ function SwissSettingsPanel({ config, onSave, busyKey }) {
721
+ const [draft, setDraft] = useState(config);
722
+ const [dirty, setDirty] = useState(false);
723
+
724
+ useEffect(() => {
725
+ setDraft(config);
726
+ setDirty(false);
727
+ }, [
728
+ config.enabled,
729
+ config.mode,
730
+ config.minTurnsBetween,
731
+ config.minMinutesBetween,
732
+ config.maxMessages,
733
+ config.maxChars,
734
+ config.reviewTimeoutSeconds,
735
+ config.curatorEnabled,
736
+ config.consolidate,
737
+ config.consolidateDryRun,
738
+ config.staleAfterDays,
739
+ config.archiveAfterDays,
740
+ config.reviewModel?.model,
741
+ ]);
742
+
743
+ const set = (k, v) => {
744
+ setDraft((prev) => ({ ...prev, [k]: v }));
745
+ setDirty(true);
746
+ };
747
+
748
+ const isBusy = busyKey === 'save-config';
749
+
750
+ return h(
751
+ 'div',
752
+ { className: 'evo-settings-box' },
753
+ h(
754
+ 'div',
755
+ { className: 'evo-settings-grid' },
756
+ h(
757
+ SettingField,
758
+ { label: '启用后台复盘采集', hint: '每个有效会话回合结束后自动提取可复用经验' },
759
+ h(NativeSwitch, {
760
+ checked: Boolean(draft.enabled),
761
+ label: '启用后台复盘采集',
762
+ onChange: (v) => set('enabled', v),
763
+ }),
764
+ ),
765
+ h(
766
+ SettingField,
767
+ { label: '落盘模式', hint: '草稿审阅先写入暂存区等待批示;直接落盘通过安全闸门后立即生效' },
768
+ h(
769
+ 'div',
770
+ { className: 'evo-pills-row' },
771
+ [
772
+ ['draft', '草稿审阅'],
773
+ ['apply', '直接落盘'],
774
+ ].map(([k, label]) =>
775
+ h(
776
+ 'button',
777
+ {
778
+ key: k,
779
+ type: 'button',
780
+ className: 'evo-pill',
781
+ 'aria-pressed': draft.mode === k ? 'true' : 'false',
782
+ onClick: () => set('mode', k),
783
+ },
784
+ label,
785
+ ),
786
+ ),
787
+ ),
788
+ ),
789
+ h(
790
+ SettingField,
791
+ { label: '复盘回合间隔', hint: '建议设为 1,避免高价值回合被节流跳过' },
792
+ h(SettingNumberInput, {
793
+ value: draft.minTurnsBetween,
794
+ min: 1,
795
+ max: 50,
796
+ onChange: (v) => set('minTurnsBetween', v),
797
+ }),
798
+ ),
799
+ h(
800
+ SettingField,
801
+ { label: '复盘时间防抖(分钟)', hint: '两次后台复盘之间的最短间隔分钟数' },
802
+ h(SettingNumberInput, {
803
+ value: draft.minMinutesBetween,
804
+ min: 0,
805
+ max: 1440,
806
+ onChange: (v) => set('minMinutesBetween', v),
807
+ }),
808
+ ),
809
+ h(
810
+ SettingField,
811
+ { label: '快照保留消息数', hint: '送入复盘模型的最近原文消息数,更早消息自动折叠为摘要' },
812
+ h(SettingNumberInput, {
813
+ value: draft.maxMessages,
814
+ min: 4,
815
+ max: 200,
816
+ onChange: (v) => set('maxMessages', v),
817
+ }),
818
+ ),
819
+ h(
820
+ SettingField,
821
+ { label: '快照字符上限', hint: '单次复盘最大上下文字符预算' },
822
+ h(SettingNumberInput, {
823
+ value: draft.maxChars,
824
+ min: 2000,
825
+ max: 200000,
826
+ step: 1000,
827
+ onChange: (v) => set('maxChars', v),
828
+ }),
829
+ ),
830
+ h(
831
+ SettingField,
832
+ { label: '陈旧 / 归档天数阈值', hint: '默认 14 天标记为陈旧,30 天归入 .archive(永不删除)' },
833
+ h(
834
+ 'div',
835
+ { className: 'evo-inline-fields' },
836
+ h(SettingNumberInput, {
837
+ value: draft.staleAfterDays,
838
+ min: 1,
839
+ max: 365,
840
+ onChange: (v) => set('staleAfterDays', v),
841
+ }),
842
+ h(SettingNumberInput, {
843
+ value: draft.archiveAfterDays,
844
+ min: 1,
845
+ max: 3650,
846
+ onChange: (v) => set('archiveAfterDays', v),
847
+ }),
848
+ ),
849
+ ),
850
+ h(
851
+ SettingField,
852
+ { label: '复盘专用模型', hint: '留空继承当前会话模型;也可填更便宜的辅助模型以省主模型配额' },
853
+ h('input', {
854
+ type: 'text',
855
+ className: 'evo-input evo-input-wide',
856
+ placeholder: 'provider/model(留空继承会话模型)',
857
+ value: draft.reviewModel?.model || '',
858
+ onChange: (e) =>
859
+ set('reviewModel', { ...(draft.reviewModel || {}), model: e.target.value }),
860
+ }),
861
+ ),
862
+ ),
863
+ h(
864
+ 'div',
865
+ { className: 'evo-settings-foot' },
866
+ h('span', { className: 'evo-kicker' }, `技能目录:${config.skillsRoot || '~/.dsh/skills'}`),
867
+ h(
868
+ 'button',
869
+ {
870
+ type: 'button',
871
+ className: 'evo-btn primary',
872
+ disabled: !dirty || isBusy,
873
+ onClick: () => onSave(draft),
874
+ },
875
+ h(SvgIcon, { d: ICONS.check, size: 14 }),
876
+ isBusy ? '保存中…' : dirty ? '保存' : '已同步',
877
+ ),
878
+ ),
879
+ );
880
+ }
881
+
882
+ // ---------- 8. 主工作台(歸藏瑞士国际主义左栏 + 右主区架构)----------
883
+ function EvolutionPanel({ variant = 'page' }) {
884
+ const { data, error, loading, reload } = useSnapshot();
885
+ const [view, setView] = useState('home'); // home | drafts | skills | ledger | settings
886
+ const [busyKey, setBusyKey] = useState(null);
887
+ const [toast, setToast] = useState(null);
888
+ const [skillQuery, setSkillQuery] = useState('');
889
+ const [skillFilter, setSkillFilter] = useState('all');
890
+ const [consolidationPlan, setConsolidationPlan] = useState(null);
891
+ const [tidyPlan, setTidyPlan] = useState(null);
892
+
893
+ useEffect(() => {
894
+ if (!toast) return undefined;
895
+ const t = setTimeout(() => setToast(null), 4000);
896
+ return () => clearTimeout(t);
897
+ }, [toast]);
898
+
899
+ const act = useCallback(
900
+ async (key, fn, okMsg) => {
901
+ setBusyKey(key);
902
+ try {
903
+ const res = await fn();
904
+ if (okMsg) {
905
+ setToast({
906
+ message: typeof okMsg === 'function' ? okMsg(res) : okMsg,
907
+ tone: 'ok',
908
+ });
909
+ }
910
+ await reload();
911
+ return res;
912
+ } catch (e) {
913
+ setToast({ message: String(e.message || e), tone: 'err' });
914
+ return null;
915
+ } finally {
916
+ setBusyKey(null);
917
+ }
918
+ },
919
+ [reload],
920
+ );
921
+
922
+ if (loading && !data) {
923
+ return h('div', { className: 'evo-page' }, h('div', { className: 'evo-loading' }, '正在加载自进化数据…'));
924
+ }
925
+ if (error && !data) {
926
+ return h(
927
+ 'div',
928
+ { className: 'evo-loading' },
929
+ h('div', null, `连接失败:${error}`),
930
+ h(
931
+ 'button',
932
+ { type: 'button', className: 'evo-btn', style: { marginTop: '12px' }, onClick: () => reload() },
933
+ '重试连接',
934
+ ),
935
+ );
936
+ }
937
+
938
+ const stats = data?.stats ?? { skills: 0, agentCreated: 0, drafts: 0, ledger: 0, byState: {} };
939
+ const config = data?.config ?? {};
940
+ const drafts = data?.drafts ?? [];
941
+ const skills = data?.skills ?? [];
942
+ const ledger = data?.recentLedger ?? [];
943
+ const unmanaged = data?.unmanaged ?? [];
944
+ const lastReview = data?.lastReview ?? null;
945
+
946
+ const handleManualReview = () =>
947
+ act(
948
+ 'manual-review',
949
+ () => api('/review', { method: 'POST', body: '{}' }),
950
+ (r) =>
951
+ r?.result?.target
952
+ ? `复盘完成:已生成「${r.result.target}」`
953
+ : `复盘完成:${r?.result?.action || '当前会话无新技能信号'}`,
954
+ );
955
+
956
+ const handleRefine = (name, comment) =>
957
+ act(
958
+ `draft:${name}`,
959
+ () => api('/refine-draft', { method: 'POST', body: JSON.stringify({ name, comment }) }),
960
+ (r) => `AI 已按您的批示修订「${name}」:${r?.aiAnalysis || ''}`,
961
+ );
962
+
963
+ const handlePromote = (name, comment, evolveWithComment = false) =>
964
+ act(
965
+ `draft:${name}`,
966
+ () => api('/promote', { method: 'POST', body: JSON.stringify({ name, comment, evolveWithComment }) }),
967
+ `已采纳「${name}」进入正式技能库`,
968
+ );
969
+
970
+ const handleDiscard = (name, comment) =>
971
+ act(
972
+ `draft:${name}`,
973
+ () => api('/discard', { method: 'POST', body: JSON.stringify({ name, comment }) }),
974
+ `已驳回并销毁草稿「${name}」`,
975
+ );
976
+
977
+ const handleTidyPreview = () =>
978
+ act(
979
+ 'tidy-preview',
980
+ async () => {
981
+ const r = await api('/tidy', { method: 'POST', body: JSON.stringify({ dryRun: true }) });
982
+ setTidyPlan(r.plan);
983
+ return r;
984
+ },
985
+ (r) => {
986
+ const s = r?.plan?.summary || {};
987
+ return `整理方案:自动升级 ${s.autoPromote || 0} 份、自动归档 ${(s.corrupt || 0) + (s.autoDrop || 0)} 份、仅 ${s.groupsNeedingDecision || 0} 组需你决策`;
988
+ },
989
+ );
990
+
991
+ const handleTidyApply = () =>
992
+ act(
993
+ 'tidy-apply',
994
+ async () => {
995
+ const r = await api('/tidy', { method: 'POST', body: JSON.stringify({ dryRun: false }) });
996
+ setTidyPlan(r.plan);
997
+ return r;
998
+ },
999
+ (r) => `已整理:${(r?.done || []).length} 项机械动作完成(全部记入 SHA-256 账本可回滚)`,
1000
+ );
1001
+
1002
+ const handlePromoteBatch = () =>
1003
+ act(
1004
+ 'promote-batch',
1005
+ () => api('/promote-batch', { method: 'POST', body: JSON.stringify({ comment: '一键批量审阅采纳' }) }),
1006
+ (r) => `已一次性批量采纳 ${(r?.promoted || []).length} 个草稿(单次目录刷新)`,
1007
+ );
1008
+
1009
+ const handlePreviewConsolidate = () =>
1010
+ act(
1011
+ 'consolidate-preview',
1012
+ async () => {
1013
+ const r = await api('/consolidate', { method: 'POST', body: JSON.stringify({ dryRun: true }) });
1014
+ setConsolidationPlan(r);
1015
+ return r;
1016
+ },
1017
+ (r) => (r?.skipped ? `建伞分析:${r.reason}` : `已生成 ${(r?.planned || []).length} 项建伞合并预览`),
1018
+ );
1019
+
1020
+ const handleApplyConsolidate = () =>
1021
+ act(
1022
+ 'consolidate-apply',
1023
+ async () => {
1024
+ const r = await api('/consolidate', { method: 'POST', body: JSON.stringify({ dryRun: false }) });
1025
+ setConsolidationPlan(r);
1026
+ return r;
1027
+ },
1028
+ (r) => `已执行建伞合并:${(r?.done || []).length} 项变更已记入账本`,
1029
+ );
1030
+
1031
+ const heartbeatText = lastReview?.ts
1032
+ ? new Date(lastReview.ts).toLocaleTimeString('zh-CN', { hour12: false })
1033
+ : 'READY';
1034
+ const heartbeatSub = lastReview?.lastSaved?.target
1035
+ ? `最近产出: ${lastReview.lastSaved.target}`
1036
+ : lastReview?.target
1037
+ ? `最近产出: ${lastReview.target}`
1038
+ : lastReview?.status
1039
+ ? `状态: ${lastReview.status.toUpperCase()}`
1040
+ : '监听回合中';
1041
+
1042
+ const filteredSkills = skills.filter((s) => {
1043
+ if (skillFilter === 'agent' && s.createdBy !== 'agent') return false;
1044
+ if (skillFilter === 'active' && s.state !== 'active') return false;
1045
+ if (skillFilter === 'stale' && s.state !== 'stale') return false;
1046
+ if (skillFilter === 'archived' && s.state !== 'archived') return false;
1047
+ if (skillQuery.trim()) {
1048
+ const q = skillQuery.trim().toLowerCase();
1049
+ return (
1050
+ s.name.toLowerCase().includes(q) ||
1051
+ String(s.description || '').toLowerCase().includes(q)
1052
+ );
1053
+ }
1054
+ return true;
1055
+ });
1056
+
1057
+ const TABS = [
1058
+ ['home', '概览'],
1059
+ ['drafts', '待审草稿', stats.drafts],
1060
+ ['skills', '技能库', stats.skills],
1061
+ ['ledger', '账本', stats.ledger],
1062
+ ['settings', '参数'],
1063
+ ];
1064
+
1065
+ // 设置页插槽:只保留原生设置页该有的内容(参数 + 状态),审阅工作台在侧栏面板
1066
+ if (variant === 'settings') {
1067
+ return h(
1068
+ React.Fragment,
1069
+ null,
1070
+ h(
1071
+ 'div',
1072
+ { className: 'evo-page evo-page-settings' },
1073
+ h(
1074
+ 'div',
1075
+ { className: 'evo-page-inner' },
1076
+ h(
1077
+ 'header',
1078
+ { className: 'evo-page-head' },
1079
+ h(
1080
+ 'div',
1081
+ null,
1082
+ h('h1', { className: 'evo-page-title' }, '自进化'),
1083
+ h(
1084
+ 'p',
1085
+ { className: 'evo-page-lead' },
1086
+ '回合结束后自动复盘会话,把可复用流程与防坑规则蒸馏成技能草稿;审阅与入库在侧栏「自进化」中完成。',
1087
+ ),
1088
+ ),
1089
+ ),
1090
+ h(SwissSettingsPanel, {
1091
+ config,
1092
+ busyKey,
1093
+ onSave: (next) =>
1094
+ act(
1095
+ 'save-config',
1096
+ () => api('/config', { method: 'POST', body: JSON.stringify(next) }),
1097
+ '配置已保存并同步至内存节流器',
1098
+ ),
1099
+ }),
1100
+ ),
1101
+ ),
1102
+ toast
1103
+ ? h(
1104
+ 'div',
1105
+ { className: 'evo-toast' + (toast.tone === 'err' ? ' err' : '') },
1106
+ h('span', { className: 'evo-kicker' }, toast.tone === 'err' ? '错误' : '完成'),
1107
+ h('span', null, toast.message),
1108
+ )
1109
+ : null,
1110
+ );
1111
+ }
1112
+
1113
+ return h(
1114
+ 'div',
1115
+ { className: 'evo-page' },
1116
+ h(
1117
+ 'div',
1118
+ { className: 'evo-page-inner' },
1119
+ h(
1120
+ 'header',
1121
+ { className: 'evo-page-head' },
1122
+ h(
1123
+ 'div',
1124
+ null,
1125
+ h('h1', { className: 'evo-page-title' }, '自进化'),
1126
+ h(
1127
+ 'p',
1128
+ { className: 'evo-page-lead' },
1129
+ '回合结束后自动提取可复用流程与防坑规则。打开草稿可查看中文简报、点击步骤插入想法,或直接采纳进正式技能库。',
1130
+ ),
1131
+ ),
1132
+ h(
1133
+ 'div',
1134
+ { className: 'evo-head-actions' },
1135
+ drafts.length > 0
1136
+ ? h(
1137
+ 'button',
1138
+ {
1139
+ type: 'button',
1140
+ className: 'evo-btn',
1141
+ disabled: busyKey === 'tidy-preview' || busyKey === 'tidy-apply',
1142
+ onClick: handleTidyPreview,
1143
+ title: '先出方案:自动升级同名补丁、自动归档垃圾草稿,只把真正需要你决策的留下来',
1144
+ },
1145
+ h(SvgIcon, { d: ICONS.spark, size: 14 }),
1146
+ busyKey === 'tidy-preview' ? '正在分析…' : `一键整理 (${drafts.length})`,
1147
+ )
1148
+ : null,
1149
+ drafts.length > 1
1150
+ ? h(
1151
+ 'button',
1152
+ {
1153
+ type: 'button',
1154
+ className: 'evo-btn',
1155
+ disabled: busyKey === 'promote-batch',
1156
+ onClick: handlePromoteBatch,
1157
+ },
1158
+ h(SvgIcon, { d: ICONS.check, size: 14 }),
1159
+ busyKey === 'promote-batch' ? '批量入库中…' : `全部采纳 (${drafts.length})`,
1160
+ )
1161
+ : null,
1162
+ h(
1163
+ 'button',
1164
+ {
1165
+ type: 'button',
1166
+ className: 'evo-btn',
1167
+ onClick: () => reload(),
1168
+ },
1169
+ h(SvgIcon, { d: ICONS.refresh, size: 14 }),
1170
+ '刷新',
1171
+ ),
1172
+ h(
1173
+ 'button',
1174
+ {
1175
+ type: 'button',
1176
+ className: 'evo-btn primary',
1177
+ disabled: busyKey === 'manual-review',
1178
+ onClick: handleManualReview,
1179
+ },
1180
+ h(SvgIcon, { d: ICONS.play, size: 13 }),
1181
+ busyKey === 'manual-review' ? '正在复盘当前会话…' : '立即复盘当前会话',
1182
+ ),
1183
+ ),
1184
+ ),
1185
+
1186
+ // 原生分段标签页
1187
+ h(
1188
+ 'nav',
1189
+ { className: 'evo-tabs', role: 'tablist', 'aria-label': '自进化视图' },
1190
+ TABS.map(([id, label, count]) =>
1191
+ h(
1192
+ 'button',
1193
+ {
1194
+ key: id,
1195
+ type: 'button',
1196
+ role: 'tab',
1197
+ className: 'evo-tab',
1198
+ 'aria-selected': view === id ? 'true' : 'false',
1199
+ onClick: () => setView(id),
1200
+ },
1201
+ label,
1202
+ count !== null && count !== undefined
1203
+ ? h('span', { className: 'evo-tab-count' }, String(count))
1204
+ : null,
1205
+ ),
1206
+ ),
1207
+ ),
1208
+
1209
+ // 概览统计(原生行式,无自造卡片)
1210
+ h(
1211
+ 'div',
1212
+ { className: 'evo-stats' },
1213
+ h(
1214
+ 'div',
1215
+ { className: 'evo-stat', onClick: () => setView('drafts') },
1216
+ h('div', { className: 'evo-stat-label' }, '待审草稿'),
1217
+ h('div', { className: 'evo-stat-val' }, String(stats.drafts)),
1218
+ h('div', { className: 'evo-stat-sub' }, stats.drafts ? '等待您批示审阅' : '暂存区已清空'),
1219
+ ),
1220
+ h(
1221
+ 'div',
1222
+ { className: 'evo-stat', onClick: () => setView('skills') },
1223
+ h('div', { className: 'evo-stat-label' }, '正式技能'),
1224
+ h('div', { className: 'evo-stat-val' }, String(stats.skills)),
1225
+ h('div', { className: 'evo-stat-sub' }, `活跃 ${stats.byState?.active || 0} · 陈旧 ${stats.byState?.stale || 0}`),
1226
+ ),
1227
+ h(
1228
+ 'div',
1229
+ { className: 'evo-stat', onClick: () => setView('ledger') },
1230
+ h('div', { className: 'evo-stat-label' }, '账本快照'),
1231
+ h('div', { className: 'evo-stat-val' }, String(stats.ledger)),
1232
+ h('div', { className: 'evo-stat-sub' }, '内容寻址 · 可随时回滚'),
1233
+ ),
1234
+ h(
1235
+ 'div',
1236
+ { className: 'evo-stat', onClick: () => setView('settings') },
1237
+ h('div', { className: 'evo-stat-label' }, '最近心跳'),
1238
+ h('div', { className: 'evo-stat-val' }, heartbeatText),
1239
+ h('div', { className: 'evo-stat-sub' }, heartbeatSub),
1240
+ ),
1241
+ ),
1242
+ h(
1243
+ 'p',
1244
+ { className: 'evo-meta' },
1245
+ `模式 ${(config.mode || 'draft') === 'apply' ? '直接落盘' : '草稿审阅'} · 节流 ${config.minTurnsBetween || 1} 回合 / ${config.minMinutesBetween || 2} 分钟 · 心跳 ${heartbeatText}`,
1246
+ ),
1247
+
1248
+ // 视图 1 & 2:概览 / 待审草稿
1249
+ view === 'home' || view === 'drafts'
1250
+ ? h(
1251
+ React.Fragment,
1252
+ null,
1253
+ h(
1254
+ 'section',
1255
+ { className: 'evo-sec' },
1256
+ h(
1257
+ 'div',
1258
+ { className: 'evo-sec-head' },
1259
+ h('h2', { className: 'evo-sec-title' }, '待审阅技能草稿'),
1260
+ h('span', { className: 'evo-count' }, String(drafts.length)),
1261
+ drafts.length > 0
1262
+ ? h(
1263
+ 'span',
1264
+ { className: 'evo-kicker', style: { marginLeft: 'auto' } },
1265
+ '点击步骤可插入想法',
1266
+ )
1267
+ : null,
1268
+ ),
1269
+ tidyPlan
1270
+ ? h(
1271
+ 'div',
1272
+ { className: 'evo-tidy-box' },
1273
+ h(
1274
+ 'div',
1275
+ { className: 'evo-tidy-head' },
1276
+ h('span', { className: 'evo-ink' }, '整理方案'),
1277
+ h(
1278
+ 'span',
1279
+ { className: 'evo-tidy-stats' },
1280
+ h('span', null, `自动升级补丁 ${tidyPlan.summary?.autoPromote || 0}`),
1281
+ h('span', { className: 'evo-sep' }, '/'),
1282
+ h('span', null, `自动归档垃圾 ${(tidyPlan.summary?.corrupt || 0) + (tidyPlan.summary?.autoDrop || 0)}`),
1283
+ h('span', { className: 'evo-sep' }, '/'),
1284
+ h('span', { className: 'evo-accent' }, `需你决策 ${tidyPlan.summary?.groupsNeedingDecision || 0} 组`),
1285
+ ),
1286
+ h(
1287
+ 'div',
1288
+ { style: { marginLeft: 'auto', display: 'flex', gap: '8px' } },
1289
+ h(
1290
+ 'button',
1291
+ { type: 'button', className: 'evo-btn ghost', onClick: () => setTidyPlan(null) },
1292
+ '收起',
1293
+ ),
1294
+ h(
1295
+ 'button',
1296
+ {
1297
+ type: 'button',
1298
+ className: 'evo-btn',
1299
+ disabled: busyKey === 'tidy-apply',
1300
+ onClick: handleTidyApply,
1301
+ },
1302
+ h(SvgIcon, { d: ICONS.check, size: 13 }),
1303
+ busyKey === 'tidy-apply' ? '执行中…' : '执行机械部分',
1304
+ ),
1305
+ ),
1306
+ ),
1307
+ h(
1308
+ 'div',
1309
+ { className: 'evo-tidy-grid' },
1310
+ (tidyPlan.autoPromote || []).length
1311
+ ? h(
1312
+ 'div',
1313
+ { className: 'evo-tidy-cell' },
1314
+ h('div', { className: 'evo-kicker evo-ok-label' }, '自动升级(可回滚)'),
1315
+ tidyPlan.autoPromote.map((c) =>
1316
+ h('div', { key: c.name, className: 'evo-tidy-item' }, `· ${c.name} → ${c.anchor}`),
1317
+ ),
1318
+ )
1319
+ : null,
1320
+ (tidyPlan.corrupt || []).length + (tidyPlan.autoDrop || []).length
1321
+ ? h(
1322
+ 'div',
1323
+ { className: 'evo-tidy-cell' },
1324
+ h('div', { className: 'evo-kicker' }, '自动归入 .archive(不删除)'),
1325
+ [...(tidyPlan.corrupt || []), ...(tidyPlan.autoDrop || [])].map((c) =>
1326
+ h('div', { key: c.name, className: 'evo-tidy-item' }, `· ${c.name}`),
1327
+ ),
1328
+ )
1329
+ : null,
1330
+ (tidyPlan.groups || []).length
1331
+ ? h(
1332
+ 'div',
1333
+ { className: 'evo-tidy-cell evo-tidy-cell-wide' },
1334
+ h('div', { className: 'evo-kicker evo-accent' }, '需要你拍板的分组'),
1335
+ tidyPlan.groups.map((g) =>
1336
+ h(
1337
+ 'div',
1338
+ { key: g.theme, className: 'evo-tidy-group' },
1339
+ h(
1340
+ 'div',
1341
+ { className: 'evo-tidy-group-head' },
1342
+ h('span', { className: 'evo-tidy-group-name' }, g.theme),
1343
+ h(
1344
+ 'span',
1345
+ { className: 'evo-kicker ' + (g.suggestion === 'merge' ? 'evo-accent' : 'evo-muted') },
1346
+ g.suggestion === 'merge' ? `建议合并 ${g.members.length} 份` : '可单独采纳',
1347
+ ),
1348
+ ),
1349
+ h(
1350
+ 'div',
1351
+ { className: 'evo-tidy-members' },
1352
+ g.members.map((m) =>
1353
+ h(
1354
+ 'button',
1355
+ {
1356
+ key: m,
1357
+ type: 'button',
1358
+ className: 'evo-pill',
1359
+ onClick: () =>
1360
+ act(
1361
+ `draft:${m}`,
1362
+ () =>
1363
+ api('/promote', {
1364
+ method: 'POST',
1365
+ body: JSON.stringify({ name: m, comment: '一键整理:采纳', evolveWithComment: false }),
1366
+ }),
1367
+ `已采纳「${m}」`,
1368
+ ),
1369
+ },
1370
+ m,
1371
+ ),
1372
+ ),
1373
+ ),
1374
+ ),
1375
+ ),
1376
+ )
1377
+ : null,
1378
+ ),
1379
+ )
1380
+ : null,
1381
+ drafts.length
1382
+ ? h(
1383
+ 'div',
1384
+ { className: 'evo-draft-list' },
1385
+ drafts.map((d) =>
1386
+ h(SwissDraftCard, {
1387
+ key: d.name,
1388
+ draft: d,
1389
+ busyKey,
1390
+ onRefine: handleRefine,
1391
+ onPromote: handlePromote,
1392
+ onDiscard: handleDiscard,
1393
+ }),
1394
+ ),
1395
+ )
1396
+ : h(
1397
+ 'div',
1398
+ { className: 'evo-empty' },
1399
+ h('div', { className: 'evo-ink' }, '暂无待审草稿'),
1400
+ h('p', null, '当前没有待审阅的技能草稿。点击右上角「立即复盘当前会话」可随时提取新草稿。'),
1401
+ ),
1402
+ ),
1403
+ view === 'home'
1404
+ ? h(
1405
+ 'section',
1406
+ { className: 'evo-sec' },
1407
+ h(
1408
+ 'div',
1409
+ { className: 'evo-sec-head' },
1410
+ h('h2', { className: 'evo-sec-title' }, '最近账本变动'),
1411
+ h(
1412
+ 'button',
1413
+ { type: 'button', className: 'evo-more', onClick: () => setView('ledger') },
1414
+ '查看全部账本',
1415
+ h(SvgIcon, { d: ICONS.arrowRight, size: 13 }),
1416
+ ),
1417
+ ),
1418
+ h(
1419
+ 'div',
1420
+ { className: 'evo-list' },
1421
+ ledger.slice(0, 5).map((e) =>
1422
+ h(SwissLedgerRow, {
1423
+ key: e.id,
1424
+ entry: e,
1425
+ busyKey,
1426
+ onRollback: (id, target) =>
1427
+ act(
1428
+ `rb:${id}`,
1429
+ () => api('/rollback', { method: 'POST', body: JSON.stringify({ id }) }),
1430
+ `已回滚「${target}」`,
1431
+ ),
1432
+ }),
1433
+ ),
1434
+ ),
1435
+ )
1436
+ : null,
1437
+ )
1438
+ : null,
1439
+
1440
+ // 视图 3:正式技能与建伞合并
1441
+ view === 'skills'
1442
+ ? h(
1443
+ React.Fragment,
1444
+ null,
1445
+ h(
1446
+ 'section',
1447
+ { className: 'evo-sec' },
1448
+ h(
1449
+ 'div',
1450
+ { className: 'evo-sec-head' },
1451
+ h('h2', { className: 'evo-sec-title' }, '合并为大伞技能'),
1452
+ h(
1453
+ 'div',
1454
+ { className: 'evo-sec-actions' },
1455
+ h(
1456
+ 'button',
1457
+ {
1458
+ type: 'button',
1459
+ className: 'evo-btn ghost',
1460
+ disabled: busyKey === 'consolidate-preview',
1461
+ onClick: handlePreviewConsolidate,
1462
+ },
1463
+ busyKey === 'consolidate-preview' ? '分析中…' : '预览合并计划 (Dry-Run)',
1464
+ ),
1465
+ consolidationPlan?.planned?.length
1466
+ ? h(
1467
+ 'button',
1468
+ {
1469
+ type: 'button',
1470
+ className: 'evo-btn',
1471
+ disabled: busyKey === 'consolidate-apply',
1472
+ onClick: handleApplyConsolidate,
1473
+ },
1474
+ busyKey === 'consolidate-apply' ? '执行中…' : '确认执行合并',
1475
+ )
1476
+ : null,
1477
+ ),
1478
+ ),
1479
+ consolidationPlan
1480
+ ? h(
1481
+ 'div',
1482
+ { className: 'evo-plan-box' },
1483
+ h(
1484
+ 'div',
1485
+ { className: 'evo-mono' },
1486
+ consolidationPlan.skipped
1487
+ ? `已跳过:${consolidationPlan.reason}`
1488
+ : consolidationPlan.summary || `计划操作:${(consolidationPlan.planned || []).length} 项`,
1489
+ ),
1490
+ (consolidationPlan.planned || []).map((p, i) =>
1491
+ h('div', { key: i, className: 'evo-mono evo-muted' }, `· ${p}`),
1492
+ ),
1493
+ )
1494
+ : h(
1495
+ 'p',
1496
+ { className: 'evo-field-hint' },
1497
+ '将多个重叠的窄技能蒸馏合并为高内聚「类级别大伞技能」,减少目录行数并提升路由准确度(被吸收的旧技能自动归入 .archive 并记入 SHA-256 账本)。',
1498
+ ),
1499
+ ),
1500
+
1501
+ h(
1502
+ 'section',
1503
+ { className: 'evo-sec' },
1504
+ h(
1505
+ 'div',
1506
+ { className: 'evo-sec-head' },
1507
+ h('h2', { className: 'evo-sec-title' }, '正式技能库'),
1508
+ h('span', { className: 'evo-count' }, String(filteredSkills.length)),
1509
+ ),
1510
+ h(
1511
+ 'div',
1512
+ { className: 'evo-toolbar' },
1513
+ h(
1514
+ 'div',
1515
+ { className: 'evo-search' },
1516
+ h(SvgIcon, { d: ICONS.search, size: 14 }),
1517
+ h('input', {
1518
+ type: 'text',
1519
+ placeholder: '搜索技能名称或描述…',
1520
+ value: skillQuery,
1521
+ onChange: (e) => setSkillQuery(e.target.value),
1522
+ }),
1523
+ ),
1524
+ h(
1525
+ 'div',
1526
+ { className: 'evo-pills-row', style: { marginLeft: 'auto' } },
1527
+ [
1528
+ ['all', `全部 (${skills.length})`],
1529
+ ['active', `活跃 (${stats.byState?.active || 0})`],
1530
+ ['stale', `陈旧 (${stats.byState?.stale || 0})`],
1531
+ ['archived', `归档 (${stats.byState?.archived || 0})`],
1532
+ ].map(([id, label]) =>
1533
+ h(
1534
+ 'button',
1535
+ {
1536
+ key: id,
1537
+ type: 'button',
1538
+ className: 'evo-pill',
1539
+ 'aria-pressed': skillFilter === id ? 'true' : 'false',
1540
+ onClick: () => setSkillFilter(id),
1541
+ },
1542
+ label,
1543
+ ),
1544
+ ),
1545
+ ),
1546
+ ),
1547
+ h(
1548
+ 'div',
1549
+ { className: 'evo-list' },
1550
+ filteredSkills.map((s) =>
1551
+ h(SwissSkillRow, {
1552
+ key: s.name,
1553
+ skill: s,
1554
+ busyKey,
1555
+ onPin: (name, pinned) =>
1556
+ act(
1557
+ `skill:${name}`,
1558
+ () => api('/pin', { method: 'POST', body: JSON.stringify({ name, pinned }) }),
1559
+ pinned ? `已固定「${name}」` : `已取消固定「${name}」`,
1560
+ ),
1561
+ onDisown: (name) =>
1562
+ act(
1563
+ `skill:${name}`,
1564
+ () => api('/disown', { method: 'POST', body: JSON.stringify({ name }) }),
1565
+ `已脱离「${name}」`,
1566
+ ),
1567
+ }),
1568
+ ),
1569
+ ),
1570
+ ),
1571
+
1572
+ unmanaged.length
1573
+ ? h(
1574
+ 'section',
1575
+ { className: 'evo-sec' },
1576
+ h(
1577
+ 'div',
1578
+ { className: 'evo-sec-head' },
1579
+ h('h2', { className: 'evo-sec-title' }, '外部 / 手写未纳管技能'),
1580
+ h('span', { className: 'evo-count' }, String(unmanaged.length)),
1581
+ ),
1582
+ h(
1583
+ 'div',
1584
+ { className: 'evo-list' },
1585
+ unmanaged.map((name) =>
1586
+ h(
1587
+ 'div',
1588
+ { key: name, className: 'evo-row-card' },
1589
+ h(
1590
+ 'div',
1591
+ { className: 'evo-row-line' },
1592
+ h(
1593
+ 'div',
1594
+ { className: 'evo-row-main' },
1595
+ h(
1596
+ 'div',
1597
+ { className: 'evo-row-title-line' },
1598
+ h('span', { className: 'evo-row-name' }, name),
1599
+ h('span', { className: 'evo-badge' }, '未纳管'),
1600
+ ),
1601
+ h('span', { className: 'evo-row-desc' }, '用户手写或外部导入(默认受保护,不自动修改)'),
1602
+ ),
1603
+ h(
1604
+ 'div',
1605
+ { className: 'evo-row-end' },
1606
+ h(
1607
+ 'button',
1608
+ {
1609
+ type: 'button',
1610
+ className: 'evo-btn',
1611
+ onClick: () =>
1612
+ act(
1613
+ `adopt:${name}`,
1614
+ () => api('/adopt', { method: 'POST', body: JSON.stringify({ name }) }),
1615
+ `已纳管「${name}」`,
1616
+ ),
1617
+ },
1618
+ '纳入统计',
1619
+ ),
1620
+ ),
1621
+ ),
1622
+ ),
1623
+ ),
1624
+ ),
1625
+ )
1626
+ : null,
1627
+ )
1628
+ : null,
1629
+
1630
+ // 视图 4:SHA-256 账本
1631
+ view === 'ledger'
1632
+ ? h(
1633
+ 'section',
1634
+ { className: 'evo-sec' },
1635
+ h(
1636
+ 'div',
1637
+ { className: 'evo-sec-head' },
1638
+ h('h2', { className: 'evo-sec-title' }, 'SHA-256 内容寻址账本'),
1639
+ h('span', { className: 'evo-count' }, String(ledger.length)),
1640
+ h('span', { className: 'evo-kicker', style: { marginLeft: 'auto' } }, '.evolution_ledger.jsonl'),
1641
+ ),
1642
+ h(
1643
+ 'div',
1644
+ { className: 'evo-list' },
1645
+ ledger.map((e) =>
1646
+ h(SwissLedgerRow, {
1647
+ key: e.id,
1648
+ entry: e,
1649
+ busyKey,
1650
+ onRollback: (id, target) =>
1651
+ act(
1652
+ `rb:${id}`,
1653
+ () => api('/rollback', { method: 'POST', body: JSON.stringify({ id }) }),
1654
+ `已回滚「${target}」`,
1655
+ ),
1656
+ }),
1657
+ ),
1658
+ ),
1659
+ )
1660
+ : null,
1661
+
1662
+ // 视图 5:引擎配置
1663
+ view === 'settings'
1664
+ ? h(
1665
+ 'section',
1666
+ { className: 'evo-sec' },
1667
+ h(
1668
+ 'div',
1669
+ { className: 'evo-sec-head' },
1670
+ h('h2', { className: 'evo-sec-title' }, '引擎与节流参数'),
1671
+ ),
1672
+ h(SwissSettingsPanel, {
1673
+ config,
1674
+ busyKey,
1675
+ onSave: (next) =>
1676
+ act(
1677
+ 'save-config',
1678
+ () => api('/config', { method: 'POST', body: JSON.stringify(next) }),
1679
+ '配置已保存并同步至内存节流器',
1680
+ ),
1681
+ }),
1682
+ )
1683
+ : null,
1684
+ ),
1685
+
1686
+ toast
1687
+ ? h(
1688
+ 'div',
1689
+ { className: 'evo-toast' + (toast.tone === 'err' ? ' err' : '') },
1690
+ h('span', { className: 'evo-kicker' }, toast.tone === 'err' ? '错误' : '完成'),
1691
+ h('span', null, toast.message),
1692
+ )
1693
+ : null,
1694
+ );
1695
+ }
1696
+
1697
+ // ---------- 9. 原生样式表(对齐 DSH 设置页:720px 容器 / 20·14·12 字号阶梯 / .5px 行线 / token 取色)----------
1698
+ const CSS = `
1699
+ .evo-page {
1700
+ --evo-radius-sm: var(--dsw-radius-sm, 6px);
1701
+ --evo-radius-md: var(--dsw-radius-md, 8px);
1702
+ box-sizing: border-box;
1703
+ width: 100%;
1704
+ height: 100%;
1705
+ overflow-y: auto;
1706
+ color: var(--dsw-alias-label-primary);
1707
+ font-family: inherit;
1708
+ font-size: 14px;
1709
+ line-height: 20px;
1710
+ padding: 0 clamp(24px, 4vw, 48px);
1711
+ -webkit-font-smoothing: antialiased;
1712
+ }
1713
+ .evo-page *, .evo-page *::before, .evo-page *::after { box-sizing: border-box; }
1714
+ .evo-page-inner {
1715
+ display: flex;
1716
+ flex-direction: column;
1717
+ gap: 20px;
1718
+ width: 100%;
1719
+ max-width: 720px;
1720
+ margin: 0 auto;
1721
+ padding: 28px 0 64px;
1722
+ }
1723
+ .evo-page-settings { height: auto; overflow: visible; padding: 0; }
1724
+ .evo-page-settings .evo-page-inner { gap: 16px; padding: 4px 0 24px; }
1725
+
1726
+ /* 页头 */
1727
+ .evo-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
1728
+ .evo-page-title { margin: 0; font-size: 20px; font-weight: 500; line-height: 28px; color: var(--dsw-alias-label-primary); }
1729
+ .evo-page-lead { margin: 4px 0 0; max-width: 60ch; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }
1730
+ .evo-head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
1731
+ .evo-meta { margin: -8px 0 0; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); }
1732
+
1733
+ /* 分段标签页(原生 SegmentedTabs 观感) */
1734
+ .evo-tabs {
1735
+ display: inline-flex;
1736
+ align-items: center;
1737
+ gap: 2px;
1738
+ width: fit-content;
1739
+ max-width: 100%;
1740
+ padding: 2px;
1741
+ overflow-x: auto;
1742
+ border: .5px solid var(--dsw-alias-border-l2);
1743
+ border-radius: var(--evo-radius-md);
1744
+ background: var(--dsw-alias-bg-layer-2);
1745
+ }
1746
+ .evo-tab {
1747
+ display: inline-flex;
1748
+ align-items: center;
1749
+ gap: 6px;
1750
+ height: 32px;
1751
+ padding: 0 12px;
1752
+ border: .5px solid transparent;
1753
+ border-radius: var(--evo-radius-sm);
1754
+ background: transparent;
1755
+ color: var(--dsw-alias-label-secondary);
1756
+ font: inherit;
1757
+ font-size: 13px;
1758
+ line-height: 20px;
1759
+ white-space: nowrap;
1760
+ cursor: pointer;
1761
+ }
1762
+ .evo-tab:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }
1763
+ .evo-tab[aria-selected="true"] {
1764
+ border-color: var(--dsw-alias-border-l2);
1765
+ background: var(--dsw-alias-bg-base);
1766
+ color: var(--dsw-alias-label-primary);
1767
+ font-weight: 500;
1768
+ }
1769
+ .evo-tab:focus-visible { outline: var(--dsw-focus-ring-width, 2px) solid var(--dsw-focus-ring-color); outline-offset: 2px; }
1770
+ .evo-tab-count { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }
1771
+
1772
+ /* 概览统计 */
1773
+ .evo-stats {
1774
+ display: grid;
1775
+ grid-template-columns: repeat(4, minmax(0, 1fr));
1776
+ border-top: .5px solid var(--dsw-alias-border-l2);
1777
+ border-bottom: .5px solid var(--dsw-alias-border-l2);
1778
+ }
1779
+ .evo-stat { min-width: 0; padding: 12px 16px; border-left: .5px solid var(--dsw-alias-border-l2); cursor: pointer; }
1780
+ .evo-stat:first-child { padding-left: 0; border-left: 0; }
1781
+ .evo-stat:hover { background: var(--dsw-alias-interactive-bg-hover); }
1782
+ .evo-stat-label { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); }
1783
+ .evo-stat-val { margin-top: 2px; font-size: 20px; font-weight: 500; line-height: 28px; font-variant-numeric: tabular-nums; }
1784
+ .evo-stat-sub { margin-top: 2px; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1785
+
1786
+ /* 分节 */
1787
+ .evo-sec { display: flex; flex-direction: column; }
1788
+ .evo-sec-head { display: flex; align-items: center; gap: 12px; padding-bottom: 2px; }
1789
+ .evo-sec-title { margin: 0; font-size: 14px; font-weight: 500; line-height: 20px; color: var(--dsw-alias-label-primary); }
1790
+ .evo-count { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }
1791
+ .evo-sec-head .evo-link-btn { margin-left: auto; }
1792
+ .evo-sec-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
1793
+ .evo-more {
1794
+ display: inline-flex; align-items: center; gap: 4px;
1795
+ margin-left: auto; padding: 0; border: 0; border-radius: 4px;
1796
+ background: transparent; color: var(--dsw-alias-label-secondary);
1797
+ font: inherit; font-size: 12px; line-height: 18px; cursor: pointer;
1798
+ }
1799
+ .evo-more:hover { color: var(--dsw-alias-label-primary); }
1800
+
1801
+ /* 列表行 */
1802
+ .evo-list { display: flex; flex-direction: column; border-top: .5px solid var(--dsw-alias-border-l2); }
1803
+ .evo-row-card { border-bottom: .5px solid var(--dsw-alias-border-l2); }
1804
+ .evo-list > .evo-row-card:last-child { border-bottom: 0; }
1805
+ .evo-row-line { display: flex; align-items: center; gap: 12px; padding: 16px 0; flex-wrap: wrap; min-width: 0; }
1806
+ .evo-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
1807
+ .evo-row-title-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
1808
+ .evo-row-name {
1809
+ padding: 0; border: 0; border-radius: 4px; background: none; cursor: pointer;
1810
+ color: var(--dsw-alias-label-primary); font: inherit; font-size: 14px; font-weight: 500; line-height: 20px;
1811
+ overflow: hidden; text-overflow: ellipsis;
1812
+ }
1813
+ .evo-row-name:hover { text-decoration: underline; text-underline-offset: 3px; }
1814
+ .evo-row-desc { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 56ch; }
1815
+ .evo-row-end { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }
1816
+ .evo-row-meta { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
1817
+ .evo-drawer { padding: 12px 0 16px; border-top: .5px solid var(--dsw-alias-border-l2); }
1818
+ .evo-drawer .evo-code-box { margin-top: 0; }
1819
+
1820
+ /* 徽章与文本 */
1821
+ .evo-badge {
1822
+ display: inline-flex; align-items: center; height: 20px; padding: 0 8px;
1823
+ border: .5px solid var(--dsw-alias-label-secondary); border-radius: 999px;
1824
+ color: var(--dsw-alias-label-secondary); font-size: 12px; line-height: 18px; white-space: nowrap;
1825
+ }
1826
+ .evo-badge-info { border-color: var(--dsw-alias-state-business-primary); color: var(--dsw-alias-state-business-primary); }
1827
+ .evo-badge-ok { border-color: var(--dsw-alias-state-success-primary); color: var(--dsw-alias-state-success-primary); }
1828
+ .evo-kicker { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); }
1829
+ .evo-mono { font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace; font-size: 12px; line-height: 18px; }
1830
+ .evo-muted { color: var(--dsw-alias-label-secondary); }
1831
+ .evo-ink { color: var(--dsw-alias-label-primary); font-weight: 500; }
1832
+ .evo-accent { color: var(--dsw-alias-state-business-primary); }
1833
+ .evo-sep { color: var(--dsw-alias-label-tertiary); }
1834
+ .evo-pitfall-item { overflow-wrap: anywhere; }
1835
+ .evo-ok-label { color: var(--dsw-alias-label-primary); font-weight: 500; }
1836
+
1837
+ /* 按钮 */
1838
+ .evo-btn {
1839
+ display: inline-flex; align-items: center; justify-content: center; gap: 6px;
1840
+ height: 32px; padding: 0 12px;
1841
+ border: .5px solid var(--dsw-alias-border-l2); border-radius: var(--evo-radius-sm);
1842
+ background: transparent; color: var(--dsw-alias-label-primary);
1843
+ font: inherit; font-size: 13px; line-height: 20px; white-space: nowrap; cursor: pointer;
1844
+ transition: background-color .12s ease, border-color .12s ease, color .12s ease;
1845
+ }
1846
+ .evo-btn:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }
1847
+ .evo-btn:active:not(:disabled) { background: var(--dsw-alias-interactive-bg-active); }
1848
+ .evo-btn:disabled { opacity: .45; cursor: not-allowed; }
1849
+ .evo-btn:focus-visible { outline: var(--dsw-focus-ring-width, 2px) solid var(--dsw-focus-ring-color); outline-offset: 2px; }
1850
+ .evo-btn.primary { border-color: transparent; background: var(--dsw-alias-label-primary); color: var(--dsw-alias-bg-base); }
1851
+ .evo-btn.primary:hover:not(:disabled) { background: var(--dsw-alias-label-primary); opacity: .88; }
1852
+ .evo-btn.ghost { background: transparent; color: var(--dsw-alias-label-primary); }
1853
+ .evo-btn.danger { color: var(--dsw-alias-state-error-primary); }
1854
+ .evo-btn.danger:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover-danger, var(--dsw-alias-interactive-bg-hover)); }
1855
+ .evo-ibtn {
1856
+ display: inline-flex; align-items: center; justify-content: center; flex: none;
1857
+ width: 28px; height: 28px; padding: 0;
1858
+ border: 0; border-radius: var(--evo-radius-sm); background: transparent;
1859
+ color: var(--dsw-alias-label-secondary); cursor: pointer;
1860
+ }
1861
+ .evo-ibtn:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }
1862
+ .evo-ibtn.on { color: var(--dsw-alias-label-primary); background: var(--dsw-alias-interactive-bg-active); }
1863
+ .evo-ibtn:focus-visible { outline: var(--dsw-focus-ring-width, 2px) solid var(--dsw-focus-ring-color); outline-offset: 2px; }
1864
+ .evo-link-btn {
1865
+ display: inline-flex; align-items: center; gap: 4px;
1866
+ padding: 2px 0; border: 0; border-radius: 4px; background: none;
1867
+ color: var(--dsw-alias-label-secondary); font: inherit; font-size: 12px; line-height: 18px; cursor: pointer;
1868
+ }
1869
+ .evo-link-btn:hover { color: var(--dsw-alias-label-primary); }
1870
+ .evo-link-btn:disabled { opacity: .45; cursor: not-allowed; }
1871
+ .evo-link-btn:focus-visible { outline: var(--dsw-focus-ring-width, 2px) solid var(--dsw-focus-ring-color); outline-offset: 2px; }
1872
+
1873
+ /* 草稿卡 */
1874
+ .evo-draft-list { display: flex; flex-direction: column; border-top: .5px solid var(--dsw-alias-border-l2); }
1875
+ .evo-draft { padding: 16px 0; border-bottom: .5px solid var(--dsw-alias-border-l2); }
1876
+ .evo-draft-list > .evo-draft:last-child { border-bottom: 0; }
1877
+ .evo-draft-compact { padding: 12px 0; }
1878
+ .evo-compact-row { display: flex; align-items: center; gap: 12px; min-width: 0; flex-wrap: nowrap; }
1879
+ .evo-compact-name { flex: none; max-width: 26ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; line-height: 20px; }
1880
+ .evo-compact-sum { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); }
1881
+ .evo-compact-actions { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }
1882
+ .evo-draft-kicker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-bottom: 8px; color: var(--dsw-alias-label-secondary); }
1883
+ .evo-draft-kicker .evo-link-btn { margin-left: auto; }
1884
+ .evo-draft-main { padding: 0; }
1885
+ .evo-draft-title { margin: 0; font-size: 16px; font-weight: 500; line-height: 24px; color: var(--dsw-alias-label-primary); }
1886
+ .evo-draft-summary { margin: 4px 0 0; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }
1887
+ .evo-trigger-line { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); }
1888
+ .evo-trigger-line .evo-kicker { flex: none; }
1889
+
1890
+ /* 步骤、护栏、后果 */
1891
+ .evo-steps-grid {
1892
+ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px;
1893
+ margin-top: 8px; border-top: .5px solid var(--dsw-alias-border-l2);
1894
+ }
1895
+ .evo-step-cell {
1896
+ display: flex; flex-direction: column; gap: 2px;
1897
+ padding: 12px 0; border: 0; border-bottom: .5px solid var(--dsw-alias-border-l2);
1898
+ background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
1899
+ }
1900
+ .evo-step-cell:hover, .evo-step-cell.on { background: var(--dsw-alias-interactive-bg-hover); }
1901
+ .evo-step-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
1902
+ .evo-step-label { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }
1903
+ .evo-step-add { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); opacity: 0; transition: opacity .12s ease; }
1904
+ .evo-step-cell:hover .evo-step-add, .evo-step-cell.on .evo-step-add { opacity: 1; }
1905
+ .evo-step-body { font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-primary); }
1906
+ .evo-pitfalls {
1907
+ display: flex; align-items: baseline; gap: 12px; padding: 12px 0;
1908
+ border-bottom: .5px solid var(--dsw-alias-border-l2); font-size: 12px; line-height: 18px;
1909
+ }
1910
+ .evo-pitfalls-list { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--dsw-alias-label-secondary); }
1911
+ .evo-outcomes {
1912
+ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px;
1913
+ padding: 12px 0; border-bottom: .5px solid var(--dsw-alias-border-l2);
1914
+ }
1915
+ .evo-outcome-cell { min-width: 0; }
1916
+ .evo-outcome-cell p { margin: 4px 0 0; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); }
1917
+ .evo-ai-note {
1918
+ display: flex; align-items: baseline; gap: 12px; padding: 12px 0;
1919
+ border-bottom: .5px solid var(--dsw-alias-border-l2); font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary);
1920
+ }
1921
+ .evo-ai-note .evo-kicker { flex: none; color: var(--dsw-alias-label-primary); }
1922
+
1923
+ /* 批示与操作 */
1924
+ .evo-draft-foot { display: flex; flex-direction: column; gap: 8px; padding: 12px 0 0; }
1925
+ .evo-pills-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
1926
+ .evo-pill {
1927
+ height: 28px; padding: 0 10px;
1928
+ border: .5px solid var(--dsw-alias-border-l2); border-radius: var(--evo-radius-sm);
1929
+ background: transparent; color: var(--dsw-alias-label-secondary);
1930
+ font: inherit; font-size: 12px; line-height: 18px; cursor: pointer;
1931
+ transition: background-color .12s ease, border-color .12s ease, color .12s ease;
1932
+ }
1933
+ .evo-pill:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }
1934
+ .evo-pill[aria-pressed="true"] {
1935
+ border-color: var(--dsw-alias-border-l3);
1936
+ background: var(--dsw-alias-interactive-bg-active);
1937
+ color: var(--dsw-alias-label-primary);
1938
+ }
1939
+ .evo-pill:focus-visible { outline: var(--dsw-focus-ring-width, 2px) solid var(--dsw-focus-ring-color); outline-offset: 2px; }
1940
+ .evo-action-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
1941
+ .evo-input {
1942
+ height: 32px; padding: 0 10px;
1943
+ border: .5px solid var(--dsw-alias-border-l3); border-radius: var(--evo-radius-sm);
1944
+ background: var(--dsw-alias-bg-layer-3); color: var(--dsw-alias-label-primary);
1945
+ font: inherit; font-size: 13px; line-height: 20px;
1946
+ }
1947
+ .evo-input::placeholder { color: var(--dsw-alias-label-tertiary); }
1948
+ .evo-input:focus {
1949
+ outline: none;
1950
+ border-color: var(--dsw-alias-brand-primary);
1951
+ box-shadow: inset 0 0 0 .5px var(--dsw-alias-brand-primary);
1952
+ }
1953
+ .evo-directive-input { flex: 1; min-width: 240px; }
1954
+ .evo-input-num { width: 96px; text-align: right; font-variant-numeric: tabular-nums; }
1955
+ .evo-input-wide { width: 240px; max-width: 100%; }
1956
+ .evo-inline-fields { display: grid; grid-template-columns: repeat(2, 96px); gap: 8px; }
1957
+
1958
+ /* 搜索与工具栏 */
1959
+ .evo-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
1960
+ .evo-search { position: relative; flex: 0 1 280px; }
1961
+ .evo-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--dsw-alias-label-tertiary); }
1962
+ .evo-search input {
1963
+ width: 100%; height: 32px; padding: 0 10px 0 32px;
1964
+ border: .5px solid var(--dsw-alias-border-l3); border-radius: var(--evo-radius-sm);
1965
+ background: var(--dsw-alias-bg-layer-3); color: var(--dsw-alias-label-primary);
1966
+ font: inherit; font-size: 13px; line-height: 20px;
1967
+ }
1968
+ .evo-search input::placeholder { color: var(--dsw-alias-label-tertiary); }
1969
+ .evo-search input:focus { outline: none; border-color: var(--dsw-alias-brand-primary); box-shadow: inset 0 0 0 .5px var(--dsw-alias-brand-primary); }
1970
+
1971
+ /* 代码与表格 */
1972
+ .evo-code-box { margin-top: 8px; border: .5px solid var(--dsw-alias-border-l2); border-radius: var(--evo-radius-md); background: var(--dsw-alias-bg-layer-2); overflow: hidden; }
1973
+ .evo-code-fm { display: flex; flex-wrap: wrap; gap: 12px; padding: 8px 12px; border-bottom: .5px solid var(--dsw-alias-border-l2); font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); }
1974
+ .evo-code-fm-item strong { color: var(--dsw-alias-label-primary); font-weight: 500; }
1975
+ .evo-code-pre { margin: 0; max-height: 320px; overflow: auto; padding: 8px 0; font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-primary); }
1976
+ .evo-code-line { display: flex; padding: 0 12px; }
1977
+ .evo-code-num { width: 24px; margin-right: 12px; flex: none; color: var(--dsw-alias-label-tertiary); text-align: right; user-select: none; }
1978
+ .evo-code-txt { white-space: pre-wrap; word-break: break-word; }
1979
+ .evo-table { width: 100%; border-collapse: collapse; font-size: 12px; line-height: 18px; }
1980
+ .evo-table th, .evo-table td { padding: 8px; border-bottom: .5px solid var(--dsw-alias-border-l2); text-align: left; vertical-align: top; }
1981
+ .evo-table th { color: var(--dsw-alias-label-tertiary); font-weight: 400; white-space: nowrap; }
1982
+
1983
+ /* 设置分组(原生设置行) */
1984
+ .evo-settings-box { margin: 0; }
1985
+ .evo-settings-grid { display: flex; flex-direction: column; border-top: .5px solid var(--dsw-alias-border-l2); }
1986
+ .evo-field { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 0; border-bottom: .5px solid var(--dsw-alias-border-l2); }
1987
+ .evo-field:last-child { border-bottom: 0; }
1988
+ .evo-field-main { min-width: 0; }
1989
+ .evo-field-label { font-size: 14px; line-height: 20px; color: var(--dsw-alias-label-primary); }
1990
+ .evo-field-hint { margin-top: 4px; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); }
1991
+ .evo-field-control { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: none; flex-wrap: wrap; }
1992
+ .evo-settings-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; border-top: .5px solid var(--dsw-alias-border-l2); }
1993
+ .evo-settings-foot .evo-kicker { overflow-wrap: anywhere; }
1994
+
1995
+ /* 开关(对齐宿主 36×20) */
1996
+ .evo-switch {
1997
+ position: relative; flex: none; width: 36px; height: 20px; padding: 2px;
1998
+ border: 0; border-radius: 999px;
1999
+ background: var(--dsw-alias-border-l3, var(--dsw-alias-border-l2));
2000
+ cursor: pointer; -webkit-appearance: none; appearance: none;
2001
+ transition: background-color .12s ease;
2002
+ }
2003
+ .evo-switch[aria-checked="true"] { background: var(--dsw-alias-brand-primary); }
2004
+ .evo-switch:disabled { opacity: .45; cursor: not-allowed; }
2005
+ .evo-switch:focus-visible { outline: var(--dsw-focus-ring-width, 2px) solid var(--dsw-focus-ring-color); outline-offset: 2px; }
2006
+ .evo-thumb {
2007
+ display: block; width: 16px; height: 16px; border-radius: 50%;
2008
+ background: var(--dsw-alias-label-primary-foreground);
2009
+ transition: transform .12s ease;
2010
+ }
2011
+ .evo-switch[aria-checked="true"] .evo-thumb { transform: translateX(16px); }
2012
+
2013
+ /* 整理方案与空状态 */
2014
+ .evo-tidy-box { display: flex; flex-direction: column; gap: 12px; padding: 12px 0; border-top: .5px solid var(--dsw-alias-border-l2); }
2015
+ .evo-tidy-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
2016
+ .evo-tidy-stats { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); }
2017
+ .evo-tidy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
2018
+ .evo-tidy-cell { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; border-top: .5px solid var(--dsw-alias-border-l2); min-width: 0; }
2019
+ .evo-tidy-cell-wide { grid-column: 1 / -1; }
2020
+ .evo-tidy-item { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); overflow-wrap: anywhere; }
2021
+ .evo-tidy-group { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; border-top: .5px solid var(--dsw-alias-border-l2); }
2022
+ .evo-tidy-group:first-of-type { border-top: 0; }
2023
+ .evo-tidy-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
2024
+ .evo-tidy-group-name { font-size: 13px; font-weight: 500; line-height: 20px; }
2025
+ .evo-tidy-members { display: flex; flex-wrap: wrap; gap: 6px; }
2026
+ .evo-plan-box { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-top: .5px solid var(--dsw-alias-border-l2); font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); }
2027
+ .evo-plan-box .evo-mono { overflow-wrap: anywhere; }
2028
+ .evo-empty { padding: 16px 0; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }
2029
+ .evo-empty p { margin: 4px 0 0; }
2030
+ .evo-empty .evo-mono { display: inline-block; margin-bottom: 4px; color: var(--dsw-alias-label-tertiary); }
2031
+ .evo-loading { padding: 64px 24px; text-align: center; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }
2032
+
2033
+ /* 浮层提示(不遮挡、无自造弹窗) */
2034
+ .evo-toast {
2035
+ position: fixed; right: 24px; bottom: 24px; z-index: 9999;
2036
+ display: inline-flex; align-items: center; gap: 8px; max-width: min(420px, calc(100vw - 48px));
2037
+ padding: 10px 12px;
2038
+ border: .5px solid var(--dsw-alias-border-l2); border-radius: var(--evo-radius-md);
2039
+ background: var(--dsw-alias-bg-layer-3); color: var(--dsw-alias-label-primary);
2040
+ font-size: 13px; line-height: 20px;
2041
+ box-shadow: var(--dsw-elevation-prominent);
2042
+ }
2043
+ .evo-toast .evo-kicker { color: var(--dsw-alias-label-secondary); }
2044
+ .evo-toast.err { border-color: var(--dsw-alias-state-error-primary); }
2045
+ .evo-toast.err .evo-kicker { color: var(--dsw-alias-state-error-primary); }
2046
+
2047
+ @media (max-width: 780px) {
2048
+ .evo-page { padding: 0 16px; }
2049
+ .evo-page-inner { padding: 20px 0 48px; }
2050
+ .evo-page-settings { padding: 0; }
2051
+ .evo-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
2052
+ .evo-stat { padding-left: 0; border-left: 0; }
2053
+ .evo-stat:nth-child(n + 3) { border-top: .5px solid var(--dsw-alias-border-l2); }
2054
+ .evo-step-cell { padding-left: 0; padding-right: 0; }
2055
+ .evo-steps-grid, .evo-outcomes, .evo-tidy-grid { grid-template-columns: 1fr; }
2056
+ .evo-field { flex-direction: column; align-items: stretch; gap: 8px; }
2057
+ .evo-field-control { justify-content: flex-start; }
2058
+ .evo-compact-row { flex-wrap: wrap; }
2059
+ .evo-compact-name, .evo-compact-sum { max-width: none; flex: 1 1 100%; white-space: normal; }
2060
+ .evo-compact-actions { margin-left: 0; }
2061
+ .evo-page-head { flex-direction: column; align-items: stretch; }
2062
+ .evo-head-actions { justify-content: flex-start; }
2063
+ }
2064
+ `;
2065
+
2066
+ function renderPage(props) {
2067
+ return h(React.Fragment, null, h('style', null, CSS), h(EvolutionPanel, { ...props, variant: 'page' }));
2068
+ }
2069
+
2070
+ function renderSettingsSection(props) {
2071
+ return h(React.Fragment, null, h('style', null, CSS), h(EvolutionPanel, { ...props, variant: 'settings' }));
2072
+ }
2073
+
2074
+ function SidebarPanelIcon(props) {
2075
+ const sz = typeof props?.size === 'number' ? props.size : 18;
2076
+ return h(
2077
+ 'svg',
2078
+ {
2079
+ width: sz,
2080
+ height: sz,
2081
+ viewBox: '0 0 24 24',
2082
+ fill: 'none',
2083
+ stroke: 'currentColor',
2084
+ strokeWidth: 1.5,
2085
+ strokeLinecap: 'round',
2086
+ strokeLinejoin: 'round',
2087
+ 'aria-hidden': true,
2088
+ },
2089
+ h('path', { d: 'M12 3a9 9 0 1 0 9 9' }),
2090
+ h('path', { d: 'M12 7v5l3 3' }),
2091
+ h('path', { d: 'M17 3l3 3-3 3' }),
2092
+ );
2093
+ }
2094
+
2095
+ function SettingsSectionIcon(props) {
2096
+ return h(SidebarPanelIcon, { size: typeof props?.size === 'number' ? props.size : 16 });
2097
+ }
2098
+
2099
+ return {
2100
+ inject: ['slots'],
2101
+ apply(ctx) {
2102
+ ctx.slots.inject('main', () =>
2103
+ ctx.slots.register({ name: 'main', key: 'dsh-evolution' }, renderPage),
2104
+ );
2105
+ ctx.slots.inject('sidebar.panellist', () =>
2106
+ ctx.slots.register(
2107
+ {
2108
+ name: 'sidebar.panellist',
2109
+ id: 'dsh-evolution',
2110
+ order: 15,
2111
+ label: () => '自进化',
2112
+ },
2113
+ SidebarPanelIcon,
2114
+ ),
2115
+ );
2116
+ ctx.slots.inject('settings.section', () =>
2117
+ ctx.slots.register(
2118
+ {
2119
+ name: 'settings.section',
2120
+ id: 'dsh-evolution',
2121
+ order: 30,
2122
+ label: () => '自进化',
2123
+ },
2124
+ renderSettingsSection,
2125
+ ),
2126
+ );
2127
+ ctx.slots.inject('settings.section.icon', () =>
2128
+ ctx.slots.register({ name: 'settings.section.icon', id: 'dsh-evolution' }, SettingsSectionIcon),
2129
+ );
2130
+ },
2131
+ };
2132
+ },
2133
+ });
2134
+ /* hmr-rev: 1794203235 */
2135
+
2136
+ /* hmr-rev: 1794220549 */