@yiyi_zhang/reactflow-ui 0.5.0-beta.0 → 1.0.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 (86) hide show
  1. package/README.md +125 -117
  2. package/dist/AiWorkflowIDE.d.ts +2 -0
  3. package/dist/WorkflowIDE.d.ts +1 -2
  4. package/dist/ai.d.ts +5 -1
  5. package/dist/components/AICopilot/ParameterSuggester.d.ts +9 -0
  6. package/dist/components/AiNative/AgentTimeline.d.ts +11 -6
  7. package/dist/components/AiNative/InlineCanvasCopilot.d.ts +7 -0
  8. package/dist/components/AiNative/ProposalPreviewCard.d.ts +3 -3
  9. package/dist/components/BrandLogo.d.ts +13 -0
  10. package/dist/components/ExecutionWaterfallPanel.d.ts +3 -0
  11. package/dist/components/SandboxConfigModal.d.ts +7 -0
  12. package/dist/components/StructuredJsonViewer.d.ts +11 -0
  13. package/dist/components/nodes/NodeLayout.d.ts +3 -1
  14. package/dist/hooks/useNodeExecution.d.ts +5 -2
  15. package/dist/index.d.ts +4 -0
  16. package/dist/logo.svg +37 -0
  17. package/dist/product-launch.html +1400 -0
  18. package/dist/reactflow-ui-ai.es.js +21431 -10
  19. package/dist/reactflow-ui.css +1 -1
  20. package/dist/reactflow-ui.es.js +12224 -8310
  21. package/dist/reactflow-ui.umd.js +27 -20
  22. package/dist/services/ai/agentRunner.d.ts +23 -19
  23. package/dist/services/ai/draftPersistence.d.ts +3 -2
  24. package/dist/services/ai/systemPrompt.d.ts +1 -1
  25. package/dist/services/ai/toolExecutor.d.ts +15 -2
  26. package/dist/services/ai/workflowSynthesizer.d.ts +118 -0
  27. package/dist/services/wlsp/workflowLsp.d.ts +101 -0
  28. package/dist/store/aiStore.d.ts +34 -3
  29. package/dist/types/aiEvents.d.ts +3 -1
  30. package/dist/types/conductor.d.ts +6 -1
  31. package/dist/types/workflow.d.ts +32 -0
  32. package/dist/utils/localSandboxEngine.d.ts +49 -0
  33. package/package.json +7 -4
  34. package/dist/ai-BJwQZcGK.js +0 -15168
  35. package/dist/arc-BUGZGgtu.js +0 -83
  36. package/dist/architectureDiagram-3BPJPVTR-ZcgvTwSO.js +0 -4692
  37. package/dist/blockDiagram-GPEHLZMM-DtVtOBbH.js +0 -2418
  38. package/dist/c4Diagram-AAUBKEIU-tBS5Rcvm.js +0 -1577
  39. package/dist/channel-CURI9jmI.js +0 -5
  40. package/dist/chunk-2J33WTMH-D7gashNz.js +0 -19
  41. package/dist/chunk-4BX2VUAB-DE3VjyiZ.js +0 -8
  42. package/dist/chunk-55IACEB6-GYZ_m2MY.js +0 -8
  43. package/dist/chunk-727SXJPM-D4WVyvOg.js +0 -1528
  44. package/dist/chunk-AQP2D5EJ-Os2Uwqya.js +0 -1387
  45. package/dist/chunk-FMBD7UC4-B3CSVzS4.js +0 -19
  46. package/dist/chunk-ND2GUHAM-CNj_s1aK.js +0 -68
  47. package/dist/chunk-QZHKN3VN-DoV8iUKo.js +0 -15
  48. package/dist/classDiagram-4FO5ZUOK-Dr9C18x4.js +0 -16
  49. package/dist/classDiagram-v2-Q7XG4LA2-Dr9C18x4.js +0 -16
  50. package/dist/cose-bilkent-S5V4N54A-CgQlI-io.js +0 -2609
  51. package/dist/cytoscape.esm-kVAWcYoG.js +0 -18755
  52. package/dist/dagre-BM42HDAG-CFMIuOmS.js +0 -445
  53. package/dist/defaultLocale-BgPVtth8.js +0 -171
  54. package/dist/diagram-2AECGRRQ-C5jZp2YX.js +0 -217
  55. package/dist/diagram-5GNKFQAL-DRUVcHpp.js +0 -123
  56. package/dist/diagram-KO2AKTUF-BOl4aaej.js +0 -461
  57. package/dist/diagram-LMA3HP47-ZeckPR2Q.js +0 -142
  58. package/dist/diagram-OG6HWLK6-qUWeLfa-.js +0 -528
  59. package/dist/erDiagram-TEJ5UH35-Bw_CWS13.js +0 -899
  60. package/dist/flowDiagram-I6XJVG4X-D3xEvQA-.js +0 -1628
  61. package/dist/ganttDiagram-6RSMTGT7-D8GvenY3.js +0 -2707
  62. package/dist/gitGraphDiagram-PVQCEYII-BWrN_HOm.js +0 -815
  63. package/dist/graph-BRoPeNF3.js +0 -1545
  64. package/dist/infoDiagram-5YYISTIA-Da8FG5tB.js +0 -24
  65. package/dist/init-DjUOC4st.js +0 -16
  66. package/dist/ishikawaDiagram-YF4QCWOH-Bg2_mKEc.js +0 -621
  67. package/dist/journeyDiagram-JHISSGLW-sFIxGfua.js +0 -834
  68. package/dist/kanban-definition-UN3LZRKU-CGmopzHd.js +0 -724
  69. package/dist/katex-DoRnZ_sp.js +0 -11682
  70. package/dist/layout-D9EpM4Fg.js +0 -1728
  71. package/dist/linear-BA49eco4.js +0 -259
  72. package/dist/mermaid.core-XSpZEAKP.js +0 -16137
  73. package/dist/mindmap-definition-RKZ34NQL-Bqf76QGB.js +0 -827
  74. package/dist/ordinal-B6-f3MAq.js +0 -61
  75. package/dist/pieDiagram-4H26LBE5-hHiP8HzL.js +0 -163
  76. package/dist/quadrantDiagram-W4KKPZXB-DSccwH8B.js +0 -1024
  77. package/dist/requirementDiagram-4Y6WPE33-DIpyoYZ_.js +0 -882
  78. package/dist/sankeyDiagram-5OEKKPKP-DsaPqq8D.js +0 -847
  79. package/dist/sequenceDiagram-3UESZ5HK-BNg7orie.js +0 -2891
  80. package/dist/stateDiagram-AJRCARHV-Rv1mSmnJ.js +0 -263
  81. package/dist/stateDiagram-v2-BHNVJYJU-BME16k02.js +0 -16
  82. package/dist/timeline-definition-PNZ67QCA-CmmzdVk-.js +0 -1055
  83. package/dist/vennDiagram-CIIHVFJN-BQt00w9Q.js +0 -1557
  84. package/dist/wardley-L42UT6IY-D7b2ujEZ.js +0 -22512
  85. package/dist/wardleyDiagram-YWT4CUSO-LZpiODGN.js +0 -675
  86. package/dist/xychartDiagram-2RQKCTM6-BpJlv_mc.js +0 -1342
@@ -1,24 +1,17 @@
1
1
  /**
2
- * AgentRunner — the AI agentic loop, extracted from AiCommandCenter (M2.1)
2
+ * AgentRunner — PI-Style Durable Agent Runtime & Progressive Workflow Synthesizer
3
3
  *
4
- * Owns the entire multi-step tool-calling loop that used to live inline in a
5
- * 300-line useCallback: streaming the model, dispatching tool calls, self-healing
6
- * invalid proposals, and committing results (messages/proposal/plan/repair/
7
- * clarification/recommendation) to aiStore. This makes the orchestration logic
8
- * testable headlessly (see agentRunner.test.ts) and keeps AiCommandCenter as a
9
- * thin renderer of store state.
10
- *
11
- * Store access: this is the ONE place in the AI stack allowed to read
12
- * workflowStore/libraryStore/aiStore directly (via getState()) and call aiStore
13
- * actions to commit results — everything it calls into (toolExecutor,
14
- * systemPrompt, contextEngine) is a pure function that receives that state
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\u5177\u4F7F\u7528\u89C4\u5219\n1. **replace_workflow** \u2014 \u7528\u4E8E\uFF1A\u4ECE\u96F6\u521B\u5EFA\u5DE5\u4F5C\u6D41\u3001\u5927\u8303\u56F4\u7ED3\u6784\u91CD\u6784\u3002\u4F20\u5165\u5B8C\u6574\u7684 WorkflowDef JSON\u3002\n2. **patch_workflow** \u2014 \u7528\u4E8E\uFF1A\u5C40\u90E8\u53D8\u66F4\uFF08\u589E/\u6539/\u5220\u4EFB\u52A1\u3001\u4FEE\u6539\u5C5E\u6027\uFF09\u3002\u6BD4 replace_workflow \u66F4\u7CBE\u51C6\u3002ops \u652F\u6301\uFF1A\n - { op: 'add_task', task: TaskDef, afterRef?: string } \u2014 \u65B0\u589E\u4EFB\u52A1\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\n3. **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\u6CE8\u610F\uFF1Asystem prompt \u4E2D\u5DF2\u6CE8\u5165\u4E86\u5B9E\u65F6\u5DE5\u4F5C\u6D41\u4E0A\u4E0B\u6587\uFF0C\u901A\u5E38\u4E0D\u9700\u8981\u518D\u8C03\u7528\u6B64\u5DE5\u5177\u3002\n4. **validate_workflow** \u2014 \u6821\u9A8C\u5DE5\u4F5C\u6D41\u5408\u6CD5\u6027\uFF08read-only\uFF09\u3002\n5. **propose_plan** \u2014 \u5728\u6267\u884C\u590D\u6742\u591A\u6B65\u64CD\u4F5C\u524D\uFF0C\u5148\u5411\u7528\u6237\u5C55\u793A\u6267\u884C\u8BA1\u5212\u3002\u9002\u7528\u4E8E\uFF1A\u5927\u8303\u56F4\u91CD\u6784\uFF085+ \u6B65\uFF09\u3001\u62D3\u6251\u7ED3\u6784\u91CD\u5927\u53D8\u66F4\u3002\u8C03\u7528\u540E\u505C\u6B62\uFF0C\u7B49\u5F85\u7528\u6237\u786E\u8BA4\u3002\u7B80\u5355\u7684\u5355\u6B65\u64CD\u4F5C\u65E0\u9700\u5148\u63D0\u8BA1\u5212\u3002\n6. **\u4E0D\u8981**\u5728\u56DE\u590D\u4E2D\u76F4\u63A5\u8F93\u51FA\u5DE5\u4F5C\u6D41 JSON \u4EE3\u7801\u5757\uFF0C\u901A\u8FC7\u5DE5\u5177\u6267\u884C\u3002\n7. **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\n8. **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\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\u4E00\u53E5\u8BDD\u8BF4\u660E\u8981\u505A\u4EC0\u4E48\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\nSIMPLE, 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\n## \u5DE5\u4F5C\u6D41\u5EFA\u6A21\u89C4\u8303\n- \u6BCF\u4E2A\u4EFB\u52A1\u5FC5\u987B\u6709\u552F\u4E00\u7684 taskReferenceName\uFF08\u82F1\u6587\u4E0B\u5212\u7EBF\uFF0C\u5982 send_email\uFF09\n- SWITCH \u9700\u8981 caseValueParam \u6216 caseExpression\uFF0CdecisionCases \u952E\u503C\u5BF9\n- FORK_JOIN \u9700\u8981 forkTasks\uFF08\u4E8C\u7EF4\u6570\u7EC4\uFF09\u548C\u5BF9\u5E94\u7684 JOIN \u4EFB\u52A1\n- DO_WHILE \u9700\u8981 loopCondition \u548C loopOver \u6570\u7EC4\n- HTTP \u4EFB\u52A1\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";
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 'info'/'error': text to append to chat */
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
+ };
@@ -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
  /**
@@ -9,7 +9,7 @@
9
9
  * />
10
10
  * ```
11
11
  */
12
- export type AiEventType = 'proposal:created' | 'proposal:accepted' | 'proposal:accepted:partial' | 'proposal:rejected' | 'plan:created' | 'plan:executed' | 'plan:cancelled' | 'repair:proposed'
12
+ export type AiEventType = 'proposal:created' | 'proposal:accepted' | 'proposal:accepted:partial' | 'proposal:rejected' | 'stage:completed' | 'session:resumed' | 'plan:created' | 'plan:executed' | 'plan:cancelled' | 'repair:proposed'
13
13
  /** User clicked the inline second-click confirmation before a runtime-mutating repair action fires */
14
14
  | 'repair:confirmed' | 'repair:executed' | 'repair:dismissed' | 'tool:called' | 'undo:applied'
15
15
  /** AI request failed (network/HTTP/provider error). The user only ever sees a humanized
@@ -20,6 +20,8 @@ export interface AiEvent {
20
20
  timestamp: number;
21
21
  /** For tool:called events */
22
22
  tool?: string;
23
+ /** For stage:completed events */
24
+ phase?: string;
23
25
  /** For repair:executed / repair:confirmed events */
24
26
  repairActionType?: string;
25
27
  /** For proposal events: change counts */
@@ -54,7 +54,9 @@ export interface TaskDef {
54
54
  };
55
55
  sink?: string;
56
56
  evaluatorType?: 'graaljs' | 'javascript' | 'value-param' | 'python';
57
+ expression?: string;
57
58
  caseExpression?: string;
59
+ defaultExclusiveJoinTask?: string[];
58
60
  keepLastN?: number;
59
61
  forkTaskType?: string;
60
62
  forkTaskName?: string;
@@ -168,7 +170,7 @@ export interface TaskInstance {
168
170
  executed?: boolean;
169
171
  callbackFromWorker?: boolean;
170
172
  responseTimeoutSeconds?: number;
171
- workflowInstanceId: string;
173
+ workflowInstanceId?: string;
172
174
  workflowType?: string;
173
175
  taskId: string;
174
176
  reasonForIncompletion?: string;
@@ -176,6 +178,7 @@ export interface TaskInstance {
176
178
  workerId?: string;
177
179
  externalInputPayloadStoragePath?: string;
178
180
  externalOutputPayloadStoragePath?: string;
181
+ workflowTask?: TaskDef;
179
182
  }
180
183
  /**
181
184
  * Conductor 工作流实例 (运行时)
@@ -184,6 +187,8 @@ export interface WorkflowInstance {
184
187
  status: 'RUNNING' | 'COMPLETED' | 'FAILED' | 'TIMED_OUT' | 'TERMINATED' | 'PAUSED';
185
188
  endTime?: number;
186
189
  workflowId: string;
190
+ workflowName?: string;
191
+ workflowVersion?: number;
187
192
  parentWorkflowId?: string;
188
193
  parentWorkflowTaskId?: string;
189
194
  tasks: TaskInstance[];
@@ -213,6 +213,24 @@ export interface WorkflowState {
213
213
  showAnalysisPanel: boolean;
214
214
  /** P4.1 聚焦参数字段("去修复"跳转时使用) */
215
215
  focusedParamKey: string | null;
216
+ /** W-LSP: 是否在画布叠加显示数据血缘飞线 (Data Lineage DFG) */
217
+ showDataLineage: boolean;
218
+ /** W-LSP: 最近一次引用名重构提示结构 */
219
+ lastRefactorNotice: {
220
+ oldRef: string;
221
+ newRef: string;
222
+ replacedCount: number;
223
+ affectedTasks: string[];
224
+ timestamp: number;
225
+ } | null;
226
+ /** 运行态:是否显示底部并发瀑布流与时空回放面板 */
227
+ showWaterfallPanel: boolean;
228
+ /** 运行态:时空旅行回放游标时间戳 (ms),为 null 表示展示最终实时态 */
229
+ timeTravelTimestamp: number | null;
230
+ /** 运行态:每个 DO_WHILE 循环容器当前选中的迭代轮次 (loopRef -> iteration) */
231
+ activeLoopIterations: Record<string, number>;
232
+ /** AI 共驾:画布原位 Cmd+K 浮窗当前锚定的任务引用名 */
233
+ inlineCopilotTaskRef: string | null;
216
234
  }
217
235
  /**
218
236
  * 工作流操作接口
@@ -264,6 +282,20 @@ export interface WorkflowActions {
264
282
  setRunState: (state: RunState, execId?: string | null, error?: string | null) => void;
265
283
  /** P4.3: 切回 edit 模式并聚焦到指定任务的指定参数字段 */
266
284
  switchToEditAndFocusParam: (taskRef: string, paramKey?: string) => void;
285
+ /** W-LSP: 切换数据血缘飞线叠加显示 */
286
+ setShowDataLineage: (show: boolean) => void;
287
+ /** W-LSP: 清除重构提示文案 */
288
+ clearRefactorNotice: () => void;
289
+ /** 运行态:切换底部并发瀑布流面板 */
290
+ setShowWaterfallPanel: (show: boolean) => void;
291
+ /** 运行态:设置时空旅行时间戳 */
292
+ setTimeTravelTimestamp: (ts: number | null) => void;
293
+ /** 运行态:切换指定 DO_WHILE 循环容器的展示迭代轮次 */
294
+ setLoopIteration: (loopRef: string, iteration: number) => void;
295
+ /** AI 共驾:打开/关闭画布原位 Cmd+K 浮窗 */
296
+ setInlineCopilotTaskRef: (taskRef: string | null) => void;
297
+ /** 本地沙箱:在浏览器内执行零延迟确定性试运行并进入调试视图 */
298
+ runLocalSandboxDryRun: (mockInput?: Record<string, any>, taskMocks?: Record<string, any>, maxLoopIterations?: number) => void;
267
299
  }
268
300
  /**
269
301
  * 重启选项
@@ -0,0 +1,49 @@
1
+ import type { WorkflowDef, TaskDef as WorkflowTask, WorkflowInstance, TaskInstance as TaskExecution } from '../types/conductor';
2
+ export interface TaskMockOverride {
3
+ __isMockOverride?: boolean;
4
+ /** Override execution status (e.g. simulate FAILED or TIMED_OUT) */
5
+ status?: 'COMPLETED' | 'FAILED' | 'TIMED_OUT' | 'COMPLETED_WITH_ERRORS';
6
+ /** Override simulated execution duration in ms */
7
+ durationMs?: number;
8
+ /** For SWITCH / DECISION tasks: force routing to a specific case key (or '__default__') */
9
+ forceCase?: string;
10
+ /** Custom outputData JSON for this task */
11
+ outputData?: Record<string, any>;
12
+ /** Custom error message when status is FAILED / TIMED_OUT */
13
+ reasonForIncompletion?: string;
14
+ }
15
+ export interface SandboxDryRunOptions {
16
+ /** Mock workflow input JSON */
17
+ workflowInput?: Record<string, any>;
18
+ /** Custom task output or behavior overrides keyed by taskReferenceName */
19
+ taskMocks?: Record<string, Record<string, any> | TaskMockOverride>;
20
+ /** Max iterations per DO_WHILE loop in dry-run (default: 2) */
21
+ maxLoopIterations?: number;
22
+ }
23
+ interface SandboxRuntimeContext {
24
+ workflowInput: Record<string, any>;
25
+ variables: Record<string, any>;
26
+ taskOutputs: Record<string, Record<string, any>>;
27
+ taskMocks: Record<string, Record<string, any> | TaskMockOverride>;
28
+ tasks: TaskExecution[];
29
+ currentTimeMs: number;
30
+ maxLoopIterations: number;
31
+ seqCounter: number;
32
+ }
33
+ /**
34
+ * Resolve Conductor `${...}` expressions against current sandbox context
35
+ */
36
+ export declare function resolveExpressionValue(val: any, ctx: SandboxRuntimeContext): any;
37
+ /**
38
+ * Generate default synthetic output for a given task (used both at runtime and as UI template preview)
39
+ */
40
+ export declare function generateDefaultTaskOutputPreview(task: WorkflowTask, resolvedInput?: Record<string, any>, iteration?: number): Record<string, any>;
41
+ /**
42
+ * Build default mock input from workflowDef.inputParameters and auto-discovered ${workflow.input.*} references
43
+ */
44
+ export declare function buildDefaultWorkflowMockInput(workflowDef: WorkflowDef): Record<string, any>;
45
+ /**
46
+ * Execute an entire WorkflowDef in-browser deterministically and return a complete WorkflowInstance
47
+ */
48
+ export declare function executeLocalSandboxDryRun(workflowDef: WorkflowDef, options?: SandboxDryRunOptions): WorkflowInstance;
49
+ export {};