@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,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User-defined custom providers (Hermes-style `$HERMES_HOME/plugins/`).
|
|
3
|
+
*
|
|
4
|
+
* Users declare fully custom LLM providers in `<configDir>/custom-providers.json`
|
|
5
|
+
* (e.g. `~/.boombot/custom-providers.json`). Entries are validated — invalid
|
|
6
|
+
* ones are skipped with a warning, never fatal — and registered into the
|
|
7
|
+
* profile registry, so they appear in `provider.list` and work with the LLM
|
|
8
|
+
* client exactly like built-ins.
|
|
9
|
+
*
|
|
10
|
+
* This module is intentionally NOT imported by `./index.js`: the registry
|
|
11
|
+
* must stay importable without touching the filesystem. Callers
|
|
12
|
+
* (`agent-worker` startup) import this module directly and call
|
|
13
|
+
* `registerCustomProviders()`.
|
|
14
|
+
*
|
|
15
|
+
* Boundary: leaf package — node builtins only, no `@boombot/*` imports.
|
|
16
|
+
*/
|
|
17
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
18
|
+
import { join } from 'node:path';
|
|
19
|
+
import { getProviderProfile, registerProvider } from './index.js';
|
|
20
|
+
/** File name (inside the config dir) holding user-defined providers. */
|
|
21
|
+
export const CUSTOM_PROVIDERS_FILE = 'custom-providers.json';
|
|
22
|
+
/** Provider names: lowercase letters, digits, hyphens. */
|
|
23
|
+
const NAME_PATTERN = /^[a-z0-9-]+$/u;
|
|
24
|
+
const API_MODES = [
|
|
25
|
+
'chat_completions',
|
|
26
|
+
'anthropic_messages',
|
|
27
|
+
];
|
|
28
|
+
const AUTH_STYLES = ['bearer', 'x-api-key'];
|
|
29
|
+
function isRecord(value) {
|
|
30
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
31
|
+
}
|
|
32
|
+
function isNonEmptyString(value) {
|
|
33
|
+
return typeof value === 'string' && value.trim().length > 0;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Validate one raw entry. Returns the profile, or `undefined` (after warning)
|
|
37
|
+
* when the entry is unusable.
|
|
38
|
+
*/
|
|
39
|
+
function validateOne(raw, index, onWarn) {
|
|
40
|
+
const where = `${CUSTOM_PROVIDERS_FILE}[providers][${index}]`;
|
|
41
|
+
if (!isRecord(raw)) {
|
|
42
|
+
onWarn(`${where}: entry must be an object, skipping.`);
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
// --- name (required, unique, pattern) ---
|
|
46
|
+
const name = raw['name'];
|
|
47
|
+
if (!isNonEmptyString(name) || !NAME_PATTERN.test(name)) {
|
|
48
|
+
onWarn(`${where}: 'name' must match /^[a-z0-9-]+$/ (lowercase, digits, hyphens), skipping.`, { name: typeof name === 'string' ? name : undefined });
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
if (getProviderProfile(name) !== undefined) {
|
|
52
|
+
onWarn(`${where}: name '${name}' collides with an already-registered provider, skipping.`);
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
// --- apiMode (required) ---
|
|
56
|
+
const apiMode = raw['apiMode'];
|
|
57
|
+
if (typeof apiMode !== 'string' ||
|
|
58
|
+
!API_MODES.includes(apiMode)) {
|
|
59
|
+
onWarn(`${where}: 'apiMode' must be one of: ${API_MODES.join(', ')}. Skipping '${name}'.`);
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
// --- keyless / defaultBaseUrl ---
|
|
63
|
+
const keyless = raw['keyless'] === true;
|
|
64
|
+
const defaultBaseUrl = raw['defaultBaseUrl'];
|
|
65
|
+
if (!keyless) {
|
|
66
|
+
if (!isNonEmptyString(defaultBaseUrl)) {
|
|
67
|
+
onWarn(`${where}: 'defaultBaseUrl' is required for '${name}' (or set 'keyless': true), skipping.`);
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
new URL(defaultBaseUrl);
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
onWarn(`${where}: 'defaultBaseUrl' is not a valid URL for '${name}', skipping.`, { defaultBaseUrl });
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else if (defaultBaseUrl !== undefined &&
|
|
79
|
+
defaultBaseUrl !== null &&
|
|
80
|
+
typeof defaultBaseUrl !== 'string') {
|
|
81
|
+
onWarn(`${where}: 'defaultBaseUrl' must be a string when present for '${name}', skipping.`);
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
// --- authStyle (optional, defaults to bearer) ---
|
|
85
|
+
const authStyle = raw['authStyle'] ?? 'bearer';
|
|
86
|
+
if (typeof authStyle !== 'string' ||
|
|
87
|
+
!AUTH_STYLES.includes(authStyle)) {
|
|
88
|
+
onWarn(`${where}: 'authStyle' must be one of: ${AUTH_STYLES.join(', ')}. Skipping '${name}'.`);
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
// --- defaultModel (required) ---
|
|
92
|
+
const defaultModel = raw['defaultModel'];
|
|
93
|
+
if (!isNonEmptyString(defaultModel)) {
|
|
94
|
+
onWarn(`${where}: 'defaultModel' must be a non-empty string for '${name}', skipping.`);
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
// --- aliases (optional) ---
|
|
98
|
+
let aliases;
|
|
99
|
+
const rawAliases = raw['aliases'];
|
|
100
|
+
if (rawAliases !== undefined) {
|
|
101
|
+
if (!Array.isArray(rawAliases)) {
|
|
102
|
+
onWarn(`${where}: 'aliases' must be an array of strings for '${name}', skipping.`);
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
const clean = [];
|
|
106
|
+
for (const alias of rawAliases) {
|
|
107
|
+
if (typeof alias !== 'string' || !NAME_PATTERN.test(alias)) {
|
|
108
|
+
onWarn(`${where}: alias must match /^[a-z0-9-]+$/ for '${name}', dropping alias.`, { alias });
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (getProviderProfile(alias) !== undefined) {
|
|
112
|
+
onWarn(`${where}: alias '${alias}' collides with an existing provider for '${name}', dropping alias.`);
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
clean.push(alias);
|
|
116
|
+
}
|
|
117
|
+
if (clean.length > 0)
|
|
118
|
+
aliases = clean;
|
|
119
|
+
}
|
|
120
|
+
// --- authVersionHeader (optional, only meaningful for x-api-key) ---
|
|
121
|
+
let authVersionHeader;
|
|
122
|
+
const rawVersionHeader = raw['authVersionHeader'];
|
|
123
|
+
if (rawVersionHeader !== undefined) {
|
|
124
|
+
if (!isRecord(rawVersionHeader) ||
|
|
125
|
+
!isNonEmptyString(rawVersionHeader['name']) ||
|
|
126
|
+
!isNonEmptyString(rawVersionHeader['value'])) {
|
|
127
|
+
onWarn(`${where}: 'authVersionHeader' must be { name, value } strings for '${name}', skipping.`);
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
authVersionHeader = {
|
|
131
|
+
name: rawVersionHeader['name'],
|
|
132
|
+
value: rawVersionHeader['value'],
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
// --- optional string fields ---
|
|
136
|
+
const displayName = isNonEmptyString(raw['displayName']) ? raw['displayName'] : name;
|
|
137
|
+
const description = isNonEmptyString(raw['description'])
|
|
138
|
+
? raw['description']
|
|
139
|
+
: undefined;
|
|
140
|
+
const defaultEmbeddingModel = isNonEmptyString(raw['defaultEmbeddingModel'])
|
|
141
|
+
? raw['defaultEmbeddingModel']
|
|
142
|
+
: undefined;
|
|
143
|
+
return {
|
|
144
|
+
// Custom names are not members of the `ProviderKind` union by construction;
|
|
145
|
+
// the registry is string-keyed at runtime, so the cast is contained here.
|
|
146
|
+
name: name,
|
|
147
|
+
displayName,
|
|
148
|
+
apiMode: apiMode,
|
|
149
|
+
defaultBaseUrl: typeof defaultBaseUrl === 'string' ? defaultBaseUrl : null,
|
|
150
|
+
aliases,
|
|
151
|
+
authStyle: authStyle,
|
|
152
|
+
authVersionHeader,
|
|
153
|
+
defaultModel,
|
|
154
|
+
defaultEmbeddingModel,
|
|
155
|
+
keyless: keyless ? true : undefined,
|
|
156
|
+
requestUsage: raw['requestUsage'] === true ? true : undefined,
|
|
157
|
+
description,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Read and validate `<configDir>/custom-providers.json`.
|
|
162
|
+
*
|
|
163
|
+
* Returns the valid profiles (possibly empty). A missing file is not an
|
|
164
|
+
* error — it just means the user defined no custom providers. Malformed
|
|
165
|
+
* JSON or invalid entries produce warnings via `onWarn` and are skipped;
|
|
166
|
+
* this function never throws for user-data problems.
|
|
167
|
+
*/
|
|
168
|
+
export function loadCustomProviders(configDir, onWarn = () => { }) {
|
|
169
|
+
const path = join(configDir, CUSTOM_PROVIDERS_FILE);
|
|
170
|
+
if (!existsSync(path))
|
|
171
|
+
return [];
|
|
172
|
+
let parsed;
|
|
173
|
+
try {
|
|
174
|
+
parsed = JSON.parse(readFileSync(path, 'utf8'));
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
onWarn(`Could not parse ${CUSTOM_PROVIDERS_FILE}: ${error instanceof Error ? error.message : String(error)}. Skipping custom providers.`);
|
|
178
|
+
return [];
|
|
179
|
+
}
|
|
180
|
+
const list = isRecord(parsed) && Array.isArray(parsed['providers'])
|
|
181
|
+
? parsed['providers']
|
|
182
|
+
: null;
|
|
183
|
+
if (list === null) {
|
|
184
|
+
onWarn(`${CUSTOM_PROVIDERS_FILE}: expected { "providers": [...] }. Skipping custom providers.`);
|
|
185
|
+
return [];
|
|
186
|
+
}
|
|
187
|
+
const out = [];
|
|
188
|
+
const seenInFile = new Set();
|
|
189
|
+
list.forEach((raw, index) => {
|
|
190
|
+
const profile = validateOne(raw, index, onWarn);
|
|
191
|
+
if (profile === undefined)
|
|
192
|
+
return;
|
|
193
|
+
const key = profile.name.toLowerCase();
|
|
194
|
+
if (seenInFile.has(key)) {
|
|
195
|
+
onWarn(`${CUSTOM_PROVIDERS_FILE}[providers][${index}]: duplicate name '${profile.name}' in file, skipping.`);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
seenInFile.add(key);
|
|
199
|
+
out.push(profile);
|
|
200
|
+
});
|
|
201
|
+
return out;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Load custom providers from `<configDir>/custom-providers.json` and register
|
|
205
|
+
* them into the profile registry. Returns the number successfully registered.
|
|
206
|
+
*
|
|
207
|
+
* Never throws for user-data problems — invalid entries are skipped with a
|
|
208
|
+
* warning. Registration itself is best-effort for the same reason.
|
|
209
|
+
*/
|
|
210
|
+
export function registerCustomProviders(configDir, onWarn = () => { }) {
|
|
211
|
+
let count = 0;
|
|
212
|
+
for (const profile of loadCustomProviders(configDir, onWarn)) {
|
|
213
|
+
try {
|
|
214
|
+
registerProvider(profile);
|
|
215
|
+
count += 1;
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
onWarn(`Could not register custom provider '${profile.name}': ${error instanceof Error ? error.message : String(error)}. Skipping.`);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return count;
|
|
222
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const deepseekProfile = {
|
|
2
|
+
name: 'deepseek',
|
|
3
|
+
displayName: 'DeepSeek',
|
|
4
|
+
apiMode: 'chat_completions',
|
|
5
|
+
defaultBaseUrl: 'https://api.deepseek.com/v1',
|
|
6
|
+
authStyle: 'bearer',
|
|
7
|
+
defaultModel: 'deepseek-chat',
|
|
8
|
+
description: 'DeepSeek API (OpenAI-compatible).',
|
|
9
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google provider profile.
|
|
3
|
+
*
|
|
4
|
+
* Uses the `v1beta/openai` compatibility endpoint, so it speaks the
|
|
5
|
+
* OpenAI chat-completions wire protocol with Bearer auth.
|
|
6
|
+
*
|
|
7
|
+
* Boundary: leaf package — node builtins only.
|
|
8
|
+
*/
|
|
9
|
+
import type { ProviderProfile } from './types.js';
|
|
10
|
+
export declare const googleProfile: ProviderProfile;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const googleProfile = {
|
|
2
|
+
name: 'google',
|
|
3
|
+
displayName: 'Google',
|
|
4
|
+
apiMode: 'chat_completions',
|
|
5
|
+
defaultBaseUrl: 'https://generativelanguage.googleapis.com/v1beta/openai',
|
|
6
|
+
aliases: ['gemini'],
|
|
7
|
+
authStyle: 'bearer',
|
|
8
|
+
defaultModel: 'gemini-2.0-flash',
|
|
9
|
+
description: 'Google Gemini via the OpenAI-compatibility endpoint.',
|
|
10
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider profile registry (Hermes-style).
|
|
3
|
+
*
|
|
4
|
+
* Providers are discovered, not hardcoded: each provider is a declarative
|
|
5
|
+
* `ProviderProfile` in its own module, registered here. Third parties can
|
|
6
|
+
* call `registerProvider()` to add custom providers without touching this
|
|
7
|
+
* package's types.
|
|
8
|
+
*
|
|
9
|
+
* The 8 built-in providers self-register on import.
|
|
10
|
+
*
|
|
11
|
+
* Boundary: leaf package — node builtins only, no `@boombot/*` imports.
|
|
12
|
+
*/
|
|
13
|
+
import type { ProviderKind } from '../types.js';
|
|
14
|
+
import type { ProviderProfile } from './types.js';
|
|
15
|
+
export type { ProviderApiMode, ProviderAuthStyle, ProviderProfile } from './types.js';
|
|
16
|
+
/**
|
|
17
|
+
* Register a provider profile. Later registrations with the same name win
|
|
18
|
+
* (lets embedders override a built-in). Aliases must not collide with an
|
|
19
|
+
* existing name or alias — a collision throws.
|
|
20
|
+
*/
|
|
21
|
+
export declare function registerProvider(profile: ProviderProfile): void;
|
|
22
|
+
/** Look up a profile by name or alias (case-insensitive). `undefined` when unknown. */
|
|
23
|
+
export declare function getProviderProfile(name: string): ProviderProfile | undefined;
|
|
24
|
+
/** All registered profiles, in registration order. */
|
|
25
|
+
export declare function listProviderProfiles(): readonly ProviderProfile[];
|
|
26
|
+
/**
|
|
27
|
+
* Provider kinds derived from the registry. Kept in sync with the
|
|
28
|
+
* `ProviderKind` union in `../types.js` — every union member must have a
|
|
29
|
+
* registered profile (asserted by the built-in self-registration below).
|
|
30
|
+
*/
|
|
31
|
+
export declare function registeredProviderKinds(): readonly ProviderKind[];
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { anthropicProfile } from './anthropic.js';
|
|
2
|
+
import { deepseekProfile } from './deepseek.js';
|
|
3
|
+
import { googleProfile } from './google.js';
|
|
4
|
+
import { localProfile } from './local.js';
|
|
5
|
+
import { mistralProfile } from './mistral.js';
|
|
6
|
+
import { openaiProfile } from './openai.js';
|
|
7
|
+
import { openaiCompatibleProfile } from './openai-compatible.js';
|
|
8
|
+
import { xaiProfile } from './xai.js';
|
|
9
|
+
const byName = new Map();
|
|
10
|
+
const byAlias = new Map();
|
|
11
|
+
/**
|
|
12
|
+
* Register a provider profile. Later registrations with the same name win
|
|
13
|
+
* (lets embedders override a built-in). Aliases must not collide with an
|
|
14
|
+
* existing name or alias — a collision throws.
|
|
15
|
+
*/
|
|
16
|
+
export function registerProvider(profile) {
|
|
17
|
+
const key = profile.name.toLowerCase();
|
|
18
|
+
byName.set(key, profile);
|
|
19
|
+
for (const alias of profile.aliases ?? []) {
|
|
20
|
+
const aliasKey = alias.toLowerCase();
|
|
21
|
+
if (byName.has(aliasKey) || byAlias.has(aliasKey)) {
|
|
22
|
+
throw new Error(`Provider alias '${alias}' collides with an existing provider name or alias.`);
|
|
23
|
+
}
|
|
24
|
+
byAlias.set(aliasKey, profile);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** Look up a profile by name or alias (case-insensitive). `undefined` when unknown. */
|
|
28
|
+
export function getProviderProfile(name) {
|
|
29
|
+
const key = name.toLowerCase();
|
|
30
|
+
return byName.get(key) ?? byAlias.get(key);
|
|
31
|
+
}
|
|
32
|
+
/** All registered profiles, in registration order. */
|
|
33
|
+
export function listProviderProfiles() {
|
|
34
|
+
return [...byName.values()];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Provider kinds derived from the registry. Kept in sync with the
|
|
38
|
+
* `ProviderKind` union in `../types.js` — every union member must have a
|
|
39
|
+
* registered profile (asserted by the built-in self-registration below).
|
|
40
|
+
*/
|
|
41
|
+
export function registeredProviderKinds() {
|
|
42
|
+
return listProviderProfiles().map((p) => p.name);
|
|
43
|
+
}
|
|
44
|
+
// Built-in providers self-register on import, in `ProviderKind` order.
|
|
45
|
+
for (const profile of [
|
|
46
|
+
openaiProfile,
|
|
47
|
+
anthropicProfile,
|
|
48
|
+
googleProfile,
|
|
49
|
+
mistralProfile,
|
|
50
|
+
xaiProfile,
|
|
51
|
+
deepseekProfile,
|
|
52
|
+
openaiCompatibleProfile,
|
|
53
|
+
localProfile,
|
|
54
|
+
]) {
|
|
55
|
+
registerProvider(profile);
|
|
56
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local provider profile.
|
|
3
|
+
*
|
|
4
|
+
* For self-hosted inference (Ollama, LM Studio, vLLM, …). No default base
|
|
5
|
+
* URL and no API key required — the user points it at their local server.
|
|
6
|
+
*
|
|
7
|
+
* Boundary: leaf package — node builtins only.
|
|
8
|
+
*/
|
|
9
|
+
import type { ProviderProfile } from './types.js';
|
|
10
|
+
export declare const localProfile: ProviderProfile;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const localProfile = {
|
|
2
|
+
name: 'local',
|
|
3
|
+
displayName: 'Local',
|
|
4
|
+
apiMode: 'chat_completions',
|
|
5
|
+
defaultBaseUrl: null,
|
|
6
|
+
aliases: ['ollama', 'self-hosted'],
|
|
7
|
+
authStyle: 'bearer',
|
|
8
|
+
defaultModel: '',
|
|
9
|
+
keyless: true,
|
|
10
|
+
description: 'Self-hosted model server (Ollama, LM Studio, vLLM). No API key needed.',
|
|
11
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const mistralProfile = {
|
|
2
|
+
name: 'mistral',
|
|
3
|
+
displayName: 'Mistral',
|
|
4
|
+
apiMode: 'chat_completions',
|
|
5
|
+
defaultBaseUrl: 'https://api.mistral.ai/v1',
|
|
6
|
+
authStyle: 'bearer',
|
|
7
|
+
defaultModel: 'mistral-large-latest',
|
|
8
|
+
description: 'Mistral API (OpenAI-compatible).',
|
|
9
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic OpenAI-compatible provider profile.
|
|
3
|
+
*
|
|
4
|
+
* For any third-party endpoint speaking the chat-completions protocol.
|
|
5
|
+
* No default base URL — the user must supply one.
|
|
6
|
+
*
|
|
7
|
+
* Boundary: leaf package — node builtins only.
|
|
8
|
+
*/
|
|
9
|
+
import type { ProviderProfile } from './types.js';
|
|
10
|
+
export declare const openaiCompatibleProfile: ProviderProfile;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const openaiCompatibleProfile = {
|
|
2
|
+
name: 'openai-compatible',
|
|
3
|
+
displayName: 'OpenAI-compatible',
|
|
4
|
+
apiMode: 'chat_completions',
|
|
5
|
+
defaultBaseUrl: null,
|
|
6
|
+
aliases: ['custom', 'generic'],
|
|
7
|
+
authStyle: 'bearer',
|
|
8
|
+
defaultModel: '',
|
|
9
|
+
description: 'Any OpenAI-compatible endpoint (custom base URL required).',
|
|
10
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const openaiProfile = {
|
|
2
|
+
name: 'openai',
|
|
3
|
+
displayName: 'OpenAI',
|
|
4
|
+
apiMode: 'chat_completions',
|
|
5
|
+
defaultBaseUrl: 'https://api.openai.com/v1',
|
|
6
|
+
authStyle: 'bearer',
|
|
7
|
+
defaultModel: 'gpt-4o-mini',
|
|
8
|
+
defaultEmbeddingModel: 'text-embedding-3-small',
|
|
9
|
+
requestUsage: true,
|
|
10
|
+
description: 'OpenAI API (GPT models).',
|
|
11
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Declarative provider profiles (Hermes-style).
|
|
3
|
+
*
|
|
4
|
+
* Each LLM provider is described by a single `ProviderProfile` object instead
|
|
5
|
+
* of scattered `switch (kind)` branches. Adding a provider means adding one
|
|
6
|
+
* file — no changes to types, no new switch cases.
|
|
7
|
+
*
|
|
8
|
+
* Boundary: leaf package — node builtins only, no `@boombot/*` imports.
|
|
9
|
+
*/
|
|
10
|
+
import type { RequestProfile } from '../request-profile.js';
|
|
11
|
+
import type { ProviderKind } from '../types.js';
|
|
12
|
+
/** Wire protocol a provider speaks. Determines request shape and decoder. */
|
|
13
|
+
export type ProviderApiMode = 'chat_completions' | 'anthropic_messages';
|
|
14
|
+
/** How the API key is sent on every request. */
|
|
15
|
+
export type ProviderAuthStyle = 'bearer' | 'x-api-key';
|
|
16
|
+
/**
|
|
17
|
+
* Declarative description of one LLM provider.
|
|
18
|
+
*
|
|
19
|
+
* All behavior the gateway's LLM client derives from `ProviderKind` lives
|
|
20
|
+
* here: base URL, auth headers, wire protocol, and tier-1 request defaults.
|
|
21
|
+
*/
|
|
22
|
+
export interface ProviderProfile {
|
|
23
|
+
/** Machine name. Must be a member of `ProviderKind`. */
|
|
24
|
+
readonly name: ProviderKind;
|
|
25
|
+
/** Human-readable name shown in UIs. */
|
|
26
|
+
readonly displayName: string;
|
|
27
|
+
/** Wire protocol: request format + response decoder. */
|
|
28
|
+
readonly apiMode: ProviderApiMode;
|
|
29
|
+
/** Default base URL, or `null` when the user must supply one. */
|
|
30
|
+
readonly defaultBaseUrl: string | null;
|
|
31
|
+
/** Alternate names accepted by `getProviderProfile`. */
|
|
32
|
+
readonly aliases?: readonly string[];
|
|
33
|
+
/** How the API key is transmitted. */
|
|
34
|
+
readonly authStyle: ProviderAuthStyle;
|
|
35
|
+
/**
|
|
36
|
+
* Extra version header for `x-api-key` auth (e.g. Anthropic's
|
|
37
|
+
* `anthropic-version: 2023-06-01`). Ignored for `bearer` auth.
|
|
38
|
+
*/
|
|
39
|
+
readonly authVersionHeader?: {
|
|
40
|
+
readonly name: string;
|
|
41
|
+
readonly value: string;
|
|
42
|
+
};
|
|
43
|
+
/** Sensible default chat model suggestion (user config wins). */
|
|
44
|
+
readonly defaultModel: string;
|
|
45
|
+
/** Tier-1 request profile defaults for this provider. */
|
|
46
|
+
readonly defaultProfile?: RequestProfile;
|
|
47
|
+
/** Whether this provider can serve without an API key. */
|
|
48
|
+
readonly keyless?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Request token usage in streaming responses
|
|
51
|
+
* (`stream_options: { include_usage: true }` for chat_completions).
|
|
52
|
+
*/
|
|
53
|
+
readonly requestUsage?: boolean;
|
|
54
|
+
/** Default embedding model for semantic search (if the provider offers one). */
|
|
55
|
+
readonly defaultEmbeddingModel?: string;
|
|
56
|
+
/** Short description for UIs and setup wizards. */
|
|
57
|
+
readonly description?: string;
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const xaiProfile = {
|
|
2
|
+
name: 'xai',
|
|
3
|
+
displayName: 'xAI',
|
|
4
|
+
apiMode: 'chat_completions',
|
|
5
|
+
defaultBaseUrl: 'https://api.x.ai/v1',
|
|
6
|
+
aliases: ['grok'],
|
|
7
|
+
authStyle: 'bearer',
|
|
8
|
+
defaultModel: 'grok-3-mini',
|
|
9
|
+
description: 'xAI API (Grok models, OpenAI-compatible).',
|
|
10
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layered request profiles for LLM calls.
|
|
3
|
+
*
|
|
4
|
+
* A request profile carries the per-request knobs the gateway applies when
|
|
5
|
+
* building a provider HTTP request: scalar params (`maxTokens`,
|
|
6
|
+
* `temperature`, `topP`), extra HTTP `headers`, an `extraBody` object merged
|
|
7
|
+
* into the JSON request body, and per-model `reasoning` knobs.
|
|
8
|
+
*
|
|
9
|
+
* Three tiers merge left-to-right, later tiers winning:
|
|
10
|
+
*
|
|
11
|
+
* kind defaults < provider.extra < per-model override
|
|
12
|
+
*
|
|
13
|
+
* - Tier 1 (kind defaults): hardcoded per `ProviderKind` (e.g. Anthropic
|
|
14
|
+
* requires `max_tokens`, so its default lives here instead of as a magic
|
|
15
|
+
* constant at the call site).
|
|
16
|
+
* - Tier 2 (`provider.extra`): stored on the provider record in
|
|
17
|
+
* `providers.json`, applies to every model of that provider.
|
|
18
|
+
* - Tier 3 (per-model override): `provider.modelProfiles[model]`, wins over
|
|
19
|
+
* everything for that one model.
|
|
20
|
+
*
|
|
21
|
+
* Merge rules (shared by every consumer — there is exactly one merge
|
|
22
|
+
* implementation):
|
|
23
|
+
* - `undefined` means "unset" and never overwrites a set value. There is no
|
|
24
|
+
* way to *clear* an inherited value except by overriding it with a new one.
|
|
25
|
+
* - Scalars are replaced wholesale.
|
|
26
|
+
* - `headers` merge key-by-key (later tier wins per header name).
|
|
27
|
+
* - `extraBody` merges recursively: plain objects merge key-by-key to any
|
|
28
|
+
* depth; arrays and scalars are replaced, never concatenated.
|
|
29
|
+
* - `reasoning` merges field-by-field like `headers`.
|
|
30
|
+
*
|
|
31
|
+
* Boundary: leaf package — node builtins only, no `@boombot/*` imports.
|
|
32
|
+
* Pure functions; the gateway's `llm-client.ts` is the single consumer on
|
|
33
|
+
* the real request path.
|
|
34
|
+
*/
|
|
35
|
+
import type { ProviderKind } from './types.js';
|
|
36
|
+
/**
|
|
37
|
+
* Reasoning knobs a profile can carry. Each wire protocol maps them its own
|
|
38
|
+
* way at request-build time:
|
|
39
|
+
* - `effort` → OpenAI-compatible `reasoning_effort` (o-series / gpt-5 style).
|
|
40
|
+
* - `budgetTokens` → Anthropic `thinking: { type: 'enabled', budget_tokens }`.
|
|
41
|
+
*/
|
|
42
|
+
export interface ReasoningProfile {
|
|
43
|
+
/** OpenAI-style reasoning effort, e.g. `'low' | 'medium' | 'high'`. */
|
|
44
|
+
readonly effort?: string;
|
|
45
|
+
/** Anthropic-style thinking budget in tokens. */
|
|
46
|
+
readonly budgetTokens?: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Per-request overrides for one LLM call. Every field is optional; absent
|
|
50
|
+
* fields inherit from the lower tier.
|
|
51
|
+
*/
|
|
52
|
+
export interface RequestProfile {
|
|
53
|
+
/** Mapped to `max_tokens` (Anthropic) / `max_completion_tokens`-style body params. */
|
|
54
|
+
readonly maxTokens?: number;
|
|
55
|
+
readonly temperature?: number;
|
|
56
|
+
readonly topP?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Extra HTTP headers merged over the auth headers. Auth headers always
|
|
59
|
+
* stay authoritative: on a name conflict the auth value wins, so a profile
|
|
60
|
+
* can never silently swap the credential.
|
|
61
|
+
*/
|
|
62
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
63
|
+
/**
|
|
64
|
+
* Extra top-level fields merged into the JSON request body. Applied after
|
|
65
|
+
* the mapped scalar params, so it works as an escape hatch for
|
|
66
|
+
* provider-specific knobs (e.g. `top_k`, `min_p`, `seed`).
|
|
67
|
+
*/
|
|
68
|
+
readonly extraBody?: Readonly<Record<string, unknown>>;
|
|
69
|
+
/** Per-model reasoning knobs; mapped per wire protocol. */
|
|
70
|
+
readonly reasoning?: ReasoningProfile;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Tier-1 default profile for a provider kind, read from the provider's
|
|
74
|
+
* declarative profile (e.g. Anthropic rejects requests without `max_tokens`,
|
|
75
|
+
* so its default lives in the profile, not as a magic constant).
|
|
76
|
+
* Unknown kinds get `{}` (fail-open: the caller validates the kind).
|
|
77
|
+
*/
|
|
78
|
+
export declare function kindDefaultProfile(kind: ProviderKind): RequestProfile;
|
|
79
|
+
/**
|
|
80
|
+
* All tier-1 defaults, keyed by provider name. Built lazily from the
|
|
81
|
+
* registry so third-party `registerProvider()` calls are honored.
|
|
82
|
+
*/
|
|
83
|
+
export declare function allKindDefaultProfiles(): Readonly<Record<string, RequestProfile>>;
|
|
84
|
+
/**
|
|
85
|
+
* Recursively merge two JSON-ish records. Plain objects merge key-by-key to
|
|
86
|
+
* any depth; arrays, scalars and class instances are replaced wholesale;
|
|
87
|
+
* `undefined` values never overwrite. Shared by profile merging and by the
|
|
88
|
+
* request builder applying `extraBody` onto the wire body.
|
|
89
|
+
*/
|
|
90
|
+
export declare function deepMergeRecords(base: Readonly<Record<string, unknown>>, override: Readonly<Record<string, unknown>>): Record<string, unknown>;
|
|
91
|
+
/**
|
|
92
|
+
* Deep-merge request profiles left-to-right: later profiles win.
|
|
93
|
+
* See the module docstring for the exact merge rules.
|
|
94
|
+
*/
|
|
95
|
+
export declare function mergeRequestProfiles(...profiles: readonly (RequestProfile | undefined)[]): RequestProfile;
|
|
96
|
+
/**
|
|
97
|
+
* Resolve the effective request profile for one model:
|
|
98
|
+
* kind defaults < provider.extra < provider.modelProfiles[model].
|
|
99
|
+
*/
|
|
100
|
+
export declare function resolveRequestProfile(kind: ProviderKind, providerExtra: RequestProfile | undefined, modelProfiles: Readonly<Record<string, RequestProfile>> | undefined, model: string): RequestProfile;
|
|
101
|
+
/** Structural check used by the provider service when validating stored/wire input. */
|
|
102
|
+
export declare function isRequestProfile(value: unknown): value is RequestProfile;
|