better-dsh 0.2.3-b → 0.2.3-c

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.
Files changed (77) hide show
  1. package/docs/50_test-reports/upstream-dsh-0.1.5-rc.2-local-test-report.md +79 -0
  2. package/docs/upstream-dsh-0.1.5-rc.2-report.md +156 -0
  3. package/lib/client/index.js +60 -51
  4. package/lib/index.d.ts +2 -3
  5. package/lib/index.js +29 -25
  6. package/package.json +2 -2
  7. package/docs/50_test-reports/v0.1.8d_artifacts/README.md +0 -138
  8. package/docs/50_test-reports/v0.1.8d_artifacts/code-mode-repl-only.observation.md +0 -74
  9. package/docs/50_test-reports/v0.1.8d_artifacts/dsh-session-session-4a293388-9ae1-474b-87a0-9e17bb556d94.jsonl +0 -3890
  10. package/docs/50_test-reports/v0.1.8d_artifacts/dsh-session-session-4a293388-9ae1-474b-87a0-9e17bb556d94.w-sample-0435.jsonl +0 -544
  11. package/docs/50_test-reports/v0.1.8d_artifacts/functions.json +0 -592
  12. package/docs/50_test-reports/v0.1.8d_artifacts/skills-catalog.snapshot.md +0 -30
  13. package/docs/50_test-reports/v0.1.8d_artifacts/tools-sdk.output-schemas.json +0 -1236
  14. package/docs/50_test-reports/v0.1.8d_artifacts/tools-sdk.python.txt +0 -592
  15. package/docs/50_test-reports/v0.1.8d_artifacts/tools-sdk.typescript.txt +0 -516
  16. package/docs/50_test-reports/v0.1.8d_artifacts/wire-vs-transcription.diff.md +0 -54
  17. package/docs/50_test-reports/v0.2.0b_artifacts/f2probe/Cargo.lock +0 -7
  18. package/docs/50_test-reports/v0.2.0b_artifacts/f2probe/Cargo.toml +0 -6
  19. package/docs/50_test-reports/v0.2.0b_artifacts/f2probe/src/bin/messy.rs +0 -8
  20. package/docs/50_test-reports/v0.2.0b_artifacts/f2probe/src/main.rs +0 -4
  21. package/docs/50_test-reports/v0.2.0b_artifacts/hashline-probe.md +0 -5
  22. package/docs/50_test-reports/v0.2.0b_artifacts/slowprobe/Cargo.lock +0 -7
  23. package/docs/50_test-reports/v0.2.0b_artifacts/slowprobe/Cargo.toml +0 -7
  24. package/docs/50_test-reports/v0.2.0b_artifacts/slowprobe/build.rs +0 -4
  25. package/docs/50_test-reports/v0.2.0b_artifacts/slowprobe/src/main.rs +0 -13
  26. package/docs/60_exploration-and-research/01-cordis-runtime/bun-compile-cordis-runtime-bootstrap-research.md +0 -536
  27. package/docs/60_exploration-and-research/01-cordis-runtime/cordis-customization-and-override-mechanics.md +0 -418
  28. package/docs/60_exploration-and-research/01-cordis-runtime/cordis-engineering-feasibility.md +0 -155
  29. package/docs/60_exploration-and-research/01-cordis-runtime/cordis-research.md +0 -583
  30. package/docs/60_exploration-and-research/01-cordis-runtime/dsh-cordis-hotplug-mcp-patch-research.md +0 -265
  31. package/docs/60_exploration-and-research/01-cordis-runtime/js-ts-language-fundamentals.md +0 -628
  32. package/docs/60_exploration-and-research/02-dsh/dash-research.md +0 -592
  33. package/docs/60_exploration-and-research/02-dsh/dsh-web-profile-package-map.md +0 -186
  34. package/docs/60_exploration-and-research/02-dsh/dsh-web-ui-slot-system-research.md +0 -310
  35. package/docs/60_exploration-and-research/02-dsh/dsh-webui-backend-data-inventory.md +0 -633
  36. package/docs/60_exploration-and-research/02-dsh/dsh-webui-strip-boundary-research.md +0 -300
  37. package/docs/60_exploration-and-research/02-dsh/dsh-webui-wire-appendix.md +0 -3729
  38. package/docs/60_exploration-and-research/02-dsh/web-frontend-composability-research.md +0 -191
  39. package/docs/60_exploration-and-research/02-dsh/webui-wire-data/capture-live-turn.json +0 -1
  40. package/docs/60_exploration-and-research/02-dsh/webui-wire-data/observed-endpoints.json +0 -224
  41. package/docs/60_exploration-and-research/02-dsh/webui-wire-data/remote-inventory.json +0 -110954
  42. package/docs/60_exploration-and-research/02-dsh/webui-wire-data/served-index-sample.html +0 -47
  43. package/docs/60_exploration-and-research/02-dsh/webui-wire-data/session-events.json +0 -9411
  44. package/docs/60_exploration-and-research/02-dsh/webui-wire-data/ws-frame-examples.json +0 -20
  45. package/docs/60_exploration-and-research/02-dsh-webui/dsh-web-profile-package-map.md +0 -186
  46. package/docs/60_exploration-and-research/02-dsh-webui/dsh-web-ui-slot-system-research.md +0 -310
  47. package/docs/60_exploration-and-research/02-dsh-webui/dsh-webui-backend-data-inventory.md +0 -633
  48. package/docs/60_exploration-and-research/02-dsh-webui/dsh-webui-strip-boundary-research.md +0 -300
  49. package/docs/60_exploration-and-research/02-dsh-webui/dsh-webui-wire-appendix.md +0 -3729
  50. package/docs/60_exploration-and-research/02-dsh-webui/web-frontend-composability-research.md +0 -191
  51. package/docs/60_exploration-and-research/02-dsh-webui/webui-wire-data/capture-live-turn.json +0 -1
  52. package/docs/60_exploration-and-research/02-dsh-webui/webui-wire-data/observed-endpoints.json +0 -224
  53. package/docs/60_exploration-and-research/02-dsh-webui/webui-wire-data/remote-inventory.json +0 -110954
  54. package/docs/60_exploration-and-research/02-dsh-webui/webui-wire-data/served-index-sample.html +0 -47
  55. package/docs/60_exploration-and-research/02-dsh-webui/webui-wire-data/session-events.json +0 -9411
  56. package/docs/60_exploration-and-research/02-dsh-webui/webui-wire-data/ws-frame-examples.json +0 -20
  57. package/docs/60_exploration-and-research/03-mobile-ios/dsh-mobile-spa-ios-input-experience-research.md +0 -160
  58. package/docs/60_exploration-and-research/03-mobile-ios/ios-chat-app-bridge-research.md +0 -324
  59. package/docs/60_exploration-and-research/04-session-storage/alpha5-compaction-jsonl-mapping.md +0 -1532
  60. package/docs/60_exploration-and-research/04-session-storage/alpha5-compaction-sample/episode-failed.json +0 -46
  61. package/docs/60_exploration-and-research/04-session-storage/alpha5-compaction-sample/episode1.json +0 -1124
  62. package/docs/60_exploration-and-research/04-session-storage/alpha5-compaction-sample/episode2.json +0 -1240
  63. package/docs/60_exploration-and-research/05-dashr-dev/plugin-development.md +0 -148
  64. package/docs/60_exploration-and-research/05-dashr-dev/upstream-alignment.md +0 -102
  65. package/docs/60_exploration-and-research/README.md +0 -87
  66. package/docs/60_exploration-and-research/bun-compile-cordis-runtime-bootstrap-research.md +0 -348
  67. package/docs/60_exploration-and-research/cordis-research.md +0 -350
  68. package/docs/60_exploration-and-research/dsh-mobile-spa-ios-input-experience-research.md +0 -160
  69. package/docs/60_exploration-and-research/dsh-web-profile-package-map.md +0 -186
  70. package/docs/60_exploration-and-research/dsh-web-ui-slot-system-research.md +0 -310
  71. package/docs/60_exploration-and-research/dsh-webui-strip-boundary-research.md +0 -300
  72. package/docs/60_exploration-and-research/ios-chat-app-bridge-research.md +0 -324
  73. package/docs/60_exploration-and-research/web-frontend-composability-research.md +0 -191
  74. package/docs/superd/00-blueprint.md +0 -331
  75. package/docs/superd/01-component-boundaries.md +0 -261
  76. package/docs/superd/02-dsh-embed-modes.md +0 -151
  77. package/docs/superd/image.png +0 -0
@@ -1,331 +0,0 @@
1
- # Super D (superD) 开发蓝图 v0.4
2
-
3
- > 2026-09-06 · 由 grilling Q&A(4 轮)收敛而成。全程决策记录见 §9。
4
- > 2026-09-08 v0.2 修订:前端 UI 策略重构——弃"全量字段大全包",改为与后端 Agent Adapter
5
- > 对偶的 Agent UI Adapter 组合层(§3.5);组件级边界与包 roster 见 `01-component-boundaries.md`。
6
- > 2026-09-08 v0.3 修订:DSH 面全透传 + routing mux 裁决(§3.6,token/cookie 认证链源码级
7
- > 取证);品牌 MVP 不动;selector 定位"品牌与 New Session 之间"(§3.7)。
8
- > 2026-09-08 v0.4 修订:selector 移位侧栏底部 footer 区——落位现成 list 槽 `sidebar.footer.action`
9
- > occupant(Settings 上方),**撤回 superd-sidebar copy**,ui-sidebar 回归中性底座(§3.7,决策 #24)。
10
- > 引用研究(2026-09-08 去重后路径):剥离边界 / 后端数据盘点 / wire 附录 → `02-dsh/`,
11
- > iOS bridge → `03-mobile-ios/`(镜像自 dashr 研究集);异构运行时 SDK 调研(六家,含
12
- > Codex/Hermes)→ `research/research-heterogeneous-agent-runtimes.md`(superd 专属);
13
- > 深层引用 dashr 仓 `docs/60_exploration-and-research/`(package map、slot system、composability)。
14
-
15
- ---
16
-
17
- ## 1. 定位与命名
18
-
19
- - **是什么**:多 Agent 运行时的统一入口(桥接层 / UI-BFF)。Super D **不提供** Agent 运行时——它把
20
- 本机与远端机器上已存在的各类 Agent 运行时,统一映射到 DSH Web UI 可消费的数据面。
21
- - **不是什么**:不是 DSH 的 fork/profile,不 vendor 修改上游源码;不含自己的模型调用链。
22
- - **命名**:App 名 **Super Dash**,品牌/简称 **Super D**,CLI 与代码标识 **superd**(无空格无连字符)。
23
- npm:顶层 unscoped `superD`(主发布名)+ 私有 scope(`@pgmi-builds/*`)用于 adapter 子包。
24
- - **品牌原则**:只有自研代码用 Super D 品牌(App 标识、Machine 标识、自有 UI 组件);
25
- 上游包内的 DSH/Web UI 名称原样沿用;runtime 名称(DSH、OMP、Claude Code…)照实显示。
26
- brand 槽(`brand.mark`/`brand.name`)**MVP 不替换**(v0.3):沿用当前激活 runtime 的上游品牌,
27
- 切换 runtime 也不改页面品牌;后续各 composition 填各自 runtime 品牌,Super D 自有品牌延后引入。
28
- - **形态**:独立 App。安装后即使机器上没有任何 Agent 运行时,服务器照常起、UI 照常访问(内容为空,
29
- 可连 remote)。本地无 runtime 时它就是一个壳——这是特性不是缺陷。
30
-
31
- ## 2. 架构
32
-
33
- ```
34
- 浏览器(DSH Web UI 中性底座原样复用 + per-runtime Agent UI Adapter 组合层,见 §3.5)
35
- │ 4 条 wire 契约(剥离研究 §1.3):①静态资产 ②boot graph ③/api unary ④WS mux
36
- ▼
37
- superD 服务器(端口 3090,唯一 origin、唯一认证面)
38
- ├─ Cordis 核心(自举):入口 CLI `superd`,第一个插件即 superd 主插件
39
- ├─ 载体插件(上游原样):webserver / frontend-static / client-modules / connection / gateway
40
- │ (WS traffic 与 connection 全部交由上层/上游处理)
41
- ├─ superd 自有插件:
42
- │ · Provider Registry(RuntimeProvider 统一接口,见 §3)
43
- │ · Machine Manager(local/remote 清单、连接池、探测)
44
- │ · Session Pairing(配对表,见 §4)
45
- │ · Selector UI patch(multi-agent selector,见 §6)
46
- │ · Composition Registry(per-runtime UI 组合选择,见 §3.5)
47
- │ · Routing Mux(/api namespace 分流:superD 自有面本地应答,其余透传 active adapter,见 §3.6)
48
- │ · AuthChain(预留中间件链,见 §7)
49
- │ · Consumers(TG 等 messaging channel,M2+,见 §8)
50
- └─ Adapter 插件 ×N(各自独立 npm 包,Provider 类别注册)
51
- ```
52
-
53
- - **分界点**(剥离研究裁决):浏览器半 + 4 条 wire 契约是保留层;**SessionController 及其下的
54
- TypertRemoteService 命名空间实现是替换层**——由 superd 的 Provider Registry + 各 adapter 接管。
55
- 替换层形态是 **thin routing mux** 而非全量重实现:superD 自有 namespace 本地应答,其余按
56
- active adapter 透传/翻译(DSH 面全透传,见 §3.6)。
57
- - **前端分界点**(v0.2 裁决):浏览器侧会话面 UI(chat/conversation/session/…)从"单一全量 UI"
58
- 改为 per-runtime Agent UI Adapter 组合层——同一时刻仅一个 composition 激活,随 selector 整组
59
- 换装;中性底座(slots/renderer/layout/sidebar/theme/settings 壳)原样复用(§3.5)。
60
- - **骨架形态**:最小 cordis 宿主(研究 §2.4 变体升格为主线)。进程形态与 DASH 同构:入口起 cordis
61
- 核心,自举 superd 插件,bundle 上游载体组件。理由:WS mux 帧格式无兼容承诺,复用 gateway 让
62
- wire 面 100% 原样、升级跟随 upstream;该层"无稳定性承诺"的风险被锁版策略对冲(§5)。
63
-
64
- ## 3. Adapter 体系(RuntimeProvider 统一接口)
65
-
66
- - **一套标准、统一出口,不分 proxy/translate 类型**。所有 adapter 做的都是"桥接":把上游 runtime
67
- 能提供的字段/事件映射到 superD 标准字段(DSH SessionEvent 词汇)。DSH adapter 今天实现为
68
- wire 级转发,明天上游 breaking change 时在 adapter 层消化翻译——对下游消费层始终同一接口。
69
- - **能力协商靠"两半"注册**:adapter 声明上游有什么数据字段(observable 字段注册),UI 侧按在场
70
- 字段渲染;缺字段 = 空,不崩、对应 element 隐藏。DSH Web UI 的降级容错是设计内行为(事件子集
71
- 可任意裁剪,`request/header` 缺失有显式占位;roster/patch 两级披露旋钮)。
72
- - **桥接范围**:能桥尽桥——会话列表/新建、消息流(含 WS streaming)、agent 状态 check、模型列表/
73
- 选择器、settings 面(可自定义增页)、附件、slash 命令、技能(slash 调出)。以 OMP Web 经验为准,
74
- 各 runtime 用户交互面共性远大于差异。
75
- - **UI composition 随 selector 切换**:字段在场制(两半注册)保留用于**同一 runtime 内**的降级
76
- 容错;**跨 runtime 形态差异**由 Agent UI Adapter 组合层承接(§3.5)——切换即整组换装,而非
77
- 往单一全量 UI 里叠字段。
78
- - **接入层选型**(依 `docs/research/research-heterogeneous-agent-runtimes.md`):优先 SDK 或厂商
79
- 官方协议面(app-server / stream-json / serve RPC),ACP/CLI spawn 作回退;A 档四家
80
- (Claude Code / Codex 等)SDK 自带引擎、独立 API key、可与用户全局安装完全隔离共存;Hermes
81
- 无官方 SDK(B/C 档),只能协议桥或源码 import,与用户共享 `~/.hermes` 现场需 profile 隔离。
82
- - **5 个 adapter 与排序**(第一期 OMP 打头):
83
- 1. **DSH**(参考实现,最薄:**全透传**——session / workspace / settings 三个面同 wire 协议逐帧
84
- 转发 unary + WS mux 到目标 machine;UI 与上游锁死同版 ⇒ 数据面契约逐字节相同;认证走服务端
85
- token→cookie 注入,见 §3.6)
86
- 2. **OMP**(第一期主力:复用 `~/workspaces/dsh-omp/apps/omp-web` 现成桥接——`agent.ts` 事件映射表、
87
- `rpc.ts` spawn `omp --mode rpc` NDJSON/stdio、union persistence、`pairing.ts`;差异点:omp-web 是
88
- "替换原生"(disable agent-loop/llm-*),superD 需要**多 runtime 并存**)
89
- 3. **Pi**(与 OMP 同系,源码大部分共用,独立注册)
90
- 4. **Claude Code**(A 档:SDK 捆绑官方 core,stdio/JSON-RPC 子进程驱动;独立 API key,不碰用户登录态)
91
- 5. **Codex**(A 档同型;SDK 形态见研究档)
92
- 6. **Hermes**(无官方 SDK:JSON-RPC/OpenAI 兼容 HTTP 协议面或源码 import;注意现场隔离,排序最后)
93
- - **发布粒度**:主包 bundle 全部 adapter(装完即用,selector 直接可见);将来数量多了再走按需安装
94
- (cordis patch 线现成)。
95
- - **法律边界提示**(研究档结论):Claude/Codex 等厂商禁止借用用户订阅登录态做产品转售——
96
- adapter 必须用独立 API key 认证,这是 wrapper 的合规边界。
97
- - **Provisioning 预留**:adapter 契约留可选方法位 `detect / install / locate-isolated-instance`,
98
- v1 全部 not-supported;**不留配置段**(避免"写了不生效"误导)。后续两路径:辅助安装(registry
99
- 拉取)与实例隔离安装(独立版本、与现场实例完全隔离,仅供 superD 消费——A 档 SDK 的
100
- "自包含引擎 + 独立认证"特性使这条路径天然可行)。
101
-
102
- ### 3.5 前端 Agent UI Adapter(与后端 Adapter 对偶)
103
-
104
- > 2026-09-08 裁决:弃"全量字段大全包"路线(把所有 runtime 的字段/插槽往一套 UI 里累加)——
105
- > 五个上游 runtime 更新步伐不一,全量表同步成本随时爆炸,且 superD 自有字段会与之互相污染。
106
- > 改为前后端对偶的组合层;组件级边界与包 roster 见 `01-component-boundaries.md`。
107
-
108
- - **对偶原则**:后端 **Agent Adapter**(数据面:runtime → superD 标准字段)↔ 前端 **Agent UI
109
- Adapter**(呈现面:标准字段 → 该 runtime 的 UI 形态;实现机制是插槽组合,行文亦称
110
- composition)。两者都是 cordis 插件,同一 selector 驱动、同组启停(一个 runtime 一对包)。
111
- - **三条策略**:
112
- 1. **agent-ui-dsh**:copy 一版 DSH 会话面 UI(精准锁版),完全对齐 DSH 形态——它既是 DSH
113
- runtime 的 composition,也是其余 composition 的**蓝本**。
114
- 2. **agent-ui-omp / -pi / -claude-code / -codex / -hermes**:各自从蓝本 copy 成独立包、独立
115
- 修改维护。各 runtime 会话面共性远多于差异(thinking / tool call / user prompt / agent
116
- response / context injection / system prompt…),从 DSH 起步后慢慢调;runtime 特有字段只改
117
- 自己的包。
118
- 3. **动态切换与扩展**:selector 切 runtime → 该组 composition 整组换装(cordis 插件行
119
- enable/disable + 前端重渲染,两档实现见边界文档 §5);后续可加 superD 自有全页 Tab 与
120
- 专属插槽。
121
- - **互斥保证**:同一时刻仅一个 composition 激活(conversation.* 等槽带同 key 双注册会撞、
122
- list 槽会叠渲染)——由 Composition Registry 按 selector 计算互斥的插件行集合。
123
- - **维护解耦**:Codex 字段更新 → 只改 agent-ui-codex + codex adapter;DSH Web UI 更新 → 想跟
124
- 进就 diff 抄进 agent-ui-dsh,不跟则维持锁版;各 composition 演进节奏完全独立。这是把
125
- "everything is plug-in" 从后端延伸到前端的自然结论:**换 provider(runtime)= 换整组插件行**。
126
- - **命名**:对偶名 **Agent UI Adapter**;包名 `@pgmi-builds/agent-ui-*` ↔ 后端
127
- `@pgmi-builds/agent-adapter-*`。
128
-
129
- ### 3.6 DSH 面全透传与认证链(v0.3 裁决)
130
-
131
- **裁决:方案一(服务端全透传)胜出,细化为一层 routing mux;方案二(前端直连上游端口)否决。**
132
-
133
- - **透传范围**:DSH adapter 对 session / workspace / settings 三个面全部逐帧转发——superD 的 DSH
134
- UI 包与上游**锁死同版**(无滞后),数据面契约逐字节一致,透传零翻译、上游新 feature 自动出现。
135
- superD 自有面(machines / selector / pairing 查询 / TG bindings)由 routing mux **本地应答**:按
136
- RPC method namespace 分流(`machines.*` / `superd.*` 本地,其余转发 active adapter)。分界不在
137
- "哪些面透传",而在"哪些 namespace 属于 superD"。
138
- - **settings 呈现纪律**:settings 面按 machine 整体呈现(切换 active machine 即切换到该 machine 的
139
- settings document);superD 自有 namespace 永不与上游 namespace 合并写入——跨边界 `replace()`
140
- 是 CAS 灾难,写操作只走各自 namespace 内的 path-op。
141
- - **否决方案二的硬理由**(前端 JS 直连上游 3080):① multi-machine 直接不可行——remote runtime 无
142
- 公网面,必须经 superD 中转(决策 #17);② cookie 是 authority-bound 的,浏览器对 3090/3080 是
143
- 两套 authority 两套握手,HttpOnly cookie 互不可见;③ 上游 `/api` 信任栅栏要求 Origin 与 Host 同
144
- authority——3090 页面跨源打 3080 会被 Origin fence 直接拒(除非把 3090 域名配进上游
145
- trustedHosts,逆流而上);④ 统一认证面 / 审计 / TG consumer 复用全部被打散。
146
- - **认证链(一手源码取证:`client-connection/src/{browser-auth,rpc-host,api-request-trust}.ts`)**:
147
- 1. DSH 每次进程启动生成 launch token(进程级随机;`authenticatedUrl()` 印在终端的 `?token=` URL);
148
- 2. 任何 HTTP client GET `/?token=…` → 校验通过 → 303 到 `/` + `Set-Cookie`(`dsh-auth-<hash>`,
149
- HttpOnly / SameSite=Strict,默认 30 天 = `cookieMaxAgeDays`);
150
- 3. cookie 由 HMAC-SHA256 签名,签名密钥**持久**存于 DSH credentials store
151
- (`credentialKey('client-connection','browser-session')`)——⇒ **cookie 跨 DSH 重启有效**,
152
- 每次轮换的只是 launch token;
153
- 4. 此后每个 `/api` 请求(unary 与 WS upgrade 面)过同一 `requestRejection`:Host/Origin 信任栅栏
154
- (loopback Host 天然过)+ `isAuthenticated` cookie 校验(authority 精确匹配)。**两道闸相互独立:
155
- 栅栏 loopback 免**(防 DNS rebinding / 跨源浏览器请求,源码注释明言 "not an auth layer");
156
- **认证 loopback 不免**——本机 curl 冒烟也必须先走 token URL 换 cookie 即证。superD 透传过关
157
- 靠的不是"loopback 特权",而是手里持有 mint 出来的 cookie。
158
- - **superD 侧落地**:machine 配置 `{name, url, token}`(§6 已预留)的 token 用于**一次性 mint**——
159
- DSH adapter 服务端 GET `http://127.0.0.1:3080/?token=…`,收下 cookie 存入 adapter 自己的 cookie
160
- jar(cookie 绑定 `127.0.0.1:3080` 这个精确 authority),此后所有 unary/WS 转发自动附带。
161
- **运维含义**:token 只需首次配置或 cookie 过期(默认 30 天)时提供一次;DSH 重启**不需要**换
162
- token。未来 provisioning 托管拉起 DSH 时可从子进程 stdout 自动读 token URL,实现零手工。
163
- - **patch 上游去 token gate:否决**。源码确认 `BrowserAuth` 在 Connection 插件激活时**无条件**创建,
164
- config 仅 `trustedHosts / cookieMaxAgeDays / maxRequestBodyBytes`,无 auth-off 配置口——patch
165
- 违背"不修改上游源码"与 user-just-another-user 部署形态,且升级要重打、remote 裸奔;仅作绝对
166
- 兜底记录在案,不进方案。
167
- - **superD 自身浏览器面**:复用 client-connection 原样 ⇒ 3090 自带同款 token URL + cookie 认证
168
- (浏览器↔superD 唯一认证面的 MVP 实现;authChain / Caddy 白名单前置,§7 不变)。
169
-
170
- ### 3.7 selector 位置与品牌呈现(v0.4 裁决,取代 v0.3 的"品牌与 New Session 之间")
171
-
172
- - **位置(v0.4)**:左栏**底部 footer 区**——注册为 `sidebar.footer.action` 槽的 occupant,渲染在
173
- **Settings 行的上方**。源码锚点:`ui-sidebar/src/client/SidebarRoot.tsx` 注释原话
174
- "Footer actions stack above Settings in both sidebar widths";`footArea` 为
175
- `flex-direction: column`(footer 块在上、settings 块在下)。
176
- - **为什么不能"与 Settings 同一行"**:owner(ui-sidebar)的 foot 区是垂直堆叠布局,occupant
177
- 从槽内改不了 owner 的布局(footer.action 的 owner props 只给 `{wide: boolean}`)。多
178
- occupant 之间倒是横排(`footerActions` 为 row)——将来有第二个 action 会并排。**先实现先
179
- 显示,位置观感后调**(v0.4 纪律)。
180
- - **现成官方槽,零 copy**:`sidebar.footer.action` 是 ui-sidebar 声明的 **list 槽**(kind:
181
- 'list',scope: 'root'),契约注释明言 "Optional actions beside Settings at the sidebar
182
- foot"——正是"append 一个 Settings 附近按钮"的官方用途。实现即标准 occupant 注册:
183
- `ctx.slots.inject('sidebar.footer.action', () => ctx.slots.register({ name:
184
- 'sidebar.footer.action', id: 'superd-agents', order }, AgentsButton))`。`wide` 两形态
185
- 自担(宽栏 = 与 Settings 行同宽样式的按钮;56px rail = 单图标);样式对齐 Settings 观感即可。
186
- - **撤回 superd-sidebar copy(v0.3 #23 机制作废)**:copy 是为"brand 与 New Session 之间无槽"
187
- 而设;selector 移位底部后不再需要——**ui-sidebar 回归中性底座原样依赖,中性底座 copy 例外
188
- 清零**,上游 PR 路线同步撤销。v0.3 的机制结论仍有效,保留备查:① brand 与 workspaces 之间
189
- 不可插入的原因是**该位置没有声明槽**(children 是 owner 源码结构;YAML patch 作用于插件行、
190
- 不动包内代码、不存在方法级 patch);② 若将来确需 owner 级改动,正道是 bundle 级整包替换
191
- (superD 是独立 app,装自己的 copy、不装上游包)或上游 PR;DOM 注入(与 React 树竞争父
192
- 容器)仅 fallback。能力图谱:bundle 级能换整插件不能改包内代码;patch 行级能 id 覆盖/name
193
- 重指/config 重述/disabled,不能动 method;`!!js` 只算 config;CSS claim / index-inject 只到
194
- 样式与 head 层脚本。
195
- - **品牌 MVP 策略**:见 §1——brand 槽不替换、不跟随 runtime 切换,全部沿用上游品牌;后续各
196
- composition 再填各自 runtime 的品牌。
197
-
198
- ## 4. Session Pairing(配对层)
199
-
200
- - superD **不持久化任何原始会话**——全量对话数据都在上游 runtime。
201
- - 但维护**单一统一配对表**:superD session id ↔ `{machine, runtime, upstreamId, locator?,
202
- consumerBindings?}`。存在 `~/.superd/pairings.json`(M1 起即此形态)。存在原因:DSH Web UI 的
203
- session id 格式与各上游不兼容,不可直传;配对即含寻址(如直接定位 OMP 物理文件做重放)。
204
- - 生命周期:会话列表刷新时对上游已不存在的配对惰性 GC(标 dead 不立删,防误删)。
205
- - Web UI 与 messaging channel 是同一会话的两条消费通道,查同一张表。
206
-
207
- ## 5. 依赖策略与构建(半构建 ready)
208
-
209
- - **方案 B:精确锁版 + 构建期内嵌**,不提交上游源码进仓:
210
- - 依赖三系列:**cordis 系列**(核心,全量需要)+ **dsh-web-app 系列**(限中性底座包,roster 见
211
- `01-component-boundaries.md` §4)+ **@pgmi-builds/agent-ui-*** 系列(自研 composition 包,
212
- 从 DSH 会话面源码 copy 起步、独立演进)。
213
- - exact-pin(无 `^`);repo 本地 node_modules 是唯一依赖来源,**禁止解析机器全局包**(不设
214
- NODE_PATH、不 symlink 全局树)——开发测试与生产环境隔离,版本一致。
215
- - **vendor 保护**:`superd vendor verify`(tarball hash 比对检漂移)+ `superd vendor restore`
216
- (registry 强制重拉覆盖)——防 agent/人工误改 vendor 源码,GitHub/npm 覆盖一步复原。
217
- - 修改上游一律走 patch 机制 / 自有插件(cordis.patch.yml 层序),非必要不碰源码——上游升级
218
- 随时跟进,patch 同步调整。
219
- - **Bun 单文件可执行**:交付期 `bun build --compile`,node_modules 整体嵌入 binary(静态锚定、
220
- 环境完整)。dev 期建议统一 bun runtime,避免 node/bun 双漂移(待 PoC 验证 bun 对上游包兼容性,
221
- 见 §11)。
222
- - **半构建 ready 验收**:最终产物在本机 / DEV3 / Docker / LXD container 以普通 user 试安装——
223
- 命令行能调出、SupervisorD/systemd 能拉起、服务器能跑——为测试终点。
224
-
225
- ## 6. Machine 概念与运行时发现
226
-
227
- - **层级**:Local(DSH, OMP…)+ Remote(DEV3-DSH, DEV3-OMP…)。无 remote 时默认连 local DSH。
228
- - **Remote 条目 v1 仅 superD-to-superD**:remote 机器上必须装 superD(它本身是服务器),本机连其
229
- URL。CLI 型 runtime(OMP 等)无网络服务概念,PC 上的 superD 无法向 DEV3 的 OMP 直接发起 RPC——
230
- 必须由 DEV3 上的 superD 起 adapter、spawn 本地 OMP,再经 HTTP 暴露。裸 runtime endpoint 直连
231
- 将来若有需求再加 `kind: raw` 档。
232
- - **配置**:machines 列表 `{name, url, token}`,纯 manual;remote 不做任何自动扫描(不扫内网、
233
- 无 mDNS)。
234
- - **本地发现(自动扫描)**:可配置启动时扫 / 定时(如每小时)扫。
235
- 1. `which dsh` 等探测 PATH 上的 CLI(装了什么);
236
- 2. DSH 服务探测三步:`which dsh` → 3080 握手探针(非 DSH 应答即放弃,**不盲扫端口**)→
237
- 扫进程树找 dsh 进程并解析 `--port` 参数(prod/测试线均显式 --port 启动;`ps e` 还可取
238
- DSH_HOME 标识实例);
239
- 3. DSH 服务是否存活由 DSH adapter 内部消化;CLI 型(Claude Code/OMP)无守护进程,探测即探测
240
- binary 在不在。
241
- - 参考 Multica 的发现方式(路径待 user 提供,届时对照修正)。
242
-
243
- ## 7. Auth(预留)
244
-
245
- - **入站**:所有 traffic(Web UI 对 3090、TG webhook)过同一 `authChain` 中间件序列。v1 只挂空壳
246
- whitelist 插件(Caddy 已做 IP 白名单,插件实际什么都不做)。未来加真实 auth = 往 chain 插
247
- provider,不动业务层。
248
- - **出站**:machine 连接的 token 走 `machine.credentials` 独立配置段。入站/出站概念分离,v1 实现
249
- 可暂保持一致。
250
-
251
- ## 8. Consumers(messaging channels,M2+)
252
-
253
- - TG/Slack 与 Web UI 同级:都只是消费通道,不与特定 runtime 强绑定。
254
- - **模型**:仿 DASH 方法论与 schema——类别 `consumer`,类型 `messaging channel`,实例 Telegram
255
- (后续 Slack、WhatsApp…)。
256
- - **绑定**:用户添加 TG binding(提供 bot token)→ 平台具备该 channel facility → 在 UI 上把 channel
257
- 自由配对给任意 runtime(local DSH 或 remote OMP 皆可)。
258
- - **会话语义(A 方案)**:一个 TG chat 配对一个 runtime;无 session 时首条消息自动创建;用户可
259
- slash command 主动新建/切换(含 switch agent runtime);**TTL 轮换**:新 prompt 距 session
260
- last-modified 超阈值(默认 24h,可按 channel 配置)则自动开新会话——借鉴 Hermes
261
- (`idle_minutes=1440`,`gateway/session.py::_is_session_expired`),但 superD 用**新 prompt 到达时
262
- 惰性判定**,不用 Hermes 的后台 watcher(无常驻轮换进程,更省)。
263
- - **TTL 归属 consumer 侧**(非 adapter/全局):TTL 是消费通道的使用习惯;Web UI 通道永远显式新建,
264
- 不自动轮换。
265
- - **复用**:orchestra 的 telegram-consumer(`~/workspaces/orchestra/src/packages/consumer/
266
- telegram-consumer/`,grammy,long polling:`bot.start({drop_pending_updates})`;binding/deliver/
267
- media 分文件)搬运 + 改挂 superD pairing 层。设计参考 `~/workspaces/research/a2a-telegram/`。
268
-
269
- ## 9. 决策记录(grilling 全量裁决)
270
-
271
- | # | 决策 | 裁决 |
272
- |---|---|---|
273
- | 1 | 进程形态 | 独立 App:superd CLI 起 cordis 核心,最小 cordis 宿主 + 自有插件;非 dsh profile |
274
- | 2 | 命名 | superD / `superD`(npm unscoped 主发布) + `@pgmi-builds/*` scope;repo `~/workspaces/superd`(dashr 同级新仓) |
275
- | 3 | 数据/端口 | 独立 `~/.superd/`(用户 dsh 数据不动);默认 3090(避 3080/3081/4999) |
276
- | 4 | 桥接范围 | 能桥尽桥,字段在场制 + UI 降级;"两半"注册一套统一标准 |
277
- | 5 | remote 注册 | manual `{name,url,token}`;remote 无自动扫描;本地扫描 PATH+端口+进程树 |
278
- | 6 | M1 形态 | 两条腿(DSH 透传 + OMP adapter)+ DEV3 remote;TG 为 M2 |
279
- | 7 | 依赖 | 方案 B:exact-pin + bun compile 内嵌;repo 自包含;vendor verify/restore 保护 |
280
- | 8 | 骨架 | 最小 cordis 宿主(webserver/frontend-static/client-modules/connection/gateway 原样) |
281
- | 9 | Provider 接口 | 统一 RuntimeProvider,不分 passthrough/translate 类型 |
282
- | 10 | 会话归属 | 不存原始会话;单一 pairing 表(~/.superd/pairings.json,惰性 GC) |
283
- | 11 | adapter 发布 | 主包 bundle 全部 5+1 个 adapter |
284
- | 12 | provisioning | 只留方法位(detect/install/locate-isolated),不留配置段 |
285
- | 13 | 品牌原则 | 仅自研代码用 Super D;上游与 runtime 名原样 |
286
- | 14 | TG 会话 | A 方案 + TTL(24h 默认,consumer 侧惰性判定) |
287
- | 15 | auth | authChain 空壳中间件(Caddy 白名单先行);入站/出站概念分离 |
288
- | 16 | dev/test | 端口 4999(机器共用惯例,用完即停);home `.superd-test`(user space 或仓内均可);预配置 local-dsh(3080)/local-omp/dev3-superd 三 machine |
289
- | 17 | 远程协议 | v1 仅 superD-to-superD;CLI 型 runtime 无网络面,必须由 remote superD 本地桥接 |
290
- | 18 | 前端 UI 策略 | 弃全量字段大全包;Agent UI Adapter 与后端对偶,per-runtime composition(agent-ui-dsh 为蓝本),selector 切换整组换装(§3.5) |
291
- | 19 | UI roster 分界 | 中性底座(slots/renderer/layout/**sidebar**/theme/settings 壳/wire 桩)原样依赖;会话面包全部进 composition 层替换;草案见 01-component-boundaries.md,M1 定稿(v0.4:ui-sidebar 回归,见 #24) |
292
- | 20 | DSH 面透传 | 方案一全透传(session/workspace/settings)+ routing mux 按 namespace 分流;否决前端直连 3080(§3.6) |
293
- | 21 | DSH 认证 | 服务端 token 一次性 mint cookie jar(持久 secret ⇒ cookie 跨上游重启有效,默认 30 天);否决 patch 去 token gate(§3.6) |
294
- | 22 | 品牌 MVP | brand 槽不替换:沿用上游/runtime 品牌,切换不改;Super D 品牌延后(§1/§3.7) |
295
- | 23 | selector 位置 | ~~品牌与 New Session 之间;superd-sidebar copy~~(位置与机制已被 #24 取代) |
296
- | 24 | selector 移位(v0.4) | 侧栏底部 footer 区:`sidebar.footer.action` list 槽 occupant(Settings 上方,源码 stack above);撤回 superd-sidebar copy,ui-sidebar 回归中性底座;先实现先显示、位置后调(§3.7) |
297
-
298
- ## 10. 里程碑
299
-
300
- **M1(第一期)**:
301
- - superD 源码仓 + 最小 cordis 宿主骨架,dev 实例 4999 + `.superd-test` home,UI 完整可访问(中性底座 + agent-ui-dsh composition);
302
- - selector 显示 Local: DSH, OMP + Remote: DEV3(位置:侧栏底部 footer 区 Settings 上方,§3.7);
303
- - DSH adapter(全透传 3080 三面:session/workspace/settings + 服务端 token→cookie mint,§3.6);OMP adapter(复用 omp-web 桥接,多 runtime 并存改造):
304
- 新建会话、收发一轮含工具调用的消息;
305
- - DEV3 部署 superD 并连入,其 local OMP 出现在列表(Caddy IP 白名单,无认证负担);
306
- - 交付验收按"半构建 ready"标准(本机/容器普通 user 试装拉起)。
307
-
308
- **M2**:TG consumer 转正(binding 配对、slash 命令、TTL);Pi adapter + agent-ui-pi;auth 真实实现(若需要)。
309
-
310
- **M3+**:Claude Code → Codex → Hermes adapter(接入层选型依 §3,各 adapter 同步交付对应 agent-ui-* composition);辅助安装/实例隔离 provisioner;Multica 式发现对照;Electron 壳(借鉴 MIT 开源 DSH Desktop,Web UI 装壳即 GUI App)。
311
-
312
- ## 11. 开放问题
313
-
314
- 1. ~~Codex adapter 专项研究缺失~~ → 已由 `docs/research/research-heterogeneous-agent-runtimes.md`
315
- 覆盖(A 档 SDK 形态、协议面、独立 API key 要求);M3 动工前按其选型结论细化事件映射即可。
316
- 2. ~~Hermes 进程面勘测~~ → 同上文档已测绘(无官方 SDK,JSON-RPC/OpenAI 兼容 HTTP 协议面或源码
317
- import;现场隔离注意事项已记)。剩余:协议面事件词汇 → SessionEvent 的具体映射表,M3 前做。
318
- 3. **bun 兼容性 PoC**:上游包在 `bun build --compile` 下的行为(native addon、`import.meta.url`
319
- 技巧、vendored 树)未实测。
320
- 4. ~~DSH 零认证探针端点~~ → **已解决**(2026-09-08 源码核实):GET `/` 未带 token/cookie 时返回
321
- 401 + 特征响应体 `dsh web authentication required; reopen the URL printed by dsh web.`
322
- (browser-auth.ts `writeUnauthorized`)——这本身就是零认证、且带 DSH 指纹的探针应答。
323
- 5. **Multica 发现方式**:user 将提供路径,届时对照修正本地扫描设计。
324
- 6. **dsh-web-app 系列包清单定格**:三档草案(中性底座 / composition 蓝本 / 排除)已在
325
- `01-component-boundaries.md` §4,随 M1 骨架落地定稿。
326
- 7. **DSH WS upgrade 握手鉴权细节**:高置信推断与 `/api` 同走 `requestRejection`(rpc-host.ts L98
327
- 调用点);M1 落地 DSH adapter 时实证并记录。
328
- 8. **DSH 呈现层嵌入模式裁决**:直连 iframe / 透明反代+iframe(lite composition)/ 集成
329
- composition 三档——上游六条事实已核验(无 frame 头、token 仅进程内存、栅栏按 Host、
330
- 客户端按 location.origin、资产 root-相对),利弊与验证清单见 `02-dsh-embed-modes.md`;
331
- 建议 M1 用 lite(本地直连 + 远程镜像反代)、集成版为终态,落地前过该文档 §7 清单。
@@ -1,261 +0,0 @@
1
- # Super D 组件边界与 UI 组合层(v0.3)
2
-
3
- > 2026-09-08 · 比蓝图细一层:组件级"复用 / 替换 / 排除 / 自研"边界,两幅 Mermaid + 包 roster
4
- > 草案。蓝图见 `00-blueprint.md`(v0.2,§3.5 对偶裁决)。
5
- > 上游包事实依据:`../60_exploration-and-research/02-dsh/dsh-web-profile-package-map.md`(220 包
6
- > 四层分类)与 `dsh-web-ui-slot-system-research.md`(插槽机制一手核验);机制语言层依据:
7
- > `../60_exploration-and-research/02-dsh/dash-research.md` §1「"Everything is plug-in" 的语言层
8
- > 实现」。本文回答:DSH 现有包里哪些拿来做依赖、哪些明确不要(如 DSH Session Controller)、
9
- > 自研 agent adapter 补在哪、前端组合层替换 DSH UI 的哪一段。
10
- > 2026-09-08 v0.2 修订:BFF 定性为 routing mux(namespace 分流);ui-sidebar 移入 superD 自有
11
- > shell;selector 位置与品牌 MVP 策略落位;DSH 认证链速查见 §2 要点(全文:蓝图 §3.6)。
12
- > 2026-09-08 v0.3 修订:selector 移位侧栏底部(`sidebar.footer.action` list 槽 occupant,
13
- > Settings 上方),superd-sidebar copy 撤回,ui-sidebar 回归中性底座(蓝图 §3.7 v0.4 / 决策 #24)。
14
-
15
- ---
16
-
17
- ## 1. 前后端对偶总则
18
-
19
- - 后端 **Agent Adapter**(数据面):把 runtime 的字段/事件映射到 superD 标准字段(DSH
20
- SessionEvent 词汇)。统一 `RuntimeProvider` 接口,一个 runtime 一个包。
21
- - 前端 **Agent UI Adapter**(呈现面,机制 = 插槽组合):把标准字段渲染成该 runtime 的 UI
22
- 形态。一个 runtime 一个包,从 agent-ui-dsh 蓝本 copy 起步。
23
- - 两者都是 cordis 插件;**同一 selector 驱动、同组启停**——一个 runtime 落地为一对包:
24
- `@pgmi-builds/agent-adapter-x` + `@pgmi-builds/agent-ui-x`。
25
- - **切换 = 组合重算**:selector 变更 → 插件行集合(空间数据)一次变更 → 时间维机制(受影响
26
- fiber 的 unload → reload 重放)落地 → 插槽树重渲染。这是 "everything is plug-in" 的机制内
27
- 行为(epoch 签名驱动),不是 hack;语言层同构案例见 dash-research §1(5) 的 provider 切换。
28
- - **互斥不变量**:同一时刻仅一个 composition 激活。conversation.* 槽带同 key 双注册会撞、
29
- list 槽会叠渲染)——互斥由 host 侧 Composition Registry 保证(按 selector 算出互斥插件行集)。
30
- - **DSH 面 = 全透传 + routing mux**:superD 自有 namespace(`machines.*` / `superd.*`)本地应答,
31
- 其余按 active adapter 转发;DSH 三面(session/workspace/settings)逐帧透传、零翻译(蓝图 §3.6)。
32
-
33
- ---
34
-
35
- ## 2. Host 侧组件边界
36
-
37
- ```mermaid
38
- flowchart LR
39
- subgraph UP["复用 · 上游原样(exact-pin)"]
40
- COR["cordis 核心 + loader/include/group/timer/hmr<br/>(插件系统基座)"]
41
- CARRY["载体:host-webserver · host-frontend-static<br/>client-modules(wire ①②:静态资产 + boot graph)"]
42
- WIREH["wire:client-connection · api-gateway · typert-*<br/>(wire ③④:/api unary + WS mux,哑传输)"]
43
- end
44
-
45
- subgraph SD["自研 · superD host 核心"]
46
- BOOT["superd 主插件(CLI 自举 · bundle 组装)"]
47
- REG["Provider Registry<br/>RuntimeProvider 统一接口"]
48
- BFF["superD Routing Mux / BFF<br/>machines.* / superd.* 本地应答 · 其余透传 active adapter"]
49
- MM["Machine Manager<br/>local/remote 清单 · 连接池 · 探测"]
50
- PAIR["Session Pairing(配对表 ~/.superd/pairings.json)"]
51
- SELH["Selector + Composition Registry<br/>runtime 选择态 · 插件行集合重算"]
52
- AUTH["AuthChain(空壳中间件链)"]
53
- end
54
-
55
- subgraph AD["自研 · Agent Adapter ×6(@pgmi-builds/agent-adapter-*)"]
56
- A1["dsh(wire 透传 3080)"]
57
- A2["omp(omp-web 桥接改造)"]
58
- A3["pi(与 omp 同系共用源码)"]
59
- A4["claude-code(SDK)"]
60
- A5["codex(SDK)"]
61
- A6["hermes(协议桥/源码 import)"]
62
- end
63
-
64
- CONSU["自研 · Consumers:TG messaging channel(M2+,orchestra 搬运)"]
65
-
66
- subgraph X["排除 · 不进依赖树"]
67
- X1["DSH BFF:api-session / api-workspace / api-settings-controller"]
68
- X2["DSH 数据面:session / persistence / projection / query / title / telemetry…"]
69
- X3["DSH agent 运行时:agent / agent-loop / llm-* / tools / tool-* / sandbox / fs / subprocess…"]
70
- X4["DSH 编排原语:subagent / goal / workflow / schedule / agent-team…"]
71
- end
72
-
73
- REMOTE["远端 machine(superD-to-superD:DEV3…)"]
74
- RT["上游 runtime 进程(dsh:3080 / omp / claude-code / codex / pi / hermes)"]
75
-
76
- BOOT --> COR & CARRY & WIREH
77
- BOOT --> REG & MM & PAIR & SELH & AUTH
78
- BFF --> REG
79
- SELH --> REG
80
- MM --> REMOTE
81
- REG --> A1 & A2 & A3 & A4 & A5 & A6
82
- A1 & A2 & A3 & A4 & A5 & A6 --> RT
83
- REMOTE -.->|"remote superD 起 adapter 桥本地 runtime"| RT
84
- CONSU --> PAIR
85
- BFF -.->|"替代其 RPC 面(不进树)"| X1
86
- ```
87
-
88
- 要点:
89
-
90
- - **载体层原样**:webserver / frontend-static / client-modules / connection / gateway 保持上游
91
- 依赖——wire 面 100% 兼容、升级跟随 upstream,锁版策略对冲无稳定性承诺的风险(蓝图 §2/§5)。
92
- - **替换层 = thin routing mux,不是全量重实现**:DSH 三个 BFF controller(**含 DSH Session
93
- Controller**)不进依赖树;superD 侧按 RPC namespace 分流——自有面本地应答,其余透传 active
94
- adapter(DSH 面逐帧零翻译,UI 与上游锁死同版 ⇒ 契约逐字节一致)。
95
- - **DSH 认证链速查**:machine token 一次性 mint `dsh-auth-*` cookie(HMAC 签名、持久 secret ⇒
96
- cookie 跨上游重启有效,默认 30 天)→ adapter 服务端 cookie jar 附带转发;loopback Host 天然过
97
- 信任栅栏。源码锚点与 mint 流程见蓝图 §3.6。
98
- - **排除层**:DSH 的会话数据面、agent 运行时、编排原语整体不引入。superD 不跑 agent、不存原始
99
- 会话(唯一持久状态是 pairing 表)。这些包不是"被 patch 掉",而是**根本不出现在 bundle 里**。
100
- - **远端**:v1 仅 superD-to-superD;CLI 型 runtime 必须由远端 superD 本地桥接(蓝图决策 #17)。
101
-
102
- ---
103
-
104
- ## 3. 浏览器侧组件边界(Agent UI Adapter 替换带)
105
-
106
- ```mermaid
107
- flowchart TD
108
- subgraph BASE["中性底座 · 上游原样(所有 composition 共享,exact-pin)"]
109
- RUN["cordis-client-runner(浏览器 Cordis:fiber/registry/reflect/events)"]
110
- CMOD["client-modules / client-locale / client-store / client-hmr"]
111
- SLO["ui-slots(SlotCore · SlotMap 契约声明合并)"]
112
- REN["ui-renderer(唯一 React 绑定 · renderSlot('root'))"]
113
- LAY["ui-layout(root 布局树 · sidebar/会话区 区域槽)"]
114
- SID["ui-sidebar(sidebar 壳,原样复用)<br/>含 sidebar.footer.action list 槽(selector 落位)"]
115
- THM["ui-theme"]
116
- SET["ui-settings(settings 页壳)"]
117
- WS["ui-workspace(workspace 壳 · 数据由 superD BFF 聚合供给)"]
118
- RPC["client-connection / api-remotes(RPC 桩 · 远程能力本地代理)"]
119
- end
120
-
121
- subgraph COMP["自研 · Agent UI Adapter ×6(@pgmi-builds/agent-ui-* · 同一时刻仅一个激活)"]
122
- U1["agent-ui-dsh<br/>(蓝本:copy DSH 会话面全套)"]
123
- U2["agent-ui-omp"]
124
- U3["agent-ui-pi"]
125
- U4["agent-ui-claude-code"]
126
- U5["agent-ui-codex"]
127
- U6["agent-ui-hermes"]
128
- end
129
-
130
- subgraph OWN["自研 · superD 自有 UI(occupant / 自有槽,不动底座)"]
131
- SELUI["Runtime Selector(Agents 按钮)<br/>sidebar.footer.action occupant · Settings 上方"]
132
- MSET["Machines 设置页(multi-machine 配置)"]
133
- BRD["brand:MVP 不动(沿用上游品牌)"]
134
- TAB["(后续)superD 专属全页 Tab + 专属插槽"]
135
- end
136
-
137
- subgraph CUT["被 composition 替换 · 不进 bundle(槽声明权随 copy 转移)"]
138
- C1["ui-chat / ui-conversation / ui-session / ui-trajectory"]
139
- C2["ui-model-selection / ui-agent-preset / ui-permission-presets / ui-settings-models"]
140
- C3["ui-tool / ui-attachment / ui-input-trigger / ui-reference / ui-message-feedback / ui-approval / ui-user-questions"]
141
- C4["ui-plan / ui-goal / ui-subagent / ui-workflow-run / ui-jobs / ui-deliverables / ui-skill / ui-commands"]
142
- end
143
-
144
- RPC --> RUN
145
- RUN --> SLO
146
- REN --> LAY
147
- LAY --> SID
148
- LAY --> SET
149
- LAY --> WS
150
- LAY -->|"会话区槽带(conversation.* / tool.call.* / composer.*)同一时刻仅一个激活"| U1 & U2 & U3 & U4 & U5 & U6
151
- U1 -.->|"copy 蓝本(锁版 diff 基线)"| C1 & C2 & C3 & C4
152
- SID --> SELUI
153
- SET --> MSET
154
- SID --> BRD
155
- LAY -.-> TAB
156
- SELUI -.->|"切换:整组换装 + 重渲染"| COMP
157
- ```
158
-
159
- 要点:
160
-
161
- - **中性底座 = 上游原样依赖**:插槽机制(ui-slots)、渲染器(ui-renderer)、布局树(ui-layout)、
162
- 主题、settings 页壳、sidebar 壳、wire 桩。换 runtime 不动这一层——对应 DSH 前端"框架中立
163
- 内核 + 可替换渲染后端"的既有分层。
164
- - **替换不是 patch,是不进 bundle**:CUT 组的 DSH 包(ui-chat / ui-conversation / ui-session /
165
- …)直接不进依赖树;composition 包 copy 了它们的源码,**槽声明权(SlotMap 契约合并 + 槽
166
- 注册)随 copy 转移**给 composition。底座的 layout 只认槽带,不认包。
167
- - **superD 自有 UI 全部走 occupant**:selector(Agents 按钮)= `sidebar.footer.action` list 槽
168
- occupant(Settings 上方;owner 只给 `wide` 标志,rail 态渲染单图标,样式对齐 Settings 行);
169
- Machines 挂 settings 页;brand MVP 不动;未来全页 Tab 走 ui-layout 声明新区域槽或自有路由
170
- 槽——中性底座零 copy 例外(v0.4:superd-sidebar 计划撤回)。
171
- - **数据来源不变**:composition 消费的仍是 api-remotes RPC 桩暴露的标准面(session/workspace/
172
- settings),服务端由 superD BFF + adapter 供给。前后端各自的"对偶替换带"互不越界。
173
-
174
- ---
175
-
176
- ## 4. 包 roster 草案(三档处置,M1 定稿——对齐蓝图开放问题 #6)
177
-
178
- ### ① 中性底座:原样依赖(exact-pin)
179
-
180
- | 组 | 包 | 备注 |
181
- |---|---|---|
182
- | Cordis 框架 | `cordis`、`plugin-loader`、`plugin-include`、`plugin-group`、`plugin-timer`、`plugin-hmr`、`cosmokit`、`schemastery` | 插件系统基座,全量需要 |
183
- | 载体(host) | `host-webserver`、`host-frontend-static`、`client-modules` | wire ①②(静态资产 + boot graph) |
184
- | wire 双端 | `client-connection`、`api-gateway`、`api-remotes`、`typert-protocol/-registry/-loader`、`cordis-host-runner`、`cordis-client-runner` | wire ③④ + 浏览器 Cordis,哑传输/哑运行时 |
185
- | 前端基建 | `client-locale`、`client-store`、`client-hmr` | observable/locale/热更基建 |
186
- | UI 壳 | `ui-slots`、`ui-renderer`、`ui-layout`、`ui-sidebar`、`ui-theme`、`ui-settings`(页壳)、`ui-cordis`(调试面板) | 组合机制与布局骨架,所有 composition 共享(v0.4:sidebar 回归) |
187
- | UI 壳(复核位) | `ui-workspace` | 壳可复用;数据面改由 superD BFF 聚合(machine/runtime 分组),M1 复核是否需 patch |
188
-
189
- > v0.4 修订:~~ui-sidebar 移出中性底座~~ **撤回**——selector 移位侧栏底部 footer 区,落位现成
190
- > list 槽 `sidebar.footer.action`(occupant 注册,渲染于 Settings **上方**堆叠;与 Settings 同行
191
- > 不可行:owner 的 `footArea` 是 column 布局,occupant 改不了 owner)。ui-sidebar 回归中性底座
192
- > 原样依赖,copy 例外清零(蓝图 §3.7 v0.4 / 决策 #24)。
193
-
194
- ### ② composition 蓝本:不直接依赖,copy 进 agent-ui-dsh 后派生 per-runtime 包
195
-
196
- | 组 | DSH 源包(蓝本) | 说明 |
197
- |---|---|---|
198
- | 会话核心 | `ui-chat`、`ui-conversation`、`ui-session`、`ui-trajectory` | conversation.* 槽带的 owner,整组 copy |
199
- | 模型/预设 | `ui-model-selection`、`ui-agent-preset`、`ui-permission-presets`、`ui-settings-models` | 模型列表/预设是 runtime 特有词汇 |
200
- | 会话附属 | `ui-tool`、`ui-attachment`、`ui-input-trigger`、`ui-reference`、`ui-message-feedback`、`ui-approval`、`ui-user-questions` | 审批/提问面各 runtime 形态不一;缺字段 = 隐藏(降级容错是设计内行为) |
201
- | DSH 深度面 | `ui-plan`、`ui-goal`、`ui-subagent`、`ui-workflow-run`、`ui-jobs`、`ui-deliverables`、`ui-skill`、`ui-commands` | DSH 特有编排/深度面;其他 runtime 按字段在场裁剪或整块不实现 |
202
-
203
- 派生纪律:`agent-ui-omp/-pi/-claude-code/-codex/-hermes` 一律从 **agent-ui-dsh**(而非上游原包)
204
- fork 起步——蓝本已经过一次"去 DSH 宿主耦合"的整理,派生成本更低。
205
-
206
- ### ③ 排除:不进依赖树
207
-
208
- | 组 | 包 | 理由 |
209
- |---|---|---|
210
- | DSH BFF | `api-session-controller`、`api-workspace-controller`、`api-settings-controller` | 替换层:RPC 面由 superD BFF + Provider Registry 接管 |
211
- | DSH 数据面 | `session`、`session-persistence(-jsonl/sqlite)`、`session-projection(-cache)`、`session-query(-sqlite)`、`session-title*`、`session-stats`、`session-telemetry*`、`session-log-*`、`session-checkpoint-policy`、`session-reference` | superD 不存原始会话;唯一持久状态 = pairing 表 |
212
- | DSH agent 运行时 | `agent`、`agent-loop`、`agent-presets`、`agent-default-model`、`agent-instructions`、`llm-*`、`tools`、`tool-*`、`shell*`、`bash-*`、`pwsh-*`、`sandbox*`、`fs*`、`subprocess*`、`code-runtime*`、`compaction*`、`spill*`、`credentials*`、`system-prompt`、`persona`、`mcp-client` | superD 不跑 agent、不含模型调用链(蓝图 §1) |
213
- | DSH 编排原语 | `subagent*`、`goal*`、`workflow*`、`schedule`、`jobs*`、`experimental-agent-team`、`plan-mode` | 上游 runtime 自带编排;superD 只桥接 |
214
- | 宿主杂项 | `plugin-inventory*`、`directory-picker-*`(暂缓)、`brand-official`(brand 槽由自有 occupant 替换)、`settings-plugins`/`settings-plugin-inventory`(superD v1 无插件管理面) | 按需再议;directory-picker 与 machine 语义耦合,M1 裁决 |
215
- | 候补复核 | `dsh-settings`、`settings-file`、`storage*` | superD 自身设置面(machines/selector/TG bindings)的底座:复用或自研轻量 JSON,M1 定 |
216
-
217
- ---
218
-
219
- ## 5. 切换机制(两档实现)
220
-
221
- **v1 简化档(M1 先用)**:
222
-
223
- ```
224
- UI selector 切 runtime(settings CAS 写入)
225
- → host Composition Registry 重算互斥插件行集(disable 旧组 · enable 新组)
226
- → boot graph 随之变更(该组 client 模块表换装)
227
- → 前端整页 reload:client runner 按新组合重新拉模块、逐个 apply
228
- → SlotRegistry 重算 → renderSlot('root') 整树重渲染
229
- ```
230
-
231
- 成本最低,正确性靠"组合是声明式数据"保证——页面刷新只是最粗粒度的 reload。
232
-
233
- **v2 热切换档(M2+ 增强)**:client-hmr 式 fiber 级换装,不整页刷新——旧行组 fiber unload
234
- (LIFO 撤销槽注册)、新行组 reload 重放,React 树保持挂载、仅会话区槽带重渲染。
235
-
236
- **机制依据**:插件行集合是运行时数据(空间维被数据化);enable/disable 触发受影响 fiber 的
237
- epoch 变化 → unload → reload 重放(时间维机制化);插槽注册随 disposer 撤销、重放时重登记。
238
- 与 dash-research §1(5) 的 provider 切换案例完全同构,只是粒度从"单服务槽"换成"一组插件行"。
239
-
240
- ---
241
-
242
- ## 6. 维护策略(对偶架构的收益兑现)
243
-
244
- - **各 composition 独立演进**:Codex 字段更新 → 只改 agent-ui-codex + codex adapter,回归测试
245
- 只测这一对包;DSH Web UI 更新 → diff 锁定版本 → 选择性抄进 agent-ui-dsh,不跟则维持现状。
246
- - **copy 纪律**:每个 composition 包记录其蓝本基线(上游精确版本号);跟进 = `diff 基线..新版`
247
- → 人工挑选 → 更新基线记录。vendor verify/restore(蓝图 §5)防误改上游本体。
248
- - **弃大全包的理由存档**:全量字段/全模板路线在 5+ 个更新步伐不一的上游之间同步一个全量表,
249
- 复杂度按 O(runtime × 字段) 增长且任何一次上游 breaking 都波及全部用户;组合层把复杂度切回
250
- O(runtime) 的独立通道——这正是用 Cordis 组合机制(换 provider = 换插件行)换来的维护性。
251
-
252
- ---
253
-
254
- ## 来源
255
-
256
- - 蓝图:`00-blueprint.md` v0.4(§2 分界点、§3.5 对偶裁决、§3.6 透传与认证链、§3.7 selector 位置 v0.4、决策 #18–#24)
257
- - DSH 包事实:`../60_exploration-and-research/02-dsh/dsh-web-profile-package-map.md`(220 包四层
258
- 分类、类型双轨)、`dsh-web-ui-slot-system-research.md`(SlotCore/双半插件/RPC 边界)
259
- - 机制语言层:`../60_exploration-and-research/02-dsh/dash-research.md` §1「"Everything is
260
- plug-in" 的语言层实现」(3)(5)(名字耦合与 epoch、provider 切换生命周期)
261
- - 官方文档蒸馏:dsh-dev-skill `skill/chapters/ch18`(slots/webServer/settings 契约)