dsh-uitest 2.1.3 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.js CHANGED
@@ -43,6 +43,11 @@ window.__ModuleLoader__.load({
43
43
  if (!Number.isFinite(n) || n < 0) return '—';
44
44
  if (n < 1000) return Math.round(n) + 'ms';
45
45
  if (n < 60000) return (n / 1000).toFixed(n < 10000 ? 1 : 0) + 's';
46
+ if (n >= 3600000) {
47
+ const h = Math.floor(n / 3600000);
48
+ const m = Math.floor((n % 3600000) / 60000);
49
+ return h + 'h' + (m < 10 ? '0' : '') + m + 'm';
50
+ }
46
51
  const m = Math.floor(n / 60000);
47
52
  const s = Math.round((n % 60000) / 1000);
48
53
  return m + 'm' + (s < 10 ? '0' : '') + s + 's';
@@ -93,32 +98,98 @@ window.__ModuleLoader__.load({
93
98
  return parts[parts.length - 1] || String(projectPath || '');
94
99
  }
95
100
 
101
+ /** 运行状态是同一个领域概念:标签、色调、是否进行中、是否已判定,全站只从这里取。 */
102
+ const RUN_STATES = {
103
+ untested: { label: '未执行', tone: 'muted' },
104
+ pending: { label: '待执行', tone: 'muted' },
105
+ queued: { label: '排队中', tone: 'muted' },
106
+ preparing: { label: '准备中', tone: 'business', live: true },
107
+ running: { label: '执行中', tone: 'business', live: true },
108
+ passed: { label: '通过', tone: 'success', done: true },
109
+ partial: { label: '部分通过', tone: 'warn', done: true },
110
+ failed: { label: '失败', tone: 'danger', done: true },
111
+ blocked: { label: '阻塞', tone: 'warn', done: true },
112
+ stopped: { label: '已停止', tone: 'warn', done: true },
113
+ done: { label: '已完成', tone: 'success', done: true },
114
+ skipped: { label: '已跳过', tone: 'muted', done: true },
115
+ failed_batch: { label: '失败', tone: 'danger', done: true },
116
+ };
117
+
118
+ function runState(status) {
119
+ return RUN_STATES[status] || { label: status || '未执行', tone: 'muted' };
120
+ }
121
+
96
122
  function statusLabel(status) {
97
- return ({ passed: '通过', partial: '部分通过', failed: '失败', blocked: '阻塞', untested: '未执行', running: '执行中', queued: '排队中', pending: '待执行', done: '完成', stopped: '已停止', failed_batch: '失败' })[status] || status || '未执行';
123
+ return runState(status).label;
98
124
  }
99
125
 
100
126
  function statusTone(status) {
101
- if (status === 'passed') return 'success';
102
- if (status === 'failed') return 'danger';
103
- if (status === 'blocked') return 'warn';
104
- if (status === 'partial') return 'warn';
105
- if (status === 'running') return 'business';
106
- if (status === 'done') return 'success';
107
- if (status === 'stopped') return 'warn';
108
- if (status === 'queued' || status === 'pending') return 'muted';
109
- return 'muted';
127
+ return runState(status).tone;
110
128
  }
111
129
 
112
130
  function modeLabel(mode) {
113
131
  return ({ flow: '流程', agent: 'Agent', manual: '人工', blocked: '阻塞' })[mode] || mode || '—';
114
132
  }
115
133
 
116
- function batchPercent(batch) {
117
- if (!batch) return 0;
118
- const s = batch.summary || {};
119
- const done = (s.passed || 0) + (s.partial || 0) + (s.failed || 0) + (s.blocked || 0);
120
- const total = s.total || batch.cases?.length || 0;
121
- return total ? Math.round((done / total) * 100) : 0;
134
+ function batchProgress(batch) {
135
+ const s = (batch && batch.summary) || {};
136
+ const runs = asArray(batch && batch.cases);
137
+ const total = Number(s.total) || runs.length || 0;
138
+ const passed = Number(s.passed) || 0;
139
+ const partial = Number(s.partial) || 0;
140
+ const failed = Number(s.failed) || 0;
141
+ const blocked = Number(s.blocked) || 0;
142
+ const done = Number.isFinite(Number(s.done)) ? Number(s.done) : passed + partial + failed + blocked;
143
+ const runningRuns = runs.filter((run) => run.status === 'running' || run.queue?.state === 'running');
144
+ const queuedRuns = runs.filter((run) => run.status === 'queued' || run.queue?.state === 'queued');
145
+ const untested = Number(s.untested) || 0;
146
+ const stopped = Number(s.stopped) || 0;
147
+ const current = runningRuns[0] || null;
148
+ const stages = batch ? batchStageList(batch) : [];
149
+ const runningStage = stages.find((stage) => stage.status === 'running')
150
+ || stages.find((stage) => stage.status === 'failed')
151
+ || stages.find((stage) => stage.status === 'pending')
152
+ || stages[stages.length - 1]
153
+ || null;
154
+ const status = batch ? String(batch.status || '') : '';
155
+ const active = ['running', 'preparing', 'queued'].includes(status) || runningRuns.length > 0;
156
+ const startedAt = batch && (batch.startedAt || batch.createdAt);
157
+ const endedAt = batch && batch.endedAt;
158
+ const elapsedMs = startedAt
159
+ ? Math.max(0, (endedAt ? new Date(endedAt).getTime() : Date.now()) - new Date(startedAt).getTime())
160
+ : 0;
161
+ return {
162
+ total,
163
+ done,
164
+ passed,
165
+ partial,
166
+ failed,
167
+ blocked,
168
+ stopped,
169
+ queued: queuedRuns.length || Number(s.queued) || 0,
170
+ untested,
171
+ pending: (queuedRuns.length || Number(s.queued) || 0) + untested,
172
+ running: runningRuns.length,
173
+ percent: total ? Math.round((done / total) * 100) : 0,
174
+ current,
175
+ queuedRuns,
176
+ stage: runningStage,
177
+ active,
178
+ status,
179
+ elapsedMs,
180
+ startedAt,
181
+ };
182
+ }
183
+
184
+ function useElapsed(startedAt, active) {
185
+ const [now, setNow] = useState(() => Date.now());
186
+ useEffect(() => {
187
+ if (!active) return undefined;
188
+ const timer = setInterval(() => setNow(Date.now()), 1000);
189
+ return () => clearInterval(timer);
190
+ }, [active]);
191
+ const start = startedAt ? new Date(startedAt).getTime() : NaN;
192
+ return Number.isFinite(start) ? Math.max(0, now - start) : 0;
122
193
  }
123
194
 
124
195
  function readFileBase64(file) {
@@ -222,8 +293,11 @@ window.__ModuleLoader__.load({
222
293
  }
223
294
 
224
295
  function StatusBadge(props) {
225
- const status = props.status;
226
- return h('span', { className: cx('studio-status', 'tone-' + statusTone(status)) }, h('span', { className: 'studio-status-dot' }), statusLabel(status));
296
+ const state = runState(props.status);
297
+ return h('span', {
298
+ className: cx('studio-status', 'tone-' + state.tone, state.live ? 'is-live' : ''),
299
+ title: props.title || '',
300
+ }, h('span', { className: 'studio-status-dot' }), props.label || state.label);
227
301
  }
228
302
 
229
303
  function ModeBadge(props) {
@@ -242,14 +316,14 @@ window.__ModuleLoader__.load({
242
316
 
243
317
  function Progress(props) {
244
318
  const percent = Math.max(0, Math.min(100, Number(props.percent) || 0));
245
- return h('div', { className: cx('studio-progress', props.className) },
246
- h('div', { className: 'studio-progress-fill', style: { width: percent + '%' } }),
319
+ return h('div', { className: cx('studio-progress', props.tone ? 'is-' + props.tone : '', props.live ? 'is-live' : '', props.indeterminate ? 'is-indeterminate' : '', props.className) },
320
+ h('div', { className: 'studio-progress-fill', style: { width: (props.indeterminate ? 36 : percent) + '%' } }),
247
321
  props.label ? h('span', { className: 'studio-progress-label' }, props.label) : null
248
322
  );
249
323
  }
250
324
 
251
325
  function Spinner(props) {
252
- return h('span', { className: cx('studio-spinner', props.className) });
326
+ return h('span', { className: cx('studio-spinner', props.className), style: props.style });
253
327
  }
254
328
 
255
329
  function Empty(props) {
@@ -271,6 +345,207 @@ window.__ModuleLoader__.load({
271
345
  );
272
346
  }
273
347
 
348
+ function PageHeader(props) {
349
+ return h('div', { className: 'studio-page-head' },
350
+ h('div', null,
351
+ props.kicker ? h('div', { className: 'studio-page-kicker' }, props.icon ? h(Icon, { name: props.icon, size: 13 }) : null, props.kicker) : null,
352
+ h('h1', { className: 'studio-page-title' }, props.title),
353
+ props.desc ? h('p', { className: 'studio-page-desc' }, props.desc) : null,
354
+ props.meta ? h('div', { className: 'studio-page-meta' }, props.meta) : null
355
+ ),
356
+ props.actions ? h('div', { className: 'studio-page-actions' }, props.actions) : null
357
+ );
358
+ }
359
+
360
+ function MenuButton(props) {
361
+ const [open, setOpen] = useState(false);
362
+ const ref = useRef(null);
363
+ useEffect(() => {
364
+ if (!open) return undefined;
365
+ const close = (event) => { if (ref.current && !ref.current.contains(event.target)) setOpen(false); };
366
+ const escape = (event) => { if (event.key === 'Escape') setOpen(false); };
367
+ document.addEventListener('mousedown', close);
368
+ document.addEventListener('keydown', escape);
369
+ return () => {
370
+ document.removeEventListener('mousedown', close);
371
+ document.removeEventListener('keydown', escape);
372
+ };
373
+ }, [open]);
374
+ return h('div', { className: 'studio-menu', ref },
375
+ h('button', {
376
+ type: 'button',
377
+ className: cx('studio-btn', props.primary ? 'studio-btn-primary' : ''),
378
+ disabled: props.disabled,
379
+ onClick: () => setOpen((value) => !value),
380
+ 'aria-expanded': open,
381
+ }, props.icon ? h(Icon, { name: props.icon, size: 14 }) : null, props.label, h(Icon, { name: 'chevron', size: 12, className: 'studio-menu-caret' })),
382
+ open ? h('div', { className: 'studio-menu-pop', onClick: () => setOpen(false) }, props.children) : null
383
+ );
384
+ }
385
+
386
+ /**
387
+ * 固定行高的窗口列表:只渲染视口内与少量缓冲行,长列表滚动不再随行数变慢。
388
+ * 行高由调用方给出,行内容必须能在一行高度内裁切。
389
+ */
390
+ function VirtualList(props) {
391
+ const items = props.items || [];
392
+ const rowHeight = Number(props.rowHeight) || 72;
393
+ const overscan = props.overscan === undefined ? 6 : Number(props.overscan);
394
+ const ref = useRef(null);
395
+ const [scrollTop, setScrollTop] = useState(0);
396
+ const [viewport, setViewport] = useState(0);
397
+ useEffect(() => {
398
+ const element = ref.current;
399
+ if (!element) return undefined;
400
+ const update = () => setViewport(element.clientHeight);
401
+ update();
402
+ if (typeof ResizeObserver === 'undefined') {
403
+ window.addEventListener('resize', update);
404
+ return () => window.removeEventListener('resize', update);
405
+ }
406
+ const observer = new ResizeObserver(update);
407
+ observer.observe(element);
408
+ return () => observer.disconnect();
409
+ }, []);
410
+ useEffect(() => {
411
+ const element = ref.current;
412
+ if (!element) return;
413
+ element.scrollTop = 0;
414
+ setScrollTop(0);
415
+ }, [props.resetKey]);
416
+ if (!items.length) return props.empty || null;
417
+ const first = Math.floor(scrollTop / rowHeight);
418
+ const start = Math.max(0, Math.min(first, items.length - 1) - overscan);
419
+ const end = Math.min(items.length, Math.ceil((scrollTop + (viewport || rowHeight * 10)) / rowHeight) + overscan);
420
+ const visible = items.slice(start, end);
421
+ return h('div', {
422
+ ref,
423
+ className: cx('studio-virtual', props.className),
424
+ onScroll: (event) => setScrollTop(event.currentTarget.scrollTop),
425
+ role: 'list',
426
+ 'aria-label': props.ariaLabel || '',
427
+ },
428
+ h('div', { className: 'studio-virtual-inner', style: { height: items.length * rowHeight } },
429
+ visible.map((item, index) => {
430
+ const position = start + index;
431
+ const key = props.keyFor ? props.keyFor(item, position) : (item?.tcId || item?.caseId || item?.id || position);
432
+ return h('div', {
433
+ key,
434
+ className: 'studio-virtual-row',
435
+ style: { top: position * rowHeight, height: rowHeight },
436
+ role: 'listitem',
437
+ }, props.renderRow(item, position));
438
+ })
439
+ )
440
+ );
441
+ }
442
+
443
+ function StageStrip(props) {
444
+ const stages = props.stages || batchStageList(props.batch || {});
445
+ if (!stages.length) return null;
446
+ return h('div', { className: 'studio-stage-strip' },
447
+ stages.map((stage) => h('div', { key: stage.id, className: cx('studio-stage-item', 'is-' + stage.status) },
448
+ h('span', { className: 'studio-stage-dot' }, stage.status === 'done' ? h(Icon, { name: 'check', size: 10 }) : stage.status === 'running' ? h(Spinner, { style: { width: 9, height: 9, borderWidth: 1.5 } }) : null),
449
+ h('div', { className: 'studio-stage-body' },
450
+ h('div', { className: 'studio-stage-label' }, stage.label),
451
+ h('div', { className: 'studio-stage-meta' }, stage.status === 'running' ? '进行中…' : stage.meta || statusLabel(stage.status))
452
+ )
453
+ ))
454
+ );
455
+ }
456
+
457
+ function ExecutionBanner(props) {
458
+ const batch = props.batch;
459
+ const progress = props.progress || batchProgress(batch);
460
+ const state = runState(batch.status === 'preparing' ? 'preparing' : batch.status);
461
+ const liveElapsed = useElapsed(progress.startedAt, progress.active);
462
+ const elapsed = progress.active ? liveElapsed : progress.elapsedMs;
463
+ const current = progress.current;
464
+ const title = current ? (current.title || current.caseId) : '';
465
+ const note = current ? (current.note || current.agentLive?.note || '') : '';
466
+ const queuedAhead = current?.queue?.ahead ?? progress.queuedRuns[0]?.queue?.ahead;
467
+ const currentLabel = current
468
+ ? (current.status === 'running' ? '正在执行' : '准备执行')
469
+ : progress.active && progress.queued
470
+ ? '等待调度 · 队列 ' + progress.queued + ' 条'
471
+ : progress.active
472
+ ? '批次运行中'
473
+ : progress.done >= progress.total && progress.total
474
+ ? '本批次已结束'
475
+ : '等待开始';
476
+ return h('div', { className: cx('studio-execution', 'tone-' + state.tone, props.compact ? 'is-compact' : '') },
477
+ h('div', { className: 'studio-execution-inner' },
478
+ h('div', { className: 'studio-execution-top' },
479
+ h('div', { style: { minWidth: 0 } },
480
+ h('div', { className: 'studio-execution-title' }, batch.name || batch.id),
481
+ h('div', { className: 'studio-execution-sub' },
482
+ h(StatusBadge, { status: batch.status === 'preparing' ? 'preparing' : batch.status }),
483
+ progress.stage ? h('span', null, '阶段:' + progress.stage.label) : null,
484
+ progress.startedAt ? h('span', null, (progress.active ? '已用时 ' : '用时 ') + formatDuration(elapsed)) : null,
485
+ batch.options?.concurrency && !props.compact ? h('span', null, '并发 ' + batch.options.concurrency) : null,
486
+ progress.total && !props.compact ? h('span', null, progress.total + ' 条用例') : null
487
+ )
488
+ ),
489
+ props.actions ? h('div', { className: 'studio-execution-side' }, props.actions) : null
490
+ ),
491
+ h('div', { className: 'studio-execution-progress' },
492
+ h('div', { className: 'studio-execution-progress-head' },
493
+ h('span', { className: 'studio-execution-percent' }, progress.percent + '%'),
494
+ h('span', { className: 'studio-execution-count' },
495
+ progress.done + ' / ' + progress.total + ' 已判定 · 执行中 ' + progress.running + ' · 排队 ' + progress.queued
496
+ )
497
+ ),
498
+ h(Progress, {
499
+ percent: progress.percent,
500
+ tone: progress.failed ? 'danger' : progress.active ? 'business' : 'success',
501
+ live: progress.active,
502
+ })
503
+ ),
504
+ props.compact ? null : h('div', { className: 'studio-execution-metrics' },
505
+ h('div', { className: 'studio-metric' }, h('div', { className: 'studio-metric-value tone-success' }, progress.passed), h('div', { className: 'studio-metric-label' }, '通过' + (progress.partial ? ' +' + progress.partial + ' 部分' : ''))),
506
+ h('div', { className: 'studio-metric' }, h('div', { className: 'studio-metric-value tone-danger' }, progress.failed), h('div', { className: 'studio-metric-label' }, '失败')),
507
+ h('div', { className: 'studio-metric' }, h('div', { className: 'studio-metric-value tone-warn' }, progress.blocked), h('div', { className: 'studio-metric-label' }, '阻塞')),
508
+ h('div', { className: 'studio-metric' }, h('div', { className: 'studio-metric-value' }, progress.pending), h('div', { className: 'studio-metric-label' }, '待执行')),
509
+ progress.stopped ? h('div', { className: 'studio-metric' }, h('div', { className: 'studio-metric-value tone-warn' }, progress.stopped), h('div', { className: 'studio-metric-label' }, '已停止')) : null
510
+ ),
511
+ h('div', { className: cx('studio-execution-current', progress.active && current ? 'is-live' : '') },
512
+ h('span', { className: 'studio-execution-current-icon' },
513
+ progress.active ? h(Spinner) : h(Icon, { name: state.done ? 'check' : 'clock', size: 14 })
514
+ ),
515
+ h('div', { className: 'studio-execution-current-main' },
516
+ h('div', { className: 'studio-execution-current-title' }, current ? currentLabel + ' · ' + title : currentLabel),
517
+ note ? h('div', { className: 'studio-execution-current-note' }, note) : null
518
+ ),
519
+ queuedAhead !== undefined && queuedAhead !== null && progress.active && (!current || current.status !== 'running')
520
+ ? h('span', { className: 'studio-execution-current-meta' }, '前方 ' + queuedAhead + ' 条')
521
+ : null
522
+ ),
523
+ props.compact || props.showStages === false ? null : h(StageStrip, { stages: batchStageList(batch) })
524
+ )
525
+ );
526
+ }
527
+
528
+ function OperationProgress(props) {
529
+ const elapsed = useElapsed(props.startedAt, props.active !== false);
530
+ return h('div', { className: 'studio-op', role: 'status', 'aria-live': 'polite' },
531
+ h('div', { className: 'studio-op-head' },
532
+ h(Spinner),
533
+ h('span', { className: 'studio-op-title' }, props.label || '正在处理'),
534
+ h('span', { className: 'studio-op-time' }, formatDuration(elapsed))
535
+ ),
536
+ props.detail ? h('div', { className: 'studio-op-detail' }, props.detail) : null,
537
+ props.steps && props.steps.length
538
+ ? h('div', { className: 'studio-op-steps' },
539
+ props.steps.map((step, index) => h('span', {
540
+ key: index,
541
+ className: cx('studio-op-step', step.status === 'done' ? 'is-done' : step.status === 'active' ? 'is-active' : ''),
542
+ }, h('span', { className: 'studio-op-step-dot' }), step.label))
543
+ )
544
+ : null,
545
+ h('div', { className: 'studio-op-bar' }, h(Progress, { indeterminate: true, tone: 'business' }))
546
+ );
547
+ }
548
+
274
549
  function Field(props) {
275
550
  return h('label', { className: 'studio-field' },
276
551
  h('span', { className: 'studio-field-label' }, props.label),
@@ -352,282 +627,486 @@ window.__ModuleLoader__.load({
352
627
  /* ------------------------------------------------------------------ */
353
628
 
354
629
  const CSS = [
355
- '.studio-root{display:flex;flex-direction:column;flex:1;min-width:0;min-height:0;height:100%;overflow:hidden;position:relative;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font-size:13px;line-height:1.5}',
356
- '.studio-topbar{flex:none;display:flex;align-items:center;gap:12px;padding:12px 18px;border-bottom:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1)}',
357
- '.studio-brand{display:flex;align-items:center;gap:10px;min-width:0}',
358
- '.studio-logo{width:30px;height:30px;border-radius:9px;display:inline-flex;align-items:center;justify-content:center;background:var(--dsw-alias-button-primary-fill);color:var(--dsw-alias-label-primary-inverted);flex:none}',
359
- '.studio-brand-title{font-size:15px;font-weight:650;letter-spacing:.2px;line-height:1.2}',
360
- '.studio-brand-sub{font-size:11px;color:var(--dsw-alias-label-tertiary);line-height:1.3}',
630
+ /* ---------- 设计令牌:一处定义,全站复用 ---------- */
631
+ '.studio-root{--ui-bg:var(--dsw-alias-bg-base,#f6f7f9);--ui-surface:var(--dsw-alias-bg-layer-1,#ffffff);--ui-surface-2:var(--dsw-alias-bg-layer-2,#f1f3f5);--ui-text:var(--dsw-alias-label-primary,#1f2329);--ui-text-2:var(--dsw-alias-label-secondary,#4e5969);--ui-text-3:var(--dsw-alias-label-tertiary,#86909c);--ui-border:var(--dsw-alias-border-l1,#e5e6eb);--ui-accent:var(--dsw-alias-link,#1f6feb);--ui-accent-fill:var(--dsw-alias-button-primary-fill,#1f6feb);--ui-accent-hover:var(--dsw-alias-button-primary-hover,#1a5fc7);--ui-accent-soft:color-mix(in srgb,var(--dsw-alias-link,#1f6feb) 10%,transparent);--ui-success:var(--dsw-alias-state-success-primary,#12a150);--ui-danger:var(--dsw-alias-state-error-primary,#d92d20);--ui-warn:var(--dsw-alias-state-warn-primary,#d97706);--ui-business:var(--dsw-alias-state-business-primary,#7c3aed);--ui-hover:var(--dsw-alias-interactive-bg-hover,#f2f3f5);--ui-active:var(--dsw-alias-interactive-bg-active,#e8f0fe);--ui-radius:12px;--ui-radius-sm:8px;--ui-shadow:0 1px 2px color-mix(in srgb,var(--ui-bg) 55%,transparent);--ui-shadow-lg:0 18px 44px color-mix(in srgb,var(--ui-bg) 52%,transparent);--ui-mono:"JetBrains Mono",ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;--ui-font:"Inter","IBM Plex Sans",-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif}',
632
+ '.studio-root{display:flex;flex-direction:column;flex:1;min-width:0;min-height:0;height:100%;overflow:hidden;position:relative;background:var(--ui-bg);color:var(--ui-text);font-family:var(--ui-font);font-size:13.5px;line-height:1.55;-webkit-font-smoothing:antialiased}',
633
+ '.studio-root *{box-sizing:border-box}',
634
+ '.studio-root ::selection{background:color-mix(in srgb,var(--ui-accent) 22%,transparent)}',
635
+ '.studio-root button:focus-visible,.studio-root input:focus-visible,.studio-root select:focus-visible,.studio-root textarea:focus-visible,.studio-root [role=button]:focus-visible{outline:2px solid var(--ui-accent);outline-offset:2px}',
636
+ '.studio-root ::-webkit-scrollbar{width:10px;height:10px}',
637
+ '.studio-root ::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--ui-text-3) 34%,transparent);border-radius:999px;border:2px solid transparent;background-clip:padding-box}',
638
+ '.studio-root ::-webkit-scrollbar-track{background:transparent}',
639
+
640
+ /* ---------- 顶栏 ---------- */
641
+ '.studio-topbar{flex:none;display:flex;align-items:center;gap:10px;min-height:56px;padding:0 18px;border-bottom:1px solid var(--ui-border);background:var(--ui-surface);position:relative;z-index:20}',
642
+ '.studio-brand{display:flex;align-items:center;gap:10px;min-width:0;flex:none}',
643
+ '.studio-logo{width:30px;height:30px;border-radius:9px;display:inline-flex;align-items:center;justify-content:center;background:linear-gradient(145deg,var(--ui-accent-fill),color-mix(in srgb,var(--ui-accent-fill) 70%,var(--ui-business)));color:var(--dsw-alias-label-primary-inverted,#fff);flex:none;box-shadow:0 2px 6px color-mix(in srgb,var(--ui-accent) 24%,transparent)}',
644
+ '.studio-brand-title{font-size:14.5px;font-weight:680;letter-spacing:-.1px;line-height:1.2}',
645
+ '.studio-brand-sub{font-size:10.5px;color:var(--ui-text-3);line-height:1.3;margin-top:1px}',
361
646
  '.studio-topbar-spacer{flex:1 1 auto;min-width:8px}',
362
- '.studio-env{display:inline-flex;align-items:center;gap:6px;font-size:11px;color:var(--dsw-alias-label-tertiary);white-space:nowrap}',
363
- '.studio-env-dot{width:7px;height:7px;border-radius:50%;background:var(--dsw-alias-state-success-primary);flex:none}',
364
- '.studio-env-dot.is-warn{background:var(--dsw-alias-state-warn-primary)}',
365
- '.studio-env-dot.is-fail{background:var(--dsw-alias-state-error-primary)}',
366
- '.studio-select{height:28px;padding:0 8px;border-radius:6px;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font-size:12px;font-family:inherit;outline:none;max-width:200px}',
367
- '.studio-input,.studio-textarea{box-sizing:border-box;width:100%;height:30px;padding:0 9px;border-radius:7px;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font-size:12px;font-family:inherit;outline:none}',
368
- '.studio-textarea{height:auto;min-height:80px;padding:7px 9px;resize:vertical;line-height:1.55}',
369
- '.studio-input:focus,.studio-textarea:focus{border-color:var(--dsw-alias-link)}',
370
- '.studio-btn{display:inline-flex;align-items:center;justify-content:center;gap:5px;height:29px;padding:0 11px;border-radius:7px;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font-size:12px;font-family:inherit;cursor:pointer;white-space:nowrap;transition:background .12s ease,opacity .12s ease}',
371
- '.studio-btn-icon{padding-left:8px;padding-right:8px}',
372
- '.studio-folder-icon{flex:none;display:inline-flex;align-items:center;color:var(--dsw-alias-label-secondary)}',
373
- '.studio-workspace-row{display:flex;align-items:center;gap:8px;width:100%;padding:9px 11px;border:1px solid var(--dsw-alias-border-l1);border-radius:9px;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;text-align:left}',
374
- '.studio-workspace-row:hover{background:var(--dsw-alias-interactive-bg-hover)}',
375
- '.studio-btn:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}',
647
+ '.studio-env{display:inline-flex;align-items:center;gap:6px;height:26px;padding:0 9px;border-radius:999px;border:1px solid var(--ui-border);background:var(--ui-surface-2);font-size:10.5px;color:var(--ui-text-2);white-space:nowrap;max-width:230px;overflow:hidden;text-overflow:ellipsis}',
648
+ '.studio-topbar-live{display:inline-flex;align-items:center;gap:7px;height:28px;padding:0 10px;border-radius:999px;border:1px solid color-mix(in srgb,var(--ui-business) 34%,var(--ui-border));background:color-mix(in srgb,var(--ui-business) 8%,var(--ui-surface));color:var(--ui-text);font:inherit;font-size:11px;cursor:pointer;white-space:nowrap;flex:none}',
649
+ '.studio-topbar-live:hover{background:color-mix(in srgb,var(--ui-business) 14%,var(--ui-surface))}',
650
+ '.studio-topbar-live-label{color:var(--ui-business);font-weight:650}',
651
+ '.studio-topbar-live-num{font-variant-numeric:tabular-nums;font-weight:650}',
652
+ '.studio-topbar-live-sub{color:var(--ui-text-3);font-variant-numeric:tabular-nums}',
653
+ '.studio-nav-live{width:6px;height:6px;border-radius:50%;background:var(--ui-business);flex:none;animation:studio-pulse 1.15s ease-in-out infinite}',
654
+ '.studio-env-dot{width:6px;height:6px;border-radius:50%;background:var(--ui-success);flex:none}',
655
+ '.studio-env-dot.is-warn{background:var(--ui-warn)}',
656
+ '.studio-env-dot.is-fail{background:var(--ui-danger)}',
657
+ '.studio-select{height:28px;padding:0 26px 0 9px;border-radius:7px;border:1px solid var(--ui-border);background:var(--ui-surface-2);color:var(--ui-text);font-size:11.5px;font-family:inherit;outline:none;max-width:220px;appearance:none;background-image:linear-gradient(45deg,transparent 50%,var(--ui-text-3) 50%),linear-gradient(135deg,var(--ui-text-3) 50%,transparent 50%);background-position:calc(100% - 13px) 12px,calc(100% - 9px) 12px;background-size:4px 4px,4px 4px;background-repeat:no-repeat;cursor:pointer}',
658
+ '.studio-select:hover{border-color:color-mix(in srgb,var(--ui-text-3) 42%,var(--ui-border))}',
659
+
660
+ /* ---------- 基础控件 ---------- */
661
+ '.studio-input,.studio-textarea{width:100%;height:32px;padding:0 10px;border-radius:8px;border:1px solid var(--ui-border);background:var(--ui-surface);color:var(--ui-text);font-size:12.5px;font-family:inherit;outline:none;transition:border-color .15s ease,box-shadow .15s ease}',
662
+ '.studio-textarea{height:auto;min-height:84px;padding:8px 10px;resize:vertical;line-height:1.6}',
663
+ '.studio-input:hover,.studio-textarea:hover{border-color:color-mix(in srgb,var(--ui-text-3) 42%,var(--ui-border))}',
664
+ '.studio-input:focus,.studio-textarea:focus{border-color:var(--ui-accent);box-shadow:0 0 0 3px var(--ui-accent-soft)}',
665
+ '.studio-input::placeholder,.studio-textarea::placeholder{color:var(--ui-text-3)}',
666
+ '.studio-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;height:30px;padding:0 12px;border-radius:8px;border:1px solid var(--ui-border);background:var(--ui-surface);color:var(--ui-text);font-size:12px;font-weight:550;font-family:inherit;cursor:pointer;white-space:nowrap;transition:background .14s ease,border-color .14s ease,transform .06s ease}',
667
+ '.studio-btn:hover:not(:disabled){background:var(--ui-hover);border-color:color-mix(in srgb,var(--ui-text-3) 36%,var(--ui-border))}',
668
+ '.studio-btn:active:not(:disabled){transform:translateY(1px)}',
376
669
  '.studio-btn:disabled{opacity:.45;cursor:not-allowed}',
377
- '.studio-btn-primary{border-color:transparent;background:var(--dsw-alias-button-primary-fill);color:var(--dsw-alias-label-primary-inverted)}',
378
- '.studio-btn-primary:hover:not(:disabled){background:var(--dsw-alias-button-primary-hover)}',
379
- '.studio-btn-danger{color:var(--dsw-alias-state-error-primary);background:transparent}',
380
- '.studio-btn-sm{height:24px;padding:0 8px;font-size:11px;border-radius:6px}',
381
- '.studio-icon-btn{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:6px;border:0;background:transparent;color:var(--dsw-alias-label-tertiary);cursor:pointer}',
382
- '.studio-icon-btn:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}',
670
+ '.studio-btn-primary{border-color:transparent;background:var(--ui-accent-fill);color:var(--dsw-alias-label-primary-inverted,#fff);box-shadow:0 1px 2px color-mix(in srgb,var(--ui-accent) 28%,transparent)}',
671
+ '.studio-btn-primary:hover:not(:disabled){background:var(--ui-accent-hover);border-color:transparent}',
672
+ '.studio-btn-danger{color:var(--ui-danger);background:transparent;border-color:color-mix(in srgb,var(--ui-danger) 26%,var(--ui-border))}',
673
+ '.studio-btn-danger:hover:not(:disabled){background:color-mix(in srgb,var(--ui-danger) 8%,transparent);border-color:color-mix(in srgb,var(--ui-danger) 42%,var(--ui-border))}',
674
+ '.studio-btn-sm{height:25px;padding:0 9px;font-size:11px;border-radius:7px}',
675
+ '.studio-btn-icon{padding-left:8px;padding-right:8px}',
676
+ '.studio-icon-btn{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:7px;border:0;background:transparent;color:var(--ui-text-3);cursor:pointer;transition:background .12s ease,color .12s ease}',
677
+ '.studio-icon-btn:hover{background:var(--ui-hover);color:var(--ui-text)}',
678
+ '.studio-menu{position:relative;display:inline-flex}',
679
+ '.studio-menu-caret{transform:rotate(90deg);opacity:.65;margin-left:1px}',
680
+ '.studio-menu-pop{position:absolute;right:0;top:calc(100% + 6px);z-index:60;min-width:190px;padding:5px;border:1px solid var(--ui-border);border-radius:10px;background:var(--ui-surface);box-shadow:var(--ui-shadow-lg)}',
681
+ '.studio-menu-pop .studio-btn{width:100%;justify-content:flex-start;border:0;background:transparent;box-shadow:none;height:31px;font-weight:500}',
682
+ '.studio-menu-pop .studio-btn:hover:not(:disabled){background:var(--ui-hover)}',
683
+ '.studio-folder-icon{flex:none;display:inline-flex;align-items:center;color:var(--ui-text-2)}',
684
+ '.studio-workspace-row{display:flex;align-items:center;gap:9px;width:100%;padding:10px 11px;border:1px solid var(--ui-border);border-radius:9px;background:var(--ui-surface);color:var(--ui-text);font:inherit;cursor:pointer;text-align:left;transition:background .12s ease,border-color .12s ease}',
685
+ '.studio-workspace-row:hover{background:var(--ui-hover);border-color:color-mix(in srgb,var(--ui-text-3) 36%,var(--ui-border))}',
686
+
687
+ /* ---------- 骨架与侧栏 ---------- */
383
688
  '.studio-body{display:flex;flex:1;min-height:0;overflow:hidden}',
384
- '.studio-rail{width:208px;flex:none;display:flex;flex-direction:column;gap:4px;padding:12px 10px;border-right:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1)}',
385
- '.studio-rail-group{font-size:10px;letter-spacing:.8px;text-transform:uppercase;color:var(--dsw-alias-label-tertiary);padding:8px 10px 4px}',
386
- '.studio-nav{display:flex;align-items:center;gap:9px;height:34px;padding:0 10px;border-radius:8px;border:0;background:transparent;color:var(--dsw-alias-label-secondary);font-size:12.5px;font-family:inherit;cursor:pointer;text-align:left;width:100%}',
387
- '.studio-nav:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}',
388
- '.studio-nav.is-active{background:var(--dsw-alias-interactive-bg-active);color:var(--dsw-alias-label-primary);font-weight:600}',
389
- '.studio-nav-icon{display:inline-flex;color:var(--dsw-alias-label-tertiary)}',
390
- '.studio-nav.is-active .studio-nav-icon{color:var(--dsw-alias-link)}',
391
- '.studio-nav-badge{margin-left:auto;font-size:10px;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums}',
392
- '.studio-rail-foot{margin-top:auto;padding:10px;border-top:1px solid var(--dsw-alias-border-l1);font-size:11px;color:var(--dsw-alias-label-tertiary)}',
393
- '.studio-main{flex:1;min-width:0;overflow-y:auto;overflow-x:hidden;scroll-behavior:smooth}',
394
- '.studio-content{max-width:1120px;margin:0 auto;padding:22px 28px 56px}',
395
- '.studio-page-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:18px}',
396
- '.studio-page-title{font-size:20px;font-weight:650;letter-spacing:.2px;margin:0}',
397
- '.studio-page-desc{margin:5px 0 0;color:var(--dsw-alias-label-secondary);font-size:12.5px;max-width:680px}',
398
- '.studio-page-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}',
399
- '.studio-card{border:1px solid var(--dsw-alias-border-l1);border-radius:12px;background:var(--dsw-alias-bg-layer-1);padding:16px 18px}',
400
- '.studio-card + .studio-card{margin-top:14px}',
401
- '.studio-hero{position:relative;overflow:hidden;border:1px solid var(--dsw-alias-border-l1);border-radius:16px;background:var(--dsw-alias-bg-layer-1);padding:26px 28px 22px}',
402
- '.studio-hero:after{content:"";position:absolute;right:-60px;top:-80px;width:260px;height:260px;border-radius:50%;background:radial-gradient(circle,var(--dsw-alias-interactive-bg-hover),transparent 68%);pointer-events:none}',
403
- '.studio-hero-kicker{display:inline-flex;align-items:center;gap:6px;font-size:11px;color:var(--dsw-alias-link);letter-spacing:.4px;text-transform:uppercase;margin-bottom:10px}',
404
- '.studio-hero-title{margin:0;font-size:25px;line-height:1.3;font-weight:680;letter-spacing:.2px;max-width:720px}',
405
- '.studio-hero-desc{margin:9px 0 0;color:var(--dsw-alias-label-secondary);font-size:13px;max-width:720px}',
406
- '.studio-hero-actions{display:flex;gap:9px;flex-wrap:wrap;margin-top:18px}',
407
- '.studio-pipeline{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:8px;margin-top:22px;position:relative;z-index:1}',
408
- '.studio-pipe{display:flex;flex-direction:column;gap:6px;padding:10px 10px 9px;border-radius:10px;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);min-width:0}',
689
+ '.studio-rail{width:176px;flex:none;display:flex;flex-direction:column;gap:3px;padding:14px 8px 10px;border-right:1px solid var(--ui-border);background:var(--ui-surface);overflow-y:auto}',
690
+ '.studio-rail-group{font-size:10.5px;letter-spacing:.2px;color:var(--ui-text-3);padding:6px 9px 6px;font-weight:600}',
691
+ '.studio-nav{position:relative;display:flex;align-items:center;gap:9px;height:36px;padding:0 9px;border-radius:8px;border:0;background:transparent;color:var(--ui-text-2);font-size:12.5px;font-weight:500;font-family:inherit;cursor:pointer;text-align:left;width:100%;transition:background .12s ease,color .12s ease}',
692
+ '.studio-nav:hover{background:var(--ui-hover);color:var(--ui-text)}',
693
+ '.studio-nav.is-active{background:var(--ui-active);color:var(--ui-text);font-weight:650}',
694
+ '.studio-nav.is-active:before{content:"";position:absolute;left:0;top:9px;bottom:9px;width:3px;border-radius:0 3px 3px 0;background:var(--ui-accent)}',
695
+ '.studio-nav-icon{display:inline-flex;color:var(--ui-text-3);flex:none}',
696
+ '.studio-nav.is-active .studio-nav-icon{color:var(--ui-accent)}',
697
+ '.studio-nav-badge{margin-left:auto;font-size:10.5px;color:var(--ui-text-3);font-variant-numeric:tabular-nums;background:var(--ui-surface-2);border-radius:999px;padding:0 6px;line-height:18px;min-width:20px;text-align:center}',
698
+ '.studio-rail-foot{margin-top:auto;padding:12px 9px 4px;border-top:1px solid var(--ui-border);font-size:10.5px;color:var(--ui-text-3);line-height:1.7}',
699
+ '.studio-rail-foot .studio-code{font-size:10px}',
700
+ '.studio-main{flex:1;min-width:0;overflow-y:auto;overflow-x:hidden;scroll-behavior:smooth;scrollbar-gutter:stable}',
701
+ '.studio-content{width:100%;max-width:1680px;margin:0 auto;padding:26px 32px 72px}',
702
+
703
+ /* ---------- 页头 ---------- */
704
+ '.studio-page-head{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;margin-bottom:18px;flex-wrap:wrap}',
705
+ '.studio-page-head>div:first-child{min-width:0;flex:1 1 320px}',
706
+ '.studio-page-kicker{display:inline-flex;align-items:center;gap:6px;font-size:11px;font-weight:600;color:var(--ui-accent);margin-bottom:5px}',
707
+ '.studio-page-title{font-size:22px;font-weight:700;letter-spacing:-.3px;line-height:1.28;margin:0}',
708
+ '.studio-page-desc{margin:6px 0 0;color:var(--ui-text-2);font-size:12.5px;line-height:1.6;max-width:760px}',
709
+ '.studio-page-meta{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:10px}',
710
+ '.studio-page-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end;align-items:center;flex:0 1 auto}',
711
+
712
+ /* ---------- 容器 ---------- */
713
+ '.studio-card{border:1px solid var(--ui-border);border-radius:var(--ui-radius);background:var(--ui-surface);padding:16px 18px;box-shadow:var(--ui-shadow)}',
714
+ '.studio-card + .studio-card{margin-top:12px}',
715
+ '.studio-card-flush{padding:10px}',
716
+ '.studio-card-flush .studio-list-head{padding:2px 4px 0}',
717
+ '.studio-empty-wrap{padding:24px 16px;border:1px dashed var(--ui-border);border-radius:10px;background:var(--ui-surface)}',
718
+ '.studio-backbar{display:flex;align-items:center;gap:8px;margin-bottom:10px;flex-wrap:wrap}',
719
+ '.studio-meta-strip{display:flex;align-items:center;gap:6px 16px;flex-wrap:wrap;font-size:11px;color:var(--ui-text-3);margin:10px 0 0;font-variant-numeric:tabular-nums}',
720
+ '.studio-meta-strip .studio-code{max-width:320px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:inline-block;vertical-align:middle}',
721
+ '.studio-results-head{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;margin:18px 0 10px;flex-wrap:wrap}',
722
+ '.studio-results-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap}',
723
+ '.studio-loading{display:flex;align-items:center;gap:9px;padding:16px 2px;color:var(--ui-text-3);font-size:11.5px}',
724
+ '.studio-central-metrics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:0;margin-top:12px;border-top:1px solid var(--ui-border);padding-top:11px}',
725
+ '.studio-central-metric{display:flex;flex-direction:column;gap:2px;padding:0 14px;border-left:1px solid var(--ui-border);min-width:0}',
726
+ '.studio-central-metric:first-child{padding-left:0;border-left:0}',
727
+ '.studio-central-metric-value{font-size:17px;font-weight:680;font-variant-numeric:tabular-nums;line-height:1.25;letter-spacing:-.2px}',
728
+ '.studio-central-metric-label{font-size:10px;color:var(--ui-text-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}',
729
+ '.studio-virtual .studio-result-row,.studio-virtual .studio-case{height:100%}',
730
+ '.studio-virtual .studio-result-main{gap:2px}',
731
+ '.studio-virtual .studio-result-summary{-webkit-line-clamp:1;line-clamp:1}',
732
+ '.studio-hero{position:relative;overflow:hidden;border:1px solid var(--ui-border);border-radius:16px;background:var(--ui-surface);padding:24px 26px 22px;box-shadow:var(--ui-shadow)}',
733
+ '.studio-hero:before{content:"";position:absolute;left:0;top:0;right:0;height:3px;background:linear-gradient(90deg,var(--ui-accent),color-mix(in srgb,var(--ui-business) 70%,var(--ui-accent)))}',
734
+ '.studio-hero-grid{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(280px,.85fr);gap:26px;align-items:start}',
735
+ '.studio-hero-kicker{display:inline-flex;align-items:center;gap:6px;font-size:11px;font-weight:650;color:var(--ui-accent);margin-bottom:8px}',
736
+ '.studio-hero-title{margin:0;font-size:27px;line-height:1.25;font-weight:720;letter-spacing:-.6px;max-width:640px}',
737
+ '.studio-hero-desc{margin:10px 0 0;color:var(--ui-text-2);font-size:12.5px;line-height:1.7;max-width:640px}',
738
+ '.studio-hero-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:18px}',
739
+ '.studio-pipeline{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:0;margin-top:22px;border:1px solid var(--ui-border);border-radius:11px;overflow:hidden;background:var(--ui-surface-2)}',
740
+ '.studio-pipe{display:flex;flex-direction:column;gap:5px;padding:11px 12px 10px;background:var(--ui-surface);border-top:2px solid transparent;min-width:0;position:relative}',
741
+ '.studio-pipe + .studio-pipe{border-left:1px solid var(--ui-border)}',
742
+ '.studio-pipe.is-active{border-top-color:var(--ui-business);background:color-mix(in srgb,var(--ui-business) 5%,var(--ui-surface))}',
743
+ '.studio-pipe.is-done{border-top-color:var(--ui-success)}',
744
+ '.studio-pipe.is-blocked{border-top-color:var(--ui-warn)}',
409
745
  '.studio-pipe-top{display:flex;align-items:center;justify-content:space-between;gap:6px}',
410
- '.studio-pipe-index{font-size:10px;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums}',
411
- '.studio-pipe-icon{display:inline-flex;color:var(--dsw-alias-link)}',
746
+ '.studio-pipe-index{font-size:9.5px;color:var(--ui-text-3);font-variant-numeric:tabular-nums;font-family:var(--ui-mono)}',
747
+ '.studio-pipe-icon{display:inline-flex;color:var(--ui-accent)}',
412
748
  '.studio-pipe-name{font-size:11.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}',
413
- '.studio-pipe-value{font-size:18px;font-weight:650;line-height:1.1;font-variant-numeric:tabular-nums}',
414
- '.studio-pipe-hint{font-size:10px;color:var(--dsw-alias-label-tertiary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}',
415
- '.studio-stat-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-top:16px}',
416
- '.studio-stat{border:1px solid var(--dsw-alias-border-l1);border-radius:12px;background:var(--dsw-alias-bg-layer-1);padding:13px 15px;min-width:0}',
417
- '.studio-stat-label{font-size:11px;color:var(--dsw-alias-label-tertiary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}',
418
- '.studio-stat-value{font-size:24px;font-weight:660;line-height:1.25;font-variant-numeric:tabular-nums}',
419
- '.studio-stat-hint{font-size:10.5px;color:var(--dsw-alias-label-tertiary);margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}',
420
- '.studio-grid-2{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(0,1fr);gap:16px;margin-top:16px;align-items:start}',
749
+ '.studio-pipe-value{font-size:18px;font-weight:680;line-height:1.15;font-variant-numeric:tabular-nums;letter-spacing:-.3px}',
750
+ '.studio-pipe-hint{font-size:9.5px;color:var(--ui-text-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}',
751
+ '.studio-stat-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));margin-top:16px;border:1px solid var(--ui-border);border-radius:var(--ui-radius);background:var(--ui-surface);overflow:hidden;box-shadow:var(--ui-shadow)}',
752
+ '.studio-stat{padding:13px 16px;min-width:0;border-left:1px solid var(--ui-border)}',
753
+ '.studio-stat:first-child{border-left:0}',
754
+ '.studio-stat-label{font-size:11px;color:var(--ui-text-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}',
755
+ '.studio-stat-value{font-size:24px;font-weight:700;line-height:1.2;font-variant-numeric:tabular-nums;letter-spacing:-.5px;margin-top:2px}',
756
+ '.studio-stat-hint{font-size:10.5px;color:var(--ui-text-3);margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}',
757
+ '.studio-grid-2{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr);gap:18px;margin-top:18px;align-items:start}',
421
758
  '.studio-section-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin:22px 0 10px}',
422
- '.studio-section-title{font-size:14px;font-weight:650;margin:0;letter-spacing:.2px}',
423
- '.studio-section-desc{margin:3px 0 0;font-size:11.5px;color:var(--dsw-alias-label-tertiary)}',
424
- '.studio-list{display:flex;flex-direction:column;gap:8px}',
425
- '.studio-row{display:flex;align-items:center;gap:10px;padding:10px 12px;border:1px solid var(--dsw-alias-border-l1);border-radius:10px;background:var(--dsw-alias-bg-layer-1);min-width:0;cursor:pointer;transition:background .12s ease}',
426
- '.studio-row:hover{background:var(--dsw-alias-interactive-bg-hover)}',
427
- '.studio-row-main{flex:1;min-width:0}',
428
- '.studio-row-title{font-size:12.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}',
429
- '.studio-row-sub{font-size:11px;color:var(--dsw-alias-label-tertiary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}',
430
- '.studio-row-side{display:flex;align-items:center;gap:8px;flex:none}',
431
- '.studio-badge{display:inline-flex;align-items:center;justify-content:center;height:20px;padding:0 7px;border-radius:999px;border:1px solid var(--dsw-alias-border-l1);font-size:10.5px;font-weight:600;white-space:nowrap;color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-2)}',
432
- '.studio-status{display:inline-flex;align-items:center;gap:5px;font-size:10.5px;font-weight:600;white-space:nowrap;color:var(--dsw-alias-label-secondary)}',
433
- '.studio-status-dot{width:6px;height:6px;border-radius:50%;background:currentColor;flex:none}',
434
- '.tone-success{color:var(--dsw-alias-state-success-primary)}',
435
- '.tone-danger{color:var(--dsw-alias-state-error-primary)}',
436
- '.tone-warn{color:var(--dsw-alias-state-warn-primary)}',
437
- '.tone-business{color:var(--dsw-alias-state-business-primary)}',
438
- '.tone-link{color:var(--dsw-alias-link)}',
439
- '.tone-muted{color:var(--dsw-alias-label-tertiary)}',
440
- '.studio-badge.tone-success{color:var(--dsw-alias-state-success-primary);border-color:color-mix(in srgb,var(--dsw-alias-state-success-primary) 28%,transparent);background:color-mix(in srgb,var(--dsw-alias-state-success-primary) 10%,transparent)}',
441
- '.studio-badge.tone-danger{color:var(--dsw-alias-state-error-primary);border-color:color-mix(in srgb,var(--dsw-alias-state-error-primary) 28%,transparent);background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 10%,transparent)}',
442
- '.studio-badge.tone-warn{color:var(--dsw-alias-state-warn-primary);border-color:color-mix(in srgb,var(--dsw-alias-state-warn-primary) 28%,transparent);background:color-mix(in srgb,var(--dsw-alias-state-warn-primary) 10%,transparent)}',
443
- '.studio-badge.tone-business{color:var(--dsw-alias-state-business-primary);border-color:color-mix(in srgb,var(--dsw-alias-state-business-primary) 28%,transparent);background:color-mix(in srgb,var(--dsw-alias-state-business-primary) 10%,transparent)}',
444
- '.studio-badge.tone-link{color:var(--dsw-alias-link);border-color:color-mix(in srgb,var(--dsw-alias-link) 28%,transparent);background:color-mix(in srgb,var(--dsw-alias-link) 9%,transparent)}',
445
- '.studio-progress{position:relative;height:6px;border-radius:999px;background:var(--dsw-alias-bg-layer-2);overflow:hidden}',
446
- '.studio-progress-fill{position:absolute;left:0;top:0;bottom:0;border-radius:999px;background:var(--dsw-alias-button-primary-fill);transition:width .3s ease}',
447
- '.studio-progress-label{position:absolute;right:0;top:-16px;font-size:10px;color:var(--dsw-alias-label-tertiary)}',
759
+ '.studio-section-title{font-size:14px;font-weight:680;margin:0;letter-spacing:-.1px}',
760
+ '.studio-section-desc{margin:3px 0 0;font-size:11.5px;color:var(--ui-text-3);line-height:1.55}',
761
+
762
+ /* ---------- 执行状态:全站统一语言 ---------- */
763
+ '.studio-execution{border:1px solid var(--ui-border);border-radius:var(--ui-radius);background:var(--ui-surface);box-shadow:var(--ui-shadow);overflow:visible;position:relative}',
764
+ '.studio-execution:before{content:"";position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--ui-text-3);border-radius:calc(var(--ui-radius) - 1px) 0 0 calc(var(--ui-radius) - 1px)}',
765
+ '.studio-execution.tone-business:before{background:var(--ui-business)}',
766
+ '.studio-execution.tone-success:before{background:var(--ui-success)}',
767
+ '.studio-execution.tone-danger:before{background:var(--ui-danger)}',
768
+ '.studio-execution.tone-warn:before{background:var(--ui-warn)}',
769
+ '.studio-execution-inner{padding:15px 18px 15px 20px}',
770
+ '.studio-execution-top{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;flex-wrap:wrap}',
771
+ '.studio-execution-title{font-size:14px;font-weight:680;line-height:1.4;min-width:0;word-break:break-word}',
772
+ '.studio-execution-sub{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:6px;font-size:11px;color:var(--ui-text-3)}',
773
+ '.studio-execution-side{display:flex;align-items:center;gap:7px;flex-wrap:wrap;justify-content:flex-end}',
774
+ '.studio-execution-progress{margin-top:13px}',
775
+ '.studio-execution-progress-head{display:flex;align-items:baseline;justify-content:space-between;gap:10px;margin-bottom:7px}',
776
+ '.studio-execution-percent{font-size:22px;font-weight:720;line-height:1;font-variant-numeric:tabular-nums;letter-spacing:-.6px}',
777
+ '.studio-execution-count{font-size:11px;color:var(--ui-text-3);font-variant-numeric:tabular-nums}',
778
+ '.studio-execution-metrics{display:flex;gap:0;flex-wrap:wrap;margin-top:13px;border-top:1px solid var(--ui-border);padding-top:11px}',
779
+ '.studio-metric{min-width:74px;padding-right:16px;margin-right:16px;border-right:1px solid var(--ui-border)}',
780
+ '.studio-metric:last-child{border-right:0;margin-right:0;padding-right:0}',
781
+ '.studio-metric-value{font-size:16px;font-weight:680;line-height:1.2;font-variant-numeric:tabular-nums}',
782
+ '.studio-metric-label{font-size:10px;color:var(--ui-text-3);margin-top:2px;white-space:nowrap}',
783
+ '.studio-execution-current{display:flex;align-items:flex-start;gap:9px;margin-top:12px;padding:9px 11px;border-radius:9px;background:var(--ui-surface-2);border:1px solid var(--ui-border);min-width:0}',
784
+ '.studio-execution-current.is-live{background:color-mix(in srgb,var(--ui-business) 7%,var(--ui-surface));border-color:color-mix(in srgb,var(--ui-business) 24%,var(--ui-border))}',
785
+ '.studio-execution-current-icon{flex:none;color:var(--ui-business);display:inline-flex;margin-top:1px}',
786
+ '.studio-execution-current-main{flex:1;min-width:0}',
787
+ '.studio-execution-current-title{font-size:11.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}',
788
+ '.studio-execution-current-note{font-size:11px;color:var(--ui-text-2);margin-top:2px;line-height:1.5;word-break:break-word;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}',
789
+ '.studio-execution-current-meta{flex:none;font-size:10.5px;color:var(--ui-text-3);font-variant-numeric:tabular-nums}',
790
+ '.studio-execution.is-compact .studio-execution-inner{padding:13px 15px 13px 17px}',
791
+ '.studio-execution.is-compact .studio-execution-title{font-size:13px}',
792
+ '.studio-execution.is-compact .studio-execution-percent{font-size:20px}',
793
+ '.studio-execution.is-compact .studio-execution-metrics{display:none}',
794
+ '.studio-batch-row{align-items:stretch}',
795
+ '.studio-batch-percent{font-size:17px;font-weight:700;font-variant-numeric:tabular-nums;letter-spacing:-.4px;margin-left:auto}',
796
+ '.studio-stage-strip{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px;margin-top:13px}',
797
+ '.studio-stage-item{display:flex;align-items:flex-start;gap:7px;padding:8px 9px;border-radius:8px;background:var(--ui-surface-2);border:1px solid transparent;min-width:0}',
798
+ '.studio-stage-item.is-running{background:color-mix(in srgb,var(--ui-business) 9%,var(--ui-surface));border-color:color-mix(in srgb,var(--ui-business) 28%,transparent)}',
799
+ '.studio-stage-item.is-done{background:color-mix(in srgb,var(--ui-success) 6%,var(--ui-surface))}',
800
+ '.studio-stage-item.is-failed{background:color-mix(in srgb,var(--ui-danger) 8%,var(--ui-surface));border-color:color-mix(in srgb,var(--ui-danger) 24%,transparent)}',
801
+ '.studio-stage-dot{width:16px;height:16px;border-radius:50%;flex:none;display:flex;align-items:center;justify-content:center;margin-top:1px;background:var(--ui-surface);border:1px solid var(--ui-border);color:var(--ui-text-3);font-size:9px;font-weight:700}',
802
+ '.studio-stage-item.is-done .studio-stage-dot{background:var(--ui-success);border-color:transparent;color:var(--dsw-alias-label-primary-inverted,#fff)}',
803
+ '.studio-stage-item.is-running .studio-stage-dot{background:var(--ui-business);border-color:transparent;color:var(--dsw-alias-label-primary-inverted,#fff)}',
804
+ '.studio-stage-item.is-failed .studio-stage-dot{background:var(--ui-danger);border-color:transparent;color:var(--dsw-alias-label-primary-inverted,#fff)}',
805
+ '.studio-stage-body{min-width:0}',
806
+ '.studio-stage-label{font-size:10.5px;font-weight:650;white-space:nowrap}',
807
+ '.studio-stage-meta{font-size:9.5px;color:var(--ui-text-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:1px}',
808
+ '.studio-op{border:1px solid color-mix(in srgb,var(--ui-business) 26%,var(--ui-border));border-radius:var(--ui-radius);background:color-mix(in srgb,var(--ui-business) 5%,var(--ui-surface));padding:12px 14px;margin:0 0 12px}',
809
+ '.studio-op-head{display:flex;align-items:center;gap:9px;flex-wrap:wrap}',
810
+ '.studio-op-title{font-size:12px;font-weight:650;color:var(--ui-text)}',
811
+ '.studio-op-time{font-size:10.5px;color:var(--ui-text-3);font-variant-numeric:tabular-nums;margin-left:auto}',
812
+ '.studio-op-detail{font-size:11px;color:var(--ui-text-2);margin-top:5px;line-height:1.55}',
813
+ '.studio-op-steps{display:flex;gap:6px;flex-wrap:wrap;margin-top:9px}',
814
+ '.studio-op-step{display:inline-flex;align-items:center;gap:5px;height:23px;padding:0 8px;border-radius:999px;background:var(--ui-surface);border:1px solid var(--ui-border);font-size:10.5px;color:var(--ui-text-3);white-space:nowrap}',
815
+ '.studio-op-step.is-active{color:var(--ui-business);border-color:color-mix(in srgb,var(--ui-business) 34%,var(--ui-border))}',
816
+ '.studio-op-step.is-done{color:var(--ui-success)}',
817
+ '.studio-op-step-dot{width:5px;height:5px;border-radius:50%;background:currentColor;flex:none}',
818
+ '.studio-op-bar{margin-top:10px}',
819
+
820
+ /* ---------- 进度条 ---------- */
821
+ '.studio-progress{position:relative;height:7px;border-radius:999px;background:var(--ui-surface-2);overflow:hidden;border:1px solid color-mix(in srgb,var(--ui-border) 70%,transparent)}',
822
+ '.studio-progress-fill{position:absolute;left:0;top:0;bottom:0;border-radius:999px;background:var(--ui-accent-fill);transition:width .35s ease}',
823
+ '.studio-progress.is-success .studio-progress-fill{background:var(--ui-success)}',
824
+ '.studio-progress.is-danger .studio-progress-fill{background:var(--ui-danger)}',
825
+ '.studio-progress.is-warn .studio-progress-fill{background:var(--ui-warn)}',
826
+ '.studio-progress.is-business .studio-progress-fill{background:var(--ui-business)}',
827
+ '.studio-progress.is-live .studio-progress-fill{background-image:linear-gradient(90deg,transparent 0,color-mix(in srgb,#fff 38%,transparent) 50%,transparent 100%);background-size:220px 100%;background-repeat:no-repeat;animation:studio-shimmer 1.6s linear infinite}',
828
+ '.studio-progress.is-indeterminate .studio-progress-fill{width:36%!important;animation:studio-indeterminate 1.35s ease-in-out infinite}',
829
+ '.studio-progress-label{position:absolute;right:0;top:-17px;font-size:10px;color:var(--ui-text-3);font-variant-numeric:tabular-nums}',
830
+ '@keyframes studio-shimmer{0%{background-position:-220px 0}100%{background-position:calc(100% + 220px) 0}}',
831
+ '@keyframes studio-indeterminate{0%{left:-36%}100%{left:100%}}',
448
832
  '.studio-stepper{display:flex;gap:0;overflow-x:auto;padding:4px 0 2px}',
449
833
  '.studio-step{flex:1;min-width:110px;display:flex;gap:8px}',
450
834
  '.studio-step-rail{display:flex;flex-direction:column;align-items:center;flex:none}',
451
- '.studio-step-dot{width:22px;height:22px;border-radius:50%;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-tertiary);display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:600}',
452
- '.studio-step.is-done .studio-step-dot{border-color:transparent;background:var(--dsw-alias-state-success-primary);color:var(--dsw-alias-label-primary-inverted)}',
453
- '.studio-step.is-running .studio-step-dot{border-color:transparent;background:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-label-primary-inverted)}',
454
- '.studio-step.is-failed .studio-step-dot{border-color:transparent;background:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-label-primary-inverted)}',
835
+ '.studio-step-dot{width:22px;height:22px;border-radius:50%;border:1px solid var(--ui-border);background:var(--ui-surface-2);color:var(--ui-text-3);display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:600}',
836
+ '.studio-step.is-done .studio-step-dot{border-color:transparent;background:var(--ui-success);color:var(--dsw-alias-label-primary-inverted,#fff)}',
837
+ '.studio-step.is-running .studio-step-dot{border-color:transparent;background:var(--ui-business);color:var(--dsw-alias-label-primary-inverted,#fff)}',
838
+ '.studio-step.is-failed .studio-step-dot{border-color:transparent;background:var(--ui-danger);color:var(--dsw-alias-label-primary-inverted,#fff)}',
455
839
  '.studio-step.is-skipped .studio-step-dot{opacity:.55}',
456
- '.studio-step-line{width:1px;flex:1;min-height:16px;background:var(--dsw-alias-border-l1);margin:3px 0}',
840
+ '.studio-step-line{width:1px;flex:1;min-height:16px;background:var(--ui-border);margin:3px 0}',
457
841
  '.studio-step-body{padding:2px 8px 0 0;min-width:0}',
458
842
  '.studio-step-title{font-size:11.5px;font-weight:600;white-space:nowrap}',
459
- '.studio-step-meta{font-size:10px;color:var(--dsw-alias-label-tertiary);margin-top:1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}',
843
+ '.studio-step-meta{font-size:10px;color:var(--ui-text-3);margin-top:1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}',
844
+
845
+ /* ---------- 列表与行 ---------- */
846
+ '.studio-list{display:flex;flex-direction:column;gap:8px}',
847
+ '.studio-list-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px;flex-wrap:wrap}',
848
+ '.studio-row{display:flex;align-items:center;gap:11px;padding:11px 13px;border:1px solid var(--ui-border);border-radius:10px;background:var(--ui-surface);min-width:0;cursor:pointer;transition:background .12s ease,border-color .12s ease}',
849
+ '.studio-row:hover{background:var(--ui-hover)}',
850
+ '.studio-row-main{flex:1;min-width:0}',
851
+ '.studio-row-title{font-size:12.5px;font-weight:620;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}',
852
+ '.studio-row-sub{font-size:11px;color:var(--ui-text-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px;line-height:1.5}',
853
+ '.studio-row-side{display:flex;align-items:center;gap:8px;flex:none}',
854
+ '.studio-row-actions{display:flex;align-items:center;gap:5px;flex:none;opacity:.6;transition:opacity .12s ease}',
855
+ '.studio-result-row:hover .studio-row-actions,.studio-result-row:focus-within .studio-row-actions{opacity:1}',
856
+ '.studio-result-row:focus-visible{outline:2px solid var(--ui-accent);outline-offset:1px}',
857
+ '.studio-virtual{overflow-y:auto;overscroll-behavior:contain;position:relative;scrollbar-gutter:stable}',
858
+ '.studio-virtual-inner{position:relative;width:100%}',
859
+ '.studio-virtual-row{position:absolute;left:0;right:0;padding-bottom:7px}',
860
+
861
+ /* ---------- 徽标与状态 ---------- */
862
+ '.studio-badge{display:inline-flex;align-items:center;justify-content:center;height:21px;padding:0 8px;border-radius:999px;border:1px solid var(--ui-border);font-size:10.5px;font-weight:600;white-space:nowrap;color:var(--ui-text-2);background:var(--ui-surface-2);letter-spacing:.1px}',
863
+ '.studio-status{display:inline-flex;align-items:center;gap:5px;height:21px;padding:0 7px;border-radius:999px;border:1px solid transparent;font-size:10.5px;font-weight:650;white-space:nowrap;color:var(--ui-text-2);background:var(--ui-surface-2)}',
864
+ '.studio-status.tone-success{color:var(--ui-success);background:color-mix(in srgb,var(--ui-success) 9%,var(--ui-surface))}',
865
+ '.studio-status.tone-danger{color:var(--ui-danger);background:color-mix(in srgb,var(--ui-danger) 9%,var(--ui-surface))}',
866
+ '.studio-status.tone-warn{color:var(--ui-warn);background:color-mix(in srgb,var(--ui-warn) 10%,var(--ui-surface))}',
867
+ '.studio-status.tone-business{color:var(--ui-business);background:color-mix(in srgb,var(--ui-business) 10%,var(--ui-surface))}',
868
+ '.studio-status.tone-link{color:var(--ui-accent);background:var(--ui-accent-soft)}',
869
+ '.studio-status-dot{width:6px;height:6px;border-radius:50%;background:currentColor;flex:none}',
870
+ '.studio-status.is-live .studio-status-dot{animation:studio-pulse 1.15s ease-in-out infinite}',
871
+ '.tone-success{color:var(--ui-success)}',
872
+ '.tone-danger{color:var(--ui-danger)}',
873
+ '.tone-warn{color:var(--ui-warn)}',
874
+ '.tone-business{color:var(--ui-business)}',
875
+ '.tone-link{color:var(--ui-accent)}',
876
+ '.tone-muted{color:var(--ui-text-3)}',
877
+ '.studio-badge.tone-success{color:var(--ui-success);border-color:color-mix(in srgb,var(--ui-success) 28%,transparent);background:color-mix(in srgb,var(--ui-success) 10%,transparent)}',
878
+ '.studio-badge.tone-danger{color:var(--ui-danger);border-color:color-mix(in srgb,var(--ui-danger) 28%,transparent);background:color-mix(in srgb,var(--ui-danger) 10%,transparent)}',
879
+ '.studio-badge.tone-warn{color:var(--ui-warn);border-color:color-mix(in srgb,var(--ui-warn) 28%,transparent);background:color-mix(in srgb,var(--ui-warn) 10%,transparent)}',
880
+ '.studio-badge.tone-business{color:var(--ui-business);border-color:color-mix(in srgb,var(--ui-business) 28%,transparent);background:color-mix(in srgb,var(--ui-business) 10%,transparent)}',
881
+ '.studio-badge.tone-link{color:var(--ui-accent);border-color:color-mix(in srgb,var(--ui-accent) 28%,transparent);background:color-mix(in srgb,var(--ui-accent) 9%,transparent)}',
882
+ '.studio-queue-badge{display:inline-flex;flex-direction:column;align-items:flex-end;gap:2px;min-width:0}',
883
+ '.studio-queue-hint{font-size:9.5px;color:var(--ui-text-3);white-space:nowrap}',
884
+
885
+ /* ---------- 工具条与筛选 ---------- */
460
886
  '.studio-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:0 0 12px}',
461
- '.studio-search{position:relative;flex:1 1 220px;min-width:160px}',
462
- '.studio-search .studio-input{padding-left:30px}',
463
- '.studio-search-icon{position:absolute;left:9px;top:7px;color:var(--dsw-alias-label-tertiary);pointer-events:none}',
464
- '.studio-chip{display:inline-flex;align-items:center;height:24px;padding:0 9px;border-radius:999px;border:1px solid var(--dsw-alias-border-l1);background:transparent;color:var(--dsw-alias-label-secondary);font-size:11px;font-family:inherit;cursor:pointer;white-space:nowrap}',
465
- '.studio-chip.is-active{border-color:transparent;background:var(--dsw-alias-interactive-bg-active);color:var(--dsw-alias-label-primary);font-weight:600}',
887
+ '.studio-search{position:relative;flex:1 1 240px;min-width:170px}',
888
+ '.studio-search .studio-input{padding-left:31px;background:var(--ui-surface)}',
889
+ '.studio-search-icon{position:absolute;left:9px;top:8px;color:var(--ui-text-3);pointer-events:none}',
890
+ '.studio-filter-bar{display:flex;align-items:center;gap:6px;flex-wrap:wrap;padding:3px;border:1px solid var(--ui-border);border-radius:9px;background:var(--ui-surface-2)}',
891
+ '.studio-chip{display:inline-flex;align-items:center;gap:5px;height:25px;padding:0 9px;border-radius:7px;border:1px solid transparent;background:transparent;color:var(--ui-text-2);font-size:11px;font-family:inherit;cursor:pointer;white-space:nowrap;transition:background .12s ease,color .12s ease}',
892
+ '.studio-chip:hover{background:var(--ui-hover);color:var(--ui-text)}',
893
+ '.studio-chip.is-active{background:var(--ui-surface);color:var(--ui-text);font-weight:650;border-color:var(--ui-border);box-shadow:var(--ui-shadow)}',
894
+ '.studio-chip-count{font-size:10px;color:var(--ui-text-3);font-variant-numeric:tabular-nums}',
895
+
896
+ /* ---------- 用例列表 ---------- */
466
897
  '.studio-case-list{display:flex;flex-direction:column;gap:7px}',
467
- '.studio-case{display:flex;gap:10px;padding:11px 12px;border:1px solid var(--dsw-alias-border-l1);border-radius:10px;background:var(--dsw-alias-bg-layer-1);cursor:pointer;min-width:0;transition:background .12s ease,border-color .12s ease}',
468
- '.studio-case:hover{background:var(--dsw-alias-interactive-bg-hover)}',
469
- '.studio-case.is-active{border-color:var(--dsw-alias-link);background:var(--dsw-alias-interactive-bg-active)}',
470
- '.studio-case-check{margin-top:2px;flex:none}',
471
- '.studio-case-main{flex:1;min-width:0}',
898
+ '.studio-case{display:flex;gap:10px;padding:10px 12px;border:1px solid var(--ui-border);border-radius:10px;background:var(--ui-surface);cursor:pointer;min-width:0;height:100%;transition:background .12s ease,border-color .12s ease,box-shadow .12s ease;position:relative}',
899
+ '.studio-case:hover{background:var(--ui-hover);border-color:color-mix(in srgb,var(--ui-text-3) 34%,var(--ui-border))}',
900
+ '.studio-case.is-active{border-color:var(--ui-accent);background:var(--ui-accent-soft);box-shadow:0 0 0 1px color-mix(in srgb,var(--ui-accent) 22%,transparent)}',
901
+ '.studio-case.is-active:before{content:"";position:absolute;left:-1px;top:9px;bottom:9px;width:3px;border-radius:0 3px 3px 0;background:var(--ui-accent)}',
902
+ '.studio-case.is-live{border-color:color-mix(in srgb,var(--ui-business) 32%,var(--ui-border))}',
903
+ '.studio-case-check{margin-top:2px;flex:none;display:flex;align-items:center}',
904
+ '.studio-case-main{flex:1;min-width:0;display:flex;flex-direction:column;justify-content:center}',
472
905
  '.studio-case-top{display:flex;align-items:center;gap:7px;min-width:0}',
473
- '.studio-case-title{font-size:12.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}',
474
- '.studio-case-id{font-size:10.5px;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;white-space:nowrap}',
475
- '.studio-case-meta{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:10.5px;color:var(--dsw-alias-label-tertiary);margin-top:4px}',
476
- '.studio-case-side{display:flex;flex-direction:column;align-items:flex-end;gap:5px;flex:none}',
477
- '.studio-detail{position:sticky;top:16px;border:1px solid var(--dsw-alias-border-l1);border-radius:14px;background:var(--dsw-alias-bg-layer-1);overflow:hidden}',
478
- '.studio-detail-head{padding:15px 16px 12px;border-bottom:1px solid var(--dsw-alias-border-l1)}',
479
- '.studio-detail-title{font-size:15px;font-weight:650;margin:0;line-height:1.35}',
480
- '.studio-detail-meta{display:flex;gap:8px;flex-wrap:wrap;margin-top:7px}',
481
- '.studio-detail-body{padding:14px 16px 18px;max-height:calc(100vh - 260px);overflow-y:auto}',
482
- '.studio-detail-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}',
906
+ '.studio-case-title{font-size:12.5px;font-weight:620;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}',
907
+ '.studio-case-id{font-size:10px;color:var(--ui-text-3);font-family:var(--ui-mono);white-space:nowrap}',
908
+ '.studio-case-meta{display:flex;align-items:center;gap:8px;flex-wrap:nowrap;overflow:hidden;font-size:10.5px;color:var(--ui-text-3);margin-top:4px;white-space:nowrap}',
909
+ '.studio-case-meta>span{flex:none}',
910
+ '.studio-case-meta>span:last-child{overflow:hidden;text-overflow:ellipsis;flex:0 1 auto}',
911
+ '.studio-case-side{display:flex;flex-direction:column;align-items:flex-end;justify-content:center;gap:3px;flex:none}',
912
+ '.studio-case-scroll{max-height:clamp(320px,calc(100vh - 330px),760px);border-radius:10px}',
913
+
914
+ /* ---------- 文档行 ---------- */
915
+ '.studio-doc-row{display:flex;align-items:center;gap:9px;padding:9px 12px;border:1px solid var(--ui-border);border-radius:10px;background:var(--ui-surface-2);cursor:pointer;height:100%;min-width:0;overflow:hidden;transition:background .12s ease,border-color .12s ease}',
916
+ '.studio-doc-row:hover{background:var(--ui-hover);border-color:color-mix(in srgb,var(--ui-text-3) 32%,var(--ui-border))}',
917
+ '.studio-doc-row.is-unassigned{background:color-mix(in srgb,var(--ui-warn) 5%,var(--ui-surface));border-style:dashed}',
918
+ '.studio-doc-chevron{width:20px;height:20px;flex:none;display:inline-flex;align-items:center;justify-content:center;border:0;border-radius:6px;background:transparent;color:var(--ui-text-3);cursor:pointer;padding:0;transition:transform .12s ease,background .12s ease}',
919
+ '.studio-doc-row.is-expanded .studio-doc-chevron{transform:rotate(90deg)}',
920
+ '.studio-doc-chevron:hover{background:var(--ui-hover);color:var(--ui-text)}',
921
+ '.studio-doc-main{flex:1;min-width:0;display:flex;flex-direction:column;justify-content:center;gap:3px}',
922
+ '.studio-doc-top{display:flex;align-items:center;gap:7px;min-width:0;flex-wrap:nowrap}',
923
+ '.studio-doc-name{font-size:12.5px;font-weight:650;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;flex:0 1 auto}',
924
+ '.studio-doc-kind{flex:none}',
925
+ '.studio-doc-count,.studio-doc-version{font-size:10.5px;color:var(--ui-text-3);white-space:nowrap;flex:none;font-variant-numeric:tabular-nums}',
926
+ '.studio-doc-source{flex:none;display:inline-flex}',
927
+ '.studio-doc-sub{display:flex;align-items:center;gap:9px;min-width:0;font-size:10.5px;color:var(--ui-text-3);white-space:nowrap;overflow:hidden}',
928
+ '.studio-doc-sub>span{flex:none}',
929
+ '.studio-doc-hint{overflow:hidden;text-overflow:ellipsis;flex:0 1 auto!important}',
930
+ '.studio-doc-rollup{display:inline-flex;gap:7px;min-width:0;overflow:hidden}',
931
+ '.studio-doc-writeback,.studio-doc-mode,.studio-doc-action{flex:none}',
932
+
933
+ /* ---------- 用例所属文档 ---------- */
934
+ '.studio-doc-link{display:flex;align-items:center;gap:5px;margin-top:8px;font-size:11px;color:var(--ui-text-3);min-width:0;flex-wrap:wrap}',
935
+ '.studio-doc-link-name{color:var(--ui-text-2);font-weight:600;overflow:hidden;text-overflow:ellipsis}',
936
+ '.studio-doc-link-meta{font-size:10.5px;color:var(--ui-text-3)}',
937
+ '.studio-doc-link.is-unassigned{color:var(--ui-warn)}',
938
+ '.studio-mono-break{font-family:var(--ui-mono);font-size:10.5px;word-break:break-all}',
939
+
940
+ /* ---------- 用例详情 ---------- */
941
+ '.studio-detail{position:sticky;top:16px;border:1px solid var(--ui-border);border-radius:14px;background:var(--ui-surface);overflow:hidden;box-shadow:var(--ui-shadow);max-height:calc(100vh - 120px);display:flex;flex-direction:column}',
942
+ '.studio-detail-head{padding:15px 16px 12px;border-bottom:1px solid var(--ui-border);flex:none}',
943
+ '.studio-detail-title{font-size:15px;font-weight:680;margin:0;line-height:1.4;letter-spacing:-.1px}',
944
+ '.studio-detail-meta{display:flex;gap:7px;flex-wrap:wrap;margin-top:7px}',
945
+ '.studio-detail-body{padding:14px 16px 20px;overflow-y:auto;min-height:0}',
946
+ '.studio-detail-actions{display:flex;gap:7px;flex-wrap:wrap;margin-top:12px}',
947
+ '.studio-detail-live{margin-top:10px;padding:8px 10px;border-radius:8px;background:color-mix(in srgb,var(--ui-business) 7%,var(--ui-surface));border:1px solid color-mix(in srgb,var(--ui-business) 22%,var(--ui-border));font-size:10.5px;color:var(--ui-text-2);line-height:1.5}',
483
948
  '.studio-nl{display:flex;flex-direction:column;gap:14px}',
484
- '.studio-nl-block{border-left:2px solid var(--dsw-alias-border-l1);padding-left:12px}',
485
- '.studio-nl-label{font-size:10.5px;letter-spacing:.6px;text-transform:uppercase;color:var(--dsw-alias-label-tertiary);margin-bottom:5px}',
486
- '.studio-nl-list{margin:0;padding-left:18px;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.7}',
487
- '.studio-nl-list li{margin:1px 0}',
488
- '.studio-note{white-space:pre-wrap;word-break:break-word;color:var(--dsw-alias-label-secondary);font-size:11.5px;line-height:1.6}',
949
+ '.studio-nl-block{border-left:2px solid var(--ui-border);padding-left:12px}',
950
+ '.studio-nl-label{font-size:10.5px;font-weight:650;color:var(--ui-text-3);margin-bottom:5px;letter-spacing:.1px}',
951
+ '.studio-nl-list{margin:0;padding-left:18px;color:var(--ui-text-2);font-size:12px;line-height:1.75}',
952
+ '.studio-nl-list li{margin:2px 0}',
953
+ '.studio-note{white-space:pre-wrap;word-break:break-word;color:var(--ui-text-2);font-size:11.5px;line-height:1.65}',
489
954
  '.studio-evidence{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}',
490
955
  '.studio-evidence-item{display:flex;flex-direction:column;gap:4px;min-width:0}',
491
- '.studio-evidence img{width:100%;height:92px;object-fit:cover;border-radius:8px;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);cursor:zoom-in}',
492
- '.studio-evidence-cap{font-size:10px;color:var(--dsw-alias-label-tertiary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}',
493
- '.studio-case-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}',
494
- '.studio-run-card{border:1px solid var(--dsw-alias-border-l1);border-radius:11px;background:var(--dsw-alias-bg-layer-1);padding:12px 13px;min-width:0}',
495
- '.studio-run-card.is-running{border-color:var(--dsw-alias-state-business-primary)}',
496
- '.studio-result-list{display:flex;flex-direction:column;gap:8px}',
497
- '.studio-result-row{display:flex;align-items:flex-start;gap:12px;width:100%;padding:11px 13px;border:1px solid var(--dsw-alias-border-l1);border-radius:11px;background:var(--dsw-alias-bg-layer-1);color:inherit;font:inherit;text-align:left;cursor:pointer;min-width:0}',
498
- '.studio-result-row:hover{background:var(--dsw-alias-interactive-bg-hover)}',
499
- '.studio-result-main{flex:1;min-width:0;display:grid;gap:4px}',
500
- '.studio-result-title{font-size:12px;font-weight:600;line-height:1.45;word-break:break-word}',
501
- '.studio-result-summary{font-size:11px;line-height:1.55;color:var(--dsw-alias-label-secondary);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-break:break-word}',
502
- '.studio-result-side{display:flex;align-items:center;gap:7px;flex:none;color:var(--dsw-alias-label-tertiary)}',
503
- '.studio-drawer-overlay{position:absolute;inset:0;z-index:80;display:flex;justify-content:flex-end;background:color-mix(in srgb,var(--dsw-alias-bg-base) 55%,transparent)}',
504
- '.studio-drawer{width:min(780px,100%);height:100%;display:flex;flex-direction:column;background:var(--dsw-alias-bg-layer-1);border-left:1px solid var(--dsw-alias-border-l1);box-shadow:-24px 0 60px color-mix(in srgb,var(--dsw-alias-bg-base) 45%,transparent)}',
505
- '.studio-drawer-body{flex:1;overflow-y:auto;padding:14px 18px 24px}',
506
- '.studio-feedback{margin-top:10px;padding-top:10px;border-top:1px dashed var(--dsw-alias-border-l1)}',
507
- '.studio-feedback-head{display:flex;align-items:center;gap:7px;flex-wrap:wrap;margin-bottom:7px}',
508
- '.studio-feedback-title{font-size:11.5px;font-weight:650;color:var(--dsw-alias-label-primary)}',
509
- '.studio-feedback-actions{display:flex;gap:7px;flex-wrap:wrap;margin-top:7px}',
510
- '.studio-feedback-used{font-size:11px;line-height:1.55;color:var(--dsw-alias-label-secondary);white-space:pre-wrap;word-break:break-word;margin-bottom:6px}',
511
- '.studio-correction{padding:7px 9px;border-radius:8px;background:var(--dsw-alias-bg-layer-2);font-size:11px;line-height:1.55;color:var(--dsw-alias-label-secondary);word-break:break-word}',
512
- '.studio-knowledge-deposit{margin-top:9px;padding:8px 10px;border:1px solid var(--dsw-alias-border-l1);border-radius:9px;background:var(--dsw-alias-bg-layer-1)}',
513
- '.studio-knowledge-deposit summary{cursor:pointer;list-style:none;display:flex;align-items:center;gap:6px;flex-wrap:wrap}',
514
- '.studio-knowledge-chips{display:flex;gap:5px;flex-wrap:wrap;margin-top:6px}',
515
- '.studio-knowledge-item{padding:5px 0;border-top:1px dashed var(--dsw-alias-border-l1);font-size:11px;line-height:1.55;color:var(--dsw-alias-label-secondary);word-break:break-word}',
956
+ '.studio-evidence img{width:100%;height:92px;object-fit:cover;border-radius:8px;border:1px solid var(--ui-border);background:var(--ui-surface-2);cursor:zoom-in}',
957
+ '.studio-evidence-cap{font-size:10px;color:var(--ui-text-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}',
958
+ '.studio-evidence-missing{height:92px;display:flex;align-items:center;justify-content:center;border:1px dashed var(--ui-border);border-radius:8px;color:var(--ui-text-3);font-size:10.5px;background:var(--ui-surface-2)}',
516
959
  '.studio-lifecycle{display:flex;gap:6px;flex-wrap:wrap;margin-top:12px}',
517
- '.studio-lifecycle-item{flex:1 1 118px;min-width:0;display:flex;align-items:flex-start;gap:6px;padding:7px 9px;border:0;border-radius:8px;background:var(--dsw-alias-bg-layer-2);color:inherit;font:inherit;text-align:left;cursor:pointer}',
518
- '.studio-lifecycle-item:hover{background:var(--dsw-alias-interactive-bg-hover)}',
519
- '.studio-lifecycle-dot{flex:none;width:7px;height:7px;margin-top:5px;border-radius:50%;background:var(--dsw-alias-label-tertiary)}',
520
- '.studio-lifecycle-label{font-size:11px;font-weight:650;color:var(--dsw-alias-label-primary)}',
521
- '.studio-lifecycle-detail{font-size:10.5px;line-height:1.45;color:var(--dsw-alias-label-secondary);word-break:break-word}',
522
- '.studio-lifecycle-dot.tone-success{background:var(--dsw-alias-state-success-primary)}',
523
- '.studio-lifecycle-dot.tone-danger{background:var(--dsw-alias-state-error-primary)}',
524
- '.studio-lifecycle-dot.tone-warn{background:var(--dsw-alias-state-warn-primary)}',
525
- '.studio-lifecycle-dot.tone-business{background:var(--dsw-alias-state-business-primary)}',
960
+ '.studio-lifecycle-item{flex:1 1 118px;min-width:0;display:flex;align-items:flex-start;gap:6px;padding:7px 9px;border:1px solid transparent;border-radius:8px;background:var(--ui-surface-2);color:inherit;font:inherit;text-align:left;cursor:pointer;transition:background .12s ease,border-color .12s ease}',
961
+ '.studio-lifecycle-item:hover{background:var(--ui-hover);border-color:var(--ui-border)}',
962
+ '.studio-lifecycle-dot{flex:none;width:7px;height:7px;margin-top:5px;border-radius:50%;background:var(--ui-text-3)}',
963
+ '.studio-lifecycle-label{font-size:11px;font-weight:650;color:var(--ui-text)}',
964
+ '.studio-lifecycle-detail{font-size:10.5px;line-height:1.45;color:var(--ui-text-2);word-break:break-word}',
965
+ '.studio-lifecycle-dot.tone-success{background:var(--ui-success)}',
966
+ '.studio-lifecycle-dot.tone-danger{background:var(--ui-danger)}',
967
+ '.studio-lifecycle-dot.tone-warn{background:var(--ui-warn)}',
968
+ '.studio-lifecycle-dot.tone-business{background:var(--ui-business)}',
969
+
970
+ /* ---------- 批次结果 ---------- */
971
+ '.studio-result-row{display:flex;align-items:flex-start;gap:12px;width:100%;padding:11px 13px;border:1px solid var(--ui-border);border-radius:10px;background:var(--ui-surface);color:inherit;font:inherit;text-align:left;cursor:pointer;min-width:0;height:100%;transition:background .12s ease,border-color .12s ease}',
972
+ '.studio-result-row:hover{background:var(--ui-hover)}',
973
+ '.studio-result-row.is-live{border-color:color-mix(in srgb,var(--ui-business) 32%,var(--ui-border));background:color-mix(in srgb,var(--ui-business) 4%,var(--ui-surface))}',
974
+ '.studio-result-main{flex:1;min-width:0;display:grid;gap:4px}',
975
+ '.studio-result-title{font-size:12px;font-weight:620;line-height:1.45;word-break:break-word;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}',
976
+ '.studio-result-summary{font-size:11px;line-height:1.5;color:var(--ui-text-2);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-break:break-word}',
977
+ '.studio-result-side{display:flex;align-items:center;gap:7px;flex:none;color:var(--ui-text-3);flex-wrap:wrap;justify-content:flex-end;max-width:46%}',
978
+ '.studio-result-scroll{max-height:clamp(260px,calc(100vh - 560px),560px);border-radius:10px}',
979
+ '.studio-run-card{border:1px solid var(--ui-border);border-radius:11px;background:var(--ui-surface);padding:12px 13px;min-width:0}',
980
+ '.studio-run-card.is-running{border-color:var(--ui-business);box-shadow:0 0 0 1px color-mix(in srgb,var(--ui-business) 20%,transparent)}',
526
981
  '.studio-run-top{display:flex;align-items:flex-start;justify-content:space-between;gap:8px}',
527
982
  '.studio-run-title{font-size:12px;font-weight:600;line-height:1.4;min-width:0;word-break:break-word}',
528
- '.studio-run-meta{display:flex;gap:8px;flex-wrap:wrap;font-size:10.5px;color:var(--dsw-alias-label-tertiary);margin-top:5px;font-variant-numeric:tabular-nums}',
529
- '.studio-run-note{font-size:11px;color:var(--dsw-alias-label-secondary);margin-top:7px;line-height:1.55;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;word-break:break-word}',
530
- '.studio-run-summary{margin-top:8px;padding:8px 10px;border-radius:8px;background:var(--dsw-alias-bg-layer-2);display:grid;gap:5px}',
531
- '.studio-run-summary-title{font-size:10.5px;letter-spacing:.5px;text-transform:uppercase;color:var(--dsw-alias-label-tertiary)}',
983
+ '.studio-run-meta{display:flex;gap:8px;flex-wrap:wrap;font-size:10.5px;color:var(--ui-text-3);margin-top:5px;font-variant-numeric:tabular-nums}',
984
+ '.studio-run-summary{margin-top:8px;padding:8px 10px;border-radius:8px;background:var(--ui-surface-2);display:grid;gap:5px}',
985
+ '.studio-run-summary-title{font-size:10.5px;font-weight:650;color:var(--ui-text-3)}',
532
986
  '.studio-summary{display:grid;gap:6px}',
533
- '.studio-summary p{margin:0;max-width:76ch;font-size:11.5px;line-height:1.65;color:var(--dsw-alias-label-secondary);word-break:break-word}',
534
- '.studio-summary ul{margin:0;padding-left:18px;max-width:76ch;font-size:11.5px;line-height:1.65;color:var(--dsw-alias-label-secondary)}',
987
+ '.studio-summary p{margin:0;max-width:76ch;font-size:11.5px;line-height:1.65;color:var(--ui-text-2);word-break:break-word}',
988
+ '.studio-summary ul{margin:0;padding-left:18px;max-width:76ch;font-size:11.5px;line-height:1.65;color:var(--ui-text-2)}',
535
989
  '.studio-summary li{margin:1px 0;word-break:break-word}',
536
990
  '.studio-summary-issues{display:grid;gap:4px;margin-top:2px}',
537
- '.studio-summary-list{margin:0;padding-left:18px;max-width:76ch;font-size:11.5px;line-height:1.65;color:var(--dsw-alias-label-secondary)}',
538
- '.studio-summary-label{font-size:10.5px;letter-spacing:.5px;text-transform:uppercase;color:var(--dsw-alias-label-tertiary)}',
539
- '.studio-summary-toggle{align-self:flex-start;border:0;background:transparent;padding:0;color:var(--dsw-alias-link);font:inherit;font-size:11px;cursor:pointer}',
991
+ '.studio-summary-list{margin:0;padding-left:18px;max-width:76ch;font-size:11.5px;line-height:1.65;color:var(--ui-text-2)}',
992
+ '.studio-summary-label{font-size:10.5px;font-weight:650;color:var(--ui-text-3)}',
993
+ '.studio-summary-toggle{align-self:flex-start;border:0;background:transparent;padding:0;color:var(--ui-accent);font:inherit;font-size:11px;cursor:pointer}',
540
994
  '.studio-summary-toggle:hover{text-decoration:underline}',
541
- '.studio-details{margin-top:2px;font-size:11px;color:var(--dsw-alias-label-tertiary)}',
995
+ '.studio-details{margin-top:2px;font-size:11px;color:var(--ui-text-3)}',
542
996
  '.studio-details summary{cursor:pointer}',
543
- '.studio-details pre{margin:6px 0 0;max-height:200px;overflow:auto;white-space:pre-wrap;word-break:break-word;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:10.5px;line-height:1.55;color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l1);border-radius:6px;padding:8px}',
544
- '.studio-failure-card{display:grid;gap:6px;padding:10px 12px;border:1px solid color-mix(in srgb,var(--dsw-alias-state-error-primary) 30%,var(--dsw-alias-border-l1));border-radius:9px;background:var(--dsw-alias-bg-layer-2)}',
545
- '.studio-failure-head{display:flex;align-items:center;gap:6px;font-size:11.5px;font-weight:650;color:var(--dsw-alias-state-error-primary)}',
546
- '.studio-queue-badge{display:inline-flex;flex-direction:column;align-items:flex-end;gap:2px;min-width:0}',
547
- '.studio-queue-hint{font-size:10px;color:var(--dsw-alias-label-tertiary);white-space:nowrap}',
548
- '.studio-row-actions{display:flex;align-items:center;gap:6px;flex:none;opacity:.55;transition:opacity .12s ease}',
549
- '.studio-result-row:hover .studio-row-actions,.studio-result-row:focus-within .studio-row-actions{opacity:1}',
550
- '.studio-result-row:focus-visible{outline:2px solid var(--dsw-alias-link);outline-offset:1px}',
997
+ '.studio-details pre{margin:6px 0 0;max-height:200px;overflow:auto;white-space:pre-wrap;word-break:break-word;font-family:var(--ui-mono);font-size:10.5px;line-height:1.55;color:var(--ui-text-2);background:var(--ui-surface);border:1px solid var(--ui-border);border-radius:6px;padding:8px}',
998
+ '.studio-failure-card{display:grid;gap:6px;padding:10px 12px;border:1px solid color-mix(in srgb,var(--ui-danger) 30%,var(--ui-border));border-radius:9px;background:color-mix(in srgb,var(--ui-danger) 4%,var(--ui-surface))}',
999
+ '.studio-failure-head{display:flex;align-items:center;gap:6px;font-size:11.5px;font-weight:650;color:var(--ui-danger)}',
1000
+
1001
+ /* ---------- 步骤时间线 ---------- */
551
1002
  '.studio-step-list{display:flex;flex-direction:column;min-width:0}',
552
- '.studio-step-row{display:flex;align-items:flex-start;gap:9px;padding:9px 0;border-top:1px dashed var(--dsw-alias-border-l1);min-width:0}',
1003
+ '.studio-step-row{display:flex;align-items:flex-start;gap:9px;padding:9px 0;border-top:1px dashed var(--ui-border);min-width:0}',
553
1004
  '.studio-step-row:first-child{border-top:0}',
554
- '.studio-step-seq{flex:none;width:20px;text-align:right;font-size:10.5px;font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);padding-top:2px}',
555
- '.studio-step-status{flex:none;width:7px;height:7px;border-radius:50%;margin-top:6px;background:var(--dsw-alias-label-tertiary)}',
556
- '.studio-step-status.tone-success{background:var(--dsw-alias-state-success-primary)}',
557
- '.studio-step-status.tone-danger{background:var(--dsw-alias-state-error-primary)}',
558
- '.studio-step-status.tone-business{background:var(--dsw-alias-state-business-primary)}',
1005
+ '.studio-step-seq{flex:none;width:20px;text-align:right;font-size:10.5px;font-variant-numeric:tabular-nums;color:var(--ui-text-3);padding-top:2px;font-family:var(--ui-mono)}',
1006
+ '.studio-step-status{flex:none;width:7px;height:7px;border-radius:50%;margin-top:6px;background:var(--ui-text-3)}',
1007
+ '.studio-step-status.tone-success{background:var(--ui-success)}',
1008
+ '.studio-step-status.tone-danger{background:var(--ui-danger)}',
1009
+ '.studio-step-status.tone-business{background:var(--ui-business);animation:studio-pulse 1.2s ease-in-out infinite}',
559
1010
  '.studio-step-content{flex:1;min-width:0;display:grid;gap:2px}',
560
- '.studio-step-name{font-size:11.5px;font-weight:600;line-height:1.5;color:var(--dsw-alias-label-primary);word-break:break-word}',
561
- '.studio-step-info{display:flex;gap:7px;flex-wrap:wrap;font-size:10.5px;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums}',
562
- '.studio-step-thumb{width:96px;height:56px;flex:none;object-fit:cover;border-radius:8px;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);cursor:zoom-in;display:inline-flex;align-items:center;justify-content:center;color:var(--dsw-alias-label-tertiary);padding:0}',
1011
+ '.studio-step-name{font-size:11.5px;font-weight:600;line-height:1.5;color:var(--ui-text);word-break:break-word}',
1012
+ '.studio-step-info{display:flex;gap:7px;flex-wrap:wrap;font-size:10.5px;color:var(--ui-text-3);font-variant-numeric:tabular-nums}',
1013
+ '.studio-step-thumb{width:96px;height:56px;flex:none;object-fit:cover;border-radius:8px;border:1px solid var(--ui-border);background:var(--ui-surface-2);cursor:zoom-in;display:inline-flex;align-items:center;justify-content:center;color:var(--ui-text-3);padding:0}',
563
1014
  '.studio-step-thumb.is-empty{cursor:default;border-style:dashed}',
564
- '.studio-evidence-missing{height:92px;display:flex;align-items:center;justify-content:center;border:1px dashed var(--dsw-alias-border-l1);border-radius:8px;color:var(--dsw-alias-label-tertiary);font-size:10.5px;background:var(--dsw-alias-bg-layer-2)}',
565
- '.studio-empty{padding:38px 18px;text-align:center;border:1px dashed var(--dsw-alias-border-l1);border-radius:12px;color:var(--dsw-alias-label-tertiary)}',
566
- '.studio-empty-icon{display:flex;justify-content:center;color:var(--dsw-alias-label-tertiary);margin-bottom:8px}',
567
- '.studio-empty-title{font-size:12.5px;font-weight:600;color:var(--dsw-alias-label-secondary)}',
568
- '.studio-empty-desc{font-size:11.5px;margin-top:4px;max-width:420px;margin-left:auto;margin-right:auto;line-height:1.6}',
569
- '.studio-modal-overlay{position:absolute;inset:0;z-index:80;display:flex;align-items:center;justify-content:center;padding:24px;background:color-mix(in srgb,var(--dsw-alias-bg-base) 62%,transparent);backdrop-filter:blur(3px)}',
570
- '.studio-modal{width:min(560px,100%);max-height:88vh;display:flex;flex-direction:column;border:1px solid var(--dsw-alias-border-l1);border-radius:16px;background:var(--dsw-alias-bg-layer-1);box-shadow:0 22px 60px color-mix(in srgb,var(--dsw-alias-bg-base) 55%,transparent);overflow:hidden}',
1015
+
1016
+ /* ---------- 反馈与知识沉淀 ---------- */
1017
+ '.studio-feedback{margin-top:10px;padding-top:10px;border-top:1px dashed var(--ui-border)}',
1018
+ '.studio-feedback-head{display:flex;align-items:center;gap:7px;flex-wrap:wrap;margin-bottom:7px}',
1019
+ '.studio-feedback-title{font-size:11.5px;font-weight:650;color:var(--ui-text)}',
1020
+ '.studio-feedback-actions{display:flex;gap:7px;flex-wrap:wrap;margin-top:7px}',
1021
+ '.studio-feedback-used{font-size:11px;line-height:1.55;color:var(--ui-text-2);white-space:pre-wrap;word-break:break-word;margin-bottom:6px}',
1022
+ '.studio-correction{padding:7px 9px;border-radius:8px;background:var(--ui-surface-2);font-size:11px;line-height:1.55;color:var(--ui-text-2);word-break:break-word}',
1023
+ '.studio-knowledge-deposit{margin-top:9px;padding:9px 11px;border:1px solid var(--ui-border);border-radius:9px;background:var(--ui-surface)}',
1024
+ '.studio-knowledge-deposit summary{cursor:pointer;list-style:none;display:flex;align-items:center;gap:6px;flex-wrap:wrap}',
1025
+ '.studio-knowledge-chips{display:flex;gap:5px;flex-wrap:wrap;margin-top:6px}',
1026
+ '.studio-knowledge-item{padding:6px 0;border-top:1px dashed var(--ui-border);font-size:11px;line-height:1.6;color:var(--ui-text-2);word-break:break-word}',
1027
+
1028
+ /* ---------- 空态与加载 ---------- */
1029
+ '.studio-empty{padding:36px 18px;text-align:center;border:1px dashed var(--ui-border);border-radius:12px;color:var(--ui-text-3);background:color-mix(in srgb,var(--ui-surface) 60%,transparent)}',
1030
+ '.studio-empty-icon{display:flex;justify-content:center;color:var(--ui-text-3);margin-bottom:8px}',
1031
+ '.studio-empty-title{font-size:12.5px;font-weight:650;color:var(--ui-text-2)}',
1032
+ '.studio-empty-desc{font-size:11.5px;margin-top:4px;max-width:430px;margin-left:auto;margin-right:auto;line-height:1.65}',
1033
+ '.studio-spinner{width:14px;height:14px;border-radius:50%;border:2px solid color-mix(in srgb,var(--ui-text-3) 30%,transparent);border-top-color:var(--ui-accent);display:inline-block;animation:studio-spin .7s linear infinite;flex:none}',
1034
+ '@keyframes studio-spin{to{transform:rotate(360deg)}}',
1035
+ '@keyframes studio-pulse{0%,100%{opacity:.4}50%{opacity:1}}',
1036
+ '.studio-pulse{animation:studio-pulse 1.6s ease-in-out infinite}',
1037
+
1038
+ /* ---------- 弹层 ---------- */
1039
+ '.studio-modal-overlay{position:absolute;inset:0;z-index:80;display:flex;align-items:center;justify-content:center;padding:24px;background:color-mix(in srgb,var(--ui-bg) 62%,transparent);backdrop-filter:blur(4px)}',
1040
+ '.studio-modal{width:min(560px,100%);max-height:88vh;display:flex;flex-direction:column;border:1px solid var(--ui-border);border-radius:16px;background:var(--ui-surface);box-shadow:var(--ui-shadow-lg);overflow:hidden}',
571
1041
  '.studio-modal-wide{width:min(900px,100%)}',
572
- '.studio-modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:16px 18px 12px;border-bottom:1px solid var(--dsw-alias-border-l1)}',
573
- '.studio-modal-title{font-size:15px;font-weight:650;margin:0}',
574
- '.studio-modal-desc{margin:4px 0 0;font-size:11.5px;color:var(--dsw-alias-label-tertiary);line-height:1.5}',
575
- '.studio-modal-body{padding:16px 18px;overflow-y:auto}',
576
- '.studio-modal-foot{display:flex;justify-content:flex-end;gap:8px;padding:12px 18px;border-top:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2)}',
577
- '.studio-form{display:flex;flex-direction:column;gap:12px}',
1042
+ '.studio-modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:16px 18px 13px;border-bottom:1px solid var(--ui-border);flex:none}',
1043
+ '.studio-modal-title{font-size:15px;font-weight:680;margin:0;letter-spacing:-.1px}',
1044
+ '.studio-modal-desc{margin:4px 0 0;font-size:11.5px;color:var(--ui-text-3);line-height:1.55}',
1045
+ '.studio-modal-body{padding:16px 18px;overflow-y:auto;min-height:0}',
1046
+ '.studio-modal-foot{display:flex;justify-content:flex-end;align-items:center;gap:8px;padding:12px 18px;border-top:1px solid var(--ui-border);background:var(--ui-surface-2);flex:none}',
1047
+ '.studio-drawer-overlay{position:absolute;inset:0;z-index:80;display:flex;justify-content:flex-end;background:color-mix(in srgb,var(--ui-bg) 55%,transparent);backdrop-filter:blur(2px)}',
1048
+ '.studio-drawer{width:min(800px,100%);height:100%;display:flex;flex-direction:column;background:var(--ui-surface);border-left:1px solid var(--ui-border);box-shadow:var(--ui-shadow-lg)}',
1049
+ '.studio-drawer-body{flex:1;overflow-y:auto;padding:14px 18px 24px;min-height:0}',
1050
+ '.studio-form{display:flex;flex-direction:column;gap:13px}',
578
1051
  '.studio-field{display:flex;flex-direction:column;gap:5px}',
579
- '.studio-field-label{font-size:11px;font-weight:600;color:var(--dsw-alias-label-secondary)}',
580
- '.studio-field-hint{font-size:10.5px;color:var(--dsw-alias-label-tertiary)}',
581
- '.studio-toggle{display:inline-flex;align-items:center;gap:8px;cursor:pointer;font-size:12px;color:var(--dsw-alias-label-secondary)}',
1052
+ '.studio-field-label{font-size:11px;font-weight:650;color:var(--ui-text-2)}',
1053
+ '.studio-field-hint{font-size:10.5px;color:var(--ui-text-3);line-height:1.5}',
1054
+ '.studio-toggle{display:inline-flex;align-items:center;gap:9px;cursor:pointer;font-size:12px;color:var(--ui-text-2)}',
582
1055
  '.studio-toggle input{position:absolute;opacity:0;pointer-events:none}',
583
- '.studio-toggle-track{width:32px;height:18px;border-radius:999px;background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l1);position:relative;flex:none;transition:background .15s ease}',
584
- '.studio-toggle-thumb{position:absolute;left:2px;top:2px;width:12px;height:12px;border-radius:50%;background:var(--dsw-alias-label-tertiary);transition:transform .15s ease,background .15s ease}',
585
- '.studio-toggle input:checked + .studio-toggle-track{background:var(--dsw-alias-button-primary-fill);border-color:transparent}',
586
- '.studio-toggle input:checked + .studio-toggle-track .studio-toggle-thumb{transform:translateX(14px);background:var(--dsw-alias-label-primary-inverted)}',
587
- '.studio-check{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;color:var(--dsw-alias-label-secondary);cursor:pointer}',
588
- '.studio-check input{accent-color:var(--dsw-alias-link)}',
589
- '.studio-tabs{display:flex;gap:4px;border-bottom:1px solid var(--dsw-alias-border-l1);margin:14px 0}',
590
- '.studio-tab{display:inline-flex;align-items:center;gap:5px;height:32px;padding:0 10px;border:0;border-bottom:2px solid transparent;background:transparent;color:var(--dsw-alias-label-tertiary);font-size:12px;font-family:inherit;cursor:pointer}',
591
- '.studio-tab.is-active{color:var(--dsw-alias-label-primary);border-bottom-color:var(--dsw-alias-link);font-weight:600}',
592
- '.studio-tab-count{font-size:10px;background:var(--dsw-alias-bg-layer-2);border-radius:999px;padding:0 5px;color:var(--dsw-alias-label-tertiary)}',
593
- '.studio-kv{display:grid;grid-template-columns:120px minmax(0,1fr);gap:6px 10px;font-size:11.5px}',
594
- '.studio-kv-key{color:var(--dsw-alias-label-tertiary)}',
595
- '.studio-kv-val{color:var(--dsw-alias-label-secondary);min-width:0;word-break:break-word}',
596
- '.studio-code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:10.5px;background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l1);border-radius:6px;padding:1px 5px;color:var(--dsw-alias-label-secondary);word-break:break-all}',
597
- '.studio-log{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:10.5px;line-height:1.6;white-space:pre-wrap;background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l1);border-radius:8px;padding:10px;max-height:220px;overflow:auto;color:var(--dsw-alias-label-secondary)}',
598
- '.studio-toast{position:fixed;left:50%;bottom:26px;transform:translateX(-50%);z-index:120;display:flex;align-items:center;gap:8px;padding:9px 14px;border-radius:10px;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);box-shadow:0 12px 32px color-mix(in srgb,var(--dsw-alias-bg-base) 45%,transparent);font-size:12px;color:var(--dsw-alias-label-primary);max-width:min(560px,90vw)}',
599
- '.studio-toast.is-error{color:var(--dsw-alias-state-error-primary);border-color:color-mix(in srgb,var(--dsw-alias-state-error-primary) 35%,transparent)}',
600
- '.studio-spinner{width:14px;height:14px;border-radius:50%;border:2px solid var(--dsw-alias-border-l1);border-top-color:var(--dsw-alias-link);display:inline-block;animation:studio-spin .7s linear infinite;flex:none}',
601
- '@keyframes studio-spin{to{transform:rotate(360deg)}}',
602
- '@keyframes studio-pulse{0%,100%{opacity:.45}50%{opacity:1}}',
603
- '.studio-pulse{animation:studio-pulse 1.2s ease-in-out infinite}',
604
- '.studio-lightbox{position:absolute;inset:0;z-index:140;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--dsw-alias-bg-base) 78%,transparent);padding:28px}',
605
- '.studio-lightbox img{max-width:92%;max-height:88%;border-radius:10px;box-shadow:0 20px 60px color-mix(in srgb,var(--dsw-alias-bg-base) 60%,transparent)}',
1056
+ '.studio-toggle-track{width:34px;height:19px;border-radius:999px;background:var(--ui-surface-2);border:1px solid var(--ui-border);position:relative;flex:none;transition:background .15s ease}',
1057
+ '.studio-toggle-thumb{position:absolute;left:2px;top:2px;width:13px;height:13px;border-radius:50%;background:var(--ui-text-3);transition:transform .15s ease,background .15s ease}',
1058
+ '.studio-toggle input:checked + .studio-toggle-track{background:var(--ui-accent-fill);border-color:transparent}',
1059
+ '.studio-toggle input:checked + .studio-toggle-track .studio-toggle-thumb{transform:translateX(15px);background:var(--dsw-alias-label-primary-inverted,#fff)}',
1060
+ '.studio-check{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;color:var(--ui-text-2);cursor:pointer}',
1061
+ '.studio-check input{accent-color:var(--ui-accent)}',
1062
+ '.studio-tabs{display:flex;gap:2px;border-bottom:1px solid var(--ui-border);margin:14px 0;overflow-x:auto}',
1063
+ '.studio-tab{display:inline-flex;align-items:center;gap:5px;height:34px;padding:0 11px;border:0;border-bottom:2px solid transparent;background:transparent;color:var(--ui-text-3);font-size:12px;font-family:inherit;cursor:pointer;white-space:nowrap;transition:color .12s ease,border-color .12s ease}',
1064
+ '.studio-tab:hover{color:var(--ui-text)}',
1065
+ '.studio-tab.is-active{color:var(--ui-text);border-bottom-color:var(--ui-accent);font-weight:650}',
1066
+ '.studio-tab-count{font-size:10px;background:var(--ui-surface-2);border-radius:999px;padding:0 5px;color:var(--ui-text-3);line-height:17px}',
1067
+ '.studio-kv{display:grid;grid-template-columns:120px minmax(0,1fr);gap:7px 12px;font-size:11.5px}',
1068
+ '.studio-kv-key{color:var(--ui-text-3)}',
1069
+ '.studio-kv-val{color:var(--ui-text-2);min-width:0;word-break:break-word}',
1070
+ '.studio-code{font-family:var(--ui-mono);font-size:10.5px;background:var(--ui-surface-2);border:1px solid var(--ui-border);border-radius:5px;padding:1px 5px;color:var(--ui-text-2);word-break:break-all}',
1071
+ '.studio-log{font-family:var(--ui-mono);font-size:10.5px;line-height:1.65;white-space:pre-wrap;background:var(--ui-surface-2);border:1px solid var(--ui-border);border-radius:8px;padding:10px;max-height:240px;overflow:auto;color:var(--ui-text-2)}',
1072
+ '.studio-toast{position:fixed;left:50%;bottom:26px;transform:translateX(-50%);z-index:120;display:flex;align-items:center;gap:8px;padding:10px 15px;border-radius:10px;border:1px solid var(--ui-border);background:var(--ui-surface);box-shadow:var(--ui-shadow-lg);font-size:12px;color:var(--ui-text);max-width:min(560px,90vw)}',
1073
+ '.studio-toast.is-error{color:var(--ui-danger);border-color:color-mix(in srgb,var(--ui-danger) 35%,transparent)}',
1074
+ '.studio-lightbox{position:absolute;inset:0;z-index:140;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--ui-bg) 82%,transparent);padding:28px}',
1075
+ '.studio-lightbox img{max-width:92%;max-height:88%;border-radius:10px;box-shadow:var(--ui-shadow-lg)}',
606
1076
  '.studio-lightbox-close{position:absolute;top:18px;right:18px}',
607
1077
  '.studio-sidebar-icon{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px}',
1078
+ '.studio-rotate-180{transform:rotate(180deg)}',
1079
+
1080
+ /* ---------- 实时与 Agent ---------- */
608
1081
  '.studio-account-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}',
1082
+ '.studio-account-card{min-width:0}',
609
1083
  '.studio-live-panel{margin-top:14px;padding:14px 16px}',
610
1084
  '.studio-live-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}',
611
- '.studio-live-tile{display:flex;flex-direction:column;gap:6px;min-width:0;border:1px solid var(--dsw-alias-border-l1);border-radius:10px;background:var(--dsw-alias-bg-layer-2);padding:8px}',
1085
+ '.studio-live-tile{display:flex;flex-direction:column;gap:6px;min-width:0;border:1px solid var(--ui-border);border-radius:10px;background:var(--ui-surface-2);padding:8px}',
612
1086
  '.studio-live-head{display:flex;align-items:center;gap:7px;min-width:0}',
613
1087
  '.studio-live-title{font-size:11.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;flex:1}',
614
- '.studio-live-status{display:inline-flex;align-items:center;gap:4px;font-size:10px;color:var(--dsw-alias-label-tertiary);white-space:nowrap}',
615
- '.studio-live-status.is-live{color:var(--dsw-alias-state-success-primary)}',
1088
+ '.studio-live-status{display:inline-flex;align-items:center;gap:4px;font-size:10px;color:var(--ui-text-3);white-space:nowrap}',
1089
+ '.studio-live-status.is-live{color:var(--ui-success)}',
616
1090
  '.studio-live-status.is-live .studio-status-dot{animation:studio-pulse 1.2s ease-in-out infinite}',
617
- '.studio-live-frames{font-size:9.5px;color:var(--dsw-alias-label-tertiary);white-space:nowrap;font-variant-numeric:tabular-nums}',
618
- '.studio-live-frame{display:block;width:100%;aspect-ratio:16/10;object-fit:contain;border-radius:7px;background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l1);cursor:zoom-in}',
619
- '.studio-live-empty{display:flex;align-items:center;justify-content:center;width:100%;aspect-ratio:16/10;border-radius:7px;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-tertiary);font-size:11px;text-align:center;padding:12px}',
620
- '.studio-live-empty-panel{padding:22px 12px;text-align:center;color:var(--dsw-alias-label-tertiary);font-size:11.5px;border:1px dashed var(--dsw-alias-border-l1);border-radius:8px}',
1091
+ '.studio-live-frames{font-size:9.5px;color:var(--ui-text-3);white-space:nowrap;font-variant-numeric:tabular-nums}',
1092
+ '.studio-live-frame{display:block;width:100%;aspect-ratio:16/10;object-fit:contain;border-radius:7px;background:var(--ui-bg);border:1px solid var(--ui-border);cursor:zoom-in}',
1093
+ '.studio-live-empty{display:flex;align-items:center;justify-content:center;width:100%;aspect-ratio:16/10;border-radius:7px;background:var(--ui-bg);color:var(--ui-text-3);font-size:11px;text-align:center;padding:12px}',
1094
+ '.studio-live-empty-panel{padding:22px 12px;text-align:center;color:var(--ui-text-3);font-size:11.5px;border:1px dashed var(--ui-border);border-radius:8px}',
621
1095
  '.studio-monitor-grid{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);gap:12px;align-items:start;margin-bottom:12px}',
622
1096
  '.studio-agent-view{padding:14px 16px;min-height:260px}',
623
- '.studio-agent-events{display:flex;flex-direction:column;gap:6px;max-height:360px;overflow-y:auto;padding-right:4px}',
624
- '.studio-agent-event-kind{font-size:9.5px;letter-spacing:.4px;text-transform:uppercase;color:var(--dsw-alias-label-tertiary);font-weight:600}',
625
- '.studio-agent-empty{padding:24px 10px;text-align:center;color:var(--dsw-alias-label-tertiary);font-size:11.5px;border:1px dashed var(--dsw-alias-border-l1);border-radius:8px}',
626
- '.studio-live-error{font-size:10px;color:var(--dsw-alias-state-warn-primary);line-height:1.4}',
627
- '.studio-account-card{min-width:0}',
628
- '.studio-rotate-180{transform:rotate(180deg)}',
629
- '@media (max-width:900px){.studio-account-grid{grid-template-columns:1fr}.studio-monitor-grid{grid-template-columns:1fr}.studio-live-grid{grid-template-columns:1fr}.studio-pipeline{grid-template-columns:repeat(3,minmax(0,1fr))}.studio-stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.studio-grid-2{grid-template-columns:1fr}.studio-detail{position:static}.studio-case-grid{grid-template-columns:1fr}}',
630
- '@media (max-width:720px){.studio-topbar{flex-wrap:wrap;padding:10px 12px}.studio-brand-sub{display:none}.studio-rail{position:fixed;left:0;right:0;bottom:0;z-index:30;width:auto;flex-direction:row;gap:2px;padding:6px 8px;border-right:0;border-top:1px solid var(--dsw-alias-border-l1);overflow-x:auto}.studio-rail-group,.studio-rail-foot{display:none}.studio-nav{flex-direction:column;gap:2px;height:48px;justify-content:center;padding:0 6px;font-size:9.5px;min-width:56px}.studio-nav-icon{display:flex}.studio-nav-badge{display:none}.studio-body{padding-bottom:58px}.studio-content{padding:16px 14px 40px}.studio-hero{padding:18px 16px}.studio-hero-title{font-size:20px}.studio-pipeline{grid-template-columns:repeat(2,minmax(0,1fr))}.studio-page-head{flex-direction:column}.studio-page-actions{justify-content:flex-start}.studio-evidence{grid-template-columns:repeat(2,minmax(0,1fr))}.studio-case-side{display:none}.studio-kv{grid-template-columns:90px minmax(0,1fr)}.studio-step-thumb{width:72px;height:44px}.studio-row-actions{opacity:1}}',
1097
+ '.studio-agent-events{display:flex;flex-direction:column;gap:6px;max-height:380px;overflow-y:auto;padding-right:4px}',
1098
+ '.studio-agent-event-kind{font-size:9.5px;letter-spacing:.2px;color:var(--ui-text-3);font-weight:650}',
1099
+ '.studio-agent-empty{padding:24px 10px;text-align:center;color:var(--ui-text-3);font-size:11.5px;border:1px dashed var(--ui-border);border-radius:8px}',
1100
+ '.studio-live-error{font-size:10px;color:var(--ui-warn);line-height:1.4}',
1101
+ '.studio-flow-chips{display:flex;gap:5px;flex-wrap:wrap}',
1102
+ '.studio-import-mode{display:flex;gap:6px;flex-wrap:wrap}',
1103
+
1104
+ /* ---------- 响应式 ---------- */
1105
+ '@media (max-width:1240px){.studio-brand-sub{display:none}.studio-env{max-width:180px}.studio-content{padding:22px 24px 56px}.studio-hero{padding:22px 22px 20px}.studio-hero-grid{grid-template-columns:minmax(0,1.3fr) minmax(260px,.9fr);gap:20px}.studio-hero-title{font-size:24px}.studio-grid-2{grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);gap:14px}.studio-case-scroll{max-height:clamp(300px,calc(100vh - 320px),720px)}.studio-doc-mode{display:none}}',
1106
+ '@media (max-width:1080px){.studio-env{display:none}.studio-topbar{gap:8px}.studio-select{max-width:180px}.studio-hero-grid{grid-template-columns:1fr}.studio-pipeline{grid-template-columns:repeat(3,minmax(0,1fr))}.studio-pipe:nth-child(4){border-left:0;border-top:1px solid var(--ui-border)}.studio-pipe:nth-child(n+4){border-top:1px solid var(--ui-border)}.studio-stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.studio-stat:nth-child(3){border-left:0;border-top:1px solid var(--ui-border)}.studio-stat:nth-child(4){border-top:1px solid var(--ui-border)}.studio-grid-2{grid-template-columns:1fr}.studio-detail{position:static;max-height:none}.studio-case-scroll{max-height:520px}.studio-result-scroll{max-height:480px}.studio-stage-strip{grid-template-columns:repeat(3,minmax(0,1fr))}}',
1107
+ '@media (max-width:900px){.studio-account-grid{grid-template-columns:1fr}.studio-monitor-grid{grid-template-columns:1fr}.studio-live-grid{grid-template-columns:1fr}.studio-result-side{max-width:52%}.studio-doc-writeback{display:none}}',
1108
+ '@media (max-width:720px){.studio-topbar{flex-wrap:wrap;padding:9px 12px;min-height:auto;gap:8px}.studio-brand-sub{display:none}.studio-topbar-spacer{display:none}.studio-topbar .studio-btn{padding:0 9px}.studio-rail{position:fixed;left:0;right:0;bottom:0;z-index:30;width:auto;flex-direction:row;gap:2px;padding:6px 8px;border-right:0;border-top:1px solid var(--ui-border);overflow-x:auto}.studio-rail-group,.studio-rail-foot{display:none}.studio-nav{flex-direction:column;gap:2px;height:48px;justify-content:center;padding:0 6px;font-size:9.5px;min-width:56px}.studio-nav.is-active:before{display:none}.studio-nav-icon{display:flex}.studio-nav-badge{display:none}.studio-body{padding-bottom:58px}.studio-content{padding:16px 14px 44px}.studio-hero{padding:18px 16px}.studio-hero-title{font-size:21px}.studio-pipeline{grid-template-columns:repeat(2,minmax(0,1fr))}.studio-page-head{flex-direction:column;justify-content:flex-start;gap:12px}.studio-page-head>div:first-child{flex:0 1 auto;width:100%}.studio-page-actions{justify-content:flex-start}.studio-evidence{grid-template-columns:repeat(2,minmax(0,1fr))}.studio-case-side{display:none}.studio-kv{grid-template-columns:90px minmax(0,1fr)}.studio-step-thumb{width:72px;height:44px}.studio-row-actions{opacity:1}.studio-stat-grid{grid-template-columns:1fr 1fr}.studio-execution-metrics{gap:8px 0}.studio-metric{min-width:64px;padding-right:10px;margin-right:10px}.studio-result-side{display:none}.studio-filter-bar{width:100%;overflow-x:auto;flex-wrap:nowrap}.studio-doc-row{padding:8px 9px;gap:6px}.studio-doc-sub{gap:6px}.studio-doc-kind,.studio-doc-version,.studio-doc-writeback,.studio-doc-mode,.studio-doc-action-label{display:none}.studio-doc-action{padding:0 6px}}',
1109
+ '@media (prefers-reduced-motion:reduce){.studio-root *{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}',
631
1110
  ].join('\n');
632
1111
 
633
1112
  /* ------------------------------------------------------------------ */
@@ -1148,6 +1627,8 @@ window.__ModuleLoader__.load({
1148
1627
  const recent = readRecentProjects().filter((item) => !workspaces.some((workspace) => workspace.path === item));
1149
1628
  const hasCurrent = workspaces.some((item) => item.path === current) || recent.includes(current);
1150
1629
  const envTone = env.agentBrowser === '不可用' ? 'is-fail' : env.stateReady ? '' : 'is-warn';
1630
+ const activeBatch = snapshot?.activeBatch || null;
1631
+ const activeProgress = activeBatch ? batchProgress(activeBatch) : null;
1151
1632
  return h('header', { className: 'studio-topbar' },
1152
1633
  h('div', { className: 'studio-brand' },
1153
1634
  h(Logo),
@@ -1157,6 +1638,16 @@ window.__ModuleLoader__.load({
1157
1638
  )
1158
1639
  ),
1159
1640
  h('div', { className: 'studio-topbar-spacer' }),
1641
+ activeBatch && activeProgress ? h('button', {
1642
+ className: 'studio-topbar-live',
1643
+ onClick: () => props.onNavigate && props.onNavigate('batches'),
1644
+ title: '打开执行中的批次:' + (activeBatch.name || activeBatch.id),
1645
+ },
1646
+ h(Spinner, { style: { width: 10, height: 10, borderWidth: 1.5 } }),
1647
+ h('span', { className: 'studio-topbar-live-label' }, activeProgress.active ? '执行中' : statusLabel(activeBatch.status)),
1648
+ h('span', { className: 'studio-topbar-live-num' }, activeProgress.percent + '%'),
1649
+ h('span', { className: 'studio-topbar-live-sub' }, activeProgress.done + '/' + activeProgress.total)
1650
+ ) : null,
1160
1651
  h('span', { className: cx('studio-env', 'studio-pulse') }, h('span', { className: cx('studio-env-dot', envTone) }), text(env.baseUrl || snapshot?.config?.baseUrl || '未配置环境')),
1161
1652
  h('select', {
1162
1653
  className: 'studio-select',
@@ -1200,6 +1691,7 @@ window.__ModuleLoader__.load({
1200
1691
  const snapshot = props.snapshot;
1201
1692
  const counts = snapshot?.counts || {};
1202
1693
  const knowledge = snapshot?.knowledge?.summary || {};
1694
+ const activeBatch = snapshot?.activeBatch || null;
1203
1695
  const badge = {
1204
1696
  cases: counts.total,
1205
1697
  batches: snapshot?.batches?.length,
@@ -1216,6 +1708,7 @@ window.__ModuleLoader__.load({
1216
1708
  },
1217
1709
  h('span', { className: 'studio-nav-icon' }, h(Icon, { name: item.icon, size: 16 })),
1218
1710
  h('span', null, item.label),
1711
+ item.id === 'batches' && activeBatch ? h('span', { className: 'studio-nav-live', title: '批次执行中' }) : null,
1219
1712
  badge[item.id] !== undefined && badge[item.id] !== null ? h('span', { className: 'studio-nav-badge' }, badge[item.id]) : null
1220
1713
  )),
1221
1714
  h('div', { className: 'studio-rail-foot' },
@@ -1231,7 +1724,7 @@ window.__ModuleLoader__.load({
1231
1724
  /* ------------------------------------------------------------------ */
1232
1725
 
1233
1726
  function PipelineCard(props) {
1234
- return h('div', { className: 'studio-pipe' },
1727
+ return h('div', { className: cx('studio-pipe', props.state ? 'is-' + props.state : '') },
1235
1728
  h('div', { className: 'studio-pipe-top' },
1236
1729
  h('span', { className: 'studio-pipe-icon' }, h(Icon, { name: props.icon, size: 14 })),
1237
1730
  h('span', { className: 'studio-pipe-index' }, props.index)
@@ -1244,22 +1737,49 @@ window.__ModuleLoader__.load({
1244
1737
 
1245
1738
  function BatchRow(props) {
1246
1739
  const batch = props.batch;
1247
- const percent = batchPercent(batch);
1248
- return h('div', { className: 'studio-row', onClick: () => props.onOpen(batch.id), role: 'button', tabIndex: 0 },
1740
+ const progress = batchProgress(batch);
1741
+ const current = progress.current;
1742
+ const liveElapsed = useElapsed(progress.startedAt, progress.active);
1743
+ const open = () => props.onOpen(batch.id);
1744
+ return h('div', {
1745
+ className: 'studio-row studio-batch-row',
1746
+ onClick: open,
1747
+ role: 'button',
1748
+ tabIndex: 0,
1749
+ onKeyDown: (event) => {
1750
+ if (event.target !== event.currentTarget) return;
1751
+ if (event.key !== 'Enter' && event.key !== ' ') return;
1752
+ event.preventDefault();
1753
+ open();
1754
+ },
1755
+ },
1249
1756
  h('div', { className: 'studio-row-main' },
1250
- h('div', { className: 'studio-row-title' }, batch.name || batch.id),
1757
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, minWidth: 0 } },
1758
+ h(StatusBadge, { status: batch.status === 'preparing' ? 'preparing' : batch.status }),
1759
+ h('div', { className: 'studio-row-title', style: { flex: 1 } }, batch.name || batch.id),
1760
+ h('span', { className: 'studio-batch-percent' }, progress.percent + '%')
1761
+ ),
1251
1762
  h('div', { className: 'studio-row-sub' },
1252
1763
  formatTime(batch.createdAt || batch.startedAt),
1253
1764
  ' · ',
1254
- (batch.summary?.passed || 0) + ' 通过 / ' + (batch.summary?.total || 0) + ' 条',
1765
+ progress.done + '/' + progress.total + ' 已判定',
1766
+ ' · 通过 ' + progress.passed,
1767
+ progress.failed ? ' · 失败 ' + progress.failed : '',
1768
+ progress.active ? ' · 已用时 ' + formatDuration(progress.active ? liveElapsed : progress.elapsedMs) : '',
1255
1769
  batch.options?.allowWrites ? ' · 已放行写操作' : ''
1256
1770
  ),
1257
- h('div', { style: { marginTop: 7 } }, h(Progress, { percent }))
1771
+ h('div', { style: { marginTop: 7 } }, h(Progress, {
1772
+ percent: progress.percent,
1773
+ tone: progress.failed ? 'danger' : progress.active ? 'business' : 'success',
1774
+ live: progress.active,
1775
+ })),
1776
+ current
1777
+ ? h('div', { className: 'studio-row-sub tone-business', style: { marginTop: 5 } }, '执行中 · ' + (current.title || current.caseId))
1778
+ : progress.active && progress.queued
1779
+ ? h('div', { className: 'studio-row-sub', style: { marginTop: 5 } }, '队列 ' + progress.queued + ' 条待执行')
1780
+ : null
1258
1781
  ),
1259
- h('div', { className: 'studio-row-side' },
1260
- h(StatusBadge, { status: batch.status === 'preparing' ? 'running' : batch.status }),
1261
- h(Icon, { name: 'chevron', size: 14 })
1262
- )
1782
+ h('div', { className: 'studio-row-side' }, h(Icon, { name: 'chevron', size: 14 }))
1263
1783
  );
1264
1784
  }
1265
1785
 
@@ -1281,34 +1801,70 @@ window.__ModuleLoader__.load({
1281
1801
  const batches = asArray(snapshot.batches);
1282
1802
  const active = snapshot.activeBatch;
1283
1803
  const latest = batches[0];
1284
- const activePercent = active ? batchPercent(active) : 0;
1804
+ const activeProgress = active ? batchProgress(active) : null;
1805
+ const latestProgress = latest ? batchProgress(latest) : null;
1285
1806
  const ran = (counts.passed || 0) + (counts.failed || 0) + (counts.blocked || 0);
1286
1807
  const passRate = ran ? Math.round(((counts.passed || 0) / ran) * 100) : 0;
1287
1808
  const nextActions = [];
1288
1809
  if (!counts.total) nextActions.push({ icon: 'import', title: '导入第一份用例文档', desc: '支持 Markdown、文本、xlsx 或目录;导入后自动生成自然语言用例', onClick: props.onImport });
1289
1810
  if (counts.total && !batches.length) nextActions.push({ icon: 'play', title: '创建第一个执行批次', desc: 'flow 与 Agent 两条泳道并发,前置造数自动执行', onClick: props.onNewBatch });
1290
- if (active) nextActions.push({ icon: 'clock', title: '继续查看执行中的批次', desc: active.name + ' · ' + activePercent + '% 完成', onClick: () => props.onOpenBatch(active.id) });
1811
+ if (active) nextActions.push({ icon: 'clock', title: '继续查看执行中的批次', desc: active.name + ' · ' + activeProgress.percent + '% 完成' + (activeProgress.current ? ' · ' + (activeProgress.current.title || activeProgress.current.caseId) : ''), onClick: () => props.onOpenBatch(active.id) });
1291
1812
  if (latest && latest.status === 'done' && !latest.writeback) nextActions.push({ icon: 'file', title: '回写用例文档', desc: '批次已结束;按批次一次写回,避免并发覆盖', onClick: () => props.onOpenBatch(latest.id) });
1292
1813
  if (knowledge.pages) nextActions.push({ icon: 'knowledge', title: '查看本轮页面知识', desc: knowledge.pages + ' 个页面 · ' + knowledge.learnings + ' 条学习记录', onClick: () => props.onNavigate('knowledge') });
1293
1814
  if (!nextActions.length) nextActions.push({ icon: 'batch', title: '再跑一个批次', desc: '选择用例、设置并发,结果与证据自动归档', onClick: props.onNewBatch });
1294
1815
 
1295
1816
  return h('div', null,
1296
1817
  h('section', { className: 'studio-hero' },
1297
- h('div', { className: 'studio-hero-kicker' }, h(Icon, { name: 'spark', size: 13 }), 'Test Studio'),
1298
- h('h1', { className: 'studio-hero-title' }, '把一份用例文档,变成可复跑的测试资产'),
1299
- h('p', { className: 'studio-hero-desc' }, '导入文档后,先得到带前置条件、测试过程与预期结果的自然语言用例;Agent 负责造数与执行,批次结束后统一归档、回写,并把通过轨迹沉淀成 flow。'),
1300
- h('div', { className: 'studio-hero-actions' },
1301
- h('button', { className: 'studio-btn studio-btn-primary', onClick: props.onNewBatch }, h(Icon, { name: 'play', size: 14 }), '新建测试批次'),
1302
- h('button', { className: 'studio-btn', onClick: props.onImport }, h(Icon, { name: 'import', size: 14 }), '导入用例文档'),
1303
- h('button', { className: 'studio-btn', onClick: () => props.onNavigate('cases') }, h(Icon, { name: 'cases', size: 14 }), '浏览用例')
1818
+ h('div', { className: 'studio-hero-grid' },
1819
+ h('div', null,
1820
+ h('div', { className: 'studio-hero-kicker' }, h(Icon, { name: 'spark', size: 13 }), 'TEST STUDIO'),
1821
+ h('h1', { className: 'studio-hero-title' }, '把一份用例文档,变成可复跑的测试资产'),
1822
+ h('p', { className: 'studio-hero-desc' }, '导入文档后得到带前置条件、测试过程与预期结果的自然语言用例;Agent 负责造数与执行,批次结束后统一归档、回写,并把通过轨迹沉淀成 flow。'),
1823
+ h('div', { className: 'studio-hero-actions' },
1824
+ h('button', { className: 'studio-btn studio-btn-primary', onClick: props.onNewBatch }, h(Icon, { name: 'play', size: 14 }), '新建测试批次'),
1825
+ h('button', { className: 'studio-btn', onClick: props.onImport }, h(Icon, { name: 'import', size: 14 }), '导入用例文档'),
1826
+ h('button', { className: 'studio-btn', onClick: () => props.onNavigate('cases') }, h(Icon, { name: 'cases', size: 14 }), '浏览用例')
1827
+ )
1828
+ ),
1829
+ active
1830
+ ? h(ExecutionBanner, {
1831
+ batch: active,
1832
+ progress: activeProgress,
1833
+ compact: true,
1834
+ actions: h('button', { className: 'studio-btn studio-btn-sm', onClick: () => props.onOpenBatch(active.id) }, '查看详情', h(Icon, { name: 'chevron', size: 12 })),
1835
+ })
1836
+ : latest
1837
+ ? h('div', { className: 'studio-card', style: { margin: 0 } },
1838
+ h('div', { className: 'studio-row-sub' }, '最近批次'),
1839
+ h('div', { className: 'studio-row-title', style: { marginTop: 4, whiteSpace: 'normal', fontSize: 13.5 } }, latest.name || latest.id),
1840
+ h('div', { className: 'studio-run-meta', style: { alignItems: 'center' } },
1841
+ h('span', null, formatTime(latest.createdAt)),
1842
+ h(StatusBadge, { status: latest.status }),
1843
+ h('span', null, latestProgress.passed + ' 通过 / ' + latestProgress.total + ' 条')
1844
+ ),
1845
+ h('div', { style: { marginTop: 11 } }, h(Progress, {
1846
+ percent: latestProgress.percent,
1847
+ tone: latestProgress.failed ? 'danger' : 'success',
1848
+ })),
1849
+ h('div', { className: 'studio-detail-actions' },
1850
+ h('button', { className: 'studio-btn studio-btn-sm', onClick: () => props.onOpenBatch(latest.id) }, '查看批次', h(Icon, { name: 'chevron', size: 12 }))
1851
+ )
1852
+ )
1853
+ : h('div', { className: 'studio-card', style: { margin: 0 } },
1854
+ h('div', { className: 'studio-row-title' }, '还没有执行批次'),
1855
+ h('p', { className: 'studio-row-sub', style: { whiteSpace: 'normal', marginTop: 6, lineHeight: 1.6 } }, '导入用例后,新建一个批次,把前置造数、执行、归档与回写串起来。'),
1856
+ h('div', { className: 'studio-detail-actions' },
1857
+ h('button', { className: 'studio-btn studio-btn-primary studio-btn-sm', onClick: props.onNewBatch }, h(Icon, { name: 'play', size: 12 }), '新建批次')
1858
+ )
1859
+ )
1304
1860
  ),
1305
1861
  h('div', { className: 'studio-pipeline' },
1306
- h(PipelineCard, { index: '01', icon: 'file', name: '文档', value: asArray(snapshot.docs).length, hint: '已导入来源' }),
1307
- h(PipelineCard, { index: '02', icon: 'cases', name: '用例', value: counts.total || 0, hint: '自然语言用例' }),
1308
- h(PipelineCard, { index: '03', icon: 'layers', name: '造数', value: counts.agent || 0, hint: 'Agent / 配方前置' }),
1309
- h(PipelineCard, { index: '04', icon: 'play', name: '执行', value: active ? activePercent + '%' : batches.length, hint: active ? '当前批次进度' : '历史批次数' }),
1310
- h(PipelineCard, { index: '05', icon: 'file', name: '回写', value: latest?.writeback ? '已回写' : '待批次', hint: latest ? formatTime(latest.createdAt) : '尚无批次' }),
1311
- h(PipelineCard, { index: '06', icon: 'knowledge', name: '沉淀', value: knowledge.pages || 0, hint: '页面知识条目' })
1862
+ h(PipelineCard, { index: '01', icon: 'file', name: '文档', value: asArray(snapshot.docs).length, hint: '已导入来源', state: asArray(snapshot.docs).length ? 'done' : '' }),
1863
+ h(PipelineCard, { index: '02', icon: 'cases', name: '用例', value: counts.total || 0, hint: '自然语言用例', state: counts.total ? 'done' : '' }),
1864
+ h(PipelineCard, { index: '03', icon: 'layers', name: '造数', value: counts.agent || 0, hint: 'Agent / 配方前置', state: counts.agent ? 'done' : '' }),
1865
+ h(PipelineCard, { index: '04', icon: 'play', name: '执行', value: active ? activeProgress.percent + '%' : batches.length, hint: active ? '正在进行 · ' + (activeProgress.current ? (activeProgress.current.title || activeProgress.current.caseId) : '等待调度') : '历史批次数', state: active ? 'active' : batches.length ? 'done' : '' }),
1866
+ h(PipelineCard, { index: '05', icon: 'file', name: '回写', value: latest?.writeback ? '已回写' : latest?.status === 'done' ? '待回写' : '待批次', hint: latest ? formatTime(latest.createdAt) : '尚无批次', state: latest?.writeback ? 'done' : latest?.status === 'done' ? 'blocked' : '' }),
1867
+ h(PipelineCard, { index: '06', icon: 'knowledge', name: '沉淀', value: knowledge.pages || 0, hint: '页面知识条目', state: knowledge.pages ? 'done' : '' })
1312
1868
  )
1313
1869
  ),
1314
1870
 
@@ -1321,31 +1877,15 @@ window.__ModuleLoader__.load({
1321
1877
 
1322
1878
  h('div', { className: 'studio-grid-2' },
1323
1879
  h('div', null,
1324
- h(SectionHead, { title: active ? '进行中的批次' : '最近批次', desc: active ? '每 1.6 秒自动刷新执行状态' : '批次是归档与回写的最小单位' }),
1325
- active
1326
- ? h('div', { className: 'studio-card' },
1327
- h('div', { style: { display: 'flex', alignItems: 'center', gap: 10, marginBottom: 10 } },
1328
- h(StatusBadge, { status: 'running' }),
1329
- h('div', { style: { flex: 1, minWidth: 0 } },
1330
- h('div', { className: 'studio-row-title' }, active.name),
1331
- h('div', { className: 'studio-row-sub' }, active.summary?.passed + ' 通过 · ' + active.summary?.failed + ' 失败 · ' + active.summary?.blocked + ' 阻塞')
1332
- ),
1333
- h('button', { className: 'studio-btn studio-btn-sm', onClick: () => props.onOpenBatch(active.id) }, '查看详情')
1334
- ),
1335
- h(Progress, { percent: activePercent }),
1336
- h('div', { className: 'studio-run-meta', style: { marginTop: 10 } },
1337
- h('span', null, '并发 ' + (active.options?.concurrency || Math.max(active.options?.workers || 0, active.options?.agentWorkers || 0) || '-')),
1338
- h('span', null, '已用时 ' + formatDuration(Date.now() - new Date(active.startedAt || active.createdAt).getTime()))
1339
- )
1340
- )
1341
- : batches.length
1342
- ? h('div', { className: 'studio-list' }, batches.slice(0, 5).map((batch) => h(BatchRow, { key: batch.id, batch, onOpen: props.onOpenBatch })))
1343
- : h(Empty, { icon: 'batch', title: '还没有执行批次', desc: '导入用例后,新建一个批次把前置造数、执行、归档与回写串起来。', action: h('button', { className: 'studio-btn studio-btn-primary', onClick: props.onNewBatch, style: { marginTop: 12 } }, '新建批次') })
1880
+ h(SectionHead, { title: active ? '批次动态' : '最近批次', desc: active ? '执行中批次置顶,每 1.6 秒刷新状态' : '批次是归档与回写的最小单位' }),
1881
+ batches.length
1882
+ ? h('div', { className: 'studio-list' }, batches.slice(0, 6).map((batch) => h(BatchRow, { key: batch.id, batch, onOpen: props.onOpenBatch })))
1883
+ : h(Empty, { icon: 'batch', title: '还没有执行批次', desc: '导入用例后,新建一个批次把前置造数、执行、归档与回写串起来。', action: h('button', { className: 'studio-btn studio-btn-primary', onClick: props.onNewBatch, style: { marginTop: 12 } }, '新建批次') })
1344
1884
  ),
1345
1885
  h('div', null,
1346
1886
  h(SectionHead, { title: '下一步', desc: '按当前项目状态给出建议' }),
1347
1887
  h('div', { className: 'studio-list' },
1348
- nextActions.map((item, index) => h(NextAction, { key: index, ...item }))
1888
+ nextActions.slice(0, 4).map((item, index) => h(NextAction, { key: index, ...item }))
1349
1889
  ),
1350
1890
  latest ? h('div', { className: 'studio-card', style: { marginTop: 14 } },
1351
1891
  h('div', { className: 'studio-row-title' }, '最近一次批次'),
@@ -1370,6 +1910,7 @@ window.__ModuleLoader__.load({
1370
1910
 
1371
1911
  const CASE_FILTERS = [
1372
1912
  { id: 'all', label: '全部' },
1913
+ { id: 'live', label: '进行中' },
1373
1914
  { id: 'flow', label: '有流程' },
1374
1915
  { id: 'agent', label: 'Agent' },
1375
1916
  { id: 'manual', label: '人工' },
@@ -1377,29 +1918,186 @@ window.__ModuleLoader__.load({
1377
1918
  { id: 'untested', label: '未执行' },
1378
1919
  ];
1379
1920
 
1380
- function caseMatches(item, query, filter) {
1921
+ function caseMatches(item, query, filter, live) {
1922
+ if (filter === 'live') return Boolean(live);
1381
1923
  if (filter === 'flow' && item.mode !== 'flow') return false;
1382
1924
  if (filter === 'agent' && item.mode !== 'agent') return false;
1383
1925
  if (filter === 'manual' && item.mode !== 'manual') return false;
1384
1926
  if (filter === 'failed' && item.status !== 'failed' && item.status !== 'blocked') return false;
1385
- if (filter === 'untested' && item.status !== 'untested') return false;
1927
+ if (filter === 'untested' && (item.status !== 'untested' || live)) return false;
1386
1928
  if (!query) return true;
1387
1929
  const needle = query.toLowerCase();
1388
1930
  return [item.tcId, item.title, item.module, item.precondition, item.steps, item.expected, item.flow?.name]
1389
1931
  .join(' ').toLowerCase().includes(needle);
1390
1932
  }
1391
1933
 
1392
- function CaseListItem(props) {
1934
+ function caseSignature(item) {
1935
+ if (!item) return '';
1936
+ return [item.tcId, item.title, item.status, item.mode, item.module, item.priority, item.lastRun?.at, asArray(item.dataNeeds).join(',')].join('|');
1937
+ }
1938
+
1939
+ function sameLiveState(a, b) {
1940
+ if (a === b) return true;
1941
+ if (!a || !b) return false;
1942
+ return a.status === b.status && a.note === b.note && a.position === b.position && a.ahead === b.ahead;
1943
+ }
1944
+
1945
+ function docKindLabel(kind) {
1946
+ return ({ xlsx: 'Excel', markdown: 'Markdown', json: 'JSON', text: '文本' })[kind] || kind || '文档';
1947
+ }
1948
+
1949
+ function docKindTone(kind) {
1950
+ return kind === 'xlsx' ? 'success' : kind === 'markdown' ? 'link' : kind === 'json' ? 'warn' : 'muted';
1951
+ }
1952
+
1953
+ function docModeLabel(mode) {
1954
+ return mode === 'overwrite' ? '覆盖导入' : '合并导入';
1955
+ }
1956
+
1957
+ const DOC_STATUS_PARTS = [
1958
+ ['passed', '通过', 'success'],
1959
+ ['partial', '部分', 'warn'],
1960
+ ['failed', '失败', 'danger'],
1961
+ ['blocked', '阻塞', 'warn'],
1962
+ ['running', '执行中', 'business'],
1963
+ ['untested', '未执行', 'muted'],
1964
+ ];
1965
+
1966
+ function docRollup(doc) {
1967
+ const counts = doc?.statusCounts || {};
1968
+ return DOC_STATUS_PARTS
1969
+ .filter(([key]) => Number(counts[key]) > 0)
1970
+ .map(([key, label, tone]) => ({ key, label: label + ' ' + counts[key], tone }));
1971
+ }
1972
+
1973
+ function diffText(diff) {
1974
+ if (!diff) return '—';
1975
+ const parts = [
1976
+ '新增 ' + (diff.added || 0),
1977
+ '更新 ' + (diff.updated || 0),
1978
+ '未变 ' + (diff.unchanged || 0),
1979
+ '移除 ' + (diff.removed || 0),
1980
+ ];
1981
+ if (diff.missing) parts.push('缺失 ' + diff.missing);
1982
+ if (diff.hidden) parts.push('隐藏 ' + diff.hidden);
1983
+ return parts.join(' · ');
1984
+ }
1985
+
1986
+ function SelectCheckbox(props) {
1987
+ const ref = useRef(null);
1988
+ useEffect(() => {
1989
+ if (ref.current) ref.current.indeterminate = Boolean(props.mixed) && !props.checked;
1990
+ }, [props.mixed, props.checked]);
1991
+ return h('label', { className: 'studio-case-check', onClick: (event) => event.stopPropagation() },
1992
+ h('input', {
1993
+ ref,
1994
+ type: 'checkbox',
1995
+ checked: Boolean(props.checked),
1996
+ disabled: Boolean(props.disabled),
1997
+ onChange: () => props.onChange(!props.checked),
1998
+ 'aria-label': props.label || '选择',
1999
+ })
2000
+ );
2001
+ }
2002
+
2003
+ /**
2004
+ * 文档层的一行:标题、归属用例数、源文件状态、执行汇总与重新导读入口。
2005
+ * 用例行和文档行共用同一套固定行高,滚动窗口才能准确定位。
2006
+ */
2007
+ const CaseDocHeader = React.memo(function CaseDocHeader(props) {
2008
+ const doc = props.doc || null;
2009
+ const isUnassigned = !doc;
2010
+ const collapseKey = isUnassigned ? '__unassigned__' : doc.id;
2011
+ const cases = asArray(props.cases);
2012
+ const ids = cases.map((item) => item.tcId);
2013
+ const selected = ids.length > 0 && ids.every((caseId) => props.selectedIds.includes(caseId));
2014
+ const mixed = !selected && ids.some((caseId) => props.selectedIds.includes(caseId));
2015
+ const expanded = props.expanded;
2016
+ const rollup = doc ? docRollup(doc) : [];
2017
+ const total = doc ? Number(doc.visibleCount) || 0 : Number(props.total) || 0;
2018
+ const toggle = () => props.onToggleCollapse(collapseKey);
2019
+ return h('div', {
2020
+ className: cx('studio-doc-row', isUnassigned ? 'is-unassigned' : '', expanded ? 'is-expanded' : ''),
2021
+ role: 'button',
2022
+ tabIndex: 0,
2023
+ onClick: toggle,
2024
+ onKeyDown: (event) => {
2025
+ if (event.target !== event.currentTarget) return;
2026
+ if (event.key !== 'Enter' && event.key !== ' ') return;
2027
+ event.preventDefault();
2028
+ toggle();
2029
+ },
2030
+ 'aria-expanded': expanded,
2031
+ },
2032
+ h('button', {
2033
+ type: 'button',
2034
+ className: 'studio-doc-chevron',
2035
+ title: expanded ? '收起该文档下的用例' : '展开该文档下的用例',
2036
+ onClick: (event) => { event.stopPropagation(); toggle(); },
2037
+ }, h(Icon, { name: 'chevron', size: 13 })),
2038
+ h(SelectCheckbox, {
2039
+ checked: selected,
2040
+ mixed,
2041
+ disabled: !ids.length,
2042
+ label: isUnassigned ? '选择未归属用例' : '选择该文档下的用例',
2043
+ onChange: (next) => props.onToggleCases(ids, next),
2044
+ }),
2045
+ h('div', { className: 'studio-doc-main' },
2046
+ h('div', { className: 'studio-doc-top' },
2047
+ h('span', { className: 'studio-doc-name', title: doc?.name || '未归属文档' }, doc?.name || '未归属文档'),
2048
+ doc ? h(Badge, { tone: docKindTone(doc.kind), className: 'studio-doc-kind' }, docKindLabel(doc.kind)) : null,
2049
+ h('span', { className: 'studio-doc-count' },
2050
+ total + ' 条',
2051
+ props.filtering && cases.length !== total ? ' · 命中 ' + cases.length : ''
2052
+ ),
2053
+ doc ? h('span', { className: 'studio-doc-version' }, 'v' + (doc.version || 1)) : null,
2054
+ doc
2055
+ ? h('span', { className: 'studio-doc-source', title: doc.sourcePath || '' },
2056
+ h(Badge, { tone: doc.sourceState === 'missing' ? 'danger' : 'success' },
2057
+ doc.sourceState === 'missing' ? '源缺失' : '源就绪'))
2058
+ : h(Badge, { tone: 'warn' }, '未关联文档')
2059
+ ),
2060
+ h('div', { className: 'studio-doc-sub' },
2061
+ isUnassigned
2062
+ ? h('span', { className: 'studio-doc-hint' }, '这些用例没有关联到导入文档,回写时按独立用例处理')
2063
+ : h(React.Fragment, null,
2064
+ h('span', { className: 'studio-doc-rollup' },
2065
+ rollup.length
2066
+ ? rollup.map((part) => h('span', { key: part.key, className: cx('tone-' + part.tone) }, part.label))
2067
+ : '暂无执行结果'
2068
+ ),
2069
+ h('span', { className: 'studio-doc-writeback' },
2070
+ doc.writeback?.at ? '回写 ' + relativeTime(doc.writeback.at) : '未回写'),
2071
+ h('span', { className: 'studio-doc-mode' }, docModeLabel(doc.mode))
2072
+ )
2073
+ )
2074
+ ),
2075
+ doc ? h('button', {
2076
+ type: 'button',
2077
+ className: 'studio-btn studio-btn-sm studio-doc-action',
2078
+ title: '重新读取源文档并更新该文档下的用例',
2079
+ onClick: (event) => { event.stopPropagation(); props.onReRead(doc); },
2080
+ }, h(Icon, { name: 'refresh', size: 12 }), h('span', { className: 'studio-doc-action-label' }, '重新导读')) : null
2081
+ );
2082
+ });
2083
+
2084
+ const CaseListItem = React.memo(function CaseListItem(props) {
1393
2085
  const item = props.item;
1394
- const selected = props.selected;
2086
+ const live = props.live || null;
1395
2087
  return h('div', {
1396
- className: cx('studio-case', props.active ? 'is-active' : ''),
1397
- onClick: props.onClick,
2088
+ className: cx('studio-case', props.active ? 'is-active' : '', live ? 'is-live' : ''),
2089
+ onClick: () => props.onSelect(item.tcId),
1398
2090
  role: 'button',
1399
2091
  tabIndex: 0,
2092
+ onKeyDown: (event) => {
2093
+ if (event.target !== event.currentTarget) return;
2094
+ if (event.key !== 'Enter' && event.key !== ' ') return;
2095
+ event.preventDefault();
2096
+ props.onSelect(item.tcId);
2097
+ },
1400
2098
  },
1401
2099
  h('label', { className: 'studio-case-check', onClick: (event) => event.stopPropagation() },
1402
- h('input', { type: 'checkbox', checked: selected, onChange: () => props.onToggle(item.tcId), 'aria-label': '选择用例' })
2100
+ h('input', { type: 'checkbox', checked: props.selected, onChange: () => props.onToggle(item.tcId), 'aria-label': '选择用例' })
1403
2101
  ),
1404
2102
  h('div', { className: 'studio-case-main' },
1405
2103
  h('div', { className: 'studio-case-top' },
@@ -1408,17 +2106,30 @@ window.__ModuleLoader__.load({
1408
2106
  ),
1409
2107
  h('div', { className: 'studio-case-meta' },
1410
2108
  h(ModeBadge, { mode: item.mode }),
1411
- item.module ? h('span', null, item.module) : null,
1412
- item.priority ? h('span', null, item.priority) : null,
1413
- item.mode === 'flow' && asArray(item.dataNeeds).length ? h('span', null, '数据提示:' + item.dataNeeds.join('、')) : null
2109
+ live
2110
+ ? h('span', { className: 'tone-business' },
2111
+ live.status === 'running'
2112
+ ? (live.note || '正在执行')
2113
+ : live.status === 'preparing'
2114
+ ? '准备执行'
2115
+ : '排队' + (live.position ? ' #' + live.position : '') + (live.ahead > 0 ? ' · 前方 ' + live.ahead : '')
2116
+ )
2117
+ : h(React.Fragment, null,
2118
+ item.module ? h('span', { key: 'module' }, item.module) : null,
2119
+ item.priority ? h('span', { key: 'priority' }, item.priority) : null,
2120
+ item.mode === 'flow' && asArray(item.dataNeeds).length ? h('span', { key: 'data' }, '数据提示:' + item.dataNeeds.join('、')) : null,
2121
+ )
1414
2122
  )
1415
2123
  ),
1416
2124
  h('div', { className: 'studio-case-side' },
1417
- h(StatusBadge, { status: item.status }),
2125
+ h(StatusBadge, { status: live ? live.status : item.status }),
1418
2126
  item.lastRun ? h('span', { className: 'studio-case-id' }, relativeTime(item.lastRun.at)) : null
1419
2127
  )
1420
2128
  );
1421
- }
2129
+ }, (prev, next) => prev.active === next.active
2130
+ && prev.selected === next.selected
2131
+ && sameLiveState(prev.live, next.live)
2132
+ && caseSignature(prev.item) === caseSignature(next.item));
1422
2133
 
1423
2134
  function EvidenceImage(props) {
1424
2135
  const [failed, setFailed] = useState(false);
@@ -1449,6 +2160,11 @@ window.__ModuleLoader__.load({
1449
2160
  ...entry,
1450
2161
  url: entry.url || (entry.file ? API + '/shot?project=' + encodeURIComponent(props.project || '') + '&file=' + encodeURIComponent(entry.file) : ''),
1451
2162
  }));
2163
+ const liveRun = props.liveRun || null;
2164
+ const caseDoc = props.doc || null;
2165
+ const caseDocId = item.docId || item.source?.docId || '';
2166
+ const caseDocName = caseDoc?.name || item.docName || '';
2167
+ const caseDocKind = caseDoc?.kind || item.docKind || '';
1452
2168
  return h('div', { className: 'studio-detail' },
1453
2169
  h('div', { className: 'studio-detail-head' },
1454
2170
  h('div', { style: { display: 'flex', alignItems: 'flex-start', justifyContent: 'space-between', gap: 8 } },
@@ -1456,19 +2172,31 @@ window.__ModuleLoader__.load({
1456
2172
  h('h3', { className: 'studio-detail-title' }, item.title || item.tcId),
1457
2173
  h('div', { className: 'studio-detail-meta' },
1458
2174
  h(ModeBadge, { mode: item.mode }),
1459
- h(StatusBadge, { status: item.status }),
2175
+ h(StatusBadge, { status: liveRun ? liveRun.status : item.status }),
1460
2176
  item.module ? h(Badge, { tone: 'muted' }, item.module) : null,
1461
2177
  item.priority ? h(Badge, { tone: 'muted' }, item.priority) : null
2178
+ ),
2179
+ h('div', { className: cx('studio-doc-link', caseDocName ? '' : 'is-unassigned'), title: caseDoc?.sourcePath || '' },
2180
+ h(Icon, { name: 'folder', size: 12 }),
2181
+ h('span', null, '所属文档:', h('span', { className: 'studio-doc-link-name' }, caseDocName || '未归属文档')),
2182
+ caseDoc
2183
+ ? h('span', { className: cx('studio-doc-link-meta', caseDoc.sourceState === 'missing' ? 'tone-danger' : '') },
2184
+ docKindLabel(caseDoc.kind) + ' · v' + (caseDoc.version || 1) + ' · ' + (caseDoc.sourceState === 'missing' ? '源文件缺失' : '源文件可用'))
2185
+ : caseDocKind
2186
+ ? h('span', { className: 'studio-doc-link-meta' }, docKindLabel(caseDocKind))
2187
+ : caseDocId
2188
+ ? h('span', { className: 'studio-doc-link-meta' }, '文档记录不可用')
2189
+ : null
1462
2190
  )
1463
2191
  ),
1464
2192
  h('button', { className: 'studio-icon-btn', onClick: props.onClose, title: '收起' }, h(Icon, { name: 'x', size: 15 }))
1465
2193
  ),
1466
2194
  h('div', { className: 'studio-detail-actions' },
1467
2195
  item.lastRun && ['failed', 'partial', 'blocked'].includes(item.lastRun.status)
1468
- ? h('button', { className: 'studio-btn studio-btn-primary studio-btn-sm', disabled: !props.hasBaseUrl, title: props.hasBaseUrl ? '不填写反馈,直接用 Agent 重跑' : '请先配置被测地址', onClick: () => props.onRunAgent(item) }, h(Icon, { name: 'play', size: 12 }), '直接重跑')
1469
- : h('button', { className: 'studio-btn studio-btn-primary studio-btn-sm', disabled: !props.hasBaseUrl, title: props.hasBaseUrl ? '' : '请先配置被测地址', onClick: () => props.onRun(item) }, h(Icon, { name: 'play', size: 12 }), item.lastRun ? '再执行一次' : '执行用例'),
2196
+ ? h('button', { className: 'studio-btn studio-btn-primary studio-btn-sm', disabled: !props.hasBaseUrl || Boolean(liveRun), title: liveRun ? '该用例正在批次中执行' : props.hasBaseUrl ? '不填写反馈,直接用 Agent 重跑' : '请先配置被测地址', onClick: () => props.onRunAgent(item) }, h(Icon, { name: 'play', size: 12 }), '直接重跑')
2197
+ : h('button', { className: 'studio-btn studio-btn-primary studio-btn-sm', disabled: !props.hasBaseUrl || Boolean(liveRun), title: liveRun ? '该用例正在批次中执行' : props.hasBaseUrl ? '' : '请先配置被测地址', onClick: () => props.onRun(item) }, h(Icon, { name: 'play', size: 12 }), liveRun ? '执行中' : item.lastRun ? '再执行一次' : '执行用例'),
1470
2198
  item.lastRun ? h('button', { className: 'studio-btn studio-btn-sm', onClick: () => { setTab('run'); setFeedbackRequest((value) => value + 1); } }, h(Icon, { name: 'file', size: 12 }), '填写反馈') : null,
1471
- (!item.lastRun || !['failed', 'partial', 'blocked'].includes(item.lastRun.status)) && (item.flow || asArray(item.preconditionFlows).length) ? h('button', { className: 'studio-btn studio-btn-sm', disabled: !props.hasBaseUrl, title: props.hasBaseUrl ? '' : '请先配置被测地址', onClick: () => props.onRunAgent(item) }, h(Icon, { name: 'spark', size: 12 }), '用 Agent 重跑') : null,
2199
+ (!item.lastRun || !['failed', 'partial', 'blocked'].includes(item.lastRun.status)) && (item.flow || asArray(item.preconditionFlows).length) ? h('button', { className: 'studio-btn studio-btn-sm', disabled: !props.hasBaseUrl || Boolean(liveRun), title: liveRun ? '该用例正在批次中执行' : props.hasBaseUrl ? '' : '请先配置被测地址', onClick: () => props.onRunAgent(item) }, h(Icon, { name: 'spark', size: 12 }), '用 Agent 重跑') : null,
1472
2200
  item.lastRun?.batchId ? h('button', { className: 'studio-btn studio-btn-sm', onClick: () => props.onOpenBatch(item.lastRun.batchId) }, h(Icon, { name: 'batch', size: 12 }), '打开批次') : null,
1473
2201
  h('button', { className: 'studio-btn studio-btn-sm', onClick: () => props.onAdd(item.tcId) }, h(Icon, { name: 'plus', size: 12 }), '加入批次'),
1474
2202
  h('button', { className: 'studio-btn studio-btn-sm', onClick: () => props.onEdit(item) }, '编辑'),
@@ -1479,6 +2207,19 @@ window.__ModuleLoader__.load({
1479
2207
  h(Icon, { name: 'alert', size: 13 }), '当前工作区未配置被测地址 baseUrl;执行前请先去设置页填写。',
1480
2208
  h('button', { className: 'studio-btn studio-btn-sm', onClick: props.onOpenSettings }, '去设置')
1481
2209
  ) : null,
2210
+ liveRun ? h('div', { className: 'studio-detail-live' },
2211
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 6, flexWrap: 'wrap' } },
2212
+ h(StatusBadge, { status: liveRun.status }),
2213
+ h('span', null,
2214
+ liveRun.status === 'running'
2215
+ ? '当前批次正在执行这条用例'
2216
+ : liveRun.status === 'preparing'
2217
+ ? '正在准备执行环境'
2218
+ : '排队第 ' + (liveRun.queue?.position || '?') + ' 位' + (liveRun.queue?.ahead > 0 ? ' · 前方 ' + liveRun.queue.ahead + ' 条' : '')
2219
+ )
2220
+ ),
2221
+ liveRun.note ? h('div', { style: { marginTop: 5, color: 'var(--ui-text-2)' } }, liveRun.note) : null
2222
+ ) : null,
1482
2223
  h('div', { className: 'studio-lifecycle' },
1483
2224
  [
1484
2225
  { key: 'define', label: '用例定义', detail: '前置 / 步骤 / 预期', tone: 'success', tab: 'nl' },
@@ -1893,6 +2634,113 @@ window.__ModuleLoader__.load({
1893
2634
  );
1894
2635
  }
1895
2636
 
2637
+ function ReReadDialog(props) {
2638
+ const doc = props.doc;
2639
+ const [mode, setMode] = useState(doc?.mode === 'overwrite' ? 'overwrite' : 'merge');
2640
+ const [busy, setBusy] = useState(false);
2641
+ const [error, setError] = useState('');
2642
+ const [result, setResult] = useState(null);
2643
+ const sourceMissing = doc?.sourceState === 'missing';
2644
+ const current = result?.doc || doc;
2645
+ // 重新导读返回的是文档记录而不是视图,源状态回落到打开对话框时的快照。
2646
+ const sourceState = current?.sourceState || doc?.sourceState || 'missing';
2647
+ const lastRead = current?.lastRead || doc?.lastRead || null;
2648
+ // 首次导入后还没有 lastRead:退回到导入时间和那次导入的差异,别让对话框看起来像没有历史。
2649
+ const lastImportAt = current?.updatedAt || current?.importedAt || '';
2650
+ const lastDiff = lastRead?.diff || current?.diff || null;
2651
+ const diff = result?.diffSummary || result?.diff || lastRead?.diff || null;
2652
+ const submit = async () => {
2653
+ if (!props.onReRead) {
2654
+ setError('当前环境没有连接测试工作室 Host,无法重新导读。');
2655
+ return;
2656
+ }
2657
+ setBusy(true);
2658
+ setError('');
2659
+ setResult(null);
2660
+ try {
2661
+ const payload = await props.onReRead({ docId: doc.id, mode });
2662
+ setResult(payload);
2663
+ if (props.onDone) props.onDone(payload);
2664
+ } catch (err) {
2665
+ setError(err.message);
2666
+ } finally {
2667
+ setBusy(false);
2668
+ }
2669
+ };
2670
+ return h(Modal, {
2671
+ title: '重新导读文档',
2672
+ desc: '重新读取源文件并更新该文档下的用例;源文件只读,不会被改动。',
2673
+ onClose: props.onClose,
2674
+ footer: h(React.Fragment, null,
2675
+ h('button', { className: 'studio-btn', onClick: props.onClose }, result ? '完成' : '取消'),
2676
+ result || sourceMissing ? null : h('button', { className: 'studio-btn studio-btn-primary', onClick: submit, disabled: busy },
2677
+ busy ? h(Spinner) : h(Icon, { name: 'refresh', size: 14 }), busy ? '正在导读…' : '开始重新导读')
2678
+ ),
2679
+ },
2680
+ h('div', { className: 'studio-form' },
2681
+ h('div', { className: 'studio-kv' },
2682
+ h('span', { className: 'studio-kv-key' }, '文档'),
2683
+ h('span', { className: 'studio-kv-val' }, current?.name || '—'),
2684
+ h('span', { className: 'studio-kv-key' }, '类型'),
2685
+ h('span', { className: 'studio-kv-val' }, docKindLabel(current?.kind)),
2686
+ h('span', { className: 'studio-kv-key' }, '当前版本'),
2687
+ h('span', { className: 'studio-kv-val' }, 'v' + (current?.version || 1)),
2688
+ h('span', { className: 'studio-kv-key' }, '源文件'),
2689
+ h('span', { className: 'studio-kv-val studio-mono-break' }, current?.sourcePath || '—'),
2690
+ h('span', { className: 'studio-kv-key' }, '源文件状态'),
2691
+ h('span', { className: 'studio-kv-val' },
2692
+ h(Badge, { tone: sourceState === 'missing' ? 'danger' : 'success' },
2693
+ sourceState === 'missing' ? '源文件缺失' : '源文件可用')),
2694
+ h('span', { className: 'studio-kv-key' }, '上次导读'),
2695
+ h('span', { className: 'studio-kv-val' }, lastRead?.at
2696
+ ? relativeTime(lastRead.at) + ' · v' + (lastRead.version || 1)
2697
+ : lastImportAt
2698
+ ? '尚未重新导读 · 上次导入 ' + relativeTime(lastImportAt) + ' · v' + (current?.version || 1)
2699
+ : '尚未重新导读'),
2700
+ h('span', { className: 'studio-kv-key' }, '上次回写'),
2701
+ h('span', { className: 'studio-kv-val' }, current?.writeback?.at
2702
+ ? relativeTime(current.writeback.at) + (current.writeback.targetPath ? ' · ' + current.writeback.targetPath : '')
2703
+ : '尚未回写')
2704
+ ),
2705
+ lastDiff ? h('div', { className: 'studio-note' }, (lastRead?.diff ? '上次导读差异:' : '上次导入差异:') + diffText(lastDiff)) : null,
2706
+ sourceMissing ? h('div', { className: 'studio-note tone-danger', style: { display: 'flex', gap: 7, alignItems: 'flex-start' } },
2707
+ h(Icon, { name: 'alert', size: 14 }),
2708
+ h('span', null, '源文件已不存在,无法重新导读:', current?.sourcePath || doc?.sourcePath || '—')
2709
+ ) : null,
2710
+ h('div', { className: 'studio-card', style: { padding: '12px 14px', background: 'var(--dsw-alias-bg-layer-2)' } },
2711
+ h('div', { className: 'studio-nl-label' }, '导读方式'),
2712
+ h('label', { className: 'studio-check', style: { padding: '4px 0' } },
2713
+ h('input', { type: 'radio', name: 'studio-reread-mode', checked: mode === 'merge', onChange: () => setMode('merge') }),
2714
+ '合并更新'
2715
+ ),
2716
+ h('div', { className: 'studio-note', style: { marginLeft: 22 } }, '新增用例并更新同编号用例;源文档中已删除的旧用例保留。'),
2717
+ h('label', { className: 'studio-check', style: { padding: '4px 0', marginTop: 6 } },
2718
+ h('input', { type: 'radio', name: 'studio-reread-mode', checked: mode === 'overwrite', onChange: () => setMode('overwrite') }),
2719
+ '覆盖同名文档'
2720
+ ),
2721
+ h('div', { className: 'studio-note', style: { marginLeft: 22 } }, '以源文档为准,删除该文档上次导入、本次已不存在的用例;同编号用例按文档内容更新。')
2722
+ ),
2723
+ h('div', { className: 'studio-note' }, '导读完成后会尝试把该文档上一次的执行结果回写到新的用例文件;源文件只读,不会被修改。'),
2724
+ error ? h('div', { className: 'studio-note tone-danger' }, error) : null,
2725
+ result ? h('div', { className: 'studio-nl' },
2726
+ h('div', { className: 'studio-kv' },
2727
+ h('span', { className: 'studio-kv-key' }, '识别用例'),
2728
+ h('span', { className: 'studio-kv-val', style: { fontWeight: 600 } }, result.caseCount ?? asArray(result.cases).length),
2729
+ h('span', { className: 'studio-kv-key' }, '文档版本'),
2730
+ h('span', { className: 'studio-kv-val' }, 'v' + (result.doc?.version || current?.version || 1)),
2731
+ h('span', { className: 'studio-kv-key' }, '本次差异'),
2732
+ h('span', { className: 'studio-kv-val' }, diffText(diff)),
2733
+ h('span', { className: 'studio-kv-key' }, '结果回写'),
2734
+ h('span', { className: 'studio-kv-val' }, result.resultReapplied ? '已随导读重新回写上次结果' : '没有可重放的历史结果')
2735
+ ),
2736
+ asArray(result.warnings).length
2737
+ ? h('div', { className: 'studio-note tone-warn' }, asArray(result.warnings).map((warning) => warning.message || warning.code || String(warning)).join(';'))
2738
+ : null
2739
+ ) : null
2740
+ )
2741
+ );
2742
+ }
2743
+
1896
2744
  function CasesView(props) {
1897
2745
  const snapshot = props.snapshot;
1898
2746
  const [query, setQuery] = useState('');
@@ -1902,11 +2750,89 @@ window.__ModuleLoader__.load({
1902
2750
  const [deleteTargets, setDeleteTargets] = useState([]);
1903
2751
  const [exportOpen, setExportOpen] = useState(false);
1904
2752
  const [exportKind, setExportKind] = useState('cases');
1905
- const cases = asArray(snapshot.cases).filter((item) => caseMatches(item, query, filter));
1906
- const selectedCase = asArray(snapshot.cases).find((item) => item.tcId === props.selectedCaseId) || null;
2753
+ const [collapsedDocs, setCollapsedDocs] = useState(() => new Set());
2754
+ const [reReadDoc, setReReadDoc] = useState(null);
2755
+ const allCases = asArray(snapshot.cases);
2756
+ const activeRuns = useMemo(() => {
2757
+ const map = new Map();
2758
+ for (const run of asArray(snapshot.activeBatch?.cases)) map.set(String(run.caseId), run);
2759
+ return map;
2760
+ }, [snapshot.activeBatch]);
2761
+ const liveFor = (item) => {
2762
+ const run = activeRuns.get(String(item.tcId));
2763
+ if (!run || !['running', 'queued', 'preparing'].includes(run.status)) return null;
2764
+ return {
2765
+ status: run.status,
2766
+ note: run.note || run.agentLive?.note || '',
2767
+ position: run.queue?.position,
2768
+ ahead: run.queue?.ahead,
2769
+ };
2770
+ };
2771
+ const cases = useMemo(() => allCases.filter((item) => caseMatches(item, query, filter, liveFor(item))), [allCases, query, filter, activeRuns]);
2772
+ const filterCounts = useMemo(() => {
2773
+ const counts = { all: allCases.length };
2774
+ for (const entry of CASE_FILTERS) {
2775
+ if (entry.id !== 'all') counts[entry.id] = allCases.filter((item) => caseMatches(item, '', entry.id, liveFor(item))).length;
2776
+ }
2777
+ return counts;
2778
+ }, [allCases, activeRuns]);
2779
+ const docs = useMemo(() => asArray(snapshot.docs), [snapshot.docs]);
2780
+ const docIds = useMemo(() => new Set(docs.map((doc) => doc.id)), [docs]);
2781
+ const filtering = filter !== 'all' || Boolean(query.trim());
2782
+ const unassignedAll = useMemo(() => allCases.filter((item) => !item.docId && !item.source?.docId), [allCases]);
2783
+ const rows = useMemo(() => {
2784
+ const byDoc = new Map();
2785
+ const unassigned = [];
2786
+ for (const item of cases) {
2787
+ const id = item.docId || item.source?.docId || '';
2788
+ if (id && docIds.has(id)) {
2789
+ if (!byDoc.has(id)) byDoc.set(id, []);
2790
+ byDoc.get(id).push(item);
2791
+ } else {
2792
+ unassigned.push(item);
2793
+ }
2794
+ }
2795
+ const next = [];
2796
+ for (const doc of docs) {
2797
+ const list = byDoc.get(doc.id) || [];
2798
+ if (filtering && !list.length) continue;
2799
+ next.push({ type: 'doc', key: 'doc:' + doc.id, doc, cases: list });
2800
+ if (filtering || !collapsedDocs.has(doc.id)) {
2801
+ for (const item of list) next.push({ type: 'case', key: 'case:' + item.tcId, item });
2802
+ }
2803
+ }
2804
+ if (unassigned.length || (!filtering && unassignedAll.length)) {
2805
+ next.push({ type: 'unassigned', key: 'unassigned', cases: unassigned, total: unassignedAll.length });
2806
+ if (filtering || !collapsedDocs.has('__unassigned__')) {
2807
+ for (const item of unassigned) next.push({ type: 'case', key: 'case:' + item.tcId, item });
2808
+ }
2809
+ }
2810
+ return next;
2811
+ }, [cases, docs, docIds, filtering, unassignedAll, collapsedDocs]);
2812
+ const toggleDocCollapse = useCallback((id) => {
2813
+ setCollapsedDocs((current) => {
2814
+ const next = new Set(current);
2815
+ if (next.has(id)) next.delete(id);
2816
+ else next.add(id);
2817
+ return next;
2818
+ });
2819
+ }, []);
2820
+ const toggleDocCases = useCallback((ids, next) => {
2821
+ const set = new Set(props.selectedIds);
2822
+ for (const id of ids) {
2823
+ if (next) set.add(id);
2824
+ else set.delete(id);
2825
+ }
2826
+ props.onSelectAll([...set]);
2827
+ }, [props.selectedIds, props.onSelectAll]);
2828
+ const selectedCase = allCases.find((item) => item.tcId === props.selectedCaseId) || null;
2829
+ const selectedDoc = selectedCase
2830
+ ? docs.find((doc) => doc.id === (selectedCase.docId || selectedCase.source?.docId)) || null
2831
+ : null;
2832
+ const selectedLive = selectedCase ? liveFor(selectedCase) : null;
1907
2833
  const selectedCount = props.selectedIds.length;
1908
2834
  const hasBaseUrl = Boolean(snapshot.config?.baseUrl);
1909
- const selectedCases = asArray(snapshot.cases).filter((item) => props.selectedIds.includes(item.tcId));
2835
+ const selectedCases = allCases.filter((item) => props.selectedIds.includes(item.tcId));
1910
2836
  const selectedFlows = (() => {
1911
2837
  const map = new Map();
1912
2838
  const add = (flow, kind, caseId) => {
@@ -1924,48 +2850,56 @@ window.__ModuleLoader__.load({
1924
2850
  return [...map.values()];
1925
2851
  })();
1926
2852
  return h('div', null,
1927
- h('div', { className: 'studio-page-head' },
1928
- h('div', null,
1929
- h('h1', { className: 'studio-page-title' }, '用例'),
1930
- h('p', { className: 'studio-page-desc' }, '选中用例查看执行、反馈与知识沉淀;可单条执行、加入批次,或批量删除关联流程。')
1931
- ),
1932
- h('div', { className: 'studio-page-actions' },
1933
- selectedCount ? h('span', { className: 'studio-badge tone-link' }, '已选 ' + selectedCount + ' 条') : null,
1934
- h('button', { className: 'studio-btn', onClick: props.onImport }, h(Icon, { name: 'import', size: 14 }), '导入'),
1935
- h('button', { className: 'studio-btn', onClick: () => { setExportKind('cases'); setExportOpen(true); } }, h(Icon, { name: 'file', size: 14 }), '导出用例'),
1936
- h('button', { className: 'studio-btn', onClick: () => { setExportKind('results'); setExportOpen(true); } }, h(Icon, { name: 'file', size: 14 }), '导出结果'),
1937
- h('button', {
1938
- className: 'studio-btn studio-btn-danger',
1939
- onClick: () => { setDeleteTargets(selectedCases); setDeleteCasesOpen(true); },
1940
- disabled: !selectedCount,
1941
- title: selectedCount ? '删除所选用例' : '先选择要删除的用例',
1942
- }, h(Icon, { name: 'trash', size: 14 }), '删除用例' + (selectedCount ? '(' + selectedCount + ')' : '')),
1943
- h('button', { className: 'studio-btn studio-btn-danger', onClick: () => setDeleteFlowsOpen(true), disabled: !selectedFlows.length, title: selectedFlows.length ? '删除所选用例关联的 flow' : '所选用例没有关联 flow' },
1944
- h(Icon, { name: 'trash', size: 14 }), '批量删除关联流程' + (selectedFlows.length ? '(' + selectedFlows.length + ')' : '')
1945
- ),
1946
- h('button', { className: 'studio-btn studio-btn-primary', onClick: () => props.onNewBatch(props.selectedIds), disabled: !cases.length }, h(Icon, { name: 'play', size: 14 }), '执行所选用例')
1947
- )
2853
+ h(PageHeader, {
2854
+ kicker: '用例库',
2855
+ icon: 'cases',
2856
+ title: '用例',
2857
+ desc: '选中用例查看执行、反馈与知识沉淀;可单条执行、加入批次,或批量管理。',
2858
+ meta: [
2859
+ h('span', { key: 'total', className: 'studio-badge tone-muted' }, allCases.length + ' 条用例'),
2860
+ snapshot.activeBatch ? h(StatusBadge, { key: 'live', status: 'running', label: '批次执行中' }) : null,
2861
+ ],
2862
+ actions: [
2863
+ selectedCount ? h('span', { key: 'sel', className: 'studio-badge tone-link' }, '已选 ' + selectedCount + ' 条') : null,
2864
+ h('button', { key: 'import', className: 'studio-btn', onClick: props.onImport }, h(Icon, { name: 'import', size: 14 }), '导入'),
2865
+ h(MenuButton, { key: 'export', label: '导出', icon: 'file' }, [
2866
+ h('button', { key: 'cases', className: 'studio-btn', onClick: () => { setExportKind('cases'); setExportOpen(true); } }, '导出用例'),
2867
+ h('button', { key: 'results', className: 'studio-btn', onClick: () => { setExportKind('results'); setExportOpen(true); } }, '导出结果'),
2868
+ ]),
2869
+ h(MenuButton, { key: 'more', label: '批量操作', icon: 'more' }, [
2870
+ h('button', { key: 'delcases', className: 'studio-btn', disabled: !selectedCount, onClick: () => { setDeleteTargets(selectedCases); setDeleteCasesOpen(true); } }, '删除所选用例' + (selectedCount ? '(' + selectedCount + ')' : '')),
2871
+ h('button', { key: 'delflows', className: 'studio-btn', disabled: !selectedFlows.length, onClick: () => setDeleteFlowsOpen(true) }, '删除关联流程' + (selectedFlows.length ? '(' + selectedFlows.length + ')' : '')),
2872
+ ]),
2873
+ h('button', { key: 'run', className: 'studio-btn studio-btn-primary', onClick: () => props.onNewBatch(props.selectedIds), disabled: !cases.length }, h(Icon, { name: 'play', size: 14 }), '执行所选用例'),
2874
+ ],
2875
+ }),
2876
+ h('div', { className: 'studio-note', style: { marginBottom: 8 } },
2877
+ '用例按导入文档分组展示;执行结果会回写到各自文档的用例文件。'
2878
+ + ' 共 ' + docs.length + ' 个文档、' + allCases.length + ' 条用例'
2879
+ + (unassignedAll.length ? ',其中 ' + unassignedAll.length + ' 条未归属文档' : '')
2880
+ + '。'
1948
2881
  ),
1949
- asArray(snapshot.docs).length ? h('div', { className: 'studio-note', style: { marginBottom: 8 } },
1950
- '已导入文档:' + asArray(snapshot.docs).slice(0, 4).map((doc) => doc.name + '(' + (doc.count || 0) + ' 条 · v' + (doc.version || 1) + ')').join('、')
1951
- + (asArray(snapshot.docs).length > 4 ? ' 等 ' + asArray(snapshot.docs).length + ' 个' : '')
1952
- + ';重复导入同名文档可更新对应用例。'
1953
- ) : null,
1954
2882
  h('div', { className: 'studio-toolbar' },
1955
2883
  h('div', { className: 'studio-search' },
1956
2884
  h('span', { className: 'studio-search-icon' }, h(Icon, { name: 'search', size: 14 })),
1957
2885
  h('input', { className: 'studio-input', placeholder: '搜索编号、标题、前置条件、步骤…', value: query, onChange: (event) => setQuery(event.target.value) })
1958
2886
  ),
1959
- CASE_FILTERS.map((item) => h('button', {
1960
- key: item.id,
1961
- className: cx('studio-chip', filter === item.id ? 'is-active' : ''),
1962
- onClick: () => setFilter(item.id),
1963
- }, item.label))
2887
+ h('div', { className: 'studio-filter-bar' },
2888
+ CASE_FILTERS.map((item) => h('button', {
2889
+ key: item.id,
2890
+ className: cx('studio-chip', filter === item.id ? 'is-active' : ''),
2891
+ onClick: () => setFilter(item.id),
2892
+ }, item.label, h('span', { className: 'studio-chip-count' }, filterCounts[item.id] ?? 0)))
2893
+ )
1964
2894
  ),
1965
2895
  h('div', { className: 'studio-grid-2' },
1966
- h('div', null,
1967
- h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 8 } },
1968
- h('span', { className: 'studio-row-sub' }, cases.length + ' 条用例'),
2896
+ h('div', { className: 'studio-card studio-card-flush' },
2897
+ h('div', { className: 'studio-list-head' },
2898
+ h('span', { className: 'studio-row-sub' },
2899
+ cases.length + ' 条用例'
2900
+ + (filtering ? ' · 已按文档展开' : ' · ' + docs.length + ' 个文档')
2901
+ + (!filtering && unassignedAll.length ? ' · 未归属 ' + unassignedAll.length : '')
2902
+ ),
1969
2903
  h('label', { className: 'studio-check' },
1970
2904
  h('input', {
1971
2905
  type: 'checkbox',
@@ -1975,19 +2909,44 @@ window.__ModuleLoader__.load({
1975
2909
  '全选当前结果'
1976
2910
  )
1977
2911
  ),
1978
- cases.length
1979
- ? h('div', { className: 'studio-case-list' }, cases.slice(0, 400).map((item) => h(CaseListItem, {
1980
- key: item.tcId,
1981
- item,
1982
- active: item.tcId === props.selectedCaseId,
1983
- selected: props.selectedIds.includes(item.tcId),
1984
- onClick: () => props.onSelectCase(item.tcId),
1985
- onToggle: props.onToggleCase,
1986
- })))
1987
- : h(Empty, { icon: 'search', title: '没有匹配的用例', desc: '换一个关键词,或先导入新的用例文档。' })
2912
+ rows.length
2913
+ ? h(VirtualList, {
2914
+ items: rows,
2915
+ rowHeight: 74,
2916
+ className: 'studio-case-scroll',
2917
+ keyFor: (row) => row.key,
2918
+ resetKey: filter + '|' + query,
2919
+ ariaLabel: '文档与用例列表',
2920
+ renderRow: (row) => {
2921
+ if (row.type === 'case') {
2922
+ return h(CaseListItem, {
2923
+ item: row.item,
2924
+ active: row.item.tcId === props.selectedCaseId,
2925
+ selected: props.selectedIds.includes(row.item.tcId),
2926
+ live: liveFor(row.item),
2927
+ onSelect: props.onSelectCase,
2928
+ onToggle: props.onToggleCase,
2929
+ });
2930
+ }
2931
+ return h(CaseDocHeader, {
2932
+ doc: row.doc || null,
2933
+ cases: row.cases,
2934
+ total: row.total,
2935
+ expanded: filtering || !collapsedDocs.has(row.doc ? row.doc.id : '__unassigned__'),
2936
+ filtering,
2937
+ selectedIds: props.selectedIds,
2938
+ onToggleCollapse: toggleDocCollapse,
2939
+ onToggleCases: toggleDocCases,
2940
+ onReRead: setReReadDoc,
2941
+ });
2942
+ },
2943
+ })
2944
+ : h('div', { className: 'studio-empty-wrap' }, h(Empty, { icon: 'search', title: '没有匹配的用例', desc: '换一个关键词,或先导入新的用例文档。' }))
1988
2945
  ),
1989
2946
  selectedCase ? h(CaseDetail, {
1990
2947
  item: selectedCase,
2948
+ doc: selectedDoc,
2949
+ liveRun: selectedLive,
1991
2950
  project: snapshot.project,
1992
2951
  onClose: () => props.onSelectCase(''),
1993
2952
  onRun: props.onRunCase,
@@ -2024,6 +2983,20 @@ window.__ModuleLoader__.load({
2024
2983
  filteredIds: cases.map((item) => item.tcId),
2025
2984
  onClose: () => setExportOpen(false),
2026
2985
  }) : null,
2986
+ reReadDoc ? h(ReReadDialog, {
2987
+ doc: reReadDoc,
2988
+ onClose: () => setReReadDoc(null),
2989
+ onReRead: props.onReReadDocument,
2990
+ onDone: (payload) => {
2991
+ if (props.onToast) {
2992
+ props.onToast({
2993
+ kind: 'success',
2994
+ text: '已重新导读:' + (payload?.doc?.name || reReadDoc.name)
2995
+ + (payload?.caseCount ? ' · ' + payload.caseCount + ' 条用例' : ''),
2996
+ });
2997
+ }
2998
+ },
2999
+ }) : null,
2027
3000
  props.caseRunBatchId ? h(CaseRunDrawer, {
2028
3001
  batchId: props.caseRunBatchId,
2029
3002
  caseId: props.caseRunCaseId || props.selectedCaseId,
@@ -2067,11 +3040,6 @@ window.__ModuleLoader__.load({
2067
3040
  });
2068
3041
  }
2069
3042
 
2070
- function batchActionStatus(batch) {
2071
- if (batch.status === 'preparing') return 'running';
2072
- return batch.status || 'queued';
2073
- }
2074
-
2075
3043
  function KnowledgeDeposit(props) {
2076
3044
  const knowledge = props.knowledge || null;
2077
3045
  if (!knowledge) return null;
@@ -2289,6 +3257,10 @@ window.__ModuleLoader__.load({
2289
3257
  .finally(() => { if (!cancelled) setBusy(false); });
2290
3258
  return () => { cancelled = true; };
2291
3259
  }, [props.batch.id, props.project]);
3260
+ const previewDocs = preview ? asArray(preview.documents) : [];
3261
+ const previewFiles = preview
3262
+ ? [...new Set([...asArray(preview.files), ...previewDocs.map((item) => item.targetPath).filter(Boolean)])]
3263
+ : [];
2292
3264
  return h(Modal, {
2293
3265
  title: '回写用例文档',
2294
3266
  desc: '整个批次结束后只写一次。Markdown 用例插入结果块与截图;xlsx 生成执行结果副本,不覆盖原文档。',
@@ -2325,12 +3297,29 @@ window.__ModuleLoader__.load({
2325
3297
  h('span', { className: 'studio-kv-key' }, '插入 / 替换'),
2326
3298
  h('span', { className: 'studio-kv-val' }, (preview.markdown?.inserted || 0) + ' / ' + (preview.markdown?.replaced || 0)),
2327
3299
  h('span', { className: 'studio-kv-key' }, 'xlsx'),
2328
- h('span', { className: 'studio-kv-val' }, preview.xlsx?.path || (preview.xlsx?.written ? '生成执行结果副本' : '无'))
3300
+ h('span', { className: 'studio-kv-val' }, preview.xlsx?.path
3301
+ || (previewDocs.some((item) => item.kind === 'xlsx' && !item.error) ? '按文档生成执行结果副本' : '无'))
2329
3302
  ),
2330
- asArray(preview.files).length ? h('div', null,
3303
+ previewDocs.length ? h('div', null,
3304
+ h('div', { className: 'studio-nl-label' }, '按文档回写'),
3305
+ h('div', { className: 'studio-nl-list', style: { paddingLeft: 0 } },
3306
+ previewDocs.slice(0, 12).map((item, index) => h('div', {
3307
+ key: item.id || index,
3308
+ className: 'studio-code',
3309
+ style: { marginBottom: 4, display: 'block' },
3310
+ },
3311
+ (item.name || item.id || '')
3312
+ + ' · ' + docKindLabel(item.kind)
3313
+ + ' · ' + (item.results || 0) + ' 条'
3314
+ + (item.targetPath ? ' → ' + item.targetPath : '')
3315
+ + (item.error ? ' · 失败:' + (item.error.message || item.error.code || '') : '')
3316
+ ))
3317
+ )
3318
+ ) : null,
3319
+ previewFiles.length ? h('div', null,
2331
3320
  h('div', { className: 'studio-nl-label' }, '将修改'),
2332
3321
  h('div', { className: 'studio-nl-list', style: { paddingLeft: 0 } },
2333
- preview.files.slice(0, 12).map((file, index) => h('div', { key: index, className: 'studio-code', style: { marginBottom: 4, display: 'block' } }, file))
3322
+ previewFiles.slice(0, 12).map((file, index) => h('div', { key: index, className: 'studio-code', style: { marginBottom: 4, display: 'block' } }, file))
2334
3323
  )
2335
3324
  ) : null
2336
3325
  ) : null
@@ -2342,8 +3331,9 @@ window.__ModuleLoader__.load({
2342
3331
  const summary = summaryPieces(run.note || run.review?.summary || '')[0];
2343
3332
  const evidenceCount = asArray(run.evidence).length;
2344
3333
  const open = () => props.onClick();
3334
+ const live = run.status === 'running' || run.queue?.state === 'running' || run.status === 'preparing';
2345
3335
  return h('div', {
2346
- className: 'studio-result-row',
3336
+ className: cx('studio-result-row', live ? 'is-live' : ''),
2347
3337
  role: 'button',
2348
3338
  tabIndex: 0,
2349
3339
  onClick: open,
@@ -2500,10 +3490,21 @@ window.__ModuleLoader__.load({
2500
3490
  const [writebackOpen, setWritebackOpen] = useState(false);
2501
3491
  const [exportOpen, setExportOpen] = useState(false);
2502
3492
  const [liveFocus, setLiveFocus] = useState(null);
2503
- const stages = batchStageList(batch);
2504
- const percent = batchPercent(batch);
2505
- const summary = batch.summary || {};
3493
+ const [runFilter, setRunFilter] = useState('all');
3494
+ const progress = batchProgress(batch);
2506
3495
  const cases = sortRunsForDisplay(batch.cases);
3496
+ const runFilterDefs = [
3497
+ { id: 'all', label: '全部', match: () => true },
3498
+ { id: 'live', label: '进行中', match: (run) => ['running', 'preparing', 'queued', 'pending'].includes(run.status) || ['running', 'queued'].includes(run.queue?.state) },
3499
+ { id: 'passed', label: '通过', match: (run) => run.status === 'passed' || run.status === 'partial' },
3500
+ { id: 'failed', label: '失败', match: (run) => run.status === 'failed' },
3501
+ { id: 'blocked', label: '阻塞', match: (run) => run.status === 'blocked' },
3502
+ { id: 'rest', label: '未执行', match: (run) => ['untested', 'skipped', 'stopped'].includes(run.status) },
3503
+ ];
3504
+ const runCounts = {};
3505
+ for (const def of runFilterDefs) runCounts[def.id] = def.id === 'all' ? cases.length : cases.filter(def.match).length;
3506
+ const activeFilter = runFilterDefs.find((def) => def.id === runFilter) || runFilterDefs[0];
3507
+ const visibleCases = runFilter === 'all' ? cases : cases.filter(activeFilter.match);
2507
3508
  const stoppable = ['running', 'preparing', 'queued'].includes(String(batch.status || ''));
2508
3509
  const deletable = !['running', 'queued', 'preparing'].includes(String(batch.status || ''));
2509
3510
  const distillStage = String(batch.stages?.distill?.status || '');
@@ -2524,6 +3525,7 @@ window.__ModuleLoader__.load({
2524
3525
  setDistillError('');
2525
3526
  setLogOpen(false);
2526
3527
  setArchiveOpen(false);
3528
+ setRunFilter('all');
2527
3529
  }, [batch.id]);
2528
3530
  const distillBatchNow = async () => {
2529
3531
  setDistilling(true);
@@ -2552,84 +3554,83 @@ window.__ModuleLoader__.load({
2552
3554
  }
2553
3555
  };
2554
3556
  return h('div', null,
2555
- h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, marginBottom: 12 } },
3557
+ h('div', { className: 'studio-backbar' },
2556
3558
  h('button', { className: 'studio-btn studio-btn-sm', onClick: props.onBack }, h(Icon, { name: 'chevron', size: 12, className: 'studio-rotate-180' }), '返回批次'),
2557
- h('span', { className: 'studio-row-sub' }, batch.id)
2558
- ),
2559
- h('div', { className: 'studio-card' },
2560
- h('div', { style: { display: 'flex', alignItems: 'flex-start', justifyContent: 'space-between', gap: 14, flexWrap: 'wrap' } },
2561
- h('div', { style: { minWidth: 0 } },
2562
- h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap' } },
2563
- h('h1', { className: 'studio-page-title', style: { fontSize: 18 } }, batch.name || batch.id),
2564
- h(StatusBadge, { status: batchActionStatus(batch) }),
2565
- batch.options?.allowWrites ? h(Badge, { tone: 'warn' }, '写操作已放行') : h(Badge, { tone: 'muted' }, '只读')
2566
- ),
2567
- h('div', { className: 'studio-run-meta', style: { marginTop: 7 } },
2568
- h('span', null, '创建 ' + formatTime(batch.createdAt)),
2569
- batch.startedAt ? h('span', null, '开始 ' + formatTime(batch.startedAt)) : null,
2570
- batch.endedAt ? h('span', null, '结束 ' + formatTime(batch.endedAt)) : null,
2571
- h('span', null, '并发 ' + (batch.options?.concurrency || Math.max(batch.options?.workers || 0, batch.options?.agentWorkers || 0) || '-')),
2572
- batch.options?.forceCreateData ? h('span', null, '强制造数') : null
2573
- )
2574
- ),
2575
- h('div', { className: 'studio-page-actions' },
2576
- stoppable ? h('button', { className: 'studio-btn studio-btn-danger', onClick: async () => { await props.onStop(batch.id); refreshNow(); } }, h(Icon, { name: 'stop', size: 13 }), '停止批次') : null,
2577
- !stoppable && (batch.status === 'done' || batch.status === 'stopped') ? h('button', { className: 'studio-btn studio-btn-primary', onClick: () => setWritebackOpen(true) }, h(Icon, { name: 'file', size: 13 }), batch.writeback ? '再次回写' : '回写用例文档') : null,
2578
- h('button', { className: 'studio-btn', onClick: () => setExportOpen(true), disabled: !cases.length, title: cases.length ? '导出本批次测试结果 xlsx' : '批次还没有用例结果' }, h(Icon, { name: 'file', size: 13 }), '导出结果'),
2579
- needsDistill ? h('button', {
2580
- className: 'studio-btn studio-btn-primary',
2581
- disabled: distilling,
2582
- title: '重新学习本批页面与流程并写入中心知识库',
2583
- onClick: distillBatchNow,
2584
- }, distilling ? h(Spinner) : h(Icon, { name: 'knowledge', size: 13 }), distilling ? '沉淀中…' : '重新沉淀') : null,
2585
- h('button', {
2586
- className: 'studio-btn studio-btn-danger',
2587
- disabled: !deletable,
2588
- title: deletable ? '删除批次目录与该批次的结果记录' : '批次正在执行,请先停止批次',
2589
- onClick: () => { setDeleteError(''); setDeleteOpen(true); },
2590
- }, h(Icon, { name: 'trash', size: 13 }), '删除批次'),
2591
- batch.resultDoc ? h('span', { className: 'studio-code', style: { maxWidth: 260, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }, title: batch.resultDoc }, shortPath(batch.resultDoc, 36)) : null
2592
- )
2593
- ),
2594
- h('div', { style: { marginTop: 16 } }, h(Progress, { percent, label: percent + '%' })),
2595
- h('div', { className: 'studio-stepper', style: { marginTop: 18 } },
2596
- stages.map((stage) => h('div', { key: stage.id, className: cx('studio-step', 'is-' + stage.status) },
2597
- h('div', { className: 'studio-step-rail' },
2598
- h('div', { className: 'studio-step-dot' }, stage.status === 'done' ? h(Icon, { name: 'check', size: 11 }) : stage.status === 'running' ? h(Spinner, { className: 'studio-step-spinner' }) : null),
2599
- stage.id !== 'distill' ? h('div', { className: 'studio-step-line' }) : null
2600
- ),
2601
- h('div', { className: 'studio-step-body' },
2602
- h('div', { className: 'studio-step-title' }, stage.label),
2603
- h('div', { className: 'studio-step-meta' }, stage.status === 'running' ? '进行中…' : stage.meta || statusLabel(stage.status))
2604
- )
2605
- ))
2606
- )
2607
- ),
2608
-
2609
- h('div', { className: 'studio-stat-grid', style: { marginTop: 14 } },
2610
- h(Stat, { label: '通过', value: summary.passed || 0, tone: 'success', hint: '含部分通过 ' + (summary.partial || 0) }),
2611
- h(Stat, { label: '失败', value: summary.failed || 0, tone: 'danger', hint: '失败步骤保留截图' }),
2612
- h(Stat, { label: '阻塞', value: summary.blocked || 0, tone: 'warn', hint: '前置数据或环境限制' }),
2613
- h(Stat, { label: '未开始', value: summary.queued || summary.untested || 0, hint: summary.stopped ? '已停止 ' + summary.stopped + ' · 排队中 ' + (summary.queued || 0) : '排队中的用例' })
3559
+ h('span', { className: 'studio-code' }, batch.id)
2614
3560
  ),
3561
+ h(ExecutionBanner, {
3562
+ batch,
3563
+ progress,
3564
+ actions: [
3565
+ stoppable ? h('button', { key: 'stop', className: 'studio-btn studio-btn-danger', onClick: async () => { await props.onStop(batch.id); refreshNow(); } }, h(Icon, { name: 'stop', size: 13 }), '停止批次') : null,
3566
+ !stoppable && (batch.status === 'done' || batch.status === 'stopped') ? h('button', { key: 'writeback', className: 'studio-btn studio-btn-primary', onClick: () => setWritebackOpen(true) }, h(Icon, { name: 'file', size: 13 }), batch.writeback ? '再次回写' : '回写用例文档') : null,
3567
+ needsDistill ? h('button', {
3568
+ key: 'distill',
3569
+ className: 'studio-btn studio-btn-primary',
3570
+ disabled: distilling,
3571
+ title: '重新学习本批页面与流程并写入中心知识库',
3572
+ onClick: distillBatchNow,
3573
+ }, distilling ? h(Spinner) : h(Icon, { name: 'knowledge', size: 13 }), distilling ? '沉淀中…' : '重新沉淀') : null,
3574
+ h(MenuButton, { key: 'more', label: '更多', icon: 'more' }, [
3575
+ h('button', { key: 'export', className: 'studio-btn', disabled: !cases.length, title: cases.length ? '导出本批次测试结果 xlsx' : '批次还没有用例结果', onClick: () => setExportOpen(true) }, h(Icon, { name: 'file', size: 13 }), '导出结果'),
3576
+ h('button', { key: 'log', className: 'studio-btn', onClick: () => setLogOpen(true) }, h(Icon, { name: 'terminal', size: 13 }), '执行日志'),
3577
+ h('button', { key: 'archive', className: 'studio-btn', onClick: () => setArchiveOpen(true) }, h(Icon, { name: 'knowledge', size: 13 }), '归档与沉淀'),
3578
+ h('button', { key: 'delete', className: 'studio-btn studio-btn-danger', disabled: !deletable, title: deletable ? '删除批次目录与该批次的结果记录' : '批次正在执行,请先停止批次', onClick: () => { setDeleteError(''); setDeleteOpen(true); } }, h(Icon, { name: 'trash', size: 13 }), '删除批次'),
3579
+ ]),
3580
+ ],
3581
+ }),
2615
3582
 
3583
+ distilling ? h('div', { style: { marginTop: 12 } }, h(OperationProgress, {
3584
+ label: '正在重新沉淀本批知识',
3585
+ detail: '重新学习本批页面与流程,合并后写入中心知识库。完成后列表会自动刷新。',
3586
+ steps: [{ label: '页面学习', status: 'active' }, { label: '流程知识合并' }, { label: '写入中心知识库' }],
3587
+ })) : null,
2616
3588
  distillError ? h('div', { className: 'studio-note tone-danger', style: { marginTop: 10 } }, '重新沉淀失败:' + distillError) : null,
2617
3589
 
2618
- h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, margin: '16px 0 9px', flexWrap: 'wrap' } },
2619
- h('div', { className: 'studio-row-title' }, '用例结果'),
2620
- h('span', { className: 'studio-row-sub' }, cases.length + ' 条 · 点击用例查看结果、步骤、证据与知识沉淀'),
2621
- h('div', { style: { marginLeft: 'auto', display: 'flex', gap: 6 } },
3590
+ h('div', { className: 'studio-meta-strip' },
3591
+ h('span', null, '创建 ' + formatTime(batch.createdAt)),
3592
+ batch.startedAt ? h('span', null, '开始 ' + formatTime(batch.startedAt)) : null,
3593
+ batch.endedAt ? h('span', null, '结束 ' + formatTime(batch.endedAt)) : null,
3594
+ h('span', null, '并发 ' + (batch.options?.concurrency || Math.max(batch.options?.workers || 0, batch.options?.agentWorkers || 0) || '-')),
3595
+ batch.options?.forceCreateData ? h('span', null, '强制造数') : null,
3596
+ batch.options?.allowWrites ? h('span', { className: 'tone-warn' }, '写操作已放行') : h('span', null, '只读'),
3597
+ batch.resultDoc ? h('span', null, '结果文档 ', h('span', { className: 'studio-code', title: batch.resultDoc }, shortPath(batch.resultDoc, 36))) : null
3598
+ ),
3599
+
3600
+ h('div', { className: 'studio-results-head' },
3601
+ h('div', null,
3602
+ h('div', { className: 'studio-row-title' }, '用例结果'),
3603
+ h('div', { className: 'studio-row-sub' }, cases.length + ' 条 · 点击用例查看结果、步骤、证据与知识沉淀')
3604
+ ),
3605
+ h('div', { className: 'studio-results-actions' },
2622
3606
  h('button', { className: 'studio-btn studio-btn-sm', onClick: () => setLogOpen(true) }, h(Icon, { name: 'file', size: 12 }), '执行日志'),
2623
3607
  h('button', { className: 'studio-btn studio-btn-sm', onClick: () => setArchiveOpen(true) }, h(Icon, { name: 'knowledge', size: 12 }), '归档与沉淀')
2624
3608
  )
2625
3609
  ),
3610
+ h('div', { className: 'studio-toolbar' },
3611
+ h('div', { className: 'studio-filter-bar' },
3612
+ runFilterDefs.map((def) => h('button', {
3613
+ key: def.id,
3614
+ className: cx('studio-chip', runFilter === def.id ? 'is-active' : ''),
3615
+ onClick: () => setRunFilter(def.id),
3616
+ }, def.label, h('span', { className: 'studio-chip-count' }, runCounts[def.id])))
3617
+ )
3618
+ ),
2626
3619
  cases.length
2627
- ? h('div', { className: 'studio-result-list' }, cases.map((run) => h(RunListRow, {
2628
- key: run.caseId,
2629
- run,
2630
- onClick: () => setCaseId(String(run.caseId)),
2631
- onAction: runAction,
2632
- })))
3620
+ ? h(VirtualList, {
3621
+ items: visibleCases,
3622
+ rowHeight: 82,
3623
+ className: 'studio-result-scroll',
3624
+ keyFor: (run) => String(run.caseId),
3625
+ resetKey: runFilter,
3626
+ ariaLabel: '用例结果',
3627
+ empty: h('div', { className: 'studio-empty-wrap' }, h(Empty, { icon: 'search', title: '当前筛选没有结果', desc: '切换到其他状态查看该批次的用例。' })),
3628
+ renderRow: (run) => h(RunListRow, {
3629
+ run,
3630
+ onClick: () => setCaseId(String(run.caseId)),
3631
+ onAction: runAction,
3632
+ }),
3633
+ })
2633
3634
  : h(Empty, { icon: 'batch', title: '批次还没有用例结果', desc: '执行开始后,这里会按用例实时出现状态、说明与截图。' }),
2634
3635
  caseRun ? h(BatchCaseDrawer, {
2635
3636
  run: caseRun,
@@ -2783,16 +3784,23 @@ window.__ModuleLoader__.load({
2783
3784
  );
2784
3785
  }
2785
3786
  const batches = asArray(snapshot.batches);
3787
+ const activeBatch = batches.find((batch) => ['running', 'preparing', 'queued'].includes(String(batch.status || ''))) || null;
3788
+ const finished = batches.filter((batch) => batch.summary?.failed).length;
2786
3789
  return h('div', null,
2787
- h('div', { className: 'studio-page-head' },
2788
- h('div', null,
2789
- h('h1', { className: 'studio-page-title' }, '批次'),
2790
- h('p', { className: 'studio-page-desc' }, '每个批次是一份可审计的执行记录:并发跑 flow 与 Agent,统一归档,最后只回写一次。')
2791
- ),
2792
- h('div', { className: 'studio-page-actions' },
2793
- h('button', { className: 'studio-btn studio-btn-primary', onClick: () => props.onNewBatch([]) }, h(Icon, { name: 'plus', size: 14 }), '新建批次')
2794
- )
2795
- ),
3790
+ h(PageHeader, {
3791
+ kicker: '执行记录',
3792
+ icon: 'batch',
3793
+ title: '批次',
3794
+ desc: '每个批次是一份可审计的执行记录:并发跑 flow 与 Agent,统一归档,最后只回写一次。',
3795
+ meta: [
3796
+ h('span', { key: 'total', className: 'studio-badge tone-muted' }, batches.length + ' 个批次'),
3797
+ activeBatch ? h(StatusBadge, { key: 'live', status: 'running', label: '1 个批次执行中' }) : null,
3798
+ finished ? h('span', { key: 'failed', className: 'studio-badge tone-danger' }, finished + ' 个批次有失败用例') : null,
3799
+ ],
3800
+ actions: [
3801
+ h('button', { key: 'new', className: 'studio-btn studio-btn-primary', onClick: () => props.onNewBatch([]) }, h(Icon, { name: 'plus', size: 14 }), '新建批次'),
3802
+ ],
3803
+ }),
2796
3804
  batches.length ? h('div', { className: 'studio-list' },
2797
3805
  batches.map((batch) => h(BatchRow, { key: batch.id, batch, onOpen: props.onSelectBatch }))
2798
3806
  ) : h(Empty, { icon: 'batch', title: '还没有批次', desc: '新建批次后,执行、证据、归档与回写都在这里。', action: h('button', { className: 'studio-btn studio-btn-primary', onClick: () => props.onNewBatch([]), style: { marginTop: 12 } }, '新建批次') })
@@ -2812,15 +3820,20 @@ window.__ModuleLoader__.load({
2812
3820
  });
2813
3821
  const flowCaseIds = [...new Set(flows.flatMap((flow) => asArray(flow.cases)).filter(Boolean))];
2814
3822
  return h('div', null,
2815
- h('div', { className: 'studio-page-head' },
2816
- h('div', null,
2817
- h('h1', { className: 'studio-page-title' }, '流程'),
2818
- h('p', { className: 'studio-page-desc' }, '通过 Agent 执行并判为通过的自然语言轨迹,会自动去值化沉淀为 flow;下一次同用例优先走 flow,更快、更稳定。')
2819
- ),
2820
- h('div', { className: 'studio-page-actions' },
2821
- h('button', { className: 'studio-btn', onClick: () => props.onNewBatch(flowCaseIds), disabled: !flowCaseIds.length }, h(Icon, { name: 'play', size: 14 }), '用流程跑批次' + (flowCaseIds.length ? '(' + flowCaseIds.length + ' 条用例)' : ''))
2822
- )
2823
- ),
3823
+ h(PageHeader, {
3824
+ kicker: '执行路径',
3825
+ icon: 'flow',
3826
+ title: '流程',
3827
+ desc: '通过 Agent 执行并判为通过的自然语言轨迹,会自动去值化沉淀为 flow;下一次同用例优先走 flow,更快、更稳定。',
3828
+ meta: [
3829
+ h('span', { key: 'total', className: 'studio-badge tone-muted' }, flows.length + ' 个流程'),
3830
+ h('span', { key: 'cases', className: 'studio-badge tone-muted' }, flowCaseIds.length + ' 条关联用例'),
3831
+ flows.some((flow) => flow.generated) ? h('span', { key: 'gen', className: 'studio-badge tone-business' }, flows.filter((flow) => flow.generated).length + ' 个 Agent 沉淀') : null,
3832
+ ],
3833
+ actions: [
3834
+ h('button', { key: 'run', className: 'studio-btn studio-btn-primary', onClick: () => props.onNewBatch(flowCaseIds), disabled: !flowCaseIds.length }, h(Icon, { name: 'play', size: 14 }), '用流程跑批次' + (flowCaseIds.length ? '(' + flowCaseIds.length + ' 条用例)' : '')),
3835
+ ],
3836
+ }),
2824
3837
  h('div', { className: 'studio-toolbar' },
2825
3838
  h('div', { className: 'studio-search' },
2826
3839
  h('span', { className: 'studio-search-icon' }, h(Icon, { name: 'search', size: 14 })),
@@ -3224,6 +4237,86 @@ window.__ModuleLoader__.load({
3224
4237
  );
3225
4238
  }
3226
4239
 
4240
+ const PIPELINE_PHASE_LABELS = {
4241
+ idle: '空闲',
4242
+ extracting: '提取中',
4243
+ indexing: '索引中',
4244
+ backoff: '重试等待',
4245
+ stopped: '已停用',
4246
+ };
4247
+
4248
+ function CentralPipelineCard(props) {
4249
+ const pipeline = props.pipeline;
4250
+ const counts = pipeline && pipeline.counts && typeof pipeline.counts === 'object' ? pipeline.counts : null;
4251
+ const phase = pipeline?.phase || 'idle';
4252
+ const phaseTone = pipeline?.last_error
4253
+ ? 'danger'
4254
+ : phase === 'backoff'
4255
+ ? 'warn'
4256
+ : phase === 'stopped'
4257
+ ? 'warn'
4258
+ : pipeline?.manual
4259
+ ? 'link'
4260
+ : pipeline?.auto === false
4261
+ ? 'muted'
4262
+ : 'success';
4263
+ const sources = counts ? Number(counts.sources) || 0 : 0;
4264
+ const extractPending = counts ? Number(counts.extract_pending) || 0 : 0;
4265
+ const knowledge = counts ? Number(counts.knowledge) || 0 : 0;
4266
+ const indexPending = counts ? Number(counts.index_pending) || 0 : 0;
4267
+ const extracted = Math.max(0, sources - extractPending);
4268
+ const indexed = Math.max(0, knowledge - indexPending);
4269
+ const extractPercent = sources ? Math.round((extracted / sources) * 100) : (extractPending ? 0 : 100);
4270
+ const indexPercent = knowledge ? Math.round((indexed / knowledge) * 100) : (indexPending ? 0 : 100);
4271
+ const lastExtract = pipeline?.last_extract || null;
4272
+ const lastIndex = pipeline?.last_index || null;
4273
+ const engine = String(lastExtract?.engine || '');
4274
+ const activity = lastIndex
4275
+ ? '最近索引 ' + relativeTime(lastIndex.at) + ',本次 ' + (Number(lastIndex.indexed) || 0) + ' 条' + (Number(lastIndex.errors) ? ',错误 ' + lastIndex.errors + ' 条' : '')
4276
+ : lastExtract
4277
+ ? '最近提取 ' + relativeTime(lastExtract.at) + ',扫描 ' + (Number(lastExtract.scanned) || 0) + ' 条,保存 ' + (Number(lastExtract.stored) || 0) + ' 个分类'
4278
+ : '等待首次自动运行';
4279
+ const error = props.error || '';
4280
+ const errorNote = error
4281
+ ? h('div', { className: 'studio-note tone-' + (pipeline ? 'warn' : 'danger'), style: { marginTop: 8 } },
4282
+ pipeline ? '状态刷新失败,显示的是最后一次成功状态:' + error : '状态读取失败:' + error
4283
+ )
4284
+ : null;
4285
+ return h('div', { className: 'studio-card', style: { marginBottom: 12 } },
4286
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap' } },
4287
+ h('div', { className: 'studio-row-title' }, '自动管线'),
4288
+ pipeline ? h(Badge, { tone: phaseTone }, PIPELINE_PHASE_LABELS[phase] || phase) : h(Badge, { tone: 'muted' }, props.enabled ? '连接中' : '未启用'),
4289
+ pipeline?.manual ? h('span', { className: 'studio-row-sub' }, '手动补跑') : null,
4290
+ pipeline?.auto === false ? h('span', { className: 'studio-row-sub' }, '自动已关闭') : null,
4291
+ pipeline?.updated_at ? h('span', { className: 'studio-row-sub', style: { marginLeft: 'auto' } }, '更新于 ' + relativeTime(pipeline.updated_at)) : null
4292
+ ),
4293
+ !props.enabled
4294
+ ? h('div', { className: 'studio-note', style: { marginTop: 8 } }, '中心知识库未启用,自动管线不会运行。')
4295
+ : !pipeline
4296
+ ? (errorNote || h('div', { className: 'studio-loading', style: { marginTop: 8 } }, h(Spinner), '正在读取管线状态…'))
4297
+ : h(React.Fragment, null,
4298
+ errorNote,
4299
+ counts
4300
+ ? h('div', { style: { display: 'grid', gridTemplateColumns: 'repeat(2,minmax(0,1fr))', gap: '10px 18px', marginTop: 10 } },
4301
+ h('div', null,
4302
+ h('div', { className: 'studio-row-sub' }, '知识提取 ' + extracted + ' / ' + sources),
4303
+ h(Progress, { percent: extractPercent, tone: 'business', label: extractPercent + '%' })
4304
+ ),
4305
+ h('div', null,
4306
+ h('div', { className: 'studio-row-sub' }, '语义索引 ' + indexed + ' / ' + knowledge),
4307
+ h(Progress, { percent: indexPercent, tone: 'success', label: indexPercent + '%' })
4308
+ )
4309
+ )
4310
+ : h('div', { className: 'studio-note tone-warn', style: { marginTop: 8 } }, '计数暂不可用:' + (pipeline.error || '中心库暂时不可达')),
4311
+ h('div', { className: 'studio-row-sub', style: { marginTop: 8 } }, activity),
4312
+ pipeline.last_error ? h('div', { className: 'studio-note tone-danger', style: { marginTop: 6 } }, '最近错误(' + (pipeline.last_error.phase || phase) + '):' + (pipeline.last_error.message || '未知错误') + ' · ' + relativeTime(pipeline.last_error.at)) : null,
4313
+ engine === 'heuristic' || engine === 'llm+heuristic'
4314
+ ? h('div', { className: 'studio-note tone-warn', style: { marginTop: 6 } }, '上次提取使用了规则兜底(engine=' + engine + '),LLM 不可用。')
4315
+ : null
4316
+ )
4317
+ );
4318
+ }
4319
+
3227
4320
  function CentralKnowledgePanel(props) {
3228
4321
  const central = props.central || {};
3229
4322
  const nodeCount = asArray(central.nodes).reduce((sum, item) => sum + (Number(item.count) || 0), 0);
@@ -3255,8 +4348,13 @@ window.__ModuleLoader__.load({
3255
4348
  const [extractionsLoading, setExtractionsLoading] = useState(false);
3256
4349
  const [extractBusy, setExtractBusy] = useState(false);
3257
4350
  const [semanticBusy, setSemanticBusy] = useState(false);
4351
+ const [categorizeBusy, setCategorizeBusy] = useState(false);
4352
+ const [opStartedAt, setOpStartedAt] = useState(null);
3258
4353
  const [extractResult, setExtractResult] = useState(null);
3259
4354
  const [extractError, setExtractError] = useState('');
4355
+ const [pipeline, setPipeline] = useState(null);
4356
+ const [pipelineError, setPipelineError] = useState('');
4357
+ const pipelineRevisionRef = useRef(-1);
3260
4358
  const [importMode, setImportMode] = useState('');
3261
4359
  const seqRef = useRef(0);
3262
4360
 
@@ -3269,7 +4367,6 @@ window.__ModuleLoader__.load({
3269
4367
  if (kind !== 'extract') return undefined;
3270
4368
  let cancelled = false;
3271
4369
  setExtractionsLoading(true);
3272
- setExtractError('');
3273
4370
  api('/knowledge/central/extractions', { project: props.project, query: { limit: 40 } })
3274
4371
  .then((payload) => { if (!cancelled) setExtractions(asArray(payload.items)); })
3275
4372
  .catch((err) => { if (!cancelled) setExtractError(err.message); })
@@ -3277,9 +4374,48 @@ window.__ModuleLoader__.load({
3277
4374
  return () => { cancelled = true; };
3278
4375
  }, [kind, reload, props.project]);
3279
4376
 
4377
+ useEffect(() => {
4378
+ if (!central.enabled) {
4379
+ setPipeline(null);
4380
+ setPipelineError('');
4381
+ return undefined;
4382
+ }
4383
+ let cancelled = false;
4384
+ let timer = null;
4385
+ const poll = async () => {
4386
+ try {
4387
+ const payload = await api('/knowledge/central/pipeline', {
4388
+ project: props.project,
4389
+ query: { groupId: central.groupId || '' },
4390
+ timeoutMs: 20000,
4391
+ });
4392
+ if (!cancelled) {
4393
+ setPipeline(payload);
4394
+ setPipelineError('');
4395
+ }
4396
+ } catch (err) {
4397
+ // 保留上一份状态,由卡片标明它已过期。
4398
+ if (!cancelled) setPipelineError(err?.message || '状态读取失败');
4399
+ }
4400
+ if (!cancelled) timer = setTimeout(poll, 2000);
4401
+ };
4402
+ poll();
4403
+ return () => { cancelled = true; if (timer) clearTimeout(timer); };
4404
+ }, [central.enabled, central.groupId, props.project]);
4405
+
4406
+ useEffect(() => {
4407
+ if (!pipeline) return;
4408
+ const revision = Number(pipeline.revision);
4409
+ if (!Number.isFinite(revision) || revision === pipelineRevisionRef.current) return;
4410
+ const first = pipelineRevisionRef.current < 0;
4411
+ pipelineRevisionRef.current = revision;
4412
+ if (!first && kind === 'extract') setReload((value) => value + 1);
4413
+ }, [pipeline, kind]);
4414
+
3280
4415
  const runExtract = async (force) => {
3281
4416
  if (extractBusy) return;
3282
4417
  setExtractBusy(true);
4418
+ setOpStartedAt(Date.now());
3283
4419
  setExtractError('');
3284
4420
  setExtractResult(null);
3285
4421
  try {
@@ -3295,14 +4431,16 @@ window.__ModuleLoader__.load({
3295
4431
  setExtractError(err.message);
3296
4432
  } finally {
3297
4433
  setExtractBusy(false);
4434
+ setOpStartedAt(null);
3298
4435
  }
3299
4436
  };
3300
4437
 
3301
4438
  const runSemanticIndex = async () => {
3302
4439
  if (semanticBusy) return;
3303
4440
  setSemanticBusy(true);
4441
+ setOpStartedAt(Date.now());
3304
4442
  setExtractError('');
3305
- setCategoryNote('正在把提取结果送入语义索引…');
4443
+ setCategoryNote('');
3306
4444
  try {
3307
4445
  const payload = await api('/knowledge/central/semantic-index', {
3308
4446
  method: 'POST',
@@ -3314,9 +4452,9 @@ window.__ModuleLoader__.load({
3314
4452
  setReload((value) => value + 1);
3315
4453
  } catch (err) {
3316
4454
  setExtractError(err.message);
3317
- setCategoryNote('');
3318
4455
  } finally {
3319
4456
  setSemanticBusy(false);
4457
+ setOpStartedAt(null);
3320
4458
  }
3321
4459
  };
3322
4460
 
@@ -3433,45 +4571,73 @@ window.__ModuleLoader__.load({
3433
4571
  };
3434
4572
 
3435
4573
  const organizeCategories = async () => {
4574
+ if (categorizeBusy) return;
4575
+ setCategorizeBusy(true);
4576
+ setOpStartedAt(Date.now());
3436
4577
  setActionError('');
3437
- setCategoryNote('正在整理分类…');
3438
4578
  try {
3439
4579
  const payload = await api('/knowledge/central/categories', { method: 'POST', project: props.project, body: { force: true }, timeoutMs: 300000 });
3440
4580
  setCategoryNote('分类整理完成:扫描 ' + (payload.scanned || 0) + ' 条,补标记 ' + (payload.updated || 0) + ' 条');
3441
4581
  setReload((value) => value + 1);
3442
4582
  } catch (err) {
3443
4583
  setActionError(err.message);
3444
- setCategoryNote('');
4584
+ } finally {
4585
+ setCategorizeBusy(false);
4586
+ setOpStartedAt(null);
3445
4587
  }
3446
4588
  };
3447
4589
 
3448
4590
  const emptyText = kind === 'episodes' ? '近况' : kind === 'facts' ? '事实' : '实体';
4591
+ const activeOp = extractBusy
4592
+ ? { label: '正在提取知识', detail: '读取已有知识和导入文档,按页面知识、业务流程、操作流程、注意事项、单据流转整理要点。每次处理 20 条未提取数据。', steps: [{ label: '扫描知识' }, { label: '分类提取', status: 'active' }, { label: '写入知识库' }] }
4593
+ : semanticBusy
4594
+ ? { label: '正在建立语义索引', detail: '把已提取的知识送入 Graphiti 语义索引,每次处理 5 条。', steps: [{ label: '读取提取结果' }, { label: '生成索引', status: 'active' }, { label: '写回中心库' }] }
4595
+ : categorizeBusy
4596
+ ? { label: '正在整理分类', detail: '扫描中心知识条目,为缺少分类的条目补标记。', steps: [{ label: '扫描条目' }, { label: '补标记', status: 'active' }] }
4597
+ : null;
3449
4598
  return h('div', null,
3450
4599
  h('div', { className: 'studio-card', style: { marginBottom: 12 } },
3451
4600
  h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap' } },
3452
4601
  h('div', { className: 'studio-row-title' }, '中心知识库'),
3453
4602
  h(Badge, { tone: central.ok ? 'success' : central.enabled ? 'danger' : 'warn' }, centralStatusText(central)),
3454
- central.url ? h('span', { className: 'studio-code' }, central.url) : null,
4603
+ central.url ? h('span', { className: 'studio-code', title: central.url }, central.url) : null,
3455
4604
  central.groupId ? h('span', { className: 'studio-badge tone-muted' }, 'group ' + central.groupId) : null,
3456
4605
  h('div', { style: { marginLeft: 'auto', display: 'flex', gap: 6, flexWrap: 'wrap' } },
3457
4606
  h('button', { className: 'studio-btn studio-btn-sm', onClick: refresh, disabled: refreshing }, refreshing ? h(Spinner) : h(Icon, { name: 'refresh', size: 12 }), '刷新'),
3458
- h('button', { className: 'studio-btn studio-btn-sm', onClick: () => setImportMode('files') }, h(Icon, { name: 'file', size: 12 }), '导入文件'),
3459
- h('button', { className: 'studio-btn studio-btn-sm', onClick: () => setImportMode('folder') }, h(Icon, { name: 'folder', size: 12 }), '导入文件夹'),
3460
- h('button', { className: 'studio-btn studio-btn-sm', onClick: organizeCategories }, h(Icon, { name: 'knowledge', size: 12 }), '整理分类'),
3461
- kind === 'docs' ? h('button', { className: 'studio-btn studio-btn-sm', onClick: syncDocs, disabled: docsLoading }, h(Icon, { name: 'refresh', size: 12 }), '同步中心文档') : null,
3462
- h('button', { className: 'studio-btn studio-btn-sm', onClick: props.onOpenSettings }, '配置')
4607
+ h(MenuButton, { label: '导入', icon: 'import' }, [
4608
+ h('button', { key: 'files', className: 'studio-btn', onClick: () => setImportMode('files') }, h(Icon, { name: 'file', size: 13 }), '导入文件'),
4609
+ h('button', { key: 'folder', className: 'studio-btn', onClick: () => setImportMode('folder') }, h(Icon, { name: 'folder', size: 13 }), '导入文件夹'),
4610
+ kind === 'docs' ? h('button', { key: 'sync', className: 'studio-btn', disabled: docsLoading, onClick: syncDocs }, h(Icon, { name: 'refresh', size: 13 }), '同步中心文档') : null,
4611
+ ]),
4612
+ h(MenuButton, { label: '维护', icon: 'settings' }, [
4613
+ h('button', { key: 'cat', className: 'studio-btn', disabled: categorizeBusy, onClick: organizeCategories }, h(Icon, { name: 'knowledge', size: 13 }), categorizeBusy ? '整理中…' : '整理分类'),
4614
+ h('button', { key: 'cfg', className: 'studio-btn', onClick: props.onOpenSettings }, h(Icon, { name: 'settings', size: 13 }), '知识库配置'),
4615
+ ])
3463
4616
  )
3464
4617
  ),
3465
- h('div', { className: 'studio-row-sub', style: { marginTop: 6 } },
3466
- central.ok
3467
- ? 'Neo4j 节点 ' + nodeCount + ' 个 / 关系 ' + edgeCount + ' 条;最后同步 ' + relativeTime(central.at) + '。批次沉淀会增量写入这里。'
3468
- : central.error || '中心知识库未启用;本地缓存页签仍可正常使用。'
3469
- )
4618
+ h('div', { className: 'studio-central-metrics' },
4619
+ h('div', { className: 'studio-central-metric' },
4620
+ h('div', { className: 'studio-central-metric-value' }, nodeCount),
4621
+ h('div', { className: 'studio-central-metric-label' }, '图节点')
4622
+ ),
4623
+ h('div', { className: 'studio-central-metric' },
4624
+ h('div', { className: 'studio-central-metric-value' }, edgeCount),
4625
+ h('div', { className: 'studio-central-metric-label' }, '关系')
4626
+ ),
4627
+ h('div', { className: 'studio-central-metric' },
4628
+ h('div', { className: 'studio-central-metric-value' }, central.at ? relativeTime(central.at) : '—'),
4629
+ h('div', { className: 'studio-central-metric-label' }, '最后同步')
4630
+ )
4631
+ ),
4632
+ !central.ok ? h('div', { className: 'studio-note' + (central.error ? ' tone-danger' : ''), style: { marginTop: 10 } },
4633
+ central.error || '中心知识库未启用;本地缓存页签仍可正常使用。') : null
3470
4634
  ),
4635
+ activeOp ? h(OperationProgress, { label: activeOp.label, detail: activeOp.detail, steps: activeOp.steps, startedAt: opStartedAt, active: true }) : null,
4636
+ h(CentralPipelineCard, { pipeline, error: pipelineError, enabled: central.enabled === true }),
3471
4637
  h(TabBar, {
3472
4638
  tabs: CENTRAL_TABS.map((item) => (item.id === kind ? { ...item, count: items.length } : item)),
3473
4639
  active: kind,
3474
- onChange: setKind,
4640
+ onChange: (value) => { setKind(value); setExtractError(''); },
3475
4641
  }),
3476
4642
  kind === 'episodes' ? h('div', { style: { display: 'flex', gap: 6, flexWrap: 'wrap', margin: '0 0 10px' } },
3477
4643
  KNOWLEDGE_CATEGORY_TABS.map((item) => h('button', {
@@ -3514,12 +4680,12 @@ window.__ModuleLoader__.load({
3514
4680
  h('div', { className: 'studio-card', style: { marginBottom: 12 } },
3515
4681
  h('div', { className: 'studio-row-title' }, '从当前知识库提取知识'),
3516
4682
  h('div', { className: 'studio-row-sub', style: { marginTop: 6 } },
3517
- '读取已有知识和导入文档,按页面知识、业务流程、操作流程、注意事项、单据流转提取要点;每次处理 20 条未提取数据。'
4683
+ '知识提取和语义索引由中心服务自动、持续运行,新知识与导入文档会自动处理。下方按钮只用于补跑、重跑或排查问题。'
3518
4684
  ),
3519
4685
  h('div', { className: 'studio-detail-actions' },
3520
- h('button', { className: 'studio-btn studio-btn-primary', onClick: () => runExtract(false), disabled: extractBusy }, extractBusy ? h(Spinner) : h(Icon, { name: 'knowledge', size: 14 }), extractBusy ? '提取中…' : '一键提取'),
4686
+ h('button', { className: 'studio-btn', onClick: () => runExtract(false), disabled: extractBusy }, extractBusy ? h(Spinner) : h(Icon, { name: 'knowledge', size: 14 }), extractBusy ? '提取中…' : '手动提取一批(20 条)'),
3521
4687
  h('button', { className: 'studio-btn', onClick: () => runExtract(true), disabled: extractBusy }, '重新提取最近 20 条'),
3522
- h('button', { className: 'studio-btn', onClick: runSemanticIndex, disabled: semanticBusy || extractBusy }, semanticBusy ? h(Spinner) : h(Icon, { name: 'shield', size: 14 }), semanticBusy ? '索引中…' : '语义索引(5 条)')
4688
+ h('button', { className: 'studio-btn', onClick: runSemanticIndex, disabled: semanticBusy || extractBusy }, semanticBusy ? h(Spinner) : h(Icon, { name: 'shield', size: 14 }), semanticBusy ? '索引中…' : '手动索引一批(5 条)')
3523
4689
  ),
3524
4690
  extractError ? h('div', { className: 'studio-note tone-danger', style: { marginTop: 8 } }, extractError) : null,
3525
4691
  extractResult ? h('div', { className: 'studio-note', style: { marginTop: 8 } },
@@ -3527,8 +4693,8 @@ window.__ModuleLoader__.load({
3527
4693
  (extractResult.remaining !== undefined ? ',还有 ' + extractResult.remaining + ' 条未提取' : '')
3528
4694
  ) : null
3529
4695
  ),
3530
- extractionsLoading ? h('div', { className: 'studio-note' }, h(Spinner), ' 正在读取提取结果…') : null,
3531
- !extractionsLoading && !extractions.length ? h(Empty, { icon: 'knowledge', title: '还没有提取记录', desc: '点击「一键提取」,从现有知识和导入文档中整理分类要点。' }) : null,
4696
+ extractionsLoading ? h('div', { className: 'studio-loading' }, h(Spinner), '正在读取提取结果…') : null,
4697
+ !extractionsLoading && !extractions.length ? h(Empty, { icon: 'knowledge', title: '还没有提取记录', desc: '自动管线会持续提取;也可以手动补跑一批。' }) : null,
3532
4698
  h('div', { className: 'studio-list' },
3533
4699
  KNOWLEDGE_CATEGORY_TABS.filter((item) => item.id).map((item) => {
3534
4700
  const points = groupedExtractions.get(item.id) || [];
@@ -3553,7 +4719,7 @@ window.__ModuleLoader__.load({
3553
4719
  ? h('div', null,
3554
4720
  actionError ? h('div', { className: 'studio-note tone-danger', style: { marginBottom: 10 } }, actionError) : null,
3555
4721
  docsError ? h('div', { className: 'studio-note tone-danger', style: { marginBottom: 10 } }, '读取导入文档失败:' + docsError) : null,
3556
- docsLoading ? h('div', { className: 'studio-note' }, h(Spinner), ' 正在读取导入文档…') : null,
4722
+ docsLoading ? h('div', { className: 'studio-loading' }, h(Spinner), '正在读取导入文档…') : null,
3557
4723
  !docsLoading && !docsError && !documents.length
3558
4724
  ? h(Empty, { icon: 'file', title: '还没有导入文档', desc: '从上方「导入文件/文件夹」导入后,可以在这里查看、编辑和删除。' })
3559
4725
  : null,
@@ -3576,7 +4742,7 @@ window.__ModuleLoader__.load({
3576
4742
  )
3577
4743
  : h('div', null,
3578
4744
  listError ? h('div', { className: 'studio-note tone-danger', style: { marginBottom: 10 } }, '中心知识库读取失败:' + listError) : null,
3579
- loading ? h('div', { className: 'studio-note' }, h(Spinner), ' 正在读取中心知识库…') : null,
4745
+ loading ? h('div', { className: 'studio-loading' }, h(Spinner), '正在读取中心知识库…') : null,
3580
4746
  !loading && !listError && !items.length
3581
4747
  ? h(Empty, {
3582
4748
  icon: 'knowledge',
@@ -3722,19 +4888,19 @@ window.__ModuleLoader__.load({
3722
4888
  ) : h(Empty, { icon: 'file', title: '还没有业务规则', desc: '从文档导入或知识库合并后会出现。' });
3723
4889
  };
3724
4890
  return h('div', null,
3725
- h('div', { className: 'studio-page-head' },
3726
- h('div', null,
3727
- h('h1', { className: 'studio-page-title' }, '知识'),
3728
- h('p', { className: 'studio-page-desc' }, '中心知识库是主知识源;本地缓存只用于选择器与离线兜底。执行过程中看到的页面结构、动作与流程会先写入缓存,再增量同步到中心。')
3729
- ),
3730
- h('div', { className: 'studio-page-actions' },
3731
- h(Badge, { tone: central.ok ? 'success' : central.enabled ? 'danger' : 'warn' }, '中心 ' + centralStatusText(central)),
3732
- h('span', { className: 'studio-badge tone-business' }, summary.pages + ' 页面缓存'),
3733
- h('span', { className: 'studio-badge tone-link' }, summary.processes + ' 流程缓存'),
3734
- summary.corrections ? h('span', { className: 'studio-badge tone-success' }, summary.corrections + ' 条纠错经验') : null,
3735
- h('span', { className: 'studio-badge tone-muted' }, summary.learnings + ' 学习')
3736
- )
3737
- ),
4891
+ h(PageHeader, {
4892
+ kicker: '知识沉淀',
4893
+ icon: 'knowledge',
4894
+ title: '知识',
4895
+ desc: '中心知识库是主知识源;本地缓存只用于选择器与离线兜底。执行过程中看到的页面结构、动作与流程会先写入缓存,再增量同步到中心。',
4896
+ meta: [
4897
+ h(StatusBadge, { key: 'central', status: central.ok ? 'done' : central.enabled ? 'failed' : 'untested', label: '中心 ' + centralStatusText(central) }),
4898
+ h('span', { key: 'pages', className: 'studio-badge tone-muted' }, (summary.pages || 0) + ' 页面缓存'),
4899
+ h('span', { key: 'processes', className: 'studio-badge tone-muted' }, (summary.processes || 0) + ' 流程缓存'),
4900
+ summary.corrections ? h('span', { key: 'fixes', className: 'studio-badge tone-success' }, summary.corrections + ' 条纠错经验') : null,
4901
+ h('span', { key: 'learn', className: 'studio-badge tone-muted' }, (summary.learnings || 0) + ' 学习'),
4902
+ ],
4903
+ }),
3738
4904
  h(TabBar, {
3739
4905
  tabs: [
3740
4906
  { id: 'central', label: '中心知识库' },
@@ -4198,15 +5364,21 @@ window.__ModuleLoader__.load({
4198
5364
  const centralInfo = centralResult || snapshot.central || {};
4199
5365
  const centralNodeCount = asArray(centralInfo.nodes).reduce((sum, item) => sum + (Number(item.count) || 0), 0);
4200
5366
  return h('div', null,
4201
- h('div', { className: 'studio-page-head' },
4202
- h('div', null,
4203
- h('h1', { className: 'studio-page-title' }, '设置'),
4204
- h('p', { className: 'studio-page-desc' }, '连接被测环境、并发策略与回写方式。测试步骤会按角色从已导入账号中自动选择并切换账号;账号密码保存在本地测试工程。')
4205
- ),
4206
- h('div', { className: 'studio-page-actions' },
4207
- h('button', { className: 'studio-btn', onClick: runDoctor, disabled: doctorBusy }, doctorBusy ? h(Spinner) : h(Icon, { name: 'shield', size: 14 }), '环境自检')
4208
- )
4209
- ),
5367
+ h(PageHeader, {
5368
+ kicker: '运行配置',
5369
+ icon: 'settings',
5370
+ title: '设置',
5371
+ desc: '连接被测环境、并发策略与回写方式。测试步骤会按角色从已导入账号中自动选择并切换账号;账号密码保存在本地测试工程。',
5372
+ meta: [
5373
+ h('span', { key: 'url', className: 'studio-code', title: config.baseUrl || '' }, config.baseUrl || '未配置被测地址'),
5374
+ h('span', { key: 'conc', className: 'studio-badge tone-muted' }, '并发 ' + (config.concurrency || 0)),
5375
+ h('span', { key: 'wb', className: 'studio-badge tone-muted' }, config.writeBack === 'none' ? '不回写' : config.writeBack === 'batch' ? '批次文档' : '回写用例文档'),
5376
+ accounts.length ? h('span', { key: 'acc', className: 'studio-badge tone-muted' }, accounts.length + ' 个测试账号') : null,
5377
+ ],
5378
+ actions: [
5379
+ h('button', { key: 'doctor', className: 'studio-btn', onClick: runDoctor, disabled: doctorBusy }, doctorBusy ? h(Spinner) : h(Icon, { name: 'shield', size: 14 }), '环境自检'),
5380
+ ],
5381
+ }),
4210
5382
  h('div', { className: 'studio-grid-2' },
4211
5383
  h('div', { className: 'studio-card' },
4212
5384
  h('div', { className: 'studio-form' },
@@ -4446,33 +5618,44 @@ window.__ModuleLoader__.load({
4446
5618
  !uploadSupported ? h('div', { className: 'studio-note tone-warn', style: { marginTop: 8 } }, '当前 Host 没有加载上传接口。请重启 DSH 后再试;也可以先用下面的服务器路径导入。') : null
4447
5619
  ),
4448
5620
  docs.length ? h('div', { className: 'studio-card', style: { padding: '12px 14px', background: 'var(--dsw-alias-bg-layer-2)' } },
4449
- h('div', { className: 'studio-nl-label' }, '已导入文档(点击可覆盖更新)'),
5621
+ h('div', { className: 'studio-nl-label' }, '已导入文档(点击可带入路径和导入方式)'),
4450
5622
  h('div', { className: 'studio-list' },
4451
- docs.slice(0, 8).map((doc) => h('div', {
4452
- key: doc.id || doc.docKey || doc.name,
4453
- className: 'studio-row',
4454
- role: 'button',
4455
- tabIndex: 0,
4456
- onClick: () => {
4457
- setName(doc.name || '');
4458
- if (doc.sourcePath) setFile(doc.sourcePath);
4459
- setMode('overwrite');
4460
- setResult(null);
4461
- setError('');
5623
+ docs.slice(0, 8).map((doc) => {
5624
+ const visible = Number(doc.visibleCount ?? doc.count) || 0;
5625
+ const owned = Number(doc.ownedCount) || 0;
5626
+ const missing = doc.sourceState === 'missing';
5627
+ const isMatched = matchedDoc && (doc.id === matchedDoc.id || doc.docKey === matchedDoc.docKey);
5628
+ return h('div', {
5629
+ key: doc.id || doc.docKey || doc.name,
5630
+ className: 'studio-row',
5631
+ role: 'button',
5632
+ tabIndex: 0,
5633
+ title: doc.sourcePath || '',
5634
+ onClick: () => {
5635
+ setName(doc.name || '');
5636
+ if (doc.sourcePath) setFile(doc.sourcePath);
5637
+ setMode(doc.mode === 'overwrite' ? 'overwrite' : 'merge');
5638
+ setResult(null);
5639
+ setError('');
5640
+ },
4462
5641
  },
4463
- },
4464
- h('div', { className: 'studio-row-main' },
4465
- h('div', { className: 'studio-row-title' }, doc.name || doc.docKey),
4466
- h('div', { className: 'studio-row-sub' }, [
4467
- doc.kind || '文档',
4468
- (doc.count || 0) + ' 条',
4469
- 'v' + (doc.version || 1),
4470
- doc.mode === 'overwrite' ? '上次覆盖导入' : '上次合并导入',
4471
- relativeTime(doc.updatedAt || doc.importedAt),
4472
- ].join(' · '))
4473
- ),
4474
- h(Badge, { tone: matchedDoc && (doc.id === matchedDoc.id || doc.docKey === matchedDoc.docKey) ? 'link' : 'muted' }, doc.docKey || doc.name)
4475
- ))
5642
+ h('div', { className: 'studio-row-main' },
5643
+ h('div', { className: 'studio-row-title' }, doc.name || doc.docKey),
5644
+ h('div', { className: 'studio-row-sub' }, [
5645
+ docKindLabel(doc.kind),
5646
+ visible + ' 条' + (owned > visible ? ' / 账本 ' + owned : ''),
5647
+ 'v' + (doc.version || 1),
5648
+ '回写 ' + (doc.writeback?.at ? relativeTime(doc.writeback.at) : '未回写'),
5649
+ relativeTime(doc.updatedAt || doc.importedAt),
5650
+ ].join(' · ')),
5651
+ missing ? h('div', { className: 'studio-row-sub tone-danger' }, '源文件缺失:' + (doc.sourcePath || '—')) : null
5652
+ ),
5653
+ h('div', { className: 'studio-row-side' },
5654
+ missing ? h(Badge, { tone: 'danger' }, '源缺失') : h(Badge, { tone: 'success' }, '源就绪'),
5655
+ h(Badge, { tone: isMatched ? 'link' : 'muted' }, docKindLabel(doc.kind))
5656
+ )
5657
+ );
5658
+ })
4476
5659
  ),
4477
5660
  docs.length > 8 ? h('div', { className: 'studio-note', style: { marginTop: 4 } }, '还有 ' + (docs.length - 8) + ' 个文档未展示') : null
4478
5661
  ) : null,
@@ -4496,7 +5679,7 @@ window.__ModuleLoader__.load({
4496
5679
  ),
4497
5680
  h('div', { className: 'studio-note', style: { marginLeft: 22 } }, '以当前文档为准:删除该文档上次导入、本次已不存在的用例;同编号用例以文档内容更新。'),
4498
5681
  matchedDoc
4499
- ? h('div', { className: 'studio-note tone-warn', style: { marginTop: 6 } }, '将更新已导入文档:' + matchedDoc.name + '(v' + (matchedDoc.version || 1) + ' · ' + (matchedDoc.count || 0) + ' 条)')
5682
+ ? h('div', { className: 'studio-note tone-warn', style: { marginTop: 6 } }, '将更新已导入文档:' + matchedDoc.name + '(v' + (matchedDoc.version || 1) + ' · ' + (matchedDoc.visibleCount ?? matchedDoc.count ?? 0) + ' 条)')
4500
5683
  : h('div', { className: 'studio-note', style: { marginTop: 6 } }, '没有匹配到同名文档;本次会作为新文档导入。')
4501
5684
  ),
4502
5685
  status ? h('div', { className: 'studio-note' }, h(Spinner), ' ' + status) : null,
@@ -4770,7 +5953,7 @@ window.__ModuleLoader__.load({
4770
5953
  const snapshot = props.snapshot;
4771
5954
  const error = snapshot?.projectError || {};
4772
5955
  const workspaces = asArray(snapshot?.workspaces);
4773
- return h('div', { className: 'studio-content' },
5956
+ return h('div', null,
4774
5957
  h('div', { className: 'studio-card' },
4775
5958
  h('div', { className: 'studio-empty-icon', style: { justifyContent: 'flex-start', color: 'var(--dsw-alias-state-error-primary)' } }, h(Icon, { name: 'alert', size: 28 })),
4776
5959
  h('div', { style: { fontSize: 16, fontWeight: 650, marginTop: 8 } }, '工作区没有加载成功'),
@@ -5069,14 +6252,14 @@ window.__ModuleLoader__.load({
5069
6252
  const snapshot = studio.snapshot;
5070
6253
  const content = () => {
5071
6254
  if (!snapshot && studio.loading) {
5072
- return h('div', { className: 'studio-content' },
6255
+ return h('div', null,
5073
6256
  h('div', { className: 'studio-card', style: { display: 'flex', alignItems: 'center', gap: 10, justifyContent: 'center', minHeight: 160 } },
5074
6257
  h(Spinner), h('span', { className: 'studio-note' }, '正在加载测试工作室…')
5075
6258
  )
5076
6259
  );
5077
6260
  }
5078
6261
  if (!snapshot && studio.error) {
5079
- return h('div', { className: 'studio-content' },
6262
+ return h('div', null,
5080
6263
  h('div', { className: 'studio-card' },
5081
6264
  h('div', { className: 'studio-note tone-danger' }, studio.error.message),
5082
6265
  h('button', { className: 'studio-btn studio-btn-primary', onClick: studio.reload, style: { marginTop: 12 } }, '重试')
@@ -5106,6 +6289,11 @@ window.__ModuleLoader__.load({
5106
6289
  onEditCase: setEditCase,
5107
6290
  onShot: setLightbox,
5108
6291
  onImport: () => setImportOpen(true),
6292
+ onReReadDocument: async (body) => {
6293
+ const payload = await api('/docs/re-read', { method: 'POST', project: studio.snapshot.project, body, timeoutMs: 120000 });
6294
+ studio.reload();
6295
+ return payload;
6296
+ },
5109
6297
  onDeleteCases,
5110
6298
  onOpenBatch: (id) => { setCaseRunBatchId(''); setCaseRunCaseId(''); setSelectedBatchId(id); setView('batches'); studio.reload(); },
5111
6299
  onCloseCaseRun: () => { setCaseRunBatchId(''); setCaseRunCaseId(''); studio.reload(); },
@@ -5156,6 +6344,7 @@ window.__ModuleLoader__.load({
5156
6344
  snapshot,
5157
6345
  refreshing: studio.refreshing,
5158
6346
  onProject: selectProject,
6347
+ onNavigate: navigate,
5159
6348
  onPickWorkspace: () => { setWorkspaceInitial(studio.snapshot?.project || ''); setWorkspaceInitialInfo(null); setWorkspaceOpen(true); },
5160
6349
  onRefresh: studio.reload,
5161
6350
  onImport: () => setImportOpen(true),
@@ -5163,7 +6352,7 @@ window.__ModuleLoader__.load({
5163
6352
  }),
5164
6353
  h('div', { className: 'studio-body' },
5165
6354
  h(Rail, { snapshot, view, onNavigate: navigate }),
5166
- h('main', { className: 'studio-main' }, content())
6355
+ h('main', { className: 'studio-main' }, h('div', { className: 'studio-content' }, content()))
5167
6356
  ),
5168
6357
  importOpen ? h(ImportDialog, {
5169
6358
  snapshot: studio.snapshot,