@alvin0/ai-agent-sdk-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 (623) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +52 -0
  3. package/dist/agent/accounting/common.js +2 -0
  4. package/dist/agent/accounting/common.js.map +1 -0
  5. package/dist/agent/accounting/config.js +2 -0
  6. package/dist/agent/accounting/config.js.map +1 -0
  7. package/dist/agent/accounting/contracts.d.ts +36 -0
  8. package/dist/agent/accounting/contracts.d.ts.map +1 -0
  9. package/dist/agent/accounting/delivery/accounting-data.js +2 -0
  10. package/dist/agent/accounting/delivery/accounting-data.js.map +1 -0
  11. package/dist/agent/accounting/delivery/config.js +2 -0
  12. package/dist/agent/accounting/delivery/config.js.map +1 -0
  13. package/dist/agent/accounting/delivery/data.js +2 -0
  14. package/dist/agent/accounting/delivery/data.js.map +1 -0
  15. package/dist/agent/accounting/delivery/support-errors.js +2 -0
  16. package/dist/agent/accounting/delivery/support-errors.js.map +1 -0
  17. package/dist/agent/accounting/delivery/terminal.js +2 -0
  18. package/dist/agent/accounting/delivery/terminal.js.map +1 -0
  19. package/dist/agent/accounting/delivery-types.d.ts +43 -0
  20. package/dist/agent/accounting/delivery-types.d.ts.map +1 -0
  21. package/dist/agent/accounting/error.d.ts +18 -0
  22. package/dist/agent/accounting/error.d.ts.map +1 -0
  23. package/dist/agent/accounting/error.js +2 -0
  24. package/dist/agent/accounting/error.js.map +1 -0
  25. package/dist/agent/accounting/estimate.js +2 -0
  26. package/dist/agent/accounting/estimate.js.map +1 -0
  27. package/dist/agent/accounting/event-buffer.js +2 -0
  28. package/dist/agent/accounting/event-buffer.js.map +1 -0
  29. package/dist/agent/accounting/ledger.js +2 -0
  30. package/dist/agent/accounting/ledger.js.map +1 -0
  31. package/dist/agent/accounting/report.d.ts +70 -0
  32. package/dist/agent/accounting/report.d.ts.map +1 -0
  33. package/dist/agent/accounting/usage.d.ts +13 -0
  34. package/dist/agent/accounting/usage.d.ts.map +1 -0
  35. package/dist/agent/accounting/usage.js +2 -0
  36. package/dist/agent/accounting/usage.js.map +1 -0
  37. package/dist/agent/context/section.d.ts +15 -0
  38. package/dist/agent/context/section.d.ts.map +1 -0
  39. package/dist/agent/context/section.js +2 -0
  40. package/dist/agent/context/section.js.map +1 -0
  41. package/dist/agent/context/types.d.ts +98 -0
  42. package/dist/agent/context/types.d.ts.map +1 -0
  43. package/dist/agent/define/definition.d.ts +110 -0
  44. package/dist/agent/define/definition.d.ts.map +1 -0
  45. package/dist/agent/define/definition.js +2 -0
  46. package/dist/agent/define/definition.js.map +1 -0
  47. package/dist/agent/define/instructions.js +2 -0
  48. package/dist/agent/define/instructions.js.map +1 -0
  49. package/dist/agent/define/output-format.js +2 -0
  50. package/dist/agent/define/output-format.js.map +1 -0
  51. package/dist/agent/define/session/accounting.js +2 -0
  52. package/dist/agent/define/session/accounting.js.map +1 -0
  53. package/dist/agent/define/session/common.js +2 -0
  54. package/dist/agent/define/session/common.js.map +1 -0
  55. package/dist/agent/define/session/config.js +2 -0
  56. package/dist/agent/define/session/config.js.map +1 -0
  57. package/dist/agent/define/session/model-config.js +2 -0
  58. package/dist/agent/define/session/model-config.js.map +1 -0
  59. package/dist/agent/define/session/observer.js +2 -0
  60. package/dist/agent/define/session/observer.js.map +1 -0
  61. package/dist/agent/define/session/run-seal.js +2 -0
  62. package/dist/agent/define/session/run-seal.js.map +1 -0
  63. package/dist/agent/define/session/runtime-binding.js +2 -0
  64. package/dist/agent/define/session/runtime-binding.js.map +1 -0
  65. package/dist/agent/define/session/runtime-compaction.js +2 -0
  66. package/dist/agent/define/session/runtime-compaction.js.map +1 -0
  67. package/dist/agent/define/session/runtime-memory.js +2 -0
  68. package/dist/agent/define/session/runtime-memory.js.map +1 -0
  69. package/dist/agent/define/session/skills.js +2 -0
  70. package/dist/agent/define/session/skills.js.map +1 -0
  71. package/dist/agent/define/session/trace-accounting.js +2 -0
  72. package/dist/agent/define/session/trace-accounting.js.map +1 -0
  73. package/dist/agent/define/session/types.d.ts +217 -0
  74. package/dist/agent/define/session/types.d.ts.map +1 -0
  75. package/dist/agent/define/session/validation.js +2 -0
  76. package/dist/agent/define/session/validation.js.map +1 -0
  77. package/dist/agent/define/session.d.ts +77 -0
  78. package/dist/agent/define/session.d.ts.map +1 -0
  79. package/dist/agent/define/session.js +2 -0
  80. package/dist/agent/define/session.js.map +1 -0
  81. package/dist/agent/history/config.js +2 -0
  82. package/dist/agent/history/config.js.map +1 -0
  83. package/dist/agent/history/history.d.ts +33 -0
  84. package/dist/agent/history/history.d.ts.map +1 -0
  85. package/dist/agent/history/history.js +2 -0
  86. package/dist/agent/history/history.js.map +1 -0
  87. package/dist/agent/history/normalize.d.ts +7 -0
  88. package/dist/agent/history/normalize.d.ts.map +1 -0
  89. package/dist/agent/history/normalize.js +2 -0
  90. package/dist/agent/history/normalize.js.map +1 -0
  91. package/dist/agent/history/project.d.ts +14 -0
  92. package/dist/agent/history/project.d.ts.map +1 -0
  93. package/dist/agent/history/project.js +2 -0
  94. package/dist/agent/history/project.js.map +1 -0
  95. package/dist/agent/history/types.d.ts +85 -0
  96. package/dist/agent/history/types.d.ts.map +1 -0
  97. package/dist/agent/history/validation.js +2 -0
  98. package/dist/agent/history/validation.js.map +1 -0
  99. package/dist/agent/loop/events.d.ts +213 -0
  100. package/dist/agent/loop/events.d.ts.map +1 -0
  101. package/dist/agent/loop/queue.js +2 -0
  102. package/dist/agent/loop/queue.js.map +1 -0
  103. package/dist/agent/loop/run-turn.d.ts +8 -0
  104. package/dist/agent/loop/run-turn.d.ts.map +1 -0
  105. package/dist/agent/loop/run-turn.js +2 -0
  106. package/dist/agent/loop/run-turn.js.map +1 -0
  107. package/dist/agent/loop/schedule.d.ts +62 -0
  108. package/dist/agent/loop/schedule.d.ts.map +1 -0
  109. package/dist/agent/loop/schedule.js +3 -0
  110. package/dist/agent/loop/schedule.js.map +1 -0
  111. package/dist/agent/loop/turn/cancellation.js +2 -0
  112. package/dist/agent/loop/turn/cancellation.js.map +1 -0
  113. package/dist/agent/loop/turn/common.js +2 -0
  114. package/dist/agent/loop/turn/common.js.map +1 -0
  115. package/dist/agent/loop/turn/config.js +2 -0
  116. package/dist/agent/loop/turn/config.js.map +1 -0
  117. package/dist/agent/loop/turn/content.js +4 -0
  118. package/dist/agent/loop/turn/content.js.map +1 -0
  119. package/dist/agent/loop/turn/hooks.js +2 -0
  120. package/dist/agent/loop/turn/hooks.js.map +1 -0
  121. package/dist/agent/loop/turn/model-round.js +2 -0
  122. package/dist/agent/loop/turn/model-round.js.map +1 -0
  123. package/dist/agent/loop/turn/repetition.js +2 -0
  124. package/dist/agent/loop/turn/repetition.js.map +1 -0
  125. package/dist/agent/loop/turn/types.d.ts +82 -0
  126. package/dist/agent/loop/turn/types.d.ts.map +1 -0
  127. package/dist/agent/loop/turn/usage-stop.js +2 -0
  128. package/dist/agent/loop/turn/usage-stop.js.map +1 -0
  129. package/dist/agent/loop/turn/validation.js +2 -0
  130. package/dist/agent/loop/turn/validation.js.map +1 -0
  131. package/dist/agent/loop/types.d.ts +82 -0
  132. package/dist/agent/loop/types.d.ts.map +1 -0
  133. package/dist/agent/memory/accounting-binding.js +2 -0
  134. package/dist/agent/memory/accounting-binding.js.map +1 -0
  135. package/dist/agent/memory/compaction-config.d.ts +63 -0
  136. package/dist/agent/memory/compaction-config.d.ts.map +1 -0
  137. package/dist/agent/memory/compaction-config.js +2 -0
  138. package/dist/agent/memory/compaction-config.js.map +1 -0
  139. package/dist/agent/memory/compaction.d.ts +62 -0
  140. package/dist/agent/memory/compaction.d.ts.map +1 -0
  141. package/dist/agent/memory/compaction.js +6 -0
  142. package/dist/agent/memory/compaction.js.map +1 -0
  143. package/dist/agent/memory/memory.d.ts +61 -0
  144. package/dist/agent/memory/memory.d.ts.map +1 -0
  145. package/dist/agent/memory/memory.js +5 -0
  146. package/dist/agent/memory/memory.js.map +1 -0
  147. package/dist/agent/memory/persistence-types.d.ts +44 -0
  148. package/dist/agent/memory/persistence-types.d.ts.map +1 -0
  149. package/dist/agent/memory/surface-compaction.d.ts +6 -0
  150. package/dist/agent/memory/surface-compaction.d.ts.map +1 -0
  151. package/dist/agent/memory/surface-compaction.js +4 -0
  152. package/dist/agent/memory/surface-compaction.js.map +1 -0
  153. package/dist/agent/memory/token-estimator.d.ts +12 -0
  154. package/dist/agent/memory/token-estimator.d.ts.map +1 -0
  155. package/dist/agent/memory/token-estimator.js +2 -0
  156. package/dist/agent/memory/token-estimator.js.map +1 -0
  157. package/dist/agent/mode/run-agent.d.ts +79 -0
  158. package/dist/agent/mode/run-agent.d.ts.map +1 -0
  159. package/dist/agent/mode/run-agent.js +4 -0
  160. package/dist/agent/mode/run-agent.js.map +1 -0
  161. package/dist/agent/mode/user-input.d.ts +61 -0
  162. package/dist/agent/mode/user-input.d.ts.map +1 -0
  163. package/dist/agent/mode/user-input.js +2 -0
  164. package/dist/agent/mode/user-input.js.map +1 -0
  165. package/dist/agent/skill/catalog.d.ts +53 -0
  166. package/dist/agent/skill/catalog.d.ts.map +1 -0
  167. package/dist/agent/skill/catalog.js +2 -0
  168. package/dist/agent/skill/catalog.js.map +1 -0
  169. package/dist/agent/skill/definition.d.ts +106 -0
  170. package/dist/agent/skill/definition.d.ts.map +1 -0
  171. package/dist/agent/skill/definition.js +2 -0
  172. package/dist/agent/skill/definition.js.map +1 -0
  173. package/dist/agent/skill/provider/config.d.ts +11 -0
  174. package/dist/agent/skill/provider/config.d.ts.map +1 -0
  175. package/dist/agent/skill/provider/config.js +2 -0
  176. package/dist/agent/skill/provider/config.js.map +1 -0
  177. package/dist/agent/skill/provider/context.js +2 -0
  178. package/dist/agent/skill/provider/context.js.map +1 -0
  179. package/dist/agent/skill/provider/definition.d.ts +6 -0
  180. package/dist/agent/skill/provider/definition.d.ts.map +1 -0
  181. package/dist/agent/skill/provider/definition.js +2 -0
  182. package/dist/agent/skill/provider/definition.js.map +1 -0
  183. package/dist/agent/skill/provider/snapshot.js +2 -0
  184. package/dist/agent/skill/provider/snapshot.js.map +1 -0
  185. package/dist/agent/skill/provider/types.d.ts +49 -0
  186. package/dist/agent/skill/provider/types.d.ts.map +1 -0
  187. package/dist/agent/skill/tools.d.ts +45 -0
  188. package/dist/agent/skill/tools.d.ts.map +1 -0
  189. package/dist/agent/skill/tools.js +14 -0
  190. package/dist/agent/skill/tools.js.map +1 -0
  191. package/dist/agent/team/common.d.ts +26 -0
  192. package/dist/agent/team/common.d.ts.map +1 -0
  193. package/dist/agent/team/common.js +2 -0
  194. package/dist/agent/team/common.js.map +1 -0
  195. package/dist/agent/team/composed.d.ts +45 -0
  196. package/dist/agent/team/composed.d.ts.map +1 -0
  197. package/dist/agent/team/composed.js +2 -0
  198. package/dist/agent/team/composed.js.map +1 -0
  199. package/dist/agent/team/contracts.d.ts +54 -0
  200. package/dist/agent/team/contracts.d.ts.map +1 -0
  201. package/dist/agent/team/managed.d.ts +527 -0
  202. package/dist/agent/team/managed.d.ts.map +1 -0
  203. package/dist/agent/team/managed.js +4 -0
  204. package/dist/agent/team/managed.js.map +1 -0
  205. package/dist/agent/team/team.d.ts +142 -0
  206. package/dist/agent/team/team.d.ts.map +1 -0
  207. package/dist/agent/team/team.js +2 -0
  208. package/dist/agent/team/team.js.map +1 -0
  209. package/dist/agent/team/types.d.ts +170 -0
  210. package/dist/agent/team/types.d.ts.map +1 -0
  211. package/dist/agent/tool/approval.d.ts +106 -0
  212. package/dist/agent/tool/approval.d.ts.map +1 -0
  213. package/dist/agent/tool/approval.js +2 -0
  214. package/dist/agent/tool/approval.js.map +1 -0
  215. package/dist/agent/tool/capture.js +2 -0
  216. package/dist/agent/tool/capture.js.map +1 -0
  217. package/dist/agent/tool/config.js +2 -0
  218. package/dist/agent/tool/config.js.map +1 -0
  219. package/dist/agent/tool/definition.d.ts +227 -0
  220. package/dist/agent/tool/definition.d.ts.map +1 -0
  221. package/dist/agent/tool/definition.js +2 -0
  222. package/dist/agent/tool/definition.js.map +1 -0
  223. package/dist/agent/tool/errors.d.ts +82 -0
  224. package/dist/agent/tool/errors.d.ts.map +1 -0
  225. package/dist/agent/tool/errors.js +2 -0
  226. package/dist/agent/tool/errors.js.map +1 -0
  227. package/dist/agent/tool/execution.d.ts +60 -0
  228. package/dist/agent/tool/execution.d.ts.map +1 -0
  229. package/dist/agent/tool/execution.js +2 -0
  230. package/dist/agent/tool/execution.js.map +1 -0
  231. package/dist/agent/tool/output-budget.d.ts +159 -0
  232. package/dist/agent/tool/output-budget.d.ts.map +1 -0
  233. package/dist/agent/tool/output-budget.js +3 -0
  234. package/dist/agent/tool/output-budget.js.map +1 -0
  235. package/dist/agent/tool/pipeline.d.ts +98 -0
  236. package/dist/agent/tool/pipeline.d.ts.map +1 -0
  237. package/dist/agent/tool/pipeline.js +4 -0
  238. package/dist/agent/tool/pipeline.js.map +1 -0
  239. package/dist/agent/tool/registry.d.ts +70 -0
  240. package/dist/agent/tool/registry.d.ts.map +1 -0
  241. package/dist/agent/tool/registry.js +2 -0
  242. package/dist/agent/tool/registry.js.map +1 -0
  243. package/dist/agent/tool/schema.d.ts +12 -0
  244. package/dist/agent/tool/schema.d.ts.map +1 -0
  245. package/dist/agent/tool/schema.js +2 -0
  246. package/dist/agent/tool/schema.js.map +1 -0
  247. package/dist/agent/tool/source-types.d.ts +25 -0
  248. package/dist/agent/tool/source-types.d.ts.map +1 -0
  249. package/dist/agent/trace/trace.d.ts +63 -0
  250. package/dist/agent/trace/trace.d.ts.map +1 -0
  251. package/dist/agent/trace/trace.js +2 -0
  252. package/dist/agent/trace/trace.js.map +1 -0
  253. package/dist/agent.d.ts +52 -0
  254. package/dist/agent.js +1 -0
  255. package/dist/async/settlement.d.ts +6 -0
  256. package/dist/async/settlement.d.ts.map +1 -0
  257. package/dist/async/settlement.js +2 -0
  258. package/dist/async/settlement.js.map +1 -0
  259. package/dist/capability/common/config.js +2 -0
  260. package/dist/capability/common/config.js.map +1 -0
  261. package/dist/capability/common/data.js +2 -0
  262. package/dist/capability/common/data.js.map +1 -0
  263. package/dist/composition/agent/author.d.ts +12 -0
  264. package/dist/composition/agent/author.d.ts.map +1 -0
  265. package/dist/composition/agent/author.js +2 -0
  266. package/dist/composition/agent/author.js.map +1 -0
  267. package/dist/composition/agent/definition.js +2 -0
  268. package/dist/composition/agent/definition.js.map +1 -0
  269. package/dist/composition/agent/native-event.js +2 -0
  270. package/dist/composition/agent/native-event.js.map +1 -0
  271. package/dist/composition/agent/native-tools.js +2 -0
  272. package/dist/composition/agent/native-tools.js.map +1 -0
  273. package/dist/composition/agent/options.js +2 -0
  274. package/dist/composition/agent/options.js.map +1 -0
  275. package/dist/composition/agent/policy.js +2 -0
  276. package/dist/composition/agent/policy.js.map +1 -0
  277. package/dist/composition/agent/public-message.js +2 -0
  278. package/dist/composition/agent/public-message.js.map +1 -0
  279. package/dist/composition/agent/session.js +2 -0
  280. package/dist/composition/agent/session.js.map +1 -0
  281. package/dist/composition/agent/types.d.ts +218 -0
  282. package/dist/composition/agent/types.d.ts.map +1 -0
  283. package/dist/composition/common/counter.js +2 -0
  284. package/dist/composition/common/counter.js.map +1 -0
  285. package/dist/composition/common/errors.d.ts +15 -0
  286. package/dist/composition/common/errors.d.ts.map +1 -0
  287. package/dist/composition/common/errors.js +2 -0
  288. package/dist/composition/common/errors.js.map +1 -0
  289. package/dist/composition/common/json-data.js +2 -0
  290. package/dist/composition/common/json-data.js.map +1 -0
  291. package/dist/composition/credential/config.d.ts +5 -0
  292. package/dist/composition/credential/config.d.ts.map +1 -0
  293. package/dist/composition/credential/config.js +2 -0
  294. package/dist/composition/credential/config.js.map +1 -0
  295. package/dist/composition/credential/definition.d.ts +9 -0
  296. package/dist/composition/credential/definition.d.ts.map +1 -0
  297. package/dist/composition/credential/definition.js +2 -0
  298. package/dist/composition/credential/definition.js.map +1 -0
  299. package/dist/composition/credential/types.d.ts +38 -0
  300. package/dist/composition/credential/types.d.ts.map +1 -0
  301. package/dist/composition/delivery/ack.js +2 -0
  302. package/dist/composition/delivery/ack.js.map +1 -0
  303. package/dist/composition/delivery/attempt.js +2 -0
  304. package/dist/composition/delivery/attempt.js.map +1 -0
  305. package/dist/composition/delivery/batch.js +2 -0
  306. package/dist/composition/delivery/batch.js.map +1 -0
  307. package/dist/composition/delivery/checkpoint.js +2 -0
  308. package/dist/composition/delivery/checkpoint.js.map +1 -0
  309. package/dist/composition/delivery/event.js +2 -0
  310. package/dist/composition/delivery/event.js.map +1 -0
  311. package/dist/composition/delivery/resource.d.ts +11 -0
  312. package/dist/composition/delivery/resource.d.ts.map +1 -0
  313. package/dist/composition/delivery/resource.js +2 -0
  314. package/dist/composition/delivery/resource.js.map +1 -0
  315. package/dist/composition/delivery/staging.js +2 -0
  316. package/dist/composition/delivery/staging.js.map +1 -0
  317. package/dist/composition/diagnostics/config.js +2 -0
  318. package/dist/composition/diagnostics/config.js.map +1 -0
  319. package/dist/composition/diagnostics/ring.d.ts +12 -0
  320. package/dist/composition/diagnostics/ring.d.ts.map +1 -0
  321. package/dist/composition/diagnostics/ring.js +2 -0
  322. package/dist/composition/diagnostics/ring.js.map +1 -0
  323. package/dist/composition/exporter/definition.d.ts +7 -0
  324. package/dist/composition/exporter/definition.d.ts.map +1 -0
  325. package/dist/composition/exporter/definition.js +2 -0
  326. package/dist/composition/exporter/definition.js.map +1 -0
  327. package/dist/composition/exporter/lifecycle.js +2 -0
  328. package/dist/composition/exporter/lifecycle.js.map +1 -0
  329. package/dist/composition/exporter/preflight.js +2 -0
  330. package/dist/composition/exporter/preflight.js.map +1 -0
  331. package/dist/composition/exporter/types.d.ts +25 -0
  332. package/dist/composition/exporter/types.d.ts.map +1 -0
  333. package/dist/composition/exporter/types.js +2 -0
  334. package/dist/composition/exporter/types.js.map +1 -0
  335. package/dist/composition/identity/agent.js +2 -0
  336. package/dist/composition/identity/agent.js.map +1 -0
  337. package/dist/composition/lifecycle/bounded.js +2 -0
  338. package/dist/composition/lifecycle/bounded.js.map +1 -0
  339. package/dist/composition/lifecycle/operations.js +2 -0
  340. package/dist/composition/lifecycle/operations.js.map +1 -0
  341. package/dist/composition/lifecycle/types.d.ts +13 -0
  342. package/dist/composition/lifecycle/types.d.ts.map +1 -0
  343. package/dist/composition/lifecycle/types.js +2 -0
  344. package/dist/composition/lifecycle/types.js.map +1 -0
  345. package/dist/composition/logging/config.js +2 -0
  346. package/dist/composition/logging/config.js.map +1 -0
  347. package/dist/composition/logging/integration.js +2 -0
  348. package/dist/composition/logging/integration.js.map +1 -0
  349. package/dist/composition/logging/logger.d.ts +9 -0
  350. package/dist/composition/logging/logger.d.ts.map +1 -0
  351. package/dist/composition/logging/logger.js +2 -0
  352. package/dist/composition/logging/logger.js.map +1 -0
  353. package/dist/composition/memory/config.d.ts +10 -0
  354. package/dist/composition/memory/config.d.ts.map +1 -0
  355. package/dist/composition/memory/config.js +2 -0
  356. package/dist/composition/memory/config.js.map +1 -0
  357. package/dist/composition/memory/definition.d.ts +7 -0
  358. package/dist/composition/memory/definition.d.ts.map +1 -0
  359. package/dist/composition/memory/definition.js +2 -0
  360. package/dist/composition/memory/definition.js.map +1 -0
  361. package/dist/composition/memory/key.js +2 -0
  362. package/dist/composition/memory/key.js.map +1 -0
  363. package/dist/composition/memory/resume.js +2 -0
  364. package/dist/composition/memory/resume.js.map +1 -0
  365. package/dist/composition/memory/run.js +2 -0
  366. package/dist/composition/memory/run.js.map +1 -0
  367. package/dist/composition/model-catalog/config.js +2 -0
  368. package/dist/composition/model-catalog/config.js.map +1 -0
  369. package/dist/composition/model-catalog/manager.js +2 -0
  370. package/dist/composition/model-catalog/manager.js.map +1 -0
  371. package/dist/composition/model-catalog/options.js +2 -0
  372. package/dist/composition/model-catalog/options.js.map +1 -0
  373. package/dist/composition/model-catalog/types.d.ts +9 -0
  374. package/dist/composition/model-catalog/types.d.ts.map +1 -0
  375. package/dist/composition/observation/config.js +2 -0
  376. package/dist/composition/observation/config.js.map +1 -0
  377. package/dist/composition/observation/extensions.js +2 -0
  378. package/dist/composition/observation/extensions.js.map +1 -0
  379. package/dist/composition/observation/final-report.d.ts +6 -0
  380. package/dist/composition/observation/final-report.d.ts.map +1 -0
  381. package/dist/composition/observation/final-report.js +2 -0
  382. package/dist/composition/observation/final-report.js.map +1 -0
  383. package/dist/composition/observation/health.d.ts +13 -0
  384. package/dist/composition/observation/health.d.ts.map +1 -0
  385. package/dist/composition/observation/port.d.ts +11 -0
  386. package/dist/composition/observation/port.d.ts.map +1 -0
  387. package/dist/composition/observation/port.js +2 -0
  388. package/dist/composition/observation/port.js.map +1 -0
  389. package/dist/composition/preflight.js +2 -0
  390. package/dist/composition/preflight.js.map +1 -0
  391. package/dist/composition/provider/activation.js +2 -0
  392. package/dist/composition/provider/activation.js.map +1 -0
  393. package/dist/composition/provider/definition.d.ts +7 -0
  394. package/dist/composition/provider/definition.d.ts.map +1 -0
  395. package/dist/composition/provider/definition.js +2 -0
  396. package/dist/composition/provider/definition.js.map +1 -0
  397. package/dist/composition/provider/model-selection.js +2 -0
  398. package/dist/composition/provider/model-selection.js.map +1 -0
  399. package/dist/composition/provider/preflight.js +2 -0
  400. package/dist/composition/provider/preflight.js.map +1 -0
  401. package/dist/composition/provider/types.d.ts +38 -0
  402. package/dist/composition/provider/types.d.ts.map +1 -0
  403. package/dist/composition/provider/types.js +2 -0
  404. package/dist/composition/provider/types.js.map +1 -0
  405. package/dist/composition/queue/config.js +2 -0
  406. package/dist/composition/queue/config.js.map +1 -0
  407. package/dist/composition/queue/scheduler.js +2 -0
  408. package/dist/composition/queue/scheduler.js.map +1 -0
  409. package/dist/composition/queue/store.js +2 -0
  410. package/dist/composition/queue/store.js.map +1 -0
  411. package/dist/composition/runtime/config.js +2 -0
  412. package/dist/composition/runtime/config.js.map +1 -0
  413. package/dist/composition/runtime/owner.js +2 -0
  414. package/dist/composition/runtime/owner.js.map +1 -0
  415. package/dist/composition/runtime/public.d.ts +7 -0
  416. package/dist/composition/runtime/public.d.ts.map +1 -0
  417. package/dist/composition/runtime/public.js +2 -0
  418. package/dist/composition/runtime/public.js.map +1 -0
  419. package/dist/composition/runtime/types.d.ts +76 -0
  420. package/dist/composition/runtime/types.d.ts.map +1 -0
  421. package/dist/composition/startup.js +2 -0
  422. package/dist/composition/startup.js.map +1 -0
  423. package/dist/composition/team/config.js +2 -0
  424. package/dist/composition/team/config.js.map +1 -0
  425. package/dist/composition/team/options.js +2 -0
  426. package/dist/composition/team/options.js.map +1 -0
  427. package/dist/composition/team/runtime.js +2 -0
  428. package/dist/composition/team/runtime.js.map +1 -0
  429. package/dist/composition/team/types.d.ts +63 -0
  430. package/dist/composition/team/types.d.ts.map +1 -0
  431. package/dist/composition/tool-source/config.d.ts +5 -0
  432. package/dist/composition/tool-source/config.d.ts.map +1 -0
  433. package/dist/composition/tool-source/config.js +2 -0
  434. package/dist/composition/tool-source/config.js.map +1 -0
  435. package/dist/composition/tool-source/definition.d.ts +7 -0
  436. package/dist/composition/tool-source/definition.d.ts.map +1 -0
  437. package/dist/composition/tool-source/definition.js +2 -0
  438. package/dist/composition/tool-source/definition.js.map +1 -0
  439. package/dist/composition/tool-source/snapshot.js +2 -0
  440. package/dist/composition/tool-source/snapshot.js.map +1 -0
  441. package/dist/contract/adapter.d.ts +91 -0
  442. package/dist/contract/adapter.d.ts.map +1 -0
  443. package/dist/contract/adapter.js +2 -0
  444. package/dist/contract/adapter.js.map +1 -0
  445. package/dist/contract/call-config.d.ts +36 -0
  446. package/dist/contract/call-config.d.ts.map +1 -0
  447. package/dist/contract/call-config.js +2 -0
  448. package/dist/contract/call-config.js.map +1 -0
  449. package/dist/contract/generate-options.d.ts +41 -0
  450. package/dist/contract/generate-options.d.ts.map +1 -0
  451. package/dist/contract/model-info.d.ts +99 -0
  452. package/dist/contract/model-info.d.ts.map +1 -0
  453. package/dist/contract/output-format.d.ts +18 -0
  454. package/dist/contract/output-format.d.ts.map +1 -0
  455. package/dist/contract/retry-policy.d.ts +104 -0
  456. package/dist/contract/retry-policy.d.ts.map +1 -0
  457. package/dist/contract/retry-policy.js +2 -0
  458. package/dist/contract/retry-policy.js.map +1 -0
  459. package/dist/contract/tool.d.ts +65 -0
  460. package/dist/contract/tool.d.ts.map +1 -0
  461. package/dist/contract/tool.js +2 -0
  462. package/dist/contract/tool.js.map +1 -0
  463. package/dist/errors/agent-sdk-error.d.ts +88 -0
  464. package/dist/errors/agent-sdk-error.d.ts.map +1 -0
  465. package/dist/errors/agent-sdk-error.js +2 -0
  466. package/dist/errors/agent-sdk-error.js.map +1 -0
  467. package/dist/errors/capability-identity.d.ts +10 -0
  468. package/dist/errors/capability-identity.d.ts.map +1 -0
  469. package/dist/errors/capability-identity.js +2 -0
  470. package/dist/errors/capability-identity.js.map +1 -0
  471. package/dist/errors/failure.d.ts +33 -0
  472. package/dist/errors/failure.d.ts.map +1 -0
  473. package/dist/errors/failure.js +2 -0
  474. package/dist/errors/failure.js.map +1 -0
  475. package/dist/errors/model-error.d.ts +83 -0
  476. package/dist/errors/model-error.d.ts.map +1 -0
  477. package/dist/errors/model-error.js +2 -0
  478. package/dist/errors/model-error.js.map +1 -0
  479. package/dist/http/api-key.d.ts +47 -0
  480. package/dist/http/api-key.d.ts.map +1 -0
  481. package/dist/http/api-key.js +2 -0
  482. package/dist/http/api-key.js.map +1 -0
  483. package/dist/http/attribution.d.ts +51 -0
  484. package/dist/http/attribution.d.ts.map +1 -0
  485. package/dist/http/attribution.js +2 -0
  486. package/dist/http/attribution.js.map +1 -0
  487. package/dist/index.d.ts +70 -0
  488. package/dist/index.js +1 -0
  489. package/dist/logging/types.d.ts +53 -0
  490. package/dist/logging/types.d.ts.map +1 -0
  491. package/dist/logging/types.js +2 -0
  492. package/dist/logging/types.js.map +1 -0
  493. package/dist/memory.d.ts +10 -0
  494. package/dist/memory.js +1 -0
  495. package/dist/message/content.d.ts +125 -0
  496. package/dist/message/content.d.ts.map +1 -0
  497. package/dist/message/message.d.ts +154 -0
  498. package/dist/message/message.d.ts.map +1 -0
  499. package/dist/message/message.js +2 -0
  500. package/dist/message/message.js.map +1 -0
  501. package/dist/message/projection.d.ts +34 -0
  502. package/dist/message/projection.d.ts.map +1 -0
  503. package/dist/message/projection.js +2 -0
  504. package/dist/message/projection.js.map +1 -0
  505. package/dist/observability/bus.d.ts +7 -0
  506. package/dist/observability/bus.d.ts.map +1 -0
  507. package/dist/observability/bus.js +2 -0
  508. package/dist/observability/bus.js.map +1 -0
  509. package/dist/observability/exporters.d.ts +39 -0
  510. package/dist/observability/exporters.d.ts.map +1 -0
  511. package/dist/observability/exporters.js +2 -0
  512. package/dist/observability/exporters.js.map +1 -0
  513. package/dist/observability/logger.js +2 -0
  514. package/dist/observability/logger.js.map +1 -0
  515. package/dist/observability/projections.d.ts +12 -0
  516. package/dist/observability/projections.d.ts.map +1 -0
  517. package/dist/observability/projections.js +2 -0
  518. package/dist/observability/projections.js.map +1 -0
  519. package/dist/observability/types.d.ts +103 -0
  520. package/dist/observability/types.d.ts.map +1 -0
  521. package/dist/observability.d.ts +20 -0
  522. package/dist/observability.js +1 -0
  523. package/dist/observation/boundaries.js +2 -0
  524. package/dist/observation/boundaries.js.map +1 -0
  525. package/dist/observation/context.d.ts +39 -0
  526. package/dist/observation/context.d.ts.map +1 -0
  527. package/dist/observation/context.js +2 -0
  528. package/dist/observation/context.js.map +1 -0
  529. package/dist/observation/event.d.ts +50 -0
  530. package/dist/observation/event.d.ts.map +1 -0
  531. package/dist/observation/event.js +2 -0
  532. package/dist/observation/event.js.map +1 -0
  533. package/dist/observation/port.d.ts +56 -0
  534. package/dist/observation/port.d.ts.map +1 -0
  535. package/dist/observation/port.js +2 -0
  536. package/dist/observation/port.js.map +1 -0
  537. package/dist/observation/privacy.js +2 -0
  538. package/dist/observation/privacy.js.map +1 -0
  539. package/dist/observation/report.d.ts +117 -0
  540. package/dist/observation/report.d.ts.map +1 -0
  541. package/dist/observation/report.js +2 -0
  542. package/dist/observation/report.js.map +1 -0
  543. package/dist/observation/telemetry-types.d.ts +29 -0
  544. package/dist/observation/telemetry-types.d.ts.map +1 -0
  545. package/dist/observation/usage.d.ts +52 -0
  546. package/dist/observation/usage.d.ts.map +1 -0
  547. package/dist/observation/usage.js +2 -0
  548. package/dist/observation/usage.js.map +1 -0
  549. package/dist/platform/adapter.js +2 -0
  550. package/dist/platform/adapter.js.map +1 -0
  551. package/dist/platform/capability-operation.js +2 -0
  552. package/dist/platform/capability-operation.js.map +1 -0
  553. package/dist/platform/config.js +2 -0
  554. package/dist/platform/config.js.map +1 -0
  555. package/dist/platform/logger-platform.js +2 -0
  556. package/dist/platform/logger-platform.js.map +1 -0
  557. package/dist/platform/resources.js +2 -0
  558. package/dist/platform/resources.js.map +1 -0
  559. package/dist/plugin/provider-plugin.d.ts +37 -0
  560. package/dist/plugin/provider-plugin.d.ts.map +1 -0
  561. package/dist/plugin/provider-plugin.js +2 -0
  562. package/dist/plugin/provider-plugin.js.map +1 -0
  563. package/dist/primitives/brand.d.ts +61 -0
  564. package/dist/primitives/brand.d.ts.map +1 -0
  565. package/dist/primitives/brand.js +2 -0
  566. package/dist/primitives/brand.js.map +1 -0
  567. package/dist/primitives/freeze.d.ts +20 -0
  568. package/dist/primitives/freeze.d.ts.map +1 -0
  569. package/dist/primitives/freeze.js +2 -0
  570. package/dist/primitives/freeze.js.map +1 -0
  571. package/dist/primitives/json-snapshot.js +2 -0
  572. package/dist/primitives/json-snapshot.js.map +1 -0
  573. package/dist/primitives/json.d.ts +32 -0
  574. package/dist/primitives/json.d.ts.map +1 -0
  575. package/dist/primitives/json.js +2 -0
  576. package/dist/primitives/json.js.map +1 -0
  577. package/dist/primitives/never.d.ts +22 -0
  578. package/dist/primitives/never.d.ts.map +1 -0
  579. package/dist/primitives/never.js +2 -0
  580. package/dist/primitives/never.js.map +1 -0
  581. package/dist/primitives/snapshot.d.ts +10 -0
  582. package/dist/primitives/snapshot.d.ts.map +1 -0
  583. package/dist/primitives/snapshot.js +2 -0
  584. package/dist/primitives/snapshot.js.map +1 -0
  585. package/dist/primitives/version.d.ts +6 -0
  586. package/dist/primitives/version.d.ts.map +1 -0
  587. package/dist/primitives/version.js +2 -0
  588. package/dist/primitives/version.js.map +1 -0
  589. package/dist/provider.d.ts +19 -0
  590. package/dist/provider.js +1 -0
  591. package/dist/runtime/model-call-handle.js +2 -0
  592. package/dist/runtime/model-call-handle.js.map +1 -0
  593. package/dist/runtime/model-metadata.js +2 -0
  594. package/dist/runtime/model-metadata.js.map +1 -0
  595. package/dist/runtime/model-stream.js +2 -0
  596. package/dist/runtime/model-stream.js.map +1 -0
  597. package/dist/runtime/registry.d.ts +171 -0
  598. package/dist/runtime/registry.d.ts.map +1 -0
  599. package/dist/runtime/registry.js +2 -0
  600. package/dist/runtime/registry.js.map +1 -0
  601. package/dist/runtime/with-retry.d.ts +45 -0
  602. package/dist/runtime/with-retry.d.ts.map +1 -0
  603. package/dist/runtime/with-retry.js +2 -0
  604. package/dist/runtime/with-retry.js.map +1 -0
  605. package/dist/skills.d.ts +8 -0
  606. package/dist/skills.js +1 -0
  607. package/dist/stream/assembler.d.ts +86 -0
  608. package/dist/stream/assembler.d.ts.map +1 -0
  609. package/dist/stream/assembler.js +2 -0
  610. package/dist/stream/assembler.js.map +1 -0
  611. package/dist/stream/chunk.d.ts +135 -0
  612. package/dist/stream/chunk.d.ts.map +1 -0
  613. package/dist/stream/idle-timeout.d.ts +30 -0
  614. package/dist/stream/idle-timeout.d.ts.map +1 -0
  615. package/dist/stream/idle-timeout.js +2 -0
  616. package/dist/stream/idle-timeout.js.map +1 -0
  617. package/dist/support-safe/error.d.ts +29 -0
  618. package/dist/support-safe/error.d.ts.map +1 -0
  619. package/dist/support-safe/error.js +2 -0
  620. package/dist/support-safe/error.js.map +1 -0
  621. package/dist/tools.d.ts +15 -0
  622. package/dist/tools.js +1 -0
  623. package/package.json +96 -0
@@ -0,0 +1,91 @@
1
+ import { StreamChunk } from "../stream/chunk.js";
2
+ import { ModelInvocationContext } from "../observation/report.js";
3
+ import { GenerateOptions } from "./generate-options.js";
4
+ import { ModelCatalogOptions, ModelCatalogSnapshot, ModelInfo, ProviderInfo, ResolvedModelInfo } from "./model-info.js";
5
+ import { ResolvedRetryPolicy } from "./retry-policy.js";
6
+ //#region src/contract/adapter.d.ts
7
+ /**
8
+ * One adapter-owned model-resolution generation, bound to its eventual stream call.
9
+ *
10
+ * This exists to close a real gap. Between "what can this model do?" and "send
11
+ * the request", configuration can change. Without binding, a caller could resolve
12
+ * capabilities against one endpoint and dispatch to another  Ecombining one
13
+ * generation's answers with another's connection. The pair travels together here
14
+ * so that cannot happen.
15
+ */
16
+ interface PreparedAdapterCall {
17
+ /** Exact model metadata from the SAME generation as {@link stream}. */
18
+ readonly model: ResolvedModelInfo;
19
+ /** Dispatch through that generation, without re-reading dynamic connection facts. */
20
+ stream(options: GenerateOptions, context?: ModelInvocationContext): AsyncIterable<StreamChunk>;
21
+ }
22
+ /**
23
+ * Provider-wire adapter for this SDK's message and stream vocabulary.
24
+ *
25
+ * Register implementations with `registry.registerAdapter(routes, adapter)`.
26
+ *
27
+ * Contract obligations on implementations:
28
+ * - honour `options.signal` promptly;
29
+ * - emit chunks per the protocol documented on {@link StreamChunk};
30
+ * - include `attributionHeaders()` on every provider HTTP request.
31
+ */
32
+ declare abstract class ModelAdapter {
33
+ /**
34
+ * Describe one provider route owned by this adapter.
35
+ * @param provider - a route this instance was registered under.
36
+ * @returns detached display metadata whose `id` MUST equal `provider`.
37
+ */
38
+ providerInfo(provider: string): ProviderInfo;
39
+ /**
40
+ * The retry policy this route owns.
41
+ * @param _provider - a route this instance was registered under.
42
+ * @returns a resolved policy, or `undefined` to accept the defaults.
43
+ */
44
+ providerRetryPolicy(_provider: string): ResolvedRetryPolicy | undefined;
45
+ /**
46
+ * List models this adapter can currently advertise for one route.
47
+ *
48
+ * ADVISORY only: an adapter may accept unlisted ids, and consumers must not
49
+ * turn absence from this list into a request rejection.
50
+ * @param _provider - one route owned by this adapter.
51
+ * @returns discoverable models, in adapter-preferred order.
52
+ */
53
+ listModels(_provider: string, _signal?: AbortSignal): Promise<readonly ModelInfo[]>;
54
+ /** Uncached adapter-level catalog; the composition runtime owns refresh policy. */
55
+ modelCatalog(provider: string, options?: ModelCatalogOptions): Promise<ModelCatalogSnapshot>;
56
+ /**
57
+ * Resolve all metadata available for one exact model.
58
+ *
59
+ * Independent of the advisory catalog, and NOT request validation  Ean unknown
60
+ * id resolves to a minimal descriptor rather than an error.
61
+ * @param provider - one route owned by this adapter.
62
+ * @param model - exact model id.
63
+ * @param _signal - cancellation; async implementations must settle promptly after abort.
64
+ * @returns identity plus any context, default, and reasoning metadata.
65
+ */
66
+ resolveModel(provider: string, model: string, _signal?: AbortSignal): Promise<ResolvedModelInfo>;
67
+ /**
68
+ * Bind exact model metadata and the eventual dispatch to one generation.
69
+ *
70
+ * Adapters whose connection facts come from mutable configuration override this
71
+ * and snapshot those facts here; the default is sufficient for a static one.
72
+ * @param provider - registered route.
73
+ * @param model - exact model id.
74
+ * @param signal - cancellation for model resolution.
75
+ * @returns metadata plus a one-generation stream entry point.
76
+ */
77
+ prepareCall(provider: string, model: string, signal?: AbortSignal, context?: ModelInvocationContext): Promise<PreparedAdapterCall>;
78
+ /**
79
+ * Stream one model call as raw chunks. The only required method.
80
+ *
81
+ * There is deliberately no non-streaming counterpart. A single code path cannot
82
+ * drift from itself, and a caller wanting one value awaits the assembled
83
+ * message instead.
84
+ * @param options - the fully assembled request.
85
+ * @returns the chunk stream, obeying the {@link StreamChunk} protocol.
86
+ */
87
+ abstract stream(options: GenerateOptions, context?: ModelInvocationContext): AsyncIterable<StreamChunk>;
88
+ }
89
+ //#endregion
90
+ export { ModelAdapter, PreparedAdapterCall };
91
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","names":[],"sources":["../../src/contract/adapter.ts"],"mappings":";;;;;;;;;;;;;;;UAiCiB;;WAEN,OAAO;;EAEhB,OAAO,SAAS,iBAAiB,UAAU,yBAAyB,cAAc;;;;;;;;;;;;uBAa9D;;;;;;EAMpB,aAAa,mBAAmB;;;;;;EAShC,oBAAoB,oBAAoB;;;;;;;;;EAYxC,WAAW,mBAAmB,UAAU,cAAc,iBAAiB;;EAKjE,aAAa,kBAAkB,UAAS,sBAA2B,QAAQ;;;;;;;;;;;EAkBjF,aACE,kBACA,eACA,UAAU,cACT,QAAQ;;;;;;;;;;;EAcL,YACJ,kBACA,eACA,SAAS,aACT,UAAU,yBACT,QAAQ;;;;;;;;;;WAgBF,OAAO,SAAS,iBAAiB,UAAU,yBAAyB,cAAc"}
@@ -0,0 +1,2 @@
1
+ var e=class{providerInfo(e){return{id:e,name:e}}providerRetryPolicy(e){}listModels(e,t){return Promise.resolve([])}async modelCatalog(e,t={}){let n=await this.listModels(e,t.signal),r=new Date().toISOString();return Object.freeze({provider:Object.freeze({...this.providerInfo(e)}),state:n.length===0?`empty`:`fresh`,revision:`adapter-uncached`,models:Object.freeze([...n]),observedAt:r})}resolveModel(e,t,n){return Promise.resolve({provider:e,id:t,name:t})}async prepareCall(e,t,n,r){return{model:await this.resolveModel(e,t,n),stream:(e,t=r)=>this.stream(e,t)}}};export{e as ModelAdapter};
2
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.js","names":[],"sources":["../../src/contract/adapter.ts"],"sourcesContent":["/**\n * The contract a provider backend implements.\n *\n * Shape worth noting: ONE abstract method. Everything else has a working default,\n * so a minimal adapter is a single `stream()` implementation, while a fully\n * featured one overrides metadata, catalog, and generation binding. That keeps the\n * barrier to a new provider low without capping what a mature one can express.\n *\n * Also note that every metadata method takes the route key as its first argument\n * rather than reading instance state. One adapter instance can therefore serve\n * many routes  Ethe same Anthropic adapter can back both a first-party route and\n * a proxy route with different endpoints and credentials.\n *\n * @module ai-agent-sdk/core/contract/adapter\n */\n\nimport type { StreamChunk } from '../stream/chunk.ts'\nimport type { ModelInvocationContext } from '../observation/report.ts'\nimport type { GenerateOptions } from './generate-options.ts'\nimport type {\n ModelCatalogOptions, ModelCatalogSnapshot, ModelInfo, ProviderInfo, ResolvedModelInfo,\n} from './model-info.ts'\nimport type { ResolvedRetryPolicy } from './retry-policy.ts'\n\n/**\n * One adapter-owned model-resolution generation, bound to its eventual stream call.\n *\n * This exists to close a real gap. Between \"what can this model do?\" and \"send\n * the request\", configuration can change. Without binding, a caller could resolve\n * capabilities against one endpoint and dispatch to another  Ecombining one\n * generation's answers with another's connection. The pair travels together here\n * so that cannot happen.\n */\nexport interface PreparedAdapterCall {\n /** Exact model metadata from the SAME generation as {@link stream}. */\n readonly model: ResolvedModelInfo\n /** Dispatch through that generation, without re-reading dynamic connection facts. */\n stream(options: GenerateOptions, context?: ModelInvocationContext): AsyncIterable<StreamChunk>\n}\n\n/**\n * Provider-wire adapter for this SDK's message and stream vocabulary.\n *\n * Register implementations with `registry.registerAdapter(routes, adapter)`.\n *\n * Contract obligations on implementations:\n * - honour `options.signal` promptly;\n * - emit chunks per the protocol documented on {@link StreamChunk};\n * - include `attributionHeaders()` on every provider HTTP request.\n */\nexport abstract class ModelAdapter {\n /**\n * Describe one provider route owned by this adapter.\n * @param provider - a route this instance was registered under.\n * @returns detached display metadata whose `id` MUST equal `provider`.\n */\n providerInfo(provider: string): ProviderInfo {\n return { id: provider, name: provider }\n }\n\n /**\n * The retry policy this route owns.\n * @param _provider - a route this instance was registered under.\n * @returns a resolved policy, or `undefined` to accept the defaults.\n */\n providerRetryPolicy(_provider: string): ResolvedRetryPolicy | undefined {\n return undefined\n }\n\n /**\n * List models this adapter can currently advertise for one route.\n *\n * ADVISORY only: an adapter may accept unlisted ids, and consumers must not\n * turn absence from this list into a request rejection.\n * @param _provider - one route owned by this adapter.\n * @returns discoverable models, in adapter-preferred order.\n */\n listModels(_provider: string, _signal?: AbortSignal): Promise<readonly ModelInfo[]> {\n return Promise.resolve([])\n }\n\n /** Uncached adapter-level catalog; the composition runtime owns refresh policy. */\n async modelCatalog(provider: string, options: ModelCatalogOptions = {}): Promise<ModelCatalogSnapshot> {\n const models = await this.listModels(provider, options.signal)\n const observedAt = new Date().toISOString()\n return Object.freeze({ provider: Object.freeze({ ...this.providerInfo(provider) }),\n state: models.length === 0 ? 'empty' : 'fresh', revision: 'adapter-uncached',\n models: Object.freeze([...models]), observedAt })\n }\n\n /**\n * Resolve all metadata available for one exact model.\n *\n * Independent of the advisory catalog, and NOT request validation  Ean unknown\n * id resolves to a minimal descriptor rather than an error.\n * @param provider - one route owned by this adapter.\n * @param model - exact model id.\n * @param _signal - cancellation; async implementations must settle promptly after abort.\n * @returns identity plus any context, default, and reasoning metadata.\n */\n resolveModel(\n provider: string,\n model: string,\n _signal?: AbortSignal,\n ): Promise<ResolvedModelInfo> {\n return Promise.resolve({ provider, id: model, name: model })\n }\n\n /**\n * Bind exact model metadata and the eventual dispatch to one generation.\n *\n * Adapters whose connection facts come from mutable configuration override this\n * and snapshot those facts here; the default is sufficient for a static one.\n * @param provider - registered route.\n * @param model - exact model id.\n * @param signal - cancellation for model resolution.\n * @returns metadata plus a one-generation stream entry point.\n */\n async prepareCall(\n provider: string,\n model: string,\n signal?: AbortSignal,\n context?: ModelInvocationContext,\n ): Promise<PreparedAdapterCall> {\n return {\n model: await this.resolveModel(provider, model, signal),\n stream: (options, invocation = context) => this.stream(options, invocation),\n }\n }\n\n /**\n * Stream one model call as raw chunks. The only required method.\n *\n * There is deliberately no non-streaming counterpart. A single code path cannot\n * drift from itself, and a caller wanting one value awaits the assembled\n * message instead.\n * @param options - the fully assembled request.\n * @returns the chunk stream, obeying the {@link StreamChunk} protocol.\n */\n abstract stream(options: GenerateOptions, context?: ModelInvocationContext): AsyncIterable<StreamChunk>\n}\n"],"mappings":"AAkDA,IAAsB,EAAtB,KAAmC,CAMjC,aAAa,EAAgC,CAC3C,MAAO,CAAE,GAAI,EAAU,KAAM,CAAS,CACxC,CAOA,oBAAoB,EAAoD,CAExE,CAUA,WAAW,EAAmB,EAAsD,CAClF,OAAO,QAAQ,QAAQ,CAAC,CAAC,CAC3B,CAGA,MAAM,aAAa,EAAkB,EAA+B,CAAC,EAAkC,CACrG,IAAM,EAAS,MAAM,KAAK,WAAW,EAAU,EAAQ,MAAM,EACvD,EAAa,IAAI,KAAK,CAAA,CAAE,YAAY,EAC1C,OAAO,OAAO,OAAO,CAAE,SAAU,OAAO,OAAO,CAAE,GAAG,KAAK,aAAa,CAAQ,CAAE,CAAC,EAC/E,MAAO,EAAO,SAAW,EAAI,QAAU,QAAS,SAAU,mBAC1D,OAAQ,OAAO,OAAO,CAAC,GAAG,CAAM,CAAC,EAAG,YAAW,CAAC,CACpD,CAYA,aACE,EACA,EACA,EAC4B,CAC5B,OAAO,QAAQ,QAAQ,CAAE,WAAU,GAAI,EAAO,KAAM,CAAM,CAAC,CAC7D,CAYA,MAAM,YACJ,EACA,EACA,EACA,EAC8B,CAC9B,MAAO,CACL,MAAO,MAAM,KAAK,aAAa,EAAU,EAAO,CAAM,EACtD,QAAS,EAAS,EAAa,IAAY,KAAK,OAAO,EAAS,CAAU,CAC5E,CACF,CAYF"}
@@ -0,0 +1,36 @@
1
+ import { ReasoningEffortId } from "../primitives/brand.js";
2
+ //#region src/contract/call-config.d.ts
3
+ /**
4
+ * Route, model, effort, and sampling scalars of one request. Every field maps
5
+ * 1:1 onto the same-named {@link GenerateOptions} field.
6
+ */
7
+ interface CallConfig {
8
+ provider: string;
9
+ model: string;
10
+ reasoningEffort?: ReasoningEffortId;
11
+ temperature?: number;
12
+ topP?: number;
13
+ maxTokens?: number;
14
+ stop?: readonly string[];
15
+ }
16
+ /**
17
+ * Which effective config fields came from adapter resolution rather than from
18
+ * the caller's request.
19
+ *
20
+ * Reported so a caller can tell "I chose 4096 output tokens" from "the adapter
21
+ * chose 4096 for me", which matters when surfacing effective settings.
22
+ */
23
+ interface CallConfigAdapterDefaults {
24
+ reasoningEffort?: true;
25
+ maxTokens?: true;
26
+ }
27
+ /**
28
+ * Field-wise equality over {@link CallConfig}.
29
+ * @param a - one configuration.
30
+ * @param b - the other.
31
+ * @returns whether every field matches, comparing `stop` element-wise.
32
+ */
33
+ declare function callConfigEquals(a: CallConfig, b: CallConfig): boolean;
34
+ //#endregion
35
+ export { CallConfig, CallConfigAdapterDefaults, callConfigEquals };
36
+ //# sourceMappingURL=call-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call-config.d.ts","names":[],"sources":["../../src/contract/call-config.ts"],"mappings":";;;;;;UAiBiB;EACf;EACA;EACA,kBAAkB;EAClB;EACA;EACA;EACA;;;;;;;;;UAUe;EACf;EACA;;;;;;;;iBASc,iBAAiB,GAAG,YAAY,GAAG"}
@@ -0,0 +1,2 @@
1
+ function e(e,t){return e.provider!==t.provider||e.model!==t.model||e.reasoningEffort!==t.reasoningEffort||e.temperature!==t.temperature||e.topP!==t.topP||e.maxTokens!==t.maxTokens?!1:e.stop===void 0||t.stop===void 0?e.stop===t.stop:e.stop.length===t.stop.length&&e.stop.every((e,n)=>e===t.stop?.[n])}export{e as callConfigEquals};
2
+ //# sourceMappingURL=call-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call-config.js","names":[],"sources":["../../src/contract/call-config.ts"],"sourcesContent":["/**\n * The subset of a request that behaves like connection state rather than\n * per-message content: route, model, effort, and sampling scalars.\n *\n * Isolating these is what makes the prepare/dispatch split in the registry\n * meaningful  Ethe registry can prove that the configuration it resolved\n * capabilities against is the same one being dispatched.\n *\n * @module ai-agent-sdk/core/contract/call-config\n */\n\nimport type { ReasoningEffortId } from '../primitives/brand.ts'\n\n/**\n * Route, model, effort, and sampling scalars of one request. Every field maps\n * 1:1 onto the same-named {@link GenerateOptions} field.\n */\nexport interface CallConfig {\n provider: string\n model: string\n reasoningEffort?: ReasoningEffortId\n temperature?: number\n topP?: number\n maxTokens?: number\n stop?: readonly string[]\n}\n\n/**\n * Which effective config fields came from adapter resolution rather than from\n * the caller's request.\n *\n * Reported so a caller can tell \"I chose 4096 output tokens\" from \"the adapter\n * chose 4096 for me\", which matters when surfacing effective settings.\n */\nexport interface CallConfigAdapterDefaults {\n reasoningEffort?: true\n maxTokens?: true\n}\n\n/**\n * Field-wise equality over {@link CallConfig}.\n * @param a - one configuration.\n * @param b - the other.\n * @returns whether every field matches, comparing `stop` element-wise.\n */\nexport function callConfigEquals(a: CallConfig, b: CallConfig): boolean {\n if (\n a.provider !== b.provider\n || a.model !== b.model\n || a.reasoningEffort !== b.reasoningEffort\n || a.temperature !== b.temperature\n || a.topP !== b.topP\n || a.maxTokens !== b.maxTokens\n ) return false\n if (a.stop === undefined || b.stop === undefined) return a.stop === b.stop\n return a.stop.length === b.stop.length && a.stop.every((value, index) => value === b.stop?.[index])\n}\n"],"mappings":"AA6CA,SAAgB,EAAiB,EAAe,EAAwB,CAUtE,OARE,EAAE,WAAa,EAAE,UACd,EAAE,QAAU,EAAE,OACd,EAAE,kBAAoB,EAAE,iBACxB,EAAE,cAAgB,EAAE,aACpB,EAAE,OAAS,EAAE,MACb,EAAE,YAAc,EAAE,UACd,GACL,EAAE,OAAS,IAAA,IAAa,EAAE,OAAS,IAAA,GAAkB,EAAE,OAAS,EAAE,KAC/D,EAAE,KAAK,SAAW,EAAE,KAAK,QAAU,EAAE,KAAK,OAAO,EAAO,IAAU,IAAU,EAAE,OAAO,EAAM,CACpG"}
@@ -0,0 +1,41 @@
1
+ import { ReasoningEffortId } from "../primitives/brand.js";
2
+ import { Message } from "../message/message.js";
3
+ import { ModelToolSchema, ToolChoice } from "./tool.js";
4
+ import { ModelOutputFormat } from "./output-format.js";
5
+ //#region src/contract/generate-options.d.ts
6
+ /** One fully assembled model request. */
7
+ interface GenerateOptions {
8
+ /** strict rejects known text-only models when request history contains images; project permits lossy conversion. */
9
+ readonly imagePolicy?: 'strict' | 'project';
10
+ /** Registered provider route, selecting the adapter instance. */
11
+ provider: string;
12
+ /**
13
+ * Exact model id, passed to the provider verbatim.
14
+ *
15
+ * Required, with no SDK-side default. Provider model lineups turn over faster
16
+ * than this package's release cadence, so any built-in default would eventually
17
+ * name a retired model and break for everyone who trusted it.
18
+ */
19
+ model: string;
20
+ /** Adapter-owned reasoning effort selected for this exact model. */
21
+ reasoningEffort?: ReasoningEffortId;
22
+ /** Ordered conversation messages, exactly as the provider will see them. */
23
+ messages: readonly Message[];
24
+ /** System prompt text; adapters map it to the provider's system slot. */
25
+ system?: string;
26
+ /** Host functions and provider-native tools offered to the model. */
27
+ tools?: readonly ModelToolSchema[];
28
+ /** Tool-selection constraint; omission means the provider's own default. */
29
+ toolChoice?: ToolChoice;
30
+ /** Visible response format; omission uses the provider's ordinary text default. */
31
+ outputFormat?: ModelOutputFormat;
32
+ temperature?: number;
33
+ topP?: number;
34
+ maxTokens?: number;
35
+ /** Stop sequences; generation halts on any of them, and the string is excluded from output. */
36
+ stop?: readonly string[];
37
+ signal?: AbortSignal;
38
+ }
39
+ //#endregion
40
+ export { GenerateOptions };
41
+ //# sourceMappingURL=generate-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-options.d.ts","names":[],"sources":["../../src/contract/generate-options.ts"],"mappings":";;;;;;UAYiB;;WAEN;;EAET;;;;;;;;EAQA;;EAEA,kBAAkB;;EAElB,mBAAmB;;EAEnB;;EAEA,iBAAiB;;EAEjB,aAAa;;EAEb,eAAe;EACf;EACA;EACA;;EAEA;EACA,SAAS"}
@@ -0,0 +1,99 @@
1
+ import { ReasoningEffortId } from "../primitives/brand.js";
2
+ import { NativeToolName } from "./tool.js";
3
+ import { SupportSafeError } from "../support-safe/error.js";
4
+ //#region src/contract/model-info.d.ts
5
+ /** Display metadata for one registered provider route. */
6
+ interface ProviderInfo {
7
+ /** Route key used by {@link GenerateOptions.provider}. */
8
+ id: string;
9
+ /** Human-readable provider name for selectors and diagnostics. */
10
+ name: string;
11
+ }
12
+ /** Merge-extensible model input-modality vocabulary. */
13
+ interface ModelModalityMap {
14
+ text: 'text';
15
+ image: 'image';
16
+ }
17
+ /** Any declared model input modality. */
18
+ type ModelModality = ModelModalityMap[keyof ModelModalityMap];
19
+ /**
20
+ * One model an adapter can advertise.
21
+ *
22
+ * Catalog membership is ADVISORY. An adapter may accept an id it does not list —
23
+ * new models ship faster than this package can — so a consumer must never turn
24
+ * absence from this list into a request rejection.
25
+ */
26
+ interface ModelInfo {
27
+ /** Provider route that owns this entry. */
28
+ provider: string;
29
+ /** Model id passed to {@link GenerateOptions.model}. */
30
+ id: string;
31
+ /** Human-readable name for selectors. */
32
+ name: string;
33
+ /** Optional user-facing distinction from otherwise similar models. */
34
+ description?: string;
35
+ /**
36
+ * Accepted request modalities.
37
+ *
38
+ * Absent means UNKNOWN; an explicit list that omits a modality is a negative
39
+ * capability claim, and the registry acts on it by projecting images to text.
40
+ */
41
+ inputModalities?: readonly ModelModality[];
42
+ /** Modalities this model route may return, directly or through native tools. */
43
+ outputModalities?: readonly ModelModality[];
44
+ /** Provider-native tools explicitly supported; omission means unknown. */
45
+ nativeTools?: readonly NativeToolName[];
46
+ }
47
+ /** Provider-owned context capacity for one exact model route. */
48
+ interface ModelContext {
49
+ /** Maximum combined request and response tokens. */
50
+ contextWindow: number;
51
+ }
52
+ /** Display metadata for one adapter-owned reasoning effort. */
53
+ interface ReasoningEffortInfo {
54
+ /** Opaque stable value accepted by {@link GenerateOptions.reasoningEffort}. */
55
+ id: ReasoningEffortId;
56
+ /** Human-readable effort name. */
57
+ name: string;
58
+ /** Optional user-facing distinction from otherwise similar efforts. */
59
+ description?: string;
60
+ }
61
+ /** Selectable reasoning efforts for one exact model route. */
62
+ interface ModelReasoningInfo {
63
+ /** Supported efforts, in adapter-preferred display order. */
64
+ efforts: readonly ReasoningEffortInfo[];
65
+ /**
66
+ * Effort materialized into requests when the caller omits one.
67
+ * Absence preserves the provider's own default.
68
+ */
69
+ defaultEffort?: ReasoningEffortId;
70
+ }
71
+ /** Exact-route model metadata, resolved by the adapter that owns the route. */
72
+ interface ResolvedModelInfo extends ModelInfo {
73
+ /** Provider-owned context capacity, when known. */
74
+ context?: ModelContext;
75
+ /** Per-request output cap materialized when the caller omits one. */
76
+ defaultMaxTokens?: number;
77
+ /** Hard provider/model output ceiling; explicit requests above it are rejected. */
78
+ maxOutputTokens?: number;
79
+ /** Selectable reasoning levels, when the route exposes any. */
80
+ reasoning?: ModelReasoningInfo;
81
+ }
82
+ type ModelCatalogState = 'static' | 'fresh' | 'empty' | 'stale' | 'unavailable';
83
+ interface ModelCatalogOptions {
84
+ readonly signal?: AbortSignal;
85
+ readonly refresh?: 'if-stale' | 'force';
86
+ }
87
+ interface ModelCatalogSnapshot {
88
+ readonly provider: ProviderInfo;
89
+ readonly state: ModelCatalogState;
90
+ readonly revision: string;
91
+ readonly models: readonly ModelInfo[];
92
+ readonly observedAt: string;
93
+ readonly expiresAt?: string;
94
+ readonly retryAt?: string;
95
+ readonly error?: SupportSafeError;
96
+ }
97
+ //#endregion
98
+ export { ModelCatalogOptions, ModelCatalogSnapshot, ModelCatalogState, ModelContext, ModelInfo, ModelModality, ModelModalityMap, ModelReasoningInfo, ProviderInfo, ReasoningEffortInfo, ResolvedModelInfo };
99
+ //# sourceMappingURL=model-info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-info.d.ts","names":[],"sources":["../../src/contract/model-info.ts"],"mappings":";;;;;UAWiB;;EAEf;;EAEA;;;UAIe;EACf;EACA;;;KAIU,gBAAgB,uBAAuB;;;;;;;;UASlC;;EAEf;;EAEA;;EAEA;;EAEA;;;;;;;EAOA,2BAA2B;;EAE3B,4BAA4B;;EAE5B,uBAAuB;;;UAIR;;EAEf;;;UAIe;;EAEf,IAAI;;EAEJ;;EAEA;;;UAIe;;EAEf,kBAAkB;;;;;EAKlB,gBAAgB;;;UAID,0BAA0B;;EAEzC,UAAU;;EAEV;;EAEA;;EAEA,YAAY;;KAGF;UAEK;WACN,SAAS;WACT;;UAGM;WACN,UAAU;WACV,OAAO;WACP;WACA,iBAAiB;WACjB;WACA;WACA;WACA,QAAQ"}
@@ -0,0 +1,18 @@
1
+ import { JsonObject } from "../primitives/json.js";
2
+ //#region src/contract/output-format.d.ts
3
+ /** Ordinary unconstrained model text. */
4
+ interface TextOutputFormat {
5
+ readonly type: 'text';
6
+ }
7
+ /** JSON text constrained by a caller-owned JSON Schema. */
8
+ interface JsonSchemaOutputFormat {
9
+ readonly type: 'json_schema';
10
+ /** Stable schema identifier. Required by providers such as OpenAI Responses. */
11
+ readonly name: string;
12
+ /** Provider-supported JSON Schema. Provider-specific subsets still apply. */
13
+ readonly schema: Readonly<JsonObject>;
14
+ }
15
+ type ModelOutputFormat = TextOutputFormat | JsonSchemaOutputFormat;
16
+ //#endregion
17
+ export { JsonSchemaOutputFormat, ModelOutputFormat, TextOutputFormat };
18
+ //# sourceMappingURL=output-format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output-format.d.ts","names":[],"sources":["../../src/contract/output-format.ts"],"mappings":";;;UAKiB;WACN;;;UAIM;WACN;;WAEA;;WAEA,QAAQ,SAAS;;KAGhB,oBAAoB,mBAAmB"}
@@ -0,0 +1,104 @@
1
+ //#region src/contract/retry-policy.d.ts
2
+ /**
3
+ * Retry policy as PURE DATA plus validation. Nothing here executes a retry.
4
+ *
5
+ * The separation is deliberate and is the load-bearing idea: an adapter's job is
6
+ * to assign a stable `code` at the wire boundary, and the policy's job is to
7
+ * decide which codes are eligible. Adapters never decide retry. That is what
8
+ * lets a caller widen or narrow retry behaviour per route without touching  Eor
9
+ * even understanding  Eany provider's error mapping.
10
+ *
11
+ * @module ai-agent-sdk/core/contract/retry-policy
12
+ */
13
+ /**
14
+ * Largest delay a timer can hold (`2**31 - 1` ms, ~24.9 days).
15
+ *
16
+ * Beyond this, `setTimeout` overflows to a 1 ms delay  Ea scheduled retry would
17
+ * fire immediately instead of much later, which is the opposite of the intent.
18
+ */
19
+ declare const MAX_TIMER_DELAY_MS = 2147483647;
20
+ /** Bounded exponential backoff with symmetric jitter around each local delay. */
21
+ interface BackoffConfig {
22
+ /** First local backoff delay in milliseconds (default 500). */
23
+ initialDelayMs?: number;
24
+ /** Ceiling on any locally scheduled or accepted provider delay (default 10000). */
25
+ maxDelayMs?: number;
26
+ /** Symmetric random multiplier range around one (default 0.1). */
27
+ jitterRatio?: number;
28
+ }
29
+ /** Bounded transient retry behaviour for one route. */
30
+ interface NormalRetryPolicyConfig {
31
+ /** Retry only the configured transient failure codes. */
32
+ mode: 'normal';
33
+ /** Maximum retries AFTER the first attempt (default 5). */
34
+ maxRetries?: number;
35
+ /** Failure codes eligible under this policy. */
36
+ retryableCodes?: readonly string[];
37
+ backoff?: BackoffConfig;
38
+ }
39
+ /**
40
+ * Unbounded retry for every failure on one route.
41
+ *
42
+ * For long-running unattended work where giving up is worse than waiting.
43
+ * Bounded only by cancellation. The retry decorator therefore requires the
44
+ * model request to carry an AbortSignal when this mode is selected.
45
+ */
46
+ interface AlwaysRetryPolicyConfig {
47
+ mode: 'always';
48
+ backoff?: BackoffConfig;
49
+ }
50
+ /** Retry policy configuration for one provider route. */
51
+ type RetryPolicyConfig = NormalRetryPolicyConfig | AlwaysRetryPolicyConfig;
52
+ /** Fully resolved backoff shared by both modes. */
53
+ interface ResolvedRetryBackoff {
54
+ readonly initialDelayMs: number;
55
+ readonly maxDelayMs: number;
56
+ readonly jitterRatio: number;
57
+ }
58
+ /** Fully resolved bounded transient retry policy. */
59
+ interface ResolvedNormalRetryPolicy extends ResolvedRetryBackoff {
60
+ readonly mode: 'normal';
61
+ readonly maxRetries: number;
62
+ readonly retryableCodes: readonly string[];
63
+ }
64
+ /** Fully resolved unbounded retry policy. */
65
+ interface ResolvedAlwaysRetryPolicy extends ResolvedRetryBackoff {
66
+ readonly mode: 'always';
67
+ }
68
+ /** Immutable policy, captured when a route is registered. */
69
+ type ResolvedRetryPolicy = ResolvedNormalRetryPolicy | ResolvedAlwaysRetryPolicy;
70
+ /**
71
+ * Validate, default, and detach one retry policy.
72
+ *
73
+ * Everything returned is frozen, because a policy is captured at registration
74
+ * and read on every failure; a mutable one could be edited between the decision
75
+ * to retry and the wait itself.
76
+ * @param config - optional configuration; omission selects the normal defaults.
77
+ * @param path - diagnostic path naming the setting that owns the value.
78
+ * @returns an immutable policy, safe to capture in registration state.
79
+ */
80
+ declare function resolveRetryPolicy(config: RetryPolicyConfig | undefined, path: string): ResolvedRetryPolicy;
81
+ /**
82
+ * The delay before one retry attempt: bounded exponential growth with symmetric
83
+ * jitter.
84
+ *
85
+ * Jitter matters more than it looks. Without it, every client that failed
86
+ * against the same overloaded provider retries at the same instant, and the
87
+ * synchronized wave reproduces the outage it was meant to ride out.
88
+ * @param policy - the resolved policy supplying growth and bounds.
89
+ * @param attempt - 1-based retry number.
90
+ * @param random - sample in `[0, 1)`; injectable so tests can be deterministic.
91
+ * @returns the delay in milliseconds, never above `policy.maxDelayMs`.
92
+ */
93
+ declare function backoffDelayMs(policy: ResolvedRetryPolicy, attempt: number, random?: () => number): number;
94
+ /**
95
+ * Whether a policy admits one more attempt for a given failure code.
96
+ * @param policy - the resolved policy.
97
+ * @param code - the failure code assigned by the adapter.
98
+ * @param attemptsSoFar - retries already performed, excluding the first attempt.
99
+ * @returns true when another retry is permitted.
100
+ */
101
+ declare function isRetryable(policy: ResolvedRetryPolicy, code: string, attemptsSoFar: number): boolean;
102
+ //#endregion
103
+ export { AlwaysRetryPolicyConfig, BackoffConfig, MAX_TIMER_DELAY_MS, NormalRetryPolicyConfig, ResolvedAlwaysRetryPolicy, ResolvedNormalRetryPolicy, ResolvedRetryBackoff, ResolvedRetryPolicy, RetryPolicyConfig, backoffDelayMs, isRetryable, resolveRetryPolicy };
104
+ //# sourceMappingURL=retry-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry-policy.d.ts","names":[],"sources":["../../src/contract/retry-policy.ts"],"mappings":";;;;;;;;;;;;;;;;;;cAqBa;;UAyBI;;EAEf;;EAEA;;EAEA;;;UAIe;;EAEf;;EAEA;;EAEA;EACA,UAAU;;;;;;;;;UAUK;EACf;EACA,UAAU;;;KAIA,oBAAoB,0BAA0B;;UAGzC;WACN;WACA;WACA;;;UAIM,kCAAkC;WACxC;WACA;WACA;;;UAIM,kCAAkC;WACxC;;;KAIC,sBAAsB,4BAA4B;;;;;;;;;;;iBA+C9C,mBACd,QAAQ,+BACR,eACC;;;;;;;;;;;;;iBA2Da,eACd,QAAQ,qBACR,iBACA;;;;;;;;iBAiBc,YACd,QAAQ,qBACR,cACA"}
@@ -0,0 +1,2 @@
1
+ import{EMPTY_RESPONSE_CODE as e}from"../errors/agent-sdk-error.js";import{MODEL_ERROR_CODES as t}from"../errors/model-error.js";const n=2147483647,r=Object.freeze([e,t.RATE_LIMIT,t.SERVER,t.TIMEOUT,t.TRANSPORT]),i=new Set([`mode`,`maxRetries`,`retryableCodes`,`backoff`]),a=i,o=new Set([`initialDelayMs`,`maxDelayMs`,`jitterRatio`]);function s(e,t,n){for(let r of Object.keys(e))if(!t.has(r))throw Error(`${n}: unknown key "${r}"`)}function c(e,t){e!==void 0&&s(e,o,t);let r=e?.initialDelayMs??500,i=e?.maxDelayMs??1e4,a=e?.jitterRatio??.1;if(!Number.isFinite(r)||r<=0||r>2147483647)throw Error(`${t}.initialDelayMs must be a positive finite number no greater than ${n}`);if(!Number.isFinite(i)||i<=0||i>2147483647)throw Error(`${t}.maxDelayMs must be a positive finite number no greater than ${n}`);if(r>i)throw Error(`${t}.initialDelayMs must be less than or equal to maxDelayMs`);if(!Number.isFinite(a)||a<0||a>1)throw Error(`${t}.jitterRatio must be between 0 and 1`);return Object.freeze({initialDelayMs:r,maxDelayMs:i,jitterRatio:a})}function l(e,t){if(e===void 0)return Object.freeze({mode:`normal`,maxRetries:5,retryableCodes:r,...c(void 0,`${t}.backoff`)});switch(e.mode){case`normal`:{s(e,i,t);let n=e.maxRetries??5,a=e.retryableCodes??r;if(!Number.isSafeInteger(n)||n<0)throw Error(`${t}.maxRetries must be a non-negative safe integer`);if(a.length===0)throw Error(`${t}.retryableCodes must not be empty`);if(a.some(e=>typeof e!=`string`||e.length===0))throw Error(`${t}.retryableCodes must contain only non-empty strings`);if(new Set(a).size!==a.length)throw Error(`${t}.retryableCodes must not contain duplicates`);return Object.freeze({mode:`normal`,maxRetries:n,retryableCodes:Object.freeze([...a]),...c(e.backoff,`${t}.backoff`)})}case`always`:return s(e,a,t),Object.freeze({mode:`always`,...c(e.backoff,`${t}.backoff`)});default:throw Error(`${t}.mode must be "normal" or "always"`)}}function u(e,t,n=Math.random){let r=Math.min(Math.max(t-1,0),1024),i=Math.min(e.initialDelayMs*2**r,e.maxDelayMs),a=1-e.jitterRatio+2*e.jitterRatio*n();return Math.min(i*a,e.maxDelayMs)}function d(e,t,n){return e.mode===`always`||e.retryableCodes.includes(t)&&n<e.maxRetries}export{n as MAX_TIMER_DELAY_MS,u as backoffDelayMs,d as isRetryable,l as resolveRetryPolicy};
2
+ //# sourceMappingURL=retry-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry-policy.js","names":[],"sources":["../../src/contract/retry-policy.ts"],"sourcesContent":["/**\n * Retry policy as PURE DATA plus validation. Nothing here executes a retry.\n *\n * The separation is deliberate and is the load-bearing idea: an adapter's job is\n * to assign a stable `code` at the wire boundary, and the policy's job is to\n * decide which codes are eligible. Adapters never decide retry. That is what\n * lets a caller widen or narrow retry behaviour per route without touching  Eor\n * even understanding  Eany provider's error mapping.\n *\n * @module ai-agent-sdk/core/contract/retry-policy\n */\n\nimport { EMPTY_RESPONSE_CODE } from '../errors/agent-sdk-error.ts'\nimport { MODEL_ERROR_CODES } from '../errors/model-error.ts'\n\n/**\n * Largest delay a timer can hold (`2**31 - 1` ms, ~24.9 days).\n *\n * Beyond this, `setTimeout` overflows to a 1 ms delay  Ea scheduled retry would\n * fire immediately instead of much later, which is the opposite of the intent.\n */\nexport const MAX_TIMER_DELAY_MS = 2_147_483_647\n\nconst DEFAULT_MAX_RETRIES = 5\nconst DEFAULT_INITIAL_DELAY_MS = 500\nconst DEFAULT_MAX_DELAY_MS = 10_000\nconst DEFAULT_JITTER_RATIO = 0.1\n\n/**\n * Codes eligible for retry by default.\n *\n * The exclusions are the interesting part. `AUTH`, `INVALID_REQUEST`, `QUOTA`,\n * `INVALID_CREDENTIAL`, and `CONTEXT_WINDOW_EXCEEDED` are absent because they\n * fail IDENTICALLY on every attempt  Eretrying them only burns latency and, for\n * quota, money. `EMPTY_RESPONSE` is present for the opposite reason: nothing\n * durable was produced, so repeating the call is safe and usually works.\n */\nconst DEFAULT_RETRYABLE_CODES: readonly string[] = Object.freeze([\n EMPTY_RESPONSE_CODE,\n MODEL_ERROR_CODES.RATE_LIMIT,\n MODEL_ERROR_CODES.SERVER,\n MODEL_ERROR_CODES.TIMEOUT,\n MODEL_ERROR_CODES.TRANSPORT,\n])\n\n/** Bounded exponential backoff with symmetric jitter around each local delay. */\nexport interface BackoffConfig {\n /** First local backoff delay in milliseconds (default 500). */\n initialDelayMs?: number\n /** Ceiling on any locally scheduled or accepted provider delay (default 10000). */\n maxDelayMs?: number\n /** Symmetric random multiplier range around one (default 0.1). */\n jitterRatio?: number\n}\n\n/** Bounded transient retry behaviour for one route. */\nexport interface NormalRetryPolicyConfig {\n /** Retry only the configured transient failure codes. */\n mode: 'normal'\n /** Maximum retries AFTER the first attempt (default 5). */\n maxRetries?: number\n /** Failure codes eligible under this policy. */\n retryableCodes?: readonly string[]\n backoff?: BackoffConfig\n}\n\n/**\n * Unbounded retry for every failure on one route.\n *\n * For long-running unattended work where giving up is worse than waiting.\n * Bounded only by cancellation. The retry decorator therefore requires the\n * model request to carry an AbortSignal when this mode is selected.\n */\nexport interface AlwaysRetryPolicyConfig {\n mode: 'always'\n backoff?: BackoffConfig\n}\n\n/** Retry policy configuration for one provider route. */\nexport type RetryPolicyConfig = NormalRetryPolicyConfig | AlwaysRetryPolicyConfig\n\n/** Fully resolved backoff shared by both modes. */\nexport interface ResolvedRetryBackoff {\n readonly initialDelayMs: number\n readonly maxDelayMs: number\n readonly jitterRatio: number\n}\n\n/** Fully resolved bounded transient retry policy. */\nexport interface ResolvedNormalRetryPolicy extends ResolvedRetryBackoff {\n readonly mode: 'normal'\n readonly maxRetries: number\n readonly retryableCodes: readonly string[]\n}\n\n/** Fully resolved unbounded retry policy. */\nexport interface ResolvedAlwaysRetryPolicy extends ResolvedRetryBackoff {\n readonly mode: 'always'\n}\n\n/** Immutable policy, captured when a route is registered. */\nexport type ResolvedRetryPolicy = ResolvedNormalRetryPolicy | ResolvedAlwaysRetryPolicy\n\nconst NORMAL_POLICY_KEYS: ReadonlySet<string> = new Set([\n 'mode', 'maxRetries', 'retryableCodes', 'backoff',\n])\n// Layered configuration can retain normal-only fields after a mode switch, so\n// `always` tolerates those inactive values while still rejecting typos.\nconst ALWAYS_POLICY_KEYS: ReadonlySet<string> = NORMAL_POLICY_KEYS\nconst BACKOFF_KEYS: ReadonlySet<string> = new Set(['initialDelayMs', 'maxDelayMs', 'jitterRatio'])\n\nfunction validateKeys(value: object, allowed: ReadonlySet<string>, path: string): void {\n for (const key of Object.keys(value)) {\n if (!allowed.has(key)) throw new Error(`${path}: unknown key \"${key}\"`)\n }\n}\n\nfunction resolveBackoff(config: BackoffConfig | undefined, path: string): ResolvedRetryBackoff {\n if (config !== undefined) validateKeys(config, BACKOFF_KEYS, path)\n const initialDelayMs = config?.initialDelayMs ?? DEFAULT_INITIAL_DELAY_MS\n const maxDelayMs = config?.maxDelayMs ?? DEFAULT_MAX_DELAY_MS\n const jitterRatio = config?.jitterRatio ?? DEFAULT_JITTER_RATIO\n\n if (!Number.isFinite(initialDelayMs) || initialDelayMs <= 0 || initialDelayMs > MAX_TIMER_DELAY_MS) {\n throw new Error(`${path}.initialDelayMs must be a positive finite number no greater than ${MAX_TIMER_DELAY_MS}`)\n }\n if (!Number.isFinite(maxDelayMs) || maxDelayMs <= 0 || maxDelayMs > MAX_TIMER_DELAY_MS) {\n throw new Error(`${path}.maxDelayMs must be a positive finite number no greater than ${MAX_TIMER_DELAY_MS}`)\n }\n if (initialDelayMs > maxDelayMs) {\n throw new Error(`${path}.initialDelayMs must be less than or equal to maxDelayMs`)\n }\n if (!Number.isFinite(jitterRatio) || jitterRatio < 0 || jitterRatio > 1) {\n throw new Error(`${path}.jitterRatio must be between 0 and 1`)\n }\n return Object.freeze({ initialDelayMs, maxDelayMs, jitterRatio })\n}\n\n/**\n * Validate, default, and detach one retry policy.\n *\n * Everything returned is frozen, because a policy is captured at registration\n * and read on every failure; a mutable one could be edited between the decision\n * to retry and the wait itself.\n * @param config - optional configuration; omission selects the normal defaults.\n * @param path - diagnostic path naming the setting that owns the value.\n * @returns an immutable policy, safe to capture in registration state.\n */\nexport function resolveRetryPolicy(\n config: RetryPolicyConfig | undefined,\n path: string,\n): ResolvedRetryPolicy {\n if (config === undefined) {\n return Object.freeze({\n mode: 'normal' as const,\n maxRetries: DEFAULT_MAX_RETRIES,\n retryableCodes: DEFAULT_RETRYABLE_CODES,\n ...resolveBackoff(undefined, `${path}.backoff`),\n })\n }\n\n switch (config.mode) {\n case 'normal': {\n validateKeys(config, NORMAL_POLICY_KEYS, path)\n const maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES\n const retryableCodes = config.retryableCodes ?? DEFAULT_RETRYABLE_CODES\n if (!Number.isSafeInteger(maxRetries) || maxRetries < 0) {\n throw new Error(`${path}.maxRetries must be a non-negative safe integer`)\n }\n if (retryableCodes.length === 0) {\n // An empty list is almost certainly a mistake rather than \"never retry\";\n // `maxRetries: 0` says that unambiguously.\n throw new Error(`${path}.retryableCodes must not be empty`)\n }\n if (retryableCodes.some(code => typeof code !== 'string' || code.length === 0)) {\n throw new Error(`${path}.retryableCodes must contain only non-empty strings`)\n }\n if (new Set(retryableCodes).size !== retryableCodes.length) {\n throw new Error(`${path}.retryableCodes must not contain duplicates`)\n }\n return Object.freeze({\n mode: 'normal' as const,\n maxRetries,\n retryableCodes: Object.freeze([...retryableCodes]),\n ...resolveBackoff(config.backoff, `${path}.backoff`),\n })\n }\n case 'always':\n validateKeys(config, ALWAYS_POLICY_KEYS, path)\n return Object.freeze({\n mode: 'always' as const,\n ...resolveBackoff(config.backoff, `${path}.backoff`),\n })\n default:\n throw new Error(`${path}.mode must be \"normal\" or \"always\"`)\n }\n}\n\n/**\n * The delay before one retry attempt: bounded exponential growth with symmetric\n * jitter.\n *\n * Jitter matters more than it looks. Without it, every client that failed\n * against the same overloaded provider retries at the same instant, and the\n * synchronized wave reproduces the outage it was meant to ride out.\n * @param policy - the resolved policy supplying growth and bounds.\n * @param attempt - 1-based retry number.\n * @param random - sample in `[0, 1)`; injectable so tests can be deterministic.\n * @returns the delay in milliseconds, never above `policy.maxDelayMs`.\n */\nexport function backoffDelayMs(\n policy: ResolvedRetryPolicy,\n attempt: number,\n random: () => number = Math.random,\n): number {\n // Clamp the exponent before shifting: 2 ** 100000 is Infinity, and\n // Infinity * jitter would defeat the Math.min bound below.\n const exponent = Math.min(Math.max(attempt - 1, 0), 1024)\n const exponential = Math.min(policy.initialDelayMs * 2 ** exponent, policy.maxDelayMs)\n const jitter = 1 - policy.jitterRatio + 2 * policy.jitterRatio * random()\n return Math.min(exponential * jitter, policy.maxDelayMs)\n}\n\n/**\n * Whether a policy admits one more attempt for a given failure code.\n * @param policy - the resolved policy.\n * @param code - the failure code assigned by the adapter.\n * @param attemptsSoFar - retries already performed, excluding the first attempt.\n * @returns true when another retry is permitted.\n */\nexport function isRetryable(\n policy: ResolvedRetryPolicy,\n code: string,\n attemptsSoFar: number,\n): boolean {\n if (policy.mode === 'always') return true\n return policy.retryableCodes.includes(code) && attemptsSoFar < policy.maxRetries\n}\n"],"mappings":"gIAqBA,MAAa,EAAqB,WAgB5B,EAA6C,OAAO,OAAO,CAC/D,EACA,EAAkB,WAClB,EAAkB,OAClB,EAAkB,QAClB,EAAkB,SACpB,CAAC,EA4DK,EAA0C,IAAI,IAAI,CACtD,OAAQ,aAAc,iBAAkB,SAC1C,CAAC,EAGK,EAA0C,EAC1C,EAAoC,IAAI,IAAI,CAAC,iBAAkB,aAAc,aAAa,CAAC,EAEjG,SAAS,EAAa,EAAe,EAA8B,EAAoB,CACrF,IAAK,IAAM,KAAO,OAAO,KAAK,CAAK,EACjC,GAAI,CAAC,EAAQ,IAAI,CAAG,EAAG,MAAU,MAAM,GAAG,EAAK,iBAAiB,EAAI,EAAE,CAE1E,CAEA,SAAS,EAAe,EAAmC,EAAoC,CACzF,IAAW,IAAA,IAAW,EAAa,EAAQ,EAAc,CAAI,EACjE,IAAM,EAAiB,GAAQ,gBAAkB,IAC3C,EAAa,GAAQ,YAAc,IACnC,EAAc,GAAQ,aAAe,GAE3C,GAAI,CAAC,OAAO,SAAS,CAAc,GAAK,GAAkB,GAAK,EAAA,WAC7D,MAAU,MAAM,GAAG,EAAK,mEAAmE,GAAoB,EAEjH,GAAI,CAAC,OAAO,SAAS,CAAU,GAAK,GAAc,GAAK,EAAA,WACrD,MAAU,MAAM,GAAG,EAAK,+DAA+D,GAAoB,EAE7G,GAAI,EAAiB,EACnB,MAAU,MAAM,GAAG,EAAK,yDAAyD,EAEnF,GAAI,CAAC,OAAO,SAAS,CAAW,GAAK,EAAc,GAAK,EAAc,EACpE,MAAU,MAAM,GAAG,EAAK,qCAAqC,EAE/D,OAAO,OAAO,OAAO,CAAE,iBAAgB,aAAY,aAAY,CAAC,CAClE,CAYA,SAAgB,EACd,EACA,EACqB,CACrB,GAAI,IAAW,IAAA,GACb,OAAO,OAAO,OAAO,CACnB,KAAM,SACN,WAAY,EACZ,eAAgB,EAChB,GAAG,EAAe,IAAA,GAAW,GAAG,EAAK,SAAS,CAChD,CAAC,EAGH,OAAQ,EAAO,KAAf,CACE,IAAK,SAAU,CACb,EAAa,EAAQ,EAAoB,CAAI,EAC7C,IAAM,EAAa,EAAO,YAAc,EAClC,EAAiB,EAAO,gBAAkB,EAChD,GAAI,CAAC,OAAO,cAAc,CAAU,GAAK,EAAa,EACpD,MAAU,MAAM,GAAG,EAAK,gDAAgD,EAE1E,GAAI,EAAe,SAAW,EAG5B,MAAU,MAAM,GAAG,EAAK,kCAAkC,EAE5D,GAAI,EAAe,KAAK,GAAQ,OAAO,GAAS,UAAY,EAAK,SAAW,CAAC,EAC3E,MAAU,MAAM,GAAG,EAAK,oDAAoD,EAE9E,GAAI,IAAI,IAAI,CAAc,CAAC,CAAC,OAAS,EAAe,OAClD,MAAU,MAAM,GAAG,EAAK,4CAA4C,EAEtE,OAAO,OAAO,OAAO,CACnB,KAAM,SACN,aACA,eAAgB,OAAO,OAAO,CAAC,GAAG,CAAc,CAAC,EACjD,GAAG,EAAe,EAAO,QAAS,GAAG,EAAK,SAAS,CACrD,CAAC,CACH,CACA,IAAK,SAEH,OADA,EAAa,EAAQ,EAAoB,CAAI,EACtC,OAAO,OAAO,CACnB,KAAM,SACN,GAAG,EAAe,EAAO,QAAS,GAAG,EAAK,SAAS,CACrD,CAAC,EACH,QACE,MAAU,MAAM,GAAG,EAAK,mCAAmC,CAC/D,CACF,CAcA,SAAgB,EACd,EACA,EACA,EAAuB,KAAK,OACpB,CAGR,IAAM,EAAW,KAAK,IAAI,KAAK,IAAI,EAAU,EAAG,CAAC,EAAG,IAAI,EAClD,EAAc,KAAK,IAAI,EAAO,eAAiB,GAAK,EAAU,EAAO,UAAU,EAC/E,EAAS,EAAI,EAAO,YAAc,EAAI,EAAO,YAAc,EAAO,EACxE,OAAO,KAAK,IAAI,EAAc,EAAQ,EAAO,UAAU,CACzD,CASA,SAAgB,EACd,EACA,EACA,EACS,CAET,OADI,EAAO,OAAS,UACb,EAAO,eAAe,SAAS,CAAI,GAAK,EAAgB,EAAO,UACxE"}
@@ -0,0 +1,65 @@
1
+ //#region src/contract/tool.d.ts
2
+ /**
3
+ * How tools are described to a model and how its choice among them is constrained.
4
+ *
5
+ * @module ai-agent-sdk/core/contract/tool
6
+ */
7
+ /** JSON-Schema description of one application function executed by the host. */
8
+ interface ToolSchema {
9
+ readonly name: string;
10
+ readonly description: string;
11
+ /** JSON Schema object describing the arguments. */
12
+ readonly parameters: Readonly<Record<string, unknown>>;
13
+ }
14
+ /** Approximate user location used to improve a provider-native web search. */
15
+ interface WebSearchLocation {
16
+ readonly city?: string;
17
+ readonly region?: string;
18
+ readonly country?: string;
19
+ readonly timezone?: string;
20
+ }
21
+ /** Web search executed inside the provider response, not by the host scheduler. */
22
+ interface NativeWebSearchTool {
23
+ readonly type: 'native';
24
+ readonly name: 'web-search';
25
+ readonly searchContextSize?: 'low' | 'medium' | 'high';
26
+ readonly allowedDomains?: readonly string[];
27
+ readonly blockedDomains?: readonly string[];
28
+ readonly userLocation?: WebSearchLocation;
29
+ readonly maxUses?: number;
30
+ }
31
+ /** Image generation executed inside the provider response. */
32
+ interface NativeImageGenerationTool {
33
+ readonly type: 'native';
34
+ readonly name: 'image-generation';
35
+ readonly size?: 'auto' | '1024x1024' | '1536x1024' | '1024x1536';
36
+ readonly quality?: 'auto' | 'low' | 'medium' | 'high';
37
+ readonly format?: 'png' | 'jpeg' | 'webp';
38
+ readonly background?: 'auto' | 'transparent' | 'opaque';
39
+ /** Number of progressive images requested while generation is in flight. */
40
+ readonly partialImages?: number;
41
+ }
42
+ /** Merge-extensible semantic vocabulary for tools executed by a provider. */
43
+ interface NativeToolSchemaMap {
44
+ 'web-search': NativeWebSearchTool;
45
+ 'image-generation': NativeImageGenerationTool;
46
+ }
47
+ type NativeToolName = keyof NativeToolSchemaMap;
48
+ type NativeToolSchema = NativeToolSchemaMap[NativeToolName];
49
+ type ModelToolSchema = ToolSchema | NativeToolSchema;
50
+ declare function isNativeToolSchema(tool: ModelToolSchema): tool is NativeToolSchema;
51
+ /**
52
+ * How the model should choose among the supplied tools.
53
+ *
54
+ * `required` means "call some tool"; `{ type: 'tool' }` names exactly one.
55
+ */
56
+ type ToolChoice = 'auto' | 'none' | 'required' | {
57
+ type: 'tool';
58
+ name: string;
59
+ } | {
60
+ type: 'native';
61
+ name: NativeToolName;
62
+ };
63
+ //#endregion
64
+ export { ModelToolSchema, NativeImageGenerationTool, NativeToolName, NativeToolSchema, NativeToolSchemaMap, NativeWebSearchTool, ToolChoice, ToolSchema, WebSearchLocation, isNativeToolSchema };
65
+ //# sourceMappingURL=tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool.d.ts","names":[],"sources":["../../src/contract/tool.ts"],"mappings":";;;;;;;UAOiB;WACN;WACA;;WAEA,YAAY,SAAS;;;UAIf;WACN;WACA;WACA;WACA;;;UAIM;WACN;WACA;WACA;WACA;WACA;WACA,eAAe;WACf;;;UAIM;WACN;WACA;WACA;WACA;WACA;WACA;;WAEA;;;UAIM;EACf,cAAc;EACd,oBAAoB;;KAGV,uBAAuB;KACvB,mBAAmB,oBAAoB;KACvC,kBAAkB,aAAa;iBAE3B,mBAAmB,MAAM,kBAAkB,QAAQ;;;;;;KASvD;EAIN;EAAc;;EACd;EAAgB,MAAM"}
@@ -0,0 +1,2 @@
1
+ function e(e){return`type`in e&&e.type===`native`}export{e as isNativeToolSchema};
2
+ //# sourceMappingURL=tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool.js","names":[],"sources":["../../src/contract/tool.ts"],"sourcesContent":["/**\n * How tools are described to a model and how its choice among them is constrained.\n *\n * @module ai-agent-sdk/core/contract/tool\n */\n\n/** JSON-Schema description of one application function executed by the host. */\nexport interface ToolSchema {\n readonly name: string\n readonly description: string\n /** JSON Schema object describing the arguments. */\n readonly parameters: Readonly<Record<string, unknown>>\n}\n\n/** Approximate user location used to improve a provider-native web search. */\nexport interface WebSearchLocation {\n readonly city?: string\n readonly region?: string\n readonly country?: string\n readonly timezone?: string\n}\n\n/** Web search executed inside the provider response, not by the host scheduler. */\nexport interface NativeWebSearchTool {\n readonly type: 'native'\n readonly name: 'web-search'\n readonly searchContextSize?: 'low' | 'medium' | 'high'\n readonly allowedDomains?: readonly string[]\n readonly blockedDomains?: readonly string[]\n readonly userLocation?: WebSearchLocation\n readonly maxUses?: number\n}\n\n/** Image generation executed inside the provider response. */\nexport interface NativeImageGenerationTool {\n readonly type: 'native'\n readonly name: 'image-generation'\n readonly size?: 'auto' | '1024x1024' | '1536x1024' | '1024x1536'\n readonly quality?: 'auto' | 'low' | 'medium' | 'high'\n readonly format?: 'png' | 'jpeg' | 'webp'\n readonly background?: 'auto' | 'transparent' | 'opaque'\n /** Number of progressive images requested while generation is in flight. */\n readonly partialImages?: number\n}\n\n/** Merge-extensible semantic vocabulary for tools executed by a provider. */\nexport interface NativeToolSchemaMap {\n 'web-search': NativeWebSearchTool\n 'image-generation': NativeImageGenerationTool\n}\n\nexport type NativeToolName = keyof NativeToolSchemaMap\nexport type NativeToolSchema = NativeToolSchemaMap[NativeToolName]\nexport type ModelToolSchema = ToolSchema | NativeToolSchema\n\nexport function isNativeToolSchema(tool: ModelToolSchema): tool is NativeToolSchema {\n return 'type' in tool && tool.type === 'native'\n}\n\n/**\n * How the model should choose among the supplied tools.\n *\n * `required` means \"call some tool\"; `{ type: 'tool' }` names exactly one.\n */\nexport type ToolChoice =\n | 'auto'\n | 'none'\n | 'required'\n | { type: 'tool'; name: string }\n | { type: 'native'; name: NativeToolName }\n"],"mappings":"AAuDA,SAAgB,EAAmB,EAAiD,CAClF,MAAO,SAAU,GAAQ,EAAK,OAAS,QACzC"}