@synergenius/flowweaver-pack-weaver 0.5.0 → 0.5.2

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 (243) hide show
  1. package/README.md +167 -0
  2. package/dist/bot/agent-provider.d.ts +15 -1
  3. package/dist/bot/agent-provider.d.ts.map +1 -1
  4. package/dist/bot/agent-provider.js +78 -2
  5. package/dist/bot/agent-provider.js.map +1 -1
  6. package/dist/bot/ai-client.d.ts +4 -0
  7. package/dist/bot/ai-client.d.ts.map +1 -0
  8. package/dist/bot/ai-client.js +46 -0
  9. package/dist/bot/ai-client.js.map +1 -0
  10. package/dist/bot/bot-agent-channel.d.ts +14 -1
  11. package/dist/bot/bot-agent-channel.d.ts.map +1 -1
  12. package/dist/bot/bot-agent-channel.js +16 -0
  13. package/dist/bot/bot-agent-channel.js.map +1 -1
  14. package/dist/bot/cli-provider.d.ts +16 -1
  15. package/dist/bot/cli-provider.d.ts.map +1 -1
  16. package/dist/bot/cli-provider.js +10 -0
  17. package/dist/bot/cli-provider.js.map +1 -1
  18. package/dist/bot/dashboard.d.ts.map +1 -1
  19. package/dist/bot/dashboard.js +2 -2
  20. package/dist/bot/dashboard.js.map +1 -1
  21. package/dist/bot/file-lock.d.ts +7 -0
  22. package/dist/bot/file-lock.d.ts.map +1 -0
  23. package/dist/bot/file-lock.js +64 -0
  24. package/dist/bot/file-lock.js.map +1 -0
  25. package/dist/bot/file-validator.d.ts +7 -0
  26. package/dist/bot/file-validator.d.ts.map +1 -0
  27. package/dist/bot/file-validator.js +20 -0
  28. package/dist/bot/file-validator.js.map +1 -0
  29. package/dist/bot/genesis-store.d.ts +18 -0
  30. package/dist/bot/genesis-store.d.ts.map +1 -0
  31. package/dist/bot/genesis-store.js +89 -0
  32. package/dist/bot/genesis-store.js.map +1 -0
  33. package/dist/bot/index.d.ts +7 -1
  34. package/dist/bot/index.d.ts.map +1 -1
  35. package/dist/bot/index.js +8 -0
  36. package/dist/bot/index.js.map +1 -1
  37. package/dist/bot/runner.d.ts.map +1 -1
  38. package/dist/bot/runner.js +2 -4
  39. package/dist/bot/runner.js.map +1 -1
  40. package/dist/bot/session-state.d.ts +3 -3
  41. package/dist/bot/session-state.d.ts.map +1 -1
  42. package/dist/bot/session-state.js +24 -15
  43. package/dist/bot/session-state.js.map +1 -1
  44. package/dist/bot/steering.d.ts +2 -2
  45. package/dist/bot/steering.d.ts.map +1 -1
  46. package/dist/bot/steering.js +20 -15
  47. package/dist/bot/steering.js.map +1 -1
  48. package/dist/bot/step-executor.d.ts +9 -0
  49. package/dist/bot/step-executor.d.ts.map +1 -0
  50. package/dist/bot/step-executor.js +51 -0
  51. package/dist/bot/step-executor.js.map +1 -0
  52. package/dist/bot/task-queue.d.ts +8 -8
  53. package/dist/bot/task-queue.d.ts.map +1 -1
  54. package/dist/bot/task-queue.js +58 -47
  55. package/dist/bot/task-queue.js.map +1 -1
  56. package/dist/bot/types.d.ts +131 -0
  57. package/dist/bot/types.d.ts.map +1 -1
  58. package/dist/cli-bridge.d.ts.map +1 -1
  59. package/dist/cli-bridge.js +2 -4
  60. package/dist/cli-bridge.js.map +1 -1
  61. package/dist/cli-handlers.d.ts +4 -1
  62. package/dist/cli-handlers.d.ts.map +1 -1
  63. package/dist/cli-handlers.js +84 -8
  64. package/dist/cli-handlers.js.map +1 -1
  65. package/dist/index.d.ts +4 -3
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +3 -1
  68. package/dist/index.js.map +1 -1
  69. package/dist/mcp-tools.d.ts.map +1 -1
  70. package/dist/mcp-tools.js +27 -5
  71. package/dist/mcp-tools.js.map +1 -1
  72. package/dist/node-types/abort-task.d.ts +5 -12
  73. package/dist/node-types/abort-task.d.ts.map +1 -1
  74. package/dist/node-types/abort-task.js +11 -16
  75. package/dist/node-types/abort-task.js.map +1 -1
  76. package/dist/node-types/approval-gate.d.ts +4 -21
  77. package/dist/node-types/approval-gate.d.ts.map +1 -1
  78. package/dist/node-types/approval-gate.js +17 -23
  79. package/dist/node-types/approval-gate.js.map +1 -1
  80. package/dist/node-types/bot-report.d.ts +8 -10
  81. package/dist/node-types/bot-report.d.ts.map +1 -1
  82. package/dist/node-types/bot-report.js +28 -24
  83. package/dist/node-types/bot-report.js.map +1 -1
  84. package/dist/node-types/build-context.d.ts +5 -18
  85. package/dist/node-types/build-context.d.ts.map +1 -1
  86. package/dist/node-types/build-context.js +14 -23
  87. package/dist/node-types/build-context.js.map +1 -1
  88. package/dist/node-types/detect-provider.d.ts +7 -10
  89. package/dist/node-types/detect-provider.d.ts.map +1 -1
  90. package/dist/node-types/detect-provider.js +8 -12
  91. package/dist/node-types/detect-provider.js.map +1 -1
  92. package/dist/node-types/exec-validate-retry.d.ts +5 -26
  93. package/dist/node-types/exec-validate-retry.d.ts.map +1 -1
  94. package/dist/node-types/exec-validate-retry.js +21 -144
  95. package/dist/node-types/exec-validate-retry.js.map +1 -1
  96. package/dist/node-types/execute-plan.d.ts +10 -18
  97. package/dist/node-types/execute-plan.d.ts.map +1 -1
  98. package/dist/node-types/execute-plan.js +13 -68
  99. package/dist/node-types/execute-plan.js.map +1 -1
  100. package/dist/node-types/execute-target.d.ts +5 -15
  101. package/dist/node-types/execute-target.d.ts.map +1 -1
  102. package/dist/node-types/execute-target.js +17 -85
  103. package/dist/node-types/execute-target.js.map +1 -1
  104. package/dist/node-types/fix-errors.d.ts +9 -17
  105. package/dist/node-types/fix-errors.d.ts.map +1 -1
  106. package/dist/node-types/fix-errors.js +13 -64
  107. package/dist/node-types/fix-errors.js.map +1 -1
  108. package/dist/node-types/genesis-apply-retry.d.ts +24 -0
  109. package/dist/node-types/genesis-apply-retry.d.ts.map +1 -0
  110. package/dist/node-types/genesis-apply-retry.js +95 -0
  111. package/dist/node-types/genesis-apply-retry.js.map +1 -0
  112. package/dist/node-types/genesis-apply.d.ts +29 -0
  113. package/dist/node-types/genesis-apply.d.ts.map +1 -0
  114. package/dist/node-types/genesis-apply.js +76 -0
  115. package/dist/node-types/genesis-apply.js.map +1 -0
  116. package/dist/node-types/genesis-approve.d.ts +19 -0
  117. package/dist/node-types/genesis-approve.d.ts.map +1 -0
  118. package/dist/node-types/genesis-approve.js +54 -0
  119. package/dist/node-types/genesis-approve.js.map +1 -0
  120. package/dist/node-types/genesis-check-stabilize.d.ts +16 -0
  121. package/dist/node-types/genesis-check-stabilize.d.ts.map +1 -0
  122. package/dist/node-types/genesis-check-stabilize.js +32 -0
  123. package/dist/node-types/genesis-check-stabilize.js.map +1 -0
  124. package/dist/node-types/genesis-check-threshold.d.ts +15 -0
  125. package/dist/node-types/genesis-check-threshold.d.ts.map +1 -0
  126. package/dist/node-types/genesis-check-threshold.js +29 -0
  127. package/dist/node-types/genesis-check-threshold.js.map +1 -0
  128. package/dist/node-types/genesis-commit.d.ts +17 -0
  129. package/dist/node-types/genesis-commit.d.ts.map +1 -0
  130. package/dist/node-types/genesis-commit.js +59 -0
  131. package/dist/node-types/genesis-commit.js.map +1 -0
  132. package/dist/node-types/genesis-compile-validate.d.ts +26 -0
  133. package/dist/node-types/genesis-compile-validate.d.ts.map +1 -0
  134. package/dist/node-types/genesis-compile-validate.js +60 -0
  135. package/dist/node-types/genesis-compile-validate.js.map +1 -0
  136. package/dist/node-types/genesis-diff-fingerprint.d.ts +15 -0
  137. package/dist/node-types/genesis-diff-fingerprint.d.ts.map +1 -0
  138. package/dist/node-types/genesis-diff-fingerprint.js +59 -0
  139. package/dist/node-types/genesis-diff-fingerprint.js.map +1 -0
  140. package/dist/node-types/genesis-diff-workflow.d.ts +15 -0
  141. package/dist/node-types/genesis-diff-workflow.d.ts.map +1 -0
  142. package/dist/node-types/genesis-diff-workflow.js +39 -0
  143. package/dist/node-types/genesis-diff-workflow.js.map +1 -0
  144. package/dist/node-types/genesis-load-config.d.ts +17 -0
  145. package/dist/node-types/genesis-load-config.d.ts.map +1 -0
  146. package/dist/node-types/genesis-load-config.js +35 -0
  147. package/dist/node-types/genesis-load-config.js.map +1 -0
  148. package/dist/node-types/genesis-observe.d.ts +18 -0
  149. package/dist/node-types/genesis-observe.d.ts.map +1 -0
  150. package/dist/node-types/genesis-observe.js +101 -0
  151. package/dist/node-types/genesis-observe.js.map +1 -0
  152. package/dist/node-types/genesis-propose.d.ts +17 -0
  153. package/dist/node-types/genesis-propose.d.ts.map +1 -0
  154. package/dist/node-types/genesis-propose.js +67 -0
  155. package/dist/node-types/genesis-propose.js.map +1 -0
  156. package/dist/node-types/genesis-report.d.ts +18 -0
  157. package/dist/node-types/genesis-report.d.ts.map +1 -0
  158. package/dist/node-types/genesis-report.js +61 -0
  159. package/dist/node-types/genesis-report.js.map +1 -0
  160. package/dist/node-types/genesis-snapshot.d.ts +15 -0
  161. package/dist/node-types/genesis-snapshot.d.ts.map +1 -0
  162. package/dist/node-types/genesis-snapshot.js +26 -0
  163. package/dist/node-types/genesis-snapshot.js.map +1 -0
  164. package/dist/node-types/genesis-try-apply.d.ts +18 -0
  165. package/dist/node-types/genesis-try-apply.d.ts.map +1 -0
  166. package/dist/node-types/genesis-try-apply.js +109 -0
  167. package/dist/node-types/genesis-try-apply.js.map +1 -0
  168. package/dist/node-types/genesis-update-history.d.ts +15 -0
  169. package/dist/node-types/genesis-update-history.d.ts.map +1 -0
  170. package/dist/node-types/genesis-update-history.js +57 -0
  171. package/dist/node-types/genesis-update-history.js.map +1 -0
  172. package/dist/node-types/genesis-validate-proposal.d.ts +16 -0
  173. package/dist/node-types/genesis-validate-proposal.d.ts.map +1 -0
  174. package/dist/node-types/genesis-validate-proposal.js +52 -0
  175. package/dist/node-types/genesis-validate-proposal.js.map +1 -0
  176. package/dist/node-types/git-ops.d.ts +5 -8
  177. package/dist/node-types/git-ops.d.ts.map +1 -1
  178. package/dist/node-types/git-ops.js +16 -14
  179. package/dist/node-types/git-ops.js.map +1 -1
  180. package/dist/node-types/index.d.ts +17 -0
  181. package/dist/node-types/index.d.ts.map +1 -1
  182. package/dist/node-types/index.js +17 -0
  183. package/dist/node-types/index.js.map +1 -1
  184. package/dist/node-types/load-config.d.ts +4 -2
  185. package/dist/node-types/load-config.d.ts.map +1 -1
  186. package/dist/node-types/load-config.js +3 -2
  187. package/dist/node-types/load-config.js.map +1 -1
  188. package/dist/node-types/plan-task.d.ts +5 -20
  189. package/dist/node-types/plan-task.d.ts.map +1 -1
  190. package/dist/node-types/plan-task.js +16 -85
  191. package/dist/node-types/plan-task.js.map +1 -1
  192. package/dist/node-types/read-workflow.d.ts +5 -20
  193. package/dist/node-types/read-workflow.d.ts.map +1 -1
  194. package/dist/node-types/read-workflow.js +16 -28
  195. package/dist/node-types/read-workflow.js.map +1 -1
  196. package/dist/node-types/receive-task.d.ts +9 -20
  197. package/dist/node-types/receive-task.d.ts.map +1 -1
  198. package/dist/node-types/receive-task.js +16 -19
  199. package/dist/node-types/receive-task.js.map +1 -1
  200. package/dist/node-types/report.d.ts +3 -4
  201. package/dist/node-types/report.d.ts.map +1 -1
  202. package/dist/node-types/report.js +6 -6
  203. package/dist/node-types/report.js.map +1 -1
  204. package/dist/node-types/resolve-target.d.ts +7 -15
  205. package/dist/node-types/resolve-target.d.ts.map +1 -1
  206. package/dist/node-types/resolve-target.js +47 -47
  207. package/dist/node-types/resolve-target.js.map +1 -1
  208. package/dist/node-types/route-task.d.ts +4 -16
  209. package/dist/node-types/route-task.d.ts.map +1 -1
  210. package/dist/node-types/route-task.js +6 -13
  211. package/dist/node-types/route-task.js.map +1 -1
  212. package/dist/node-types/send-notify.d.ts +5 -11
  213. package/dist/node-types/send-notify.d.ts.map +1 -1
  214. package/dist/node-types/send-notify.js +17 -24
  215. package/dist/node-types/send-notify.js.map +1 -1
  216. package/dist/node-types/validate-result.d.ts +11 -19
  217. package/dist/node-types/validate-result.d.ts.map +1 -1
  218. package/dist/node-types/validate-result.js +18 -33
  219. package/dist/node-types/validate-result.js.map +1 -1
  220. package/dist/workflows/genesis-task.d.ts +52 -0
  221. package/dist/workflows/genesis-task.d.ts.map +1 -0
  222. package/dist/workflows/genesis-task.js +56 -0
  223. package/dist/workflows/genesis-task.js.map +1 -0
  224. package/dist/workflows/index.d.ts +1 -1
  225. package/dist/workflows/index.d.ts.map +1 -1
  226. package/dist/workflows/index.js +1 -1
  227. package/dist/workflows/index.js.map +1 -1
  228. package/dist/workflows/weaver-bot-batch.d.ts +15 -26
  229. package/dist/workflows/weaver-bot-batch.d.ts.map +1 -1
  230. package/dist/workflows/weaver-bot-batch.js +15 -26
  231. package/dist/workflows/weaver-bot-batch.js.map +1 -1
  232. package/dist/workflows/weaver-bot.d.ts +18 -32
  233. package/dist/workflows/weaver-bot.d.ts.map +1 -1
  234. package/dist/workflows/weaver-bot.js +18 -32
  235. package/dist/workflows/weaver-bot.js.map +1 -1
  236. package/dist/workflows/weaver.d.ts +9 -9
  237. package/dist/workflows/weaver.js +9 -9
  238. package/flowweaver.manifest.json +494 -558
  239. package/package.json +3 -3
  240. package/dist/workflows/weaver-bot-session.d.ts +0 -65
  241. package/dist/workflows/weaver-bot-session.d.ts.map +0 -1
  242. package/dist/workflows/weaver-bot-session.js +0 -68
  243. package/dist/workflows/weaver-bot-session.js.map +0 -1
@@ -0,0 +1,67 @@
1
+ import { callCli, callApi, parseJsonResponse } from '../bot/ai-client.js';
2
+ /**
3
+ * Sends project context and diff information to the AI provider, which
4
+ * returns a structured proposal of workflow operations to apply.
5
+ *
6
+ * @flowWeaver nodeType
7
+ * @label Genesis Propose
8
+ * @input ctx [order:0] - Genesis context (JSON)
9
+ * @output ctx [order:0] - Genesis context with proposalJson (JSON)
10
+ * @output onSuccess [order:-2] - On Success
11
+ * @output onFailure [order:-1] [hidden] - On Failure
12
+ */
13
+ export async function genesisPropose(execute, ctx) {
14
+ const context = JSON.parse(ctx);
15
+ const { env } = context;
16
+ if (!execute) {
17
+ const empty = { operations: [], totalCost: 0, impactLevel: 'COSMETIC', summary: 'dry run', rationale: '' };
18
+ context.proposalJson = JSON.stringify(empty);
19
+ return { onSuccess: true, onFailure: false, ctx: JSON.stringify(context) };
20
+ }
21
+ const { providerInfo: pInfo } = env;
22
+ const config = JSON.parse(context.genesisConfigJson);
23
+ const diff = JSON.parse(context.diffJson);
24
+ const stabilizeClause = context.stabilized
25
+ ? '\n\nSTABILIZE MODE: Only removeNode, removeConnection, and implementNode operations are allowed. Do NOT propose addNode or addConnection.'
26
+ : '';
27
+ const systemPrompt = [
28
+ 'You are Genesis, a workflow self-evolution engine.',
29
+ `Intent: ${config.intent}`,
30
+ config.focus.length > 0 ? `Focus areas: ${config.focus.join(', ')}` : '',
31
+ config.constraints.length > 0 ? `Constraints: ${config.constraints.join(', ')}` : '',
32
+ `Budget: ${config.budgetPerCycle} cost units per cycle.`,
33
+ 'Cost map: addNode=1, removeNode=1, addConnection=1, removeConnection=1, implementNode=2.',
34
+ stabilizeClause,
35
+ '',
36
+ 'Return a JSON object with: operations (array of {type, args, costUnits, rationale}), totalCost (number), impactLevel ("COSMETIC"|"MINOR"|"BREAKING"|"CRITICAL"), summary (string), rationale (string).',
37
+ ].filter(Boolean).join('\n');
38
+ const userPrompt = [
39
+ 'Project diff since last cycle:',
40
+ JSON.stringify(diff, null, 2),
41
+ '',
42
+ 'Current fingerprint:',
43
+ context.fingerprintJson,
44
+ '',
45
+ 'Propose workflow evolution operations within the budget.',
46
+ ].join('\n');
47
+ try {
48
+ let text;
49
+ if (pInfo.type === 'anthropic') {
50
+ text = await callApi(pInfo.apiKey, pInfo.model ?? 'claude-sonnet-4-6', pInfo.maxTokens ?? 8192, systemPrompt, userPrompt);
51
+ }
52
+ else {
53
+ text = callCli(pInfo.type, systemPrompt + '\n\n' + userPrompt);
54
+ }
55
+ const proposal = parseJsonResponse(text);
56
+ console.log(`\x1b[36m→ Proposal: ${proposal.summary} (${proposal.operations.length} ops, impact=${proposal.impactLevel})\x1b[0m`);
57
+ context.proposalJson = JSON.stringify(proposal);
58
+ return { onSuccess: true, onFailure: false, ctx: JSON.stringify(context) };
59
+ }
60
+ catch (err) {
61
+ const msg = err instanceof Error ? err.message : String(err);
62
+ console.error(`\x1b[31m→ Proposal failed: ${msg}\x1b[0m`);
63
+ context.proposalJson = JSON.stringify({ operations: [], totalCost: 0, impactLevel: 'COSMETIC', summary: `Failed: ${msg}`, rationale: '' });
64
+ return { onSuccess: false, onFailure: true, ctx: JSON.stringify(context) };
65
+ }
66
+ }
67
+ //# sourceMappingURL=genesis-propose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genesis-propose.js","sourceRoot":"","sources":["../../src/node-types/genesis-propose.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE1E;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAAgB,EAChB,GAAW;IAKX,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAmB,CAAC;IAClD,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IAExB,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,KAAK,GAAoB,EAAE,UAAU,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;QAC5H,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC7C,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;IAC7E,CAAC;IAED,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC;IACpC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAkB,CAAC;IACtE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAS,CAAC,CAAC;IAE3C,MAAM,eAAe,GAAG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AAC;QAED,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAA+B,CAAC;QACvE,OAAO,CAAC,GAAG,CAAC,uBAAuB,QAAQ,CAAC,OAAO,KAAK,QAAQ,CAAC,UAAU,CAAC,MAAM,gBAAgB,QAAQ,CAAC,WAAW,UAAU,CAAC,CAAC;QAElI,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAChD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;IAC7E,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7D,OAAO,CAAC,KAAK,CAAC,8BAA8B,GAAG,SAAS,CAAC,CAAC;QAC1D,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,GAAG,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;QAC3I,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;IAC7E,CAAC;AACH,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Formats a genesis cycle summary for console output. Receives context
3
+ * from either the success path or the fail path. Fires from any
4
+ * incoming path.
5
+ *
6
+ * @flowWeaver nodeType
7
+ * @expression
8
+ * @label Genesis Report
9
+ * @executeWhen DISJUNCTION
10
+ * @input [successCtx] [order:0] - Genesis context from success path (JSON)
11
+ * @input [failCtx] [order:1] - Genesis context from fail path (JSON)
12
+ * @output summary [order:1] - Formatted summary text
13
+ * @output onFailure [hidden]
14
+ */
15
+ export declare function genesisReport(successCtx?: string, failCtx?: string): {
16
+ summary: string;
17
+ };
18
+ //# sourceMappingURL=genesis-report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genesis-report.d.ts","sourceRoot":"","sources":["../../src/node-types/genesis-report.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAuDxF"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Formats a genesis cycle summary for console output. Receives context
3
+ * from either the success path or the fail path. Fires from any
4
+ * incoming path.
5
+ *
6
+ * @flowWeaver nodeType
7
+ * @expression
8
+ * @label Genesis Report
9
+ * @executeWhen DISJUNCTION
10
+ * @input [successCtx] [order:0] - Genesis context from success path (JSON)
11
+ * @input [failCtx] [order:1] - Genesis context from fail path (JSON)
12
+ * @output summary [order:1] - Formatted summary text
13
+ * @output onFailure [hidden]
14
+ */
15
+ export function genesisReport(successCtx, failCtx) {
16
+ const ctx = successCtx ?? failCtx;
17
+ if (!ctx) {
18
+ const summary = 'Genesis cycle completed with no record';
19
+ console.log(`\n\x1b[33m${summary}\x1b[0m\n`);
20
+ return { summary };
21
+ }
22
+ const context = JSON.parse(ctx);
23
+ if (context.error) {
24
+ let summary = `Genesis cycle failed: ${context.error}`;
25
+ if (context.applyResultJson) {
26
+ try {
27
+ const result = JSON.parse(context.applyResultJson);
28
+ summary += ` (applied: ${result.applied}, failed: ${result.failed})`;
29
+ }
30
+ catch { /* ignore parse errors */ }
31
+ }
32
+ console.log(`\n\x1b[31m${summary}\x1b[0m\n`);
33
+ return { summary };
34
+ }
35
+ if (!context.cycleRecordJson) {
36
+ const summary = 'Genesis cycle completed with no record';
37
+ console.log(`\n\x1b[33m${summary}\x1b[0m\n`);
38
+ return { summary };
39
+ }
40
+ const record = JSON.parse(context.cycleRecordJson);
41
+ const parts = [
42
+ `Cycle: ${record.id}`,
43
+ `Outcome: ${record.outcome}`,
44
+ `Duration: ${record.durationMs}ms`,
45
+ ];
46
+ if (record.proposal) {
47
+ parts.push(`Operations: ${record.proposal.operations.length}`);
48
+ parts.push(`Impact: ${record.proposal.impactLevel}`);
49
+ }
50
+ if (record.approved !== null) {
51
+ parts.push(`Approved: ${record.approved}`);
52
+ }
53
+ if (record.error) {
54
+ parts.push(`Errors: ${record.error}`);
55
+ }
56
+ const summary = parts.join(' | ');
57
+ const color = record.outcome === 'applied' ? '\x1b[32m' : record.outcome === 'error' ? '\x1b[31m' : '\x1b[33m';
58
+ console.log(`\n\x1b[1m${color}Genesis: ${summary}\x1b[0m\n`);
59
+ return { summary };
60
+ }
61
+ //# sourceMappingURL=genesis-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genesis-report.js","sourceRoot":"","sources":["../../src/node-types/genesis-report.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAAC,UAAmB,EAAE,OAAgB;IACjE,MAAM,GAAG,GAAG,UAAU,IAAI,OAAO,CAAC;IAClC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,OAAO,GAAG,wCAAwC,CAAC;QACzD,OAAO,CAAC,GAAG,CAAC,aAAa,OAAO,WAAW,CAAC,CAAC;QAC7C,OAAO,EAAE,OAAO,EAAE,CAAC;IACrB,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAmB,CAAC;IAElD,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,IAAI,OAAO,GAAG,yBAAyB,OAAO,CAAC,KAAK,EAAE,CAAC;QACvD,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;YAC5B,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG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xC,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC;IAE/G,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,YAAY,OAAO,WAAW,CAAC,CAAC;IAE7D,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Saves a snapshot of the target workflow file before any modifications
3
+ * are applied, enabling rollback if something goes wrong.
4
+ *
5
+ * @flowWeaver nodeType
6
+ * @expression
7
+ * @label Genesis Snapshot
8
+ * @input ctx [order:0] - Genesis context (JSON)
9
+ * @output ctx [order:0] - Genesis context with snapshotPath (JSON)
10
+ * @output onFailure [hidden]
11
+ */
12
+ export declare function genesisSnapshot(ctx: string): {
13
+ ctx: string;
14
+ };
15
+ //# sourceMappingURL=genesis-snapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genesis-snapshot.d.ts","sourceRoot":"","sources":["../../src/node-types/genesis-snapshot.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAa5D"}
@@ -0,0 +1,26 @@
1
+ import * as fs from 'node:fs';
2
+ import * as path from 'node:path';
3
+ import { GenesisStore } from '../bot/genesis-store.js';
4
+ /**
5
+ * Saves a snapshot of the target workflow file before any modifications
6
+ * are applied, enabling rollback if something goes wrong.
7
+ *
8
+ * @flowWeaver nodeType
9
+ * @expression
10
+ * @label Genesis Snapshot
11
+ * @input ctx [order:0] - Genesis context (JSON)
12
+ * @output ctx [order:0] - Genesis context with snapshotPath (JSON)
13
+ * @output onFailure [hidden]
14
+ */
15
+ export function genesisSnapshot(ctx) {
16
+ const context = JSON.parse(ctx);
17
+ const config = JSON.parse(context.genesisConfigJson);
18
+ const targetPath = path.resolve(context.env.projectDir, config.targetWorkflow);
19
+ const content = fs.readFileSync(targetPath, 'utf-8');
20
+ const store = new GenesisStore(context.env.projectDir);
21
+ const snapshotPath = store.saveSnapshot(context.cycleId, content);
22
+ console.log(`\x1b[36m→ Snapshot saved: ${snapshotPath}\x1b[0m`);
23
+ context.snapshotPath = snapshotPath;
24
+ return { ctx: JSON.stringify(context) };
25
+ }
26
+ //# sourceMappingURL=genesis-snapshot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genesis-snapshot.js","sourceRoot":"","sources":["../../src/node-types/genesis-snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAmB,CAAC;IAClD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAkB,CAAC;IACtE,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC;IAC/E,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAErD,MAAM,KAAK,GAAG,IAAI,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACvD,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAElE,OAAO,CAAC,GAAG,CAAC,6BAA6B,YAAY,SAAS,CAAC,CAAC;IAEhE,OAAO,CAAC,YAAY,GAAG,YAAY,CAAC;IACpC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Applies proposal operations then validates + compiles. On compile
3
+ * failure, restores the snapshot and returns the failure path with
4
+ * error details so the parent scope can retry with a revised proposal.
5
+ *
6
+ * @flowWeaver nodeType
7
+ * @label Genesis Try Apply
8
+ * @input ctx [order:0] - Genesis context (JSON)
9
+ * @output ctx [order:0] - Genesis context with apply results (JSON)
10
+ * @output onSuccess [order:-2] - On Success
11
+ * @output onFailure [order:-1] [hidden] - On Failure
12
+ */
13
+ export declare function genesisTryApply(execute: boolean, ctx: string): Promise<{
14
+ onSuccess: boolean;
15
+ onFailure: boolean;
16
+ ctx: string;
17
+ }>;
18
+ //# sourceMappingURL=genesis-try-apply.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genesis-try-apply.d.ts","sourceRoot":"","sources":["../../src/node-types/genesis-try-apply.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IACT,SAAS,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IACvC,GAAG,EAAE,MAAM,CAAC;CACb,CAAC,CAqFD"}
@@ -0,0 +1,109 @@
1
+ import * as path from 'node:path';
2
+ import * as fs from 'node:fs';
3
+ import { execFileSync } from 'node:child_process';
4
+ import { GenesisStore } from '../bot/genesis-store.js';
5
+ /**
6
+ * Applies proposal operations then validates + compiles. On compile
7
+ * failure, restores the snapshot and returns the failure path with
8
+ * error details so the parent scope can retry with a revised proposal.
9
+ *
10
+ * @flowWeaver nodeType
11
+ * @label Genesis Try Apply
12
+ * @input ctx [order:0] - Genesis context (JSON)
13
+ * @output ctx [order:0] - Genesis context with apply results (JSON)
14
+ * @output onSuccess [order:-2] - On Success
15
+ * @output onFailure [order:-1] [hidden] - On Failure
16
+ */
17
+ export async function genesisTryApply(execute, ctx) {
18
+ const context = JSON.parse(ctx);
19
+ if (!execute) {
20
+ const result = { applied: 0, failed: 0, errors: [] };
21
+ context.applyResultJson = JSON.stringify(result);
22
+ context.error = '';
23
+ return { onSuccess: true, onFailure: false, ctx: JSON.stringify(context) };
24
+ }
25
+ const { env } = context;
26
+ const config = JSON.parse(context.genesisConfigJson);
27
+ const proposal = JSON.parse(context.proposalJson);
28
+ const targetPath = path.resolve(env.projectDir, config.targetWorkflow);
29
+ // Apply operations
30
+ let applied = 0;
31
+ let failed = 0;
32
+ const errors = [];
33
+ for (const op of proposal.operations) {
34
+ try {
35
+ const cliArgs = buildModifyArgs(op, targetPath);
36
+ execFileSync('flow-weaver', cliArgs, {
37
+ cwd: env.projectDir,
38
+ encoding: 'utf-8',
39
+ stdio: ['pipe', 'pipe', 'pipe'],
40
+ timeout: 30_000,
41
+ });
42
+ applied++;
43
+ console.log(`\x1b[32m + ${op.type}: ${op.rationale}\x1b[0m`);
44
+ }
45
+ catch (err) {
46
+ failed++;
47
+ const msg = err instanceof Error ? err.message : String(err);
48
+ errors.push(`${op.type}: ${msg}`);
49
+ console.error(`\x1b[31m x ${op.type}: ${msg}\x1b[0m`);
50
+ }
51
+ }
52
+ const applyResult = { applied, failed, errors };
53
+ context.applyResultJson = JSON.stringify(applyResult);
54
+ console.log(`\x1b[36m→ Apply: ${applied} succeeded, ${failed} failed\x1b[0m`);
55
+ // If all operations failed, no point compiling
56
+ if (applied === 0) {
57
+ context.error = '';
58
+ return { onSuccess: false, onFailure: true, ctx: JSON.stringify(context) };
59
+ }
60
+ // Validate + compile
61
+ try {
62
+ execFileSync('flow-weaver', ['validate', targetPath], {
63
+ cwd: env.projectDir,
64
+ encoding: 'utf-8',
65
+ stdio: ['pipe', 'pipe', 'pipe'],
66
+ timeout: 30_000,
67
+ });
68
+ console.log('\x1b[32m→ Validation passed\x1b[0m');
69
+ execFileSync('flow-weaver', ['compile', targetPath], {
70
+ cwd: env.projectDir,
71
+ encoding: 'utf-8',
72
+ stdio: ['pipe', 'pipe', 'pipe'],
73
+ timeout: 60_000,
74
+ });
75
+ console.log('\x1b[32m→ Compilation passed\x1b[0m');
76
+ context.error = '';
77
+ return { onSuccess: true, onFailure: false, ctx: JSON.stringify(context) };
78
+ }
79
+ catch (err) {
80
+ const msg = err instanceof Error ? err.message : String(err);
81
+ console.error(`\x1b[31m→ Compile/validate failed: ${msg}\x1b[0m`);
82
+ // Restore from snapshot
83
+ const store = new GenesisStore(env.projectDir);
84
+ const snapshot = store.loadSnapshot(context.snapshotPath);
85
+ if (snapshot) {
86
+ fs.writeFileSync(targetPath, snapshot, 'utf-8');
87
+ console.log('\x1b[33m→ Restored from snapshot\x1b[0m');
88
+ }
89
+ context.error = msg;
90
+ return { onSuccess: false, onFailure: true, ctx: JSON.stringify(context) };
91
+ }
92
+ }
93
+ function buildModifyArgs(op, targetPath) {
94
+ switch (op.type) {
95
+ case 'addNode':
96
+ return ['modify', 'addNode', '--file', targetPath, '--nodeId', String(op.args.nodeId), '--nodeType', String(op.args.nodeType)];
97
+ case 'removeNode':
98
+ return ['modify', 'removeNode', '--file', targetPath, '--nodeId', String(op.args.nodeId)];
99
+ case 'addConnection':
100
+ return ['modify', 'addConnection', '--file', targetPath, '--from', String(op.args.from), '--to', String(op.args.to)];
101
+ case 'removeConnection':
102
+ return ['modify', 'removeConnection', '--file', targetPath, '--from', String(op.args.from), '--to', String(op.args.to)];
103
+ case 'implementNode':
104
+ return ['implement', targetPath, '--nodeId', String(op.args.nodeId)];
105
+ default:
106
+ throw new Error(`Unknown genesis operation type: ${op.type}`);
107
+ }
108
+ }
109
+ //# sourceMappingURL=genesis-try-apply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genesis-try-apply.js","sourceRoot":"","sources":["../../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,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1H,KAAK,eAAe;YAClB,OAAO,CAAC,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QACvE;YACE,MAAM,IAAI,KAAK,CAAC,mCAAmC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;IAClE,CAAC;AACH,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Builds a cycle record from all available data, determines the outcome,
3
+ * appends it to the genesis history, and saves the current fingerprint.
4
+ *
5
+ * @flowWeaver nodeType
6
+ * @expression
7
+ * @label Genesis Update History
8
+ * @input ctx [order:0] - Genesis context (JSON)
9
+ * @output ctx [order:0] - Genesis context with cycleRecordJson (JSON)
10
+ * @output onFailure [hidden]
11
+ */
12
+ export declare function genesisUpdateHistory(ctx: string): {
13
+ ctx: string;
14
+ };
15
+ //# sourceMappingURL=genesis-update-history.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genesis-update-history.d.ts","sourceRoot":"","sources":["../../src/node-types/genesis-update-history.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CA8CjE"}
@@ -0,0 +1,57 @@
1
+ import { GenesisStore } from '../bot/genesis-store.js';
2
+ /**
3
+ * Builds a cycle record from all available data, determines the outcome,
4
+ * appends it to the genesis history, and saves the current fingerprint.
5
+ *
6
+ * @flowWeaver nodeType
7
+ * @expression
8
+ * @label Genesis Update History
9
+ * @input ctx [order:0] - Genesis context (JSON)
10
+ * @output ctx [order:0] - Genesis context with cycleRecordJson (JSON)
11
+ * @output onFailure [hidden]
12
+ */
13
+ export function genesisUpdateHistory(ctx) {
14
+ const context = JSON.parse(ctx);
15
+ const { env } = context;
16
+ const fingerprint = JSON.parse(context.fingerprintJson);
17
+ const proposal = context.proposalJson ? JSON.parse(context.proposalJson) : null;
18
+ const applyResult = context.applyResultJson ? JSON.parse(context.applyResultJson) : null;
19
+ const durationMs = 0;
20
+ // Determine outcome
21
+ let outcome;
22
+ if (!proposal || proposal.operations.length === 0) {
23
+ outcome = 'no-change';
24
+ }
25
+ else if (context.approved === false) {
26
+ outcome = 'rejected';
27
+ }
28
+ else if (applyResult && applyResult.failed > 0) {
29
+ outcome = 'rolled-back';
30
+ }
31
+ else if (context.approved === true && applyResult && applyResult.failed === 0) {
32
+ outcome = 'applied';
33
+ }
34
+ else {
35
+ outcome = 'error';
36
+ }
37
+ const record = {
38
+ id: context.cycleId,
39
+ timestamp: new Date().toISOString(),
40
+ durationMs,
41
+ fingerprint,
42
+ proposal,
43
+ outcome,
44
+ diffSummary: proposal?.summary ?? null,
45
+ approvalRequired: context.approved !== undefined,
46
+ approved: context.approved ?? null,
47
+ error: applyResult?.errors?.length ? applyResult.errors.join('; ') : null,
48
+ snapshotFile: context.snapshotPath ?? null,
49
+ };
50
+ const store = new GenesisStore(env.projectDir);
51
+ store.appendCycle(record);
52
+ store.saveFingerprint(fingerprint);
53
+ console.log(`\x1b[36m→ Cycle ${context.cycleId}: ${outcome} (${durationMs}ms)\x1b[0m`);
54
+ context.cycleRecordJson = JSON.stringify(record);
55
+ return { ctx: JSON.stringify(context) };
56
+ }
57
+ //# sourceMappingURL=genesis-update-history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genesis-update-history.js","sourceRoot":"","sources":["../../src/node-types/genesis-update-history.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAmB,CAAC;IAClD,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IAExB,MAAM,WAAW,GAA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OAAO,CAAC,QAAQ,IAAI,IAAI;QAClC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI;QACzE,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,IAAI;KAC3C,CAAC;IAEF,MAAM,KAAK,GAAG,IAAI,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC/C,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1B,KAAK,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;IAEnC,OAAO,CAAC,GAAG,CAAC,mBAAmB,OAAO,CAAC,OAAO,KAAK,OAAO,KAAK,UAAU,YAAY,CAAC,CAAC;IAEvF,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACjD,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Validates and trims a genesis proposal to fit within the budget.
3
+ * Recalculates costs (never trusts the AI), filters out disallowed
4
+ * operations in stabilize mode, and trims from the end if over budget.
5
+ *
6
+ * @flowWeaver nodeType
7
+ * @expression
8
+ * @label Genesis Validate Proposal
9
+ * @input ctx [order:0] - Genesis context (JSON)
10
+ * @output ctx [order:0] - Genesis context with validated proposalJson (JSON)
11
+ * @output onFailure [hidden]
12
+ */
13
+ export declare function genesisValidateProposal(ctx: string): {
14
+ ctx: string;
15
+ };
16
+ //# sourceMappingURL=genesis-validate-proposal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genesis-validate-proposal.d.ts","sourceRoot":"","sources":["../../src/node-types/genesis-validate-proposal.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAsCpE"}
@@ -0,0 +1,52 @@
1
+ const COST_MAP = {
2
+ addNode: 1,
3
+ removeNode: 1,
4
+ addConnection: 1,
5
+ removeConnection: 1,
6
+ implementNode: 2,
7
+ };
8
+ /**
9
+ * Validates and trims a genesis proposal to fit within the budget.
10
+ * Recalculates costs (never trusts the AI), filters out disallowed
11
+ * operations in stabilize mode, and trims from the end if over budget.
12
+ *
13
+ * @flowWeaver nodeType
14
+ * @expression
15
+ * @label Genesis Validate Proposal
16
+ * @input ctx [order:0] - Genesis context (JSON)
17
+ * @output ctx [order:0] - Genesis context with validated proposalJson (JSON)
18
+ * @output onFailure [hidden]
19
+ */
20
+ export function genesisValidateProposal(ctx) {
21
+ const context = JSON.parse(ctx);
22
+ const config = JSON.parse(context.genesisConfigJson);
23
+ const proposal = JSON.parse(context.proposalJson);
24
+ let ops = proposal.operations;
25
+ // In stabilize mode, hard-reject addNode and addConnection
26
+ if (context.stabilized) {
27
+ const before = ops.length;
28
+ ops = ops.filter(op => op.type !== 'addNode' && op.type !== 'addConnection');
29
+ if (ops.length < before) {
30
+ console.log(`\x1b[33m→ Stabilize: filtered ${before - ops.length} disallowed operations\x1b[0m`);
31
+ }
32
+ }
33
+ // Recalculate costs (never trust the AI values)
34
+ for (const op of ops) {
35
+ op.costUnits = COST_MAP[op.type] ?? 1;
36
+ }
37
+ // Trim from end if over budget
38
+ let totalCost = ops.reduce((sum, op) => sum + op.costUnits, 0);
39
+ while (totalCost > config.budgetPerCycle && ops.length > 0) {
40
+ ops.pop();
41
+ totalCost = ops.reduce((sum, op) => sum + op.costUnits, 0);
42
+ }
43
+ const validated = {
44
+ ...proposal,
45
+ operations: ops,
46
+ totalCost,
47
+ };
48
+ console.log(`\x1b[36m→ Validated proposal: ${ops.length} ops, cost=${totalCost}/${config.budgetPerCycle}\x1b[0m`);
49
+ context.proposalJson = JSON.stringify(validated);
50
+ return { ctx: JSON.stringify(context) };
51
+ }
52
+ //# sourceMappingURL=genesis-validate-proposal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genesis-validate-proposal.js","sourceRoot":"","sources":["../../src/node-types/genesis-validate-proposal.ts"],"names":[],"mappings":"AAEA,MAAM,QAAQ,GAA2B;IACvC,OAAO,EAAE,CAAC;IACV,UAAU,EAAE,CAAC;IACb,aAAa,EAAE,CAAC;IAChB,gBAAgB,EAAE,CAAC;IACnB,aAAa,EAAE,CAAC;CACjB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,uBAAuB,CAAC,GAAW;IACjD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAmB,CAAC;IAClD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAkB,CAAC;IACtE,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAa,CAAoB,CAAC;IAEtE,IAAI,GAAG,GAAG,QAAQ,CAAC,UAAU,CAAC;IAE9B,2DAA2D;IAC3D,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QACvB,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;QAC1B,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,CAAC,IAAI,KAAK,eAAe,CAAC,CAAC;QAC7E,IAAI,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;YACxB,OAAO,CAAC,GAAG,CAAC,iCAAiC,MAAM,GAAG,GAAG,CAAC,MAAM,+BAA+B,CAAC,CAAC;QACnG,CAAC;IACH,CAAC;IAED,gDAAgD;IAChD,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACrB,EAAE,CAAC,SAAS,GAAG,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,+BAA+B;IAC/B,IAAI,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IAC/D,OAAO,SAAS,GAAG,MAAM,CAAC,cAAc,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3D,GAAG,CAAC,GAAG,EAAE,CAAC;QACV,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,SAAS,GAAoB;QACjC,GAAG,QAAQ;QACX,UAAU,EAAE,GAAG;QACf,SAAS;KACV,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,iCAAiC,GAAG,CAAC,MAAM,cAAc,SAAS,IAAI,MAAM,CAAC,cAAc,SAAS,CAAC,CAAC;IAElH,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACjD,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;AAC1C,CAAC"}
@@ -5,14 +5,11 @@
5
5
  * @flowWeaver nodeType
6
6
  * @expression
7
7
  * @label Git Operations
8
- * @input projectDir [order:0] - Project root directory
9
- * @input filesModified [order:1] - Files modified (JSON array)
10
- * @input config [order:2] - Config (JSON)
11
- * @output projectDir [order:0] - Project root directory (pass-through)
12
- * @output gitResultJson [order:1] - Git operation result (JSON)
8
+ * @input ctx [order:0] - Weaver context (JSON)
9
+ * @output ctx [order:0] - Weaver context with gitResultJson (JSON)
10
+ * @output onFailure [hidden]
13
11
  */
14
- export declare function weaverGitOps(projectDir: string, filesModified: string, config: string): {
15
- projectDir: string;
16
- gitResultJson: string;
12
+ export declare function weaverGitOps(ctx: string): {
13
+ ctx: string;
17
14
  };
18
15
  //# sourceMappingURL=git-ops.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"git-ops.d.ts","sourceRoot":"","sources":["../../src/node-types/git-ops.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,GACb;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAmD/C"}
1
+ {"version":3,"file":"git-ops.d.ts","sourceRoot":"","sources":["../../src/node-types/git-ops.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAuDzD"}
@@ -1,4 +1,4 @@
1
- import { execFileSync, execSync } from 'node:child_process';
1
+ import { execFileSync } from 'node:child_process';
2
2
  /**
3
3
  * Git operations on created/modified files: stage, commit, branch.
4
4
  * Runs in parallel with notifications after execution.
@@ -6,25 +6,26 @@ import { execFileSync, execSync } from 'node:child_process';
6
6
  * @flowWeaver nodeType
7
7
  * @expression
8
8
  * @label Git Operations
9
- * @input projectDir [order:0] - Project root directory
10
- * @input filesModified [order:1] - Files modified (JSON array)
11
- * @input config [order:2] - Config (JSON)
12
- * @output projectDir [order:0] - Project root directory (pass-through)
13
- * @output gitResultJson [order:1] - Git operation result (JSON)
9
+ * @input ctx [order:0] - Weaver context (JSON)
10
+ * @output ctx [order:0] - Weaver context with gitResultJson (JSON)
11
+ * @output onFailure [hidden]
14
12
  */
15
- export function weaverGitOps(projectDir, filesModified, config) {
16
- const files = JSON.parse(filesModified);
17
- const cfg = JSON.parse(config);
18
- const gitConfig = cfg.git ?? {};
13
+ export function weaverGitOps(ctx) {
14
+ const context = JSON.parse(ctx);
15
+ const { projectDir, config } = context.env;
16
+ const files = context.filesModified ? JSON.parse(context.filesModified) : [];
17
+ const gitConfig = config.git ?? {};
19
18
  if (gitConfig.enabled === false || files.length === 0) {
20
- return { projectDir, gitResultJson: JSON.stringify({ skipped: true, reason: files.length === 0 ? 'no files' : 'git disabled' }) };
19
+ context.gitResultJson = JSON.stringify({ skipped: true, reason: files.length === 0 ? 'no files' : 'git disabled' });
20
+ return { ctx: JSON.stringify(context) };
21
21
  }
22
22
  // Check if we're in a git repo
23
23
  try {
24
- execSync('git rev-parse --is-inside-work-tree', { cwd: projectDir, encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] });
24
+ execFileSync('git', ['rev-parse', '--is-inside-work-tree'], { cwd: projectDir, encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] });
25
25
  }
26
26
  catch {
27
- return { projectDir, gitResultJson: JSON.stringify({ skipped: true, reason: 'not a git repo' }) };
27
+ context.gitResultJson = JSON.stringify({ skipped: true, reason: 'not a git repo' });
28
+ return { ctx: JSON.stringify(context) };
28
29
  }
29
30
  const results = [];
30
31
  // Create branch if specified
@@ -60,6 +61,7 @@ export function weaverGitOps(projectDir, filesModified, config) {
60
61
  catch {
61
62
  results.push('Nothing to commit');
62
63
  }
63
- return { projectDir, gitResultJson: JSON.stringify({ skipped: false, results }) };
64
+ context.gitResultJson = JSON.stringify({ skipped: false, results });
65
+ return { ctx: JSON.stringify(context) };
64
66
  }
65
67
  //# sourceMappingURL=git-ops.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"git-ops.js","sourceRoot":"","sources":["../../src/node-types/git-ops.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,YAAY,CAC1B,UAAkB,EAClB,aAAqB,EACrB,MAAc;IAEd,MAAM,KAAK,GAAa,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAClD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MA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