@huanban/rulego-editor-core 1.1.1 → 1.1.2
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/LICENSE +190 -0
- package/dist/api/AIManager.d.ts +12 -0
- package/dist/api/ApiProvider.d.ts +83 -0
- package/dist/api/DebugSocketClient.d.ts +39 -0
- package/dist/api/RuleChainAPI.d.ts +5 -1
- package/dist/api/StreamParser.d.ts +13 -0
- package/dist/api/index.d.ts +5 -1
- package/dist/api/response-utils.d.ts +28 -0
- package/dist/api/types.d.ts +67 -0
- package/dist/core/AutoLayout.d.ts +1 -1
- package/dist/core/ComponentRegistry.d.ts +11 -1
- package/dist/core/EditorCore.d.ts +23 -1
- package/dist/core/I18nManager.d.ts +18 -0
- package/dist/core/Optimizations.d.ts +16 -0
- package/dist/core/RuleChainChatManager.d.ts +53 -0
- package/dist/core/component-payload.d.ts +12 -0
- package/dist/core/index.d.ts +4 -2
- package/dist/core/runtime-limits.d.ts +35 -0
- package/dist/defaults/components.d.ts +4 -23
- package/dist/defaults/official-component-fallbacks.d.ts +12 -0
- package/dist/extensions/ClipboardExtension.d.ts +28 -0
- package/dist/extensions/KeyboardExtension.d.ts +18 -0
- package/dist/extensions/MenuExtension.d.ts +29 -0
- package/dist/iconRegistry.d.ts +2 -2
- package/dist/index.cjs.js +5739 -922
- package/dist/index.d.ts +11 -6
- package/dist/index.esm.js +74892 -43118
- package/dist/index.umd.js +5739 -922
- package/dist/models/BaseNodeModel.d.ts +38 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/nodes/AgentOrchestrationNode.d.ts +41 -0
- package/dist/nodes/GroupNode.d.ts +50 -0
- package/dist/nodes/HeadlessHtmlNode.d.ts +20 -0
- package/dist/nodes/SwitchNode.d.ts +27 -0
- package/dist/nodes/UnknownNodeModel.d.ts +24 -0
- package/dist/standalone/HuanbanRulegoEditor.d.ts +122 -12
- package/dist/standalone/ai-providers.d.ts +7 -0
- package/dist/standalone/auth-fetch.d.ts +6 -1
- package/dist/standalone/code-editor.d.ts +40 -4
- package/dist/standalone/custom-nodes.d.ts +4 -1
- package/dist/standalone/editor-context-menu.d.ts +3 -2
- package/dist/standalone/editor-debug-ws.d.ts +26 -6
- package/dist/standalone/editor-delete.d.ts +4 -0
- package/dist/standalone/editor-dialogs.d.ts +27 -4
- package/dist/standalone/editor-events.d.ts +2 -1
- package/dist/standalone/editor-property-drawers.d.ts +30 -2
- package/dist/standalone/editor-route-settings.d.ts +49 -0
- package/dist/standalone/editor-sidebar.d.ts +11 -0
- package/dist/standalone/editor-toast.d.ts +2 -0
- package/dist/standalone/editor-toolbar.d.ts +13 -1
- package/dist/standalone/group-node.d.ts +9 -1
- package/dist/standalone/index.d.ts +4 -2
- package/dist/standalone/layout-scheduler.d.ts +16 -0
- package/dist/standalone/lifecycle.d.ts +15 -0
- package/dist/standalone/models-dev-catalog.d.ts +53 -0
- package/dist/standalone/node-definitions.d.ts +25 -7
- package/dist/standalone/official-node-view-patches.d.ts +15 -0
- package/dist/standalone/security-utils.d.ts +45 -0
- package/dist/test/setup-dom.d.ts +3 -0
- package/dist/types/component.d.ts +10 -1
- package/dist/types/editor.d.ts +48 -2
- package/dist/types/events.d.ts +14 -0
- package/dist/types/rule-chain.d.ts +1 -1
- package/dist/utils/GraphUtils.d.ts +24 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/relation-utils.d.ts +13 -0
- package/dist/utils/textUtils.d.ts +13 -0
- package/package.json +15 -13
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ComponentDefinition } from '../types/component';
|
|
2
|
+
/**
|
|
3
|
+
* Normalize common RuleGo /api/v1/components payload wrappers without losing
|
|
4
|
+
* builtin metadata such as builtins and skillPath.
|
|
5
|
+
*/
|
|
6
|
+
export declare function normalizeComponentsRawPayload(data: unknown): unknown;
|
|
7
|
+
/**
|
|
8
|
+
* Flatten official segmented component payloads into the component list used by
|
|
9
|
+
* the registry and sidebar. Legacy arrays are returned unchanged.
|
|
10
|
+
*/
|
|
11
|
+
export declare function normalizeComponentsPayload(data: unknown): ComponentDefinition[];
|
|
12
|
+
//# sourceMappingURL=component-payload.d.ts.map
|
package/dist/core/index.d.ts
CHANGED
|
@@ -18,17 +18,19 @@ export { EventBus } from './EventBus';
|
|
|
18
18
|
export { DataAdapter } from './DataAdapter';
|
|
19
19
|
export type { LFNodeData, LFEdgeData, LFGraphData, LFPoint } from './DataAdapter';
|
|
20
20
|
export { ComponentRegistry } from './ComponentRegistry';
|
|
21
|
+
export { normalizeComponentsPayload, normalizeComponentsRawPayload, } from './component-payload';
|
|
21
22
|
export { HistoryManager, BatchCommand } from './HistoryManager';
|
|
22
23
|
export type { Command } from './HistoryManager';
|
|
23
24
|
export { ValidationEngine } from './ValidationEngine';
|
|
24
25
|
export type { ValidationError, ValidationResult, ValidationRule, ValidationContext, } from './ValidationEngine';
|
|
25
26
|
export { ThemeManager, THEME_LIGHT, THEME_DARK, THEME_BLUE } from './ThemeManager';
|
|
26
27
|
export type { ThemeVariables, ThemeDefinition } from './ThemeManager';
|
|
27
|
-
export { I18nManager } from './I18nManager';
|
|
28
|
-
export type { LocaleMessages } from './I18nManager';
|
|
28
|
+
export { I18nManager, i18nText } from './I18nManager';
|
|
29
|
+
export type { LocaleMessages, TranslationSource } from './I18nManager';
|
|
29
30
|
export { EditorCore } from './EditorCore';
|
|
30
31
|
export { autoLayout, needsAutoLayout } from './AutoLayout';
|
|
31
32
|
export type { AutoLayoutOptions } from './AutoLayout';
|
|
32
33
|
export { RuleChainValidator } from './RuleChainValidator';
|
|
33
34
|
export type { ValidationIssue, ValidationResult as RuleChainValidationResult, IssueSeverity, } from './RuleChainValidator';
|
|
35
|
+
export { RUNTIME_LIMITS, RuntimeLimitError, assertGraphWithinLimits, assertComponentsWithinLimits, assertTextWithinBytes, truncateText, assertObjectDepth, } from './runtime-limits';
|
|
34
36
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file core/runtime-limits.ts
|
|
3
|
+
* @description Shared size limits to keep imports, rendering, layout, debug, and storage bounded.
|
|
4
|
+
*/
|
|
5
|
+
export declare const RUNTIME_LIMITS: {
|
|
6
|
+
readonly maxImportBytes: number;
|
|
7
|
+
readonly maxGraphNodes: 1000;
|
|
8
|
+
readonly maxGraphEdges: 3000;
|
|
9
|
+
readonly maxComponents: 1000;
|
|
10
|
+
readonly maxFieldsPerNode: 200;
|
|
11
|
+
readonly maxDebugItems: 500;
|
|
12
|
+
readonly maxDebugItemChars: 20000;
|
|
13
|
+
readonly maxExampleEventLogLines: 80;
|
|
14
|
+
readonly maxJsonPrettyChars: 200000;
|
|
15
|
+
readonly maxChatChains: 20;
|
|
16
|
+
readonly maxChatMessagesPerChain: 50;
|
|
17
|
+
readonly maxChatMessageChars: 2000;
|
|
18
|
+
readonly maxChatReasoningChars: 50000;
|
|
19
|
+
readonly maxChatToolArgumentChars: 20000;
|
|
20
|
+
readonly maxRecentToolCallGroups: 5;
|
|
21
|
+
readonly maxObjectDepth: 8;
|
|
22
|
+
};
|
|
23
|
+
export declare class RuntimeLimitError extends Error {
|
|
24
|
+
code: string;
|
|
25
|
+
constructor(code: string, message: string);
|
|
26
|
+
}
|
|
27
|
+
export declare function assertGraphWithinLimits(graph: {
|
|
28
|
+
nodes?: unknown[];
|
|
29
|
+
edges?: unknown[];
|
|
30
|
+
}, stage: 'import' | 'render' | 'save' | 'layout' | 'validate'): void;
|
|
31
|
+
export declare function assertComponentsWithinLimits(components: unknown[]): void;
|
|
32
|
+
export declare function assertTextWithinBytes(text: string, maxBytes: number, label: string): void;
|
|
33
|
+
export declare function truncateText(value: unknown, maxChars: number): string;
|
|
34
|
+
export declare function assertObjectDepth(value: unknown, maxDepth: number, label: string): void;
|
|
35
|
+
//# sourceMappingURL=runtime-limits.d.ts.map
|
|
@@ -1,30 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file defaults/components.ts
|
|
3
|
-
* @description
|
|
3
|
+
* @description 官方 RuleGo 默认组件定义。
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* - transform: 转换器 (jsTransform)
|
|
8
|
-
* - action: 动作 (log, delay, restApiCall, sendMail, mqttClient,
|
|
9
|
-
* dbClient, ssh, for, groupAction, delay)
|
|
10
|
-
* - external: 外部集成 (restApiCall, mqttClient, dbClient 等)
|
|
11
|
-
* - flow: 流程控制 (flow/子规则链)
|
|
12
|
-
*
|
|
13
|
-
* @see 原版: src/components/utils/default.js
|
|
5
|
+
* 该文件由参考项目 src/components/utils/default.js 机械同步,保持内置组件列表
|
|
6
|
+
* 与官方默认节点协议一致。真实运行时仍优先使用 /api/v1/components 返回的后端组件定义。
|
|
14
7
|
*/
|
|
15
8
|
import type { ComponentDefinition } from '../types/component';
|
|
16
|
-
/**
|
|
17
|
-
* RuleGo 默认内置组件列表
|
|
18
|
-
*
|
|
19
|
-
* 这些组件对应 RuleGo 后端支持的标准节点类型。
|
|
20
|
-
* 每个组件包含:
|
|
21
|
-
* - type: 节点类型标识
|
|
22
|
-
* - category: 所属分类
|
|
23
|
-
* - fields: 配置表单字段
|
|
24
|
-
* - label: 显示名称
|
|
25
|
-
* - desc: 描述
|
|
26
|
-
* - icon: 图标
|
|
27
|
-
* - relationTypes: 允许的关系类型
|
|
28
|
-
*/
|
|
9
|
+
/** 官方默认内置组件列表: endpoints + nodes */
|
|
29
10
|
export declare const defaultComponents: ComponentDefinition[];
|
|
30
11
|
//# sourceMappingURL=components.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Official component fallbacks that exist in the upstream locale/view protocol
|
|
3
|
+
* but are not always returned by older /api/v1/components backends.
|
|
4
|
+
*
|
|
5
|
+
* These entries are appended only when a backend/default component list does not
|
|
6
|
+
* already contain the type, so live backend definitions remain authoritative.
|
|
7
|
+
*/
|
|
8
|
+
import type { ComponentDefinition } from '../types/component';
|
|
9
|
+
export declare const OFFICIAL_COMPONENT_FALLBACK_TYPES: readonly ["endpoint/beanstalkdTubeset", "iterator", "ci/exec", "x/beanstalkdTube", "x/beanstalkdWorker", "ai/transform/documentLoader", "ai/transform/textChunker", "ai/embedding/openai", "ai/indexer/milvus", "ai/indexer/redis", "ai/retriever/milvus", "ai/retriever/redis"];
|
|
10
|
+
export declare function createOfficialComponentFallback(type: string): ComponentDefinition | null;
|
|
11
|
+
export declare function appendOfficialComponentFallbacks<T extends ComponentDefinition>(components: T[]): ComponentDefinition[];
|
|
12
|
+
//# sourceMappingURL=official-component-fallbacks.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file ClipboardExtension.ts
|
|
3
|
+
* @description 画布剪贴板拦截与 ID 净化增强
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 画布剪贴板扩展插件 (RuleGoClipboard)
|
|
7
|
+
*
|
|
8
|
+
* @class RuleGoClipboard
|
|
9
|
+
* @description 拦截 LogicFlow 原生的复制粘贴行为。
|
|
10
|
+
* 官方原生 LogicFlow 在复制时,直接使用内置的数据模型进行全量克隆。
|
|
11
|
+
* 在我们的业务场景下,复制一个包含算子的 Group (编排子组) 时,其内部节点的 `groupId` 与新组的 ID 会发生断裂。
|
|
12
|
+
* 该插件的职责是作为中间件,拦截粘贴流,并自动向所有被粘贴的节点派发新的唯一序列化 ID(基于 getNodeSeq)。
|
|
13
|
+
*/
|
|
14
|
+
export declare class RuleGoClipboard {
|
|
15
|
+
/** 暴露给 LogicFlow 的插件识别名 */
|
|
16
|
+
static pluginName: string;
|
|
17
|
+
/**
|
|
18
|
+
* 构造函数
|
|
19
|
+
* @param options 注入的上下文参数,包含 eventCenter 等
|
|
20
|
+
*/
|
|
21
|
+
constructor(_options: any);
|
|
22
|
+
/**
|
|
23
|
+
* 插件装载时的生命周期钩子
|
|
24
|
+
* @param lf LogicFlow 实例对象
|
|
25
|
+
*/
|
|
26
|
+
install(lf: any): void;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=ClipboardExtension.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file KeyboardExtension.ts
|
|
3
|
+
* @description 全局快捷键注册机制
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 全局快捷键注册器
|
|
7
|
+
*
|
|
8
|
+
* @function registerKeyboard
|
|
9
|
+
* @description 将原生的键盘按键事件转化为框架内的通用语义事件。
|
|
10
|
+
* 由于我们在外部使用的是 Vue 或 React,不能直接依赖原生事件绑定。
|
|
11
|
+
* 此注册器剥离了 LogicFlow 与浏览器的耦合,拦截常见快捷键。
|
|
12
|
+
*
|
|
13
|
+
* @param {any} lf - LogicFlow 实例对象,必须开启 keyboard 插件
|
|
14
|
+
* @param {any} eventCenter - 全局事件总线,负责向外透传 ui 级别的交互事件
|
|
15
|
+
* @returns {void} 无返回值
|
|
16
|
+
*/
|
|
17
|
+
export declare const registerKeyboard: (lf: any, eventCenter: any) => void;
|
|
18
|
+
//# sourceMappingURL=KeyboardExtension.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file MenuExtension.ts
|
|
3
|
+
* @description 无头右键菜单 (Headless Context Menu) 抛出器
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 无头右键菜单扩展插件 (RuleGoMenu)
|
|
7
|
+
*
|
|
8
|
+
* @class RuleGoMenu
|
|
9
|
+
* @description 传统基于 DOM 的插件在画布移动和缩放时,往往存在严重的错位和 DOM 节点堆积问题。
|
|
10
|
+
* 本插件实施“无头化 (Headless)”策略:
|
|
11
|
+
* 阻止默认事件发生,计算出画布内元素的精确屏幕绝对坐标 (e.clientX, e.clientY),
|
|
12
|
+
* 并携带目标业务数据 (node/edge) 向外层 UI 框架广播。
|
|
13
|
+
*/
|
|
14
|
+
export declare class RuleGoMenu {
|
|
15
|
+
private options;
|
|
16
|
+
/** 暴露给 LogicFlow 的插件识别名 */
|
|
17
|
+
static pluginName: string;
|
|
18
|
+
/**
|
|
19
|
+
* 构造函数
|
|
20
|
+
* @param options 注入的上下文参数,包含 eventCenter 等
|
|
21
|
+
*/
|
|
22
|
+
constructor(options: any);
|
|
23
|
+
/**
|
|
24
|
+
* 插件装载时的生命周期钩子
|
|
25
|
+
* @param lf LogicFlow 实例对象
|
|
26
|
+
*/
|
|
27
|
+
install(lf: any): void;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=MenuExtension.d.ts.map
|
package/dist/iconRegistry.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 自动生成的图标注册表 — 所有 SVG 图标以 data URL 形式内联
|
|
3
|
-
*
|
|
4
|
-
* 图标数量:
|
|
3
|
+
* 来源: packages/editor-core/src/icons
|
|
4
|
+
* 图标数量: 123
|
|
5
5
|
*
|
|
6
6
|
* 用法: import { ICON_REGISTRY } from './iconRegistry'
|
|
7
7
|
* const url = ICON_REGISTRY['delay'] // => data:image/svg+xml;base64,...
|