@synergenius/flowweaver-pack-weaver 0.3.1 → 0.5.0

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.
Files changed (161) hide show
  1. package/dist/bot/dashboard.d.ts +3 -0
  2. package/dist/bot/dashboard.d.ts.map +1 -1
  3. package/dist/bot/dashboard.js +141 -0
  4. package/dist/bot/dashboard.js.map +1 -1
  5. package/dist/bot/index.d.ts +8 -1
  6. package/dist/bot/index.d.ts.map +1 -1
  7. package/dist/bot/index.js +5 -0
  8. package/dist/bot/index.js.map +1 -1
  9. package/dist/bot/notifications.d.ts.map +1 -1
  10. package/dist/bot/notifications.js +18 -0
  11. package/dist/bot/notifications.js.map +1 -1
  12. package/dist/bot/session-state.d.ts +19 -0
  13. package/dist/bot/session-state.d.ts.map +1 -0
  14. package/dist/bot/session-state.js +56 -0
  15. package/dist/bot/session-state.js.map +1 -0
  16. package/dist/bot/steering.d.ts +13 -0
  17. package/dist/bot/steering.d.ts.map +1 -0
  18. package/dist/bot/steering.js +35 -0
  19. package/dist/bot/steering.js.map +1 -0
  20. package/dist/bot/system-prompt.d.ts +1 -0
  21. package/dist/bot/system-prompt.d.ts.map +1 -1
  22. package/dist/bot/system-prompt.js +55 -0
  23. package/dist/bot/system-prompt.js.map +1 -1
  24. package/dist/bot/task-queue.d.ts +26 -0
  25. package/dist/bot/task-queue.d.ts.map +1 -0
  26. package/dist/bot/task-queue.js +87 -0
  27. package/dist/bot/task-queue.js.map +1 -0
  28. package/dist/bot/types.d.ts +37 -1
  29. package/dist/bot/types.d.ts.map +1 -1
  30. package/dist/cli-bridge.d.ts +2 -0
  31. package/dist/cli-bridge.d.ts.map +1 -0
  32. package/dist/cli-bridge.js +31 -0
  33. package/dist/cli-bridge.js.map +1 -0
  34. package/dist/cli-handlers.d.ts +50 -0
  35. package/dist/cli-handlers.d.ts.map +1 -0
  36. package/dist/{cli.js → cli-handlers.js} +413 -181
  37. package/dist/cli-handlers.js.map +1 -0
  38. package/dist/index.d.ts +3 -0
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +4 -0
  41. package/dist/index.js.map +1 -1
  42. package/dist/mcp-tools.d.ts +13 -0
  43. package/dist/mcp-tools.d.ts.map +1 -0
  44. package/dist/mcp-tools.js +175 -0
  45. package/dist/mcp-tools.js.map +1 -0
  46. package/dist/node-types/abort-task.d.ts +22 -0
  47. package/dist/node-types/abort-task.d.ts.map +1 -0
  48. package/dist/node-types/abort-task.js +33 -0
  49. package/dist/node-types/abort-task.js.map +1 -0
  50. package/dist/node-types/approval-gate.d.ts +35 -0
  51. package/dist/node-types/approval-gate.d.ts.map +1 -0
  52. package/dist/node-types/approval-gate.js +62 -0
  53. package/dist/node-types/approval-gate.js.map +1 -0
  54. package/dist/node-types/bot-report.d.ts +22 -0
  55. package/dist/node-types/bot-report.d.ts.map +1 -0
  56. package/dist/node-types/bot-report.js +63 -0
  57. package/dist/node-types/bot-report.js.map +1 -0
  58. package/dist/node-types/build-context.d.ts +29 -0
  59. package/dist/node-types/build-context.d.ts.map +1 -0
  60. package/dist/node-types/build-context.js +73 -0
  61. package/dist/node-types/build-context.js.map +1 -0
  62. package/dist/node-types/detect-provider.d.ts +20 -0
  63. package/dist/node-types/detect-provider.d.ts.map +1 -0
  64. package/dist/node-types/detect-provider.js +72 -0
  65. package/dist/node-types/detect-provider.js.map +1 -0
  66. package/dist/node-types/exec-validate-retry.d.ts +38 -0
  67. package/dist/node-types/exec-validate-retry.d.ts.map +1 -0
  68. package/dist/node-types/exec-validate-retry.js +250 -0
  69. package/dist/node-types/exec-validate-retry.js.map +1 -0
  70. package/dist/node-types/execute-plan.d.ts +34 -0
  71. package/dist/node-types/execute-plan.d.ts.map +1 -0
  72. package/dist/node-types/execute-plan.js +175 -0
  73. package/dist/node-types/execute-plan.js.map +1 -0
  74. package/dist/node-types/execute-target.d.ts +26 -0
  75. package/dist/node-types/execute-target.d.ts.map +1 -0
  76. package/dist/node-types/execute-target.js +312 -0
  77. package/dist/node-types/execute-target.js.map +1 -0
  78. package/dist/node-types/fix-errors.d.ts +32 -0
  79. package/dist/node-types/fix-errors.d.ts.map +1 -0
  80. package/dist/node-types/fix-errors.js +106 -0
  81. package/dist/node-types/fix-errors.js.map +1 -0
  82. package/dist/node-types/git-ops.d.ts +18 -0
  83. package/dist/node-types/git-ops.d.ts.map +1 -0
  84. package/dist/node-types/git-ops.js +65 -0
  85. package/dist/node-types/git-ops.js.map +1 -0
  86. package/dist/node-types/index.d.ts +20 -0
  87. package/dist/node-types/index.d.ts.map +1 -0
  88. package/dist/node-types/index.js +20 -0
  89. package/dist/node-types/index.js.map +1 -0
  90. package/dist/node-types/load-config.d.ts +15 -0
  91. package/dist/node-types/load-config.d.ts.map +1 -0
  92. package/dist/node-types/load-config.js +26 -0
  93. package/dist/node-types/load-config.js.map +1 -0
  94. package/dist/node-types/plan-task.d.ts +32 -0
  95. package/dist/node-types/plan-task.d.ts.map +1 -0
  96. package/dist/node-types/plan-task.js +122 -0
  97. package/dist/node-types/plan-task.js.map +1 -0
  98. package/dist/node-types/read-workflow.d.ts +30 -0
  99. package/dist/node-types/read-workflow.d.ts.map +1 -0
  100. package/dist/node-types/read-workflow.js +72 -0
  101. package/dist/node-types/read-workflow.js.map +1 -0
  102. package/dist/node-types/receive-task.d.ts +31 -0
  103. package/dist/node-types/receive-task.d.ts.map +1 -0
  104. package/dist/node-types/receive-task.js +72 -0
  105. package/dist/node-types/receive-task.js.map +1 -0
  106. package/dist/node-types/report.d.ts +15 -0
  107. package/dist/node-types/report.d.ts.map +1 -0
  108. package/dist/node-types/report.js +25 -0
  109. package/dist/node-types/report.js.map +1 -0
  110. package/dist/node-types/resolve-target.d.ts +24 -0
  111. package/dist/node-types/resolve-target.d.ts.map +1 -0
  112. package/dist/node-types/resolve-target.js +67 -0
  113. package/dist/node-types/resolve-target.js.map +1 -0
  114. package/dist/node-types/route-task.d.ts +26 -0
  115. package/dist/node-types/route-task.d.ts.map +1 -0
  116. package/dist/node-types/route-task.js +29 -0
  117. package/dist/node-types/route-task.js.map +1 -0
  118. package/dist/node-types/send-notify.d.ts +20 -0
  119. package/dist/node-types/send-notify.d.ts.map +1 -0
  120. package/dist/node-types/send-notify.js +75 -0
  121. package/dist/node-types/send-notify.js.map +1 -0
  122. package/dist/node-types/validate-result.d.ts +32 -0
  123. package/dist/node-types/validate-result.d.ts.map +1 -0
  124. package/dist/node-types/validate-result.js +53 -0
  125. package/dist/node-types/validate-result.js.map +1 -0
  126. package/dist/templates/index.d.ts +2 -0
  127. package/dist/templates/index.d.ts.map +1 -1
  128. package/dist/templates/index.js +3 -1
  129. package/dist/templates/index.js.map +1 -1
  130. package/dist/templates/weaver-bot-template.d.ts +3 -0
  131. package/dist/templates/weaver-bot-template.d.ts.map +1 -0
  132. package/dist/templates/weaver-bot-template.js +99 -0
  133. package/dist/templates/weaver-bot-template.js.map +1 -0
  134. package/dist/templates/weaver-template.d.ts.map +1 -1
  135. package/dist/templates/weaver-template.js +15 -653
  136. package/dist/templates/weaver-template.js.map +1 -1
  137. package/dist/workflows/index.d.ts +5 -0
  138. package/dist/workflows/index.d.ts.map +1 -0
  139. package/dist/workflows/index.js +5 -0
  140. package/dist/workflows/index.js.map +1 -0
  141. package/dist/workflows/weaver-bot-batch.d.ts +57 -0
  142. package/dist/workflows/weaver-bot-batch.d.ts.map +1 -0
  143. package/dist/workflows/weaver-bot-batch.js +60 -0
  144. package/dist/workflows/weaver-bot-batch.js.map +1 -0
  145. package/dist/workflows/weaver-bot-session.d.ts +65 -0
  146. package/dist/workflows/weaver-bot-session.d.ts.map +1 -0
  147. package/dist/workflows/weaver-bot-session.js +68 -0
  148. package/dist/workflows/weaver-bot-session.js.map +1 -0
  149. package/dist/workflows/weaver-bot.d.ts +72 -0
  150. package/dist/workflows/weaver-bot.d.ts.map +1 -0
  151. package/dist/workflows/weaver-bot.js +75 -0
  152. package/dist/workflows/weaver-bot.js.map +1 -0
  153. package/dist/workflows/weaver.d.ts +24 -0
  154. package/dist/workflows/weaver.d.ts.map +1 -0
  155. package/dist/workflows/weaver.js +28 -0
  156. package/dist/workflows/weaver.js.map +1 -0
  157. package/flowweaver.manifest.json +1004 -3
  158. package/package.json +23 -5
  159. package/dist/cli.d.ts +0 -3
  160. package/dist/cli.d.ts.map +0 -1
  161. package/dist/cli.js.map +0 -1
@@ -0,0 +1,175 @@
1
+ import { execSync } from 'node:child_process';
2
+ import * as fs from 'node:fs';
3
+ import * as path from 'node:path';
4
+ import * as os from 'node:os';
5
+ /**
6
+ * Executes plan steps via the flow-weaver CLI. Checks steering
7
+ * between steps.
8
+ *
9
+ * @flowWeaver nodeType
10
+ * @label Execute Plan
11
+ * @input projectDir [order:0] - Project root directory
12
+ * @input config [order:1] - Config (JSON, pass-through)
13
+ * @input providerType [order:2] - Provider type (pass-through)
14
+ * @input providerInfo [order:3] - Provider info (pass-through)
15
+ * @input planJson [order:4] - Plan (JSON)
16
+ * @input taskJson [order:5] - Task (JSON)
17
+ * @output projectDir [order:0] - Project root directory (pass-through)
18
+ * @output config [order:1] - Config (pass-through)
19
+ * @output providerType [order:2] - Provider type (pass-through)
20
+ * @output providerInfo [order:3] - Provider info (pass-through)
21
+ * @output executionResultJson [order:4] - Execution result (JSON)
22
+ * @output taskJson [order:5] - Task (pass-through)
23
+ * @output filesModified [order:6] - Files modified (JSON array)
24
+ * @output onSuccess [order:-2] - On Success
25
+ * @output onFailure [order:-1] - On Failure
26
+ */
27
+ export async function weaverExecutePlan(execute, projectDir, config, providerType, providerInfo, planJson, taskJson) {
28
+ const passthrough = { projectDir, config, providerType, providerInfo, taskJson };
29
+ if (!execute) {
30
+ return {
31
+ onSuccess: true, onFailure: false, ...passthrough,
32
+ executionResultJson: JSON.stringify({ success: true, stepsCompleted: 0, stepsTotal: 0, filesModified: [], filesCreated: [], errors: [], output: 'dry run' }),
33
+ filesModified: '[]',
34
+ };
35
+ }
36
+ const plan = JSON.parse(planJson);
37
+ const filesModified = [];
38
+ const filesCreated = [];
39
+ const errors = [];
40
+ const output = [];
41
+ let completed = 0;
42
+ // Check steering before starting
43
+ const steeringCheck = checkSteering();
44
+ if (steeringCheck === 'cancel') {
45
+ return {
46
+ onSuccess: false, onFailure: true, ...passthrough,
47
+ executionResultJson: JSON.stringify({ success: false, stepsCompleted: 0, stepsTotal: plan.steps.length, filesModified: [], filesCreated: [], errors: ['Cancelled via steering'], output: '' }),
48
+ filesModified: '[]',
49
+ };
50
+ }
51
+ for (const step of plan.steps) {
52
+ // Check steering between steps
53
+ const steering = checkSteering();
54
+ if (steering === 'cancel') {
55
+ output.push(`Cancelled at step ${step.id}`);
56
+ break;
57
+ }
58
+ if (steering === 'pause') {
59
+ console.log('\x1b[33m→ Paused. Waiting for resume...\x1b[0m');
60
+ await waitForResume();
61
+ }
62
+ try {
63
+ const result = executeStep(step, projectDir);
64
+ if (result.file) {
65
+ if (result.created)
66
+ filesCreated.push(result.file);
67
+ else
68
+ filesModified.push(result.file);
69
+ }
70
+ completed++;
71
+ output.push(`${step.id}: ${step.description} - done`);
72
+ console.log(`\x1b[32m + ${step.id}: ${step.description}\x1b[0m`);
73
+ }
74
+ catch (err) {
75
+ const msg = err instanceof Error ? err.message : String(err);
76
+ errors.push(`${step.id}: ${msg}`);
77
+ output.push(`${step.id}: FAILED - ${msg}`);
78
+ console.error(`\x1b[31m x ${step.id}: ${msg}\x1b[0m`);
79
+ }
80
+ }
81
+ const allFiles = [...new Set([...filesModified, ...filesCreated])];
82
+ const success = errors.length === 0;
83
+ return {
84
+ onSuccess: success, onFailure: !success, ...passthrough,
85
+ executionResultJson: JSON.stringify({
86
+ success, stepsCompleted: completed, stepsTotal: plan.steps.length,
87
+ filesModified, filesCreated, errors, output: output.join('\n'),
88
+ }),
89
+ filesModified: JSON.stringify(allFiles),
90
+ };
91
+ }
92
+ function executeStep(step, projectDir) {
93
+ const args = step.args;
94
+ const file = args.file;
95
+ switch (step.operation) {
96
+ case 'write-file':
97
+ case 'create-workflow':
98
+ case 'modify-source':
99
+ case 'implement-node': {
100
+ const filePath = path.resolve(projectDir, file);
101
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
102
+ const existed = fs.existsSync(filePath);
103
+ fs.writeFileSync(filePath, args.content ?? args.body ?? '', 'utf-8');
104
+ return { file: filePath, created: !existed };
105
+ }
106
+ case 'compile':
107
+ execSync(`flow-weaver compile "${file}"`, { cwd: projectDir, encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'], timeout: 30_000 });
108
+ return { file: file };
109
+ case 'validate':
110
+ execSync(`flow-weaver validate "${file}"`, { cwd: projectDir, encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'], timeout: 30_000 });
111
+ return {};
112
+ case 'add-node':
113
+ execSync(`flow-weaver modify addNode --file "${file}" --nodeId "${args.nodeId}" --nodeType "${args.nodeType}"`, { cwd: projectDir, encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'], timeout: 30_000 });
114
+ return { file: file };
115
+ case 'remove-node':
116
+ execSync(`flow-weaver modify removeNode --file "${file}" --nodeId "${args.nodeId}"`, { cwd: projectDir, encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'], timeout: 30_000 });
117
+ return { file: file };
118
+ case 'add-connection':
119
+ execSync(`flow-weaver modify addConnection --file "${file}" --from "${args.from}" --to "${args.to}"`, { cwd: projectDir, encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'], timeout: 30_000 });
120
+ return { file: file };
121
+ case 'remove-connection':
122
+ execSync(`flow-weaver modify removeConnection --file "${file}" --from "${args.from}" --to "${args.to}"`, { cwd: projectDir, encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'], timeout: 30_000 });
123
+ return { file: file };
124
+ case 'scaffold':
125
+ execSync(`flow-weaver create workflow "${args.template}" "${file}"`, { cwd: projectDir, encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'], timeout: 30_000 });
126
+ return { file: file, created: true };
127
+ case 'read-file':
128
+ return {};
129
+ case 'run-cli': {
130
+ const cmd = args.command;
131
+ const cliArgs = args.args?.join(' ') ?? '';
132
+ execSync(`flow-weaver ${cmd} ${cliArgs}`, { cwd: projectDir, encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'], timeout: 30_000 });
133
+ return {};
134
+ }
135
+ default:
136
+ throw new Error(`Unknown operation: ${step.operation}`);
137
+ }
138
+ }
139
+ function checkSteering() {
140
+ try {
141
+ const controlPath = path.join(os.homedir(), '.weaver', 'control.json');
142
+ if (!fs.existsSync(controlPath))
143
+ return null;
144
+ const raw = fs.readFileSync(controlPath, 'utf-8');
145
+ fs.unlinkSync(controlPath);
146
+ const cmd = JSON.parse(raw);
147
+ if (cmd.command === 'cancel')
148
+ return 'cancel';
149
+ if (cmd.command === 'pause')
150
+ return 'pause';
151
+ return null;
152
+ }
153
+ catch {
154
+ return null;
155
+ }
156
+ }
157
+ async function waitForResume() {
158
+ const controlPath = path.join(os.homedir(), '.weaver', 'control.json');
159
+ while (true) {
160
+ await new Promise(r => setTimeout(r, 1000));
161
+ try {
162
+ if (fs.existsSync(controlPath)) {
163
+ const raw = fs.readFileSync(controlPath, 'utf-8');
164
+ fs.unlinkSync(controlPath);
165
+ const cmd = JSON.parse(raw);
166
+ if (cmd.command === 'resume' || cmd.command === 'cancel') {
167
+ console.log(`\x1b[36m→ ${cmd.command === 'resume' ? 'Resumed' : 'Cancelled'}\x1b[0m`);
168
+ return;
169
+ }
170
+ }
171
+ }
172
+ catch { /* retry */ }
173
+ }
174
+ }
175
+ //# sourceMappingURL=execute-plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute-plan.js","sourceRoot":"","sources":["../../src/node-types/execute-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9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,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;IACvE,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;QAC5C,IAAI,CAAC;YACH,IAAI,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;gBAC/B,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;gBAClD,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;gBAC3B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAwB,CAAC;gBACnD,IAAI,GAAG,CAAC,OAAO,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;oBACzD,OAAO,CAAC,GAAG,CAAC,aAAa,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,SAAS,CAAC,CAAC;oBACtF,OAAO;gBACT,CAAC;YACH,CAAC;QACH,CAAC;QAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC;IACzB,CAAC;AACH,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Run the target workflow via the flow-weaver executor with an AI agent channel.
3
+ *
4
+ * @flowWeaver nodeType
5
+ * @label Execute Target
6
+ * @input projectDir [order:0] - Project root directory
7
+ * @input config [order:1] - Config (JSON)
8
+ * @input providerType [order:2] - Provider type
9
+ * @input providerInfo [order:3] - Provider info (JSON)
10
+ * @input targetPath [order:4] - Absolute path to target workflow
11
+ * @output projectDir [order:0] - Project root directory (pass-through)
12
+ * @output config [order:1] - Config (pass-through)
13
+ * @output targetPath [order:2] - Target path (pass-through)
14
+ * @output resultJson [order:3] - Workflow execution result (JSON)
15
+ * @output onSuccess [order:-2] - On Success
16
+ * @output onFailure [order:-1] - On Failure
17
+ */
18
+ export declare function weaverExecuteTarget(execute: boolean, projectDir: string, config: string, providerType: string, providerInfo: string, targetPath: string): Promise<{
19
+ onSuccess: boolean;
20
+ onFailure: boolean;
21
+ projectDir: string;
22
+ config: string;
23
+ targetPath: string;
24
+ resultJson: string;
25
+ }>;
26
+ //# sourceMappingURL=execute-target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute-target.d.ts","sourceRoot":"","sources":["../../src/node-types/execute-target.ts"],"names":[],"mappings":"AA+MA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC;IACT,SAAS,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IACvC,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;CAC5E,CAAC,CAgHD"}
@@ -0,0 +1,312 @@
1
+ import { execSync } from 'node:child_process';
2
+ function callCli(provider, prompt) {
3
+ if (provider === 'claude-cli') {
4
+ return execSync('claude -p --output-format text', {
5
+ input: prompt,
6
+ encoding: 'utf-8',
7
+ stdio: ['pipe', 'pipe', 'pipe'],
8
+ timeout: 120_000,
9
+ }).trim();
10
+ }
11
+ if (provider === 'copilot-cli') {
12
+ return execSync('copilot -p --silent --allow-all-tools', {
13
+ input: prompt,
14
+ encoding: 'utf-8',
15
+ stdio: ['pipe', 'pipe', 'pipe'],
16
+ timeout: 120_000,
17
+ }).trim();
18
+ }
19
+ throw new Error(`Unknown CLI provider: ${provider}`);
20
+ }
21
+ async function callApiAsync(apiKey, model, maxTokens, systemPrompt, userPrompt) {
22
+ const body = JSON.stringify({
23
+ model, max_tokens: maxTokens, system: systemPrompt,
24
+ messages: [{ role: 'user', content: userPrompt }],
25
+ });
26
+ const response = await fetch('https://api.anthropic.com/v1/messages', {
27
+ method: 'POST',
28
+ headers: {
29
+ 'x-api-key': apiKey,
30
+ 'anthropic-version': '2023-06-01',
31
+ 'content-type': 'application/json',
32
+ },
33
+ body,
34
+ });
35
+ if (!response.ok) {
36
+ const text = await response.text();
37
+ throw new Error(`Anthropic API error ${response.status}: ${text.slice(0, 200)}`);
38
+ }
39
+ const json = await response.json();
40
+ return json.content[0]?.text ?? '';
41
+ }
42
+ function parseJsonResponse(text) {
43
+ let cleaned = text.trim();
44
+ if (cleaned.startsWith('```')) {
45
+ cleaned = cleaned.replace(/^```(?:json)?\s*\n?/, '').replace(/\n?```\s*$/, '');
46
+ }
47
+ try {
48
+ return JSON.parse(cleaned);
49
+ }
50
+ catch { /* fallthrough */ }
51
+ const match = cleaned.match(/\{[\s\S]*\}/);
52
+ if (match)
53
+ return JSON.parse(match[0]);
54
+ throw new Error(`Failed to parse AI response as JSON: ${text.slice(0, 200)}`);
55
+ }
56
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
57
+ async function buildWeaverPrompt() {
58
+ const FALLBACK = 'You are Weaver, an expert AI companion for Flow Weaver workflows. Respond ONLY with valid JSON. No markdown, no code fences, no explanation outside the JSON structure.';
59
+ try {
60
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
+ const docMeta = await import('@synergenius/flow-weaver/doc-metadata');
62
+ const annotations = docMeta.ALL_ANNOTATIONS ?? [];
63
+ const portMods = docMeta.PORT_MODIFIERS ?? [];
64
+ const nodeMods = docMeta.NODE_MODIFIERS ?? [];
65
+ const codes = docMeta.VALIDATION_CODES ?? [];
66
+ const commands = docMeta.CLI_COMMANDS ?? [];
67
+ const groups = new Map();
68
+ for (const a of annotations) {
69
+ const list = groups.get(a.category) ?? [];
70
+ list.push(a);
71
+ groups.set(a.category, list);
72
+ }
73
+ const annotationLines = [];
74
+ for (const [category, items] of groups) {
75
+ annotationLines.push('[' + category + ']');
76
+ for (const item of items)
77
+ annotationLines.push(' ' + item.syntax + ' -- ' + item.description);
78
+ }
79
+ const modLines = [];
80
+ if (portMods.length > 0) {
81
+ modLines.push('Port modifiers (after port name):');
82
+ for (const m of portMods)
83
+ modLines.push(' ' + m.syntax + ' -- ' + m.description);
84
+ }
85
+ if (nodeMods.length > 0) {
86
+ modLines.push('Node instance modifiers (in @node declaration):');
87
+ for (const m of nodeMods)
88
+ modLines.push(' ' + m.syntax + ' -- ' + m.description);
89
+ }
90
+ const errors = codes.filter(c => c.severity === 'error').slice(0, 15);
91
+ const errorLines = errors.map(c => ' ' + c.code + ': ' + c.title + ' -- ' + c.description);
92
+ const topCmds = commands.filter(c => !c.group);
93
+ const cmdLines = topCmds.map(c => ' flow-weaver ' + c.name + ' -- ' + c.description);
94
+ return `You are Weaver, an expert AI companion for Flow Weaver workflows. You have deep knowledge of the entire Flow Weaver ecosystem: annotation grammar, compilation, CLI tools, node patterns, error diagnosis, and the Genesis self-evolution protocol.
95
+
96
+ ## Core Mental Model
97
+
98
+ The code IS the workflow. Flow Weaver workflows are plain TypeScript files with JSDoc annotations above functions. The compiler reads annotations and generates deterministic execution code between @flow-weaver-body-start/end markers. Compiled code is standalone with no runtime dependency on flow-weaver.
99
+
100
+ Three block types:
101
+ - @flowWeaver nodeType: A reusable function (node) with typed inputs/outputs
102
+ - @flowWeaver workflow: A DAG orchestration that wires node instances together
103
+ - @flowWeaver pattern: A reusable fragment with boundary ports (IN/OUT instead of Start/Exit)
104
+
105
+ ## Annotation Grammar
106
+
107
+ ${annotationLines.join('\n')}
108
+
109
+ ${modLines.join('\n')}
110
+
111
+ ## Node Execution Model
112
+
113
+ Expression nodes (@expression):
114
+ - No execute/onSuccess/onFailure params. Just inputs and return value.
115
+ - throw = failure path, return = success path
116
+ - Synchronous. Use execSync for shell commands.
117
+ - Preferred for deterministic operations.
118
+
119
+ Standard nodes:
120
+ - execute: boolean param gates execution
121
+ - Return { onSuccess: boolean, onFailure: boolean, ...outputs }
122
+ - Can be async for I/O operations
123
+
124
+ Async agent nodes:
125
+ - Use (globalThis as any).__fw_agent_channel__ to pause workflow
126
+ - Call channel.request({ agentId, context, prompt }) which returns a Promise
127
+ - Workflow suspends until agent responds
128
+ - NOT @expression (must be async)
129
+
130
+ Pass-through pattern:
131
+ - FW auto-connects ports by matching names on adjacent nodes
132
+ - To forward data through intermediate nodes, declare it as both @input and @output with the same name
133
+ - For non-adjacent wiring, use @connect sourceNode.port -> targetNode.port
134
+
135
+ Data flow:
136
+ - @path A -> B -> C: Linear execution path (sugar for multiple @connect)
137
+ - @autoConnect: Auto-wire all nodes in declaration order
138
+ - @connect: Explicit port-to-port wiring
139
+ - Merge strategies for fan-in: FIRST, LAST, COLLECT, MERGE, CONCAT
140
+
141
+ ## CLI Commands
142
+
143
+ ${cmdLines.join('\n')}
144
+
145
+ Key workflows:
146
+ flow-weaver compile <file> -- Generate executable code (in-place)
147
+ flow-weaver validate <file> -- Check for errors without compiling
148
+ flow-weaver modify <op> --file <f> -- Structural changes (addNode, removeNode, addConnection, removeConnection)
149
+ flow-weaver implement <file> -- Replace declare stubs with implementations
150
+ flow-weaver diff <a> <b> -- Semantic diff between two workflow versions
151
+ flow-weaver diagram <file> -f ascii-compact -- Generate ASCII diagram
152
+
153
+ ## Validation Errors
154
+
155
+ ${errorLines.join('\n')}
156
+
157
+ When you encounter validation errors, suggest the specific fix. Common resolutions:
158
+ - UNKNOWN_NODE_TYPE: Ensure the referenced function has @flowWeaver nodeType annotation
159
+ - MISSING_REQUIRED_INPUT: Add a @connect from a source port or make the input optional with [brackets]
160
+ - UNKNOWN_SOURCE_PORT / UNKNOWN_TARGET_PORT: Check port name spelling in @connect
161
+ - CYCLE_DETECTED: Break the cycle; use scoped iteration (@scope, @map) instead of circular dependencies
162
+
163
+ ## Genesis Protocol
164
+
165
+ Genesis is a 17-step self-evolving workflow engine:
166
+ 1. Load config (.genesis/config.json with intent, focus, constraints, approval thresholds)
167
+ 2. Observe project (fingerprint: files, package.json, git, CI, tests, existing FW workflows)
168
+ 3. Load task workflow (genesis-task.ts)
169
+ 4. Diff fingerprint against last cycle
170
+ 5. Check stabilize mode (3+ rollbacks/rejections = read-only, or explicit flag)
171
+ 6. Wait for agent (YOU decide what evolutions to propose)
172
+ 7. Propose evolution (map your decisions to FwModifyOperation[])
173
+ 8. Validate proposal (budget: max 3 cost units per cycle. addNode=1, removeNode=1, addConnection=1, removeConnection=1, implementNode=2)
174
+ 9. Snapshot current task workflow for rollback
175
+ 10. Apply changes via flow-weaver CLI
176
+ 11. Compile and validate (auto-rollback on failure)
177
+ 12. Diff workflow (semantic diff)
178
+ 13. Check approval threshold (CRITICAL > BREAKING > MINOR > COSMETIC)
179
+ 14. Wait for approval (if impact >= threshold)
180
+ 15. Commit or rollback based on approval
181
+ 16. Update history (.genesis/history.json)
182
+ 17. Report summary
183
+
184
+ When stabilize mode is active, only fix-up operations are allowed: removeNode, removeConnection, implementNode. No new nodes or connections.
185
+
186
+ ## Response Format
187
+
188
+ Return ONLY valid JSON. No markdown, no code fences, no explanation outside the JSON structure.`;
189
+ }
190
+ catch {
191
+ return FALLBACK;
192
+ }
193
+ }
194
+ /**
195
+ * Run the target workflow via the flow-weaver executor with an AI agent channel.
196
+ *
197
+ * @flowWeaver nodeType
198
+ * @label Execute Target
199
+ * @input projectDir [order:0] - Project root directory
200
+ * @input config [order:1] - Config (JSON)
201
+ * @input providerType [order:2] - Provider type
202
+ * @input providerInfo [order:3] - Provider info (JSON)
203
+ * @input targetPath [order:4] - Absolute path to target workflow
204
+ * @output projectDir [order:0] - Project root directory (pass-through)
205
+ * @output config [order:1] - Config (pass-through)
206
+ * @output targetPath [order:2] - Target path (pass-through)
207
+ * @output resultJson [order:3] - Workflow execution result (JSON)
208
+ * @output onSuccess [order:-2] - On Success
209
+ * @output onFailure [order:-1] - On Failure
210
+ */
211
+ export async function weaverExecuteTarget(execute, projectDir, config, providerType, providerInfo, targetPath) {
212
+ if (!execute) {
213
+ return {
214
+ onSuccess: true, onFailure: false,
215
+ projectDir, config, targetPath,
216
+ resultJson: JSON.stringify({ success: true, summary: 'Dry run', outcome: 'skipped' }),
217
+ };
218
+ }
219
+ const pInfo = JSON.parse(providerInfo);
220
+ const cfg = JSON.parse(config);
221
+ const systemPrompt = await buildWeaverPrompt();
222
+ const approvalSetting = cfg.approval ?? 'auto';
223
+ const approvalMode = typeof approvalSetting === 'string' ? approvalSetting : approvalSetting.mode;
224
+ const agentChannel = {
225
+ request: async (req) => {
226
+ if (req.agentId.includes('approval')) {
227
+ if (approvalMode === 'auto') {
228
+ console.log('\x1b[36m→ Auto-approving\x1b[0m');
229
+ return { approved: true, reason: 'auto-approved' };
230
+ }
231
+ if (approvalMode === 'timeout-auto') {
232
+ const timeout = typeof approvalSetting === 'object' ? (approvalSetting.timeoutSeconds ?? 300) : 300;
233
+ console.log(`\x1b[36m→ Waiting ${timeout}s before auto-approving...\x1b[0m`);
234
+ await new Promise(resolve => setTimeout(resolve, timeout * 1000));
235
+ return { approved: true, reason: 'timeout-auto-approved' };
236
+ }
237
+ return { approved: true, reason: 'default-approved' };
238
+ }
239
+ const contextStr = typeof req.context === 'string'
240
+ ? req.context
241
+ : JSON.stringify(req.context, null, 2);
242
+ const userPrompt = `Context:\n${contextStr}\n\nInstructions:\n${req.prompt}`;
243
+ let text;
244
+ if (pInfo.type === 'anthropic') {
245
+ text = await callApiAsync(pInfo.apiKey, pInfo.model ?? 'claude-sonnet-4-6', pInfo.maxTokens ?? 4096, systemPrompt, userPrompt);
246
+ }
247
+ else {
248
+ text = callCli(pInfo.type, systemPrompt + '\n\n' + userPrompt);
249
+ }
250
+ return parseJsonResponse(text);
251
+ },
252
+ onPause: () => new Promise(() => { }),
253
+ resume: () => { },
254
+ fail: () => { },
255
+ };
256
+ try {
257
+ console.log(`\x1b[36m→ Executing: ${targetPath}\x1b[0m`);
258
+ const startTime = Date.now();
259
+ const mod = '@synergenius/flow-weaver/executor';
260
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
261
+ const { executeWorkflowFromFile } = await import(mod);
262
+ const execResult = await executeWorkflowFromFile(targetPath, {}, {
263
+ agentChannel,
264
+ includeTrace: false,
265
+ production: true,
266
+ });
267
+ const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
268
+ const result = execResult.result;
269
+ const ok = result?.onSuccess ?? false;
270
+ let summary;
271
+ if (typeof result?.summary === 'string') {
272
+ summary = result.summary;
273
+ }
274
+ else if (result) {
275
+ const parts = [];
276
+ for (const [k, v] of Object.entries(result)) {
277
+ if (k === 'onSuccess' || k === 'onFailure' || v == null)
278
+ continue;
279
+ const s = typeof v === 'string' ? v : JSON.stringify(v);
280
+ parts.push(k + ': ' + (s.length > 80 ? s.slice(0, 80) + '...' : s));
281
+ }
282
+ summary = parts.length > 0 ? parts.join(', ') : 'completed';
283
+ }
284
+ else {
285
+ summary = 'completed';
286
+ }
287
+ if (ok)
288
+ console.log(`\x1b[32m✓ Completed in ${elapsed}s: ${summary}\x1b[0m`);
289
+ else
290
+ console.log(`\x1b[33m! Failed after ${elapsed}s: ${summary}\x1b[0m`);
291
+ const resultObj = {
292
+ success: ok, summary, outcome: ok ? 'completed' : 'failed',
293
+ functionName: execResult.functionName,
294
+ executionTime: Number(elapsed),
295
+ };
296
+ return {
297
+ onSuccess: ok, onFailure: !ok,
298
+ projectDir, config, targetPath,
299
+ resultJson: JSON.stringify(resultObj),
300
+ };
301
+ }
302
+ catch (err) {
303
+ const msg = err instanceof Error ? err.message : String(err);
304
+ console.log(`\x1b[33m! Error: ${msg}\x1b[0m`);
305
+ return {
306
+ onSuccess: false, onFailure: true,
307
+ projectDir, config, targetPath,
308
+ resultJson: JSON.stringify({ success: false, summary: msg, outcome: 'error' }),
309
+ };
310
+ }
311
+ }
312
+ //# sourceMappingURL=execute-target.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exec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;QACtB,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7D,OAAO,CAAC,GAAG,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAAC;QAC9C,OAAO;YACL,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI;YACjC,UAAU,EAAE,MAAM,EAAE,UAAU;YAC9B,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;SAC/E,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * When validation fails, sends errors + context to the AI and
3
+ * asks it to produce a repair plan.
4
+ *
5
+ * @flowWeaver nodeType
6
+ * @label Fix Errors
7
+ * @input projectDir [order:0] - Project root directory (pass-through)
8
+ * @input config [order:1] - Config (JSON, pass-through)
9
+ * @input providerType [order:2] - Provider type
10
+ * @input providerInfo [order:3] - Provider info (JSON)
11
+ * @input validationResultJson [order:4] - Validation results (JSON)
12
+ * @input taskJson [order:5] - Task (JSON, pass-through)
13
+ * @output projectDir [order:0] - Project root directory (pass-through)
14
+ * @output config [order:1] - Config (pass-through)
15
+ * @output providerType [order:2] - Provider type (pass-through)
16
+ * @output providerInfo [order:3] - Provider info (pass-through)
17
+ * @output fixPlanJson [order:4] - Fix plan (JSON, same schema as planJson)
18
+ * @output taskJson [order:5] - Task (pass-through)
19
+ * @output onSuccess [order:-2] - On Success
20
+ * @output onFailure [order:-1] - On Failure
21
+ */
22
+ export declare function weaverFixErrors(execute: boolean, projectDir: string, config: string, providerType: string, providerInfo: string, validationResultJson: string, taskJson: string): Promise<{
23
+ onSuccess: boolean;
24
+ onFailure: boolean;
25
+ projectDir: string;
26
+ config: string;
27
+ providerType: string;
28
+ providerInfo: string;
29
+ fixPlanJson: string;
30
+ taskJson: string;
31
+ }>;
32
+ //# sourceMappingURL=fix-errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fix-errors.d.ts","sourceRoot":"","sources":["../../src/node-types/fix-errors.ts"],"names":[],"mappings":"AAuDA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,oBAAoB,EAAE,MAAM,EAC5B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;IACT,SAAS,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IACvC,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAC/E,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;CACvC,CAAC,CA0CD"}