@levelcode/sdk 0.2.2 → 0.2.3

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 (324) hide show
  1. package/dist/agents/constants.d.ts +1 -0
  2. package/dist/agents/team/apprentice.d.ts +3 -0
  3. package/dist/agents/team/coordinator.d.ts +3 -0
  4. package/dist/agents/team/cto.d.ts +3 -0
  5. package/dist/agents/team/designer.d.ts +3 -0
  6. package/dist/agents/team/director.d.ts +3 -0
  7. package/dist/agents/team/distinguished-engineer.d.ts +3 -0
  8. package/dist/agents/team/fellow.d.ts +3 -0
  9. package/dist/agents/team/index.d.ts +27 -0
  10. package/dist/agents/team/intern.d.ts +3 -0
  11. package/dist/agents/team/junior-engineer.d.ts +3 -0
  12. package/dist/agents/team/manager.d.ts +3 -0
  13. package/dist/agents/team/mid-level-engineer.d.ts +3 -0
  14. package/dist/agents/team/principal-engineer.d.ts +3 -0
  15. package/dist/agents/team/product-lead.d.ts +3 -0
  16. package/dist/agents/team/researcher.d.ts +3 -0
  17. package/dist/agents/team/role-hierarchy.d.ts +24 -0
  18. package/dist/agents/team/scientist.d.ts +3 -0
  19. package/dist/agents/team/senior-engineer.d.ts +3 -0
  20. package/dist/agents/team/senior-staff-engineer.d.ts +3 -0
  21. package/dist/agents/team/staff-engineer.d.ts +3 -0
  22. package/dist/agents/team/sub-manager.d.ts +3 -0
  23. package/dist/agents/team/tester.d.ts +3 -0
  24. package/dist/agents/team/vp-engineering.d.ts +3 -0
  25. package/dist/agents/types/agent-definition.d.ts +296 -0
  26. package/dist/agents/types/secret-agent-definition.d.ts +19 -0
  27. package/dist/agents/types/tools.d.ts +308 -0
  28. package/dist/agents/types/util-types.d.ts +134 -0
  29. package/dist/common/src/actions.d.ts +176 -0
  30. package/dist/common/src/analytics-core.d.ts +52 -0
  31. package/dist/common/src/analytics.d.ts +9 -0
  32. package/dist/common/src/browser-actions.d.ts +1200 -0
  33. package/dist/common/src/constants/agents.d.ts +47 -0
  34. package/dist/common/src/constants/analytics-events.d.ts +111 -0
  35. package/dist/common/src/constants/byok.d.ts +2 -0
  36. package/dist/common/src/constants/claude-oauth.d.ts +36 -0
  37. package/dist/common/src/constants/index.d.ts +4 -0
  38. package/dist/common/src/constants/knowledge.d.ts +21 -0
  39. package/dist/common/src/constants/limits.d.ts +14 -0
  40. package/dist/common/src/constants/model-config.d.ts +117 -0
  41. package/dist/common/src/constants/paths.d.ts +23 -0
  42. package/dist/common/src/constants/skills.d.ts +42 -0
  43. package/dist/common/src/constants/ui.d.ts +14 -0
  44. package/dist/common/src/env-ci.d.ts +22 -0
  45. package/dist/common/src/env-process.d.ts +28 -0
  46. package/dist/common/src/env-schema.d.ts +24 -0
  47. package/dist/common/src/env.d.ts +16 -0
  48. package/dist/common/src/mcp/client.d.ts +6 -0
  49. package/dist/common/src/old-constants.d.ts +10 -0
  50. package/dist/common/src/project-file-tree.d.ts +27 -0
  51. package/dist/common/src/templates/agent-validation.d.ts +48 -0
  52. package/dist/common/src/templates/initial-agents-dir/types/agent-definition.d.ts +296 -0
  53. package/dist/common/src/templates/initial-agents-dir/types/tools.d.ts +308 -0
  54. package/dist/common/src/templates/initial-agents-dir/types/util-types.d.ts +128 -0
  55. package/dist/common/src/testing/errors.d.ts +14 -0
  56. package/dist/common/src/testing/mock-modules.d.ts +11 -0
  57. package/dist/common/src/testing/mock-types.d.ts +97 -0
  58. package/dist/common/src/testing/mocks/analytics.d.ts +182 -0
  59. package/dist/common/src/testing/mocks/child-process.d.ts +29 -0
  60. package/dist/common/src/testing/mocks/crypto.d.ts +159 -0
  61. package/dist/common/src/testing/mocks/database.d.ts +197 -0
  62. package/dist/common/src/testing/mocks/fetch.d.ts +35 -0
  63. package/dist/common/src/testing/mocks/filesystem.d.ts +31 -0
  64. package/dist/common/src/testing/mocks/index.d.ts +25 -0
  65. package/dist/common/src/testing/mocks/logger.d.ts +35 -0
  66. package/dist/common/src/testing/mocks/stream.d.ts +203 -0
  67. package/dist/common/src/testing/mocks/timers.d.ts +27 -0
  68. package/dist/common/src/testing/mocks/tree-sitter.d.ts +58 -0
  69. package/dist/common/src/testing-env-process.d.ts +7 -0
  70. package/dist/common/src/tools/constants.d.ts +17 -0
  71. package/dist/common/src/tools/list.d.ts +1152 -0
  72. package/dist/common/src/tools/params/tool/add-message.d.ts +19 -0
  73. package/dist/common/src/tools/params/tool/add-subgoal.d.ts +26 -0
  74. package/dist/common/src/tools/params/tool/ask-user.d.ts +59 -0
  75. package/dist/common/src/tools/params/tool/browser-logs.d.ts +127 -0
  76. package/dist/common/src/tools/params/tool/code-search.d.ts +30 -0
  77. package/dist/common/src/tools/params/tool/create-plan.d.ts +30 -0
  78. package/dist/common/src/tools/params/tool/end-turn.d.ts +13 -0
  79. package/dist/common/src/tools/params/tool/find-files.d.ts +31 -0
  80. package/dist/common/src/tools/params/tool/glob.d.ts +26 -0
  81. package/dist/common/src/tools/params/tool/list-directory.d.ts +25 -0
  82. package/dist/common/src/tools/params/tool/lookup-agent-info.d.ts +13 -0
  83. package/dist/common/src/tools/params/tool/propose-str-replace.d.ts +40 -0
  84. package/dist/common/src/tools/params/tool/propose-write-file.d.ts +29 -0
  85. package/dist/common/src/tools/params/tool/read-docs.d.ts +19 -0
  86. package/dist/common/src/tools/params/tool/read-files.d.ts +35 -0
  87. package/dist/common/src/tools/params/tool/read-subtree.d.ts +40 -0
  88. package/dist/common/src/tools/params/tool/run-file-change-hooks.d.ts +63 -0
  89. package/dist/common/src/tools/params/tool/run-terminal-command.d.ts +88 -0
  90. package/dist/common/src/tools/params/tool/send-message.d.ts +26 -0
  91. package/dist/common/src/tools/params/tool/set-messages.d.ts +15 -0
  92. package/dist/common/src/tools/params/tool/set-output.d.ts +15 -0
  93. package/dist/common/src/tools/params/tool/skill.d.ts +28 -0
  94. package/dist/common/src/tools/params/tool/spawn-agent-inline.d.ts +17 -0
  95. package/dist/common/src/tools/params/tool/spawn-agents.d.ts +26 -0
  96. package/dist/common/src/tools/params/tool/str-replace.d.ts +43 -0
  97. package/dist/common/src/tools/params/tool/suggest-followups.d.ts +26 -0
  98. package/dist/common/src/tools/params/tool/task-completed.d.ts +13 -0
  99. package/dist/common/src/tools/params/tool/task-create.d.ts +24 -0
  100. package/dist/common/src/tools/params/tool/task-get.d.ts +15 -0
  101. package/dist/common/src/tools/params/tool/task-list.d.ts +13 -0
  102. package/dist/common/src/tools/params/tool/task-update.d.ts +29 -0
  103. package/dist/common/src/tools/params/tool/team-create.d.ts +17 -0
  104. package/dist/common/src/tools/params/tool/team-delete.d.ts +13 -0
  105. package/dist/common/src/tools/params/tool/think-deeply.d.ts +15 -0
  106. package/dist/common/src/tools/params/tool/update-subgoal.d.ts +25 -0
  107. package/dist/common/src/tools/params/tool/web-search.d.ts +25 -0
  108. package/dist/common/src/tools/params/tool/write-file.d.ts +31 -0
  109. package/dist/common/src/tools/params/tool/write-todos.d.ts +18 -0
  110. package/dist/common/src/tools/params/utils.d.ts +35 -0
  111. package/dist/common/src/tools/utils.d.ts +4 -0
  112. package/dist/common/src/types/agent-template.d.ts +156 -0
  113. package/dist/common/src/types/contracts/agent-runtime.d.ts +36 -0
  114. package/dist/common/src/types/contracts/analytics.d.ts +8 -0
  115. package/dist/common/src/types/contracts/billing.d.ts +40 -0
  116. package/dist/common/src/types/contracts/client.d.ts +45 -0
  117. package/dist/common/src/types/contracts/database.d.ts +80 -0
  118. package/dist/common/src/types/contracts/env.d.ts +150 -0
  119. package/dist/common/src/types/contracts/llm.d.ts +102 -0
  120. package/dist/common/src/types/contracts/logger.d.ts +8 -0
  121. package/dist/common/src/types/dynamic-agent-template.d.ts +227 -0
  122. package/dist/common/src/types/filesystem.d.ts +6 -0
  123. package/dist/common/src/types/function-params.d.ts +15 -0
  124. package/dist/common/src/types/grant.d.ts +2 -0
  125. package/dist/common/src/types/json.d.ts +9 -0
  126. package/dist/common/src/types/mcp.d.ts +31 -0
  127. package/dist/common/src/types/messages/content-part.d.ts +46 -0
  128. package/dist/common/src/types/messages/data-content.d.ts +3 -0
  129. package/dist/common/src/types/messages/levelcode-message.d.ts +37 -0
  130. package/dist/common/src/types/messages/provider-metadata.d.ts +3 -0
  131. package/dist/common/src/types/print-mode.d.ts +155 -0
  132. package/dist/common/src/types/session-state.d.ts +94 -0
  133. package/dist/common/src/types/skill.d.ts +31 -0
  134. package/dist/common/src/types/source.d.ts +8 -0
  135. package/dist/common/src/types/spawn.d.ts +8 -0
  136. package/dist/common/src/types/team-config-schemas.d.ts +217 -0
  137. package/dist/common/src/types/team-config.d.ts +42 -0
  138. package/dist/common/src/types/team-hook-events.d.ts +36 -0
  139. package/dist/common/src/types/team-protocol.d.ts +64 -0
  140. package/dist/common/src/util/agent-id-parsing.d.ts +22 -0
  141. package/dist/common/src/util/agent-name-normalization.d.ts +12 -0
  142. package/dist/common/src/util/array.d.ts +6 -0
  143. package/dist/common/src/util/credentials.d.ts +11 -0
  144. package/dist/common/src/util/error.d.ts +128 -0
  145. package/dist/common/src/util/file.d.ts +133 -0
  146. package/dist/common/src/util/format-code-search.d.ts +16 -0
  147. package/dist/common/src/util/lru-cache.d.ts +30 -0
  148. package/dist/common/src/util/messages.d.ts +46 -0
  149. package/dist/common/src/util/model-utils.d.ts +8 -0
  150. package/dist/common/src/util/object.d.ts +22 -0
  151. package/dist/common/src/util/promise.d.ts +16 -0
  152. package/dist/common/src/util/random.d.ts +1 -0
  153. package/dist/common/src/util/skills.d.ts +5 -0
  154. package/dist/common/src/util/stop-sequence.d.ts +14 -0
  155. package/dist/common/src/util/string.d.ts +82 -0
  156. package/dist/common/src/util/xml.d.ts +12 -0
  157. package/dist/common/src/util/zod-schema.d.ts +5 -0
  158. package/dist/common/src/utils/dev-phases.d.ts +23 -0
  159. package/dist/common/src/utils/file-lock.d.ts +13 -0
  160. package/dist/common/src/utils/team-analytics.d.ts +16 -0
  161. package/dist/common/src/utils/team-discovery.d.ts +47 -0
  162. package/dist/common/src/utils/team-fs.d.ts +20 -0
  163. package/dist/common/src/utils/team-hook-emitter.d.ts +40 -0
  164. package/dist/common/src/utils/team-presets.d.ts +35 -0
  165. package/dist/index.cjs +2 -1
  166. package/dist/index.cjs.map +3 -3
  167. package/dist/index.mjs +2 -1
  168. package/dist/index.mjs.map +3 -3
  169. package/dist/packages/agent-runtime/src/constants.d.ts +1 -0
  170. package/dist/packages/agent-runtime/src/fast-rewrite.d.ts +45 -0
  171. package/dist/packages/agent-runtime/src/find-files/request-files-prompt.d.ts +71 -0
  172. package/dist/packages/agent-runtime/src/generate-diffs-prompt.d.ts +53 -0
  173. package/dist/packages/agent-runtime/src/get-file-reading-updates.d.ts +8 -0
  174. package/dist/packages/agent-runtime/src/inbox-poller.d.ts +81 -0
  175. package/dist/packages/agent-runtime/src/llm-api/claude.d.ts +5 -0
  176. package/dist/packages/agent-runtime/src/llm-api/context7-api.d.ts +55 -0
  177. package/dist/packages/agent-runtime/src/llm-api/gemini-with-fallbacks.d.ts +40 -0
  178. package/dist/packages/agent-runtime/src/llm-api/levelcode-web-api.d.ts +49 -0
  179. package/dist/packages/agent-runtime/src/llm-api/relace-api.d.ts +16 -0
  180. package/dist/packages/agent-runtime/src/main-prompt.d.ts +29 -0
  181. package/dist/packages/agent-runtime/src/mcp-constants.d.ts +12 -0
  182. package/dist/packages/agent-runtime/src/mcp.d.ts +10 -0
  183. package/dist/packages/agent-runtime/src/message-formatter.d.ts +12 -0
  184. package/dist/packages/agent-runtime/src/process-file-block.d.ts +56 -0
  185. package/dist/packages/agent-runtime/src/process-str-replace.d.ts +21 -0
  186. package/dist/packages/agent-runtime/src/prompt-agent-stream.d.ts +28 -0
  187. package/dist/packages/agent-runtime/src/run-agent-step.d.ts +73 -0
  188. package/dist/packages/agent-runtime/src/run-programmatic-step.d.ts +40 -0
  189. package/dist/packages/agent-runtime/src/system-prompt/prompts.d.ts +19 -0
  190. package/dist/packages/agent-runtime/src/system-prompt/search-system-prompt.d.ts +14 -0
  191. package/dist/packages/agent-runtime/src/system-prompt/team-context-prompt.d.ts +9 -0
  192. package/dist/packages/agent-runtime/src/system-prompt/team-prompt.d.ts +9 -0
  193. package/dist/packages/agent-runtime/src/system-prompt/truncate-file-tree.d.ts +13 -0
  194. package/dist/packages/agent-runtime/src/team-context.d.ts +14 -0
  195. package/dist/packages/agent-runtime/src/templates/agent-registry.d.ts +35 -0
  196. package/dist/packages/agent-runtime/src/templates/prompts.d.ts +35 -0
  197. package/dist/packages/agent-runtime/src/templates/strings.d.ts +32 -0
  198. package/dist/packages/agent-runtime/src/templates/types.d.ts +13 -0
  199. package/dist/packages/agent-runtime/src/tool-stream-parser.d.ts +31 -0
  200. package/dist/packages/agent-runtime/src/tools/handlers/handler-function-type.d.ts +51 -0
  201. package/dist/packages/agent-runtime/src/tools/handlers/list.d.ts +370 -0
  202. package/dist/packages/agent-runtime/src/tools/handlers/tool/add-message.d.ts +9 -0
  203. package/dist/packages/agent-runtime/src/tools/handlers/tool/add-subgoal.d.ts +9 -0
  204. package/dist/packages/agent-runtime/src/tools/handlers/tool/ask-user.d.ts +10 -0
  205. package/dist/packages/agent-runtime/src/tools/handlers/tool/browser-logs.d.ts +8 -0
  206. package/dist/packages/agent-runtime/src/tools/handlers/tool/code-search.d.ts +8 -0
  207. package/dist/packages/agent-runtime/src/tools/handlers/tool/create-plan.d.ts +13 -0
  208. package/dist/packages/agent-runtime/src/tools/handlers/tool/end-turn.d.ts +7 -0
  209. package/dist/packages/agent-runtime/src/tools/handlers/tool/find-files.d.ts +27 -0
  210. package/dist/packages/agent-runtime/src/tools/handlers/tool/glob.d.ts +10 -0
  211. package/dist/packages/agent-runtime/src/tools/handlers/tool/list-directory.d.ts +10 -0
  212. package/dist/packages/agent-runtime/src/tools/handlers/tool/lookup-agent-info.d.ts +14 -0
  213. package/dist/packages/agent-runtime/src/tools/handlers/tool/propose-str-replace.d.ts +15 -0
  214. package/dist/packages/agent-runtime/src/tools/handlers/tool/propose-write-file.d.ts +7 -0
  215. package/dist/packages/agent-runtime/src/tools/handlers/tool/proposed-content-store.d.ts +27 -0
  216. package/dist/packages/agent-runtime/src/tools/handlers/tool/read-docs.d.ts +21 -0
  217. package/dist/packages/agent-runtime/src/tools/handlers/tool/read-files.d.ts +13 -0
  218. package/dist/packages/agent-runtime/src/tools/handlers/tool/read-subtree.d.ts +13 -0
  219. package/dist/packages/agent-runtime/src/tools/handlers/tool/run-file-change-hooks.d.ts +10 -0
  220. package/dist/packages/agent-runtime/src/tools/handlers/tool/run-terminal-command.d.ts +10 -0
  221. package/dist/packages/agent-runtime/src/tools/handlers/tool/send-message.d.ts +15 -0
  222. package/dist/packages/agent-runtime/src/tools/handlers/tool/set-messages.d.ts +9 -0
  223. package/dist/packages/agent-runtime/src/tools/handlers/tool/set-output.d.ts +18 -0
  224. package/dist/packages/agent-runtime/src/tools/handlers/tool/skill.d.ts +11 -0
  225. package/dist/packages/agent-runtime/src/tools/handlers/tool/spawn-agent-inline.d.ts +29 -0
  226. package/dist/packages/agent-runtime/src/tools/handlers/tool/spawn-agent-utils.d.ts +130 -0
  227. package/dist/packages/agent-runtime/src/tools/handlers/tool/spawn-agents.d.ts +37 -0
  228. package/dist/packages/agent-runtime/src/tools/handlers/tool/str-replace.d.ts +16 -0
  229. package/dist/packages/agent-runtime/src/tools/handlers/tool/suggest-followups.d.ts +9 -0
  230. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-completed.d.ts +15 -0
  231. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-create.d.ts +10 -0
  232. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-get.d.ts +10 -0
  233. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-list.d.ts +10 -0
  234. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-update.d.ts +15 -0
  235. package/dist/packages/agent-runtime/src/tools/handlers/tool/team-create.d.ts +15 -0
  236. package/dist/packages/agent-runtime/src/tools/handlers/tool/team-delete.d.ts +15 -0
  237. package/dist/packages/agent-runtime/src/tools/handlers/tool/think-deeply.d.ts +9 -0
  238. package/dist/packages/agent-runtime/src/tools/handlers/tool/update-subgoal.d.ts +11 -0
  239. package/dist/packages/agent-runtime/src/tools/handlers/tool/web-search.d.ts +22 -0
  240. package/dist/packages/agent-runtime/src/tools/handlers/tool/write-file.d.ts +49 -0
  241. package/dist/packages/agent-runtime/src/tools/handlers/tool/write-todos.d.ts +9 -0
  242. package/dist/packages/agent-runtime/src/tools/prompts.d.ts +31 -0
  243. package/dist/packages/agent-runtime/src/tools/stream-parser.d.ts +33 -0
  244. package/dist/packages/agent-runtime/src/tools/tool-executor.d.ts +87 -0
  245. package/dist/packages/agent-runtime/src/util/agent-output.d.ts +3 -0
  246. package/dist/packages/agent-runtime/src/util/messages.d.ts +68 -0
  247. package/dist/packages/agent-runtime/src/util/parse-tool-calls-from-text.d.ts +38 -0
  248. package/dist/packages/agent-runtime/src/util/render-read-files-result.d.ts +15 -0
  249. package/dist/packages/agent-runtime/src/util/simplify-tool-results.d.ts +7 -0
  250. package/dist/packages/agent-runtime/src/util/stream-xml-parser.d.ts +34 -0
  251. package/dist/packages/agent-runtime/src/util/token-counter.d.ts +3 -0
  252. package/dist/packages/code-map/src/index.d.ts +3 -0
  253. package/dist/packages/code-map/src/init-node.d.ts +4 -0
  254. package/dist/packages/code-map/src/languages.d.ts +36 -0
  255. package/dist/packages/code-map/src/parse.d.ts +21 -0
  256. package/dist/packages/code-map/src/types.d.ts +8 -0
  257. package/dist/packages/code-map/src/utils.d.ts +1 -0
  258. package/dist/sdk/src/__tests__/client.test.d.ts +1 -0
  259. package/dist/sdk/src/__tests__/code-search.test.d.ts +1 -0
  260. package/dist/sdk/src/__tests__/credentials.test.d.ts +1 -0
  261. package/dist/sdk/src/__tests__/database.test.d.ts +1 -0
  262. package/dist/sdk/src/__tests__/env.test.d.ts +1 -0
  263. package/dist/sdk/src/__tests__/error-utils.test.d.ts +1 -0
  264. package/dist/sdk/src/__tests__/initial-session-state.test.d.ts +1 -0
  265. package/dist/sdk/src/__tests__/knowledge-file-selection.test.d.ts +1 -0
  266. package/dist/sdk/src/__tests__/load-agents.test.d.ts +1 -0
  267. package/dist/sdk/src/__tests__/load-mcp-config.test.d.ts +1 -0
  268. package/dist/sdk/src/__tests__/model-provider.test.d.ts +1 -0
  269. package/dist/sdk/src/__tests__/read-files.test.d.ts +1 -0
  270. package/dist/sdk/src/__tests__/run-cancellation.test.d.ts +1 -0
  271. package/dist/sdk/src/__tests__/run-file-filter.test.d.ts +1 -0
  272. package/dist/sdk/src/__tests__/run-handle-event.test.d.ts +1 -0
  273. package/dist/sdk/src/__tests__/run.integration.test.d.ts +1 -0
  274. package/dist/sdk/src/__tests__/team-api.test.d.ts +1 -0
  275. package/dist/sdk/src/__tests__/user-knowledge-files.test.d.ts +1 -0
  276. package/dist/sdk/src/__tests__/validate-agents.test.d.ts +1 -0
  277. package/dist/sdk/src/agents/load-agents.d.ts +106 -0
  278. package/dist/sdk/src/agents/load-mcp-config.d.ts +69 -0
  279. package/dist/sdk/src/client.d.ts +71 -0
  280. package/dist/sdk/src/constants.d.ts +4 -0
  281. package/dist/sdk/src/credentials.d.ts +58 -0
  282. package/dist/sdk/src/custom-tool.d.ts +32 -0
  283. package/dist/sdk/src/env.d.ts +31 -0
  284. package/dist/sdk/src/error-utils.d.ts +55 -0
  285. package/dist/sdk/src/impl/__tests__/prompt-result.test.d.ts +1 -0
  286. package/dist/sdk/src/impl/agent-runtime.d.ts +8 -0
  287. package/dist/sdk/src/impl/database.d.ts +7 -0
  288. package/dist/sdk/src/impl/llm.d.ts +8 -0
  289. package/dist/sdk/src/impl/model-provider.d.ts +61 -0
  290. package/dist/sdk/src/index.d.ts +42 -0
  291. package/dist/sdk/src/native/ripgrep.d.ts +7 -0
  292. package/dist/sdk/src/retry-config.d.ts +46 -0
  293. package/dist/sdk/src/run-state.d.ts +81 -0
  294. package/dist/sdk/src/run.d.ts +79 -0
  295. package/dist/sdk/src/skills/load-skills.d.ts +42 -0
  296. package/dist/sdk/src/team.d.ts +49 -0
  297. package/dist/sdk/src/testing/env.d.ts +5 -0
  298. package/dist/sdk/src/tools/change-file.d.ts +7 -0
  299. package/dist/sdk/src/tools/code-search.d.ts +13 -0
  300. package/dist/sdk/src/tools/glob.d.ts +8 -0
  301. package/dist/sdk/src/tools/index.d.ts +16 -0
  302. package/dist/sdk/src/tools/list-directory.d.ts +7 -0
  303. package/dist/sdk/src/tools/read-files.d.ts +16 -0
  304. package/dist/sdk/src/tools/run-file-change-hooks.d.ts +4 -0
  305. package/dist/sdk/src/tools/run-terminal-command.d.ts +8 -0
  306. package/dist/sdk/src/types/env.d.ts +30 -0
  307. package/dist/sdk/src/validate-agents.d.ts +45 -0
  308. package/dist/vendor/ripgrep/arm64-darwin/rg +0 -0
  309. package/dist/vendor/ripgrep/arm64-linux/rg +0 -0
  310. package/dist/vendor/ripgrep/x64-darwin/rg +0 -0
  311. package/dist/vendor/ripgrep/x64-linux/rg +0 -0
  312. package/dist/vendor/ripgrep/x64-win32/rg.exe +0 -0
  313. package/dist/wasm/tree-sitter-c-sharp.wasm +0 -0
  314. package/dist/wasm/tree-sitter-cpp.wasm +0 -0
  315. package/dist/wasm/tree-sitter-go.wasm +0 -0
  316. package/dist/wasm/tree-sitter-java.wasm +0 -0
  317. package/dist/wasm/tree-sitter-javascript.wasm +0 -0
  318. package/dist/wasm/tree-sitter-python.wasm +0 -0
  319. package/dist/wasm/tree-sitter-ruby.wasm +0 -0
  320. package/dist/wasm/tree-sitter-rust.wasm +0 -0
  321. package/dist/wasm/tree-sitter-tsx.wasm +0 -0
  322. package/dist/wasm/tree-sitter-typescript.wasm +0 -0
  323. package/dist/wasm/tree-sitter.wasm +0 -0
  324. package/package.json +1 -1
@@ -0,0 +1,87 @@
1
+ import type { AgentTemplate } from '../templates/types';
2
+ import type { FileProcessingState } from './handlers/tool/write-file';
3
+ import type { ToolName } from '@levelcode/common/tools/constants';
4
+ import type { LevelCodeToolCall } from '@levelcode/common/tools/list';
5
+ import type { AgentRuntimeDeps, AgentRuntimeScopedDeps } from '@levelcode/common/types/contracts/agent-runtime';
6
+ import type { Logger } from '@levelcode/common/types/contracts/logger';
7
+ import type { ToolMessage } from '@levelcode/common/types/messages/levelcode-message';
8
+ import type { PrintModeEvent } from '@levelcode/common/types/print-mode';
9
+ import type { AgentTemplateType, AgentState, Subgoal } from '@levelcode/common/types/session-state';
10
+ import type { CustomToolDefinitions, ProjectFileContext } from '@levelcode/common/util/file';
11
+ import type { ToolCallPart, ToolSet } from 'ai';
12
+ export type CustomToolCall = {
13
+ toolName: string;
14
+ input: Record<string, unknown>;
15
+ } & Omit<ToolCallPart, 'type'>;
16
+ export type ToolCallError = {
17
+ toolName?: string;
18
+ input: Record<string, unknown>;
19
+ error: string;
20
+ } & Pick<LevelCodeToolCall, 'toolCallId'>;
21
+ export declare function parseRawToolCall<T extends ToolName = ToolName>(params: {
22
+ rawToolCall: {
23
+ toolName: T;
24
+ toolCallId: string;
25
+ input: Record<string, unknown>;
26
+ };
27
+ }): LevelCodeToolCall<T> | ToolCallError;
28
+ export type ExecuteToolCallParams<T extends string = ToolName> = {
29
+ toolName: T;
30
+ input: Record<string, unknown>;
31
+ autoInsertEndStepParam?: boolean;
32
+ excludeToolFromMessageHistory?: boolean;
33
+ agentContext: Record<string, Subgoal>;
34
+ agentState: AgentState;
35
+ agentStepId: string;
36
+ ancestorRunIds: string[];
37
+ agentTemplate: AgentTemplate;
38
+ clientSessionId: string;
39
+ fileContext: ProjectFileContext;
40
+ fileProcessingState: FileProcessingState;
41
+ fingerprintId: string;
42
+ fromHandleSteps?: boolean;
43
+ fullResponse: string;
44
+ localAgentTemplates: Record<string, AgentTemplate>;
45
+ logger: Logger;
46
+ previousToolCallFinished: Promise<void>;
47
+ prompt: string | undefined;
48
+ repoId: string | undefined;
49
+ repoUrl: string | undefined;
50
+ runId: string;
51
+ signal: AbortSignal;
52
+ system: string;
53
+ tools: ToolSet;
54
+ toolCallId: string | undefined;
55
+ toolCalls: (LevelCodeToolCall | CustomToolCall)[];
56
+ toolResults: ToolMessage[];
57
+ toolResultsToAddAfterStream: ToolMessage[];
58
+ skipDirectResultPush?: boolean;
59
+ userId: string | undefined;
60
+ userInputId: string;
61
+ fetch: typeof globalThis.fetch;
62
+ onCostCalculated: (credits: number) => Promise<void>;
63
+ onResponseChunk: (chunk: string | PrintModeEvent) => void;
64
+ } & AgentRuntimeDeps & AgentRuntimeScopedDeps;
65
+ export declare function executeToolCall<T extends ToolName>(params: ExecuteToolCallParams<T>): Promise<void>;
66
+ export declare function parseRawCustomToolCall(params: {
67
+ customToolDefs: CustomToolDefinitions;
68
+ rawToolCall: {
69
+ toolName: string;
70
+ toolCallId: string;
71
+ input: Record<string, unknown>;
72
+ };
73
+ autoInsertEndStepParam?: boolean;
74
+ }): CustomToolCall | ToolCallError;
75
+ export declare function executeCustomToolCall(params: ExecuteToolCallParams<string>): Promise<void>;
76
+ /**
77
+ * Checks if a tool name matches a spawnable agent and returns the transformed
78
+ * spawn_agents input if so. Returns null if not an agent tool call.
79
+ */
80
+ export declare function tryTransformAgentToolCall(params: {
81
+ toolName: string;
82
+ input: Record<string, unknown>;
83
+ spawnableAgents: AgentTemplateType[];
84
+ }): {
85
+ toolName: 'spawn_agents';
86
+ input: Record<string, unknown>;
87
+ } | null;
@@ -0,0 +1,3 @@
1
+ import type { AgentTemplate } from '@levelcode/common/types/agent-template';
2
+ import type { AgentState, AgentOutput } from '@levelcode/common/types/session-state';
3
+ export declare function getAgentOutput(agentState: AgentState, agentTemplate: AgentTemplate): AgentOutput;
@@ -0,0 +1,68 @@
1
+ import type { System } from '../llm-api/claude';
2
+ import type { Logger } from '@levelcode/common/types/contracts/logger';
3
+ import type { Message } from '@levelcode/common/types/messages/levelcode-message';
4
+ import type { TextPart, ImagePart } from '@levelcode/common/types/messages/content-part';
5
+ export declare function messagesWithSystem(params: {
6
+ messages: Message[];
7
+ system: System;
8
+ }): Message[];
9
+ export declare function asUserMessage(str: string): string;
10
+ /**
11
+ * Combines prompt, params, and content into a unified message content structure.
12
+ * Always wraps the first text part in <user_message> tags for consistent XML framing.
13
+ * If you need a specific text part wrapped, put it first or pre-wrap it yourself before calling.
14
+ */
15
+ export declare function buildUserMessageContent(prompt: string | undefined, params: Record<string, any> | undefined, content?: Array<TextPart | ImagePart>): Array<TextPart | ImagePart>;
16
+ export declare function parseUserMessage(str: string): string | undefined;
17
+ export declare function withSystemInstructionTags(str: string): string;
18
+ export declare function withSystemTags(str: string): string;
19
+ export declare function castAssistantMessage(message: Message): Message | null;
20
+ /**
21
+ * Trims messages from the beginning to fit within token limits while preserving
22
+ * important content. Also simplifies terminal command outputs to save tokens.
23
+ *
24
+ * The function:
25
+ * 1. Processes messages from newest to oldest
26
+ * 2. Simplifies terminal command outputs after keeping N most recent ones
27
+ * 3. Stops adding messages when approaching token limit
28
+ *
29
+ * @param messages - Array of messages to trim
30
+ * @param systemTokens - Number of tokens used by system prompt
31
+ * @param maxTotalTokens - Maximum total tokens allowed, defaults to 200k
32
+ * @returns Trimmed array of messages that fits within token limit
33
+ */
34
+ export declare function trimMessagesToFitTokenLimit(params: {
35
+ messages: Message[];
36
+ systemTokens: number;
37
+ maxTotalTokens?: number;
38
+ logger: Logger;
39
+ }): Message[];
40
+ export declare function getMessagesSubset(params: {
41
+ messages: Message[];
42
+ otherTokens: number;
43
+ logger: Logger;
44
+ }): Message[];
45
+ export declare function expireMessages(messages: Message[], endOf: 'agentStep' | 'userPrompt'): Message[];
46
+ /**
47
+ * Removes tool calls from the message history that don't have corresponding tool responses.
48
+ * This is important when passing message history to spawned agents, as unfinished tool calls
49
+ * will cause issues with the LLM expecting tool responses.
50
+ *
51
+ * The function:
52
+ * 1. Collects all toolCallIds from tool response messages
53
+ * 2. Filters assistant messages to remove tool-call content parts without responses
54
+ * 3. Removes assistant messages that become empty after filtering
55
+ */
56
+ export declare function filterUnfinishedToolCalls(messages: Message[]): Message[];
57
+ export declare function getEditedFiles(params: {
58
+ messages: Message[];
59
+ logger: Logger;
60
+ }): string[];
61
+ export declare function getPreviouslyReadFiles(params: {
62
+ messages: Message[];
63
+ logger: Logger;
64
+ }): {
65
+ path: string;
66
+ content: string;
67
+ referencedBy?: Record<string, string[]>;
68
+ }[];
@@ -0,0 +1,38 @@
1
+ export type ParsedToolCallFromText = {
2
+ type: 'tool_call';
3
+ toolName: string;
4
+ input: Record<string, unknown>;
5
+ };
6
+ export type ParsedTextSegment = {
7
+ type: 'text';
8
+ text: string;
9
+ };
10
+ export type ParsedSegment = ParsedToolCallFromText | ParsedTextSegment;
11
+ /**
12
+ * Parses text containing tool calls in the <levelcode_tool_call> XML format,
13
+ * returning interleaved text and tool call segments in order.
14
+ *
15
+ * Example input:
16
+ * ```
17
+ * Some text before
18
+ * <levelcode_tool_call>
19
+ * {
20
+ * "cb_tool_name": "read_files",
21
+ * "paths": ["file.ts"]
22
+ * }
23
+ * </levelcode_tool_call>
24
+ * Some text after
25
+ * ```
26
+ *
27
+ * @param text - The text containing tool calls in XML format
28
+ * @returns Array of segments (text and tool calls) in order of appearance
29
+ */
30
+ export declare function parseTextWithToolCalls(text: string): ParsedSegment[];
31
+ /**
32
+ * Parses tool calls from text in the <levelcode_tool_call> XML format.
33
+ * This is a convenience function that returns only tool calls (no text segments).
34
+ *
35
+ * @param text - The text containing tool calls in XML format
36
+ * @returns Array of parsed tool calls with toolName and input
37
+ */
38
+ export declare function parseToolCallsFromText(text: string): Omit<ParsedToolCallFromText, 'type'>[];
@@ -0,0 +1,15 @@
1
+ export interface TokenCallerMap {
2
+ [filePath: string]: {
3
+ [token: string]: string[];
4
+ };
5
+ }
6
+ export declare function renderReadFilesResult(files: {
7
+ path: string;
8
+ content: string;
9
+ }[], tokenCallers: TokenCallerMap): {
10
+ path: string;
11
+ content: string;
12
+ referencedBy: {
13
+ [token: string]: string[];
14
+ };
15
+ }[];
@@ -0,0 +1,7 @@
1
+ import type { LevelCodeToolOutput } from '@levelcode/common/tools/list';
2
+ import type { Logger } from '@levelcode/common/types/contracts/logger';
3
+ export declare function simplifyReadFileResults(messageContent: LevelCodeToolOutput<'read_files'>): LevelCodeToolOutput<'read_files'>;
4
+ export declare function simplifyTerminalCommandResults(params: {
5
+ messageContent: LevelCodeToolOutput<'run_terminal_command'>;
6
+ logger: Logger;
7
+ }): LevelCodeToolOutput<'run_terminal_command'>;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Stateful stream XML parser that extracts tool calls from <levelcode_tool_call> XML
3
+ * and filters them out of the text stream.
4
+ *
5
+ * Handles partial tags at chunk boundaries using a stateful approach.
6
+ */
7
+ export type ParsedToolCall = {
8
+ toolName: string;
9
+ input: Record<string, unknown>;
10
+ };
11
+ export type StreamParserState = {
12
+ /** Buffer for holding partial content when inside a tool call tag or at boundaries */
13
+ buffer: string;
14
+ /** Whether we're currently inside a tool call tag */
15
+ insideToolCall: boolean;
16
+ };
17
+ export type ParseResult = {
18
+ /** Filtered text with tool call XML removed */
19
+ filteredText: string;
20
+ /** Tool calls extracted from this chunk */
21
+ toolCalls: ParsedToolCall[];
22
+ };
23
+ /**
24
+ * Creates initial parser state
25
+ */
26
+ export declare function createStreamParserState(): StreamParserState;
27
+ /**
28
+ * Parses a stream chunk, extracting tool calls and filtering out the XML.
29
+ *
30
+ * @param chunk - The incoming text chunk
31
+ * @param state - Mutable parser state (updated in place)
32
+ * @returns Filtered text and any extracted tool calls
33
+ */
34
+ export declare function parseStreamChunk(chunk: string, state: StreamParserState): ParseResult;
@@ -0,0 +1,3 @@
1
+ export declare function countTokens(text: string): number;
2
+ export declare function countTokensJson(text: string | object): number;
3
+ export declare function countTokensForFiles(files: Record<string, string | null>): Record<string, number>;
@@ -0,0 +1,3 @@
1
+ import './types';
2
+ export * from './parse';
3
+ export * from './languages';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Initialize web-tree-sitter for Node.js environments with proper WASM file location
3
+ */
4
+ export declare function initTreeSitterForNode(): Promise<void>;
@@ -0,0 +1,36 @@
1
+ import './types';
2
+ import { Language, Parser, Query } from 'web-tree-sitter';
3
+ export interface LanguageConfig {
4
+ extensions: string[];
5
+ wasmFile: string;
6
+ queryPathOrContent: string;
7
+ parser?: Parser;
8
+ query?: Query;
9
+ language?: Language;
10
+ }
11
+ export interface RuntimeLanguageLoader {
12
+ loadLanguage(wasmFile: string): Promise<Language>;
13
+ initParser(): Promise<void>;
14
+ }
15
+ export declare const WASM_FILES: {
16
+ readonly 'tree-sitter-c-sharp.wasm': "tree-sitter-c-sharp.wasm";
17
+ readonly 'tree-sitter-cpp.wasm': "tree-sitter-cpp.wasm";
18
+ readonly 'tree-sitter-go.wasm': "tree-sitter-go.wasm";
19
+ readonly 'tree-sitter-java.wasm': "tree-sitter-java.wasm";
20
+ readonly 'tree-sitter-javascript.wasm': "tree-sitter-javascript.wasm";
21
+ readonly 'tree-sitter-python.wasm': "tree-sitter-python.wasm";
22
+ readonly 'tree-sitter-ruby.wasm': "tree-sitter-ruby.wasm";
23
+ readonly 'tree-sitter-rust.wasm': "tree-sitter-rust.wasm";
24
+ readonly 'tree-sitter-tsx.wasm': "tree-sitter-tsx.wasm";
25
+ readonly 'tree-sitter-typescript.wasm': "tree-sitter-typescript.wasm";
26
+ };
27
+ export declare const languageTable: LanguageConfig[];
28
+ /**
29
+ * Set a custom WASM directory for loading tree-sitter WASM files.
30
+ * This can be useful for custom packaging or deployment scenarios.
31
+ */
32
+ export declare function setWasmDir(dir: string): void;
33
+ export declare function getWasmDir(): string | undefined;
34
+ export declare function findLanguageConfigByExtension(filePath: string): LanguageConfig | undefined;
35
+ export declare function createLanguageConfig(filePath: string, runtimeLoader: RuntimeLanguageLoader): Promise<LanguageConfig | undefined>;
36
+ export declare function getLanguageConfig(filePath: string): Promise<LanguageConfig | undefined>;
@@ -0,0 +1,21 @@
1
+ import type { LanguageConfig } from './languages';
2
+ export declare const DEBUG_PARSING = false;
3
+ export interface TokenCallerMap {
4
+ [filePath: string]: {
5
+ [token: string]: string[];
6
+ };
7
+ }
8
+ export interface FileTokenData {
9
+ tokenScores: {
10
+ [filePath: string]: {
11
+ [token: string]: number;
12
+ };
13
+ };
14
+ tokenCallers: TokenCallerMap;
15
+ }
16
+ export declare function getFileTokenScores(projectRoot: string, filePaths: string[], readFile?: (filePath: string) => string | null): Promise<FileTokenData>;
17
+ export declare function parseTokens(filePath: string, languageConfig: LanguageConfig, readFile?: (filePath: string) => string | null): {
18
+ numLines: number;
19
+ identifiers: string[];
20
+ calls: string[];
21
+ };
@@ -0,0 +1,8 @@
1
+ declare module '@vscode/tree-sitter-wasm/wasm/*.wasm' {
2
+ const content: string;
3
+ export default content;
4
+ }
5
+ declare module '*.scm' {
6
+ const content: string;
7
+ export default content;
8
+ }
@@ -0,0 +1 @@
1
+ export declare function getDirnameDynamically(): string | undefined;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,106 @@
1
+ import type { AgentDefinition } from '@levelcode/common/templates/initial-agents-dir/types/agent-definition';
2
+ /**
3
+ * Agent definition with source file path metadata.
4
+ */
5
+ export type LoadedAgentDefinition = AgentDefinition & {
6
+ /** The file path this agent was loaded from */
7
+ _sourceFilePath: string;
8
+ };
9
+ /**
10
+ * Loaded agent definitions keyed by agent ID.
11
+ */
12
+ export type LoadedAgents = Record<string, LoadedAgentDefinition>;
13
+ /**
14
+ * Resolves environment variable references in MCP server configs.
15
+ * Values starting with `$` are treated as env var references (e.g., `'$NOTION_TOKEN'`).
16
+ *
17
+ * @param env - The env object from MCP config with possible $VAR_NAME references
18
+ * @param agentId - The agent ID for error messages
19
+ * @param mcpServerName - The MCP server name for error messages
20
+ * @returns Resolved env object with all $VAR_NAME values replaced with actual values
21
+ * @throws Error if a referenced environment variable is missing
22
+ */
23
+ export declare function resolveMcpEnv(env: Record<string, string> | undefined, agentId: string, mcpServerName: string): Record<string, string>;
24
+ /**
25
+ * Resolves all MCP server env references in an agent definition.
26
+ * Mutates the mcpServers object to replace $VAR_NAME references with resolved values.
27
+ *
28
+ * @param agent - The agent definition to process
29
+ * @throws Error if any referenced environment variable is missing
30
+ */
31
+ export declare function resolveAgentMcpEnv(agent: AgentDefinition): void;
32
+ /**
33
+ * Validation error for an agent that failed validation.
34
+ */
35
+ export type AgentValidationError = {
36
+ /** The agent's ID */
37
+ agentId: string;
38
+ /** The source file path where the agent was loaded from */
39
+ filePath: string;
40
+ /** The validation error message */
41
+ message: string;
42
+ };
43
+ /**
44
+ * Result returned by loadLocalAgents when validate: true.
45
+ * Contains both the valid agents and any validation errors.
46
+ */
47
+ export type LoadLocalAgentsResult = {
48
+ /** Valid agent definitions that passed validation */
49
+ agents: LoadedAgents;
50
+ /** Validation errors for agents that failed validation */
51
+ validationErrors: AgentValidationError[];
52
+ };
53
+ /**
54
+ * Load agent definitions from `.agents` directories.
55
+ *
56
+ * By default, searches for agents in:
57
+ * - `{cwd}/.agents`
58
+ * - `{cwd}/../.agents`
59
+ * - `{homedir}/.agents`
60
+ *
61
+ * Agent files can be `.ts`, `.tsx`, `.js`, `.mjs`, or `.cjs`.
62
+ * TypeScript files are loaded natively by Bun's runtime.
63
+ *
64
+ * @param options.agentsPath - Optional path to a specific agents directory
65
+ * @param options.verbose - Whether to log errors during loading
66
+ * @param options.validate - Whether to validate agents after loading
67
+ * @returns When validate is false/omitted: Record of agent definitions keyed by agent ID.
68
+ * When validate is true: Object with valid agents and validation errors.
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * // Load from default locations
73
+ * const agents = await loadLocalAgents({ verbose: true })
74
+ *
75
+ * // Load from a specific directory
76
+ * const agents = await loadLocalAgents({ agentsPath: './my-agents' })
77
+ *
78
+ * // Load and validate agents - returns both valid agents and errors
79
+ * const { agents, validationErrors } = await loadLocalAgents({ validate: true })
80
+ * if (validationErrors.length > 0) {
81
+ * console.error('Some agents failed validation:', validationErrors)
82
+ * }
83
+ *
84
+ * // Access source file path for debugging
85
+ * for (const agent of Object.values(agents)) {
86
+ * console.log(`${agent.id} loaded from ${agent._sourceFilePath}`)
87
+ * }
88
+ *
89
+ * // Use with client.run()
90
+ * const result = await client.run({
91
+ * agent: 'my-agent',
92
+ * agentDefinitions: Object.values(agents),
93
+ * prompt: 'Hello',
94
+ * })
95
+ * ```
96
+ */
97
+ export declare function loadLocalAgents(options: {
98
+ agentsPath?: string;
99
+ verbose?: boolean;
100
+ validate: true;
101
+ }): Promise<LoadLocalAgentsResult>;
102
+ export declare function loadLocalAgents(options: {
103
+ agentsPath?: string;
104
+ verbose?: boolean;
105
+ validate?: false;
106
+ }): Promise<LoadedAgents>;
@@ -0,0 +1,69 @@
1
+ import { z } from 'zod/v4';
2
+ import type { MCPConfig } from '@levelcode/common/types/mcp';
3
+ /**
4
+ * Schema for the mcp.json file format.
5
+ * Matches the standard MCP config format used by Claude Code, Cursor, etc.
6
+ */
7
+ export declare const mcpFileSchema: z.ZodObject<{
8
+ mcpServers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
9
+ type: z.ZodDefault<z.ZodEnum<{
10
+ http: "http";
11
+ sse: "sse";
12
+ }>>;
13
+ url: z.ZodString;
14
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
15
+ headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
16
+ }, z.core.$strict>, z.ZodObject<{
17
+ type: z.ZodDefault<z.ZodLiteral<"stdio">>;
18
+ command: z.ZodString;
19
+ args: z.ZodDefault<z.ZodArray<z.ZodString>>;
20
+ env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
21
+ }, z.core.$strict>]>>>;
22
+ }, z.core.$strip>;
23
+ export type MCPFileConfig = z.infer<typeof mcpFileSchema>;
24
+ /**
25
+ * Loaded MCP configuration with resolved environment variables.
26
+ */
27
+ export type LoadedMCPConfig = {
28
+ mcpServers: Record<string, MCPConfig>;
29
+ /** The file path this config was loaded from */
30
+ _sourceFilePath: string;
31
+ };
32
+ /**
33
+ * Load MCP configuration from `mcp.json` files in `.agents` directories.
34
+ *
35
+ * By default, searches for mcp.json in:
36
+ * - `{cwd}/.agents/mcp.json`
37
+ * - `{cwd}/../.agents/mcp.json`
38
+ * - `{homedir}/.agents/mcp.json`
39
+ *
40
+ * Later directories take precedence, so project MCP servers override global ones.
41
+ * Environment variable references (e.g., `$API_KEY`) are resolved from process.env.
42
+ *
43
+ * @param options.verbose - Whether to log errors during loading
44
+ * @returns Record of MCP server configurations keyed by server name
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * // Load from default locations
49
+ * const mcpConfig = await loadMCPConfig({ verbose: true })
50
+ *
51
+ * // Access MCP servers
52
+ * for (const [serverName, config] of Object.entries(mcpConfig.mcpServers)) {
53
+ * console.log(`MCP server: ${serverName}`)
54
+ * }
55
+ * ```
56
+ */
57
+ export declare function loadMCPConfig(options: {
58
+ verbose?: boolean;
59
+ }): Promise<LoadedMCPConfig>;
60
+ /**
61
+ * Synchronously load MCP configuration from `mcp.json` files in `.agents` directories.
62
+ * This is a sync version for use in contexts where async is not available.
63
+ *
64
+ * @param options.verbose - Whether to log errors during loading
65
+ * @returns Record of MCP server configurations keyed by server name
66
+ */
67
+ export declare function loadMCPConfigSync(options: {
68
+ verbose?: boolean;
69
+ }): LoadedMCPConfig;