@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,135 @@
|
|
|
1
|
+
# Weaver Bot Configuration Reference
|
|
2
|
+
|
|
3
|
+
The weaver bot runs workflows, executes tasks from natural language, and evolves autonomously. It auto-detects AI providers, manages approval gates, handles git operations, and sends notifications.
|
|
4
|
+
|
|
5
|
+
The bot has deep knowledge of the full flow-weaver ecosystem: annotation grammar, CLI tools, node patterns, error diagnosis, and the genesis protocol (loaded dynamically from `@synergenius/flow-weaver/doc-metadata`).
|
|
6
|
+
|
|
7
|
+
## Getting started
|
|
8
|
+
|
|
9
|
+
Run the bot directly via CLI:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
flow-weaver weaver bot "Create a workflow that processes CSV files"
|
|
13
|
+
flow-weaver weaver run my-workflow.ts
|
|
14
|
+
flow-weaver weaver session
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or scaffold a project via `flow-weaver init` and select the "AI Workflow Runner" use case.
|
|
18
|
+
|
|
19
|
+
## .weaver.json
|
|
20
|
+
|
|
21
|
+
Place a `.weaver.json` in your project root to configure the weaver workflow:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"provider": "auto",
|
|
26
|
+
"target": "scripts/my-pipeline.ts",
|
|
27
|
+
"notify": [
|
|
28
|
+
{ "channel": "discord", "url": "https://discord.com/api/webhooks/ID/TOKEN" }
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Provider options
|
|
34
|
+
|
|
35
|
+
**Auto-detect** (tries each in order):
|
|
36
|
+
```json
|
|
37
|
+
{ "provider": "auto" }
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Anthropic API** (best quality, requires API key):
|
|
41
|
+
```json
|
|
42
|
+
{ "provider": "anthropic" }
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Claude CLI** (uses your CLI subscription, no API key needed):
|
|
46
|
+
```json
|
|
47
|
+
{ "provider": "claude-cli" }
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**GitHub Copilot CLI** (uses your Copilot subscription):
|
|
51
|
+
```json
|
|
52
|
+
{ "provider": "copilot-cli" }
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Workflow nodes
|
|
56
|
+
|
|
57
|
+
The weaver workflow has 6 nodes, visible and editable in Studio:
|
|
58
|
+
|
|
59
|
+
1. **Load Config** - Reads `.weaver.json`, falls back to `{ provider: 'auto' }`
|
|
60
|
+
2. **Detect Provider** - Auto-detects installed CLIs and API keys
|
|
61
|
+
3. **Resolve Target** - Finds the workflow to run (from config or by scanning)
|
|
62
|
+
4. **Execute Target** - Runs the target with an AI agent channel
|
|
63
|
+
5. **Notify Result** - Sends Discord/Slack/webhook notifications
|
|
64
|
+
6. **Report** - Prints summary to console
|
|
65
|
+
|
|
66
|
+
You can customize any node, add pre/post-processing steps, or insert approval gates in Studio.
|
|
67
|
+
|
|
68
|
+
## Full .weaver.json reference
|
|
69
|
+
|
|
70
|
+
| Field | Type | Default | Description |
|
|
71
|
+
|-------|------|---------|-------------|
|
|
72
|
+
| `provider` | string or object | `"auto"` | AI provider (see options above) |
|
|
73
|
+
| `target` | string | auto-scan | Path to target workflow file |
|
|
74
|
+
| `approval` | `"auto"` / `"timeout-auto"` / object | `"auto"` | Approval gate behavior |
|
|
75
|
+
| `notify` | array | `[]` | Webhook notification channels |
|
|
76
|
+
|
|
77
|
+
### Provider (verbose form)
|
|
78
|
+
|
|
79
|
+
| Field | Type | Default | Description |
|
|
80
|
+
|-------|------|---------|-------------|
|
|
81
|
+
| `name` | `"anthropic"` / `"claude-cli"` / `"copilot-cli"` | required | Provider name |
|
|
82
|
+
| `model` | string | `"claude-sonnet-4-6"` | Model to use (Anthropic only) |
|
|
83
|
+
| `maxTokens` | number | `4096` | Max response tokens (Anthropic only) |
|
|
84
|
+
|
|
85
|
+
Shorthand values:
|
|
86
|
+
|
|
87
|
+
- `"anthropic"` requires `ANTHROPIC_API_KEY` env var and `@anthropic-ai/sdk` package
|
|
88
|
+
- `"claude-cli"` uses the Claude Code CLI (`claude -p`), requires Claude CLI installed
|
|
89
|
+
- `"copilot-cli"` uses GitHub Copilot CLI (`copilot -p`), requires Copilot CLI installed
|
|
90
|
+
- `"auto"` auto-detects in order: `ANTHROPIC_API_KEY` > `claude` CLI > `copilot` CLI
|
|
91
|
+
|
|
92
|
+
### Approval
|
|
93
|
+
|
|
94
|
+
How approval gates are handled.
|
|
95
|
+
|
|
96
|
+
| Field | Type | Default | Description |
|
|
97
|
+
|-------|------|---------|-------------|
|
|
98
|
+
| `mode` | `"auto"` / `"timeout-auto"` | `"auto"` | `auto`: approve immediately. `timeout-auto`: wait, then approve |
|
|
99
|
+
| `timeoutSeconds` | number | `300` | Seconds to wait before auto-approving (timeout-auto only) |
|
|
100
|
+
|
|
101
|
+
### Notifications
|
|
102
|
+
|
|
103
|
+
Webhook notifications. Array of notification targets. Supports Discord, Slack, and custom webhooks.
|
|
104
|
+
|
|
105
|
+
| Field | Type | Default | Description |
|
|
106
|
+
|-------|------|---------|-------------|
|
|
107
|
+
| `channel` | `"discord"` / `"slack"` / `"webhook"` | required | Notification target |
|
|
108
|
+
| `url` | string | required | Webhook URL |
|
|
109
|
+
| `events` | array | all events | Event types to send: `workflow-start`, `workflow-complete`, `error` |
|
|
110
|
+
| `headers` | object | `{}` | Extra HTTP headers (custom webhooks only) |
|
|
111
|
+
|
|
112
|
+
Discord notifications use rich embeds with color-coded outcomes. Slack uses Block Kit formatting.
|
|
113
|
+
|
|
114
|
+
## Programmatic usage
|
|
115
|
+
|
|
116
|
+
The pack also exports library functions for building custom runners:
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
import {
|
|
120
|
+
createProvider,
|
|
121
|
+
detectProvider,
|
|
122
|
+
runWorkflow,
|
|
123
|
+
BotAgentChannel,
|
|
124
|
+
} from '@synergenius/flow-weaver-pack-weaver';
|
|
125
|
+
|
|
126
|
+
// Auto-detect and run
|
|
127
|
+
const result = await runWorkflow('path/to/workflow.ts', { verbose: true });
|
|
128
|
+
|
|
129
|
+
// Or build a custom agent channel
|
|
130
|
+
const providerConfig = detectProvider();
|
|
131
|
+
const provider = createProvider(providerConfig);
|
|
132
|
+
const channel = new BotAgentChannel(provider, { ... });
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Scheduling is left to the user: cron, GitHub Actions, git hooks, etc.
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
// Types
|
|
2
|
+
export type {
|
|
3
|
+
BotConfig,
|
|
4
|
+
BotProviderConfig,
|
|
5
|
+
BotApprovalConfig,
|
|
6
|
+
BotNotifyConfig,
|
|
7
|
+
NotificationEvent,
|
|
8
|
+
NotificationEventType,
|
|
9
|
+
ExecutionEvent,
|
|
10
|
+
ExecutionEventType,
|
|
11
|
+
ApprovalMode,
|
|
12
|
+
WeaverConfig,
|
|
13
|
+
WeaverEnv,
|
|
14
|
+
ProviderInfo,
|
|
15
|
+
WorkflowResult,
|
|
16
|
+
ProviderName,
|
|
17
|
+
RunRecord,
|
|
18
|
+
RunFilter,
|
|
19
|
+
RetentionPolicy,
|
|
20
|
+
RunOutcome,
|
|
21
|
+
TokenUsage,
|
|
22
|
+
OnUsageCallback,
|
|
23
|
+
RunCostEntry,
|
|
24
|
+
RunCostSummary,
|
|
25
|
+
CostRecord,
|
|
26
|
+
CostSummary,
|
|
27
|
+
BotAgentProvider,
|
|
28
|
+
ProviderMetadata,
|
|
29
|
+
ProviderFactory,
|
|
30
|
+
ProviderFactoryConfig,
|
|
31
|
+
ProviderModule,
|
|
32
|
+
CronExpression,
|
|
33
|
+
ParsedCron,
|
|
34
|
+
CronField,
|
|
35
|
+
TriggerSource,
|
|
36
|
+
WatchDaemonOptions,
|
|
37
|
+
WatchDaemonState,
|
|
38
|
+
StageCondition,
|
|
39
|
+
StageStatus,
|
|
40
|
+
PipelineStage,
|
|
41
|
+
PipelineConfig,
|
|
42
|
+
StageResult,
|
|
43
|
+
PipelineResult,
|
|
44
|
+
DashboardEventType,
|
|
45
|
+
DashboardNodeStatus,
|
|
46
|
+
DashboardEvent,
|
|
47
|
+
DashboardNodeState,
|
|
48
|
+
DashboardServerOptions,
|
|
49
|
+
} from './bot/types.js';
|
|
50
|
+
|
|
51
|
+
// Providers
|
|
52
|
+
export type { BotChannelContext } from './bot/index.js';
|
|
53
|
+
export {
|
|
54
|
+
AnthropicAgentProvider,
|
|
55
|
+
CliAgentProvider,
|
|
56
|
+
resolveProviderConfig,
|
|
57
|
+
createProvider,
|
|
58
|
+
detectProvider,
|
|
59
|
+
} from './bot/index.js';
|
|
60
|
+
|
|
61
|
+
// Provider registry
|
|
62
|
+
export { ProviderRegistry, defaultRegistry, loadExternalProvider, discoverProviders } from './bot/index.js';
|
|
63
|
+
|
|
64
|
+
// Agent channel & notifications
|
|
65
|
+
export { BotAgentChannel } from './bot/index.js';
|
|
66
|
+
export {
|
|
67
|
+
WebhookNotificationChannel,
|
|
68
|
+
createNotifier,
|
|
69
|
+
} from './bot/index.js';
|
|
70
|
+
export type { NotificationChannel, NotificationErrorHandler } from './bot/index.js';
|
|
71
|
+
|
|
72
|
+
// Approvals
|
|
73
|
+
export { createApprovalHandler } from './bot/index.js';
|
|
74
|
+
export type { ApprovalHandler, ApprovalResult } from './bot/index.js';
|
|
75
|
+
|
|
76
|
+
// System prompt
|
|
77
|
+
export { buildSystemPrompt } from './bot/index.js';
|
|
78
|
+
|
|
79
|
+
// Runner
|
|
80
|
+
export { runWorkflow } from './bot/index.js';
|
|
81
|
+
|
|
82
|
+
// History & Cost
|
|
83
|
+
export { RunStore } from './bot/index.js';
|
|
84
|
+
export { CostTracker, MODEL_PRICING } from './bot/index.js';
|
|
85
|
+
export { CostStore } from './bot/index.js';
|
|
86
|
+
|
|
87
|
+
// Watch/Cron
|
|
88
|
+
export { parseCron, cronMatches, cronNextMatch } from './bot/index.js';
|
|
89
|
+
export { FileWatcher } from './bot/index.js';
|
|
90
|
+
export { CronScheduler } from './bot/index.js';
|
|
91
|
+
export { WatchDaemon } from './bot/index.js';
|
|
92
|
+
|
|
93
|
+
// Pipelines
|
|
94
|
+
export { PipelineRunner } from './bot/index.js';
|
|
95
|
+
export type { PipelineRunOptions } from './bot/index.js';
|
|
96
|
+
|
|
97
|
+
// Dashboard
|
|
98
|
+
export { DashboardServer } from './bot/index.js';
|
|
99
|
+
export { openBrowser } from './bot/index.js';
|
|
100
|
+
|
|
101
|
+
// Web Approval
|
|
102
|
+
export { WebApprovalHandler } from './bot/index.js';
|
|
103
|
+
|
|
104
|
+
// Bot infrastructure
|
|
105
|
+
export {
|
|
106
|
+
SteeringController,
|
|
107
|
+
TaskQueue,
|
|
108
|
+
SessionStore,
|
|
109
|
+
buildBotSystemPrompt,
|
|
110
|
+
} from './bot/index.js';
|
|
111
|
+
export type {
|
|
112
|
+
SteeringCommand,
|
|
113
|
+
QueuedTask,
|
|
114
|
+
SessionState,
|
|
115
|
+
BotTask,
|
|
116
|
+
BotPlan,
|
|
117
|
+
BotPlanStep,
|
|
118
|
+
BotValidationResult,
|
|
119
|
+
BotExecutionResult,
|
|
120
|
+
BotNotificationEventType,
|
|
121
|
+
ToolDefinition,
|
|
122
|
+
ToolUseResult,
|
|
123
|
+
StreamChunk,
|
|
124
|
+
GenesisImpactLevel,
|
|
125
|
+
GenesisOperationType,
|
|
126
|
+
GenesisConfig,
|
|
127
|
+
GenesisOperation,
|
|
128
|
+
GenesisProposal,
|
|
129
|
+
GenesisFingerprint,
|
|
130
|
+
GenesisCycleRecord,
|
|
131
|
+
GenesisHistory,
|
|
132
|
+
} from './bot/index.js';
|
|
133
|
+
|
|
134
|
+
// Genesis store
|
|
135
|
+
export { GenesisStore } from './bot/index.js';
|
|
136
|
+
|
|
137
|
+
// Node types (for use in flow-weaver workflows)
|
|
138
|
+
export {
|
|
139
|
+
weaverLoadConfig,
|
|
140
|
+
weaverDetectProvider,
|
|
141
|
+
weaverResolveTarget,
|
|
142
|
+
weaverExecuteTarget,
|
|
143
|
+
weaverSendNotify,
|
|
144
|
+
weaverReport,
|
|
145
|
+
weaverReceiveTask,
|
|
146
|
+
weaverRouteTask,
|
|
147
|
+
weaverReadWorkflow,
|
|
148
|
+
weaverBuildContext,
|
|
149
|
+
weaverPlanTask,
|
|
150
|
+
weaverApprovalGate,
|
|
151
|
+
weaverAbortTask,
|
|
152
|
+
weaverExecValidateRetry,
|
|
153
|
+
weaverExecutePlan,
|
|
154
|
+
weaverValidateResult,
|
|
155
|
+
weaverFixErrors,
|
|
156
|
+
weaverGitOps,
|
|
157
|
+
weaverBotReport,
|
|
158
|
+
genesisLoadConfig,
|
|
159
|
+
genesisObserve,
|
|
160
|
+
genesisDiffFingerprint,
|
|
161
|
+
genesisCheckStabilize,
|
|
162
|
+
genesisPropose,
|
|
163
|
+
genesisValidateProposal,
|
|
164
|
+
genesisSnapshot,
|
|
165
|
+
genesisApply,
|
|
166
|
+
genesisCompileValidate,
|
|
167
|
+
genesisDiffWorkflow,
|
|
168
|
+
genesisCheckThreshold,
|
|
169
|
+
genesisApprove,
|
|
170
|
+
genesisCommit,
|
|
171
|
+
genesisUpdateHistory,
|
|
172
|
+
genesisReport,
|
|
173
|
+
} from './node-types/index.js';
|
|
174
|
+
|
|
175
|
+
// Eject API (for platform/studio server-side use)
|
|
176
|
+
export { ejectWorkflows } from './cli-handlers.js';
|
|
177
|
+
export type { EjectResult } from './cli-handlers.js';
|
package/src/mcp-tools.ts
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { runWorkflow } from './bot/runner.js';
|
|
4
|
+
import { RunStore } from './bot/run-store.js';
|
|
5
|
+
import { CostStore } from './bot/cost-store.js';
|
|
6
|
+
import { defaultRegistry, discoverProviders } from './bot/provider-registry.js';
|
|
7
|
+
|
|
8
|
+
// McpServer type from the SDK, kept loose to avoid hard dependency
|
|
9
|
+
type McpServer = {
|
|
10
|
+
tool(
|
|
11
|
+
name: string,
|
|
12
|
+
description: string,
|
|
13
|
+
schema: Record<string, unknown>,
|
|
14
|
+
handler: (args: { [key: string]: unknown }) => Promise<{ content: Array<{ type: string; text: string }> }>,
|
|
15
|
+
): void;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export async function registerMcpTools(mcp: McpServer): Promise<void> {
|
|
19
|
+
mcp.tool(
|
|
20
|
+
'fw_weaver_run',
|
|
21
|
+
'Execute a Flow Weaver workflow with the AI runner. Returns the result summary, outcome, and cost.',
|
|
22
|
+
{
|
|
23
|
+
file: z.string().describe('Path to the workflow file'),
|
|
24
|
+
params: z.record(z.unknown()).optional().describe('Input parameters as key-value pairs'),
|
|
25
|
+
verbose: z.boolean().optional().describe('Show detailed execution info'),
|
|
26
|
+
dryRun: z.boolean().optional().describe('Preview without executing'),
|
|
27
|
+
},
|
|
28
|
+
async (args) => {
|
|
29
|
+
const result = await runWorkflow(args.file as string, {
|
|
30
|
+
params: args.params as Record<string, unknown> | undefined,
|
|
31
|
+
verbose: args.verbose as boolean | undefined,
|
|
32
|
+
dryRun: args.dryRun as boolean | undefined,
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
mcp.tool(
|
|
41
|
+
'fw_weaver_history',
|
|
42
|
+
'Query weaver run history. Returns recent workflow executions with outcome, duration, and summary.',
|
|
43
|
+
{
|
|
44
|
+
id: z.string().optional().describe('Specific run ID to look up'),
|
|
45
|
+
limit: z.number().optional().describe('Max number of entries (default 20)'),
|
|
46
|
+
outcome: z.enum(['completed', 'failed', 'error', 'skipped']).optional().describe('Filter by outcome'),
|
|
47
|
+
workflowFile: z.string().optional().describe('Filter by workflow file path'),
|
|
48
|
+
},
|
|
49
|
+
async (args) => {
|
|
50
|
+
const store = new RunStore();
|
|
51
|
+
|
|
52
|
+
if (args.id) {
|
|
53
|
+
const record = store.get(args.id as string);
|
|
54
|
+
if (!record) {
|
|
55
|
+
return { content: [{ type: 'text', text: `No run found matching "${args.id}"` }] };
|
|
56
|
+
}
|
|
57
|
+
return { content: [{ type: 'text', text: JSON.stringify(record, null, 2) }] };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const records = store.list({
|
|
61
|
+
outcome: args.outcome as 'completed' | 'failed' | 'error' | 'skipped' | undefined,
|
|
62
|
+
workflowFile: args.workflowFile as string | undefined,
|
|
63
|
+
limit: (args.limit as number | undefined) ?? 20,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
if (records.length === 0) {
|
|
67
|
+
return { content: [{ type: 'text', text: 'No runs recorded yet.' }] };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return { content: [{ type: 'text', text: JSON.stringify(records, null, 2) }] };
|
|
71
|
+
},
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
mcp.tool(
|
|
75
|
+
'fw_weaver_costs',
|
|
76
|
+
'Get AI cost summary across weaver runs. Shows total tokens, estimated cost, and breakdown by model.',
|
|
77
|
+
{
|
|
78
|
+
since: z.string().optional().describe('Filter: duration like "7d", "30d", or ISO-8601 date'),
|
|
79
|
+
model: z.string().optional().describe('Filter by model name'),
|
|
80
|
+
},
|
|
81
|
+
async (args) => {
|
|
82
|
+
const store = new CostStore();
|
|
83
|
+
let sinceTs: number | undefined;
|
|
84
|
+
|
|
85
|
+
if (args.since) {
|
|
86
|
+
const spec = args.since as string;
|
|
87
|
+
const match = spec.match(/^(\d+)([dhm])$/);
|
|
88
|
+
if (match) {
|
|
89
|
+
const n = parseInt(match[1]!, 10);
|
|
90
|
+
const unit = match[2];
|
|
91
|
+
const ms = unit === 'd' ? n * 86_400_000 : unit === 'h' ? n * 3_600_000 : n * 60_000;
|
|
92
|
+
sinceTs = Date.now() - ms;
|
|
93
|
+
} else {
|
|
94
|
+
const ts = new Date(spec).getTime();
|
|
95
|
+
if (!isNaN(ts)) sinceTs = ts;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const summary = store.summarize({ since: sinceTs, model: args.model as string | undefined });
|
|
100
|
+
return { content: [{ type: 'text', text: JSON.stringify(summary, null, 2) }] };
|
|
101
|
+
},
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
mcp.tool(
|
|
105
|
+
'fw_weaver_providers',
|
|
106
|
+
'List available AI providers for weaver workflow execution.',
|
|
107
|
+
{},
|
|
108
|
+
async () => {
|
|
109
|
+
await discoverProviders(defaultRegistry);
|
|
110
|
+
const providers = defaultRegistry.list();
|
|
111
|
+
|
|
112
|
+
const result = providers.map(({ name, metadata }) => ({
|
|
113
|
+
name,
|
|
114
|
+
source: metadata.source,
|
|
115
|
+
description: metadata.description,
|
|
116
|
+
requiredEnvVars: metadata.requiredEnvVars,
|
|
117
|
+
envVarsSet: metadata.requiredEnvVars?.every((v) => process.env[v]) ?? false,
|
|
118
|
+
detectCliCommand: metadata.detectCliCommand,
|
|
119
|
+
}));
|
|
120
|
+
|
|
121
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
122
|
+
},
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
// --- Bot Tools ---
|
|
126
|
+
|
|
127
|
+
mcp.tool(
|
|
128
|
+
'fw_weaver_bot',
|
|
129
|
+
'Run the autonomous bot to create or modify a Flow Weaver workflow. Provide a natural language task description.',
|
|
130
|
+
{
|
|
131
|
+
task: z.string().describe('Natural language task description'),
|
|
132
|
+
projectDir: z.string().optional().describe('Project directory'),
|
|
133
|
+
mode: z.enum(['create', 'modify', 'read', 'batch']).optional().describe('Task mode'),
|
|
134
|
+
targets: z.array(z.string()).optional().describe('Target files for modify/read'),
|
|
135
|
+
template: z.string().optional().describe('Template to use for scaffolding'),
|
|
136
|
+
dryRun: z.boolean().optional().describe('Preview without executing'),
|
|
137
|
+
autoApprove: z.boolean().optional().describe('Skip approval gate'),
|
|
138
|
+
},
|
|
139
|
+
async (args) => {
|
|
140
|
+
const task = {
|
|
141
|
+
instruction: args.task as string,
|
|
142
|
+
mode: (args.mode as string) ?? 'create',
|
|
143
|
+
targets: args.targets as string[] | undefined,
|
|
144
|
+
options: {
|
|
145
|
+
template: args.template as string | undefined,
|
|
146
|
+
dryRun: args.dryRun as boolean | undefined,
|
|
147
|
+
autoApprove: (args.autoApprove as boolean | undefined) ?? true,
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const packRoot = new URL('..', import.meta.url);
|
|
152
|
+
let workflowPath: string;
|
|
153
|
+
try {
|
|
154
|
+
const { existsSync } = await import('node:fs');
|
|
155
|
+
workflowPath = fileURLToPath(new URL('src/workflows/weaver-bot.ts', packRoot));
|
|
156
|
+
if (!existsSync(workflowPath)) {
|
|
157
|
+
workflowPath = fileURLToPath(new URL('dist/workflows/weaver-bot.js', packRoot));
|
|
158
|
+
}
|
|
159
|
+
} catch {
|
|
160
|
+
workflowPath = fileURLToPath(new URL('dist/workflows/weaver-bot.js', packRoot));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const result = await runWorkflow(
|
|
164
|
+
workflowPath,
|
|
165
|
+
{
|
|
166
|
+
params: { taskJson: JSON.stringify(task), projectDir: (args.projectDir as string) ?? process.cwd() },
|
|
167
|
+
dryRun: args.dryRun as boolean | undefined,
|
|
168
|
+
},
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
172
|
+
},
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
mcp.tool(
|
|
176
|
+
'fw_weaver_steer',
|
|
177
|
+
'Send a steering command to a running bot (pause, resume, cancel, redirect, queue).',
|
|
178
|
+
{
|
|
179
|
+
command: z.enum(['pause', 'resume', 'cancel', 'redirect', 'queue']).describe('Steering command'),
|
|
180
|
+
payload: z.string().optional().describe('Payload for redirect/queue commands'),
|
|
181
|
+
},
|
|
182
|
+
async (args) => {
|
|
183
|
+
const { SteeringController } = await import('./bot/steering.js');
|
|
184
|
+
const controller = new SteeringController();
|
|
185
|
+
await controller.write({
|
|
186
|
+
command: args.command as 'pause' | 'resume' | 'cancel' | 'redirect' | 'queue',
|
|
187
|
+
payload: args.payload as string | undefined,
|
|
188
|
+
timestamp: Date.now(),
|
|
189
|
+
});
|
|
190
|
+
return { content: [{ type: 'text', text: `Steering command sent: ${args.command}` }] };
|
|
191
|
+
},
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
mcp.tool(
|
|
195
|
+
'fw_weaver_queue',
|
|
196
|
+
'Manage the bot task queue (add, list, clear, remove tasks).',
|
|
197
|
+
{
|
|
198
|
+
action: z.enum(['add', 'list', 'clear', 'remove']).describe('Queue action'),
|
|
199
|
+
task: z.string().optional().describe('Task instruction (for add)'),
|
|
200
|
+
id: z.string().optional().describe('Task ID (for remove)'),
|
|
201
|
+
},
|
|
202
|
+
async (args) => {
|
|
203
|
+
const { TaskQueue } = await import('./bot/task-queue.js');
|
|
204
|
+
const queue = new TaskQueue();
|
|
205
|
+
|
|
206
|
+
switch (args.action) {
|
|
207
|
+
case 'add': {
|
|
208
|
+
if (!args.task) return { content: [{ type: 'text', text: 'Error: task instruction required' }] };
|
|
209
|
+
const id = await queue.add({ instruction: args.task as string, priority: 0 });
|
|
210
|
+
return { content: [{ type: 'text', text: `Task added: ${id}` }] };
|
|
211
|
+
}
|
|
212
|
+
case 'list':
|
|
213
|
+
return { content: [{ type: 'text', text: JSON.stringify(await queue.list(), null, 2) }] };
|
|
214
|
+
case 'clear': {
|
|
215
|
+
const count = await queue.clear();
|
|
216
|
+
return { content: [{ type: 'text', text: `Cleared ${count} task(s)` }] };
|
|
217
|
+
}
|
|
218
|
+
case 'remove': {
|
|
219
|
+
if (!args.id) return { content: [{ type: 'text', text: 'Error: task ID required' }] };
|
|
220
|
+
const removed = await queue.remove(args.id as string);
|
|
221
|
+
return { content: [{ type: 'text', text: removed ? `Removed ${args.id}` : `Not found: ${args.id}` }] };
|
|
222
|
+
}
|
|
223
|
+
default:
|
|
224
|
+
return { content: [{ type: 'text', text: `Unknown action: ${args.action}` }] };
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
mcp.tool(
|
|
230
|
+
'fw_weaver_status',
|
|
231
|
+
'Get current bot session status (idle/planning/executing/etc), current task, completed count.',
|
|
232
|
+
{},
|
|
233
|
+
async () => {
|
|
234
|
+
const { SessionStore } = await import('./bot/session-state.js');
|
|
235
|
+
const store = new SessionStore();
|
|
236
|
+
const state = store.load();
|
|
237
|
+
|
|
238
|
+
if (!state) {
|
|
239
|
+
return { content: [{ type: 'text', text: JSON.stringify({ status: 'no active session' }, null, 2) }] };
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return { content: [{ type: 'text', text: JSON.stringify(state, null, 2) }] };
|
|
243
|
+
},
|
|
244
|
+
);
|
|
245
|
+
|
|
246
|
+
mcp.tool(
|
|
247
|
+
'fw_weaver_genesis',
|
|
248
|
+
'Run a single Genesis self-evolution cycle on a target workflow. Genesis observes the project, proposes changes within a budget, validates, and commits or rolls back.',
|
|
249
|
+
{
|
|
250
|
+
projectDir: z.string().optional().describe('Project directory (defaults to cwd)'),
|
|
251
|
+
dryRun: z.boolean().optional().describe('Preview without executing'),
|
|
252
|
+
},
|
|
253
|
+
async (args) => {
|
|
254
|
+
const packRoot = new URL('..', import.meta.url);
|
|
255
|
+
let workflowPath: string;
|
|
256
|
+
try {
|
|
257
|
+
const { existsSync } = await import('node:fs');
|
|
258
|
+
workflowPath = fileURLToPath(new URL('src/workflows/genesis-task.ts', packRoot));
|
|
259
|
+
if (!existsSync(workflowPath)) {
|
|
260
|
+
workflowPath = fileURLToPath(new URL('dist/workflows/genesis-task.js', packRoot));
|
|
261
|
+
}
|
|
262
|
+
} catch {
|
|
263
|
+
workflowPath = fileURLToPath(new URL('dist/workflows/genesis-task.js', packRoot));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const result = await runWorkflow(workflowPath, {
|
|
267
|
+
params: { projectDir: (args.projectDir as string) ?? process.cwd() },
|
|
268
|
+
dryRun: args.dryRun as boolean | undefined,
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
272
|
+
},
|
|
273
|
+
);
|
|
274
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { WeaverContext } from '../bot/types.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Handles the rejection path from the approval gate.
|
|
5
|
+
* Formats the rejection reason into a result compatible with the report node.
|
|
6
|
+
*
|
|
7
|
+
* @flowWeaver nodeType
|
|
8
|
+
* @expression
|
|
9
|
+
* @label Abort Task
|
|
10
|
+
* @input ctx [order:0] - Weaver context (JSON)
|
|
11
|
+
* @output ctx [order:0] - Weaver context with abort resultJson (JSON)
|
|
12
|
+
* @output onFailure [hidden]
|
|
13
|
+
*/
|
|
14
|
+
export function weaverAbortTask(ctx: string): { ctx: string } {
|
|
15
|
+
const context = JSON.parse(ctx) as WeaverContext;
|
|
16
|
+
const task = JSON.parse(context.taskJson!) as { instruction?: string };
|
|
17
|
+
const result = {
|
|
18
|
+
success: false,
|
|
19
|
+
outcome: 'aborted',
|
|
20
|
+
summary: `Task aborted: ${context.rejectionReason}`,
|
|
21
|
+
instruction: task.instruction,
|
|
22
|
+
filesModified: [],
|
|
23
|
+
filesCreated: [],
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
console.log(`\x1b[33m→ Task aborted: ${context.rejectionReason}\x1b[0m`);
|
|
27
|
+
|
|
28
|
+
context.resultJson = JSON.stringify(result);
|
|
29
|
+
context.filesModified = '[]';
|
|
30
|
+
return { ctx: JSON.stringify(context) };
|
|
31
|
+
}
|