@huanban/rulego-editor-core 1.3.18 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/README.md +153 -2
  2. package/assets/images/discovery-dark.svg +1 -0
  3. package/assets/images/discovery.svg +1 -0
  4. package/assets/images/nacos-dark.svg +1 -0
  5. package/assets/images/nacos.svg +1 -0
  6. package/assets/theme-icons/ant-blue/discovery-dark.svg +1 -0
  7. package/assets/theme-icons/ant-blue/discovery.svg +1 -0
  8. package/assets/theme-icons/ant-blue/nacos-dark.svg +1 -0
  9. package/assets/theme-icons/ant-blue/nacos.svg +1 -0
  10. package/assets/theme-icons/apple/discovery-dark.svg +1 -0
  11. package/assets/theme-icons/apple/discovery.svg +1 -0
  12. package/assets/theme-icons/apple/nacos-dark.svg +1 -0
  13. package/assets/theme-icons/apple/nacos.svg +1 -0
  14. package/assets/theme-icons/colorful/discovery-dark.svg +1 -0
  15. package/assets/theme-icons/colorful/discovery.svg +1 -0
  16. package/assets/theme-icons/colorful/nacos-dark.svg +1 -0
  17. package/assets/theme-icons/colorful/nacos.svg +1 -0
  18. package/assets/theme-icons/dark/discovery-dark.svg +1 -0
  19. package/assets/theme-icons/dark/discovery.svg +1 -0
  20. package/assets/theme-icons/dark/nacos-dark.svg +1 -0
  21. package/assets/theme-icons/dark/nacos.svg +1 -0
  22. package/assets/theme-icons/default/discovery-dark.svg +1 -0
  23. package/assets/theme-icons/default/discovery.svg +1 -0
  24. package/assets/theme-icons/default/nacos-dark.svg +1 -0
  25. package/assets/theme-icons/default/nacos.svg +1 -0
  26. package/assets/theme-icons/elegant/discovery-dark.svg +1 -0
  27. package/assets/theme-icons/elegant/discovery.svg +1 -0
  28. package/assets/theme-icons/elegant/nacos-dark.svg +1 -0
  29. package/assets/theme-icons/elegant/nacos.svg +1 -0
  30. package/assets/theme-icons/github/discovery-dark.svg +1 -0
  31. package/assets/theme-icons/github/discovery.svg +1 -0
  32. package/assets/theme-icons/github/nacos-dark.svg +1 -0
  33. package/assets/theme-icons/github/nacos.svg +1 -0
  34. package/assets/theme-icons/icon-theme-manifest.json +30 -14
  35. package/assets/theme-icons/icon-theme-overview.svg +1599 -1287
  36. package/assets/theme-icons/material/discovery-dark.svg +1 -0
  37. package/assets/theme-icons/material/discovery.svg +1 -0
  38. package/assets/theme-icons/material/nacos-dark.svg +1 -0
  39. package/assets/theme-icons/material/nacos.svg +1 -0
  40. package/assets/theme-icons/modern/discovery-dark.svg +1 -0
  41. package/assets/theme-icons/modern/discovery.svg +1 -0
  42. package/assets/theme-icons/modern/nacos-dark.svg +1 -0
  43. package/assets/theme-icons/modern/nacos.svg +1 -0
  44. package/assets/theme-icons/nature/discovery-dark.svg +1 -0
  45. package/assets/theme-icons/nature/discovery.svg +1 -0
  46. package/assets/theme-icons/nature/nacos-dark.svg +1 -0
  47. package/assets/theme-icons/nature/nacos.svg +1 -0
  48. package/assets/theme-icons/tailwind/discovery-dark.svg +1 -0
  49. package/assets/theme-icons/tailwind/discovery.svg +1 -0
  50. package/assets/theme-icons/tailwind/nacos-dark.svg +1 -0
  51. package/assets/theme-icons/tailwind/nacos.svg +1 -0
  52. package/assets/theme-icons/tech/discovery-dark.svg +1 -0
  53. package/assets/theme-icons/tech/discovery.svg +1 -0
  54. package/assets/theme-icons/tech/nacos-dark.svg +1 -0
  55. package/assets/theme-icons/tech/nacos.svg +1 -0
  56. package/assets/theme-icons/vscode/discovery-dark.svg +1 -0
  57. package/assets/theme-icons/vscode/discovery.svg +1 -0
  58. package/assets/theme-icons/vscode/nacos-dark.svg +1 -0
  59. package/assets/theme-icons/vscode/nacos.svg +1 -0
  60. package/dist/ai/copilot-markdown.d.ts +40 -0
  61. package/dist/ai/copilot-transport.d.ts +39 -0
  62. package/dist/api/AIManager.d.ts +5 -4
  63. package/dist/api/ApiProvider.d.ts +17 -69
  64. package/dist/api/ComponentCatalogCache.d.ts +27 -0
  65. package/dist/api/DebugSocketClient.d.ts +18 -25
  66. package/dist/api/RuleChainAPI.d.ts +24 -145
  67. package/dist/api/StreamParser.d.ts +0 -10
  68. package/dist/api/index.d.ts +4 -14
  69. package/dist/api/response-utils.d.ts +4 -22
  70. package/dist/api/types.d.ts +44 -179
  71. package/dist/chunks/editor-core-code-editor-CRki2wA_.js +512 -0
  72. package/dist/chunks/editor-core-default-components-BjF65lar.js +9448 -0
  73. package/dist/chunks/editor-core-dialogs-CkFLaC8Q.js +17176 -0
  74. package/dist/chunks/editor-core-icons-BqeFofNA.js +668 -0
  75. package/dist/chunks/editor-core-json-diff-RHsPeX-w.js +199 -0
  76. package/dist/chunks/editor-core-locales-i6o28vm2.js +4159 -0
  77. package/dist/chunks/editor-core-node-patches-BJTT3TuX.js +8060 -0
  78. package/dist/chunks/editor-core-node-views-BOaPVdmN.js +1288 -0
  79. package/dist/chunks/editor-core-property-drawers-lLsBIoCa.js +8035 -0
  80. package/dist/chunks/editor-core-standalone-CHXk3ukc.js +11270 -0
  81. package/dist/chunks/editor-core-styles-C1TbLgCK.js +8841 -0
  82. package/dist/chunks/vendor-logicflow-core-runtime-Cp6IBEjB.js +217 -0
  83. package/dist/chunks/vendor-logicflow-shared-C7YynLDn.js +4 -0
  84. package/dist/chunks/xlsx-BopDBbWb.js +24176 -0
  85. package/dist/core/ActionRegistry.d.ts +47 -0
  86. package/dist/core/AutoLayout.d.ts +1 -48
  87. package/dist/core/ComponentDocService.d.ts +28 -0
  88. package/dist/core/ComponentRegistry.d.ts +1 -125
  89. package/dist/core/DataAdapter.d.ts +4 -89
  90. package/dist/core/DiagnosticService.d.ts +15 -0
  91. package/dist/core/EditorCore.d.ts +22 -212
  92. package/dist/core/EditorWorkspace.d.ts +111 -0
  93. package/dist/core/EventBus.d.ts +0 -86
  94. package/dist/core/ExplorerTreeStore.d.ts +43 -0
  95. package/dist/core/FieldCapabilityRegistry.d.ts +16 -0
  96. package/dist/core/FieldChangeRegistry.d.ts +48 -0
  97. package/dist/core/HistoryManager.d.ts +0 -123
  98. package/dist/core/I18nManager.d.ts +0 -120
  99. package/dist/core/Optimizations.d.ts +0 -14
  100. package/dist/core/OptionSourceRegistry.d.ts +38 -0
  101. package/dist/core/RuleChainChatManager.d.ts +0 -37
  102. package/dist/core/RuleChainValidator.d.ts +0 -79
  103. package/dist/core/StateStore.d.ts +4 -140
  104. package/dist/core/ThemeManager.d.ts +0 -141
  105. package/dist/core/ValidationEngine.d.ts +0 -103
  106. package/dist/core/component-palette.d.ts +20 -0
  107. package/dist/core/component-payload.d.ts +0 -9
  108. package/dist/core/connection-status.d.ts +77 -0
  109. package/dist/core/context-menu-position.d.ts +27 -0
  110. package/dist/core/cron-schedule.d.ts +85 -0
  111. package/dist/core/debug-panel.d.ts +6 -0
  112. package/dist/core/editor-capabilities.d.ts +95 -0
  113. package/dist/core/editor-dock.d.ts +100 -0
  114. package/dist/core/editor-panel.d.ts +68 -0
  115. package/dist/core/explorer-tree.d.ts +27 -0
  116. package/dist/core/field-protocol.d.ts +32 -0
  117. package/dist/core/foundation-tokens.d.ts +38 -0
  118. package/dist/core/graph-operations.d.ts +34 -0
  119. package/dist/core/hover-tools.d.ts +26 -0
  120. package/dist/core/index.d.ts +68 -16
  121. package/dist/core/infer-run-input.d.ts +11 -0
  122. package/dist/core/key-value-editor.d.ts +6 -0
  123. package/dist/core/overlay-layers.d.ts +28 -0
  124. package/dist/core/recent-components.d.ts +51 -0
  125. package/dist/core/run-guard.d.ts +7 -0
  126. package/dist/core/runtime-field-dictionary.d.ts +68 -0
  127. package/dist/core/runtime-limits.d.ts +0 -5
  128. package/dist/core/save-conflict.d.ts +4 -0
  129. package/dist/core/server-status.d.ts +34 -0
  130. package/dist/core/simple-array.d.ts +4 -0
  131. package/dist/core/table-protocol.d.ts +36 -0
  132. package/dist/core/table-spreadsheet.d.ts +3 -0
  133. package/dist/core/test-cases.d.ts +54 -0
  134. package/dist/core/toolbar-icons.d.ts +4 -0
  135. package/dist/core/topology-rules.d.ts +17 -0
  136. package/dist/core/virtual-window.d.ts +20 -0
  137. package/dist/core/workspace-tab-actions.d.ts +13 -0
  138. package/dist/defaults/components.d.ts +0 -9
  139. package/dist/defaults/index.d.ts +0 -15
  140. package/dist/defaults/locale-en-US.d.ts +0 -24
  141. package/dist/defaults/locale-zh-CN.d.ts +0 -39
  142. package/dist/defaults/official-component-fallbacks.d.ts +0 -8
  143. package/dist/extensions/ClipboardExtension.d.ts +0 -23
  144. package/dist/extensions/KeyboardExtension.d.ts +0 -17
  145. package/dist/extensions/MenuExtension.d.ts +0 -23
  146. package/dist/iconRegistry.d.ts +0 -22
  147. package/dist/index.cjs +11320 -0
  148. package/dist/index.d.ts +25 -47
  149. package/dist/index.esm.js +1123 -99614
  150. package/dist/index.umd.js +3380 -1471
  151. package/dist/models/BaseNodeModel.d.ts +0 -32
  152. package/dist/models/index.d.ts +0 -1
  153. package/dist/nodes/AgentOrchestrationNode.d.ts +0 -24
  154. package/dist/nodes/GroupNode.d.ts +0 -38
  155. package/dist/nodes/HeadlessHtmlNode.d.ts +0 -16
  156. package/dist/nodes/SwitchNode.d.ts +0 -22
  157. package/dist/nodes/UnknownNodeModel.d.ts +0 -19
  158. package/dist/standalone/HuanbanRulegoEditor.d.ts +202 -401
  159. package/dist/standalone/ai-model-policy.d.ts +0 -1
  160. package/dist/standalone/ai-providers.d.ts +0 -1
  161. package/dist/standalone/auth-fetch.d.ts +2 -46
  162. package/dist/standalone/browser-assets.d.ts +0 -8
  163. package/dist/standalone/canvas-view.d.ts +6 -0
  164. package/dist/standalone/code-editor-language-loaders.d.ts +2 -0
  165. package/dist/standalone/code-editor-language-loaders.legacy.d.ts +7 -0
  166. package/dist/standalone/code-editor.d.ts +3 -87
  167. package/dist/standalone/connection-status-binding.d.ts +8 -0
  168. package/dist/standalone/custom-nodes.d.ts +0 -26
  169. package/dist/standalone/drawer-unsaved-guard.d.ts +2 -9
  170. package/dist/standalone/edge-label-quick-editor.d.ts +2 -0
  171. package/dist/standalone/editor-actions.d.ts +4 -0
  172. package/dist/standalone/editor-chain-info.d.ts +5 -38
  173. package/dist/standalone/editor-context-menu.d.ts +0 -21
  174. package/dist/standalone/editor-debug-ws.d.ts +37 -145
  175. package/dist/standalone/editor-delete.d.ts +0 -1
  176. package/dist/standalone/editor-dialogs.d.ts +16 -66
  177. package/dist/standalone/editor-events.d.ts +0 -27
  178. package/dist/standalone/editor-overlays.d.ts +14 -0
  179. package/dist/standalone/editor-property-drawers.d.ts +13 -71
  180. package/dist/standalone/editor-route-settings.d.ts +7 -55
  181. package/dist/standalone/editor-sidebar.d.ts +0 -18
  182. package/dist/standalone/editor-styles.d.ts +0 -11
  183. package/dist/standalone/editor-toast.d.ts +1 -2
  184. package/dist/standalone/editor-toolbar.d.ts +5 -80
  185. package/dist/standalone/editor-tour.d.ts +7 -0
  186. package/dist/standalone/editor-trace-overlay.d.ts +0 -5
  187. package/dist/standalone/full-json-dialog.d.ts +5 -1
  188. package/dist/standalone/group-node.d.ts +1 -51
  189. package/dist/standalone/icon-utils.d.ts +0 -20
  190. package/dist/standalone/index.d.ts +10 -7
  191. package/dist/standalone/json-diff.d.ts +0 -1
  192. package/dist/standalone/keyboard-events.d.ts +0 -1
  193. package/dist/standalone/layout-scheduler.d.ts +0 -6
  194. package/dist/standalone/lifecycle.d.ts +0 -5
  195. package/dist/standalone/logger.d.ts +0 -32
  196. package/dist/standalone/models-dev-catalog.d.ts +0 -1
  197. package/dist/standalone/node-copy.d.ts +7 -4
  198. package/dist/standalone/node-definitions.d.ts +0 -63
  199. package/dist/standalone/node-identity.d.ts +0 -1
  200. package/dist/standalone/node-theme.d.ts +8 -0
  201. package/dist/standalone/node-views-data.d.ts +0 -20
  202. package/dist/standalone/official-node-view-patches.d.ts +1 -14
  203. package/dist/standalone/outline-style.d.ts +7 -0
  204. package/dist/standalone/run-history-format.d.ts +0 -1
  205. package/dist/standalone/security-utils.d.ts +1 -5
  206. package/dist/standalone/shared-node-manager.d.ts +31 -0
  207. package/dist/standalone/themes.d.ts +0 -48
  208. package/dist/tools/tool-editor.d.ts +0 -1
  209. package/dist/types/component.d.ts +105 -87
  210. package/dist/types/editor.d.ts +16 -169
  211. package/dist/types/events.d.ts +30 -107
  212. package/dist/types/index.d.ts +3 -10
  213. package/dist/types/rule-chain.d.ts +0 -90
  214. package/dist/utils/GraphUtils.d.ts +0 -10
  215. package/dist/utils/helpers.d.ts +0 -80
  216. package/dist/utils/index.d.ts +0 -5
  217. package/dist/utils/pinyin-search.d.ts +0 -57
  218. package/dist/utils/relation-utils.d.ts +0 -1
  219. package/dist/utils/textUtils.d.ts +0 -12
  220. package/dist/version.d.ts +2 -3
  221. package/dist/xlsx-qn1xoUuv.cjs +105 -0
  222. package/package.json +19 -5
  223. package/vite-chunks.d.ts +11 -0
  224. package/vite-chunks.mjs +120 -0
  225. package/dist/index.cjs.js +0 -9515
package/README.md CHANGED
@@ -21,6 +21,9 @@
21
21
  - **调试日志** — 内置调试开关,默认关闭,可按需开启
22
22
  - **节点分组** — DynamicGroup 容器节点,支持拖入/折叠/调整大小
23
23
  - **WebSocket 调试** — 内置实时调试面板,支持节点日志追踪
24
+ - **工作区状态服务** — `EditorWorkspace` 管理多 Tab、草稿、保存冲突和关闭确认
25
+ - **Shell 状态服务** — `EditorDockStore` 管理左右/底部/AI Dock 的折叠与尺寸约束
26
+ - **服务状态服务** — `ServerStatusStore` 区分 API 授权状态和 WebSocket 实时连接状态
24
27
 
25
28
  ## 📦 安装
26
29
 
@@ -76,6 +79,10 @@ const api = new RuleChainAPI({
76
79
  // 获取列表
77
80
  const list = await api.list(1, 10)
78
81
 
82
+ // 资源树或跨链搜索需要完整数据源时按页读取,最多读取 100 页。
83
+ // 结果仍应由宿主或 UI 侧虚拟化渲染,不要直接渲染成无分页卡片墙。
84
+ const allChains = await api.listAll(100, '', 100)
85
+
79
86
  // 获取内容
80
87
  const content = await api.getContent('chain-001')
81
88
 
@@ -127,13 +134,142 @@ setDebug(true)
127
134
  | `HuanbanRulegoEditor` | 独立编辑器主类,全功能即开即用 |
128
135
  | `EditorCore` | 编辑器引擎,管理生命周期和数据流 |
129
136
  | `RuleChainAPI` | 默认 API 客户端,实现 `WorkflowFetcher` 接口 |
137
+ | `RuleChainAPI.listAll` | 受最大页数保护的全量分页读取,供资源树/跨链搜索使用 |
130
138
  | `DEFAULT_ROUTES` | 默认 API 路径映射 (RuleGo 标准路径) |
131
139
  | `EventBus` | 事件总线,支持 on / off / emit 模式 |
132
140
  | `StateStore` | 响应式状态容器,支持 subscribe |
133
141
  | `ThemeManager` | 主题管理器,6 套主题自由切换 |
134
142
  | `I18nManager` | 国际化管理器,中英文切换 |
135
143
  | `ValidationEngine` | 规则链验证引擎 |
144
+ | `EditorWorkspace` | 框架无关的多 Tab、草稿和保存冲突状态 |
145
+ | `EditorDockStore` | 左右/底部/AI Dock 的可见性与尺寸状态 |
146
+ | `EditorPanelRegistry` | 面板 ID、所属 Dock、打开/关闭和激活状态 |
147
+ | `ServerStatusStore` | API/WS 连接状态、401、1006 和重连次数 |
148
+ | `deriveWsUrl` | 按 HTTP(S) 服务地址推导 WS(S) 地址 |
136
149
  | `setDebug` / `isDebug` | 调试日志开关 |
150
+ | `calculateVirtualWindow` | 框架无关的固定行高虚拟窗口计算,React/Vue/HTML 共用 |
151
+
152
+ ### 工作区与服务状态(HTML/原生 JS)
153
+
154
+ 这些服务不依赖 React、Vue 或 DOM,可以在原生 HTML 工作台中直接组合。每次创建
155
+ 都是独立实例,不使用全局状态;销毁后不会再接收订阅通知。
156
+
157
+ ```ts
158
+ import {
159
+ EditorWorkspace,
160
+ EditorDockStore,
161
+ ServerStatusStore,
162
+ } from '@huanban/rulego-editor-core'
163
+
164
+ const workspace = new EditorWorkspace()
165
+ const tab = workspace.openTab({ chainId: 'orders', title: '订单流程', data })
166
+ workspace.setDraft(tab.id, nextData)
167
+
168
+ const dock = new EditorDockStore()
169
+ dock.setDockVisibility('ai', true)
170
+ dock.setDockWidth('ai', 560)
171
+
172
+ const server = new ServerStatusStore({ baseUrl: 'http://127.0.0.1:19806' })
173
+ const unsubscribe = server.subscribe(state => {
174
+ // state.api: unknown/checking/online/unauthorized/offline/error
175
+ // state.ws: idle/connecting/connected/reconnecting/closed/error
176
+ renderConnectionBadge(state)
177
+ })
178
+
179
+ // 在 fetch 或 WebSocket 的真实回调中报告状态,不伪造成功。
180
+ server.recordHttpStatus(response.status)
181
+ server.recordWebSocketStatus('live')
182
+
183
+ unsubscribe()
184
+ workspace.destroy()
185
+ dock.destroy()
186
+ server.destroy()
187
+ ```
188
+
189
+ `EditorWorkspace.activateTab()` 只更新工作区状态,适合宿主自己管理画布数据的场景。
190
+ 如果使用 `HuanbanRulegoEditor` 实例并希望 Tab 激活和画布切换始终成对发生,应使用:
191
+
192
+ ```ts
193
+ const activated = editor.activateWorkspaceTab(tab.id)
194
+ ```
195
+
196
+ 该入口会同步激活 Tab、加载 Tab 中的 DSL,并在恢复脏草稿时重新标记 dirty。真正切换
197
+ 规则链时也会先关闭绑定旧链的运行/AI Drawer,取消旧请求;同一规则链刷新不会打断
198
+ 当前 AI 对话。React、Vue 和 HTML 宿主都可以通过 `ref.editor` 或 standalone 实例调用。
199
+
200
+ 宿主隐藏内置工具栏后,仍可以用同一实例打开组件管理,并直接定位到指定页签:
201
+
202
+ ```ts
203
+ editor.openComponentManager('shared')
204
+ ```
205
+
206
+ 可用页签为 `installed` / `market` / `dsl` / `shared`。`shared` 仍受
207
+ `capabilities.workspace.sharedNodes` 控制;能力未开启时会回退到已安装页,不会发起共享节点请求。
208
+
209
+ ### standalone 布局持久化(宿主显式启用)
210
+
211
+ `HuanbanRulegoEditor` 默认不读取 `localStorage`、Cookie 或模块级全局变量。需要
212
+ 恢复 Dock/Panel 布局时,由宿主注入一个同步存储适配器和稳定命名空间:
213
+
214
+ ```ts
215
+ import { HuanbanRulegoEditor } from '@huanban/rulego-editor-core'
216
+
217
+ const editor = new HuanbanRulegoEditor({
218
+ container: '#editor',
219
+ persistence: {
220
+ adapter: {
221
+ getItem: key => localStorage.getItem(key),
222
+ setItem: (key, value) => localStorage.setItem(key, value),
223
+ removeItem: key => localStorage.removeItem(key),
224
+ },
225
+ namespace: {
226
+ host: 'orders-workbench',
227
+ editorInstance: 'rule-chain-editor',
228
+ version: 'v2',
229
+ },
230
+ migrateFromVersions: ['v1'],
231
+ dockMigrate: oldState => migrateDockV1ToV2(oldState),
232
+ panelMigrate: oldState => migratePanelsV1ToV2(oldState),
233
+ },
234
+ })
235
+ ```
236
+
237
+ `host`、`editorInstance` 和 `version` 会共同构成 Dock、Panel 和聊天历史的存储
238
+ 命名空间。聊天历史还会追加当前 `chainId` 与 `assistant/run` 模式,因此同一宿主
239
+ 内的多个编辑器实例、规则链和 AI 助理/运行面板不会串话。版本升级时,宿主需要用
240
+ `migrateFromVersions` 明确列出允许读取的旧版本,再分别通过 `dockMigrate`、
241
+ `panelMigrate` 将旧数据转换为当前结构;Core 不扫描存储,也不会猜测旧版本。当前版本
242
+ key 已存在但内容损坏时会回退默认状态,不会静默恢复更旧的数据。聊天历史由宿主 adapter
243
+ 自行迁移或清理。坏 JSON、不匹配的命名空间和越界尺寸会回退到默认状态。未传
244
+ `persistence` 时 Dock/Panel 不会写入新的全局状态 key;聊天面板继续兼容旧版
245
+ `rulego-chat-history-*` 浏览器 key。React hook、Vue composable 和原生 HTML 宿主也可以直接把同一个
246
+ `EditorDockStore`、`EditorPanelRegistry` 实例传给各自适配层,避免多个状态副本。
247
+
248
+ `ServerStatusStore` 只记录连接结果,不会替宿主发请求或自动创建 WebSocket。API 地址
249
+ 变化会清空旧连接状态;HTTP 401/403 进入 `api=unauthorized`,WS 1006 进入
250
+ `ws=closed` 并保留错误提示,UI 可以分别提供登录和重连操作。
251
+
252
+ `RuleChainAPI` 的内置请求层也遵守同一认证边界。宿主可以通过 `apiOptions` 传入
253
+ 动态 `headers`、`customFetch`、`credentials`、`includeStoredToken`、`onAuthRequired` 和
254
+ `serverStatus`:
255
+
256
+ ```ts
257
+ const api = new RuleChainAPI({
258
+ apiBase: '/api/v1',
259
+ headers: () => ({ Authorization: `Bearer ${readToken()}` }),
260
+ credentials: 'include',
261
+ includeStoredToken: false,
262
+ onAuthRequired: () => host.openLogin(),
263
+ serverStatus,
264
+ })
265
+ ```
266
+
267
+ 跨域 Cookie 只有在宿主明确传入 `credentials: 'include'` 并由后端配置允许凭据时才会发送;
268
+ 默认不会把当前页面 Cookie 发给任意远程地址。HTTP 401 会通过 `onAuthRequired` 做短时间去重
269
+ 通知,表示凭据缺失或失效,宿主应进入登录流程;HTTP 403 也保留真实状态码并通知宿主,表示
270
+ 当前凭据已被服务识别但没有权限,宿主不应因此清理 token;网络失败则只更新服务离线状态。
271
+ 所有情况都通过 `RuleChainApiError.status` 保留真实结果,禁止把未授权、无权限或网络错误误报
272
+ 为成功或普通空列表。
137
273
 
138
274
  ## 📋 导出类型
139
275
 
@@ -144,9 +280,11 @@ PagedResponse<T> // 分页响应
144
280
  ApiResult // 操作结果
145
281
 
146
282
  // 请求抽象
147
- WorkflowFetcher // 请求适配器接口(8 个方法)
283
+ WorkflowFetcher // 请求适配器接口(分页 list 必选,listAll 可选)
148
284
  RuleChainAPIOptions // API 客户端配置
149
285
  RuleChainRoutes // 路径映射(支持函数式路由)
286
+ VirtualWindow // 固定行高虚拟窗口结果
287
+ VirtualWindowOptions // 虚拟窗口输入参数
150
288
 
151
289
  // UI 自定义
152
290
  WorkflowListIcons // 列表组件图标映射
@@ -161,12 +299,25 @@ EditorEventMap, EditorEventName
161
299
  HuanbanRulegoEditorOptions
162
300
  ```
163
301
 
302
+ ### 按连线插入组件
303
+
304
+ standalone 的 `openNodePicker` 支持传入 `edgeId`,用于把现有的
305
+ `source -> target` 连线替换为 `source -> new -> target`:
306
+
307
+ ```ts
308
+ editor.openNodePicker({ edgeId: selectedEdgeId, excludeInputNodes: true })
309
+ ```
310
+
311
+ 该操作保留原关系类型及源/目标锚点,并在内部失败时恢复原连线。React/Vue 主编辑器复用
312
+ 同一 Core 行为;独立渲染 `EditorEdgeHoverTools` 时,宿主应把目标连线 ID 传给同一个
313
+ `openNodePicker`,不要把边 ID 当成节点 ID。
314
+
164
315
  ## 🏗️ 构建产物
165
316
 
166
317
  | 格式 | 文件 | 说明 |
167
318
  |------|------|------|
168
319
  | ESM | `dist/index.esm.js` | 现代打包工具 (Vite/Webpack) |
169
- | CJS | `dist/index.cjs.js` | Node.js / 旧项目 |
320
+ | CJS | `dist/index.cjs` | Node.js / 旧项目 |
170
321
  | UMD | `dist/index.umd.js` | `<script>` 标签直接引入,暴露 `window.RuleGoEditorCore` |
171
322
 
172
323
  > 所有格式均全量打包 LogicFlow + CodeMirror,无需额外安装。
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#344054" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><circle cx="512" cy="512" r="300"/><path d="M690 334L430 428C392 442 364 470 350 508L256 768C244 804 280 840 316 828L576 734C614 720 642 692 656 654L750 394C762 358 726 322 690 334Z"/><circle cx="512" cy="512" r="64"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#ffffff" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><circle cx="512" cy="512" r="300"/><path d="M690 334L430 428C392 442 364 470 350 508L256 768C244 804 280 840 316 828L576 734C614 720 642 692 656 654L750 394C762 358 726 322 690 334Z"/><circle cx="512" cy="512" r="64"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#344054" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><rect x="226" y="228" width="572" height="568" rx="84"/><path d="M304 704V320L516 704V320"/><path d="M604 320V704H742"/><path d="M604 512H714"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#ffffff" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><rect x="226" y="228" width="572" height="568" rx="84"/><path d="M304 704V320L516 704V320"/><path d="M604 320V704H742"/><path d="M604 512H714"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#1677ff" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><circle cx="512" cy="512" r="300"/><path d="M690 334L430 428C392 442 364 470 350 508L256 768C244 804 280 840 316 828L576 734C614 720 642 692 656 654L750 394C762 358 726 322 690 334Z"/><circle cx="512" cy="512" r="64"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#1677ff" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><circle cx="512" cy="512" r="300"/><path d="M690 334L430 428C392 442 364 470 350 508L256 768C244 804 280 840 316 828L576 734C614 720 642 692 656 654L750 394C762 358 726 322 690 334Z"/><circle cx="512" cy="512" r="64"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#1677ff" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><rect x="226" y="228" width="572" height="568" rx="84"/><path d="M304 704V320L516 704V320"/><path d="M604 320V704H742"/><path d="M604 512H714"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#1677ff" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><rect x="226" y="228" width="572" height="568" rx="84"/><path d="M304 704V320L516 704V320"/><path d="M604 320V704H742"/><path d="M604 512H714"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#3a3a3c" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><circle cx="512" cy="512" r="300"/><path d="M690 334L430 428C392 442 364 470 350 508L256 768C244 804 280 840 316 828L576 734C614 720 642 692 656 654L750 394C762 358 726 322 690 334Z"/><circle cx="512" cy="512" r="64"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#3a3a3c" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><circle cx="512" cy="512" r="300"/><path d="M690 334L430 428C392 442 364 470 350 508L256 768C244 804 280 840 316 828L576 734C614 720 642 692 656 654L750 394C762 358 726 322 690 334Z"/><circle cx="512" cy="512" r="64"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#3a3a3c" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><rect x="226" y="228" width="572" height="568" rx="84"/><path d="M304 704V320L516 704V320"/><path d="M604 320V704H742"/><path d="M604 512H714"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#3a3a3c" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><rect x="226" y="228" width="572" height="568" rx="84"/><path d="M304 704V320L516 704V320"/><path d="M604 320V704H742"/><path d="M604 512H714"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#475569" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><circle cx="512" cy="512" r="300"/><path d="M690 334L430 428C392 442 364 470 350 508L256 768C244 804 280 840 316 828L576 734C614 720 642 692 656 654L750 394C762 358 726 322 690 334Z"/><circle cx="512" cy="512" r="64"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#475569" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><circle cx="512" cy="512" r="300"/><path d="M690 334L430 428C392 442 364 470 350 508L256 768C244 804 280 840 316 828L576 734C614 720 642 692 656 654L750 394C762 358 726 322 690 334Z"/><circle cx="512" cy="512" r="64"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#475569" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><rect x="226" y="228" width="572" height="568" rx="84"/><path d="M304 704V320L516 704V320"/><path d="M604 320V704H742"/><path d="M604 512H714"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#475569" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><rect x="226" y="228" width="572" height="568" rx="84"/><path d="M304 704V320L516 704V320"/><path d="M604 320V704H742"/><path d="M604 512H714"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#dbe4f0" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><circle cx="512" cy="512" r="300"/><path d="M690 334L430 428C392 442 364 470 350 508L256 768C244 804 280 840 316 828L576 734C614 720 642 692 656 654L750 394C762 358 726 322 690 334Z"/><circle cx="512" cy="512" r="64"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#dbe4f0" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><circle cx="512" cy="512" r="300"/><path d="M690 334L430 428C392 442 364 470 350 508L256 768C244 804 280 840 316 828L576 734C614 720 642 692 656 654L750 394C762 358 726 322 690 334Z"/><circle cx="512" cy="512" r="64"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#dbe4f0" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><rect x="226" y="228" width="572" height="568" rx="84"/><path d="M304 704V320L516 704V320"/><path d="M604 320V704H742"/><path d="M604 512H714"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#dbe4f0" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><rect x="226" y="228" width="572" height="568" rx="84"/><path d="M304 704V320L516 704V320"/><path d="M604 320V704H742"/><path d="M604 512H714"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#344054" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><circle cx="512" cy="512" r="300"/><path d="M690 334L430 428C392 442 364 470 350 508L256 768C244 804 280 840 316 828L576 734C614 720 642 692 656 654L750 394C762 358 726 322 690 334Z"/><circle cx="512" cy="512" r="64"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#ffffff" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><circle cx="512" cy="512" r="300"/><path d="M690 334L430 428C392 442 364 470 350 508L256 768C244 804 280 840 316 828L576 734C614 720 642 692 656 654L750 394C762 358 726 322 690 334Z"/><circle cx="512" cy="512" r="64"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#344054" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><rect x="226" y="228" width="572" height="568" rx="84"/><path d="M304 704V320L516 704V320"/><path d="M604 320V704H742"/><path d="M604 512H714"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#ffffff" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><rect x="226" y="228" width="572" height="568" rx="84"/><path d="M304 704V320L516 704V320"/><path d="M604 320V704H742"/><path d="M604 512H714"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#7c3aed" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><circle cx="512" cy="512" r="300"/><path d="M690 334L430 428C392 442 364 470 350 508L256 768C244 804 280 840 316 828L576 734C614 720 642 692 656 654L750 394C762 358 726 322 690 334Z"/><circle cx="512" cy="512" r="64"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#7c3aed" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><circle cx="512" cy="512" r="300"/><path d="M690 334L430 428C392 442 364 470 350 508L256 768C244 804 280 840 316 828L576 734C614 720 642 692 656 654L750 394C762 358 726 322 690 334Z"/><circle cx="512" cy="512" r="64"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#7c3aed" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><rect x="226" y="228" width="572" height="568" rx="84"/><path d="M304 704V320L516 704V320"/><path d="M604 320V704H742"/><path d="M604 512H714"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#7c3aed" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><rect x="226" y="228" width="572" height="568" rx="84"/><path d="M304 704V320L516 704V320"/><path d="M604 320V704H742"/><path d="M604 512H714"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#57606a" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><circle cx="512" cy="512" r="300"/><path d="M690 334L430 428C392 442 364 470 350 508L256 768C244 804 280 840 316 828L576 734C614 720 642 692 656 654L750 394C762 358 726 322 690 334Z"/><circle cx="512" cy="512" r="64"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#57606a" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><circle cx="512" cy="512" r="300"/><path d="M690 334L430 428C392 442 364 470 350 508L256 768C244 804 280 840 316 828L576 734C614 720 642 692 656 654L750 394C762 358 726 322 690 334Z"/><circle cx="512" cy="512" r="64"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#57606a" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><rect x="226" y="228" width="572" height="568" rx="84"/><path d="M304 704V320L516 704V320"/><path d="M604 320V704H742"/><path d="M604 512H714"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><g fill="none" stroke="#57606a" stroke-width="64" stroke-linecap="round" stroke-linejoin="round" transform="translate(512 512) scale(0.84) translate(-512 -512)"><rect x="226" y="228" width="572" height="568" rx="84"/><path d="M304 704V320L516 704V320"/><path d="M604 320V704H742"/><path d="M604 512H714"/></g></svg>
@@ -1,71 +1,71 @@
1
1
  {
2
- "iconCount": 123,
2
+ "iconCount": 127,
3
3
  "themeCount": 13,
4
4
  "themes": [
5
5
  {
6
6
  "name": "default",
7
7
  "label": "Classic",
8
- "iconCount": 123
8
+ "iconCount": 127
9
9
  },
10
10
  {
11
11
  "name": "dark",
12
12
  "label": "Dark",
13
- "iconCount": 123
13
+ "iconCount": 127
14
14
  },
15
15
  {
16
16
  "name": "nature",
17
17
  "label": "Nature",
18
- "iconCount": 123
18
+ "iconCount": 127
19
19
  },
20
20
  {
21
21
  "name": "elegant",
22
22
  "label": "Elegant",
23
- "iconCount": 123
23
+ "iconCount": 127
24
24
  },
25
25
  {
26
26
  "name": "tech",
27
27
  "label": "Tech",
28
- "iconCount": 123
28
+ "iconCount": 127
29
29
  },
30
30
  {
31
31
  "name": "modern",
32
32
  "label": "Modern",
33
- "iconCount": 123
33
+ "iconCount": 127
34
34
  },
35
35
  {
36
36
  "name": "colorful",
37
37
  "label": "Colorful",
38
- "iconCount": 123
38
+ "iconCount": 127
39
39
  },
40
40
  {
41
41
  "name": "ant-blue",
42
42
  "label": "Ant Blue",
43
- "iconCount": 123
43
+ "iconCount": 127
44
44
  },
45
45
  {
46
46
  "name": "material",
47
47
  "label": "Material",
48
- "iconCount": 123
48
+ "iconCount": 127
49
49
  },
50
50
  {
51
51
  "name": "tailwind",
52
52
  "label": "Tailwind",
53
- "iconCount": 123
53
+ "iconCount": 127
54
54
  },
55
55
  {
56
56
  "name": "github",
57
57
  "label": "GitHub",
58
- "iconCount": 123
58
+ "iconCount": 127
59
59
  },
60
60
  {
61
61
  "name": "vscode",
62
62
  "label": "VS Code",
63
- "iconCount": 123
63
+ "iconCount": 127
64
64
  },
65
65
  {
66
66
  "name": "apple",
67
67
  "label": "Apple",
68
- "iconCount": 123
68
+ "iconCount": 127
69
69
  }
70
70
  ],
71
71
  "overview": "icon-theme-overview.svg",
@@ -166,6 +166,14 @@
166
166
  "name": "delay",
167
167
  "semantic": "action"
168
168
  },
169
+ {
170
+ "name": "discovery-dark",
171
+ "semantic": "common"
172
+ },
173
+ {
174
+ "name": "discovery",
175
+ "semantic": "common"
176
+ },
169
177
  {
170
178
  "name": "document",
171
179
  "semantic": "file"
@@ -410,6 +418,14 @@
410
418
  "name": "mysql_cdc",
411
419
  "semantic": "common"
412
420
  },
421
+ {
422
+ "name": "nacos-dark",
423
+ "semantic": "common"
424
+ },
425
+ {
426
+ "name": "nacos",
427
+ "semantic": "common"
428
+ },
413
429
  {
414
430
  "name": "nats",
415
431
  "semantic": "mq"