@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
@@ -0,0 +1,777 @@
1
+ // Weaver agent workflow — tool-use based execution.
2
+ // Uses Claude's tool calling to drive tasks dynamically instead of
3
+ // the plan-execute-retry pattern.
4
+ import { weaverLoadConfig } from '../node-types/load-config.js';
5
+ import { weaverDetectProvider } from '../node-types/detect-provider.js';
6
+ import { weaverReceiveTask } from '../node-types/receive-task.js';
7
+ import { weaverBuildContext } from '../node-types/build-context.js';
8
+ import { weaverAgentExecute } from '../node-types/agent-execute.js';
9
+ import { weaverGitOps } from '../node-types/git-ops.js';
10
+ import { weaverSendNotify } from '../node-types/send-notify.js';
11
+ import { weaverBotReport } from '../node-types/bot-report.js';
12
+ // @flow-weaver-runtime-start
13
+ // ============================================================================
14
+ // DO NOT EDIT - This section is auto-generated by Flow Weaver
15
+ // ============================================================================
16
+ import { GeneratedExecutionContext, CancellationError } from '@synergenius/flow-weaver/runtime';
17
+ // @flow-weaver-runtime-end
18
+ /**
19
+ * @flowWeaver workflow
20
+ * @node cfg weaverLoadConfig [color: "teal"] [icon: "settings"] [position: 200 200]
21
+ * @node detect weaverDetectProvider [color: "cyan"] [icon: "search"] [position: 400 200] [suppress: "OBJECT_TYPE_MISMATCH", "ANNOTATION_SIGNATURE_TYPE_MISMATCH"]
22
+ * @node receive weaverReceiveTask [color: "blue"] [icon: "send"] [position: 600 200]
23
+ * @node context weaverBuildContext [color: "teal"] [icon: "code"] [position: 800 200]
24
+ * @node agent weaverAgentExecute [color: "purple"] [icon: "psychology"] [position: 1000 200]
25
+ * @node gitOps weaverGitOps [color: "green"] [icon: "code"] [position: 1200 100]
26
+ * @node notify weaverSendNotify [color: "yellow"] [icon: "send"] [position: 1200 300] [suppress: "UNUSED_OUTPUT_PORT"]
27
+ * @node report weaverBotReport [color: "green"] [icon: "description"] [position: 1400 200] [suppress: "UNUSED_OUTPUT_PORT", "DESIGN_ASYNC_NO_ERROR_PATH"]
28
+ * @path Start -> cfg -> detect -> receive -> context -> agent -> gitOps -> report -> Exit
29
+ * @path agent -> notify
30
+ * @path receive:fail -> report
31
+ * @path agent:fail -> report
32
+ * @position Start 0 200
33
+ * @position Exit 1600 200
34
+ * @connect gitOps.ctx -> report.mainCtx
35
+ * @connect notify.onSuccess -> report.execute
36
+ * @connect report.summary -> Exit.summary
37
+ * @param execute [order:-1] - Execute
38
+ * @param taskJson [order:0] - TaskJson
39
+ * @param projectDir [order:1] - ProjectDir
40
+ * @returns onSuccess [order:-2] - On Success
41
+ * @returns onFailure [order:-1] - On Failure
42
+ * @returns summary [order:0] - Summary text
43
+ */
44
+ export async function weaverAgent(execute, params, __abortSignal__) {
45
+ // @flow-weaver-body-start
46
+ // ============================================================================
47
+ // DO NOT EDIT - This section is auto-generated by Flow Weaver
48
+ // Edit the @flowWeaver annotations above to modify workflow behavior
49
+ // ============================================================================
50
+ const __effectiveDebugger__ = typeof __flowWeaverDebugger__ !== 'undefined' ? __flowWeaverDebugger__ : undefined;
51
+ // Recursion depth protection
52
+ const __rd__ = params.__rd__ ?? 0;
53
+ if (__rd__ >= 1000) {
54
+ throw new Error('Max recursion depth exceeded (1000) in workflow "weaverAgent"');
55
+ }
56
+ const ctx = new GeneratedExecutionContext(true, __effectiveDebugger__, __abortSignal__);
57
+ // Debug controller for step-through debugging and checkpoint/resume
58
+ const __ctrl__ = (typeof globalThis !== 'undefined' && globalThis.__fw_debug_controller__
59
+ ? globalThis.__fw_debug_controller__
60
+ : { beforeNode: () => true, afterNode: () => { } });
61
+ const startIdx = ctx.addExecution('Start');
62
+ await ctx.setVariable({ id: 'Start', portName: 'execute', executionIndex: startIdx, nodeTypeName: 'Start' }, execute);
63
+ await ctx.setVariable({ id: 'Start', portName: 'taskJson', executionIndex: startIdx, nodeTypeName: 'Start' }, params.taskJson);
64
+ await ctx.setVariable({ id: 'Start', portName: 'projectDir', executionIndex: startIdx, nodeTypeName: 'Start' }, params.projectDir);
65
+ await ctx.sendStatusChangedEvent({
66
+ nodeTypeName: 'Start',
67
+ id: 'Start',
68
+ executionIndex: startIdx,
69
+ status: 'SUCCEEDED',
70
+ });
71
+ let cfgIdx;
72
+ let detectIdx;
73
+ let receiveIdx;
74
+ let contextIdx;
75
+ let agentIdx;
76
+ let gitOpsIdx;
77
+ let notifyIdx;
78
+ let reportIdx;
79
+ let cfg_success = false;
80
+ let detect_success = false;
81
+ let receive_success = false;
82
+ let context_success = false;
83
+ if (await __ctrl__.beforeNode('cfg', ctx)) {
84
+ // ── cfg (weaverLoadConfig) ──
85
+ ctx.checkAborted('cfg');
86
+ cfgIdx = ctx.addExecution('cfg');
87
+ if (typeof globalThis !== 'undefined')
88
+ globalThis.__fw_current_node_id__ = 'cfg';
89
+ await ctx.sendStatusChangedEvent({
90
+ nodeTypeName: 'weaverLoadConfig',
91
+ id: 'cfg',
92
+ executionIndex: cfgIdx,
93
+ status: 'RUNNING',
94
+ });
95
+ cfg_success = false;
96
+ try {
97
+ await ctx.setVariable({ id: 'cfg', portName: 'execute', executionIndex: cfgIdx, nodeTypeName: 'weaverLoadConfig' }, true);
98
+ const cfg_projectDir = await ctx.getVariable({ id: 'Start', portName: 'projectDir', executionIndex: startIdx });
99
+ await ctx.setVariable({ id: 'cfg', portName: 'projectDir', executionIndex: cfgIdx, nodeTypeName: 'weaverLoadConfig' }, cfg_projectDir);
100
+ const cfgResult = weaverLoadConfig(cfg_projectDir);
101
+ await ctx.setVariable({ id: 'cfg', portName: 'projectDir', executionIndex: cfgIdx, nodeTypeName: 'weaverLoadConfig' }, cfgResult.projectDir);
102
+ await ctx.setVariable({ id: 'cfg', portName: 'config', executionIndex: cfgIdx, nodeTypeName: 'weaverLoadConfig' }, cfgResult.config);
103
+ await ctx.setVariable({ id: 'cfg', portName: 'onSuccess', executionIndex: cfgIdx, nodeTypeName: 'weaverLoadConfig' }, true);
104
+ await ctx.setVariable({ id: 'cfg', portName: 'onFailure', executionIndex: cfgIdx, nodeTypeName: 'weaverLoadConfig' }, false);
105
+ await ctx.sendStatusChangedEvent({
106
+ nodeTypeName: 'weaverLoadConfig',
107
+ id: 'cfg',
108
+ executionIndex: cfgIdx,
109
+ status: 'SUCCEEDED',
110
+ });
111
+ await __ctrl__.afterNode('cfg', ctx);
112
+ cfg_success = true;
113
+ }
114
+ catch (error) {
115
+ const isCancellation = CancellationError.isCancellationError(error);
116
+ await ctx.sendStatusChangedEvent({
117
+ nodeTypeName: 'weaverLoadConfig',
118
+ id: 'cfg',
119
+ executionIndex: cfgIdx,
120
+ status: isCancellation ? 'CANCELLED' : 'FAILED',
121
+ });
122
+ if (!isCancellation) {
123
+ ctx.sendLogErrorEvent({
124
+ nodeTypeName: 'weaverLoadConfig',
125
+ id: 'cfg',
126
+ executionIndex: cfgIdx,
127
+ error: error instanceof Error ? error.message : String(error),
128
+ });
129
+ await ctx.setVariable({ id: 'cfg', portName: 'onSuccess', executionIndex: cfgIdx, nodeTypeName: 'weaverLoadConfig' }, false);
130
+ await ctx.setVariable({ id: 'cfg', portName: 'onFailure', executionIndex: cfgIdx, nodeTypeName: 'weaverLoadConfig' }, true);
131
+ cfg_success = false;
132
+ }
133
+ throw error;
134
+ }
135
+ }
136
+ else {
137
+ cfgIdx = ctx.addExecution('cfg');
138
+ cfg_success = true;
139
+ }
140
+ if (cfg_success) {
141
+ if (await __ctrl__.beforeNode('detect', ctx)) {
142
+ // ── detect (weaverDetectProvider) ──
143
+ ctx.checkAborted('detect');
144
+ detectIdx = ctx.addExecution('detect');
145
+ if (typeof globalThis !== 'undefined')
146
+ globalThis.__fw_current_node_id__ = 'detect';
147
+ await ctx.sendStatusChangedEvent({
148
+ nodeTypeName: 'weaverDetectProvider',
149
+ id: 'detect',
150
+ executionIndex: detectIdx,
151
+ status: 'RUNNING',
152
+ });
153
+ detect_success = false;
154
+ try {
155
+ await ctx.setVariable({ id: 'detect', portName: 'execute', executionIndex: detectIdx, nodeTypeName: 'weaverDetectProvider' }, true);
156
+ const detect_projectDir = await ctx.getVariable({ id: 'cfg', portName: 'projectDir', executionIndex: cfgIdx });
157
+ await ctx.setVariable({ id: 'detect', portName: 'projectDir', executionIndex: detectIdx, nodeTypeName: 'weaverDetectProvider' }, detect_projectDir);
158
+ const detect_config = await ctx.getVariable({ id: 'cfg', portName: 'config', executionIndex: cfgIdx });
159
+ await ctx.setVariable({ id: 'detect', portName: 'config', executionIndex: detectIdx, nodeTypeName: 'weaverDetectProvider' }, detect_config);
160
+ const detectResult = weaverDetectProvider(detect_projectDir, detect_config);
161
+ const detectResult_raw = detectResult;
162
+ 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);
163
+ await ctx.setVariable({ id: 'detect', portName: 'onSuccess', executionIndex: detectIdx, nodeTypeName: 'weaverDetectProvider' }, true);
164
+ await ctx.setVariable({ id: 'detect', portName: 'onFailure', executionIndex: detectIdx, nodeTypeName: 'weaverDetectProvider' }, false);
165
+ await ctx.sendStatusChangedEvent({
166
+ nodeTypeName: 'weaverDetectProvider',
167
+ id: 'detect',
168
+ executionIndex: detectIdx,
169
+ status: 'SUCCEEDED',
170
+ });
171
+ await __ctrl__.afterNode('detect', ctx);
172
+ detect_success = true;
173
+ }
174
+ catch (error) {
175
+ const isCancellation = CancellationError.isCancellationError(error);
176
+ await ctx.sendStatusChangedEvent({
177
+ nodeTypeName: 'weaverDetectProvider',
178
+ id: 'detect',
179
+ executionIndex: detectIdx,
180
+ status: isCancellation ? 'CANCELLED' : 'FAILED',
181
+ });
182
+ if (!isCancellation) {
183
+ ctx.sendLogErrorEvent({
184
+ nodeTypeName: 'weaverDetectProvider',
185
+ id: 'detect',
186
+ executionIndex: detectIdx,
187
+ error: error instanceof Error ? error.message : String(error),
188
+ });
189
+ await ctx.setVariable({ id: 'detect', portName: 'onSuccess', executionIndex: detectIdx, nodeTypeName: 'weaverDetectProvider' }, false);
190
+ await ctx.setVariable({ id: 'detect', portName: 'onFailure', executionIndex: detectIdx, nodeTypeName: 'weaverDetectProvider' }, true);
191
+ detect_success = false;
192
+ }
193
+ throw error;
194
+ }
195
+ }
196
+ else {
197
+ detectIdx = ctx.addExecution('detect');
198
+ detect_success = true;
199
+ }
200
+ }
201
+ else {
202
+ const detectIdx = ctx.addExecution('detect');
203
+ await ctx.setVariable({ id: 'detect', portName: 'onSuccess', executionIndex: detectIdx, nodeTypeName: 'weaverDetectProvider' }, false);
204
+ await ctx.setVariable({ id: 'detect', portName: 'onFailure', executionIndex: detectIdx, nodeTypeName: 'weaverDetectProvider' }, false);
205
+ await ctx.sendStatusChangedEvent({
206
+ nodeTypeName: 'weaverDetectProvider',
207
+ id: 'detect',
208
+ executionIndex: detectIdx,
209
+ status: 'CANCELLED',
210
+ });
211
+ const receiveIdx = ctx.addExecution('receive');
212
+ await ctx.setVariable({ id: 'receive', portName: 'onSuccess', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, false);
213
+ await ctx.setVariable({ id: 'receive', portName: 'onFailure', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, false);
214
+ await ctx.sendStatusChangedEvent({
215
+ nodeTypeName: 'weaverReceiveTask',
216
+ id: 'receive',
217
+ executionIndex: receiveIdx,
218
+ status: 'CANCELLED',
219
+ });
220
+ const contextIdx = ctx.addExecution('context');
221
+ await ctx.setVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
222
+ await ctx.setVariable({ id: 'context', portName: 'onFailure', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
223
+ await ctx.sendStatusChangedEvent({
224
+ nodeTypeName: 'weaverBuildContext',
225
+ id: 'context',
226
+ executionIndex: contextIdx,
227
+ status: 'CANCELLED',
228
+ });
229
+ const agentIdx = ctx.addExecution('agent');
230
+ await ctx.setVariable({ id: 'agent', portName: 'onSuccess', executionIndex: agentIdx, nodeTypeName: 'weaverAgentExecute' }, false);
231
+ await ctx.setVariable({ id: 'agent', portName: 'onFailure', executionIndex: agentIdx, nodeTypeName: 'weaverAgentExecute' }, false);
232
+ await ctx.sendStatusChangedEvent({
233
+ nodeTypeName: 'weaverAgentExecute',
234
+ id: 'agent',
235
+ executionIndex: agentIdx,
236
+ status: 'CANCELLED',
237
+ });
238
+ const gitOpsIdx = ctx.addExecution('gitOps');
239
+ await ctx.setVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
240
+ await ctx.setVariable({ id: 'gitOps', portName: 'onFailure', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
241
+ await ctx.sendStatusChangedEvent({
242
+ nodeTypeName: 'weaverGitOps',
243
+ id: 'gitOps',
244
+ executionIndex: gitOpsIdx,
245
+ status: 'CANCELLED',
246
+ });
247
+ const notifyIdx = ctx.addExecution('notify');
248
+ await ctx.setVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
249
+ await ctx.setVariable({ id: 'notify', portName: 'onFailure', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
250
+ await ctx.sendStatusChangedEvent({
251
+ nodeTypeName: 'weaverSendNotify',
252
+ id: 'notify',
253
+ executionIndex: notifyIdx,
254
+ status: 'CANCELLED',
255
+ });
256
+ }
257
+ if (cfg_success && detect_success) {
258
+ if (await __ctrl__.beforeNode('receive', ctx)) {
259
+ // ── receive (weaverReceiveTask) ──
260
+ ctx.checkAborted('receive');
261
+ receiveIdx = ctx.addExecution('receive');
262
+ if (typeof globalThis !== 'undefined')
263
+ globalThis.__fw_current_node_id__ = 'receive';
264
+ await ctx.sendStatusChangedEvent({
265
+ nodeTypeName: 'weaverReceiveTask',
266
+ id: 'receive',
267
+ executionIndex: receiveIdx,
268
+ status: 'RUNNING',
269
+ });
270
+ receive_success = false;
271
+ try {
272
+ const receive_execute = detectIdx !== undefined ? await ctx.getVariable({ id: 'detect', portName: 'onSuccess', executionIndex: detectIdx }) : false;
273
+ await ctx.setVariable({ id: 'receive', portName: 'execute', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receive_execute);
274
+ const receive_env = await ctx.getVariable({ id: 'detect', portName: 'env', executionIndex: detectIdx });
275
+ await ctx.setVariable({ id: 'receive', portName: 'env', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receive_env);
276
+ const receive_taskJson = await ctx.getVariable({ id: 'Start', portName: 'taskJson', executionIndex: startIdx });
277
+ await ctx.setVariable({ id: 'receive', portName: 'taskJson', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receive_taskJson);
278
+ const receiveResult = await weaverReceiveTask(receive_execute, receive_env, receive_taskJson);
279
+ await ctx.setVariable({ id: 'receive', portName: 'ctx', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receiveResult.ctx);
280
+ await ctx.setVariable({ id: 'receive', portName: 'onSuccess', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receiveResult.onSuccess);
281
+ await ctx.setVariable({ id: 'receive', portName: 'onFailure', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receiveResult.onFailure);
282
+ await ctx.sendStatusChangedEvent({
283
+ nodeTypeName: 'weaverReceiveTask',
284
+ id: 'receive',
285
+ executionIndex: receiveIdx,
286
+ status: 'SUCCEEDED',
287
+ });
288
+ await __ctrl__.afterNode('receive', ctx);
289
+ receive_success = receiveResult.onSuccess;
290
+ }
291
+ catch (error) {
292
+ const isCancellation = CancellationError.isCancellationError(error);
293
+ await ctx.sendStatusChangedEvent({
294
+ nodeTypeName: 'weaverReceiveTask',
295
+ id: 'receive',
296
+ executionIndex: receiveIdx,
297
+ status: isCancellation ? 'CANCELLED' : 'FAILED',
298
+ });
299
+ if (!isCancellation) {
300
+ ctx.sendLogErrorEvent({
301
+ nodeTypeName: 'weaverReceiveTask',
302
+ id: 'receive',
303
+ executionIndex: receiveIdx,
304
+ error: error instanceof Error ? error.message : String(error),
305
+ });
306
+ await ctx.setVariable({ id: 'receive', portName: 'onSuccess', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, false);
307
+ await ctx.setVariable({ id: 'receive', portName: 'onFailure', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, true);
308
+ receive_success = false;
309
+ }
310
+ throw error;
311
+ }
312
+ }
313
+ else {
314
+ receiveIdx = ctx.addExecution('receive');
315
+ receive_success = true;
316
+ }
317
+ }
318
+ else {
319
+ const receiveIdx = ctx.addExecution('receive');
320
+ await ctx.setVariable({ id: 'receive', portName: 'onSuccess', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, false);
321
+ await ctx.setVariable({ id: 'receive', portName: 'onFailure', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, false);
322
+ await ctx.sendStatusChangedEvent({
323
+ nodeTypeName: 'weaverReceiveTask',
324
+ id: 'receive',
325
+ executionIndex: receiveIdx,
326
+ status: 'CANCELLED',
327
+ });
328
+ const contextIdx = ctx.addExecution('context');
329
+ await ctx.setVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
330
+ await ctx.setVariable({ id: 'context', portName: 'onFailure', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
331
+ await ctx.sendStatusChangedEvent({
332
+ nodeTypeName: 'weaverBuildContext',
333
+ id: 'context',
334
+ executionIndex: contextIdx,
335
+ status: 'CANCELLED',
336
+ });
337
+ const agentIdx = ctx.addExecution('agent');
338
+ await ctx.setVariable({ id: 'agent', portName: 'onSuccess', executionIndex: agentIdx, nodeTypeName: 'weaverAgentExecute' }, false);
339
+ await ctx.setVariable({ id: 'agent', portName: 'onFailure', executionIndex: agentIdx, nodeTypeName: 'weaverAgentExecute' }, false);
340
+ await ctx.sendStatusChangedEvent({
341
+ nodeTypeName: 'weaverAgentExecute',
342
+ id: 'agent',
343
+ executionIndex: agentIdx,
344
+ status: 'CANCELLED',
345
+ });
346
+ const gitOpsIdx = ctx.addExecution('gitOps');
347
+ await ctx.setVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
348
+ await ctx.setVariable({ id: 'gitOps', portName: 'onFailure', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
349
+ await ctx.sendStatusChangedEvent({
350
+ nodeTypeName: 'weaverGitOps',
351
+ id: 'gitOps',
352
+ executionIndex: gitOpsIdx,
353
+ status: 'CANCELLED',
354
+ });
355
+ const notifyIdx = ctx.addExecution('notify');
356
+ await ctx.setVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
357
+ await ctx.setVariable({ id: 'notify', portName: 'onFailure', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
358
+ await ctx.sendStatusChangedEvent({
359
+ nodeTypeName: 'weaverSendNotify',
360
+ id: 'notify',
361
+ executionIndex: notifyIdx,
362
+ status: 'CANCELLED',
363
+ });
364
+ }
365
+ if (cfg_success && detect_success && receive_success) {
366
+ if (await __ctrl__.beforeNode('context', ctx)) {
367
+ // ── context (weaverBuildContext) ──
368
+ ctx.checkAborted('context');
369
+ contextIdx = ctx.addExecution('context');
370
+ if (typeof globalThis !== 'undefined')
371
+ globalThis.__fw_current_node_id__ = 'context';
372
+ await ctx.sendStatusChangedEvent({
373
+ nodeTypeName: 'weaverBuildContext',
374
+ id: 'context',
375
+ executionIndex: contextIdx,
376
+ status: 'RUNNING',
377
+ });
378
+ context_success = false;
379
+ try {
380
+ await ctx.setVariable({ id: 'context', portName: 'execute', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, true);
381
+ const context_ctx = await ctx.getVariable({ id: 'receive', portName: 'ctx', executionIndex: receiveIdx });
382
+ await ctx.setVariable({ id: 'context', portName: 'ctx', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, context_ctx);
383
+ const contextResult = weaverBuildContext(context_ctx);
384
+ const contextResult_raw = contextResult;
385
+ 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);
386
+ await ctx.setVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, true);
387
+ await ctx.setVariable({ id: 'context', portName: 'onFailure', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
388
+ await ctx.sendStatusChangedEvent({
389
+ nodeTypeName: 'weaverBuildContext',
390
+ id: 'context',
391
+ executionIndex: contextIdx,
392
+ status: 'SUCCEEDED',
393
+ });
394
+ await __ctrl__.afterNode('context', ctx);
395
+ context_success = true;
396
+ }
397
+ catch (error) {
398
+ const isCancellation = CancellationError.isCancellationError(error);
399
+ await ctx.sendStatusChangedEvent({
400
+ nodeTypeName: 'weaverBuildContext',
401
+ id: 'context',
402
+ executionIndex: contextIdx,
403
+ status: isCancellation ? 'CANCELLED' : 'FAILED',
404
+ });
405
+ if (!isCancellation) {
406
+ ctx.sendLogErrorEvent({
407
+ nodeTypeName: 'weaverBuildContext',
408
+ id: 'context',
409
+ executionIndex: contextIdx,
410
+ error: error instanceof Error ? error.message : String(error),
411
+ });
412
+ await ctx.setVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
413
+ await ctx.setVariable({ id: 'context', portName: 'onFailure', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, true);
414
+ context_success = false;
415
+ }
416
+ throw error;
417
+ }
418
+ }
419
+ else {
420
+ contextIdx = ctx.addExecution('context');
421
+ context_success = true;
422
+ }
423
+ }
424
+ else {
425
+ const contextIdx = ctx.addExecution('context');
426
+ await ctx.setVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
427
+ await ctx.setVariable({ id: 'context', portName: 'onFailure', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
428
+ await ctx.sendStatusChangedEvent({
429
+ nodeTypeName: 'weaverBuildContext',
430
+ id: 'context',
431
+ executionIndex: contextIdx,
432
+ status: 'CANCELLED',
433
+ });
434
+ const agentIdx = ctx.addExecution('agent');
435
+ await ctx.setVariable({ id: 'agent', portName: 'onSuccess', executionIndex: agentIdx, nodeTypeName: 'weaverAgentExecute' }, false);
436
+ await ctx.setVariable({ id: 'agent', portName: 'onFailure', executionIndex: agentIdx, nodeTypeName: 'weaverAgentExecute' }, false);
437
+ await ctx.sendStatusChangedEvent({
438
+ nodeTypeName: 'weaverAgentExecute',
439
+ id: 'agent',
440
+ executionIndex: agentIdx,
441
+ status: 'CANCELLED',
442
+ });
443
+ const gitOpsIdx = ctx.addExecution('gitOps');
444
+ await ctx.setVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
445
+ await ctx.setVariable({ id: 'gitOps', portName: 'onFailure', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
446
+ await ctx.sendStatusChangedEvent({
447
+ nodeTypeName: 'weaverGitOps',
448
+ id: 'gitOps',
449
+ executionIndex: gitOpsIdx,
450
+ status: 'CANCELLED',
451
+ });
452
+ const notifyIdx = ctx.addExecution('notify');
453
+ await ctx.setVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
454
+ await ctx.setVariable({ id: 'notify', portName: 'onFailure', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
455
+ await ctx.sendStatusChangedEvent({
456
+ nodeTypeName: 'weaverSendNotify',
457
+ id: 'notify',
458
+ executionIndex: notifyIdx,
459
+ status: 'CANCELLED',
460
+ });
461
+ }
462
+ if (cfg_success && detect_success && receive_success && context_success) {
463
+ let agent_success = false;
464
+ if (await __ctrl__.beforeNode('agent', ctx)) {
465
+ // ── agent (weaverAgentExecute) ──
466
+ ctx.checkAborted('agent');
467
+ agentIdx = ctx.addExecution('agent');
468
+ if (typeof globalThis !== 'undefined')
469
+ globalThis.__fw_current_node_id__ = 'agent';
470
+ await ctx.sendStatusChangedEvent({
471
+ nodeTypeName: 'weaverAgentExecute',
472
+ id: 'agent',
473
+ executionIndex: agentIdx,
474
+ status: 'RUNNING',
475
+ });
476
+ agent_success = false;
477
+ try {
478
+ const agent_execute = contextIdx !== undefined ? await ctx.getVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx }) : false;
479
+ await ctx.setVariable({ id: 'agent', portName: 'execute', executionIndex: agentIdx, nodeTypeName: 'weaverAgentExecute' }, agent_execute);
480
+ const agent_ctx = await ctx.getVariable({ id: 'context', portName: 'ctx', executionIndex: contextIdx });
481
+ await ctx.setVariable({ id: 'agent', portName: 'ctx', executionIndex: agentIdx, nodeTypeName: 'weaverAgentExecute' }, agent_ctx);
482
+ const agentResult = await weaverAgentExecute(agent_execute, agent_ctx);
483
+ await ctx.setVariable({ id: 'agent', portName: 'ctx', executionIndex: agentIdx, nodeTypeName: 'weaverAgentExecute' }, agentResult.ctx);
484
+ await ctx.setVariable({ id: 'agent', portName: 'onSuccess', executionIndex: agentIdx, nodeTypeName: 'weaverAgentExecute' }, agentResult.onSuccess);
485
+ await ctx.setVariable({ id: 'agent', portName: 'onFailure', executionIndex: agentIdx, nodeTypeName: 'weaverAgentExecute' }, agentResult.onFailure);
486
+ await ctx.sendStatusChangedEvent({
487
+ nodeTypeName: 'weaverAgentExecute',
488
+ id: 'agent',
489
+ executionIndex: agentIdx,
490
+ status: 'SUCCEEDED',
491
+ });
492
+ await __ctrl__.afterNode('agent', ctx);
493
+ agent_success = agentResult.onSuccess;
494
+ }
495
+ catch (error) {
496
+ const isCancellation = CancellationError.isCancellationError(error);
497
+ await ctx.sendStatusChangedEvent({
498
+ nodeTypeName: 'weaverAgentExecute',
499
+ id: 'agent',
500
+ executionIndex: agentIdx,
501
+ status: isCancellation ? 'CANCELLED' : 'FAILED',
502
+ });
503
+ if (!isCancellation) {
504
+ ctx.sendLogErrorEvent({
505
+ nodeTypeName: 'weaverAgentExecute',
506
+ id: 'agent',
507
+ executionIndex: agentIdx,
508
+ error: error instanceof Error ? error.message : String(error),
509
+ });
510
+ await ctx.setVariable({ id: 'agent', portName: 'onSuccess', executionIndex: agentIdx, nodeTypeName: 'weaverAgentExecute' }, false);
511
+ await ctx.setVariable({ id: 'agent', portName: 'onFailure', executionIndex: agentIdx, nodeTypeName: 'weaverAgentExecute' }, true);
512
+ agent_success = false;
513
+ }
514
+ const gitOpsIdx = ctx.addExecution('gitOps');
515
+ await ctx.setVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
516
+ await ctx.setVariable({ id: 'gitOps', portName: 'onFailure', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
517
+ await ctx.sendStatusChangedEvent({
518
+ nodeTypeName: 'weaverGitOps',
519
+ id: 'gitOps',
520
+ executionIndex: gitOpsIdx,
521
+ status: 'CANCELLED',
522
+ });
523
+ const notifyIdx = ctx.addExecution('notify');
524
+ await ctx.setVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
525
+ await ctx.setVariable({ id: 'notify', portName: 'onFailure', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
526
+ await ctx.sendStatusChangedEvent({
527
+ nodeTypeName: 'weaverSendNotify',
528
+ id: 'notify',
529
+ executionIndex: notifyIdx,
530
+ status: 'CANCELLED',
531
+ });
532
+ throw error;
533
+ }
534
+ }
535
+ else {
536
+ agentIdx = ctx.addExecution('agent');
537
+ agent_success = true;
538
+ }
539
+ if (agent_success) {
540
+ if (await __ctrl__.beforeNode('gitOps', ctx)) {
541
+ // ── gitOps (weaverGitOps) ──
542
+ ctx.checkAborted('gitOps');
543
+ gitOpsIdx = ctx.addExecution('gitOps');
544
+ if (typeof globalThis !== 'undefined')
545
+ globalThis.__fw_current_node_id__ = 'gitOps';
546
+ await ctx.sendStatusChangedEvent({
547
+ nodeTypeName: 'weaverGitOps',
548
+ id: 'gitOps',
549
+ executionIndex: gitOpsIdx,
550
+ status: 'RUNNING',
551
+ });
552
+ try {
553
+ await ctx.setVariable({ id: 'gitOps', portName: 'execute', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, true);
554
+ const gitOps_ctx = await ctx.getVariable({ id: 'agent', portName: 'ctx', executionIndex: agentIdx });
555
+ await ctx.setVariable({ id: 'gitOps', portName: 'ctx', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, gitOps_ctx);
556
+ const gitOpsResult = weaverGitOps(gitOps_ctx);
557
+ const gitOpsResult_raw = gitOpsResult;
558
+ 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);
559
+ await ctx.setVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, true);
560
+ await ctx.setVariable({ id: 'gitOps', portName: 'onFailure', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
561
+ await ctx.sendStatusChangedEvent({
562
+ nodeTypeName: 'weaverGitOps',
563
+ id: 'gitOps',
564
+ executionIndex: gitOpsIdx,
565
+ status: 'SUCCEEDED',
566
+ });
567
+ await __ctrl__.afterNode('gitOps', ctx);
568
+ }
569
+ catch (error) {
570
+ const isCancellation = CancellationError.isCancellationError(error);
571
+ await ctx.sendStatusChangedEvent({
572
+ nodeTypeName: 'weaverGitOps',
573
+ id: 'gitOps',
574
+ executionIndex: gitOpsIdx,
575
+ status: isCancellation ? 'CANCELLED' : 'FAILED',
576
+ });
577
+ if (!isCancellation) {
578
+ ctx.sendLogErrorEvent({
579
+ nodeTypeName: 'weaverGitOps',
580
+ id: 'gitOps',
581
+ executionIndex: gitOpsIdx,
582
+ error: error instanceof Error ? error.message : String(error),
583
+ });
584
+ await ctx.setVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
585
+ await ctx.setVariable({ id: 'gitOps', portName: 'onFailure', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, true);
586
+ }
587
+ throw error;
588
+ }
589
+ }
590
+ else {
591
+ gitOpsIdx = ctx.addExecution('gitOps');
592
+ }
593
+ if (await __ctrl__.beforeNode('notify', ctx)) {
594
+ // ── notify (weaverSendNotify) ──
595
+ ctx.checkAborted('notify');
596
+ notifyIdx = ctx.addExecution('notify');
597
+ if (typeof globalThis !== 'undefined')
598
+ globalThis.__fw_current_node_id__ = 'notify';
599
+ await ctx.sendStatusChangedEvent({
600
+ nodeTypeName: 'weaverSendNotify',
601
+ id: 'notify',
602
+ executionIndex: notifyIdx,
603
+ status: 'RUNNING',
604
+ });
605
+ try {
606
+ await ctx.setVariable({ id: 'notify', portName: 'execute', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, true);
607
+ const notify_ctx = await ctx.getVariable({ id: 'agent', portName: 'ctx', executionIndex: agentIdx });
608
+ await ctx.setVariable({ id: 'notify', portName: 'ctx', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, notify_ctx);
609
+ const notifyResult = weaverSendNotify(notify_ctx);
610
+ const notifyResult_raw = notifyResult;
611
+ 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);
612
+ await ctx.setVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, true);
613
+ await ctx.setVariable({ id: 'notify', portName: 'onFailure', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
614
+ await ctx.sendStatusChangedEvent({
615
+ nodeTypeName: 'weaverSendNotify',
616
+ id: 'notify',
617
+ executionIndex: notifyIdx,
618
+ status: 'SUCCEEDED',
619
+ });
620
+ await __ctrl__.afterNode('notify', ctx);
621
+ }
622
+ catch (error) {
623
+ const isCancellation = CancellationError.isCancellationError(error);
624
+ await ctx.sendStatusChangedEvent({
625
+ nodeTypeName: 'weaverSendNotify',
626
+ id: 'notify',
627
+ executionIndex: notifyIdx,
628
+ status: isCancellation ? 'CANCELLED' : 'FAILED',
629
+ });
630
+ if (!isCancellation) {
631
+ ctx.sendLogErrorEvent({
632
+ nodeTypeName: 'weaverSendNotify',
633
+ id: 'notify',
634
+ executionIndex: notifyIdx,
635
+ error: error instanceof Error ? error.message : String(error),
636
+ });
637
+ await ctx.setVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
638
+ await ctx.setVariable({ id: 'notify', portName: 'onFailure', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, true);
639
+ }
640
+ throw error;
641
+ }
642
+ }
643
+ else {
644
+ notifyIdx = ctx.addExecution('notify');
645
+ }
646
+ }
647
+ else {
648
+ const gitOpsIdx = ctx.addExecution('gitOps');
649
+ await ctx.setVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
650
+ await ctx.setVariable({ id: 'gitOps', portName: 'onFailure', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
651
+ await ctx.sendStatusChangedEvent({
652
+ nodeTypeName: 'weaverGitOps',
653
+ id: 'gitOps',
654
+ executionIndex: gitOpsIdx,
655
+ status: 'CANCELLED',
656
+ });
657
+ const notifyIdx = ctx.addExecution('notify');
658
+ await ctx.setVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
659
+ await ctx.setVariable({ id: 'notify', portName: 'onFailure', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
660
+ await ctx.sendStatusChangedEvent({
661
+ nodeTypeName: 'weaverSendNotify',
662
+ id: 'notify',
663
+ executionIndex: notifyIdx,
664
+ status: 'CANCELLED',
665
+ });
666
+ }
667
+ }
668
+ else {
669
+ const agentIdx = ctx.addExecution('agent');
670
+ await ctx.setVariable({ id: 'agent', portName: 'onSuccess', executionIndex: agentIdx, nodeTypeName: 'weaverAgentExecute' }, false);
671
+ await ctx.setVariable({ id: 'agent', portName: 'onFailure', executionIndex: agentIdx, nodeTypeName: 'weaverAgentExecute' }, false);
672
+ await ctx.sendStatusChangedEvent({
673
+ nodeTypeName: 'weaverAgentExecute',
674
+ id: 'agent',
675
+ executionIndex: agentIdx,
676
+ status: 'CANCELLED',
677
+ });
678
+ const gitOpsIdx = ctx.addExecution('gitOps');
679
+ await ctx.setVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
680
+ await ctx.setVariable({ id: 'gitOps', portName: 'onFailure', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
681
+ await ctx.sendStatusChangedEvent({
682
+ nodeTypeName: 'weaverGitOps',
683
+ id: 'gitOps',
684
+ executionIndex: gitOpsIdx,
685
+ status: 'CANCELLED',
686
+ });
687
+ const notifyIdx = ctx.addExecution('notify');
688
+ await ctx.setVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
689
+ await ctx.setVariable({ id: 'notify', portName: 'onFailure', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
690
+ await ctx.sendStatusChangedEvent({
691
+ nodeTypeName: 'weaverSendNotify',
692
+ id: 'notify',
693
+ executionIndex: notifyIdx,
694
+ status: 'CANCELLED',
695
+ });
696
+ }
697
+ if (await __ctrl__.beforeNode('report', ctx)) {
698
+ // ── report (weaverBotReport) ──
699
+ ctx.checkAborted('report');
700
+ reportIdx = ctx.addExecution('report');
701
+ if (typeof globalThis !== 'undefined')
702
+ globalThis.__fw_current_node_id__ = 'report';
703
+ await ctx.sendStatusChangedEvent({
704
+ nodeTypeName: 'weaverBotReport',
705
+ id: 'report',
706
+ executionIndex: reportIdx,
707
+ status: 'RUNNING',
708
+ });
709
+ try {
710
+ const report_execute = (notifyIdx !== undefined ? await ctx.getVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx }) : false) || (gitOpsIdx !== undefined ? await ctx.getVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx }) : false);
711
+ await ctx.setVariable({ id: 'report', portName: 'execute', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_execute);
712
+ const report_mainCtx = gitOpsIdx !== undefined ? await ctx.getVariable({ id: 'gitOps', portName: 'ctx', executionIndex: gitOpsIdx }) : undefined;
713
+ await ctx.setVariable({ id: 'report', portName: 'mainCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_mainCtx);
714
+ const report_readCtx = undefined;
715
+ await ctx.setVariable({ id: 'report', portName: 'readCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_readCtx);
716
+ const report_abortCtx = undefined;
717
+ await ctx.setVariable({ id: 'report', portName: 'abortCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_abortCtx);
718
+ const reportResult = await weaverBotReport(report_execute, report_mainCtx, report_readCtx, report_abortCtx);
719
+ await ctx.setVariable({ id: 'report', portName: 'summary', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.summary);
720
+ await ctx.setVariable({ id: 'report', portName: 'reportJson', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.reportJson);
721
+ await ctx.setVariable({ id: 'report', portName: 'onFailure', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.onFailure);
722
+ await ctx.setVariable({ id: 'report', portName: 'onSuccess', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.onSuccess);
723
+ await ctx.sendStatusChangedEvent({
724
+ nodeTypeName: 'weaverBotReport',
725
+ id: 'report',
726
+ executionIndex: reportIdx,
727
+ status: 'SUCCEEDED',
728
+ });
729
+ await __ctrl__.afterNode('report', ctx);
730
+ }
731
+ catch (error) {
732
+ const isCancellation = CancellationError.isCancellationError(error);
733
+ await ctx.sendStatusChangedEvent({
734
+ nodeTypeName: 'weaverBotReport',
735
+ id: 'report',
736
+ executionIndex: reportIdx,
737
+ status: isCancellation ? 'CANCELLED' : 'FAILED',
738
+ });
739
+ if (!isCancellation) {
740
+ ctx.sendLogErrorEvent({
741
+ nodeTypeName: 'weaverBotReport',
742
+ id: 'report',
743
+ executionIndex: reportIdx,
744
+ error: error instanceof Error ? error.message : String(error),
745
+ });
746
+ await ctx.setVariable({ id: 'report', portName: 'onSuccess', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, false);
747
+ await ctx.setVariable({ id: 'report', portName: 'onFailure', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, true);
748
+ }
749
+ throw error;
750
+ }
751
+ }
752
+ else {
753
+ reportIdx = ctx.addExecution('report');
754
+ }
755
+ const exitIdx = ctx.addExecution('Exit');
756
+ const exit_summary = reportIdx !== undefined ? await ctx.getVariable({ id: 'report', portName: 'summary', executionIndex: reportIdx }) : undefined;
757
+ await ctx.setVariable({ id: 'Exit', portName: 'summary', executionIndex: exitIdx, nodeTypeName: 'Exit' }, exit_summary);
758
+ const exit_onSuccess = reportIdx !== undefined ? await ctx.getVariable({ id: 'report', portName: 'onSuccess', executionIndex: reportIdx }) : false;
759
+ await ctx.setVariable({ id: 'Exit', portName: 'onSuccess', executionIndex: exitIdx, nodeTypeName: 'Exit' }, exit_onSuccess);
760
+ await ctx.setVariable({ id: 'Exit', portName: 'onFailure', executionIndex: exitIdx, nodeTypeName: 'Exit' }, false);
761
+ const finalResult = { onFailure: false, summary: exit_summary, onSuccess: exit_onSuccess };
762
+ await ctx.sendStatusChangedEvent({
763
+ nodeTypeName: 'Exit',
764
+ id: 'Exit',
765
+ executionIndex: exitIdx,
766
+ status: 'SUCCEEDED',
767
+ });
768
+ ctx.sendWorkflowCompletedEvent({
769
+ executionIndex: exitIdx,
770
+ status: 'SUCCEEDED',
771
+ result: finalResult,
772
+ });
773
+ return finalResult;
774
+ // @flow-weaver-body-end
775
+ return { onSuccess: false, onFailure: true, summary: null };
776
+ }
777
+ //# sourceMappingURL=weaver-agent.js.map