@qredence/fleet 0.5.1 → 0.5.7

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 (200) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/bin/fleet-prime.mjs +6 -0
  3. package/dist/web/client/assets/action-swap-roll-BB8DFMuf.js +1 -0
  4. package/dist/web/client/assets/agent-activity-CDcDNVC6.js +1 -0
  5. package/dist/web/client/assets/agent-disclosure-B8SnhQXL.js +1 -0
  6. package/dist/web/client/assets/analytics-stub-B8MIkiDB.js +1 -0
  7. package/dist/web/client/assets/{artifacts-panel-CX62LQ13.js → artifacts-panel-CmHYXfoo.js} +1 -1
  8. package/dist/web/client/assets/button-BV9NafmI.js +1 -0
  9. package/dist/web/client/assets/{chat-CsepBQwy.js → chat-W-yOMyG_.js} +1 -1
  10. package/dist/web/client/assets/chat-command-palette-DiG-i3uJ.js +1 -0
  11. package/dist/web/client/assets/check-JjHKAZas.js +1 -0
  12. package/dist/web/client/assets/chevron-up-CnSvySGH.js +1 -0
  13. package/dist/web/client/assets/circle-alert-CONlFReH.js +1 -0
  14. package/dist/web/client/assets/circle-x-CkKCB__4.js +1 -0
  15. package/dist/web/client/assets/citations-CpTFUvx7.js +2 -0
  16. package/dist/web/client/assets/collapsible-BoXtZZWN.js +1 -0
  17. package/dist/web/client/assets/command-Cx-UYeQ9.js +1 -0
  18. package/dist/web/client/assets/createBaseUIEventDetails-DV0dQrBX.js +1 -0
  19. package/dist/web/client/assets/dialog-Dh7WpGIu.js +1 -0
  20. package/dist/web/client/assets/dist-BPaFisIZ.js +41 -0
  21. package/dist/web/client/assets/earth-DGZXAN5r.js +1 -0
  22. package/dist/web/client/assets/ease-u56MhKYS.js +1 -0
  23. package/dist/web/client/assets/file-text-T-NcAlZs.js +1 -0
  24. package/dist/web/client/assets/fleet-message-queue-B6zAK-hX.js +1 -0
  25. package/dist/web/client/assets/{fleet-pi-tool-renderer-BD_ZAjlG.js → fleet-pi-tool-renderer-Btq9mDUe.js} +29 -29
  26. package/dist/web/client/assets/fleet-reasoning-panel-MtbSdoCv.js +1 -0
  27. package/dist/web/client/assets/fleet-subagent-list-iszvrvy_.js +1 -0
  28. package/dist/web/client/assets/fleet-tool-timeline-COzPrwr8.js +1 -0
  29. package/dist/web/client/assets/{fork-picker-dialog-C2cVJUbf.js → fork-picker-dialog-CAhWx0G5.js} +1 -1
  30. package/dist/web/client/assets/gauge-DNpstbBn.js +1 -0
  31. package/dist/web/client/assets/generative-text-renderer-C1JrmYfx.js +6 -0
  32. package/dist/web/client/assets/globals-Bfr0jrPq.css +2 -0
  33. package/dist/web/client/assets/horizontal-resize-Bl3AyBJg.js +1 -0
  34. package/dist/web/client/assets/image-BbPmlw-n.js +1 -0
  35. package/dist/web/client/assets/index-QgUwd4m8.js +12 -0
  36. package/dist/web/client/assets/input-Bol3TP4v.js +1 -0
  37. package/dist/web/client/assets/input-group-D5gi9zBK.js +1 -0
  38. package/dist/web/client/assets/{ipython-tool-BfeIa0nK.js → ipython-tool-BrMePqD-.js} +1 -1
  39. package/dist/web/client/assets/{markdown-DG7pUdsX.js → markdown-RD_ydkyD.js} +2 -2
  40. package/dist/web/client/assets/{markdown-code-BgMzpy7O.js → markdown-code-ETqXqY8E.js} +1 -1
  41. package/dist/web/client/assets/message-square-hbDao-A1.js +1 -0
  42. package/dist/web/client/assets/model-selector-list-CJY9pyt2.js +1 -0
  43. package/dist/web/client/assets/notify-DKTqXChG.js +1 -0
  44. package/dist/web/client/assets/{openui-renderer-DlUo6ehT.js → openui-renderer-BZMghkzQ.js} +8 -8
  45. package/dist/web/client/assets/{prime-agent-artifacts-CHGb5V_j.js → prime-agent-artifacts-C-g1VPiW.js} +1 -1
  46. package/dist/web/client/assets/prompt-suggestions-CXM6knMK.js +1 -0
  47. package/dist/web/client/assets/provider-catalog-CHKFGwHr.js +1 -0
  48. package/dist/web/client/assets/provider-label-KkqVX1CI.js +1 -0
  49. package/dist/web/client/assets/range-BWOHiLNe.js +1 -0
  50. package/dist/web/client/assets/refresh-cw-IThTJ3j-.js +1 -0
  51. package/dist/web/client/assets/repl-panel-CCh4ly7J.js +1 -0
  52. package/dist/web/client/assets/{resource-helpers-ULlyU8qK.js → resource-helpers-Q2T0YCMO.js} +1 -1
  53. package/dist/web/client/assets/resources-panel-Bo8dfUdm.js +1 -0
  54. package/dist/web/client/assets/right-panel-context-B2VAZ2p4.js +1 -0
  55. package/dist/web/client/assets/right-panel-registry-C5fQcBKw.js +2 -0
  56. package/dist/web/client/assets/routes-C1hRkRkv.js +16 -0
  57. package/dist/web/client/assets/safe-external-url-D3PJJIcM.js +1 -0
  58. package/dist/web/client/assets/session-insights-panel-CQdT90Op.js +1 -0
  59. package/dist/web/client/assets/settings-dialog-CvvM6T0m.js +1 -0
  60. package/dist/web/client/assets/{sparkles-C5H3Jtgf.js → shield-check-CkA2viVW.js} +1 -1
  61. package/dist/web/client/assets/{skeleton-loaders-fStjEeRP.js → skeleton-loaders-DjGv9LLA.js} +1 -1
  62. package/dist/web/client/assets/sparkles-DuclzqlE.js +1 -0
  63. package/dist/web/client/assets/subagent-chat-panel-tGCg6gcn.js +1 -0
  64. package/dist/web/client/assets/subagent-transcript-NO0PR8RU.js +1 -0
  65. package/dist/web/client/assets/subagent-utils-CQbaJ1g-.js +1 -0
  66. package/dist/web/client/assets/subagents-panel-BkFLsQQY.js +1 -0
  67. package/dist/web/client/assets/surfaces-cW-gp56p.js +1 -0
  68. package/dist/web/client/assets/switch-CcOFiQBK.js +1 -0
  69. package/dist/web/client/assets/terminal-DOS1s1gm.js +1 -0
  70. package/dist/web/client/assets/toast-ATq44uAL.js +1 -0
  71. package/dist/web/client/assets/tool-result-pklnrxSW.js +4 -0
  72. package/dist/web/client/assets/use-reduced-motion-eORd7fqW.js +9 -0
  73. package/dist/web/client/assets/useBaseUiId-CHqXB2UQ.js +1 -0
  74. package/dist/web/client/assets/useControlled-CJJ9BOQB.js +1 -0
  75. package/dist/web/client/assets/workspace-panel-BmMW7h7b.js +1 -0
  76. package/dist/web/client/assets/wrench-BJNNe07k.js +1 -0
  77. package/dist/web/client/assets/x-CsRC_tCI.js +1 -0
  78. package/dist/web/client/bundle-budget.json +10 -0
  79. package/dist/web/server/_tanstack-start-manifest_v-B4BnRTa_-DR7WQTT5.js +90 -0
  80. package/dist/web/server/agent-activity-Dx6AlDhN-JXOL2EXK.js +514 -0
  81. package/dist/web/server/{artifacts-panel-D9w1DHAN-FGRDCYU2.js → artifacts-panel-CloS3-ij-XWYXKL6A.js} +30 -22
  82. package/dist/web/server/{chat-command-palette-BaenPkCN-BHSOPGU4.js → chat-command-palette-Cc0uGvNm-GKENKTO7.js} +48 -22
  83. package/dist/web/server/{chunk-KPNGZR2R.js → chunk-3B6M63AO.js} +206 -209
  84. package/dist/web/server/chunk-3D4Z32XA.js +22 -0
  85. package/dist/web/server/chunk-3SSHBMDS.js +196 -0
  86. package/dist/web/server/chunk-4PQ6OD6J.js +22 -0
  87. package/dist/web/server/{chunk-5AVQZ4AZ.js → chunk-4UBOIY2S.js} +2 -1
  88. package/dist/web/server/chunk-56SEDI5N.js +19 -0
  89. package/dist/web/server/chunk-6QNW66XR.js +19 -0
  90. package/dist/web/server/chunk-744IIIDL.js +19 -0
  91. package/dist/web/server/{chunk-52SJQXO4.js → chunk-7PQTPSEE.js} +568 -568
  92. package/dist/web/server/{chunk-XYYNYFFD.js → chunk-7SR6WDM2.js} +2 -2
  93. package/dist/web/server/chunk-ANL4B775.js +60 -0
  94. package/dist/web/server/chunk-BNQWMQHD.js +35 -0
  95. package/dist/web/server/{chunk-X2TUFLTP.js → chunk-C5X6G26O.js} +436 -454
  96. package/dist/web/server/chunk-C66BSNA6.js +42 -0
  97. package/dist/web/server/{chunk-3GSFXWL5.js → chunk-DEUBJJZN.js} +4 -59
  98. package/dist/web/server/chunk-E365EOXJ.js +35 -0
  99. package/dist/web/server/{chunk-5WZFFNFY.js → chunk-EFAGCVZ3.js} +2 -23
  100. package/dist/web/server/{chunk-Y6LJ4WBI.js → chunk-EGQ6ZX4D.js} +563 -830
  101. package/dist/web/server/{chunk-DO3TVNGA.js → chunk-EKBKGAWX.js} +12 -10
  102. package/dist/web/server/{chunk-RPROZ2JC.js → chunk-F6MGAW3L.js} +133 -133
  103. package/dist/web/server/chunk-GABXCOY3.js +37 -0
  104. package/dist/web/server/chunk-GV7DJIHY.js +36 -0
  105. package/dist/web/server/{chunk-PWK2HJIV.js → chunk-HSJMLO36.js} +5 -252
  106. package/dist/web/server/{chunk-46VQY7SG.js → chunk-HU4AIJV3.js} +4 -4
  107. package/dist/web/server/{chunk-H64JLONZ.js → chunk-HZY3LBGP.js} +146 -2
  108. package/dist/web/server/{chunk-3IKSPTYI.js → chunk-J6MRJXUH.js} +22 -15
  109. package/dist/web/server/{chunk-FE4KN6T2.js → chunk-JOSTE7WK.js} +7 -5
  110. package/dist/web/server/{chunk-QJBEWT4E.js → chunk-K3BXQG3N.js} +27 -292
  111. package/dist/web/server/chunk-K4ESBQ3R.js +20 -0
  112. package/dist/web/server/chunk-KOIPYBJF.js +3773 -0
  113. package/dist/web/server/{chunk-44IVTHDV.js → chunk-KZSM3BHO.js} +28 -119
  114. package/dist/web/server/chunk-L46H6IDX.js +13 -0
  115. package/dist/web/server/chunk-LNGWHEE6.js +206 -0
  116. package/dist/web/server/{chunk-2U7PWSJX.js → chunk-MOSVTKH5.js} +262 -3661
  117. package/dist/web/server/{chunk-MDYA4NXK.js → chunk-NJRYX4A2.js} +4 -4
  118. package/dist/web/server/chunk-NNMZQN7Q.js +296 -0
  119. package/dist/web/server/{chunk-VHCAD46L.js → chunk-NPPG2GTW.js} +7 -7
  120. package/dist/web/server/{chunk-AZZHUVJR.js → chunk-PJNYH5SR.js} +7 -303
  121. package/dist/web/server/{chunk-7APYEQIO.js → chunk-QAE5SXDK.js} +1 -24
  122. package/dist/web/server/chunk-QTFCJGOY.js +189 -0
  123. package/dist/web/server/{chunk-FBOO3G67.js → chunk-RANJ6OJ3.js} +9 -9
  124. package/dist/web/server/chunk-RPBSDXJ4.js +62 -0
  125. package/dist/web/server/{chunk-PCJ5EKFE.js → chunk-RYHIJMFD.js} +63 -34
  126. package/dist/web/server/{chunk-NLIUTTKL.js → chunk-S3PQ6HKH.js} +1 -16
  127. package/dist/web/server/chunk-SG4W4SPQ.js +31 -0
  128. package/dist/web/server/{chunk-LESNF5O4.js → chunk-T23OO4SC.js} +2 -11
  129. package/dist/web/server/{chunk-FVWDJNXR.js → chunk-UNZJQ7CY.js} +6 -4
  130. package/dist/web/server/chunk-V3S6BVXO.js +22 -0
  131. package/dist/web/server/{chunk-M2FGGPNA.js → chunk-VGDP4YDU.js} +70 -45
  132. package/dist/web/server/{chunk-WK7CQS2N.js → chunk-W5GRNHV5.js} +51 -49
  133. package/dist/web/server/{chunk-HBZ6YKRB.js → chunk-WN77JNYY.js} +2 -2
  134. package/dist/web/server/{chunk-B2F6MLVZ.js → chunk-XFVL5ITL.js} +2246 -2228
  135. package/dist/web/server/{chunk-EIVNRYP3.js → chunk-XKYEXPLQ.js} +2 -17
  136. package/dist/web/server/{chunk-6GMKRR3C.js → chunk-XNYQSCB2.js} +2 -2
  137. package/dist/web/server/chunk-YHXAXJ6I.js +22 -0
  138. package/dist/web/server/chunk-YLMXYMLG.js +86 -0
  139. package/dist/web/server/chunk-YNGDUWCF.js +56 -0
  140. package/dist/web/server/chunk-ZJFA4F5X.js +280 -0
  141. package/dist/web/server/fleet-message-queue-Bn0_3Efe-G4BZR2EU.js +74 -0
  142. package/dist/web/server/fleet-pi-tool-renderer-C52SZmPx-CIAH3IV7.js +51 -0
  143. package/dist/web/server/fleet-reasoning-panel-C_e7wzVm-SDHEWDQT.js +199 -0
  144. package/dist/web/server/fleet-subagent-list-CQltKswG-EKCMQHDI.js +18 -0
  145. package/dist/web/server/fleet-tool-timeline-KENErMKg-HTN7SW3D.js +16 -0
  146. package/dist/web/server/{fork-picker-dialog-BZzfxdQd-Y725VJ7G.js → fork-picker-dialog-DK9YGQuB-4QEFWRU4.js} +6 -5
  147. package/dist/web/server/{markdown-Boni3lHk-AZGKDNAR.js → markdown-QcSUaLyd-6DJUK5NC.js} +1 -1
  148. package/dist/web/server/{markdown-code-BrWukbg3-D2GN4Y77.js → markdown-code-Dyo1_13a-52ZQZSPE.js} +2 -2
  149. package/dist/web/server/model-selector-list-CEfWjRc--GBW2GUO6.js +289 -0
  150. package/dist/web/server/{openui-renderer-Cg4RSE9k-7BTJIYZJ.js → openui-renderer-Dk0Ak9cW-MUJQHDAS.js} +19 -16
  151. package/dist/web/server/prompt-suggestions-BOmHi4-J-C563CHFU.js +30 -0
  152. package/dist/web/server/{repl-panel-BEQrC2ef-V3YEZ7EO.js → repl-panel-D9E8nkQy-L45ZNG2V.js} +4 -3
  153. package/dist/web/server/{resources-panel-CwKh4U9f-D3VDEMDW.js → resources-panel-B03M8bEp-SZG726N5.js} +7 -6
  154. package/dist/web/server/{router-CEahIUpn-SRG7XKIH.js → router-BE9HcX2W-JMQ3JWE5.js} +1756 -1374
  155. package/dist/web/server/{routes-BznemByz-F4DJAYIM.js → routes-CJTRGB1Z-WJKXJFFT.js} +3748 -3955
  156. package/dist/web/server/server.js +3 -3
  157. package/dist/web/server/{session-insights-panel-JfeTHE0d-3HZB3ZWI.js → session-insights-panel-BHZyKDTo-LRMAMA3O.js} +4 -2
  158. package/dist/web/server/{settings-dialog-DgeBMORv-7SRSENPM.js → settings-dialog-yDibpbBH-TCLJ7NRJ.js} +172 -161
  159. package/dist/web/server/{start-CLAD7RcD-56S4BWMM.js → start-BYVnok_H-IA6TWGA3.js} +1 -1
  160. package/dist/web/server/subagent-chat-panel-B1YoZIKO-DFRUDQJ2.js +82 -0
  161. package/dist/web/server/subagents-panel-dJJwpsEL-FTWWCHND.js +200 -0
  162. package/dist/web/server/{workspace-panel-y54P79_B-VPIYUXF6.js → workspace-panel-BC_H8Jri-5MHAEQQS.js} +22 -18
  163. package/package.json +5 -5
  164. package/dist/web/client/assets/analytics-stub-Jh3lkb8P.js +0 -1
  165. package/dist/web/client/assets/button-0At5xSyU.js +0 -1
  166. package/dist/web/client/assets/chat-command-palette-C4sSf8Kg.js +0 -1
  167. package/dist/web/client/assets/collapsible-DmyYcezk.js +0 -1
  168. package/dist/web/client/assets/command-CB6emP8m.js +0 -2
  169. package/dist/web/client/assets/conversation-turns-ByFoWPXe.js +0 -6
  170. package/dist/web/client/assets/dialog-DZ44tBtH.js +0 -1
  171. package/dist/web/client/assets/dist-MNgIFxqY.js +0 -41
  172. package/dist/web/client/assets/ease-vFBiNFNK.js +0 -9
  173. package/dist/web/client/assets/file-text-BhQ0ZnoU.js +0 -1
  174. package/dist/web/client/assets/globals-CqqQdk2S.css +0 -2
  175. package/dist/web/client/assets/horizontal-resize-C1TpRLNC.js +0 -1
  176. package/dist/web/client/assets/index-DweoFRMs.js +0 -12
  177. package/dist/web/client/assets/input-CqC82Agz.js +0 -1
  178. package/dist/web/client/assets/input-group-H0TG-mkU.js +0 -1
  179. package/dist/web/client/assets/notify-Duj26eeZ.js +0 -1
  180. package/dist/web/client/assets/provider-catalog-BZhZuKSz.js +0 -1
  181. package/dist/web/client/assets/provider-label-jKm8v18u.js +0 -1
  182. package/dist/web/client/assets/range-vSJ7Ux_5.js +0 -2
  183. package/dist/web/client/assets/repl-panel-DiGS6uCw.js +0 -1
  184. package/dist/web/client/assets/resources-panel-DSU7VGX2.js +0 -1
  185. package/dist/web/client/assets/routes-CxlNCi_v.js +0 -16
  186. package/dist/web/client/assets/safe-external-url-Bl_78dpZ.js +0 -1
  187. package/dist/web/client/assets/session-insights-panel-DwmwiikS.js +0 -1
  188. package/dist/web/client/assets/settings-dialog-CkfpTKfM.js +0 -1
  189. package/dist/web/client/assets/subagents-panel-DGnsK6Nx.js +0 -1
  190. package/dist/web/client/assets/switch-BFEBpUEU.js +0 -1
  191. package/dist/web/client/assets/toast-C4s7FYYa.js +0 -1
  192. package/dist/web/client/assets/tool-result-CBzwwUE9.js +0 -4
  193. package/dist/web/client/assets/useBaseUiId-B9f7fokB.js +0 -1
  194. package/dist/web/client/assets/useControlled-CoY1jSuL.js +0 -1
  195. package/dist/web/client/assets/workspace-panel-CjdXlEvd.js +0 -1
  196. package/dist/web/client/assets/x-BgciQ7_C.js +0 -1
  197. package/dist/web/server/_tanstack-start-manifest_v-bDUlyKY0-KFW35JRO.js +0 -82
  198. package/dist/web/server/chunk-ZEVZFLIY.js +0 -334
  199. package/dist/web/server/fleet-pi-tool-renderer-lJvZWmBJ-4M5YI6VS.js +0 -35
  200. package/dist/web/server/subagents-panel-CzZe3co7-2VZ5JTWF.js +0 -332
@@ -10,11 +10,9 @@ import {
10
10
  QueryClient,
11
11
  QueryClientProvider,
12
12
  domAnimation,
13
+ initAnalytics,
13
14
  isServer
14
- } from "./chunk-H64JLONZ.js";
15
- import {
16
- redactSessionLabelSecrets
17
- } from "./chunk-QK4CHLVV.js";
15
+ } from "./chunk-HZY3LBGP.js";
18
16
  import {
19
17
  DEFAULT_UI_PREFERENCES,
20
18
  isModelPatternEnabled,
@@ -22,20 +20,24 @@ import {
22
20
  } from "./chunk-54II5QXQ.js";
23
21
  import {
24
22
  Toaster
25
- } from "./chunk-WK7CQS2N.js";
23
+ } from "./chunk-W5GRNHV5.js";
24
+ import {
25
+ redactSessionLabelSecrets
26
+ } from "./chunk-QK4CHLVV.js";
27
+ import "./chunk-PKCTG7EW.js";
26
28
  import {
27
29
  drag,
28
30
  layout
29
31
  } from "./chunk-FAGDMGLK.js";
30
- import "./chunk-PKCTG7EW.js";
31
32
  import {
32
33
  Card,
33
34
  CardContent,
34
35
  CardDescription,
35
36
  CardHeader,
36
37
  CardTitle,
38
+ generatePrompt,
37
39
  validateAndNormalizeOpenUIHtmlArtifact
38
- } from "./chunk-ZEVZFLIY.js";
40
+ } from "./chunk-KOIPYBJF.js";
39
41
  import {
40
42
  ChatNewRequestSchema,
41
43
  ChatOpenUIArtifactUpsertRequestSchema,
@@ -54,7 +56,7 @@ import {
54
56
  SessionIdSchema,
55
57
  UploadedAttachmentSchema,
56
58
  external_exports
57
- } from "./chunk-B2F6MLVZ.js";
59
+ } from "./chunk-XFVL5ITL.js";
58
60
  import {
59
61
  KNOWN_PROVIDERS,
60
62
  OPENAI_CHAT_COMPLETIONS_PROVIDER_ID,
@@ -69,8 +71,9 @@ import {
69
71
  toInstanceSlug,
70
72
  toOccInstanceId
71
73
  } from "./chunk-RJOANOT4.js";
72
- import "./chunk-RPROZ2JC.js";
73
- import "./chunk-X2TUFLTP.js";
74
+ import "./chunk-F6MGAW3L.js";
75
+ import "./chunk-YHXAXJ6I.js";
76
+ import "./chunk-C5X6G26O.js";
74
77
  import "./chunk-E26EAQIM.js";
75
78
  import "./chunk-DJMHPJBP.js";
76
79
  import {
@@ -86,7 +89,7 @@ import "./chunk-JDCCC7A7.js";
86
89
  import "./chunk-L547YHC4.js";
87
90
  import "./chunk-MLKGABMK.js";
88
91
 
89
- // web/app/dist/server/assets/router-CEahIUpn.js
92
+ // web/app/dist/server/assets/router-BE9HcX2W.js
90
93
  import { useEffect, useLayoutEffect } from "react";
91
94
  import { jsx, jsxs } from "react/jsx-runtime";
92
95
  import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
@@ -120,7 +123,7 @@ function NotFoundPage({ title = "404", description = "The requested page could n
120
123
  })
121
124
  });
122
125
  }
123
- var globals_default = "/assets/globals-CqqQdk2S.css";
126
+ var globals_default = "/assets/globals-Bfr0jrPq.css";
124
127
  function makeQueryClient() {
125
128
  return new QueryClient({ defaultOptions: { queries: {
126
129
  staleTime: 6e4,
@@ -172,10 +175,11 @@ function RootComponent() {
172
175
  document.documentElement.classList.toggle("reduce-motion", preferences.motion === "reduced");
173
176
  }, []);
174
177
  useEffect(() => {
178
+ initAnalytics();
175
179
  }, []);
176
- return /* @__PURE__ */ jsx(MotionRuntime, { children: /* @__PURE__ */ jsx(QueryClientProvider, {
180
+ return /* @__PURE__ */ jsx(MotionRuntime, { children: /* @__PURE__ */ jsxs(QueryClientProvider, {
177
181
  client: getQueryClient(),
178
- children: /* @__PURE__ */ jsx(Outlet, {})
182
+ children: [/* @__PURE__ */ jsx(Outlet, {}), null]
179
183
  }) });
180
184
  }
181
185
  function RootDocument({ children }) {
@@ -189,7 +193,7 @@ function RootDocument({ children }) {
189
193
  ] })]
190
194
  });
191
195
  }
192
- var $$splitComponentImporter = () => import("./routes-BznemByz-F4DJAYIM.js");
196
+ var $$splitComponentImporter = () => import("./routes-CJTRGB1Z-WJKXJFFT.js");
193
197
  var Route$26 = createFileRoute("/")({ component: lazyRouteComponent($$splitComponentImporter, "component") });
194
198
  var ManagedAttachmentValidationError = class extends Error {
195
199
  status;
@@ -336,639 +340,6 @@ function sessionCommandResultText(command, presentation, initialRefinementCount)
336
340
  if (command.name === "goal") return presentation.goal?.objective ? `Goal ${presentation.goal.status}: ${presentation.goal.objective}` : "No active goal.";
337
341
  return `/${command.name} completed.`;
338
342
  }
339
- function resolveField(obj, path) {
340
- if (!path || obj == null) return void 0;
341
- if (!path.includes(".")) return obj[path];
342
- let cur = obj;
343
- for (const p of path.split(".")) {
344
- if (cur == null) return void 0;
345
- cur = cur[p];
346
- }
347
- return cur;
348
- }
349
- function toNumber(val) {
350
- if (typeof val === "number") return val;
351
- if (typeof val === "string") {
352
- const n = Number(val);
353
- return isNaN(n) ? 0 : n;
354
- }
355
- if (typeof val === "boolean") return val ? 1 : 0;
356
- return 0;
357
- }
358
- var BUILTINS = {
359
- Count: {
360
- name: "Count",
361
- signature: "Count(array) \u2192 number",
362
- description: "Returns array length",
363
- fn: (arr) => Array.isArray(arr) ? arr.length : 0
364
- },
365
- First: {
366
- name: "First",
367
- signature: "First(array) \u2192 element",
368
- description: "Returns first element of array",
369
- fn: (arr) => Array.isArray(arr) ? arr[0] ?? null : null
370
- },
371
- Last: {
372
- name: "Last",
373
- signature: "Last(array) \u2192 element",
374
- description: "Returns last element of array",
375
- fn: (arr) => Array.isArray(arr) ? arr[arr.length - 1] ?? null : null
376
- },
377
- Sum: {
378
- name: "Sum",
379
- signature: "Sum(numbers[]) \u2192 number",
380
- description: "Sum of numeric array",
381
- fn: (arr) => Array.isArray(arr) ? arr.reduce((a, b) => a + toNumber(b), 0) : 0
382
- },
383
- Avg: {
384
- name: "Avg",
385
- signature: "Avg(numbers[]) \u2192 number",
386
- description: "Average of numeric array",
387
- fn: (arr) => Array.isArray(arr) && arr.length ? arr.reduce((a, b) => a + toNumber(b), 0) / arr.length : 0
388
- },
389
- Min: {
390
- name: "Min",
391
- signature: "Min(numbers[]) \u2192 number",
392
- description: "Minimum value in array",
393
- fn: (arr) => Array.isArray(arr) && arr.length ? arr.reduce((acc, b) => Math.min(acc, toNumber(b)), toNumber(arr[0])) : 0
394
- },
395
- Max: {
396
- name: "Max",
397
- signature: "Max(numbers[]) \u2192 number",
398
- description: "Maximum value in array",
399
- fn: (arr) => Array.isArray(arr) && arr.length ? arr.reduce((acc, b) => Math.max(acc, toNumber(b)), toNumber(arr[0])) : 0
400
- },
401
- Sort: {
402
- name: "Sort",
403
- signature: "Sort(array, field, direction?) \u2192 sorted array",
404
- description: 'Sort array by field. Direction: "asc" (default) or "desc"',
405
- fn: (arr, field, dir) => {
406
- if (!Array.isArray(arr)) return arr;
407
- const f = String(field ?? "");
408
- const desc = String(dir ?? "asc") === "desc";
409
- return [...arr].sort((a, b) => {
410
- const av = f ? resolveField(a, f) : a;
411
- const bv = f ? resolveField(b, f) : b;
412
- const aIsNumeric = typeof av === "number" || typeof av === "string" && !isNaN(Number(av)) && av !== "";
413
- const bIsNumeric = typeof bv === "number" || typeof bv === "string" && !isNaN(Number(bv)) && bv !== "";
414
- if (aIsNumeric && bIsNumeric) {
415
- const diff = toNumber(av) - toNumber(bv);
416
- return desc ? -diff : diff;
417
- }
418
- const cmp = String(av ?? "").localeCompare(String(bv ?? ""));
419
- return desc ? -cmp : cmp;
420
- });
421
- }
422
- },
423
- Filter: {
424
- name: "Filter",
425
- signature: 'Filter(array, field, operator: "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains", value) \u2192 filtered array',
426
- description: "Filter array by field value",
427
- fn: (arr, field, op, value) => {
428
- if (!Array.isArray(arr)) return [];
429
- const f = String(field ?? "");
430
- const o = String(op ?? "==");
431
- return arr.filter((item) => {
432
- const v = f ? resolveField(item, f) : item;
433
- switch (o) {
434
- case "==":
435
- return v == value;
436
- case "!=":
437
- return v != value;
438
- case ">":
439
- return toNumber(v) > toNumber(value);
440
- case "<":
441
- return toNumber(v) < toNumber(value);
442
- case ">=":
443
- return toNumber(v) >= toNumber(value);
444
- case "<=":
445
- return toNumber(v) <= toNumber(value);
446
- case "contains":
447
- return String(v ?? "").includes(String(value ?? ""));
448
- default:
449
- return false;
450
- }
451
- });
452
- }
453
- },
454
- Round: {
455
- name: "Round",
456
- signature: "Round(number, decimals?) \u2192 number",
457
- description: "Round to N decimal places (default 0)",
458
- fn: (n, decimals) => {
459
- const num = toNumber(n);
460
- const d = decimals != null ? toNumber(decimals) : 0;
461
- const factor = Math.pow(10, d);
462
- return Math.round(num * factor) / factor;
463
- }
464
- },
465
- Abs: {
466
- name: "Abs",
467
- signature: "Abs(number) \u2192 number",
468
- description: "Absolute value",
469
- fn: (n) => Math.abs(toNumber(n))
470
- },
471
- Floor: {
472
- name: "Floor",
473
- signature: "Floor(number) \u2192 number",
474
- description: "Round down to nearest integer",
475
- fn: (n) => Math.floor(toNumber(n))
476
- },
477
- Ceil: {
478
- name: "Ceil",
479
- signature: "Ceil(number) \u2192 number",
480
- description: "Round up to nearest integer",
481
- fn: (n) => Math.ceil(toNumber(n))
482
- }
483
- };
484
- var LAZY_BUILTINS = /* @__PURE__ */ new Set(["Each"]);
485
- var LAZY_BUILTIN_DEFS = { Each: {
486
- signature: "Each(array, varName, template)",
487
- description: "Evaluate template for each element. varName is the loop variable \u2014 use it ONLY inside the template expression (inline). Do NOT create a separate statement for the template."
488
- } };
489
- var ACTION_NAMES = /* @__PURE__ */ new Set(["Action", ...Object.keys({
490
- Run: "run",
491
- ToAssistant: "continue_conversation",
492
- OpenUrl: "open_url",
493
- Set: "set",
494
- Reset: "reset"
495
- })]);
496
- [
497
- ...Object.keys(BUILTINS),
498
- ...LAZY_BUILTINS,
499
- ...ACTION_NAMES
500
- ];
501
- function jsonSchemaTypeStr(schema) {
502
- const type = schema.type;
503
- if (type === "string") {
504
- const enumVals = schema.enum;
505
- if (enumVals) return enumVals.map((v) => `"${v}"`).join(" | ");
506
- return "string";
507
- }
508
- if (type === "number" || type === "integer") return "number";
509
- if (type === "boolean") return "boolean";
510
- if (type === "array") {
511
- const items = schema.items;
512
- if (items) return `${jsonSchemaTypeStr(items)}[]`;
513
- return "any[]";
514
- }
515
- if (type === "object") {
516
- const props = schema.properties;
517
- if (props && Object.keys(props).length > 0) {
518
- const required = schema.required ?? [];
519
- return `{${Object.entries(props).map(([k, v]) => {
520
- return `${k}${required.includes(k) ? "" : "?"}: ${jsonSchemaTypeStr(v)}`;
521
- }).join(", ")}}`;
522
- }
523
- return "object";
524
- }
525
- return "any";
526
- }
527
- function defaultForSchema(schema) {
528
- const type = schema.type;
529
- if (type === "string") return "";
530
- if (type === "number" || type === "integer") return 0;
531
- if (type === "boolean") return false;
532
- if (type === "array") return [];
533
- if (type === "object") {
534
- const props = schema.properties;
535
- if (props && Object.keys(props).length > 0) {
536
- const result = {};
537
- for (const [k, v] of Object.entries(props)) result[k] = defaultForSchema(v);
538
- return result;
539
- }
540
- return {};
541
- }
542
- return null;
543
- }
544
- var PREAMBLE = `You are an AI assistant that responds using openui-lang, a declarative UI language. Your ENTIRE response must be valid openui-lang code \u2014 no markdown, no explanations, just openui-lang.`;
545
- function syntaxRules(rootName, flags) {
546
- const lines = [
547
- "## Syntax Rules",
548
- "",
549
- "1. Each statement is on its own line: `identifier = Expression`",
550
- `2. \`root\` is the entry point \u2014 every program must define \`root = ${rootName}(...)\``,
551
- '3. Expressions are: strings ("..."), numbers, booleans (true/false), null, arrays ([...]), objects ({...}), or component calls TypeName(arg1, arg2, ...)',
552
- "4. Use references for readability: define `name = ...` on one line, then use `name` later",
553
- "5. EVERY variable (except root) MUST be referenced by at least one other variable. Unreferenced variables are silently dropped and will NOT render. Always include defined variables in their parent's children/items array.",
554
- '6. Arguments are POSITIONAL (order matters, not names). Write `Stack([children], "row", "l")` NOT `Stack([children], direction: "row", gap: "l")` \u2014 colon syntax is NOT supported and silently breaks',
555
- "7. Optional arguments can be omitted from the end"
556
- ];
557
- let ruleNum = 8;
558
- if (flags.bindings) lines.push(`${ruleNum++}. Declare mutable state with \`$varName = defaultValue\`. Components marked with \`$binding\` can read/write these. Undeclared $variables are auto-created with null default.`);
559
- if (flags.supportsExpressions) lines.push(`${ruleNum++}. String concatenation: \`"text" + $var + "more"\``, `${ruleNum++}. Dot member access: \`query.field\` reads a field; on arrays it extracts that field from every element`, `${ruleNum++}. Index access: \`arr[0]\`, \`data[index]\``, `${ruleNum++}. Arithmetic operators: +, -, *, /, % (work on numbers; + is string concat when either side is a string)`, `${ruleNum++}. Comparison: ==, !=, >, <, >=, <=`, `${ruleNum++}. Logical: &&, ||, ! (prefix)`, `${ruleNum++}. Ternary: \`condition ? valueIfTrue : valueIfFalse\``, `${ruleNum++}. Parentheses for grouping: \`(a + b) * c\``);
560
- lines.push("- Strings use double quotes with backslash escaping");
561
- return lines.join("\n");
562
- }
563
- function builtinFunctionsSection() {
564
- const builtinLines = Object.values(BUILTINS).map((b) => `@${b.signature} \u2014 ${b.description}`);
565
- const lazyLines = Object.values(LAZY_BUILTIN_DEFS).map((b) => `@${b.signature} \u2014 ${b.description}`);
566
- return `## Built-in Functions
567
-
568
- Data functions prefixed with \`@\` to distinguish from components. These are the ONLY functions available \u2014 do NOT invent new ones.
569
- Use @-prefixed built-in functions (@Count, @Sum, @Avg, @Min, @Max, @Round) on Query results \u2014 do NOT hardcode computed values.
570
-
571
- ${[...builtinLines, ...lazyLines].join("\n")}
572
-
573
- Builtins compose \u2014 output of one is input to the next:
574
- \`@Count(@Filter(data.rows, "field", "==", "val"))\` for KPIs/chart values, \`@Round(@Avg(data.rows.score), 1)\`, \`@Each(data.rows, "item", Comp(item.field))\` for per-item rendering.
575
- Array pluck: \`data.rows.field\` extracts a field from every row \u2192 use with @Sum, @Avg, charts, tables.
576
-
577
- IMPORTANT @Each rule: The loop variable (e.g. "item") is ONLY available inside the @Each template expression. Always inline the template \u2014 do NOT extract it to a separate statement.
578
- CORRECT: \`Col("Actions", @Each(rows, "t", Button("Edit", Action([@Set($id, t.id)]))))\`
579
- WRONG: \`myBtn = Button("Edit", Action([@Set($id, t.id)]))\` then \`Col("Actions", @Each(rows, "t", myBtn))\` \u2014 t is undefined in myBtn.`;
580
- }
581
- function querySection() {
582
- return `## Query \u2014 Live Data Fetching
583
-
584
- Fetch data from available tools. Returns defaults instantly, swaps in real data when it arrives.
585
-
586
- \`\`\`
587
- metrics = Query("tool_name", {arg1: value, arg2: $binding}, {defaultField: 0, defaultData: []}, refreshInterval?)
588
- \`\`\`
589
-
590
- - First arg: tool name (string)
591
- - Second arg: arguments object (may reference $bindings \u2014 re-fetches automatically on change)
592
- - Third arg: default data (rendered immediately before fetch resolves)
593
- - Fourth arg (optional): refresh interval in seconds (e.g. 30 for auto-refresh every 30s)
594
- - Use dot access on results: metrics.totalEvents, metrics.data.day (array pluck)
595
- - Query results must use regular identifiers: \`metrics = Query(...)\`, NOT \`$metrics = Query(...)\`
596
- - Manual refresh: \`Button("Refresh", Action([@Run(query1), @Run(query2)]), "secondary")\` \u2014 re-fetches the listed queries
597
- - Refresh all queries: create Action with @Run for each query`;
598
- }
599
- function mutationSection() {
600
- return `## Mutation \u2014 Write Operations
601
-
602
- Execute state-changing tool calls (create, update, delete). Unlike Query (auto-fetches on render), Mutation fires only on button click via Action.
603
-
604
- \`\`\`
605
- result = Mutation("tool_name", {arg1: $binding, arg2: "value"})
606
- \`\`\`
607
-
608
- - First arg: tool name (string)
609
- - Second arg: arguments object (evaluated with current $binding values at click time)
610
- - result.status: "idle" | "loading" | "success" | "error"
611
- - result.data: tool response on success
612
- - result.error: error message on failure
613
- - Mutation results use regular identifiers: \`result = Mutation(...)\`, NOT \`$result\`
614
- - Show loading state: \`result.status == "loading" ? TextContent("Saving...") : null\``;
615
- }
616
- function actionSection(flags) {
617
- const steps = ['- @ToAssistant("message") \u2014 Send a message to the assistant (for conversational buttons like "Tell me more", "Explain this")', '- @OpenUrl("https://...") \u2014 Navigate to a URL'];
618
- if (flags.bindings) steps.push("- @Set($variable, value) \u2014 Set a $variable to a specific value", '- @Reset($var1, $var2, ...) \u2014 Reset $variables to their declared defaults (e.g. @Reset($title, $priority) restores $title="" and $priority="medium")');
619
- if (flags.toolCalls) steps.unshift("- @Run(queryOrMutationRef) \u2014 Execute a Mutation or re-fetch a Query (ref must be a declared Query/Mutation)");
620
- const examples = [];
621
- if (flags.toolCalls) examples.push(`Example \u2014 mutation + refresh + reset (PREFERRED pattern):
622
- \`\`\`
623
- $binding = "default"
624
- result = Mutation("tool_name", {field: $binding})
625
- data = Query("tool_name", {}, {rows: []})
626
- onSubmit = Action([@Run(result), @Run(data), @Reset($binding)])
627
- \`\`\``);
628
- examples.push(`Example \u2014 simple nav:
629
- \`\`\`
630
- viewBtn = Button("View", Action([@OpenUrl("https://example.com")]))
631
- \`\`\``);
632
- const rules = ['- Action can be assigned to a variable or inlined: Button("Go", onSubmit) and Button("Go", Action([...])) both work'];
633
- if (flags.toolCalls) rules.push("- If a @Run(mutation) step fails, remaining steps are skipped (halt on failure)", "- @Run(queryRef) re-fetches the query (fire-and-forget, cannot fail)");
634
- return `## Action \u2014 Button Behavior
635
-
636
- Action([@steps...]) wires button clicks to operations. Steps are @-prefixed built-in actions. Steps execute in order.
637
- Buttons without an explicit Action prop automatically send their label to the assistant (equivalent to Action([@ToAssistant(label)])).
638
-
639
- Available steps:
640
- ${steps.join("\n")}
641
-
642
- ${examples.join("\n\n")}
643
-
644
- ${rules.join("\n")}`;
645
- }
646
- function interactiveFiltersSection() {
647
- return `## Interactive Filters
648
-
649
- To let the user filter data with a dropdown:
650
- 1. Declare a $variable with a default: \`$dateRange = "14"\`
651
- 2. Create a Select with name, items, and binding: \`Select("dateRange", [SelectItem("7", "Last 7 days"), ...], null, null, $dateRange)\`
652
- 3. Wrap in FormControl for a label: \`FormControl("Date Range", Select(...))\`
653
- 4. Pass $dateRange in Query args: \`Query("tool", {dateRange: $dateRange}, {defaults})\`
654
- 5. When the user changes the Select, $dateRange updates and the Query automatically re-fetches
655
-
656
- FILTER WIRING RULE: If a $binding filter is visible in the UI, EVERY relevant Query MUST reference that $binding in its args. Never show a filter dropdown while hardcoding the query args.
657
-
658
- Rules for $variables:
659
- - $variables hold simple values (strings or numbers), NOT arrays or objects
660
- - $variables must be bound to a Select/Input component via the value argument (last positional arg) to be interactive
661
- - Queries must use regular identifiers (NOT $variables): \`metrics = Query(...)\` not \`$metrics = Query(...)\`
662
- - **Auto-declare**: You do NOT need to explicitly declare $variables. If you use \`$foo\` without declaring it, the parser auto-creates \`$foo = null\`. You can still declare explicitly to set a default: \`$days = "14"\`
663
-
664
- ## Forms
665
-
666
- Simple form \u2014 no $bindings needed. Field values are managed internally by the Form via the name prop:
667
- \`\`\`
668
- contactForm = Form("contact", submitBtn, [nameField, emailField])
669
- nameField = FormControl("Name", Input("name", "Your name", "text", {required: true}))
670
- emailField = FormControl("Email", Input("email", "your@email.com", "email", {required: true, email: true}))
671
- submitBtn = Button("Submit")
672
- \`\`\`
673
-
674
- Use $bindings when you need to read field values elsewhere (in Action context, Query args, or conditionals). They are auto-declared:
675
- \`\`\`
676
- $role = "engineer"
677
- contactForm = Form("contact", submitBtn, [nameField, emailField, roleField])
678
- nameField = FormControl("Name", Input("name", "Enter your name", "text", {required: true}, $name))
679
- emailField = FormControl("Email", Input("email", "Enter your email", "email", {required: true, email: true}, $email))
680
- roleField = FormControl("Role", Select("role", [SelectItem("engineer", "Engineer"), SelectItem("designer", "Designer"), SelectItem("pm", "PM")], null, {required: true}, $role))
681
- submitBtn = Button("Submit")
682
- \`\`\`
683
-
684
- For form + mutation patterns (create, refresh, reset), see the Action section example above.
685
-
686
- IMPORTANT: Always add validation rules to form fields used with Mutations. Use OBJECT syntax: {required: true, email: true, minLength: 8}. The renderer shows error messages automatically and blocks submit when validation fails.`;
687
- }
688
- function editModeSection() {
689
- return `## Edit Mode
690
-
691
- The runtime merges by statement name: same name = replace, new name = append.
692
- Output ONLY statements that changed or are new. Everything else is kept automatically.
693
-
694
- ### Delete
695
- To remove a component, update the parent to exclude it from its children array. Orphaned statements are automatically garbage-collected.
696
- Example \u2014 remove chart: \`root = Stack([header, kpiRow, table])\` \u2014 chart is no longer in the children list, so it and any statements only it referenced are auto-deleted.
697
-
698
- ### Patch size guide
699
- - Changing a title or label: 1 statement
700
- - Adding a component: 2-3 statements (the new component + parent update)
701
- - Removing a component: 1 statement (re-declare parent without the removed child)
702
- - Adding a filter + wiring to query: 3-5 statements
703
- - Restructuring into tabs: 5-10 statements
704
-
705
- ### Rules
706
- - Reuse existing statement names exactly \u2014 do not rename
707
- - Do NOT re-emit unchanged statements \u2014 the runtime keeps them
708
- - A typical edit patch is 1-10 statements, not 20+
709
- - If the existing code already satisfies the request, output only the root statement
710
- - NEVER output the entire program as a patch. Only output what actually changes
711
- - If you are about to output more than 10 statements, reconsider \u2014 most edits need fewer`;
712
- }
713
- function streamingRules(rootName, flags) {
714
- const steps = [`1. \`root = ${rootName}(...)\` \u2014 UI shell appears immediately`];
715
- if (flags.supportsExpressions) {
716
- steps.push("2. $variable declarations \u2014 state ready for bindings");
717
- steps.push("3. Query statements \u2014 defaults resolve immediately so components render with data");
718
- steps.push("4. Component definitions \u2014 fill in with data already available");
719
- steps.push("5. Data values \u2014 leaf content last");
720
- } else {
721
- steps.push("2. Component definitions \u2014 fill in as they stream");
722
- steps.push("3. Data values \u2014 leaf content last");
723
- }
724
- return `## Hoisting & Streaming (CRITICAL)
725
-
726
- openui-lang supports hoisting: a reference can be used BEFORE it is defined. The parser resolves all references after the full input is parsed.
727
-
728
- During streaming, the output is re-parsed on every chunk. Undefined references are temporarily unresolved and appear once their definitions stream in. This creates a progressive top-down reveal \u2014 structure first, then data fills in.
729
-
730
- **Recommended statement order for optimal streaming:**
731
- ${steps.join("\n")}
732
-
733
- Always write the root = ${rootName}(...) statement first so the UI shell appears immediately, even before child data has streamed in.`;
734
- }
735
- function inlineModeSection() {
736
- return `## Inline Mode
737
-
738
- You are in inline mode. You can respond in two ways:
739
-
740
- ### 1. Code response (when the user wants to CREATE or CHANGE the UI)
741
- Wrap openui-lang code in triple-backtick fences. You can include explanatory text before/after:
742
-
743
- Here's your dashboard:
744
-
745
- \`\`\`openui-lang
746
- root = RootComp([header, content])
747
- header = SomeHeader("Title")
748
- content = SomeContent("Hello world")
749
- \`\`\`
750
-
751
- I created a simple layout with a header.
752
-
753
- ### 2. Text-only response (when the user asks a QUESTION)
754
- If the user asks "what is this?", "explain the chart", "how does this work", etc. \u2014 respond with plain text. Do NOT output any openui-lang code. The existing dashboard stays unchanged.
755
-
756
- ### Rules
757
- - When the user asks for changes, output ONLY the changed/new statements in a fenced block
758
- - When the user asks a question, respond with text only \u2014 NO code. The dashboard stays unchanged.
759
- - The parser extracts code from fences automatically. Text outside fences is shown as chat.`;
760
- }
761
- function toolWorkflowSection() {
762
- return `## Data Workflow
763
-
764
- When tools are available, follow this workflow:
765
- 1. FIRST: Call the most relevant tool to inspect the real data shape before generating code
766
- 2. Use Query() for READ operations (data that should stay live) \u2014 NEVER hardcode tool results as literal arrays or objects
767
- 3. Use Mutation() for WRITE operations (create, update, delete) \u2014 triggered by button clicks via Action([@Run(mutationRef)])
768
- 4. Use the real data from step 1 as condensed Query defaults (3-5 rows) so the UI renders immediately
769
- 5. Use @-prefixed builtins (@Count, @Filter, @Sort, @Sum) on Query results for KPIs and aggregations \u2014 the runtime evaluates these live on every refresh
770
- 6. Hardcoded arrays are ONLY for static display data (labels, options) where no tool exists
771
-
772
- WRONG \u2014 you called a tool and got data back, but you inlined the results:
773
- \`\`\`
774
- openCount = 2
775
- item1 = SomeComp("first item title")
776
- item2 = SomeComp("second item title")
777
- list = Stack([item1, item2])
778
- chart = SomeChart(["A", "B"], [12, 8])
779
- \`\`\`
780
- This is static \u2014 it shows stale data and won't update. Creating item1, item2, item3... manually is ALWAYS wrong when a tool exists.
781
-
782
- RIGHT \u2014 use Query() for live data, Mutation() for writes, @builtins to derive values:
783
- \`\`\`
784
- data = Query("tool_name", {}, {rows: []})
785
- openCount = @Count(@Filter(data.rows, "field", "==", "value"))
786
- list = @Each(data.rows, "item", SomeComp(item.title, item.field))
787
- createResult = Mutation("create_tool", {title: $title})
788
- submitBtn = Button("Create", Action([@Run(createResult), @Run(data), @Reset($title)]))
789
- \`\`\`
790
- Everything derives from the Query \u2014 when data refreshes, the entire dashboard updates automatically.`;
791
- }
792
- function importantRules(rootName, flags) {
793
- const verifyLines = [`1. root = ${rootName}(...) is the FIRST line (for optimal streaming).`, "2. Every referenced name is defined. Every defined name (other than root) is reachable from root."];
794
- if (flags.toolCalls) verifyLines.push("3. Every Query result is referenced by at least one component.");
795
- if (flags.bindings) verifyLines.push(`${flags.toolCalls ? "4" : "3"}. Every $binding appears in at least one component or expression.`);
796
- if (flags.toolCalls && flags.bindings) verifyLines.push("5. Every visible filter $binding appears in at least one Query args object.");
797
- return `## Important Rules
798
- - When asked about data, generate realistic/plausible data
799
- - Choose components that best represent the content (tables for comparisons, charts for trends, forms for input, etc.)
800
-
801
- ## Final Verification
802
- Before finishing, walk your output and verify:
803
- ${verifyLines.join("\n")}`;
804
- }
805
- function renderToolSignature(tool) {
806
- let args = "";
807
- if (tool.inputSchema) {
808
- const props = tool.inputSchema.properties;
809
- const required = tool.inputSchema.required ?? [];
810
- if (props && Object.keys(props).length > 0) args = Object.entries(props).map(([k, v]) => {
811
- return `${k}${required.includes(k) ? "" : "?"}: ${jsonSchemaTypeStr(v)}`;
812
- }).join(", ");
813
- }
814
- let returnType = "";
815
- if (tool.outputSchema) returnType = ` \u2192 ${jsonSchemaTypeStr(tool.outputSchema)}`;
816
- let line = `- ${tool.name}(${args})${returnType}`;
817
- if (tool.description) line += `
818
- ${tool.description}`;
819
- return line;
820
- }
821
- function renderToolsSection(tools) {
822
- const lines = [];
823
- const stringTools = [];
824
- const specTools = [];
825
- for (const tool of tools) if (typeof tool === "string") stringTools.push(tool);
826
- else specTools.push(tool);
827
- lines.push("## Available Tools");
828
- lines.push("");
829
- lines.push("Use these with Query() for read operations or Mutation() for write operations. The LLM decides which is appropriate based on the tool's purpose.");
830
- lines.push("");
831
- for (const t of stringTools) lines.push(`- ${t}`);
832
- for (const t of specTools) lines.push(renderToolSignature(t));
833
- const toolsWithOutput = specTools.filter((t) => t.outputSchema);
834
- if (toolsWithOutput.length > 0) {
835
- lines.push("");
836
- lines.push("### Default values for Query results");
837
- lines.push("");
838
- lines.push("Use these shapes as minimal Query defaults:");
839
- for (const t of toolsWithOutput) {
840
- const defaults = defaultForSchema(t.outputSchema);
841
- lines.push(`- ${t.name}: \`${JSON.stringify(defaults)}\``);
842
- }
843
- }
844
- lines.push("");
845
- lines.push("CRITICAL: Use ONLY the tools listed above in Query() and Mutation() calls. Do NOT invent or guess tool names. If the user asks for functionality that doesn't match any available tool, use realistic mock data instead of fabricating a tool call.");
846
- return lines.join("\n");
847
- }
848
- function generateComponentSignatures(spec, flags) {
849
- const lines = [
850
- "## Component Signatures",
851
- "",
852
- "Arguments marked with ? are optional. Sub-components can be inline or referenced; prefer references for better streaming."
853
- ];
854
- if (flags.usesActionExpression) {
855
- const allSteps = [
856
- flags.toolCalls ? "@Run" : "",
857
- "@ToAssistant",
858
- "@OpenUrl",
859
- flags.bindings ? "@Set" : "",
860
- flags.bindings ? "@Reset" : ""
861
- ].filter(Boolean);
862
- lines.push(`Props typed \`ActionExpression\` accept an Action([@steps...]) expression. See the Action section for available steps (${allSteps.join(", ")}).`);
863
- }
864
- if (flags.bindings || Object.values(spec.components).some((c) => c.signature?.includes("$binding"))) lines.push("Props marked `$binding<type>` accept a `$variable` reference for two-way binding.");
865
- const formatSig = (comp) => comp.description ? `${comp.signature} \u2014 ${comp.description}` : comp.signature;
866
- if (spec.componentGroups?.length) {
867
- const grouped = /* @__PURE__ */ new Set();
868
- for (const group of spec.componentGroups) {
869
- lines.push("", `### ${group.name}`);
870
- for (const name of group.components) {
871
- if (grouped.has(name)) continue;
872
- const comp = spec.components[name];
873
- if (!comp) continue;
874
- grouped.add(name);
875
- lines.push(formatSig(comp));
876
- }
877
- if (group.notes?.length) for (const note of group.notes) lines.push(note);
878
- }
879
- const ungrouped = Object.keys(spec.components).filter((n) => !grouped.has(n));
880
- if (ungrouped.length) {
881
- lines.push("", "### Other");
882
- for (const name of ungrouped) {
883
- const comp = spec.components[name];
884
- lines.push(formatSig(comp));
885
- }
886
- }
887
- } else {
888
- lines.push("");
889
- for (const [, comp] of Object.entries(spec.components)) lines.push(formatSig(comp));
890
- }
891
- return lines.join("\n");
892
- }
893
- function generatePrompt(spec) {
894
- const rootName = spec.root ?? "Root";
895
- const hasTools = !!spec.tools?.length;
896
- const toolCalls = spec.toolCalls ?? hasTools;
897
- const bindings = spec.bindings ?? toolCalls;
898
- const supportsExpressions = toolCalls || bindings;
899
- const usesActionExpression = Object.values(spec.components).some((c) => c.signature?.includes("ActionExpression"));
900
- const parts = [];
901
- parts.push(spec.preamble ?? PREAMBLE);
902
- parts.push("");
903
- parts.push(syntaxRules(rootName, {
904
- supportsExpressions,
905
- bindings
906
- }));
907
- parts.push("");
908
- parts.push(generateComponentSignatures(spec, {
909
- toolCalls,
910
- bindings,
911
- usesActionExpression
912
- }));
913
- if (supportsExpressions) {
914
- parts.push("");
915
- parts.push(builtinFunctionsSection());
916
- }
917
- if (toolCalls) {
918
- parts.push("");
919
- parts.push(querySection());
920
- parts.push("");
921
- parts.push(mutationSection());
922
- }
923
- if (usesActionExpression) {
924
- parts.push("");
925
- parts.push(actionSection({
926
- toolCalls,
927
- bindings
928
- }));
929
- }
930
- if (toolCalls && bindings) {
931
- parts.push("");
932
- parts.push(interactiveFiltersSection());
933
- }
934
- if (toolCalls) {
935
- parts.push("");
936
- parts.push(toolWorkflowSection());
937
- }
938
- if (spec.tools?.length) {
939
- parts.push("");
940
- parts.push(renderToolsSection(spec.tools));
941
- }
942
- parts.push("");
943
- parts.push(streamingRules(rootName, { supportsExpressions }));
944
- const allExamples = [...spec.examples ?? [], ...spec.toolExamples ?? []];
945
- if (allExamples.length) {
946
- parts.push("");
947
- parts.push("## Examples");
948
- parts.push("");
949
- for (const ex of allExamples) {
950
- parts.push(ex);
951
- parts.push("");
952
- }
953
- }
954
- if (spec.editMode) {
955
- parts.push("");
956
- parts.push(editModeSection());
957
- }
958
- if (spec.inlineMode) {
959
- parts.push("");
960
- parts.push(inlineModeSection());
961
- }
962
- parts.push(importantRules(rootName, {
963
- toolCalls,
964
- bindings
965
- }));
966
- if (spec.additionalRules?.length) {
967
- parts.push("");
968
- for (const rule of spec.additionalRules) parts.push(`- ${rule}`);
969
- }
970
- return parts.join("\n");
971
- }
972
343
  var openUIPromptSpec = {
973
344
  components: {
974
345
  Root: {
@@ -1911,6 +1282,28 @@ function buildOpenUIPrompt(mode, options) {
1911
1282
  editMode: false
1912
1283
  });
1913
1284
  }
1285
+ var CoalescingRefreshQueue = class {
1286
+ #inFlight = /* @__PURE__ */ new Map();
1287
+ #pending = /* @__PURE__ */ new Set();
1288
+ request(key, refresh) {
1289
+ this.#pending.add(key);
1290
+ if (this.#inFlight.has(key)) return;
1291
+ const run = (async () => {
1292
+ while (this.#pending.delete(key)) try {
1293
+ await refresh();
1294
+ } catch {
1295
+ }
1296
+ })();
1297
+ this.#inFlight.set(key, run);
1298
+ run.finally(() => {
1299
+ if (this.#inFlight.get(key) === run) this.#inFlight.delete(key);
1300
+ }).catch(() => void 0);
1301
+ }
1302
+ clear() {
1303
+ this.#inFlight.clear();
1304
+ this.#pending.clear();
1305
+ }
1306
+ };
1914
1307
  var defaultPersistence = {
1915
1308
  mkdir: (path, options) => mkdir(path, options),
1916
1309
  writeFile: (path, data, encoding) => writeFile(path, data, encoding),
@@ -3069,6 +2462,15 @@ function extractToolErrorText(result) {
3069
2462
  }
3070
2463
  return "Tool execution failed";
3071
2464
  }
2465
+ function extractToolBackgroundOutput(result) {
2466
+ if (!result || typeof result !== "object") return void 0;
2467
+ const record2 = result;
2468
+ if (typeof record2.backgroundOutput === "string") return record2.backgroundOutput;
2469
+ if (record2.details && typeof record2.details === "object") {
2470
+ const details = record2.details;
2471
+ if (typeof details.backgroundOutput === "string") return details.backgroundOutput;
2472
+ }
2473
+ }
3072
2474
  function toChatMessagesFromAgentMessages(messages, sessionId) {
3073
2475
  const output = [];
3074
2476
  for (const [index, message] of messages.entries()) {
@@ -3095,6 +2497,7 @@ function toChatMessagesFromAgentMessages(messages, sessionId) {
3095
2497
  const errorText = isError ? extractToolErrorText(result) : void 0;
3096
2498
  const errorEnvelope = errorText ? createFleetErrorEnvelope(errorText) : void 0;
3097
2499
  const durationMs = typeof result.durationMs === "number" ? result.durationMs : typeof result.details?.durationMs === "number" ? result.details.durationMs : void 0;
2500
+ const backgroundOutput = extractToolBackgroundOutput(result);
3098
2501
  let attached = false;
3099
2502
  if (toolCallId) for (let messageIndex = output.length - 1; messageIndex >= 0 && !attached; messageIndex -= 1) {
3100
2503
  const candidate = output[messageIndex];
@@ -3108,6 +2511,7 @@ function toChatMessagesFromAgentMessages(messages, sessionId) {
3108
2511
  output: toolResultOutput(result),
3109
2512
  result: toolResultOutput(result),
3110
2513
  ...durationMs !== void 0 ? { durationMs } : {},
2514
+ ...backgroundOutput !== void 0 ? { backgroundOutput } : {},
3111
2515
  ...errorEnvelope ? { error: errorEnvelope } : {}
3112
2516
  };
3113
2517
  output[messageIndex] = {
@@ -3127,6 +2531,7 @@ function toChatMessagesFromAgentMessages(messages, sessionId) {
3127
2531
  output: toolResultOutput(result),
3128
2532
  result: toolResultOutput(result),
3129
2533
  ...durationMs !== void 0 ? { durationMs } : {},
2534
+ ...backgroundOutput !== void 0 ? { backgroundOutput } : {},
3130
2535
  ...errorEnvelope ? { error: errorEnvelope } : {}
3131
2536
  }]
3132
2537
  });
@@ -3158,7 +2563,9 @@ function createEventMapperState(init) {
3158
2563
  inRun: false,
3159
2564
  presentation: init?.presentation ?? createEmptyPrimeAgentSessionPresentation(),
3160
2565
  activeUserBashId: void 0,
3161
- userBashSequence: 0
2566
+ userBashSequence: 0,
2567
+ rlmChildOverrides: new Map(init?.rlmChildOverrides),
2568
+ rlmChildRuntimeOverrides: /* @__PURE__ */ new Map()
3162
2569
  };
3163
2570
  }
3164
2571
  function resetRun(state) {
@@ -3264,7 +2671,9 @@ function computeRlmExecutionTree(rootSessionId, children, activeNodeId) {
3264
2671
  ...activeNodeId ? { activeNodeId } : {}
3265
2672
  };
3266
2673
  }
3267
- function safeRlmChild(child) {
2674
+ function safeRlmChild(child, override) {
2675
+ const childLastHeardFrom = child.lastHeardFrom;
2676
+ const lastHeardFrom = override?.lastHeardFrom ?? (typeof childLastHeardFrom === "number" ? childLastHeardFrom : void 0);
3268
2677
  return {
3269
2678
  id: child.id,
3270
2679
  ...child.parentId ? { parentId: child.parentId } : {},
@@ -3272,7 +2681,7 @@ function safeRlmChild(child) {
3272
2681
  ...child.sessionName ? { sessionName: child.sessionName } : {},
3273
2682
  ...child.model ? { model: child.model } : {},
3274
2683
  label: child.label,
3275
- status: child.status,
2684
+ status: override?.status ?? child.status,
3276
2685
  ...child.durationMs !== void 0 ? { durationMs: child.durationMs } : {},
3277
2686
  ...child.answerPreview ? { answerPreview: child.answerPreview } : {},
3278
2687
  ...child.toolUseCount !== void 0 ? { toolUseCount: child.toolUseCount } : {},
@@ -3281,9 +2690,63 @@ function safeRlmChild(child) {
3281
2690
  ...child.activity ? { activity: child.activity } : {},
3282
2691
  ...child.repliedSinceTask !== void 0 ? { repliedSinceTask: child.repliedSinceTask } : {},
3283
2692
  ...child.error ? { error: child.error } : {},
2693
+ ...lastHeardFrom !== void 0 ? { lastHeardFrom } : {},
3284
2694
  timestamp: Date.now()
3285
2695
  };
3286
2696
  }
2697
+ function rlmArtifactStatus(status) {
2698
+ if (status === "cancelled") return "cancelled";
2699
+ if (status === "error" || status === "failed") return "error";
2700
+ if (status === "done") return "success";
2701
+ return "running";
2702
+ }
2703
+ function applyRlmChildStatusOverrides(state, overrides) {
2704
+ for (const [childId, override] of overrides) state.rlmChildOverrides.set(childId, override);
2705
+ let changed = false;
2706
+ const rawRlmChildren = state.presentation.rlmChildren.map((child) => {
2707
+ const override = state.rlmChildOverrides.get(child.id);
2708
+ const runtimeOverride = state.rlmChildRuntimeOverrides.get(child.id);
2709
+ const status = override?.status ?? runtimeOverride?.status ?? child.status;
2710
+ const lastHeardFrom = override ? override.lastHeardFrom : runtimeOverride?.lastHeardFrom ?? child.lastHeardFrom;
2711
+ if (status === child.status && lastHeardFrom === child.lastHeardFrom) return child;
2712
+ changed = true;
2713
+ return {
2714
+ ...child,
2715
+ status,
2716
+ ...lastHeardFrom !== void 0 ? { lastHeardFrom } : {}
2717
+ };
2718
+ });
2719
+ if (!changed) return [];
2720
+ const rlmTree = computeRlmExecutionTree(state.sessionId, rawRlmChildren, state.presentation.rlmTree?.activeNodeId);
2721
+ const rlmChildren = rawRlmChildren.map((child) => {
2722
+ const treeNode = rlmTree.nodes[child.id];
2723
+ return treeNode ? {
2724
+ ...child,
2725
+ depth: treeNode.depth,
2726
+ childrenIds: treeNode.childrenIds
2727
+ } : child;
2728
+ });
2729
+ const updatedArtifacts = state.presentation.artifactRuns.map((run) => ({
2730
+ ...run,
2731
+ artifacts: run.artifacts.map((artifact) => {
2732
+ if (artifact.kind !== "rlm" || !artifact.sourceToolCallId) return artifact;
2733
+ const child = rlmChildren.find((entry) => entry.id === artifact.sourceToolCallId);
2734
+ if (!child) return artifact;
2735
+ return {
2736
+ ...artifact,
2737
+ status: rlmArtifactStatus(child.status),
2738
+ output: child,
2739
+ timestamp: child.timestamp
2740
+ };
2741
+ })
2742
+ }));
2743
+ return [emitPresentation(state, {
2744
+ ...state.presentation,
2745
+ rlmChildren,
2746
+ rlmTree,
2747
+ artifactRuns: updatedArtifacts
2748
+ })];
2749
+ }
3287
2750
  function safeGoal(goal) {
3288
2751
  return {
3289
2752
  active: goal.active,
@@ -3573,6 +3036,7 @@ function mapCoreAgentEvent(state, event) {
3573
3036
  }
3574
3037
  case "tool_execution_update": {
3575
3038
  const { category, toolName, serverName } = categorizeTool(event.toolName);
3039
+ const backgroundOutput = extractToolBackgroundOutput(event.partialResult);
3576
3040
  return [{
3577
3041
  type: "tool",
3578
3042
  part: upsertCurrentToolPart(state, {
@@ -3583,7 +3047,8 @@ function mapCoreAgentEvent(state, event) {
3583
3047
  toolCallId: event.toolCallId,
3584
3048
  state: "input-streaming",
3585
3049
  input: event.args,
3586
- result: event.partialResult
3050
+ result: event.partialResult,
3051
+ ...backgroundOutput !== void 0 ? { backgroundOutput } : {}
3587
3052
  }),
3588
3053
  messageId: state.currentMessageId
3589
3054
  }];
@@ -3593,6 +3058,7 @@ function mapCoreAgentEvent(state, event) {
3593
3058
  const errorText = event.isError ? extractToolErrorText(event.result) : void 0;
3594
3059
  const errorEnvelope = errorText ? createFleetErrorEnvelope(errorText) : void 0;
3595
3060
  const durationMs = typeof event.result?.durationMs === "number" ? event.result.durationMs : typeof event.result?.details?.durationMs === "number" ? event.result.details.durationMs : void 0;
3061
+ const backgroundOutput = extractToolBackgroundOutput(event.result);
3596
3062
  return [{
3597
3063
  type: "tool",
3598
3064
  part: upsertCurrentToolPart(state, {
@@ -3605,6 +3071,7 @@ function mapCoreAgentEvent(state, event) {
3605
3071
  output: event.result,
3606
3072
  result: event.result,
3607
3073
  ...durationMs !== void 0 ? { durationMs } : {},
3074
+ ...backgroundOutput !== void 0 ? { backgroundOutput } : {},
3608
3075
  ...errorEnvelope ? { error: errorEnvelope } : {}
3609
3076
  }),
3610
3077
  messageId: state.currentMessageId
@@ -3778,7 +3245,12 @@ function mapSessionSpecificEvent(state, event) {
3778
3245
  serviceTier: event.serviceTier
3779
3246
  })];
3780
3247
  case "rlm_child_update": {
3781
- const child = safeRlmChild(event.child);
3248
+ const runtimeChild = safeRlmChild(event.child);
3249
+ state.rlmChildRuntimeOverrides.set(event.child.id, {
3250
+ status: runtimeChild.status,
3251
+ ...runtimeChild.lastHeardFrom !== void 0 ? { lastHeardFrom: runtimeChild.lastHeardFrom } : {}
3252
+ });
3253
+ const child = safeRlmChild(event.child, state.rlmChildOverrides.get(event.child.id));
3782
3254
  const rawRlmChildren = state.presentation.rlmChildren.filter((entry) => entry.id !== child.id);
3783
3255
  rawRlmChildren.push(child);
3784
3256
  const rlmTree = computeRlmExecutionTree(state.sessionId, rawRlmChildren, child.id);
@@ -3801,7 +3273,7 @@ function mapSessionSpecificEvent(state, event) {
3801
3273
  sourceToolCallId: child.id,
3802
3274
  kind: "rlm",
3803
3275
  title: child.label,
3804
- status: child.status === "cancelled" ? "cancelled" : child.status === "error" ? "error" : child.status === "done" ? "success" : "running",
3276
+ status: rlmArtifactStatus(child.status),
3805
3277
  output: child,
3806
3278
  timestamp: child.timestamp
3807
3279
  };
@@ -3964,7 +3436,14 @@ function mapAgentConnectionEvent(state, event) {
3964
3436
  resetRun(state);
3965
3437
  const events = [];
3966
3438
  if (event.snapshot.parent || event.snapshot.children) {
3967
- const rawRlmChildren = (event.snapshot.children ?? []).map(safeRlmChild);
3439
+ const rawRlmChildren = (event.snapshot.children ?? []).map((child) => {
3440
+ const runtimeChild = safeRlmChild(child);
3441
+ state.rlmChildRuntimeOverrides.set(child.id, {
3442
+ status: runtimeChild.status,
3443
+ ...runtimeChild.lastHeardFrom !== void 0 ? { lastHeardFrom: runtimeChild.lastHeardFrom } : {}
3444
+ });
3445
+ return safeRlmChild(child, state.rlmChildOverrides.get(child.id));
3446
+ });
3968
3447
  const rlmTree = computeRlmExecutionTree(state.sessionId, rawRlmChildren);
3969
3448
  const rlmChildren = rawRlmChildren.map((c) => {
3970
3449
  const treeNode = rlmTree.nodes[c.id];
@@ -4295,6 +3774,9 @@ var RingBuffer = class {
4295
3774
  size() {
4296
3775
  return this.entries.length;
4297
3776
  }
3777
+ latestSequence() {
3778
+ return this.entries.at(-1)?.seq ?? 0;
3779
+ }
4298
3780
  clear() {
4299
3781
  this.entries.length = 0;
4300
3782
  this.nextSeq = 1;
@@ -4533,7 +4015,13 @@ function sessionSummaryIdentifiers(summary) {
4533
4015
  function sessionSummaryParentIdentifiers(summary) {
4534
4016
  return [summary.parentSessionId, summary.parentActiveSessionId].flatMap((value) => typeof value === "string" && value.length > 0 ? [value] : []);
4535
4017
  }
4536
- function hasSessionLineage(candidate, rootIdentifiers, sessionsByIdentifier) {
4018
+ function sessionSummaryPath(summary) {
4019
+ return typeof summary.sessionFile === "string" && summary.sessionFile.length > 0 ? resolve(summary.sessionFile) : void 0;
4020
+ }
4021
+ function sessionSummaryParentPaths(summary) {
4022
+ return [summary.parentSessionPath].flatMap((value) => typeof value === "string" && value.length > 0 ? [resolve(value)] : []);
4023
+ }
4024
+ function hasSessionLineage(candidate, rootIdentifiers, rootPaths, sessionsByIdentifier, sessionsByPath) {
4537
4025
  const pending = [candidate];
4538
4026
  const visited = /* @__PURE__ */ new Set();
4539
4027
  while (pending.length > 0) {
@@ -4545,13 +4033,47 @@ function hasSessionLineage(candidate, rootIdentifiers, sessionsByIdentifier) {
4545
4033
  const parent = sessionsByIdentifier.get(parentId);
4546
4034
  if (parent && !visited.has(parent)) pending.push(parent);
4547
4035
  }
4036
+ for (const parentPath of sessionSummaryParentPaths(current)) {
4037
+ if (rootPaths.has(parentPath)) return true;
4038
+ const parent = sessionsByPath.get(parentPath);
4039
+ if (parent && !visited.has(parent)) pending.push(parent);
4040
+ }
4548
4041
  }
4549
4042
  return false;
4550
4043
  }
4044
+ async function sessionLineagePaths(sessionPath) {
4045
+ const paths = /* @__PURE__ */ new Set();
4046
+ let currentPath = resolve(sessionPath);
4047
+ while (!paths.has(currentPath)) {
4048
+ paths.add(currentPath);
4049
+ try {
4050
+ const parentSession = (await SessionManager.openAsync(currentPath)).getHeader()?.parentSession;
4051
+ if (!parentSession) break;
4052
+ currentPath = resolve(dirname(currentPath), parentSession);
4053
+ } catch {
4054
+ break;
4055
+ }
4056
+ }
4057
+ return paths;
4058
+ }
4059
+ function rlmChildStatusOverride(summary) {
4060
+ const status = summary.statusLabel === "failed" || summary.workerState === "failed" ? "failed" : summary.statusLabel === "recovering" || summary.workerState === "recovering" ? "recovering" : void 0;
4061
+ const lastHeardFrom = summary.lastHeardFromAt ? Date.parse(summary.lastHeardFromAt) : NaN;
4062
+ return {
4063
+ ...status ? { status } : {},
4064
+ ...Number.isFinite(lastHeardFrom) ? { lastHeardFrom } : {}
4065
+ };
4066
+ }
4067
+ function effectiveRlmChildStatus(child, summary) {
4068
+ return rlmChildStatusOverride(summary).status ?? child.status;
4069
+ }
4551
4070
  var PrimeBridge = class {
4552
4071
  #sessions = /* @__PURE__ */ new Map();
4553
4072
  #listeners = /* @__PURE__ */ new Set();
4554
4073
  #ringBuffers = /* @__PURE__ */ new Map();
4074
+ #rlmChildStreams = /* @__PURE__ */ new Map();
4075
+ #rlmChildStreamInitializations = /* @__PURE__ */ new Map();
4076
+ #rlmChildMetadataRefreshQueue = new CoalescingRefreshQueue();
4555
4077
  #dialogs;
4556
4078
  #kernelTimeoutMs;
4557
4079
  #ringBufferCapacity;
@@ -4638,6 +4160,14 @@ var PrimeBridge = class {
4638
4160
  }
4639
4161
  /** Test-only: reset state. */
4640
4162
  resetForTests() {
4163
+ for (const stream of this.#rlmChildStreams.values()) {
4164
+ stream.closed = true;
4165
+ stream.removeWatcherListener();
4166
+ stream.watcher.close().catch(() => void 0);
4167
+ }
4168
+ this.#rlmChildStreams.clear();
4169
+ this.#rlmChildStreamInitializations.clear();
4170
+ this.#rlmChildMetadataRefreshQueue.clear();
4641
4171
  for (const session of this.#sessions.values()) {
4642
4172
  session.unsubscribe();
4643
4173
  session.connection.dispose().catch(() => void 0);
@@ -4788,6 +4318,7 @@ var PrimeBridge = class {
4788
4318
  if (frame.type === "presentation") this.#persistPresentation(sessionId, sessionPath, frame.presentation);
4789
4319
  this.#dispatch(sessionId, frame);
4790
4320
  }
4321
+ if (event.type === "session_resynced" || event.type === "session_event" && event.event.type === "rlm_child_update") this.#queueRlmChildMetadataRefresh(sessionId);
4791
4322
  });
4792
4323
  const bridgeSession = {
4793
4324
  sessionId,
@@ -4880,33 +4411,184 @@ var PrimeBridge = class {
4880
4411
  async listSessions(cwd) {
4881
4412
  return this.#sessionLister(cwd);
4882
4413
  }
4883
- /**
4884
- * Load a completed RLM child without resuming it as a live session.
4885
- *
4886
- * Child transcripts can be stored outside the parent's configured session
4887
- * directory. Authorization is therefore based on both the live parent's
4888
- * presentation and the daemon's lineage metadata, never on a browser-
4889
- * supplied filesystem path.
4890
- */
4891
- async loadRlmChildTranscript(parentSessionId, childId) {
4414
+ async #resolveRlmLineage(sessions2, rootSessionId, rootSessionPath) {
4415
+ const sessionsByIdentifier = /* @__PURE__ */ new Map();
4416
+ const sessionsByPath = /* @__PURE__ */ new Map();
4417
+ for (const session of sessions2) {
4418
+ for (const identifier of sessionSummaryIdentifiers(session)) if (!sessionsByIdentifier.has(identifier)) sessionsByIdentifier.set(identifier, session);
4419
+ const path = sessionSummaryPath(session);
4420
+ if (path && !sessionsByPath.has(path)) sessionsByPath.set(path, session);
4421
+ }
4422
+ const rootIdentifiers = /* @__PURE__ */ new Set([rootSessionId]);
4423
+ const rootPaths = new Set(await sessionLineagePaths(rootSessionPath));
4424
+ const rootSummary = sessionsByIdentifier.get(rootSessionId);
4425
+ if (rootSummary) {
4426
+ for (const identifier of sessionSummaryIdentifiers(rootSummary)) rootIdentifiers.add(identifier);
4427
+ for (const path of sessionSummaryParentPaths(rootSummary)) rootPaths.add(path);
4428
+ }
4429
+ for (const rootPath of rootPaths) {
4430
+ const rootAncestor = sessionsByPath.get(rootPath);
4431
+ if (!rootAncestor) continue;
4432
+ for (const identifier of sessionSummaryIdentifiers(rootAncestor)) rootIdentifiers.add(identifier);
4433
+ }
4434
+ return {
4435
+ sessionsByIdentifier,
4436
+ sessionsByPath,
4437
+ rootIdentifiers,
4438
+ rootPaths
4439
+ };
4440
+ }
4441
+ async #findAuthorizedRlmChild(parentSessionId, childId) {
4892
4442
  const parent = this.#sessions.get(parentSessionId);
4893
- if (!parent || !parent.mapperState.presentation.rlmChildren.some((child2) => child2.id === childId)) return;
4443
+ const child = parent?.mapperState.presentation.rlmChildren.find((entry) => entry.id === childId);
4444
+ if (!parent || !child) return void 0;
4894
4445
  const sessions2 = await this.#sessionLister();
4895
- const sessionsByIdentifier = /* @__PURE__ */ new Map();
4896
- for (const session of sessions2) for (const identifier of sessionSummaryIdentifiers(session)) if (!sessionsByIdentifier.has(identifier)) sessionsByIdentifier.set(identifier, session);
4897
- const rootIdentifiers = /* @__PURE__ */ new Set([parentSessionId]);
4898
- const rootSummary = sessionsByIdentifier.get(parentSessionId);
4899
- if (rootSummary) for (const identifier of sessionSummaryIdentifiers(rootSummary)) rootIdentifiers.add(identifier);
4900
- const child = sessions2.find((candidate) => {
4901
- return candidate.rlmChildId === childId && typeof candidate.sessionFile === "string" && hasSessionLineage(candidate, rootIdentifiers, sessionsByIdentifier);
4902
- });
4903
- if (!child?.sessionFile) return void 0;
4904
- const sessionManager = await SessionManager.openAsync(child.sessionFile);
4446
+ const { sessionsByIdentifier, sessionsByPath, rootIdentifiers, rootPaths } = await this.#resolveRlmLineage(sessions2, parentSessionId, parent.sessionPath);
4447
+ const summary = sessions2.find((candidate) => candidate.rlmChildId === childId && hasSessionLineage(candidate, rootIdentifiers, rootPaths, sessionsByIdentifier, sessionsByPath));
4448
+ return summary ? {
4449
+ parent,
4450
+ child,
4451
+ summary
4452
+ } : void 0;
4453
+ }
4454
+ #queueRlmChildMetadataRefresh(rootSessionId) {
4455
+ this.#rlmChildMetadataRefreshQueue.request(rootSessionId, () => this.#refreshRlmChildMetadata(rootSessionId));
4456
+ }
4457
+ async #refreshRlmChildMetadata(rootSessionId) {
4458
+ const parent = this.#sessions.get(rootSessionId);
4459
+ if (!parent) return;
4460
+ let sessions2;
4461
+ try {
4462
+ sessions2 = await this.#sessionLister();
4463
+ } catch {
4464
+ for (const child of parent.mapperState.presentation.rlmChildren) parent.mapperState.rlmChildOverrides.delete(child.id);
4465
+ for (const frame of applyRlmChildStatusOverrides(parent.mapperState, /* @__PURE__ */ new Map())) this.#dispatch(rootSessionId, frame);
4466
+ return;
4467
+ }
4468
+ const { sessionsByIdentifier, sessionsByPath, rootIdentifiers, rootPaths } = await this.#resolveRlmLineage(sessions2, rootSessionId, parent.sessionPath);
4469
+ const overrides = /* @__PURE__ */ new Map();
4470
+ for (const child of parent.mapperState.presentation.rlmChildren) {
4471
+ const summary = sessions2.find((candidate) => candidate.rlmChildId === child.id && hasSessionLineage(candidate, rootIdentifiers, rootPaths, sessionsByIdentifier, sessionsByPath));
4472
+ if (summary) overrides.set(child.id, rlmChildStatusOverride(summary));
4473
+ else parent.mapperState.rlmChildOverrides.delete(child.id);
4474
+ }
4475
+ const frames = applyRlmChildStatusOverrides(parent.mapperState, overrides);
4476
+ for (const frame of frames) {
4477
+ if (frame.type === "presentation") this.#persistPresentation(rootSessionId, parent.sessionPath, frame.presentation);
4478
+ this.#dispatch(rootSessionId, frame);
4479
+ }
4480
+ }
4481
+ #childStreamStatus(child, summary) {
4482
+ const status = summary ? effectiveRlmChildStatus(child, summary) : child.status;
4483
+ if (status === "error" || status === "failed") return "error";
4484
+ if (status === "running" || status === "recovering") return "streaming";
4485
+ return "ready";
4486
+ }
4487
+ async #closeRlmChildStream(stream) {
4488
+ if (stream.closed) return;
4489
+ stream.closed = true;
4490
+ if (this.#rlmChildStreams.get(stream.key) === stream) this.#rlmChildStreams.delete(stream.key);
4491
+ stream.buffering = false;
4492
+ stream.bufferedEvents.length = 0;
4493
+ stream.removeWatcherListener();
4494
+ await stream.watcher.close().catch(() => void 0);
4495
+ this.#ringBuffers.delete(stream.channelId);
4496
+ }
4497
+ async #publicRlmChildStream(stream, resume) {
4498
+ const requestedCursor = resume?.lastEventId && resume.lastEventId > 0 ? resume.lastEventId : 0;
4499
+ const generationMatches = resume?.streamGeneration === stream.streamGeneration;
4500
+ const buffer = this.#ringBufferFor(stream.channelId);
4501
+ const latest = buffer.latestSequence();
4502
+ const cursorOverflowed = generationMatches && requestedCursor > 0 ? buffer.replaySince(requestedCursor).overflowed : false;
4503
+ const canResume = generationMatches && requestedCursor > 0 && (requestedCursor === 0 || requestedCursor <= latest) && !cursorOverflowed;
4504
+ if (!canResume && !stream.snapshot.terminal && (resume?.streamGeneration !== void 0 || requestedCursor > 0)) await this.#refreshRlmChildSnapshot(stream);
4505
+ const refreshedLatest = buffer.latestSequence();
4506
+ const includeSnapshot = !canResume || stream.snapshot.terminal === true;
4507
+ const cursorReset = (resume?.streamGeneration !== void 0 || requestedCursor > 0) && !canResume;
4508
+ const replayFrom = canResume ? requestedCursor : stream.snapshot.terminal ? refreshedLatest : stream.replayFrom;
4509
+ let released = false;
4510
+ return {
4511
+ sessionId: stream.streamSessionId,
4512
+ projectId: stream.projectId,
4513
+ snapshot: stream.snapshot,
4514
+ channelId: stream.channelId,
4515
+ streamGeneration: stream.streamGeneration,
4516
+ mode: "live",
4517
+ resumeAccepted: canResume,
4518
+ cursorReset,
4519
+ replayFrom,
4520
+ includeSnapshot,
4521
+ release: async () => {
4522
+ if (released) return;
4523
+ released = true;
4524
+ stream.refs = Math.max(0, stream.refs - 1);
4525
+ if (stream.refs === 0) await this.#closeRlmChildStream(stream);
4526
+ }
4527
+ };
4528
+ }
4529
+ async #refreshRlmChildSnapshot(stream) {
4530
+ if (stream.closed) return;
4531
+ stream.buffering = true;
4532
+ const tracked = stream.refreshTail.catch(() => void 0).then(async () => {
4533
+ if (stream.closed) return;
4534
+ const messages = toChatMessagesFromAgentMessages(await stream.watcher.getMessages(), stream.canonicalSessionId);
4535
+ if (stream.closed) return;
4536
+ stream.snapshot = {
4537
+ ...stream.snapshot,
4538
+ messages,
4539
+ presentation: stream.mapperState.presentation
4540
+ };
4541
+ this.#dispatch(stream.channelId, stream.snapshot);
4542
+ stream.replayFrom = this.#ringBufferFor(stream.channelId).latestSequence();
4543
+ }).catch(() => void 0);
4544
+ stream.refreshTail = tracked;
4545
+ await tracked;
4546
+ if (stream.refreshTail === tracked) {
4547
+ stream.buffering = false;
4548
+ for (const event of stream.bufferedEvents.splice(0)) this.#handleRlmChildEvent(stream, event);
4549
+ }
4550
+ }
4551
+ #queueRlmChildSnapshot(stream) {
4552
+ this.#refreshRlmChildSnapshot(stream);
4553
+ }
4554
+ #handleRlmChildEvent(stream, event) {
4555
+ if (stream.closed) return;
4556
+ if (event.type === "session_event") {
4557
+ if (event.event.type === "agent_start" || event.event.type === "turn_start") stream.snapshot = {
4558
+ ...stream.snapshot,
4559
+ status: "streaming",
4560
+ terminal: false
4561
+ };
4562
+ if (event.event.type === "agent_end" || event.event.type === "turn_end") stream.snapshot = {
4563
+ ...stream.snapshot,
4564
+ status: "ready"
4565
+ };
4566
+ }
4567
+ if (event.type === "closed") stream.snapshot = {
4568
+ ...stream.snapshot,
4569
+ status: event.error ? "error" : "ready",
4570
+ terminal: true
4571
+ };
4572
+ const frames = mapAgentConnectionEvent(stream.mapperState, event);
4573
+ for (const frame of frames) {
4574
+ if (frame.type === "error") stream.snapshot = {
4575
+ ...stream.snapshot,
4576
+ status: "error"
4577
+ };
4578
+ this.#dispatch(stream.channelId, frame);
4579
+ }
4580
+ if (event.type === "session_event" && event.event.type === "rlm_child_update") this.#queueRlmChildMetadataRefresh(stream.parentSessionId);
4581
+ if (event.type === "session_replaced" || event.type === "session_resynced" || event.type === "closed" || event.type === "session_event" && (event.event.type === "agent_end" || event.event.type === "turn_end")) this.#queueRlmChildSnapshot(stream);
4582
+ }
4583
+ async #loadAuthorizedRlmChildTranscript(authorized) {
4584
+ const { summary: childSummary } = authorized;
4585
+ if (!childSummary.sessionFile) return void 0;
4586
+ const sessionManager = await SessionManager.openAsync(childSummary.sessionFile);
4905
4587
  const sessionId = sessionManager.getSessionId();
4906
- if (sessionId !== child.sessionId && sessionId !== child.id) return void 0;
4588
+ if (sessionId !== childSummary.sessionId && sessionId !== childSummary.id) return void 0;
4907
4589
  const agentMessages = sessionManager.buildSessionContext().messages;
4908
4590
  const messages = toChatMessagesFromAgentMessages(agentMessages, sessionId);
4909
- const presentation = initialPresentationForSession(agentMessages, void 0, void 0, void 0, void 0, sessionId, await loadManagedPrimePresentation({ sessionPath: child.sessionFile }));
4591
+ const presentation = initialPresentationForSession(agentMessages, void 0, void 0, void 0, void 0, sessionId, await loadManagedPrimePresentation({ sessionPath: childSummary.sessionFile }));
4910
4592
  return {
4911
4593
  sessionId,
4912
4594
  projectId: await getPrimeConfig().projectRegistry.projectIdForSession(sessionId, sessionManager.getCwd()),
@@ -4914,6 +4596,170 @@ var PrimeBridge = class {
4914
4596
  presentation
4915
4597
  };
4916
4598
  }
4599
+ async #snapshotOnlyRlmChildStream(authorized, resume) {
4600
+ const transcript = await this.#loadAuthorizedRlmChildTranscript(authorized).catch(() => void 0);
4601
+ if (!transcript) return void 0;
4602
+ const streamGeneration = crypto.randomUUID();
4603
+ const snapshot2 = {
4604
+ type: "session_snapshot",
4605
+ session: {
4606
+ sessionId: transcript.sessionId,
4607
+ projectId: transcript.projectId
4608
+ },
4609
+ messages: transcript.messages,
4610
+ presentation: transcript.presentation,
4611
+ status: this.#childStreamStatus(authorized.child, authorized.summary),
4612
+ terminal: true
4613
+ };
4614
+ return {
4615
+ sessionId: transcript.sessionId,
4616
+ projectId: transcript.projectId,
4617
+ snapshot: snapshot2,
4618
+ channelId: `snapshot:${authorized.parent.sessionId}:${authorized.child.id}:${streamGeneration}`,
4619
+ streamGeneration,
4620
+ mode: "snapshot-only",
4621
+ resumeAccepted: false,
4622
+ cursorReset: resume?.streamGeneration !== void 0 || (resume?.lastEventId ?? 0) > 0,
4623
+ replayFrom: 0,
4624
+ includeSnapshot: true,
4625
+ release: async () => void 0
4626
+ };
4627
+ }
4628
+ async #initializeRlmChildStream(authorized) {
4629
+ const { child, summary, parent } = authorized;
4630
+ const runtimeIds = [
4631
+ summary.activeSessionId,
4632
+ child.activeSessionId,
4633
+ summary.sessionId,
4634
+ summary.id,
4635
+ child.id
4636
+ ].filter((value) => typeof value === "string" && value.length > 0);
4637
+ let watcher;
4638
+ let streamSessionId;
4639
+ for (const runtimeId of [...new Set(runtimeIds)]) {
4640
+ try {
4641
+ watcher = await parent.connection.watchSession(runtimeId);
4642
+ } catch {
4643
+ watcher = void 0;
4644
+ }
4645
+ if (watcher) {
4646
+ streamSessionId = runtimeId;
4647
+ break;
4648
+ }
4649
+ }
4650
+ if (!watcher || !streamSessionId) return void 0;
4651
+ const pendingEvents = [];
4652
+ let buffering = true;
4653
+ let removeWatcherListener = () => void 0;
4654
+ try {
4655
+ removeWatcherListener = watcher.subscribe((event) => {
4656
+ if (buffering) pendingEvents.push(event);
4657
+ else {
4658
+ const stream2 = this.#rlmChildStreams.get(`${parent.sessionId}:${child.id}`);
4659
+ if (!stream2) return;
4660
+ if (stream2.buffering) stream2.bufferedEvents.push(event);
4661
+ else this.#handleRlmChildEvent(stream2, event);
4662
+ }
4663
+ });
4664
+ const agentMessages = await watcher.getMessages();
4665
+ const persistedPresentation = summary.sessionFile ? await loadManagedPrimePresentation({ sessionPath: summary.sessionFile }) : void 0;
4666
+ const canonicalSessionId = summary.sessionId || streamSessionId;
4667
+ const override = rlmChildStatusOverride(summary);
4668
+ const presentation = initialPresentationForSession(agentMessages, summary.sessionName ?? child.sessionName ?? child.label, summary.thinkingLevel, void 0, child.recap ?? summary.summary, canonicalSessionId, persistedPresentation);
4669
+ const mapperState = createEventMapperState({
4670
+ sessionId: canonicalSessionId,
4671
+ presentation,
4672
+ rlmChildOverrides: /* @__PURE__ */ new Map([[child.id, override]])
4673
+ });
4674
+ const projectId = await getPrimeConfig().projectRegistry.projectIdForSession(canonicalSessionId, summary.cwd);
4675
+ const streamGeneration = crypto.randomUUID();
4676
+ const stream = {
4677
+ key: `${parent.sessionId}:${child.id}`,
4678
+ parentSessionId: parent.sessionId,
4679
+ childId: child.id,
4680
+ streamSessionId,
4681
+ canonicalSessionId,
4682
+ channelId: `child:${parent.sessionId}:${child.id}:${streamGeneration}`,
4683
+ streamGeneration,
4684
+ projectId,
4685
+ child,
4686
+ summary,
4687
+ watcher,
4688
+ mapperState,
4689
+ snapshot: {
4690
+ type: "session_snapshot",
4691
+ session: {
4692
+ sessionId: canonicalSessionId,
4693
+ projectId
4694
+ },
4695
+ messages: toChatMessagesFromAgentMessages(agentMessages, canonicalSessionId),
4696
+ presentation,
4697
+ status: this.#childStreamStatus(child, summary)
4698
+ },
4699
+ replayFrom: 0,
4700
+ refs: 1,
4701
+ closed: false,
4702
+ buffering: false,
4703
+ bufferedEvents: [],
4704
+ removeWatcherListener,
4705
+ refreshTail: Promise.resolve()
4706
+ };
4707
+ this.#rlmChildStreams.set(stream.key, stream);
4708
+ this.#ringBufferFor(stream.channelId);
4709
+ buffering = false;
4710
+ for (const event of pendingEvents.splice(0)) this.#handleRlmChildEvent(stream, event);
4711
+ return stream;
4712
+ } catch {
4713
+ buffering = false;
4714
+ removeWatcherListener();
4715
+ await watcher.close().catch(() => void 0);
4716
+ return;
4717
+ }
4718
+ }
4719
+ /**
4720
+ * Open a read-only stream for an authorized RLM child. Completed and cold
4721
+ * children use a one-shot snapshot and never resume a runtime session.
4722
+ */
4723
+ async openRlmChildStream(parentSessionId, childId, resume) {
4724
+ const authorized = await this.#findAuthorizedRlmChild(parentSessionId, childId);
4725
+ if (!authorized) return void 0;
4726
+ const key = `${parentSessionId}:${childId}`;
4727
+ const existing = this.#rlmChildStreams.get(key);
4728
+ if (existing) {
4729
+ existing.refs += 1;
4730
+ return this.#publicRlmChildStream(existing, resume);
4731
+ }
4732
+ const status = effectiveRlmChildStatus(authorized.child, authorized.summary);
4733
+ if (status !== "running" && status !== "recovering") return this.#snapshotOnlyRlmChildStream(authorized, resume);
4734
+ const pending = this.#rlmChildStreamInitializations.get(key);
4735
+ if (pending) {
4736
+ const stream = await pending;
4737
+ if (!stream) return void 0;
4738
+ stream.refs += 1;
4739
+ return this.#publicRlmChildStream(stream, resume);
4740
+ }
4741
+ const initialization = this.#initializeRlmChildStream(authorized);
4742
+ this.#rlmChildStreamInitializations.set(key, initialization);
4743
+ try {
4744
+ const stream = await initialization;
4745
+ if (!stream) return void 0;
4746
+ return this.#publicRlmChildStream(stream, resume);
4747
+ } finally {
4748
+ if (this.#rlmChildStreamInitializations.get(key) === initialization) this.#rlmChildStreamInitializations.delete(key);
4749
+ }
4750
+ }
4751
+ /**
4752
+ * Load a completed RLM child without resuming it as a live session.
4753
+ *
4754
+ * Child transcripts can be stored outside the parent's configured session
4755
+ * directory. Authorization is therefore based on both the live parent's
4756
+ * presentation and the daemon's lineage metadata, never on a browser-
4757
+ * supplied filesystem path.
4758
+ */
4759
+ async loadRlmChildTranscript(parentSessionId, childId) {
4760
+ const authorized = await this.#findAuthorizedRlmChild(parentSessionId, childId);
4761
+ return authorized ? this.#loadAuthorizedRlmChildTranscript(authorized) : void 0;
4762
+ }
4917
4763
  async deleteSession(sessionId) {
4918
4764
  let existing = this.#sessions.get(sessionId);
4919
4765
  if (!existing) {
@@ -4939,6 +4785,11 @@ var PrimeBridge = class {
4939
4785
  await pendingPresentationWrite?.catch(() => void 0);
4940
4786
  if (this.#presentationWrites.get(existing.sessionId) === pendingPresentationWrite) this.#presentationWrites.delete(existing.sessionId);
4941
4787
  this.#dialogs.cancelAll(existing.sessionId, "server-shutdown");
4788
+ for (const childStream of [...this.#rlmChildStreams.values()]) {
4789
+ if (childStream.parentSessionId !== existing.sessionId) continue;
4790
+ childStream.refs = 0;
4791
+ await this.#closeRlmChildStream(childStream);
4792
+ }
4942
4793
  existing.unsubscribe();
4943
4794
  await existing.connection.abort().catch(() => void 0);
4944
4795
  await this.#openUIPromptTransitions.get(existing.sessionId)?.catch(() => void 0);
@@ -5862,103 +5713,162 @@ function normalizeSseReplayEvent(event) {
5862
5713
  if (!event || typeof event !== "object" || !("frame" in event)) return event;
5863
5714
  return event.frame ?? event;
5864
5715
  }
5865
- function handleChatEventsGet(request) {
5866
- return wrapApiHandler(async () => {
5867
- const url = new URL(request.url);
5868
- const sessionId = url.searchParams.get("sessionId");
5869
- if (!sessionId) return Response.json({ message: "SSE requires ?sessionId=" }, { status: 400 });
5870
- const lastEventIdRaw = request.headers.get("last-event-id") ?? url.searchParams.get("lastEventId");
5871
- const parsedLastEventId = lastEventIdRaw ? Number.parseInt(lastEventIdRaw, 10) : 0;
5872
- const lastEventId = Number.isFinite(parsedLastEventId) && parsedLastEventId > 0 ? parsedLastEventId : 0;
5873
- const bridge = getBridge();
5874
- const encoder = new TextEncoder();
5875
- let heartbeat;
5876
- let removeListener;
5877
- const stream = new ReadableStream({
5878
- async start(controller) {
5879
- let closed = false;
5880
- const enqueue = (data) => {
5881
- if (closed) return;
5882
- try {
5883
- controller.enqueue(encoder.encode(data));
5884
- } catch {
5885
- closed = true;
5886
- }
5887
- };
5888
- const write = (chunk) => {
5889
- const lines = [
5890
- chunk.id !== void 0 ? `id: ${chunk.id}
5716
+ function lastEventIdFor(request, url) {
5717
+ const raw = request.headers.get("last-event-id") ?? url.searchParams.get("lastEventId");
5718
+ const parsed = raw ? Number.parseInt(raw, 10) : 0;
5719
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
5720
+ }
5721
+ function createSseResponse(request, bridge, source, lastEventId) {
5722
+ const encoder = new TextEncoder();
5723
+ let heartbeat;
5724
+ let removeListener;
5725
+ let cleaned = false;
5726
+ let released = false;
5727
+ const releaseSource = () => {
5728
+ if (released) return;
5729
+ released = true;
5730
+ const release = source.release;
5731
+ if (release) release().catch(() => void 0);
5732
+ };
5733
+ const stream = new ReadableStream({
5734
+ async start(controller) {
5735
+ let closed = false;
5736
+ const enqueue = (data) => {
5737
+ if (closed) return;
5738
+ try {
5739
+ controller.enqueue(encoder.encode(data));
5740
+ } catch {
5741
+ closed = true;
5742
+ }
5743
+ };
5744
+ const write = (chunk) => {
5745
+ const lines = [
5746
+ chunk.id !== void 0 ? `id: ${chunk.id}
5891
5747
  ` : "",
5892
- `event: message
5893
- `,
5894
- `data: ${JSON.stringify(chunk.data)}
5748
+ "event: message\n",
5749
+ `data: ${JSON.stringify(chunk.data)}
5895
5750
 
5896
5751
  `
5897
- ];
5898
- enqueue(lines.join(""));
5899
- };
5900
- write({ data: {
5901
- type: "connected",
5902
- sessionId,
5903
- adapterCapabilities: FLEET_ADAPTER_CAPABILITIES
5904
- } });
5905
- let liveCursor = lastEventId;
5906
- let pendingQuestionIds = lastEventId === 0 ? new Set(bridge.pendingDialogsFor(sessionId).map((dialog) => dialog.toolCallId)) : null;
5907
- const flush = () => {
5908
- const { replayed } = bridge.replaySince(sessionId, liveCursor);
5909
- for (const entry of replayed) {
5910
- liveCursor = entry.seq;
5911
- const event = normalizeSseReplayEvent(entry.event);
5912
- if (!shouldReplaySseEvent(event, pendingQuestionIds)) continue;
5913
- write({
5914
- id: entry.seq,
5915
- data: event
5916
- });
5917
- }
5918
- pendingQuestionIds = null;
5919
- };
5920
- removeListener = bridge.addEventListener((sid) => {
5921
- if (sid !== sessionId) return;
5922
- flush();
5923
- });
5924
- if (lastEventId > 0) {
5925
- const { overflowed } = bridge.replaySince(sessionId, lastEventId);
5926
- if (overflowed) write({ data: {
5752
+ ];
5753
+ enqueue(lines.join(""));
5754
+ };
5755
+ const cleanup = () => {
5756
+ if (cleaned) return;
5757
+ cleaned = true;
5758
+ closed = true;
5759
+ if (heartbeat) clearInterval(heartbeat);
5760
+ removeListener?.();
5761
+ releaseSource();
5762
+ try {
5763
+ controller.close();
5764
+ } catch {
5765
+ }
5766
+ };
5767
+ const channelId = source.channelId ?? source.sessionId;
5768
+ let readyToFlush = false;
5769
+ let resyncSent = false;
5770
+ let liveCursor = source.replayFrom ?? lastEventId;
5771
+ let pendingQuestionIds = liveCursor === 0 ? new Set(bridge.pendingDialogsFor(source.sessionId).map((dialog) => dialog.toolCallId)) : null;
5772
+ const flush = () => {
5773
+ if (!readyToFlush || resyncSent || closed) return;
5774
+ const { replayed, overflowed } = bridge.replaySince(channelId, liveCursor);
5775
+ if (overflowed) {
5776
+ resyncSent = true;
5777
+ write({ data: {
5927
5778
  type: "state",
5928
5779
  state: {
5929
5780
  name: "agent_settled",
5930
5781
  message: "resync-required"
5931
5782
  }
5932
5783
  } });
5784
+ pendingQuestionIds = null;
5785
+ return;
5933
5786
  }
5934
- flush();
5935
- heartbeat = setInterval(() => {
5936
- enqueue(`: heartbeat
5937
-
5938
- `);
5939
- }, 15e3);
5940
- request.signal.addEventListener("abort", () => {
5941
- if (closed) return;
5942
- closed = true;
5943
- if (heartbeat) clearInterval(heartbeat);
5944
- removeListener?.();
5945
- try {
5946
- controller.close();
5947
- } catch {
5787
+ for (const entry of replayed) {
5788
+ liveCursor = entry.seq;
5789
+ const event = normalizeSseReplayEvent(entry.event);
5790
+ if (!shouldReplaySseEvent(event, pendingQuestionIds)) continue;
5791
+ write({
5792
+ id: entry.seq,
5793
+ data: event
5794
+ });
5795
+ if (event && typeof event === "object" && event.type === "session_snapshot" && event.terminal === true) {
5796
+ cleanup();
5797
+ return;
5948
5798
  }
5949
- });
5950
- },
5951
- cancel() {
5952
- if (heartbeat) clearInterval(heartbeat);
5953
- removeListener?.();
5799
+ }
5800
+ pendingQuestionIds = null;
5801
+ };
5802
+ removeListener = bridge.addEventListener((sessionId) => {
5803
+ if (sessionId === channelId) flush();
5804
+ });
5805
+ write({ data: {
5806
+ type: "connected",
5807
+ sessionId: source.sessionId,
5808
+ adapterCapabilities: FLEET_ADAPTER_CAPABILITIES,
5809
+ ...source.streamGeneration ? { streamGeneration: source.streamGeneration } : {},
5810
+ ...source.cursorReset ? { cursorReset: true } : {},
5811
+ ...source.resumeAccepted ? { resumeAccepted: true } : {}
5812
+ } });
5813
+ if (source.includeSnapshot !== false && source.initialSnapshot) write({ data: source.initialSnapshot });
5814
+ readyToFlush = true;
5815
+ if (source.initialSnapshot?.terminal === true) {
5816
+ cleanup();
5817
+ return;
5954
5818
  }
5955
- });
5956
- return new Response(stream, { headers: {
5957
- "Content-Type": "text/event-stream; charset=utf-8",
5958
- "Cache-Control": "no-cache, no-store",
5959
- Connection: "keep-alive",
5960
- "X-Accel-Buffering": "no"
5961
- } });
5819
+ flush();
5820
+ if (closed || cleaned) return;
5821
+ heartbeat = setInterval(() => enqueue(": heartbeat\n\n"), 15e3);
5822
+ request.signal.addEventListener("abort", cleanup, { once: true });
5823
+ },
5824
+ cancel() {
5825
+ if (heartbeat) clearInterval(heartbeat);
5826
+ removeListener?.();
5827
+ releaseSource();
5828
+ cleaned = true;
5829
+ }
5830
+ });
5831
+ return new Response(stream, { headers: {
5832
+ "Content-Type": "text/event-stream; charset=utf-8",
5833
+ "Cache-Control": "no-cache, no-store",
5834
+ Connection: "keep-alive",
5835
+ "X-Accel-Buffering": "no"
5836
+ } });
5837
+ }
5838
+ function handleChatEventsGet(request) {
5839
+ return wrapApiHandler(async () => {
5840
+ const url = new URL(request.url);
5841
+ const sessionIdParam = url.searchParams.get("sessionId");
5842
+ const parentSessionIdParam = url.searchParams.get("parentSessionId");
5843
+ const childIdParam = url.searchParams.get("childId");
5844
+ const streamGenerationParam = url.searchParams.get("streamGeneration");
5845
+ if (parentSessionIdParam !== null || childIdParam !== null || streamGenerationParam !== null) {
5846
+ if (sessionIdParam || !parentSessionIdParam || !childIdParam) return Response.json({ message: "GET /api/chat/events requires both ?parentSessionId= and ?childId= for child streams" }, { status: 400 });
5847
+ const parentSessionId = SessionIdSchema.safeParse(parentSessionIdParam);
5848
+ const childId = SessionIdSchema.safeParse(childIdParam);
5849
+ if (!parentSessionId.success || !childId.success) return Response.json({ message: "Invalid subagent stream identifiers" }, { status: 400 });
5850
+ if (streamGenerationParam !== null && !/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(streamGenerationParam)) return Response.json({ message: "Invalid child stream generation" }, { status: 400 });
5851
+ const childStream = await getBridge().openRlmChildStream(parentSessionId.data, childId.data, {
5852
+ ...streamGenerationParam ? { streamGeneration: streamGenerationParam } : {},
5853
+ lastEventId: lastEventIdFor(request, url)
5854
+ });
5855
+ if (!childStream) return Response.json({ message: "Unknown live subagent stream" }, { status: 404 });
5856
+ return createSseResponse(request, getBridge(), {
5857
+ sessionId: childStream.sessionId,
5858
+ channelId: childStream.channelId,
5859
+ streamGeneration: childStream.streamGeneration,
5860
+ resumeAccepted: childStream.resumeAccepted,
5861
+ cursorReset: childStream.cursorReset,
5862
+ replayFrom: childStream.replayFrom,
5863
+ includeSnapshot: childStream.includeSnapshot,
5864
+ initialSnapshot: childStream.snapshot,
5865
+ release: childStream.release
5866
+ }, lastEventIdFor(request, url));
5867
+ }
5868
+ if (!sessionIdParam) return Response.json({ message: "SSE requires ?sessionId=" }, { status: 400 });
5869
+ const sessionId = SessionIdSchema.safeParse(sessionIdParam);
5870
+ if (!sessionId.success) return Response.json({ message: "Invalid session identifier" }, { status: 400 });
5871
+ return createSseResponse(request, getBridge(), { sessionId: sessionId.data }, lastEventIdFor(request, url));
5962
5872
  });
5963
5873
  }
5964
5874
  var BodySchema$1 = external_exports.object({
@@ -6816,6 +6726,28 @@ var MODELS = {
6816
6726
  contextWindow: 1e6,
6817
6727
  maxTokens: 128e3
6818
6728
  },
6729
+ "anthropic.claude-fable-5-1": {
6730
+ id: "anthropic.claude-fable-5-1",
6731
+ name: "Claude Fable 5.1",
6732
+ api: "bedrock-converse-stream",
6733
+ provider: "amazon-bedrock",
6734
+ baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",
6735
+ reasoning: true,
6736
+ thinkingLevelMap: {
6737
+ "off": null,
6738
+ "xhigh": "xhigh",
6739
+ "max": "max"
6740
+ },
6741
+ input: ["text", "image"],
6742
+ cost: {
6743
+ input: 10,
6744
+ output: 50,
6745
+ cacheRead: 0.25,
6746
+ cacheWrite: 12.5
6747
+ },
6748
+ contextWindow: 1e6,
6749
+ maxTokens: 128e3
6750
+ },
6819
6751
  "anthropic.claude-haiku-4-5-20251001-v1:0": {
6820
6752
  id: "anthropic.claude-haiku-4-5-20251001-v1:0",
6821
6753
  name: "Claude Haiku 4.5",
@@ -7403,6 +7335,28 @@ var MODELS = {
7403
7335
  contextWindow: 1e6,
7404
7336
  maxTokens: 128e3
7405
7337
  },
7338
+ "global.anthropic.claude-fable-5-1": {
7339
+ id: "global.anthropic.claude-fable-5-1",
7340
+ name: "Claude Fable 5.1 (Global)",
7341
+ api: "bedrock-converse-stream",
7342
+ provider: "amazon-bedrock",
7343
+ baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",
7344
+ reasoning: true,
7345
+ thinkingLevelMap: {
7346
+ "off": null,
7347
+ "xhigh": "xhigh",
7348
+ "max": "max"
7349
+ },
7350
+ input: ["text", "image"],
7351
+ cost: {
7352
+ input: 10,
7353
+ output: 50,
7354
+ cacheRead: 0.25,
7355
+ cacheWrite: 12.5
7356
+ },
7357
+ contextWindow: 1e6,
7358
+ maxTokens: 128e3
7359
+ },
7406
7360
  "global.anthropic.claude-haiku-4-5-20251001-v1:0": {
7407
7361
  id: "global.anthropic.claude-haiku-4-5-20251001-v1:0",
7408
7362
  name: "Claude Haiku 4.5 (Global)",
@@ -7588,10 +7542,10 @@ var MODELS = {
7588
7542
  },
7589
7543
  input: ["text", "image"],
7590
7544
  cost: {
7591
- input: 0.22,
7592
- output: 1.32,
7593
- cacheRead: 0.022,
7594
- cacheWrite: 0.275
7545
+ input: 0.2,
7546
+ output: 1.2,
7547
+ cacheRead: 0.02,
7548
+ cacheWrite: 0.25
7595
7549
  },
7596
7550
  contextWindow: 105e4,
7597
7551
  maxTokens: 128e3
@@ -7610,10 +7564,10 @@ var MODELS = {
7610
7564
  },
7611
7565
  input: ["text", "image"],
7612
7566
  cost: {
7613
- input: 5.5,
7614
- output: 33,
7615
- cacheRead: 0.55,
7616
- cacheWrite: 6.875
7567
+ input: 4,
7568
+ output: 20,
7569
+ cacheRead: 0.4,
7570
+ cacheWrite: 5
7617
7571
  },
7618
7572
  contextWindow: 105e4,
7619
7573
  maxTokens: 128e3
@@ -7632,10 +7586,10 @@ var MODELS = {
7632
7586
  },
7633
7587
  input: ["text", "image"],
7634
7588
  cost: {
7635
- input: 2.2,
7636
- output: 13.2,
7637
- cacheRead: 0.22,
7638
- cacheWrite: 2.75
7589
+ input: 2,
7590
+ output: 12,
7591
+ cacheRead: 0.2,
7592
+ cacheWrite: 2.5
7639
7593
  },
7640
7594
  contextWindow: 105e4,
7641
7595
  maxTokens: 128e3
@@ -8273,10 +8227,10 @@ var MODELS = {
8273
8227
  },
8274
8228
  input: ["text", "image"],
8275
8229
  cost: {
8276
- input: 5.5,
8277
- output: 33,
8278
- cacheRead: 0.55,
8279
- cacheWrite: 6.875
8230
+ input: 4.4,
8231
+ output: 22,
8232
+ cacheRead: 0.44,
8233
+ cacheWrite: 5.5
8280
8234
  },
8281
8235
  contextWindow: 105e4,
8282
8236
  maxTokens: 128e3
@@ -8546,6 +8500,28 @@ var MODELS = {
8546
8500
  contextWindow: 1e6,
8547
8501
  maxTokens: 128e3
8548
8502
  },
8503
+ "us.anthropic.claude-fable-5-1": {
8504
+ id: "us.anthropic.claude-fable-5-1",
8505
+ name: "Claude Fable 5.1 (US)",
8506
+ api: "bedrock-converse-stream",
8507
+ provider: "amazon-bedrock",
8508
+ baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",
8509
+ reasoning: true,
8510
+ thinkingLevelMap: {
8511
+ "off": null,
8512
+ "xhigh": "xhigh",
8513
+ "max": "max"
8514
+ },
8515
+ input: ["text", "image"],
8516
+ cost: {
8517
+ input: 11,
8518
+ output: 55,
8519
+ cacheRead: 0.275,
8520
+ cacheWrite: 13.75
8521
+ },
8522
+ contextWindow: 1e6,
8523
+ maxTokens: 128e3
8524
+ },
8549
8525
  "us.anthropic.claude-haiku-4-5-20251001-v1:0": {
8550
8526
  id: "us.anthropic.claude-haiku-4-5-20251001-v1:0",
8551
8527
  name: "Claude Haiku 4.5 (US)",
@@ -8928,6 +8904,28 @@ var MODELS = {
8928
8904
  contextWindow: 1e6,
8929
8905
  maxTokens: 128e3
8930
8906
  },
8907
+ "claude-fable-5-1": {
8908
+ id: "claude-fable-5-1",
8909
+ name: "Claude Fable 5.1",
8910
+ api: "anthropic-messages",
8911
+ provider: "anthropic",
8912
+ baseUrl: "https://api.anthropic.com",
8913
+ reasoning: true,
8914
+ thinkingLevelMap: {
8915
+ "off": null,
8916
+ "xhigh": "xhigh",
8917
+ "max": "max"
8918
+ },
8919
+ input: ["text", "image"],
8920
+ cost: {
8921
+ input: 10,
8922
+ output: 50,
8923
+ cacheRead: 0.25,
8924
+ cacheWrite: 12.5
8925
+ },
8926
+ contextWindow: 1e6,
8927
+ maxTokens: 128e3
8928
+ },
8931
8929
  "claude-haiku-4-5": {
8932
8930
  id: "claude-haiku-4-5",
8933
8931
  name: "Claude Haiku 4.5 (latest)",
@@ -10876,6 +10874,42 @@ var MODELS = {
10876
10874
  },
10877
10875
  contextWindow: 262144,
10878
10876
  maxTokens: 256e3
10877
+ },
10878
+ "@cf/zai-org/glm-5.3": {
10879
+ id: "@cf/zai-org/glm-5.3",
10880
+ name: "Glm 5.3",
10881
+ api: "openai-completions",
10882
+ provider: "cloudflare-workers-ai",
10883
+ baseUrl: "https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",
10884
+ compat: { "sendSessionAffinityHeaders": true },
10885
+ reasoning: true,
10886
+ input: ["text"],
10887
+ cost: {
10888
+ input: 1.4,
10889
+ output: 4.4,
10890
+ cacheRead: 0.26,
10891
+ cacheWrite: 0
10892
+ },
10893
+ contextWindow: 1310720,
10894
+ maxTokens: 1310720
10895
+ },
10896
+ "@cf/zai-org/glm-5.3-flash": {
10897
+ id: "@cf/zai-org/glm-5.3-flash",
10898
+ name: "Glm 5.3 Flash",
10899
+ api: "openai-completions",
10900
+ provider: "cloudflare-workers-ai",
10901
+ baseUrl: "https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",
10902
+ compat: { "sendSessionAffinityHeaders": true },
10903
+ reasoning: true,
10904
+ input: ["text", "image"],
10905
+ cost: {
10906
+ input: 0.15,
10907
+ output: 0.5,
10908
+ cacheRead: 0.03,
10909
+ cacheWrite: 0
10910
+ },
10911
+ contextWindow: 1310720,
10912
+ maxTokens: 1048576
10879
10913
  }
10880
10914
  },
10881
10915
  "deepseek": {
@@ -10939,23 +10973,6 @@ var MODELS = {
10939
10973
  }
10940
10974
  },
10941
10975
  "fireworks": {
10942
- "accounts/fireworks/models/deepseek-v4-flash": {
10943
- id: "accounts/fireworks/models/deepseek-v4-flash",
10944
- name: "DeepSeek V4 Flash",
10945
- api: "anthropic-messages",
10946
- provider: "fireworks",
10947
- baseUrl: "https://api.fireworks.ai/inference",
10948
- reasoning: true,
10949
- input: ["text"],
10950
- cost: {
10951
- input: 0.14,
10952
- output: 0.28,
10953
- cacheRead: 0.028,
10954
- cacheWrite: 0
10955
- },
10956
- contextWindow: 1e6,
10957
- maxTokens: 384e3
10958
- },
10959
10976
  "accounts/fireworks/models/deepseek-v4-flash-0731": {
10960
10977
  id: "accounts/fireworks/models/deepseek-v4-flash-0731",
10961
10978
  name: "DeepSeek V4 Flash 0731",
@@ -10973,23 +10990,6 @@ var MODELS = {
10973
10990
  contextWindow: 1e6,
10974
10991
  maxTokens: 384e3
10975
10992
  },
10976
- "accounts/fireworks/models/deepseek-v4-pro": {
10977
- id: "accounts/fireworks/models/deepseek-v4-pro",
10978
- name: "DeepSeek V4 Pro",
10979
- api: "anthropic-messages",
10980
- provider: "fireworks",
10981
- baseUrl: "https://api.fireworks.ai/inference",
10982
- reasoning: true,
10983
- input: ["text"],
10984
- cost: {
10985
- input: 1.74,
10986
- output: 3.48,
10987
- cacheRead: 0.145,
10988
- cacheWrite: 0
10989
- },
10990
- contextWindow: 1e6,
10991
- maxTokens: 384e3
10992
- },
10993
10993
  "accounts/fireworks/models/deepseek-v4-pro-0813": {
10994
10994
  id: "accounts/fireworks/models/deepseek-v4-pro-0813",
10995
10995
  name: "DeepSeek V4 Pro 0813",
@@ -11024,35 +11024,52 @@ var MODELS = {
11024
11024
  contextWindow: 1048575,
11025
11025
  maxTokens: 131072
11026
11026
  },
11027
- "accounts/fireworks/models/gpt-oss-120b": {
11028
- id: "accounts/fireworks/models/gpt-oss-120b",
11029
- name: "GPT OSS 120B",
11027
+ "accounts/fireworks/models/glm-5p3": {
11028
+ id: "accounts/fireworks/models/glm-5p3",
11029
+ name: "GLM 5.3",
11030
11030
  api: "anthropic-messages",
11031
11031
  provider: "fireworks",
11032
11032
  baseUrl: "https://api.fireworks.ai/inference",
11033
11033
  reasoning: true,
11034
11034
  input: ["text"],
11035
+ cost: {
11036
+ input: 1.4,
11037
+ output: 4.4,
11038
+ cacheRead: 0.26,
11039
+ cacheWrite: 0
11040
+ },
11041
+ contextWindow: 1e6,
11042
+ maxTokens: 131072
11043
+ },
11044
+ "accounts/fireworks/models/glm-5p3-flash": {
11045
+ id: "accounts/fireworks/models/glm-5p3-flash",
11046
+ name: "GLM 5.3 Flash",
11047
+ api: "anthropic-messages",
11048
+ provider: "fireworks",
11049
+ baseUrl: "https://api.fireworks.ai/inference",
11050
+ reasoning: true,
11051
+ input: ["text", "image"],
11035
11052
  cost: {
11036
11053
  input: 0.15,
11037
- output: 0.6,
11038
- cacheRead: 0.015,
11054
+ output: 0.5,
11055
+ cacheRead: 0.029,
11039
11056
  cacheWrite: 0
11040
11057
  },
11041
- contextWindow: 131072,
11042
- maxTokens: 32768
11058
+ contextWindow: 1e6,
11059
+ maxTokens: 131072
11043
11060
  },
11044
- "accounts/fireworks/models/gpt-oss-20b": {
11045
- id: "accounts/fireworks/models/gpt-oss-20b",
11046
- name: "GPT OSS 20B",
11061
+ "accounts/fireworks/models/gpt-oss-120b": {
11062
+ id: "accounts/fireworks/models/gpt-oss-120b",
11063
+ name: "GPT OSS 120B",
11047
11064
  api: "anthropic-messages",
11048
11065
  provider: "fireworks",
11049
11066
  baseUrl: "https://api.fireworks.ai/inference",
11050
11067
  reasoning: true,
11051
11068
  input: ["text"],
11052
11069
  cost: {
11053
- input: 0.07,
11054
- output: 0.3,
11055
- cacheRead: 0.035,
11070
+ input: 0.15,
11071
+ output: 0.6,
11072
+ cacheRead: 0.015,
11056
11073
  cacheWrite: 0
11057
11074
  },
11058
11075
  contextWindow: 131072,
@@ -11135,23 +11152,6 @@ var MODELS = {
11135
11152
  contextWindow: 1048576,
11136
11153
  maxTokens: 131072
11137
11154
  },
11138
- "accounts/fireworks/models/minimax-m2p7": {
11139
- id: "accounts/fireworks/models/minimax-m2p7",
11140
- name: "MiniMax-M2.7",
11141
- api: "anthropic-messages",
11142
- provider: "fireworks",
11143
- baseUrl: "https://api.fireworks.ai/inference",
11144
- reasoning: true,
11145
- input: ["text"],
11146
- cost: {
11147
- input: 0.3,
11148
- output: 1.2,
11149
- cacheRead: 0.06,
11150
- cacheWrite: 0
11151
- },
11152
- contextWindow: 196608,
11153
- maxTokens: 196608
11154
- },
11155
11155
  "accounts/fireworks/models/minimax-m3": {
11156
11156
  id: "accounts/fireworks/models/minimax-m3",
11157
11157
  name: "MiniMax-M3",
@@ -11271,57 +11271,6 @@ var MODELS = {
11271
11271
  contextWindow: 1048575,
11272
11272
  maxTokens: 131072
11273
11273
  },
11274
- "accounts/fireworks/routers/kimi-k2p6-fast": {
11275
- id: "accounts/fireworks/routers/kimi-k2p6-fast",
11276
- name: "Kimi K2.6 Fast",
11277
- api: "anthropic-messages",
11278
- provider: "fireworks",
11279
- baseUrl: "https://api.fireworks.ai/inference",
11280
- reasoning: true,
11281
- input: ["text", "image"],
11282
- cost: {
11283
- input: 2,
11284
- output: 8,
11285
- cacheRead: 0.3,
11286
- cacheWrite: 0
11287
- },
11288
- contextWindow: 262e3,
11289
- maxTokens: 262e3
11290
- },
11291
- "accounts/fireworks/routers/kimi-k2p6-turbo": {
11292
- id: "accounts/fireworks/routers/kimi-k2p6-turbo",
11293
- name: "Kimi K2.6 Turbo",
11294
- api: "anthropic-messages",
11295
- provider: "fireworks",
11296
- baseUrl: "https://api.fireworks.ai/inference",
11297
- reasoning: true,
11298
- input: ["text", "image"],
11299
- cost: {
11300
- input: 2,
11301
- output: 8,
11302
- cacheRead: 0.3,
11303
- cacheWrite: 0
11304
- },
11305
- contextWindow: 262e3,
11306
- maxTokens: 262e3
11307
- },
11308
- "accounts/fireworks/routers/kimi-k2p7-code-fast": {
11309
- id: "accounts/fireworks/routers/kimi-k2p7-code-fast",
11310
- name: "Kimi K2.7 Code Fast",
11311
- api: "anthropic-messages",
11312
- provider: "fireworks",
11313
- baseUrl: "https://api.fireworks.ai/inference",
11314
- reasoning: true,
11315
- input: ["text", "image"],
11316
- cost: {
11317
- input: 1.9,
11318
- output: 8,
11319
- cacheRead: 0.38,
11320
- cacheWrite: 0
11321
- },
11322
- contextWindow: 262e3,
11323
- maxTokens: 262e3
11324
- },
11325
11274
  "accounts/fireworks/routers/kimi-k3-fast": {
11326
11275
  id: "accounts/fireworks/routers/kimi-k3-fast",
11327
11276
  name: "Kimi K3 Fast",
@@ -11705,9 +11654,9 @@ var MODELS = {
11705
11654
  reasoning: true,
11706
11655
  input: ["text", "image"],
11707
11656
  cost: {
11708
- input: 1.5,
11709
- output: 7.5,
11710
- cacheRead: 0.15,
11657
+ input: 0.75,
11658
+ output: 3.75,
11659
+ cacheRead: 0.075,
11711
11660
  cacheWrite: 0
11712
11661
  },
11713
11662
  contextWindow: 1e6,
@@ -12006,7 +11955,7 @@ var MODELS = {
12006
11955
  input: 0.2,
12007
11956
  output: 1.2,
12008
11957
  cacheRead: 0.02,
12009
- cacheWrite: 0
11958
+ cacheWrite: 0.25
12010
11959
  },
12011
11960
  contextWindow: 105e4,
12012
11961
  maxTokens: 128e3
@@ -12032,10 +11981,10 @@ var MODELS = {
12032
11981
  },
12033
11982
  input: ["text", "image"],
12034
11983
  cost: {
12035
- input: 2.5,
12036
- output: 15,
12037
- cacheRead: 0.25,
12038
- cacheWrite: 3.125
11984
+ input: 2,
11985
+ output: 10,
11986
+ cacheRead: 0.2,
11987
+ cacheWrite: 2.5
12039
11988
  },
12040
11989
  contextWindow: 105e4,
12041
11990
  maxTokens: 128e3
@@ -12064,7 +12013,7 @@ var MODELS = {
12064
12013
  input: 2,
12065
12014
  output: 12,
12066
12015
  cacheRead: 0.2,
12067
- cacheWrite: 0
12016
+ cacheWrite: 2.5
12068
12017
  },
12069
12018
  contextWindow: 105e4,
12070
12019
  maxTokens: 128e3
@@ -12507,23 +12456,6 @@ var MODELS = {
12507
12456
  contextWindow: 1048576,
12508
12457
  maxTokens: 65536
12509
12458
  },
12510
- "gemini-robotics-er-1.6-preview": {
12511
- id: "gemini-robotics-er-1.6-preview",
12512
- name: "Gemini Robotics-ER 1.6 Preview",
12513
- api: "google-generative-ai",
12514
- provider: "google",
12515
- baseUrl: "https://generativelanguage.googleapis.com/v1beta",
12516
- reasoning: true,
12517
- input: ["text", "image"],
12518
- cost: {
12519
- input: 1,
12520
- output: 5,
12521
- cacheRead: 0,
12522
- cacheWrite: 0
12523
- },
12524
- contextWindow: 131072,
12525
- maxTokens: 65536
12526
- },
12527
12459
  "gemma-4-26b-a4b-it": {
12528
12460
  id: "gemma-4-26b-a4b-it",
12529
12461
  name: "Gemma 4 26B A4B IT",
@@ -12920,6 +12852,23 @@ var MODELS = {
12920
12852
  },
12921
12853
  contextWindow: 131072,
12922
12854
  maxTokens: 16384
12855
+ },
12856
+ "qwen/qwen3.8-27b": {
12857
+ id: "qwen/qwen3.8-27b",
12858
+ name: "Qwen3.8 27B",
12859
+ api: "openai-completions",
12860
+ provider: "groq",
12861
+ baseUrl: "https://api.groq.com/openai/v1",
12862
+ reasoning: true,
12863
+ input: ["text", "image"],
12864
+ cost: {
12865
+ input: 0.8,
12866
+ output: 4,
12867
+ cacheRead: 0,
12868
+ cacheWrite: 0
12869
+ },
12870
+ contextWindow: 131042,
12871
+ maxTokens: 16384
12923
12872
  }
12924
12873
  },
12925
12874
  "huggingface": {
@@ -12939,7 +12888,7 @@ var MODELS = {
12939
12888
  cacheWrite: 0
12940
12889
  },
12941
12890
  contextWindow: 204800,
12942
- maxTokens: 128e3
12891
+ maxTokens: 131072
12943
12892
  },
12944
12893
  "MiniMaxAI/MiniMax-M2.1": {
12945
12894
  id: "MiniMaxAI/MiniMax-M2.1",
@@ -13011,7 +12960,7 @@ var MODELS = {
13011
12960
  cacheWrite: 0
13012
12961
  },
13013
12962
  contextWindow: 524288,
13014
- maxTokens: 128e3
12963
+ maxTokens: 512e3
13015
12964
  },
13016
12965
  "Qwen/Qwen2.5-Coder-32B-Instruct": {
13017
12966
  id: "Qwen/Qwen2.5-Coder-32B-Instruct",
@@ -14155,6 +14104,42 @@ var MODELS = {
14155
14104
  },
14156
14105
  contextWindow: 262144,
14157
14106
  maxTokens: 131072
14107
+ },
14108
+ "zai-org/GLM-5.3": {
14109
+ id: "zai-org/GLM-5.3",
14110
+ name: "GLM-5.3",
14111
+ api: "openai-completions",
14112
+ provider: "huggingface",
14113
+ baseUrl: "https://router.huggingface.co/v1",
14114
+ compat: { "supportsDeveloperRole": false },
14115
+ reasoning: true,
14116
+ input: ["text"],
14117
+ cost: {
14118
+ input: 1.4,
14119
+ output: 4.4,
14120
+ cacheRead: 0,
14121
+ cacheWrite: 0
14122
+ },
14123
+ contextWindow: 1048576,
14124
+ maxTokens: 131072
14125
+ },
14126
+ "zai-org/GLM-5.3-Flash": {
14127
+ id: "zai-org/GLM-5.3-Flash",
14128
+ name: "GLM-5.3-Flash",
14129
+ api: "openai-completions",
14130
+ provider: "huggingface",
14131
+ baseUrl: "https://router.huggingface.co/v1",
14132
+ compat: { "supportsDeveloperRole": false },
14133
+ reasoning: true,
14134
+ input: ["text", "image"],
14135
+ cost: {
14136
+ input: 0.15,
14137
+ output: 0.5,
14138
+ cacheRead: 0,
14139
+ cacheWrite: 0
14140
+ },
14141
+ contextWindow: 1048576,
14142
+ maxTokens: 131072
14158
14143
  }
14159
14144
  },
14160
14145
  "kimi-coding": {
@@ -14848,6 +14833,23 @@ var MODELS = {
14848
14833
  },
14849
14834
  contextWindow: 32e3,
14850
14835
  maxTokens: 32e3
14836
+ },
14837
+ "zai-glm-5-2": {
14838
+ id: "zai-glm-5-2",
14839
+ name: "GLM-5.2",
14840
+ api: "mistral-conversations",
14841
+ provider: "mistral",
14842
+ baseUrl: "https://api.mistral.ai",
14843
+ reasoning: true,
14844
+ input: ["text"],
14845
+ cost: {
14846
+ input: 1.4,
14847
+ output: 4.4,
14848
+ cacheRead: 0.14,
14849
+ cacheWrite: 0
14850
+ },
14851
+ contextWindow: 1e6,
14852
+ maxTokens: 131072
14851
14853
  }
14852
14854
  },
14853
14855
  "moonshotai": {
@@ -16443,6 +16445,28 @@ var MODELS = {
16443
16445
  contextWindow: 1e6,
16444
16446
  maxTokens: 128e3
16445
16447
  },
16448
+ "claude-fable-5-1": {
16449
+ id: "claude-fable-5-1",
16450
+ name: "Claude Fable 5.1",
16451
+ api: "anthropic-messages",
16452
+ provider: "opencode",
16453
+ baseUrl: "https://opencode.ai/zen",
16454
+ reasoning: true,
16455
+ thinkingLevelMap: {
16456
+ "off": null,
16457
+ "xhigh": "xhigh",
16458
+ "max": "max"
16459
+ },
16460
+ input: ["text", "image"],
16461
+ cost: {
16462
+ input: 10,
16463
+ output: 50,
16464
+ cacheRead: 0.25,
16465
+ cacheWrite: 12.5
16466
+ },
16467
+ contextWindow: 1e6,
16468
+ maxTokens: 128e3
16469
+ },
16446
16470
  "claude-haiku-4-5": {
16447
16471
  id: "claude-haiku-4-5",
16448
16472
  name: "Claude Haiku 4.5",
@@ -17289,23 +17313,6 @@ var MODELS = {
17289
17313
  contextWindow: 256e3,
17290
17314
  maxTokens: 256e3
17291
17315
  },
17292
- "hy3-free": {
17293
- id: "hy3-free",
17294
- name: "Hy3 Free",
17295
- api: "openai-completions",
17296
- provider: "opencode",
17297
- baseUrl: "https://opencode.ai/zen/v1",
17298
- reasoning: true,
17299
- input: ["text"],
17300
- cost: {
17301
- input: 0,
17302
- output: 0,
17303
- cacheRead: 0,
17304
- cacheWrite: 0
17305
- },
17306
- contextWindow: 19e4,
17307
- maxTokens: 64e3
17308
- },
17309
17316
  "kimi-k2.5": {
17310
17317
  id: "kimi-k2.5",
17311
17318
  name: "Kimi K2.5",
@@ -17383,6 +17390,23 @@ var MODELS = {
17383
17390
  contextWindow: 1048576,
17384
17391
  maxTokens: 131072
17385
17392
  },
17393
+ "ling-3.0-flash-fin-free": {
17394
+ id: "ling-3.0-flash-fin-free",
17395
+ name: "Ling 3.0 Flash Fin Free",
17396
+ api: "openai-completions",
17397
+ provider: "opencode",
17398
+ baseUrl: "https://opencode.ai/zen/v1",
17399
+ reasoning: true,
17400
+ input: ["text"],
17401
+ cost: {
17402
+ input: 0,
17403
+ output: 0,
17404
+ cacheRead: 0,
17405
+ cacheWrite: 0
17406
+ },
17407
+ contextWindow: 262144,
17408
+ maxTokens: 32768
17409
+ },
17386
17410
  "mimo-v2.5-free": {
17387
17411
  id: "mimo-v2.5-free",
17388
17412
  name: "MiMo V2.5 Free",
@@ -17552,23 +17576,6 @@ var MODELS = {
17552
17576
  },
17553
17577
  contextWindow: 262144,
17554
17578
  maxTokens: 65536
17555
- },
17556
- "x-preview-f-free": {
17557
- id: "x-preview-f-free",
17558
- name: "Ox Alpha Free (Unlimited)",
17559
- api: "openai-completions",
17560
- provider: "opencode",
17561
- baseUrl: "https://opencode.ai/zen/v1",
17562
- reasoning: true,
17563
- input: ["text", "image"],
17564
- cost: {
17565
- input: 0,
17566
- output: 0,
17567
- cacheRead: 0,
17568
- cacheWrite: 0
17569
- },
17570
- contextWindow: 1e6,
17571
- maxTokens: 131072
17572
17579
  }
17573
17580
  },
17574
17581
  "opencode-go": {
@@ -17710,6 +17717,23 @@ var MODELS = {
17710
17717
  contextWindow: 1e6,
17711
17718
  maxTokens: 131072
17712
17719
  },
17720
+ "glm-5.3-flash": {
17721
+ id: "glm-5.3-flash",
17722
+ name: "GLM-5.3-Flash (2x usage)",
17723
+ api: "openai-completions",
17724
+ provider: "opencode-go",
17725
+ baseUrl: "https://opencode.ai/zen/go/v1",
17726
+ reasoning: true,
17727
+ input: ["text", "image"],
17728
+ cost: {
17729
+ input: 0.075,
17730
+ output: 0.25,
17731
+ cacheRead: 0.015,
17732
+ cacheWrite: 0
17733
+ },
17734
+ contextWindow: 1e6,
17735
+ maxTokens: 131072
17736
+ },
17713
17737
  "gpt-5.6-luna": {
17714
17738
  id: "gpt-5.6-luna",
17715
17739
  name: "GPT-5.6 Luna",
@@ -17752,21 +17776,38 @@ var MODELS = {
17752
17776
  },
17753
17777
  "hy3": {
17754
17778
  id: "hy3",
17755
- name: "Hy3 (8x usage)",
17779
+ name: "Hy3",
17756
17780
  api: "openai-completions",
17757
17781
  provider: "opencode-go",
17758
17782
  baseUrl: "https://opencode.ai/zen/go/v1",
17759
17783
  reasoning: true,
17760
17784
  input: ["text"],
17761
17785
  cost: {
17762
- input: 0.0175,
17763
- output: 0.0725,
17764
- cacheRead: 4375e-6,
17786
+ input: 0.14,
17787
+ output: 0.58,
17788
+ cacheRead: 0.035,
17765
17789
  cacheWrite: 0
17766
17790
  },
17767
17791
  contextWindow: 256e3,
17768
17792
  maxTokens: 64e3
17769
17793
  },
17794
+ "hy4-preview": {
17795
+ id: "hy4-preview",
17796
+ name: "Hy4 preview",
17797
+ api: "openai-completions",
17798
+ provider: "opencode-go",
17799
+ baseUrl: "https://opencode.ai/zen/go/v1",
17800
+ reasoning: true,
17801
+ input: ["text"],
17802
+ cost: {
17803
+ input: 0.834,
17804
+ output: 2.501,
17805
+ cacheRead: 0.042,
17806
+ cacheWrite: 0
17807
+ },
17808
+ contextWindow: 1024e3,
17809
+ maxTokens: 64e3
17810
+ },
17770
17811
  "kimi-k2.6": {
17771
17812
  id: "kimi-k2.6",
17772
17813
  name: "Kimi K2.6",
@@ -17929,23 +17970,6 @@ var MODELS = {
17929
17970
  contextWindow: 1048576,
17930
17971
  maxTokens: 131072
17931
17972
  },
17932
- "ox-alpha-free": {
17933
- id: "ox-alpha-free",
17934
- name: "Ox Alpha Free (Unlimited)",
17935
- api: "openai-completions",
17936
- provider: "opencode-go",
17937
- baseUrl: "https://opencode.ai/zen/go/v1",
17938
- reasoning: true,
17939
- input: ["text", "image"],
17940
- cost: {
17941
- input: 0,
17942
- output: 0,
17943
- cacheRead: 0,
17944
- cacheWrite: 0
17945
- },
17946
- contextWindow: 1e6,
17947
- maxTokens: 131072
17948
- },
17949
17973
  "qwen3.6-plus": {
17950
17974
  id: "qwen3.6-plus",
17951
17975
  name: "Qwen3.6 Plus",
@@ -17998,6 +18022,23 @@ var MODELS = {
17998
18022
  contextWindow: 1e6,
17999
18023
  maxTokens: 65536
18000
18024
  },
18025
+ "qwen3.8-flash": {
18026
+ id: "qwen3.8-flash",
18027
+ name: "Qwen3.8 Flash",
18028
+ api: "openai-completions",
18029
+ provider: "opencode-go",
18030
+ baseUrl: "https://opencode.ai/zen/go/v1",
18031
+ reasoning: true,
18032
+ input: ["text", "image"],
18033
+ cost: {
18034
+ input: 0.15,
18035
+ output: 0.47,
18036
+ cacheRead: 0.016,
18037
+ cacheWrite: 0.2
18038
+ },
18039
+ contextWindow: 1e6,
18040
+ maxTokens: 131072
18041
+ },
18001
18042
  "qwen3.8-max": {
18002
18043
  id: "qwen3.8-max",
18003
18044
  name: "Qwen3.8 Max",
@@ -18235,6 +18276,32 @@ var MODELS = {
18235
18276
  contextWindow: 1e6,
18236
18277
  maxTokens: 128e3
18237
18278
  },
18279
+ "anthropic/claude-fable-5.1": {
18280
+ id: "anthropic/claude-fable-5.1",
18281
+ name: "Anthropic: Claude Fable 5.1",
18282
+ api: "openai-completions",
18283
+ provider: "openrouter",
18284
+ baseUrl: "https://openrouter.ai/api/v1",
18285
+ reasoning: true,
18286
+ thinkingLevelMap: {
18287
+ "off": null,
18288
+ "minimal": null,
18289
+ "low": "low",
18290
+ "medium": "medium",
18291
+ "high": "high",
18292
+ "xhigh": "xhigh",
18293
+ "max": "max"
18294
+ },
18295
+ input: ["text", "image"],
18296
+ cost: {
18297
+ input: 0,
18298
+ output: 0,
18299
+ cacheRead: 0,
18300
+ cacheWrite: 0
18301
+ },
18302
+ contextWindow: 1e6,
18303
+ maxTokens: 128e3
18304
+ },
18238
18305
  "anthropic/claude-haiku-4.5": {
18239
18306
  id: "anthropic/claude-haiku-4.5",
18240
18307
  name: "Anthropic: Claude Haiku 4.5",
@@ -18389,31 +18456,6 @@ var MODELS = {
18389
18456
  contextWindow: 1e6,
18390
18457
  maxTokens: 128e3
18391
18458
  },
18392
- "anthropic/claude-opus-4.7-fast": {
18393
- id: "anthropic/claude-opus-4.7-fast",
18394
- name: "Anthropic: Claude Opus 4.7 (Fast)",
18395
- api: "openai-completions",
18396
- provider: "openrouter",
18397
- baseUrl: "https://openrouter.ai/api/v1",
18398
- reasoning: true,
18399
- thinkingLevelMap: {
18400
- "minimal": null,
18401
- "low": "low",
18402
- "medium": "medium",
18403
- "high": "high",
18404
- "xhigh": "xhigh",
18405
- "max": "max"
18406
- },
18407
- input: ["text", "image"],
18408
- cost: {
18409
- input: 30,
18410
- output: 150,
18411
- cacheRead: 3,
18412
- cacheWrite: 37.5
18413
- },
18414
- contextWindow: 1e6,
18415
- maxTokens: 128e3
18416
- },
18417
18459
  "anthropic/claude-opus-4.8": {
18418
18460
  id: "anthropic/claude-opus-4.8",
18419
18461
  name: "Anthropic: Claude Opus 4.8",
@@ -18439,31 +18481,6 @@ var MODELS = {
18439
18481
  contextWindow: 1e6,
18440
18482
  maxTokens: 128e3
18441
18483
  },
18442
- "anthropic/claude-opus-4.8-fast": {
18443
- id: "anthropic/claude-opus-4.8-fast",
18444
- name: "Anthropic: Claude Opus 4.8 (Fast)",
18445
- api: "openai-completions",
18446
- provider: "openrouter",
18447
- baseUrl: "https://openrouter.ai/api/v1",
18448
- reasoning: true,
18449
- thinkingLevelMap: {
18450
- "minimal": null,
18451
- "low": "low",
18452
- "medium": "medium",
18453
- "high": "high",
18454
- "xhigh": "xhigh",
18455
- "max": "max"
18456
- },
18457
- input: ["text", "image"],
18458
- cost: {
18459
- input: 10,
18460
- output: 50,
18461
- cacheRead: 1,
18462
- cacheWrite: 12.5
18463
- },
18464
- contextWindow: 1e6,
18465
- maxTokens: 128e3
18466
- },
18467
18484
  "anthropic/claude-opus-5": {
18468
18485
  id: "anthropic/claude-opus-5",
18469
18486
  name: "Claude Opus 5",
@@ -18489,31 +18506,6 @@ var MODELS = {
18489
18506
  contextWindow: 1e6,
18490
18507
  maxTokens: 128e3
18491
18508
  },
18492
- "anthropic/claude-opus-5-fast": {
18493
- id: "anthropic/claude-opus-5-fast",
18494
- name: "Claude Opus 5 (Fast)",
18495
- api: "openai-completions",
18496
- provider: "openrouter",
18497
- baseUrl: "https://openrouter.ai/api/v1",
18498
- reasoning: true,
18499
- thinkingLevelMap: {
18500
- "minimal": null,
18501
- "low": "low",
18502
- "medium": "medium",
18503
- "high": "high",
18504
- "xhigh": "xhigh",
18505
- "max": "max"
18506
- },
18507
- input: ["text", "image"],
18508
- cost: {
18509
- input: 10,
18510
- output: 50,
18511
- cacheRead: 1,
18512
- cacheWrite: 12.5
18513
- },
18514
- contextWindow: 1e6,
18515
- maxTokens: 128e3
18516
- },
18517
18509
  "anthropic/claude-sonnet-4": {
18518
18510
  id: "anthropic/claude-sonnet-4",
18519
18511
  name: "Anthropic: Claude Sonnet 4",
@@ -18635,30 +18627,13 @@ var MODELS = {
18635
18627
  },
18636
18628
  input: ["text"],
18637
18629
  cost: {
18638
- input: 0.22,
18639
- output: 0.85,
18630
+ input: 0.25,
18631
+ output: 0.7999999999999999,
18640
18632
  cacheRead: 0.06,
18641
18633
  cacheWrite: 0
18642
18634
  },
18643
18635
  contextWindow: 262144,
18644
- maxTokens: 235929
18645
- },
18646
- "arcee-ai/virtuoso-large": {
18647
- id: "arcee-ai/virtuoso-large",
18648
- name: "Arcee AI: Virtuoso Large",
18649
- api: "openai-completions",
18650
- provider: "openrouter",
18651
- baseUrl: "https://openrouter.ai/api/v1",
18652
- reasoning: false,
18653
- input: ["text"],
18654
- cost: {
18655
- input: 0.75,
18656
- output: 1.2,
18657
- cacheRead: 0,
18658
- cacheWrite: 0
18659
- },
18660
- contextWindow: 131072,
18661
- maxTokens: 64e3
18636
+ maxTokens: 8e4
18662
18637
  },
18663
18638
  "auto": {
18664
18639
  id: "auto",
@@ -19048,13 +19023,13 @@ var MODELS = {
19048
19023
  },
19049
19024
  input: ["text"],
19050
19025
  cost: {
19051
- input: 0.26,
19052
- output: 0.38,
19053
- cacheRead: 0.13,
19026
+ input: 0.26899999999999996,
19027
+ output: 0.39999999999999997,
19028
+ cacheRead: 0.13449999999999998,
19054
19029
  cacheWrite: 0
19055
19030
  },
19056
19031
  contextWindow: 163840,
19057
- maxTokens: 147456
19032
+ maxTokens: 65536
19058
19033
  },
19059
19034
  "deepseek/deepseek-v3.2-exp": {
19060
19035
  id: "deepseek/deepseek-v3.2-exp",
@@ -19103,9 +19078,9 @@ var MODELS = {
19103
19078
  },
19104
19079
  input: ["text"],
19105
19080
  cost: {
19106
- input: 0.088606,
19107
- output: 0.177212,
19108
- cacheRead: 0.017721200000000003,
19081
+ input: 0.07476000000000001,
19082
+ output: 0.14952000000000001,
19083
+ cacheRead: 0.014952,
19109
19084
  cacheWrite: 0
19110
19085
  },
19111
19086
  contextWindow: 1048576,
@@ -19132,9 +19107,9 @@ var MODELS = {
19132
19107
  },
19133
19108
  input: ["text"],
19134
19109
  cost: {
19135
- input: 0.06,
19136
- output: 0.12,
19137
- cacheRead: 0.012,
19110
+ input: 0.065,
19111
+ output: 0.18,
19112
+ cacheRead: 0.016,
19138
19113
  cacheWrite: 0
19139
19114
  },
19140
19115
  contextWindow: 1310720,
@@ -19190,13 +19165,13 @@ var MODELS = {
19190
19165
  },
19191
19166
  input: ["text"],
19192
19167
  cost: {
19193
- input: 0.87,
19194
- output: 1.74,
19195
- cacheRead: 0.0725,
19168
+ input: 1.5999999999999999,
19169
+ output: 3.1999999999999997,
19170
+ cacheRead: 0.135,
19196
19171
  cacheWrite: 0
19197
19172
  },
19198
19173
  contextWindow: 1048576,
19199
- maxTokens: 384e3
19174
+ maxTokens: 393216
19200
19175
  },
19201
19176
  "deepseek/deepseek-v4-pro-0813": {
19202
19177
  id: "deepseek/deepseek-v4-pro-0813",
@@ -19219,13 +19194,13 @@ var MODELS = {
19219
19194
  },
19220
19195
  input: ["text"],
19221
19196
  cost: {
19222
- input: 1.122,
19223
- output: 3.366,
19224
- cacheRead: 0.037399999999999996,
19197
+ input: 0.66,
19198
+ output: 1.9800000000000002,
19199
+ cacheRead: 0.022,
19225
19200
  cacheWrite: 0
19226
19201
  },
19227
19202
  contextWindow: 1048576,
19228
- maxTokens: 943717
19203
+ maxTokens: 384e3
19229
19204
  },
19230
19205
  "dots-studio/dots-3-note-preview:free": {
19231
19206
  id: "dots-studio/dots-3-note-preview:free",
@@ -19636,10 +19611,10 @@ var MODELS = {
19636
19611
  },
19637
19612
  input: ["text", "image"],
19638
19613
  cost: {
19639
- input: 0.375,
19640
- output: 1.875,
19641
- cacheRead: 0.0375,
19642
- cacheWrite: 0.0208333333333333
19614
+ input: 0.75,
19615
+ output: 3.75,
19616
+ cacheRead: 0.075,
19617
+ cacheWrite: 0.0416666666666667
19643
19618
  },
19644
19619
  contextWindow: 1048576,
19645
19620
  maxTokens: 65536
@@ -19675,7 +19650,7 @@ var MODELS = {
19675
19650
  cacheRead: 0.04,
19676
19651
  cacheWrite: 0
19677
19652
  },
19678
- contextWindow: 262144,
19653
+ contextWindow: 131072,
19679
19654
  maxTokens: 117964
19680
19655
  },
19681
19656
  "google/gemma-4-26b-a4b-it": {
@@ -19799,6 +19774,31 @@ var MODELS = {
19799
19774
  contextWindow: 131072,
19800
19775
  maxTokens: 117964
19801
19776
  },
19777
+ "ibm-granite/granite-4.2-8b": {
19778
+ id: "ibm-granite/granite-4.2-8b",
19779
+ name: "IBM: Granite 4.2 8B",
19780
+ api: "openai-completions",
19781
+ provider: "openrouter",
19782
+ baseUrl: "https://openrouter.ai/api/v1",
19783
+ reasoning: true,
19784
+ thinkingLevelMap: {
19785
+ "minimal": null,
19786
+ "low": "low",
19787
+ "medium": null,
19788
+ "high": "high",
19789
+ "xhigh": null,
19790
+ "max": null
19791
+ },
19792
+ input: ["text"],
19793
+ cost: {
19794
+ input: 0.09999999999999999,
19795
+ output: 0.15,
19796
+ cacheRead: 0.049999999999999996,
19797
+ cacheWrite: 0
19798
+ },
19799
+ contextWindow: 131072,
19800
+ maxTokens: 117964
19801
+ },
19802
19802
  "inception/mercury-2": {
19803
19803
  id: "inception/mercury-2",
19804
19804
  name: "Inception: Mercury 2",
@@ -19824,6 +19824,31 @@ var MODELS = {
19824
19824
  contextWindow: 128e3,
19825
19825
  maxTokens: 5e4
19826
19826
  },
19827
+ "inception/mercury-2.5-preview": {
19828
+ id: "inception/mercury-2.5-preview",
19829
+ name: "Inception: Mercury 2.5 Preview",
19830
+ api: "openai-completions",
19831
+ provider: "openrouter",
19832
+ baseUrl: "https://openrouter.ai/api/v1",
19833
+ reasoning: true,
19834
+ thinkingLevelMap: {
19835
+ "minimal": null,
19836
+ "low": "low",
19837
+ "medium": "medium",
19838
+ "high": "high",
19839
+ "xhigh": null,
19840
+ "max": null
19841
+ },
19842
+ input: ["text"],
19843
+ cost: {
19844
+ input: 0.04,
19845
+ output: 0.15,
19846
+ cacheRead: 4e-3,
19847
+ cacheWrite: 0
19848
+ },
19849
+ contextWindow: 26e4,
19850
+ maxTokens: 65536
19851
+ },
19827
19852
  "inclusionai/ling-3.0-flash": {
19828
19853
  id: "inclusionai/ling-3.0-flash",
19829
19854
  name: "Ling-3.0-flash",
@@ -19850,22 +19875,31 @@ var MODELS = {
19850
19875
  contextWindow: 262144,
19851
19876
  maxTokens: 32768
19852
19877
  },
19853
- "kwaipilot/kat-coder-air-v2.5": {
19854
- id: "kwaipilot/kat-coder-air-v2.5",
19855
- name: "Kwaipilot: KAT-Coder-Air V2.5",
19878
+ "inclusionai/ling-3.0-flash-fin:free": {
19879
+ id: "inclusionai/ling-3.0-flash-fin:free",
19880
+ name: "Ling 3.0 Flash Fin (free)",
19856
19881
  api: "openai-completions",
19857
19882
  provider: "openrouter",
19858
19883
  baseUrl: "https://openrouter.ai/api/v1",
19859
- reasoning: false,
19884
+ compat: { "supportsReasoningEffort": false },
19885
+ reasoning: true,
19886
+ thinkingLevelMap: {
19887
+ "minimal": null,
19888
+ "low": null,
19889
+ "medium": null,
19890
+ "high": "high",
19891
+ "xhigh": null,
19892
+ "max": null
19893
+ },
19860
19894
  input: ["text"],
19861
19895
  cost: {
19862
- input: 0.15,
19863
- output: 0.6,
19864
- cacheRead: 0.03,
19896
+ input: 0,
19897
+ output: 0,
19898
+ cacheRead: 0,
19865
19899
  cacheWrite: 0
19866
19900
  },
19867
- contextWindow: 256e3,
19868
- maxTokens: 8e4
19901
+ contextWindow: 262144,
19902
+ maxTokens: 32768
19869
19903
  },
19870
19904
  "kwaipilot/kat-coder-pro-v2": {
19871
19905
  id: "kwaipilot/kat-coder-pro-v2",
@@ -19882,7 +19916,7 @@ var MODELS = {
19882
19916
  cacheWrite: 0
19883
19917
  },
19884
19918
  contextWindow: 262144,
19885
- maxTokens: 8e4
19919
+ maxTokens: 144e3
19886
19920
  },
19887
19921
  "kwaipilot/kat-coder-pro-v2.5": {
19888
19922
  id: "kwaipilot/kat-coder-pro-v2.5",
@@ -19898,8 +19932,8 @@ var MODELS = {
19898
19932
  cacheRead: 0.15,
19899
19933
  cacheWrite: 0
19900
19934
  },
19901
- contextWindow: 256e3,
19902
- maxTokens: 8e4
19935
+ contextWindow: 262144,
19936
+ maxTokens: 235929
19903
19937
  },
19904
19938
  "liquid/lfm-2.5-2.6b:free": {
19905
19939
  id: "liquid/lfm-2.5-2.6b:free",
@@ -20015,12 +20049,12 @@ var MODELS = {
20015
20049
  input: ["text", "image"],
20016
20050
  cost: {
20017
20051
  input: 0.19999999999999998,
20018
- output: 0.7999999999999999,
20052
+ output: 0.696,
20019
20053
  cacheRead: 0,
20020
20054
  cacheWrite: 0
20021
20055
  },
20022
20056
  contextWindow: 1048576,
20023
- maxTokens: 16384
20057
+ maxTokens: 115200
20024
20058
  },
20025
20059
  "meta-llama/llama-4-scout": {
20026
20060
  id: "meta-llama/llama-4-scout",
@@ -20031,13 +20065,13 @@ var MODELS = {
20031
20065
  reasoning: false,
20032
20066
  input: ["text", "image"],
20033
20067
  cost: {
20034
- input: 0.11,
20035
- output: 0.33999999999999997,
20036
- cacheRead: 0.055,
20068
+ input: 0.09999999999999999,
20069
+ output: 0.3,
20070
+ cacheRead: 0,
20037
20071
  cacheWrite: 0
20038
20072
  },
20039
20073
  contextWindow: 1310720,
20040
- maxTokens: 8192
20074
+ maxTokens: 16384
20041
20075
  },
20042
20076
  "meta/muse-glimmer-30b": {
20043
20077
  id: "meta/muse-glimmer-30b",
@@ -20057,13 +20091,13 @@ var MODELS = {
20057
20091
  },
20058
20092
  input: ["text", "image"],
20059
20093
  cost: {
20060
- input: 0.35,
20061
- output: 1.5,
20094
+ input: 0.3,
20095
+ output: 1.2,
20062
20096
  cacheRead: 0.04,
20063
20097
  cacheWrite: 0
20064
20098
  },
20065
20099
  contextWindow: 131072,
20066
- maxTokens: 117964
20100
+ maxTokens: 16384
20067
20101
  },
20068
20102
  "meta/muse-spark-1.1": {
20069
20103
  id: "meta/muse-spark-1.1",
@@ -20382,9 +20416,9 @@ var MODELS = {
20382
20416
  reasoning: false,
20383
20417
  input: ["text"],
20384
20418
  cost: {
20385
- input: 0.44,
20386
- output: 2.2,
20387
- cacheRead: 0.044,
20419
+ input: 0.39999999999999997,
20420
+ output: 2,
20421
+ cacheRead: 0.04,
20388
20422
  cacheWrite: 0
20389
20423
  },
20390
20424
  contextWindow: 262144,
@@ -20658,8 +20692,8 @@ var MODELS = {
20658
20692
  cacheRead: 0.01,
20659
20693
  cacheWrite: 0
20660
20694
  },
20661
- contextWindow: 32e3,
20662
- maxTokens: 25600
20695
+ contextWindow: 32768,
20696
+ maxTokens: 26214
20663
20697
  },
20664
20698
  "moonshotai/kimi-k2": {
20665
20699
  id: "moonshotai/kimi-k2",
@@ -20793,9 +20827,9 @@ var MODELS = {
20793
20827
  },
20794
20828
  input: ["text", "image"],
20795
20829
  cost: {
20796
- input: 0.67,
20830
+ input: 0.66,
20797
20831
  output: 3.4,
20798
- cacheRead: 0.19,
20832
+ cacheRead: 0.18,
20799
20833
  cacheWrite: 0
20800
20834
  },
20801
20835
  contextWindow: 262144,
@@ -20898,11 +20932,11 @@ var MODELS = {
20898
20932
  cost: {
20899
20933
  input: 0.049999999999999996,
20900
20934
  output: 0.19999999999999998,
20901
- cacheRead: 0.03,
20935
+ cacheRead: 0.024999999999999998,
20902
20936
  cacheWrite: 0
20903
20937
  },
20904
20938
  contextWindow: 262144,
20905
- maxTokens: 235929
20939
+ maxTokens: 228e3
20906
20940
  },
20907
20941
  "nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free": {
20908
20942
  id: "nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free",
@@ -20997,13 +21031,13 @@ var MODELS = {
20997
21031
  },
20998
21032
  input: ["text"],
20999
21033
  cost: {
21000
- input: 0.6,
21001
- output: 3.5999999999999996,
21002
- cacheRead: 0.19999999999999998,
21034
+ input: 0.5,
21035
+ output: 2.2,
21036
+ cacheRead: 0.09999999999999999,
21003
21037
  cacheWrite: 0
21004
21038
  },
21005
- contextWindow: 512288,
21006
- maxTokens: 461059
21039
+ contextWindow: 262144,
21040
+ maxTokens: 16384
21007
21041
  },
21008
21042
  "nvidia/nemotron-3-ultra-550b-a55b:free": {
21009
21043
  id: "nvidia/nemotron-3-ultra-550b-a55b:free",
@@ -22561,13 +22595,13 @@ var MODELS = {
22561
22595
  reasoning: false,
22562
22596
  input: ["text"],
22563
22597
  cost: {
22564
- input: 0.09,
22565
- output: 0.55,
22566
- cacheRead: 0,
22598
+ input: 0.0875,
22599
+ output: 0.35,
22600
+ cacheRead: 0.0175,
22567
22601
  cacheWrite: 0
22568
22602
  },
22569
22603
  contextWindow: 262144,
22570
- maxTokens: 16384
22604
+ maxTokens: 235929
22571
22605
  },
22572
22606
  "qwen/qwen3-235b-a22b-thinking-2507": {
22573
22607
  id: "qwen/qwen3-235b-a22b-thinking-2507",
@@ -22943,13 +22977,13 @@ var MODELS = {
22943
22977
  reasoning: false,
22944
22978
  input: ["text", "image"],
22945
22979
  cost: {
22946
- input: 0.13,
22947
- output: 0.52,
22980
+ input: 0.15,
22981
+ output: 0.6,
22948
22982
  cacheRead: 0,
22949
22983
  cacheWrite: 0
22950
22984
  },
22951
22985
  contextWindow: 262144,
22952
- maxTokens: 32768
22986
+ maxTokens: 16384
22953
22987
  },
22954
22988
  "qwen/qwen3-vl-30b-a3b-thinking": {
22955
22989
  id: "qwen/qwen3-vl-30b-a3b-thinking",
@@ -23057,13 +23091,13 @@ var MODELS = {
23057
23091
  },
23058
23092
  input: ["text", "image"],
23059
23093
  cost: {
23060
- input: 0.26,
23061
- output: 2.08,
23094
+ input: 0.29,
23095
+ output: 2.4,
23062
23096
  cacheRead: 0,
23063
23097
  cacheWrite: 0
23064
23098
  },
23065
23099
  contextWindow: 262144,
23066
- maxTokens: 235929
23100
+ maxTokens: 81920
23067
23101
  },
23068
23102
  "qwen/qwen3.5-27b": {
23069
23103
  id: "qwen/qwen3.5-27b",
@@ -23291,8 +23325,8 @@ var MODELS = {
23291
23325
  },
23292
23326
  input: ["text", "image"],
23293
23327
  cost: {
23294
- input: 0.14,
23295
- output: 1,
23328
+ input: 0.09999999999999999,
23329
+ output: 0.8999999999999999,
23296
23330
  cacheRead: 0.049999999999999996,
23297
23331
  cacheWrite: 0
23298
23332
  },
@@ -23479,7 +23513,7 @@ var MODELS = {
23479
23513
  cacheWrite: 0
23480
23514
  },
23481
23515
  contextWindow: 1048576,
23482
- maxTokens: 131072
23516
+ maxTokens: 262144
23483
23517
  },
23484
23518
  "qwen/qwen3.8-27b": {
23485
23519
  id: "qwen/qwen3.8-27b",
@@ -23506,6 +23540,32 @@ var MODELS = {
23506
23540
  contextWindow: 1e6,
23507
23541
  maxTokens: 131072
23508
23542
  },
23543
+ "qwen/qwen3.8-flash": {
23544
+ id: "qwen/qwen3.8-flash",
23545
+ name: "Qwen: Qwen3.8 Flash",
23546
+ api: "openai-completions",
23547
+ provider: "openrouter",
23548
+ baseUrl: "https://openrouter.ai/api/v1",
23549
+ compat: { "supportsReasoningEffort": false },
23550
+ reasoning: true,
23551
+ thinkingLevelMap: {
23552
+ "minimal": null,
23553
+ "low": null,
23554
+ "medium": null,
23555
+ "high": "high",
23556
+ "xhigh": null,
23557
+ "max": null
23558
+ },
23559
+ input: ["text", "image"],
23560
+ cost: {
23561
+ input: 0.15,
23562
+ output: 0.47,
23563
+ cacheRead: 0.016,
23564
+ cacheWrite: 0.19999999999999998
23565
+ },
23566
+ contextWindow: 1e6,
23567
+ maxTokens: 131072
23568
+ },
23509
23569
  "qwen/qwen3.8-max": {
23510
23570
  id: "qwen/qwen3.8-max",
23511
23571
  name: "Qwen: Qwen3.8 Max",
@@ -23634,32 +23694,6 @@ var MODELS = {
23634
23694
  contextWindow: 131072,
23635
23695
  maxTokens: 16384
23636
23696
  },
23637
- "stealth/ox-alpha": {
23638
- id: "stealth/ox-alpha",
23639
- name: "Ox Alpha",
23640
- api: "openai-completions",
23641
- provider: "openrouter",
23642
- baseUrl: "https://openrouter.ai/api/v1",
23643
- reasoning: true,
23644
- thinkingLevelMap: {
23645
- "off": null,
23646
- "minimal": null,
23647
- "low": "low",
23648
- "medium": null,
23649
- "high": "high",
23650
- "xhigh": null,
23651
- "max": "max"
23652
- },
23653
- input: ["text", "image"],
23654
- cost: {
23655
- input: 0,
23656
- output: 0,
23657
- cacheRead: 0,
23658
- cacheWrite: 0
23659
- },
23660
- contextWindow: 1048576,
23661
- maxTokens: 131072
23662
- },
23663
23697
  "stepfun/step-3.5-flash": {
23664
23698
  id: "stepfun/step-3.5-flash",
23665
23699
  name: "StepFun: Step 3.5 Flash",
@@ -23730,9 +23764,9 @@ var MODELS = {
23730
23764
  },
23731
23765
  input: ["text"],
23732
23766
  cost: {
23733
- input: 0.13199999999999998,
23734
- output: 0.5279999999999999,
23735
- cacheRead: 0.032999999999999995,
23767
+ input: 0.0825,
23768
+ output: 0.33,
23769
+ cacheRead: 0.020625,
23736
23770
  cacheWrite: 0
23737
23771
  },
23738
23772
  contextWindow: 262144,
@@ -23763,6 +23797,31 @@ var MODELS = {
23763
23797
  contextWindow: 262144,
23764
23798
  maxTokens: 235929
23765
23799
  },
23800
+ "tencent/hy4-preview": {
23801
+ id: "tencent/hy4-preview",
23802
+ name: "Tencent: Hy4 preview",
23803
+ api: "openai-completions",
23804
+ provider: "openrouter",
23805
+ baseUrl: "https://openrouter.ai/api/v1",
23806
+ reasoning: true,
23807
+ thinkingLevelMap: {
23808
+ "minimal": null,
23809
+ "low": "low",
23810
+ "medium": null,
23811
+ "high": "high",
23812
+ "xhigh": null,
23813
+ "max": null
23814
+ },
23815
+ input: ["text"],
23816
+ cost: {
23817
+ input: 0.834,
23818
+ output: 2.501,
23819
+ cacheRead: 0.041999999999999996,
23820
+ cacheWrite: 0
23821
+ },
23822
+ contextWindow: 1048576,
23823
+ maxTokens: 64e3
23824
+ },
23766
23825
  "thedrummer/unslopnemo-12b": {
23767
23826
  id: "thedrummer/unslopnemo-12b",
23768
23827
  name: "TheDrummer: UnslopNemo 12B",
@@ -23797,13 +23856,13 @@ var MODELS = {
23797
23856
  },
23798
23857
  input: ["text", "image"],
23799
23858
  cost: {
23800
- input: 0.95,
23859
+ input: 1,
23801
23860
  output: 4.05,
23802
- cacheRead: 0.16,
23861
+ cacheRead: 0.16999999999999998,
23803
23862
  cacheWrite: 0
23804
23863
  },
23805
23864
  contextWindow: 1048576,
23806
- maxTokens: 262144
23865
+ maxTokens: 471859
23807
23866
  },
23808
23867
  "thinkingmachines/inkling-small": {
23809
23868
  id: "thinkingmachines/inkling-small",
@@ -24210,13 +24269,13 @@ var MODELS = {
24210
24269
  },
24211
24270
  input: ["text"],
24212
24271
  cost: {
24213
- input: 0.5,
24214
- output: 2,
24215
- cacheRead: 0.09999999999999999,
24272
+ input: 0.43,
24273
+ output: 1.75,
24274
+ cacheRead: 0.08,
24216
24275
  cacheWrite: 0
24217
24276
  },
24218
24277
  contextWindow: 204800,
24219
- maxTokens: 131072
24278
+ maxTokens: 16384
24220
24279
  },
24221
24280
  "z-ai/glm-4.6v": {
24222
24281
  id: "z-ai/glm-4.6v",
@@ -24366,13 +24425,13 @@ var MODELS = {
24366
24425
  },
24367
24426
  input: ["text"],
24368
24427
  cost: {
24369
- input: 1.26,
24370
- output: 3.9600000000000004,
24371
- cacheRead: 0.234,
24428
+ input: 0.966,
24429
+ output: 3.036,
24430
+ cacheRead: 0.1794,
24372
24431
  cacheWrite: 0
24373
24432
  },
24374
24433
  contextWindow: 204800,
24375
- maxTokens: 182476
24434
+ maxTokens: 128e3
24376
24435
  },
24377
24436
  "z-ai/glm-5.2": {
24378
24437
  id: "z-ai/glm-5.2",
@@ -24447,7 +24506,33 @@ var MODELS = {
24447
24506
  cacheRead: 0.26,
24448
24507
  cacheWrite: 0
24449
24508
  },
24450
- contextWindow: 1048576,
24509
+ contextWindow: 1310720,
24510
+ maxTokens: 131072
24511
+ },
24512
+ "z-ai/glm-5.3-flash": {
24513
+ id: "z-ai/glm-5.3-flash",
24514
+ name: "Z.ai: GLM 5.3 Flash",
24515
+ api: "openai-completions",
24516
+ provider: "openrouter",
24517
+ baseUrl: "https://openrouter.ai/api/v1",
24518
+ reasoning: true,
24519
+ thinkingLevelMap: {
24520
+ "off": null,
24521
+ "minimal": null,
24522
+ "low": "low",
24523
+ "medium": null,
24524
+ "high": "high",
24525
+ "xhigh": null,
24526
+ "max": "max"
24527
+ },
24528
+ input: ["text", "image"],
24529
+ cost: {
24530
+ input: 0.075,
24531
+ output: 0.25,
24532
+ cacheRead: 0.015,
24533
+ cacheWrite: 0
24534
+ },
24535
+ contextWindow: 1310720,
24451
24536
  maxTokens: 131072
24452
24537
  },
24453
24538
  "z-ai/glm-5v-turbo": {
@@ -24599,9 +24684,9 @@ var MODELS = {
24599
24684
  },
24600
24685
  input: ["text"],
24601
24686
  cost: {
24602
- input: 0.03,
24603
- output: 0.075,
24604
- cacheRead: 7e-3,
24687
+ input: 0.049980000000000004,
24688
+ output: 0.09996000000000001,
24689
+ cacheRead: 0.009996000000000001,
24605
24690
  cacheWrite: 0
24606
24691
  },
24607
24692
  contextWindow: 1310720,
@@ -24625,10 +24710,10 @@ var MODELS = {
24625
24710
  },
24626
24711
  input: ["text", "image"],
24627
24712
  cost: {
24628
- input: 0.375,
24629
- output: 1.875,
24630
- cacheRead: 0.0375,
24631
- cacheWrite: 0.0208333333333333
24713
+ input: 0.75,
24714
+ output: 3.75,
24715
+ cacheRead: 0.075,
24716
+ cacheWrite: 0.0416666666666667
24632
24717
  },
24633
24718
  contextWindow: 1048576,
24634
24719
  maxTokens: 65536
@@ -24778,13 +24863,13 @@ var MODELS = {
24778
24863
  },
24779
24864
  input: ["text"],
24780
24865
  cost: {
24781
- input: 1.4,
24782
- output: 4.4,
24783
- cacheRead: 0.26,
24866
+ input: 1.17,
24867
+ output: 3.9600000000000004,
24868
+ cacheRead: 0.234,
24784
24869
  cacheWrite: 0
24785
24870
  },
24786
- contextWindow: 1048576,
24787
- maxTokens: 131072
24871
+ contextWindow: 1310720,
24872
+ maxTokens: 943718
24788
24873
  }
24789
24874
  },
24790
24875
  "prime-inference": {
@@ -25202,8 +25287,8 @@ var MODELS = {
25202
25287
  reasoning: false,
25203
25288
  input: ["text"],
25204
25289
  cost: {
25205
- input: 0.5,
25206
- output: 1.5,
25290
+ input: 0.4,
25291
+ output: 1.3,
25207
25292
  cacheRead: 0,
25208
25293
  cacheWrite: 0
25209
25294
  },
@@ -25226,8 +25311,8 @@ var MODELS = {
25226
25311
  reasoning: false,
25227
25312
  input: ["text"],
25228
25313
  cost: {
25229
- input: 1.25,
25230
- output: 1.5,
25314
+ input: 0.27,
25315
+ output: 1.12,
25231
25316
  cacheRead: 0,
25232
25317
  cacheWrite: 0
25233
25318
  },
@@ -25259,8 +25344,8 @@ var MODELS = {
25259
25344
  },
25260
25345
  input: ["text"],
25261
25346
  cost: {
25262
- input: 0.56,
25263
- output: 1.68,
25347
+ input: 0.6,
25348
+ output: 1.7,
25264
25349
  cacheRead: 0,
25265
25350
  cacheWrite: 0
25266
25351
  },
@@ -25292,8 +25377,8 @@ var MODELS = {
25292
25377
  },
25293
25378
  input: ["text"],
25294
25379
  cost: {
25295
- input: 0.45,
25296
- output: 1.5,
25380
+ input: 0.27,
25381
+ output: 1,
25297
25382
  cacheRead: 0,
25298
25383
  cacheWrite: 0
25299
25384
  },
@@ -25325,13 +25410,13 @@ var MODELS = {
25325
25410
  },
25326
25411
  input: ["text"],
25327
25412
  cost: {
25328
- input: 0.28,
25329
- output: 0.42,
25413
+ input: 0.3705,
25414
+ output: 1.1115,
25330
25415
  cacheRead: 0,
25331
25416
  cacheWrite: 0
25332
25417
  },
25333
25418
  contextWindow: 163840,
25334
- maxTokens: 147456,
25419
+ maxTokens: 65536,
25335
25420
  featured: true
25336
25421
  },
25337
25422
  "deepseek/deepseek-v3.2-exp": {
@@ -25359,8 +25444,8 @@ var MODELS = {
25359
25444
  },
25360
25445
  input: ["text"],
25361
25446
  cost: {
25362
- input: 0.28,
25363
- output: 0.42,
25447
+ input: 0.27,
25448
+ output: 0.41,
25364
25449
  cacheRead: 0,
25365
25450
  cacheWrite: 0
25366
25451
  },
@@ -25393,8 +25478,8 @@ var MODELS = {
25393
25478
  },
25394
25479
  input: ["text"],
25395
25480
  cost: {
25396
- input: 0.14,
25397
- output: 0.28,
25481
+ input: 0.44,
25482
+ output: 1.32,
25398
25483
  cacheRead: 0,
25399
25484
  cacheWrite: 0
25400
25485
  },
@@ -25428,8 +25513,8 @@ var MODELS = {
25428
25513
  },
25429
25514
  input: ["text"],
25430
25515
  cost: {
25431
- input: 0.14,
25432
- output: 0.28,
25516
+ input: 0.44,
25517
+ output: 1.32,
25433
25518
  cacheRead: 0,
25434
25519
  cacheWrite: 0
25435
25520
  },
@@ -25462,13 +25547,13 @@ var MODELS = {
25462
25547
  },
25463
25548
  input: ["text"],
25464
25549
  cost: {
25465
- input: 2.1,
25466
- output: 4.4,
25550
+ input: 1.91,
25551
+ output: 3.83,
25467
25552
  cacheRead: 0,
25468
25553
  cacheWrite: 0
25469
25554
  },
25470
25555
  contextWindow: 1048576,
25471
- maxTokens: 384e3,
25556
+ maxTokens: 393216,
25472
25557
  featured: true
25473
25558
  },
25474
25559
  "google/gemini-2.5-flash": {
@@ -25702,6 +25787,39 @@ var MODELS = {
25702
25787
  contextWindow: 1048576,
25703
25788
  maxTokens: 65536
25704
25789
  },
25790
+ "google/gemini-3.7-flash": {
25791
+ id: "google/gemini-3.7-flash",
25792
+ name: "Gemini 3.7 Flash",
25793
+ api: "openai-completions",
25794
+ provider: "prime-inference",
25795
+ baseUrl: "https://api.pinference.ai/api/v1",
25796
+ compat: {
25797
+ "supportsStore": false,
25798
+ "supportsDeveloperRole": false,
25799
+ "supportsReasoningEffort": true,
25800
+ "maxTokensField": "max_tokens",
25801
+ "supportsStrictMode": false
25802
+ },
25803
+ reasoning: true,
25804
+ thinkingLevelMap: {
25805
+ "off": null,
25806
+ "minimal": null,
25807
+ "low": "low",
25808
+ "medium": "medium",
25809
+ "high": "high",
25810
+ "xhigh": null,
25811
+ "max": null
25812
+ },
25813
+ input: ["text", "image"],
25814
+ cost: {
25815
+ input: 1.35,
25816
+ output: 6.75,
25817
+ cacheRead: 0,
25818
+ cacheWrite: 0
25819
+ },
25820
+ contextWindow: 1048576,
25821
+ maxTokens: 65536
25822
+ },
25705
25823
  "google/gemma-3-27b-it": {
25706
25824
  id: "google/gemma-3-27b-it",
25707
25825
  name: "Gemma 3 27B IT",
@@ -25723,7 +25841,7 @@ var MODELS = {
25723
25841
  cacheRead: 0,
25724
25842
  cacheWrite: 0
25725
25843
  },
25726
- contextWindow: 262144,
25844
+ contextWindow: 131072,
25727
25845
  maxTokens: 117964
25728
25846
  },
25729
25847
  "meta-llama/Llama-3.2-1B-Instruct": {
@@ -25742,8 +25860,8 @@ var MODELS = {
25742
25860
  reasoning: false,
25743
25861
  input: ["text"],
25744
25862
  cost: {
25745
- input: 0.03,
25746
- output: 0.21,
25863
+ input: 0.027,
25864
+ output: 0.201,
25747
25865
  cacheRead: 0,
25748
25866
  cacheWrite: 0
25749
25867
  },
@@ -25766,8 +25884,8 @@ var MODELS = {
25766
25884
  reasoning: false,
25767
25885
  input: ["text"],
25768
25886
  cost: {
25769
- input: 0.1,
25770
- output: 0.34,
25887
+ input: 0.0509,
25888
+ output: 0.335,
25771
25889
  cacheRead: 0,
25772
25890
  cacheWrite: 0
25773
25891
  },
@@ -25790,8 +25908,8 @@ var MODELS = {
25790
25908
  reasoning: false,
25791
25909
  input: ["text"],
25792
25910
  cost: {
25793
- input: 0.9,
25794
- output: 0.9,
25911
+ input: 1.04,
25912
+ output: 2.253,
25795
25913
  cacheRead: 0,
25796
25914
  cacheWrite: 0
25797
25915
  },
@@ -25814,13 +25932,46 @@ var MODELS = {
25814
25932
  reasoning: false,
25815
25933
  input: ["text", "image"],
25816
25934
  cost: {
25817
- input: 0.27,
25818
- output: 0.88,
25935
+ input: 0.35,
25936
+ output: 1.15,
25819
25937
  cacheRead: 0,
25820
25938
  cacheWrite: 0
25821
25939
  },
25822
25940
  contextWindow: 1048576,
25823
- maxTokens: 16384
25941
+ maxTokens: 115200
25942
+ },
25943
+ "meta/muse-spark-1.2": {
25944
+ id: "meta/muse-spark-1.2",
25945
+ name: "Muse Spark 1.2",
25946
+ api: "openai-completions",
25947
+ provider: "prime-inference",
25948
+ baseUrl: "https://api.pinference.ai/api/v1",
25949
+ compat: {
25950
+ "supportsStore": false,
25951
+ "supportsDeveloperRole": false,
25952
+ "supportsReasoningEffort": true,
25953
+ "maxTokensField": "max_tokens",
25954
+ "supportsStrictMode": false
25955
+ },
25956
+ reasoning: true,
25957
+ thinkingLevelMap: {
25958
+ "off": null,
25959
+ "minimal": "minimal",
25960
+ "low": "low",
25961
+ "medium": "medium",
25962
+ "high": "high",
25963
+ "xhigh": "xhigh",
25964
+ "max": null
25965
+ },
25966
+ input: ["text", "image"],
25967
+ cost: {
25968
+ input: 1.25,
25969
+ output: 4.25,
25970
+ cacheRead: 0,
25971
+ cacheWrite: 0
25972
+ },
25973
+ contextWindow: 1048576,
25974
+ maxTokens: 943718
25824
25975
  },
25825
25976
  "minimax/minimax-m2.5": {
25826
25977
  id: "minimax/minimax-m2.5",
@@ -25848,8 +25999,8 @@ var MODELS = {
25848
25999
  },
25849
26000
  input: ["text"],
25850
26001
  cost: {
25851
- input: 0.3,
25852
- output: 1.2,
26002
+ input: 0.6,
26003
+ output: 2.4,
25853
26004
  cacheRead: 0,
25854
26005
  cacheWrite: 0
25855
26006
  },
@@ -25964,8 +26115,8 @@ var MODELS = {
25964
26115
  reasoning: false,
25965
26116
  input: ["text"],
25966
26117
  cost: {
25967
- input: 0.1,
25968
- output: 0.25,
26118
+ input: 0.165,
26119
+ output: 0.17,
25969
26120
  cacheRead: 0,
25970
26121
  cacheWrite: 0
25971
26122
  },
@@ -25996,8 +26147,8 @@ var MODELS = {
25996
26147
  },
25997
26148
  input: ["text", "image"],
25998
26149
  cost: {
25999
- input: 0.1875,
26000
- output: 0.75,
26150
+ input: 0.165,
26151
+ output: 0.66,
26001
26152
  cacheRead: 0,
26002
26153
  cacheWrite: 0
26003
26154
  },
@@ -26020,8 +26171,8 @@ var MODELS = {
26020
26171
  reasoning: false,
26021
26172
  input: ["text"],
26022
26173
  cost: {
26023
- input: 2,
26024
- output: 6,
26174
+ input: 2.2,
26175
+ output: 6.6,
26025
26176
  cacheRead: 0,
26026
26177
  cacheWrite: 0
26027
26178
  },
@@ -26044,8 +26195,8 @@ var MODELS = {
26044
26195
  reasoning: false,
26045
26196
  input: ["text"],
26046
26197
  cost: {
26047
- input: 1.2,
26048
- output: 5,
26198
+ input: 0.6,
26199
+ output: 2.5,
26049
26200
  cacheRead: 0,
26050
26201
  cacheWrite: 0
26051
26202
  },
@@ -26078,7 +26229,7 @@ var MODELS = {
26078
26229
  input: ["text", "image"],
26079
26230
  cost: {
26080
26231
  input: 0.6,
26081
- output: 3.2,
26232
+ output: 3,
26082
26233
  cacheRead: 0,
26083
26234
  cacheWrite: 0
26084
26235
  },
@@ -26144,8 +26295,8 @@ var MODELS = {
26144
26295
  },
26145
26296
  input: ["text", "image"],
26146
26297
  cost: {
26147
- input: 1.0925,
26148
- output: 4.6,
26298
+ input: 1.9,
26299
+ output: 8,
26149
26300
  cacheRead: 0,
26150
26301
  cacheWrite: 0
26151
26302
  },
@@ -26177,8 +26328,8 @@ var MODELS = {
26177
26328
  },
26178
26329
  input: ["text", "image"],
26179
26330
  cost: {
26180
- input: 3,
26181
- output: 15,
26331
+ input: 3.45,
26332
+ output: 17.25,
26182
26333
  cacheRead: 0,
26183
26334
  cacheWrite: 0
26184
26335
  },
@@ -26211,13 +26362,13 @@ var MODELS = {
26211
26362
  },
26212
26363
  input: ["text"],
26213
26364
  cost: {
26214
- input: 0.05,
26215
- output: 0.2,
26365
+ input: 0.06,
26366
+ output: 0.24,
26216
26367
  cacheRead: 0,
26217
26368
  cacheWrite: 0
26218
26369
  },
26219
26370
  contextWindow: 262144,
26220
- maxTokens: 235929,
26371
+ maxTokens: 228e3,
26221
26372
  featured: true
26222
26373
  },
26223
26374
  "nvidia/nemotron-3-super-120b-a12b": {
@@ -26245,7 +26396,7 @@ var MODELS = {
26245
26396
  input: ["text"],
26246
26397
  cost: {
26247
26398
  input: 0.3,
26248
- output: 0.9,
26399
+ output: 0.65,
26249
26400
  cacheRead: 0,
26250
26401
  cacheWrite: 0
26251
26402
  },
@@ -26536,31 +26687,6 @@ var MODELS = {
26536
26687
  contextWindow: 4e5,
26537
26688
  maxTokens: 128e3
26538
26689
  },
26539
- "openai/gpt-5.2-chat": {
26540
- id: "openai/gpt-5.2-chat",
26541
- name: "GPT 5.2 Chat",
26542
- api: "openai-completions",
26543
- provider: "prime-inference",
26544
- baseUrl: "https://api.pinference.ai/api/v1",
26545
- compat: {
26546
- "supportsStore": false,
26547
- "supportsDeveloperRole": false,
26548
- "supportsReasoningEffort": true,
26549
- "maxTokensField": "max_tokens",
26550
- "supportsStrictMode": false
26551
- },
26552
- reasoning: false,
26553
- thinkingLevelMap: { "xhigh": "xhigh" },
26554
- input: ["text", "image"],
26555
- cost: {
26556
- input: 1.75,
26557
- output: 14,
26558
- cacheRead: 0,
26559
- cacheWrite: 0
26560
- },
26561
- contextWindow: 128e3,
26562
- maxTokens: 32e3
26563
- },
26564
26690
  "openai/gpt-5.2-pro": {
26565
26691
  id: "openai/gpt-5.2-pro",
26566
26692
  name: "GPT 5.2 PRO",
@@ -26845,8 +26971,8 @@ var MODELS = {
26845
26971
  },
26846
26972
  input: ["text", "image"],
26847
26973
  cost: {
26848
- input: 1,
26849
- output: 6,
26974
+ input: 0.2,
26975
+ output: 1.2,
26850
26976
  cacheRead: 0,
26851
26977
  cacheWrite: 0
26852
26978
  },
@@ -27038,8 +27164,8 @@ var MODELS = {
27038
27164
  },
27039
27165
  input: ["text"],
27040
27166
  cost: {
27041
- input: 0.15,
27042
- output: 0.6,
27167
+ input: 0.35,
27168
+ output: 0.75,
27043
27169
  cacheRead: 0,
27044
27170
  cacheWrite: 0
27045
27171
  },
@@ -27104,8 +27230,8 @@ var MODELS = {
27104
27230
  },
27105
27231
  input: ["text"],
27106
27232
  cost: {
27107
- input: 0.1,
27108
- output: 0.19,
27233
+ input: 0.09,
27234
+ output: 0.18,
27109
27235
  cacheRead: 0,
27110
27236
  cacheWrite: 0
27111
27237
  },
@@ -27137,8 +27263,8 @@ var MODELS = {
27137
27263
  },
27138
27264
  input: ["text"],
27139
27265
  cost: {
27140
- input: 0.065,
27141
- output: 0.13,
27266
+ input: 0.06,
27267
+ output: 0.12,
27142
27268
  cacheRead: 0,
27143
27269
  cacheWrite: 0
27144
27270
  },
@@ -27161,13 +27287,13 @@ var MODELS = {
27161
27287
  reasoning: false,
27162
27288
  input: ["text"],
27163
27289
  cost: {
27164
- input: 0.22,
27165
- output: 0.88,
27290
+ input: 0.25,
27291
+ output: 1,
27166
27292
  cacheRead: 0,
27167
27293
  cacheWrite: 0
27168
27294
  },
27169
27295
  contextWindow: 262144,
27170
- maxTokens: 16384
27296
+ maxTokens: 235929
27171
27297
  },
27172
27298
  "qwen/qwen3-30b-a3b-instruct-2507": {
27173
27299
  id: "qwen/qwen3-30b-a3b-instruct-2507",
@@ -27185,8 +27311,8 @@ var MODELS = {
27185
27311
  reasoning: false,
27186
27312
  input: ["text"],
27187
27313
  cost: {
27188
- input: 0.2,
27189
- output: 0.8,
27314
+ input: 0.13,
27315
+ output: 0.52,
27190
27316
  cacheRead: 0,
27191
27317
  cacheWrite: 0
27192
27318
  },
@@ -27243,7 +27369,7 @@ var MODELS = {
27243
27369
  reasoning: false,
27244
27370
  input: ["text"],
27245
27371
  cost: {
27246
- input: 2,
27372
+ input: 0.975,
27247
27373
  output: 4.875,
27248
27374
  cacheRead: 0,
27249
27375
  cacheWrite: 0
@@ -27267,7 +27393,7 @@ var MODELS = {
27267
27393
  reasoning: false,
27268
27394
  input: ["text"],
27269
27395
  cost: {
27270
- input: 0.5,
27396
+ input: 0.3,
27271
27397
  output: 1.5,
27272
27398
  cacheRead: 0,
27273
27399
  cacheWrite: 0
@@ -27317,8 +27443,8 @@ var MODELS = {
27317
27443
  reasoning: false,
27318
27444
  input: ["text", "image"],
27319
27445
  cost: {
27320
- input: 0.4,
27321
- output: 1.9,
27446
+ input: 0.3,
27447
+ output: 1.5,
27322
27448
  cacheRead: 0,
27323
27449
  cacheWrite: 0
27324
27450
  },
@@ -27351,7 +27477,7 @@ var MODELS = {
27351
27477
  },
27352
27478
  input: ["text", "image"],
27353
27479
  cost: {
27354
- input: 1,
27480
+ input: 0.98,
27355
27481
  output: 4,
27356
27482
  cacheRead: 0,
27357
27483
  cacheWrite: 0
@@ -27376,13 +27502,13 @@ var MODELS = {
27376
27502
  reasoning: false,
27377
27503
  input: ["text", "image"],
27378
27504
  cost: {
27379
- input: 0.25,
27380
- output: 1,
27505
+ input: 0.2,
27506
+ output: 0.7,
27381
27507
  cacheRead: 0,
27382
27508
  cacheWrite: 0
27383
27509
  },
27384
27510
  contextWindow: 262144,
27385
- maxTokens: 32768
27511
+ maxTokens: 16384
27386
27512
  },
27387
27513
  "qwen/qwen3-vl-8b-instruct": {
27388
27514
  id: "qwen/qwen3-vl-8b-instruct",
@@ -27400,8 +27526,8 @@ var MODELS = {
27400
27526
  reasoning: false,
27401
27527
  input: ["text", "image"],
27402
27528
  cost: {
27403
- input: 0.18,
27404
- output: 0.7,
27529
+ input: 0.117,
27530
+ output: 0.455,
27405
27531
  cacheRead: 0,
27406
27532
  cacheWrite: 0
27407
27533
  },
@@ -27433,8 +27559,8 @@ var MODELS = {
27433
27559
  },
27434
27560
  input: ["text", "image"],
27435
27561
  cost: {
27436
- input: 0.3125,
27437
- output: 1.8,
27562
+ input: 0.25,
27563
+ output: 1.3,
27438
27564
  cacheRead: 0,
27439
27565
  cacheWrite: 0
27440
27566
  },
@@ -27532,8 +27658,8 @@ var MODELS = {
27532
27658
  },
27533
27659
  input: ["text", "image"],
27534
27660
  cost: {
27535
- input: 0.3,
27536
- output: 1.8,
27661
+ input: 0.25,
27662
+ output: 1.25,
27537
27663
  cacheRead: 0,
27538
27664
  cacheWrite: 0
27539
27665
  },
@@ -27675,6 +27801,39 @@ var MODELS = {
27675
27801
  maxTokens: 3e4,
27676
27802
  featured: true
27677
27803
  },
27804
+ "x-ai/grok-4.6": {
27805
+ id: "x-ai/grok-4.6",
27806
+ name: "Grok 4.6",
27807
+ api: "openai-completions",
27808
+ provider: "prime-inference",
27809
+ baseUrl: "https://api.pinference.ai/api/v1",
27810
+ compat: {
27811
+ "supportsStore": false,
27812
+ "supportsDeveloperRole": false,
27813
+ "supportsReasoningEffort": true,
27814
+ "maxTokensField": "max_tokens",
27815
+ "supportsStrictMode": false
27816
+ },
27817
+ reasoning: true,
27818
+ thinkingLevelMap: {
27819
+ "off": null,
27820
+ "minimal": null,
27821
+ "low": "low",
27822
+ "medium": "medium",
27823
+ "high": "high",
27824
+ "xhigh": "xhigh",
27825
+ "max": null
27826
+ },
27827
+ input: ["text", "image"],
27828
+ cost: {
27829
+ input: 2,
27830
+ output: 6,
27831
+ cacheRead: 0,
27832
+ cacheWrite: 0
27833
+ },
27834
+ contextWindow: 5e5,
27835
+ maxTokens: 45e4
27836
+ },
27678
27837
  "xiaomi/mimo-v2.5": {
27679
27838
  id: "xiaomi/mimo-v2.5",
27680
27839
  name: "Mimo V2.5",
@@ -27700,8 +27859,8 @@ var MODELS = {
27700
27859
  },
27701
27860
  input: ["text", "image"],
27702
27861
  cost: {
27703
- input: 0.4,
27704
- output: 2,
27862
+ input: 0.168,
27863
+ output: 0.336,
27705
27864
  cacheRead: 0,
27706
27865
  cacheWrite: 0
27707
27866
  },
@@ -27733,8 +27892,8 @@ var MODELS = {
27733
27892
  },
27734
27893
  input: ["text"],
27735
27894
  cost: {
27736
- input: 1,
27737
- output: 3,
27895
+ input: 0.48024,
27896
+ output: 1.5,
27738
27897
  cacheRead: 0,
27739
27898
  cacheWrite: 0
27740
27899
  },
@@ -27838,41 +27997,41 @@ var MODELS = {
27838
27997
  cacheWrite: 0
27839
27998
  },
27840
27999
  contextWindow: 204800,
28000
+ maxTokens: 16384
28001
+ },
28002
+ "z-ai/glm-4.7": {
28003
+ id: "z-ai/glm-4.7",
28004
+ name: "GLM 4.7",
28005
+ api: "openai-completions",
28006
+ provider: "prime-inference",
28007
+ baseUrl: "https://api.pinference.ai/api/v1",
28008
+ compat: {
28009
+ "supportsStore": false,
28010
+ "supportsDeveloperRole": false,
28011
+ "supportsReasoningEffort": false,
28012
+ "maxTokensField": "max_tokens",
28013
+ "supportsStrictMode": false,
28014
+ "thinkingFormat": "zai"
28015
+ },
28016
+ reasoning: true,
28017
+ thinkingLevelMap: {
28018
+ "minimal": null,
28019
+ "low": null,
28020
+ "medium": null,
28021
+ "high": "high",
28022
+ "xhigh": null,
28023
+ "max": null
28024
+ },
28025
+ input: ["text"],
28026
+ cost: {
28027
+ input: 0.6,
28028
+ output: 2.2,
28029
+ cacheRead: 0,
28030
+ cacheWrite: 0
28031
+ },
28032
+ contextWindow: 204800,
27841
28033
  maxTokens: 131072
27842
28034
  },
27843
- "z-ai/glm-4.7": {
27844
- id: "z-ai/glm-4.7",
27845
- name: "GLM 4.7",
27846
- api: "openai-completions",
27847
- provider: "prime-inference",
27848
- baseUrl: "https://api.pinference.ai/api/v1",
27849
- compat: {
27850
- "supportsStore": false,
27851
- "supportsDeveloperRole": false,
27852
- "supportsReasoningEffort": false,
27853
- "maxTokensField": "max_tokens",
27854
- "supportsStrictMode": false,
27855
- "thinkingFormat": "zai"
27856
- },
27857
- reasoning: true,
27858
- thinkingLevelMap: {
27859
- "minimal": null,
27860
- "low": null,
27861
- "medium": null,
27862
- "high": "high",
27863
- "xhigh": null,
27864
- "max": null
27865
- },
27866
- input: ["text"],
27867
- cost: {
27868
- input: 0.6,
27869
- output: 2.65,
27870
- cacheRead: 0,
27871
- cacheWrite: 0
27872
- },
27873
- contextWindow: 204800,
27874
- maxTokens: 131072
27875
- },
27876
28035
  "z-ai/glm-4.7-flash": {
27877
28036
  id: "z-ai/glm-4.7-flash",
27878
28037
  name: "GLM 4.7 Flash",
@@ -27898,8 +28057,8 @@ var MODELS = {
27898
28057
  },
27899
28058
  input: ["text"],
27900
28059
  cost: {
27901
- input: 0.1,
27902
- output: 0.43,
28060
+ input: 0.07,
28061
+ output: 0.4,
27903
28062
  cacheRead: 0,
27904
28063
  cacheWrite: 0
27905
28064
  },
@@ -27931,8 +28090,8 @@ var MODELS = {
27931
28090
  },
27932
28091
  input: ["text"],
27933
28092
  cost: {
27934
- input: 1.2,
27935
- output: 3.5,
28093
+ input: 1,
28094
+ output: 3.2,
27936
28095
  cacheRead: 0,
27937
28096
  cacheWrite: 0
27938
28097
  },
@@ -27965,13 +28124,13 @@ var MODELS = {
27965
28124
  },
27966
28125
  input: ["text"],
27967
28126
  cost: {
27968
- input: 1.75,
27969
- output: 5.5,
28127
+ input: 1.4,
28128
+ output: 4.4,
27970
28129
  cacheRead: 0,
27971
28130
  cacheWrite: 0
27972
28131
  },
27973
28132
  contextWindow: 204800,
27974
- maxTokens: 182476,
28133
+ maxTokens: 128e3,
27975
28134
  featured: true
27976
28135
  },
27977
28136
  "z-ai/glm-5.2": {
@@ -27999,8 +28158,8 @@ var MODELS = {
27999
28158
  },
28000
28159
  input: ["text"],
28001
28160
  cost: {
28002
- input: 1.68,
28003
- output: 5.28,
28161
+ input: 1.54,
28162
+ output: 4.84,
28004
28163
  cacheRead: 0,
28005
28164
  cacheWrite: 0
28006
28165
  },
@@ -28039,7 +28198,41 @@ var MODELS = {
28039
28198
  cacheRead: 0,
28040
28199
  cacheWrite: 0
28041
28200
  },
28042
- contextWindow: 1048576,
28201
+ contextWindow: 1310720,
28202
+ maxTokens: 131072
28203
+ },
28204
+ "z-ai/glm-5.3-flash": {
28205
+ id: "z-ai/glm-5.3-flash",
28206
+ name: "GLM 5.3 Flash",
28207
+ api: "openai-completions",
28208
+ provider: "prime-inference",
28209
+ baseUrl: "https://api.pinference.ai/api/v1",
28210
+ compat: {
28211
+ "supportsStore": false,
28212
+ "supportsDeveloperRole": false,
28213
+ "supportsReasoningEffort": false,
28214
+ "maxTokensField": "max_tokens",
28215
+ "supportsStrictMode": false,
28216
+ "thinkingFormat": "zai"
28217
+ },
28218
+ reasoning: true,
28219
+ thinkingLevelMap: {
28220
+ "off": null,
28221
+ "minimal": null,
28222
+ "low": "low",
28223
+ "medium": null,
28224
+ "high": "high",
28225
+ "xhigh": null,
28226
+ "max": "max"
28227
+ },
28228
+ input: ["text", "image"],
28229
+ cost: {
28230
+ input: 0.15,
28231
+ output: 0.5,
28232
+ cacheRead: 0,
28233
+ cacheWrite: 0
28234
+ },
28235
+ contextWindow: 1310720,
28043
28236
  maxTokens: 131072
28044
28237
  }
28045
28238
  },
@@ -28480,11 +28673,11 @@ var MODELS = {
28480
28673
  cost: {
28481
28674
  input: 2,
28482
28675
  output: 6,
28483
- cacheRead: 0.19999999999999998,
28676
+ cacheRead: 0.25,
28484
28677
  cacheWrite: 0
28485
28678
  },
28486
28679
  contextWindow: 262144,
28487
- maxTokens: 131072
28680
+ maxTokens: 128e3
28488
28681
  },
28489
28682
  "alibaba/qwen3.8-27b": {
28490
28683
  id: "alibaba/qwen3.8-27b",
@@ -28495,14 +28688,48 @@ var MODELS = {
28495
28688
  reasoning: true,
28496
28689
  input: ["text", "image"],
28497
28690
  cost: {
28498
- input: 0.55,
28499
- output: 3.3000000000000003,
28500
- cacheRead: 0.11,
28501
- cacheWrite: 0
28691
+ input: 0.5,
28692
+ output: 3,
28693
+ cacheRead: 0.09999999999999999,
28694
+ cacheWrite: 0.625
28502
28695
  },
28503
28696
  contextWindow: 1e6,
28504
28697
  maxTokens: 131072
28505
28698
  },
28699
+ "alibaba/qwen3.8-flash": {
28700
+ id: "alibaba/qwen3.8-flash",
28701
+ name: "Qwen 3.8 Flash",
28702
+ api: "anthropic-messages",
28703
+ provider: "vercel-ai-gateway",
28704
+ baseUrl: "https://ai-gateway.vercel.sh",
28705
+ reasoning: true,
28706
+ input: ["text", "image"],
28707
+ cost: {
28708
+ input: 0.16,
28709
+ output: 0.47,
28710
+ cacheRead: 0.016,
28711
+ cacheWrite: 0.19999999999999998
28712
+ },
28713
+ contextWindow: 991e3,
28714
+ maxTokens: 128e3
28715
+ },
28716
+ "alibaba/qwen3.8-flash-next": {
28717
+ id: "alibaba/qwen3.8-flash-next",
28718
+ name: "Qwen 3.8 Flash Next",
28719
+ api: "anthropic-messages",
28720
+ provider: "vercel-ai-gateway",
28721
+ baseUrl: "https://ai-gateway.vercel.sh",
28722
+ reasoning: true,
28723
+ input: ["text", "image"],
28724
+ cost: {
28725
+ input: 0.12,
28726
+ output: 0.39999999999999997,
28727
+ cacheRead: 0.01,
28728
+ cacheWrite: 0
28729
+ },
28730
+ contextWindow: 1048576,
28731
+ maxTokens: 1048576
28732
+ },
28506
28733
  "alibaba/qwen3.8-max": {
28507
28734
  id: "alibaba/qwen3.8-max",
28508
28735
  name: "Qwen 3.8 Max",
@@ -28627,6 +28854,28 @@ var MODELS = {
28627
28854
  contextWindow: 1e6,
28628
28855
  maxTokens: 128e3
28629
28856
  },
28857
+ "anthropic/claude-fable-5.1": {
28858
+ id: "anthropic/claude-fable-5.1",
28859
+ name: "Claude Fable 5.1",
28860
+ api: "anthropic-messages",
28861
+ provider: "vercel-ai-gateway",
28862
+ baseUrl: "https://ai-gateway.vercel.sh",
28863
+ reasoning: true,
28864
+ thinkingLevelMap: {
28865
+ "off": null,
28866
+ "xhigh": "xhigh",
28867
+ "max": "max"
28868
+ },
28869
+ input: ["text", "image"],
28870
+ cost: {
28871
+ input: 10,
28872
+ output: 50,
28873
+ cacheRead: 0.25,
28874
+ cacheWrite: 12.5
28875
+ },
28876
+ contextWindow: 1e6,
28877
+ maxTokens: 128e3
28878
+ },
28630
28879
  "anthropic/claude-haiku-4.5": {
28631
28880
  id: "anthropic/claude-haiku-4.5",
28632
28881
  name: "Claude Haiku 4.5",
@@ -29092,8 +29341,8 @@ var MODELS = {
29092
29341
  cacheRead: 7e-3,
29093
29342
  cacheWrite: 0
29094
29343
  },
29095
- contextWindow: 1e6,
29096
- maxTokens: 384e3
29344
+ contextWindow: 1048576,
29345
+ maxTokens: 1048576
29097
29346
  },
29098
29347
  "deepseek/deepseek-v4-pro": {
29099
29348
  id: "deepseek/deepseek-v4-pro",
@@ -29104,13 +29353,13 @@ var MODELS = {
29104
29353
  reasoning: true,
29105
29354
  input: ["text"],
29106
29355
  cost: {
29107
- input: 1.74,
29108
- output: 3.48,
29109
- cacheRead: 0.14,
29356
+ input: 0.66,
29357
+ output: 1.9800000000000002,
29358
+ cacheRead: 0.022,
29110
29359
  cacheWrite: 0
29111
29360
  },
29112
- contextWindow: 1048600,
29113
- maxTokens: 1048600
29361
+ contextWindow: 1e6,
29362
+ maxTokens: 384e3
29114
29363
  },
29115
29364
  "deepseek/deepseek-v4-pro-0813": {
29116
29365
  id: "deepseek/deepseek-v4-pro-0813",
@@ -29384,6 +29633,40 @@ var MODELS = {
29384
29633
  contextWindow: 256e3,
29385
29634
  maxTokens: 32e3
29386
29635
  },
29636
+ "inclusionai/ling-3.0-flash-fin": {
29637
+ id: "inclusionai/ling-3.0-flash-fin",
29638
+ name: "Ling 3.0 Flash Fin",
29639
+ api: "anthropic-messages",
29640
+ provider: "vercel-ai-gateway",
29641
+ baseUrl: "https://ai-gateway.vercel.sh",
29642
+ reasoning: true,
29643
+ input: ["text"],
29644
+ cost: {
29645
+ input: 0,
29646
+ output: 0,
29647
+ cacheRead: 0,
29648
+ cacheWrite: 0
29649
+ },
29650
+ contextWindow: 256e3,
29651
+ maxTokens: 32e3
29652
+ },
29653
+ "inclusionai/ling-3.0-flash-fin-free": {
29654
+ id: "inclusionai/ling-3.0-flash-fin-free",
29655
+ name: "Ling 3.0 Flash Fin (Free)",
29656
+ api: "anthropic-messages",
29657
+ provider: "vercel-ai-gateway",
29658
+ baseUrl: "https://ai-gateway.vercel.sh",
29659
+ reasoning: true,
29660
+ input: ["text"],
29661
+ cost: {
29662
+ input: 0,
29663
+ output: 0,
29664
+ cacheRead: 0,
29665
+ cacheWrite: 0
29666
+ },
29667
+ contextWindow: 256e3,
29668
+ maxTokens: 32e3
29669
+ },
29387
29670
  "interfaze/interfaze-beta": {
29388
29671
  id: "interfaze/interfaze-beta",
29389
29672
  name: "Interfaze Beta",
@@ -29709,7 +29992,7 @@ var MODELS = {
29709
29992
  },
29710
29993
  "minimax/minimax-m2.7": {
29711
29994
  id: "minimax/minimax-m2.7",
29712
- name: "Minimax M2.7",
29995
+ name: "MiniMax M2.7",
29713
29996
  api: "anthropic-messages",
29714
29997
  provider: "vercel-ai-gateway",
29715
29998
  baseUrl: "https://ai-gateway.vercel.sh",
@@ -29726,7 +30009,7 @@ var MODELS = {
29726
30009
  },
29727
30010
  "minimax/minimax-m2.7-free": {
29728
30011
  id: "minimax/minimax-m2.7-free",
29729
- name: "Minimax M2.7 (Free)",
30012
+ name: "MiniMax M2.7 (Free)",
29730
30013
  api: "anthropic-messages",
29731
30014
  provider: "vercel-ai-gateway",
29732
30015
  baseUrl: "https://ai-gateway.vercel.sh",
@@ -29772,8 +30055,8 @@ var MODELS = {
29772
30055
  cacheRead: 0.06,
29773
30056
  cacheWrite: 0
29774
30057
  },
29775
- contextWindow: 1e6,
29776
- maxTokens: 1e6
30058
+ contextWindow: 512e3,
30059
+ maxTokens: 512e3
29777
30060
  },
29778
30061
  "minimax/minimax-m3-free": {
29779
30062
  id: "minimax/minimax-m3-free",
@@ -30075,7 +30358,7 @@ var MODELS = {
30075
30358
  cost: {
30076
30359
  input: 0.95,
30077
30360
  output: 4,
30078
- cacheRead: 0.19,
30361
+ cacheRead: 0.16,
30079
30362
  cacheWrite: 0
30080
30363
  },
30081
30364
  contextWindow: 256e3,
@@ -30211,8 +30494,8 @@ var MODELS = {
30211
30494
  input: ["text"],
30212
30495
  cost: {
30213
30496
  input: 0.049999999999999996,
30214
- output: 0.15,
30215
- cacheRead: 0.049999999999999996,
30497
+ output: 0.19999999999999998,
30498
+ cacheRead: 0.01,
30216
30499
  cacheWrite: 0
30217
30500
  },
30218
30501
  contextWindow: 262144,
@@ -31564,13 +31847,30 @@ var MODELS = {
31564
31847
  reasoning: true,
31565
31848
  input: ["text"],
31566
31849
  cost: {
31567
- input: 0.13199999999999998,
31568
- output: 0.5279999999999999,
31569
- cacheRead: 0.032999999999999995,
31850
+ input: 0.14,
31851
+ output: 0.58,
31852
+ cacheRead: 0.035,
31570
31853
  cacheWrite: 0
31571
31854
  },
31572
- contextWindow: 256e3,
31573
- maxTokens: 128e3
31855
+ contextWindow: 262144,
31856
+ maxTokens: 262144
31857
+ },
31858
+ "tencent/hy4-preview": {
31859
+ id: "tencent/hy4-preview",
31860
+ name: "Tencent Hy4 Preview",
31861
+ api: "anthropic-messages",
31862
+ provider: "vercel-ai-gateway",
31863
+ baseUrl: "https://ai-gateway.vercel.sh",
31864
+ reasoning: true,
31865
+ input: ["text"],
31866
+ cost: {
31867
+ input: 0.834,
31868
+ output: 2.501,
31869
+ cacheRead: 0.041999999999999996,
31870
+ cacheWrite: 0
31871
+ },
31872
+ contextWindow: 1024e3,
31873
+ maxTokens: 64e3
31574
31874
  },
31575
31875
  "thinkingmachines/inkling": {
31576
31876
  id: "thinkingmachines/inkling",
@@ -31640,6 +31940,23 @@ var MODELS = {
31640
31940
  contextWindow: 105e4,
31641
31941
  maxTokens: 131e3
31642
31942
  },
31943
+ "xiaomi/mimo-v2.5-pro-ultraspeed": {
31944
+ id: "xiaomi/mimo-v2.5-pro-ultraspeed",
31945
+ name: "MiMo V2.5 Pro UltraSpeed",
31946
+ api: "anthropic-messages",
31947
+ provider: "vercel-ai-gateway",
31948
+ baseUrl: "https://ai-gateway.vercel.sh",
31949
+ reasoning: true,
31950
+ input: ["text"],
31951
+ cost: {
31952
+ input: 1.305,
31953
+ output: 2.61,
31954
+ cacheRead: 0.0108,
31955
+ cacheWrite: 0
31956
+ },
31957
+ contextWindow: 1048576,
31958
+ maxTokens: 131072
31959
+ },
31643
31960
  "zai/glm-4.5": {
31644
31961
  id: "zai/glm-4.5",
31645
31962
  name: "GLM 4.5",
@@ -31855,11 +32172,28 @@ var MODELS = {
31855
32172
  cost: {
31856
32173
  input: 1.4,
31857
32174
  output: 4.4,
31858
- cacheRead: 0.26,
32175
+ cacheRead: 0.14,
32176
+ cacheWrite: 0
32177
+ },
32178
+ contextWindow: 1e6,
32179
+ maxTokens: 1e6
32180
+ },
32181
+ "zai/glm-5.3-flash": {
32182
+ id: "zai/glm-5.3-flash",
32183
+ name: "GLM 5.3 Flash",
32184
+ api: "anthropic-messages",
32185
+ provider: "vercel-ai-gateway",
32186
+ baseUrl: "https://ai-gateway.vercel.sh",
32187
+ reasoning: true,
32188
+ input: ["text", "image"],
32189
+ cost: {
32190
+ input: 0.15,
32191
+ output: 0.5,
32192
+ cacheRead: 0.03,
31859
32193
  cacheWrite: 0
31860
32194
  },
31861
32195
  contextWindow: 1e6,
31862
- maxTokens: 12800
32196
+ maxTokens: 131e3
31863
32197
  },
31864
32198
  "zai/glm-5v-turbo": {
31865
32199
  id: "zai/glm-5v-turbo",
@@ -32526,6 +32860,50 @@ var MODELS = {
32526
32860
  },
32527
32861
  contextWindow: 1e6,
32528
32862
  maxTokens: 131072
32863
+ },
32864
+ "glm-5.3-flash": {
32865
+ id: "glm-5.3-flash",
32866
+ name: "GLM-5.3-Flash",
32867
+ api: "openai-completions",
32868
+ provider: "zai",
32869
+ baseUrl: "https://api.z.ai/api/coding/paas/v4",
32870
+ compat: {
32871
+ "supportsDeveloperRole": false,
32872
+ "thinkingFormat": "zai",
32873
+ "zaiToolStream": true
32874
+ },
32875
+ reasoning: true,
32876
+ input: ["text", "image"],
32877
+ cost: {
32878
+ input: 0,
32879
+ output: 0,
32880
+ cacheRead: 0,
32881
+ cacheWrite: 0
32882
+ },
32883
+ contextWindow: 1e6,
32884
+ maxTokens: 131072
32885
+ },
32886
+ "glm-5.3-highspeed": {
32887
+ id: "glm-5.3-highspeed",
32888
+ name: "GLM-5.3 Highspeed",
32889
+ api: "openai-completions",
32890
+ provider: "zai",
32891
+ baseUrl: "https://api.z.ai/api/coding/paas/v4",
32892
+ compat: {
32893
+ "supportsDeveloperRole": false,
32894
+ "thinkingFormat": "zai",
32895
+ "zaiToolStream": true
32896
+ },
32897
+ reasoning: true,
32898
+ input: ["text"],
32899
+ cost: {
32900
+ input: 0,
32901
+ output: 0,
32902
+ cacheRead: 0,
32903
+ cacheWrite: 0
32904
+ },
32905
+ contextWindow: 1e6,
32906
+ maxTokens: 131072
32529
32907
  }
32530
32908
  }
32531
32909
  };
@@ -33634,6 +34012,7 @@ function normalizeSessionListRow(source) {
33634
34012
  if (!sessionId || !cwd) throw new Error("The Prime Agent session listing returned an invalid session entry");
33635
34013
  const createdAt = timestampValue(raw.created) ?? timestampValue(raw.modified) ?? (/* @__PURE__ */ new Date()).toISOString();
33636
34014
  const updatedAt = timestampValue(raw.modified) ?? timestampValue(raw.created) ?? createdAt;
34015
+ const isSubagent = typeof raw.runtimeKind === "string" ? raw.runtimeKind === "subagent" : Boolean(raw.rlmChildId ?? raw.rlmParentNodeId ?? raw.parentActiveSessionId ?? raw.parentSessionId ?? raw.parentSessionPath);
33637
34016
  return {
33638
34017
  source,
33639
34018
  sessionId,
@@ -33642,7 +34021,8 @@ function normalizeSessionListRow(source) {
33642
34021
  createdAt,
33643
34022
  updatedAt,
33644
34023
  messageCount: messageCountValue(raw.messageCount),
33645
- firstMessage: typeof raw.firstMessage === "string" ? raw.firstMessage : ""
34024
+ firstMessage: typeof raw.firstMessage === "string" ? raw.firstMessage : "",
34025
+ isSubagent
33646
34026
  };
33647
34027
  }
33648
34028
  function sessionStatus(info, live) {
@@ -33682,7 +34062,8 @@ function handleProjectsGet(_request) {
33682
34062
  updatedAt: session.updatedAt,
33683
34063
  status: sessionStatus(session.source, getBridge().getSession(session.sessionId)),
33684
34064
  messageCount: session.messageCount,
33685
- firstMessage: session.firstMessage ? redactSessionLabelSecrets(session.firstMessage) : ""
34065
+ firstMessage: session.firstMessage ? redactSessionLabelSecrets(session.firstMessage) : "",
34066
+ ...session.isSubagent ? { isSubagent: true } : {}
33686
34067
  };
33687
34068
  })
33688
34069
  });
@@ -33746,7 +34127,8 @@ function handleChatSessionsGet(_request) {
33746
34127
  updatedAt: session.updatedAt,
33747
34128
  status: sessionStatus(session.source, liveSession),
33748
34129
  messageCount: session.messageCount,
33749
- firstMessage: session.firstMessage
34130
+ firstMessage: session.firstMessage,
34131
+ ...session.isSubagent ? { isSubagent: true } : {}
33750
34132
  };
33751
34133
  }));
33752
34134
  return Response.json({ sessions: projectId ? formatted.filter((session) => session.projectId === projectId) : formatted });