@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
|
@@ -11,16 +11,248 @@ import { weaverExecValidateRetry } from '../node-types/exec-validate-retry.js';
|
|
|
11
11
|
import { weaverGitOps } from '../node-types/git-ops.js';
|
|
12
12
|
import { weaverSendNotify } from '../node-types/send-notify.js';
|
|
13
13
|
import { weaverBotReport } from '../node-types/bot-report.js';
|
|
14
|
-
// @flow-weaver-runtime-start
|
|
15
14
|
// ============================================================================
|
|
16
|
-
//
|
|
15
|
+
// Cancellation Error
|
|
17
16
|
// ============================================================================
|
|
18
|
-
|
|
17
|
+
class CancellationError extends Error {
|
|
18
|
+
executionIndex;
|
|
19
|
+
nodeId;
|
|
20
|
+
timestamp;
|
|
21
|
+
constructor(message = 'Workflow execution cancelled', executionIndex = 0, nodeId, timestamp = Date.now()) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.name = 'CancellationError';
|
|
24
|
+
this.executionIndex = executionIndex;
|
|
25
|
+
this.nodeId = nodeId;
|
|
26
|
+
this.timestamp = timestamp;
|
|
27
|
+
}
|
|
28
|
+
static isCancellationError(error) {
|
|
29
|
+
return (error instanceof CancellationError ||
|
|
30
|
+
(error instanceof Error && error.name === 'CancellationError'));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// ============================================================================
|
|
34
|
+
// Execution Context
|
|
35
|
+
// ============================================================================
|
|
36
|
+
class GeneratedExecutionContext {
|
|
37
|
+
variables = new Map();
|
|
38
|
+
executions = new Map();
|
|
39
|
+
executionCounter = 0;
|
|
40
|
+
nodeExecutionCounts = new Map();
|
|
41
|
+
isAsync;
|
|
42
|
+
flowWeaverDebugger;
|
|
43
|
+
pullExecutors = new Map();
|
|
44
|
+
nodeExecutionIndices = new Map();
|
|
45
|
+
abortSignal;
|
|
46
|
+
constructor(isAsync = true, flowWeaverDebugger, abortSignal) {
|
|
47
|
+
this.isAsync = isAsync;
|
|
48
|
+
this.flowWeaverDebugger = flowWeaverDebugger;
|
|
49
|
+
this.abortSignal = abortSignal;
|
|
50
|
+
}
|
|
51
|
+
registerPullExecutor(id, executor) {
|
|
52
|
+
this.pullExecutors.set(id, executor);
|
|
53
|
+
}
|
|
54
|
+
addExecution(id, parentIndex, scopeName) {
|
|
55
|
+
// Use per-node execution counter (each node starts at 0)
|
|
56
|
+
const currentCount = this.nodeExecutionCounts.get(id) || 0;
|
|
57
|
+
const index = currentCount;
|
|
58
|
+
this.nodeExecutionCounts.set(id, currentCount + 1);
|
|
59
|
+
this.executionCounter++;
|
|
60
|
+
this.executions.set(this.getExecutionKey(id, index), {
|
|
61
|
+
id,
|
|
62
|
+
index,
|
|
63
|
+
parentIndex,
|
|
64
|
+
scopeName,
|
|
65
|
+
});
|
|
66
|
+
this.nodeExecutionIndices.set(id, index);
|
|
67
|
+
return index;
|
|
68
|
+
}
|
|
69
|
+
setVariable(address, value) {
|
|
70
|
+
const key = this.getVariableKey(address);
|
|
71
|
+
this.variables.set(key, value);
|
|
72
|
+
if (this.flowWeaverDebugger) {
|
|
73
|
+
const actualValue = typeof value === "function" ? value() : value;
|
|
74
|
+
this.sendVariableSetEvent({
|
|
75
|
+
identifier: {
|
|
76
|
+
nodeTypeName: address.nodeTypeName || "unknown",
|
|
77
|
+
id: address.id,
|
|
78
|
+
portName: address.portName,
|
|
79
|
+
executionIndex: address.executionIndex,
|
|
80
|
+
key: "default",
|
|
81
|
+
...(address.scope && { scope: address.scope }),
|
|
82
|
+
...(address.side && { side: address.side }),
|
|
83
|
+
},
|
|
84
|
+
value: actualValue,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return this.isAsync ? Promise.resolve() : undefined;
|
|
88
|
+
}
|
|
89
|
+
getVariable(address) {
|
|
90
|
+
const executor = this.pullExecutors.get(address.id);
|
|
91
|
+
if (executor) {
|
|
92
|
+
if (!this.hasVariable(address)) {
|
|
93
|
+
const result = executor();
|
|
94
|
+
// Handle async executor (returns Promise)
|
|
95
|
+
if (result instanceof Promise) {
|
|
96
|
+
return result.then(() => {
|
|
97
|
+
const trackedIndex = this.nodeExecutionIndices.get(address.id);
|
|
98
|
+
const finalAddress = trackedIndex !== undefined
|
|
99
|
+
? { ...address, executionIndex: trackedIndex }
|
|
100
|
+
: address;
|
|
101
|
+
return this.retrieveVariable(finalAddress);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
// Handle sync executor (returns void)
|
|
105
|
+
const trackedIndex = this.nodeExecutionIndices.get(address.id);
|
|
106
|
+
const finalAddress = trackedIndex !== undefined
|
|
107
|
+
? { ...address, executionIndex: trackedIndex }
|
|
108
|
+
: address;
|
|
109
|
+
return this.retrieveVariable(finalAddress);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return this.retrieveVariable(address);
|
|
113
|
+
}
|
|
114
|
+
retrieveVariable(address) {
|
|
115
|
+
const key = this.getVariableKey(address);
|
|
116
|
+
if (!this.variables.has(key)) {
|
|
117
|
+
throw new Error(`Variable not found: ${address.id}.${address.portName}[${address.executionIndex}]`);
|
|
118
|
+
}
|
|
119
|
+
const value = this.variables.get(key);
|
|
120
|
+
if (typeof value === "function") {
|
|
121
|
+
const result = value();
|
|
122
|
+
if (result instanceof Promise) {
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
125
|
+
return this.isAsync ? Promise.resolve(result) : result;
|
|
126
|
+
}
|
|
127
|
+
return this.isAsync ? Promise.resolve(value) : value;
|
|
128
|
+
}
|
|
129
|
+
hasVariable(address) {
|
|
130
|
+
const key = this.getVariableKey(address);
|
|
131
|
+
return this.variables.has(key);
|
|
132
|
+
}
|
|
133
|
+
getExecution(id, index) {
|
|
134
|
+
return this.executions.get(this.getExecutionKey(id, index));
|
|
135
|
+
}
|
|
136
|
+
createScope(_parentNodeName, _parentIndex, _scopeName, cleanScope = false, isAsyncOverride) {
|
|
137
|
+
const effectiveIsAsync = isAsyncOverride !== undefined ? isAsyncOverride : this.isAsync;
|
|
138
|
+
const scopedContext = new GeneratedExecutionContext(effectiveIsAsync, this.flowWeaverDebugger, this.abortSignal);
|
|
139
|
+
// For per-port function scopes (cleanScope=true), start with empty variables
|
|
140
|
+
// For node-level scopes (cleanScope=false), inherit parent variables
|
|
141
|
+
scopedContext.variables = cleanScope ? new Map() : new Map(this.variables);
|
|
142
|
+
scopedContext.executions = new Map(this.executions);
|
|
143
|
+
scopedContext.executionCounter = this.executionCounter;
|
|
144
|
+
scopedContext.nodeExecutionCounts = new Map(this.nodeExecutionCounts);
|
|
145
|
+
return scopedContext;
|
|
146
|
+
}
|
|
147
|
+
mergeScope(scopedContext) {
|
|
148
|
+
scopedContext.executions.forEach((info, key) => {
|
|
149
|
+
this.executions.set(key, info);
|
|
150
|
+
});
|
|
151
|
+
scopedContext.variables.forEach((value, key) => {
|
|
152
|
+
this.variables.set(key, value);
|
|
153
|
+
});
|
|
154
|
+
this.executionCounter = Math.max(this.executionCounter, scopedContext.executionCounter);
|
|
155
|
+
scopedContext.nodeExecutionCounts.forEach((count, id) => {
|
|
156
|
+
const currentCount = this.nodeExecutionCounts.get(id) || 0;
|
|
157
|
+
this.nodeExecutionCounts.set(id, Math.max(currentCount, count));
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
getVariableKey(address) {
|
|
161
|
+
return `${address.id}:${address.portName}:${address.executionIndex}`;
|
|
162
|
+
}
|
|
163
|
+
getExecutionKey(id, index) {
|
|
164
|
+
return `${id}:${index}`;
|
|
165
|
+
}
|
|
166
|
+
getExecutionCount() {
|
|
167
|
+
return this.executionCounter;
|
|
168
|
+
}
|
|
169
|
+
reset() {
|
|
170
|
+
this.variables.clear();
|
|
171
|
+
this.executions.clear();
|
|
172
|
+
this.executionCounter = 0;
|
|
173
|
+
this.nodeExecutionCounts.clear();
|
|
174
|
+
}
|
|
175
|
+
isAborted() {
|
|
176
|
+
return this.abortSignal?.aborted ?? false;
|
|
177
|
+
}
|
|
178
|
+
checkAborted(nodeId) {
|
|
179
|
+
if (this.abortSignal?.aborted) {
|
|
180
|
+
throw new CancellationError(`Workflow execution cancelled${nodeId ? ` at ${nodeId}` : ''}`, this.executionCounter, nodeId);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
async sendStatusChangedEvent(args) {
|
|
184
|
+
if (this.flowWeaverDebugger) {
|
|
185
|
+
await this.flowWeaverDebugger.sendEvent({
|
|
186
|
+
type: "STATUS_CHANGED",
|
|
187
|
+
...args,
|
|
188
|
+
innerFlowInvocation: this.flowWeaverDebugger.innerFlowInvocation,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
async sendVariableSetEvent(args) {
|
|
193
|
+
if (this.flowWeaverDebugger) {
|
|
194
|
+
await this.flowWeaverDebugger.sendEvent({
|
|
195
|
+
type: "VARIABLE_SET",
|
|
196
|
+
...args,
|
|
197
|
+
innerFlowInvocation: this.flowWeaverDebugger.innerFlowInvocation,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
async sendLogErrorEvent(args) {
|
|
202
|
+
if (this.flowWeaverDebugger) {
|
|
203
|
+
await this.flowWeaverDebugger.sendEvent({
|
|
204
|
+
type: "LOG_ERROR",
|
|
205
|
+
...args,
|
|
206
|
+
innerFlowInvocation: this.flowWeaverDebugger.innerFlowInvocation,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
async sendWorkflowCompletedEvent(args) {
|
|
211
|
+
if (this.flowWeaverDebugger) {
|
|
212
|
+
await this.flowWeaverDebugger.sendEvent({
|
|
213
|
+
type: "WORKFLOW_COMPLETED",
|
|
214
|
+
...args,
|
|
215
|
+
innerFlowInvocation: this.flowWeaverDebugger.innerFlowInvocation,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
serialize() {
|
|
220
|
+
const vars = {};
|
|
221
|
+
for (const [key, value] of this.variables) {
|
|
222
|
+
if (typeof value === "function") {
|
|
223
|
+
try {
|
|
224
|
+
vars[key] = value();
|
|
225
|
+
}
|
|
226
|
+
catch {
|
|
227
|
+
vars[key] = value;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
vars[key] = value;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
const execs = {};
|
|
235
|
+
for (const [key, info] of this.executions) {
|
|
236
|
+
execs[key] = { ...info };
|
|
237
|
+
}
|
|
238
|
+
const nodeCounts = {};
|
|
239
|
+
for (const [key, count] of this.nodeExecutionIndices) {
|
|
240
|
+
nodeCounts[key] = count;
|
|
241
|
+
}
|
|
242
|
+
return { variables: vars, executions: execs, executionCounter: this.executionCounter, nodeExecutionCounts: nodeCounts };
|
|
243
|
+
}
|
|
244
|
+
restore(data) {
|
|
245
|
+
this.variables = new Map(Object.entries(data.variables));
|
|
246
|
+
this.executions = new Map(Object.entries(data.executions));
|
|
247
|
+
this.executionCounter = data.executionCounter;
|
|
248
|
+
this.nodeExecutionIndices = new Map(Object.entries(data.nodeExecutionCounts));
|
|
249
|
+
}
|
|
250
|
+
}
|
|
19
251
|
// @flow-weaver-runtime-end
|
|
20
252
|
/**
|
|
21
253
|
* @flowWeaver workflow
|
|
22
254
|
* @node cfg weaverLoadConfig [color: "teal"] [icon: "settings"] [position: 200 200]
|
|
23
|
-
* @node detect weaverDetectProvider [color: "cyan"] [icon: "search"] [
|
|
255
|
+
* @node detect weaverDetectProvider [color: "cyan"] [icon: "search"] [suppress: "OBJECT_TYPE_MISMATCH", "ANNOTATION_SIGNATURE_TYPE_MISMATCH"] [position: 400 200]
|
|
24
256
|
* @node receive weaverReceiveTask [color: "blue"] [icon: "send"] [position: 600 200]
|
|
25
257
|
* @node context weaverBuildContext [color: "teal"] [icon: "code"] [position: 800 200]
|
|
26
258
|
* @node plan weaverPlanTask [color: "blue"] [icon: "psychology"] [position: 1000 200]
|
|
@@ -28,8 +260,8 @@ import { GeneratedExecutionContext, CancellationError } from '@synergenius/flow-
|
|
|
28
260
|
* @node abort weaverAbortTask [color: "red"] [icon: "code"] [position: 1400 400]
|
|
29
261
|
* @node execRetry weaverExecValidateRetry [color: "purple"] [icon: "code"] [position: 1400 200]
|
|
30
262
|
* @node gitOps weaverGitOps [color: "green"] [icon: "code"] [position: 1600 100]
|
|
31
|
-
* @node notify weaverSendNotify [color: "yellow"] [icon: "send"] [
|
|
32
|
-
* @node report weaverBotReport [color: "green"] [icon: "description"] [
|
|
263
|
+
* @node notify weaverSendNotify [color: "yellow"] [icon: "send"] [suppress: "UNUSED_OUTPUT_PORT"] [position: 1600 300]
|
|
264
|
+
* @node report weaverBotReport [color: "green"] [icon: "description"] [suppress: "UNUSED_OUTPUT_PORT", "DESIGN_ASYNC_NO_ERROR_PATH"] [position: 1800 200]
|
|
33
265
|
* @path Start -> cfg -> detect -> receive -> context -> plan -> approve -> execRetry -> gitOps -> report -> Exit
|
|
34
266
|
* @path execRetry -> notify
|
|
35
267
|
* @path approve:fail -> abort
|
|
@@ -88,11 +320,16 @@ export async function weaverBotBatch(execute, params, __abortSignal__) {
|
|
|
88
320
|
let gitOpsIdx;
|
|
89
321
|
let notifyIdx;
|
|
90
322
|
let reportIdx;
|
|
323
|
+
let notify_success = false;
|
|
324
|
+
let abort_success = false;
|
|
91
325
|
let cfg_success = false;
|
|
92
326
|
let detect_success = false;
|
|
93
327
|
let receive_success = false;
|
|
94
328
|
let context_success = false;
|
|
95
329
|
let plan_success = false;
|
|
330
|
+
let approve_success = false;
|
|
331
|
+
let execRetry_success = false;
|
|
332
|
+
let gitOps_success = false;
|
|
96
333
|
if (await __ctrl__.beforeNode('cfg', ctx)) {
|
|
97
334
|
// ── cfg (weaverLoadConfig) ──
|
|
98
335
|
ctx.checkAborted('cfg');
|
|
@@ -291,13 +528,15 @@ export async function weaverBotBatch(execute, params, __abortSignal__) {
|
|
|
291
528
|
});
|
|
292
529
|
receive_success = false;
|
|
293
530
|
try {
|
|
294
|
-
const receive_execute = await ctx.getVariable({ id: 'detect', portName: 'onSuccess', executionIndex: detectIdx });
|
|
531
|
+
const receive_execute = detectIdx !== undefined ? await ctx.getVariable({ id: 'detect', portName: 'onSuccess', executionIndex: detectIdx }) : false;
|
|
295
532
|
await ctx.setVariable({ id: 'receive', portName: 'execute', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receive_execute);
|
|
296
533
|
const receive_env = await ctx.getVariable({ id: 'detect', portName: 'env', executionIndex: detectIdx });
|
|
297
534
|
await ctx.setVariable({ id: 'receive', portName: 'env', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receive_env);
|
|
298
535
|
const receive_taskJson = await ctx.getVariable({ id: 'Start', portName: 'taskJson', executionIndex: startIdx });
|
|
299
536
|
await ctx.setVariable({ id: 'receive', portName: 'taskJson', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receive_taskJson);
|
|
300
|
-
const
|
|
537
|
+
const receive_frozenPromptPrefix = undefined;
|
|
538
|
+
await ctx.setVariable({ id: 'receive', portName: 'frozenPromptPrefix', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receive_frozenPromptPrefix);
|
|
539
|
+
const receiveResult = await weaverReceiveTask(receive_execute, receive_env, receive_taskJson, receive_frozenPromptPrefix);
|
|
301
540
|
await ctx.setVariable({ id: 'receive', portName: 'ctx', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receiveResult.ctx);
|
|
302
541
|
await ctx.setVariable({ id: 'receive', portName: 'onSuccess', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receiveResult.onSuccess);
|
|
303
542
|
await ctx.setVariable({ id: 'receive', portName: 'onFailure', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receiveResult.onFailure);
|
|
@@ -408,14 +647,14 @@ export async function weaverBotBatch(execute, params, __abortSignal__) {
|
|
|
408
647
|
});
|
|
409
648
|
context_success = false;
|
|
410
649
|
try {
|
|
411
|
-
await ctx.
|
|
650
|
+
const context_execute = receiveIdx !== undefined ? await ctx.getVariable({ id: 'receive', portName: 'onSuccess', executionIndex: receiveIdx }) : false;
|
|
651
|
+
await ctx.setVariable({ id: 'context', portName: 'execute', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, context_execute);
|
|
412
652
|
const context_ctx = await ctx.getVariable({ id: 'receive', portName: 'ctx', executionIndex: receiveIdx });
|
|
413
653
|
await ctx.setVariable({ id: 'context', portName: 'ctx', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, context_ctx);
|
|
414
|
-
const contextResult = weaverBuildContext(context_ctx);
|
|
415
|
-
|
|
416
|
-
await ctx.setVariable({ id: 'context', portName: '
|
|
417
|
-
await ctx.setVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' },
|
|
418
|
-
await ctx.setVariable({ id: 'context', portName: 'onFailure', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
|
|
654
|
+
const contextResult = await weaverBuildContext(context_execute, context_ctx);
|
|
655
|
+
await ctx.setVariable({ id: 'context', portName: 'ctx', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, contextResult.ctx);
|
|
656
|
+
await ctx.setVariable({ id: 'context', portName: 'onFailure', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, contextResult.onFailure);
|
|
657
|
+
await ctx.setVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, contextResult.onSuccess);
|
|
419
658
|
await ctx.sendStatusChangedEvent({
|
|
420
659
|
nodeTypeName: 'weaverBuildContext',
|
|
421
660
|
id: 'context',
|
|
@@ -423,7 +662,7 @@ export async function weaverBotBatch(execute, params, __abortSignal__) {
|
|
|
423
662
|
status: 'SUCCEEDED',
|
|
424
663
|
});
|
|
425
664
|
await __ctrl__.afterNode('context', ctx);
|
|
426
|
-
context_success =
|
|
665
|
+
context_success = contextResult.onSuccess;
|
|
427
666
|
}
|
|
428
667
|
catch (error) {
|
|
429
668
|
const isCancellation = CancellationError.isCancellationError(error);
|
|
@@ -514,11 +753,13 @@ export async function weaverBotBatch(execute, params, __abortSignal__) {
|
|
|
514
753
|
});
|
|
515
754
|
plan_success = false;
|
|
516
755
|
try {
|
|
517
|
-
const plan_execute = await ctx.getVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx });
|
|
756
|
+
const plan_execute = contextIdx !== undefined ? await ctx.getVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx }) : false;
|
|
518
757
|
await ctx.setVariable({ id: 'plan', portName: 'execute', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, plan_execute);
|
|
519
758
|
const plan_ctx = await ctx.getVariable({ id: 'context', portName: 'ctx', executionIndex: contextIdx });
|
|
520
759
|
await ctx.setVariable({ id: 'plan', portName: 'ctx', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, plan_ctx);
|
|
521
|
-
const
|
|
760
|
+
const plan_modelOverride = undefined;
|
|
761
|
+
await ctx.setVariable({ id: 'plan', portName: 'modelOverride', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, plan_modelOverride);
|
|
762
|
+
const planResult = await weaverPlanTask(plan_execute, plan_ctx, plan_modelOverride);
|
|
522
763
|
await ctx.setVariable({ id: 'plan', portName: 'ctx', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, planResult.ctx);
|
|
523
764
|
await ctx.setVariable({ id: 'plan', portName: 'onSuccess', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, planResult.onSuccess);
|
|
524
765
|
await ctx.setVariable({ id: 'plan', portName: 'onFailure', executionIndex: planIdx, nodeTypeName: 'weaverPlanTask' }, planResult.onFailure);
|
|
@@ -597,7 +838,6 @@ export async function weaverBotBatch(execute, params, __abortSignal__) {
|
|
|
597
838
|
});
|
|
598
839
|
}
|
|
599
840
|
if (cfg_success && detect_success && receive_success && context_success && plan_success) {
|
|
600
|
-
let approve_success = false;
|
|
601
841
|
if (await __ctrl__.beforeNode('approve', ctx)) {
|
|
602
842
|
// ── approve (weaverApprovalGate) ──
|
|
603
843
|
ctx.checkAborted('approve');
|
|
@@ -612,7 +852,7 @@ export async function weaverBotBatch(execute, params, __abortSignal__) {
|
|
|
612
852
|
});
|
|
613
853
|
approve_success = false;
|
|
614
854
|
try {
|
|
615
|
-
const approve_execute = await ctx.getVariable({ id: 'plan', portName: 'onSuccess', executionIndex: planIdx });
|
|
855
|
+
const approve_execute = planIdx !== undefined ? await ctx.getVariable({ id: 'plan', portName: 'onSuccess', executionIndex: planIdx }) : false;
|
|
616
856
|
await ctx.setVariable({ id: 'approve', portName: 'execute', executionIndex: approveIdx, nodeTypeName: 'weaverApprovalGate' }, approve_execute);
|
|
617
857
|
const approve_ctx = await ctx.getVariable({ id: 'plan', portName: 'ctx', executionIndex: planIdx });
|
|
618
858
|
await ctx.setVariable({ id: 'approve', portName: 'ctx', executionIndex: approveIdx, nodeTypeName: 'weaverApprovalGate' }, approve_ctx);
|
|
@@ -683,7 +923,6 @@ export async function weaverBotBatch(execute, params, __abortSignal__) {
|
|
|
683
923
|
executionIndex: abortIdx,
|
|
684
924
|
status: 'CANCELLED',
|
|
685
925
|
});
|
|
686
|
-
let execRetry_success = false;
|
|
687
926
|
if (await __ctrl__.beforeNode('execRetry', ctx)) {
|
|
688
927
|
// ── execRetry (weaverExecValidateRetry) ──
|
|
689
928
|
ctx.checkAborted('execRetry');
|
|
@@ -698,11 +937,13 @@ export async function weaverBotBatch(execute, params, __abortSignal__) {
|
|
|
698
937
|
});
|
|
699
938
|
execRetry_success = false;
|
|
700
939
|
try {
|
|
701
|
-
const execRetry_execute = await ctx.getVariable({ id: 'approve', portName: 'onSuccess', executionIndex: approveIdx });
|
|
940
|
+
const execRetry_execute = approveIdx !== undefined ? await ctx.getVariable({ id: 'approve', portName: 'onSuccess', executionIndex: approveIdx }) : false;
|
|
702
941
|
await ctx.setVariable({ id: 'execRetry', portName: 'execute', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, execRetry_execute);
|
|
703
942
|
const execRetry_ctx = await ctx.getVariable({ id: 'approve', portName: 'ctx', executionIndex: approveIdx });
|
|
704
943
|
await ctx.setVariable({ id: 'execRetry', portName: 'ctx', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, execRetry_ctx);
|
|
705
|
-
const
|
|
944
|
+
const execRetry_modelOverride = undefined;
|
|
945
|
+
await ctx.setVariable({ id: 'execRetry', portName: 'modelOverride', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, execRetry_modelOverride);
|
|
946
|
+
const execRetryResult = await weaverExecValidateRetry(execRetry_execute, execRetry_ctx, execRetry_modelOverride);
|
|
706
947
|
await ctx.setVariable({ id: 'execRetry', portName: 'ctx', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, execRetryResult.ctx);
|
|
707
948
|
await ctx.setVariable({ id: 'execRetry', portName: 'onSuccess', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, execRetryResult.onSuccess);
|
|
708
949
|
await ctx.setVariable({ id: 'execRetry', portName: 'onFailure', executionIndex: execRetryIdx, nodeTypeName: 'weaverExecValidateRetry' }, execRetryResult.onFailure);
|
|
@@ -772,6 +1013,7 @@ export async function weaverBotBatch(execute, params, __abortSignal__) {
|
|
|
772
1013
|
executionIndex: gitOpsIdx,
|
|
773
1014
|
status: 'RUNNING',
|
|
774
1015
|
});
|
|
1016
|
+
gitOps_success = false;
|
|
775
1017
|
try {
|
|
776
1018
|
await ctx.setVariable({ id: 'gitOps', portName: 'execute', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, true);
|
|
777
1019
|
const gitOps_ctx = await ctx.getVariable({ id: 'execRetry', portName: 'ctx', executionIndex: execRetryIdx });
|
|
@@ -788,6 +1030,7 @@ export async function weaverBotBatch(execute, params, __abortSignal__) {
|
|
|
788
1030
|
status: 'SUCCEEDED',
|
|
789
1031
|
});
|
|
790
1032
|
await __ctrl__.afterNode('gitOps', ctx);
|
|
1033
|
+
gitOps_success = true;
|
|
791
1034
|
}
|
|
792
1035
|
catch (error) {
|
|
793
1036
|
const isCancellation = CancellationError.isCancellationError(error);
|
|
@@ -806,12 +1049,14 @@ export async function weaverBotBatch(execute, params, __abortSignal__) {
|
|
|
806
1049
|
});
|
|
807
1050
|
await ctx.setVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
|
|
808
1051
|
await ctx.setVariable({ id: 'gitOps', portName: 'onFailure', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, true);
|
|
1052
|
+
gitOps_success = false;
|
|
809
1053
|
}
|
|
810
1054
|
throw error;
|
|
811
1055
|
}
|
|
812
1056
|
}
|
|
813
1057
|
else {
|
|
814
1058
|
gitOpsIdx = ctx.addExecution('gitOps');
|
|
1059
|
+
gitOps_success = true;
|
|
815
1060
|
}
|
|
816
1061
|
if (await __ctrl__.beforeNode('notify', ctx)) {
|
|
817
1062
|
// ── notify (weaverSendNotify) ──
|
|
@@ -825,6 +1070,7 @@ export async function weaverBotBatch(execute, params, __abortSignal__) {
|
|
|
825
1070
|
executionIndex: notifyIdx,
|
|
826
1071
|
status: 'RUNNING',
|
|
827
1072
|
});
|
|
1073
|
+
notify_success = false;
|
|
828
1074
|
try {
|
|
829
1075
|
await ctx.setVariable({ id: 'notify', portName: 'execute', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, true);
|
|
830
1076
|
const notify_ctx = await ctx.getVariable({ id: 'execRetry', portName: 'ctx', executionIndex: execRetryIdx });
|
|
@@ -841,6 +1087,7 @@ export async function weaverBotBatch(execute, params, __abortSignal__) {
|
|
|
841
1087
|
status: 'SUCCEEDED',
|
|
842
1088
|
});
|
|
843
1089
|
await __ctrl__.afterNode('notify', ctx);
|
|
1090
|
+
notify_success = true;
|
|
844
1091
|
}
|
|
845
1092
|
catch (error) {
|
|
846
1093
|
const isCancellation = CancellationError.isCancellationError(error);
|
|
@@ -859,12 +1106,14 @@ export async function weaverBotBatch(execute, params, __abortSignal__) {
|
|
|
859
1106
|
});
|
|
860
1107
|
await ctx.setVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
|
|
861
1108
|
await ctx.setVariable({ id: 'notify', portName: 'onFailure', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, true);
|
|
1109
|
+
notify_success = false;
|
|
862
1110
|
}
|
|
863
1111
|
throw error;
|
|
864
1112
|
}
|
|
865
1113
|
}
|
|
866
1114
|
else {
|
|
867
1115
|
notifyIdx = ctx.addExecution('notify');
|
|
1116
|
+
notify_success = true;
|
|
868
1117
|
}
|
|
869
1118
|
}
|
|
870
1119
|
else {
|
|
@@ -910,6 +1159,7 @@ export async function weaverBotBatch(execute, params, __abortSignal__) {
|
|
|
910
1159
|
executionIndex: abortIdx,
|
|
911
1160
|
status: 'RUNNING',
|
|
912
1161
|
});
|
|
1162
|
+
abort_success = false;
|
|
913
1163
|
try {
|
|
914
1164
|
await ctx.setVariable({ id: 'abort', portName: 'execute', executionIndex: abortIdx, nodeTypeName: 'weaverAbortTask' }, true);
|
|
915
1165
|
const abort_ctx = await ctx.getVariable({ id: 'approve', portName: 'ctx', executionIndex: approveIdx });
|
|
@@ -926,6 +1176,7 @@ export async function weaverBotBatch(execute, params, __abortSignal__) {
|
|
|
926
1176
|
status: 'SUCCEEDED',
|
|
927
1177
|
});
|
|
928
1178
|
await __ctrl__.afterNode('abort', ctx);
|
|
1179
|
+
abort_success = true;
|
|
929
1180
|
}
|
|
930
1181
|
catch (error) {
|
|
931
1182
|
const isCancellation = CancellationError.isCancellationError(error);
|
|
@@ -944,12 +1195,14 @@ export async function weaverBotBatch(execute, params, __abortSignal__) {
|
|
|
944
1195
|
});
|
|
945
1196
|
await ctx.setVariable({ id: 'abort', portName: 'onSuccess', executionIndex: abortIdx, nodeTypeName: 'weaverAbortTask' }, false);
|
|
946
1197
|
await ctx.setVariable({ id: 'abort', portName: 'onFailure', executionIndex: abortIdx, nodeTypeName: 'weaverAbortTask' }, true);
|
|
1198
|
+
abort_success = false;
|
|
947
1199
|
}
|
|
948
1200
|
throw error;
|
|
949
1201
|
}
|
|
950
1202
|
}
|
|
951
1203
|
else {
|
|
952
1204
|
abortIdx = ctx.addExecution('abort');
|
|
1205
|
+
abort_success = true;
|
|
953
1206
|
}
|
|
954
1207
|
}
|
|
955
1208
|
}
|
|
@@ -995,7 +1248,7 @@ export async function weaverBotBatch(execute, params, __abortSignal__) {
|
|
|
995
1248
|
status: 'RUNNING',
|
|
996
1249
|
});
|
|
997
1250
|
try {
|
|
998
|
-
const report_execute = await ctx.getVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx });
|
|
1251
|
+
const report_execute = (notifyIdx !== undefined ? await ctx.getVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx }) : false) || (abortIdx !== undefined ? await ctx.getVariable({ id: 'abort', portName: 'onSuccess', executionIndex: abortIdx }) : false) || (gitOpsIdx !== undefined ? await ctx.getVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx }) : false) || (receiveIdx !== undefined ? await ctx.getVariable({ id: 'receive', portName: 'onFailure', executionIndex: receiveIdx }) : false) || (planIdx !== undefined ? await ctx.getVariable({ id: 'plan', portName: 'onFailure', executionIndex: planIdx }) : false) || (execRetryIdx !== undefined ? await ctx.getVariable({ id: 'execRetry', portName: 'onFailure', executionIndex: execRetryIdx }) : false);
|
|
999
1252
|
await ctx.setVariable({ id: 'report', portName: 'execute', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_execute);
|
|
1000
1253
|
const report_mainCtx = gitOpsIdx !== undefined ? await ctx.getVariable({ id: 'gitOps', portName: 'ctx', executionIndex: gitOpsIdx }) : undefined;
|
|
1001
1254
|
await ctx.setVariable({ id: 'report', portName: 'mainCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_mainCtx);
|
|
@@ -1003,8 +1256,11 @@ export async function weaverBotBatch(execute, params, __abortSignal__) {
|
|
|
1003
1256
|
await ctx.setVariable({ id: 'report', portName: 'readCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_readCtx);
|
|
1004
1257
|
const report_abortCtx = abortIdx !== undefined ? await ctx.getVariable({ id: 'abort', portName: 'ctx', executionIndex: abortIdx }) : undefined;
|
|
1005
1258
|
await ctx.setVariable({ id: 'report', portName: 'abortCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_abortCtx);
|
|
1006
|
-
const
|
|
1259
|
+
const report_failCtx = undefined;
|
|
1260
|
+
await ctx.setVariable({ id: 'report', portName: 'failCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_failCtx);
|
|
1261
|
+
const reportResult = await weaverBotReport(report_execute, report_mainCtx, report_readCtx, report_abortCtx, report_failCtx);
|
|
1007
1262
|
await ctx.setVariable({ id: 'report', portName: 'summary', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.summary);
|
|
1263
|
+
await ctx.setVariable({ id: 'report', portName: 'report', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.report);
|
|
1008
1264
|
await ctx.setVariable({ id: 'report', portName: 'reportJson', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.reportJson);
|
|
1009
1265
|
await ctx.setVariable({ id: 'report', portName: 'onFailure', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.onFailure);
|
|
1010
1266
|
await ctx.setVariable({ id: 'report', portName: 'onSuccess', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.onSuccess);
|