@amodalai/core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (463) hide show
  1. package/LICENSE +21 -0
  2. package/dist/.last_build +0 -0
  3. package/dist/src/amodal-config.d.ts +194 -0
  4. package/dist/src/amodal-config.js +326 -0
  5. package/dist/src/amodal-config.js.map +1 -0
  6. package/dist/src/audit/audit-logger.d.ts +52 -0
  7. package/dist/src/audit/audit-logger.js +137 -0
  8. package/dist/src/audit/audit-logger.js.map +1 -0
  9. package/dist/src/audit/audit-outputs.d.ts +34 -0
  10. package/dist/src/audit/audit-outputs.js +73 -0
  11. package/dist/src/audit/audit-outputs.js.map +1 -0
  12. package/dist/src/audit/audit-redact.d.ts +14 -0
  13. package/dist/src/audit/audit-redact.js +55 -0
  14. package/dist/src/audit/audit-redact.js.map +1 -0
  15. package/dist/src/audit/audit-types.d.ts +122 -0
  16. package/dist/src/audit/audit-types.js +64 -0
  17. package/dist/src/audit/audit-types.js.map +1 -0
  18. package/dist/src/audit/index.d.ts +10 -0
  19. package/dist/src/audit/index.js +10 -0
  20. package/dist/src/audit/index.js.map +1 -0
  21. package/dist/src/eval/eval-cost.d.ts +33 -0
  22. package/dist/src/eval/eval-cost.js +73 -0
  23. package/dist/src/eval/eval-cost.js.map +1 -0
  24. package/dist/src/eval/eval-diff.d.ts +11 -0
  25. package/dist/src/eval/eval-diff.js +97 -0
  26. package/dist/src/eval/eval-diff.js.map +1 -0
  27. package/dist/src/eval/eval-formatter.d.ts +23 -0
  28. package/dist/src/eval/eval-formatter.js +221 -0
  29. package/dist/src/eval/eval-formatter.js.map +1 -0
  30. package/dist/src/eval/eval-judge.d.ts +26 -0
  31. package/dist/src/eval/eval-judge.js +76 -0
  32. package/dist/src/eval/eval-judge.js.map +1 -0
  33. package/dist/src/eval/eval-run-builder.d.ts +25 -0
  34. package/dist/src/eval/eval-run-builder.js +78 -0
  35. package/dist/src/eval/eval-run-builder.js.map +1 -0
  36. package/dist/src/eval/eval-runner.d.ts +36 -0
  37. package/dist/src/eval/eval-runner.js +92 -0
  38. package/dist/src/eval/eval-runner.js.map +1 -0
  39. package/dist/src/eval/eval-session-provider.d.ts +40 -0
  40. package/dist/src/eval/eval-session-provider.js +46 -0
  41. package/dist/src/eval/eval-session-provider.js.map +1 -0
  42. package/dist/src/eval/eval-types.d.ts +146 -0
  43. package/dist/src/eval/eval-types.js +7 -0
  44. package/dist/src/eval/eval-types.js.map +1 -0
  45. package/dist/src/eval/experiment-runner.d.ts +16 -0
  46. package/dist/src/eval/experiment-runner.js +73 -0
  47. package/dist/src/eval/experiment-runner.js.map +1 -0
  48. package/dist/src/eval/experiment-types.d.ts +56 -0
  49. package/dist/src/eval/experiment-types.js +7 -0
  50. package/dist/src/eval/experiment-types.js.map +1 -0
  51. package/dist/src/eval/index.d.ts +22 -0
  52. package/dist/src/eval/index.js +18 -0
  53. package/dist/src/eval/index.js.map +1 -0
  54. package/dist/src/eval/multi-model-runner.d.ts +42 -0
  55. package/dist/src/eval/multi-model-runner.js +70 -0
  56. package/dist/src/eval/multi-model-runner.js.map +1 -0
  57. package/dist/src/eval/platform-eval-client.d.ts +105 -0
  58. package/dist/src/eval/platform-eval-client.js +155 -0
  59. package/dist/src/eval/platform-eval-client.js.map +1 -0
  60. package/dist/src/index.d.ts +41 -0
  61. package/dist/src/index.js +68 -0
  62. package/dist/src/index.js.map +1 -0
  63. package/dist/src/knowledge/index.d.ts +11 -0
  64. package/dist/src/knowledge/index.js +12 -0
  65. package/dist/src/knowledge/index.js.map +1 -0
  66. package/dist/src/knowledge/kb-formatter.d.ts +15 -0
  67. package/dist/src/knowledge/kb-formatter.js +78 -0
  68. package/dist/src/knowledge/kb-formatter.js.map +1 -0
  69. package/dist/src/knowledge/kb-index.d.ts +27 -0
  70. package/dist/src/knowledge/kb-index.js +66 -0
  71. package/dist/src/knowledge/kb-index.js.map +1 -0
  72. package/dist/src/knowledge/kb-types.d.ts +54 -0
  73. package/dist/src/knowledge/kb-types.js +7 -0
  74. package/dist/src/knowledge/kb-types.js.map +1 -0
  75. package/dist/src/knowledge/knowledge-store.d.ts +56 -0
  76. package/dist/src/knowledge/knowledge-store.js +141 -0
  77. package/dist/src/knowledge/knowledge-store.js.map +1 -0
  78. package/dist/src/knowledge/load-knowledge.d.ts +30 -0
  79. package/dist/src/knowledge/load-knowledge.js +161 -0
  80. package/dist/src/knowledge/load-knowledge.js.map +1 -0
  81. package/dist/src/knowledge/propose-kb-update.d.ts +32 -0
  82. package/dist/src/knowledge/propose-kb-update.js +148 -0
  83. package/dist/src/knowledge/propose-kb-update.js.map +1 -0
  84. package/dist/src/knowledge/propose-knowledge.d.ts +34 -0
  85. package/dist/src/knowledge/propose-knowledge.js +163 -0
  86. package/dist/src/knowledge/propose-knowledge.js.map +1 -0
  87. package/dist/src/mcp/index.d.ts +7 -0
  88. package/dist/src/mcp/index.js +7 -0
  89. package/dist/src/mcp/index.js.map +1 -0
  90. package/dist/src/mcp/mcp-manager.d.ts +96 -0
  91. package/dist/src/mcp/mcp-manager.js +192 -0
  92. package/dist/src/mcp/mcp-manager.js.map +1 -0
  93. package/dist/src/packages/config-deps.d.ts +20 -0
  94. package/dist/src/packages/config-deps.js +77 -0
  95. package/dist/src/packages/config-deps.js.map +1 -0
  96. package/dist/src/packages/env-file.d.ts +28 -0
  97. package/dist/src/packages/env-file.js +143 -0
  98. package/dist/src/packages/env-file.js.map +1 -0
  99. package/dist/src/packages/frontmatter.d.ts +28 -0
  100. package/dist/src/packages/frontmatter.js +77 -0
  101. package/dist/src/packages/frontmatter.js.map +1 -0
  102. package/dist/src/packages/index.d.ts +16 -0
  103. package/dist/src/packages/index.js +17 -0
  104. package/dist/src/packages/index.js.map +1 -0
  105. package/dist/src/packages/lock-file.d.ts +35 -0
  106. package/dist/src/packages/lock-file.js +117 -0
  107. package/dist/src/packages/lock-file.js.map +1 -0
  108. package/dist/src/packages/manifest-reader.d.ts +19 -0
  109. package/dist/src/packages/manifest-reader.js +91 -0
  110. package/dist/src/packages/manifest-reader.js.map +1 -0
  111. package/dist/src/packages/merge-engine.d.ts +63 -0
  112. package/dist/src/packages/merge-engine.js +357 -0
  113. package/dist/src/packages/merge-engine.js.map +1 -0
  114. package/dist/src/packages/npm-context.d.ts +56 -0
  115. package/dist/src/packages/npm-context.js +235 -0
  116. package/dist/src/packages/npm-context.js.map +1 -0
  117. package/dist/src/packages/npm-registry.d.ts +35 -0
  118. package/dist/src/packages/npm-registry.js +107 -0
  119. package/dist/src/packages/npm-registry.js.map +1 -0
  120. package/dist/src/packages/package-error.d.ts +16 -0
  121. package/dist/src/packages/package-error.js +17 -0
  122. package/dist/src/packages/package-error.js.map +1 -0
  123. package/dist/src/packages/package-types.d.ts +477 -0
  124. package/dist/src/packages/package-types.js +156 -0
  125. package/dist/src/packages/package-types.js.map +1 -0
  126. package/dist/src/packages/resolver.d.ts +41 -0
  127. package/dist/src/packages/resolver.js +353 -0
  128. package/dist/src/packages/resolver.js.map +1 -0
  129. package/dist/src/platform/config-builder.d.ts +24 -0
  130. package/dist/src/platform/config-builder.js +70 -0
  131. package/dist/src/platform/config-builder.js.map +1 -0
  132. package/dist/src/platform/index.d.ts +8 -0
  133. package/dist/src/platform/index.js +9 -0
  134. package/dist/src/platform/index.js.map +1 -0
  135. package/dist/src/platform/platform-client.d.ts +160 -0
  136. package/dist/src/platform/platform-client.js +486 -0
  137. package/dist/src/platform/platform-client.js.map +1 -0
  138. package/dist/src/platform/platform-types.d.ts +81 -0
  139. package/dist/src/platform/platform-types.js +18 -0
  140. package/dist/src/platform/platform-types.js.map +1 -0
  141. package/dist/src/providers/content-generator/google-to-llm.d.ts +87 -0
  142. package/dist/src/providers/content-generator/google-to-llm.js +226 -0
  143. package/dist/src/providers/content-generator/google-to-llm.js.map +1 -0
  144. package/dist/src/providers/content-generator/index.d.ts +10 -0
  145. package/dist/src/providers/content-generator/index.js +9 -0
  146. package/dist/src/providers/content-generator/index.js.map +1 -0
  147. package/dist/src/providers/content-generator/llm-to-google.d.ts +59 -0
  148. package/dist/src/providers/content-generator/llm-to-google.js +178 -0
  149. package/dist/src/providers/content-generator/llm-to-google.js.map +1 -0
  150. package/dist/src/providers/content-generator/multi-provider-content-generator.d.ts +61 -0
  151. package/dist/src/providers/content-generator/multi-provider-content-generator.js +144 -0
  152. package/dist/src/providers/content-generator/multi-provider-content-generator.js.map +1 -0
  153. package/dist/src/providers/runtime/anthropic-provider.d.ts +18 -0
  154. package/dist/src/providers/runtime/anthropic-provider.js +253 -0
  155. package/dist/src/providers/runtime/anthropic-provider.js.map +1 -0
  156. package/dist/src/providers/runtime/azure-provider.d.ts +25 -0
  157. package/dist/src/providers/runtime/azure-provider.js +206 -0
  158. package/dist/src/providers/runtime/azure-provider.js.map +1 -0
  159. package/dist/src/providers/runtime/bedrock-provider.d.ts +22 -0
  160. package/dist/src/providers/runtime/bedrock-provider.js +276 -0
  161. package/dist/src/providers/runtime/bedrock-provider.js.map +1 -0
  162. package/dist/src/providers/runtime/failover-provider.d.ts +30 -0
  163. package/dist/src/providers/runtime/failover-provider.js +124 -0
  164. package/dist/src/providers/runtime/failover-provider.js.map +1 -0
  165. package/dist/src/providers/runtime/google-provider.d.ts +17 -0
  166. package/dist/src/providers/runtime/google-provider.js +239 -0
  167. package/dist/src/providers/runtime/google-provider.js.map +1 -0
  168. package/dist/src/providers/runtime/index.d.ts +16 -0
  169. package/dist/src/providers/runtime/index.js +16 -0
  170. package/dist/src/providers/runtime/index.js.map +1 -0
  171. package/dist/src/providers/runtime/openai-provider.d.ts +21 -0
  172. package/dist/src/providers/runtime/openai-provider.js +266 -0
  173. package/dist/src/providers/runtime/openai-provider.js.map +1 -0
  174. package/dist/src/providers/runtime/provider-errors.d.ts +39 -0
  175. package/dist/src/providers/runtime/provider-errors.js +50 -0
  176. package/dist/src/providers/runtime/provider-errors.js.map +1 -0
  177. package/dist/src/providers/runtime/provider-factory.d.ts +19 -0
  178. package/dist/src/providers/runtime/provider-factory.js +45 -0
  179. package/dist/src/providers/runtime/provider-factory.js.map +1 -0
  180. package/dist/src/providers/runtime/runtime-provider-types.d.ts +63 -0
  181. package/dist/src/providers/runtime/runtime-provider-types.js +7 -0
  182. package/dist/src/providers/runtime/runtime-provider-types.js.map +1 -0
  183. package/dist/src/providers/runtime/streaming-types.d.ts +40 -0
  184. package/dist/src/providers/runtime/streaming-types.js +7 -0
  185. package/dist/src/providers/runtime/streaming-types.js.map +1 -0
  186. package/dist/src/repo/config-schema.d.ts +238 -0
  187. package/dist/src/repo/config-schema.js +155 -0
  188. package/dist/src/repo/config-schema.js.map +1 -0
  189. package/dist/src/repo/connection-schemas.d.ts +449 -0
  190. package/dist/src/repo/connection-schemas.js +109 -0
  191. package/dist/src/repo/connection-schemas.js.map +1 -0
  192. package/dist/src/repo/connection-types.d.ts +29 -0
  193. package/dist/src/repo/connection-types.js +7 -0
  194. package/dist/src/repo/connection-types.js.map +1 -0
  195. package/dist/src/repo/drift-detector.d.ts +26 -0
  196. package/dist/src/repo/drift-detector.js +66 -0
  197. package/dist/src/repo/drift-detector.js.map +1 -0
  198. package/dist/src/repo/graphql-drift-detector.d.ts +27 -0
  199. package/dist/src/repo/graphql-drift-detector.js +66 -0
  200. package/dist/src/repo/graphql-drift-detector.js.map +1 -0
  201. package/dist/src/repo/graphql-parser.d.ts +30 -0
  202. package/dist/src/repo/graphql-parser.js +125 -0
  203. package/dist/src/repo/graphql-parser.js.map +1 -0
  204. package/dist/src/repo/graphql-surface-parser.d.ts +20 -0
  205. package/dist/src/repo/graphql-surface-parser.js +74 -0
  206. package/dist/src/repo/graphql-surface-parser.js.map +1 -0
  207. package/dist/src/repo/index.d.ts +30 -0
  208. package/dist/src/repo/index.js +29 -0
  209. package/dist/src/repo/index.js.map +1 -0
  210. package/dist/src/repo/local-reader.d.ts +10 -0
  211. package/dist/src/repo/local-reader.js +299 -0
  212. package/dist/src/repo/local-reader.js.map +1 -0
  213. package/dist/src/repo/openapi-parser.d.ts +35 -0
  214. package/dist/src/repo/openapi-parser.js +93 -0
  215. package/dist/src/repo/openapi-parser.js.map +1 -0
  216. package/dist/src/repo/parsers.d.ts +91 -0
  217. package/dist/src/repo/parsers.js +454 -0
  218. package/dist/src/repo/parsers.js.map +1 -0
  219. package/dist/src/repo/platform-reader.d.ts +10 -0
  220. package/dist/src/repo/platform-reader.js +206 -0
  221. package/dist/src/repo/platform-reader.js.map +1 -0
  222. package/dist/src/repo/repo-loader.d.ts +14 -0
  223. package/dist/src/repo/repo-loader.js +25 -0
  224. package/dist/src/repo/repo-loader.js.map +1 -0
  225. package/dist/src/repo/repo-types.d.ts +159 -0
  226. package/dist/src/repo/repo-types.js +17 -0
  227. package/dist/src/repo/repo-types.js.map +1 -0
  228. package/dist/src/repo/spec-syncer.d.ts +30 -0
  229. package/dist/src/repo/spec-syncer.js +85 -0
  230. package/dist/src/repo/spec-syncer.js.map +1 -0
  231. package/dist/src/repo/store-loader.d.ts +19 -0
  232. package/dist/src/repo/store-loader.js +94 -0
  233. package/dist/src/repo/store-loader.js.map +1 -0
  234. package/dist/src/repo/store-schemas.d.ts +313 -0
  235. package/dist/src/repo/store-schemas.js +103 -0
  236. package/dist/src/repo/store-schemas.js.map +1 -0
  237. package/dist/src/repo/store-tool-schema.d.ts +29 -0
  238. package/dist/src/repo/store-tool-schema.js +103 -0
  239. package/dist/src/repo/store-tool-schema.js.map +1 -0
  240. package/dist/src/repo/store-types.d.ts +91 -0
  241. package/dist/src/repo/store-types.js +7 -0
  242. package/dist/src/repo/store-types.js.map +1 -0
  243. package/dist/src/repo/surface-parser.d.ts +17 -0
  244. package/dist/src/repo/surface-parser.js +75 -0
  245. package/dist/src/repo/surface-parser.js.map +1 -0
  246. package/dist/src/repo/tool-loader.d.ts +33 -0
  247. package/dist/src/repo/tool-loader.js +240 -0
  248. package/dist/src/repo/tool-loader.js.map +1 -0
  249. package/dist/src/repo/tool-types.d.ts +205 -0
  250. package/dist/src/repo/tool-types.js +61 -0
  251. package/dist/src/repo/tool-types.js.map +1 -0
  252. package/dist/src/roles/index.d.ts +7 -0
  253. package/dist/src/roles/index.js +8 -0
  254. package/dist/src/roles/index.js.map +1 -0
  255. package/dist/src/roles/role-filter.d.ts +33 -0
  256. package/dist/src/roles/role-filter.js +55 -0
  257. package/dist/src/roles/role-filter.js.map +1 -0
  258. package/dist/src/roles/role-types.d.ts +76 -0
  259. package/dist/src/roles/role-types.js +38 -0
  260. package/dist/src/roles/role-types.js.map +1 -0
  261. package/dist/src/runtime/connection-bridge.d.ts +19 -0
  262. package/dist/src/runtime/connection-bridge.js +103 -0
  263. package/dist/src/runtime/connection-bridge.js.map +1 -0
  264. package/dist/src/runtime/context-compiler.d.ts +35 -0
  265. package/dist/src/runtime/context-compiler.js +183 -0
  266. package/dist/src/runtime/context-compiler.js.map +1 -0
  267. package/dist/src/runtime/default-prompt.d.ts +28 -0
  268. package/dist/src/runtime/default-prompt.js +71 -0
  269. package/dist/src/runtime/default-prompt.js.map +1 -0
  270. package/dist/src/runtime/explore-tool.d.ts +96 -0
  271. package/dist/src/runtime/explore-tool.js +111 -0
  272. package/dist/src/runtime/explore-tool.js.map +1 -0
  273. package/dist/src/runtime/index.d.ts +26 -0
  274. package/dist/src/runtime/index.js +19 -0
  275. package/dist/src/runtime/index.js.map +1 -0
  276. package/dist/src/runtime/output-pipeline.d.ts +62 -0
  277. package/dist/src/runtime/output-pipeline.js +69 -0
  278. package/dist/src/runtime/output-pipeline.js.map +1 -0
  279. package/dist/src/runtime/plan-mode.d.ts +39 -0
  280. package/dist/src/runtime/plan-mode.js +81 -0
  281. package/dist/src/runtime/plan-mode.js.map +1 -0
  282. package/dist/src/runtime/preference-client.d.ts +39 -0
  283. package/dist/src/runtime/preference-client.js +70 -0
  284. package/dist/src/runtime/preference-client.js.map +1 -0
  285. package/dist/src/runtime/preference-detector.d.ts +22 -0
  286. package/dist/src/runtime/preference-detector.js +95 -0
  287. package/dist/src/runtime/preference-detector.js.map +1 -0
  288. package/dist/src/runtime/request-integration.d.ts +18 -0
  289. package/dist/src/runtime/request-integration.js +36 -0
  290. package/dist/src/runtime/request-integration.js.map +1 -0
  291. package/dist/src/runtime/runtime-types.d.ts +48 -0
  292. package/dist/src/runtime/runtime-types.js +7 -0
  293. package/dist/src/runtime/runtime-types.js.map +1 -0
  294. package/dist/src/runtime/session-setup.d.ts +53 -0
  295. package/dist/src/runtime/session-setup.js +90 -0
  296. package/dist/src/runtime/session-setup.js.map +1 -0
  297. package/dist/src/runtime/telemetry-client.d.ts +39 -0
  298. package/dist/src/runtime/telemetry-client.js +87 -0
  299. package/dist/src/runtime/telemetry-client.js.map +1 -0
  300. package/dist/src/runtime/telemetry-hooks.d.ts +47 -0
  301. package/dist/src/runtime/telemetry-hooks.js +115 -0
  302. package/dist/src/runtime/telemetry-hooks.js.map +1 -0
  303. package/dist/src/runtime/token-allocator.d.ts +34 -0
  304. package/dist/src/runtime/token-allocator.js +86 -0
  305. package/dist/src/runtime/token-allocator.js.map +1 -0
  306. package/dist/src/runtime/user-context.d.ts +49 -0
  307. package/dist/src/runtime/user-context.js +135 -0
  308. package/dist/src/runtime/user-context.js.map +1 -0
  309. package/dist/src/sdk.d.ts +57 -0
  310. package/dist/src/sdk.js +377 -0
  311. package/dist/src/sdk.js.map +1 -0
  312. package/dist/src/security/action-gate.d.ts +23 -0
  313. package/dist/src/security/action-gate.js +78 -0
  314. package/dist/src/security/action-gate.js.map +1 -0
  315. package/dist/src/security/field-scrubber.d.ts +27 -0
  316. package/dist/src/security/field-scrubber.js +152 -0
  317. package/dist/src/security/field-scrubber.js.map +1 -0
  318. package/dist/src/security/index.d.ts +14 -0
  319. package/dist/src/security/index.js +15 -0
  320. package/dist/src/security/index.js.map +1 -0
  321. package/dist/src/security/leak-detector.d.ts +23 -0
  322. package/dist/src/security/leak-detector.js +51 -0
  323. package/dist/src/security/leak-detector.js.map +1 -0
  324. package/dist/src/security/output-guard.d.ts +33 -0
  325. package/dist/src/security/output-guard.js +118 -0
  326. package/dist/src/security/output-guard.js.map +1 -0
  327. package/dist/src/security/pattern-scanner.d.ts +19 -0
  328. package/dist/src/security/pattern-scanner.js +66 -0
  329. package/dist/src/security/pattern-scanner.js.map +1 -0
  330. package/dist/src/security/scope-checker.d.ts +27 -0
  331. package/dist/src/security/scope-checker.js +52 -0
  332. package/dist/src/security/scope-checker.js.map +1 -0
  333. package/dist/src/security/scrub-tracker.d.ts +21 -0
  334. package/dist/src/security/scrub-tracker.js +39 -0
  335. package/dist/src/security/scrub-tracker.js.map +1 -0
  336. package/dist/src/security/security-types.d.ts +69 -0
  337. package/dist/src/security/security-types.js +17 -0
  338. package/dist/src/security/security-types.js.map +1 -0
  339. package/dist/src/security/threshold-evaluator.d.ts +13 -0
  340. package/dist/src/security/threshold-evaluator.js +44 -0
  341. package/dist/src/security/threshold-evaluator.js.map +1 -0
  342. package/dist/src/snapshot/index.d.ts +8 -0
  343. package/dist/src/snapshot/index.js +9 -0
  344. package/dist/src/snapshot/index.js.map +1 -0
  345. package/dist/src/snapshot/snapshot-builder.d.ts +37 -0
  346. package/dist/src/snapshot/snapshot-builder.js +152 -0
  347. package/dist/src/snapshot/snapshot-builder.js.map +1 -0
  348. package/dist/src/snapshot/snapshot-loader.d.ts +29 -0
  349. package/dist/src/snapshot/snapshot-loader.js +188 -0
  350. package/dist/src/snapshot/snapshot-loader.js.map +1 -0
  351. package/dist/src/snapshot/snapshot-types.d.ts +1940 -0
  352. package/dist/src/snapshot/snapshot-types.js +145 -0
  353. package/dist/src/snapshot/snapshot-types.js.map +1 -0
  354. package/dist/src/stores/index.d.ts +6 -0
  355. package/dist/src/stores/index.js +7 -0
  356. package/dist/src/stores/index.js.map +1 -0
  357. package/dist/src/stores/store-backend.d.ts +135 -0
  358. package/dist/src/stores/store-backend.js +7 -0
  359. package/dist/src/stores/store-backend.js.map +1 -0
  360. package/dist/src/templates/connections.d.ts +14 -0
  361. package/dist/src/templates/connections.js +7 -0
  362. package/dist/src/templates/connections.js.map +1 -0
  363. package/dist/src/templates/index.d.ts +7 -0
  364. package/dist/src/templates/index.js +8 -0
  365. package/dist/src/templates/index.js.map +1 -0
  366. package/dist/src/templates/template-resolver.d.ts +45 -0
  367. package/dist/src/templates/template-resolver.js +121 -0
  368. package/dist/src/templates/template-resolver.js.map +1 -0
  369. package/dist/src/tool-context.d.ts +33 -0
  370. package/dist/src/tool-context.js +7 -0
  371. package/dist/src/tool-context.js.map +1 -0
  372. package/dist/src/tool-registration.d.ts +14 -0
  373. package/dist/src/tool-registration.js +51 -0
  374. package/dist/src/tool-registration.js.map +1 -0
  375. package/dist/src/tools/amodal-tool-errors.d.ts +24 -0
  376. package/dist/src/tools/amodal-tool-errors.js +28 -0
  377. package/dist/src/tools/amodal-tool-errors.js.map +1 -0
  378. package/dist/src/tools/amodal-tool-names.d.ts +14 -0
  379. package/dist/src/tools/amodal-tool-names.js +15 -0
  380. package/dist/src/tools/amodal-tool-names.js.map +1 -0
  381. package/dist/src/tools/chain-tool-registry.d.ts +20 -0
  382. package/dist/src/tools/chain-tool-registry.js +49 -0
  383. package/dist/src/tools/chain-tool-registry.js.map +1 -0
  384. package/dist/src/tools/chain-tool-types.d.ts +190 -0
  385. package/dist/src/tools/chain-tool-types.js +50 -0
  386. package/dist/src/tools/chain-tool-types.js.map +1 -0
  387. package/dist/src/tools/chain-tool.d.ts +34 -0
  388. package/dist/src/tools/chain-tool.js +294 -0
  389. package/dist/src/tools/chain-tool.js.map +1 -0
  390. package/dist/src/tools/custom-tool-registrar.d.ts +8 -0
  391. package/dist/src/tools/custom-tool-registrar.js +10 -0
  392. package/dist/src/tools/custom-tool-registrar.js.map +1 -0
  393. package/dist/src/tools/definitions/amodal-tools.d.ts +9 -0
  394. package/dist/src/tools/definitions/amodal-tools.js +192 -0
  395. package/dist/src/tools/definitions/amodal-tools.js.map +1 -0
  396. package/dist/src/tools/function-tool-registry.d.ts +22 -0
  397. package/dist/src/tools/function-tool-registry.js +45 -0
  398. package/dist/src/tools/function-tool-registry.js.map +1 -0
  399. package/dist/src/tools/function-tool-types.d.ts +76 -0
  400. package/dist/src/tools/function-tool-types.js +27 -0
  401. package/dist/src/tools/function-tool-types.js.map +1 -0
  402. package/dist/src/tools/function-tool.d.ts +34 -0
  403. package/dist/src/tools/function-tool.js +97 -0
  404. package/dist/src/tools/function-tool.js.map +1 -0
  405. package/dist/src/tools/http-tool-registry.d.ts +20 -0
  406. package/dist/src/tools/http-tool-registry.js +34 -0
  407. package/dist/src/tools/http-tool-registry.js.map +1 -0
  408. package/dist/src/tools/http-tool-types.d.ts +92 -0
  409. package/dist/src/tools/http-tool-types.js +44 -0
  410. package/dist/src/tools/http-tool-types.js.map +1 -0
  411. package/dist/src/tools/http-tool.d.ts +32 -0
  412. package/dist/src/tools/http-tool.js +176 -0
  413. package/dist/src/tools/http-tool.js.map +1 -0
  414. package/dist/src/tools/merge-template.d.ts +33 -0
  415. package/dist/src/tools/merge-template.js +65 -0
  416. package/dist/src/tools/merge-template.js.map +1 -0
  417. package/dist/src/tools/request-tool-types.d.ts +46 -0
  418. package/dist/src/tools/request-tool-types.js +20 -0
  419. package/dist/src/tools/request-tool-types.js.map +1 -0
  420. package/dist/src/tools/request-tool.d.ts +29 -0
  421. package/dist/src/tools/request-tool.js +268 -0
  422. package/dist/src/tools/request-tool.js.map +1 -0
  423. package/dist/src/tools/store-query-tool.d.ts +29 -0
  424. package/dist/src/tools/store-query-tool.js +82 -0
  425. package/dist/src/tools/store-query-tool.js.map +1 -0
  426. package/dist/src/tools/store-write-tool.d.ts +26 -0
  427. package/dist/src/tools/store-write-tool.js +84 -0
  428. package/dist/src/tools/store-write-tool.js.map +1 -0
  429. package/dist/src/tools/tool-definition-types.d.ts +21 -0
  430. package/dist/src/tools/tool-definition-types.js +7 -0
  431. package/dist/src/tools/tool-definition-types.js.map +1 -0
  432. package/dist/src/tools/tool-utils.d.ts +29 -0
  433. package/dist/src/tools/tool-utils.js +66 -0
  434. package/dist/src/tools/tool-utils.js.map +1 -0
  435. package/dist/src/versions/bundle-loader.d.ts +37 -0
  436. package/dist/src/versions/bundle-loader.js +99 -0
  437. package/dist/src/versions/bundle-loader.js.map +1 -0
  438. package/dist/src/versions/dependency-manager.d.ts +54 -0
  439. package/dist/src/versions/dependency-manager.js +132 -0
  440. package/dist/src/versions/dependency-manager.js.map +1 -0
  441. package/dist/src/versions/handler-loader.d.ts +27 -0
  442. package/dist/src/versions/handler-loader.js +62 -0
  443. package/dist/src/versions/handler-loader.js.map +1 -0
  444. package/dist/src/versions/index.d.ts +10 -0
  445. package/dist/src/versions/index.js +11 -0
  446. package/dist/src/versions/index.js.map +1 -0
  447. package/dist/src/versions/version-bundle-types.d.ts +1278 -0
  448. package/dist/src/versions/version-bundle-types.js +207 -0
  449. package/dist/src/versions/version-bundle-types.js.map +1 -0
  450. package/dist/src/versions/version-manager.d.ts +89 -0
  451. package/dist/src/versions/version-manager.js +124 -0
  452. package/dist/src/versions/version-manager.js.map +1 -0
  453. package/dist/src/widgets/index.d.ts +8 -0
  454. package/dist/src/widgets/index.js +8 -0
  455. package/dist/src/widgets/index.js.map +1 -0
  456. package/dist/src/widgets/present-tool.d.ts +21 -0
  457. package/dist/src/widgets/present-tool.js +107 -0
  458. package/dist/src/widgets/present-tool.js.map +1 -0
  459. package/dist/src/widgets/widget-types.d.ts +78 -0
  460. package/dist/src/widgets/widget-types.js +28 -0
  461. package/dist/src/widgets/widget-types.js.map +1 -0
  462. package/dist/tsconfig.tsbuildinfo +1 -0
  463. package/package.json +50 -0
@@ -0,0 +1,87 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Amodal Labs, Inc.
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ import type { LLMChatRequest, LLMMessage, LLMToolDefinition } from '../runtime/runtime-provider-types.js';
7
+ /** @google/genai Content */
8
+ interface GContent {
9
+ role?: string;
10
+ parts?: GPart[];
11
+ }
12
+ /** @google/genai Part */
13
+ interface GPart {
14
+ text?: string;
15
+ functionCall?: GFunctionCall;
16
+ functionResponse?: GFunctionResponse;
17
+ thought?: boolean;
18
+ thoughtSignature?: string;
19
+ inlineData?: {
20
+ mimeType?: string;
21
+ data?: string;
22
+ };
23
+ [key: string]: unknown;
24
+ }
25
+ /** @google/genai FunctionCall */
26
+ interface GFunctionCall {
27
+ id?: string;
28
+ name?: string;
29
+ args?: Record<string, unknown>;
30
+ [key: string]: unknown;
31
+ }
32
+ /** @google/genai FunctionResponse */
33
+ interface GFunctionResponse {
34
+ id?: string;
35
+ name?: string;
36
+ response?: Record<string, unknown>;
37
+ [key: string]: unknown;
38
+ }
39
+ /** Subset of GenerateContentConfig we care about */
40
+ interface GGenerateContentConfig {
41
+ systemInstruction?: unknown;
42
+ tools?: unknown[];
43
+ maxOutputTokens?: number;
44
+ temperature?: number;
45
+ topP?: number;
46
+ topK?: number;
47
+ abortSignal?: AbortSignal;
48
+ [key: string]: unknown;
49
+ }
50
+ /** Subset of GenerateContentParameters */
51
+ export interface GGenerateContentParams {
52
+ model: string;
53
+ contents: unknown;
54
+ config?: GGenerateContentConfig;
55
+ }
56
+ /**
57
+ * Convert a Google GenerateContentParameters into our LLMChatRequest.
58
+ */
59
+ export declare function convertGenerateContentParams(request: GGenerateContentParams): LLMChatRequest;
60
+ /**
61
+ * Normalize ContentListUnion to Content[].
62
+ *
63
+ * ContentListUnion can be:
64
+ * - Content (single object with role + parts)
65
+ * - Content[] (array)
66
+ * - string (bare text)
67
+ * - Part (single part)
68
+ * - Part[] (array of parts)
69
+ */
70
+ export declare function normalizeContents(contents: unknown): GContent[];
71
+ /**
72
+ * Extract system prompt text from systemInstruction.
73
+ * Can be a string, Content, or Part[].
74
+ */
75
+ export declare function extractSystemPrompt(instruction: unknown): string;
76
+ /**
77
+ * Convert Content[] to LLMMessage[].
78
+ *
79
+ * A single Content can produce multiple LLMMessages when it contains
80
+ * both text parts and functionResponse parts (tool results).
81
+ */
82
+ export declare function contentsToMessages(contents: GContent[]): LLMMessage[];
83
+ /**
84
+ * Extract LLMToolDefinition[] from Google Tool[].
85
+ */
86
+ export declare function extractTools(tools: unknown[] | undefined): LLMToolDefinition[];
87
+ export {};
@@ -0,0 +1,226 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Amodal Labs, Inc.
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ /**
7
+ * Converts Google @google/genai types (GenerateContentParameters)
8
+ * into our provider-neutral LLM types (LLMChatRequest).
9
+ *
10
+ * This is the "input" side of the ContentGenerator adapter — it translates
11
+ * the request format that the upstream GeminiClient produces into what our
12
+ * RuntimeProvider implementations expect.
13
+ */
14
+ import { randomUUID } from 'node:crypto';
15
+ // ---------------------------------------------------------------------------
16
+ // Public conversion function
17
+ // ---------------------------------------------------------------------------
18
+ /**
19
+ * Convert a Google GenerateContentParameters into our LLMChatRequest.
20
+ */
21
+ export function convertGenerateContentParams(request) {
22
+ const contents = normalizeContents(request.contents);
23
+ const messages = contentsToMessages(contents);
24
+ const systemPrompt = extractSystemPrompt(request.config?.systemInstruction);
25
+ const tools = extractTools(request.config?.tools);
26
+ return {
27
+ model: request.model,
28
+ systemPrompt,
29
+ messages,
30
+ tools,
31
+ maxTokens: request.config?.maxOutputTokens,
32
+ signal: request.config?.abortSignal,
33
+ };
34
+ }
35
+ // ---------------------------------------------------------------------------
36
+ // Content normalization
37
+ // ---------------------------------------------------------------------------
38
+ /**
39
+ * Normalize ContentListUnion to Content[].
40
+ *
41
+ * ContentListUnion can be:
42
+ * - Content (single object with role + parts)
43
+ * - Content[] (array)
44
+ * - string (bare text)
45
+ * - Part (single part)
46
+ * - Part[] (array of parts)
47
+ */
48
+ export function normalizeContents(contents) {
49
+ if (!contents)
50
+ return [];
51
+ // String → single user message
52
+ if (typeof contents === 'string') {
53
+ return [{ role: 'user', parts: [{ text: contents }] }];
54
+ }
55
+ // Array
56
+ if (Array.isArray(contents)) {
57
+ if (contents.length === 0)
58
+ return [];
59
+ // Check if first element looks like Content (has 'role' or 'parts')
60
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Gemini SDK content normalization
61
+ const first = contents[0];
62
+ if (first && (typeof first['role'] === 'string' || Array.isArray(first['parts']))) {
63
+ // Content[]
64
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Gemini SDK content normalization
65
+ return contents;
66
+ }
67
+ // Part[] — wrap as single user message
68
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Gemini SDK content normalization
69
+ return [{ role: 'user', parts: contents }];
70
+ }
71
+ // Single object
72
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Gemini SDK content normalization
73
+ const obj = contents;
74
+ if (typeof obj['role'] === 'string' || Array.isArray(obj['parts'])) {
75
+ // Single Content
76
+ return [contents];
77
+ }
78
+ // Single Part — wrap as user message
79
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Gemini SDK content normalization
80
+ return [{ role: 'user', parts: [contents] }];
81
+ }
82
+ // ---------------------------------------------------------------------------
83
+ // System prompt extraction
84
+ // ---------------------------------------------------------------------------
85
+ /**
86
+ * Extract system prompt text from systemInstruction.
87
+ * Can be a string, Content, or Part[].
88
+ */
89
+ export function extractSystemPrompt(instruction) {
90
+ if (!instruction)
91
+ return '';
92
+ if (typeof instruction === 'string')
93
+ return instruction;
94
+ // Content with parts
95
+ const content = instruction;
96
+ if (Array.isArray(content.parts)) {
97
+ return extractTextFromParts(content.parts);
98
+ }
99
+ // Part[] directly
100
+ if (Array.isArray(instruction)) {
101
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Gemini SDK content normalization
102
+ return extractTextFromParts(instruction);
103
+ }
104
+ // Single Part
105
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Gemini SDK content normalization
106
+ const part = instruction;
107
+ if (typeof part.text === 'string')
108
+ return part.text;
109
+ return '';
110
+ }
111
+ function extractTextFromParts(parts) {
112
+ return parts
113
+ .filter((p) => typeof p.text === 'string' && !p.thought)
114
+ .map((p) => p.text)
115
+ .join('\n');
116
+ }
117
+ // ---------------------------------------------------------------------------
118
+ // Contents → Messages
119
+ // ---------------------------------------------------------------------------
120
+ /**
121
+ * Convert Content[] to LLMMessage[].
122
+ *
123
+ * A single Content can produce multiple LLMMessages when it contains
124
+ * both text parts and functionResponse parts (tool results).
125
+ */
126
+ export function contentsToMessages(contents) {
127
+ const messages = [];
128
+ for (const content of contents) {
129
+ const parts = content.parts ?? [];
130
+ const role = content.role ?? 'user';
131
+ if (role === 'model') {
132
+ // Model turn → assistant message with response blocks
133
+ const blocks = partsToResponseBlocks(parts);
134
+ if (blocks.length > 0) {
135
+ messages.push({ role: 'assistant', content: blocks });
136
+ }
137
+ }
138
+ else {
139
+ // User turn — may contain text, functionResponse, or both
140
+ const textParts = parts.filter((p) => typeof p.text === 'string' && !p.thought && !p.functionResponse && !p.functionCall);
141
+ const functionResponses = parts.filter((p) => p.functionResponse);
142
+ // Text parts → user message
143
+ if (textParts.length > 0) {
144
+ const text = textParts.map((p) => p.text).join('\n');
145
+ messages.push({ role: 'user', content: text });
146
+ }
147
+ // Function responses → tool result messages
148
+ for (const part of functionResponses) {
149
+ const fr = part.functionResponse;
150
+ messages.push({
151
+ role: 'tool_result',
152
+ toolCallId: fr.id ?? fr.name ?? randomUUID(),
153
+ content: fr.response ? JSON.stringify(fr.response) : '',
154
+ isError: false,
155
+ });
156
+ }
157
+ // If no text and no function responses, but there are parts with text (including thoughts)
158
+ // still send something so the conversation doesn't break
159
+ if (textParts.length === 0 && functionResponses.length === 0 && parts.length > 0) {
160
+ const anyText = parts.find((p) => typeof p.text === 'string');
161
+ if (anyText) {
162
+ messages.push({ role: 'user', content: anyText.text ?? '' });
163
+ }
164
+ }
165
+ }
166
+ }
167
+ return messages;
168
+ }
169
+ /**
170
+ * Convert model parts to LLMResponseBlock[].
171
+ */
172
+ function partsToResponseBlocks(parts) {
173
+ const blocks = [];
174
+ for (const part of parts) {
175
+ // Skip thought parts (but not functionCall parts that happen to have thoughtSignature)
176
+ if (part.thought && !part.functionCall)
177
+ continue;
178
+ // Skip pure thought signature parts (no other content)
179
+ if (part.thoughtSignature && !part.functionCall && !part.text)
180
+ continue;
181
+ if (part.functionCall) {
182
+ blocks.push({
183
+ type: 'tool_use',
184
+ id: part.functionCall.id ?? randomUUID(),
185
+ name: part.functionCall.name ?? '',
186
+ input: part.functionCall.args ?? {},
187
+ });
188
+ }
189
+ else if (typeof part.text === 'string') {
190
+ blocks.push({ type: 'text', text: part.text });
191
+ }
192
+ }
193
+ return blocks;
194
+ }
195
+ // ---------------------------------------------------------------------------
196
+ // Tools extraction
197
+ // ---------------------------------------------------------------------------
198
+ /**
199
+ * Extract LLMToolDefinition[] from Google Tool[].
200
+ */
201
+ export function extractTools(tools) {
202
+ if (!tools || tools.length === 0)
203
+ return [];
204
+ const defs = [];
205
+ for (const tool of tools) {
206
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Gemini SDK tool types
207
+ const gTool = tool;
208
+ if (!gTool.functionDeclarations)
209
+ continue;
210
+ for (const fd of gTool.functionDeclarations) {
211
+ // Upstream uses parametersJsonSchema; standard @google/genai uses parameters
212
+ const params = fd.parametersJsonSchema ?? fd.parameters ?? {};
213
+ // Ensure parameters always has type: 'object' — Anthropic requires this
214
+ if (!params['type']) {
215
+ params['type'] = 'object';
216
+ }
217
+ defs.push({
218
+ name: fd.name ?? '',
219
+ description: fd.description ?? '',
220
+ parameters: params,
221
+ });
222
+ }
223
+ }
224
+ return defs;
225
+ }
226
+ //# sourceMappingURL=google-to-llm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google-to-llm.js","sourceRoot":"","sources":["../../../../src/providers/content-generator/google-to-llm.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA+EzC,8EAA8E;AAC9E,6BAA6B;AAC7B,8EAA8E;AAE9E;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAC1C,OAA+B;IAE/B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,GAAwB,EAAE,CAAC;IAErC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,gGAAgG;QAChG,MAAM,KAAK,GAAG,IAAa,CAAC;QAC5B,IAAI,CAAC,KAAK,CAAC,oBAAoB;YAAE,SAAS;QAE1C,KAAK,MAAM,EAAE,IAAI,KAAK,CAAC,oBAAoB,EAAE,CAAC;YAC5C,6EAA6E;YAC7E,MAAM,MAAM,GAAG,EAAE,CAAC,oBAAoB,IAAI,EAAE,CAAC,UAAU,IAAI,EAAE,CAAC;YAC9D,wEAAwE;YACxE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;gBACpB,MAAM,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC;YAC5B,CAAC;YACD,IAAI,CAAC,IAAI,CAAC;gBACR,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,EAAE;gBACnB,WAAW,EAAE,EAAE,CAAC,WAAW,IAAI,EAAE;gBACjC,UAAU,EAAE,MAAM;aACnB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Amodal Labs, Inc.
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ export { MultiProviderContentGenerator } from './multi-provider-content-generator.js';
7
+ export { convertGenerateContentParams, normalizeContents, extractSystemPrompt, extractTools } from './google-to-llm.js';
8
+ export { convertLLMResponse, convertStreamEvent } from './llm-to-google.js';
9
+ export type { GGenerateContentParams } from './google-to-llm.js';
10
+ export type { GGenerateContentResponse } from './llm-to-google.js';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Amodal Labs, Inc.
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ export { MultiProviderContentGenerator } from './multi-provider-content-generator.js';
7
+ export { convertGenerateContentParams, normalizeContents, extractSystemPrompt, extractTools } from './google-to-llm.js';
8
+ export { convertLLMResponse, convertStreamEvent } from './llm-to-google.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/providers/content-generator/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACxH,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Amodal Labs, Inc.
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ /**
7
+ * Converts our provider-neutral LLM types (LLMChatResponse, LLMStreamEvent)
8
+ * back into Google @google/genai types (GenerateContentResponse).
9
+ *
10
+ * This is the "output" side of the ContentGenerator adapter — it translates
11
+ * responses from our RuntimeProvider implementations into the format that
12
+ * the upstream GeminiClient expects.
13
+ */
14
+ import type { LLMChatResponse } from '../runtime/runtime-provider-types.js';
15
+ import type { LLMStreamEvent } from '../runtime/streaming-types.js';
16
+ interface GContent {
17
+ role?: string;
18
+ parts?: GPart[];
19
+ }
20
+ interface GPart {
21
+ text?: string;
22
+ functionCall?: {
23
+ id?: string;
24
+ name?: string;
25
+ args?: Record<string, unknown>;
26
+ };
27
+ [key: string]: unknown;
28
+ }
29
+ interface GCandidate {
30
+ content?: GContent;
31
+ finishReason?: string;
32
+ index?: number;
33
+ }
34
+ interface GUsageMetadata {
35
+ promptTokenCount?: number;
36
+ candidatesTokenCount?: number;
37
+ totalTokenCount?: number;
38
+ }
39
+ /**
40
+ * Structural match for GenerateContentResponse.
41
+ * We construct plain objects matching this shape and cast to the real class.
42
+ */
43
+ export interface GGenerateContentResponse {
44
+ candidates?: GCandidate[];
45
+ usageMetadata?: GUsageMetadata;
46
+ responseId?: string;
47
+ }
48
+ /**
49
+ * Convert an LLMChatResponse to a GenerateContentResponse.
50
+ */
51
+ export declare function convertLLMResponse(response: LLMChatResponse): GGenerateContentResponse;
52
+ /**
53
+ * Convert a single LLMStreamEvent into a GenerateContentResponse chunk.
54
+ *
55
+ * Returns null for events that should be skipped (e.g., tool_use_delta
56
+ * which is accumulated by the caller).
57
+ */
58
+ export declare function convertStreamEvent(event: LLMStreamEvent): GGenerateContentResponse | null;
59
+ export {};
@@ -0,0 +1,178 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Amodal Labs, Inc.
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ // ---------------------------------------------------------------------------
7
+ // Non-streaming conversion
8
+ // ---------------------------------------------------------------------------
9
+ /**
10
+ * Convert an LLMChatResponse to a GenerateContentResponse.
11
+ */
12
+ export function convertLLMResponse(response) {
13
+ const parts = response.content.map(blockToPart);
14
+ const result = {
15
+ candidates: [
16
+ {
17
+ content: { role: 'model', parts },
18
+ finishReason: mapFinishReason(response.stopReason),
19
+ index: 0,
20
+ },
21
+ ],
22
+ };
23
+ if (response.usage) {
24
+ result.usageMetadata = {
25
+ promptTokenCount: response.usage.inputTokens,
26
+ candidatesTokenCount: response.usage.outputTokens,
27
+ totalTokenCount: response.usage.inputTokens + response.usage.outputTokens,
28
+ };
29
+ }
30
+ attachFunctionCallsGetter(result);
31
+ return result;
32
+ }
33
+ // ---------------------------------------------------------------------------
34
+ // Streaming conversion
35
+ // ---------------------------------------------------------------------------
36
+ /**
37
+ * Convert a single LLMStreamEvent into a GenerateContentResponse chunk.
38
+ *
39
+ * Returns null for events that should be skipped (e.g., tool_use_delta
40
+ * which is accumulated by the caller).
41
+ */
42
+ export function convertStreamEvent(event) {
43
+ let chunk;
44
+ switch (event.type) {
45
+ case 'text_delta':
46
+ chunk = {
47
+ candidates: [
48
+ {
49
+ content: {
50
+ role: 'model',
51
+ parts: [{ text: event.text }],
52
+ },
53
+ index: 0,
54
+ },
55
+ ],
56
+ };
57
+ break;
58
+ case 'tool_use_start':
59
+ // Skip — we'll emit the complete function call on tool_use_end.
60
+ // The caller must track the name from this event.
61
+ return null;
62
+ case 'tool_use_delta':
63
+ // Skip — deltas are accumulated by the provider; args come in tool_use_end
64
+ return null;
65
+ case 'tool_use_end':
66
+ // Emit the complete function call with parsed args.
67
+ // The caller should have set the name from tool_use_start via toolNameMap.
68
+ chunk = {
69
+ candidates: [
70
+ {
71
+ content: {
72
+ role: 'model',
73
+ parts: [
74
+ {
75
+ functionCall: {
76
+ id: event.id,
77
+ name: '', // Caller must patch this with the name from tool_use_start
78
+ args: event.input,
79
+ },
80
+ },
81
+ ],
82
+ },
83
+ index: 0,
84
+ },
85
+ ],
86
+ };
87
+ break;
88
+ case 'message_end':
89
+ chunk = {
90
+ candidates: [
91
+ {
92
+ content: { role: 'model', parts: [] },
93
+ finishReason: mapFinishReason(event.stopReason),
94
+ index: 0,
95
+ },
96
+ ],
97
+ };
98
+ if (event.usage) {
99
+ chunk.usageMetadata = {
100
+ promptTokenCount: event.usage.inputTokens,
101
+ candidatesTokenCount: event.usage.outputTokens,
102
+ totalTokenCount: event.usage.inputTokens + event.usage.outputTokens,
103
+ };
104
+ }
105
+ break;
106
+ default:
107
+ return null;
108
+ }
109
+ if (chunk) {
110
+ attachFunctionCallsGetter(chunk);
111
+ }
112
+ return chunk;
113
+ }
114
+ // ---------------------------------------------------------------------------
115
+ // Helpers
116
+ // ---------------------------------------------------------------------------
117
+ /**
118
+ * Attach a `functionCalls` getter to a response object.
119
+ *
120
+ * The upstream GeminiChat uses `resp.functionCalls` (a class getter) to extract
121
+ * function calls from responses. Our plain objects don't have this getter,
122
+ * so we must add it manually.
123
+ */
124
+ function attachFunctionCallsGetter(resp) {
125
+ Object.defineProperty(resp, 'functionCalls', {
126
+ get() {
127
+ const parts = resp.candidates?.[0]?.content?.parts;
128
+ if (!parts)
129
+ return undefined;
130
+ const calls = parts
131
+ .filter((p) => p.functionCall)
132
+ .map((p) => p.functionCall);
133
+ return calls.length > 0 ? calls : undefined;
134
+ },
135
+ enumerable: false,
136
+ configurable: true,
137
+ });
138
+ // Also add `text` getter used by some upstream code
139
+ Object.defineProperty(resp, 'text', {
140
+ get() {
141
+ const parts = resp.candidates?.[0]?.content?.parts;
142
+ if (!parts)
143
+ return undefined;
144
+ const texts = parts.filter((p) => p.text).map((p) => p.text);
145
+ return texts.length > 0 ? texts.join('') : undefined;
146
+ },
147
+ enumerable: false,
148
+ configurable: true,
149
+ });
150
+ }
151
+ function blockToPart(block) {
152
+ if (block.type === 'text') {
153
+ return { text: block.text };
154
+ }
155
+ // tool_use
156
+ return {
157
+ functionCall: {
158
+ id: block.id,
159
+ name: block.name,
160
+ args: block.input,
161
+ },
162
+ };
163
+ }
164
+ function mapFinishReason(stopReason) {
165
+ switch (stopReason) {
166
+ case 'end_turn':
167
+ return 'STOP';
168
+ case 'tool_use':
169
+ return 'STOP';
170
+ case 'max_tokens':
171
+ return 'MAX_TOKENS';
172
+ case 'error':
173
+ return 'FINISH_REASON_UNSPECIFIED';
174
+ default:
175
+ return 'STOP';
176
+ }
177
+ }
178
+ //# sourceMappingURL=llm-to-google.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llm-to-google.js","sourceRoot":"","sources":["../../../../src/providers/content-generator/llm-to-google.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAmDH,8EAA8E;AAC9E,2BAA2B;AAC3B,8EAA8E;AAE9E;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAyB;IAC1D,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAEhD,MAAM,MAAM,GAA6B;QACvC,UAAU,EAAE;YACV;gBACE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE;gBACjC,YAAY,EAAE,eAAe,CAAC,QAAQ,CAAC,UAAU,CAAC;gBAClD,KAAK,EAAE,CAAC;aACT;SACF;KACF,CAAC;IAE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,UAAU;YACb,OAAO,MAAM,CAAC;QAChB,KAAK,YAAY;YACf,OAAO,YAAY,CAAC;QACtB,KAAK,OAAO;YACV,OAAO,2BAA2B,CAAC;QACrC;YACE,OAAO,MAAM,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Amodal Labs, Inc.
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ /**
7
+ * A ContentGenerator implementation that delegates to our existing
8
+ * RuntimeProvider implementations (Anthropic, OpenAI, Bedrock, Azure, etc.)
9
+ *
10
+ * This bridges the upstream gemini-cli-core's ContentGenerator interface
11
+ * (which uses @google/genai types) with our provider-neutral RuntimeProvider
12
+ * system. The upstream GeminiClient calls this instead of the Gemini API,
13
+ * so all its orchestration logic (compression, loop detection, hooks,
14
+ * tool execution) continues to work with any LLM provider.
15
+ */
16
+ import type { ModelConfig } from '../../repo/config-schema.js';
17
+ import { type GGenerateContentParams } from './google-to-llm.js';
18
+ import { type GGenerateContentResponse } from './llm-to-google.js';
19
+ /**
20
+ * ContentGenerator that routes LLM calls through our RuntimeProvider system.
21
+ *
22
+ * Implements the upstream ContentGenerator interface structurally — the
23
+ * actual type comes from @google/gemini-cli-core which we don't import
24
+ * directly. The upstream Config accepts any object matching the interface.
25
+ */
26
+ export declare class MultiProviderContentGenerator {
27
+ private readonly provider;
28
+ constructor(modelConfig: ModelConfig);
29
+ /**
30
+ * Non-streaming content generation.
31
+ */
32
+ generateContent(request: GGenerateContentParams, _userPromptId: string, _role: unknown): Promise<GGenerateContentResponse>;
33
+ /**
34
+ * Streaming content generation.
35
+ *
36
+ * Returns an async generator that yields GenerateContentResponse chunks
37
+ * as our RuntimeProvider streams events.
38
+ */
39
+ generateContentStream(request: GGenerateContentParams, _userPromptId: string, _role: unknown): Promise<AsyncGenerator<GGenerateContentResponse>>;
40
+ /**
41
+ * Estimate token count based on character length.
42
+ *
43
+ * Provider-specific tokenizers could be added later; for now a rough
44
+ * estimate (chars / 4) is sufficient since this is only used for
45
+ * context window overflow checks.
46
+ */
47
+ countTokens(request: {
48
+ contents: unknown;
49
+ model?: string;
50
+ }): Promise<{
51
+ totalTokens: number;
52
+ }>;
53
+ /**
54
+ * Embeddings are not supported for non-Google providers.
55
+ */
56
+ embedContent(_request: unknown): Promise<{
57
+ embeddings: never[];
58
+ }>;
59
+ private streamFromProvider;
60
+ private fakeStream;
61
+ }