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