@agimon-ai/po-cloudflare 0.0.2-alpha.2 → 0.0.2-alpha.4

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 (198) hide show
  1. package/README.md +4 -3
  2. package/dist/abort-signals-Bkmp_euQ.js +34 -0
  3. package/dist/anthropic-messages-CkYm8M3V.js +14317 -0
  4. package/dist/{approval-BMXqnTYd.js → approval-Eu7UgGL-.js} +1 -1
  5. package/dist/assets/assets/{CodeEditorView-BnyZHaYM.js → CodeEditorView-rEfljuRK.js} +2 -2
  6. package/dist/assets/assets/{abnfDiagram-WEYOIA3C-muME0eCj.js → abnfDiagram-WEYOIA3C-J6Iu5p17.js} +2 -2
  7. package/dist/assets/assets/{architecture-WOLXFQ4H-DMnhK1WH.js → architecture-WOLXFQ4H-DKj_xMR1.js} +1 -1
  8. package/dist/assets/assets/{architectureDiagram-ZHVYKT53-DKn7XGP7.js → architectureDiagram-ZHVYKT53--D1MzuBo.js} +2 -2
  9. package/dist/assets/assets/{blockDiagram-RJAE7QA3-DtDctXZg.js → blockDiagram-RJAE7QA3-CrWO0t-Q.js} +2 -2
  10. package/dist/assets/assets/{c4Diagram-XDPPPE54-23pGLJeP.js → c4Diagram-XDPPPE54-CBMOJREz.js} +2 -2
  11. package/dist/assets/assets/channel-CNegK3Rr.js +2 -0
  12. package/dist/assets/assets/{chunk-2E7WHVMD-BZ2nGNPa.js → chunk-2E7WHVMD-CR9NMk46.js} +2 -2
  13. package/dist/assets/assets/{chunk-4EMNKR2T-Dui1SYFi.js → chunk-4EMNKR2T-B4D0falO.js} +2 -2
  14. package/dist/assets/assets/{chunk-55XCU76K-CUB92Evl.js → chunk-55XCU76K-CKrttFen.js} +2 -2
  15. package/dist/assets/assets/{chunk-7S6XSTFO-CVayPHfE.js → chunk-7S6XSTFO-BPNrdjSb.js} +2 -2
  16. package/dist/assets/assets/{chunk-AQDTSKZB---wakYqY.js → chunk-AQDTSKZB-Ddx2gPU_.js} +2 -2
  17. package/dist/assets/assets/{chunk-DSNLSHJZ-DfbdohUR.js → chunk-DSNLSHJZ-iQg3RbZ_.js} +2 -2
  18. package/dist/assets/assets/{chunk-HAGFOTED-Dr4KRh-b.js → chunk-HAGFOTED-CGlDRwnk.js} +2 -2
  19. package/dist/assets/assets/{chunk-HNE4Q36P-D06cR91Z.js → chunk-HNE4Q36P-CN7VMEsn.js} +2 -2
  20. package/dist/assets/assets/{chunk-NQOKRVIF-Ca4gLeDb.js → chunk-NQOKRVIF-DQKmIS4j.js} +2 -2
  21. package/dist/assets/assets/{chunk-UHW7PFBP-DmL638jN.js → chunk-UHW7PFBP-BKSG_d1a.js} +2 -2
  22. package/dist/assets/assets/{chunk-VQ5W62QI-pkxSW5Zj.js → chunk-VQ5W62QI-AbFHiDOg.js} +2 -2
  23. package/dist/assets/assets/{chunk-WQQL4CDK-Dcc8hV4U.js → chunk-WQQL4CDK-C5a4DmCb.js} +2 -2
  24. package/dist/assets/assets/chunk-XXDRQBXY-BbVKQGnw.js +2 -0
  25. package/dist/assets/assets/{chunk-YZO67HFG-B_HKcFrw.js → chunk-YZO67HFG-UbKezTdY.js} +2 -2
  26. package/dist/assets/assets/{chunk-ZAUX2LTX-DAzZUysS.js → chunk-ZAUX2LTX-BShGGpRc.js} +2 -2
  27. package/dist/assets/assets/{chunk-ZCHMQSOR-DAVgjymL.js → chunk-ZCHMQSOR-BmV-PDP0.js} +2 -2
  28. package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-Fsw8TGPu.js → classDiagram-v2-4MYWR3UA-DB-cfBNq.js} +2 -2
  29. package/dist/assets/assets/{cose-bilkent-JH36ORCC-CgUbISYV.js → cose-bilkent-JH36ORCC-Dprqh48h.js} +2 -2
  30. package/dist/assets/assets/{cynefin-EF2NZ3EQ-D1LxAU2x.js → cynefin-EF2NZ3EQ-Bz4CND4n.js} +1 -1
  31. package/dist/assets/assets/{cynefinDiagram-WF24UDRP-D54I1jil.js → cynefinDiagram-WF24UDRP-Cv0Tq-0q.js} +2 -2
  32. package/dist/assets/assets/{dagre-NK4GIZVX-DC7zL16U.js → dagre-NK4GIZVX-H4d8oeNm.js} +2 -2
  33. package/dist/assets/assets/{diagram-CBK3MWTC-DB0ptUdz.js → diagram-CBK3MWTC-D75OthTM.js} +2 -2
  34. package/dist/assets/assets/{diagram-I5XIIV2D-CozSftPJ.js → diagram-I5XIIV2D-CB_W2jXU.js} +2 -2
  35. package/dist/assets/assets/{diagram-ODIL2UCW-g3WOEWDS.js → diagram-ODIL2UCW-DPO0lYZ-.js} +2 -2
  36. package/dist/assets/assets/{diagram-PFBEJUXE-CFxGeOYi.js → diagram-PFBEJUXE-DJ9olXAC.js} +2 -2
  37. package/dist/assets/assets/{diagram-RJA3I4VV-BQBsLche.js → diagram-RJA3I4VV-DL3974PI.js} +2 -2
  38. package/dist/assets/assets/{diagram-TYUNFSNR-DrjpW2yq.js → diagram-TYUNFSNR-ZuYESp4p.js} +2 -2
  39. package/dist/assets/assets/{dist-B3JXhDWV.js → dist-BnkGKHOV.js} +2 -2
  40. package/dist/assets/assets/{dist-1-mhYUBH.js → dist-C8iSs-hT.js} +2 -2
  41. package/dist/assets/assets/{dist-XIZum9n5.js → dist-CXqaT1wB.js} +2 -2
  42. package/dist/assets/assets/{dist-gfbb4ygy.js → dist-CdrEbsAL.js} +2 -2
  43. package/dist/assets/assets/{dist-h6SOnP8-.js → dist-CeotBqYt.js} +2 -2
  44. package/dist/assets/assets/{dist-DvgCCshF.js → dist-D2iSi_lg.js} +2 -2
  45. package/dist/assets/assets/{dist-DjL8d1jZ.js → dist-DvCNYjgK.js} +2 -2
  46. package/dist/assets/assets/{dist-BabjcJ3j.js → dist-G3vL_xw7.js} +2 -2
  47. package/dist/assets/assets/{dist-Izr2SB3q.js → dist-zXhaMKmO.js} +2 -2
  48. package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-BZS_aAve.js → ebnfDiagram-V4P3TTPT-DNfHKEsm.js} +2 -2
  49. package/dist/assets/assets/{elk-QONTBCTQ-B2ksVmMA.js → elk-QONTBCTQ-C0FX9D60.js} +2 -2
  50. package/dist/assets/assets/{erDiagram-KYQIGQAA-7P6zF-Z-.js → erDiagram-KYQIGQAA-BI1O9lW0.js} +2 -2
  51. package/dist/assets/assets/{eventmodeling-K75KTNOO-RoGQoRq-.js → eventmodeling-K75KTNOO-BmWt-aOv.js} +1 -1
  52. package/dist/assets/assets/flowDiagram-IUGLLWBU-DQj3H5a6.js +1 -0
  53. package/dist/assets/assets/{ganttDiagram-R7GPNTJY-CTOlRy7M.js → ganttDiagram-R7GPNTJY-pM7PmQ6B.js} +2 -2
  54. package/dist/assets/assets/{gitGraph-VSP46ZUC-CPqytIt0.js → gitGraph-VSP46ZUC-D0QXMQxv.js} +1 -1
  55. package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-BffLxuxg.js → gitGraphDiagram-PDYL7XHY-BsMltgt3.js} +2 -2
  56. package/dist/assets/assets/index-BTHzc8EN.js +155 -0
  57. package/dist/assets/assets/{info-OHQRW6UA-BI8RK0Ow.js → info-OHQRW6UA-Dp5Eu5PX.js} +1 -1
  58. package/dist/assets/assets/{infoDiagram-MVDRKAX5-DUIst1FB.js → infoDiagram-MVDRKAX5-TgXRfZiq.js} +2 -2
  59. package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-CA17Eho5.js → ishikawaDiagram-HPEHV2GE-Qzrmih4p.js} +2 -2
  60. package/dist/assets/assets/{journeyDiagram-BOSHW7O7-CNri5Ap9.js → journeyDiagram-BOSHW7O7-BksI3QOT.js} +2 -2
  61. package/dist/assets/assets/{kanban-definition-FNSA4HC5-DnXna7jO.js → kanban-definition-FNSA4HC5-l_IuN5_k.js} +2 -2
  62. package/dist/assets/assets/{line-BsXJZn93.js → line-BDKssGoM.js} +2 -2
  63. package/dist/assets/assets/{linear-BHYaD5T0.js → linear-C9vmtzBC.js} +2 -2
  64. package/dist/assets/assets/{mermaid-parser.core-B64Eo-8a.js → mermaid-parser.core-O1yFX7K_.js} +4 -4
  65. package/dist/assets/assets/{mermaid.core-Zw9qmTzg.js → mermaid.core-CIq57361.js} +5 -5
  66. package/dist/assets/assets/{mindmap-definition-6OY57UG3-E5qz4KNc.js → mindmap-definition-6OY57UG3-BkVuZ010.js} +2 -2
  67. package/dist/assets/assets/{packet-JDAUHWVQ-DgfizTr3.js → packet-JDAUHWVQ-PPNcSWeV.js} +1 -1
  68. package/dist/assets/assets/{pegDiagram-ECIUJNBX-D0WK_agM.js → pegDiagram-ECIUJNBX-ClwrHXhM.js} +2 -2
  69. package/dist/assets/assets/{pie-XZMESJXO-PJR1sXD4.js → pie-XZMESJXO-BAE4Cy9j.js} +1 -1
  70. package/dist/assets/assets/{pieDiagram-GNMPY74T-CPuU-NTs.js → pieDiagram-GNMPY74T-CvQ62Knb.js} +2 -2
  71. package/dist/assets/assets/{quadrantDiagram-D57K4MC3-5C9yjM1b.js → quadrantDiagram-D57K4MC3-CzAyT5ZB.js} +2 -2
  72. package/dist/assets/assets/{radar-ABXABTNO-BspdXgl0.js → radar-ABXABTNO-CoEe8B7b.js} +1 -1
  73. package/dist/assets/assets/{railroad-I3PHUGI6-Ct0a6hLD.js → railroad-I3PHUGI6-BbK5J8H5.js} +1 -1
  74. package/dist/assets/assets/{railroad-abnf-LNEFI6M7-fduYB4SA.js → railroad-abnf-LNEFI6M7-DlGngfop.js} +1 -1
  75. package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-CTQa8Sww.js → railroad-ebnf-DWYD2UWJ-BRk4ifMx.js} +1 -1
  76. package/dist/assets/assets/{railroad-peg-JR7BVNR7-DatoH3GJ.js → railroad-peg-JR7BVNR7-Rz-3vbj2.js} +1 -1
  77. package/dist/assets/assets/{railroadDiagram-Y72NRBL7-C8sWN8l2.js → railroadDiagram-Y72NRBL7-DQISBRHH.js} +2 -2
  78. package/dist/assets/assets/{requirementDiagram-EQYSW5RA-CqRz4RcT.js → requirementDiagram-EQYSW5RA-DcK4FnTB.js} +2 -2
  79. package/dist/assets/assets/{sankeyDiagram-SY24JHO5-bdiuKKlX.js → sankeyDiagram-SY24JHO5-N2EXBOYb.js} +2 -2
  80. package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-Zy-8I0Hy.js → sequenceDiagram-BLEHNHQU-CMJ2EqC_.js} +2 -2
  81. package/dist/assets/assets/{src-gihY33R9.js → src-Df9VBjd7.js} +2 -2
  82. package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-DXQERPvz.js → stateDiagram-v2-A6IESKWZ-D6Cxm8wj.js} +2 -2
  83. package/dist/assets/assets/{swimlanes-B3ENRKFQ-1gjZQElg.js → swimlanes-B3ENRKFQ-BybuzSPd.js} +2 -2
  84. package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-CXJkO6sc.js +9 -0
  85. package/dist/assets/assets/{timeline-definition-JXYKGLGB-CTeYEw-9.js → timeline-definition-JXYKGLGB-BzjkWUdz.js} +2 -2
  86. package/dist/assets/assets/{treeView-D4JQ5SDB-DD-EsLLT.js → treeView-D4JQ5SDB-DIDWwDtU.js} +1 -1
  87. package/dist/assets/assets/{treemap-SAJKECNS-BLdFeS5J.js → treemap-SAJKECNS-SWP4JszI.js} +1 -1
  88. package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-C1GikSSP.js → usecaseDiagram-WPOLBNNX-ZfCxSJdE.js} +2 -2
  89. package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-B1FoA3g8.js → vennDiagram-Q3Y3IDCW-o44wkgGH.js} +2 -2
  90. package/dist/assets/assets/{wardley-7MLQ67FV-BrHb5Bjf.js → wardley-7MLQ67FV-0zKRsI4Z.js} +1 -1
  91. package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-CmPLD1X4.js → wardleyDiagram-IVAIDKWA-CyBVyB40.js} +2 -2
  92. package/dist/assets/assets/{webpack-BYWDFj_R.js → webpack-C4nkEwJD.js} +2 -2
  93. package/dist/assets/assets/{xychartDiagram-4URNHDU4-DR5pfEjl.js → xychartDiagram-4URNHDU4-BMvRihYC.js} +2 -2
  94. package/dist/assets/bundle-asset-policy.json +1 -1
  95. package/dist/assets/index.html +1 -1
  96. package/dist/assets/plugins/assets/base-B5jpmLBl.css +2 -0
  97. package/dist/assets/plugins/assets/ibm-plex-sans-cyrillic-ext-wght-normal-d45eAU9y.woff2 +0 -0
  98. package/dist/assets/plugins/assets/ibm-plex-sans-cyrillic-wght-normal-BAAhND-U.woff2 +0 -0
  99. package/dist/assets/plugins/assets/ibm-plex-sans-greek-wght-normal-CmyJS8uq.woff2 +0 -0
  100. package/dist/assets/plugins/assets/ibm-plex-sans-latin-ext-wght-normal-CIII54If.woff2 +0 -0
  101. package/dist/assets/plugins/assets/ibm-plex-sans-latin-wght-normal-IvpUvPa2.woff2 +0 -0
  102. package/dist/assets/plugins/assets/ibm-plex-sans-vietnamese-wght-normal-Dg1JeJN0.woff2 +0 -0
  103. package/dist/assets/plugins/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
  104. package/dist/assets/plugins/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  105. package/dist/assets/plugins/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  106. package/dist/assets/plugins/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  107. package/dist/assets/plugins/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  108. package/dist/assets/plugins/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  109. package/dist/assets/plugins/chunks/po-web-runtime-D4qQFtJO.js +1 -0
  110. package/dist/assets/plugins/compositions.json +1 -0
  111. package/dist/assets/plugins/slots/approval.09e72f36-Cck_K9ex.js +2 -0
  112. package/dist/assets/plugins/slots/artifacts.50b639bb-BZM7uEbe.js +1 -0
  113. package/dist/assets/plugins/slots/builtin-tools.75108f21-EWWGTveL.js +7 -0
  114. package/dist/assets/plugins/slots/codemode.c58fb583-CgfTL6kt.js +9 -0
  115. package/dist/assets/plugins/slots/domain.753f9f92-BU0ilfwM.js +1 -0
  116. package/dist/assets/plugins/slots/mcp.82cc1ff5-BaCD2xZB.js +109 -0
  117. package/dist/assets/plugins/slots/profile.ab16dcec-Cu6ev2uW.js +1 -0
  118. package/dist/assets/plugins/slots/skill.62a0a1b3-Bz20F1eA.js +4 -0
  119. package/dist/{atomicJson-BJfPFSYF.js → atomicJson-DwSqByUJ.js} +3 -3
  120. package/dist/azure-openai-config-DHMgdIa-.js +55 -0
  121. package/dist/azure-openai-responses-CTgRdQ4m.js +183 -0
  122. package/dist/backgroundWork-bE3pc-R9.js +25 -0
  123. package/dist/classifier-shared-jXm-plIK.js +106 -0
  124. package/dist/cloudflare-workers-ai-system-one-B0wH6HU5.js +52 -0
  125. package/dist/{codemode-DbPu0yJN.js → codemode-yHAHBZO-.js} +1 -1
  126. package/dist/diagnostics-DPTP-yrt.js +131 -0
  127. package/dist/dist-Dvx5mlIR.js +50 -0
  128. package/dist/{domains-BNjGTOPj.js → domains-dHfk2U8X.js} +4 -4
  129. package/dist/env-api-keys-CAnjjnsR.js +32 -0
  130. package/dist/error-body-DQZRsyL5.js +102 -0
  131. package/dist/{exports-BNZz2DNU.js → exports-CrJqsTU6.js} +8 -8
  132. package/dist/{extensionFile-CXOa5G4C.js → extensionFile-CY4EFNHQ.js} +1 -1
  133. package/dist/github-copilot-headers-DpQQAh-s.js +22 -0
  134. package/dist/google-generative-ai-BTTOo5RQ.js +328 -0
  135. package/dist/google-shared-S7bqOccz.js +19588 -0
  136. package/dist/google-vertex-BcMU_DMb.js +374 -0
  137. package/dist/{harnessStore-BT706Ly6.js → harnessStore-CRtlTdbI.js} +4 -4
  138. package/dist/harnessStore-DZ4lDIq6.js +1 -0
  139. package/dist/hash-B3RRpLS2.js +16 -0
  140. package/dist/headers-BEuxFxDI.js +17 -0
  141. package/dist/{hubChannel-BHQyzcOo.js → hubChannel-Cj1iF847.js} +1 -1
  142. package/dist/identity-BIeAyilV.js +165 -0
  143. package/dist/{layeredConfig-DPQAnlXD.js → layeredConfig-BqIwPJ-I.js} +3 -3
  144. package/dist/majorModes-AYZvnOpU.js +1 -0
  145. package/dist/{majorModes-DbCfLZH3.js → majorModes-C-OD4PBc.js} +4 -4
  146. package/dist/mistral-conversations-DN8VSERk.js +689 -0
  147. package/dist/models-D6d73jcW.js +1511 -0
  148. package/dist/node-DytJOfYf.js +23 -0
  149. package/dist/node-UuMT2C3q.js +2479 -0
  150. package/dist/openai-bt3ZRBZv.js +17357 -0
  151. package/dist/openai-codex-responses-cL36x0ml.js +1210 -0
  152. package/dist/openai-completions-BWsTNYyT.js +984 -0
  153. package/dist/openai-decisions-Dfn_KgQd.js +142 -0
  154. package/dist/openai-prompt-cache-Bc6qNWt0.js +8 -0
  155. package/dist/openai-responses-aa0LoyCJ.js +281 -0
  156. package/dist/openai-responses-shared-H-jH5SlM.js +661 -0
  157. package/dist/openrouter-cost-D99Qqcs6.js +30 -0
  158. package/dist/openrouter-images-BpwVpALC.js +124 -0
  159. package/dist/pi-messages-BHAIkYBj.js +312 -0
  160. package/dist/{platform-B4AAgwJ0.js → platform-CNhm9zLi.js} +1 -1
  161. package/dist/{platformFiles-C_bXo4Ig.js → platformFiles-3rzOh9cg.js} +1 -1
  162. package/dist/provider-env-DgfpjgTa.js +38 -0
  163. package/dist/provider-retry-ChD-K2Gv.js +79 -0
  164. package/dist/{remoteMcp-CMqZldeA.js → remoteMcp-Ci8crSU9.js} +1 -1
  165. package/dist/sanitize-unicode-Dl4ROF7y.js +26 -0
  166. package/dist/{server-BZh1ZXz_.js → server-B2xd7WTP.js} +4 -4
  167. package/dist/{server-DJAanjoI.js → server-BPvd3Ya5.js} +6 -6
  168. package/dist/{server-D4W7EdJY.js → server-BccTx_r6.js} +11 -10
  169. package/dist/{server-BZaPPoQp.js → server-Bf3_VTkt.js} +9 -9
  170. package/dist/{server-tvgQ99rv.js → server-BmAziQml.js} +4 -4
  171. package/dist/{server-r358hzQg.js → server-BvV-GqDO.js} +3 -3
  172. package/dist/{server-BAAL9-NA.js → server-C1ijZQp4.js} +2 -2
  173. package/dist/{server-BE6VqEiA.js → server-CUvohcAm.js} +4 -4
  174. package/dist/{server-D8ndq0wL.js → server-CYQHzqaQ.js} +2 -2
  175. package/dist/{server-Dt4y1rZD.js → server-De_PIOty.js} +5 -5
  176. package/dist/{server-A-_GFpPr.js → server-DrZBZ17y.js} +7 -7
  177. package/dist/{server-Dpgh8PDh.js → server-DwWTQg1J.js} +4 -4
  178. package/dist/{server-D75MWDhB.js → server-xiuzwJ1C.js} +2 -2
  179. package/dist/{server-D3PQk1Gt.js → server-y9pjeHJM.js} +3 -3
  180. package/dist/{serverPlugin-BOI6c6s5.js → serverPlugin-H4T49sac.js} +4 -50
  181. package/dist/{sessionConfig-rBQgzXlT.js → sessionConfig-2a4LWInR.js} +8 -8
  182. package/dist/simple-options-DWrW31_K.js +156 -0
  183. package/dist/streaming-json-t4rzNHEp.js +858 -0
  184. package/dist/system-one-shared-DLVLdzYL.js +132 -0
  185. package/dist/transform-messages-CjTSwW9q.js +356 -0
  186. package/dist/typesafe-system-one-DBVcjcUQ.js +37 -0
  187. package/dist/uuid-mkNGilLv.js +31 -0
  188. package/dist/worker.js +56113 -21793
  189. package/package.json +22 -22
  190. package/dist/assets/assets/channel-CMrEzemr.js +0 -2
  191. package/dist/assets/assets/chunk-XXDRQBXY-CFf0S6bN.js +0 -2
  192. package/dist/assets/assets/flowDiagram-IUGLLWBU-BhGbWVf0.js +0 -1
  193. package/dist/assets/assets/index-Bx_K4Joy.js +0 -155
  194. package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-q91tR8ri.js +0 -9
  195. package/dist/backgroundWork-CeFrbRnj.js +0 -43
  196. package/dist/harnessStore-BiH9vSuD.js +0 -1
  197. package/dist/majorModes-BvWNqoHt.js +0 -1
  198. package/dist/server-36iuA3MI.js +0 -343
@@ -0,0 +1,132 @@
1
+ import { n as normalizeProviderError, t as formatProviderError } from "./error-body-DQZRsyL5.js";
2
+ import { i as requiredNumber, n as parseClassifierUsage, r as postClassifierRequest, t as isRecord } from "./classifier-shared-jXm-plIK.js";
3
+ //#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.0_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_cbd356c737d8e30c7d704b4728fb9233/node_modules/@earendil-works/pi-ai/dist/api/system-one-shared.js
4
+ /** TypeSafe's opt-in header for its experimental image input. */
5
+ const IMAGE_OPT_IN_HEADERS = { "TypeSafe-Danger-Zone-Images": "true" };
6
+ function probabilities(label, value, id) {
7
+ if (!isRecord(value)) throw new Error(`${label} returned invalid probabilities for ${id}`);
8
+ return Object.fromEntries(Object.entries(value).map(([key, probability]) => [key, requiredNumber(label, probability, `probability for ${id}.${key}`)]));
9
+ }
10
+ function parseAnswers(label, value, context) {
11
+ if (!isRecord(value)) throw new Error(`${label} returned an unexpected response`);
12
+ const answers = [];
13
+ for (const [id, question] of Object.entries(context.questions)) {
14
+ const answer = value[id];
15
+ if (!isRecord(answer)) throw new Error(`${label} did not return an answer for ${id}`);
16
+ if (question.type === "choice") {
17
+ if (answer.type !== "choice" || typeof answer.choice !== "string") throw new Error(`${label} did not return a choice answer for ${id}`);
18
+ answers.push([id, {
19
+ type: "choice",
20
+ choice: answer.choice,
21
+ probabilities: probabilities(label, answer.probabilities, id),
22
+ confidence: requiredNumber(label, answer.confidence, `confidence for ${id}`)
23
+ }]);
24
+ } else if (question.type === "score") {
25
+ if (answer.type !== "score") throw new Error(`${label} did not return a score answer for ${id}`);
26
+ answers.push([id, {
27
+ type: "score",
28
+ score: requiredNumber(label, answer.score, `score for ${id}`),
29
+ confidence: requiredNumber(label, answer.confidence, `confidence for ${id}`)
30
+ }]);
31
+ } else {
32
+ if (answer.type !== "noul") throw new Error(`${label} did not return a bool answer for ${id}`);
33
+ answers.push([id, {
34
+ type: "bool",
35
+ probability: requiredNumber(label, answer.noul, `probability for ${id}`)
36
+ }]);
37
+ }
38
+ }
39
+ return Object.fromEntries(answers);
40
+ }
41
+ const ASSET_FORMATS = {
42
+ "image/png": "png",
43
+ "image/jpeg": "jpeg"
44
+ };
45
+ const DATA_URL_TYPES = /* @__PURE__ */ new Set([
46
+ "image/png",
47
+ "image/jpeg",
48
+ "image/webp"
49
+ ]);
50
+ /** Clef accepts at most this many images per request. */
51
+ const MAX_DATA_URL_IMAGES = 4;
52
+ /** Adds the context images to `request` in the service's form. */
53
+ function addImages(label, model, input, images, request) {
54
+ if (input === "images") {
55
+ if (images.length > MAX_DATA_URL_IMAGES) throw new Error(`${label} accepts at most ${MAX_DATA_URL_IMAGES} images for ${model.id}, got ${images.length}`);
56
+ request.images = images.map((image) => {
57
+ if (!DATA_URL_TYPES.has(image.mimeType)) throw new Error(`${label} accepts PNG, JPEG, and WebP images for ${model.id}, got ${image.mimeType}`);
58
+ return `data:${image.mimeType};base64,${image.data}`;
59
+ });
60
+ return;
61
+ }
62
+ if (input === "state-image-urls") {
63
+ request.state = [...images.map((image) => ({
64
+ type: "image_url",
65
+ image_url: { url: `data:${image.mimeType};base64,${image.data}` }
66
+ })), request.state];
67
+ return;
68
+ }
69
+ const assets = {};
70
+ images.forEach((image, index) => {
71
+ const format = ASSET_FORMATS[image.mimeType];
72
+ if (!format) throw new Error(`${label} accepts PNG and JPEG images for ${model.id}, got ${image.mimeType}`);
73
+ assets[`<image-${index + 1}>`] = {
74
+ type: "image",
75
+ format,
76
+ data_base64: image.data
77
+ };
78
+ });
79
+ request.assets = assets;
80
+ request.state = [...Object.keys(assets), request.state];
81
+ }
82
+ /** Maps public `bool` questions to TypeSafe's wire-level `noul` type. */
83
+ function wireRequest(context) {
84
+ return {
85
+ state: context.state,
86
+ questions: Object.fromEntries(Object.entries(context.questions).map(([id, question]) => [id, question.type === "bool" ? {
87
+ ...question,
88
+ type: "noul"
89
+ } : question]))
90
+ };
91
+ }
92
+ /** Runs one System One classification over the given transport. */
93
+ async function classifySystemOne(transport, model, context, options) {
94
+ const output = {
95
+ api: model.api,
96
+ provider: model.provider,
97
+ model: model.id,
98
+ answers: {},
99
+ stopReason: "stop",
100
+ timestamp: Date.now()
101
+ };
102
+ try {
103
+ if (model.api !== transport.api) throw new Error(`Unsupported classifier API: ${model.api}`);
104
+ const request = wireRequest(context);
105
+ let requestOptions = options;
106
+ if (context.images?.length) {
107
+ if (!model.input.includes("image")) throw new Error(`${transport.label} does not support image input for ${model.id}`);
108
+ const detected = transport.detectCompat(model);
109
+ const imageInput = model.compat?.imageInput ?? detected.imageInput;
110
+ addImages(transport.label, model, imageInput, context.images, request);
111
+ if (model.compat?.sendImageOptInHeader ?? detected.sendImageOptInHeader) requestOptions = {
112
+ ...options,
113
+ headers: {
114
+ ...IMAGE_OPT_IN_HEADERS,
115
+ ...options?.headers
116
+ }
117
+ };
118
+ }
119
+ const body = await postClassifierRequest(transport.label, transport.url(model), model, transport.payload(model, request), requestOptions);
120
+ const result = transport.output(body);
121
+ const usage = parseClassifierUsage(result.usage, model);
122
+ if (usage) output.usage = usage;
123
+ output.answers = parseAnswers(transport.label, result.answers, context);
124
+ return output;
125
+ } catch (error) {
126
+ output.stopReason = options?.signal?.aborted ? "aborted" : "error";
127
+ output.errorMessage = formatProviderError(normalizeProviderError(error), `${transport.label} error`);
128
+ return output;
129
+ }
130
+ }
131
+ //#endregion
132
+ export { classifySystemOne as t };
@@ -0,0 +1,356 @@
1
+ //#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.0_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_cbd356c737d8e30c7d704b4728fb9233/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.js
2
+ var UnsupportedStrictJsonSchemaError = class extends Error {};
3
+ const UNSUPPORTED_STRICT_SCHEMA_KEYS = [
4
+ "$ref",
5
+ "$defs",
6
+ "definitions",
7
+ "allOf",
8
+ "oneOf",
9
+ "patternProperties",
10
+ "dependentSchemas",
11
+ "dependencies",
12
+ "unevaluatedProperties",
13
+ "propertyNames",
14
+ "contains",
15
+ "prefixItems",
16
+ "not",
17
+ "if",
18
+ "then",
19
+ "else"
20
+ ];
21
+ function isJsonSchemaObject(value) {
22
+ return typeof value === "object" && value !== null && !Array.isArray(value);
23
+ }
24
+ function isStructuredSchema(schema) {
25
+ if (!isJsonSchemaObject(schema)) return false;
26
+ const types = typeof schema.type === "string" ? [schema.type] : Array.isArray(schema.type) ? schema.type : [];
27
+ return types.includes("object") || types.includes("array") || schema.properties !== void 0 || schema.items !== void 0;
28
+ }
29
+ function schemaAllowsNull(schema) {
30
+ if (!isJsonSchemaObject(schema)) return false;
31
+ if (schema.type === "null" || Array.isArray(schema.type) && schema.type.includes("null")) return true;
32
+ if (schema.const === null || Array.isArray(schema.enum) && schema.enum.includes(null)) return true;
33
+ return Array.isArray(schema.anyOf) && schema.anyOf.some((variant) => schemaAllowsNull(variant));
34
+ }
35
+ function makeJsonSchemaNodeStrict(schema, isUnsupportedKeyword) {
36
+ if (!isJsonSchemaObject(schema)) throw new UnsupportedStrictJsonSchemaError("boolean schemas are unsupported");
37
+ for (const key of UNSUPPORTED_STRICT_SCHEMA_KEYS) if (schema[key] !== void 0) throw new UnsupportedStrictJsonSchemaError(`${key} schemas are unsupported`);
38
+ if (isUnsupportedKeyword) {
39
+ for (const [key, value] of Object.entries(schema)) if (isUnsupportedKeyword(key, value)) throw new UnsupportedStrictJsonSchemaError(`${key}: ${JSON.stringify(value)} is unsupported`);
40
+ }
41
+ if (schema.anyOf !== void 0) {
42
+ if (!Array.isArray(schema.anyOf) || schema.anyOf.length === 0) throw new UnsupportedStrictJsonSchemaError("anyOf must contain at least one schema");
43
+ for (const variant of schema.anyOf) {
44
+ if (isStructuredSchema(variant)) throw new UnsupportedStrictJsonSchemaError("object and array unions are unsupported");
45
+ makeJsonSchemaNodeStrict(variant, isUnsupportedKeyword);
46
+ }
47
+ }
48
+ if (schema.items !== void 0) {
49
+ if (Array.isArray(schema.items)) throw new UnsupportedStrictJsonSchemaError("tuple schemas are unsupported");
50
+ makeJsonSchemaNodeStrict(schema.items, isUnsupportedKeyword);
51
+ }
52
+ const isObjectSchema = schema.type === "object";
53
+ if (schema.properties !== void 0 && !isObjectSchema) throw new UnsupportedStrictJsonSchemaError("properties require type object");
54
+ if (!isObjectSchema) return;
55
+ if (schema.additionalProperties !== void 0 && schema.additionalProperties !== false) throw new UnsupportedStrictJsonSchemaError("schema-valued or true additionalProperties is unsupported");
56
+ if (schema.properties !== void 0 && !isJsonSchemaObject(schema.properties)) throw new UnsupportedStrictJsonSchemaError("object properties must be a schema map");
57
+ if (schema.required !== void 0 && (!Array.isArray(schema.required) || schema.required.some((key) => typeof key !== "string"))) throw new UnsupportedStrictJsonSchemaError("object required must be a string array");
58
+ const properties = schema.properties ?? {};
59
+ const propertyNames = Object.keys(properties);
60
+ const required = new Set(Array.isArray(schema.required) ? schema.required : []);
61
+ if ([...required].some((key) => !propertyNames.includes(key))) throw new UnsupportedStrictJsonSchemaError("required contains an unknown property");
62
+ for (const [key, property] of Object.entries(properties)) {
63
+ makeJsonSchemaNodeStrict(property, isUnsupportedKeyword);
64
+ if (!required.has(key) && !schemaAllowsNull(property)) properties[key] = { anyOf: [property, { type: "null" }] };
65
+ }
66
+ schema.required = propertyNames;
67
+ schema.additionalProperties = false;
68
+ }
69
+ /** Convert a tool schema to the strict subset expected by provider constrained sampling. */
70
+ function makeStrictJsonSchema(schema, isUnsupportedKeyword) {
71
+ const cloned = structuredClone(schema);
72
+ if (!isJsonSchemaObject(cloned)) throw new UnsupportedStrictJsonSchemaError("root schema must have type object");
73
+ makeJsonSchemaNodeStrict(cloned, isUnsupportedKeyword);
74
+ if (cloned.type !== "object") throw new UnsupportedStrictJsonSchemaError("root schema must have type object");
75
+ return cloned;
76
+ }
77
+ /** Returns true for a tool that asks for strict JSON-schema sampling only when possible (`strict: "prefer"`). */
78
+ function prefersJsonSchemaStrictSampling(tool) {
79
+ const config = tool.constrainedSampling;
80
+ return !!config && config.type === "json_schema" && config.strict === "prefer";
81
+ }
82
+ /**
83
+ * Claude rejects (on the Anthropic API and on Bedrock) a request whose strict tools exceed its limits with one of these
84
+ * messages. Observed limits: 20 strict tools, and 16 optional or union-typed parameters across all strict tools.
85
+ */
86
+ const STRICT_TOOL_LIMIT_ERROR_MESSAGES = [
87
+ "The compiled grammar is too large",
88
+ "Too many strict tools (",
89
+ "Schemas contains too many parameters with union types ("
90
+ ];
91
+ /** Returns true when a provider error message says the request's strict tools exceed the provider's limits. */
92
+ function isStrictToolLimitErrorMessage(message) {
93
+ return STRICT_TOOL_LIMIT_ERROR_MESSAGES.some((limitMessage) => message.includes(limitMessage));
94
+ }
95
+ function getJsonSchemaToolParameters(tool, strict) {
96
+ return strict === true ? makeStrictJsonSchema(tool.parameters) : tool.parameters;
97
+ }
98
+ function getGrammarToolInput(toolName, arguments_, inputProperty) {
99
+ const input = arguments_[inputProperty];
100
+ if (typeof input !== "string") throw new Error(`Grammar tool call "${toolName}" requires argument "${inputProperty}" to be a string.`);
101
+ return input;
102
+ }
103
+ /**
104
+ * Append `inputDelta` to a streaming grammar tool input and return the matching piece of its JSON arguments text, or
105
+ * `undefined` for an empty delta. Costs time linear in the delta, never in the input so far.
106
+ */
107
+ function appendGrammarToolInputJsonDelta(buffer, inputProperty, inputDelta) {
108
+ if (buffer.closed) throw new Error(`grammar tool input for property "${inputProperty}" changed after it was closed`);
109
+ if (inputDelta.length === 0) return void 0;
110
+ buffer.input += inputDelta;
111
+ return grammarToolInputJsonStart(buffer, inputProperty) + JSON.stringify(inputDelta).slice(1, -1);
112
+ }
113
+ /**
114
+ * Close a streaming grammar tool input and return the rest of its JSON arguments text. `finalInput` is the complete
115
+ * input when the provider sends one; it must continue the input streamed so far. Closing again with the same input
116
+ * returns `undefined`.
117
+ */
118
+ function closeGrammarToolInputJson(buffer, inputProperty, finalInput) {
119
+ if (buffer.closed) {
120
+ if (finalInput === void 0 || finalInput === buffer.input) return void 0;
121
+ throw new Error(`grammar tool input for property "${inputProperty}" changed after it was closed`);
122
+ }
123
+ if (finalInput !== void 0 && !finalInput.startsWith(buffer.input)) throw new Error(`grammar tool input for property "${inputProperty}" changed non-monotonically`);
124
+ const rest = finalInput === void 0 ? "" : finalInput.slice(buffer.input.length);
125
+ if (finalInput !== void 0) buffer.input = finalInput;
126
+ buffer.closed = true;
127
+ return `${grammarToolInputJsonStart(buffer, inputProperty)}${JSON.stringify(rest).slice(1, -1)}"}`;
128
+ }
129
+ /** The opening of the JSON arguments text, once. */
130
+ function grammarToolInputJsonStart(buffer, inputProperty) {
131
+ if (buffer.started) return "";
132
+ buffer.started = true;
133
+ return `{${JSON.stringify(inputProperty)}:"`;
134
+ }
135
+ function inferGrammarInputProperty(tool) {
136
+ const schema = tool.parameters;
137
+ if (schema.type !== "object") throw new Error("grammar constrained sampling requires an object parameter schema");
138
+ if (!Array.isArray(schema.required) || schema.required.length !== 1 || typeof schema.required[0] !== "string") throw new Error("grammar constrained sampling requires exactly one required string property");
139
+ const inputProperty = schema.required[0];
140
+ if (!schema.properties?.[inputProperty]) throw new Error(`grammar constrained sampling requires a properties entry for ${inputProperty}`);
141
+ if (schema.properties[inputProperty]?.type !== "string") throw new Error(`grammar constrained sampling property ${inputProperty} must have type string`);
142
+ return inputProperty;
143
+ }
144
+ /**
145
+ * Decide whether a JSON-schema tool is sent in strict mode. `isUnsupportedKeyword` lets a provider
146
+ * reject extra keywords its strict mode does not accept, so "prefer" tools fall back to non-strict.
147
+ */
148
+ function resolveJsonSchemaStrictSampling(tool, supportsStrictMode, isUnsupportedKeyword) {
149
+ const config = tool.constrainedSampling;
150
+ if (!config || config.type !== "json_schema") return void 0;
151
+ if (supportsStrictMode) try {
152
+ makeStrictJsonSchema(tool.parameters, isUnsupportedKeyword);
153
+ return true;
154
+ } catch (error) {
155
+ if (!(error instanceof UnsupportedStrictJsonSchemaError)) throw error;
156
+ if (config.strict !== "require") return void 0;
157
+ throw new Error(`Tool "${tool.name}" requires JSON-schema constrained sampling, but ${error.message}.`);
158
+ }
159
+ if (config.strict === "require") throw new Error(`Tool "${tool.name}" requires JSON-schema constrained sampling, but strict tools are unsupported.`);
160
+ }
161
+ function resolveGrammarConstrainedSampling(tool, supportsOpenAIGrammarTools) {
162
+ const config = tool.constrainedSampling;
163
+ if (!config || config.type !== "grammar") return;
164
+ if (!supportsOpenAIGrammarTools) return;
165
+ const larkDefinition = config.variants.openai_lark;
166
+ const regexDefinition = config.variants.openai_regex;
167
+ const hasLarkDefinition = typeof larkDefinition === "string" && larkDefinition.trim().length > 0;
168
+ const hasRegexDefinition = typeof regexDefinition === "string" && regexDefinition.trim().length > 0;
169
+ if (!hasLarkDefinition && !hasRegexDefinition) throw new Error(`Tool "${tool.name}" cannot use grammar constrained sampling: no supported grammar variant was provided.`);
170
+ try {
171
+ return {
172
+ format: hasLarkDefinition ? "lark" : "regex",
173
+ definition: hasLarkDefinition ? larkDefinition : regexDefinition,
174
+ inputProperty: inferGrammarInputProperty(tool)
175
+ };
176
+ } catch (error) {
177
+ const message = error instanceof Error ? error.message : String(error);
178
+ throw new Error(`Tool "${tool.name}" cannot use grammar constrained sampling: ${message}.`);
179
+ }
180
+ }
181
+ function createGrammarToolInputProperties(tools, supportsOpenAIGrammarTools) {
182
+ const properties = /* @__PURE__ */ new Map();
183
+ for (const tool of tools ?? []) {
184
+ const grammar = resolveGrammarConstrainedSampling(tool, supportsOpenAIGrammarTools);
185
+ if (grammar) properties.set(tool.name, grammar.inputProperty);
186
+ }
187
+ return properties;
188
+ }
189
+ //#endregion
190
+ //#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.0_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_cbd356c737d8e30c7d704b4728fb9233/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.js
191
+ const NON_VISION_USER_IMAGE_PLACEHOLDER = "(image omitted: model does not support images)";
192
+ const NON_VISION_TOOL_IMAGE_PLACEHOLDER = "(tool image omitted: model does not support images)";
193
+ const ERROR_TOOL_IMAGE_PLACEHOLDER = "(image attached after the tool results)";
194
+ /**
195
+ * Split the images out of an error tool result, for APIs that reject images in error results
196
+ * (Anthropic, and Claude on Bedrock). Send the returned content as the tool result and the caption and
197
+ * images after all tool results of the turn, in the same user message. Returns undefined for results
198
+ * that need no split (#10794).
199
+ */
200
+ function splitErrorToolResultImages(msg) {
201
+ if (!msg.isError) return void 0;
202
+ const images = msg.content.filter((block) => block.type === "image");
203
+ if (images.length === 0) return void 0;
204
+ return {
205
+ content: replaceImagesWithPlaceholder(msg.content, ERROR_TOOL_IMAGE_PLACEHOLDER),
206
+ caption: `Images from the error result of tool call ${msg.toolCallId} (${msg.toolName}):`,
207
+ images
208
+ };
209
+ }
210
+ function replaceImagesWithPlaceholder(content, placeholder) {
211
+ const result = [];
212
+ let previousWasPlaceholder = false;
213
+ for (const block of content) {
214
+ if (block.type === "image") {
215
+ if (!previousWasPlaceholder) result.push({
216
+ type: "text",
217
+ text: placeholder
218
+ });
219
+ previousWasPlaceholder = true;
220
+ continue;
221
+ }
222
+ result.push(block);
223
+ previousWasPlaceholder = block.text === placeholder;
224
+ }
225
+ return result;
226
+ }
227
+ function downgradeUnsupportedImages(messages, model) {
228
+ if (model.input.includes("image")) return messages;
229
+ return messages.map((msg) => {
230
+ if (msg.role === "user" && Array.isArray(msg.content)) return {
231
+ ...msg,
232
+ content: replaceImagesWithPlaceholder(msg.content, NON_VISION_USER_IMAGE_PLACEHOLDER)
233
+ };
234
+ if (msg.role === "toolResult") return {
235
+ ...msg,
236
+ content: replaceImagesWithPlaceholder(msg.content, NON_VISION_TOOL_IMAGE_PLACEHOLDER)
237
+ };
238
+ return msg;
239
+ });
240
+ }
241
+ /**
242
+ * Normalize tool call ID for cross-provider compatibility.
243
+ * OpenAI Responses API generates IDs that are 450+ chars with special characters like `|`.
244
+ * Anthropic APIs require IDs matching ^[a-zA-Z0-9_-]+$ (max 64 chars).
245
+ */
246
+ function transformMessages(messages, model, normalizeToolCallId) {
247
+ const toolCallIdMap = /* @__PURE__ */ new Map();
248
+ const transformed = downgradeUnsupportedImages(messages.map((msg) => msg.content == null ? {
249
+ ...msg,
250
+ content: []
251
+ } : msg), model).map((msg) => {
252
+ if (msg.role === "system" || msg.role === "user") return msg;
253
+ if (msg.role === "toolResult") {
254
+ const normalizedId = toolCallIdMap.get(msg.toolCallId);
255
+ if (normalizedId && normalizedId !== msg.toolCallId) return {
256
+ ...msg,
257
+ toolCallId: normalizedId
258
+ };
259
+ return msg;
260
+ }
261
+ if (msg.role === "assistant") {
262
+ const assistantMsg = msg;
263
+ const isSameModel = assistantMsg.provider === model.provider && assistantMsg.api === model.api && assistantMsg.model === model.id;
264
+ const transformedContent = assistantMsg.content.flatMap((block) => {
265
+ if (block.type === "thinking") {
266
+ if (!isSameModel) return [];
267
+ if (block.redacted || block.thinkingSignature) return block;
268
+ if (!block.thinking || block.thinking.trim() === "") return [];
269
+ return block;
270
+ }
271
+ if (block.type === "text") {
272
+ if (isSameModel) return block;
273
+ return {
274
+ type: "text",
275
+ text: block.text
276
+ };
277
+ }
278
+ if (block.type === "toolCall") {
279
+ const toolCall = block;
280
+ let normalizedToolCall = toolCall;
281
+ if (!isSameModel && toolCall.thoughtSignature) {
282
+ normalizedToolCall = { ...toolCall };
283
+ delete normalizedToolCall.thoughtSignature;
284
+ }
285
+ if (!isSameModel && normalizeToolCallId) {
286
+ const normalizedId = normalizeToolCallId(toolCall.id, model, assistantMsg);
287
+ if (normalizedId !== toolCall.id) {
288
+ toolCallIdMap.set(toolCall.id, normalizedId);
289
+ normalizedToolCall = {
290
+ ...normalizedToolCall,
291
+ id: normalizedId
292
+ };
293
+ }
294
+ }
295
+ return normalizedToolCall;
296
+ }
297
+ return block;
298
+ });
299
+ return {
300
+ ...assistantMsg,
301
+ content: transformedContent
302
+ };
303
+ }
304
+ return msg;
305
+ });
306
+ const result = [];
307
+ let pendingToolCalls = [];
308
+ let existingToolResultIds = /* @__PURE__ */ new Set();
309
+ const heldSystemMessages = [];
310
+ const closePendingToolCalls = () => {
311
+ if (pendingToolCalls.length > 0) {
312
+ for (const tc of pendingToolCalls) if (!existingToolResultIds.has(tc.id)) result.push({
313
+ role: "toolResult",
314
+ toolCallId: tc.id,
315
+ toolName: tc.name,
316
+ content: [{
317
+ type: "text",
318
+ text: "No result provided"
319
+ }],
320
+ isError: true,
321
+ timestamp: Date.now()
322
+ });
323
+ pendingToolCalls = [];
324
+ existingToolResultIds = /* @__PURE__ */ new Set();
325
+ }
326
+ result.push(...heldSystemMessages);
327
+ heldSystemMessages.length = 0;
328
+ };
329
+ for (let i = 0; i < transformed.length; i++) {
330
+ const msg = transformed[i];
331
+ if (msg.role === "assistant") {
332
+ closePendingToolCalls();
333
+ const assistantMsg = msg;
334
+ if (assistantMsg.stopReason === "error" || assistantMsg.stopReason === "aborted") continue;
335
+ const toolCalls = assistantMsg.content.filter((b) => b.type === "toolCall");
336
+ if (toolCalls.length > 0) {
337
+ pendingToolCalls = toolCalls;
338
+ existingToolResultIds = /* @__PURE__ */ new Set();
339
+ }
340
+ result.push(msg);
341
+ } else if (msg.role === "toolResult") {
342
+ existingToolResultIds.add(msg.toolCallId);
343
+ result.push(msg);
344
+ } else if (msg.role === "system") {
345
+ if (pendingToolCalls.length > 0) heldSystemMessages.push(msg);
346
+ else result.push(msg);
347
+ } else if (msg.role === "user") {
348
+ closePendingToolCalls();
349
+ result.push(msg);
350
+ } else result.push(msg);
351
+ }
352
+ closePendingToolCalls();
353
+ return result;
354
+ }
355
+ //#endregion
356
+ export { createGrammarToolInputProperties as a, isStrictToolLimitErrorMessage as c, resolveJsonSchemaStrictSampling as d, closeGrammarToolInputJson as i, prefersJsonSchemaStrictSampling as l, transformMessages as n, getGrammarToolInput as o, appendGrammarToolInputJsonDelta as r, getJsonSchemaToolParameters as s, splitErrorToolResultImages as t, resolveGrammarConstrainedSampling as u };
@@ -0,0 +1,37 @@
1
+ import { t as isRecord } from "./classifier-shared-jXm-plIK.js";
2
+ import { t as classifySystemOne } from "./system-one-shared-DLVLdzYL.js";
3
+ //#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.0_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_cbd356c737d8e30c7d704b4728fb9233/node_modules/@earendil-works/pi-ai/dist/api/typesafe-system-one.js
4
+ /**
5
+ * TypeSafe's native System One protocol. OpenRouter serves the same protocol,
6
+ * so both providers use this API with different base URLs.
7
+ *
8
+ * TypeSafe takes images as `assets`. They are experimental and need the
9
+ * `TypeSafe-Danger-Zone-Images` opt-in header; without it the API answers 400.
10
+ * OpenRouter drops `assets` silently and takes images as `image_url` parts in the state instead.
11
+ * Models behind a proxy that hides both the provider ID and the OpenRouter host must set
12
+ * `compat.imageInput`.
13
+ */
14
+ const transport = {
15
+ api: "typesafe-system-one",
16
+ label: "System One API",
17
+ detectCompat: (model) => model.provider === "openrouter" || model.baseUrl.includes("openrouter.ai") ? {
18
+ imageInput: "state-image-urls",
19
+ sendImageOptInHeader: false
20
+ } : {
21
+ imageInput: "assets",
22
+ sendImageOptInHeader: true
23
+ },
24
+ url: (model) => new URL("systemone", `${model.baseUrl.replace(/\/+$/u, "")}/`),
25
+ payload: (model, request) => ({
26
+ model: model.id,
27
+ ...request
28
+ }),
29
+ output: (body) => {
30
+ if (!isRecord(body)) throw new Error("System One API returned an unexpected response");
31
+ return body;
32
+ }
33
+ };
34
+ /** TypeSafe System One classification with public `bool` values mapped to wire-level `noul`. */
35
+ const classify = (model, context, options) => classifySystemOne(transport, model, context, options);
36
+ //#endregion
37
+ export { classify };
@@ -0,0 +1,31 @@
1
+ //#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.0_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_cbd356c737d8e30c7d704b4728fb9233/node_modules/@earendil-works/pi-ai/dist/utils/uuid.js
2
+ const MAX_UUID_V7_TIMESTAMP = 0xffffffffffff;
3
+ const MAX_SEQUENCE = (1n << 41n) - 1n;
4
+ let lastOrdinaryTimestamp = -1;
5
+ let sequence;
6
+ /** Generate a time-ordered UUIDv7. A supplied timestamp is preserved for follower ids. */
7
+ function uuidv7(timestampMs) {
8
+ const requestedTimestamp = timestampMs ?? Date.now();
9
+ if (!Number.isInteger(requestedTimestamp) || requestedTimestamp < 0 || requestedTimestamp > MAX_UUID_V7_TIMESTAMP) throw new RangeError(`UUIDv7 timestamp must be an integer between 0 and ${MAX_UUID_V7_TIMESTAMP}`);
10
+ const effectiveTimestamp = timestampMs === void 0 ? Math.max(requestedTimestamp, lastOrdinaryTimestamp) : timestampMs;
11
+ if (timestampMs === void 0) lastOrdinaryTimestamp = effectiveTimestamp;
12
+ const bytes = /* @__PURE__ */ new Uint8Array(16);
13
+ globalThis.crypto.getRandomValues(bytes);
14
+ if (sequence === void 0) sequence = BigInt(bytes[1]) << 32n | BigInt(bytes[2]) << 24n | BigInt(bytes[3]) << 16n | BigInt(bytes[4]) << 8n | BigInt(bytes[5]);
15
+ else {
16
+ if (sequence === MAX_SEQUENCE) throw new RangeError("UUIDv7 generator sequence exhausted");
17
+ sequence++;
18
+ }
19
+ const timestamp = BigInt(effectiveTimestamp);
20
+ for (let index = 5; index >= 0; index--) bytes[index] = Number(timestamp >> BigInt((5 - index) * 8)) & 255;
21
+ bytes[6] = 112 | Number(sequence >> 37n & 15n);
22
+ bytes[7] = Number(sequence >> 29n & 255n);
23
+ bytes[8] = 128 | Number(sequence >> 23n & 63n);
24
+ bytes[9] = Number(sequence >> 15n & 255n);
25
+ bytes[10] = Number(sequence >> 7n & 255n);
26
+ bytes[11] = Number((sequence & 127n) << 1n) | bytes[11] & 1;
27
+ const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0"));
28
+ return `${hex.slice(0, 4).join("")}-${hex.slice(4, 6).join("")}-${hex.slice(6, 8).join("")}-${hex.slice(8, 10).join("")}-${hex.slice(10).join("")}`;
29
+ }
30
+ //#endregion
31
+ export { uuidv7 as t };