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