codecane 1.0.293 → 1.0.296

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