@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,31 @@
1
+ import { z } from 'zod/v4';
2
+ /**
3
+ * Zod schema for skill frontmatter metadata.
4
+ */
5
+ export declare const SkillMetadataSchema: z.ZodRecord<z.ZodString, z.ZodString>;
6
+ /**
7
+ * Zod schema for skill frontmatter (parsed from YAML).
8
+ */
9
+ export declare const SkillFrontmatterSchema: z.ZodObject<{
10
+ name: z.ZodString;
11
+ description: z.ZodString;
12
+ license: z.ZodOptional<z.ZodString>;
13
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
14
+ }, z.core.$strip>;
15
+ export type SkillFrontmatter = z.infer<typeof SkillFrontmatterSchema>;
16
+ /**
17
+ * Full skill definition including content and source path.
18
+ */
19
+ export declare const SkillDefinitionSchema: z.ZodObject<{
20
+ name: z.ZodString;
21
+ description: z.ZodString;
22
+ license: z.ZodOptional<z.ZodString>;
23
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
24
+ content: z.ZodString;
25
+ filePath: z.ZodString;
26
+ }, z.core.$strip>;
27
+ export type SkillDefinition = z.infer<typeof SkillDefinitionSchema>;
28
+ /**
29
+ * Collection of skills keyed by skill name.
30
+ */
31
+ export type SkillsMap = Record<string, SkillDefinition>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Represents a source of data.
3
+ *
4
+ * By default, can be a value or a promise.
5
+ *
6
+ * In the case that the type is a not function itself, this can also be a function that returns the value or promise.
7
+ */
8
+ export type Source<T> = T | Promise<T> | (T extends (...args: unknown[]) => unknown ? never : () => T | Promise<T>);
@@ -0,0 +1,8 @@
1
+ import type { ChildProcess, SpawnOptions } from 'child_process';
2
+ /**
3
+ * Spawn function for running shell commands.
4
+ *
5
+ * Compatible with `child_process.spawn` from Node.js.
6
+ * Returns ChildProcess to support full streaming capabilities (stdin, stdout, stderr).
7
+ */
8
+ export type LevelCodeSpawn = (command: string, args?: readonly string[], options?: SpawnOptions) => ChildProcess;
@@ -0,0 +1,39 @@
1
+ export type TeamRole = 'coordinator' | 'cto' | 'vp-engineering' | 'director' | 'fellow' | 'distinguished-engineer' | 'principal-engineer' | 'senior-staff-engineer' | 'staff-engineer' | 'manager' | 'sub-manager' | 'senior-engineer' | 'super-senior' | 'mid-level-engineer' | 'junior-engineer' | 'researcher' | 'scientist' | 'designer' | 'product-lead' | 'tester' | 'reviewer' | 'intern' | 'apprentice';
2
+ export type DevPhase = 'planning' | 'pre-alpha' | 'alpha' | 'beta' | 'production' | 'mature';
3
+ export interface TeamMember {
4
+ agentId: string;
5
+ name: string;
6
+ role: TeamRole;
7
+ agentType: string;
8
+ model: string;
9
+ joinedAt: number;
10
+ status: 'active' | 'idle' | 'completed' | 'failed';
11
+ currentTaskId?: string;
12
+ cwd: string;
13
+ }
14
+ export interface TeamConfig {
15
+ name: string;
16
+ description: string;
17
+ createdAt: number;
18
+ leadAgentId: string;
19
+ phase: DevPhase;
20
+ members: TeamMember[];
21
+ settings: {
22
+ maxMembers: number;
23
+ autoAssign: boolean;
24
+ };
25
+ }
26
+ export interface TeamTask {
27
+ id: string;
28
+ subject: string;
29
+ description: string;
30
+ status: 'pending' | 'in_progress' | 'completed' | 'blocked';
31
+ owner?: string;
32
+ blockedBy: string[];
33
+ blocks: string[];
34
+ phase: DevPhase;
35
+ activeForm?: string;
36
+ createdAt: number;
37
+ updatedAt: number;
38
+ metadata?: Record<string, unknown>;
39
+ }
@@ -0,0 +1,64 @@
1
+ export type IdleNotification = {
2
+ type: 'idle_notification';
3
+ from: string;
4
+ timestamp: string;
5
+ summary?: string;
6
+ completedTaskId?: string;
7
+ };
8
+ export type TaskCompletedMessage = {
9
+ type: 'task_completed';
10
+ from: string;
11
+ taskId: string;
12
+ taskSubject: string;
13
+ timestamp: string;
14
+ };
15
+ export type ShutdownRequest = {
16
+ type: 'shutdown_request';
17
+ requestId: string;
18
+ from: string;
19
+ reason?: string;
20
+ timestamp: string;
21
+ };
22
+ export type ShutdownApproved = {
23
+ type: 'shutdown_approved';
24
+ requestId: string;
25
+ from: string;
26
+ timestamp: string;
27
+ };
28
+ export type ShutdownRejected = {
29
+ type: 'shutdown_rejected';
30
+ requestId: string;
31
+ from: string;
32
+ reason: string;
33
+ timestamp: string;
34
+ };
35
+ export type PlanApprovalRequest = {
36
+ type: 'plan_approval_request';
37
+ requestId: string;
38
+ from: string;
39
+ planContent: string;
40
+ timestamp: string;
41
+ };
42
+ export type PlanApprovalResponse = {
43
+ type: 'plan_approval_response';
44
+ requestId: string;
45
+ approved: boolean;
46
+ feedback?: string;
47
+ timestamp: string;
48
+ };
49
+ export type TeamMessage = {
50
+ type: 'message';
51
+ from: string;
52
+ to: string;
53
+ text: string;
54
+ summary?: string;
55
+ timestamp: string;
56
+ };
57
+ export type BroadcastMessage = {
58
+ type: 'broadcast';
59
+ from: string;
60
+ text: string;
61
+ summary?: string;
62
+ timestamp: string;
63
+ };
64
+ export type TeamProtocolMessage = IdleNotification | TaskCompletedMessage | ShutdownRequest | ShutdownApproved | ShutdownRejected | PlanApprovalRequest | PlanApprovalResponse | TeamMessage | BroadcastMessage;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Parse agent ID to extract publisher, agent name, and version
3
+ * Supports formats:
4
+ * - publisher/agentId[@version]
5
+ * - agentId[@version] (no publisher)
6
+ */
7
+ export declare function parseAgentId(fullAgentId: string): {
8
+ publisherId?: string;
9
+ agentId?: string;
10
+ version?: string;
11
+ givenAgentId: string;
12
+ };
13
+ /**
14
+ * Parse published agent ID to extract publisher, agent name, and optionally version
15
+ *
16
+ * If the agent ID is not in the publisher/agent format, return null
17
+ */
18
+ export declare function parsePublishedAgentId(fullAgentId: string): {
19
+ publisherId: string;
20
+ agentId: string;
21
+ version?: string;
22
+ } | null;
@@ -0,0 +1,12 @@
1
+ export declare const DEFAULT_ORG_PREFIX = "levelcode/";
2
+ /**
3
+ * Resolves an agent ID by trying multiple strategies:
4
+ * 1. Direct lookup in registry
5
+ * 2. Try with DEFAULT_ORG_PREFIX for spawnable agents
6
+ * 3. Return null if not found
7
+ *
8
+ * This provides a more robust alternative to string concatenation
9
+ * and handles the common case where users reference spawnable agents
10
+ * without the org prefix.
11
+ */
12
+ export declare function resolveAgentId(agentId: string, agentRegistry: Record<string, any>): string | null;
@@ -0,0 +1,6 @@
1
+ export declare function filterDefined<T>(array: (T | null | undefined)[]): T[];
2
+ type Falsey = false | undefined | null | 0 | '';
3
+ type FalseyValueArray<T> = T | Falsey | FalseyValueArray<T>[];
4
+ export declare function buildArray<T>(...params: FalseyValueArray<T>[]): T[];
5
+ export declare function groupConsecutive<T, U>(xs: T[], key: (x: T) => U): any[];
6
+ export {};
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod/v4';
2
+ export declare const userSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ email: z.ZodString;
5
+ name: z.ZodNullable<z.ZodString>;
6
+ authToken: z.ZodString;
7
+ fingerprintId: z.ZodString;
8
+ fingerprintHash: z.ZodString;
9
+ }, z.core.$strip>;
10
+ export type User = z.infer<typeof userSchema>;
11
+ export declare const genAuthCode: (fingerprintId: string, expiresAt: string, secret: string) => string;
@@ -0,0 +1,128 @@
1
+ export type ErrorOr<T, E extends ErrorObject = ErrorObject> = Success<T> | Failure<E>;
2
+ export type Success<T> = {
3
+ success: true;
4
+ value: T;
5
+ };
6
+ export type Failure<E extends ErrorObject = ErrorObject> = {
7
+ success: false;
8
+ error: E;
9
+ };
10
+ /**
11
+ * Result type for prompt functions that can be aborted.
12
+ * Provides rich semantics to distinguish between successful completion and user abort.
13
+ *
14
+ * ## When to use `PromptResult<T>` vs `ErrorOr<T>`
15
+ *
16
+ * Use `PromptResult<T>` when:
17
+ * - The operation can be cancelled by the user (via AbortSignal)
18
+ * - An abort is an expected outcome, not an error
19
+ * - You need to distinguish between errors (which might trigger fallbacks) and
20
+ * user-initiated aborts (which should propagate immediately)
21
+ *
22
+ * Use `ErrorOr<T>` when:
23
+ * - The operation can fail with an error that should be handled
24
+ * - There's no concept of user-initiated abort
25
+ * - You want to return error details rather than throw
26
+ *
27
+ * ## Abort handling patterns
28
+ *
29
+ * 1. **Check and return early** - For graceful handling where abort means "stop, no error":
30
+ * ```ts
31
+ * const result = await promptAiSdk({ ... })
32
+ * if (result.aborted) return // or return null, false, etc.
33
+ * doSomething(result.value)
34
+ * ```
35
+ *
36
+ * 2. **Unwrap and throw** - For propagating aborts as exceptions:
37
+ * ```ts
38
+ * const value = unwrapPromptResult(await promptAiSdk({ ... }))
39
+ * // Throws if aborted, callers should use isAbortError() in catch blocks
40
+ * ```
41
+ *
42
+ * 3. **Rethrow in catch blocks** - Prevent swallowing abort errors:
43
+ * ```ts
44
+ * try {
45
+ * await someOperation()
46
+ * } catch (error) {
47
+ * if (isAbortError(error)) throw error // Don't swallow aborts
48
+ * // Handle other errors
49
+ * }
50
+ * ```
51
+ */
52
+ export type PromptResult<T> = PromptSuccess<T> | PromptAborted;
53
+ export type PromptSuccess<T> = {
54
+ aborted: false;
55
+ value: T;
56
+ };
57
+ export type PromptAborted = {
58
+ aborted: true;
59
+ reason?: string;
60
+ };
61
+ export type ErrorObject = {
62
+ name: string;
63
+ message: string;
64
+ stack?: string;
65
+ /** HTTP status code from error.status (used by some libraries) */
66
+ status?: number;
67
+ /** HTTP status code from error.statusCode (used by AI SDK and LevelCode errors) */
68
+ statusCode?: number;
69
+ /** Optional machine-friendly error code, if available */
70
+ code?: string;
71
+ /** Optional raw error object */
72
+ rawError?: string;
73
+ /** Response body from API errors (AI SDK APICallError) */
74
+ responseBody?: string;
75
+ /** URL that was called (API errors) */
76
+ url?: string;
77
+ /** Whether the error is retryable (API errors) */
78
+ isRetryable?: boolean;
79
+ /** Request body values that were sent (API errors) - stringified for safety */
80
+ requestBodyValues?: string;
81
+ /** Cause of the error, if nested */
82
+ cause?: ErrorObject;
83
+ };
84
+ export declare function success<T>(value: T): Success<T>;
85
+ export declare function failure(error: unknown): Failure<ErrorObject>;
86
+ /**
87
+ * Create a successful prompt result.
88
+ */
89
+ export declare function promptSuccess<T>(value: T): PromptSuccess<T>;
90
+ /**
91
+ * Create an aborted prompt result.
92
+ */
93
+ export declare function promptAborted(reason?: string): PromptAborted;
94
+ /**
95
+ * Standard error message for aborted requests.
96
+ * Use this constant when throwing abort errors to ensure consistency.
97
+ */
98
+ export declare const ABORT_ERROR_MESSAGE = "Request aborted";
99
+ /**
100
+ * Custom error class for abort errors.
101
+ * Use this class instead of generic Error for abort errors to ensure
102
+ * robust detection via isAbortError() (checks error.name === 'AbortError').
103
+ */
104
+ export declare class AbortError extends Error {
105
+ constructor(reason?: string);
106
+ }
107
+ /**
108
+ * Check if an error is an abort error.
109
+ * Use this helper to detect abort errors in catch blocks.
110
+ *
111
+ * Detects both:
112
+ * - Errors with message starting with 'Request aborted' (thrown by our code via AbortError)
113
+ * - Native AbortError (thrown by fetch/AI SDK when AbortSignal is triggered)
114
+ */
115
+ export declare function isAbortError(error: unknown): boolean;
116
+ /**
117
+ * Unwrap a PromptResult, returning the value if successful or throwing if aborted.
118
+ *
119
+ * Use this helper for consistent abort handling when you want aborts to propagate
120
+ * as exceptions. Callers should use `isAbortError()` in catch blocks to detect
121
+ * and handle abort errors appropriately (e.g., rethrow instead of logging as errors).
122
+ *
123
+ * @throws {AbortError} When result.aborted is true.
124
+ */
125
+ export declare function unwrapPromptResult<T>(result: PromptResult<T>): T;
126
+ export declare function getErrorObject(error: unknown, options?: {
127
+ includeRawError?: boolean;
128
+ }): ErrorObject;
@@ -0,0 +1,133 @@
1
+ import { z } from 'zod/v4';
2
+ import type { LevelCodeFileSystem } from '../types/filesystem';
3
+ import type { SkillsMap } from '../types/skill';
4
+ export declare const FileTreeNodeSchema: z.ZodType<FileTreeNode>;
5
+ export interface FileTreeNode {
6
+ name: string;
7
+ type: 'file' | 'directory';
8
+ filePath: string;
9
+ lastReadTime?: number;
10
+ children?: FileTreeNode[];
11
+ }
12
+ export interface DirectoryNode extends FileTreeNode {
13
+ type: 'directory';
14
+ children: FileTreeNode[];
15
+ }
16
+ export interface FileNode extends FileTreeNode {
17
+ type: 'file';
18
+ lastReadTime: number;
19
+ }
20
+ export declare const FileVersionSchema: z.ZodObject<{
21
+ path: z.ZodString;
22
+ content: z.ZodString;
23
+ }, z.core.$strip>;
24
+ export type FileVersion = z.infer<typeof FileVersionSchema>;
25
+ export declare const customToolDefinitionsSchema: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
26
+ inputSchema: z.ZodCustom<Record<string, unknown> | z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
27
+ endsAgentStep: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
28
+ description: z.ZodOptional<z.ZodString>;
29
+ exampleInputs: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodAny>>>;
30
+ }, z.core.$strip>>>;
31
+ export type CustomToolDefinitions = NonNullable<z.input<typeof customToolDefinitionsSchema>>;
32
+ export declare const ProjectFileContextSchema: z.ZodObject<{
33
+ projectRoot: z.ZodString;
34
+ cwd: z.ZodString;
35
+ fileTree: z.ZodArray<z.ZodCustom<FileTreeNode, FileTreeNode>>;
36
+ fileTokenScores: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
37
+ tokenCallers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>>;
38
+ knowledgeFiles: z.ZodRecord<z.ZodString, z.ZodString>;
39
+ userKnowledgeFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
40
+ agentTemplates: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
41
+ customToolDefinitions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
42
+ inputSchema: z.ZodCustom<Record<string, unknown> | z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
43
+ endsAgentStep: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
44
+ description: z.ZodOptional<z.ZodString>;
45
+ exampleInputs: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodAny>>>;
46
+ }, z.core.$strip>>>;
47
+ skills: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
48
+ gitChanges: z.ZodObject<{
49
+ status: z.ZodString;
50
+ diff: z.ZodString;
51
+ diffCached: z.ZodString;
52
+ lastCommitMessages: z.ZodString;
53
+ }, z.core.$strip>;
54
+ changesSinceLastChat: z.ZodRecord<z.ZodString, z.ZodString>;
55
+ shellConfigFiles: z.ZodRecord<z.ZodString, z.ZodString>;
56
+ systemInfo: z.ZodObject<{
57
+ platform: z.ZodString;
58
+ shell: z.ZodString;
59
+ nodeVersion: z.ZodString;
60
+ arch: z.ZodString;
61
+ homedir: z.ZodString;
62
+ cpus: z.ZodNumber;
63
+ }, z.core.$strip>;
64
+ }, z.core.$strip>;
65
+ export type ProjectFileContext = {
66
+ projectRoot: string;
67
+ cwd: string;
68
+ fileTree: FileTreeNode[];
69
+ fileTokenScores: Record<string, Record<string, number>>;
70
+ tokenCallers?: Record<string, Record<string, string[]>>;
71
+ knowledgeFiles: Record<string, string>;
72
+ userKnowledgeFiles?: Record<string, string>;
73
+ agentTemplates: Record<string, any>;
74
+ customToolDefinitions: CustomToolDefinitions;
75
+ skills?: SkillsMap;
76
+ gitChanges: {
77
+ status: string;
78
+ diff: string;
79
+ diffCached: string;
80
+ lastCommitMessages: string;
81
+ };
82
+ changesSinceLastChat: Record<string, string>;
83
+ shellConfigFiles: Record<string, string>;
84
+ systemInfo: {
85
+ platform: string;
86
+ shell: string;
87
+ nodeVersion: string;
88
+ arch: string;
89
+ homedir: string;
90
+ cpus: number;
91
+ };
92
+ };
93
+ export declare const fileRegex: RegExp;
94
+ export declare const fileWithNoPathRegex: RegExp;
95
+ export declare const parseFileBlocks: (fileBlocks: string) => Record<string, string>;
96
+ export declare const getStubProjectFileContext: () => ProjectFileContext;
97
+ export declare const createMarkdownFileBlock: (filePath: string, content: string) => string;
98
+ export declare const parseMarkdownCodeBlock: (content: string) => string;
99
+ export declare const createSearchReplaceBlock: (search: string, replace: string) => string;
100
+ export declare function printFileTree(nodes: FileTreeNode[], depth?: number): string;
101
+ export declare function printFileTreeWithTokens(nodes: FileTreeNode[], fileTokenScores: Record<string, Record<string, number>>, path?: string[]): string;
102
+ /**
103
+ * Ensures the given file contents ends with a newline character.
104
+ * @param contents - The file contents
105
+ * @returns the file contents with a newline character.
106
+ */
107
+ export declare const ensureEndsWithNewline: (contents: string | null) => string | null;
108
+ /**
109
+ * Node-compatible file existence check.
110
+ * Uses fs.stat instead of Bun-specific fs.exists.
111
+ */
112
+ export declare function fileExists(params: {
113
+ filePath: string;
114
+ fs: LevelCodeFileSystem;
115
+ }): Promise<boolean>;
116
+ export declare const ensureDirectoryExists: (params: {
117
+ baseDir: string;
118
+ fs: LevelCodeFileSystem;
119
+ }) => Promise<void>;
120
+ /**
121
+ * Removes markdown code block syntax if present, including any language tag
122
+ */
123
+ export declare const cleanMarkdownCodeBlock: (content: string) => string;
124
+ export declare function isValidFilePath(path: string): boolean;
125
+ export declare function isDir(params: {
126
+ path: string;
127
+ fs: LevelCodeFileSystem;
128
+ }): Promise<boolean>;
129
+ /**
130
+ * Returns true if the `toPath` is a subdirectory of `fromPath`.
131
+ */
132
+ export declare function isSubdir(fromPath: string, toPath: string): boolean;
133
+ export declare function isValidProjectRoot(dir: string): boolean;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Formats code search output to group matches by file.
3
+ *
4
+ * Input format: ./file.ts:line content
5
+ * Output format:
6
+ * ./file.ts:
7
+ * line content
8
+ * another line content
9
+ * yet another line content
10
+ *
11
+ * (double newline between distinct files)
12
+ *
13
+ * @param stdout The raw stdout from ripgrep
14
+ * @returns Formatted output with matches grouped by file
15
+ */
16
+ export declare function formatCodeSearchOutput(stdout: string): string;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * A simple Least Recently Used (LRU) cache implementation using a Map.
3
+ * It leverages the fact that Map objects maintain insertion order.
4
+ */
5
+ export declare class LRUCache<K, V> {
6
+ private maxSize;
7
+ private cache;
8
+ constructor(maxSize: number);
9
+ /**
10
+ * Retrieves an item from the cache. If found, marks it as recently used.
11
+ * @param key The key of the item to retrieve.
12
+ * @returns The value associated with the key, or undefined if not found.
13
+ */
14
+ get(key: K): V | undefined;
15
+ /**
16
+ * Adds or updates an item in the cache. If the cache exceeds maxSize,
17
+ * the least recently used item is evicted.
18
+ * @param key The key of the item to set.
19
+ * @param value The value to associate with the key.
20
+ */
21
+ set(key: K, value: V): void;
22
+ /**
23
+ * Returns the current number of items in the cache.
24
+ */
25
+ get size(): number;
26
+ /**
27
+ * Clears all items from the cache.
28
+ */
29
+ clear(): void;
30
+ }
@@ -0,0 +1,46 @@
1
+ import type { Logger } from '../types/contracts/logger';
2
+ import type { JSONValue } from '../types/json';
3
+ import type { AssistantMessage, Message, SystemMessage, UserMessage } from '../types/messages/levelcode-message';
4
+ import type { ToolResultOutput } from '../types/messages/content-part';
5
+ import type { ProviderMetadata } from '../types/messages/provider-metadata';
6
+ import type { ModelMessage } from 'ai';
7
+ export declare function toContentString(msg: ModelMessage): string;
8
+ export declare function withCacheControl<T extends {
9
+ providerOptions?: ProviderMetadata;
10
+ }>(obj: T): T;
11
+ export declare function withoutCacheControl<T extends {
12
+ providerOptions?: ProviderMetadata;
13
+ }>(obj: T): T;
14
+ export declare function convertCbToModelMessages({ messages, includeCacheControl, logger, }: {
15
+ messages: Message[];
16
+ includeCacheControl?: boolean;
17
+ logger?: Logger;
18
+ }): ModelMessage[];
19
+ export type SystemContent = string | SystemMessage['content'][number] | SystemMessage['content'];
20
+ export declare function systemContent(content: SystemContent): SystemMessage['content'];
21
+ export declare function systemMessage(params: SystemContent | ({
22
+ content: SystemContent;
23
+ } & Omit<SystemMessage, 'role' | 'content'>)): SystemMessage;
24
+ export type UserContent = string | UserMessage['content'][number] | UserMessage['content'];
25
+ export declare function userContent(content: UserContent): UserMessage['content'];
26
+ export declare function userMessage(params: UserContent | ({
27
+ content: UserContent;
28
+ } & Omit<UserMessage, 'role' | 'content'>)): UserMessage;
29
+ export type AssistantContent = string | AssistantMessage['content'][number] | AssistantMessage['content'];
30
+ export declare function assistantContent(content: AssistantContent): AssistantMessage['content'];
31
+ export declare function assistantMessage(params: AssistantContent | ({
32
+ content: AssistantContent;
33
+ } & Omit<AssistantMessage, 'role' | 'content'>)): AssistantMessage;
34
+ export declare function jsonToolResult<T extends JSONValue>(value: T): [
35
+ Extract<ToolResultOutput, {
36
+ type: 'json';
37
+ }> & {
38
+ value: T;
39
+ }
40
+ ];
41
+ export declare function mediaToolResult(params: {
42
+ data: string;
43
+ mediaType: string;
44
+ }): [Extract<ToolResultOutput, {
45
+ type: 'media';
46
+ }>];
@@ -0,0 +1,8 @@
1
+ import type { Model } from '../old-constants';
2
+ /**
3
+ * Check if a model is explicitly defined in the models constant object.
4
+ * This is used to determine if a model should allow fallbacks or support cache control.
5
+ * @param model - The model to check
6
+ * @returns boolean - True if the model is explicitly defined, false otherwise
7
+ */
8
+ export declare function isExplicitlyDefinedModel(model: Model): boolean;
@@ -0,0 +1,22 @@
1
+ type RemoveUndefined<T extends object> = {
2
+ [K in keyof T as T[K] extends undefined ? never : K]: Exclude<T[K], undefined>;
3
+ };
4
+ export declare const removeUndefinedProps: <T extends object>(obj: T) => RemoveUndefined<T>;
5
+ export declare const removeNullOrUndefinedProps: <T extends object>(obj: T, exceptions?: string[]) => T;
6
+ export declare const addObjects: <T extends {
7
+ [key: string]: number;
8
+ }>(obj1: T, obj2: T) => T;
9
+ export declare const subtractObjects: <T extends {
10
+ [key: string]: number;
11
+ }>(obj1: T, obj2: T) => T;
12
+ export declare const hasChanges: <T extends object>(obj: T, partial: Partial<T>) => boolean;
13
+ export declare const hasSignificantDeepChanges: <T extends object>(obj: T, partial: Partial<T>, epsilonForNumbers: number) => boolean;
14
+ export declare const filterObject: <T extends object>(obj: T, predicate: (value: any, key: keyof T) => boolean) => { [P in keyof T]: T[P]; };
15
+ /**
16
+ * Asserts that a condition is true. If the condition is false, it throws an error with the provided message.
17
+ * @param condition The condition to check
18
+ * @param message The error message to display if the condition is false
19
+ * @throws {Error} If the condition is false
20
+ */
21
+ export declare function assert(condition: boolean, message: string): asserts condition;
22
+ export {};
@@ -0,0 +1,16 @@
1
+ export declare const INITIAL_RETRY_DELAY = 1000;
2
+ export declare function withRetry<T>(operation: () => Promise<T>, options?: {
3
+ maxRetries?: number;
4
+ retryIf?: (error: any) => boolean;
5
+ onRetry?: (error: any, attempt: number) => void;
6
+ retryDelayMs?: number;
7
+ }): Promise<T>;
8
+ export declare const sleep: (ms: number) => Promise<unknown>;
9
+ /**
10
+ * Wraps a promise with a timeout
11
+ * @param promise The promise to wrap
12
+ * @param timeoutMs Timeout in milliseconds
13
+ * @param timeoutMessage Optional message for the timeout error
14
+ * @returns A promise that resolves with the result of the original promise or rejects with a timeout error
15
+ */
16
+ export declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number, timeoutMessage?: string): Promise<T>;
@@ -0,0 +1 @@
1
+ export declare function sampleSizeWithSeed<T>(array: T[], size: number, seed: string): T[];
@@ -0,0 +1,5 @@
1
+ import type { SkillsMap } from '../types/skill';
2
+ /**
3
+ * Formats available skills as XML for inclusion in tool descriptions.
4
+ */
5
+ export declare function formatAvailableSkillsXml(skills: SkillsMap): string;
@@ -0,0 +1,14 @@
1
+ export declare class StopSequenceHandler {
2
+ private buffer;
3
+ private finished;
4
+ private stopSequences;
5
+ constructor(stopSequences?: string[]);
6
+ process(text: string): {
7
+ text: string;
8
+ endOfStream: boolean;
9
+ } | {
10
+ text: null;
11
+ endOfStream: true;
12
+ };
13
+ flush(): string;
14
+ }