@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.
Files changed (328) hide show
  1. package/package.json +74 -70
  2. package/src/agents/bundled-agents.generated.ts +4 -4
  3. package/src/chat.tsx +1703 -1698
  4. package/src/cli-args.ts +134 -134
  5. package/src/components/status-bar.tsx +331 -313
  6. package/src/hooks/helpers/send-message.ts +663 -654
  7. package/src/hooks/use-send-message.ts +806 -773
  8. package/src/index.tsx +473 -473
  9. package/src/state/chat-store.ts +553 -544
  10. package/src/utils/create-run-config.ts +121 -121
  11. package/src/utils/format-compact-number.ts +37 -0
  12. package/vendor/@anvil/common/package.json +27 -0
  13. package/vendor/@anvil/common/src/__tests__/agent-validation.test.ts +846 -0
  14. package/vendor/@anvil/common/src/__tests__/anvil-model-availability.test.ts +101 -0
  15. package/vendor/@anvil/common/src/__tests__/anvil-models.test.ts +1408 -0
  16. package/vendor/@anvil/common/src/__tests__/anvil-public-data-use-copy.test.ts +258 -0
  17. package/vendor/@anvil/common/src/__tests__/anvil-referral-tiers.test.ts +48 -0
  18. package/vendor/@anvil/common/src/__tests__/anvil-spend-ceilings.test.ts +282 -0
  19. package/vendor/@anvil/common/src/__tests__/anvil-trust.test.ts +526 -0
  20. package/vendor/@anvil/common/src/__tests__/deepseek-direct.test.ts +68 -0
  21. package/vendor/@anvil/common/src/__tests__/disposable-email.test.ts +132 -0
  22. package/vendor/@anvil/common/src/__tests__/dynamic-agent-template-schema.test.ts +422 -0
  23. package/vendor/@anvil/common/src/__tests__/env-ci.test.ts +167 -0
  24. package/vendor/@anvil/common/src/__tests__/env-process.test.ts +145 -0
  25. package/vendor/@anvil/common/src/__tests__/foreign-client-shipped-agents.test.ts +234 -0
  26. package/vendor/@anvil/common/src/__tests__/foreign-client-signals.test.ts +379 -0
  27. package/vendor/@anvil/common/src/__tests__/free-agents.test.ts +807 -0
  28. package/vendor/@anvil/common/src/__tests__/gravity-capi.test.ts +154 -0
  29. package/vendor/@anvil/common/src/__tests__/handlesteps-parsing.test.ts +246 -0
  30. package/vendor/@anvil/common/src/__tests__/kimi-k3-god-only.test.ts +77 -0
  31. package/vendor/@anvil/common/src/__tests__/model-config.test.ts +89 -0
  32. package/vendor/@anvil/common/src/__tests__/project-file-tree.test.ts +298 -0
  33. package/vendor/@anvil/common/src/__tests__/provisioned-model-tiers.test.ts +116 -0
  34. package/vendor/@anvil/common/src/__tests__/reasoning-effort.test.ts +167 -0
  35. package/vendor/@anvil/common/src/__tests__/reddit-capi.test.ts +132 -0
  36. package/vendor/@anvil/common/src/__tests__/response-ad-positions.test.ts +72 -0
  37. package/vendor/@anvil/common/src/__tests__/user-state.test.ts +30 -0
  38. package/vendor/@anvil/common/src/actions.ts +215 -0
  39. package/vendor/@anvil/common/src/analytics-core.ts +69 -0
  40. package/vendor/@anvil/common/src/analytics.ts +93 -0
  41. package/vendor/@anvil/common/src/api-keys/constants.ts +26 -0
  42. package/vendor/@anvil/common/src/browser-actions.ts +413 -0
  43. package/vendor/@anvil/common/src/constants/__tests__/anvil-onboarding-gate.test.ts +63 -0
  44. package/vendor/@anvil/common/src/constants/__tests__/anvil-onboarding.test.ts +246 -0
  45. package/vendor/@anvil/common/src/constants/__tests__/cf-worker-signals.test.ts +106 -0
  46. package/vendor/@anvil/common/src/constants/agents.ts +99 -0
  47. package/vendor/@anvil/common/src/constants/analytics-events.ts +435 -0
  48. package/vendor/@anvil/common/src/constants/anthropic.ts +73 -0
  49. package/vendor/@anvil/common/src/constants/anvil-data-use.ts +81 -0
  50. package/vendor/@anvil/common/src/constants/anvil-errors.ts +7 -0
  51. package/vendor/@anvil/common/src/constants/anvil-gemini-thinker.ts +21 -0
  52. package/vendor/@anvil/common/src/constants/anvil-model-ids.ts +11 -0
  53. package/vendor/@anvil/common/src/constants/anvil-models.ts +2130 -0
  54. package/vendor/@anvil/common/src/constants/anvil-onboarding-gate.ts +55 -0
  55. package/vendor/@anvil/common/src/constants/anvil-onboarding.ts +307 -0
  56. package/vendor/@anvil/common/src/constants/anvil-referral-tiers.ts +87 -0
  57. package/vendor/@anvil/common/src/constants/anvil-signup-block.ts +68 -0
  58. package/vendor/@anvil/common/src/constants/anvil-spend-ceilings.ts +450 -0
  59. package/vendor/@anvil/common/src/constants/anvil-trust.ts +976 -0
  60. package/vendor/@anvil/common/src/constants/auth.ts +18 -0
  61. package/vendor/@anvil/common/src/constants/byok.ts +2 -0
  62. package/vendor/@anvil/common/src/constants/cf-worker-signals.ts +132 -0
  63. package/vendor/@anvil/common/src/constants/composio.ts +34 -0
  64. package/vendor/@anvil/common/src/constants/deepseek-direct.ts +55 -0
  65. package/vendor/@anvil/common/src/constants/feedback.ts +13 -0
  66. package/vendor/@anvil/common/src/constants/foreign-client-signals.ts +272 -0
  67. package/vendor/@anvil/common/src/constants/free-agents.ts +777 -0
  68. package/vendor/@anvil/common/src/constants/gemini.ts +15 -0
  69. package/vendor/@anvil/common/src/constants/grant-priorities.ts +13 -0
  70. package/vendor/@anvil/common/src/constants/hosts.ts +6 -0
  71. package/vendor/@anvil/common/src/constants/images.ts +51 -0
  72. package/vendor/@anvil/common/src/constants/index.ts +7 -0
  73. package/vendor/@anvil/common/src/constants/knowledge.ts +35 -0
  74. package/vendor/@anvil/common/src/constants/limits.ts +23 -0
  75. package/vendor/@anvil/common/src/constants/model-config.ts +277 -0
  76. package/vendor/@anvil/common/src/constants/openrouter-attribution.ts +8 -0
  77. package/vendor/@anvil/common/src/constants/paths.ts +69 -0
  78. package/vendor/@anvil/common/src/constants/provider-routes.ts +317 -0
  79. package/vendor/@anvil/common/src/constants/reasoning-effort.ts +79 -0
  80. package/vendor/@anvil/common/src/constants/skills.ts +60 -0
  81. package/vendor/@anvil/common/src/constants/subscription-plans.ts +49 -0
  82. package/vendor/@anvil/common/src/constants/ui.ts +25 -0
  83. package/vendor/@anvil/common/src/env-ci.ts +36 -0
  84. package/vendor/@anvil/common/src/env-process.ts +95 -0
  85. package/vendor/@anvil/common/src/env-schema.ts +95 -0
  86. package/vendor/@anvil/common/src/env.ts +24 -0
  87. package/vendor/@anvil/common/src/gravity-capi.ts +207 -0
  88. package/vendor/@anvil/common/src/mcp/client.ts +233 -0
  89. package/vendor/@anvil/common/src/old-constants.ts +10 -0
  90. package/vendor/@anvil/common/src/project-file-tree.ts +355 -0
  91. package/vendor/@anvil/common/src/reddit-capi.ts +254 -0
  92. package/vendor/@anvil/common/src/schemas/feedback.ts +52 -0
  93. package/vendor/@anvil/common/src/schemas/logs.ts +66 -0
  94. package/vendor/@anvil/common/src/templates/agent-validation.ts +392 -0
  95. package/vendor/@anvil/common/src/templates/initial-agents-dir/LICENSE +202 -0
  96. package/vendor/@anvil/common/src/templates/initial-agents-dir/README.md +294 -0
  97. package/vendor/@anvil/common/src/templates/initial-agents-dir/examples/01-basic-diff-reviewer.ts +17 -0
  98. package/vendor/@anvil/common/src/templates/initial-agents-dir/examples/02-intermediate-git-committer.ts +78 -0
  99. package/vendor/@anvil/common/src/templates/initial-agents-dir/examples/03-advanced-file-explorer.ts +73 -0
  100. package/vendor/@anvil/common/src/templates/initial-agents-dir/my-custom-agent.ts +40 -0
  101. package/vendor/@anvil/common/src/templates/initial-agents-dir/package.json +6 -0
  102. package/vendor/@anvil/common/src/templates/initial-agents-dir/skills/README.md +65 -0
  103. package/vendor/@anvil/common/src/templates/initial-agents-dir/skills/example-skill/SKILL.md +29 -0
  104. package/vendor/@anvil/common/src/templates/initial-agents-dir/types/agent-definition.ts +497 -0
  105. package/vendor/@anvil/common/src/templates/initial-agents-dir/types/tools.ts +444 -0
  106. package/vendor/@anvil/common/src/templates/initial-agents-dir/types/util-types.ts +178 -0
  107. package/vendor/@anvil/common/src/testing/TESTING_PATTERNS.md +351 -0
  108. package/vendor/@anvil/common/src/testing/anvil-offer-invariants.ts +169 -0
  109. package/vendor/@anvil/common/src/testing/errors.ts +33 -0
  110. package/vendor/@anvil/common/src/testing/fixtures/agent-runtime.ts +334 -0
  111. package/vendor/@anvil/common/src/testing/impl/agent-runtime.ts +6 -0
  112. package/vendor/@anvil/common/src/testing/index.ts +84 -0
  113. package/vendor/@anvil/common/src/testing/mock-modules.ts +53 -0
  114. package/vendor/@anvil/common/src/testing/mock-types.ts +123 -0
  115. package/vendor/@anvil/common/src/testing/mocks/analytics.ts +261 -0
  116. package/vendor/@anvil/common/src/testing/mocks/child-process.ts +93 -0
  117. package/vendor/@anvil/common/src/testing/mocks/crypto.ts +218 -0
  118. package/vendor/@anvil/common/src/testing/mocks/database.ts +337 -0
  119. package/vendor/@anvil/common/src/testing/mocks/fetch.ts +219 -0
  120. package/vendor/@anvil/common/src/testing/mocks/filesystem.ts +166 -0
  121. package/vendor/@anvil/common/src/testing/mocks/index.ts +101 -0
  122. package/vendor/@anvil/common/src/testing/mocks/logger.ts +135 -0
  123. package/vendor/@anvil/common/src/testing/mocks/stream.ts +313 -0
  124. package/vendor/@anvil/common/src/testing/mocks/timers.ts +132 -0
  125. package/vendor/@anvil/common/src/testing/mocks/tree-sitter.ts +127 -0
  126. package/vendor/@anvil/common/src/testing/setup.ts +282 -0
  127. package/vendor/@anvil/common/src/testing-env-ci.ts +15 -0
  128. package/vendor/@anvil/common/src/testing-env-process.ts +78 -0
  129. package/vendor/@anvil/common/src/tools/__tests__/compile-tool-definitions.test.ts +34 -0
  130. package/vendor/@anvil/common/src/tools/compile-tool-definitions.ts +157 -0
  131. package/vendor/@anvil/common/src/tools/constants.ts +117 -0
  132. package/vendor/@anvil/common/src/tools/list.ts +190 -0
  133. package/vendor/@anvil/common/src/tools/params/__tests__/coerce-to-array.test.ts +213 -0
  134. package/vendor/@anvil/common/src/tools/params/__tests__/read-docs.test.ts +47 -0
  135. package/vendor/@anvil/common/src/tools/params/__tests__/render-ui.test.ts +65 -0
  136. package/vendor/@anvil/common/src/tools/params/tool/__tests__/run-terminal-command-timeout.test.ts +49 -0
  137. package/vendor/@anvil/common/src/tools/params/tool/add-message.ts +39 -0
  138. package/vendor/@anvil/common/src/tools/params/tool/add-subgoal.ts +57 -0
  139. package/vendor/@anvil/common/src/tools/params/tool/apply-patch.ts +110 -0
  140. package/vendor/@anvil/common/src/tools/params/tool/ask-user.ts +181 -0
  141. package/vendor/@anvil/common/src/tools/params/tool/browser-logs.ts +85 -0
  142. package/vendor/@anvil/common/src/tools/params/tool/cloud-plan-ready.ts +94 -0
  143. package/vendor/@anvil/common/src/tools/params/tool/code-search.ts +159 -0
  144. package/vendor/@anvil/common/src/tools/params/tool/composio.ts +131 -0
  145. package/vendor/@anvil/common/src/tools/params/tool/create-plan.ts +80 -0
  146. package/vendor/@anvil/common/src/tools/params/tool/end-turn.ts +57 -0
  147. package/vendor/@anvil/common/src/tools/params/tool/find-files.ts +60 -0
  148. package/vendor/@anvil/common/src/tools/params/tool/glob.ts +80 -0
  149. package/vendor/@anvil/common/src/tools/params/tool/gravity-index.ts +93 -0
  150. package/vendor/@anvil/common/src/tools/params/tool/list-directory.ts +58 -0
  151. package/vendor/@anvil/common/src/tools/params/tool/lookup-agent-info.ts +37 -0
  152. package/vendor/@anvil/common/src/tools/params/tool/propose-str-replace.ts +103 -0
  153. package/vendor/@anvil/common/src/tools/params/tool/propose-write-file.ts +71 -0
  154. package/vendor/@anvil/common/src/tools/params/tool/read-docs.ts +90 -0
  155. package/vendor/@anvil/common/src/tools/params/tool/read-files.ts +109 -0
  156. package/vendor/@anvil/common/src/tools/params/tool/read-subtree.ts +79 -0
  157. package/vendor/@anvil/common/src/tools/params/tool/read-url.ts +81 -0
  158. package/vendor/@anvil/common/src/tools/params/tool/render-ui.ts +168 -0
  159. package/vendor/@anvil/common/src/tools/params/tool/run-file-change-hooks.ts +57 -0
  160. package/vendor/@anvil/common/src/tools/params/tool/run-terminal-command.ts +211 -0
  161. package/vendor/@anvil/common/src/tools/params/tool/screenshot.ts +97 -0
  162. package/vendor/@anvil/common/src/tools/params/tool/set-messages.ts +44 -0
  163. package/vendor/@anvil/common/src/tools/params/tool/set-output.ts +61 -0
  164. package/vendor/@anvil/common/src/tools/params/tool/skill.ts +59 -0
  165. package/vendor/@anvil/common/src/tools/params/tool/spawn-agent-inline.ts +56 -0
  166. package/vendor/@anvil/common/src/tools/params/tool/spawn-agents.ts +154 -0
  167. package/vendor/@anvil/common/src/tools/params/tool/str-replace.ts +107 -0
  168. package/vendor/@anvil/common/src/tools/params/tool/suggest-followups.ts +97 -0
  169. package/vendor/@anvil/common/src/tools/params/tool/task-completed.ts +61 -0
  170. package/vendor/@anvil/common/src/tools/params/tool/think-deeply.ts +56 -0
  171. package/vendor/@anvil/common/src/tools/params/tool/update-subgoal.ts +89 -0
  172. package/vendor/@anvil/common/src/tools/params/tool/vision-analyze.ts +82 -0
  173. package/vendor/@anvil/common/src/tools/params/tool/web-search.ts +73 -0
  174. package/vendor/@anvil/common/src/tools/params/tool/write-file.ts +71 -0
  175. package/vendor/@anvil/common/src/tools/params/tool/write-todos.ts +67 -0
  176. package/vendor/@anvil/common/src/tools/params/utils.ts +150 -0
  177. package/vendor/@anvil/common/src/tools/utils.ts +24 -0
  178. package/vendor/@anvil/common/src/types/__tests__/dynamic-agent-template.test.ts +20 -0
  179. package/vendor/@anvil/common/src/types/agent-template.ts +215 -0
  180. package/vendor/@anvil/common/src/types/anvil-session.ts +535 -0
  181. package/vendor/@anvil/common/src/types/anvil-streak.ts +6 -0
  182. package/vendor/@anvil/common/src/types/anvil-usage.ts +64 -0
  183. package/vendor/@anvil/common/src/types/api/agents/publish.ts +61 -0
  184. package/vendor/@anvil/common/src/types/bun-test.d.ts +5 -0
  185. package/vendor/@anvil/common/src/types/contracts/agent-runtime.ts +75 -0
  186. package/vendor/@anvil/common/src/types/contracts/analytics.ts +9 -0
  187. package/vendor/@anvil/common/src/types/contracts/bigquery.ts +55 -0
  188. package/vendor/@anvil/common/src/types/contracts/billing.ts +46 -0
  189. package/vendor/@anvil/common/src/types/contracts/client.ts +53 -0
  190. package/vendor/@anvil/common/src/types/contracts/database.ts +112 -0
  191. package/vendor/@anvil/common/src/types/contracts/env.ts +203 -0
  192. package/vendor/@anvil/common/src/types/contracts/llm.ts +191 -0
  193. package/vendor/@anvil/common/src/types/contracts/logger.ts +14 -0
  194. package/vendor/@anvil/common/src/types/contracts/logs.ts +34 -0
  195. package/vendor/@anvil/common/src/types/contracts/trace.ts +21 -0
  196. package/vendor/@anvil/common/src/types/dynamic-agent-template.ts +328 -0
  197. package/vendor/@anvil/common/src/types/filesystem.ts +10 -0
  198. package/vendor/@anvil/common/src/types/function-params.ts +33 -0
  199. package/vendor/@anvil/common/src/types/grant.ts +20 -0
  200. package/vendor/@anvil/common/src/types/gravity-index.ts +170 -0
  201. package/vendor/@anvil/common/src/types/json.ts +29 -0
  202. package/vendor/@anvil/common/src/types/mcp.ts +24 -0
  203. package/vendor/@anvil/common/src/types/messages/anvil-message.ts +58 -0
  204. package/vendor/@anvil/common/src/types/messages/content-part.ts +59 -0
  205. package/vendor/@anvil/common/src/types/messages/data-content.ts +14 -0
  206. package/vendor/@anvil/common/src/types/messages/provider-metadata.ts +13 -0
  207. package/vendor/@anvil/common/src/types/organization.ts +118 -0
  208. package/vendor/@anvil/common/src/types/print-mode.ts +121 -0
  209. package/vendor/@anvil/common/src/types/publisher.ts +67 -0
  210. package/vendor/@anvil/common/src/types/session-state.ts +149 -0
  211. package/vendor/@anvil/common/src/types/skill.ts +86 -0
  212. package/vendor/@anvil/common/src/types/source.ts +11 -0
  213. package/vendor/@anvil/common/src/types/spawn.ts +13 -0
  214. package/vendor/@anvil/common/src/types/subscription.ts +67 -0
  215. package/vendor/@anvil/common/src/types/usage.ts +16 -0
  216. package/vendor/@anvil/common/src/types/util.ts +3 -0
  217. package/vendor/@anvil/common/src/util/__tests__/ad-user-agent.test.ts +26 -0
  218. package/vendor/@anvil/common/src/util/__tests__/analytics-dispatcher.test.ts +122 -0
  219. package/vendor/@anvil/common/src/util/__tests__/analytics-log.test.ts +102 -0
  220. package/vendor/@anvil/common/src/util/__tests__/analytics-sampling.test.ts +143 -0
  221. package/vendor/@anvil/common/src/util/__tests__/anvil-streak.test.ts +202 -0
  222. package/vendor/@anvil/common/src/util/__tests__/anvil-usage-summary.test.ts +193 -0
  223. package/vendor/@anvil/common/src/util/__tests__/axiom-only-log.test.ts +140 -0
  224. package/vendor/@anvil/common/src/util/__tests__/client-user-agent.test.ts +148 -0
  225. package/vendor/@anvil/common/src/util/__tests__/engagement-tracker.test.ts +115 -0
  226. package/vendor/@anvil/common/src/util/__tests__/env-file-path.test.ts +57 -0
  227. package/vendor/@anvil/common/src/util/__tests__/error-abort.test.ts +774 -0
  228. package/vendor/@anvil/common/src/util/__tests__/error-api-details.test.ts +206 -0
  229. package/vendor/@anvil/common/src/util/__tests__/file-read-limits.test.ts +173 -0
  230. package/vendor/@anvil/common/src/util/__tests__/format-code-search.test.ts +60 -0
  231. package/vendor/@anvil/common/src/util/__tests__/log-mirror.test.ts +31 -0
  232. package/vendor/@anvil/common/src/util/__tests__/messages.test.ts +1252 -0
  233. package/vendor/@anvil/common/src/util/__tests__/partial-json-delta.test.ts +505 -0
  234. package/vendor/@anvil/common/src/util/__tests__/path.test.ts +22 -0
  235. package/vendor/@anvil/common/src/util/__tests__/project-ignore.test.ts +90 -0
  236. package/vendor/@anvil/common/src/util/__tests__/promise.test.ts +325 -0
  237. package/vendor/@anvil/common/src/util/__tests__/rate-limit.test.ts +28 -0
  238. package/vendor/@anvil/common/src/util/__tests__/reddit-anvil-retention.test.ts +130 -0
  239. package/vendor/@anvil/common/src/util/__tests__/saxy.test.ts +1008 -0
  240. package/vendor/@anvil/common/src/util/__tests__/split-data.test.ts +289 -0
  241. package/vendor/@anvil/common/src/util/__tests__/string.test.ts +239 -0
  242. package/vendor/@anvil/common/src/util/__tests__/thread-title.test.ts +70 -0
  243. package/vendor/@anvil/common/src/util/__tests__/tool-result-media-order.test.ts +108 -0
  244. package/vendor/@anvil/common/src/util/__tests__/ttft-histogram.test.ts +180 -0
  245. package/vendor/@anvil/common/src/util/__tests__/with-timeout.test.ts +24 -0
  246. package/vendor/@anvil/common/src/util/__tests__/zoned-time.test.ts +88 -0
  247. package/vendor/@anvil/common/src/util/ad-user-agent.ts +25 -0
  248. package/vendor/@anvil/common/src/util/agent-file-utils.ts +110 -0
  249. package/vendor/@anvil/common/src/util/agent-id-parsing.ts +136 -0
  250. package/vendor/@anvil/common/src/util/agent-name-normalization.ts +38 -0
  251. package/vendor/@anvil/common/src/util/agent-name-resolver.ts +86 -0
  252. package/vendor/@anvil/common/src/util/analytics-dispatcher.ts +82 -0
  253. package/vendor/@anvil/common/src/util/analytics-log.ts +78 -0
  254. package/vendor/@anvil/common/src/util/analytics-sampling.ts +255 -0
  255. package/vendor/@anvil/common/src/util/anvil-model-availability.ts +102 -0
  256. package/vendor/@anvil/common/src/util/anvil-privacy.ts +82 -0
  257. package/vendor/@anvil/common/src/util/anvil-streak-line.ts +103 -0
  258. package/vendor/@anvil/common/src/util/anvil-streak.ts +156 -0
  259. package/vendor/@anvil/common/src/util/anvil-usage-summary.ts +125 -0
  260. package/vendor/@anvil/common/src/util/array.ts +31 -0
  261. package/vendor/@anvil/common/src/util/axiom-only-log.ts +124 -0
  262. package/vendor/@anvil/common/src/util/cache-debug.ts +171 -0
  263. package/vendor/@anvil/common/src/util/client-user-agent.ts +114 -0
  264. package/vendor/@anvil/common/src/util/credentials.ts +26 -0
  265. package/vendor/@anvil/common/src/util/currency.ts +25 -0
  266. package/vendor/@anvil/common/src/util/dates.ts +81 -0
  267. package/vendor/@anvil/common/src/util/disposable-email.ts +277 -0
  268. package/vendor/@anvil/common/src/util/engagement-tracker.ts +129 -0
  269. package/vendor/@anvil/common/src/util/env-file-path.ts +40 -0
  270. package/vendor/@anvil/common/src/util/error.ts +562 -0
  271. package/vendor/@anvil/common/src/util/file-read-limits.ts +236 -0
  272. package/vendor/@anvil/common/src/util/file.ts +339 -0
  273. package/vendor/@anvil/common/src/util/format-code-search.ts +115 -0
  274. package/vendor/@anvil/common/src/util/lazy-response-ads.ts +92 -0
  275. package/vendor/@anvil/common/src/util/log-data.ts +57 -0
  276. package/vendor/@anvil/common/src/util/log-ingest.ts +58 -0
  277. package/vendor/@anvil/common/src/util/log-mirror.ts +34 -0
  278. package/vendor/@anvil/common/src/util/lru-cache.ts +67 -0
  279. package/vendor/@anvil/common/src/util/messages.ts +685 -0
  280. package/vendor/@anvil/common/src/util/min-heap.ts +87 -0
  281. package/vendor/@anvil/common/src/util/model-utils.ts +4 -0
  282. package/vendor/@anvil/common/src/util/object.ts +128 -0
  283. package/vendor/@anvil/common/src/util/partial-json-delta.ts +89 -0
  284. package/vendor/@anvil/common/src/util/path.ts +15 -0
  285. package/vendor/@anvil/common/src/util/project-ignore.ts +119 -0
  286. package/vendor/@anvil/common/src/util/promise.ts +73 -0
  287. package/vendor/@anvil/common/src/util/random.ts +15 -0
  288. package/vendor/@anvil/common/src/util/rate-limit.ts +56 -0
  289. package/vendor/@anvil/common/src/util/reddit-anvil-retention.ts +60 -0
  290. package/vendor/@anvil/common/src/util/reddit-capi-events.ts +36 -0
  291. package/vendor/@anvil/common/src/util/response-ad-positions.ts +54 -0
  292. package/vendor/@anvil/common/src/util/saxy.ts +741 -0
  293. package/vendor/@anvil/common/src/util/skills.test.ts +44 -0
  294. package/vendor/@anvil/common/src/util/skills.ts +36 -0
  295. package/vendor/@anvil/common/src/util/split-data.ts +259 -0
  296. package/vendor/@anvil/common/src/util/stop-sequence.ts +61 -0
  297. package/vendor/@anvil/common/src/util/string.ts +426 -0
  298. package/vendor/@anvil/common/src/util/system-info.ts +53 -0
  299. package/vendor/@anvil/common/src/util/thread-title.ts +46 -0
  300. package/vendor/@anvil/common/src/util/ttft-histogram.ts +73 -0
  301. package/vendor/@anvil/common/src/util/xml-parser.ts +27 -0
  302. package/vendor/@anvil/common/src/util/xml.ts +17 -0
  303. package/vendor/@anvil/common/src/util/zod-schema.ts +25 -0
  304. package/vendor/@anvil/common/src/util/zoned-time.ts +136 -0
  305. package/vendor/@anvil/common/src/utils/ask-user-bridge.ts +44 -0
  306. package/vendor/@anvil/sdk/dist/index.cjs +52297 -0
  307. package/vendor/@anvil/sdk/dist/index.cjs.map +440 -0
  308. package/vendor/@anvil/sdk/dist/index.d.ts +4277 -0
  309. package/vendor/@anvil/sdk/dist/index.mjs +52290 -0
  310. package/vendor/@anvil/sdk/dist/index.mjs.map +440 -0
  311. package/vendor/@anvil/sdk/dist/vendor/ai.cjs +30886 -0
  312. package/vendor/@anvil/sdk/dist/vendor/ripgrep/arm64-darwin/rg +0 -0
  313. package/vendor/@anvil/sdk/dist/vendor/ripgrep/arm64-linux/rg +0 -0
  314. package/vendor/@anvil/sdk/dist/vendor/ripgrep/x64-darwin/rg +0 -0
  315. package/vendor/@anvil/sdk/dist/vendor/ripgrep/x64-linux/rg +0 -0
  316. package/vendor/@anvil/sdk/dist/vendor/ripgrep/x64-win32/rg.exe +0 -0
  317. package/vendor/@anvil/sdk/dist/wasm/tree-sitter-c-sharp.wasm +0 -0
  318. package/vendor/@anvil/sdk/dist/wasm/tree-sitter-cpp.wasm +0 -0
  319. package/vendor/@anvil/sdk/dist/wasm/tree-sitter-go.wasm +0 -0
  320. package/vendor/@anvil/sdk/dist/wasm/tree-sitter-java.wasm +0 -0
  321. package/vendor/@anvil/sdk/dist/wasm/tree-sitter-javascript.wasm +0 -0
  322. package/vendor/@anvil/sdk/dist/wasm/tree-sitter-python.wasm +0 -0
  323. package/vendor/@anvil/sdk/dist/wasm/tree-sitter-ruby.wasm +0 -0
  324. package/vendor/@anvil/sdk/dist/wasm/tree-sitter-rust.wasm +0 -0
  325. package/vendor/@anvil/sdk/dist/wasm/tree-sitter-tsx.wasm +0 -0
  326. package/vendor/@anvil/sdk/dist/wasm/tree-sitter-typescript.wasm +0 -0
  327. package/vendor/@anvil/sdk/dist/wasm/tree-sitter.wasm +0 -0
  328. package/vendor/@anvil/sdk/package.json +21 -0
@@ -0,0 +1,444 @@
1
+ /**
2
+ * Union type of all available tool names
3
+ */
4
+ export type ToolName =
5
+ | 'add_message'
6
+ | 'apply_patch'
7
+ | 'ask_user'
8
+ | 'cloud_plan_ready'
9
+ | 'code_search'
10
+ | 'end_turn'
11
+ | 'find_files'
12
+ | 'glob'
13
+ | 'gravity_index'
14
+ | 'list_directory'
15
+ | 'lookup_agent_info'
16
+ | 'propose_str_replace'
17
+ | 'propose_write_file'
18
+ | 'read_docs'
19
+ | 'read_files'
20
+ | 'read_subtree'
21
+ | 'read_url'
22
+ | 'render_ui'
23
+ | 'run_file_change_hooks'
24
+ | 'run_terminal_command'
25
+ | 'set_messages'
26
+ | 'set_output'
27
+ | 'skill'
28
+ | 'spawn_agents'
29
+ | 'str_replace'
30
+ | 'suggest_followups'
31
+ | 'task_completed'
32
+ | 'think_deeply'
33
+ | 'web_search'
34
+ | 'write_file'
35
+ | 'write_todos'
36
+
37
+ /**
38
+ * Map of tool names to their parameter types
39
+ */
40
+ export interface ToolParamsMap {
41
+ add_message: AddMessageParams
42
+ apply_patch: ApplyPatchParams
43
+ ask_user: AskUserParams
44
+ cloud_plan_ready: CloudPlanReadyParams
45
+ code_search: CodeSearchParams
46
+ end_turn: EndTurnParams
47
+ find_files: FindFilesParams
48
+ glob: GlobParams
49
+ gravity_index: GravityIndexParams
50
+ list_directory: ListDirectoryParams
51
+ lookup_agent_info: LookupAgentInfoParams
52
+ propose_str_replace: ProposeStrReplaceParams
53
+ propose_write_file: ProposeWriteFileParams
54
+ read_docs: ReadDocsParams
55
+ read_files: ReadFilesParams
56
+ read_subtree: ReadSubtreeParams
57
+ read_url: ReadUrlParams
58
+ render_ui: RenderUiParams
59
+ run_file_change_hooks: RunFileChangeHooksParams
60
+ run_terminal_command: RunTerminalCommandParams
61
+ set_messages: SetMessagesParams
62
+ set_output: SetOutputParams
63
+ skill: SkillParams
64
+ spawn_agents: SpawnAgentsParams
65
+ str_replace: StrReplaceParams
66
+ suggest_followups: SuggestFollowupsParams
67
+ task_completed: TaskCompletedParams
68
+ think_deeply: ThinkDeeplyParams
69
+ web_search: WebSearchParams
70
+ write_file: WriteFileParams
71
+ write_todos: WriteTodosParams
72
+ }
73
+
74
+ /**
75
+ * Add a new message to the conversation history. To be used for complex requests that can't be solved in a single step, as you may forget what happened!
76
+ */
77
+ export interface AddMessageParams {
78
+ role: 'user' | 'assistant'
79
+ content: string
80
+ }
81
+
82
+ /**
83
+ * Apply a file operation (create, update, or delete) using Codex-style apply_patch format.
84
+ */
85
+ export interface ApplyPatchParams {
86
+ /** The file operation to perform. */
87
+ operation: {
88
+ /** Operation type: create_file, update_file, or delete_file */
89
+ type: 'create_file' | 'update_file' | 'delete_file'
90
+ /** File path relative to project root */
91
+ path: string
92
+ /** Diff content. Required for create_file and update_file. Lines prefixed with + for creates, unified diff with @@ hunks for updates. */
93
+ diff?: string
94
+ }
95
+ }
96
+
97
+ /**
98
+ * Ask the user multiple choice questions and pause execution until they respond.
99
+ */
100
+ export interface AskUserParams {
101
+ /** List of multiple choice questions to ask the user */
102
+ questions: {
103
+ /** The question to ask the user */
104
+ question: string
105
+ /** Short label (max 12 chars) displayed as a chip/tag */
106
+ header?: string
107
+ /** Array of answer options with label and optional description (minimum 2) */
108
+ options: {
109
+ /** The display text for this option */
110
+ label: string
111
+ /** Explanation shown when option is focused */
112
+ description?: string
113
+ }[]
114
+ /** If true, allows selecting multiple options (checkbox). If false, single selection only (radio). */
115
+ multiSelect?: boolean
116
+ /** Validation rules for "Other" text input */
117
+ validation?: {
118
+ /** Maximum length for "Other" text input */
119
+ maxLength?: number
120
+ /** Minimum length for "Other" text input */
121
+ minLength?: number
122
+ /** Regex pattern for "Other" text input */
123
+ pattern?: string
124
+ /** Custom error message when pattern fails */
125
+ patternError?: string
126
+ }
127
+ }[]
128
+ }
129
+
130
+ export interface CloudPlanReadyParams {
131
+ summary: string
132
+ stack: string[]
133
+ build_prompt: string
134
+ }
135
+
136
+ /**
137
+ * Search for string patterns in the project's files. This tool uses ripgrep (rg), a fast line-oriented search tool. Use this tool only when read_files is not sufficient to find the files you need.
138
+ */
139
+ export interface CodeSearchParams {
140
+ /** The pattern to search for. */
141
+ pattern: string
142
+ /** Optional ripgrep flags to customize the search (e.g., "-i" for case-insensitive, "-g *.ts -g *.js" for TypeScript and JavaScript files only, "-g !*.test.ts" to exclude Typescript test files, "-A 3" for 3 lines after match, "-B 2" for 2 lines before match). */
143
+ flags?: string
144
+ /** Optional working directory to search within, relative to the project root. Defaults to searching the entire project. */
145
+ cwd?: string
146
+ /** Maximum number of results to return per file. Defaults to 15. There is also a global limit of 250 results across all files. */
147
+ maxResults?: number
148
+ }
149
+
150
+ /**
151
+ * End your turn, regardless of any new tool results that might be coming. This will allow the user to type another prompt.
152
+ */
153
+ export interface EndTurnParams {}
154
+
155
+ /**
156
+ * Find several files related to a brief natural language description of the files or the name of a function or class you are looking for.
157
+ */
158
+ export interface FindFilesParams {
159
+ /** A brief natural language description of the files or the name of a function or class you are looking for. It's also helpful to mention a directory or two to look within. */
160
+ prompt: string
161
+ }
162
+
163
+ /**
164
+ * Search for files matching a glob pattern. Returns matching file paths sorted by modification time.
165
+ */
166
+ export interface GlobParams {
167
+ /** Glob pattern to match files against (e.g., *.js, src/glob/*.ts, glob/test/glob/*.go). */
168
+ pattern: string
169
+ /** Optional working directory to search within, relative to project root. If not provided, searches from project root. */
170
+ cwd?: string
171
+ }
172
+
173
+ /**
174
+ * Use the Gravity Index tool discovery and install API.
175
+ */
176
+ export interface GravityIndexParams {
177
+ /** Which Gravity Index operation to perform. search: recommend a provider; browse: list catalog services; list_categories: list categories with counts; get_service: full detail for a known slug; report_integration: report a completed integration. */
178
+ action:
179
+ | 'search'
180
+ | 'browse'
181
+ | 'list_categories'
182
+ | 'get_service'
183
+ | 'report_integration'
184
+ /** For action "search": what the user needs, including stack, constraints, and required capabilities. */
185
+ query?: string
186
+ /** For action "search": continue a previous search. For action "report_integration": the search_id from the earlier search result (required). */
187
+ search_id?: string
188
+ /** For action "search": optional structured JSON context about the project, stack, or constraints. */
189
+ context?: Record<string, any>
190
+ /** For action "browse": optional category filter, e.g. Database, Auth, Payments, Hosting, Email, AI. */
191
+ category?: string
192
+ /** For action "browse": optional keyword filter, e.g. sendgrid or postgres. */
193
+ q?: string
194
+ /** For action "get_service": service slug, e.g. supabase, stripe, sendgrid (required). */
195
+ slug?: string
196
+ /** For action "report_integration": slug of the service that was actually integrated (required). */
197
+ integrated_slug?: string
198
+ }
199
+
200
+ /**
201
+ * List files and directories in the specified path. Returns separate arrays of file names and directory names.
202
+ */
203
+ export interface ListDirectoryParams {
204
+ /** Directory path to list, relative to the project root. */
205
+ path: string
206
+ }
207
+
208
+ /**
209
+ * Retrieve information about an agent by ID
210
+ */
211
+ export interface LookupAgentInfoParams {
212
+ /** Agent ID (short local or full published format) */
213
+ agentId: string
214
+ }
215
+
216
+ /**
217
+ * Propose string replacements in a file without actually applying them.
218
+ */
219
+ export interface ProposeStrReplaceParams {
220
+ /** The path to the file to edit. */
221
+ path: string
222
+ /** Array of replacements to make. */
223
+ replacements: {
224
+ /** The string to replace. This must be an *exact match* of the string you want to replace, including whitespace and punctuation. */
225
+ oldString: string
226
+ /** The string to replace the corresponding oldString with. Can be empty to delete. */
227
+ newString: string
228
+ /** Whether to allow multiple replacements of oldString. */
229
+ allowMultiple?: boolean
230
+ }[]
231
+ }
232
+
233
+ /**
234
+ * Propose creating or editing a file without actually applying the changes.
235
+ */
236
+ export interface ProposeWriteFileParams {
237
+ /** Path to the file relative to the **project root** */
238
+ path: string
239
+ /** What the change is intended to do in only one sentence. */
240
+ instructions: string
241
+ /** Edit snippet to apply to the file. */
242
+ content: string
243
+ }
244
+
245
+ /**
246
+ * Fetch up-to-date documentation for libraries and frameworks using Context7 API.
247
+ */
248
+ export interface ReadDocsParams {
249
+ /** 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. */
250
+ libraryTitle: string
251
+ /** Specific topic to focus on (e.g., "routing", "hooks", "authentication") */
252
+ topic: string
253
+ /** Optional maximum number of tokens to return. Defaults to 10000. */
254
+ max_tokens?: number
255
+ }
256
+
257
+ /**
258
+ * Read the multiple files from disk and return their contents. Use this tool to read as many files as would be helpful to answer the user's request.
259
+ */
260
+ export interface ReadFilesParams {
261
+ /** List of file paths to read. */
262
+ paths: string[]
263
+ }
264
+
265
+ /**
266
+ * 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.
267
+ */
268
+ export interface ReadSubtreeParams {
269
+ /** List of paths to directories or files. Relative to the project root. If omitted, the entire project tree is used. */
270
+ paths?: string[]
271
+ /** 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. */
272
+ maxTokens?: number
273
+ }
274
+
275
+ /**
276
+ * Fetch a URL and extract readable text from the page.
277
+ */
278
+ export interface ReadUrlParams {
279
+ /** The full http:// or https:// URL to fetch and extract readable text from. */
280
+ url: string
281
+ /** Maximum number of extracted text characters to return. Defaults to 20000. */
282
+ max_chars?: number
283
+ }
284
+
285
+ /**
286
+ * Render a small interactive UI widget in the Anvil CLI. Currently supports a button that opens a link.
287
+ */
288
+ export interface RenderUiParams {
289
+ /** The UI widget to render. */
290
+ widget: {
291
+ /** Widget type. Currently, the only supported widget is button. */
292
+ type: 'button'
293
+ /** Short button label shown to the user. */
294
+ text: string
295
+ /** The http:// or https:// URL to open when the user clicks the button. */
296
+ link: string
297
+ /** Theme-aware color treatment. Use primary for the main action and secondary for lower-emphasis actions. */
298
+ variant?: 'primary' | 'secondary'
299
+ }
300
+ }
301
+
302
+ /**
303
+ * Parameters for run_file_change_hooks tool
304
+ */
305
+ export interface RunFileChangeHooksParams {
306
+ /** List of file paths that were changed and should trigger file change hooks */
307
+ files: string[]
308
+ }
309
+
310
+ /**
311
+ * Execute a CLI command from the **project root** (different from the user's cwd).
312
+ */
313
+ export interface RunTerminalCommandParams {
314
+ /** CLI command valid for user's OS. */
315
+ command: string
316
+ /** Either SYNC (waits, returns output) or BACKGROUND (runs in background). Default SYNC */
317
+ process_type?: 'SYNC' | 'BACKGROUND'
318
+ /** The working directory to run the command in. Default is the project root. */
319
+ cwd?: string
320
+ /** Set to -1 for no timeout. Does not apply for BACKGROUND commands. Default 30 */
321
+ timeout_seconds?: number
322
+ }
323
+
324
+ /**
325
+ * Set the conversation history to the provided messages.
326
+ */
327
+ export interface SetMessagesParams {
328
+ messages: any
329
+ }
330
+
331
+ /**
332
+ * JSON object to set as the agent output. This completely replaces any previous output. If the agent was spawned, this value will be passed back to its parent. If the agent has an outputSchema defined, the output will be validated against it.
333
+ */
334
+ export interface SetOutputParams {}
335
+
336
+ /**
337
+ * Load a skill's full instructions when relevant to the current task. Skills are loaded on-demand - only load them when you need their specific guidance.
338
+ */
339
+ export interface SkillParams {
340
+ /** The name of the skill to load */
341
+ name: string
342
+ }
343
+
344
+ /**
345
+ * Spawn multiple agents and send a prompt and/or parameters to each of them. These agents will run in parallel. Note that that means they will run independently. If you need to run agents sequentially, use spawn_agents with one agent at a time instead.
346
+ */
347
+ export interface SpawnAgentsParams {
348
+ agents: {
349
+ /** Agent to spawn */
350
+ agent_type: string
351
+ /** Prompt to send to the agent */
352
+ prompt?: string
353
+ /** Parameters object for the agent (if any) */
354
+ params?: Record<string, any>
355
+ }[]
356
+ }
357
+
358
+ /**
359
+ * Replace strings in a file with new strings.
360
+ */
361
+ export interface StrReplaceParams {
362
+ /** The path to the file to edit. */
363
+ path: string
364
+ /** Array of replacements to make. */
365
+ replacements: {
366
+ /** The string to replace. This must be an *exact match* of the string you want to replace, including whitespace and punctuation. */
367
+ oldString: string
368
+ /** The string to replace the corresponding oldString with. Can be empty to delete. */
369
+ newString: string
370
+ /** Whether to allow multiple replacements of oldString. */
371
+ allowMultiple?: boolean
372
+ }[]
373
+ }
374
+
375
+ /**
376
+ * Suggest clickable followup prompts to the user.
377
+ */
378
+ export interface SuggestFollowupsParams {
379
+ /** List of suggested followup prompts the user can click to send */
380
+ followups: {
381
+ /** The prompt text to send as a user message when clicked. Keep it short and goal-oriented — one sentence naming the outcome, not the steps to get there */
382
+ prompt: string
383
+ /** Short display label for the card (defaults to truncated prompt if not provided) */
384
+ label?: string
385
+ }[]
386
+ }
387
+
388
+ /**
389
+ * Signal that the task is complete. Use this tool when:
390
+ - The user's request is completely fulfilled
391
+ - You need clarification from the user before continuing
392
+ - You are stuck or need help from the user to continue
393
+
394
+ This tool explicitly marks the end of your work on the current task.
395
+ */
396
+ export interface TaskCompletedParams {}
397
+
398
+ /**
399
+ * Deeply consider complex tasks by brainstorming approaches and tradeoffs step-by-step.
400
+ */
401
+ export interface ThinkDeeplyParams {
402
+ /** Detailed step-by-step analysis. Initially keep each step concise (max ~5-7 words per step). */
403
+ thought: string
404
+ }
405
+
406
+ /**
407
+ * Search the web for current information using Serper API.
408
+ */
409
+ export interface WebSearchParams {
410
+ /** The search query to find relevant web content */
411
+ query: string
412
+ /** Search depth - 'standard' for quick results, 'deep' for more comprehensive search. Default is 'standard'. */
413
+ depth?: 'standard' | 'deep'
414
+ }
415
+
416
+ /**
417
+ * Create or edit a file with the given content.
418
+ */
419
+ export interface WriteFileParams {
420
+ /** Path to the file relative to the **project root** */
421
+ path: string
422
+ /** What the change is intended to do in only one sentence. */
423
+ instructions: string
424
+ /** Edit snippet to apply to the file. */
425
+ content: string
426
+ }
427
+
428
+ /**
429
+ * Write a todo list to track tasks for multi-step implementations. Use this frequently to maintain an updated step-by-step plan.
430
+ */
431
+ export interface WriteTodosParams {
432
+ /** List of todos with their completion status. Add ALL of the applicable tasks to the list, so you don't forget to do anything. Try to order the todos the same way you will complete them. Do not mark todos as completed if you have not completed them yet! */
433
+ todos: {
434
+ /** Description of the task */
435
+ task: string
436
+ /** Whether the task is completed */
437
+ completed: boolean
438
+ }[]
439
+ }
440
+
441
+ /**
442
+ * Get parameters type for a specific tool
443
+ */
444
+ export type GetToolParams<T extends ToolName> = ToolParamsMap[T]
@@ -0,0 +1,178 @@
1
+ // ===== JSON Types =====
2
+ export type JSONValue =
3
+ | null
4
+ | string
5
+ | number
6
+ | boolean
7
+ | JSONObject
8
+ | JSONArray
9
+
10
+ export type JSONObject = { [key: string]: JSONValue | undefined }
11
+
12
+ export type JSONArray = JSONValue[]
13
+
14
+ /**
15
+ * JSON Schema definition (for prompt schema or output schema)
16
+ */
17
+ export type JsonSchema = {
18
+ type?:
19
+ | 'object'
20
+ | 'array'
21
+ | 'string'
22
+ | 'number'
23
+ | 'boolean'
24
+ | 'null'
25
+ | 'integer'
26
+ description?: string
27
+ properties?: Record<string, JsonSchema | boolean>
28
+ required?: string[]
29
+ enum?: Array<string | number | boolean | null>
30
+ [k: string]: unknown
31
+ }
32
+ export type JsonObjectSchema = JsonSchema & { type: 'object' }
33
+
34
+ // ===== Data Content Types =====
35
+ export type DataContent = string | Uint8Array | ArrayBuffer | Buffer
36
+
37
+ // ===== Provider Metadata Types =====
38
+ export type ProviderMetadata = Record<
39
+ string,
40
+ Record<string, JSONValue | undefined>
41
+ >
42
+
43
+ // ===== Content Part Types =====
44
+ export type TextPart = {
45
+ type: 'text'
46
+ text: string
47
+ providerOptions?: ProviderMetadata
48
+ }
49
+
50
+ export type ImagePart = {
51
+ type: 'image'
52
+ image: DataContent
53
+ mediaType?: string
54
+ providerOptions?: ProviderMetadata
55
+ }
56
+
57
+ export type FilePart = {
58
+ type: 'file'
59
+ data: DataContent
60
+ filename?: string
61
+ mediaType: string
62
+ providerOptions?: ProviderMetadata
63
+ }
64
+
65
+ export type ReasoningPart = {
66
+ type: 'reasoning'
67
+ text: string
68
+ providerOptions?: ProviderMetadata
69
+ }
70
+
71
+ export type ToolCallPart = {
72
+ type: 'tool-call'
73
+ toolCallId: string
74
+ toolName: string
75
+ input: Record<string, unknown>
76
+ providerOptions?: ProviderMetadata
77
+ providerExecuted?: boolean
78
+ }
79
+
80
+ export type ToolResultOutput =
81
+ | {
82
+ type: 'json'
83
+ value: JSONValue
84
+ }
85
+ | {
86
+ type: 'media'
87
+ data: string
88
+ mediaType: string
89
+ }
90
+
91
+ // ===== Message Types =====
92
+ export type AuxiliaryMessageData = {
93
+ providerOptions?: ProviderMetadata
94
+ tags?: string[]
95
+
96
+ /** @deprecated Use tags instead. */
97
+ timeToLive?: 'agentStep' | 'userPrompt'
98
+ /** @deprecated Use tags instead. */
99
+ keepDuringTruncation?: boolean
100
+ /** @deprecated Use tags instead. */
101
+ keepLastTags?: string[]
102
+ }
103
+
104
+ export type SystemMessage = {
105
+ role: 'system'
106
+ content: TextPart[]
107
+ } & AuxiliaryMessageData
108
+
109
+ export type UserMessage = {
110
+ role: 'user'
111
+ content: (TextPart | ImagePart | FilePart)[]
112
+ } & AuxiliaryMessageData
113
+
114
+ export type AssistantMessage = {
115
+ role: 'assistant'
116
+ content: (TextPart | ReasoningPart | ToolCallPart)[]
117
+ } & AuxiliaryMessageData
118
+
119
+ export type ToolMessage = {
120
+ role: 'tool'
121
+ toolCallId: string
122
+ toolName: string
123
+ content: ToolResultOutput[]
124
+ } & AuxiliaryMessageData
125
+
126
+ export type Message =
127
+ | SystemMessage
128
+ | UserMessage
129
+ | AssistantMessage
130
+ | ToolMessage
131
+
132
+ // ===== MCP Server Types =====
133
+
134
+ /**
135
+ * MCP server configuration for stdio-based servers.
136
+ *
137
+ * Environment variables in `env` can be:
138
+ * - A plain string value (hardcoded, e.g., `'production'`)
139
+ * - A `$VAR_NAME` reference to read from local environment (e.g., `'$NOTION_TOKEN'`)
140
+ *
141
+ * The `$VAR_NAME` syntax reads from `process.env.VAR_NAME` at agent load time.
142
+ * This keeps secrets out of your agent definitions - store them in `.env.local` instead.
143
+ *
144
+ * @example
145
+ * ```typescript
146
+ * env: {
147
+ * // Read NOTION_TOKEN from local .env file
148
+ * NOTION_TOKEN: '$NOTION_TOKEN',
149
+ * // Read MY_API_KEY from local env, pass as API_KEY to MCP server
150
+ * API_KEY: '$MY_API_KEY',
151
+ * // Hardcoded value (non-secret)
152
+ * NODE_ENV: 'production',
153
+ * }
154
+ * ```
155
+ */
156
+ export type MCPConfig =
157
+ | {
158
+ type?: 'stdio'
159
+ command: string
160
+ args?: string[]
161
+ env?: Record<string, string>
162
+ }
163
+ | {
164
+ type?: 'http' | 'sse'
165
+ url: string
166
+ params?: Record<string, string>
167
+ headers?: Record<string, string>
168
+ }
169
+
170
+ // ============================================================================
171
+ // Logger Interface
172
+ // ============================================================================
173
+ export interface Logger {
174
+ debug: (data: any, msg?: string) => void
175
+ info: (data: any, msg?: string) => void
176
+ warn: (data: any, msg?: string) => void
177
+ error: (data: any, msg?: string) => void
178
+ }