@theowlops/boombot 0.0.0-stage → 1.1.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/README.md +69 -3
- package/dist/LICENSE +21 -0
- package/dist/bin/boombot.js +16 -0
- package/dist/cli/api-key.js +123 -0
- package/dist/cli/bin-bun.js +17 -0
- package/dist/cli/bin.js +34 -0
- package/dist/cli/cli/cli-error.js +61 -0
- package/dist/cli/cli/dispatch.js +138 -0
- package/dist/cli/cli/help.js +83 -0
- package/dist/cli/cli/parser.js +89 -0
- package/dist/cli/cli/registry.js +185 -0
- package/dist/cli/cli/spec.js +41 -0
- package/dist/cli/cli/suggest.js +125 -0
- package/dist/cli/cli/version.js +30 -0
- package/dist/cli/cli/vocabulary.js +87 -0
- package/dist/cli/commands/doctor.js +365 -0
- package/dist/cli/commands/gateway.js +290 -0
- package/dist/cli/commands/migrate.js +270 -0
- package/dist/cli/commands/plugin.js +97 -0
- package/dist/cli/commands/setup.js +244 -0
- package/dist/cli/config-file.js +133 -0
- package/dist/cli/master-key.js +78 -0
- package/dist/cli/open-browser.js +59 -0
- package/dist/cli/web-assets.js +58 -0
- package/dist/gateway/auth.js +46 -0
- package/dist/gateway/config-format.js +202 -0
- package/dist/gateway/config.js +427 -0
- package/dist/gateway/context.js +1 -0
- package/dist/gateway/env-file.js +129 -0
- package/dist/gateway/events.js +172 -0
- package/dist/gateway/guard/tagging.js +505 -0
- package/dist/gateway/handlers/index.js +66 -0
- package/dist/gateway/handlers/memory.js +54 -0
- package/dist/gateway/handlers/providers.js +73 -0
- package/dist/gateway/handlers/registry.js +39 -0
- package/dist/gateway/handlers/sessions.js +188 -0
- package/dist/gateway/handlers/system.js +12 -0
- package/dist/gateway/handlers/tasks.js +191 -0
- package/dist/gateway/handlers/turn.js +100 -0
- package/dist/gateway/index.js +126 -0
- package/dist/gateway/main.js +23 -0
- package/dist/gateway/server.js +354 -0
- package/dist/gateway/services/context-limits.js +75 -0
- package/dist/gateway/services/history-normalizer.js +42 -0
- package/dist/gateway/services/image-pipeline.js +56 -0
- package/dist/gateway/services/key-roulette-client.js +43 -0
- package/dist/gateway/services/llm-client.js +593 -0
- package/dist/gateway/services/llm-decoder.js +200 -0
- package/dist/gateway/services/local-fallback.js +135 -0
- package/dist/gateway/services/memory.js +511 -0
- package/dist/gateway/services/persistent-memory.js +196 -0
- package/dist/gateway/services/providers.js +44 -0
- package/dist/gateway/services/tasks.js +237 -0
- package/dist/gateway/services/verification.js +124 -0
- package/dist/gateway/services/vision-payload.js +48 -0
- package/dist/gateway/services.js +257 -0
- package/dist/gateway/session-snapshot.js +19 -0
- package/dist/gateway/sessions.js +701 -0
- package/dist/gateway/static.js +239 -0
- package/dist/gateway/turns/clarify-tool.js +57 -0
- package/dist/gateway/turns/cronjob-tool.js +96 -0
- package/dist/gateway/turns/deferred-tools.js +154 -0
- package/dist/gateway/turns/execute-code-tool.js +84 -0
- package/dist/gateway/turns/file-tool-defs.js +178 -0
- package/dist/gateway/turns/file-tool-ops.js +178 -0
- package/dist/gateway/turns/file-tool-scan.js +182 -0
- package/dist/gateway/turns/file-tool.js +302 -0
- package/dist/gateway/turns/index.js +416 -0
- package/dist/gateway/turns/jev-middleware.js +91 -0
- package/dist/gateway/turns/local-reply.js +156 -0
- package/dist/gateway/turns/mcp-client.js +643 -0
- package/dist/gateway/turns/memory-tool.js +171 -0
- package/dist/gateway/turns/middleware.js +96 -0
- package/dist/gateway/turns/python-core.js +397 -0
- package/dist/gateway/turns/routing/index.js +3 -0
- package/dist/gateway/turns/routing/intent-classifier.js +60 -0
- package/dist/gateway/turns/routing/planner-adapter.js +91 -0
- package/dist/gateway/turns/routing/types.js +1 -0
- package/dist/gateway/turns/runtime-deps.js +228 -0
- package/dist/gateway/turns/self-config-tool.js +277 -0
- package/dist/gateway/turns/service-types.js +11 -0
- package/dist/gateway/turns/service.js +820 -0
- package/dist/gateway/turns/session-adapter.js +158 -0
- package/dist/gateway/turns/session-tool.js +49 -0
- package/dist/gateway/turns/shell-tool.js +190 -0
- package/dist/gateway/turns/skill-tool.js +239 -0
- package/dist/gateway/turns/spillover.js +201 -0
- package/dist/gateway/turns/subagent-tool.js +140 -0
- package/dist/gateway/turns/system-prompt.js +121 -0
- package/dist/gateway/turns/tool-schema.js +90 -0
- package/dist/gateway/turns/turn-utils.js +58 -0
- package/dist/gateway/turns/vision-tool.js +120 -0
- package/dist/gateway/types.js +1 -0
- package/dist/native/win32-x64/boombot-native-host.exe +0 -0
- package/dist/node_modules/@boombot/channels/handlers.d.ts +9 -0
- package/dist/node_modules/@boombot/channels/handlers.js +109 -0
- package/dist/node_modules/@boombot/channels/index.d.ts +12 -0
- package/dist/node_modules/@boombot/channels/index.js +12 -0
- package/dist/node_modules/@boombot/channels/package.json +9 -0
- package/dist/node_modules/@boombot/channels/service.d.ts +62 -0
- package/dist/node_modules/@boombot/channels/service.js +608 -0
- package/dist/node_modules/@boombot/channels/tool.d.ts +10 -0
- package/dist/node_modules/@boombot/channels/tool.js +46 -0
- package/dist/node_modules/@boombot/channels/transports/common/dedup.d.ts +17 -0
- package/dist/node_modules/@boombot/channels/transports/common/dedup.js +42 -0
- package/dist/node_modules/@boombot/channels/transports/common/handoff.d.ts +19 -0
- package/dist/node_modules/@boombot/channels/transports/common/handoff.js +32 -0
- package/dist/node_modules/@boombot/channels/transports/common/index.d.ts +3 -0
- package/dist/node_modules/@boombot/channels/transports/common/index.js +3 -0
- package/dist/node_modules/@boombot/channels/transports/common/types.d.ts +99 -0
- package/dist/node_modules/@boombot/channels/transports/common/types.js +54 -0
- package/dist/node_modules/@boombot/channels/transports/common.d.ts +2 -0
- package/dist/node_modules/@boombot/channels/transports/common.js +2 -0
- package/dist/node_modules/@boombot/channels/transports/dedup/index.d.ts +1 -0
- package/dist/node_modules/@boombot/channels/transports/dedup/index.js +1 -0
- package/dist/node_modules/@boombot/channels/transports/dedup.d.ts +2 -0
- package/dist/node_modules/@boombot/channels/transports/dedup.js +2 -0
- package/dist/node_modules/@boombot/channels/transports/discord/index.d.ts +1 -0
- package/dist/node_modules/@boombot/channels/transports/discord/index.js +1 -0
- package/dist/node_modules/@boombot/channels/transports/discord/transport.d.ts +36 -0
- package/dist/node_modules/@boombot/channels/transports/discord/transport.js +199 -0
- package/dist/node_modules/@boombot/channels/transports/discord.d.ts +2 -0
- package/dist/node_modules/@boombot/channels/transports/discord.js +2 -0
- package/dist/node_modules/@boombot/channels/transports/handoff.d.ts +2 -0
- package/dist/node_modules/@boombot/channels/transports/handoff.js +2 -0
- package/dist/node_modules/@boombot/channels/transports/messenger/index.d.ts +1 -0
- package/dist/node_modules/@boombot/channels/transports/messenger/index.js +1 -0
- package/dist/node_modules/@boombot/channels/transports/messenger/transport.d.ts +34 -0
- package/dist/node_modules/@boombot/channels/transports/messenger/transport.js +180 -0
- package/dist/node_modules/@boombot/channels/transports/messenger.d.ts +2 -0
- package/dist/node_modules/@boombot/channels/transports/messenger.js +2 -0
- package/dist/node_modules/@boombot/channels/transports/slack/index.d.ts +1 -0
- package/dist/node_modules/@boombot/channels/transports/slack/index.js +1 -0
- package/dist/node_modules/@boombot/channels/transports/slack/transport.d.ts +35 -0
- package/dist/node_modules/@boombot/channels/transports/slack/transport.js +183 -0
- package/dist/node_modules/@boombot/channels/transports/slack.d.ts +2 -0
- package/dist/node_modules/@boombot/channels/transports/slack.js +2 -0
- package/dist/node_modules/@boombot/channels/transports/streamer/index.d.ts +1 -0
- package/dist/node_modules/@boombot/channels/transports/streamer/index.js +1 -0
- package/dist/node_modules/@boombot/channels/transports/streamer/streamer.d.ts +31 -0
- package/dist/node_modules/@boombot/channels/transports/streamer/streamer.js +141 -0
- package/dist/node_modules/@boombot/channels/transports/streamer.d.ts +2 -0
- package/dist/node_modules/@boombot/channels/transports/streamer.js +2 -0
- package/dist/node_modules/@boombot/channels/transports/telegram/index.d.ts +1 -0
- package/dist/node_modules/@boombot/channels/transports/telegram/index.js +1 -0
- package/dist/node_modules/@boombot/channels/transports/telegram/transport.d.ts +75 -0
- package/dist/node_modules/@boombot/channels/transports/telegram/transport.js +395 -0
- package/dist/node_modules/@boombot/channels/transports/telegram.d.ts +2 -0
- package/dist/node_modules/@boombot/channels/transports/telegram.js +2 -0
- package/dist/node_modules/@boombot/channels/transports/tiktok/index.d.ts +1 -0
- package/dist/node_modules/@boombot/channels/transports/tiktok/index.js +1 -0
- package/dist/node_modules/@boombot/channels/transports/tiktok/transport.d.ts +27 -0
- package/dist/node_modules/@boombot/channels/transports/tiktok/transport.js +97 -0
- package/dist/node_modules/@boombot/channels/transports/tiktok.d.ts +2 -0
- package/dist/node_modules/@boombot/channels/transports/tiktok.js +2 -0
- package/dist/node_modules/@boombot/channels/transports/whatsapp/index.d.ts +1 -0
- package/dist/node_modules/@boombot/channels/transports/whatsapp/index.js +1 -0
- package/dist/node_modules/@boombot/channels/transports/whatsapp/transport.d.ts +38 -0
- package/dist/node_modules/@boombot/channels/transports/whatsapp/transport.js +189 -0
- package/dist/node_modules/@boombot/channels/transports/whatsapp.d.ts +2 -0
- package/dist/node_modules/@boombot/channels/transports/whatsapp.js +2 -0
- package/dist/node_modules/@boombot/channels/transports/zalo/index.d.ts +2 -0
- package/dist/node_modules/@boombot/channels/transports/zalo/index.js +2 -0
- package/dist/node_modules/@boombot/channels/transports/zalo/oa.d.ts +28 -0
- package/dist/node_modules/@boombot/channels/transports/zalo/oa.js +94 -0
- package/dist/node_modules/@boombot/channels/transports/zalo/personal.d.ts +106 -0
- package/dist/node_modules/@boombot/channels/transports/zalo/personal.js +171 -0
- package/dist/node_modules/@boombot/channels/transports/zalo-personal.d.ts +2 -0
- package/dist/node_modules/@boombot/channels/transports/zalo-personal.js +2 -0
- package/dist/node_modules/@boombot/channels/transports/zalo.d.ts +2 -0
- package/dist/node_modules/@boombot/channels/transports/zalo.js +2 -0
- package/dist/node_modules/@boombot/core/agent-core/index.d.ts +12 -0
- package/dist/node_modules/@boombot/core/agent-core/index.js +12 -0
- package/dist/node_modules/@boombot/core/agent-core/middleware.d.ts +60 -0
- package/dist/node_modules/@boombot/core/agent-core/middleware.js +152 -0
- package/dist/node_modules/@boombot/core/agent-core/routing.d.ts +128 -0
- package/dist/node_modules/@boombot/core/agent-core/routing.js +437 -0
- package/dist/node_modules/@boombot/core/agent-core/runtime-deps.d.ts +88 -0
- package/dist/node_modules/@boombot/core/agent-core/runtime-deps.js +8 -0
- package/dist/node_modules/@boombot/core/agent-core/tool-errors.d.ts +44 -0
- package/dist/node_modules/@boombot/core/agent-core/tool-errors.js +60 -0
- package/dist/node_modules/@boombot/core/agent-core/turn-loop.d.ts +21 -0
- package/dist/node_modules/@boombot/core/agent-core/turn-loop.js +561 -0
- package/dist/node_modules/@boombot/core/agent-core/types.d.ts +189 -0
- package/dist/node_modules/@boombot/core/agent-core/types.js +7 -0
- package/dist/node_modules/@boombot/core/compaction/compactor.d.ts +19 -0
- package/dist/node_modules/@boombot/core/compaction/compactor.js +127 -0
- package/dist/node_modules/@boombot/core/compaction/estimator.d.ts +10 -0
- package/dist/node_modules/@boombot/core/compaction/estimator.js +48 -0
- package/dist/node_modules/@boombot/core/compaction/index.d.ts +3 -0
- package/dist/node_modules/@boombot/core/compaction/index.js +3 -0
- package/dist/node_modules/@boombot/core/compaction/types.d.ts +31 -0
- package/dist/node_modules/@boombot/core/compaction/types.js +7 -0
- package/dist/node_modules/@boombot/core/index.d.ts +9 -0
- package/dist/node_modules/@boombot/core/index.js +9 -0
- package/dist/node_modules/@boombot/core/jev/index.d.ts +2 -0
- package/dist/node_modules/@boombot/core/jev/index.js +2 -0
- package/dist/node_modules/@boombot/core/jev/jev.d.ts +30 -0
- package/dist/node_modules/@boombot/core/jev/jev.js +164 -0
- package/dist/node_modules/@boombot/core/jev/types.d.ts +22 -0
- package/dist/node_modules/@boombot/core/jev/types.js +1 -0
- package/dist/node_modules/@boombot/core/memory/consolidation/budget.d.ts +63 -0
- package/dist/node_modules/@boombot/core/memory/consolidation/budget.js +94 -0
- package/dist/node_modules/@boombot/core/memory/consolidation/consolidator.d.ts +152 -0
- package/dist/node_modules/@boombot/core/memory/consolidation/consolidator.js +318 -0
- package/dist/node_modules/@boombot/core/memory/consolidation/index.d.ts +12 -0
- package/dist/node_modules/@boombot/core/memory/consolidation/index.js +12 -0
- package/dist/node_modules/@boombot/core/memory/curation.d.ts +86 -0
- package/dist/node_modules/@boombot/core/memory/curation.js +120 -0
- package/dist/node_modules/@boombot/core/memory/errors.d.ts +12 -0
- package/dist/node_modules/@boombot/core/memory/errors.js +20 -0
- package/dist/node_modules/@boombot/core/memory/hybrid-search.d.ts +29 -0
- package/dist/node_modules/@boombot/core/memory/hybrid-search.js +52 -0
- package/dist/node_modules/@boombot/core/memory/index.d.ts +23 -0
- package/dist/node_modules/@boombot/core/memory/index.js +23 -0
- package/dist/node_modules/@boombot/core/memory/indexer.d.ts +47 -0
- package/dist/node_modules/@boombot/core/memory/indexer.js +138 -0
- package/dist/node_modules/@boombot/core/memory/lifecycle.d.ts +12 -0
- package/dist/node_modules/@boombot/core/memory/lifecycle.js +66 -0
- package/dist/node_modules/@boombot/core/memory/provider.d.ts +84 -0
- package/dist/node_modules/@boombot/core/memory/provider.js +117 -0
- package/dist/node_modules/@boombot/core/memory/recall.d.ts +7 -0
- package/dist/node_modules/@boombot/core/memory/recall.js +111 -0
- package/dist/node_modules/@boombot/core/memory/scope-resolver.d.ts +27 -0
- package/dist/node_modules/@boombot/core/memory/scope-resolver.js +60 -0
- package/dist/node_modules/@boombot/core/memory/search.d.ts +37 -0
- package/dist/node_modules/@boombot/core/memory/search.js +158 -0
- package/dist/node_modules/@boombot/core/memory/store.d.ts +60 -0
- package/dist/node_modules/@boombot/core/memory/store.js +289 -0
- package/dist/node_modules/@boombot/core/memory/types.d.ts +121 -0
- package/dist/node_modules/@boombot/core/memory/types.js +21 -0
- package/dist/node_modules/@boombot/core/memory/vector-index.d.ts +34 -0
- package/dist/node_modules/@boombot/core/memory/vector-index.js +65 -0
- package/dist/node_modules/@boombot/core/package.json +9 -0
- package/dist/node_modules/@boombot/core/reflection/classifier.d.ts +13 -0
- package/dist/node_modules/@boombot/core/reflection/classifier.js +77 -0
- package/dist/node_modules/@boombot/core/reflection/index.d.ts +2 -0
- package/dist/node_modules/@boombot/core/reflection/index.js +2 -0
- package/dist/node_modules/@boombot/core/reflection/types.d.ts +13 -0
- package/dist/node_modules/@boombot/core/reflection/types.js +4 -0
- package/dist/node_modules/@boombot/core/research/config.d.ts +89 -0
- package/dist/node_modules/@boombot/core/research/config.js +206 -0
- package/dist/node_modules/@boombot/core/research/crawl.d.ts +36 -0
- package/dist/node_modules/@boombot/core/research/crawl.js +179 -0
- package/dist/node_modules/@boombot/core/research/factory.d.ts +26 -0
- package/dist/node_modules/@boombot/core/research/factory.js +46 -0
- package/dist/node_modules/@boombot/core/research/http.d.ts +87 -0
- package/dist/node_modules/@boombot/core/research/http.js +250 -0
- package/dist/node_modules/@boombot/core/research/index.d.ts +17 -0
- package/dist/node_modules/@boombot/core/research/index.js +10 -0
- package/dist/node_modules/@boombot/core/research/orchestrator.d.ts +113 -0
- package/dist/node_modules/@boombot/core/research/orchestrator.js +252 -0
- package/dist/node_modules/@boombot/core/research/parse/docx.d.ts +24 -0
- package/dist/node_modules/@boombot/core/research/parse/docx.js +183 -0
- package/dist/node_modules/@boombot/core/research/parse/guards.d.ts +89 -0
- package/dist/node_modules/@boombot/core/research/parse/guards.js +171 -0
- package/dist/node_modules/@boombot/core/research/parse/index.d.ts +68 -0
- package/dist/node_modules/@boombot/core/research/parse/index.js +219 -0
- package/dist/node_modules/@boombot/core/research/parse/pdf.d.ts +38 -0
- package/dist/node_modules/@boombot/core/research/parse/pdf.js +567 -0
- package/dist/node_modules/@boombot/core/research/providers/arxiv.d.ts +9 -0
- package/dist/node_modules/@boombot/core/research/providers/arxiv.js +72 -0
- package/dist/node_modules/@boombot/core/research/providers/brave.d.ts +11 -0
- package/dist/node_modules/@boombot/core/research/providers/brave.js +36 -0
- package/dist/node_modules/@boombot/core/research/providers/duckduckgo.d.ts +9 -0
- package/dist/node_modules/@boombot/core/research/providers/duckduckgo.js +78 -0
- package/dist/node_modules/@boombot/core/research/providers/exa.d.ts +11 -0
- package/dist/node_modules/@boombot/core/research/providers/exa.js +34 -0
- package/dist/node_modules/@boombot/core/research/providers/firecrawl.d.ts +16 -0
- package/dist/node_modules/@boombot/core/research/providers/firecrawl.js +47 -0
- package/dist/node_modules/@boombot/core/research/providers/index.d.ts +17 -0
- package/dist/node_modules/@boombot/core/research/providers/index.js +11 -0
- package/dist/node_modules/@boombot/core/research/providers/jina.d.ts +13 -0
- package/dist/node_modules/@boombot/core/research/providers/jina.js +114 -0
- package/dist/node_modules/@boombot/core/research/providers/openalex.d.ts +14 -0
- package/dist/node_modules/@boombot/core/research/providers/openalex.js +66 -0
- package/dist/node_modules/@boombot/core/research/providers/semantic-scholar.d.ts +9 -0
- package/dist/node_modules/@boombot/core/research/providers/semantic-scholar.js +56 -0
- package/dist/node_modules/@boombot/core/research/providers/tavily.d.ts +11 -0
- package/dist/node_modules/@boombot/core/research/providers/tavily.js +35 -0
- package/dist/node_modules/@boombot/core/research/providers/wikipedia.d.ts +12 -0
- package/dist/node_modules/@boombot/core/research/providers/wikipedia.js +47 -0
- package/dist/node_modules/@boombot/core/research/tools.d.ts +27 -0
- package/dist/node_modules/@boombot/core/research/tools.js +251 -0
- package/dist/node_modules/@boombot/core/research/types.d.ts +133 -0
- package/dist/node_modules/@boombot/core/research/types.js +8 -0
- package/dist/node_modules/@boombot/core/research/wiring.d.ts +25 -0
- package/dist/node_modules/@boombot/core/research/wiring.js +51 -0
- package/dist/node_modules/@boombot/core/scheduler/cron.d.ts +34 -0
- package/dist/node_modules/@boombot/core/scheduler/cron.js +147 -0
- package/dist/node_modules/@boombot/core/scheduler/evaluator.d.ts +42 -0
- package/dist/node_modules/@boombot/core/scheduler/evaluator.js +148 -0
- package/dist/node_modules/@boombot/core/scheduler/index.d.ts +15 -0
- package/dist/node_modules/@boombot/core/scheduler/index.js +15 -0
- package/dist/node_modules/@boombot/core/scheduler/registry.d.ts +81 -0
- package/dist/node_modules/@boombot/core/scheduler/registry.js +263 -0
- package/dist/node_modules/@boombot/core/scheduler/runner.d.ts +59 -0
- package/dist/node_modules/@boombot/core/scheduler/runner.js +257 -0
- package/dist/node_modules/@boombot/core/scheduler/store.d.ts +150 -0
- package/dist/node_modules/@boombot/core/scheduler/store.js +526 -0
- package/dist/node_modules/@boombot/core/scheduler/timezone.d.ts +35 -0
- package/dist/node_modules/@boombot/core/scheduler/timezone.js +96 -0
- package/dist/node_modules/@boombot/core/scheduler/types.d.ts +157 -0
- package/dist/node_modules/@boombot/core/scheduler/types.js +89 -0
- package/dist/node_modules/@boombot/core/task-runner/index.d.ts +7 -0
- package/dist/node_modules/@boombot/core/task-runner/index.js +5 -0
- package/dist/node_modules/@boombot/core/task-runner/planner.d.ts +37 -0
- package/dist/node_modules/@boombot/core/task-runner/planner.js +154 -0
- package/dist/node_modules/@boombot/core/task-runner/runner.d.ts +8 -0
- package/dist/node_modules/@boombot/core/task-runner/runner.js +564 -0
- package/dist/node_modules/@boombot/core/task-runner/store.d.ts +28 -0
- package/dist/node_modules/@boombot/core/task-runner/store.js +126 -0
- package/dist/node_modules/@boombot/core/task-runner/types.d.ts +138 -0
- package/dist/node_modules/@boombot/core/task-runner/types.js +11 -0
- package/dist/node_modules/@boombot/core/workflow/dag.d.ts +16 -0
- package/dist/node_modules/@boombot/core/workflow/dag.js +109 -0
- package/dist/node_modules/@boombot/core/workflow/engine.d.ts +34 -0
- package/dist/node_modules/@boombot/core/workflow/engine.js +304 -0
- package/dist/node_modules/@boombot/core/workflow/index.d.ts +3 -0
- package/dist/node_modules/@boombot/core/workflow/index.js +3 -0
- package/dist/node_modules/@boombot/core/workflow/types.d.ts +98 -0
- package/dist/node_modules/@boombot/core/workflow/types.js +21 -0
- package/dist/node_modules/@boombot/cronjobs/handlers.d.ts +11 -0
- package/dist/node_modules/@boombot/cronjobs/handlers.js +174 -0
- package/dist/node_modules/@boombot/cronjobs/index.d.ts +2 -0
- package/dist/node_modules/@boombot/cronjobs/index.js +2 -0
- package/dist/node_modules/@boombot/cronjobs/package.json +9 -0
- package/dist/node_modules/@boombot/cronjobs/service.d.ts +53 -0
- package/dist/node_modules/@boombot/cronjobs/service.js +200 -0
- package/dist/node_modules/@boombot/plugins/index.d.ts +2 -0
- package/dist/node_modules/@boombot/plugins/index.js +2 -0
- package/dist/node_modules/@boombot/plugins/installer.d.ts +45 -0
- package/dist/node_modules/@boombot/plugins/installer.js +487 -0
- package/dist/node_modules/@boombot/plugins/manager.d.ts +23 -0
- package/dist/node_modules/@boombot/plugins/manager.js +243 -0
- package/dist/node_modules/@boombot/plugins/package.json +9 -0
- package/dist/node_modules/@boombot/protocol/gateway-protocol/commands-channels.d.ts +125 -0
- package/dist/node_modules/@boombot/protocol/gateway-protocol/commands-channels.js +76 -0
- package/dist/node_modules/@boombot/protocol/gateway-protocol/commands-plugins.d.ts +220 -0
- package/dist/node_modules/@boombot/protocol/gateway-protocol/commands-plugins.js +60 -0
- package/dist/node_modules/@boombot/protocol/gateway-protocol/commands-scheduler.d.ts +33 -0
- package/dist/node_modules/@boombot/protocol/gateway-protocol/commands-scheduler.js +25 -0
- package/dist/node_modules/@boombot/protocol/gateway-protocol/commands.d.ts +4349 -0
- package/dist/node_modules/@boombot/protocol/gateway-protocol/commands.js +563 -0
- package/dist/node_modules/@boombot/protocol/gateway-protocol/envelope.d.ts +32 -0
- package/dist/node_modules/@boombot/protocol/gateway-protocol/envelope.js +61 -0
- package/dist/node_modules/@boombot/protocol/gateway-protocol/errors.d.ts +13 -0
- package/dist/node_modules/@boombot/protocol/gateway-protocol/errors.js +16 -0
- package/dist/node_modules/@boombot/protocol/gateway-protocol/events.d.ts +567 -0
- package/dist/node_modules/@boombot/protocol/gateway-protocol/events.js +395 -0
- package/dist/node_modules/@boombot/protocol/gateway-protocol/index.d.ts +20 -0
- package/dist/node_modules/@boombot/protocol/gateway-protocol/index.js +13 -0
- package/dist/node_modules/@boombot/protocol/gateway-protocol/types.d.ts +91 -0
- package/dist/node_modules/@boombot/protocol/gateway-protocol/types.js +7 -0
- package/dist/node_modules/@boombot/protocol/index.d.ts +4 -0
- package/dist/node_modules/@boombot/protocol/index.js +3 -0
- package/dist/node_modules/@boombot/protocol/package.json +9 -0
- package/dist/node_modules/@boombot/protocol/plugin-sdk/channel.d.ts +41 -0
- package/dist/node_modules/@boombot/protocol/plugin-sdk/channel.js +17 -0
- package/dist/node_modules/@boombot/protocol/plugin-sdk/index.d.ts +10 -0
- package/dist/node_modules/@boombot/protocol/plugin-sdk/index.js +10 -0
- package/dist/node_modules/@boombot/protocol/plugin-sdk/manifest.d.ts +58 -0
- package/dist/node_modules/@boombot/protocol/plugin-sdk/manifest.js +116 -0
- package/dist/node_modules/@boombot/protocol/plugin-sdk/plugin.d.ts +25 -0
- package/dist/node_modules/@boombot/protocol/plugin-sdk/plugin.js +1 -0
- package/dist/node_modules/@boombot/protocol/providers/cipher.d.ts +7 -0
- package/dist/node_modules/@boombot/protocol/providers/cipher.js +52 -0
- package/dist/node_modules/@boombot/protocol/providers/index.d.ts +19 -0
- package/dist/node_modules/@boombot/protocol/providers/index.js +19 -0
- package/dist/node_modules/@boombot/protocol/providers/key-roulette.d.ts +79 -0
- package/dist/node_modules/@boombot/protocol/providers/key-roulette.js +81 -0
- package/dist/node_modules/@boombot/protocol/providers/probe.d.ts +29 -0
- package/dist/node_modules/@boombot/protocol/providers/probe.js +96 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/anthropic.d.ts +11 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/anthropic.js +11 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/custom.d.ts +22 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/custom.js +222 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/deepseek.d.ts +7 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/deepseek.js +9 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/google.d.ts +10 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/google.js +10 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/index.d.ts +31 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/index.js +56 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/local.d.ts +10 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/local.js +11 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/mistral.d.ts +7 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/mistral.js +9 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/openai-compatible.d.ts +10 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/openai-compatible.js +10 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/openai.d.ts +7 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/openai.js +11 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/types.d.ts +58 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/types.js +1 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/xai.d.ts +7 -0
- package/dist/node_modules/@boombot/protocol/providers/profiles/xai.js +10 -0
- package/dist/node_modules/@boombot/protocol/providers/request-profile.d.ts +102 -0
- package/dist/node_modules/@boombot/protocol/providers/request-profile.js +118 -0
- package/dist/node_modules/@boombot/protocol/providers/service.d.ts +2 -0
- package/dist/node_modules/@boombot/protocol/providers/service.js +418 -0
- package/dist/node_modules/@boombot/protocol/providers/types.d.ts +141 -0
- package/dist/node_modules/@boombot/protocol/providers/types.js +16 -0
- package/dist/node_modules/@boombot/sandbox/fs-path.d.ts +13 -0
- package/dist/node_modules/@boombot/sandbox/fs-path.js +79 -0
- package/dist/node_modules/@boombot/sandbox/index.d.ts +13 -0
- package/dist/node_modules/@boombot/sandbox/index.js +13 -0
- package/dist/node_modules/@boombot/sandbox/native.d.ts +39 -0
- package/dist/node_modules/@boombot/sandbox/native.js +224 -0
- package/dist/node_modules/@boombot/sandbox/package.json +9 -0
- package/dist/node_modules/@boombot/sandbox/sandbox.d.ts +92 -0
- package/dist/node_modules/@boombot/sandbox/sandbox.js +229 -0
- package/dist/node_modules/@boombot/security/harness-guard/boundary.d.ts +22 -0
- package/dist/node_modules/@boombot/security/harness-guard/boundary.js +105 -0
- package/dist/node_modules/@boombot/security/harness-guard/gates.d.ts +90 -0
- package/dist/node_modules/@boombot/security/harness-guard/gates.js +791 -0
- package/dist/node_modules/@boombot/security/harness-guard/index.d.ts +23 -0
- package/dist/node_modules/@boombot/security/harness-guard/index.js +23 -0
- package/dist/node_modules/@boombot/security/harness-guard/policy.d.ts +20 -0
- package/dist/node_modules/@boombot/security/harness-guard/policy.js +70 -0
- package/dist/node_modules/@boombot/security/harness-guard/sanitizer.d.ts +53 -0
- package/dist/node_modules/@boombot/security/harness-guard/sanitizer.js +145 -0
- package/dist/node_modules/@boombot/security/harness-guard/types.d.ts +71 -0
- package/dist/node_modules/@boombot/security/harness-guard/types.js +10 -0
- package/dist/node_modules/@boombot/security/harness-guard/verifier.d.ts +59 -0
- package/dist/node_modules/@boombot/security/harness-guard/verifier.js +169 -0
- package/dist/node_modules/@boombot/security/index.d.ts +5 -0
- package/dist/node_modules/@boombot/security/index.js +9 -0
- package/dist/node_modules/@boombot/security/package.json +9 -0
- package/dist/node_modules/@boombot/security/policy/approval.d.ts +117 -0
- package/dist/node_modules/@boombot/security/policy/approval.js +223 -0
- package/dist/node_modules/@boombot/security/reasoning-guard/claim-extractor.d.ts +10 -0
- package/dist/node_modules/@boombot/security/reasoning-guard/claim-extractor.js +124 -0
- package/dist/node_modules/@boombot/security/reasoning-guard/evidence-ledger.d.ts +25 -0
- package/dist/node_modules/@boombot/security/reasoning-guard/evidence-ledger.js +70 -0
- package/dist/node_modules/@boombot/security/reasoning-guard/gate.d.ts +38 -0
- package/dist/node_modules/@boombot/security/reasoning-guard/gate.js +61 -0
- package/dist/node_modules/@boombot/security/reasoning-guard/grounding-check.d.ts +12 -0
- package/dist/node_modules/@boombot/security/reasoning-guard/grounding-check.js +234 -0
- package/dist/node_modules/@boombot/security/reasoning-guard/index.d.ts +17 -0
- package/dist/node_modules/@boombot/security/reasoning-guard/index.js +13 -0
- package/dist/node_modules/@boombot/security/reasoning-guard/policy.d.ts +15 -0
- package/dist/node_modules/@boombot/security/reasoning-guard/policy.js +39 -0
- package/dist/node_modules/@boombot/security/reasoning-guard/types.d.ts +46 -0
- package/dist/node_modules/@boombot/security/reasoning-guard/types.js +7 -0
- package/dist/node_modules/@boombot/security/security/approval.d.ts +63 -0
- package/dist/node_modules/@boombot/security/security/approval.js +140 -0
- package/dist/node_modules/@boombot/security/security/audit.d.ts +39 -0
- package/dist/node_modules/@boombot/security/security/audit.js +70 -0
- package/dist/node_modules/@boombot/security/security/index.d.ts +12 -0
- package/dist/node_modules/@boombot/security/security/index.js +12 -0
- package/dist/node_modules/@boombot/security/security/trust.d.ts +79 -0
- package/dist/node_modules/@boombot/security/security/trust.js +87 -0
- package/dist/package.json +5 -0
- package/dist/proto/agent_core.proto +56 -0
- package/dist/python/agent-core-python/pyproject.toml +40 -0
- package/dist/python/agent-core-python/src/boombot_agent/__init__.py +5 -0
- package/dist/python/agent-core-python/src/boombot_agent/generated/__init__.py +0 -0
- package/dist/python/agent-core-python/src/boombot_agent/generated/agent_core_pb2.py +54 -0
- package/dist/python/agent-core-python/src/boombot_agent/generated/agent_core_pb2_grpc.py +140 -0
- package/dist/python/agent-core-python/src/boombot_agent/rpc.py +265 -0
- package/dist/python/agent-core-python/src/boombot_agent/turn.py +577 -0
- package/dist/python/agent-core-python/src/boombot_ml/__init__.py +12 -0
- package/dist/python/agent-core-python/src/boombot_ml/embeddings.py +58 -0
- package/dist/python/agent-core-python/src/boombot_ml/training.py +156 -0
- package/dist/python/agent-core-python/uv.lock +2856 -0
- package/dist/web/assets/ChatView-BZrSD-64.js +262 -0
- package/dist/web/assets/ChatView-Cahbjez6.css +1 -0
- package/dist/web/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/web/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/web/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/web/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/web/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/web/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/web/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/web/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/web/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/web/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/web/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/web/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/web/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/web/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/web/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/web/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/web/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/web/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/web/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/web/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/web/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/web/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/web/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/web/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/web/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/web/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/web/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/web/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/web/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/web/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/web/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/web/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/web/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/web/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/web/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/web/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/web/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/web/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/web/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/web/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/web/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/web/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/web/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/web/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/web/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/web/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/web/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/web/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/web/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/web/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/web/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/web/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/web/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/web/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/web/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/web/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/web/assets/MemoryView-BJbXqqs7.css +1 -0
- package/dist/web/assets/MemoryView-BfMq_6CD.js +1 -0
- package/dist/web/assets/SchedulesView-B22QmPR-.js +1 -0
- package/dist/web/assets/SchedulesView-C6XK7A8a.css +1 -0
- package/dist/web/assets/SessionsView-C1dqdhxI.css +1 -0
- package/dist/web/assets/SessionsView-DS0-aH2a.js +1 -0
- package/dist/web/assets/TasksView-Dtasg4hd.css +1 -0
- package/dist/web/assets/TasksView-ey0FLsW8.js +2 -0
- package/dist/web/assets/Textarea-DN3Zybl1.js +1 -0
- package/dist/web/assets/Tooltip-Bn2cqFPz.css +1 -0
- package/dist/web/assets/Tooltip-MzV2Gqnc.js +1 -0
- package/dist/web/assets/browser-Bnt73-Ub.js +8 -0
- package/dist/web/assets/index-BL8bi7Yt.css +1 -0
- package/dist/web/assets/index-CuPR73Tn.js +73 -0
- package/dist/web/favicon.svg +4 -0
- package/dist/web/index.html +26 -0
- package/dist/web/logo.jpg +0 -0
- package/dist/web/logo.png +0 -0
- package/package.json +51 -4
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scheduler tick loop.
|
|
3
|
+
*
|
|
4
|
+
* Each tick (non-overlapping by construction):
|
|
5
|
+
* 1. recoverExpiredLeases — crash recovery for claimed/running runs;
|
|
6
|
+
* 2. claimDueJobs — atomic claim + misfire-policy evaluation;
|
|
7
|
+
* 3. driveRuns — submit turns through the narrow `TurnSubmitter` port,
|
|
8
|
+
* bounded by a monotonic deadline (spec 04: wall clock for eligibility,
|
|
9
|
+
* monotonic clock for elapsed deadlines).
|
|
10
|
+
*
|
|
11
|
+
* The runner never executes schedule payloads itself: it only submits the
|
|
12
|
+
* registered prompt text as an agent turn with the run's idempotency key.
|
|
13
|
+
*/
|
|
14
|
+
import { randomUUID } from 'node:crypto';
|
|
15
|
+
import { performance } from 'node:perf_hooks';
|
|
16
|
+
import { parseCron } from './cron.js';
|
|
17
|
+
import { classifyMisfire, computeNextFire } from './evaluator.js';
|
|
18
|
+
import { buildClaimFires } from './registry.js';
|
|
19
|
+
import {} from './store.js';
|
|
20
|
+
import {} from './types.js';
|
|
21
|
+
const EMPTY_STATS = {
|
|
22
|
+
recovered: 0,
|
|
23
|
+
claimed: 0,
|
|
24
|
+
skippedConcurrency: 0,
|
|
25
|
+
driven: 0,
|
|
26
|
+
completed: 0,
|
|
27
|
+
retried: 0,
|
|
28
|
+
deadLettered: 0,
|
|
29
|
+
};
|
|
30
|
+
function asIso(ms) {
|
|
31
|
+
return new Date(ms).toISOString();
|
|
32
|
+
}
|
|
33
|
+
export class SchedulerRunner {
|
|
34
|
+
store;
|
|
35
|
+
submitter;
|
|
36
|
+
clock;
|
|
37
|
+
runnerId;
|
|
38
|
+
tickIntervalMs;
|
|
39
|
+
misfireGraceMs;
|
|
40
|
+
leaseMs;
|
|
41
|
+
maxTickDurationMs;
|
|
42
|
+
claimBatchSize;
|
|
43
|
+
jitter;
|
|
44
|
+
onError;
|
|
45
|
+
timer = null;
|
|
46
|
+
tickInFlight = null;
|
|
47
|
+
stopped = false;
|
|
48
|
+
constructor(options) {
|
|
49
|
+
this.store = options.store;
|
|
50
|
+
this.submitter = options.submitter;
|
|
51
|
+
this.clock = options.clock ?? { now: () => Date.now() };
|
|
52
|
+
this.runnerId = options.runnerId ?? `runner_${randomUUID().replace(/-/g, '')}`;
|
|
53
|
+
this.tickIntervalMs = options.tickIntervalMs ?? 1000;
|
|
54
|
+
this.misfireGraceMs = options.misfireGraceMs ?? 60000;
|
|
55
|
+
this.leaseMs = options.leaseMs ?? 60000;
|
|
56
|
+
this.maxTickDurationMs = options.maxTickDurationMs ?? 5000;
|
|
57
|
+
this.claimBatchSize = options.claimBatchSize ?? 100;
|
|
58
|
+
this.jitter = options.jitter ?? Math.random;
|
|
59
|
+
this.onError = options.onError ?? (() => undefined);
|
|
60
|
+
}
|
|
61
|
+
get id() {
|
|
62
|
+
return this.runnerId;
|
|
63
|
+
}
|
|
64
|
+
/** Start the non-overlapping tick chain. */
|
|
65
|
+
start() {
|
|
66
|
+
this.stopped = false;
|
|
67
|
+
this.scheduleNext();
|
|
68
|
+
}
|
|
69
|
+
/** Stop ticking; resolves when the in-flight tick (if any) settles. */
|
|
70
|
+
async stop() {
|
|
71
|
+
this.stopped = true;
|
|
72
|
+
if (this.timer !== null) {
|
|
73
|
+
clearTimeout(this.timer);
|
|
74
|
+
this.timer = null;
|
|
75
|
+
}
|
|
76
|
+
if (this.tickInFlight !== null) {
|
|
77
|
+
await this.tickInFlight;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
scheduleNext() {
|
|
81
|
+
if (this.stopped)
|
|
82
|
+
return;
|
|
83
|
+
this.timer = setTimeout(() => {
|
|
84
|
+
this.timer = null;
|
|
85
|
+
const tick = this.tickOnce().catch((error) => this.onError(error, 'drive'));
|
|
86
|
+
this.tickInFlight = tick.then(() => undefined);
|
|
87
|
+
void tick.finally(() => {
|
|
88
|
+
this.tickInFlight = null;
|
|
89
|
+
this.scheduleNext();
|
|
90
|
+
});
|
|
91
|
+
}, this.tickIntervalMs);
|
|
92
|
+
// Don't keep the process alive just for the scheduler in tests/scripts.
|
|
93
|
+
if (typeof this.timer.unref === 'function')
|
|
94
|
+
this.timer.unref();
|
|
95
|
+
}
|
|
96
|
+
/** Run one full tick. Exposed for tests; `start()` uses it internally. */
|
|
97
|
+
async tickOnce(nowMs) {
|
|
98
|
+
const now = nowMs ?? this.clock.now();
|
|
99
|
+
const stats = { ...EMPTY_STATS };
|
|
100
|
+
// 1. Crash recovery.
|
|
101
|
+
try {
|
|
102
|
+
const recovered = this.store.recoverExpiredLeases({
|
|
103
|
+
nowIso: asIso(now),
|
|
104
|
+
runnerId: this.runnerId,
|
|
105
|
+
leaseMs: this.leaseMs,
|
|
106
|
+
});
|
|
107
|
+
stats.recovered = recovered.length;
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
this.onError(error, 'recover');
|
|
111
|
+
}
|
|
112
|
+
// 2. Claim due jobs.
|
|
113
|
+
try {
|
|
114
|
+
const due = this.store.getDueJobs(asIso(now), this.claimBatchSize);
|
|
115
|
+
for (const job of due) {
|
|
116
|
+
const result = this.claimJob(job, now);
|
|
117
|
+
if (result === 'claimed')
|
|
118
|
+
stats.claimed += 1;
|
|
119
|
+
else if (result === 'skipped_concurrency')
|
|
120
|
+
stats.skippedConcurrency += 1;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
this.onError(error, 'claim');
|
|
125
|
+
}
|
|
126
|
+
// 3. Drive runs, bounded by a monotonic deadline.
|
|
127
|
+
const deadline = performance.now() + this.maxTickDurationMs;
|
|
128
|
+
try {
|
|
129
|
+
const drivable = this.store.getDrivableRuns(asIso(now), this.claimBatchSize);
|
|
130
|
+
for (const run of drivable) {
|
|
131
|
+
if (performance.now() >= deadline)
|
|
132
|
+
break;
|
|
133
|
+
await this.driveRun(run, now, stats);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
this.onError(error, 'drive');
|
|
138
|
+
}
|
|
139
|
+
return stats;
|
|
140
|
+
}
|
|
141
|
+
claimJob(job, nowMs) {
|
|
142
|
+
let schedule;
|
|
143
|
+
try {
|
|
144
|
+
schedule = parseCron(job.cronExpr);
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
return 'skipped'; // validated at creation; defensive
|
|
148
|
+
}
|
|
149
|
+
const nextRunAtMs = job.nextRunAt === null ? NaN : Date.parse(job.nextRunAt);
|
|
150
|
+
if (Number.isNaN(nextRunAtMs) || nextRunAtMs > nowMs)
|
|
151
|
+
return 'skipped';
|
|
152
|
+
const misfired = classifyMisfire(nextRunAtMs, nowMs, this.misfireGraceMs) === 'misfired';
|
|
153
|
+
let fireTimes;
|
|
154
|
+
let newNextRunAt;
|
|
155
|
+
if (!misfired) {
|
|
156
|
+
fireTimes = [asIso(nextRunAtMs)];
|
|
157
|
+
const next = computeNextFire(schedule, nextRunAtMs, job.timezone);
|
|
158
|
+
if (next === undefined)
|
|
159
|
+
return 'skipped';
|
|
160
|
+
newNextRunAt = asIso(next);
|
|
161
|
+
}
|
|
162
|
+
else if (job.missedRunPolicy === 'skip') {
|
|
163
|
+
fireTimes = [];
|
|
164
|
+
const next = computeNextFire(schedule, nowMs, job.timezone);
|
|
165
|
+
if (next === undefined)
|
|
166
|
+
return 'skipped';
|
|
167
|
+
newNextRunAt = asIso(next);
|
|
168
|
+
}
|
|
169
|
+
else if (job.missedRunPolicy === 'run_once') {
|
|
170
|
+
fireTimes = [asIso(nextRunAtMs)];
|
|
171
|
+
const next = computeNextFire(schedule, nowMs, job.timezone);
|
|
172
|
+
if (next === undefined)
|
|
173
|
+
return 'skipped';
|
|
174
|
+
newNextRunAt = asIso(next);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
// catch_up_bounded: oldest-first missed fires, capped.
|
|
178
|
+
fireTimes = [];
|
|
179
|
+
let cursor = nextRunAtMs;
|
|
180
|
+
for (let i = 0; i < job.maxCatchUp; i += 1) {
|
|
181
|
+
if (cursor > nowMs)
|
|
182
|
+
break;
|
|
183
|
+
fireTimes.push(asIso(cursor));
|
|
184
|
+
const next = computeNextFire(schedule, cursor, job.timezone);
|
|
185
|
+
if (next === undefined)
|
|
186
|
+
break;
|
|
187
|
+
cursor = next;
|
|
188
|
+
}
|
|
189
|
+
const resume = computeNextFire(schedule, nowMs, job.timezone);
|
|
190
|
+
if (resume === undefined)
|
|
191
|
+
return 'skipped';
|
|
192
|
+
newNextRunAt = asIso(resume);
|
|
193
|
+
}
|
|
194
|
+
const claim = this.store.claimJob({
|
|
195
|
+
jobId: job.id,
|
|
196
|
+
expectedNextRunAt: job.nextRunAt,
|
|
197
|
+
fires: buildClaimFires(job, fireTimes),
|
|
198
|
+
newNextRunAt,
|
|
199
|
+
concurrency: job.concurrencyPolicy,
|
|
200
|
+
runnerId: this.runnerId,
|
|
201
|
+
leaseExpiresAt: asIso(nowMs + this.leaseMs),
|
|
202
|
+
nowIso: asIso(nowMs),
|
|
203
|
+
});
|
|
204
|
+
if (claim.ok)
|
|
205
|
+
return 'claimed';
|
|
206
|
+
if (claim.reason === 'concurrency_forbid')
|
|
207
|
+
return 'skipped_concurrency';
|
|
208
|
+
return 'skipped';
|
|
209
|
+
}
|
|
210
|
+
async driveRun(run, nowMs, stats) {
|
|
211
|
+
const jobId = run.jobId;
|
|
212
|
+
const runId = run.id;
|
|
213
|
+
const job = this.store.getJob(jobId);
|
|
214
|
+
if (job === undefined || !job.enabled) {
|
|
215
|
+
this.store.deadLetterRun(runId, 'job_disabled', asIso(nowMs));
|
|
216
|
+
stats.deadLettered += 1;
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
if (!this.store.markRunning(runId, this.runnerId, asIso(nowMs))) {
|
|
220
|
+
return; // lost race with another driver
|
|
221
|
+
}
|
|
222
|
+
stats.driven += 1;
|
|
223
|
+
try {
|
|
224
|
+
await this.submitter.submit({
|
|
225
|
+
principalId: job.ownerPrincipalId,
|
|
226
|
+
text: job.promptText,
|
|
227
|
+
idempotencyKey: run.idempotencyKey,
|
|
228
|
+
// Run context: hosts (gateway scheduler service) need job/run ids
|
|
229
|
+
// to record delivery outcomes (`schedule.run-now` reads them back).
|
|
230
|
+
jobId: job.id,
|
|
231
|
+
jobName: job.name,
|
|
232
|
+
runId: run.id,
|
|
233
|
+
attempt: run.attempt,
|
|
234
|
+
});
|
|
235
|
+
this.store.completeRun(runId, asIso(nowMs));
|
|
236
|
+
stats.completed += 1;
|
|
237
|
+
}
|
|
238
|
+
catch {
|
|
239
|
+
const attempt = run.attempt + 1;
|
|
240
|
+
if (attempt > job.maxAttempts) {
|
|
241
|
+
this.store.deadLetterRun(runId, 'submit_failed_exhausted', asIso(nowMs));
|
|
242
|
+
stats.deadLettered += 1;
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
const delay = this.backoffDelay(job, attempt);
|
|
246
|
+
this.store.requeueRun(runId, attempt, asIso(nowMs + delay), asIso(nowMs + this.leaseMs), 'submit_failed');
|
|
247
|
+
stats.retried += 1;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/** Bounded exponential backoff with jitter. */
|
|
252
|
+
backoffDelay(job, attempt) {
|
|
253
|
+
const exp = job.baseRetryDelayMs * 2 ** (attempt - 1);
|
|
254
|
+
const capped = Math.min(job.maxRetryDelayMs, exp);
|
|
255
|
+
return capped + Math.floor(this.jitter() * job.baseRetryDelayMs);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { type ConcurrencyPolicy, type MissedRunPolicy, type RunStatus, type SchedulerJob } from './types.js';
|
|
2
|
+
export interface SchedulerRunRecord {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly jobId: string;
|
|
5
|
+
readonly idempotencyKey: string;
|
|
6
|
+
readonly scheduledFireAt: string;
|
|
7
|
+
readonly status: RunStatus;
|
|
8
|
+
readonly attempt: number;
|
|
9
|
+
readonly notBeforeAt: string;
|
|
10
|
+
readonly claimedBy: string;
|
|
11
|
+
readonly leaseExpiresAt: string;
|
|
12
|
+
readonly claimedAt: string;
|
|
13
|
+
readonly completedAt: string | null;
|
|
14
|
+
readonly errorCode: string | null;
|
|
15
|
+
}
|
|
16
|
+
/** Outcome of one dispatch attempt for a claimed scheduler run. */
|
|
17
|
+
export type DeliveryOutcome = 'fired' | 'completed' | 'failed';
|
|
18
|
+
/**
|
|
19
|
+
* One row of `scheduler_deliveries`: the gateway records `fired` when a run
|
|
20
|
+
* is claimed for dispatch, then `completed` (with the turn id) or `failed`
|
|
21
|
+
* (with the error). `schedule.run-now` reads these back to find the turn id
|
|
22
|
+
* of the manual fire.
|
|
23
|
+
*/
|
|
24
|
+
export interface SchedulerDeliveryRecord {
|
|
25
|
+
readonly runId: string;
|
|
26
|
+
readonly jobId: string;
|
|
27
|
+
readonly attempt: number;
|
|
28
|
+
readonly recordedAt: string;
|
|
29
|
+
readonly outcome: DeliveryOutcome;
|
|
30
|
+
readonly turnId: string | null;
|
|
31
|
+
readonly error: string | null;
|
|
32
|
+
}
|
|
33
|
+
/** Migration SQL for repo integration (would become migration v6). */
|
|
34
|
+
export declare const SCHEDULER_SCHEMA_SQL = "\nCREATE TABLE IF NOT EXISTS scheduler_schedules (\n id TEXT PRIMARY KEY,\n owner_principal_id TEXT NOT NULL,\n name TEXT NOT NULL,\n cron_expr TEXT NOT NULL,\n timezone TEXT NOT NULL,\n prompt_text TEXT NOT NULL,\n enabled INTEGER NOT NULL DEFAULT 1 CHECK (enabled IN (0, 1)),\n concurrency_policy TEXT NOT NULL DEFAULT 'forbid'\n CHECK (concurrency_policy IN ('forbid', 'allow', 'replace')),\n missed_run_policy TEXT NOT NULL DEFAULT 'skip'\n CHECK (missed_run_policy IN ('skip', 'run_once', 'catch_up_bounded')),\n max_catch_up INTEGER NOT NULL DEFAULT 3\n CHECK (max_catch_up BETWEEN 1 AND 100),\n max_attempts INTEGER NOT NULL DEFAULT 3\n CHECK (max_attempts BETWEEN 1 AND 10),\n base_retry_delay_ms INTEGER NOT NULL DEFAULT 5000\n CHECK (base_retry_delay_ms BETWEEN 100 AND 3600000),\n max_retry_delay_ms INTEGER NOT NULL DEFAULT 300000\n CHECK (max_retry_delay_ms BETWEEN 1000 AND 86400000),\n next_run_at TEXT,\n created_at TEXT NOT NULL,\n updated_at TEXT NOT NULL\n);\nCREATE INDEX IF NOT EXISTS scheduler_schedules_due\n ON scheduler_schedules (enabled, next_run_at);\nCREATE INDEX IF NOT EXISTS scheduler_schedules_owner\n ON scheduler_schedules (owner_principal_id);\n\nCREATE TABLE IF NOT EXISTS scheduler_runs (\n id TEXT PRIMARY KEY,\n job_id TEXT NOT NULL REFERENCES scheduler_schedules(id) ON DELETE CASCADE,\n idempotency_key TEXT NOT NULL,\n scheduled_fire_at TEXT NOT NULL,\n status TEXT NOT NULL CHECK (status IN\n ('claimed', 'running', 'completed', 'failed', 'dead_letter')),\n attempt INTEGER NOT NULL DEFAULT 1 CHECK (attempt >= 1),\n not_before_at TEXT NOT NULL,\n claimed_by TEXT NOT NULL,\n lease_expires_at TEXT NOT NULL,\n claimed_at TEXT NOT NULL,\n completed_at TEXT,\n error_code TEXT,\n UNIQUE (job_id, idempotency_key)\n);\nCREATE INDEX IF NOT EXISTS scheduler_runs_drivable\n ON scheduler_runs (status, not_before_at, lease_expires_at);\nCREATE INDEX IF NOT EXISTS scheduler_runs_job\n ON scheduler_runs (job_id, status);\n\nCREATE TABLE IF NOT EXISTS scheduler_deliveries (\n run_id TEXT NOT NULL,\n job_id TEXT NOT NULL REFERENCES scheduler_schedules(id) ON DELETE CASCADE,\n attempt INTEGER NOT NULL CHECK (attempt >= 1),\n recorded_at TEXT NOT NULL,\n outcome TEXT NOT NULL CHECK (outcome IN ('fired', 'completed', 'failed')),\n turn_id TEXT,\n error TEXT\n);\nCREATE INDEX IF NOT EXISTS scheduler_deliveries_job\n ON scheduler_deliveries (job_id, recorded_at DESC);\n";
|
|
35
|
+
export declare function newJobId(): string;
|
|
36
|
+
export declare function newRunId(): string;
|
|
37
|
+
/** Deterministic idempotency key per (job, fire time). */
|
|
38
|
+
export declare function idempotencyKeyFor(jobId: string, scheduledFireAtIso: string): string;
|
|
39
|
+
export interface ClaimFire {
|
|
40
|
+
readonly runId: string;
|
|
41
|
+
readonly idempotencyKey: string;
|
|
42
|
+
readonly scheduledFireAt: string;
|
|
43
|
+
}
|
|
44
|
+
export type ClaimResult = {
|
|
45
|
+
readonly ok: true;
|
|
46
|
+
readonly runs: readonly SchedulerRunRecord[];
|
|
47
|
+
} | {
|
|
48
|
+
readonly ok: false;
|
|
49
|
+
readonly reason: 'lost_race' | 'concurrency_forbid' | 'not_due' | 'disabled' | 'not_found';
|
|
50
|
+
};
|
|
51
|
+
export declare class ScheduleStore {
|
|
52
|
+
private readonly db;
|
|
53
|
+
private constructor();
|
|
54
|
+
/** Uniform error contract: storage failures surface as SchedulerError. */
|
|
55
|
+
private io;
|
|
56
|
+
static open(path: string): ScheduleStore;
|
|
57
|
+
static openMemory(): ScheduleStore;
|
|
58
|
+
close(): void;
|
|
59
|
+
private insertJobRow;
|
|
60
|
+
insertJob(job: SchedulerJob): void;
|
|
61
|
+
/**
|
|
62
|
+
* SECURITY FIX (quota check-then-act, low): count + insert inside one
|
|
63
|
+
* `BEGIN IMMEDIATE` transaction. The old code did `countByOwner()` then
|
|
64
|
+
* `insertJob()` as two statements — safe in a single process (no await
|
|
65
|
+
* between them), but two processes sharing one SQLite file could both pass
|
|
66
|
+
* the count check before either inserted, bypassing the per-principal
|
|
67
|
+
* quota. `BEGIN IMMEDIATE` takes the write lock up front, so exactly one
|
|
68
|
+
* contender wins the race; the loser sees the winner's row in its count.
|
|
69
|
+
*/
|
|
70
|
+
insertJobWithQuotaCheck(job: SchedulerJob, maxPerPrincipal: number): void;
|
|
71
|
+
getJob(id: string): SchedulerJob | undefined;
|
|
72
|
+
updateJob(id: string, patch: {
|
|
73
|
+
readonly name?: string;
|
|
74
|
+
readonly cronExpr?: string;
|
|
75
|
+
readonly timezone?: string;
|
|
76
|
+
readonly promptText?: string;
|
|
77
|
+
readonly enabled?: boolean;
|
|
78
|
+
readonly concurrencyPolicy?: ConcurrencyPolicy;
|
|
79
|
+
readonly missedRunPolicy?: MissedRunPolicy;
|
|
80
|
+
readonly maxCatchUp?: number;
|
|
81
|
+
readonly maxAttempts?: number;
|
|
82
|
+
readonly baseRetryDelayMs?: number;
|
|
83
|
+
readonly maxRetryDelayMs?: number;
|
|
84
|
+
readonly nextRunAt?: string | null;
|
|
85
|
+
readonly updatedAt: string;
|
|
86
|
+
}): SchedulerJob | undefined;
|
|
87
|
+
deleteJob(id: string): boolean;
|
|
88
|
+
countByOwner(ownerPrincipalId: string): number;
|
|
89
|
+
listByOwner(ownerPrincipalId: string): SchedulerJob[];
|
|
90
|
+
/** Jobs eligible to fire at `nowIso`, oldest first. */
|
|
91
|
+
getDueJobs(nowIso: string, limit: number): SchedulerJob[];
|
|
92
|
+
hasActiveRun(jobId: string): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Atomically claim a job: CAS on the previously-read `next_run_at`,
|
|
95
|
+
* insert run rows (UNIQUE backstop on idempotency), advance `next_run_at`.
|
|
96
|
+
* Concurrency is enforced inside the same transaction:
|
|
97
|
+
* - `forbid`: refuse when an active run exists;
|
|
98
|
+
* - `allow`: no check, overlapping runs permitted;
|
|
99
|
+
* - `replace`: supersede in-flight runs before claiming.
|
|
100
|
+
* Single BEGIN IMMEDIATE transaction — one winner under races.
|
|
101
|
+
*/
|
|
102
|
+
claimJob(input: {
|
|
103
|
+
readonly jobId: string;
|
|
104
|
+
readonly expectedNextRunAt: string | null;
|
|
105
|
+
readonly fires: readonly ClaimFire[];
|
|
106
|
+
readonly newNextRunAt: string | null;
|
|
107
|
+
readonly concurrency: ConcurrencyPolicy;
|
|
108
|
+
readonly runnerId: string;
|
|
109
|
+
readonly leaseExpiresAt: string;
|
|
110
|
+
readonly nowIso: string;
|
|
111
|
+
}): ClaimResult;
|
|
112
|
+
getRun(id: string): SchedulerRunRecord | undefined;
|
|
113
|
+
listRuns(jobId: string): SchedulerRunRecord[];
|
|
114
|
+
/** Runs this runner may drive now. */
|
|
115
|
+
getDrivableRuns(nowIso: string, limit: number): SchedulerRunRecord[];
|
|
116
|
+
markRunning(runId: string, runnerId: string, _nowIso: string): boolean;
|
|
117
|
+
completeRun(runId: string, nowIso: string): boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Requeue a failed run for retry. Returns false when the run is not in a
|
|
120
|
+
* retryable state (lost race with another driver).
|
|
121
|
+
*/
|
|
122
|
+
requeueRun(runId: string, attempt: number, notBeforeAt: string, leaseExpiresAt: string, errorCode: string): boolean;
|
|
123
|
+
deadLetterRun(runId: string, errorCode: string, nowIso: string): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Crash recovery: runs stuck in claimed/running past their lease.
|
|
126
|
+
* Exhausted attempts go to dead_letter; the rest are requeued with a fresh
|
|
127
|
+
* lease under the recovering runner. Returns requeued runs.
|
|
128
|
+
*/
|
|
129
|
+
recoverExpiredLeases(input: {
|
|
130
|
+
readonly nowIso: string;
|
|
131
|
+
readonly runnerId: string;
|
|
132
|
+
readonly leaseMs: number;
|
|
133
|
+
}): SchedulerRunRecord[];
|
|
134
|
+
/**
|
|
135
|
+
* Record one dispatch outcome for a run (`fired` when the run is claimed
|
|
136
|
+
* for dispatch, then `completed` with the turn id or `failed` with the
|
|
137
|
+
* error). Rows are append-only; readers take the latest per run.
|
|
138
|
+
*/
|
|
139
|
+
recordDelivery(input: {
|
|
140
|
+
readonly runId: string;
|
|
141
|
+
readonly jobId: string;
|
|
142
|
+
readonly attempt: number;
|
|
143
|
+
readonly recordedAt: string;
|
|
144
|
+
readonly outcome: DeliveryOutcome;
|
|
145
|
+
readonly turnId?: string | null;
|
|
146
|
+
readonly error?: string | null;
|
|
147
|
+
}): void;
|
|
148
|
+
/** Latest-first delivery rows for a job (bounded by `limit`). */
|
|
149
|
+
listDeliveries(jobId: string, limit: number): SchedulerDeliveryRecord[];
|
|
150
|
+
}
|