codecane 1.0.268 → 1.0.269

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 (529) hide show
  1. package/dist/actions.d.ts +2590 -0
  2. package/dist/actions.d.ts.map +1 -0
  3. package/dist/actions.js +143 -0
  4. package/dist/actions.js.map +1 -0
  5. package/dist/analytics.d.ts +5 -0
  6. package/dist/analytics.d.ts.map +1 -0
  7. package/dist/analytics.js +40 -0
  8. package/dist/analytics.js.map +1 -0
  9. package/dist/api-keys/constants.d.ts +9 -0
  10. package/dist/api-keys/constants.d.ts.map +1 -0
  11. package/dist/api-keys/constants.js +26 -0
  12. package/dist/api-keys/constants.js.map +1 -0
  13. package/dist/api-keys/crypto.d.ts +25 -0
  14. package/dist/api-keys/crypto.d.ts.map +1 -0
  15. package/dist/api-keys/crypto.js +186 -0
  16. package/dist/api-keys/crypto.js.map +1 -0
  17. package/dist/background-process-manager.d.ts +2 -1
  18. package/dist/background-process-manager.d.ts.map +1 -0
  19. package/dist/background-process-manager.js +3 -3
  20. package/dist/browser-actions.d.ts +4416 -0
  21. package/dist/browser-actions.d.ts.map +1 -0
  22. package/dist/browser-actions.js +343 -0
  23. package/dist/browser-actions.js.map +1 -0
  24. package/dist/browser-runner.d.ts +2 -1
  25. package/dist/browser-runner.d.ts.map +1 -0
  26. package/dist/browser-runner.js +4 -4
  27. package/dist/chat-storage.d.ts +2 -1
  28. package/dist/chat-storage.d.ts.map +1 -0
  29. package/dist/chat-storage.js +1 -1
  30. package/dist/checkpoints/checkpoint-manager.d.ts +2 -1
  31. package/dist/checkpoints/checkpoint-manager.d.ts.map +1 -0
  32. package/dist/checkpoints/checkpoint-manager.js +1 -1
  33. package/dist/checkpoints/file-manager.d.ts +1 -0
  34. package/dist/checkpoints/file-manager.d.ts.map +1 -0
  35. package/dist/cli-handlers/api-key.d.ts +2 -1
  36. package/dist/cli-handlers/api-key.d.ts.map +1 -0
  37. package/dist/cli-handlers/api-key.js +1 -1
  38. package/dist/cli-handlers/checkpoint.d.ts +1 -0
  39. package/dist/cli-handlers/checkpoint.d.ts.map +1 -0
  40. package/dist/cli-handlers/diff.d.ts +2 -1
  41. package/dist/cli-handlers/diff.d.ts.map +1 -0
  42. package/dist/cli-handlers/easter-egg.d.ts +1 -0
  43. package/dist/cli-handlers/easter-egg.d.ts.map +1 -0
  44. package/dist/cli-handlers/inititalization-flow.d.ts +1 -0
  45. package/dist/cli-handlers/inititalization-flow.d.ts.map +1 -0
  46. package/dist/cli-handlers/inititalization-flow.js +1 -1
  47. package/dist/cli.d.ts +2 -1
  48. package/dist/cli.d.ts.map +1 -0
  49. package/dist/cli.js +2 -2
  50. package/dist/client.d.ts +8 -7
  51. package/dist/client.d.ts.map +1 -0
  52. package/dist/client.js +9 -9
  53. package/dist/code-map/languages.d.ts +13 -0
  54. package/dist/code-map/languages.d.ts.map +1 -0
  55. package/dist/code-map/languages.js +129 -0
  56. package/dist/code-map/languages.js.map +1 -0
  57. package/dist/code-map/parse.d.ts +12 -0
  58. package/dist/code-map/parse.d.ts.map +1 -0
  59. package/dist/code-map/parse.js +127 -0
  60. package/dist/code-map/parse.js.map +1 -0
  61. package/dist/code-map/test-langs/test.d.ts +12 -0
  62. package/dist/code-map/test-langs/test.d.ts.map +1 -0
  63. package/dist/code-map/test-langs/test.js +23 -0
  64. package/dist/code-map/test-langs/test.js.map +1 -0
  65. package/dist/code-map/tree-sitter-queries/readme.md +23 -0
  66. package/dist/code-map/tree-sitter-queries/tree-sitter-c-tags.scm +11 -0
  67. package/dist/code-map/tree-sitter-queries/tree-sitter-c_sharp-tags.scm +13 -0
  68. package/dist/code-map/tree-sitter-queries/tree-sitter-cpp-tags.scm +17 -0
  69. package/dist/code-map/tree-sitter-queries/tree-sitter-go-tags.scm +26 -0
  70. package/dist/code-map/tree-sitter-queries/tree-sitter-java-tags.scm +19 -0
  71. package/dist/code-map/tree-sitter-queries/tree-sitter-javascript-tags.scm +15 -0
  72. package/dist/code-map/tree-sitter-queries/tree-sitter-php-tags.scm +26 -0
  73. package/dist/code-map/tree-sitter-queries/tree-sitter-python-tags.scm +9 -0
  74. package/dist/code-map/tree-sitter-queries/tree-sitter-ruby-tags.scm +58 -0
  75. package/dist/code-map/tree-sitter-queries/tree-sitter-rust-tags.scm +26 -0
  76. package/dist/code-map/tree-sitter-queries/tree-sitter-typescript-tags.scm +15 -0
  77. package/dist/code-map/tsconfig.tsbuildinfo +1 -0
  78. package/dist/common/actions.d.ts +2590 -0
  79. package/dist/common/actions.d.ts.map +1 -0
  80. package/dist/common/actions.js +143 -0
  81. package/dist/common/actions.js.map +1 -0
  82. package/dist/common/analytics.d.ts +5 -0
  83. package/dist/common/analytics.d.ts.map +1 -0
  84. package/dist/common/analytics.js +40 -0
  85. package/dist/common/analytics.js.map +1 -0
  86. package/dist/common/api-keys/constants.d.ts +9 -0
  87. package/dist/common/api-keys/constants.d.ts.map +1 -0
  88. package/dist/common/api-keys/constants.js +26 -0
  89. package/dist/common/api-keys/constants.js.map +1 -0
  90. package/dist/common/api-keys/crypto.d.ts +25 -0
  91. package/dist/common/api-keys/crypto.d.ts.map +1 -0
  92. package/dist/common/api-keys/crypto.js +186 -0
  93. package/dist/common/api-keys/crypto.js.map +1 -0
  94. package/dist/common/browser-actions.d.ts +4416 -0
  95. package/dist/common/browser-actions.d.ts.map +1 -0
  96. package/dist/common/browser-actions.js +343 -0
  97. package/dist/common/browser-actions.js.map +1 -0
  98. package/dist/common/constants/analytics-events.d.ts +20 -0
  99. package/dist/common/constants/analytics-events.d.ts.map +1 -0
  100. package/dist/common/constants/analytics-events.js +27 -0
  101. package/dist/common/constants/analytics-events.js.map +1 -0
  102. package/dist/common/constants/grant-priorities.d.ts +3 -0
  103. package/dist/common/constants/grant-priorities.d.ts.map +1 -0
  104. package/dist/common/constants/grant-priorities.js +10 -0
  105. package/dist/common/constants/grant-priorities.js.map +1 -0
  106. package/dist/common/constants/tools.d.ts +17 -0
  107. package/dist/common/constants/tools.d.ts.map +1 -0
  108. package/dist/common/constants/tools.js +44 -0
  109. package/dist/common/constants/tools.js.map +1 -0
  110. package/dist/common/constants.d.ts +135 -0
  111. package/dist/common/constants.d.ts.map +1 -0
  112. package/dist/common/constants.js +180 -0
  113. package/dist/common/constants.js.map +1 -0
  114. package/dist/common/db/drizzle.config.d.ts +3 -0
  115. package/dist/common/db/drizzle.config.d.ts.map +1 -0
  116. package/dist/common/db/drizzle.config.js +17 -0
  117. package/dist/common/db/drizzle.config.js.map +1 -0
  118. package/dist/common/db/env.d.mts +2 -0
  119. package/dist/common/db/env.d.mts.map +1 -0
  120. package/dist/common/db/env.mjs +26 -0
  121. package/dist/common/db/env.mjs.map +1 -0
  122. package/dist/common/db/index.d.ts +7 -0
  123. package/dist/common/db/index.d.ts.map +1 -0
  124. package/dist/common/db/index.js +35 -0
  125. package/dist/common/db/index.js.map +1 -0
  126. package/dist/common/db/schema.d.ts +1420 -0
  127. package/dist/common/db/schema.d.ts.map +1 -0
  128. package/dist/common/db/schema.js +175 -0
  129. package/dist/common/db/schema.js.map +1 -0
  130. package/dist/common/db/transaction.d.ts +13 -0
  131. package/dist/common/db/transaction.d.ts.map +1 -0
  132. package/dist/common/db/transaction.js +36 -0
  133. package/dist/common/db/transaction.js.map +1 -0
  134. package/dist/common/env.d.mts +2 -0
  135. package/dist/common/env.d.mts.map +1 -0
  136. package/dist/common/env.mjs +40 -0
  137. package/dist/common/env.mjs.map +1 -0
  138. package/dist/common/json-config/__tests__/stringify-schema.test.d.ts +2 -0
  139. package/dist/common/json-config/__tests__/stringify-schema.test.d.ts.map +1 -0
  140. package/dist/common/json-config/__tests__/stringify-schema.test.js +66 -0
  141. package/dist/common/json-config/__tests__/stringify-schema.test.js.map +1 -0
  142. package/dist/common/json-config/constants.d.ts +83 -0
  143. package/dist/common/json-config/constants.d.ts.map +1 -0
  144. package/dist/common/json-config/constants.js +48 -0
  145. package/dist/common/json-config/constants.js.map +1 -0
  146. package/dist/common/json-config/parser.d.ts +8 -0
  147. package/dist/common/json-config/parser.d.ts.map +1 -0
  148. package/dist/common/json-config/parser.js +51 -0
  149. package/dist/common/json-config/parser.js.map +1 -0
  150. package/dist/common/json-config/stringify-schema.d.ts +10 -0
  151. package/dist/common/json-config/stringify-schema.d.ts.map +1 -0
  152. package/dist/common/json-config/stringify-schema.js +131 -0
  153. package/dist/common/json-config/stringify-schema.js.map +1 -0
  154. package/dist/common/project-file-tree.d.ts +12 -0
  155. package/dist/common/project-file-tree.d.ts.map +1 -0
  156. package/dist/common/project-file-tree.js +200 -0
  157. package/dist/common/project-file-tree.js.map +1 -0
  158. package/dist/common/types/agent-state.d.ts +465 -0
  159. package/dist/common/types/agent-state.d.ts.map +1 -0
  160. package/dist/common/types/agent-state.js +32 -0
  161. package/dist/common/types/agent-state.js.map +1 -0
  162. package/dist/common/types/grant.d.ts +3 -0
  163. package/dist/common/types/grant.d.ts.map +1 -0
  164. package/dist/common/types/grant.js +10 -0
  165. package/dist/common/types/grant.js.map +1 -0
  166. package/dist/common/types/message.d.ts +312 -0
  167. package/dist/common/types/message.d.ts.map +1 -0
  168. package/dist/common/types/message.js +54 -0
  169. package/dist/common/types/message.js.map +1 -0
  170. package/dist/common/types/referral.d.ts +3 -0
  171. package/dist/common/types/referral.d.ts.map +1 -0
  172. package/dist/common/types/referral.js +5 -0
  173. package/dist/common/types/referral.js.map +1 -0
  174. package/dist/common/types/tools.d.ts +6 -0
  175. package/dist/common/types/tools.d.ts.map +1 -0
  176. package/dist/common/types/tools.js +3 -0
  177. package/dist/common/types/tools.js.map +1 -0
  178. package/dist/common/types/usage.d.ts +41 -0
  179. package/dist/common/types/usage.d.ts.map +1 -0
  180. package/dist/common/types/usage.js +15 -0
  181. package/dist/common/types/usage.js.map +1 -0
  182. package/dist/common/util/__tests__/messages.test.d.ts +2 -0
  183. package/dist/common/util/__tests__/messages.test.d.ts.map +1 -0
  184. package/dist/common/util/__tests__/messages.test.js +70 -0
  185. package/dist/common/util/__tests__/messages.test.js.map +1 -0
  186. package/dist/common/util/__tests__/saxy.test.d.ts +2 -0
  187. package/dist/common/util/__tests__/saxy.test.d.ts.map +1 -0
  188. package/dist/common/util/__tests__/saxy.test.js +262 -0
  189. package/dist/common/util/__tests__/saxy.test.js.map +1 -0
  190. package/dist/common/util/__tests__/string.test.d.ts +2 -0
  191. package/dist/common/util/__tests__/string.test.d.ts.map +1 -0
  192. package/dist/common/util/__tests__/string.test.js +82 -0
  193. package/dist/common/util/__tests__/string.test.js.map +1 -0
  194. package/dist/common/util/array.d.ts +7 -0
  195. package/dist/common/util/array.d.ts.map +1 -0
  196. package/dist/common/util/array.js +32 -0
  197. package/dist/common/util/array.js.map +1 -0
  198. package/dist/common/util/changes.d.ts +8 -0
  199. package/dist/common/util/changes.d.ts.map +1 -0
  200. package/dist/common/util/changes.js +78 -0
  201. package/dist/common/util/changes.js.map +1 -0
  202. package/dist/common/util/credentials.d.ts +26 -0
  203. package/dist/common/util/credentials.d.ts.map +1 -0
  204. package/dist/common/util/credentials.js +24 -0
  205. package/dist/common/util/credentials.js.map +1 -0
  206. package/dist/common/util/currency.d.ts +15 -0
  207. package/dist/common/util/currency.d.ts.map +1 -0
  208. package/dist/common/util/currency.js +23 -0
  209. package/dist/common/util/currency.js.map +1 -0
  210. package/dist/common/util/dates.d.ts +11 -0
  211. package/dist/common/util/dates.d.ts.map +1 -0
  212. package/dist/common/util/dates.js +22 -0
  213. package/dist/common/util/dates.js.map +1 -0
  214. package/dist/common/util/file.d.ts +160 -0
  215. package/dist/common/util/file.d.ts.map +1 -0
  216. package/dist/common/util/file.js +192 -0
  217. package/dist/common/util/file.js.map +1 -0
  218. package/dist/common/util/git.d.ts +7 -0
  219. package/dist/common/util/git.d.ts.map +1 -0
  220. package/dist/common/util/git.js +81 -0
  221. package/dist/common/util/git.js.map +1 -0
  222. package/dist/common/util/logger.d.ts +9 -0
  223. package/dist/common/util/logger.d.ts.map +1 -0
  224. package/dist/common/util/logger.js +52 -0
  225. package/dist/common/util/logger.js.map +1 -0
  226. package/dist/common/util/lru-cache.d.ts +31 -0
  227. package/dist/common/util/lru-cache.d.ts.map +1 -0
  228. package/dist/common/util/lru-cache.js +68 -0
  229. package/dist/common/util/lru-cache.js.map +1 -0
  230. package/dist/common/util/messages.d.ts +10 -0
  231. package/dist/common/util/messages.d.ts.map +1 -0
  232. package/dist/common/util/messages.js +69 -0
  233. package/dist/common/util/messages.js.map +1 -0
  234. package/dist/common/util/min-heap.d.ts +16 -0
  235. package/dist/common/util/min-heap.d.ts.map +1 -0
  236. package/dist/common/util/min-heap.js +73 -0
  237. package/dist/common/util/min-heap.js.map +1 -0
  238. package/dist/common/util/object.d.ts +19 -0
  239. package/dist/common/util/object.d.ts.map +1 -0
  240. package/dist/common/util/object.js +91 -0
  241. package/dist/common/util/object.js.map +1 -0
  242. package/dist/common/util/patch.d.ts +2 -0
  243. package/dist/common/util/patch.d.ts.map +1 -0
  244. package/dist/common/util/patch.js +215 -0
  245. package/dist/common/util/patch.js.map +1 -0
  246. package/dist/common/util/promise.d.ts +18 -0
  247. package/dist/common/util/promise.d.ts.map +1 -0
  248. package/dist/common/util/promise.js +80 -0
  249. package/dist/common/util/promise.js.map +1 -0
  250. package/dist/common/util/referral.d.ts +2 -0
  251. package/dist/common/util/referral.d.ts.map +1 -0
  252. package/dist/common/util/referral.js +6 -0
  253. package/dist/common/util/referral.js.map +1 -0
  254. package/dist/common/util/saxy.d.ts +167 -0
  255. package/dist/common/util/saxy.d.ts.map +1 -0
  256. package/dist/common/util/saxy.js +473 -0
  257. package/dist/common/util/saxy.js.map +1 -0
  258. package/dist/common/util/string.d.ts +62 -0
  259. package/dist/common/util/string.d.ts.map +1 -0
  260. package/dist/common/util/string.js +220 -0
  261. package/dist/common/util/string.js.map +1 -0
  262. package/dist/common/util/stripe.d.ts +4 -0
  263. package/dist/common/util/stripe.d.ts.map +1 -0
  264. package/dist/common/util/stripe.js +22 -0
  265. package/dist/common/util/stripe.js.map +1 -0
  266. package/dist/common/util/sync-failure.d.ts +2 -0
  267. package/dist/common/util/sync-failure.d.ts.map +1 -0
  268. package/dist/common/util/sync-failure.js +57 -0
  269. package/dist/common/util/sync-failure.js.map +1 -0
  270. package/dist/common/websockets/websocket-client.d.ts +43 -0
  271. package/dist/common/websockets/websocket-client.d.ts.map +1 -0
  272. package/dist/common/websockets/websocket-client.js +216 -0
  273. package/dist/common/websockets/websocket-client.js.map +1 -0
  274. package/dist/common/websockets/websocket-schema.d.ts +4867 -0
  275. package/dist/common/websockets/websocket-schema.d.ts.map +1 -0
  276. package/dist/common/websockets/websocket-schema.js +55 -0
  277. package/dist/common/websockets/websocket-schema.js.map +1 -0
  278. package/dist/config.d.ts +1 -0
  279. package/dist/config.d.ts.map +1 -0
  280. package/dist/constants/analytics-events.d.ts +20 -0
  281. package/dist/constants/analytics-events.d.ts.map +1 -0
  282. package/dist/constants/analytics-events.js +27 -0
  283. package/dist/constants/analytics-events.js.map +1 -0
  284. package/dist/constants/grant-priorities.d.ts +3 -0
  285. package/dist/constants/grant-priorities.d.ts.map +1 -0
  286. package/dist/constants/grant-priorities.js +10 -0
  287. package/dist/constants/grant-priorities.js.map +1 -0
  288. package/dist/constants/tools.d.ts +17 -0
  289. package/dist/constants/tools.d.ts.map +1 -0
  290. package/dist/constants/tools.js +44 -0
  291. package/dist/constants/tools.js.map +1 -0
  292. package/dist/constants.d.ts +135 -0
  293. package/dist/constants.d.ts.map +1 -0
  294. package/dist/constants.js +180 -0
  295. package/dist/constants.js.map +1 -0
  296. package/dist/create-template-project.d.ts +1 -0
  297. package/dist/create-template-project.d.ts.map +1 -0
  298. package/dist/credentials.d.ts +2 -1
  299. package/dist/credentials.d.ts.map +1 -0
  300. package/dist/credentials.js +2 -2
  301. package/dist/db/drizzle.config.d.ts +3 -0
  302. package/dist/db/drizzle.config.d.ts.map +1 -0
  303. package/dist/db/drizzle.config.js +17 -0
  304. package/dist/db/drizzle.config.js.map +1 -0
  305. package/dist/db/env.d.mts +2 -0
  306. package/dist/db/env.d.mts.map +1 -0
  307. package/dist/db/env.mjs +26 -0
  308. package/dist/db/env.mjs.map +1 -0
  309. package/dist/db/index.d.ts +7 -0
  310. package/dist/db/index.d.ts.map +1 -0
  311. package/dist/db/index.js +35 -0
  312. package/dist/db/index.js.map +1 -0
  313. package/dist/db/schema.d.ts +1420 -0
  314. package/dist/db/schema.d.ts.map +1 -0
  315. package/dist/db/schema.js +175 -0
  316. package/dist/db/schema.js.map +1 -0
  317. package/dist/db/transaction.d.ts +13 -0
  318. package/dist/db/transaction.d.ts.map +1 -0
  319. package/dist/db/transaction.js +36 -0
  320. package/dist/db/transaction.js.map +1 -0
  321. package/dist/dev-process-manager.d.ts +2 -1
  322. package/dist/dev-process-manager.d.ts.map +1 -0
  323. package/dist/dev-process-manager.js +1 -1
  324. package/dist/display.d.ts +1 -0
  325. package/dist/display.d.ts.map +1 -0
  326. package/dist/env.d.mts +2 -0
  327. package/dist/env.d.mts.map +1 -0
  328. package/dist/env.mjs +40 -0
  329. package/dist/env.mjs.map +1 -0
  330. package/dist/fingerprint.d.ts +1 -0
  331. package/dist/fingerprint.d.ts.map +1 -0
  332. package/dist/index.d.ts +1 -0
  333. package/dist/index.d.ts.map +1 -0
  334. package/dist/index.js +1 -1
  335. package/dist/json-config/__tests__/stringify-schema.test.d.ts +2 -0
  336. package/dist/json-config/__tests__/stringify-schema.test.d.ts.map +1 -0
  337. package/dist/json-config/__tests__/stringify-schema.test.js +66 -0
  338. package/dist/json-config/__tests__/stringify-schema.test.js.map +1 -0
  339. package/dist/json-config/constants.d.ts +83 -0
  340. package/dist/json-config/constants.d.ts.map +1 -0
  341. package/dist/json-config/constants.js +48 -0
  342. package/dist/json-config/constants.js.map +1 -0
  343. package/dist/json-config/parser.d.ts +8 -0
  344. package/dist/json-config/parser.d.ts.map +1 -0
  345. package/dist/json-config/parser.js +51 -0
  346. package/dist/json-config/parser.js.map +1 -0
  347. package/dist/json-config/stringify-schema.d.ts +10 -0
  348. package/dist/json-config/stringify-schema.d.ts.map +1 -0
  349. package/dist/json-config/stringify-schema.js +131 -0
  350. package/dist/json-config/stringify-schema.js.map +1 -0
  351. package/dist/menu.d.ts +2 -1
  352. package/dist/menu.d.ts.map +1 -0
  353. package/dist/menu.js +1 -1
  354. package/dist/project-file-tree.d.ts +12 -0
  355. package/dist/project-file-tree.d.ts.map +1 -0
  356. package/dist/project-file-tree.js +200 -0
  357. package/dist/project-file-tree.js.map +1 -0
  358. package/dist/project-files.d.ts +3 -2
  359. package/dist/project-files.d.ts.map +1 -0
  360. package/dist/project-files.js +6 -6
  361. package/dist/startup-process-handler.d.ts +2 -1
  362. package/dist/startup-process-handler.d.ts.map +1 -0
  363. package/dist/tool-handlers.d.ts +3 -2
  364. package/dist/tool-handlers.d.ts.map +1 -0
  365. package/dist/tool-handlers.js +4 -4
  366. package/dist/types/agent-state.d.ts +465 -0
  367. package/dist/types/agent-state.d.ts.map +1 -0
  368. package/dist/types/agent-state.js +32 -0
  369. package/dist/types/agent-state.js.map +1 -0
  370. package/dist/types/grant.d.ts +3 -0
  371. package/dist/types/grant.d.ts.map +1 -0
  372. package/dist/types/grant.js +10 -0
  373. package/dist/types/grant.js.map +1 -0
  374. package/dist/types/message.d.ts +312 -0
  375. package/dist/types/message.d.ts.map +1 -0
  376. package/dist/types/message.js +54 -0
  377. package/dist/types/message.js.map +1 -0
  378. package/dist/types/referral.d.ts +3 -0
  379. package/dist/types/referral.d.ts.map +1 -0
  380. package/dist/types/referral.js +5 -0
  381. package/dist/types/referral.js.map +1 -0
  382. package/dist/types/tools.d.ts +6 -0
  383. package/dist/types/tools.d.ts.map +1 -0
  384. package/dist/types/tools.js +3 -0
  385. package/dist/types/tools.js.map +1 -0
  386. package/dist/types/usage.d.ts +41 -0
  387. package/dist/types/usage.d.ts.map +1 -0
  388. package/dist/types/usage.js +15 -0
  389. package/dist/types/usage.js.map +1 -0
  390. package/dist/types.d.ts +2 -1
  391. package/dist/types.d.ts.map +1 -0
  392. package/dist/update-codebuff.d.ts +1 -0
  393. package/dist/update-codebuff.d.ts.map +1 -0
  394. package/dist/util/__tests__/messages.test.d.ts +2 -0
  395. package/dist/util/__tests__/messages.test.d.ts.map +1 -0
  396. package/dist/util/__tests__/messages.test.js +70 -0
  397. package/dist/util/__tests__/messages.test.js.map +1 -0
  398. package/dist/util/__tests__/saxy.test.d.ts +2 -0
  399. package/dist/util/__tests__/saxy.test.d.ts.map +1 -0
  400. package/dist/util/__tests__/saxy.test.js +262 -0
  401. package/dist/util/__tests__/saxy.test.js.map +1 -0
  402. package/dist/util/__tests__/string.test.d.ts +2 -0
  403. package/dist/util/__tests__/string.test.d.ts.map +1 -0
  404. package/dist/util/__tests__/string.test.js +82 -0
  405. package/dist/util/__tests__/string.test.js.map +1 -0
  406. package/dist/util/array.d.ts +7 -0
  407. package/dist/util/array.d.ts.map +1 -0
  408. package/dist/util/array.js +32 -0
  409. package/dist/util/array.js.map +1 -0
  410. package/dist/util/changes.d.ts +8 -0
  411. package/dist/util/changes.d.ts.map +1 -0
  412. package/dist/util/changes.js +78 -0
  413. package/dist/util/changes.js.map +1 -0
  414. package/dist/util/credentials.d.ts +26 -0
  415. package/dist/util/credentials.d.ts.map +1 -0
  416. package/dist/util/credentials.js +24 -0
  417. package/dist/util/credentials.js.map +1 -0
  418. package/dist/util/currency.d.ts +15 -0
  419. package/dist/util/currency.d.ts.map +1 -0
  420. package/dist/util/currency.js +23 -0
  421. package/dist/util/currency.js.map +1 -0
  422. package/dist/util/dates.d.ts +11 -0
  423. package/dist/util/dates.d.ts.map +1 -0
  424. package/dist/util/dates.js +22 -0
  425. package/dist/util/dates.js.map +1 -0
  426. package/dist/util/file.d.ts +160 -0
  427. package/dist/util/file.d.ts.map +1 -0
  428. package/dist/util/file.js +192 -0
  429. package/dist/util/file.js.map +1 -0
  430. package/dist/util/git.d.ts +7 -0
  431. package/dist/util/git.d.ts.map +1 -0
  432. package/dist/util/git.js +81 -0
  433. package/dist/util/git.js.map +1 -0
  434. package/dist/util/logger.d.ts +9 -0
  435. package/dist/util/logger.d.ts.map +1 -0
  436. package/dist/util/logger.js +52 -0
  437. package/dist/util/logger.js.map +1 -0
  438. package/dist/util/lru-cache.d.ts +31 -0
  439. package/dist/util/lru-cache.d.ts.map +1 -0
  440. package/dist/util/lru-cache.js +68 -0
  441. package/dist/util/lru-cache.js.map +1 -0
  442. package/dist/util/messages.d.ts +10 -0
  443. package/dist/util/messages.d.ts.map +1 -0
  444. package/dist/util/messages.js +69 -0
  445. package/dist/util/messages.js.map +1 -0
  446. package/dist/util/min-heap.d.ts +16 -0
  447. package/dist/util/min-heap.d.ts.map +1 -0
  448. package/dist/util/min-heap.js +73 -0
  449. package/dist/util/min-heap.js.map +1 -0
  450. package/dist/util/object.d.ts +19 -0
  451. package/dist/util/object.d.ts.map +1 -0
  452. package/dist/util/object.js +91 -0
  453. package/dist/util/object.js.map +1 -0
  454. package/dist/util/patch.d.ts +2 -0
  455. package/dist/util/patch.d.ts.map +1 -0
  456. package/dist/util/patch.js +215 -0
  457. package/dist/util/patch.js.map +1 -0
  458. package/dist/util/promise.d.ts +18 -0
  459. package/dist/util/promise.d.ts.map +1 -0
  460. package/dist/util/promise.js +80 -0
  461. package/dist/util/promise.js.map +1 -0
  462. package/dist/util/referral.d.ts +2 -0
  463. package/dist/util/referral.d.ts.map +1 -0
  464. package/dist/util/referral.js +6 -0
  465. package/dist/util/referral.js.map +1 -0
  466. package/dist/util/saxy.d.ts +167 -0
  467. package/dist/util/saxy.d.ts.map +1 -0
  468. package/dist/util/saxy.js +473 -0
  469. package/dist/util/saxy.js.map +1 -0
  470. package/dist/util/string.d.ts +62 -0
  471. package/dist/util/string.d.ts.map +1 -0
  472. package/dist/util/string.js +220 -0
  473. package/dist/util/string.js.map +1 -0
  474. package/dist/util/stripe.d.ts +4 -0
  475. package/dist/util/stripe.d.ts.map +1 -0
  476. package/dist/util/stripe.js +22 -0
  477. package/dist/util/stripe.js.map +1 -0
  478. package/dist/util/sync-failure.d.ts +2 -0
  479. package/dist/util/sync-failure.d.ts.map +1 -0
  480. package/dist/util/sync-failure.js +57 -0
  481. package/dist/util/sync-failure.js.map +1 -0
  482. package/dist/utils/__tests__/background-process-manager.test.d.ts +1 -0
  483. package/dist/utils/__tests__/background-process-manager.test.d.ts.map +1 -0
  484. package/dist/utils/__tests__/response-example-4-files.txt +621 -0
  485. package/dist/utils/__tests__/tool-renderers.test.d.ts +1 -0
  486. package/dist/utils/__tests__/tool-renderers.test.d.ts.map +1 -0
  487. package/dist/utils/__tests__/tool-renderers.test.js +1 -1
  488. package/dist/utils/__tests__/xml-stream-parser.test.d.ts +1 -0
  489. package/dist/utils/__tests__/xml-stream-parser.test.d.ts.map +1 -0
  490. package/dist/utils/__tests__/xml-stream-parser.test.js +1 -1
  491. package/dist/utils/analytics.d.ts +2 -1
  492. package/dist/utils/analytics.d.ts.map +1 -0
  493. package/dist/utils/detect-shell.d.ts +1 -0
  494. package/dist/utils/detect-shell.d.ts.map +1 -0
  495. package/dist/utils/git.d.ts +1 -0
  496. package/dist/utils/git.d.ts.map +1 -0
  497. package/dist/utils/logger.d.ts +1 -0
  498. package/dist/utils/logger.d.ts.map +1 -0
  499. package/dist/utils/logger.js +2 -2
  500. package/dist/utils/spinner.d.ts +1 -0
  501. package/dist/utils/spinner.d.ts.map +1 -0
  502. package/dist/utils/system-info.d.ts +1 -0
  503. package/dist/utils/system-info.d.ts.map +1 -0
  504. package/dist/utils/terminal.d.ts +1 -0
  505. package/dist/utils/terminal.d.ts.map +1 -0
  506. package/dist/utils/terminal.js +3 -3
  507. package/dist/utils/tool-renderers.d.ts +2 -1
  508. package/dist/utils/tool-renderers.d.ts.map +1 -0
  509. package/dist/utils/tool-renderers.js +1 -1
  510. package/dist/utils/xml-stream-parser.d.ts +2 -1
  511. package/dist/utils/xml-stream-parser.d.ts.map +1 -0
  512. package/dist/utils/xml-stream-parser.js +2 -2
  513. package/dist/web-scraper.d.ts +1 -0
  514. package/dist/web-scraper.d.ts.map +1 -0
  515. package/dist/web-scraper.js +1 -1
  516. package/dist/websockets/websocket-client.d.ts +43 -0
  517. package/dist/websockets/websocket-client.d.ts.map +1 -0
  518. package/dist/websockets/websocket-client.js +216 -0
  519. package/dist/websockets/websocket-client.js.map +1 -0
  520. package/dist/websockets/websocket-schema.d.ts +4867 -0
  521. package/dist/websockets/websocket-schema.d.ts.map +1 -0
  522. package/dist/websockets/websocket-schema.js +55 -0
  523. package/dist/websockets/websocket-schema.js.map +1 -0
  524. package/dist/workers/checkpoint-worker.d.ts +1 -0
  525. package/dist/workers/checkpoint-worker.d.ts.map +1 -0
  526. package/dist/workers/project-context.d.ts +1 -0
  527. package/dist/workers/project-context.d.ts.map +1 -0
  528. package/dist/workers/project-context.js +1 -1
  529. package/package.json +7 -2
@@ -0,0 +1,4867 @@
1
+ import { z } from 'zod';
2
+ export declare const CLIENT_MESSAGE_SCHEMAS: {
3
+ readonly identify: z.ZodObject<{
4
+ type: z.ZodLiteral<"identify">;
5
+ txid: z.ZodNumber;
6
+ clientSessionId: z.ZodString;
7
+ }, "strip", z.ZodTypeAny, {
8
+ type: "identify";
9
+ clientSessionId: string;
10
+ txid: number;
11
+ }, {
12
+ type: "identify";
13
+ clientSessionId: string;
14
+ txid: number;
15
+ }>;
16
+ readonly subscribe: z.ZodObject<{
17
+ type: z.ZodLiteral<"subscribe">;
18
+ txid: z.ZodNumber;
19
+ topics: z.ZodArray<z.ZodString, "many">;
20
+ }, "strip", z.ZodTypeAny, {
21
+ type: "subscribe";
22
+ txid: number;
23
+ topics: string[];
24
+ }, {
25
+ type: "subscribe";
26
+ txid: number;
27
+ topics: string[];
28
+ }>;
29
+ readonly unsubscribe: z.ZodObject<{
30
+ type: z.ZodLiteral<"unsubscribe">;
31
+ txid: z.ZodNumber;
32
+ topics: z.ZodArray<z.ZodString, "many">;
33
+ }, "strip", z.ZodTypeAny, {
34
+ type: "unsubscribe";
35
+ txid: number;
36
+ topics: string[];
37
+ }, {
38
+ type: "unsubscribe";
39
+ txid: number;
40
+ topics: string[];
41
+ }>;
42
+ readonly ping: z.ZodObject<{
43
+ type: z.ZodLiteral<"ping">;
44
+ txid: z.ZodNumber;
45
+ }, "strip", z.ZodTypeAny, {
46
+ type: "ping";
47
+ txid: number;
48
+ }, {
49
+ type: "ping";
50
+ txid: number;
51
+ }>;
52
+ readonly action: z.ZodObject<{
53
+ type: z.ZodLiteral<"action">;
54
+ txid: z.ZodNumber;
55
+ data: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
56
+ type: z.ZodLiteral<"prompt">;
57
+ promptId: z.ZodString;
58
+ prompt: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
59
+ fingerprintId: z.ZodString;
60
+ authToken: z.ZodOptional<z.ZodString>;
61
+ costMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<["lite", "normal", "max", "experimental"]>>>;
62
+ agentState: z.ZodObject<{
63
+ agentContext: z.ZodString;
64
+ fileContext: z.ZodObject<{
65
+ currentWorkingDirectory: z.ZodString;
66
+ fileTree: z.ZodArray<z.ZodType<import("../util/file").FileTreeNode, z.ZodTypeDef, import("../util/file").FileTreeNode>, "many">;
67
+ fileTokenScores: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
68
+ knowledgeFiles: z.ZodRecord<z.ZodString, z.ZodString>;
69
+ userKnowledgeFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
70
+ gitChanges: z.ZodObject<{
71
+ status: z.ZodString;
72
+ diff: z.ZodString;
73
+ diffCached: z.ZodString;
74
+ lastCommitMessages: z.ZodString;
75
+ }, "strip", z.ZodTypeAny, {
76
+ status: string;
77
+ diff: string;
78
+ diffCached: string;
79
+ lastCommitMessages: string;
80
+ }, {
81
+ status: string;
82
+ diff: string;
83
+ diffCached: string;
84
+ lastCommitMessages: string;
85
+ }>;
86
+ changesSinceLastChat: z.ZodRecord<z.ZodString, z.ZodString>;
87
+ shellConfigFiles: z.ZodRecord<z.ZodString, z.ZodString>;
88
+ systemInfo: z.ZodObject<{
89
+ platform: z.ZodString;
90
+ shell: z.ZodString;
91
+ nodeVersion: z.ZodString;
92
+ arch: z.ZodString;
93
+ homedir: z.ZodString;
94
+ cpus: z.ZodNumber;
95
+ }, "strip", z.ZodTypeAny, {
96
+ platform: string;
97
+ shell: string;
98
+ nodeVersion: string;
99
+ arch: string;
100
+ homedir: string;
101
+ cpus: number;
102
+ }, {
103
+ platform: string;
104
+ shell: string;
105
+ nodeVersion: string;
106
+ arch: string;
107
+ homedir: string;
108
+ cpus: number;
109
+ }>;
110
+ fileVersions: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodObject<{
111
+ path: z.ZodString;
112
+ content: z.ZodString;
113
+ }, "strip", z.ZodTypeAny, {
114
+ path: string;
115
+ content: string;
116
+ }, {
117
+ path: string;
118
+ content: string;
119
+ }>, "many">, "many">>;
120
+ }, "strip", z.ZodTypeAny, {
121
+ currentWorkingDirectory: string;
122
+ fileTree: import("../util/file").FileTreeNode[];
123
+ fileTokenScores: Record<string, Record<string, number>>;
124
+ knowledgeFiles: Record<string, string>;
125
+ gitChanges: {
126
+ status: string;
127
+ diff: string;
128
+ diffCached: string;
129
+ lastCommitMessages: string;
130
+ };
131
+ changesSinceLastChat: Record<string, string>;
132
+ shellConfigFiles: Record<string, string>;
133
+ systemInfo: {
134
+ platform: string;
135
+ shell: string;
136
+ nodeVersion: string;
137
+ arch: string;
138
+ homedir: string;
139
+ cpus: number;
140
+ };
141
+ userKnowledgeFiles?: Record<string, string> | undefined;
142
+ fileVersions?: {
143
+ path: string;
144
+ content: string;
145
+ }[][] | undefined;
146
+ }, {
147
+ currentWorkingDirectory: string;
148
+ fileTree: import("../util/file").FileTreeNode[];
149
+ fileTokenScores: Record<string, Record<string, number>>;
150
+ knowledgeFiles: Record<string, string>;
151
+ gitChanges: {
152
+ status: string;
153
+ diff: string;
154
+ diffCached: string;
155
+ lastCommitMessages: string;
156
+ };
157
+ changesSinceLastChat: Record<string, string>;
158
+ shellConfigFiles: Record<string, string>;
159
+ systemInfo: {
160
+ platform: string;
161
+ shell: string;
162
+ nodeVersion: string;
163
+ arch: string;
164
+ homedir: string;
165
+ cpus: number;
166
+ };
167
+ userKnowledgeFiles?: Record<string, string> | undefined;
168
+ fileVersions?: {
169
+ path: string;
170
+ content: string;
171
+ }[][] | undefined;
172
+ }>;
173
+ messageHistory: z.ZodArray<z.ZodObject<{
174
+ role: z.ZodUnion<[z.ZodLiteral<"user">, z.ZodLiteral<"assistant">]>;
175
+ content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{
176
+ type: z.ZodLiteral<"text">;
177
+ text: z.ZodString;
178
+ cache_control: z.ZodOptional<z.ZodObject<{
179
+ type: z.ZodLiteral<"ephemeral">;
180
+ }, "strip", z.ZodTypeAny, {
181
+ type: "ephemeral";
182
+ }, {
183
+ type: "ephemeral";
184
+ }>>;
185
+ }, "strip", z.ZodTypeAny, {
186
+ type: "text";
187
+ text: string;
188
+ cache_control?: {
189
+ type: "ephemeral";
190
+ } | undefined;
191
+ }, {
192
+ type: "text";
193
+ text: string;
194
+ cache_control?: {
195
+ type: "ephemeral";
196
+ } | undefined;
197
+ }>, z.ZodObject<{
198
+ type: z.ZodLiteral<"tool_use">;
199
+ id: z.ZodString;
200
+ name: z.ZodString;
201
+ input: z.ZodRecord<z.ZodString, z.ZodAny>;
202
+ cache_control: z.ZodOptional<z.ZodObject<{
203
+ type: z.ZodLiteral<"ephemeral">;
204
+ }, "strip", z.ZodTypeAny, {
205
+ type: "ephemeral";
206
+ }, {
207
+ type: "ephemeral";
208
+ }>>;
209
+ }, "strip", z.ZodTypeAny, {
210
+ type: "tool_use";
211
+ name: string;
212
+ id: string;
213
+ input: Record<string, any>;
214
+ cache_control?: {
215
+ type: "ephemeral";
216
+ } | undefined;
217
+ }, {
218
+ type: "tool_use";
219
+ name: string;
220
+ id: string;
221
+ input: Record<string, any>;
222
+ cache_control?: {
223
+ type: "ephemeral";
224
+ } | undefined;
225
+ }>, z.ZodObject<{
226
+ type: z.ZodLiteral<"tool_result">;
227
+ tool_use_id: z.ZodString;
228
+ content: z.ZodString;
229
+ cache_control: z.ZodOptional<z.ZodObject<{
230
+ type: z.ZodLiteral<"ephemeral">;
231
+ }, "strip", z.ZodTypeAny, {
232
+ type: "ephemeral";
233
+ }, {
234
+ type: "ephemeral";
235
+ }>>;
236
+ }, "strip", z.ZodTypeAny, {
237
+ type: "tool_result";
238
+ content: string;
239
+ tool_use_id: string;
240
+ cache_control?: {
241
+ type: "ephemeral";
242
+ } | undefined;
243
+ }, {
244
+ type: "tool_result";
245
+ content: string;
246
+ tool_use_id: string;
247
+ cache_control?: {
248
+ type: "ephemeral";
249
+ } | undefined;
250
+ }>, z.ZodObject<{
251
+ type: z.ZodLiteral<"image">;
252
+ source: z.ZodObject<{
253
+ type: z.ZodLiteral<"base64">;
254
+ media_type: z.ZodLiteral<"image/jpeg">;
255
+ data: z.ZodString;
256
+ }, "strip", z.ZodTypeAny, {
257
+ type: "base64";
258
+ media_type: "image/jpeg";
259
+ data: string;
260
+ }, {
261
+ type: "base64";
262
+ media_type: "image/jpeg";
263
+ data: string;
264
+ }>;
265
+ cache_control: z.ZodOptional<z.ZodObject<{
266
+ type: z.ZodLiteral<"ephemeral">;
267
+ }, "strip", z.ZodTypeAny, {
268
+ type: "ephemeral";
269
+ }, {
270
+ type: "ephemeral";
271
+ }>>;
272
+ }, "strip", z.ZodTypeAny, {
273
+ type: "image";
274
+ source: {
275
+ type: "base64";
276
+ media_type: "image/jpeg";
277
+ data: string;
278
+ };
279
+ cache_control?: {
280
+ type: "ephemeral";
281
+ } | undefined;
282
+ }, {
283
+ type: "image";
284
+ source: {
285
+ type: "base64";
286
+ media_type: "image/jpeg";
287
+ data: string;
288
+ };
289
+ cache_control?: {
290
+ type: "ephemeral";
291
+ } | undefined;
292
+ }>]>, "many">]>;
293
+ }, "strip", z.ZodTypeAny, {
294
+ content: string | ({
295
+ type: "text";
296
+ text: string;
297
+ cache_control?: {
298
+ type: "ephemeral";
299
+ } | undefined;
300
+ } | {
301
+ type: "tool_use";
302
+ name: string;
303
+ id: string;
304
+ input: Record<string, any>;
305
+ cache_control?: {
306
+ type: "ephemeral";
307
+ } | undefined;
308
+ } | {
309
+ type: "tool_result";
310
+ content: string;
311
+ tool_use_id: string;
312
+ cache_control?: {
313
+ type: "ephemeral";
314
+ } | undefined;
315
+ } | {
316
+ type: "image";
317
+ source: {
318
+ type: "base64";
319
+ media_type: "image/jpeg";
320
+ data: string;
321
+ };
322
+ cache_control?: {
323
+ type: "ephemeral";
324
+ } | undefined;
325
+ })[];
326
+ role: "user" | "assistant";
327
+ }, {
328
+ content: string | ({
329
+ type: "text";
330
+ text: string;
331
+ cache_control?: {
332
+ type: "ephemeral";
333
+ } | undefined;
334
+ } | {
335
+ type: "tool_use";
336
+ name: string;
337
+ id: string;
338
+ input: Record<string, any>;
339
+ cache_control?: {
340
+ type: "ephemeral";
341
+ } | undefined;
342
+ } | {
343
+ type: "tool_result";
344
+ content: string;
345
+ tool_use_id: string;
346
+ cache_control?: {
347
+ type: "ephemeral";
348
+ } | undefined;
349
+ } | {
350
+ type: "image";
351
+ source: {
352
+ type: "base64";
353
+ media_type: "image/jpeg";
354
+ data: string;
355
+ };
356
+ cache_control?: {
357
+ type: "ephemeral";
358
+ } | undefined;
359
+ })[];
360
+ role: "user" | "assistant";
361
+ }>, "many">;
362
+ consecutiveAssistantMessages: z.ZodOptional<z.ZodNumber>;
363
+ }, "strip", z.ZodTypeAny, {
364
+ agentContext: string;
365
+ fileContext: {
366
+ currentWorkingDirectory: string;
367
+ fileTree: import("../util/file").FileTreeNode[];
368
+ fileTokenScores: Record<string, Record<string, number>>;
369
+ knowledgeFiles: Record<string, string>;
370
+ gitChanges: {
371
+ status: string;
372
+ diff: string;
373
+ diffCached: string;
374
+ lastCommitMessages: string;
375
+ };
376
+ changesSinceLastChat: Record<string, string>;
377
+ shellConfigFiles: Record<string, string>;
378
+ systemInfo: {
379
+ platform: string;
380
+ shell: string;
381
+ nodeVersion: string;
382
+ arch: string;
383
+ homedir: string;
384
+ cpus: number;
385
+ };
386
+ userKnowledgeFiles?: Record<string, string> | undefined;
387
+ fileVersions?: {
388
+ path: string;
389
+ content: string;
390
+ }[][] | undefined;
391
+ };
392
+ messageHistory: {
393
+ content: string | ({
394
+ type: "text";
395
+ text: string;
396
+ cache_control?: {
397
+ type: "ephemeral";
398
+ } | undefined;
399
+ } | {
400
+ type: "tool_use";
401
+ name: string;
402
+ id: string;
403
+ input: Record<string, any>;
404
+ cache_control?: {
405
+ type: "ephemeral";
406
+ } | undefined;
407
+ } | {
408
+ type: "tool_result";
409
+ content: string;
410
+ tool_use_id: string;
411
+ cache_control?: {
412
+ type: "ephemeral";
413
+ } | undefined;
414
+ } | {
415
+ type: "image";
416
+ source: {
417
+ type: "base64";
418
+ media_type: "image/jpeg";
419
+ data: string;
420
+ };
421
+ cache_control?: {
422
+ type: "ephemeral";
423
+ } | undefined;
424
+ })[];
425
+ role: "user" | "assistant";
426
+ }[];
427
+ consecutiveAssistantMessages?: number | undefined;
428
+ }, {
429
+ agentContext: string;
430
+ fileContext: {
431
+ currentWorkingDirectory: string;
432
+ fileTree: import("../util/file").FileTreeNode[];
433
+ fileTokenScores: Record<string, Record<string, number>>;
434
+ knowledgeFiles: Record<string, string>;
435
+ gitChanges: {
436
+ status: string;
437
+ diff: string;
438
+ diffCached: string;
439
+ lastCommitMessages: string;
440
+ };
441
+ changesSinceLastChat: Record<string, string>;
442
+ shellConfigFiles: Record<string, string>;
443
+ systemInfo: {
444
+ platform: string;
445
+ shell: string;
446
+ nodeVersion: string;
447
+ arch: string;
448
+ homedir: string;
449
+ cpus: number;
450
+ };
451
+ userKnowledgeFiles?: Record<string, string> | undefined;
452
+ fileVersions?: {
453
+ path: string;
454
+ content: string;
455
+ }[][] | undefined;
456
+ };
457
+ messageHistory: {
458
+ content: string | ({
459
+ type: "text";
460
+ text: string;
461
+ cache_control?: {
462
+ type: "ephemeral";
463
+ } | undefined;
464
+ } | {
465
+ type: "tool_use";
466
+ name: string;
467
+ id: string;
468
+ input: Record<string, any>;
469
+ cache_control?: {
470
+ type: "ephemeral";
471
+ } | undefined;
472
+ } | {
473
+ type: "tool_result";
474
+ content: string;
475
+ tool_use_id: string;
476
+ cache_control?: {
477
+ type: "ephemeral";
478
+ } | undefined;
479
+ } | {
480
+ type: "image";
481
+ source: {
482
+ type: "base64";
483
+ media_type: "image/jpeg";
484
+ data: string;
485
+ };
486
+ cache_control?: {
487
+ type: "ephemeral";
488
+ } | undefined;
489
+ })[];
490
+ role: "user" | "assistant";
491
+ }[];
492
+ consecutiveAssistantMessages?: number | undefined;
493
+ }>;
494
+ toolResults: z.ZodArray<z.ZodObject<{
495
+ name: z.ZodString;
496
+ result: z.ZodString;
497
+ id: z.ZodString;
498
+ }, "strip", z.ZodTypeAny, {
499
+ name: string;
500
+ id: string;
501
+ result: string;
502
+ }, {
503
+ name: string;
504
+ id: string;
505
+ result: string;
506
+ }>, "many">;
507
+ model: z.ZodOptional<z.ZodString>;
508
+ }, "strip", z.ZodTypeAny, {
509
+ type: "prompt";
510
+ promptId: string;
511
+ fingerprintId: string;
512
+ costMode: "lite" | "normal" | "max" | "experimental";
513
+ agentState: {
514
+ agentContext: string;
515
+ fileContext: {
516
+ currentWorkingDirectory: string;
517
+ fileTree: import("../util/file").FileTreeNode[];
518
+ fileTokenScores: Record<string, Record<string, number>>;
519
+ knowledgeFiles: Record<string, string>;
520
+ gitChanges: {
521
+ status: string;
522
+ diff: string;
523
+ diffCached: string;
524
+ lastCommitMessages: string;
525
+ };
526
+ changesSinceLastChat: Record<string, string>;
527
+ shellConfigFiles: Record<string, string>;
528
+ systemInfo: {
529
+ platform: string;
530
+ shell: string;
531
+ nodeVersion: string;
532
+ arch: string;
533
+ homedir: string;
534
+ cpus: number;
535
+ };
536
+ userKnowledgeFiles?: Record<string, string> | undefined;
537
+ fileVersions?: {
538
+ path: string;
539
+ content: string;
540
+ }[][] | undefined;
541
+ };
542
+ messageHistory: {
543
+ content: string | ({
544
+ type: "text";
545
+ text: string;
546
+ cache_control?: {
547
+ type: "ephemeral";
548
+ } | undefined;
549
+ } | {
550
+ type: "tool_use";
551
+ name: string;
552
+ id: string;
553
+ input: Record<string, any>;
554
+ cache_control?: {
555
+ type: "ephemeral";
556
+ } | undefined;
557
+ } | {
558
+ type: "tool_result";
559
+ content: string;
560
+ tool_use_id: string;
561
+ cache_control?: {
562
+ type: "ephemeral";
563
+ } | undefined;
564
+ } | {
565
+ type: "image";
566
+ source: {
567
+ type: "base64";
568
+ media_type: "image/jpeg";
569
+ data: string;
570
+ };
571
+ cache_control?: {
572
+ type: "ephemeral";
573
+ } | undefined;
574
+ })[];
575
+ role: "user" | "assistant";
576
+ }[];
577
+ consecutiveAssistantMessages?: number | undefined;
578
+ };
579
+ toolResults: {
580
+ name: string;
581
+ id: string;
582
+ result: string;
583
+ }[];
584
+ prompt?: string | undefined;
585
+ authToken?: string | undefined;
586
+ model?: string | undefined;
587
+ }, {
588
+ type: "prompt";
589
+ promptId: string;
590
+ fingerprintId: string;
591
+ agentState: {
592
+ agentContext: string;
593
+ fileContext: {
594
+ currentWorkingDirectory: string;
595
+ fileTree: import("../util/file").FileTreeNode[];
596
+ fileTokenScores: Record<string, Record<string, number>>;
597
+ knowledgeFiles: Record<string, string>;
598
+ gitChanges: {
599
+ status: string;
600
+ diff: string;
601
+ diffCached: string;
602
+ lastCommitMessages: string;
603
+ };
604
+ changesSinceLastChat: Record<string, string>;
605
+ shellConfigFiles: Record<string, string>;
606
+ systemInfo: {
607
+ platform: string;
608
+ shell: string;
609
+ nodeVersion: string;
610
+ arch: string;
611
+ homedir: string;
612
+ cpus: number;
613
+ };
614
+ userKnowledgeFiles?: Record<string, string> | undefined;
615
+ fileVersions?: {
616
+ path: string;
617
+ content: string;
618
+ }[][] | undefined;
619
+ };
620
+ messageHistory: {
621
+ content: string | ({
622
+ type: "text";
623
+ text: string;
624
+ cache_control?: {
625
+ type: "ephemeral";
626
+ } | undefined;
627
+ } | {
628
+ type: "tool_use";
629
+ name: string;
630
+ id: string;
631
+ input: Record<string, any>;
632
+ cache_control?: {
633
+ type: "ephemeral";
634
+ } | undefined;
635
+ } | {
636
+ type: "tool_result";
637
+ content: string;
638
+ tool_use_id: string;
639
+ cache_control?: {
640
+ type: "ephemeral";
641
+ } | undefined;
642
+ } | {
643
+ type: "image";
644
+ source: {
645
+ type: "base64";
646
+ media_type: "image/jpeg";
647
+ data: string;
648
+ };
649
+ cache_control?: {
650
+ type: "ephemeral";
651
+ } | undefined;
652
+ })[];
653
+ role: "user" | "assistant";
654
+ }[];
655
+ consecutiveAssistantMessages?: number | undefined;
656
+ };
657
+ toolResults: {
658
+ name: string;
659
+ id: string;
660
+ result: string;
661
+ }[];
662
+ prompt?: string | undefined;
663
+ authToken?: string | undefined;
664
+ costMode?: "lite" | "normal" | "max" | "experimental" | undefined;
665
+ model?: string | undefined;
666
+ }>, z.ZodObject<{
667
+ type: z.ZodLiteral<"read-files-response">;
668
+ files: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNull]>>;
669
+ requestId: z.ZodOptional<z.ZodString>;
670
+ }, "strip", z.ZodTypeAny, {
671
+ type: "read-files-response";
672
+ files: Record<string, string | null>;
673
+ requestId?: string | undefined;
674
+ }, {
675
+ type: "read-files-response";
676
+ files: Record<string, string | null>;
677
+ requestId?: string | undefined;
678
+ }>, z.ZodObject<{
679
+ type: z.ZodLiteral<"init">;
680
+ fingerprintId: z.ZodString;
681
+ authToken: z.ZodOptional<z.ZodString>;
682
+ fileContext: z.ZodObject<{
683
+ currentWorkingDirectory: z.ZodString;
684
+ fileTree: z.ZodArray<z.ZodType<import("../util/file").FileTreeNode, z.ZodTypeDef, import("../util/file").FileTreeNode>, "many">;
685
+ fileTokenScores: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
686
+ knowledgeFiles: z.ZodRecord<z.ZodString, z.ZodString>;
687
+ userKnowledgeFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
688
+ gitChanges: z.ZodObject<{
689
+ status: z.ZodString;
690
+ diff: z.ZodString;
691
+ diffCached: z.ZodString;
692
+ lastCommitMessages: z.ZodString;
693
+ }, "strip", z.ZodTypeAny, {
694
+ status: string;
695
+ diff: string;
696
+ diffCached: string;
697
+ lastCommitMessages: string;
698
+ }, {
699
+ status: string;
700
+ diff: string;
701
+ diffCached: string;
702
+ lastCommitMessages: string;
703
+ }>;
704
+ changesSinceLastChat: z.ZodRecord<z.ZodString, z.ZodString>;
705
+ shellConfigFiles: z.ZodRecord<z.ZodString, z.ZodString>;
706
+ systemInfo: z.ZodObject<{
707
+ platform: z.ZodString;
708
+ shell: z.ZodString;
709
+ nodeVersion: z.ZodString;
710
+ arch: z.ZodString;
711
+ homedir: z.ZodString;
712
+ cpus: z.ZodNumber;
713
+ }, "strip", z.ZodTypeAny, {
714
+ platform: string;
715
+ shell: string;
716
+ nodeVersion: string;
717
+ arch: string;
718
+ homedir: string;
719
+ cpus: number;
720
+ }, {
721
+ platform: string;
722
+ shell: string;
723
+ nodeVersion: string;
724
+ arch: string;
725
+ homedir: string;
726
+ cpus: number;
727
+ }>;
728
+ fileVersions: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodObject<{
729
+ path: z.ZodString;
730
+ content: z.ZodString;
731
+ }, "strip", z.ZodTypeAny, {
732
+ path: string;
733
+ content: string;
734
+ }, {
735
+ path: string;
736
+ content: string;
737
+ }>, "many">, "many">>;
738
+ }, "strip", z.ZodTypeAny, {
739
+ currentWorkingDirectory: string;
740
+ fileTree: import("../util/file").FileTreeNode[];
741
+ fileTokenScores: Record<string, Record<string, number>>;
742
+ knowledgeFiles: Record<string, string>;
743
+ gitChanges: {
744
+ status: string;
745
+ diff: string;
746
+ diffCached: string;
747
+ lastCommitMessages: string;
748
+ };
749
+ changesSinceLastChat: Record<string, string>;
750
+ shellConfigFiles: Record<string, string>;
751
+ systemInfo: {
752
+ platform: string;
753
+ shell: string;
754
+ nodeVersion: string;
755
+ arch: string;
756
+ homedir: string;
757
+ cpus: number;
758
+ };
759
+ userKnowledgeFiles?: Record<string, string> | undefined;
760
+ fileVersions?: {
761
+ path: string;
762
+ content: string;
763
+ }[][] | undefined;
764
+ }, {
765
+ currentWorkingDirectory: string;
766
+ fileTree: import("../util/file").FileTreeNode[];
767
+ fileTokenScores: Record<string, Record<string, number>>;
768
+ knowledgeFiles: Record<string, string>;
769
+ gitChanges: {
770
+ status: string;
771
+ diff: string;
772
+ diffCached: string;
773
+ lastCommitMessages: string;
774
+ };
775
+ changesSinceLastChat: Record<string, string>;
776
+ shellConfigFiles: Record<string, string>;
777
+ systemInfo: {
778
+ platform: string;
779
+ shell: string;
780
+ nodeVersion: string;
781
+ arch: string;
782
+ homedir: string;
783
+ cpus: number;
784
+ };
785
+ userKnowledgeFiles?: Record<string, string> | undefined;
786
+ fileVersions?: {
787
+ path: string;
788
+ content: string;
789
+ }[][] | undefined;
790
+ }>;
791
+ }, "strip", z.ZodTypeAny, {
792
+ type: "init";
793
+ fileContext: {
794
+ currentWorkingDirectory: string;
795
+ fileTree: import("../util/file").FileTreeNode[];
796
+ fileTokenScores: Record<string, Record<string, number>>;
797
+ knowledgeFiles: Record<string, string>;
798
+ gitChanges: {
799
+ status: string;
800
+ diff: string;
801
+ diffCached: string;
802
+ lastCommitMessages: string;
803
+ };
804
+ changesSinceLastChat: Record<string, string>;
805
+ shellConfigFiles: Record<string, string>;
806
+ systemInfo: {
807
+ platform: string;
808
+ shell: string;
809
+ nodeVersion: string;
810
+ arch: string;
811
+ homedir: string;
812
+ cpus: number;
813
+ };
814
+ userKnowledgeFiles?: Record<string, string> | undefined;
815
+ fileVersions?: {
816
+ path: string;
817
+ content: string;
818
+ }[][] | undefined;
819
+ };
820
+ fingerprintId: string;
821
+ authToken?: string | undefined;
822
+ }, {
823
+ type: "init";
824
+ fileContext: {
825
+ currentWorkingDirectory: string;
826
+ fileTree: import("../util/file").FileTreeNode[];
827
+ fileTokenScores: Record<string, Record<string, number>>;
828
+ knowledgeFiles: Record<string, string>;
829
+ gitChanges: {
830
+ status: string;
831
+ diff: string;
832
+ diffCached: string;
833
+ lastCommitMessages: string;
834
+ };
835
+ changesSinceLastChat: Record<string, string>;
836
+ shellConfigFiles: Record<string, string>;
837
+ systemInfo: {
838
+ platform: string;
839
+ shell: string;
840
+ nodeVersion: string;
841
+ arch: string;
842
+ homedir: string;
843
+ cpus: number;
844
+ };
845
+ userKnowledgeFiles?: Record<string, string> | undefined;
846
+ fileVersions?: {
847
+ path: string;
848
+ content: string;
849
+ }[][] | undefined;
850
+ };
851
+ fingerprintId: string;
852
+ authToken?: string | undefined;
853
+ }>, z.ZodObject<{
854
+ type: z.ZodLiteral<"generate-commit-message">;
855
+ fingerprintId: z.ZodString;
856
+ authToken: z.ZodOptional<z.ZodString>;
857
+ stagedChanges: z.ZodString;
858
+ }, "strip", z.ZodTypeAny, {
859
+ type: "generate-commit-message";
860
+ fingerprintId: string;
861
+ stagedChanges: string;
862
+ authToken?: string | undefined;
863
+ }, {
864
+ type: "generate-commit-message";
865
+ fingerprintId: string;
866
+ stagedChanges: string;
867
+ authToken?: string | undefined;
868
+ }>]>;
869
+ }, "strip", z.ZodTypeAny, {
870
+ type: "action";
871
+ data: {
872
+ type: "prompt";
873
+ promptId: string;
874
+ fingerprintId: string;
875
+ costMode: "lite" | "normal" | "max" | "experimental";
876
+ agentState: {
877
+ agentContext: string;
878
+ fileContext: {
879
+ currentWorkingDirectory: string;
880
+ fileTree: import("../util/file").FileTreeNode[];
881
+ fileTokenScores: Record<string, Record<string, number>>;
882
+ knowledgeFiles: Record<string, string>;
883
+ gitChanges: {
884
+ status: string;
885
+ diff: string;
886
+ diffCached: string;
887
+ lastCommitMessages: string;
888
+ };
889
+ changesSinceLastChat: Record<string, string>;
890
+ shellConfigFiles: Record<string, string>;
891
+ systemInfo: {
892
+ platform: string;
893
+ shell: string;
894
+ nodeVersion: string;
895
+ arch: string;
896
+ homedir: string;
897
+ cpus: number;
898
+ };
899
+ userKnowledgeFiles?: Record<string, string> | undefined;
900
+ fileVersions?: {
901
+ path: string;
902
+ content: string;
903
+ }[][] | undefined;
904
+ };
905
+ messageHistory: {
906
+ content: string | ({
907
+ type: "text";
908
+ text: string;
909
+ cache_control?: {
910
+ type: "ephemeral";
911
+ } | undefined;
912
+ } | {
913
+ type: "tool_use";
914
+ name: string;
915
+ id: string;
916
+ input: Record<string, any>;
917
+ cache_control?: {
918
+ type: "ephemeral";
919
+ } | undefined;
920
+ } | {
921
+ type: "tool_result";
922
+ content: string;
923
+ tool_use_id: string;
924
+ cache_control?: {
925
+ type: "ephemeral";
926
+ } | undefined;
927
+ } | {
928
+ type: "image";
929
+ source: {
930
+ type: "base64";
931
+ media_type: "image/jpeg";
932
+ data: string;
933
+ };
934
+ cache_control?: {
935
+ type: "ephemeral";
936
+ } | undefined;
937
+ })[];
938
+ role: "user" | "assistant";
939
+ }[];
940
+ consecutiveAssistantMessages?: number | undefined;
941
+ };
942
+ toolResults: {
943
+ name: string;
944
+ id: string;
945
+ result: string;
946
+ }[];
947
+ prompt?: string | undefined;
948
+ authToken?: string | undefined;
949
+ model?: string | undefined;
950
+ } | {
951
+ type: "read-files-response";
952
+ files: Record<string, string | null>;
953
+ requestId?: string | undefined;
954
+ } | {
955
+ type: "init";
956
+ fileContext: {
957
+ currentWorkingDirectory: string;
958
+ fileTree: import("../util/file").FileTreeNode[];
959
+ fileTokenScores: Record<string, Record<string, number>>;
960
+ knowledgeFiles: Record<string, string>;
961
+ gitChanges: {
962
+ status: string;
963
+ diff: string;
964
+ diffCached: string;
965
+ lastCommitMessages: string;
966
+ };
967
+ changesSinceLastChat: Record<string, string>;
968
+ shellConfigFiles: Record<string, string>;
969
+ systemInfo: {
970
+ platform: string;
971
+ shell: string;
972
+ nodeVersion: string;
973
+ arch: string;
974
+ homedir: string;
975
+ cpus: number;
976
+ };
977
+ userKnowledgeFiles?: Record<string, string> | undefined;
978
+ fileVersions?: {
979
+ path: string;
980
+ content: string;
981
+ }[][] | undefined;
982
+ };
983
+ fingerprintId: string;
984
+ authToken?: string | undefined;
985
+ } | {
986
+ type: "generate-commit-message";
987
+ fingerprintId: string;
988
+ stagedChanges: string;
989
+ authToken?: string | undefined;
990
+ };
991
+ txid: number;
992
+ }, {
993
+ type: "action";
994
+ data: {
995
+ type: "prompt";
996
+ promptId: string;
997
+ fingerprintId: string;
998
+ agentState: {
999
+ agentContext: string;
1000
+ fileContext: {
1001
+ currentWorkingDirectory: string;
1002
+ fileTree: import("../util/file").FileTreeNode[];
1003
+ fileTokenScores: Record<string, Record<string, number>>;
1004
+ knowledgeFiles: Record<string, string>;
1005
+ gitChanges: {
1006
+ status: string;
1007
+ diff: string;
1008
+ diffCached: string;
1009
+ lastCommitMessages: string;
1010
+ };
1011
+ changesSinceLastChat: Record<string, string>;
1012
+ shellConfigFiles: Record<string, string>;
1013
+ systemInfo: {
1014
+ platform: string;
1015
+ shell: string;
1016
+ nodeVersion: string;
1017
+ arch: string;
1018
+ homedir: string;
1019
+ cpus: number;
1020
+ };
1021
+ userKnowledgeFiles?: Record<string, string> | undefined;
1022
+ fileVersions?: {
1023
+ path: string;
1024
+ content: string;
1025
+ }[][] | undefined;
1026
+ };
1027
+ messageHistory: {
1028
+ content: string | ({
1029
+ type: "text";
1030
+ text: string;
1031
+ cache_control?: {
1032
+ type: "ephemeral";
1033
+ } | undefined;
1034
+ } | {
1035
+ type: "tool_use";
1036
+ name: string;
1037
+ id: string;
1038
+ input: Record<string, any>;
1039
+ cache_control?: {
1040
+ type: "ephemeral";
1041
+ } | undefined;
1042
+ } | {
1043
+ type: "tool_result";
1044
+ content: string;
1045
+ tool_use_id: string;
1046
+ cache_control?: {
1047
+ type: "ephemeral";
1048
+ } | undefined;
1049
+ } | {
1050
+ type: "image";
1051
+ source: {
1052
+ type: "base64";
1053
+ media_type: "image/jpeg";
1054
+ data: string;
1055
+ };
1056
+ cache_control?: {
1057
+ type: "ephemeral";
1058
+ } | undefined;
1059
+ })[];
1060
+ role: "user" | "assistant";
1061
+ }[];
1062
+ consecutiveAssistantMessages?: number | undefined;
1063
+ };
1064
+ toolResults: {
1065
+ name: string;
1066
+ id: string;
1067
+ result: string;
1068
+ }[];
1069
+ prompt?: string | undefined;
1070
+ authToken?: string | undefined;
1071
+ costMode?: "lite" | "normal" | "max" | "experimental" | undefined;
1072
+ model?: string | undefined;
1073
+ } | {
1074
+ type: "read-files-response";
1075
+ files: Record<string, string | null>;
1076
+ requestId?: string | undefined;
1077
+ } | {
1078
+ type: "init";
1079
+ fileContext: {
1080
+ currentWorkingDirectory: string;
1081
+ fileTree: import("../util/file").FileTreeNode[];
1082
+ fileTokenScores: Record<string, Record<string, number>>;
1083
+ knowledgeFiles: Record<string, string>;
1084
+ gitChanges: {
1085
+ status: string;
1086
+ diff: string;
1087
+ diffCached: string;
1088
+ lastCommitMessages: string;
1089
+ };
1090
+ changesSinceLastChat: Record<string, string>;
1091
+ shellConfigFiles: Record<string, string>;
1092
+ systemInfo: {
1093
+ platform: string;
1094
+ shell: string;
1095
+ nodeVersion: string;
1096
+ arch: string;
1097
+ homedir: string;
1098
+ cpus: number;
1099
+ };
1100
+ userKnowledgeFiles?: Record<string, string> | undefined;
1101
+ fileVersions?: {
1102
+ path: string;
1103
+ content: string;
1104
+ }[][] | undefined;
1105
+ };
1106
+ fingerprintId: string;
1107
+ authToken?: string | undefined;
1108
+ } | {
1109
+ type: "generate-commit-message";
1110
+ fingerprintId: string;
1111
+ stagedChanges: string;
1112
+ authToken?: string | undefined;
1113
+ };
1114
+ txid: number;
1115
+ }>;
1116
+ };
1117
+ export declare const CLIENT_MESSAGE_SCHEMA: z.ZodUnion<[z.ZodObject<{
1118
+ type: z.ZodLiteral<"identify">;
1119
+ txid: z.ZodNumber;
1120
+ clientSessionId: z.ZodString;
1121
+ }, "strip", z.ZodTypeAny, {
1122
+ type: "identify";
1123
+ clientSessionId: string;
1124
+ txid: number;
1125
+ }, {
1126
+ type: "identify";
1127
+ clientSessionId: string;
1128
+ txid: number;
1129
+ }>, z.ZodObject<{
1130
+ type: z.ZodLiteral<"subscribe">;
1131
+ txid: z.ZodNumber;
1132
+ topics: z.ZodArray<z.ZodString, "many">;
1133
+ }, "strip", z.ZodTypeAny, {
1134
+ type: "subscribe";
1135
+ txid: number;
1136
+ topics: string[];
1137
+ }, {
1138
+ type: "subscribe";
1139
+ txid: number;
1140
+ topics: string[];
1141
+ }>, z.ZodObject<{
1142
+ type: z.ZodLiteral<"unsubscribe">;
1143
+ txid: z.ZodNumber;
1144
+ topics: z.ZodArray<z.ZodString, "many">;
1145
+ }, "strip", z.ZodTypeAny, {
1146
+ type: "unsubscribe";
1147
+ txid: number;
1148
+ topics: string[];
1149
+ }, {
1150
+ type: "unsubscribe";
1151
+ txid: number;
1152
+ topics: string[];
1153
+ }>, z.ZodObject<{
1154
+ type: z.ZodLiteral<"ping">;
1155
+ txid: z.ZodNumber;
1156
+ }, "strip", z.ZodTypeAny, {
1157
+ type: "ping";
1158
+ txid: number;
1159
+ }, {
1160
+ type: "ping";
1161
+ txid: number;
1162
+ }>, z.ZodObject<{
1163
+ type: z.ZodLiteral<"action">;
1164
+ txid: z.ZodNumber;
1165
+ data: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1166
+ type: z.ZodLiteral<"prompt">;
1167
+ promptId: z.ZodString;
1168
+ prompt: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
1169
+ fingerprintId: z.ZodString;
1170
+ authToken: z.ZodOptional<z.ZodString>;
1171
+ costMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<["lite", "normal", "max", "experimental"]>>>;
1172
+ agentState: z.ZodObject<{
1173
+ agentContext: z.ZodString;
1174
+ fileContext: z.ZodObject<{
1175
+ currentWorkingDirectory: z.ZodString;
1176
+ fileTree: z.ZodArray<z.ZodType<import("../util/file").FileTreeNode, z.ZodTypeDef, import("../util/file").FileTreeNode>, "many">;
1177
+ fileTokenScores: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
1178
+ knowledgeFiles: z.ZodRecord<z.ZodString, z.ZodString>;
1179
+ userKnowledgeFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1180
+ gitChanges: z.ZodObject<{
1181
+ status: z.ZodString;
1182
+ diff: z.ZodString;
1183
+ diffCached: z.ZodString;
1184
+ lastCommitMessages: z.ZodString;
1185
+ }, "strip", z.ZodTypeAny, {
1186
+ status: string;
1187
+ diff: string;
1188
+ diffCached: string;
1189
+ lastCommitMessages: string;
1190
+ }, {
1191
+ status: string;
1192
+ diff: string;
1193
+ diffCached: string;
1194
+ lastCommitMessages: string;
1195
+ }>;
1196
+ changesSinceLastChat: z.ZodRecord<z.ZodString, z.ZodString>;
1197
+ shellConfigFiles: z.ZodRecord<z.ZodString, z.ZodString>;
1198
+ systemInfo: z.ZodObject<{
1199
+ platform: z.ZodString;
1200
+ shell: z.ZodString;
1201
+ nodeVersion: z.ZodString;
1202
+ arch: z.ZodString;
1203
+ homedir: z.ZodString;
1204
+ cpus: z.ZodNumber;
1205
+ }, "strip", z.ZodTypeAny, {
1206
+ platform: string;
1207
+ shell: string;
1208
+ nodeVersion: string;
1209
+ arch: string;
1210
+ homedir: string;
1211
+ cpus: number;
1212
+ }, {
1213
+ platform: string;
1214
+ shell: string;
1215
+ nodeVersion: string;
1216
+ arch: string;
1217
+ homedir: string;
1218
+ cpus: number;
1219
+ }>;
1220
+ fileVersions: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodObject<{
1221
+ path: z.ZodString;
1222
+ content: z.ZodString;
1223
+ }, "strip", z.ZodTypeAny, {
1224
+ path: string;
1225
+ content: string;
1226
+ }, {
1227
+ path: string;
1228
+ content: string;
1229
+ }>, "many">, "many">>;
1230
+ }, "strip", z.ZodTypeAny, {
1231
+ currentWorkingDirectory: string;
1232
+ fileTree: import("../util/file").FileTreeNode[];
1233
+ fileTokenScores: Record<string, Record<string, number>>;
1234
+ knowledgeFiles: Record<string, string>;
1235
+ gitChanges: {
1236
+ status: string;
1237
+ diff: string;
1238
+ diffCached: string;
1239
+ lastCommitMessages: string;
1240
+ };
1241
+ changesSinceLastChat: Record<string, string>;
1242
+ shellConfigFiles: Record<string, string>;
1243
+ systemInfo: {
1244
+ platform: string;
1245
+ shell: string;
1246
+ nodeVersion: string;
1247
+ arch: string;
1248
+ homedir: string;
1249
+ cpus: number;
1250
+ };
1251
+ userKnowledgeFiles?: Record<string, string> | undefined;
1252
+ fileVersions?: {
1253
+ path: string;
1254
+ content: string;
1255
+ }[][] | undefined;
1256
+ }, {
1257
+ currentWorkingDirectory: string;
1258
+ fileTree: import("../util/file").FileTreeNode[];
1259
+ fileTokenScores: Record<string, Record<string, number>>;
1260
+ knowledgeFiles: Record<string, string>;
1261
+ gitChanges: {
1262
+ status: string;
1263
+ diff: string;
1264
+ diffCached: string;
1265
+ lastCommitMessages: string;
1266
+ };
1267
+ changesSinceLastChat: Record<string, string>;
1268
+ shellConfigFiles: Record<string, string>;
1269
+ systemInfo: {
1270
+ platform: string;
1271
+ shell: string;
1272
+ nodeVersion: string;
1273
+ arch: string;
1274
+ homedir: string;
1275
+ cpus: number;
1276
+ };
1277
+ userKnowledgeFiles?: Record<string, string> | undefined;
1278
+ fileVersions?: {
1279
+ path: string;
1280
+ content: string;
1281
+ }[][] | undefined;
1282
+ }>;
1283
+ messageHistory: z.ZodArray<z.ZodObject<{
1284
+ role: z.ZodUnion<[z.ZodLiteral<"user">, z.ZodLiteral<"assistant">]>;
1285
+ content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{
1286
+ type: z.ZodLiteral<"text">;
1287
+ text: z.ZodString;
1288
+ cache_control: z.ZodOptional<z.ZodObject<{
1289
+ type: z.ZodLiteral<"ephemeral">;
1290
+ }, "strip", z.ZodTypeAny, {
1291
+ type: "ephemeral";
1292
+ }, {
1293
+ type: "ephemeral";
1294
+ }>>;
1295
+ }, "strip", z.ZodTypeAny, {
1296
+ type: "text";
1297
+ text: string;
1298
+ cache_control?: {
1299
+ type: "ephemeral";
1300
+ } | undefined;
1301
+ }, {
1302
+ type: "text";
1303
+ text: string;
1304
+ cache_control?: {
1305
+ type: "ephemeral";
1306
+ } | undefined;
1307
+ }>, z.ZodObject<{
1308
+ type: z.ZodLiteral<"tool_use">;
1309
+ id: z.ZodString;
1310
+ name: z.ZodString;
1311
+ input: z.ZodRecord<z.ZodString, z.ZodAny>;
1312
+ cache_control: z.ZodOptional<z.ZodObject<{
1313
+ type: z.ZodLiteral<"ephemeral">;
1314
+ }, "strip", z.ZodTypeAny, {
1315
+ type: "ephemeral";
1316
+ }, {
1317
+ type: "ephemeral";
1318
+ }>>;
1319
+ }, "strip", z.ZodTypeAny, {
1320
+ type: "tool_use";
1321
+ name: string;
1322
+ id: string;
1323
+ input: Record<string, any>;
1324
+ cache_control?: {
1325
+ type: "ephemeral";
1326
+ } | undefined;
1327
+ }, {
1328
+ type: "tool_use";
1329
+ name: string;
1330
+ id: string;
1331
+ input: Record<string, any>;
1332
+ cache_control?: {
1333
+ type: "ephemeral";
1334
+ } | undefined;
1335
+ }>, z.ZodObject<{
1336
+ type: z.ZodLiteral<"tool_result">;
1337
+ tool_use_id: z.ZodString;
1338
+ content: z.ZodString;
1339
+ cache_control: z.ZodOptional<z.ZodObject<{
1340
+ type: z.ZodLiteral<"ephemeral">;
1341
+ }, "strip", z.ZodTypeAny, {
1342
+ type: "ephemeral";
1343
+ }, {
1344
+ type: "ephemeral";
1345
+ }>>;
1346
+ }, "strip", z.ZodTypeAny, {
1347
+ type: "tool_result";
1348
+ content: string;
1349
+ tool_use_id: string;
1350
+ cache_control?: {
1351
+ type: "ephemeral";
1352
+ } | undefined;
1353
+ }, {
1354
+ type: "tool_result";
1355
+ content: string;
1356
+ tool_use_id: string;
1357
+ cache_control?: {
1358
+ type: "ephemeral";
1359
+ } | undefined;
1360
+ }>, z.ZodObject<{
1361
+ type: z.ZodLiteral<"image">;
1362
+ source: z.ZodObject<{
1363
+ type: z.ZodLiteral<"base64">;
1364
+ media_type: z.ZodLiteral<"image/jpeg">;
1365
+ data: z.ZodString;
1366
+ }, "strip", z.ZodTypeAny, {
1367
+ type: "base64";
1368
+ media_type: "image/jpeg";
1369
+ data: string;
1370
+ }, {
1371
+ type: "base64";
1372
+ media_type: "image/jpeg";
1373
+ data: string;
1374
+ }>;
1375
+ cache_control: z.ZodOptional<z.ZodObject<{
1376
+ type: z.ZodLiteral<"ephemeral">;
1377
+ }, "strip", z.ZodTypeAny, {
1378
+ type: "ephemeral";
1379
+ }, {
1380
+ type: "ephemeral";
1381
+ }>>;
1382
+ }, "strip", z.ZodTypeAny, {
1383
+ type: "image";
1384
+ source: {
1385
+ type: "base64";
1386
+ media_type: "image/jpeg";
1387
+ data: string;
1388
+ };
1389
+ cache_control?: {
1390
+ type: "ephemeral";
1391
+ } | undefined;
1392
+ }, {
1393
+ type: "image";
1394
+ source: {
1395
+ type: "base64";
1396
+ media_type: "image/jpeg";
1397
+ data: string;
1398
+ };
1399
+ cache_control?: {
1400
+ type: "ephemeral";
1401
+ } | undefined;
1402
+ }>]>, "many">]>;
1403
+ }, "strip", z.ZodTypeAny, {
1404
+ content: string | ({
1405
+ type: "text";
1406
+ text: string;
1407
+ cache_control?: {
1408
+ type: "ephemeral";
1409
+ } | undefined;
1410
+ } | {
1411
+ type: "tool_use";
1412
+ name: string;
1413
+ id: string;
1414
+ input: Record<string, any>;
1415
+ cache_control?: {
1416
+ type: "ephemeral";
1417
+ } | undefined;
1418
+ } | {
1419
+ type: "tool_result";
1420
+ content: string;
1421
+ tool_use_id: string;
1422
+ cache_control?: {
1423
+ type: "ephemeral";
1424
+ } | undefined;
1425
+ } | {
1426
+ type: "image";
1427
+ source: {
1428
+ type: "base64";
1429
+ media_type: "image/jpeg";
1430
+ data: string;
1431
+ };
1432
+ cache_control?: {
1433
+ type: "ephemeral";
1434
+ } | undefined;
1435
+ })[];
1436
+ role: "user" | "assistant";
1437
+ }, {
1438
+ content: string | ({
1439
+ type: "text";
1440
+ text: string;
1441
+ cache_control?: {
1442
+ type: "ephemeral";
1443
+ } | undefined;
1444
+ } | {
1445
+ type: "tool_use";
1446
+ name: string;
1447
+ id: string;
1448
+ input: Record<string, any>;
1449
+ cache_control?: {
1450
+ type: "ephemeral";
1451
+ } | undefined;
1452
+ } | {
1453
+ type: "tool_result";
1454
+ content: string;
1455
+ tool_use_id: string;
1456
+ cache_control?: {
1457
+ type: "ephemeral";
1458
+ } | undefined;
1459
+ } | {
1460
+ type: "image";
1461
+ source: {
1462
+ type: "base64";
1463
+ media_type: "image/jpeg";
1464
+ data: string;
1465
+ };
1466
+ cache_control?: {
1467
+ type: "ephemeral";
1468
+ } | undefined;
1469
+ })[];
1470
+ role: "user" | "assistant";
1471
+ }>, "many">;
1472
+ consecutiveAssistantMessages: z.ZodOptional<z.ZodNumber>;
1473
+ }, "strip", z.ZodTypeAny, {
1474
+ agentContext: string;
1475
+ fileContext: {
1476
+ currentWorkingDirectory: string;
1477
+ fileTree: import("../util/file").FileTreeNode[];
1478
+ fileTokenScores: Record<string, Record<string, number>>;
1479
+ knowledgeFiles: Record<string, string>;
1480
+ gitChanges: {
1481
+ status: string;
1482
+ diff: string;
1483
+ diffCached: string;
1484
+ lastCommitMessages: string;
1485
+ };
1486
+ changesSinceLastChat: Record<string, string>;
1487
+ shellConfigFiles: Record<string, string>;
1488
+ systemInfo: {
1489
+ platform: string;
1490
+ shell: string;
1491
+ nodeVersion: string;
1492
+ arch: string;
1493
+ homedir: string;
1494
+ cpus: number;
1495
+ };
1496
+ userKnowledgeFiles?: Record<string, string> | undefined;
1497
+ fileVersions?: {
1498
+ path: string;
1499
+ content: string;
1500
+ }[][] | undefined;
1501
+ };
1502
+ messageHistory: {
1503
+ content: string | ({
1504
+ type: "text";
1505
+ text: string;
1506
+ cache_control?: {
1507
+ type: "ephemeral";
1508
+ } | undefined;
1509
+ } | {
1510
+ type: "tool_use";
1511
+ name: string;
1512
+ id: string;
1513
+ input: Record<string, any>;
1514
+ cache_control?: {
1515
+ type: "ephemeral";
1516
+ } | undefined;
1517
+ } | {
1518
+ type: "tool_result";
1519
+ content: string;
1520
+ tool_use_id: string;
1521
+ cache_control?: {
1522
+ type: "ephemeral";
1523
+ } | undefined;
1524
+ } | {
1525
+ type: "image";
1526
+ source: {
1527
+ type: "base64";
1528
+ media_type: "image/jpeg";
1529
+ data: string;
1530
+ };
1531
+ cache_control?: {
1532
+ type: "ephemeral";
1533
+ } | undefined;
1534
+ })[];
1535
+ role: "user" | "assistant";
1536
+ }[];
1537
+ consecutiveAssistantMessages?: number | undefined;
1538
+ }, {
1539
+ agentContext: string;
1540
+ fileContext: {
1541
+ currentWorkingDirectory: string;
1542
+ fileTree: import("../util/file").FileTreeNode[];
1543
+ fileTokenScores: Record<string, Record<string, number>>;
1544
+ knowledgeFiles: Record<string, string>;
1545
+ gitChanges: {
1546
+ status: string;
1547
+ diff: string;
1548
+ diffCached: string;
1549
+ lastCommitMessages: string;
1550
+ };
1551
+ changesSinceLastChat: Record<string, string>;
1552
+ shellConfigFiles: Record<string, string>;
1553
+ systemInfo: {
1554
+ platform: string;
1555
+ shell: string;
1556
+ nodeVersion: string;
1557
+ arch: string;
1558
+ homedir: string;
1559
+ cpus: number;
1560
+ };
1561
+ userKnowledgeFiles?: Record<string, string> | undefined;
1562
+ fileVersions?: {
1563
+ path: string;
1564
+ content: string;
1565
+ }[][] | undefined;
1566
+ };
1567
+ messageHistory: {
1568
+ content: string | ({
1569
+ type: "text";
1570
+ text: string;
1571
+ cache_control?: {
1572
+ type: "ephemeral";
1573
+ } | undefined;
1574
+ } | {
1575
+ type: "tool_use";
1576
+ name: string;
1577
+ id: string;
1578
+ input: Record<string, any>;
1579
+ cache_control?: {
1580
+ type: "ephemeral";
1581
+ } | undefined;
1582
+ } | {
1583
+ type: "tool_result";
1584
+ content: string;
1585
+ tool_use_id: string;
1586
+ cache_control?: {
1587
+ type: "ephemeral";
1588
+ } | undefined;
1589
+ } | {
1590
+ type: "image";
1591
+ source: {
1592
+ type: "base64";
1593
+ media_type: "image/jpeg";
1594
+ data: string;
1595
+ };
1596
+ cache_control?: {
1597
+ type: "ephemeral";
1598
+ } | undefined;
1599
+ })[];
1600
+ role: "user" | "assistant";
1601
+ }[];
1602
+ consecutiveAssistantMessages?: number | undefined;
1603
+ }>;
1604
+ toolResults: z.ZodArray<z.ZodObject<{
1605
+ name: z.ZodString;
1606
+ result: z.ZodString;
1607
+ id: z.ZodString;
1608
+ }, "strip", z.ZodTypeAny, {
1609
+ name: string;
1610
+ id: string;
1611
+ result: string;
1612
+ }, {
1613
+ name: string;
1614
+ id: string;
1615
+ result: string;
1616
+ }>, "many">;
1617
+ model: z.ZodOptional<z.ZodString>;
1618
+ }, "strip", z.ZodTypeAny, {
1619
+ type: "prompt";
1620
+ promptId: string;
1621
+ fingerprintId: string;
1622
+ costMode: "lite" | "normal" | "max" | "experimental";
1623
+ agentState: {
1624
+ agentContext: string;
1625
+ fileContext: {
1626
+ currentWorkingDirectory: string;
1627
+ fileTree: import("../util/file").FileTreeNode[];
1628
+ fileTokenScores: Record<string, Record<string, number>>;
1629
+ knowledgeFiles: Record<string, string>;
1630
+ gitChanges: {
1631
+ status: string;
1632
+ diff: string;
1633
+ diffCached: string;
1634
+ lastCommitMessages: string;
1635
+ };
1636
+ changesSinceLastChat: Record<string, string>;
1637
+ shellConfigFiles: Record<string, string>;
1638
+ systemInfo: {
1639
+ platform: string;
1640
+ shell: string;
1641
+ nodeVersion: string;
1642
+ arch: string;
1643
+ homedir: string;
1644
+ cpus: number;
1645
+ };
1646
+ userKnowledgeFiles?: Record<string, string> | undefined;
1647
+ fileVersions?: {
1648
+ path: string;
1649
+ content: string;
1650
+ }[][] | undefined;
1651
+ };
1652
+ messageHistory: {
1653
+ content: string | ({
1654
+ type: "text";
1655
+ text: string;
1656
+ cache_control?: {
1657
+ type: "ephemeral";
1658
+ } | undefined;
1659
+ } | {
1660
+ type: "tool_use";
1661
+ name: string;
1662
+ id: string;
1663
+ input: Record<string, any>;
1664
+ cache_control?: {
1665
+ type: "ephemeral";
1666
+ } | undefined;
1667
+ } | {
1668
+ type: "tool_result";
1669
+ content: string;
1670
+ tool_use_id: string;
1671
+ cache_control?: {
1672
+ type: "ephemeral";
1673
+ } | undefined;
1674
+ } | {
1675
+ type: "image";
1676
+ source: {
1677
+ type: "base64";
1678
+ media_type: "image/jpeg";
1679
+ data: string;
1680
+ };
1681
+ cache_control?: {
1682
+ type: "ephemeral";
1683
+ } | undefined;
1684
+ })[];
1685
+ role: "user" | "assistant";
1686
+ }[];
1687
+ consecutiveAssistantMessages?: number | undefined;
1688
+ };
1689
+ toolResults: {
1690
+ name: string;
1691
+ id: string;
1692
+ result: string;
1693
+ }[];
1694
+ prompt?: string | undefined;
1695
+ authToken?: string | undefined;
1696
+ model?: string | undefined;
1697
+ }, {
1698
+ type: "prompt";
1699
+ promptId: string;
1700
+ fingerprintId: string;
1701
+ agentState: {
1702
+ agentContext: string;
1703
+ fileContext: {
1704
+ currentWorkingDirectory: string;
1705
+ fileTree: import("../util/file").FileTreeNode[];
1706
+ fileTokenScores: Record<string, Record<string, number>>;
1707
+ knowledgeFiles: Record<string, string>;
1708
+ gitChanges: {
1709
+ status: string;
1710
+ diff: string;
1711
+ diffCached: string;
1712
+ lastCommitMessages: string;
1713
+ };
1714
+ changesSinceLastChat: Record<string, string>;
1715
+ shellConfigFiles: Record<string, string>;
1716
+ systemInfo: {
1717
+ platform: string;
1718
+ shell: string;
1719
+ nodeVersion: string;
1720
+ arch: string;
1721
+ homedir: string;
1722
+ cpus: number;
1723
+ };
1724
+ userKnowledgeFiles?: Record<string, string> | undefined;
1725
+ fileVersions?: {
1726
+ path: string;
1727
+ content: string;
1728
+ }[][] | undefined;
1729
+ };
1730
+ messageHistory: {
1731
+ content: string | ({
1732
+ type: "text";
1733
+ text: string;
1734
+ cache_control?: {
1735
+ type: "ephemeral";
1736
+ } | undefined;
1737
+ } | {
1738
+ type: "tool_use";
1739
+ name: string;
1740
+ id: string;
1741
+ input: Record<string, any>;
1742
+ cache_control?: {
1743
+ type: "ephemeral";
1744
+ } | undefined;
1745
+ } | {
1746
+ type: "tool_result";
1747
+ content: string;
1748
+ tool_use_id: string;
1749
+ cache_control?: {
1750
+ type: "ephemeral";
1751
+ } | undefined;
1752
+ } | {
1753
+ type: "image";
1754
+ source: {
1755
+ type: "base64";
1756
+ media_type: "image/jpeg";
1757
+ data: string;
1758
+ };
1759
+ cache_control?: {
1760
+ type: "ephemeral";
1761
+ } | undefined;
1762
+ })[];
1763
+ role: "user" | "assistant";
1764
+ }[];
1765
+ consecutiveAssistantMessages?: number | undefined;
1766
+ };
1767
+ toolResults: {
1768
+ name: string;
1769
+ id: string;
1770
+ result: string;
1771
+ }[];
1772
+ prompt?: string | undefined;
1773
+ authToken?: string | undefined;
1774
+ costMode?: "lite" | "normal" | "max" | "experimental" | undefined;
1775
+ model?: string | undefined;
1776
+ }>, z.ZodObject<{
1777
+ type: z.ZodLiteral<"read-files-response">;
1778
+ files: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNull]>>;
1779
+ requestId: z.ZodOptional<z.ZodString>;
1780
+ }, "strip", z.ZodTypeAny, {
1781
+ type: "read-files-response";
1782
+ files: Record<string, string | null>;
1783
+ requestId?: string | undefined;
1784
+ }, {
1785
+ type: "read-files-response";
1786
+ files: Record<string, string | null>;
1787
+ requestId?: string | undefined;
1788
+ }>, z.ZodObject<{
1789
+ type: z.ZodLiteral<"init">;
1790
+ fingerprintId: z.ZodString;
1791
+ authToken: z.ZodOptional<z.ZodString>;
1792
+ fileContext: z.ZodObject<{
1793
+ currentWorkingDirectory: z.ZodString;
1794
+ fileTree: z.ZodArray<z.ZodType<import("../util/file").FileTreeNode, z.ZodTypeDef, import("../util/file").FileTreeNode>, "many">;
1795
+ fileTokenScores: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
1796
+ knowledgeFiles: z.ZodRecord<z.ZodString, z.ZodString>;
1797
+ userKnowledgeFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1798
+ gitChanges: z.ZodObject<{
1799
+ status: z.ZodString;
1800
+ diff: z.ZodString;
1801
+ diffCached: z.ZodString;
1802
+ lastCommitMessages: z.ZodString;
1803
+ }, "strip", z.ZodTypeAny, {
1804
+ status: string;
1805
+ diff: string;
1806
+ diffCached: string;
1807
+ lastCommitMessages: string;
1808
+ }, {
1809
+ status: string;
1810
+ diff: string;
1811
+ diffCached: string;
1812
+ lastCommitMessages: string;
1813
+ }>;
1814
+ changesSinceLastChat: z.ZodRecord<z.ZodString, z.ZodString>;
1815
+ shellConfigFiles: z.ZodRecord<z.ZodString, z.ZodString>;
1816
+ systemInfo: z.ZodObject<{
1817
+ platform: z.ZodString;
1818
+ shell: z.ZodString;
1819
+ nodeVersion: z.ZodString;
1820
+ arch: z.ZodString;
1821
+ homedir: z.ZodString;
1822
+ cpus: z.ZodNumber;
1823
+ }, "strip", z.ZodTypeAny, {
1824
+ platform: string;
1825
+ shell: string;
1826
+ nodeVersion: string;
1827
+ arch: string;
1828
+ homedir: string;
1829
+ cpus: number;
1830
+ }, {
1831
+ platform: string;
1832
+ shell: string;
1833
+ nodeVersion: string;
1834
+ arch: string;
1835
+ homedir: string;
1836
+ cpus: number;
1837
+ }>;
1838
+ fileVersions: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodObject<{
1839
+ path: z.ZodString;
1840
+ content: z.ZodString;
1841
+ }, "strip", z.ZodTypeAny, {
1842
+ path: string;
1843
+ content: string;
1844
+ }, {
1845
+ path: string;
1846
+ content: string;
1847
+ }>, "many">, "many">>;
1848
+ }, "strip", z.ZodTypeAny, {
1849
+ currentWorkingDirectory: string;
1850
+ fileTree: import("../util/file").FileTreeNode[];
1851
+ fileTokenScores: Record<string, Record<string, number>>;
1852
+ knowledgeFiles: Record<string, string>;
1853
+ gitChanges: {
1854
+ status: string;
1855
+ diff: string;
1856
+ diffCached: string;
1857
+ lastCommitMessages: string;
1858
+ };
1859
+ changesSinceLastChat: Record<string, string>;
1860
+ shellConfigFiles: Record<string, string>;
1861
+ systemInfo: {
1862
+ platform: string;
1863
+ shell: string;
1864
+ nodeVersion: string;
1865
+ arch: string;
1866
+ homedir: string;
1867
+ cpus: number;
1868
+ };
1869
+ userKnowledgeFiles?: Record<string, string> | undefined;
1870
+ fileVersions?: {
1871
+ path: string;
1872
+ content: string;
1873
+ }[][] | undefined;
1874
+ }, {
1875
+ currentWorkingDirectory: string;
1876
+ fileTree: import("../util/file").FileTreeNode[];
1877
+ fileTokenScores: Record<string, Record<string, number>>;
1878
+ knowledgeFiles: Record<string, string>;
1879
+ gitChanges: {
1880
+ status: string;
1881
+ diff: string;
1882
+ diffCached: string;
1883
+ lastCommitMessages: string;
1884
+ };
1885
+ changesSinceLastChat: Record<string, string>;
1886
+ shellConfigFiles: Record<string, string>;
1887
+ systemInfo: {
1888
+ platform: string;
1889
+ shell: string;
1890
+ nodeVersion: string;
1891
+ arch: string;
1892
+ homedir: string;
1893
+ cpus: number;
1894
+ };
1895
+ userKnowledgeFiles?: Record<string, string> | undefined;
1896
+ fileVersions?: {
1897
+ path: string;
1898
+ content: string;
1899
+ }[][] | undefined;
1900
+ }>;
1901
+ }, "strip", z.ZodTypeAny, {
1902
+ type: "init";
1903
+ fileContext: {
1904
+ currentWorkingDirectory: string;
1905
+ fileTree: import("../util/file").FileTreeNode[];
1906
+ fileTokenScores: Record<string, Record<string, number>>;
1907
+ knowledgeFiles: Record<string, string>;
1908
+ gitChanges: {
1909
+ status: string;
1910
+ diff: string;
1911
+ diffCached: string;
1912
+ lastCommitMessages: string;
1913
+ };
1914
+ changesSinceLastChat: Record<string, string>;
1915
+ shellConfigFiles: Record<string, string>;
1916
+ systemInfo: {
1917
+ platform: string;
1918
+ shell: string;
1919
+ nodeVersion: string;
1920
+ arch: string;
1921
+ homedir: string;
1922
+ cpus: number;
1923
+ };
1924
+ userKnowledgeFiles?: Record<string, string> | undefined;
1925
+ fileVersions?: {
1926
+ path: string;
1927
+ content: string;
1928
+ }[][] | undefined;
1929
+ };
1930
+ fingerprintId: string;
1931
+ authToken?: string | undefined;
1932
+ }, {
1933
+ type: "init";
1934
+ fileContext: {
1935
+ currentWorkingDirectory: string;
1936
+ fileTree: import("../util/file").FileTreeNode[];
1937
+ fileTokenScores: Record<string, Record<string, number>>;
1938
+ knowledgeFiles: Record<string, string>;
1939
+ gitChanges: {
1940
+ status: string;
1941
+ diff: string;
1942
+ diffCached: string;
1943
+ lastCommitMessages: string;
1944
+ };
1945
+ changesSinceLastChat: Record<string, string>;
1946
+ shellConfigFiles: Record<string, string>;
1947
+ systemInfo: {
1948
+ platform: string;
1949
+ shell: string;
1950
+ nodeVersion: string;
1951
+ arch: string;
1952
+ homedir: string;
1953
+ cpus: number;
1954
+ };
1955
+ userKnowledgeFiles?: Record<string, string> | undefined;
1956
+ fileVersions?: {
1957
+ path: string;
1958
+ content: string;
1959
+ }[][] | undefined;
1960
+ };
1961
+ fingerprintId: string;
1962
+ authToken?: string | undefined;
1963
+ }>, z.ZodObject<{
1964
+ type: z.ZodLiteral<"generate-commit-message">;
1965
+ fingerprintId: z.ZodString;
1966
+ authToken: z.ZodOptional<z.ZodString>;
1967
+ stagedChanges: z.ZodString;
1968
+ }, "strip", z.ZodTypeAny, {
1969
+ type: "generate-commit-message";
1970
+ fingerprintId: string;
1971
+ stagedChanges: string;
1972
+ authToken?: string | undefined;
1973
+ }, {
1974
+ type: "generate-commit-message";
1975
+ fingerprintId: string;
1976
+ stagedChanges: string;
1977
+ authToken?: string | undefined;
1978
+ }>]>;
1979
+ }, "strip", z.ZodTypeAny, {
1980
+ type: "action";
1981
+ data: {
1982
+ type: "prompt";
1983
+ promptId: string;
1984
+ fingerprintId: string;
1985
+ costMode: "lite" | "normal" | "max" | "experimental";
1986
+ agentState: {
1987
+ agentContext: string;
1988
+ fileContext: {
1989
+ currentWorkingDirectory: string;
1990
+ fileTree: import("../util/file").FileTreeNode[];
1991
+ fileTokenScores: Record<string, Record<string, number>>;
1992
+ knowledgeFiles: Record<string, string>;
1993
+ gitChanges: {
1994
+ status: string;
1995
+ diff: string;
1996
+ diffCached: string;
1997
+ lastCommitMessages: string;
1998
+ };
1999
+ changesSinceLastChat: Record<string, string>;
2000
+ shellConfigFiles: Record<string, string>;
2001
+ systemInfo: {
2002
+ platform: string;
2003
+ shell: string;
2004
+ nodeVersion: string;
2005
+ arch: string;
2006
+ homedir: string;
2007
+ cpus: number;
2008
+ };
2009
+ userKnowledgeFiles?: Record<string, string> | undefined;
2010
+ fileVersions?: {
2011
+ path: string;
2012
+ content: string;
2013
+ }[][] | undefined;
2014
+ };
2015
+ messageHistory: {
2016
+ content: string | ({
2017
+ type: "text";
2018
+ text: string;
2019
+ cache_control?: {
2020
+ type: "ephemeral";
2021
+ } | undefined;
2022
+ } | {
2023
+ type: "tool_use";
2024
+ name: string;
2025
+ id: string;
2026
+ input: Record<string, any>;
2027
+ cache_control?: {
2028
+ type: "ephemeral";
2029
+ } | undefined;
2030
+ } | {
2031
+ type: "tool_result";
2032
+ content: string;
2033
+ tool_use_id: string;
2034
+ cache_control?: {
2035
+ type: "ephemeral";
2036
+ } | undefined;
2037
+ } | {
2038
+ type: "image";
2039
+ source: {
2040
+ type: "base64";
2041
+ media_type: "image/jpeg";
2042
+ data: string;
2043
+ };
2044
+ cache_control?: {
2045
+ type: "ephemeral";
2046
+ } | undefined;
2047
+ })[];
2048
+ role: "user" | "assistant";
2049
+ }[];
2050
+ consecutiveAssistantMessages?: number | undefined;
2051
+ };
2052
+ toolResults: {
2053
+ name: string;
2054
+ id: string;
2055
+ result: string;
2056
+ }[];
2057
+ prompt?: string | undefined;
2058
+ authToken?: string | undefined;
2059
+ model?: string | undefined;
2060
+ } | {
2061
+ type: "read-files-response";
2062
+ files: Record<string, string | null>;
2063
+ requestId?: string | undefined;
2064
+ } | {
2065
+ type: "init";
2066
+ fileContext: {
2067
+ currentWorkingDirectory: string;
2068
+ fileTree: import("../util/file").FileTreeNode[];
2069
+ fileTokenScores: Record<string, Record<string, number>>;
2070
+ knowledgeFiles: Record<string, string>;
2071
+ gitChanges: {
2072
+ status: string;
2073
+ diff: string;
2074
+ diffCached: string;
2075
+ lastCommitMessages: string;
2076
+ };
2077
+ changesSinceLastChat: Record<string, string>;
2078
+ shellConfigFiles: Record<string, string>;
2079
+ systemInfo: {
2080
+ platform: string;
2081
+ shell: string;
2082
+ nodeVersion: string;
2083
+ arch: string;
2084
+ homedir: string;
2085
+ cpus: number;
2086
+ };
2087
+ userKnowledgeFiles?: Record<string, string> | undefined;
2088
+ fileVersions?: {
2089
+ path: string;
2090
+ content: string;
2091
+ }[][] | undefined;
2092
+ };
2093
+ fingerprintId: string;
2094
+ authToken?: string | undefined;
2095
+ } | {
2096
+ type: "generate-commit-message";
2097
+ fingerprintId: string;
2098
+ stagedChanges: string;
2099
+ authToken?: string | undefined;
2100
+ };
2101
+ txid: number;
2102
+ }, {
2103
+ type: "action";
2104
+ data: {
2105
+ type: "prompt";
2106
+ promptId: string;
2107
+ fingerprintId: string;
2108
+ agentState: {
2109
+ agentContext: string;
2110
+ fileContext: {
2111
+ currentWorkingDirectory: string;
2112
+ fileTree: import("../util/file").FileTreeNode[];
2113
+ fileTokenScores: Record<string, Record<string, number>>;
2114
+ knowledgeFiles: Record<string, string>;
2115
+ gitChanges: {
2116
+ status: string;
2117
+ diff: string;
2118
+ diffCached: string;
2119
+ lastCommitMessages: string;
2120
+ };
2121
+ changesSinceLastChat: Record<string, string>;
2122
+ shellConfigFiles: Record<string, string>;
2123
+ systemInfo: {
2124
+ platform: string;
2125
+ shell: string;
2126
+ nodeVersion: string;
2127
+ arch: string;
2128
+ homedir: string;
2129
+ cpus: number;
2130
+ };
2131
+ userKnowledgeFiles?: Record<string, string> | undefined;
2132
+ fileVersions?: {
2133
+ path: string;
2134
+ content: string;
2135
+ }[][] | undefined;
2136
+ };
2137
+ messageHistory: {
2138
+ content: string | ({
2139
+ type: "text";
2140
+ text: string;
2141
+ cache_control?: {
2142
+ type: "ephemeral";
2143
+ } | undefined;
2144
+ } | {
2145
+ type: "tool_use";
2146
+ name: string;
2147
+ id: string;
2148
+ input: Record<string, any>;
2149
+ cache_control?: {
2150
+ type: "ephemeral";
2151
+ } | undefined;
2152
+ } | {
2153
+ type: "tool_result";
2154
+ content: string;
2155
+ tool_use_id: string;
2156
+ cache_control?: {
2157
+ type: "ephemeral";
2158
+ } | undefined;
2159
+ } | {
2160
+ type: "image";
2161
+ source: {
2162
+ type: "base64";
2163
+ media_type: "image/jpeg";
2164
+ data: string;
2165
+ };
2166
+ cache_control?: {
2167
+ type: "ephemeral";
2168
+ } | undefined;
2169
+ })[];
2170
+ role: "user" | "assistant";
2171
+ }[];
2172
+ consecutiveAssistantMessages?: number | undefined;
2173
+ };
2174
+ toolResults: {
2175
+ name: string;
2176
+ id: string;
2177
+ result: string;
2178
+ }[];
2179
+ prompt?: string | undefined;
2180
+ authToken?: string | undefined;
2181
+ costMode?: "lite" | "normal" | "max" | "experimental" | undefined;
2182
+ model?: string | undefined;
2183
+ } | {
2184
+ type: "read-files-response";
2185
+ files: Record<string, string | null>;
2186
+ requestId?: string | undefined;
2187
+ } | {
2188
+ type: "init";
2189
+ fileContext: {
2190
+ currentWorkingDirectory: string;
2191
+ fileTree: import("../util/file").FileTreeNode[];
2192
+ fileTokenScores: Record<string, Record<string, number>>;
2193
+ knowledgeFiles: Record<string, string>;
2194
+ gitChanges: {
2195
+ status: string;
2196
+ diff: string;
2197
+ diffCached: string;
2198
+ lastCommitMessages: string;
2199
+ };
2200
+ changesSinceLastChat: Record<string, string>;
2201
+ shellConfigFiles: Record<string, string>;
2202
+ systemInfo: {
2203
+ platform: string;
2204
+ shell: string;
2205
+ nodeVersion: string;
2206
+ arch: string;
2207
+ homedir: string;
2208
+ cpus: number;
2209
+ };
2210
+ userKnowledgeFiles?: Record<string, string> | undefined;
2211
+ fileVersions?: {
2212
+ path: string;
2213
+ content: string;
2214
+ }[][] | undefined;
2215
+ };
2216
+ fingerprintId: string;
2217
+ authToken?: string | undefined;
2218
+ } | {
2219
+ type: "generate-commit-message";
2220
+ fingerprintId: string;
2221
+ stagedChanges: string;
2222
+ authToken?: string | undefined;
2223
+ };
2224
+ txid: number;
2225
+ }>]>;
2226
+ export type ClientMessageType = keyof typeof CLIENT_MESSAGE_SCHEMAS;
2227
+ export type ClientMessage<T extends ClientMessageType = ClientMessageType> = z.infer<(typeof CLIENT_MESSAGE_SCHEMAS)[T]>;
2228
+ export declare const SERVER_MESSAGE_SCHEMAS: {
2229
+ ack: z.ZodObject<{
2230
+ type: z.ZodLiteral<"ack">;
2231
+ txid: z.ZodOptional<z.ZodNumber>;
2232
+ success: z.ZodBoolean;
2233
+ error: z.ZodOptional<z.ZodString>;
2234
+ }, "strip", z.ZodTypeAny, {
2235
+ type: "ack";
2236
+ success: boolean;
2237
+ error?: string | undefined;
2238
+ txid?: number | undefined;
2239
+ }, {
2240
+ type: "ack";
2241
+ success: boolean;
2242
+ error?: string | undefined;
2243
+ txid?: number | undefined;
2244
+ }>;
2245
+ action: z.ZodObject<{
2246
+ type: z.ZodLiteral<"action">;
2247
+ data: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2248
+ type: z.ZodLiteral<"response-chunk">;
2249
+ userInputId: z.ZodString;
2250
+ chunk: z.ZodString;
2251
+ }, "strip", z.ZodTypeAny, {
2252
+ type: "response-chunk";
2253
+ userInputId: string;
2254
+ chunk: string;
2255
+ }, {
2256
+ type: "response-chunk";
2257
+ userInputId: string;
2258
+ chunk: string;
2259
+ }>, z.ZodObject<z.objectUtil.extendShape<{
2260
+ type: z.ZodLiteral<"response-complete">;
2261
+ userInputId: z.ZodString;
2262
+ response: z.ZodString;
2263
+ changes: z.ZodArray<z.ZodObject<{
2264
+ type: z.ZodEnum<["patch", "file"]>;
2265
+ path: z.ZodString;
2266
+ content: z.ZodString;
2267
+ }, "strip", z.ZodTypeAny, {
2268
+ path: string;
2269
+ type: "file" | "patch";
2270
+ content: string;
2271
+ }, {
2272
+ path: string;
2273
+ type: "file" | "patch";
2274
+ content: string;
2275
+ }>, "many">;
2276
+ changesAlreadyApplied: z.ZodArray<z.ZodObject<{
2277
+ type: z.ZodEnum<["patch", "file"]>;
2278
+ path: z.ZodString;
2279
+ content: z.ZodString;
2280
+ }, "strip", z.ZodTypeAny, {
2281
+ path: string;
2282
+ type: "file" | "patch";
2283
+ content: string;
2284
+ }, {
2285
+ path: string;
2286
+ type: "file" | "patch";
2287
+ content: string;
2288
+ }>, "many">;
2289
+ addedFileVersions: z.ZodArray<z.ZodObject<{
2290
+ path: z.ZodString;
2291
+ content: z.ZodString;
2292
+ }, "strip", z.ZodTypeAny, {
2293
+ path: string;
2294
+ content: string;
2295
+ }, {
2296
+ path: string;
2297
+ content: string;
2298
+ }>, "many">;
2299
+ resetFileVersions: z.ZodBoolean;
2300
+ }, {
2301
+ usage: z.ZodOptional<z.ZodNumber>;
2302
+ remainingBalance: z.ZodOptional<z.ZodNumber>;
2303
+ balanceBreakdown: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodEnum<[import("../types/grant").GrantType, ...import("../types/grant").GrantType[]]>, z.ZodNumber>>>;
2304
+ next_quota_reset: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
2305
+ autoTopupAdded: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
2306
+ }>, "strip", z.ZodTypeAny, {
2307
+ type: "response-complete";
2308
+ userInputId: string;
2309
+ response: string;
2310
+ changes: {
2311
+ path: string;
2312
+ type: "file" | "patch";
2313
+ content: string;
2314
+ }[];
2315
+ changesAlreadyApplied: {
2316
+ path: string;
2317
+ type: "file" | "patch";
2318
+ content: string;
2319
+ }[];
2320
+ addedFileVersions: {
2321
+ path: string;
2322
+ content: string;
2323
+ }[];
2324
+ resetFileVersions: boolean;
2325
+ usage?: number | undefined;
2326
+ remainingBalance?: number | undefined;
2327
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
2328
+ next_quota_reset?: Date | null | undefined;
2329
+ autoTopupAdded?: number | undefined;
2330
+ }, {
2331
+ type: "response-complete";
2332
+ userInputId: string;
2333
+ response: string;
2334
+ changes: {
2335
+ path: string;
2336
+ type: "file" | "patch";
2337
+ content: string;
2338
+ }[];
2339
+ changesAlreadyApplied: {
2340
+ path: string;
2341
+ type: "file" | "patch";
2342
+ content: string;
2343
+ }[];
2344
+ addedFileVersions: {
2345
+ path: string;
2346
+ content: string;
2347
+ }[];
2348
+ resetFileVersions: boolean;
2349
+ usage?: number | undefined;
2350
+ remainingBalance?: number | undefined;
2351
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
2352
+ next_quota_reset?: Date | null | undefined;
2353
+ autoTopupAdded?: number | undefined;
2354
+ }>, z.ZodObject<{
2355
+ type: z.ZodLiteral<"prompt-response">;
2356
+ promptId: z.ZodString;
2357
+ agentState: z.ZodObject<{
2358
+ agentContext: z.ZodString;
2359
+ fileContext: z.ZodObject<{
2360
+ currentWorkingDirectory: z.ZodString;
2361
+ fileTree: z.ZodArray<z.ZodType<import("../util/file").FileTreeNode, z.ZodTypeDef, import("../util/file").FileTreeNode>, "many">;
2362
+ fileTokenScores: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
2363
+ knowledgeFiles: z.ZodRecord<z.ZodString, z.ZodString>;
2364
+ userKnowledgeFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2365
+ gitChanges: z.ZodObject<{
2366
+ status: z.ZodString;
2367
+ diff: z.ZodString;
2368
+ diffCached: z.ZodString;
2369
+ lastCommitMessages: z.ZodString;
2370
+ }, "strip", z.ZodTypeAny, {
2371
+ status: string;
2372
+ diff: string;
2373
+ diffCached: string;
2374
+ lastCommitMessages: string;
2375
+ }, {
2376
+ status: string;
2377
+ diff: string;
2378
+ diffCached: string;
2379
+ lastCommitMessages: string;
2380
+ }>;
2381
+ changesSinceLastChat: z.ZodRecord<z.ZodString, z.ZodString>;
2382
+ shellConfigFiles: z.ZodRecord<z.ZodString, z.ZodString>;
2383
+ systemInfo: z.ZodObject<{
2384
+ platform: z.ZodString;
2385
+ shell: z.ZodString;
2386
+ nodeVersion: z.ZodString;
2387
+ arch: z.ZodString;
2388
+ homedir: z.ZodString;
2389
+ cpus: z.ZodNumber;
2390
+ }, "strip", z.ZodTypeAny, {
2391
+ platform: string;
2392
+ shell: string;
2393
+ nodeVersion: string;
2394
+ arch: string;
2395
+ homedir: string;
2396
+ cpus: number;
2397
+ }, {
2398
+ platform: string;
2399
+ shell: string;
2400
+ nodeVersion: string;
2401
+ arch: string;
2402
+ homedir: string;
2403
+ cpus: number;
2404
+ }>;
2405
+ fileVersions: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodObject<{
2406
+ path: z.ZodString;
2407
+ content: z.ZodString;
2408
+ }, "strip", z.ZodTypeAny, {
2409
+ path: string;
2410
+ content: string;
2411
+ }, {
2412
+ path: string;
2413
+ content: string;
2414
+ }>, "many">, "many">>;
2415
+ }, "strip", z.ZodTypeAny, {
2416
+ currentWorkingDirectory: string;
2417
+ fileTree: import("../util/file").FileTreeNode[];
2418
+ fileTokenScores: Record<string, Record<string, number>>;
2419
+ knowledgeFiles: Record<string, string>;
2420
+ gitChanges: {
2421
+ status: string;
2422
+ diff: string;
2423
+ diffCached: string;
2424
+ lastCommitMessages: string;
2425
+ };
2426
+ changesSinceLastChat: Record<string, string>;
2427
+ shellConfigFiles: Record<string, string>;
2428
+ systemInfo: {
2429
+ platform: string;
2430
+ shell: string;
2431
+ nodeVersion: string;
2432
+ arch: string;
2433
+ homedir: string;
2434
+ cpus: number;
2435
+ };
2436
+ userKnowledgeFiles?: Record<string, string> | undefined;
2437
+ fileVersions?: {
2438
+ path: string;
2439
+ content: string;
2440
+ }[][] | undefined;
2441
+ }, {
2442
+ currentWorkingDirectory: string;
2443
+ fileTree: import("../util/file").FileTreeNode[];
2444
+ fileTokenScores: Record<string, Record<string, number>>;
2445
+ knowledgeFiles: Record<string, string>;
2446
+ gitChanges: {
2447
+ status: string;
2448
+ diff: string;
2449
+ diffCached: string;
2450
+ lastCommitMessages: string;
2451
+ };
2452
+ changesSinceLastChat: Record<string, string>;
2453
+ shellConfigFiles: Record<string, string>;
2454
+ systemInfo: {
2455
+ platform: string;
2456
+ shell: string;
2457
+ nodeVersion: string;
2458
+ arch: string;
2459
+ homedir: string;
2460
+ cpus: number;
2461
+ };
2462
+ userKnowledgeFiles?: Record<string, string> | undefined;
2463
+ fileVersions?: {
2464
+ path: string;
2465
+ content: string;
2466
+ }[][] | undefined;
2467
+ }>;
2468
+ messageHistory: z.ZodArray<z.ZodObject<{
2469
+ role: z.ZodUnion<[z.ZodLiteral<"user">, z.ZodLiteral<"assistant">]>;
2470
+ content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{
2471
+ type: z.ZodLiteral<"text">;
2472
+ text: z.ZodString;
2473
+ cache_control: z.ZodOptional<z.ZodObject<{
2474
+ type: z.ZodLiteral<"ephemeral">;
2475
+ }, "strip", z.ZodTypeAny, {
2476
+ type: "ephemeral";
2477
+ }, {
2478
+ type: "ephemeral";
2479
+ }>>;
2480
+ }, "strip", z.ZodTypeAny, {
2481
+ type: "text";
2482
+ text: string;
2483
+ cache_control?: {
2484
+ type: "ephemeral";
2485
+ } | undefined;
2486
+ }, {
2487
+ type: "text";
2488
+ text: string;
2489
+ cache_control?: {
2490
+ type: "ephemeral";
2491
+ } | undefined;
2492
+ }>, z.ZodObject<{
2493
+ type: z.ZodLiteral<"tool_use">;
2494
+ id: z.ZodString;
2495
+ name: z.ZodString;
2496
+ input: z.ZodRecord<z.ZodString, z.ZodAny>;
2497
+ cache_control: z.ZodOptional<z.ZodObject<{
2498
+ type: z.ZodLiteral<"ephemeral">;
2499
+ }, "strip", z.ZodTypeAny, {
2500
+ type: "ephemeral";
2501
+ }, {
2502
+ type: "ephemeral";
2503
+ }>>;
2504
+ }, "strip", z.ZodTypeAny, {
2505
+ type: "tool_use";
2506
+ name: string;
2507
+ id: string;
2508
+ input: Record<string, any>;
2509
+ cache_control?: {
2510
+ type: "ephemeral";
2511
+ } | undefined;
2512
+ }, {
2513
+ type: "tool_use";
2514
+ name: string;
2515
+ id: string;
2516
+ input: Record<string, any>;
2517
+ cache_control?: {
2518
+ type: "ephemeral";
2519
+ } | undefined;
2520
+ }>, z.ZodObject<{
2521
+ type: z.ZodLiteral<"tool_result">;
2522
+ tool_use_id: z.ZodString;
2523
+ content: z.ZodString;
2524
+ cache_control: z.ZodOptional<z.ZodObject<{
2525
+ type: z.ZodLiteral<"ephemeral">;
2526
+ }, "strip", z.ZodTypeAny, {
2527
+ type: "ephemeral";
2528
+ }, {
2529
+ type: "ephemeral";
2530
+ }>>;
2531
+ }, "strip", z.ZodTypeAny, {
2532
+ type: "tool_result";
2533
+ content: string;
2534
+ tool_use_id: string;
2535
+ cache_control?: {
2536
+ type: "ephemeral";
2537
+ } | undefined;
2538
+ }, {
2539
+ type: "tool_result";
2540
+ content: string;
2541
+ tool_use_id: string;
2542
+ cache_control?: {
2543
+ type: "ephemeral";
2544
+ } | undefined;
2545
+ }>, z.ZodObject<{
2546
+ type: z.ZodLiteral<"image">;
2547
+ source: z.ZodObject<{
2548
+ type: z.ZodLiteral<"base64">;
2549
+ media_type: z.ZodLiteral<"image/jpeg">;
2550
+ data: z.ZodString;
2551
+ }, "strip", z.ZodTypeAny, {
2552
+ type: "base64";
2553
+ media_type: "image/jpeg";
2554
+ data: string;
2555
+ }, {
2556
+ type: "base64";
2557
+ media_type: "image/jpeg";
2558
+ data: string;
2559
+ }>;
2560
+ cache_control: z.ZodOptional<z.ZodObject<{
2561
+ type: z.ZodLiteral<"ephemeral">;
2562
+ }, "strip", z.ZodTypeAny, {
2563
+ type: "ephemeral";
2564
+ }, {
2565
+ type: "ephemeral";
2566
+ }>>;
2567
+ }, "strip", z.ZodTypeAny, {
2568
+ type: "image";
2569
+ source: {
2570
+ type: "base64";
2571
+ media_type: "image/jpeg";
2572
+ data: string;
2573
+ };
2574
+ cache_control?: {
2575
+ type: "ephemeral";
2576
+ } | undefined;
2577
+ }, {
2578
+ type: "image";
2579
+ source: {
2580
+ type: "base64";
2581
+ media_type: "image/jpeg";
2582
+ data: string;
2583
+ };
2584
+ cache_control?: {
2585
+ type: "ephemeral";
2586
+ } | undefined;
2587
+ }>]>, "many">]>;
2588
+ }, "strip", z.ZodTypeAny, {
2589
+ content: string | ({
2590
+ type: "text";
2591
+ text: string;
2592
+ cache_control?: {
2593
+ type: "ephemeral";
2594
+ } | undefined;
2595
+ } | {
2596
+ type: "tool_use";
2597
+ name: string;
2598
+ id: string;
2599
+ input: Record<string, any>;
2600
+ cache_control?: {
2601
+ type: "ephemeral";
2602
+ } | undefined;
2603
+ } | {
2604
+ type: "tool_result";
2605
+ content: string;
2606
+ tool_use_id: string;
2607
+ cache_control?: {
2608
+ type: "ephemeral";
2609
+ } | undefined;
2610
+ } | {
2611
+ type: "image";
2612
+ source: {
2613
+ type: "base64";
2614
+ media_type: "image/jpeg";
2615
+ data: string;
2616
+ };
2617
+ cache_control?: {
2618
+ type: "ephemeral";
2619
+ } | undefined;
2620
+ })[];
2621
+ role: "user" | "assistant";
2622
+ }, {
2623
+ content: string | ({
2624
+ type: "text";
2625
+ text: string;
2626
+ cache_control?: {
2627
+ type: "ephemeral";
2628
+ } | undefined;
2629
+ } | {
2630
+ type: "tool_use";
2631
+ name: string;
2632
+ id: string;
2633
+ input: Record<string, any>;
2634
+ cache_control?: {
2635
+ type: "ephemeral";
2636
+ } | undefined;
2637
+ } | {
2638
+ type: "tool_result";
2639
+ content: string;
2640
+ tool_use_id: string;
2641
+ cache_control?: {
2642
+ type: "ephemeral";
2643
+ } | undefined;
2644
+ } | {
2645
+ type: "image";
2646
+ source: {
2647
+ type: "base64";
2648
+ media_type: "image/jpeg";
2649
+ data: string;
2650
+ };
2651
+ cache_control?: {
2652
+ type: "ephemeral";
2653
+ } | undefined;
2654
+ })[];
2655
+ role: "user" | "assistant";
2656
+ }>, "many">;
2657
+ consecutiveAssistantMessages: z.ZodOptional<z.ZodNumber>;
2658
+ }, "strip", z.ZodTypeAny, {
2659
+ agentContext: string;
2660
+ fileContext: {
2661
+ currentWorkingDirectory: string;
2662
+ fileTree: import("../util/file").FileTreeNode[];
2663
+ fileTokenScores: Record<string, Record<string, number>>;
2664
+ knowledgeFiles: Record<string, string>;
2665
+ gitChanges: {
2666
+ status: string;
2667
+ diff: string;
2668
+ diffCached: string;
2669
+ lastCommitMessages: string;
2670
+ };
2671
+ changesSinceLastChat: Record<string, string>;
2672
+ shellConfigFiles: Record<string, string>;
2673
+ systemInfo: {
2674
+ platform: string;
2675
+ shell: string;
2676
+ nodeVersion: string;
2677
+ arch: string;
2678
+ homedir: string;
2679
+ cpus: number;
2680
+ };
2681
+ userKnowledgeFiles?: Record<string, string> | undefined;
2682
+ fileVersions?: {
2683
+ path: string;
2684
+ content: string;
2685
+ }[][] | undefined;
2686
+ };
2687
+ messageHistory: {
2688
+ content: string | ({
2689
+ type: "text";
2690
+ text: string;
2691
+ cache_control?: {
2692
+ type: "ephemeral";
2693
+ } | undefined;
2694
+ } | {
2695
+ type: "tool_use";
2696
+ name: string;
2697
+ id: string;
2698
+ input: Record<string, any>;
2699
+ cache_control?: {
2700
+ type: "ephemeral";
2701
+ } | undefined;
2702
+ } | {
2703
+ type: "tool_result";
2704
+ content: string;
2705
+ tool_use_id: string;
2706
+ cache_control?: {
2707
+ type: "ephemeral";
2708
+ } | undefined;
2709
+ } | {
2710
+ type: "image";
2711
+ source: {
2712
+ type: "base64";
2713
+ media_type: "image/jpeg";
2714
+ data: string;
2715
+ };
2716
+ cache_control?: {
2717
+ type: "ephemeral";
2718
+ } | undefined;
2719
+ })[];
2720
+ role: "user" | "assistant";
2721
+ }[];
2722
+ consecutiveAssistantMessages?: number | undefined;
2723
+ }, {
2724
+ agentContext: string;
2725
+ fileContext: {
2726
+ currentWorkingDirectory: string;
2727
+ fileTree: import("../util/file").FileTreeNode[];
2728
+ fileTokenScores: Record<string, Record<string, number>>;
2729
+ knowledgeFiles: Record<string, string>;
2730
+ gitChanges: {
2731
+ status: string;
2732
+ diff: string;
2733
+ diffCached: string;
2734
+ lastCommitMessages: string;
2735
+ };
2736
+ changesSinceLastChat: Record<string, string>;
2737
+ shellConfigFiles: Record<string, string>;
2738
+ systemInfo: {
2739
+ platform: string;
2740
+ shell: string;
2741
+ nodeVersion: string;
2742
+ arch: string;
2743
+ homedir: string;
2744
+ cpus: number;
2745
+ };
2746
+ userKnowledgeFiles?: Record<string, string> | undefined;
2747
+ fileVersions?: {
2748
+ path: string;
2749
+ content: string;
2750
+ }[][] | undefined;
2751
+ };
2752
+ messageHistory: {
2753
+ content: string | ({
2754
+ type: "text";
2755
+ text: string;
2756
+ cache_control?: {
2757
+ type: "ephemeral";
2758
+ } | undefined;
2759
+ } | {
2760
+ type: "tool_use";
2761
+ name: string;
2762
+ id: string;
2763
+ input: Record<string, any>;
2764
+ cache_control?: {
2765
+ type: "ephemeral";
2766
+ } | undefined;
2767
+ } | {
2768
+ type: "tool_result";
2769
+ content: string;
2770
+ tool_use_id: string;
2771
+ cache_control?: {
2772
+ type: "ephemeral";
2773
+ } | undefined;
2774
+ } | {
2775
+ type: "image";
2776
+ source: {
2777
+ type: "base64";
2778
+ media_type: "image/jpeg";
2779
+ data: string;
2780
+ };
2781
+ cache_control?: {
2782
+ type: "ephemeral";
2783
+ } | undefined;
2784
+ })[];
2785
+ role: "user" | "assistant";
2786
+ }[];
2787
+ consecutiveAssistantMessages?: number | undefined;
2788
+ }>;
2789
+ toolCalls: z.ZodArray<z.ZodObject<{
2790
+ name: z.ZodString;
2791
+ parameters: z.ZodRecord<z.ZodString, z.ZodString>;
2792
+ id: z.ZodString;
2793
+ }, "strip", z.ZodTypeAny, {
2794
+ name: string;
2795
+ id: string;
2796
+ parameters: Record<string, string>;
2797
+ }, {
2798
+ name: string;
2799
+ id: string;
2800
+ parameters: Record<string, string>;
2801
+ }>, "many">;
2802
+ toolResults: z.ZodArray<z.ZodObject<{
2803
+ name: z.ZodString;
2804
+ result: z.ZodString;
2805
+ id: z.ZodString;
2806
+ }, "strip", z.ZodTypeAny, {
2807
+ name: string;
2808
+ id: string;
2809
+ result: string;
2810
+ }, {
2811
+ name: string;
2812
+ id: string;
2813
+ result: string;
2814
+ }>, "many">;
2815
+ }, "strip", z.ZodTypeAny, {
2816
+ type: "prompt-response";
2817
+ promptId: string;
2818
+ agentState: {
2819
+ agentContext: string;
2820
+ fileContext: {
2821
+ currentWorkingDirectory: string;
2822
+ fileTree: import("../util/file").FileTreeNode[];
2823
+ fileTokenScores: Record<string, Record<string, number>>;
2824
+ knowledgeFiles: Record<string, string>;
2825
+ gitChanges: {
2826
+ status: string;
2827
+ diff: string;
2828
+ diffCached: string;
2829
+ lastCommitMessages: string;
2830
+ };
2831
+ changesSinceLastChat: Record<string, string>;
2832
+ shellConfigFiles: Record<string, string>;
2833
+ systemInfo: {
2834
+ platform: string;
2835
+ shell: string;
2836
+ nodeVersion: string;
2837
+ arch: string;
2838
+ homedir: string;
2839
+ cpus: number;
2840
+ };
2841
+ userKnowledgeFiles?: Record<string, string> | undefined;
2842
+ fileVersions?: {
2843
+ path: string;
2844
+ content: string;
2845
+ }[][] | undefined;
2846
+ };
2847
+ messageHistory: {
2848
+ content: string | ({
2849
+ type: "text";
2850
+ text: string;
2851
+ cache_control?: {
2852
+ type: "ephemeral";
2853
+ } | undefined;
2854
+ } | {
2855
+ type: "tool_use";
2856
+ name: string;
2857
+ id: string;
2858
+ input: Record<string, any>;
2859
+ cache_control?: {
2860
+ type: "ephemeral";
2861
+ } | undefined;
2862
+ } | {
2863
+ type: "tool_result";
2864
+ content: string;
2865
+ tool_use_id: string;
2866
+ cache_control?: {
2867
+ type: "ephemeral";
2868
+ } | undefined;
2869
+ } | {
2870
+ type: "image";
2871
+ source: {
2872
+ type: "base64";
2873
+ media_type: "image/jpeg";
2874
+ data: string;
2875
+ };
2876
+ cache_control?: {
2877
+ type: "ephemeral";
2878
+ } | undefined;
2879
+ })[];
2880
+ role: "user" | "assistant";
2881
+ }[];
2882
+ consecutiveAssistantMessages?: number | undefined;
2883
+ };
2884
+ toolResults: {
2885
+ name: string;
2886
+ id: string;
2887
+ result: string;
2888
+ }[];
2889
+ toolCalls: {
2890
+ name: string;
2891
+ id: string;
2892
+ parameters: Record<string, string>;
2893
+ }[];
2894
+ }, {
2895
+ type: "prompt-response";
2896
+ promptId: string;
2897
+ agentState: {
2898
+ agentContext: string;
2899
+ fileContext: {
2900
+ currentWorkingDirectory: string;
2901
+ fileTree: import("../util/file").FileTreeNode[];
2902
+ fileTokenScores: Record<string, Record<string, number>>;
2903
+ knowledgeFiles: Record<string, string>;
2904
+ gitChanges: {
2905
+ status: string;
2906
+ diff: string;
2907
+ diffCached: string;
2908
+ lastCommitMessages: string;
2909
+ };
2910
+ changesSinceLastChat: Record<string, string>;
2911
+ shellConfigFiles: Record<string, string>;
2912
+ systemInfo: {
2913
+ platform: string;
2914
+ shell: string;
2915
+ nodeVersion: string;
2916
+ arch: string;
2917
+ homedir: string;
2918
+ cpus: number;
2919
+ };
2920
+ userKnowledgeFiles?: Record<string, string> | undefined;
2921
+ fileVersions?: {
2922
+ path: string;
2923
+ content: string;
2924
+ }[][] | undefined;
2925
+ };
2926
+ messageHistory: {
2927
+ content: string | ({
2928
+ type: "text";
2929
+ text: string;
2930
+ cache_control?: {
2931
+ type: "ephemeral";
2932
+ } | undefined;
2933
+ } | {
2934
+ type: "tool_use";
2935
+ name: string;
2936
+ id: string;
2937
+ input: Record<string, any>;
2938
+ cache_control?: {
2939
+ type: "ephemeral";
2940
+ } | undefined;
2941
+ } | {
2942
+ type: "tool_result";
2943
+ content: string;
2944
+ tool_use_id: string;
2945
+ cache_control?: {
2946
+ type: "ephemeral";
2947
+ } | undefined;
2948
+ } | {
2949
+ type: "image";
2950
+ source: {
2951
+ type: "base64";
2952
+ media_type: "image/jpeg";
2953
+ data: string;
2954
+ };
2955
+ cache_control?: {
2956
+ type: "ephemeral";
2957
+ } | undefined;
2958
+ })[];
2959
+ role: "user" | "assistant";
2960
+ }[];
2961
+ consecutiveAssistantMessages?: number | undefined;
2962
+ };
2963
+ toolResults: {
2964
+ name: string;
2965
+ id: string;
2966
+ result: string;
2967
+ }[];
2968
+ toolCalls: {
2969
+ name: string;
2970
+ id: string;
2971
+ parameters: Record<string, string>;
2972
+ }[];
2973
+ }>, z.ZodObject<{
2974
+ type: z.ZodLiteral<"read-files">;
2975
+ filePaths: z.ZodArray<z.ZodString, "many">;
2976
+ requestId: z.ZodString;
2977
+ }, "strip", z.ZodTypeAny, {
2978
+ type: "read-files";
2979
+ requestId: string;
2980
+ filePaths: string[];
2981
+ }, {
2982
+ type: "read-files";
2983
+ requestId: string;
2984
+ filePaths: string[];
2985
+ }>, z.ZodObject<{
2986
+ type: z.ZodLiteral<"tool-call">;
2987
+ userInputId: z.ZodString;
2988
+ response: z.ZodString;
2989
+ data: z.ZodObject<{
2990
+ name: z.ZodString;
2991
+ id: z.ZodString;
2992
+ input: z.ZodRecord<z.ZodString, z.ZodAny>;
2993
+ }, "strip", z.ZodTypeAny, {
2994
+ name: string;
2995
+ id: string;
2996
+ input: Record<string, any>;
2997
+ }, {
2998
+ name: string;
2999
+ id: string;
3000
+ input: Record<string, any>;
3001
+ }>;
3002
+ changes: z.ZodArray<z.ZodObject<{
3003
+ type: z.ZodEnum<["patch", "file"]>;
3004
+ path: z.ZodString;
3005
+ content: z.ZodString;
3006
+ }, "strip", z.ZodTypeAny, {
3007
+ path: string;
3008
+ type: "file" | "patch";
3009
+ content: string;
3010
+ }, {
3011
+ path: string;
3012
+ type: "file" | "patch";
3013
+ content: string;
3014
+ }>, "many">;
3015
+ changesAlreadyApplied: z.ZodArray<z.ZodObject<{
3016
+ type: z.ZodEnum<["patch", "file"]>;
3017
+ path: z.ZodString;
3018
+ content: z.ZodString;
3019
+ }, "strip", z.ZodTypeAny, {
3020
+ path: string;
3021
+ type: "file" | "patch";
3022
+ content: string;
3023
+ }, {
3024
+ path: string;
3025
+ type: "file" | "patch";
3026
+ content: string;
3027
+ }>, "many">;
3028
+ addedFileVersions: z.ZodArray<z.ZodObject<{
3029
+ path: z.ZodString;
3030
+ content: z.ZodString;
3031
+ }, "strip", z.ZodTypeAny, {
3032
+ path: string;
3033
+ content: string;
3034
+ }, {
3035
+ path: string;
3036
+ content: string;
3037
+ }>, "many">;
3038
+ resetFileVersions: z.ZodBoolean;
3039
+ }, "strip", z.ZodTypeAny, {
3040
+ type: "tool-call";
3041
+ data: {
3042
+ name: string;
3043
+ id: string;
3044
+ input: Record<string, any>;
3045
+ };
3046
+ userInputId: string;
3047
+ response: string;
3048
+ changes: {
3049
+ path: string;
3050
+ type: "file" | "patch";
3051
+ content: string;
3052
+ }[];
3053
+ changesAlreadyApplied: {
3054
+ path: string;
3055
+ type: "file" | "patch";
3056
+ content: string;
3057
+ }[];
3058
+ addedFileVersions: {
3059
+ path: string;
3060
+ content: string;
3061
+ }[];
3062
+ resetFileVersions: boolean;
3063
+ }, {
3064
+ type: "tool-call";
3065
+ data: {
3066
+ name: string;
3067
+ id: string;
3068
+ input: Record<string, any>;
3069
+ };
3070
+ userInputId: string;
3071
+ response: string;
3072
+ changes: {
3073
+ path: string;
3074
+ type: "file" | "patch";
3075
+ content: string;
3076
+ }[];
3077
+ changesAlreadyApplied: {
3078
+ path: string;
3079
+ type: "file" | "patch";
3080
+ content: string;
3081
+ }[];
3082
+ addedFileVersions: {
3083
+ path: string;
3084
+ content: string;
3085
+ }[];
3086
+ resetFileVersions: boolean;
3087
+ }>, z.ZodObject<{
3088
+ type: z.ZodLiteral<"terminal-command-result">;
3089
+ userInputId: z.ZodString;
3090
+ result: z.ZodString;
3091
+ }, "strip", z.ZodTypeAny, {
3092
+ type: "terminal-command-result";
3093
+ result: string;
3094
+ userInputId: string;
3095
+ }, {
3096
+ type: "terminal-command-result";
3097
+ result: string;
3098
+ userInputId: string;
3099
+ }>, z.ZodObject<{
3100
+ type: z.ZodLiteral<"npm-version-status">;
3101
+ isUpToDate: z.ZodBoolean;
3102
+ latestVersion: z.ZodString;
3103
+ }, "strip", z.ZodTypeAny, {
3104
+ type: "npm-version-status";
3105
+ isUpToDate: boolean;
3106
+ latestVersion: string;
3107
+ }, {
3108
+ type: "npm-version-status";
3109
+ isUpToDate: boolean;
3110
+ latestVersion: string;
3111
+ }>, z.ZodObject<z.objectUtil.extendShape<{
3112
+ type: z.ZodLiteral<"init-response">;
3113
+ }, Omit<{
3114
+ type: z.ZodLiteral<"usage-response">;
3115
+ usage: z.ZodNumber;
3116
+ remainingBalance: z.ZodNumber;
3117
+ balanceBreakdown: z.ZodOptional<z.ZodRecord<z.ZodEnum<[import("../types/grant").GrantType, ...import("../types/grant").GrantType[]]>, z.ZodNumber>>;
3118
+ next_quota_reset: z.ZodNullable<z.ZodDate>;
3119
+ autoTopupAdded: z.ZodOptional<z.ZodNumber>;
3120
+ }, "type">>, "strip", z.ZodTypeAny, {
3121
+ type: "init-response";
3122
+ usage: number;
3123
+ remainingBalance: number;
3124
+ next_quota_reset: Date | null;
3125
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
3126
+ autoTopupAdded?: number | undefined;
3127
+ }, {
3128
+ type: "init-response";
3129
+ usage: number;
3130
+ remainingBalance: number;
3131
+ next_quota_reset: Date | null;
3132
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
3133
+ autoTopupAdded?: number | undefined;
3134
+ }>, z.ZodObject<{
3135
+ type: z.ZodLiteral<"usage-response">;
3136
+ usage: z.ZodNumber;
3137
+ remainingBalance: z.ZodNumber;
3138
+ balanceBreakdown: z.ZodOptional<z.ZodRecord<z.ZodEnum<[import("../types/grant").GrantType, ...import("../types/grant").GrantType[]]>, z.ZodNumber>>;
3139
+ next_quota_reset: z.ZodNullable<z.ZodDate>;
3140
+ autoTopupAdded: z.ZodOptional<z.ZodNumber>;
3141
+ }, "strip", z.ZodTypeAny, {
3142
+ type: "usage-response";
3143
+ usage: number;
3144
+ remainingBalance: number;
3145
+ next_quota_reset: Date | null;
3146
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
3147
+ autoTopupAdded?: number | undefined;
3148
+ }, {
3149
+ type: "usage-response";
3150
+ usage: number;
3151
+ remainingBalance: number;
3152
+ next_quota_reset: Date | null;
3153
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
3154
+ autoTopupAdded?: number | undefined;
3155
+ }>, z.ZodObject<{
3156
+ type: z.ZodLiteral<"message-cost-response">;
3157
+ promptId: z.ZodString;
3158
+ credits: z.ZodNumber;
3159
+ }, "strip", z.ZodTypeAny, {
3160
+ type: "message-cost-response";
3161
+ promptId: string;
3162
+ credits: number;
3163
+ }, {
3164
+ type: "message-cost-response";
3165
+ promptId: string;
3166
+ credits: number;
3167
+ }>, z.ZodObject<{
3168
+ type: z.ZodLiteral<"action-error">;
3169
+ message: z.ZodString;
3170
+ error: z.ZodOptional<z.ZodString>;
3171
+ remainingBalance: z.ZodOptional<z.ZodNumber>;
3172
+ }, "strip", z.ZodTypeAny, {
3173
+ message: string;
3174
+ type: "action-error";
3175
+ remainingBalance?: number | undefined;
3176
+ error?: string | undefined;
3177
+ }, {
3178
+ message: string;
3179
+ type: "action-error";
3180
+ remainingBalance?: number | undefined;
3181
+ error?: string | undefined;
3182
+ }>, z.ZodObject<{
3183
+ type: z.ZodLiteral<"commit-message-response">;
3184
+ commitMessage: z.ZodString;
3185
+ }, "strip", z.ZodTypeAny, {
3186
+ type: "commit-message-response";
3187
+ commitMessage: string;
3188
+ }, {
3189
+ type: "commit-message-response";
3190
+ commitMessage: string;
3191
+ }>, z.ZodObject<{
3192
+ type: z.ZodLiteral<"request-reconnect">;
3193
+ }, "strip", z.ZodTypeAny, {
3194
+ type: "request-reconnect";
3195
+ }, {
3196
+ type: "request-reconnect";
3197
+ }>]>;
3198
+ }, "strip", z.ZodTypeAny, {
3199
+ type: "action";
3200
+ data: {
3201
+ type: "usage-response";
3202
+ usage: number;
3203
+ remainingBalance: number;
3204
+ next_quota_reset: Date | null;
3205
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
3206
+ autoTopupAdded?: number | undefined;
3207
+ } | {
3208
+ type: "init-response";
3209
+ usage: number;
3210
+ remainingBalance: number;
3211
+ next_quota_reset: Date | null;
3212
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
3213
+ autoTopupAdded?: number | undefined;
3214
+ } | {
3215
+ type: "response-complete";
3216
+ userInputId: string;
3217
+ response: string;
3218
+ changes: {
3219
+ path: string;
3220
+ type: "file" | "patch";
3221
+ content: string;
3222
+ }[];
3223
+ changesAlreadyApplied: {
3224
+ path: string;
3225
+ type: "file" | "patch";
3226
+ content: string;
3227
+ }[];
3228
+ addedFileVersions: {
3229
+ path: string;
3230
+ content: string;
3231
+ }[];
3232
+ resetFileVersions: boolean;
3233
+ usage?: number | undefined;
3234
+ remainingBalance?: number | undefined;
3235
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
3236
+ next_quota_reset?: Date | null | undefined;
3237
+ autoTopupAdded?: number | undefined;
3238
+ } | {
3239
+ type: "message-cost-response";
3240
+ promptId: string;
3241
+ credits: number;
3242
+ } | {
3243
+ type: "prompt-response";
3244
+ promptId: string;
3245
+ agentState: {
3246
+ agentContext: string;
3247
+ fileContext: {
3248
+ currentWorkingDirectory: string;
3249
+ fileTree: import("../util/file").FileTreeNode[];
3250
+ fileTokenScores: Record<string, Record<string, number>>;
3251
+ knowledgeFiles: Record<string, string>;
3252
+ gitChanges: {
3253
+ status: string;
3254
+ diff: string;
3255
+ diffCached: string;
3256
+ lastCommitMessages: string;
3257
+ };
3258
+ changesSinceLastChat: Record<string, string>;
3259
+ shellConfigFiles: Record<string, string>;
3260
+ systemInfo: {
3261
+ platform: string;
3262
+ shell: string;
3263
+ nodeVersion: string;
3264
+ arch: string;
3265
+ homedir: string;
3266
+ cpus: number;
3267
+ };
3268
+ userKnowledgeFiles?: Record<string, string> | undefined;
3269
+ fileVersions?: {
3270
+ path: string;
3271
+ content: string;
3272
+ }[][] | undefined;
3273
+ };
3274
+ messageHistory: {
3275
+ content: string | ({
3276
+ type: "text";
3277
+ text: string;
3278
+ cache_control?: {
3279
+ type: "ephemeral";
3280
+ } | undefined;
3281
+ } | {
3282
+ type: "tool_use";
3283
+ name: string;
3284
+ id: string;
3285
+ input: Record<string, any>;
3286
+ cache_control?: {
3287
+ type: "ephemeral";
3288
+ } | undefined;
3289
+ } | {
3290
+ type: "tool_result";
3291
+ content: string;
3292
+ tool_use_id: string;
3293
+ cache_control?: {
3294
+ type: "ephemeral";
3295
+ } | undefined;
3296
+ } | {
3297
+ type: "image";
3298
+ source: {
3299
+ type: "base64";
3300
+ media_type: "image/jpeg";
3301
+ data: string;
3302
+ };
3303
+ cache_control?: {
3304
+ type: "ephemeral";
3305
+ } | undefined;
3306
+ })[];
3307
+ role: "user" | "assistant";
3308
+ }[];
3309
+ consecutiveAssistantMessages?: number | undefined;
3310
+ };
3311
+ toolResults: {
3312
+ name: string;
3313
+ id: string;
3314
+ result: string;
3315
+ }[];
3316
+ toolCalls: {
3317
+ name: string;
3318
+ id: string;
3319
+ parameters: Record<string, string>;
3320
+ }[];
3321
+ } | {
3322
+ type: "response-chunk";
3323
+ userInputId: string;
3324
+ chunk: string;
3325
+ } | {
3326
+ type: "read-files";
3327
+ requestId: string;
3328
+ filePaths: string[];
3329
+ } | {
3330
+ type: "tool-call";
3331
+ data: {
3332
+ name: string;
3333
+ id: string;
3334
+ input: Record<string, any>;
3335
+ };
3336
+ userInputId: string;
3337
+ response: string;
3338
+ changes: {
3339
+ path: string;
3340
+ type: "file" | "patch";
3341
+ content: string;
3342
+ }[];
3343
+ changesAlreadyApplied: {
3344
+ path: string;
3345
+ type: "file" | "patch";
3346
+ content: string;
3347
+ }[];
3348
+ addedFileVersions: {
3349
+ path: string;
3350
+ content: string;
3351
+ }[];
3352
+ resetFileVersions: boolean;
3353
+ } | {
3354
+ type: "terminal-command-result";
3355
+ result: string;
3356
+ userInputId: string;
3357
+ } | {
3358
+ type: "npm-version-status";
3359
+ isUpToDate: boolean;
3360
+ latestVersion: string;
3361
+ } | {
3362
+ message: string;
3363
+ type: "action-error";
3364
+ remainingBalance?: number | undefined;
3365
+ error?: string | undefined;
3366
+ } | {
3367
+ type: "commit-message-response";
3368
+ commitMessage: string;
3369
+ } | {
3370
+ type: "request-reconnect";
3371
+ };
3372
+ }, {
3373
+ type: "action";
3374
+ data: {
3375
+ type: "usage-response";
3376
+ usage: number;
3377
+ remainingBalance: number;
3378
+ next_quota_reset: Date | null;
3379
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
3380
+ autoTopupAdded?: number | undefined;
3381
+ } | {
3382
+ type: "init-response";
3383
+ usage: number;
3384
+ remainingBalance: number;
3385
+ next_quota_reset: Date | null;
3386
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
3387
+ autoTopupAdded?: number | undefined;
3388
+ } | {
3389
+ type: "response-complete";
3390
+ userInputId: string;
3391
+ response: string;
3392
+ changes: {
3393
+ path: string;
3394
+ type: "file" | "patch";
3395
+ content: string;
3396
+ }[];
3397
+ changesAlreadyApplied: {
3398
+ path: string;
3399
+ type: "file" | "patch";
3400
+ content: string;
3401
+ }[];
3402
+ addedFileVersions: {
3403
+ path: string;
3404
+ content: string;
3405
+ }[];
3406
+ resetFileVersions: boolean;
3407
+ usage?: number | undefined;
3408
+ remainingBalance?: number | undefined;
3409
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
3410
+ next_quota_reset?: Date | null | undefined;
3411
+ autoTopupAdded?: number | undefined;
3412
+ } | {
3413
+ type: "message-cost-response";
3414
+ promptId: string;
3415
+ credits: number;
3416
+ } | {
3417
+ type: "prompt-response";
3418
+ promptId: string;
3419
+ agentState: {
3420
+ agentContext: string;
3421
+ fileContext: {
3422
+ currentWorkingDirectory: string;
3423
+ fileTree: import("../util/file").FileTreeNode[];
3424
+ fileTokenScores: Record<string, Record<string, number>>;
3425
+ knowledgeFiles: Record<string, string>;
3426
+ gitChanges: {
3427
+ status: string;
3428
+ diff: string;
3429
+ diffCached: string;
3430
+ lastCommitMessages: string;
3431
+ };
3432
+ changesSinceLastChat: Record<string, string>;
3433
+ shellConfigFiles: Record<string, string>;
3434
+ systemInfo: {
3435
+ platform: string;
3436
+ shell: string;
3437
+ nodeVersion: string;
3438
+ arch: string;
3439
+ homedir: string;
3440
+ cpus: number;
3441
+ };
3442
+ userKnowledgeFiles?: Record<string, string> | undefined;
3443
+ fileVersions?: {
3444
+ path: string;
3445
+ content: string;
3446
+ }[][] | undefined;
3447
+ };
3448
+ messageHistory: {
3449
+ content: string | ({
3450
+ type: "text";
3451
+ text: string;
3452
+ cache_control?: {
3453
+ type: "ephemeral";
3454
+ } | undefined;
3455
+ } | {
3456
+ type: "tool_use";
3457
+ name: string;
3458
+ id: string;
3459
+ input: Record<string, any>;
3460
+ cache_control?: {
3461
+ type: "ephemeral";
3462
+ } | undefined;
3463
+ } | {
3464
+ type: "tool_result";
3465
+ content: string;
3466
+ tool_use_id: string;
3467
+ cache_control?: {
3468
+ type: "ephemeral";
3469
+ } | undefined;
3470
+ } | {
3471
+ type: "image";
3472
+ source: {
3473
+ type: "base64";
3474
+ media_type: "image/jpeg";
3475
+ data: string;
3476
+ };
3477
+ cache_control?: {
3478
+ type: "ephemeral";
3479
+ } | undefined;
3480
+ })[];
3481
+ role: "user" | "assistant";
3482
+ }[];
3483
+ consecutiveAssistantMessages?: number | undefined;
3484
+ };
3485
+ toolResults: {
3486
+ name: string;
3487
+ id: string;
3488
+ result: string;
3489
+ }[];
3490
+ toolCalls: {
3491
+ name: string;
3492
+ id: string;
3493
+ parameters: Record<string, string>;
3494
+ }[];
3495
+ } | {
3496
+ type: "response-chunk";
3497
+ userInputId: string;
3498
+ chunk: string;
3499
+ } | {
3500
+ type: "read-files";
3501
+ requestId: string;
3502
+ filePaths: string[];
3503
+ } | {
3504
+ type: "tool-call";
3505
+ data: {
3506
+ name: string;
3507
+ id: string;
3508
+ input: Record<string, any>;
3509
+ };
3510
+ userInputId: string;
3511
+ response: string;
3512
+ changes: {
3513
+ path: string;
3514
+ type: "file" | "patch";
3515
+ content: string;
3516
+ }[];
3517
+ changesAlreadyApplied: {
3518
+ path: string;
3519
+ type: "file" | "patch";
3520
+ content: string;
3521
+ }[];
3522
+ addedFileVersions: {
3523
+ path: string;
3524
+ content: string;
3525
+ }[];
3526
+ resetFileVersions: boolean;
3527
+ } | {
3528
+ type: "terminal-command-result";
3529
+ result: string;
3530
+ userInputId: string;
3531
+ } | {
3532
+ type: "npm-version-status";
3533
+ isUpToDate: boolean;
3534
+ latestVersion: string;
3535
+ } | {
3536
+ message: string;
3537
+ type: "action-error";
3538
+ remainingBalance?: number | undefined;
3539
+ error?: string | undefined;
3540
+ } | {
3541
+ type: "commit-message-response";
3542
+ commitMessage: string;
3543
+ } | {
3544
+ type: "request-reconnect";
3545
+ };
3546
+ }>;
3547
+ };
3548
+ export declare const SERVER_MESSAGE_SCHEMA: z.ZodUnion<[z.ZodObject<{
3549
+ type: z.ZodLiteral<"ack">;
3550
+ txid: z.ZodOptional<z.ZodNumber>;
3551
+ success: z.ZodBoolean;
3552
+ error: z.ZodOptional<z.ZodString>;
3553
+ }, "strip", z.ZodTypeAny, {
3554
+ type: "ack";
3555
+ success: boolean;
3556
+ error?: string | undefined;
3557
+ txid?: number | undefined;
3558
+ }, {
3559
+ type: "ack";
3560
+ success: boolean;
3561
+ error?: string | undefined;
3562
+ txid?: number | undefined;
3563
+ }>, z.ZodObject<{
3564
+ type: z.ZodLiteral<"action">;
3565
+ data: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
3566
+ type: z.ZodLiteral<"response-chunk">;
3567
+ userInputId: z.ZodString;
3568
+ chunk: z.ZodString;
3569
+ }, "strip", z.ZodTypeAny, {
3570
+ type: "response-chunk";
3571
+ userInputId: string;
3572
+ chunk: string;
3573
+ }, {
3574
+ type: "response-chunk";
3575
+ userInputId: string;
3576
+ chunk: string;
3577
+ }>, z.ZodObject<z.objectUtil.extendShape<{
3578
+ type: z.ZodLiteral<"response-complete">;
3579
+ userInputId: z.ZodString;
3580
+ response: z.ZodString;
3581
+ changes: z.ZodArray<z.ZodObject<{
3582
+ type: z.ZodEnum<["patch", "file"]>;
3583
+ path: z.ZodString;
3584
+ content: z.ZodString;
3585
+ }, "strip", z.ZodTypeAny, {
3586
+ path: string;
3587
+ type: "file" | "patch";
3588
+ content: string;
3589
+ }, {
3590
+ path: string;
3591
+ type: "file" | "patch";
3592
+ content: string;
3593
+ }>, "many">;
3594
+ changesAlreadyApplied: z.ZodArray<z.ZodObject<{
3595
+ type: z.ZodEnum<["patch", "file"]>;
3596
+ path: z.ZodString;
3597
+ content: z.ZodString;
3598
+ }, "strip", z.ZodTypeAny, {
3599
+ path: string;
3600
+ type: "file" | "patch";
3601
+ content: string;
3602
+ }, {
3603
+ path: string;
3604
+ type: "file" | "patch";
3605
+ content: string;
3606
+ }>, "many">;
3607
+ addedFileVersions: z.ZodArray<z.ZodObject<{
3608
+ path: z.ZodString;
3609
+ content: z.ZodString;
3610
+ }, "strip", z.ZodTypeAny, {
3611
+ path: string;
3612
+ content: string;
3613
+ }, {
3614
+ path: string;
3615
+ content: string;
3616
+ }>, "many">;
3617
+ resetFileVersions: z.ZodBoolean;
3618
+ }, {
3619
+ usage: z.ZodOptional<z.ZodNumber>;
3620
+ remainingBalance: z.ZodOptional<z.ZodNumber>;
3621
+ balanceBreakdown: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodEnum<[import("../types/grant").GrantType, ...import("../types/grant").GrantType[]]>, z.ZodNumber>>>;
3622
+ next_quota_reset: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
3623
+ autoTopupAdded: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
3624
+ }>, "strip", z.ZodTypeAny, {
3625
+ type: "response-complete";
3626
+ userInputId: string;
3627
+ response: string;
3628
+ changes: {
3629
+ path: string;
3630
+ type: "file" | "patch";
3631
+ content: string;
3632
+ }[];
3633
+ changesAlreadyApplied: {
3634
+ path: string;
3635
+ type: "file" | "patch";
3636
+ content: string;
3637
+ }[];
3638
+ addedFileVersions: {
3639
+ path: string;
3640
+ content: string;
3641
+ }[];
3642
+ resetFileVersions: boolean;
3643
+ usage?: number | undefined;
3644
+ remainingBalance?: number | undefined;
3645
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
3646
+ next_quota_reset?: Date | null | undefined;
3647
+ autoTopupAdded?: number | undefined;
3648
+ }, {
3649
+ type: "response-complete";
3650
+ userInputId: string;
3651
+ response: string;
3652
+ changes: {
3653
+ path: string;
3654
+ type: "file" | "patch";
3655
+ content: string;
3656
+ }[];
3657
+ changesAlreadyApplied: {
3658
+ path: string;
3659
+ type: "file" | "patch";
3660
+ content: string;
3661
+ }[];
3662
+ addedFileVersions: {
3663
+ path: string;
3664
+ content: string;
3665
+ }[];
3666
+ resetFileVersions: boolean;
3667
+ usage?: number | undefined;
3668
+ remainingBalance?: number | undefined;
3669
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
3670
+ next_quota_reset?: Date | null | undefined;
3671
+ autoTopupAdded?: number | undefined;
3672
+ }>, z.ZodObject<{
3673
+ type: z.ZodLiteral<"prompt-response">;
3674
+ promptId: z.ZodString;
3675
+ agentState: z.ZodObject<{
3676
+ agentContext: z.ZodString;
3677
+ fileContext: z.ZodObject<{
3678
+ currentWorkingDirectory: z.ZodString;
3679
+ fileTree: z.ZodArray<z.ZodType<import("../util/file").FileTreeNode, z.ZodTypeDef, import("../util/file").FileTreeNode>, "many">;
3680
+ fileTokenScores: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
3681
+ knowledgeFiles: z.ZodRecord<z.ZodString, z.ZodString>;
3682
+ userKnowledgeFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
3683
+ gitChanges: z.ZodObject<{
3684
+ status: z.ZodString;
3685
+ diff: z.ZodString;
3686
+ diffCached: z.ZodString;
3687
+ lastCommitMessages: z.ZodString;
3688
+ }, "strip", z.ZodTypeAny, {
3689
+ status: string;
3690
+ diff: string;
3691
+ diffCached: string;
3692
+ lastCommitMessages: string;
3693
+ }, {
3694
+ status: string;
3695
+ diff: string;
3696
+ diffCached: string;
3697
+ lastCommitMessages: string;
3698
+ }>;
3699
+ changesSinceLastChat: z.ZodRecord<z.ZodString, z.ZodString>;
3700
+ shellConfigFiles: z.ZodRecord<z.ZodString, z.ZodString>;
3701
+ systemInfo: z.ZodObject<{
3702
+ platform: z.ZodString;
3703
+ shell: z.ZodString;
3704
+ nodeVersion: z.ZodString;
3705
+ arch: z.ZodString;
3706
+ homedir: z.ZodString;
3707
+ cpus: z.ZodNumber;
3708
+ }, "strip", z.ZodTypeAny, {
3709
+ platform: string;
3710
+ shell: string;
3711
+ nodeVersion: string;
3712
+ arch: string;
3713
+ homedir: string;
3714
+ cpus: number;
3715
+ }, {
3716
+ platform: string;
3717
+ shell: string;
3718
+ nodeVersion: string;
3719
+ arch: string;
3720
+ homedir: string;
3721
+ cpus: number;
3722
+ }>;
3723
+ fileVersions: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodObject<{
3724
+ path: z.ZodString;
3725
+ content: z.ZodString;
3726
+ }, "strip", z.ZodTypeAny, {
3727
+ path: string;
3728
+ content: string;
3729
+ }, {
3730
+ path: string;
3731
+ content: string;
3732
+ }>, "many">, "many">>;
3733
+ }, "strip", z.ZodTypeAny, {
3734
+ currentWorkingDirectory: string;
3735
+ fileTree: import("../util/file").FileTreeNode[];
3736
+ fileTokenScores: Record<string, Record<string, number>>;
3737
+ knowledgeFiles: Record<string, string>;
3738
+ gitChanges: {
3739
+ status: string;
3740
+ diff: string;
3741
+ diffCached: string;
3742
+ lastCommitMessages: string;
3743
+ };
3744
+ changesSinceLastChat: Record<string, string>;
3745
+ shellConfigFiles: Record<string, string>;
3746
+ systemInfo: {
3747
+ platform: string;
3748
+ shell: string;
3749
+ nodeVersion: string;
3750
+ arch: string;
3751
+ homedir: string;
3752
+ cpus: number;
3753
+ };
3754
+ userKnowledgeFiles?: Record<string, string> | undefined;
3755
+ fileVersions?: {
3756
+ path: string;
3757
+ content: string;
3758
+ }[][] | undefined;
3759
+ }, {
3760
+ currentWorkingDirectory: string;
3761
+ fileTree: import("../util/file").FileTreeNode[];
3762
+ fileTokenScores: Record<string, Record<string, number>>;
3763
+ knowledgeFiles: Record<string, string>;
3764
+ gitChanges: {
3765
+ status: string;
3766
+ diff: string;
3767
+ diffCached: string;
3768
+ lastCommitMessages: string;
3769
+ };
3770
+ changesSinceLastChat: Record<string, string>;
3771
+ shellConfigFiles: Record<string, string>;
3772
+ systemInfo: {
3773
+ platform: string;
3774
+ shell: string;
3775
+ nodeVersion: string;
3776
+ arch: string;
3777
+ homedir: string;
3778
+ cpus: number;
3779
+ };
3780
+ userKnowledgeFiles?: Record<string, string> | undefined;
3781
+ fileVersions?: {
3782
+ path: string;
3783
+ content: string;
3784
+ }[][] | undefined;
3785
+ }>;
3786
+ messageHistory: z.ZodArray<z.ZodObject<{
3787
+ role: z.ZodUnion<[z.ZodLiteral<"user">, z.ZodLiteral<"assistant">]>;
3788
+ content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{
3789
+ type: z.ZodLiteral<"text">;
3790
+ text: z.ZodString;
3791
+ cache_control: z.ZodOptional<z.ZodObject<{
3792
+ type: z.ZodLiteral<"ephemeral">;
3793
+ }, "strip", z.ZodTypeAny, {
3794
+ type: "ephemeral";
3795
+ }, {
3796
+ type: "ephemeral";
3797
+ }>>;
3798
+ }, "strip", z.ZodTypeAny, {
3799
+ type: "text";
3800
+ text: string;
3801
+ cache_control?: {
3802
+ type: "ephemeral";
3803
+ } | undefined;
3804
+ }, {
3805
+ type: "text";
3806
+ text: string;
3807
+ cache_control?: {
3808
+ type: "ephemeral";
3809
+ } | undefined;
3810
+ }>, z.ZodObject<{
3811
+ type: z.ZodLiteral<"tool_use">;
3812
+ id: z.ZodString;
3813
+ name: z.ZodString;
3814
+ input: z.ZodRecord<z.ZodString, z.ZodAny>;
3815
+ cache_control: z.ZodOptional<z.ZodObject<{
3816
+ type: z.ZodLiteral<"ephemeral">;
3817
+ }, "strip", z.ZodTypeAny, {
3818
+ type: "ephemeral";
3819
+ }, {
3820
+ type: "ephemeral";
3821
+ }>>;
3822
+ }, "strip", z.ZodTypeAny, {
3823
+ type: "tool_use";
3824
+ name: string;
3825
+ id: string;
3826
+ input: Record<string, any>;
3827
+ cache_control?: {
3828
+ type: "ephemeral";
3829
+ } | undefined;
3830
+ }, {
3831
+ type: "tool_use";
3832
+ name: string;
3833
+ id: string;
3834
+ input: Record<string, any>;
3835
+ cache_control?: {
3836
+ type: "ephemeral";
3837
+ } | undefined;
3838
+ }>, z.ZodObject<{
3839
+ type: z.ZodLiteral<"tool_result">;
3840
+ tool_use_id: z.ZodString;
3841
+ content: z.ZodString;
3842
+ cache_control: z.ZodOptional<z.ZodObject<{
3843
+ type: z.ZodLiteral<"ephemeral">;
3844
+ }, "strip", z.ZodTypeAny, {
3845
+ type: "ephemeral";
3846
+ }, {
3847
+ type: "ephemeral";
3848
+ }>>;
3849
+ }, "strip", z.ZodTypeAny, {
3850
+ type: "tool_result";
3851
+ content: string;
3852
+ tool_use_id: string;
3853
+ cache_control?: {
3854
+ type: "ephemeral";
3855
+ } | undefined;
3856
+ }, {
3857
+ type: "tool_result";
3858
+ content: string;
3859
+ tool_use_id: string;
3860
+ cache_control?: {
3861
+ type: "ephemeral";
3862
+ } | undefined;
3863
+ }>, z.ZodObject<{
3864
+ type: z.ZodLiteral<"image">;
3865
+ source: z.ZodObject<{
3866
+ type: z.ZodLiteral<"base64">;
3867
+ media_type: z.ZodLiteral<"image/jpeg">;
3868
+ data: z.ZodString;
3869
+ }, "strip", z.ZodTypeAny, {
3870
+ type: "base64";
3871
+ media_type: "image/jpeg";
3872
+ data: string;
3873
+ }, {
3874
+ type: "base64";
3875
+ media_type: "image/jpeg";
3876
+ data: string;
3877
+ }>;
3878
+ cache_control: z.ZodOptional<z.ZodObject<{
3879
+ type: z.ZodLiteral<"ephemeral">;
3880
+ }, "strip", z.ZodTypeAny, {
3881
+ type: "ephemeral";
3882
+ }, {
3883
+ type: "ephemeral";
3884
+ }>>;
3885
+ }, "strip", z.ZodTypeAny, {
3886
+ type: "image";
3887
+ source: {
3888
+ type: "base64";
3889
+ media_type: "image/jpeg";
3890
+ data: string;
3891
+ };
3892
+ cache_control?: {
3893
+ type: "ephemeral";
3894
+ } | undefined;
3895
+ }, {
3896
+ type: "image";
3897
+ source: {
3898
+ type: "base64";
3899
+ media_type: "image/jpeg";
3900
+ data: string;
3901
+ };
3902
+ cache_control?: {
3903
+ type: "ephemeral";
3904
+ } | undefined;
3905
+ }>]>, "many">]>;
3906
+ }, "strip", z.ZodTypeAny, {
3907
+ content: string | ({
3908
+ type: "text";
3909
+ text: string;
3910
+ cache_control?: {
3911
+ type: "ephemeral";
3912
+ } | undefined;
3913
+ } | {
3914
+ type: "tool_use";
3915
+ name: string;
3916
+ id: string;
3917
+ input: Record<string, any>;
3918
+ cache_control?: {
3919
+ type: "ephemeral";
3920
+ } | undefined;
3921
+ } | {
3922
+ type: "tool_result";
3923
+ content: string;
3924
+ tool_use_id: string;
3925
+ cache_control?: {
3926
+ type: "ephemeral";
3927
+ } | undefined;
3928
+ } | {
3929
+ type: "image";
3930
+ source: {
3931
+ type: "base64";
3932
+ media_type: "image/jpeg";
3933
+ data: string;
3934
+ };
3935
+ cache_control?: {
3936
+ type: "ephemeral";
3937
+ } | undefined;
3938
+ })[];
3939
+ role: "user" | "assistant";
3940
+ }, {
3941
+ content: string | ({
3942
+ type: "text";
3943
+ text: string;
3944
+ cache_control?: {
3945
+ type: "ephemeral";
3946
+ } | undefined;
3947
+ } | {
3948
+ type: "tool_use";
3949
+ name: string;
3950
+ id: string;
3951
+ input: Record<string, any>;
3952
+ cache_control?: {
3953
+ type: "ephemeral";
3954
+ } | undefined;
3955
+ } | {
3956
+ type: "tool_result";
3957
+ content: string;
3958
+ tool_use_id: string;
3959
+ cache_control?: {
3960
+ type: "ephemeral";
3961
+ } | undefined;
3962
+ } | {
3963
+ type: "image";
3964
+ source: {
3965
+ type: "base64";
3966
+ media_type: "image/jpeg";
3967
+ data: string;
3968
+ };
3969
+ cache_control?: {
3970
+ type: "ephemeral";
3971
+ } | undefined;
3972
+ })[];
3973
+ role: "user" | "assistant";
3974
+ }>, "many">;
3975
+ consecutiveAssistantMessages: z.ZodOptional<z.ZodNumber>;
3976
+ }, "strip", z.ZodTypeAny, {
3977
+ agentContext: string;
3978
+ fileContext: {
3979
+ currentWorkingDirectory: string;
3980
+ fileTree: import("../util/file").FileTreeNode[];
3981
+ fileTokenScores: Record<string, Record<string, number>>;
3982
+ knowledgeFiles: Record<string, string>;
3983
+ gitChanges: {
3984
+ status: string;
3985
+ diff: string;
3986
+ diffCached: string;
3987
+ lastCommitMessages: string;
3988
+ };
3989
+ changesSinceLastChat: Record<string, string>;
3990
+ shellConfigFiles: Record<string, string>;
3991
+ systemInfo: {
3992
+ platform: string;
3993
+ shell: string;
3994
+ nodeVersion: string;
3995
+ arch: string;
3996
+ homedir: string;
3997
+ cpus: number;
3998
+ };
3999
+ userKnowledgeFiles?: Record<string, string> | undefined;
4000
+ fileVersions?: {
4001
+ path: string;
4002
+ content: string;
4003
+ }[][] | undefined;
4004
+ };
4005
+ messageHistory: {
4006
+ content: string | ({
4007
+ type: "text";
4008
+ text: string;
4009
+ cache_control?: {
4010
+ type: "ephemeral";
4011
+ } | undefined;
4012
+ } | {
4013
+ type: "tool_use";
4014
+ name: string;
4015
+ id: string;
4016
+ input: Record<string, any>;
4017
+ cache_control?: {
4018
+ type: "ephemeral";
4019
+ } | undefined;
4020
+ } | {
4021
+ type: "tool_result";
4022
+ content: string;
4023
+ tool_use_id: string;
4024
+ cache_control?: {
4025
+ type: "ephemeral";
4026
+ } | undefined;
4027
+ } | {
4028
+ type: "image";
4029
+ source: {
4030
+ type: "base64";
4031
+ media_type: "image/jpeg";
4032
+ data: string;
4033
+ };
4034
+ cache_control?: {
4035
+ type: "ephemeral";
4036
+ } | undefined;
4037
+ })[];
4038
+ role: "user" | "assistant";
4039
+ }[];
4040
+ consecutiveAssistantMessages?: number | undefined;
4041
+ }, {
4042
+ agentContext: string;
4043
+ fileContext: {
4044
+ currentWorkingDirectory: string;
4045
+ fileTree: import("../util/file").FileTreeNode[];
4046
+ fileTokenScores: Record<string, Record<string, number>>;
4047
+ knowledgeFiles: Record<string, string>;
4048
+ gitChanges: {
4049
+ status: string;
4050
+ diff: string;
4051
+ diffCached: string;
4052
+ lastCommitMessages: string;
4053
+ };
4054
+ changesSinceLastChat: Record<string, string>;
4055
+ shellConfigFiles: Record<string, string>;
4056
+ systemInfo: {
4057
+ platform: string;
4058
+ shell: string;
4059
+ nodeVersion: string;
4060
+ arch: string;
4061
+ homedir: string;
4062
+ cpus: number;
4063
+ };
4064
+ userKnowledgeFiles?: Record<string, string> | undefined;
4065
+ fileVersions?: {
4066
+ path: string;
4067
+ content: string;
4068
+ }[][] | undefined;
4069
+ };
4070
+ messageHistory: {
4071
+ content: string | ({
4072
+ type: "text";
4073
+ text: string;
4074
+ cache_control?: {
4075
+ type: "ephemeral";
4076
+ } | undefined;
4077
+ } | {
4078
+ type: "tool_use";
4079
+ name: string;
4080
+ id: string;
4081
+ input: Record<string, any>;
4082
+ cache_control?: {
4083
+ type: "ephemeral";
4084
+ } | undefined;
4085
+ } | {
4086
+ type: "tool_result";
4087
+ content: string;
4088
+ tool_use_id: string;
4089
+ cache_control?: {
4090
+ type: "ephemeral";
4091
+ } | undefined;
4092
+ } | {
4093
+ type: "image";
4094
+ source: {
4095
+ type: "base64";
4096
+ media_type: "image/jpeg";
4097
+ data: string;
4098
+ };
4099
+ cache_control?: {
4100
+ type: "ephemeral";
4101
+ } | undefined;
4102
+ })[];
4103
+ role: "user" | "assistant";
4104
+ }[];
4105
+ consecutiveAssistantMessages?: number | undefined;
4106
+ }>;
4107
+ toolCalls: z.ZodArray<z.ZodObject<{
4108
+ name: z.ZodString;
4109
+ parameters: z.ZodRecord<z.ZodString, z.ZodString>;
4110
+ id: z.ZodString;
4111
+ }, "strip", z.ZodTypeAny, {
4112
+ name: string;
4113
+ id: string;
4114
+ parameters: Record<string, string>;
4115
+ }, {
4116
+ name: string;
4117
+ id: string;
4118
+ parameters: Record<string, string>;
4119
+ }>, "many">;
4120
+ toolResults: z.ZodArray<z.ZodObject<{
4121
+ name: z.ZodString;
4122
+ result: z.ZodString;
4123
+ id: z.ZodString;
4124
+ }, "strip", z.ZodTypeAny, {
4125
+ name: string;
4126
+ id: string;
4127
+ result: string;
4128
+ }, {
4129
+ name: string;
4130
+ id: string;
4131
+ result: string;
4132
+ }>, "many">;
4133
+ }, "strip", z.ZodTypeAny, {
4134
+ type: "prompt-response";
4135
+ promptId: string;
4136
+ agentState: {
4137
+ agentContext: string;
4138
+ fileContext: {
4139
+ currentWorkingDirectory: string;
4140
+ fileTree: import("../util/file").FileTreeNode[];
4141
+ fileTokenScores: Record<string, Record<string, number>>;
4142
+ knowledgeFiles: Record<string, string>;
4143
+ gitChanges: {
4144
+ status: string;
4145
+ diff: string;
4146
+ diffCached: string;
4147
+ lastCommitMessages: string;
4148
+ };
4149
+ changesSinceLastChat: Record<string, string>;
4150
+ shellConfigFiles: Record<string, string>;
4151
+ systemInfo: {
4152
+ platform: string;
4153
+ shell: string;
4154
+ nodeVersion: string;
4155
+ arch: string;
4156
+ homedir: string;
4157
+ cpus: number;
4158
+ };
4159
+ userKnowledgeFiles?: Record<string, string> | undefined;
4160
+ fileVersions?: {
4161
+ path: string;
4162
+ content: string;
4163
+ }[][] | undefined;
4164
+ };
4165
+ messageHistory: {
4166
+ content: string | ({
4167
+ type: "text";
4168
+ text: string;
4169
+ cache_control?: {
4170
+ type: "ephemeral";
4171
+ } | undefined;
4172
+ } | {
4173
+ type: "tool_use";
4174
+ name: string;
4175
+ id: string;
4176
+ input: Record<string, any>;
4177
+ cache_control?: {
4178
+ type: "ephemeral";
4179
+ } | undefined;
4180
+ } | {
4181
+ type: "tool_result";
4182
+ content: string;
4183
+ tool_use_id: string;
4184
+ cache_control?: {
4185
+ type: "ephemeral";
4186
+ } | undefined;
4187
+ } | {
4188
+ type: "image";
4189
+ source: {
4190
+ type: "base64";
4191
+ media_type: "image/jpeg";
4192
+ data: string;
4193
+ };
4194
+ cache_control?: {
4195
+ type: "ephemeral";
4196
+ } | undefined;
4197
+ })[];
4198
+ role: "user" | "assistant";
4199
+ }[];
4200
+ consecutiveAssistantMessages?: number | undefined;
4201
+ };
4202
+ toolResults: {
4203
+ name: string;
4204
+ id: string;
4205
+ result: string;
4206
+ }[];
4207
+ toolCalls: {
4208
+ name: string;
4209
+ id: string;
4210
+ parameters: Record<string, string>;
4211
+ }[];
4212
+ }, {
4213
+ type: "prompt-response";
4214
+ promptId: string;
4215
+ agentState: {
4216
+ agentContext: string;
4217
+ fileContext: {
4218
+ currentWorkingDirectory: string;
4219
+ fileTree: import("../util/file").FileTreeNode[];
4220
+ fileTokenScores: Record<string, Record<string, number>>;
4221
+ knowledgeFiles: Record<string, string>;
4222
+ gitChanges: {
4223
+ status: string;
4224
+ diff: string;
4225
+ diffCached: string;
4226
+ lastCommitMessages: string;
4227
+ };
4228
+ changesSinceLastChat: Record<string, string>;
4229
+ shellConfigFiles: Record<string, string>;
4230
+ systemInfo: {
4231
+ platform: string;
4232
+ shell: string;
4233
+ nodeVersion: string;
4234
+ arch: string;
4235
+ homedir: string;
4236
+ cpus: number;
4237
+ };
4238
+ userKnowledgeFiles?: Record<string, string> | undefined;
4239
+ fileVersions?: {
4240
+ path: string;
4241
+ content: string;
4242
+ }[][] | undefined;
4243
+ };
4244
+ messageHistory: {
4245
+ content: string | ({
4246
+ type: "text";
4247
+ text: string;
4248
+ cache_control?: {
4249
+ type: "ephemeral";
4250
+ } | undefined;
4251
+ } | {
4252
+ type: "tool_use";
4253
+ name: string;
4254
+ id: string;
4255
+ input: Record<string, any>;
4256
+ cache_control?: {
4257
+ type: "ephemeral";
4258
+ } | undefined;
4259
+ } | {
4260
+ type: "tool_result";
4261
+ content: string;
4262
+ tool_use_id: string;
4263
+ cache_control?: {
4264
+ type: "ephemeral";
4265
+ } | undefined;
4266
+ } | {
4267
+ type: "image";
4268
+ source: {
4269
+ type: "base64";
4270
+ media_type: "image/jpeg";
4271
+ data: string;
4272
+ };
4273
+ cache_control?: {
4274
+ type: "ephemeral";
4275
+ } | undefined;
4276
+ })[];
4277
+ role: "user" | "assistant";
4278
+ }[];
4279
+ consecutiveAssistantMessages?: number | undefined;
4280
+ };
4281
+ toolResults: {
4282
+ name: string;
4283
+ id: string;
4284
+ result: string;
4285
+ }[];
4286
+ toolCalls: {
4287
+ name: string;
4288
+ id: string;
4289
+ parameters: Record<string, string>;
4290
+ }[];
4291
+ }>, z.ZodObject<{
4292
+ type: z.ZodLiteral<"read-files">;
4293
+ filePaths: z.ZodArray<z.ZodString, "many">;
4294
+ requestId: z.ZodString;
4295
+ }, "strip", z.ZodTypeAny, {
4296
+ type: "read-files";
4297
+ requestId: string;
4298
+ filePaths: string[];
4299
+ }, {
4300
+ type: "read-files";
4301
+ requestId: string;
4302
+ filePaths: string[];
4303
+ }>, z.ZodObject<{
4304
+ type: z.ZodLiteral<"tool-call">;
4305
+ userInputId: z.ZodString;
4306
+ response: z.ZodString;
4307
+ data: z.ZodObject<{
4308
+ name: z.ZodString;
4309
+ id: z.ZodString;
4310
+ input: z.ZodRecord<z.ZodString, z.ZodAny>;
4311
+ }, "strip", z.ZodTypeAny, {
4312
+ name: string;
4313
+ id: string;
4314
+ input: Record<string, any>;
4315
+ }, {
4316
+ name: string;
4317
+ id: string;
4318
+ input: Record<string, any>;
4319
+ }>;
4320
+ changes: z.ZodArray<z.ZodObject<{
4321
+ type: z.ZodEnum<["patch", "file"]>;
4322
+ path: z.ZodString;
4323
+ content: z.ZodString;
4324
+ }, "strip", z.ZodTypeAny, {
4325
+ path: string;
4326
+ type: "file" | "patch";
4327
+ content: string;
4328
+ }, {
4329
+ path: string;
4330
+ type: "file" | "patch";
4331
+ content: string;
4332
+ }>, "many">;
4333
+ changesAlreadyApplied: z.ZodArray<z.ZodObject<{
4334
+ type: z.ZodEnum<["patch", "file"]>;
4335
+ path: z.ZodString;
4336
+ content: z.ZodString;
4337
+ }, "strip", z.ZodTypeAny, {
4338
+ path: string;
4339
+ type: "file" | "patch";
4340
+ content: string;
4341
+ }, {
4342
+ path: string;
4343
+ type: "file" | "patch";
4344
+ content: string;
4345
+ }>, "many">;
4346
+ addedFileVersions: z.ZodArray<z.ZodObject<{
4347
+ path: z.ZodString;
4348
+ content: z.ZodString;
4349
+ }, "strip", z.ZodTypeAny, {
4350
+ path: string;
4351
+ content: string;
4352
+ }, {
4353
+ path: string;
4354
+ content: string;
4355
+ }>, "many">;
4356
+ resetFileVersions: z.ZodBoolean;
4357
+ }, "strip", z.ZodTypeAny, {
4358
+ type: "tool-call";
4359
+ data: {
4360
+ name: string;
4361
+ id: string;
4362
+ input: Record<string, any>;
4363
+ };
4364
+ userInputId: string;
4365
+ response: string;
4366
+ changes: {
4367
+ path: string;
4368
+ type: "file" | "patch";
4369
+ content: string;
4370
+ }[];
4371
+ changesAlreadyApplied: {
4372
+ path: string;
4373
+ type: "file" | "patch";
4374
+ content: string;
4375
+ }[];
4376
+ addedFileVersions: {
4377
+ path: string;
4378
+ content: string;
4379
+ }[];
4380
+ resetFileVersions: boolean;
4381
+ }, {
4382
+ type: "tool-call";
4383
+ data: {
4384
+ name: string;
4385
+ id: string;
4386
+ input: Record<string, any>;
4387
+ };
4388
+ userInputId: string;
4389
+ response: string;
4390
+ changes: {
4391
+ path: string;
4392
+ type: "file" | "patch";
4393
+ content: string;
4394
+ }[];
4395
+ changesAlreadyApplied: {
4396
+ path: string;
4397
+ type: "file" | "patch";
4398
+ content: string;
4399
+ }[];
4400
+ addedFileVersions: {
4401
+ path: string;
4402
+ content: string;
4403
+ }[];
4404
+ resetFileVersions: boolean;
4405
+ }>, z.ZodObject<{
4406
+ type: z.ZodLiteral<"terminal-command-result">;
4407
+ userInputId: z.ZodString;
4408
+ result: z.ZodString;
4409
+ }, "strip", z.ZodTypeAny, {
4410
+ type: "terminal-command-result";
4411
+ result: string;
4412
+ userInputId: string;
4413
+ }, {
4414
+ type: "terminal-command-result";
4415
+ result: string;
4416
+ userInputId: string;
4417
+ }>, z.ZodObject<{
4418
+ type: z.ZodLiteral<"npm-version-status">;
4419
+ isUpToDate: z.ZodBoolean;
4420
+ latestVersion: z.ZodString;
4421
+ }, "strip", z.ZodTypeAny, {
4422
+ type: "npm-version-status";
4423
+ isUpToDate: boolean;
4424
+ latestVersion: string;
4425
+ }, {
4426
+ type: "npm-version-status";
4427
+ isUpToDate: boolean;
4428
+ latestVersion: string;
4429
+ }>, z.ZodObject<z.objectUtil.extendShape<{
4430
+ type: z.ZodLiteral<"init-response">;
4431
+ }, Omit<{
4432
+ type: z.ZodLiteral<"usage-response">;
4433
+ usage: z.ZodNumber;
4434
+ remainingBalance: z.ZodNumber;
4435
+ balanceBreakdown: z.ZodOptional<z.ZodRecord<z.ZodEnum<[import("../types/grant").GrantType, ...import("../types/grant").GrantType[]]>, z.ZodNumber>>;
4436
+ next_quota_reset: z.ZodNullable<z.ZodDate>;
4437
+ autoTopupAdded: z.ZodOptional<z.ZodNumber>;
4438
+ }, "type">>, "strip", z.ZodTypeAny, {
4439
+ type: "init-response";
4440
+ usage: number;
4441
+ remainingBalance: number;
4442
+ next_quota_reset: Date | null;
4443
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
4444
+ autoTopupAdded?: number | undefined;
4445
+ }, {
4446
+ type: "init-response";
4447
+ usage: number;
4448
+ remainingBalance: number;
4449
+ next_quota_reset: Date | null;
4450
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
4451
+ autoTopupAdded?: number | undefined;
4452
+ }>, z.ZodObject<{
4453
+ type: z.ZodLiteral<"usage-response">;
4454
+ usage: z.ZodNumber;
4455
+ remainingBalance: z.ZodNumber;
4456
+ balanceBreakdown: z.ZodOptional<z.ZodRecord<z.ZodEnum<[import("../types/grant").GrantType, ...import("../types/grant").GrantType[]]>, z.ZodNumber>>;
4457
+ next_quota_reset: z.ZodNullable<z.ZodDate>;
4458
+ autoTopupAdded: z.ZodOptional<z.ZodNumber>;
4459
+ }, "strip", z.ZodTypeAny, {
4460
+ type: "usage-response";
4461
+ usage: number;
4462
+ remainingBalance: number;
4463
+ next_quota_reset: Date | null;
4464
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
4465
+ autoTopupAdded?: number | undefined;
4466
+ }, {
4467
+ type: "usage-response";
4468
+ usage: number;
4469
+ remainingBalance: number;
4470
+ next_quota_reset: Date | null;
4471
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
4472
+ autoTopupAdded?: number | undefined;
4473
+ }>, z.ZodObject<{
4474
+ type: z.ZodLiteral<"message-cost-response">;
4475
+ promptId: z.ZodString;
4476
+ credits: z.ZodNumber;
4477
+ }, "strip", z.ZodTypeAny, {
4478
+ type: "message-cost-response";
4479
+ promptId: string;
4480
+ credits: number;
4481
+ }, {
4482
+ type: "message-cost-response";
4483
+ promptId: string;
4484
+ credits: number;
4485
+ }>, z.ZodObject<{
4486
+ type: z.ZodLiteral<"action-error">;
4487
+ message: z.ZodString;
4488
+ error: z.ZodOptional<z.ZodString>;
4489
+ remainingBalance: z.ZodOptional<z.ZodNumber>;
4490
+ }, "strip", z.ZodTypeAny, {
4491
+ message: string;
4492
+ type: "action-error";
4493
+ remainingBalance?: number | undefined;
4494
+ error?: string | undefined;
4495
+ }, {
4496
+ message: string;
4497
+ type: "action-error";
4498
+ remainingBalance?: number | undefined;
4499
+ error?: string | undefined;
4500
+ }>, z.ZodObject<{
4501
+ type: z.ZodLiteral<"commit-message-response">;
4502
+ commitMessage: z.ZodString;
4503
+ }, "strip", z.ZodTypeAny, {
4504
+ type: "commit-message-response";
4505
+ commitMessage: string;
4506
+ }, {
4507
+ type: "commit-message-response";
4508
+ commitMessage: string;
4509
+ }>, z.ZodObject<{
4510
+ type: z.ZodLiteral<"request-reconnect">;
4511
+ }, "strip", z.ZodTypeAny, {
4512
+ type: "request-reconnect";
4513
+ }, {
4514
+ type: "request-reconnect";
4515
+ }>]>;
4516
+ }, "strip", z.ZodTypeAny, {
4517
+ type: "action";
4518
+ data: {
4519
+ type: "usage-response";
4520
+ usage: number;
4521
+ remainingBalance: number;
4522
+ next_quota_reset: Date | null;
4523
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
4524
+ autoTopupAdded?: number | undefined;
4525
+ } | {
4526
+ type: "init-response";
4527
+ usage: number;
4528
+ remainingBalance: number;
4529
+ next_quota_reset: Date | null;
4530
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
4531
+ autoTopupAdded?: number | undefined;
4532
+ } | {
4533
+ type: "response-complete";
4534
+ userInputId: string;
4535
+ response: string;
4536
+ changes: {
4537
+ path: string;
4538
+ type: "file" | "patch";
4539
+ content: string;
4540
+ }[];
4541
+ changesAlreadyApplied: {
4542
+ path: string;
4543
+ type: "file" | "patch";
4544
+ content: string;
4545
+ }[];
4546
+ addedFileVersions: {
4547
+ path: string;
4548
+ content: string;
4549
+ }[];
4550
+ resetFileVersions: boolean;
4551
+ usage?: number | undefined;
4552
+ remainingBalance?: number | undefined;
4553
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
4554
+ next_quota_reset?: Date | null | undefined;
4555
+ autoTopupAdded?: number | undefined;
4556
+ } | {
4557
+ type: "message-cost-response";
4558
+ promptId: string;
4559
+ credits: number;
4560
+ } | {
4561
+ type: "prompt-response";
4562
+ promptId: string;
4563
+ agentState: {
4564
+ agentContext: string;
4565
+ fileContext: {
4566
+ currentWorkingDirectory: string;
4567
+ fileTree: import("../util/file").FileTreeNode[];
4568
+ fileTokenScores: Record<string, Record<string, number>>;
4569
+ knowledgeFiles: Record<string, string>;
4570
+ gitChanges: {
4571
+ status: string;
4572
+ diff: string;
4573
+ diffCached: string;
4574
+ lastCommitMessages: string;
4575
+ };
4576
+ changesSinceLastChat: Record<string, string>;
4577
+ shellConfigFiles: Record<string, string>;
4578
+ systemInfo: {
4579
+ platform: string;
4580
+ shell: string;
4581
+ nodeVersion: string;
4582
+ arch: string;
4583
+ homedir: string;
4584
+ cpus: number;
4585
+ };
4586
+ userKnowledgeFiles?: Record<string, string> | undefined;
4587
+ fileVersions?: {
4588
+ path: string;
4589
+ content: string;
4590
+ }[][] | undefined;
4591
+ };
4592
+ messageHistory: {
4593
+ content: string | ({
4594
+ type: "text";
4595
+ text: string;
4596
+ cache_control?: {
4597
+ type: "ephemeral";
4598
+ } | undefined;
4599
+ } | {
4600
+ type: "tool_use";
4601
+ name: string;
4602
+ id: string;
4603
+ input: Record<string, any>;
4604
+ cache_control?: {
4605
+ type: "ephemeral";
4606
+ } | undefined;
4607
+ } | {
4608
+ type: "tool_result";
4609
+ content: string;
4610
+ tool_use_id: string;
4611
+ cache_control?: {
4612
+ type: "ephemeral";
4613
+ } | undefined;
4614
+ } | {
4615
+ type: "image";
4616
+ source: {
4617
+ type: "base64";
4618
+ media_type: "image/jpeg";
4619
+ data: string;
4620
+ };
4621
+ cache_control?: {
4622
+ type: "ephemeral";
4623
+ } | undefined;
4624
+ })[];
4625
+ role: "user" | "assistant";
4626
+ }[];
4627
+ consecutiveAssistantMessages?: number | undefined;
4628
+ };
4629
+ toolResults: {
4630
+ name: string;
4631
+ id: string;
4632
+ result: string;
4633
+ }[];
4634
+ toolCalls: {
4635
+ name: string;
4636
+ id: string;
4637
+ parameters: Record<string, string>;
4638
+ }[];
4639
+ } | {
4640
+ type: "response-chunk";
4641
+ userInputId: string;
4642
+ chunk: string;
4643
+ } | {
4644
+ type: "read-files";
4645
+ requestId: string;
4646
+ filePaths: string[];
4647
+ } | {
4648
+ type: "tool-call";
4649
+ data: {
4650
+ name: string;
4651
+ id: string;
4652
+ input: Record<string, any>;
4653
+ };
4654
+ userInputId: string;
4655
+ response: string;
4656
+ changes: {
4657
+ path: string;
4658
+ type: "file" | "patch";
4659
+ content: string;
4660
+ }[];
4661
+ changesAlreadyApplied: {
4662
+ path: string;
4663
+ type: "file" | "patch";
4664
+ content: string;
4665
+ }[];
4666
+ addedFileVersions: {
4667
+ path: string;
4668
+ content: string;
4669
+ }[];
4670
+ resetFileVersions: boolean;
4671
+ } | {
4672
+ type: "terminal-command-result";
4673
+ result: string;
4674
+ userInputId: string;
4675
+ } | {
4676
+ type: "npm-version-status";
4677
+ isUpToDate: boolean;
4678
+ latestVersion: string;
4679
+ } | {
4680
+ message: string;
4681
+ type: "action-error";
4682
+ remainingBalance?: number | undefined;
4683
+ error?: string | undefined;
4684
+ } | {
4685
+ type: "commit-message-response";
4686
+ commitMessage: string;
4687
+ } | {
4688
+ type: "request-reconnect";
4689
+ };
4690
+ }, {
4691
+ type: "action";
4692
+ data: {
4693
+ type: "usage-response";
4694
+ usage: number;
4695
+ remainingBalance: number;
4696
+ next_quota_reset: Date | null;
4697
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
4698
+ autoTopupAdded?: number | undefined;
4699
+ } | {
4700
+ type: "init-response";
4701
+ usage: number;
4702
+ remainingBalance: number;
4703
+ next_quota_reset: Date | null;
4704
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
4705
+ autoTopupAdded?: number | undefined;
4706
+ } | {
4707
+ type: "response-complete";
4708
+ userInputId: string;
4709
+ response: string;
4710
+ changes: {
4711
+ path: string;
4712
+ type: "file" | "patch";
4713
+ content: string;
4714
+ }[];
4715
+ changesAlreadyApplied: {
4716
+ path: string;
4717
+ type: "file" | "patch";
4718
+ content: string;
4719
+ }[];
4720
+ addedFileVersions: {
4721
+ path: string;
4722
+ content: string;
4723
+ }[];
4724
+ resetFileVersions: boolean;
4725
+ usage?: number | undefined;
4726
+ remainingBalance?: number | undefined;
4727
+ balanceBreakdown?: Partial<Record<import("../types/grant").GrantType, number>> | undefined;
4728
+ next_quota_reset?: Date | null | undefined;
4729
+ autoTopupAdded?: number | undefined;
4730
+ } | {
4731
+ type: "message-cost-response";
4732
+ promptId: string;
4733
+ credits: number;
4734
+ } | {
4735
+ type: "prompt-response";
4736
+ promptId: string;
4737
+ agentState: {
4738
+ agentContext: string;
4739
+ fileContext: {
4740
+ currentWorkingDirectory: string;
4741
+ fileTree: import("../util/file").FileTreeNode[];
4742
+ fileTokenScores: Record<string, Record<string, number>>;
4743
+ knowledgeFiles: Record<string, string>;
4744
+ gitChanges: {
4745
+ status: string;
4746
+ diff: string;
4747
+ diffCached: string;
4748
+ lastCommitMessages: string;
4749
+ };
4750
+ changesSinceLastChat: Record<string, string>;
4751
+ shellConfigFiles: Record<string, string>;
4752
+ systemInfo: {
4753
+ platform: string;
4754
+ shell: string;
4755
+ nodeVersion: string;
4756
+ arch: string;
4757
+ homedir: string;
4758
+ cpus: number;
4759
+ };
4760
+ userKnowledgeFiles?: Record<string, string> | undefined;
4761
+ fileVersions?: {
4762
+ path: string;
4763
+ content: string;
4764
+ }[][] | undefined;
4765
+ };
4766
+ messageHistory: {
4767
+ content: string | ({
4768
+ type: "text";
4769
+ text: string;
4770
+ cache_control?: {
4771
+ type: "ephemeral";
4772
+ } | undefined;
4773
+ } | {
4774
+ type: "tool_use";
4775
+ name: string;
4776
+ id: string;
4777
+ input: Record<string, any>;
4778
+ cache_control?: {
4779
+ type: "ephemeral";
4780
+ } | undefined;
4781
+ } | {
4782
+ type: "tool_result";
4783
+ content: string;
4784
+ tool_use_id: string;
4785
+ cache_control?: {
4786
+ type: "ephemeral";
4787
+ } | undefined;
4788
+ } | {
4789
+ type: "image";
4790
+ source: {
4791
+ type: "base64";
4792
+ media_type: "image/jpeg";
4793
+ data: string;
4794
+ };
4795
+ cache_control?: {
4796
+ type: "ephemeral";
4797
+ } | undefined;
4798
+ })[];
4799
+ role: "user" | "assistant";
4800
+ }[];
4801
+ consecutiveAssistantMessages?: number | undefined;
4802
+ };
4803
+ toolResults: {
4804
+ name: string;
4805
+ id: string;
4806
+ result: string;
4807
+ }[];
4808
+ toolCalls: {
4809
+ name: string;
4810
+ id: string;
4811
+ parameters: Record<string, string>;
4812
+ }[];
4813
+ } | {
4814
+ type: "response-chunk";
4815
+ userInputId: string;
4816
+ chunk: string;
4817
+ } | {
4818
+ type: "read-files";
4819
+ requestId: string;
4820
+ filePaths: string[];
4821
+ } | {
4822
+ type: "tool-call";
4823
+ data: {
4824
+ name: string;
4825
+ id: string;
4826
+ input: Record<string, any>;
4827
+ };
4828
+ userInputId: string;
4829
+ response: string;
4830
+ changes: {
4831
+ path: string;
4832
+ type: "file" | "patch";
4833
+ content: string;
4834
+ }[];
4835
+ changesAlreadyApplied: {
4836
+ path: string;
4837
+ type: "file" | "patch";
4838
+ content: string;
4839
+ }[];
4840
+ addedFileVersions: {
4841
+ path: string;
4842
+ content: string;
4843
+ }[];
4844
+ resetFileVersions: boolean;
4845
+ } | {
4846
+ type: "terminal-command-result";
4847
+ result: string;
4848
+ userInputId: string;
4849
+ } | {
4850
+ type: "npm-version-status";
4851
+ isUpToDate: boolean;
4852
+ latestVersion: string;
4853
+ } | {
4854
+ message: string;
4855
+ type: "action-error";
4856
+ remainingBalance?: number | undefined;
4857
+ error?: string | undefined;
4858
+ } | {
4859
+ type: "commit-message-response";
4860
+ commitMessage: string;
4861
+ } | {
4862
+ type: "request-reconnect";
4863
+ };
4864
+ }>]>;
4865
+ export type ServerMessageType = keyof typeof SERVER_MESSAGE_SCHEMAS;
4866
+ export type ServerMessage<T extends ServerMessageType = ServerMessageType> = z.infer<(typeof SERVER_MESSAGE_SCHEMAS)[T]>;
4867
+ //# sourceMappingURL=websocket-schema.d.ts.map