@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,294 @@
|
|
|
1
|
+
# Custom Agents
|
|
2
|
+
|
|
3
|
+
Create specialized agent workflows that coordinate multiple AI agents to tackle complex engineering tasks. Instead of a single agent trying to handle everything, you can orchestrate teams of focused specialists that work together.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
1. **Edit an existing agent**: Start with `my-custom-agent.ts` and modify it for your needs
|
|
8
|
+
2. **Test your agent**: Run `anvil` without `--agent` so local `.agents` load, then invoke your agent from a prompt
|
|
9
|
+
3. **Publish your agent**: Run `anvil publish your-agent-name`
|
|
10
|
+
|
|
11
|
+
## Need Help?
|
|
12
|
+
|
|
13
|
+
- For examples, check the `examples/` directory.
|
|
14
|
+
- Join our [Discord community](https://codebuff.com/discord) and ask your questions!
|
|
15
|
+
- Check our [documentation](https://codebuff.com/docs) for more details
|
|
16
|
+
|
|
17
|
+
# What is Anvil?
|
|
18
|
+
|
|
19
|
+
Anvil is an **open-source AI coding assistant** that edits your codebase through natural language instructions. Instead of using one model for everything, it coordinates specialized agents that work together to understand your project and make precise changes.
|
|
20
|
+
|
|
21
|
+
Anvil beats Claude Code at 61% vs 53% on [our evals](https://github.com/CodebuffAI/anvil/tree/main/evals) across 175+ coding tasks over multiple open-source repos that simulate real-world tasks.
|
|
22
|
+
|
|
23
|
+
## How Anvil Works
|
|
24
|
+
|
|
25
|
+
When you ask Anvil to "add authentication to my API," it might invoke:
|
|
26
|
+
|
|
27
|
+
1. A **File Explorer Agent** to scan your codebase to understand the architecture and find relevant files
|
|
28
|
+
2. A **Planner Agent** to plan which files need changes and in what order
|
|
29
|
+
3. An **Editor Agent** to make precise edits
|
|
30
|
+
4. A **Reviewer Agent** to validate changes
|
|
31
|
+
|
|
32
|
+
This multi-agent approach gives you better context understanding, more accurate edits, and fewer errors compared to single-model tools.
|
|
33
|
+
|
|
34
|
+
## Context Window Management
|
|
35
|
+
|
|
36
|
+
### Why Agent Workflows?
|
|
37
|
+
|
|
38
|
+
Modern software projects are complex ecosystems with thousands of files, multiple frameworks, intricate dependencies, and domain-specific requirements. A single AI agent trying to understand and modify such systems faces fundamental limitations—not just in knowledge, but in the sheer volume of information it can process at once.
|
|
39
|
+
|
|
40
|
+
### The Solution: Focused Context Windows
|
|
41
|
+
|
|
42
|
+
Agent workflows elegantly solve this by breaking large tasks into focused sub-problems. When working with large codebases (100k+ lines), each specialist agent receives only the narrow context it needs—a security agent sees only auth code, not UI components—keeping the context for each agent manageable while ensuring comprehensive coverage.
|
|
43
|
+
|
|
44
|
+
### Why Not Just Mimic Human Roles?
|
|
45
|
+
|
|
46
|
+
This is about efficient AI context management, not recreating a human department. Simply creating a "frontend-developer" agent misses the point. AI agents don't have human constraints like context-switching or meetings. Their power comes from hyper-specialization, allowing them to process a narrow domain more deeply than a human could, then coordinating seamlessly with other specialists.
|
|
47
|
+
|
|
48
|
+
## Agent workflows in action
|
|
49
|
+
|
|
50
|
+
Here's an example of a `git-committer` agent that creates good commit messages:
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
export default {
|
|
54
|
+
id: 'git-committer',
|
|
55
|
+
displayName: 'Git Committer',
|
|
56
|
+
model: 'openai/gpt-5-nano',
|
|
57
|
+
toolNames: ['read_files', 'run_terminal_command', 'end_turn'],
|
|
58
|
+
|
|
59
|
+
instructionsPrompt:
|
|
60
|
+
'You create meaningful git commits by analyzing changes, reading relevant files for context, and crafting clear commit messages that explain the "why" behind changes.',
|
|
61
|
+
|
|
62
|
+
async *handleSteps() {
|
|
63
|
+
// Analyze what changed
|
|
64
|
+
yield { tool: 'run_terminal_command', command: 'git diff' }
|
|
65
|
+
yield { tool: 'run_terminal_command', command: 'git log --oneline -5' }
|
|
66
|
+
|
|
67
|
+
// Stage files and create commit with good message
|
|
68
|
+
yield 'STEP_ALL'
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
This agent systematically analyzes changes, reads relevant files for context, then creates commits with clear, meaningful messages that explain the "why" behind changes.
|
|
74
|
+
|
|
75
|
+
# Agent Development Guide
|
|
76
|
+
|
|
77
|
+
This guide covers everything you need to know about building custom Anvil agents.
|
|
78
|
+
|
|
79
|
+
## Agent Structure
|
|
80
|
+
|
|
81
|
+
Each agent is a TypeScript file that exports an `AgentDefinition` object:
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
export default {
|
|
85
|
+
id: 'my-agent', // Unique identifier (lowercase, hyphens only)
|
|
86
|
+
displayName: 'My Agent', // Human-readable name
|
|
87
|
+
model: 'claude-3-5-sonnet', // AI model to use
|
|
88
|
+
toolNames: ['read_files', 'write_file'], // Available tools
|
|
89
|
+
instructionsPrompt: 'You are...', // Agent behavior instructions
|
|
90
|
+
spawnerPrompt: 'Use this agent when...', // When others should spawn this
|
|
91
|
+
spawnableAgents: ['helper-agent'], // Agents this can spawn
|
|
92
|
+
|
|
93
|
+
// Optional: Programmatic control
|
|
94
|
+
async *handleSteps() {
|
|
95
|
+
yield { tool: 'read_files', paths: ['src/config.ts'] }
|
|
96
|
+
yield 'STEP' // Let AI process and respond
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Core Properties
|
|
102
|
+
|
|
103
|
+
### Required Fields
|
|
104
|
+
|
|
105
|
+
- **`id`**: Unique identifier using lowercase letters and hyphens only
|
|
106
|
+
- **`displayName`**: Human-readable name shown in UI
|
|
107
|
+
- **`model`**: AI model from OpenRouter (see [available models](https://openrouter.ai/models))
|
|
108
|
+
- **`instructionsPrompt`**: Detailed instructions defining the agent's role and behavior
|
|
109
|
+
|
|
110
|
+
### Optional Fields
|
|
111
|
+
|
|
112
|
+
- **`toolNames`**: Array of tools the agent can use (defaults to common tools)
|
|
113
|
+
- **`spawnerPrompt`**: Instructions for when other agents should spawn this one
|
|
114
|
+
- **`spawnableAgents`**: Array of agent names this agent can spawn
|
|
115
|
+
- **`handleSteps`**: Generator function for programmatic control
|
|
116
|
+
|
|
117
|
+
## Available Tools
|
|
118
|
+
|
|
119
|
+
### File Operations
|
|
120
|
+
|
|
121
|
+
- **`read_files`**: Read file contents
|
|
122
|
+
- **`write_file`**: Create or modify entire files
|
|
123
|
+
- **`str_replace`**: Make targeted string replacements
|
|
124
|
+
- **`code_search`**: Search for patterns across the codebase
|
|
125
|
+
|
|
126
|
+
### Execution
|
|
127
|
+
|
|
128
|
+
- **`run_terminal_command`**: Execute shell commands
|
|
129
|
+
- **`spawn_agents`**: Delegate tasks to other agents
|
|
130
|
+
- **`end_turn`**: Finish the agent's response
|
|
131
|
+
|
|
132
|
+
### Web & Research
|
|
133
|
+
|
|
134
|
+
- **`web_search`**: Search the internet for information
|
|
135
|
+
- **`read_url`**: Fetch a URL and extract readable page text
|
|
136
|
+
- **`read_docs`**: Read technical documentation
|
|
137
|
+
- **`browser_logs`**: Navigate and inspect web pages
|
|
138
|
+
|
|
139
|
+
See `types/tools.ts` for detailed parameter information.
|
|
140
|
+
|
|
141
|
+
## Programmatic Control
|
|
142
|
+
|
|
143
|
+
Use the `handleSteps` generator function to mix AI reasoning with programmatic logic:
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
async *handleSteps() {
|
|
147
|
+
// Execute a tool
|
|
148
|
+
yield { tool: 'read_files', paths: ['package.json'] }
|
|
149
|
+
|
|
150
|
+
// Let AI process results and respond
|
|
151
|
+
yield 'STEP'
|
|
152
|
+
|
|
153
|
+
// Conditional logic
|
|
154
|
+
if (needsMoreAnalysis) {
|
|
155
|
+
yield { tool: 'spawn_agents', agents: ['deep-analyzer'] }
|
|
156
|
+
yield 'STEP_ALL' // Wait for spawned agents to complete
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Final AI response
|
|
160
|
+
yield 'STEP'
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Control Commands
|
|
165
|
+
|
|
166
|
+
- **`'STEP'`**: Let AI process and respond once
|
|
167
|
+
- **`'STEP_ALL'`**: Let AI continue until completion
|
|
168
|
+
- **Tool calls**: `{ tool: 'tool_name', ...params }`
|
|
169
|
+
|
|
170
|
+
## Model Selection
|
|
171
|
+
|
|
172
|
+
Choose models based on your agent's needs:
|
|
173
|
+
|
|
174
|
+
- **`anthropic/claude-opus-4.7`**: Best general-purpose capabilities and code generation
|
|
175
|
+
- **`openai/gpt-5.2`**: Best at complex reasoning and planning
|
|
176
|
+
- **`google/gemini-3.1-flash-lite`**: Fast and cost-effective for simple or medium-complexity tasks
|
|
177
|
+
|
|
178
|
+
**Any model on OpenRouter**: Unlike Claude Code which locks you into Anthropic's models, Anvil supports any model available on [OpenRouter](https://openrouter.ai/models) - from Claude and GPT to specialized models like Qwen, DeepSeek, and others. Switch models for different tasks or use the latest releases without waiting for platform updates.
|
|
179
|
+
|
|
180
|
+
See [OpenRouter](https://openrouter.ai/models) for all available models and pricing.
|
|
181
|
+
|
|
182
|
+
## Agent Coordination
|
|
183
|
+
|
|
184
|
+
Agents can spawn other agents to create sophisticated workflows:
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
// Parent agent spawns specialists
|
|
188
|
+
async *handleSteps() {
|
|
189
|
+
yield { tool: 'spawn_agents', agents: [
|
|
190
|
+
'security-scanner',
|
|
191
|
+
'performance-analyzer',
|
|
192
|
+
'code-reviewer'
|
|
193
|
+
]}
|
|
194
|
+
yield 'STEP_ALL' // Wait for all to complete
|
|
195
|
+
|
|
196
|
+
// Synthesize results
|
|
197
|
+
yield 'STEP'
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Reuse any published agent**: Compose existing [published agents](https://www.codebuff.com/store) to get a leg up. Anvil agents are the new MCP!
|
|
202
|
+
|
|
203
|
+
## Best Practices
|
|
204
|
+
|
|
205
|
+
### Instructions
|
|
206
|
+
|
|
207
|
+
- Be specific about the agent's role and expertise
|
|
208
|
+
- Include examples of good outputs
|
|
209
|
+
- Specify when the agent should ask for clarification
|
|
210
|
+
- Define the agent's limitations
|
|
211
|
+
|
|
212
|
+
### Tool Usage
|
|
213
|
+
|
|
214
|
+
- Start with file exploration tools (`read_files`, `code_search`)
|
|
215
|
+
- Use `str_replace` for targeted edits, `write_file` for major changes
|
|
216
|
+
- Always use `end_turn` to finish responses cleanly
|
|
217
|
+
|
|
218
|
+
### Error Handling
|
|
219
|
+
|
|
220
|
+
- Include error checking in programmatic flows
|
|
221
|
+
- Provide fallback strategies for failed operations
|
|
222
|
+
- Log important decisions for debugging
|
|
223
|
+
|
|
224
|
+
### Performance
|
|
225
|
+
|
|
226
|
+
- Choose appropriate models for the task complexity
|
|
227
|
+
- Minimize unnecessary tool calls
|
|
228
|
+
- Use spawnable agents for parallel processing
|
|
229
|
+
|
|
230
|
+
## Testing Your Agent
|
|
231
|
+
|
|
232
|
+
1. **Local Testing**: Run `anvil` without `--agent` so local `.agents` load, then invoke your agent from a prompt
|
|
233
|
+
2. **Debug Mode**: Add logging to your `handleSteps` function
|
|
234
|
+
3. **Unit Testing**: Test individual functions in isolation
|
|
235
|
+
4. **Integration Testing**: Test agent coordination workflows
|
|
236
|
+
|
|
237
|
+
## Publishing & Sharing
|
|
238
|
+
|
|
239
|
+
1. **Validate**: Ensure your agent works across different codebases
|
|
240
|
+
2. **Document**: Include clear usage instructions
|
|
241
|
+
3. **Publish**: `anvil publish your-agent-name`
|
|
242
|
+
4. **Maintain**: Update as models and tools evolve
|
|
243
|
+
|
|
244
|
+
## Advanced Patterns
|
|
245
|
+
|
|
246
|
+
### Conditional Workflows
|
|
247
|
+
|
|
248
|
+
```typescript
|
|
249
|
+
async *handleSteps() {
|
|
250
|
+
const config = yield { tool: 'read_files', paths: ['config.json'] }
|
|
251
|
+
yield 'STEP'
|
|
252
|
+
|
|
253
|
+
if (config.includes('typescript')) {
|
|
254
|
+
yield { tool: 'spawn_agents', agents: ['typescript-expert'] }
|
|
255
|
+
} else {
|
|
256
|
+
yield { tool: 'spawn_agents', agents: ['javascript-expert'] }
|
|
257
|
+
}
|
|
258
|
+
yield 'STEP_ALL'
|
|
259
|
+
}
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Iterative Refinement
|
|
263
|
+
|
|
264
|
+
```typescript
|
|
265
|
+
async *handleSteps() {
|
|
266
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
267
|
+
yield { tool: 'run_terminal_command', command: 'npm test' }
|
|
268
|
+
yield 'STEP'
|
|
269
|
+
|
|
270
|
+
if (allTestsPass) break
|
|
271
|
+
|
|
272
|
+
yield { tool: 'spawn_agents', agents: ['test-fixer'] }
|
|
273
|
+
yield 'STEP_ALL'
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Why Choose Anvil for Custom Agents
|
|
279
|
+
|
|
280
|
+
**Deep customizability**: Create sophisticated agent workflows with TypeScript generators that mix AI generation with programmatic control. Define custom agents that spawn subagents, implement conditional logic, and orchestrate complex multi-step processes that adapt to your specific use cases.
|
|
281
|
+
|
|
282
|
+
**Fully customizable SDK**: Build Anvil's capabilities directly into your applications with a complete TypeScript SDK. Create custom tools, integrate with your CI/CD pipeline, build AI-powered development environments, or embed intelligent coding assistance into your products.
|
|
283
|
+
|
|
284
|
+
Learn more about the SDK [here](https://www.npmjs.com/package/@anvil/sdk).
|
|
285
|
+
|
|
286
|
+
## Community & Support
|
|
287
|
+
|
|
288
|
+
- **Discord**: [Join our community](https://codebuff.com/discord) for help and inspiration
|
|
289
|
+
- **Examples**: Study the `examples/` directory for patterns
|
|
290
|
+
- **Documentation**: [codebuff.com/docs](https://codebuff.com/docs) and check `types/` for detailed type information
|
|
291
|
+
- **Issues**: [Report bugs and request features on GitHub](https://github.com/CodebuffAI/anvil/issues)
|
|
292
|
+
- **Support**: [support@codebuff.com](mailto:support@codebuff.com)
|
|
293
|
+
|
|
294
|
+
Happy agent building! 🤖
|
package/vendor/@anvil/common/src/templates/initial-agents-dir/examples/01-basic-diff-reviewer.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AgentDefinition } from '../types/agent-definition'
|
|
2
|
+
|
|
3
|
+
const definition: AgentDefinition = {
|
|
4
|
+
id: 'basic-diff-reviewer',
|
|
5
|
+
displayName: 'Basic Diff Reviewer',
|
|
6
|
+
model: 'anthropic/claude-4-sonnet-20250522',
|
|
7
|
+
toolNames: ['read_files', 'run_terminal_command'],
|
|
8
|
+
|
|
9
|
+
spawnerPrompt: 'Spawn when you need to review code changes in the git diff',
|
|
10
|
+
|
|
11
|
+
instructionsPrompt: `Execute the following steps:
|
|
12
|
+
1. Run git diff
|
|
13
|
+
2. Read the files that have changed
|
|
14
|
+
3. Review the changes and suggest improvements`,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default definition
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AgentDefinition,
|
|
3
|
+
AgentStepContext,
|
|
4
|
+
ToolCall,
|
|
5
|
+
} from '../types/agent-definition'
|
|
6
|
+
|
|
7
|
+
const definition: AgentDefinition = {
|
|
8
|
+
id: 'git-committer',
|
|
9
|
+
displayName: 'Intermediate Git Committer',
|
|
10
|
+
model: 'anthropic/claude-4-sonnet-20250522',
|
|
11
|
+
toolNames: ['read_files', 'run_terminal_command', 'add_message', 'end_turn'],
|
|
12
|
+
|
|
13
|
+
inputSchema: {
|
|
14
|
+
prompt: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'What changes to commit',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
spawnerPrompt:
|
|
21
|
+
'Spawn when you need to commit code changes to git with an appropriate commit message',
|
|
22
|
+
|
|
23
|
+
systemPrompt:
|
|
24
|
+
'You are an expert software developer. Your job is to create a git commit with a really good commit message.',
|
|
25
|
+
|
|
26
|
+
instructionsPrompt:
|
|
27
|
+
'Follow the steps to create a good commit: analyze changes with git diff and git log, read relevant files for context, stage appropriate files, analyze changes, and create a commit with proper formatting.',
|
|
28
|
+
|
|
29
|
+
handleSteps: function* ({ agentState, prompt, params }: AgentStepContext) {
|
|
30
|
+
// Step 1: Run git diff and git log to analyze changes.
|
|
31
|
+
yield {
|
|
32
|
+
toolName: 'run_terminal_command',
|
|
33
|
+
input: {
|
|
34
|
+
command: 'git diff',
|
|
35
|
+
process_type: 'SYNC',
|
|
36
|
+
timeout_seconds: 30,
|
|
37
|
+
},
|
|
38
|
+
} satisfies ToolCall
|
|
39
|
+
|
|
40
|
+
yield {
|
|
41
|
+
toolName: 'run_terminal_command',
|
|
42
|
+
input: {
|
|
43
|
+
command: 'git log --oneline -10',
|
|
44
|
+
process_type: 'SYNC',
|
|
45
|
+
timeout_seconds: 30,
|
|
46
|
+
},
|
|
47
|
+
} satisfies ToolCall
|
|
48
|
+
|
|
49
|
+
// Step 2: Put words in AI's mouth so it will read files next.
|
|
50
|
+
yield {
|
|
51
|
+
toolName: 'add_message',
|
|
52
|
+
input: {
|
|
53
|
+
role: 'assistant',
|
|
54
|
+
content:
|
|
55
|
+
"I've analyzed the git diff and recent commit history. Now I'll read any relevant files to better understand the context of these changes.",
|
|
56
|
+
},
|
|
57
|
+
includeToolCall: false,
|
|
58
|
+
} satisfies ToolCall
|
|
59
|
+
|
|
60
|
+
// Step 3: Let AI generate a step to decide which files to read.
|
|
61
|
+
yield 'STEP'
|
|
62
|
+
|
|
63
|
+
// Step 4: Put words in AI's mouth to analyze the changes and create a commit.
|
|
64
|
+
yield {
|
|
65
|
+
toolName: 'add_message',
|
|
66
|
+
input: {
|
|
67
|
+
role: 'assistant',
|
|
68
|
+
content:
|
|
69
|
+
"Now I'll analyze the changes and create a commit with a good commit message.",
|
|
70
|
+
},
|
|
71
|
+
includeToolCall: false,
|
|
72
|
+
} satisfies ToolCall
|
|
73
|
+
|
|
74
|
+
yield 'STEP_ALL'
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default definition
|
package/vendor/@anvil/common/src/templates/initial-agents-dir/examples/03-advanced-file-explorer.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { AgentDefinition, ToolCall } from '../types/agent-definition'
|
|
2
|
+
|
|
3
|
+
const definition: AgentDefinition = {
|
|
4
|
+
id: 'advanced-file-explorer',
|
|
5
|
+
displayName: 'Dora the File Explorer',
|
|
6
|
+
model: 'openai/gpt-5.1',
|
|
7
|
+
|
|
8
|
+
spawnerPrompt:
|
|
9
|
+
'Spawns multiple file picker agents in parallel to comprehensively explore the codebase from different perspectives',
|
|
10
|
+
|
|
11
|
+
includeMessageHistory: false,
|
|
12
|
+
toolNames: ['spawn_agents', 'set_output'],
|
|
13
|
+
spawnableAgents: [`anvil/file-picker@0.0.1`],
|
|
14
|
+
|
|
15
|
+
inputSchema: {
|
|
16
|
+
prompt: {
|
|
17
|
+
description: 'What you need to accomplish by exploring the codebase',
|
|
18
|
+
type: 'string',
|
|
19
|
+
},
|
|
20
|
+
params: {
|
|
21
|
+
type: 'object',
|
|
22
|
+
properties: {
|
|
23
|
+
prompts: {
|
|
24
|
+
description:
|
|
25
|
+
'List of 1-4 different parts of the codebase that could be useful to explore',
|
|
26
|
+
type: 'array',
|
|
27
|
+
items: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
required: ['prompts'],
|
|
33
|
+
additionalProperties: false,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
outputMode: 'structured_output',
|
|
37
|
+
outputSchema: {
|
|
38
|
+
type: 'object',
|
|
39
|
+
properties: {
|
|
40
|
+
results: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'The results of the file exploration',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
required: ['results'],
|
|
46
|
+
additionalProperties: false,
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
handleSteps: function* ({ prompt, params }) {
|
|
50
|
+
const prompts: string[] = params?.prompts ?? []
|
|
51
|
+
const filePickerPrompts = prompts.map(
|
|
52
|
+
(focusPrompt) =>
|
|
53
|
+
`Based on the overall goal "${prompt}", find files related to this specific area: ${focusPrompt}`,
|
|
54
|
+
),
|
|
55
|
+
{ toolResult: spawnResult } = yield {
|
|
56
|
+
toolName: 'spawn_agents',
|
|
57
|
+
input: {
|
|
58
|
+
agents: filePickerPrompts.map((promptText) => ({
|
|
59
|
+
agent_type: 'anvil/file-picker@0.0.1',
|
|
60
|
+
prompt: promptText,
|
|
61
|
+
})),
|
|
62
|
+
},
|
|
63
|
+
} satisfies ToolCall
|
|
64
|
+
yield {
|
|
65
|
+
toolName: 'set_output',
|
|
66
|
+
input: {
|
|
67
|
+
results: spawnResult,
|
|
68
|
+
},
|
|
69
|
+
} satisfies ToolCall
|
|
70
|
+
},
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export default definition
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* EDIT ME to create your own agent!
|
|
3
|
+
*
|
|
4
|
+
* Run your agent with:
|
|
5
|
+
* > anvil
|
|
6
|
+
* Inside anvil:
|
|
7
|
+
* > @my-custom-agent please review my recent changes
|
|
8
|
+
*
|
|
9
|
+
* Finally, you can publish your agent with:
|
|
10
|
+
* > anvil publish my-custom-agent
|
|
11
|
+
* Then users from around the world can run it!
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type { AgentDefinition } from './types/agent-definition'
|
|
15
|
+
|
|
16
|
+
const definition: AgentDefinition = {
|
|
17
|
+
id: 'my-custom-agent',
|
|
18
|
+
displayName: 'My Custom Agent',
|
|
19
|
+
|
|
20
|
+
model: 'anthropic/claude-haiku-4.5',
|
|
21
|
+
spawnableAgents: ['anvil/file-explorer@0.0.6'],
|
|
22
|
+
|
|
23
|
+
// Check out .agents/types/tools.ts for more information on the tools you can include.
|
|
24
|
+
toolNames: ['run_terminal_command', 'read_files', 'spawn_agents'],
|
|
25
|
+
|
|
26
|
+
spawnerPrompt: 'Spawn when you need to review code changes in the git diff',
|
|
27
|
+
|
|
28
|
+
instructionsPrompt: `Review the code changes and suggest improvements.
|
|
29
|
+
Execute the following steps:
|
|
30
|
+
1. Run git diff
|
|
31
|
+
2. Spawn a file explorer to find all relevant files
|
|
32
|
+
3. Read any relevant files
|
|
33
|
+
4. Review the changes and suggest improvements`,
|
|
34
|
+
|
|
35
|
+
// See also:
|
|
36
|
+
// - types/agent-definition.ts file for more fields you can add
|
|
37
|
+
// - the examples directory for more ideas!
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default definition
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Skills
|
|
2
|
+
|
|
3
|
+
Skills are reusable instruction sets that agents can load on-demand via the `skill` tool.
|
|
4
|
+
|
|
5
|
+
## Creating a Skill
|
|
6
|
+
|
|
7
|
+
1. Create a directory with your skill name (lowercase alphanumeric with hyphens):
|
|
8
|
+
```
|
|
9
|
+
.agents/skills/my-skill/
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
2. Create a `SKILL.md` file with YAML frontmatter:
|
|
13
|
+
```markdown
|
|
14
|
+
---
|
|
15
|
+
name: my-skill
|
|
16
|
+
description: A short description of what this skill does
|
|
17
|
+
license: MIT
|
|
18
|
+
metadata:
|
|
19
|
+
category: development
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# My Skill
|
|
23
|
+
|
|
24
|
+
Instructions and content for the skill...
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Frontmatter Fields
|
|
28
|
+
|
|
29
|
+
| Field | Required | Description |
|
|
30
|
+
|-------|----------|-------------|
|
|
31
|
+
| `name` | Yes | Skill name (1-64 chars, lowercase alphanumeric with hyphens, must match directory name) |
|
|
32
|
+
| `description` | Yes | Short description (1-1024 chars) used for agent discovery |
|
|
33
|
+
| `license` | No | License identifier (e.g., "MIT", "Apache-2.0") |
|
|
34
|
+
| `disable-model-invocation` | No | Set to `true` to keep the skill out of model discovery while leaving it available for explicit user invocation |
|
|
35
|
+
| `metadata` | No | Key-value pairs for additional categorization |
|
|
36
|
+
|
|
37
|
+
## Name Validation
|
|
38
|
+
|
|
39
|
+
Skill names must:
|
|
40
|
+
- Be 1-64 characters long
|
|
41
|
+
- Use only lowercase letters, numbers, and hyphens
|
|
42
|
+
- Not start or end with a hyphen
|
|
43
|
+
- Not contain consecutive hyphens
|
|
44
|
+
- Match the directory name exactly
|
|
45
|
+
|
|
46
|
+
Valid examples: `git-release`, `api-design`, `review2`
|
|
47
|
+
Invalid examples: `Git-Release`, `my--skill`, `-skill`, `skill-`
|
|
48
|
+
|
|
49
|
+
## Discovery Locations
|
|
50
|
+
|
|
51
|
+
Skills are discovered from these locations (in order of precedence):
|
|
52
|
+
1. `~/.agents/skills/` (global, lowest priority)
|
|
53
|
+
2. `.agents/skills/` (project, highest priority)
|
|
54
|
+
|
|
55
|
+
Project skills override global skills with the same name.
|
|
56
|
+
|
|
57
|
+
## How Agents Use Skills
|
|
58
|
+
|
|
59
|
+
Agents see available skills listed in the `skill` tool description. When an agent needs a skill's instructions, it calls:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
skill({ name: "my-skill" })
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The full SKILL.md content is then returned to the agent.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: example-skill
|
|
3
|
+
description: An example skill demonstrating the SKILL.md format
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
category: examples
|
|
7
|
+
audience: developers
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Example Skill
|
|
11
|
+
|
|
12
|
+
This is an example skill that demonstrates the SKILL.md format.
|
|
13
|
+
|
|
14
|
+
## When to use this skill
|
|
15
|
+
|
|
16
|
+
Use this skill when you need an example of how skills work.
|
|
17
|
+
|
|
18
|
+
## Instructions
|
|
19
|
+
|
|
20
|
+
1. Skills are loaded on-demand via the `skill` tool
|
|
21
|
+
2. The agent sees available skills listed in the tool description
|
|
22
|
+
3. When needed, the agent calls `skill({ name: "example-skill" })` to load the full content
|
|
23
|
+
4. The skill content is then available in the conversation context
|
|
24
|
+
|
|
25
|
+
## Notes
|
|
26
|
+
|
|
27
|
+
- Skills should have clear, specific descriptions
|
|
28
|
+
- The name must be lowercase alphanumeric with hyphens
|
|
29
|
+
- The name must match the directory name
|