@levelcode/sdk 0.0.5 → 0.2.0

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 (310) hide show
  1. package/README.md +104 -0
  2. package/dist/agents/constants.d.ts +1 -0
  3. package/dist/agents/team/apprentice.d.ts +3 -0
  4. package/dist/agents/team/coordinator.d.ts +3 -0
  5. package/dist/agents/team/cto.d.ts +3 -0
  6. package/dist/agents/team/designer.d.ts +3 -0
  7. package/dist/agents/team/director.d.ts +3 -0
  8. package/dist/agents/team/distinguished-engineer.d.ts +3 -0
  9. package/dist/agents/team/fellow.d.ts +3 -0
  10. package/dist/agents/team/index.d.ts +27 -0
  11. package/dist/agents/team/intern.d.ts +3 -0
  12. package/dist/agents/team/junior-engineer.d.ts +3 -0
  13. package/dist/agents/team/manager.d.ts +3 -0
  14. package/dist/agents/team/mid-level-engineer.d.ts +3 -0
  15. package/dist/agents/team/principal-engineer.d.ts +3 -0
  16. package/dist/agents/team/product-lead.d.ts +3 -0
  17. package/dist/agents/team/researcher.d.ts +3 -0
  18. package/dist/agents/team/role-hierarchy.d.ts +24 -0
  19. package/dist/agents/team/scientist.d.ts +3 -0
  20. package/dist/agents/team/senior-engineer.d.ts +3 -0
  21. package/dist/agents/team/senior-staff-engineer.d.ts +3 -0
  22. package/dist/agents/team/staff-engineer.d.ts +3 -0
  23. package/dist/agents/team/sub-manager.d.ts +3 -0
  24. package/dist/agents/team/tester.d.ts +3 -0
  25. package/dist/agents/team/vp-engineering.d.ts +3 -0
  26. package/dist/agents/types/agent-definition.d.ts +296 -0
  27. package/dist/agents/types/secret-agent-definition.d.ts +19 -0
  28. package/dist/agents/types/tools.d.ts +308 -0
  29. package/dist/agents/types/util-types.d.ts +134 -0
  30. package/dist/common/src/actions.d.ts +176 -0
  31. package/dist/common/src/analytics-core.d.ts +52 -0
  32. package/dist/common/src/analytics.d.ts +9 -0
  33. package/dist/common/src/browser-actions.d.ts +1200 -0
  34. package/dist/common/src/constants/agents.d.ts +47 -0
  35. package/dist/common/src/constants/analytics-events.d.ts +111 -0
  36. package/dist/common/src/constants/byok.d.ts +2 -0
  37. package/dist/common/src/constants/claude-oauth.d.ts +36 -0
  38. package/dist/common/src/constants/index.d.ts +4 -0
  39. package/dist/common/src/constants/knowledge.d.ts +21 -0
  40. package/dist/common/src/constants/limits.d.ts +14 -0
  41. package/dist/common/src/constants/model-config.d.ts +117 -0
  42. package/dist/common/src/constants/paths.d.ts +23 -0
  43. package/dist/common/src/constants/skills.d.ts +42 -0
  44. package/dist/common/src/constants/ui.d.ts +14 -0
  45. package/dist/common/src/env-ci.d.ts +22 -0
  46. package/dist/common/src/env-process.d.ts +28 -0
  47. package/dist/common/src/env-schema.d.ts +24 -0
  48. package/dist/common/src/env.d.ts +16 -0
  49. package/dist/common/src/mcp/client.d.ts +6 -0
  50. package/dist/common/src/old-constants.d.ts +10 -0
  51. package/dist/common/src/project-file-tree.d.ts +27 -0
  52. package/dist/common/src/templates/agent-validation.d.ts +48 -0
  53. package/dist/common/src/templates/initial-agents-dir/types/agent-definition.d.ts +296 -0
  54. package/dist/common/src/templates/initial-agents-dir/types/tools.d.ts +308 -0
  55. package/dist/common/src/templates/initial-agents-dir/types/util-types.d.ts +128 -0
  56. package/dist/common/src/testing/errors.d.ts +14 -0
  57. package/dist/common/src/testing/mock-modules.d.ts +11 -0
  58. package/dist/common/src/testing/mock-types.d.ts +97 -0
  59. package/dist/common/src/testing/mocks/analytics.d.ts +182 -0
  60. package/dist/common/src/testing/mocks/child-process.d.ts +29 -0
  61. package/dist/common/src/testing/mocks/crypto.d.ts +159 -0
  62. package/dist/common/src/testing/mocks/database.d.ts +197 -0
  63. package/dist/common/src/testing/mocks/fetch.d.ts +35 -0
  64. package/dist/common/src/testing/mocks/filesystem.d.ts +31 -0
  65. package/dist/common/src/testing/mocks/index.d.ts +25 -0
  66. package/dist/common/src/testing/mocks/logger.d.ts +35 -0
  67. package/dist/common/src/testing/mocks/stream.d.ts +203 -0
  68. package/dist/common/src/testing/mocks/timers.d.ts +27 -0
  69. package/dist/common/src/testing/mocks/tree-sitter.d.ts +58 -0
  70. package/dist/common/src/testing-env-process.d.ts +7 -0
  71. package/dist/common/src/tools/constants.d.ts +17 -0
  72. package/dist/common/src/tools/list.d.ts +1152 -0
  73. package/dist/common/src/tools/params/tool/add-message.d.ts +19 -0
  74. package/dist/common/src/tools/params/tool/add-subgoal.d.ts +26 -0
  75. package/dist/common/src/tools/params/tool/ask-user.d.ts +59 -0
  76. package/dist/common/src/tools/params/tool/browser-logs.d.ts +127 -0
  77. package/dist/common/src/tools/params/tool/code-search.d.ts +30 -0
  78. package/dist/common/src/tools/params/tool/create-plan.d.ts +30 -0
  79. package/dist/common/src/tools/params/tool/end-turn.d.ts +13 -0
  80. package/dist/common/src/tools/params/tool/find-files.d.ts +31 -0
  81. package/dist/common/src/tools/params/tool/glob.d.ts +26 -0
  82. package/dist/common/src/tools/params/tool/list-directory.d.ts +25 -0
  83. package/dist/common/src/tools/params/tool/lookup-agent-info.d.ts +13 -0
  84. package/dist/common/src/tools/params/tool/propose-str-replace.d.ts +40 -0
  85. package/dist/common/src/tools/params/tool/propose-write-file.d.ts +29 -0
  86. package/dist/common/src/tools/params/tool/read-docs.d.ts +19 -0
  87. package/dist/common/src/tools/params/tool/read-files.d.ts +35 -0
  88. package/dist/common/src/tools/params/tool/read-subtree.d.ts +40 -0
  89. package/dist/common/src/tools/params/tool/run-file-change-hooks.d.ts +63 -0
  90. package/dist/common/src/tools/params/tool/run-terminal-command.d.ts +88 -0
  91. package/dist/common/src/tools/params/tool/send-message.d.ts +26 -0
  92. package/dist/common/src/tools/params/tool/set-messages.d.ts +15 -0
  93. package/dist/common/src/tools/params/tool/set-output.d.ts +15 -0
  94. package/dist/common/src/tools/params/tool/skill.d.ts +28 -0
  95. package/dist/common/src/tools/params/tool/spawn-agent-inline.d.ts +17 -0
  96. package/dist/common/src/tools/params/tool/spawn-agents.d.ts +26 -0
  97. package/dist/common/src/tools/params/tool/str-replace.d.ts +43 -0
  98. package/dist/common/src/tools/params/tool/suggest-followups.d.ts +26 -0
  99. package/dist/common/src/tools/params/tool/task-completed.d.ts +13 -0
  100. package/dist/common/src/tools/params/tool/task-create.d.ts +24 -0
  101. package/dist/common/src/tools/params/tool/task-get.d.ts +15 -0
  102. package/dist/common/src/tools/params/tool/task-list.d.ts +13 -0
  103. package/dist/common/src/tools/params/tool/task-update.d.ts +29 -0
  104. package/dist/common/src/tools/params/tool/team-create.d.ts +17 -0
  105. package/dist/common/src/tools/params/tool/team-delete.d.ts +13 -0
  106. package/dist/common/src/tools/params/tool/think-deeply.d.ts +15 -0
  107. package/dist/common/src/tools/params/tool/update-subgoal.d.ts +25 -0
  108. package/dist/common/src/tools/params/tool/web-search.d.ts +25 -0
  109. package/dist/common/src/tools/params/tool/write-file.d.ts +31 -0
  110. package/dist/common/src/tools/params/tool/write-todos.d.ts +18 -0
  111. package/dist/common/src/tools/params/utils.d.ts +35 -0
  112. package/dist/common/src/tools/utils.d.ts +4 -0
  113. package/dist/common/src/types/agent-template.d.ts +156 -0
  114. package/dist/common/src/types/contracts/agent-runtime.d.ts +36 -0
  115. package/dist/common/src/types/contracts/analytics.d.ts +8 -0
  116. package/dist/common/src/types/contracts/billing.d.ts +40 -0
  117. package/dist/common/src/types/contracts/client.d.ts +45 -0
  118. package/dist/common/src/types/contracts/database.d.ts +80 -0
  119. package/dist/common/src/types/contracts/env.d.ts +150 -0
  120. package/dist/common/src/types/contracts/llm.d.ts +102 -0
  121. package/dist/common/src/types/contracts/logger.d.ts +8 -0
  122. package/dist/common/src/types/dynamic-agent-template.d.ts +227 -0
  123. package/dist/common/src/types/filesystem.d.ts +6 -0
  124. package/dist/common/src/types/function-params.d.ts +15 -0
  125. package/dist/common/src/types/grant.d.ts +2 -0
  126. package/dist/common/src/types/json.d.ts +9 -0
  127. package/dist/common/src/types/mcp.d.ts +31 -0
  128. package/dist/common/src/types/messages/content-part.d.ts +46 -0
  129. package/dist/common/src/types/messages/data-content.d.ts +3 -0
  130. package/dist/common/src/types/messages/levelcode-message.d.ts +37 -0
  131. package/dist/common/src/types/messages/provider-metadata.d.ts +3 -0
  132. package/dist/common/src/types/print-mode.d.ts +155 -0
  133. package/dist/common/src/types/session-state.d.ts +94 -0
  134. package/dist/common/src/types/skill.d.ts +31 -0
  135. package/dist/common/src/types/source.d.ts +8 -0
  136. package/dist/common/src/types/spawn.d.ts +8 -0
  137. package/dist/common/src/types/team-config-schemas.d.ts +213 -0
  138. package/dist/common/src/types/team-config.d.ts +42 -0
  139. package/dist/common/src/types/team-hook-events.d.ts +36 -0
  140. package/dist/common/src/types/team-protocol.d.ts +64 -0
  141. package/dist/common/src/util/agent-id-parsing.d.ts +22 -0
  142. package/dist/common/src/util/agent-name-normalization.d.ts +12 -0
  143. package/dist/common/src/util/array.d.ts +6 -0
  144. package/dist/common/src/util/credentials.d.ts +11 -0
  145. package/dist/common/src/util/error.d.ts +128 -0
  146. package/dist/common/src/util/file.d.ts +133 -0
  147. package/dist/common/src/util/format-code-search.d.ts +16 -0
  148. package/dist/common/src/util/lru-cache.d.ts +30 -0
  149. package/dist/common/src/util/messages.d.ts +46 -0
  150. package/dist/common/src/util/model-utils.d.ts +8 -0
  151. package/dist/common/src/util/object.d.ts +22 -0
  152. package/dist/common/src/util/promise.d.ts +16 -0
  153. package/dist/common/src/util/random.d.ts +1 -0
  154. package/dist/common/src/util/skills.d.ts +5 -0
  155. package/dist/common/src/util/stop-sequence.d.ts +14 -0
  156. package/dist/common/src/util/string.d.ts +82 -0
  157. package/dist/common/src/util/xml.d.ts +12 -0
  158. package/dist/common/src/util/zod-schema.d.ts +5 -0
  159. package/dist/common/src/utils/dev-phases.d.ts +23 -0
  160. package/dist/common/src/utils/file-lock.d.ts +13 -0
  161. package/dist/common/src/utils/team-analytics.d.ts +16 -0
  162. package/dist/common/src/utils/team-discovery.d.ts +47 -0
  163. package/dist/common/src/utils/team-fs.d.ts +20 -0
  164. package/dist/common/src/utils/team-hook-emitter.d.ts +40 -0
  165. package/dist/common/src/utils/team-presets.d.ts +35 -0
  166. package/dist/index.cjs +7029 -2221
  167. package/dist/index.cjs.map +70 -17
  168. package/dist/index.mjs +7161 -2353
  169. package/dist/index.mjs.map +70 -17
  170. package/dist/packages/agent-runtime/src/constants.d.ts +1 -0
  171. package/dist/packages/agent-runtime/src/fast-rewrite.d.ts +45 -0
  172. package/dist/packages/agent-runtime/src/find-files/request-files-prompt.d.ts +71 -0
  173. package/dist/packages/agent-runtime/src/generate-diffs-prompt.d.ts +53 -0
  174. package/dist/packages/agent-runtime/src/get-file-reading-updates.d.ts +8 -0
  175. package/dist/packages/agent-runtime/src/inbox-poller.d.ts +81 -0
  176. package/dist/packages/agent-runtime/src/llm-api/claude.d.ts +5 -0
  177. package/dist/packages/agent-runtime/src/llm-api/context7-api.d.ts +55 -0
  178. package/dist/packages/agent-runtime/src/llm-api/gemini-with-fallbacks.d.ts +40 -0
  179. package/dist/packages/agent-runtime/src/llm-api/levelcode-web-api.d.ts +49 -0
  180. package/dist/packages/agent-runtime/src/llm-api/relace-api.d.ts +16 -0
  181. package/dist/packages/agent-runtime/src/main-prompt.d.ts +29 -0
  182. package/dist/packages/agent-runtime/src/mcp-constants.d.ts +12 -0
  183. package/dist/packages/agent-runtime/src/mcp.d.ts +10 -0
  184. package/dist/packages/agent-runtime/src/message-formatter.d.ts +12 -0
  185. package/dist/packages/agent-runtime/src/process-file-block.d.ts +56 -0
  186. package/dist/packages/agent-runtime/src/process-str-replace.d.ts +21 -0
  187. package/dist/packages/agent-runtime/src/prompt-agent-stream.d.ts +28 -0
  188. package/dist/packages/agent-runtime/src/run-agent-step.d.ts +73 -0
  189. package/dist/packages/agent-runtime/src/run-programmatic-step.d.ts +40 -0
  190. package/dist/packages/agent-runtime/src/system-prompt/prompts.d.ts +19 -0
  191. package/dist/packages/agent-runtime/src/system-prompt/search-system-prompt.d.ts +14 -0
  192. package/dist/packages/agent-runtime/src/system-prompt/team-context-prompt.d.ts +9 -0
  193. package/dist/packages/agent-runtime/src/system-prompt/team-prompt.d.ts +9 -0
  194. package/dist/packages/agent-runtime/src/system-prompt/truncate-file-tree.d.ts +13 -0
  195. package/dist/packages/agent-runtime/src/team-context.d.ts +14 -0
  196. package/dist/packages/agent-runtime/src/templates/agent-registry.d.ts +35 -0
  197. package/dist/packages/agent-runtime/src/templates/prompts.d.ts +35 -0
  198. package/dist/packages/agent-runtime/src/templates/strings.d.ts +32 -0
  199. package/dist/packages/agent-runtime/src/templates/types.d.ts +13 -0
  200. package/dist/packages/agent-runtime/src/tool-stream-parser.d.ts +31 -0
  201. package/dist/packages/agent-runtime/src/tools/handlers/handler-function-type.d.ts +51 -0
  202. package/dist/packages/agent-runtime/src/tools/handlers/list.d.ts +366 -0
  203. package/dist/packages/agent-runtime/src/tools/handlers/tool/add-message.d.ts +9 -0
  204. package/dist/packages/agent-runtime/src/tools/handlers/tool/add-subgoal.d.ts +9 -0
  205. package/dist/packages/agent-runtime/src/tools/handlers/tool/ask-user.d.ts +10 -0
  206. package/dist/packages/agent-runtime/src/tools/handlers/tool/browser-logs.d.ts +8 -0
  207. package/dist/packages/agent-runtime/src/tools/handlers/tool/code-search.d.ts +8 -0
  208. package/dist/packages/agent-runtime/src/tools/handlers/tool/create-plan.d.ts +13 -0
  209. package/dist/packages/agent-runtime/src/tools/handlers/tool/end-turn.d.ts +7 -0
  210. package/dist/packages/agent-runtime/src/tools/handlers/tool/find-files.d.ts +27 -0
  211. package/dist/packages/agent-runtime/src/tools/handlers/tool/glob.d.ts +10 -0
  212. package/dist/packages/agent-runtime/src/tools/handlers/tool/list-directory.d.ts +10 -0
  213. package/dist/packages/agent-runtime/src/tools/handlers/tool/lookup-agent-info.d.ts +14 -0
  214. package/dist/packages/agent-runtime/src/tools/handlers/tool/propose-str-replace.d.ts +15 -0
  215. package/dist/packages/agent-runtime/src/tools/handlers/tool/propose-write-file.d.ts +7 -0
  216. package/dist/packages/agent-runtime/src/tools/handlers/tool/proposed-content-store.d.ts +27 -0
  217. package/dist/packages/agent-runtime/src/tools/handlers/tool/read-docs.d.ts +21 -0
  218. package/dist/packages/agent-runtime/src/tools/handlers/tool/read-files.d.ts +13 -0
  219. package/dist/packages/agent-runtime/src/tools/handlers/tool/read-subtree.d.ts +13 -0
  220. package/dist/packages/agent-runtime/src/tools/handlers/tool/run-file-change-hooks.d.ts +10 -0
  221. package/dist/packages/agent-runtime/src/tools/handlers/tool/run-terminal-command.d.ts +10 -0
  222. package/dist/packages/agent-runtime/src/tools/handlers/tool/send-message.d.ts +15 -0
  223. package/dist/packages/agent-runtime/src/tools/handlers/tool/set-messages.d.ts +9 -0
  224. package/dist/packages/agent-runtime/src/tools/handlers/tool/set-output.d.ts +18 -0
  225. package/dist/packages/agent-runtime/src/tools/handlers/tool/skill.d.ts +11 -0
  226. package/dist/packages/agent-runtime/src/tools/handlers/tool/spawn-agent-inline.d.ts +29 -0
  227. package/dist/packages/agent-runtime/src/tools/handlers/tool/spawn-agent-utils.d.ts +130 -0
  228. package/dist/packages/agent-runtime/src/tools/handlers/tool/spawn-agents.d.ts +37 -0
  229. package/dist/packages/agent-runtime/src/tools/handlers/tool/str-replace.d.ts +16 -0
  230. package/dist/packages/agent-runtime/src/tools/handlers/tool/suggest-followups.d.ts +9 -0
  231. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-completed.d.ts +15 -0
  232. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-create.d.ts +9 -0
  233. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-get.d.ts +9 -0
  234. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-list.d.ts +9 -0
  235. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-update.d.ts +14 -0
  236. package/dist/packages/agent-runtime/src/tools/handlers/tool/team-create.d.ts +15 -0
  237. package/dist/packages/agent-runtime/src/tools/handlers/tool/team-delete.d.ts +15 -0
  238. package/dist/packages/agent-runtime/src/tools/handlers/tool/think-deeply.d.ts +9 -0
  239. package/dist/packages/agent-runtime/src/tools/handlers/tool/update-subgoal.d.ts +11 -0
  240. package/dist/packages/agent-runtime/src/tools/handlers/tool/web-search.d.ts +22 -0
  241. package/dist/packages/agent-runtime/src/tools/handlers/tool/write-file.d.ts +49 -0
  242. package/dist/packages/agent-runtime/src/tools/handlers/tool/write-todos.d.ts +9 -0
  243. package/dist/packages/agent-runtime/src/tools/prompts.d.ts +31 -0
  244. package/dist/packages/agent-runtime/src/tools/stream-parser.d.ts +33 -0
  245. package/dist/packages/agent-runtime/src/tools/tool-executor.d.ts +87 -0
  246. package/dist/packages/agent-runtime/src/util/agent-output.d.ts +3 -0
  247. package/dist/packages/agent-runtime/src/util/messages.d.ts +68 -0
  248. package/dist/packages/agent-runtime/src/util/parse-tool-calls-from-text.d.ts +38 -0
  249. package/dist/packages/agent-runtime/src/util/render-read-files-result.d.ts +15 -0
  250. package/dist/packages/agent-runtime/src/util/simplify-tool-results.d.ts +7 -0
  251. package/dist/packages/agent-runtime/src/util/stream-xml-parser.d.ts +34 -0
  252. package/dist/packages/agent-runtime/src/util/token-counter.d.ts +3 -0
  253. package/dist/packages/code-map/src/index.d.ts +3 -0
  254. package/dist/packages/code-map/src/init-node.d.ts +4 -0
  255. package/dist/packages/code-map/src/languages.d.ts +36 -0
  256. package/dist/packages/code-map/src/parse.d.ts +21 -0
  257. package/dist/packages/code-map/src/types.d.ts +8 -0
  258. package/dist/packages/code-map/src/utils.d.ts +1 -0
  259. package/dist/sdk/src/__tests__/client.test.d.ts +1 -0
  260. package/dist/sdk/src/__tests__/code-search.test.d.ts +1 -0
  261. package/dist/sdk/src/__tests__/credentials.test.d.ts +1 -0
  262. package/dist/sdk/src/__tests__/database.test.d.ts +1 -0
  263. package/dist/sdk/src/__tests__/env.test.d.ts +1 -0
  264. package/dist/sdk/src/__tests__/error-utils.test.d.ts +1 -0
  265. package/dist/sdk/src/__tests__/initial-session-state.test.d.ts +1 -0
  266. package/dist/sdk/src/__tests__/knowledge-file-selection.test.d.ts +1 -0
  267. package/dist/sdk/src/__tests__/load-agents.test.d.ts +1 -0
  268. package/dist/sdk/src/__tests__/load-mcp-config.test.d.ts +1 -0
  269. package/dist/sdk/src/__tests__/model-provider.test.d.ts +1 -0
  270. package/dist/sdk/src/__tests__/read-files.test.d.ts +1 -0
  271. package/dist/sdk/src/__tests__/run-cancellation.test.d.ts +1 -0
  272. package/dist/sdk/src/__tests__/run-file-filter.test.d.ts +1 -0
  273. package/dist/sdk/src/__tests__/run-handle-event.test.d.ts +1 -0
  274. package/dist/sdk/src/__tests__/run.integration.test.d.ts +1 -0
  275. package/dist/sdk/src/__tests__/team-api.test.d.ts +1 -0
  276. package/dist/sdk/src/__tests__/user-knowledge-files.test.d.ts +1 -0
  277. package/dist/sdk/src/__tests__/validate-agents.test.d.ts +1 -0
  278. package/dist/sdk/src/agents/load-agents.d.ts +106 -0
  279. package/dist/sdk/src/agents/load-mcp-config.d.ts +69 -0
  280. package/dist/sdk/src/client.d.ts +71 -0
  281. package/dist/sdk/src/constants.d.ts +4 -0
  282. package/dist/sdk/src/credentials.d.ts +58 -0
  283. package/dist/sdk/src/custom-tool.d.ts +32 -0
  284. package/dist/sdk/src/env.d.ts +31 -0
  285. package/dist/sdk/src/error-utils.d.ts +55 -0
  286. package/dist/sdk/src/impl/__tests__/prompt-result.test.d.ts +1 -0
  287. package/dist/sdk/src/impl/agent-runtime.d.ts +8 -0
  288. package/dist/sdk/src/impl/database.d.ts +7 -0
  289. package/dist/sdk/src/impl/llm.d.ts +8 -0
  290. package/dist/sdk/src/impl/model-provider.d.ts +61 -0
  291. package/dist/sdk/src/index.d.ts +41 -0
  292. package/dist/sdk/src/native/ripgrep.d.ts +7 -0
  293. package/dist/sdk/src/retry-config.d.ts +46 -0
  294. package/dist/sdk/src/run-state.d.ts +81 -0
  295. package/dist/sdk/src/run.d.ts +79 -0
  296. package/dist/sdk/src/skills/load-skills.d.ts +42 -0
  297. package/dist/sdk/src/team.d.ts +49 -0
  298. package/dist/sdk/src/testing/env.d.ts +5 -0
  299. package/dist/sdk/src/tools/change-file.d.ts +7 -0
  300. package/dist/sdk/src/tools/code-search.d.ts +13 -0
  301. package/dist/sdk/src/tools/glob.d.ts +8 -0
  302. package/dist/sdk/src/tools/index.d.ts +16 -0
  303. package/dist/sdk/src/tools/list-directory.d.ts +7 -0
  304. package/dist/sdk/src/tools/read-files.d.ts +16 -0
  305. package/dist/sdk/src/tools/run-file-change-hooks.d.ts +4 -0
  306. package/dist/sdk/src/tools/run-terminal-command.d.ts +8 -0
  307. package/dist/sdk/src/types/env.d.ts +30 -0
  308. package/dist/sdk/src/validate-agents.d.ts +45 -0
  309. package/package.json +1 -1
  310. package/dist/index.d.ts +0 -3443
@@ -0,0 +1,296 @@
1
+ /**
2
+ * LevelCode Agent Type Definitions
3
+ *
4
+ * This file provides TypeScript type definitions for creating custom LevelCode agents.
5
+ * Import these types in your agent files to get full type safety and IntelliSense.
6
+ *
7
+ * Usage in .agents/your-agent.ts:
8
+ * import { AgentDefinition, ToolName, ModelName } from './types/agent-definition'
9
+ *
10
+ * const definition: AgentDefinition = {
11
+ * // ... your agent configuration with full type safety ...
12
+ * }
13
+ *
14
+ * export default definition
15
+ */
16
+ export interface AgentDefinition {
17
+ /** Unique identifier for this agent. Must contain only lowercase letters, numbers, and hyphens, e.g. 'code-reviewer' */
18
+ id: string;
19
+ /** Version string (if not provided, will default to '0.0.1' and be bumped on each publish) */
20
+ version?: string;
21
+ /** Publisher ID for the agent. Must be provided if you want to publish the agent. */
22
+ publisher?: string;
23
+ /** Human-readable name for the agent */
24
+ displayName: string;
25
+ /** AI model to use for this agent. Can be any model in OpenRouter: https://openrouter.ai/models */
26
+ model: ModelName;
27
+ /**
28
+ * https://openrouter.ai/docs/use-cases/reasoning-tokens
29
+ * One of `max_tokens` or `effort` is required.
30
+ * If `exclude` is true, reasoning will be removed from the response. Default is false.
31
+ */
32
+ reasoningOptions?: {
33
+ enabled?: boolean;
34
+ exclude?: boolean;
35
+ } & ({
36
+ max_tokens: number;
37
+ } | {
38
+ effort: 'high' | 'medium' | 'low' | 'minimal' | 'none';
39
+ });
40
+ /**
41
+ * Provider routing options for OpenRouter.
42
+ * Controls which providers to use and fallback behavior.
43
+ * See https://openrouter.ai/docs/features/provider-routing
44
+ */
45
+ providerOptions?: {
46
+ /**
47
+ * List of provider slugs to try in order (e.g. ["anthropic", "openai"])
48
+ */
49
+ order?: string[];
50
+ /**
51
+ * Whether to allow backup providers when primary is unavailable (default: true)
52
+ */
53
+ allow_fallbacks?: boolean;
54
+ /**
55
+ * Only use providers that support all parameters in your request (default: false)
56
+ */
57
+ require_parameters?: boolean;
58
+ /**
59
+ * Control whether to use providers that may store data
60
+ */
61
+ data_collection?: 'allow' | 'deny';
62
+ /**
63
+ * List of provider slugs to allow for this request
64
+ */
65
+ only?: string[];
66
+ /**
67
+ * List of provider slugs to skip for this request
68
+ */
69
+ ignore?: string[];
70
+ /**
71
+ * List of quantization levels to filter by (e.g. ["int4", "int8"])
72
+ */
73
+ quantizations?: Array<'int4' | 'int8' | 'fp4' | 'fp6' | 'fp8' | 'fp16' | 'bf16' | 'fp32' | 'unknown'>;
74
+ /**
75
+ * Sort providers by price, throughput, or latency
76
+ */
77
+ sort?: 'price' | 'throughput' | 'latency';
78
+ /**
79
+ * Maximum pricing you want to pay for this request
80
+ */
81
+ max_price?: {
82
+ prompt?: number | string;
83
+ completion?: number | string;
84
+ image?: number | string;
85
+ audio?: number | string;
86
+ request?: number | string;
87
+ };
88
+ };
89
+ /** MCP servers by name. Names cannot contain `/`. */
90
+ mcpServers?: Record<string, MCPConfig>;
91
+ /**
92
+ * Tools this agent can use.
93
+ *
94
+ * By default, all tools are available from any specified MCP server. In
95
+ * order to limit the tools from a specific MCP server, add the tool name(s)
96
+ * in the format `'mcpServerName/toolName1'`, `'mcpServerName/toolName2'`,
97
+ * etc.
98
+ */
99
+ toolNames?: (ToolName | (string & {}))[];
100
+ /** Other agents this agent can spawn, like 'levelcode/file-picker@0.0.1'.
101
+ *
102
+ * Use the fully qualified agent id from the agent store, including publisher and version: 'levelcode/file-picker@0.0.1'
103
+ * (publisher and version are required!)
104
+ *
105
+ * Or, use the agent id from a local agent file in your .agents directory: 'file-picker'.
106
+ */
107
+ spawnableAgents?: string[];
108
+ /** The input schema required to spawn the agent. Provide a prompt string and/or a params object or none.
109
+ * 80% of the time you want just a prompt string with a description:
110
+ * inputSchema: {
111
+ * prompt: { type: 'string', description: 'A description of what info would be helpful to the agent' }
112
+ * }
113
+ */
114
+ inputSchema?: {
115
+ prompt?: {
116
+ type: 'string';
117
+ description?: string;
118
+ };
119
+ params?: JsonObjectSchema;
120
+ };
121
+ /** How the agent should output a response to its parent (defaults to 'last_message')
122
+ *
123
+ * last_message: The last message from the agent, typically after using tools.
124
+ *
125
+ * all_messages: All messages from the agent, including tool calls and results.
126
+ *
127
+ * structured_output: Make the agent output a JSON object. Can be used with outputSchema or without if you want freeform json output.
128
+ */
129
+ outputMode?: 'last_message' | 'all_messages' | 'structured_output';
130
+ /** JSON schema for structured output (when outputMode is 'structured_output') */
131
+ outputSchema?: JsonObjectSchema;
132
+ /** Prompt for when and why to spawn this agent. Include the main purpose and use cases.
133
+ *
134
+ * This field is key if the agent is intended to be spawned by other agents. */
135
+ spawnerPrompt?: string;
136
+ /** Whether to include conversation history from the parent agent in context.
137
+ *
138
+ * Defaults to false.
139
+ * Use this when the agent needs to know all the previous messages in the conversation.
140
+ */
141
+ includeMessageHistory?: boolean;
142
+ /** Whether to inherit the parent agent's system prompt instead of using this agent's own systemPrompt.
143
+ *
144
+ * Defaults to false.
145
+ * Use this when you want to enable prompt caching by preserving the same system prompt prefix.
146
+ * Cannot be used together with the systemPrompt field.
147
+ */
148
+ inheritParentSystemPrompt?: boolean;
149
+ /** Background information for the agent. Fairly optional. Prefer using instructionsPrompt for agent instructions. */
150
+ systemPrompt?: string;
151
+ /** Instructions for the agent.
152
+ *
153
+ * IMPORTANT: Updating this prompt is the best way to shape the agent's behavior.
154
+ * This prompt is inserted after each user input. */
155
+ instructionsPrompt?: string;
156
+ /** Prompt inserted at each agent step.
157
+ *
158
+ * Powerful for changing the agent's behavior, but usually not necessary for smart models.
159
+ * Prefer instructionsPrompt for most instructions. */
160
+ stepPrompt?: string;
161
+ /** Programmatically step the agent forward and run tools.
162
+ *
163
+ * You can either yield:
164
+ * - A tool call object with toolName and input properties.
165
+ * - 'STEP' to run agent's model and generate one assistant message.
166
+ * - 'STEP_ALL' to run the agent's model until it uses the end_turn tool or stops includes no tool calls in a message.
167
+ *
168
+ * Or use 'return' to end the turn.
169
+ *
170
+ * Example 1:
171
+ * function* handleSteps({ agentState, prompt, params, logger }) {
172
+ * logger.info('Starting file read process')
173
+ * const { toolResult } = yield {
174
+ * toolName: 'read_files',
175
+ * input: { paths: ['file1.txt', 'file2.txt'] }
176
+ * }
177
+ * yield 'STEP_ALL'
178
+ *
179
+ * // Optionally do a post-processing step here...
180
+ * logger.info('Files read successfully, setting output')
181
+ * yield {
182
+ * toolName: 'set_output',
183
+ * input: {
184
+ * output: 'The files were read successfully.',
185
+ * },
186
+ * }
187
+ * }
188
+ *
189
+ * Example 2:
190
+ * handleSteps: function* ({ agentState, prompt, params, logger }) {
191
+ * while (true) {
192
+ * logger.debug('Spawning thinker agent')
193
+ * yield {
194
+ * toolName: 'spawn_agents',
195
+ * input: {
196
+ * agents: [
197
+ * {
198
+ * agent_type: 'thinker',
199
+ * prompt: 'Think deeply about the user request',
200
+ * },
201
+ * ],
202
+ * },
203
+ * }
204
+ * const { stepsComplete } = yield 'STEP'
205
+ * if (stepsComplete) break
206
+ * }
207
+ * }
208
+ */
209
+ handleSteps?: (context: AgentStepContext) => Generator<ToolCall | 'STEP' | 'STEP_ALL' | StepText | GenerateN, void, {
210
+ agentState: AgentState;
211
+ toolResult: ToolResultOutput[] | undefined;
212
+ stepsComplete: boolean;
213
+ nResponses?: string[];
214
+ }>;
215
+ }
216
+ export interface AgentState {
217
+ agentId: string;
218
+ runId: string;
219
+ parentId: string | undefined;
220
+ /** The agent's conversation history: messages from the user and the assistant. */
221
+ messageHistory: Message[];
222
+ /** The last value set by the set_output tool. This is a plain object or undefined if not set. */
223
+ output: Record<string, any> | undefined;
224
+ /** The system prompt for this agent. */
225
+ systemPrompt: string;
226
+ /** The tool definitions for this agent. */
227
+ toolDefinitions: Record<string, {
228
+ description: string | undefined;
229
+ inputSchema: {};
230
+ }>;
231
+ /**
232
+ * The token count from the Anthropic API.
233
+ * This is updated on every agent step via the /api/v1/token-count endpoint.
234
+ */
235
+ contextTokenCount: number;
236
+ }
237
+ /**
238
+ * Context provided to handleSteps generator function
239
+ */
240
+ export interface AgentStepContext {
241
+ agentState: AgentState;
242
+ prompt?: string;
243
+ params?: Record<string, any>;
244
+ logger: Logger;
245
+ }
246
+ export type StepText = {
247
+ type: 'STEP_TEXT';
248
+ text: string;
249
+ };
250
+ export type GenerateN = {
251
+ type: 'GENERATE_N';
252
+ n: number;
253
+ };
254
+ /**
255
+ * Tool call object for handleSteps generator
256
+ */
257
+ export type ToolCall<T extends ToolName = ToolName> = {
258
+ [K in T]: {
259
+ toolName: K;
260
+ input: GetToolParams<K>;
261
+ includeToolCall?: boolean;
262
+ };
263
+ }[T];
264
+ /**
265
+ * File operation tools
266
+ */
267
+ export type FileEditingTools = 'read_files' | 'write_file' | 'str_replace';
268
+ /**
269
+ * Code analysis tools
270
+ */
271
+ export type CodeAnalysisTools = 'code_search' | 'find_files' | 'read_files';
272
+ /**
273
+ * Terminal and system tools
274
+ */
275
+ export type TerminalTools = 'run_terminal_command' | 'code_search';
276
+ /**
277
+ * Web and browser tools
278
+ */
279
+ export type WebTools = 'web_search' | 'read_docs';
280
+ /**
281
+ * Agent management tools
282
+ */
283
+ export type AgentTools = 'spawn_agents';
284
+ /**
285
+ * Output and control tools
286
+ */
287
+ export type OutputTools = 'set_output';
288
+ /**
289
+ * AI models available for agents. Pick from our selection of recommended models or choose any model in OpenRouter.
290
+ *
291
+ * See available models at https://openrouter.ai/models
292
+ */
293
+ export type ModelName = 'openai/gpt-5.1' | 'openai/gpt-5.1-chat' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-opus-4.1' | 'google/gemini-2.5-pro' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-flash-preview-09-2025' | 'google/gemini-2.5-flash-lite-preview-09-2025' | 'x-ai/grok-4-07-09' | 'x-ai/grok-4-fast' | 'x-ai/grok-code-fast-1' | 'qwen/qwen3-max' | 'qwen/qwen3-coder-plus' | 'qwen/qwen3-coder' | 'qwen/qwen3-coder:nitro' | 'qwen/qwen3-coder-flash' | 'qwen/qwen3-235b-a22b-2507' | 'qwen/qwen3-235b-a22b-2507:nitro' | 'qwen/qwen3-235b-a22b-thinking-2507' | 'qwen/qwen3-235b-a22b-thinking-2507:nitro' | 'qwen/qwen3-30b-a3b' | 'qwen/qwen3-30b-a3b:nitro' | 'deepseek/deepseek-chat-v3-0324' | 'deepseek/deepseek-chat-v3-0324:nitro' | 'deepseek/deepseek-r1-0528' | 'deepseek/deepseek-r1-0528:nitro' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2:nitro' | 'z-ai/glm-4.6' | 'z-ai/glm-4.6:nitro' | (string & {});
294
+ import type { ToolName, GetToolParams } from './tools';
295
+ import type { Message, ToolResultOutput, JsonObjectSchema, MCPConfig, Logger } from './util-types';
296
+ export type { ToolName, GetToolParams };
@@ -0,0 +1,308 @@
1
+ /**
2
+ * Union type of all available tool names
3
+ */
4
+ export type ToolName = 'add_message' | 'ask_user' | 'code_search' | 'end_turn' | 'find_files' | 'glob' | 'list_directory' | 'lookup_agent_info' | 'propose_str_replace' | 'propose_write_file' | 'read_docs' | 'read_files' | 'read_subtree' | 'run_file_change_hooks' | 'run_terminal_command' | 'set_messages' | 'set_output' | 'skill' | 'spawn_agents' | 'str_replace' | 'suggest_followups' | 'task_completed' | 'think_deeply' | 'web_search' | 'write_file' | 'write_todos';
5
+ /**
6
+ * Map of tool names to their parameter types
7
+ */
8
+ export interface ToolParamsMap {
9
+ add_message: AddMessageParams;
10
+ ask_user: AskUserParams;
11
+ code_search: CodeSearchParams;
12
+ end_turn: EndTurnParams;
13
+ find_files: FindFilesParams;
14
+ glob: GlobParams;
15
+ list_directory: ListDirectoryParams;
16
+ lookup_agent_info: LookupAgentInfoParams;
17
+ propose_str_replace: ProposeStrReplaceParams;
18
+ propose_write_file: ProposeWriteFileParams;
19
+ read_docs: ReadDocsParams;
20
+ read_files: ReadFilesParams;
21
+ read_subtree: ReadSubtreeParams;
22
+ run_file_change_hooks: RunFileChangeHooksParams;
23
+ run_terminal_command: RunTerminalCommandParams;
24
+ set_messages: SetMessagesParams;
25
+ set_output: SetOutputParams;
26
+ skill: SkillParams;
27
+ spawn_agents: SpawnAgentsParams;
28
+ str_replace: StrReplaceParams;
29
+ suggest_followups: SuggestFollowupsParams;
30
+ task_completed: TaskCompletedParams;
31
+ think_deeply: ThinkDeeplyParams;
32
+ web_search: WebSearchParams;
33
+ write_file: WriteFileParams;
34
+ write_todos: WriteTodosParams;
35
+ }
36
+ /**
37
+ * 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!
38
+ */
39
+ export interface AddMessageParams {
40
+ role: 'user' | 'assistant';
41
+ content: string;
42
+ }
43
+ /**
44
+ * Ask the user multiple choice questions and pause execution until they respond.
45
+ */
46
+ export interface AskUserParams {
47
+ /** List of multiple choice questions to ask the user */
48
+ questions: {
49
+ /** The question to ask the user */
50
+ question: string;
51
+ /** Short label (max 12 chars) displayed as a chip/tag */
52
+ header?: string;
53
+ /** Array of answer options with label and optional description (minimum 2) */
54
+ options: {
55
+ /** The display text for this option */
56
+ label: string;
57
+ /** Explanation shown when option is focused */
58
+ description?: string;
59
+ }[];
60
+ /** If true, allows selecting multiple options (checkbox). If false, single selection only (radio). */
61
+ multiSelect?: boolean;
62
+ /** Validation rules for "Other" text input */
63
+ validation?: {
64
+ /** Maximum length for "Other" text input */
65
+ maxLength?: number;
66
+ /** Minimum length for "Other" text input */
67
+ minLength?: number;
68
+ /** Regex pattern for "Other" text input */
69
+ pattern?: string;
70
+ /** Custom error message when pattern fails */
71
+ patternError?: string;
72
+ };
73
+ }[];
74
+ }
75
+ /**
76
+ * 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.
77
+ */
78
+ export interface CodeSearchParams {
79
+ /** The pattern to search for. */
80
+ pattern: string;
81
+ /** 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). */
82
+ flags?: string;
83
+ /** Optional working directory to search within, relative to the project root. Defaults to searching the entire project. */
84
+ cwd?: string;
85
+ /** Maximum number of results to return per file. Defaults to 15. There is also a global limit of 250 results across all files. */
86
+ maxResults?: number;
87
+ }
88
+ /**
89
+ * End your turn, regardless of any new tool results that might be coming. This will allow the user to type another prompt.
90
+ */
91
+ export interface EndTurnParams {
92
+ }
93
+ /**
94
+ * 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.
95
+ */
96
+ export interface FindFilesParams {
97
+ /** 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. */
98
+ prompt: string;
99
+ }
100
+ /**
101
+ * Search for files matching a glob pattern. Returns matching file paths sorted by modification time.
102
+ */
103
+ export interface GlobParams {
104
+ /** Glob pattern to match files against (e.g., *.js, src/glob/*.ts, glob/test/glob/*.go). */
105
+ pattern: string;
106
+ /** Optional working directory to search within, relative to project root. If not provided, searches from project root. */
107
+ cwd?: string;
108
+ }
109
+ /**
110
+ * List files and directories in the specified path. Returns separate arrays of file names and directory names.
111
+ */
112
+ export interface ListDirectoryParams {
113
+ /** Directory path to list, relative to the project root. */
114
+ path: string;
115
+ }
116
+ /**
117
+ * Retrieve information about an agent by ID
118
+ */
119
+ export interface LookupAgentInfoParams {
120
+ /** Agent ID (short local or full published format) */
121
+ agentId: string;
122
+ }
123
+ /**
124
+ * Propose string replacements in a file without actually applying them.
125
+ */
126
+ export interface ProposeStrReplaceParams {
127
+ /** The path to the file to edit. */
128
+ path: string;
129
+ /** Array of replacements to make. */
130
+ replacements: {
131
+ /** The string to replace. This must be an *exact match* of the string you want to replace, including whitespace and punctuation. */
132
+ old: string;
133
+ /** The string to replace the corresponding old string with. Can be empty to delete. */
134
+ new: string;
135
+ /** Whether to allow multiple replacements of old string. */
136
+ allowMultiple?: boolean;
137
+ }[];
138
+ }
139
+ /**
140
+ * Propose creating or editing a file without actually applying the changes.
141
+ */
142
+ export interface ProposeWriteFileParams {
143
+ /** Path to the file relative to the **project root** */
144
+ path: string;
145
+ /** What the change is intended to do in only one sentence. */
146
+ instructions: string;
147
+ /** Edit snippet to apply to the file. */
148
+ content: string;
149
+ }
150
+ /**
151
+ * Fetch up-to-date documentation for libraries and frameworks using Context7 API.
152
+ */
153
+ export interface ReadDocsParams {
154
+ /** 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. */
155
+ libraryTitle: string;
156
+ /** Specific topic to focus on (e.g., "routing", "hooks", "authentication") */
157
+ topic: string;
158
+ /** Optional maximum number of tokens to return. Defaults to 20000. Values less than 10000 are automatically increased to 10000. */
159
+ max_tokens?: number;
160
+ }
161
+ /**
162
+ * 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.
163
+ */
164
+ export interface ReadFilesParams {
165
+ /** List of file paths to read. */
166
+ paths: string[];
167
+ }
168
+ /**
169
+ * 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.
170
+ */
171
+ export interface ReadSubtreeParams {
172
+ /** List of paths to directories or files. Relative to the project root. If omitted, the entire project tree is used. */
173
+ paths?: string[];
174
+ /** 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. */
175
+ maxTokens?: number;
176
+ }
177
+ /**
178
+ * Parameters for run_file_change_hooks tool
179
+ */
180
+ export interface RunFileChangeHooksParams {
181
+ /** List of file paths that were changed and should trigger file change hooks */
182
+ files: string[];
183
+ }
184
+ /**
185
+ * Execute a CLI command from the **project root** (different from the user's cwd).
186
+ */
187
+ export interface RunTerminalCommandParams {
188
+ /** CLI command valid for user's OS. */
189
+ command: string;
190
+ /** Either SYNC (waits, returns output) or BACKGROUND (runs in background). Default SYNC */
191
+ process_type?: 'SYNC' | 'BACKGROUND';
192
+ /** The working directory to run the command in. Default is the project root. */
193
+ cwd?: string;
194
+ /** Set to -1 for no timeout. Does not apply for BACKGROUND commands. Default 30 */
195
+ timeout_seconds?: number;
196
+ }
197
+ /**
198
+ * Set the conversation history to the provided messages.
199
+ */
200
+ export interface SetMessagesParams {
201
+ messages: any;
202
+ }
203
+ /**
204
+ * 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.
205
+ */
206
+ export interface SetOutputParams {
207
+ }
208
+ /**
209
+ * 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.
210
+ */
211
+ export interface SkillParams {
212
+ /** The name of the skill to load */
213
+ name: string;
214
+ }
215
+ /**
216
+ * 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.
217
+ */
218
+ export interface SpawnAgentsParams {
219
+ agents: {
220
+ /** Agent to spawn */
221
+ agent_type: string;
222
+ /** Prompt to send to the agent */
223
+ prompt?: string;
224
+ /** Parameters object for the agent (if any) */
225
+ params?: Record<string, any>;
226
+ }[];
227
+ }
228
+ /**
229
+ * Replace strings in a file with new strings.
230
+ */
231
+ export interface StrReplaceParams {
232
+ /** The path to the file to edit. */
233
+ path: string;
234
+ /** Array of replacements to make. */
235
+ replacements: {
236
+ /** The string to replace. This must be an *exact match* of the string you want to replace, including whitespace and punctuation. */
237
+ old: string;
238
+ /** The string to replace the corresponding old string with. Can be empty to delete. */
239
+ new: string;
240
+ /** Whether to allow multiple replacements of old string. */
241
+ allowMultiple?: boolean;
242
+ }[];
243
+ }
244
+ /**
245
+ * Suggest clickable followup prompts to the user.
246
+ */
247
+ export interface SuggestFollowupsParams {
248
+ /** List of suggested followup prompts the user can click to send */
249
+ followups: {
250
+ /** The full prompt text to send as a user message when clicked */
251
+ prompt: string;
252
+ /** Short display label for the card (defaults to truncated prompt if not provided) */
253
+ label?: string;
254
+ }[];
255
+ }
256
+ /**
257
+ * Signal that the task is complete. Use this tool when:
258
+ - The user's request is completely fulfilled
259
+ - You need clarification from the user before continuing
260
+ - You are stuck or need help from the user to continue
261
+
262
+ This tool explicitly marks the end of your work on the current task.
263
+ */
264
+ export interface TaskCompletedParams {
265
+ }
266
+ /**
267
+ * Deeply consider complex tasks by brainstorming approaches and tradeoffs step-by-step.
268
+ */
269
+ export interface ThinkDeeplyParams {
270
+ /** Detailed step-by-step analysis. Initially keep each step concise (max ~5-7 words per step). */
271
+ thought: string;
272
+ }
273
+ /**
274
+ * Search the web for current information using Linkup API.
275
+ */
276
+ export interface WebSearchParams {
277
+ /** The search query to find relevant web content */
278
+ query: string;
279
+ /** Search depth - 'standard' for quick results, 'deep' for more comprehensive search. Default is 'standard'. */
280
+ depth?: 'standard' | 'deep';
281
+ }
282
+ /**
283
+ * Create or edit a file with the given content.
284
+ */
285
+ export interface WriteFileParams {
286
+ /** Path to the file relative to the **project root** */
287
+ path: string;
288
+ /** What the change is intended to do in only one sentence. */
289
+ instructions: string;
290
+ /** Edit snippet to apply to the file. */
291
+ content: string;
292
+ }
293
+ /**
294
+ * Write a todo list to track tasks for multi-step implementations. Use this frequently to maintain an updated step-by-step plan.
295
+ */
296
+ export interface WriteTodosParams {
297
+ /** 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! */
298
+ todos: {
299
+ /** Description of the task */
300
+ task: string;
301
+ /** Whether the task is completed */
302
+ completed: boolean;
303
+ }[];
304
+ }
305
+ /**
306
+ * Get parameters type for a specific tool
307
+ */
308
+ export type GetToolParams<T extends ToolName> = ToolParamsMap[T];