@poolzin/pool-bot 2026.2.24 → 2026.2.26
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/CHANGELOG.md +21 -0
- package/dist/acp/client.js +207 -18
- package/dist/acp/event-mapper.js +87 -22
- package/dist/acp/meta.js +12 -6
- package/dist/acp/secret-file.js +22 -0
- package/dist/agents/agent-paths.js +8 -9
- package/dist/agents/agent-scope.js +17 -5
- package/dist/agents/auth-profiles/oauth.js +148 -64
- package/dist/agents/auth-profiles/session-override.js +13 -7
- package/dist/agents/bash-process-registry.test-helpers.js +29 -0
- package/dist/agents/bash-tools.exec-approval-request.js +20 -0
- package/dist/agents/bash-tools.exec-host-gateway.js +240 -0
- package/dist/agents/bash-tools.exec-host-node.js +235 -0
- package/dist/agents/bash-tools.exec-runtime.js +2 -25
- package/dist/agents/bash-tools.exec-types.js +1 -0
- package/dist/agents/bash-tools.process.js +224 -218
- package/dist/agents/bedrock-discovery.js +3 -1
- package/dist/agents/byteplus-models.js +97 -0
- package/dist/agents/chutes-oauth.js +1 -0
- package/dist/agents/cli-runner/helpers.js +4 -0
- package/dist/agents/compaction.js +41 -14
- package/dist/agents/content-blocks.js +16 -0
- package/dist/agents/doubao-models.js +121 -0
- package/dist/agents/failover-error.js +2 -0
- package/dist/agents/huggingface-models.js +5 -3
- package/dist/agents/live-model-filter.js +5 -0
- package/dist/agents/minimax-vlm.js +10 -8
- package/dist/agents/model-auth.js +6 -0
- package/dist/agents/model-catalog.js +3 -1
- package/dist/agents/model-fallback.js +96 -101
- package/dist/agents/model-selection.js +7 -1
- package/dist/agents/models-config.providers.js +364 -165
- package/dist/agents/ollama-stream.js +117 -4
- package/dist/agents/opencode-zen-models.js +22 -11
- package/dist/agents/pi-embedded-helpers/errors.js +55 -33
- package/dist/agents/pi-embedded-helpers/messaging-dedupe.js +10 -5
- package/dist/agents/pi-embedded-helpers/thinking.js +10 -5
- package/dist/agents/pi-embedded-helpers.js +1 -1
- package/dist/agents/pi-embedded-payloads.js +1 -0
- package/dist/agents/pi-embedded-runner/compact.js +29 -7
- package/dist/agents/pi-embedded-runner/extensions.js +28 -26
- package/dist/agents/pi-embedded-runner/google.js +20 -8
- package/dist/agents/pi-embedded-runner/run/attempt.js +95 -36
- package/dist/agents/pi-embedded-runner/run.js +71 -12
- package/dist/agents/pi-embedded-runner/run.overflow-compaction.fixture.js +34 -0
- package/dist/agents/pi-embedded-runner/run.overflow-compaction.mocks.shared.js +11 -2
- package/dist/agents/pi-embedded-runner/session-manager-cache.js +11 -7
- package/dist/agents/pi-embedded-runner/system-prompt.js +2 -0
- package/dist/agents/pi-embedded-runner/thinking.js +42 -0
- package/dist/agents/pi-embedded-runner/tool-name-allowlist.js +19 -0
- package/dist/agents/pi-embedded-runner/utils.js +7 -10
- package/dist/agents/pi-embedded-subscribe.handlers.lifecycle.js +45 -56
- package/dist/agents/pi-embedded-subscribe.handlers.tools.js +2 -2
- package/dist/agents/pi-embedded-subscribe.js +9 -4
- package/dist/agents/pi-embedded-subscribe.tools.js +68 -14
- package/dist/agents/pi-embedded-utils.js +3 -0
- package/dist/agents/pi-extensions/compaction-safeguard-runtime.js +4 -20
- package/dist/agents/pi-extensions/compaction-safeguard.js +75 -33
- package/dist/agents/pi-settings.js +40 -0
- package/dist/agents/pi-tools.policy.js +2 -1
- package/dist/agents/provider/config-loader.js +1 -1
- package/dist/agents/sandbox/browser.js +170 -33
- package/dist/agents/sandbox/config-hash.js +14 -27
- package/dist/agents/sandbox/config.js +21 -2
- package/dist/agents/sandbox/constants.js +2 -0
- package/dist/agents/sandbox/docker.js +16 -2
- package/dist/agents/sandbox/novnc-auth.js +62 -0
- package/dist/agents/sandbox/sanitize-env-vars.js +1 -1
- package/dist/agents/sandbox/shared.js +10 -6
- package/dist/agents/sandbox-paths.js +24 -11
- package/dist/agents/schema/clean-for-gemini.js +132 -85
- package/dist/agents/session-slug.js +10 -5
- package/dist/agents/session-tool-result-guard-wrapper.js +1 -0
- package/dist/agents/session-tool-result-guard.js +3 -1
- package/dist/agents/session-transcript-repair.js +40 -6
- package/dist/agents/skills/bundled-dir.js +19 -5
- package/dist/agents/skills/env-overrides.js +124 -43
- package/dist/agents/skills/frontmatter.js +6 -6
- package/dist/agents/skills/plugin-skills.js +14 -7
- package/dist/agents/skills/workspace.js +1 -0
- package/dist/agents/skills.test-helpers.js +13 -0
- package/dist/agents/stable-stringify.js +12 -0
- package/dist/agents/subagent-announce.js +251 -49
- package/dist/agents/subagent-lifecycle-events.js +19 -0
- package/dist/agents/subagent-registry-cleanup.js +31 -0
- package/dist/agents/subagent-registry-completion.js +68 -0
- package/dist/agents/subagent-registry-queries.js +117 -0
- package/dist/agents/subagent-registry-state.js +46 -0
- package/dist/agents/subagent-registry.js +252 -221
- package/dist/agents/subagent-registry.mocks.shared.js +12 -0
- package/dist/agents/subagent-registry.store.js +1 -0
- package/dist/agents/subagent-registry.types.js +1 -0
- package/dist/agents/subagent-spawn.js +195 -7
- package/dist/agents/system-prompt.js +22 -6
- package/dist/agents/test-helpers/assistant-message-fixtures.js +29 -0
- package/dist/agents/test-helpers/fast-coding-tools.js +1 -18
- package/dist/agents/test-helpers/fast-core-tools.js +1 -17
- package/dist/agents/test-helpers/pi-tools-sandbox-context.js +27 -0
- package/dist/agents/timeout.js +18 -6
- package/dist/agents/tool-call-id.js +1 -1
- package/dist/agents/tool-display-common.js +162 -29
- package/dist/agents/tool-images.js +82 -9
- package/dist/agents/tool-policy-shared.js +108 -0
- package/dist/agents/tool-policy.js +51 -26
- package/dist/agents/tools/browser-tool.js +160 -54
- package/dist/agents/tools/canvas-tool.js +27 -1
- package/dist/agents/tools/common.js +45 -0
- package/dist/agents/tools/cron-tool.test-helpers.js +12 -0
- package/dist/agents/tools/discord-actions-guild.js +4 -1
- package/dist/agents/tools/discord-actions-moderation-shared.js +27 -0
- package/dist/agents/tools/gateway-tool.js +3 -1
- package/dist/agents/tools/image-tool.js +214 -99
- package/dist/agents/tools/nodes-utils.js +1 -10
- package/dist/agents/tools/sessions-history-tool.js +140 -108
- package/dist/agents/tools/sessions-send-helpers.js +12 -6
- package/dist/agents/tools/sessions-spawn-tool.js +8 -2
- package/dist/agents/tools/subagents-tool.js +2 -1
- package/dist/agents/tools/whatsapp-actions.js +10 -2
- package/dist/agents/tools/whatsapp-target-auth.js +18 -0
- package/dist/agents/transcript-policy.js +22 -8
- package/dist/agents/venice-models.js +11 -3
- package/dist/agents/workspace.js +222 -46
- package/dist/auto-reply/commands-registry.data.js +51 -0
- package/dist/auto-reply/commands-registry.js +19 -21
- package/dist/auto-reply/fallback-state.js +114 -0
- package/dist/auto-reply/group-activation.js +10 -5
- package/dist/auto-reply/inbound-debounce.js +10 -5
- package/dist/auto-reply/model-runtime.js +68 -0
- package/dist/auto-reply/reply/abort.js +1 -1
- package/dist/auto-reply/reply/agent-runner-execution.js +40 -5
- package/dist/auto-reply/reply/agent-runner.js +165 -39
- package/dist/auto-reply/reply/bash-command.js +41 -39
- package/dist/auto-reply/reply/command-gates.js +25 -0
- package/dist/auto-reply/reply/commands-allowlist.js +111 -72
- package/dist/auto-reply/reply/commands-bash.js +6 -5
- package/dist/auto-reply/reply/commands-config.js +30 -28
- package/dist/auto-reply/reply/commands-core.js +2 -1
- package/dist/auto-reply/reply/commands-info.js +1 -0
- package/dist/auto-reply/reply/commands-models.js +65 -14
- package/dist/auto-reply/reply/commands-session.js +237 -82
- package/dist/auto-reply/reply/commands-setunset-standard.js +13 -0
- package/dist/auto-reply/reply/commands-setunset.js +45 -0
- package/dist/auto-reply/reply/commands-subagents/action-agents.js +44 -0
- package/dist/auto-reply/reply/commands-subagents/action-focus.js +64 -0
- package/dist/auto-reply/reply/commands-subagents/action-help.js +4 -0
- package/dist/auto-reply/reply/commands-subagents/action-info.js +45 -0
- package/dist/auto-reply/reply/commands-subagents/action-kill.js +60 -0
- package/dist/auto-reply/reply/commands-subagents/action-list.js +44 -0
- package/dist/auto-reply/reply/commands-subagents/action-log.js +29 -0
- package/dist/auto-reply/reply/commands-subagents/action-send.js +119 -0
- package/dist/auto-reply/reply/commands-subagents/action-spawn.js +52 -0
- package/dist/auto-reply/reply/commands-subagents/action-unfocus.js +30 -0
- package/dist/auto-reply/reply/commands-subagents/shared.js +303 -0
- package/dist/auto-reply/reply/commands-subagents.js +51 -587
- package/dist/auto-reply/reply/commands-tts.js +10 -5
- package/dist/auto-reply/reply/config-value.js +10 -5
- package/dist/auto-reply/reply/directive-handling.model-picker.js +12 -6
- package/dist/auto-reply/reply/directive-handling.persist.js +9 -21
- package/dist/auto-reply/reply/directive-handling.shared.js +24 -4
- package/dist/auto-reply/reply/followup-runner.js +1 -0
- package/dist/auto-reply/reply/get-reply-directives-utils.js +23 -14
- package/dist/auto-reply/reply/get-reply-directives.js +17 -28
- package/dist/auto-reply/reply/get-reply-inline-actions.js +1 -0
- package/dist/auto-reply/reply/get-reply.js +71 -12
- package/dist/auto-reply/reply/model-selection.js +80 -39
- package/dist/auto-reply/reply/queue/enqueue.js +10 -5
- package/dist/auto-reply/reply/queue/state.js +13 -12
- package/dist/auto-reply/reply/reply-payloads.js +67 -36
- package/dist/auto-reply/reply/reply-reference.js +9 -8
- package/dist/auto-reply/reply/route-reply.js +15 -8
- package/dist/auto-reply/reply/session-reset-prompt.js +1 -1
- package/dist/auto-reply/reply/session.js +22 -6
- package/dist/auto-reply/reply/strip-inbound-meta.js +147 -0
- package/dist/auto-reply/reply/subagents-utils.js +56 -30
- package/dist/auto-reply/reply/typing.js +46 -21
- package/dist/auto-reply/send-policy.js +14 -7
- package/dist/auto-reply/status.js +140 -16
- package/dist/auto-reply/templating.js +10 -5
- package/dist/auto-reply/thinking.js +7 -16
- package/dist/auto-reply/tokens.js +21 -5
- package/dist/browser/bridge-server.js +36 -20
- package/dist/browser/cdp.helpers.js +7 -14
- package/dist/browser/cdp.js +35 -15
- package/dist/browser/chrome.profile-decoration.js +7 -4
- package/dist/browser/config.js +30 -0
- package/dist/browser/extension-relay-auth.js +55 -0
- package/dist/browser/extension-relay.js +74 -29
- package/dist/browser/navigation-guard.js +39 -0
- package/dist/browser/paths.js +77 -0
- package/dist/browser/profiles.js +13 -8
- package/dist/browser/pw-ai-module.js +10 -5
- package/dist/browser/pw-session.js +76 -39
- package/dist/browser/pw-tools-core.interactions.js +14 -7
- package/dist/browser/pw-tools-core.state.js +12 -6
- package/dist/browser/routes/agent.act.js +431 -424
- package/dist/browser/routes/agent.shared.js +47 -3
- package/dist/browser/routes/agent.snapshot.js +122 -116
- package/dist/browser/routes/agent.storage.js +303 -297
- package/dist/browser/routes/tabs.js +154 -100
- package/dist/browser/server-context.js +7 -0
- package/dist/browser/server-lifecycle.js +37 -0
- package/dist/build-info.json +3 -3
- package/dist/channels/allow-from.js +26 -0
- package/dist/channels/allowlists/resolve-utils.js +43 -19
- package/dist/channels/channel-config.js +14 -7
- package/dist/channels/draft-stream-loop.js +7 -0
- package/dist/channels/model-overrides.js +82 -0
- package/dist/channels/plugins/account-action-gate.js +13 -0
- package/dist/channels/plugins/message-actions.js +10 -0
- package/dist/channels/plugins/normalize/imessage.js +14 -7
- package/dist/channels/plugins/normalize/slack.js +10 -5
- package/dist/channels/plugins/normalize/telegram.js +14 -7
- package/dist/channels/plugins/outbound/discord.js +80 -8
- package/dist/channels/plugins/outbound/signal.js +11 -11
- package/dist/channels/plugins/setup-helpers.js +10 -5
- package/dist/channels/sender-label.js +14 -7
- package/dist/channels/session.js +4 -2
- package/dist/channels/status-reactions.js +297 -0
- package/dist/channels/telegram/api.js +18 -0
- package/dist/cli/argv.js +84 -21
- package/dist/cli/banner.js +3 -2
- package/dist/cli/browser-cli-actions-input/register.files-downloads.js +65 -56
- package/dist/cli/cli-name.js +11 -11
- package/dist/cli/cli-utils.js +13 -3
- package/dist/cli/command-format.js +1 -1
- package/dist/cli/config-cli.js +1 -1
- package/dist/cli/daemon-cli/lifecycle-core.js +31 -19
- package/dist/cli/daemon-cli/lifecycle.js +64 -2
- package/dist/cli/daemon-cli/restart-health.js +126 -0
- package/dist/cli/daemon-cli/status.gather.js +9 -13
- package/dist/cli/daemon-cli/status.print.js +2 -10
- package/dist/cli/deps.js +27 -22
- package/dist/cli/exec-approvals-cli.js +92 -124
- package/dist/cli/gateway-cli/run-loop.js +23 -5
- package/dist/cli/memory-cli.js +158 -61
- package/dist/cli/node-cli/register.js +14 -5
- package/dist/cli/nodes-cli/register.push.js +63 -0
- package/dist/cli/nodes-media-utils.js +26 -0
- package/dist/cli/outbound-send-deps.js +2 -9
- package/dist/cli/outbound-send-mapping.js +11 -0
- package/dist/cli/pairing-cli.js +40 -14
- package/dist/cli/plugins-cli.js +250 -73
- package/dist/cli/ports.js +11 -10
- package/dist/cli/program/build-program.js +3 -1
- package/dist/cli/program/command-registry.js +214 -136
- package/dist/cli/program/command-tree.js +16 -0
- package/dist/cli/program/help.js +43 -12
- package/dist/cli/program/preaction.js +13 -9
- package/dist/cli/program/register.configure.js +3 -18
- package/dist/cli/program/register.maintenance.js +2 -2
- package/dist/cli/program/register.onboard.js +2 -0
- package/dist/cli/program/register.status-health-sessions.js +16 -17
- package/dist/cli/program/register.subclis.js +93 -52
- package/dist/cli/route.js +12 -8
- package/dist/cli/system-cli.js +36 -46
- package/dist/cli/test-runtime-capture.js +24 -0
- package/dist/cli/update-cli/shared.js +22 -9
- package/dist/cli/update-cli/update-command.js +89 -14
- package/dist/cli/update-cli/wizard.js +6 -12
- package/dist/commands/agent/run-context.js +18 -5
- package/dist/commands/agent/session-store.js +17 -4
- package/dist/commands/agent.js +185 -89
- package/dist/commands/agents.bindings.js +14 -7
- package/dist/commands/agents.commands.add.js +13 -9
- package/dist/commands/agents.commands.identity.js +12 -6
- package/dist/commands/agents.commands.list.js +11 -6
- package/dist/commands/agents.config.js +8 -10
- package/dist/commands/agents.providers.js +12 -6
- package/dist/commands/auth-choice-options.js +103 -75
- package/dist/commands/auth-choice.apply.byteplus.js +55 -0
- package/dist/commands/auth-choice.apply.js +4 -0
- package/dist/commands/auth-choice.apply.minimax.js +61 -13
- package/dist/commands/auth-choice.apply.openai.js +3 -1
- package/dist/commands/auth-choice.apply.volcengine.js +55 -0
- package/dist/commands/auth-choice.preferred-provider.js +2 -0
- package/dist/commands/channels/remove.js +13 -6
- package/dist/commands/channels/shared.js +4 -14
- package/dist/commands/channels.mock-harness.js +23 -0
- package/dist/commands/configure.commands.js +14 -0
- package/dist/commands/configure.gateway.js +2 -4
- package/dist/commands/configure.js +1 -1
- package/dist/commands/configure.shared.js +11 -0
- package/dist/commands/daemon-install-helpers.js +2 -2
- package/dist/commands/daemon-install-runtime-warning.js +11 -0
- package/dist/commands/dashboard.js +12 -10
- package/dist/commands/docs.js +14 -8
- package/dist/commands/doctor-config-flow.js +11 -9
- package/dist/commands/doctor-legacy-config.js +281 -0
- package/dist/commands/doctor-state-integrity.js +99 -23
- package/dist/commands/doctor-update.js +12 -9
- package/dist/commands/models/list.list-command.js +7 -5
- package/dist/commands/models/set-image.js +2 -21
- package/dist/commands/node-daemon-install-helpers.js +10 -8
- package/dist/commands/onboard-auth.config-minimax.js +54 -80
- package/dist/commands/onboard-auth.config-opencode.js +2 -18
- package/dist/commands/onboard-auth.credentials.js +90 -13
- package/dist/commands/onboard-auth.js +1 -1
- package/dist/commands/onboard-auth.models.js +6 -5
- package/dist/commands/onboard-hooks.js +1 -1
- package/dist/commands/onboard-non-interactive/api-keys.js +14 -7
- package/dist/commands/onboard-non-interactive/local/auth-choice.js +64 -49
- package/dist/commands/onboard-provider-auth-flags.js +14 -0
- package/dist/commands/onboard-remote.js +14 -7
- package/dist/commands/onboard.js +11 -13
- package/dist/commands/sandbox-display.js +6 -5
- package/dist/commands/sessions.test-helpers.js +61 -0
- package/dist/commands/status-all/diagnosis.js +14 -10
- package/dist/commands/status-all/format.js +1 -0
- package/dist/commands/status.gateway-probe.js +1 -16
- package/dist/commands/systemd-linger.js +12 -6
- package/dist/config/agent-limits.js +2 -0
- package/dist/config/commands.js +32 -15
- package/dist/config/config-paths.js +9 -11
- package/dist/config/config.js +1 -1
- package/dist/config/defaults.js +22 -2
- package/dist/config/discord-preview-streaming.js +104 -0
- package/dist/config/env-substitution.js +62 -34
- package/dist/config/env-vars.js +45 -7
- package/dist/config/includes.js +4 -0
- package/dist/config/io.js +656 -171
- package/dist/config/legacy.migrations.part-1.js +189 -78
- package/dist/config/legacy.shared.js +3 -1
- package/dist/config/merge-patch.js +54 -4
- package/dist/config/prototype-keys.js +4 -0
- package/dist/config/redact-snapshot.js +404 -76
- package/dist/config/schema.help.js +44 -7
- package/dist/config/schema.js +58 -570
- package/dist/config/schema.labels.js +38 -6
- package/dist/config/sessions/delivery-info.js +10 -3
- package/dist/config/sessions/main-session.js +10 -5
- package/dist/config/sessions/session-file.js +33 -0
- package/dist/config/sessions/session-key.js +10 -5
- package/dist/config/sessions/store.js +1 -1
- package/dist/config/sessions.js +1 -0
- package/dist/config/validation.js +140 -85
- package/dist/config/zod-schema.agent-runtime.js +11 -0
- package/dist/config/zod-schema.hooks.js +40 -11
- package/dist/config/zod-schema.installs.js +20 -0
- package/dist/config/zod-schema.js +156 -20
- package/dist/config/zod-schema.providers-core.js +78 -4
- package/dist/config/zod-schema.providers.js +6 -1
- package/dist/config/zod-schema.session.js +41 -2
- package/dist/cron/run-log.js +3 -0
- package/dist/cron/schedule.js +21 -10
- package/dist/cron/service/ops.js +35 -21
- package/dist/cron/service/timer.js +116 -16
- package/dist/cron/stagger.js +3 -1
- package/dist/daemon/cmd-argv.js +21 -0
- package/dist/daemon/cmd-set.js +58 -0
- package/dist/daemon/service-types.js +1 -0
- package/dist/discord/api.js +12 -6
- package/dist/discord/draft-chunking.js +22 -0
- package/dist/discord/draft-stream.js +124 -0
- package/dist/discord/monitor/agent-components.js +1 -1
- package/dist/discord/monitor/commands.js +5 -0
- package/dist/discord/monitor/exec-approvals.js +357 -162
- package/dist/discord/monitor/gateway-plugin.js +2 -1
- package/dist/discord/monitor/listeners.js +37 -27
- package/dist/discord/monitor/message-handler.js +4 -1
- package/dist/discord/monitor/message-handler.preflight.js +65 -8
- package/dist/discord/monitor/message-handler.process.js +246 -217
- package/dist/discord/monitor/message-utils.js +143 -6
- package/dist/discord/monitor/model-picker-preferences.js +143 -0
- package/dist/discord/monitor/model-picker.js +651 -0
- package/dist/discord/monitor/native-command.js +573 -16
- package/dist/discord/monitor/provider.allowlist.js +223 -0
- package/dist/discord/monitor/provider.js +275 -347
- package/dist/discord/monitor/provider.lifecycle.js +100 -0
- package/dist/discord/monitor/reply-delivery.js +123 -16
- package/dist/discord/monitor/thread-bindings.discord-api.js +215 -0
- package/dist/discord/monitor/thread-bindings.js +4 -0
- package/dist/discord/monitor/thread-bindings.lifecycle.js +177 -0
- package/dist/discord/monitor/thread-bindings.manager.js +423 -0
- package/dist/discord/monitor/thread-bindings.messages.js +55 -0
- package/dist/discord/monitor/thread-bindings.state.js +358 -0
- package/dist/discord/monitor/thread-bindings.types.js +6 -0
- package/dist/discord/resolve-users.js +33 -21
- package/dist/discord/send.channels.js +15 -0
- package/dist/discord/send.js +3 -2
- package/dist/discord/send.outbound.js +82 -26
- package/dist/discord/send.permissions.js +83 -30
- package/dist/discord/send.reactions.js +8 -4
- package/dist/discord/token.js +10 -5
- package/dist/discord/voice/command.js +263 -0
- package/dist/discord/voice/manager.js +531 -0
- package/dist/gateway/auth.js +72 -13
- package/dist/gateway/call.js +152 -83
- package/dist/gateway/canvas-capability.js +75 -0
- package/dist/gateway/client.js +28 -4
- package/dist/gateway/config-reload.js +3 -4
- package/dist/gateway/control-plane-audit.js +28 -0
- package/dist/gateway/control-plane-rate-limit.js +53 -0
- package/dist/gateway/control-ui.js +219 -96
- package/dist/gateway/events.js +1 -0
- package/dist/gateway/hooks-mapping.js +88 -38
- package/dist/gateway/hooks.js +109 -54
- package/dist/gateway/http-auth-helpers.js +3 -2
- package/dist/gateway/http-common.js +22 -0
- package/dist/gateway/http-endpoint-helpers.js +1 -0
- package/dist/gateway/method-scopes.js +169 -0
- package/dist/gateway/net.js +74 -9
- package/dist/gateway/node-invoke-system-run-approval.js +14 -35
- package/dist/gateway/node-registry.js +10 -5
- package/dist/gateway/openai-http.js +1 -0
- package/dist/gateway/openresponses-http.js +121 -110
- package/dist/gateway/origin-check.js +1 -18
- package/dist/gateway/probe-auth.js +2 -0
- package/dist/gateway/protocol/index.js +4 -2
- package/dist/gateway/protocol/schema/cron.js +1 -0
- package/dist/gateway/protocol/schema/devices.js +1 -0
- package/dist/gateway/protocol/schema/protocol-schemas.js +4 -1
- package/dist/gateway/protocol/schema/push.js +18 -0
- package/dist/gateway/protocol/schema/sessions.js +6 -0
- package/dist/gateway/protocol/schema.js +1 -0
- package/dist/gateway/role-policy.js +17 -0
- package/dist/gateway/server/ws-connection/connect-policy.js +37 -0
- package/dist/gateway/server/ws-connection/message-handler.js +175 -148
- package/dist/gateway/server-chat.js +83 -25
- package/dist/gateway/server-constants.js +10 -9
- package/dist/gateway/server-cron.js +1 -0
- package/dist/gateway/server-http.js +247 -54
- package/dist/gateway/server-maintenance.js +20 -5
- package/dist/gateway/server-methods/agent.js +162 -24
- package/dist/gateway/server-methods/chat.js +465 -130
- package/dist/gateway/server-methods/config.js +193 -152
- package/dist/gateway/server-methods/devices.js +17 -3
- package/dist/gateway/server-methods/models.js +11 -1
- package/dist/gateway/server-methods/nodes.helpers.js +12 -0
- package/dist/gateway/server-methods/nodes.js +251 -69
- package/dist/gateway/server-methods/push.js +53 -0
- package/dist/gateway/server-methods/sessions.js +64 -8
- package/dist/gateway/server-methods/usage.js +162 -75
- package/dist/gateway/server-node-events.js +29 -0
- package/dist/gateway/server-reload-handlers.js +2 -3
- package/dist/gateway/server-runtime-config.js +39 -13
- package/dist/gateway/server-runtime-state.js +2 -0
- package/dist/gateway/server-startup-memory.js +17 -11
- package/dist/gateway/server-ws-runtime.js +1 -0
- package/dist/gateway/server.impl.js +296 -139
- package/dist/gateway/session-preview.test-helpers.js +11 -0
- package/dist/gateway/session-utils.fs.js +32 -34
- package/dist/gateway/sessions-resolve.js +17 -5
- package/dist/gateway/startup-auth.js +126 -0
- package/dist/gateway/test-helpers.agent-results.js +15 -0
- package/dist/gateway/test-helpers.mocks.js +37 -14
- package/dist/gateway/test-helpers.openai-mock.js +14 -7
- package/dist/gateway/test-helpers.server.js +161 -77
- package/dist/gateway/tools-invoke-http.js +21 -10
- package/dist/hooks/bundled/bootstrap-extra-files/handler.js +3 -1
- package/dist/hooks/bundled/command-logger/handler.js +7 -2
- package/dist/hooks/bundled/session-memory/handler.js +170 -38
- package/dist/hooks/frontmatter.js +6 -6
- package/dist/hooks/gmail-watcher-lifecycle.js +23 -0
- package/dist/hooks/gmail-watcher.js +11 -6
- package/dist/hooks/internal-hooks.js +11 -1
- package/dist/hooks/llm-slug-generator.js +4 -1
- package/dist/hooks/workspace.js +47 -17
- package/dist/imessage/accounts.js +9 -20
- package/dist/imessage/monitor/inbound-processing.js +2 -1
- package/dist/infra/archive-path.js +49 -0
- package/dist/infra/archive.js +174 -73
- package/dist/infra/control-ui-assets.js +14 -6
- package/dist/infra/device-pairing.js +204 -144
- package/dist/infra/env.js +10 -5
- package/dist/infra/exec-approvals-allowlist.js +141 -70
- package/dist/infra/exec-approvals-analysis.js +78 -20
- package/dist/infra/exec-approvals.js +5 -17
- package/dist/infra/exec-safe-bin-policy.js +277 -0
- package/dist/infra/fixed-window-rate-limit.js +33 -0
- package/dist/infra/fs-safe.js +71 -39
- package/dist/infra/gateway-lock.js +6 -2
- package/dist/infra/git-root.js +61 -0
- package/dist/infra/heartbeat-active-hours.js +2 -2
- package/dist/infra/heartbeat-reason.js +40 -0
- package/dist/infra/heartbeat-runner.js +72 -32
- package/dist/infra/heartbeat-wake.js +6 -12
- package/dist/infra/host-env-security-policy.json +19 -0
- package/dist/infra/host-env-security.js +66 -0
- package/dist/infra/install-source-utils.js +91 -7
- package/dist/infra/net/ssrf.js +131 -38
- package/dist/infra/node-pairing.js +50 -105
- package/dist/infra/npm-integrity.js +45 -0
- package/dist/infra/npm-pack-install.js +40 -0
- package/dist/infra/outbound/bound-delivery-router.js +88 -0
- package/dist/infra/outbound/channel-adapters.js +20 -7
- package/dist/infra/outbound/channel-selection.js +12 -6
- package/dist/infra/outbound/envelope.js +1 -1
- package/dist/infra/outbound/format.js +12 -6
- package/dist/infra/outbound/message-action-runner.js +107 -327
- package/dist/infra/outbound/message.js +59 -36
- package/dist/infra/outbound/outbound-policy.js +52 -25
- package/dist/infra/outbound/outbound-send-service.js +58 -71
- package/dist/infra/outbound/payloads.js +14 -7
- package/dist/infra/outbound/session-binding-service.js +123 -0
- package/dist/infra/pairing-files.js +10 -0
- package/dist/infra/path-guards.js +25 -0
- package/dist/infra/plain-object.js +9 -0
- package/dist/infra/provider-usage.fetch.codex.js +7 -15
- package/dist/infra/provider-usage.fetch.gemini.js +14 -11
- package/dist/infra/provider-usage.fetch.shared.js +30 -1
- package/dist/infra/provider-usage.fetch.zai.js +10 -9
- package/dist/infra/push-apns.js +365 -0
- package/dist/infra/restart-sentinel.js +16 -1
- package/dist/infra/restart.js +229 -26
- package/dist/infra/retry-policy.js +4 -2
- package/dist/infra/retry.js +9 -5
- package/dist/infra/scp-host.js +54 -0
- package/dist/infra/session-cost-usage.js +107 -59
- package/dist/infra/session-maintenance-warning.js +3 -1
- package/dist/infra/shell-env.js +98 -34
- package/dist/infra/ssh-config.js +12 -6
- package/dist/infra/system-run-command.js +49 -4
- package/dist/infra/update-channels.js +10 -5
- package/dist/infra/update-startup.js +86 -9
- package/dist/line/accounts.js +5 -7
- package/dist/line/bot-access.js +8 -20
- package/dist/line/bot-handlers.js +3 -1
- package/dist/link-understanding/detect.js +15 -7
- package/dist/media/constants.js +15 -6
- package/dist/media/image-ops.js +7 -0
- package/dist/media/inbound-path-policy.js +114 -0
- package/dist/media/input-files.js +16 -0
- package/dist/media/local-roots.js +3 -2
- package/dist/media-understanding/apply.js +4 -1
- package/dist/media-understanding/concurrency.js +8 -20
- package/dist/memory/backend-config.js +45 -6
- package/dist/memory/embeddings.js +10 -4
- package/dist/memory/fs-utils.js +23 -0
- package/dist/memory/manager-search.js +12 -6
- package/dist/memory/manager-sync-ops.js +12 -2
- package/dist/memory/qmd-manager.js +466 -53
- package/dist/memory/query-expansion.js +167 -3
- package/dist/memory/status-format.js +10 -5
- package/dist/memory/sync-memory-files.js +1 -1
- package/dist/memory/test-manager.js +8 -0
- package/dist/node-host/invoke-system-run.js +281 -0
- package/dist/node-host/invoke.js +55 -337
- package/dist/pairing/pairing-store.js +22 -0
- package/dist/plugin-sdk/allow-from.js +1 -1
- package/dist/plugin-sdk/command-auth.js +3 -1
- package/dist/plugin-sdk/index.js +6 -3
- package/dist/plugin-sdk/temp-path.js +47 -0
- package/dist/plugin-sdk/webhook-targets.js +32 -0
- package/dist/plugins/bundled-dir.js +9 -6
- package/dist/plugins/discovery.js +217 -23
- package/dist/plugins/hook-runner-global.js +16 -0
- package/dist/plugins/hooks.js +50 -0
- package/dist/plugins/install.js +28 -16
- package/dist/plugins/loader.js +192 -26
- package/dist/plugins/logger.js +8 -0
- package/dist/plugins/manifest-registry.js +3 -0
- package/dist/plugins/path-safety.js +34 -0
- package/dist/plugins/registry.js +5 -2
- package/dist/plugins/runtime/index.js +271 -206
- package/dist/plugins/runtime.js +3 -17
- package/dist/plugins/update.js +78 -12
- package/dist/process/spawn-utils.js +14 -7
- package/dist/providers/github-copilot-models.js +4 -1
- package/dist/providers/github-copilot-token.js +11 -6
- package/dist/providers/qwen-portal-oauth.js +14 -6
- package/dist/routing/account-id.js +30 -0
- package/dist/routing/resolve-route.js +3 -7
- package/dist/routing/session-key.js +2 -16
- package/dist/security/audit-channel.js +100 -20
- package/dist/security/audit-extra.async.js +505 -179
- package/dist/security/audit-extra.js +12 -2
- package/dist/security/audit-extra.sync.js +421 -35
- package/dist/security/audit-fs.js +31 -13
- package/dist/security/audit.js +180 -370
- package/dist/security/dm-policy-shared.js +68 -0
- package/dist/security/external-content.js +46 -14
- package/dist/security/fix.js +49 -85
- package/dist/security/scan-paths.js +20 -0
- package/dist/security/secret-equal.js +3 -7
- package/dist/security/windows-acl.js +30 -15
- package/dist/shared/entry-status.js +6 -0
- package/dist/shared/frontmatter.js +5 -5
- package/dist/shared/node-list-parse.js +13 -0
- package/dist/shared/node-match.js +11 -4
- package/dist/shared/operator-scope-compat.js +42 -0
- package/dist/shared/text-chunking.js +29 -0
- package/dist/signal/accounts.js +7 -20
- package/dist/signal/monitor/event-handler.js +3 -1
- package/dist/slack/accounts.js +6 -19
- package/dist/slack/actions.js +11 -3
- package/dist/slack/blocks.test-helpers.js +31 -0
- package/dist/slack/monitor/auth.js +1 -1
- package/dist/slack/monitor/message-handler/dispatch.js +50 -29
- package/dist/slack/monitor/mrkdwn.js +8 -0
- package/dist/slack/monitor/replies.js +15 -7
- package/dist/slack/monitor/slash.js +22 -13
- package/dist/slack/resolve-channels.js +10 -5
- package/dist/slack/send.js +102 -12
- package/dist/slack/stream-mode.js +10 -0
- package/dist/slack/streaming.js +4 -2
- package/dist/telegram/accounts.js +19 -14
- package/dist/telegram/bot/helpers.js +3 -5
- package/dist/telegram/bot-access.js +35 -36
- package/dist/telegram/bot-handlers.js +120 -148
- package/dist/telegram/bot-message-context.js +68 -9
- package/dist/telegram/bot-message-dispatch.js +477 -210
- package/dist/telegram/bot-native-commands.js +16 -0
- package/dist/telegram/draft-stream.js +44 -8
- package/dist/telegram/inline-buttons.js +5 -15
- package/dist/telegram/monitor.js +11 -7
- package/dist/telegram/network-config.js +19 -7
- package/dist/telegram/reasoning-lane-coordinator.js +128 -0
- package/dist/telegram/send.js +3 -2
- package/dist/telegram/sent-message-cache.js +5 -6
- package/dist/telegram/status-reaction-variants.js +208 -0
- package/dist/telegram/sticker-cache.js +11 -9
- package/dist/terminal/prompt-select-styled.js +9 -0
- package/dist/terminal/theme.js +12 -12
- package/dist/test-utils/command-runner.js +6 -0
- package/dist/test-utils/internal-hook-event-payload.js +10 -0
- package/dist/test-utils/model-auth-mock.js +12 -0
- package/dist/test-utils/provider-usage-fetch.js +14 -0
- package/dist/test-utils/temp-home.js +33 -0
- package/dist/tts/tts.js +80 -567
- package/dist/tui/components/chat-log.js +50 -8
- package/dist/tui/theme/theme.js +10 -12
- package/dist/tui/tui-command-handlers.js +36 -27
- package/dist/tui/tui-event-handlers.js +122 -32
- package/dist/tui/tui-local-shell.js +16 -6
- package/dist/tui/tui.js +236 -48
- package/dist/utils/account-id.js +2 -4
- package/dist/utils/boolean.js +10 -5
- package/dist/utils/directive-tags.js +11 -0
- package/dist/utils/mask-api-key.js +10 -0
- package/dist/utils/queue-helpers.js +67 -12
- package/dist/utils/run-with-concurrency.js +39 -0
- package/dist/web/auto-reply/deliver-reply.js +8 -4
- package/dist/web/auto-reply/mentions.js +10 -5
- package/dist/web/auto-reply/monitor/group-members.js +14 -7
- package/dist/web/auto-reply/monitor/process-message.js +45 -24
- package/dist/web/inbound/access-control.js +5 -2
- package/dist/web/login-qr.js +12 -6
- package/dist/web/media.js +126 -15
- package/docs/tools/slash-commands.md +5 -1
- package/extensions/bluebubbles/src/monitor-processing.ts +580 -139
- package/extensions/bluebubbles/src/monitor.ts +208 -1950
- package/extensions/feishu/src/external-keys.ts +19 -0
- package/extensions/lobster/src/windows-spawn.ts +193 -0
- package/extensions/matrix/src/matrix/actions/limits.ts +6 -0
- package/extensions/mattermost/src/mattermost/reactions.test-helpers.ts +83 -0
- package/package.json +1 -1
|
@@ -1,68 +1,68 @@
|
|
|
1
|
+
import { createSubsystemLogger } from "../logging/subsystem.js";
|
|
1
2
|
import { DEFAULT_COPILOT_API_BASE_URL, resolveCopilotApiToken, } from "../providers/github-copilot-token.js";
|
|
2
3
|
import { ensureAuthProfileStore, listProfilesForProvider } from "./auth-profiles.js";
|
|
3
|
-
import { resolveAwsSdkEnvVarName, resolveEnvApiKey } from "./model-auth.js";
|
|
4
4
|
import { discoverBedrockModels } from "./bedrock-discovery.js";
|
|
5
|
+
import { buildBytePlusModelDefinition, BYTEPLUS_BASE_URL, BYTEPLUS_MODEL_CATALOG, BYTEPLUS_CODING_BASE_URL, BYTEPLUS_CODING_MODEL_CATALOG, } from "./byteplus-models.js";
|
|
5
6
|
import { buildCloudflareAiGatewayModelDefinition, resolveCloudflareAiGatewayBaseUrl, } from "./cloudflare-ai-gateway.js";
|
|
7
|
+
import { buildDoubaoModelDefinition, DOUBAO_BASE_URL, DOUBAO_MODEL_CATALOG, DOUBAO_CODING_BASE_URL, DOUBAO_CODING_MODEL_CATALOG, } from "./doubao-models.js";
|
|
8
|
+
import { discoverHuggingfaceModels, HUGGINGFACE_BASE_URL, HUGGINGFACE_MODEL_CATALOG, buildHuggingfaceModelDefinition, } from "./huggingface-models.js";
|
|
9
|
+
import { resolveAwsSdkEnvVarName, resolveEnvApiKey } from "./model-auth.js";
|
|
10
|
+
import { OLLAMA_NATIVE_BASE_URL } from "./ollama-stream.js";
|
|
6
11
|
import { buildSyntheticModelDefinition, SYNTHETIC_BASE_URL, SYNTHETIC_MODEL_CATALOG, } from "./synthetic-models.js";
|
|
7
12
|
import { TOGETHER_BASE_URL, TOGETHER_MODEL_CATALOG, buildTogetherModelDefinition, } from "./together-models.js";
|
|
8
|
-
import { discoverNvidiaModels, NVIDIA_BASE_URL } from "./nvidia-models.js";
|
|
9
13
|
import { discoverVeniceModels, VENICE_BASE_URL } from "./venice-models.js";
|
|
10
|
-
const MINIMAX_API_BASE_URL = "https://api.minimax.chat/v1";
|
|
11
14
|
const MINIMAX_PORTAL_BASE_URL = "https://api.minimax.io/anthropic";
|
|
12
15
|
const MINIMAX_DEFAULT_MODEL_ID = "MiniMax-M2.1";
|
|
13
16
|
const MINIMAX_DEFAULT_VISION_MODEL_ID = "MiniMax-VL-01";
|
|
14
17
|
const MINIMAX_DEFAULT_CONTEXT_WINDOW = 200000;
|
|
15
18
|
const MINIMAX_DEFAULT_MAX_TOKENS = 8192;
|
|
16
19
|
const MINIMAX_OAUTH_PLACEHOLDER = "minimax-oauth";
|
|
17
|
-
// Pricing
|
|
20
|
+
// Pricing per 1M tokens (USD) — https://platform.minimaxi.com/document/Price
|
|
18
21
|
const MINIMAX_API_COST = {
|
|
19
|
-
input:
|
|
20
|
-
output:
|
|
21
|
-
cacheRead:
|
|
22
|
-
cacheWrite:
|
|
22
|
+
input: 0.3,
|
|
23
|
+
output: 1.2,
|
|
24
|
+
cacheRead: 0.03,
|
|
25
|
+
cacheWrite: 0.12,
|
|
23
26
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
function buildMinimaxModel(params) {
|
|
28
|
+
return {
|
|
29
|
+
id: params.id,
|
|
30
|
+
name: params.name,
|
|
31
|
+
reasoning: params.reasoning,
|
|
32
|
+
input: params.input,
|
|
33
|
+
cost: MINIMAX_API_COST,
|
|
34
|
+
contextWindow: MINIMAX_DEFAULT_CONTEXT_WINDOW,
|
|
35
|
+
maxTokens: MINIMAX_DEFAULT_MAX_TOKENS,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function buildMinimaxTextModel(params) {
|
|
39
|
+
return buildMinimaxModel({ ...params, input: ["text"] });
|
|
40
|
+
}
|
|
41
|
+
const XIAOMI_BASE_URL = "https://api.xiaomimimo.com/anthropic";
|
|
42
|
+
export const XIAOMI_DEFAULT_MODEL_ID = "mimo-v2-flash";
|
|
43
|
+
const XIAOMI_DEFAULT_CONTEXT_WINDOW = 262144;
|
|
44
|
+
const XIAOMI_DEFAULT_MAX_TOKENS = 8192;
|
|
45
|
+
const XIAOMI_DEFAULT_COST = {
|
|
29
46
|
input: 0,
|
|
30
47
|
output: 0,
|
|
31
48
|
cacheRead: 0,
|
|
32
49
|
cacheWrite: 0,
|
|
33
50
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const ZAI_DEFAULT_MAX_TOKENS = 8192;
|
|
40
|
-
// GLM-4.7-Flash and GLM-4.5-Flash are completely free
|
|
41
|
-
const ZAI_FREE_COST = {
|
|
51
|
+
const MOONSHOT_BASE_URL = "https://api.moonshot.ai/v1";
|
|
52
|
+
const MOONSHOT_DEFAULT_MODEL_ID = "kimi-k2.5";
|
|
53
|
+
const MOONSHOT_DEFAULT_CONTEXT_WINDOW = 256000;
|
|
54
|
+
const MOONSHOT_DEFAULT_MAX_TOKENS = 8192;
|
|
55
|
+
const MOONSHOT_DEFAULT_COST = {
|
|
42
56
|
input: 0,
|
|
43
57
|
output: 0,
|
|
44
58
|
cacheRead: 0,
|
|
45
59
|
cacheWrite: 0,
|
|
46
60
|
};
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
cacheWrite: 0,
|
|
53
|
-
};
|
|
54
|
-
// GLM-4.7: $0.6/$2.2 per 1M tokens
|
|
55
|
-
const ZAI_PREMIUM_COST = {
|
|
56
|
-
input: 0.6,
|
|
57
|
-
output: 2.2,
|
|
58
|
-
cacheRead: 0,
|
|
59
|
-
cacheWrite: 0,
|
|
60
|
-
};
|
|
61
|
-
const XIAOMI_BASE_URL = "https://api.xiaomimimo.com/anthropic";
|
|
62
|
-
export const XIAOMI_DEFAULT_MODEL_ID = "mimo-v2-flash";
|
|
63
|
-
const XIAOMI_DEFAULT_CONTEXT_WINDOW = 262144;
|
|
64
|
-
const XIAOMI_DEFAULT_MAX_TOKENS = 8192;
|
|
65
|
-
const XIAOMI_DEFAULT_COST = {
|
|
61
|
+
const KIMI_CODING_BASE_URL = "https://api.kimi.com/coding/";
|
|
62
|
+
const KIMI_CODING_DEFAULT_MODEL_ID = "k2p5";
|
|
63
|
+
const KIMI_CODING_DEFAULT_CONTEXT_WINDOW = 262144;
|
|
64
|
+
const KIMI_CODING_DEFAULT_MAX_TOKENS = 32768;
|
|
65
|
+
const KIMI_CODING_DEFAULT_COST = {
|
|
66
66
|
input: 0,
|
|
67
67
|
output: 0,
|
|
68
68
|
cacheRead: 0,
|
|
@@ -78,8 +78,8 @@ const QWEN_PORTAL_DEFAULT_COST = {
|
|
|
78
78
|
cacheRead: 0,
|
|
79
79
|
cacheWrite: 0,
|
|
80
80
|
};
|
|
81
|
-
const OLLAMA_BASE_URL =
|
|
82
|
-
const OLLAMA_API_BASE_URL =
|
|
81
|
+
const OLLAMA_BASE_URL = OLLAMA_NATIVE_BASE_URL;
|
|
82
|
+
const OLLAMA_API_BASE_URL = OLLAMA_BASE_URL;
|
|
83
83
|
const OLLAMA_DEFAULT_CONTEXT_WINDOW = 128000;
|
|
84
84
|
const OLLAMA_DEFAULT_MAX_TOKENS = 8192;
|
|
85
85
|
const OLLAMA_DEFAULT_COST = {
|
|
@@ -88,6 +88,15 @@ const OLLAMA_DEFAULT_COST = {
|
|
|
88
88
|
cacheRead: 0,
|
|
89
89
|
cacheWrite: 0,
|
|
90
90
|
};
|
|
91
|
+
const VLLM_BASE_URL = "http://127.0.0.1:8000/v1";
|
|
92
|
+
const VLLM_DEFAULT_CONTEXT_WINDOW = 128000;
|
|
93
|
+
const VLLM_DEFAULT_MAX_TOKENS = 8192;
|
|
94
|
+
const VLLM_DEFAULT_COST = {
|
|
95
|
+
input: 0,
|
|
96
|
+
output: 0,
|
|
97
|
+
cacheRead: 0,
|
|
98
|
+
cacheWrite: 0,
|
|
99
|
+
};
|
|
91
100
|
export const QIANFAN_BASE_URL = "https://qianfan.baidubce.com/v2";
|
|
92
101
|
export const QIANFAN_DEFAULT_MODEL_ID = "deepseek-v3.2";
|
|
93
102
|
const QIANFAN_DEFAULT_CONTEXT_WINDOW = 98304;
|
|
@@ -98,22 +107,50 @@ const QIANFAN_DEFAULT_COST = {
|
|
|
98
107
|
cacheRead: 0,
|
|
99
108
|
cacheWrite: 0,
|
|
100
109
|
};
|
|
101
|
-
|
|
110
|
+
const NVIDIA_BASE_URL = "https://integrate.api.nvidia.com/v1";
|
|
111
|
+
const NVIDIA_DEFAULT_MODEL_ID = "nvidia/llama-3.1-nemotron-70b-instruct";
|
|
112
|
+
const NVIDIA_DEFAULT_CONTEXT_WINDOW = 131072;
|
|
113
|
+
const NVIDIA_DEFAULT_MAX_TOKENS = 4096;
|
|
114
|
+
const NVIDIA_DEFAULT_COST = {
|
|
115
|
+
input: 0,
|
|
116
|
+
output: 0,
|
|
117
|
+
cacheRead: 0,
|
|
118
|
+
cacheWrite: 0,
|
|
119
|
+
};
|
|
120
|
+
const log = createSubsystemLogger("agents/model-providers");
|
|
121
|
+
/**
|
|
122
|
+
* Derive the Ollama native API base URL from a configured base URL.
|
|
123
|
+
*
|
|
124
|
+
* Users typically configure `baseUrl` with a `/v1` suffix (e.g.
|
|
125
|
+
* `http://192.168.20.14:11434/v1`) for the OpenAI-compatible endpoint.
|
|
126
|
+
* The native Ollama API lives at the root (e.g. `/api/tags`), so we
|
|
127
|
+
* strip the `/v1` suffix when present.
|
|
128
|
+
*/
|
|
129
|
+
export function resolveOllamaApiBase(configuredBaseUrl) {
|
|
130
|
+
if (!configuredBaseUrl) {
|
|
131
|
+
return OLLAMA_API_BASE_URL;
|
|
132
|
+
}
|
|
133
|
+
// Strip trailing slash, then strip /v1 suffix if present
|
|
134
|
+
const trimmed = configuredBaseUrl.replace(/\/+$/, "");
|
|
135
|
+
return trimmed.replace(/\/v1$/i, "");
|
|
136
|
+
}
|
|
137
|
+
async function discoverOllamaModels(baseUrl) {
|
|
102
138
|
// Skip Ollama discovery in test environments
|
|
103
139
|
if (process.env.VITEST || process.env.NODE_ENV === "test") {
|
|
104
140
|
return [];
|
|
105
141
|
}
|
|
106
142
|
try {
|
|
107
|
-
const
|
|
143
|
+
const apiBase = resolveOllamaApiBase(baseUrl);
|
|
144
|
+
const response = await fetch(`${apiBase}/api/tags`, {
|
|
108
145
|
signal: AbortSignal.timeout(5000),
|
|
109
146
|
});
|
|
110
147
|
if (!response.ok) {
|
|
111
|
-
|
|
148
|
+
log.warn(`Failed to discover Ollama models: ${response.status}`);
|
|
112
149
|
return [];
|
|
113
150
|
}
|
|
114
151
|
const data = (await response.json());
|
|
115
152
|
if (!data.models || data.models.length === 0) {
|
|
116
|
-
|
|
153
|
+
log.warn("No Ollama models found on local instance");
|
|
117
154
|
return [];
|
|
118
155
|
}
|
|
119
156
|
return data.models.map((model) => {
|
|
@@ -127,16 +164,57 @@ async function discoverOllamaModels() {
|
|
|
127
164
|
cost: OLLAMA_DEFAULT_COST,
|
|
128
165
|
contextWindow: OLLAMA_DEFAULT_CONTEXT_WINDOW,
|
|
129
166
|
maxTokens: OLLAMA_DEFAULT_MAX_TOKENS,
|
|
130
|
-
// Disable streaming by default for Ollama to avoid SDK issue #1205
|
|
131
|
-
// See: https://github.com/badlogic/pi-mono/issues/1205
|
|
132
|
-
params: {
|
|
133
|
-
streaming: false,
|
|
134
|
-
},
|
|
135
167
|
};
|
|
136
168
|
});
|
|
137
169
|
}
|
|
138
170
|
catch (error) {
|
|
139
|
-
|
|
171
|
+
log.warn(`Failed to discover Ollama models: ${String(error)}`);
|
|
172
|
+
return [];
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
async function discoverVllmModels(baseUrl, apiKey) {
|
|
176
|
+
// Skip vLLM discovery in test environments
|
|
177
|
+
if (process.env.VITEST || process.env.NODE_ENV === "test") {
|
|
178
|
+
return [];
|
|
179
|
+
}
|
|
180
|
+
const trimmedBaseUrl = baseUrl.trim().replace(/\/+$/, "");
|
|
181
|
+
const url = `${trimmedBaseUrl}/models`;
|
|
182
|
+
try {
|
|
183
|
+
const trimmedApiKey = apiKey?.trim();
|
|
184
|
+
const response = await fetch(url, {
|
|
185
|
+
headers: trimmedApiKey ? { Authorization: `Bearer ${trimmedApiKey}` } : undefined,
|
|
186
|
+
signal: AbortSignal.timeout(5000),
|
|
187
|
+
});
|
|
188
|
+
if (!response.ok) {
|
|
189
|
+
log.warn(`Failed to discover vLLM models: ${response.status}`);
|
|
190
|
+
return [];
|
|
191
|
+
}
|
|
192
|
+
const data = (await response.json());
|
|
193
|
+
const models = data.data ?? [];
|
|
194
|
+
if (models.length === 0) {
|
|
195
|
+
log.warn("No vLLM models found on local instance");
|
|
196
|
+
return [];
|
|
197
|
+
}
|
|
198
|
+
return models
|
|
199
|
+
.map((m) => ({ id: typeof m.id === "string" ? m.id.trim() : "" }))
|
|
200
|
+
.filter((m) => Boolean(m.id))
|
|
201
|
+
.map((m) => {
|
|
202
|
+
const modelId = m.id;
|
|
203
|
+
const lower = modelId.toLowerCase();
|
|
204
|
+
const isReasoning = lower.includes("r1") || lower.includes("reasoning") || lower.includes("think");
|
|
205
|
+
return {
|
|
206
|
+
id: modelId,
|
|
207
|
+
name: modelId,
|
|
208
|
+
reasoning: isReasoning,
|
|
209
|
+
input: ["text"],
|
|
210
|
+
cost: VLLM_DEFAULT_COST,
|
|
211
|
+
contextWindow: VLLM_DEFAULT_CONTEXT_WINDOW,
|
|
212
|
+
maxTokens: VLLM_DEFAULT_MAX_TOKENS,
|
|
213
|
+
};
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
log.warn(`Failed to discover vLLM models: ${String(error)}`);
|
|
140
218
|
return [];
|
|
141
219
|
}
|
|
142
220
|
}
|
|
@@ -147,8 +225,9 @@ function normalizeApiKeyConfig(value) {
|
|
|
147
225
|
}
|
|
148
226
|
function resolveEnvApiKeyVarName(provider) {
|
|
149
227
|
const resolved = resolveEnvApiKey(provider);
|
|
150
|
-
if (!resolved)
|
|
228
|
+
if (!resolved) {
|
|
151
229
|
return undefined;
|
|
230
|
+
}
|
|
152
231
|
const match = /^(?:env: |shell env: )([A-Z0-9_]+)$/.exec(resolved.source);
|
|
153
232
|
return match ? match[1] : undefined;
|
|
154
233
|
}
|
|
@@ -159,28 +238,34 @@ function resolveApiKeyFromProfiles(params) {
|
|
|
159
238
|
const ids = listProfilesForProvider(params.store, params.provider);
|
|
160
239
|
for (const id of ids) {
|
|
161
240
|
const cred = params.store.profiles[id];
|
|
162
|
-
if (!cred)
|
|
241
|
+
if (!cred) {
|
|
163
242
|
continue;
|
|
164
|
-
|
|
243
|
+
}
|
|
244
|
+
if (cred.type === "api_key") {
|
|
165
245
|
return cred.key;
|
|
166
|
-
|
|
246
|
+
}
|
|
247
|
+
if (cred.type === "token") {
|
|
167
248
|
return cred.token;
|
|
249
|
+
}
|
|
168
250
|
}
|
|
169
251
|
return undefined;
|
|
170
252
|
}
|
|
171
253
|
export function normalizeGoogleModelId(id) {
|
|
172
|
-
if (id === "gemini-3-pro")
|
|
254
|
+
if (id === "gemini-3-pro") {
|
|
173
255
|
return "gemini-3-pro-preview";
|
|
174
|
-
|
|
256
|
+
}
|
|
257
|
+
if (id === "gemini-3-flash") {
|
|
175
258
|
return "gemini-3-flash-preview";
|
|
259
|
+
}
|
|
176
260
|
return id;
|
|
177
261
|
}
|
|
178
262
|
function normalizeGoogleProvider(provider) {
|
|
179
263
|
let mutated = false;
|
|
180
264
|
const models = provider.models.map((model) => {
|
|
181
265
|
const nextId = normalizeGoogleModelId(model.id);
|
|
182
|
-
if (nextId === model.id)
|
|
266
|
+
if (nextId === model.id) {
|
|
183
267
|
return model;
|
|
268
|
+
}
|
|
184
269
|
mutated = true;
|
|
185
270
|
return { ...model, id: nextId };
|
|
186
271
|
});
|
|
@@ -188,8 +273,9 @@ function normalizeGoogleProvider(provider) {
|
|
|
188
273
|
}
|
|
189
274
|
export function normalizeProviders(params) {
|
|
190
275
|
const { providers } = params;
|
|
191
|
-
if (!providers)
|
|
276
|
+
if (!providers) {
|
|
192
277
|
return providers;
|
|
278
|
+
}
|
|
193
279
|
const authStore = ensureAuthProfileStore(params.agentDir, {
|
|
194
280
|
allowKeychainPrompt: false,
|
|
195
281
|
});
|
|
@@ -232,8 +318,9 @@ export function normalizeProviders(params) {
|
|
|
232
318
|
}
|
|
233
319
|
if (normalizedKey === "google") {
|
|
234
320
|
const googleNormalized = normalizeGoogleProvider(normalizedProvider);
|
|
235
|
-
if (googleNormalized !== normalizedProvider)
|
|
321
|
+
if (googleNormalized !== normalizedProvider) {
|
|
236
322
|
mutated = true;
|
|
323
|
+
}
|
|
237
324
|
normalizedProvider = googleNormalized;
|
|
238
325
|
}
|
|
239
326
|
next[key] = normalizedProvider;
|
|
@@ -242,27 +329,53 @@ export function normalizeProviders(params) {
|
|
|
242
329
|
}
|
|
243
330
|
function buildMinimaxProvider() {
|
|
244
331
|
return {
|
|
245
|
-
baseUrl:
|
|
246
|
-
api: "
|
|
332
|
+
baseUrl: MINIMAX_PORTAL_BASE_URL,
|
|
333
|
+
api: "anthropic-messages",
|
|
247
334
|
models: [
|
|
248
|
-
{
|
|
335
|
+
buildMinimaxTextModel({
|
|
249
336
|
id: MINIMAX_DEFAULT_MODEL_ID,
|
|
250
337
|
name: "MiniMax M2.1",
|
|
251
338
|
reasoning: false,
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
339
|
+
}),
|
|
340
|
+
buildMinimaxTextModel({
|
|
341
|
+
id: "MiniMax-M2.1-lightning",
|
|
342
|
+
name: "MiniMax M2.1 Lightning",
|
|
343
|
+
reasoning: false,
|
|
344
|
+
}),
|
|
345
|
+
buildMinimaxModel({
|
|
258
346
|
id: MINIMAX_DEFAULT_VISION_MODEL_ID,
|
|
259
347
|
name: "MiniMax VL 01",
|
|
260
348
|
reasoning: false,
|
|
261
349
|
input: ["text", "image"],
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
350
|
+
}),
|
|
351
|
+
buildMinimaxTextModel({
|
|
352
|
+
id: "MiniMax-M2.5",
|
|
353
|
+
name: "MiniMax M2.5",
|
|
354
|
+
reasoning: true,
|
|
355
|
+
}),
|
|
356
|
+
buildMinimaxTextModel({
|
|
357
|
+
id: "MiniMax-M2.5-Lightning",
|
|
358
|
+
name: "MiniMax M2.5 Lightning",
|
|
359
|
+
reasoning: true,
|
|
360
|
+
}),
|
|
361
|
+
],
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
function buildMinimaxPortalProvider() {
|
|
365
|
+
return {
|
|
366
|
+
baseUrl: MINIMAX_PORTAL_BASE_URL,
|
|
367
|
+
api: "anthropic-messages",
|
|
368
|
+
models: [
|
|
369
|
+
buildMinimaxTextModel({
|
|
370
|
+
id: MINIMAX_DEFAULT_MODEL_ID,
|
|
371
|
+
name: "MiniMax M2.1",
|
|
372
|
+
reasoning: false,
|
|
373
|
+
}),
|
|
374
|
+
buildMinimaxTextModel({
|
|
375
|
+
id: "MiniMax-M2.5",
|
|
376
|
+
name: "MiniMax M2.5",
|
|
377
|
+
reasoning: true,
|
|
378
|
+
}),
|
|
266
379
|
],
|
|
267
380
|
};
|
|
268
381
|
}
|
|
@@ -283,55 +396,19 @@ function buildMoonshotProvider() {
|
|
|
283
396
|
],
|
|
284
397
|
};
|
|
285
398
|
}
|
|
286
|
-
function
|
|
399
|
+
export function buildKimiCodingProvider() {
|
|
287
400
|
return {
|
|
288
|
-
baseUrl:
|
|
289
|
-
api: "
|
|
401
|
+
baseUrl: KIMI_CODING_BASE_URL,
|
|
402
|
+
api: "anthropic-messages",
|
|
290
403
|
models: [
|
|
291
404
|
{
|
|
292
|
-
id:
|
|
293
|
-
name: "
|
|
294
|
-
reasoning:
|
|
295
|
-
input: ["text"],
|
|
296
|
-
cost: ZAI_FREE_COST,
|
|
297
|
-
contextWindow: ZAI_DEFAULT_CONTEXT_WINDOW,
|
|
298
|
-
maxTokens: ZAI_DEFAULT_MAX_TOKENS,
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
id: "GLM-4.5-Flash",
|
|
302
|
-
name: "GLM 4.5 Flash",
|
|
303
|
-
reasoning: false,
|
|
304
|
-
input: ["text"],
|
|
305
|
-
cost: ZAI_FREE_COST,
|
|
306
|
-
contextWindow: ZAI_DEFAULT_CONTEXT_WINDOW,
|
|
307
|
-
maxTokens: ZAI_DEFAULT_MAX_TOKENS,
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
id: "GLM-4.6V-Flash",
|
|
311
|
-
name: "GLM 4.6V Flash (Vision)",
|
|
312
|
-
reasoning: false,
|
|
405
|
+
id: KIMI_CODING_DEFAULT_MODEL_ID,
|
|
406
|
+
name: "Kimi for Coding",
|
|
407
|
+
reasoning: true,
|
|
313
408
|
input: ["text", "image"],
|
|
314
|
-
cost:
|
|
315
|
-
contextWindow:
|
|
316
|
-
maxTokens:
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
id: "GLM-4.7-FlashX",
|
|
320
|
-
name: "GLM 4.7 FlashX",
|
|
321
|
-
reasoning: false,
|
|
322
|
-
input: ["text"],
|
|
323
|
-
cost: ZAI_FLASHX_COST,
|
|
324
|
-
contextWindow: ZAI_DEFAULT_CONTEXT_WINDOW,
|
|
325
|
-
maxTokens: ZAI_DEFAULT_MAX_TOKENS,
|
|
326
|
-
},
|
|
327
|
-
{
|
|
328
|
-
id: "GLM-4.7",
|
|
329
|
-
name: "GLM 4.7",
|
|
330
|
-
reasoning: false,
|
|
331
|
-
input: ["text"],
|
|
332
|
-
cost: ZAI_PREMIUM_COST,
|
|
333
|
-
contextWindow: ZAI_DEFAULT_CONTEXT_WINDOW,
|
|
334
|
-
maxTokens: ZAI_DEFAULT_MAX_TOKENS,
|
|
409
|
+
cost: KIMI_CODING_DEFAULT_COST,
|
|
410
|
+
contextWindow: KIMI_CODING_DEFAULT_CONTEXT_WINDOW,
|
|
411
|
+
maxTokens: KIMI_CODING_DEFAULT_MAX_TOKENS,
|
|
335
412
|
},
|
|
336
413
|
],
|
|
337
414
|
};
|
|
@@ -369,37 +446,32 @@ function buildSyntheticProvider() {
|
|
|
369
446
|
models: SYNTHETIC_MODEL_CATALOG.map(buildSyntheticModelDefinition),
|
|
370
447
|
};
|
|
371
448
|
}
|
|
372
|
-
|
|
373
|
-
const models = await discoverVeniceModels();
|
|
449
|
+
function buildDoubaoProvider() {
|
|
374
450
|
return {
|
|
375
|
-
baseUrl:
|
|
451
|
+
baseUrl: DOUBAO_BASE_URL,
|
|
376
452
|
api: "openai-completions",
|
|
377
|
-
models,
|
|
453
|
+
models: DOUBAO_MODEL_CATALOG.map(buildDoubaoModelDefinition),
|
|
378
454
|
};
|
|
379
455
|
}
|
|
380
|
-
|
|
381
|
-
const models = await discoverOllamaModels();
|
|
456
|
+
function buildDoubaoCodingProvider() {
|
|
382
457
|
return {
|
|
383
|
-
baseUrl:
|
|
458
|
+
baseUrl: DOUBAO_CODING_BASE_URL,
|
|
384
459
|
api: "openai-completions",
|
|
385
|
-
models,
|
|
460
|
+
models: DOUBAO_CODING_MODEL_CATALOG.map(buildDoubaoModelDefinition),
|
|
386
461
|
};
|
|
387
462
|
}
|
|
388
|
-
function
|
|
463
|
+
function buildBytePlusProvider() {
|
|
389
464
|
return {
|
|
390
|
-
baseUrl:
|
|
391
|
-
api: "
|
|
392
|
-
models:
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
maxTokens: MINIMAX_DEFAULT_MAX_TOKENS,
|
|
401
|
-
},
|
|
402
|
-
],
|
|
465
|
+
baseUrl: BYTEPLUS_BASE_URL,
|
|
466
|
+
api: "openai-completions",
|
|
467
|
+
models: BYTEPLUS_MODEL_CATALOG.map(buildBytePlusModelDefinition),
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
function buildBytePlusCodingProvider() {
|
|
471
|
+
return {
|
|
472
|
+
baseUrl: BYTEPLUS_CODING_BASE_URL,
|
|
473
|
+
api: "openai-completions",
|
|
474
|
+
models: BYTEPLUS_CODING_MODEL_CATALOG.map(buildBytePlusModelDefinition),
|
|
403
475
|
};
|
|
404
476
|
}
|
|
405
477
|
export function buildXiaomiProvider() {
|
|
@@ -419,6 +491,38 @@ export function buildXiaomiProvider() {
|
|
|
419
491
|
],
|
|
420
492
|
};
|
|
421
493
|
}
|
|
494
|
+
async function buildVeniceProvider() {
|
|
495
|
+
const models = await discoverVeniceModels();
|
|
496
|
+
return {
|
|
497
|
+
baseUrl: VENICE_BASE_URL,
|
|
498
|
+
api: "openai-completions",
|
|
499
|
+
models,
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
async function buildOllamaProvider(configuredBaseUrl) {
|
|
503
|
+
const models = await discoverOllamaModels(configuredBaseUrl);
|
|
504
|
+
return {
|
|
505
|
+
baseUrl: resolveOllamaApiBase(configuredBaseUrl),
|
|
506
|
+
api: "ollama",
|
|
507
|
+
models,
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
async function buildHuggingfaceProvider(apiKey) {
|
|
511
|
+
// Resolve env var name to value for discovery (GET /v1/models requires Bearer token).
|
|
512
|
+
const resolvedSecret = apiKey?.trim() !== ""
|
|
513
|
+
? /^[A-Z][A-Z0-9_]*$/.test(apiKey.trim())
|
|
514
|
+
? (process.env[apiKey.trim()] ?? "").trim()
|
|
515
|
+
: apiKey.trim()
|
|
516
|
+
: "";
|
|
517
|
+
const models = resolvedSecret !== ""
|
|
518
|
+
? await discoverHuggingfaceModels(resolvedSecret)
|
|
519
|
+
: HUGGINGFACE_MODEL_CATALOG.map(buildHuggingfaceModelDefinition);
|
|
520
|
+
return {
|
|
521
|
+
baseUrl: HUGGINGFACE_BASE_URL,
|
|
522
|
+
api: "openai-completions",
|
|
523
|
+
models,
|
|
524
|
+
};
|
|
525
|
+
}
|
|
422
526
|
function buildTogetherProvider() {
|
|
423
527
|
return {
|
|
424
528
|
baseUrl: TOGETHER_BASE_URL,
|
|
@@ -426,10 +530,11 @@ function buildTogetherProvider() {
|
|
|
426
530
|
models: TOGETHER_MODEL_CATALOG.map(buildTogetherModelDefinition),
|
|
427
531
|
};
|
|
428
532
|
}
|
|
429
|
-
async function
|
|
430
|
-
const
|
|
533
|
+
async function buildVllmProvider(params) {
|
|
534
|
+
const baseUrl = (params?.baseUrl?.trim() || VLLM_BASE_URL).replace(/\/+$/, "");
|
|
535
|
+
const models = await discoverVllmModels(baseUrl, params?.apiKey);
|
|
431
536
|
return {
|
|
432
|
-
baseUrl
|
|
537
|
+
baseUrl,
|
|
433
538
|
api: "openai-completions",
|
|
434
539
|
models,
|
|
435
540
|
};
|
|
@@ -460,6 +565,41 @@ export function buildQianfanProvider() {
|
|
|
460
565
|
],
|
|
461
566
|
};
|
|
462
567
|
}
|
|
568
|
+
export function buildNvidiaProvider() {
|
|
569
|
+
return {
|
|
570
|
+
baseUrl: NVIDIA_BASE_URL,
|
|
571
|
+
api: "openai-completions",
|
|
572
|
+
models: [
|
|
573
|
+
{
|
|
574
|
+
id: NVIDIA_DEFAULT_MODEL_ID,
|
|
575
|
+
name: "NVIDIA Llama 3.1 Nemotron 70B Instruct",
|
|
576
|
+
reasoning: false,
|
|
577
|
+
input: ["text"],
|
|
578
|
+
cost: NVIDIA_DEFAULT_COST,
|
|
579
|
+
contextWindow: NVIDIA_DEFAULT_CONTEXT_WINDOW,
|
|
580
|
+
maxTokens: NVIDIA_DEFAULT_MAX_TOKENS,
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
id: "meta/llama-3.3-70b-instruct",
|
|
584
|
+
name: "Meta Llama 3.3 70B Instruct",
|
|
585
|
+
reasoning: false,
|
|
586
|
+
input: ["text"],
|
|
587
|
+
cost: NVIDIA_DEFAULT_COST,
|
|
588
|
+
contextWindow: 131072,
|
|
589
|
+
maxTokens: 4096,
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
id: "nvidia/mistral-nemo-minitron-8b-8k-instruct",
|
|
593
|
+
name: "NVIDIA Mistral NeMo Minitron 8B Instruct",
|
|
594
|
+
reasoning: false,
|
|
595
|
+
input: ["text"],
|
|
596
|
+
cost: NVIDIA_DEFAULT_COST,
|
|
597
|
+
contextWindow: 8192,
|
|
598
|
+
maxTokens: 2048,
|
|
599
|
+
},
|
|
600
|
+
],
|
|
601
|
+
};
|
|
602
|
+
}
|
|
463
603
|
export async function resolveImplicitProviders(params) {
|
|
464
604
|
const providers = {};
|
|
465
605
|
const authStore = ensureAuthProfileStore(params.agentDir, {
|
|
@@ -482,10 +622,10 @@ export async function resolveImplicitProviders(params) {
|
|
|
482
622
|
if (moonshotKey) {
|
|
483
623
|
providers.moonshot = { ...buildMoonshotProvider(), apiKey: moonshotKey };
|
|
484
624
|
}
|
|
485
|
-
const
|
|
486
|
-
resolveApiKeyFromProfiles({ provider: "
|
|
487
|
-
if (
|
|
488
|
-
providers
|
|
625
|
+
const kimiCodingKey = resolveEnvApiKeyVarName("kimi-coding") ??
|
|
626
|
+
resolveApiKeyFromProfiles({ provider: "kimi-coding", store: authStore });
|
|
627
|
+
if (kimiCodingKey) {
|
|
628
|
+
providers["kimi-coding"] = { ...buildKimiCodingProvider(), apiKey: kimiCodingKey };
|
|
489
629
|
}
|
|
490
630
|
const syntheticKey = resolveEnvApiKeyVarName("synthetic") ??
|
|
491
631
|
resolveApiKeyFromProfiles({ provider: "synthetic", store: authStore });
|
|
@@ -504,6 +644,24 @@ export async function resolveImplicitProviders(params) {
|
|
|
504
644
|
apiKey: QWEN_PORTAL_OAUTH_PLACEHOLDER,
|
|
505
645
|
};
|
|
506
646
|
}
|
|
647
|
+
const volcengineKey = resolveEnvApiKeyVarName("volcengine") ??
|
|
648
|
+
resolveApiKeyFromProfiles({ provider: "volcengine", store: authStore });
|
|
649
|
+
if (volcengineKey) {
|
|
650
|
+
providers.volcengine = { ...buildDoubaoProvider(), apiKey: volcengineKey };
|
|
651
|
+
providers["volcengine-plan"] = {
|
|
652
|
+
...buildDoubaoCodingProvider(),
|
|
653
|
+
apiKey: volcengineKey,
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
const byteplusKey = resolveEnvApiKeyVarName("byteplus") ??
|
|
657
|
+
resolveApiKeyFromProfiles({ provider: "byteplus", store: authStore });
|
|
658
|
+
if (byteplusKey) {
|
|
659
|
+
providers.byteplus = { ...buildBytePlusProvider(), apiKey: byteplusKey };
|
|
660
|
+
providers["byteplus-plan"] = {
|
|
661
|
+
...buildBytePlusCodingProvider(),
|
|
662
|
+
apiKey: byteplusKey,
|
|
663
|
+
};
|
|
664
|
+
}
|
|
507
665
|
const xiaomiKey = resolveEnvApiKeyVarName("xiaomi") ??
|
|
508
666
|
resolveApiKeyFromProfiles({ provider: "xiaomi", store: authStore });
|
|
509
667
|
if (xiaomiKey) {
|
|
@@ -512,18 +670,22 @@ export async function resolveImplicitProviders(params) {
|
|
|
512
670
|
const cloudflareProfiles = listProfilesForProvider(authStore, "cloudflare-ai-gateway");
|
|
513
671
|
for (const profileId of cloudflareProfiles) {
|
|
514
672
|
const cred = authStore.profiles[profileId];
|
|
515
|
-
if (cred?.type !== "api_key")
|
|
673
|
+
if (cred?.type !== "api_key") {
|
|
516
674
|
continue;
|
|
675
|
+
}
|
|
517
676
|
const accountId = cred.metadata?.accountId?.trim();
|
|
518
677
|
const gatewayId = cred.metadata?.gatewayId?.trim();
|
|
519
|
-
if (!accountId || !gatewayId)
|
|
678
|
+
if (!accountId || !gatewayId) {
|
|
520
679
|
continue;
|
|
680
|
+
}
|
|
521
681
|
const baseUrl = resolveCloudflareAiGatewayBaseUrl({ accountId, gatewayId });
|
|
522
|
-
if (!baseUrl)
|
|
682
|
+
if (!baseUrl) {
|
|
523
683
|
continue;
|
|
684
|
+
}
|
|
524
685
|
const apiKey = resolveEnvApiKeyVarName("cloudflare-ai-gateway") ?? cred.key?.trim() ?? "";
|
|
525
|
-
if (!apiKey)
|
|
686
|
+
if (!apiKey) {
|
|
526
687
|
continue;
|
|
688
|
+
}
|
|
527
689
|
providers["cloudflare-ai-gateway"] = {
|
|
528
690
|
baseUrl,
|
|
529
691
|
api: "anthropic-messages",
|
|
@@ -532,11 +694,30 @@ export async function resolveImplicitProviders(params) {
|
|
|
532
694
|
};
|
|
533
695
|
break;
|
|
534
696
|
}
|
|
535
|
-
// Ollama provider - only add if explicitly configured
|
|
697
|
+
// Ollama provider - only add if explicitly configured.
|
|
698
|
+
// Use the user's configured baseUrl (from explicit providers) for model
|
|
699
|
+
// discovery so that remote / non-default Ollama instances are reachable.
|
|
536
700
|
const ollamaKey = resolveEnvApiKeyVarName("ollama") ??
|
|
537
701
|
resolveApiKeyFromProfiles({ provider: "ollama", store: authStore });
|
|
538
702
|
if (ollamaKey) {
|
|
539
|
-
|
|
703
|
+
const ollamaBaseUrl = params.explicitProviders?.ollama?.baseUrl;
|
|
704
|
+
providers.ollama = { ...(await buildOllamaProvider(ollamaBaseUrl)), apiKey: ollamaKey };
|
|
705
|
+
}
|
|
706
|
+
// vLLM provider - OpenAI-compatible local server (opt-in via env/profile).
|
|
707
|
+
// If explicitly configured, keep user-defined models/settings as-is.
|
|
708
|
+
if (!params.explicitProviders?.vllm) {
|
|
709
|
+
const vllmEnvVar = resolveEnvApiKeyVarName("vllm");
|
|
710
|
+
const vllmProfileKey = resolveApiKeyFromProfiles({ provider: "vllm", store: authStore });
|
|
711
|
+
const vllmKey = vllmEnvVar ?? vllmProfileKey;
|
|
712
|
+
if (vllmKey) {
|
|
713
|
+
const discoveryApiKey = vllmEnvVar
|
|
714
|
+
? (process.env[vllmEnvVar]?.trim() ?? "")
|
|
715
|
+
: (vllmProfileKey ?? "");
|
|
716
|
+
providers.vllm = {
|
|
717
|
+
...(await buildVllmProvider({ apiKey: discoveryApiKey || undefined })),
|
|
718
|
+
apiKey: vllmKey,
|
|
719
|
+
};
|
|
720
|
+
}
|
|
540
721
|
}
|
|
541
722
|
const togetherKey = resolveEnvApiKeyVarName("together") ??
|
|
542
723
|
resolveApiKeyFromProfiles({ provider: "together", store: authStore });
|
|
@@ -546,6 +727,15 @@ export async function resolveImplicitProviders(params) {
|
|
|
546
727
|
apiKey: togetherKey,
|
|
547
728
|
};
|
|
548
729
|
}
|
|
730
|
+
const huggingfaceKey = resolveEnvApiKeyVarName("huggingface") ??
|
|
731
|
+
resolveApiKeyFromProfiles({ provider: "huggingface", store: authStore });
|
|
732
|
+
if (huggingfaceKey) {
|
|
733
|
+
const hfProvider = await buildHuggingfaceProvider(huggingfaceKey);
|
|
734
|
+
providers.huggingface = {
|
|
735
|
+
...hfProvider,
|
|
736
|
+
apiKey: huggingfaceKey,
|
|
737
|
+
};
|
|
738
|
+
}
|
|
549
739
|
const qianfanKey = resolveEnvApiKeyVarName("qianfan") ??
|
|
550
740
|
resolveApiKeyFromProfiles({ provider: "qianfan", store: authStore });
|
|
551
741
|
if (qianfanKey) {
|
|
@@ -554,18 +744,21 @@ export async function resolveImplicitProviders(params) {
|
|
|
554
744
|
const nvidiaKey = resolveEnvApiKeyVarName("nvidia") ??
|
|
555
745
|
resolveApiKeyFromProfiles({ provider: "nvidia", store: authStore });
|
|
556
746
|
if (nvidiaKey) {
|
|
557
|
-
providers.nvidia = { ...
|
|
747
|
+
providers.nvidia = { ...buildNvidiaProvider(), apiKey: nvidiaKey };
|
|
558
748
|
}
|
|
559
749
|
return providers;
|
|
560
750
|
}
|
|
561
751
|
export async function resolveImplicitCopilotProvider(params) {
|
|
562
752
|
const env = params.env ?? process.env;
|
|
563
|
-
const authStore = ensureAuthProfileStore(params.agentDir, {
|
|
753
|
+
const authStore = ensureAuthProfileStore(params.agentDir, {
|
|
754
|
+
allowKeychainPrompt: false,
|
|
755
|
+
});
|
|
564
756
|
const hasProfile = listProfilesForProvider(authStore, "github-copilot").length > 0;
|
|
565
757
|
const envToken = env.COPILOT_GITHUB_TOKEN ?? env.GH_TOKEN ?? env.GITHUB_TOKEN;
|
|
566
758
|
const githubToken = (envToken ?? "").trim();
|
|
567
|
-
if (!hasProfile && !githubToken)
|
|
759
|
+
if (!hasProfile && !githubToken) {
|
|
568
760
|
return null;
|
|
761
|
+
}
|
|
569
762
|
let selectedGithubToken = githubToken;
|
|
570
763
|
if (!selectedGithubToken && hasProfile) {
|
|
571
764
|
// Use the first available profile as a default for discovery (it will be
|
|
@@ -591,15 +784,15 @@ export async function resolveImplicitCopilotProvider(params) {
|
|
|
591
784
|
}
|
|
592
785
|
// pi-coding-agent's ModelRegistry marks a model "available" only if its
|
|
593
786
|
// `AuthStorage` has auth configured for that provider (via auth.json/env/etc).
|
|
594
|
-
// Our Copilot auth lives in
|
|
787
|
+
// Our Copilot auth lives in Pool Bot's auth-profiles store instead, so we also
|
|
595
788
|
// write a runtime-only auth.json entry for pi-coding-agent to pick up.
|
|
596
789
|
//
|
|
597
|
-
// This is safe because it's (1) within
|
|
790
|
+
// This is safe because it's (1) within Pool Bot's agent dir, (2) contains the
|
|
598
791
|
// GitHub token (not the exchanged Copilot token), and (3) matches existing
|
|
599
792
|
// patterns for OAuth-like providers in pi-coding-agent.
|
|
600
793
|
// Note: we deliberately do not write pi-coding-agent's `auth.json` here.
|
|
601
|
-
//
|
|
602
|
-
// `models list` uses
|
|
794
|
+
// Pool Bot uses its own auth store and exchanges tokens at runtime.
|
|
795
|
+
// `models list` uses Pool Bot's auth heuristics for availability.
|
|
603
796
|
// We intentionally do NOT define custom models for Copilot in models.json.
|
|
604
797
|
// pi-coding-agent treats providers with models as replacements requiring apiKey.
|
|
605
798
|
// We only override baseUrl; the model list comes from pi-ai built-ins.
|
|
@@ -613,14 +806,20 @@ export async function resolveImplicitBedrockProvider(params) {
|
|
|
613
806
|
const discoveryConfig = params.config?.models?.bedrockDiscovery;
|
|
614
807
|
const enabled = discoveryConfig?.enabled;
|
|
615
808
|
const hasAwsCreds = resolveAwsSdkEnvVarName(env) !== undefined;
|
|
616
|
-
if (enabled === false)
|
|
809
|
+
if (enabled === false) {
|
|
617
810
|
return null;
|
|
618
|
-
|
|
811
|
+
}
|
|
812
|
+
if (enabled !== true && !hasAwsCreds) {
|
|
619
813
|
return null;
|
|
814
|
+
}
|
|
620
815
|
const region = discoveryConfig?.region ?? env.AWS_REGION ?? env.AWS_DEFAULT_REGION ?? "us-east-1";
|
|
621
|
-
const models = await discoverBedrockModels({
|
|
622
|
-
|
|
816
|
+
const models = await discoverBedrockModels({
|
|
817
|
+
region,
|
|
818
|
+
config: discoveryConfig,
|
|
819
|
+
});
|
|
820
|
+
if (models.length === 0) {
|
|
623
821
|
return null;
|
|
822
|
+
}
|
|
624
823
|
return {
|
|
625
824
|
baseUrl: `https://bedrock-runtime.${region}.amazonaws.com`,
|
|
626
825
|
api: "bedrock-converse-stream",
|