@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
|
@@ -2668,7 +2668,7 @@ var OP_VALIDATE = "validate";
|
|
|
2668
2668
|
var OP_TSC_CHECK = "tsc_check";
|
|
2669
2669
|
var OP_RUN_TESTS = "run_tests";
|
|
2670
2670
|
var OP_TASK_CREATE = "task_create";
|
|
2671
|
-
var
|
|
2671
|
+
var OP_LEARN = "learn";
|
|
2672
2672
|
var OP_RECALL = "recall";
|
|
2673
2673
|
|
|
2674
2674
|
// src/bot/capability-registry.ts
|
|
@@ -2939,9 +2939,9 @@ Omit assignedProfile for auto-routing.`
|
|
|
2939
2939
|
var CAP_MEMORY = {
|
|
2940
2940
|
name: "memory",
|
|
2941
2941
|
description: "Project memory persistence.",
|
|
2942
|
-
tools: [
|
|
2942
|
+
tools: [OP_LEARN, OP_RECALL],
|
|
2943
2943
|
prompt: `## Project Memory
|
|
2944
|
-
-
|
|
2944
|
+
- learn(key, value): Persists a key-value pair to .weaver/project-memory.json.
|
|
2945
2945
|
- recall(): Returns all saved key-value pairs from project memory.`
|
|
2946
2946
|
};
|
|
2947
2947
|
var BUILT_IN_CAPABILITIES = [
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @flowWeaver workflow
|
|
3
3
|
* @node cfg weaverLoadConfig [color: "teal"] [icon: "settings"] [position: 200 200]
|
|
4
|
-
* @node detect weaverDetectProvider [color: "cyan"] [icon: "search"] [
|
|
4
|
+
* @node detect weaverDetectProvider [color: "cyan"] [icon: "search"] [suppress: "OBJECT_TYPE_MISMATCH", "ANNOTATION_SIGNATURE_TYPE_MISMATCH"] [position: 400 200]
|
|
5
5
|
* @node receive weaverReceiveTask [color: "blue"] [icon: "send"] [position: 600 200]
|
|
6
6
|
* @node context weaverBuildContext [color: "teal"] [icon: "code"] [position: 800 200]
|
|
7
7
|
* @node agent weaverAgentExecute [color: "purple"] [icon: "psychology"] [position: 1000 200]
|
|
8
8
|
* @node gitOps weaverGitOps [color: "green"] [icon: "code"] [position: 1200 100]
|
|
9
|
-
* @node notify weaverSendNotify [color: "yellow"] [icon: "send"] [
|
|
10
|
-
* @node report weaverBotReport [color: "green"] [icon: "description"] [
|
|
9
|
+
* @node notify weaverSendNotify [color: "yellow"] [icon: "send"] [suppress: "UNUSED_OUTPUT_PORT"] [position: 1200 300]
|
|
10
|
+
* @node report weaverBotReport [color: "green"] [icon: "description"] [suppress: "UNUSED_OUTPUT_PORT", "DESIGN_ASYNC_NO_ERROR_PATH"] [position: 1400 200]
|
|
11
11
|
* @path Start -> cfg -> detect -> receive -> context -> agent -> gitOps -> report -> Exit
|
|
12
12
|
* @path agent -> notify
|
|
13
13
|
* @path receive:fail -> report
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"weaver-agent.d.ts","sourceRoot":"","sources":["../../src/workflows/weaver-agent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"weaver-agent.d.ts","sourceRoot":"","sources":["../../src/workflows/weaver-agent.ts"],"names":[],"mappings":"AA+ZA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,EAClD,eAAe,CAAC,EAAE,WAAW,GAC5B,OAAO,CAAC;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CA4vB7E"}
|
|
@@ -9,22 +9,254 @@ import { weaverAgentExecute } from '../node-types/agent-execute.js';
|
|
|
9
9
|
import { weaverGitOps } from '../node-types/git-ops.js';
|
|
10
10
|
import { weaverSendNotify } from '../node-types/send-notify.js';
|
|
11
11
|
import { weaverBotReport } from '../node-types/bot-report.js';
|
|
12
|
-
// @flow-weaver-runtime-start
|
|
13
12
|
// ============================================================================
|
|
14
|
-
//
|
|
13
|
+
// Cancellation Error
|
|
15
14
|
// ============================================================================
|
|
16
|
-
|
|
15
|
+
class CancellationError extends Error {
|
|
16
|
+
executionIndex;
|
|
17
|
+
nodeId;
|
|
18
|
+
timestamp;
|
|
19
|
+
constructor(message = 'Workflow execution cancelled', executionIndex = 0, nodeId, timestamp = Date.now()) {
|
|
20
|
+
super(message);
|
|
21
|
+
this.name = 'CancellationError';
|
|
22
|
+
this.executionIndex = executionIndex;
|
|
23
|
+
this.nodeId = nodeId;
|
|
24
|
+
this.timestamp = timestamp;
|
|
25
|
+
}
|
|
26
|
+
static isCancellationError(error) {
|
|
27
|
+
return (error instanceof CancellationError ||
|
|
28
|
+
(error instanceof Error && error.name === 'CancellationError'));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// ============================================================================
|
|
32
|
+
// Execution Context
|
|
33
|
+
// ============================================================================
|
|
34
|
+
class GeneratedExecutionContext {
|
|
35
|
+
variables = new Map();
|
|
36
|
+
executions = new Map();
|
|
37
|
+
executionCounter = 0;
|
|
38
|
+
nodeExecutionCounts = new Map();
|
|
39
|
+
isAsync;
|
|
40
|
+
flowWeaverDebugger;
|
|
41
|
+
pullExecutors = new Map();
|
|
42
|
+
nodeExecutionIndices = new Map();
|
|
43
|
+
abortSignal;
|
|
44
|
+
constructor(isAsync = true, flowWeaverDebugger, abortSignal) {
|
|
45
|
+
this.isAsync = isAsync;
|
|
46
|
+
this.flowWeaverDebugger = flowWeaverDebugger;
|
|
47
|
+
this.abortSignal = abortSignal;
|
|
48
|
+
}
|
|
49
|
+
registerPullExecutor(id, executor) {
|
|
50
|
+
this.pullExecutors.set(id, executor);
|
|
51
|
+
}
|
|
52
|
+
addExecution(id, parentIndex, scopeName) {
|
|
53
|
+
// Use per-node execution counter (each node starts at 0)
|
|
54
|
+
const currentCount = this.nodeExecutionCounts.get(id) || 0;
|
|
55
|
+
const index = currentCount;
|
|
56
|
+
this.nodeExecutionCounts.set(id, currentCount + 1);
|
|
57
|
+
this.executionCounter++;
|
|
58
|
+
this.executions.set(this.getExecutionKey(id, index), {
|
|
59
|
+
id,
|
|
60
|
+
index,
|
|
61
|
+
parentIndex,
|
|
62
|
+
scopeName,
|
|
63
|
+
});
|
|
64
|
+
this.nodeExecutionIndices.set(id, index);
|
|
65
|
+
return index;
|
|
66
|
+
}
|
|
67
|
+
setVariable(address, value) {
|
|
68
|
+
const key = this.getVariableKey(address);
|
|
69
|
+
this.variables.set(key, value);
|
|
70
|
+
if (this.flowWeaverDebugger) {
|
|
71
|
+
const actualValue = typeof value === "function" ? value() : value;
|
|
72
|
+
this.sendVariableSetEvent({
|
|
73
|
+
identifier: {
|
|
74
|
+
nodeTypeName: address.nodeTypeName || "unknown",
|
|
75
|
+
id: address.id,
|
|
76
|
+
portName: address.portName,
|
|
77
|
+
executionIndex: address.executionIndex,
|
|
78
|
+
key: "default",
|
|
79
|
+
...(address.scope && { scope: address.scope }),
|
|
80
|
+
...(address.side && { side: address.side }),
|
|
81
|
+
},
|
|
82
|
+
value: actualValue,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return this.isAsync ? Promise.resolve() : undefined;
|
|
86
|
+
}
|
|
87
|
+
getVariable(address) {
|
|
88
|
+
const executor = this.pullExecutors.get(address.id);
|
|
89
|
+
if (executor) {
|
|
90
|
+
if (!this.hasVariable(address)) {
|
|
91
|
+
const result = executor();
|
|
92
|
+
// Handle async executor (returns Promise)
|
|
93
|
+
if (result instanceof Promise) {
|
|
94
|
+
return result.then(() => {
|
|
95
|
+
const trackedIndex = this.nodeExecutionIndices.get(address.id);
|
|
96
|
+
const finalAddress = trackedIndex !== undefined
|
|
97
|
+
? { ...address, executionIndex: trackedIndex }
|
|
98
|
+
: address;
|
|
99
|
+
return this.retrieveVariable(finalAddress);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
// Handle sync executor (returns void)
|
|
103
|
+
const trackedIndex = this.nodeExecutionIndices.get(address.id);
|
|
104
|
+
const finalAddress = trackedIndex !== undefined
|
|
105
|
+
? { ...address, executionIndex: trackedIndex }
|
|
106
|
+
: address;
|
|
107
|
+
return this.retrieveVariable(finalAddress);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return this.retrieveVariable(address);
|
|
111
|
+
}
|
|
112
|
+
retrieveVariable(address) {
|
|
113
|
+
const key = this.getVariableKey(address);
|
|
114
|
+
if (!this.variables.has(key)) {
|
|
115
|
+
throw new Error(`Variable not found: ${address.id}.${address.portName}[${address.executionIndex}]`);
|
|
116
|
+
}
|
|
117
|
+
const value = this.variables.get(key);
|
|
118
|
+
if (typeof value === "function") {
|
|
119
|
+
const result = value();
|
|
120
|
+
if (result instanceof Promise) {
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
return this.isAsync ? Promise.resolve(result) : result;
|
|
124
|
+
}
|
|
125
|
+
return this.isAsync ? Promise.resolve(value) : value;
|
|
126
|
+
}
|
|
127
|
+
hasVariable(address) {
|
|
128
|
+
const key = this.getVariableKey(address);
|
|
129
|
+
return this.variables.has(key);
|
|
130
|
+
}
|
|
131
|
+
getExecution(id, index) {
|
|
132
|
+
return this.executions.get(this.getExecutionKey(id, index));
|
|
133
|
+
}
|
|
134
|
+
createScope(_parentNodeName, _parentIndex, _scopeName, cleanScope = false, isAsyncOverride) {
|
|
135
|
+
const effectiveIsAsync = isAsyncOverride !== undefined ? isAsyncOverride : this.isAsync;
|
|
136
|
+
const scopedContext = new GeneratedExecutionContext(effectiveIsAsync, this.flowWeaverDebugger, this.abortSignal);
|
|
137
|
+
// For per-port function scopes (cleanScope=true), start with empty variables
|
|
138
|
+
// For node-level scopes (cleanScope=false), inherit parent variables
|
|
139
|
+
scopedContext.variables = cleanScope ? new Map() : new Map(this.variables);
|
|
140
|
+
scopedContext.executions = new Map(this.executions);
|
|
141
|
+
scopedContext.executionCounter = this.executionCounter;
|
|
142
|
+
scopedContext.nodeExecutionCounts = new Map(this.nodeExecutionCounts);
|
|
143
|
+
return scopedContext;
|
|
144
|
+
}
|
|
145
|
+
mergeScope(scopedContext) {
|
|
146
|
+
scopedContext.executions.forEach((info, key) => {
|
|
147
|
+
this.executions.set(key, info);
|
|
148
|
+
});
|
|
149
|
+
scopedContext.variables.forEach((value, key) => {
|
|
150
|
+
this.variables.set(key, value);
|
|
151
|
+
});
|
|
152
|
+
this.executionCounter = Math.max(this.executionCounter, scopedContext.executionCounter);
|
|
153
|
+
scopedContext.nodeExecutionCounts.forEach((count, id) => {
|
|
154
|
+
const currentCount = this.nodeExecutionCounts.get(id) || 0;
|
|
155
|
+
this.nodeExecutionCounts.set(id, Math.max(currentCount, count));
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
getVariableKey(address) {
|
|
159
|
+
return `${address.id}:${address.portName}:${address.executionIndex}`;
|
|
160
|
+
}
|
|
161
|
+
getExecutionKey(id, index) {
|
|
162
|
+
return `${id}:${index}`;
|
|
163
|
+
}
|
|
164
|
+
getExecutionCount() {
|
|
165
|
+
return this.executionCounter;
|
|
166
|
+
}
|
|
167
|
+
reset() {
|
|
168
|
+
this.variables.clear();
|
|
169
|
+
this.executions.clear();
|
|
170
|
+
this.executionCounter = 0;
|
|
171
|
+
this.nodeExecutionCounts.clear();
|
|
172
|
+
}
|
|
173
|
+
isAborted() {
|
|
174
|
+
return this.abortSignal?.aborted ?? false;
|
|
175
|
+
}
|
|
176
|
+
checkAborted(nodeId) {
|
|
177
|
+
if (this.abortSignal?.aborted) {
|
|
178
|
+
throw new CancellationError(`Workflow execution cancelled${nodeId ? ` at ${nodeId}` : ''}`, this.executionCounter, nodeId);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
async sendStatusChangedEvent(args) {
|
|
182
|
+
if (this.flowWeaverDebugger) {
|
|
183
|
+
await this.flowWeaverDebugger.sendEvent({
|
|
184
|
+
type: "STATUS_CHANGED",
|
|
185
|
+
...args,
|
|
186
|
+
innerFlowInvocation: this.flowWeaverDebugger.innerFlowInvocation,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
async sendVariableSetEvent(args) {
|
|
191
|
+
if (this.flowWeaverDebugger) {
|
|
192
|
+
await this.flowWeaverDebugger.sendEvent({
|
|
193
|
+
type: "VARIABLE_SET",
|
|
194
|
+
...args,
|
|
195
|
+
innerFlowInvocation: this.flowWeaverDebugger.innerFlowInvocation,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
async sendLogErrorEvent(args) {
|
|
200
|
+
if (this.flowWeaverDebugger) {
|
|
201
|
+
await this.flowWeaverDebugger.sendEvent({
|
|
202
|
+
type: "LOG_ERROR",
|
|
203
|
+
...args,
|
|
204
|
+
innerFlowInvocation: this.flowWeaverDebugger.innerFlowInvocation,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
async sendWorkflowCompletedEvent(args) {
|
|
209
|
+
if (this.flowWeaverDebugger) {
|
|
210
|
+
await this.flowWeaverDebugger.sendEvent({
|
|
211
|
+
type: "WORKFLOW_COMPLETED",
|
|
212
|
+
...args,
|
|
213
|
+
innerFlowInvocation: this.flowWeaverDebugger.innerFlowInvocation,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
serialize() {
|
|
218
|
+
const vars = {};
|
|
219
|
+
for (const [key, value] of this.variables) {
|
|
220
|
+
if (typeof value === "function") {
|
|
221
|
+
try {
|
|
222
|
+
vars[key] = value();
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
vars[key] = value;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
vars[key] = value;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
const execs = {};
|
|
233
|
+
for (const [key, info] of this.executions) {
|
|
234
|
+
execs[key] = { ...info };
|
|
235
|
+
}
|
|
236
|
+
const nodeCounts = {};
|
|
237
|
+
for (const [key, count] of this.nodeExecutionIndices) {
|
|
238
|
+
nodeCounts[key] = count;
|
|
239
|
+
}
|
|
240
|
+
return { variables: vars, executions: execs, executionCounter: this.executionCounter, nodeExecutionCounts: nodeCounts };
|
|
241
|
+
}
|
|
242
|
+
restore(data) {
|
|
243
|
+
this.variables = new Map(Object.entries(data.variables));
|
|
244
|
+
this.executions = new Map(Object.entries(data.executions));
|
|
245
|
+
this.executionCounter = data.executionCounter;
|
|
246
|
+
this.nodeExecutionIndices = new Map(Object.entries(data.nodeExecutionCounts));
|
|
247
|
+
}
|
|
248
|
+
}
|
|
17
249
|
// @flow-weaver-runtime-end
|
|
18
250
|
/**
|
|
19
251
|
* @flowWeaver workflow
|
|
20
252
|
* @node cfg weaverLoadConfig [color: "teal"] [icon: "settings"] [position: 200 200]
|
|
21
|
-
* @node detect weaverDetectProvider [color: "cyan"] [icon: "search"] [
|
|
253
|
+
* @node detect weaverDetectProvider [color: "cyan"] [icon: "search"] [suppress: "OBJECT_TYPE_MISMATCH", "ANNOTATION_SIGNATURE_TYPE_MISMATCH"] [position: 400 200]
|
|
22
254
|
* @node receive weaverReceiveTask [color: "blue"] [icon: "send"] [position: 600 200]
|
|
23
255
|
* @node context weaverBuildContext [color: "teal"] [icon: "code"] [position: 800 200]
|
|
24
256
|
* @node agent weaverAgentExecute [color: "purple"] [icon: "psychology"] [position: 1000 200]
|
|
25
257
|
* @node gitOps weaverGitOps [color: "green"] [icon: "code"] [position: 1200 100]
|
|
26
|
-
* @node notify weaverSendNotify [color: "yellow"] [icon: "send"] [
|
|
27
|
-
* @node report weaverBotReport [color: "green"] [icon: "description"] [
|
|
258
|
+
* @node notify weaverSendNotify [color: "yellow"] [icon: "send"] [suppress: "UNUSED_OUTPUT_PORT"] [position: 1200 300]
|
|
259
|
+
* @node report weaverBotReport [color: "green"] [icon: "description"] [suppress: "UNUSED_OUTPUT_PORT", "DESIGN_ASYNC_NO_ERROR_PATH"] [position: 1400 200]
|
|
28
260
|
* @path Start -> cfg -> detect -> receive -> context -> agent -> gitOps -> report -> Exit
|
|
29
261
|
* @path agent -> notify
|
|
30
262
|
* @path receive:fail -> report
|
|
@@ -76,10 +308,13 @@ export async function weaverAgent(execute, params, __abortSignal__) {
|
|
|
76
308
|
let gitOpsIdx;
|
|
77
309
|
let notifyIdx;
|
|
78
310
|
let reportIdx;
|
|
311
|
+
let notify_success = false;
|
|
79
312
|
let cfg_success = false;
|
|
80
313
|
let detect_success = false;
|
|
81
314
|
let receive_success = false;
|
|
82
315
|
let context_success = false;
|
|
316
|
+
let agent_success = false;
|
|
317
|
+
let gitOps_success = false;
|
|
83
318
|
if (await __ctrl__.beforeNode('cfg', ctx)) {
|
|
84
319
|
// ── cfg (weaverLoadConfig) ──
|
|
85
320
|
ctx.checkAborted('cfg');
|
|
@@ -275,7 +510,9 @@ export async function weaverAgent(execute, params, __abortSignal__) {
|
|
|
275
510
|
await ctx.setVariable({ id: 'receive', portName: 'env', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receive_env);
|
|
276
511
|
const receive_taskJson = await ctx.getVariable({ id: 'Start', portName: 'taskJson', executionIndex: startIdx });
|
|
277
512
|
await ctx.setVariable({ id: 'receive', portName: 'taskJson', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receive_taskJson);
|
|
278
|
-
const
|
|
513
|
+
const receive_frozenPromptPrefix = undefined;
|
|
514
|
+
await ctx.setVariable({ id: 'receive', portName: 'frozenPromptPrefix', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receive_frozenPromptPrefix);
|
|
515
|
+
const receiveResult = await weaverReceiveTask(receive_execute, receive_env, receive_taskJson, receive_frozenPromptPrefix);
|
|
279
516
|
await ctx.setVariable({ id: 'receive', portName: 'ctx', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receiveResult.ctx);
|
|
280
517
|
await ctx.setVariable({ id: 'receive', portName: 'onSuccess', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receiveResult.onSuccess);
|
|
281
518
|
await ctx.setVariable({ id: 'receive', portName: 'onFailure', executionIndex: receiveIdx, nodeTypeName: 'weaverReceiveTask' }, receiveResult.onFailure);
|
|
@@ -377,14 +614,14 @@ export async function weaverAgent(execute, params, __abortSignal__) {
|
|
|
377
614
|
});
|
|
378
615
|
context_success = false;
|
|
379
616
|
try {
|
|
380
|
-
await ctx.
|
|
617
|
+
const context_execute = receiveIdx !== undefined ? await ctx.getVariable({ id: 'receive', portName: 'onSuccess', executionIndex: receiveIdx }) : false;
|
|
618
|
+
await ctx.setVariable({ id: 'context', portName: 'execute', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, context_execute);
|
|
381
619
|
const context_ctx = await ctx.getVariable({ id: 'receive', portName: 'ctx', executionIndex: receiveIdx });
|
|
382
620
|
await ctx.setVariable({ id: 'context', portName: 'ctx', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, context_ctx);
|
|
383
|
-
const contextResult = weaverBuildContext(context_ctx);
|
|
384
|
-
|
|
385
|
-
await ctx.setVariable({ id: 'context', portName: '
|
|
386
|
-
await ctx.setVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' },
|
|
387
|
-
await ctx.setVariable({ id: 'context', portName: 'onFailure', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, false);
|
|
621
|
+
const contextResult = await weaverBuildContext(context_execute, context_ctx);
|
|
622
|
+
await ctx.setVariable({ id: 'context', portName: 'ctx', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, contextResult.ctx);
|
|
623
|
+
await ctx.setVariable({ id: 'context', portName: 'onFailure', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, contextResult.onFailure);
|
|
624
|
+
await ctx.setVariable({ id: 'context', portName: 'onSuccess', executionIndex: contextIdx, nodeTypeName: 'weaverBuildContext' }, contextResult.onSuccess);
|
|
388
625
|
await ctx.sendStatusChangedEvent({
|
|
389
626
|
nodeTypeName: 'weaverBuildContext',
|
|
390
627
|
id: 'context',
|
|
@@ -392,7 +629,7 @@ export async function weaverAgent(execute, params, __abortSignal__) {
|
|
|
392
629
|
status: 'SUCCEEDED',
|
|
393
630
|
});
|
|
394
631
|
await __ctrl__.afterNode('context', ctx);
|
|
395
|
-
context_success =
|
|
632
|
+
context_success = contextResult.onSuccess;
|
|
396
633
|
}
|
|
397
634
|
catch (error) {
|
|
398
635
|
const isCancellation = CancellationError.isCancellationError(error);
|
|
@@ -460,7 +697,6 @@ export async function weaverAgent(execute, params, __abortSignal__) {
|
|
|
460
697
|
});
|
|
461
698
|
}
|
|
462
699
|
if (cfg_success && detect_success && receive_success && context_success) {
|
|
463
|
-
let agent_success = false;
|
|
464
700
|
if (await __ctrl__.beforeNode('agent', ctx)) {
|
|
465
701
|
// ── agent (weaverAgentExecute) ──
|
|
466
702
|
ctx.checkAborted('agent');
|
|
@@ -479,7 +715,9 @@ export async function weaverAgent(execute, params, __abortSignal__) {
|
|
|
479
715
|
await ctx.setVariable({ id: 'agent', portName: 'execute', executionIndex: agentIdx, nodeTypeName: 'weaverAgentExecute' }, agent_execute);
|
|
480
716
|
const agent_ctx = await ctx.getVariable({ id: 'context', portName: 'ctx', executionIndex: contextIdx });
|
|
481
717
|
await ctx.setVariable({ id: 'agent', portName: 'ctx', executionIndex: agentIdx, nodeTypeName: 'weaverAgentExecute' }, agent_ctx);
|
|
482
|
-
const
|
|
718
|
+
const agent_modelOverride = undefined;
|
|
719
|
+
await ctx.setVariable({ id: 'agent', portName: 'modelOverride', executionIndex: agentIdx, nodeTypeName: 'weaverAgentExecute' }, agent_modelOverride);
|
|
720
|
+
const agentResult = await weaverAgentExecute(agent_execute, agent_ctx, agent_modelOverride);
|
|
483
721
|
await ctx.setVariable({ id: 'agent', portName: 'ctx', executionIndex: agentIdx, nodeTypeName: 'weaverAgentExecute' }, agentResult.ctx);
|
|
484
722
|
await ctx.setVariable({ id: 'agent', portName: 'onSuccess', executionIndex: agentIdx, nodeTypeName: 'weaverAgentExecute' }, agentResult.onSuccess);
|
|
485
723
|
await ctx.setVariable({ id: 'agent', portName: 'onFailure', executionIndex: agentIdx, nodeTypeName: 'weaverAgentExecute' }, agentResult.onFailure);
|
|
@@ -549,6 +787,7 @@ export async function weaverAgent(execute, params, __abortSignal__) {
|
|
|
549
787
|
executionIndex: gitOpsIdx,
|
|
550
788
|
status: 'RUNNING',
|
|
551
789
|
});
|
|
790
|
+
gitOps_success = false;
|
|
552
791
|
try {
|
|
553
792
|
await ctx.setVariable({ id: 'gitOps', portName: 'execute', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, true);
|
|
554
793
|
const gitOps_ctx = await ctx.getVariable({ id: 'agent', portName: 'ctx', executionIndex: agentIdx });
|
|
@@ -565,6 +804,7 @@ export async function weaverAgent(execute, params, __abortSignal__) {
|
|
|
565
804
|
status: 'SUCCEEDED',
|
|
566
805
|
});
|
|
567
806
|
await __ctrl__.afterNode('gitOps', ctx);
|
|
807
|
+
gitOps_success = true;
|
|
568
808
|
}
|
|
569
809
|
catch (error) {
|
|
570
810
|
const isCancellation = CancellationError.isCancellationError(error);
|
|
@@ -583,12 +823,14 @@ export async function weaverAgent(execute, params, __abortSignal__) {
|
|
|
583
823
|
});
|
|
584
824
|
await ctx.setVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, false);
|
|
585
825
|
await ctx.setVariable({ id: 'gitOps', portName: 'onFailure', executionIndex: gitOpsIdx, nodeTypeName: 'weaverGitOps' }, true);
|
|
826
|
+
gitOps_success = false;
|
|
586
827
|
}
|
|
587
828
|
throw error;
|
|
588
829
|
}
|
|
589
830
|
}
|
|
590
831
|
else {
|
|
591
832
|
gitOpsIdx = ctx.addExecution('gitOps');
|
|
833
|
+
gitOps_success = true;
|
|
592
834
|
}
|
|
593
835
|
if (await __ctrl__.beforeNode('notify', ctx)) {
|
|
594
836
|
// ── notify (weaverSendNotify) ──
|
|
@@ -602,6 +844,7 @@ export async function weaverAgent(execute, params, __abortSignal__) {
|
|
|
602
844
|
executionIndex: notifyIdx,
|
|
603
845
|
status: 'RUNNING',
|
|
604
846
|
});
|
|
847
|
+
notify_success = false;
|
|
605
848
|
try {
|
|
606
849
|
await ctx.setVariable({ id: 'notify', portName: 'execute', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, true);
|
|
607
850
|
const notify_ctx = await ctx.getVariable({ id: 'agent', portName: 'ctx', executionIndex: agentIdx });
|
|
@@ -618,6 +861,7 @@ export async function weaverAgent(execute, params, __abortSignal__) {
|
|
|
618
861
|
status: 'SUCCEEDED',
|
|
619
862
|
});
|
|
620
863
|
await __ctrl__.afterNode('notify', ctx);
|
|
864
|
+
notify_success = true;
|
|
621
865
|
}
|
|
622
866
|
catch (error) {
|
|
623
867
|
const isCancellation = CancellationError.isCancellationError(error);
|
|
@@ -636,12 +880,14 @@ export async function weaverAgent(execute, params, __abortSignal__) {
|
|
|
636
880
|
});
|
|
637
881
|
await ctx.setVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, false);
|
|
638
882
|
await ctx.setVariable({ id: 'notify', portName: 'onFailure', executionIndex: notifyIdx, nodeTypeName: 'weaverSendNotify' }, true);
|
|
883
|
+
notify_success = false;
|
|
639
884
|
}
|
|
640
885
|
throw error;
|
|
641
886
|
}
|
|
642
887
|
}
|
|
643
888
|
else {
|
|
644
889
|
notifyIdx = ctx.addExecution('notify');
|
|
890
|
+
notify_success = true;
|
|
645
891
|
}
|
|
646
892
|
}
|
|
647
893
|
else {
|
|
@@ -707,7 +953,7 @@ export async function weaverAgent(execute, params, __abortSignal__) {
|
|
|
707
953
|
status: 'RUNNING',
|
|
708
954
|
});
|
|
709
955
|
try {
|
|
710
|
-
const report_execute = (notifyIdx !== undefined ? await ctx.getVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx }) : false) || (gitOpsIdx !== undefined ? await ctx.getVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx }) : false);
|
|
956
|
+
const report_execute = (notifyIdx !== undefined ? await ctx.getVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx }) : 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) || (agentIdx !== undefined ? await ctx.getVariable({ id: 'agent', portName: 'onFailure', executionIndex: agentIdx }) : false);
|
|
711
957
|
await ctx.setVariable({ id: 'report', portName: 'execute', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_execute);
|
|
712
958
|
const report_mainCtx = gitOpsIdx !== undefined ? await ctx.getVariable({ id: 'gitOps', portName: 'ctx', executionIndex: gitOpsIdx }) : undefined;
|
|
713
959
|
await ctx.setVariable({ id: 'report', portName: 'mainCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_mainCtx);
|
|
@@ -715,8 +961,11 @@ export async function weaverAgent(execute, params, __abortSignal__) {
|
|
|
715
961
|
await ctx.setVariable({ id: 'report', portName: 'readCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_readCtx);
|
|
716
962
|
const report_abortCtx = undefined;
|
|
717
963
|
await ctx.setVariable({ id: 'report', portName: 'abortCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_abortCtx);
|
|
718
|
-
const
|
|
964
|
+
const report_failCtx = undefined;
|
|
965
|
+
await ctx.setVariable({ id: 'report', portName: 'failCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_failCtx);
|
|
966
|
+
const reportResult = await weaverBotReport(report_execute, report_mainCtx, report_readCtx, report_abortCtx, report_failCtx);
|
|
719
967
|
await ctx.setVariable({ id: 'report', portName: 'summary', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.summary);
|
|
968
|
+
await ctx.setVariable({ id: 'report', portName: 'report', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.report);
|
|
720
969
|
await ctx.setVariable({ id: 'report', portName: 'reportJson', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.reportJson);
|
|
721
970
|
await ctx.setVariable({ id: 'report', portName: 'onFailure', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.onFailure);
|
|
722
971
|
await ctx.setVariable({ id: 'report', portName: 'onSuccess', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.onSuccess);
|