dsh-plugin-agentflow 0.2.3 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -80,7 +80,7 @@ CC19990113/dsh-plugin-agentflow
80
80
 
81
81
  ![深色](docs/images/canvas-dark.png)
82
82
 
83
- 主题跟随 DSH:插件把当前主题拼进 iframe 地址,画布启动时按它初始化;手动切换只在本次会话内生效,DSH 重开时重新读配置。
83
+ 主题跟随 DSH:内联(`native`)模式下画布直接读宿主主题(`body[data-ds-dark-theme]` / `html.dark` / 系统偏好),切换时实时推送;`iframe` 回滚模式仍把主题拼进地址,画布启动时按它初始化。手动切换只在本次会话内生效,DSH 重开时重新读配置。
84
84
 
85
85
  ## 架构
86
86
 
@@ -88,16 +88,18 @@ CC19990113/dsh-plugin-agentflow
88
88
  DSH 桌面
89
89
  ├── 插件(index.js)
90
90
  │ ├── 工具:agentflow_list / agentflow_run
91
- │ ├── 客户端:侧边栏入口、设置页分区、画布 iframe
92
- │ └── 子进程:node runtime/server.mjs → 127.0.0.1:8791
91
+ │ ├── 客户端:侧边栏入口、设置页分区、主视图画布
92
+ │ │ ├── src/canvas 画布源码(构建时编进客户端 bundle)
93
+ │ │ └── src/host 宿主桥:API 基地址 / 主题 / 样式注入
94
+ │ └── 子进程:node runtime/server.mjs → 127.0.0.1:8791(只提供 API)
93
95
  │ ├── engine.mjs 纯 DAG 执行器
94
96
  │ ├── llm.mjs 调模型(只走 bridge)
95
- │ └── web/dist 画布前端
97
+ │ └── web/dist 独立画布页面(iframe 回滚模式用)
96
98
  └── llm bridge(lib/bridge.js)
97
99
  └── 把 ctx.llm 暴露给引擎,模型调用始终在 DSH 进程内
98
100
  ```
99
101
 
100
- `runtime/` 是打包时从引擎仓库同步过来的副本(`npm run sync`),所以插件自带完整引擎,装完即用。
102
+ `runtime/` 是打包时从引擎仓库同步过来的副本(`npm run sync`),所以插件自带完整引擎,装完即用。画布源码(`src/canvas/`)由同一次同步带来、构建时一起编进客户端 bundle:默认 `native` 模式下画布直接长在 DSH 主视图里,8791 只负责 API;配成 `iframe` 则回滚到嵌入 `web/dist` 独立页面的旧行为。
101
103
 
102
104
  ## 配置
103
105
 
@@ -106,6 +108,8 @@ DSH 桌面
106
108
  | 数据目录 | `~/.dsh/agent-flow-data` | 首次启动会自动从 `~/.dsh/agent-flow/data` 迁移 |
107
109
  | 后端端口 | `8791` | 可用 `agentflowPort` 插件配置改 |
108
110
  | 预设 profile | `desktop` | 用环境变量 `AGENTFLOW_PROFILE` 指定别的 profile |
111
+ | `agentflowRenderMode` | `native` | 画布渲染方式:`native` 把画布编进客户端 bundle 直接渲染;`iframe` 回滚到嵌入独立画布页面 |
112
+ | `agentflowUrl` | `http://127.0.0.1:8791` | `native` 下作为 API 基地址;`iframe` 下作为画布页面地址 |
109
113
 
110
114
  ## 限制
111
115
 
@@ -113,14 +117,17 @@ DSH 桌面
113
117
  - 运行态是全局的:跑图时切换画布,事件会被丢弃;「停止」不分画布
114
118
  - 验证跑图会真实调用模型,注意 token 消耗
115
119
  - 预设依赖 DSH profile 的 patch 机制,profile 结构变了要跟着调整
120
+ - 宿主客户端运行时是 **React 18**;画布源码来自 React 19,但只使用两者共有的 API(不用 19-only API)
121
+ - 画布样式靠 `.af-canvas` 作用域隔离(Tailwind 的 `:root` 变量收进容器内),不污染宿主页面
122
+ - **`npm run sync` 会清空重建 `src/canvas/`**:为内联渲染做的适配改动会被引擎源码覆盖,改完需要重做
116
123
 
117
124
  ## 开发
118
125
 
119
126
  ```bash
120
- npm run build # 构建客户端 bundle(lib/client.js)
121
- npm run sync # 从 ~/.dsh/agent-flow 同步引擎到 runtime/
122
- npm run check # 语法检查
123
- npm test # 插件自测(83 项)
127
+ npm run build # 构建客户端 bundle(lib/client.js,含画布)
128
+ npm run sync # 从 ~/.dsh/agent-flow 同步引擎到 runtime/,并把画布源码同步到 src/canvas/
129
+ npm run check # 语法检查 + tsc --noEmit
130
+ npm test # 插件自测(152 项:bridge 83 + client bundle 69)
124
131
  ```
125
132
 
126
133
  引擎侧测试在 `~/.dsh/agent-flow/test`(85 项)。
@@ -130,9 +137,9 @@ npm test # 插件自测(83 项)
130
137
  发布由 **GitHub Release 触发**,不在本地手动 `npm publish`:
131
138
 
132
139
  1. 升 `package.json`(和 `package-lock.json`)的版本号
133
- 2. 打 tag 并创建 Release:`gh release create v0.2.3 --title "v0.2.3" --notes-file notes.md`
140
+ 2. 打 tag 并创建 Release:`gh release create v0.3.0 --title "v0.3.0" --notes-file notes.md`
134
141
  3. Release 发布后 [`.github/workflows/publish.yml`](.github/workflows/publish.yml) 自动执行:
135
- `npm ci` → 语法检查 → 自测 → 构建客户端 → 校验提交的 `lib/client.js` 与源码构建一致 → 校验 tag 与 `package.json` 版本一致 → `npm publish --provenance`
142
+ `npm ci` → 语法检查 → 构建客户端 → 自测(含客户端 bundle 自测)→ 校验提交的 `lib/client.js` 与源码构建一致 → 校验 tag 与 `package.json` 版本一致 → `npm publish --provenance`
136
143
 
137
144
  需要仓库 secret `NPM_TOKEN`:npm granular token,权限选 `Read and write (publish and stage)`,并勾选 `Bypass two-factor authentication`。
138
145