@synergenius/flow-weaver-pack-weaver 0.9.0 → 0.9.4

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 (235) hide show
  1. package/dist/bot/ai-client.d.ts +22 -2
  2. package/dist/bot/ai-client.d.ts.map +1 -1
  3. package/dist/bot/ai-client.js +168 -20
  4. package/dist/bot/ai-client.js.map +1 -1
  5. package/dist/bot/ansi.d.ts +13 -0
  6. package/dist/bot/ansi.d.ts.map +1 -0
  7. package/dist/bot/ansi.js +13 -0
  8. package/dist/bot/ansi.js.map +1 -0
  9. package/dist/bot/assistant-core.d.ts +25 -0
  10. package/dist/bot/assistant-core.d.ts.map +1 -0
  11. package/dist/bot/assistant-core.js +272 -0
  12. package/dist/bot/assistant-core.js.map +1 -0
  13. package/dist/bot/assistant-tools.d.ts +10 -0
  14. package/dist/bot/assistant-tools.d.ts.map +1 -0
  15. package/dist/bot/assistant-tools.js +324 -0
  16. package/dist/bot/assistant-tools.js.map +1 -0
  17. package/dist/bot/audit-logger.d.ts.map +1 -1
  18. package/dist/bot/audit-logger.js +9 -5
  19. package/dist/bot/audit-logger.js.map +1 -1
  20. package/dist/bot/bot-manager.d.ts +49 -0
  21. package/dist/bot/bot-manager.d.ts.map +1 -0
  22. package/dist/bot/bot-manager.js +279 -0
  23. package/dist/bot/bot-manager.js.map +1 -0
  24. package/dist/bot/child-process-tracker.d.ts +6 -0
  25. package/dist/bot/child-process-tracker.d.ts.map +1 -0
  26. package/dist/bot/child-process-tracker.js +35 -0
  27. package/dist/bot/child-process-tracker.js.map +1 -0
  28. package/dist/bot/cli-provider.d.ts.map +1 -1
  29. package/dist/bot/cli-provider.js +13 -8
  30. package/dist/bot/cli-provider.js.map +1 -1
  31. package/dist/bot/conversation-store.d.ts +40 -0
  32. package/dist/bot/conversation-store.d.ts.map +1 -0
  33. package/dist/bot/conversation-store.js +182 -0
  34. package/dist/bot/conversation-store.js.map +1 -0
  35. package/dist/bot/error-classifier.d.ts +27 -0
  36. package/dist/bot/error-classifier.d.ts.map +1 -0
  37. package/dist/bot/error-classifier.js +71 -0
  38. package/dist/bot/error-classifier.js.map +1 -0
  39. package/dist/bot/error-guide.d.ts +5 -0
  40. package/dist/bot/error-guide.d.ts.map +1 -0
  41. package/dist/bot/error-guide.js +5 -0
  42. package/dist/bot/error-guide.js.map +1 -0
  43. package/dist/bot/knowledge-store.d.ts +17 -0
  44. package/dist/bot/knowledge-store.d.ts.map +1 -0
  45. package/dist/bot/knowledge-store.js +53 -0
  46. package/dist/bot/knowledge-store.js.map +1 -0
  47. package/dist/bot/paths.d.ts +11 -0
  48. package/dist/bot/paths.d.ts.map +1 -0
  49. package/dist/bot/paths.js +26 -0
  50. package/dist/bot/paths.js.map +1 -0
  51. package/dist/bot/retry-utils.d.ts +5 -0
  52. package/dist/bot/retry-utils.d.ts.map +1 -0
  53. package/dist/bot/retry-utils.js +5 -0
  54. package/dist/bot/retry-utils.js.map +1 -0
  55. package/dist/bot/runner.d.ts.map +1 -1
  56. package/dist/bot/runner.js +12 -1
  57. package/dist/bot/runner.js.map +1 -1
  58. package/dist/bot/safety.d.ts +10 -0
  59. package/dist/bot/safety.d.ts.map +1 -0
  60. package/dist/bot/safety.js +14 -0
  61. package/dist/bot/safety.js.map +1 -0
  62. package/dist/bot/session-state.d.ts.map +1 -1
  63. package/dist/bot/session-state.js +3 -1
  64. package/dist/bot/session-state.js.map +1 -1
  65. package/dist/bot/steering.js +2 -2
  66. package/dist/bot/steering.js.map +1 -1
  67. package/dist/bot/step-executor.d.ts +10 -5
  68. package/dist/bot/step-executor.d.ts.map +1 -1
  69. package/dist/bot/step-executor.js +252 -3
  70. package/dist/bot/step-executor.js.map +1 -1
  71. package/dist/bot/system-prompt.d.ts +1 -1
  72. package/dist/bot/system-prompt.d.ts.map +1 -1
  73. package/dist/bot/system-prompt.js +69 -43
  74. package/dist/bot/system-prompt.js.map +1 -1
  75. package/dist/bot/task-decomposer.d.ts +24 -0
  76. package/dist/bot/task-decomposer.d.ts.map +1 -0
  77. package/dist/bot/task-decomposer.js +75 -0
  78. package/dist/bot/task-decomposer.js.map +1 -0
  79. package/dist/bot/task-queue.d.ts +17 -4
  80. package/dist/bot/task-queue.d.ts.map +1 -1
  81. package/dist/bot/task-queue.js +83 -5
  82. package/dist/bot/task-queue.js.map +1 -1
  83. package/dist/bot/terminal-renderer.d.ts +60 -0
  84. package/dist/bot/terminal-renderer.d.ts.map +1 -0
  85. package/dist/bot/terminal-renderer.js +204 -0
  86. package/dist/bot/terminal-renderer.js.map +1 -0
  87. package/dist/bot/tool-registry.d.ts +24 -0
  88. package/dist/bot/tool-registry.d.ts.map +1 -0
  89. package/dist/bot/tool-registry.js +458 -0
  90. package/dist/bot/tool-registry.js.map +1 -0
  91. package/dist/bot/types.d.ts +7 -0
  92. package/dist/bot/types.d.ts.map +1 -1
  93. package/dist/bot/weaver-tools.d.ts +18 -0
  94. package/dist/bot/weaver-tools.d.ts.map +1 -0
  95. package/dist/bot/weaver-tools.js +124 -0
  96. package/dist/bot/weaver-tools.js.map +1 -0
  97. package/dist/cli-bridge.d.ts.map +1 -1
  98. package/dist/cli-bridge.js +5 -1
  99. package/dist/cli-bridge.js.map +1 -1
  100. package/dist/cli-handlers.d.ts +13 -1
  101. package/dist/cli-handlers.d.ts.map +1 -1
  102. package/dist/cli-handlers.js +615 -48
  103. package/dist/cli-handlers.js.map +1 -1
  104. package/dist/mcp-tools.js +2 -2
  105. package/dist/mcp-tools.js.map +1 -1
  106. package/dist/node-types/abort-task.d.ts.map +1 -1
  107. package/dist/node-types/abort-task.js +4 -3
  108. package/dist/node-types/abort-task.js.map +1 -1
  109. package/dist/node-types/agent-execute.d.ts +38 -0
  110. package/dist/node-types/agent-execute.d.ts.map +1 -0
  111. package/dist/node-types/agent-execute.js +252 -0
  112. package/dist/node-types/agent-execute.js.map +1 -0
  113. package/dist/node-types/bot-report.d.ts +5 -3
  114. package/dist/node-types/bot-report.d.ts.map +1 -1
  115. package/dist/node-types/bot-report.js +39 -7
  116. package/dist/node-types/bot-report.js.map +1 -1
  117. package/dist/node-types/build-context.d.ts +3 -3
  118. package/dist/node-types/build-context.d.ts.map +1 -1
  119. package/dist/node-types/build-context.js +108 -24
  120. package/dist/node-types/build-context.js.map +1 -1
  121. package/dist/node-types/detect-provider.d.ts +2 -2
  122. package/dist/node-types/detect-provider.d.ts.map +1 -1
  123. package/dist/node-types/detect-provider.js +3 -1
  124. package/dist/node-types/detect-provider.js.map +1 -1
  125. package/dist/node-types/exec-validate-retry.d.ts.map +1 -1
  126. package/dist/node-types/exec-validate-retry.js +43 -6
  127. package/dist/node-types/exec-validate-retry.js.map +1 -1
  128. package/dist/node-types/execute-plan.d.ts.map +1 -1
  129. package/dist/node-types/execute-plan.js +31 -8
  130. package/dist/node-types/execute-plan.js.map +1 -1
  131. package/dist/node-types/execute-target.d.ts.map +1 -1
  132. package/dist/node-types/execute-target.js +3 -1
  133. package/dist/node-types/execute-target.js.map +1 -1
  134. package/dist/node-types/fix-errors.d.ts.map +1 -1
  135. package/dist/node-types/fix-errors.js +21 -5
  136. package/dist/node-types/fix-errors.js.map +1 -1
  137. package/dist/node-types/genesis-observe.d.ts.map +1 -1
  138. package/dist/node-types/genesis-observe.js +3 -1
  139. package/dist/node-types/genesis-observe.js.map +1 -1
  140. package/dist/node-types/genesis-report.js +4 -1
  141. package/dist/node-types/genesis-report.js.map +1 -1
  142. package/dist/node-types/git-ops.d.ts.map +1 -1
  143. package/dist/node-types/git-ops.js +98 -4
  144. package/dist/node-types/git-ops.js.map +1 -1
  145. package/dist/node-types/index.d.ts +2 -0
  146. package/dist/node-types/index.d.ts.map +1 -1
  147. package/dist/node-types/index.js +2 -0
  148. package/dist/node-types/index.js.map +1 -1
  149. package/dist/node-types/load-config.d.ts +2 -2
  150. package/dist/node-types/load-config.d.ts.map +1 -1
  151. package/dist/node-types/load-config.js.map +1 -1
  152. package/dist/node-types/plan-task.d.ts.map +1 -1
  153. package/dist/node-types/plan-task.js +14 -2
  154. package/dist/node-types/plan-task.js.map +1 -1
  155. package/dist/node-types/read-workflow.js +8 -2
  156. package/dist/node-types/read-workflow.js.map +1 -1
  157. package/dist/node-types/receive-task.d.ts.map +1 -1
  158. package/dist/node-types/receive-task.js +35 -26
  159. package/dist/node-types/receive-task.js.map +1 -1
  160. package/dist/node-types/send-notify.js +2 -1
  161. package/dist/node-types/send-notify.js.map +1 -1
  162. package/dist/node-types/validate-gate.d.ts +18 -0
  163. package/dist/node-types/validate-gate.d.ts.map +1 -0
  164. package/dist/node-types/validate-gate.js +96 -0
  165. package/dist/node-types/validate-gate.js.map +1 -0
  166. package/dist/workflows/genesis-task.d.ts +20 -12
  167. package/dist/workflows/genesis-task.d.ts.map +1 -1
  168. package/dist/workflows/genesis-task.js +20 -12
  169. package/dist/workflows/genesis-task.js.map +1 -1
  170. package/dist/workflows/weaver-agent.d.ts +35 -0
  171. package/dist/workflows/weaver-agent.d.ts.map +1 -0
  172. package/dist/workflows/weaver-agent.js +777 -0
  173. package/dist/workflows/weaver-agent.js.map +1 -0
  174. package/dist/workflows/weaver-bot-batch.d.ts +19 -26
  175. package/dist/workflows/weaver-bot-batch.d.ts.map +1 -1
  176. package/dist/workflows/weaver-bot-batch.js +1043 -27
  177. package/dist/workflows/weaver-bot-batch.js.map +1 -1
  178. package/dist/workflows/weaver-bot.d.ts +21 -35
  179. package/dist/workflows/weaver-bot.d.ts.map +1 -1
  180. package/dist/workflows/weaver-bot.js +1119 -36
  181. package/dist/workflows/weaver-bot.js.map +1 -1
  182. package/flowweaver.manifest.json +21 -1
  183. package/package.json +5 -2
  184. package/src/bot/ai-client.ts +180 -19
  185. package/src/bot/ansi.ts +12 -0
  186. package/src/bot/assistant-core.ts +312 -0
  187. package/src/bot/assistant-tools.ts +318 -0
  188. package/src/bot/audit-logger.ts +6 -5
  189. package/src/bot/bot-manager.ts +293 -0
  190. package/src/bot/child-process-tracker.ts +40 -0
  191. package/src/bot/cli-provider.ts +13 -8
  192. package/src/bot/conversation-store.ts +222 -0
  193. package/src/bot/error-classifier.ts +90 -0
  194. package/src/bot/error-guide.ts +4 -0
  195. package/src/bot/knowledge-store.ts +59 -0
  196. package/src/bot/paths.ts +27 -0
  197. package/src/bot/retry-utils.ts +4 -0
  198. package/src/bot/runner.ts +12 -1
  199. package/src/bot/safety.ts +16 -0
  200. package/src/bot/session-state.ts +2 -1
  201. package/src/bot/steering.ts +2 -2
  202. package/src/bot/step-executor.ts +313 -5
  203. package/src/bot/system-prompt.ts +70 -47
  204. package/src/bot/task-decomposer.ts +100 -0
  205. package/src/bot/task-queue.ts +100 -8
  206. package/src/bot/terminal-renderer.ts +238 -0
  207. package/src/bot/tool-registry.ts +477 -0
  208. package/src/bot/types.ts +8 -0
  209. package/src/bot/weaver-tools.ts +134 -0
  210. package/src/cli-bridge.ts +7 -1
  211. package/src/cli-handlers.ts +624 -48
  212. package/src/mcp-tools.ts +2 -2
  213. package/src/node-types/abort-task.ts +5 -4
  214. package/src/node-types/agent-execute.ts +303 -0
  215. package/src/node-types/bot-report.ts +40 -9
  216. package/src/node-types/build-context.ts +112 -25
  217. package/src/node-types/detect-provider.ts +4 -3
  218. package/src/node-types/exec-validate-retry.ts +47 -8
  219. package/src/node-types/execute-plan.ts +32 -8
  220. package/src/node-types/execute-target.ts +2 -1
  221. package/src/node-types/fix-errors.ts +20 -5
  222. package/src/node-types/genesis-observe.ts +2 -1
  223. package/src/node-types/genesis-report.ts +1 -1
  224. package/src/node-types/git-ops.ts +93 -4
  225. package/src/node-types/index.ts +2 -0
  226. package/src/node-types/load-config.ts +3 -3
  227. package/src/node-types/plan-task.ts +15 -3
  228. package/src/node-types/read-workflow.ts +2 -2
  229. package/src/node-types/receive-task.ts +31 -26
  230. package/src/node-types/send-notify.ts +1 -1
  231. package/src/node-types/validate-gate.ts +112 -0
  232. package/src/workflows/genesis-task.ts +20 -12
  233. package/src/workflows/weaver-agent.ts +799 -0
  234. package/src/workflows/weaver-bot-batch.ts +1049 -27
  235. package/src/workflows/weaver-bot.ts +1123 -36
@@ -1,60 +1,1143 @@
1
1
  // Managed weaver bot workflow - autonomous task creation and management.
2
2
  // Run `weaver eject` to customize.
3
+ import { weaverLoadConfig } from '../node-types/load-config.js';
4
+ import { weaverDetectProvider } from '../node-types/detect-provider.js';
5
+ import { weaverReceiveTask } from '../node-types/receive-task.js';
6
+ import { weaverRouteTask } from '../node-types/route-task.js';
7
+ import { weaverReadWorkflow } from '../node-types/read-workflow.js';
8
+ import { weaverBuildContext } from '../node-types/build-context.js';
9
+ import { weaverPlanTask } from '../node-types/plan-task.js';
10
+ import { weaverApprovalGate } from '../node-types/approval-gate.js';
11
+ import { weaverAbortTask } from '../node-types/abort-task.js';
12
+ import { weaverExecValidateRetry } from '../node-types/exec-validate-retry.js';
13
+ import { weaverGitOps } from '../node-types/git-ops.js';
14
+ import { weaverSendNotify } from '../node-types/send-notify.js';
15
+ import { weaverBotReport } from '../node-types/bot-report.js';
16
+ // @flow-weaver-runtime-start
17
+ // ============================================================================
18
+ // DO NOT EDIT - This section is auto-generated by Flow Weaver
19
+ // ============================================================================
20
+ import { GeneratedExecutionContext, CancellationError } from '@synergenius/flow-weaver/runtime';
21
+ // @flow-weaver-runtime-end
3
22
  /**
4
- * Autonomous workflow bot. Routes by task type, branches on approval,
5
- * retries validation failures via scoped execution, fans out to git
6
- * and notifications in parallel, merges all paths at report.
7
- *
8
23
  * @flowWeaver workflow
9
- *
10
- * @node cfg weaverLoadConfig [color: "teal"] [icon: "settings"] [position: 200 200]
11
- * @node detect weaverDetectProvider [color: "cyan"] [icon: "search"] [position: 400 200]
12
- * @node receive weaverReceiveTask [color: "blue"] [icon: "send"] [position: 600 200]
13
- * @node route weaverRouteTask [color: "purple"] [icon: "flow"] [position: 800 200]
14
- *
15
- * @node readWf weaverReadWorkflow [color: "cyan"] [icon: "description"] [position: 1000 450]
16
- *
17
- * @node context weaverBuildContext [color: "teal"] [icon: "code"] [position: 1000 200]
18
- * @node plan weaverPlanTask [color: "blue"] [icon: "psychology"] [position: 1200 200]
19
- * @node approve weaverApprovalGate [color: "orange"] [icon: "send"] [position: 1400 200]
20
- *
21
- * @node abort weaverAbortTask [color: "red"] [icon: "code"] [position: 1600 450]
22
- *
23
- * @node execRetry weaverExecValidateRetry [color: "purple"] [icon: "code"] [position: 1600 200]
24
- *
25
- * @node gitOps weaverGitOps [color: "green"] [icon: "code"] [position: 1800 100]
26
- * @node notify weaverSendNotify [color: "yellow"] [icon: "send"] [position: 1800 300]
27
- *
28
- * @node report weaverBotReport [color: "green"] [icon: "description"] [position: 2000 200]
29
- *
24
+ * @node cfg weaverLoadConfig [color: "teal"] [icon: "settings"] [position: 200 200]
25
+ * @node detect weaverDetectProvider [color: "cyan"] [icon: "search"] [position: 400 200] [suppress: "OBJECT_TYPE_MISMATCH", "ANNOTATION_SIGNATURE_TYPE_MISMATCH"]
26
+ * @node receive weaverReceiveTask [color: "blue"] [icon: "send"] [position: 600 200]
27
+ * @node route weaverRouteTask [color: "purple"] [icon: "flow"] [position: 800 200]
28
+ * @node readWf weaverReadWorkflow [color: "cyan"] [icon: "description"] [position: 1000 450]
29
+ * @node context weaverBuildContext [color: "teal"] [icon: "code"] [position: 1000 200]
30
+ * @node plan weaverPlanTask [color: "blue"] [icon: "psychology"] [position: 1200 200]
31
+ * @node approve weaverApprovalGate [color: "orange"] [icon: "send"] [position: 1400 200]
32
+ * @node abort weaverAbortTask [color: "red"] [icon: "code"] [position: 1600 450]
33
+ * @node execRetry weaverExecValidateRetry [color: "purple"] [icon: "code"] [position: 1600 200]
34
+ * @node gitOps weaverGitOps [color: "green"] [icon: "code"] [position: 1800 100]
35
+ * @node notify weaverSendNotify [color: "yellow"] [icon: "send"] [position: 1800 300] [suppress: "UNUSED_OUTPUT_PORT"]
36
+ * @node report weaverBotReport [color: "green"] [icon: "description"] [position: 2000 200] [suppress: "UNUSED_OUTPUT_PORT", "DESIGN_ASYNC_NO_ERROR_PATH"]
30
37
  * @path Start -> cfg -> detect -> receive -> route -> context -> plan -> approve -> execRetry -> gitOps -> report -> Exit
31
38
  * @path execRetry -> notify
32
39
  * @path route:fail -> readWf
33
40
  * @path approve:fail -> abort
34
- *
41
+ * @path receive:fail -> report
42
+ * @path plan:fail -> report
43
+ * @path execRetry:fail -> report
44
+ * @position Start 0 200
45
+ * @position Exit 2200 200
35
46
  * @connect readWf.onSuccess -> report.execute
36
47
  * @connect abort.onSuccess -> report.execute
37
48
  * @connect notify.onSuccess -> report.execute
38
- *
39
49
  * @connect gitOps.ctx -> report.mainCtx
40
50
  * @connect readWf.ctx -> report.readCtx
41
51
  * @connect abort.ctx -> report.abortCtx
42
- *
43
52
  * @connect report.summary -> Exit.summary
44
- *
45
- * @position Start 0 200
46
- * @position Exit 2200 200
47
- *
48
53
  * @param execute [order:-1] - Execute
49
- * @param taskJson [order:0] [optional] - Task instruction (JSON)
50
- * @param projectDir [order:1] [optional] - Project directory
54
+ * @param taskJson [order:0] - TaskJson
55
+ * @param projectDir [order:1] - ProjectDir
51
56
  * @returns onSuccess [order:-2] - On Success
52
- * @returns onFailure [order:-1] [hidden] - On Failure
57
+ * @returns onFailure [order:-1] - On Failure
53
58
  * @returns summary [order:0] - Summary text
54
59
  */
55
60
  export async function weaverBot(execute, params, __abortSignal__) {
56
61
  // @flow-weaver-body-start
57
- // (auto-generated by compiler)
62
+ // ============================================================================
63
+ // DO NOT EDIT - This section is auto-generated by Flow Weaver
64
+ // Edit the @flowWeaver annotations above to modify workflow behavior
65
+ // ============================================================================
66
+ const __effectiveDebugger__ = typeof __flowWeaverDebugger__ !== 'undefined' ? __flowWeaverDebugger__ : undefined;
67
+ // Recursion depth protection
68
+ const __rd__ = params.__rd__ ?? 0;
69
+ if (__rd__ >= 1000) {
70
+ throw new Error('Max recursion depth exceeded (1000) in workflow "weaverBot"');
71
+ }
72
+ const ctx = new GeneratedExecutionContext(true, __effectiveDebugger__, __abortSignal__);
73
+ // Debug controller for step-through debugging and checkpoint/resume
74
+ const __ctrl__ = (typeof globalThis !== 'undefined' && globalThis.__fw_debug_controller__
75
+ ? globalThis.__fw_debug_controller__
76
+ : { beforeNode: () => true, afterNode: () => { } });
77
+ const startIdx = ctx.addExecution('Start');
78
+ await ctx.setVariable({ id: 'Start', portName: 'execute', executionIndex: startIdx, nodeTypeName: 'Start' }, execute);
79
+ await ctx.setVariable({ id: 'Start', portName: 'taskJson', executionIndex: startIdx, nodeTypeName: 'Start' }, params.taskJson);
80
+ await ctx.setVariable({ id: 'Start', portName: 'projectDir', executionIndex: startIdx, nodeTypeName: 'Start' }, params.projectDir);
81
+ await ctx.sendStatusChangedEvent({
82
+ nodeTypeName: 'Start',
83
+ id: 'Start',
84
+ executionIndex: startIdx,
85
+ status: 'SUCCEEDED',
86
+ });
87
+ let cfgIdx;
88
+ let detectIdx;
89
+ let receiveIdx;
90
+ let routeIdx;
91
+ let readWfIdx;
92
+ let contextIdx;
93
+ let planIdx;
94
+ let approveIdx;
95
+ let abortIdx;
96
+ let execRetryIdx;
97
+ let gitOpsIdx;
98
+ let notifyIdx;
99
+ let reportIdx;
100
+ let cfg_success = false;
101
+ let detect_success = false;
102
+ let receive_success = false;
103
+ if (await __ctrl__.beforeNode('cfg', ctx)) {
104
+ // ── cfg (weaverLoadConfig) ──
105
+ ctx.checkAborted('cfg');
106
+ cfgIdx = ctx.addExecution('cfg');
107
+ if (typeof globalThis !== 'undefined')
108
+ globalThis.__fw_current_node_id__ = 'cfg';
109
+ await ctx.sendStatusChangedEvent({
110
+ nodeTypeName: 'weaverLoadConfig',
111
+ id: 'cfg',
112
+ executionIndex: cfgIdx,
113
+ status: 'RUNNING',
114
+ });
115
+ cfg_success = false;
116
+ try {
117
+ await ctx.setVariable({ id: 'cfg', portName: 'execute', executionIndex: cfgIdx, nodeTypeName: 'weaverLoadConfig' }, true);
118
+ const cfg_projectDir = await ctx.getVariable({ id: 'Start', portName: 'projectDir', executionIndex: startIdx });
119
+ await ctx.setVariable({ id: 'cfg', portName: 'projectDir', executionIndex: cfgIdx, nodeTypeName: 'weaverLoadConfig' }, cfg_projectDir);
120
+ const cfgResult = weaverLoadConfig(cfg_projectDir);
121
+ await ctx.setVariable({ id: 'cfg', portName: 'projectDir', executionIndex: cfgIdx, nodeTypeName: 'weaverLoadConfig' }, cfgResult.projectDir);
122
+ await ctx.setVariable({ id: 'cfg', portName: 'config', executionIndex: cfgIdx, nodeTypeName: 'weaverLoadConfig' }, cfgResult.config);
123
+ await ctx.setVariable({ id: 'cfg', portName: 'onSuccess', executionIndex: cfgIdx, nodeTypeName: 'weaverLoadConfig' }, true);
124
+ await ctx.setVariable({ id: 'cfg', portName: 'onFailure', executionIndex: cfgIdx, nodeTypeName: 'weaverLoadConfig' }, false);
125
+ await ctx.sendStatusChangedEvent({
126
+ nodeTypeName: 'weaverLoadConfig',
127
+ id: 'cfg',
128
+ executionIndex: cfgIdx,
129
+ status: 'SUCCEEDED',
130
+ });
131
+ await __ctrl__.afterNode('cfg', ctx);
132
+ cfg_success = true;
133
+ }
134
+ catch (error) {
135
+ const isCancellation = CancellationError.isCancellationError(error);
136
+ await ctx.sendStatusChangedEvent({
137
+ nodeTypeName: 'weaverLoadConfig',
138
+ id: 'cfg',
139
+ executionIndex: cfgIdx,
140
+ status: isCancellation ? 'CANCELLED' : 'FAILED',
141
+ });
142
+ if (!isCancellation) {
143
+ ctx.sendLogErrorEvent({
144
+ nodeTypeName: 'weaverLoadConfig',
145
+ id: 'cfg',
146
+ executionIndex: cfgIdx,
147
+ error: error instanceof Error ? error.message : String(error),
148
+ });
149
+ await ctx.setVariable({ id: 'cfg', portName: 'onSuccess', executionIndex: cfgIdx, nodeTypeName: 'weaverLoadConfig' }, false);
150
+ await ctx.setVariable({ id: 'cfg', portName: 'onFailure', executionIndex: cfgIdx, nodeTypeName: 'weaverLoadConfig' }, true);
151
+ cfg_success = false;
152
+ }
153
+ throw error;
154
+ }
155
+ }
156
+ else {
157
+ cfgIdx = ctx.addExecution('cfg');
158
+ cfg_success = true;
159
+ }
160
+ if (cfg_success) {
161
+ if (await __ctrl__.beforeNode('detect', ctx)) {
162
+ // ── detect (weaverDetectProvider) ──
163
+ ctx.checkAborted('detect');
164
+ detectIdx = ctx.addExecution('detect');
165
+ if (typeof globalThis !== 'undefined')
166
+ globalThis.__fw_current_node_id__ = 'detect';
167
+ await ctx.sendStatusChangedEvent({
168
+ nodeTypeName: 'weaverDetectProvider',
169
+ id: 'detect',
170
+ executionIndex: detectIdx,
171
+ status: 'RUNNING',
172
+ });
173
+ detect_success = false;
174
+ try {
175
+ await ctx.setVariable({ id: 'detect', portName: 'execute', executionIndex: detectIdx, nodeTypeName: 'weaverDetectProvider' }, true);
176
+ const detect_projectDir = await ctx.getVariable({ id: 'cfg', portName: 'projectDir', executionIndex: cfgIdx });
177
+ await ctx.setVariable({ id: 'detect', portName: 'projectDir', executionIndex: detectIdx, nodeTypeName: 'weaverDetectProvider' }, detect_projectDir);
178
+ const detect_config = await ctx.getVariable({ id: 'cfg', portName: 'config', executionIndex: cfgIdx });
179
+ await ctx.setVariable({ id: 'detect', portName: 'config', executionIndex: detectIdx, nodeTypeName: 'weaverDetectProvider' }, detect_config);
180
+ const detectResult = weaverDetectProvider(detect_projectDir, detect_config);
181
+ const detectResult_raw = detectResult;
182
+ await ctx.setVariable({ id: 'detect', portName: 'env', executionIndex: detectIdx, nodeTypeName: 'weaverDetectProvider' }, typeof detectResult_raw === 'object' && detectResult_raw !== null && 'env' in detectResult_raw ? detectResult_raw.env : detectResult_raw);
183
+ await ctx.setVariable({ id: 'detect', portName: 'onSuccess', executionIndex: detectIdx, nodeTypeName: 'weaverDetectProvider' }, true);
184
+ await ctx.setVariable({ id: 'detect', portName: 'onFailure', executionIndex: detectIdx, nodeTypeName: 'weaverDetectProvider' }, false);
185
+ await ctx.sendStatusChangedEvent({
186
+ nodeTypeName: 'weaverDetectProvider',
187
+ id: 'detect',
188
+ executionIndex: detectIdx,
189
+ status: 'SUCCEEDED',
190
+ });
191
+ await __ctrl__.afterNode('detect', ctx);
192
+ detect_success = true;
193
+ }
194
+ catch (error) {
195
+ const isCancellation = CancellationError.isCancellationError(error);
196
+ await ctx.sendStatusChangedEvent({
197
+ nodeTypeName: 'weaverDetectProvider',
198
+ id: 'detect',
199
+ executionIndex: detectIdx,
200
+ status: isCancellation ? 'CANCELLED' : 'FAILED',
201
+ });
202
+ if (!isCancellation) {
203
+ ctx.sendLogErrorEvent({
204
+ nodeTypeName: 'weaverDetectProvider',
205
+ id: 'detect',
206
+ executionIndex: detectIdx,
207
+ error: error instanceof Error ? error.message : String(error),
208
+ });
209
+ await ctx.setVariable({ id: 'detect', portName: 'onSuccess', executionIndex: detectIdx, nodeTypeName: 'weaverDetectProvider' }, false);
210
+ await ctx.setVariable({ id: 'detect', portName: 'onFailure', executionIndex: detectIdx, nodeTypeName: 'weaverDetectProvider' }, true);
211
+ detect_success = false;
212
+ }
213
+ throw error;
214
+ }
215
+ }
216
+ else {
217
+ detectIdx = ctx.addExecution('detect');
218
+ detect_success = true;
219
+ }
220
+ }
221
+ else {
222
+ const detectIdx = ctx.addExecution('detect');
223
+ await ctx.setVariable({ id: 'detect', portName: 'onSuccess', executionIndex: detectIdx, nodeTypeName: 'weaverDetectProvider' }, false);
224
+ await ctx.setVariable({ id: 'detect', portName: 'onFailure', executionIndex: detectIdx, nodeTypeName: 'weaverDetectProvider' }, false);
225
+ await ctx.sendStatusChangedEvent({
226
+ nodeTypeName: 'weaverDetectProvider',
227
+ id: 'detect',
228
+ executionIndex: detectIdx,
229
+ status: 'CANCELLED',
230
+ });
231
+ const receiveIdx = ctx.addExecution('receive');
232
+ await ctx.setVariable({ id: 'receive', portName: 'onSuccess', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, false);
233
+ await ctx.setVariable({ id: 'receive', portName: 'onFailure', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, false);
234
+ await ctx.sendStatusChangedEvent({
235
+ nodeTypeName: 'weaverReceiveTask',
236
+ id: 'receive',
237
+ executionIndex: receiveIdx,
238
+ status: 'CANCELLED',
239
+ });
240
+ const routeIdx = ctx.addExecution('route');
241
+ await ctx.setVariable({ id: 'route', portName: 'onSuccess', executionIndex: routeIdx, nodeTypeName: 'weaverRouteTask' }, false);
242
+ await ctx.setVariable({ id: 'route', portName: 'onFailure', executionIndex: routeIdx, nodeTypeName: 'weaverRouteTask' }, false);
243
+ await ctx.sendStatusChangedEvent({
244
+ nodeTypeName: 'weaverRouteTask',
245
+ id: 'route',
246
+ executionIndex: routeIdx,
247
+ status: 'CANCELLED',
248
+ });
249
+ const contextIdx = ctx.addExecution('context');
250
+ await ctx.setVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
251
+ await ctx.setVariable({ id: 'context', portName: 'onFailure', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
252
+ await ctx.sendStatusChangedEvent({
253
+ nodeTypeName: 'weaverBuildContext',
254
+ id: 'context',
255
+ executionIndex: contextIdx,
256
+ status: 'CANCELLED',
257
+ });
258
+ const readWfIdx = ctx.addExecution('readWf');
259
+ await ctx.setVariable({ id: 'readWf', portName: 'onSuccess', executionIndex: readWfIdx, nodeTypeName: 'weaverReadWorkflow' }, false);
260
+ await ctx.setVariable({ id: 'readWf', portName: 'onFailure', executionIndex: readWfIdx, nodeTypeName: 'weaverReadWorkflow' }, false);
261
+ await ctx.sendStatusChangedEvent({
262
+ nodeTypeName: 'weaverReadWorkflow',
263
+ id: 'readWf',
264
+ executionIndex: readWfIdx,
265
+ status: 'CANCELLED',
266
+ });
267
+ }
268
+ if (cfg_success && detect_success) {
269
+ if (await __ctrl__.beforeNode('receive', ctx)) {
270
+ // ── receive (weaverReceiveTask) ──
271
+ ctx.checkAborted('receive');
272
+ receiveIdx = ctx.addExecution('receive');
273
+ if (typeof globalThis !== 'undefined')
274
+ globalThis.__fw_current_node_id__ = 'receive';
275
+ await ctx.sendStatusChangedEvent({
276
+ nodeTypeName: 'weaverReceiveTask',
277
+ id: 'receive',
278
+ executionIndex: receiveIdx,
279
+ status: 'RUNNING',
280
+ });
281
+ receive_success = false;
282
+ try {
283
+ const receive_execute = detectIdx !== undefined ? await ctx.getVariable({ id: 'detect', portName: 'onSuccess', executionIndex: detectIdx }) : false;
284
+ await ctx.setVariable({ id: 'receive', portName: 'execute', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receive_execute);
285
+ const receive_env = await ctx.getVariable({ id: 'detect', portName: 'env', executionIndex: detectIdx });
286
+ await ctx.setVariable({ id: 'receive', portName: 'env', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receive_env);
287
+ const receive_taskJson = await ctx.getVariable({ id: 'Start', portName: 'taskJson', executionIndex: startIdx });
288
+ await ctx.setVariable({ id: 'receive', portName: 'taskJson', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receive_taskJson);
289
+ const receiveResult = await weaverReceiveTask(receive_execute, receive_env, receive_taskJson);
290
+ await ctx.setVariable({ id: 'receive', portName: 'ctx', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receiveResult.ctx);
291
+ await ctx.setVariable({ id: 'receive', portName: 'onSuccess', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receiveResult.onSuccess);
292
+ await ctx.setVariable({ id: 'receive', portName: 'onFailure', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receiveResult.onFailure);
293
+ await ctx.sendStatusChangedEvent({
294
+ nodeTypeName: 'weaverReceiveTask',
295
+ id: 'receive',
296
+ executionIndex: receiveIdx,
297
+ status: 'SUCCEEDED',
298
+ });
299
+ await __ctrl__.afterNode('receive', ctx);
300
+ receive_success = receiveResult.onSuccess;
301
+ }
302
+ catch (error) {
303
+ const isCancellation = CancellationError.isCancellationError(error);
304
+ await ctx.sendStatusChangedEvent({
305
+ nodeTypeName: 'weaverReceiveTask',
306
+ id: 'receive',
307
+ executionIndex: receiveIdx,
308
+ status: isCancellation ? 'CANCELLED' : 'FAILED',
309
+ });
310
+ if (!isCancellation) {
311
+ ctx.sendLogErrorEvent({
312
+ nodeTypeName: 'weaverReceiveTask',
313
+ id: 'receive',
314
+ executionIndex: receiveIdx,
315
+ error: error instanceof Error ? error.message : String(error),
316
+ });
317
+ await ctx.setVariable({ id: 'receive', portName: 'onSuccess', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, false);
318
+ await ctx.setVariable({ id: 'receive', portName: 'onFailure', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, true);
319
+ receive_success = false;
320
+ }
321
+ throw error;
322
+ }
323
+ }
324
+ else {
325
+ receiveIdx = ctx.addExecution('receive');
326
+ receive_success = true;
327
+ }
328
+ }
329
+ else {
330
+ const receiveIdx = ctx.addExecution('receive');
331
+ await ctx.setVariable({ id: 'receive', portName: 'onSuccess', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, false);
332
+ await ctx.setVariable({ id: 'receive', portName: 'onFailure', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, false);
333
+ await ctx.sendStatusChangedEvent({
334
+ nodeTypeName: 'weaverReceiveTask',
335
+ id: 'receive',
336
+ executionIndex: receiveIdx,
337
+ status: 'CANCELLED',
338
+ });
339
+ const routeIdx = ctx.addExecution('route');
340
+ await ctx.setVariable({ id: 'route', portName: 'onSuccess', executionIndex: routeIdx, nodeTypeName: 'weaverRouteTask' }, false);
341
+ await ctx.setVariable({ id: 'route', portName: 'onFailure', executionIndex: routeIdx, nodeTypeName: 'weaverRouteTask' }, false);
342
+ await ctx.sendStatusChangedEvent({
343
+ nodeTypeName: 'weaverRouteTask',
344
+ id: 'route',
345
+ executionIndex: routeIdx,
346
+ status: 'CANCELLED',
347
+ });
348
+ const contextIdx = ctx.addExecution('context');
349
+ await ctx.setVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
350
+ await ctx.setVariable({ id: 'context', portName: 'onFailure', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
351
+ await ctx.sendStatusChangedEvent({
352
+ nodeTypeName: 'weaverBuildContext',
353
+ id: 'context',
354
+ executionIndex: contextIdx,
355
+ status: 'CANCELLED',
356
+ });
357
+ const readWfIdx = ctx.addExecution('readWf');
358
+ await ctx.setVariable({ id: 'readWf', portName: 'onSuccess', executionIndex: readWfIdx, nodeTypeName: 'weaverReadWorkflow' }, false);
359
+ await ctx.setVariable({ id: 'readWf', portName: 'onFailure', executionIndex: readWfIdx, nodeTypeName: 'weaverReadWorkflow' }, false);
360
+ await ctx.sendStatusChangedEvent({
361
+ nodeTypeName: 'weaverReadWorkflow',
362
+ id: 'readWf',
363
+ executionIndex: readWfIdx,
364
+ status: 'CANCELLED',
365
+ });
366
+ }
367
+ if (cfg_success && detect_success && receive_success) {
368
+ let route_success = false;
369
+ if (await __ctrl__.beforeNode('route', ctx)) {
370
+ // ── route (weaverRouteTask) ──
371
+ ctx.checkAborted('route');
372
+ routeIdx = ctx.addExecution('route');
373
+ if (typeof globalThis !== 'undefined')
374
+ globalThis.__fw_current_node_id__ = 'route';
375
+ await ctx.sendStatusChangedEvent({
376
+ nodeTypeName: 'weaverRouteTask',
377
+ id: 'route',
378
+ executionIndex: routeIdx,
379
+ status: 'RUNNING',
380
+ });
381
+ route_success = false;
382
+ try {
383
+ await ctx.setVariable({ id: 'route', portName: 'execute', executionIndex: routeIdx, nodeTypeName: 'weaverRouteTask' }, true);
384
+ const route_ctx = await ctx.getVariable({ id: 'receive', portName: 'ctx', executionIndex: receiveIdx });
385
+ await ctx.setVariable({ id: 'route', portName: 'ctx', executionIndex: routeIdx, nodeTypeName: 'weaverRouteTask' }, route_ctx);
386
+ const routeResult = weaverRouteTask(route_ctx);
387
+ const routeResult_raw = routeResult;
388
+ await ctx.setVariable({ id: 'route', portName: 'ctx', executionIndex: routeIdx, nodeTypeName: 'weaverRouteTask' }, typeof routeResult_raw === 'object' && routeResult_raw !== null && 'ctx' in routeResult_raw ? routeResult_raw.ctx : routeResult_raw);
389
+ await ctx.setVariable({ id: 'route', portName: 'onSuccess', executionIndex: routeIdx, nodeTypeName: 'weaverRouteTask' }, true);
390
+ await ctx.setVariable({ id: 'route', portName: 'onFailure', executionIndex: routeIdx, nodeTypeName: 'weaverRouteTask' }, false);
391
+ await ctx.sendStatusChangedEvent({
392
+ nodeTypeName: 'weaverRouteTask',
393
+ id: 'route',
394
+ executionIndex: routeIdx,
395
+ status: 'SUCCEEDED',
396
+ });
397
+ await __ctrl__.afterNode('route', ctx);
398
+ route_success = true;
399
+ }
400
+ catch (error) {
401
+ const isCancellation = CancellationError.isCancellationError(error);
402
+ await ctx.sendStatusChangedEvent({
403
+ nodeTypeName: 'weaverRouteTask',
404
+ id: 'route',
405
+ executionIndex: routeIdx,
406
+ status: isCancellation ? 'CANCELLED' : 'FAILED',
407
+ });
408
+ if (!isCancellation) {
409
+ ctx.sendLogErrorEvent({
410
+ nodeTypeName: 'weaverRouteTask',
411
+ id: 'route',
412
+ executionIndex: routeIdx,
413
+ error: error instanceof Error ? error.message : String(error),
414
+ });
415
+ await ctx.setVariable({ id: 'route', portName: 'onSuccess', executionIndex: routeIdx, nodeTypeName: 'weaverRouteTask' }, false);
416
+ await ctx.setVariable({ id: 'route', portName: 'onFailure', executionIndex: routeIdx, nodeTypeName: 'weaverRouteTask' }, true);
417
+ route_success = false;
418
+ }
419
+ const contextIdx = ctx.addExecution('context');
420
+ await ctx.setVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
421
+ await ctx.setVariable({ id: 'context', portName: 'onFailure', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
422
+ await ctx.sendStatusChangedEvent({
423
+ nodeTypeName: 'weaverBuildContext',
424
+ id: 'context',
425
+ executionIndex: contextIdx,
426
+ status: 'CANCELLED',
427
+ });
428
+ const readWfIdx = ctx.addExecution('readWf');
429
+ await ctx.setVariable({ id: 'readWf', portName: 'onSuccess', executionIndex: readWfIdx, nodeTypeName: 'weaverReadWorkflow' }, false);
430
+ await ctx.setVariable({ id: 'readWf', portName: 'onFailure', executionIndex: readWfIdx, nodeTypeName: 'weaverReadWorkflow' }, false);
431
+ await ctx.sendStatusChangedEvent({
432
+ nodeTypeName: 'weaverReadWorkflow',
433
+ id: 'readWf',
434
+ executionIndex: readWfIdx,
435
+ status: 'CANCELLED',
436
+ });
437
+ throw error;
438
+ }
439
+ }
440
+ else {
441
+ routeIdx = ctx.addExecution('route');
442
+ route_success = true;
443
+ }
444
+ if (route_success) {
445
+ const readWfIdx = ctx.addExecution('readWf');
446
+ await ctx.setVariable({ id: 'readWf', portName: 'onSuccess', executionIndex: readWfIdx, nodeTypeName: 'weaverReadWorkflow' }, false);
447
+ await ctx.setVariable({ id: 'readWf', portName: 'onFailure', executionIndex: readWfIdx, nodeTypeName: 'weaverReadWorkflow' }, false);
448
+ await ctx.sendStatusChangedEvent({
449
+ nodeTypeName: 'weaverReadWorkflow',
450
+ id: 'readWf',
451
+ executionIndex: readWfIdx,
452
+ status: 'CANCELLED',
453
+ });
454
+ let context_success = false;
455
+ if (await __ctrl__.beforeNode('context', ctx)) {
456
+ // ── context (weaverBuildContext) ──
457
+ ctx.checkAborted('context');
458
+ contextIdx = ctx.addExecution('context');
459
+ if (typeof globalThis !== 'undefined')
460
+ globalThis.__fw_current_node_id__ = 'context';
461
+ await ctx.sendStatusChangedEvent({
462
+ nodeTypeName: 'weaverBuildContext',
463
+ id: 'context',
464
+ executionIndex: contextIdx,
465
+ status: 'RUNNING',
466
+ });
467
+ context_success = false;
468
+ try {
469
+ await ctx.setVariable({ id: 'context', portName: 'execute', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, true);
470
+ const context_ctx = await ctx.getVariable({ id: 'route', portName: 'ctx', executionIndex: routeIdx });
471
+ await ctx.setVariable({ id: 'context', portName: 'ctx', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, context_ctx);
472
+ const contextResult = weaverBuildContext(context_ctx);
473
+ const contextResult_raw = contextResult;
474
+ await ctx.setVariable({ id: 'context', portName: 'ctx', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, typeof contextResult_raw === 'object' && contextResult_raw !== null && 'ctx' in contextResult_raw ? contextResult_raw.ctx : contextResult_raw);
475
+ await ctx.setVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, true);
476
+ await ctx.setVariable({ id: 'context', portName: 'onFailure', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
477
+ await ctx.sendStatusChangedEvent({
478
+ nodeTypeName: 'weaverBuildContext',
479
+ id: 'context',
480
+ executionIndex: contextIdx,
481
+ status: 'SUCCEEDED',
482
+ });
483
+ await __ctrl__.afterNode('context', ctx);
484
+ context_success = true;
485
+ }
486
+ catch (error) {
487
+ const isCancellation = CancellationError.isCancellationError(error);
488
+ await ctx.sendStatusChangedEvent({
489
+ nodeTypeName: 'weaverBuildContext',
490
+ id: 'context',
491
+ executionIndex: contextIdx,
492
+ status: isCancellation ? 'CANCELLED' : 'FAILED',
493
+ });
494
+ if (!isCancellation) {
495
+ ctx.sendLogErrorEvent({
496
+ nodeTypeName: 'weaverBuildContext',
497
+ id: 'context',
498
+ executionIndex: contextIdx,
499
+ error: error instanceof Error ? error.message : String(error),
500
+ });
501
+ await ctx.setVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
502
+ await ctx.setVariable({ id: 'context', portName: 'onFailure', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, true);
503
+ context_success = false;
504
+ }
505
+ const planIdx = ctx.addExecution('plan');
506
+ await ctx.setVariable({ id: 'plan', portName: 'onSuccess', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, false);
507
+ await ctx.setVariable({ id: 'plan', portName: 'onFailure', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, false);
508
+ await ctx.sendStatusChangedEvent({
509
+ nodeTypeName: 'weaverPlanTask',
510
+ id: 'plan',
511
+ executionIndex: planIdx,
512
+ status: 'CANCELLED',
513
+ });
514
+ throw error;
515
+ }
516
+ }
517
+ else {
518
+ contextIdx = ctx.addExecution('context');
519
+ context_success = true;
520
+ }
521
+ if (context_success) {
522
+ let plan_success = false;
523
+ if (await __ctrl__.beforeNode('plan', ctx)) {
524
+ // ── plan (weaverPlanTask) ──
525
+ ctx.checkAborted('plan');
526
+ planIdx = ctx.addExecution('plan');
527
+ if (typeof globalThis !== 'undefined')
528
+ globalThis.__fw_current_node_id__ = 'plan';
529
+ await ctx.sendStatusChangedEvent({
530
+ nodeTypeName: 'weaverPlanTask',
531
+ id: 'plan',
532
+ executionIndex: planIdx,
533
+ status: 'RUNNING',
534
+ });
535
+ plan_success = false;
536
+ try {
537
+ const plan_execute = contextIdx !== undefined ? await ctx.getVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx }) : false;
538
+ await ctx.setVariable({ id: 'plan', portName: 'execute', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, plan_execute);
539
+ const plan_ctx = await ctx.getVariable({ id: 'context', portName: 'ctx', executionIndex: contextIdx });
540
+ await ctx.setVariable({ id: 'plan', portName: 'ctx', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, plan_ctx);
541
+ const planResult = await weaverPlanTask(plan_execute, plan_ctx);
542
+ await ctx.setVariable({ id: 'plan', portName: 'ctx', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, planResult.ctx);
543
+ await ctx.setVariable({ id: 'plan', portName: 'onSuccess', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, planResult.onSuccess);
544
+ await ctx.setVariable({ id: 'plan', portName: 'onFailure', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, planResult.onFailure);
545
+ await ctx.sendStatusChangedEvent({
546
+ nodeTypeName: 'weaverPlanTask',
547
+ id: 'plan',
548
+ executionIndex: planIdx,
549
+ status: 'SUCCEEDED',
550
+ });
551
+ await __ctrl__.afterNode('plan', ctx);
552
+ plan_success = planResult.onSuccess;
553
+ }
554
+ catch (error) {
555
+ const isCancellation = CancellationError.isCancellationError(error);
556
+ await ctx.sendStatusChangedEvent({
557
+ nodeTypeName: 'weaverPlanTask',
558
+ id: 'plan',
559
+ executionIndex: planIdx,
560
+ status: isCancellation ? 'CANCELLED' : 'FAILED',
561
+ });
562
+ if (!isCancellation) {
563
+ ctx.sendLogErrorEvent({
564
+ nodeTypeName: 'weaverPlanTask',
565
+ id: 'plan',
566
+ executionIndex: planIdx,
567
+ error: error instanceof Error ? error.message : String(error),
568
+ });
569
+ await ctx.setVariable({ id: 'plan', portName: 'onSuccess', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, false);
570
+ await ctx.setVariable({ id: 'plan', portName: 'onFailure', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, true);
571
+ plan_success = false;
572
+ }
573
+ const approveIdx = ctx.addExecution('approve');
574
+ await ctx.setVariable({ id: 'approve', portName: 'onSuccess', executionIndex: approveIdx, nodeTypeName: 'weaverApprovalGate' }, false);
575
+ await ctx.setVariable({ id: 'approve', portName: 'onFailure', executionIndex: approveIdx, nodeTypeName: 'weaverApprovalGate' }, false);
576
+ await ctx.sendStatusChangedEvent({
577
+ nodeTypeName: 'weaverApprovalGate',
578
+ id: 'approve',
579
+ executionIndex: approveIdx,
580
+ status: 'CANCELLED',
581
+ });
582
+ throw error;
583
+ }
584
+ }
585
+ else {
586
+ planIdx = ctx.addExecution('plan');
587
+ plan_success = true;
588
+ }
589
+ if (plan_success) {
590
+ let approve_success = false;
591
+ if (await __ctrl__.beforeNode('approve', ctx)) {
592
+ // ── approve (weaverApprovalGate) ──
593
+ ctx.checkAborted('approve');
594
+ approveIdx = ctx.addExecution('approve');
595
+ if (typeof globalThis !== 'undefined')
596
+ globalThis.__fw_current_node_id__ = 'approve';
597
+ await ctx.sendStatusChangedEvent({
598
+ nodeTypeName: 'weaverApprovalGate',
599
+ id: 'approve',
600
+ executionIndex: approveIdx,
601
+ status: 'RUNNING',
602
+ });
603
+ approve_success = false;
604
+ try {
605
+ const approve_execute = planIdx !== undefined ? await ctx.getVariable({ id: 'plan', portName: 'onSuccess', executionIndex: planIdx }) : false;
606
+ await ctx.setVariable({ id: 'approve', portName: 'execute', executionIndex: approveIdx, nodeTypeName: 'weaverApprovalGate' }, approve_execute);
607
+ const approve_ctx = await ctx.getVariable({ id: 'plan', portName: 'ctx', executionIndex: planIdx });
608
+ await ctx.setVariable({ id: 'approve', portName: 'ctx', executionIndex: approveIdx, nodeTypeName: 'weaverApprovalGate' }, approve_ctx);
609
+ const approveResult = await weaverApprovalGate(approve_execute, approve_ctx);
610
+ await ctx.setVariable({ id: 'approve', portName: 'ctx', executionIndex: approveIdx, nodeTypeName: 'weaverApprovalGate' }, approveResult.ctx);
611
+ await ctx.setVariable({ id: 'approve', portName: 'onSuccess', executionIndex: approveIdx, nodeTypeName: 'weaverApprovalGate' }, approveResult.onSuccess);
612
+ await ctx.setVariable({ id: 'approve', portName: 'onFailure', executionIndex: approveIdx, nodeTypeName: 'weaverApprovalGate' }, approveResult.onFailure);
613
+ await ctx.sendStatusChangedEvent({
614
+ nodeTypeName: 'weaverApprovalGate',
615
+ id: 'approve',
616
+ executionIndex: approveIdx,
617
+ status: 'SUCCEEDED',
618
+ });
619
+ await __ctrl__.afterNode('approve', ctx);
620
+ approve_success = approveResult.onSuccess;
621
+ }
622
+ catch (error) {
623
+ const isCancellation = CancellationError.isCancellationError(error);
624
+ await ctx.sendStatusChangedEvent({
625
+ nodeTypeName: 'weaverApprovalGate',
626
+ id: 'approve',
627
+ executionIndex: approveIdx,
628
+ status: isCancellation ? 'CANCELLED' : 'FAILED',
629
+ });
630
+ if (!isCancellation) {
631
+ ctx.sendLogErrorEvent({
632
+ nodeTypeName: 'weaverApprovalGate',
633
+ id: 'approve',
634
+ executionIndex: approveIdx,
635
+ error: error instanceof Error ? error.message : String(error),
636
+ });
637
+ await ctx.setVariable({ id: 'approve', portName: 'onSuccess', executionIndex: approveIdx, nodeTypeName: 'weaverApprovalGate' }, false);
638
+ await ctx.setVariable({ id: 'approve', portName: 'onFailure', executionIndex: approveIdx, nodeTypeName: 'weaverApprovalGate' }, true);
639
+ approve_success = false;
640
+ }
641
+ const execRetryIdx = ctx.addExecution('execRetry');
642
+ await ctx.setVariable({ id: 'execRetry', portName: 'onSuccess', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, false);
643
+ await ctx.setVariable({ id: 'execRetry', portName: 'onFailure', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, false);
644
+ await ctx.sendStatusChangedEvent({
645
+ nodeTypeName: 'weaverExecValidateRetry',
646
+ id: 'execRetry',
647
+ executionIndex: execRetryIdx,
648
+ status: 'CANCELLED',
649
+ });
650
+ const abortIdx = ctx.addExecution('abort');
651
+ await ctx.setVariable({ id: 'abort', portName: 'onSuccess', executionIndex: abortIdx, nodeTypeName: 'weaverAbortTask' }, false);
652
+ await ctx.setVariable({ id: 'abort', portName: 'onFailure', executionIndex: abortIdx, nodeTypeName: 'weaverAbortTask' }, false);
653
+ await ctx.sendStatusChangedEvent({
654
+ nodeTypeName: 'weaverAbortTask',
655
+ id: 'abort',
656
+ executionIndex: abortIdx,
657
+ status: 'CANCELLED',
658
+ });
659
+ throw error;
660
+ }
661
+ }
662
+ else {
663
+ approveIdx = ctx.addExecution('approve');
664
+ approve_success = true;
665
+ }
666
+ if (approve_success) {
667
+ const abortIdx = ctx.addExecution('abort');
668
+ await ctx.setVariable({ id: 'abort', portName: 'onSuccess', executionIndex: abortIdx, nodeTypeName: 'weaverAbortTask' }, false);
669
+ await ctx.setVariable({ id: 'abort', portName: 'onFailure', executionIndex: abortIdx, nodeTypeName: 'weaverAbortTask' }, false);
670
+ await ctx.sendStatusChangedEvent({
671
+ nodeTypeName: 'weaverAbortTask',
672
+ id: 'abort',
673
+ executionIndex: abortIdx,
674
+ status: 'CANCELLED',
675
+ });
676
+ let execRetry_success = false;
677
+ if (await __ctrl__.beforeNode('execRetry', ctx)) {
678
+ // ── execRetry (weaverExecValidateRetry) ──
679
+ ctx.checkAborted('execRetry');
680
+ execRetryIdx = ctx.addExecution('execRetry');
681
+ if (typeof globalThis !== 'undefined')
682
+ globalThis.__fw_current_node_id__ = 'execRetry';
683
+ await ctx.sendStatusChangedEvent({
684
+ nodeTypeName: 'weaverExecValidateRetry',
685
+ id: 'execRetry',
686
+ executionIndex: execRetryIdx,
687
+ status: 'RUNNING',
688
+ });
689
+ execRetry_success = false;
690
+ try {
691
+ const execRetry_execute = approveIdx !== undefined ? await ctx.getVariable({ id: 'approve', portName: 'onSuccess', executionIndex: approveIdx }) : false;
692
+ await ctx.setVariable({ id: 'execRetry', portName: 'execute', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, execRetry_execute);
693
+ const execRetry_ctx = await ctx.getVariable({ id: 'approve', portName: 'ctx', executionIndex: approveIdx });
694
+ await ctx.setVariable({ id: 'execRetry', portName: 'ctx', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, execRetry_ctx);
695
+ const execRetryResult = await weaverExecValidateRetry(execRetry_execute, execRetry_ctx);
696
+ await ctx.setVariable({ id: 'execRetry', portName: 'ctx', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, execRetryResult.ctx);
697
+ await ctx.setVariable({ id: 'execRetry', portName: 'onSuccess', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, execRetryResult.onSuccess);
698
+ await ctx.setVariable({ id: 'execRetry', portName: 'onFailure', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, execRetryResult.onFailure);
699
+ await ctx.sendStatusChangedEvent({
700
+ nodeTypeName: 'weaverExecValidateRetry',
701
+ id: 'execRetry',
702
+ executionIndex: execRetryIdx,
703
+ status: 'SUCCEEDED',
704
+ });
705
+ await __ctrl__.afterNode('execRetry', ctx);
706
+ execRetry_success = execRetryResult.onSuccess;
707
+ }
708
+ catch (error) {
709
+ const isCancellation = CancellationError.isCancellationError(error);
710
+ await ctx.sendStatusChangedEvent({
711
+ nodeTypeName: 'weaverExecValidateRetry',
712
+ id: 'execRetry',
713
+ executionIndex: execRetryIdx,
714
+ status: isCancellation ? 'CANCELLED' : 'FAILED',
715
+ });
716
+ if (!isCancellation) {
717
+ ctx.sendLogErrorEvent({
718
+ nodeTypeName: 'weaverExecValidateRetry',
719
+ id: 'execRetry',
720
+ executionIndex: execRetryIdx,
721
+ error: error instanceof Error ? error.message : String(error),
722
+ });
723
+ await ctx.setVariable({ id: 'execRetry', portName: 'onSuccess', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, false);
724
+ await ctx.setVariable({ id: 'execRetry', portName: 'onFailure', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, true);
725
+ execRetry_success = false;
726
+ }
727
+ const gitOpsIdx = ctx.addExecution('gitOps');
728
+ await ctx.setVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
729
+ await ctx.setVariable({ id: 'gitOps', portName: 'onFailure', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
730
+ await ctx.sendStatusChangedEvent({
731
+ nodeTypeName: 'weaverGitOps',
732
+ id: 'gitOps',
733
+ executionIndex: gitOpsIdx,
734
+ status: 'CANCELLED',
735
+ });
736
+ const notifyIdx = ctx.addExecution('notify');
737
+ await ctx.setVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
738
+ await ctx.setVariable({ id: 'notify', portName: 'onFailure', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
739
+ await ctx.sendStatusChangedEvent({
740
+ nodeTypeName: 'weaverSendNotify',
741
+ id: 'notify',
742
+ executionIndex: notifyIdx,
743
+ status: 'CANCELLED',
744
+ });
745
+ throw error;
746
+ }
747
+ }
748
+ else {
749
+ execRetryIdx = ctx.addExecution('execRetry');
750
+ execRetry_success = true;
751
+ }
752
+ if (execRetry_success) {
753
+ if (await __ctrl__.beforeNode('gitOps', ctx)) {
754
+ // ── gitOps (weaverGitOps) ──
755
+ ctx.checkAborted('gitOps');
756
+ gitOpsIdx = ctx.addExecution('gitOps');
757
+ if (typeof globalThis !== 'undefined')
758
+ globalThis.__fw_current_node_id__ = 'gitOps';
759
+ await ctx.sendStatusChangedEvent({
760
+ nodeTypeName: 'weaverGitOps',
761
+ id: 'gitOps',
762
+ executionIndex: gitOpsIdx,
763
+ status: 'RUNNING',
764
+ });
765
+ try {
766
+ await ctx.setVariable({ id: 'gitOps', portName: 'execute', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, true);
767
+ const gitOps_ctx = await ctx.getVariable({ id: 'execRetry', portName: 'ctx', executionIndex: execRetryIdx });
768
+ await ctx.setVariable({ id: 'gitOps', portName: 'ctx', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, gitOps_ctx);
769
+ const gitOpsResult = weaverGitOps(gitOps_ctx);
770
+ const gitOpsResult_raw = gitOpsResult;
771
+ await ctx.setVariable({ id: 'gitOps', portName: 'ctx', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, typeof gitOpsResult_raw === 'object' && gitOpsResult_raw !== null && 'ctx' in gitOpsResult_raw ? gitOpsResult_raw.ctx : gitOpsResult_raw);
772
+ await ctx.setVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, true);
773
+ await ctx.setVariable({ id: 'gitOps', portName: 'onFailure', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
774
+ await ctx.sendStatusChangedEvent({
775
+ nodeTypeName: 'weaverGitOps',
776
+ id: 'gitOps',
777
+ executionIndex: gitOpsIdx,
778
+ status: 'SUCCEEDED',
779
+ });
780
+ await __ctrl__.afterNode('gitOps', ctx);
781
+ }
782
+ catch (error) {
783
+ const isCancellation = CancellationError.isCancellationError(error);
784
+ await ctx.sendStatusChangedEvent({
785
+ nodeTypeName: 'weaverGitOps',
786
+ id: 'gitOps',
787
+ executionIndex: gitOpsIdx,
788
+ status: isCancellation ? 'CANCELLED' : 'FAILED',
789
+ });
790
+ if (!isCancellation) {
791
+ ctx.sendLogErrorEvent({
792
+ nodeTypeName: 'weaverGitOps',
793
+ id: 'gitOps',
794
+ executionIndex: gitOpsIdx,
795
+ error: error instanceof Error ? error.message : String(error),
796
+ });
797
+ await ctx.setVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
798
+ await ctx.setVariable({ id: 'gitOps', portName: 'onFailure', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, true);
799
+ }
800
+ throw error;
801
+ }
802
+ }
803
+ else {
804
+ gitOpsIdx = ctx.addExecution('gitOps');
805
+ }
806
+ if (await __ctrl__.beforeNode('notify', ctx)) {
807
+ // ── notify (weaverSendNotify) ──
808
+ ctx.checkAborted('notify');
809
+ notifyIdx = ctx.addExecution('notify');
810
+ if (typeof globalThis !== 'undefined')
811
+ globalThis.__fw_current_node_id__ = 'notify';
812
+ await ctx.sendStatusChangedEvent({
813
+ nodeTypeName: 'weaverSendNotify',
814
+ id: 'notify',
815
+ executionIndex: notifyIdx,
816
+ status: 'RUNNING',
817
+ });
818
+ try {
819
+ await ctx.setVariable({ id: 'notify', portName: 'execute', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, true);
820
+ const notify_ctx = await ctx.getVariable({ id: 'execRetry', portName: 'ctx', executionIndex: execRetryIdx });
821
+ await ctx.setVariable({ id: 'notify', portName: 'ctx', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, notify_ctx);
822
+ const notifyResult = weaverSendNotify(notify_ctx);
823
+ const notifyResult_raw = notifyResult;
824
+ await ctx.setVariable({ id: 'notify', portName: 'ctx', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, typeof notifyResult_raw === 'object' && notifyResult_raw !== null && 'ctx' in notifyResult_raw ? notifyResult_raw.ctx : notifyResult_raw);
825
+ await ctx.setVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, true);
826
+ await ctx.setVariable({ id: 'notify', portName: 'onFailure', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
827
+ await ctx.sendStatusChangedEvent({
828
+ nodeTypeName: 'weaverSendNotify',
829
+ id: 'notify',
830
+ executionIndex: notifyIdx,
831
+ status: 'SUCCEEDED',
832
+ });
833
+ await __ctrl__.afterNode('notify', ctx);
834
+ }
835
+ catch (error) {
836
+ const isCancellation = CancellationError.isCancellationError(error);
837
+ await ctx.sendStatusChangedEvent({
838
+ nodeTypeName: 'weaverSendNotify',
839
+ id: 'notify',
840
+ executionIndex: notifyIdx,
841
+ status: isCancellation ? 'CANCELLED' : 'FAILED',
842
+ });
843
+ if (!isCancellation) {
844
+ ctx.sendLogErrorEvent({
845
+ nodeTypeName: 'weaverSendNotify',
846
+ id: 'notify',
847
+ executionIndex: notifyIdx,
848
+ error: error instanceof Error ? error.message : String(error),
849
+ });
850
+ await ctx.setVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
851
+ await ctx.setVariable({ id: 'notify', portName: 'onFailure', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, true);
852
+ }
853
+ throw error;
854
+ }
855
+ }
856
+ else {
857
+ notifyIdx = ctx.addExecution('notify');
858
+ }
859
+ }
860
+ else {
861
+ const gitOpsIdx = ctx.addExecution('gitOps');
862
+ await ctx.setVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
863
+ await ctx.setVariable({ id: 'gitOps', portName: 'onFailure', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
864
+ await ctx.sendStatusChangedEvent({
865
+ nodeTypeName: 'weaverGitOps',
866
+ id: 'gitOps',
867
+ executionIndex: gitOpsIdx,
868
+ status: 'CANCELLED',
869
+ });
870
+ const notifyIdx = ctx.addExecution('notify');
871
+ await ctx.setVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
872
+ await ctx.setVariable({ id: 'notify', portName: 'onFailure', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
873
+ await ctx.sendStatusChangedEvent({
874
+ nodeTypeName: 'weaverSendNotify',
875
+ id: 'notify',
876
+ executionIndex: notifyIdx,
877
+ status: 'CANCELLED',
878
+ });
879
+ }
880
+ }
881
+ else {
882
+ const execRetryIdx = ctx.addExecution('execRetry');
883
+ await ctx.setVariable({ id: 'execRetry', portName: 'onSuccess', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, false);
884
+ await ctx.setVariable({ id: 'execRetry', portName: 'onFailure', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, false);
885
+ await ctx.sendStatusChangedEvent({
886
+ nodeTypeName: 'weaverExecValidateRetry',
887
+ id: 'execRetry',
888
+ executionIndex: execRetryIdx,
889
+ status: 'CANCELLED',
890
+ });
891
+ if (await __ctrl__.beforeNode('abort', ctx)) {
892
+ // ── abort (weaverAbortTask) ──
893
+ ctx.checkAborted('abort');
894
+ abortIdx = ctx.addExecution('abort');
895
+ if (typeof globalThis !== 'undefined')
896
+ globalThis.__fw_current_node_id__ = 'abort';
897
+ await ctx.sendStatusChangedEvent({
898
+ nodeTypeName: 'weaverAbortTask',
899
+ id: 'abort',
900
+ executionIndex: abortIdx,
901
+ status: 'RUNNING',
902
+ });
903
+ try {
904
+ await ctx.setVariable({ id: 'abort', portName: 'execute', executionIndex: abortIdx, nodeTypeName: 'weaverAbortTask' }, true);
905
+ const abort_ctx = await ctx.getVariable({ id: 'approve', portName: 'ctx', executionIndex: approveIdx });
906
+ await ctx.setVariable({ id: 'abort', portName: 'ctx', executionIndex: abortIdx, nodeTypeName: 'weaverAbortTask' }, abort_ctx);
907
+ const abortResult = weaverAbortTask(abort_ctx);
908
+ const abortResult_raw = abortResult;
909
+ await ctx.setVariable({ id: 'abort', portName: 'ctx', executionIndex: abortIdx, nodeTypeName: 'weaverAbortTask' }, typeof abortResult_raw === 'object' && abortResult_raw !== null && 'ctx' in abortResult_raw ? abortResult_raw.ctx : abortResult_raw);
910
+ await ctx.setVariable({ id: 'abort', portName: 'onSuccess', executionIndex: abortIdx, nodeTypeName: 'weaverAbortTask' }, true);
911
+ await ctx.setVariable({ id: 'abort', portName: 'onFailure', executionIndex: abortIdx, nodeTypeName: 'weaverAbortTask' }, false);
912
+ await ctx.sendStatusChangedEvent({
913
+ nodeTypeName: 'weaverAbortTask',
914
+ id: 'abort',
915
+ executionIndex: abortIdx,
916
+ status: 'SUCCEEDED',
917
+ });
918
+ await __ctrl__.afterNode('abort', ctx);
919
+ }
920
+ catch (error) {
921
+ const isCancellation = CancellationError.isCancellationError(error);
922
+ await ctx.sendStatusChangedEvent({
923
+ nodeTypeName: 'weaverAbortTask',
924
+ id: 'abort',
925
+ executionIndex: abortIdx,
926
+ status: isCancellation ? 'CANCELLED' : 'FAILED',
927
+ });
928
+ if (!isCancellation) {
929
+ ctx.sendLogErrorEvent({
930
+ nodeTypeName: 'weaverAbortTask',
931
+ id: 'abort',
932
+ executionIndex: abortIdx,
933
+ error: error instanceof Error ? error.message : String(error),
934
+ });
935
+ await ctx.setVariable({ id: 'abort', portName: 'onSuccess', executionIndex: abortIdx, nodeTypeName: 'weaverAbortTask' }, false);
936
+ await ctx.setVariable({ id: 'abort', portName: 'onFailure', executionIndex: abortIdx, nodeTypeName: 'weaverAbortTask' }, true);
937
+ }
938
+ throw error;
939
+ }
940
+ }
941
+ else {
942
+ abortIdx = ctx.addExecution('abort');
943
+ }
944
+ }
945
+ }
946
+ else {
947
+ const approveIdx = ctx.addExecution('approve');
948
+ await ctx.setVariable({ id: 'approve', portName: 'onSuccess', executionIndex: approveIdx, nodeTypeName: 'weaverApprovalGate' }, false);
949
+ await ctx.setVariable({ id: 'approve', portName: 'onFailure', executionIndex: approveIdx, nodeTypeName: 'weaverApprovalGate' }, false);
950
+ await ctx.sendStatusChangedEvent({
951
+ nodeTypeName: 'weaverApprovalGate',
952
+ id: 'approve',
953
+ executionIndex: approveIdx,
954
+ status: 'CANCELLED',
955
+ });
956
+ }
957
+ }
958
+ else {
959
+ const planIdx = ctx.addExecution('plan');
960
+ await ctx.setVariable({ id: 'plan', portName: 'onSuccess', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, false);
961
+ await ctx.setVariable({ id: 'plan', portName: 'onFailure', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, false);
962
+ await ctx.sendStatusChangedEvent({
963
+ nodeTypeName: 'weaverPlanTask',
964
+ id: 'plan',
965
+ executionIndex: planIdx,
966
+ status: 'CANCELLED',
967
+ });
968
+ }
969
+ }
970
+ else {
971
+ const contextIdx = ctx.addExecution('context');
972
+ await ctx.setVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
973
+ await ctx.setVariable({ id: 'context', portName: 'onFailure', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
974
+ await ctx.sendStatusChangedEvent({
975
+ nodeTypeName: 'weaverBuildContext',
976
+ id: 'context',
977
+ executionIndex: contextIdx,
978
+ status: 'CANCELLED',
979
+ });
980
+ if (await __ctrl__.beforeNode('readWf', ctx)) {
981
+ // ── readWf (weaverReadWorkflow) ──
982
+ ctx.checkAborted('readWf');
983
+ readWfIdx = ctx.addExecution('readWf');
984
+ if (typeof globalThis !== 'undefined')
985
+ globalThis.__fw_current_node_id__ = 'readWf';
986
+ await ctx.sendStatusChangedEvent({
987
+ nodeTypeName: 'weaverReadWorkflow',
988
+ id: 'readWf',
989
+ executionIndex: readWfIdx,
990
+ status: 'RUNNING',
991
+ });
992
+ try {
993
+ await ctx.setVariable({ id: 'readWf', portName: 'execute', executionIndex: readWfIdx, nodeTypeName: 'weaverReadWorkflow' }, true);
994
+ const readWf_ctx = await ctx.getVariable({ id: 'route', portName: 'ctx', executionIndex: routeIdx });
995
+ await ctx.setVariable({ id: 'readWf', portName: 'ctx', executionIndex: readWfIdx, nodeTypeName: 'weaverReadWorkflow' }, readWf_ctx);
996
+ const readWfResult = weaverReadWorkflow(readWf_ctx);
997
+ const readWfResult_raw = readWfResult;
998
+ await ctx.setVariable({ id: 'readWf', portName: 'ctx', executionIndex: readWfIdx, nodeTypeName: 'weaverReadWorkflow' }, typeof readWfResult_raw === 'object' && readWfResult_raw !== null && 'ctx' in readWfResult_raw ? readWfResult_raw.ctx : readWfResult_raw);
999
+ await ctx.setVariable({ id: 'readWf', portName: 'onSuccess', executionIndex: readWfIdx, nodeTypeName: 'weaverReadWorkflow' }, true);
1000
+ await ctx.setVariable({ id: 'readWf', portName: 'onFailure', executionIndex: readWfIdx, nodeTypeName: 'weaverReadWorkflow' }, false);
1001
+ await ctx.sendStatusChangedEvent({
1002
+ nodeTypeName: 'weaverReadWorkflow',
1003
+ id: 'readWf',
1004
+ executionIndex: readWfIdx,
1005
+ status: 'SUCCEEDED',
1006
+ });
1007
+ await __ctrl__.afterNode('readWf', ctx);
1008
+ }
1009
+ catch (error) {
1010
+ const isCancellation = CancellationError.isCancellationError(error);
1011
+ await ctx.sendStatusChangedEvent({
1012
+ nodeTypeName: 'weaverReadWorkflow',
1013
+ id: 'readWf',
1014
+ executionIndex: readWfIdx,
1015
+ status: isCancellation ? 'CANCELLED' : 'FAILED',
1016
+ });
1017
+ if (!isCancellation) {
1018
+ ctx.sendLogErrorEvent({
1019
+ nodeTypeName: 'weaverReadWorkflow',
1020
+ id: 'readWf',
1021
+ executionIndex: readWfIdx,
1022
+ error: error instanceof Error ? error.message : String(error),
1023
+ });
1024
+ await ctx.setVariable({ id: 'readWf', portName: 'onSuccess', executionIndex: readWfIdx, nodeTypeName: 'weaverReadWorkflow' }, false);
1025
+ await ctx.setVariable({ id: 'readWf', portName: 'onFailure', executionIndex: readWfIdx, nodeTypeName: 'weaverReadWorkflow' }, true);
1026
+ }
1027
+ throw error;
1028
+ }
1029
+ }
1030
+ else {
1031
+ readWfIdx = ctx.addExecution('readWf');
1032
+ }
1033
+ }
1034
+ }
1035
+ else {
1036
+ const routeIdx = ctx.addExecution('route');
1037
+ await ctx.setVariable({ id: 'route', portName: 'onSuccess', executionIndex: routeIdx, nodeTypeName: 'weaverRouteTask' }, false);
1038
+ await ctx.setVariable({ id: 'route', portName: 'onFailure', executionIndex: routeIdx, nodeTypeName: 'weaverRouteTask' }, false);
1039
+ await ctx.sendStatusChangedEvent({
1040
+ nodeTypeName: 'weaverRouteTask',
1041
+ id: 'route',
1042
+ executionIndex: routeIdx,
1043
+ status: 'CANCELLED',
1044
+ });
1045
+ const contextIdx = ctx.addExecution('context');
1046
+ await ctx.setVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
1047
+ await ctx.setVariable({ id: 'context', portName: 'onFailure', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
1048
+ await ctx.sendStatusChangedEvent({
1049
+ nodeTypeName: 'weaverBuildContext',
1050
+ id: 'context',
1051
+ executionIndex: contextIdx,
1052
+ status: 'CANCELLED',
1053
+ });
1054
+ const readWfIdx = ctx.addExecution('readWf');
1055
+ await ctx.setVariable({ id: 'readWf', portName: 'onSuccess', executionIndex: readWfIdx, nodeTypeName: 'weaverReadWorkflow' }, false);
1056
+ await ctx.setVariable({ id: 'readWf', portName: 'onFailure', executionIndex: readWfIdx, nodeTypeName: 'weaverReadWorkflow' }, false);
1057
+ await ctx.sendStatusChangedEvent({
1058
+ nodeTypeName: 'weaverReadWorkflow',
1059
+ id: 'readWf',
1060
+ executionIndex: readWfIdx,
1061
+ status: 'CANCELLED',
1062
+ });
1063
+ }
1064
+ if (await __ctrl__.beforeNode('report', ctx)) {
1065
+ // ── report (weaverBotReport) ──
1066
+ ctx.checkAborted('report');
1067
+ reportIdx = ctx.addExecution('report');
1068
+ if (typeof globalThis !== 'undefined')
1069
+ globalThis.__fw_current_node_id__ = 'report';
1070
+ await ctx.sendStatusChangedEvent({
1071
+ nodeTypeName: 'weaverBotReport',
1072
+ id: 'report',
1073
+ executionIndex: reportIdx,
1074
+ status: 'RUNNING',
1075
+ });
1076
+ try {
1077
+ const report_execute = (readWfIdx !== undefined ? await ctx.getVariable({ id: 'readWf', portName: 'onSuccess', executionIndex: readWfIdx }) : false) || (abortIdx !== undefined ? await ctx.getVariable({ id: 'abort', portName: 'onSuccess', executionIndex: abortIdx }) : false) || (notifyIdx !== undefined ? await ctx.getVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx }) : false) || (gitOpsIdx !== undefined ? await ctx.getVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx }) : false);
1078
+ await ctx.setVariable({ id: 'report', portName: 'execute', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_execute);
1079
+ const report_mainCtx = gitOpsIdx !== undefined ? await ctx.getVariable({ id: 'gitOps', portName: 'ctx', executionIndex: gitOpsIdx }) : undefined;
1080
+ await ctx.setVariable({ id: 'report', portName: 'mainCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_mainCtx);
1081
+ const report_readCtx = readWfIdx !== undefined ? await ctx.getVariable({ id: 'readWf', portName: 'ctx', executionIndex: readWfIdx }) : undefined;
1082
+ await ctx.setVariable({ id: 'report', portName: 'readCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_readCtx);
1083
+ const report_abortCtx = abortIdx !== undefined ? await ctx.getVariable({ id: 'abort', portName: 'ctx', executionIndex: abortIdx }) : undefined;
1084
+ await ctx.setVariable({ id: 'report', portName: 'abortCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_abortCtx);
1085
+ const reportResult = await weaverBotReport(report_execute, report_mainCtx, report_readCtx, report_abortCtx);
1086
+ await ctx.setVariable({ id: 'report', portName: 'summary', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.summary);
1087
+ await ctx.setVariable({ id: 'report', portName: 'reportJson', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.reportJson);
1088
+ await ctx.setVariable({ id: 'report', portName: 'onFailure', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.onFailure);
1089
+ await ctx.setVariable({ id: 'report', portName: 'onSuccess', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.onSuccess);
1090
+ await ctx.sendStatusChangedEvent({
1091
+ nodeTypeName: 'weaverBotReport',
1092
+ id: 'report',
1093
+ executionIndex: reportIdx,
1094
+ status: 'SUCCEEDED',
1095
+ });
1096
+ await __ctrl__.afterNode('report', ctx);
1097
+ }
1098
+ catch (error) {
1099
+ const isCancellation = CancellationError.isCancellationError(error);
1100
+ await ctx.sendStatusChangedEvent({
1101
+ nodeTypeName: 'weaverBotReport',
1102
+ id: 'report',
1103
+ executionIndex: reportIdx,
1104
+ status: isCancellation ? 'CANCELLED' : 'FAILED',
1105
+ });
1106
+ if (!isCancellation) {
1107
+ ctx.sendLogErrorEvent({
1108
+ nodeTypeName: 'weaverBotReport',
1109
+ id: 'report',
1110
+ executionIndex: reportIdx,
1111
+ error: error instanceof Error ? error.message : String(error),
1112
+ });
1113
+ await ctx.setVariable({ id: 'report', portName: 'onSuccess', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, false);
1114
+ await ctx.setVariable({ id: 'report', portName: 'onFailure', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, true);
1115
+ }
1116
+ throw error;
1117
+ }
1118
+ }
1119
+ else {
1120
+ reportIdx = ctx.addExecution('report');
1121
+ }
1122
+ const exitIdx = ctx.addExecution('Exit');
1123
+ const exit_summary = reportIdx !== undefined ? await ctx.getVariable({ id: 'report', portName: 'summary', executionIndex: reportIdx }) : undefined;
1124
+ await ctx.setVariable({ id: 'Exit', portName: 'summary', executionIndex: exitIdx, nodeTypeName: 'Exit' }, exit_summary);
1125
+ const exit_onSuccess = reportIdx !== undefined ? await ctx.getVariable({ id: 'report', portName: 'onSuccess', executionIndex: reportIdx }) : false;
1126
+ await ctx.setVariable({ id: 'Exit', portName: 'onSuccess', executionIndex: exitIdx, nodeTypeName: 'Exit' }, exit_onSuccess);
1127
+ await ctx.setVariable({ id: 'Exit', portName: 'onFailure', executionIndex: exitIdx, nodeTypeName: 'Exit' }, false);
1128
+ const finalResult = { onFailure: false, summary: exit_summary, onSuccess: exit_onSuccess };
1129
+ await ctx.sendStatusChangedEvent({
1130
+ nodeTypeName: 'Exit',
1131
+ id: 'Exit',
1132
+ executionIndex: exitIdx,
1133
+ status: 'SUCCEEDED',
1134
+ });
1135
+ ctx.sendWorkflowCompletedEvent({
1136
+ executionIndex: exitIdx,
1137
+ status: 'SUCCEEDED',
1138
+ result: finalResult,
1139
+ });
1140
+ return finalResult;
58
1141
  // @flow-weaver-body-end
59
1142
  return { onSuccess: false, onFailure: true, summary: null };
60
1143
  }