dsh-session-superagent 0.10.12 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.js 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,88 @@ window.__ModuleLoader__.load({
422
440
  }
423
441
 
424
442
  // 客户端版本探针:每次模块加载写一次,用来确认浏览器里跑的是哪一版
425
- const CLIENT_VERSION = '0.10.12'
443
+ const CLIENT_VERSION = '2.0.1'
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 RIGHT_TAB_DEFINITION_PENDING = '宿主 sidebarRightTabs 尚未注册本页签'
453
+ let rightRegistrationError = null
454
+ const HEADER_UTILITY_ID = 'session-superagent-current'
455
+ let hostLayout = null
456
+ let hostSidebarRight = null
457
+ let hostSidebarRightTabs = null
458
+ let hostSessions = null
459
+
460
+ function canToggleSessionRightTab() {
461
+ return Boolean(hostSidebarRight
462
+ && hostSidebarRight.view && typeof hostSidebarRight.view.subscribe === 'function'
463
+ && typeof hostSidebarRight.tabsIn === 'function' && typeof hostSidebarRight.hide === 'function')
464
+ }
465
+ function visibleSessionRightTab(sessionId) {
466
+ if (!canToggleSessionRightTab()) return null
467
+ const tabs = hostSidebarRight.tabsIn(sessionId) || []
468
+ return tabs.find((tab) => tab && tab.kind === RIGHT_TAB_KIND && tab.visible !== false) || null
469
+ }
470
+
471
+ function optionalHostService(ctx, name) {
472
+ try {
473
+ const service = typeof ctx.get === 'function' ? ctx.get(name) : ctx[name]
474
+ return service || null
475
+ } catch {
476
+ return null
477
+ }
478
+ }
479
+
480
+ function openSessionSuperagentTab() {
481
+ if (!hostSidebarRight || typeof hostSidebarRight.openTab !== 'function') {
482
+ throw new Error(RIGHT_TAB_UNAVAILABLE)
483
+ }
484
+ // 右栏 session slot 自带当前 sessionId;调用方只传 kind,不拼 sidebar:// 地址或伪造 params。
485
+ return hostSidebarRight.openTab(RIGHT_TAB_KIND)
486
+ }
487
+ // 宿主 openTab 在 kind 没有注册时直接抛 `sidebarRight: no tab type is registered as "…"`,
488
+ // 所以入口可用性必须以宿主注册表的真实内容为准:既要 kind 在,也要 inForce 的 definition
489
+ // 就是我们这一条(同 kind 被别的插件 shadow 时 get(kind) 返回的是别人,点开会是别人的页签)。
490
+ function rightTabOwnedByUs() {
491
+ if (!hostSidebarRightTabs) return false
492
+ try {
493
+ if (typeof hostSidebarRightTabs.get === 'function') {
494
+ const definition = hostSidebarRightTabs.get(RIGHT_TAB_KIND)
495
+ return Boolean(definition && definition.id === RIGHT_TAB_ID)
496
+ }
497
+ if (typeof hostSidebarRightTabs.entries === 'function') {
498
+ const entries = hostSidebarRightTabs.entries() || []
499
+ return entries.some((definition) => definition
500
+ && definition.kind === RIGHT_TAB_KIND && definition.id === RIGHT_TAB_ID)
501
+ }
502
+ } catch {
503
+ return false
504
+ }
505
+ // 宿主只暴露 register(老宿主/测试桩)时无法查询:按已注册处理,保持原有的 open-only 行为。
506
+ return true
507
+ }
508
+
509
+ // 会话头部与 Dock/Orbit 共用同一个判定:null 表示「现在点下去宿主一定按我们的 kind 打开」。
510
+ // 只看 register 方法是否存在会把「服务在、注册却没跑到」显示成可点 —— 真机上就是那条红字。
511
+ function rightTabIssue() {
512
+ if (!hostSidebarRight || typeof hostSidebarRight.openTab !== 'function') return RIGHT_TAB_UNAVAILABLE
513
+ if (!hostSidebarRightTabs || typeof hostSidebarRightTabs.register !== 'function') return RIGHT_TAB_DEFINITION_UNAVAILABLE
514
+ if (rightTabOwnedByUs()) return null
515
+ // kind 在、但不是我们的 definition:可能被别的插件 shadow(extension band 更高)。
516
+ try {
517
+ const held = typeof hostSidebarRightTabs.get === 'function'
518
+ ? hostSidebarRightTabs.get(RIGHT_TAB_KIND)
519
+ : null
520
+ if (held && held.id !== RIGHT_TAB_ID) return '主理鱼右栏页签已被 ' + String(held.id || '其它插件') + ' 占用'
521
+ } catch {}
522
+ if (rightRegistrationError) return '主理鱼右栏注册失败:' + rightRegistrationError
523
+ return RIGHT_TAB_DEFINITION_PENDING
524
+ }
426
525
  // SEMVER_COMPARATOR_SOURCE_START
427
526
  // This block is duplicated verbatim in client.js because the browser UMD cannot import ESM.
428
527
  // test/update-semver.test.mjs audits both copies and exercises their behavior.
@@ -483,6 +582,138 @@ window.__ModuleLoader__.load({
483
582
  return parseSemver(value) !== null
484
583
  }
485
584
  // SEMVER_COMPARATOR_SOURCE_END
585
+ // ── 入口名称(左侧全局中枢 / 会话右栏标题)───────────────────────────────
586
+ // 名称只有一份品牌语义(issue #11 的 brandName,`/state` 下发),这里不另造字段:
587
+ // 本地显示覆盖(本浏览器 localStorage)> /state.brandName > 默认「主理鱼」。
588
+ // 左栏、右栏 definition 与右栏标题在改名时先 dispose 再按原 id/key/component 重注册,
589
+ // 让宿主立刻重算文案;覆盖不动唤醒抬头、插件包名和 ack 标签。
590
+ const TAB_NAME_DEFAULT = '主理鱼'
591
+ const TAB_NAME_STORAGE_KEY = 'dsh-session-superagent.tab-name'
592
+ // 页签条不允许无限长:超过 24 个码点就截断。按码点切(Array.from)而不是 UTF-16 单元,
593
+ // 否则「😀」这类增补平面字符会被劈成半个代理对,渲染出一个替换符。
594
+ const TAB_NAME_MAX = 24
595
+
596
+ /**
597
+ * 页签名称归一化:与 `lib/watch.js` 的 `normalizeBrandName` 同一套规则
598
+ * (trim → 压平换行 → 空值回落默认),再按码点截断到 TAB_NAME_MAX。
599
+ * client.js 是 UMD,不能 import ESM,所以规则在这里镜像一份;
600
+ * `test/client.test.mjs` 有「与 normalizeBrandName 同源」的用例钉住两边一致。
601
+ */
602
+ function normalizeTabName(value, fallback = TAB_NAME_DEFAULT) {
603
+ const text = String(value ?? '').trim().replace(/[\r\n]+/g, ' ')
604
+ if (!text) return fallback
605
+ const points = Array.from(text)
606
+ return points.length <= TAB_NAME_MAX ? text : points.slice(0, TAB_NAME_MAX).join('')
607
+ }
608
+
609
+ /**
610
+ * 输入框的即时截断:只截长度,不 trim、不回落空值 ——
611
+ * 否则客户清空输入框想「恢复默认」时,值会被当场改回默认名,看起来像清不掉。
612
+ */
613
+ function clampTabNameDraft(value) {
614
+ const text = String(value ?? '')
615
+ const points = Array.from(text)
616
+ return points.length <= TAB_NAME_MAX ? text : points.slice(0, TAB_NAME_MAX).join('')
617
+ }
618
+
619
+ /**
620
+ * 取 localStorage。桌面/浏览器两种宿主都可能禁用它(隐私模式、沙箱、配额满),
621
+ * 访问本身也可能抛 —— 一律返回 null,调用方回落默认,绝不因为一个页签名把 apply() 弄挂。
622
+ */
623
+ function tabNameStorage() {
624
+ try {
625
+ const storage = typeof localStorage === 'undefined' ? null : localStorage
626
+ if (!storage || typeof storage.getItem !== 'function' || typeof storage.setItem !== 'function') return null
627
+ return storage
628
+ } catch {
629
+ return null
630
+ }
631
+ }
632
+
633
+ /** 本地显示覆盖(null = 没有覆盖,跟随 /state.brandName)。读不到/读坏都回落 null。 */
634
+ function readTabNameOverride() {
635
+ const storage = tabNameStorage()
636
+ if (!storage) return null
637
+ try {
638
+ const raw = storage.getItem(TAB_NAME_STORAGE_KEY)
639
+ if (typeof raw !== 'string') return null
640
+ const text = raw.trim()
641
+ return text ? text : null
642
+ } catch {
643
+ return null
644
+ }
645
+ }
646
+
647
+ let tabNameOverride = null // 本地显示覆盖;null = 跟随品牌名
648
+ let tabNameBrand = '' // /state.brandName;'' = 还没读到(老服务端也没有)
649
+ const tabNameListeners = new Set()
650
+
651
+ /** 当前页签名称:覆盖 > 品牌名 > 默认。 */
652
+ function tabNameLabel() {
653
+ return normalizeTabName(tabNameOverride || tabNameBrand || TAB_NAME_DEFAULT)
654
+ }
655
+
656
+ /** 页签名变化时重注册(apply 里订阅)。返回清理函数。 */
657
+ function subscribeTabName(listener) {
658
+ tabNameListeners.add(listener)
659
+ return () => { tabNameListeners.delete(listener) }
660
+ }
661
+
662
+ /**
663
+ * 通知订阅者;单个订阅者抛错不能连坐其它订阅者。
664
+ * `previous` 是**变化前**的文案,订阅者据此判断「草稿还是干净的」:
665
+ * 干净草稿跟着新值走,用户正在编辑的脏草稿不许被外部事件覆盖(终审 M1)。
666
+ */
667
+ function notifyTabName(previous) {
668
+ const label = tabNameLabel()
669
+ for (const listener of [...tabNameListeners]) {
670
+ try {
671
+ listener(label, previous)
672
+ } catch (error) {
673
+ try { note('desk-fail', String((error && error.message) || error)) } catch {}
674
+ }
675
+ }
676
+ return label
677
+ }
678
+
679
+ /**
680
+ * 保存页签名称:空值(含全空格)= 清除覆盖,回到 /state 的 brandName(默认「主理鱼」)。
681
+ * 返回 { label, persisted }:persisted=false 表示 localStorage 不可用 —— 本次会话内有效,
682
+ * 刷新后回到默认。面板必须把这件事说清楚,不能假装存住了。
683
+ */
684
+ function saveTabName(value) {
685
+ const previous = tabNameLabel()
686
+ const text = String(value ?? '').trim()
687
+ tabNameOverride = text ? normalizeTabName(text) : null
688
+ let persisted = false
689
+ const storage = tabNameStorage()
690
+ if (storage) {
691
+ try {
692
+ if (tabNameOverride === null) {
693
+ if (typeof storage.removeItem === 'function') storage.removeItem(TAB_NAME_STORAGE_KEY)
694
+ else storage.setItem(TAB_NAME_STORAGE_KEY, '')
695
+ } else {
696
+ storage.setItem(TAB_NAME_STORAGE_KEY, tabNameOverride)
697
+ }
698
+ persisted = true
699
+ } catch {
700
+ persisted = false
701
+ }
702
+ }
703
+ return { label: notifyTabName(previous), persisted }
704
+ }
705
+
706
+ /**
707
+ * /state 的品牌名同步到页签(issue #11 的唯一品牌源)。变了才重注册;
708
+ * 有本地覆盖时文案不变,因此不会为品牌名抖动重画。
709
+ */
710
+ function syncTabNameBrand(value) {
711
+ const before = tabNameLabel()
712
+ tabNameBrand = typeof value === 'string' ? value.trim() : ''
713
+ if (tabNameLabel() === before) return before
714
+ return notifyTabName(before)
715
+ }
716
+
486
717
  const UPDATE_UNKNOWN_HINT = '请求结果未知,请先重新检查 installed/running,再手动确认'
487
718
  let BASE = '/session-superagent'
488
719
  /**
@@ -579,6 +810,11 @@ window.__ModuleLoader__.load({
579
810
  if (updatePost && res.status === 404) throw unknownUpdateError(error)
580
811
  throw error
581
812
  }
813
+ // 页签名称跟随品牌名(issue #11 的唯一品牌源):/state 是唯一带 brandName 的路由,
814
+ // 所有读取都经过这里 —— 既不额外发请求,也不在本地另存一份品牌名。
815
+ if (path.startsWith('/state')) {
816
+ try { syncTabNameBrand(body && body.brandName) } catch {}
817
+ }
582
818
  return body
583
819
  }
584
820
 
@@ -608,7 +844,7 @@ window.__ModuleLoader__.load({
608
844
  // 官方 GUI 的 376 条选择器 / 40KB 样式原样搬过来,类名统一 `dt-` 前缀,不污染宿主。
609
845
  // 两个表单都有这个开关:文案只写一份,改的时候不会漏掉另一处
610
846
  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";
847
+ 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
848
 
613
849
  /** 把移植过来的样式挂到 document 上,只挂一次。 */
614
850
  /**
@@ -616,6 +852,10 @@ window.__ModuleLoader__.load({
616
852
  * 以前这里是一整套自成体系的 inline style,和原生界面放一起能看出断层。
617
853
  */
618
854
  const DOCK_CSS = `
855
+ /* 目标会话选择器进入预览后,控件边界也须达到 3:1;只换官方 token,不提高豁免基线。 */
856
+ .dt-page .dt-select { border-color: var(--dsw-alias-label-tertiary); }
857
+ /* HoursField 多段:沿用官方 dt-hours 行与 dt-btn,只补 derived 纵向列表。 */
858
+ .sa-hours-list { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
619
859
  /* Composer dock 入口:保留 20px derived 几何;交互色与焦点复用官方 dt-btn / ghost 规则。 */
620
860
  .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
861
  .dt-btn.sa-orbit-trigger:hover { background: var(--dsw-alias-interactive-bg-hover); }
@@ -647,13 +887,15 @@ window.__ModuleLoader__.load({
647
887
  .sa-dock-session { flex: none; font-size: 11px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }
648
888
  .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
889
  .sa-dock-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dsw-alias-label-tertiary); }
890
+ /* 最近唤醒的条目:仓库名与状态之后的第二行事实,比 sub 亮一档(客户最关心的一条) */
891
+ .sa-dock-wake { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dsw-alias-label-secondary); }
650
892
  .sa-dock-err { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dsw-alias-state-error-primary); }
651
893
  .sa-dock-actions { display: flex; flex: none; gap: 2px; opacity: 0; transition: opacity 120ms ease; }
652
894
  .sa-dock-row:hover .sa-dock-actions, .sa-dock-row:focus-within .sa-dock-actions { opacity: 1; }
653
895
  @media (hover: none) { .sa-dock-actions { opacity: 1; } }
654
896
  @media (prefers-reduced-motion: reduce) { .sa-dock-actions { transition: none; } }
655
897
  .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); }
898
+ .sa-dock-foot { padding: 8px 14px 10px; border-top: 0.5px solid var(--dsw-alias-border-l3); color: var(--dsw-alias-label-secondary); }
657
899
  `
658
900
 
659
901
  /**
@@ -863,14 +1105,15 @@ window.__ModuleLoader__.load({
863
1105
  }
864
1106
 
865
1107
  // 审核 T26 W2:以前 传了但这里不解构 —— 传的人以为会显示,其实被静默吞掉。
866
- function Section({ title, count, subtitle, hint, action, children }) {
1108
+ function Section({ title, count, subtitle, hint, action, icon, children }) {
867
1109
  return h('section', { className: 'dt-section' },
868
1110
  title
869
1111
  ? h('h2', { className: 'dt-section-title' },
1112
+ icon ? h('span', { className: 'dt-section-icon' }, h(Icon, { name: icon, size: 14 })) : null,
870
1113
  h('span', { className: 'dt-section-name' }, title),
871
1114
  count !== undefined && count !== null ? h('span', { className: 'dt-count' }, String(count)) : null,
872
1115
  subtitle ? h('span', { className: 'dt-section-sub' }, subtitle) : null,
873
- action ? h('span', { className: 'dt-subhead-actions' }, action) : null)
1116
+ action ? h('span', { className: 'dt-subhead-actions', style: { marginLeft: 'auto' } }, action) : null)
874
1117
  : null,
875
1118
  hint ? h(Hint, null, hint) : null,
876
1119
  children)
@@ -1071,9 +1314,12 @@ window.__ModuleLoader__.load({
1071
1314
  // 这里刻意不引入 DSH InlineEditor:watcher 是多字段表单,不是单文本编辑器。
1072
1315
  const AUTHOR_LIST_PLACEHOLDER = 'GitHub 登录名,逗号分隔,留空 = 谁都算'
1073
1316
  const PRIORITY_LABEL = '优先级(在「单次最多唤醒条数」内先挑谁)'
1317
+ // PR 响应监控:watchKind 决定后面三项显不显示,所以必须进初值 ——
1318
+ // 否则新建表单的分段控件没有选中项(两个都不亮),dirty 比较也会漏掉这个键。
1074
1319
  const CREATE_WATCHER_VALUES = {
1075
- repo: '', intervalSec: '60', labels: '', ignoreLabels: '', assignee: '',
1076
- activeHours: '', goal: '', ackLabel: '', onlyAssigned: false, allowAuthors: '',
1320
+ repo: '', watchKind: 'issue', audit: false, adversarialAudit: false, auditMode: 'subagent',
1321
+ intervalSec: '60', labels: '', ignoreLabels: '', assignee: '',
1322
+ activeHours: '', goal: '', ackLabel: '', onlyAssigned: false, onlyNewComments: false, allowAuthors: '',
1077
1323
  observe: false, isolated: false, workdir: '', batchLimit: '', maxWakesPerHour: '',
1078
1324
  sessionMaxWakes: '', isolateKeepDays: '', maxIsolated: '',
1079
1325
  priorityReopened: true, priorityComments: true, priorityLabels: true,
@@ -1094,6 +1340,11 @@ window.__ModuleLoader__.load({
1094
1340
  }
1095
1341
  const watcherValuesFrom = (watcher, ackDefaults) => ({
1096
1342
  repo: watcher.repo || '',
1343
+ // 服务端用 kind: 'pr' 表示 PR 响应监控(老 watcher 没有这个字段 → issue)。
1344
+ watchKind: watcher.kind === 'pr' ? 'pr' : 'issue',
1345
+ audit: watcher.audit === true,
1346
+ adversarialAudit: watcher.adversarialAudit === true,
1347
+ auditMode: watcher.auditMode === 'inline' ? 'inline' : 'subagent',
1097
1348
  intervalSec: watcherNumberText(watcher.intervalSec ?? 60),
1098
1349
  labels: (watcher.filters && Array.isArray(watcher.filters.labels) ? watcher.filters.labels : []).join(','),
1099
1350
  ignoreLabels: (watcher.filters && Array.isArray(watcher.filters.ignoreLabels) ? watcher.filters.ignoreLabels : []).join(','),
@@ -1102,6 +1353,7 @@ window.__ModuleLoader__.load({
1102
1353
  goal: watcher.note || (typeof watcher.goal === 'string' ? watcher.goal : (watcher.goal && watcher.goal.objective) || ''),
1103
1354
  ackLabel: watcher.ackLabel || ackLabelFallback(watcher, ackDefaults),
1104
1355
  onlyAssigned: !!(watcher.filters && watcher.filters.onlyAssigned),
1356
+ onlyNewComments: !!(watcher.filters && watcher.filters.onlyNewComments),
1105
1357
  allowAuthors: (watcher.filters && Array.isArray(watcher.filters.allowAuthors) ? watcher.filters.allowAuthors : []).join(', '),
1106
1358
  observe: !!watcher.observe,
1107
1359
  isolated: !!watcher.isolated,
@@ -1123,24 +1375,40 @@ window.__ModuleLoader__.load({
1123
1375
  // label/hint/note/control 的顺序只在这里声明一次;两个调用点只负责提供值与回调。
1124
1376
  const WATCHER_FIELD_SCHEMA = [
1125
1377
  { key: 'repo', label: '仓库', kind: 'text', modes: ['create'], required: true, placeholder: 'owner/name,或 gitee:owner/name' },
1378
+ // PR 响应监控(Task 6):类型本身跟仓库走,所以不 advanced;后三项只在 PR 类型下出现。
1379
+ { key: 'watchKind', label: '监控类型', kind: 'segmented', options: [
1380
+ // 两条路的语义完全不同:左边是「别人提给我们、我们来处理」,右边是「我们提给别人、等别人回」。
1381
+ // 只写 Issue / PR 会让人以为右边是「监控仓库里的 PR」,实际正好相反。
1382
+ { value: 'issue', label: '收到的 Issue/PR' },
1383
+ { value: 'pr', label: '对外发出的 PR' },
1384
+ ] },
1385
+ { key: 'audit', label: '审计', kind: 'switch', when: (value) => value.watchKind === 'pr', hint: '修改后先自审一遍再提交' },
1386
+ { key: 'adversarialAudit', label: '对抗性审计', kind: 'switch', when: (value) => value.watchKind === 'pr', hint: '专门挑刺:假设这段代码一定有 bug' },
1387
+ { key: 'auditMode', label: '执行方式', kind: 'segmented', when: (value) => value.watchKind === 'pr', options: [
1388
+ { value: 'inline', label: '当前会话' },
1389
+ { value: 'subagent', label: '子代理' },
1390
+ ], disabledWhen: (value) => !value.audit && !value.adversarialAudit },
1126
1391
  { key: 'intervalSec', label: '间隔(秒)', kind: 'number', min: 30, max: 3600, required: true, hint: '多长时间检查一次这个仓库,最小 30 秒' },
1127
1392
  { key: 'labels', label: '只处理这些标签', kind: 'text', placeholder: '逗号分隔,留空 = 全部' },
1128
1393
  { key: 'ignoreLabels', label: '排除这些标签', kind: 'text', placeholder: '逗号分隔,留空 = 不排除', hint: '命中任意一个就跳过,优先级高于上面的白名单' },
1129
1394
  { key: 'allowAuthors', label: '只理这些人提的', kind: 'text', placeholder: AUTHOR_LIST_PLACEHOLDER, hint: '不在名单里的人提的 issue/PR 不会叫醒你(Gitee 也可以填)' },
1130
- { key: 'activeHours', label: '活跃时段', kind: 'hours', hint: '只在这个时间段内唤醒;窗口外只攒条目,不打扰' },
1395
+ { key: 'activeHours', label: '活跃时段', kind: 'hours', hint: '可添加多段;只在任一时段内唤醒,窗口外只攒条目,不打扰' },
1131
1396
  { key: 'goal', label: '目标/规则', kind: 'text', placeholder: '可选,会附在唤醒消息里' },
1132
1397
  { key: 'ackLabel', label: '已处理标签', kind: 'text', placeholder: '主理鱼:已处理', hint: 'watch_ack 会把同名标签打到 issue/PR 上;改名字等于换一套已处理标记' },
1133
1398
  { key: 'onlyAssigned', label: '只看已指派', kind: 'switch', hint: '只处理已指派给人的条目' },
1399
+ { key: 'onlyNewComments', label: '只看新评论', kind: 'switch', when: (value) => value.watchKind !== 'pr', hint: '只有 discussion 或 PR review 新评论才唤醒;push、改标签不唤醒。「评论优先」只调整排序,不过滤。' },
1134
1400
  { key: 'assignee', label: '只看指派给谁', kind: 'text', when: (value) => !!value.onlyAssigned, placeholder: 'GitHub 登录名,留空 = 只要有指派就行' },
1135
1401
  { key: 'observe', label: '仅观察', kind: 'switch', hint: '仅观察(只记录本会唤醒哪几条,不真唤醒)' },
1136
- { key: 'isolated', label: '隔离执行', kind: 'switch', hint: ISOLATED_HINT },
1402
+ // PR 守不做隔离执行:worktree 要建在本地仓库里,而 PR 在别人仓库,建出来的树没用。
1403
+ // 所以这四个控件在「对外发出的 PR」类型下整个不渲染(2026-11-13 review B7)。
1404
+ { key: 'isolated', label: '隔离执行', kind: 'switch', when: (value) => value.watchKind !== 'pr', hint: ISOLATED_HINT },
1137
1405
  { key: 'batchLimit', label: '单次最多唤醒条数', kind: 'number', advanced: true, min: 1, max: 20, placeholder: (defaults) => String(defaults.batchLimit ?? 5) + '(1-20)' },
1138
1406
  { key: 'maxWakesPerHour', label: '每小时最多唤醒次数', kind: 'number', advanced: true, min: 1, max: 60, placeholder: (defaults) => String(defaults.maxWakesPerHour ?? 6) + '(1-60)' },
1139
1407
  { key: 'sessionMaxWakes', label: '这条会话每小时最多被唤醒', kind: 'number', advanced: true, min: 1, max: 60, placeholder: (defaults) => String(defaults.sessionMaxWakes ?? 12) + '(1-60)', hint: '跨所有守累计:守 5 个仓库时,光有单守上限挡不住叠加' },
1140
1408
  { 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: '天数之外的第二道线:超出就回收最旧的(不影响正在用的那个)' },
1409
+ { key: 'workdir', label: '隔离工作目录', kind: 'text', advanced: true, when: (value) => value.watchKind !== 'pr' && !!value.isolated, placeholder: '绝对路径,留空 = 当前工作目录' },
1410
+ { 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: '每次唤醒前回收这个天数之前的一次性工作区;留空用默认天数' },
1411
+ { key: 'maxIsolated', label: '最多保留几个隔离区', kind: 'number', advanced: true, when: (value) => value.watchKind !== 'pr' && !!value.isolated, min: 1, max: 50, placeholder: '5(1-50)', hint: '天数之外的第二道线:超出就回收最旧的(不影响正在用的那个)' },
1144
1412
  ]
1145
1413
 
1146
1414
  /** superagent Field 的 DOM:label 与 InfoTip 是兄弟节点,控件拿同一个唯一 id。 */
@@ -1170,14 +1438,14 @@ window.__ModuleLoader__.load({
1170
1438
  }
1171
1439
 
1172
1440
  /** superagent SaveBar 的精简草稿状态:clean 不挂载,dirty/busy/error 才挂载。 */
1173
- function SaveBar({ dirty, busy, error, disabled, onDiscard, onSave, saveLabel = '保存' }) {
1441
+ function SaveBar({ dirty, busy, error, disabled, onDiscard, onSave, saveLabel = '保存', discardLabel = '放弃', status, busyLabel = '保存中…' }) {
1174
1442
  if (!dirty && !busy && !error) return null
1175
1443
  return h('div', { className: 'dt-savebar' },
1176
1444
  error
1177
1445
  ? 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))
1446
+ : h('p', { className: 'dt-hint', 'aria-live': 'polite' }, status || (busy ? busyLabel : '未保存')),
1447
+ h(Btn, { size: 'sm', variant: 'ghost', 'aria-label': discardLabel, disabled: !dirty || !!busy || !!disabled, onClick: onDiscard }, discardLabel),
1448
+ h(Btn, { size: 'sm', variant: 'primary', type: 'submit', 'aria-label': busy ? busyLabel : saveLabel, disabled: !dirty || !!busy || !!disabled, onClick: onSave }, busy ? busyLabel : saveLabel))
1181
1449
  }
1182
1450
 
1183
1451
  /**
@@ -1205,30 +1473,66 @@ window.__ModuleLoader__.load({
1205
1473
  }, 0)
1206
1474
  }
1207
1475
 
1208
- /** derived HoursField:两个原生时间控件,Field 的 label 只关联起始控件。 */
1476
+ /** derived HoursField:每段两个原生时间控件;多段直接由 value 推导,不新增 hook。 */
1209
1477
  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)
1478
+ const text = String(value || '')
1479
+ const rows = (text ? text.split(/[,;]/) : ['']).map((segment) => {
1480
+ const match = segment.trim().match(/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/)
1481
+ return {
1482
+ start: match ? String(match[1]).padStart(2, '0') + ':' + match[2] : '',
1483
+ end: match ? String(match[3]).padStart(2, '0') + ':' + match[4] : '',
1484
+ }
1485
+ })
1486
+ const multiple = rows.length > 1
1487
+ const serialize = (list) => list
1488
+ .map((row) => row.start && row.end ? row.start + '-' + row.end : '')
1489
+ .filter(Boolean).join(',')
1490
+ const write = (index, nextStart, nextEnd) => {
1491
+ const next = rows.map((row) => ({ ...row }))
1492
+ next[index] = { start: nextStart, end: nextEnd }
1493
+ onChange(serialize(next))
1494
+ }
1495
+ const addButton = h('button', {
1496
+ type: 'button', className: 'dt-btn dt-btn-sm dt-btn-ghost', disabled,
1497
+ 'aria-label': '添加时段',
1498
+ onClick: () => onChange([serialize(rows), '09:00-10:00'].filter(Boolean).join(',')),
1499
+ }, '添加时段')
1500
+ const renderRow = (row, index) => {
1501
+ const startId = index === 0 ? id : id ? id + '-' + (index + 1) + '-start' : undefined
1502
+ const endId = index === 0 ? (id ? id + '-end' : undefined) : id ? id + '-' + (index + 1) + '-end' : undefined
1503
+ const label = multiple ? '第 ' + (index + 1) + ' 段' : ''
1504
+ const overnight = Boolean(row.start && row.end && row.end <= row.start)
1505
+ return [
1506
+ h('input', {
1507
+ id: startId, type: 'time', className: 'dt-time', value: row.start,
1508
+ 'aria-label': label + '起始时间', disabled,
1509
+ onChange: (event) => write(index, event.target.value, row.end || '23:00'),
1510
+ }),
1511
+ h('span', { className: 'dt-hours-sep' }, '→'),
1512
+ h('input', {
1513
+ id: endId, type: 'time', className: 'dt-time', value: row.end,
1514
+ 'aria-label': label + '结束时间', disabled,
1515
+ onChange: (event) => write(index, row.start || '09:00', event.target.value),
1516
+ }),
1517
+ multiple
1518
+ ? h('button', {
1519
+ type: 'button', className: 'dt-btn dt-btn-sm dt-btn-ghost', disabled,
1520
+ 'aria-label': '删除第 ' + (index + 1) + ' 段',
1521
+ onClick: () => onChange(serialize(rows.filter((_, rowIndex) => rowIndex !== index))),
1522
+ }, '删除')
1523
+ : value
1524
+ ? h('button', {
1525
+ type: 'button', className: 'dt-btn dt-btn-sm dt-btn-ghost', disabled,
1526
+ onClick: () => onChange(''),
1527
+ }, '全天')
1528
+ : h('span', { className: 'dt-hours-hint' }, '留空 = 全天'),
1529
+ overnight ? h('span', { className: 'dt-hours-hint' }, '跨夜窗口') : null,
1530
+ ]
1531
+ }
1532
+ if (!multiple) return h('div', { className: 'dt-hours' }, ...renderRow(rows[0], 0), addButton)
1533
+ return h('div', { className: 'sa-hours-list' },
1534
+ rows.map((row, index) => h('div', { className: 'dt-hours', key: index }, ...renderRow(row, index))),
1535
+ addButton)
1232
1536
  }
1233
1537
 
1234
1538
  function WatcherSwitch({ spec, value, onChange, disabled, id }) {
@@ -1242,7 +1546,7 @@ window.__ModuleLoader__.load({
1242
1546
  function WatcherPriority({ value, onChange, disabled, idPrefix }) {
1243
1547
  const items = [
1244
1548
  ['priorityReopened', '重开优先', '被重开的排最前'],
1245
- ['priorityComments', '评论优先', '有人在等回应的靠前'],
1549
+ ['priorityComments', '评论优先', '只排序:有人在等回应的靠前,不过滤其它更新'],
1246
1550
  ['priorityLabels', '标签优先', '带标签的靠前'],
1247
1551
  ['priorityUnassigned', '未认领优先', '没人认领的靠前(默认关:这是我们的判断,不是规则)'],
1248
1552
  ['priorityStale', '积压优先', '躺了 30 天以上的靠前(默认关,只展示)'],
@@ -1257,7 +1561,7 @@ window.__ModuleLoader__.load({
1257
1561
  }
1258
1562
 
1259
1563
  function WatcherForm({ mode = 'edit', idPrefix = 'watcher', value, snapshot, defaults = {}, disabled = false,
1260
- onChange, onSave, onDiscard, submitLabel = '保存', sessionId }) {
1564
+ onChange, onSave, onDiscard, submitLabel = '保存', sessionId, targetControl = null }) {
1261
1565
  const [advancedOpen, setAdvancedOpen] = useState(false)
1262
1566
  const [busy, setBusy] = useState(false)
1263
1567
  const [error, setError] = useState(null)
@@ -1320,17 +1624,27 @@ window.__ModuleLoader__.load({
1320
1624
  if (spec.modes && !spec.modes.includes(mode)) return null
1321
1625
  if (spec.when && !spec.when(values)) return null
1322
1626
  const id = idPrefix + '-' + spec.key
1627
+ // 统一算一次:busy/disabled 是整表语义,disabledWhen 是字段自己的规则,两者取或。
1628
+ // 以前三处各写一遍 `busy || disabled` —— 加第四种控件时漏一处就静默可点。
1629
+ const specDisabled = busy || disabled || (typeof spec.disabledWhen === 'function' ? !!spec.disabledWhen(values) : false)
1323
1630
  if (spec.kind === 'switch') {
1324
- return h(WatcherSwitch, { key: spec.key, spec, value: values[spec.key], disabled: busy || disabled, id,
1631
+ return h(WatcherSwitch, { key: spec.key, spec, value: values[spec.key], disabled: specDisabled, id,
1325
1632
  onChange: (next) => change(spec.key, next) })
1326
1633
  }
1327
1634
  if (spec.kind === 'priority') {
1328
- return h(WatcherPriority, { key: spec.key, value: values, disabled: busy || disabled, idPrefix,
1635
+ return h(WatcherPriority, { key: spec.key, value: values, disabled: specDisabled, idPrefix,
1329
1636
  onChange: change })
1330
1637
  }
1638
+ if (spec.kind === 'segmented') {
1639
+ return h(Field, { key: spec.key, id, label: spec.label, hint: spec.hint, note: spec.note },
1640
+ h(SegmentedControl, {
1641
+ id, label: spec.label, options: spec.options, value: values[spec.key],
1642
+ disabled: specDisabled, onChange: (next) => change(spec.key, next),
1643
+ }))
1644
+ }
1331
1645
  const common = {
1332
1646
  value: spec.kind === 'hours' ? (values[spec.key] || '') : watcherNumberText(values[spec.key]),
1333
- disabled: busy || disabled,
1647
+ disabled: specDisabled,
1334
1648
  onChange: (next) => change(spec.key, next),
1335
1649
  }
1336
1650
  const control = spec.kind === 'hours'
@@ -1341,7 +1655,7 @@ window.__ModuleLoader__.load({
1341
1655
  min: spec.min, max: spec.max, step: spec.kind === 'number' ? 1 : undefined,
1342
1656
  required: !!spec.required,
1343
1657
  placeholder: typeof spec.placeholder === 'function' ? spec.placeholder(defaults) : spec.placeholder,
1344
- disabled: busy || disabled,
1658
+ disabled: specDisabled,
1345
1659
  onChange: (event) => change(spec.key, event.target.value),
1346
1660
  })
1347
1661
  return h(Field, { key: spec.key, id, label: spec.label, hint: spec.hint, note: spec.note }, control)
@@ -1349,12 +1663,21 @@ window.__ModuleLoader__.load({
1349
1663
  const basic = WATCHER_FIELD_SCHEMA.filter((spec) => !spec.advanced).map(renderField)
1350
1664
  const advanced = WATCHER_FIELD_SCHEMA.filter((spec) => spec.advanced).map(renderField)
1351
1665
  const collapsedAdvanced = h('span', { className: 'dt-row-meta' },
1352
- h('span', { className: 'dt-hint' }, '限额、优先级与隔离保留策略'),
1666
+ // 标题也要按类型分流:PR 守没有隔离配置,标题再写「隔离保留策略」就是误导
1667
+ // (2026-11-13 真实 Chromium 复验 B7 最后一处)。
1668
+ h('span', { className: 'dt-hint' },
1669
+ values.watchKind === 'pr' ? '限额与优先级' : '限额、优先级与隔离保留策略'),
1353
1670
  // 收起时只展示默认值摘要,不挂载高级 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
- }))
1671
+ // `when` 必须和 renderField 走同一套判断:只按 advanced+number 过滤时,
1672
+ // 真正的高级 input 已经被隐藏,摘要却仍把「隔离区保留天数 / 最多保留几个隔离区」
1673
+ // 显示出来(2026-11-13 真实 Chromium 复验 B7 遗漏)。
1674
+ WATCHER_FIELD_SCHEMA
1675
+ .filter((spec) => spec.advanced && spec.kind === 'number')
1676
+ .filter((spec) => !spec.when || spec.when(values))
1677
+ .map((spec) => {
1678
+ const placeholder = typeof spec.placeholder === 'function' ? spec.placeholder(defaults) : spec.placeholder
1679
+ return h('span', { key: spec.key, className: 'dt-hint', placeholder }, spec.label + ' ' + placeholder)
1680
+ }))
1358
1681
  const submitFromClick = (event) => submit(event)
1359
1682
  return h('form', {
1360
1683
  id: idPrefix, ref: formRef, className: 'dt-form dt-card', 'data-mode': mode, onSubmit: submit,
@@ -1365,6 +1688,7 @@ window.__ModuleLoader__.load({
1365
1688
  if ((!next || !event.currentTarget.contains(next)) && !(busyRef.current && !next)) formFocusedRef.current = false
1366
1689
  },
1367
1690
  },
1691
+ typeof targetControl === 'function' ? targetControl(busy) : targetControl,
1368
1692
  h(Fields, { disabled: busy || disabled },
1369
1693
  basic,
1370
1694
  h(DisclosureRow, {
@@ -1384,11 +1708,388 @@ window.__ModuleLoader__.load({
1384
1708
  }
1385
1709
 
1386
1710
  function KeyValues({ rows }) {
1711
+ // 与官方 widgets.tsx 一致:每对 dt/dd 都由 display:contents 行容器包裹。
1387
1712
  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
- ]))
1713
+ rows.filter(Boolean).map(([key, value], index) => h('div', { key: String(key) + '-' + index, style: { display: 'contents' } },
1714
+ h('dt', null, key),
1715
+ h('dd', null, value))))
1716
+ }
1717
+
1718
+ function LabelValue({ label, value }) {
1719
+ return h('span', { className: 'dt-lv' },
1720
+ h('span', { className: 'dt-section-sub' }, label),
1721
+ ' ',
1722
+ h('span', { className: 'dt-lv-value' }, value))
1723
+ }
1724
+
1725
+ function StageMark({ state, icon, label }) {
1726
+ return h('span', { className: 'dt-stage', 'data-state': state },
1727
+ state === 'ongoing' ? h(StateDot, { state: 'ongoing' }) : h(Icon, { name: icon, size: 14 }),
1728
+ label)
1729
+ }
1730
+
1731
+ // 模块化房间只复用现有 Section/Btn/KeyValues/TicketLine 结构;动作由宿主数据层注入,
1732
+ // 浏览器视图不自行臆造 HTTP 路径。未知计数必须显式写“未知”,不能用 || 0 吞掉 null。
1733
+ const MODULAR_VIEW_TEXT = {
1734
+ zh: {
1735
+ tab: '房间', records: 'Ticket records', execution: '当前执行', health: '部署与健康', outbox: 'Outbox', draft: '草稿',
1736
+ unknown: '未知', none: '无', yes: '是', no: '否', all: '全部', filterEmpty: '当前筛选没有 Ticket。',
1737
+ total: '总数', open: '待接单', assigned: '执行中', waiting: '等待', ended: '已结束',
1738
+ currentTicket: '当前 Ticket', assignment: 'Assignment', session: '会话', running: '运行中', queued: '排队',
1739
+ active: '活跃 Ticket', maxWorkers: 'worker 上限', paused: '已暂停', status: '状态', stateDir: '状态目录', problem: '问题',
1740
+ pending: '待发送', sending: '发送中', sent: '已发送', failed: '失败', gone: '已失效',
1741
+ attempts: '尝试', history: '历史', resumes: '恢复次数', workdir: '工作目录',
1742
+ createdAt: '创建时间', updatedAt: '更新时间', endedAt: '结束时间', endReason: '结束原因',
1743
+ recordsUnknown: 'Ticket records 未知。', recordsEmpty: '没有 Ticket records。',
1744
+ executionUnknown: '当前执行未知。', executionEmpty: '当前没有执行。',
1745
+ executionIntro: '这里显示当前 Ticket、执行 Assignment 与 worker 负载;停止的是当前 Ticket,不是全局暂停。',
1746
+ executorRunning: '执行器运行中', processingPaused: 'worker 执行已暂停', executionIdle: '当前没有执行',
1747
+ pauseProcessing: '暂停 worker', resumeProcessing: '恢复 worker', pauseMessage: '只暂停或恢复新的 worker 自动执行;inline 会话的既有唤醒规则不变。',
1748
+ openSession: '打开 Session',
1749
+ healthUnknown: '健康项未知。', healthEmpty: '没有健康项。',
1750
+ outboxUnknown: 'Outbox 未知。', outboxEmpty: 'Outbox 为空。', draftUnknown: '草稿未知。',
1751
+ back: '返回 Ticket records', identifiers: '标识与执行信息',
1752
+ resume: '恢复', stop: '停止', flush: '发送 Outbox', save: '保存草稿', clear: '清空草稿',
1753
+ confirm: '确认', cancel: '取消', resumeTitle: '恢复 Ticket', stopTitle: '停止 Ticket',
1754
+ resumeMessage: (id) => '确定要恢复 ' + id + ' 吗?恢复后仍需等待新的执行分派。',
1755
+ stopMessage: (id) => '确定要停止 ' + id + ' 吗?当前执行会结束。',
1756
+ draftValue: '草稿内容', revision: 'revision', phase: '阶段', dirty: '已有修改', unsaved: '未保存',
1757
+ discard: '放弃修改', saving: '保存中…', saveFailed: '保存失败,草稿仍保留在本地。',
1758
+ clearFailed: '清空失败,草稿仍保留。', invalidJson: '草稿必须是合法 JSON。',
1759
+ states: {
1760
+ open: '待接单', assigned: '执行中', waiting: '等待', ended: '已结束',
1761
+ pending: '待发送', sending: '发送中', sent: '已发送', failed: '失败', gone: '已失效',
1762
+ ready: '就绪', error: '异常', starting: '启动中', paused: '已暂停', unknown: '未知',
1763
+ clean: '干净', editing: '编辑中',
1764
+ },
1765
+ },
1766
+ en: {
1767
+ tab: 'Rooms', records: 'Ticket records', execution: 'Current execution', health: 'Deployment & health', outbox: 'Outbox', draft: 'Draft',
1768
+ unknown: 'Unknown', none: 'None', yes: 'Yes', no: 'No', all: 'All', filterEmpty: 'No Tickets match this filter.',
1769
+ total: 'Total', open: 'Open', assigned: 'Assigned', waiting: 'Waiting', ended: 'Ended',
1770
+ currentTicket: 'Current Ticket', assignment: 'Assignment', session: 'Session', running: 'Running', queued: 'Queued',
1771
+ active: 'Active Tickets', maxWorkers: 'Worker limit', paused: 'Paused', status: 'Status', stateDir: 'State directory', problem: 'Problem',
1772
+ pending: 'Pending', sending: 'Sending', sent: 'Sent', failed: 'Failed', gone: 'Gone',
1773
+ attempts: 'Attempts', history: 'History', resumes: 'Resumes', workdir: 'Working directory',
1774
+ createdAt: 'Created', updatedAt: 'Updated', endedAt: 'Ended at', endReason: 'End reason',
1775
+ recordsUnknown: 'Ticket records are unknown.', recordsEmpty: 'No Ticket records.',
1776
+ executionUnknown: 'Current execution is unknown.', executionEmpty: 'No current execution.',
1777
+ executionIntro: 'Shows the current Ticket, Assignment, and worker load. Stop ends the current Ticket; it is not a global pause.',
1778
+ executorRunning: 'Executor running', processingPaused: 'Worker execution paused', executionIdle: 'No current execution',
1779
+ pauseProcessing: 'Pause workers', resumeProcessing: 'Resume workers', pauseMessage: 'Pause or resume new automatic worker execution only; existing inline wake rules are unchanged.',
1780
+ openSession: 'Open Session',
1781
+ healthUnknown: 'Health entries are unknown.', healthEmpty: 'No health entries.',
1782
+ outboxUnknown: 'Outbox is unknown.', outboxEmpty: 'Outbox is empty.', draftUnknown: 'Draft is unknown.',
1783
+ back: 'Back to Ticket records', identifiers: 'Identifiers & execution',
1784
+ resume: 'Resume', stop: 'Stop', flush: 'Flush outbox', save: 'Save draft', clear: 'Clear draft',
1785
+ confirm: 'Confirm', cancel: 'Cancel', resumeTitle: 'Resume Ticket', stopTitle: 'Stop Ticket',
1786
+ resumeMessage: (id) => 'Resume ' + id + '? A new Assignment is still required before work can continue.',
1787
+ stopMessage: (id) => 'Stop ' + id + '? The current execution will end.',
1788
+ draftValue: 'Draft value', revision: 'Revision', phase: 'Phase', dirty: 'Modified', unsaved: 'Unsaved changes',
1789
+ discard: 'Discard changes', saving: 'Saving…', saveFailed: 'Save failed. Your local draft is preserved.',
1790
+ clearFailed: 'Clear failed. Your draft is preserved.', invalidJson: 'Draft must be valid JSON.',
1791
+ states: {
1792
+ open: 'Open', assigned: 'Assigned', waiting: 'Waiting', ended: 'Ended',
1793
+ pending: 'Pending', sending: 'Sending', sent: 'Sent', failed: 'Failed', gone: 'Gone',
1794
+ ready: 'Ready', error: 'Error', starting: 'Starting', paused: 'Paused', unknown: 'Unknown',
1795
+ clean: 'Clean', editing: 'Editing',
1796
+ },
1797
+ },
1798
+ }
1799
+
1800
+ function modularCopy(locale) {
1801
+ const tag = String(locale || '').trim().toLowerCase().replaceAll('_', '-')
1802
+ return MODULAR_VIEW_TEXT[tag === 'en' || tag.startsWith('en-') ? 'en' : 'zh']
1803
+ }
1804
+
1805
+ function modularCount(value, copy) {
1806
+ return value === null || value === undefined ? copy.unknown : String(value)
1807
+ }
1808
+
1809
+ function modularValue(value, copy) {
1810
+ if (value === null || value === undefined) return copy.unknown
1811
+ if (typeof value === 'string') return value || copy.none
1812
+ if (typeof value === 'number' || typeof value === 'boolean') return String(value)
1813
+ try { return JSON.stringify(value) } catch { return copy.unknown }
1814
+ }
1815
+
1816
+ function modularState(value, copy) {
1817
+ return (value && copy.states[value]) || value || copy.unknown
1818
+ }
1819
+
1820
+ function ModularDraft({ draft, ticketId, copy, onSave, onClear }) {
1821
+ // 生产 /draft 的 value 是 {ticketId, body:string};编辑器只改 body,
1822
+ // 不能把整个 value 对象 String 成 "[object Object]" 再交给服务端。
1823
+ const bodyValue = draft.value && typeof draft.value === 'object' && typeof draft.value.body === 'string'
1824
+ const plainText = typeof draft.value === 'string' || bodyValue
1825
+ const initial = typeof draft.value === 'string'
1826
+ ? draft.value
1827
+ : bodyValue ? draft.value.body : JSON.stringify(draft.value === undefined ? null : draft.value, null, 2)
1828
+ const storageKey = 'dsh-session-superagent:draft:' + String(ticketId || 'unknown')
1829
+ const [value, setValue] = useState(() => {
1830
+ try {
1831
+ const stored = JSON.parse(globalThis.sessionStorage.getItem(storageKey) || 'null')
1832
+ if (stored && typeof stored.body === 'string' && Number.isInteger(stored.revision) && stored.revision <= draft.revision) return stored.body
1833
+ } catch {}
1834
+ return initial
1835
+ })
1836
+ const [error, setError] = useState(null)
1837
+ const [busy, setBusy] = useState(false)
1838
+ const busyRef = useRef(false)
1839
+ const previousInitial = useRef(initial)
1840
+ useEffect(() => {
1841
+ try { globalThis.sessionStorage.setItem(storageKey, JSON.stringify({ ticketId, body: value, revision: draft.revision })) } catch {}
1842
+ }, [storageKey, ticketId, value, draft.revision])
1843
+ useEffect(() => {
1844
+ // 409 后回读会推进服务端 revision;本地已编辑文本必须保留。
1845
+ // 只有用户没有未保存修改时,才跟随另一标签页/服务端的新值。
1846
+ if (value === previousInitial.current) setValue(initial)
1847
+ previousInitial.current = initial
1848
+ }, [initial])
1849
+ const dirty = value !== initial || draft.dirty === true
1850
+ const save = async (event) => {
1851
+ if (event && typeof event.preventDefault === 'function') event.preventDefault()
1852
+ if (busyRef.current || !dirty || !onSave) return false
1853
+ let body = value
1854
+ if (!plainText) {
1855
+ try { body = JSON.parse(value) } catch {
1856
+ setError(copy.invalidJson)
1857
+ return false
1858
+ }
1859
+ }
1860
+ busyRef.current = true
1861
+ setBusy(true)
1862
+ setError(null)
1863
+ try {
1864
+ const result = await onSave(body, { ticketId, body, revision: draft.revision })
1865
+ if (result === false) setError(copy.saveFailed)
1866
+ return result
1867
+ } catch (failure) {
1868
+ setError(String((failure && failure.message) || failure || copy.saveFailed))
1869
+ return false
1870
+ } finally {
1871
+ busyRef.current = false
1872
+ setBusy(false)
1873
+ }
1874
+ }
1875
+ const clear = async () => {
1876
+ if (busyRef.current || !onClear) return false
1877
+ busyRef.current = true
1878
+ setBusy(true)
1879
+ setError(null)
1880
+ try {
1881
+ const result = await onClear({ ticketId, revision: draft.revision, clear: true })
1882
+ if (result === false) setError(copy.clearFailed)
1883
+ else setValue('')
1884
+ return result
1885
+ } catch (failure) {
1886
+ setError(String((failure && failure.message) || failure || copy.clearFailed))
1887
+ return false
1888
+ } finally {
1889
+ busyRef.current = false
1890
+ setBusy(false)
1891
+ }
1892
+ }
1893
+ return h('form', { className: 'dt-form', onSubmit: save },
1894
+ h(KeyValues, { rows: [
1895
+ [copy.revision, modularCount(draft.revision, copy)],
1896
+ [copy.phase, modularState(draft.phase, copy)],
1897
+ [copy.dirty, draft.dirty === true ? copy.yes : draft.dirty === false ? copy.no : copy.unknown],
1898
+ ] }),
1899
+ h(Fields, { disabled: busy },
1900
+ h(Field, { id: 'modular-draft-body', label: copy.draftValue },
1901
+ h('textarea', {
1902
+ className: 'dt-textarea', rows: 6, value, spellCheck: false,
1903
+ 'aria-label': copy.draftValue,
1904
+ onChange: (event) => { setError(null); setValue(event.target.value) },
1905
+ }))),
1906
+ h(SaveBar, {
1907
+ dirty, busy, error, disabled: !onSave,
1908
+ onDiscard: () => { setError(null); setValue(initial) },
1909
+ onSave: save, saveLabel: copy.save, discardLabel: copy.discard,
1910
+ status: dirty ? copy.unsaved : undefined, busyLabel: copy.saving,
1911
+ }),
1912
+ h('div', { className: 'dt-danger-zone' },
1913
+ h('span', { className: 'dt-hint' }, copy.draftValue + ' · ' + modularState(draft.phase, copy)),
1914
+ h(Btn, {
1915
+ size: 'sm', variant: 'outline', 'aria-label': copy.clear, disabled: busy || !onClear, onClick: clear,
1916
+ }, copy.clear)))
1917
+ }
1918
+
1919
+ function ModularView({ data, actions, onAction, onOpenSession }) {
1920
+ const source = data && typeof data === 'object' ? data : {}
1921
+ const records = source.records && typeof source.records === 'object' ? source.records : {}
1922
+ const execution = source.execution && typeof source.execution === 'object' ? source.execution : {}
1923
+ const deployment = source.deployment && typeof source.deployment === 'object' ? source.deployment : {}
1924
+ const outbox = records.outbox && typeof records.outbox === 'object'
1925
+ ? records.outbox
1926
+ : (execution.outbox && typeof execution.outbox === 'object' ? execution.outbox : {})
1927
+ const copy = modularCopy(source.locale)
1928
+ const available = (name) => Boolean((actions && typeof actions[name] === 'function') || typeof onAction === 'function')
1929
+ const perform = (name, args = [], payload) => {
1930
+ if (actions && typeof actions[name] === 'function') return actions[name](...args)
1931
+ if (typeof onAction === 'function') return onAction(name, payload)
1932
+ return false
1933
+ }
1934
+ const current = execution.current && typeof execution.current === 'object' ? execution.current : null
1935
+ const assignment = execution.assignment && typeof execution.assignment === 'object' ? execution.assignment : null
1936
+ const currentTicketId = (current && current.id) || (assignment && assignment.ticketId) || null
1937
+ const draft = source.draft && typeof source.draft === 'object' ? source.draft : null
1938
+ const draftTicketId = (draft && (draft.ticketId || (draft.value && draft.value.ticketId))) || currentTicketId
1939
+ || (Array.isArray(records.records) && records.records[0] && records.records[0].id) || null
1940
+ const ticketRows = Array.isArray(records.records) ? records.records : []
1941
+ const healthRows = Array.isArray(deployment.health) ? deployment.health : []
1942
+ const outboxRows = Array.isArray(outbox.records) ? outbox.records : []
1943
+ const [ticketFilter, setTicketFilter] = useState('all')
1944
+ const [selectedTicketId, setSelectedTicketId] = useState(null)
1945
+ const selectedTicket = ticketRows.find((record) => record && record.id === selectedTicketId) || null
1946
+ const visibleTickets = ticketFilter === 'all' ? ticketRows : ticketRows.filter((record) => record && record.status === ticketFilter)
1947
+ const stageProps = (status) => status === 'assigned'
1948
+ ? { state: 'ongoing', icon: 'refresh' }
1949
+ : status === 'waiting' ? { state: 'warning', icon: 'clock' }
1950
+ : status === 'ended' ? { state: 'idle', icon: 'stop' } : { state: 'idle', icon: 'inbox' }
1951
+ const actionButtons = (ticketId, status) => {
1952
+ // ticket-state:只有 ended 才能被显式人类 resume;已结束的执行不再 stop。
1953
+ const canResume = Boolean(ticketId && status === 'ended' && available('resume'))
1954
+ const canStop = Boolean(ticketId && status && status !== 'ended' && available('stop'))
1955
+ return h(React.Fragment, null,
1956
+ h(Btn, {
1957
+ size: 'sm', variant: 'ghost', 'aria-label': copy.resume, disabled: !canResume,
1958
+ onClick: () => canResume ? perform('resume', [ticketId], { ticketId }) : false,
1959
+ }, copy.resume),
1960
+ h(ConfirmButton, {
1961
+ size: 'sm', variant: 'outline', label: copy.stop, confirmLabel: copy.stop, disabled: !canStop,
1962
+ title: copy.stopTitle, message: copy.stopMessage(ticketId),
1963
+ onConfirm: () => canStop ? perform('stop', [ticketId], { ticketId }) : false,
1964
+ }))
1965
+ }
1966
+
1967
+ return h('div', { className: 'dt-column' },
1968
+ h(Section, { title: copy.records, count: modularCount(records.total, copy) },
1969
+ h('div', { className: 'dt-filters', role: 'group', 'aria-label': copy.records }, ['all', 'open', 'assigned', 'waiting', 'ended'].map((key) =>
1970
+ h(Pill, {
1971
+ key, active: ticketFilter === key, 'aria-label': copy[key], 'aria-pressed': ticketFilter === key,
1972
+ onClick: () => { setTicketFilter(key); setSelectedTicketId(null) },
1973
+ }, copy[key] + ' ' + (key === 'all' ? modularCount(records.total, copy) : modularCount(records.counts && records.counts[key], copy))))),
1974
+ selectedTicket ? h('div', { className: 'dt-column' },
1975
+ h('div', { className: 'dt-page-head' },
1976
+ h(Btn, { variant: 'ghost', size: 'sm', icon: h(Icon, { name: 'chevron-left' }), 'aria-label': copy.back, onClick: () => setSelectedTicketId(null) }, copy.back),
1977
+ h('h1', { className: 'dt-title' }, selectedTicket.id),
1978
+ h(StageMark, { ...stageProps(selectedTicket.status), label: modularState(selectedTicket.status, copy) })),
1979
+ h(KeyValues, { rows: [
1980
+ [copy.currentTicket, h('span', { className: 'dt-mono' }, selectedTicket.id)],
1981
+ ['Thread', h('span', { className: 'dt-mono' }, modularValue(selectedTicket.threadKey, copy))],
1982
+ [copy.session, selectedTicket.ownerSessionId ? h('span', null,
1983
+ h('span', { className: 'dt-mono' }, selectedTicket.ownerSessionId), ' ',
1984
+ h(Btn, { size: 'sm', variant: 'ghost', 'aria-label': copy.openSession, disabled: !onOpenSession, onClick: () => onOpenSession(selectedTicket.ownerSessionId) }, copy.openSession)) : modularValue(selectedTicket.ownerSessionId, copy)],
1985
+ [copy.assignment, modularValue(selectedTicket.assignmentId, copy)],
1986
+ [copy.workdir, h('span', { className: 'dt-mono' }, modularValue(selectedTicket.workdir, copy))],
1987
+ [copy.resumes, modularCount(selectedTicket.resumeCount, copy)],
1988
+ [copy.history, modularCount(selectedTicket.historyCount, copy)],
1989
+ [copy.createdAt, modularValue(selectedTicket.createdAt, copy)],
1990
+ [copy.updatedAt, modularValue(selectedTicket.updatedAt, copy)],
1991
+ [copy.endedAt, modularValue(selectedTicket.endedAt, copy)],
1992
+ [copy.endReason, modularValue(selectedTicket.endReason, copy)],
1993
+ ] }),
1994
+ h('div', { className: 'dt-danger-zone' },
1995
+ h('span', { className: 'dt-hint' }, selectedTicket.id),
1996
+ h('div', { className: 'dt-ticket-actions' }, actionButtons(selectedTicket.id, selectedTicket.status))))
1997
+ : records.records === null || records.records === undefined
1998
+ ? h(Hint, null, copy.recordsUnknown)
1999
+ : visibleTickets.length === 0
2000
+ ? h(Hint, null, ticketRows.length === 0 ? copy.recordsEmpty : copy.filterEmpty)
2001
+ : h('ul', { className: 'dt-list' }, visibleTickets.map((record, index) => {
2002
+ const ticketId = record && record.id
2003
+ return h('li', { key: ticketId || index, className: 'dt-row dt-ticket', 'data-state': record && record.status === 'assigned' ? 'ongoing' : 'idle' },
2004
+ h('div', { className: 'dt-ticket-stage' }, h(StageMark, { ...stageProps(record && record.status), label: modularState(record && record.status, copy) })),
2005
+ h('div', { className: 'dt-ticket-body' },
2006
+ h('div', { className: 'dt-row-title' },
2007
+ h('button', { type: 'button', className: 'dt-open', 'aria-label': ticketId || copy.unknown, onClick: () => setSelectedTicketId(ticketId) }, ticketId || copy.unknown)),
2008
+ h('div', { className: 'dt-row-meta' },
2009
+ h('span', null, (record && record.threadKey) || copy.unknown),
2010
+ h('span', null, copy.resumes + ' ' + modularCount(record && record.resumeCount, copy)),
2011
+ h('span', null, copy.history + ' ' + modularCount(record && record.historyCount, copy))),
2012
+ h('div', { className: 'dt-ticket-actions' }, actionButtons(ticketId, record && record.status))))
2013
+ }))),
2014
+
2015
+ h(Section, { title: copy.execution, count: modularCount(execution.activeCount, copy) },
2016
+ h(Hint, null, copy.executionIntro),
2017
+ h('div', { className: 'dt-row-meta dt-status-line' },
2018
+ h('span', { className: 'dt-status-text', 'data-state': execution.paused === true ? 'warning' : current ? 'ongoing' : 'idle' },
2019
+ execution.paused === true ? copy.processingPaused : current ? copy.executorRunning : copy.executionIdle),
2020
+ h(LabelValue, { label: copy.running, value: modularCount(execution.running, copy) + ' / ' + modularCount(execution.maxWorkers, copy) }),
2021
+ h(LabelValue, { label: copy.queued, value: modularCount(execution.queued, copy) }),
2022
+ available('pauseProcessing') ? h(ConfirmButton, {
2023
+ variant: 'outline', size: 'sm', label: execution.paused === true ? copy.resumeProcessing : copy.pauseProcessing,
2024
+ confirmLabel: copy.confirm, title: execution.paused === true ? copy.resumeProcessing : copy.pauseProcessing,
2025
+ message: copy.pauseMessage,
2026
+ onConfirm: () => perform('pauseProcessing', [!execution.paused], { paused: !execution.paused }),
2027
+ }) : null),
2028
+ !current && !assignment ? h(Hint, null, execution.total === null || execution.total === undefined ? copy.executionUnknown : copy.executionEmpty) : null,
2029
+ h(KeyValues, { rows: [
2030
+ [copy.currentTicket, current && current.id ? current.id : execution.total === null || execution.total === undefined ? copy.unknown : copy.none],
2031
+ [copy.assignment, assignment && assignment.id ? assignment.id : execution.total === null || execution.total === undefined ? copy.unknown : copy.none],
2032
+ [copy.session, assignment ? modularValue(assignment.sessionId, copy) : execution.total === 0 ? copy.none : copy.unknown],
2033
+ [copy.paused, execution.paused === true ? copy.yes : execution.paused === false ? copy.no : copy.unknown],
2034
+ ] }),
2035
+ currentTicketId ? h('div', { className: 'dt-actions' }, actionButtons(currentTicketId, (current && current.status) || (assignment && assignment.status))) : null),
2036
+
2037
+ h(Section, { title: copy.health, count: modularCount(deployment.counts && deployment.counts.total, copy) },
2038
+ h(KeyValues, { rows: [
2039
+ [copy.status, modularState(deployment.status, copy)],
2040
+ [copy.stateDir, modularValue(deployment.stateDir, copy)],
2041
+ ] }),
2042
+ deployment.problem !== null && deployment.problem !== undefined
2043
+ ? h('div', { className: 'dt-banner dt-danger' }, copy.problem + ': ' + modularValue(deployment.problem, copy)) : null,
2044
+ deployment.health === null || deployment.health === undefined
2045
+ ? h(Hint, null, copy.healthUnknown)
2046
+ : healthRows.length === 0
2047
+ ? h(Hint, null, copy.healthEmpty)
2048
+ : h('ul', { className: 'dt-list' }, healthRows.map((entry, index) => h('li', {
2049
+ key: (entry && entry.name) || index, className: 'dt-row',
2050
+ },
2051
+ h('div', { className: 'dt-row-main' },
2052
+ h('div', { className: 'dt-row-title' },
2053
+ h(StateDot, { state: entry && entry.state === 'ready' ? 'done' : entry && entry.state === 'error' ? 'error' : entry && entry.state === 'starting' ? 'ongoing' : 'idle' }),
2054
+ h('span', { className: 'dt-row-name' }, (entry && entry.name) || copy.unknown),
2055
+ h(Tag, { tone: entry && entry.state === 'error' ? 'danger' : entry && entry.state === 'ready' ? 'success' : 'outline' }, modularState(entry && entry.state, copy))),
2056
+ h('div', { className: 'dt-row-meta' },
2057
+ h('span', null, (entry && (entry.code || entry.detail)) || copy.none),
2058
+ entry && entry.at ? h('time', { dateTime: entry.at, title: entry.at }, entry.at) : null)))))),
2059
+
2060
+ h(Section, {
2061
+ title: copy.outbox, count: modularCount(outbox.total, copy),
2062
+ action: h(Btn, { size: 'sm', variant: 'outline', 'aria-label': copy.flush, disabled: !available('flush'), onClick: () => perform('flush') }, copy.flush),
2063
+ },
2064
+ h('div', { className: 'dt-row-meta' }, ['pending', 'sending', 'sent', 'failed', 'gone'].map((key) =>
2065
+ h(Tag, { key, tone: key === 'failed' ? 'danger' : key === 'sent' ? 'success' : 'outline' },
2066
+ copy[key] + ' ' + modularCount(outbox.counts && outbox.counts[key], copy)))),
2067
+ outbox.records === null || outbox.records === undefined
2068
+ ? h(Hint, null, copy.outboxUnknown)
2069
+ : outboxRows.length === 0
2070
+ ? h(Hint, null, copy.outboxEmpty)
2071
+ : h('ul', { className: 'dt-list' }, outboxRows.map((message, index) => h('li', {
2072
+ key: (message && message.id) || index, className: 'dt-row',
2073
+ },
2074
+ h('div', { className: 'dt-row-main' },
2075
+ h('div', { className: 'dt-row-title' },
2076
+ h(StateDot, { state: message && message.status === 'failed' ? 'error' : message && message.status === 'sent' ? 'done' : message && message.status === 'sending' ? 'ongoing' : 'idle' }),
2077
+ h('span', { className: 'dt-row-name' }, (message && message.id) || copy.unknown),
2078
+ h(Tag, { tone: message && message.status === 'failed' ? 'danger' : message && message.status === 'sent' ? 'success' : 'outline' }, modularState(message && message.status, copy))),
2079
+ h('div', { className: 'dt-row-meta' },
2080
+ h('span', null, (message && message.ticketId) || copy.unknown),
2081
+ h('span', null, copy.attempts + ' ' + modularCount(message && message.attempts, copy))),
2082
+ message && message.lastError ? h('div', { className: 'dt-error', role: 'alert' }, message.lastError) : null,
2083
+ message && message.body ? h('div', { className: 'dt-row-quote', title: message.body }, message.body) : null))))),
2084
+
2085
+ h(Section, { title: copy.draft },
2086
+ draft
2087
+ ? h(ModularDraft, {
2088
+ key: 'modular-draft-' + String(draftTicketId || 'unknown'), draft, ticketId: draftTicketId, copy,
2089
+ onSave: available('save') ? (body, context) => perform('save', [body, context], context) : null,
2090
+ onClear: available('clear') ? (context) => perform('clear', [context], context) : null,
2091
+ })
2092
+ : h(Hint, null, copy.draftUnknown)))
1392
2093
  }
1393
2094
 
1394
2095
  // 官方 Modal 的键盘行为:Escape 关闭 + Tab 焦点陷阱 + 关闭后焦点回到触发元素。
@@ -1409,6 +2110,17 @@ window.__ModuleLoader__.load({
1409
2110
  }
1410
2111
  }
1411
2112
 
2113
+ /**
2114
+ * 本地 Modal 的 portal 宿主。只有真实可挂载的 body 才接;
2115
+ * 非 DOM/老宿主拿不到时返回 null,保持内联渲染(不另建第二个 root)。
2116
+ */
2117
+ function localModalHost() {
2118
+ if (typeof document === 'undefined' || !document.body) return null
2119
+ const host = document.body
2120
+ if (typeof host.appendChild !== 'function' || typeof host.contains !== 'function') return null
2121
+ return host
2122
+ }
2123
+
1412
2124
  function Modal({ open, title, description, footer, className, children, onClose }) {
1413
2125
  const dialog = useRef(null)
1414
2126
  const restoreTo = useRef(null)
@@ -1445,7 +2157,7 @@ window.__ModuleLoader__.load({
1445
2157
  }, [open])
1446
2158
  if (!open) return null
1447
2159
  // class 必须与移植来的官方 CSS 对齐:dt-modal-root / dt-modal-mask / dt-modal-header
1448
- return h('div', { className: 'dt-modal-root' },
2160
+ const root = h('div', { className: 'dt-modal-root' },
1449
2161
  h('div', { className: 'dt-modal-mask', role: 'presentation', onClick: onClose }),
1450
2162
  h('div', {
1451
2163
  ref: dialog, tabIndex: -1,
@@ -1458,6 +2170,10 @@ window.__ModuleLoader__.load({
1458
2170
  description ? h('p', { className: 'dt-modal-description' }, description) : null,
1459
2171
  children !== undefined && children !== null ? h('div', { className: 'dt-modal-body' }, children) : null,
1460
2172
  footer !== undefined ? h('div', { className: 'dt-modal-footer' }, footer) : null))
2173
+ // Issue #35:确认层 portal 到 body,dock 的 transform/contain 祖先就裁不到它。
2174
+ // createPortal 不可用(老宿主/非 DOM)时退回内联,语义与之前完全一致。
2175
+ const host = localCreatePortal ? localModalHost() : null
2176
+ return host ? localCreatePortal(root, host) : root
1461
2177
  }
1462
2178
 
1463
2179
  // 主面板使用 DSH Modal;没有宿主原语时回退到上面的 superagent 同源实现。
@@ -1465,7 +2181,7 @@ window.__ModuleLoader__.load({
1465
2181
  const PanelModal = hostUi ? hostUi.Modal : Modal
1466
2182
 
1467
2183
  /** 确认层与触发器分离: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 = '安装进行中,完成后才能关闭' }) {
2184
+ 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
2185
  const [busy, setBusy] = useState(false)
1470
2186
  const busyRef = useRef(false)
1471
2187
  const dismiss = () => {
@@ -1501,7 +2217,7 @@ window.__ModuleLoader__.load({
1501
2217
  description: message || ('确定要执行「' + label + '」操作吗?'),
1502
2218
  onClose: dismiss,
1503
2219
  footer: h(React.Fragment, null,
1504
- h(ButtonComponent, { variant: 'ghost', disabled: preventDismissOnBusy && busy, onClick: dismiss }, '取消'),
2220
+ h(ButtonComponent, { variant: 'ghost', disabled: preventDismissOnBusy && busy, onClick: dismiss }, cancelLabel),
1505
2221
  h(ButtonComponent, {
1506
2222
  variant: 'primary',
1507
2223
  className: cx(danger && 'dt-danger', busy && 'dt-btn-busy'),
@@ -1514,7 +2230,7 @@ window.__ModuleLoader__.load({
1514
2230
  }
1515
2231
 
1516
2232
  /** 官方 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 }) {
2233
+ 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
2234
  const [open, setOpen] = useState(false)
1519
2235
  const close = useCallback(() => setOpen(false), [])
1520
2236
  return h(React.Fragment, null,
@@ -1523,14 +2239,15 @@ window.__ModuleLoader__.load({
1523
2239
  size,
1524
2240
  icon,
1525
2241
  'aria-label': label,
1526
- 'aria-haspopup': 'dialog',
2242
+ 'aria-haspopup': 'dialog', ...(disabled ? { disabled: true } : {}),
1527
2243
  onClick: () => {
2244
+ if (disabled) return
1528
2245
  // 打开前先跑调用方的清理(例如清掉上一次「删除失败」);打开行为本身不变。
1529
2246
  if (typeof onOpen === 'function') onOpen()
1530
2247
  setOpen(true)
1531
2248
  },
1532
2249
  }, label),
1533
- h(ConfirmDialog, { open, label, confirmLabel, title, message, onConfirm, onClose: close, modalContext, ButtonComponent, danger, preventDismissOnBusy, error, busyLabel, busyHint }))
2250
+ h(ConfirmDialog, { open, label, confirmLabel, cancelLabel, title, message, onConfirm, onClose: close, modalContext, ButtonComponent, danger, preventDismissOnBusy, error, busyLabel, busyHint }))
1534
2251
  }
1535
2252
 
1536
2253
  const watcherId = (w) => (w && w.id) || String((w && w.repo) || '') + '#' + String((w && w.sessionId) || '')
@@ -1548,23 +2265,32 @@ window.__ModuleLoader__.load({
1548
2265
  // paused, red = last poll failed. Icon only — details live in the
1549
2266
  // click-through panel, and a native tooltip carries the one-line summary.
1550
2267
  /**
1551
- * 现在是否落在活跃时段里。支持跨夜(22:00-06:00)。
1552
- * 解析不了就返回 null —— 宁可显示「主理中」,也不要乱标。
2268
+ * 现在是否落在活跃时段里。支持跨夜(22:00-06:00)与逗号/分号多段,任一段命中即可。
2269
+ * 任一段解析不了就整串返回 null —— 宁可显示「主理中」,也不要乱标。
1553
2270
  */
1554
2271
  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
2272
+ const segments = String(hours || '').split(/[,;]/).map((segment) => segment.trim())
2273
+ if (segments.some((segment) => !segment)) return null
2274
+ const parsed = []
2275
+ for (const segment of segments) {
2276
+ const match = segment.match(/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/)
2277
+ if (!match) return null
2278
+ const parts = match.slice(1).map(Number)
2279
+ if (parts[0] > 23 || parts[2] > 23 || parts[1] > 59 || parts[3] > 59) return null
2280
+ parsed.push({ from: parts[0] * 60 + parts[1], to: parts[2] * 60 + parts[3] })
2281
+ }
1557
2282
  const now = new Date()
1558
2283
  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
2284
+ return parsed.some(({ from, to }) => from === to
2285
+ ? true
2286
+ : from < to ? current >= from && current < to : current >= from || current < to)
1562
2287
  }
1563
2288
 
1564
2289
  function orbitStateOf(w) {
1565
2290
  if (!w) return 'paused'
1566
2291
  // 历史数据里可能残留「gh: HTTP 304」这类不是错误的记录 —— 不把它当异常
1567
2292
  if (w.lastError && !/HTTP 304|304 Not Modified/i.test(String(w.lastError))) return 'error'
2293
+ if (w.poll && POLL_STALE_TEXT[w.poll]) return 'error'
1568
2294
  if (w.enabled === false) return 'paused'
1569
2295
  // 设了活跃时段、而此刻在窗口外:它其实不会唤醒,只是把条目攒着 ——
1570
2296
  // 这时候还标「主理中」就是在骗人(2026-11-02 用户截图指出)。
@@ -1640,6 +2366,22 @@ window.__ModuleLoader__.load({
1640
2366
  h('g', null, spin, dots))
1641
2367
  }
1642
2368
 
2369
+ // 官方品牌鲸鱼(assets/brand/whale-dark.svg):只取主轮廓与尾鳍两段子路径。
2370
+ // 官方 path 还带眼睛和腹部纹理,16px 缩到一行时会糊成一团;去掉细节后是一笔清楚的线稿。
2371
+ // 用 stroke 描边、不填色,也不引入位图或底色 —— 头部入口、左栏与右栏标题都用它当品牌标记。
2372
+ 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'
2373
+
2374
+ function DeepSeekWhaleMark(props = {}) {
2375
+ const size = Number(props.size) || 16
2376
+ return h('svg', {
2377
+ width: size, height: size, viewBox: '0 0 50 50', fill: 'none',
2378
+ 'aria-hidden': 'true', style: { overflow: 'visible' },
2379
+ }, h('path', {
2380
+ d: WHALE_PATH, fill: 'none', stroke: 'currentColor',
2381
+ strokeWidth: 2.8, strokeLinejoin: 'round', strokeLinecap: 'round',
2382
+ }))
2383
+ }
2384
+
1643
2385
  const notedOnce = new Set()
1644
2386
  /** Diagnostics: write once per page load, never on every poll. */
1645
2387
  function noteOnce(key, value) {
@@ -1667,6 +2409,7 @@ window.__ModuleLoader__.load({
1667
2409
  if (f.labels && f.labels.length) parts.push('标签: ' + f.labels.join(','))
1668
2410
  if (f.ignoreLabels && f.ignoreLabels.length) parts.push('排除: ' + f.ignoreLabels.join(','))
1669
2411
  if (f.onlyAssigned) parts.push(f.assignee ? '只看指派给 @' + f.assignee : '只看已指派')
2412
+ if (f.onlyNewComments) parts.push('只看新评论')
1670
2413
  // 设了作者白名单就要能自查;只在编辑器里出现,列表上看不出「到底生效的是谁」。
1671
2414
  if (f.allowAuthors && f.allowAuthors.length) parts.push('作者: ' + f.allowAuthors.join(','))
1672
2415
  return parts.join(' · ')
@@ -1732,7 +2475,12 @@ window.__ModuleLoader__.load({
1732
2475
  if (!match) return { main: value, hint: '' }
1733
2476
  return { main: value.slice(0, match.index).trim(), hint: match[0].trim() }
1734
2477
  }
1735
- function StatusOrbit() {
2478
+ function StatusOrbit(props = {}) {
2479
+ // Dock 的 session slot 已提供当前 sessionId;右栏打开动作只传 kind。
2480
+ // 与头部共用 rightTabIssue():definition 没注册时要直接降级并说明原因 ——
2481
+ // 以前这里只看 openTab 存在,点击把宿主内部错误塞进弹层(弹层没开时用户根本看不见)。
2482
+ const rightIssue = rightTabIssue()
2483
+ const canOpenRight = Boolean(props.sessionId && !rightIssue)
1736
2484
  const [watchers, setWatchers] = useState(null)
1737
2485
  // 写操作的失败提示(M4):为空表示没有错误
1738
2486
  const [orbitError, setOrbitError] = useState(null)
@@ -1860,6 +2608,15 @@ window.__ModuleLoader__.load({
1860
2608
  setOpen((value) => !value)
1861
2609
  }
1862
2610
 
2611
+ const openRight = async () => {
2612
+ try {
2613
+ await openSessionSuperagentTab()
2614
+ setOrbitError(null)
2615
+ } catch (error) {
2616
+ setOrbitError('打开本会话右栏失败:' + String((error && error.message) || error))
2617
+ }
2618
+ }
2619
+
1863
2620
  const button = h('button', {
1864
2621
  ref: btnRef,
1865
2622
  type: 'button',
@@ -1869,9 +2626,9 @@ window.__ModuleLoader__.load({
1869
2626
  ? list.map((w) => (w.repo + ' · ' + (w.title || '未命名会话') + ' · ' + sessionTag(w.sessionId) + ' · ' + STATE_TEXT[orbitStateOf(w)])).join('\n')
1870
2627
  : '还没有' + brandName + ' —— 在「' + brandName + '」页加一条',
1871
2628
  'aria-label': summary,
1872
- 'aria-expanded': open ? 'true' : 'false',
2629
+ 'aria-expanded': canOpenRight ? undefined : open ? 'true' : 'false',
1873
2630
  className: cx('dt-btn', 'dt-btn-ghost', 'sa-orbit-trigger', watchers === null && 'is-loading'),
1874
- onClick: toggle,
2631
+ onClick: canOpenRight ? openRight : toggle,
1875
2632
  }, h(OrbitMark, { watchers: list }))
1876
2633
 
1877
2634
  // DSH 固定业务宽度 252/368,坐标全部交给 useAnchoredPosition;只有 fallback 保留视口夹紧与手算 bottom。
@@ -1937,9 +2694,27 @@ window.__ModuleLoader__.load({
1937
2694
  const parts = [whoName(w) + whoId(w), '每 ' + (Number(w.intervalSec) || 60) + 's']
1938
2695
  // ageText 自己已经带「前」(「76 秒前」),别再拼一个 —— 真机上显示成「76 秒前前」
1939
2696
  if (w.lastPoll) parts.push(ageText(w.lastPoll))
2697
+ if (w.poll && POLL_STALE_TEXT[w.poll]) parts.push(POLL_STALE_TEXT[w.poll])
1940
2698
  if (w.activeHours) parts.push('时段 ' + w.activeHours)
1941
2699
  return parts.join(' · ')
1942
2700
  }
2701
+ // 「这个仓库正在处理哪一条」:服务端在唤醒真正发出后写 lastWakeItem(编号 + 标题 + 类型)。
2702
+ // 只显示**一条**(batchFresh 已按优先级降序,取 head = listed[0]),
2703
+ // 条数用 lastWakeCount(本轮新增条数,可能大于 batchLimit),行高不变 ——
2704
+ // 弹层一行摘要的写法,不新增展开层级。
2705
+ const wakeLine = (w) => {
2706
+ const item = w.lastWakeItem && typeof w.lastWakeItem === 'object' ? w.lastWakeItem : null
2707
+ if (!item || !String(item.number || '').trim()) return ''
2708
+ const title = String(item.title || '').trim()
2709
+ const kind = String(item.kind || '').toLowerCase() === 'pr' ? 'PR' : 'issue'
2710
+ // 失败时 lastWake 是 'failed: …':那条时间不属于「处理过」,前缀也要说清是上一批
2711
+ const failed = typeof w.lastWake === 'string' && w.lastWake.indexOf('failed') === 0
2712
+ const total = Math.max(0, Number(w.lastWakeCount) || 0)
2713
+ const at = !failed && typeof w.lastWake === 'string' && w.lastWake ? ' · ' + ageText(w.lastWake) : ''
2714
+ return (failed ? '上次成功唤醒 ' : '最近唤醒 ') + kind + ' #' + String(item.number)
2715
+ + (title ? ' ' + title : '')
2716
+ + (total > 1 ? ' 等 ' + total + ' 条' : '') + at
2717
+ }
1943
2718
  const detailTitle = (w) => [
1944
2719
  w.title || '未命名会话',
1945
2720
  '会话 ' + sessionTag(w.sessionId),
@@ -1947,6 +2722,7 @@ window.__ModuleLoader__.load({
1947
2722
  isolationText(w),
1948
2723
  backoffText(w),
1949
2724
  historyText(w),
2725
+ wakeLine(w),
1950
2726
  w.lastDeferred,
1951
2727
  w.goal && w.goal.objective ? 'goal · ' + String(w.goal.objective).slice(0, 80) : '',
1952
2728
  w.lastError || '',
@@ -1965,6 +2741,9 @@ window.__ModuleLoader__.load({
1965
2741
  const togglePending = actionPending(w, toggleAction)
1966
2742
  const detailContent = h(React.Fragment, null,
1967
2743
  h('div', { className: 'sa-dock-sub' }, shortSub(w)),
2744
+ // 最近唤醒条目(编号 + 标题):客户在弹层里就能看出「轮到哪一条了」,
2745
+ // 不用回会话翻消息。没有唤醒记录时不占一行。
2746
+ wakeLine(w) ? h('div', { className: 'sa-dock-wake' }, wakeLine(w)) : null,
1968
2747
  w.lastError
1969
2748
  ? h('div', { className: 'sa-dock-err' }, splitErrorText(w.lastError).main)
1970
2749
  : null)
@@ -2053,6 +2832,12 @@ window.__ModuleLoader__.load({
2053
2832
  // 读失败与写操作失败分开说;旧列表仍可保留在错误上方。
2054
2833
  readError ? h('div', { className: 'sa-dock-err', role: 'alert' }, readError) : null,
2055
2834
  !readError && orbitError ? h('div', { className: 'sa-dock-err', role: 'alert' }, '操作失败:' + orbitError) : null,
2835
+ !canOpenRight ? h('div', { className: 'sa-dock-foot', role: 'status' },
2836
+ !hostSidebarRight || typeof hostSidebarRight.openTab !== 'function'
2837
+ ? '宿主 sidebarRight 服务不存在;已保留旧操作列表。'
2838
+ : !props.sessionId
2839
+ ? '当前 Dock 没有 sessionId;已保留旧操作列表,未读取右栏。'
2840
+ : (rightIssue || RIGHT_TAB_UNAVAILABLE) + ';已保留旧操作列表。') : null,
2056
2841
  list.length > 0
2057
2842
  ? h('div', { className: 'sa-dock-foot' }, '详细状态与凭证在「' + brandName + '」标签页')
2058
2843
  : null)
@@ -2099,11 +2884,12 @@ window.__ModuleLoader__.load({
2099
2884
  // ── 官方 GUI 的三个交互件(移植自 src/client/provider.tsx + draft.tsx + src/client/controls.tsx)──
2100
2885
 
2101
2886
  /** 轮询:可见时按 interval,隐藏时降频 6 倍;上一轮没跑完就跳过;卸载时清干净。 */
2102
- function usePoll(task, intervalMs = POLL_MS) {
2887
+ function usePoll(task, intervalMs = POLL_MS, enabled = true) {
2103
2888
  const ref = useRef(task)
2104
2889
  ref.current = task
2105
2890
  const busy = useRef(false)
2106
2891
  useEffect(() => {
2892
+ if (!enabled) return undefined
2107
2893
  let alive = true
2108
2894
  let timer = null
2109
2895
  let discovered = false
@@ -2124,7 +2910,7 @@ window.__ModuleLoader__.load({
2124
2910
  }
2125
2911
  step()
2126
2912
  return () => { alive = false; if (timer) clearTimeout(timer) }
2127
- }, [intervalMs])
2913
+ }, [intervalMs, enabled])
2128
2914
  }
2129
2915
 
2130
2916
  /** 轻量 Toast:DSH 可用时由宿主计时;fallback 保留 4 秒自动消失。 */
@@ -2959,8 +3745,11 @@ window.__ModuleLoader__.load({
2959
3745
  : null)
2960
3746
  }
2961
3747
 
2962
- function ZhuliPanel(props) {
2963
- const sessionId = props && props.sessionId
3748
+ function SuperagentPage(props = {}) {
3749
+ // 同一个领域页面服务两个宿主容器;scope 只决定数据范围,不复制 watcher/Ticket/草稿动作。
3750
+ const scope = props.scope === 'global' ? 'global' : 'session'
3751
+ const sessionId = scope === 'session' ? props.sessionId : null
3752
+ const missingSession = scope === 'session' && !sessionId
2964
3753
  /** 暂停原因码 → 人话(服务端 deferReason 是唯一来源)。 */
2965
3754
  const DEFER_LABELS = {
2966
3755
  'active-hours': '不在活跃时段',
@@ -2976,6 +3765,36 @@ window.__ModuleLoader__.load({
2976
3765
  const [tab, setTab] = useState('overview')
2977
3766
  const [notice, setNotice] = useState(null)
2978
3767
  const [form, setForm] = useState({ ...CREATE_WATCHER_VALUES })
3768
+ // 全局新建复用现有 form 状态,不新增位置化 hook;目标 sessionId 只进入新建请求。
3769
+ const createSessionId = scope === 'global' ? String(form.createSessionId || '') : sessionId
3770
+ let sessionCatalog = null
3771
+ let sessionCatalogMessage = null
3772
+ let sessionCatalogIds = []
3773
+ if (scope === 'global') {
3774
+ try {
3775
+ if (!hostSessions || !hostSessions.list || typeof hostSessions.list.getSnapshot !== 'function') {
3776
+ sessionCatalogMessage = '宿主 sessions catalog 不可用,无法选择目标会话。'
3777
+ } else {
3778
+ sessionCatalog = hostSessions.list.getSnapshot()
3779
+ const byId = sessionCatalog && sessionCatalog.byId && typeof sessionCatalog.byId === 'object' ? sessionCatalog.byId : {}
3780
+ sessionCatalogIds = Object.keys(byId).sort()
3781
+ if (sessionCatalog.phase === 'error') {
3782
+ sessionCatalogMessage = '会话目录读取失败:' + String(sessionCatalog.error || '未知错误')
3783
+ } else if (sessionCatalog.phase !== 'ready') {
3784
+ sessionCatalogMessage = '正在读取会话目录…'
3785
+ } else if (sessionCatalogIds.length === 0) {
3786
+ sessionCatalogMessage = '会话目录为空,无法新建 watcher。'
3787
+ }
3788
+ }
3789
+ } catch (error) {
3790
+ sessionCatalog = null
3791
+ sessionCatalogMessage = '会话目录读取失败:' + String((error && error.message) || error)
3792
+ }
3793
+ }
3794
+ const createSessionReady = scope === 'session'
3795
+ ? Boolean(sessionId)
3796
+ : Boolean(sessionCatalog && sessionCatalog.phase === 'ready'
3797
+ && createSessionId && sessionCatalog.byId && sessionCatalog.byId[createSessionId])
2979
3798
  const [token, setToken] = useState('')
2980
3799
  const [goalDraft, setGoalDraft] = useState('')
2981
3800
  const [goalTouched, setGoalTouched] = useState(false)
@@ -3044,6 +3863,15 @@ window.__ModuleLoader__.load({
3044
3863
  const traceSeqRef = useRef(0)
3045
3864
  // 安装回执与版本检查分开:POST 失败不能冲掉当前版本和命令回退。
3046
3865
  const [updateResult, setUpdateResult] = useState(null)
3866
+ // 设置→来源里的页签名称草稿。只能在 hook 队列**末尾**追加:前面的下标是测试桩的
3867
+ // 位置化契约(deskQueue / 预览 deskHooks 必须同步追加一位)。
3868
+ const [tabNameDraft, setTabNameDraft] = useState(() => tabNameLabel())
3869
+ // 别处改了名字(另一个页面 / 晚到的 brandName)时同步草稿:**干净草稿**跟着新生效的名字走,
3870
+ // 用户正在编辑的**脏草稿**不动 —— 否则外部刚设的名字会被下一次「保存」用旧草稿覆盖回去(终审 M1)。
3871
+ // 只按「变化前的 label」判断脏净,不新增状态槽,也不碰 hook 队列位置。
3872
+ useEffect(() => subscribeTabName((next, previous) => {
3873
+ setTabNameDraft((current) => (normalizeTabName(current) === previous ? next : current))
3874
+ }), [])
3047
3875
  // POST 后 GET 仍以 runningVersion 比较 latest;已装到 latest 且等待重载时,回执优先于 hasUpdate。
3048
3876
  const updateAwaitingReload = Boolean(updateResult && updateResult.needsReload === true
3049
3877
  && update && updateResult.installedVersion === update.latest)
@@ -3052,6 +3880,26 @@ window.__ModuleLoader__.load({
3052
3880
  setSettingsSection(section)
3053
3881
  setTab('settings')
3054
3882
  }
3883
+ // 设置→来源:保存 / 恢复默认页签名称。保存后立刻重注册,当前 GUI 的页签当场就变;
3884
+ // 存不住(localStorage 被禁用)时只在本会话内有效 —— 必须如实说清,不能假装存住了。
3885
+ const saveTabNameDraft = () => {
3886
+ const result = saveTabName(tabNameDraft)
3887
+ setTabNameDraft(result.label)
3888
+ notify(result.persisted
3889
+ ? '页签名称已保存:' + result.label
3890
+ : '页签名称已改为「' + result.label + '」;浏览器本地存储不可用,刷新后会回到默认',
3891
+ result.persisted ? 'info' : 'error')
3892
+ }
3893
+ const resetTabNameDraft = () => {
3894
+ // 删不掉覆盖时不能报「已恢复默认」:本次会话内确实回到了默认,但刷新后旧名字会回来。
3895
+ const previous = tabNameLabel()
3896
+ const result = saveTabName('')
3897
+ setTabNameDraft(result.label)
3898
+ notify(result.persisted
3899
+ ? '页签名称已恢复默认:' + result.label
3900
+ : '页签名称已在本次会话内恢复默认:「' + result.label + '」;浏览器本地存储不可用(删除失败),刷新后可能又回到「' + previous + '」',
3901
+ result.persisted ? 'info' : 'error')
3902
+ }
3055
3903
  // 建议规则弹层:给"叫醒了没回音"一个下一步动作(只提供可复制的规则,不替客户写仓库文件)
3056
3904
 
3057
3905
  // 「我现在手上有没有能渲染的数据」。判断依据必须是**当前 snap**,不是"以前拿到过一次" ——
@@ -3069,9 +3917,12 @@ window.__ModuleLoader__.load({
3069
3917
  // 记下最新一次的 promise:被顶掉就等它,用最新快照回话;它真失败时仍然按失败返回。
3070
3918
  const latestLoadRef = useRef(null)
3071
3919
  const load = useCallback(() => {
3920
+ if (missingSession) return Promise.resolve(null)
3072
3921
  const seq = ++loadSeqRef.current
3073
3922
  const job = (async () => {
3074
- const statePath = sessionId ? '/state?sessionId=' + encodeURIComponent(String(sessionId)) : '/state'
3923
+ const statePath = scope === 'global'
3924
+ ? '/state?scope=global'
3925
+ : '/state?sessionId=' + encodeURIComponent(String(sessionId))
3075
3926
  const etag = readStateEtag(statePath)
3076
3927
  try {
3077
3928
  const payload = await call(statePath, etag ? { headers: { 'if-none-match': etag } } : undefined)
@@ -3107,10 +3958,24 @@ window.__ModuleLoader__.load({
3107
3958
  })()
3108
3959
  latestLoadRef.current = job
3109
3960
  return job
3110
- }, [sessionId])
3961
+ }, [sessionId, scope, missingSession])
3111
3962
 
3112
3963
  useEffect(() => { ensurePortedCss() }, [])
3113
- usePoll(load, POLL_MS)
3964
+ usePoll(load, POLL_MS, !missingSession)
3965
+ useEffect(() => {
3966
+ if (scope !== 'global' || !hostSessions || !hostSessions.list
3967
+ || typeof hostSessions.list.getSnapshot !== 'function' || typeof hostSessions.refresh !== 'function') return undefined
3968
+ let current
3969
+ try { current = hostSessions.list.getSnapshot() } catch { return undefined }
3970
+ if (current.phase === 'ready') return undefined
3971
+ let alive = true
3972
+ Promise.resolve().then(() => hostSessions.refresh())
3973
+ .then(() => { if (alive) load() })
3974
+ .catch((error) => {
3975
+ if (alive) setNotice({ ok: false, text: '会话目录读取失败:' + String((error && error.message) || error) })
3976
+ })
3977
+ return () => { alive = false }
3978
+ }, [scope, load])
3114
3979
 
3115
3980
  const body = snap.body || {}
3116
3981
  // 默认值提示从后端读:写死 12/3/6 会在常量变化后变成谎话(JSON Schema 的 default 也是这个用法)
@@ -3119,6 +3984,25 @@ window.__ModuleLoader__.load({
3119
3984
  const BRAND = (typeof body.brandName === 'string' && body.brandName.trim()) || '主理鱼'
3120
3985
  const ACK_DEFAULTS = body.defaultAckLabels || null
3121
3986
  const watchers = body.watchers || []
3987
+ const modular = body.modular && typeof body.modular === 'object' ? body.modular : null
3988
+ const hasExternalModularActions = Boolean(props.modularActions || typeof props.onModularAction === 'function')
3989
+ // 会话右栏的写操作显式携带 scope,全局动作不绑定某个当前会话。
3990
+ const scopedWriteSessionId = scope === 'session' ? sessionId : null
3991
+ const withWriteScope = (payload) => scopedWriteSessionId ? { ...payload, sessionId: scopedWriteSessionId } : payload
3992
+ const modularActions = {
3993
+ ...(modular && modular.actions === true && !hasExternalModularActions ? {
3994
+ resume: (ticketId) => run(() => call('/tickets', { method: 'POST', body: JSON.stringify(withWriteScope({ action: 'resume', ticketId })) }), '已提交恢复'),
3995
+ stop: (ticketId) => run(() => call('/tickets', { method: 'POST', body: JSON.stringify(withWriteScope({ action: 'stop', ticketId })) }), '已停止 Ticket'),
3996
+ flush: () => run(() => call('/outbox', { method: 'POST', body: JSON.stringify(withWriteScope({})) }), 'Outbox 已刷新'),
3997
+ ...(scope === 'global' ? {
3998
+ // executorPaused 是全局开关;会话右栏不展示这个必然跨 scope 的动作。
3999
+ pauseProcessing: (paused) => run(() => call('/tickets', { method: 'POST', body: JSON.stringify({ action: paused ? 'pause-processing' : 'resume-processing' }) }), paused ? '已暂停 worker' : '已恢复 worker'),
4000
+ } : {}),
4001
+ save: (body, context) => run(() => call('/draft', { method: 'POST', body: JSON.stringify(withWriteScope({ ...context, body })) }), '草稿已保存'),
4002
+ clear: (context) => run(() => call('/draft', { method: 'POST', body: JSON.stringify(withWriteScope({ ...context, clear: true })) }), '草稿已清空'),
4003
+ } : {}),
4004
+ ...(props.modularActions || {}),
4005
+ }
3122
4006
  // 行内编辑只有这一条入口:clean 维持原直达行为;dirty 先确认,取消绝不重置 draft/touched。
3123
4007
  const applyWatcherEditor = (watcher, nextKey) => {
3124
4008
  const values = watcherValuesFrom(watcher, ACK_DEFAULTS)
@@ -3126,6 +4010,12 @@ window.__ModuleLoader__.load({
3126
4010
  touchedRef.current = new Set()
3127
4011
  editSnapshotRef.current = nextKey ? { key: nextKey, values } : null
3128
4012
  setDraft({
4013
+ // PR 响应监控的四项必须一起进 draft:watcherDirty 只比较 snapshot 里有的键,
4014
+ // 少一个键就等于「切了类型不算修改」,SaveBar 永远不出现。
4015
+ watchKind: values.watchKind,
4016
+ audit: values.audit,
4017
+ adversarialAudit: values.adversarialAudit,
4018
+ auditMode: values.auditMode,
3129
4019
  intervalSec: watcherNumberText(watcher.intervalSec ?? 60),
3130
4020
  labels: (watcher.filters && watcher.filters.labels ? watcher.filters.labels : []).join(','),
3131
4021
  ignoreLabels: (watcher.filters && watcher.filters.ignoreLabels ? watcher.filters.ignoreLabels : []).join(','),
@@ -3135,6 +4025,7 @@ window.__ModuleLoader__.load({
3135
4025
  goal: watcher.note || (typeof watcher.goal === 'string' ? watcher.goal : (watcher.goal && watcher.goal.objective) || ''),
3136
4026
  ackLabel: watcher.ackLabel || ackLabelFallback(watcher, ACK_DEFAULTS),
3137
4027
  onlyAssigned: !!(watcher.filters && watcher.filters.onlyAssigned),
4028
+ onlyNewComments: !!(watcher.filters && watcher.filters.onlyNewComments),
3138
4029
  allowAuthors: (watcher.filters && watcher.filters.allowAuthors ? watcher.filters.allowAuthors : []).join(', '),
3139
4030
  observe: !!watcher.observe,
3140
4031
  isolated: !!watcher.isolated,
@@ -3151,7 +4042,11 @@ window.__ModuleLoader__.load({
3151
4042
  priorityStale: Boolean(watcher.priority && watcher.priority.stale) === true,
3152
4043
  })
3153
4044
  }
3154
- const editingWatcher = watchers.find((watcher) => watcher.repo + '#' + watcher.sessionId === editing)
4045
+ // 同仓库同会话的 issue 守与 PR 守 repo#sessionId 一模一样:编辑目标必须带上 kind 前缀,
4046
+ // 否则点 PR 行会展开 issue 的表单(2026-11-13 review 实测 prClickEditingCalls=[{next:"o/r#s"}]、
4047
+ // prEditForms:0 / issueEditForms:1)。与渲染时的行 key 保持同一套算法。
4048
+ const watcherKeyOf = (watcher) => (watcher.kind === 'pr' ? 'pr:' : '') + (watcher.repo || '') + '#' + (watcher.sessionId || '')
4049
+ const editingWatcher = watchers.find((watcher) => watcherKeyOf(watcher) === editing)
3155
4050
  const editingOpening = editSnapshotRef.current && editSnapshotRef.current.key === editing
3156
4051
  ? editSnapshotRef.current.values
3157
4052
  : editingWatcher ? watcherValuesFrom(editingWatcher, ACK_DEFAULTS) : null
@@ -3162,7 +4057,7 @@ window.__ModuleLoader__.load({
3162
4057
  // dirty 折叠在确认期间挂起 editing id,但原表单仍挂载;取消/确认之前绝不清它的 draft。
3163
4058
  const displayedEditing = editing || pendingCollapseKey
3164
4059
  const toggleWatcherEditor = (watcher) => {
3165
- const key = watcher.repo + '#' + watcher.sessionId
4060
+ const key = watcherKeyOf(watcher)
3166
4061
  const nextKey = editing === key ? null : key
3167
4062
  if (editing && editingDirty) {
3168
4063
  watcherDraftConfirmedRef.current = false
@@ -3232,14 +4127,26 @@ window.__ModuleLoader__.load({
3232
4127
  // 只发 touched 字段;repo/sessionId 只是现有 /watch 的定位键,不是全量快照。
3233
4128
  body: JSON.stringify((() => {
3234
4129
  const full = {
3235
- repo: watcher.repo,
4130
+ // /state 里的 repo 是**规范化后**的 `owner/name`(provider 单独一个字段)——
4131
+ // 提交前必须把 `gitee:` 前缀补回去。否则服务端 parseRepoSpec 会把它判成 GitHub:
4132
+ // id 从 `gitee:owner/name#s` 变成 `owner/name#s`,匹配不到已有守 ⇒ **静默新建一条
4133
+ // github 孪生守**(每轮 gh 404),而原来那条的间隔/过滤分毫不动
4134
+ //(0.10.12 真机踩到:Gitee 仓库改 600 秒保存后仍是 180 秒,面板里还多出一条 404 的孪生)。
4135
+ repo: (watcher.provider === 'gitee' ? 'gitee:' : '') + String(watcher.repo || ''),
3236
4136
  sessionId: watcher.sessionId,
4137
+ // 类型决定服务端 id 前缀(`pr:`)。编辑时 `watchKind` 控件不渲染(modes: ['create']),
4138
+ // 所以这里的值只用来让服务端认对 id,不是「用户改类型」的入口。
4139
+ watchKind: watcher.kind === 'pr' ? 'pr' : 'issue',
4140
+ audit: !!draft.audit,
4141
+ adversarialAudit: !!draft.adversarialAudit,
4142
+ auditMode: draft.auditMode === 'inline' ? 'inline' : 'subagent',
3237
4143
  intervalSec: numberOrUndefined(draft.intervalSec) ?? watcher.intervalSec,
3238
4144
  filters: {
3239
4145
  labels: String(draft.labels ?? '').split(',').map((v) => v.trim()).filter(Boolean),
3240
4146
  // filters 整块发送,三个名单都必须带上,否则改标签会顺带清空另外两项。
3241
4147
  ignoreLabels: String(draft.ignoreLabels ?? '').split(',').map((v) => v.trim()).filter(Boolean),
3242
4148
  onlyAssigned: !!draft.onlyAssigned,
4149
+ onlyNewComments: !!draft.onlyNewComments,
3243
4150
  assignee: String(draft.assignee ?? '').trim().replace(/^@/, '') || null,
3244
4151
  allowAuthors: String(draft.allowAuthors ?? '').split(',').map((v) => v.trim().replace(/^@/, '')).filter(Boolean),
3245
4152
  },
@@ -3267,6 +4174,7 @@ window.__ModuleLoader__.load({
3267
4174
  labels: "filters",
3268
4175
  ignoreLabels: "filters",
3269
4176
  onlyAssigned: "filters",
4177
+ onlyNewComments: "filters",
3270
4178
  assignee: "filters",
3271
4179
  allowAuthors: "filters",
3272
4180
  priorityReopened: "priority",
@@ -3280,6 +4188,9 @@ window.__ModuleLoader__.load({
3280
4188
  wanted.add(CONTROL_TO_FIELD[key] || key)
3281
4189
  }
3282
4190
  const out = { repo: full.repo, sessionId: full.sessionId }
4191
+ // 类型必须无条件带上:编辑时 `watchKind` 控件不渲染,touchedRef 里永远没有它,
4192
+ // 只发 touched 字段就会让服务端按「issue」算 id —— 改一条 PR 守会静默新建一条 issue 守。
4193
+ out.watchKind = full.watchKind
3283
4194
  for (const key of wanted) {
3284
4195
  if (Object.prototype.hasOwnProperty.call(full, key)) out[key] = full[key]
3285
4196
  }
@@ -3292,7 +4203,7 @@ window.__ModuleLoader__.load({
3292
4203
  }, '已保存:' + watcher.repo, { rethrow: true })
3293
4204
 
3294
4205
  const act = (watcher, action) => run(async () => {
3295
- await call('/watch', { method: 'POST', body: JSON.stringify({ action, id: watcherId(watcher) }) })
4206
+ await call('/watch', { method: 'POST', body: JSON.stringify(withWriteScope({ action, id: watcherId(watcher) })) })
3296
4207
  }, action === 'delete' ? '已删除 ' + watcher.repo
3297
4208
  : action === 'poll' ? '已触发一次轮询:' + watcher.repo
3298
4209
  // 审核 T24 W6:暂停/恢复成功以前什么都不说,客户不确定点没点上。
@@ -3306,25 +4217,35 @@ window.__ModuleLoader__.load({
3306
4217
  for (const watcher of list) {
3307
4218
  if (action === 'pause' && !watcher.enabled) continue
3308
4219
  if (action === 'resume' && watcher.enabled) continue
3309
- await call('/watch', { method: 'POST', body: JSON.stringify({ action, id: watcherId(watcher) }) })
4220
+ await call('/watch', { method: 'POST', body: JSON.stringify(withWriteScope({ action, id: watcherId(watcher) })) })
3310
4221
  }
3311
4222
  }, action === 'pause' ? '全部已暂停' : '全部已恢复')
3312
4223
 
3313
4224
  const addWatcher = () => run(async () => {
4225
+ if (!createSessionReady) throw new Error('目标会话不可用:' + (sessionCatalogMessage || '请选择目标会话'))
3314
4226
  const value = { ...CREATE_WATCHER_VALUES, ...form }
3315
4227
  const created = await call('/watch', {
3316
4228
  method: 'POST',
3317
4229
  body: JSON.stringify((() => {
3318
4230
  const valueDirty = (key) => createTouchedRef.current.has(key) || !watcherSameValue(value[key], createSnapshotRef.current[key])
3319
- const payload = { repo: value.repo.trim(), sessionId }
4231
+ const payload = { repo: value.repo.trim(), sessionId: createSessionId }
4232
+ // 监控类型永远提交:它决定服务端 id 前缀(`pr:`),漏了就当 issue 建。
4233
+ payload.watchKind = value.watchKind === 'pr' ? 'pr' : 'issue'
4234
+ if (payload.watchKind === 'pr') {
4235
+ // 审计三项只在 PR 类型下有意义;没碰过的项交给服务端保默认,别用假值覆盖。
4236
+ if (valueDirty('audit')) payload.audit = !!value.audit
4237
+ if (valueDirty('adversarialAudit')) payload.adversarialAudit = !!value.adversarialAudit
4238
+ if (valueDirty('auditMode')) payload.auditMode = value.auditMode === 'inline' ? 'inline' : 'subagent'
4239
+ }
3320
4240
  // 新建也必须只提交实际输入过的配置;服务端负责未提供项的默认值。
3321
4241
  if (valueDirty('intervalSec')) payload.intervalSec = numberOrUndefined(value.intervalSec) ?? 60
3322
4242
  if (valueDirty('goal')) payload.goal = value.goal || ''
3323
- if (['labels', 'ignoreLabels', 'onlyAssigned', 'assignee', 'allowAuthors'].some(valueDirty)) {
4243
+ if (['labels', 'ignoreLabels', 'onlyAssigned', 'onlyNewComments', 'assignee', 'allowAuthors'].some(valueDirty)) {
3324
4244
  payload.filters = {
3325
4245
  labels: String(value.labels ?? '').split(',').map((v) => v.trim()).filter(Boolean),
3326
4246
  ignoreLabels: String(value.ignoreLabels ?? '').split(',').map((v) => v.trim()).filter(Boolean),
3327
4247
  onlyAssigned: !!value.onlyAssigned,
4248
+ onlyNewComments: !!value.onlyNewComments,
3328
4249
  assignee: String(value.assignee ?? '').trim().replace(/^@/, '') || null,
3329
4250
  allowAuthors: String(value.allowAuthors ?? '').split(',').map((v) => v.trim().replace(/^@/, '')).filter(Boolean),
3330
4251
  }
@@ -3350,7 +4271,7 @@ window.__ModuleLoader__.load({
3350
4271
  })()),
3351
4272
  })
3352
4273
  // 只重置既定仓库相关字段;限额、隔离策略和时段保留,连续添加不用重填。
3353
- const nextForm = { ...form, repo: '', goal: '', labels: '', onlyAssigned: false, allowAuthors: '' }
4274
+ const nextForm = { ...form, repo: '', goal: '', labels: '', onlyAssigned: false, onlyNewComments: false, allowAuthors: '' }
3354
4275
  setForm(nextForm)
3355
4276
  // 这些保留下来的值已经由本次 /watch 保存,成为下一次新增的全新基线。
3356
4277
  createSnapshotRef.current = { ...CREATE_WATCHER_VALUES, ...nextForm }
@@ -3452,7 +4373,11 @@ window.__ModuleLoader__.load({
3452
4373
  // 标题本身是按钮 —— 官方就是点标题进详情,我们点标题展开行内编辑,交互更轻但不脱离这套结构。
3453
4374
  const STAGE_STATE = { active: undefined, paused: 'warning', error: 'error', dormant: 'warning' }
3454
4375
  const row = (watcher) => {
3455
- const key = watcher.repo + '#' + watcher.sessionId
4376
+ // key 必须带 kind:同一个仓库同一个会话完全可以同时开一条 issue 守和一条 PR 守,
4377
+ // 而它们的 `repo#sessionId` 一模一样 —— 只按 repo#session 生成的 key 会撞,
4378
+ // React 会把两行当成同一条(重复 key),编辑态也会一起展开、改一个两个都动。
4379
+ // 服务端的 id 前缀(`pr:`)本来就是为这个存在的,这里跟它对齐。
4380
+ const key = (watcher.kind === 'pr' ? 'pr:' : '') + watcher.repo + '#' + watcher.sessionId
3456
4381
  const state = orbitStateOf(watcher)
3457
4382
  const rowBody = h('div', { className: 'dt-ticket-body' },
3458
4383
  h('div', { className: 'dt-row-title' },
@@ -3475,7 +4400,10 @@ window.__ModuleLoader__.load({
3475
4400
  // ack 标签决定这条是否还会被叫醒,不能只在工具参数里出现。
3476
4401
  h(Tag, { tone: 'quiet' }, '回执 ' + (watcher.ackLabel || ackLabelFallback(watcher, ACK_DEFAULTS))),
3477
4402
  watcher.queuedWakes > 0 ? h(Tag, { tone: 'warning' }, '排队 ' + watcher.queuedWakes) : null,
3478
- backoffText(watcher) ? h(Tag, { tone: 'warning' }, backoffText(watcher)) : null),
4403
+ backoffText(watcher) ? h(Tag, { tone: 'warning' }, backoffText(watcher)) : null,
4404
+ (watcher.poll && POLL_STALE_TEXT[watcher.poll])
4405
+ ? h(Tag, { tone: 'warning' }, POLL_STALE_TEXT[watcher.poll])
4406
+ : null),
3479
4407
  // 三行,各管一件事:① 是谁 ② 节律与最近结果 ③ 目标
3480
4408
  // 原来六段用 ' · ' 串成一行(会话 · 每 60s · 轮询 · 唤醒 · 上次唤醒 · 目标),
3481
4409
  // 出图时那行在浅色主题下折成两行、读起来像一堵墙。
@@ -3646,6 +4574,7 @@ window.__ModuleLoader__.load({
3646
4574
  const matchesBadge = (watcher) => !badgeFilter
3647
4575
  || repoBadges(watcher.repoAccess).some((badge) => badge.text === badgeFilter)
3648
4576
  const hasProblem = (watcher) => Boolean(watcher.lastError)
4577
+ || Boolean(watcher.poll && POLL_STALE_TEXT[watcher.poll])
3649
4578
  || Boolean(watcher.lastReopened)
3650
4579
  || Number(watcher.silentWakes) >= 2
3651
4580
  || Boolean(repoStructureNote(watcher.repoAccess))
@@ -3777,13 +4706,12 @@ window.__ModuleLoader__.load({
3777
4706
  item.text,
3778
4707
  item.action ? h(Btn, { variant: 'link', size: 'sm', 'aria-label': item.action.label, onClick: item.action.onClick }, item.action.label) : null))))
3779
4708
  : null,
3780
- // 中间态:已经有守、但一次都没唤醒过 —— 这不是"没配置",是"在等"
4709
+ // 中间态:已经有守、但一次都没唤醒过 —— 这不是"没配置",是"在等"。
4710
+ // 只留一句。叫醒之后按什么规则处理(AGENTS.md → 修/回/待定 → watch_ack)
4711
+ // 移进「判定」页的问号提示:主面板常驻四行灰字会把右栏挤成一团。
3781
4712
  (watchers.length > 0 && watchers.every((w) => !w.lastWake))
3782
4713
  ? h('div', { className: 'sa-dock-foot', key: 'waiting' },
3783
- '还没有唤醒过:守会在仓库出现新条目时叫醒这个会话。'
3784
- + '想先试一次,点行里的「立刻」;如果一直没动静,看上面「需要关注」里有没有被过滤的记录。'
3785
- + '叫醒之后:会话先读仓库 AGENTS.md → 决定「修 / 回 / 待定」→ 做完写回并 watch_ack 打标签;'
3786
- + '不做也要说明理由并 ack。每次只处理叫醒消息里列出的那几条,不会扩大范围。')
4714
+ '还没有唤醒过:仓库有新条目就叫醒本会话,点「立刻」可以先试一次。')
3787
4715
  : null,
3788
4716
  // 需要重启:这是"功能看起来没生效"最常见的根因,必须显眼
3789
4717
  (body.installedVersion && body.runningVersion && body.installedVersion !== body.runningVersion)
@@ -3824,6 +4752,8 @@ window.__ModuleLoader__.load({
3824
4752
  count: watchers.reduce((n, w) => n + (w.history || []).length, 0),
3825
4753
  action: h(InfoTip, { text: '每轮判定都会记一条:唤醒、仅观察,或跳过及其原因。只存最近若干条。' }),
3826
4754
  },
4755
+ // 规则说明放这里而不是主面板:主面板只留一句,避免右栏被灰字堆满。
4756
+ h(Hint, { key: 'rules' }, '叫醒后按 AGENTS.md → 修 / 回 / 待定 → 做完写回并 watch_ack;只处理列出的几条,不会扩大范围。'),
3827
4757
  (() => {
3828
4758
  const needle = search.trim()
3829
4759
  // 审核 T40 M3:以前只认纯数字 —— Gitee 的编号是 IKSQJH 这种字符串,
@@ -4044,8 +4974,27 @@ window.__ModuleLoader__.load({
4044
4974
  const trigger = h(Section, { title: '新增' + BRAND },
4045
4975
  h(WatcherForm, {
4046
4976
  mode: 'create', idPrefix: 'watcher-new', value: { ...CREATE_WATCHER_VALUES, ...form },
4047
- snapshot: createSnapshotRef.current, defaults: DEFAULTS, disabled: !sessionId, sessionId,
4048
- submitLabel: sessionId ? '添加到当前会话' : '先打开一个会话',
4977
+ snapshot: createSnapshotRef.current, defaults: DEFAULTS, disabled: !createSessionReady, sessionId: createSessionId,
4978
+ submitLabel: scope === 'global'
4979
+ ? (createSessionReady ? '添加到所选会话' : '选择目标会话')
4980
+ : (sessionId ? '添加到当前会话' : '先打开一个会话'),
4981
+ targetControl: scope === 'global' ? (busy) => h(Field, { id: 'watcher-new-session', label: '目标会话' },
4982
+ h(React.Fragment, null,
4983
+ h('select', {
4984
+ id: 'watcher-new-session', className: 'dt-select', 'aria-label': '目标会话',
4985
+ value: createSessionId,
4986
+ disabled: busy || !sessionCatalog || sessionCatalog.phase !== 'ready' || sessionCatalogIds.length === 0,
4987
+ onChange: (event) => setCreateField('createSessionId', event.target.value),
4988
+ },
4989
+ h('option', { value: '' }, '选择目标会话'),
4990
+ sessionCatalogIds.map((id) => {
4991
+ const item = sessionCatalog.byId[id]
4992
+ const title = item && (item.title || item.name)
4993
+ return h('option', { key: id, value: id }, title ? String(title) + ' · ' + id : id)
4994
+ })),
4995
+ sessionCatalogMessage
4996
+ ? h('p', { className: sessionCatalog && sessionCatalog.phase === 'error' ? 'dt-error' : 'dt-hint', role: sessionCatalog && sessionCatalog.phase === 'error' ? 'alert' : undefined }, sessionCatalogMessage)
4997
+ : h('p', { className: 'dt-hint' }, '只用于新建 watcher;不改变全局读取或批量动作范围。'))) : null,
4049
4998
  onChange: setCreateField,
4050
4999
  onSave: addWatcher,
4051
5000
  onDiscard: () => {
@@ -4066,6 +5015,9 @@ window.__ModuleLoader__.load({
4066
5015
  // 没有就交给服务端按默认目录来,面板把服务端回的路径原样显示出来。
4067
5016
  const gateRepo = (watchers.find((item) => typeof item.workdir === 'string' && item.workdir.trim()) || {}).workdir || ''
4068
5017
 
5018
+ // 页签名称的草稿状态:脏 = 「保存后文案会变」(空值 = 恢复默认,也算一种改动)。
5019
+ const tabNameDirty = normalizeTabName(tabNameDraft) !== tabNameLabel()
5020
+ const tabNameOverridden = tabNameOverride !== null
4069
5021
  const settingsSections = [
4070
5022
  h(Section, { key: 'source', title: '来源' },
4071
5023
  h(KeyValues, { rows: [
@@ -4098,7 +5050,23 @@ window.__ModuleLoader__.load({
4098
5050
  const each = roots.map((r) => r.count + ' 个隔离根 · ' + bytesText(r.bytes)).join(';')
4099
5051
  return roots.length > 1 ? each + '(合计 ' + bytesText(body.isolation.totalBytes) + ')' : each
4100
5052
  })()],
4101
- ] })),
5053
+ ] }),
5054
+ // 页签名称:只改会话头第二个 row(对话 / 轨迹 / …)上的这一个页签,
5055
+ // 不动面板标题、唤醒抬头、插件包名和 ack 标签。
5056
+ field('页签名称',
5057
+ h(Input, {
5058
+ value: tabNameDraft,
5059
+ 'aria-label': '页签名称',
5060
+ placeholder: BRAND,
5061
+ onChange: (e) => setTabNameDraft(clampTabNameDraft(e.target.value)),
5062
+ }),
5063
+ '只改这个页签:会话标题、插件包名和 ack 标签都不动'),
5064
+ h(Hint, null, '默认跟随品牌名「' + BRAND + '」;留空 = 恢复默认。最多 ' + TAB_NAME_MAX
5065
+ + ' 个字符。存在这台机器的浏览器本地(同一浏览器的所有会话共用),不同步到服务端或其他设备。'),
5066
+ h('div', { className: 'dt-actions' },
5067
+ h(Btn, { variant: 'primary', size: 'sm', onClick: saveTabNameDraft, disabled: !tabNameDirty }, '保存名称'),
5068
+ h(Btn, { variant: 'ghost', size: 'sm', onClick: resetTabNameDraft, disabled: !tabNameOverridden }, '恢复默认')),
5069
+ ),
4102
5070
  h(Section, { key: 'creds', title: '凭证' },
4103
5071
  h(KeyValues, { rows: [['GitHub token', credentials.token === 'none' ? '未配置(回退到已登录的 gh CLI)' : '已配置'], ['SSH 私钥', credentials.sshKeyPath === 'none' ? '未配置(当前版本不使用)' : '已配置'],
4104
5072
  ['gh 账号', credentials.ghConfigDir === 'configured' ? '已绑定独立配置目录(评论挂智能体账号)' : '宿主当前登录的账号'],
@@ -4330,7 +5298,7 @@ window.__ModuleLoader__.load({
4330
5298
  if (watcher.enabled !== false) group.enabled += 1
4331
5299
  if (watcher.lastWake && (!group.lastWake || String(watcher.lastWake) > String(group.lastWake))) group.lastWake = watcher.lastWake
4332
5300
  group.silentWakes = Math.max(group.silentWakes, Number(watcher.silentWakes) || 0)
4333
- if (watcher.lastError) group.errors += 1
5301
+ if (watcher.lastError || (watcher.poll && POLL_STALE_TEXT[watcher.poll])) group.errors += 1
4334
5302
  for (const badge of repoBadges(watcher.repoAccess) || []) {
4335
5303
  if (!group.badges.some((b) => b.text === badge.text)) group.badges.push(badge)
4336
5304
  }
@@ -4403,13 +5371,23 @@ window.__ModuleLoader__.load({
4403
5371
  return h(Field, { key: label, label, hint, note }, control)
4404
5372
  }
4405
5373
 
5374
+ if (missingSession) {
5375
+ return h('div', { className: 'dt-page' }, h('div', { className: 'dt-column' },
5376
+ h('div', { className: 'dt-card dt-error-card' },
5377
+ h('div', { className: 'dt-card-head' }, h('span', { className: 'dt-card-title' }, '无法打开会话工作台')),
5378
+ h('p', { className: 'dt-error', role: 'alert' }, '右栏 slot 没有提供当前 sessionId;未读取全局数据,也未发出任何会话写操作。'),
5379
+ h(Hint, null, '请从已打开会话的头部入口或 Dock 进入;宿主必须提供真实 sessionId。'))))
5380
+ }
5381
+
4406
5382
  return h('div', { className: 'dt-page' },
4407
5383
  h('div', { className: 'dt-page-head' },
4408
5384
  h('div', null,
4409
5385
  h('h1', { className: 'dt-page-title' }, BRAND),
4410
5386
  h('span', { className: 'dt-hint' },
4411
- (body.sessionTitle ? '会话:' + body.sessionTitle + ' · ' : '')
4412
- + (sessionId ? '盯办 + 主动办:仓库有动静就叫醒本会话' : '(在会话里打开本面板,才能把仓库绑到会话上)'))),
5387
+ scope === 'global'
5388
+ ? '全局中枢 · 全部项目会话的 watcher、Ticket、执行、Outbox 与健康'
5389
+ : (body.sessionTitle ? '会话:' + body.sessionTitle + ' · ' : '')
5390
+ + (sessionId ? '盯办 + 主动办:仓库有动静就叫醒本会话' : '(在会话里打开本面板,才能把仓库绑到会话上)'))),
4413
5391
  h('div', { className: 'dt-toolbar' },
4414
5392
  h(Input, { value: search, placeholder: '搜索仓库 / 编号 / 标题', onChange: (e) => setSearch(e.target.value), 'aria-label': '搜索' }),
4415
5393
  h(Btn, { size: 'sm', variant: 'ghost', icon: h(Icon, { name: 'question' }), onClick: () => setGlossary(true) }, '术语'),
@@ -4442,6 +5420,7 @@ window.__ModuleLoader__.load({
4442
5420
  { value: 'judge', label: '判定', id: 'sa-main-tab-judge', panelId: 'sa-main-panel-judge' },
4443
5421
  { value: 'trigger', label: '触发', id: 'sa-main-tab-trigger', panelId: 'sa-main-panel-trigger' },
4444
5422
  { value: 'settings', label: '设置', id: 'sa-main-tab-settings', panelId: 'sa-main-panel-settings' },
5423
+ ...(modular ? [{ value: 'modular', label: modularCopy(modular.locale).tab, id: 'sa-main-tab-modular', panelId: 'sa-main-panel-modular' }] : []),
4445
5424
  ],
4446
5425
  value: tab, onChange: setTab, label: '主理鱼分区',
4447
5426
  }),
@@ -4472,6 +5451,12 @@ window.__ModuleLoader__.load({
4472
5451
  snap.body && tab === 'settings' ? h('div', {
4473
5452
  id: 'sa-main-panel-settings', role: 'tabpanel', 'aria-labelledby': 'sa-main-tab-settings', className: 'dt-tabpanel',
4474
5453
  }, settings) : null,
5454
+ snap.body && tab === 'modular' && modular ? h('div', {
5455
+ id: 'sa-main-panel-modular', role: 'tabpanel', 'aria-labelledby': 'sa-main-tab-modular', className: 'dt-tabpanel',
5456
+ }, h(ModularView, {
5457
+ data: modular, actions: modularActions, onAction: props.onModularAction,
5458
+ onOpenSession: (props.onOpenSession || hostOpenSession) ? (id) => run(() => (props.onOpenSession || hostOpenSession)(id), '已打开 Session') : null,
5459
+ })) : null,
4475
5460
  glossary && glossary.type === 'watcher-draft' ? h(ConfirmDialog, {
4476
5461
  open: true,
4477
5462
  label: '放弃未保存的修改',
@@ -4508,7 +5493,7 @@ window.__ModuleLoader__.load({
4508
5493
  ['办', '唤醒会话后按仓库 AGENTS.md 主动处理,完成后 watch_ack 打标签'],
4509
5494
  ['唤醒', '只在会话空闲(idle)时注入一条【' + BRAND + '】消息'],
4510
5495
  ['过滤', '标签白名单/黑名单、只看已指派、跳过机器人/草稿/已关闭'],
4511
- ['时段', 'activeHours,比如 09:00-23:00,时段外只攒不唤醒'],
5496
+ ['时段', 'activeHours,比如 09:00-12:00,14:00-23:00;多段任一命中,时段外只攒不唤醒'],
4512
5497
  ['隔离', 'isolated:每次唤醒开一次性 git worktree,改副本不碰主工作区'],
4513
5498
  ['ack', '处理完给条目打「' + (ACK_DEFAULTS && ACK_DEFAULTS.github ? ACK_DEFAULTS.github : '主理鱼:已处理') + '」标签,轮询直接跳过'],
4514
5499
  ['goal', '会话目标(ctx.goals),和 /goal 命令同一份状态'],
@@ -4523,32 +5508,369 @@ window.__ModuleLoader__.load({
4523
5508
  }
4524
5509
 
4525
5510
 
5511
+ function SuperagentGlobalPage(props = {}) {
5512
+ return h(SuperagentPage, { ...props, scope: 'global' })
5513
+ }
5514
+
5515
+ function SuperagentSessionPage(props = {}) {
5516
+ // sessionId 只从右栏 session slot 读取,不从 URL、watcher 或全局状态猜测。
5517
+ return h(SuperagentPage, { ...props, scope: 'session' })
5518
+ }
5519
+
5520
+ function SuperagentNavIcon() {
5521
+ // 品牌用官方 DeepSeek 鲸鱼线稿;轨道环只留在面板内部表达每条守的状态,不再当入口图标。
5522
+ return h(DeepSeekWhaleMark, { size: 16 })
5523
+ }
5524
+
5525
+ function SuperagentHeaderUtility(props = {}) {
5526
+ const [error, setError] = useState(null)
5527
+ const [pressed, setPressed] = useState(() => Boolean(visibleSessionRightTab(props.sessionId)))
5528
+ useEffect(() => {
5529
+ if (!canToggleSessionRightTab()) return undefined
5530
+ const update = () => setPressed(Boolean(visibleSessionRightTab(props.sessionId)))
5531
+ const unsubscribe = hostSidebarRight.view.subscribe(update)
5532
+ update()
5533
+ return typeof unsubscribe === 'function' ? unsubscribe : undefined
5534
+ }, [props.sessionId])
5535
+ const unavailable = !props.sessionId
5536
+ ? '当前头部 slot 没有 sessionId'
5537
+ : rightTabIssue()
5538
+ const toggle = async () => {
5539
+ if (unavailable) return
5540
+ try {
5541
+ const tab = pressed ? visibleSessionRightTab(props.sessionId) : null
5542
+ if (tab) await hostSidebarRight.hide(tab.id)
5543
+ else await openSessionSuperagentTab()
5544
+ setError(null)
5545
+ } catch (failure) {
5546
+ setError(String((failure && failure.message) || failure))
5547
+ }
5548
+ }
5549
+ const label = '本会话的主理鱼'
5550
+ const tip = unavailable || label
5551
+ // 官方 Forge 头部入口不传 variant:默认 ghost 就是无底色,只有按下态才给
5552
+ // interactive-bg-active。之前传 toolbar,命中安装版 Button 的填充 variant,
5553
+ // 于是真机上多出一块深色圆角底 —— 这就是"不像原生"的来源。
5554
+ // DSH Tooltip 要把 ref 合并到真实 trigger;本地 Btn 是普通函数,不能接住 ref。
5555
+ // 两个能力同时存在时直接用官方 forwardRef Button,缺任一项就显式回退 title。
5556
+ const useHostTooltip = Boolean(hostTooltipPrimitive && hostButton)
5557
+ const shared = {
5558
+ 'aria-label': label, 'aria-pressed': pressed,
5559
+ title: useHostTooltip ? undefined : tip,
5560
+ disabled: Boolean(unavailable), onClick: toggle,
5561
+ }
5562
+ const button = hostButton
5563
+ ? h(hostButton, { type: 'button', variant: 'ghost', size: 'sm', icon: h(SuperagentNavIcon), className: 'dt-header-entry dt-header-entry-host', ...shared })
5564
+ : h('button', { type: 'button', className: 'dt-header-entry', ...shared }, h(SuperagentNavIcon))
5565
+ return h(React.Fragment, null,
5566
+ useHostTooltip ? h(hostTooltipPrimitive, { label: tip, side: 'bottom', openOnClick: true }, button) : button,
5567
+ error ? h('span', { className: 'dt-error', role: 'alert' }, '切换右栏失败:' + error) : null)
5568
+ }
5569
+
5570
+ function SuperagentRightTabTitle() {
5571
+ return h(React.Fragment, null, h(SuperagentNavIcon), h('span', null, tabNameLabel()))
5572
+ }
5573
+
5574
+ let hostOpenSession = null
4526
5575
  return {
4527
5576
  inject: ['slots'],
4528
5577
  apply(ctx) {
5578
+ hostLayout = optionalHostService(ctx, 'layout')
5579
+ hostSidebarRight = optionalHostService(ctx, 'sidebarRight')
5580
+ hostSidebarRightTabs = optionalHostService(ctx, 'sidebarRightTabs')
5581
+ hostSessions = optionalHostService(ctx, 'sessions')
4529
5582
  try { noteOnce('client-version', CLIENT_VERSION) } catch {}
4530
5583
  try { note('apply', 'start') } catch {}
4531
5584
  // 样式表在这里注入一次就够了:任何槽位(面板 / 圆环 / 将来的入口)都用得上。
4532
5585
  // 之前只在面板组件挂载时注入,没打开过面板就直接点圆环 → 弹层没有样式(0.9.159 才补上那次调用)。
4533
5586
  try { ensurePortedCss() } catch {}
4534
5587
 
4535
- // ① the 主理鱼 tab in the centre-column view ring
4536
- ctx.effect(() => {
5588
+ // 品牌名同时驱动左栏、右栏 definition 与右栏标题。旧中栏删除后,
5589
+ // 改名订阅仍保留在这些存活入口上:先释放原注册,再按同 id/key/component 重注册。
5590
+ tabNameOverride = readTabNameOverride()
5591
+ const mountBrandEntry = (mount, failureKey, onFailure) => {
5592
+ let dispose = null
5593
+ const fail = (error) => {
5594
+ const message = String((error && error.message) || error)
5595
+ note(failureKey, message)
5596
+ if (typeof onFailure === 'function') {
5597
+ try { onFailure(message) } catch {}
5598
+ }
5599
+ }
5600
+ const unmount = () => {
5601
+ if (!dispose) return
5602
+ const current = dispose
5603
+ dispose = null
5604
+ try { current() } catch {}
5605
+ }
5606
+ const remount = () => {
5607
+ unmount()
5608
+ dispose = mount()
5609
+ }
4537
5610
  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
5611
+ remount()
5612
+ const stopWatching = subscribeTabName(() => {
5613
+ try { remount() } catch (error) {
5614
+ fail(error)
5615
+ }
4547
5616
  })
5617
+ const cleanup = () => { stopWatching(); unmount() }
5618
+ // 宿主服务可能比本插件晚就绪:记下 remount,服务到位后重挂一次,
5619
+ // 让入口用「服务已可用」的新状态渲染(否则真机会一直显示禁用)。
5620
+ cleanup.remount = remount
5621
+ return cleanup
4548
5622
  } catch (error) {
4549
- note('desk-fail', String((error && error.message) || error))
5623
+ fail(error)
5624
+ unmount()
4550
5625
  return undefined
4551
5626
  }
5627
+ }
5628
+ const openSession = async (id) => {
5629
+ const sessions = typeof ctx.get === 'function' ? ctx.get('sessions') : ctx.sessions
5630
+ const uiWorkspace = typeof ctx.get === 'function' ? ctx.get('uiWorkspace') : ctx.uiWorkspace
5631
+ if (!sessions || !uiWorkspace || !sessions.list) throw new Error('Session navigation unavailable')
5632
+ if (sessions.list.getSnapshot().phase !== 'ready' || !sessions.list.getSnapshot().byId[id]) await sessions.refresh()
5633
+ const catalog = sessions.list.getSnapshot()
5634
+ if (catalog.phase !== 'ready') throw new Error('Session catalog is not ready')
5635
+ if (!catalog.byId[id]) throw new Error('Session is not listed: ' + id)
5636
+ uiWorkspace.openSession(id)
5637
+ }
5638
+ hostOpenSession = openSession
5639
+
5640
+ // 左侧全局中枢:main 与 sidebar.panellist 使用同一个 panel id。
5641
+ // layout 同样可能晚于 apply 就绪(与右栏同源问题):只挂一次会让左栏全局页永久缺失,
5642
+ // 所以也做成可重入 mount,由下方 ctx.inject(['layout']) 在服务到位后补挂。
5643
+ let globalEntriesCleanup = null
5644
+ let globalEntriesHost = null
5645
+ const unmountGlobalEntries = () => {
5646
+ if (globalEntriesCleanup) {
5647
+ try { globalEntriesCleanup() } catch {}
5648
+ }
5649
+ globalEntriesCleanup = null
5650
+ globalEntriesHost = null
5651
+ }
5652
+ const mountGlobalEntries = () => {
5653
+ if (!hostLayout || typeof hostLayout.selectPanel !== 'function') {
5654
+ noteOnce('layout-unavailable', 'layout.selectPanel 服务不存在;不注册无法选择的全局入口')
5655
+ return
5656
+ }
5657
+ if (globalEntriesCleanup && globalEntriesHost === hostLayout) return
5658
+ unmountGlobalEntries()
5659
+ const disposers = []
5660
+ try {
5661
+ const disposePanel = ctx.slots.inject('main', () => ctx.slots.register({
5662
+ name: 'main', key: GLOBAL_PANEL_ID,
5663
+ }, SuperagentGlobalPage))
5664
+ if (typeof disposePanel === 'function') disposers.push(disposePanel)
5665
+ } catch (error) {
5666
+ note('global-panel-fail', String((error && error.message) || error))
5667
+ }
5668
+ const sidebarCleanup = mountBrandEntry(() => ctx.slots.inject('sidebar.panellist', () => ctx.slots.register({
5669
+ name: 'sidebar.panellist', id: GLOBAL_PANEL_ID, order: 20,
5670
+ label: () => tabNameLabel(),
5671
+ }, SuperagentNavIcon)), 'global-sidebar-fail')
5672
+ if (sidebarCleanup) disposers.push(sidebarCleanup)
5673
+ if (!disposers.length) return
5674
+ globalEntriesCleanup = () => {
5675
+ for (const dispose of disposers.reverse()) {
5676
+ try { dispose() } catch {}
5677
+ }
5678
+ }
5679
+ globalEntriesHost = hostLayout
5680
+ }
5681
+ ctx.effect(() => {
5682
+ mountGlobalEntries()
5683
+ return unmountGlobalEntries
5684
+ })
5685
+
5686
+ // 右栏 page type:definition.id 用于 keyed body/title 分派,definition.kind 用于 openTab。
5687
+ // 这三件事都依赖宿主 sidebarRightTabs 就绪。真机上该服务晚于本插件 apply,而 ctx.effect
5688
+ // 只在 apply 跑一次 —— 只靠 ctx.effect 会出现「服务到位后头部被启用、definition 却没注册」,
5689
+ // 点下去宿主抛 `sidebarRight: no tab type is registered as "sessionSuperagent"`。
5690
+ // 所以拆成可重入的 mount 函数:apply 时试一次,服务到位/重建时(见下方 ctx.inject)再试。
5691
+ // 幂等判据必须看「宿主注册表里还有没有我们的 id」:宿主 HMR 换掉 service 实例后,
5692
+ // 本地 cleanup 还在,但新 registry 是空的 —— 只看本地 flag 会把右栏永久丢掉。
5693
+ const canRegisterRightTab = () => Boolean(hostSidebarRightTabs
5694
+ && typeof hostSidebarRightTabs.register === 'function')
5695
+ let rightDefinitionCleanup = null
5696
+ let rightDefinitionHost = null
5697
+ let rightPaneCleanup = null
5698
+ let rightPaneHost = null
5699
+ const unmountRightDefinition = () => {
5700
+ if (rightDefinitionCleanup) {
5701
+ try { rightDefinitionCleanup() } catch {}
5702
+ }
5703
+ rightDefinitionCleanup = null
5704
+ rightDefinitionHost = null
5705
+ }
5706
+ const mountRightDefinition = () => {
5707
+ if (!canRegisterRightTab()) {
5708
+ noteOnce('sidebar-right-tabs-unavailable', 'sidebarRightTabs.register 服务不存在;会话头部入口显示不可用原因')
5709
+ return
5710
+ }
5711
+ if (rightDefinitionCleanup && rightDefinitionHost === hostSidebarRightTabs && rightTabOwnedByUs()) return
5712
+ unmountRightDefinition()
5713
+ const cleanup = mountBrandEntry(() => {
5714
+ const dispose = hostSidebarRightTabs.register({
5715
+ id: RIGHT_TAB_ID,
5716
+ kind: RIGHT_TAB_KIND,
5717
+ priority: 'builtin',
5718
+ title: () => tabNameLabel(),
5719
+ guide: [{
5720
+ id: 'session-superagent',
5721
+ order: 20,
5722
+ title: () => tabNameLabel(),
5723
+ description: () => '查看当前项目会话的 watcher、Ticket、执行、Outbox 与草稿',
5724
+ icon: SuperagentNavIcon,
5725
+ }],
5726
+ })
5727
+ rightRegistrationError = null
5728
+ return dispose
5729
+ }, 'right-definition-fail', (message) => { rightRegistrationError = message })
5730
+ if (!cleanup) return
5731
+ rightDefinitionCleanup = cleanup
5732
+ rightDefinitionHost = hostSidebarRightTabs
5733
+ }
5734
+ const unmountRightPane = () => {
5735
+ if (rightPaneCleanup) {
5736
+ try { rightPaneCleanup() } catch {}
5737
+ }
5738
+ rightPaneCleanup = null
5739
+ rightPaneHost = null
5740
+ }
5741
+ const mountRightPane = () => {
5742
+ if (!canRegisterRightTab()) return
5743
+ if (rightPaneCleanup && rightPaneHost === hostSidebarRightTabs) return
5744
+ unmountRightPane()
5745
+ const disposers = []
5746
+ try {
5747
+ const disposeBody = ctx.slots.inject('sidebar.right.pane.tab', () => ctx.slots.register({
5748
+ name: 'sidebar.right.pane.tab', key: RIGHT_TAB_ID,
5749
+ }, SuperagentSessionPage))
5750
+ if (typeof disposeBody === 'function') disposers.push(disposeBody)
5751
+ } catch (error) {
5752
+ note('right-tab-fail', String((error && error.message) || error))
5753
+ }
5754
+ const titleCleanup = mountBrandEntry(() => ctx.slots.inject('sidebar.right.pane.tab.title', () => ctx.slots.register({
5755
+ name: 'sidebar.right.pane.tab.title', key: RIGHT_TAB_ID,
5756
+ }, SuperagentRightTabTitle)), 'right-title-fail')
5757
+ if (titleCleanup) disposers.push(titleCleanup)
5758
+ if (!disposers.length) return
5759
+ rightPaneCleanup = () => {
5760
+ for (const dispose of disposers.reverse()) {
5761
+ try { dispose() } catch {}
5762
+ }
5763
+ }
5764
+ rightPaneHost = hostSidebarRightTabs
5765
+ }
5766
+ ctx.effect(() => {
5767
+ mountRightDefinition()
5768
+ mountRightPane()
5769
+ return () => {
5770
+ unmountRightDefinition()
5771
+ unmountRightPane()
5772
+ }
5773
+ })
5774
+ let headerRemount = null
5775
+ let headerCleanup = null
5776
+ const mountHeaderEntry = () => {
5777
+ if (headerCleanup) return
5778
+ if (!hostLayout && !hostSidebarRight && !hostSidebarRightTabs) return
5779
+ try {
5780
+ const cleanup = mountBrandEntry(() => ctx.slots.inject('conversation.session.header.utilities', () => ctx.slots.register({
5781
+ name: 'conversation.session.header.utilities', id: HEADER_UTILITY_ID, order: -6,
5782
+ }, SuperagentHeaderUtility)), 'header-utility-fail')
5783
+ if (!cleanup) return
5784
+ headerCleanup = cleanup
5785
+ if (typeof cleanup.remount === 'function') headerRemount = cleanup.remount
5786
+ } catch (error) {
5787
+ note('header-utility-fail', String((error && error.message) || error))
5788
+ }
5789
+ }
5790
+ ctx.effect(() => {
5791
+ mountHeaderEntry()
5792
+ return () => {
5793
+ if (headerCleanup) {
5794
+ try { headerCleanup() } catch {}
5795
+ headerCleanup = null
5796
+ headerRemount = null
5797
+ }
5798
+ }
5799
+ })
5800
+
5801
+ // 真机上 sidebarRight 等宿主服务可能在本插件 apply 之后才就绪,也可能在宿主 HMR 时
5802
+ // 被换成新实例:Cordis 的 ctx.inject(deps, cb) 是子插件 fiber —— 依赖到位时跑一次,
5803
+ // 依赖重建再跑。各入口的依赖要拆开:右栏 definition 只依赖 sidebarRightTabs,
5804
+ // 头部只依赖 sidebarRight,全局页只依赖 layout。把它们绑在同一个 inject 上,
5805
+ // 任一服务缺失/晚到就会连累其余入口(2.0.0 真机:sessions 缺失 → definition 永不注册)。
5806
+ const refreshHostServices = (scoped) => {
5807
+ const host = scoped && typeof scoped.get === 'function' ? scoped : ctx
5808
+ const nextRight = optionalHostService(host, 'sidebarRight')
5809
+ const nextTabs = optionalHostService(host, 'sidebarRightTabs')
5810
+ const nextSessions = optionalHostService(host, 'sessions')
5811
+ const nextLayout = optionalHostService(host, 'layout')
5812
+ const changed = nextRight !== hostSidebarRight || nextTabs !== hostSidebarRightTabs
5813
+ || nextSessions !== hostSessions || nextLayout !== hostLayout
5814
+ hostSidebarRight = nextRight
5815
+ hostSidebarRightTabs = nextTabs
5816
+ hostSessions = nextSessions
5817
+ if (nextLayout) hostLayout = nextLayout
5818
+ return changed
5819
+ }
5820
+ const onHostServicesReady = (scoped) => {
5821
+ const changed = refreshHostServices(scoped)
5822
+ // 顺序不能反:先补注册右栏 definition 与 body/title、补挂左栏全局页,
5823
+ // 再重挂头部 —— 头部渲染时按宿主注册表的真实内容决定是否可用(见 rightTabIssue)。
5824
+ mountRightDefinition()
5825
+ mountRightPane()
5826
+ mountGlobalEntries()
5827
+ if (changed) note('host-services-ready', '收到宿主导航服务,补挂右栏与头部入口')
5828
+ if (headerCleanup) {
5829
+ if (headerRemount) {
5830
+ try { headerRemount() } catch {}
5831
+ }
5832
+ } else {
5833
+ // apply 时服务全缺,头部当时根本没注册 —— 这里补挂。
5834
+ mountHeaderEntry()
5835
+ }
5836
+ }
5837
+ if (typeof ctx.inject === 'function') {
5838
+ for (const deps of [['sidebarRightTabs'], ['sidebarRight'], ['layout']]) {
5839
+ try {
5840
+ ctx.inject(deps, onHostServicesReady)
5841
+ } catch (error) {
5842
+ note('host-services-inject-fail', String((error && error.message) || error))
5843
+ }
5844
+ }
5845
+ }
5846
+
5847
+ // 同一浏览器的其它页面改了名字:storage 事件只当触发器,真值回 localStorage 读。
5848
+ // 该监听独立于任何页面是否打开,确保左栏/右栏与设置草稿都收到改名通知。
5849
+ ctx.effect(() => {
5850
+ const onStorage = (event) => {
5851
+ if (!event) return
5852
+ // localStorage.clear() 的事件 key 是 null —— 那是「所有覆盖都没了」,按删除处理。
5853
+ const cleared = event.key === null || event.key === undefined
5854
+ if (!cleared && event.key !== TAB_NAME_STORAGE_KEY) return
5855
+ const before = tabNameLabel()
5856
+ tabNameOverride = (cleared || event.newValue === null || event.newValue === undefined)
5857
+ ? null
5858
+ : readTabNameOverride()
5859
+ if (tabNameLabel() === before) return
5860
+ try { notifyTabName(before) } catch {}
5861
+ }
5862
+ try {
5863
+ if (typeof window !== 'undefined' && typeof window.addEventListener === 'function') {
5864
+ window.addEventListener('storage', onStorage)
5865
+ }
5866
+ } catch {}
5867
+ return () => {
5868
+ try {
5869
+ if (typeof window !== 'undefined' && typeof window.removeEventListener === 'function') {
5870
+ window.removeEventListener('storage', onStorage)
5871
+ }
5872
+ } catch {}
5873
+ }
4552
5874
  })
4553
5875
 
4554
5876
  // ② the machine-wide orbit in the composer dock row — the same row as