@machina.ai/cell-cli-core 1.10.0-rc1 → 1.13.0-rc1

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 (549) hide show
  1. package/dist/index.d.ts +5 -0
  2. package/dist/index.js +4 -0
  3. package/dist/index.js.map +1 -1
  4. package/dist/package.json +13 -5
  5. package/dist/src/agents/codebase-investigator.js +2 -5
  6. package/dist/src/agents/codebase-investigator.js.map +1 -1
  7. package/dist/src/agents/executor.d.ts +19 -0
  8. package/dist/src/agents/executor.js +234 -46
  9. package/dist/src/agents/executor.js.map +1 -1
  10. package/dist/src/agents/executor.test.js +371 -40
  11. package/dist/src/agents/executor.test.js.map +1 -1
  12. package/dist/src/agents/registry.js +4 -3
  13. package/dist/src/agents/registry.js.map +1 -1
  14. package/dist/src/agents/subagent-tool-wrapper.test.js +2 -4
  15. package/dist/src/agents/subagent-tool-wrapper.test.js.map +1 -1
  16. package/dist/src/agents/types.d.ts +2 -1
  17. package/dist/src/agents/types.js +1 -0
  18. package/dist/src/agents/types.js.map +1 -1
  19. package/dist/src/code_assist/converter.d.ts +1 -0
  20. package/dist/src/code_assist/converter.js +1 -0
  21. package/dist/src/code_assist/converter.js.map +1 -1
  22. package/dist/src/code_assist/converter.test.js +19 -0
  23. package/dist/src/code_assist/converter.test.js.map +1 -1
  24. package/dist/src/code_assist/experiments/client_metadata.d.ts +12 -0
  25. package/dist/src/code_assist/experiments/client_metadata.js +49 -0
  26. package/dist/src/code_assist/experiments/client_metadata.js.map +1 -0
  27. package/dist/src/code_assist/experiments/experiments.d.ts +17 -0
  28. package/dist/src/code_assist/experiments/experiments.js +36 -0
  29. package/dist/src/code_assist/experiments/experiments.js.map +1 -0
  30. package/dist/src/code_assist/experiments/types.d.ts +35 -0
  31. package/dist/src/code_assist/experiments/types.js +7 -0
  32. package/dist/src/code_assist/experiments/types.js.map +1 -0
  33. package/dist/src/code_assist/oauth-credential-storage.js +5 -4
  34. package/dist/src/code_assist/oauth-credential-storage.js.map +1 -1
  35. package/dist/src/code_assist/oauth-credential-storage.test.js +15 -3
  36. package/dist/src/code_assist/oauth-credential-storage.test.js.map +1 -1
  37. package/dist/src/code_assist/oauth2.d.ts +2 -2
  38. package/dist/src/code_assist/oauth2.js +64 -51
  39. package/dist/src/code_assist/oauth2.js.map +1 -1
  40. package/dist/src/code_assist/oauth2.test.js +65 -33
  41. package/dist/src/code_assist/oauth2.test.js.map +1 -1
  42. package/dist/src/code_assist/server.d.ts +6 -4
  43. package/dist/src/code_assist/server.js +11 -0
  44. package/dist/src/code_assist/server.js.map +1 -1
  45. package/dist/src/code_assist/server.test.js +17 -0
  46. package/dist/src/code_assist/server.test.js.map +1 -1
  47. package/dist/src/code_assist/setup.d.ts +2 -2
  48. package/dist/src/code_assist/setup.js.map +1 -1
  49. package/dist/src/code_assist/types.d.ts +1 -1
  50. package/dist/src/code_assist/types.js.map +1 -1
  51. package/dist/src/commands/extensions.d.ts +7 -0
  52. package/dist/src/commands/extensions.js +9 -0
  53. package/dist/src/commands/extensions.js.map +1 -0
  54. package/dist/src/commands/extensions.test.js +19 -0
  55. package/dist/src/commands/extensions.test.js.map +1 -0
  56. package/dist/src/config/config.d.ts +81 -32
  57. package/dist/src/config/config.js +193 -66
  58. package/dist/src/config/config.js.map +1 -1
  59. package/dist/src/config/config.test.js +115 -36
  60. package/dist/src/config/config.test.js.map +1 -1
  61. package/dist/src/config/models.d.ts +1 -1
  62. package/dist/src/config/models.js +2 -2
  63. package/dist/src/config/models.js.map +1 -1
  64. package/dist/src/config/storage.d.ts +3 -0
  65. package/dist/src/config/storage.js +20 -0
  66. package/dist/src/config/storage.js.map +1 -1
  67. package/dist/src/confirmation-bus/message-bus.d.ts +2 -1
  68. package/dist/src/confirmation-bus/message-bus.js +7 -1
  69. package/dist/src/confirmation-bus/message-bus.js.map +1 -1
  70. package/dist/src/confirmation-bus/types.d.ts +12 -2
  71. package/dist/src/confirmation-bus/types.js +1 -0
  72. package/dist/src/confirmation-bus/types.js.map +1 -1
  73. package/dist/src/core/apiKeyCredentialStorage.d.ts +17 -0
  74. package/dist/src/core/apiKeyCredentialStorage.js +64 -0
  75. package/dist/src/core/apiKeyCredentialStorage.js.map +1 -0
  76. package/dist/src/core/apiKeyCredentialStorage.test.d.ts +6 -0
  77. package/dist/src/core/apiKeyCredentialStorage.test.js +71 -0
  78. package/dist/src/core/apiKeyCredentialStorage.test.js.map +1 -0
  79. package/dist/src/core/client.d.ts +2 -11
  80. package/dist/src/core/client.js +31 -170
  81. package/dist/src/core/client.js.map +1 -1
  82. package/dist/src/core/client.test.js +107 -429
  83. package/dist/src/core/client.test.js.map +1 -1
  84. package/dist/src/core/contentGenerator.js +64 -59
  85. package/dist/src/core/contentGenerator.js.map +1 -1
  86. package/dist/src/core/contentGenerator.test.js +38 -4
  87. package/dist/src/core/contentGenerator.test.js.map +1 -1
  88. package/dist/src/core/coreToolScheduler.d.ts +8 -2
  89. package/dist/src/core/coreToolScheduler.js +337 -172
  90. package/dist/src/core/coreToolScheduler.js.map +1 -1
  91. package/dist/src/core/coreToolScheduler.test.js +363 -12
  92. package/dist/src/core/coreToolScheduler.test.js.map +1 -1
  93. package/dist/src/core/fakeContentGenerator.d.ts +33 -0
  94. package/dist/src/core/fakeContentGenerator.js +58 -0
  95. package/dist/src/core/fakeContentGenerator.js.map +1 -0
  96. package/dist/src/core/fakeContentGenerator.test.d.ts +6 -0
  97. package/dist/src/core/fakeContentGenerator.test.js +127 -0
  98. package/dist/src/core/fakeContentGenerator.test.js.map +1 -0
  99. package/dist/src/core/geminiChat.d.ts +2 -0
  100. package/dist/src/core/geminiChat.js +7 -2
  101. package/dist/src/core/geminiChat.js.map +1 -1
  102. package/dist/src/core/geminiChat.test.js +15 -3
  103. package/dist/src/core/geminiChat.test.js.map +1 -1
  104. package/dist/src/core/logger.js +21 -19
  105. package/dist/src/core/logger.js.map +1 -1
  106. package/dist/src/core/loggingContentGenerator.d.ts +1 -0
  107. package/dist/src/core/loggingContentGenerator.js +113 -33
  108. package/dist/src/core/loggingContentGenerator.js.map +1 -1
  109. package/dist/src/core/nonInteractiveToolExecutor.js +5 -4
  110. package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -1
  111. package/dist/src/core/nonInteractiveToolExecutor.test.js +3 -0
  112. package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -1
  113. package/dist/src/core/prompts.js +115 -72
  114. package/dist/src/core/prompts.js.map +1 -1
  115. package/dist/src/core/prompts.test.js +30 -108
  116. package/dist/src/core/prompts.test.js.map +1 -1
  117. package/dist/src/core/recordingContentGenerator.d.ts +18 -0
  118. package/dist/src/core/recordingContentGenerator.js +77 -0
  119. package/dist/src/core/recordingContentGenerator.js.map +1 -0
  120. package/dist/src/core/recordingContentGenerator.test.d.ts +6 -0
  121. package/dist/src/core/recordingContentGenerator.test.js +101 -0
  122. package/dist/src/core/recordingContentGenerator.test.js.map +1 -0
  123. package/dist/src/core/turn.d.ts +2 -0
  124. package/dist/src/core/turn.js +3 -1
  125. package/dist/src/core/turn.js.map +1 -1
  126. package/dist/src/core/turn.test.js +48 -0
  127. package/dist/src/core/turn.test.js.map +1 -1
  128. package/dist/src/fallback/handler.js +2 -0
  129. package/dist/src/fallback/handler.js.map +1 -1
  130. package/dist/src/generated/git-commit.d.ts +2 -2
  131. package/dist/src/generated/git-commit.js +2 -2
  132. package/dist/src/hooks/hookPlanner.d.ts +46 -0
  133. package/dist/src/hooks/hookPlanner.js +108 -0
  134. package/dist/src/hooks/hookPlanner.js.map +1 -0
  135. package/dist/src/hooks/hookPlanner.test.d.ts +6 -0
  136. package/dist/src/hooks/hookPlanner.test.js +255 -0
  137. package/dist/src/hooks/hookPlanner.test.js.map +1 -0
  138. package/dist/src/hooks/hookRegistry.d.ts +87 -0
  139. package/dist/src/hooks/hookRegistry.js +198 -0
  140. package/dist/src/hooks/hookRegistry.js.map +1 -0
  141. package/dist/src/hooks/hookRegistry.test.d.ts +6 -0
  142. package/dist/src/hooks/hookRegistry.test.js +341 -0
  143. package/dist/src/hooks/hookRegistry.test.js.map +1 -0
  144. package/dist/src/hooks/hookTranslator.d.ts +113 -0
  145. package/dist/src/hooks/hookTranslator.js +232 -0
  146. package/dist/src/hooks/hookTranslator.js.map +1 -0
  147. package/dist/src/hooks/hookTranslator.test.d.ts +6 -0
  148. package/dist/src/hooks/hookTranslator.test.js +192 -0
  149. package/dist/src/hooks/hookTranslator.test.js.map +1 -0
  150. package/dist/src/hooks/types.d.ts +384 -0
  151. package/dist/src/hooks/types.js +284 -0
  152. package/dist/src/hooks/types.js.map +1 -0
  153. package/dist/src/hooks/types.test.d.ts +6 -0
  154. package/dist/src/hooks/types.test.js +35 -0
  155. package/dist/src/hooks/types.test.js.map +1 -0
  156. package/dist/src/ide/ide-client.js +2 -1
  157. package/dist/src/ide/ide-client.js.map +1 -1
  158. package/dist/src/index.d.ts +15 -0
  159. package/dist/src/index.js +18 -0
  160. package/dist/src/index.js.map +1 -1
  161. package/dist/src/mcp/google-auth-provider.d.ts +2 -0
  162. package/dist/src/mcp/google-auth-provider.js +21 -3
  163. package/dist/src/mcp/google-auth-provider.js.map +1 -1
  164. package/dist/src/mcp/google-auth-provider.test.js +42 -9
  165. package/dist/src/mcp/google-auth-provider.test.js.map +1 -1
  166. package/dist/src/mcp/mcpLauncher.d.ts +26 -0
  167. package/dist/src/mcp/mcpLauncher.js +238 -0
  168. package/dist/src/mcp/mcpLauncher.js.map +1 -0
  169. package/dist/src/mcp/oauth-provider.d.ts +8 -5
  170. package/dist/src/mcp/oauth-provider.js +140 -55
  171. package/dist/src/mcp/oauth-provider.js.map +1 -1
  172. package/dist/src/mcp/oauth-provider.test.js +191 -2
  173. package/dist/src/mcp/oauth-provider.test.js.map +1 -1
  174. package/dist/src/mcp/oauth-token-storage.js +5 -4
  175. package/dist/src/mcp/oauth-token-storage.js.map +1 -1
  176. package/dist/src/mcp/oauth-token-storage.test.js +17 -11
  177. package/dist/src/mcp/oauth-token-storage.test.js.map +1 -1
  178. package/dist/src/mcp/oauth-utils.d.ts +7 -0
  179. package/dist/src/mcp/oauth-utils.js +28 -8
  180. package/dist/src/mcp/oauth-utils.js.map +1 -1
  181. package/dist/src/mcp/oauth-utils.test.js +45 -2
  182. package/dist/src/mcp/oauth-utils.test.js.map +1 -1
  183. package/dist/src/mcp/sa-impersonation-provider.d.ts +0 -6
  184. package/dist/src/mcp/sa-impersonation-provider.js +6 -23
  185. package/dist/src/mcp/sa-impersonation-provider.js.map +1 -1
  186. package/dist/src/mcp/token-storage/base-token-storage.test.js +75 -84
  187. package/dist/src/mcp/token-storage/base-token-storage.test.js.map +1 -1
  188. package/dist/src/mcp/token-storage/file-token-storage.js +1 -1
  189. package/dist/src/mcp/token-storage/file-token-storage.js.map +1 -1
  190. package/dist/src/mcp/token-storage/file-token-storage.test.js +7 -5
  191. package/dist/src/mcp/token-storage/file-token-storage.test.js.map +1 -1
  192. package/dist/src/mcp/token-storage/hybrid-token-storage.js +1 -1
  193. package/dist/src/mcp/token-storage/hybrid-token-storage.js.map +1 -1
  194. package/dist/src/mcp/token-storage/hybrid-token-storage.test.js +2 -2
  195. package/dist/src/mcp/token-storage/hybrid-token-storage.test.js.map +1 -1
  196. package/dist/src/mcp/token-storage/keychain-token-storage.d.ts +6 -2
  197. package/dist/src/mcp/token-storage/keychain-token-storage.js +63 -7
  198. package/dist/src/mcp/token-storage/keychain-token-storage.js.map +1 -1
  199. package/dist/src/mcp/token-storage/keychain-token-storage.test.js +54 -3
  200. package/dist/src/mcp/token-storage/keychain-token-storage.test.js.map +1 -1
  201. package/dist/src/mcp/token-storage/types.d.ts +6 -0
  202. package/dist/src/mcp/token-storage/types.js.map +1 -1
  203. package/dist/src/output/stream-json-formatter.d.ts +32 -0
  204. package/dist/src/output/stream-json-formatter.js +52 -0
  205. package/dist/src/output/stream-json-formatter.js.map +1 -0
  206. package/dist/src/output/stream-json-formatter.test.d.ts +6 -0
  207. package/dist/src/output/stream-json-formatter.test.js +479 -0
  208. package/dist/src/output/stream-json-formatter.test.js.map +1 -0
  209. package/dist/src/output/types.d.ts +63 -1
  210. package/dist/src/output/types.js +11 -0
  211. package/dist/src/output/types.js.map +1 -1
  212. package/dist/src/policy/config.d.ts +31 -0
  213. package/dist/src/policy/config.js +197 -0
  214. package/dist/src/policy/config.js.map +1 -0
  215. package/dist/src/policy/config.test.d.ts +6 -0
  216. package/dist/src/policy/config.test.js +404 -0
  217. package/dist/src/policy/config.test.js.map +1 -0
  218. package/dist/src/policy/index.d.ts +2 -0
  219. package/dist/src/policy/index.js +2 -0
  220. package/dist/src/policy/index.js.map +1 -1
  221. package/dist/src/policy/policies/read-only.toml +56 -0
  222. package/dist/src/policy/policies/write.toml +63 -0
  223. package/dist/src/policy/policies/yolo.toml +31 -0
  224. package/dist/src/policy/policy-engine.js +4 -0
  225. package/dist/src/policy/policy-engine.js.map +1 -1
  226. package/dist/src/policy/toml-loader.d.ts +46 -0
  227. package/dist/src/policy/toml-loader.js +314 -0
  228. package/dist/src/policy/toml-loader.js.map +1 -0
  229. package/dist/src/policy/toml-loader.test.d.ts +6 -0
  230. package/dist/src/policy/toml-loader.test.js +522 -0
  231. package/dist/src/policy/toml-loader.test.js.map +1 -0
  232. package/dist/src/policy/types.d.ts +18 -0
  233. package/dist/src/policy/types.js +6 -0
  234. package/dist/src/policy/types.js.map +1 -1
  235. package/dist/src/prompts/prompt-registry.js +2 -1
  236. package/dist/src/prompts/prompt-registry.js.map +1 -1
  237. package/dist/src/routing/strategies/classifierStrategy.js +3 -2
  238. package/dist/src/routing/strategies/classifierStrategy.js.map +1 -1
  239. package/dist/src/services/chatCompressionService.d.ts +32 -0
  240. package/dist/src/services/chatCompressionService.js +162 -0
  241. package/dist/src/services/chatCompressionService.js.map +1 -0
  242. package/dist/src/services/chatCompressionService.test.d.ts +6 -0
  243. package/dist/src/services/chatCompressionService.test.js +209 -0
  244. package/dist/src/services/chatCompressionService.test.js.map +1 -0
  245. package/dist/src/services/chatRecordingService.js +9 -8
  246. package/dist/src/services/chatRecordingService.js.map +1 -1
  247. package/dist/src/services/fileDiscoveryService.d.ts +2 -14
  248. package/dist/src/services/fileDiscoveryService.js +19 -55
  249. package/dist/src/services/fileDiscoveryService.js.map +1 -1
  250. package/dist/src/services/fileDiscoveryService.test.js +91 -11
  251. package/dist/src/services/fileDiscoveryService.test.js.map +1 -1
  252. package/dist/src/services/loopDetectionService.d.ts +1 -1
  253. package/dist/src/services/loopDetectionService.js +27 -13
  254. package/dist/src/services/loopDetectionService.js.map +1 -1
  255. package/dist/src/services/loopDetectionService.test.js +119 -11
  256. package/dist/src/services/loopDetectionService.test.js.map +1 -1
  257. package/dist/src/services/shellExecutionService.js +50 -23
  258. package/dist/src/services/shellExecutionService.js.map +1 -1
  259. package/dist/src/services/shellExecutionService.test.js +82 -15
  260. package/dist/src/services/shellExecutionService.test.js.map +1 -1
  261. package/dist/src/telemetry/activity-monitor.d.ts +116 -0
  262. package/dist/src/telemetry/activity-monitor.js +209 -0
  263. package/dist/src/telemetry/activity-monitor.js.map +1 -0
  264. package/dist/src/telemetry/activity-monitor.test.d.ts +6 -0
  265. package/dist/src/telemetry/activity-monitor.test.js +248 -0
  266. package/dist/src/telemetry/activity-monitor.test.js.map +1 -0
  267. package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +5 -1
  268. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +135 -57
  269. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
  270. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +43 -75
  271. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -1
  272. package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +7 -1
  273. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +13 -1
  274. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
  275. package/dist/src/telemetry/gcp-exporters.js +0 -1
  276. package/dist/src/telemetry/gcp-exporters.js.map +1 -1
  277. package/dist/src/telemetry/gcp-exporters.test.js +1 -1
  278. package/dist/src/telemetry/gcp-exporters.test.js.map +1 -1
  279. package/dist/src/telemetry/index.d.ts +4 -2
  280. package/dist/src/telemetry/index.js +5 -3
  281. package/dist/src/telemetry/index.js.map +1 -1
  282. package/dist/src/telemetry/loggers.d.ts +2 -1
  283. package/dist/src/telemetry/loggers.js +37 -26
  284. package/dist/src/telemetry/loggers.js.map +1 -1
  285. package/dist/src/telemetry/loggers.test.js +215 -56
  286. package/dist/src/telemetry/loggers.test.js.map +1 -1
  287. package/dist/src/telemetry/metrics.d.ts +55 -6
  288. package/dist/src/telemetry/metrics.js +89 -1
  289. package/dist/src/telemetry/metrics.js.map +1 -1
  290. package/dist/src/telemetry/metrics.test.js +172 -213
  291. package/dist/src/telemetry/metrics.test.js.map +1 -1
  292. package/dist/src/telemetry/sdk.js +3 -2
  293. package/dist/src/telemetry/sdk.js.map +1 -1
  294. package/dist/src/telemetry/semantic.d.ts +82 -0
  295. package/dist/src/telemetry/semantic.js +269 -0
  296. package/dist/src/telemetry/semantic.js.map +1 -0
  297. package/dist/src/telemetry/semantic.test.d.ts +6 -0
  298. package/dist/src/telemetry/semantic.test.js +387 -0
  299. package/dist/src/telemetry/semantic.test.js.map +1 -0
  300. package/dist/src/telemetry/telemetry-utils.test.js +29 -28
  301. package/dist/src/telemetry/telemetry-utils.test.js.map +1 -1
  302. package/dist/src/telemetry/trace.d.ts +46 -0
  303. package/dist/src/telemetry/trace.js +121 -0
  304. package/dist/src/telemetry/trace.js.map +1 -0
  305. package/dist/src/telemetry/types.d.ts +79 -34
  306. package/dist/src/telemetry/types.js +191 -61
  307. package/dist/src/telemetry/types.js.map +1 -1
  308. package/dist/src/telemetry/uiTelemetry.js +6 -6
  309. package/dist/src/telemetry/uiTelemetry.js.map +1 -1
  310. package/dist/src/telemetry/uiTelemetry.test.js +88 -66
  311. package/dist/src/telemetry/uiTelemetry.test.js.map +1 -1
  312. package/dist/src/tools/edit.d.ts +3 -2
  313. package/dist/src/tools/edit.js +24 -19
  314. package/dist/src/tools/edit.js.map +1 -1
  315. package/dist/src/tools/edit.test.js +78 -2
  316. package/dist/src/tools/edit.test.js.map +1 -1
  317. package/dist/src/tools/glob.d.ts +3 -2
  318. package/dist/src/tools/glob.js +15 -19
  319. package/dist/src/tools/glob.js.map +1 -1
  320. package/dist/src/tools/glob.test.js +203 -199
  321. package/dist/src/tools/glob.test.js.map +1 -1
  322. package/dist/src/tools/grep.d.ts +3 -2
  323. package/dist/src/tools/grep.js +22 -16
  324. package/dist/src/tools/grep.js.map +1 -1
  325. package/dist/src/tools/ls.d.ts +3 -2
  326. package/dist/src/tools/ls.js +15 -20
  327. package/dist/src/tools/ls.js.map +1 -1
  328. package/dist/src/tools/ls.test.js +2 -9
  329. package/dist/src/tools/ls.test.js.map +1 -1
  330. package/dist/src/tools/mcp-client-manager.d.ts +49 -11
  331. package/dist/src/tools/mcp-client-manager.js +209 -31
  332. package/dist/src/tools/mcp-client-manager.js.map +1 -1
  333. package/dist/src/tools/mcp-client-manager.test.js +132 -25
  334. package/dist/src/tools/mcp-client-manager.test.js.map +1 -1
  335. package/dist/src/tools/mcp-client.d.ts +5 -1
  336. package/dist/src/tools/mcp-client.js +85 -104
  337. package/dist/src/tools/mcp-client.js.map +1 -1
  338. package/dist/src/tools/mcp-client.test.js +65 -6
  339. package/dist/src/tools/mcp-client.test.js.map +1 -1
  340. package/dist/src/tools/mcp-tool.d.ts +5 -2
  341. package/dist/src/tools/mcp-tool.js +16 -8
  342. package/dist/src/tools/mcp-tool.js.map +1 -1
  343. package/dist/src/tools/memoryTool.d.ts +6 -4
  344. package/dist/src/tools/memoryTool.js +13 -10
  345. package/dist/src/tools/memoryTool.js.map +1 -1
  346. package/dist/src/tools/message-bus-integration.test.js +14 -1
  347. package/dist/src/tools/message-bus-integration.test.js.map +1 -1
  348. package/dist/src/tools/modifiable-tool.js +3 -2
  349. package/dist/src/tools/modifiable-tool.js.map +1 -1
  350. package/dist/src/tools/read-file.d.ts +4 -3
  351. package/dist/src/tools/read-file.js +16 -11
  352. package/dist/src/tools/read-file.js.map +1 -1
  353. package/dist/src/tools/read-file.test.js +25 -2
  354. package/dist/src/tools/read-file.test.js.map +1 -1
  355. package/dist/src/tools/read-many-files.d.ts +4 -3
  356. package/dist/src/tools/read-many-files.js +19 -37
  357. package/dist/src/tools/read-many-files.js.map +1 -1
  358. package/dist/src/tools/read-many-files.test.js +0 -1
  359. package/dist/src/tools/read-many-files.test.js.map +1 -1
  360. package/dist/src/tools/ripGrep.d.ts +3 -2
  361. package/dist/src/tools/ripGrep.js +47 -17
  362. package/dist/src/tools/ripGrep.js.map +1 -1
  363. package/dist/src/tools/ripGrep.test.js +106 -60
  364. package/dist/src/tools/ripGrep.test.js.map +1 -1
  365. package/dist/src/tools/shell.d.ts +7 -5
  366. package/dist/src/tools/shell.js +39 -68
  367. package/dist/src/tools/shell.js.map +1 -1
  368. package/dist/src/tools/shell.test.js +69 -9
  369. package/dist/src/tools/shell.test.js.map +1 -1
  370. package/dist/src/tools/smart-edit.d.ts +3 -2
  371. package/dist/src/tools/smart-edit.js +30 -18
  372. package/dist/src/tools/smart-edit.js.map +1 -1
  373. package/dist/src/tools/smart-edit.test.js +62 -2
  374. package/dist/src/tools/smart-edit.test.js.map +1 -1
  375. package/dist/src/tools/tool-names.d.ts +8 -0
  376. package/dist/src/tools/tool-names.js +8 -5
  377. package/dist/src/tools/tool-names.js.map +1 -1
  378. package/dist/src/tools/tool-registry.d.ts +6 -19
  379. package/dist/src/tools/tool-registry.js +14 -49
  380. package/dist/src/tools/tool-registry.js.map +1 -1
  381. package/dist/src/tools/tool-registry.test.js +2 -24
  382. package/dist/src/tools/tool-registry.test.js.map +1 -1
  383. package/dist/src/tools/tools.d.ts +22 -8
  384. package/dist/src/tools/tools.js +65 -36
  385. package/dist/src/tools/tools.js.map +1 -1
  386. package/dist/src/tools/web-fetch.d.ts +4 -3
  387. package/dist/src/tools/web-fetch.js +37 -25
  388. package/dist/src/tools/web-fetch.js.map +1 -1
  389. package/dist/src/tools/web-fetch.test.js +262 -1
  390. package/dist/src/tools/web-fetch.test.js.map +1 -1
  391. package/dist/src/tools/web-search.d.ts +4 -3
  392. package/dist/src/tools/web-search.js +8 -6
  393. package/dist/src/tools/web-search.js.map +1 -1
  394. package/dist/src/tools/write-file.d.ts +3 -2
  395. package/dist/src/tools/write-file.js +8 -8
  396. package/dist/src/tools/write-file.js.map +1 -1
  397. package/dist/src/tools/write-file.test.js +1 -2
  398. package/dist/src/tools/write-file.test.js.map +1 -1
  399. package/dist/src/tools/write-todos.d.ts +4 -8
  400. package/dist/src/tools/write-todos.js +15 -6
  401. package/dist/src/tools/write-todos.js.map +1 -1
  402. package/dist/src/tools/write-todos.test.js +2 -2
  403. package/dist/src/tools/write-todos.test.js.map +1 -1
  404. package/dist/src/utils/bfsFileSearch.js +3 -2
  405. package/dist/src/utils/bfsFileSearch.js.map +1 -1
  406. package/dist/src/utils/channel.d.ts +19 -0
  407. package/dist/src/utils/channel.js +49 -0
  408. package/dist/src/utils/channel.js.map +1 -0
  409. package/dist/src/utils/channel.test.d.ts +6 -0
  410. package/dist/src/utils/channel.test.js +170 -0
  411. package/dist/src/utils/channel.test.js.map +1 -0
  412. package/dist/src/utils/debugLogger.d.ts +25 -0
  413. package/dist/src/utils/debugLogger.js +33 -0
  414. package/dist/src/utils/debugLogger.js.map +1 -0
  415. package/dist/src/utils/debugLogger.test.d.ts +6 -0
  416. package/dist/src/utils/debugLogger.test.js +67 -0
  417. package/dist/src/utils/debugLogger.test.js.map +1 -0
  418. package/dist/src/utils/delay.d.ts +16 -0
  419. package/dist/src/utils/delay.js +43 -0
  420. package/dist/src/utils/delay.js.map +1 -0
  421. package/dist/src/utils/delay.test.d.ts +6 -0
  422. package/dist/src/utils/delay.test.js +88 -0
  423. package/dist/src/utils/delay.test.js.map +1 -0
  424. package/dist/src/utils/editCorrector.js +5 -9
  425. package/dist/src/utils/editCorrector.js.map +1 -1
  426. package/dist/src/utils/editCorrector.test.js +3 -5
  427. package/dist/src/utils/editCorrector.test.js.map +1 -1
  428. package/dist/src/utils/editor.js +33 -38
  429. package/dist/src/utils/editor.js.map +1 -1
  430. package/dist/src/utils/environmentContext.d.ts +2 -1
  431. package/dist/src/utils/environmentContext.js +18 -33
  432. package/dist/src/utils/environmentContext.js.map +1 -1
  433. package/dist/src/utils/environmentContext.test.js +0 -34
  434. package/dist/src/utils/environmentContext.test.js.map +1 -1
  435. package/dist/src/utils/errorParsing.d.ts +1 -1
  436. package/dist/src/utils/errorParsing.js +5 -33
  437. package/dist/src/utils/errorParsing.js.map +1 -1
  438. package/dist/src/utils/errorParsing.test.js +0 -88
  439. package/dist/src/utils/errorParsing.test.js.map +1 -1
  440. package/dist/src/utils/errors.d.ts +3 -0
  441. package/dist/src/utils/errors.js +6 -0
  442. package/dist/src/utils/errors.js.map +1 -1
  443. package/dist/src/utils/events.d.ts +88 -0
  444. package/dist/src/utils/events.js +77 -0
  445. package/dist/src/utils/events.js.map +1 -0
  446. package/dist/src/utils/events.test.d.ts +6 -0
  447. package/dist/src/utils/events.test.js +131 -0
  448. package/dist/src/utils/events.test.js.map +1 -0
  449. package/dist/src/utils/extensionLoader.d.ts +78 -0
  450. package/dist/src/utils/extensionLoader.js +162 -0
  451. package/dist/src/utils/extensionLoader.js.map +1 -0
  452. package/dist/src/utils/extensionLoader.test.d.ts +6 -0
  453. package/dist/src/utils/extensionLoader.test.js +90 -0
  454. package/dist/src/utils/extensionLoader.test.js.map +1 -0
  455. package/dist/src/utils/fetch.d.ts +1 -0
  456. package/dist/src/utils/fetch.js +4 -0
  457. package/dist/src/utils/fetch.js.map +1 -1
  458. package/dist/src/utils/fileUtils.d.ts +4 -0
  459. package/dist/src/utils/fileUtils.js +34 -2
  460. package/dist/src/utils/fileUtils.js.map +1 -1
  461. package/dist/src/utils/fileUtils.test.js +12 -1
  462. package/dist/src/utils/fileUtils.test.js.map +1 -1
  463. package/dist/src/utils/flashFallback.test.js +26 -45
  464. package/dist/src/utils/flashFallback.test.js.map +1 -1
  465. package/dist/src/utils/getFolderStructure.js +9 -17
  466. package/dist/src/utils/getFolderStructure.js.map +1 -1
  467. package/dist/src/utils/gitIgnoreParser.d.ts +4 -1
  468. package/dist/src/utils/gitIgnoreParser.js +28 -10
  469. package/dist/src/utils/gitIgnoreParser.js.map +1 -1
  470. package/dist/src/utils/gitIgnoreParser.test.js +58 -0
  471. package/dist/src/utils/gitIgnoreParser.test.js.map +1 -1
  472. package/dist/src/utils/googleErrors.d.ts +104 -0
  473. package/dist/src/utils/googleErrors.js +152 -0
  474. package/dist/src/utils/googleErrors.js.map +1 -0
  475. package/dist/src/utils/googleErrors.test.d.ts +6 -0
  476. package/dist/src/utils/googleErrors.test.js +301 -0
  477. package/dist/src/utils/googleErrors.test.js.map +1 -0
  478. package/dist/src/utils/googleQuotaErrors.d.ts +36 -0
  479. package/dist/src/utils/googleQuotaErrors.js +149 -0
  480. package/dist/src/utils/googleQuotaErrors.js.map +1 -0
  481. package/dist/src/utils/googleQuotaErrors.test.d.ts +6 -0
  482. package/dist/src/utils/googleQuotaErrors.test.js +311 -0
  483. package/dist/src/utils/googleQuotaErrors.test.js.map +1 -0
  484. package/dist/src/utils/ignorePatterns.test.js +26 -30
  485. package/dist/src/utils/ignorePatterns.test.js.map +1 -1
  486. package/dist/src/utils/installationManager.js +2 -1
  487. package/dist/src/utils/installationManager.js.map +1 -1
  488. package/dist/src/utils/installationManager.test.js +3 -3
  489. package/dist/src/utils/installationManager.test.js.map +1 -1
  490. package/dist/src/utils/llm-edit-fixer.d.ts +1 -1
  491. package/dist/src/utils/llm-edit-fixer.js +29 -4
  492. package/dist/src/utils/llm-edit-fixer.js.map +1 -1
  493. package/dist/src/utils/llm-edit-fixer.test.js +21 -0
  494. package/dist/src/utils/llm-edit-fixer.test.js.map +1 -1
  495. package/dist/src/utils/memoryDiscovery.d.ts +11 -1
  496. package/dist/src/utils/memoryDiscovery.js +150 -11
  497. package/dist/src/utils/memoryDiscovery.js.map +1 -1
  498. package/dist/src/utils/memoryDiscovery.test.js +157 -19
  499. package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
  500. package/dist/src/utils/memoryImportProcessor.js +3 -2
  501. package/dist/src/utils/memoryImportProcessor.js.map +1 -1
  502. package/dist/src/utils/nextSpeakerChecker.js +2 -1
  503. package/dist/src/utils/nextSpeakerChecker.js.map +1 -1
  504. package/dist/src/utils/package.d.ts +12 -0
  505. package/dist/src/utils/package.js +15 -0
  506. package/dist/src/utils/package.js.map +1 -0
  507. package/dist/src/utils/paths.js +126 -26
  508. package/dist/src/utils/paths.js.map +1 -1
  509. package/dist/src/utils/paths.test.js +200 -68
  510. package/dist/src/utils/paths.test.js.map +1 -1
  511. package/dist/src/utils/quotaErrorDetection.d.ts +0 -2
  512. package/dist/src/utils/quotaErrorDetection.js +0 -46
  513. package/dist/src/utils/quotaErrorDetection.js.map +1 -1
  514. package/dist/src/utils/retry.d.ts +1 -0
  515. package/dist/src/utils/retry.js +57 -158
  516. package/dist/src/utils/retry.js.map +1 -1
  517. package/dist/src/utils/retry.test.js +48 -109
  518. package/dist/src/utils/retry.test.js.map +1 -1
  519. package/dist/src/utils/safeJsonStringify.d.ts +4 -4
  520. package/dist/src/utils/safeJsonStringify.js +31 -7
  521. package/dist/src/utils/safeJsonStringify.js.map +1 -1
  522. package/dist/src/utils/shell-utils.d.ts +14 -2
  523. package/dist/src/utils/shell-utils.js +381 -136
  524. package/dist/src/utils/shell-utils.js.map +1 -1
  525. package/dist/src/utils/shell-utils.test.js +242 -60
  526. package/dist/src/utils/shell-utils.test.js.map +1 -1
  527. package/dist/src/utils/summarizer.js +2 -1
  528. package/dist/src/utils/summarizer.js.map +1 -1
  529. package/dist/src/utils/summarizer.test.js +0 -1
  530. package/dist/src/utils/summarizer.test.js.map +1 -1
  531. package/dist/src/utils/systemEncoding.js +5 -4
  532. package/dist/src/utils/systemEncoding.js.map +1 -1
  533. package/dist/src/utils/tool-utils.d.ts +2 -2
  534. package/dist/src/utils/tool-utils.js +14 -5
  535. package/dist/src/utils/tool-utils.js.map +1 -1
  536. package/dist/src/utils/userAccountManager.js +5 -4
  537. package/dist/src/utils/userAccountManager.js.map +1 -1
  538. package/dist/src/utils/workspaceContext.js +3 -2
  539. package/dist/src/utils/workspaceContext.js.map +1 -1
  540. package/dist/src/utils/workspaceContext.test.js +2 -2
  541. package/dist/src/utils/workspaceContext.test.js.map +1 -1
  542. package/dist/tsconfig.tsbuildinfo +1 -1
  543. package/package.json +13 -5
  544. package/dist/src/core/subagent.d.ts +0 -236
  545. package/dist/src/core/subagent.js +0 -482
  546. package/dist/src/core/subagent.js.map +0 -1
  547. package/dist/src/core/subagent.test.js +0 -556
  548. package/dist/src/core/subagent.test.js.map +0 -1
  549. /package/dist/src/{core/subagent.test.d.ts → commands/extensions.test.d.ts} +0 -0
@@ -0,0 +1,113 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { GenerateContentResponse, GenerateContentParameters, ToolConfig } from '@google/genai';
7
+ /**
8
+ * Decoupled LLM request format - stable across Gemini CLI versions
9
+ */
10
+ export interface LLMRequest {
11
+ model: string;
12
+ messages: Array<{
13
+ role: 'user' | 'model' | 'system';
14
+ content: string | Array<{
15
+ type: string;
16
+ [key: string]: unknown;
17
+ }>;
18
+ }>;
19
+ config?: {
20
+ temperature?: number;
21
+ maxOutputTokens?: number;
22
+ topP?: number;
23
+ topK?: number;
24
+ stopSequences?: string[];
25
+ candidateCount?: number;
26
+ presencePenalty?: number;
27
+ frequencyPenalty?: number;
28
+ [key: string]: unknown;
29
+ };
30
+ toolConfig?: HookToolConfig;
31
+ }
32
+ /**
33
+ * Decoupled LLM response format - stable across Gemini CLI versions
34
+ */
35
+ export interface LLMResponse {
36
+ text?: string;
37
+ candidates: Array<{
38
+ content: {
39
+ role: 'model';
40
+ parts: string[];
41
+ };
42
+ finishReason?: 'STOP' | 'MAX_TOKENS' | 'SAFETY' | 'RECITATION' | 'OTHER';
43
+ index?: number;
44
+ safetyRatings?: Array<{
45
+ category: string;
46
+ probability: string;
47
+ blocked?: boolean;
48
+ }>;
49
+ }>;
50
+ usageMetadata?: {
51
+ promptTokenCount?: number;
52
+ candidatesTokenCount?: number;
53
+ totalTokenCount?: number;
54
+ };
55
+ }
56
+ /**
57
+ * Decoupled tool configuration - stable across Gemini CLI versions
58
+ */
59
+ export interface HookToolConfig {
60
+ mode?: 'AUTO' | 'ANY' | 'NONE';
61
+ allowedFunctionNames?: string[];
62
+ }
63
+ /**
64
+ * Base class for hook translators - handles version-specific translation logic
65
+ */
66
+ export declare abstract class HookTranslator {
67
+ abstract toHookLLMRequest(sdkRequest: GenerateContentParameters): LLMRequest;
68
+ abstract fromHookLLMRequest(hookRequest: LLMRequest, baseRequest?: GenerateContentParameters): GenerateContentParameters;
69
+ abstract toHookLLMResponse(sdkResponse: GenerateContentResponse): LLMResponse;
70
+ abstract fromHookLLMResponse(hookResponse: LLMResponse): GenerateContentResponse;
71
+ abstract toHookToolConfig(sdkToolConfig: ToolConfig): HookToolConfig;
72
+ abstract fromHookToolConfig(hookToolConfig: HookToolConfig): ToolConfig;
73
+ }
74
+ /**
75
+ * Hook translator for GenAI SDK v1.x
76
+ * Handles translation between GenAI SDK types and stable Hook API types
77
+ */
78
+ export declare class HookTranslatorGenAIv1 extends HookTranslator {
79
+ /**
80
+ * Convert genai SDK GenerateContentParameters to stable LLMRequest
81
+ *
82
+ * Note: This implementation intentionally extracts only text content from parts.
83
+ * Non-text parts (images, function calls, etc.) are filtered out in v1 to provide
84
+ * a simplified, stable interface for hooks. This allows hooks to focus on text
85
+ * manipulation without needing to handle complex multimodal content.
86
+ * Future versions may expose additional content types if needed.
87
+ */
88
+ toHookLLMRequest(sdkRequest: GenerateContentParameters): LLMRequest;
89
+ /**
90
+ * Convert stable LLMRequest to genai SDK GenerateContentParameters
91
+ */
92
+ fromHookLLMRequest(hookRequest: LLMRequest, baseRequest?: GenerateContentParameters): GenerateContentParameters;
93
+ /**
94
+ * Convert genai SDK GenerateContentResponse to stable LLMResponse
95
+ */
96
+ toHookLLMResponse(sdkResponse: GenerateContentResponse): LLMResponse;
97
+ /**
98
+ * Convert stable LLMResponse to genai SDK GenerateContentResponse
99
+ */
100
+ fromHookLLMResponse(hookResponse: LLMResponse): GenerateContentResponse;
101
+ /**
102
+ * Convert genai SDK ToolConfig to stable HookToolConfig
103
+ */
104
+ toHookToolConfig(sdkToolConfig: ToolConfig): HookToolConfig;
105
+ /**
106
+ * Convert stable HookToolConfig to genai SDK ToolConfig
107
+ */
108
+ fromHookToolConfig(hookToolConfig: HookToolConfig): ToolConfig;
109
+ }
110
+ /**
111
+ * Default translator instance for current GenAI SDK version
112
+ */
113
+ export declare const defaultHookTranslator: HookTranslatorGenAIv1;
@@ -0,0 +1,232 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js';
7
+ /**
8
+ * Base class for hook translators - handles version-specific translation logic
9
+ */
10
+ export class HookTranslator {
11
+ }
12
+ /**
13
+ * Type guard to check if a value has a text property
14
+ */
15
+ function hasTextProperty(value) {
16
+ return (typeof value === 'object' &&
17
+ value !== null &&
18
+ 'text' in value &&
19
+ typeof value.text === 'string');
20
+ }
21
+ /**
22
+ * Type guard to check if content has role and parts properties
23
+ */
24
+ function isContentWithParts(content) {
25
+ return (typeof content === 'object' &&
26
+ content !== null &&
27
+ 'role' in content &&
28
+ 'parts' in content);
29
+ }
30
+ /**
31
+ * Helper to safely extract generation config from SDK request
32
+ * The SDK uses a config field that contains generation parameters
33
+ */
34
+ function extractGenerationConfig(request) {
35
+ // Access the config field which contains generation settings
36
+ // Use type assertion after checking the field exists
37
+ if (request.config && typeof request.config === 'object') {
38
+ const config = request.config;
39
+ return {
40
+ temperature: config.temperature,
41
+ maxOutputTokens: config.maxOutputTokens,
42
+ topP: config.topP,
43
+ topK: config.topK,
44
+ };
45
+ }
46
+ return undefined;
47
+ }
48
+ /**
49
+ * Hook translator for GenAI SDK v1.x
50
+ * Handles translation between GenAI SDK types and stable Hook API types
51
+ */
52
+ export class HookTranslatorGenAIv1 extends HookTranslator {
53
+ /**
54
+ * Convert genai SDK GenerateContentParameters to stable LLMRequest
55
+ *
56
+ * Note: This implementation intentionally extracts only text content from parts.
57
+ * Non-text parts (images, function calls, etc.) are filtered out in v1 to provide
58
+ * a simplified, stable interface for hooks. This allows hooks to focus on text
59
+ * manipulation without needing to handle complex multimodal content.
60
+ * Future versions may expose additional content types if needed.
61
+ */
62
+ toHookLLMRequest(sdkRequest) {
63
+ const messages = [];
64
+ // Convert contents to messages format (simplified)
65
+ if (sdkRequest.contents) {
66
+ const contents = Array.isArray(sdkRequest.contents)
67
+ ? sdkRequest.contents
68
+ : [sdkRequest.contents];
69
+ for (const content of contents) {
70
+ if (typeof content === 'string') {
71
+ messages.push({
72
+ role: 'user',
73
+ content,
74
+ });
75
+ }
76
+ else if (isContentWithParts(content)) {
77
+ const role = content.role === 'model'
78
+ ? 'model'
79
+ : content.role === 'system'
80
+ ? 'system'
81
+ : 'user';
82
+ const parts = Array.isArray(content.parts)
83
+ ? content.parts
84
+ : [content.parts];
85
+ // Extract only text parts - intentionally filtering out non-text content
86
+ const textContent = parts
87
+ .filter(hasTextProperty)
88
+ .map((part) => part.text)
89
+ .join('');
90
+ // Only add message if there's text content
91
+ if (textContent) {
92
+ messages.push({
93
+ role,
94
+ content: textContent,
95
+ });
96
+ }
97
+ }
98
+ }
99
+ }
100
+ // Safely extract generation config using proper type access
101
+ const config = extractGenerationConfig(sdkRequest);
102
+ return {
103
+ model: sdkRequest.model || DEFAULT_GEMINI_FLASH_MODEL,
104
+ messages,
105
+ config: {
106
+ temperature: config?.temperature,
107
+ maxOutputTokens: config?.maxOutputTokens,
108
+ topP: config?.topP,
109
+ topK: config?.topK,
110
+ },
111
+ };
112
+ }
113
+ /**
114
+ * Convert stable LLMRequest to genai SDK GenerateContentParameters
115
+ */
116
+ fromHookLLMRequest(hookRequest, baseRequest) {
117
+ // Convert hook messages back to SDK Content format
118
+ const contents = hookRequest.messages.map((message) => ({
119
+ role: message.role === 'model' ? 'model' : message.role,
120
+ parts: [
121
+ {
122
+ text: typeof message.content === 'string'
123
+ ? message.content
124
+ : String(message.content),
125
+ },
126
+ ],
127
+ }));
128
+ // Build the result with proper typing
129
+ const result = {
130
+ ...baseRequest,
131
+ model: hookRequest.model,
132
+ contents,
133
+ };
134
+ // Add generation config if it exists in the hook request
135
+ if (hookRequest.config) {
136
+ const baseConfig = baseRequest
137
+ ? extractGenerationConfig(baseRequest)
138
+ : undefined;
139
+ result.config = {
140
+ ...baseConfig,
141
+ temperature: hookRequest.config.temperature,
142
+ maxOutputTokens: hookRequest.config.maxOutputTokens,
143
+ topP: hookRequest.config.topP,
144
+ topK: hookRequest.config.topK,
145
+ };
146
+ }
147
+ return result;
148
+ }
149
+ /**
150
+ * Convert genai SDK GenerateContentResponse to stable LLMResponse
151
+ */
152
+ toHookLLMResponse(sdkResponse) {
153
+ return {
154
+ text: sdkResponse.text,
155
+ candidates: (sdkResponse.candidates || []).map((candidate) => {
156
+ // Extract text parts from the candidate
157
+ const textParts = candidate.content?.parts
158
+ ?.filter(hasTextProperty)
159
+ .map((part) => part.text) || [];
160
+ return {
161
+ content: {
162
+ role: 'model',
163
+ parts: textParts,
164
+ },
165
+ finishReason: candidate.finishReason,
166
+ index: candidate.index,
167
+ safetyRatings: candidate.safetyRatings?.map((rating) => ({
168
+ category: String(rating.category || ''),
169
+ probability: String(rating.probability || ''),
170
+ })),
171
+ };
172
+ }),
173
+ usageMetadata: sdkResponse.usageMetadata
174
+ ? {
175
+ promptTokenCount: sdkResponse.usageMetadata.promptTokenCount,
176
+ candidatesTokenCount: sdkResponse.usageMetadata.candidatesTokenCount,
177
+ totalTokenCount: sdkResponse.usageMetadata.totalTokenCount,
178
+ }
179
+ : undefined,
180
+ };
181
+ }
182
+ /**
183
+ * Convert stable LLMResponse to genai SDK GenerateContentResponse
184
+ */
185
+ fromHookLLMResponse(hookResponse) {
186
+ // Build response object with proper structure
187
+ const response = {
188
+ text: hookResponse.text,
189
+ candidates: hookResponse.candidates.map((candidate) => ({
190
+ content: {
191
+ role: 'model',
192
+ parts: candidate.content.parts.map((part) => ({
193
+ text: part,
194
+ })),
195
+ },
196
+ finishReason: candidate.finishReason,
197
+ index: candidate.index,
198
+ safetyRatings: candidate.safetyRatings,
199
+ })),
200
+ usageMetadata: hookResponse.usageMetadata,
201
+ };
202
+ return response;
203
+ }
204
+ /**
205
+ * Convert genai SDK ToolConfig to stable HookToolConfig
206
+ */
207
+ toHookToolConfig(sdkToolConfig) {
208
+ return {
209
+ mode: sdkToolConfig.functionCallingConfig?.mode,
210
+ allowedFunctionNames: sdkToolConfig.functionCallingConfig?.allowedFunctionNames,
211
+ };
212
+ }
213
+ /**
214
+ * Convert stable HookToolConfig to genai SDK ToolConfig
215
+ */
216
+ fromHookToolConfig(hookToolConfig) {
217
+ const functionCallingConfig = hookToolConfig.mode || hookToolConfig.allowedFunctionNames
218
+ ? {
219
+ mode: hookToolConfig.mode,
220
+ allowedFunctionNames: hookToolConfig.allowedFunctionNames,
221
+ }
222
+ : undefined;
223
+ return {
224
+ functionCallingConfig,
225
+ };
226
+ }
227
+ }
228
+ /**
229
+ * Default translator instance for current GenAI SDK version
230
+ */
231
+ export const defaultHookTranslator = new HookTranslatorGenAIv1();
232
+ //# sourceMappingURL=hookTranslator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hookTranslator.js","sourceRoot":"","sources":["../../../src/hooks/hookTranslator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AA0DjE;;GAEG;AACH,MAAM,OAAgB,cAAc;CAYnC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,KAAc;IACrC,O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GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;wBAC5C,IAAI,EAAE,IAAI;qBACX,CAAC,CAAC;iBACJ;gBACD,YAAY,EAAE,SAAS,CAAC,YAA4B;gBACpD,KAAK,EAAE,SAAS,CAAC,KAAK;gBACtB,aAAa,EAAE,SAAS,CAAC,aAAa;aACvC,CAAC,CAAC;YACH,aAAa,EAAE,YAAY,CAAC,aAAa;SACf,CAAC;QAE7B,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;OAEG;IACH,gBAAgB,CAAC,aAAyB;QACxC,OAAO;YACL,IAAI,EAAE,aAAa,CAAC,qBAAqB,EAAE,IAA8B;YACzE,oBAAoB,EAClB,aAAa,CAAC,qBAAqB,EAAE,oBAAoB;SAC5D,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,kBAAkB,CAAC,cAA8B;QAC/C,MAAM,qBAAqB,GACzB,cAAc,CAAC,IAAI,IAAI,cAAc,CAAC,oBAAoB;YACxD,CAAC,CAAE;gBACC,IAAI,EAAE,cAAc,CAAC,IAAI;gBACzB,oBAAoB,EAAE,cAAc,CAAC,oBAAoB;aAChC;YAC7B,CAAC,CAAC,SAAS,CAAC;QAEhB,OAAO;YACL,qBAAqB;SACtB,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ export {};
@@ -0,0 +1,192 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { describe, it, expect, beforeEach } from 'vitest';
7
+ import { HookTranslatorGenAIv1, defaultHookTranslator, } from './hookTranslator.js';
8
+ describe('HookTranslator', () => {
9
+ let translator;
10
+ beforeEach(() => {
11
+ translator = new HookTranslatorGenAIv1();
12
+ });
13
+ describe('defaultHookTranslator', () => {
14
+ it('should be an instance of HookTranslatorGenAIv1', () => {
15
+ expect(defaultHookTranslator).toBeInstanceOf(HookTranslatorGenAIv1);
16
+ });
17
+ });
18
+ describe('LLM Request Translation', () => {
19
+ it('should convert SDK request to hook format', () => {
20
+ const sdkRequest = {
21
+ model: 'gemini-1.5-flash',
22
+ contents: [
23
+ {
24
+ role: 'user',
25
+ parts: [{ text: 'Hello world' }],
26
+ },
27
+ ],
28
+ config: {
29
+ temperature: 0.7,
30
+ maxOutputTokens: 1000,
31
+ },
32
+ };
33
+ const hookRequest = translator.toHookLLMRequest(sdkRequest);
34
+ expect(hookRequest).toEqual({
35
+ model: 'gemini-1.5-flash',
36
+ messages: [
37
+ {
38
+ role: 'user',
39
+ content: 'Hello world',
40
+ },
41
+ ],
42
+ config: {
43
+ temperature: 0.7,
44
+ maxOutputTokens: 1000,
45
+ topP: undefined,
46
+ topK: undefined,
47
+ },
48
+ });
49
+ });
50
+ it('should handle string contents', () => {
51
+ const sdkRequest = {
52
+ model: 'gemini-1.5-flash',
53
+ contents: ['Simple string message'],
54
+ };
55
+ const hookRequest = translator.toHookLLMRequest(sdkRequest);
56
+ expect(hookRequest.messages).toEqual([
57
+ {
58
+ role: 'user',
59
+ content: 'Simple string message',
60
+ },
61
+ ]);
62
+ });
63
+ it('should handle conversion errors gracefully', () => {
64
+ const sdkRequest = {
65
+ model: 'gemini-1.5-flash',
66
+ contents: [null], // Invalid content
67
+ };
68
+ const hookRequest = translator.toHookLLMRequest(sdkRequest);
69
+ // When contents are invalid, the translator skips them and returns empty messages
70
+ expect(hookRequest.messages).toEqual([]);
71
+ expect(hookRequest.model).toBe('gemini-1.5-flash');
72
+ });
73
+ it('should convert hook request back to SDK format', () => {
74
+ const hookRequest = {
75
+ model: 'gemini-1.5-flash',
76
+ messages: [
77
+ {
78
+ role: 'user',
79
+ content: 'Hello world',
80
+ },
81
+ ],
82
+ config: {
83
+ temperature: 0.7,
84
+ maxOutputTokens: 1000,
85
+ },
86
+ };
87
+ const sdkRequest = translator.fromHookLLMRequest(hookRequest);
88
+ expect(sdkRequest.model).toBe('gemini-1.5-flash');
89
+ expect(sdkRequest.contents).toEqual([
90
+ {
91
+ role: 'user',
92
+ parts: [{ text: 'Hello world' }],
93
+ },
94
+ ]);
95
+ });
96
+ });
97
+ describe('LLM Response Translation', () => {
98
+ it('should convert SDK response to hook format', () => {
99
+ const sdkResponse = {
100
+ text: 'Hello response',
101
+ candidates: [
102
+ {
103
+ content: {
104
+ role: 'model',
105
+ parts: [{ text: 'Hello response' }],
106
+ },
107
+ finishReason: 'STOP',
108
+ index: 0,
109
+ },
110
+ ],
111
+ usageMetadata: {
112
+ promptTokenCount: 10,
113
+ candidatesTokenCount: 20,
114
+ totalTokenCount: 30,
115
+ },
116
+ };
117
+ const hookResponse = translator.toHookLLMResponse(sdkResponse);
118
+ expect(hookResponse).toEqual({
119
+ text: 'Hello response',
120
+ candidates: [
121
+ {
122
+ content: {
123
+ role: 'model',
124
+ parts: ['Hello response'],
125
+ },
126
+ finishReason: 'STOP',
127
+ index: 0,
128
+ safetyRatings: undefined,
129
+ },
130
+ ],
131
+ usageMetadata: {
132
+ promptTokenCount: 10,
133
+ candidatesTokenCount: 20,
134
+ totalTokenCount: 30,
135
+ },
136
+ });
137
+ });
138
+ it('should convert hook response back to SDK format', () => {
139
+ const hookResponse = {
140
+ text: 'Hello response',
141
+ candidates: [
142
+ {
143
+ content: {
144
+ role: 'model',
145
+ parts: ['Hello response'],
146
+ },
147
+ finishReason: 'STOP',
148
+ },
149
+ ],
150
+ };
151
+ const sdkResponse = translator.fromHookLLMResponse(hookResponse);
152
+ expect(sdkResponse.text).toBe('Hello response');
153
+ expect(sdkResponse.candidates).toHaveLength(1);
154
+ expect(sdkResponse.candidates?.[0]?.content?.parts?.[0]?.text).toBe('Hello response');
155
+ });
156
+ });
157
+ describe('Tool Config Translation', () => {
158
+ it('should convert SDK tool config to hook format', () => {
159
+ const sdkToolConfig = {
160
+ functionCallingConfig: {
161
+ mode: 'ANY',
162
+ allowedFunctionNames: ['tool1', 'tool2'],
163
+ },
164
+ };
165
+ const hookToolConfig = translator.toHookToolConfig(sdkToolConfig);
166
+ expect(hookToolConfig).toEqual({
167
+ mode: 'ANY',
168
+ allowedFunctionNames: ['tool1', 'tool2'],
169
+ });
170
+ });
171
+ it('should convert hook tool config back to SDK format', () => {
172
+ const hookToolConfig = {
173
+ mode: 'AUTO',
174
+ allowedFunctionNames: ['tool1', 'tool2'],
175
+ };
176
+ const sdkToolConfig = translator.fromHookToolConfig(hookToolConfig);
177
+ expect(sdkToolConfig.functionCallingConfig).toEqual({
178
+ mode: 'AUTO',
179
+ allowedFunctionNames: ['tool1', 'tool2'],
180
+ });
181
+ });
182
+ it('should handle undefined tool config', () => {
183
+ const sdkToolConfig = {};
184
+ const hookToolConfig = translator.toHookToolConfig(sdkToolConfig);
185
+ expect(hookToolConfig).toEqual({
186
+ mode: undefined,
187
+ allowedFunctionNames: undefined,
188
+ });
189
+ });
190
+ });
191
+ });
192
+ //# sourceMappingURL=hookTranslator.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hookTranslator.test.js","sourceRoot":"","sources":["../../../src/hooks/hookTranslator.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EACL,qBAAqB,EACrB,qBAAqB,GAItB,MAAM,qBAAqB,CAAC;AAQ7B,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,IAAI,UAAiC,CAAC;IAEtC,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,GAAG,IAAI,qBAAqB,EAAE,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;QACrC,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE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