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