@synergenius/flow-weaver-pack-weaver 0.9.193 → 0.9.196
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 +5 -0
- package/dist/bot/ai-client.d.ts.map +1 -1
- package/dist/bot/ai-client.js +43 -0
- package/dist/bot/ai-client.js.map +1 -1
- package/dist/bot/assistant-core.js +2 -2
- package/dist/bot/assistant-core.js.map +1 -1
- package/dist/bot/behavior-defaults.d.ts +3 -1
- package/dist/bot/behavior-defaults.d.ts.map +1 -1
- package/dist/bot/behavior-defaults.js +7 -0
- package/dist/bot/behavior-defaults.js.map +1 -1
- package/dist/bot/capability-registry.js +3 -3
- package/dist/bot/capability-registry.js.map +1 -1
- package/dist/bot/context-compactor.d.ts +35 -0
- package/dist/bot/context-compactor.d.ts.map +1 -0
- package/dist/bot/context-compactor.js +130 -0
- package/dist/bot/context-compactor.js.map +1 -0
- package/dist/bot/dream-task.d.ts +45 -0
- package/dist/bot/dream-task.d.ts.map +1 -0
- package/dist/bot/dream-task.js +125 -0
- package/dist/bot/dream-task.js.map +1 -0
- package/dist/bot/knowledge-store.d.ts +9 -0
- package/dist/bot/knowledge-store.d.ts.map +1 -1
- package/dist/bot/knowledge-store.js +21 -0
- package/dist/bot/knowledge-store.js.map +1 -1
- package/dist/bot/memory-extraction-worker.d.ts +14 -0
- package/dist/bot/memory-extraction-worker.d.ts.map +1 -0
- package/dist/bot/memory-extraction-worker.js +42 -0
- package/dist/bot/memory-extraction-worker.js.map +1 -0
- package/dist/bot/memory-extractor.d.ts +27 -0
- package/dist/bot/memory-extractor.d.ts.map +1 -0
- package/dist/bot/memory-extractor.js +155 -0
- package/dist/bot/memory-extractor.js.map +1 -0
- package/dist/bot/operations.d.ts +3 -1
- package/dist/bot/operations.d.ts.map +1 -1
- package/dist/bot/operations.js +3 -1
- package/dist/bot/operations.js.map +1 -1
- package/dist/bot/post-turn-hooks.d.ts +57 -0
- package/dist/bot/post-turn-hooks.d.ts.map +1 -0
- package/dist/bot/post-turn-hooks.js +108 -0
- package/dist/bot/post-turn-hooks.js.map +1 -0
- package/dist/bot/profile-types.d.ts +16 -0
- package/dist/bot/profile-types.d.ts.map +1 -1
- package/dist/bot/swarm-controller.d.ts +7 -0
- package/dist/bot/swarm-controller.d.ts.map +1 -1
- package/dist/bot/swarm-controller.js +121 -1
- package/dist/bot/swarm-controller.js.map +1 -1
- package/dist/bot/task-prompt-builder.js +35 -21
- package/dist/bot/task-prompt-builder.js.map +1 -1
- package/dist/bot/task-types.d.ts +13 -0
- package/dist/bot/task-types.d.ts.map +1 -1
- package/dist/bot/tool-registry.d.ts +13 -0
- package/dist/bot/tool-registry.d.ts.map +1 -1
- package/dist/bot/tool-registry.js +80 -0
- package/dist/bot/tool-registry.js.map +1 -1
- package/dist/bot/types.d.ts +2 -0
- package/dist/bot/types.d.ts.map +1 -1
- package/dist/node-types/agent-execute.d.ts.map +1 -1
- package/dist/node-types/agent-execute.js +38 -17
- package/dist/node-types/agent-execute.js.map +1 -1
- package/dist/node-types/build-context.d.ts +4 -3
- package/dist/node-types/build-context.d.ts.map +1 -1
- package/dist/node-types/build-context.js +37 -6
- package/dist/node-types/build-context.js.map +1 -1
- package/dist/node-types/receive-task.d.ts +2 -1
- package/dist/node-types/receive-task.d.ts.map +1 -1
- package/dist/node-types/receive-task.js +4 -1
- package/dist/node-types/receive-task.js.map +1 -1
- package/dist/node-types/review-result.d.ts +9 -0
- package/dist/node-types/review-result.d.ts.map +1 -1
- package/dist/node-types/review-result.js +20 -5
- package/dist/node-types/review-result.js.map +1 -1
- package/dist/node-types/verify-task.d.ts +22 -0
- package/dist/node-types/verify-task.d.ts.map +1 -0
- package/dist/node-types/verify-task.js +143 -0
- package/dist/node-types/verify-task.js.map +1 -0
- package/dist/ui/capability-editor.js +3 -3
- package/dist/ui/profile-editor.js +3 -3
- package/dist/ui/swarm-dashboard.js +3 -3
- package/dist/workflows/weaver-agent.d.ts +3 -3
- package/dist/workflows/weaver-agent.d.ts.map +1 -1
- package/dist/workflows/weaver-agent.js +267 -18
- package/dist/workflows/weaver-agent.js.map +1 -1
- package/dist/workflows/weaver-bot-batch.d.ts +3 -3
- package/dist/workflows/weaver-bot-batch.d.ts.map +1 -1
- package/dist/workflows/weaver-bot-batch.js +280 -24
- package/dist/workflows/weaver-bot-batch.js.map +1 -1
- package/dist/workflows/weaver-bot.d.ts +2 -0
- package/dist/workflows/weaver-bot.d.ts.map +1 -1
- package/dist/workflows/weaver-bot.js +15 -10
- package/dist/workflows/weaver-bot.js.map +1 -1
- package/flowweaver.manifest.json +1 -1
- package/package.json +3 -3
- package/src/bot/ai-client.ts +54 -0
- package/src/bot/assistant-core.ts +2 -2
- package/src/bot/behavior-defaults.ts +9 -1
- package/src/bot/capability-registry.ts +3 -3
- package/src/bot/context-compactor.ts +147 -0
- package/src/bot/dream-task.ts +167 -0
- package/src/bot/knowledge-store.ts +27 -0
- package/src/bot/memory-extraction-worker.ts +58 -0
- package/src/bot/memory-extractor.ts +213 -0
- package/src/bot/operations.ts +3 -1
- package/src/bot/post-turn-hooks.ts +137 -0
- package/src/bot/profile-types.ts +17 -0
- package/src/bot/swarm-controller.ts +129 -2
- package/src/bot/task-prompt-builder.ts +37 -21
- package/src/bot/task-types.ts +21 -0
- package/src/bot/tool-registry.ts +89 -0
- package/src/bot/types.ts +2 -0
- package/src/node-types/agent-execute.ts +44 -17
- package/src/node-types/build-context.ts +45 -7
- package/src/node-types/receive-task.ts +3 -0
- package/src/node-types/review-result.ts +22 -5
- package/src/node-types/verify-task.ts +181 -0
- package/src/workflows/weaver-agent.ts +429 -18
- package/src/workflows/weaver-bot-batch.ts +443 -24
- package/src/workflows/weaver-bot.ts +16 -11
|
@@ -18,15 +18,407 @@ import { weaverBotReport } from '../node-types/bot-report.js';
|
|
|
18
18
|
// DO NOT EDIT - This section is auto-generated by Flow Weaver
|
|
19
19
|
// ============================================================================
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
// ============================================================================
|
|
22
|
+
// Runtime Types
|
|
23
|
+
// ============================================================================
|
|
24
|
+
|
|
25
|
+
type TStatusType =
|
|
26
|
+
| "RUNNING"
|
|
27
|
+
| "SCHEDULED"
|
|
28
|
+
| "SUCCEEDED"
|
|
29
|
+
| "FAILED"
|
|
30
|
+
| "CANCELLED"
|
|
31
|
+
| "PENDING";
|
|
32
|
+
|
|
33
|
+
type TVariableIdentification = {
|
|
34
|
+
nodeTypeName: string;
|
|
35
|
+
id: string;
|
|
36
|
+
scope?: string | undefined;
|
|
37
|
+
side?: "start" | "exit" | undefined;
|
|
38
|
+
portName: string;
|
|
39
|
+
executionIndex: number;
|
|
40
|
+
key?: string | undefined;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
type TStatusChangedEvent = {
|
|
44
|
+
type: "STATUS_CHANGED";
|
|
45
|
+
nodeTypeName: string;
|
|
46
|
+
id: string;
|
|
47
|
+
scope?: string;
|
|
48
|
+
side?: "start" | "exit";
|
|
49
|
+
executionIndex: number;
|
|
50
|
+
status: TStatusType;
|
|
51
|
+
innerFlowInvocation?: boolean;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
type TVariableSetEvent = {
|
|
55
|
+
type: "VARIABLE_SET";
|
|
56
|
+
identifier: TVariableIdentification;
|
|
57
|
+
value?: unknown;
|
|
58
|
+
innerFlowInvocation?: boolean;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
type TErrorLogEvent = {
|
|
62
|
+
type: "LOG_ERROR";
|
|
63
|
+
nodeTypeName: string;
|
|
64
|
+
id: string;
|
|
65
|
+
scope?: string;
|
|
66
|
+
side?: "start" | "exit";
|
|
67
|
+
executionIndex: number;
|
|
68
|
+
error: string;
|
|
69
|
+
innerFlowInvocation?: boolean;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
type TWorkflowCompletedEvent = {
|
|
73
|
+
type: "WORKFLOW_COMPLETED";
|
|
74
|
+
executionIndex: number;
|
|
75
|
+
status: "SUCCEEDED" | "FAILED" | "CANCELLED";
|
|
76
|
+
result?: unknown;
|
|
77
|
+
innerFlowInvocation?: boolean;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
type TEvent =
|
|
81
|
+
| TStatusChangedEvent
|
|
82
|
+
| TVariableSetEvent
|
|
83
|
+
| TErrorLogEvent
|
|
84
|
+
| TWorkflowCompletedEvent;
|
|
85
|
+
|
|
86
|
+
type TDebugger = {
|
|
87
|
+
sendEvent: (event: TEvent) => void | Promise<void>;
|
|
88
|
+
innerFlowInvocation: boolean;
|
|
89
|
+
sessionId?: string;
|
|
90
|
+
};
|
|
91
|
+
|
|
23
92
|
declare const __flowWeaverDebugger__: TDebugger | undefined;
|
|
93
|
+
|
|
94
|
+
type TDebugController = {
|
|
95
|
+
beforeNode(nodeId: string, ctx: GeneratedExecutionContext): Promise<boolean> | boolean;
|
|
96
|
+
afterNode(nodeId: string, ctx: GeneratedExecutionContext): Promise<void> | void;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
declare const __abortSignal__: AbortSignal | undefined;
|
|
100
|
+
|
|
101
|
+
interface VariableAddress {
|
|
102
|
+
id: string;
|
|
103
|
+
portName: string;
|
|
104
|
+
executionIndex: number;
|
|
105
|
+
nodeTypeName?: string | undefined;
|
|
106
|
+
scope?: string | undefined;
|
|
107
|
+
side?: 'start' | 'exit' | undefined;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
interface ExecutionInfo {
|
|
111
|
+
id: string;
|
|
112
|
+
index: number;
|
|
113
|
+
parentIndex?: number | undefined;
|
|
114
|
+
scopeName?: string | undefined;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
type VariableValue = unknown | (() => unknown) | (() => Promise<unknown>);
|
|
118
|
+
|
|
119
|
+
// ============================================================================
|
|
120
|
+
// Cancellation Error
|
|
121
|
+
// ============================================================================
|
|
122
|
+
|
|
123
|
+
class CancellationError extends Error {
|
|
124
|
+
public readonly executionIndex: number;
|
|
125
|
+
public readonly nodeId?: string;
|
|
126
|
+
public readonly timestamp: number;
|
|
127
|
+
|
|
128
|
+
constructor(
|
|
129
|
+
message: string = 'Workflow execution cancelled',
|
|
130
|
+
executionIndex: number = 0,
|
|
131
|
+
nodeId?: string,
|
|
132
|
+
timestamp: number = Date.now()
|
|
133
|
+
) {
|
|
134
|
+
super(message);
|
|
135
|
+
this.name = 'CancellationError';
|
|
136
|
+
this.executionIndex = executionIndex;
|
|
137
|
+
this.nodeId = nodeId;
|
|
138
|
+
this.timestamp = timestamp;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
static isCancellationError(error: unknown): error is CancellationError {
|
|
142
|
+
return (
|
|
143
|
+
error instanceof CancellationError ||
|
|
144
|
+
(error instanceof Error && error.name === 'CancellationError')
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// ============================================================================
|
|
150
|
+
// Execution Context
|
|
151
|
+
// ============================================================================
|
|
152
|
+
|
|
153
|
+
class GeneratedExecutionContext {
|
|
154
|
+
private variables: Map<string, VariableValue> = new Map();
|
|
155
|
+
private executions: Map<string, ExecutionInfo> = new Map();
|
|
156
|
+
private executionCounter: number = 0;
|
|
157
|
+
private nodeExecutionCounts: Map<string, number> = new Map();
|
|
158
|
+
private isAsync: boolean;
|
|
159
|
+
private flowWeaverDebugger?: TDebugger | undefined;
|
|
160
|
+
private pullExecutors: Map<string, () => void | Promise<void>> = new Map();
|
|
161
|
+
private nodeExecutionIndices: Map<string, number> = new Map();
|
|
162
|
+
private abortSignal?: AbortSignal | undefined;
|
|
163
|
+
|
|
164
|
+
constructor(isAsync: boolean = true, flowWeaverDebugger?: TDebugger, abortSignal?: AbortSignal) {
|
|
165
|
+
this.isAsync = isAsync;
|
|
166
|
+
this.flowWeaverDebugger = flowWeaverDebugger;
|
|
167
|
+
this.abortSignal = abortSignal;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
registerPullExecutor(id: string, executor: () => void | Promise<void>): void {
|
|
171
|
+
this.pullExecutors.set(id, executor);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
addExecution(id: string, parentIndex?: number, scopeName?: string): number {
|
|
175
|
+
// Use per-node execution counter (each node starts at 0)
|
|
176
|
+
const currentCount = this.nodeExecutionCounts.get(id) || 0;
|
|
177
|
+
const index = currentCount;
|
|
178
|
+
this.nodeExecutionCounts.set(id, currentCount + 1);
|
|
179
|
+
this.executionCounter++;
|
|
180
|
+
this.executions.set(this.getExecutionKey(id, index), {
|
|
181
|
+
id,
|
|
182
|
+
index,
|
|
183
|
+
parentIndex,
|
|
184
|
+
scopeName,
|
|
185
|
+
});
|
|
186
|
+
this.nodeExecutionIndices.set(id, index);
|
|
187
|
+
return index;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
setVariable(address: VariableAddress, value: VariableValue): void | Promise<void> {
|
|
191
|
+
const key = this.getVariableKey(address);
|
|
192
|
+
this.variables.set(key, value);
|
|
193
|
+
if (this.flowWeaverDebugger) {
|
|
194
|
+
const actualValue = typeof value === "function" ? value() : value;
|
|
195
|
+
this.sendVariableSetEvent({
|
|
196
|
+
identifier: {
|
|
197
|
+
nodeTypeName: address.nodeTypeName || "unknown",
|
|
198
|
+
id: address.id,
|
|
199
|
+
portName: address.portName,
|
|
200
|
+
executionIndex: address.executionIndex,
|
|
201
|
+
key: "default",
|
|
202
|
+
...(address.scope && { scope: address.scope }),
|
|
203
|
+
...(address.side && { side: address.side }),
|
|
204
|
+
},
|
|
205
|
+
value: actualValue,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
return this.isAsync ? Promise.resolve() : undefined;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
getVariable(address: VariableAddress): unknown | Promise<unknown> {
|
|
212
|
+
const executor = this.pullExecutors.get(address.id);
|
|
213
|
+
if (executor) {
|
|
214
|
+
if (!this.hasVariable(address)) {
|
|
215
|
+
const result = executor();
|
|
216
|
+
// Handle async executor (returns Promise)
|
|
217
|
+
if (result instanceof Promise) {
|
|
218
|
+
return result.then(() => {
|
|
219
|
+
const trackedIndex = this.nodeExecutionIndices.get(address.id);
|
|
220
|
+
const finalAddress = trackedIndex !== undefined
|
|
221
|
+
? { ...address, executionIndex: trackedIndex }
|
|
222
|
+
: address;
|
|
223
|
+
return this.retrieveVariable(finalAddress);
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
// Handle sync executor (returns void)
|
|
227
|
+
const trackedIndex = this.nodeExecutionIndices.get(address.id);
|
|
228
|
+
const finalAddress = trackedIndex !== undefined
|
|
229
|
+
? { ...address, executionIndex: trackedIndex }
|
|
230
|
+
: address;
|
|
231
|
+
return this.retrieveVariable(finalAddress);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return this.retrieveVariable(address);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
private retrieveVariable(address: VariableAddress): unknown | Promise<unknown> {
|
|
238
|
+
const key = this.getVariableKey(address);
|
|
239
|
+
if (!this.variables.has(key)) {
|
|
240
|
+
throw new Error(`Variable not found: ${address.id}.${address.portName}[${address.executionIndex}]`);
|
|
241
|
+
}
|
|
242
|
+
const value = this.variables.get(key);
|
|
243
|
+
if (typeof value === "function") {
|
|
244
|
+
const result = value();
|
|
245
|
+
if (result instanceof Promise) {
|
|
246
|
+
return result;
|
|
247
|
+
}
|
|
248
|
+
return this.isAsync ? Promise.resolve(result) : result;
|
|
249
|
+
}
|
|
250
|
+
return this.isAsync ? Promise.resolve(value) : value;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
hasVariable(address: VariableAddress): boolean {
|
|
254
|
+
const key = this.getVariableKey(address);
|
|
255
|
+
return this.variables.has(key);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
getExecution(id: string, index: number): ExecutionInfo | undefined {
|
|
259
|
+
return this.executions.get(this.getExecutionKey(id, index));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
createScope(_parentNodeName: string, _parentIndex: number, _scopeName: string, cleanScope: boolean = false, isAsyncOverride?: boolean): GeneratedExecutionContext {
|
|
263
|
+
const effectiveIsAsync = isAsyncOverride !== undefined ? isAsyncOverride : this.isAsync;
|
|
264
|
+
const scopedContext = new GeneratedExecutionContext(effectiveIsAsync, this.flowWeaverDebugger, this.abortSignal);
|
|
265
|
+
// For per-port function scopes (cleanScope=true), start with empty variables
|
|
266
|
+
// For node-level scopes (cleanScope=false), inherit parent variables
|
|
267
|
+
scopedContext.variables = cleanScope ? new Map() : new Map(this.variables);
|
|
268
|
+
scopedContext.executions = new Map(this.executions);
|
|
269
|
+
scopedContext.executionCounter = this.executionCounter;
|
|
270
|
+
scopedContext.nodeExecutionCounts = new Map(this.nodeExecutionCounts);
|
|
271
|
+
return scopedContext;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
mergeScope(scopedContext: GeneratedExecutionContext): void {
|
|
275
|
+
scopedContext.executions.forEach((info, key) => {
|
|
276
|
+
this.executions.set(key, info);
|
|
277
|
+
});
|
|
278
|
+
scopedContext.variables.forEach((value, key) => {
|
|
279
|
+
this.variables.set(key, value);
|
|
280
|
+
});
|
|
281
|
+
this.executionCounter = Math.max(this.executionCounter, scopedContext.executionCounter);
|
|
282
|
+
scopedContext.nodeExecutionCounts.forEach((count, id) => {
|
|
283
|
+
const currentCount = this.nodeExecutionCounts.get(id) || 0;
|
|
284
|
+
this.nodeExecutionCounts.set(id, Math.max(currentCount, count));
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
private getVariableKey(address: VariableAddress): string {
|
|
289
|
+
return `${address.id}:${address.portName}:${address.executionIndex}`;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
private getExecutionKey(id: string, index: number): string {
|
|
293
|
+
return `${id}:${index}`;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
getExecutionCount(): number {
|
|
297
|
+
return this.executionCounter;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
reset(): void {
|
|
301
|
+
this.variables.clear();
|
|
302
|
+
this.executions.clear();
|
|
303
|
+
this.executionCounter = 0;
|
|
304
|
+
this.nodeExecutionCounts.clear();
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
isAborted(): boolean {
|
|
308
|
+
return this.abortSignal?.aborted ?? false;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
checkAborted(nodeId?: string): void {
|
|
312
|
+
if (this.abortSignal?.aborted) {
|
|
313
|
+
throw new CancellationError(
|
|
314
|
+
`Workflow execution cancelled${nodeId ? ` at ${nodeId}` : ''}`,
|
|
315
|
+
this.executionCounter,
|
|
316
|
+
nodeId
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
async sendStatusChangedEvent(args: {
|
|
322
|
+
nodeTypeName: string;
|
|
323
|
+
id: string;
|
|
324
|
+
scope?: string;
|
|
325
|
+
side?: "start" | "exit";
|
|
326
|
+
executionIndex: number;
|
|
327
|
+
status: TStatusType;
|
|
328
|
+
}): Promise<void> {
|
|
329
|
+
if (this.flowWeaverDebugger) {
|
|
330
|
+
await this.flowWeaverDebugger.sendEvent({
|
|
331
|
+
type: "STATUS_CHANGED",
|
|
332
|
+
...args,
|
|
333
|
+
innerFlowInvocation: this.flowWeaverDebugger.innerFlowInvocation,
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
private async sendVariableSetEvent(args: {
|
|
339
|
+
identifier: TVariableIdentification;
|
|
340
|
+
value: unknown;
|
|
341
|
+
}): Promise<void> {
|
|
342
|
+
if (this.flowWeaverDebugger) {
|
|
343
|
+
await this.flowWeaverDebugger.sendEvent({
|
|
344
|
+
type: "VARIABLE_SET",
|
|
345
|
+
...args,
|
|
346
|
+
innerFlowInvocation: this.flowWeaverDebugger.innerFlowInvocation,
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
async sendLogErrorEvent(args: {
|
|
352
|
+
nodeTypeName: string;
|
|
353
|
+
id: string;
|
|
354
|
+
scope?: string;
|
|
355
|
+
side?: "start" | "exit";
|
|
356
|
+
executionIndex: number;
|
|
357
|
+
error: string;
|
|
358
|
+
}): Promise<void> {
|
|
359
|
+
if (this.flowWeaverDebugger) {
|
|
360
|
+
await this.flowWeaverDebugger.sendEvent({
|
|
361
|
+
type: "LOG_ERROR",
|
|
362
|
+
...args,
|
|
363
|
+
innerFlowInvocation: this.flowWeaverDebugger.innerFlowInvocation,
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
async sendWorkflowCompletedEvent(args: {
|
|
369
|
+
executionIndex: number;
|
|
370
|
+
status: "SUCCEEDED" | "FAILED" | "CANCELLED";
|
|
371
|
+
result?: unknown;
|
|
372
|
+
}): Promise<void> {
|
|
373
|
+
if (this.flowWeaverDebugger) {
|
|
374
|
+
await this.flowWeaverDebugger.sendEvent({
|
|
375
|
+
type: "WORKFLOW_COMPLETED",
|
|
376
|
+
...args,
|
|
377
|
+
innerFlowInvocation: this.flowWeaverDebugger.innerFlowInvocation,
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
serialize(): {
|
|
383
|
+
variables: Record<string, unknown>;
|
|
384
|
+
executions: Record<string, ExecutionInfo>;
|
|
385
|
+
executionCounter: number;
|
|
386
|
+
nodeExecutionCounts: Record<string, number>;
|
|
387
|
+
} {
|
|
388
|
+
const vars: Record<string, unknown> = {};
|
|
389
|
+
for (const [key, value] of this.variables) {
|
|
390
|
+
if (typeof value === "function") {
|
|
391
|
+
try { vars[key] = (value as () => unknown)(); } catch { vars[key] = value; }
|
|
392
|
+
} else {
|
|
393
|
+
vars[key] = value;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
const execs: Record<string, ExecutionInfo> = {};
|
|
397
|
+
for (const [key, info] of this.executions) { execs[key] = { ...info }; }
|
|
398
|
+
const nodeCounts: Record<string, number> = {};
|
|
399
|
+
for (const [key, count] of this.nodeExecutionIndices) { nodeCounts[key] = count; }
|
|
400
|
+
return { variables: vars, executions: execs, executionCounter: this.executionCounter, nodeExecutionCounts: nodeCounts };
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
restore(data: {
|
|
404
|
+
variables: Record<string, unknown>;
|
|
405
|
+
executions: Record<string, ExecutionInfo>;
|
|
406
|
+
executionCounter: number;
|
|
407
|
+
nodeExecutionCounts: Record<string, number>;
|
|
408
|
+
}): void {
|
|
409
|
+
this.variables = new Map(Object.entries(data.variables));
|
|
410
|
+
this.executions = new Map(Object.entries(data.executions));
|
|
411
|
+
this.executionCounter = data.executionCounter;
|
|
412
|
+
this.nodeExecutionIndices = new Map(Object.entries(data.nodeExecutionCounts));
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
24
416
|
// @flow-weaver-runtime-end
|
|
25
417
|
|
|
26
418
|
/**
|
|
27
419
|
* @flowWeaver workflow
|
|
28
420
|
* @node cfg weaverLoadConfig [color: "teal"] [icon: "settings"] [position: 200 200]
|
|
29
|
-
* @node detect weaverDetectProvider [color: "cyan"] [icon: "search"] [
|
|
421
|
+
* @node detect weaverDetectProvider [color: "cyan"] [icon: "search"] [suppress: "OBJECT_TYPE_MISMATCH", "ANNOTATION_SIGNATURE_TYPE_MISMATCH"] [position: 400 200]
|
|
30
422
|
* @node receive weaverReceiveTask [color: "blue"] [icon: "send"] [position: 600 200]
|
|
31
423
|
* @node context weaverBuildContext [color: "teal"] [icon: "code"] [position: 800 200]
|
|
32
424
|
* @node plan weaverPlanTask [color: "blue"] [icon: "psychology"] [position: 1000 200]
|
|
@@ -34,8 +426,8 @@ declare const __flowWeaverDebugger__: TDebugger | undefined;
|
|
|
34
426
|
* @node abort weaverAbortTask [color: "red"] [icon: "code"] [position: 1400 400]
|
|
35
427
|
* @node execRetry weaverExecValidateRetry [color: "purple"] [icon: "code"] [position: 1400 200]
|
|
36
428
|
* @node gitOps weaverGitOps [color: "green"] [icon: "code"] [position: 1600 100]
|
|
37
|
-
* @node notify weaverSendNotify [color: "yellow"] [icon: "send"] [
|
|
38
|
-
* @node report weaverBotReport [color: "green"] [icon: "description"] [
|
|
429
|
+
* @node notify weaverSendNotify [color: "yellow"] [icon: "send"] [suppress: "UNUSED_OUTPUT_PORT"] [position: 1600 300]
|
|
430
|
+
* @node report weaverBotReport [color: "green"] [icon: "description"] [suppress: "UNUSED_OUTPUT_PORT", "DESIGN_ASYNC_NO_ERROR_PATH"] [position: 1800 200]
|
|
39
431
|
* @path Start -> cfg -> detect -> receive -> context -> plan -> approve -> execRetry -> gitOps -> report -> Exit
|
|
40
432
|
* @path execRetry -> notify
|
|
41
433
|
* @path approve:fail -> abort
|
|
@@ -106,12 +498,17 @@ export async function weaverBotBatch(
|
|
|
106
498
|
let gitOpsIdx: number | undefined;
|
|
107
499
|
let notifyIdx: number | undefined;
|
|
108
500
|
let reportIdx: number | undefined;
|
|
109
|
-
|
|
501
|
+
let notify_success = false;
|
|
502
|
+
let abort_success = false;
|
|
110
503
|
let cfg_success = false;
|
|
111
504
|
let detect_success = false;
|
|
112
505
|
let receive_success = false;
|
|
113
506
|
let context_success = false;
|
|
114
507
|
let plan_success = false;
|
|
508
|
+
let approve_success = false;
|
|
509
|
+
let execRetry_success = false;
|
|
510
|
+
let gitOps_success = false;
|
|
511
|
+
|
|
115
512
|
|
|
116
513
|
if (await __ctrl__.beforeNode('cfg', ctx)) {
|
|
117
514
|
|
|
@@ -314,13 +711,15 @@ export async function weaverBotBatch(
|
|
|
314
711
|
receive_success = false;
|
|
315
712
|
|
|
316
713
|
try {
|
|
317
|
-
const receive_execute = await ctx.getVariable({ id: 'detect', portName: 'onSuccess', executionIndex: detectIdx
|
|
714
|
+
const receive_execute = detectIdx !== undefined ? await ctx.getVariable({ id: 'detect', portName: 'onSuccess', executionIndex: detectIdx }) as boolean : false;
|
|
318
715
|
await ctx.setVariable({ id: 'receive', portName: 'execute', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receive_execute);
|
|
319
716
|
const receive_env = await ctx.getVariable({ id: 'detect', portName: 'env', executionIndex: detectIdx! }) as Parameters<typeof weaverReceiveTask>[1];
|
|
320
717
|
await ctx.setVariable({ id: 'receive', portName: 'env', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receive_env);
|
|
321
718
|
const receive_taskJson = await ctx.getVariable({ id: 'Start', portName: 'taskJson', executionIndex: startIdx }) as string;
|
|
322
719
|
await ctx.setVariable({ id: 'receive', portName: 'taskJson', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receive_taskJson);
|
|
323
|
-
const
|
|
720
|
+
const receive_frozenPromptPrefix = undefined;
|
|
721
|
+
await ctx.setVariable({ id: 'receive', portName: 'frozenPromptPrefix', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receive_frozenPromptPrefix);
|
|
722
|
+
const receiveResult = await weaverReceiveTask(receive_execute, receive_env, receive_taskJson, receive_frozenPromptPrefix);
|
|
324
723
|
await ctx.setVariable({ id: 'receive', portName: 'ctx', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receiveResult.ctx);
|
|
325
724
|
await ctx.setVariable({ id: 'receive', portName: 'onSuccess', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receiveResult.onSuccess);
|
|
326
725
|
await ctx.setVariable({ id: 'receive', portName: 'onFailure', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receiveResult.onFailure);
|
|
@@ -431,14 +830,14 @@ export async function weaverBotBatch(
|
|
|
431
830
|
context_success = false;
|
|
432
831
|
|
|
433
832
|
try {
|
|
434
|
-
await ctx.
|
|
833
|
+
const context_execute = receiveIdx !== undefined ? await ctx.getVariable({ id: 'receive', portName: 'onSuccess', executionIndex: receiveIdx }) as boolean : false;
|
|
834
|
+
await ctx.setVariable({ id: 'context', portName: 'execute', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, context_execute);
|
|
435
835
|
const context_ctx = await ctx.getVariable({ id: 'receive', portName: 'ctx', executionIndex: receiveIdx! }) as string;
|
|
436
836
|
await ctx.setVariable({ id: 'context', portName: 'ctx', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, context_ctx);
|
|
437
|
-
const contextResult = weaverBuildContext(context_ctx);
|
|
438
|
-
|
|
439
|
-
await ctx.setVariable({ id: 'context', portName: '
|
|
440
|
-
await ctx.setVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' },
|
|
441
|
-
await ctx.setVariable({ id: 'context', portName: 'onFailure', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
|
|
837
|
+
const contextResult = await weaverBuildContext(context_execute, context_ctx);
|
|
838
|
+
await ctx.setVariable({ id: 'context', portName: 'ctx', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, contextResult.ctx);
|
|
839
|
+
await ctx.setVariable({ id: 'context', portName: 'onFailure', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, contextResult.onFailure);
|
|
840
|
+
await ctx.setVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, contextResult.onSuccess);
|
|
442
841
|
await ctx.sendStatusChangedEvent({
|
|
443
842
|
nodeTypeName: 'weaverBuildContext',
|
|
444
843
|
id: 'context',
|
|
@@ -446,7 +845,7 @@ export async function weaverBotBatch(
|
|
|
446
845
|
status: 'SUCCEEDED',
|
|
447
846
|
});
|
|
448
847
|
await __ctrl__.afterNode('context', ctx);
|
|
449
|
-
context_success =
|
|
848
|
+
context_success = contextResult.onSuccess;
|
|
450
849
|
} catch (error: unknown) {
|
|
451
850
|
const isCancellation = CancellationError.isCancellationError(error);
|
|
452
851
|
await ctx.sendStatusChangedEvent({
|
|
@@ -537,11 +936,13 @@ export async function weaverBotBatch(
|
|
|
537
936
|
plan_success = false;
|
|
538
937
|
|
|
539
938
|
try {
|
|
540
|
-
const plan_execute = await ctx.getVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx
|
|
939
|
+
const plan_execute = contextIdx !== undefined ? await ctx.getVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx }) as boolean : false;
|
|
541
940
|
await ctx.setVariable({ id: 'plan', portName: 'execute', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, plan_execute);
|
|
542
941
|
const plan_ctx = await ctx.getVariable({ id: 'context', portName: 'ctx', executionIndex: contextIdx! }) as string;
|
|
543
942
|
await ctx.setVariable({ id: 'plan', portName: 'ctx', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, plan_ctx);
|
|
544
|
-
const
|
|
943
|
+
const plan_modelOverride = undefined;
|
|
944
|
+
await ctx.setVariable({ id: 'plan', portName: 'modelOverride', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, plan_modelOverride);
|
|
945
|
+
const planResult = await weaverPlanTask(plan_execute, plan_ctx, plan_modelOverride);
|
|
545
946
|
await ctx.setVariable({ id: 'plan', portName: 'ctx', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, planResult.ctx);
|
|
546
947
|
await ctx.setVariable({ id: 'plan', portName: 'onSuccess', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, planResult.onSuccess);
|
|
547
948
|
await ctx.setVariable({ id: 'plan', portName: 'onFailure', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, planResult.onFailure);
|
|
@@ -618,7 +1019,6 @@ export async function weaverBotBatch(
|
|
|
618
1019
|
});
|
|
619
1020
|
}
|
|
620
1021
|
if (cfg_success && detect_success && receive_success && context_success && plan_success) {
|
|
621
|
-
let approve_success = false;
|
|
622
1022
|
if (await __ctrl__.beforeNode('approve', ctx)) {
|
|
623
1023
|
|
|
624
1024
|
// ── approve (weaverApprovalGate) ──
|
|
@@ -635,7 +1035,7 @@ export async function weaverBotBatch(
|
|
|
635
1035
|
approve_success = false;
|
|
636
1036
|
|
|
637
1037
|
try {
|
|
638
|
-
const approve_execute = await ctx.getVariable({ id: 'plan', portName: 'onSuccess', executionIndex: planIdx
|
|
1038
|
+
const approve_execute = planIdx !== undefined ? await ctx.getVariable({ id: 'plan', portName: 'onSuccess', executionIndex: planIdx }) as boolean : false;
|
|
639
1039
|
await ctx.setVariable({ id: 'approve', portName: 'execute', executionIndex: approveIdx, nodeTypeName: 'weaverApprovalGate' }, approve_execute);
|
|
640
1040
|
const approve_ctx = await ctx.getVariable({ id: 'plan', portName: 'ctx', executionIndex: planIdx! }) as string;
|
|
641
1041
|
await ctx.setVariable({ id: 'approve', portName: 'ctx', executionIndex: approveIdx, nodeTypeName: 'weaverApprovalGate' }, approve_ctx);
|
|
@@ -705,7 +1105,6 @@ export async function weaverBotBatch(
|
|
|
705
1105
|
executionIndex: abortIdx,
|
|
706
1106
|
status: 'CANCELLED',
|
|
707
1107
|
});
|
|
708
|
-
let execRetry_success = false;
|
|
709
1108
|
if (await __ctrl__.beforeNode('execRetry', ctx)) {
|
|
710
1109
|
|
|
711
1110
|
// ── execRetry (weaverExecValidateRetry) ──
|
|
@@ -722,11 +1121,13 @@ export async function weaverBotBatch(
|
|
|
722
1121
|
execRetry_success = false;
|
|
723
1122
|
|
|
724
1123
|
try {
|
|
725
|
-
const execRetry_execute = await ctx.getVariable({ id: 'approve', portName: 'onSuccess', executionIndex: approveIdx
|
|
1124
|
+
const execRetry_execute = approveIdx !== undefined ? await ctx.getVariable({ id: 'approve', portName: 'onSuccess', executionIndex: approveIdx }) as boolean : false;
|
|
726
1125
|
await ctx.setVariable({ id: 'execRetry', portName: 'execute', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, execRetry_execute);
|
|
727
1126
|
const execRetry_ctx = await ctx.getVariable({ id: 'approve', portName: 'ctx', executionIndex: approveIdx! }) as string;
|
|
728
1127
|
await ctx.setVariable({ id: 'execRetry', portName: 'ctx', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, execRetry_ctx);
|
|
729
|
-
const
|
|
1128
|
+
const execRetry_modelOverride = undefined;
|
|
1129
|
+
await ctx.setVariable({ id: 'execRetry', portName: 'modelOverride', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, execRetry_modelOverride);
|
|
1130
|
+
const execRetryResult = await weaverExecValidateRetry(execRetry_execute, execRetry_ctx, execRetry_modelOverride);
|
|
730
1131
|
await ctx.setVariable({ id: 'execRetry', portName: 'ctx', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, execRetryResult.ctx);
|
|
731
1132
|
await ctx.setVariable({ id: 'execRetry', portName: 'onSuccess', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, execRetryResult.onSuccess);
|
|
732
1133
|
await ctx.setVariable({ id: 'execRetry', portName: 'onFailure', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, execRetryResult.onFailure);
|
|
@@ -796,6 +1197,8 @@ export async function weaverBotBatch(
|
|
|
796
1197
|
status: 'RUNNING',
|
|
797
1198
|
});
|
|
798
1199
|
|
|
1200
|
+
gitOps_success = false;
|
|
1201
|
+
|
|
799
1202
|
try {
|
|
800
1203
|
await ctx.setVariable({ id: 'gitOps', portName: 'execute', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, true);
|
|
801
1204
|
const gitOps_ctx = await ctx.getVariable({ id: 'execRetry', portName: 'ctx', executionIndex: execRetryIdx! }) as string;
|
|
@@ -812,6 +1215,7 @@ export async function weaverBotBatch(
|
|
|
812
1215
|
status: 'SUCCEEDED',
|
|
813
1216
|
});
|
|
814
1217
|
await __ctrl__.afterNode('gitOps', ctx);
|
|
1218
|
+
gitOps_success = true;
|
|
815
1219
|
} catch (error: unknown) {
|
|
816
1220
|
const isCancellation = CancellationError.isCancellationError(error);
|
|
817
1221
|
await ctx.sendStatusChangedEvent({
|
|
@@ -829,11 +1233,13 @@ export async function weaverBotBatch(
|
|
|
829
1233
|
});
|
|
830
1234
|
await ctx.setVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
|
|
831
1235
|
await ctx.setVariable({ id: 'gitOps', portName: 'onFailure', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, true);
|
|
1236
|
+
gitOps_success = false;
|
|
832
1237
|
}
|
|
833
1238
|
throw error;
|
|
834
1239
|
}
|
|
835
1240
|
} else {
|
|
836
1241
|
gitOpsIdx = ctx.addExecution('gitOps');
|
|
1242
|
+
gitOps_success = true;
|
|
837
1243
|
}
|
|
838
1244
|
|
|
839
1245
|
if (await __ctrl__.beforeNode('notify', ctx)) {
|
|
@@ -849,6 +1255,8 @@ export async function weaverBotBatch(
|
|
|
849
1255
|
status: 'RUNNING',
|
|
850
1256
|
});
|
|
851
1257
|
|
|
1258
|
+
notify_success = false;
|
|
1259
|
+
|
|
852
1260
|
try {
|
|
853
1261
|
await ctx.setVariable({ id: 'notify', portName: 'execute', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, true);
|
|
854
1262
|
const notify_ctx = await ctx.getVariable({ id: 'execRetry', portName: 'ctx', executionIndex: execRetryIdx! }) as string;
|
|
@@ -865,6 +1273,7 @@ export async function weaverBotBatch(
|
|
|
865
1273
|
status: 'SUCCEEDED',
|
|
866
1274
|
});
|
|
867
1275
|
await __ctrl__.afterNode('notify', ctx);
|
|
1276
|
+
notify_success = true;
|
|
868
1277
|
} catch (error: unknown) {
|
|
869
1278
|
const isCancellation = CancellationError.isCancellationError(error);
|
|
870
1279
|
await ctx.sendStatusChangedEvent({
|
|
@@ -882,11 +1291,13 @@ export async function weaverBotBatch(
|
|
|
882
1291
|
});
|
|
883
1292
|
await ctx.setVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
|
|
884
1293
|
await ctx.setVariable({ id: 'notify', portName: 'onFailure', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, true);
|
|
1294
|
+
notify_success = false;
|
|
885
1295
|
}
|
|
886
1296
|
throw error;
|
|
887
1297
|
}
|
|
888
1298
|
} else {
|
|
889
1299
|
notifyIdx = ctx.addExecution('notify');
|
|
1300
|
+
notify_success = true;
|
|
890
1301
|
}
|
|
891
1302
|
|
|
892
1303
|
} else {
|
|
@@ -932,6 +1343,8 @@ export async function weaverBotBatch(
|
|
|
932
1343
|
status: 'RUNNING',
|
|
933
1344
|
});
|
|
934
1345
|
|
|
1346
|
+
abort_success = false;
|
|
1347
|
+
|
|
935
1348
|
try {
|
|
936
1349
|
await ctx.setVariable({ id: 'abort', portName: 'execute', executionIndex: abortIdx, nodeTypeName: 'weaverAbortTask' }, true);
|
|
937
1350
|
const abort_ctx = await ctx.getVariable({ id: 'approve', portName: 'ctx', executionIndex: approveIdx! }) as string;
|
|
@@ -948,6 +1361,7 @@ export async function weaverBotBatch(
|
|
|
948
1361
|
status: 'SUCCEEDED',
|
|
949
1362
|
});
|
|
950
1363
|
await __ctrl__.afterNode('abort', ctx);
|
|
1364
|
+
abort_success = true;
|
|
951
1365
|
} catch (error: unknown) {
|
|
952
1366
|
const isCancellation = CancellationError.isCancellationError(error);
|
|
953
1367
|
await ctx.sendStatusChangedEvent({
|
|
@@ -965,11 +1379,13 @@ export async function weaverBotBatch(
|
|
|
965
1379
|
});
|
|
966
1380
|
await ctx.setVariable({ id: 'abort', portName: 'onSuccess', executionIndex: abortIdx, nodeTypeName: 'weaverAbortTask' }, false);
|
|
967
1381
|
await ctx.setVariable({ id: 'abort', portName: 'onFailure', executionIndex: abortIdx, nodeTypeName: 'weaverAbortTask' }, true);
|
|
1382
|
+
abort_success = false;
|
|
968
1383
|
}
|
|
969
1384
|
throw error;
|
|
970
1385
|
}
|
|
971
1386
|
} else {
|
|
972
1387
|
abortIdx = ctx.addExecution('abort');
|
|
1388
|
+
abort_success = true;
|
|
973
1389
|
}
|
|
974
1390
|
|
|
975
1391
|
}
|
|
@@ -1016,7 +1432,7 @@ export async function weaverBotBatch(
|
|
|
1016
1432
|
});
|
|
1017
1433
|
|
|
1018
1434
|
try {
|
|
1019
|
-
const report_execute = await ctx.getVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx
|
|
1435
|
+
const report_execute = (notifyIdx !== undefined ? await ctx.getVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx }) as boolean : false) || (abortIdx !== undefined ? await ctx.getVariable({ id: 'abort', portName: 'onSuccess', executionIndex: abortIdx }) as boolean : false) || (gitOpsIdx !== undefined ? await ctx.getVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx }) as boolean : false) || (receiveIdx !== undefined ? await ctx.getVariable({ id: 'receive', portName: 'onFailure', executionIndex: receiveIdx }) as boolean : false) || (planIdx !== undefined ? await ctx.getVariable({ id: 'plan', portName: 'onFailure', executionIndex: planIdx }) as boolean : false) || (execRetryIdx !== undefined ? await ctx.getVariable({ id: 'execRetry', portName: 'onFailure', executionIndex: execRetryIdx }) as boolean : false);
|
|
1020
1436
|
await ctx.setVariable({ id: 'report', portName: 'execute', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_execute);
|
|
1021
1437
|
const report_mainCtx = gitOpsIdx !== undefined ? await ctx.getVariable({ id: 'gitOps', portName: 'ctx', executionIndex: gitOpsIdx }) as string : undefined;
|
|
1022
1438
|
await ctx.setVariable({ id: 'report', portName: 'mainCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_mainCtx);
|
|
@@ -1024,8 +1440,11 @@ export async function weaverBotBatch(
|
|
|
1024
1440
|
await ctx.setVariable({ id: 'report', portName: 'readCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_readCtx);
|
|
1025
1441
|
const report_abortCtx = abortIdx !== undefined ? await ctx.getVariable({ id: 'abort', portName: 'ctx', executionIndex: abortIdx }) as string : undefined;
|
|
1026
1442
|
await ctx.setVariable({ id: 'report', portName: 'abortCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_abortCtx);
|
|
1027
|
-
const
|
|
1443
|
+
const report_failCtx = undefined;
|
|
1444
|
+
await ctx.setVariable({ id: 'report', portName: 'failCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_failCtx);
|
|
1445
|
+
const reportResult = await weaverBotReport(report_execute, report_mainCtx, report_readCtx, report_abortCtx, report_failCtx);
|
|
1028
1446
|
await ctx.setVariable({ id: 'report', portName: 'summary', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.summary);
|
|
1447
|
+
await ctx.setVariable({ id: 'report', portName: 'report', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.report);
|
|
1029
1448
|
await ctx.setVariable({ id: 'report', portName: 'reportJson', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.reportJson);
|
|
1030
1449
|
await ctx.setVariable({ id: 'report', portName: 'onFailure', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.onFailure);
|
|
1031
1450
|
await ctx.setVariable({ id: 'report', portName: 'onSuccess', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.onSuccess);
|