@alumbwe/anvil 1.0.20 → 1.0.21
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 +6 -2
- 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,58 @@
|
|
|
1
|
+
import z from 'zod/v4'
|
|
2
|
+
|
|
3
|
+
import { $getNativeToolCallExampleString, jsonToolResultSchema } from '../utils'
|
|
4
|
+
|
|
5
|
+
import type { $ToolParams } from '../../constants'
|
|
6
|
+
|
|
7
|
+
const toolName = 'list_directory'
|
|
8
|
+
const endsAgentStep = true
|
|
9
|
+
const inputSchema = z
|
|
10
|
+
.object({
|
|
11
|
+
path: z
|
|
12
|
+
.string()
|
|
13
|
+
.describe('Directory path to list, relative to the project root.'),
|
|
14
|
+
})
|
|
15
|
+
.describe(
|
|
16
|
+
'List files and directories in the specified path. Returns separate arrays of file names and directory names.',
|
|
17
|
+
)
|
|
18
|
+
const description = `
|
|
19
|
+
Lists all files and directories in the specified path. Useful for exploring directory structure and finding files.
|
|
20
|
+
|
|
21
|
+
Example:
|
|
22
|
+
${$getNativeToolCallExampleString({
|
|
23
|
+
toolName,
|
|
24
|
+
inputSchema,
|
|
25
|
+
input: {
|
|
26
|
+
path: 'src/components',
|
|
27
|
+
},
|
|
28
|
+
endsAgentStep,
|
|
29
|
+
})}
|
|
30
|
+
|
|
31
|
+
${$getNativeToolCallExampleString({
|
|
32
|
+
toolName,
|
|
33
|
+
inputSchema,
|
|
34
|
+
input: {
|
|
35
|
+
path: '.',
|
|
36
|
+
},
|
|
37
|
+
endsAgentStep,
|
|
38
|
+
})}
|
|
39
|
+
`.trim()
|
|
40
|
+
|
|
41
|
+
export const listDirectoryParams = {
|
|
42
|
+
toolName,
|
|
43
|
+
endsAgentStep,
|
|
44
|
+
description,
|
|
45
|
+
inputSchema,
|
|
46
|
+
outputSchema: jsonToolResultSchema(
|
|
47
|
+
z.union([
|
|
48
|
+
z.object({
|
|
49
|
+
files: z.array(z.string()).describe('Array of file names'),
|
|
50
|
+
directories: z.array(z.string()).describe('Array of directory names'),
|
|
51
|
+
path: z.string().describe('The directory path that was listed'),
|
|
52
|
+
}),
|
|
53
|
+
z.object({
|
|
54
|
+
errorMessage: z.string(),
|
|
55
|
+
}),
|
|
56
|
+
]),
|
|
57
|
+
),
|
|
58
|
+
} satisfies $ToolParams
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import z from 'zod/v4'
|
|
2
|
+
|
|
3
|
+
import { jsonValueSchema } from '../../../types/json'
|
|
4
|
+
import { $getNativeToolCallExampleString, jsonToolResultSchema } from '../utils'
|
|
5
|
+
|
|
6
|
+
import type { $ToolParams } from '../../constants'
|
|
7
|
+
|
|
8
|
+
const toolName = 'lookup_agent_info'
|
|
9
|
+
const endsAgentStep = false
|
|
10
|
+
const inputSchema = z
|
|
11
|
+
.object({
|
|
12
|
+
agentId: z
|
|
13
|
+
.string()
|
|
14
|
+
.describe('Agent ID (short local or full published format)'),
|
|
15
|
+
})
|
|
16
|
+
.describe('Retrieve information about an agent by ID')
|
|
17
|
+
const description = `
|
|
18
|
+
Retrieve information about an agent by ID for proper spawning. Use this when you see a request with a full agent ID like "@publisher/agent-id@version" to validate the agent exists and get its metadata. Only agents that are published under a publisher and version are supported for this tool.
|
|
19
|
+
|
|
20
|
+
Example:
|
|
21
|
+
${$getNativeToolCallExampleString({
|
|
22
|
+
toolName,
|
|
23
|
+
inputSchema,
|
|
24
|
+
input: {
|
|
25
|
+
agentId: 'anvil/researcher@0.0.1',
|
|
26
|
+
},
|
|
27
|
+
endsAgentStep,
|
|
28
|
+
})}
|
|
29
|
+
`.trim()
|
|
30
|
+
|
|
31
|
+
export const lookupAgentInfoParams = {
|
|
32
|
+
toolName,
|
|
33
|
+
endsAgentStep,
|
|
34
|
+
description,
|
|
35
|
+
inputSchema,
|
|
36
|
+
outputSchema: jsonToolResultSchema(jsonValueSchema),
|
|
37
|
+
} satisfies $ToolParams
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import z from 'zod/v4'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
$getNativeToolCallExampleString,
|
|
5
|
+
coerceToArray,
|
|
6
|
+
jsonToolResultSchema,
|
|
7
|
+
normalizeReplacementAliases,
|
|
8
|
+
} from '../utils'
|
|
9
|
+
|
|
10
|
+
import type { $ToolParams } from '../../constants'
|
|
11
|
+
|
|
12
|
+
export const proposeUpdateFileResultSchema = z.union([
|
|
13
|
+
z.object({
|
|
14
|
+
file: z.string(),
|
|
15
|
+
message: z.string(),
|
|
16
|
+
unifiedDiff: z.string(),
|
|
17
|
+
}),
|
|
18
|
+
z.object({
|
|
19
|
+
file: z.string(),
|
|
20
|
+
errorMessage: z.string(),
|
|
21
|
+
}),
|
|
22
|
+
])
|
|
23
|
+
|
|
24
|
+
const toolName = 'propose_str_replace'
|
|
25
|
+
const endsAgentStep = false
|
|
26
|
+
const inputSchema = z
|
|
27
|
+
.object({
|
|
28
|
+
path: z
|
|
29
|
+
.string()
|
|
30
|
+
.min(1, 'Path cannot be empty')
|
|
31
|
+
.describe(`The path to the file to edit.`),
|
|
32
|
+
replacements: z
|
|
33
|
+
.preprocess(
|
|
34
|
+
coerceToArray,
|
|
35
|
+
z
|
|
36
|
+
.array(
|
|
37
|
+
z
|
|
38
|
+
.preprocess(
|
|
39
|
+
normalizeReplacementAliases,
|
|
40
|
+
z.object({
|
|
41
|
+
oldString: z
|
|
42
|
+
.string()
|
|
43
|
+
.min(1, 'oldString cannot be empty')
|
|
44
|
+
.describe(
|
|
45
|
+
`The string to replace. This must be an *exact match* of the string you want to replace, including whitespace and punctuation.`,
|
|
46
|
+
),
|
|
47
|
+
newString: z
|
|
48
|
+
.string()
|
|
49
|
+
.describe(
|
|
50
|
+
`The string to replace the corresponding oldString with. Can be empty to delete.`,
|
|
51
|
+
),
|
|
52
|
+
allowMultiple: z
|
|
53
|
+
.boolean()
|
|
54
|
+
.optional()
|
|
55
|
+
.default(false)
|
|
56
|
+
.describe(
|
|
57
|
+
'Whether to allow multiple replacements of oldString.',
|
|
58
|
+
),
|
|
59
|
+
}),
|
|
60
|
+
)
|
|
61
|
+
.describe('Pair of oldString and newString values.'),
|
|
62
|
+
)
|
|
63
|
+
.min(1, 'Replacements cannot be empty'),
|
|
64
|
+
)
|
|
65
|
+
.describe('Array of replacements to make.'),
|
|
66
|
+
})
|
|
67
|
+
.describe(
|
|
68
|
+
`Propose string replacements in a file without actually applying them.`,
|
|
69
|
+
)
|
|
70
|
+
const description = `
|
|
71
|
+
Propose edits to a file without actually applying them. Use this tool when you want to draft changes that will be reviewed before being applied.
|
|
72
|
+
|
|
73
|
+
This tool works identically to str_replace but the changes are not written to disk. Instead, it returns the unified diff of what would change. Multiple propose calls on the same file will stack correctly.
|
|
74
|
+
|
|
75
|
+
Example:
|
|
76
|
+
${$getNativeToolCallExampleString({
|
|
77
|
+
toolName,
|
|
78
|
+
inputSchema,
|
|
79
|
+
input: {
|
|
80
|
+
path: 'path/to/file',
|
|
81
|
+
replacements: [
|
|
82
|
+
{
|
|
83
|
+
oldString: 'This is the old string',
|
|
84
|
+
newString: 'This is the new string',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
oldString: '\nfoo:',
|
|
88
|
+
newString: '\nbar:',
|
|
89
|
+
allowMultiple: true,
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
endsAgentStep,
|
|
94
|
+
})}
|
|
95
|
+
`.trim()
|
|
96
|
+
|
|
97
|
+
export const proposeStrReplaceParams = {
|
|
98
|
+
toolName,
|
|
99
|
+
endsAgentStep,
|
|
100
|
+
description,
|
|
101
|
+
inputSchema,
|
|
102
|
+
outputSchema: jsonToolResultSchema(proposeUpdateFileResultSchema),
|
|
103
|
+
} satisfies $ToolParams
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import z from 'zod/v4'
|
|
2
|
+
|
|
3
|
+
import { proposeUpdateFileResultSchema } from './propose-str-replace'
|
|
4
|
+
import { $getNativeToolCallExampleString, jsonToolResultSchema } from '../utils'
|
|
5
|
+
|
|
6
|
+
import type { $ToolParams } from '../../constants'
|
|
7
|
+
|
|
8
|
+
const toolName = 'propose_write_file'
|
|
9
|
+
const endsAgentStep = false
|
|
10
|
+
const inputSchema = z
|
|
11
|
+
.object({
|
|
12
|
+
path: z
|
|
13
|
+
.string()
|
|
14
|
+
.min(1, 'Path cannot be empty')
|
|
15
|
+
.describe(`Path to the file relative to the **project root**`),
|
|
16
|
+
instructions: z
|
|
17
|
+
.string()
|
|
18
|
+
.describe('What the change is intended to do in only one sentence.'),
|
|
19
|
+
content: z.string().describe(`Complete file content to write to the file.`),
|
|
20
|
+
})
|
|
21
|
+
.describe(
|
|
22
|
+
`Propose creating or editing a file without actually applying the changes.`,
|
|
23
|
+
)
|
|
24
|
+
const description = `
|
|
25
|
+
Propose creating or editing a file without actually applying the changes.
|
|
26
|
+
|
|
27
|
+
This tool works identically to write_file but the changes are not written to disk. Instead, it returns the unified diff of what would change. Each call overwrites the previous call.
|
|
28
|
+
|
|
29
|
+
Format the \`content\` parameter with the entire content of the file.
|
|
30
|
+
|
|
31
|
+
This tool is to be used in subagents.
|
|
32
|
+
|
|
33
|
+
Example - Simple file creation:
|
|
34
|
+
${$getNativeToolCallExampleString({
|
|
35
|
+
toolName,
|
|
36
|
+
inputSchema,
|
|
37
|
+
input: {
|
|
38
|
+
path: 'new-file.ts',
|
|
39
|
+
instructions: 'Prints Hello, world',
|
|
40
|
+
content: 'console.log("Hello, world!");',
|
|
41
|
+
},
|
|
42
|
+
endsAgentStep,
|
|
43
|
+
})}
|
|
44
|
+
|
|
45
|
+
Example - Overwriting a file:
|
|
46
|
+
${$getNativeToolCallExampleString({
|
|
47
|
+
toolName,
|
|
48
|
+
inputSchema,
|
|
49
|
+
input: {
|
|
50
|
+
path: 'foo.ts',
|
|
51
|
+
instructions: 'Update foo function',
|
|
52
|
+
content: `function foo() {
|
|
53
|
+
doSomethingNew();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function bar() {
|
|
57
|
+
doSomethingOld();
|
|
58
|
+
}
|
|
59
|
+
`,
|
|
60
|
+
},
|
|
61
|
+
endsAgentStep,
|
|
62
|
+
})}
|
|
63
|
+
`.trim()
|
|
64
|
+
|
|
65
|
+
export const proposeWriteFileParams = {
|
|
66
|
+
toolName,
|
|
67
|
+
endsAgentStep,
|
|
68
|
+
description,
|
|
69
|
+
inputSchema,
|
|
70
|
+
outputSchema: jsonToolResultSchema(proposeUpdateFileResultSchema),
|
|
71
|
+
} satisfies $ToolParams
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import z from 'zod/v4'
|
|
2
|
+
|
|
3
|
+
import { $getNativeToolCallExampleString, jsonToolResultSchema } from '../utils'
|
|
4
|
+
|
|
5
|
+
import type { $ToolParams } from '../../constants'
|
|
6
|
+
|
|
7
|
+
const toolName = 'read_docs'
|
|
8
|
+
const endsAgentStep = true
|
|
9
|
+
const inputSchema = z
|
|
10
|
+
.object({
|
|
11
|
+
libraryTitle: z
|
|
12
|
+
.string()
|
|
13
|
+
.trim()
|
|
14
|
+
.min(1, 'Library title cannot be empty')
|
|
15
|
+
.describe(
|
|
16
|
+
`The library or framework name (e.g., "Next.js", "MongoDB", "React"). Use the official name as it appears in documentation if possible. Only public libraries available in Context7's database are supported, so small or private libraries may not be available.`,
|
|
17
|
+
),
|
|
18
|
+
topic: z
|
|
19
|
+
.string()
|
|
20
|
+
.trim()
|
|
21
|
+
.min(1, 'Topic cannot be empty')
|
|
22
|
+
.describe(
|
|
23
|
+
`Specific topic to focus on (e.g., "routing", "hooks", "authentication")`,
|
|
24
|
+
),
|
|
25
|
+
max_tokens: z
|
|
26
|
+
.number()
|
|
27
|
+
.int()
|
|
28
|
+
.positive()
|
|
29
|
+
.default(10_000)
|
|
30
|
+
.optional()
|
|
31
|
+
.describe(
|
|
32
|
+
`Optional maximum number of tokens to return. Defaults to 10000.`,
|
|
33
|
+
),
|
|
34
|
+
})
|
|
35
|
+
.describe(
|
|
36
|
+
`Fetch up-to-date documentation for libraries and frameworks using Context7 API.`,
|
|
37
|
+
)
|
|
38
|
+
const description = `
|
|
39
|
+
Purpose: Get current, accurate documentation for popular libraries, frameworks, and technologies. This tool searches Context7's database of up-to-date documentation and returns relevant content.
|
|
40
|
+
|
|
41
|
+
**IMPORTANT**: The \`libraryTitle\` parameter should be the exact, official name of the library or framework, not a search query. Think of it as looking up a specific book title in a library catalog.
|
|
42
|
+
|
|
43
|
+
Correct examples:
|
|
44
|
+
- "Next.js" (not "nextjs tutorial" or "how to use nextjs")
|
|
45
|
+
- "React" (not "react hooks guide")
|
|
46
|
+
- "MongoDB" (not "mongodb database setup")
|
|
47
|
+
- "Express.js" (not "express server")
|
|
48
|
+
|
|
49
|
+
Use cases:
|
|
50
|
+
- Getting current API documentation for a library
|
|
51
|
+
- Finding usage examples and best practices
|
|
52
|
+
- Understanding how to implement specific features
|
|
53
|
+
- Checking the latest syntax and methods
|
|
54
|
+
|
|
55
|
+
The tool will search for the library and return the most relevant documentation content. If a topic is specified, it will focus the results on that specific area.
|
|
56
|
+
|
|
57
|
+
Example:
|
|
58
|
+
${$getNativeToolCallExampleString({
|
|
59
|
+
toolName,
|
|
60
|
+
inputSchema,
|
|
61
|
+
input: {
|
|
62
|
+
libraryTitle: 'Next.js',
|
|
63
|
+
topic: 'app router',
|
|
64
|
+
max_tokens: 15000,
|
|
65
|
+
},
|
|
66
|
+
endsAgentStep,
|
|
67
|
+
})}
|
|
68
|
+
|
|
69
|
+
${$getNativeToolCallExampleString({
|
|
70
|
+
toolName,
|
|
71
|
+
inputSchema,
|
|
72
|
+
input: {
|
|
73
|
+
libraryTitle: 'MongoDB',
|
|
74
|
+
topic: 'database setup',
|
|
75
|
+
},
|
|
76
|
+
endsAgentStep,
|
|
77
|
+
})}
|
|
78
|
+
`.trim()
|
|
79
|
+
|
|
80
|
+
export const readDocsParams = {
|
|
81
|
+
toolName,
|
|
82
|
+
endsAgentStep,
|
|
83
|
+
description,
|
|
84
|
+
inputSchema,
|
|
85
|
+
outputSchema: jsonToolResultSchema(
|
|
86
|
+
z.object({
|
|
87
|
+
documentation: z.string(),
|
|
88
|
+
}),
|
|
89
|
+
),
|
|
90
|
+
} satisfies $ToolParams
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import z from 'zod/v4'
|
|
2
|
+
|
|
3
|
+
import { $getNativeToolCallExampleString, coerceToArray, jsonToolResultSchema } from '../utils'
|
|
4
|
+
|
|
5
|
+
import type { $ToolParams } from '../../constants'
|
|
6
|
+
|
|
7
|
+
export const fileContentsSchema = z.union([
|
|
8
|
+
z.object({
|
|
9
|
+
path: z.string(),
|
|
10
|
+
content: z.string(),
|
|
11
|
+
referencedBy: z.record(z.string(), z.string().array()).optional(),
|
|
12
|
+
}),
|
|
13
|
+
z.object({
|
|
14
|
+
path: z.string(),
|
|
15
|
+
contentOmittedForLength: z.literal(true),
|
|
16
|
+
}),
|
|
17
|
+
])
|
|
18
|
+
|
|
19
|
+
const toolName = 'read_files'
|
|
20
|
+
const endsAgentStep = true
|
|
21
|
+
|
|
22
|
+
const pathEntrySchema = z
|
|
23
|
+
.string()
|
|
24
|
+
.min(1, 'Paths cannot be empty')
|
|
25
|
+
.describe(
|
|
26
|
+
`File path to read. Prefer paths relative to the **project root**; absolute paths inside the project are accepted, but paths outside the project will not work.`,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
const windowedEntrySchema = z.union([
|
|
30
|
+
pathEntrySchema,
|
|
31
|
+
z.object({
|
|
32
|
+
path: z.string().min(1, 'Paths cannot be empty'),
|
|
33
|
+
offset: z
|
|
34
|
+
.number()
|
|
35
|
+
.int()
|
|
36
|
+
.min(1)
|
|
37
|
+
.optional()
|
|
38
|
+
.describe('Line number to start reading from (1-indexed).'),
|
|
39
|
+
limit: z
|
|
40
|
+
.number()
|
|
41
|
+
.int()
|
|
42
|
+
.positive()
|
|
43
|
+
.optional()
|
|
44
|
+
.describe('Maximum number of lines to read (defaults to 2,000).'),
|
|
45
|
+
}),
|
|
46
|
+
])
|
|
47
|
+
|
|
48
|
+
const legacyInputSchema = z
|
|
49
|
+
.object({
|
|
50
|
+
paths: z
|
|
51
|
+
.preprocess(coerceToArray, z.array(pathEntrySchema))
|
|
52
|
+
.describe('List of file paths to read.'),
|
|
53
|
+
})
|
|
54
|
+
.describe(
|
|
55
|
+
`Read multiple files from disk. Returned file content shares a 20,000 estimated-token limit and a 100,000-character hard limit. Prefer the smallest relevant set of files and use code_search for targeted discovery.`,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
const windowedInputSchema = z
|
|
59
|
+
.object({
|
|
60
|
+
paths: z
|
|
61
|
+
.preprocess(coerceToArray, z.array(windowedEntrySchema))
|
|
62
|
+
.describe(
|
|
63
|
+
'List of files to read. Each entry is either a file path, or an object { path, offset, limit } to read a specific line range of that file.',
|
|
64
|
+
),
|
|
65
|
+
})
|
|
66
|
+
.describe(
|
|
67
|
+
`Read files from disk. List several paths to read several files in one call. Large files are cut off after 2,000 lines, with a note telling you the file's total line count. Don't read a large file whole: use code_search to locate the part you need (matches come with line numbers), then read a window around it with { path, offset, limit }. Avoid tiny repeated slices; when in doubt, take a window of a few hundred lines.`,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
const description = `
|
|
71
|
+
Example:
|
|
72
|
+
${$getNativeToolCallExampleString({
|
|
73
|
+
toolName,
|
|
74
|
+
inputSchema: legacyInputSchema,
|
|
75
|
+
input: {
|
|
76
|
+
paths: ['path/to/file1.ts', 'path/to/file2.ts'],
|
|
77
|
+
},
|
|
78
|
+
endsAgentStep,
|
|
79
|
+
})}
|
|
80
|
+
`.trim()
|
|
81
|
+
|
|
82
|
+
export const readFilesDisplayVariants = {
|
|
83
|
+
legacy: { description, inputSchema: legacyInputSchema },
|
|
84
|
+
windowed: { description, inputSchema: windowedInputSchema },
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function readFilePathsOf(paths: unknown): string[] {
|
|
88
|
+
if (!Array.isArray(paths)) return []
|
|
89
|
+
const result: string[] = []
|
|
90
|
+
for (const entry of paths) {
|
|
91
|
+
const path =
|
|
92
|
+
typeof entry === 'string'
|
|
93
|
+
? entry
|
|
94
|
+
: entry && typeof entry === 'object' && typeof entry.path === 'string'
|
|
95
|
+
? entry.path
|
|
96
|
+
: undefined
|
|
97
|
+
const trimmed = path?.trim()
|
|
98
|
+
if (trimmed) result.push(trimmed)
|
|
99
|
+
}
|
|
100
|
+
return result
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export const readFilesParams = {
|
|
104
|
+
toolName,
|
|
105
|
+
endsAgentStep,
|
|
106
|
+
description,
|
|
107
|
+
inputSchema: windowedInputSchema,
|
|
108
|
+
outputSchema: jsonToolResultSchema(fileContentsSchema.array()),
|
|
109
|
+
} satisfies $ToolParams
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import z from 'zod/v4'
|
|
2
|
+
|
|
3
|
+
import { $getNativeToolCallExampleString, coerceToArray, jsonToolResultSchema } from '../utils'
|
|
4
|
+
|
|
5
|
+
import type { $ToolParams } from '../../constants'
|
|
6
|
+
|
|
7
|
+
const toolName = 'read_subtree'
|
|
8
|
+
const endsAgentStep = true
|
|
9
|
+
const inputSchema = z
|
|
10
|
+
.object({
|
|
11
|
+
paths: z
|
|
12
|
+
.preprocess(coerceToArray, z.array(z.string()))
|
|
13
|
+
.optional()
|
|
14
|
+
.describe(
|
|
15
|
+
`List of paths to directories or files. Relative to the project root. If omitted, the entire project tree is used.`,
|
|
16
|
+
),
|
|
17
|
+
maxTokens: z
|
|
18
|
+
.number()
|
|
19
|
+
.int()
|
|
20
|
+
.positive()
|
|
21
|
+
.default(4000)
|
|
22
|
+
.describe(
|
|
23
|
+
`Maximum token budget for the subtree blob; the tree will be truncated to fit within this budget by first dropping file variables and then removing the most-nested files and directories.`,
|
|
24
|
+
),
|
|
25
|
+
})
|
|
26
|
+
.describe(
|
|
27
|
+
`Read one or more directory subtrees (as a blob including subdirectories, file names, and parsed variables within each source file) or return parsed variable names for files. If no paths are provided, returns the entire project tree.`,
|
|
28
|
+
)
|
|
29
|
+
const description = `
|
|
30
|
+
Example:
|
|
31
|
+
${$getNativeToolCallExampleString({
|
|
32
|
+
toolName,
|
|
33
|
+
inputSchema,
|
|
34
|
+
input: {
|
|
35
|
+
paths: ['src', 'package.json'],
|
|
36
|
+
maxTokens: 4000,
|
|
37
|
+
},
|
|
38
|
+
endsAgentStep,
|
|
39
|
+
})}
|
|
40
|
+
|
|
41
|
+
Purpose: Read a directory subtree and return a blob containing subdirectories, file names, and parsed variable/functions names from source files. For files, return only the parsed variable names. If no paths are provided, returns the entire project tree. The output is truncated to fit within the provided token budget.
|
|
42
|
+
|
|
43
|
+
- Use this tool on particular subdirectories when you need to know all the nested files and directories. E.g. for a refactoring task, or to understand a particular part of the codebase.
|
|
44
|
+
- In normal use, don't set maxTokens beyond 10,000.
|
|
45
|
+
`.trim()
|
|
46
|
+
|
|
47
|
+
export const readSubtreeParams = {
|
|
48
|
+
toolName,
|
|
49
|
+
endsAgentStep,
|
|
50
|
+
description,
|
|
51
|
+
inputSchema,
|
|
52
|
+
outputSchema: jsonToolResultSchema(
|
|
53
|
+
z.array(
|
|
54
|
+
z.union([
|
|
55
|
+
z.object({
|
|
56
|
+
path: z.string(),
|
|
57
|
+
type: z.literal('directory'),
|
|
58
|
+
printedTree: z.string(),
|
|
59
|
+
tokenCount: z.number(),
|
|
60
|
+
truncationLevel: z.enum([
|
|
61
|
+
'none',
|
|
62
|
+
'unimportant-files',
|
|
63
|
+
'tokens',
|
|
64
|
+
'depth-based',
|
|
65
|
+
]),
|
|
66
|
+
}),
|
|
67
|
+
z.object({
|
|
68
|
+
path: z.string(),
|
|
69
|
+
type: z.literal('file'),
|
|
70
|
+
variables: z.array(z.string()),
|
|
71
|
+
}),
|
|
72
|
+
z.object({
|
|
73
|
+
path: z.string(),
|
|
74
|
+
errorMessage: z.string(),
|
|
75
|
+
}),
|
|
76
|
+
]),
|
|
77
|
+
),
|
|
78
|
+
),
|
|
79
|
+
} satisfies $ToolParams
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import z from 'zod/v4'
|
|
2
|
+
|
|
3
|
+
import { $getNativeToolCallExampleString, jsonToolResultSchema } from '../utils'
|
|
4
|
+
|
|
5
|
+
import type { $ToolParams } from '../../constants'
|
|
6
|
+
|
|
7
|
+
const toolName = 'read_url'
|
|
8
|
+
const endsAgentStep = true
|
|
9
|
+
const inputSchema = z
|
|
10
|
+
.object({
|
|
11
|
+
url: z
|
|
12
|
+
.url()
|
|
13
|
+
.refine((value) => {
|
|
14
|
+
try {
|
|
15
|
+
const parsedUrl = new URL(value)
|
|
16
|
+
return (
|
|
17
|
+
parsedUrl.protocol === 'http:' || parsedUrl.protocol === 'https:'
|
|
18
|
+
)
|
|
19
|
+
} catch {
|
|
20
|
+
return false
|
|
21
|
+
}
|
|
22
|
+
}, 'URL must use http:// or https://')
|
|
23
|
+
.describe(
|
|
24
|
+
'The full http:// or https:// URL to fetch and extract readable text from.',
|
|
25
|
+
),
|
|
26
|
+
max_chars: z
|
|
27
|
+
.number()
|
|
28
|
+
.int()
|
|
29
|
+
.min(1_000)
|
|
30
|
+
.max(50_000)
|
|
31
|
+
.default(20_000)
|
|
32
|
+
.optional()
|
|
33
|
+
.describe(
|
|
34
|
+
'Maximum number of extracted text characters to return. Defaults to 20000.',
|
|
35
|
+
),
|
|
36
|
+
})
|
|
37
|
+
.describe('Fetch a URL and extract readable text from the page.')
|
|
38
|
+
|
|
39
|
+
const description = `
|
|
40
|
+
Purpose: Fetch a URL returned by web_search and extract the readable page text so you can answer with source-backed evidence.
|
|
41
|
+
|
|
42
|
+
Use this after web_search when snippets are not enough. Prefer authoritative, relevant pages from the search results. The tool follows redirects, extracts titles and metadata, strips scripts/styles/navigation boilerplate from HTML, and returns normalized readable text.
|
|
43
|
+
|
|
44
|
+
Do not use run_terminal_command with curl just to inspect web pages; use read_url instead. If read_url reports unsupported content or extraction failure, then choose a different search result or explain the limitation.
|
|
45
|
+
|
|
46
|
+
Example:
|
|
47
|
+
${$getNativeToolCallExampleString({
|
|
48
|
+
toolName,
|
|
49
|
+
inputSchema,
|
|
50
|
+
input: {
|
|
51
|
+
url: 'https://react.dev/reference/react/useActionState',
|
|
52
|
+
max_chars: 12000,
|
|
53
|
+
},
|
|
54
|
+
endsAgentStep,
|
|
55
|
+
})}
|
|
56
|
+
`.trim()
|
|
57
|
+
|
|
58
|
+
export const readUrlParams = {
|
|
59
|
+
toolName,
|
|
60
|
+
endsAgentStep,
|
|
61
|
+
description,
|
|
62
|
+
inputSchema,
|
|
63
|
+
outputSchema: jsonToolResultSchema(
|
|
64
|
+
z.union([
|
|
65
|
+
z.object({
|
|
66
|
+
url: z.string(),
|
|
67
|
+
finalUrl: z.string(),
|
|
68
|
+
status: z.number(),
|
|
69
|
+
contentType: z.string().optional(),
|
|
70
|
+
title: z.string().optional(),
|
|
71
|
+
description: z.string().optional(),
|
|
72
|
+
text: z.string(),
|
|
73
|
+
truncated: z.boolean(),
|
|
74
|
+
}),
|
|
75
|
+
z.object({
|
|
76
|
+
url: z.string().optional(),
|
|
77
|
+
errorMessage: z.string(),
|
|
78
|
+
}),
|
|
79
|
+
]),
|
|
80
|
+
),
|
|
81
|
+
} satisfies $ToolParams
|