@vellumai/assistant 0.4.52 → 0.4.54
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/ARCHITECTURE.md +2 -2
- package/bun.lock +62 -349
- package/docs/architecture/integrations.md +1 -1
- package/docs/architecture/keychain-broker.md +91 -40
- package/docs/architecture/memory.md +3 -3
- package/docs/architecture/security.md +2 -2
- package/knip.json +7 -29
- package/package.json +2 -9
- package/src/__tests__/agent-loop.test.ts +1 -1
- package/src/__tests__/app-git-history.test.ts +0 -2
- package/src/__tests__/app-git-service.test.ts +1 -6
- package/src/__tests__/approval-cascade.test.ts +3 -2
- package/src/__tests__/approval-routes-http.test.ts +0 -1
- package/src/__tests__/asset-materialize-tool.test.ts +0 -1
- package/src/__tests__/asset-search-tool.test.ts +0 -1
- package/src/__tests__/assistant-events-sse-hardening.test.ts +0 -1
- package/src/__tests__/attachments-store.test.ts +0 -1
- package/src/__tests__/avatar-e2e.test.ts +5 -1
- package/src/__tests__/browser-fill-credential.test.ts +4 -6
- package/src/__tests__/btw-routes.test.ts +39 -0
- package/src/__tests__/call-controller.test.ts +0 -1
- package/src/__tests__/call-domain.test.ts +1 -1
- package/src/__tests__/call-routes-http.test.ts +1 -3
- package/src/__tests__/canonical-guardian-store.test.ts +33 -2
- package/src/__tests__/channel-guardian.test.ts +4 -4
- package/src/__tests__/channel-readiness-routes.test.ts +0 -1
- package/src/__tests__/channel-readiness-service.test.ts +1 -1
- package/src/__tests__/checker.test.ts +13 -11
- package/src/__tests__/claude-code-skill-regression.test.ts +5 -2
- package/src/__tests__/claude-code-tool-profiles.test.ts +7 -3
- package/src/__tests__/config-loader-backfill.test.ts +1 -5
- package/src/__tests__/config-schema.test.ts +9 -46
- package/src/__tests__/config-watcher.test.ts +11 -3
- package/src/__tests__/conversation-routes-slash-commands.test.ts +0 -1
- package/src/__tests__/credential-broker-browser-fill.test.ts +27 -24
- package/src/__tests__/credential-broker-server-use.test.ts +76 -40
- package/src/__tests__/credential-security-e2e.test.ts +1 -6
- package/src/__tests__/credential-security-invariants.test.ts +27 -8
- package/src/__tests__/credential-vault-unit.test.ts +32 -16
- package/src/__tests__/credential-vault.test.ts +40 -28
- package/src/__tests__/credentials-cli.test.ts +1 -21
- package/src/__tests__/email-invite-adapter.test.ts +0 -1
- package/src/__tests__/error-handler-friendly-messages.test.ts +4 -5
- package/src/__tests__/fixtures/credential-security-fixtures.ts +3 -3
- package/src/__tests__/fixtures/media-reuse-fixtures.ts +3 -79
- package/src/__tests__/gateway-only-enforcement.test.ts +1 -23
- package/src/__tests__/guardian-action-conversation-turn.test.ts +8 -8
- package/src/__tests__/guardian-action-late-reply.test.ts +13 -14
- package/src/__tests__/guardian-action-store.test.ts +0 -57
- package/src/__tests__/guardian-outbound-http.test.ts +1 -1
- package/src/__tests__/guardian-verification-voice-binding.test.ts +1 -3
- package/src/__tests__/hooks-blocking.test.ts +1 -1
- package/src/__tests__/hooks-config.test.ts +5 -29
- package/src/__tests__/hooks-discovery.test.ts +1 -1
- package/src/__tests__/hooks-integration.test.ts +1 -1
- package/src/__tests__/hooks-manager.test.ts +1 -1
- package/src/__tests__/hooks-runner.test.ts +1 -23
- package/src/__tests__/hooks-settings.test.ts +1 -1
- package/src/__tests__/hooks-templates.test.ts +1 -1
- package/src/__tests__/host-shell-tool.test.ts +0 -1
- package/src/__tests__/http-user-message-parity.test.ts +19 -0
- package/src/__tests__/integration-status.test.ts +0 -1
- package/src/__tests__/invite-routes-http.test.ts +0 -3
- package/src/__tests__/list-messages-attachments.test.ts +0 -1
- package/src/__tests__/llm-usage-store.test.ts +50 -0
- package/src/__tests__/log-export-workspace.test.ts +233 -0
- package/src/__tests__/managed-proxy-context.test.ts +41 -41
- package/src/__tests__/managed-skill-lifecycle.test.ts +0 -1
- package/src/__tests__/media-generate-image.test.ts +9 -4
- package/src/__tests__/media-reuse-story.e2e.test.ts +1 -7
- package/src/__tests__/memory-regressions.experimental.test.ts +4 -4
- package/src/__tests__/memory-regressions.test.ts +27 -28
- package/src/__tests__/memory-retrieval.benchmark.test.ts +1 -1
- package/src/__tests__/memory-upsert-concurrency.test.ts +4 -4
- package/src/__tests__/migration-cross-version-compatibility.test.ts +0 -1
- package/src/__tests__/migration-export-http.test.ts +0 -1
- package/src/__tests__/migration-import-commit-http.test.ts +0 -1
- package/src/__tests__/migration-import-preflight-http.test.ts +0 -1
- package/src/__tests__/migration-validate-http.test.ts +0 -1
- package/src/__tests__/notification-decision-fallback.test.ts +1 -1
- package/src/__tests__/notification-schedule-dedup.test.ts +237 -0
- package/src/__tests__/oauth-cli.test.ts +2 -14
- package/src/__tests__/oauth-store.test.ts +3 -7
- package/src/__tests__/oauth2-gateway-transport.test.ts +5 -4
- package/src/__tests__/onboarding-starter-tasks.test.ts +1 -1
- package/src/__tests__/onboarding-template-contract.test.ts +1 -2
- package/src/__tests__/openai-provider.test.ts +7 -7
- package/src/__tests__/platform.test.ts +14 -4
- package/src/__tests__/pricing.test.ts +0 -234
- package/src/__tests__/provider-commit-message-generator.test.ts +19 -15
- package/src/__tests__/provider-fail-open-selection.test.ts +67 -62
- package/src/__tests__/provider-managed-proxy-integration.test.ts +88 -85
- package/src/__tests__/provider-registry-ollama.test.ts +10 -4
- package/src/__tests__/public-ingress-urls.test.ts +1 -1
- package/src/__tests__/recording-handler.test.ts +0 -1
- package/src/__tests__/registry.test.ts +3 -103
- package/src/__tests__/relay-server.test.ts +0 -1
- package/src/__tests__/runtime-attachment-metadata.test.ts +0 -1
- package/src/__tests__/runtime-events-sse-parity.test.ts +0 -1
- package/src/__tests__/runtime-events-sse.test.ts +0 -1
- package/src/__tests__/script-proxy-injection-runtime.test.ts +2 -7
- package/src/__tests__/secret-onetime-send.test.ts +1 -6
- package/src/__tests__/secret-routes-managed-proxy.test.ts +6 -14
- package/src/__tests__/secret-scanner-executor.test.ts +0 -1
- package/src/__tests__/secure-keys.test.ts +241 -229
- package/src/__tests__/send-endpoint-busy.test.ts +0 -1
- package/src/__tests__/session-abort-tool-results.test.ts +3 -2
- package/src/__tests__/session-agent-loop-overflow.test.ts +1012 -838
- package/src/__tests__/session-agent-loop.test.ts +2 -2
- package/src/__tests__/session-confirmation-signals.test.ts +3 -2
- package/src/__tests__/session-error.test.ts +5 -4
- package/src/__tests__/session-history-web-search.test.ts +34 -9
- package/src/__tests__/session-messaging-secret-redirect.test.ts +1 -7
- package/src/__tests__/session-pre-run-repair.test.ts +3 -2
- package/src/__tests__/session-provider-retry-repair.test.ts +31 -27
- package/src/__tests__/session-queue.test.ts +5 -5
- package/src/__tests__/session-runtime-assembly.test.ts +118 -0
- package/src/__tests__/session-slash-known.test.ts +31 -14
- package/src/__tests__/session-slash-queue.test.ts +3 -2
- package/src/__tests__/session-slash-unknown.test.ts +3 -2
- package/src/__tests__/session-workspace-cache-state.test.ts +3 -1
- package/src/__tests__/session-workspace-injection.test.ts +3 -2
- package/src/__tests__/session-workspace-tool-tracking.test.ts +3 -2
- package/src/__tests__/shell-tool-proxy-mode.test.ts +0 -1
- package/src/__tests__/skill-projection-feature-flag.test.ts +0 -1
- package/src/__tests__/skill-script-runner-sandbox.test.ts +0 -1
- package/src/__tests__/skillssh-registry.test.ts +21 -0
- package/src/__tests__/slack-channel-config.test.ts +1 -7
- package/src/__tests__/slack-share-routes.test.ts +1 -1
- package/src/__tests__/swarm-recursion.test.ts +4 -1
- package/src/__tests__/swarm-session-integration.test.ts +24 -14
- package/src/__tests__/swarm-tool.test.ts +4 -2
- package/src/__tests__/task-compiler.test.ts +1 -1
- package/src/__tests__/telegram-bot-username-resolution.test.ts +2 -4
- package/src/__tests__/test-support/browser-skill-harness.ts +0 -18
- package/src/__tests__/test-support/computer-use-skill-harness.ts +0 -23
- package/src/__tests__/token-estimator-accuracy.benchmark.test.ts +1521 -0
- package/src/__tests__/tool-execution-abort-cleanup.test.ts +0 -1
- package/src/__tests__/tool-executor-lifecycle-events.test.ts +0 -1
- package/src/__tests__/tool-executor-shell-integration.test.ts +0 -1
- package/src/__tests__/tool-executor.test.ts +1 -2
- package/src/__tests__/trust-store.test.ts +8 -83
- package/src/__tests__/twilio-config.test.ts +0 -1
- package/src/__tests__/twilio-provider.test.ts +0 -5
- package/src/__tests__/twilio-routes.test.ts +2 -3
- package/src/__tests__/usage-cache-backfill-migration.test.ts +10 -10
- package/src/__tests__/verification-control-plane-policy.test.ts +0 -1
- package/src/__tests__/voice-quality.test.ts +2 -1
- package/src/__tests__/voice-scoped-grant-consumer.test.ts +0 -1
- package/src/__tests__/web-search.test.ts +1 -1
- package/src/agent/loop.ts +17 -1
- package/src/bundler/app-bundler.ts +40 -24
- package/src/calls/call-controller.ts +16 -0
- package/src/calls/guardian-question-copy.ts +1 -1
- package/src/calls/relay-server.ts +29 -13
- package/src/calls/voice-control-protocol.ts +1 -0
- package/src/calls/voice-quality.ts +1 -1
- package/src/calls/voice-session-bridge.ts +9 -3
- package/src/channels/types.ts +16 -0
- package/src/cli/commands/bash.ts +173 -0
- package/src/cli/commands/doctor.ts +15 -57
- package/src/cli/commands/memory.ts +3 -5
- package/src/cli/commands/oauth/connections.ts +4 -2
- package/src/cli/commands/oauth/providers.ts +1 -13
- package/src/cli/commands/sessions.ts +1 -1
- package/src/cli/commands/usage.ts +359 -0
- package/src/cli/http-client.ts +22 -12
- package/src/cli/program.ts +4 -0
- package/src/cli/reference.ts +2 -0
- package/src/cli.ts +251 -181
- package/src/config/assistant-feature-flags.ts +0 -7
- package/src/config/bundled-skills/chatgpt-import/tools/chatgpt-import.ts +1 -1
- package/src/config/bundled-skills/claude-code/SKILL.md +1 -1
- package/src/config/bundled-skills/claude-code/TOOLS.json +1 -1
- package/src/config/bundled-skills/gmail/SKILL.md +0 -1
- package/src/config/bundled-skills/image-studio/tools/media-generate-image.ts +4 -3
- package/src/config/bundled-skills/media-processing/services/reduce.ts +1 -1
- package/src/config/bundled-skills/media-processing/tools/analyze-keyframes.ts +3 -5
- package/src/config/bundled-skills/media-processing/tools/extract-keyframes.ts +2 -3
- package/src/config/bundled-skills/messaging/SKILL.md +0 -1
- package/src/config/bundled-skills/phone-calls/references/CONFIG.md +1 -1
- package/src/config/bundled-skills/sequences/SKILL.md +0 -1
- package/src/config/bundled-skills/transcribe/tools/transcribe-media.ts +5 -6
- package/src/config/env.ts +13 -0
- package/src/config/feature-flag-registry.json +15 -39
- package/src/config/loader.ts +7 -135
- package/src/config/schema.ts +0 -6
- package/src/config/schemas/channels.ts +1 -0
- package/src/config/schemas/elevenlabs.ts +2 -2
- package/src/config/schemas/security.ts +1 -2
- package/src/config/skills.ts +1 -1
- package/src/contacts/contact-store.ts +21 -75
- package/src/contacts/contacts-write.ts +6 -6
- package/src/contacts/types.ts +2 -0
- package/src/context/token-estimator.ts +35 -2
- package/src/context/window-manager.ts +16 -2
- package/src/daemon/approved-devices-store.ts +0 -44
- package/src/daemon/classifier.ts +1 -1
- package/src/daemon/config-watcher.ts +35 -11
- package/src/daemon/context-overflow-reducer.ts +13 -2
- package/src/daemon/handlers/config-ingress.ts +25 -8
- package/src/daemon/handlers/config-model.ts +22 -16
- package/src/daemon/handlers/config-telegram.ts +18 -6
- package/src/daemon/handlers/dictation.ts +0 -429
- package/src/daemon/handlers/sessions.ts +4 -116
- package/src/daemon/handlers/skills.ts +2 -201
- package/src/daemon/lifecycle.ts +21 -20
- package/src/daemon/message-types/contacts.ts +2 -0
- package/src/daemon/message-types/integrations.ts +1 -0
- package/src/daemon/message-types/sessions.ts +2 -0
- package/src/daemon/parse-actual-tokens-from-error.test.ts +75 -0
- package/src/daemon/providers-setup.ts +1 -1
- package/src/daemon/server.ts +42 -5
- package/src/daemon/session-agent-loop-handlers.ts +1 -1
- package/src/daemon/session-agent-loop.ts +27 -79
- package/src/daemon/session-error.ts +5 -4
- package/src/daemon/session-process.ts +17 -10
- package/src/daemon/session-runtime-assembly.ts +50 -0
- package/src/daemon/session-slash.ts +34 -22
- package/src/daemon/session.ts +1 -0
- package/src/daemon/shutdown-handlers.ts +15 -0
- package/src/daemon/watch-handler.ts +2 -2
- package/src/email/guardrails.ts +1 -1
- package/src/email/service.ts +0 -5
- package/src/events/domain-events.ts +1 -0
- package/src/hooks/templates.ts +1 -1
- package/src/media/app-icon-generator.ts +4 -3
- package/src/media/avatar-router.ts +5 -4
- package/src/media/gemini-image-service.ts +5 -5
- package/src/memory/admin.ts +2 -2
- package/src/memory/app-git-service.ts +0 -7
- package/src/memory/canonical-guardian-store.ts +25 -3
- package/src/memory/conversation-crud.ts +1 -1
- package/src/memory/conversation-title-service.ts +2 -2
- package/src/memory/db-init.ts +12 -0
- package/src/memory/embedding-backend.ts +46 -33
- package/src/memory/external-conversation-store.ts +0 -30
- package/src/memory/guardian-action-store.ts +0 -31
- package/src/memory/guardian-approvals.ts +1 -56
- package/src/memory/indexer.ts +4 -3
- package/src/memory/items-extractor.ts +1 -1
- package/src/memory/job-handlers/backfill.ts +5 -2
- package/src/memory/job-handlers/index-maintenance.ts +2 -2
- package/src/memory/job-handlers/media-processing.ts +2 -2
- package/src/memory/job-handlers/summarization.ts +1 -1
- package/src/memory/job-utils.ts +1 -2
- package/src/memory/jobs-worker.ts +2 -2
- package/src/memory/llm-usage-store.ts +57 -11
- package/src/memory/media-store.ts +4 -535
- package/src/memory/migrations/032-guardian-delivery-conversation-index.ts +2 -2
- package/src/memory/migrations/110-channel-guardian.ts +0 -1
- package/src/memory/migrations/158-channel-interaction-columns.ts +18 -0
- package/src/memory/migrations/159-drop-contact-interaction-columns.ts +16 -0
- package/src/memory/migrations/160-drop-loopback-port-column.ts +13 -0
- package/src/memory/migrations/index.ts +3 -0
- package/src/memory/published-pages-store.ts +0 -83
- package/src/memory/qdrant-circuit-breaker.ts +0 -8
- package/src/memory/retriever.test.ts +19 -12
- package/src/memory/retriever.ts +1 -1
- package/src/memory/schema/contacts.ts +2 -2
- package/src/memory/schema/oauth.ts +0 -1
- package/src/memory/search/semantic.ts +1 -8
- package/src/memory/shared-app-links-store.ts +0 -15
- package/src/messaging/registry.ts +0 -5
- package/src/messaging/style-analyzer.ts +1 -1
- package/src/notifications/copy-composer.ts +5 -13
- package/src/notifications/decision-engine.ts +2 -2
- package/src/notifications/deliveries-store.ts +0 -39
- package/src/notifications/guardian-question-mode.ts +6 -10
- package/src/notifications/preference-extractor.ts +1 -1
- package/src/oauth/byo-connection.test.ts +29 -20
- package/src/oauth/connect-orchestrator.ts +5 -3
- package/src/oauth/connect-types.ts +9 -2
- package/src/oauth/manual-token-connection.ts +9 -7
- package/src/oauth/oauth-store.ts +2 -8
- package/src/oauth/provider-behaviors.ts +11 -1
- package/src/oauth/seed-providers.ts +13 -5
- package/src/permissions/checker.ts +21 -2
- package/src/permissions/shell-identity.ts +0 -5
- package/src/permissions/trust-store.ts +0 -37
- package/src/prompts/__tests__/build-cli-reference-section.test.ts +1 -1
- package/src/prompts/system-prompt.ts +5 -14
- package/src/prompts/templates/BOOTSTRAP.md +1 -3
- package/src/providers/anthropic/client.ts +16 -8
- package/src/providers/managed-proxy/constants.ts +9 -11
- package/src/providers/managed-proxy/context.ts +14 -9
- package/src/providers/provider-send-message.ts +4 -52
- package/src/providers/registry.ts +29 -57
- package/src/providers/types.ts +1 -1
- package/src/runtime/actor-token-store.ts +0 -23
- package/src/runtime/auth/route-policy.ts +4 -0
- package/src/runtime/channel-invite-transports/telegram.ts +12 -6
- package/src/runtime/channel-retry-sweep.ts +6 -0
- package/src/runtime/http-router.ts +5 -1
- package/src/runtime/http-server.ts +101 -4
- package/src/runtime/http-types.ts +1 -0
- package/src/runtime/invite-instruction-generator.ts +25 -51
- package/src/runtime/invite-service.ts +0 -20
- package/src/runtime/middleware/error-handler.ts +1 -2
- package/src/runtime/routes/app-management-routes.ts +1 -0
- package/src/runtime/routes/attachment-routes.ts +1 -1
- package/src/runtime/routes/brain-graph-routes.ts +1 -1
- package/src/runtime/routes/btw-routes.ts +20 -1
- package/src/runtime/routes/call-routes.ts +1 -1
- package/src/runtime/routes/conversation-routes.ts +64 -24
- package/src/runtime/routes/debug-routes.ts +1 -1
- package/src/runtime/routes/diagnostics-routes.ts +2 -2
- package/src/runtime/routes/documents-routes.ts +3 -3
- package/src/runtime/routes/global-search-routes.ts +1 -1
- package/src/runtime/routes/guardian-bootstrap-routes.ts +0 -20
- package/src/runtime/routes/guardian-refresh-routes.ts +0 -20
- package/src/runtime/routes/inbound-message-handler.ts +10 -2
- package/src/runtime/routes/inbound-stages/background-dispatch.ts +4 -0
- package/src/runtime/routes/inbound-stages/edit-intercept.ts +5 -5
- package/src/runtime/routes/integrations/slack/share.ts +5 -5
- package/src/runtime/routes/log-export-routes.ts +122 -10
- package/src/runtime/routes/secret-routes.ts +4 -4
- package/src/runtime/routes/session-query-routes.ts +3 -3
- package/src/runtime/routes/settings-routes.ts +53 -0
- package/src/runtime/routes/trust-rules-routes.ts +1 -1
- package/src/runtime/routes/workspace-routes.ts +3 -0
- package/src/runtime/verification-templates.ts +1 -1
- package/src/security/credential-backend.ts +148 -0
- package/src/security/oauth2.ts +5 -5
- package/src/security/secret-allowlist.ts +1 -1
- package/src/security/secure-keys.ts +98 -160
- package/src/security/token-manager.ts +0 -7
- package/src/sequence/guardrails.ts +0 -4
- package/src/sequence/store.ts +1 -20
- package/src/sequence/types.ts +1 -36
- package/src/signals/bash.ts +157 -0
- package/src/signals/cancel.ts +69 -0
- package/src/signals/conversation-undo.ts +127 -0
- package/src/signals/trust-rule.ts +174 -0
- package/src/skills/clawhub.ts +5 -5
- package/src/skills/managed-store.ts +4 -4
- package/src/skills/skillssh-registry.ts +6 -1
- package/src/swarm/backend-claude-code.ts +6 -6
- package/src/swarm/worker-backend.ts +1 -1
- package/src/swarm/worker-runner.ts +1 -1
- package/src/telegram/bot-username.ts +11 -0
- package/src/telemetry/usage-telemetry-reporter.test.ts +366 -0
- package/src/telemetry/usage-telemetry-reporter.ts +181 -0
- package/src/tools/claude-code/claude-code.ts +6 -6
- package/src/tools/credentials/broker.ts +7 -5
- package/src/tools/credentials/vault.ts +11 -6
- package/src/tools/memory/handlers.test.ts +24 -26
- package/src/tools/memory/handlers.ts +1 -13
- package/src/tools/network/__tests__/web-search.test.ts +18 -86
- package/src/tools/network/web-search.ts +9 -15
- package/src/tools/registry.ts +5 -100
- package/src/tools/terminal/parser.ts +34 -4
- package/src/tools/tool-manifest.ts +0 -10
- package/src/usage/actors.ts +0 -12
- package/src/util/canonicalize-identity.ts +0 -9
- package/src/util/errors.ts +0 -3
- package/src/util/platform.ts +31 -8
- package/src/util/pricing.ts +0 -39
- package/src/watcher/constants.ts +0 -7
- package/src/watcher/providers/linear.ts +1 -1
- package/src/work-items/work-item-store.ts +4 -4
- package/src/workspace/commit-message-provider.ts +1 -1
- package/src/workspace/git-service.ts +44 -1
- package/src/workspace/provider-commit-message-generator.ts +11 -7
- package/src/__tests__/fixtures/proxy-fixtures.ts +0 -147
- package/src/browser-extension-relay/client.ts +0 -155
- package/src/contacts/index.ts +0 -18
- package/src/daemon/tls-certs.ts +0 -270
- package/src/errors.ts +0 -41
- package/src/events/index.ts +0 -18
- package/src/followups/index.ts +0 -10
- package/src/playbooks/index.ts +0 -10
- package/src/runtime/auth/index.ts +0 -44
- package/src/tasks/candidate-store.ts +0 -95
- package/src/tools/browser/api-map.ts +0 -313
- package/src/tools/browser/auto-navigate.ts +0 -469
- package/src/tools/browser/headless-browser.ts +0 -590
- package/src/tools/browser/recording-store.ts +0 -75
- package/src/tools/computer-use/registry.ts +0 -21
- package/src/tools/tasks/index.ts +0 -27
|
@@ -22,7 +22,6 @@ mock.module("../util/platform.js", () => ({
|
|
|
22
22
|
}));
|
|
23
23
|
|
|
24
24
|
mock.module("../memory/guardian-action-store.js", () => ({
|
|
25
|
-
getPendingDeliveryByConversation: () => null,
|
|
26
25
|
getGuardianActionRequest: () => null,
|
|
27
26
|
resolveGuardianActionRequest: () => {},
|
|
28
27
|
}));
|
|
@@ -54,7 +53,6 @@ mock.module("../config/loader.js", () => ({
|
|
|
54
53
|
},
|
|
55
54
|
},
|
|
56
55
|
rateLimit: { maxRequestsPerMinute: 0, maxTokensPerSession: 0 },
|
|
57
|
-
apiKeys: {},
|
|
58
56
|
daemon: {
|
|
59
57
|
startupSocketWaitMs: 5000,
|
|
60
58
|
stopTimeoutMs: 5000,
|
|
@@ -199,6 +197,9 @@ let agentLoopRunCalled = false;
|
|
|
199
197
|
mock.module("../agent/loop.js", () => ({
|
|
200
198
|
AgentLoop: class {
|
|
201
199
|
constructor() {}
|
|
200
|
+
getToolTokenBudget() {
|
|
201
|
+
return 0;
|
|
202
|
+
}
|
|
202
203
|
async run(
|
|
203
204
|
messages: Message[],
|
|
204
205
|
onEvent: (event: AgentEvent) => void,
|
|
@@ -36,7 +36,6 @@ mock.module("../config/loader.js", () => ({
|
|
|
36
36
|
summaryBudgetRatio: 0.05,
|
|
37
37
|
},
|
|
38
38
|
rateLimit: { maxRequestsPerMinute: 0, maxTokensPerSession: 0 },
|
|
39
|
-
apiKeys: {},
|
|
40
39
|
memory: { enabled: false },
|
|
41
40
|
}),
|
|
42
41
|
loadRawConfig: () => ({}),
|
|
@@ -154,6 +153,9 @@ mock.module("../memory/app-store.js", () => ({
|
|
|
154
153
|
mock.module("../agent/loop.js", () => ({
|
|
155
154
|
AgentLoop: class {
|
|
156
155
|
constructor() {}
|
|
156
|
+
getToolTokenBudget() {
|
|
157
|
+
return 0;
|
|
158
|
+
}
|
|
157
159
|
async run(
|
|
158
160
|
messages: Message[],
|
|
159
161
|
onEvent: (event: AgentEvent) => void,
|
|
@@ -25,7 +25,6 @@ mock.module("../util/platform.js", () => ({
|
|
|
25
25
|
}));
|
|
26
26
|
|
|
27
27
|
mock.module("../memory/guardian-action-store.js", () => ({
|
|
28
|
-
getPendingDeliveryByConversation: () => null,
|
|
29
28
|
getGuardianActionRequest: () => null,
|
|
30
29
|
resolveGuardianActionRequest: () => {},
|
|
31
30
|
}));
|
|
@@ -57,7 +56,6 @@ mock.module("../config/loader.js", () => ({
|
|
|
57
56
|
},
|
|
58
57
|
},
|
|
59
58
|
rateLimit: { maxRequestsPerMinute: 0, maxTokensPerSession: 0 },
|
|
60
|
-
apiKeys: {},
|
|
61
59
|
memory: { enabled: false },
|
|
62
60
|
daemon: {
|
|
63
61
|
startupSocketWaitMs: 5000,
|
|
@@ -197,6 +195,9 @@ mock.module("../workspace/top-level-scanner.js", () => ({
|
|
|
197
195
|
mock.module("../agent/loop.js", () => ({
|
|
198
196
|
AgentLoop: class {
|
|
199
197
|
constructor() {}
|
|
198
|
+
getToolTokenBudget() {
|
|
199
|
+
return 0;
|
|
200
|
+
}
|
|
200
201
|
async run(
|
|
201
202
|
messages: Message[],
|
|
202
203
|
onEvent: (event: AgentEvent) => void,
|
|
@@ -23,7 +23,6 @@ mock.module("../util/platform.js", () => ({
|
|
|
23
23
|
}));
|
|
24
24
|
|
|
25
25
|
mock.module("../memory/guardian-action-store.js", () => ({
|
|
26
|
-
getPendingDeliveryByConversation: () => null,
|
|
27
26
|
getGuardianActionRequest: () => null,
|
|
28
27
|
resolveGuardianActionRequest: () => {},
|
|
29
28
|
}));
|
|
@@ -55,7 +54,6 @@ mock.module("../config/loader.js", () => ({
|
|
|
55
54
|
},
|
|
56
55
|
},
|
|
57
56
|
rateLimit: { maxRequestsPerMinute: 0, maxTokensPerSession: 0 },
|
|
58
|
-
apiKeys: {},
|
|
59
57
|
memory: { enabled: false },
|
|
60
58
|
daemon: {
|
|
61
59
|
startupSocketWaitMs: 5000,
|
|
@@ -182,6 +180,9 @@ mock.module("../memory/app-store.js", () => ({
|
|
|
182
180
|
mock.module("../agent/loop.js", () => ({
|
|
183
181
|
AgentLoop: class {
|
|
184
182
|
constructor() {}
|
|
183
|
+
getToolTokenBudget() {
|
|
184
|
+
return 0;
|
|
185
|
+
}
|
|
185
186
|
async run(
|
|
186
187
|
messages: Message[],
|
|
187
188
|
onEvent: (event: AgentEvent) => void,
|
|
@@ -427,6 +427,27 @@ describe("fetchSkillFromGitHub", () => {
|
|
|
427
427
|
expect(files["scripts/filter.sh"]).toBe("#!/bin/bash\necho filter");
|
|
428
428
|
});
|
|
429
429
|
|
|
430
|
+
test("surfaces non-404 errors from tree lookup instead of misleading 'not found'", async () => {
|
|
431
|
+
mockFetchImpl = (url: string | URL | Request) => {
|
|
432
|
+
const urlStr = url.toString();
|
|
433
|
+
// Probe for conventional path returns 404
|
|
434
|
+
if (urlStr.includes("/contents/skills/my-skill")) {
|
|
435
|
+
return Promise.resolve(new Response("Not Found", { status: 404 }));
|
|
436
|
+
}
|
|
437
|
+
// Tree API returns a rate-limit error
|
|
438
|
+
if (urlStr.includes("/git/trees/")) {
|
|
439
|
+
return Promise.resolve(
|
|
440
|
+
new Response("rate limit exceeded", { status: 403 }),
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
return Promise.resolve(new Response("not found", { status: 404 }));
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
await expect(
|
|
447
|
+
fetchSkillFromGitHub("owner", "repo", "my-skill"),
|
|
448
|
+
).rejects.toThrow("GitHub API error while searching repo tree: HTTP 403");
|
|
449
|
+
});
|
|
450
|
+
|
|
430
451
|
test("throws when skill not found in tree either", async () => {
|
|
431
452
|
mockFetchImpl = (url: string | URL | Request) => {
|
|
432
453
|
const urlStr = url.toString();
|
|
@@ -100,19 +100,13 @@ mock.module("../security/secure-keys.js", () => {
|
|
|
100
100
|
return "not-found" as const;
|
|
101
101
|
};
|
|
102
102
|
return {
|
|
103
|
-
getSecureKey: (account: string) => secureKeyStore[account] ?? undefined,
|
|
104
103
|
getSecureKeyAsync: async (account: string) =>
|
|
105
104
|
secureKeyStore[account] ?? undefined,
|
|
106
|
-
setSecureKey: syncSet,
|
|
107
|
-
deleteSecureKey: syncDelete,
|
|
108
105
|
setSecureKeyAsync: async (account: string, value: string) =>
|
|
109
106
|
syncSet(account, value),
|
|
110
107
|
deleteSecureKeyAsync: async (account: string) => syncDelete(account),
|
|
111
|
-
|
|
112
|
-
getBackendType: () => "encrypted",
|
|
113
|
-
isDowngradedFromKeychain: () => false,
|
|
108
|
+
listSecureKeysAsync: async () => Object.keys(secureKeyStore),
|
|
114
109
|
_resetBackend: () => {},
|
|
115
|
-
_setBackend: () => {},
|
|
116
110
|
};
|
|
117
111
|
});
|
|
118
112
|
|
|
@@ -6,7 +6,7 @@ import { beforeEach, describe, expect, mock, test } from "bun:test";
|
|
|
6
6
|
|
|
7
7
|
const secureKeyValues = new Map<string, string>();
|
|
8
8
|
mock.module("../security/secure-keys.js", () => ({
|
|
9
|
-
|
|
9
|
+
getSecureKeyAsync: async (key: string) => secureKeyValues.get(key),
|
|
10
10
|
setSecureKeyAsync: async () => {},
|
|
11
11
|
}));
|
|
12
12
|
|
|
@@ -37,7 +37,6 @@ mock.module("../config/loader.js", () => ({
|
|
|
37
37
|
|
|
38
38
|
provider: "anthropic",
|
|
39
39
|
providerOrder: ["anthropic"],
|
|
40
|
-
apiKeys: { anthropic: "test-key" },
|
|
41
40
|
swarm: {
|
|
42
41
|
enabled: true,
|
|
43
42
|
maxWorkers: 3,
|
|
@@ -67,6 +66,10 @@ const mockProvider = {
|
|
|
67
66
|
};
|
|
68
67
|
},
|
|
69
68
|
};
|
|
69
|
+
mock.module("../security/secure-keys.js", () => ({
|
|
70
|
+
getSecureKeyAsync: async () => "test-api-key",
|
|
71
|
+
}));
|
|
72
|
+
|
|
70
73
|
mock.module("../providers/registry.js", () => ({
|
|
71
74
|
getProvider: () => mockProvider,
|
|
72
75
|
getFailoverProvider: () => mockProvider,
|
|
@@ -18,7 +18,6 @@ mock.module("../hooks/manager.js", () => ({
|
|
|
18
18
|
}));
|
|
19
19
|
|
|
20
20
|
let swarmEnabled = true;
|
|
21
|
-
let hasApiKey = true;
|
|
22
21
|
|
|
23
22
|
mock.module("../config/loader.js", () => ({
|
|
24
23
|
getConfig: () => ({
|
|
@@ -26,7 +25,6 @@ mock.module("../config/loader.js", () => ({
|
|
|
26
25
|
|
|
27
26
|
provider: "anthropic",
|
|
28
27
|
providerOrder: ["anthropic"],
|
|
29
|
-
apiKeys: { anthropic: hasApiKey ? "test-key" : "" },
|
|
30
28
|
swarm: {
|
|
31
29
|
enabled: swarmEnabled,
|
|
32
30
|
maxWorkers: 2,
|
|
@@ -56,6 +54,11 @@ const mockTestProvider = {
|
|
|
56
54
|
};
|
|
57
55
|
},
|
|
58
56
|
};
|
|
57
|
+
let mockAnthropicKey: string | undefined = "test-api-key";
|
|
58
|
+
mock.module("../security/secure-keys.js", () => ({
|
|
59
|
+
getSecureKeyAsync: async () => mockAnthropicKey,
|
|
60
|
+
}));
|
|
61
|
+
|
|
59
62
|
mock.module("../providers/registry.js", () => ({
|
|
60
63
|
getProvider: () => mockTestProvider,
|
|
61
64
|
getFailoverProvider: () => mockTestProvider,
|
|
@@ -103,7 +106,6 @@ describe("swarm through AgentLoop", () => {
|
|
|
103
106
|
beforeEach(() => {
|
|
104
107
|
_resetSwarmActive();
|
|
105
108
|
swarmEnabled = true;
|
|
106
|
-
hasApiKey = true;
|
|
107
109
|
});
|
|
108
110
|
|
|
109
111
|
test("agent loop calls swarm_delegate and receives tool result", async () => {
|
|
@@ -253,7 +255,6 @@ describe("swarm regression tests", () => {
|
|
|
253
255
|
beforeEach(() => {
|
|
254
256
|
_resetSwarmActive();
|
|
255
257
|
swarmEnabled = true;
|
|
256
|
-
hasApiKey = true;
|
|
257
258
|
});
|
|
258
259
|
|
|
259
260
|
test("swarm_delegate returns graceful message when disabled", async () => {
|
|
@@ -298,17 +299,26 @@ describe("swarm regression tests", () => {
|
|
|
298
299
|
});
|
|
299
300
|
|
|
300
301
|
test("worker backend reports unavailable when no API key", async () => {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
302
|
+
const prevKey = mockAnthropicKey;
|
|
303
|
+
const prevEnv = process.env.ANTHROPIC_API_KEY;
|
|
304
|
+
mockAnthropicKey = undefined;
|
|
305
|
+
delete process.env.ANTHROPIC_API_KEY;
|
|
306
|
+
try {
|
|
307
|
+
const result = await swarmDelegateTool.execute(
|
|
308
|
+
{ objective: "Task without key" },
|
|
309
|
+
makeContext(),
|
|
310
|
+
);
|
|
307
311
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
+
// The tool should still complete — the orchestrator handles backend failures
|
|
313
|
+
// Tasks should fail because no backend is available
|
|
314
|
+
expect(result.content).toBeTruthy();
|
|
315
|
+
expect(result.content).toContain("failed");
|
|
316
|
+
} finally {
|
|
317
|
+
mockAnthropicKey = prevKey;
|
|
318
|
+
if (prevEnv !== undefined) {
|
|
319
|
+
process.env.ANTHROPIC_API_KEY = prevEnv;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
312
322
|
});
|
|
313
323
|
|
|
314
324
|
test("progress chunks stream through onOutput", async () => {
|
|
@@ -17,7 +17,6 @@ mock.module("../config/loader.js", () => ({
|
|
|
17
17
|
|
|
18
18
|
provider: "anthropic",
|
|
19
19
|
providerOrder: ["anthropic"],
|
|
20
|
-
apiKeys: { anthropic: "test-key" },
|
|
21
20
|
swarm: {
|
|
22
21
|
enabled: true,
|
|
23
22
|
maxWorkers: 3,
|
|
@@ -32,7 +31,6 @@ mock.module("../config/loader.js", () => ({
|
|
|
32
31
|
getSwarmDisabledConfig: () => ({
|
|
33
32
|
provider: "anthropic",
|
|
34
33
|
providerOrder: ["anthropic"],
|
|
35
|
-
apiKeys: { anthropic: "test-key" },
|
|
36
34
|
swarm: {
|
|
37
35
|
enabled: false,
|
|
38
36
|
maxWorkers: 3,
|
|
@@ -63,6 +61,10 @@ const mockProvider = {
|
|
|
63
61
|
};
|
|
64
62
|
},
|
|
65
63
|
};
|
|
64
|
+
mock.module("../security/secure-keys.js", () => ({
|
|
65
|
+
getSecureKeyAsync: async () => "test-api-key",
|
|
66
|
+
}));
|
|
67
|
+
|
|
66
68
|
mock.module("../providers/registry.js", () => ({
|
|
67
69
|
getProvider: () => mockProvider,
|
|
68
70
|
getFailoverProvider: () => mockProvider,
|
|
@@ -21,6 +21,7 @@ let mockConfigWriteCalls: Array<{
|
|
|
21
21
|
|
|
22
22
|
mock.module("../telegram/bot-username.js", () => ({
|
|
23
23
|
getTelegramBotUsername: () => mockBotUsername,
|
|
24
|
+
getTelegramBotId: () => (mockBotUsername ? "123456" : undefined),
|
|
24
25
|
}));
|
|
25
26
|
|
|
26
27
|
mock.module("../config/loader.js", () => ({
|
|
@@ -37,10 +38,7 @@ mock.module("../config/loader.js", () => ({
|
|
|
37
38
|
}));
|
|
38
39
|
|
|
39
40
|
mock.module("../security/secure-keys.js", () => ({
|
|
40
|
-
|
|
41
|
-
setSecureKey: (_account: string, _value: string) => true,
|
|
42
|
-
deleteSecureKey: (_account: string) => "deleted" as const,
|
|
43
|
-
listSecureKeys: () => [] as string[],
|
|
41
|
+
getSecureKeyAsync: async (_keyId: string) => mockSecureKey,
|
|
44
42
|
}));
|
|
45
43
|
|
|
46
44
|
// Suppress logger output during tests
|
|
@@ -61,24 +61,6 @@ export function buildSkillLoadHistory(
|
|
|
61
61
|
];
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
/**
|
|
65
|
-
* Assert that a set of tool names is exactly the expected set (order-independent).
|
|
66
|
-
*/
|
|
67
|
-
export function expectToolNamesEqual(
|
|
68
|
-
actual: string[],
|
|
69
|
-
expected: readonly string[],
|
|
70
|
-
): void {
|
|
71
|
-
const sorted = [...actual].sort();
|
|
72
|
-
const expectedSorted = [...expected].sort();
|
|
73
|
-
if (JSON.stringify(sorted) !== JSON.stringify(expectedSorted)) {
|
|
74
|
-
throw new Error(
|
|
75
|
-
`Tool names mismatch.\nExpected: ${JSON.stringify(
|
|
76
|
-
expectedSorted,
|
|
77
|
-
)}\nActual: ${JSON.stringify(sorted)}`,
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
64
|
/**
|
|
83
65
|
* Assert that all browser tool names are present in a given set.
|
|
84
66
|
*/
|
|
@@ -17,28 +17,5 @@ export const COMPUTER_USE_TOOL_NAMES = [
|
|
|
17
17
|
"computer_use_respond",
|
|
18
18
|
] as const;
|
|
19
19
|
|
|
20
|
-
/** The skill ID for the bundled computer-use skill (used in later PRs). */
|
|
21
|
-
export const COMPUTER_USE_SKILL_ID = "computer-use";
|
|
22
|
-
|
|
23
20
|
/** Number of computer_use_* tools. */
|
|
24
21
|
export const COMPUTER_USE_TOOL_COUNT = COMPUTER_USE_TOOL_NAMES.length; // 11
|
|
25
|
-
|
|
26
|
-
import { expect } from "bun:test";
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Assert that every COMPUTER_USE_TOOL_NAMES entry is present in `names`.
|
|
30
|
-
*/
|
|
31
|
-
export function assertComputerUseToolsPresent(names: string[]): void {
|
|
32
|
-
for (const name of COMPUTER_USE_TOOL_NAMES) {
|
|
33
|
-
expect(names).toContain(name);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Assert that no COMPUTER_USE_TOOL_NAMES entry is present in `names`.
|
|
39
|
-
*/
|
|
40
|
-
export function assertComputerUseToolsAbsent(names: string[]): void {
|
|
41
|
-
for (const name of COMPUTER_USE_TOOL_NAMES) {
|
|
42
|
-
expect(names).not.toContain(name);
|
|
43
|
-
}
|
|
44
|
-
}
|