@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,75 @@
|
|
|
1
|
+
import type { TrackEventFn } from './analytics'
|
|
2
|
+
import type { ConsumeCreditsWithFallbackFn } from './billing'
|
|
3
|
+
import type {
|
|
4
|
+
HandleStepsLogChunkFn,
|
|
5
|
+
RequestFilesFn,
|
|
6
|
+
RequestMcpToolDataFn,
|
|
7
|
+
RequestOptionalFileFn,
|
|
8
|
+
RequestToolCallFn,
|
|
9
|
+
SendActionFn,
|
|
10
|
+
SendSubagentChunkFn,
|
|
11
|
+
} from './client'
|
|
12
|
+
import type {
|
|
13
|
+
AddAgentStepFn,
|
|
14
|
+
DatabaseAgentCache,
|
|
15
|
+
FetchAgentFromDatabaseFn,
|
|
16
|
+
FinishAgentRunFn,
|
|
17
|
+
GetUserInfoFromApiKeyFn,
|
|
18
|
+
StartAgentRunFn,
|
|
19
|
+
} from './database'
|
|
20
|
+
import type { ClientEnv, CiEnv } from './env'
|
|
21
|
+
import type {
|
|
22
|
+
PromptAiSdkFn,
|
|
23
|
+
PromptAiSdkStreamFn,
|
|
24
|
+
PromptAiSdkStructuredFn,
|
|
25
|
+
} from './llm'
|
|
26
|
+
import type { Logger } from './logger'
|
|
27
|
+
import type { TraceWriter } from './trace'
|
|
28
|
+
|
|
29
|
+
/** Shared dependencies */
|
|
30
|
+
export type AgentRuntimeDeps = {
|
|
31
|
+
// Environment
|
|
32
|
+
clientEnv: ClientEnv
|
|
33
|
+
ciEnv: CiEnv
|
|
34
|
+
|
|
35
|
+
// Database
|
|
36
|
+
getUserInfoFromApiKey: GetUserInfoFromApiKeyFn
|
|
37
|
+
fetchAgentFromDatabase: FetchAgentFromDatabaseFn
|
|
38
|
+
startAgentRun: StartAgentRunFn
|
|
39
|
+
finishAgentRun: FinishAgentRunFn
|
|
40
|
+
addAgentStep: AddAgentStepFn
|
|
41
|
+
|
|
42
|
+
// Billing
|
|
43
|
+
consumeCreditsWithFallback: ConsumeCreditsWithFallbackFn
|
|
44
|
+
|
|
45
|
+
// LLM
|
|
46
|
+
promptAiSdkStream: PromptAiSdkStreamFn
|
|
47
|
+
promptAiSdk: PromptAiSdkFn
|
|
48
|
+
promptAiSdkStructured: PromptAiSdkStructuredFn
|
|
49
|
+
|
|
50
|
+
// Mutable State
|
|
51
|
+
databaseAgentCache: DatabaseAgentCache
|
|
52
|
+
|
|
53
|
+
// Analytics
|
|
54
|
+
trackEvent: TrackEventFn
|
|
55
|
+
|
|
56
|
+
// Other
|
|
57
|
+
logger: Logger
|
|
58
|
+
/** Optional debug trace of agent message histories (see TraceWriter) */
|
|
59
|
+
traceWriter?: TraceWriter
|
|
60
|
+
fetch: typeof globalThis.fetch
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Per-run dependencies */
|
|
64
|
+
export type AgentRuntimeScopedDeps = {
|
|
65
|
+
// Client (WebSocket)
|
|
66
|
+
handleStepsLogChunk: HandleStepsLogChunkFn
|
|
67
|
+
requestToolCall: RequestToolCallFn
|
|
68
|
+
requestMcpToolData: RequestMcpToolDataFn
|
|
69
|
+
requestFiles: RequestFilesFn
|
|
70
|
+
requestOptionalFile: RequestOptionalFileFn
|
|
71
|
+
sendAction: SendActionFn
|
|
72
|
+
sendSubagentChunk: SendSubagentChunkFn
|
|
73
|
+
|
|
74
|
+
apiKey: string
|
|
75
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Logger } from './logger'
|
|
2
|
+
|
|
3
|
+
export type MessageRow = {
|
|
4
|
+
id: string
|
|
5
|
+
user_id: string
|
|
6
|
+
finished_at: Date
|
|
7
|
+
created_at: Date
|
|
8
|
+
request: unknown
|
|
9
|
+
reasoning_text: string
|
|
10
|
+
response: string
|
|
11
|
+
output_tokens?: number | null
|
|
12
|
+
reasoning_tokens?: number | null
|
|
13
|
+
cost?: number | null
|
|
14
|
+
upstream_inference_cost?: number | null
|
|
15
|
+
input_tokens?: number | null
|
|
16
|
+
cache_read_input_tokens?: number | null
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type InsertMessageBigqueryFn = (params: {
|
|
20
|
+
row: MessageRow
|
|
21
|
+
dataset?: string
|
|
22
|
+
logger: Logger
|
|
23
|
+
}) => Promise<boolean>
|
|
24
|
+
|
|
25
|
+
export type ChatCompletionTraceRow = {
|
|
26
|
+
id: string
|
|
27
|
+
user_id: string
|
|
28
|
+
client_id?: string | null
|
|
29
|
+
trace_session_id: string
|
|
30
|
+
trace_lineage_id: string
|
|
31
|
+
run_id: string
|
|
32
|
+
agent_id: string
|
|
33
|
+
created_at: Date
|
|
34
|
+
model: string
|
|
35
|
+
cost_mode?: string | null
|
|
36
|
+
request: unknown
|
|
37
|
+
message_count: number
|
|
38
|
+
message_start_index: number
|
|
39
|
+
message_delta_count: number
|
|
40
|
+
previous_message_count?: number | null
|
|
41
|
+
common_prefix_length: number
|
|
42
|
+
cache_hit: boolean
|
|
43
|
+
full_snapshot: boolean
|
|
44
|
+
messages: unknown[]
|
|
45
|
+
delta_message_hashes: string[]
|
|
46
|
+
tool_count: number
|
|
47
|
+
tools?: unknown[] | null
|
|
48
|
+
tools_omitted: boolean
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type InsertChatCompletionTraceBigqueryFn = (params: {
|
|
52
|
+
row: ChatCompletionTraceRow
|
|
53
|
+
dataset?: string
|
|
54
|
+
logger: Logger
|
|
55
|
+
}) => Promise<boolean>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Logger } from './logger'
|
|
2
|
+
import type { ErrorOr } from '../../util/error'
|
|
3
|
+
|
|
4
|
+
export type GetUserUsageDataFn = (params: {
|
|
5
|
+
userId: string
|
|
6
|
+
logger: Logger
|
|
7
|
+
includeSubscriptionCredits?: boolean
|
|
8
|
+
}) => Promise<{
|
|
9
|
+
usageThisCycle: number
|
|
10
|
+
balance: {
|
|
11
|
+
totalRemaining: number
|
|
12
|
+
totalDebt: number
|
|
13
|
+
netBalance: number
|
|
14
|
+
breakdown: Record<string, number>
|
|
15
|
+
principals: Record<string, number>
|
|
16
|
+
}
|
|
17
|
+
nextQuotaReset: string
|
|
18
|
+
autoTopupTriggered?: boolean
|
|
19
|
+
autoTopupEnabled?: boolean
|
|
20
|
+
}>
|
|
21
|
+
|
|
22
|
+
export type ConsumeCreditsWithFallbackFn = (params: {
|
|
23
|
+
userId: string
|
|
24
|
+
creditsToCharge: number
|
|
25
|
+
repoUrl?: string | null
|
|
26
|
+
context: string // Description of what the credits are for (e.g., 'web search', 'documentation lookup')
|
|
27
|
+
logger: Logger
|
|
28
|
+
}) => Promise<ErrorOr<CreditFallbackResult>>
|
|
29
|
+
|
|
30
|
+
export type CreditFallbackResult = {
|
|
31
|
+
organizationId?: string
|
|
32
|
+
organizationName?: string
|
|
33
|
+
chargedToOrganization: boolean
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type GetOrganizationUsageResponseFn = (params: {
|
|
37
|
+
organizationId: string
|
|
38
|
+
userId: string
|
|
39
|
+
logger: Logger
|
|
40
|
+
}) => Promise<{
|
|
41
|
+
type: 'usage-response'
|
|
42
|
+
usage: number
|
|
43
|
+
remainingBalance: number
|
|
44
|
+
balanceBreakdown: Record<string, never>
|
|
45
|
+
next_quota_reset: null
|
|
46
|
+
}>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ServerAction } from '../../actions'
|
|
2
|
+
import type { MCPConfig } from '../mcp'
|
|
3
|
+
import type { ToolResultOutput } from '../messages/content-part'
|
|
4
|
+
|
|
5
|
+
export type RequestToolCallFn = (params: {
|
|
6
|
+
userInputId: string
|
|
7
|
+
toolName: string
|
|
8
|
+
input: Record<string, any> & { timeout_seconds?: number }
|
|
9
|
+
mcpConfig?: MCPConfig
|
|
10
|
+
}) => Promise<{
|
|
11
|
+
output: ToolResultOutput[]
|
|
12
|
+
}>
|
|
13
|
+
|
|
14
|
+
export type RequestMcpToolDataFn = (params: {
|
|
15
|
+
mcpConfig: MCPConfig
|
|
16
|
+
toolNames: string[] | null
|
|
17
|
+
}) => Promise<
|
|
18
|
+
{
|
|
19
|
+
name: string
|
|
20
|
+
description?: string
|
|
21
|
+
inputSchema: unknown
|
|
22
|
+
}[]
|
|
23
|
+
>
|
|
24
|
+
|
|
25
|
+
export type FileReadWindow = { offset?: number; limit?: number }
|
|
26
|
+
|
|
27
|
+
export type RequestFilesFn = (params: {
|
|
28
|
+
filePaths: string[]
|
|
29
|
+
fileWindows?: Record<string, FileReadWindow[]>
|
|
30
|
+
}) => Promise<Record<string, string | null>>
|
|
31
|
+
|
|
32
|
+
export type RequestOptionalFileFn = (params: {
|
|
33
|
+
filePath: string
|
|
34
|
+
}) => Promise<string | null>
|
|
35
|
+
|
|
36
|
+
export type SendSubagentChunkFn = (params: {
|
|
37
|
+
userInputId: string
|
|
38
|
+
agentId: string
|
|
39
|
+
agentType: string
|
|
40
|
+
chunk: string
|
|
41
|
+
prompt?: string | undefined
|
|
42
|
+
forwardToPrompt?: boolean
|
|
43
|
+
}) => void
|
|
44
|
+
|
|
45
|
+
export type HandleStepsLogChunkFn = (params: {
|
|
46
|
+
userInputId: string
|
|
47
|
+
runId: string
|
|
48
|
+
level: 'debug' | 'info' | 'warn' | 'error'
|
|
49
|
+
data: unknown
|
|
50
|
+
message?: string
|
|
51
|
+
}) => void
|
|
52
|
+
|
|
53
|
+
export type SendActionFn = (params: { action: ServerAction }) => void
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { AgentTemplate } from '@anvil/common/types/agent-template'
|
|
2
|
+
import type { Logger } from '@anvil/common/types/contracts/logger'
|
|
3
|
+
|
|
4
|
+
type User = {
|
|
5
|
+
id: string
|
|
6
|
+
email: string
|
|
7
|
+
discord_id: string | null
|
|
8
|
+
stripe_customer_id: string | null
|
|
9
|
+
banned: boolean
|
|
10
|
+
created_at: Date
|
|
11
|
+
}
|
|
12
|
+
export const userColumns = [
|
|
13
|
+
'id',
|
|
14
|
+
'email',
|
|
15
|
+
'discord_id',
|
|
16
|
+
'stripe_customer_id',
|
|
17
|
+
'banned',
|
|
18
|
+
'created_at',
|
|
19
|
+
] as const
|
|
20
|
+
export type UserColumn = keyof User
|
|
21
|
+
export type GetUserInfoFromApiKeyInput<T extends UserColumn> = {
|
|
22
|
+
apiKey: string
|
|
23
|
+
fields: readonly T[]
|
|
24
|
+
logger: Logger
|
|
25
|
+
}
|
|
26
|
+
export type GetUserInfoFromApiKeyOutput<T extends UserColumn> = Promise<
|
|
27
|
+
| {
|
|
28
|
+
[K in T]: User[K]
|
|
29
|
+
}
|
|
30
|
+
| null
|
|
31
|
+
>
|
|
32
|
+
export type GetUserInfoFromApiKeyFn = <T extends UserColumn>(
|
|
33
|
+
params: GetUserInfoFromApiKeyInput<T>,
|
|
34
|
+
) => GetUserInfoFromApiKeyOutput<T>
|
|
35
|
+
|
|
36
|
+
export type GetUserInfoByIdInput<T extends UserColumn> = {
|
|
37
|
+
userId: string
|
|
38
|
+
fields: readonly T[]
|
|
39
|
+
}
|
|
40
|
+
export type GetUserInfoByIdFn = <T extends UserColumn>(
|
|
41
|
+
params: GetUserInfoByIdInput<T>,
|
|
42
|
+
) => GetUserInfoFromApiKeyOutput<T>
|
|
43
|
+
|
|
44
|
+
type AgentRun = {
|
|
45
|
+
agent_id: string
|
|
46
|
+
ancestor_run_ids: string[]
|
|
47
|
+
status: 'running' | 'completed' | 'failed' | 'cancelled'
|
|
48
|
+
}
|
|
49
|
+
export type AgentRunColumn = keyof AgentRun
|
|
50
|
+
export type GetAgentRunFromIdInput<T extends AgentRunColumn> = {
|
|
51
|
+
runId: string
|
|
52
|
+
userId: string
|
|
53
|
+
fields: readonly T[]
|
|
54
|
+
}
|
|
55
|
+
export type GetAgentRunFromIdOutput<T extends AgentRunColumn> = Promise<
|
|
56
|
+
| {
|
|
57
|
+
[K in T]: AgentRun[K]
|
|
58
|
+
}
|
|
59
|
+
| null
|
|
60
|
+
>
|
|
61
|
+
export type GetAgentRunFromIdFn = <T extends AgentRunColumn>(
|
|
62
|
+
params: GetAgentRunFromIdInput<T>,
|
|
63
|
+
) => GetAgentRunFromIdOutput<T>
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Fetch and validate an agent from the database by `publisher/agent-id[@version]` format
|
|
67
|
+
*/
|
|
68
|
+
export type FetchAgentFromDatabaseFn = (params: {
|
|
69
|
+
apiKey: string
|
|
70
|
+
parsedAgentId: {
|
|
71
|
+
publisherId: string
|
|
72
|
+
agentId: string
|
|
73
|
+
version?: string
|
|
74
|
+
}
|
|
75
|
+
logger: Logger
|
|
76
|
+
}) => Promise<AgentTemplate | null>
|
|
77
|
+
|
|
78
|
+
export type StartAgentRunFn = (params: {
|
|
79
|
+
apiKey: string
|
|
80
|
+
userId?: string
|
|
81
|
+
agentId: string
|
|
82
|
+
ancestorRunIds: string[]
|
|
83
|
+
logger: Logger
|
|
84
|
+
}) => Promise<string | null>
|
|
85
|
+
|
|
86
|
+
export type FinishAgentRunFn = (params: {
|
|
87
|
+
apiKey: string
|
|
88
|
+
userId: string | undefined
|
|
89
|
+
runId: string
|
|
90
|
+
status: 'completed' | 'failed' | 'cancelled'
|
|
91
|
+
totalSteps: number
|
|
92
|
+
directCredits: number
|
|
93
|
+
totalCredits: number
|
|
94
|
+
errorMessage?: string
|
|
95
|
+
logger: Logger
|
|
96
|
+
}) => Promise<void>
|
|
97
|
+
|
|
98
|
+
export type AddAgentStepFn = (params: {
|
|
99
|
+
apiKey: string
|
|
100
|
+
userId: string | undefined
|
|
101
|
+
agentRunId: string
|
|
102
|
+
stepNumber: number
|
|
103
|
+
credits?: number
|
|
104
|
+
childRunIds?: string[]
|
|
105
|
+
messageId: string | null
|
|
106
|
+
status?: 'running' | 'completed' | 'skipped'
|
|
107
|
+
errorMessage?: string
|
|
108
|
+
startTime: Date
|
|
109
|
+
logger: Logger
|
|
110
|
+
}) => Promise<string | null>
|
|
111
|
+
|
|
112
|
+
export type DatabaseAgentCache = Map<string, AgentTemplate | null>
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment variable contract types for dependency injection.
|
|
3
|
+
*
|
|
4
|
+
* ARCHITECTURE:
|
|
5
|
+
* =============
|
|
6
|
+
* Base types (defined here in common) that packages extend:
|
|
7
|
+
*
|
|
8
|
+
* ┌─────────────────────────────────────────────────────────────────┐
|
|
9
|
+
* │ BASE TYPES (common) │
|
|
10
|
+
* ├─────────────────────────────────────────────────────────────────┤
|
|
11
|
+
* │ BaseProcessEnv - OS/runtime vars (SHELL, HOME, TERM, etc.) │
|
|
12
|
+
* │ BaseCiEnv - CI vars (CI, GITHUB_ACTIONS, etc.) │
|
|
13
|
+
* │ ClientEnv - Public vars (NEXT_PUBLIC_*) from env-schema │
|
|
14
|
+
* └─────────────────────────────────────────────────────────────────┘
|
|
15
|
+
* │
|
|
16
|
+
* extends │
|
|
17
|
+
* ▼
|
|
18
|
+
* ┌─────────────────────────────────────────────────────────────────┐
|
|
19
|
+
* │ PACKAGE-SPECIFIC ENVS │
|
|
20
|
+
* ├─────────────────────────────────────────────────────────────────┤
|
|
21
|
+
* │ CLI: CliProcessEnv = BaseProcessEnv & { CLI-specific } │
|
|
22
|
+
* │ SDK: SdkProcessEnv = BaseProcessEnv & { SDK-specific } │
|
|
23
|
+
* │ Server: ServerEnv = ClientEnv & { server secrets } │
|
|
24
|
+
* │ Evals: EvalsCiEnv = BaseCiEnv & { eval-specific } │
|
|
25
|
+
* └─────────────────────────────────────────────────────────────────┘
|
|
26
|
+
*
|
|
27
|
+
* Each package imports the base types and extends them with package-specific vars.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import type { ClientEnv } from '../../env-schema'
|
|
31
|
+
|
|
32
|
+
// Re-export the env types for convenience
|
|
33
|
+
export type { ClientEnv } from '../../env-schema'
|
|
34
|
+
|
|
35
|
+
// =============================================================================
|
|
36
|
+
// BASE TYPES - Extended by packages
|
|
37
|
+
// =============================================================================
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Base CI environment variables.
|
|
41
|
+
* Used in CI/CD pipelines across all packages.
|
|
42
|
+
*/
|
|
43
|
+
export type BaseCiEnv = {
|
|
44
|
+
CI?: string
|
|
45
|
+
GITHUB_ACTIONS?: string
|
|
46
|
+
RENDER?: string
|
|
47
|
+
IS_PULL_REQUEST?: string
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Base runtime environment variables.
|
|
52
|
+
* These are OS-level env vars common across all packages.
|
|
53
|
+
*/
|
|
54
|
+
export type BaseEnv = {
|
|
55
|
+
// Shell detection
|
|
56
|
+
SHELL?: string
|
|
57
|
+
COMSPEC?: string // Windows command processor
|
|
58
|
+
|
|
59
|
+
// Home directory
|
|
60
|
+
HOME?: string
|
|
61
|
+
USERPROFILE?: string // Windows home
|
|
62
|
+
APPDATA?: string // Windows app data
|
|
63
|
+
XDG_CONFIG_HOME?: string // Linux config home
|
|
64
|
+
|
|
65
|
+
// Terminal detection
|
|
66
|
+
TERM?: string
|
|
67
|
+
TERM_PROGRAM?: string
|
|
68
|
+
TERM_BACKGROUND?: string
|
|
69
|
+
TERMINAL_EMULATOR?: string
|
|
70
|
+
COLORFGBG?: string
|
|
71
|
+
|
|
72
|
+
// Node/runtime
|
|
73
|
+
NODE_ENV?: string
|
|
74
|
+
NODE_PATH?: string
|
|
75
|
+
PATH?: string
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// =============================================================================
|
|
79
|
+
// EXTENDED TYPES - For packages that need more than base
|
|
80
|
+
// =============================================================================
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Extended CI env with Anvil-specific CI vars.
|
|
84
|
+
* Used by agent-runtime and server code.
|
|
85
|
+
*/
|
|
86
|
+
export type CiEnv = BaseCiEnv & {
|
|
87
|
+
ANVIL_GITHUB_TOKEN?: string
|
|
88
|
+
ANVIL_API_KEY?: string
|
|
89
|
+
EVAL_RESULTS_EMAIL?: string
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Extended process env with terminal/IDE detection.
|
|
94
|
+
* This is the full ProcessEnv used by CLI and SDK.
|
|
95
|
+
* Packages can import this or create their own extensions of BaseProcessEnv.
|
|
96
|
+
*/
|
|
97
|
+
export type ProcessEnv = BaseEnv & {
|
|
98
|
+
// Terminal-specific
|
|
99
|
+
KITTY_WINDOW_ID?: string
|
|
100
|
+
SIXEL_SUPPORT?: string
|
|
101
|
+
ZED_NODE_ENV?: string
|
|
102
|
+
|
|
103
|
+
// VS Code family detection
|
|
104
|
+
VSCODE_THEME_KIND?: string
|
|
105
|
+
VSCODE_COLOR_THEME_KIND?: string
|
|
106
|
+
VSCODE_GIT_IPC_HANDLE?: string
|
|
107
|
+
VSCODE_PID?: string
|
|
108
|
+
VSCODE_CWD?: string
|
|
109
|
+
VSCODE_NLS_CONFIG?: string
|
|
110
|
+
|
|
111
|
+
// Cursor editor detection
|
|
112
|
+
CURSOR_PORT?: string
|
|
113
|
+
CURSOR?: string
|
|
114
|
+
|
|
115
|
+
// JetBrains IDE detection
|
|
116
|
+
JETBRAINS_REMOTE_RUN?: string
|
|
117
|
+
IDEA_INITIAL_DIRECTORY?: string
|
|
118
|
+
IDE_CONFIG_DIR?: string
|
|
119
|
+
JB_IDE_CONFIG_DIR?: string
|
|
120
|
+
|
|
121
|
+
// Editor preferences
|
|
122
|
+
VISUAL?: string
|
|
123
|
+
EDITOR?: string
|
|
124
|
+
ANVIL_CLI_EDITOR?: string
|
|
125
|
+
ANVIL_EDITOR?: string
|
|
126
|
+
|
|
127
|
+
// Theme preferences
|
|
128
|
+
OPEN_TUI_THEME?: string
|
|
129
|
+
OPENTUI_THEME?: string
|
|
130
|
+
|
|
131
|
+
// Anvil CLI-specific (set during binary build)
|
|
132
|
+
ANVIL_IS_BINARY?: string
|
|
133
|
+
ANVIL_CLI_VERSION?: string
|
|
134
|
+
ANVIL_CLI_TARGET?: string
|
|
135
|
+
ANVIL_RG_PATH?: string
|
|
136
|
+
ANVIL_WASM_DIR?: string
|
|
137
|
+
|
|
138
|
+
// Build/CI flags
|
|
139
|
+
VERBOSE?: string
|
|
140
|
+
OVERRIDE_TARGET?: string
|
|
141
|
+
OVERRIDE_PLATFORM?: string
|
|
142
|
+
OVERRIDE_ARCH?: string
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// =============================================================================
|
|
146
|
+
// FUNCTION TYPES - For dependency injection
|
|
147
|
+
// =============================================================================
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Function type for getting a client env value.
|
|
151
|
+
*/
|
|
152
|
+
export type GetClientEnvFn = () => ClientEnv
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Function type for getting base env values.
|
|
156
|
+
*/
|
|
157
|
+
export type GetBaseEnvFn = () => BaseEnv
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Function type for getting full process env values.
|
|
161
|
+
*/
|
|
162
|
+
export type GetProcessEnvFn = () => ProcessEnv
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Function type for getting base CI env values.
|
|
166
|
+
*/
|
|
167
|
+
export type GetBaseCiEnvFn = () => BaseCiEnv
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Function type for getting extended CI env values.
|
|
171
|
+
*/
|
|
172
|
+
export type GetCiEnvFn = () => CiEnv
|
|
173
|
+
|
|
174
|
+
// =============================================================================
|
|
175
|
+
// COMBINED DEPS - For functions that need multiple env types
|
|
176
|
+
// =============================================================================
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Base env deps - minimal set for most functions.
|
|
180
|
+
*/
|
|
181
|
+
export type BaseEnvDeps = {
|
|
182
|
+
clientEnv: ClientEnv
|
|
183
|
+
env: BaseEnv
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Combined env deps with full process env.
|
|
188
|
+
* Used in CLI and client-side code.
|
|
189
|
+
*/
|
|
190
|
+
export type EnvDeps = {
|
|
191
|
+
clientEnv: ClientEnv
|
|
192
|
+
processEnv: ProcessEnv
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Full env deps including CI vars.
|
|
197
|
+
* Note: ServerEnv is defined in packages/internal and should be imported from there.
|
|
198
|
+
*/
|
|
199
|
+
export type FullEnvDeps = {
|
|
200
|
+
clientEnv: ClientEnv
|
|
201
|
+
processEnv: ProcessEnv
|
|
202
|
+
ciEnv: CiEnv
|
|
203
|
+
}
|