@alumbwe/anvil 1.0.20 → 1.0.22
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/package.json +74 -70
- package/src/agents/bundled-agents.generated.ts +4 -4
- package/src/chat.tsx +1703 -1698
- package/src/cli-args.ts +134 -134
- package/src/components/status-bar.tsx +331 -313
- package/src/hooks/helpers/send-message.ts +663 -654
- package/src/hooks/use-send-message.ts +806 -773
- package/src/index.tsx +473 -473
- package/src/state/chat-store.ts +553 -544
- package/src/utils/create-run-config.ts +121 -121
- package/src/utils/format-compact-number.ts +37 -0
- package/vendor/@anvil/common/package.json +27 -0
- package/vendor/@anvil/common/src/__tests__/agent-validation.test.ts +846 -0
- package/vendor/@anvil/common/src/__tests__/anvil-model-availability.test.ts +101 -0
- package/vendor/@anvil/common/src/__tests__/anvil-models.test.ts +1408 -0
- package/vendor/@anvil/common/src/__tests__/anvil-public-data-use-copy.test.ts +258 -0
- package/vendor/@anvil/common/src/__tests__/anvil-referral-tiers.test.ts +48 -0
- package/vendor/@anvil/common/src/__tests__/anvil-spend-ceilings.test.ts +282 -0
- package/vendor/@anvil/common/src/__tests__/anvil-trust.test.ts +526 -0
- package/vendor/@anvil/common/src/__tests__/deepseek-direct.test.ts +68 -0
- package/vendor/@anvil/common/src/__tests__/disposable-email.test.ts +132 -0
- package/vendor/@anvil/common/src/__tests__/dynamic-agent-template-schema.test.ts +422 -0
- package/vendor/@anvil/common/src/__tests__/env-ci.test.ts +167 -0
- package/vendor/@anvil/common/src/__tests__/env-process.test.ts +145 -0
- package/vendor/@anvil/common/src/__tests__/foreign-client-shipped-agents.test.ts +234 -0
- package/vendor/@anvil/common/src/__tests__/foreign-client-signals.test.ts +379 -0
- package/vendor/@anvil/common/src/__tests__/free-agents.test.ts +807 -0
- package/vendor/@anvil/common/src/__tests__/gravity-capi.test.ts +154 -0
- package/vendor/@anvil/common/src/__tests__/handlesteps-parsing.test.ts +246 -0
- package/vendor/@anvil/common/src/__tests__/kimi-k3-god-only.test.ts +77 -0
- package/vendor/@anvil/common/src/__tests__/model-config.test.ts +89 -0
- package/vendor/@anvil/common/src/__tests__/project-file-tree.test.ts +298 -0
- package/vendor/@anvil/common/src/__tests__/provisioned-model-tiers.test.ts +116 -0
- package/vendor/@anvil/common/src/__tests__/reasoning-effort.test.ts +167 -0
- package/vendor/@anvil/common/src/__tests__/reddit-capi.test.ts +132 -0
- package/vendor/@anvil/common/src/__tests__/response-ad-positions.test.ts +72 -0
- package/vendor/@anvil/common/src/__tests__/user-state.test.ts +30 -0
- package/vendor/@anvil/common/src/actions.ts +215 -0
- package/vendor/@anvil/common/src/analytics-core.ts +69 -0
- package/vendor/@anvil/common/src/analytics.ts +93 -0
- package/vendor/@anvil/common/src/api-keys/constants.ts +26 -0
- package/vendor/@anvil/common/src/browser-actions.ts +413 -0
- package/vendor/@anvil/common/src/constants/__tests__/anvil-onboarding-gate.test.ts +63 -0
- package/vendor/@anvil/common/src/constants/__tests__/anvil-onboarding.test.ts +246 -0
- package/vendor/@anvil/common/src/constants/__tests__/cf-worker-signals.test.ts +106 -0
- package/vendor/@anvil/common/src/constants/agents.ts +99 -0
- package/vendor/@anvil/common/src/constants/analytics-events.ts +435 -0
- package/vendor/@anvil/common/src/constants/anthropic.ts +73 -0
- package/vendor/@anvil/common/src/constants/anvil-data-use.ts +81 -0
- package/vendor/@anvil/common/src/constants/anvil-errors.ts +7 -0
- package/vendor/@anvil/common/src/constants/anvil-gemini-thinker.ts +21 -0
- package/vendor/@anvil/common/src/constants/anvil-model-ids.ts +11 -0
- package/vendor/@anvil/common/src/constants/anvil-models.ts +2130 -0
- package/vendor/@anvil/common/src/constants/anvil-onboarding-gate.ts +55 -0
- package/vendor/@anvil/common/src/constants/anvil-onboarding.ts +307 -0
- package/vendor/@anvil/common/src/constants/anvil-referral-tiers.ts +87 -0
- package/vendor/@anvil/common/src/constants/anvil-signup-block.ts +68 -0
- package/vendor/@anvil/common/src/constants/anvil-spend-ceilings.ts +450 -0
- package/vendor/@anvil/common/src/constants/anvil-trust.ts +976 -0
- package/vendor/@anvil/common/src/constants/auth.ts +18 -0
- package/vendor/@anvil/common/src/constants/byok.ts +2 -0
- package/vendor/@anvil/common/src/constants/cf-worker-signals.ts +132 -0
- package/vendor/@anvil/common/src/constants/composio.ts +34 -0
- package/vendor/@anvil/common/src/constants/deepseek-direct.ts +55 -0
- package/vendor/@anvil/common/src/constants/feedback.ts +13 -0
- package/vendor/@anvil/common/src/constants/foreign-client-signals.ts +272 -0
- package/vendor/@anvil/common/src/constants/free-agents.ts +777 -0
- package/vendor/@anvil/common/src/constants/gemini.ts +15 -0
- package/vendor/@anvil/common/src/constants/grant-priorities.ts +13 -0
- package/vendor/@anvil/common/src/constants/hosts.ts +6 -0
- package/vendor/@anvil/common/src/constants/images.ts +51 -0
- package/vendor/@anvil/common/src/constants/index.ts +7 -0
- package/vendor/@anvil/common/src/constants/knowledge.ts +35 -0
- package/vendor/@anvil/common/src/constants/limits.ts +23 -0
- package/vendor/@anvil/common/src/constants/model-config.ts +277 -0
- package/vendor/@anvil/common/src/constants/openrouter-attribution.ts +8 -0
- package/vendor/@anvil/common/src/constants/paths.ts +69 -0
- package/vendor/@anvil/common/src/constants/provider-routes.ts +317 -0
- package/vendor/@anvil/common/src/constants/reasoning-effort.ts +79 -0
- package/vendor/@anvil/common/src/constants/skills.ts +60 -0
- package/vendor/@anvil/common/src/constants/subscription-plans.ts +49 -0
- package/vendor/@anvil/common/src/constants/ui.ts +25 -0
- package/vendor/@anvil/common/src/env-ci.ts +36 -0
- package/vendor/@anvil/common/src/env-process.ts +95 -0
- package/vendor/@anvil/common/src/env-schema.ts +95 -0
- package/vendor/@anvil/common/src/env.ts +24 -0
- package/vendor/@anvil/common/src/gravity-capi.ts +207 -0
- package/vendor/@anvil/common/src/mcp/client.ts +233 -0
- package/vendor/@anvil/common/src/old-constants.ts +10 -0
- package/vendor/@anvil/common/src/project-file-tree.ts +355 -0
- package/vendor/@anvil/common/src/reddit-capi.ts +254 -0
- package/vendor/@anvil/common/src/schemas/feedback.ts +52 -0
- package/vendor/@anvil/common/src/schemas/logs.ts +66 -0
- package/vendor/@anvil/common/src/templates/agent-validation.ts +392 -0
- package/vendor/@anvil/common/src/templates/initial-agents-dir/LICENSE +202 -0
- package/vendor/@anvil/common/src/templates/initial-agents-dir/README.md +294 -0
- package/vendor/@anvil/common/src/templates/initial-agents-dir/examples/01-basic-diff-reviewer.ts +17 -0
- package/vendor/@anvil/common/src/templates/initial-agents-dir/examples/02-intermediate-git-committer.ts +78 -0
- package/vendor/@anvil/common/src/templates/initial-agents-dir/examples/03-advanced-file-explorer.ts +73 -0
- package/vendor/@anvil/common/src/templates/initial-agents-dir/my-custom-agent.ts +40 -0
- package/vendor/@anvil/common/src/templates/initial-agents-dir/package.json +6 -0
- package/vendor/@anvil/common/src/templates/initial-agents-dir/skills/README.md +65 -0
- package/vendor/@anvil/common/src/templates/initial-agents-dir/skills/example-skill/SKILL.md +29 -0
- package/vendor/@anvil/common/src/templates/initial-agents-dir/types/agent-definition.ts +497 -0
- package/vendor/@anvil/common/src/templates/initial-agents-dir/types/tools.ts +444 -0
- package/vendor/@anvil/common/src/templates/initial-agents-dir/types/util-types.ts +178 -0
- package/vendor/@anvil/common/src/testing/TESTING_PATTERNS.md +351 -0
- package/vendor/@anvil/common/src/testing/anvil-offer-invariants.ts +169 -0
- package/vendor/@anvil/common/src/testing/errors.ts +33 -0
- package/vendor/@anvil/common/src/testing/fixtures/agent-runtime.ts +334 -0
- package/vendor/@anvil/common/src/testing/impl/agent-runtime.ts +6 -0
- package/vendor/@anvil/common/src/testing/index.ts +84 -0
- package/vendor/@anvil/common/src/testing/mock-modules.ts +53 -0
- package/vendor/@anvil/common/src/testing/mock-types.ts +123 -0
- package/vendor/@anvil/common/src/testing/mocks/analytics.ts +261 -0
- package/vendor/@anvil/common/src/testing/mocks/child-process.ts +93 -0
- package/vendor/@anvil/common/src/testing/mocks/crypto.ts +218 -0
- package/vendor/@anvil/common/src/testing/mocks/database.ts +337 -0
- package/vendor/@anvil/common/src/testing/mocks/fetch.ts +219 -0
- package/vendor/@anvil/common/src/testing/mocks/filesystem.ts +166 -0
- package/vendor/@anvil/common/src/testing/mocks/index.ts +101 -0
- package/vendor/@anvil/common/src/testing/mocks/logger.ts +135 -0
- package/vendor/@anvil/common/src/testing/mocks/stream.ts +313 -0
- package/vendor/@anvil/common/src/testing/mocks/timers.ts +132 -0
- package/vendor/@anvil/common/src/testing/mocks/tree-sitter.ts +127 -0
- package/vendor/@anvil/common/src/testing/setup.ts +282 -0
- package/vendor/@anvil/common/src/testing-env-ci.ts +15 -0
- package/vendor/@anvil/common/src/testing-env-process.ts +78 -0
- package/vendor/@anvil/common/src/tools/__tests__/compile-tool-definitions.test.ts +34 -0
- package/vendor/@anvil/common/src/tools/compile-tool-definitions.ts +157 -0
- package/vendor/@anvil/common/src/tools/constants.ts +117 -0
- package/vendor/@anvil/common/src/tools/list.ts +190 -0
- package/vendor/@anvil/common/src/tools/params/__tests__/coerce-to-array.test.ts +213 -0
- package/vendor/@anvil/common/src/tools/params/__tests__/read-docs.test.ts +47 -0
- package/vendor/@anvil/common/src/tools/params/__tests__/render-ui.test.ts +65 -0
- package/vendor/@anvil/common/src/tools/params/tool/__tests__/run-terminal-command-timeout.test.ts +49 -0
- package/vendor/@anvil/common/src/tools/params/tool/add-message.ts +39 -0
- package/vendor/@anvil/common/src/tools/params/tool/add-subgoal.ts +57 -0
- package/vendor/@anvil/common/src/tools/params/tool/apply-patch.ts +110 -0
- package/vendor/@anvil/common/src/tools/params/tool/ask-user.ts +181 -0
- package/vendor/@anvil/common/src/tools/params/tool/browser-logs.ts +85 -0
- package/vendor/@anvil/common/src/tools/params/tool/cloud-plan-ready.ts +94 -0
- package/vendor/@anvil/common/src/tools/params/tool/code-search.ts +159 -0
- package/vendor/@anvil/common/src/tools/params/tool/composio.ts +131 -0
- package/vendor/@anvil/common/src/tools/params/tool/create-plan.ts +80 -0
- package/vendor/@anvil/common/src/tools/params/tool/end-turn.ts +57 -0
- package/vendor/@anvil/common/src/tools/params/tool/find-files.ts +60 -0
- package/vendor/@anvil/common/src/tools/params/tool/glob.ts +80 -0
- package/vendor/@anvil/common/src/tools/params/tool/gravity-index.ts +93 -0
- package/vendor/@anvil/common/src/tools/params/tool/list-directory.ts +58 -0
- package/vendor/@anvil/common/src/tools/params/tool/lookup-agent-info.ts +37 -0
- package/vendor/@anvil/common/src/tools/params/tool/propose-str-replace.ts +103 -0
- package/vendor/@anvil/common/src/tools/params/tool/propose-write-file.ts +71 -0
- package/vendor/@anvil/common/src/tools/params/tool/read-docs.ts +90 -0
- package/vendor/@anvil/common/src/tools/params/tool/read-files.ts +109 -0
- package/vendor/@anvil/common/src/tools/params/tool/read-subtree.ts +79 -0
- package/vendor/@anvil/common/src/tools/params/tool/read-url.ts +81 -0
- package/vendor/@anvil/common/src/tools/params/tool/render-ui.ts +168 -0
- package/vendor/@anvil/common/src/tools/params/tool/run-file-change-hooks.ts +57 -0
- package/vendor/@anvil/common/src/tools/params/tool/run-terminal-command.ts +211 -0
- package/vendor/@anvil/common/src/tools/params/tool/screenshot.ts +97 -0
- package/vendor/@anvil/common/src/tools/params/tool/set-messages.ts +44 -0
- package/vendor/@anvil/common/src/tools/params/tool/set-output.ts +61 -0
- package/vendor/@anvil/common/src/tools/params/tool/skill.ts +59 -0
- package/vendor/@anvil/common/src/tools/params/tool/spawn-agent-inline.ts +56 -0
- package/vendor/@anvil/common/src/tools/params/tool/spawn-agents.ts +154 -0
- package/vendor/@anvil/common/src/tools/params/tool/str-replace.ts +107 -0
- package/vendor/@anvil/common/src/tools/params/tool/suggest-followups.ts +97 -0
- package/vendor/@anvil/common/src/tools/params/tool/task-completed.ts +61 -0
- package/vendor/@anvil/common/src/tools/params/tool/think-deeply.ts +56 -0
- package/vendor/@anvil/common/src/tools/params/tool/update-subgoal.ts +89 -0
- package/vendor/@anvil/common/src/tools/params/tool/vision-analyze.ts +82 -0
- package/vendor/@anvil/common/src/tools/params/tool/web-search.ts +73 -0
- package/vendor/@anvil/common/src/tools/params/tool/write-file.ts +71 -0
- package/vendor/@anvil/common/src/tools/params/tool/write-todos.ts +67 -0
- package/vendor/@anvil/common/src/tools/params/utils.ts +150 -0
- package/vendor/@anvil/common/src/tools/utils.ts +24 -0
- package/vendor/@anvil/common/src/types/__tests__/dynamic-agent-template.test.ts +20 -0
- package/vendor/@anvil/common/src/types/agent-template.ts +215 -0
- package/vendor/@anvil/common/src/types/anvil-session.ts +535 -0
- package/vendor/@anvil/common/src/types/anvil-streak.ts +6 -0
- package/vendor/@anvil/common/src/types/anvil-usage.ts +64 -0
- package/vendor/@anvil/common/src/types/api/agents/publish.ts +61 -0
- package/vendor/@anvil/common/src/types/bun-test.d.ts +5 -0
- package/vendor/@anvil/common/src/types/contracts/agent-runtime.ts +75 -0
- package/vendor/@anvil/common/src/types/contracts/analytics.ts +9 -0
- package/vendor/@anvil/common/src/types/contracts/bigquery.ts +55 -0
- package/vendor/@anvil/common/src/types/contracts/billing.ts +46 -0
- package/vendor/@anvil/common/src/types/contracts/client.ts +53 -0
- package/vendor/@anvil/common/src/types/contracts/database.ts +112 -0
- package/vendor/@anvil/common/src/types/contracts/env.ts +203 -0
- package/vendor/@anvil/common/src/types/contracts/llm.ts +191 -0
- package/vendor/@anvil/common/src/types/contracts/logger.ts +14 -0
- package/vendor/@anvil/common/src/types/contracts/logs.ts +34 -0
- package/vendor/@anvil/common/src/types/contracts/trace.ts +21 -0
- package/vendor/@anvil/common/src/types/dynamic-agent-template.ts +328 -0
- package/vendor/@anvil/common/src/types/filesystem.ts +10 -0
- package/vendor/@anvil/common/src/types/function-params.ts +33 -0
- package/vendor/@anvil/common/src/types/grant.ts +20 -0
- package/vendor/@anvil/common/src/types/gravity-index.ts +170 -0
- package/vendor/@anvil/common/src/types/json.ts +29 -0
- package/vendor/@anvil/common/src/types/mcp.ts +24 -0
- package/vendor/@anvil/common/src/types/messages/anvil-message.ts +58 -0
- package/vendor/@anvil/common/src/types/messages/content-part.ts +59 -0
- package/vendor/@anvil/common/src/types/messages/data-content.ts +14 -0
- package/vendor/@anvil/common/src/types/messages/provider-metadata.ts +13 -0
- package/vendor/@anvil/common/src/types/organization.ts +118 -0
- package/vendor/@anvil/common/src/types/print-mode.ts +121 -0
- package/vendor/@anvil/common/src/types/publisher.ts +67 -0
- package/vendor/@anvil/common/src/types/session-state.ts +149 -0
- package/vendor/@anvil/common/src/types/skill.ts +86 -0
- package/vendor/@anvil/common/src/types/source.ts +11 -0
- package/vendor/@anvil/common/src/types/spawn.ts +13 -0
- package/vendor/@anvil/common/src/types/subscription.ts +67 -0
- package/vendor/@anvil/common/src/types/usage.ts +16 -0
- package/vendor/@anvil/common/src/types/util.ts +3 -0
- package/vendor/@anvil/common/src/util/__tests__/ad-user-agent.test.ts +26 -0
- package/vendor/@anvil/common/src/util/__tests__/analytics-dispatcher.test.ts +122 -0
- package/vendor/@anvil/common/src/util/__tests__/analytics-log.test.ts +102 -0
- package/vendor/@anvil/common/src/util/__tests__/analytics-sampling.test.ts +143 -0
- package/vendor/@anvil/common/src/util/__tests__/anvil-streak.test.ts +202 -0
- package/vendor/@anvil/common/src/util/__tests__/anvil-usage-summary.test.ts +193 -0
- package/vendor/@anvil/common/src/util/__tests__/axiom-only-log.test.ts +140 -0
- package/vendor/@anvil/common/src/util/__tests__/client-user-agent.test.ts +148 -0
- package/vendor/@anvil/common/src/util/__tests__/engagement-tracker.test.ts +115 -0
- package/vendor/@anvil/common/src/util/__tests__/env-file-path.test.ts +57 -0
- package/vendor/@anvil/common/src/util/__tests__/error-abort.test.ts +774 -0
- package/vendor/@anvil/common/src/util/__tests__/error-api-details.test.ts +206 -0
- package/vendor/@anvil/common/src/util/__tests__/file-read-limits.test.ts +173 -0
- package/vendor/@anvil/common/src/util/__tests__/format-code-search.test.ts +60 -0
- package/vendor/@anvil/common/src/util/__tests__/log-mirror.test.ts +31 -0
- package/vendor/@anvil/common/src/util/__tests__/messages.test.ts +1252 -0
- package/vendor/@anvil/common/src/util/__tests__/partial-json-delta.test.ts +505 -0
- package/vendor/@anvil/common/src/util/__tests__/path.test.ts +22 -0
- package/vendor/@anvil/common/src/util/__tests__/project-ignore.test.ts +90 -0
- package/vendor/@anvil/common/src/util/__tests__/promise.test.ts +325 -0
- package/vendor/@anvil/common/src/util/__tests__/rate-limit.test.ts +28 -0
- package/vendor/@anvil/common/src/util/__tests__/reddit-anvil-retention.test.ts +130 -0
- package/vendor/@anvil/common/src/util/__tests__/saxy.test.ts +1008 -0
- package/vendor/@anvil/common/src/util/__tests__/split-data.test.ts +289 -0
- package/vendor/@anvil/common/src/util/__tests__/string.test.ts +239 -0
- package/vendor/@anvil/common/src/util/__tests__/thread-title.test.ts +70 -0
- package/vendor/@anvil/common/src/util/__tests__/tool-result-media-order.test.ts +108 -0
- package/vendor/@anvil/common/src/util/__tests__/ttft-histogram.test.ts +180 -0
- package/vendor/@anvil/common/src/util/__tests__/with-timeout.test.ts +24 -0
- package/vendor/@anvil/common/src/util/__tests__/zoned-time.test.ts +88 -0
- package/vendor/@anvil/common/src/util/ad-user-agent.ts +25 -0
- package/vendor/@anvil/common/src/util/agent-file-utils.ts +110 -0
- package/vendor/@anvil/common/src/util/agent-id-parsing.ts +136 -0
- package/vendor/@anvil/common/src/util/agent-name-normalization.ts +38 -0
- package/vendor/@anvil/common/src/util/agent-name-resolver.ts +86 -0
- package/vendor/@anvil/common/src/util/analytics-dispatcher.ts +82 -0
- package/vendor/@anvil/common/src/util/analytics-log.ts +78 -0
- package/vendor/@anvil/common/src/util/analytics-sampling.ts +255 -0
- package/vendor/@anvil/common/src/util/anvil-model-availability.ts +102 -0
- package/vendor/@anvil/common/src/util/anvil-privacy.ts +82 -0
- package/vendor/@anvil/common/src/util/anvil-streak-line.ts +103 -0
- package/vendor/@anvil/common/src/util/anvil-streak.ts +156 -0
- package/vendor/@anvil/common/src/util/anvil-usage-summary.ts +125 -0
- package/vendor/@anvil/common/src/util/array.ts +31 -0
- package/vendor/@anvil/common/src/util/axiom-only-log.ts +124 -0
- package/vendor/@anvil/common/src/util/cache-debug.ts +171 -0
- package/vendor/@anvil/common/src/util/client-user-agent.ts +114 -0
- package/vendor/@anvil/common/src/util/credentials.ts +26 -0
- package/vendor/@anvil/common/src/util/currency.ts +25 -0
- package/vendor/@anvil/common/src/util/dates.ts +81 -0
- package/vendor/@anvil/common/src/util/disposable-email.ts +277 -0
- package/vendor/@anvil/common/src/util/engagement-tracker.ts +129 -0
- package/vendor/@anvil/common/src/util/env-file-path.ts +40 -0
- package/vendor/@anvil/common/src/util/error.ts +562 -0
- package/vendor/@anvil/common/src/util/file-read-limits.ts +236 -0
- package/vendor/@anvil/common/src/util/file.ts +339 -0
- package/vendor/@anvil/common/src/util/format-code-search.ts +115 -0
- package/vendor/@anvil/common/src/util/lazy-response-ads.ts +92 -0
- package/vendor/@anvil/common/src/util/log-data.ts +57 -0
- package/vendor/@anvil/common/src/util/log-ingest.ts +58 -0
- package/vendor/@anvil/common/src/util/log-mirror.ts +34 -0
- package/vendor/@anvil/common/src/util/lru-cache.ts +67 -0
- package/vendor/@anvil/common/src/util/messages.ts +685 -0
- package/vendor/@anvil/common/src/util/min-heap.ts +87 -0
- package/vendor/@anvil/common/src/util/model-utils.ts +4 -0
- package/vendor/@anvil/common/src/util/object.ts +128 -0
- package/vendor/@anvil/common/src/util/partial-json-delta.ts +89 -0
- package/vendor/@anvil/common/src/util/path.ts +15 -0
- package/vendor/@anvil/common/src/util/project-ignore.ts +119 -0
- package/vendor/@anvil/common/src/util/promise.ts +73 -0
- package/vendor/@anvil/common/src/util/random.ts +15 -0
- package/vendor/@anvil/common/src/util/rate-limit.ts +56 -0
- package/vendor/@anvil/common/src/util/reddit-anvil-retention.ts +60 -0
- package/vendor/@anvil/common/src/util/reddit-capi-events.ts +36 -0
- package/vendor/@anvil/common/src/util/response-ad-positions.ts +54 -0
- package/vendor/@anvil/common/src/util/saxy.ts +741 -0
- package/vendor/@anvil/common/src/util/skills.test.ts +44 -0
- package/vendor/@anvil/common/src/util/skills.ts +36 -0
- package/vendor/@anvil/common/src/util/split-data.ts +259 -0
- package/vendor/@anvil/common/src/util/stop-sequence.ts +61 -0
- package/vendor/@anvil/common/src/util/string.ts +426 -0
- package/vendor/@anvil/common/src/util/system-info.ts +53 -0
- package/vendor/@anvil/common/src/util/thread-title.ts +46 -0
- package/vendor/@anvil/common/src/util/ttft-histogram.ts +73 -0
- package/vendor/@anvil/common/src/util/xml-parser.ts +27 -0
- package/vendor/@anvil/common/src/util/xml.ts +17 -0
- package/vendor/@anvil/common/src/util/zod-schema.ts +25 -0
- package/vendor/@anvil/common/src/util/zoned-time.ts +136 -0
- package/vendor/@anvil/common/src/utils/ask-user-bridge.ts +44 -0
- package/vendor/@anvil/sdk/dist/index.cjs +52297 -0
- package/vendor/@anvil/sdk/dist/index.cjs.map +440 -0
- package/vendor/@anvil/sdk/dist/index.d.ts +4277 -0
- package/vendor/@anvil/sdk/dist/index.mjs +52290 -0
- package/vendor/@anvil/sdk/dist/index.mjs.map +440 -0
- package/vendor/@anvil/sdk/dist/vendor/ai.cjs +30886 -0
- package/vendor/@anvil/sdk/dist/vendor/ripgrep/arm64-darwin/rg +0 -0
- package/vendor/@anvil/sdk/dist/vendor/ripgrep/arm64-linux/rg +0 -0
- package/vendor/@anvil/sdk/dist/vendor/ripgrep/x64-darwin/rg +0 -0
- package/vendor/@anvil/sdk/dist/vendor/ripgrep/x64-linux/rg +0 -0
- package/vendor/@anvil/sdk/dist/vendor/ripgrep/x64-win32/rg.exe +0 -0
- package/vendor/@anvil/sdk/dist/wasm/tree-sitter-c-sharp.wasm +0 -0
- package/vendor/@anvil/sdk/dist/wasm/tree-sitter-cpp.wasm +0 -0
- package/vendor/@anvil/sdk/dist/wasm/tree-sitter-go.wasm +0 -0
- package/vendor/@anvil/sdk/dist/wasm/tree-sitter-java.wasm +0 -0
- package/vendor/@anvil/sdk/dist/wasm/tree-sitter-javascript.wasm +0 -0
- package/vendor/@anvil/sdk/dist/wasm/tree-sitter-python.wasm +0 -0
- package/vendor/@anvil/sdk/dist/wasm/tree-sitter-ruby.wasm +0 -0
- package/vendor/@anvil/sdk/dist/wasm/tree-sitter-rust.wasm +0 -0
- package/vendor/@anvil/sdk/dist/wasm/tree-sitter-tsx.wasm +0 -0
- package/vendor/@anvil/sdk/dist/wasm/tree-sitter-typescript.wasm +0 -0
- package/vendor/@anvil/sdk/dist/wasm/tree-sitter.wasm +0 -0
- package/vendor/@anvil/sdk/package.json +21 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
UNRECOGNIZED_CLIENT,
|
|
5
|
+
clientUserAgentFields,
|
|
6
|
+
normalizeClientUserAgent,
|
|
7
|
+
} from '../client-user-agent'
|
|
8
|
+
|
|
9
|
+
describe('normalizeClientUserAgent', () => {
|
|
10
|
+
it('parses the official CLI agent', () => {
|
|
11
|
+
// What getCliAdRequestUserAgent() emits.
|
|
12
|
+
expect(normalizeClientUserAgent('Anvil-CLI/0.0.138')).toEqual({
|
|
13
|
+
product: 'anvil-cli',
|
|
14
|
+
version: '0.0.138',
|
|
15
|
+
})
|
|
16
|
+
expect(normalizeClientUserAgent('Anvil-CLI/1.0.685')).toEqual({
|
|
17
|
+
product: 'anvil-cli',
|
|
18
|
+
version: '1.0.685',
|
|
19
|
+
})
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it('parses runtime and SDK agents a non-official client would send', () => {
|
|
23
|
+
expect(normalizeClientUserAgent('Go-http-client/2.0')).toEqual({
|
|
24
|
+
product: 'go-http-client',
|
|
25
|
+
version: '2.0',
|
|
26
|
+
})
|
|
27
|
+
expect(normalizeClientUserAgent('Bun/1.3.11')).toEqual({
|
|
28
|
+
product: 'bun',
|
|
29
|
+
version: '1.3.11',
|
|
30
|
+
})
|
|
31
|
+
// The UA a published Anvil proxy sends. The second segment is not a
|
|
32
|
+
// version, so it is dropped — `ai-sdk` alone still separates it from
|
|
33
|
+
// `anvil-cli`, which is the whole point.
|
|
34
|
+
expect(
|
|
35
|
+
normalizeClientUserAgent('ai-sdk/openai-compatible/1.0.25/anvil'),
|
|
36
|
+
).toEqual({ product: 'ai-sdk' })
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('keeps only the leading product token, dropping platform detail', () => {
|
|
40
|
+
// The PII guard: everything after the first whitespace is never read, so
|
|
41
|
+
// OS/device strings cannot reach an event payload.
|
|
42
|
+
const browser =
|
|
43
|
+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36'
|
|
44
|
+
expect(normalizeClientUserAgent(browser)).toEqual({
|
|
45
|
+
product: 'mozilla',
|
|
46
|
+
version: '5.0',
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it('returns undefined for an absent or blank header', () => {
|
|
51
|
+
expect(normalizeClientUserAgent(undefined)).toBeUndefined()
|
|
52
|
+
expect(normalizeClientUserAgent(null)).toBeUndefined()
|
|
53
|
+
expect(normalizeClientUserAgent(' ')).toBeUndefined()
|
|
54
|
+
expect(clientUserAgentFields(null)).toEqual({})
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
it('collapses an over-long product instead of truncating it', () => {
|
|
58
|
+
// Truncating would both fabricate a name and leave long random strings as
|
|
59
|
+
// a cheap way to mint new values.
|
|
60
|
+
expect(normalizeClientUserAgent('A'.repeat(200) + '/1.0')).toEqual({
|
|
61
|
+
product: UNRECOGNIZED_CLIENT,
|
|
62
|
+
})
|
|
63
|
+
// Exactly at the cap is still kept.
|
|
64
|
+
const atCap = 'a'.repeat(32)
|
|
65
|
+
expect(normalizeClientUserAgent(`${atCap}/1.0`)).toEqual({
|
|
66
|
+
product: atCap,
|
|
67
|
+
version: '1.0',
|
|
68
|
+
})
|
|
69
|
+
// One past it collapses.
|
|
70
|
+
expect(normalizeClientUserAgent(`${'a'.repeat(33)}/1.0`)).toEqual({
|
|
71
|
+
product: UNRECOGNIZED_CLIENT,
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it('collapses junk to a single constant rather than minting a value', () => {
|
|
76
|
+
// The cardinality guard: a caller varying unparseable bytes cannot create
|
|
77
|
+
// new distinct values.
|
|
78
|
+
expect(normalizeClientUserAgent('!!!@@@###')).toEqual({
|
|
79
|
+
product: UNRECOGNIZED_CLIENT,
|
|
80
|
+
})
|
|
81
|
+
expect(normalizeClientUserAgent('***/1.0')).toEqual({
|
|
82
|
+
product: UNRECOGNIZED_CLIENT,
|
|
83
|
+
})
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it('rejects an address-shaped product rather than mangling it', () => {
|
|
87
|
+
// Stripping `@` would record `userexample.com`, which is still identifying.
|
|
88
|
+
expect(normalizeClientUserAgent('user@example.com/1.0')).toEqual({
|
|
89
|
+
product: UNRECOGNIZED_CLIENT,
|
|
90
|
+
})
|
|
91
|
+
// A contact address in the conventional comment position is already gone:
|
|
92
|
+
// everything after the first whitespace is never read.
|
|
93
|
+
expect(
|
|
94
|
+
normalizeClientUserAgent('MyBot/1.0 (+contact@example.com)'),
|
|
95
|
+
).toEqual({ product: 'mybot', version: '1.0' })
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
it('cannot inject fields into a log line', () => {
|
|
99
|
+
// Newlines and CR terminate the token before any charset stripping.
|
|
100
|
+
expect(normalizeClientUserAgent('evil\nFAKE-FIELD: 1/1.0')).toEqual({
|
|
101
|
+
product: 'evil',
|
|
102
|
+
})
|
|
103
|
+
expect(normalizeClientUserAgent('evil\r\ninjected/1.0')).toEqual({
|
|
104
|
+
product: 'evil',
|
|
105
|
+
})
|
|
106
|
+
expect(normalizeClientUserAgent('{"json":"inject"}/1.0')).toEqual({
|
|
107
|
+
product: 'jsoninject',
|
|
108
|
+
version: '1.0',
|
|
109
|
+
})
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
it('drops a version that does not look like a version', () => {
|
|
113
|
+
// Keeps free-form text (a plausible PII carrier) out of the version field.
|
|
114
|
+
expect(normalizeClientUserAgent('curl/not-a-version')).toEqual({
|
|
115
|
+
product: 'curl',
|
|
116
|
+
})
|
|
117
|
+
expect(normalizeClientUserAgent('someclient')).toEqual({
|
|
118
|
+
product: 'someclient',
|
|
119
|
+
})
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
it('drops an over-long version rather than fabricating a truncated one', () => {
|
|
123
|
+
expect(normalizeClientUserAgent('x/1' + '2'.repeat(100))).toEqual({
|
|
124
|
+
product: 'x',
|
|
125
|
+
})
|
|
126
|
+
// The case that makes truncation actively wrong: a real, legitimate semver
|
|
127
|
+
// longer than the cap. Reporting `1.0.0-beta+build` would name a version
|
|
128
|
+
// that does not exist and would collide with `...build.2`.
|
|
129
|
+
expect(normalizeClientUserAgent('x/1.0.0-beta+build.1')).toEqual({
|
|
130
|
+
product: 'x',
|
|
131
|
+
})
|
|
132
|
+
// Exactly at the cap is kept.
|
|
133
|
+
expect(normalizeClientUserAgent('x/1234567890123456')).toEqual({
|
|
134
|
+
product: 'x',
|
|
135
|
+
version: '1234567890123456',
|
|
136
|
+
})
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
it('omits the version key entirely when absent', () => {
|
|
140
|
+
expect(clientUserAgentFields('someclient')).toEqual({
|
|
141
|
+
client_ua_product: 'someclient',
|
|
142
|
+
})
|
|
143
|
+
expect(clientUserAgentFields('Anvil-CLI/0.0.138')).toEqual({
|
|
144
|
+
client_ua_product: 'anvil-cli',
|
|
145
|
+
client_ua_version: '0.0.138',
|
|
146
|
+
})
|
|
147
|
+
})
|
|
148
|
+
})
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
EngagementTracker,
|
|
5
|
+
ENGAGEMENT_INTERVAL_MS,
|
|
6
|
+
ENGAGEMENT_IDLE_THRESHOLD_MS,
|
|
7
|
+
type EngagementScheduler,
|
|
8
|
+
} from '../engagement-tracker'
|
|
9
|
+
|
|
10
|
+
/** A scheduler whose registered tick can be fired manually, with a movable clock. */
|
|
11
|
+
function harness(opts?: { idleThresholdMs?: number }) {
|
|
12
|
+
let now = 1_000_000
|
|
13
|
+
let registered: (() => void) | undefined
|
|
14
|
+
let cleared = false
|
|
15
|
+
let emits = 0
|
|
16
|
+
|
|
17
|
+
const scheduler: EngagementScheduler = {
|
|
18
|
+
setInterval: (fn) => {
|
|
19
|
+
registered = fn
|
|
20
|
+
return 'handle'
|
|
21
|
+
},
|
|
22
|
+
clearInterval: () => {
|
|
23
|
+
cleared = true
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const tracker = new EngagementTracker({
|
|
28
|
+
emit: () => emits++,
|
|
29
|
+
now: () => now,
|
|
30
|
+
scheduler,
|
|
31
|
+
idleThresholdMs: opts?.idleThresholdMs,
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
tracker,
|
|
36
|
+
advance: (ms: number) => {
|
|
37
|
+
now += ms
|
|
38
|
+
},
|
|
39
|
+
fireTick: () => registered?.(),
|
|
40
|
+
get emits() {
|
|
41
|
+
return emits
|
|
42
|
+
},
|
|
43
|
+
get cleared() {
|
|
44
|
+
return cleared
|
|
45
|
+
},
|
|
46
|
+
get started() {
|
|
47
|
+
return registered !== undefined
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
describe('EngagementTracker', () => {
|
|
53
|
+
it('emits one event per tick while visible and recently active', () => {
|
|
54
|
+
const h = harness()
|
|
55
|
+
h.tracker.start()
|
|
56
|
+
|
|
57
|
+
h.fireTick()
|
|
58
|
+
h.fireTick()
|
|
59
|
+
expect(h.emits).toBe(2)
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it('does not emit when the surface is not visible', () => {
|
|
63
|
+
const h = harness()
|
|
64
|
+
h.tracker.start()
|
|
65
|
+
h.tracker.setVisible(false)
|
|
66
|
+
|
|
67
|
+
h.fireTick()
|
|
68
|
+
expect(h.emits).toBe(0)
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it('stops emitting once the user is idle past the threshold', () => {
|
|
72
|
+
const h = harness()
|
|
73
|
+
h.tracker.start()
|
|
74
|
+
|
|
75
|
+
h.advance(ENGAGEMENT_IDLE_THRESHOLD_MS - 1)
|
|
76
|
+
h.fireTick()
|
|
77
|
+
expect(h.emits).toBe(1)
|
|
78
|
+
|
|
79
|
+
// Cross the idle threshold with no activity → no more counting.
|
|
80
|
+
h.advance(2)
|
|
81
|
+
h.fireTick()
|
|
82
|
+
expect(h.emits).toBe(1)
|
|
83
|
+
|
|
84
|
+
// Activity revives engagement.
|
|
85
|
+
h.tracker.recordActivity()
|
|
86
|
+
h.fireTick()
|
|
87
|
+
expect(h.emits).toBe(2)
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
it('treats re-becoming visible as activity', () => {
|
|
91
|
+
const h = harness()
|
|
92
|
+
h.tracker.start()
|
|
93
|
+
|
|
94
|
+
h.tracker.setVisible(false)
|
|
95
|
+
h.advance(ENGAGEMENT_IDLE_THRESHOLD_MS + 10)
|
|
96
|
+
// Returning to the surface counts as fresh activity, so the next tick counts.
|
|
97
|
+
h.tracker.setVisible(true)
|
|
98
|
+
h.fireTick()
|
|
99
|
+
expect(h.emits).toBe(1)
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
it('start is idempotent and stop clears the timer', () => {
|
|
103
|
+
const h = harness()
|
|
104
|
+
h.tracker.start()
|
|
105
|
+
h.tracker.start()
|
|
106
|
+
expect(h.started).toBe(true)
|
|
107
|
+
|
|
108
|
+
h.tracker.stop()
|
|
109
|
+
expect(h.cleared).toBe(true)
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
it('defaults to a one-minute cadence', () => {
|
|
113
|
+
expect(ENGAGEMENT_INTERVAL_MS).toBe(60_000)
|
|
114
|
+
})
|
|
115
|
+
})
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
isEnvFilePath,
|
|
5
|
+
isEnvTemplateFilePath,
|
|
6
|
+
isSensitiveEnvFilePath,
|
|
7
|
+
} from '../env-file-path'
|
|
8
|
+
|
|
9
|
+
describe('env file paths', () => {
|
|
10
|
+
test.each([
|
|
11
|
+
['.env', true],
|
|
12
|
+
['.ENV.LOCAL', true],
|
|
13
|
+
['config/.Env.Template', true],
|
|
14
|
+
['app.env', false],
|
|
15
|
+
])('%s env family → %s', (filePath, expected) => {
|
|
16
|
+
expect(isEnvFilePath(filePath)).toBe(expected)
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
test.each([
|
|
20
|
+
['.env', true],
|
|
21
|
+
['.ENV', true],
|
|
22
|
+
['config/.env.local', true],
|
|
23
|
+
['config\\.Env.Production', true],
|
|
24
|
+
['.ENV/', true],
|
|
25
|
+
['config/.env.local/.', true],
|
|
26
|
+
['safe/../.env', true],
|
|
27
|
+
['.env ', true],
|
|
28
|
+
['.env:$DATA', true],
|
|
29
|
+
['config/.env.local:backup', true],
|
|
30
|
+
['C:.ENV', true],
|
|
31
|
+
['.env.example ', true],
|
|
32
|
+
['.env.example:$DATA', true],
|
|
33
|
+
['/tmp/.env.example', false],
|
|
34
|
+
['.ENV.SAMPLE', false],
|
|
35
|
+
['config\\.env.Template', false],
|
|
36
|
+
['.envrc', false],
|
|
37
|
+
['app.env', false],
|
|
38
|
+
['.env/..', false],
|
|
39
|
+
])('%s sensitive → %s', (filePath, expected) => {
|
|
40
|
+
expect(isSensitiveEnvFilePath(filePath)).toBe(expected)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
test.each([
|
|
44
|
+
['.env.example', true],
|
|
45
|
+
['.ENV.SAMPLE', true],
|
|
46
|
+
['config/.Env.Template', true],
|
|
47
|
+
['config/.Env.Template/./', true],
|
|
48
|
+
['C:.Env.Example', true],
|
|
49
|
+
['.env', false],
|
|
50
|
+
['.env.local', false],
|
|
51
|
+
['.env.example ', false],
|
|
52
|
+
['.env.example:$DATA', false],
|
|
53
|
+
['app.env.example', false],
|
|
54
|
+
])('%s template → %s', (filePath, expected) => {
|
|
55
|
+
expect(isEnvTemplateFilePath(filePath)).toBe(expected)
|
|
56
|
+
})
|
|
57
|
+
})
|