@synergenius/flow-weaver-pack-weaver 0.8.1
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/LICENSE +204 -0
- package/README.md +167 -0
- package/dist/bot/agent-provider.d.ts +34 -0
- package/dist/bot/agent-provider.d.ts.map +1 -0
- package/dist/bot/agent-provider.js +218 -0
- package/dist/bot/agent-provider.js.map +1 -0
- package/dist/bot/ai-client.d.ts +15 -0
- package/dist/bot/ai-client.d.ts.map +1 -0
- package/dist/bot/ai-client.js +128 -0
- package/dist/bot/ai-client.js.map +1 -0
- package/dist/bot/approvals.d.ts +22 -0
- package/dist/bot/approvals.d.ts.map +1 -0
- package/dist/bot/approvals.js +187 -0
- package/dist/bot/approvals.js.map +1 -0
- package/dist/bot/audit-logger.d.ts +5 -0
- package/dist/bot/audit-logger.d.ts.map +1 -0
- package/dist/bot/audit-logger.js +42 -0
- package/dist/bot/audit-logger.js.map +1 -0
- package/dist/bot/audit-store.d.ts +13 -0
- package/dist/bot/audit-store.d.ts.map +1 -0
- package/dist/bot/audit-store.js +59 -0
- package/dist/bot/audit-store.js.map +1 -0
- package/dist/bot/bot-agent-channel.d.ts +46 -0
- package/dist/bot/bot-agent-channel.d.ts.map +1 -0
- package/dist/bot/bot-agent-channel.js +58 -0
- package/dist/bot/bot-agent-channel.js.map +1 -0
- package/dist/bot/cli-provider.d.ts +29 -0
- package/dist/bot/cli-provider.d.ts.map +1 -0
- package/dist/bot/cli-provider.js +132 -0
- package/dist/bot/cli-provider.js.map +1 -0
- package/dist/bot/cli-stream-parser.d.ts +11 -0
- package/dist/bot/cli-stream-parser.d.ts.map +1 -0
- package/dist/bot/cli-stream-parser.js +53 -0
- package/dist/bot/cli-stream-parser.js.map +1 -0
- package/dist/bot/cost-store.d.ts +18 -0
- package/dist/bot/cost-store.d.ts.map +1 -0
- package/dist/bot/cost-store.js +81 -0
- package/dist/bot/cost-store.js.map +1 -0
- package/dist/bot/cost-tracker.d.ts +18 -0
- package/dist/bot/cost-tracker.d.ts.map +1 -0
- package/dist/bot/cost-tracker.js +60 -0
- package/dist/bot/cost-tracker.js.map +1 -0
- package/dist/bot/cron-parser.d.ts +5 -0
- package/dist/bot/cron-parser.d.ts.map +1 -0
- package/dist/bot/cron-parser.js +141 -0
- package/dist/bot/cron-parser.js.map +1 -0
- package/dist/bot/cron-scheduler.d.ts +12 -0
- package/dist/bot/cron-scheduler.d.ts.map +1 -0
- package/dist/bot/cron-scheduler.js +43 -0
- package/dist/bot/cron-scheduler.js.map +1 -0
- package/dist/bot/dashboard.d.ts +34 -0
- package/dist/bot/dashboard.d.ts.map +1 -0
- package/dist/bot/dashboard.js +602 -0
- package/dist/bot/dashboard.js.map +1 -0
- package/dist/bot/design-checker.d.ts +24 -0
- package/dist/bot/design-checker.d.ts.map +1 -0
- package/dist/bot/design-checker.js +269 -0
- package/dist/bot/design-checker.js.map +1 -0
- package/dist/bot/file-lock.d.ts +7 -0
- package/dist/bot/file-lock.d.ts.map +1 -0
- package/dist/bot/file-lock.js +64 -0
- package/dist/bot/file-lock.js.map +1 -0
- package/dist/bot/file-validator.d.ts +10 -0
- package/dist/bot/file-validator.d.ts.map +1 -0
- package/dist/bot/file-validator.js +27 -0
- package/dist/bot/file-validator.js.map +1 -0
- package/dist/bot/file-watcher.d.ts +24 -0
- package/dist/bot/file-watcher.d.ts.map +1 -0
- package/dist/bot/file-watcher.js +98 -0
- package/dist/bot/file-watcher.js.map +1 -0
- package/dist/bot/fw-api.d.ts +8 -0
- package/dist/bot/fw-api.d.ts.map +1 -0
- package/dist/bot/fw-api.js +12 -0
- package/dist/bot/fw-api.js.map +1 -0
- package/dist/bot/genesis-prompt-context.d.ts +31 -0
- package/dist/bot/genesis-prompt-context.d.ts.map +1 -0
- package/dist/bot/genesis-prompt-context.js +121 -0
- package/dist/bot/genesis-prompt-context.js.map +1 -0
- package/dist/bot/genesis-store.d.ts +28 -0
- package/dist/bot/genesis-store.d.ts.map +1 -0
- package/dist/bot/genesis-store.js +154 -0
- package/dist/bot/genesis-store.js.map +1 -0
- package/dist/bot/index.d.ts +38 -0
- package/dist/bot/index.d.ts.map +1 -0
- package/dist/bot/index.js +37 -0
- package/dist/bot/index.js.map +1 -0
- package/dist/bot/notifications.d.ts +20 -0
- package/dist/bot/notifications.d.ts.map +1 -0
- package/dist/bot/notifications.js +215 -0
- package/dist/bot/notifications.js.map +1 -0
- package/dist/bot/pipeline-runner.d.ts +22 -0
- package/dist/bot/pipeline-runner.d.ts.map +1 -0
- package/dist/bot/pipeline-runner.js +263 -0
- package/dist/bot/pipeline-runner.js.map +1 -0
- package/dist/bot/provider-registry.d.ts +26 -0
- package/dist/bot/provider-registry.d.ts.map +1 -0
- package/dist/bot/provider-registry.js +175 -0
- package/dist/bot/provider-registry.js.map +1 -0
- package/dist/bot/run-store.d.ts +25 -0
- package/dist/bot/run-store.d.ts.map +1 -0
- package/dist/bot/run-store.js +156 -0
- package/dist/bot/run-store.js.map +1 -0
- package/dist/bot/runner.d.ts +13 -0
- package/dist/bot/runner.d.ts.map +1 -0
- package/dist/bot/runner.js +244 -0
- package/dist/bot/runner.js.map +1 -0
- package/dist/bot/session-state.d.ts +19 -0
- package/dist/bot/session-state.d.ts.map +1 -0
- package/dist/bot/session-state.js +65 -0
- package/dist/bot/session-state.js.map +1 -0
- package/dist/bot/steering.d.ts +13 -0
- package/dist/bot/steering.d.ts.map +1 -0
- package/dist/bot/steering.js +40 -0
- package/dist/bot/steering.js.map +1 -0
- package/dist/bot/step-executor.d.ts +10 -0
- package/dist/bot/step-executor.d.ts.map +1 -0
- package/dist/bot/step-executor.js +30 -0
- package/dist/bot/step-executor.js.map +1 -0
- package/dist/bot/system-prompt.d.ts +19 -0
- package/dist/bot/system-prompt.d.ts.map +1 -0
- package/dist/bot/system-prompt.js +222 -0
- package/dist/bot/system-prompt.js.map +1 -0
- package/dist/bot/task-queue.d.ts +26 -0
- package/dist/bot/task-queue.d.ts.map +1 -0
- package/dist/bot/task-queue.js +98 -0
- package/dist/bot/task-queue.js.map +1 -0
- package/dist/bot/types.d.ts +478 -0
- package/dist/bot/types.d.ts.map +1 -0
- package/dist/bot/types.js +2 -0
- package/dist/bot/types.js.map +1 -0
- package/dist/bot/utils.d.ts +2 -0
- package/dist/bot/utils.d.ts.map +1 -0
- package/dist/bot/utils.js +20 -0
- package/dist/bot/utils.js.map +1 -0
- package/dist/bot/watch-daemon.d.ts +19 -0
- package/dist/bot/watch-daemon.d.ts.map +1 -0
- package/dist/bot/watch-daemon.js +178 -0
- package/dist/bot/watch-daemon.js.map +1 -0
- package/dist/bot/web-approval.d.ts +19 -0
- package/dist/bot/web-approval.d.ts.map +1 -0
- package/dist/bot/web-approval.js +207 -0
- package/dist/bot/web-approval.js.map +1 -0
- package/dist/cli-bridge.d.ts +2 -0
- package/dist/cli-bridge.d.ts.map +1 -0
- package/dist/cli-bridge.js +30 -0
- package/dist/cli-bridge.js.map +1 -0
- package/dist/cli-handlers.d.ts +79 -0
- package/dist/cli-handlers.d.ts.map +1 -0
- package/dist/cli-handlers.js +1335 -0
- package/dist/cli-handlers.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +749 -0
- package/dist/cli.js.map +1 -0
- package/dist/docs/docs/weaver-config.md +135 -0
- package/dist/docs/weaver-config.md +141 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-tools.d.ts +13 -0
- package/dist/mcp-tools.d.ts.map +1 -0
- package/dist/mcp-tools.js +197 -0
- package/dist/mcp-tools.js.map +1 -0
- package/dist/node-types/abort-task.d.ts +15 -0
- package/dist/node-types/abort-task.d.ts.map +1 -0
- package/dist/node-types/abort-task.js +28 -0
- package/dist/node-types/abort-task.js.map +1 -0
- package/dist/node-types/approval-gate.d.ts +18 -0
- package/dist/node-types/approval-gate.d.ts.map +1 -0
- package/dist/node-types/approval-gate.js +80 -0
- package/dist/node-types/approval-gate.js.map +1 -0
- package/dist/node-types/bot-report.d.ts +20 -0
- package/dist/node-types/bot-report.d.ts.map +1 -0
- package/dist/node-types/bot-report.js +67 -0
- package/dist/node-types/bot-report.js.map +1 -0
- package/dist/node-types/build-context.d.ts +16 -0
- package/dist/node-types/build-context.d.ts.map +1 -0
- package/dist/node-types/build-context.js +64 -0
- package/dist/node-types/build-context.js.map +1 -0
- package/dist/node-types/detect-provider.d.ts +17 -0
- package/dist/node-types/detect-provider.d.ts.map +1 -0
- package/dist/node-types/detect-provider.js +71 -0
- package/dist/node-types/detect-provider.js.map +1 -0
- package/dist/node-types/exec-validate-retry.d.ts +17 -0
- package/dist/node-types/exec-validate-retry.d.ts.map +1 -0
- package/dist/node-types/exec-validate-retry.js +147 -0
- package/dist/node-types/exec-validate-retry.js.map +1 -0
- package/dist/node-types/execute-plan.d.ts +26 -0
- package/dist/node-types/execute-plan.d.ts.map +1 -0
- package/dist/node-types/execute-plan.js +120 -0
- package/dist/node-types/execute-plan.js.map +1 -0
- package/dist/node-types/execute-target.d.ts +16 -0
- package/dist/node-types/execute-target.d.ts.map +1 -0
- package/dist/node-types/execute-target.js +238 -0
- package/dist/node-types/execute-target.js.map +1 -0
- package/dist/node-types/fix-errors.d.ts +24 -0
- package/dist/node-types/fix-errors.d.ts.map +1 -0
- package/dist/node-types/fix-errors.js +49 -0
- package/dist/node-types/fix-errors.js.map +1 -0
- package/dist/node-types/genesis-apply-retry.d.ts +27 -0
- package/dist/node-types/genesis-apply-retry.d.ts.map +1 -0
- package/dist/node-types/genesis-apply-retry.js +97 -0
- package/dist/node-types/genesis-apply-retry.js.map +1 -0
- package/dist/node-types/genesis-apply.d.ts +29 -0
- package/dist/node-types/genesis-apply.d.ts.map +1 -0
- package/dist/node-types/genesis-apply.js +76 -0
- package/dist/node-types/genesis-apply.js.map +1 -0
- package/dist/node-types/genesis-approve.d.ts +19 -0
- package/dist/node-types/genesis-approve.d.ts.map +1 -0
- package/dist/node-types/genesis-approve.js +59 -0
- package/dist/node-types/genesis-approve.js.map +1 -0
- package/dist/node-types/genesis-check-stabilize.d.ts +16 -0
- package/dist/node-types/genesis-check-stabilize.d.ts.map +1 -0
- package/dist/node-types/genesis-check-stabilize.js +32 -0
- package/dist/node-types/genesis-check-stabilize.js.map +1 -0
- package/dist/node-types/genesis-check-threshold.d.ts +15 -0
- package/dist/node-types/genesis-check-threshold.d.ts.map +1 -0
- package/dist/node-types/genesis-check-threshold.js +29 -0
- package/dist/node-types/genesis-check-threshold.js.map +1 -0
- package/dist/node-types/genesis-commit.d.ts +17 -0
- package/dist/node-types/genesis-commit.d.ts.map +1 -0
- package/dist/node-types/genesis-commit.js +59 -0
- package/dist/node-types/genesis-commit.js.map +1 -0
- package/dist/node-types/genesis-compile-validate.d.ts +26 -0
- package/dist/node-types/genesis-compile-validate.d.ts.map +1 -0
- package/dist/node-types/genesis-compile-validate.js +60 -0
- package/dist/node-types/genesis-compile-validate.js.map +1 -0
- package/dist/node-types/genesis-diff-fingerprint.d.ts +15 -0
- package/dist/node-types/genesis-diff-fingerprint.d.ts.map +1 -0
- package/dist/node-types/genesis-diff-fingerprint.js +59 -0
- package/dist/node-types/genesis-diff-fingerprint.js.map +1 -0
- package/dist/node-types/genesis-diff-workflow.d.ts +15 -0
- package/dist/node-types/genesis-diff-workflow.d.ts.map +1 -0
- package/dist/node-types/genesis-diff-workflow.js +67 -0
- package/dist/node-types/genesis-diff-workflow.js.map +1 -0
- package/dist/node-types/genesis-escrow-grace.d.ts +15 -0
- package/dist/node-types/genesis-escrow-grace.d.ts.map +1 -0
- package/dist/node-types/genesis-escrow-grace.js +52 -0
- package/dist/node-types/genesis-escrow-grace.js.map +1 -0
- package/dist/node-types/genesis-escrow-migrate.d.ts +21 -0
- package/dist/node-types/genesis-escrow-migrate.d.ts.map +1 -0
- package/dist/node-types/genesis-escrow-migrate.js +116 -0
- package/dist/node-types/genesis-escrow-migrate.js.map +1 -0
- package/dist/node-types/genesis-escrow-recover.d.ts +15 -0
- package/dist/node-types/genesis-escrow-recover.d.ts.map +1 -0
- package/dist/node-types/genesis-escrow-recover.js +90 -0
- package/dist/node-types/genesis-escrow-recover.js.map +1 -0
- package/dist/node-types/genesis-escrow-stage.d.ts +17 -0
- package/dist/node-types/genesis-escrow-stage.d.ts.map +1 -0
- package/dist/node-types/genesis-escrow-stage.js +86 -0
- package/dist/node-types/genesis-escrow-stage.js.map +1 -0
- package/dist/node-types/genesis-escrow-validate.d.ts +17 -0
- package/dist/node-types/genesis-escrow-validate.d.ts.map +1 -0
- package/dist/node-types/genesis-escrow-validate.js +110 -0
- package/dist/node-types/genesis-escrow-validate.js.map +1 -0
- package/dist/node-types/genesis-load-config.d.ts +17 -0
- package/dist/node-types/genesis-load-config.d.ts.map +1 -0
- package/dist/node-types/genesis-load-config.js +36 -0
- package/dist/node-types/genesis-load-config.js.map +1 -0
- package/dist/node-types/genesis-observe.d.ts +18 -0
- package/dist/node-types/genesis-observe.d.ts.map +1 -0
- package/dist/node-types/genesis-observe.js +103 -0
- package/dist/node-types/genesis-observe.js.map +1 -0
- package/dist/node-types/genesis-propose.d.ts +17 -0
- package/dist/node-types/genesis-propose.d.ts.map +1 -0
- package/dist/node-types/genesis-propose.js +69 -0
- package/dist/node-types/genesis-propose.js.map +1 -0
- package/dist/node-types/genesis-report.d.ts +20 -0
- package/dist/node-types/genesis-report.d.ts.map +1 -0
- package/dist/node-types/genesis-report.js +87 -0
- package/dist/node-types/genesis-report.js.map +1 -0
- package/dist/node-types/genesis-snapshot.d.ts +15 -0
- package/dist/node-types/genesis-snapshot.d.ts.map +1 -0
- package/dist/node-types/genesis-snapshot.js +26 -0
- package/dist/node-types/genesis-snapshot.js.map +1 -0
- package/dist/node-types/genesis-try-apply.d.ts +18 -0
- package/dist/node-types/genesis-try-apply.d.ts.map +1 -0
- package/dist/node-types/genesis-try-apply.js +142 -0
- package/dist/node-types/genesis-try-apply.js.map +1 -0
- package/dist/node-types/genesis-update-history.d.ts +15 -0
- package/dist/node-types/genesis-update-history.d.ts.map +1 -0
- package/dist/node-types/genesis-update-history.js +70 -0
- package/dist/node-types/genesis-update-history.js.map +1 -0
- package/dist/node-types/genesis-validate-proposal.d.ts +16 -0
- package/dist/node-types/genesis-validate-proposal.d.ts.map +1 -0
- package/dist/node-types/genesis-validate-proposal.js +109 -0
- package/dist/node-types/genesis-validate-proposal.js.map +1 -0
- package/dist/node-types/git-ops.d.ts +15 -0
- package/dist/node-types/git-ops.d.ts.map +1 -0
- package/dist/node-types/git-ops.js +69 -0
- package/dist/node-types/git-ops.js.map +1 -0
- package/dist/node-types/index.d.ts +37 -0
- package/dist/node-types/index.d.ts.map +1 -0
- package/dist/node-types/index.js +37 -0
- package/dist/node-types/index.js.map +1 -0
- package/dist/node-types/load-config.d.ts +17 -0
- package/dist/node-types/load-config.d.ts.map +1 -0
- package/dist/node-types/load-config.js +27 -0
- package/dist/node-types/load-config.js.map +1 -0
- package/dist/node-types/plan-task.d.ts +17 -0
- package/dist/node-types/plan-task.d.ts.map +1 -0
- package/dist/node-types/plan-task.js +55 -0
- package/dist/node-types/plan-task.js.map +1 -0
- package/dist/node-types/read-workflow.d.ts +15 -0
- package/dist/node-types/read-workflow.d.ts.map +1 -0
- package/dist/node-types/read-workflow.js +60 -0
- package/dist/node-types/read-workflow.js.map +1 -0
- package/dist/node-types/receive-task.d.ts +20 -0
- package/dist/node-types/receive-task.d.ts.map +1 -0
- package/dist/node-types/receive-task.js +69 -0
- package/dist/node-types/receive-task.js.map +1 -0
- package/dist/node-types/report.d.ts +14 -0
- package/dist/node-types/report.d.ts.map +1 -0
- package/dist/node-types/report.js +25 -0
- package/dist/node-types/report.js.map +1 -0
- package/dist/node-types/resolve-target.d.ts +16 -0
- package/dist/node-types/resolve-target.d.ts.map +1 -0
- package/dist/node-types/resolve-target.js +67 -0
- package/dist/node-types/resolve-target.js.map +1 -0
- package/dist/node-types/route-task.d.ts +14 -0
- package/dist/node-types/route-task.d.ts.map +1 -0
- package/dist/node-types/route-task.js +22 -0
- package/dist/node-types/route-task.js.map +1 -0
- package/dist/node-types/send-notify.d.ts +14 -0
- package/dist/node-types/send-notify.d.ts.map +1 -0
- package/dist/node-types/send-notify.js +71 -0
- package/dist/node-types/send-notify.js.map +1 -0
- package/dist/node-types/validate-result.d.ts +24 -0
- package/dist/node-types/validate-result.d.ts.map +1 -0
- package/dist/node-types/validate-result.js +38 -0
- package/dist/node-types/validate-result.js.map +1 -0
- package/dist/templates/index.d.ts +5 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +4 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/weaver-bot-template.d.ts +11 -0
- package/dist/templates/weaver-bot-template.d.ts.map +1 -0
- package/dist/templates/weaver-bot-template.js +99 -0
- package/dist/templates/weaver-bot-template.js.map +1 -0
- package/dist/templates/weaver-template.d.ts +11 -0
- package/dist/templates/weaver-template.d.ts.map +1 -0
- package/dist/templates/weaver-template.js +53 -0
- package/dist/templates/weaver-template.js.map +1 -0
- package/dist/workflows/genesis-task.d.ts +62 -0
- package/dist/workflows/genesis-task.d.ts.map +1 -0
- package/dist/workflows/genesis-task.js +64 -0
- package/dist/workflows/genesis-task.js.map +1 -0
- package/dist/workflows/index.d.ts +4 -0
- package/dist/workflows/index.d.ts.map +1 -0
- package/dist/workflows/index.js +4 -0
- package/dist/workflows/index.js.map +1 -0
- package/dist/workflows/weaver-bot-batch.d.ts +49 -0
- package/dist/workflows/weaver-bot-batch.d.ts.map +1 -0
- package/dist/workflows/weaver-bot-batch.js +49 -0
- package/dist/workflows/weaver-bot-batch.js.map +1 -0
- package/dist/workflows/weaver-bot-session.d.ts +65 -0
- package/dist/workflows/weaver-bot-session.d.ts.map +1 -0
- package/dist/workflows/weaver-bot-session.js +68 -0
- package/dist/workflows/weaver-bot-session.js.map +1 -0
- package/dist/workflows/weaver-bot.d.ts +61 -0
- package/dist/workflows/weaver-bot.d.ts.map +1 -0
- package/dist/workflows/weaver-bot.js +61 -0
- package/dist/workflows/weaver-bot.js.map +1 -0
- package/dist/workflows/weaver.d.ts +24 -0
- package/dist/workflows/weaver.d.ts.map +1 -0
- package/dist/workflows/weaver.js +28 -0
- package/dist/workflows/weaver.js.map +1 -0
- package/flowweaver.manifest.json +1001 -0
- package/package.json +78 -0
- package/src/bot/agent-provider.ts +273 -0
- package/src/bot/ai-client.ts +153 -0
- package/src/bot/approvals.ts +273 -0
- package/src/bot/audit-logger.ts +45 -0
- package/src/bot/audit-store.ts +69 -0
- package/src/bot/bot-agent-channel.ts +99 -0
- package/src/bot/cli-provider.ts +169 -0
- package/src/bot/cli-stream-parser.ts +59 -0
- package/src/bot/cost-store.ts +92 -0
- package/src/bot/cost-tracker.ts +72 -0
- package/src/bot/cron-parser.ts +153 -0
- package/src/bot/cron-scheduler.ts +48 -0
- package/src/bot/dashboard.ts +658 -0
- package/src/bot/design-checker.ts +327 -0
- package/src/bot/file-lock.ts +73 -0
- package/src/bot/file-validator.ts +41 -0
- package/src/bot/file-watcher.ts +103 -0
- package/src/bot/fw-api.ts +18 -0
- package/src/bot/genesis-prompt-context.ts +135 -0
- package/src/bot/genesis-store.ts +180 -0
- package/src/bot/index.ts +127 -0
- package/src/bot/notifications.ts +263 -0
- package/src/bot/pipeline-runner.ts +324 -0
- package/src/bot/provider-registry.ts +236 -0
- package/src/bot/run-store.ts +169 -0
- package/src/bot/runner.ts +311 -0
- package/src/bot/session-state.ts +73 -0
- package/src/bot/steering.ts +44 -0
- package/src/bot/step-executor.ts +34 -0
- package/src/bot/system-prompt.ts +280 -0
- package/src/bot/task-queue.ts +111 -0
- package/src/bot/types.ts +571 -0
- package/src/bot/utils.ts +17 -0
- package/src/bot/watch-daemon.ts +203 -0
- package/src/bot/web-approval.ts +240 -0
- package/src/cli-bridge.ts +41 -0
- package/src/cli-handlers.ts +1445 -0
- package/src/docs/weaver-config.md +135 -0
- package/src/index.ts +177 -0
- package/src/mcp-tools.ts +274 -0
- package/src/node-types/abort-task.ts +31 -0
- package/src/node-types/approval-gate.ts +95 -0
- package/src/node-types/bot-report.ts +82 -0
- package/src/node-types/build-context.ts +65 -0
- package/src/node-types/detect-provider.ts +77 -0
- package/src/node-types/exec-validate-retry.ts +170 -0
- package/src/node-types/execute-plan.ts +130 -0
- package/src/node-types/execute-target.ts +256 -0
- package/src/node-types/fix-errors.ts +63 -0
- package/src/node-types/genesis-apply-retry.ts +133 -0
- package/src/node-types/genesis-apply.ts +96 -0
- package/src/node-types/genesis-approve.ts +73 -0
- package/src/node-types/genesis-check-stabilize.ts +37 -0
- package/src/node-types/genesis-check-threshold.ts +34 -0
- package/src/node-types/genesis-commit.ts +71 -0
- package/src/node-types/genesis-compile-validate.ts +77 -0
- package/src/node-types/genesis-diff-fingerprint.ts +67 -0
- package/src/node-types/genesis-diff-workflow.ts +71 -0
- package/src/node-types/genesis-escrow-grace.ts +62 -0
- package/src/node-types/genesis-escrow-migrate.ts +138 -0
- package/src/node-types/genesis-escrow-recover.ts +99 -0
- package/src/node-types/genesis-escrow-stage.ts +104 -0
- package/src/node-types/genesis-escrow-validate.ts +120 -0
- package/src/node-types/genesis-load-config.ts +44 -0
- package/src/node-types/genesis-observe.ts +119 -0
- package/src/node-types/genesis-propose.ts +86 -0
- package/src/node-types/genesis-report.ts +95 -0
- package/src/node-types/genesis-snapshot.ts +30 -0
- package/src/node-types/genesis-try-apply.ts +165 -0
- package/src/node-types/genesis-update-history.ts +72 -0
- package/src/node-types/genesis-validate-proposal.ts +124 -0
- package/src/node-types/git-ops.ts +72 -0
- package/src/node-types/index.ts +36 -0
- package/src/node-types/load-config.ts +27 -0
- package/src/node-types/plan-task.ts +66 -0
- package/src/node-types/read-workflow.ts +68 -0
- package/src/node-types/receive-task.ts +92 -0
- package/src/node-types/report.ts +25 -0
- package/src/node-types/resolve-target.ts +64 -0
- package/src/node-types/route-task.ts +25 -0
- package/src/node-types/send-notify.ts +75 -0
- package/src/node-types/validate-result.ts +49 -0
- package/src/templates/index.ts +5 -0
- package/src/templates/weaver-bot-template.ts +106 -0
- package/src/workflows/genesis-task.ts +91 -0
- package/src/workflows/index.ts +3 -0
- package/src/workflows/weaver-bot-batch.ts +65 -0
- package/src/workflows/weaver-bot.ts +79 -0
- package/templates.js +1 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared prompt helpers for genesis propose and revise steps.
|
|
3
|
+
* Centralises context building so the AI always gets the CLI grammar,
|
|
4
|
+
* operation syntax, and workflow structure it needs to produce valid proposals.
|
|
5
|
+
*/
|
|
6
|
+
import { buildSystemPrompt } from './system-prompt.js';
|
|
7
|
+
let cachedOpsContext = null;
|
|
8
|
+
/**
|
|
9
|
+
* Full system prompt with annotation grammar, CLI commands, validation codes,
|
|
10
|
+
* and genesis protocol. Cached after first call.
|
|
11
|
+
*/
|
|
12
|
+
export async function getGenesisSystemPrompt(config, stabilized, options) {
|
|
13
|
+
const base = await buildSystemPrompt();
|
|
14
|
+
const stabilizeClause = stabilized
|
|
15
|
+
? '\n\nSTABILIZE MODE: Only removeNode, removeConnection, and implementNode operations are allowed. Do NOT propose addNode or addConnection.'
|
|
16
|
+
: '';
|
|
17
|
+
const selfEvolveClause = config.selfEvolve
|
|
18
|
+
? [
|
|
19
|
+
'',
|
|
20
|
+
'## Self-Evolution',
|
|
21
|
+
`Self-evolution is ENABLED with a budget of ${config.selfEvolveBudget ?? 2} cost units.`,
|
|
22
|
+
'Cost map: selfModifyWorkflow=3, selfModifyNodeType=2, selfModifyModule=2.',
|
|
23
|
+
'Self-modify operations use { file: "relative/path.ts", content: "full file content" } in args.',
|
|
24
|
+
'The file path is relative to the pack root (e.g. "src/workflows/genesis-task.ts").',
|
|
25
|
+
'Content must be the complete replacement file, not a diff.',
|
|
26
|
+
].join('\n')
|
|
27
|
+
: '';
|
|
28
|
+
const lockClause = options?.selfEvolveLocked
|
|
29
|
+
? `\n\nSELF-EVOLUTION LOCKED: A migration is in grace period (${options.graceRemaining} cycles remaining). Do not propose selfModify operations.`
|
|
30
|
+
: '';
|
|
31
|
+
return [
|
|
32
|
+
base,
|
|
33
|
+
'',
|
|
34
|
+
'## Genesis Cycle Config',
|
|
35
|
+
`Intent: ${config.intent}`,
|
|
36
|
+
config.focus.length > 0 ? `Focus areas: ${config.focus.join(', ')}` : '',
|
|
37
|
+
config.constraints.length > 0 ? `Constraints: ${config.constraints.join(', ')}` : '',
|
|
38
|
+
`Budget: ${config.budgetPerCycle} cost units per cycle.`,
|
|
39
|
+
'Cost map: addNode=1, removeNode=1, addConnection=1, removeConnection=1, implementNode=2.',
|
|
40
|
+
stabilizeClause,
|
|
41
|
+
selfEvolveClause,
|
|
42
|
+
lockClause,
|
|
43
|
+
].filter(Boolean).join('\n');
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Operation format reference with concrete examples.
|
|
47
|
+
* Appended to both propose and revise prompts so the AI knows
|
|
48
|
+
* the exact CLI arg format.
|
|
49
|
+
*/
|
|
50
|
+
export function getOperationExamples(targetPath) {
|
|
51
|
+
return `## Operation Format
|
|
52
|
+
|
|
53
|
+
Each operation is { type, args, costUnits, rationale }.
|
|
54
|
+
|
|
55
|
+
### addNode
|
|
56
|
+
args: { "nodeId": "myNode", "nodeType": "someFunction", "file": "${targetPath}" }
|
|
57
|
+
|
|
58
|
+
### removeNode
|
|
59
|
+
args: { "nodeId": "myNode", "file": "${targetPath}" }
|
|
60
|
+
|
|
61
|
+
### addConnection
|
|
62
|
+
args: { "from": "sourceNode.portName", "to": "targetNode.portName", "file": "${targetPath}" }
|
|
63
|
+
IMPORTANT: Connection format is "node.port" using a DOT separator. NOT "node:port", NOT "node:portName".
|
|
64
|
+
|
|
65
|
+
### removeConnection
|
|
66
|
+
args: { "from": "sourceNode.portName", "to": "targetNode.portName", "file": "${targetPath}" }
|
|
67
|
+
|
|
68
|
+
### implementNode
|
|
69
|
+
args: { "nodeId": "existingStubNodeId", "file": "${targetPath}" }
|
|
70
|
+
Only works on nodes declared with \`declare function\` (stubs). The nodeId must match an existing stub in the workflow.
|
|
71
|
+
|
|
72
|
+
### selfModifyWorkflow (cost: 3)
|
|
73
|
+
args: { "file": "src/workflows/genesis-task.ts", "content": "// full file content..." }
|
|
74
|
+
Replaces the genesis workflow file. File path is relative to pack root.
|
|
75
|
+
|
|
76
|
+
### selfModifyNodeType (cost: 2)
|
|
77
|
+
args: { "file": "src/node-types/genesis-propose.ts", "content": "// full file content..." }
|
|
78
|
+
Replaces a genesis node type implementation.
|
|
79
|
+
|
|
80
|
+
### selfModifyModule (cost: 2)
|
|
81
|
+
args: { "file": "src/bot/genesis-prompt-context.ts", "content": "// full file content..." }
|
|
82
|
+
Replaces a bot module file.
|
|
83
|
+
|
|
84
|
+
## Response Format
|
|
85
|
+
Return ONLY valid JSON with: { operations: [...], totalCost: number, impactLevel: "COSMETIC"|"MINOR"|"BREAKING"|"CRITICAL", summary: string, rationale: string }
|
|
86
|
+
No markdown, no code fences, no explanation outside the JSON.`;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Ops context from flow-weaver docs (CLI reference, error codes, etc.).
|
|
90
|
+
* Falls back gracefully if the context module is unavailable.
|
|
91
|
+
*/
|
|
92
|
+
export async function getOpsContext() {
|
|
93
|
+
if (cachedOpsContext)
|
|
94
|
+
return cachedOpsContext;
|
|
95
|
+
try {
|
|
96
|
+
const { buildContext } = await import('@synergenius/flow-weaver/context');
|
|
97
|
+
const result = buildContext({ preset: 'ops', includeGrammar: false });
|
|
98
|
+
cachedOpsContext = result.content;
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
cachedOpsContext = '(ops context unavailable)';
|
|
102
|
+
}
|
|
103
|
+
return cachedOpsContext;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Gets a text description of the workflow using the describe module.
|
|
107
|
+
* Falls back to reading the raw file if describe isn't available.
|
|
108
|
+
*/
|
|
109
|
+
export async function getWorkflowDescription(filePath) {
|
|
110
|
+
try {
|
|
111
|
+
const { parseWorkflow } = await import('@synergenius/flow-weaver/api');
|
|
112
|
+
const { describeWorkflow, formatTextOutput } = await import('@synergenius/flow-weaver/describe');
|
|
113
|
+
const result = await parseWorkflow(filePath);
|
|
114
|
+
const output = describeWorkflow(result.ast);
|
|
115
|
+
return formatTextOutput(result.ast, output);
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
return '(workflow description unavailable)';
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=genesis-prompt-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genesis-prompt-context.js","sourceRoot":"","sources":["../../src/bot/genesis-prompt-context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD,IAAI,gBAAgB,GAAkB,IAAI,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,MAAqB,EACrB,UAAmB,EACnB,OAAiE;IAEjE,MAAM,IAAI,GAAG,MAAM,iBAAiB,EAAE,CAAC;IAEvC,MAAM,eAAe,GAAG,UAAU;QAChC,CAAC,CAAC,2IAA2I;QAC7I,CAAC,CAAC,EAAE,CAAC;IAEP,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU;QACxC,CAAC,CAAC;YACE,EAAE;YACF,mBAAmB;YACnB,8CAA8C,MAAM,CAAC,gBAAgB,IAAI,CAAC,cAAc;YACxF,2EAA2E;YAC3E,gGAAgG;YAChG,oFAAoF;YACpF,4DAA4D;SAC7D,CAAC,IAAI,CAAC,IAAI,CAAC;QACd,CAAC,CAAC,EAAE,CAAC;IAEP,MAAM,UAAU,GAAG,OAAO,EAAE,gBAAgB;QAC1C,CAAC,CAAC,8DAA8D,OAAO,CAAC,cAAc,2DAA2D;QACjJ,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO;QACL,IAAI;QACJ,EAAE;QACF,yBAAyB;QAC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3D,IAAI,CAAC;QACH,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,8BAA8B,CAAC,CAAC;QACvE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,mCAAmC,CAAC,CAAC;QAEjG,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC7C,MAAM,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC5C,OAAO,gBAAgB,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,oCAAoC,CAAC;IAC9C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { GenesisConfig, GenesisHistory, GenesisCycleRecord, GenesisFingerprint, EscrowToken, GenesisSelfMigrationRecord } from './types.js';
|
|
2
|
+
export declare class GenesisStore {
|
|
3
|
+
private genesisDir;
|
|
4
|
+
constructor(projectDir: string);
|
|
5
|
+
ensureDirs(): void;
|
|
6
|
+
loadConfig(): GenesisConfig;
|
|
7
|
+
saveConfig(config: GenesisConfig): void;
|
|
8
|
+
loadHistory(): GenesisHistory;
|
|
9
|
+
appendCycle(cycle: GenesisCycleRecord): void;
|
|
10
|
+
saveSnapshot(cycleId: string, content: string): string;
|
|
11
|
+
loadSnapshot(snapshotPath: string): string | null;
|
|
12
|
+
saveFingerprint(fingerprint: GenesisFingerprint): void;
|
|
13
|
+
getLastFingerprint(): GenesisFingerprint | null;
|
|
14
|
+
getRecentOutcomes(count: number): string[];
|
|
15
|
+
static newCycleId(): string;
|
|
16
|
+
static hashConfig(config: GenesisConfig): string;
|
|
17
|
+
ensureEscrowDirs(): void;
|
|
18
|
+
loadEscrowToken(): EscrowToken | null;
|
|
19
|
+
saveEscrowToken(token: EscrowToken): void;
|
|
20
|
+
clearEscrow(): void;
|
|
21
|
+
getEscrowStagedPath(relativePath: string): string;
|
|
22
|
+
getEscrowBackupPath(relativePath: string): string;
|
|
23
|
+
loadSelfHistory(): GenesisSelfMigrationRecord[];
|
|
24
|
+
appendSelfMigration(record: GenesisSelfMigrationRecord): void;
|
|
25
|
+
getSelfFailureCount(): number;
|
|
26
|
+
static hashFile(filePath: string): string;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=genesis-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genesis-store.d.ts","sourceRoot":"","sources":["../../src/bot/genesis-store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,WAAW,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAajJ,qBAAa,YAAY;IACvB,OAAO,CAAC,UAAU,CAAS;gBAEf,UAAU,EAAE,MAAM;IAI9B,UAAU,IAAI,IAAI;IAIlB,UAAU,IAAI,aAAa;IAW3B,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IAKvC,WAAW,IAAI,cAAc;IAQ7B,WAAW,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI;IAO5C,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IAOtD,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAQjD,eAAe,CAAC,WAAW,EAAE,kBAAkB,GAAG,IAAI;IAKtD,kBAAkB,IAAI,kBAAkB,GAAG,IAAI;IAU/C,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IAK1C,MAAM,CAAC,UAAU,IAAI,MAAM;IAI3B,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM;IAMhD,gBAAgB,IAAI,IAAI;IAKxB,eAAe,IAAI,WAAW,GAAG,IAAI;IAUrC,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IASzC,WAAW,IAAI,IAAI;IAOnB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAIjD,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAMjD,eAAe,IAAI,0BAA0B,EAAE;IAU/C,mBAAmB,CAAC,MAAM,EAAE,0BAA0B,GAAG,IAAI;IAW7D,mBAAmB,IAAI,MAAM;IAU7B,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;CAI1C"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import * as crypto from 'node:crypto';
|
|
4
|
+
const DEFAULT_CONFIG = {
|
|
5
|
+
intent: 'Improve workflow reliability and efficiency',
|
|
6
|
+
focus: [],
|
|
7
|
+
constraints: [],
|
|
8
|
+
approvalThreshold: 'MINOR',
|
|
9
|
+
budgetPerCycle: 3,
|
|
10
|
+
stabilize: false,
|
|
11
|
+
targetWorkflow: '',
|
|
12
|
+
maxCyclesPerRun: 10,
|
|
13
|
+
};
|
|
14
|
+
export class GenesisStore {
|
|
15
|
+
genesisDir;
|
|
16
|
+
constructor(projectDir) {
|
|
17
|
+
this.genesisDir = path.join(projectDir, '.genesis');
|
|
18
|
+
}
|
|
19
|
+
ensureDirs() {
|
|
20
|
+
fs.mkdirSync(path.join(this.genesisDir, 'snapshots'), { recursive: true });
|
|
21
|
+
}
|
|
22
|
+
loadConfig() {
|
|
23
|
+
const configPath = path.join(this.genesisDir, 'config.json');
|
|
24
|
+
if (!fs.existsSync(configPath)) {
|
|
25
|
+
this.ensureDirs();
|
|
26
|
+
fs.writeFileSync(configPath, JSON.stringify(DEFAULT_CONFIG, null, 2), 'utf-8');
|
|
27
|
+
return { ...DEFAULT_CONFIG };
|
|
28
|
+
}
|
|
29
|
+
const raw = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
30
|
+
return { ...DEFAULT_CONFIG, ...raw };
|
|
31
|
+
}
|
|
32
|
+
saveConfig(config) {
|
|
33
|
+
this.ensureDirs();
|
|
34
|
+
fs.writeFileSync(path.join(this.genesisDir, 'config.json'), JSON.stringify(config, null, 2), 'utf-8');
|
|
35
|
+
}
|
|
36
|
+
loadHistory() {
|
|
37
|
+
const historyPath = path.join(this.genesisDir, 'history.json');
|
|
38
|
+
if (!fs.existsSync(historyPath)) {
|
|
39
|
+
return { configHash: '', cycles: [] };
|
|
40
|
+
}
|
|
41
|
+
return JSON.parse(fs.readFileSync(historyPath, 'utf-8'));
|
|
42
|
+
}
|
|
43
|
+
appendCycle(cycle) {
|
|
44
|
+
const history = this.loadHistory();
|
|
45
|
+
history.cycles.push(cycle);
|
|
46
|
+
this.ensureDirs();
|
|
47
|
+
fs.writeFileSync(path.join(this.genesisDir, 'history.json'), JSON.stringify(history, null, 2), 'utf-8');
|
|
48
|
+
}
|
|
49
|
+
saveSnapshot(cycleId, content) {
|
|
50
|
+
this.ensureDirs();
|
|
51
|
+
const snapshotPath = path.join(this.genesisDir, 'snapshots', `${cycleId}.ts`);
|
|
52
|
+
fs.writeFileSync(snapshotPath, content, 'utf-8');
|
|
53
|
+
return snapshotPath;
|
|
54
|
+
}
|
|
55
|
+
loadSnapshot(snapshotPath) {
|
|
56
|
+
try {
|
|
57
|
+
return fs.readFileSync(snapshotPath, 'utf-8');
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
saveFingerprint(fingerprint) {
|
|
64
|
+
this.ensureDirs();
|
|
65
|
+
fs.writeFileSync(path.join(this.genesisDir, 'fingerprint.json'), JSON.stringify(fingerprint, null, 2), 'utf-8');
|
|
66
|
+
}
|
|
67
|
+
getLastFingerprint() {
|
|
68
|
+
const fpPath = path.join(this.genesisDir, 'fingerprint.json');
|
|
69
|
+
if (!fs.existsSync(fpPath))
|
|
70
|
+
return null;
|
|
71
|
+
try {
|
|
72
|
+
return JSON.parse(fs.readFileSync(fpPath, 'utf-8'));
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
getRecentOutcomes(count) {
|
|
79
|
+
const history = this.loadHistory();
|
|
80
|
+
return history.cycles.slice(-count).map(c => c.outcome);
|
|
81
|
+
}
|
|
82
|
+
static newCycleId() {
|
|
83
|
+
return crypto.randomUUID().slice(0, 8);
|
|
84
|
+
}
|
|
85
|
+
static hashConfig(config) {
|
|
86
|
+
return crypto.createHash('sha256').update(JSON.stringify(config)).digest('hex').slice(0, 12);
|
|
87
|
+
}
|
|
88
|
+
// --- Escrow ---
|
|
89
|
+
ensureEscrowDirs() {
|
|
90
|
+
fs.mkdirSync(path.join(this.genesisDir, 'escrow', 'staged'), { recursive: true });
|
|
91
|
+
fs.mkdirSync(path.join(this.genesisDir, 'escrow', 'backup'), { recursive: true });
|
|
92
|
+
}
|
|
93
|
+
loadEscrowToken() {
|
|
94
|
+
const tokenPath = path.join(this.genesisDir, 'escrow', 'token.json');
|
|
95
|
+
if (!fs.existsSync(tokenPath))
|
|
96
|
+
return null;
|
|
97
|
+
try {
|
|
98
|
+
return JSON.parse(fs.readFileSync(tokenPath, 'utf-8'));
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
saveEscrowToken(token) {
|
|
105
|
+
this.ensureEscrowDirs();
|
|
106
|
+
fs.writeFileSync(path.join(this.genesisDir, 'escrow', 'token.json'), JSON.stringify(token, null, 2), 'utf-8');
|
|
107
|
+
}
|
|
108
|
+
clearEscrow() {
|
|
109
|
+
const escrowDir = path.join(this.genesisDir, 'escrow');
|
|
110
|
+
if (fs.existsSync(escrowDir)) {
|
|
111
|
+
fs.rmSync(escrowDir, { recursive: true, force: true });
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
getEscrowStagedPath(relativePath) {
|
|
115
|
+
return path.join(this.genesisDir, 'escrow', 'staged', relativePath);
|
|
116
|
+
}
|
|
117
|
+
getEscrowBackupPath(relativePath) {
|
|
118
|
+
return path.join(this.genesisDir, 'escrow', 'backup', relativePath);
|
|
119
|
+
}
|
|
120
|
+
// --- Self-evolution history ---
|
|
121
|
+
loadSelfHistory() {
|
|
122
|
+
const histPath = path.join(this.genesisDir, 'self-history.json');
|
|
123
|
+
if (!fs.existsSync(histPath))
|
|
124
|
+
return [];
|
|
125
|
+
try {
|
|
126
|
+
return JSON.parse(fs.readFileSync(histPath, 'utf-8'));
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
return [];
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
appendSelfMigration(record) {
|
|
133
|
+
const records = this.loadSelfHistory();
|
|
134
|
+
records.push(record);
|
|
135
|
+
this.ensureDirs();
|
|
136
|
+
fs.writeFileSync(path.join(this.genesisDir, 'self-history.json'), JSON.stringify(records, null, 2), 'utf-8');
|
|
137
|
+
}
|
|
138
|
+
getSelfFailureCount() {
|
|
139
|
+
const records = this.loadSelfHistory();
|
|
140
|
+
let count = 0;
|
|
141
|
+
for (let i = records.length - 1; i >= 0; i--) {
|
|
142
|
+
if (records[i].outcome === 'rolled-back')
|
|
143
|
+
count++;
|
|
144
|
+
else
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
return count;
|
|
148
|
+
}
|
|
149
|
+
static hashFile(filePath) {
|
|
150
|
+
const content = fs.readFileSync(filePath);
|
|
151
|
+
return crypto.createHash('sha256').update(content).digest('hex');
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=genesis-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genesis-store.js","sourceRoot":"","sources":["../../src/bot/genesis-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,C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,CAAC;IAED,mBAAmB;QACjB,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACvC,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7C,IAAI,OAAO,CAAC,CAAC,CAAE,CAAC,OAAO,KAAK,aAAa;gBAAE,KAAK,EAAE,CAAC;;gBAC9C,MAAM;QACb,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,QAAgB;QAC9B,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC1C,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACnE,CAAC;CACF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export type { BotConfig, BotProviderConfig, BotApprovalConfig, BotNotifyConfig, NotificationEvent, NotificationEventType, ExecutionEvent, ExecutionEventType, ApprovalMode, WeaverConfig, WeaverEnv, ProviderInfo, WorkflowResult, ProviderName, RunRecord, RunFilter, RetentionPolicy, RunOutcome, TokenUsage, OnUsageCallback, RunCostEntry, RunCostSummary, CostRecord, CostSummary, BotAgentProvider, ProviderMetadata, ProviderFactory, ProviderFactoryConfig, ProviderModule, CronExpression, ParsedCron, CronField, TriggerSource, WatchDaemonOptions, WatchDaemonState, StageCondition, StageStatus, PipelineStage, PipelineConfig, StageResult, PipelineResult, DashboardEventType, DashboardNodeStatus, DashboardEvent, DashboardNodeState, DashboardServerOptions, BotTask, BotPlan, BotPlanStep, BotValidationResult, BotExecutionResult, BotNotificationEventType, ToolDefinition, ToolUseResult, StreamChunk, GenesisImpactLevel, GenesisOperationType, GenesisConfig, GenesisOperation, GenesisProposal, GenesisFingerprint, GenesisCycleRecord, GenesisHistory, } from './types.js';
|
|
2
|
+
export { AnthropicAgentProvider, resolveProviderConfig, createProvider, detectProvider, } from './agent-provider.js';
|
|
3
|
+
export { CliAgentProvider } from './cli-provider.js';
|
|
4
|
+
export { ProviderRegistry, defaultRegistry, loadExternalProvider, discoverProviders } from './provider-registry.js';
|
|
5
|
+
export { BotAgentChannel } from './bot-agent-channel.js';
|
|
6
|
+
export type { BotChannelContext } from './bot-agent-channel.js';
|
|
7
|
+
export { WebhookNotificationChannel, createNotifier, } from './notifications.js';
|
|
8
|
+
export type { NotificationChannel, NotificationErrorHandler } from './notifications.js';
|
|
9
|
+
export { buildSystemPrompt } from './system-prompt.js';
|
|
10
|
+
export { runWorkflow } from './runner.js';
|
|
11
|
+
export { createApprovalHandler } from './approvals.js';
|
|
12
|
+
export type { ApprovalHandler, ApprovalResult } from './approvals.js';
|
|
13
|
+
export { RunStore } from './run-store.js';
|
|
14
|
+
export { CostTracker, MODEL_PRICING } from './cost-tracker.js';
|
|
15
|
+
export { CostStore } from './cost-store.js';
|
|
16
|
+
export { parseCron, matches as cronMatches, nextMatch as cronNextMatch } from './cron-parser.js';
|
|
17
|
+
export { FileWatcher } from './file-watcher.js';
|
|
18
|
+
export { CronScheduler } from './cron-scheduler.js';
|
|
19
|
+
export { WatchDaemon } from './watch-daemon.js';
|
|
20
|
+
export { PipelineRunner } from './pipeline-runner.js';
|
|
21
|
+
export type { PipelineRunOptions } from './pipeline-runner.js';
|
|
22
|
+
export { DashboardServer } from './dashboard.js';
|
|
23
|
+
export { openBrowser } from './utils.js';
|
|
24
|
+
export { WebApprovalHandler } from './web-approval.js';
|
|
25
|
+
export { GenesisStore } from './genesis-store.js';
|
|
26
|
+
export { withFileLock } from './file-lock.js';
|
|
27
|
+
export type { FileLockOptions } from './file-lock.js';
|
|
28
|
+
export { callCli, callApi, parseJsonResponse } from './ai-client.js';
|
|
29
|
+
export { executeStep } from './step-executor.js';
|
|
30
|
+
export { validateFiles } from './file-validator.js';
|
|
31
|
+
export { SteeringController } from './steering.js';
|
|
32
|
+
export type { SteeringCommand } from './steering.js';
|
|
33
|
+
export { TaskQueue } from './task-queue.js';
|
|
34
|
+
export type { QueuedTask } from './task-queue.js';
|
|
35
|
+
export { SessionStore } from './session-state.js';
|
|
36
|
+
export type { SessionState } from './session-state.js';
|
|
37
|
+
export { buildBotSystemPrompt } from './system-prompt.js';
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bot/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,SAAS,EACT,SAAS,EACT,eAAe,EACf,UAAU,EACV,UAAU,EACV,eAAe,EACf,YAAY,EACZ,cAAc,EACd,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,UAAU,EACV,SAAS,EACT,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,aAAa,EACb,cAAc,EACd,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,OAAO,EACP,OAAO,EACP,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,EACxB,cAAc,EACd,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,sBAAsB,EACtB,qBAA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jD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export { AnthropicAgentProvider, resolveProviderConfig, createProvider, detectProvider, } from './agent-provider.js';
|
|
2
|
+
export { CliAgentProvider } from './cli-provider.js';
|
|
3
|
+
export { ProviderRegistry, defaultRegistry, loadExternalProvider, discoverProviders } from './provider-registry.js';
|
|
4
|
+
export { BotAgentChannel } from './bot-agent-channel.js';
|
|
5
|
+
export { WebhookNotificationChannel, createNotifier, } from './notifications.js';
|
|
6
|
+
export { buildSystemPrompt } from './system-prompt.js';
|
|
7
|
+
export { runWorkflow } from './runner.js';
|
|
8
|
+
export { createApprovalHandler } from './approvals.js';
|
|
9
|
+
export { RunStore } from './run-store.js';
|
|
10
|
+
export { CostTracker, MODEL_PRICING } from './cost-tracker.js';
|
|
11
|
+
export { CostStore } from './cost-store.js';
|
|
12
|
+
// Watch/Cron (F4)
|
|
13
|
+
export { parseCron, matches as cronMatches, nextMatch as cronNextMatch } from './cron-parser.js';
|
|
14
|
+
export { FileWatcher } from './file-watcher.js';
|
|
15
|
+
export { CronScheduler } from './cron-scheduler.js';
|
|
16
|
+
export { WatchDaemon } from './watch-daemon.js';
|
|
17
|
+
// Pipelines (F1)
|
|
18
|
+
export { PipelineRunner } from './pipeline-runner.js';
|
|
19
|
+
// Dashboard (F3)
|
|
20
|
+
export { DashboardServer } from './dashboard.js';
|
|
21
|
+
export { openBrowser } from './utils.js';
|
|
22
|
+
// Web Approval (F6)
|
|
23
|
+
export { WebApprovalHandler } from './web-approval.js';
|
|
24
|
+
// Genesis
|
|
25
|
+
export { GenesisStore } from './genesis-store.js';
|
|
26
|
+
// File locking
|
|
27
|
+
export { withFileLock } from './file-lock.js';
|
|
28
|
+
// Shared modules
|
|
29
|
+
export { callCli, callApi, parseJsonResponse } from './ai-client.js';
|
|
30
|
+
export { executeStep } from './step-executor.js';
|
|
31
|
+
export { validateFiles } from './file-validator.js';
|
|
32
|
+
// Bot infrastructure
|
|
33
|
+
export { SteeringController } from './steering.js';
|
|
34
|
+
export { TaskQueue } from './task-queue.js';
|
|
35
|
+
export { SessionStore } from './session-state.js';
|
|
36
|
+
export { buildBotSystemPrompt } from './system-prompt.js';
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bot/index.ts"],"names":[],"mappings":"AAkEA,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,oBAAoB,EAAE,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AAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,qBAAqB;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { BotNotifyConfig, NotificationEvent, NotificationEventType } from './types.js';
|
|
2
|
+
export interface NotificationChannel {
|
|
3
|
+
name: string;
|
|
4
|
+
shouldSend(eventType: NotificationEventType): boolean;
|
|
5
|
+
send(event: NotificationEvent): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export type NotificationErrorHandler = (channel: string, event: NotificationEvent, error: string) => void;
|
|
8
|
+
export declare class WebhookNotificationChannel implements NotificationChannel {
|
|
9
|
+
name: string;
|
|
10
|
+
private url;
|
|
11
|
+
private channelType;
|
|
12
|
+
private events;
|
|
13
|
+
private headers;
|
|
14
|
+
private onError?;
|
|
15
|
+
constructor(config: BotNotifyConfig, onError?: NotificationErrorHandler);
|
|
16
|
+
shouldSend(eventType: NotificationEventType): boolean;
|
|
17
|
+
send(event: NotificationEvent): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export declare function createNotifier(channels: NotificationChannel[]): (event: NotificationEvent) => Promise<void>;
|
|
20
|
+
//# sourceMappingURL=notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../src/bot/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,SAAS,EAAE,qBAAqB,GAAG,OAAO,CAAC;IACtD,IAAI,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/C;AAED,MAAM,MAAM,wBAAwB,GAAG,CACrC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE,MAAM,KACV,IAAI,CAAC;AAmLV,qBAAa,0BAA2B,YAAW,mBAAmB;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,WAAW,CAAkC;IACrD,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,OAAO,CAAyB;IACxC,OAAO,CAAC,OAAO,CAAC,CAA2B;gBAE/B,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,wBAAwB;IAgBvE,UAAU,CAAC,SAAS,EAAE,qBAAqB,GAAG,OAAO;IAI/C,IAAI,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CA+BpD;AAED,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,mBAAmB,EAAE,GAC9B,CAAC,KAAK,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAI7C"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
const EVENT_COLORS = {
|
|
2
|
+
'workflow-start': 0x3498db,
|
|
3
|
+
'workflow-complete': 0x2ecc71,
|
|
4
|
+
'cycle-start': 0x3498db,
|
|
5
|
+
'cycle-complete': 0x2ecc71,
|
|
6
|
+
'approval-needed': 0xf1c40f,
|
|
7
|
+
error: 0xe74c3c,
|
|
8
|
+
'pipeline-start': 0x9b59b6,
|
|
9
|
+
'pipeline-complete': 0x2ecc71,
|
|
10
|
+
'stage-start': 0x3498db,
|
|
11
|
+
'stage-complete': 0x2ecc71,
|
|
12
|
+
'bot-task-start': 0x3498db,
|
|
13
|
+
'bot-task-complete': 0x2ecc71,
|
|
14
|
+
'bot-plan-ready': 0x9b59b6,
|
|
15
|
+
'bot-step-complete': 0x1abc9c,
|
|
16
|
+
'bot-validation-failed': 0xe67e22,
|
|
17
|
+
'bot-fix-attempt': 0xf39c12,
|
|
18
|
+
'bot-session-start': 0x3498db,
|
|
19
|
+
'bot-session-end': 0x2ecc71,
|
|
20
|
+
'bot-steering-received': 0x95a5a6,
|
|
21
|
+
};
|
|
22
|
+
const EVENT_LABELS = {
|
|
23
|
+
'workflow-start': 'Workflow Started',
|
|
24
|
+
'workflow-complete': 'Workflow Complete',
|
|
25
|
+
'cycle-start': 'Cycle Started',
|
|
26
|
+
'cycle-complete': 'Cycle Complete',
|
|
27
|
+
'approval-needed': 'Approval Needed',
|
|
28
|
+
error: 'Error',
|
|
29
|
+
'pipeline-start': 'Pipeline Started',
|
|
30
|
+
'pipeline-complete': 'Pipeline Complete',
|
|
31
|
+
'stage-start': 'Stage Started',
|
|
32
|
+
'stage-complete': 'Stage Complete',
|
|
33
|
+
'bot-task-start': 'Bot Task Started',
|
|
34
|
+
'bot-task-complete': 'Bot Task Complete',
|
|
35
|
+
'bot-plan-ready': 'Bot Plan Ready',
|
|
36
|
+
'bot-step-complete': 'Bot Step Complete',
|
|
37
|
+
'bot-validation-failed': 'Bot Validation Failed',
|
|
38
|
+
'bot-fix-attempt': 'Bot Fix Attempt',
|
|
39
|
+
'bot-session-start': 'Bot Session Started',
|
|
40
|
+
'bot-session-end': 'Bot Session Ended',
|
|
41
|
+
'bot-steering-received': 'Bot Steering Received',
|
|
42
|
+
};
|
|
43
|
+
function formatDiscordBody(event) {
|
|
44
|
+
const color = EVENT_COLORS[event.type];
|
|
45
|
+
const context = event.cycle != null
|
|
46
|
+
? `Cycle ${event.cycle}`
|
|
47
|
+
: (event.workflowFile ?? 'Workflow');
|
|
48
|
+
const title = `Weaver: ${EVENT_LABELS[event.type]} (${context})`;
|
|
49
|
+
const fields = [];
|
|
50
|
+
if (event.summary) {
|
|
51
|
+
fields.push({ name: 'Summary', value: event.summary });
|
|
52
|
+
}
|
|
53
|
+
if (event.outcome) {
|
|
54
|
+
fields.push({ name: 'Outcome', value: event.outcome, inline: true });
|
|
55
|
+
}
|
|
56
|
+
if (event.diff) {
|
|
57
|
+
const s = event.diff.summary;
|
|
58
|
+
if (s) {
|
|
59
|
+
fields.push({
|
|
60
|
+
name: 'Nodes',
|
|
61
|
+
value: `+${s.nodeTypesAdded ?? 0} / -${s.nodeTypesRemoved ?? 0}`,
|
|
62
|
+
inline: true,
|
|
63
|
+
});
|
|
64
|
+
fields.push({
|
|
65
|
+
name: 'Connections',
|
|
66
|
+
value: `+${s.connectionsAdded ?? 0} / -${s.connectionsRemoved ?? 0}`,
|
|
67
|
+
inline: true,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (event.pipelineName) {
|
|
72
|
+
fields.push({ name: 'Pipeline', value: event.pipelineName, inline: true });
|
|
73
|
+
}
|
|
74
|
+
if (event.stageId) {
|
|
75
|
+
fields.push({ name: 'Stage', value: event.stageId, inline: true });
|
|
76
|
+
}
|
|
77
|
+
if (event.totalStages != null) {
|
|
78
|
+
fields.push({ name: 'Progress', value: `${event.completedStages ?? 0}/${event.totalStages}`, inline: true });
|
|
79
|
+
}
|
|
80
|
+
if (event.error) {
|
|
81
|
+
fields.push({ name: 'Error', value: event.error.slice(0, 1024) });
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
embeds: [
|
|
85
|
+
{
|
|
86
|
+
title,
|
|
87
|
+
description: event.projectDir,
|
|
88
|
+
color,
|
|
89
|
+
fields: fields.length > 0 ? fields : undefined,
|
|
90
|
+
timestamp: new Date().toISOString(),
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function formatSlackBody(event) {
|
|
96
|
+
const label = EVENT_LABELS[event.type];
|
|
97
|
+
const blocks = [
|
|
98
|
+
{
|
|
99
|
+
type: 'header',
|
|
100
|
+
text: {
|
|
101
|
+
type: 'plain_text',
|
|
102
|
+
text: `Weaver: ${label}${event.cycle != null ? ` (Cycle ${event.cycle})` : ''}`,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
];
|
|
106
|
+
const parts = [`*Project:* ${event.projectDir}`];
|
|
107
|
+
if (event.summary)
|
|
108
|
+
parts.push(`*Summary:* ${event.summary}`);
|
|
109
|
+
if (event.outcome)
|
|
110
|
+
parts.push(`*Outcome:* ${event.outcome}`);
|
|
111
|
+
if (event.pipelineName)
|
|
112
|
+
parts.push(`*Pipeline:* ${event.pipelineName}`);
|
|
113
|
+
if (event.stageId)
|
|
114
|
+
parts.push(`*Stage:* ${event.stageId}`);
|
|
115
|
+
if (event.totalStages != null)
|
|
116
|
+
parts.push(`*Progress:* ${event.completedStages ?? 0}/${event.totalStages}`);
|
|
117
|
+
if (event.error)
|
|
118
|
+
parts.push(`*Error:* ${event.error.slice(0, 500)}`);
|
|
119
|
+
blocks.push({
|
|
120
|
+
type: 'section',
|
|
121
|
+
text: { type: 'mrkdwn', text: parts.join('\n') },
|
|
122
|
+
});
|
|
123
|
+
return { blocks };
|
|
124
|
+
}
|
|
125
|
+
function formatWebhookBody(event) {
|
|
126
|
+
return { event };
|
|
127
|
+
}
|
|
128
|
+
async function fetchWithRetry(url, init, maxAttempts, onError, channelName, event) {
|
|
129
|
+
const delays = [1000, 2000, 4000];
|
|
130
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
131
|
+
try {
|
|
132
|
+
const resp = await fetch(url, init);
|
|
133
|
+
if (resp.ok)
|
|
134
|
+
return resp;
|
|
135
|
+
const msg = `${resp.status} ${resp.statusText}`;
|
|
136
|
+
if (attempt < maxAttempts - 1) {
|
|
137
|
+
console.error(`[weaver] ${channelName} notification failed (attempt ${attempt + 1}/${maxAttempts}): ${msg}`);
|
|
138
|
+
await new Promise((r) => setTimeout(r, delays[attempt] ?? 4000));
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
const errorMsg = `${channelName} notification failed after ${maxAttempts} attempts: ${msg}`;
|
|
142
|
+
console.error(`[weaver] ${errorMsg}`);
|
|
143
|
+
if (onError && event)
|
|
144
|
+
onError(channelName ?? 'unknown', event, errorMsg);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
catch (err) {
|
|
148
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
149
|
+
if (attempt < maxAttempts - 1) {
|
|
150
|
+
console.error(`[weaver] ${channelName} notification error (attempt ${attempt + 1}/${maxAttempts}): ${msg}`);
|
|
151
|
+
await new Promise((r) => setTimeout(r, delays[attempt] ?? 4000));
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
const errorMsg = `${channelName} notification error after ${maxAttempts} attempts: ${msg}`;
|
|
155
|
+
console.error(`[weaver] ${errorMsg}`);
|
|
156
|
+
if (onError && event)
|
|
157
|
+
onError(channelName ?? 'unknown', event, errorMsg);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
export class WebhookNotificationChannel {
|
|
164
|
+
name;
|
|
165
|
+
url;
|
|
166
|
+
channelType;
|
|
167
|
+
events;
|
|
168
|
+
headers;
|
|
169
|
+
onError;
|
|
170
|
+
constructor(config, onError) {
|
|
171
|
+
this.name = config.channel;
|
|
172
|
+
this.url = config.url;
|
|
173
|
+
this.channelType = config.channel;
|
|
174
|
+
this.events = new Set(config.events ?? [
|
|
175
|
+
'cycle-start',
|
|
176
|
+
'cycle-complete',
|
|
177
|
+
'approval-needed',
|
|
178
|
+
'error',
|
|
179
|
+
]);
|
|
180
|
+
this.headers = config.headers ?? {};
|
|
181
|
+
this.onError = onError;
|
|
182
|
+
}
|
|
183
|
+
shouldSend(eventType) {
|
|
184
|
+
return this.events.has(eventType);
|
|
185
|
+
}
|
|
186
|
+
async send(event) {
|
|
187
|
+
if (!this.shouldSend(event.type))
|
|
188
|
+
return;
|
|
189
|
+
let body;
|
|
190
|
+
switch (this.channelType) {
|
|
191
|
+
case 'discord':
|
|
192
|
+
body = formatDiscordBody(event);
|
|
193
|
+
break;
|
|
194
|
+
case 'slack':
|
|
195
|
+
body = formatSlackBody(event);
|
|
196
|
+
break;
|
|
197
|
+
default:
|
|
198
|
+
body = formatWebhookBody(event);
|
|
199
|
+
}
|
|
200
|
+
await fetchWithRetry(this.url, {
|
|
201
|
+
method: 'POST',
|
|
202
|
+
headers: {
|
|
203
|
+
'Content-Type': 'application/json',
|
|
204
|
+
...this.headers,
|
|
205
|
+
},
|
|
206
|
+
body: JSON.stringify(body),
|
|
207
|
+
}, 3, this.onError, this.channelType, event);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
export function createNotifier(channels) {
|
|
211
|
+
return async (event) => {
|
|
212
|
+
await Promise.allSettled(channels.map((ch) => ch.send(event)));
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=notifications.js.map
|