@digitalsee-ai/rcs 2.0.4-alpha → 2.0.4-beta10

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 (40) hide show
  1. package/dist/components/digitalsee/workflow/Canvas/hooks/useWorkflowCanvasState.d.ts +3 -3
  2. package/dist/components/digitalsee/workflow/Edges/EdgeFactory.d.ts +7 -5
  3. package/dist/components/digitalsee/workflow/Nodes/classicPortLayout.d.ts +2 -0
  4. package/dist/components/digitalsee/workflow/NodesConfig/components/FormFieldRenderer/fields/TextField/index.d.ts +1 -0
  5. package/dist/components/digitalsee/workflow/api/dip.types.d.ts +2 -1
  6. package/dist/components/digitalsee/workflow/api/index.d.ts +5 -1
  7. package/dist/components/digitalsee/workflow/context/canvasConfig.d.ts +6 -0
  8. package/dist/components/digitalsee/workflow/enums/node.d.ts +1 -0
  9. package/dist/components/digitalsee/workflow/hooks/use-nodes-interaction.d.ts +16 -3
  10. package/dist/components/digitalsee/workflow/types/engine.d.ts +2 -0
  11. package/dist/components/digitalsee/workflow/utils/common.d.ts +4 -0
  12. package/dist/components/digitalsee/workflow/utils/connectionCheck.d.ts +5 -3
  13. package/dist/components/digitalsee/workflow/utils/flowDataAdapter.d.ts +1 -1
  14. package/dist/components/digitalsee/workflow/utils/nodePackageConnection.d.ts +6 -1
  15. package/dist/components/digitalsee/workflow/utils/portConnectionValidator.d.ts +22 -0
  16. package/dist/components/dynamic-form/components/ValueModeWrapper/index.d.ts +2 -0
  17. package/dist/components/dynamic-form/fields/special/GlobalVariableKeyField.d.ts +3 -0
  18. package/dist/components/dynamic-form/fields/special/index.d.ts +1 -0
  19. package/dist/components/dynamic-form/types/field-component.d.ts +2 -0
  20. package/dist/components/dynamic-form/types/form-schema.d.ts +8 -1
  21. package/dist/index-BUi2LZJB.mjs +81657 -0
  22. package/dist/{index-Cx8t3uUz.mjs → index-D4qXUcQz.mjs} +73 -69
  23. package/dist/locales/RcsIntlProvider.d.ts +20 -0
  24. package/dist/locales/en-US/common.d.ts +7 -0
  25. package/dist/locales/en-US/link/flow.d.ts +2 -0
  26. package/dist/locales/en-US.d.ts +9 -0
  27. package/dist/locales/index.d.ts +4 -0
  28. package/dist/locales/zh-CN/common.d.ts +7 -0
  29. package/dist/locales/zh-CN/link/flow.d.ts +2 -0
  30. package/dist/locales/zh-CN.d.ts +9 -0
  31. package/dist/locales/zh-TW/common.d.ts +7 -0
  32. package/dist/locales/zh-TW/link/flow.d.ts +2 -0
  33. package/dist/locales/zh-TW.d.ts +9 -0
  34. package/dist/rcs.css +1 -1
  35. package/dist/rcs.es.js +1 -1
  36. package/dist/rcs.umd.js +103 -82
  37. package/package.json +6 -5
  38. package/dist/components/digitalsee/workflow/coverage/acceptanceManifest.d.ts +0 -30
  39. package/dist/components/digitalsee/workflow/coverage/runtimeCoverage.d.ts +0 -34
  40. package/dist/index-CrFbT2mm.mjs +0 -71424
@@ -2,7 +2,7 @@ import { WorkflowCanvasProps } from '../constants';
2
2
  import { SaveStatus } from '../../enums/workflow';
3
3
  import { useEdgesInteraction } from '../../hooks/use-edges-interaction';
4
4
  import { useFlowDataOperation } from '../../hooks/use-flow-data-operation';
5
- import { useNodesInteraction } from '../../hooks/use-nodes-interaction';
5
+ import { useNodeHoverHandlers } from '../../hooks/use-nodes-interaction';
6
6
  import { usePanel } from '../../hooks/usePanel';
7
7
  import { useWorkflow } from '../../hooks/useWorkflow';
8
8
  import { useAppDispatch } from '../../store';
@@ -63,8 +63,8 @@ export interface WorkflowCanvasStateResult {
63
63
  handleTidy: () => void;
64
64
  onEdgeMouseEnter: ReturnType<typeof useEdgesInteraction>['onEdgeMouseEnter'];
65
65
  onEdgeMouseLeave: ReturnType<typeof useEdgesInteraction>['onEdgeMouseLeave'];
66
- onNodeMouseEnter: ReturnType<typeof useNodesInteraction>['onNodeMouseEnter'];
67
- onNodeMouseLeave: ReturnType<typeof useNodesInteraction>['onNodeMouseLeave'];
66
+ onNodeMouseEnter: ReturnType<typeof useNodeHoverHandlers>['onNodeMouseEnter'];
67
+ onNodeMouseLeave: ReturnType<typeof useNodeHoverHandlers>['onNodeMouseLeave'];
68
68
  onNodeContextMenu: (event: React.MouseEvent, node: Node) => void;
69
69
  onPaneContextMenu: (event: React.MouseEvent) => void;
70
70
  updateSaveStatus: (status: SaveStatus, error?: Error) => void;
@@ -1,9 +1,11 @@
1
1
  import { EdgeType } from '../enums/edge';
2
2
  import { EdgeData } from '../types/Edge';
3
- import { Edge } from '@xyflow/react';
4
- interface EdgeCreationOptions {
3
+ import { Edge, Node } from '@xyflow/react';
4
+ export interface EdgeCreationOptions {
5
5
  sourceHandle?: string;
6
6
  targetHandle?: string;
7
+ sourceNode?: Node | null;
8
+ targetNode?: Node | null;
7
9
  data?: EdgeData;
8
10
  onAddNode?: (position: {
9
11
  x: number;
@@ -27,12 +29,12 @@ declare class EdgeFactory {
27
29
  static getEdgeComponent(type: EdgeType): import('react').FC<import('./BaseEdge').CustomEdgeProps>;
28
30
  /**
29
31
  * 创建一个连线实例
30
- * @param type 连线类型
32
+ * @param type 连线类型(若不提供或为 MAIN,则仅当 source/target 为 NodePackage 节点时取其 handle 对应类型,否则为 MAIN)
31
33
  * @param id 连线ID
32
34
  * @param source 源节点ID
33
35
  * @param target 目标节点ID
34
- * @param options 可选参数,包括sourceHandle, targetHandle, data和回调函数
36
+ * @param options 可选参数,包括sourceHandle, targetHandle, sourceNode, targetNode, data和回调函数
35
37
  */
36
- static createEdge(type: EdgeType | string, id: string, source: string, target: string, options?: EdgeCreationOptions): Edge;
38
+ static createEdge(type: EdgeType | string | undefined | null, id: string, source: string, target: string, options?: EdgeCreationOptions): Edge;
37
39
  }
38
40
  export default EdgeFactory;
@@ -23,6 +23,8 @@ export interface NodePortSchema extends Omit<DipPortSchema, 'protocol'> {
23
23
  style?: React.CSSProperties;
24
24
  /** isMain 覆盖;缺省 name === 'main' */
25
25
  isMain?: boolean;
26
+ /** 针对某种支持多种协议的情况 */
27
+ protocols?: string[];
26
28
  }
27
29
  /** (type, protocol) 维度的端口覆盖声明;省略一侧即继承 type 级默认。 */
28
30
  export interface NodePortsDeclaration {
@@ -15,6 +15,7 @@ interface TextFieldProps extends IFieldSuperProps {
15
15
  lang?: CodeEditorLanguage;
16
16
  onFocus?: () => void;
17
17
  onBlur?: () => void;
18
+ required?: boolean;
18
19
  }
19
20
  export declare const TextField: (props: TextFieldProps) => import("react/jsx-runtime").JSX.Element;
20
21
  export {};
@@ -303,11 +303,12 @@ export interface DipWorkflowDefinition {
303
303
  * | `DATETIME` | 日期时间 | DatePicker |
304
304
  * | `CODE` | 代码/JSON 文本 | 工作流代码编辑器 |
305
305
  * | `PROXY` | 代理网关 | 工作流代理网关选择器 |
306
+ * | `GLOBAL_VARIABLE_KEY` | 全局变量键 | 工作流全局变量选择器 |
306
307
  * | `OBJECT` | 嵌套对象 | 递归渲染子字段 |
307
308
  * | `ARRAY` / `DYNAMIC_ARRAY` | 数组/列表 | 动态增减表单项 |
308
309
  * | `KEYVALUE` | 键值对列表 | Key-Value 编辑器 |
309
310
  */
310
- export type DipFieldType = 'STRING' | 'TEXTAREA' | 'PASSWORD' | 'HIDDEN' | 'NUMBER' | 'BOOLEAN' | 'SELECT' | 'DATETIME' | 'CODE' | 'PROXY' | 'OBJECT' | 'ARRAY' | 'DYNAMIC_ARRAY' | 'KEYVALUE';
311
+ export type DipFieldType = 'STRING' | 'TEXTAREA' | 'PASSWORD' | 'HIDDEN' | 'NUMBER' | 'BOOLEAN' | 'SELECT' | 'DATETIME' | 'CODE' | 'PROXY' | 'GLOBAL_VARIABLE_KEY' | 'OBJECT' | 'ARRAY' | 'DYNAMIC_ARRAY' | 'KEYVALUE';
311
312
  /**
312
313
  * 数组元素类型
313
314
  *
@@ -168,7 +168,11 @@ export interface FlowOutputTreeRequest {
168
168
  edges?: any[];
169
169
  }
170
170
  export declare function apiGetFlowOutputTree(flowId: string, data: FlowOutputTreeRequest): Promise<any>;
171
- export declare function apiGetGlobalVariables(): Promise<any>;
171
+ export interface GlobalVariablesQuery {
172
+ /** 传 1 时仅返回允许流程更新的全局变量 */
173
+ allowFlowUpdate?: 0 | 1;
174
+ }
175
+ export declare function apiGetGlobalVariables(query?: GlobalVariablesQuery): Promise<any>;
172
176
  /**
173
177
  * Fetches the account model for a credential schema key.
174
178
  *
@@ -1,3 +1,9 @@
1
1
  import { CanvasEngineConfig } from '../types/engine';
2
+ /**
3
+ * 判断当前是否处于工作流画布内(画布入口同时挂载 redux、CanvasConfig、ReactFlow 三个 Provider)。
4
+ *
5
+ * 仅用于区分「画布内组件」与「独立使用的表单组件」;业务组件取配置请用 useCanvasConfig。
6
+ */
7
+ export declare const useHasCanvasConfig: () => boolean;
2
8
  export declare const useCanvasConfig: () => CanvasEngineConfig;
3
9
  export declare const CanvasConfigProvider: import('react').Provider<CanvasEngineConfig>;
@@ -113,6 +113,7 @@ export declare enum NodeProtocol {
113
113
  AI_TEXT_SPLITTER = "AI_TEXTSPLITTER",
114
114
  AI_EMBEDDING = "AI_EMBEDDING",
115
115
  AI_TOOL = "AI_TOOL",
116
+ KNOWLEDGE = "KNOWLEDGE",
116
117
  MCP = "MCP",
117
118
  BUILTIN_MCP = "BUILTIN_MCP",
118
119
  MCP_SERVER = "MCP_SERVER"
@@ -1,8 +1,21 @@
1
1
  import { NodeType } from '../types/Node';
2
- import { NodeMouseHandler, OnNodesChange } from '@xyflow/react';
3
- export declare const useNodesInteraction: () => {
2
+ import { Node, NodeMouseHandler } from '@xyflow/react';
3
+ /** 受控画布 setNodes 的函数式签名(hover 只用函数式更新,保证不读到滞后快照)。 */
4
+ type SetNodesFn = (updater: (nodes: Node[]) => Node[]) => void;
5
+ type NodeHoverHandlersOptions = {
6
+ /**
7
+ * 受控画布的 React state 写入器(useNodesState 的 setNodes)。
8
+ * hover 等改动必须写受控 state:直写 RF store 会被 StoreUpdater 在下一次
9
+ * 同步时覆盖,且与 store 快照互写会放大选中态的代际差(双选中 bug 根因之一)。
10
+ */
11
+ setNodes: SetNodesFn;
12
+ };
13
+ /** 节点 hover 高亮:写受控 React state,不直写 RF store。 */
14
+ export declare const useNodeHoverHandlers: ({ setNodes }: NodeHoverHandlersOptions) => {
4
15
  onNodeMouseEnter: NodeMouseHandler;
5
16
  onNodeMouseLeave: NodeMouseHandler;
6
- handleNodesChange: OnNodesChange;
17
+ };
18
+ export declare const useNodesInteraction: () => {
7
19
  handleNodesDelete: (nodeIds: string[], nodeType: NodeType) => void;
8
20
  };
21
+ export {};
@@ -252,6 +252,8 @@ export interface CanvasAPI {
252
252
  getNode(id: string): NodeConfig | null;
253
253
  selectNode(id: string): void;
254
254
  clearSelection(): void;
255
+ /** 清除单个节点的选中/悬停高亮(写受控 state,避免直写 RF store 被 StoreUpdater 覆盖)。 */
256
+ clearNodeHighlight(id: string): void;
255
257
  moveNode(id: string, pos: {
256
258
  x: number;
257
259
  y: number;
@@ -85,4 +85,8 @@ export declare function base64ToString(base64Str: string): string;
85
85
  * ```
86
86
  */
87
87
  export declare function isValidBase64(str: string): boolean;
88
+ /**
89
+ * 模块级翻译函数:调用时动态读取全局 locale(由 DigitalseeWorkFlow 依据宿主传入的 locale 同步),
90
+ * 适用于工具函数、事件回调等非 React 上下文;渲染路径中的文案建议用 useIntl()/FormattedMessage(响应式)。
91
+ */
88
92
  export declare const t: import('../../../../locales').TranslateFn;
@@ -1,8 +1,9 @@
1
+ import { PortNodeKeyAccessCode } from './portConnectionValidator';
1
2
  import { Node } from '@xyflow/react';
2
3
  /**
3
- * 统一连线检查的结果码,命名对齐 portConnectionValidator 的 code 风格。
4
+ * 统一连线检查的结果码,端口黑白名单部分复用 PortNodeKeyAccessCode。
4
5
  */
5
- export type ConnectionCheckCode = 'VALID' | 'SOURCE_NODE_NOT_FOUND' | 'TARGET_NODE_NOT_FOUND' | 'SOURCE_PORT_NOT_FOUND' | 'TARGET_PORT_NOT_FOUND' | 'PROTOCOL_MISMATCH' | 'SELF_CONNECTION_NOT_ALLOWED';
6
+ export type ConnectionCheckCode = 'VALID' | 'SOURCE_NODE_NOT_FOUND' | 'TARGET_NODE_NOT_FOUND' | 'SOURCE_PORT_NOT_FOUND' | 'TARGET_PORT_NOT_FOUND' | 'PROTOCOL_MISMATCH' | 'SELF_CONNECTION_NOT_ALLOWED' | PortNodeKeyAccessCode;
6
7
  export interface ConnectionCheckResult {
7
8
  valid: boolean;
8
9
  code: ConnectionCheckCode;
@@ -22,7 +23,8 @@ export interface ConnectionCheckConnection {
22
23
  * 范围(与手动拖线今天的实际行为一致,再叠自连规则门):
23
24
  * 1. 节点存在性;
24
25
  * 2. 协议一致性(大小写不敏感;双侧均无法解析协议时放行,保留旧 `?? ''` 行为);
25
- * 3. 自连(source === target)必须命中节点声明的 auto_connect 规则。
26
+ * 3. 自连(source === target)必须命中节点声明的 auto_connect 规则;
27
+ * 4. NodePackage schema.input / schema.output 的 node key 黑白名单(放在最后验证)。
26
28
  *
27
29
  * workflowConnectionValidator 的重链(edgeRules / connectable / native 校验)
28
30
  * 有意不在本检查内,仍由各自的既有入口负责。
@@ -51,7 +51,7 @@ export declare function convertNodesToReactFlowFormat(backendNodes: BackendNode[
51
51
  /**
52
52
  * 将后端连接数据转换为前端可用的边数据
53
53
  */
54
- export declare function convertConnectionsToReactFlowEdges(connections: BackendConnection): Edge[];
54
+ export declare function convertConnectionsToReactFlowEdges(connections: BackendConnection, nodes?: Node[]): Edge[];
55
55
  /**
56
56
  * 将后端响应数据转换为前端工作流数据
57
57
  */
@@ -1,5 +1,5 @@
1
1
  import { DipNodeSchema } from '../api/dip';
2
- import { PortConnectionEdge, PortConnectionValidationCode } from './portConnectionValidator';
2
+ import { NormalizedDipPortSchema, PortConnectionEdge, PortConnectionValidationCode } from './portConnectionValidator';
3
3
  import { Node } from '@xyflow/react';
4
4
  export type NodePackageConnectionCode = PortConnectionValidationCode | 'NOT_APPLICABLE' | 'SCHEMA_NOT_READY';
5
5
  export interface NodePackageConnectionResult {
@@ -19,6 +19,11 @@ export interface ValidateNodePackageConnectionInput {
19
19
  /** 同步解析已预加载的 NodePackage Schema。 */
20
20
  export declare function resolveNodePackageSchema(node?: Node | null): DipNodeSchema | null;
21
21
  export declare function isNodePackageConnectionNode(node?: Node | null): boolean;
22
+ /**
23
+ * 读取 NodePackage 节点 schema 指定方向的端口定义(schema.inputs / schema.outputs)。
24
+ * 非 NodePackage 节点、Schema 未预热或端口未声明时返回 null,视为无黑白名单约束。
25
+ */
26
+ export declare function findNodePackagePort(node: Node | undefined, handle: string | null | undefined, side: 'inputs' | 'outputs'): NormalizedDipPortSchema | null;
22
27
  /**
23
28
  * 校验两个 NodePackage 节点之间的端口连接。
24
29
  *
@@ -57,6 +57,28 @@ export interface PortConnectionValidationResult {
57
57
  export declare const normalizePortSchema: (port: DipPortSchema) => NormalizedDipPortSchema;
58
58
  /** 从 ReactFlow 节点 data 中解析用于黑白名单判断的 NodePackage schema key。 */
59
59
  export declare const getPortConnectionNodeIdentity: (node?: PortConnectionNode | null) => string | null;
60
+ /** 端口 node key 黑白名单校验失败的返回码。 */
61
+ export type PortNodeKeyAccessCode = 'SOURCE_NODE_DENIED' | 'TARGET_NODE_DENIED' | 'SOURCE_NODE_NOT_ALLOWED' | 'TARGET_NODE_NOT_ALLOWED';
62
+ export interface PortNodeKeyAccessViolation {
63
+ code: PortNodeKeyAccessCode;
64
+ /** 中文兜底原因,便于 console 调试。 */
65
+ reason: string;
66
+ }
67
+ /** 黑白名单校验的单侧输入:本侧端口 Schema 约束匹配的是对端节点的身份。 */
68
+ export interface PortNodeKeyAccessSide {
69
+ port: NormalizedDipPortSchema | null;
70
+ identity: string | null;
71
+ }
72
+ /**
73
+ * 按连接方向校验端口 node key 黑白名单(schema.input / schema.output):
74
+ * - 未配置(缺失或为空)不限制;
75
+ * - 黑名单命中即拒绝;
76
+ * - 白名单非空时,过滤完黑名单后必须命中白名单;
77
+ * - 不在黑名单且未配置白名单则允许。
78
+ *
79
+ * 双侧 port 均可为 null(该侧无 Schema 约束,仅跳过该侧规则);返回 null 表示放行。
80
+ */
81
+ export declare const checkPortNodeKeyAccess: (source: PortNodeKeyAccessSide, target: PortNodeKeyAccessSide) => PortNodeKeyAccessViolation | null;
60
82
  /**
61
83
  * 按 NodePackage PortSchema 校验一条准备创建的连接。
62
84
  *
@@ -84,6 +84,8 @@ export interface ValueModeWrapperProps {
84
84
  * 代码编辑器语言(json / javascript)
85
85
  */
86
86
  lang?: CodeEditorLanguage;
87
+ /** 是否必填 */
88
+ required?: boolean;
87
89
  }
88
90
  export declare const ValueModeWrapper: React.FC<ValueModeWrapperProps>;
89
91
  export default ValueModeWrapper;
@@ -0,0 +1,3 @@
1
+ /** 全局变量键的数据源动作名,宿主 optionsLoader 需实现该 action */
2
+ export declare const GLOBAL_VARIABLE_KEY_ACTION = "globalVariables";
3
+ export declare const GlobalVariableKeyField: import('../../types/field-component').FieldComponentDefinition<import('../../types/form-schema').FieldDef>;
@@ -1,5 +1,6 @@
1
1
  export { AutoCompleteField } from './AutoCompleteField';
2
2
  export { ColorPickerField } from './ColorPickerField';
3
+ export { GlobalVariableKeyField, GLOBAL_VARIABLE_KEY_ACTION, } from './GlobalVariableKeyField';
3
4
  export { MentionsField } from './MentionsField';
4
5
  export { RateField } from './RateField';
5
6
  export { SliderField } from './SliderField';
@@ -66,6 +66,8 @@ export interface FieldComponentProps<T extends FieldDef = FieldDef, K = unknown>
66
66
  onChange?: (value: unknown) => void;
67
67
  /** 字段 ID(由 Form.Item 注入) */
68
68
  id?: string;
69
+ /** 是否必填 */
70
+ required?: boolean;
69
71
  }
70
72
  /**
71
73
  * 字段组件元数据
@@ -65,6 +65,7 @@ export declare enum DynamicFormField {
65
65
  JSON = "JSON",// JSON 编辑器
66
66
  CODE = "CODE",// 工作流代码/JSON 编辑器(由宿主作用域注册)
67
67
  PROXY = "PROXY",// 工作流代理网关选择器(由宿主作用域注册)
68
+ GLOBAL_VARIABLE_KEY = "GLOBAL_VARIABLE_KEY",// 全局变量键选择器(选项由宿主 optionsLoader 提供)
68
69
  DIVIDER = "DIVIDER",// 分割线
69
70
  INFO_CARD = "INFO_CARD",// 展示卡片
70
71
  ARRAY = "ARRAY",// 简单数组
@@ -246,6 +247,12 @@ export type InfoCardField = BaseField & {
246
247
  closable?: boolean;
247
248
  showIcon?: boolean;
248
249
  };
250
+ /** 全局变量键字段定义 */
251
+ export type GlobalVariableKeyField = BaseField & {
252
+ type: DynamicFormField.GLOBAL_VARIABLE_KEY;
253
+ /** 静态兜底选项(宿主未提供 optionsLoader 时使用) */
254
+ options?: Option[];
255
+ };
249
256
  /** 数组字段定义 */
250
257
  export type ArrayField = BaseField & {
251
258
  type: DynamicFormField.ARRAY;
@@ -298,7 +305,7 @@ export type ArrayObjectField = BaseField & {
298
305
  }) => Record<string, unknown>;
299
306
  };
300
307
  /** 字段定义联合类型 */
301
- export type FieldDef = BaseField | TextareaField | SelectField | RadioField | CheckboxGroupField | DateField | DateRangeField | TimeField | TimeRangeField | NumberField | UploadField | SliderField | RateField | CascaderField | TreeSelectField | AutoCompleteField | SwitchField | InfoCardField | ArrayField | ObjectField | KeyValueField | ArrayObjectField;
308
+ export type FieldDef = BaseField | TextareaField | SelectField | RadioField | CheckboxGroupField | DateField | DateRangeField | TimeField | TimeRangeField | NumberField | UploadField | SliderField | RateField | CascaderField | TreeSelectField | AutoCompleteField | SwitchField | InfoCardField | GlobalVariableKeyField | ArrayField | ObjectField | KeyValueField | ArrayObjectField;
302
309
  /** 表单 Schema */
303
310
  export type FormSchema = {
304
311
  fields: FieldDef[];