@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
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export class IntentClassifier {
|
|
2
|
+
/**
|
|
3
|
+
* Fast reflex classification based on prefixes, patterns, and structure.
|
|
4
|
+
*/
|
|
5
|
+
static classify(input) {
|
|
6
|
+
const trimmed = input.trim();
|
|
7
|
+
// 1. Explicit Slash Commands
|
|
8
|
+
if (/^\/(plan|task|longtask|decompose)\b/i.test(trimmed)) {
|
|
9
|
+
const goal = trimmed.replace(/^\/(plan|task|longtask|decompose)\s*/i, '').trim();
|
|
10
|
+
return {
|
|
11
|
+
mode: 'planner',
|
|
12
|
+
reason: 'explicit /plan command',
|
|
13
|
+
goal: goal || trimmed,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
if (/^\/(workflow|dag|mass)\b/i.test(trimmed)) {
|
|
17
|
+
const goal = trimmed.replace(/^\/(workflow|dag|mass)\s*/i, '').trim();
|
|
18
|
+
return {
|
|
19
|
+
mode: 'workflow',
|
|
20
|
+
reason: 'explicit /workflow command',
|
|
21
|
+
goal: goal || trimmed,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
// 2. Parallel / DAG Workflow Intent (auto-detect without requiring /workflow)
|
|
25
|
+
const isParallelWorkflow = /(song song|đồng thời|parallel|multi-agent|chạy cùng lúc|phân nhánh|dag workflow|đồ thị tác vụ)/i.test(trimmed);
|
|
26
|
+
if (isParallelWorkflow) {
|
|
27
|
+
return {
|
|
28
|
+
mode: 'workflow',
|
|
29
|
+
reason: 'detected parallel / multi-agent workflow intent',
|
|
30
|
+
goal: trimmed,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
// 3. Multi-step explicitly enumerated user plans (>= 2 steps, or sequential conjunctions)
|
|
34
|
+
const numberedStepCount = (trimmed.match(/(?:^|\n|\b)\s*(?:bước\s*\d+|\bstep\s*\d+|\bpha\s*\d+|\bphase\s*\d+|\d+[\.\)])\s+/gi) ?? []).length;
|
|
35
|
+
const hasSequentialFlow = /(?:sau đó|tiếp theo|rồi|lần lượt|then|after that|next|in order to)/i.test(trimmed);
|
|
36
|
+
if (numberedStepCount >= 2 || (numberedStepCount >= 1 && hasSequentialFlow)) {
|
|
37
|
+
return {
|
|
38
|
+
mode: 'planner',
|
|
39
|
+
reason: `detected structured multi-step plan (${numberedStepCount} steps)`,
|
|
40
|
+
goal: trimmed,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
// 4. Complex autonomous engineering / refactoring / pipeline goals (lowered threshold)
|
|
44
|
+
const isMajorGoal = /(xây dựng tính năng|triển khai toàn bộ|phát triển mô đun|refactor toàn diện|phân rã tác vụ|build feature|implement full|architect and test|full refactor)/i.test(trimmed);
|
|
45
|
+
const hasPhases = /(từng bước|kế hoạch|hoàn chỉnh|toàn diện|end-to-end|lifecycle|từ đầu đến cuối)/i.test(trimmed);
|
|
46
|
+
if (isMajorGoal || (hasPhases && trimmed.length > 30)) {
|
|
47
|
+
return {
|
|
48
|
+
mode: 'planner',
|
|
49
|
+
reason: 'detected complex multi-phase engineering goal',
|
|
50
|
+
goal: trimmed,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
// 5. Default: Standard ReAct loop
|
|
54
|
+
return {
|
|
55
|
+
mode: 'react',
|
|
56
|
+
reason: 'standard direct query / single-turn react',
|
|
57
|
+
goal: trimmed,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Planner Adapter for Gateway Execution.
|
|
3
|
+
*
|
|
4
|
+
* Translates high-level goals into multi-phase execution plans using `@boombot/core`'s
|
|
5
|
+
* `decomposeGoal`, executing each phase through the cognitive ReAct loop with checkpoints.
|
|
6
|
+
*/
|
|
7
|
+
import { decomposeGoal } from '@boombot/core';
|
|
8
|
+
export async function executePlannedTurn(options) {
|
|
9
|
+
const { goal, baseContext, runtimeDeps, runTurn, onEvent, signal, onPhaseProgress, } = options;
|
|
10
|
+
// 1. Decompose the high-level goal into phases
|
|
11
|
+
const plan = await decomposeGoal(goal);
|
|
12
|
+
const totalPhases = plan.steps.length;
|
|
13
|
+
const aggregatedMessages = [...baseContext.messages];
|
|
14
|
+
let totalRounds = 0;
|
|
15
|
+
let totalExecuted = 0;
|
|
16
|
+
let totalDenied = 0;
|
|
17
|
+
const totalUsage = { inputTokens: 0, outputTokens: 0, totalTokens: 0 };
|
|
18
|
+
const phaseReports = [];
|
|
19
|
+
// 2. Execute each phase sequentially with full ReAct capabilities
|
|
20
|
+
for (let i = 0; i < totalPhases; i++) {
|
|
21
|
+
if (signal?.aborted) {
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
const step = plan.steps[i];
|
|
25
|
+
onPhaseProgress?.(i + 1, totalPhases, step.title);
|
|
26
|
+
const phaseSystemPrompt = {
|
|
27
|
+
role: 'system',
|
|
28
|
+
content: [
|
|
29
|
+
`[AUTONOMOUS PLANNER: PHASE ${i + 1}/${totalPhases} - ${step.title.toUpperCase()}]`,
|
|
30
|
+
`Overall Goal: ${plan.goal}`,
|
|
31
|
+
`Current Objective: ${step.prompt}`,
|
|
32
|
+
'Execute this phase thoroughly using all required tools. Provide a clear summary upon completion of this phase.',
|
|
33
|
+
].join('\n'),
|
|
34
|
+
};
|
|
35
|
+
const phaseContext = {
|
|
36
|
+
...baseContext,
|
|
37
|
+
sessionId: `${baseContext.sessionId}:phase_${i + 1}`,
|
|
38
|
+
messages: [
|
|
39
|
+
...aggregatedMessages,
|
|
40
|
+
phaseSystemPrompt,
|
|
41
|
+
{ role: 'user', content: step.prompt },
|
|
42
|
+
],
|
|
43
|
+
budget: { maxRounds: 10, maxToolCalls: 24 },
|
|
44
|
+
};
|
|
45
|
+
const phaseResult = await runTurn(runtimeDeps, phaseContext, onEvent, signal);
|
|
46
|
+
totalRounds += phaseResult.rounds;
|
|
47
|
+
totalExecuted += phaseResult.toolCallsExecuted;
|
|
48
|
+
totalDenied += phaseResult.toolCallsDenied;
|
|
49
|
+
if (phaseResult.usage) {
|
|
50
|
+
totalUsage.inputTokens += phaseResult.usage.inputTokens;
|
|
51
|
+
totalUsage.outputTokens += phaseResult.usage.outputTokens;
|
|
52
|
+
totalUsage.totalTokens += phaseResult.usage.totalTokens;
|
|
53
|
+
}
|
|
54
|
+
// Extract assistant summary of this phase
|
|
55
|
+
const phaseSummary = [...phaseResult.messages]
|
|
56
|
+
.reverse()
|
|
57
|
+
.find((m) => m.role === 'assistant')?.content ?? `Completed ${step.title}`;
|
|
58
|
+
phaseReports.push(`### Phase ${i + 1}: ${step.title}\n${phaseSummary}`);
|
|
59
|
+
// Append phase results to aggregated context for next phases
|
|
60
|
+
aggregatedMessages.push({ role: 'user', content: `[Completed Phase ${i + 1}: ${step.title}]` }, { role: 'assistant', content: phaseSummary });
|
|
61
|
+
if (phaseResult.status !== 'completed') {
|
|
62
|
+
return {
|
|
63
|
+
status: phaseResult.status,
|
|
64
|
+
messages: aggregatedMessages,
|
|
65
|
+
rounds: totalRounds,
|
|
66
|
+
toolCallsExecuted: totalExecuted,
|
|
67
|
+
toolCallsDenied: totalDenied,
|
|
68
|
+
usage: totalUsage,
|
|
69
|
+
error: `Phase ${i + 1} (${step.title}) failed: ${phaseResult.error ?? 'unknown error'}`,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// 3. Synthesize the final comprehensive multi-phase report
|
|
74
|
+
const finalSummaryText = [
|
|
75
|
+
`## Kế hoạch hoàn thành (${totalPhases}/${totalPhases} pha): ${plan.goal}`,
|
|
76
|
+
...phaseReports,
|
|
77
|
+
].join('\n\n');
|
|
78
|
+
const finalAssistantMessage = {
|
|
79
|
+
role: 'assistant',
|
|
80
|
+
content: finalSummaryText,
|
|
81
|
+
};
|
|
82
|
+
aggregatedMessages.push(finalAssistantMessage);
|
|
83
|
+
return {
|
|
84
|
+
status: 'completed',
|
|
85
|
+
messages: aggregatedMessages,
|
|
86
|
+
rounds: totalRounds,
|
|
87
|
+
toolCallsExecuted: totalExecuted,
|
|
88
|
+
toolCallsDenied: totalDenied,
|
|
89
|
+
usage: totalUsage,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { enrichWithSelfHealing } from '@boombot/core';
|
|
2
|
+
import { RuleEvaluator, toGuardToolError, verifyBeforeExecute, DefaultApprovalPolicy } from '@boombot/security';
|
|
3
|
+
import { sanitizeToolSchema } from './tool-schema.js';
|
|
4
|
+
/**
|
|
5
|
+
* LLM client that resolves the real provider client lazily on first use
|
|
6
|
+
* and caches it for the lifetime of these deps (one turn). A fresh deps
|
|
7
|
+
* object is built per turn, so provider changes are picked up on the next
|
|
8
|
+
* turn. Never mocked: without an active provider every model round fails
|
|
9
|
+
* with a clear error instead of fake output.
|
|
10
|
+
*/
|
|
11
|
+
class LazyLlmClient {
|
|
12
|
+
providerService;
|
|
13
|
+
cached;
|
|
14
|
+
constructor(providerService) {
|
|
15
|
+
this.providerService = providerService;
|
|
16
|
+
}
|
|
17
|
+
resolve() {
|
|
18
|
+
if (this.cached === undefined) {
|
|
19
|
+
this.cached = (async () => {
|
|
20
|
+
if (this.providerService === undefined) {
|
|
21
|
+
throw new Error('no LLM provider configured: activate a provider before submitting a turn');
|
|
22
|
+
}
|
|
23
|
+
const client = await this.providerService.resolveLlm();
|
|
24
|
+
if (client === undefined || client === null) {
|
|
25
|
+
throw new Error('provider service did not return an LLM client');
|
|
26
|
+
}
|
|
27
|
+
return client;
|
|
28
|
+
})();
|
|
29
|
+
}
|
|
30
|
+
return this.cached;
|
|
31
|
+
}
|
|
32
|
+
async *complete(messages, tools, signal) {
|
|
33
|
+
const client = await this.resolve();
|
|
34
|
+
yield* client.complete(messages, tools, signal);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export class GatewayToolExecutor {
|
|
38
|
+
entries = new Map();
|
|
39
|
+
guardPolicy;
|
|
40
|
+
onGuardBlock;
|
|
41
|
+
/**
|
|
42
|
+
* Attach the deterministic harness guard (`@boombot/security`).
|
|
43
|
+
* Every registered tool call is verified BEFORE its handler runs; denials
|
|
44
|
+
* never reach the handler. `onBlock` fires once per denial so the turn
|
|
45
|
+
* service can announce it on the wire. Unset (default) = no guard.
|
|
46
|
+
*/
|
|
47
|
+
setGuard(policy, onBlock) {
|
|
48
|
+
this.guardPolicy = policy;
|
|
49
|
+
this.onGuardBlock = onBlock;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Register a real tool implementation. Throws when the name is
|
|
53
|
+
* already taken so a later registration can never silently shadow one.
|
|
54
|
+
*/
|
|
55
|
+
registerTool(definition, handler) {
|
|
56
|
+
if (this.entries.has(definition.name)) {
|
|
57
|
+
throw new Error(`tool already registered: '${definition.name}'`);
|
|
58
|
+
}
|
|
59
|
+
// Sanitize once at registration: MCP/plugin schemas may carry `$ref`,
|
|
60
|
+
// `$defs`, or other keywords providers reject with a 400. Sanitizing
|
|
61
|
+
// here (instead of per request) covers every registration path —
|
|
62
|
+
// built-in, MCP, plugin, deferred — through this single choke point.
|
|
63
|
+
const sanitized = {
|
|
64
|
+
...definition,
|
|
65
|
+
parameters: sanitizeToolSchema(definition.parameters),
|
|
66
|
+
};
|
|
67
|
+
this.entries.set(definition.name, { definition: sanitized, handler });
|
|
68
|
+
}
|
|
69
|
+
/** Definitions handed to the model each round. */
|
|
70
|
+
listDefinitions() {
|
|
71
|
+
return [...this.entries.values()].map((entry) => entry.definition);
|
|
72
|
+
}
|
|
73
|
+
async execute(call, signal) {
|
|
74
|
+
throwIfAborted(signal);
|
|
75
|
+
const entry = this.entries.get(call.name);
|
|
76
|
+
if (entry === undefined) {
|
|
77
|
+
return {
|
|
78
|
+
callId: call.id,
|
|
79
|
+
name: call.name,
|
|
80
|
+
output: `tool not registered: '${call.name}' is not available on this gateway`,
|
|
81
|
+
error: true,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
// Harness guard: deterministic pre-execution gate. A denial (or
|
|
85
|
+
// require-approval — there is no operator in this loop to approve)
|
|
86
|
+
// returns a policy error result; the handler never runs.
|
|
87
|
+
if (this.guardPolicy !== undefined) {
|
|
88
|
+
const verdict = await verifyBeforeExecute(call, new RuleEvaluator(this.guardPolicy), this.guardPolicy);
|
|
89
|
+
if (verdict.decision !== 'allow') {
|
|
90
|
+
const toolError = toGuardToolError(verdict);
|
|
91
|
+
this.onGuardBlock?.({ toolName: call.name, reason: verdict.reason, layer: verdict.layer });
|
|
92
|
+
return {
|
|
93
|
+
callId: call.id,
|
|
94
|
+
name: call.name,
|
|
95
|
+
output: `[${toolError.code}] ${toolError.message}`,
|
|
96
|
+
error: true,
|
|
97
|
+
deniedByPolicy: true,
|
|
98
|
+
toolError,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
const result = await entry.handler(call, signal);
|
|
104
|
+
// Guarantee the result answers the call the loop actually made and enrich if failed
|
|
105
|
+
return enrichWithSelfHealing(call, { ...result, callId: call.id, name: call.name });
|
|
106
|
+
}
|
|
107
|
+
catch (err) {
|
|
108
|
+
const rawErrorResult = {
|
|
109
|
+
callId: call.id,
|
|
110
|
+
name: call.name,
|
|
111
|
+
output: `tool '${call.name}' failed: ${err instanceof Error ? err.message : 'unknown error'}`,
|
|
112
|
+
error: true,
|
|
113
|
+
};
|
|
114
|
+
return enrichWithSelfHealing(call, rawErrorResult);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Attach the harness guard to a turn's tool executor. No-op when the deps
|
|
120
|
+
* do not carry a `GatewayToolExecutor` (foreign executors stay untouched).
|
|
121
|
+
*/
|
|
122
|
+
export function attachHarnessGuard(deps, policy, onBlock) {
|
|
123
|
+
if (deps.tools instanceof GatewayToolExecutor) {
|
|
124
|
+
deps.tools.setGuard(policy, onBlock);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/** Memory port delegating to the gateway memory service; `[]` when absent. */
|
|
128
|
+
class GatewayMemoryPort {
|
|
129
|
+
memoryService;
|
|
130
|
+
constructor(memoryService) {
|
|
131
|
+
this.memoryService = memoryService;
|
|
132
|
+
}
|
|
133
|
+
async recall(query) {
|
|
134
|
+
if (this.memoryService === undefined) {
|
|
135
|
+
return [];
|
|
136
|
+
}
|
|
137
|
+
return this.memoryService.recall(query);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Policy port over `DefaultApprovalPolicy` (deterministic risk floors).
|
|
142
|
+
*
|
|
143
|
+
* - `allow` → the call proceeds.
|
|
144
|
+
* - `deny` → the loop stops safely.
|
|
145
|
+
* - `require-approval` → the loop sees `ask`; the turn service supplies the
|
|
146
|
+
* ApprovalPort and pauses until the operator answers `turn.approve`.
|
|
147
|
+
*/
|
|
148
|
+
class GatewayPolicyPort {
|
|
149
|
+
principalId;
|
|
150
|
+
policy;
|
|
151
|
+
constructor(principalId, allowTools = [], denyTools = [], autonomous = false) {
|
|
152
|
+
this.principalId = principalId;
|
|
153
|
+
// Operators may explicitly allow or hard-deny tools. Everything else
|
|
154
|
+
// keeps the default risk policy and can pause for HITL approval.
|
|
155
|
+
this.policy = new DefaultApprovalPolicy({
|
|
156
|
+
allowTools: [...allowTools],
|
|
157
|
+
denyTools: [...denyTools],
|
|
158
|
+
autonomous,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
checkToolCall(call) {
|
|
162
|
+
const evaluation = this.policy.evaluate({
|
|
163
|
+
tool: call.name,
|
|
164
|
+
args: call.arguments,
|
|
165
|
+
principalId: this.principalId,
|
|
166
|
+
});
|
|
167
|
+
return evaluation.decision === 'require-approval' ? 'ask' : evaluation.decision;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/** Build one turn's runtime deps. Cheap and side-effect free (LLM resolves lazily). */
|
|
171
|
+
export function createAgentRuntimeDeps(options = {}) {
|
|
172
|
+
return {
|
|
173
|
+
llm: new LazyLlmClient(options.providerService),
|
|
174
|
+
tools: new GatewayToolExecutor(),
|
|
175
|
+
memory: new GatewayMemoryPort(options.memoryService),
|
|
176
|
+
policy: new GatewayPolicyPort(options.principalId ?? 'gateway', options.policyAllowTools ?? [], options.policyDenyTools ?? [], options.autonomous ?? false),
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Read the tool definitions to offer the model. Works on any
|
|
181
|
+
* `AgentRuntimeDeps`; returns `[]` for foreign `ToolExecutor`
|
|
182
|
+
* implementations that do not expose a definition list.
|
|
183
|
+
*/
|
|
184
|
+
/**
|
|
185
|
+
* Id used to probe the policy for a tool's verdict. A definition is judged
|
|
186
|
+
* by NAME, before the model has picked arguments, so the probe carries none.
|
|
187
|
+
* A policy that denies on *arguments* is unaffected: it still denies at
|
|
188
|
+
* execution time, exactly as before.
|
|
189
|
+
*/
|
|
190
|
+
const POLICY_PROBE_CALL_ID = 'policy-probe';
|
|
191
|
+
/**
|
|
192
|
+
* Read the tool definitions to offer the model, minus the ones this turn's
|
|
193
|
+
* policy would hard-deny.
|
|
194
|
+
*
|
|
195
|
+
* A denied tool is worse than an absent one. The model cannot see the
|
|
196
|
+
* policy, so it reaches for whatever looks useful (`shell.exec` is the
|
|
197
|
+
* obvious way to "find a file"), the call is refused, and a refusal stops
|
|
198
|
+
* the entire turn — the model is punished for a choice it had no way to
|
|
199
|
+
* make correctly. Filtering is what turns the fail-closed default into a
|
|
200
|
+
* capability list rather than a trap.
|
|
201
|
+
*
|
|
202
|
+
* `'ask'` decisions are deliberately kept: those are the calls a human may
|
|
203
|
+
* legitimately approve, and the approval gate is the point of them.
|
|
204
|
+
*/
|
|
205
|
+
export async function getToolDefinitions(deps) {
|
|
206
|
+
const tools = deps.tools;
|
|
207
|
+
if (typeof tools.listDefinitions !== 'function')
|
|
208
|
+
return [];
|
|
209
|
+
const definitions = tools.listDefinitions();
|
|
210
|
+
const judged = await Promise.all(definitions.map(async (definition) => ({
|
|
211
|
+
definition,
|
|
212
|
+
decision: await deps.policy.checkToolCall({
|
|
213
|
+
id: POLICY_PROBE_CALL_ID,
|
|
214
|
+
name: definition.name,
|
|
215
|
+
arguments: {},
|
|
216
|
+
}),
|
|
217
|
+
})));
|
|
218
|
+
return judged
|
|
219
|
+
.filter((entry) => entry.decision !== 'deny')
|
|
220
|
+
.map((entry) => entry.definition);
|
|
221
|
+
}
|
|
222
|
+
function throwIfAborted(signal) {
|
|
223
|
+
if (signal?.aborted === true) {
|
|
224
|
+
const err = new Error('turn cancelled');
|
|
225
|
+
err.name = 'AbortError';
|
|
226
|
+
throw err;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-Configuration & In-Process Plugin Management Tools.
|
|
3
|
+
*
|
|
4
|
+
* Allows BoomBot to dynamically inspect, update, and self-evolve its own
|
|
5
|
+
* runtime configuration and plugin ecosystem WITHOUT dropping connections or
|
|
6
|
+
* restarting the gateway process.
|
|
7
|
+
*/
|
|
8
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
9
|
+
import { PluginInstaller } from '@boombot/plugins';
|
|
10
|
+
export const CONFIG_MANAGE_TOOL_NAME = 'config_manage';
|
|
11
|
+
export const PLUGIN_MANAGE_TOOL_NAME = 'plugin_manage';
|
|
12
|
+
export const configManageDefinition = {
|
|
13
|
+
name: CONFIG_MANAGE_TOOL_NAME,
|
|
14
|
+
description: 'Inspect or update BoomBot runtime configuration (autonomous mode, ports, providers, shell opt-in) without restart.',
|
|
15
|
+
parameters: {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
action: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
enum: ['get', 'update'],
|
|
21
|
+
description: "'get' to read current configuration; 'update' to patch configuration.",
|
|
22
|
+
},
|
|
23
|
+
settings: {
|
|
24
|
+
type: 'object',
|
|
25
|
+
description: 'Key-value pairs to merge into config.json when action is update.',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
required: ['action'],
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
export const pluginManageDefinition = {
|
|
32
|
+
name: PLUGIN_MANAGE_TOOL_NAME,
|
|
33
|
+
description: 'Manage BoomBot plugins live without dropping sessions: list installed & marketplace plugins, install new plugins from catalog/git/npm, uninstall, or hot-reload.',
|
|
34
|
+
parameters: {
|
|
35
|
+
type: 'object',
|
|
36
|
+
properties: {
|
|
37
|
+
action: {
|
|
38
|
+
type: 'string',
|
|
39
|
+
enum: ['list', 'install', 'uninstall', 'reload'],
|
|
40
|
+
description: 'Action to perform: list, install, uninstall, or hot-reload.',
|
|
41
|
+
},
|
|
42
|
+
name: {
|
|
43
|
+
type: 'string',
|
|
44
|
+
description: 'Plugin identifier (e.g. boombot.browser), git repository URL, or npm package name for install/uninstall.',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
required: ['action'],
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
export function registerSelfConfigTools(registry, options) {
|
|
51
|
+
const { configPath, pluginsRoot, liveConfig, pluginManager } = options;
|
|
52
|
+
// 1. config_manage
|
|
53
|
+
registry.registerTool(configManageDefinition, async (call) => {
|
|
54
|
+
const action = String(call.arguments['action'] ?? 'get');
|
|
55
|
+
if (action === 'get') {
|
|
56
|
+
try {
|
|
57
|
+
const raw = await readFile(configPath, 'utf8');
|
|
58
|
+
const parsed = JSON.parse(raw);
|
|
59
|
+
return {
|
|
60
|
+
callId: call.id,
|
|
61
|
+
name: call.name,
|
|
62
|
+
output: JSON.stringify({
|
|
63
|
+
status: 'ok',
|
|
64
|
+
configPath,
|
|
65
|
+
config: parsed,
|
|
66
|
+
liveRuntime: {
|
|
67
|
+
autonomous: liveConfig['autonomous'] ?? true,
|
|
68
|
+
installedPlugins: pluginManager?.manifests.map((m) => m.id) ?? [],
|
|
69
|
+
registeredPluginTools: pluginManager?.toolNames ?? [],
|
|
70
|
+
},
|
|
71
|
+
}, null, 2),
|
|
72
|
+
error: false,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
return {
|
|
77
|
+
callId: call.id,
|
|
78
|
+
name: call.name,
|
|
79
|
+
output: `Failed to read config file: ${err instanceof Error ? err.message : String(err)}`,
|
|
80
|
+
error: true,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (action === 'update') {
|
|
85
|
+
const updates = call.arguments['settings'];
|
|
86
|
+
if (!updates || typeof updates !== 'object') {
|
|
87
|
+
return {
|
|
88
|
+
callId: call.id,
|
|
89
|
+
name: call.name,
|
|
90
|
+
output: 'Error: settings object required for update action',
|
|
91
|
+
error: true,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
let existing = {};
|
|
96
|
+
try {
|
|
97
|
+
const raw = await readFile(configPath, 'utf8');
|
|
98
|
+
existing = JSON.parse(raw);
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
// fresh
|
|
102
|
+
}
|
|
103
|
+
const merged = { ...existing, ...updates };
|
|
104
|
+
await writeFile(configPath, JSON.stringify(merged, null, 2), 'utf8');
|
|
105
|
+
// Apply live updates in memory immediately
|
|
106
|
+
for (const [k, v] of Object.entries(updates)) {
|
|
107
|
+
liveConfig[k] = v;
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
callId: call.id,
|
|
111
|
+
name: call.name,
|
|
112
|
+
output: JSON.stringify({
|
|
113
|
+
status: 'ok',
|
|
114
|
+
message: 'Configuration updated and applied live to memory and disk.',
|
|
115
|
+
updatedKeys: Object.keys(updates),
|
|
116
|
+
}, null, 2),
|
|
117
|
+
error: false,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
return {
|
|
122
|
+
callId: call.id,
|
|
123
|
+
name: call.name,
|
|
124
|
+
output: `Failed to write config: ${err instanceof Error ? err.message : String(err)}`,
|
|
125
|
+
error: true,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
callId: call.id,
|
|
131
|
+
name: call.name,
|
|
132
|
+
output: `Unknown action: ${action}`,
|
|
133
|
+
error: true,
|
|
134
|
+
};
|
|
135
|
+
});
|
|
136
|
+
// 2. plugin_manage
|
|
137
|
+
registry.registerTool(pluginManageDefinition, async (call) => {
|
|
138
|
+
const action = String(call.arguments['action'] ?? 'list');
|
|
139
|
+
const name = String(call.arguments['name'] ?? '').trim();
|
|
140
|
+
if (action === 'list') {
|
|
141
|
+
try {
|
|
142
|
+
const installed = await PluginInstaller.listInstalled(pluginsRoot);
|
|
143
|
+
const catalog = PluginInstaller.getMarketplace();
|
|
144
|
+
return {
|
|
145
|
+
callId: call.id,
|
|
146
|
+
name: call.name,
|
|
147
|
+
output: JSON.stringify({
|
|
148
|
+
installedCount: installed.length,
|
|
149
|
+
installed: installed.map((p) => ({
|
|
150
|
+
id: p.id,
|
|
151
|
+
version: p.version,
|
|
152
|
+
displayName: p.displayName,
|
|
153
|
+
description: p.description,
|
|
154
|
+
capabilities: p.capabilities,
|
|
155
|
+
})),
|
|
156
|
+
marketplaceAvailable: catalog.map((c) => ({
|
|
157
|
+
id: c.id,
|
|
158
|
+
name: c.name,
|
|
159
|
+
description: c.description,
|
|
160
|
+
tags: c.tags,
|
|
161
|
+
})),
|
|
162
|
+
}, null, 2),
|
|
163
|
+
error: false,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
catch (err) {
|
|
167
|
+
return {
|
|
168
|
+
callId: call.id,
|
|
169
|
+
name: call.name,
|
|
170
|
+
output: `Failed to list plugins: ${err instanceof Error ? err.message : String(err)}`,
|
|
171
|
+
error: true,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (action === 'install') {
|
|
176
|
+
if (!name) {
|
|
177
|
+
return {
|
|
178
|
+
callId: call.id,
|
|
179
|
+
name: call.name,
|
|
180
|
+
output: 'Error: plugin name or source required for install action',
|
|
181
|
+
error: true,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
try {
|
|
185
|
+
const res = await PluginInstaller.install(name, { root: pluginsRoot });
|
|
186
|
+
// Live hot-reload into memory
|
|
187
|
+
if (pluginManager) {
|
|
188
|
+
await pluginManager.reload();
|
|
189
|
+
}
|
|
190
|
+
return {
|
|
191
|
+
callId: call.id,
|
|
192
|
+
name: call.name,
|
|
193
|
+
output: JSON.stringify({
|
|
194
|
+
status: 'ok',
|
|
195
|
+
message: `Plugin '${res.id}' installed and activated live with zero downtime!`,
|
|
196
|
+
installedPlugin: res,
|
|
197
|
+
activePluginTools: pluginManager?.toolNames ?? [],
|
|
198
|
+
}, null, 2),
|
|
199
|
+
error: false,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
catch (err) {
|
|
203
|
+
return {
|
|
204
|
+
callId: call.id,
|
|
205
|
+
name: call.name,
|
|
206
|
+
output: `Failed to install plugin '${name}': ${err instanceof Error ? err.message : String(err)}`,
|
|
207
|
+
error: true,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (action === 'uninstall') {
|
|
212
|
+
if (!name) {
|
|
213
|
+
return {
|
|
214
|
+
callId: call.id,
|
|
215
|
+
name: call.name,
|
|
216
|
+
output: 'Error: plugin id required for uninstall action',
|
|
217
|
+
error: true,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
try {
|
|
221
|
+
const ok = await PluginInstaller.uninstall(name, { root: pluginsRoot });
|
|
222
|
+
if (pluginManager) {
|
|
223
|
+
await pluginManager.reload();
|
|
224
|
+
}
|
|
225
|
+
return {
|
|
226
|
+
callId: call.id,
|
|
227
|
+
name: call.name,
|
|
228
|
+
output: JSON.stringify({
|
|
229
|
+
status: ok ? 'ok' : 'not_found',
|
|
230
|
+
message: ok
|
|
231
|
+
? `Plugin '${name}' uninstalled and unloaded live.`
|
|
232
|
+
: `Plugin '${name}' not found.`,
|
|
233
|
+
activePluginTools: pluginManager?.toolNames ?? [],
|
|
234
|
+
}),
|
|
235
|
+
error: false,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
catch (err) {
|
|
239
|
+
return {
|
|
240
|
+
callId: call.id,
|
|
241
|
+
name: call.name,
|
|
242
|
+
output: `Failed to uninstall plugin: ${err instanceof Error ? err.message : String(err)}`,
|
|
243
|
+
error: true,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
if (action === 'reload') {
|
|
248
|
+
try {
|
|
249
|
+
const tools = pluginManager ? await pluginManager.reload() : [];
|
|
250
|
+
return {
|
|
251
|
+
callId: call.id,
|
|
252
|
+
name: call.name,
|
|
253
|
+
output: JSON.stringify({
|
|
254
|
+
status: 'ok',
|
|
255
|
+
message: 'Plugins hot-reloaded successfully in-memory.',
|
|
256
|
+
activePluginTools: tools,
|
|
257
|
+
}),
|
|
258
|
+
error: false,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
catch (err) {
|
|
262
|
+
return {
|
|
263
|
+
callId: call.id,
|
|
264
|
+
name: call.name,
|
|
265
|
+
output: `Failed to reload plugins: ${err instanceof Error ? err.message : String(err)}`,
|
|
266
|
+
error: true,
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return {
|
|
271
|
+
callId: call.id,
|
|
272
|
+
name: call.name,
|
|
273
|
+
output: `Unknown action: ${action}`,
|
|
274
|
+
error: true,
|
|
275
|
+
};
|
|
276
|
+
});
|
|
277
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default HITL approval window: 60 seconds.
|
|
3
|
+
*
|
|
4
|
+
* The window bounds how long a turn may sit in SILENCE, not how much work it
|
|
5
|
+
* may do. The pause is announced on the wire the moment it starts
|
|
6
|
+
* (`turn.approval_required`) and persisted as `pending`, so five minutes
|
|
7
|
+
* bought nothing over one minute except a five-minute stall when nobody was
|
|
8
|
+
* watching the client. At the deadline the call is recorded `expired` and
|
|
9
|
+
* rejected; that is a turn the user can retry, not one that looks hung.
|
|
10
|
+
*/
|
|
11
|
+
export const DEFAULT_APPROVAL_TIMEOUT_MS = 60_000;
|