@levelcode/sdk 0.2.3 → 0.2.5

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/index.cjs +493 -289
  2. package/dist/index.cjs.map +8 -7
  3. package/dist/index.mjs +564 -360
  4. package/dist/index.mjs.map +8 -7
  5. package/package.json +1 -1
  6. package/dist/agents/constants.d.ts +0 -1
  7. package/dist/agents/team/apprentice.d.ts +0 -3
  8. package/dist/agents/team/coordinator.d.ts +0 -3
  9. package/dist/agents/team/cto.d.ts +0 -3
  10. package/dist/agents/team/designer.d.ts +0 -3
  11. package/dist/agents/team/director.d.ts +0 -3
  12. package/dist/agents/team/distinguished-engineer.d.ts +0 -3
  13. package/dist/agents/team/fellow.d.ts +0 -3
  14. package/dist/agents/team/index.d.ts +0 -27
  15. package/dist/agents/team/intern.d.ts +0 -3
  16. package/dist/agents/team/junior-engineer.d.ts +0 -3
  17. package/dist/agents/team/manager.d.ts +0 -3
  18. package/dist/agents/team/mid-level-engineer.d.ts +0 -3
  19. package/dist/agents/team/principal-engineer.d.ts +0 -3
  20. package/dist/agents/team/product-lead.d.ts +0 -3
  21. package/dist/agents/team/researcher.d.ts +0 -3
  22. package/dist/agents/team/role-hierarchy.d.ts +0 -24
  23. package/dist/agents/team/scientist.d.ts +0 -3
  24. package/dist/agents/team/senior-engineer.d.ts +0 -3
  25. package/dist/agents/team/senior-staff-engineer.d.ts +0 -3
  26. package/dist/agents/team/staff-engineer.d.ts +0 -3
  27. package/dist/agents/team/sub-manager.d.ts +0 -3
  28. package/dist/agents/team/tester.d.ts +0 -3
  29. package/dist/agents/team/vp-engineering.d.ts +0 -3
  30. package/dist/agents/types/agent-definition.d.ts +0 -296
  31. package/dist/agents/types/secret-agent-definition.d.ts +0 -19
  32. package/dist/agents/types/tools.d.ts +0 -308
  33. package/dist/agents/types/util-types.d.ts +0 -134
  34. package/dist/common/src/actions.d.ts +0 -176
  35. package/dist/common/src/analytics-core.d.ts +0 -52
  36. package/dist/common/src/analytics.d.ts +0 -9
  37. package/dist/common/src/browser-actions.d.ts +0 -1200
  38. package/dist/common/src/constants/agents.d.ts +0 -47
  39. package/dist/common/src/constants/analytics-events.d.ts +0 -111
  40. package/dist/common/src/constants/byok.d.ts +0 -2
  41. package/dist/common/src/constants/claude-oauth.d.ts +0 -36
  42. package/dist/common/src/constants/index.d.ts +0 -4
  43. package/dist/common/src/constants/knowledge.d.ts +0 -21
  44. package/dist/common/src/constants/limits.d.ts +0 -14
  45. package/dist/common/src/constants/model-config.d.ts +0 -117
  46. package/dist/common/src/constants/paths.d.ts +0 -23
  47. package/dist/common/src/constants/skills.d.ts +0 -42
  48. package/dist/common/src/constants/ui.d.ts +0 -14
  49. package/dist/common/src/env-ci.d.ts +0 -22
  50. package/dist/common/src/env-process.d.ts +0 -28
  51. package/dist/common/src/env-schema.d.ts +0 -24
  52. package/dist/common/src/env.d.ts +0 -16
  53. package/dist/common/src/mcp/client.d.ts +0 -6
  54. package/dist/common/src/old-constants.d.ts +0 -10
  55. package/dist/common/src/project-file-tree.d.ts +0 -27
  56. package/dist/common/src/templates/agent-validation.d.ts +0 -48
  57. package/dist/common/src/templates/initial-agents-dir/types/agent-definition.d.ts +0 -296
  58. package/dist/common/src/templates/initial-agents-dir/types/tools.d.ts +0 -308
  59. package/dist/common/src/templates/initial-agents-dir/types/util-types.d.ts +0 -128
  60. package/dist/common/src/testing/errors.d.ts +0 -14
  61. package/dist/common/src/testing/mock-modules.d.ts +0 -11
  62. package/dist/common/src/testing/mock-types.d.ts +0 -97
  63. package/dist/common/src/testing/mocks/analytics.d.ts +0 -182
  64. package/dist/common/src/testing/mocks/child-process.d.ts +0 -29
  65. package/dist/common/src/testing/mocks/crypto.d.ts +0 -159
  66. package/dist/common/src/testing/mocks/database.d.ts +0 -197
  67. package/dist/common/src/testing/mocks/fetch.d.ts +0 -35
  68. package/dist/common/src/testing/mocks/filesystem.d.ts +0 -31
  69. package/dist/common/src/testing/mocks/index.d.ts +0 -25
  70. package/dist/common/src/testing/mocks/logger.d.ts +0 -35
  71. package/dist/common/src/testing/mocks/stream.d.ts +0 -203
  72. package/dist/common/src/testing/mocks/timers.d.ts +0 -27
  73. package/dist/common/src/testing/mocks/tree-sitter.d.ts +0 -58
  74. package/dist/common/src/testing-env-process.d.ts +0 -7
  75. package/dist/common/src/tools/constants.d.ts +0 -17
  76. package/dist/common/src/tools/list.d.ts +0 -1152
  77. package/dist/common/src/tools/params/tool/add-message.d.ts +0 -19
  78. package/dist/common/src/tools/params/tool/add-subgoal.d.ts +0 -26
  79. package/dist/common/src/tools/params/tool/ask-user.d.ts +0 -59
  80. package/dist/common/src/tools/params/tool/browser-logs.d.ts +0 -127
  81. package/dist/common/src/tools/params/tool/code-search.d.ts +0 -30
  82. package/dist/common/src/tools/params/tool/create-plan.d.ts +0 -30
  83. package/dist/common/src/tools/params/tool/end-turn.d.ts +0 -13
  84. package/dist/common/src/tools/params/tool/find-files.d.ts +0 -31
  85. package/dist/common/src/tools/params/tool/glob.d.ts +0 -26
  86. package/dist/common/src/tools/params/tool/list-directory.d.ts +0 -25
  87. package/dist/common/src/tools/params/tool/lookup-agent-info.d.ts +0 -13
  88. package/dist/common/src/tools/params/tool/propose-str-replace.d.ts +0 -40
  89. package/dist/common/src/tools/params/tool/propose-write-file.d.ts +0 -29
  90. package/dist/common/src/tools/params/tool/read-docs.d.ts +0 -19
  91. package/dist/common/src/tools/params/tool/read-files.d.ts +0 -35
  92. package/dist/common/src/tools/params/tool/read-subtree.d.ts +0 -40
  93. package/dist/common/src/tools/params/tool/run-file-change-hooks.d.ts +0 -63
  94. package/dist/common/src/tools/params/tool/run-terminal-command.d.ts +0 -88
  95. package/dist/common/src/tools/params/tool/send-message.d.ts +0 -26
  96. package/dist/common/src/tools/params/tool/set-messages.d.ts +0 -15
  97. package/dist/common/src/tools/params/tool/set-output.d.ts +0 -15
  98. package/dist/common/src/tools/params/tool/skill.d.ts +0 -28
  99. package/dist/common/src/tools/params/tool/spawn-agent-inline.d.ts +0 -17
  100. package/dist/common/src/tools/params/tool/spawn-agents.d.ts +0 -26
  101. package/dist/common/src/tools/params/tool/str-replace.d.ts +0 -43
  102. package/dist/common/src/tools/params/tool/suggest-followups.d.ts +0 -26
  103. package/dist/common/src/tools/params/tool/task-completed.d.ts +0 -13
  104. package/dist/common/src/tools/params/tool/task-create.d.ts +0 -24
  105. package/dist/common/src/tools/params/tool/task-get.d.ts +0 -15
  106. package/dist/common/src/tools/params/tool/task-list.d.ts +0 -13
  107. package/dist/common/src/tools/params/tool/task-update.d.ts +0 -29
  108. package/dist/common/src/tools/params/tool/team-create.d.ts +0 -17
  109. package/dist/common/src/tools/params/tool/team-delete.d.ts +0 -13
  110. package/dist/common/src/tools/params/tool/think-deeply.d.ts +0 -15
  111. package/dist/common/src/tools/params/tool/update-subgoal.d.ts +0 -25
  112. package/dist/common/src/tools/params/tool/web-search.d.ts +0 -25
  113. package/dist/common/src/tools/params/tool/write-file.d.ts +0 -31
  114. package/dist/common/src/tools/params/tool/write-todos.d.ts +0 -18
  115. package/dist/common/src/tools/params/utils.d.ts +0 -35
  116. package/dist/common/src/tools/utils.d.ts +0 -4
  117. package/dist/common/src/types/agent-template.d.ts +0 -156
  118. package/dist/common/src/types/contracts/agent-runtime.d.ts +0 -36
  119. package/dist/common/src/types/contracts/analytics.d.ts +0 -8
  120. package/dist/common/src/types/contracts/billing.d.ts +0 -40
  121. package/dist/common/src/types/contracts/client.d.ts +0 -45
  122. package/dist/common/src/types/contracts/database.d.ts +0 -80
  123. package/dist/common/src/types/contracts/env.d.ts +0 -150
  124. package/dist/common/src/types/contracts/llm.d.ts +0 -102
  125. package/dist/common/src/types/contracts/logger.d.ts +0 -8
  126. package/dist/common/src/types/dynamic-agent-template.d.ts +0 -227
  127. package/dist/common/src/types/filesystem.d.ts +0 -6
  128. package/dist/common/src/types/function-params.d.ts +0 -15
  129. package/dist/common/src/types/grant.d.ts +0 -2
  130. package/dist/common/src/types/json.d.ts +0 -9
  131. package/dist/common/src/types/mcp.d.ts +0 -31
  132. package/dist/common/src/types/messages/content-part.d.ts +0 -46
  133. package/dist/common/src/types/messages/data-content.d.ts +0 -3
  134. package/dist/common/src/types/messages/levelcode-message.d.ts +0 -37
  135. package/dist/common/src/types/messages/provider-metadata.d.ts +0 -3
  136. package/dist/common/src/types/print-mode.d.ts +0 -155
  137. package/dist/common/src/types/session-state.d.ts +0 -94
  138. package/dist/common/src/types/skill.d.ts +0 -31
  139. package/dist/common/src/types/source.d.ts +0 -8
  140. package/dist/common/src/types/spawn.d.ts +0 -8
  141. package/dist/common/src/types/team-config-schemas.d.ts +0 -217
  142. package/dist/common/src/types/team-config.d.ts +0 -42
  143. package/dist/common/src/types/team-hook-events.d.ts +0 -36
  144. package/dist/common/src/types/team-protocol.d.ts +0 -64
  145. package/dist/common/src/util/agent-id-parsing.d.ts +0 -22
  146. package/dist/common/src/util/agent-name-normalization.d.ts +0 -12
  147. package/dist/common/src/util/array.d.ts +0 -6
  148. package/dist/common/src/util/credentials.d.ts +0 -11
  149. package/dist/common/src/util/error.d.ts +0 -128
  150. package/dist/common/src/util/file.d.ts +0 -133
  151. package/dist/common/src/util/format-code-search.d.ts +0 -16
  152. package/dist/common/src/util/lru-cache.d.ts +0 -30
  153. package/dist/common/src/util/messages.d.ts +0 -46
  154. package/dist/common/src/util/model-utils.d.ts +0 -8
  155. package/dist/common/src/util/object.d.ts +0 -22
  156. package/dist/common/src/util/promise.d.ts +0 -16
  157. package/dist/common/src/util/random.d.ts +0 -1
  158. package/dist/common/src/util/skills.d.ts +0 -5
  159. package/dist/common/src/util/stop-sequence.d.ts +0 -14
  160. package/dist/common/src/util/string.d.ts +0 -82
  161. package/dist/common/src/util/xml.d.ts +0 -12
  162. package/dist/common/src/util/zod-schema.d.ts +0 -5
  163. package/dist/common/src/utils/dev-phases.d.ts +0 -23
  164. package/dist/common/src/utils/file-lock.d.ts +0 -13
  165. package/dist/common/src/utils/team-analytics.d.ts +0 -16
  166. package/dist/common/src/utils/team-discovery.d.ts +0 -47
  167. package/dist/common/src/utils/team-fs.d.ts +0 -20
  168. package/dist/common/src/utils/team-hook-emitter.d.ts +0 -40
  169. package/dist/common/src/utils/team-presets.d.ts +0 -35
  170. package/dist/packages/agent-runtime/src/constants.d.ts +0 -1
  171. package/dist/packages/agent-runtime/src/fast-rewrite.d.ts +0 -45
  172. package/dist/packages/agent-runtime/src/find-files/request-files-prompt.d.ts +0 -71
  173. package/dist/packages/agent-runtime/src/generate-diffs-prompt.d.ts +0 -53
  174. package/dist/packages/agent-runtime/src/get-file-reading-updates.d.ts +0 -8
  175. package/dist/packages/agent-runtime/src/inbox-poller.d.ts +0 -81
  176. package/dist/packages/agent-runtime/src/llm-api/claude.d.ts +0 -5
  177. package/dist/packages/agent-runtime/src/llm-api/context7-api.d.ts +0 -55
  178. package/dist/packages/agent-runtime/src/llm-api/gemini-with-fallbacks.d.ts +0 -40
  179. package/dist/packages/agent-runtime/src/llm-api/levelcode-web-api.d.ts +0 -49
  180. package/dist/packages/agent-runtime/src/llm-api/relace-api.d.ts +0 -16
  181. package/dist/packages/agent-runtime/src/main-prompt.d.ts +0 -29
  182. package/dist/packages/agent-runtime/src/mcp-constants.d.ts +0 -12
  183. package/dist/packages/agent-runtime/src/mcp.d.ts +0 -10
  184. package/dist/packages/agent-runtime/src/message-formatter.d.ts +0 -12
  185. package/dist/packages/agent-runtime/src/process-file-block.d.ts +0 -56
  186. package/dist/packages/agent-runtime/src/process-str-replace.d.ts +0 -21
  187. package/dist/packages/agent-runtime/src/prompt-agent-stream.d.ts +0 -28
  188. package/dist/packages/agent-runtime/src/run-agent-step.d.ts +0 -73
  189. package/dist/packages/agent-runtime/src/run-programmatic-step.d.ts +0 -40
  190. package/dist/packages/agent-runtime/src/system-prompt/prompts.d.ts +0 -19
  191. package/dist/packages/agent-runtime/src/system-prompt/search-system-prompt.d.ts +0 -14
  192. package/dist/packages/agent-runtime/src/system-prompt/team-context-prompt.d.ts +0 -9
  193. package/dist/packages/agent-runtime/src/system-prompt/team-prompt.d.ts +0 -9
  194. package/dist/packages/agent-runtime/src/system-prompt/truncate-file-tree.d.ts +0 -13
  195. package/dist/packages/agent-runtime/src/team-context.d.ts +0 -14
  196. package/dist/packages/agent-runtime/src/templates/agent-registry.d.ts +0 -35
  197. package/dist/packages/agent-runtime/src/templates/prompts.d.ts +0 -35
  198. package/dist/packages/agent-runtime/src/templates/strings.d.ts +0 -32
  199. package/dist/packages/agent-runtime/src/templates/types.d.ts +0 -13
  200. package/dist/packages/agent-runtime/src/tool-stream-parser.d.ts +0 -31
  201. package/dist/packages/agent-runtime/src/tools/handlers/handler-function-type.d.ts +0 -51
  202. package/dist/packages/agent-runtime/src/tools/handlers/list.d.ts +0 -370
  203. package/dist/packages/agent-runtime/src/tools/handlers/tool/add-message.d.ts +0 -9
  204. package/dist/packages/agent-runtime/src/tools/handlers/tool/add-subgoal.d.ts +0 -9
  205. package/dist/packages/agent-runtime/src/tools/handlers/tool/ask-user.d.ts +0 -10
  206. package/dist/packages/agent-runtime/src/tools/handlers/tool/browser-logs.d.ts +0 -8
  207. package/dist/packages/agent-runtime/src/tools/handlers/tool/code-search.d.ts +0 -8
  208. package/dist/packages/agent-runtime/src/tools/handlers/tool/create-plan.d.ts +0 -13
  209. package/dist/packages/agent-runtime/src/tools/handlers/tool/end-turn.d.ts +0 -7
  210. package/dist/packages/agent-runtime/src/tools/handlers/tool/find-files.d.ts +0 -27
  211. package/dist/packages/agent-runtime/src/tools/handlers/tool/glob.d.ts +0 -10
  212. package/dist/packages/agent-runtime/src/tools/handlers/tool/list-directory.d.ts +0 -10
  213. package/dist/packages/agent-runtime/src/tools/handlers/tool/lookup-agent-info.d.ts +0 -14
  214. package/dist/packages/agent-runtime/src/tools/handlers/tool/propose-str-replace.d.ts +0 -15
  215. package/dist/packages/agent-runtime/src/tools/handlers/tool/propose-write-file.d.ts +0 -7
  216. package/dist/packages/agent-runtime/src/tools/handlers/tool/proposed-content-store.d.ts +0 -27
  217. package/dist/packages/agent-runtime/src/tools/handlers/tool/read-docs.d.ts +0 -21
  218. package/dist/packages/agent-runtime/src/tools/handlers/tool/read-files.d.ts +0 -13
  219. package/dist/packages/agent-runtime/src/tools/handlers/tool/read-subtree.d.ts +0 -13
  220. package/dist/packages/agent-runtime/src/tools/handlers/tool/run-file-change-hooks.d.ts +0 -10
  221. package/dist/packages/agent-runtime/src/tools/handlers/tool/run-terminal-command.d.ts +0 -10
  222. package/dist/packages/agent-runtime/src/tools/handlers/tool/send-message.d.ts +0 -15
  223. package/dist/packages/agent-runtime/src/tools/handlers/tool/set-messages.d.ts +0 -9
  224. package/dist/packages/agent-runtime/src/tools/handlers/tool/set-output.d.ts +0 -18
  225. package/dist/packages/agent-runtime/src/tools/handlers/tool/skill.d.ts +0 -11
  226. package/dist/packages/agent-runtime/src/tools/handlers/tool/spawn-agent-inline.d.ts +0 -29
  227. package/dist/packages/agent-runtime/src/tools/handlers/tool/spawn-agent-utils.d.ts +0 -130
  228. package/dist/packages/agent-runtime/src/tools/handlers/tool/spawn-agents.d.ts +0 -37
  229. package/dist/packages/agent-runtime/src/tools/handlers/tool/str-replace.d.ts +0 -16
  230. package/dist/packages/agent-runtime/src/tools/handlers/tool/suggest-followups.d.ts +0 -9
  231. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-completed.d.ts +0 -15
  232. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-create.d.ts +0 -10
  233. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-get.d.ts +0 -10
  234. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-list.d.ts +0 -10
  235. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-update.d.ts +0 -15
  236. package/dist/packages/agent-runtime/src/tools/handlers/tool/team-create.d.ts +0 -15
  237. package/dist/packages/agent-runtime/src/tools/handlers/tool/team-delete.d.ts +0 -15
  238. package/dist/packages/agent-runtime/src/tools/handlers/tool/think-deeply.d.ts +0 -9
  239. package/dist/packages/agent-runtime/src/tools/handlers/tool/update-subgoal.d.ts +0 -11
  240. package/dist/packages/agent-runtime/src/tools/handlers/tool/web-search.d.ts +0 -22
  241. package/dist/packages/agent-runtime/src/tools/handlers/tool/write-file.d.ts +0 -49
  242. package/dist/packages/agent-runtime/src/tools/handlers/tool/write-todos.d.ts +0 -9
  243. package/dist/packages/agent-runtime/src/tools/prompts.d.ts +0 -31
  244. package/dist/packages/agent-runtime/src/tools/stream-parser.d.ts +0 -33
  245. package/dist/packages/agent-runtime/src/tools/tool-executor.d.ts +0 -87
  246. package/dist/packages/agent-runtime/src/util/agent-output.d.ts +0 -3
  247. package/dist/packages/agent-runtime/src/util/messages.d.ts +0 -68
  248. package/dist/packages/agent-runtime/src/util/parse-tool-calls-from-text.d.ts +0 -38
  249. package/dist/packages/agent-runtime/src/util/render-read-files-result.d.ts +0 -15
  250. package/dist/packages/agent-runtime/src/util/simplify-tool-results.d.ts +0 -7
  251. package/dist/packages/agent-runtime/src/util/stream-xml-parser.d.ts +0 -34
  252. package/dist/packages/agent-runtime/src/util/token-counter.d.ts +0 -3
  253. package/dist/packages/code-map/src/index.d.ts +0 -3
  254. package/dist/packages/code-map/src/init-node.d.ts +0 -4
  255. package/dist/packages/code-map/src/languages.d.ts +0 -36
  256. package/dist/packages/code-map/src/parse.d.ts +0 -21
  257. package/dist/packages/code-map/src/types.d.ts +0 -8
  258. package/dist/packages/code-map/src/utils.d.ts +0 -1
  259. package/dist/sdk/src/__tests__/client.test.d.ts +0 -1
  260. package/dist/sdk/src/__tests__/code-search.test.d.ts +0 -1
  261. package/dist/sdk/src/__tests__/credentials.test.d.ts +0 -1
  262. package/dist/sdk/src/__tests__/database.test.d.ts +0 -1
  263. package/dist/sdk/src/__tests__/env.test.d.ts +0 -1
  264. package/dist/sdk/src/__tests__/error-utils.test.d.ts +0 -1
  265. package/dist/sdk/src/__tests__/initial-session-state.test.d.ts +0 -1
  266. package/dist/sdk/src/__tests__/knowledge-file-selection.test.d.ts +0 -1
  267. package/dist/sdk/src/__tests__/load-agents.test.d.ts +0 -1
  268. package/dist/sdk/src/__tests__/load-mcp-config.test.d.ts +0 -1
  269. package/dist/sdk/src/__tests__/model-provider.test.d.ts +0 -1
  270. package/dist/sdk/src/__tests__/read-files.test.d.ts +0 -1
  271. package/dist/sdk/src/__tests__/run-cancellation.test.d.ts +0 -1
  272. package/dist/sdk/src/__tests__/run-file-filter.test.d.ts +0 -1
  273. package/dist/sdk/src/__tests__/run-handle-event.test.d.ts +0 -1
  274. package/dist/sdk/src/__tests__/run.integration.test.d.ts +0 -1
  275. package/dist/sdk/src/__tests__/team-api.test.d.ts +0 -1
  276. package/dist/sdk/src/__tests__/user-knowledge-files.test.d.ts +0 -1
  277. package/dist/sdk/src/__tests__/validate-agents.test.d.ts +0 -1
  278. package/dist/sdk/src/agents/load-agents.d.ts +0 -106
  279. package/dist/sdk/src/agents/load-mcp-config.d.ts +0 -69
  280. package/dist/sdk/src/client.d.ts +0 -71
  281. package/dist/sdk/src/constants.d.ts +0 -4
  282. package/dist/sdk/src/credentials.d.ts +0 -58
  283. package/dist/sdk/src/custom-tool.d.ts +0 -32
  284. package/dist/sdk/src/env.d.ts +0 -31
  285. package/dist/sdk/src/error-utils.d.ts +0 -55
  286. package/dist/sdk/src/impl/__tests__/prompt-result.test.d.ts +0 -1
  287. package/dist/sdk/src/impl/agent-runtime.d.ts +0 -8
  288. package/dist/sdk/src/impl/database.d.ts +0 -7
  289. package/dist/sdk/src/impl/llm.d.ts +0 -8
  290. package/dist/sdk/src/impl/model-provider.d.ts +0 -61
  291. package/dist/sdk/src/index.d.ts +0 -42
  292. package/dist/sdk/src/native/ripgrep.d.ts +0 -7
  293. package/dist/sdk/src/retry-config.d.ts +0 -46
  294. package/dist/sdk/src/run-state.d.ts +0 -81
  295. package/dist/sdk/src/run.d.ts +0 -79
  296. package/dist/sdk/src/skills/load-skills.d.ts +0 -42
  297. package/dist/sdk/src/team.d.ts +0 -49
  298. package/dist/sdk/src/testing/env.d.ts +0 -5
  299. package/dist/sdk/src/tools/change-file.d.ts +0 -7
  300. package/dist/sdk/src/tools/code-search.d.ts +0 -13
  301. package/dist/sdk/src/tools/glob.d.ts +0 -8
  302. package/dist/sdk/src/tools/index.d.ts +0 -16
  303. package/dist/sdk/src/tools/list-directory.d.ts +0 -7
  304. package/dist/sdk/src/tools/read-files.d.ts +0 -16
  305. package/dist/sdk/src/tools/run-file-change-hooks.d.ts +0 -4
  306. package/dist/sdk/src/tools/run-terminal-command.d.ts +0 -8
  307. package/dist/sdk/src/types/env.d.ts +0 -30
  308. package/dist/sdk/src/validate-agents.d.ts +0 -45
  309. package/dist/vendor/ripgrep/arm64-darwin/rg +0 -0
  310. package/dist/vendor/ripgrep/arm64-linux/rg +0 -0
  311. package/dist/vendor/ripgrep/x64-darwin/rg +0 -0
  312. package/dist/vendor/ripgrep/x64-linux/rg +0 -0
  313. package/dist/vendor/ripgrep/x64-win32/rg.exe +0 -0
  314. package/dist/wasm/tree-sitter-c-sharp.wasm +0 -0
  315. package/dist/wasm/tree-sitter-cpp.wasm +0 -0
  316. package/dist/wasm/tree-sitter-go.wasm +0 -0
  317. package/dist/wasm/tree-sitter-java.wasm +0 -0
  318. package/dist/wasm/tree-sitter-javascript.wasm +0 -0
  319. package/dist/wasm/tree-sitter-python.wasm +0 -0
  320. package/dist/wasm/tree-sitter-ruby.wasm +0 -0
  321. package/dist/wasm/tree-sitter-rust.wasm +0 -0
  322. package/dist/wasm/tree-sitter-tsx.wasm +0 -0
  323. package/dist/wasm/tree-sitter-typescript.wasm +0 -0
  324. package/dist/wasm/tree-sitter.wasm +0 -0
@@ -1,71 +0,0 @@
1
- import type { RunOptions, LevelCodeClientOptions } from './run';
2
- import type { RunState } from './run-state';
3
- import type { CreateTeamOptions, TeamStatus, RunWithTeamOptions } from './team';
4
- import type { TeamConfig } from '@levelcode/common/types/team-config';
5
- import type { TeamSummary } from '@levelcode/common/utils/team-discovery';
6
- export declare class LevelCodeClient {
7
- options: LevelCodeClientOptions & {
8
- apiKey: string;
9
- fingerprintId: string;
10
- };
11
- constructor(options: LevelCodeClientOptions);
12
- /**
13
- * Run a LevelCode agent with the specified options.
14
- *
15
- * @param agent - The agent to run. Use 'base' for the default agent, or specify a custom agent ID if you made your own agent config.
16
- * @param prompt - The user prompt describing what you want the agent to do.
17
- * @param params - (Optional) Additional parameters for the agent. Most agents don't use this, but some custom agents can take a JSON object as input in addition to the user prompt string.
18
- * @param handleEvent - (Optional) Callback function that receives every event during execution (assistant messages, tool calls, etc.). This allows you to stream the agent's progress in real-time. We will likely add a token-by-token streaming callback in the future.
19
- * @param previousRun - (Optional) JSON state returned from a previous run() call. Use this to continue a conversation or session with the agent, maintaining context from previous interactions.
20
- * @param projectFiles - (Optional) All the files in your project as a plain JavaScript object. Keys should be the full path from your current directory to each file, and values should be the string contents of the file. Example: { "src/index.ts": "console.log('hi')" }. This helps LevelCode pick good source files for context.
21
- * @param knowledgeFiles - (Optional) Knowledge files to inject into every run() call. Uses the same schema as projectFiles - keys are file paths and values are file contents. These files are added directly to the agent's context.
22
- * @param agentDefinitions - (Optional) Array of custom agent definitions. Each object should satisfy the AgentDefinition type. You can input the agent's id field into the agent parameter to run that agent.
23
- * @param customToolDefinitions - (Optional) Array of custom tool definitions that extend the agent's capabilities. Each tool definition includes a name, Zod schema for input validation, and a handler function. These tools can be called by the agent during execution.
24
- * @param maxAgentSteps - (Optional) Maximum number of steps the agent can take before stopping. Use this as a safety measure in case your agent starts going off the rails. A reasonable number is around 20.
25
- * @param env - (Optional) Environment variables to pass to terminal commands executed by the agent. These will be merged with the current process environment, with the custom values taking precedence. Can also be provided in individual run() calls to override.
26
- *
27
- * @returns A Promise that resolves to a RunState JSON object which you can pass to a subsequent run() call to continue the run. Use result.output to get the agent's output.
28
- */
29
- run(options: RunOptions & LevelCodeClientOptions): Promise<RunState>;
30
- /**
31
- * Check connection to the LevelCode backend by hitting the /healthz endpoint.
32
- *
33
- * @returns Promise that resolves to true if connected, false otherwise
34
- */
35
- checkConnection(): Promise<boolean>;
36
- /**
37
- * Create a new team for coordinating multiple agents.
38
- *
39
- * @param name - Unique name for the team.
40
- * @param options - Optional configuration including description, phase, preset, members, and settings.
41
- * @returns The created TeamConfig.
42
- */
43
- createTeam(name: string, options?: CreateTeamOptions): TeamConfig;
44
- /**
45
- * Delete a team and all its associated data (inboxes, tasks).
46
- *
47
- * @param name - Name of the team to delete.
48
- */
49
- deleteTeam(name: string): void;
50
- /**
51
- * Get the full status of a team including its config, tasks, and member count.
52
- *
53
- * @param name - Name of the team.
54
- * @returns TeamStatus with config, tasks array, and memberCount.
55
- */
56
- getTeamStatus(name: string): TeamStatus;
57
- /**
58
- * List all teams with summary information (name, phase, member count).
59
- *
60
- * @returns Array of TeamSummary objects.
61
- */
62
- listTeams(): TeamSummary[];
63
- /**
64
- * Run an agent as part of a team. The agent will be registered as a team member
65
- * and the run will include team context.
66
- *
67
- * @param options - Run options extended with teamName, memberName, and role.
68
- * @returns A Promise that resolves to a RunState.
69
- */
70
- runWithTeam(options: RunWithTeamOptions): Promise<RunState>;
71
- }
@@ -1,4 +0,0 @@
1
- import { IS_DEV, IS_TEST, IS_PROD } from '@levelcode/common/env';
2
- export { IS_DEV, IS_TEST, IS_PROD };
3
- export declare const LEVELCODE_BINARY = "levelcode";
4
- export declare const WEBSITE_URL: string;
@@ -1,58 +0,0 @@
1
- import type { ClientEnv } from '@levelcode/common/types/contracts/env';
2
- import type { User } from '@levelcode/common/util/credentials';
3
- export declare const userFromJson: (json: string) => User | null;
4
- /**
5
- * Get the config directory path based on the environment.
6
- * Uses the clientEnv to determine the environment suffix.
7
- */
8
- export declare const getConfigDir: (clientEnv?: ClientEnv) => string;
9
- /**
10
- * Get the credentials file path based on the environment.
11
- */
12
- export declare const getCredentialsPath: (clientEnv?: ClientEnv) => string;
13
- export declare const getUserCredentials: (clientEnv?: ClientEnv) => User | null;
14
- /**
15
- * Claude OAuth credentials stored in the credentials file.
16
- */
17
- export interface ClaudeOAuthCredentials {
18
- accessToken: string;
19
- refreshToken: string;
20
- expiresAt: number;
21
- connectedAt: number;
22
- }
23
- /**
24
- * Get Claude OAuth credentials from file or environment variable.
25
- * Environment variable takes precedence.
26
- * @returns OAuth credentials or null if not found
27
- */
28
- export declare const getClaudeOAuthCredentials: (clientEnv?: ClientEnv) => ClaudeOAuthCredentials | null;
29
- /**
30
- * Save Claude OAuth credentials to the credentials file.
31
- * Preserves existing user credentials.
32
- */
33
- export declare const saveClaudeOAuthCredentials: (credentials: ClaudeOAuthCredentials, clientEnv?: ClientEnv) => void;
34
- /**
35
- * Clear Claude OAuth credentials from the credentials file.
36
- * Preserves other credentials.
37
- */
38
- export declare const clearClaudeOAuthCredentials: (clientEnv?: ClientEnv) => void;
39
- /**
40
- * Check if Claude OAuth credentials are valid (not expired).
41
- * Returns true if credentials exist and haven't expired.
42
- */
43
- export declare const isClaudeOAuthValid: (clientEnv?: ClientEnv) => boolean;
44
- /**
45
- * Refresh the Claude OAuth access token using the refresh token.
46
- * Returns the new credentials if successful, null if refresh fails.
47
- * Uses a mutex to prevent concurrent refresh attempts.
48
- */
49
- export declare const refreshClaudeOAuthToken: (clientEnv?: ClientEnv) => Promise<ClaudeOAuthCredentials | null>;
50
- /**
51
- * Get valid Claude OAuth credentials, refreshing if necessary.
52
- * This is the main function to use when you need credentials for an API call.
53
- *
54
- * - Returns credentials immediately if valid (>5 min until expiry)
55
- * - Attempts refresh if token is expired or near-expiry
56
- * - Returns null if no credentials or refresh fails
57
- */
58
- export declare const getValidClaudeOAuthCredentials: (clientEnv?: ClientEnv) => Promise<ClaudeOAuthCredentials | null>;
@@ -1,32 +0,0 @@
1
- import type { ToolName } from '@levelcode/common/tools/constants';
2
- import type { ToolResultOutput } from '@levelcode/common/types/messages/content-part';
3
- import type { z } from 'zod/v4';
4
- export type CustomToolDefinition<N extends string = string, Args extends any = any, Input extends any = any> = {
5
- toolName: N;
6
- inputSchema: z.ZodType<Args, Input>;
7
- description: string;
8
- endsAgentStep: boolean;
9
- exampleInputs: Input[];
10
- execute: (params: Args) => Promise<ToolResultOutput[]>;
11
- };
12
- /**
13
- * Creates a CustomToolDefinition object
14
- *
15
- * @param toolName the name of the tool
16
- * @param inputSchema a Zod4 schema describing the input of the tool.
17
- * @param description a description of the tool to be passed to the LLM. This should describe what the tool does and when to use it.
18
- * @param endsAgentStep whether the tool ends the agent step. If `true`, this will be used as a "stop sequence" for the LLM. i.e. it will not be able to call any other tools after this one in a single step and must wait for the tool results. Used for tools that give more information to the LLM.
19
- * @param exampleInputs an array of example inputs for the tool.
20
- * @param execute what to do when the tool is called. Can be either a sync or async. Must return an array of {@linkcode ToolResultOutput}
21
- * @returns a {@linkcode CustomToolDefinition} object
22
- */
23
- export declare function getCustomToolDefinition<TN extends string, Args extends any, Input extends any>({ toolName, inputSchema, description, endsAgentStep, exampleInputs, execute, }: {
24
- toolName: TN extends ToolName ? TN & {
25
- error: `Hi there. This is a message from the LevelCode team: You have used a custom tool where you needed to use overrideTools instead for name: ${TN}`;
26
- } : TN;
27
- inputSchema: z.ZodType<Args, Input>;
28
- description: string;
29
- endsAgentStep?: boolean;
30
- exampleInputs?: Input[];
31
- execute: (params: Args) => Promise<ToolResultOutput[]> | ToolResultOutput[];
32
- }): CustomToolDefinition<TN, Args, Input>;
@@ -1,31 +0,0 @@
1
- /**
2
- * SDK environment helper for dependency injection.
3
- *
4
- * This module provides SDK-specific env helpers that extend the base
5
- * process env with SDK-specific vars for binary paths and WASM.
6
- */
7
- import type { SdkEnv } from './types/env';
8
- /**
9
- * Get SDK environment values.
10
- * Composes from getBaseEnv() + SDK-specific vars.
11
- */
12
- export declare const getSdkEnv: () => SdkEnv;
13
- export declare const getLevelCodeApiKeyFromEnv: () => string | undefined;
14
- export declare const getSystemProcessEnv: () => NodeJS.ProcessEnv;
15
- export declare const getByokOpenrouterApiKeyFromEnv: () => string | undefined;
16
- /**
17
- * Get Claude OAuth token from environment variable.
18
- * This allows users to provide their Claude Pro/Max OAuth token for direct Anthropic API access.
19
- */
20
- export declare const getClaudeOAuthTokenFromEnv: () => string | undefined;
21
- export declare const getOpenRouterApiKeyFromEnv: () => string | undefined;
22
- export declare const getOpenRouterBaseUrlFromEnv: () => string | undefined;
23
- export declare const getAnthropicApiKeyFromEnv: () => string | undefined;
24
- export declare const getAnthropicBaseUrlFromEnv: () => string | undefined;
25
- /**
26
- * Standalone mode: bypass all backend dependencies, route LLM calls directly.
27
- * Default mode when no backend URL (NEXT_PUBLIC_LEVELCODE_APP_URL) is configured.
28
- * Also activates when a direct provider key (OPENROUTER_API_KEY or ANTHROPIC_API_KEY)
29
- * is set AND LEVELCODE_API_KEY is NOT set.
30
- */
31
- export declare const isStandaloneMode: () => boolean;
@@ -1,55 +0,0 @@
1
- /**
2
- * SDK Error Utilities
3
- *
4
- * Simple utilities for error handling based on HTTP status codes.
5
- * Uses the AI SDK's error types which include statusCode property.
6
- */
7
- /**
8
- * Error type with statusCode property
9
- */
10
- export type HttpError = Error & {
11
- statusCode: number;
12
- };
13
- /**
14
- * HTTP status codes that should trigger automatic retry
15
- */
16
- export declare const RETRYABLE_STATUS_CODES: Set<number>;
17
- /**
18
- * Creates an Error with a statusCode property
19
- */
20
- export declare function createHttpError(message: string, statusCode: number): HttpError;
21
- /**
22
- * Creates an authentication error (401)
23
- */
24
- export declare function createAuthError(message?: string): HttpError;
25
- /**
26
- * Creates a forbidden error (403)
27
- */
28
- export declare function createForbiddenError(message?: string): HttpError;
29
- /**
30
- * Creates a payment required error (402)
31
- */
32
- export declare function createPaymentRequiredError(message?: string): HttpError;
33
- /**
34
- * Creates a server error (500 by default, or custom 5xx)
35
- */
36
- export declare function createServerError(message?: string, statusCode?: number): HttpError;
37
- /**
38
- * Creates a network error (503 - service unavailable)
39
- * Used for connection failures, DNS errors, timeouts, etc.
40
- */
41
- export declare function createNetworkError(message?: string): HttpError;
42
- /**
43
- * Checks if an HTTP status code is retryable
44
- */
45
- export declare function isRetryableStatusCode(statusCode: number | undefined): boolean;
46
- /**
47
- * Extracts the statusCode from an error if available.
48
- * Checks both 'statusCode' (our convention) and 'status' (AI SDK's APICallError convention).
49
- */
50
- export declare function getErrorStatusCode(error: unknown): number | undefined;
51
- /**
52
- * Sanitizes error messages for display
53
- * Removes sensitive information and formats for user consumption
54
- */
55
- export declare function sanitizeErrorMessage(error: unknown): string;
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- import type { AgentRuntimeDeps, AgentRuntimeScopedDeps } from '@levelcode/common/types/contracts/agent-runtime';
2
- import type { ClientEnv } from '@levelcode/common/types/contracts/env';
3
- import type { Logger } from '@levelcode/common/types/contracts/logger';
4
- export declare function getAgentRuntimeImpl(params: {
5
- logger?: Logger;
6
- apiKey: string;
7
- clientEnv?: ClientEnv;
8
- } & Pick<AgentRuntimeScopedDeps, 'handleStepsLogChunk' | 'requestToolCall' | 'requestMcpToolData' | 'requestFiles' | 'requestOptionalFile' | 'sendAction' | 'sendSubagentChunk'>): AgentRuntimeDeps & AgentRuntimeScopedDeps;
@@ -1,7 +0,0 @@
1
- import type { AddAgentStepFn, FetchAgentFromDatabaseFn, FinishAgentRunFn, GetUserInfoFromApiKeyInput, GetUserInfoFromApiKeyOutput, StartAgentRunFn, UserColumn } from '@levelcode/common/types/contracts/database';
2
- import type { ParamsOf } from '@levelcode/common/types/function-params';
3
- export declare function getUserInfoFromApiKey<T extends UserColumn>(params: GetUserInfoFromApiKeyInput<T>): GetUserInfoFromApiKeyOutput<T>;
4
- export declare function fetchAgentFromDatabase(params: ParamsOf<FetchAgentFromDatabaseFn>): ReturnType<FetchAgentFromDatabaseFn>;
5
- export declare function startAgentRun(params: ParamsOf<StartAgentRunFn>): ReturnType<StartAgentRunFn>;
6
- export declare function finishAgentRun(params: ParamsOf<FinishAgentRunFn>): ReturnType<FinishAgentRunFn>;
7
- export declare function addAgentStep(params: ParamsOf<AddAgentStepFn>): ReturnType<AddAgentStepFn>;
@@ -1,8 +0,0 @@
1
- import type { PromptAiSdkFn, PromptAiSdkStreamFn, PromptAiSdkStructuredInput, PromptAiSdkStructuredOutput } from '@levelcode/common/types/contracts/llm';
2
- import type { ParamsOf } from '@levelcode/common/types/function-params';
3
- export declare function promptAiSdkStream(params: ParamsOf<PromptAiSdkStreamFn> & {
4
- skipClaudeOAuth?: boolean;
5
- onClaudeOAuthStatusChange?: (isActive: boolean) => void;
6
- }): ReturnType<PromptAiSdkStreamFn>;
7
- export declare function promptAiSdk(params: ParamsOf<PromptAiSdkFn>): ReturnType<PromptAiSdkFn>;
8
- export declare function promptAiSdkStructured<T>(params: PromptAiSdkStructuredInput<T>): PromptAiSdkStructuredOutput<T>;
@@ -1,61 +0,0 @@
1
- /**
2
- * Model provider abstraction for routing requests to the appropriate LLM provider.
3
- *
4
- * Routing priority:
5
- * 1. Claude OAuth: Direct requests to Anthropic API using user's OAuth token
6
- * 2. Standalone + OPENROUTER_API_KEY: Direct requests to OpenRouter (or custom base via OPENROUTER_BASE_URL)
7
- * 3. Standalone + ANTHROPIC_API_KEY: Direct requests to Anthropic API (or custom base via ANTHROPIC_BASE_URL)
8
- * 4. Non-standalone: Requests through LevelCode backend (which routes to OpenRouter)
9
- */
10
- import type { LanguageModel } from 'ai';
11
- /**
12
- * Mark Claude OAuth as rate-limited. Subsequent requests will skip Claude OAuth
13
- * and use LevelCode backend until the reset time.
14
- * @param resetAt - When the rate limit resets. If not provided, guesses 5 minutes from now.
15
- */
16
- export declare function markClaudeOAuthRateLimited(resetAt?: Date): void;
17
- /**
18
- * Check if Claude OAuth is currently rate-limited.
19
- * Returns true if rate-limited and reset time hasn't passed.
20
- */
21
- export declare function isClaudeOAuthRateLimited(): boolean;
22
- /**
23
- * Reset the Claude OAuth rate limit cache.
24
- * Call this when user reconnects their Claude subscription.
25
- */
26
- export declare function resetClaudeOAuthRateLimit(): void;
27
- /**
28
- * Fetch the rate limit reset time from Anthropic's quota API.
29
- * Returns the earliest reset time (whichever limit is more restrictive).
30
- * Returns null if fetch fails or no reset time is available.
31
- */
32
- export declare function fetchClaudeOAuthResetTime(accessToken: string): Promise<Date | null>;
33
- /**
34
- * Parameters for requesting a model.
35
- */
36
- export interface ModelRequestParams {
37
- /** LevelCode API key for backend authentication */
38
- apiKey: string;
39
- /** Model ID (OpenRouter format, e.g., "anthropic/claude-sonnet-4") */
40
- model: string;
41
- /** If true, skip Claude OAuth and use LevelCode backend (for fallback after rate limit) */
42
- skipClaudeOAuth?: boolean;
43
- }
44
- /**
45
- * Result from getModelForRequest.
46
- */
47
- export interface ModelResult {
48
- /** The language model to use for requests */
49
- model: LanguageModel;
50
- /** Whether this model uses Claude OAuth direct (affects cost tracking) */
51
- isClaudeOAuth: boolean;
52
- }
53
- /**
54
- * Get the appropriate model for a request.
55
- *
56
- * If Claude OAuth credentials are available and the model is a Claude model,
57
- * returns an Anthropic direct model. Otherwise, returns the LevelCode backend model.
58
- *
59
- * This function is async because it may need to refresh the OAuth token.
60
- */
61
- export declare function getModelForRequest(params: ModelRequestParams): Promise<ModelResult>;
@@ -1,42 +0,0 @@
1
- export type * from '@levelcode/common/types/json';
2
- export type * from '@levelcode/common/types/messages/levelcode-message';
3
- export type * from '@levelcode/common/types/messages/data-content';
4
- export type * from '@levelcode/common/types/print-mode';
5
- export type { TextPart, ImagePart, } from '@levelcode/common/types/messages/content-part';
6
- export { run } from './run';
7
- export { getFiles } from './tools/read-files';
8
- export type { FileFilter, FileFilterResult } from './tools/read-files';
9
- export type { RunOptions, MessageContent, TextContent, ImageContent, } from './run';
10
- export { buildUserMessageContent } from '@levelcode/agent-runtime/util/messages';
11
- export type { AgentDefinition } from '@levelcode/common/templates/initial-agents-dir/types/agent-definition';
12
- export type { ToolName } from '@levelcode/common/tools/constants';
13
- export type { ClientToolCall, ClientToolName, LevelCodeToolOutput, } from '@levelcode/common/tools/list';
14
- export * from './client';
15
- export * from './team';
16
- export * from './custom-tool';
17
- export * from './native/ripgrep';
18
- export * from './run-state';
19
- export { ToolHelpers } from './tools';
20
- export * from './constants';
21
- export { getUserInfoFromApiKey } from './impl/database';
22
- export { isStandaloneMode, getOpenRouterApiKeyFromEnv } from './env';
23
- export * from './credentials';
24
- export { loadLocalAgents } from './agents/load-agents';
25
- export { loadMCPConfig, loadMCPConfigSync } from './agents/load-mcp-config';
26
- export { loadSkills } from './skills/load-skills';
27
- export { formatAvailableSkillsXml } from '@levelcode/common/util/skills';
28
- export type { LoadSkillsOptions } from './skills/load-skills';
29
- export type { SkillDefinition, SkillsMap } from '@levelcode/common/types/skill';
30
- export type { LoadedAgents, LoadedAgentDefinition, LoadLocalAgentsResult, AgentValidationError, } from './agents/load-agents';
31
- export type { MCPFileConfig, LoadedMCPConfig, } from './agents/load-mcp-config';
32
- export { validateAgents } from './validate-agents';
33
- export type { ValidationResult, ValidateAgentsOptions } from './validate-agents';
34
- export { isRetryableStatusCode, getErrorStatusCode, sanitizeErrorMessage, RETRYABLE_STATUS_CODES, createHttpError, createAuthError, createForbiddenError, createPaymentRequiredError, createServerError, createNetworkError, } from './error-utils';
35
- export type { HttpError } from './error-utils';
36
- export { MAX_RETRIES_PER_MESSAGE, RETRY_BACKOFF_BASE_DELAY_MS, RETRY_BACKOFF_MAX_DELAY_MS, RECONNECTION_MESSAGE_DURATION_MS, RECONNECTION_RETRY_DELAY_MS, } from './retry-config';
37
- export type { LevelCodeFileSystem } from '@levelcode/common/types/filesystem';
38
- export { getFileTokenScores, setWasmDir } from '@levelcode/code-map';
39
- export type { FileTokenData, TokenCallerMap } from '@levelcode/code-map';
40
- export { runTerminalCommand } from './tools/run-terminal-command';
41
- export { promptAiSdk, promptAiSdkStream, promptAiSdkStructured, } from './impl/llm';
42
- export { resetClaudeOAuthRateLimit } from './impl/model-provider';
@@ -1,7 +0,0 @@
1
- import type { SdkEnv } from '../types/env';
2
- /**
3
- * Get the path to the bundled ripgrep binary based on the current platform
4
- * @param importMetaUrl - import.meta.url from the calling module
5
- * @returns Path to the ripgrep binary
6
- */
7
- export declare function getBundledRgPath(importMetaUrl?: string, env?: SdkEnv): string;
@@ -1,46 +0,0 @@
1
- /**
2
- * Retry Configuration Constants
3
- *
4
- * This module defines constants for retry behavior and exponential backoff.
5
- * Used by the CLI to automatically retry failed messages after reconnection.
6
- *
7
- * @example
8
- * ```typescript
9
- * import { MAX_RETRIES_PER_MESSAGE, RETRY_BACKOFF_BASE_DELAY_MS } from '@levelcode/sdk'
10
- *
11
- * let retryCount = 0
12
- * let backoffDelay = RETRY_BACKOFF_BASE_DELAY_MS
13
- *
14
- * while (retryCount < MAX_RETRIES_PER_MESSAGE) {
15
- * await new Promise(resolve => setTimeout(resolve, backoffDelay))
16
- * // ... retry logic
17
- * backoffDelay = Math.min(backoffDelay * 2, RETRY_BACKOFF_MAX_DELAY_MS)
18
- * retryCount++
19
- * }
20
- * ```
21
- */
22
- /**
23
- * Maximum number of retry attempts per message
24
- * After this many attempts, the message is marked as permanently failed
25
- */
26
- export declare const MAX_RETRIES_PER_MESSAGE = 3;
27
- /**
28
- * Base delay in milliseconds for exponential backoff
29
- * First retry: 1s, Second: 2s, Third: 4s, Fourth: 8s (capped)
30
- */
31
- export declare const RETRY_BACKOFF_BASE_DELAY_MS = 1000;
32
- /**
33
- * Maximum delay in milliseconds for exponential backoff
34
- * Prevents backoff from growing indefinitely
35
- */
36
- export declare const RETRY_BACKOFF_MAX_DELAY_MS = 8000;
37
- /**
38
- * Duration in milliseconds to show the reconnection message
39
- * After this time, the message auto-hides
40
- */
41
- export declare const RECONNECTION_MESSAGE_DURATION_MS = 2000;
42
- /**
43
- * Delay in milliseconds before retrying messages after reconnection
44
- * Gives the connection time to stabilize before attempting retries
45
- */
46
- export declare const RECONNECTION_RETRY_DELAY_MS = 500;
@@ -1,81 +0,0 @@
1
- export { KNOWLEDGE_FILE_NAMES, PRIMARY_KNOWLEDGE_FILE_NAME, isKnowledgeFile, } from '@levelcode/common/constants/knowledge';
2
- import type { CustomToolDefinition } from './custom-tool';
3
- import type { AgentDefinition } from '@levelcode/common/templates/initial-agents-dir/types/agent-definition';
4
- import type { Logger } from '@levelcode/common/types/contracts/logger';
5
- import type { LevelCodeFileSystem } from '@levelcode/common/types/filesystem';
6
- import type { Message } from '@levelcode/common/types/messages/levelcode-message';
7
- import type { AgentOutput, SessionState } from '@levelcode/common/types/session-state';
8
- import type { LevelCodeSpawn } from '@levelcode/common/types/spawn';
9
- /**
10
- * Given a list of candidate file paths, selects the one with highest priority.
11
- * Priority order: knowledge.md > AGENTS.md > CLAUDE.md (case-insensitive).
12
- * Returns undefined if no knowledge files are found.
13
- * @internal Exported for testing
14
- */
15
- export declare function selectHighestPriorityKnowledgeFile(candidates: string[]): string | undefined;
16
- export type RunState = {
17
- sessionState?: SessionState;
18
- output: AgentOutput;
19
- };
20
- export type InitialSessionStateOptions = {
21
- cwd?: string;
22
- projectFiles?: Record<string, string>;
23
- knowledgeFiles?: Record<string, string>;
24
- /** User-provided knowledge files that will be merged with home directory files */
25
- userKnowledgeFiles?: Record<string, string>;
26
- agentDefinitions?: AgentDefinition[];
27
- customToolDefinitions?: CustomToolDefinition[];
28
- maxAgentSteps?: number;
29
- fs?: LevelCodeFileSystem;
30
- spawn?: LevelCodeSpawn;
31
- logger?: Logger;
32
- };
33
- /**
34
- * Loads user knowledge files from the home directory.
35
- * Checks for ~/.knowledge.md, ~/.AGENTS.md, and ~/.CLAUDE.md with priority fallback.
36
- * Matching is case-insensitive (e.g., ~/.KNOWLEDGE.md will match).
37
- * Returns a record with the tilde-prefixed path as key (e.g., "~/.knowledge.md").
38
- * @internal Exported for testing
39
- */
40
- export declare function loadUserKnowledgeFiles(params: {
41
- fs: LevelCodeFileSystem;
42
- logger: Logger;
43
- /** Optional home directory override for testing */
44
- homeDir?: string;
45
- }): Promise<Record<string, string>>;
46
- /**
47
- * Selects knowledge files from a list of file paths with fallback logic.
48
- * For each directory, checks for knowledge.md first, then AGENTS.md, then CLAUDE.md.
49
- * @internal Exported for testing
50
- */
51
- export declare function selectKnowledgeFilePaths(allFilePaths: string[]): string[];
52
- export declare function initialSessionState(params: InitialSessionStateOptions): Promise<SessionState>;
53
- export declare function generateInitialRunState({ cwd, projectFiles, knowledgeFiles, userKnowledgeFiles, agentDefinitions, customToolDefinitions, maxAgentSteps, fs, }: {
54
- cwd: string;
55
- projectFiles?: Record<string, string>;
56
- knowledgeFiles?: Record<string, string>;
57
- userKnowledgeFiles?: Record<string, string>;
58
- agentDefinitions?: AgentDefinition[];
59
- customToolDefinitions?: CustomToolDefinition[];
60
- maxAgentSteps?: number;
61
- fs: LevelCodeFileSystem;
62
- }): Promise<RunState>;
63
- export declare function withAdditionalMessage({ runState, message, }: {
64
- runState: RunState;
65
- message: Message;
66
- }): RunState;
67
- export declare function withMessageHistory({ runState, messages, }: {
68
- runState: RunState;
69
- messages: Message[];
70
- }): RunState;
71
- /**
72
- * Applies overrides to an existing session state, allowing specific fields to be updated
73
- * even when continuing from a previous run.
74
- */
75
- export declare function applyOverridesToSessionState(cwd: string | undefined, baseSessionState: SessionState, overrides: {
76
- projectFiles?: Record<string, string>;
77
- knowledgeFiles?: Record<string, string>;
78
- agentDefinitions?: AgentDefinition[];
79
- customToolDefinitions?: CustomToolDefinition[];
80
- maxAgentSteps?: number;
81
- }): Promise<SessionState>;
@@ -1,79 +0,0 @@
1
- import type { CustomToolDefinition } from './custom-tool';
2
- import type { RunState } from './run-state';
3
- import type { FileFilter } from './tools/read-files';
4
- import type { AgentDefinition } from '@levelcode/common/templates/initial-agents-dir/types/agent-definition';
5
- import type { PublishedToolName } from '@levelcode/common/tools/constants';
6
- import type { ClientToolCall, ClientToolName, LevelCodeToolOutput } from '@levelcode/common/tools/list';
7
- import type { Logger } from '@levelcode/common/types/contracts/logger';
8
- import type { LevelCodeFileSystem } from '@levelcode/common/types/filesystem';
9
- import type { ToolMessage } from '@levelcode/common/types/messages/levelcode-message';
10
- import type { PrintModeEvent } from '@levelcode/common/types/print-mode';
11
- import type { Source } from '@levelcode/common/types/source';
12
- import type { LevelCodeSpawn } from '@levelcode/common/types/spawn';
13
- export type LevelCodeClientOptions = {
14
- apiKey?: string;
15
- cwd?: string;
16
- projectFiles?: Record<string, string>;
17
- knowledgeFiles?: Record<string, string>;
18
- agentDefinitions?: AgentDefinition[];
19
- maxAgentSteps?: number;
20
- env?: Record<string, string>;
21
- handleEvent?: (event: PrintModeEvent) => void | Promise<void>;
22
- handleStreamChunk?: (chunk: string | {
23
- type: 'subagent_chunk';
24
- agentId: string;
25
- agentType: string;
26
- chunk: string;
27
- } | {
28
- type: 'reasoning_chunk';
29
- agentId: string;
30
- ancestorRunIds: string[];
31
- chunk: string;
32
- }) => void | Promise<void>;
33
- /** Optional filter to classify files before reading (runs before gitignore check) */
34
- fileFilter?: FileFilter;
35
- overrideTools?: Partial<{
36
- [K in ClientToolName & PublishedToolName]: (input: ClientToolCall<K>['input']) => Promise<LevelCodeToolOutput<K>>;
37
- } & {
38
- read_files: (input: {
39
- filePaths: string[];
40
- }) => Promise<Record<string, string | null>>;
41
- }>;
42
- customToolDefinitions?: CustomToolDefinition[];
43
- fsSource?: Source<LevelCodeFileSystem>;
44
- spawnSource?: Source<LevelCodeSpawn>;
45
- logger?: Logger;
46
- };
47
- export type ImageContent = {
48
- type: 'image';
49
- image: string;
50
- mediaType: string;
51
- };
52
- export type TextContent = {
53
- type: 'text';
54
- text: string;
55
- };
56
- export type MessageContent = TextContent | ImageContent;
57
- export type RunOptions = {
58
- agent: string | AgentDefinition;
59
- prompt: string;
60
- /** Content array for multimodal messages (text + images) */
61
- content?: MessageContent[];
62
- params?: Record<string, any>;
63
- previousRun?: RunState;
64
- extraToolResults?: ToolMessage[];
65
- signal?: AbortSignal;
66
- costMode?: string;
67
- };
68
- type RunExecutionOptions = RunOptions & LevelCodeClientOptions & {
69
- apiKey: string;
70
- fingerprintId: string;
71
- };
72
- export declare function run(options: RunExecutionOptions): Promise<RunState>;
73
- /**
74
- * Extracts an HTTP status code from an error message string.
75
- * Parses common error patterns to identify the underlying status code.
76
- * Returns the status code if found, undefined otherwise.
77
- */
78
- export declare const extractStatusCodeFromMessage: (errorMessage: string) => number | undefined;
79
- export {};
@@ -1,42 +0,0 @@
1
- import { type SkillsMap } from '@levelcode/common/types/skill';
2
- export { formatAvailableSkillsXml } from '@levelcode/common/util/skills';
3
- export type LoadSkillsOptions = {
4
- /** Working directory for project skills. Defaults to process.cwd() */
5
- cwd?: string;
6
- /** Optional specific skills directory path */
7
- skillsPath?: string;
8
- /** Whether to log errors during loading */
9
- verbose?: boolean;
10
- };
11
- /**
12
- * Load skills from .agents/skills and .claude/skills directories.
13
- *
14
- * By default, searches for skills in (later overrides earlier):
15
- * - `~/.claude/skills/` (global, Claude Code compatible)
16
- * - `~/.agents/skills/` (global)
17
- * - `{cwd}/.claude/skills/` (project, Claude Code compatible)
18
- * - `{cwd}/.agents/skills/` (project, highest priority)
19
- *
20
- * Each skill must be in its own directory with a SKILL.md file:
21
- * - `.agents/skills/my-skill/SKILL.md`
22
- * - `.claude/skills/my-skill/SKILL.md`
23
- *
24
- * @param options.cwd - Working directory for project skills
25
- * @param options.skillsPath - Optional path to a specific skills directory
26
- * @param options.verbose - Whether to log errors during loading
27
- * @returns Record of skill definitions keyed by skill name
28
- *
29
- * @example
30
- * ```typescript
31
- * // Load from default locations
32
- * const skills = await loadSkills({ verbose: true })
33
- *
34
- * // Load from a specific directory
35
- * const skills = await loadSkills({ skillsPath: './my-skills' })
36
- *
37
- * // Access a skill
38
- * const gitReleaseSkill = skills['git-release']
39
- * console.log(gitReleaseSkill.description)
40
- * ```
41
- */
42
- export declare function loadSkills(options?: LoadSkillsOptions): Promise<SkillsMap>;