@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
package/LICENSE
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
Flow Weaver Library License
|
|
2
|
+
|
|
3
|
+
Version 2.0, February 2026
|
|
4
|
+
|
|
5
|
+
## Quick Reference (non-binding summary)
|
|
6
|
+
|
|
7
|
+
This table is provided for convenience only. In case of any conflict between
|
|
8
|
+
this summary and the license terms below, the license terms control.
|
|
9
|
+
|
|
10
|
+
Permitted:
|
|
11
|
+
|
|
12
|
+
Use Who Notes
|
|
13
|
+
---------------------------------------- ---------------- ----------------------------------
|
|
14
|
+
Install and run locally Anyone No restrictions on local use
|
|
15
|
+
Compile workflows Anyone CLI, programmatic, scripts
|
|
16
|
+
Use generated output (code, artifacts) Anyone Output is unrestricted
|
|
17
|
+
Run in CI/CD pipelines and build systems Anyone, any size Not considered "hosting"
|
|
18
|
+
Distribute copies with license notices Anyone Must include license, mark changes
|
|
19
|
+
Create derivative works Anyone Must retain license key checks
|
|
20
|
+
Host internally Orgs <= 15 All members count toward limit
|
|
21
|
+
Embed in internal toolchains Anyone No visual workflow authoring UI
|
|
22
|
+
Use inside a larger product Anyone If flow-weaver is not the primary value
|
|
23
|
+
|
|
24
|
+
Requires commercial license:
|
|
25
|
+
|
|
26
|
+
Use Notes
|
|
27
|
+
---------------------------------------- ----------------------------------
|
|
28
|
+
Host internally Orgs > 15 people
|
|
29
|
+
Build visual workflow authoring tools Standalone products for workflow authoring
|
|
30
|
+
Offer as a hosted or managed service To third parties, at any scale
|
|
31
|
+
Sell products built on the software Where flow-weaver is the primary value
|
|
32
|
+
|
|
33
|
+
Never permitted:
|
|
34
|
+
|
|
35
|
+
Use Notes
|
|
36
|
+
---------------------------------------- ----------------------------------
|
|
37
|
+
Remove or circumvent license keys Applies to software and derivatives
|
|
38
|
+
Remove licensing or copyright notices Must always be retained
|
|
39
|
+
Strip license key checks from forks Derivatives must retain protections
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Acceptance
|
|
44
|
+
|
|
45
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
46
|
+
|
|
47
|
+
## Copyright License
|
|
48
|
+
|
|
49
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
50
|
+
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
51
|
+
available, and prepare derivative works of the software, in each case subject to
|
|
52
|
+
the limitations and conditions below.
|
|
53
|
+
|
|
54
|
+
## Limitations
|
|
55
|
+
|
|
56
|
+
You may not provide the software to third parties as a hosted or managed
|
|
57
|
+
service, where the service provides users with access to any of the features or
|
|
58
|
+
functionality of the software.
|
|
59
|
+
|
|
60
|
+
You may not use the software to build, distribute, or offer any standalone
|
|
61
|
+
product or service whose primary purpose is providing a graphical or visual
|
|
62
|
+
interface for creating, editing, designing, or composing workflows. This
|
|
63
|
+
restriction applies whether the product is hosted, distributed, sold, or offered
|
|
64
|
+
free of charge. It does not apply to products that use the software internally
|
|
65
|
+
without exposing its workflow authoring capabilities to end users through a
|
|
66
|
+
graphical interface.
|
|
67
|
+
|
|
68
|
+
You may not sell the software or any product that provides, as its primary
|
|
69
|
+
function, capabilities supplied by the software (including workflow compilation,
|
|
70
|
+
parsing, validation, code generation, or diagram generation), without a separate
|
|
71
|
+
commercial license from the licensor. This does not restrict the sale of products
|
|
72
|
+
that merely incorporate the software as one component among many, where the
|
|
73
|
+
product's primary value comes from functionality independent of the software.
|
|
74
|
+
|
|
75
|
+
You may not move, change, disable, or circumvent the license key functionality
|
|
76
|
+
in the software, and you may not remove or obscure any functionality in the
|
|
77
|
+
software that is protected by the license key.
|
|
78
|
+
|
|
79
|
+
Derivative works must retain all license key functionality, license verification
|
|
80
|
+
mechanisms, and licensing notices present in the original software. Distributing
|
|
81
|
+
derivative works with license key protections removed, disabled, or bypassed
|
|
82
|
+
constitutes a violation of this license.
|
|
83
|
+
|
|
84
|
+
You may not alter, remove, or obscure any licensing, copyright, or other notices
|
|
85
|
+
of the licensor in the software. Any use of the licensor's trademarks is subject
|
|
86
|
+
to applicable law.
|
|
87
|
+
|
|
88
|
+
## Patents
|
|
89
|
+
|
|
90
|
+
The licensor grants you a license, under any patent claims the licensor can
|
|
91
|
+
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
92
|
+
sale, import and have imported the software, in each case subject to the
|
|
93
|
+
limitations and conditions in this license. This license does not cover any
|
|
94
|
+
patent claims that you cause to be infringed by modifications or additions to the
|
|
95
|
+
software. If you or your company make any written claim that the software
|
|
96
|
+
infringes or contributes to infringement of any patent, your patent license for
|
|
97
|
+
the software granted under these terms ends immediately. If your company makes
|
|
98
|
+
such a claim, your patent license ends immediately for work on behalf of your
|
|
99
|
+
company.
|
|
100
|
+
|
|
101
|
+
## Notices
|
|
102
|
+
|
|
103
|
+
You must ensure that anyone who gets a copy of any part of the software from you
|
|
104
|
+
also gets a copy of these terms.
|
|
105
|
+
|
|
106
|
+
If you modify the software, you must include in any modified copies of the
|
|
107
|
+
software prominent notices stating that you have modified the software.
|
|
108
|
+
|
|
109
|
+
## No Other Rights
|
|
110
|
+
|
|
111
|
+
These terms do not imply any licenses other than those expressly granted in
|
|
112
|
+
these terms.
|
|
113
|
+
|
|
114
|
+
## Termination
|
|
115
|
+
|
|
116
|
+
If you use the software in violation of these terms, such use is not licensed,
|
|
117
|
+
and your licenses will automatically terminate. If the licensor provides you
|
|
118
|
+
with a notice of your violation, and you cease all violation of this license no
|
|
119
|
+
later than 30 days after you receive that notice, your licenses will be
|
|
120
|
+
reinstated retroactively. However, if you violate these terms after such
|
|
121
|
+
reinstatement, any additional violation of these terms will cause your licenses
|
|
122
|
+
to terminate immediately.
|
|
123
|
+
|
|
124
|
+
You may request a review of any termination by contacting the licensor in
|
|
125
|
+
writing within 15 days of termination. The licensor will respond within 30 days.
|
|
126
|
+
|
|
127
|
+
## No Liability
|
|
128
|
+
|
|
129
|
+
As far as the law allows, the software comes as is, without any warranty or
|
|
130
|
+
condition, and the licensor will not be liable to you for any damages arising
|
|
131
|
+
out of these terms or the use or nature of the software, under any kind of
|
|
132
|
+
legal claim.
|
|
133
|
+
|
|
134
|
+
## Governing Law
|
|
135
|
+
|
|
136
|
+
This license is governed by the laws of Portugal. Any disputes arising from or
|
|
137
|
+
related to this license will be submitted to the exclusive jurisdiction of the
|
|
138
|
+
courts of Lisbon, Portugal.
|
|
139
|
+
|
|
140
|
+
## Definitions
|
|
141
|
+
|
|
142
|
+
The "licensor" is Ricardo Jose Horta Morais (Synergenius), and the "software"
|
|
143
|
+
is the software the licensor makes available under these terms.
|
|
144
|
+
|
|
145
|
+
"You" refers to the individual or entity agreeing to these terms. "Your company"
|
|
146
|
+
is any legal entity, sole proprietorship, or other kind of organization that you
|
|
147
|
+
work for, plus all organizations that have control over, are under the control
|
|
148
|
+
of, or are under common control with that organization. "Control" means
|
|
149
|
+
ownership of substantially all the assets of an entity, or the power to direct
|
|
150
|
+
its management and policies by vote, contract, or otherwise. Control can be
|
|
151
|
+
direct or indirect.
|
|
152
|
+
|
|
153
|
+
"Third parties" means any individual or entity that is not you or your company
|
|
154
|
+
as defined in these terms.
|
|
155
|
+
|
|
156
|
+
"Your licenses" are all the licenses granted to you for the software under these
|
|
157
|
+
terms. "Use" means anything you do with the software requiring one of your
|
|
158
|
+
licenses.
|
|
159
|
+
|
|
160
|
+
"Hosting the software" means making the software's functionality available to
|
|
161
|
+
users over a network as a service. Running the software in automated build
|
|
162
|
+
pipelines, continuous integration systems, command-line interfaces, or
|
|
163
|
+
development toolchains does not constitute hosting, regardless of organization
|
|
164
|
+
size.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
ADDITIONAL NOTICES
|
|
169
|
+
|
|
170
|
+
1. Output of the Software
|
|
171
|
+
|
|
172
|
+
The output of the software, including but not limited to compiled workflows,
|
|
173
|
+
generated code, deployment artifacts, and any other files produced by the
|
|
174
|
+
software's compilation, code generation, or export features, is not considered
|
|
175
|
+
part of the software and may be used, copied, modified, distributed, and
|
|
176
|
+
sublicensed for any purpose without restriction under this license.
|
|
177
|
+
|
|
178
|
+
2. Internal Hosting Threshold
|
|
179
|
+
|
|
180
|
+
Organizations with 15 or fewer individuals, including employees, contractors,
|
|
181
|
+
and affiliates, may host the software on internal infrastructure for use by
|
|
182
|
+
their members without restriction under this license. The count includes all
|
|
183
|
+
individuals in the organization, not only those who directly use the software.
|
|
184
|
+
|
|
185
|
+
Organizations with more than 15 individuals that wish to host the software,
|
|
186
|
+
whether on internal infrastructure or as a service, require a commercial
|
|
187
|
+
license.
|
|
188
|
+
|
|
189
|
+
3. Unrestricted Use
|
|
190
|
+
|
|
191
|
+
Using the software locally, including installing, running, compiling workflows,
|
|
192
|
+
generating code, and producing deployment artifacts, is permitted for any
|
|
193
|
+
individual or organization regardless of size, subject to the Limitations above.
|
|
194
|
+
|
|
195
|
+
4. Export Compliance
|
|
196
|
+
|
|
197
|
+
You are responsible for compliance with all applicable export and import laws
|
|
198
|
+
and regulations in your jurisdiction when using, distributing, or making the
|
|
199
|
+
software available.
|
|
200
|
+
|
|
201
|
+
5. Commercial Licensing
|
|
202
|
+
|
|
203
|
+
For commercial licensing inquiries, partnership arrangements, or questions
|
|
204
|
+
about permitted use, contact support@synergenius.pt.
|
package/README.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# Weaver
|
|
2
|
+
|
|
3
|
+
Weaver is an autonomous AI bot that creates, runs, and evolves Flow Weaver workflows. It is itself built as a set of Flow Weaver workflows, so the bot that evolves workflows is a workflow. It ships as a marketplace pack (`@synergenius/flowweaver-pack-weaver`) and plugs into any Flow Weaver project.
|
|
4
|
+
|
|
5
|
+
Weaver understands the full Flow Weaver ecosystem: annotation grammar, compilation, validation, CLI tools, node patterns, error diagnosis, and the Genesis self-evolution protocol. This knowledge is loaded dynamically from `@synergenius/flow-weaver/doc-metadata`, so Weaver always stays current with the engine.
|
|
6
|
+
|
|
7
|
+
## How it works
|
|
8
|
+
|
|
9
|
+
Weaver connects to an AI provider (Anthropic API, Claude CLI, or GitHub Copilot CLI), detects the right one automatically or uses your `.weaver.json` config, and operates in one of four modes:
|
|
10
|
+
|
|
11
|
+
**Run mode** (`weaver run`) executes an existing workflow file with an AI agent channel attached. The agent channel lets nodes inside the target workflow pause and ask Weaver for decisions. This is how Genesis works: the genesis-task workflow asks Weaver what evolutions to propose, and Weaver responds with structured operations.
|
|
12
|
+
|
|
13
|
+
**Bot mode** (`weaver bot "create a greeting workflow"`) takes a task instruction and handles it end-to-end. It builds context from the project, sends the task to the AI for planning, presents the plan for approval, executes the plan steps (writing files, running CLI commands, compiling), validates the results, and retries with AI-generated fixes if validation fails. Git operations and notifications run in parallel after execution.
|
|
14
|
+
|
|
15
|
+
**Batch mode** (`weaver bot --batch`) processes multiple sub-tasks sequentially through the same plan-approve-execute cycle.
|
|
16
|
+
|
|
17
|
+
**Session mode** (`weaver session`) polls a task queue continuously, picking up tasks submitted via CLI or MCP and processing them one at a time through the full pipeline.
|
|
18
|
+
|
|
19
|
+
## The three workflows
|
|
20
|
+
|
|
21
|
+
Each mode maps to a workflow file that wires the same set of reusable node types differently:
|
|
22
|
+
|
|
23
|
+
`weaver.ts` is the runner. Six nodes in a line: load config, detect provider, find the target, execute it, notify, report.
|
|
24
|
+
|
|
25
|
+
`weaver-bot.ts` is the single-task bot. It adds task routing (read-only tasks skip to analysis, actionable tasks go through planning), an approval gate with an abort path, the execute-validate-retry loop, and parallel fan-out to git ops and notifications before merging at the report node. Session mode also uses this workflow, running it in a continuous loop that polls the task queue.
|
|
26
|
+
|
|
27
|
+
`weaver-bot-batch.ts` is the batch variant. Same pipeline as the bot but without read-only routing, since batch tasks are always actionable.
|
|
28
|
+
|
|
29
|
+
All three workflows are customizable. Run `weaver eject` to get a local copy you can modify in Studio: add nodes, change connections, insert custom approval logic, whatever you need.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
flow-weaver pack add @synergenius/flowweaver-pack-weaver
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Or scaffold a new project with it:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
flow-weaver init # select "AI Workflow Runner"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Configuration
|
|
44
|
+
|
|
45
|
+
Place a `.weaver.json` in your project root:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"provider": "auto",
|
|
50
|
+
"target": "src/my-workflow.ts",
|
|
51
|
+
"approval": "auto",
|
|
52
|
+
"notify": [
|
|
53
|
+
{ "channel": "discord", "url": "https://discord.com/api/webhooks/..." }
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Provider
|
|
59
|
+
|
|
60
|
+
Controls which AI provider Weaver uses.
|
|
61
|
+
|
|
62
|
+
`"auto"` (default) tries in order: `ANTHROPIC_API_KEY` env var, `claude` CLI, `copilot` CLI.
|
|
63
|
+
|
|
64
|
+
Explicit string values: `"anthropic"`, `"claude-cli"`, `"copilot-cli"`.
|
|
65
|
+
|
|
66
|
+
Object form for full control:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"provider": {
|
|
71
|
+
"name": "anthropic",
|
|
72
|
+
"model": "claude-sonnet-4-6",
|
|
73
|
+
"maxTokens": 8192
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Approval
|
|
79
|
+
|
|
80
|
+
How the approval gate behaves in bot mode.
|
|
81
|
+
|
|
82
|
+
`"auto"` approves immediately. `"prompt"` asks interactively. `"timeout-auto"` waits N seconds then approves.
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"approval": { "mode": "timeout-auto", "timeoutSeconds": 120 }
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Notifications
|
|
91
|
+
|
|
92
|
+
Array of webhook targets. Supports Discord (rich embeds), Slack (Block Kit), and raw webhooks.
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"notify": [
|
|
97
|
+
{ "channel": "discord", "url": "...", "events": ["workflow-complete", "error"] },
|
|
98
|
+
{ "channel": "slack", "url": "..." }
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## CLI commands
|
|
104
|
+
|
|
105
|
+
The pack adds these commands to `flow-weaver`:
|
|
106
|
+
|
|
107
|
+
| Command | Description |
|
|
108
|
+
|---------|-------------|
|
|
109
|
+
| `weaver run [file]` | Run a workflow with Weaver |
|
|
110
|
+
| `weaver bot <task>` | Give Weaver a task to execute |
|
|
111
|
+
| `weaver session` | Start continuous queue processing |
|
|
112
|
+
| `weaver eject` | Copy the managed workflow for customization |
|
|
113
|
+
| `weaver history [id]` | List recent runs |
|
|
114
|
+
| `weaver costs` | Show token usage and cost summary |
|
|
115
|
+
| `weaver providers` | List detected AI providers |
|
|
116
|
+
| `weaver steer <cmd>` | Send pause/resume/cancel to a running bot |
|
|
117
|
+
| `weaver queue <op>` | Manage the task queue (add, list, clear, remove) |
|
|
118
|
+
| `weaver watch <file>` | Re-run on file changes |
|
|
119
|
+
| `weaver cron <expr> <file>` | Run on a schedule |
|
|
120
|
+
| `weaver pipeline <config>` | Run a multi-stage pipeline |
|
|
121
|
+
| `weaver dashboard [file]` | Live execution dashboard |
|
|
122
|
+
|
|
123
|
+
## MCP tools
|
|
124
|
+
|
|
125
|
+
For IDE integration, the pack exposes MCP tools: `fw_weaver_run`, `fw_weaver_bot`, `fw_weaver_steer`, `fw_weaver_queue`, `fw_weaver_status`, `fw_weaver_history`, `fw_weaver_costs`, `fw_weaver_providers`.
|
|
126
|
+
|
|
127
|
+
## Node types
|
|
128
|
+
|
|
129
|
+
The pack ships 19 node types usable in any Flow Weaver workflow. The core ones:
|
|
130
|
+
|
|
131
|
+
`weaverLoadConfig` reads `.weaver.json` and outputs the parsed config object.
|
|
132
|
+
|
|
133
|
+
`weaverDetectProvider` resolves the AI provider and assembles a `WeaverEnv` bundle (project dir, config, provider type, provider info) that flows through the rest of the pipeline as a single typed object.
|
|
134
|
+
|
|
135
|
+
`weaverReceiveTask` picks up a task from CLI args, MCP, or the queue.
|
|
136
|
+
|
|
137
|
+
`weaverBuildContext` generates the knowledge bundle the AI needs for planning, pulling annotation grammar and docs from the Flow Weaver engine.
|
|
138
|
+
|
|
139
|
+
`weaverPlanTask` sends the task and context to the AI and gets back a structured execution plan.
|
|
140
|
+
|
|
141
|
+
`weaverApprovalGate` presents the plan for approval, branching to abort on rejection.
|
|
142
|
+
|
|
143
|
+
`weaverExecValidateRetry` runs the plan, validates with `flow-weaver validate`, and on failure asks the AI for fixes. Up to 3 attempts.
|
|
144
|
+
|
|
145
|
+
`weaverGitOps` stages and commits modified files.
|
|
146
|
+
|
|
147
|
+
`weaverSendNotify` dispatches webhook notifications.
|
|
148
|
+
|
|
149
|
+
## Programmatic usage
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
import { runWorkflow, createProvider, detectProvider, BotAgentChannel } from '@synergenius/flowweaver-pack-weaver';
|
|
153
|
+
|
|
154
|
+
const result = await runWorkflow('path/to/workflow.ts', { verbose: true });
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Or build a custom agent channel for more control:
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
const providerConfig = detectProvider();
|
|
161
|
+
const provider = createProvider(providerConfig);
|
|
162
|
+
const channel = new BotAgentChannel(provider, { systemPrompt: '...' });
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## License
|
|
166
|
+
|
|
167
|
+
See [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { BotProviderConfig, BotConfig, BotAgentProvider, OnUsageCallback, StreamChunk, ToolDefinition, ToolUseResult } from './types.js';
|
|
2
|
+
import type { ProviderRegistry } from './provider-registry.js';
|
|
3
|
+
export type { BotAgentProvider };
|
|
4
|
+
export declare function resolveProviderConfig(provider: BotConfig['provider']): BotProviderConfig;
|
|
5
|
+
export declare function createProvider(config: BotProviderConfig, registry?: ProviderRegistry): Promise<BotAgentProvider>;
|
|
6
|
+
export declare function detectProvider(registry?: ProviderRegistry): BotProviderConfig;
|
|
7
|
+
export declare class AnthropicAgentProvider implements BotAgentProvider {
|
|
8
|
+
private model;
|
|
9
|
+
private maxTokens;
|
|
10
|
+
onUsage?: OnUsageCallback;
|
|
11
|
+
constructor(config: BotProviderConfig);
|
|
12
|
+
decide(request: {
|
|
13
|
+
agentId: string;
|
|
14
|
+
context: Record<string, unknown>;
|
|
15
|
+
prompt: string;
|
|
16
|
+
}): Promise<Record<string, unknown>>;
|
|
17
|
+
stream(request: {
|
|
18
|
+
agentId: string;
|
|
19
|
+
context: Record<string, unknown>;
|
|
20
|
+
prompt: string;
|
|
21
|
+
}): AsyncIterable<StreamChunk>;
|
|
22
|
+
decideWithTools(request: {
|
|
23
|
+
agentId: string;
|
|
24
|
+
context: Record<string, unknown>;
|
|
25
|
+
prompt: string;
|
|
26
|
+
tools: ToolDefinition[];
|
|
27
|
+
}): Promise<{
|
|
28
|
+
result: Record<string, unknown>;
|
|
29
|
+
toolCalls?: ToolUseResult[];
|
|
30
|
+
}>;
|
|
31
|
+
private parseJson;
|
|
32
|
+
private loadSdk;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=agent-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-provider.d.ts","sourceRoot":"","sources":["../../src/bot/agent-provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,gBAAgB,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,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,CAAC;QAAC,SAAS,CAAC,EAAE,aAAa,EAAE,CAAA;KAAE,CAAC;IA0C7E,OAAO,CAAC,SAAS;YAkBH,OAAO;CAWtB"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { buildSystemPrompt } from './system-prompt.js';
|
|
3
|
+
import { defaultRegistry, loadExternalProvider } from './provider-registry.js';
|
|
4
|
+
const WHICH_CMD = process.platform === 'win32' ? 'where' : 'which';
|
|
5
|
+
export function resolveProviderConfig(provider) {
|
|
6
|
+
if (provider === 'auto')
|
|
7
|
+
return detectProvider();
|
|
8
|
+
if (typeof provider === 'string')
|
|
9
|
+
return { name: provider };
|
|
10
|
+
return provider;
|
|
11
|
+
}
|
|
12
|
+
export async function createProvider(config, registry = defaultRegistry) {
|
|
13
|
+
// If config.module is set, load and register it first
|
|
14
|
+
if (config.module) {
|
|
15
|
+
if (!registry.has(config.name)) {
|
|
16
|
+
const { factory, metadata } = await loadExternalProvider(config.module);
|
|
17
|
+
registry.register(config.name, factory, metadata);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
// Check registry (covers built-ins + loaded externals)
|
|
21
|
+
const entry = registry.resolve(config.name);
|
|
22
|
+
if (entry) {
|
|
23
|
+
return entry.factory({
|
|
24
|
+
model: config.model,
|
|
25
|
+
maxTokens: config.maxTokens,
|
|
26
|
+
options: config.options,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
// Fallback: try conventional npm package names
|
|
30
|
+
const candidates = [
|
|
31
|
+
`flowweaver-provider-${config.name}`,
|
|
32
|
+
`@synergenius/flowweaver-provider-${config.name}`,
|
|
33
|
+
];
|
|
34
|
+
for (const candidate of candidates) {
|
|
35
|
+
try {
|
|
36
|
+
const { factory, metadata } = await loadExternalProvider(candidate);
|
|
37
|
+
registry.register(config.name, factory, metadata);
|
|
38
|
+
return factory({
|
|
39
|
+
model: config.model,
|
|
40
|
+
maxTokens: config.maxTokens,
|
|
41
|
+
options: config.options,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// Try next candidate
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
throw new Error(`Unknown provider: ${config.name}\n` +
|
|
49
|
+
` Install a provider package: npm install flowweaver-provider-${config.name}\n` +
|
|
50
|
+
` Or specify a module path: { "provider": { "name": "${config.name}", "module": "./my-provider.js" } }`);
|
|
51
|
+
}
|
|
52
|
+
export function detectProvider(registry = defaultRegistry) {
|
|
53
|
+
// Check registry metadata for env vars and CLI commands
|
|
54
|
+
for (const { name, metadata } of registry.list()) {
|
|
55
|
+
if (metadata.requiredEnvVars) {
|
|
56
|
+
const allPresent = metadata.requiredEnvVars.every((v) => process.env[v]);
|
|
57
|
+
if (allPresent)
|
|
58
|
+
return { name };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
for (const { name, metadata } of registry.list()) {
|
|
62
|
+
if (metadata.detectCliCommand) {
|
|
63
|
+
try {
|
|
64
|
+
execFileSync(WHICH_CMD, [metadata.detectCliCommand], { stdio: 'pipe' });
|
|
65
|
+
return { name };
|
|
66
|
+
}
|
|
67
|
+
catch { /* not installed */ }
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
throw new Error('No AI provider found. Options:\n' +
|
|
71
|
+
' 1. Set ANTHROPIC_API_KEY environment variable\n' +
|
|
72
|
+
' 2. Install Claude CLI: https://docs.anthropic.com/claude-code\n' +
|
|
73
|
+
' 3. Install GitHub Copilot CLI: https://github.com/features/copilot');
|
|
74
|
+
}
|
|
75
|
+
export class AnthropicAgentProvider {
|
|
76
|
+
model;
|
|
77
|
+
maxTokens;
|
|
78
|
+
onUsage;
|
|
79
|
+
constructor(config) {
|
|
80
|
+
this.model = config.model ?? 'claude-sonnet-4-6';
|
|
81
|
+
this.maxTokens = config.maxTokens ?? 4096;
|
|
82
|
+
}
|
|
83
|
+
async decide(request) {
|
|
84
|
+
if (!process.env.ANTHROPIC_API_KEY) {
|
|
85
|
+
throw new Error('ANTHROPIC_API_KEY environment variable is required for the Anthropic provider');
|
|
86
|
+
}
|
|
87
|
+
const Anthropic = await this.loadSdk();
|
|
88
|
+
const client = new Anthropic();
|
|
89
|
+
const systemPrompt = await buildSystemPrompt();
|
|
90
|
+
const contextStr = typeof request.context === 'string'
|
|
91
|
+
? request.context
|
|
92
|
+
: JSON.stringify(request.context, null, 2);
|
|
93
|
+
const response = await client.messages.create({
|
|
94
|
+
model: this.model,
|
|
95
|
+
max_tokens: this.maxTokens,
|
|
96
|
+
system: systemPrompt,
|
|
97
|
+
messages: [
|
|
98
|
+
{
|
|
99
|
+
role: 'user',
|
|
100
|
+
content: `Context:\n${contextStr}\n\nInstructions:\n${request.prompt}`,
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
});
|
|
104
|
+
if (this.onUsage && response.usage) {
|
|
105
|
+
this.onUsage(request.agentId, response.model ?? this.model, {
|
|
106
|
+
inputTokens: response.usage.input_tokens,
|
|
107
|
+
outputTokens: response.usage.output_tokens,
|
|
108
|
+
cacheCreationInputTokens: response.usage.cache_creation_input_tokens,
|
|
109
|
+
cacheReadInputTokens: response.usage.cache_read_input_tokens,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
const text = response.content[0].type === 'text' ? response.content[0].text : '';
|
|
113
|
+
return this.parseJson(text);
|
|
114
|
+
}
|
|
115
|
+
async *stream(request) {
|
|
116
|
+
if (!process.env.ANTHROPIC_API_KEY) {
|
|
117
|
+
throw new Error('ANTHROPIC_API_KEY environment variable is required for the Anthropic provider');
|
|
118
|
+
}
|
|
119
|
+
const Anthropic = await this.loadSdk();
|
|
120
|
+
const client = new Anthropic();
|
|
121
|
+
const systemPrompt = await buildSystemPrompt();
|
|
122
|
+
const contextStr = typeof request.context === 'string'
|
|
123
|
+
? request.context
|
|
124
|
+
: JSON.stringify(request.context, null, 2);
|
|
125
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
126
|
+
const stream = client.messages.stream({
|
|
127
|
+
model: this.model,
|
|
128
|
+
max_tokens: this.maxTokens,
|
|
129
|
+
system: systemPrompt,
|
|
130
|
+
messages: [{ role: 'user', content: `Context:\n${contextStr}\n\nInstructions:\n${request.prompt}` }],
|
|
131
|
+
});
|
|
132
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
133
|
+
for await (const event of stream) {
|
|
134
|
+
if (event.type === 'content_block_delta' && event.delta?.type === 'text_delta') {
|
|
135
|
+
yield { type: 'text', text: event.delta.text };
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
139
|
+
const finalMessage = await stream.finalMessage();
|
|
140
|
+
if (finalMessage?.usage) {
|
|
141
|
+
const usage = {
|
|
142
|
+
inputTokens: finalMessage.usage.input_tokens,
|
|
143
|
+
outputTokens: finalMessage.usage.output_tokens,
|
|
144
|
+
cacheCreationInputTokens: finalMessage.usage.cache_creation_input_tokens,
|
|
145
|
+
cacheReadInputTokens: finalMessage.usage.cache_read_input_tokens,
|
|
146
|
+
};
|
|
147
|
+
if (this.onUsage)
|
|
148
|
+
this.onUsage(request.agentId, finalMessage.model ?? this.model, usage);
|
|
149
|
+
yield { type: 'usage', usage };
|
|
150
|
+
}
|
|
151
|
+
yield { type: 'done' };
|
|
152
|
+
}
|
|
153
|
+
async decideWithTools(request) {
|
|
154
|
+
if (!process.env.ANTHROPIC_API_KEY) {
|
|
155
|
+
throw new Error('ANTHROPIC_API_KEY environment variable is required for the Anthropic provider');
|
|
156
|
+
}
|
|
157
|
+
const Anthropic = await this.loadSdk();
|
|
158
|
+
const client = new Anthropic();
|
|
159
|
+
const systemPrompt = await buildSystemPrompt();
|
|
160
|
+
const contextStr = typeof request.context === 'string'
|
|
161
|
+
? request.context
|
|
162
|
+
: JSON.stringify(request.context, null, 2);
|
|
163
|
+
const response = await client.messages.create({
|
|
164
|
+
model: this.model,
|
|
165
|
+
max_tokens: this.maxTokens,
|
|
166
|
+
system: systemPrompt,
|
|
167
|
+
messages: [{ role: 'user', content: `Context:\n${contextStr}\n\nInstructions:\n${request.prompt}` }],
|
|
168
|
+
tools: request.tools,
|
|
169
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
170
|
+
});
|
|
171
|
+
if (this.onUsage && response.usage) {
|
|
172
|
+
this.onUsage(request.agentId, response.model ?? this.model, {
|
|
173
|
+
inputTokens: response.usage.input_tokens,
|
|
174
|
+
outputTokens: response.usage.output_tokens,
|
|
175
|
+
cacheCreationInputTokens: response.usage.cache_creation_input_tokens,
|
|
176
|
+
cacheReadInputTokens: response.usage.cache_read_input_tokens,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
const toolCalls = [];
|
|
180
|
+
let text = '';
|
|
181
|
+
for (const block of response.content) {
|
|
182
|
+
if (block.type === 'text')
|
|
183
|
+
text = block.text;
|
|
184
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
185
|
+
else if (block.type === 'tool_use')
|
|
186
|
+
toolCalls.push({ toolName: block.name, toolInput: block.input });
|
|
187
|
+
}
|
|
188
|
+
return { result: this.parseJson(text || '{}'), toolCalls: toolCalls.length > 0 ? toolCalls : undefined };
|
|
189
|
+
}
|
|
190
|
+
parseJson(text) {
|
|
191
|
+
let cleaned = text.trim();
|
|
192
|
+
if (cleaned.startsWith('```')) {
|
|
193
|
+
cleaned = cleaned.replace(/^```(?:json)?\s*\n?/, '').replace(/\n?```\s*$/, '');
|
|
194
|
+
}
|
|
195
|
+
try {
|
|
196
|
+
return JSON.parse(cleaned);
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
const match = cleaned.match(/\{[\s\S]*\}/);
|
|
200
|
+
if (match) {
|
|
201
|
+
return JSON.parse(match[0]);
|
|
202
|
+
}
|
|
203
|
+
throw new Error(`Failed to parse AI response as JSON: ${text.slice(0, 200)}`);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
207
|
+
async loadSdk() {
|
|
208
|
+
try {
|
|
209
|
+
// @ts-expect-error -- optional peer dep, loaded at runtime
|
|
210
|
+
const mod = await import('@anthropic-ai/sdk');
|
|
211
|
+
return mod.default ?? mod.Anthropic;
|
|
212
|
+
}
|
|
213
|
+
catch {
|
|
214
|
+
throw new Error('Bot mode requires @anthropic-ai/sdk. Install it:\n npm install @anthropic-ai/sdk');
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=agent-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-provider.js","sourceRoot":"","sources":["../../src/bot/agent-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG/E,MAAM,SAAS,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;AAInE,MAAM,UAAU,qBAAqB,CACnC,QAA+B;IAE/B,IAAI,QAAQ,KAAK,MAAM;QAAE,OAAO,cAAc,EAAE,CAAC;IACjD,IAAI,OAAO,QAAQ,KAAK,QAAQ;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC5D,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAyB,EACzB,WAA6B,eAAe;IAE5C,sDAAsD;IACtD,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YAC/B,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAA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AAI,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IAC3G,CAAC;IAEO,SAAS,CAAC,IAAY;QAC5B,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC1B,IAAI,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QACjF,CAAC;QAED,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;YAC3C,IAAI,KAAK,EAAE,CAAC;gBACV,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9B,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,wCAAwC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QAChF,CAAC;IACH,CAAC;IAED,8DAA8D;IACtD,KAAK,CAAC,OAAO;QACnB,IAAI,CAAC;YACH,2DAA2D;YAC3D,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;YAC9C,OAAO,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,SAAS,CAAC;QACtC,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CACb,mFAAmF,CACpF,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ProviderInfo } from './types.js';
|
|
2
|
+
export declare function callCli(provider: string, prompt: string, model?: string): string;
|
|
3
|
+
export declare function callCliAsync(provider: string, prompt: string, model?: string): Promise<string>;
|
|
4
|
+
export declare function callApi(apiKey: string, model: string, maxTokens: number, systemPrompt: string, userPrompt: string): Promise<string>;
|
|
5
|
+
/**
|
|
6
|
+
* Call the platform-injected AI proxy (routes through IPC to the host process).
|
|
7
|
+
* Available when running inside the Studio sandbox.
|
|
8
|
+
*/
|
|
9
|
+
export declare function callPlatform(systemPrompt: string, userPrompt: string, model?: string, maxTokens?: number): Promise<string>;
|
|
10
|
+
/**
|
|
11
|
+
* Unified AI call that dispatches to the right backend based on provider type.
|
|
12
|
+
*/
|
|
13
|
+
export declare function callAI(pInfo: Pick<ProviderInfo, 'type' | 'apiKey' | 'model' | 'maxTokens'>, systemPrompt: string, userPrompt: string, defaultMaxTokens?: number): Promise<string>;
|
|
14
|
+
export declare function parseJsonResponse(text: string): Record<string, unknown>;
|
|
15
|
+
//# sourceMappingURL=ai-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-client.d.ts","sourceRoot":"","sources":["../../src/bot/ai-client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAe,MAAM,YAAY,CAAC;AAM5D,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAahF;AAED,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAqDpG;AAED,wBAAsB,OAAO,CAC3B,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAChD,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GACvC,OAAO,CAAC,MAAM,CAAC,CAgBjB;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAChC,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,CASjB;AAED;;GAEG;AACH,wBAAsB,MAAM,CAC1B,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,WAAW,CAAC,EACpE,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,gBAAgB,SAAO,GACtB,OAAO,CAAC,MAAM,CAAC,CAcjB;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASvE"}
|