@levelcode/sdk 0.2.0 → 0.2.2

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 +313 -303
  2. package/dist/index.cjs.map +21 -21
  3. package/dist/index.mjs +346 -336
  4. package/dist/index.mjs.map +21 -21
  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 -213
  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 -366
  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 -9
  233. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-get.d.ts +0 -9
  234. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-list.d.ts +0 -9
  235. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-update.d.ts +0 -14
  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 -41
  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,308 +0,0 @@
1
- /**
2
- * Union type of all available tool names
3
- */
4
- export type ToolName = 'add_message' | 'ask_user' | 'code_search' | 'end_turn' | 'find_files' | 'glob' | 'list_directory' | 'lookup_agent_info' | 'propose_str_replace' | 'propose_write_file' | 'read_docs' | 'read_files' | 'read_subtree' | 'run_file_change_hooks' | 'run_terminal_command' | 'set_messages' | 'set_output' | 'skill' | 'spawn_agents' | 'str_replace' | 'suggest_followups' | 'task_completed' | 'think_deeply' | 'web_search' | 'write_file' | 'write_todos';
5
- /**
6
- * Map of tool names to their parameter types
7
- */
8
- export interface ToolParamsMap {
9
- add_message: AddMessageParams;
10
- ask_user: AskUserParams;
11
- code_search: CodeSearchParams;
12
- end_turn: EndTurnParams;
13
- find_files: FindFilesParams;
14
- glob: GlobParams;
15
- list_directory: ListDirectoryParams;
16
- lookup_agent_info: LookupAgentInfoParams;
17
- propose_str_replace: ProposeStrReplaceParams;
18
- propose_write_file: ProposeWriteFileParams;
19
- read_docs: ReadDocsParams;
20
- read_files: ReadFilesParams;
21
- read_subtree: ReadSubtreeParams;
22
- run_file_change_hooks: RunFileChangeHooksParams;
23
- run_terminal_command: RunTerminalCommandParams;
24
- set_messages: SetMessagesParams;
25
- set_output: SetOutputParams;
26
- skill: SkillParams;
27
- spawn_agents: SpawnAgentsParams;
28
- str_replace: StrReplaceParams;
29
- suggest_followups: SuggestFollowupsParams;
30
- task_completed: TaskCompletedParams;
31
- think_deeply: ThinkDeeplyParams;
32
- web_search: WebSearchParams;
33
- write_file: WriteFileParams;
34
- write_todos: WriteTodosParams;
35
- }
36
- /**
37
- * Add a new message to the conversation history. To be used for complex requests that can't be solved in a single step, as you may forget what happened!
38
- */
39
- export interface AddMessageParams {
40
- role: 'user' | 'assistant';
41
- content: string;
42
- }
43
- /**
44
- * Ask the user multiple choice questions and pause execution until they respond.
45
- */
46
- export interface AskUserParams {
47
- /** List of multiple choice questions to ask the user */
48
- questions: {
49
- /** The question to ask the user */
50
- question: string;
51
- /** Short label (max 12 chars) displayed as a chip/tag */
52
- header?: string;
53
- /** Array of answer options with label and optional description (minimum 2) */
54
- options: {
55
- /** The display text for this option */
56
- label: string;
57
- /** Explanation shown when option is focused */
58
- description?: string;
59
- }[];
60
- /** If true, allows selecting multiple options (checkbox). If false, single selection only (radio). */
61
- multiSelect?: boolean;
62
- /** Validation rules for "Other" text input */
63
- validation?: {
64
- /** Maximum length for "Other" text input */
65
- maxLength?: number;
66
- /** Minimum length for "Other" text input */
67
- minLength?: number;
68
- /** Regex pattern for "Other" text input */
69
- pattern?: string;
70
- /** Custom error message when pattern fails */
71
- patternError?: string;
72
- };
73
- }[];
74
- }
75
- /**
76
- * Search for string patterns in the project's files. This tool uses ripgrep (rg), a fast line-oriented search tool. Use this tool only when read_files is not sufficient to find the files you need.
77
- */
78
- export interface CodeSearchParams {
79
- /** The pattern to search for. */
80
- pattern: string;
81
- /** Optional ripgrep flags to customize the search (e.g., "-i" for case-insensitive, "-g *.ts -g *.js" for TypeScript and JavaScript files only, "-g !*.test.ts" to exclude Typescript test files, "-A 3" for 3 lines after match, "-B 2" for 2 lines before match). */
82
- flags?: string;
83
- /** Optional working directory to search within, relative to the project root. Defaults to searching the entire project. */
84
- cwd?: string;
85
- /** Maximum number of results to return per file. Defaults to 15. There is also a global limit of 250 results across all files. */
86
- maxResults?: number;
87
- }
88
- /**
89
- * End your turn, regardless of any new tool results that might be coming. This will allow the user to type another prompt.
90
- */
91
- export interface EndTurnParams {
92
- }
93
- /**
94
- * Find several files related to a brief natural language description of the files or the name of a function or class you are looking for.
95
- */
96
- export interface FindFilesParams {
97
- /** A brief natural language description of the files or the name of a function or class you are looking for. It's also helpful to mention a directory or two to look within. */
98
- prompt: string;
99
- }
100
- /**
101
- * Search for files matching a glob pattern. Returns matching file paths sorted by modification time.
102
- */
103
- export interface GlobParams {
104
- /** Glob pattern to match files against (e.g., *.js, src/glob/*.ts, glob/test/glob/*.go). */
105
- pattern: string;
106
- /** Optional working directory to search within, relative to project root. If not provided, searches from project root. */
107
- cwd?: string;
108
- }
109
- /**
110
- * List files and directories in the specified path. Returns separate arrays of file names and directory names.
111
- */
112
- export interface ListDirectoryParams {
113
- /** Directory path to list, relative to the project root. */
114
- path: string;
115
- }
116
- /**
117
- * Retrieve information about an agent by ID
118
- */
119
- export interface LookupAgentInfoParams {
120
- /** Agent ID (short local or full published format) */
121
- agentId: string;
122
- }
123
- /**
124
- * Propose string replacements in a file without actually applying them.
125
- */
126
- export interface ProposeStrReplaceParams {
127
- /** The path to the file to edit. */
128
- path: string;
129
- /** Array of replacements to make. */
130
- replacements: {
131
- /** The string to replace. This must be an *exact match* of the string you want to replace, including whitespace and punctuation. */
132
- old: string;
133
- /** The string to replace the corresponding old string with. Can be empty to delete. */
134
- new: string;
135
- /** Whether to allow multiple replacements of old string. */
136
- allowMultiple?: boolean;
137
- }[];
138
- }
139
- /**
140
- * Propose creating or editing a file without actually applying the changes.
141
- */
142
- export interface ProposeWriteFileParams {
143
- /** Path to the file relative to the **project root** */
144
- path: string;
145
- /** What the change is intended to do in only one sentence. */
146
- instructions: string;
147
- /** Edit snippet to apply to the file. */
148
- content: string;
149
- }
150
- /**
151
- * Fetch up-to-date documentation for libraries and frameworks using Context7 API.
152
- */
153
- export interface ReadDocsParams {
154
- /** The library or framework name (e.g., "Next.js", "MongoDB", "React"). Use the official name as it appears in documentation if possible. Only public libraries available in Context7's database are supported, so small or private libraries may not be available. */
155
- libraryTitle: string;
156
- /** Specific topic to focus on (e.g., "routing", "hooks", "authentication") */
157
- topic: string;
158
- /** Optional maximum number of tokens to return. Defaults to 20000. Values less than 10000 are automatically increased to 10000. */
159
- max_tokens?: number;
160
- }
161
- /**
162
- * Read the multiple files from disk and return their contents. Use this tool to read as many files as would be helpful to answer the user's request.
163
- */
164
- export interface ReadFilesParams {
165
- /** List of file paths to read. */
166
- paths: string[];
167
- }
168
- /**
169
- * Read one or more directory subtrees (as a blob including subdirectories, file names, and parsed variables within each source file) or return parsed variable names for files. If no paths are provided, returns the entire project tree.
170
- */
171
- export interface ReadSubtreeParams {
172
- /** List of paths to directories or files. Relative to the project root. If omitted, the entire project tree is used. */
173
- paths?: string[];
174
- /** Maximum token budget for the subtree blob; the tree will be truncated to fit within this budget by first dropping file variables and then removing the most-nested files and directories. */
175
- maxTokens?: number;
176
- }
177
- /**
178
- * Parameters for run_file_change_hooks tool
179
- */
180
- export interface RunFileChangeHooksParams {
181
- /** List of file paths that were changed and should trigger file change hooks */
182
- files: string[];
183
- }
184
- /**
185
- * Execute a CLI command from the **project root** (different from the user's cwd).
186
- */
187
- export interface RunTerminalCommandParams {
188
- /** CLI command valid for user's OS. */
189
- command: string;
190
- /** Either SYNC (waits, returns output) or BACKGROUND (runs in background). Default SYNC */
191
- process_type?: 'SYNC' | 'BACKGROUND';
192
- /** The working directory to run the command in. Default is the project root. */
193
- cwd?: string;
194
- /** Set to -1 for no timeout. Does not apply for BACKGROUND commands. Default 30 */
195
- timeout_seconds?: number;
196
- }
197
- /**
198
- * Set the conversation history to the provided messages.
199
- */
200
- export interface SetMessagesParams {
201
- messages: any;
202
- }
203
- /**
204
- * JSON object to set as the agent output. This completely replaces any previous output. If the agent was spawned, this value will be passed back to its parent. If the agent has an outputSchema defined, the output will be validated against it.
205
- */
206
- export interface SetOutputParams {
207
- }
208
- /**
209
- * Load a skill's full instructions when relevant to the current task. Skills are loaded on-demand - only load them when you need their specific guidance.
210
- */
211
- export interface SkillParams {
212
- /** The name of the skill to load */
213
- name: string;
214
- }
215
- /**
216
- * Spawn multiple agents and send a prompt and/or parameters to each of them. These agents will run in parallel. Note that that means they will run independently. If you need to run agents sequentially, use spawn_agents with one agent at a time instead.
217
- */
218
- export interface SpawnAgentsParams {
219
- agents: {
220
- /** Agent to spawn */
221
- agent_type: string;
222
- /** Prompt to send to the agent */
223
- prompt?: string;
224
- /** Parameters object for the agent (if any) */
225
- params?: Record<string, any>;
226
- }[];
227
- }
228
- /**
229
- * Replace strings in a file with new strings.
230
- */
231
- export interface StrReplaceParams {
232
- /** The path to the file to edit. */
233
- path: string;
234
- /** Array of replacements to make. */
235
- replacements: {
236
- /** The string to replace. This must be an *exact match* of the string you want to replace, including whitespace and punctuation. */
237
- old: string;
238
- /** The string to replace the corresponding old string with. Can be empty to delete. */
239
- new: string;
240
- /** Whether to allow multiple replacements of old string. */
241
- allowMultiple?: boolean;
242
- }[];
243
- }
244
- /**
245
- * Suggest clickable followup prompts to the user.
246
- */
247
- export interface SuggestFollowupsParams {
248
- /** List of suggested followup prompts the user can click to send */
249
- followups: {
250
- /** The full prompt text to send as a user message when clicked */
251
- prompt: string;
252
- /** Short display label for the card (defaults to truncated prompt if not provided) */
253
- label?: string;
254
- }[];
255
- }
256
- /**
257
- * Signal that the task is complete. Use this tool when:
258
- - The user's request is completely fulfilled
259
- - You need clarification from the user before continuing
260
- - You are stuck or need help from the user to continue
261
-
262
- This tool explicitly marks the end of your work on the current task.
263
- */
264
- export interface TaskCompletedParams {
265
- }
266
- /**
267
- * Deeply consider complex tasks by brainstorming approaches and tradeoffs step-by-step.
268
- */
269
- export interface ThinkDeeplyParams {
270
- /** Detailed step-by-step analysis. Initially keep each step concise (max ~5-7 words per step). */
271
- thought: string;
272
- }
273
- /**
274
- * Search the web for current information using Linkup API.
275
- */
276
- export interface WebSearchParams {
277
- /** The search query to find relevant web content */
278
- query: string;
279
- /** Search depth - 'standard' for quick results, 'deep' for more comprehensive search. Default is 'standard'. */
280
- depth?: 'standard' | 'deep';
281
- }
282
- /**
283
- * Create or edit a file with the given content.
284
- */
285
- export interface WriteFileParams {
286
- /** Path to the file relative to the **project root** */
287
- path: string;
288
- /** What the change is intended to do in only one sentence. */
289
- instructions: string;
290
- /** Edit snippet to apply to the file. */
291
- content: string;
292
- }
293
- /**
294
- * Write a todo list to track tasks for multi-step implementations. Use this frequently to maintain an updated step-by-step plan.
295
- */
296
- export interface WriteTodosParams {
297
- /** List of todos with their completion status. Add ALL of the applicable tasks to the list, so you don't forget to do anything. Try to order the todos the same way you will complete them. Do not mark todos as completed if you have not completed them yet! */
298
- todos: {
299
- /** Description of the task */
300
- task: string;
301
- /** Whether the task is completed */
302
- completed: boolean;
303
- }[];
304
- }
305
- /**
306
- * Get parameters type for a specific tool
307
- */
308
- export type GetToolParams<T extends ToolName> = ToolParamsMap[T];
@@ -1,134 +0,0 @@
1
- export type JSONValue = null | string | number | boolean | JSONObject | JSONArray;
2
- export type JSONObject = {
3
- [key: string]: JSONValue;
4
- };
5
- export type JSONArray = JSONValue[];
6
- /**
7
- * JSON Schema definition (for prompt schema or output schema)
8
- */
9
- export type JsonSchema = {
10
- type?: 'object' | 'array' | 'string' | 'number' | 'boolean' | 'null' | 'integer';
11
- description?: string;
12
- properties?: Record<string, JsonSchema | boolean>;
13
- required?: string[];
14
- enum?: Array<string | number | boolean | null>;
15
- [k: string]: unknown;
16
- };
17
- export type JsonObjectSchema = JsonSchema & {
18
- type: 'object';
19
- };
20
- export type DataContent = string | Uint8Array | ArrayBuffer | Buffer;
21
- export type ProviderMetadata = Record<string, Record<string, JSONValue>>;
22
- export type TextPart = {
23
- type: 'text';
24
- text: string;
25
- providerOptions?: ProviderMetadata;
26
- };
27
- export type ImagePart = {
28
- type: 'image';
29
- image: DataContent;
30
- mediaType?: string;
31
- providerOptions?: ProviderMetadata;
32
- };
33
- export type FilePart = {
34
- type: 'file';
35
- data: DataContent;
36
- filename?: string;
37
- mediaType: string;
38
- providerOptions?: ProviderMetadata;
39
- };
40
- export type ReasoningPart = {
41
- type: 'reasoning';
42
- text: string;
43
- providerOptions?: ProviderMetadata;
44
- };
45
- export type ToolCallPart = {
46
- type: 'tool-call';
47
- toolCallId: string;
48
- toolName: string;
49
- input: Record<string, unknown>;
50
- providerOptions?: ProviderMetadata;
51
- providerExecuted?: boolean;
52
- };
53
- export type ToolResultOutput = {
54
- type: 'json';
55
- value: JSONValue;
56
- } | {
57
- type: 'media';
58
- data: string;
59
- mediaType: string;
60
- };
61
- export type AuxiliaryMessageData = {
62
- providerOptions?: ProviderMetadata;
63
- tags?: string[];
64
- /**
65
- * Unix timestamp (ms) when the message was added to history.
66
- * Used to detect prompt cache expiry (>5 min gap = cache miss).
67
- * This field is stripped before sending to the LLM.
68
- */
69
- sentAt?: number;
70
- /** @deprecated Use tags instead. */
71
- timeToLive?: 'agentStep' | 'userPrompt';
72
- /** @deprecated Use tags instead. */
73
- keepDuringTruncation?: boolean;
74
- /** @deprecated Use tags instead. */
75
- keepLastTags?: string[];
76
- };
77
- export type SystemMessage = {
78
- role: 'system';
79
- content: TextPart[];
80
- } & AuxiliaryMessageData;
81
- export type UserMessage = {
82
- role: 'user';
83
- content: (TextPart | ImagePart | FilePart)[];
84
- } & AuxiliaryMessageData;
85
- export type AssistantMessage = {
86
- role: 'assistant';
87
- content: (TextPart | ReasoningPart | ToolCallPart)[];
88
- } & AuxiliaryMessageData;
89
- export type ToolMessage = {
90
- role: 'tool';
91
- toolCallId: string;
92
- toolName: string;
93
- content: ToolResultOutput[];
94
- } & AuxiliaryMessageData;
95
- export type Message = SystemMessage | UserMessage | AssistantMessage | ToolMessage;
96
- /**
97
- * MCP server configuration for stdio-based servers.
98
- *
99
- * Environment variables in `env` can be:
100
- * - A plain string value (hardcoded, e.g., `'production'`)
101
- * - A `$VAR_NAME` reference to read from local environment (e.g., `'$NOTION_TOKEN'`)
102
- *
103
- * The `$VAR_NAME` syntax reads from `process.env.VAR_NAME` at agent load time.
104
- * This keeps secrets out of your agent definitions - store them in `.env.local` instead.
105
- *
106
- * @example
107
- * ```typescript
108
- * env: {
109
- * // Read NOTION_TOKEN from local .env file
110
- * NOTION_TOKEN: '$NOTION_TOKEN',
111
- * // Read MY_API_KEY from local env, pass as API_KEY to MCP server
112
- * API_KEY: '$MY_API_KEY',
113
- * // Hardcoded value (non-secret)
114
- * NODE_ENV: 'production',
115
- * }
116
- * ```
117
- */
118
- export type MCPConfig = {
119
- type?: 'stdio';
120
- command: string;
121
- args?: string[];
122
- env?: Record<string, string>;
123
- } | {
124
- type?: 'http' | 'sse';
125
- url: string;
126
- params?: Record<string, string>;
127
- headers?: Record<string, string>;
128
- };
129
- export interface Logger {
130
- debug: (data: any, msg?: string) => void;
131
- info: (data: any, msg?: string) => void;
132
- warn: (data: any, msg?: string) => void;
133
- error: (data: any, msg?: string) => void;
134
- }
@@ -1,176 +0,0 @@
1
- import { z } from 'zod/v4';
2
- import type { GrantType } from './types/grant';
3
- import type { MCPConfig } from './types/mcp';
4
- import type { ToolMessage } from './types/messages/levelcode-message';
5
- import type { TextPart, ImagePart, ToolResultOutput } from './types/messages/content-part';
6
- import type { PrintModeEvent } from './types/print-mode';
7
- import type { AgentOutput, SessionState, ToolCall } from './types/session-state';
8
- import type { ProjectFileContext } from './util/file';
9
- export declare const FileChangeSchema: z.ZodObject<{
10
- type: z.ZodEnum<{
11
- file: "file";
12
- patch: "patch";
13
- }>;
14
- path: z.ZodString;
15
- content: z.ZodString;
16
- }, z.core.$strip>;
17
- export type FileChange = z.infer<typeof FileChangeSchema>;
18
- export declare const CHANGES: z.ZodArray<z.ZodObject<{
19
- type: z.ZodEnum<{
20
- file: "file";
21
- patch: "patch";
22
- }>;
23
- path: z.ZodString;
24
- content: z.ZodString;
25
- }, z.core.$strip>>;
26
- export type FileChanges = z.infer<typeof CHANGES>;
27
- type ClientActionPrompt = {
28
- type: 'prompt';
29
- promptId: string;
30
- prompt: string | undefined;
31
- content?: (TextPart | ImagePart)[];
32
- promptParams?: Record<string, any>;
33
- fingerprintId: string;
34
- authToken?: string;
35
- costMode?: string;
36
- sessionState: SessionState;
37
- toolResults: ToolMessage[];
38
- model?: string;
39
- repoUrl?: string;
40
- agentId?: string;
41
- };
42
- type ClientActionReadFilesResponse = {
43
- type: 'read-files-response';
44
- files: Record<string, string | null>;
45
- requestId?: string;
46
- };
47
- type ClientActionInit = {
48
- type: 'init';
49
- fingerprintId: string;
50
- authToken?: string;
51
- fileContext: ProjectFileContext;
52
- repoUrl?: string;
53
- };
54
- type ClientActionToolCallResponse = {
55
- type: 'tool-call-response';
56
- requestId: string;
57
- output: ToolResultOutput[];
58
- };
59
- type ClientActionCancelUserInput = {
60
- type: 'cancel-user-input';
61
- authToken: string;
62
- promptId: string;
63
- };
64
- type ClientActionMcpToolData = {
65
- type: 'mcp-tool-data';
66
- requestId: string;
67
- tools: {
68
- name: string;
69
- description?: string;
70
- inputSchema: {
71
- type: 'object';
72
- [k: string]: unknown;
73
- };
74
- }[];
75
- };
76
- type ClientActionAny = ClientActionPrompt | ClientActionReadFilesResponse | ClientActionInit | ClientActionToolCallResponse | ClientActionCancelUserInput | ClientActionMcpToolData;
77
- type ClientActionType = ClientActionAny['type'];
78
- export type ClientAction<T extends ClientActionType = ClientActionType> = {
79
- [K in ClientActionType]: Extract<ClientActionAny, {
80
- type: K;
81
- }>;
82
- }[T];
83
- type ServerActionResponseChunk = {
84
- type: 'response-chunk';
85
- userInputId: string;
86
- chunk: string | PrintModeEvent;
87
- };
88
- type ServerActionSubagentResponseChunk = {
89
- type: 'subagent-response-chunk';
90
- userInputId: string;
91
- agentId: string;
92
- agentType: string;
93
- chunk: string;
94
- prompt?: string;
95
- forwardToPrompt?: boolean;
96
- };
97
- type ServerActionHandleStepsLogChunk = {
98
- type: 'handlesteps-log-chunk';
99
- userInputId: string;
100
- agentId: string;
101
- level: 'debug' | 'info' | 'warn' | 'error';
102
- data: any;
103
- message?: string;
104
- };
105
- export type PromptResponse = {
106
- type: 'prompt-response';
107
- promptId: string;
108
- sessionState: SessionState;
109
- toolCalls?: ToolCall[];
110
- toolResults?: ToolMessage[];
111
- output?: AgentOutput;
112
- };
113
- type ServerActionReadFiles = {
114
- type: 'read-files';
115
- filePaths: string[];
116
- requestId: string;
117
- };
118
- type ServerActionToolCallRequest = {
119
- type: 'tool-call-request';
120
- userInputId: string;
121
- requestId: string;
122
- toolName: string;
123
- input: Record<string, any>;
124
- timeout?: number;
125
- mcpConfig?: MCPConfig;
126
- };
127
- export type InitResponse = {
128
- type: 'init-response';
129
- message?: string;
130
- agentNames?: Record<string, string>;
131
- } & Omit<UsageResponse, 'type'>;
132
- export type UsageResponse = {
133
- type: 'usage-response';
134
- usage: number;
135
- remainingBalance: number;
136
- balanceBreakdown?: Record<GrantType, number>;
137
- next_quota_reset: Date | null;
138
- autoTopupAdded?: number;
139
- autoTopupEnabled?: boolean;
140
- };
141
- export type MessageCostResponse = {
142
- type: 'message-cost-response';
143
- promptId: string;
144
- credits: number;
145
- agentId?: string;
146
- };
147
- type ServerActionActionError = {
148
- type: 'action-error';
149
- message: string;
150
- error?: string;
151
- remainingBalance?: number;
152
- };
153
- type ServerActionPromptError = {
154
- type: 'prompt-error';
155
- userInputId: string;
156
- message: string;
157
- error?: string;
158
- remainingBalance?: number;
159
- };
160
- type ServerActionRequestReconnect = {
161
- type: 'request-reconnect';
162
- };
163
- type ServerActionRequestMcpToolData = {
164
- type: 'request-mcp-tool-data';
165
- requestId: string;
166
- mcpConfig: MCPConfig;
167
- toolNames?: string[];
168
- };
169
- type ServerActionAny = ServerActionResponseChunk | ServerActionSubagentResponseChunk | ServerActionHandleStepsLogChunk | PromptResponse | ServerActionReadFiles | ServerActionToolCallRequest | InitResponse | UsageResponse | MessageCostResponse | ServerActionActionError | ServerActionPromptError | ServerActionRequestReconnect | ServerActionRequestMcpToolData;
170
- type ServerActionType = ServerActionAny['type'];
171
- export type ServerAction<T extends ServerActionType = ServerActionType> = {
172
- [K in ServerActionType]: Extract<ServerActionAny, {
173
- type: K;
174
- }>;
175
- }[T];
176
- export {};
@@ -1,52 +0,0 @@
1
- /**
2
- * Shared analytics core module.
3
- * Provides common interfaces, types, and utilities used by both
4
- * server-side (common/src/analytics.ts) and CLI (cli/src/utils/analytics.ts) analytics.
5
- */
6
- /** Interface for PostHog client methods used for event capture */
7
- export interface AnalyticsClient {
8
- capture: (params: {
9
- distinctId: string;
10
- event: string;
11
- properties?: Record<string, any>;
12
- }) => void;
13
- flush: () => Promise<void>;
14
- }
15
- /** Extended client interface with identify, alias, and exception capture (used by CLI) */
16
- export interface AnalyticsClientWithIdentify extends AnalyticsClient {
17
- identify: (params: {
18
- distinctId: string;
19
- properties?: Record<string, any>;
20
- }) => void;
21
- /** Links an alias (previous anonymous ID) to a distinctId (real user ID) */
22
- alias: (data: {
23
- distinctId: string;
24
- alias: string;
25
- }) => void;
26
- captureException: (error: any, distinctId: string, properties?: Record<string, any>) => void;
27
- }
28
- /** Environment name type */
29
- export type AnalyticsEnvName = 'dev' | 'test' | 'prod';
30
- /** Base analytics configuration */
31
- export interface AnalyticsConfig {
32
- envName: AnalyticsEnvName;
33
- posthogApiKey: string;
34
- posthogHostUrl: string;
35
- }
36
- /** Options for creating a PostHog client */
37
- export interface PostHogClientOptions {
38
- host: string;
39
- flushAt?: number;
40
- flushInterval?: number;
41
- enableExceptionAutocapture?: boolean;
42
- }
43
- /**
44
- * Default PostHog client factory.
45
- * Creates a real PostHog client instance.
46
- */
47
- export declare function createPostHogClient(apiKey: string, options: PostHogClientOptions): AnalyticsClientWithIdentify;
48
- /**
49
- * Generates a unique anonymous ID for pre-login tracking.
50
- * Uses crypto.randomUUID() for uniqueness.
51
- */
52
- export declare function generateAnonymousId(): string;
@@ -1,9 +0,0 @@
1
- import { AnalyticsEvent } from './constants/analytics-events';
2
- import type { Logger } from '@levelcode/common/types/contracts/logger';
3
- export declare function flushAnalytics(logger?: Logger): Promise<void>;
4
- export declare function trackEvent({ event, userId, properties, logger, }: {
5
- event: AnalyticsEvent;
6
- userId: string;
7
- properties?: Record<string, any>;
8
- logger: Logger;
9
- }): void;