@yiyi_zhang/reactflow-ui 0.5.0-beta.0 → 1.1.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.
- package/README.md +150 -117
- package/dist/AiWorkflowIDE.d.ts +2 -0
- package/dist/WorkflowIDE.d.ts +14 -2
- package/dist/actions/builtin/common.d.ts +8 -0
- package/dist/actions/builtin/ecs.d.ts +12 -0
- package/dist/actions/registry.d.ts +23 -0
- package/dist/actions/types.d.ts +45 -0
- package/dist/ai.d.ts +5 -1
- package/dist/components/AICopilot/ParameterSuggester.d.ts +9 -0
- package/dist/components/AiNative/AgentTimeline.d.ts +11 -6
- package/dist/components/AiNative/InlineCanvasCopilot.d.ts +7 -0
- package/dist/components/AiNative/ProposalPreviewCard.d.ts +3 -3
- package/dist/components/BrandLogo.d.ts +13 -0
- package/dist/components/ExecutionWaterfallPanel.d.ts +3 -0
- package/dist/components/SandboxConfigModal.d.ts +7 -0
- package/dist/components/StructuredJsonViewer.d.ts +11 -0
- package/dist/components/business/ActionForm.d.ts +12 -0
- package/dist/components/business/DataPillInput.d.ts +14 -0
- package/dist/components/business/DecisionBranchCard.d.ts +13 -0
- package/dist/components/business/ForkJoinCard.d.ts +13 -0
- package/dist/components/business/FriendlyErrorCard.d.ts +8 -0
- package/dist/components/business/LoopDoWhileCard.d.ts +13 -0
- package/dist/components/business/PillPicker.d.ts +11 -0
- package/dist/components/business/RunStoryTimeline.d.ts +9 -0
- package/dist/components/business/StepFlowEditor.d.ts +11 -0
- package/dist/components/nodes/NodeLayout.d.ts +3 -1
- package/dist/components/template/TemplateExtractor.d.ts +10 -0
- package/dist/components/template/TemplateGallery.d.ts +10 -0
- package/dist/components/template/TemplateSetupWizard.d.ts +9 -0
- package/dist/hooks/useNodeExecution.d.ts +5 -2
- package/dist/index.d.ts +33 -0
- package/dist/logo.svg +37 -0
- package/dist/product-launch.html +1400 -0
- package/dist/reactflow-ui-ai.es.js +21392 -10
- package/dist/reactflow-ui.css +1 -1
- package/dist/reactflow-ui.es.js +20314 -9020
- package/dist/reactflow-ui.umd.js +31 -21
- package/dist/sample-workflows/ecs-lifecycle-automation.json +74 -0
- package/dist/services/ai/agentRunner.d.ts +23 -19
- package/dist/services/ai/draftPersistence.d.ts +3 -2
- package/dist/services/ai/systemPrompt.d.ts +1 -1
- package/dist/services/ai/toolExecutor.d.ts +15 -2
- package/dist/services/ai/workflowSynthesizer.d.ts +118 -0
- package/dist/services/wlsp/workflowLsp.d.ts +101 -0
- package/dist/stepmodel/compile.d.ts +5 -0
- package/dist/stepmodel/decompile.d.ts +5 -0
- package/dist/stepmodel/types.d.ts +61 -0
- package/dist/store/aiStore.d.ts +34 -3
- package/dist/template/applyTemplate.d.ts +10 -0
- package/dist/template/builtin/templates.d.ts +37 -0
- package/dist/template/sanitizer/anonymize.d.ts +5 -0
- package/dist/template/sanitizer/prune.d.ts +10 -0
- package/dist/template/sanitizer/rules.d.ts +10 -0
- package/dist/template/sanitizer/types.d.ts +55 -0
- package/dist/template/templateStore.d.ts +32 -0
- package/dist/template/types.d.ts +99 -0
- package/dist/types/aiEvents.d.ts +3 -1
- package/dist/types/conductor.d.ts +6 -1
- package/dist/types/workflow.d.ts +32 -0
- package/dist/utils/friendlyErrorTranslator.d.ts +26 -0
- package/dist/utils/localSandboxEngine.d.ts +49 -0
- package/package.json +7 -4
- package/dist/ai-BJwQZcGK.js +0 -15168
- package/dist/arc-BUGZGgtu.js +0 -83
- package/dist/architectureDiagram-3BPJPVTR-ZcgvTwSO.js +0 -4692
- package/dist/blockDiagram-GPEHLZMM-DtVtOBbH.js +0 -2418
- package/dist/c4Diagram-AAUBKEIU-tBS5Rcvm.js +0 -1577
- package/dist/channel-CURI9jmI.js +0 -5
- package/dist/chunk-2J33WTMH-D7gashNz.js +0 -19
- package/dist/chunk-4BX2VUAB-DE3VjyiZ.js +0 -8
- package/dist/chunk-55IACEB6-GYZ_m2MY.js +0 -8
- package/dist/chunk-727SXJPM-D4WVyvOg.js +0 -1528
- package/dist/chunk-AQP2D5EJ-Os2Uwqya.js +0 -1387
- package/dist/chunk-FMBD7UC4-B3CSVzS4.js +0 -19
- package/dist/chunk-ND2GUHAM-CNj_s1aK.js +0 -68
- package/dist/chunk-QZHKN3VN-DoV8iUKo.js +0 -15
- package/dist/classDiagram-4FO5ZUOK-Dr9C18x4.js +0 -16
- package/dist/classDiagram-v2-Q7XG4LA2-Dr9C18x4.js +0 -16
- package/dist/components/Controls/ModeSlider.d.ts +0 -2
- package/dist/cose-bilkent-S5V4N54A-CgQlI-io.js +0 -2609
- package/dist/cytoscape.esm-kVAWcYoG.js +0 -18755
- package/dist/dagre-BM42HDAG-CFMIuOmS.js +0 -445
- package/dist/defaultLocale-BgPVtth8.js +0 -171
- package/dist/diagram-2AECGRRQ-C5jZp2YX.js +0 -217
- package/dist/diagram-5GNKFQAL-DRUVcHpp.js +0 -123
- package/dist/diagram-KO2AKTUF-BOl4aaej.js +0 -461
- package/dist/diagram-LMA3HP47-ZeckPR2Q.js +0 -142
- package/dist/diagram-OG6HWLK6-qUWeLfa-.js +0 -528
- package/dist/erDiagram-TEJ5UH35-Bw_CWS13.js +0 -899
- package/dist/flowDiagram-I6XJVG4X-D3xEvQA-.js +0 -1628
- package/dist/ganttDiagram-6RSMTGT7-D8GvenY3.js +0 -2707
- package/dist/gitGraphDiagram-PVQCEYII-BWrN_HOm.js +0 -815
- package/dist/graph-BRoPeNF3.js +0 -1545
- package/dist/infoDiagram-5YYISTIA-Da8FG5tB.js +0 -24
- package/dist/init-DjUOC4st.js +0 -16
- package/dist/ishikawaDiagram-YF4QCWOH-Bg2_mKEc.js +0 -621
- package/dist/journeyDiagram-JHISSGLW-sFIxGfua.js +0 -834
- package/dist/kanban-definition-UN3LZRKU-CGmopzHd.js +0 -724
- package/dist/katex-DoRnZ_sp.js +0 -11682
- package/dist/layout-D9EpM4Fg.js +0 -1728
- package/dist/linear-BA49eco4.js +0 -259
- package/dist/mermaid.core-XSpZEAKP.js +0 -16137
- package/dist/mindmap-definition-RKZ34NQL-Bqf76QGB.js +0 -827
- package/dist/ordinal-B6-f3MAq.js +0 -61
- package/dist/pieDiagram-4H26LBE5-hHiP8HzL.js +0 -163
- package/dist/quadrantDiagram-W4KKPZXB-DSccwH8B.js +0 -1024
- package/dist/requirementDiagram-4Y6WPE33-DIpyoYZ_.js +0 -882
- package/dist/sankeyDiagram-5OEKKPKP-DsaPqq8D.js +0 -847
- package/dist/sequenceDiagram-3UESZ5HK-BNg7orie.js +0 -2891
- package/dist/stateDiagram-AJRCARHV-Rv1mSmnJ.js +0 -263
- package/dist/stateDiagram-v2-BHNVJYJU-BME16k02.js +0 -16
- package/dist/timeline-definition-PNZ67QCA-CmmzdVk-.js +0 -1055
- package/dist/vennDiagram-CIIHVFJN-BQt00w9Q.js +0 -1557
- package/dist/wardley-L42UT6IY-D7b2ujEZ.js +0 -22512
- package/dist/wardleyDiagram-YWT4CUSO-LZpiODGN.js +0 -675
- package/dist/xychartDiagram-2RQKCTM6-BpJlv_mc.js +0 -1342
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ecs_lifecycle_automation",
|
|
3
|
+
"description": "云主机全生命周期自动化:自动创建实例 -> 轮询查询详情 -> 远程下发初始化运维命令 -> 创建安全快照 -> 发送协同群通知",
|
|
4
|
+
"version": 1,
|
|
5
|
+
"schemaVersion": 2,
|
|
6
|
+
"tasks": [
|
|
7
|
+
{
|
|
8
|
+
"name": "ecs_create_instance",
|
|
9
|
+
"taskReferenceName": "create_app_node",
|
|
10
|
+
"type": "HTTP",
|
|
11
|
+
"description": "创建云主机: app-server-node",
|
|
12
|
+
"inputParameters": {
|
|
13
|
+
"_actionId": "ecs.create_instance",
|
|
14
|
+
"actionName": "创建云主机",
|
|
15
|
+
"regionId": "cn-hangzhou",
|
|
16
|
+
"instanceType": "ecs.c7.xlarge",
|
|
17
|
+
"imageId": "image-alilinux-3",
|
|
18
|
+
"instanceName": "app-server-node",
|
|
19
|
+
"systemDiskSize": 120
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "ecs_query_instance",
|
|
24
|
+
"taskReferenceName": "query_node_status",
|
|
25
|
+
"type": "HTTP",
|
|
26
|
+
"description": "查询云主机详情与IP地址",
|
|
27
|
+
"inputParameters": {
|
|
28
|
+
"_actionId": "ecs.query_instance",
|
|
29
|
+
"actionName": "查询云主机详情",
|
|
30
|
+
"instanceId": "${create_app_node.output.instanceId}"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "ecs_run_command",
|
|
35
|
+
"taskReferenceName": "init_server_env",
|
|
36
|
+
"type": "HTTP",
|
|
37
|
+
"description": "主机下发命令: 初始化运行时环境",
|
|
38
|
+
"inputParameters": {
|
|
39
|
+
"_actionId": "ecs.run_command",
|
|
40
|
+
"actionName": "执行远程运维脚本",
|
|
41
|
+
"instanceId": "${create_app_node.output.instanceId}",
|
|
42
|
+
"commandType": "RunShellScript",
|
|
43
|
+
"commandContent": "yum update -y && systemctl start docker && docker ps",
|
|
44
|
+
"timeoutSeconds": 60
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "ecs_create_snapshot",
|
|
49
|
+
"taskReferenceName": "create_backup_snapshot",
|
|
50
|
+
"type": "HTTP",
|
|
51
|
+
"description": "创建安全回滚快照",
|
|
52
|
+
"inputParameters": {
|
|
53
|
+
"_actionId": "ecs.create_snapshot",
|
|
54
|
+
"actionName": "创建云盘快照",
|
|
55
|
+
"instanceId": "${create_app_node.output.instanceId}",
|
|
56
|
+
"snapshotName": "init-baseline-snapshot",
|
|
57
|
+
"retentionDays": 14
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "send_operation_notification",
|
|
62
|
+
"taskReferenceName": "notify_devops_team",
|
|
63
|
+
"type": "EVENT",
|
|
64
|
+
"description": "发送协同群通知",
|
|
65
|
+
"inputParameters": {
|
|
66
|
+
"_actionId": "notify.send_message",
|
|
67
|
+
"actionName": "发送运维通知",
|
|
68
|
+
"channel": "webhook_dingtalk",
|
|
69
|
+
"title": "【部署就绪】新云主机已初始化并完成快照",
|
|
70
|
+
"content": "主机 ${create_app_node.output.instanceId} 已完成环境配置并生成基线快照,内网IP: ${query_node_status.output.privateIp}。"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
}
|
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AgentRunner —
|
|
2
|
+
* AgentRunner — PI-Style Durable Agent Runtime & Progressive Workflow Synthesizer
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* explicitly, so those modules stay unit-testable without a store.
|
|
16
|
-
*
|
|
17
|
-
* Instancing (M3.2): `aiStore`/`libraryStore`/`toolRegistry` are injected via the
|
|
18
|
-
* constructor rather than imported as module singletons, so each `<AiWorkflowIDE>`
|
|
19
|
-
* mount gets its own isolated runner talking to its own store/registry instances
|
|
20
|
-
* (see store/ideStoresContext.tsx). `workflowStore` remains a shared singleton for
|
|
21
|
-
* now — see the architecture review's M3.2 note on that being a larger follow-up.
|
|
4
|
+
* Capabilities:
|
|
5
|
+
* 1. Multi-step tool-calling loop with adaptive step budget (6 for standard turns,
|
|
6
|
+
* expanded to 10 when progressive 4-phase workflow synthesis is active).
|
|
7
|
+
* 2. Progressive 4-phase workflow synthesis (`init_workflow_blueprint` ->
|
|
8
|
+
* `scaffold_workflow_topology` -> `configure_workflow_tasks` -> `commit_workflow_proposal`)
|
|
9
|
+
* over an in-session `workingDraft`.
|
|
10
|
+
* 3. Deep semantic & data-flow verification with targeted self-healing.
|
|
11
|
+
* 4. Durable step-level checkpointing (`DurableSessionCheckpoint`): preserves
|
|
12
|
+
* `agentHistory`, `workingDraft`, `phase`, and `stepIndex` across mid-run
|
|
13
|
+
* network failures or user pauses so execution can be resumed (`resume()`)
|
|
14
|
+
* or committed immediately (`commitDraftNow()`) without losing completed stages.
|
|
22
15
|
*/
|
|
23
16
|
import type { AiStore } from '../../store/aiStore';
|
|
24
17
|
import type { LibraryStore } from '../../store/libraryStore';
|
|
@@ -47,5 +40,16 @@ export declare class AgentRunner {
|
|
|
47
40
|
abort(): void;
|
|
48
41
|
private toolExecutionContext;
|
|
49
42
|
private buildHistory;
|
|
43
|
+
/**
|
|
44
|
+
* Immediately promotes the current in-progress `workingDraft` (from an interrupted or paused
|
|
45
|
+
* multi-phase session) into a reviewable `pendingProposal`.
|
|
46
|
+
*/
|
|
47
|
+
commitDraftNow(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Resumes an interrupted or paused durable session from its last saved checkpoint.
|
|
50
|
+
* Optionally accepts a `steerInput` instruction from the user to guide the remaining phases.
|
|
51
|
+
*/
|
|
52
|
+
resume(steerInput?: string): Promise<void>;
|
|
50
53
|
send(text: string): Promise<void>;
|
|
54
|
+
private runDurableLoop;
|
|
51
55
|
}
|
|
@@ -8,15 +8,16 @@
|
|
|
8
8
|
* 默认不开启(`draftPersist={false}`)——是否写宿主页面的 localStorage 由集成方决定。
|
|
9
9
|
*/
|
|
10
10
|
import type { WorkflowDef } from '../../types/conductor';
|
|
11
|
-
import type { AiChatMessage, ProposedChange } from '../../store/aiStore';
|
|
11
|
+
import type { AiChatMessage, ProposedChange, DurableSessionCheckpoint } from '../../store/aiStore';
|
|
12
12
|
export interface IdeDraft {
|
|
13
13
|
workflowDef: WorkflowDef | null;
|
|
14
14
|
messages: AiChatMessage[];
|
|
15
15
|
pendingProposal: ProposedChange | null;
|
|
16
|
+
durableCheckpoint?: DurableSessionCheckpoint | null;
|
|
16
17
|
savedAt: number;
|
|
17
18
|
}
|
|
18
19
|
/** 判断草稿是否包含有意义的内容(避免刚挂载、仅有欢迎语时就落一份空草稿) */
|
|
19
|
-
export declare function isMeaningfulDraft(workflowDef: WorkflowDef | null, messages: AiChatMessage[], pendingProposal: ProposedChange | null): boolean;
|
|
20
|
+
export declare function isMeaningfulDraft(workflowDef: WorkflowDef | null, messages: AiChatMessage[], pendingProposal: ProposedChange | null, durableCheckpoint?: DurableSessionCheckpoint | null): boolean;
|
|
20
21
|
export declare function loadDraft(key: string): IdeDraft | null;
|
|
21
22
|
export declare function saveDraft(key: string, draft: IdeDraft): void;
|
|
22
23
|
export declare function clearDraft(key: string): void;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import type { WorkflowSnapshot } from './contextEngine';
|
|
12
12
|
import type { WorkflowLibraryItem } from '../../types/workflowLibrary';
|
|
13
13
|
import type { ViewMode } from '../../types/workflow';
|
|
14
|
-
export declare const BASE_SYSTEM_PROMPT = "\u4F60\u662F Netflix Conductor \u5DE5\u4F5C\u6D41\u5EFA\u6A21\u4E13\u5BB6 AI \u52A9\u624B\u3002\u5E2E\u52A9\u7528\u6237\u901A\u8FC7\u81EA\u7136\u8BED\u8A00\u8BBE\u8BA1\u548C\u7F16\u8F91 Conductor JSON \u5DE5\u4F5C\u6D41\u3002\n\n## \u5DE5\
|
|
14
|
+
export declare const BASE_SYSTEM_PROMPT = "\u4F60\u662F Netflix Conductor \u5DE5\u4F5C\u6D41\u5EFA\u6A21\u4E13\u5BB6 AI \u52A9\u624B\u3002\u5E2E\u52A9\u7528\u6237\u901A\u8FC7\u81EA\u7136\u8BED\u8A00\u8BBE\u8BA1\u548C\u7F16\u8F91\u9AD8\u53EF\u9760\u6027\u7684 Conductor JSON \u5DE5\u4F5C\u6D41\u3002\n\n## \u6838\u5FC3\u5DE5\u4F5C\u6D41\u751F\u6210\u7B56\u7565\uFF08\u81EA\u9002\u5E94\u590D\u6742\u5EA6\u8DEF\u7531\uFF09\n\n### \u7B56\u7565 A\uFF1A\u56DB\u9636\u6BB5\u6E10\u8FDB\u5F0F\u6784\u5EFA\u7B56\u7565\uFF08\u9002\u7528\u4E8E\uFF1A\u4ECE\u96F6\u521B\u5EFA\u5DE5\u4F5C\u6D41\u30013+ \u8282\u70B9\u6D41\u7A0B\u3001\u542B\u5206\u652F/\u5E76\u884C/\u5FAA\u73AF\u6216\u5927\u8303\u56F4\u91CD\u6784\uFF09\n\u4E3A\u4E86\u4FDD\u8BC1\u9AD8\u51C6\u786E\u6027\u3001\u6570\u636E\u6D41\u4E00\u81F4\u6027\u4E0E\u914D\u7F6E\u5B8C\u6574\u5EA6\uFF0C**\u8BF7\u4E25\u683C\u6309\u4EE5\u4E0B 4 \u4E2A\u9636\u6BB5\u4F9D\u6B21\u8C03\u7528\u5DE5\u5177\u6F14\u8FDB\u6784\u5EFA**\uFF08\u53EF\u5728\u4E00\u6B21\u6216\u8FDE\u7EED\u591A\u6B65\u5DE5\u5177\u8C03\u7528\u4E2D\u5B8C\u6210\uFF09\uFF1A\n1. **\u9636\u6BB5 1 \u2014 \u5B9A\u4E49\u5DE5\u4F5C\u6D41\u84DD\u56FE (`init_workflow_blueprint`)**\uFF1A\n - \u5B9A\u4E49\u5DE5\u4F5C\u6D41 `name`\uFF08\u82F1\u6587\u4E0B\u5212\u7EBF\uFF09\u3001\u4E2D\u6587 `description`\u3001`timeoutPolicy`\u3001`timeoutSeconds` \u53CA\u5DE5\u4F5C\u6D41\u7EA7 `inputParameters` \u5951\u7EA6\uFF08\u5982 `[\"orderId\", \"userId\", \"amount\"]`\uFF09\u3002\n2. **\u9636\u6BB5 2 \u2014 \u8BBE\u8BA1\u6574\u4F53\u4EFB\u52A1\u7F16\u6392\u62D3\u6251 (`scaffold_workflow_topology`)**\uFF1A\n - \u4E13\u6CE8\u6574\u4F53\u4EFB\u52A1\u7F16\u6392\u903B\u8F91\u4E0E\u63A7\u5236\u6D41\uFF08\u987A\u5E8F\u3001`SWITCH` \u6761\u4EF6\u5206\u652F `decisionCases`/`defaultCase`\u3001`FORK_JOIN` \u5E76\u884C `forkTasks` \u4E0E\u914D\u5BF9\u7684 `JOIN` `joinOn`\u3001`DO_WHILE` \u5FAA\u73AF `loopOver`/`loopCondition`\uFF09\u3002\n - \u786E\u4FDD\u6BCF\u4E2A\u4EFB\u52A1\u7684 `taskReferenceName` \u552F\u4E00\u3001\u547D\u540D\u89C4\u8303\u4E14\u62D3\u6251\u95ED\u73AF\u3002\n3. **\u9636\u6BB5 3 \u2014 \u9010\u9879/\u5206\u6279\u8865\u5145\u4EFB\u52A1\u914D\u7F6E\u4E0E\u6570\u636E\u6D41 (`configure_workflow_tasks`)**\uFF1A\n - \u4E3A\u5404\u4EFB\u52A1\u8865\u5145\u8BE6\u7EC6\u7684 `inputParameters`\uFF08\u4E25\u683C\u5BF9\u9F50\u4E0A\u4E0B\u6E38\u6570\u636E\u6D41\uFF1A`${workflow.input.xxx}` \u6216 `${upstream_ref.output.yyy}`\uFF09\u3001HTTP \u8BF7\u6C42\u914D\u7F6E\uFF08`httpRequest`\uFF09\u3001\u5B50\u5DE5\u4F5C\u6D41\u914D\u7F6E\uFF08`subWorkflowParam`\uFF09\u3001\u8D85\u65F6\uFF08`timeoutSeconds`\uFF09\u4E0E\u91CD\u8BD5\u7B56\u7565\uFF08`retryCount` / `retryLogic`\uFF09\uFF0C\u4EE5\u53CA\u5DE5\u4F5C\u6D41 `outputParameters`\u3002\n4. **\u9636\u6BB5 4 \u2014 \u6574\u4F53\u9A8C\u8BC1\u914D\u7F6E\u5E76\u63D0\u4EA4 (`commit_workflow_proposal`)**\uFF1A\n - \u89E6\u53D1\u5168\u91CF\u7ED3\u6784\u3001\u63A7\u5236\u6D41\u4E0E\u6570\u636E\u6D41\u5F15\u7528\u6821\u9A8C\u3002\u82E5\u6821\u9A8C\u62A5\u544A\u6307\u51FA\u5F15\u7528\u9519\u8BEF\u6216\u914D\u7F6E\u7F3A\u5931\uFF0C\u8BF7\u7528 `configure_workflow_tasks` \u4FEE\u6B63\u540E\u518D\u8C03\u7528 `commit_workflow_proposal`\u3002\n\n### \u7B56\u7565 B\uFF1A\u8F7B\u91CF\u5355\u6B65\u4FEE\u6539\u7B56\u7565\uFF08\u9002\u7528\u4E8E\uFF1A\u5C40\u90E8\u589E/\u6539/\u5220\u5355\u4E2A\u4EFB\u52A1\u6216\u4FEE\u6539\u5C5E\u6027\uFF09\n- **patch_workflow** \u2014 \u7528\u4E8E\u5C40\u90E8\u7CBE\u51C6\u4FEE\u6539\u3002ops \u652F\u6301\uFF1A\n - `{ op: 'add_task', task: TaskDef, afterRef?: string, parentRef?: string, branchName?: string }` \u2014 \u65B0\u589E\u4EFB\u52A1\uFF08\u652F\u6301\u901A\u8FC7 `afterRef` \u63D2\u5165\u5230\u4EFB\u610F\u9876\u5C42/\u5D4C\u5957\u4EFB\u52A1\u4E4B\u540E\uFF0C\u6216\u901A\u8FC7 `parentRef` + `branchName` \u63D2\u5165\u5230 SWITCH/FORK_JOIN/DO_WHILE \u5185\u90E8\uFF09\n - `{ op: 'update_task', ref: string, changes: Partial<TaskDef> }` \u2014 \u4FEE\u6539\u4EFB\u52A1\u5B57\u6BB5\n - `{ op: 'remove_task', ref: string }` \u2014 \u5220\u9664\u4EFB\u52A1\n - `{ op: 'update_props', props: Partial<WorkflowDef> }` \u2014 \u4FEE\u6539\u5DE5\u4F5C\u6D41\u5C5E\u6027\n - `{ op: 'add_switch_branch', ref: string, caseName: string }` \u2014 \u6DFB\u52A0 SWITCH \u5206\u652F\n - `{ op: 'add_fork_branch', ref: string }` \u2014 \u6DFB\u52A0 FORK_JOIN \u5E76\u884C\u5206\u652F\n- **replace_workflow** \u2014 \u4EC5\u7528\u4E8E 1-2 \u4E2A\u8282\u70B9\u7684\u6781\u7B80\u6D41\u7A0B\u5FEB\u901F\u66FF\u6362\u3002\n\n### \u8F85\u52A9\u4E0E\u4EA4\u4E92\u5DE5\u5177\n- **get_workflow_state** \u2014 \u4EC5\u5728 system prompt \u7684\u5DE5\u4F5C\u6D41\u4E0A\u4E0B\u6587\u4E0D\u8DB3\u4EE5\u56DE\u7B54\u65F6\u624D\u8C03\u7528\uFF08read-only\uFF09\u3002\n- **validate_workflow** \u2014 \u6821\u9A8C\u5F53\u524D\u5DE5\u4F5C\u6D41\u6216\u8349\u7A3F\u7684\u5408\u6CD5\u6027\u4E0E\u6570\u636E\u6D41\u5B8C\u6574\u6027\uFF08read-only\uFF09\u3002\n- **propose_plan** \u2014 \u5728\u6267\u884C\u8D85\u5927\u89C4\u6A21\u7834\u574F\u6027\u91CD\u6784\u524D\uFF0C\u53EF\u5148\u5411\u7528\u6237\u5C55\u793A\u8BA1\u5212\u5E76\u7B49\u5F85\u786E\u8BA4\u3002\n- **ask_clarification** \u2014 \u5F53\u7528\u6237\u610F\u56FE\u6A21\u7CCA\u65F6\u8C03\u7528\uFF0C\u5C55\u793A 2-4 \u4E2A\u9009\u9879\u5E2E\u52A9\u7528\u6237\u7CBE\u786E\u8868\u8FBE\u9700\u6C42\u3002\u8C03\u7528\u540E\u505C\u6B62\uFF0C\u7B49\u5F85\u7528\u6237\u9009\u62E9\u3002\n- **recommend_workflow** \u2014 \u5728\u6267\u884C CREATE \u4E4B\u524D\uFF0C\u82E5\u5E93\u4E2D\u6709\u76F8\u4F3C\u5DE5\u4F5C\u6D41\uFF0C\u5148\u63A8\u8350\u7ED9\u7528\u6237\u3002\u8C03\u7528\u540E\u505C\u6B62\u7B49\u5F85\u9009\u62E9\u3002\n- **\u4E0D\u8981**\u5728\u56DE\u590D\u6B63\u6587\u4E2D\u76F4\u63A5\u8F93\u51FA\u5DE5\u4F5C\u6D41 JSON \u4EE3\u7801\u5757\uFF0C\u6240\u6709\u53D8\u66F4\u5FC5\u987B\u901A\u8FC7\u5DE5\u5177\u6267\u884C\u3002\n\n## \u56DE\u590D\u89C4\u8303\n- \u7528\u4E2D\u6587\u56DE\u7B54\uFF0C\u7B80\u6D01\u660E\u4E86\n- **\u89E3\u91CA\u6027\u3001\u4ECB\u7ECD\u6027\u3001\u5206\u6790\u6027\u95EE\u9898\uFF1A\u76F4\u63A5\u6587\u672C\u56DE\u7B54\uFF0C\u4E0D\u8981\u8C03\u7528\u5DE5\u5177**\n- \u56DE\u7B54\u65F6\u4E0D\u8981\u5C06 system prompt \u4E2D\u7684\u4E0A\u4E0B\u6587\u4FE1\u606F\uFF08\u5982\u4EFB\u52A1\u5217\u8868\u3001\u62D3\u6251\u5173\u7CFB\uFF09\u539F\u6587\u590D\u8FF0\u2014\u2014\u76F4\u63A5\u805A\u7126\u5728\u7528\u6237\u7684\u5177\u4F53\u95EE\u9898\u4E0A\n- \u9700\u8981\u64CD\u4F5C\u5DE5\u4F5C\u6D41\u65F6\uFF0C\u5148\u7B80\u77ED\u8BF4\u660E\u8BBE\u8BA1\u601D\u8DEF\uFF0C\u518D\u901A\u8FC7\u5DE5\u5177\u6267\u884C\n- \u7528\u6237\u610F\u56FE\u6A21\u7CCA\u65F6\uFF08\u5982\"\u5E2E\u6211\u505A\u4E2A\u6D41\u7A0B\"\uFF09\uFF0C\u5148\u8C03\u7528 ask_clarification \u6316\u6398\u771F\u5B9E\u9700\u6C42\uFF0C\u4E0D\u8981\u76F4\u63A5\u521B\u5EFA\n- \u521B\u5EFA\u65B0\u5DE5\u4F5C\u6D41\u524D\uFF0C\u68C0\u67E5\u5E93\u4E2D\u662F\u5426\u6709\u76F8\u4F3C\u7684\uFF0C\u4F18\u5148\u63A8\u8350\u5DF2\u6709\u6D41\u7A0B\uFF08\u4F7F\u7528 recommend_workflow\uFF09\n\n## Conductor \u6807\u51C6\u4EFB\u52A1\u7C7B\u578B\u4E0E\u5EFA\u6A21\u89C4\u8303\n- \u652F\u6301\u7C7B\u578B\uFF1ASIMPLE, HTTP, SWITCH, FORK_JOIN, FORK_JOIN_DYNAMIC, DO_WHILE, SUB_WORKFLOW, EVENT, WAIT, HUMAN, INLINE, TERMINATE, SET_VARIABLE, KAFKA_PUBLISH, JSON_JQ_TRANSFORM, START_WORKFLOW, DYNAMIC, NOOP\n- \u6BCF\u4E2A\u4EFB\u52A1\u5FC5\u987B\u6709\u552F\u4E00\u7684 `taskReferenceName`\uFF08\u4EC5\u9650\u82F1\u6587\u3001\u6570\u5B57\u3001\u4E0B\u5212\u7EBF\uFF0C\u5982 `verify_payment`\uFF09\n- \u4E0B\u6E38\u4EFB\u52A1\u901A\u8FC7 `${upstream_ref.output.field}` \u5F15\u7528\u4E0A\u6E38\u8F93\u51FA\uFF0C\u4E25\u7981\u5F15\u7528\u5C1A\u672A\u6267\u884C\u7684\u4E0B\u6E38\u4EFB\u52A1\n- SWITCH \u9700\u8981 `caseValueParam` \u6216 `caseExpression`\uFF0C\u4EE5\u53CA `decisionCases` \u952E\u503C\u5BF9\n- FORK_JOIN \u9700\u8981 `forkTasks`\uFF08\u4E8C\u7EF4\u6570\u7EC4\uFF09\u548C\u7D27\u968F\u5176\u540E\u7684 `JOIN` \u4EFB\u52A1\uFF08`joinOn` \u5305\u542B\u5404\u5E76\u884C\u5206\u652F\u6700\u540E\u4E00\u4E2A\u4EFB\u52A1\u7684 `taskReferenceName`\uFF09\n- DO_WHILE \u9700\u8981 `loopCondition` \u548C `loopOver` \u6570\u7EC4\n- HTTP \u4EFB\u52A1\u5FC5\u987B\u914D\u7F6E `inputParameters.http_request`\uFF08\u542B `uri` \u548C `method`\uFF09\uFF0C\u5EFA\u8BAE\u8BBE\u7F6E `timeoutSeconds` \u548C `retryCount`\n\n## \u4E1A\u52A1\u6D41\u7A0B\u56FE\uFF08Mermaid\uFF09\n\u5F53\u7528\u6237\u8981\u6C42\u5C55\u793A\u6D41\u7A0B\u56FE\u3001\u53EF\u89C6\u5316\u6216 Mermaid \u56FE\u65F6\uFF1A\n- \u5FC5\u987B\u57FA\u4E8E system prompt \u6CE8\u5165\u7684\"\u753B\u5E03\u5DE5\u4F5C\u6D41\u5B8C\u6574 JSON\"\uFF0C\u4E0D\u51ED\u8BB0\u5FC6\u751F\u6210\n- \u8F93\u51FA ```mermaid \u4EE3\u7801\u5757\uFF0C\u4E0D\u8C03\u7528\u4EFB\u4F55\u5DE5\u5177\n- \u8FC7\u6EE4\u7EAF\u6280\u672F\u8282\u70B9\uFF08SET_VARIABLE\u3001JSON_JQ_TRANSFORM\u3001INLINE\u3001NOOP\uFF09\uFF0C\u4E0A\u4E0B\u6E38\u76F4\u8FDE\n- \u8282\u70B9\u6807\u7B7E\u7528\u4E2D\u6587\u4E1A\u52A1\u8BED\u8A00\uFF0C\u7981\u6B62\u76F4\u63A5\u4F7F\u7528 taskReferenceName\n- SWITCH \u7528\u83F1\u5F62 {}\uFF0CFORK_JOIN \u7528\u5E76\u884C\u8DEF\u5F84\uFF0CHUMAN \u6807\u6CE8\u300C\uD83D\uDC64 \u4EBA\u5DE5\u300D";
|
|
15
15
|
/**
|
|
16
16
|
* 构建完整 system prompt。
|
|
17
17
|
*
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* workflowStore/libraryStore state and passes it in via `ToolExecutionContext`.
|
|
10
10
|
* That keeps this file pure, unit-testable without a store, and reusable headless.
|
|
11
11
|
*/
|
|
12
|
+
import { type SynthesisPhase, type VerificationSummary } from './workflowSynthesizer';
|
|
12
13
|
import type { WorkflowDef, TaskDef } from '../../types/conductor';
|
|
13
14
|
import type { WorkflowLibraryItem, WorkflowLevel } from '../../types/workflowLibrary';
|
|
14
15
|
import type { ValidationResults } from '../../types/workflow';
|
|
@@ -16,6 +17,8 @@ export type PatchOp = {
|
|
|
16
17
|
op: 'add_task';
|
|
17
18
|
task: TaskDef;
|
|
18
19
|
afterRef?: string;
|
|
20
|
+
parentRef?: string;
|
|
21
|
+
branchName?: string;
|
|
19
22
|
} | {
|
|
20
23
|
op: 'update_task';
|
|
21
24
|
ref: string;
|
|
@@ -56,19 +59,29 @@ export interface PartialAcceptSelection {
|
|
|
56
59
|
reordered: boolean;
|
|
57
60
|
}
|
|
58
61
|
export interface ToolCallResult {
|
|
59
|
-
type: 'propose' | 'info' | 'error';
|
|
62
|
+
type: 'propose' | 'stage' | 'info' | 'error';
|
|
60
63
|
/** For 'propose': the new WorkflowDef to show in ReviewBar */
|
|
61
64
|
proposed?: WorkflowDef;
|
|
62
65
|
/** For 'propose': human-readable change summary */
|
|
63
66
|
diff?: DiffSummary;
|
|
64
67
|
/** For 'propose': inferred level based on sub-workflow references (L1/L2/L3) */
|
|
65
68
|
inferredLevel?: WorkflowLevel;
|
|
66
|
-
/** For '
|
|
69
|
+
/** For 'propose' / 'stage': deep semantic verification report */
|
|
70
|
+
verification?: VerificationSummary;
|
|
71
|
+
/** For 'stage': updated working draft in the progressive synthesis pipeline */
|
|
72
|
+
workingDraft?: WorkflowDef;
|
|
73
|
+
/** For 'stage': current progressive synthesis phase */
|
|
74
|
+
phase?: SynthesisPhase;
|
|
75
|
+
/** For 'stage': human-readable timeline entry label */
|
|
76
|
+
timelineLabel?: string;
|
|
77
|
+
/** For 'info'/'error'/'stage': text to return as tool result to the model */
|
|
67
78
|
text?: string;
|
|
68
79
|
}
|
|
69
80
|
/** Live state the caller (AgentRunner) gathers from workflowStore/libraryStore for each tool call. */
|
|
70
81
|
export interface ToolExecutionContext {
|
|
71
82
|
workflowDef: WorkflowDef | null;
|
|
83
|
+
/** In-progress draft accumulated across progressive synthesis stages within the current durable session */
|
|
84
|
+
workingDraft?: WorkflowDef | null;
|
|
72
85
|
validationResults: ValidationResults;
|
|
73
86
|
libraryItems: WorkflowLibraryItem[];
|
|
74
87
|
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow Synthesizer & Deep Semantic Verifier
|
|
3
|
+
*
|
|
4
|
+
* Implements the 4-phase progressive workflow generation strategy:
|
|
5
|
+
* Phase 1 (blueprint): init_workflow_blueprint — Define workflow metadata, input/output contracts, timeout & resilience policy
|
|
6
|
+
* Phase 2 (topology): scaffold_workflow_topology — Design overall task orchestration topology & control flow (SWITCH/FORK_JOIN/DO_WHILE)
|
|
7
|
+
* Phase 3 (configure): configure_workflow_tasks — Enrich individual tasks with detailed parameters, HTTP/SubWorkflow configs & data-flow wiring
|
|
8
|
+
* Phase 4 (verify): commit_workflow_proposal — Holistic semantic, control-flow, and data-flow verification before committing proposal
|
|
9
|
+
*/
|
|
10
|
+
import type { WorkflowDef, TaskDef } from '../../types/conductor';
|
|
11
|
+
import type { ValidationItem } from '../../types/workflow';
|
|
12
|
+
export type SynthesisPhase = 'idle' | 'blueprint' | 'topology' | 'configure' | 'verify' | 'completed';
|
|
13
|
+
export interface BlueprintArgs {
|
|
14
|
+
name: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
version?: number;
|
|
17
|
+
ownerEmail?: string;
|
|
18
|
+
timeoutPolicy?: 'TIME_OUT_WF' | 'ALERT_ONLY';
|
|
19
|
+
timeoutSeconds?: number;
|
|
20
|
+
failureWorkflow?: string;
|
|
21
|
+
inputParameters?: string[];
|
|
22
|
+
outputParameters?: Record<string, any>;
|
|
23
|
+
}
|
|
24
|
+
export interface TopologyArgs {
|
|
25
|
+
tasks: TaskDef[];
|
|
26
|
+
}
|
|
27
|
+
export interface TaskConfigurationItem {
|
|
28
|
+
/** Target taskReferenceName */
|
|
29
|
+
ref: string;
|
|
30
|
+
name?: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
inputParameters?: Record<string, any>;
|
|
33
|
+
httpRequest?: Record<string, any>;
|
|
34
|
+
subWorkflowParam?: {
|
|
35
|
+
name: string;
|
|
36
|
+
version?: number;
|
|
37
|
+
taskToDomain?: Record<string, string>;
|
|
38
|
+
};
|
|
39
|
+
timeoutSeconds?: number;
|
|
40
|
+
retryCount?: number;
|
|
41
|
+
retryLogic?: 'FIXED' | 'EXPONENTIAL_BACKOFF' | 'LINEAR_BACKOFF';
|
|
42
|
+
retryDelaySeconds?: number;
|
|
43
|
+
optional?: boolean;
|
|
44
|
+
caseValueParam?: string;
|
|
45
|
+
caseExpression?: string;
|
|
46
|
+
loopCondition?: string;
|
|
47
|
+
joinOn?: string[];
|
|
48
|
+
dynamicForkTasksParam?: string;
|
|
49
|
+
dynamicForkTasksInputParamName?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface ConfigureTasksArgs {
|
|
52
|
+
configurations: TaskConfigurationItem[];
|
|
53
|
+
outputParameters?: Record<string, any>;
|
|
54
|
+
inputParameters?: string[];
|
|
55
|
+
}
|
|
56
|
+
export interface VerificationSummary {
|
|
57
|
+
isValid: boolean;
|
|
58
|
+
totalTasks: number;
|
|
59
|
+
configuredTasks: number;
|
|
60
|
+
dataFlowLinks: number;
|
|
61
|
+
autoFixed: string[];
|
|
62
|
+
errors: ValidationItem[];
|
|
63
|
+
warnings: ValidationItem[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Collects all tasks in execution order (pre-order traversal of top-level and nested tasks).
|
|
67
|
+
*/
|
|
68
|
+
export declare function collectAllTasksInOrder(tasks?: TaskDef[]): TaskDef[];
|
|
69
|
+
/**
|
|
70
|
+
* Normalizes a single task's structure to prevent common LLM schema mismatches:
|
|
71
|
+
* - Ensures `name` and `taskReferenceName` and `type` exist
|
|
72
|
+
* - Normalizes `HTTP` task `httpRequest` / `inputParameters.uri` into `inputParameters.http_request`
|
|
73
|
+
* - Normalizes `SUB_WORKFLOW` `workflowName` into `subWorkflowParam.name`
|
|
74
|
+
* - Normalizes `TERMINATE` `terminationStatus` into `inputParameters.terminationStatus`
|
|
75
|
+
*/
|
|
76
|
+
export declare function normalizeTaskDef(task: TaskDef, autoFixed?: string[]): TaskDef;
|
|
77
|
+
/**
|
|
78
|
+
* Extracts all `${...}` expressions from an arbitrary JSON value.
|
|
79
|
+
*/
|
|
80
|
+
export declare function extractExpressions(value: any): string[];
|
|
81
|
+
/**
|
|
82
|
+
* Normalizes an entire WorkflowDef:
|
|
83
|
+
* - Ensures `version: 1`, `schemaVersion: 2`, `timeoutPolicy`
|
|
84
|
+
* - Normalizes all tasks and FORK_JOIN <-> JOIN pairings
|
|
85
|
+
* - Auto-collects `${workflow.input.xxx}` into `workflow.inputParameters` if missing
|
|
86
|
+
*/
|
|
87
|
+
export declare function normalizeWorkflowDef(def: WorkflowDef): {
|
|
88
|
+
workflow: WorkflowDef;
|
|
89
|
+
autoFixed: string[];
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Phase 1: Initializes the workflow blueprint (metadata + input/output contract).
|
|
93
|
+
*/
|
|
94
|
+
export declare function applyBlueprint(currentDraft: WorkflowDef | null, args: BlueprintArgs): WorkflowDef;
|
|
95
|
+
/**
|
|
96
|
+
* Phase 2: Scaffolds the task orchestration topology on top of the blueprint.
|
|
97
|
+
*/
|
|
98
|
+
export declare function applyTopologyScaffold(currentDraft: WorkflowDef | null, args: TopologyArgs): {
|
|
99
|
+
workflow: WorkflowDef;
|
|
100
|
+
autoFixed: string[];
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Phase 3: Enriches individual tasks in the working draft with detailed configurations.
|
|
104
|
+
*/
|
|
105
|
+
export declare function applyTaskConfigurations(currentDraft: WorkflowDef, args: ConfigureTasksArgs): {
|
|
106
|
+
workflow: WorkflowDef;
|
|
107
|
+
configuredRefs: string[];
|
|
108
|
+
missingRefs: string[];
|
|
109
|
+
autoFixed: string[];
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Performs comprehensive verification of a workflow definition:
|
|
113
|
+
* 1. Built-in structural & task-type rules (`validateWorkflow`)
|
|
114
|
+
* 2. Data-flow reference integrity (`${taskRef.output.*}` must reference an existing upstream task)
|
|
115
|
+
* 3. Control-flow completeness (FORK_JOIN <-> JOIN joinOn validity, non-empty branches)
|
|
116
|
+
* 4. Task configuration completeness metrics
|
|
117
|
+
*/
|
|
118
|
+
export declare function verifyWorkflowSemantics(def: WorkflowDef, autoFixedPrior?: string[]): VerificationSummary;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow Language Server (W-LSP)
|
|
3
|
+
*
|
|
4
|
+
* 提供工业级工作流静态分析、DAG 上游作用域推导、多源 Schema 自动推断、
|
|
5
|
+
* 零延迟确定性变量补全(Intellisense)、数据血缘图(DFG)构建与全图引用重构(Auto-Refactor)。
|
|
6
|
+
*/
|
|
7
|
+
import { WorkflowDef, TaskDef } from '../../types/conductor';
|
|
8
|
+
import { TaskExecutionData } from '../../types/workflow';
|
|
9
|
+
export type ValueType = 'string' | 'number' | 'boolean' | 'object' | 'array' | 'any';
|
|
10
|
+
export interface InferredField {
|
|
11
|
+
/** 字段相对路径,如 "response.body.id" 或 "result" */
|
|
12
|
+
path: string;
|
|
13
|
+
/** 完整 Conductor 引用表达式,如 "${http_get.output.response.body.id}" */
|
|
14
|
+
expression: string;
|
|
15
|
+
/** 推导出的字段类型 */
|
|
16
|
+
valueType: ValueType;
|
|
17
|
+
/** 运行态真实样本值预览(若存在) */
|
|
18
|
+
sampleValue?: string;
|
|
19
|
+
/** 描述说明 */
|
|
20
|
+
description?: string;
|
|
21
|
+
/** Schema 来源 */
|
|
22
|
+
source: 'runtime_sample' | 'schema_registry' | 'task_type_contract';
|
|
23
|
+
}
|
|
24
|
+
export interface WlspCompletionItem {
|
|
25
|
+
/** 展示名称 */
|
|
26
|
+
label: string;
|
|
27
|
+
/** 插入的完整表达式,如 "${fetch_user.output.userId}" */
|
|
28
|
+
value: string;
|
|
29
|
+
/** 分类 */
|
|
30
|
+
category: 'upstream' | 'workflow_input' | 'variable' | 'system';
|
|
31
|
+
/** 数据类型 */
|
|
32
|
+
valueType: ValueType;
|
|
33
|
+
/** 来源任务引用名或分组名 */
|
|
34
|
+
sourceRef: string;
|
|
35
|
+
/** 来源任务显示名称 */
|
|
36
|
+
sourceLabel: string;
|
|
37
|
+
/** 详细描述 */
|
|
38
|
+
description: string;
|
|
39
|
+
/** 运行态或默认值样本预览 */
|
|
40
|
+
sampleValue?: string;
|
|
41
|
+
/** 是否来自条件分支(可能未执行) */
|
|
42
|
+
isConditional?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface DataFlowEdge {
|
|
45
|
+
id: string;
|
|
46
|
+
sourceRef: string;
|
|
47
|
+
targetRef: string;
|
|
48
|
+
fieldPath: string;
|
|
49
|
+
expression: string;
|
|
50
|
+
sourceType: 'task_output' | 'workflow_variable';
|
|
51
|
+
isValidUpstream: boolean;
|
|
52
|
+
issue?: 'undefined_ref' | 'forward_ref' | 'sibling_branch_ref';
|
|
53
|
+
}
|
|
54
|
+
export interface DataFlowGraph {
|
|
55
|
+
edges: DataFlowEdge[];
|
|
56
|
+
diagnostics: Array<{
|
|
57
|
+
taskRef: string;
|
|
58
|
+
expression: string;
|
|
59
|
+
issue: 'undefined_ref' | 'forward_ref' | 'sibling_branch_ref';
|
|
60
|
+
message: string;
|
|
61
|
+
}>;
|
|
62
|
+
}
|
|
63
|
+
export interface UpstreamTaskInfo {
|
|
64
|
+
task: TaskDef;
|
|
65
|
+
/** 是否位于条件分支内部(非必经路径) */
|
|
66
|
+
isConditional: boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* 精确计算在 targetTaskRef 执行前所有合法的上游祖先节点
|
|
70
|
+
*/
|
|
71
|
+
export declare function getUpstreamAncestorsWithMeta(workflowDef: WorkflowDef | null | undefined, targetTaskRef: string): UpstreamTaskInfo[];
|
|
72
|
+
export declare function getUpstreamAncestors(workflowDef: WorkflowDef | null | undefined, targetTaskRef: string): TaskDef[];
|
|
73
|
+
/**
|
|
74
|
+
* 推导单个任务的输出 Schema 字段列表
|
|
75
|
+
*/
|
|
76
|
+
export declare function inferTaskOutputSchema(task: TaskDef, executionData?: Record<string, TaskExecutionData> | null): InferredField[];
|
|
77
|
+
/**
|
|
78
|
+
* 为指定目标任务生成零延迟确定性上下文补全项列表
|
|
79
|
+
*/
|
|
80
|
+
export declare function getCompletionItems(workflowDef: WorkflowDef | null | undefined, targetTaskRef: string, executionData?: Record<string, TaskExecutionData> | null, workflowInputSample?: Record<string, any> | null): WlspCompletionItem[];
|
|
81
|
+
/**
|
|
82
|
+
* 扁平化获取工作流中的所有任务列表
|
|
83
|
+
*/
|
|
84
|
+
export declare function getAllTasksFlat(tasks: TaskDef[] | undefined, acc?: TaskDef[]): TaskDef[];
|
|
85
|
+
/**
|
|
86
|
+
* 构建全图数据血缘依赖图 (DFG) 与编译期静态数据流诊断
|
|
87
|
+
*/
|
|
88
|
+
export declare function buildDataFlowGraph(workflowDef: WorkflowDef | null | undefined): DataFlowGraph;
|
|
89
|
+
/**
|
|
90
|
+
* 全图级联重构任务引用名 (Auto-Refactor TaskReferenceName)
|
|
91
|
+
*
|
|
92
|
+
* 当用户在属性面板修改某个节点的 taskReferenceName 时,自动扫描并更新:
|
|
93
|
+
* 1. 所有任务的 inputParameters / httpRequest / expression / loopCondition 中的 ${oldRef.xxx} 和 $.oldRef
|
|
94
|
+
* 2. 所有 JOIN 节点的 joinOn / defaultExclusiveJoinTask 列表
|
|
95
|
+
* 3. 工作流级别的 outputParameters
|
|
96
|
+
*/
|
|
97
|
+
export declare function refactorTaskReferenceName(workflowDef: WorkflowDef, oldRef: string, newRef: string): {
|
|
98
|
+
updatedDef: WorkflowDef;
|
|
99
|
+
replacedCount: number;
|
|
100
|
+
affectedTaskRefs: string[];
|
|
101
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { WorkflowDef, TaskDef } from '../types/conductor';
|
|
2
|
+
import type { BusinessWorkflowModel, BusinessStep } from './types';
|
|
3
|
+
import { ActionRegistry } from '../actions/registry';
|
|
4
|
+
export declare function compileStepToTaskDef(step: BusinessStep, index: number, workflowName: string, registry?: ActionRegistry): TaskDef;
|
|
5
|
+
export declare function compileStepModelToWorkflowDef(model: BusinessWorkflowModel, registry?: ActionRegistry): WorkflowDef;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { WorkflowDef, TaskDef } from '../types/conductor';
|
|
2
|
+
import type { BusinessWorkflowModel, BusinessStep } from './types';
|
|
3
|
+
import { ActionRegistry } from '../actions/registry';
|
|
4
|
+
export declare function decompileTaskDefToStep(task: TaskDef, index: number, registry?: ActionRegistry): BusinessStep;
|
|
5
|
+
export declare function decompileWorkflowDefToStepModel(def: WorkflowDef | null | undefined, registry?: ActionRegistry): BusinessWorkflowModel;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { TaskDef, WorkflowDef } from '../types/conductor';
|
|
2
|
+
export interface PillToken {
|
|
3
|
+
/** The Conductor reference path, e.g. "ecs_create_0.output.instanceId" or "workflow.input.userId" */
|
|
4
|
+
rawRef: string;
|
|
5
|
+
/** Human-friendly Chinese label, e.g. "实例ID" or "用户ID" */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Task or step origin label, e.g. "创建云主机" */
|
|
8
|
+
stepLabel?: string;
|
|
9
|
+
/** Optional formatting filter, e.g. "lowercase", "date" */
|
|
10
|
+
format?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 控制流节点类型
|
|
14
|
+
*/
|
|
15
|
+
export type StepControlType = 'decision' | 'fork' | 'loop';
|
|
16
|
+
/**
|
|
17
|
+
* 分支定义 (针对 DECISION / SWITCH)
|
|
18
|
+
*/
|
|
19
|
+
export interface BranchCase {
|
|
20
|
+
caseKey: string;
|
|
21
|
+
caseLabel?: string;
|
|
22
|
+
steps: BusinessStep[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 并行泳道 (针对 FORK_JOIN)
|
|
26
|
+
*/
|
|
27
|
+
export interface ForkLane {
|
|
28
|
+
laneId: string;
|
|
29
|
+
laneLabel?: string;
|
|
30
|
+
steps: BusinessStep[];
|
|
31
|
+
}
|
|
32
|
+
export interface BusinessStep {
|
|
33
|
+
id: string;
|
|
34
|
+
actionId: string;
|
|
35
|
+
taskReferenceName: string;
|
|
36
|
+
name: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
values: Record<string, any>;
|
|
39
|
+
/**
|
|
40
|
+
* If true, this step represents an unmapped technical Conductor task (e.g. raw JQ or custom Lambda)
|
|
41
|
+
* which is preserved losslessly as a read-only "Professional Step" card in business mode.
|
|
42
|
+
*/
|
|
43
|
+
isProFallback?: boolean;
|
|
44
|
+
rawTaskDef?: TaskDef;
|
|
45
|
+
controlType?: StepControlType;
|
|
46
|
+
caseParam?: string;
|
|
47
|
+
caseExpression?: string;
|
|
48
|
+
branches?: BranchCase[];
|
|
49
|
+
forkLanes?: ForkLane[];
|
|
50
|
+
pairedJoinTaskRef?: string;
|
|
51
|
+
loopCondition?: string;
|
|
52
|
+
loopSteps?: BusinessStep[];
|
|
53
|
+
}
|
|
54
|
+
export interface BusinessWorkflowModel {
|
|
55
|
+
name: string;
|
|
56
|
+
description?: string;
|
|
57
|
+
version?: number;
|
|
58
|
+
steps: BusinessStep[];
|
|
59
|
+
inputParameters?: any[];
|
|
60
|
+
rawWorkflowDef?: WorkflowDef;
|
|
61
|
+
}
|
package/dist/store/aiStore.d.ts
CHANGED
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
* isolation via IdeStoresContext — see store/ideStoresContext.tsx) and a default
|
|
9
9
|
* singleton (for callers outside that context, e.g. WorkflowIDE's shared canvas).
|
|
10
10
|
*/
|
|
11
|
-
import type { AiConfig } from '../services/ai/protocolAdapter';
|
|
11
|
+
import type { AiConfig, Message } from '../services/ai/protocolAdapter';
|
|
12
12
|
import type { WorkflowDef } from '../types/conductor';
|
|
13
13
|
import type { DiffSummary } from '../services/ai/toolExecutor';
|
|
14
|
+
import type { SynthesisPhase, VerificationSummary } from '../services/ai/workflowSynthesizer';
|
|
14
15
|
import type { WorkflowLevel } from '../types/workflowLibrary';
|
|
15
16
|
export interface AiChatMessage {
|
|
16
17
|
id: string;
|
|
@@ -26,6 +27,8 @@ export interface ProposedChange {
|
|
|
26
27
|
diff: DiffSummary;
|
|
27
28
|
/** Inferred workflow level based on sub-workflow references */
|
|
28
29
|
inferredLevel?: WorkflowLevel;
|
|
30
|
+
/** Holistic semantic & data-flow verification summary */
|
|
31
|
+
verification?: VerificationSummary;
|
|
29
32
|
/** Message that triggered this proposal */
|
|
30
33
|
messageId: string;
|
|
31
34
|
/**
|
|
@@ -34,6 +37,25 @@ export interface ProposedChange {
|
|
|
34
37
|
*/
|
|
35
38
|
baselineHash: string;
|
|
36
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* PI-style Durable Execution Checkpoint.
|
|
42
|
+
* Captures the complete state of an in-flight or interrupted multi-phase agent session
|
|
43
|
+
* so it can be resumed (`runner.resume()`) or committed (`runner.commitDraftNow()`)
|
|
44
|
+
* without re-running completed phases.
|
|
45
|
+
*/
|
|
46
|
+
export interface DurableSessionCheckpoint {
|
|
47
|
+
sessionId: string;
|
|
48
|
+
userPrompt: string;
|
|
49
|
+
assistantMsgId: string;
|
|
50
|
+
phase: SynthesisPhase;
|
|
51
|
+
workingDraft: WorkflowDef | null;
|
|
52
|
+
agentHistory: Message[];
|
|
53
|
+
stepIndex: number;
|
|
54
|
+
selfHealCount: number;
|
|
55
|
+
status: 'running' | 'paused' | 'failed' | 'completed';
|
|
56
|
+
lastError?: string;
|
|
57
|
+
updatedAt: number;
|
|
58
|
+
}
|
|
37
59
|
export interface RepairAction {
|
|
38
60
|
id: string;
|
|
39
61
|
label: string;
|
|
@@ -130,6 +152,12 @@ interface AiState {
|
|
|
130
152
|
* the correction is visible rather than silent.
|
|
131
153
|
*/
|
|
132
154
|
timelineEntries: TimelineEntry[];
|
|
155
|
+
/** Current progressive workflow synthesis phase ('idle' | 'blueprint' | 'topology' | 'configure' | 'verify' | 'completed') */
|
|
156
|
+
synthesisPhase: SynthesisPhase;
|
|
157
|
+
/** In-progress workflow draft accumulated across progressive synthesis stages */
|
|
158
|
+
workingDraft: WorkflowDef | null;
|
|
159
|
+
/** PI-style durable session checkpoint for pause/resume/fault-recovery */
|
|
160
|
+
durableCheckpoint: DurableSessionCheckpoint | null;
|
|
133
161
|
}
|
|
134
162
|
export interface TimelineEntry {
|
|
135
163
|
id: string;
|
|
@@ -174,12 +202,15 @@ interface AiActions {
|
|
|
174
202
|
clearRecommendation: () => void;
|
|
175
203
|
/** Queue a message to be sent through the AI pipeline by AiCommandCenter */
|
|
176
204
|
setPendingAutoSend: (msg: string | null) => void;
|
|
177
|
-
/** Restore conversation + pending proposal from a persisted draft (M1.4) */
|
|
178
|
-
hydrateFromDraft: (messages: AiChatMessage[], pendingProposal: ProposedChange | null) => void;
|
|
205
|
+
/** Restore conversation + pending proposal + optional durable checkpoint from a persisted draft (M1.4) */
|
|
206
|
+
hydrateFromDraft: (messages: AiChatMessage[], pendingProposal: ProposedChange | null, durableCheckpoint?: DurableSessionCheckpoint | null) => void;
|
|
179
207
|
setToolStatus: (status: string) => void;
|
|
180
208
|
setRetryInput: (input: string | null) => void;
|
|
181
209
|
addTimelineEntry: (label: string, icon?: 'done' | 'warning') => void;
|
|
182
210
|
clearTimeline: () => void;
|
|
211
|
+
setSynthesisStage: (phase: SynthesisPhase, draft?: WorkflowDef | null) => void;
|
|
212
|
+
saveCheckpoint: (checkpoint: DurableSessionCheckpoint | null) => void;
|
|
213
|
+
clearCheckpoint: () => void;
|
|
183
214
|
}
|
|
184
215
|
export type AiStore = AiState & AiActions;
|
|
185
216
|
/**
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { WorkflowDef } from '../types/conductor';
|
|
2
|
+
import type { WorkflowTemplate } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* 将用户在向导中填写的变量值注入到模板的 Conductor WorkflowDef 骨架中
|
|
5
|
+
*
|
|
6
|
+
* @param template 选中的工作流模板
|
|
7
|
+
* @param variableValues 用户填写的变量键值对
|
|
8
|
+
* @returns 注入参数后的完整 WorkflowDef
|
|
9
|
+
*/
|
|
10
|
+
export declare function applyTemplateVariables(template: WorkflowTemplate, variableValues: Record<string, any>): WorkflowDef;
|