@levelcode/sdk 0.0.5 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. package/dist/common/src/actions.d.ts +176 -0
  2. package/dist/common/src/analytics-core.d.ts +52 -0
  3. package/dist/common/src/analytics.d.ts +9 -0
  4. package/dist/common/src/browser-actions.d.ts +1200 -0
  5. package/dist/common/src/constants/agents.d.ts +47 -0
  6. package/dist/common/src/constants/analytics-events.d.ts +107 -0
  7. package/dist/common/src/constants/byok.d.ts +2 -0
  8. package/dist/common/src/constants/claude-oauth.d.ts +36 -0
  9. package/dist/common/src/constants/index.d.ts +4 -0
  10. package/dist/common/src/constants/knowledge.d.ts +21 -0
  11. package/dist/common/src/constants/limits.d.ts +14 -0
  12. package/dist/common/src/constants/model-config.d.ts +117 -0
  13. package/dist/common/src/constants/paths.d.ts +23 -0
  14. package/dist/common/src/constants/skills.d.ts +42 -0
  15. package/dist/common/src/constants/ui.d.ts +14 -0
  16. package/dist/common/src/env-ci.d.ts +22 -0
  17. package/dist/common/src/env-process.d.ts +28 -0
  18. package/dist/common/src/env-schema.d.ts +24 -0
  19. package/dist/common/src/env.d.ts +16 -0
  20. package/dist/common/src/mcp/client.d.ts +6 -0
  21. package/dist/common/src/old-constants.d.ts +10 -0
  22. package/dist/common/src/project-file-tree.d.ts +27 -0
  23. package/dist/common/src/templates/agent-validation.d.ts +48 -0
  24. package/dist/common/src/templates/initial-agents-dir/types/agent-definition.d.ts +296 -0
  25. package/dist/common/src/templates/initial-agents-dir/types/tools.d.ts +308 -0
  26. package/dist/common/src/templates/initial-agents-dir/types/util-types.d.ts +128 -0
  27. package/dist/common/src/testing/errors.d.ts +14 -0
  28. package/dist/common/src/testing/mock-modules.d.ts +11 -0
  29. package/dist/common/src/testing/mock-types.d.ts +97 -0
  30. package/dist/common/src/testing/mocks/analytics.d.ts +182 -0
  31. package/dist/common/src/testing/mocks/child-process.d.ts +29 -0
  32. package/dist/common/src/testing/mocks/crypto.d.ts +159 -0
  33. package/dist/common/src/testing/mocks/database.d.ts +197 -0
  34. package/dist/common/src/testing/mocks/fetch.d.ts +35 -0
  35. package/dist/common/src/testing/mocks/filesystem.d.ts +31 -0
  36. package/dist/common/src/testing/mocks/index.d.ts +25 -0
  37. package/dist/common/src/testing/mocks/logger.d.ts +35 -0
  38. package/dist/common/src/testing/mocks/stream.d.ts +203 -0
  39. package/dist/common/src/testing/mocks/timers.d.ts +27 -0
  40. package/dist/common/src/testing/mocks/tree-sitter.d.ts +58 -0
  41. package/dist/common/src/testing-env-process.d.ts +7 -0
  42. package/dist/common/src/tools/constants.d.ts +17 -0
  43. package/dist/common/src/tools/list.d.ts +1140 -0
  44. package/dist/common/src/tools/params/tool/add-message.d.ts +19 -0
  45. package/dist/common/src/tools/params/tool/add-subgoal.d.ts +26 -0
  46. package/dist/common/src/tools/params/tool/ask-user.d.ts +59 -0
  47. package/dist/common/src/tools/params/tool/browser-logs.d.ts +127 -0
  48. package/dist/common/src/tools/params/tool/code-search.d.ts +30 -0
  49. package/dist/common/src/tools/params/tool/create-plan.d.ts +30 -0
  50. package/dist/common/src/tools/params/tool/end-turn.d.ts +13 -0
  51. package/dist/common/src/tools/params/tool/find-files.d.ts +31 -0
  52. package/dist/common/src/tools/params/tool/glob.d.ts +26 -0
  53. package/dist/common/src/tools/params/tool/list-directory.d.ts +25 -0
  54. package/dist/common/src/tools/params/tool/lookup-agent-info.d.ts +13 -0
  55. package/dist/common/src/tools/params/tool/propose-str-replace.d.ts +40 -0
  56. package/dist/common/src/tools/params/tool/propose-write-file.d.ts +29 -0
  57. package/dist/common/src/tools/params/tool/read-docs.d.ts +19 -0
  58. package/dist/common/src/tools/params/tool/read-files.d.ts +35 -0
  59. package/dist/common/src/tools/params/tool/read-subtree.d.ts +40 -0
  60. package/dist/common/src/tools/params/tool/run-file-change-hooks.d.ts +63 -0
  61. package/dist/common/src/tools/params/tool/run-terminal-command.d.ts +88 -0
  62. package/dist/common/src/tools/params/tool/send-message.d.ts +26 -0
  63. package/dist/common/src/tools/params/tool/set-messages.d.ts +15 -0
  64. package/dist/common/src/tools/params/tool/set-output.d.ts +15 -0
  65. package/dist/common/src/tools/params/tool/skill.d.ts +28 -0
  66. package/dist/common/src/tools/params/tool/spawn-agent-inline.d.ts +17 -0
  67. package/dist/common/src/tools/params/tool/spawn-agents.d.ts +26 -0
  68. package/dist/common/src/tools/params/tool/str-replace.d.ts +43 -0
  69. package/dist/common/src/tools/params/tool/suggest-followups.d.ts +26 -0
  70. package/dist/common/src/tools/params/tool/task-completed.d.ts +13 -0
  71. package/dist/common/src/tools/params/tool/task-create.d.ts +18 -0
  72. package/dist/common/src/tools/params/tool/task-get.d.ts +15 -0
  73. package/dist/common/src/tools/params/tool/task-list.d.ts +13 -0
  74. package/dist/common/src/tools/params/tool/task-update.d.ts +23 -0
  75. package/dist/common/src/tools/params/tool/team-create.d.ts +17 -0
  76. package/dist/common/src/tools/params/tool/team-delete.d.ts +13 -0
  77. package/dist/common/src/tools/params/tool/think-deeply.d.ts +15 -0
  78. package/dist/common/src/tools/params/tool/update-subgoal.d.ts +25 -0
  79. package/dist/common/src/tools/params/tool/web-search.d.ts +25 -0
  80. package/dist/common/src/tools/params/tool/write-file.d.ts +31 -0
  81. package/dist/common/src/tools/params/tool/write-todos.d.ts +18 -0
  82. package/dist/common/src/tools/params/utils.d.ts +35 -0
  83. package/dist/common/src/tools/utils.d.ts +4 -0
  84. package/dist/common/src/types/agent-template.d.ts +156 -0
  85. package/dist/common/src/types/contracts/agent-runtime.d.ts +36 -0
  86. package/dist/common/src/types/contracts/analytics.d.ts +8 -0
  87. package/dist/common/src/types/contracts/billing.d.ts +40 -0
  88. package/dist/common/src/types/contracts/client.d.ts +45 -0
  89. package/dist/common/src/types/contracts/database.d.ts +80 -0
  90. package/dist/common/src/types/contracts/env.d.ts +150 -0
  91. package/dist/common/src/types/contracts/llm.d.ts +102 -0
  92. package/dist/common/src/types/contracts/logger.d.ts +8 -0
  93. package/dist/common/src/types/dynamic-agent-template.d.ts +227 -0
  94. package/dist/common/src/types/filesystem.d.ts +6 -0
  95. package/dist/common/src/types/function-params.d.ts +15 -0
  96. package/dist/common/src/types/grant.d.ts +2 -0
  97. package/dist/common/src/types/json.d.ts +9 -0
  98. package/dist/common/src/types/mcp.d.ts +31 -0
  99. package/dist/common/src/types/messages/content-part.d.ts +46 -0
  100. package/dist/common/src/types/messages/data-content.d.ts +3 -0
  101. package/dist/common/src/types/messages/levelcode-message.d.ts +37 -0
  102. package/dist/common/src/types/messages/provider-metadata.d.ts +3 -0
  103. package/dist/common/src/types/print-mode.d.ts +155 -0
  104. package/dist/common/src/types/session-state.d.ts +94 -0
  105. package/dist/common/src/types/skill.d.ts +31 -0
  106. package/dist/common/src/types/source.d.ts +8 -0
  107. package/dist/common/src/types/spawn.d.ts +8 -0
  108. package/dist/common/src/types/team-config.d.ts +39 -0
  109. package/dist/common/src/types/team-protocol.d.ts +64 -0
  110. package/dist/common/src/util/agent-id-parsing.d.ts +22 -0
  111. package/dist/common/src/util/agent-name-normalization.d.ts +12 -0
  112. package/dist/common/src/util/array.d.ts +6 -0
  113. package/dist/common/src/util/credentials.d.ts +11 -0
  114. package/dist/common/src/util/error.d.ts +128 -0
  115. package/dist/common/src/util/file.d.ts +133 -0
  116. package/dist/common/src/util/format-code-search.d.ts +16 -0
  117. package/dist/common/src/util/lru-cache.d.ts +30 -0
  118. package/dist/common/src/util/messages.d.ts +46 -0
  119. package/dist/common/src/util/model-utils.d.ts +8 -0
  120. package/dist/common/src/util/object.d.ts +22 -0
  121. package/dist/common/src/util/promise.d.ts +16 -0
  122. package/dist/common/src/util/random.d.ts +1 -0
  123. package/dist/common/src/util/skills.d.ts +5 -0
  124. package/dist/common/src/util/stop-sequence.d.ts +14 -0
  125. package/dist/common/src/util/string.d.ts +82 -0
  126. package/dist/common/src/util/xml.d.ts +12 -0
  127. package/dist/common/src/util/zod-schema.d.ts +5 -0
  128. package/dist/common/src/utils/team-fs.d.ts +17 -0
  129. package/dist/index.cjs +1940 -917
  130. package/dist/index.cjs.map +24 -9
  131. package/dist/index.mjs +2380 -1357
  132. package/dist/index.mjs.map +24 -9
  133. package/dist/packages/agent-runtime/src/constants.d.ts +1 -0
  134. package/dist/packages/agent-runtime/src/fast-rewrite.d.ts +45 -0
  135. package/dist/packages/agent-runtime/src/find-files/request-files-prompt.d.ts +71 -0
  136. package/dist/packages/agent-runtime/src/generate-diffs-prompt.d.ts +53 -0
  137. package/dist/packages/agent-runtime/src/get-file-reading-updates.d.ts +8 -0
  138. package/dist/packages/agent-runtime/src/llm-api/claude.d.ts +5 -0
  139. package/dist/packages/agent-runtime/src/llm-api/context7-api.d.ts +55 -0
  140. package/dist/packages/agent-runtime/src/llm-api/gemini-with-fallbacks.d.ts +40 -0
  141. package/dist/packages/agent-runtime/src/llm-api/levelcode-web-api.d.ts +49 -0
  142. package/dist/packages/agent-runtime/src/llm-api/relace-api.d.ts +16 -0
  143. package/dist/packages/agent-runtime/src/main-prompt.d.ts +29 -0
  144. package/dist/packages/agent-runtime/src/mcp-constants.d.ts +12 -0
  145. package/dist/packages/agent-runtime/src/mcp.d.ts +10 -0
  146. package/dist/packages/agent-runtime/src/process-file-block.d.ts +56 -0
  147. package/dist/packages/agent-runtime/src/process-str-replace.d.ts +21 -0
  148. package/dist/packages/agent-runtime/src/prompt-agent-stream.d.ts +28 -0
  149. package/dist/packages/agent-runtime/src/run-agent-step.d.ts +73 -0
  150. package/dist/packages/agent-runtime/src/run-programmatic-step.d.ts +40 -0
  151. package/dist/packages/agent-runtime/src/system-prompt/prompts.d.ts +19 -0
  152. package/dist/packages/agent-runtime/src/system-prompt/search-system-prompt.d.ts +14 -0
  153. package/dist/packages/agent-runtime/src/system-prompt/truncate-file-tree.d.ts +13 -0
  154. package/dist/packages/agent-runtime/src/templates/agent-registry.d.ts +35 -0
  155. package/dist/packages/agent-runtime/src/templates/prompts.d.ts +35 -0
  156. package/dist/packages/agent-runtime/src/templates/strings.d.ts +32 -0
  157. package/dist/packages/agent-runtime/src/templates/types.d.ts +13 -0
  158. package/dist/packages/agent-runtime/src/tool-stream-parser.d.ts +31 -0
  159. package/dist/packages/agent-runtime/src/tools/handlers/handler-function-type.d.ts +51 -0
  160. package/dist/packages/agent-runtime/src/tools/handlers/list.d.ts +347 -0
  161. package/dist/packages/agent-runtime/src/tools/handlers/tool/add-message.d.ts +9 -0
  162. package/dist/packages/agent-runtime/src/tools/handlers/tool/add-subgoal.d.ts +9 -0
  163. package/dist/packages/agent-runtime/src/tools/handlers/tool/ask-user.d.ts +10 -0
  164. package/dist/packages/agent-runtime/src/tools/handlers/tool/browser-logs.d.ts +8 -0
  165. package/dist/packages/agent-runtime/src/tools/handlers/tool/code-search.d.ts +8 -0
  166. package/dist/packages/agent-runtime/src/tools/handlers/tool/create-plan.d.ts +13 -0
  167. package/dist/packages/agent-runtime/src/tools/handlers/tool/end-turn.d.ts +7 -0
  168. package/dist/packages/agent-runtime/src/tools/handlers/tool/find-files.d.ts +27 -0
  169. package/dist/packages/agent-runtime/src/tools/handlers/tool/glob.d.ts +10 -0
  170. package/dist/packages/agent-runtime/src/tools/handlers/tool/list-directory.d.ts +10 -0
  171. package/dist/packages/agent-runtime/src/tools/handlers/tool/lookup-agent-info.d.ts +14 -0
  172. package/dist/packages/agent-runtime/src/tools/handlers/tool/propose-str-replace.d.ts +15 -0
  173. package/dist/packages/agent-runtime/src/tools/handlers/tool/propose-write-file.d.ts +7 -0
  174. package/dist/packages/agent-runtime/src/tools/handlers/tool/proposed-content-store.d.ts +27 -0
  175. package/dist/packages/agent-runtime/src/tools/handlers/tool/read-docs.d.ts +21 -0
  176. package/dist/packages/agent-runtime/src/tools/handlers/tool/read-files.d.ts +13 -0
  177. package/dist/packages/agent-runtime/src/tools/handlers/tool/read-subtree.d.ts +13 -0
  178. package/dist/packages/agent-runtime/src/tools/handlers/tool/run-file-change-hooks.d.ts +10 -0
  179. package/dist/packages/agent-runtime/src/tools/handlers/tool/run-terminal-command.d.ts +10 -0
  180. package/dist/packages/agent-runtime/src/tools/handlers/tool/send-message.d.ts +10 -0
  181. package/dist/packages/agent-runtime/src/tools/handlers/tool/set-messages.d.ts +9 -0
  182. package/dist/packages/agent-runtime/src/tools/handlers/tool/set-output.d.ts +18 -0
  183. package/dist/packages/agent-runtime/src/tools/handlers/tool/skill.d.ts +11 -0
  184. package/dist/packages/agent-runtime/src/tools/handlers/tool/spawn-agent-inline.d.ts +29 -0
  185. package/dist/packages/agent-runtime/src/tools/handlers/tool/spawn-agent-utils.d.ts +100 -0
  186. package/dist/packages/agent-runtime/src/tools/handlers/tool/spawn-agents.d.ts +35 -0
  187. package/dist/packages/agent-runtime/src/tools/handlers/tool/str-replace.d.ts +16 -0
  188. package/dist/packages/agent-runtime/src/tools/handlers/tool/suggest-followups.d.ts +9 -0
  189. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-completed.d.ts +7 -0
  190. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-create.d.ts +9 -0
  191. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-get.d.ts +9 -0
  192. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-list.d.ts +9 -0
  193. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-update.d.ts +9 -0
  194. package/dist/packages/agent-runtime/src/tools/handlers/tool/team-create.d.ts +10 -0
  195. package/dist/packages/agent-runtime/src/tools/handlers/tool/team-delete.d.ts +10 -0
  196. package/dist/packages/agent-runtime/src/tools/handlers/tool/think-deeply.d.ts +9 -0
  197. package/dist/packages/agent-runtime/src/tools/handlers/tool/update-subgoal.d.ts +11 -0
  198. package/dist/packages/agent-runtime/src/tools/handlers/tool/web-search.d.ts +22 -0
  199. package/dist/packages/agent-runtime/src/tools/handlers/tool/write-file.d.ts +49 -0
  200. package/dist/packages/agent-runtime/src/tools/handlers/tool/write-todos.d.ts +9 -0
  201. package/dist/packages/agent-runtime/src/tools/prompts.d.ts +31 -0
  202. package/dist/packages/agent-runtime/src/tools/stream-parser.d.ts +33 -0
  203. package/dist/packages/agent-runtime/src/tools/tool-executor.d.ts +87 -0
  204. package/dist/packages/agent-runtime/src/util/agent-output.d.ts +3 -0
  205. package/dist/packages/agent-runtime/src/util/messages.d.ts +68 -0
  206. package/dist/packages/agent-runtime/src/util/parse-tool-calls-from-text.d.ts +38 -0
  207. package/dist/packages/agent-runtime/src/util/render-read-files-result.d.ts +15 -0
  208. package/dist/packages/agent-runtime/src/util/simplify-tool-results.d.ts +7 -0
  209. package/dist/packages/agent-runtime/src/util/stream-xml-parser.d.ts +34 -0
  210. package/dist/packages/agent-runtime/src/util/token-counter.d.ts +3 -0
  211. package/dist/packages/code-map/src/index.d.ts +3 -0
  212. package/dist/packages/code-map/src/init-node.d.ts +4 -0
  213. package/dist/packages/code-map/src/languages.d.ts +36 -0
  214. package/dist/packages/code-map/src/parse.d.ts +21 -0
  215. package/dist/packages/code-map/src/types.d.ts +8 -0
  216. package/dist/packages/code-map/src/utils.d.ts +1 -0
  217. package/dist/sdk/src/__tests__/client.test.d.ts +1 -0
  218. package/dist/sdk/src/__tests__/code-search.test.d.ts +1 -0
  219. package/dist/sdk/src/__tests__/credentials.test.d.ts +1 -0
  220. package/dist/sdk/src/__tests__/database.test.d.ts +1 -0
  221. package/dist/sdk/src/__tests__/env.test.d.ts +1 -0
  222. package/dist/sdk/src/__tests__/error-utils.test.d.ts +1 -0
  223. package/dist/sdk/src/__tests__/initial-session-state.test.d.ts +1 -0
  224. package/dist/sdk/src/__tests__/knowledge-file-selection.test.d.ts +1 -0
  225. package/dist/sdk/src/__tests__/load-agents.test.d.ts +1 -0
  226. package/dist/sdk/src/__tests__/load-mcp-config.test.d.ts +1 -0
  227. package/dist/sdk/src/__tests__/model-provider.test.d.ts +1 -0
  228. package/dist/sdk/src/__tests__/read-files.test.d.ts +1 -0
  229. package/dist/sdk/src/__tests__/run-cancellation.test.d.ts +1 -0
  230. package/dist/sdk/src/__tests__/run-file-filter.test.d.ts +1 -0
  231. package/dist/sdk/src/__tests__/run-handle-event.test.d.ts +1 -0
  232. package/dist/sdk/src/__tests__/run.integration.test.d.ts +1 -0
  233. package/dist/sdk/src/__tests__/user-knowledge-files.test.d.ts +1 -0
  234. package/dist/sdk/src/__tests__/validate-agents.test.d.ts +1 -0
  235. package/dist/sdk/src/agents/load-agents.d.ts +106 -0
  236. package/dist/sdk/src/agents/load-mcp-config.d.ts +69 -0
  237. package/dist/sdk/src/client.d.ts +33 -0
  238. package/dist/sdk/src/constants.d.ts +4 -0
  239. package/dist/sdk/src/credentials.d.ts +58 -0
  240. package/dist/sdk/src/custom-tool.d.ts +32 -0
  241. package/dist/sdk/src/env.d.ts +31 -0
  242. package/dist/sdk/src/error-utils.d.ts +55 -0
  243. package/dist/sdk/src/impl/__tests__/prompt-result.test.d.ts +1 -0
  244. package/dist/sdk/src/impl/agent-runtime.d.ts +8 -0
  245. package/dist/sdk/src/impl/database.d.ts +7 -0
  246. package/dist/sdk/src/impl/llm.d.ts +8 -0
  247. package/dist/sdk/src/impl/model-provider.d.ts +61 -0
  248. package/dist/sdk/src/index.d.ts +41 -0
  249. package/dist/sdk/src/native/ripgrep.d.ts +7 -0
  250. package/dist/sdk/src/retry-config.d.ts +46 -0
  251. package/dist/sdk/src/run-state.d.ts +81 -0
  252. package/dist/sdk/src/run.d.ts +79 -0
  253. package/dist/sdk/src/skills/load-skills.d.ts +42 -0
  254. package/dist/sdk/src/testing/env.d.ts +5 -0
  255. package/dist/sdk/src/tools/change-file.d.ts +7 -0
  256. package/dist/sdk/src/tools/code-search.d.ts +13 -0
  257. package/dist/sdk/src/tools/glob.d.ts +8 -0
  258. package/dist/sdk/src/tools/index.d.ts +16 -0
  259. package/dist/sdk/src/tools/list-directory.d.ts +7 -0
  260. package/dist/sdk/src/tools/read-files.d.ts +16 -0
  261. package/dist/sdk/src/tools/run-file-change-hooks.d.ts +4 -0
  262. package/dist/sdk/src/tools/run-terminal-command.d.ts +8 -0
  263. package/dist/sdk/src/types/env.d.ts +30 -0
  264. package/dist/sdk/src/validate-agents.d.ts +45 -0
  265. package/package.json +1 -1
  266. package/dist/index.d.ts +0 -3443
@@ -0,0 +1,42 @@
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>;
@@ -0,0 +1,5 @@
1
+ import type { SdkEnv } from '../types/env';
2
+ /**
3
+ * Test-only SDK env builder.
4
+ */
5
+ export declare const createTestSdkEnv: (overrides?: Partial<SdkEnv>) => SdkEnv;
@@ -0,0 +1,7 @@
1
+ import type { LevelCodeToolOutput } from '@levelcode/common/tools/list';
2
+ import type { LevelCodeFileSystem } from '@levelcode/common/types/filesystem';
3
+ export declare function changeFile(params: {
4
+ parameters: unknown;
5
+ cwd: string;
6
+ fs: LevelCodeFileSystem;
7
+ }): Promise<LevelCodeToolOutput<'str_replace'>>;
@@ -0,0 +1,13 @@
1
+ import type { LevelCodeToolOutput } from '../../../common/src/tools/list';
2
+ import { Logger } from '@levelcode/common/types/contracts/logger';
3
+ export declare function codeSearch({ projectPath, pattern, flags, cwd, maxResults, globalMaxResults, maxOutputStringLength, timeoutSeconds, logger, }: {
4
+ projectPath: string;
5
+ pattern: string;
6
+ flags?: string;
7
+ cwd?: string;
8
+ maxResults?: number;
9
+ globalMaxResults?: number;
10
+ maxOutputStringLength?: number;
11
+ timeoutSeconds?: number;
12
+ logger?: Logger;
13
+ }): Promise<LevelCodeToolOutput<'code_search'>>;
@@ -0,0 +1,8 @@
1
+ import type { LevelCodeToolOutput } from '@levelcode/common/tools/list';
2
+ import type { LevelCodeFileSystem } from '@levelcode/common/types/filesystem';
3
+ export declare function glob(params: {
4
+ pattern: string;
5
+ projectPath: string;
6
+ cwd?: string;
7
+ fs: LevelCodeFileSystem;
8
+ }): Promise<LevelCodeToolOutput<'glob'>>;
@@ -0,0 +1,16 @@
1
+ import { changeFile } from './change-file';
2
+ import { codeSearch } from './code-search';
3
+ import { glob } from './glob';
4
+ import { listDirectory } from './list-directory';
5
+ import { getFiles } from './read-files';
6
+ import { runFileChangeHooks } from './run-file-change-hooks';
7
+ import { runTerminalCommand } from './run-terminal-command';
8
+ export declare const ToolHelpers: {
9
+ runTerminalCommand: typeof runTerminalCommand;
10
+ codeSearch: typeof codeSearch;
11
+ glob: typeof glob;
12
+ listDirectory: typeof listDirectory;
13
+ getFiles: typeof getFiles;
14
+ runFileChangeHooks: typeof runFileChangeHooks;
15
+ changeFile: typeof changeFile;
16
+ };
@@ -0,0 +1,7 @@
1
+ import type { LevelCodeToolOutput } from '@levelcode/common/tools/list';
2
+ import type { LevelCodeFileSystem } from '@levelcode/common/types/filesystem';
3
+ export declare function listDirectory(params: {
4
+ directoryPath: string;
5
+ projectPath: string;
6
+ fs: LevelCodeFileSystem;
7
+ }): Promise<LevelCodeToolOutput<'list_directory'>>;
@@ -0,0 +1,16 @@
1
+ import type { LevelCodeFileSystem } from '@levelcode/common/types/filesystem';
2
+ export type FileFilterResult = {
3
+ status: 'blocked' | 'allow-example' | 'allow';
4
+ };
5
+ export type FileFilter = (filePath: string) => FileFilterResult;
6
+ export declare function getFiles(params: {
7
+ filePaths: string[];
8
+ cwd: string;
9
+ fs: LevelCodeFileSystem;
10
+ /**
11
+ * Filter to classify files before reading.
12
+ * If provided, the caller takes full control of filtering (no gitignore check).
13
+ * If not provided, the SDK applies gitignore checking automatically.
14
+ */
15
+ fileFilter?: FileFilter;
16
+ }): Promise<Record<string, string | null>>;
@@ -0,0 +1,4 @@
1
+ import type { LevelCodeToolOutput } from '../../../common/src/tools/list';
2
+ export declare function runFileChangeHooks({ files, }: {
3
+ files: string[];
4
+ }): Promise<LevelCodeToolOutput<'run_file_change_hooks'>>;
@@ -0,0 +1,8 @@
1
+ import type { LevelCodeToolOutput } from '../../../common/src/tools/list';
2
+ export declare function runTerminalCommand({ command, process_type, cwd, timeout_seconds, env, }: {
3
+ command: string;
4
+ process_type: 'SYNC' | 'BACKGROUND';
5
+ cwd: string;
6
+ timeout_seconds: number;
7
+ env?: NodeJS.ProcessEnv;
8
+ }): Promise<LevelCodeToolOutput<'run_terminal_command'>>;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * SDK-specific environment variable types.
3
+ *
4
+ * Extends base types from common with SDK-specific vars for:
5
+ * - Ripgrep binary path configuration
6
+ * - WASM module directory
7
+ */
8
+ import type { BaseEnv, ClientEnv } from '@levelcode/common/types/contracts/env';
9
+ /**
10
+ * SDK-specific env vars for binary paths and WASM.
11
+ */
12
+ export type SdkEnv = BaseEnv & {
13
+ LEVELCODE_RG_PATH?: string;
14
+ LEVELCODE_WASM_DIR?: string;
15
+ VERBOSE?: string;
16
+ OVERRIDE_TARGET?: string;
17
+ OVERRIDE_PLATFORM?: string;
18
+ OVERRIDE_ARCH?: string;
19
+ };
20
+ /**
21
+ * Full SDK env deps combining client env and SDK env.
22
+ */
23
+ export type SdkEnvDeps = {
24
+ clientEnv: ClientEnv;
25
+ env: SdkEnv;
26
+ };
27
+ /**
28
+ * Function type for getting SDK env values.
29
+ */
30
+ export type GetSdkEnvFn = () => SdkEnv;
@@ -0,0 +1,45 @@
1
+ import type { AgentDefinition } from '@levelcode/common/templates/initial-agents-dir/types/agent-definition';
2
+ export interface ValidationResult {
3
+ success: boolean;
4
+ validationErrors: Array<{
5
+ id: string;
6
+ message: string;
7
+ }>;
8
+ errorCount: number;
9
+ }
10
+ export interface ValidateAgentsOptions {
11
+ /**
12
+ * Whether to perform remote validation via the web API.
13
+ * Remote validation checks spawnable agents against the database.
14
+ */
15
+ remote?: boolean;
16
+ /**
17
+ * The base URL of the LevelCode website API.
18
+ * Optional - defaults to NEXT_PUBLIC_LEVELCODE_APP_URL or environment-based URL.
19
+ * Example: 'https://levelcode.vercel.app'
20
+ */
21
+ websiteUrl?: string;
22
+ }
23
+ /**
24
+ * Validates an array of agent definitions.
25
+ *
26
+ * By default, performs local Zod schema validation.
27
+ * When `options.remote` is true, additionally validates spawnable agents via the web API.
28
+ *
29
+ * @param definitions - Array of agent definitions to validate
30
+ * @param options - Optional configuration for validation
31
+ * @returns Promise<ValidationResult> - Validation results with any errors
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * // Local validation only
36
+ * const result = await validateAgents(definitions)
37
+ *
38
+ * // Remote validation
39
+ * const result = await validateAgents(definitions, {
40
+ * remote: true,
41
+ * websiteUrl: 'https://levelcode.vercel.app'
42
+ * })
43
+ * ```
44
+ */
45
+ export declare function validateAgents(definitions: AgentDefinition[], options?: ValidateAgentsOptions): Promise<ValidationResult>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@levelcode/sdk",
3
3
  "private": false,
4
- "version": "0.0.5",
4
+ "version": "0.1.0",
5
5
  "description": "Official SDK for LevelCode — AI coding agent & framework",
6
6
  "license": "Apache-2.0",
7
7
  "type": "module",