@theowlops/boombot 0.0.0-stage → 1.1.0
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 +230 -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
package/README.md
CHANGED
|
@@ -1,3 +1,69 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# @boombot/cli
|
|
2
|
+
|
|
3
|
+
Command-line interface for BoomBot: first-run setup wizard, health checks, OpenClaw migration, and the gateway launcher.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @boombot/cli@latest
|
|
9
|
+
# Or install once:
|
|
10
|
+
npm install -g @boombot/cli
|
|
11
|
+
boombot
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Requires Node.js **22.13+** and Python **3.11+** with `grpcio` and `protobuf`.
|
|
15
|
+
|
|
16
|
+
First launch creates `~/.boombot/config.json`, API keys and encryption keys without prompts, then opens the web UI. Add a provider in **Settings → Connection**. Keep the terminal open; `Ctrl+C` stops the gateway.
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
boombot --help # list commands
|
|
20
|
+
boombot doctor # run health checks
|
|
21
|
+
boombot doctor --json # machine-readable output
|
|
22
|
+
boombot setup # terminal configuration wizard
|
|
23
|
+
boombot migrate --from openclaw # migrate an OpenClaw config
|
|
24
|
+
boombot gateway # start the gateway (default)
|
|
25
|
+
boombot gateway --no-browser # headless mode
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Config lives in `~/.boombot/config.json` (override with `BOOMBOT_CONFIG`). The operator key is in `api.key`; provider encryption uses `master.key`. Automatic setup never prints either key.
|
|
29
|
+
|
|
30
|
+
## Standalone binary (no Node.js required)
|
|
31
|
+
|
|
32
|
+
Build a self-contained executable with Bun:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
node build-binary.mjs # current platform
|
|
36
|
+
node build-binary.mjs --target bun-linux-x64
|
|
37
|
+
node build-binary.mjs --target bun-darwin-arm64
|
|
38
|
+
node build-binary.mjs --target bun-windows-x64
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Output: `dist/bin/boombot-<platform>` (~80–120 MB, Bun runtime embedded).
|
|
42
|
+
|
|
43
|
+
The binary bundles the gateway statically — `boombot gateway` works without Node.js. See [BUILD.md](./BUILD.md) for details and gotchas.
|
|
44
|
+
|
|
45
|
+
Or via pnpm from the repo root:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pnpm --filter @boombot/cli build:binary
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Commands
|
|
52
|
+
|
|
53
|
+
| Command | Aliases | Description |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| `boombot setup` | `init` | Terminal wizard: host/port, data dir, providers; preserves existing settings |
|
|
56
|
+
| `boombot doctor` | `dr` | Checks config, permissions, data dir, gateway, providers, channels |
|
|
57
|
+
| `boombot migrate --from openclaw` | `import` | Migrates an OpenClaw config |
|
|
58
|
+
| `boombot` / `boombot gateway` | `serve` | First-run setup, then starts the gateway |
|
|
59
|
+
|
|
60
|
+
## Framework
|
|
61
|
+
|
|
62
|
+
Every command is a declarative `CommandSpec` in `src/cli/registry.ts`. Help text is generated from specs; `bin.ts` only parses argv and dispatches. Exit codes: `0` ok, `1` runtime error, `2` usage error. Typos get "did you mean?" suggestions.
|
|
63
|
+
|
|
64
|
+
## Test / typecheck
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pnpm test # vitest run
|
|
68
|
+
pnpm typecheck # tsc --noEmit
|
|
69
|
+
```
|
package/dist/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) BoomBot contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// @boombot/cli — global `boombot` bin entry.
|
|
3
|
+
//
|
|
4
|
+
// The compiled CLI lives in ../cli/ (tsc output of apps/cli/src). This tiny
|
|
5
|
+
// wrapper exists so the published bin path is exactly `dist/bin/boombot.js`
|
|
6
|
+
// while keeping one-file-per-source emit (readable stack traces, no bundler).
|
|
7
|
+
import console from 'node:console';
|
|
8
|
+
import process from 'node:process';
|
|
9
|
+
|
|
10
|
+
const [major, minor] = process.versions.node.split('.').map(Number);
|
|
11
|
+
if (!((major === 22 && minor >= 13) || major >= 24)) {
|
|
12
|
+
console.error('BoomBot requires Node.js 22.13+ (22.x) or 24+. Install a supported Node.js version, then run boombot again.');
|
|
13
|
+
process.exitCode = 1;
|
|
14
|
+
} else {
|
|
15
|
+
await import('../cli/bin.js');
|
|
16
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gateway API key — the bearer token every client sends to `/v1/commands`.
|
|
3
|
+
*
|
|
4
|
+
* `boombot setup` used to generate the key, print it once, and keep only its
|
|
5
|
+
* sha256. That made it unrecoverable: a hash cannot be turned back into the key,
|
|
6
|
+
* so anyone who missed the one-time printout had no way to fill in the web UI's
|
|
7
|
+
* "API key" field — the app asked for a secret that no longer existed anywhere.
|
|
8
|
+
*
|
|
9
|
+
* The key is now stored at `~/.boombot/api.key` (mode 0600 on POSIX), the same
|
|
10
|
+
* place and the same reasoning as `master.key`: a local secret this machine's CLI
|
|
11
|
+
* and browser need, on a filesystem the operator already controls. It is strictly
|
|
12
|
+
* less sensitive than `master.key`, which is the KEK that decrypts provider
|
|
13
|
+
* credentials. On Windows `chmod` is a no-op — see SECURITY.md §5.
|
|
14
|
+
*
|
|
15
|
+
* `BOOMBOT_API_KEY` wins when set, matching the gateway's own precedence (see
|
|
16
|
+
* `resolveApiKeyHash` in `agent-worker/src/config.ts`).
|
|
17
|
+
*
|
|
18
|
+
* Never log or print the raw key outside the one-time `boombot setup` notice and
|
|
19
|
+
* the browser bootstrap URL.
|
|
20
|
+
*/
|
|
21
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, chmodSync } from 'node:fs';
|
|
22
|
+
import path from 'node:path';
|
|
23
|
+
import { generateApiKey, hashApiKey, resolveConfigPath } from "./config-file.js";
|
|
24
|
+
/**
|
|
25
|
+
* Default API-key path: `api.key` next to the config file
|
|
26
|
+
* (`~/.boombot/api.key` unless `$BOOMBOT_CONFIG` points elsewhere).
|
|
27
|
+
*/
|
|
28
|
+
export function resolveApiKeyPath(configPath = resolveConfigPath()) {
|
|
29
|
+
return path.join(path.dirname(configPath), 'api.key');
|
|
30
|
+
}
|
|
31
|
+
/** Read the stored API key, or `null` when absent/empty/unreadable. */
|
|
32
|
+
export function loadApiKey(keyPath = resolveApiKeyPath()) {
|
|
33
|
+
let raw;
|
|
34
|
+
try {
|
|
35
|
+
raw = readFileSync(keyPath, 'utf8');
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const key = raw.trim();
|
|
41
|
+
return key === '' ? null : key;
|
|
42
|
+
}
|
|
43
|
+
/** True when an API key is available (file or environment). */
|
|
44
|
+
export function hasApiKey(keyPath = resolveApiKeyPath()) {
|
|
45
|
+
const fromEnv = process.env['BOOMBOT_API_KEY'];
|
|
46
|
+
if (fromEnv !== undefined && fromEnv !== '')
|
|
47
|
+
return true;
|
|
48
|
+
return existsSync(keyPath) && loadApiKey(keyPath) !== null;
|
|
49
|
+
}
|
|
50
|
+
/** Persist `key` to `keyPath`, 0600 on POSIX (best-effort on Windows). */
|
|
51
|
+
export function saveApiKey(key, keyPath = resolveApiKeyPath()) {
|
|
52
|
+
mkdirSync(path.dirname(keyPath), { recursive: true });
|
|
53
|
+
writeFileSync(keyPath, `${key}\n`, { encoding: 'utf8', mode: 0o600 });
|
|
54
|
+
if (process.platform !== 'win32') {
|
|
55
|
+
chmodSync(keyPath, 0o600);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Return the existing API key, generating and persisting a fresh one when none
|
|
60
|
+
* is found. Precedence mirrors the gateway: environment first, then file.
|
|
61
|
+
*
|
|
62
|
+
* An existing key is NEVER regenerated — that would silently lock out every
|
|
63
|
+
* client already holding the current one.
|
|
64
|
+
*/
|
|
65
|
+
export function ensureApiKey(keyPath = resolveApiKeyPath()) {
|
|
66
|
+
const fromEnv = process.env['BOOMBOT_API_KEY'];
|
|
67
|
+
if (fromEnv !== undefined && fromEnv !== '') {
|
|
68
|
+
return {
|
|
69
|
+
apiKey: fromEnv,
|
|
70
|
+
apiKeyHash: hashApiKey(fromEnv),
|
|
71
|
+
keyPath: '',
|
|
72
|
+
created: false,
|
|
73
|
+
fromEnv: true,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
const existing = loadApiKey(keyPath);
|
|
77
|
+
if (existing !== null) {
|
|
78
|
+
return {
|
|
79
|
+
apiKey: existing,
|
|
80
|
+
apiKeyHash: hashApiKey(existing),
|
|
81
|
+
keyPath,
|
|
82
|
+
created: false,
|
|
83
|
+
fromEnv: false,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
const { apiKey, apiKeyHash } = generateApiKey();
|
|
87
|
+
saveApiKey(apiKey, keyPath);
|
|
88
|
+
return { apiKey, apiKeyHash, keyPath, created: true, fromEnv: false };
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The key that is actually in force: `BOOMBOT_API_KEY` when set, else the file.
|
|
92
|
+
*
|
|
93
|
+
* Every caller must go through this rather than `loadApiKey` directly. The
|
|
94
|
+
* gateway resolves the operator's key from the environment first, so anything
|
|
95
|
+
* that reads only the file disagrees with it — and the disagreement shows up as
|
|
96
|
+
* a browser signed in with a key the gateway rejects.
|
|
97
|
+
*/
|
|
98
|
+
export function effectiveApiKey(keyPath = resolveApiKeyPath()) {
|
|
99
|
+
const fromEnv = process.env['BOOMBOT_API_KEY'];
|
|
100
|
+
if (fromEnv !== undefined && fromEnv !== '')
|
|
101
|
+
return fromEnv;
|
|
102
|
+
return loadApiKey(keyPath);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Does the key in force still hash to `expectedHash`?
|
|
106
|
+
*
|
|
107
|
+
* `boombot gateway` hands this key to the browser while the gateway authenticates
|
|
108
|
+
* against `config.json`'s hash. If the two drift apart — an old `api.key` beside
|
|
109
|
+
* a config rewritten by a later `boombot setup` — the UI receives a key that fails
|
|
110
|
+
* with UNAUTHORIZED and looks like a broken gateway. Callers use this to say what
|
|
111
|
+
* actually happened.
|
|
112
|
+
*
|
|
113
|
+
* `null` means "cannot tell": no key in force at all, or no hash configured (in
|
|
114
|
+
* which case the gateway fails closed on every request regardless).
|
|
115
|
+
*/
|
|
116
|
+
export function apiKeyMatchesHash(expectedHash, keyPath = resolveApiKeyPath()) {
|
|
117
|
+
if (expectedHash === undefined || expectedHash === '')
|
|
118
|
+
return null;
|
|
119
|
+
const key = effectiveApiKey(keyPath);
|
|
120
|
+
if (key === null)
|
|
121
|
+
return null;
|
|
122
|
+
return hashApiKey(key) === expectedHash;
|
|
123
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* Bun `--compile` entry point for the standalone BoomBot CLI binary.
|
|
4
|
+
*
|
|
5
|
+
* Statically imports the gateway (`@boombot/agent-worker`) so Bun bundles it.
|
|
6
|
+
* The bundled gateway is exposed via `globalThis.__BOOMBOT_BUNDLED_GATEWAY__`,
|
|
7
|
+
* which `src/commands/gateway.ts` checks before its dynamic-import path.
|
|
8
|
+
*
|
|
9
|
+
* This file is ONLY used by `build-binary.mjs` — the `tsc` build uses `src/bin.ts`.
|
|
10
|
+
*/
|
|
11
|
+
import { startGateway, startGatewayManaged } from '@boombot/gateway';
|
|
12
|
+
globalThis.__BOOMBOT_BUNDLED_GATEWAY__ = {
|
|
13
|
+
startGateway,
|
|
14
|
+
startGatewayManaged,
|
|
15
|
+
};
|
|
16
|
+
// Re-export the CLI entry — this becomes the binary's main.
|
|
17
|
+
export * from "./bin.js";
|
package/dist/cli/bin.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `boombot` — command-line interface.
|
|
4
|
+
*
|
|
5
|
+
* Thin entrypoint: parse argv → dispatch against the declarative registry
|
|
6
|
+
* (`src/cli/registry.ts`) → structured errors with conventional exit codes.
|
|
7
|
+
* All command knowledge lives in specs; this file knows nothing about
|
|
8
|
+
* individual commands.
|
|
9
|
+
*/
|
|
10
|
+
import { CliError, formatCliError } from "./cli/cli-error.js";
|
|
11
|
+
import { dispatch } from "./cli/dispatch.js";
|
|
12
|
+
import { REGISTRY } from "./cli/registry.js";
|
|
13
|
+
import { resolveCliVersion } from "./cli/version.js";
|
|
14
|
+
async function main() {
|
|
15
|
+
const argv = process.argv.slice(2);
|
|
16
|
+
// Pre-scan so even an unparseable invocation can render `--json` errors.
|
|
17
|
+
const json = argv.includes('--json');
|
|
18
|
+
try {
|
|
19
|
+
process.exitCode = await dispatch(REGISTRY, argv, {
|
|
20
|
+
version: resolveCliVersion(), defaultCommand: ['gateway'],
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
const text = formatCliError(err, json);
|
|
25
|
+
if (json) {
|
|
26
|
+
console.log(text);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
console.error(text);
|
|
30
|
+
}
|
|
31
|
+
process.exitCode = err instanceof CliError ? err.exitCode : 1;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
void main();
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured CLI errors — orca-inspired.
|
|
3
|
+
*
|
|
4
|
+
* Every failure carries a machine-readable `code`, a conventional exit code
|
|
5
|
+
* and recovery hints (`suggestions` + `nextSteps`). `--json` prints the same
|
|
6
|
+
* shape agents can parse; humans get a short message with "did you mean?".
|
|
7
|
+
*
|
|
8
|
+
* Exit codes: 0 ok · 1 runtime error · 2 usage error (bad command/flag).
|
|
9
|
+
*/
|
|
10
|
+
export const EXIT_OK = 0;
|
|
11
|
+
export const EXIT_RUNTIME_ERROR = 1;
|
|
12
|
+
export const EXIT_USAGE_ERROR = 2;
|
|
13
|
+
export class CliError extends Error {
|
|
14
|
+
code;
|
|
15
|
+
exitCode;
|
|
16
|
+
suggestions;
|
|
17
|
+
nextSteps;
|
|
18
|
+
constructor(options) {
|
|
19
|
+
super(options.message);
|
|
20
|
+
this.name = 'CliError';
|
|
21
|
+
this.code = options.code;
|
|
22
|
+
this.exitCode = options.code === 'RUNTIME_ERROR' ? EXIT_RUNTIME_ERROR : EXIT_USAGE_ERROR;
|
|
23
|
+
this.suggestions = options.suggestions ?? [];
|
|
24
|
+
this.nextSteps = options.nextSteps ?? [];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** Wrap an unexpected failure so `--json` stays machine-readable. */
|
|
28
|
+
export function toCliError(error) {
|
|
29
|
+
if (error instanceof CliError)
|
|
30
|
+
return error;
|
|
31
|
+
return new CliError({
|
|
32
|
+
code: 'RUNTIME_ERROR',
|
|
33
|
+
message: error instanceof Error ? error.message : String(error),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Render any error for output. Human mode prints the message plus recovery
|
|
38
|
+
* hints to stderr; `--json` prints a stable envelope to stdout.
|
|
39
|
+
*/
|
|
40
|
+
export function formatCliError(error, json) {
|
|
41
|
+
const cli = toCliError(error);
|
|
42
|
+
if (json) {
|
|
43
|
+
const envelope = {
|
|
44
|
+
ok: false,
|
|
45
|
+
error: {
|
|
46
|
+
code: cli.code,
|
|
47
|
+
message: cli.message,
|
|
48
|
+
suggestions: cli.suggestions,
|
|
49
|
+
nextSteps: cli.nextSteps,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
return JSON.stringify(envelope, null, 2);
|
|
53
|
+
}
|
|
54
|
+
const lines = [`boombot: ${cli.message}`];
|
|
55
|
+
if (cli.suggestions.length > 0) {
|
|
56
|
+
lines.push(`Did you mean: ${cli.suggestions.map((s) => `boombot ${s}`).join(', ')}?`);
|
|
57
|
+
}
|
|
58
|
+
for (const step of cli.nextSteps)
|
|
59
|
+
lines.push(`Next step: ${step}`);
|
|
60
|
+
return lines.join('\n');
|
|
61
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command dispatch — orca-inspired.
|
|
3
|
+
*
|
|
4
|
+
* parse argv → match the LONGEST registered path/alias prefix (nested
|
|
5
|
+
* subcommands work from day one) → validate flags against the spec →
|
|
6
|
+
* run the handler. Unknown commands/flags produce CliErrors with
|
|
7
|
+
* "did you mean?" suggestions instead of a bare crash.
|
|
8
|
+
*/
|
|
9
|
+
import { isValidProfileName } from "../config-file.js";
|
|
10
|
+
import { CliError, EXIT_OK } from "./cli-error.js";
|
|
11
|
+
import { renderCommandHelp, renderRootHelp } from "./help.js";
|
|
12
|
+
import { parseArgv } from "./parser.js";
|
|
13
|
+
import { GLOBAL_FLAGS, specPaths } from "./spec.js";
|
|
14
|
+
import { suggestCommands, suggestFlags } from "./suggest.js";
|
|
15
|
+
function findMatch(registry, positionals) {
|
|
16
|
+
// Longest prefix first so nested paths shadow their parents.
|
|
17
|
+
for (let len = positionals.length; len >= 1; len--) {
|
|
18
|
+
const candidate = positionals.slice(0, len);
|
|
19
|
+
for (const command of registry) {
|
|
20
|
+
for (const p of specPaths(command.spec)) {
|
|
21
|
+
if (p.length === candidate.length && p.every((part, i) => part === candidate[i])) {
|
|
22
|
+
return { command, consumed: len };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
function validFlagNames(spec) {
|
|
30
|
+
const names = new Set();
|
|
31
|
+
for (const f of spec.flags)
|
|
32
|
+
names.add(f.name);
|
|
33
|
+
for (const f of GLOBAL_FLAGS)
|
|
34
|
+
names.add(f.name);
|
|
35
|
+
return [...names];
|
|
36
|
+
}
|
|
37
|
+
function flagSpecFor(spec, name) {
|
|
38
|
+
for (const f of spec.flags)
|
|
39
|
+
if (f.name === name)
|
|
40
|
+
return f;
|
|
41
|
+
for (const f of GLOBAL_FLAGS)
|
|
42
|
+
if (f.name === name)
|
|
43
|
+
return f;
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
export async function dispatch(registry, argv, opts) {
|
|
47
|
+
const program = opts.programName ?? 'boombot';
|
|
48
|
+
const parsed = parseArgv(argv);
|
|
49
|
+
if (parsed.version) {
|
|
50
|
+
console.log(opts.version);
|
|
51
|
+
return EXIT_OK;
|
|
52
|
+
}
|
|
53
|
+
if (parsed.positionals.length === 0) {
|
|
54
|
+
if (!parsed.help && opts.defaultCommand?.length) {
|
|
55
|
+
return dispatch(registry, [...opts.defaultCommand, ...argv], opts);
|
|
56
|
+
}
|
|
57
|
+
// `boombot` or `boombot --help` (or only flags): root help. An explicit
|
|
58
|
+
// --help is success; a bare invocation is a usage error (exit 2),
|
|
59
|
+
// preserving the old exit-nonzero-on-no-command contract.
|
|
60
|
+
console.log(renderRootHelp(registry, { version: opts.version, programName: program }));
|
|
61
|
+
return parsed.help ? EXIT_OK : 2;
|
|
62
|
+
}
|
|
63
|
+
const match = findMatch(registry, parsed.positionals);
|
|
64
|
+
if (match === null) {
|
|
65
|
+
const suggestions = suggestCommands(registry.map((c) => c.spec), [...parsed.positionals]);
|
|
66
|
+
throw new CliError({
|
|
67
|
+
code: 'UNKNOWN_COMMAND',
|
|
68
|
+
message: `unknown command: ${parsed.positionals.join(' ')}`,
|
|
69
|
+
suggestions,
|
|
70
|
+
nextSteps: suggestions.length > 0
|
|
71
|
+
? []
|
|
72
|
+
: [`Run \`${program} --help\` for the command list.`],
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
const { command, consumed } = match;
|
|
76
|
+
const extra = parsed.positionals.slice(consumed);
|
|
77
|
+
if (parsed.help) {
|
|
78
|
+
console.log(renderCommandHelp(command.spec, { programName: program }));
|
|
79
|
+
return EXIT_OK;
|
|
80
|
+
}
|
|
81
|
+
if (extra.length > 0 && command.spec.acceptsPositionals !== true) {
|
|
82
|
+
throw new CliError({
|
|
83
|
+
code: 'UNEXPECTED_ARGUMENT',
|
|
84
|
+
message: `unexpected argument: ${extra.join(' ')}`,
|
|
85
|
+
nextSteps: [`Run \`${program} ${command.spec.path.join(' ')} --help\` for usage.`],
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
// Flag validation against the spec (+ globals).
|
|
89
|
+
const valid = validFlagNames(command.spec);
|
|
90
|
+
for (const name of Object.keys(parsed.flags)) {
|
|
91
|
+
const decl = flagSpecFor(command.spec, name);
|
|
92
|
+
if (decl === undefined) {
|
|
93
|
+
const suggestions = suggestFlags(name, valid);
|
|
94
|
+
throw new CliError({
|
|
95
|
+
code: 'UNKNOWN_FLAG',
|
|
96
|
+
message: `unknown flag: --${name}`,
|
|
97
|
+
suggestions: suggestions.map((s) => `${command.spec.path.join(' ')} --${s}`),
|
|
98
|
+
nextSteps: [
|
|
99
|
+
`Valid flags: ${valid
|
|
100
|
+
.sort()
|
|
101
|
+
.map((n) => `--${n}`)
|
|
102
|
+
.join(', ')}`,
|
|
103
|
+
],
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (decl.takesValue && parsed.flags[name] === true) {
|
|
107
|
+
throw new CliError({
|
|
108
|
+
code: 'MISSING_FLAG_VALUE',
|
|
109
|
+
message: `--${name} requires a value`,
|
|
110
|
+
nextSteps: [`Run \`${program} ${command.spec.path.join(' ')} --help\` for usage.`],
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// `--config` keeps its historical meaning: env override before handlers run.
|
|
115
|
+
const configFlag = parsed.flags['config'];
|
|
116
|
+
const profileFlag = parsed.flags['profile'];
|
|
117
|
+
const profile = typeof profileFlag === 'string' ? profileFlag : process.env['BOOMBOT_PROFILE'];
|
|
118
|
+
if ((typeof profileFlag === 'string' && !isValidProfileName(profileFlag)) ||
|
|
119
|
+
(profileFlag === undefined && profile !== undefined && profile !== '' && !isValidProfileName(profile))) {
|
|
120
|
+
throw new CliError({
|
|
121
|
+
code: 'INVALID_FLAG_VALUE',
|
|
122
|
+
message: 'profile must match [a-z0-9][a-z0-9_-]{0,63}',
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
if (typeof configFlag === 'string' && configFlag !== '') {
|
|
126
|
+
process.env['BOOMBOT_CONFIG'] = configFlag;
|
|
127
|
+
}
|
|
128
|
+
if (typeof profileFlag === 'string')
|
|
129
|
+
process.env['BOOMBOT_PROFILE'] = profileFlag;
|
|
130
|
+
const ctx = {
|
|
131
|
+
flags: parsed.flags,
|
|
132
|
+
positionals: extra,
|
|
133
|
+
json: parsed.json,
|
|
134
|
+
rawArgs: argv,
|
|
135
|
+
};
|
|
136
|
+
const code = await command.handler(ctx);
|
|
137
|
+
return code ?? EXIT_OK;
|
|
138
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Help text — GENERATED from the command registry, never hand-written.
|
|
3
|
+
*
|
|
4
|
+
* If a command exists in the registry, it shows up in `--help` with the
|
|
5
|
+
* right summary, flags and examples. Adding a command = adding a spec.
|
|
6
|
+
*/
|
|
7
|
+
import { GLOBAL_FLAGS, specPaths } from "./spec.js";
|
|
8
|
+
function flagUsage(flag) {
|
|
9
|
+
const long = flag.takesValue ? `--${flag.name} ${flag.valueName ?? '<value>'}` : `--${flag.name}`;
|
|
10
|
+
return flag.short !== undefined ? `-${flag.short}, ${long}` : long;
|
|
11
|
+
}
|
|
12
|
+
function flagLine(flag) {
|
|
13
|
+
const env = flag.env !== undefined ? ` (also: ${flag.env}=…)` : '';
|
|
14
|
+
return ` ${flagUsage(flag).padEnd(24)} ${flag.description}${env}`;
|
|
15
|
+
}
|
|
16
|
+
/** `boombot --help` — every visible command, generated from specs. */
|
|
17
|
+
export function renderRootHelp(commands, opts) {
|
|
18
|
+
const program = opts.programName ?? 'boombot';
|
|
19
|
+
const visible = commands.filter((c) => c.spec.hidden !== true);
|
|
20
|
+
const lines = [
|
|
21
|
+
`${program} ${opts.version} — BoomBot command-line interface`,
|
|
22
|
+
'',
|
|
23
|
+
'Usage:',
|
|
24
|
+
` ${program} start locally; configure a provider in the web UI`,
|
|
25
|
+
` ${program} <command> [options]`,
|
|
26
|
+
` ${program} <command> --help show help for a command`,
|
|
27
|
+
'',
|
|
28
|
+
'Commands:',
|
|
29
|
+
];
|
|
30
|
+
for (const { spec } of visible) {
|
|
31
|
+
const name = spec.path.join(' ');
|
|
32
|
+
const alias = spec.aliases !== undefined && spec.aliases.length > 0
|
|
33
|
+
? ` (${spec.aliases.map((a) => a.join(' ')).join(', ')})`
|
|
34
|
+
: '';
|
|
35
|
+
lines.push(` ${name.padEnd(16)}${spec.summary}${alias}`);
|
|
36
|
+
}
|
|
37
|
+
lines.push('', 'Global options:');
|
|
38
|
+
for (const flag of GLOBAL_FLAGS)
|
|
39
|
+
lines.push(flagLine(flag));
|
|
40
|
+
lines.push('', `Run \`${program} <command> --help\` for command details.`);
|
|
41
|
+
return lines.join('\n');
|
|
42
|
+
}
|
|
43
|
+
/** `boombot <command> --help` — usage, flags, examples, notes. */
|
|
44
|
+
export function renderCommandHelp(spec, opts) {
|
|
45
|
+
const program = opts.programName ?? 'boombot';
|
|
46
|
+
const lines = [
|
|
47
|
+
`${program} ${spec.path.join(' ')} — ${spec.summary}`,
|
|
48
|
+
'',
|
|
49
|
+
'Usage:',
|
|
50
|
+
` ${spec.usage}`,
|
|
51
|
+
'',
|
|
52
|
+
];
|
|
53
|
+
if (spec.aliases !== undefined && spec.aliases.length > 0) {
|
|
54
|
+
lines.push(`Aliases: ${spec.aliases.map((a) => `${program} ${a.join(' ')}`).join(', ')}`, '');
|
|
55
|
+
}
|
|
56
|
+
if (spec.flags.length > 0) {
|
|
57
|
+
lines.push('Options:');
|
|
58
|
+
for (const flag of spec.flags)
|
|
59
|
+
lines.push(flagLine(flag));
|
|
60
|
+
lines.push('');
|
|
61
|
+
}
|
|
62
|
+
lines.push('Global options:');
|
|
63
|
+
for (const flag of GLOBAL_FLAGS)
|
|
64
|
+
lines.push(flagLine(flag));
|
|
65
|
+
lines.push('');
|
|
66
|
+
if (spec.examples !== undefined && spec.examples.length > 0) {
|
|
67
|
+
lines.push('Examples:');
|
|
68
|
+
for (const ex of spec.examples)
|
|
69
|
+
lines.push(` ${ex}`);
|
|
70
|
+
lines.push('');
|
|
71
|
+
}
|
|
72
|
+
if (spec.notes !== undefined && spec.notes.length > 0) {
|
|
73
|
+
lines.push('Notes:');
|
|
74
|
+
for (const note of spec.notes)
|
|
75
|
+
lines.push(` - ${note}`);
|
|
76
|
+
lines.push('');
|
|
77
|
+
}
|
|
78
|
+
return lines.join('\n').trimEnd();
|
|
79
|
+
}
|
|
80
|
+
/** All spellings users may type (canonical + aliases), for tests/docs. */
|
|
81
|
+
export function allCommandSpellings(specs) {
|
|
82
|
+
return specs.flatMap((s) => [...specPaths(s)]);
|
|
83
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* argv parser — intentionally small and heuristic.
|
|
3
|
+
*
|
|
4
|
+
* Splits raw argv into positionals (command path candidates) and flags.
|
|
5
|
+
* Whether a flag takes a value is validated LATER against the spec in
|
|
6
|
+
* dispatch.ts; here the rule is only: `--flag <next>` consumes the next
|
|
7
|
+
* token when it does not look like a flag. `--` ends flag parsing.
|
|
8
|
+
*/
|
|
9
|
+
import { CliError } from "./cli-error.js";
|
|
10
|
+
import { SHORT_FLAGS } from "./spec.js";
|
|
11
|
+
function isFlagToken(token) {
|
|
12
|
+
return token.startsWith('-') && token.length > 1;
|
|
13
|
+
}
|
|
14
|
+
export function parseArgv(argv) {
|
|
15
|
+
const positionals = [];
|
|
16
|
+
const flags = {};
|
|
17
|
+
let json = false;
|
|
18
|
+
let help = false;
|
|
19
|
+
let version = false;
|
|
20
|
+
let onlyPositionals = false;
|
|
21
|
+
const setKnownBoolean = (name) => {
|
|
22
|
+
if (name === 'json') {
|
|
23
|
+
json = true;
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
if (name === 'help') {
|
|
27
|
+
help = true;
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
if (name === 'version') {
|
|
31
|
+
version = true;
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
};
|
|
36
|
+
for (let i = 0; i < argv.length; i++) {
|
|
37
|
+
const arg = argv[i];
|
|
38
|
+
if (arg === undefined)
|
|
39
|
+
continue;
|
|
40
|
+
if (onlyPositionals) {
|
|
41
|
+
positionals.push(arg);
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (arg === '--') {
|
|
45
|
+
onlyPositionals = true;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (arg.startsWith('--')) {
|
|
49
|
+
const eq = arg.indexOf('=');
|
|
50
|
+
if (eq !== -1) {
|
|
51
|
+
const name = arg.slice(2, eq);
|
|
52
|
+
const value = arg.slice(eq + 1);
|
|
53
|
+
if (name === '')
|
|
54
|
+
throw new CliError({ code: 'UNKNOWN_FLAG', message: `bad flag: ${arg}` });
|
|
55
|
+
if (!setKnownBoolean(name))
|
|
56
|
+
flags[name] = value;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
const name = arg.slice(2);
|
|
60
|
+
if (name === '')
|
|
61
|
+
throw new CliError({ code: 'UNKNOWN_FLAG', message: `bad flag: ${arg}` });
|
|
62
|
+
if (!setKnownBoolean(name)) {
|
|
63
|
+
const next = argv[i + 1];
|
|
64
|
+
if (next !== undefined && !isFlagToken(next)) {
|
|
65
|
+
flags[name] = next;
|
|
66
|
+
i++;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
flags[name] = true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (arg.startsWith('-') && !arg.startsWith('--')) {
|
|
75
|
+
// Single-dash: only -h / -v are known; anything else is recorded raw
|
|
76
|
+
// and rejected later by dispatch flag validation (with suggestions).
|
|
77
|
+
const mapped = SHORT_FLAGS[arg.slice(1)];
|
|
78
|
+
if (mapped !== undefined && arg.length === 2) {
|
|
79
|
+
setKnownBoolean(mapped);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
flags[arg.slice(1)] = true;
|
|
83
|
+
}
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
positionals.push(arg);
|
|
87
|
+
}
|
|
88
|
+
return { positionals, flags, json, help, version };
|
|
89
|
+
}
|