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