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