dsh-session-superagent 0.10.11 → 2.0.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
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * dsh-session-superagent — browser half.
3
3
  *
4
- * Registers one list entry into `conversation.view` (the centre-column view
5
- * ring: chat / trajectory / waterfall live there), so the panel appears as a
6
- * tab beside them. It reads the read-only host route the server half
7
- * registers; no credential ever crosses this boundary.
4
+ * Registers the global workspace into `main` / `sidebar.panellist`, and the
5
+ * current-session workspace into the official right-sidebar slots. It reads
6
+ * the read-only host route the server half registers; no credential ever
7
+ * crosses this boundary.
8
8
  */
9
9
  window.__ModuleLoader__.load({
10
10
  id: 'dsh-session-superagent',
@@ -13,6 +13,20 @@ window.__ModuleLoader__.load({
13
13
  const h = React.createElement
14
14
  const { useCallback, useEffect, useRef, useState } = React
15
15
 
16
+ // 服务端只传状态名;人话统一在客户端翻译,弹层与主面板共用。
17
+ const POLL_STALE_TEXT = { 'boot-miss': '重启后没跑起来', stalled: '轮询停了' }
18
+
19
+ // Issue #35:本地回退 Modal 的 portal 通道。composer dock 的祖先可能带 transform / contain,
20
+ // 那会让 position:fixed 以该祖先为包含块并被 overflow 裁掉 —— 确认层 footer 既看不见也点不到。
21
+ // 宿主 react-dom 走 factory require;拿不到时保持内联渲染,不另造第三套 Modal。
22
+ let localCreatePortal = null
23
+ try {
24
+ const reactDom = require('react-dom')
25
+ if (reactDom && typeof reactDom.createPortal === 'function') localCreatePortal = reactDom.createPortal
26
+ } catch {
27
+ localCreatePortal = null
28
+ }
29
+
16
30
  // client.js 是 UMD:宿主原语只能走 factory 注入的 require,不能 import 相对 ESM 适配模块。
17
31
  // 这里的参数与 ui-host-primitives.js 的 createHostUi 保持一致,仅接入本面板需要的 Modal/Toast/Tooltip。
18
32
  function dismissToast(current, id) {
@@ -362,6 +376,7 @@ window.__ModuleLoader__.load({
362
376
  let hostPill = null
363
377
  let hostCollapsibleRow = null
364
378
  let hostTooltip = null
379
+ let hostTooltipPrimitive = null
365
380
  let hostOrbit = null
366
381
  let hostOrbitRow = null
367
382
  try {
@@ -383,6 +398,8 @@ window.__ModuleLoader__.load({
383
398
  hostPill = primitives.Pill || null
384
399
  // 仅供 CollapsibleList:WatcherForm 高级区需要 bodyId/aria-controls,必须继续走本地 DisclosureRow。
385
400
  hostCollapsibleRow = primitives.DisclosureRow || null
401
+ // 头部入口直接复用官方 Tooltip 包装 Button;InfoTip 适配器只服务它自己的问号 trigger。
402
+ hostTooltipPrimitive = primitives.Tooltip || null
386
403
  if (primitives && primitives.Modal && primitives.Toast && primitives.IconWarningOutlineMedium) {
387
404
  hostUi = createHostUi({ React, primitives })
388
405
  // Tooltip 独立探测:缺少它只回退 InfoTip,不把已接入的 Modal/Toast 一起降级。
@@ -400,6 +417,7 @@ window.__ModuleLoader__.load({
400
417
  hostPill = null
401
418
  hostCollapsibleRow = null
402
419
  hostTooltip = null
420
+ hostTooltipPrimitive = null
403
421
  }
404
422
 
405
423
  // Orbit 独立探测:容器用官方 MenuSurface,watcher 行用官方 DisclosureRow。
@@ -422,7 +440,48 @@ window.__ModuleLoader__.load({
422
440
  }
423
441
 
424
442
  // 客户端版本探针:每次模块加载写一次,用来确认浏览器里跑的是哪一版
425
- const CLIENT_VERSION = '0.10.11'
443
+ const CLIENT_VERSION = '2.0.0'
444
+
445
+ // 会话级导航使用官方 root/session slot。服务是可选的:老宿主没有它们时,
446
+ // 全局页仍可用,头部入口明确禁用,Dock 保留旧操作列表;不能用猜来的路由代替真实服务。
447
+ const GLOBAL_PANEL_ID = 'session-superagent'
448
+ const RIGHT_TAB_ID = 'dsh-session-superagent/session'
449
+ const RIGHT_TAB_KIND = 'sessionSuperagent'
450
+ const RIGHT_TAB_UNAVAILABLE = '宿主 sidebarRight.openTab 服务不存在'
451
+ const RIGHT_TAB_DEFINITION_UNAVAILABLE = '宿主 sidebarRightTabs.register 服务不存在'
452
+ const HEADER_UTILITY_ID = 'session-superagent-current'
453
+ let hostLayout = null
454
+ let hostSidebarRight = null
455
+ let hostSidebarRightTabs = null
456
+ let hostSessions = null
457
+
458
+ function canToggleSessionRightTab() {
459
+ return Boolean(hostSidebarRight
460
+ && hostSidebarRight.view && typeof hostSidebarRight.view.subscribe === 'function'
461
+ && typeof hostSidebarRight.tabsIn === 'function' && typeof hostSidebarRight.hide === 'function')
462
+ }
463
+ function visibleSessionRightTab(sessionId) {
464
+ if (!canToggleSessionRightTab()) return null
465
+ const tabs = hostSidebarRight.tabsIn(sessionId) || []
466
+ return tabs.find((tab) => tab && tab.kind === RIGHT_TAB_KIND && tab.visible !== false) || null
467
+ }
468
+
469
+ function optionalHostService(ctx, name) {
470
+ try {
471
+ const service = typeof ctx.get === 'function' ? ctx.get(name) : ctx[name]
472
+ return service || null
473
+ } catch {
474
+ return null
475
+ }
476
+ }
477
+
478
+ function openSessionSuperagentTab() {
479
+ if (!hostSidebarRight || typeof hostSidebarRight.openTab !== 'function') {
480
+ throw new Error(RIGHT_TAB_UNAVAILABLE)
481
+ }
482
+ // 右栏 session slot 自带当前 sessionId;调用方只传 kind,不拼 sidebar:// 地址或伪造 params。
483
+ return hostSidebarRight.openTab(RIGHT_TAB_KIND)
484
+ }
426
485
  // SEMVER_COMPARATOR_SOURCE_START
427
486
  // This block is duplicated verbatim in client.js because the browser UMD cannot import ESM.
428
487
  // test/update-semver.test.mjs audits both copies and exercises their behavior.
@@ -483,6 +542,138 @@ window.__ModuleLoader__.load({
483
542
  return parseSemver(value) !== null
484
543
  }
485
544
  // SEMVER_COMPARATOR_SOURCE_END
545
+ // ── 入口名称(左侧全局中枢 / 会话右栏标题)───────────────────────────────
546
+ // 名称只有一份品牌语义(issue #11 的 brandName,`/state` 下发),这里不另造字段:
547
+ // 本地显示覆盖(本浏览器 localStorage)> /state.brandName > 默认「主理鱼」。
548
+ // 左栏、右栏 definition 与右栏标题在改名时先 dispose 再按原 id/key/component 重注册,
549
+ // 让宿主立刻重算文案;覆盖不动唤醒抬头、插件包名和 ack 标签。
550
+ const TAB_NAME_DEFAULT = '主理鱼'
551
+ const TAB_NAME_STORAGE_KEY = 'dsh-session-superagent.tab-name'
552
+ // 页签条不允许无限长:超过 24 个码点就截断。按码点切(Array.from)而不是 UTF-16 单元,
553
+ // 否则「😀」这类增补平面字符会被劈成半个代理对,渲染出一个替换符。
554
+ const TAB_NAME_MAX = 24
555
+
556
+ /**
557
+ * 页签名称归一化:与 `lib/watch.js` 的 `normalizeBrandName` 同一套规则
558
+ * (trim → 压平换行 → 空值回落默认),再按码点截断到 TAB_NAME_MAX。
559
+ * client.js 是 UMD,不能 import ESM,所以规则在这里镜像一份;
560
+ * `test/client.test.mjs` 有「与 normalizeBrandName 同源」的用例钉住两边一致。
561
+ */
562
+ function normalizeTabName(value, fallback = TAB_NAME_DEFAULT) {
563
+ const text = String(value ?? '').trim().replace(/[\r\n]+/g, ' ')
564
+ if (!text) return fallback
565
+ const points = Array.from(text)
566
+ return points.length <= TAB_NAME_MAX ? text : points.slice(0, TAB_NAME_MAX).join('')
567
+ }
568
+
569
+ /**
570
+ * 输入框的即时截断:只截长度,不 trim、不回落空值 ——
571
+ * 否则客户清空输入框想「恢复默认」时,值会被当场改回默认名,看起来像清不掉。
572
+ */
573
+ function clampTabNameDraft(value) {
574
+ const text = String(value ?? '')
575
+ const points = Array.from(text)
576
+ return points.length <= TAB_NAME_MAX ? text : points.slice(0, TAB_NAME_MAX).join('')
577
+ }
578
+
579
+ /**
580
+ * 取 localStorage。桌面/浏览器两种宿主都可能禁用它(隐私模式、沙箱、配额满),
581
+ * 访问本身也可能抛 —— 一律返回 null,调用方回落默认,绝不因为一个页签名把 apply() 弄挂。
582
+ */
583
+ function tabNameStorage() {
584
+ try {
585
+ const storage = typeof localStorage === 'undefined' ? null : localStorage
586
+ if (!storage || typeof storage.getItem !== 'function' || typeof storage.setItem !== 'function') return null
587
+ return storage
588
+ } catch {
589
+ return null
590
+ }
591
+ }
592
+
593
+ /** 本地显示覆盖(null = 没有覆盖,跟随 /state.brandName)。读不到/读坏都回落 null。 */
594
+ function readTabNameOverride() {
595
+ const storage = tabNameStorage()
596
+ if (!storage) return null
597
+ try {
598
+ const raw = storage.getItem(TAB_NAME_STORAGE_KEY)
599
+ if (typeof raw !== 'string') return null
600
+ const text = raw.trim()
601
+ return text ? text : null
602
+ } catch {
603
+ return null
604
+ }
605
+ }
606
+
607
+ let tabNameOverride = null // 本地显示覆盖;null = 跟随品牌名
608
+ let tabNameBrand = '' // /state.brandName;'' = 还没读到(老服务端也没有)
609
+ const tabNameListeners = new Set()
610
+
611
+ /** 当前页签名称:覆盖 > 品牌名 > 默认。 */
612
+ function tabNameLabel() {
613
+ return normalizeTabName(tabNameOverride || tabNameBrand || TAB_NAME_DEFAULT)
614
+ }
615
+
616
+ /** 页签名变化时重注册(apply 里订阅)。返回清理函数。 */
617
+ function subscribeTabName(listener) {
618
+ tabNameListeners.add(listener)
619
+ return () => { tabNameListeners.delete(listener) }
620
+ }
621
+
622
+ /**
623
+ * 通知订阅者;单个订阅者抛错不能连坐其它订阅者。
624
+ * `previous` 是**变化前**的文案,订阅者据此判断「草稿还是干净的」:
625
+ * 干净草稿跟着新值走,用户正在编辑的脏草稿不许被外部事件覆盖(终审 M1)。
626
+ */
627
+ function notifyTabName(previous) {
628
+ const label = tabNameLabel()
629
+ for (const listener of [...tabNameListeners]) {
630
+ try {
631
+ listener(label, previous)
632
+ } catch (error) {
633
+ try { note('desk-fail', String((error && error.message) || error)) } catch {}
634
+ }
635
+ }
636
+ return label
637
+ }
638
+
639
+ /**
640
+ * 保存页签名称:空值(含全空格)= 清除覆盖,回到 /state 的 brandName(默认「主理鱼」)。
641
+ * 返回 { label, persisted }:persisted=false 表示 localStorage 不可用 —— 本次会话内有效,
642
+ * 刷新后回到默认。面板必须把这件事说清楚,不能假装存住了。
643
+ */
644
+ function saveTabName(value) {
645
+ const previous = tabNameLabel()
646
+ const text = String(value ?? '').trim()
647
+ tabNameOverride = text ? normalizeTabName(text) : null
648
+ let persisted = false
649
+ const storage = tabNameStorage()
650
+ if (storage) {
651
+ try {
652
+ if (tabNameOverride === null) {
653
+ if (typeof storage.removeItem === 'function') storage.removeItem(TAB_NAME_STORAGE_KEY)
654
+ else storage.setItem(TAB_NAME_STORAGE_KEY, '')
655
+ } else {
656
+ storage.setItem(TAB_NAME_STORAGE_KEY, tabNameOverride)
657
+ }
658
+ persisted = true
659
+ } catch {
660
+ persisted = false
661
+ }
662
+ }
663
+ return { label: notifyTabName(previous), persisted }
664
+ }
665
+
666
+ /**
667
+ * /state 的品牌名同步到页签(issue #11 的唯一品牌源)。变了才重注册;
668
+ * 有本地覆盖时文案不变,因此不会为品牌名抖动重画。
669
+ */
670
+ function syncTabNameBrand(value) {
671
+ const before = tabNameLabel()
672
+ tabNameBrand = typeof value === 'string' ? value.trim() : ''
673
+ if (tabNameLabel() === before) return before
674
+ return notifyTabName(before)
675
+ }
676
+
486
677
  const UPDATE_UNKNOWN_HINT = '请求结果未知,请先重新检查 installed/running,再手动确认'
487
678
  let BASE = '/session-superagent'
488
679
  /**
@@ -579,6 +770,11 @@ window.__ModuleLoader__.load({
579
770
  if (updatePost && res.status === 404) throw unknownUpdateError(error)
580
771
  throw error
581
772
  }
773
+ // 页签名称跟随品牌名(issue #11 的唯一品牌源):/state 是唯一带 brandName 的路由,
774
+ // 所有读取都经过这里 —— 既不额外发请求,也不在本地另存一份品牌名。
775
+ if (path.startsWith('/state')) {
776
+ try { syncTabNameBrand(body && body.brandName) } catch {}
777
+ }
582
778
  return body
583
779
  }
584
780
 
@@ -608,7 +804,7 @@ window.__ModuleLoader__.load({
608
804
  // 官方 GUI 的 376 条选择器 / 40KB 样式原样搬过来,类名统一 `dt-` 前缀,不污染宿主。
609
805
  // 两个表单都有这个开关:文案只写一份,改的时候不会漏掉另一处
610
806
  const ISOLATED_HINT = '隔离执行(每次唤醒开一个临时副本;在副本里改,用完自动回收)'
611
- const PORTED_CSS = "/* Panel layout and local UI controls styled with DSH `--dsw-alias-*` design tokens; one rule per line. */\n.dt-page { box-sizing: border-box; height: 100%; overflow: auto; scrollbar-gutter: stable; scroll-padding: 48px 0 72px; container-type: inline-size; padding: 28px clamp(24px, 4vw, 48px) 0; color: var(--dsw-alias-label-primary); }\n/* Deployment page rendered inside DSH Plugin Manager, which owns scrolling and padding. */\n.dt-embedded { container-type: inline-size; color: var(--dsw-alias-label-primary); }\n/* Disable sticky positioning inside DSH Plugin Manager, where the host container owns scrolling and bottom padding. */\n.dt-embedded .dt-savebar { position: static; }\n.dt-page > * + *, .dt-tabpanel > * + * { margin-top: 16px; }\n.dt-page > .dt-column { max-width: 960px; margin: 0 auto; padding-bottom: 48px; display: flex; flex-direction: column; gap: 24px; }\n.dt-head { position: relative; z-index: 3; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }\n.dt-search { position: relative; width: 240px; max-width: 100%; }\n.dt-search-results { position: absolute; top: calc(100% + 6px); right: 0; width: min(560px, 90cqw); max-height: 60vh; overflow: auto; padding: 8px 16px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 12px; background: var(--dsw-alias-bg-layer-2); box-shadow: var(--dsw-elevation-prominent); z-index: 5; display: flex; flex-direction: column; gap: 8px; }\n.dt-mark { background: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 25%, transparent); color: inherit; border-radius: 2px; }\n[data-platform='darwin'] .dt-page .dt-head { padding-top: var(--dsh-frame-top-clearance, 0px); }\n.dt-title { margin: 0; font-size: 15px; line-height: 22px; font-weight: 600; color: var(--dsw-alias-label-secondary); }\n.dt-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }\n.dt-page .dt-tabs { overflow-x: auto; display: flex; gap: 20px; max-width: none; padding: 0; border-radius: 0; background: none; border-bottom: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-segmented { width: 100%; max-width: 420px; box-sizing: border-box; display: inline-grid; gap: 2px; padding: 3px; border-radius: 9px; background: var(--dsw-alias-interactive-bg-hover); }\n.dt-ticket-body .dt-form { position: relative; z-index: 1; }\n.dt-form.dt-block { padding: 16px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 16px; gap: 16px; }\n.dt-block-title { display: flex; align-items: center; gap: 4px; margin: 0; font-size: 16px; line-height: 24px; font-weight: 500; }\n.dt-section { display: flex; flex-direction: column; gap: 8px; min-width: 0; }\n.dt-section-title { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; line-height: 22px; font-weight: 600; color: var(--dsw-alias-label-primary); }\n.dt-section-name { white-space: nowrap; }\n.dt-count { font-size: 14px; color: var(--dsw-alias-label-caption); font-variant-numeric: tabular-nums; font-weight: 400; } .dt-section-sub { font-size: 12px; line-height: 18px; font-weight: 400; color: var(--dsw-alias-label-caption); }\n.dt-hint { margin: 0; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-tertiary); }\n.dt-error { margin: 0; font-size: 13px; line-height: 20px; color: var(--dsw-alias-state-error-primary); }\n.dt-banner { margin: 0; padding: 8px 12px; border-radius: 10px; font-size: 13px; line-height: 20px; background: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 10%, transparent); overflow-wrap: anywhere; }\n.dt-banner.dt-danger { background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 10%, transparent); color: var(--dsw-alias-state-error-primary); }\n.dt-list { list-style: none; margin: 0 -8px; padding: 0; display: flex; flex-direction: column; gap: 2px; }\n.dt-row { position: relative; min-width: 0; border-radius: 12px; padding: 10px 8px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: flex-start; }\n.dt-row.dt-link:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-row-main { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }\n.dt-disclosure-body .dt-row-main { flex-basis: 0; }\n.dt-row-title { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; line-height: 20px; font-weight: 500; }\n.dt-open { max-width: 100%; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-size: 14px; line-height: 20px; font-weight: 500; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.dt-open::after { content: ''; position: absolute; inset: 0; border-radius: 12px; }\n.dt-open:focus-visible { outline: none; }\n.dt-open-wrap { white-space: normal; }\n.dt-open:focus-visible::after { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }\n.dt-row-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-caption); overflow-wrap: anywhere; }\n.dt-row-quote { font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.dt-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }\n/* Transparent block borders preserve vertical spacing when line clamping clips padding. */\n.dt-banner:is(.dt-clamp, .dt-clamp-8) { padding-block: 0; border-block: 8px solid transparent; }\n.dt-banner-label { font-weight: 500; }\n.dt-banner .dt-md { display: inline; }\n.dt-banner .dt-md > p:first-child { display: inline; }\n.dt-row-buttons { position: relative; z-index: 1; gap: 8px; margin-top: 4px; }\n.dt-row-actions { position: relative; z-index: 1; display: flex; align-items: center; gap: 4px; flex: none; margin-left: auto; font-size: 13px; line-height: 20px; }\n.dt-dot { flex: none; margin-top: 5px; }\n.dt-inline-link { position: relative; z-index: 1; color: var(--dsw-alias-link); text-decoration: none; }\n.dt-inline-link:hover { text-decoration: underline; }\n.dt-textlink { padding: 0; border: 0; background: none; font: inherit; color: var(--dsw-alias-link); cursor: pointer; text-align: left; }\n.dt-textlink:hover { text-decoration: underline; }\n.dt-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; line-height: 20px; }\n.dt-kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13px; line-height: 20px; }\n.dt-kv dt { color: var(--dsw-alias-label-tertiary); }\n.dt-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }\n@container (max-width: 640px) { .dt-kv dt { margin-top: 4px; } .dt-kv dt:first-of-type { margin-top: 0; } }\n.dt-timeline-day { position: sticky; top: 0; z-index: 1; padding: 6px 0 2px; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); font-weight: 500; list-style: none; background: var(--dsw-alias-bg-base); }\n.dt-event-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }\n.dt-event-head .dt-event-time { margin-left: auto; flex: none; font-size: 12px; color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }\n.dt-event-nums { color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }\n.dt-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }\n.dt-event { padding: 12px 0; border-bottom: 0.5px solid var(--dsw-alias-border-l2); display: flex; flex-direction: column; gap: 6px; min-width: 0; }\n.dt-event:last-child { border-bottom: 0; }\n.dt-event.dt-highlight { background: var(--dsw-alias-interactive-bg-hover); border-radius: 8px; padding-inline: 8px; margin-inline: -8px; }\n.dt-event-text { margin: 0; font-size: 13px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }\n.dt-event-actor { font-weight: 500; color: var(--dsw-alias-label-secondary); }\n.dt-event-quiet .dt-event-text { color: var(--dsw-alias-label-tertiary); }\n.dt-flow { margin: 0; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }\n.dt-clamp-8 { display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden; }\n.dt-more { align-self: flex-start; font-size: 12px; }\n.dt-reveal { opacity: 0; }\n.dt-event:hover .dt-reveal, .dt-reveal:focus-visible { opacity: 1; }\n@media (hover: none) {\n .dt-reveal { opacity: 1; }\n}\n.dt-event-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n.dt-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n.dt-filters .dt-search { margin-left: auto; }\n.dt-form { display: flex; flex-direction: column; gap: 24px; }\n.dt-fieldset { display: flex; flex-direction: column; gap: inherit; min-width: 0; margin: 0; padding: 0; border: 0; }\n.dt-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 20px; min-width: 0; }\n.dt-field small { color: var(--dsw-alias-label-caption); font-size: 12px; }\n.dt-textarea { box-sizing: border-box; width: 100%; min-width: 0; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 10px; padding: 8px 12px; font: inherit; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-primary); background: var(--dsw-alias-bg-layer-1, transparent); resize: vertical; }\n.dt-select { box-sizing: border-box; width: 100%; min-width: 0; height: 32px; border: 0.5px solid var(--dsw-alias-border-l4); border-radius: 8px; padding: 0 28px 0 8px; text-overflow: ellipsis; font: inherit; font-size: 14px; line-height: 22px; color: var(--dsw-alias-label-primary); background: var(--dsw-alias-bg-layer-1, transparent); }\n.dt-textarea:focus-visible, .dt-select:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }\n.dt-mono { font-family: var(--ds-font-family-code, Menlo, monospace); font-size: 12px; overflow-wrap: anywhere; }\n.dt-detail { margin-top: 2px; color: var(--dsw-alias-label-secondary); }\n.dt-savebar .dt-error { white-space: pre-line; }\n.dt-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 36px; font-size: 13px; }\n.dt-subhead-actions { display: inline-flex; align-items: center; gap: 4px; }\n.dt-btn-busy .dt-btn-icon svg { animation: dt-spin 1s linear infinite; }\n.dt-subhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }\n.dt-rules, .dt-changes { list-style: none; margin: 0; padding: 0; }\n.dt-field-head { display: inline-flex; align-items: center; gap: 4px; color: var(--dsw-alias-label-secondary); }\n.dt-info { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; padding: 0; border: 0; background: none; color: var(--dsw-alias-label-caption); cursor: help; }\n.dt-info:hover, .dt-info:focus-visible { color: var(--dsw-alias-label-secondary); }\n.dt-info:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; border-radius: 50%; }\n.dt-tooltip { position: fixed; z-index: 1100; width: max-content; max-width: min(320px, calc(100vw - 24px)); padding: 3px 7px; border-radius: 8px; background: var(--dsw-alias-tooltip-bg); color: var(--dsw-static-neutral-bluish-00); font-size: 13px; line-height: 20px; overflow-wrap: break-word; pointer-events: none; animation: dt-tooltip-in 150ms ease-in-out; }\n@keyframes dt-tooltip-in { from { opacity: 0; } }\n.dt-rules { border-top: 0.5px solid var(--dsw-alias-border-l2); }\n.dt-rule { display: flex; align-items: flex-start; gap: 12px; padding: 6px 0; border-bottom: 0.5px solid var(--dsw-alias-border-l2); }\n.dt-rule > :first-child { flex: 1; min-width: 0; }\n.dt-rule-preview { flex: 1; min-width: 0; margin-left: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--dsw-alias-label-caption); }\n.dt-rule-switch { margin-top: 2px; flex: none; }\n.dt-rule-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--dsw-alias-label-caption); }\n.dt-rule-dot[data-enabled] { background: var(--dsw-alias-brand-primary); }\n.dt-rule-body { display: flex; flex-direction: column; gap: 12px; padding: 8px 0 8px 28px; }\n.dt-model { display: flex; flex-direction: column; gap: 6px; }\n.dt-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }\n.dt-changes { display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 20px; }\n.dt-changes li::before { content: '· '; color: var(--dsw-alias-label-caption); }\n.dt-main { display: flex; flex-direction: column; gap: 24px; min-width: 0; }\n.dt-modal.dt-glossary-modal { width: min(680px, 100%); }\n.dt-nav-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 32px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 13px; line-height: 20px; text-align: left; cursor: pointer; }\n.dt-nav-item:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-nav-item[aria-current='true'] { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); font-weight: 500; }\n.dt-nav-item:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; }\n.dt-changed-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dsw-alias-brand-primary); flex: none; }\n.dt-add-skill { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 0.5px solid var(--dsw-alias-border-l2); }\n.dt-prompt-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }\n.dt-editor { min-height: 360px; }\n.dt-inline-select { width: auto; }\n.dt-preview-part { display: flex; flex-direction: column; gap: 6px; padding: 2px 0 2px 12px; border-left: 2px solid var(--dsw-alias-border-l3); }\n.dt-preview-head { font-size: 13px; line-height: 20px; display: flex; align-items: baseline; gap: 8px; }\ndiv.dt-preview-head { color: var(--dsw-alias-label-secondary); }\n.dt-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 16px; min-width: 0; }\n.dt-card-head { display: flex; align-items: center; gap: 12px; min-height: 28px; }\n.dt-card-head .dt-row-main { flex: 1 1 0; min-width: 64px; }\n.dt-card-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.dt-row-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }\n.dt-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }\n.dt-rows-item { display: grid; grid-template-columns: repeat(var(--dt-columns), minmax(0, 1fr)) auto; gap: 8px; align-items: center; }\n.dt-filter-gap { flex: 1; }\n.dt-page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; width: 100%; }\n.dt-page-head > div:first-child { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n.dt-page-head .dt-toolbar { flex: 0 1 auto; margin-left: auto; }\n.dt-page-head > .dt-btn { margin-left: -10px; }\n.dt-page-title { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; width: 100%; }\n.dt-page-title h2 { margin: 0; flex: 1 1 auto; min-width: 0; font-size: 20px; line-height: 28px; font-weight: 500; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }\n.dt-status-line { margin-top: -16px; }\n.dt-plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; line-height: 20px; }\n.dt-plain-list > li { position: relative; padding-left: 12px; }\n.dt-plain-list > li::before { content: ''; position: absolute; left: 0; top: 5px; bottom: 5px; width: 2px; border-radius: 1px; background: currentColor; opacity: 0.45; }\n.dt-details { display: flex; flex-direction: column; gap: 2px; border-top: 0.5px solid var(--dsw-alias-border-l2); padding-top: 8px; }\n.dt-danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 16px; border-top: 0.5px solid var(--dsw-alias-border-l2); }\n.dt-danger-zone .dt-btn { color: var(--dsw-alias-state-error-primary); }\n.dt-md { display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }\n.dt-md p, .dt-md ul, .dt-md ol { margin: 0; }\n.dt-md ul, .dt-md ol { padding-left: 20px; display: flex; flex-direction: column; gap: 2px; }\n.dt-md-heading { font-weight: 500; }\n.dt-code { font-family: var(--ds-font-family-code, Menlo, monospace); font-size: 12px; padding: 0 4px; border-radius: 4px; background: var(--dsw-alias-bg-module-platform); }\n.dt-dot-wrap { display: inline-flex; flex: none; }\n.dt-search-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }\n.dt-ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }\n.dt-legend-title { margin: 16px 0 6px; font-size: 13px; color: var(--dsw-alias-label-tertiary); }\n.dt-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }\n.dt-legend li { display: flex; align-items: center; gap: 6px; }\n.dt-legend .dt-dot { margin-top: 0; }\n.dt-savebar { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 0; background: var(--dsw-alias-bg-base, var(--dsw-alias-bg-layer-1)); border-top: 0.5px solid var(--dsw-alias-border-l2); }\n.dt-savebar .dt-hint { margin-right: auto; }\n.dt-card > .dt-savebar, .dt-block > .dt-savebar { margin: 0 -16px -16px; padding: 12px 16px; border-radius: 0 0 16px 16px; }\n.dt-glossary { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 20px; }\n.dt-glossary th, .dt-glossary td { text-align: left; padding: 6px 8px; border-bottom: 0.5px solid var(--dsw-alias-border-l2); vertical-align: top; }\n.dt-glossary th { color: var(--dsw-alias-label-tertiary); font-weight: 400; }\n.dt-glossary th.dt-glossary-group { color: var(--dsw-alias-label-secondary); font-weight: 600; padding-top: 14px; }\n.dt-glossary th:nth-child(-n+2), .dt-glossary td:nth-child(-n+2) { white-space: nowrap; }\n.dt-values { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 16px 0 0; font-size: 13px; }\n.dt-values dt { color: var(--dsw-alias-label-tertiary); }\n.dt-values dd { margin: 0; }\n.dt-pre { margin: 0; padding: 12px; border-radius: 10px; background: var(--dsw-alias-bg-module-platform); font-family: var(--ds-font-family-code, Menlo, monospace); font-size: 12px; line-height: 18px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 480px; overflow: auto; }\n.dt-pre ins { background: color-mix(in srgb, var(--dsw-alias-state-success-primary, green) 18%, transparent); text-decoration: none; }\n.dt-pre del { background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 18%, transparent); text-decoration: none; }\n.dt-prompt { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; align-items: start; }\n.dt-prompt-nav { display: flex; flex-direction: column; gap: 2px; }\n.dt-prompt-nav button { justify-content: flex-start; }\n.dt-disclosure-body { padding: 8px 0 8px 28px; display: flex; flex-direction: column; gap: 8px; }\n@container (max-width: 640px) {\n .dt-tab { padding: 0 8px; font-size: 13px; }\n .dt-segment { padding: 0 10px; }\n .dt-head { align-items: center; }\n .dt-search-results { right: auto; left: 0; width: 100%; }\n .dt-page-title h2 { font-size: 17px; line-height: 24px; }\n .dt-status-line { margin-top: -12px; }\n .dt-page .dt-tabs { display: flex; flex-wrap: nowrap; scrollbar-width: thin; }\n .dt-page .dt-tab { flex: none; }\n .dt-page .dt-tabs[data-more='end'] { mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }\n .dt-page .dt-tabs[data-more='start'] { mask-image: linear-gradient(to right, transparent, #000 40px); }\n .dt-page .dt-tabs[data-more='both'] { mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); }\n .dt-kv { grid-template-columns: 1fr; gap: 6px; }\n .dt-grid3, .dt-prompt { grid-template-columns: 1fr; }\n .dt-search { width: 100%; }\n .dt-filters .dt-search { margin-left: 0; }\n}\n/* Local UI primitive styles (see controls.tsx). */\n.dt-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; border: none; border-radius: 18px; cursor: pointer; font: inherit; font-size: 14px; line-height: 22px; color: var(--dsw-alias-label-primary); background: transparent; padding: 0 14px; white-space: nowrap; }\n.dt-btn:disabled { cursor: not-allowed; opacity: 0.4; }\n.dt-btn:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }\n.dt-btn-md { height: 36px; }\n.dt-btn-sm { height: 28px; font-size: 12px; line-height: 18px; padding: 0 10px; border-radius: 14px; }\n/* 主按钮:深色下 label-primary-foreground(深色)压绿底只有 4.09 —— 深色主题里前景该是浅的。 */\n/* 往白色混 70%:浅色下仍是浅字(4.5+),深色下变浅(>4.5),两边都过。 */\n.dt-btn-primary { background: var(--dsw-alias-button-primary-fill); color: var(--dsw-static-neutral-bluish-00); }\n.dt-btn-primary:hover:not(:disabled) { background: var(--dsw-alias-button-primary-hover); }\n.dt-btn-ghost { background: transparent; border: 0.5px solid var(--dsw-alias-border-l3); color: var(--dsw-alias-label-secondary); }\n.dt-btn-ghost:hover:not(:disabled), .dt-btn-outline:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-btn-ghost:active:not(:disabled) { background: var(--dsw-alias-interactive-bg-active); }\n.dt-btn-outline { border: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-btn-icon { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; }\n.dt-tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 1px 8px; font-size: 11px; line-height: 17px; font-weight: 500; white-space: nowrap; }\n.dt-tag[data-tone='outline'] { border: 0.5px solid var(--dsw-alias-border-l4); color: var(--dsw-alias-label-tertiary); }\n.dt-tag[data-tone='neutral'] { background: var(--dsw-alias-bg-module-platform); color: var(--dsw-alias-label-secondary); }\n.dt-tag[data-tone='quiet'] { color: var(--dsw-alias-label-secondary); }\n.dt-tag[data-tone='success'] { background: color-mix(in srgb, var(--dsw-alias-state-success-primary) 10%, transparent); color: color-mix(in srgb, var(--dsw-alias-state-success-primary) 72%, var(--dsw-alias-label-primary)); }\n.dt-tag[data-tone='info'] { background: color-mix(in srgb, var(--dsw-alias-state-business-primary) 10%, transparent); color: var(--dsw-alias-state-business-primary); }\n/* 胶囊是「暂停/退避/判断」唯一的状态色:文字与 12% 同色底叠起来,浅色下警告只有 4.17。 */\n/* 往 label-primary 混 28%:浅色变深、深色变浅,两档都留出余量。 */\n.dt-tag[data-tone='warning'] { background: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 12%, transparent); color: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 72%, var(--dsw-alias-label-primary)); }\n.dt-tag[data-tone='danger'] { background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 10%, transparent); color: color-mix(in srgb, var(--dsw-alias-state-error-primary) 76%, var(--dsw-alias-label-primary)); }\n.dt-pill { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border: none; border-radius: 12px; font: inherit; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); background: var(--dsw-alias-bg-layer-2); cursor: pointer; }\n.dt-pill:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-pill-active, .dt-pill-active:hover { color: var(--dsw-alias-label-primary); background: var(--dsw-alias-button-ghost-active-fill); box-shadow: inset 0 0 0 1px var(--dsw-alias-button-ghost-active-border); }\n.dt-tabs { display: grid; padding: 4px; border-radius: 12px; background: var(--dsw-alias-bg-module-platform); }\n.dt-tab { box-sizing: border-box; height: 34px; padding: 0 12px; border: 0.5px solid transparent; border-radius: 8px; background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 14px; line-height: 20px; white-space: nowrap; cursor: pointer; transition: color 180ms ease, background 180ms ease; }\n.dt-tab:hover { color: var(--dsw-alias-label-primary); }\n.dt-tab[aria-selected='true'] { color: var(--dsw-alias-label-primary); font-weight: 600; background: var(--dsw-alias-bg-layer-3); border-color: var(--dsw-alias-border-l3); }\n.dt-tab:focus-visible { outline: none; text-decoration: underline; text-underline-offset: 4px; }\n.dt-segment { height: 28px; padding: 0 16px; border: 0; border-radius: 7px; background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 13px; line-height: 20px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: color 120ms ease, background 160ms ease; }\n.dt-segment:hover:not(:disabled), .dt-segment[aria-selected='true'] { color: var(--dsw-alias-label-primary); }\n.dt-segment[aria-selected='true'] { background: var(--dsw-alias-bg-layer-1); box-shadow: var(--dsw-elevation-soft); }\n.dt-segment:disabled { cursor: default; opacity: 0.4; }\n.dt-segment:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; }\n.dt-input { box-sizing: border-box; display: inline-flex; align-items: center; gap: 6px; height: 32px; min-width: 0; padding: 0 8px; border: 0.5px solid var(--dsw-alias-border-l4); border-radius: 8px; background: var(--dsw-alias-bg-layer-1); }\n.dt-input:focus-within { border-color: var(--dsw-alias-brand-primary); }\n.dt-input-icon { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; color: var(--dsw-alias-label-tertiary); }\n.dt-input input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font: inherit; font-size: 14px; line-height: 22px; color: var(--dsw-alias-label-primary); }\n.dt-input input/* 占位符:label-dimmed 在浅色下只有 2.17(深色 3.81),必须能读出来才叫占位符。 */\n/* 往 label-tertiary 混 60%:浅色变深、深色变浅,两档都过 4.5。 */\n::placeholder { color: color-mix(in srgb, var(--dsw-alias-label-dimmed) 40%, var(--dsw-alias-label-tertiary)); }\n.dt-input input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }\n.dt-field .dt-input, .dt-search .dt-input, .dt-add-skill .dt-input { display: flex; width: 100%; }\n.dt-switch { box-sizing: border-box; flex: 0 0 auto; width: 36px; height: 20px; padding: 2px; border: 0; border-radius: 10px; background: var(--dsw-alias-border-l3); cursor: pointer; }\n.dt-switch[aria-checked='true'] { background: var(--dsw-alias-brand-primary); }\n.dt-switch:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }\n.dt-switch-thumb { display: block; width: 16px; height: 16px; border-radius: 50%; background: var(--dsw-alias-label-primary-foreground); transition: transform 120ms ease; }\n.dt-switch[aria-checked='true'] .dt-switch-thumb { transform: translateX(16px); }\n.dt-state-dot { position: relative; display: inline-block; flex: none; width: 10px; height: 10px; color: var(--dsw-alias-state-idle-primary); }\n.dt-state-dot::after { content: ''; position: absolute; inset: 20%; border-radius: 50%; background: currentColor; }\n.dt-state-dot[data-state='done'] { color: var(--dsw-alias-state-success-primary); }\n.dt-state-dot[data-state='warning'] { color: var(--dsw-alias-state-warn-primary); }\n.dt-state-dot[data-state='error'] { color: var(--dsw-alias-state-error-primary); }\n.dt-spinner { flex: none; color: var(--dsw-alias-label-tertiary); }\n.dt-spinner g { transform-origin: center; animation: dt-spin 1.5s linear infinite; }\n.dt-spinner circle { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }\n.dt-spinner circle:first-child { opacity: 0.25; }\n.dt-spinner circle:last-child { stroke-dasharray: 18 150; }\n@keyframes dt-spin { to { transform: rotate(360deg); } }\n.dt-disclosure-row { display: flex; align-items: center; gap: 4px; min-height: 28px; min-width: 0; border-radius: 8px; cursor: pointer; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }\n.dt-disclosure-row:hover { color: var(--dsw-alias-label-primary); }\n.dt-disclosure-row:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }\n.dt-disclosure-lead { position: relative; display: inline-flex; flex: none; width: 24px; height: 24px; align-items: center; justify-content: center; }\n.dt-disclosure-icon { display: inline-flex; align-items: center; justify-content: center; }\n.dt-disclosure-chevron { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; }\n.dt-disclosure-row:hover .dt-disclosure-icon, .dt-disclosure[data-open] .dt-disclosure-icon { visibility: hidden; }\n.dt-disclosure-row:hover .dt-disclosure-chevron, .dt-disclosure[data-open] .dt-disclosure-chevron { display: inline-flex; }\n.dt-disclosure-title { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.dt-modal-root { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: max(24px, var(--dsh-frame-top-clearance, 24px)) 24px; }\n.dt-modal-mask { position: absolute; inset: 0; background: var(--dsw-alias-bg-mask-1); backdrop-filter: var(--dsw-mask-blur); }\n.dt-modal { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 20px; width: min(380px, 100%); max-height: 100%; padding: 0 0 24px; overflow: hidden; border-radius: 24px; background: var(--dsw-alias-bg-layer-2); box-shadow: var(--dsw-elevation-prominent); color: var(--dsw-alias-label-primary); outline: none; }\n.dt-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 22px 14px 0 24px; }\n.dt-modal-header h2 { margin: 0; font-size: 16px; line-height: 24px; font-weight: 500; }\n.dt-modal-close { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: none; border-radius: 8px; background: transparent; cursor: pointer; color: var(--dsw-alias-label-secondary); }\n.dt-modal-close:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-modal-description { margin: -8px 0 0; padding: 0 24px; font-size: 14px; line-height: 22px; }\n.dt-modal-body { min-width: 0; min-height: 0; overflow: auto; padding: 0 24px; }\n.dt-modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 0 24px; }\n.dt-toast { position: fixed; top: 40px; left: 50%; z-index: 1100; pointer-events: none; width: max-content; max-width: min(640px, calc(100vw - 48px)); padding: 12px 16px; border-radius: 14px; background: var(--dsw-alias-toast-bg); color: var(--dsw-static-neutral-bluish-00); font-size: 14px; line-height: 22px; box-shadow: var(--dsw-shadow-lv3); transform: translateX(-50%); animation: dt-toast-in 160ms ease-out, dt-toast-fade 1000ms ease var(--dt-toast-hold, 3000ms) forwards; }\n@keyframes dt-toast-in { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }\n@keyframes dt-toast-fade { to { opacity: 0; visibility: hidden; } }\n@media (prefers-reduced-motion: reduce) {\n .dt-tab, .dt-segment, .dt-switch-thumb, .dt-spinner g, .dt-btn-busy .dt-btn-icon svg, .dt-tooltip { transition: none; animation: none; }\n .dt-toast { animation: dt-toast-fade 1000ms ease var(--dt-toast-hold, 3000ms) forwards; }\n}\n.dt-page .dt-tab { height: 34px; padding: 0 2px; border: 0; border-radius: 0; color: var(--dsw-alias-label-tertiary); font-size: 14px; }\n.dt-page .dt-tab[aria-selected='true'] { background: none; color: var(--dsw-alias-label-primary); font-weight: 500; box-shadow: inset 0 -1.5px 0 var(--dsw-alias-label-primary); }\n.dt-status-head { display: flex; align-items: center; gap: 8px; }\n.dt-status-title { margin: 0; flex: 1; display: flex; align-items: center; gap: 4px; font-size: 15px; line-height: 22px; font-weight: 600; }\n.dt-status-text { margin-left: auto; flex: none; font-size: 12px; font-weight: 400; color: var(--dsw-alias-label-secondary); }\n.dt-status-line .dt-status-text { margin-left: 0; }\n.dt-status-text[data-state='warning'] { color: var(--dsw-alias-state-warn-primary); }\n.dt-status-text[data-state='error'] { color: var(--dsw-alias-state-error-primary); }\n.dt-row-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }\n.dt-lv { white-space: nowrap; }\n.dt-lv-label { color: var(--dsw-alias-label-caption); }\n.dt-lv-value { color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }\n.dt-chip { display: inline-flex; flex-wrap: wrap; max-width: 100%; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 6px; overflow: hidden; font-size: 11px; line-height: 18px; color: var(--dsw-alias-label-secondary); }\n.dt-chip-source { padding: 0 6px; color: var(--dsw-alias-label-tertiary); background: var(--dsw-alias-bg-module-platform); }\n.dt-chip-fact { padding: 0 6px; border-left: 0.5px solid var(--dsw-alias-border-l3); white-space: nowrap; }\n.dt-chip-label { margin-right: 4px; color: var(--dsw-alias-label-caption); }\n.dt-chip-link { position: relative; z-index: 1; text-decoration: none; cursor: pointer; transition: border-color 120ms ease; }\n.dt-chip-link:hover { border-color: var(--dsw-alias-brand-primary); }\n.dt-chip-link:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }\n.dt-chip-open { display: inline-flex; align-items: center; padding: 0 5px; border-left: 0.5px solid var(--dsw-alias-border-l3); color: var(--dsw-alias-brand-primary); }\n.dt-chip-problem, .dt-chip-problem .dt-chip-label { color: var(--dsw-alias-state-error-primary); }\n.dt-cards { gap: 8px; }\n.dt-att .dt-inline-link { font-size: 13px; font-weight: 500; }\n.dt-list > .dt-att { margin: 2px 8px; }\n.dt-att { padding: 10px 12px 10px 16px; border: 0; border-radius: 0; border-bottom: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-att::before { content: ''; position: absolute; left: 6px; top: 10px; bottom: 10px; width: 2px; border-radius: 1px; background: var(--dsw-alias-state-warn-primary); opacity: 0.7; }\n.dt-att-error::before { background: var(--dsw-alias-state-error-primary); }\n.dt-att-what { font-size: 12px; line-height: 18px; font-weight: 500; color: var(--dsw-alias-state-warn-primary); }\n.dt-att-error .dt-att-what, .dt-att-error .dt-att-what .dt-open { color: var(--dsw-alias-state-error-primary); }\n.dt-stats { display: flex; flex-wrap: wrap; gap: 6px 24px; padding: 10px 14px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 12px; background: var(--dsw-alias-bg-module-platform); }\n.dt-stat { display: inline-flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--dsw-alias-label-caption); }\n/* 可点的统计数字:去掉原生按钮外观,保留文字排版;选中时用浅底提示 */\n.dt-stat-btn { border: 0; background: none; padding: 2px 6px; margin: -2px -6px; border-radius: 8px; font: inherit; color: inherit; cursor: pointer; }\n.dt-stat-btn:hover { background: var(--dsw-alias-interactive-bg-hover); }\n/* 浅色下 interactive-bg-hover 与白底只差 1.03:点了统计数字在按筛选,零视觉反馈。 */\n/* 换成品牌色 12% 底 + 0.5px 品牌色描边(两个主题都分得开)。 */\n.dt-stat-btn[aria-pressed='true'] { background: color-mix(in srgb, var(--dsw-alias-brand-primary) 12%, transparent); box-shadow: inset 0 0 0 0.5px var(--dsw-alias-brand-primary); }\n.dt-stat-btn:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }\n/* 统计条单位:按钮上的 color:inherit 会把单位染成数字色,所以单位单独一档。 */\n/* 浅色下 caption(#818b98)在白底只有 3.14–3.45,深色下同一档 4.34–5.07。 */\n/* 往 label-primary 混 30%:浅色变深、深色变浅,两个主题的对比度同时变好(不用新 token)。 */\n/* 注意选择器**不带** .dt-stat-btn 前缀 —— 带前缀就只作用于可点的格子,不可点的仍是旧色(真机踩过)。 */\n.dt-stat-unit { color: color-mix(in srgb, var(--dsw-alias-label-caption) 70%, var(--dsw-alias-label-primary)); }\n/* 选中的统计格:品牌色 12% 底会把单位压到 4.20,再往主色多混 10% 拉回来。 */\n.dt-stat-btn[aria-pressed='true'] .dt-stat-unit { color: color-mix(in srgb, var(--dsw-alias-label-caption) 58%, var(--dsw-alias-label-primary)); }\n.dt-stat-value { font-size: 14px; font-weight: 500; color: var(--dsw-alias-label-primary); font-variant-numeric: tabular-nums; }\n.dt-more-link { font-size: 12px; font-weight: 400; }\n.dt-settings { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 24px; align-items: start; }\n.dt-settings-nav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; }\n.dt-settings-link { padding: 6px 10px; border: 0; border-radius: 8px; background: none; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 13px; line-height: 20px; text-align: left; cursor: pointer; }\n.dt-settings-link:hover { color: var(--dsw-alias-label-primary); }\n.dt-settings-link[aria-current='page'] { background: var(--dsw-alias-bg-module-platform); color: var(--dsw-alias-label-primary); font-weight: 500; }\n.dt-settings-link[data-stage] + .dt-settings-link:not([data-stage]) { margin-top: 10px; }\n.dt-settings-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; padding: 16px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 16px; background: var(--dsw-alias-bg-layer-1); }\n.dt-settings-title { margin: 0; font-size: 15px; line-height: 22px; font-weight: 600; }\n.dt-settings-body .dt-section-title { font-size: 15px; line-height: 22px; }\n.dt-subtabs { display: flex; gap: 16px; border-bottom: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-subtab { padding: 0 0 6px; border: 0; background: none; color: var(--dsw-alias-label-tertiary); font: inherit; font-size: 13px; cursor: pointer; }\n.dt-subtab[aria-selected='true'] { color: var(--dsw-alias-label-primary); font-weight: 500; box-shadow: inset 0 -1.5px 0 var(--dsw-alias-label-primary); }\n.dt-part { display: flex; flex-direction: column; gap: 12px; }\n.dt-rows-summary { text-align: left; color: var(--dsw-alias-label-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }\n.dt-table { width: 100%; border-collapse: collapse; font-size: 12px; line-height: 18px; }\n.dt-table th { text-align: left; font-weight: 400; color: var(--dsw-alias-label-caption); padding: 2px 8px 2px 0; }\n.dt-table td { padding: 4px 8px 4px 0; border-top: 0.5px solid var(--dsw-alias-border-l3); vertical-align: top; color: var(--dsw-alias-label-secondary); overflow-wrap: anywhere; }\n@container (max-width: 640px) {\n .dt-settings { grid-template-columns: 1fr; gap: 12px; }\n .dt-settings-nav { position: static; flex-direction: row; flex-wrap: wrap; }\n .dt-settings-link[data-stage] + .dt-settings-link:not([data-stage]) { margin-top: 0; }\n .dt-page .dt-tabs { gap: 14px; }\n}\n.dt-list > .dt-ticket { display: grid; grid-template-columns: 112px minmax(0, 1fr); column-gap: 12px; align-items: start; margin: 0; padding: 12px 8px 12px 18px; border-radius: 0; border-bottom: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-list > .dt-ticket[data-state]::before { content: ''; position: absolute; left: 6px; top: 12px; bottom: 12px; width: 2px; border-radius: 1px; background: var(--dsw-alias-state-warn-primary); opacity: 0.7; }\n.dt-list > .dt-ticket[data-state='error']::before { background: var(--dsw-alias-state-error-primary); }\n.dt-ticket-stage { align-self: stretch; padding-top: 1px; border-right: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-ticket-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n.dt-ticket-body .dt-row-title .dt-open { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.dt-ticket-meta { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; }\n.dt-ticket-meta .dt-chip { flex: none; }\n.dt-ticket-meta .dt-ticket-actions { margin-top: 0; margin-left: auto; min-height: 0; flex-wrap: nowrap; }\n@container (max-width: 640px) { .dt-ticket-meta { flex-wrap: wrap; white-space: normal; } .dt-ticket-meta .dt-ticket-actions { flex-wrap: wrap; } }\n.dt-ticket-note { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--dsw-alias-label-primary); }\n.dt-ticket-note-error { color: var(--dsw-alias-state-error-primary); }\n.dt-ticket-note-pause { font-weight: 500; color: var(--dsw-alias-state-warn-primary); }\n.dt-ticket-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; min-height: 30px; margin-top: 2px; }\n/* Pass pointer events through action containers to the row link, keeping only child controls interactive. */\n.dt-ticket-actions, .dt-row-buttons, .dt-row-actions { pointer-events: none; }\n.dt-ticket-actions > *, .dt-row-buttons > *, .dt-row-actions > * { pointer-events: auto; }\n.dt-line { min-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.dt-row-meta.dt-line { flex-wrap: nowrap; }\n.dt-line-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dsw-alias-label-secondary); }\n.dt-error-text { color: var(--dsw-alias-state-error-primary); }\n.dt-stage { display: inline-flex; align-items: flex-start; gap: 5px; font-size: 12px; line-height: 18px; font-weight: 500; color: var(--dsw-alias-label-secondary); }\n.dt-stage svg { flex: none; margin-top: 2px; }\n.dt-stage[data-state='warning'] { color: var(--dsw-alias-state-warn-primary); }\n.dt-stage[data-state='error'] { color: var(--dsw-alias-state-error-primary); }\n.dt-stage[data-state='ongoing'] { color: var(--dsw-alias-state-business-primary); }\n.dt-icon-link { display: inline-flex; align-items: center; gap: 4px; }\na.dt-btn, a.dt-btn:hover { text-decoration: none; }\n.dt-section-icon { display: inline-flex; align-self: center; color: var(--dsw-alias-label-tertiary); }\n.dt-trigger-link { display: flex; flex-direction: column; gap: 2px; width: 100%; margin: -4px 0 -4px -8px; padding: 4px 8px; border: 0; border-radius: 8px; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }\n.dt-trigger-link:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-trigger-link:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }\n.dt-trigger-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }\n.dt-kv-stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }\n.dt-banner-actions { margin-top: 6px; }\n@container (max-width: 640px) {\n .dt-list > .dt-ticket { grid-template-columns: 1fr; row-gap: 4px; }\n .dt-ticket-stage { border-right: 0; }\n}\n.dt-nav-group { margin: 10px 10px 2px; font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-secondary); }\n.dt-nav-group:first-child { margin-top: 0; }\n.dt-prompt-nav .dt-nav-item { flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }\n.dt-nav-item > span { display: inline-flex; align-items: center; gap: 6px; }\n.dt-nav-item small { font-size: 12px; line-height: 18px; font-weight: 400; color: var(--dsw-alias-label-caption); }\n.dt-preview-part[data-editable] { border-left-color: var(--dsw-alias-brand-primary); }\n.dt-preview-head b { font-weight: 500; }\n.dt-preview-head > span { font-size: 12px; color: var(--dsw-alias-label-caption); }\n.dt-changed-tag { margin-left: 6px; padding: 0 5px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 4px; font-size: 11px; line-height: 16px; font-weight: 400; color: var(--dsw-alias-label-secondary); }\n.dt-updated-tag { border-color: var(--dsw-alias-state-warn-primary); color: var(--dsw-alias-state-warn-primary); }\n.dt-default-updated { display: flex; flex-direction: column; gap: 6px; padding: 2px 0 2px 12px; border-left: 2px solid var(--dsw-alias-state-warn-primary); }\n.dt-diff-fold { color: var(--dsw-alias-label-caption); font-style: italic; }\n.dt-compare { margin-left: auto; }\n.dt-admission th { white-space: nowrap; }\n.dt-admission thead tr:first-child th:not(:first-child) { color: var(--dsw-alias-label-secondary); font-weight: 500; }\n.dt-admission td { vertical-align: middle; }\n.dt-admission-scope { color: var(--dsw-alias-label-primary); font-size: 13px; }\n.dt-admission-scope small { display: block; font-size: 11px; color: var(--dsw-alias-label-caption); }\n.dt-admission-na { color: var(--dsw-alias-label-caption); }\n.dt-admission-cell { display: flex; align-items: center; gap: 4px; }\n.dt-admission-cell .dt-select { flex: 1; min-width: 0; }\n.dt-admission-slot { display: inline-flex; flex: none; width: 16px; }\n.dt-info-warn { color: var(--dsw-alias-state-warn-primary); }\n.dt-field-segmented { max-width: 240px; }\n/* 活跃时段:两个原生 time 选择器 + 全天按钮 */\n/* 表单控件不必满宽:短数字撑到 900px 只会显得空 */\n.dt-form > .dt-field > .dt-input { max-width: 480px; }\n.dt-error-card { border-color: color-mix(in srgb, var(--dsw-alias-state-error-primary) 35%, var(--dsw-alias-border-l3)); }\n.dt-error-card .dt-card-title { color: var(--dsw-alias-state-error-primary); }\n/* 空态引导:圆形步骤号 + 标题 + 说明,替代「① + 列表符号」的重复 */\n.dt-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; counter-reset: none; }\n.dt-step { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }\n.dt-step-num { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--dsw-alias-bg-module-platform); color: var(--dsw-alias-label-secondary); font-size: 12px; line-height: 1; font-variant-numeric: tabular-nums; }\n.dt-step-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }\n.dt-step-title { font-size: 13px; line-height: 20px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n.dt-empty { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 12px; }\n.dt-step-detail { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n.dt-hours { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n.dt-time { box-sizing: border-box; height: 32px; padding: 0 8px; border: 0.5px solid var(--dsw-alias-border-l4); border-radius: 8px; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; }\n.dt-time:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }\n.dt-hours-sep { color: var(--dsw-alias-label-tertiary); }\n.dt-hours-hint { font-size: 12px; color: var(--dsw-alias-label-caption); }\n/* 分诊信号表(设置 → 诊断):左列「名字 + 两个标签」成组,右列 `+N 分` 定宽贴右、数字等宽。只挂局部类,全局 .dt-row-title 一行没动 —— 别的列表还在用它。 */\n.dt-signal-title { display: grid; grid-template-columns: minmax(0, 1fr) 4.5em; align-items: baseline; column-gap: 12px; }\n.dt-signal-lead { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }\n.dt-signal-meta { display: block; justify-self: stretch; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }\n/* 同一个维度(默认开/关)的两档要等权:`默认关` 原本是 49×19 的裸字,`默认开` 是 51×21 的描边胶囊。 */\n.dt-signal-lead .dt-tag[data-tone='quiet'] { border: 0.5px solid var(--dsw-alias-border-l4); }\n";
807
+ const PORTED_CSS = "/* Panel layout and local UI controls styled with DSH `--dsw-alias-*` design tokens; one rule per line. */\n.dt-page { box-sizing: border-box; height: 100%; overflow: auto; scrollbar-gutter: stable; scroll-padding: 48px 0 72px; container-type: inline-size; padding: 28px clamp(24px, 4vw, 48px) 0; color: var(--dsw-alias-label-primary); }\n/* Deployment page rendered inside DSH Plugin Manager, which owns scrolling and padding. */\n.dt-embedded { container-type: inline-size; color: var(--dsw-alias-label-primary); }\n/* Disable sticky positioning inside DSH Plugin Manager, where the host container owns scrolling and bottom padding. */\n.dt-embedded .dt-savebar { position: static; }\n.dt-page > * + *, .dt-tabpanel > * + * { margin-top: 16px; }\n.dt-page > .dt-column, .dt-tabpanel > .dt-column { max-width: 960px; margin: 0 auto; padding-bottom: 48px; display: flex; flex-direction: column; gap: 24px; }\n.dt-head { position: relative; z-index: 3; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }\n.dt-search { position: relative; width: 240px; max-width: 100%; }\n.dt-search-results { position: absolute; top: calc(100% + 6px); right: 0; width: min(560px, 90cqw); max-height: 60vh; overflow: auto; padding: 8px 16px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 12px; background: var(--dsw-alias-bg-layer-2); box-shadow: var(--dsw-elevation-prominent); z-index: 5; display: flex; flex-direction: column; gap: 8px; }\n.dt-mark { background: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 25%, transparent); color: inherit; border-radius: 2px; }\n[data-platform='darwin'] .dt-page .dt-head { padding-top: var(--dsh-frame-top-clearance, 0px); }\n.dt-title { margin: 0; font-size: 15px; line-height: 22px; font-weight: 600; color: var(--dsw-alias-label-secondary); }\n.dt-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }\n.dt-page .dt-tabs { overflow-x: auto; display: flex; gap: 20px; max-width: none; padding: 0; border-radius: 0; background: none; border-bottom: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-segmented { width: 100%; max-width: 420px; box-sizing: border-box; display: inline-grid; gap: 2px; padding: 3px; border-radius: 9px; background: var(--dsw-alias-interactive-bg-hover); }\n.dt-ticket-body .dt-form { position: relative; z-index: 1; }\n.dt-form.dt-block { padding: 16px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 16px; gap: 16px; }\n.dt-block-title { display: flex; align-items: center; gap: 4px; margin: 0; font-size: 16px; line-height: 24px; font-weight: 500; }\n.dt-section { display: flex; flex-direction: column; gap: 8px; min-width: 0; }\n.dt-section-title { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; line-height: 22px; font-weight: 600; color: var(--dsw-alias-label-primary); }\n.dt-section-name { white-space: nowrap; }\n.dt-count { font-size: 14px; color: var(--dsw-alias-label-caption); font-variant-numeric: tabular-nums; font-weight: 400; } .dt-section-sub { font-size: 12px; line-height: 18px; font-weight: 400; color: var(--dsw-alias-label-caption); }\n.dt-hint { margin: 0; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-tertiary); }\n.dt-error { margin: 0; font-size: 13px; line-height: 20px; color: var(--dsw-alias-state-error-primary); }\n.dt-banner { margin: 0; padding: 8px 12px; border-radius: 10px; font-size: 13px; line-height: 20px; background: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 10%, transparent); overflow-wrap: anywhere; }\n.dt-banner.dt-danger { background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 10%, transparent); color: var(--dsw-alias-state-error-primary); }\n.dt-list { list-style: none; margin: 0 -8px; padding: 0; display: flex; flex-direction: column; gap: 2px; }\n.dt-row { position: relative; min-width: 0; border-radius: 12px; padding: 10px 8px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: flex-start; }\n.dt-row.dt-link:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-row-main { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }\n.dt-disclosure-body .dt-row-main { flex-basis: 0; }\n.dt-row-title { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; line-height: 20px; font-weight: 500; }\n.dt-open { max-width: 100%; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-size: 14px; line-height: 20px; font-weight: 500; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.dt-open::after { content: ''; position: absolute; inset: 0; border-radius: 12px; }\n.dt-open:focus-visible { outline: none; }\n.dt-open-wrap { white-space: normal; }\n.dt-open:focus-visible::after { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }\n.dt-row-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-caption); overflow-wrap: anywhere; }\n.dt-row-quote { font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.dt-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }\n/* Transparent block borders preserve vertical spacing when line clamping clips padding. */\n.dt-banner:is(.dt-clamp, .dt-clamp-8) { padding-block: 0; border-block: 8px solid transparent; }\n.dt-banner-label { font-weight: 500; }\n.dt-banner .dt-md { display: inline; }\n.dt-banner .dt-md > p:first-child { display: inline; }\n.dt-row-buttons { position: relative; z-index: 1; gap: 8px; margin-top: 4px; }\n.dt-row-actions { position: relative; z-index: 1; display: flex; align-items: center; gap: 4px; flex: none; margin-left: auto; font-size: 13px; line-height: 20px; }\n.dt-dot { flex: none; margin-top: 5px; }\n.dt-inline-link { position: relative; z-index: 1; color: var(--dsw-alias-link); text-decoration: none; }\n.dt-inline-link:hover { text-decoration: underline; }\n.dt-textlink { padding: 0; border: 0; background: none; font: inherit; color: var(--dsw-alias-link); cursor: pointer; text-align: left; }\n.dt-textlink:hover { text-decoration: underline; }\n.dt-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; line-height: 20px; }\n.dt-kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13px; line-height: 20px; }\n.dt-kv dt { color: var(--dsw-alias-label-tertiary); }\n.dt-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }\n@container (max-width: 640px) { .dt-kv dt { margin-top: 4px; } .dt-kv dt:first-of-type { margin-top: 0; } }\n.dt-timeline-day { position: sticky; top: 0; z-index: 1; padding: 6px 0 2px; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); font-weight: 500; list-style: none; background: var(--dsw-alias-bg-base); }\n.dt-event-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }\n.dt-event-head .dt-event-time { margin-left: auto; flex: none; font-size: 12px; color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }\n.dt-event-nums { color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }\n.dt-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }\n.dt-event { padding: 12px 0; border-bottom: 0.5px solid var(--dsw-alias-border-l2); display: flex; flex-direction: column; gap: 6px; min-width: 0; }\n.dt-event:last-child { border-bottom: 0; }\n.dt-event.dt-highlight { background: var(--dsw-alias-interactive-bg-hover); border-radius: 8px; padding-inline: 8px; margin-inline: -8px; }\n.dt-event-text { margin: 0; font-size: 13px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }\n.dt-event-actor { font-weight: 500; color: var(--dsw-alias-label-secondary); }\n.dt-event-quiet .dt-event-text { color: var(--dsw-alias-label-tertiary); }\n.dt-flow { margin: 0; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }\n.dt-clamp-8 { display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden; }\n.dt-more { align-self: flex-start; font-size: 12px; }\n.dt-reveal { opacity: 0; }\n.dt-event:hover .dt-reveal, .dt-reveal:focus-visible { opacity: 1; }\n@media (hover: none) {\n .dt-reveal { opacity: 1; }\n}\n.dt-event-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n.dt-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n.dt-filters .dt-search { margin-left: auto; }\n.dt-form { display: flex; flex-direction: column; gap: 24px; }\n.dt-fieldset { display: flex; flex-direction: column; gap: inherit; min-width: 0; margin: 0; padding: 0; border: 0; }\n.dt-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 20px; min-width: 0; }\n.dt-field small { color: var(--dsw-alias-label-caption); font-size: 12px; }\n.dt-textarea { box-sizing: border-box; width: 100%; min-width: 0; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 10px; padding: 8px 12px; font: inherit; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-primary); background: var(--dsw-alias-bg-layer-1, transparent); resize: vertical; }\n.dt-select { box-sizing: border-box; width: 100%; min-width: 0; height: 32px; border: 0.5px solid var(--dsw-alias-border-l4); border-radius: 8px; padding: 0 28px 0 8px; text-overflow: ellipsis; font: inherit; font-size: 14px; line-height: 22px; color: var(--dsw-alias-label-primary); background: var(--dsw-alias-bg-layer-1, transparent); }\n.dt-textarea:focus-visible, .dt-select:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }\n.dt-mono { font-family: var(--ds-font-family-code, Menlo, monospace); font-size: 12px; overflow-wrap: anywhere; }\n.dt-detail { margin-top: 2px; color: var(--dsw-alias-label-secondary); }\n.dt-savebar .dt-error { white-space: pre-line; }\n.dt-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 36px; font-size: 13px; }\n.dt-subhead-actions { display: inline-flex; align-items: center; gap: 4px; }\n.dt-btn-busy .dt-btn-icon svg { animation: dt-spin 1s linear infinite; }\n.dt-subhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }\n.dt-rules, .dt-changes { list-style: none; margin: 0; padding: 0; }\n.dt-field-head { display: inline-flex; align-items: center; gap: 4px; color: var(--dsw-alias-label-secondary); }\n.dt-info { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; padding: 0; border: 0; background: none; color: var(--dsw-alias-label-caption); cursor: help; }\n.dt-info:hover, .dt-info:focus-visible { color: var(--dsw-alias-label-secondary); }\n.dt-info:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; border-radius: 50%; }\n.dt-tooltip { position: fixed; z-index: 1100; width: max-content; max-width: min(320px, calc(100vw - 24px)); padding: 3px 7px; border-radius: 8px; background: var(--dsw-alias-tooltip-bg); color: var(--dsw-static-neutral-bluish-00); font-size: 13px; line-height: 20px; overflow-wrap: break-word; pointer-events: none; animation: dt-tooltip-in 150ms ease-in-out; }\n@keyframes dt-tooltip-in { from { opacity: 0; } }\n.dt-rules { border-top: 0.5px solid var(--dsw-alias-border-l2); }\n.dt-rule { display: flex; align-items: flex-start; gap: 12px; padding: 6px 0; border-bottom: 0.5px solid var(--dsw-alias-border-l2); }\n.dt-rule > :first-child { flex: 1; min-width: 0; }\n.dt-rule-preview { flex: 1; min-width: 0; margin-left: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--dsw-alias-label-caption); }\n.dt-rule-switch { margin-top: 2px; flex: none; }\n.dt-rule-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--dsw-alias-label-caption); }\n.dt-rule-dot[data-enabled] { background: var(--dsw-alias-brand-primary); }\n.dt-rule-body { display: flex; flex-direction: column; gap: 12px; padding: 8px 0 8px 28px; }\n.dt-model { display: flex; flex-direction: column; gap: 6px; }\n.dt-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }\n.dt-changes { display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 20px; }\n.dt-changes li::before { content: '· '; color: var(--dsw-alias-label-caption); }\n.dt-main { display: flex; flex-direction: column; gap: 24px; min-width: 0; }\n.dt-modal.dt-glossary-modal { width: min(680px, 100%); }\n.dt-nav-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 32px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 13px; line-height: 20px; text-align: left; cursor: pointer; }\n.dt-nav-item:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-nav-item[aria-current='true'] { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); font-weight: 500; }\n.dt-nav-item:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; }\n.dt-changed-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dsw-alias-brand-primary); flex: none; }\n.dt-add-skill { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 0.5px solid var(--dsw-alias-border-l2); }\n.dt-prompt-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }\n.dt-editor { min-height: 360px; }\n.dt-inline-select { width: auto; }\n.dt-preview-part { display: flex; flex-direction: column; gap: 6px; padding: 2px 0 2px 12px; border-left: 2px solid var(--dsw-alias-border-l3); }\n.dt-preview-head { font-size: 13px; line-height: 20px; display: flex; align-items: baseline; gap: 8px; }\ndiv.dt-preview-head { color: var(--dsw-alias-label-secondary); }\n.dt-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 16px; min-width: 0; }\n.dt-card-head { display: flex; align-items: center; gap: 12px; min-height: 28px; }\n.dt-card-head .dt-row-main { flex: 1 1 0; min-width: 64px; }\n.dt-card-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.dt-row-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }\n.dt-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }\n.dt-rows-item { display: grid; grid-template-columns: repeat(var(--dt-columns), minmax(0, 1fr)) auto; gap: 8px; align-items: center; }\n.dt-filter-gap { flex: 1; }\n.dt-page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; width: 100%; }\n.dt-page-head > div:first-child { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n.dt-page-head .dt-toolbar { flex: 0 1 auto; margin-left: auto; }\n.dt-page-head > .dt-btn { margin-left: -10px; }\n.dt-page-title { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; width: 100%; }\n.dt-page-title h2 { margin: 0; flex: 1 1 auto; min-width: 0; font-size: 20px; line-height: 28px; font-weight: 500; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }\n.dt-status-line { margin-top: -16px; }\n.dt-plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; line-height: 20px; }\n.dt-plain-list > li { position: relative; padding-left: 12px; }\n.dt-plain-list > li::before { content: ''; position: absolute; left: 0; top: 5px; bottom: 5px; width: 2px; border-radius: 1px; background: currentColor; opacity: 0.45; }\n.dt-details { display: flex; flex-direction: column; gap: 2px; border-top: 0.5px solid var(--dsw-alias-border-l2); padding-top: 8px; }\n.dt-danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 16px; border-top: 0.5px solid var(--dsw-alias-border-l2); }\n.dt-danger-zone .dt-btn { color: var(--dsw-alias-state-error-primary); }\n.dt-md { display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }\n.dt-md p, .dt-md ul, .dt-md ol { margin: 0; }\n.dt-md ul, .dt-md ol { padding-left: 20px; display: flex; flex-direction: column; gap: 2px; }\n.dt-md-heading { font-weight: 500; }\n.dt-code { font-family: var(--ds-font-family-code, Menlo, monospace); font-size: 12px; padding: 0 4px; border-radius: 4px; background: var(--dsw-alias-bg-module-platform); }\n.dt-dot-wrap { display: inline-flex; flex: none; }\n.dt-search-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }\n.dt-ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }\n.dt-legend-title { margin: 16px 0 6px; font-size: 13px; color: var(--dsw-alias-label-tertiary); }\n.dt-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }\n.dt-legend li { display: flex; align-items: center; gap: 6px; }\n.dt-legend .dt-dot { margin-top: 0; }\n.dt-savebar { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 0; background: var(--dsw-alias-bg-base, var(--dsw-alias-bg-layer-1)); border-top: 0.5px solid var(--dsw-alias-border-l2); }\n.dt-savebar .dt-hint { margin-right: auto; }\n.dt-card > .dt-savebar, .dt-block > .dt-savebar { margin: 0 -16px -16px; padding: 12px 16px; border-radius: 0 0 16px 16px; }\n.dt-glossary { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 20px; }\n.dt-glossary th, .dt-glossary td { text-align: left; padding: 6px 8px; border-bottom: 0.5px solid var(--dsw-alias-border-l2); vertical-align: top; }\n.dt-glossary th { color: var(--dsw-alias-label-tertiary); font-weight: 400; }\n.dt-glossary th.dt-glossary-group { color: var(--dsw-alias-label-secondary); font-weight: 600; padding-top: 14px; }\n.dt-glossary th:nth-child(-n+2), .dt-glossary td:nth-child(-n+2) { white-space: nowrap; }\n.dt-values { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 16px 0 0; font-size: 13px; }\n.dt-values dt { color: var(--dsw-alias-label-tertiary); }\n.dt-values dd { margin: 0; }\n.dt-pre { margin: 0; padding: 12px; border-radius: 10px; background: var(--dsw-alias-bg-module-platform); font-family: var(--ds-font-family-code, Menlo, monospace); font-size: 12px; line-height: 18px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 480px; overflow: auto; }\n.dt-pre ins { background: color-mix(in srgb, var(--dsw-alias-state-success-primary, green) 18%, transparent); text-decoration: none; }\n.dt-pre del { background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 18%, transparent); text-decoration: none; }\n.dt-prompt { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; align-items: start; }\n.dt-prompt-nav { display: flex; flex-direction: column; gap: 2px; }\n.dt-prompt-nav button { justify-content: flex-start; }\n.dt-disclosure-body { padding: 8px 0 8px 28px; display: flex; flex-direction: column; gap: 8px; }\n@container (max-width: 640px) {\n .dt-tab { padding: 0 8px; font-size: 13px; }\n .dt-segment { padding: 0 10px; }\n .dt-head { align-items: center; }\n .dt-search-results { right: auto; left: 0; width: 100%; }\n .dt-page-title h2 { font-size: 17px; line-height: 24px; }\n .dt-status-line { margin-top: -12px; }\n .dt-page .dt-tabs { display: flex; flex-wrap: nowrap; scrollbar-width: thin; }\n .dt-page .dt-tab { flex: none; }\n .dt-page .dt-tabs[data-more='end'] { mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }\n .dt-page .dt-tabs[data-more='start'] { mask-image: linear-gradient(to right, transparent, #000 40px); }\n .dt-page .dt-tabs[data-more='both'] { mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); }\n .dt-kv { grid-template-columns: 1fr; gap: 6px; }\n .dt-grid3, .dt-prompt { grid-template-columns: 1fr; }\n .dt-search { width: 100%; }\n .dt-filters .dt-search { margin-left: 0; }\n}\n/* Local UI primitive styles (see controls.tsx). */\n.dt-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; border: none; border-radius: 18px; cursor: pointer; font: inherit; font-size: 14px; line-height: 22px; color: var(--dsw-alias-label-primary); background: transparent; padding: 0 14px; white-space: nowrap; }\n.dt-btn:disabled { cursor: not-allowed; opacity: 0.4; }\n.dt-btn:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }\n.dt-btn-md { height: 36px; }\n.dt-btn-sm { height: 28px; font-size: 12px; line-height: 18px; padding: 0 10px; border-radius: 14px; }\n/* 主按钮:深色下 label-primary-foreground(深色)压绿底只有 4.09 —— 深色主题里前景该是浅的。 */\n/* 往白色混 70%:浅色下仍是浅字(4.5+),深色下变浅(>4.5),两边都过。 */\n.dt-btn-primary { background: var(--dsw-alias-button-primary-fill); color: var(--dsw-static-neutral-bluish-00); }\n.dt-btn-primary:hover:not(:disabled) { background: var(--dsw-alias-button-primary-hover); }\n.dt-btn-ghost { background: transparent; border: 0.5px solid var(--dsw-alias-border-l3); color: var(--dsw-alias-label-secondary); }\n.dt-btn-ghost:hover:not(:disabled), .dt-btn-outline:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-btn-ghost:active:not(:disabled) { background: var(--dsw-alias-interactive-bg-active); }\n.dt-btn-outline { border: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-btn-icon { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; }\n.dt-tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 1px 8px; font-size: 11px; line-height: 17px; font-weight: 500; white-space: nowrap; }\n.dt-tag[data-tone='outline'] { border: 0.5px solid var(--dsw-alias-border-l4); color: var(--dsw-alias-label-tertiary); }\n.dt-tag[data-tone='neutral'] { background: var(--dsw-alias-bg-module-platform); color: var(--dsw-alias-label-secondary); }\n.dt-tag[data-tone='quiet'] { color: var(--dsw-alias-label-secondary); }\n.dt-tag[data-tone='success'] { background: color-mix(in srgb, var(--dsw-alias-state-success-primary) 10%, transparent); color: color-mix(in srgb, var(--dsw-alias-state-success-primary) 72%, var(--dsw-alias-label-primary)); }\n.dt-tag[data-tone='info'] { background: color-mix(in srgb, var(--dsw-alias-state-business-primary) 10%, transparent); color: var(--dsw-alias-state-business-primary); }\n/* 胶囊是「暂停/退避/判断」唯一的状态色:文字与 12% 同色底叠起来,浅色下警告只有 4.17。 */\n/* 往 label-primary 混 28%:浅色变深、深色变浅,两档都留出余量。 */\n.dt-tag[data-tone='warning'] { background: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 12%, transparent); color: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 72%, var(--dsw-alias-label-primary)); }\n.dt-tag[data-tone='danger'] { background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 10%, transparent); color: color-mix(in srgb, var(--dsw-alias-state-error-primary) 76%, var(--dsw-alias-label-primary)); }\n.dt-pill { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border: none; border-radius: 12px; font: inherit; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); background: var(--dsw-alias-bg-layer-2); cursor: pointer; }\n.dt-pill:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-pill-active, .dt-pill-active:hover { color: var(--dsw-alias-label-primary); background: var(--dsw-alias-button-ghost-active-fill); box-shadow: inset 0 0 0 1px var(--dsw-alias-button-ghost-active-border); }\n.dt-tabs { display: grid; padding: 4px; border-radius: 12px; background: var(--dsw-alias-bg-module-platform); }\n.dt-tab { box-sizing: border-box; height: 34px; padding: 0 12px; border: 0.5px solid transparent; border-radius: 8px; background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 14px; line-height: 20px; white-space: nowrap; cursor: pointer; transition: color 180ms ease, background 180ms ease; }\n.dt-tab:hover { color: var(--dsw-alias-label-primary); }\n.dt-tab[aria-selected='true'] { color: var(--dsw-alias-label-primary); font-weight: 600; background: var(--dsw-alias-bg-layer-3); border-color: var(--dsw-alias-border-l3); }\n.dt-tab:focus-visible { outline: none; text-decoration: underline; text-underline-offset: 4px; }\n.dt-segment { height: 28px; padding: 0 16px; border: 0; border-radius: 7px; background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 13px; line-height: 20px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: color 120ms ease, background 160ms ease; }\n.dt-segment:hover:not(:disabled), .dt-segment[aria-selected='true'] { color: var(--dsw-alias-label-primary); }\n.dt-segment[aria-selected='true'] { background: var(--dsw-alias-bg-layer-1); box-shadow: var(--dsw-elevation-soft); }\n.dt-segment:disabled { cursor: default; opacity: 0.4; }\n.dt-segment:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; }\n.dt-input { box-sizing: border-box; display: inline-flex; align-items: center; gap: 6px; height: 32px; min-width: 0; padding: 0 8px; border: 0.5px solid var(--dsw-alias-border-l4); border-radius: 8px; background: var(--dsw-alias-bg-layer-1); }\n.dt-input:focus-within { border-color: var(--dsw-alias-brand-primary); }\n.dt-input-icon { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; color: var(--dsw-alias-label-tertiary); }\n.dt-input input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font: inherit; font-size: 14px; line-height: 22px; color: var(--dsw-alias-label-primary); }\n.dt-input input/* 占位符:label-dimmed 在浅色下只有 2.17(深色 3.81),必须能读出来才叫占位符。 */\n/* 往 label-tertiary 混 60%:浅色变深、深色变浅,两档都过 4.5。 */\n::placeholder { color: color-mix(in srgb, var(--dsw-alias-label-dimmed) 40%, var(--dsw-alias-label-tertiary)); }\n.dt-input input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }\n.dt-field .dt-input, .dt-search .dt-input, .dt-add-skill .dt-input { display: flex; width: 100%; }\n.dt-switch { box-sizing: border-box; flex: 0 0 auto; width: 36px; height: 20px; padding: 2px; border: 0; border-radius: 10px; background: var(--dsw-alias-border-l3); cursor: pointer; }\n.dt-switch[aria-checked='true'] { background: var(--dsw-alias-brand-primary); }\n.dt-switch:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }\n.dt-switch-thumb { display: block; width: 16px; height: 16px; border-radius: 50%; background: var(--dsw-alias-label-primary-foreground); transition: transform 120ms ease; }\n.dt-switch[aria-checked='true'] .dt-switch-thumb { transform: translateX(16px); }\n.dt-state-dot { position: relative; display: inline-block; flex: none; width: 10px; height: 10px; color: var(--dsw-alias-state-idle-primary); }\n.dt-state-dot::after { content: ''; position: absolute; inset: 20%; border-radius: 50%; background: currentColor; }\n.dt-state-dot[data-state='done'] { color: var(--dsw-alias-state-success-primary); }\n.dt-state-dot[data-state='warning'] { color: var(--dsw-alias-state-warn-primary); }\n.dt-state-dot[data-state='error'] { color: var(--dsw-alias-state-error-primary); }\n.dt-spinner { flex: none; color: var(--dsw-alias-label-tertiary); }\n.dt-spinner g { transform-origin: center; animation: dt-spin 1.5s linear infinite; }\n.dt-spinner circle { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }\n.dt-spinner circle:first-child { opacity: 0.25; }\n.dt-spinner circle:last-child { stroke-dasharray: 18 150; }\n@keyframes dt-spin { to { transform: rotate(360deg); } }\n.dt-disclosure-row { display: flex; align-items: center; gap: 4px; min-height: 28px; min-width: 0; border-radius: 8px; cursor: pointer; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }\n.dt-disclosure-row:hover { color: var(--dsw-alias-label-primary); }\n.dt-disclosure-row:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }\n.dt-disclosure-lead { position: relative; display: inline-flex; flex: none; width: 24px; height: 24px; align-items: center; justify-content: center; }\n.dt-disclosure-icon { display: inline-flex; align-items: center; justify-content: center; }\n.dt-disclosure-chevron { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; }\n.dt-disclosure-row:hover .dt-disclosure-icon, .dt-disclosure[data-open] .dt-disclosure-icon { visibility: hidden; }\n.dt-disclosure-row:hover .dt-disclosure-chevron, .dt-disclosure[data-open] .dt-disclosure-chevron { display: inline-flex; }\n.dt-disclosure-title { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.dt-modal-root { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: max(24px, var(--dsh-frame-top-clearance, 24px)) 24px; }\n.dt-modal-mask { position: absolute; inset: 0; background: var(--dsw-alias-bg-mask-1); backdrop-filter: var(--dsw-mask-blur); }\n.dt-modal { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 20px; width: min(380px, 100%); max-height: 100%; padding: 0 0 24px; overflow-x: hidden; overflow-y: auto; border-radius: 24px; background: var(--dsw-alias-bg-layer-2); box-shadow: var(--dsw-elevation-prominent); color: var(--dsw-alias-label-primary); outline: none; }\n.dt-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 22px 14px 0 24px; }\n.dt-modal-header h2 { margin: 0; font-size: 16px; line-height: 24px; font-weight: 500; }\n.dt-modal-close { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: none; border-radius: 8px; background: transparent; cursor: pointer; color: var(--dsw-alias-label-secondary); }\n.dt-modal-close:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-modal-description { margin: -8px 0 0; padding: 0 24px; font-size: 14px; line-height: 22px; }\n.dt-modal-body { min-width: 0; min-height: 0; overflow: auto; padding: 0 24px; }\n.dt-modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 0 24px; }\n.dt-modal-header, .dt-modal-description, .dt-modal-footer { flex-shrink: 0; }\n.dt-toast { position: fixed; top: 40px; left: 50%; z-index: 1100; pointer-events: none; width: max-content; max-width: min(640px, calc(100vw - 48px)); padding: 12px 16px; border-radius: 14px; background: var(--dsw-alias-toast-bg); color: var(--dsw-static-neutral-bluish-00); font-size: 14px; line-height: 22px; box-shadow: var(--dsw-shadow-lv3); transform: translateX(-50%); animation: dt-toast-in 160ms ease-out, dt-toast-fade 1000ms ease var(--dt-toast-hold, 3000ms) forwards; }\n@keyframes dt-toast-in { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }\n@keyframes dt-toast-fade { to { opacity: 0; visibility: hidden; } }\n@media (prefers-reduced-motion: reduce) {\n .dt-tab, .dt-segment, .dt-switch-thumb, .dt-spinner g, .dt-btn-busy .dt-btn-icon svg, .dt-tooltip { transition: none; animation: none; }\n .dt-toast { animation: dt-toast-fade 1000ms ease var(--dt-toast-hold, 3000ms) forwards; }\n}\n.dt-page .dt-tab { height: 34px; padding: 0 2px; border: 0; border-radius: 0; color: var(--dsw-alias-label-tertiary); font-size: 14px; }\n.dt-page .dt-tab[aria-selected='true'] { background: none; color: var(--dsw-alias-label-primary); font-weight: 500; box-shadow: inset 0 -1.5px 0 var(--dsw-alias-label-primary); }\n.dt-status-head { display: flex; align-items: center; gap: 8px; }\n.dt-status-title { margin: 0; flex: 1; display: flex; align-items: center; gap: 4px; font-size: 15px; line-height: 22px; font-weight: 600; }\n.dt-status-text { margin-left: auto; flex: none; font-size: 12px; font-weight: 400; color: var(--dsw-alias-label-secondary); }\n.dt-status-line .dt-status-text { margin-left: 0; }\n.dt-status-text[data-state='warning'] { color: var(--dsw-alias-state-warn-primary); }\n.dt-status-text[data-state='error'] { color: var(--dsw-alias-state-error-primary); }\n.dt-row-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }\n.dt-lv { white-space: nowrap; }\n.dt-lv-label { color: var(--dsw-alias-label-caption); }\n.dt-lv-value { color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }\n.dt-chip { display: inline-flex; flex-wrap: wrap; max-width: 100%; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 6px; overflow: hidden; font-size: 11px; line-height: 18px; color: var(--dsw-alias-label-secondary); }\n.dt-chip-source { padding: 0 6px; color: var(--dsw-alias-label-tertiary); background: var(--dsw-alias-bg-module-platform); }\n.dt-chip-fact { padding: 0 6px; border-left: 0.5px solid var(--dsw-alias-border-l3); white-space: nowrap; }\n.dt-chip-label { margin-right: 4px; color: var(--dsw-alias-label-caption); }\n.dt-chip-link { position: relative; z-index: 1; text-decoration: none; cursor: pointer; transition: border-color 120ms ease; }\n.dt-chip-link:hover { border-color: var(--dsw-alias-brand-primary); }\n.dt-chip-link:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }\n.dt-chip-open { display: inline-flex; align-items: center; padding: 0 5px; border-left: 0.5px solid var(--dsw-alias-border-l3); color: var(--dsw-alias-brand-primary); }\n.dt-chip-problem, .dt-chip-problem .dt-chip-label { color: var(--dsw-alias-state-error-primary); }\n.dt-cards { gap: 8px; }\n.dt-att .dt-inline-link { font-size: 13px; font-weight: 500; }\n.dt-list > .dt-att { margin: 2px 8px; }\n.dt-att { padding: 10px 12px 10px 16px; border: 0; border-radius: 0; border-bottom: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-att::before { content: ''; position: absolute; left: 6px; top: 10px; bottom: 10px; width: 2px; border-radius: 1px; background: var(--dsw-alias-state-warn-primary); opacity: 0.7; }\n.dt-att-error::before { background: var(--dsw-alias-state-error-primary); }\n.dt-att-what { font-size: 12px; line-height: 18px; font-weight: 500; color: var(--dsw-alias-state-warn-primary); }\n.dt-att-error .dt-att-what, .dt-att-error .dt-att-what .dt-open { color: var(--dsw-alias-state-error-primary); }\n.dt-stats { display: flex; flex-wrap: wrap; gap: 6px 24px; padding: 10px 14px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 12px; background: var(--dsw-alias-bg-module-platform); }\n.dt-stat { display: inline-flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--dsw-alias-label-caption); }\n/* 可点的统计数字:去掉原生按钮外观,保留文字排版;选中时用浅底提示 */\n.dt-stat-btn { border: 0; background: none; padding: 2px 6px; margin: -2px -6px; border-radius: 8px; font: inherit; color: inherit; cursor: pointer; }\n.dt-stat-btn:hover { background: var(--dsw-alias-interactive-bg-hover); }\n/* 浅色下 interactive-bg-hover 与白底只差 1.03:点了统计数字在按筛选,零视觉反馈。 */\n/* 换成品牌色 12% 底 + 0.5px 品牌色描边(两个主题都分得开)。 */\n.dt-stat-btn[aria-pressed='true'] { background: color-mix(in srgb, var(--dsw-alias-brand-primary) 12%, transparent); box-shadow: inset 0 0 0 0.5px var(--dsw-alias-brand-primary); }\n.dt-stat-btn:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }\n/* 统计条单位:按钮上的 color:inherit 会把单位染成数字色,所以单位单独一档。 */\n/* 浅色下 caption(#818b98)在白底只有 3.14–3.45,深色下同一档 4.34–5.07。 */\n/* 往 label-primary 混 30%:浅色变深、深色变浅,两个主题的对比度同时变好(不用新 token)。 */\n/* 注意选择器**不带** .dt-stat-btn 前缀 —— 带前缀就只作用于可点的格子,不可点的仍是旧色(真机踩过)。 */\n.dt-stat-unit { color: color-mix(in srgb, var(--dsw-alias-label-caption) 70%, var(--dsw-alias-label-primary)); }\n/* 选中的统计格:品牌色 12% 底会把单位压到 4.20,再往主色多混 10% 拉回来。 */\n.dt-stat-btn[aria-pressed='true'] .dt-stat-unit { color: color-mix(in srgb, var(--dsw-alias-label-caption) 58%, var(--dsw-alias-label-primary)); }\n.dt-stat-value { font-size: 14px; font-weight: 500; color: var(--dsw-alias-label-primary); font-variant-numeric: tabular-nums; }\n.dt-more-link { font-size: 12px; font-weight: 400; }\n.dt-settings { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 24px; align-items: start; }\n.dt-settings-nav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; }\n.dt-settings-link { padding: 6px 10px; border: 0; border-radius: 8px; background: none; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 13px; line-height: 20px; text-align: left; cursor: pointer; }\n.dt-settings-link:hover { color: var(--dsw-alias-label-primary); }\n.dt-settings-link[aria-current='page'] { background: var(--dsw-alias-bg-module-platform); color: var(--dsw-alias-label-primary); font-weight: 500; }\n.dt-settings-link[data-stage] + .dt-settings-link:not([data-stage]) { margin-top: 10px; }\n.dt-settings-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; padding: 16px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 16px; background: var(--dsw-alias-bg-layer-1); }\n.dt-settings-title { margin: 0; font-size: 15px; line-height: 22px; font-weight: 600; }\n.dt-settings-body .dt-section-title { font-size: 15px; line-height: 22px; }\n.dt-subtabs { display: flex; gap: 16px; border-bottom: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-subtab { padding: 0 0 6px; border: 0; background: none; color: var(--dsw-alias-label-tertiary); font: inherit; font-size: 13px; cursor: pointer; }\n.dt-subtab[aria-selected='true'] { color: var(--dsw-alias-label-primary); font-weight: 500; box-shadow: inset 0 -1.5px 0 var(--dsw-alias-label-primary); }\n.dt-part { display: flex; flex-direction: column; gap: 12px; }\n.dt-rows-summary { text-align: left; color: var(--dsw-alias-label-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }\n.dt-table { width: 100%; border-collapse: collapse; font-size: 12px; line-height: 18px; }\n.dt-table th { text-align: left; font-weight: 400; color: var(--dsw-alias-label-caption); padding: 2px 8px 2px 0; }\n.dt-table td { padding: 4px 8px 4px 0; border-top: 0.5px solid var(--dsw-alias-border-l3); vertical-align: top; color: var(--dsw-alias-label-secondary); overflow-wrap: anywhere; }\n@container (max-width: 640px) {\n .dt-settings { grid-template-columns: 1fr; gap: 12px; }\n .dt-settings-nav { position: static; flex-direction: row; flex-wrap: wrap; }\n .dt-settings-link[data-stage] + .dt-settings-link:not([data-stage]) { margin-top: 0; }\n .dt-page .dt-tabs { gap: 14px; }\n}\n.dt-list > .dt-ticket { display: grid; grid-template-columns: 112px minmax(0, 1fr); column-gap: 12px; align-items: start; margin: 0; padding: 12px 8px 12px 18px; border-radius: 0; border-bottom: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-list > .dt-ticket[data-state]::before { content: ''; position: absolute; left: 6px; top: 12px; bottom: 12px; width: 2px; border-radius: 1px; background: var(--dsw-alias-state-warn-primary); opacity: 0.7; }\n.dt-list > .dt-ticket[data-state='error']::before { background: var(--dsw-alias-state-error-primary); }\n.dt-ticket-stage { align-self: stretch; padding-top: 1px; border-right: 0.5px solid var(--dsw-alias-border-l3); }\n.dt-ticket-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n.dt-ticket-body .dt-row-title .dt-open { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.dt-ticket-meta { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; }\n.dt-ticket-meta .dt-chip { flex: none; }\n.dt-ticket-meta .dt-ticket-actions { margin-top: 0; margin-left: auto; min-height: 0; flex-wrap: nowrap; }\n@container (max-width: 640px) { .dt-ticket-meta { flex-wrap: wrap; white-space: normal; } .dt-ticket-meta .dt-ticket-actions { flex-wrap: wrap; } }\n.dt-ticket-note { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--dsw-alias-label-primary); }\n.dt-ticket-note-error { color: var(--dsw-alias-state-error-primary); }\n.dt-ticket-note-pause { font-weight: 500; color: var(--dsw-alias-state-warn-primary); }\n.dt-ticket-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; min-height: 30px; margin-top: 2px; }\n/* Pass pointer events through action containers to the row link, keeping only child controls interactive. */\n.dt-ticket-actions, .dt-row-buttons, .dt-row-actions { pointer-events: none; }\n.dt-ticket-actions > *, .dt-row-buttons > *, .dt-row-actions > * { pointer-events: auto; }\n.dt-line { min-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.dt-row-meta.dt-line { flex-wrap: nowrap; }\n.dt-line-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dsw-alias-label-secondary); }\n.dt-error-text { color: var(--dsw-alias-state-error-primary); }\n.dt-stage { display: inline-flex; align-items: flex-start; gap: 5px; font-size: 12px; line-height: 18px; font-weight: 500; color: var(--dsw-alias-label-secondary); }\n.dt-stage svg { flex: none; margin-top: 2px; }\n.dt-stage[data-state='warning'] { color: var(--dsw-alias-state-warn-primary); }\n.dt-stage[data-state='error'] { color: var(--dsw-alias-state-error-primary); }\n.dt-stage[data-state='ongoing'] { color: var(--dsw-alias-state-business-primary); }\n.dt-icon-link { display: inline-flex; align-items: center; gap: 4px; }\na.dt-btn, a.dt-btn:hover { text-decoration: none; }\n.dt-section-icon { display: inline-flex; align-self: center; color: var(--dsw-alias-label-tertiary); }\n.dt-trigger-link { display: flex; flex-direction: column; gap: 2px; width: 100%; margin: -4px 0 -4px -8px; padding: 4px 8px; border: 0; border-radius: 8px; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }\n.dt-trigger-link:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dt-trigger-link:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }\n.dt-trigger-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }\n.dt-kv-stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }\n.dt-banner-actions { margin-top: 6px; }\n@container (max-width: 640px) {\n .dt-list > .dt-ticket { grid-template-columns: 1fr; row-gap: 4px; }\n .dt-ticket-stage { border-right: 0; }\n}\n.dt-nav-group { margin: 10px 10px 2px; font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-secondary); }\n.dt-nav-group:first-child { margin-top: 0; }\n.dt-prompt-nav .dt-nav-item { flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }\n.dt-nav-item > span { display: inline-flex; align-items: center; gap: 6px; }\n.dt-nav-item small { font-size: 12px; line-height: 18px; font-weight: 400; color: var(--dsw-alias-label-caption); }\n.dt-preview-part[data-editable] { border-left-color: var(--dsw-alias-brand-primary); }\n.dt-preview-head b { font-weight: 500; }\n.dt-preview-head > span { font-size: 12px; color: var(--dsw-alias-label-caption); }\n.dt-changed-tag { margin-left: 6px; padding: 0 5px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 4px; font-size: 11px; line-height: 16px; font-weight: 400; color: var(--dsw-alias-label-secondary); }\n.dt-updated-tag { border-color: var(--dsw-alias-state-warn-primary); color: var(--dsw-alias-state-warn-primary); }\n.dt-default-updated { display: flex; flex-direction: column; gap: 6px; padding: 2px 0 2px 12px; border-left: 2px solid var(--dsw-alias-state-warn-primary); }\n.dt-diff-fold { color: var(--dsw-alias-label-caption); font-style: italic; }\n.dt-compare { margin-left: auto; }\n.dt-admission th { white-space: nowrap; }\n.dt-admission thead tr:first-child th:not(:first-child) { color: var(--dsw-alias-label-secondary); font-weight: 500; }\n.dt-admission td { vertical-align: middle; }\n.dt-admission-scope { color: var(--dsw-alias-label-primary); font-size: 13px; }\n.dt-admission-scope small { display: block; font-size: 11px; color: var(--dsw-alias-label-caption); }\n.dt-admission-na { color: var(--dsw-alias-label-caption); }\n.dt-admission-cell { display: flex; align-items: center; gap: 4px; }\n.dt-admission-cell .dt-select { flex: 1; min-width: 0; }\n.dt-admission-slot { display: inline-flex; flex: none; width: 16px; }\n.dt-info-warn { color: var(--dsw-alias-state-warn-primary); }\n.dt-field-segmented { max-width: 240px; }\n/* 活跃时段:两个原生 time 选择器 + 全天按钮 */\n/* 表单控件不必满宽:短数字撑到 900px 只会显得空 */\n.dt-form > .dt-field > .dt-input { max-width: 480px; }\n.dt-error-card { border-color: color-mix(in srgb, var(--dsw-alias-state-error-primary) 35%, var(--dsw-alias-border-l3)); }\n.dt-error-card .dt-card-title { color: var(--dsw-alias-state-error-primary); }\n/* 空态引导:圆形步骤号 + 标题 + 说明,替代「① + 列表符号」的重复 */\n.dt-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; counter-reset: none; }\n.dt-step { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }\n.dt-step-num { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--dsw-alias-bg-module-platform); color: var(--dsw-alias-label-secondary); font-size: 12px; line-height: 1; font-variant-numeric: tabular-nums; }\n.dt-step-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }\n.dt-step-title { font-size: 13px; line-height: 20px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n.dt-empty { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: 12px; }\n.dt-step-detail { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n.dt-hours { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n.dt-time { box-sizing: border-box; height: 32px; padding: 0 8px; border: 0.5px solid var(--dsw-alias-border-l4); border-radius: 8px; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; }\n.dt-time:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }\n.dt-hours-sep { color: var(--dsw-alias-label-tertiary); }\n.dt-hours-hint { font-size: 12px; color: var(--dsw-alias-label-caption); }\n/* 分诊信号表(设置 → 诊断):左列「名字 + 两个标签」成组,右列 `+N 分` 定宽贴右、数字等宽。只挂局部类,全局 .dt-row-title 一行没动 —— 别的列表还在用它。 */\n.dt-signal-title { display: grid; grid-template-columns: minmax(0, 1fr) 4.5em; align-items: baseline; column-gap: 12px; }\n.dt-signal-lead { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }\n.dt-signal-meta { display: block; justify-self: stretch; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }\n/* 同一个维度(默认开/关)的两档要等权:`默认关` 原本是 49×19 的裸字,`默认开` 是 51×21 的描边胶囊。 */\n.dt-signal-lead .dt-tag[data-tone='quiet'] { border: 0.5px solid var(--dsw-alias-border-l4); }\n/* 会话头部入口:尺寸与配色照官方 Forge HeaderButton.module.css 的 .trigger(28px、label-secondary,按下才给 interactive-bg-active)。 */\n.dt-header-entry { position: relative; flex: none; width: 28px; color: var(--dsw-alias-label-secondary); }\nbutton.dt-header-entry { display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; background: transparent; font: inherit; cursor: pointer; }\n.dt-header-entry:hover:not(:disabled) { color: var(--dsw-alias-label-primary); }\n.dt-header-entry[aria-pressed='true'] { color: var(--dsw-alias-label-primary); }\n/* 只有官方 Button 路径填底色:圆角由宿主 Button 自己拥有,这里不写自造半径。 */\n.dt-header-entry-host[aria-pressed='true'] { background: var(--dsw-alias-interactive-bg-active); }\n@media (hover: hover) { .dt-header-entry-host[aria-pressed='true']:hover:not(:disabled) { color: var(--dsw-alias-label-primary); background: var(--dsw-alias-interactive-bg-active); } }\n.dt-header-entry:disabled { cursor: not-allowed; opacity: .4; }\n.dt-header-entry:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }\n";
612
808
 
613
809
  /** 把移植过来的样式挂到 document 上,只挂一次。 */
614
810
  /**
@@ -616,6 +812,10 @@ window.__ModuleLoader__.load({
616
812
  * 以前这里是一整套自成体系的 inline style,和原生界面放一起能看出断层。
617
813
  */
618
814
  const DOCK_CSS = `
815
+ /* 目标会话选择器进入预览后,控件边界也须达到 3:1;只换官方 token,不提高豁免基线。 */
816
+ .dt-page .dt-select { border-color: var(--dsw-alias-label-tertiary); }
817
+ /* HoursField 多段:沿用官方 dt-hours 行与 dt-btn,只补 derived 纵向列表。 */
818
+ .sa-hours-list { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
619
819
  /* Composer dock 入口:保留 20px derived 几何;交互色与焦点复用官方 dt-btn / ghost 规则。 */
620
820
  .dt-btn.sa-orbit-trigger { display: inline-flex; align-items: center; justify-content: center; height: 20px; min-width: 20px; padding: 0 2px; margin: 0 2px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; color: inherit; font: inherit; opacity: 1; }
621
821
  .dt-btn.sa-orbit-trigger:hover { background: var(--dsw-alias-interactive-bg-hover); }
@@ -647,13 +847,15 @@ window.__ModuleLoader__.load({
647
847
  .sa-dock-session { flex: none; font-size: 11px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }
648
848
  .sa-dock-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--dsw-alias-label-primary); }
649
849
  .sa-dock-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dsw-alias-label-tertiary); }
850
+ /* 最近唤醒的条目:仓库名与状态之后的第二行事实,比 sub 亮一档(客户最关心的一条) */
851
+ .sa-dock-wake { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dsw-alias-label-secondary); }
650
852
  .sa-dock-err { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dsw-alias-state-error-primary); }
651
853
  .sa-dock-actions { display: flex; flex: none; gap: 2px; opacity: 0; transition: opacity 120ms ease; }
652
854
  .sa-dock-row:hover .sa-dock-actions, .sa-dock-row:focus-within .sa-dock-actions { opacity: 1; }
653
855
  @media (hover: none) { .sa-dock-actions { opacity: 1; } }
654
856
  @media (prefers-reduced-motion: reduce) { .sa-dock-actions { transition: none; } }
655
857
  .sa-dock-empty { padding: 4px 14px 12px; color: var(--dsw-alias-label-tertiary); }
656
- .sa-dock-foot { padding: 8px 14px 10px; border-top: 0.5px solid var(--dsw-alias-border-l3); color: var(--dsw-alias-label-caption); }
858
+ .sa-dock-foot { padding: 8px 14px 10px; border-top: 0.5px solid var(--dsw-alias-border-l3); color: var(--dsw-alias-label-secondary); }
657
859
  `
658
860
 
659
861
  /**
@@ -863,14 +1065,15 @@ window.__ModuleLoader__.load({
863
1065
  }
864
1066
 
865
1067
  // 审核 T26 W2:以前 传了但这里不解构 —— 传的人以为会显示,其实被静默吞掉。
866
- function Section({ title, count, subtitle, hint, action, children }) {
1068
+ function Section({ title, count, subtitle, hint, action, icon, children }) {
867
1069
  return h('section', { className: 'dt-section' },
868
1070
  title
869
1071
  ? h('h2', { className: 'dt-section-title' },
1072
+ icon ? h('span', { className: 'dt-section-icon' }, h(Icon, { name: icon, size: 14 })) : null,
870
1073
  h('span', { className: 'dt-section-name' }, title),
871
1074
  count !== undefined && count !== null ? h('span', { className: 'dt-count' }, String(count)) : null,
872
1075
  subtitle ? h('span', { className: 'dt-section-sub' }, subtitle) : null,
873
- action ? h('span', { className: 'dt-subhead-actions' }, action) : null)
1076
+ action ? h('span', { className: 'dt-subhead-actions', style: { marginLeft: 'auto' } }, action) : null)
874
1077
  : null,
875
1078
  hint ? h(Hint, null, hint) : null,
876
1079
  children)
@@ -1071,9 +1274,12 @@ window.__ModuleLoader__.load({
1071
1274
  // 这里刻意不引入 DSH InlineEditor:watcher 是多字段表单,不是单文本编辑器。
1072
1275
  const AUTHOR_LIST_PLACEHOLDER = 'GitHub 登录名,逗号分隔,留空 = 谁都算'
1073
1276
  const PRIORITY_LABEL = '优先级(在「单次最多唤醒条数」内先挑谁)'
1277
+ // PR 响应监控:watchKind 决定后面三项显不显示,所以必须进初值 ——
1278
+ // 否则新建表单的分段控件没有选中项(两个都不亮),dirty 比较也会漏掉这个键。
1074
1279
  const CREATE_WATCHER_VALUES = {
1075
- repo: '', intervalSec: '60', labels: '', ignoreLabels: '', assignee: '',
1076
- activeHours: '', goal: '', ackLabel: '', onlyAssigned: false, allowAuthors: '',
1280
+ repo: '', watchKind: 'issue', audit: false, adversarialAudit: false, auditMode: 'subagent',
1281
+ intervalSec: '60', labels: '', ignoreLabels: '', assignee: '',
1282
+ activeHours: '', goal: '', ackLabel: '', onlyAssigned: false, onlyNewComments: false, allowAuthors: '',
1077
1283
  observe: false, isolated: false, workdir: '', batchLimit: '', maxWakesPerHour: '',
1078
1284
  sessionMaxWakes: '', isolateKeepDays: '', maxIsolated: '',
1079
1285
  priorityReopened: true, priorityComments: true, priorityLabels: true,
@@ -1094,6 +1300,11 @@ window.__ModuleLoader__.load({
1094
1300
  }
1095
1301
  const watcherValuesFrom = (watcher, ackDefaults) => ({
1096
1302
  repo: watcher.repo || '',
1303
+ // 服务端用 kind: 'pr' 表示 PR 响应监控(老 watcher 没有这个字段 → issue)。
1304
+ watchKind: watcher.kind === 'pr' ? 'pr' : 'issue',
1305
+ audit: watcher.audit === true,
1306
+ adversarialAudit: watcher.adversarialAudit === true,
1307
+ auditMode: watcher.auditMode === 'inline' ? 'inline' : 'subagent',
1097
1308
  intervalSec: watcherNumberText(watcher.intervalSec ?? 60),
1098
1309
  labels: (watcher.filters && Array.isArray(watcher.filters.labels) ? watcher.filters.labels : []).join(','),
1099
1310
  ignoreLabels: (watcher.filters && Array.isArray(watcher.filters.ignoreLabels) ? watcher.filters.ignoreLabels : []).join(','),
@@ -1102,6 +1313,7 @@ window.__ModuleLoader__.load({
1102
1313
  goal: watcher.note || (typeof watcher.goal === 'string' ? watcher.goal : (watcher.goal && watcher.goal.objective) || ''),
1103
1314
  ackLabel: watcher.ackLabel || ackLabelFallback(watcher, ackDefaults),
1104
1315
  onlyAssigned: !!(watcher.filters && watcher.filters.onlyAssigned),
1316
+ onlyNewComments: !!(watcher.filters && watcher.filters.onlyNewComments),
1105
1317
  allowAuthors: (watcher.filters && Array.isArray(watcher.filters.allowAuthors) ? watcher.filters.allowAuthors : []).join(', '),
1106
1318
  observe: !!watcher.observe,
1107
1319
  isolated: !!watcher.isolated,
@@ -1123,24 +1335,40 @@ window.__ModuleLoader__.load({
1123
1335
  // label/hint/note/control 的顺序只在这里声明一次;两个调用点只负责提供值与回调。
1124
1336
  const WATCHER_FIELD_SCHEMA = [
1125
1337
  { key: 'repo', label: '仓库', kind: 'text', modes: ['create'], required: true, placeholder: 'owner/name,或 gitee:owner/name' },
1338
+ // PR 响应监控(Task 6):类型本身跟仓库走,所以不 advanced;后三项只在 PR 类型下出现。
1339
+ { key: 'watchKind', label: '监控类型', kind: 'segmented', options: [
1340
+ // 两条路的语义完全不同:左边是「别人提给我们、我们来处理」,右边是「我们提给别人、等别人回」。
1341
+ // 只写 Issue / PR 会让人以为右边是「监控仓库里的 PR」,实际正好相反。
1342
+ { value: 'issue', label: '收到的 Issue/PR' },
1343
+ { value: 'pr', label: '对外发出的 PR' },
1344
+ ] },
1345
+ { key: 'audit', label: '审计', kind: 'switch', when: (value) => value.watchKind === 'pr', hint: '修改后先自审一遍再提交' },
1346
+ { key: 'adversarialAudit', label: '对抗性审计', kind: 'switch', when: (value) => value.watchKind === 'pr', hint: '专门挑刺:假设这段代码一定有 bug' },
1347
+ { key: 'auditMode', label: '执行方式', kind: 'segmented', when: (value) => value.watchKind === 'pr', options: [
1348
+ { value: 'inline', label: '当前会话' },
1349
+ { value: 'subagent', label: '子代理' },
1350
+ ], disabledWhen: (value) => !value.audit && !value.adversarialAudit },
1126
1351
  { key: 'intervalSec', label: '间隔(秒)', kind: 'number', min: 30, max: 3600, required: true, hint: '多长时间检查一次这个仓库,最小 30 秒' },
1127
1352
  { key: 'labels', label: '只处理这些标签', kind: 'text', placeholder: '逗号分隔,留空 = 全部' },
1128
1353
  { key: 'ignoreLabels', label: '排除这些标签', kind: 'text', placeholder: '逗号分隔,留空 = 不排除', hint: '命中任意一个就跳过,优先级高于上面的白名单' },
1129
1354
  { key: 'allowAuthors', label: '只理这些人提的', kind: 'text', placeholder: AUTHOR_LIST_PLACEHOLDER, hint: '不在名单里的人提的 issue/PR 不会叫醒你(Gitee 也可以填)' },
1130
- { key: 'activeHours', label: '活跃时段', kind: 'hours', hint: '只在这个时间段内唤醒;窗口外只攒条目,不打扰' },
1355
+ { key: 'activeHours', label: '活跃时段', kind: 'hours', hint: '可添加多段;只在任一时段内唤醒,窗口外只攒条目,不打扰' },
1131
1356
  { key: 'goal', label: '目标/规则', kind: 'text', placeholder: '可选,会附在唤醒消息里' },
1132
1357
  { key: 'ackLabel', label: '已处理标签', kind: 'text', placeholder: '主理鱼:已处理', hint: 'watch_ack 会把同名标签打到 issue/PR 上;改名字等于换一套已处理标记' },
1133
1358
  { key: 'onlyAssigned', label: '只看已指派', kind: 'switch', hint: '只处理已指派给人的条目' },
1359
+ { key: 'onlyNewComments', label: '只看新评论', kind: 'switch', when: (value) => value.watchKind !== 'pr', hint: '只有 discussion 或 PR review 新评论才唤醒;push、改标签不唤醒。「评论优先」只调整排序,不过滤。' },
1134
1360
  { key: 'assignee', label: '只看指派给谁', kind: 'text', when: (value) => !!value.onlyAssigned, placeholder: 'GitHub 登录名,留空 = 只要有指派就行' },
1135
1361
  { key: 'observe', label: '仅观察', kind: 'switch', hint: '仅观察(只记录本会唤醒哪几条,不真唤醒)' },
1136
- { key: 'isolated', label: '隔离执行', kind: 'switch', hint: ISOLATED_HINT },
1362
+ // PR 守不做隔离执行:worktree 要建在本地仓库里,而 PR 在别人仓库,建出来的树没用。
1363
+ // 所以这四个控件在「对外发出的 PR」类型下整个不渲染(2026-11-13 review B7)。
1364
+ { key: 'isolated', label: '隔离执行', kind: 'switch', when: (value) => value.watchKind !== 'pr', hint: ISOLATED_HINT },
1137
1365
  { key: 'batchLimit', label: '单次最多唤醒条数', kind: 'number', advanced: true, min: 1, max: 20, placeholder: (defaults) => String(defaults.batchLimit ?? 5) + '(1-20)' },
1138
1366
  { key: 'maxWakesPerHour', label: '每小时最多唤醒次数', kind: 'number', advanced: true, min: 1, max: 60, placeholder: (defaults) => String(defaults.maxWakesPerHour ?? 6) + '(1-60)' },
1139
1367
  { key: 'sessionMaxWakes', label: '这条会话每小时最多被唤醒', kind: 'number', advanced: true, min: 1, max: 60, placeholder: (defaults) => String(defaults.sessionMaxWakes ?? 12) + '(1-60)', hint: '跨所有守累计:守 5 个仓库时,光有单守上限挡不住叠加' },
1140
1368
  { key: 'priority', label: PRIORITY_LABEL, kind: 'priority', advanced: true, hint: '全部关掉时按 GitHub 的「最近更新」顺序处理' },
1141
- { key: 'workdir', label: '隔离工作目录', kind: 'text', advanced: true, when: (value) => !!value.isolated, placeholder: '绝对路径,留空 = 当前工作目录' },
1142
- { key: 'isolateKeepDays', label: '隔离区保留天数', kind: 'number', advanced: true, when: (value) => !!value.isolated, min: 1, max: 30, placeholder: (defaults) => String(defaults.isolateKeepDays ?? 3) + '(1-30)', hint: '每次唤醒前回收这个天数之前的一次性工作区;留空用默认天数' },
1143
- { key: 'maxIsolated', label: '最多保留几个隔离区', kind: 'number', advanced: true, when: (value) => !!value.isolated, min: 1, max: 50, placeholder: '5(1-50)', hint: '天数之外的第二道线:超出就回收最旧的(不影响正在用的那个)' },
1369
+ { key: 'workdir', label: '隔离工作目录', kind: 'text', advanced: true, when: (value) => value.watchKind !== 'pr' && !!value.isolated, placeholder: '绝对路径,留空 = 当前工作目录' },
1370
+ { key: 'isolateKeepDays', label: '隔离区保留天数', kind: 'number', advanced: true, when: (value) => value.watchKind !== 'pr' && !!value.isolated, min: 1, max: 30, placeholder: (defaults) => String(defaults.isolateKeepDays ?? 3) + '(1-30)', hint: '每次唤醒前回收这个天数之前的一次性工作区;留空用默认天数' },
1371
+ { key: 'maxIsolated', label: '最多保留几个隔离区', kind: 'number', advanced: true, when: (value) => value.watchKind !== 'pr' && !!value.isolated, min: 1, max: 50, placeholder: '5(1-50)', hint: '天数之外的第二道线:超出就回收最旧的(不影响正在用的那个)' },
1144
1372
  ]
1145
1373
 
1146
1374
  /** superagent Field 的 DOM:label 与 InfoTip 是兄弟节点,控件拿同一个唯一 id。 */
@@ -1170,14 +1398,14 @@ window.__ModuleLoader__.load({
1170
1398
  }
1171
1399
 
1172
1400
  /** superagent SaveBar 的精简草稿状态:clean 不挂载,dirty/busy/error 才挂载。 */
1173
- function SaveBar({ dirty, busy, error, disabled, onDiscard, onSave, saveLabel = '保存' }) {
1401
+ function SaveBar({ dirty, busy, error, disabled, onDiscard, onSave, saveLabel = '保存', discardLabel = '放弃', status, busyLabel = '保存中…' }) {
1174
1402
  if (!dirty && !busy && !error) return null
1175
1403
  return h('div', { className: 'dt-savebar' },
1176
1404
  error
1177
1405
  ? h('p', { className: 'dt-error', role: 'alert' }, error)
1178
- : h('p', { className: 'dt-hint', 'aria-live': 'polite' }, busy ? '保存中…' : '未保存'),
1179
- h(Btn, { size: 'sm', variant: 'ghost', disabled: !dirty || !!busy || !!disabled, onClick: onDiscard }, '放弃'),
1180
- h(Btn, { size: 'sm', variant: 'primary', type: 'submit', disabled: !dirty || !!busy || !!disabled, onClick: onSave }, busy ? '保存中…' : saveLabel))
1406
+ : h('p', { className: 'dt-hint', 'aria-live': 'polite' }, status || (busy ? busyLabel : '未保存')),
1407
+ h(Btn, { size: 'sm', variant: 'ghost', 'aria-label': discardLabel, disabled: !dirty || !!busy || !!disabled, onClick: onDiscard }, discardLabel),
1408
+ h(Btn, { size: 'sm', variant: 'primary', type: 'submit', 'aria-label': busy ? busyLabel : saveLabel, disabled: !dirty || !!busy || !!disabled, onClick: onSave }, busy ? busyLabel : saveLabel))
1181
1409
  }
1182
1410
 
1183
1411
  /**
@@ -1205,30 +1433,66 @@ window.__ModuleLoader__.load({
1205
1433
  }, 0)
1206
1434
  }
1207
1435
 
1208
- /** derived HoursField:两个原生时间控件,Field 的 label 只关联起始控件。 */
1436
+ /** derived HoursField:每段两个原生时间控件;多段直接由 value 推导,不新增 hook。 */
1209
1437
  function HoursField({ value, onChange, id, disabled }) {
1210
- const match = String(value || '').match(/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/)
1211
- const start = match ? String(match[1]).padStart(2, '0') + ':' + match[2] : ''
1212
- const end = match ? String(match[3]).padStart(2, '0') + ':' + match[4] : ''
1213
- const write = (nextStart, nextEnd) => onChange(nextStart && nextEnd ? nextStart + '-' + nextEnd : '')
1214
- const overnight = Boolean(start && end && end <= start)
1215
- return h('div', { className: 'dt-hours' },
1216
- h('input', {
1217
- id, type: 'time', className: 'dt-time', value: start, 'aria-label': '起始时间', disabled,
1218
- onChange: (event) => write(event.target.value, end || '23:00'),
1219
- }),
1220
- h('span', { className: 'dt-hours-sep' }, '→'),
1221
- h('input', {
1222
- id: id ? id + '-end' : undefined, type: 'time', className: 'dt-time', value: end, 'aria-label': '结束时间', disabled,
1223
- onChange: (event) => write(start || '09:00', event.target.value),
1224
- }),
1225
- value
1226
- ? h('button', {
1227
- type: 'button', className: 'dt-btn dt-btn-sm dt-btn-ghost', disabled,
1228
- onClick: () => onChange(''),
1229
- }, '全天')
1230
- : h('span', { className: 'dt-hours-hint' }, '留空 = 全天'),
1231
- overnight ? h('span', { className: 'dt-hours-hint' }, '跨夜窗口') : null)
1438
+ const text = String(value || '')
1439
+ const rows = (text ? text.split(/[,;]/) : ['']).map((segment) => {
1440
+ const match = segment.trim().match(/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/)
1441
+ return {
1442
+ start: match ? String(match[1]).padStart(2, '0') + ':' + match[2] : '',
1443
+ end: match ? String(match[3]).padStart(2, '0') + ':' + match[4] : '',
1444
+ }
1445
+ })
1446
+ const multiple = rows.length > 1
1447
+ const serialize = (list) => list
1448
+ .map((row) => row.start && row.end ? row.start + '-' + row.end : '')
1449
+ .filter(Boolean).join(',')
1450
+ const write = (index, nextStart, nextEnd) => {
1451
+ const next = rows.map((row) => ({ ...row }))
1452
+ next[index] = { start: nextStart, end: nextEnd }
1453
+ onChange(serialize(next))
1454
+ }
1455
+ const addButton = h('button', {
1456
+ type: 'button', className: 'dt-btn dt-btn-sm dt-btn-ghost', disabled,
1457
+ 'aria-label': '添加时段',
1458
+ onClick: () => onChange([serialize(rows), '09:00-10:00'].filter(Boolean).join(',')),
1459
+ }, '添加时段')
1460
+ const renderRow = (row, index) => {
1461
+ const startId = index === 0 ? id : id ? id + '-' + (index + 1) + '-start' : undefined
1462
+ const endId = index === 0 ? (id ? id + '-end' : undefined) : id ? id + '-' + (index + 1) + '-end' : undefined
1463
+ const label = multiple ? '第 ' + (index + 1) + ' 段' : ''
1464
+ const overnight = Boolean(row.start && row.end && row.end <= row.start)
1465
+ return [
1466
+ h('input', {
1467
+ id: startId, type: 'time', className: 'dt-time', value: row.start,
1468
+ 'aria-label': label + '起始时间', disabled,
1469
+ onChange: (event) => write(index, event.target.value, row.end || '23:00'),
1470
+ }),
1471
+ h('span', { className: 'dt-hours-sep' }, '→'),
1472
+ h('input', {
1473
+ id: endId, type: 'time', className: 'dt-time', value: row.end,
1474
+ 'aria-label': label + '结束时间', disabled,
1475
+ onChange: (event) => write(index, row.start || '09:00', event.target.value),
1476
+ }),
1477
+ multiple
1478
+ ? h('button', {
1479
+ type: 'button', className: 'dt-btn dt-btn-sm dt-btn-ghost', disabled,
1480
+ 'aria-label': '删除第 ' + (index + 1) + ' 段',
1481
+ onClick: () => onChange(serialize(rows.filter((_, rowIndex) => rowIndex !== index))),
1482
+ }, '删除')
1483
+ : value
1484
+ ? h('button', {
1485
+ type: 'button', className: 'dt-btn dt-btn-sm dt-btn-ghost', disabled,
1486
+ onClick: () => onChange(''),
1487
+ }, '全天')
1488
+ : h('span', { className: 'dt-hours-hint' }, '留空 = 全天'),
1489
+ overnight ? h('span', { className: 'dt-hours-hint' }, '跨夜窗口') : null,
1490
+ ]
1491
+ }
1492
+ if (!multiple) return h('div', { className: 'dt-hours' }, ...renderRow(rows[0], 0), addButton)
1493
+ return h('div', { className: 'sa-hours-list' },
1494
+ rows.map((row, index) => h('div', { className: 'dt-hours', key: index }, ...renderRow(row, index))),
1495
+ addButton)
1232
1496
  }
1233
1497
 
1234
1498
  function WatcherSwitch({ spec, value, onChange, disabled, id }) {
@@ -1242,7 +1506,7 @@ window.__ModuleLoader__.load({
1242
1506
  function WatcherPriority({ value, onChange, disabled, idPrefix }) {
1243
1507
  const items = [
1244
1508
  ['priorityReopened', '重开优先', '被重开的排最前'],
1245
- ['priorityComments', '评论优先', '有人在等回应的靠前'],
1509
+ ['priorityComments', '评论优先', '只排序:有人在等回应的靠前,不过滤其它更新'],
1246
1510
  ['priorityLabels', '标签优先', '带标签的靠前'],
1247
1511
  ['priorityUnassigned', '未认领优先', '没人认领的靠前(默认关:这是我们的判断,不是规则)'],
1248
1512
  ['priorityStale', '积压优先', '躺了 30 天以上的靠前(默认关,只展示)'],
@@ -1257,7 +1521,7 @@ window.__ModuleLoader__.load({
1257
1521
  }
1258
1522
 
1259
1523
  function WatcherForm({ mode = 'edit', idPrefix = 'watcher', value, snapshot, defaults = {}, disabled = false,
1260
- onChange, onSave, onDiscard, submitLabel = '保存', sessionId }) {
1524
+ onChange, onSave, onDiscard, submitLabel = '保存', sessionId, targetControl = null }) {
1261
1525
  const [advancedOpen, setAdvancedOpen] = useState(false)
1262
1526
  const [busy, setBusy] = useState(false)
1263
1527
  const [error, setError] = useState(null)
@@ -1320,17 +1584,27 @@ window.__ModuleLoader__.load({
1320
1584
  if (spec.modes && !spec.modes.includes(mode)) return null
1321
1585
  if (spec.when && !spec.when(values)) return null
1322
1586
  const id = idPrefix + '-' + spec.key
1587
+ // 统一算一次:busy/disabled 是整表语义,disabledWhen 是字段自己的规则,两者取或。
1588
+ // 以前三处各写一遍 `busy || disabled` —— 加第四种控件时漏一处就静默可点。
1589
+ const specDisabled = busy || disabled || (typeof spec.disabledWhen === 'function' ? !!spec.disabledWhen(values) : false)
1323
1590
  if (spec.kind === 'switch') {
1324
- return h(WatcherSwitch, { key: spec.key, spec, value: values[spec.key], disabled: busy || disabled, id,
1591
+ return h(WatcherSwitch, { key: spec.key, spec, value: values[spec.key], disabled: specDisabled, id,
1325
1592
  onChange: (next) => change(spec.key, next) })
1326
1593
  }
1327
1594
  if (spec.kind === 'priority') {
1328
- return h(WatcherPriority, { key: spec.key, value: values, disabled: busy || disabled, idPrefix,
1595
+ return h(WatcherPriority, { key: spec.key, value: values, disabled: specDisabled, idPrefix,
1329
1596
  onChange: change })
1330
1597
  }
1598
+ if (spec.kind === 'segmented') {
1599
+ return h(Field, { key: spec.key, id, label: spec.label, hint: spec.hint, note: spec.note },
1600
+ h(SegmentedControl, {
1601
+ id, label: spec.label, options: spec.options, value: values[spec.key],
1602
+ disabled: specDisabled, onChange: (next) => change(spec.key, next),
1603
+ }))
1604
+ }
1331
1605
  const common = {
1332
1606
  value: spec.kind === 'hours' ? (values[spec.key] || '') : watcherNumberText(values[spec.key]),
1333
- disabled: busy || disabled,
1607
+ disabled: specDisabled,
1334
1608
  onChange: (next) => change(spec.key, next),
1335
1609
  }
1336
1610
  const control = spec.kind === 'hours'
@@ -1341,7 +1615,7 @@ window.__ModuleLoader__.load({
1341
1615
  min: spec.min, max: spec.max, step: spec.kind === 'number' ? 1 : undefined,
1342
1616
  required: !!spec.required,
1343
1617
  placeholder: typeof spec.placeholder === 'function' ? spec.placeholder(defaults) : spec.placeholder,
1344
- disabled: busy || disabled,
1618
+ disabled: specDisabled,
1345
1619
  onChange: (event) => change(spec.key, event.target.value),
1346
1620
  })
1347
1621
  return h(Field, { key: spec.key, id, label: spec.label, hint: spec.hint, note: spec.note }, control)
@@ -1349,12 +1623,21 @@ window.__ModuleLoader__.load({
1349
1623
  const basic = WATCHER_FIELD_SCHEMA.filter((spec) => !spec.advanced).map(renderField)
1350
1624
  const advanced = WATCHER_FIELD_SCHEMA.filter((spec) => spec.advanced).map(renderField)
1351
1625
  const collapsedAdvanced = h('span', { className: 'dt-row-meta' },
1352
- h('span', { className: 'dt-hint' }, '限额、优先级与隔离保留策略'),
1626
+ // 标题也要按类型分流:PR 守没有隔离配置,标题再写「隔离保留策略」就是误导
1627
+ // (2026-11-13 真实 Chromium 复验 B7 最后一处)。
1628
+ h('span', { className: 'dt-hint' },
1629
+ values.watchKind === 'pr' ? '限额与优先级' : '限额、优先级与隔离保留策略'),
1353
1630
  // 收起时只展示默认值摘要,不挂载高级 input;默认值仍来自 /state.defaults。
1354
- WATCHER_FIELD_SCHEMA.filter((spec) => spec.advanced && spec.kind === 'number').map((spec) => {
1355
- const placeholder = typeof spec.placeholder === 'function' ? spec.placeholder(defaults) : spec.placeholder
1356
- return h('span', { key: spec.key, className: 'dt-hint', placeholder }, spec.label + ' ' + placeholder)
1357
- }))
1631
+ // `when` 必须和 renderField 走同一套判断:只按 advanced+number 过滤时,
1632
+ // 真正的高级 input 已经被隐藏,摘要却仍把「隔离区保留天数 / 最多保留几个隔离区」
1633
+ // 显示出来(2026-11-13 真实 Chromium 复验 B7 遗漏)。
1634
+ WATCHER_FIELD_SCHEMA
1635
+ .filter((spec) => spec.advanced && spec.kind === 'number')
1636
+ .filter((spec) => !spec.when || spec.when(values))
1637
+ .map((spec) => {
1638
+ const placeholder = typeof spec.placeholder === 'function' ? spec.placeholder(defaults) : spec.placeholder
1639
+ return h('span', { key: spec.key, className: 'dt-hint', placeholder }, spec.label + ' ' + placeholder)
1640
+ }))
1358
1641
  const submitFromClick = (event) => submit(event)
1359
1642
  return h('form', {
1360
1643
  id: idPrefix, ref: formRef, className: 'dt-form dt-card', 'data-mode': mode, onSubmit: submit,
@@ -1365,6 +1648,7 @@ window.__ModuleLoader__.load({
1365
1648
  if ((!next || !event.currentTarget.contains(next)) && !(busyRef.current && !next)) formFocusedRef.current = false
1366
1649
  },
1367
1650
  },
1651
+ typeof targetControl === 'function' ? targetControl(busy) : targetControl,
1368
1652
  h(Fields, { disabled: busy || disabled },
1369
1653
  basic,
1370
1654
  h(DisclosureRow, {
@@ -1384,11 +1668,388 @@ window.__ModuleLoader__.load({
1384
1668
  }
1385
1669
 
1386
1670
  function KeyValues({ rows }) {
1671
+ // 与官方 widgets.tsx 一致:每对 dt/dd 都由 display:contents 行容器包裹。
1387
1672
  return h('dl', { className: 'dt-kv' },
1388
- rows.filter(Boolean).flatMap(([key, value]) => [
1389
- h('dt', { key: key + '-k' }, key),
1390
- h('dd', { key: key + '-v' }, value),
1391
- ]))
1673
+ rows.filter(Boolean).map(([key, value], index) => h('div', { key: String(key) + '-' + index, style: { display: 'contents' } },
1674
+ h('dt', null, key),
1675
+ h('dd', null, value))))
1676
+ }
1677
+
1678
+ function LabelValue({ label, value }) {
1679
+ return h('span', { className: 'dt-lv' },
1680
+ h('span', { className: 'dt-section-sub' }, label),
1681
+ ' ',
1682
+ h('span', { className: 'dt-lv-value' }, value))
1683
+ }
1684
+
1685
+ function StageMark({ state, icon, label }) {
1686
+ return h('span', { className: 'dt-stage', 'data-state': state },
1687
+ state === 'ongoing' ? h(StateDot, { state: 'ongoing' }) : h(Icon, { name: icon, size: 14 }),
1688
+ label)
1689
+ }
1690
+
1691
+ // 模块化房间只复用现有 Section/Btn/KeyValues/TicketLine 结构;动作由宿主数据层注入,
1692
+ // 浏览器视图不自行臆造 HTTP 路径。未知计数必须显式写“未知”,不能用 || 0 吞掉 null。
1693
+ const MODULAR_VIEW_TEXT = {
1694
+ zh: {
1695
+ tab: '房间', records: 'Ticket records', execution: '当前执行', health: '部署与健康', outbox: 'Outbox', draft: '草稿',
1696
+ unknown: '未知', none: '无', yes: '是', no: '否', all: '全部', filterEmpty: '当前筛选没有 Ticket。',
1697
+ total: '总数', open: '待接单', assigned: '执行中', waiting: '等待', ended: '已结束',
1698
+ currentTicket: '当前 Ticket', assignment: 'Assignment', session: '会话', running: '运行中', queued: '排队',
1699
+ active: '活跃 Ticket', maxWorkers: 'worker 上限', paused: '已暂停', status: '状态', stateDir: '状态目录', problem: '问题',
1700
+ pending: '待发送', sending: '发送中', sent: '已发送', failed: '失败', gone: '已失效',
1701
+ attempts: '尝试', history: '历史', resumes: '恢复次数', workdir: '工作目录',
1702
+ createdAt: '创建时间', updatedAt: '更新时间', endedAt: '结束时间', endReason: '结束原因',
1703
+ recordsUnknown: 'Ticket records 未知。', recordsEmpty: '没有 Ticket records。',
1704
+ executionUnknown: '当前执行未知。', executionEmpty: '当前没有执行。',
1705
+ executionIntro: '这里显示当前 Ticket、执行 Assignment 与 worker 负载;停止的是当前 Ticket,不是全局暂停。',
1706
+ executorRunning: '执行器运行中', processingPaused: 'worker 执行已暂停', executionIdle: '当前没有执行',
1707
+ pauseProcessing: '暂停 worker', resumeProcessing: '恢复 worker', pauseMessage: '只暂停或恢复新的 worker 自动执行;inline 会话的既有唤醒规则不变。',
1708
+ openSession: '打开 Session',
1709
+ healthUnknown: '健康项未知。', healthEmpty: '没有健康项。',
1710
+ outboxUnknown: 'Outbox 未知。', outboxEmpty: 'Outbox 为空。', draftUnknown: '草稿未知。',
1711
+ back: '返回 Ticket records', identifiers: '标识与执行信息',
1712
+ resume: '恢复', stop: '停止', flush: '发送 Outbox', save: '保存草稿', clear: '清空草稿',
1713
+ confirm: '确认', cancel: '取消', resumeTitle: '恢复 Ticket', stopTitle: '停止 Ticket',
1714
+ resumeMessage: (id) => '确定要恢复 ' + id + ' 吗?恢复后仍需等待新的执行分派。',
1715
+ stopMessage: (id) => '确定要停止 ' + id + ' 吗?当前执行会结束。',
1716
+ draftValue: '草稿内容', revision: 'revision', phase: '阶段', dirty: '已有修改', unsaved: '未保存',
1717
+ discard: '放弃修改', saving: '保存中…', saveFailed: '保存失败,草稿仍保留在本地。',
1718
+ clearFailed: '清空失败,草稿仍保留。', invalidJson: '草稿必须是合法 JSON。',
1719
+ states: {
1720
+ open: '待接单', assigned: '执行中', waiting: '等待', ended: '已结束',
1721
+ pending: '待发送', sending: '发送中', sent: '已发送', failed: '失败', gone: '已失效',
1722
+ ready: '就绪', error: '异常', starting: '启动中', paused: '已暂停', unknown: '未知',
1723
+ clean: '干净', editing: '编辑中',
1724
+ },
1725
+ },
1726
+ en: {
1727
+ tab: 'Rooms', records: 'Ticket records', execution: 'Current execution', health: 'Deployment & health', outbox: 'Outbox', draft: 'Draft',
1728
+ unknown: 'Unknown', none: 'None', yes: 'Yes', no: 'No', all: 'All', filterEmpty: 'No Tickets match this filter.',
1729
+ total: 'Total', open: 'Open', assigned: 'Assigned', waiting: 'Waiting', ended: 'Ended',
1730
+ currentTicket: 'Current Ticket', assignment: 'Assignment', session: 'Session', running: 'Running', queued: 'Queued',
1731
+ active: 'Active Tickets', maxWorkers: 'Worker limit', paused: 'Paused', status: 'Status', stateDir: 'State directory', problem: 'Problem',
1732
+ pending: 'Pending', sending: 'Sending', sent: 'Sent', failed: 'Failed', gone: 'Gone',
1733
+ attempts: 'Attempts', history: 'History', resumes: 'Resumes', workdir: 'Working directory',
1734
+ createdAt: 'Created', updatedAt: 'Updated', endedAt: 'Ended at', endReason: 'End reason',
1735
+ recordsUnknown: 'Ticket records are unknown.', recordsEmpty: 'No Ticket records.',
1736
+ executionUnknown: 'Current execution is unknown.', executionEmpty: 'No current execution.',
1737
+ executionIntro: 'Shows the current Ticket, Assignment, and worker load. Stop ends the current Ticket; it is not a global pause.',
1738
+ executorRunning: 'Executor running', processingPaused: 'Worker execution paused', executionIdle: 'No current execution',
1739
+ pauseProcessing: 'Pause workers', resumeProcessing: 'Resume workers', pauseMessage: 'Pause or resume new automatic worker execution only; existing inline wake rules are unchanged.',
1740
+ openSession: 'Open Session',
1741
+ healthUnknown: 'Health entries are unknown.', healthEmpty: 'No health entries.',
1742
+ outboxUnknown: 'Outbox is unknown.', outboxEmpty: 'Outbox is empty.', draftUnknown: 'Draft is unknown.',
1743
+ back: 'Back to Ticket records', identifiers: 'Identifiers & execution',
1744
+ resume: 'Resume', stop: 'Stop', flush: 'Flush outbox', save: 'Save draft', clear: 'Clear draft',
1745
+ confirm: 'Confirm', cancel: 'Cancel', resumeTitle: 'Resume Ticket', stopTitle: 'Stop Ticket',
1746
+ resumeMessage: (id) => 'Resume ' + id + '? A new Assignment is still required before work can continue.',
1747
+ stopMessage: (id) => 'Stop ' + id + '? The current execution will end.',
1748
+ draftValue: 'Draft value', revision: 'Revision', phase: 'Phase', dirty: 'Modified', unsaved: 'Unsaved changes',
1749
+ discard: 'Discard changes', saving: 'Saving…', saveFailed: 'Save failed. Your local draft is preserved.',
1750
+ clearFailed: 'Clear failed. Your draft is preserved.', invalidJson: 'Draft must be valid JSON.',
1751
+ states: {
1752
+ open: 'Open', assigned: 'Assigned', waiting: 'Waiting', ended: 'Ended',
1753
+ pending: 'Pending', sending: 'Sending', sent: 'Sent', failed: 'Failed', gone: 'Gone',
1754
+ ready: 'Ready', error: 'Error', starting: 'Starting', paused: 'Paused', unknown: 'Unknown',
1755
+ clean: 'Clean', editing: 'Editing',
1756
+ },
1757
+ },
1758
+ }
1759
+
1760
+ function modularCopy(locale) {
1761
+ const tag = String(locale || '').trim().toLowerCase().replaceAll('_', '-')
1762
+ return MODULAR_VIEW_TEXT[tag === 'en' || tag.startsWith('en-') ? 'en' : 'zh']
1763
+ }
1764
+
1765
+ function modularCount(value, copy) {
1766
+ return value === null || value === undefined ? copy.unknown : String(value)
1767
+ }
1768
+
1769
+ function modularValue(value, copy) {
1770
+ if (value === null || value === undefined) return copy.unknown
1771
+ if (typeof value === 'string') return value || copy.none
1772
+ if (typeof value === 'number' || typeof value === 'boolean') return String(value)
1773
+ try { return JSON.stringify(value) } catch { return copy.unknown }
1774
+ }
1775
+
1776
+ function modularState(value, copy) {
1777
+ return (value && copy.states[value]) || value || copy.unknown
1778
+ }
1779
+
1780
+ function ModularDraft({ draft, ticketId, copy, onSave, onClear }) {
1781
+ // 生产 /draft 的 value 是 {ticketId, body:string};编辑器只改 body,
1782
+ // 不能把整个 value 对象 String 成 "[object Object]" 再交给服务端。
1783
+ const bodyValue = draft.value && typeof draft.value === 'object' && typeof draft.value.body === 'string'
1784
+ const plainText = typeof draft.value === 'string' || bodyValue
1785
+ const initial = typeof draft.value === 'string'
1786
+ ? draft.value
1787
+ : bodyValue ? draft.value.body : JSON.stringify(draft.value === undefined ? null : draft.value, null, 2)
1788
+ const storageKey = 'dsh-session-superagent:draft:' + String(ticketId || 'unknown')
1789
+ const [value, setValue] = useState(() => {
1790
+ try {
1791
+ const stored = JSON.parse(globalThis.sessionStorage.getItem(storageKey) || 'null')
1792
+ if (stored && typeof stored.body === 'string' && Number.isInteger(stored.revision) && stored.revision <= draft.revision) return stored.body
1793
+ } catch {}
1794
+ return initial
1795
+ })
1796
+ const [error, setError] = useState(null)
1797
+ const [busy, setBusy] = useState(false)
1798
+ const busyRef = useRef(false)
1799
+ const previousInitial = useRef(initial)
1800
+ useEffect(() => {
1801
+ try { globalThis.sessionStorage.setItem(storageKey, JSON.stringify({ ticketId, body: value, revision: draft.revision })) } catch {}
1802
+ }, [storageKey, ticketId, value, draft.revision])
1803
+ useEffect(() => {
1804
+ // 409 后回读会推进服务端 revision;本地已编辑文本必须保留。
1805
+ // 只有用户没有未保存修改时,才跟随另一标签页/服务端的新值。
1806
+ if (value === previousInitial.current) setValue(initial)
1807
+ previousInitial.current = initial
1808
+ }, [initial])
1809
+ const dirty = value !== initial || draft.dirty === true
1810
+ const save = async (event) => {
1811
+ if (event && typeof event.preventDefault === 'function') event.preventDefault()
1812
+ if (busyRef.current || !dirty || !onSave) return false
1813
+ let body = value
1814
+ if (!plainText) {
1815
+ try { body = JSON.parse(value) } catch {
1816
+ setError(copy.invalidJson)
1817
+ return false
1818
+ }
1819
+ }
1820
+ busyRef.current = true
1821
+ setBusy(true)
1822
+ setError(null)
1823
+ try {
1824
+ const result = await onSave(body, { ticketId, body, revision: draft.revision })
1825
+ if (result === false) setError(copy.saveFailed)
1826
+ return result
1827
+ } catch (failure) {
1828
+ setError(String((failure && failure.message) || failure || copy.saveFailed))
1829
+ return false
1830
+ } finally {
1831
+ busyRef.current = false
1832
+ setBusy(false)
1833
+ }
1834
+ }
1835
+ const clear = async () => {
1836
+ if (busyRef.current || !onClear) return false
1837
+ busyRef.current = true
1838
+ setBusy(true)
1839
+ setError(null)
1840
+ try {
1841
+ const result = await onClear({ ticketId, revision: draft.revision, clear: true })
1842
+ if (result === false) setError(copy.clearFailed)
1843
+ else setValue('')
1844
+ return result
1845
+ } catch (failure) {
1846
+ setError(String((failure && failure.message) || failure || copy.clearFailed))
1847
+ return false
1848
+ } finally {
1849
+ busyRef.current = false
1850
+ setBusy(false)
1851
+ }
1852
+ }
1853
+ return h('form', { className: 'dt-form', onSubmit: save },
1854
+ h(KeyValues, { rows: [
1855
+ [copy.revision, modularCount(draft.revision, copy)],
1856
+ [copy.phase, modularState(draft.phase, copy)],
1857
+ [copy.dirty, draft.dirty === true ? copy.yes : draft.dirty === false ? copy.no : copy.unknown],
1858
+ ] }),
1859
+ h(Fields, { disabled: busy },
1860
+ h(Field, { id: 'modular-draft-body', label: copy.draftValue },
1861
+ h('textarea', {
1862
+ className: 'dt-textarea', rows: 6, value, spellCheck: false,
1863
+ 'aria-label': copy.draftValue,
1864
+ onChange: (event) => { setError(null); setValue(event.target.value) },
1865
+ }))),
1866
+ h(SaveBar, {
1867
+ dirty, busy, error, disabled: !onSave,
1868
+ onDiscard: () => { setError(null); setValue(initial) },
1869
+ onSave: save, saveLabel: copy.save, discardLabel: copy.discard,
1870
+ status: dirty ? copy.unsaved : undefined, busyLabel: copy.saving,
1871
+ }),
1872
+ h('div', { className: 'dt-danger-zone' },
1873
+ h('span', { className: 'dt-hint' }, copy.draftValue + ' · ' + modularState(draft.phase, copy)),
1874
+ h(Btn, {
1875
+ size: 'sm', variant: 'outline', 'aria-label': copy.clear, disabled: busy || !onClear, onClick: clear,
1876
+ }, copy.clear)))
1877
+ }
1878
+
1879
+ function ModularView({ data, actions, onAction, onOpenSession }) {
1880
+ const source = data && typeof data === 'object' ? data : {}
1881
+ const records = source.records && typeof source.records === 'object' ? source.records : {}
1882
+ const execution = source.execution && typeof source.execution === 'object' ? source.execution : {}
1883
+ const deployment = source.deployment && typeof source.deployment === 'object' ? source.deployment : {}
1884
+ const outbox = records.outbox && typeof records.outbox === 'object'
1885
+ ? records.outbox
1886
+ : (execution.outbox && typeof execution.outbox === 'object' ? execution.outbox : {})
1887
+ const copy = modularCopy(source.locale)
1888
+ const available = (name) => Boolean((actions && typeof actions[name] === 'function') || typeof onAction === 'function')
1889
+ const perform = (name, args = [], payload) => {
1890
+ if (actions && typeof actions[name] === 'function') return actions[name](...args)
1891
+ if (typeof onAction === 'function') return onAction(name, payload)
1892
+ return false
1893
+ }
1894
+ const current = execution.current && typeof execution.current === 'object' ? execution.current : null
1895
+ const assignment = execution.assignment && typeof execution.assignment === 'object' ? execution.assignment : null
1896
+ const currentTicketId = (current && current.id) || (assignment && assignment.ticketId) || null
1897
+ const draft = source.draft && typeof source.draft === 'object' ? source.draft : null
1898
+ const draftTicketId = (draft && (draft.ticketId || (draft.value && draft.value.ticketId))) || currentTicketId
1899
+ || (Array.isArray(records.records) && records.records[0] && records.records[0].id) || null
1900
+ const ticketRows = Array.isArray(records.records) ? records.records : []
1901
+ const healthRows = Array.isArray(deployment.health) ? deployment.health : []
1902
+ const outboxRows = Array.isArray(outbox.records) ? outbox.records : []
1903
+ const [ticketFilter, setTicketFilter] = useState('all')
1904
+ const [selectedTicketId, setSelectedTicketId] = useState(null)
1905
+ const selectedTicket = ticketRows.find((record) => record && record.id === selectedTicketId) || null
1906
+ const visibleTickets = ticketFilter === 'all' ? ticketRows : ticketRows.filter((record) => record && record.status === ticketFilter)
1907
+ const stageProps = (status) => status === 'assigned'
1908
+ ? { state: 'ongoing', icon: 'refresh' }
1909
+ : status === 'waiting' ? { state: 'warning', icon: 'clock' }
1910
+ : status === 'ended' ? { state: 'idle', icon: 'stop' } : { state: 'idle', icon: 'inbox' }
1911
+ const actionButtons = (ticketId, status) => {
1912
+ // ticket-state:只有 ended 才能被显式人类 resume;已结束的执行不再 stop。
1913
+ const canResume = Boolean(ticketId && status === 'ended' && available('resume'))
1914
+ const canStop = Boolean(ticketId && status && status !== 'ended' && available('stop'))
1915
+ return h(React.Fragment, null,
1916
+ h(Btn, {
1917
+ size: 'sm', variant: 'ghost', 'aria-label': copy.resume, disabled: !canResume,
1918
+ onClick: () => canResume ? perform('resume', [ticketId], { ticketId }) : false,
1919
+ }, copy.resume),
1920
+ h(ConfirmButton, {
1921
+ size: 'sm', variant: 'outline', label: copy.stop, confirmLabel: copy.stop, disabled: !canStop,
1922
+ title: copy.stopTitle, message: copy.stopMessage(ticketId),
1923
+ onConfirm: () => canStop ? perform('stop', [ticketId], { ticketId }) : false,
1924
+ }))
1925
+ }
1926
+
1927
+ return h('div', { className: 'dt-column' },
1928
+ h(Section, { title: copy.records, count: modularCount(records.total, copy) },
1929
+ h('div', { className: 'dt-filters', role: 'group', 'aria-label': copy.records }, ['all', 'open', 'assigned', 'waiting', 'ended'].map((key) =>
1930
+ h(Pill, {
1931
+ key, active: ticketFilter === key, 'aria-label': copy[key], 'aria-pressed': ticketFilter === key,
1932
+ onClick: () => { setTicketFilter(key); setSelectedTicketId(null) },
1933
+ }, copy[key] + ' ' + (key === 'all' ? modularCount(records.total, copy) : modularCount(records.counts && records.counts[key], copy))))),
1934
+ selectedTicket ? h('div', { className: 'dt-column' },
1935
+ h('div', { className: 'dt-page-head' },
1936
+ h(Btn, { variant: 'ghost', size: 'sm', icon: h(Icon, { name: 'chevron-left' }), 'aria-label': copy.back, onClick: () => setSelectedTicketId(null) }, copy.back),
1937
+ h('h1', { className: 'dt-title' }, selectedTicket.id),
1938
+ h(StageMark, { ...stageProps(selectedTicket.status), label: modularState(selectedTicket.status, copy) })),
1939
+ h(KeyValues, { rows: [
1940
+ [copy.currentTicket, h('span', { className: 'dt-mono' }, selectedTicket.id)],
1941
+ ['Thread', h('span', { className: 'dt-mono' }, modularValue(selectedTicket.threadKey, copy))],
1942
+ [copy.session, selectedTicket.ownerSessionId ? h('span', null,
1943
+ h('span', { className: 'dt-mono' }, selectedTicket.ownerSessionId), ' ',
1944
+ h(Btn, { size: 'sm', variant: 'ghost', 'aria-label': copy.openSession, disabled: !onOpenSession, onClick: () => onOpenSession(selectedTicket.ownerSessionId) }, copy.openSession)) : modularValue(selectedTicket.ownerSessionId, copy)],
1945
+ [copy.assignment, modularValue(selectedTicket.assignmentId, copy)],
1946
+ [copy.workdir, h('span', { className: 'dt-mono' }, modularValue(selectedTicket.workdir, copy))],
1947
+ [copy.resumes, modularCount(selectedTicket.resumeCount, copy)],
1948
+ [copy.history, modularCount(selectedTicket.historyCount, copy)],
1949
+ [copy.createdAt, modularValue(selectedTicket.createdAt, copy)],
1950
+ [copy.updatedAt, modularValue(selectedTicket.updatedAt, copy)],
1951
+ [copy.endedAt, modularValue(selectedTicket.endedAt, copy)],
1952
+ [copy.endReason, modularValue(selectedTicket.endReason, copy)],
1953
+ ] }),
1954
+ h('div', { className: 'dt-danger-zone' },
1955
+ h('span', { className: 'dt-hint' }, selectedTicket.id),
1956
+ h('div', { className: 'dt-ticket-actions' }, actionButtons(selectedTicket.id, selectedTicket.status))))
1957
+ : records.records === null || records.records === undefined
1958
+ ? h(Hint, null, copy.recordsUnknown)
1959
+ : visibleTickets.length === 0
1960
+ ? h(Hint, null, ticketRows.length === 0 ? copy.recordsEmpty : copy.filterEmpty)
1961
+ : h('ul', { className: 'dt-list' }, visibleTickets.map((record, index) => {
1962
+ const ticketId = record && record.id
1963
+ return h('li', { key: ticketId || index, className: 'dt-row dt-ticket', 'data-state': record && record.status === 'assigned' ? 'ongoing' : 'idle' },
1964
+ h('div', { className: 'dt-ticket-stage' }, h(StageMark, { ...stageProps(record && record.status), label: modularState(record && record.status, copy) })),
1965
+ h('div', { className: 'dt-ticket-body' },
1966
+ h('div', { className: 'dt-row-title' },
1967
+ h('button', { type: 'button', className: 'dt-open', 'aria-label': ticketId || copy.unknown, onClick: () => setSelectedTicketId(ticketId) }, ticketId || copy.unknown)),
1968
+ h('div', { className: 'dt-row-meta' },
1969
+ h('span', null, (record && record.threadKey) || copy.unknown),
1970
+ h('span', null, copy.resumes + ' ' + modularCount(record && record.resumeCount, copy)),
1971
+ h('span', null, copy.history + ' ' + modularCount(record && record.historyCount, copy))),
1972
+ h('div', { className: 'dt-ticket-actions' }, actionButtons(ticketId, record && record.status))))
1973
+ }))),
1974
+
1975
+ h(Section, { title: copy.execution, count: modularCount(execution.activeCount, copy) },
1976
+ h(Hint, null, copy.executionIntro),
1977
+ h('div', { className: 'dt-row-meta dt-status-line' },
1978
+ h('span', { className: 'dt-status-text', 'data-state': execution.paused === true ? 'warning' : current ? 'ongoing' : 'idle' },
1979
+ execution.paused === true ? copy.processingPaused : current ? copy.executorRunning : copy.executionIdle),
1980
+ h(LabelValue, { label: copy.running, value: modularCount(execution.running, copy) + ' / ' + modularCount(execution.maxWorkers, copy) }),
1981
+ h(LabelValue, { label: copy.queued, value: modularCount(execution.queued, copy) }),
1982
+ available('pauseProcessing') ? h(ConfirmButton, {
1983
+ variant: 'outline', size: 'sm', label: execution.paused === true ? copy.resumeProcessing : copy.pauseProcessing,
1984
+ confirmLabel: copy.confirm, title: execution.paused === true ? copy.resumeProcessing : copy.pauseProcessing,
1985
+ message: copy.pauseMessage,
1986
+ onConfirm: () => perform('pauseProcessing', [!execution.paused], { paused: !execution.paused }),
1987
+ }) : null),
1988
+ !current && !assignment ? h(Hint, null, execution.total === null || execution.total === undefined ? copy.executionUnknown : copy.executionEmpty) : null,
1989
+ h(KeyValues, { rows: [
1990
+ [copy.currentTicket, current && current.id ? current.id : execution.total === null || execution.total === undefined ? copy.unknown : copy.none],
1991
+ [copy.assignment, assignment && assignment.id ? assignment.id : execution.total === null || execution.total === undefined ? copy.unknown : copy.none],
1992
+ [copy.session, assignment ? modularValue(assignment.sessionId, copy) : execution.total === 0 ? copy.none : copy.unknown],
1993
+ [copy.paused, execution.paused === true ? copy.yes : execution.paused === false ? copy.no : copy.unknown],
1994
+ ] }),
1995
+ currentTicketId ? h('div', { className: 'dt-actions' }, actionButtons(currentTicketId, (current && current.status) || (assignment && assignment.status))) : null),
1996
+
1997
+ h(Section, { title: copy.health, count: modularCount(deployment.counts && deployment.counts.total, copy) },
1998
+ h(KeyValues, { rows: [
1999
+ [copy.status, modularState(deployment.status, copy)],
2000
+ [copy.stateDir, modularValue(deployment.stateDir, copy)],
2001
+ ] }),
2002
+ deployment.problem !== null && deployment.problem !== undefined
2003
+ ? h('div', { className: 'dt-banner dt-danger' }, copy.problem + ': ' + modularValue(deployment.problem, copy)) : null,
2004
+ deployment.health === null || deployment.health === undefined
2005
+ ? h(Hint, null, copy.healthUnknown)
2006
+ : healthRows.length === 0
2007
+ ? h(Hint, null, copy.healthEmpty)
2008
+ : h('ul', { className: 'dt-list' }, healthRows.map((entry, index) => h('li', {
2009
+ key: (entry && entry.name) || index, className: 'dt-row',
2010
+ },
2011
+ h('div', { className: 'dt-row-main' },
2012
+ h('div', { className: 'dt-row-title' },
2013
+ h(StateDot, { state: entry && entry.state === 'ready' ? 'done' : entry && entry.state === 'error' ? 'error' : entry && entry.state === 'starting' ? 'ongoing' : 'idle' }),
2014
+ h('span', { className: 'dt-row-name' }, (entry && entry.name) || copy.unknown),
2015
+ h(Tag, { tone: entry && entry.state === 'error' ? 'danger' : entry && entry.state === 'ready' ? 'success' : 'outline' }, modularState(entry && entry.state, copy))),
2016
+ h('div', { className: 'dt-row-meta' },
2017
+ h('span', null, (entry && (entry.code || entry.detail)) || copy.none),
2018
+ entry && entry.at ? h('time', { dateTime: entry.at, title: entry.at }, entry.at) : null)))))),
2019
+
2020
+ h(Section, {
2021
+ title: copy.outbox, count: modularCount(outbox.total, copy),
2022
+ action: h(Btn, { size: 'sm', variant: 'outline', 'aria-label': copy.flush, disabled: !available('flush'), onClick: () => perform('flush') }, copy.flush),
2023
+ },
2024
+ h('div', { className: 'dt-row-meta' }, ['pending', 'sending', 'sent', 'failed', 'gone'].map((key) =>
2025
+ h(Tag, { key, tone: key === 'failed' ? 'danger' : key === 'sent' ? 'success' : 'outline' },
2026
+ copy[key] + ' ' + modularCount(outbox.counts && outbox.counts[key], copy)))),
2027
+ outbox.records === null || outbox.records === undefined
2028
+ ? h(Hint, null, copy.outboxUnknown)
2029
+ : outboxRows.length === 0
2030
+ ? h(Hint, null, copy.outboxEmpty)
2031
+ : h('ul', { className: 'dt-list' }, outboxRows.map((message, index) => h('li', {
2032
+ key: (message && message.id) || index, className: 'dt-row',
2033
+ },
2034
+ h('div', { className: 'dt-row-main' },
2035
+ h('div', { className: 'dt-row-title' },
2036
+ h(StateDot, { state: message && message.status === 'failed' ? 'error' : message && message.status === 'sent' ? 'done' : message && message.status === 'sending' ? 'ongoing' : 'idle' }),
2037
+ h('span', { className: 'dt-row-name' }, (message && message.id) || copy.unknown),
2038
+ h(Tag, { tone: message && message.status === 'failed' ? 'danger' : message && message.status === 'sent' ? 'success' : 'outline' }, modularState(message && message.status, copy))),
2039
+ h('div', { className: 'dt-row-meta' },
2040
+ h('span', null, (message && message.ticketId) || copy.unknown),
2041
+ h('span', null, copy.attempts + ' ' + modularCount(message && message.attempts, copy))),
2042
+ message && message.lastError ? h('div', { className: 'dt-error', role: 'alert' }, message.lastError) : null,
2043
+ message && message.body ? h('div', { className: 'dt-row-quote', title: message.body }, message.body) : null))))),
2044
+
2045
+ h(Section, { title: copy.draft },
2046
+ draft
2047
+ ? h(ModularDraft, {
2048
+ key: 'modular-draft-' + String(draftTicketId || 'unknown'), draft, ticketId: draftTicketId, copy,
2049
+ onSave: available('save') ? (body, context) => perform('save', [body, context], context) : null,
2050
+ onClear: available('clear') ? (context) => perform('clear', [context], context) : null,
2051
+ })
2052
+ : h(Hint, null, copy.draftUnknown)))
1392
2053
  }
1393
2054
 
1394
2055
  // 官方 Modal 的键盘行为:Escape 关闭 + Tab 焦点陷阱 + 关闭后焦点回到触发元素。
@@ -1409,6 +2070,17 @@ window.__ModuleLoader__.load({
1409
2070
  }
1410
2071
  }
1411
2072
 
2073
+ /**
2074
+ * 本地 Modal 的 portal 宿主。只有真实可挂载的 body 才接;
2075
+ * 非 DOM/老宿主拿不到时返回 null,保持内联渲染(不另建第二个 root)。
2076
+ */
2077
+ function localModalHost() {
2078
+ if (typeof document === 'undefined' || !document.body) return null
2079
+ const host = document.body
2080
+ if (typeof host.appendChild !== 'function' || typeof host.contains !== 'function') return null
2081
+ return host
2082
+ }
2083
+
1412
2084
  function Modal({ open, title, description, footer, className, children, onClose }) {
1413
2085
  const dialog = useRef(null)
1414
2086
  const restoreTo = useRef(null)
@@ -1445,7 +2117,7 @@ window.__ModuleLoader__.load({
1445
2117
  }, [open])
1446
2118
  if (!open) return null
1447
2119
  // class 必须与移植来的官方 CSS 对齐:dt-modal-root / dt-modal-mask / dt-modal-header
1448
- return h('div', { className: 'dt-modal-root' },
2120
+ const root = h('div', { className: 'dt-modal-root' },
1449
2121
  h('div', { className: 'dt-modal-mask', role: 'presentation', onClick: onClose }),
1450
2122
  h('div', {
1451
2123
  ref: dialog, tabIndex: -1,
@@ -1458,6 +2130,10 @@ window.__ModuleLoader__.load({
1458
2130
  description ? h('p', { className: 'dt-modal-description' }, description) : null,
1459
2131
  children !== undefined && children !== null ? h('div', { className: 'dt-modal-body' }, children) : null,
1460
2132
  footer !== undefined ? h('div', { className: 'dt-modal-footer' }, footer) : null))
2133
+ // Issue #35:确认层 portal 到 body,dock 的 transform/contain 祖先就裁不到它。
2134
+ // createPortal 不可用(老宿主/非 DOM)时退回内联,语义与之前完全一致。
2135
+ const host = localCreatePortal ? localModalHost() : null
2136
+ return host ? localCreatePortal(root, host) : root
1461
2137
  }
1462
2138
 
1463
2139
  // 主面板使用 DSH Modal;没有宿主原语时回退到上面的 superagent 同源实现。
@@ -1465,7 +2141,7 @@ window.__ModuleLoader__.load({
1465
2141
  const PanelModal = hostUi ? hostUi.Modal : Modal
1466
2142
 
1467
2143
  /** 确认层与触发器分离:DSH orbit 关闭后,同一个本地 Modal 仍能由 StatusOrbit 持有。 */
1468
- function ConfirmDialog({ open, label, confirmLabel = '确定执行', title = confirmLabel, message, onConfirm, onClose, modalContext = 'panel', ButtonComponent = Btn, danger = true, preventDismissOnBusy = false, error = null, busyLabel = confirmLabel, busyHint = '安装进行中,完成后才能关闭' }) {
2144
+ function ConfirmDialog({ open, label, confirmLabel = '确定执行', cancelLabel = '取消', title = confirmLabel, message, onConfirm, onClose, modalContext = 'panel', ButtonComponent = Btn, danger = true, preventDismissOnBusy = false, error = null, busyLabel = confirmLabel, busyHint = '安装进行中,完成后才能关闭' }) {
1469
2145
  const [busy, setBusy] = useState(false)
1470
2146
  const busyRef = useRef(false)
1471
2147
  const dismiss = () => {
@@ -1501,7 +2177,7 @@ window.__ModuleLoader__.load({
1501
2177
  description: message || ('确定要执行「' + label + '」操作吗?'),
1502
2178
  onClose: dismiss,
1503
2179
  footer: h(React.Fragment, null,
1504
- h(ButtonComponent, { variant: 'ghost', disabled: preventDismissOnBusy && busy, onClick: dismiss }, '取消'),
2180
+ h(ButtonComponent, { variant: 'ghost', disabled: preventDismissOnBusy && busy, onClick: dismiss }, cancelLabel),
1505
2181
  h(ButtonComponent, {
1506
2182
  variant: 'primary',
1507
2183
  className: cx(danger && 'dt-danger', busy && 'dt-btn-busy'),
@@ -1514,7 +2190,7 @@ window.__ModuleLoader__.load({
1514
2190
  }
1515
2191
 
1516
2192
  /** 官方 ConfirmButton 动线:触发按钮只开 Modal,取消不执行,确认期间 busy 防重复。 */
1517
- function ConfirmButton({ label, confirmLabel = '确定执行', title = confirmLabel, message, onConfirm, variant = 'ghost', icon, size, modalContext = 'panel', ButtonComponent = Btn, danger = true, preventDismissOnBusy = false, error = null, busyLabel = confirmLabel, busyHint, onOpen }) {
2193
+ function ConfirmButton({ label, confirmLabel = '确定执行', cancelLabel = '取消', title = confirmLabel, message, onConfirm, variant = 'ghost', icon, size, disabled = false, modalContext = 'panel', ButtonComponent = Btn, danger = true, preventDismissOnBusy = false, error = null, busyLabel = confirmLabel, busyHint, onOpen }) {
1518
2194
  const [open, setOpen] = useState(false)
1519
2195
  const close = useCallback(() => setOpen(false), [])
1520
2196
  return h(React.Fragment, null,
@@ -1523,14 +2199,15 @@ window.__ModuleLoader__.load({
1523
2199
  size,
1524
2200
  icon,
1525
2201
  'aria-label': label,
1526
- 'aria-haspopup': 'dialog',
2202
+ 'aria-haspopup': 'dialog', ...(disabled ? { disabled: true } : {}),
1527
2203
  onClick: () => {
2204
+ if (disabled) return
1528
2205
  // 打开前先跑调用方的清理(例如清掉上一次「删除失败」);打开行为本身不变。
1529
2206
  if (typeof onOpen === 'function') onOpen()
1530
2207
  setOpen(true)
1531
2208
  },
1532
2209
  }, label),
1533
- h(ConfirmDialog, { open, label, confirmLabel, title, message, onConfirm, onClose: close, modalContext, ButtonComponent, danger, preventDismissOnBusy, error, busyLabel, busyHint }))
2210
+ h(ConfirmDialog, { open, label, confirmLabel, cancelLabel, title, message, onConfirm, onClose: close, modalContext, ButtonComponent, danger, preventDismissOnBusy, error, busyLabel, busyHint }))
1534
2211
  }
1535
2212
 
1536
2213
  const watcherId = (w) => (w && w.id) || String((w && w.repo) || '') + '#' + String((w && w.sessionId) || '')
@@ -1548,23 +2225,32 @@ window.__ModuleLoader__.load({
1548
2225
  // paused, red = last poll failed. Icon only — details live in the
1549
2226
  // click-through panel, and a native tooltip carries the one-line summary.
1550
2227
  /**
1551
- * 现在是否落在活跃时段里。支持跨夜(22:00-06:00)。
1552
- * 解析不了就返回 null —— 宁可显示「主理中」,也不要乱标。
2228
+ * 现在是否落在活跃时段里。支持跨夜(22:00-06:00)与逗号/分号多段,任一段命中即可。
2229
+ * 任一段解析不了就整串返回 null —— 宁可显示「主理中」,也不要乱标。
1553
2230
  */
1554
2231
  function inWindowNow(hours) {
1555
- const match = String(hours || '').match(/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/)
1556
- if (!match) return null
2232
+ const segments = String(hours || '').split(/[,;]/).map((segment) => segment.trim())
2233
+ if (segments.some((segment) => !segment)) return null
2234
+ const parsed = []
2235
+ for (const segment of segments) {
2236
+ const match = segment.match(/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/)
2237
+ if (!match) return null
2238
+ const parts = match.slice(1).map(Number)
2239
+ if (parts[0] > 23 || parts[2] > 23 || parts[1] > 59 || parts[3] > 59) return null
2240
+ parsed.push({ from: parts[0] * 60 + parts[1], to: parts[2] * 60 + parts[3] })
2241
+ }
1557
2242
  const now = new Date()
1558
2243
  const current = now.getHours() * 60 + now.getMinutes()
1559
- const from = Number(match[1]) * 60 + Number(match[2])
1560
- const to = Number(match[3]) * 60 + Number(match[4])
1561
- return from <= to ? current >= from && current < to : current >= from || current < to
2244
+ return parsed.some(({ from, to }) => from === to
2245
+ ? true
2246
+ : from < to ? current >= from && current < to : current >= from || current < to)
1562
2247
  }
1563
2248
 
1564
2249
  function orbitStateOf(w) {
1565
2250
  if (!w) return 'paused'
1566
2251
  // 历史数据里可能残留「gh: HTTP 304」这类不是错误的记录 —— 不把它当异常
1567
2252
  if (w.lastError && !/HTTP 304|304 Not Modified/i.test(String(w.lastError))) return 'error'
2253
+ if (w.poll && POLL_STALE_TEXT[w.poll]) return 'error'
1568
2254
  if (w.enabled === false) return 'paused'
1569
2255
  // 设了活跃时段、而此刻在窗口外:它其实不会唤醒,只是把条目攒着 ——
1570
2256
  // 这时候还标「主理中」就是在骗人(2026-11-02 用户截图指出)。
@@ -1640,6 +2326,22 @@ window.__ModuleLoader__.load({
1640
2326
  h('g', null, spin, dots))
1641
2327
  }
1642
2328
 
2329
+ // 官方品牌鲸鱼(assets/brand/whale-dark.svg):只取主轮廓与尾鳍两段子路径。
2330
+ // 官方 path 还带眼睛和腹部纹理,16px 缩到一行时会糊成一团;去掉细节后是一笔清楚的线稿。
2331
+ // 用 stroke 描边、不填色,也不引入位图或底色 —— 头部入口、左栏与右栏标题都用它当品牌标记。
2332
+ const WHALE_PATH = 'M48.8354 10.0479C48.3232 9.79199 48.1025 10.2798 47.8032 10.5278C47.7007 10.6079 47.6143 10.7119 47.5273 10.8076C46.7793 11.624 45.9048 12.1597 44.7622 12.0957C43.0923 12 41.666 12.5356 40.4058 13.8398C40.1377 12.2319 39.2476 11.272 37.8926 10.6558C37.1836 10.3359 36.4668 10.0156 35.9702 9.31982C35.6235 8.82373 35.5293 8.27197 35.356 7.72754C35.2456 7.3999 35.1353 7.06396 34.7651 7.00781C34.3633 6.94385 34.2056 7.2876 34.0479 7.57568C33.418 8.75195 33.1733 10.0479 33.1973 11.3599C33.2524 14.312 34.4736 16.6641 36.8999 18.3359C37.1758 18.5278 37.2466 18.7197 37.1597 19C36.9946 19.5757 36.7974 20.1357 36.624 20.7119C36.5137 21.0801 36.3486 21.1597 35.9624 21C34.6309 20.4321 33.481 19.5918 32.4644 18.5757C30.7393 16.8721 29.1792 14.9917 27.2334 13.52C26.7764 13.1758 26.3193 12.856 25.8467 12.5518C23.8618 10.584 26.1069 8.96777 26.627 8.77588C27.1704 8.57568 26.8159 7.8877 25.0591 7.896C23.3022 7.90381 21.6953 8.50391 19.647 9.30371C19.3477 9.42383 19.0322 9.51172 18.7095 9.58398C16.8501 9.22363 14.9199 9.14355 12.9033 9.37598C9.10596 9.80762 6.07275 11.6396 3.84326 14.7681C1.16455 18.5278 0.53418 22.7998 1.30664 27.2559C2.11768 31.9521 4.46582 35.8398 8.07373 38.8799C11.8159 42.0322 16.1255 43.5762 21.041 43.2803C24.0269 43.104 27.3516 42.6963 31.1016 39.4561C32.0469 39.936 33.0396 40.1279 34.686 40.272C35.9546 40.3921 37.1758 40.208 38.1211 40.0078C39.6021 39.688 39.4995 38.2881 38.9639 38.0322C34.623 35.9678 35.5762 36.8081 34.71 36.1279C36.9155 33.4639 40.2402 30.6958 41.54 21.728C41.6426 21.0161 41.5557 20.5679 41.54 19.9917C41.5322 19.6396 41.6108 19.5039 42.0049 19.4639C43.0923 19.3359 44.1479 19.0317 45.1167 18.4878C47.9292 16.9199 49.064 14.3438 49.3315 11.2559C49.3711 10.7837 49.3237 10.2959 48.8354 10.0479ZM32.6064 27.8799C32.2046 28.0479 31.8027 28.1919 31.4165 28.208C30.8179 28.2397 30.1641 27.9922 29.8096 27.688C29.2583 27.2158 28.8643 26.9521 28.6987 26.1279C28.6279 25.7759 28.6675 25.2319 28.7305 24.9199C28.8721 24.248 28.7144 23.8159 28.2495 23.4238C27.8716 23.104 27.3911 23.0161 26.8633 23.0161C26.666 23.0161 26.4849 22.9277 26.3511 22.856C26.1304 22.7441 25.9492 22.4639 26.1226 22.1201C26.1777 22.0078 26.4458 21.7358 26.5088 21.688C27.2256 21.272 28.0527 21.4077 28.8169 21.7197C29.5259 22.0161 30.0615 22.5601 30.834 23.3281C31.6216 24.2559 31.7632 24.5117 32.2124 25.208C32.5669 25.752 32.8901 26.312 33.1104 26.9521C33.2446 27.3521 33.0713 27.6802 32.6064 27.8799Z'
2333
+
2334
+ function DeepSeekWhaleMark(props = {}) {
2335
+ const size = Number(props.size) || 16
2336
+ return h('svg', {
2337
+ width: size, height: size, viewBox: '0 0 50 50', fill: 'none',
2338
+ 'aria-hidden': 'true', style: { overflow: 'visible' },
2339
+ }, h('path', {
2340
+ d: WHALE_PATH, fill: 'none', stroke: 'currentColor',
2341
+ strokeWidth: 2.8, strokeLinejoin: 'round', strokeLinecap: 'round',
2342
+ }))
2343
+ }
2344
+
1643
2345
  const notedOnce = new Set()
1644
2346
  /** Diagnostics: write once per page load, never on every poll. */
1645
2347
  function noteOnce(key, value) {
@@ -1667,6 +2369,7 @@ window.__ModuleLoader__.load({
1667
2369
  if (f.labels && f.labels.length) parts.push('标签: ' + f.labels.join(','))
1668
2370
  if (f.ignoreLabels && f.ignoreLabels.length) parts.push('排除: ' + f.ignoreLabels.join(','))
1669
2371
  if (f.onlyAssigned) parts.push(f.assignee ? '只看指派给 @' + f.assignee : '只看已指派')
2372
+ if (f.onlyNewComments) parts.push('只看新评论')
1670
2373
  // 设了作者白名单就要能自查;只在编辑器里出现,列表上看不出「到底生效的是谁」。
1671
2374
  if (f.allowAuthors && f.allowAuthors.length) parts.push('作者: ' + f.allowAuthors.join(','))
1672
2375
  return parts.join(' · ')
@@ -1732,7 +2435,9 @@ window.__ModuleLoader__.load({
1732
2435
  if (!match) return { main: value, hint: '' }
1733
2436
  return { main: value.slice(0, match.index).trim(), hint: match[0].trim() }
1734
2437
  }
1735
- function StatusOrbit() {
2438
+ function StatusOrbit(props = {}) {
2439
+ // Dock 的 session slot 已提供当前 sessionId;右栏打开动作只传 kind。
2440
+ const canOpenRight = Boolean(props.sessionId && hostSidebarRight && typeof hostSidebarRight.openTab === 'function')
1736
2441
  const [watchers, setWatchers] = useState(null)
1737
2442
  // 写操作的失败提示(M4):为空表示没有错误
1738
2443
  const [orbitError, setOrbitError] = useState(null)
@@ -1860,6 +2565,15 @@ window.__ModuleLoader__.load({
1860
2565
  setOpen((value) => !value)
1861
2566
  }
1862
2567
 
2568
+ const openRight = async () => {
2569
+ try {
2570
+ await openSessionSuperagentTab()
2571
+ setOrbitError(null)
2572
+ } catch (error) {
2573
+ setOrbitError('打开本会话右栏失败:' + String((error && error.message) || error))
2574
+ }
2575
+ }
2576
+
1863
2577
  const button = h('button', {
1864
2578
  ref: btnRef,
1865
2579
  type: 'button',
@@ -1869,9 +2583,9 @@ window.__ModuleLoader__.load({
1869
2583
  ? list.map((w) => (w.repo + ' · ' + (w.title || '未命名会话') + ' · ' + sessionTag(w.sessionId) + ' · ' + STATE_TEXT[orbitStateOf(w)])).join('\n')
1870
2584
  : '还没有' + brandName + ' —— 在「' + brandName + '」页加一条',
1871
2585
  'aria-label': summary,
1872
- 'aria-expanded': open ? 'true' : 'false',
2586
+ 'aria-expanded': canOpenRight ? undefined : open ? 'true' : 'false',
1873
2587
  className: cx('dt-btn', 'dt-btn-ghost', 'sa-orbit-trigger', watchers === null && 'is-loading'),
1874
- onClick: toggle,
2588
+ onClick: canOpenRight ? openRight : toggle,
1875
2589
  }, h(OrbitMark, { watchers: list }))
1876
2590
 
1877
2591
  // DSH 固定业务宽度 252/368,坐标全部交给 useAnchoredPosition;只有 fallback 保留视口夹紧与手算 bottom。
@@ -1937,9 +2651,27 @@ window.__ModuleLoader__.load({
1937
2651
  const parts = [whoName(w) + whoId(w), '每 ' + (Number(w.intervalSec) || 60) + 's']
1938
2652
  // ageText 自己已经带「前」(「76 秒前」),别再拼一个 —— 真机上显示成「76 秒前前」
1939
2653
  if (w.lastPoll) parts.push(ageText(w.lastPoll))
2654
+ if (w.poll && POLL_STALE_TEXT[w.poll]) parts.push(POLL_STALE_TEXT[w.poll])
1940
2655
  if (w.activeHours) parts.push('时段 ' + w.activeHours)
1941
2656
  return parts.join(' · ')
1942
2657
  }
2658
+ // 「这个仓库正在处理哪一条」:服务端在唤醒真正发出后写 lastWakeItem(编号 + 标题 + 类型)。
2659
+ // 只显示**一条**(batchFresh 已按优先级降序,取 head = listed[0]),
2660
+ // 条数用 lastWakeCount(本轮新增条数,可能大于 batchLimit),行高不变 ——
2661
+ // 弹层一行摘要的写法,不新增展开层级。
2662
+ const wakeLine = (w) => {
2663
+ const item = w.lastWakeItem && typeof w.lastWakeItem === 'object' ? w.lastWakeItem : null
2664
+ if (!item || !String(item.number || '').trim()) return ''
2665
+ const title = String(item.title || '').trim()
2666
+ const kind = String(item.kind || '').toLowerCase() === 'pr' ? 'PR' : 'issue'
2667
+ // 失败时 lastWake 是 'failed: …':那条时间不属于「处理过」,前缀也要说清是上一批
2668
+ const failed = typeof w.lastWake === 'string' && w.lastWake.indexOf('failed') === 0
2669
+ const total = Math.max(0, Number(w.lastWakeCount) || 0)
2670
+ const at = !failed && typeof w.lastWake === 'string' && w.lastWake ? ' · ' + ageText(w.lastWake) : ''
2671
+ return (failed ? '上次成功唤醒 ' : '最近唤醒 ') + kind + ' #' + String(item.number)
2672
+ + (title ? ' ' + title : '')
2673
+ + (total > 1 ? ' 等 ' + total + ' 条' : '') + at
2674
+ }
1943
2675
  const detailTitle = (w) => [
1944
2676
  w.title || '未命名会话',
1945
2677
  '会话 ' + sessionTag(w.sessionId),
@@ -1947,6 +2679,7 @@ window.__ModuleLoader__.load({
1947
2679
  isolationText(w),
1948
2680
  backoffText(w),
1949
2681
  historyText(w),
2682
+ wakeLine(w),
1950
2683
  w.lastDeferred,
1951
2684
  w.goal && w.goal.objective ? 'goal · ' + String(w.goal.objective).slice(0, 80) : '',
1952
2685
  w.lastError || '',
@@ -1965,6 +2698,9 @@ window.__ModuleLoader__.load({
1965
2698
  const togglePending = actionPending(w, toggleAction)
1966
2699
  const detailContent = h(React.Fragment, null,
1967
2700
  h('div', { className: 'sa-dock-sub' }, shortSub(w)),
2701
+ // 最近唤醒条目(编号 + 标题):客户在弹层里就能看出「轮到哪一条了」,
2702
+ // 不用回会话翻消息。没有唤醒记录时不占一行。
2703
+ wakeLine(w) ? h('div', { className: 'sa-dock-wake' }, wakeLine(w)) : null,
1968
2704
  w.lastError
1969
2705
  ? h('div', { className: 'sa-dock-err' }, splitErrorText(w.lastError).main)
1970
2706
  : null)
@@ -2053,6 +2789,10 @@ window.__ModuleLoader__.load({
2053
2789
  // 读失败与写操作失败分开说;旧列表仍可保留在错误上方。
2054
2790
  readError ? h('div', { className: 'sa-dock-err', role: 'alert' }, readError) : null,
2055
2791
  !readError && orbitError ? h('div', { className: 'sa-dock-err', role: 'alert' }, '操作失败:' + orbitError) : null,
2792
+ !canOpenRight ? h('div', { className: 'sa-dock-foot', role: 'status' },
2793
+ !hostSidebarRight || typeof hostSidebarRight.openTab !== 'function'
2794
+ ? '宿主 sidebarRight 服务不存在;已保留旧操作列表。'
2795
+ : '当前 Dock 没有 sessionId;已保留旧操作列表,未读取右栏。') : null,
2056
2796
  list.length > 0
2057
2797
  ? h('div', { className: 'sa-dock-foot' }, '详细状态与凭证在「' + brandName + '」标签页')
2058
2798
  : null)
@@ -2099,11 +2839,12 @@ window.__ModuleLoader__.load({
2099
2839
  // ── 官方 GUI 的三个交互件(移植自 src/client/provider.tsx + draft.tsx + src/client/controls.tsx)──
2100
2840
 
2101
2841
  /** 轮询:可见时按 interval,隐藏时降频 6 倍;上一轮没跑完就跳过;卸载时清干净。 */
2102
- function usePoll(task, intervalMs = POLL_MS) {
2842
+ function usePoll(task, intervalMs = POLL_MS, enabled = true) {
2103
2843
  const ref = useRef(task)
2104
2844
  ref.current = task
2105
2845
  const busy = useRef(false)
2106
2846
  useEffect(() => {
2847
+ if (!enabled) return undefined
2107
2848
  let alive = true
2108
2849
  let timer = null
2109
2850
  let discovered = false
@@ -2124,7 +2865,7 @@ window.__ModuleLoader__.load({
2124
2865
  }
2125
2866
  step()
2126
2867
  return () => { alive = false; if (timer) clearTimeout(timer) }
2127
- }, [intervalMs])
2868
+ }, [intervalMs, enabled])
2128
2869
  }
2129
2870
 
2130
2871
  /** 轻量 Toast:DSH 可用时由宿主计时;fallback 保留 4 秒自动消失。 */
@@ -2959,8 +3700,11 @@ window.__ModuleLoader__.load({
2959
3700
  : null)
2960
3701
  }
2961
3702
 
2962
- function ZhuliPanel(props) {
2963
- const sessionId = props && props.sessionId
3703
+ function SuperagentPage(props = {}) {
3704
+ // 同一个领域页面服务两个宿主容器;scope 只决定数据范围,不复制 watcher/Ticket/草稿动作。
3705
+ const scope = props.scope === 'global' ? 'global' : 'session'
3706
+ const sessionId = scope === 'session' ? props.sessionId : null
3707
+ const missingSession = scope === 'session' && !sessionId
2964
3708
  /** 暂停原因码 → 人话(服务端 deferReason 是唯一来源)。 */
2965
3709
  const DEFER_LABELS = {
2966
3710
  'active-hours': '不在活跃时段',
@@ -2976,6 +3720,36 @@ window.__ModuleLoader__.load({
2976
3720
  const [tab, setTab] = useState('overview')
2977
3721
  const [notice, setNotice] = useState(null)
2978
3722
  const [form, setForm] = useState({ ...CREATE_WATCHER_VALUES })
3723
+ // 全局新建复用现有 form 状态,不新增位置化 hook;目标 sessionId 只进入新建请求。
3724
+ const createSessionId = scope === 'global' ? String(form.createSessionId || '') : sessionId
3725
+ let sessionCatalog = null
3726
+ let sessionCatalogMessage = null
3727
+ let sessionCatalogIds = []
3728
+ if (scope === 'global') {
3729
+ try {
3730
+ if (!hostSessions || !hostSessions.list || typeof hostSessions.list.getSnapshot !== 'function') {
3731
+ sessionCatalogMessage = '宿主 sessions catalog 不可用,无法选择目标会话。'
3732
+ } else {
3733
+ sessionCatalog = hostSessions.list.getSnapshot()
3734
+ const byId = sessionCatalog && sessionCatalog.byId && typeof sessionCatalog.byId === 'object' ? sessionCatalog.byId : {}
3735
+ sessionCatalogIds = Object.keys(byId).sort()
3736
+ if (sessionCatalog.phase === 'error') {
3737
+ sessionCatalogMessage = '会话目录读取失败:' + String(sessionCatalog.error || '未知错误')
3738
+ } else if (sessionCatalog.phase !== 'ready') {
3739
+ sessionCatalogMessage = '正在读取会话目录…'
3740
+ } else if (sessionCatalogIds.length === 0) {
3741
+ sessionCatalogMessage = '会话目录为空,无法新建 watcher。'
3742
+ }
3743
+ }
3744
+ } catch (error) {
3745
+ sessionCatalog = null
3746
+ sessionCatalogMessage = '会话目录读取失败:' + String((error && error.message) || error)
3747
+ }
3748
+ }
3749
+ const createSessionReady = scope === 'session'
3750
+ ? Boolean(sessionId)
3751
+ : Boolean(sessionCatalog && sessionCatalog.phase === 'ready'
3752
+ && createSessionId && sessionCatalog.byId && sessionCatalog.byId[createSessionId])
2979
3753
  const [token, setToken] = useState('')
2980
3754
  const [goalDraft, setGoalDraft] = useState('')
2981
3755
  const [goalTouched, setGoalTouched] = useState(false)
@@ -3044,6 +3818,15 @@ window.__ModuleLoader__.load({
3044
3818
  const traceSeqRef = useRef(0)
3045
3819
  // 安装回执与版本检查分开:POST 失败不能冲掉当前版本和命令回退。
3046
3820
  const [updateResult, setUpdateResult] = useState(null)
3821
+ // 设置→来源里的页签名称草稿。只能在 hook 队列**末尾**追加:前面的下标是测试桩的
3822
+ // 位置化契约(deskQueue / 预览 deskHooks 必须同步追加一位)。
3823
+ const [tabNameDraft, setTabNameDraft] = useState(() => tabNameLabel())
3824
+ // 别处改了名字(另一个页面 / 晚到的 brandName)时同步草稿:**干净草稿**跟着新生效的名字走,
3825
+ // 用户正在编辑的**脏草稿**不动 —— 否则外部刚设的名字会被下一次「保存」用旧草稿覆盖回去(终审 M1)。
3826
+ // 只按「变化前的 label」判断脏净,不新增状态槽,也不碰 hook 队列位置。
3827
+ useEffect(() => subscribeTabName((next, previous) => {
3828
+ setTabNameDraft((current) => (normalizeTabName(current) === previous ? next : current))
3829
+ }), [])
3047
3830
  // POST 后 GET 仍以 runningVersion 比较 latest;已装到 latest 且等待重载时,回执优先于 hasUpdate。
3048
3831
  const updateAwaitingReload = Boolean(updateResult && updateResult.needsReload === true
3049
3832
  && update && updateResult.installedVersion === update.latest)
@@ -3052,6 +3835,26 @@ window.__ModuleLoader__.load({
3052
3835
  setSettingsSection(section)
3053
3836
  setTab('settings')
3054
3837
  }
3838
+ // 设置→来源:保存 / 恢复默认页签名称。保存后立刻重注册,当前 GUI 的页签当场就变;
3839
+ // 存不住(localStorage 被禁用)时只在本会话内有效 —— 必须如实说清,不能假装存住了。
3840
+ const saveTabNameDraft = () => {
3841
+ const result = saveTabName(tabNameDraft)
3842
+ setTabNameDraft(result.label)
3843
+ notify(result.persisted
3844
+ ? '页签名称已保存:' + result.label
3845
+ : '页签名称已改为「' + result.label + '」;浏览器本地存储不可用,刷新后会回到默认',
3846
+ result.persisted ? 'info' : 'error')
3847
+ }
3848
+ const resetTabNameDraft = () => {
3849
+ // 删不掉覆盖时不能报「已恢复默认」:本次会话内确实回到了默认,但刷新后旧名字会回来。
3850
+ const previous = tabNameLabel()
3851
+ const result = saveTabName('')
3852
+ setTabNameDraft(result.label)
3853
+ notify(result.persisted
3854
+ ? '页签名称已恢复默认:' + result.label
3855
+ : '页签名称已在本次会话内恢复默认:「' + result.label + '」;浏览器本地存储不可用(删除失败),刷新后可能又回到「' + previous + '」',
3856
+ result.persisted ? 'info' : 'error')
3857
+ }
3055
3858
  // 建议规则弹层:给"叫醒了没回音"一个下一步动作(只提供可复制的规则,不替客户写仓库文件)
3056
3859
 
3057
3860
  // 「我现在手上有没有能渲染的数据」。判断依据必须是**当前 snap**,不是"以前拿到过一次" ——
@@ -3069,9 +3872,12 @@ window.__ModuleLoader__.load({
3069
3872
  // 记下最新一次的 promise:被顶掉就等它,用最新快照回话;它真失败时仍然按失败返回。
3070
3873
  const latestLoadRef = useRef(null)
3071
3874
  const load = useCallback(() => {
3875
+ if (missingSession) return Promise.resolve(null)
3072
3876
  const seq = ++loadSeqRef.current
3073
3877
  const job = (async () => {
3074
- const statePath = sessionId ? '/state?sessionId=' + encodeURIComponent(String(sessionId)) : '/state'
3878
+ const statePath = scope === 'global'
3879
+ ? '/state?scope=global'
3880
+ : '/state?sessionId=' + encodeURIComponent(String(sessionId))
3075
3881
  const etag = readStateEtag(statePath)
3076
3882
  try {
3077
3883
  const payload = await call(statePath, etag ? { headers: { 'if-none-match': etag } } : undefined)
@@ -3107,10 +3913,24 @@ window.__ModuleLoader__.load({
3107
3913
  })()
3108
3914
  latestLoadRef.current = job
3109
3915
  return job
3110
- }, [sessionId])
3916
+ }, [sessionId, scope, missingSession])
3111
3917
 
3112
3918
  useEffect(() => { ensurePortedCss() }, [])
3113
- usePoll(load, POLL_MS)
3919
+ usePoll(load, POLL_MS, !missingSession)
3920
+ useEffect(() => {
3921
+ if (scope !== 'global' || !hostSessions || !hostSessions.list
3922
+ || typeof hostSessions.list.getSnapshot !== 'function' || typeof hostSessions.refresh !== 'function') return undefined
3923
+ let current
3924
+ try { current = hostSessions.list.getSnapshot() } catch { return undefined }
3925
+ if (current.phase === 'ready') return undefined
3926
+ let alive = true
3927
+ Promise.resolve().then(() => hostSessions.refresh())
3928
+ .then(() => { if (alive) load() })
3929
+ .catch((error) => {
3930
+ if (alive) setNotice({ ok: false, text: '会话目录读取失败:' + String((error && error.message) || error) })
3931
+ })
3932
+ return () => { alive = false }
3933
+ }, [scope, load])
3114
3934
 
3115
3935
  const body = snap.body || {}
3116
3936
  // 默认值提示从后端读:写死 12/3/6 会在常量变化后变成谎话(JSON Schema 的 default 也是这个用法)
@@ -3119,6 +3939,25 @@ window.__ModuleLoader__.load({
3119
3939
  const BRAND = (typeof body.brandName === 'string' && body.brandName.trim()) || '主理鱼'
3120
3940
  const ACK_DEFAULTS = body.defaultAckLabels || null
3121
3941
  const watchers = body.watchers || []
3942
+ const modular = body.modular && typeof body.modular === 'object' ? body.modular : null
3943
+ const hasExternalModularActions = Boolean(props.modularActions || typeof props.onModularAction === 'function')
3944
+ // 会话右栏的写操作显式携带 scope,全局动作不绑定某个当前会话。
3945
+ const scopedWriteSessionId = scope === 'session' ? sessionId : null
3946
+ const withWriteScope = (payload) => scopedWriteSessionId ? { ...payload, sessionId: scopedWriteSessionId } : payload
3947
+ const modularActions = {
3948
+ ...(modular && modular.actions === true && !hasExternalModularActions ? {
3949
+ resume: (ticketId) => run(() => call('/tickets', { method: 'POST', body: JSON.stringify(withWriteScope({ action: 'resume', ticketId })) }), '已提交恢复'),
3950
+ stop: (ticketId) => run(() => call('/tickets', { method: 'POST', body: JSON.stringify(withWriteScope({ action: 'stop', ticketId })) }), '已停止 Ticket'),
3951
+ flush: () => run(() => call('/outbox', { method: 'POST', body: JSON.stringify(withWriteScope({})) }), 'Outbox 已刷新'),
3952
+ ...(scope === 'global' ? {
3953
+ // executorPaused 是全局开关;会话右栏不展示这个必然跨 scope 的动作。
3954
+ pauseProcessing: (paused) => run(() => call('/tickets', { method: 'POST', body: JSON.stringify({ action: paused ? 'pause-processing' : 'resume-processing' }) }), paused ? '已暂停 worker' : '已恢复 worker'),
3955
+ } : {}),
3956
+ save: (body, context) => run(() => call('/draft', { method: 'POST', body: JSON.stringify(withWriteScope({ ...context, body })) }), '草稿已保存'),
3957
+ clear: (context) => run(() => call('/draft', { method: 'POST', body: JSON.stringify(withWriteScope({ ...context, clear: true })) }), '草稿已清空'),
3958
+ } : {}),
3959
+ ...(props.modularActions || {}),
3960
+ }
3122
3961
  // 行内编辑只有这一条入口:clean 维持原直达行为;dirty 先确认,取消绝不重置 draft/touched。
3123
3962
  const applyWatcherEditor = (watcher, nextKey) => {
3124
3963
  const values = watcherValuesFrom(watcher, ACK_DEFAULTS)
@@ -3126,6 +3965,12 @@ window.__ModuleLoader__.load({
3126
3965
  touchedRef.current = new Set()
3127
3966
  editSnapshotRef.current = nextKey ? { key: nextKey, values } : null
3128
3967
  setDraft({
3968
+ // PR 响应监控的四项必须一起进 draft:watcherDirty 只比较 snapshot 里有的键,
3969
+ // 少一个键就等于「切了类型不算修改」,SaveBar 永远不出现。
3970
+ watchKind: values.watchKind,
3971
+ audit: values.audit,
3972
+ adversarialAudit: values.adversarialAudit,
3973
+ auditMode: values.auditMode,
3129
3974
  intervalSec: watcherNumberText(watcher.intervalSec ?? 60),
3130
3975
  labels: (watcher.filters && watcher.filters.labels ? watcher.filters.labels : []).join(','),
3131
3976
  ignoreLabels: (watcher.filters && watcher.filters.ignoreLabels ? watcher.filters.ignoreLabels : []).join(','),
@@ -3135,6 +3980,7 @@ window.__ModuleLoader__.load({
3135
3980
  goal: watcher.note || (typeof watcher.goal === 'string' ? watcher.goal : (watcher.goal && watcher.goal.objective) || ''),
3136
3981
  ackLabel: watcher.ackLabel || ackLabelFallback(watcher, ACK_DEFAULTS),
3137
3982
  onlyAssigned: !!(watcher.filters && watcher.filters.onlyAssigned),
3983
+ onlyNewComments: !!(watcher.filters && watcher.filters.onlyNewComments),
3138
3984
  allowAuthors: (watcher.filters && watcher.filters.allowAuthors ? watcher.filters.allowAuthors : []).join(', '),
3139
3985
  observe: !!watcher.observe,
3140
3986
  isolated: !!watcher.isolated,
@@ -3151,7 +3997,11 @@ window.__ModuleLoader__.load({
3151
3997
  priorityStale: Boolean(watcher.priority && watcher.priority.stale) === true,
3152
3998
  })
3153
3999
  }
3154
- const editingWatcher = watchers.find((watcher) => watcher.repo + '#' + watcher.sessionId === editing)
4000
+ // 同仓库同会话的 issue 守与 PR 守 repo#sessionId 一模一样:编辑目标必须带上 kind 前缀,
4001
+ // 否则点 PR 行会展开 issue 的表单(2026-11-13 review 实测 prClickEditingCalls=[{next:"o/r#s"}]、
4002
+ // prEditForms:0 / issueEditForms:1)。与渲染时的行 key 保持同一套算法。
4003
+ const watcherKeyOf = (watcher) => (watcher.kind === 'pr' ? 'pr:' : '') + (watcher.repo || '') + '#' + (watcher.sessionId || '')
4004
+ const editingWatcher = watchers.find((watcher) => watcherKeyOf(watcher) === editing)
3155
4005
  const editingOpening = editSnapshotRef.current && editSnapshotRef.current.key === editing
3156
4006
  ? editSnapshotRef.current.values
3157
4007
  : editingWatcher ? watcherValuesFrom(editingWatcher, ACK_DEFAULTS) : null
@@ -3162,7 +4012,7 @@ window.__ModuleLoader__.load({
3162
4012
  // dirty 折叠在确认期间挂起 editing id,但原表单仍挂载;取消/确认之前绝不清它的 draft。
3163
4013
  const displayedEditing = editing || pendingCollapseKey
3164
4014
  const toggleWatcherEditor = (watcher) => {
3165
- const key = watcher.repo + '#' + watcher.sessionId
4015
+ const key = watcherKeyOf(watcher)
3166
4016
  const nextKey = editing === key ? null : key
3167
4017
  if (editing && editingDirty) {
3168
4018
  watcherDraftConfirmedRef.current = false
@@ -3232,14 +4082,26 @@ window.__ModuleLoader__.load({
3232
4082
  // 只发 touched 字段;repo/sessionId 只是现有 /watch 的定位键,不是全量快照。
3233
4083
  body: JSON.stringify((() => {
3234
4084
  const full = {
3235
- repo: watcher.repo,
4085
+ // /state 里的 repo 是**规范化后**的 `owner/name`(provider 单独一个字段)——
4086
+ // 提交前必须把 `gitee:` 前缀补回去。否则服务端 parseRepoSpec 会把它判成 GitHub:
4087
+ // id 从 `gitee:owner/name#s` 变成 `owner/name#s`,匹配不到已有守 ⇒ **静默新建一条
4088
+ // github 孪生守**(每轮 gh 404),而原来那条的间隔/过滤分毫不动
4089
+ //(0.10.12 真机踩到:Gitee 仓库改 600 秒保存后仍是 180 秒,面板里还多出一条 404 的孪生)。
4090
+ repo: (watcher.provider === 'gitee' ? 'gitee:' : '') + String(watcher.repo || ''),
3236
4091
  sessionId: watcher.sessionId,
4092
+ // 类型决定服务端 id 前缀(`pr:`)。编辑时 `watchKind` 控件不渲染(modes: ['create']),
4093
+ // 所以这里的值只用来让服务端认对 id,不是「用户改类型」的入口。
4094
+ watchKind: watcher.kind === 'pr' ? 'pr' : 'issue',
4095
+ audit: !!draft.audit,
4096
+ adversarialAudit: !!draft.adversarialAudit,
4097
+ auditMode: draft.auditMode === 'inline' ? 'inline' : 'subagent',
3237
4098
  intervalSec: numberOrUndefined(draft.intervalSec) ?? watcher.intervalSec,
3238
4099
  filters: {
3239
4100
  labels: String(draft.labels ?? '').split(',').map((v) => v.trim()).filter(Boolean),
3240
4101
  // filters 整块发送,三个名单都必须带上,否则改标签会顺带清空另外两项。
3241
4102
  ignoreLabels: String(draft.ignoreLabels ?? '').split(',').map((v) => v.trim()).filter(Boolean),
3242
4103
  onlyAssigned: !!draft.onlyAssigned,
4104
+ onlyNewComments: !!draft.onlyNewComments,
3243
4105
  assignee: String(draft.assignee ?? '').trim().replace(/^@/, '') || null,
3244
4106
  allowAuthors: String(draft.allowAuthors ?? '').split(',').map((v) => v.trim().replace(/^@/, '')).filter(Boolean),
3245
4107
  },
@@ -3267,6 +4129,7 @@ window.__ModuleLoader__.load({
3267
4129
  labels: "filters",
3268
4130
  ignoreLabels: "filters",
3269
4131
  onlyAssigned: "filters",
4132
+ onlyNewComments: "filters",
3270
4133
  assignee: "filters",
3271
4134
  allowAuthors: "filters",
3272
4135
  priorityReopened: "priority",
@@ -3280,6 +4143,9 @@ window.__ModuleLoader__.load({
3280
4143
  wanted.add(CONTROL_TO_FIELD[key] || key)
3281
4144
  }
3282
4145
  const out = { repo: full.repo, sessionId: full.sessionId }
4146
+ // 类型必须无条件带上:编辑时 `watchKind` 控件不渲染,touchedRef 里永远没有它,
4147
+ // 只发 touched 字段就会让服务端按「issue」算 id —— 改一条 PR 守会静默新建一条 issue 守。
4148
+ out.watchKind = full.watchKind
3283
4149
  for (const key of wanted) {
3284
4150
  if (Object.prototype.hasOwnProperty.call(full, key)) out[key] = full[key]
3285
4151
  }
@@ -3292,7 +4158,7 @@ window.__ModuleLoader__.load({
3292
4158
  }, '已保存:' + watcher.repo, { rethrow: true })
3293
4159
 
3294
4160
  const act = (watcher, action) => run(async () => {
3295
- await call('/watch', { method: 'POST', body: JSON.stringify({ action, id: watcherId(watcher) }) })
4161
+ await call('/watch', { method: 'POST', body: JSON.stringify(withWriteScope({ action, id: watcherId(watcher) })) })
3296
4162
  }, action === 'delete' ? '已删除 ' + watcher.repo
3297
4163
  : action === 'poll' ? '已触发一次轮询:' + watcher.repo
3298
4164
  // 审核 T24 W6:暂停/恢复成功以前什么都不说,客户不确定点没点上。
@@ -3306,25 +4172,35 @@ window.__ModuleLoader__.load({
3306
4172
  for (const watcher of list) {
3307
4173
  if (action === 'pause' && !watcher.enabled) continue
3308
4174
  if (action === 'resume' && watcher.enabled) continue
3309
- await call('/watch', { method: 'POST', body: JSON.stringify({ action, id: watcherId(watcher) }) })
4175
+ await call('/watch', { method: 'POST', body: JSON.stringify(withWriteScope({ action, id: watcherId(watcher) })) })
3310
4176
  }
3311
4177
  }, action === 'pause' ? '全部已暂停' : '全部已恢复')
3312
4178
 
3313
4179
  const addWatcher = () => run(async () => {
4180
+ if (!createSessionReady) throw new Error('目标会话不可用:' + (sessionCatalogMessage || '请选择目标会话'))
3314
4181
  const value = { ...CREATE_WATCHER_VALUES, ...form }
3315
4182
  const created = await call('/watch', {
3316
4183
  method: 'POST',
3317
4184
  body: JSON.stringify((() => {
3318
4185
  const valueDirty = (key) => createTouchedRef.current.has(key) || !watcherSameValue(value[key], createSnapshotRef.current[key])
3319
- const payload = { repo: value.repo.trim(), sessionId }
4186
+ const payload = { repo: value.repo.trim(), sessionId: createSessionId }
4187
+ // 监控类型永远提交:它决定服务端 id 前缀(`pr:`),漏了就当 issue 建。
4188
+ payload.watchKind = value.watchKind === 'pr' ? 'pr' : 'issue'
4189
+ if (payload.watchKind === 'pr') {
4190
+ // 审计三项只在 PR 类型下有意义;没碰过的项交给服务端保默认,别用假值覆盖。
4191
+ if (valueDirty('audit')) payload.audit = !!value.audit
4192
+ if (valueDirty('adversarialAudit')) payload.adversarialAudit = !!value.adversarialAudit
4193
+ if (valueDirty('auditMode')) payload.auditMode = value.auditMode === 'inline' ? 'inline' : 'subagent'
4194
+ }
3320
4195
  // 新建也必须只提交实际输入过的配置;服务端负责未提供项的默认值。
3321
4196
  if (valueDirty('intervalSec')) payload.intervalSec = numberOrUndefined(value.intervalSec) ?? 60
3322
4197
  if (valueDirty('goal')) payload.goal = value.goal || ''
3323
- if (['labels', 'ignoreLabels', 'onlyAssigned', 'assignee', 'allowAuthors'].some(valueDirty)) {
4198
+ if (['labels', 'ignoreLabels', 'onlyAssigned', 'onlyNewComments', 'assignee', 'allowAuthors'].some(valueDirty)) {
3324
4199
  payload.filters = {
3325
4200
  labels: String(value.labels ?? '').split(',').map((v) => v.trim()).filter(Boolean),
3326
4201
  ignoreLabels: String(value.ignoreLabels ?? '').split(',').map((v) => v.trim()).filter(Boolean),
3327
4202
  onlyAssigned: !!value.onlyAssigned,
4203
+ onlyNewComments: !!value.onlyNewComments,
3328
4204
  assignee: String(value.assignee ?? '').trim().replace(/^@/, '') || null,
3329
4205
  allowAuthors: String(value.allowAuthors ?? '').split(',').map((v) => v.trim().replace(/^@/, '')).filter(Boolean),
3330
4206
  }
@@ -3350,7 +4226,7 @@ window.__ModuleLoader__.load({
3350
4226
  })()),
3351
4227
  })
3352
4228
  // 只重置既定仓库相关字段;限额、隔离策略和时段保留,连续添加不用重填。
3353
- const nextForm = { ...form, repo: '', goal: '', labels: '', onlyAssigned: false, allowAuthors: '' }
4229
+ const nextForm = { ...form, repo: '', goal: '', labels: '', onlyAssigned: false, onlyNewComments: false, allowAuthors: '' }
3354
4230
  setForm(nextForm)
3355
4231
  // 这些保留下来的值已经由本次 /watch 保存,成为下一次新增的全新基线。
3356
4232
  createSnapshotRef.current = { ...CREATE_WATCHER_VALUES, ...nextForm }
@@ -3452,7 +4328,11 @@ window.__ModuleLoader__.load({
3452
4328
  // 标题本身是按钮 —— 官方就是点标题进详情,我们点标题展开行内编辑,交互更轻但不脱离这套结构。
3453
4329
  const STAGE_STATE = { active: undefined, paused: 'warning', error: 'error', dormant: 'warning' }
3454
4330
  const row = (watcher) => {
3455
- const key = watcher.repo + '#' + watcher.sessionId
4331
+ // key 必须带 kind:同一个仓库同一个会话完全可以同时开一条 issue 守和一条 PR 守,
4332
+ // 而它们的 `repo#sessionId` 一模一样 —— 只按 repo#session 生成的 key 会撞,
4333
+ // React 会把两行当成同一条(重复 key),编辑态也会一起展开、改一个两个都动。
4334
+ // 服务端的 id 前缀(`pr:`)本来就是为这个存在的,这里跟它对齐。
4335
+ const key = (watcher.kind === 'pr' ? 'pr:' : '') + watcher.repo + '#' + watcher.sessionId
3456
4336
  const state = orbitStateOf(watcher)
3457
4337
  const rowBody = h('div', { className: 'dt-ticket-body' },
3458
4338
  h('div', { className: 'dt-row-title' },
@@ -3475,7 +4355,10 @@ window.__ModuleLoader__.load({
3475
4355
  // ack 标签决定这条是否还会被叫醒,不能只在工具参数里出现。
3476
4356
  h(Tag, { tone: 'quiet' }, '回执 ' + (watcher.ackLabel || ackLabelFallback(watcher, ACK_DEFAULTS))),
3477
4357
  watcher.queuedWakes > 0 ? h(Tag, { tone: 'warning' }, '排队 ' + watcher.queuedWakes) : null,
3478
- backoffText(watcher) ? h(Tag, { tone: 'warning' }, backoffText(watcher)) : null),
4358
+ backoffText(watcher) ? h(Tag, { tone: 'warning' }, backoffText(watcher)) : null,
4359
+ (watcher.poll && POLL_STALE_TEXT[watcher.poll])
4360
+ ? h(Tag, { tone: 'warning' }, POLL_STALE_TEXT[watcher.poll])
4361
+ : null),
3479
4362
  // 三行,各管一件事:① 是谁 ② 节律与最近结果 ③ 目标
3480
4363
  // 原来六段用 ' · ' 串成一行(会话 · 每 60s · 轮询 · 唤醒 · 上次唤醒 · 目标),
3481
4364
  // 出图时那行在浅色主题下折成两行、读起来像一堵墙。
@@ -3646,6 +4529,7 @@ window.__ModuleLoader__.load({
3646
4529
  const matchesBadge = (watcher) => !badgeFilter
3647
4530
  || repoBadges(watcher.repoAccess).some((badge) => badge.text === badgeFilter)
3648
4531
  const hasProblem = (watcher) => Boolean(watcher.lastError)
4532
+ || Boolean(watcher.poll && POLL_STALE_TEXT[watcher.poll])
3649
4533
  || Boolean(watcher.lastReopened)
3650
4534
  || Number(watcher.silentWakes) >= 2
3651
4535
  || Boolean(repoStructureNote(watcher.repoAccess))
@@ -3777,13 +4661,12 @@ window.__ModuleLoader__.load({
3777
4661
  item.text,
3778
4662
  item.action ? h(Btn, { variant: 'link', size: 'sm', 'aria-label': item.action.label, onClick: item.action.onClick }, item.action.label) : null))))
3779
4663
  : null,
3780
- // 中间态:已经有守、但一次都没唤醒过 —— 这不是"没配置",是"在等"
4664
+ // 中间态:已经有守、但一次都没唤醒过 —— 这不是"没配置",是"在等"。
4665
+ // 只留一句。叫醒之后按什么规则处理(AGENTS.md → 修/回/待定 → watch_ack)
4666
+ // 移进「判定」页的问号提示:主面板常驻四行灰字会把右栏挤成一团。
3781
4667
  (watchers.length > 0 && watchers.every((w) => !w.lastWake))
3782
4668
  ? h('div', { className: 'sa-dock-foot', key: 'waiting' },
3783
- '还没有唤醒过:守会在仓库出现新条目时叫醒这个会话。'
3784
- + '想先试一次,点行里的「立刻」;如果一直没动静,看上面「需要关注」里有没有被过滤的记录。'
3785
- + '叫醒之后:会话先读仓库 AGENTS.md → 决定「修 / 回 / 待定」→ 做完写回并 watch_ack 打标签;'
3786
- + '不做也要说明理由并 ack。每次只处理叫醒消息里列出的那几条,不会扩大范围。')
4669
+ '还没有唤醒过:仓库有新条目就叫醒本会话,点「立刻」可以先试一次。')
3787
4670
  : null,
3788
4671
  // 需要重启:这是"功能看起来没生效"最常见的根因,必须显眼
3789
4672
  (body.installedVersion && body.runningVersion && body.installedVersion !== body.runningVersion)
@@ -3824,6 +4707,8 @@ window.__ModuleLoader__.load({
3824
4707
  count: watchers.reduce((n, w) => n + (w.history || []).length, 0),
3825
4708
  action: h(InfoTip, { text: '每轮判定都会记一条:唤醒、仅观察,或跳过及其原因。只存最近若干条。' }),
3826
4709
  },
4710
+ // 规则说明放这里而不是主面板:主面板只留一句,避免右栏被灰字堆满。
4711
+ h(Hint, { key: 'rules' }, '叫醒后按 AGENTS.md → 修 / 回 / 待定 → 做完写回并 watch_ack;只处理列出的几条,不会扩大范围。'),
3827
4712
  (() => {
3828
4713
  const needle = search.trim()
3829
4714
  // 审核 T40 M3:以前只认纯数字 —— Gitee 的编号是 IKSQJH 这种字符串,
@@ -4044,8 +4929,27 @@ window.__ModuleLoader__.load({
4044
4929
  const trigger = h(Section, { title: '新增' + BRAND },
4045
4930
  h(WatcherForm, {
4046
4931
  mode: 'create', idPrefix: 'watcher-new', value: { ...CREATE_WATCHER_VALUES, ...form },
4047
- snapshot: createSnapshotRef.current, defaults: DEFAULTS, disabled: !sessionId, sessionId,
4048
- submitLabel: sessionId ? '添加到当前会话' : '先打开一个会话',
4932
+ snapshot: createSnapshotRef.current, defaults: DEFAULTS, disabled: !createSessionReady, sessionId: createSessionId,
4933
+ submitLabel: scope === 'global'
4934
+ ? (createSessionReady ? '添加到所选会话' : '选择目标会话')
4935
+ : (sessionId ? '添加到当前会话' : '先打开一个会话'),
4936
+ targetControl: scope === 'global' ? (busy) => h(Field, { id: 'watcher-new-session', label: '目标会话' },
4937
+ h(React.Fragment, null,
4938
+ h('select', {
4939
+ id: 'watcher-new-session', className: 'dt-select', 'aria-label': '目标会话',
4940
+ value: createSessionId,
4941
+ disabled: busy || !sessionCatalog || sessionCatalog.phase !== 'ready' || sessionCatalogIds.length === 0,
4942
+ onChange: (event) => setCreateField('createSessionId', event.target.value),
4943
+ },
4944
+ h('option', { value: '' }, '选择目标会话'),
4945
+ sessionCatalogIds.map((id) => {
4946
+ const item = sessionCatalog.byId[id]
4947
+ const title = item && (item.title || item.name)
4948
+ return h('option', { key: id, value: id }, title ? String(title) + ' · ' + id : id)
4949
+ })),
4950
+ sessionCatalogMessage
4951
+ ? h('p', { className: sessionCatalog && sessionCatalog.phase === 'error' ? 'dt-error' : 'dt-hint', role: sessionCatalog && sessionCatalog.phase === 'error' ? 'alert' : undefined }, sessionCatalogMessage)
4952
+ : h('p', { className: 'dt-hint' }, '只用于新建 watcher;不改变全局读取或批量动作范围。'))) : null,
4049
4953
  onChange: setCreateField,
4050
4954
  onSave: addWatcher,
4051
4955
  onDiscard: () => {
@@ -4066,6 +4970,9 @@ window.__ModuleLoader__.load({
4066
4970
  // 没有就交给服务端按默认目录来,面板把服务端回的路径原样显示出来。
4067
4971
  const gateRepo = (watchers.find((item) => typeof item.workdir === 'string' && item.workdir.trim()) || {}).workdir || ''
4068
4972
 
4973
+ // 页签名称的草稿状态:脏 = 「保存后文案会变」(空值 = 恢复默认,也算一种改动)。
4974
+ const tabNameDirty = normalizeTabName(tabNameDraft) !== tabNameLabel()
4975
+ const tabNameOverridden = tabNameOverride !== null
4069
4976
  const settingsSections = [
4070
4977
  h(Section, { key: 'source', title: '来源' },
4071
4978
  h(KeyValues, { rows: [
@@ -4098,7 +5005,23 @@ window.__ModuleLoader__.load({
4098
5005
  const each = roots.map((r) => r.count + ' 个隔离根 · ' + bytesText(r.bytes)).join(';')
4099
5006
  return roots.length > 1 ? each + '(合计 ' + bytesText(body.isolation.totalBytes) + ')' : each
4100
5007
  })()],
4101
- ] })),
5008
+ ] }),
5009
+ // 页签名称:只改会话头第二个 row(对话 / 轨迹 / …)上的这一个页签,
5010
+ // 不动面板标题、唤醒抬头、插件包名和 ack 标签。
5011
+ field('页签名称',
5012
+ h(Input, {
5013
+ value: tabNameDraft,
5014
+ 'aria-label': '页签名称',
5015
+ placeholder: BRAND,
5016
+ onChange: (e) => setTabNameDraft(clampTabNameDraft(e.target.value)),
5017
+ }),
5018
+ '只改这个页签:会话标题、插件包名和 ack 标签都不动'),
5019
+ h(Hint, null, '默认跟随品牌名「' + BRAND + '」;留空 = 恢复默认。最多 ' + TAB_NAME_MAX
5020
+ + ' 个字符。存在这台机器的浏览器本地(同一浏览器的所有会话共用),不同步到服务端或其他设备。'),
5021
+ h('div', { className: 'dt-actions' },
5022
+ h(Btn, { variant: 'primary', size: 'sm', onClick: saveTabNameDraft, disabled: !tabNameDirty }, '保存名称'),
5023
+ h(Btn, { variant: 'ghost', size: 'sm', onClick: resetTabNameDraft, disabled: !tabNameOverridden }, '恢复默认')),
5024
+ ),
4102
5025
  h(Section, { key: 'creds', title: '凭证' },
4103
5026
  h(KeyValues, { rows: [['GitHub token', credentials.token === 'none' ? '未配置(回退到已登录的 gh CLI)' : '已配置'], ['SSH 私钥', credentials.sshKeyPath === 'none' ? '未配置(当前版本不使用)' : '已配置'],
4104
5027
  ['gh 账号', credentials.ghConfigDir === 'configured' ? '已绑定独立配置目录(评论挂智能体账号)' : '宿主当前登录的账号'],
@@ -4330,7 +5253,7 @@ window.__ModuleLoader__.load({
4330
5253
  if (watcher.enabled !== false) group.enabled += 1
4331
5254
  if (watcher.lastWake && (!group.lastWake || String(watcher.lastWake) > String(group.lastWake))) group.lastWake = watcher.lastWake
4332
5255
  group.silentWakes = Math.max(group.silentWakes, Number(watcher.silentWakes) || 0)
4333
- if (watcher.lastError) group.errors += 1
5256
+ if (watcher.lastError || (watcher.poll && POLL_STALE_TEXT[watcher.poll])) group.errors += 1
4334
5257
  for (const badge of repoBadges(watcher.repoAccess) || []) {
4335
5258
  if (!group.badges.some((b) => b.text === badge.text)) group.badges.push(badge)
4336
5259
  }
@@ -4403,13 +5326,23 @@ window.__ModuleLoader__.load({
4403
5326
  return h(Field, { key: label, label, hint, note }, control)
4404
5327
  }
4405
5328
 
5329
+ if (missingSession) {
5330
+ return h('div', { className: 'dt-page' }, h('div', { className: 'dt-column' },
5331
+ h('div', { className: 'dt-card dt-error-card' },
5332
+ h('div', { className: 'dt-card-head' }, h('span', { className: 'dt-card-title' }, '无法打开会话工作台')),
5333
+ h('p', { className: 'dt-error', role: 'alert' }, '右栏 slot 没有提供当前 sessionId;未读取全局数据,也未发出任何会话写操作。'),
5334
+ h(Hint, null, '请从已打开会话的头部入口或 Dock 进入;宿主必须提供真实 sessionId。'))))
5335
+ }
5336
+
4406
5337
  return h('div', { className: 'dt-page' },
4407
5338
  h('div', { className: 'dt-page-head' },
4408
5339
  h('div', null,
4409
5340
  h('h1', { className: 'dt-page-title' }, BRAND),
4410
5341
  h('span', { className: 'dt-hint' },
4411
- (body.sessionTitle ? '会话:' + body.sessionTitle + ' · ' : '')
4412
- + (sessionId ? '盯办 + 主动办:仓库有动静就叫醒本会话' : '(在会话里打开本面板,才能把仓库绑到会话上)'))),
5342
+ scope === 'global'
5343
+ ? '全局中枢 · 全部项目会话的 watcher、Ticket、执行、Outbox 与健康'
5344
+ : (body.sessionTitle ? '会话:' + body.sessionTitle + ' · ' : '')
5345
+ + (sessionId ? '盯办 + 主动办:仓库有动静就叫醒本会话' : '(在会话里打开本面板,才能把仓库绑到会话上)'))),
4413
5346
  h('div', { className: 'dt-toolbar' },
4414
5347
  h(Input, { value: search, placeholder: '搜索仓库 / 编号 / 标题', onChange: (e) => setSearch(e.target.value), 'aria-label': '搜索' }),
4415
5348
  h(Btn, { size: 'sm', variant: 'ghost', icon: h(Icon, { name: 'question' }), onClick: () => setGlossary(true) }, '术语'),
@@ -4442,6 +5375,7 @@ window.__ModuleLoader__.load({
4442
5375
  { value: 'judge', label: '判定', id: 'sa-main-tab-judge', panelId: 'sa-main-panel-judge' },
4443
5376
  { value: 'trigger', label: '触发', id: 'sa-main-tab-trigger', panelId: 'sa-main-panel-trigger' },
4444
5377
  { value: 'settings', label: '设置', id: 'sa-main-tab-settings', panelId: 'sa-main-panel-settings' },
5378
+ ...(modular ? [{ value: 'modular', label: modularCopy(modular.locale).tab, id: 'sa-main-tab-modular', panelId: 'sa-main-panel-modular' }] : []),
4445
5379
  ],
4446
5380
  value: tab, onChange: setTab, label: '主理鱼分区',
4447
5381
  }),
@@ -4472,6 +5406,12 @@ window.__ModuleLoader__.load({
4472
5406
  snap.body && tab === 'settings' ? h('div', {
4473
5407
  id: 'sa-main-panel-settings', role: 'tabpanel', 'aria-labelledby': 'sa-main-tab-settings', className: 'dt-tabpanel',
4474
5408
  }, settings) : null,
5409
+ snap.body && tab === 'modular' && modular ? h('div', {
5410
+ id: 'sa-main-panel-modular', role: 'tabpanel', 'aria-labelledby': 'sa-main-tab-modular', className: 'dt-tabpanel',
5411
+ }, h(ModularView, {
5412
+ data: modular, actions: modularActions, onAction: props.onModularAction,
5413
+ onOpenSession: (props.onOpenSession || hostOpenSession) ? (id) => run(() => (props.onOpenSession || hostOpenSession)(id), '已打开 Session') : null,
5414
+ })) : null,
4475
5415
  glossary && glossary.type === 'watcher-draft' ? h(ConfirmDialog, {
4476
5416
  open: true,
4477
5417
  label: '放弃未保存的修改',
@@ -4508,7 +5448,7 @@ window.__ModuleLoader__.load({
4508
5448
  ['办', '唤醒会话后按仓库 AGENTS.md 主动处理,完成后 watch_ack 打标签'],
4509
5449
  ['唤醒', '只在会话空闲(idle)时注入一条【' + BRAND + '】消息'],
4510
5450
  ['过滤', '标签白名单/黑名单、只看已指派、跳过机器人/草稿/已关闭'],
4511
- ['时段', 'activeHours,比如 09:00-23:00,时段外只攒不唤醒'],
5451
+ ['时段', 'activeHours,比如 09:00-12:00,14:00-23:00;多段任一命中,时段外只攒不唤醒'],
4512
5452
  ['隔离', 'isolated:每次唤醒开一次性 git worktree,改副本不碰主工作区'],
4513
5453
  ['ack', '处理完给条目打「' + (ACK_DEFAULTS && ACK_DEFAULTS.github ? ACK_DEFAULTS.github : '主理鱼:已处理') + '」标签,轮询直接跳过'],
4514
5454
  ['goal', '会话目标(ctx.goals),和 /goal 命令同一份状态'],
@@ -4523,33 +5463,279 @@ window.__ModuleLoader__.load({
4523
5463
  }
4524
5464
 
4525
5465
 
5466
+ function SuperagentGlobalPage(props = {}) {
5467
+ return h(SuperagentPage, { ...props, scope: 'global' })
5468
+ }
5469
+
5470
+ function SuperagentSessionPage(props = {}) {
5471
+ // sessionId 只从右栏 session slot 读取,不从 URL、watcher 或全局状态猜测。
5472
+ return h(SuperagentPage, { ...props, scope: 'session' })
5473
+ }
5474
+
5475
+ function SuperagentNavIcon() {
5476
+ // 品牌用官方 DeepSeek 鲸鱼线稿;轨道环只留在面板内部表达每条守的状态,不再当入口图标。
5477
+ return h(DeepSeekWhaleMark, { size: 16 })
5478
+ }
5479
+
5480
+ function SuperagentHeaderUtility(props = {}) {
5481
+ const [error, setError] = useState(null)
5482
+ const [pressed, setPressed] = useState(() => Boolean(visibleSessionRightTab(props.sessionId)))
5483
+ useEffect(() => {
5484
+ if (!canToggleSessionRightTab()) return undefined
5485
+ const update = () => setPressed(Boolean(visibleSessionRightTab(props.sessionId)))
5486
+ const unsubscribe = hostSidebarRight.view.subscribe(update)
5487
+ update()
5488
+ return typeof unsubscribe === 'function' ? unsubscribe : undefined
5489
+ }, [props.sessionId])
5490
+ const unavailable = !props.sessionId
5491
+ ? '当前头部 slot 没有 sessionId'
5492
+ : !hostSidebarRight || typeof hostSidebarRight.openTab !== 'function'
5493
+ ? RIGHT_TAB_UNAVAILABLE
5494
+ : !hostSidebarRightTabs || typeof hostSidebarRightTabs.register !== 'function'
5495
+ ? RIGHT_TAB_DEFINITION_UNAVAILABLE
5496
+ : null
5497
+ const toggle = async () => {
5498
+ if (unavailable) return
5499
+ try {
5500
+ const tab = pressed ? visibleSessionRightTab(props.sessionId) : null
5501
+ if (tab) await hostSidebarRight.hide(tab.id)
5502
+ else await openSessionSuperagentTab()
5503
+ setError(null)
5504
+ } catch (failure) {
5505
+ setError(String((failure && failure.message) || failure))
5506
+ }
5507
+ }
5508
+ const label = '本会话的主理鱼'
5509
+ const tip = unavailable || label
5510
+ // 官方 Forge 头部入口不传 variant:默认 ghost 就是无底色,只有按下态才给
5511
+ // interactive-bg-active。之前传 toolbar,命中安装版 Button 的填充 variant,
5512
+ // 于是真机上多出一块深色圆角底 —— 这就是"不像原生"的来源。
5513
+ // DSH Tooltip 要把 ref 合并到真实 trigger;本地 Btn 是普通函数,不能接住 ref。
5514
+ // 两个能力同时存在时直接用官方 forwardRef Button,缺任一项就显式回退 title。
5515
+ const useHostTooltip = Boolean(hostTooltipPrimitive && hostButton)
5516
+ const shared = {
5517
+ 'aria-label': label, 'aria-pressed': pressed,
5518
+ title: useHostTooltip ? undefined : tip,
5519
+ disabled: Boolean(unavailable), onClick: toggle,
5520
+ }
5521
+ const button = hostButton
5522
+ ? h(hostButton, { type: 'button', variant: 'ghost', size: 'sm', icon: h(SuperagentNavIcon), className: 'dt-header-entry dt-header-entry-host', ...shared })
5523
+ : h('button', { type: 'button', className: 'dt-header-entry', ...shared }, h(SuperagentNavIcon))
5524
+ return h(React.Fragment, null,
5525
+ useHostTooltip ? h(hostTooltipPrimitive, { label: tip, side: 'bottom', openOnClick: true }, button) : button,
5526
+ error ? h('span', { className: 'dt-error', role: 'alert' }, '切换右栏失败:' + error) : null)
5527
+ }
5528
+
5529
+ function SuperagentRightTabTitle() {
5530
+ return h(React.Fragment, null, h(SuperagentNavIcon), h('span', null, tabNameLabel()))
5531
+ }
5532
+
5533
+ let hostOpenSession = null
4526
5534
  return {
4527
5535
  inject: ['slots'],
4528
5536
  apply(ctx) {
5537
+ hostLayout = optionalHostService(ctx, 'layout')
5538
+ hostSidebarRight = optionalHostService(ctx, 'sidebarRight')
5539
+ hostSidebarRightTabs = optionalHostService(ctx, 'sidebarRightTabs')
5540
+ hostSessions = optionalHostService(ctx, 'sessions')
4529
5541
  try { noteOnce('client-version', CLIENT_VERSION) } catch {}
4530
5542
  try { note('apply', 'start') } catch {}
4531
5543
  // 样式表在这里注入一次就够了:任何槽位(面板 / 圆环 / 将来的入口)都用得上。
4532
5544
  // 之前只在面板组件挂载时注入,没打开过面板就直接点圆环 → 弹层没有样式(0.9.159 才补上那次调用)。
4533
5545
  try { ensurePortedCss() } catch {}
4534
5546
 
4535
- // ① the 主理鱼 tab in the centre-column view ring
4536
- ctx.effect(() => {
5547
+ // 品牌名同时驱动左栏、右栏 definition 与右栏标题。旧中栏删除后,
5548
+ // 改名订阅仍保留在这些存活入口上:先释放原注册,再按同 id/key/component 重注册。
5549
+ tabNameOverride = readTabNameOverride()
5550
+ const mountBrandEntry = (mount, failureKey) => {
5551
+ let dispose = null
5552
+ const unmount = () => {
5553
+ if (!dispose) return
5554
+ const current = dispose
5555
+ dispose = null
5556
+ try { current() } catch {}
5557
+ }
5558
+ const remount = () => {
5559
+ unmount()
5560
+ dispose = mount()
5561
+ }
4537
5562
  try {
4538
- return ctx.slots.inject('conversation.view', () => {
4539
- const dispose = ctx.slots.register({
4540
- name: 'conversation.view',
4541
- id: 'session-superagent-desk',
4542
- order: 30,
4543
- label: '主理鱼',
4544
- }, ZhuliPanel)
4545
- note('desk-registered', 'ok')
4546
- return dispose
5563
+ remount()
5564
+ const stopWatching = subscribeTabName(() => {
5565
+ try { remount() } catch (error) {
5566
+ note(failureKey, String((error && error.message) || error))
5567
+ }
4547
5568
  })
5569
+ const cleanup = () => { stopWatching(); unmount() }
5570
+ // 宿主服务可能比本插件晚就绪:记下 remount,服务到位后重挂一次,
5571
+ // 让入口用「服务已可用」的新状态渲染(否则真机会一直显示禁用)。
5572
+ cleanup.remount = remount
5573
+ return cleanup
5574
+ } catch (error) {
5575
+ note(failureKey, String((error && error.message) || error))
5576
+ unmount()
5577
+ return undefined
5578
+ }
5579
+ }
5580
+ const openSession = async (id) => {
5581
+ const sessions = typeof ctx.get === 'function' ? ctx.get('sessions') : ctx.sessions
5582
+ const uiWorkspace = typeof ctx.get === 'function' ? ctx.get('uiWorkspace') : ctx.uiWorkspace
5583
+ if (!sessions || !uiWorkspace || !sessions.list) throw new Error('Session navigation unavailable')
5584
+ if (sessions.list.getSnapshot().phase !== 'ready' || !sessions.list.getSnapshot().byId[id]) await sessions.refresh()
5585
+ const catalog = sessions.list.getSnapshot()
5586
+ if (catalog.phase !== 'ready') throw new Error('Session catalog is not ready')
5587
+ if (!catalog.byId[id]) throw new Error('Session is not listed: ' + id)
5588
+ uiWorkspace.openSession(id)
5589
+ }
5590
+ hostOpenSession = openSession
5591
+
5592
+ // 左侧全局中枢:main 与 sidebar.panellist 使用同一个 panel id。
5593
+ ctx.effect(() => {
5594
+ if (!hostLayout || typeof hostLayout.selectPanel !== 'function') {
5595
+ noteOnce('layout-unavailable', 'layout.selectPanel 服务不存在;不注册无法选择的全局入口')
5596
+ return undefined
5597
+ }
5598
+ try {
5599
+ return ctx.slots.inject('main', () => ctx.slots.register({
5600
+ name: 'main', key: GLOBAL_PANEL_ID,
5601
+ }, SuperagentGlobalPage))
4548
5602
  } catch (error) {
4549
- note('desk-fail', String((error && error.message) || error))
5603
+ note('global-panel-fail', String((error && error.message) || error))
4550
5604
  return undefined
4551
5605
  }
4552
5606
  })
5607
+ ctx.effect(() => {
5608
+ if (!hostLayout || typeof hostLayout.selectPanel !== 'function') return undefined
5609
+ return mountBrandEntry(() => ctx.slots.inject('sidebar.panellist', () => ctx.slots.register({
5610
+ name: 'sidebar.panellist', id: GLOBAL_PANEL_ID, order: 20,
5611
+ label: () => tabNameLabel(),
5612
+ }, SuperagentNavIcon)), 'global-sidebar-fail')
5613
+ })
5614
+
5615
+ // 右栏 page type:definition.id 用于 keyed body/title 分派,definition.kind 用于 openTab。
5616
+ ctx.effect(() => {
5617
+ if (!hostSidebarRightTabs || typeof hostSidebarRightTabs.register !== 'function') {
5618
+ noteOnce('sidebar-right-tabs-unavailable', 'sidebarRightTabs.register 服务不存在;会话头部入口显示不可用原因')
5619
+ return undefined
5620
+ }
5621
+ return mountBrandEntry(() => hostSidebarRightTabs.register({
5622
+ id: RIGHT_TAB_ID,
5623
+ kind: RIGHT_TAB_KIND,
5624
+ priority: 'builtin',
5625
+ title: () => tabNameLabel(),
5626
+ guide: [{
5627
+ id: 'session-superagent',
5628
+ order: 20,
5629
+ title: () => tabNameLabel(),
5630
+ description: () => '查看当前项目会话的 watcher、Ticket、执行、Outbox 与草稿',
5631
+ icon: SuperagentNavIcon,
5632
+ }],
5633
+ }), 'right-definition-fail')
5634
+ })
5635
+ ctx.effect(() => {
5636
+ if (!hostSidebarRightTabs || typeof hostSidebarRightTabs.register !== 'function') return undefined
5637
+ try {
5638
+ return ctx.slots.inject('sidebar.right.pane.tab', () => ctx.slots.register({
5639
+ name: 'sidebar.right.pane.tab', key: RIGHT_TAB_ID,
5640
+ }, SuperagentSessionPage))
5641
+ } catch (error) {
5642
+ note('right-tab-fail', String((error && error.message) || error))
5643
+ return undefined
5644
+ }
5645
+ })
5646
+ ctx.effect(() => {
5647
+ if (!hostSidebarRightTabs || typeof hostSidebarRightTabs.register !== 'function') return undefined
5648
+ return mountBrandEntry(() => ctx.slots.inject('sidebar.right.pane.tab.title', () => ctx.slots.register({
5649
+ name: 'sidebar.right.pane.tab.title', key: RIGHT_TAB_ID,
5650
+ }, SuperagentRightTabTitle)), 'right-title-fail')
5651
+ })
5652
+ let headerRemount = null
5653
+ let headerCleanup = null
5654
+ const mountHeaderEntry = () => {
5655
+ if (headerCleanup) return
5656
+ if (!hostLayout && !hostSidebarRight && !hostSidebarRightTabs) return
5657
+ try {
5658
+ const cleanup = mountBrandEntry(() => ctx.slots.inject('conversation.session.header.utilities', () => ctx.slots.register({
5659
+ name: 'conversation.session.header.utilities', id: HEADER_UTILITY_ID, order: -6,
5660
+ }, SuperagentHeaderUtility)), 'header-utility-fail')
5661
+ if (!cleanup) return
5662
+ headerCleanup = cleanup
5663
+ if (typeof cleanup.remount === 'function') headerRemount = cleanup.remount
5664
+ } catch (error) {
5665
+ note('header-utility-fail', String((error && error.message) || error))
5666
+ }
5667
+ }
5668
+ ctx.effect(() => {
5669
+ mountHeaderEntry()
5670
+ return () => {
5671
+ if (headerCleanup) {
5672
+ try { headerCleanup() } catch {}
5673
+ headerCleanup = null
5674
+ headerRemount = null
5675
+ }
5676
+ }
5677
+ })
5678
+
5679
+ // 真机上 sidebarRight 等宿主服务可能在本插件 apply 之后才就绪:此时
5680
+ // ctx.get('sidebarRight') 是 undefined,头部会被误判成「服务不存在」永久禁用
5681
+ // (2026-11-24 真机截图)。用 Cordis 的 ctx.inject 等它们就绪后重取,
5682
+ // 再重挂一次入口 —— 服务已到位就用新状态渲染,不到位仍然是原来的降级。
5683
+ if (typeof ctx.inject === 'function') {
5684
+ try {
5685
+ ctx.inject(['sidebarRight', 'sidebarRightTabs', 'sessions'], (scoped) => {
5686
+ const host = scoped && typeof scoped.get === 'function' ? scoped : ctx
5687
+ const nextRight = optionalHostService(host, 'sidebarRight')
5688
+ const nextTabs = optionalHostService(host, 'sidebarRightTabs')
5689
+ const nextSessions = optionalHostService(host, 'sessions')
5690
+ const nextLayout = optionalHostService(host, 'layout')
5691
+ const changed = nextRight !== hostSidebarRight || nextTabs !== hostSidebarRightTabs
5692
+ || nextSessions !== hostSessions || nextLayout !== hostLayout
5693
+ hostSidebarRight = nextRight
5694
+ hostSidebarRightTabs = nextTabs
5695
+ hostSessions = nextSessions
5696
+ if (nextLayout) hostLayout = nextLayout
5697
+ if (!changed) return
5698
+ note('host-services-ready', '收到 sidebarRight/sessions 服务,重挂头部与右栏入口')
5699
+ if (headerCleanup && headerRemount) {
5700
+ try { headerRemount() } catch {}
5701
+ } else {
5702
+ // apply 时服务全缺,头部当时根本没注册 —— 这里补挂。
5703
+ mountHeaderEntry()
5704
+ }
5705
+ })
5706
+ } catch (error) {
5707
+ note('host-services-inject-fail', String((error && error.message) || error))
5708
+ }
5709
+ }
5710
+
5711
+ // 同一浏览器的其它页面改了名字:storage 事件只当触发器,真值回 localStorage 读。
5712
+ // 该监听独立于任何页面是否打开,确保左栏/右栏与设置草稿都收到改名通知。
5713
+ ctx.effect(() => {
5714
+ const onStorage = (event) => {
5715
+ if (!event) return
5716
+ // localStorage.clear() 的事件 key 是 null —— 那是「所有覆盖都没了」,按删除处理。
5717
+ const cleared = event.key === null || event.key === undefined
5718
+ if (!cleared && event.key !== TAB_NAME_STORAGE_KEY) return
5719
+ const before = tabNameLabel()
5720
+ tabNameOverride = (cleared || event.newValue === null || event.newValue === undefined)
5721
+ ? null
5722
+ : readTabNameOverride()
5723
+ if (tabNameLabel() === before) return
5724
+ try { notifyTabName(before) } catch {}
5725
+ }
5726
+ try {
5727
+ if (typeof window !== 'undefined' && typeof window.addEventListener === 'function') {
5728
+ window.addEventListener('storage', onStorage)
5729
+ }
5730
+ } catch {}
5731
+ return () => {
5732
+ try {
5733
+ if (typeof window !== 'undefined' && typeof window.removeEventListener === 'function') {
5734
+ window.removeEventListener('storage', onStorage)
5735
+ }
5736
+ } catch {}
5737
+ }
5738
+ })
4553
5739
 
4554
5740
  // ② the machine-wide orbit in the composer dock row — the same row as
4555
5741
  // 轮/步 · token 用量 · 上下文环. One ring, one satellite per live