@nervekit/desktop 0.42.0 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/THIRD-PARTY-LICENSES.txt +210 -16
  2. package/dist/builtin/configure-nerve/SKILL.md +19 -10
  3. package/dist/builtin/configure-nerve/reference/agent-preferences.md +9 -0
  4. package/dist/builtin/configure-nerve/reference/agent-profiles.md +2 -6
  5. package/dist/builtin/configure-nerve/reference/agents-md.md +1 -1
  6. package/dist/builtin/configure-nerve/reference/extensions/api/extension-api/artifacts.d.ts +10 -0
  7. package/dist/builtin/configure-nerve/reference/extensions/api/extension-api/text.d.ts +4 -0
  8. package/dist/builtin/configure-nerve/reference/extensions/api/extension-sdk/components/ui-kit/collections/match-terms.d.ts +8 -0
  9. package/dist/builtin/configure-nerve/reference/extensions/api/extension-sdk/components/ui-kit/components/composites/callout/callout.svelte.d.ts +1 -1
  10. package/dist/builtin/configure-nerve/reference/extensions/api/extension-sdk/components/ui-kit/display/status.d.ts +3 -0
  11. package/dist/builtin/configure-nerve/{guide/extensions.md → reference/extensions/build.md} +4 -4
  12. package/dist/builtin/configure-nerve/reference/extensions/manifest.md +1 -1
  13. package/dist/builtin/configure-nerve/reference/extensions/overview.md +2 -2
  14. package/dist/builtin/configure-nerve/{scripts → reference/extensions/scripts}/lib.mjs +2 -2
  15. package/dist/builtin/configure-nerve/reference/extensions/scripts/nerve-version.json +1 -0
  16. package/dist/builtin/configure-nerve/reference/extensions/sharing.md +2 -2
  17. package/dist/builtin/configure-nerve/reference/extensions/themes.md +1 -1
  18. package/dist/builtin/configure-nerve/reference/permissions.md +2 -2
  19. package/dist/builtin/configure-nerve/reference/prompt-suggestions.md +2 -2
  20. package/dist/builtin/configure-nerve/reference/skills.md +9 -9
  21. package/dist/{chunk-QFK2SWD2.js → chunk-34SYO66C.js} +11 -11
  22. package/dist/{chunk-6ZS7TA6E.js → chunk-35O66NLU.js} +2 -2
  23. package/dist/{chunk-7FSH3ABG.js → chunk-57A5HFXL.js} +4 -4
  24. package/dist/{chunk-EF7ZZKA3.js → chunk-5K7U6UXA.js} +3 -3
  25. package/dist/{chunk-WIQEPAUG.js → chunk-5S5O3V5G.js} +11 -10
  26. package/dist/{chunk-MTHLTFG4.js → chunk-5VLAJMQQ.js} +97 -105
  27. package/dist/{chunk-MI6L5CEA.js → chunk-5WMHGTVL.js} +2 -2
  28. package/dist/{chunk-NVVW3MWJ.js → chunk-6IJORN3N.js} +9 -9
  29. package/dist/{chunk-OMCM3MHS.js → chunk-7GSR2AW5.js} +10 -9
  30. package/dist/{chunk-WG62RHZ2.js → chunk-7MJT6LHU.js} +14 -4
  31. package/dist/{chunk-DDBE2VLT.js → chunk-A3OFIREH.js} +2 -2
  32. package/dist/{chunk-ZGWXLG5X.js → chunk-BNBEFI2M.js} +66 -76
  33. package/dist/{chunk-7RPHIJT3.js → chunk-C7L4BBGD.js} +4 -4
  34. package/dist/{chunk-2ICPO4UM.js → chunk-CZXRZEV4.js} +16 -14
  35. package/dist/{chunk-H5CAHDII.js → chunk-EBDLSTDH.js} +51414 -50054
  36. package/dist/{chunk-PVPJAGWR.js → chunk-EOZLBW5E.js} +2 -2
  37. package/dist/{chunk-U5KGV63C.js → chunk-EZJH7ED5.js} +1 -1
  38. package/dist/{chunk-RL52LSTV.js → chunk-F3X2KHP4.js} +1 -1
  39. package/dist/{chunk-Q3C7TQ2M.js → chunk-FNWUCFVO.js} +3 -3
  40. package/dist/chunk-FQVIQOV5.js +163 -0
  41. package/dist/{chunk-LP4APBBQ.js → chunk-FZ7U3GZI.js} +1 -1
  42. package/dist/{chunk-MBMZEIOG.js → chunk-G5SVCJCT.js} +38 -51
  43. package/dist/{chunk-62DQXVPO.js → chunk-HDTS5AS5.js} +26 -7
  44. package/dist/{chunk-376GN4PB.js → chunk-HKBJTS2Z.js} +173 -79
  45. package/dist/{chunk-WC5HHPPM.js → chunk-HRJJKZGM.js} +1 -1
  46. package/dist/chunk-I7OMW4RJ.js +87 -0
  47. package/dist/{chunk-TQURLRHD.js → chunk-IL67WXRA.js} +1 -1
  48. package/dist/{chunk-QDEH776O.js → chunk-KBBBQCYV.js} +179 -20
  49. package/dist/{chunk-KUFIFCB4.js → chunk-KDGUQYYY.js} +1 -1
  50. package/dist/{chunk-IRRR3PWN.js → chunk-KQD4DYEP.js} +68 -35
  51. package/dist/{chunk-JBEWFFOK.js → chunk-LIIGX2XX.js} +1 -1
  52. package/dist/{chunk-IVBMHEPK.js → chunk-LX33FMTS.js} +23 -36
  53. package/dist/{chunk-HPINJGBO.js → chunk-METH7J6V.js} +13 -12
  54. package/dist/{chunk-N6BUYKF3.js → chunk-MLE6MKPY.js} +7 -7
  55. package/dist/{chunk-3CZXUKLG.js → chunk-MRDORR5Z.js} +8 -1
  56. package/dist/{chunk-6IHXVT5H.js → chunk-NSISYP6D.js} +1 -1
  57. package/dist/{chunk-P72Y5ZBH.js → chunk-O2IYZBX6.js} +15 -26
  58. package/dist/{chunk-TSAUBRRU.js → chunk-P7GPT4XL.js} +1 -1
  59. package/dist/{chunk-F5XCJ6UV.js → chunk-PA37GH3T.js} +33 -58
  60. package/dist/{chunk-BACYVEE6.js → chunk-QC6DSC4D.js} +2 -2
  61. package/dist/{chunk-ZVH6EB7S.js → chunk-QKRWXA5W.js} +1 -1
  62. package/dist/{chunk-D6C32XHS.js → chunk-QQPLW3ZX.js} +17359 -12634
  63. package/dist/chunk-QQPLW3ZX.js.LEGAL.txt +59 -0
  64. package/dist/{chunk-N4OXAS3A.js → chunk-R22FWLXU.js} +1 -1
  65. package/dist/{chunk-7HGFEQSD.js → chunk-R7UJIPJA.js} +5 -5
  66. package/dist/{chunk-NW3DH7IK.js → chunk-RAHBWFWV.js} +8457 -2726
  67. package/dist/{chunk-O5JHHRFN.js → chunk-RMV6IZ2C.js} +32 -116
  68. package/dist/{chunk-Z6AY5VOZ.js → chunk-RQIN5JYO.js} +9 -6
  69. package/dist/{chunk-Q5E4ZL2R.js → chunk-S2UG5HD6.js} +1 -1
  70. package/dist/{chunk-U3TEC52G.js → chunk-S637DPAG.js} +1 -1
  71. package/dist/chunk-S6KM4DOB.js +37 -0
  72. package/dist/{chunk-MPDKZVHT.js → chunk-SVX46YXY.js} +1 -3
  73. package/dist/{chunk-XTUSLUQ7.js → chunk-TLDULBKV.js} +70 -24
  74. package/dist/{chunk-L5WGVYXM.js → chunk-UFE7IMKQ.js} +2 -2
  75. package/dist/{chunk-ZUWBEV2O.js → chunk-UQHUYEFW.js} +1 -1
  76. package/dist/{chunk-XM27UVWN.js → chunk-V7WOX4O7.js} +3 -3
  77. package/dist/{chunk-W7LEYYFH.js → chunk-WJAHXDL4.js} +41 -32
  78. package/dist/{chunk-6GUJQURI.js → chunk-WLTE6OJM.js} +2 -2
  79. package/dist/{chunk-BG2KGLIA.js → chunk-WMZAJ7XA.js} +2 -2
  80. package/dist/chunk-WOLKTL4F.js +32 -0
  81. package/dist/{chunk-DHIDYKXJ.js → chunk-XIVWNWL7.js} +1778 -1701
  82. package/dist/{chunk-EUT45AKW.js → chunk-YODV42KQ.js} +25 -32
  83. package/dist/{chunk-FCAIYPDJ.js → chunk-ZFFWWZIA.js} +2 -2
  84. package/dist/{chunk-O6FDXE54.js → chunk-ZVUAJ7UV.js} +25 -36
  85. package/dist/daemon.js +15 -15
  86. package/dist/ext-frame/base.css +1 -1
  87. package/dist/extension-assets/atlassian/docs/confluence-writing.md +5 -5
  88. package/dist/extension-assets/diagram/bundle.js +3 -0
  89. package/dist/git-isolated-reader-helper.js +1 -1
  90. package/dist/main.js +57 -128
  91. package/dist/quick-script-docs/runtime/artifacts.md +11 -0
  92. package/dist/quick-script-docs/runtime/documents.md +21 -12
  93. package/dist/quick-script-docs/runtime/editing.md +44 -0
  94. package/dist/quick-script-docs/runtime/images.md +1 -1
  95. package/dist/sandbox-libraries/credential-runtime.js +3 -0
  96. package/dist/sandbox-libraries/extension-runtime.js +3 -0
  97. package/dist/web/assets/{AsyncBashCenterHost-DldW4utc.js → AsyncBashCenterHost-Dcx6zVCo.js} +1 -1
  98. package/dist/web/assets/{ConversationListItem-CCaGnyA1.js → ConversationListItem-DALhochc.js} +3 -3
  99. package/dist/web/assets/{ConversationsWorkbenchPanel-DLM3saY5.js → ConversationsWorkbenchPanel-ChtoTW2H.js} +1 -1
  100. package/dist/web/assets/{DiscoverCenterHost-DVNL8uZQ.js → DiscoverCenterHost-Bju7ypB-.js} +1 -1
  101. package/dist/web/assets/{ExtensionPageCenterHost-CHKg6c3M.js → ExtensionPageCenterHost-BO-5q4j_.js} +1 -1
  102. package/dist/web/assets/FileCenterComposedHost-BxLlLMBI.js +1 -0
  103. package/dist/web/assets/{FilesWorkbenchPanel-BxjUf50f.js → FilesWorkbenchPanel-jyqwIQAe.js} +4 -4
  104. package/dist/web/assets/{GitDiffCenterHost-DmtKqHer.js → GitDiffCenterHost-D8i3Jq9A.js} +1 -1
  105. package/dist/web/assets/{GitWorkbenchPanel-BmyMyvL8.js → GitWorkbenchPanel-CtZPJKqJ.js} +1 -1
  106. package/dist/web/assets/{LaunchCenterHost-1xrIDf73.js → LaunchCenterHost-CSy1io6s.js} +1 -1
  107. package/dist/web/assets/{LaunchConfigurationNotice-BfRdIOv0.js → LaunchConfigurationNotice-DugBa05c.js} +1 -1
  108. package/dist/web/assets/{LaunchesWorkbenchPanel-BhCyWFHf.js → LaunchesWorkbenchPanel-CNqGG_AP.js} +1 -1
  109. package/dist/web/assets/{LogStream-CibF_jgC.js → LogStream-DfJ4LiCv.js} +1 -1
  110. package/dist/web/assets/{LogsCenterHost-CdqD6zH8.js → LogsCenterHost-xynA0TWK.js} +1 -1
  111. package/dist/web/assets/{MermaidCenterHost-BjwJLU-2.js → MermaidCenterHost-kAV1ocvE.js} +1 -1
  112. package/dist/web/assets/MobileFilesBody-CiwIT8Vf.js +1 -0
  113. package/dist/web/assets/MobileFilesHost-DvQOpQFH.js +1 -0
  114. package/dist/web/assets/MobileLaunchOutputHost-pFJgIV1_.js +1 -0
  115. package/dist/web/assets/MobileLaunchesHost-0VtdW0x8.js +2 -0
  116. package/dist/web/assets/{MobileNoteEditorHost-lfAeMVH9.js → MobileNoteEditorHost-DSuZ0mU5.js} +1 -1
  117. package/dist/web/assets/{MobileNotesHost-DOi0goPc.js → MobileNotesHost-Lg699XCv.js} +2 -2
  118. package/dist/web/assets/MobileSettingsHost-Bv1P74ck.js +2 -0
  119. package/dist/web/assets/{MobileSettingsPageHost-CtpUzfVG.js → MobileSettingsPageHost-DudFqhZC.js} +1 -1
  120. package/dist/web/assets/{NotesWorkbenchPanel-CsbMYHAw.js → NotesWorkbenchPanel-C8sctQWR.js} +1 -1
  121. package/dist/web/assets/{PullRequestCenterHost-B22Ua7bA.js → PullRequestCenterHost-BWJ-exw1.js} +1 -1
  122. package/dist/web/assets/{PullRequestsWorkbenchPanel-DOIHvZ6H.js → PullRequestsWorkbenchPanel-8Fb0-hW3.js} +1 -1
  123. package/dist/web/assets/SearchWorkbenchPanel-B35YmwtL.js +1 -0
  124. package/dist/web/assets/SettingsCenterHost-BuiirrId.js +1 -0
  125. package/dist/web/assets/SystemPromptCenterHost-BqKV92Ew.js +2 -0
  126. package/dist/web/assets/{ThemePreviewPicker-B_DTUsui.js → ThemePreviewPicker-C6J0H91i.js} +1 -1
  127. package/dist/web/assets/adapters-C5HB2cBr.js +1 -0
  128. package/dist/web/assets/agent-profiles.svelte-DjdXLJnE.js +1 -0
  129. package/dist/web/assets/appearance.svelte-fB4gKc-X.js +1 -0
  130. package/dist/web/assets/center-tabs.svelte-8YpJhA1o.js +2 -0
  131. package/dist/web/assets/{channel-CxF1CmEY.js → channel-3Wv484LF.js} +2 -2
  132. package/dist/web/assets/{client-CVZRorEj.js → client-CjIsgPXA.js} +1 -1
  133. package/dist/web/assets/code-BDTZAlQg.js +7 -0
  134. package/dist/web/assets/conversation-activity-CZJfUGoL.js +1 -0
  135. package/dist/web/assets/conversation-connection-Dm9Zr6Yb.js +1 -0
  136. package/dist/web/assets/discover-Cwv6pB0p.js +4 -0
  137. package/dist/web/assets/{dist-DZN4bTV3.js → dist-BB4fpXjy.js} +1 -1
  138. package/dist/web/assets/{dist-DkQMSgZ5.js → dist-BBlCv_-z.js} +1 -1
  139. package/dist/web/assets/{dist-HTsJAisd.js → dist-BENZZeCy.js} +1 -1
  140. package/dist/web/assets/{dist-BWsookwC.js → dist-BqcaQXZ-.js} +1 -1
  141. package/dist/web/assets/{dist-CDM0qUmO.js → dist-CIK1TmOX.js} +1 -1
  142. package/dist/web/assets/{dist-EmwCDpCc.js → dist-DUPZ8ZaX.js} +1 -1
  143. package/dist/web/assets/{dist-BVmTdBxj.js → dist-DoKRJEPu.js} +1 -1
  144. package/dist/web/assets/{easing-DfoPn4-z.js → easing-B6dSt4eu.js} +1 -1
  145. package/dist/web/assets/empty-CtUlV5QU.js +1 -0
  146. package/dist/web/assets/eraser-B8qFMviR.js +1 -0
  147. package/dist/web/assets/{extension-themes.svelte-BAce41Wm.js → extension-themes.svelte-D2TAUtUA.js} +2 -2
  148. package/dist/web/assets/{file-tabs.svelte-CaZRhyw0.js → file-tabs.svelte-DxL_vZZv.js} +2 -2
  149. package/dist/web/assets/{files-dFQS0tcX.css → files-N9JiAfxr.css} +1 -1
  150. package/dist/web/assets/files-vq7_WbHL.js +156 -0
  151. package/dist/web/assets/filesystem-DiVFVMn3.js +1 -0
  152. package/dist/web/assets/floating-toolbar-Cqtfs8M7.js +1 -0
  153. package/dist/web/assets/{git-store.svelte-DkeLA_WZ.js → git-store.svelte-D9S4P9gI.js} +1 -1
  154. package/dist/web/assets/{icon-action-efe9ZEWq.js → icon-action-C9h3TdBz.js} +1 -1
  155. package/dist/web/assets/index-B8XniJoh.js +165 -0
  156. package/dist/web/assets/index-DC_ohlBG.css +1 -0
  157. package/dist/web/assets/{launches-ZxeZFPI8.js → launches-CmB4KShL.js} +5 -5
  158. package/dist/web/assets/launches.api-C4z0obJK.js +1 -0
  159. package/dist/web/assets/{launches.svelte-QFDoCgug.js → launches.svelte-D2bNAphM.js} +2 -2
  160. package/dist/web/assets/{logs.api-gZ2mVC9q.js → logs.api-BtGxtYFi.js} +1 -1
  161. package/dist/web/assets/{maintenance-state.svelte-xMmmI9yr.js → maintenance-state.svelte-BusQWeCR.js} +2 -2
  162. package/dist/web/assets/menu-icons-DLuZ586C.js +1 -0
  163. package/dist/web/assets/{mermaid-ACpEwsfj.js → mermaid-DL5xfcqL.js} +1 -1
  164. package/dist/web/assets/mobile-launch-rows-DR6V5AUH.js +1 -0
  165. package/dist/web/assets/page-tabs.svelte-Cc5F8hMx.js +4 -0
  166. package/dist/web/assets/panel-BW0llJiU.js +1 -0
  167. package/dist/web/assets/popover-panel-SA7quIc1.js +4 -0
  168. package/dist/web/assets/{pr-view-loader.svelte-CZfxwzwL.js → pr-view-loader.svelte-eOmDNaGf.js} +1 -1
  169. package/dist/web/assets/progress-BZbo8ynI.js +1 -0
  170. package/dist/web/assets/{scratch-notes-state.svelte-rBeSOn4h.js → scratch-notes-state.svelte-B4NySamQ.js} +1 -1
  171. package/dist/web/assets/{scratch-notes.api-Co80EGtL.js → scratch-notes.api-BMBs2yoU.js} +1 -1
  172. package/dist/web/assets/settings-Cu_0wNkX.js +1 -0
  173. package/dist/web/assets/settings-DTw27q0i.js +1 -0
  174. package/dist/web/assets/settings-scope-Bz4U5ImL.js +35 -0
  175. package/dist/web/assets/shell-BiZy0tcZ.js +1 -0
  176. package/dist/web/assets/{shell-layout.svelte-D5u4i1UJ.js → shell-layout.svelte-Dyx_fbRn.js} +2 -2
  177. package/dist/web/assets/{lock-open-BBTCOUg5.js → tag-Bp1l7psd.js} +1 -1
  178. package/dist/web/assets/time-egBWJGDu.js +1 -0
  179. package/dist/web/assets/views-DIrSFdZB.js +2 -0
  180. package/dist/web/assets/{workbench-connection-Gsy9bIuP.js → workbench-connection-BpvUZMVX.js} +1 -1
  181. package/dist/web/assets/workspace-actions.svelte-DE0mQsY6.js +1 -0
  182. package/dist/web/assets/{workspace-selectors.svelte-D-EQR_-Z.js → workspace-selectors.svelte-B90FdGfV.js} +2 -2
  183. package/dist/web/assets/{workspace-CUoFFOwJ.js → workspace-uXAUsF3x.js} +1 -1
  184. package/dist/web/index.html +47 -47
  185. package/dist/web/sw.js +1 -1
  186. package/dist/worker.js +14 -14
  187. package/package.json +7 -7
  188. package/dist/builtin/configure-nerve/guide/collaboration.md +0 -15
  189. package/dist/builtin/configure-nerve/scripts/nerve-version.json +0 -1
  190. package/dist/chunk-D6C32XHS.js.LEGAL.txt +0 -25
  191. package/dist/chunk-RJR7DJJK.js +0 -32
  192. package/dist/chunk-UVRULOOP.js +0 -35
  193. package/dist/quick-script-docs/runtime/files.md +0 -11
  194. package/dist/web/assets/FileCenterComposedHost-kxFWeFmP.js +0 -1
  195. package/dist/web/assets/MobileFilesBody-4bLT2m0j.js +0 -1
  196. package/dist/web/assets/MobileFilesHost-X_0r4Z16.js +0 -1
  197. package/dist/web/assets/MobileLaunchOutputHost-BEchaBtD.js +0 -1
  198. package/dist/web/assets/MobileLaunchesHost-S7Z3DySI.js +0 -2
  199. package/dist/web/assets/MobileSettingsHost-94-sABuO.js +0 -2
  200. package/dist/web/assets/SearchWorkbenchPanel-CKccBrNr.js +0 -1
  201. package/dist/web/assets/SettingsCenterHost-BM-xIy5S.js +0 -1
  202. package/dist/web/assets/SystemPromptCenterHost-VL4DXNId.js +0 -1
  203. package/dist/web/assets/adapters-CbIIxNp9.js +0 -1
  204. package/dist/web/assets/agent-profiles.svelte-8LAIYKmb.js +0 -1
  205. package/dist/web/assets/appearance.svelte-CLR_fMAx.js +0 -1
  206. package/dist/web/assets/center-tabs.svelte-BCriw5Eu.js +0 -1
  207. package/dist/web/assets/code-H_8FkG35.js +0 -7
  208. package/dist/web/assets/conversation-activity-Dl7udunb.js +0 -1
  209. package/dist/web/assets/conversation-connection-B226pY9T.js +0 -1
  210. package/dist/web/assets/discover-DTlfL84I.js +0 -4
  211. package/dist/web/assets/empty-B8eEKvqc.js +0 -1
  212. package/dist/web/assets/file-code-CMYYNL9l.js +0 -1
  213. package/dist/web/assets/files-eAvb-uRC.js +0 -48
  214. package/dist/web/assets/filesystem-CmkTuQNl.js +0 -1
  215. package/dist/web/assets/floating-toolbar-BwJ2tdsN.js +0 -1
  216. package/dist/web/assets/index-CH1Mvlxk.css +0 -1
  217. package/dist/web/assets/index-DNfABG4x.js +0 -172
  218. package/dist/web/assets/launches.api-BEsX6AKZ.js +0 -1
  219. package/dist/web/assets/menu-icons-C24r3TCF.js +0 -1
  220. package/dist/web/assets/mobile-launch-rows-Ci7ldwx6.js +0 -1
  221. package/dist/web/assets/page-tabs.svelte-VZp38ac7.js +0 -4
  222. package/dist/web/assets/panel-DEG1zXHj.js +0 -1
  223. package/dist/web/assets/popover-panel-B1cUdhY5.js +0 -5
  224. package/dist/web/assets/progress-D2Cb6vK_.js +0 -1
  225. package/dist/web/assets/settings-B_ed0eye.js +0 -1
  226. package/dist/web/assets/settings-Dzj6Az_d.js +0 -1
  227. package/dist/web/assets/settings-scope-BjQBgG9v.js +0 -33
  228. package/dist/web/assets/shell-CbR1KanT.js +0 -1
  229. package/dist/web/assets/time-DqcZ_PFK.js +0 -1
  230. package/dist/web/assets/views-D4ociG21.js +0 -2
  231. package/dist/web/assets/workspace-actions.svelte-BMp3D2e1.js +0 -1
  232. /package/dist/builtin/configure-nerve/{scripts → reference/extensions/scripts}/create-extension.mjs +0 -0
  233. /package/dist/builtin/configure-nerve/{scripts → reference/extensions/scripts}/install-extension.mjs +0 -0
  234. /package/dist/builtin/configure-nerve/{scripts → reference/extensions/scripts}/upgrade-extension.mjs +0 -0
  235. /package/dist/builtin/configure-nerve/{reference/writing-for-agents.md → writing-for-agents.md} +0 -0
  236. /package/dist/{chunk-H5CAHDII.js.LEGAL.txt → chunk-EBDLSTDH.js.LEGAL.txt} +0 -0
@@ -4,7 +4,10 @@ import {
4
4
  hasExceededStrictToolLimits,
5
5
  isStrictToolLimitErrorMessage,
6
6
  markStrictToolLimitsExceeded
7
- } from "./chunk-L5WGVYXM.js";
7
+ } from "./chunk-UFE7IMKQ.js";
8
+ import {
9
+ SseDecoder
10
+ } from "./chunk-I7OMW4RJ.js";
8
11
  import {
9
12
  Anthropic
10
13
  } from "./chunk-M3ELKCNA.js";
@@ -14,21 +17,17 @@ import {
14
17
  ANTHROPIC_ORGANIZATION_ID_ENV,
15
18
  ANTHROPIC_SERVICE_ACCOUNT_ID_ENV,
16
19
  ANTHROPIC_WORKSPACE_ID_ENV
17
- } from "./chunk-RL52LSTV.js";
20
+ } from "./chunk-F3X2KHP4.js";
18
21
  import {
19
22
  registerSessionResourceCleanup
20
- } from "./chunk-ZVH6EB7S.js";
21
- import {
22
- applyOpenRouterReportedCost,
23
- isOpenRouterModel
24
- } from "./chunk-N4OXAS3A.js";
23
+ } from "./chunk-QKRWXA5W.js";
25
24
  import {
26
25
  buildCopilotDynamicHeaders,
27
26
  hasCopilotVisionInput
28
- } from "./chunk-TQURLRHD.js";
27
+ } from "./chunk-IL67WXRA.js";
29
28
  import {
30
29
  shortHash
31
- } from "./chunk-LP4APBBQ.js";
30
+ } from "./chunk-FZ7U3GZI.js";
32
31
  import {
33
32
  adjustMaxTokensForThinking,
34
33
  buildBaseOptions,
@@ -38,46 +37,50 @@ import {
38
37
  resolveJsonSchemaStrictSampling,
39
38
  splitErrorToolResultImages,
40
39
  transformMessages
41
- } from "./chunk-Z6AY5VOZ.js";
40
+ } from "./chunk-RQIN5JYO.js";
42
41
  import {
43
42
  sanitizeSurrogates
44
- } from "./chunk-TSAUBRRU.js";
43
+ } from "./chunk-P7GPT4XL.js";
44
+ import {
45
+ applyOpenRouterReportedCost,
46
+ isOpenRouterModel
47
+ } from "./chunk-R22FWLXU.js";
45
48
  import {
46
49
  retryProviderRequest
47
- } from "./chunk-3CZXUKLG.js";
50
+ } from "./chunk-MRDORR5Z.js";
48
51
  import {
49
52
  withCauseDetail
50
- } from "./chunk-PVPJAGWR.js";
53
+ } from "./chunk-EOZLBW5E.js";
51
54
  import {
52
55
  headersToRecord
53
- } from "./chunk-6IHXVT5H.js";
56
+ } from "./chunk-NSISYP6D.js";
54
57
  import {
55
58
  getProviderEnvValue
56
- } from "./chunk-JBEWFFOK.js";
59
+ } from "./chunk-LIIGX2XX.js";
57
60
  import {
58
61
  ToolCallArgumentsStream,
59
62
  parseJsonWithRepair
60
- } from "./chunk-BG2KGLIA.js";
63
+ } from "./chunk-WMZAJ7XA.js";
61
64
  import {
62
65
  calculateCost,
63
66
  getCurrentTools,
64
67
  getInitialSystemMessage,
65
68
  resolveTranscript
66
- } from "./chunk-W7LEYYFH.js";
69
+ } from "./chunk-WJAHXDL4.js";
67
70
  import {
68
71
  AssistantMessageEventStream,
69
72
  appendAssistantMessageDiagnostic
70
- } from "./chunk-DDBE2VLT.js";
73
+ } from "./chunk-A3OFIREH.js";
71
74
  import {
72
75
  getIdentityHeaders
73
- } from "./chunk-Q3C7TQ2M.js";
76
+ } from "./chunk-FNWUCFVO.js";
74
77
  import {
75
78
  getSystemMessageText,
76
79
  renderSystemMessageUpdate
77
- } from "./chunk-U5KGV63C.js";
80
+ } from "./chunk-EZJH7ED5.js";
78
81
  import "./chunk-CWESUMYQ.js";
79
82
 
80
- // node_modules/.pnpm/@earendil-works+pi-ai@1.5.2_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_b842a8cec34a633ed5f728049ae89b72/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js
83
+ // node_modules/.pnpm/@earendil-works+pi-ai@1.6.1_@smithy+signature-v4@5.7.3_google-auth-library@10.7.0_suppo_bdf1b0d1b5e752e25be2c525cddbb146/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js
81
84
  function resolveCacheRetention(cacheRetention, env) {
82
85
  if (cacheRetention) {
83
86
  return cacheRetention;
@@ -194,7 +197,7 @@ function getAnthropicCompat(model) {
194
197
  // Gateways that drop unknown request fields would silently turn a `continue` into a request
195
198
  // without the earlier conversation, so the default is limited to Anthropic's own endpoint.
196
199
  // Widen or remove this restriction once proxies generally forward the `thread` field.
197
- supportsMessageThreads: model.compat?.supportsMessageThreads ?? (model.provider === "anthropic" && model.baseUrl.includes("api.anthropic.com"))
200
+ supportsMessageThreads: model.compat?.supportsMessageThreads ?? model.baseUrl.includes("api.anthropic.com")
198
201
  };
199
202
  }
200
203
  var threadState = /* @__PURE__ */ new Map();
@@ -365,71 +368,9 @@ var ANTHROPIC_MESSAGE_EVENTS = /* @__PURE__ */ new Set([
365
368
  "content_block_delta",
366
369
  "content_block_stop"
367
370
  ]);
368
- function flushSseEvent(state) {
369
- if (!state.event && state.data.length === 0) {
370
- return null;
371
- }
372
- const event = {
373
- event: state.event,
374
- data: state.data.join("\n"),
375
- raw: [...state.raw]
376
- };
377
- state.event = null;
378
- state.data = [];
379
- state.raw = [];
380
- return event;
381
- }
382
- function decodeSseLine(line, state) {
383
- if (line === "") {
384
- return flushSseEvent(state);
385
- }
386
- state.raw.push(line);
387
- if (line.startsWith(":")) {
388
- return null;
389
- }
390
- const delimiterIndex = line.indexOf(":");
391
- const fieldName = delimiterIndex === -1 ? line : line.slice(0, delimiterIndex);
392
- let value = delimiterIndex === -1 ? "" : line.slice(delimiterIndex + 1);
393
- if (value.startsWith(" ")) {
394
- value = value.slice(1);
395
- }
396
- if (fieldName === "event") {
397
- state.event = value;
398
- } else if (fieldName === "data") {
399
- state.data.push(value);
400
- }
401
- return null;
402
- }
403
- function nextLineBreakIndex(text) {
404
- const carriageReturnIndex = text.indexOf("\r");
405
- const newlineIndex = text.indexOf("\n");
406
- if (carriageReturnIndex === -1) {
407
- return newlineIndex;
408
- }
409
- if (newlineIndex === -1) {
410
- return carriageReturnIndex;
411
- }
412
- return Math.min(carriageReturnIndex, newlineIndex);
413
- }
414
- function consumeLine(text) {
415
- const lineBreakIndex = nextLineBreakIndex(text);
416
- if (lineBreakIndex === -1) {
417
- return null;
418
- }
419
- let nextIndex = lineBreakIndex + 1;
420
- if (text[lineBreakIndex] === "\r" && text[nextIndex] === "\n") {
421
- nextIndex += 1;
422
- }
423
- return {
424
- line: text.slice(0, lineBreakIndex),
425
- rest: text.slice(nextIndex)
426
- };
427
- }
428
371
  async function* iterateSseMessages(body, signal) {
429
372
  const reader = body.getReader();
430
- const decoder = new TextDecoder();
431
- const state = { event: null, data: [], raw: [] };
432
- let buffer = "";
373
+ const sse = new SseDecoder();
433
374
  try {
434
375
  while (true) {
435
376
  if (signal?.aborted) {
@@ -439,37 +380,9 @@ async function* iterateSseMessages(body, signal) {
439
380
  if (done) {
440
381
  break;
441
382
  }
442
- buffer += decoder.decode(value, { stream: true });
443
- let consumed2 = consumeLine(buffer);
444
- while (consumed2) {
445
- buffer = consumed2.rest;
446
- const event = decodeSseLine(consumed2.line, state);
447
- if (event) {
448
- yield event;
449
- }
450
- consumed2 = consumeLine(buffer);
451
- }
452
- }
453
- buffer += decoder.decode();
454
- let consumed = consumeLine(buffer);
455
- while (consumed) {
456
- buffer = consumed.rest;
457
- const event = decodeSseLine(consumed.line, state);
458
- if (event) {
459
- yield event;
460
- }
461
- consumed = consumeLine(buffer);
462
- }
463
- if (buffer.length > 0) {
464
- const event = decodeSseLine(buffer, state);
465
- if (event) {
466
- yield event;
467
- }
468
- }
469
- const trailingEvent = flushSseEvent(state);
470
- if (trailingEvent) {
471
- yield trailingEvent;
383
+ yield* sse.push(value);
472
384
  }
385
+ yield* sse.end();
473
386
  } finally {
474
387
  reader.releaseLock();
475
388
  }
@@ -563,7 +476,8 @@ var stream = (model, context, options) => {
563
476
  const send = (body) => retryProviderRequest(() => client.beta.messages.create(body, requestOptions).asResponse(), {
564
477
  maxRetries: options?.maxRetries,
565
478
  maxRetryDelayMs: options?.maxRetryDelayMs,
566
- signal: options?.signal
479
+ signal: options?.signal,
480
+ onErrorResponse: (errorResponse) => options?.onResponse?.(errorResponse, model)
567
481
  });
568
482
  let disablePreferredStrictTools = hasExceededStrictToolLimits(options?.sessionId);
569
483
  let response;
@@ -1312,6 +1226,8 @@ function convertTools(tools, isOAuthToken2, supportsEagerToolInputStreaming, sup
1312
1226
  type: "object",
1313
1227
  properties: schema.properties ?? {},
1314
1228
  required: schema.required ?? [],
1229
+ ...schema.additionalProperties === void 0 ? {} : { additionalProperties: schema.additionalProperties },
1230
+ ...schema.$schema === void 0 ? {} : { $schema: schema.$schema },
1315
1231
  ...schema.$defs === void 0 ? {} : { $defs: schema.$defs },
1316
1232
  ...schema.definitions === void 0 ? {} : { definitions: schema.definitions }
1317
1233
  };
@@ -2,12 +2,12 @@ import { createRequire as __nerveCreateRequire } from "node:module";
2
2
  const require = __nerveCreateRequire(import.meta.url);
3
3
  import {
4
4
  clampThinkingLevel
5
- } from "./chunk-W7LEYYFH.js";
5
+ } from "./chunk-WJAHXDL4.js";
6
6
  import {
7
7
  getSystemMessageText
8
- } from "./chunk-U5KGV63C.js";
8
+ } from "./chunk-EZJH7ED5.js";
9
9
 
10
- // node_modules/.pnpm/@earendil-works+pi-ai@1.5.2_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_b842a8cec34a633ed5f728049ae89b72/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.js
10
+ // node_modules/.pnpm/@earendil-works+pi-ai@1.6.1_@smithy+signature-v4@5.7.3_google-auth-library@10.7.0_suppo_bdf1b0d1b5e752e25be2c525cddbb146/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.js
11
11
  var UnsupportedStrictJsonSchemaError = class extends Error {
12
12
  };
13
13
  var UNSUPPORTED_STRICT_SCHEMA_KEYS = [
@@ -62,6 +62,9 @@ function makeJsonSchemaNodeStrict(schema, isUnsupportedKeyword) {
62
62
  }
63
63
  }
64
64
  }
65
+ if (schema.type === void 0 && schema.anyOf === void 0 && schema.enum === void 0) {
66
+ throw new UnsupportedStrictJsonSchemaError("schemas without a type are unsupported");
67
+ }
65
68
  if (schema.anyOf !== void 0) {
66
69
  if (!Array.isArray(schema.anyOf) || schema.anyOf.length === 0) {
67
70
  throw new UnsupportedStrictJsonSchemaError("anyOf must contain at least one schema");
@@ -239,7 +242,7 @@ function createGrammarToolInputProperties(tools, supportsOpenAIGrammarTools) {
239
242
  return properties;
240
243
  }
241
244
 
242
- // node_modules/.pnpm/@earendil-works+pi-ai@1.5.2_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_b842a8cec34a633ed5f728049ae89b72/node_modules/@earendil-works/pi-ai/dist/utils/estimate.js
245
+ // node_modules/.pnpm/@earendil-works+pi-ai@1.6.1_@smithy+signature-v4@5.7.3_google-auth-library@10.7.0_suppo_bdf1b0d1b5e752e25be2c525cddbb146/node_modules/@earendil-works/pi-ai/dist/utils/estimate.js
243
246
  var CHARS_PER_TOKEN = 3.5;
244
247
  var ESTIMATED_IMAGE_CHARS = 4800;
245
248
  function calculateContextTokens(usage) {
@@ -324,7 +327,7 @@ function estimateToolsTokens(tools) {
324
327
  return estimateTextTokens(safeJsonStringify(tools));
325
328
  }
326
329
 
327
- // node_modules/.pnpm/@earendil-works+pi-ai@1.5.2_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_b842a8cec34a633ed5f728049ae89b72/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js
330
+ // node_modules/.pnpm/@earendil-works+pi-ai@1.6.1_@smithy+signature-v4@5.7.3_google-auth-library@10.7.0_suppo_bdf1b0d1b5e752e25be2c525cddbb146/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js
328
331
  var CONTEXT_SAFETY_TOKENS = 4096;
329
332
  var CONTEXT_SAFETY_RATIO = 0.15;
330
333
  var MIN_OUTPUT_WITH_RATIO_MARGIN = 32768;
@@ -399,7 +402,7 @@ function adjustMaxTokensForThinking(baseMaxTokens, modelMaxTokens, reasoningLeve
399
402
  return { maxTokens, thinkingBudget };
400
403
  }
401
404
 
402
- // node_modules/.pnpm/@earendil-works+pi-ai@1.5.2_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_b842a8cec34a633ed5f728049ae89b72/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.js
405
+ // node_modules/.pnpm/@earendil-works+pi-ai@1.6.1_@smithy+signature-v4@5.7.3_google-auth-library@10.7.0_suppo_bdf1b0d1b5e752e25be2c525cddbb146/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.js
403
406
  var NON_VISION_USER_IMAGE_PLACEHOLDER = "(image omitted: model does not support images)";
404
407
  var NON_VISION_TOOL_IMAGE_PLACEHOLDER = "(tool image omitted: model does not support images)";
405
408
  var ERROR_TOOL_IMAGE_PLACEHOLDER = "(image attached after the tool results)";
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __nerveCreateRequire } from "node:module";
2
2
  const require = __nerveCreateRequire(import.meta.url);
3
3
 
4
- // node_modules/.pnpm/@earendil-works+pi-ai@1.5.2_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_b842a8cec34a633ed5f728049ae89b72/node_modules/@earendil-works/pi-ai/dist/auth/oauth/trusted-url.js
4
+ // node_modules/.pnpm/@earendil-works+pi-ai@1.6.1_@smithy+signature-v4@5.7.3_google-auth-library@10.7.0_suppo_bdf1b0d1b5e752e25be2c525cddbb146/node_modules/@earendil-works/pi-ai/dist/auth/oauth/trusted-url.js
5
5
  function trustedHttpUrl(value) {
6
6
  if (typeof value !== "string" || !URL.canParse(value))
7
7
  return null;
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __nerveCreateRequire } from "node:module";
2
2
  const require = __nerveCreateRequire(import.meta.url);
3
3
 
4
- // node_modules/.pnpm/@earendil-works+pi-ai@1.5.2_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_b842a8cec34a633ed5f728049ae89b72/node_modules/@earendil-works/pi-ai/dist/auth/oauth/device-code.js
4
+ // node_modules/.pnpm/@earendil-works+pi-ai@1.6.1_@smithy+signature-v4@5.7.3_google-auth-library@10.7.0_suppo_bdf1b0d1b5e752e25be2c525cddbb146/node_modules/@earendil-works/pi-ai/dist/auth/oauth/device-code.js
5
5
  var CANCEL_MESSAGE = "Login cancelled";
6
6
  var TIMEOUT_MESSAGE = "Device flow timed out";
7
7
  var SLOW_DOWN_TIMEOUT_MESSAGE = "Device flow timed out after one or more slow_down responses. This is often caused by clock drift in WSL or VM environments. Please sync or restart the VM clock and try again.";
@@ -0,0 +1,37 @@
1
+ import { createRequire as __nerveCreateRequire } from "node:module";
2
+ const require = __nerveCreateRequire(import.meta.url);
3
+ import {
4
+ classifySystemOne
5
+ } from "./chunk-7MJT6LHU.js";
6
+ import {
7
+ isRecord
8
+ } from "./chunk-CZXRZEV4.js";
9
+ import {
10
+ isOpenRouterModel
11
+ } from "./chunk-R22FWLXU.js";
12
+ import "./chunk-MRDORR5Z.js";
13
+ import "./chunk-EOZLBW5E.js";
14
+ import "./chunk-NSISYP6D.js";
15
+ import "./chunk-WJAHXDL4.js";
16
+ import "./chunk-A3OFIREH.js";
17
+ import "./chunk-FNWUCFVO.js";
18
+ import "./chunk-EZJH7ED5.js";
19
+ import "./chunk-CWESUMYQ.js";
20
+
21
+ // node_modules/.pnpm/@earendil-works+pi-ai@1.6.1_@smithy+signature-v4@5.7.3_google-auth-library@10.7.0_suppo_bdf1b0d1b5e752e25be2c525cddbb146/node_modules/@earendil-works/pi-ai/dist/api/typesafe-system-one.js
22
+ var transport = {
23
+ api: "typesafe-system-one",
24
+ label: "System One API",
25
+ detectCompat: (model) => isOpenRouterModel(model) ? { imageInput: "state-image-urls", sendImageOptInHeader: false } : { imageInput: "assets", sendImageOptInHeader: true },
26
+ url: (model) => new URL("systemone", `${model.baseUrl.replace(/\/+$/u, "")}/`),
27
+ payload: (model, request) => ({ model: model.id, ...request }),
28
+ output: (body) => {
29
+ if (!isRecord(body))
30
+ throw new Error("System One API returned an unexpected response");
31
+ return body;
32
+ }
33
+ };
34
+ var classify = (model, context, options) => classifySystemOne(transport, model, context, options);
35
+ export {
36
+ classify
37
+ };
@@ -2,7 +2,6 @@ import { createRequire as __nerveCreateRequire } from "node:module";
2
2
  const require = __nerveCreateRequire(import.meta.url);
3
3
  import {
4
4
  ChangeMonitor,
5
- NativeGitReadError,
6
5
  NativeOperationError,
7
6
  checkGitAncestry,
8
7
  configureManagedProcessRuntime,
@@ -30,11 +29,10 @@ import {
30
29
  terminateManagedTarget,
31
30
  terminateTcpListener,
32
31
  validateGitBranchName
33
- } from "./chunk-MTHLTFG4.js";
32
+ } from "./chunk-5VLAJMQQ.js";
34
33
  import "./chunk-CWESUMYQ.js";
35
34
  export {
36
35
  ChangeMonitor,
37
- NativeGitReadError,
38
36
  NativeOperationError,
39
37
  checkGitAncestry,
40
38
  configureManagedProcessRuntime,
@@ -1,22 +1,18 @@
1
1
  import { createRequire as __nerveCreateRequire } from "node:module";
2
2
  const require = __nerveCreateRequire(import.meta.url);
3
- import {
4
- applyOpenRouterReportedCost,
5
- isOpenRouterModel
6
- } from "./chunk-N4OXAS3A.js";
7
3
  import {
8
4
  buildCopilotDynamicHeaders,
9
5
  hasCopilotVisionInput
10
- } from "./chunk-TQURLRHD.js";
6
+ } from "./chunk-IL67WXRA.js";
11
7
  import {
12
8
  clampOpenAIPromptCacheKey
13
- } from "./chunk-KUFIFCB4.js";
9
+ } from "./chunk-KDGUQYYY.js";
14
10
  import {
15
11
  OpenAI
16
- } from "./chunk-NW3DH7IK.js";
12
+ } from "./chunk-RAHBWFWV.js";
17
13
  import {
18
14
  shortHash
19
- } from "./chunk-LP4APBBQ.js";
15
+ } from "./chunk-FZ7U3GZI.js";
20
16
  import {
21
17
  appendGrammarToolInputJsonDelta,
22
18
  buildBaseOptions,
@@ -30,46 +26,84 @@ import {
30
26
  resolveSamplingParams,
31
27
  thinkingBudgetForLevel,
32
28
  transformMessages
33
- } from "./chunk-Z6AY5VOZ.js";
29
+ } from "./chunk-RQIN5JYO.js";
34
30
  import {
35
31
  sanitizeSurrogates
36
- } from "./chunk-TSAUBRRU.js";
32
+ } from "./chunk-P7GPT4XL.js";
33
+ import {
34
+ applyOpenRouterReportedCost,
35
+ isOpenRouterModel
36
+ } from "./chunk-R22FWLXU.js";
37
37
  import {
38
38
  retryProviderRequest
39
- } from "./chunk-3CZXUKLG.js";
39
+ } from "./chunk-MRDORR5Z.js";
40
40
  import {
41
41
  formatProviderError,
42
42
  normalizeProviderError
43
- } from "./chunk-PVPJAGWR.js";
43
+ } from "./chunk-EOZLBW5E.js";
44
44
  import {
45
45
  headersToRecord
46
- } from "./chunk-6IHXVT5H.js";
46
+ } from "./chunk-NSISYP6D.js";
47
47
  import {
48
48
  getProviderEnvValue
49
- } from "./chunk-JBEWFFOK.js";
49
+ } from "./chunk-LIIGX2XX.js";
50
50
  import {
51
51
  ToolCallArgumentsStream
52
- } from "./chunk-BG2KGLIA.js";
52
+ } from "./chunk-WMZAJ7XA.js";
53
53
  import {
54
54
  calculateCost,
55
55
  clampThinkingLevel,
56
56
  getDeclaredTools,
57
57
  resolveTranscript,
58
58
  resolveTranscriptTools
59
- } from "./chunk-W7LEYYFH.js";
59
+ } from "./chunk-WJAHXDL4.js";
60
60
  import {
61
61
  AssistantMessageEventStream
62
- } from "./chunk-DDBE2VLT.js";
62
+ } from "./chunk-A3OFIREH.js";
63
63
  import {
64
64
  getIdentityHeaders
65
- } from "./chunk-Q3C7TQ2M.js";
65
+ } from "./chunk-FNWUCFVO.js";
66
66
  import {
67
67
  getSystemMessageText,
68
68
  renderSystemMessageUpdate
69
- } from "./chunk-U5KGV63C.js";
69
+ } from "./chunk-EZJH7ED5.js";
70
70
  import "./chunk-CWESUMYQ.js";
71
71
 
72
- // node_modules/.pnpm/@earendil-works+pi-ai@1.5.2_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_b842a8cec34a633ed5f728049ae89b72/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js
72
+ // node_modules/.pnpm/@earendil-works+pi-ai@1.6.1_@smithy+signature-v4@5.7.3_google-auth-library@10.7.0_suppo_bdf1b0d1b5e752e25be2c525cddbb146/node_modules/@earendil-works/pi-ai/dist/utils/openrouter-finish-reason.js
73
+ function readOpenRouterNativeFinishReason(choice) {
74
+ const native = choice.native_finish_reason;
75
+ return typeof native === "string" && native.length > 0 ? native : void 0;
76
+ }
77
+ function applyOpenRouterNativeFinishReason(message, finishReason, nativeReason) {
78
+ if (nativeReason === finishReason)
79
+ return;
80
+ message.rawStopReason = `${finishReason}.${nativeReason}`;
81
+ if (message.stopReason === "error" && message.errorMessage) {
82
+ message.errorMessage += ` (native_finish_reason: ${nativeReason})`;
83
+ }
84
+ }
85
+ var CLEAN_STOP_NATIVE_REASONS = /* @__PURE__ */ new Set([
86
+ "stop",
87
+ "end_turn",
88
+ "stop_sequence",
89
+ "eos",
90
+ "complete",
91
+ "completed",
92
+ "pause_turn",
93
+ "compaction",
94
+ "end_of_stream"
95
+ ]);
96
+ function flagOpenRouterEmptyStop(message, nativeReason) {
97
+ if (message.stopReason !== "stop" || CLEAN_STOP_NATIVE_REASONS.has(nativeReason.toLowerCase()))
98
+ return;
99
+ const hasVisibleOutput = message.content.some((block) => block.type === "toolCall" || block.type === "text" && block.text.trim().length > 0);
100
+ if (hasVisibleOutput)
101
+ return;
102
+ message.stopReason = "error";
103
+ message.errorMessage = `OpenRouter returned an empty response (native_finish_reason: ${nativeReason})`;
104
+ }
105
+
106
+ // node_modules/.pnpm/@earendil-works+pi-ai@1.6.1_@smithy+signature-v4@5.7.3_google-auth-library@10.7.0_suppo_bdf1b0d1b5e752e25be2c525cddbb146/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js
73
107
  function hasHeader(headers, name) {
74
108
  if (!headers)
75
109
  return false;
@@ -233,13 +267,16 @@ var stream = (model, context, options) => {
233
267
  const { data: openaiStream, response } = await retryProviderRequest(() => client.chat.completions.create(params, requestOptions).withResponse(), {
234
268
  maxRetries: options?.maxRetries,
235
269
  maxRetryDelayMs: options?.maxRetryDelayMs,
236
- signal: options?.signal
270
+ signal: options?.signal,
271
+ onErrorResponse: (errorResponse) => options?.onResponse?.(errorResponse, model)
237
272
  });
238
273
  await options?.onResponse?.({ status: response.status, headers: headersToRecord(response.headers) }, model);
239
274
  stream2.push({ type: "start", partial: output });
240
275
  let textBlock = null;
241
276
  let thinkingBlock = null;
242
277
  let hasFinishReason = false;
278
+ const isOpenRouter = isOpenRouterModel(model);
279
+ let nativeFinishReason;
243
280
  const toolCallBlocksByIndex = /* @__PURE__ */ new Map();
244
281
  const toolCallBlocksById = /* @__PURE__ */ new Map();
245
282
  const toolCallStates = /* @__PURE__ */ new Map();
@@ -381,6 +418,9 @@ var stream = (model, context, options) => {
381
418
  if (!chunk.usage && choice.usage) {
382
419
  output.usage = parseChunkUsage(choice.usage, model);
383
420
  }
421
+ if (isOpenRouter) {
422
+ nativeFinishReason = readOpenRouterNativeFinishReason(choice) ?? nativeFinishReason;
423
+ }
384
424
  if (choice.finish_reason) {
385
425
  output.rawStopReason = choice.finish_reason;
386
426
  const finishReasonResult = mapStopReason(choice.finish_reason);
@@ -388,6 +428,9 @@ var stream = (model, context, options) => {
388
428
  if (finishReasonResult.errorMessage) {
389
429
  output.errorMessage = finishReasonResult.errorMessage;
390
430
  }
431
+ if (nativeFinishReason) {
432
+ applyOpenRouterNativeFinishReason(output, choice.finish_reason, nativeFinishReason);
433
+ }
391
434
  hasFinishReason = true;
392
435
  }
393
436
  if (choice.delta) {
@@ -477,6 +520,9 @@ var stream = (model, context, options) => {
477
520
  if (!hasFinishReason && !compat.supportsFinishReason) {
478
521
  output.stopReason = output.content.some((block) => block.type === "toolCall") ? "toolUse" : "stop";
479
522
  }
523
+ if (nativeFinishReason) {
524
+ flagOpenRouterEmptyStop(output, nativeFinishReason);
525
+ }
480
526
  if (output.stopReason === "error") {
481
527
  throw new Error(output.errorMessage || "Provider returned an error stop reason");
482
528
  }
@@ -1073,7 +1119,7 @@ function parseChunkUsage(rawUsage, model) {
1073
1119
  output: outputTokens,
1074
1120
  cacheRead: cacheReadTokens,
1075
1121
  cacheWrite: cacheWriteTokens,
1076
- reasoning: rawUsage.completion_tokens_details?.reasoning_tokens || 0,
1122
+ reasoning: rawUsage.completion_tokens_details?.reasoning_tokens || rawUsage.reasoning_tokens || 0,
1077
1123
  totalTokens: input + outputTokens + cacheReadTokens + cacheWriteTokens,
1078
1124
  cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
1079
1125
  };
@@ -1122,11 +1168,11 @@ function detectCompat(model) {
1122
1168
  const isNonStandard = isNvidia || isCerebras || provider === "xai" || baseUrl.includes("api.x.ai") || isTogether || baseUrl.includes("chutes.ai") || isDeepSeek || isZai || isMoonshot || provider === "opencode" || baseUrl.includes("opencode.ai") || isCloudflareWorkersAI || isCloudflareAiGateway || isAntLing;
1123
1169
  const useMaxTokens = baseUrl.includes("chutes.ai") || isDeepSeek || isMoonshot || isCloudflareAiGateway || isTogether || isNvidia || isAntLing || isZai;
1124
1170
  const isGrok = provider === "xai" || baseUrl.includes("api.x.ai");
1125
- const isOpenRouterDeveloperRoleModel = isOpenRouter && (model.id.startsWith("anthropic/") || model.id.startsWith("openai/"));
1171
+ const isOpenAI = provider === "openai" || baseUrl.includes("api.openai.com");
1126
1172
  const cacheControlFormat = provider === "openrouter" && model.id.startsWith("anthropic/") ? "anthropic" : void 0;
1127
1173
  return {
1128
1174
  supportsStore: !isNonStandard,
1129
- supportsDeveloperRole: isOpenRouterDeveloperRoleModel || !isNonStandard && !isOpenRouter,
1175
+ supportsDeveloperRole: isOpenAI,
1130
1176
  supportsReasoningEffort: !isGrok && !isZai && !isMoonshot && !isTogether && !isCloudflareAiGateway && !isNvidia && !isAntLing,
1131
1177
  supportsUsageInStreaming: true,
1132
1178
  supportsFinishReason: true,
@@ -2,9 +2,9 @@ import { createRequire as __nerveCreateRequire } from "node:module";
2
2
  const require = __nerveCreateRequire(import.meta.url);
3
3
  import {
4
4
  registerSessionResourceCleanup
5
- } from "./chunk-ZVH6EB7S.js";
5
+ } from "./chunk-QKRWXA5W.js";
6
6
 
7
- // node_modules/.pnpm/@earendil-works+pi-ai@1.5.2_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_b842a8cec34a633ed5f728049ae89b72/node_modules/@earendil-works/pi-ai/dist/api/strict-tool-limits.js
7
+ // node_modules/.pnpm/@earendil-works+pi-ai@1.6.1_@smithy+signature-v4@5.7.3_google-auth-library@10.7.0_suppo_bdf1b0d1b5e752e25be2c525cddbb146/node_modules/@earendil-works/pi-ai/dist/api/strict-tool-limits.js
8
8
  var STRICT_TOOL_LIMIT_ERROR_MESSAGES = [
9
9
  "The compiled grammar is too large",
10
10
  "Too many strict tools (",
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __nerveCreateRequire } from "node:module";
2
2
  const require = __nerveCreateRequire(import.meta.url);
3
3
 
4
- // node_modules/.pnpm/@earendil-works+pi-ai@1.5.2_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_b842a8cec34a633ed5f728049ae89b72/node_modules/@earendil-works/pi-ai/dist/utils/abort-signals.js
4
+ // node_modules/.pnpm/@earendil-works+pi-ai@1.6.1_@smithy+signature-v4@5.7.3_google-auth-library@10.7.0_suppo_bdf1b0d1b5e752e25be2c525cddbb146/node_modules/@earendil-works/pi-ai/dist/utils/abort-signals.js
5
5
  function combineAbortSignals(signals) {
6
6
  const activeSignals = signals.filter((signal) => signal !== void 0);
7
7
  if (activeSignals.length === 0) {
@@ -4,13 +4,13 @@ import {
4
4
  generatePKCE,
5
5
  oauthErrorHtml,
6
6
  oauthSuccessHtml
7
- } from "./chunk-BACYVEE6.js";
7
+ } from "./chunk-QC6DSC4D.js";
8
8
  import {
9
9
  getProviderEnvValue
10
- } from "./chunk-JBEWFFOK.js";
10
+ } from "./chunk-LIIGX2XX.js";
11
11
  import "./chunk-CWESUMYQ.js";
12
12
 
13
- // node_modules/.pnpm/@earendil-works+pi-ai@1.5.2_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_b842a8cec34a633ed5f728049ae89b72/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-chatgpt.js
13
+ // node_modules/.pnpm/@earendil-works+pi-ai@1.6.1_@smithy+signature-v4@5.7.3_google-auth-library@10.7.0_suppo_bdf1b0d1b5e752e25be2c525cddbb146/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-chatgpt.js
14
14
  import { randomBytes } from "node:crypto";
15
15
  import { createServer } from "node:http";
16
16
  var DYNAMIC_CLIENT_ID = "dynamic_agent_client";