@sshirkit/dsh-orchestrator 1.0.2 → 1.0.3

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/lib/client.js CHANGED
@@ -28,7 +28,8 @@ window.__ModuleLoader__.load({
28
28
  'route.catalogFailed': '无法加载模型目录',
29
29
  'route.readonly': '当前不可写,无法保存',
30
30
  'route.saveFailed': '保存失败',
31
- 'route.note': '主代理的改动对新会话生效;子代理的改动从下一次委派起生效。子代理共享默认路由,可在任务或阶段中显式覆盖。',
31
+ 'route.note': '主代理的全局默认模型对新会话生效;子代理从下一次委派起使用新路由,可在任务或阶段中显式覆盖。',
32
+ 'route.sessionNote': '主代理的新路由在当前会话的下一步生效;子代理从下一次委派起使用新路由。',
32
33
  'route.search': '搜索模型…',
33
34
  'route.noMatch': '没有匹配的模型',
34
35
  'route.noMatchHint': '换个关键词,或清空搜索看全部',
@@ -37,18 +38,25 @@ window.__ModuleLoader__.load({
37
38
  'route.enableNote': '开启后主代理只做规划、由子代理执行;已打开的会话也会立即生效。',
38
39
  'route.enableFailed': '切换失败',
39
40
  'worktreeIsolation.label': '默认启用 Git Worktree 隔离',
40
- 'worktreeIsolation.hint': 'Git 仓库中的写任务默认使用独立 Worktree,并用 git diff / git log 审计。delegate 按任务、orchestrate 按条目隔离;非 Git 目录自动使用逻辑快照审计。',
41
+ 'worktreeIsolation.hint': 'Git 仓库中的写任务默认使用独立 Worktree,delegate 按任务隔离,orchestrate 按条目隔离。非 Git 工作区使用写租约协调共享目录中的写入。',
41
42
  'allowed.title': 'Allowed Tools',
42
43
  'allowed.search': '搜索工具…',
43
44
  'allowed.empty': '没有匹配的工具',
44
45
  'allowed.reset': '重置',
45
46
  'allowed.session': '仅当前会话',
46
- 'allowed.sessionOn': '仅本会话独立生效。',
47
+ 'allowed.sessionOn': '面板内所有选项仅对当前会话生效。',
47
48
  'allowed.sessionOff': '继承全局默认;编辑将修改全局设置。',
48
49
  'allowed.sessionMissing': '没有可用于保存的会话。',
49
- 'allowed.sessionLoading': '正在加载会话白名单…',
50
- 'allowed.sessionFailed': '无法加载会话白名单',
51
- 'allowed.sessionStorage': '会话白名单存储不可用。',
50
+ 'allowed.sessionLoading': '正在加载会话设置…',
51
+ 'allowed.sessionFailed': '无法加载会话设置',
52
+ 'allowed.sessionStorage': '会话设置存储不可用。',
53
+ 'more.button': '更多',
54
+ 'more.title': '更多调度设置',
55
+ 'more.close': '关闭',
56
+ 'readOnly.label': '启用只读参数',
57
+ 'readOnly.hint': '关闭时隐藏 readOnly 参数,并引导模型用 isolation: "shared" 做只读调研。若开启则推荐配合“子代理平级主动通讯”选项一块开启(对应“允许平级询问”开关)。',
58
+ 'peerReadOnlyConsult.label': '允许平级询问',
59
+ 'peerReadOnlyConsult.hint': '同一会话中的只读子代理可以共享已读索引并互相咨询,主代理不会收到通知。',
52
60
  'allowed.hint': '白名单式驱动:勾选 = 允许主代理使用;未勾选(含新插件工具)= 自动禁用。',
53
61
  'allowed.nativeBlocked': '按 ADR-0004 默认禁用;建议改用 delegate / orchestrate。显式勾选可覆盖。',
54
62
  'allowed.teamDisabled': '调度模式下禁止主代理调用原生 Team 任务板工具(allowAgentTeam: false)。',
@@ -74,7 +82,8 @@ window.__ModuleLoader__.load({
74
82
  'route.catalogFailed': 'Could not load the model catalog',
75
83
  'route.readonly': 'Not writable right now, cannot save',
76
84
  'route.saveFailed': 'Could not save',
77
- 'route.note': 'A main agent change applies to new sessions; a subagent change applies from the next delegation. Subagents share a default route that can be explicitly overridden for a task or stage.',
85
+ 'route.note': 'The global main agent default applies to new sessions. Subagents use the new route from the next delegation, unless a task or stage overrides it.',
86
+ 'route.sessionNote': 'The main agent uses the new route on the next step in this session. Subagents use it from the next delegation.',
78
87
  'route.search': 'Search models…',
79
88
  'route.noMatch': 'No matching models',
80
89
  'route.noMatchHint': 'Try another keyword, or clear the search to see everything',
@@ -83,18 +92,25 @@ window.__ModuleLoader__.load({
83
92
  'route.enableNote': 'The main agent only plans and delegates the work; an open conversation follows the switch immediately.',
84
93
  'route.enableFailed': 'Could not switch',
85
94
  'worktreeIsolation.label': 'Enable Git Worktree isolation by default',
86
- 'worktreeIsolation.hint': 'Write tasks in Git repositories use separate worktrees with git diff / git log audits: one per delegate task or orchestrate item. Non-Git directories fall back to snapshot audits.',
95
+ 'worktreeIsolation.hint': 'By default, write tasks in Git repositories use separate worktrees: one per delegate task or orchestrate item. Non-Git workspaces use write leases to coordinate writes in the shared directory.',
87
96
  'allowed.title': 'Allowed Tools',
88
97
  'allowed.search': 'Filter tools…',
89
98
  'allowed.empty': 'No matching tools',
90
99
  'allowed.reset': 'Reset',
91
100
  'allowed.session': 'Only for this session',
92
- 'allowed.sessionOn': 'Uses a separate list for this session.',
101
+ 'allowed.sessionOn': 'All settings in this panel apply only to this session.',
93
102
  'allowed.sessionOff': 'Inherits global defaults; edits change the global settings.',
94
103
  'allowed.sessionMissing': 'No session is available for saving.',
95
- 'allowed.sessionLoading': 'Loading session allowed tools…',
96
- 'allowed.sessionFailed': 'Could not load session allowed tools',
97
- 'allowed.sessionStorage': 'Session tools storage is unavailable.',
104
+ 'allowed.sessionLoading': 'Loading session settings…',
105
+ 'allowed.sessionFailed': 'Could not load session settings',
106
+ 'allowed.sessionStorage': 'Session settings storage is unavailable.',
107
+ 'more.button': 'More',
108
+ 'more.title': 'More dispatch settings',
109
+ 'more.close': 'Close',
110
+ 'readOnly.label': 'Enable the read-only parameter',
111
+ 'readOnly.hint': 'When off, readOnly is hidden and models are directed to use isolation: "shared" for read-only research. If enabled, we recommend also turning on "Allow peer consultation" for proactive communication between subagents.',
112
+ 'peerReadOnlyConsult.label': 'Allow peer consultation',
113
+ 'peerReadOnlyConsult.hint': 'Read-only subagents in the same session can share indexes of what they have read and consult each other without notifying the main agent.',
98
114
  'allowed.hint': 'Whitelist-driven: checked = allowed for the main agent; unchecked (including new plugin tools) = blocked automatically.',
99
115
  'allowed.nativeBlocked': 'Disabled by default under ADR-0004; prefer delegate / orchestrate. Check explicitly to override.',
100
116
  'allowed.teamDisabled': 'In dispatch mode, the main agent cannot call native Team task-board tools (allowAgentTeam: false).',
@@ -447,28 +463,82 @@ window.__ModuleLoader__.load({
447
463
  if (!Number.isSafeInteger(value) || value < 0) throw new TypeError('revision must be a non-negative safe integer')
448
464
  return value
449
465
  }
466
+ const isObject = (value) => value !== null && typeof value === 'object'
467
+ const objectRecord = (value) => {
468
+ const prototype = isObject(value) ? Object.getPrototypeOf(value) : undefined
469
+ return prototype === Object.prototype || prototype === null
470
+ }
450
471
  const fields = (value, names) => {
451
- if (value === null || typeof value !== 'object' || Array.isArray(value) ||
452
- Object.keys(value).length !== names.length || !names.every((key) => Object.hasOwn(value, key))) {
472
+ if (!isObject(value) || Array.isArray(value) || Object.keys(value).length !== names.length ||
473
+ !names.every((key) => Object.hasOwn(value, key))) {
453
474
  throw new TypeError(`expected record with fields ${names.join(', ')}`)
454
475
  }
455
476
  }
477
+ const boolean = (value, field) => {
478
+ if (typeof value !== 'boolean') throw new TypeError(`${field} must be a boolean`)
479
+ return value
480
+ }
481
+ const integer = (value, { key, min, max }) => {
482
+ if (!Number.isInteger(value) || value < min || value > max) {
483
+ throw new TypeError(`${key} must be an integer in ${min}..${max}`)
484
+ }
485
+ return value
486
+ }
487
+ const parseRoute = (value, field) => {
488
+ if (value === null) return null
489
+ if (!objectRecord(value) || !Object.hasOwn(value, 'provider') || !Object.hasOwn(value, 'model') ||
490
+ Object.keys(value).some((key) => !['provider', 'model', 'reasoningEffort'].includes(key))) {
491
+ throw new TypeError(`${field} must be a route with provider, model and optional reasoningEffort, or null`)
492
+ }
493
+ const provider = nonempty(value.provider, `${field}.provider`).trim()
494
+ const model = nonempty(value.model, `${field}.model`).trim()
495
+ if (Object.hasOwn(value, 'reasoningEffort') && typeof value.reasoningEffort !== 'string') {
496
+ throw new TypeError(`${field}.reasoningEffort must be a string`)
497
+ }
498
+ const reasoningEffort = value.reasoningEffort?.trim()
499
+ return { provider, model, ...(reasoningEffort && { reasoningEffort }) }
500
+ }
501
+ const configParsers = {
502
+ enabled: boolean,
503
+ worktreeIsolationEnabled: boolean,
504
+ readOnlyEnabled: boolean,
505
+ peerReadOnlyConsultEnabled: boolean,
506
+ mainRoute: parseRoute,
507
+ workerRoute: parseRoute,
508
+ superviseIntervalSeconds: (value) => integer(value, INTERVAL),
509
+ superviseMaxNoticesPerChild: (value) => integer(value, PATROL_COUNT),
510
+ superviseUnlimited: boolean,
511
+ allowedTools: parseNames,
512
+ }
513
+ const parseConfigPatch = (value) => {
514
+ if (!objectRecord(value)) throw new TypeError('config must be an object')
515
+ return Object.fromEntries(Object.entries(value).map(([key, item]) => {
516
+ if (!Object.hasOwn(configParsers, key)) throw new TypeError(`unknown config field: ${key}`)
517
+ return [key, configParsers[key](item, key)]
518
+ }))
519
+ }
456
520
  const parseResult = (value) => {
457
521
  if (value?.ok === false) {
458
522
  fields(value, ['ok', 'error'])
459
523
  fields(value.error, ['code', 'message'])
460
524
  nonempty(value.error.code, 'error code')
461
525
  nonempty(value.error.message, 'error message')
462
- } else {
463
- fields(value, ['sessionId', 'enabled', 'allowedTools', 'revision', 'storageReady'])
464
- if (typeof value.enabled !== 'boolean' || typeof value.storageReady !== 'boolean') {
465
- throw new TypeError('enabled and storageReady must be booleans')
466
- }
467
- parseSession(value.sessionId)
468
- parseNames(value.allowedTools)
469
- parseRevision(value.revision)
526
+ return value
470
527
  }
471
- return value
528
+ fields(value, ['sessionId', 'enabled', 'allowedTools', 'config', 'revision', 'storageReady'])
529
+ if (typeof value.enabled !== 'boolean' || typeof value.storageReady !== 'boolean') {
530
+ throw new TypeError('enabled and storageReady must be booleans')
531
+ }
532
+ parseSession(value.sessionId)
533
+ fields(value.config, Object.keys(configParsers))
534
+ const config = parseConfigPatch(value.config)
535
+ const allowedTools = parseNames(value.allowedTools)
536
+ if (allowedTools.length !== value.allowedTools.length || allowedTools.length !== value.config.allowedTools.length ||
537
+ !allowedTools.every((name, index) => config.allowedTools[index] === name)) {
538
+ throw new TypeError('allowedTools must match config.allowedTools exactly')
539
+ }
540
+ parseRevision(value.revision)
541
+ return { ...value, allowedTools, config }
472
542
  }
473
543
  const codec = (typeSymbol, parse) => ({ mode: 'strict', typeSymbol, create: () => ({ parse }) })
474
544
  const parameter = (name, typeSymbol, parse) => ({
@@ -477,8 +547,11 @@ window.__ModuleLoader__.load({
477
547
  const session = parameter('sessionId', 'SessionId', parseSession)
478
548
  const names = parameter('allowedTools', 'OrchestratorToolNames', parseNames)
479
549
  const revision = parameter('expectedRevision', 'OrchestratorToolsRevision', parseRevision)
550
+ const config = parameter('config', 'OrchestratorSessionConfigPatch', parseConfigPatch)
480
551
  const result = codec('OrchestratorSessionToolsResult', parseResult)
481
- return Object.entries({ get: [session], set: [session, names, revision], clear: [session, revision] })
552
+ return Object.entries({
553
+ get: [session], set: [session, names, revision], setConfig: [session, config, revision], clear: [session, revision],
554
+ })
482
555
  .map(([method, parameters]) => ({
483
556
  id: `${SESSION_REMOTE_PACKAGE}/${SESSION_REMOTE}/${method}`,
484
557
  service: SESSION_REMOTE,
@@ -572,34 +645,169 @@ window.__ModuleLoader__.load({
572
645
  }
573
646
  }
574
647
 
648
+ function toSessionRoute({ provider, model, effort }) {
649
+ if (!provider.trim() || !model.trim()) return null
650
+ return { provider, model, ...(effort.trim() === '' ? {} : { reasoningEffort: effort }) }
651
+ }
652
+
653
+ function fromSessionRoute(route) {
654
+ return { provider: route?.provider ?? '', model: route?.model ?? '', effort: route?.reasoningEffort ?? '' }
655
+ }
656
+
657
+ function createGlobalSnapshot(plugin, main, worker, catalog = catalogOf(plugin)) {
658
+ return {
659
+ enabled: plugin?.enabled ?? true,
660
+ worktreeIsolationEnabled: worktreeIsolationOf(plugin),
661
+ readOnlyEnabled: plugin?.readOnlyEnabled === true,
662
+ peerReadOnlyConsultEnabled: plugin?.peerReadOnlyConsultEnabled === true,
663
+ mainRoute: toSessionRoute(routeOf(MAIN.fields, main)),
664
+ workerRoute: toSessionRoute(routeOf(WORKER.fields, worker)),
665
+ superviseIntervalSeconds: intervalOf(plugin),
666
+ superviseMaxNoticesPerChild: patrolCountOf(plugin),
667
+ superviseUnlimited: unlimitedOf(plugin),
668
+ allowedTools: [...allowedSetOf(plugin, catalog)],
669
+ }
670
+ }
671
+
672
+ function writable(snapshot) {
673
+ return snapshot.status === 'ready' && snapshot.writable === true
674
+ }
675
+
676
+ function useSessionConfig(sessionId, remote, open, t) {
677
+ const active = React.useRef(null)
678
+ const [view, setView] = React.useState(null)
679
+ const scoped = remote !== undefined || sessionId !== undefined
680
+ const validId = typeof sessionId === 'string' && sessionId.trim() !== ''
681
+ const available = validId && Boolean(remote)
682
+ const display = view?.sessionId === sessionId && view?.remote === remote ? view : null
683
+ const state = display?.state
684
+ const loading = available && (!display?.loaded || display.loading)
685
+ const saving = display?.saving === true
686
+
687
+ const render = (request) => {
688
+ if (active.current === request) setView({ ...request })
689
+ }
690
+ React.useEffect(() => {
691
+ const request = { sessionId, remote, loaded: false, loading: false, saving: false }
692
+ active.current = request
693
+ return () => { if (active.current === request) active.current = null }
694
+ }, [sessionId, remote])
695
+ React.useEffect(() => {
696
+ if (!open || !available) return
697
+ const request = active.current
698
+ if (request.loading || request.saving) return
699
+ request.loading = true
700
+ request.problem = null
701
+ render(request)
702
+ Promise.resolve().then(() => remote.call('get', sessionId)).then((next) => {
703
+ request.state = next
704
+ }, (error) => {
705
+ if (request.state) request.state = { ...request.state, storageReady: false }
706
+ request.problem = error?.message || t('allowed.sessionFailed')
707
+ }).finally(() => {
708
+ request.loaded = true
709
+ request.loading = false
710
+ render(request)
711
+ })
712
+ }, [sessionId, remote, open])
713
+
714
+ const write = async (method, config) => {
715
+ const request = active.current
716
+ if (request?.sessionId !== sessionId || request?.remote !== remote ||
717
+ request?.state?.storageReady !== true || request.loading || request.saving) return t('route.readonly')
718
+ request.saving = true
719
+ request.problem = null
720
+ render(request)
721
+ try {
722
+ const { revision } = request.state
723
+ request.state = method === 'clear'
724
+ ? await remote.call('clear', sessionId, revision)
725
+ : await remote.call('setConfig', sessionId, config, revision)
726
+ return null
727
+ } catch (error) {
728
+ if (active.current === request && ['REVISION_CONFLICT', 'STORAGE_UNAVAILABLE', 'STORAGE_WRITE_FAILED'].includes(error?.code)) {
729
+ try {
730
+ request.state = await remote.call('get', sessionId)
731
+ } catch {
732
+ request.state = { ...request.state, storageReady: false }
733
+ }
734
+ }
735
+ request.problem = error?.message || t('route.saveFailed')
736
+ return request.problem
737
+ } finally {
738
+ request.saving = false
739
+ render(request)
740
+ }
741
+ }
742
+ const problem = display?.problem || (scoped && !validId ? t('allowed.sessionMissing')
743
+ : scoped && !remote ? t('allowed.sessionFailed')
744
+ : state?.storageReady === false ? t('allowed.sessionStorage') : null)
745
+ return { state, loading, saving, problem, write }
746
+ }
747
+
575
748
  const h = React.createElement
576
- // The popover is two columns: the original panel keeps its width, padding and
577
- // outline, and its own right border separates it from the allowed-tools column.
578
- const panelStyle = {
579
- position: 'absolute',
580
- // Anchored by its left column: the original panel keeps the exact place it had
581
- // (`right: 0` with width 340), and the allowed-tools column grows to its right
582
- // instead of pushing the left column under the conversation sidebar.
583
- left: 'calc(100% - 340px)',
584
- bottom: 'calc(100% + 8px)',
585
- zIndex: 50,
586
- width: 'auto',
587
- padding: 0,
749
+ const panelBorder = '1px solid var(--dsw-alias-border-l2, color-mix(in srgb, currentColor 22%, transparent))'
750
+ const popoverSurface = {
751
+ boxSizing: 'border-box',
588
752
  borderRadius: '12px',
589
- border: '1px solid var(--dsw-alias-border-l2, color-mix(in srgb, currentColor 22%, transparent))',
753
+ border: panelBorder,
590
754
  background: 'var(--dsw-alias-bg-layer-2, Canvas)',
591
- color: 'inherit',
755
+ color: 'var(--dsw-alias-label-primary, CanvasText)',
592
756
  boxShadow: '0 12px 32px rgba(0, 0, 0, .3)',
593
757
  fontSize: '12px',
758
+ }
759
+ const panelWidth = 574
760
+ // The original left column keeps its width where the viewport allows; the
761
+ // tools sit to its right and neither column can grow outside the viewport.
762
+ const panelStyle = {
763
+ ...popoverSurface,
764
+ position: 'fixed',
765
+ zIndex: 1090,
766
+ width: `min(${panelWidth}px, calc(100vw - 16px))`,
594
767
  display: 'flex',
595
768
  alignItems: 'stretch',
596
769
  overflow: 'hidden',
597
- // Last-resort guard for a short window: the popover may never grow past the viewport.
598
- // The left column scrolls on its own when this bites (see `panelColumnStyle`).
599
- maxHeight: 'calc(100vh - 96px)',
770
+ visibility: 'hidden',
771
+ }
772
+ const topInsetProbeStyle = {
773
+ position: 'absolute',
774
+ visibility: 'hidden',
775
+ pointerEvents: 'none',
776
+ width: 0,
777
+ height: 'var(--dsh-frame-overlay-top, 0px)',
778
+ }
779
+ const headingRowStyle = { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: '6px' }
780
+ const sessionSeparatorStyle = { borderTop: panelBorder, marginBlock: '2px' }
781
+ const moreOverlayStyle = {
782
+ position: 'fixed',
783
+ inset: 0,
784
+ zIndex: 1110,
785
+ display: 'grid',
786
+ placeItems: 'center',
787
+ padding: '12px',
788
+ background: 'rgba(0, 0, 0, .25)',
789
+ }
790
+ const morePanelStyle = {
791
+ ...popoverSurface,
792
+ width: 'min(100%, 400px)',
793
+ maxHeight: '100%',
794
+ minHeight: 0,
795
+ display: 'grid',
796
+ gap: '12px',
797
+ padding: '14px',
798
+ overflowY: 'auto',
799
+ }
800
+
801
+ function portalToBody(node) {
802
+ if (node === null || typeof ReactDOM?.createPortal !== 'function' || typeof document === 'undefined' || !document.body) {
803
+ return node
804
+ }
805
+ return ReactDOM.createPortal(node, document.body)
600
806
  }
601
807
  const panelColumnStyle = {
602
- width: '340px',
808
+ flex: '340 1 0px',
809
+ minWidth: 0,
810
+ minHeight: 0,
603
811
  padding: '12px',
604
812
  display: 'grid',
605
813
  // One column pinned to the column's own width: with the implicit `auto` track a vertical
@@ -617,7 +825,9 @@ window.__ModuleLoader__.load({
617
825
  borderRight: '1px solid var(--dsw-alias-border-l2, color-mix(in srgb, currentColor 22%, transparent))',
618
826
  }
619
827
  const allowedColumnStyle = {
620
- width: '232px',
828
+ flex: '232 1 0px',
829
+ minWidth: 0,
830
+ overflow: 'hidden auto',
621
831
  padding: '12px',
622
832
  display: 'flex',
623
833
  flexDirection: 'column',
@@ -650,7 +860,7 @@ window.__ModuleLoader__.load({
650
860
  border: '1px solid var(--dsw-alias-border-l2, color-mix(in srgb, currentColor 22%, transparent))',
651
861
  background: 'var(--dsw-alias-bg-layer-1, transparent)',
652
862
  flex: '1 1 0px',
653
- minHeight: 0,
863
+ minHeight: '84px',
654
864
  boxSizing: 'border-box',
655
865
  contain: 'size',
656
866
  }
@@ -828,26 +1038,90 @@ window.__ModuleLoader__.load({
828
1038
  }
829
1039
  }
830
1040
 
831
- /**
832
- * The popover opens upward from its trigger, so the room it really has is the space above
833
- * that trigger, not the whole window: capping it to `100vh` still let the top of the panel
834
- * hang outside the window when the composer sat low. `null` keeps the static style (a host
835
- * without layout, as in a unit test).
836
- */
837
- function panelStyleOf(room) {
838
- if (room === null || room === undefined) return panelStyle
839
- return Object.assign({}, panelStyle, { maxHeight: room + 'px' })
1041
+ /** Available height above the trigger, within the viewport's safe band. */
1042
+ function panelRoom(triggerTop, viewportHeight, topSafe = 56) {
1043
+ if (![triggerTop, viewportHeight, topSafe].every(Number.isFinite)) return null
1044
+ return Math.max(0, Math.min(triggerTop - 8, viewportHeight - 8) - topSafe)
840
1045
  }
841
1046
 
842
- /**
843
- * The height the popover may use. It is bottom-anchored 8px above its trigger, so the room
844
- * is `trigger.top - 56` (8px gap + 48px of host top chrome): anything larger hangs under
845
- * the session header, which clips the panel's rounded top edge and the first rows of both
846
- * columns — the columns then scrolled to reveal what was already off screen.
847
- */
848
- function panelRoom(triggerTop, viewportHeight) {
849
- if (!Number.isFinite(triggerTop) || !Number.isFinite(viewportHeight)) return null
850
- return Math.max(Math.min(triggerTop - 56, viewportHeight - 96), 240)
1047
+ function panelPlacement(rect, viewportHeight, viewportWidth, topSafe = 56, panelHeight = 0) {
1048
+ if (![rect?.top, rect?.bottom, viewportHeight, topSafe].every(Number.isFinite)) return null
1049
+ const limit = viewportHeight - 8
1050
+ const spaceAbove = panelRoom(rect.top, viewportHeight, topSafe)
1051
+ const downTop = Math.max(topSafe, rect.bottom + 8)
1052
+ const spaceBelow = Math.max(0, limit - downTop)
1053
+ const side = spaceAbove >= 320 || spaceAbove >= spaceBelow ? 'up' : 'down'
1054
+ // The actual room also wins in tiny windows: a visual minimum would cross a safe edge.
1055
+ const maxHeight = side === 'up' ? spaceAbove : spaceBelow
1056
+ const height = panelHeight > 0 ? Math.min(panelHeight, maxHeight) : maxHeight
1057
+ const top = side === 'up' ? Math.max(topSafe, Math.min(rect.top - 8, limit) - height) : downTop
1058
+ const right = Number.isFinite(rect.right) ? rect.right : 348
1059
+ const maxLeft = Number.isFinite(viewportWidth) ? Math.max(8, viewportWidth - panelWidth - 8) : Infinity
1060
+ const left = Math.min(Math.max(8, right - 340), maxLeft)
1061
+ return { side, top, left, maxHeight }
1062
+ }
1063
+
1064
+ function panelStyleOf(placement) {
1065
+ if (placement === null) return panelStyle
1066
+ const { top, left, maxHeight } = placement
1067
+ return { ...panelStyle, top, left, maxHeight, visibility: maxHeight >= 2 ? 'visible' : 'hidden' }
1068
+ }
1069
+
1070
+ function frameTopSafe(rect, probe, viewportHeight) {
1071
+ const styleOf = typeof window.getComputedStyle === 'function' ? window.getComputedStyle.bind(window) : null
1072
+ const inset = styleOf && document.documentElement
1073
+ ? styleOf(document.documentElement).getPropertyValue('--dsh-frame-overlay-top').trim() : ''
1074
+ // The host also publishes this token as calc(...); the browser resolves it on the probe.
1075
+ const token = /^\d+(?:\.\d+)?px$/.test(inset) ? Number.parseFloat(inset) : probe?.getBoundingClientRect?.().height
1076
+ let topSafe = Math.max(56, token || 0)
1077
+ const headers = document.querySelectorAll?.('header, [role="banner"], [data-conversation-header], [data-app-titlebar]') ?? []
1078
+ for (const header of headers) {
1079
+ const box = header.getBoundingClientRect()
1080
+ if (box.width <= 0 || box.height <= 0 || box.bottom <= 0 || box.top > topSafe || box.bottom >= viewportHeight ||
1081
+ box.right <= rect.right - panelWidth || box.left >= rect.right + 232) continue
1082
+ const style = styleOf?.(header)
1083
+ if (style?.visibility === 'hidden' || style?.visibility === 'collapse' || style?.opacity === '0') continue
1084
+ topSafe = Math.max(topSafe, box.bottom)
1085
+ }
1086
+ return topSafe
1087
+ }
1088
+
1089
+ const useLayoutEffect = React.useLayoutEffect ?? React.useEffect
1090
+
1091
+ function usePanelPlacement(open, anchor, panel, probe) {
1092
+ const [placement, setPlacement] = React.useState(null)
1093
+ useLayoutEffect(() => {
1094
+ if (!open) {
1095
+ setPlacement(null)
1096
+ return undefined
1097
+ }
1098
+ const trigger = anchor.current
1099
+ if (!trigger?.getBoundingClientRect || typeof window === 'undefined') return undefined
1100
+ const measure = () => {
1101
+ const rect = trigger.getBoundingClientRect()
1102
+ const viewportHeight = window.innerHeight
1103
+ const topSafe = frameTopSafe(rect, probe.current, viewportHeight)
1104
+ const panelHeight = panel.current?.getBoundingClientRect?.().height
1105
+ const next = panelPlacement(rect, viewportHeight, window.innerWidth, topSafe, panelHeight)
1106
+ if (next === null) return
1107
+ setPlacement((current) => current !== null && Object.keys(next).every((key) => next[key] === current[key]) ? current : next)
1108
+ }
1109
+ measure()
1110
+ window.addEventListener?.('resize', measure)
1111
+ window.addEventListener?.('scroll', measure, true)
1112
+ const observer = typeof window.ResizeObserver === 'function' ? new window.ResizeObserver(measure) : null
1113
+ if (observer) {
1114
+ observer.observe(trigger)
1115
+ if (panel.current) observer.observe(panel.current)
1116
+ if (probe.current) observer.observe(probe.current)
1117
+ }
1118
+ return () => {
1119
+ window.removeEventListener?.('resize', measure)
1120
+ window.removeEventListener?.('scroll', measure, true)
1121
+ observer?.disconnect()
1122
+ }
1123
+ }, [open])
1124
+ return placement
851
1125
  }
852
1126
 
853
1127
  /** The style for a measured placement, or the static fallback when there is none. */
@@ -949,17 +1223,15 @@ window.__ModuleLoader__.load({
949
1223
  /**
950
1224
  * The subagent check interval. Edits stay local until blur or Enter; invalid input is
951
1225
  * rejected without writing and the shown value snaps back to the stored one. The panel's
952
- * scope subscription keeps the field in step with a value changed anywhere else.
1226
+ * effective config keeps the field in step with a value changed anywhere else.
953
1227
  */
954
- function SuperviseIntervalField({ scope, t }) {
955
- const snapshot = useScope(scope)
956
- const current = intervalOf(snapshot.value)
1228
+ function SuperviseIntervalField({ config, editable, saveField, t }) {
1229
+ const current = intervalOf(config)
957
1230
  const [draft, setDraft] = React.useState(String(current))
958
1231
  const [hint, setHint] = React.useState(null)
959
1232
  const [busy, setBusy] = React.useState(false)
960
1233
  const alive = React.useRef(true)
961
1234
  const shown = React.useRef(current)
962
- const editable = snapshot.status === 'ready' && snapshot.writable === true
963
1235
 
964
1236
  React.useEffect(() => {
965
1237
  alive.current = true
@@ -1004,16 +1276,12 @@ window.__ModuleLoader__.load({
1004
1276
  reject(t('supervise.readonly'))
1005
1277
  return
1006
1278
  }
1007
- const live = scope.getSnapshot()
1008
1279
  setBusy(true)
1009
1280
  try {
1010
- await scope.mutate([{ op: 'set', path: [INTERVAL.key], value: parsed.seconds }], live.revision)
1281
+ const failure = await saveField(INTERVAL.key, parsed.seconds)
1011
1282
  if (!alive.current) return
1012
- if (intervalOf(scope.getSnapshot().value) === parsed.seconds) setHint(null)
1013
- else reject(t('supervise.saveFailed'))
1014
- } catch {
1015
- // A remote failure may be a plain object; the panel only needs a short line.
1016
- if (alive.current) reject(t('supervise.saveFailed'))
1283
+ if (failure === null) setHint(null)
1284
+ else reject(failure)
1017
1285
  } finally {
1018
1286
  if (alive.current) setBusy(false)
1019
1287
  }
@@ -1065,16 +1333,14 @@ window.__ModuleLoader__.load({
1065
1333
  * and keeps the patrol running until the child stops, delivers, or ends. Edits stay
1066
1334
  * local until blur or Enter, and invalid input is rejected without writing.
1067
1335
  */
1068
- function SuperviseCountField({ scope, t }) {
1069
- const snapshot = useScope(scope)
1070
- const current = patrolCountOf(snapshot.value)
1071
- const unlimited = unlimitedOf(snapshot.value)
1336
+ function SuperviseCountField({ config, editable, saveField, t }) {
1337
+ const current = patrolCountOf(config)
1338
+ const unlimited = unlimitedOf(config)
1072
1339
  const [draft, setDraft] = React.useState(String(current))
1073
1340
  const [hint, setHint] = React.useState(null)
1074
1341
  const [busy, setBusy] = React.useState(false)
1075
1342
  const alive = React.useRef(true)
1076
1343
  const shown = React.useRef(current)
1077
- const editable = snapshot.status === 'ready' && snapshot.writable === true
1078
1344
 
1079
1345
  React.useEffect(() => {
1080
1346
  alive.current = true
@@ -1119,16 +1385,12 @@ window.__ModuleLoader__.load({
1119
1385
  reject(t('supervise.readonly'))
1120
1386
  return
1121
1387
  }
1122
- const live = scope.getSnapshot()
1123
1388
  setBusy(true)
1124
1389
  try {
1125
- await scope.mutate([{ op: 'set', path: [PATROL_COUNT.key], value: parsed.count }], live.revision)
1390
+ const failure = await saveField(PATROL_COUNT.key, parsed.count)
1126
1391
  if (!alive.current) return
1127
- if (patrolCountOf(scope.getSnapshot().value) === parsed.count) setHint(null)
1128
- else reject(t('supervise.saveFailed'))
1129
- } catch {
1130
- // A remote failure may be a plain object; the panel only needs a short line.
1131
- if (alive.current) reject(t('supervise.saveFailed'))
1392
+ if (failure === null) setHint(null)
1393
+ else reject(failure)
1132
1394
  } finally {
1133
1395
  if (alive.current) setBusy(false)
1134
1396
  }
@@ -1140,20 +1402,13 @@ window.__ModuleLoader__.load({
1140
1402
  setHint(t('supervise.readonly'))
1141
1403
  return
1142
1404
  }
1143
- const live = scope.getSnapshot()
1144
1405
  setBusy(true)
1145
1406
  try {
1146
- await scope.mutate([{ op: 'set', path: [PATROL_COUNT.unlimitedKey], value: on }], live.revision)
1407
+ const failure = await saveField(PATROL_COUNT.unlimitedKey, on)
1147
1408
  if (!alive.current) return
1148
- if (unlimitedOf(scope.getSnapshot().value) === on) {
1149
- setHint(null)
1150
- // Turning unlimited on discards an uncommitted draft: the field is locked now.
1151
- if (on) setDraft(String(current))
1152
- } else {
1153
- setHint(t('supervise.saveFailed'))
1154
- }
1155
- } catch {
1156
- if (alive.current) setHint(t('supervise.saveFailed'))
1409
+ setHint(failure)
1410
+ // Turning unlimited on discards an uncommitted draft: the field is locked now.
1411
+ if (failure === null && on) setDraft(String(current))
1157
1412
  } finally {
1158
1413
  if (alive.current) setBusy(false)
1159
1414
  }
@@ -1274,61 +1529,70 @@ window.__ModuleLoader__.load({
1274
1529
  }
1275
1530
 
1276
1531
  function worktreeIsolationOf(config) {
1277
- return config?.worktreeIsolationEnabled ?? true
1532
+ return config?.worktreeIsolationEnabled !== false
1278
1533
  }
1279
1534
 
1280
- /** Toggle the default for future write dispatches without pinning any tool preferences. */
1281
- function WorktreeIsolationField({ scope, t }) {
1282
- const snapshot = useScope(scope)
1283
- const checked = worktreeIsolationOf(snapshot.value)
1284
- const editable = snapshot.status === 'ready' && snapshot.writable === true
1285
- const [busy, setBusy] = React.useState(false)
1286
- const [problem, setProblem] = React.useState(null)
1287
- const alive = React.useRef(true)
1288
- React.useEffect(() => {
1289
- alive.current = true
1290
- return () => {
1291
- alive.current = false
1292
- }
1293
- }, [])
1294
-
1295
- const toggle = async (on) => {
1296
- if (busy) return
1297
- const live = scope.getSnapshot()
1298
- if (live.status !== 'ready' || live.writable !== true) {
1299
- setProblem(t('route.readonly'))
1300
- return
1301
- }
1302
- setBusy(true)
1303
- setProblem(null)
1304
- try {
1305
- await scope.mutate([{ op: 'set', path: ['worktreeIsolationEnabled'], value: on }], live.revision)
1306
- if (alive.current && worktreeIsolationOf(scope.getSnapshot().value) !== on) {
1307
- setProblem(t('route.enableFailed'))
1308
- }
1309
- } catch {
1310
- if (alive.current) setProblem(t('route.enableFailed'))
1311
- } finally {
1312
- if (alive.current) setBusy(false)
1313
- }
1314
- }
1535
+ const hintStyle = { color: 'var(--dsw-alias-label-tertiary, inherit)', lineHeight: 1.3 }
1536
+ const alertStyle = { color: 'var(--dsw-alias-label-error, #ff7b72)' }
1537
+ const moreFields = [
1538
+ ['worktreeIsolationEnabled', 'worktreeIsolation'],
1539
+ ['readOnlyEnabled', 'readOnly'],
1540
+ ['peerReadOnlyConsultEnabled', 'peerReadOnlyConsult'],
1541
+ ]
1315
1542
 
1543
+ function SettingSwitch({ checked, disabled, onChange, label, hint, field }) {
1316
1544
  return h(
1317
1545
  'div',
1318
- { style: { display: 'grid', gap: '4px' } },
1546
+ { 'data-setting': field, style: { display: 'flex', alignItems: 'center', gap: '10px' } },
1319
1547
  h(
1320
1548
  'div',
1321
- { style: { display: 'flex', alignItems: 'center', gap: '10px' } },
1549
+ { style: { display: 'grid', gap: '2px', flex: '1 1 auto', minWidth: 0 } },
1550
+ h('span', { style: { fontWeight: 600 } }, label),
1551
+ h('span', { style: hintStyle }, hint),
1552
+ ),
1553
+ h(EnableSwitch, { checked, disabled, onChange, label }),
1554
+ )
1555
+ }
1556
+
1557
+ function MoreSettingsPanel({ overlayRef, dialogRef, onClose, config, editable, saveField, problem, t }) {
1558
+ const closeButton = React.useRef(null)
1559
+ React.useEffect(() => { closeButton.current?.focus?.({ preventScroll: true }) }, [])
1560
+ return portalToBody(h(
1561
+ 'div',
1562
+ {
1563
+ ref: overlayRef,
1564
+ 'data-overlay': 'more-settings',
1565
+ style: moreOverlayStyle,
1566
+ onClick: (event) => { if (event.target === event.currentTarget) onClose() },
1567
+ },
1568
+ h(
1569
+ 'div',
1570
+ {
1571
+ ref: dialogRef,
1572
+ role: 'dialog',
1573
+ 'aria-modal': true,
1574
+ 'aria-label': t('more.title'),
1575
+ 'data-panel': 'more-settings',
1576
+ style: morePanelStyle,
1577
+ },
1322
1578
  h(
1323
1579
  'div',
1324
- { style: { display: 'grid', gap: '2px', flex: '1 1 auto', minWidth: 0 } },
1325
- h('span', { style: { fontWeight: 600 } }, t('worktreeIsolation.label')),
1326
- h('span', { style: { color: 'var(--dsw-alias-label-tertiary, inherit)', lineHeight: 1.3 } }, t('worktreeIsolation.hint')),
1580
+ { style: headingRowStyle },
1581
+ h('strong', null, t('more.title')),
1582
+ h('button', { ref: closeButton, type: 'button', style: baseStyle, onClick: onClose }, t('more.close')),
1327
1583
  ),
1328
- h(EnableSwitch, { checked, disabled: busy || !editable, onChange: toggle, label: t('worktreeIsolation.label') }),
1584
+ moreFields.map(([field, prefix]) => h(SettingSwitch, {
1585
+ key: field,
1586
+ field,
1587
+ checked: config[field],
1588
+ disabled: !editable,
1589
+ onChange: (checked) => saveField(field, checked),
1590
+ label: t(`${prefix}.label`),
1591
+ hint: t(`${prefix}.hint`),
1592
+ })),
1593
+ problem ? h('div', { role: 'alert', style: alertStyle }, problem) : null,
1329
1594
  ),
1330
- problem === null ? null : h('div', { role: 'alert', style: { color: 'var(--dsw-alias-label-error, #ff7b72)' } }, problem),
1331
- )
1595
+ ))
1332
1596
  }
1333
1597
 
1334
1598
  /**
@@ -1338,98 +1602,27 @@ window.__ModuleLoader__.load({
1338
1602
  * Every change writes the single allow key from the checkbox state, so the stored
1339
1603
  * config always describes exactly what the panel shows.
1340
1604
  */
1341
- function AllowedToolsPanel({ scope, t, sessionId, sessionRemote }) {
1342
- const snapshot = useScope(scope)
1605
+ function AllowedToolsPanel({
1606
+ t, config, pluginValue, catalog, editable, session, canChangeSession, onSessionChange,
1607
+ moreTrigger, moreOpen, onMore, saveTools, resetTools,
1608
+ }) {
1343
1609
  const [query, setQuery] = React.useState('')
1344
- const [view, setView] = React.useState(null)
1345
- const active = React.useRef(null)
1346
- // Global-only consumers omit both props; the conversation slot always supplies Remote.
1347
- const scoped = sessionRemote !== undefined || sessionId !== undefined
1348
- const validId = typeof sessionId === 'string' && sessionId.trim() !== ''
1349
- const display = view?.sessionId === sessionId && view?.remote === sessionRemote ? view : null
1350
- const state = display?.state
1351
- const sessionEnabled = state?.enabled === true
1352
- const saving = display?.saving === true
1353
- const problem = display?.problem ?? null
1354
- React.useEffect(() => {
1355
- const request = { sessionId, remote: sessionRemote, saving: false }
1356
- active.current = request
1357
- const render = () => { if (active.current === request) setView({ ...request }) }
1358
- render()
1359
- if (scoped && validId && sessionRemote) {
1360
- Promise.resolve().then(() => sessionRemote.call('get', sessionId)).then((state) => {
1361
- request.state = state
1362
- request.problem = null
1363
- render()
1364
- }, (error) => {
1365
- request.problem = error?.message || t('allowed.sessionFailed')
1366
- render()
1367
- })
1368
- }
1369
- return () => { if (active.current === request) active.current = null }
1370
- }, [sessionId, sessionRemote])
1371
-
1372
1610
  // Shipped order first, then the catalog/config extras alphabetically, so a row
1373
- // keeps its place when the live catalog changes. The remembered copy survives the
1374
- // instant a settings write resets the published field (see catalogFor).
1375
- const remembered = React.useRef([])
1376
- const live = catalogFor(snapshot.value, remembered.current)
1377
- if (live.length > 0) remembered.current = live
1378
- const value = sessionEnabled ? { ...snapshot.value, [ALLOW_KEY]: state.allowedTools } : snapshot.value
1379
- const names = toolListOf(value, live)
1380
- const allowed = allowedSetOf(value, live)
1381
- const teamEnabled = snapshot.value?.[ALLOW_AGENT_TEAM_KEY] !== false
1611
+ // keeps its place when the live catalog changes.
1612
+ const value = { ...pluginValue, [ALLOW_KEY]: config.allowedTools }
1613
+ const names = toolListOf(value, catalog)
1614
+ const allowed = allowedSetOf(value, catalog)
1615
+ const teamEnabled = pluginValue?.[ALLOW_AGENT_TEAM_KEY] !== false
1382
1616
  const visible = filterTools(names, query)
1383
- const sessionReady = state?.storageReady === true
1384
- const editable = (!scoped || sessionReady) && (sessionEnabled ||
1385
- (snapshot.status === 'ready' && snapshot.writable === true))
1386
- const sessionProblem = !scoped ? null
1387
- : !validId ? t('allowed.sessionMissing')
1388
- : !sessionRemote ? t('allowed.sessionFailed')
1389
- : state?.storageReady === false ? t('allowed.sessionStorage') : null
1390
-
1391
- const write = async (operation) => {
1392
- const request = active.current
1393
- if (!request || request.sessionId !== sessionId || request.remote !== sessionRemote || request.saving) return
1394
- if (scoped && request.state?.storageReady !== true) return
1395
- request.saving = true
1396
- request.problem = null
1397
- const render = () => { if (active.current === request) setView({ ...request }) }
1398
- render()
1399
- try {
1400
- const current = scope.getSnapshot()
1401
- const currentCatalog = catalogFor(current.value, remembered.current)
1402
- const global = () => [...allowedSetOf(current.value, currentCatalog)]
1403
- if (operation === 'enable' || operation === 'disable' || request.state?.enabled) {
1404
- const revision = request.state.revision
1405
- if (operation === 'disable') request.state = await sessionRemote.call('clear', sessionId, revision)
1406
- else {
1407
- const next = Array.isArray(operation) ? operation : global()
1408
- request.state = await sessionRemote.call('set', sessionId, next, revision)
1409
- }
1410
- } else {
1411
- if (current.status !== 'ready' || current.writable !== true) throw new Error(t('route.readonly'))
1412
- const ops = operation === 'reset' ? resetAllowOps() : allowOps(operation, current.value, currentCatalog)
1413
- if (await scope.mutate(ops, current.revision) === false) throw new Error(t('route.saveFailed'))
1414
- }
1415
- } catch (error) {
1416
- request.problem = error?.message || t('route.saveFailed')
1417
- if (error?.code === 'REVISION_CONFLICT' && active.current === request) {
1418
- try { request.state = await sessionRemote.call('get', sessionId) } catch { request.state = undefined }
1419
- }
1420
- } finally {
1421
- request.saving = false
1422
- render()
1423
- }
1424
- }
1617
+ const sessionEnabled = session.state?.enabled === true
1425
1618
 
1426
1619
  const toggle = (name, on) => {
1427
1620
  // Preserve latent Team settings when ordinary checkboxes are edited; the
1428
1621
  // hard Team switch still filters what is shown and what the backend permits.
1429
- const next = new Set(sessionEnabled ? state.allowedTools : allowed)
1622
+ const next = new Set(sessionEnabled ? config.allowedTools : allowed)
1430
1623
  if (on) next.add(name)
1431
1624
  else next.delete(name)
1432
- return write([...next])
1625
+ return saveTools([...next])
1433
1626
  }
1434
1627
 
1435
1628
  return h(
@@ -1437,36 +1630,42 @@ window.__ModuleLoader__.load({
1437
1630
  { style: allowedColumnStyle, 'data-panel': 'allowed-tools' },
1438
1631
  h(
1439
1632
  'div',
1440
- { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: '6px' } },
1441
- h('span', { style: { fontWeight: 600 }, title: t('allowed.hint') }, t('allowed.title')),
1442
- h(
1443
- 'button',
1444
- {
1445
- type: 'button',
1446
- style: resetLinkStyle(editable && !saving),
1447
- disabled: saving || !editable,
1448
- onClick: () => write('reset'),
1449
- },
1450
- t('allowed.reset'),
1451
- ),
1452
- ),
1453
- h(
1454
- 'div',
1455
- { 'data-scope': 'session-tools', style: { display: 'grid', gap: '3px', padding: '4px 8px' } },
1633
+ { 'data-scope': 'session-tools', style: { display: 'grid', gap: '4px' } },
1456
1634
  h(
1457
1635
  'div',
1458
- { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: '10px' } },
1459
- h('span', { style: { fontWeight: 600, whiteSpace: 'nowrap' } }, t('allowed.session')),
1636
+ { style: { ...headingRowStyle, flexWrap: 'wrap' } },
1637
+ h('span', { style: { fontWeight: 600 } }, t('allowed.session')),
1460
1638
  h(EnableSwitch, {
1461
1639
  checked: sessionEnabled,
1462
- disabled: !sessionReady || saving,
1640
+ disabled: !canChangeSession,
1463
1641
  label: t('allowed.session'),
1464
- onChange: (next) => write(next ? 'enable' : 'disable'),
1642
+ onChange: onSessionChange,
1465
1643
  }),
1644
+ h('button', {
1645
+ ref: moreTrigger,
1646
+ type: 'button',
1647
+ 'data-action': 'more-settings',
1648
+ 'aria-haspopup': 'dialog',
1649
+ 'aria-expanded': moreOpen,
1650
+ style: { ...baseStyle, marginInlineStart: 'auto', height: '24px' },
1651
+ onClick: onMore,
1652
+ }, t('more.button')),
1466
1653
  ),
1467
- h('span', { style: { color: 'var(--dsw-alias-label-tertiary, inherit)', lineHeight: 1.3 } },
1468
- !state && !problem && scoped && !sessionProblem ? t('allowed.sessionLoading')
1469
- : t(sessionEnabled ? 'allowed.sessionOn' : 'allowed.sessionOff')),
1654
+ h('span', { style: hintStyle }, session.loading ? t('allowed.sessionLoading')
1655
+ : t(sessionEnabled ? 'allowed.sessionOn' : 'allowed.sessionOff')),
1656
+ session.problem ? h('div', { role: 'alert', style: alertStyle }, session.problem) : null,
1657
+ ),
1658
+ h('div', { role: 'separator', style: sessionSeparatorStyle }),
1659
+ h(
1660
+ 'div',
1661
+ { style: headingRowStyle },
1662
+ h('span', { style: { fontWeight: 600 }, title: t('allowed.hint') }, t('allowed.title')),
1663
+ h('button', {
1664
+ type: 'button',
1665
+ style: resetLinkStyle(editable),
1666
+ disabled: !editable,
1667
+ onClick: resetTools,
1668
+ }, t('allowed.reset')),
1470
1669
  ),
1471
1670
  h(
1472
1671
  'div',
@@ -1493,7 +1692,7 @@ window.__ModuleLoader__.load({
1493
1692
  )
1494
1693
  : visible.map((name) => {
1495
1694
  const teamDisabled = !teamEnabled && NATIVE_TEAM_TOOLS.includes(name)
1496
- const disabled = saving || !editable || teamDisabled
1695
+ const disabled = !editable || teamDisabled
1497
1696
  const hint = teamDisabled
1498
1697
  ? t('allowed.teamDisabled')
1499
1698
  : DEFAULT_BLOCKED_NATIVE_TOOLS.includes(name) ? t('allowed.nativeBlocked') : undefined
@@ -1513,14 +1712,15 @@ window.__ModuleLoader__.load({
1513
1712
  }),
1514
1713
  ),
1515
1714
  ),
1516
- problem === null && sessionProblem === null ? null : h('div', {
1517
- role: 'alert', style: { color: 'var(--dsw-alias-label-error, #ff7b72)' },
1518
- }, problem ?? sessionProblem),
1519
1715
  )
1520
1716
  }
1521
1717
 
1718
+ function contains(ref, target) {
1719
+ return Boolean(ref.current?.contains?.(target))
1720
+ }
1721
+
1522
1722
  /** One row: the current model, and the searchable list that opens in place. */
1523
- function RouteRow({ label, route, groups, disabled, onChange, t }) {
1723
+ function RouteRow({ label, route, groups, disabled, onChange, listRef, t }) {
1524
1724
  const [open, setOpen] = React.useState(false)
1525
1725
  const [active, setActive] = React.useState(0)
1526
1726
  const [query, setQuery] = React.useState('')
@@ -1528,7 +1728,8 @@ window.__ModuleLoader__.load({
1528
1728
  const box = React.useRef(null)
1529
1729
  // Portalled to the body, the list is no longer a DOM descendant of `box`, so it needs a
1530
1730
  // ref of its own for the outside-click test and for scrolling itself.
1531
- const listBox = React.useRef(null)
1731
+ const localListBox = React.useRef(null)
1732
+ const listBox = listRef ?? localListBox
1532
1733
  const searchInput = React.useRef(null)
1533
1734
  const options = React.useRef(new Map())
1534
1735
  const model = findModel(groups, route)
@@ -1571,11 +1772,7 @@ window.__ModuleLoader__.load({
1571
1772
  React.useEffect(() => {
1572
1773
  if (!open) return undefined
1573
1774
  const outside = (event) => {
1574
- if (typeof box.current?.contains === 'function' && box.current.contains(event.target)) return
1575
- // The list is portalled to the body, so a click inside it is outside `box` in the
1576
- // DOM tree. Without this check the `pointerdown` capture would close the list
1577
- // before the option's own `click` ever fired.
1578
- if (typeof listBox.current?.contains === 'function' && listBox.current.contains(event.target)) return
1775
+ if (contains(box, event.target) || contains(listBox, event.target)) return
1579
1776
  dismiss()
1580
1777
  }
1581
1778
  document.addEventListener('pointerdown', outside, true)
@@ -1590,10 +1787,9 @@ window.__ModuleLoader__.load({
1590
1787
  return undefined
1591
1788
  }
1592
1789
  const node = box.current
1593
- const viewport = typeof window === 'undefined' ? undefined : window.innerHeight
1594
- if (node === null || node === undefined || typeof node.getBoundingClientRect !== 'function') return undefined
1790
+ if (!node?.getBoundingClientRect || typeof window === 'undefined') return undefined
1595
1791
  const measure = () => {
1596
- const next = popupPlacement(node.getBoundingClientRect(), viewport)
1792
+ const next = popupPlacement(node.getBoundingClientRect(), window.innerHeight)
1597
1793
  if (next !== null) setPlacement(next)
1598
1794
  }
1599
1795
  measure()
@@ -1681,6 +1877,12 @@ window.__ModuleLoader__.load({
1681
1877
  role: 'listbox',
1682
1878
  'aria-label': label + ' · ' + t('route.search'),
1683
1879
  'data-side': placement?.side,
1880
+ onKeyDown: (event) => {
1881
+ if (event.key !== 'Escape') return
1882
+ event.preventDefault()
1883
+ event.stopPropagation()
1884
+ dismiss()
1885
+ },
1684
1886
  },
1685
1887
  h(
1686
1888
  'div',
@@ -1694,10 +1896,7 @@ window.__ModuleLoader__.load({
1694
1896
  style: searchStyle,
1695
1897
  onChange: (event) => setQuery(event.target.value),
1696
1898
  onKeyDown: (event) => {
1697
- if (event.key === 'Escape') {
1698
- event.stopPropagation()
1699
- dismiss()
1700
- } else if (event.key === 'ArrowDown') {
1899
+ if (event.key === 'ArrowDown') {
1701
1900
  event.preventDefault()
1702
1901
  move(1)
1703
1902
  } else if (event.key === 'ArrowUp') {
@@ -1724,13 +1923,7 @@ window.__ModuleLoader__.load({
1724
1923
  : items.map(renderItem),
1725
1924
  )
1726
1925
  : null
1727
- const canPortal =
1728
- listboxNode !== null &&
1729
- typeof ReactDOM?.createPortal === 'function' &&
1730
- typeof document !== 'undefined' &&
1731
- document.body !== undefined &&
1732
- document.body !== null
1733
- const listbox = canPortal ? ReactDOM.createPortal(listboxNode, document.body) : listboxNode
1926
+ const listbox = portalToBody(listboxNode)
1734
1927
  return h(
1735
1928
  'div',
1736
1929
  { style: { display: 'grid', gap: '4px' } },
@@ -1785,47 +1978,63 @@ window.__ModuleLoader__.load({
1785
1978
  /** Button plus panel: pick the default model and effort for the main agent and for workers. */
1786
1979
  function RoutePicker({ t, scopes, orch, loadCatalog, modelDirectories, sessionId, sessionRemote }) {
1787
1980
  const [open, setOpen] = React.useState(false)
1788
- const [room, setRoom] = React.useState(null)
1981
+ const [moreOpen, setMoreOpen] = React.useState(false)
1789
1982
  const anchor = React.useRef(null)
1790
- const [fallback, setFallback] = React.useState({ groups: undefined, loading: false })
1791
- const [problem, setProblem] = React.useState(null)
1792
- const [saving, setSaving] = React.useState(false)
1793
- const request = React.useRef(0)
1983
+ const panel = React.useRef(null)
1984
+ const probe = React.useRef(null)
1985
+ const mainList = React.useRef(null)
1986
+ const workerList = React.useRef(null)
1987
+ const moreTrigger = React.useRef(null)
1988
+ const moreOverlay = React.useRef(null)
1989
+ const moreDialog = React.useRef(null)
1990
+ const placement = usePanelPlacement(open, anchor, panel, probe)
1991
+ const [fallbackGroups, setFallbackGroups] = React.useState(undefined)
1992
+ const [catalogError, setCatalogError] = React.useState(null)
1993
+ const [saveError, setSaveError] = React.useState(null)
1994
+ const [globalSaving, setGlobalSaving] = React.useState(false)
1995
+ const globalBusy = React.useRef(false)
1794
1996
  const loader = React.useRef(loadCatalog)
1795
1997
  loader.current = loadCatalog
1796
1998
  const main = useScope(scopes.main)
1797
1999
  const worker = useScope(scopes.worker)
1798
2000
  const plugin = useScope(orch)
2001
+ const session = useSessionConfig(sessionId, sessionRemote, open, t)
2002
+ const sessionEnabled = session.state?.enabled === true
2003
+ const rememberedCatalog = React.useRef([])
2004
+ const catalog = catalogFor(plugin.value, rememberedCatalog.current)
2005
+ if (catalog.length > 0) rememberedCatalog.current = catalog
2006
+ const globalConfig = createGlobalSnapshot(plugin.value, main.value, worker.value, catalog)
2007
+ const config = sessionEnabled ? session.state.config : globalConfig
2008
+ const editing = !session.loading && !session.saving && !globalSaving
2009
+ const editable = (snapshot) => editing && (sessionEnabled ? session.state.storageReady : writable(snapshot))
2010
+ const pluginEditable = editable(plugin)
2011
+ const globalConfigReady = [main, worker, plugin].every((snapshot) => snapshot.status === 'ready')
2012
+ const canChangeSession = editing && session.state?.storageReady === true && (sessionEnabled || globalConfigReady)
2013
+ const fieldScope = sessionEnabled ? `session:${sessionId}` : 'global'
1799
2014
  const directory = resolveModelDirectory(modelDirectories, sessionId)
1800
2015
  const directoryState = useModelDirectory(directory)
1801
2016
  const usingDirectory = directory !== undefined
1802
- const groups = usingDirectory ? directoryState.groups : fallback.groups
1803
- const catalogProblem = usingDirectory ? directoryState.error : problem
2017
+ const groups = usingDirectory ? directoryState.groups : fallbackGroups
2018
+ const catalogProblem = usingDirectory ? directoryState.error : catalogError
1804
2019
 
1805
2020
  React.useEffect(() => {
1806
2021
  if (usingDirectory || !open) return undefined
1807
- const current = request.current + 1
1808
- request.current = current
1809
2022
  let live = true
1810
- setProblem(null)
1811
- setFallback((previous) => ({ ...previous, loading: true }))
2023
+ setCatalogError(null)
1812
2024
  Promise.resolve().then(() => {
1813
2025
  if (typeof loader.current !== 'function') throw new Error('model catalog loader unavailable')
1814
2026
  return loader.current()
1815
2027
  }).then(
1816
2028
  (response) => {
1817
- if (!live || request.current !== current) return
2029
+ if (!live) return
1818
2030
  if (response?.ok === true && Array.isArray(response.value?.groups)) {
1819
- setFallback({ groups: response.value.groups, loading: false })
2031
+ setFallbackGroups(response.value.groups)
1820
2032
  return
1821
2033
  }
1822
- setFallback((previous) => ({ ...previous, loading: false }))
1823
- setProblem(t('route.catalogFailed'))
2034
+ setCatalogError(t('route.catalogFailed'))
1824
2035
  },
1825
2036
  () => {
1826
- if (!live || request.current !== current) return
1827
- setFallback((previous) => ({ ...previous, loading: false }))
1828
- setProblem(t('route.catalogFailed'))
2037
+ if (live) setCatalogError(t('route.catalogFailed'))
1829
2038
  },
1830
2039
  )
1831
2040
  return () => {
@@ -1833,132 +2042,194 @@ window.__ModuleLoader__.load({
1833
2042
  }
1834
2043
  }, [open, usingDirectory])
1835
2044
 
1836
- const write = async (which, route) => {
1837
- setSaving(true)
1838
- setProblem(null)
1839
- const failure = await saveRoute(which === 'main' ? scopes.main : scopes.worker, which === 'main' ? MAIN.fields : WORKER.fields, route, t)
1840
- setSaving(false)
1841
- setProblem(failure)
1842
- }
1843
-
1844
- const toggleEnabled = async (on) => {
1845
- const snapshot = orch.getSnapshot()
1846
- if (snapshot.status !== 'ready' || !snapshot.writable) {
1847
- setProblem(t('route.readonly'))
1848
- return
1849
- }
1850
- setSaving(true)
1851
- setProblem(null)
2045
+ const runGlobal = async (operation, fallbackMessage) => {
2046
+ if (!editing || globalBusy.current) return t('route.readonly')
2047
+ globalBusy.current = true
2048
+ setGlobalSaving(true)
2049
+ setSaveError(null)
1852
2050
  try {
1853
- await orch.mutate([{ op: 'set', path: ['enabled'], value: on }], snapshot.revision)
1854
- } catch (reason) {
1855
- setProblem(typeof reason?.message === 'string' && reason.message !== '' ? reason.message : t('route.enableFailed'))
2051
+ const failure = await operation()
2052
+ setSaveError(failure)
2053
+ return failure
2054
+ } catch (error) {
2055
+ const failure = error?.message || fallbackMessage
2056
+ setSaveError(failure)
2057
+ return failure
2058
+ } finally {
2059
+ globalBusy.current = false
2060
+ setGlobalSaving(false)
1856
2061
  }
1857
- setSaving(false)
1858
2062
  }
1859
2063
 
1860
- // The panel is anchored above the trigger and opens upward, so its real ceiling is the
1861
- // space between the trigger and the top of the window (`panelStyle.maxHeight` alone only
1862
- // knows the viewport, which is how a low composer used to push the panel off screen).
1863
- React.useEffect(() => {
1864
- if (!open) {
1865
- setRoom(null)
1866
- return undefined
1867
- }
1868
- const node = anchor.current
1869
- if (node === null || node === undefined || typeof node.getBoundingClientRect !== 'function') return undefined
1870
- const measure = () => {
1871
- const rect = node.getBoundingClientRect()
1872
- const viewport = typeof window === 'undefined' ? undefined : window.innerHeight
1873
- const next = panelRoom(rect?.top, viewport)
1874
- if (next !== null) setRoom(next)
2064
+ const mutatePlugin = (operations, confirm = () => true, failure = t('route.saveFailed')) => runGlobal(async () => {
2065
+ const current = orch.getSnapshot()
2066
+ if (!writable(current)) return t('route.readonly')
2067
+ const result = await orch.mutate(operations(current.value), current.revision)
2068
+ return result !== false && confirm(orch.getSnapshot().value) ? null : failure
2069
+ }, failure)
2070
+
2071
+ const saveField = (key, value) => {
2072
+ if (!pluginEditable || globalBusy.current) return t('route.readonly')
2073
+ if (sessionEnabled) return session.write('setConfig', { [key]: value })
2074
+ return mutatePlugin(() => [{ op: 'set', path: [key], value }], (current) => current?.[key] === value)
2075
+ }
2076
+
2077
+ const readGlobalConfig = () => {
2078
+ const value = orch.getSnapshot().value
2079
+ return createGlobalSnapshot(value, scopes.main.getSnapshot().value, scopes.worker.getSnapshot().value,
2080
+ catalogFor(value, rememberedCatalog.current))
2081
+ }
2082
+ const changeSession = (on) => {
2083
+ if (!canChangeSession || globalBusy.current || on === sessionEnabled) return
2084
+ setSaveError(null)
2085
+ // Clearing resumes the current global route as well as the other global settings.
2086
+ return on ? session.write('setConfig', readGlobalConfig()) : session.write('clear')
2087
+ }
2088
+ const resetTools = () => pluginEditable && (sessionEnabled
2089
+ ? session.write('setConfig', { allowedTools: readGlobalConfig().allowedTools })
2090
+ : mutatePlugin(resetAllowOps))
2091
+ const saveTools = (tools) => pluginEditable && (sessionEnabled
2092
+ ? session.write('setConfig', { allowedTools: tools })
2093
+ : mutatePlugin((value) => allowOps(tools, value, catalogFor(value, rememberedCatalog.current))))
2094
+
2095
+ const write = (which, route) => {
2096
+ if (!editing || globalBusy.current) return
2097
+ if (sessionEnabled) {
2098
+ const key = which === 'main' ? 'mainRoute' : 'workerRoute'
2099
+ return session.write('setConfig', { [key]: toSessionRoute(route) })
1875
2100
  }
1876
- measure()
1877
- if (typeof window === 'undefined' || typeof window.addEventListener !== 'function') return undefined
1878
- window.addEventListener('resize', measure)
1879
- return () => window.removeEventListener('resize', measure)
1880
- }, [open])
2101
+ const fields = which === 'main' ? MAIN.fields : WORKER.fields
2102
+ return runGlobal(() => saveRoute(scopes[which], fields, route, t), t('route.saveFailed'))
2103
+ }
1881
2104
 
1882
- const writable = main.writable === true && worker.writable === true
1883
2105
  const close = () => {
2106
+ setMoreOpen(false)
1884
2107
  setOpen(false)
1885
2108
  }
2109
+ const closeMore = () => {
2110
+ setMoreOpen(false)
2111
+ moreTrigger.current?.focus?.({ preventScroll: true })
2112
+ }
2113
+ React.useEffect(() => {
2114
+ if (!open || typeof document === 'undefined') return undefined
2115
+ const outside = (event) => {
2116
+ const target = event.target
2117
+ if ([anchor, panel, mainList, workerList, moreTrigger, moreDialog, moreOverlay].some((ref) => contains(ref, target))) return
2118
+ if (moreOpen) closeMore()
2119
+ else close()
2120
+ }
2121
+ const escape = (event) => {
2122
+ if (event.key !== 'Escape') return
2123
+ if (!moreOpen && (mainList.current || workerList.current || event.target?.type === 'text')) return
2124
+ event.preventDefault()
2125
+ event.stopPropagation()
2126
+ if (moreOpen) closeMore()
2127
+ else {
2128
+ close()
2129
+ anchor.current?.focus?.({ preventScroll: true })
2130
+ }
2131
+ }
2132
+ document.addEventListener('pointerdown', outside, true)
2133
+ document.addEventListener('keydown', escape, true)
2134
+ return () => {
2135
+ document.removeEventListener('pointerdown', outside, true)
2136
+ document.removeEventListener('keydown', escape, true)
2137
+ }
2138
+ }, [open, moreOpen])
2139
+
1886
2140
  const showLoading = catalogProblem === null && (
1887
2141
  groups === undefined || (usingDirectory && directoryState.loading && groups.length === 0)
1888
2142
  )
2143
+ const modelRows = ['main', 'worker'].map((which) => h(RouteRow, {
2144
+ key: `${which}:${fieldScope}`,
2145
+ label: t(`route.${which}`),
2146
+ route: fromSessionRoute(config[`${which}Route`]),
2147
+ groups: groups ?? [],
2148
+ disabled: !editable(which === 'main' ? main : worker) || groups === undefined || showLoading,
2149
+ listRef: which === 'main' ? mainList : workerList,
2150
+ onChange: (route) => write(which, route),
2151
+ t,
2152
+ }))
1889
2153
  return h(
1890
2154
  'span',
1891
- { ref: anchor, style: { position: 'relative', display: 'inline-flex' } },
2155
+ { style: { display: 'inline-flex' } },
1892
2156
  h(
1893
2157
  'button',
1894
2158
  {
2159
+ ref: anchor,
1895
2160
  type: 'button',
1896
2161
  style: Object.assign({}, baseStyle, open ? onStyle : null),
1897
2162
  onClick: () => (open ? close() : setOpen(true)),
1898
2163
  title: t('route.title'),
1899
2164
  'aria-label': t('route.title'),
2165
+ 'aria-haspopup': 'dialog',
1900
2166
  'aria-expanded': open,
1901
2167
  },
1902
2168
  h('span', null, t('route.button')),
1903
2169
  ),
2170
+ open ? h('span', { ref: probe, style: topInsetProbeStyle, 'aria-hidden': true }) : null,
1904
2171
  open
1905
- ? h(
2172
+ ? portalToBody(h(
1906
2173
  'div',
1907
- { style: panelStyleOf(room), role: 'dialog', 'aria-label': t('route.title') },
2174
+ {
2175
+ ref: panel,
2176
+ style: panelStyleOf(placement),
2177
+ role: 'dialog',
2178
+ 'aria-label': t('route.title'),
2179
+ 'data-panel': 'orchestrator-settings',
2180
+ 'data-side': placement?.side,
2181
+ },
1908
2182
  h(
1909
2183
  'div',
1910
2184
  { style: panelColumnStyle },
1911
- h(
1912
- 'div',
1913
- { style: { display: 'flex', alignItems: 'center', gap: '10px', padding: '0 0 6px' } },
1914
- h(
1915
- 'div',
1916
- { style: { display: 'grid', gap: '2px', flex: '1 1 auto', minWidth: 0 } },
1917
- h('span', { style: { fontWeight: 600 } }, t('route.enable')),
1918
- h('span', { style: { color: 'var(--dsw-alias-label-tertiary, inherit)', lineHeight: 1.3 } }, t('route.enableNote')),
1919
- ),
1920
- h(EnableSwitch, {
1921
- checked: plugin.value?.enabled === true,
1922
- disabled: saving || plugin.writable !== true,
1923
- onChange: toggleEnabled,
1924
- label: t('route.enable'),
1925
- }),
1926
- ),
1927
- h(WorktreeIsolationField, { scope: scopes.orch, t }),
1928
- showLoading
1929
- ? h('div', null, t('route.loading'))
1930
- : groups === undefined
1931
- ? null
1932
- : [
1933
- h(RouteRow, {
1934
- key: 'main',
1935
- label: t('route.main'),
1936
- route: routeOf(MAIN.fields, main.value),
1937
- groups,
1938
- disabled: saving || !writable,
1939
- onChange: (route) => write('main', route),
1940
- t,
1941
- }),
1942
- h(RouteRow, {
1943
- key: 'worker',
1944
- label: t('route.worker'),
1945
- route: routeOf(WORKER.fields, worker.value),
1946
- groups,
1947
- disabled: saving || !writable,
1948
- onChange: (route) => write('worker', route),
1949
- t,
1950
- }),
1951
- ],
1952
- h(SuperviseIntervalField, { scope: scopes.orch, t }),
1953
- h(SuperviseCountField, { scope: scopes.orch, t }),
1954
- catalogProblem === null ? null : h('div', { style: { color: 'var(--dsw-alias-label-error, #ff7b72)' }, role: 'alert' }, catalogProblem),
1955
- !writable && groups !== undefined
1956
- ? h('div', { style: { color: 'var(--dsw-alias-label-tertiary, inherit)' } }, t('route.readonly'))
2185
+ h(SettingSwitch, {
2186
+ field: 'enabled',
2187
+ checked: config.enabled,
2188
+ disabled: !pluginEditable,
2189
+ onChange: (checked) => saveField('enabled', checked),
2190
+ label: t('route.enable'),
2191
+ hint: t('route.enableNote'),
2192
+ }),
2193
+ modelRows,
2194
+ showLoading ? h('div', null, t('route.loading')) : null,
2195
+ h(SuperviseIntervalField, { key: `interval:${fieldScope}`, config, editable: pluginEditable, saveField, t }),
2196
+ h(SuperviseCountField, { key: `count:${fieldScope}`, config, editable: pluginEditable, saveField, t }),
2197
+ catalogProblem ? h('div', { style: alertStyle, role: 'alert' }, catalogProblem) : null,
2198
+ saveError ? h('div', { style: alertStyle, role: 'alert' }, saveError) : null,
2199
+ !sessionEnabled && (!writable(main) || !writable(worker) || !writable(plugin))
2200
+ ? h('div', { style: hintStyle }, t('route.readonly'))
1957
2201
  : null,
1958
- h('div', { style: { color: 'var(--dsw-alias-label-tertiary, inherit)', lineHeight: 1.3 } }, t('route.note')),
2202
+ h('div', { style: hintStyle }, t(sessionEnabled ? 'route.sessionNote' : 'route.note')),
1959
2203
  ),
1960
- h(AllowedToolsPanel, { key: sessionId, scope: scopes.orch, t, sessionId, sessionRemote }),
1961
- )
2204
+ h(AllowedToolsPanel, {
2205
+ key: sessionId,
2206
+ t,
2207
+ config,
2208
+ pluginValue: plugin.value,
2209
+ catalog,
2210
+ editable: pluginEditable,
2211
+ session,
2212
+ canChangeSession,
2213
+ onSessionChange: changeSession,
2214
+ moreTrigger,
2215
+ moreOpen,
2216
+ onMore: () => setMoreOpen(true),
2217
+ saveTools,
2218
+ resetTools,
2219
+ }),
2220
+ ))
2221
+ : null,
2222
+ open && moreOpen
2223
+ ? h(MoreSettingsPanel, {
2224
+ overlayRef: moreOverlay,
2225
+ dialogRef: moreDialog,
2226
+ onClose: closeMore,
2227
+ config,
2228
+ editable: pluginEditable,
2229
+ saveField,
2230
+ problem: sessionEnabled ? session.problem : saveError,
2231
+ t,
2232
+ })
1962
2233
  : null,
1963
2234
  )
1964
2235
  }
@@ -2016,6 +2287,7 @@ window.__ModuleLoader__.load({
2016
2287
  panelStyle,
2017
2288
  panelStyleOf,
2018
2289
  panelRoom,
2290
+ panelPlacement,
2019
2291
  panelColumnStyle,
2020
2292
  allowedColumnStyle,
2021
2293
  allowedListBoxStyle,
@@ -2026,8 +2298,9 @@ window.__ModuleLoader__.load({
2026
2298
  allowOps,
2027
2299
  resetAllowOps,
2028
2300
  EnableSwitch,
2029
- WorktreeIsolationField,
2301
+ MoreSettingsPanel,
2030
2302
  AllowedToolsPanel,
2303
+ createGlobalSnapshot,
2031
2304
  createSessionToolsDescriptors,
2032
2305
  mountSessionRemote,
2033
2306
  RoutePicker,