ryco-cli 0.1.28 → 0.1.30

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 (278) hide show
  1. package/README.md +37 -0
  2. package/dist/{AcpAdapter-CG1wRWcf.mjs → AcpAdapter-CKWzfB3Q.mjs} +4 -4
  3. package/dist/{AcpAdapter-8CSe4HK7.cjs → AcpAdapter-DjP0IHpH.cjs} +6 -6
  4. package/dist/{AcpNativeLogging-DbjnRnTf.cjs → AcpNativeLogging-5gTPK9Fq.cjs} +1 -1
  5. package/dist/{AcpNativeLogging-B6TtnnKL.mjs → AcpNativeLogging-Do0LktDb.mjs} +1 -1
  6. package/dist/{AcpRegistryDriver-16ZTxUs3.cjs → AcpRegistryDriver-BblCFfev.cjs} +3 -3
  7. package/dist/{AcpRegistryDriver-DZFasKaz.mjs → AcpRegistryDriver-BzohT-PC.mjs} +3 -3
  8. package/dist/{AzureDevOpsSourceControlProvider-DmJD1-WL.cjs → AzureDevOpsSourceControlProvider-CKSvfuDS.cjs} +1 -1
  9. package/dist/{AzureDevOpsSourceControlProvider-d5Ogsspk.mjs → AzureDevOpsSourceControlProvider-DRWSXTml.mjs} +1 -1
  10. package/dist/{BitbucketSourceControlProvider-B-ZwKj72.cjs → BitbucketSourceControlProvider-Bvl_q1o2.cjs} +1 -1
  11. package/dist/{BitbucketSourceControlProvider-DplKc8Wo.mjs → BitbucketSourceControlProvider-D5UVAc9z.mjs} +1 -1
  12. package/dist/{ClaudeDriver-0gGVop27.mjs → ClaudeDriver-BuQ_azDw.mjs} +7 -7
  13. package/dist/{ClaudeDriver-r0lJ9vmE.cjs → ClaudeDriver-DZkz0QPr.cjs} +8 -8
  14. package/dist/{CodexDriver-bJAbhSwY.cjs → CodexDriver-6Ph2cjAW.cjs} +5 -5
  15. package/dist/{CodexDriver-baT02xVb.mjs → CodexDriver-Bi49RIL4.mjs} +4 -4
  16. package/dist/{CodexTextGeneration-Dwp6X3dq.mjs → CodexTextGeneration-C5TIspJA.mjs} +4 -4
  17. package/dist/{CodexTextGeneration-DFZ5y4gj.cjs → CodexTextGeneration-sXPR9eld.cjs} +4 -4
  18. package/dist/{CopilotDriver-C0OhnSB1.mjs → CopilotDriver-Bcdpz6U_.mjs} +5 -5
  19. package/dist/{CopilotDriver-B_jEqfYQ.cjs → CopilotDriver-D6P0xgRX.cjs} +5 -5
  20. package/dist/{CursorDriver-DinXkGP9.mjs → CursorDriver-CRnDGwEv.mjs} +6 -6
  21. package/dist/{CursorDriver-BBFEW7ZI.cjs → CursorDriver-DMJ7sGSx.cjs} +7 -7
  22. package/dist/{ForgejoSourceControlProvider-iG9o7aZB.cjs → ForgejoSourceControlProvider-D4jGdaJX.cjs} +1 -1
  23. package/dist/{ForgejoSourceControlProvider-Dr0fxfud.mjs → ForgejoSourceControlProvider-Dl_Fk3RY.mjs} +1 -1
  24. package/dist/{GitHubSourceControlProvider-CnIu0n2Y.mjs → GitHubSourceControlProvider-DnwKf0ap.mjs} +1 -1
  25. package/dist/{GitHubSourceControlProvider-L1yFpep4.cjs → GitHubSourceControlProvider-QMe-zymI.cjs} +1 -1
  26. package/dist/{GitLabSourceControlProvider-BZdwXdJl.mjs → GitLabSourceControlProvider-Cj07OTBD.mjs} +1 -1
  27. package/dist/{GitLabSourceControlProvider-CrcBR6KQ.cjs → GitLabSourceControlProvider-CvvN5pHt.cjs} +1 -1
  28. package/dist/{GrokDriver-pX-N6HGS.mjs → GrokDriver-Bvq1jP3S.mjs} +7 -7
  29. package/dist/{GrokDriver-D_Ylzh5z.cjs → GrokDriver-jy8JIvYY.cjs} +10 -10
  30. package/dist/{Metrics-Bf96NJ4j.cjs → Metrics-C0LSU8s7.cjs} +979 -976
  31. package/dist/{Metrics-BjqGlIP4.mjs → Metrics-CnmjpbWk.mjs} +979 -976
  32. package/dist/{NodeSqliteClient-BGg70C7Q.cjs → NodeSqliteClient-D8bzGgPN.cjs} +1 -1
  33. package/dist/{OpenCodeDriver-BFEw5t09.cjs → OpenCodeDriver-Bu5D19tl.cjs} +6 -6
  34. package/dist/{OpenCodeDriver-Byu1pf_i.mjs → OpenCodeDriver-DhyVaBMT.mjs} +5 -5
  35. package/dist/{SideQuestionIsolation-81IoAuoi.mjs → SideQuestionIsolation-B-aE6aBz.mjs} +1 -1
  36. package/dist/{SideQuestionIsolation-CMPkCUP0.cjs → SideQuestionIsolation-CtJ4wX83.cjs} +1 -1
  37. package/dist/bin.cjs +8580 -305
  38. package/dist/bin.mjs +8560 -268
  39. package/dist/client/assets/{AccountSettings-DF6okodO.js → AccountSettings-v6-r6gYl.js} +1 -1
  40. package/dist/client/assets/{AiFocusSettings-BNNr6MW3.js → AiFocusSettings-BVdLON0q.js} +1 -1
  41. package/dist/client/assets/{AnimatedHeight-q2A-ikJ5.js → AnimatedHeight-UXn4-nUd.js} +1 -1
  42. package/dist/client/assets/{AppearanceSettings-BD0MZkm7.js → AppearanceSettings-DRChsQnN.js} +1 -1
  43. package/dist/client/assets/{BranchToolbar.logic-DN0He2gp.js → BranchToolbar.logic-YN3KjVr9.js} +1 -1
  44. package/dist/client/assets/{BrowserPanel-C_ddyv_7.js → BrowserPanel-Dxw3stFP.js} +1 -1
  45. package/dist/client/assets/{ChatRightPanel-B62ml3EW.js → ChatRightPanel-CygpcJiF.js} +5 -5
  46. package/dist/client/assets/{ChatThreadRouteView-BnvzR19h.js → ChatThreadRouteView-DYLZFHu0.js} +1 -1
  47. package/dist/client/assets/{CommandPaletteDialog-KtIlImWg.js → CommandPaletteDialog-BRvBzP1R.js} +1 -1
  48. package/dist/client/assets/{CompositeRoot-CTspN_gA.js → CompositeRoot-BeEGGWwn.js} +1 -1
  49. package/dist/client/assets/{ComputerUseSettings-B4KnZnFy.js → ComputerUseSettings-Cq8Pi0ZU.js} +1 -1
  50. package/dist/client/assets/{ConnectionsSettings-BW1hWm-b.js → ConnectionsSettings-RSYtexxd.js} +2 -2
  51. package/dist/client/assets/{ContextHandoffEndpointLabel-BCNMjnEV.js → ContextHandoffEndpointLabel-CeGDLNA4.js} +1 -1
  52. package/dist/client/assets/{DiagnosticsSettings-Biqth29E.js → DiagnosticsSettings-CDa6MVx4.js} +1 -1
  53. package/dist/client/assets/{DialogHandle-B1kG1DEu.js → DialogHandle-BE7egDQQ.js} +1 -1
  54. package/dist/client/assets/{DialogPopup-CZ-twaqA.js → DialogPopup-NfwDyR5c.js} +1 -1
  55. package/dist/client/assets/DialogRoot-C4mtzigX.js +1 -0
  56. package/dist/client/assets/{DialogTitle-D8Vib3Xi.js → DialogTitle-B_Q4DykI.js} +1 -1
  57. package/dist/client/assets/{DialogTrigger-C8WNfJfY.js → DialogTrigger-BSqd4Crj.js} +1 -1
  58. package/dist/client/assets/{DialogViewport-BzuRIust.js → DialogViewport-B6w_ROOE.js} +1 -1
  59. package/dist/client/assets/{DraftChatThreadRouteView-Bf196For.js → DraftChatThreadRouteView-JW_bXVrM.js} +1 -1
  60. package/dist/client/assets/{ExternalIdentityWeb.logic-DsTJQkg-.js → ExternalIdentityWeb.logic-BlKX8J9h.js} +1 -1
  61. package/dist/client/assets/{GlassSurface-R5jo7uZp.js → GlassSurface-DDG4eTlj.js} +1 -1
  62. package/dist/client/assets/{HostedConnectionControls-xi9LAlqs.js → HostedConnectionControls-CscV6hm1.js} +1 -1
  63. package/dist/client/assets/{HostedHubRoot-B5cJPL0b.js → HostedHubRoot-gp7-ClBP.js} +1 -1
  64. package/dist/client/assets/{HostedNativeAuthorizationRoute-BPxYI2S8.js → HostedNativeAuthorizationRoute-j7oSlakZ.js} +1 -1
  65. package/dist/client/assets/{HostedNodeRenameDialog-CZ6B6eOA.js → HostedNodeRenameDialog-D1DSiTpx.js} +1 -1
  66. package/dist/client/assets/{HostedRelayTrustNotice-Da0fanPZ.js → HostedRelayTrustNotice-B9jp4SRh.js} +1 -1
  67. package/dist/client/assets/{IntegrationsSettingsPanel-CVIFEYar.js → IntegrationsSettingsPanel-DH7SfWtV.js} +1 -1
  68. package/dist/client/assets/{KeybindingsSettings-FJVISTz3.js → KeybindingsSettings-DkgYYSHS.js} +1 -1
  69. package/dist/client/assets/{LazyBrowserPanel-ChCZntfd.js → LazyBrowserPanel-D4e76vc_.js} +1 -1
  70. package/dist/client/assets/{McpServersSettings-D5qSFad1.js → McpServersSettings-Dc1kPa-X.js} +1 -1
  71. package/dist/client/assets/{MobileSheet-BZwVUjae.js → MobileSheet-lT--mLEz.js} +1 -1
  72. package/dist/client/assets/{NodeSecuritySettings-C9eJS4Wt.js → NodeSecuritySettings-DcfSx4KT.js} +1 -1
  73. package/dist/client/assets/{NullStore-iCZTvdl5.js → NullStore-8d2s-Re3.js} +1 -1
  74. package/dist/client/assets/{OnboardingDialog-lWnlzsHQ.js → OnboardingDialog-CnLjwM6Z.js} +1 -1
  75. package/dist/client/assets/{OpinionatedPluginsSettings-DQ77FhYa.js → OpinionatedPluginsSettings-BTJyS3rN.js} +1 -1
  76. package/dist/client/assets/{PdfAttachmentPreview-CmCBedSk.js → PdfAttachmentPreview-C8-hT8KQ.js} +1 -1
  77. package/dist/client/assets/{PhoneGetAppInterstitial-DU7Pjbrv.js → PhoneGetAppInterstitial-Zh0zpBgT.js} +1 -1
  78. package/dist/client/assets/{PhoneHome-D91zzTlE.js → PhoneHome-CIMkuDJF.js} +1 -1
  79. package/dist/client/assets/{PhoneSettingsSurface-vyuCLVtH.js → PhoneSettingsSurface-CfZQxJNI.js} +1 -1
  80. package/dist/client/assets/{ProvidersSettingsPanel-QMtod_bc.js → ProvidersSettingsPanel-DAVSiwE1.js} +1 -1
  81. package/dist/client/assets/{QuitShortcutFeedback-Bti16E53.js → QuitShortcutFeedback-Qs9XsuZ4.js} +1 -1
  82. package/dist/client/assets/{RedactedSensitiveText-9r8QC1lJ.js → RedactedSensitiveText-BHGbQJwB.js} +1 -1
  83. package/dist/client/assets/{RootAppShell-CYT2IfYW.js → RootAppShell-T056pByH.js} +2 -2
  84. package/dist/client/assets/{Separator-ClXl-hQH.js → Separator-B6Esv57Y.js} +1 -1
  85. package/dist/client/assets/{SettingsDialog-BUcF48F9.js → SettingsDialog-BERU2Qg7.js} +1 -1
  86. package/dist/client/assets/{SettingsPanels-BydjDF1I.js → SettingsPanels-De_XZOQF.js} +1 -1
  87. package/dist/client/assets/{SettingsPanels.editor-zrq4ZT2j.js → SettingsPanels.editor-Dkva9gX_.js} +1 -1
  88. package/dist/client/assets/{SourceControlSettings-CqVmc4sB.js → SourceControlSettings-B4HS17cB.js} +1 -1
  89. package/dist/client/assets/{StatisticsPage-k-gimGKE.js → StatisticsPage-Bj2ftFdH.js} +1 -1
  90. package/dist/client/assets/{StatisticsPanel-CtShfsl4.js → StatisticsPanel-Dw7GBBmd.js} +1 -1
  91. package/dist/client/assets/{StatisticsSettingsLink-BapVo9aC.js → StatisticsSettingsLink-_XL3ABoI.js} +1 -1
  92. package/dist/client/assets/{ThreadTerminalDrawer-Bfs5NCNv.js → ThreadTerminalDrawer-CPPzQSXN.js} +1 -1
  93. package/dist/client/assets/{ThreadWorkspacePanel-L6uNQRNX.js → ThreadWorkspacePanel-DWKU7Omm.js} +1 -1
  94. package/dist/client/assets/{abnfDiagram-N423BO3Z-BzwwixLv.js → abnfDiagram-N423BO3Z-ByEe3mC0.js} +1 -1
  95. package/dist/client/assets/{activity-CPE_7Kqw.js → activity-CwTUF6lv.js} +1 -1
  96. package/dist/client/assets/{alert-DVbwtykC.js → alert-DQEkrtUJ.js} +1 -1
  97. package/dist/client/assets/{appChrome-B_VWWDFj.js → appChrome-TkWLAGxk.js} +1 -1
  98. package/dist/client/assets/architecture-7GRP2DOG-HS59zfrk.js +1 -0
  99. package/dist/client/assets/{architectureDiagram-T3A2C74G-DEiVciWZ.js → architectureDiagram-T3A2C74G-Bd-yxaTr.js} +1 -1
  100. package/dist/client/assets/{arrow-left-Ce-aUiy1.js → arrow-left-DUOpzEbP.js} +1 -1
  101. package/dist/client/assets/{arrow-right-BEwkAmxp.js → arrow-right-HOYJnPKw.js} +1 -1
  102. package/dist/client/assets/{arrow-up-right-CLCNhOeC.js → arrow-up-right-DHnMKuVA.js} +1 -1
  103. package/dist/client/assets/{authorization-BugIGt5e.js → authorization-D8dOcEYq.js} +1 -1
  104. package/dist/client/assets/{badge-DqZmJa1g.js → badge-2AZ3HfVS.js} +1 -1
  105. package/dist/client/assets/{blockDiagram-VBNYF7ZC-C-PBzm5g.js → blockDiagram-VBNYF7ZC-CPDBonMC.js} +1 -1
  106. package/dist/client/assets/{bot-k1yDQ5mQ.js → bot-DxjPA7Bw.js} +1 -1
  107. package/dist/client/assets/{c4Diagram-5PPSVZJV-DB6SIv2V.js → c4Diagram-5PPSVZJV-BM6pAiqT.js} +1 -1
  108. package/dist/client/assets/{capabilities-C9OPiefV.js → capabilities-CsHjxjab.js} +1 -1
  109. package/dist/client/assets/channel-Dn3_cOkm.js +1 -0
  110. package/dist/client/assets/{chart-column-CVU4MshQ.js → chart-column-Cg7d41tb.js} +1 -1
  111. package/dist/client/assets/chevron-right-Dsw16yGn.js +1 -0
  112. package/dist/client/assets/{chunk-2GRJ4B5K-CFM4Ac_N.js → chunk-2GRJ4B5K-DVKozJ41.js} +1 -1
  113. package/dist/client/assets/{chunk-4I5QYGJK-a9tLNjnj.js → chunk-4I5QYGJK-BRoMwPkW.js} +1 -1
  114. package/dist/client/assets/{chunk-5RXB4S5H-CbEb4Ht8.js → chunk-5RXB4S5H-DFMKyoqP.js} +1 -1
  115. package/dist/client/assets/{chunk-6Q2QTUOP-DPUmSmhc.js → chunk-6Q2QTUOP-Ba6UENe9.js} +1 -1
  116. package/dist/client/assets/{chunk-7Z6QIM7H-Ba8d__CQ.js → chunk-7Z6QIM7H-B87gYLWH.js} +1 -1
  117. package/dist/client/assets/{chunk-GF5L2VYU-BKOdlQ2f.js → chunk-GF5L2VYU-DZ840GRQ.js} +1 -1
  118. package/dist/client/assets/{chunk-I66GZJ75-DAfCveu2.js → chunk-I66GZJ75-BO6p4Aqg.js} +1 -1
  119. package/dist/client/assets/{chunk-JQJVKLGR-CPzgDuD8.js → chunk-JQJVKLGR-5dTfVinz.js} +1 -1
  120. package/dist/client/assets/{chunk-KBJHAD2P-X87J_pHD.js → chunk-KBJHAD2P-BeWfBZdP.js} +1 -1
  121. package/dist/client/assets/{chunk-NSK5VX7P-BgrjQWAz.js → chunk-NSK5VX7P-DuRkdn5k.js} +1 -1
  122. package/dist/client/assets/{chunk-QR6OTTB3-NTX__XXO.js → chunk-QR6OTTB3-Duz4Y_uE.js} +1 -1
  123. package/dist/client/assets/{chunk-UBXNYLIW-BVySE3ty.js → chunk-UBXNYLIW-D-z8URgN.js} +1 -1
  124. package/dist/client/assets/{chunk-W5SLKNZC-0-ctjkBJ.js → chunk-W5SLKNZC-AGjFjjoJ.js} +1 -1
  125. package/dist/client/assets/{chunk-WRU74C26-AGGo_1S7.js → chunk-WRU74C26-BgY3UiXB.js} +1 -1
  126. package/dist/client/assets/classDiagram-JCYQIIEL-ZQvrS8No.js +1 -0
  127. package/dist/client/assets/classDiagram-v2-OCEON4UE-ZQvrS8No.js +1 -0
  128. package/dist/client/assets/{clipboard-copy-C3icJCGA.js → clipboard-copy-BWf3JuTE.js} +1 -1
  129. package/dist/client/assets/{cynefin-OW5HDTMX-BR32cltb.js → cynefin-OW5HDTMX-BuOAGqlK.js} +1 -1
  130. package/dist/client/assets/{cynefinDiagram-MW4NZA55-B7S5bXUw.js → cynefinDiagram-MW4NZA55-DqV0Aokp.js} +1 -1
  131. package/dist/client/assets/{dagre-VZM6K2ZE-BZOfZvme.js → dagre-VZM6K2ZE-D_GFquDW.js} +1 -1
  132. package/dist/client/assets/{data-list-E_dNBqgV.js → data-list-BJCq3CVP.js} +1 -1
  133. package/dist/client/assets/{desktopWorkspace-DIoIhyml.js → desktopWorkspace-_iM6B9Kf.js} +1 -1
  134. package/dist/client/assets/{deviceName-BY2WK012.js → deviceName-C2N8ZRX3.js} +1 -1
  135. package/dist/client/assets/{diagram-7IWD3JNH-CypfFHxI.js → diagram-7IWD3JNH-B1wlsNg2.js} +1 -1
  136. package/dist/client/assets/{diagram-B4RE2ZJO-CaYsJtDz.js → diagram-B4RE2ZJO-D-CYoym7.js} +1 -1
  137. package/dist/client/assets/{diagram-LBJQPF4R-BdhZtcd2.js → diagram-LBJQPF4R-DqJ9NCqt.js} +1 -1
  138. package/dist/client/assets/{diagram-Q27KOJAE-CW1SMIBy.js → diagram-Q27KOJAE-3yp1D2u4.js} +1 -1
  139. package/dist/client/assets/{diagram-UB23O5K3-Cq8GGDkV.js → diagram-UB23O5K3-Byp25nGC.js} +1 -1
  140. package/dist/client/assets/{download-Fq1MsYfI.js → download-DsYNYJeu.js} +1 -1
  141. package/dist/client/assets/{ebnfDiagram-BXEA7PRR-CE78Op8p.js → ebnfDiagram-BXEA7PRR-B_IM1l6o.js} +1 -1
  142. package/dist/client/assets/{editorPreferences-DzxKMQJx.js → editorPreferences-D8q1ItMW.js} +1 -1
  143. package/dist/client/assets/{empty-DXTz-nBL.js → empty-BbJHvskr.js} +1 -1
  144. package/dist/client/assets/{erDiagram-JOGREHBK-Bn6BFae6.js → erDiagram-JOGREHBK--OtcrCRJ.js} +1 -1
  145. package/dist/client/assets/eventmodeling-NTZA5JFV-Dj71kuPV.js +1 -0
  146. package/dist/client/assets/flowDiagram-UKHOOZJN-BaAiwuvL.js +1 -0
  147. package/dist/client/assets/{ganttDiagram-PKOTCBZU-C8NbmUQP.js → ganttDiagram-PKOTCBZU-w0seBi3Q.js} +1 -1
  148. package/dist/client/assets/{gitGraph-4MIJSDKK-Dg7W2mOf.js → gitGraph-4MIJSDKK-BOJ0lcSW.js} +1 -1
  149. package/dist/client/assets/{gitGraphDiagram-DS77QQ5N-XEC1jydW.js → gitGraphDiagram-DS77QQ5N-BMfOCCYn.js} +1 -1
  150. package/dist/client/assets/{group-CcSMHbpZ.js → group-tVMKGp7Q.js} +1 -1
  151. package/dist/client/assets/{hostedConnectionCoordinator-BkxMXc2s.js → hostedConnectionCoordinator-BuRWCvUG.js} +1 -1
  152. package/dist/client/assets/hostedPairing-5n5srRC9.js +1 -0
  153. package/dist/client/assets/{hubRoutes-Ch__ge2L.js → hubRoutes-jcMPIFy3.js} +1 -1
  154. package/dist/client/assets/{index-3zoAo5bo.js → index-BqZvnGNr.js} +1 -1
  155. package/dist/client/assets/{info-A6RAGUB7-CPN5xH7s.js → info-A6RAGUB7-acjBTQ5o.js} +1 -1
  156. package/dist/client/assets/{infoDiagram-6WML65LV-DbXXnE3-.js → infoDiagram-6WML65LV-DB01Nc2m.js} +1 -1
  157. package/dist/client/assets/{input-zI-YDU9i.js → input-BDWSVClC.js} +1 -1
  158. package/dist/client/assets/{ishikawaDiagram-WSZJBQD7-DAjJrXWe.js → ishikawaDiagram-WSZJBQD7-KhZTvm-J.js} +1 -1
  159. package/dist/client/assets/{journeyDiagram-NVQOT4AX-CaGm-K-C.js → journeyDiagram-NVQOT4AX-C3JCYk-2.js} +1 -1
  160. package/dist/client/assets/{kanban-definition-27J2QSJJ-C2YRqY28.js → kanban-definition-27J2QSJJ-Dbo0C1s6.js} +1 -1
  161. package/dist/client/assets/{kbd-DlXUKjl1.js → kbd-Dxm5Elqj.js} +1 -1
  162. package/dist/client/assets/{key-round-DLUapaUr.js → key-round-CETZqe3h.js} +1 -1
  163. package/dist/client/assets/{layers-3D4z3mrk.js → layers-Dqez1Uq8.js} +1 -1
  164. package/dist/client/assets/{log-out-BxEBqpSs.js → log-out-D5-aSBAz.js} +1 -1
  165. package/dist/client/assets/{logging-C6tXZlGQ.js → logging-B_qXVrk6.js} +1 -1
  166. package/dist/client/assets/{main-DsnAjTqg.js → main-DAbEANjY.js} +2 -2
  167. package/dist/client/assets/{mermaid-parser.core-Dhd66igk.js → mermaid-parser.core-B6Q-3x_q.js} +2 -2
  168. package/dist/client/assets/{mermaidEngine-3NZnIFOn.js → mermaidEngine-DksLcesB.js} +3 -3
  169. package/dist/client/assets/{mindmap-definition-FAOFIHXS-SuO77jBW.js → mindmap-definition-FAOFIHXS-LaMzRxqw.js} +1 -1
  170. package/dist/client/assets/{motion-B4mmVewo.js → motion-BdscFixQ.js} +1 -1
  171. package/dist/client/assets/{packet-AYTQ26CC-BZwkWo3N.js → packet-AYTQ26CC-BHhg59Si.js} +1 -1
  172. package/dist/client/assets/{pairingUrl-rQM9kSGT.js → pairingUrl-Dn1e2CVw.js} +1 -1
  173. package/dist/client/assets/{palette-BXA2I3bI.js → palette-92ylWqeC.js} +1 -1
  174. package/dist/client/assets/{pegDiagram-VL7TDLO6-DgWypDaQ.js → pegDiagram-VL7TDLO6-s7l7UD9d.js} +1 -1
  175. package/dist/client/assets/{pie-WAS4IAKB-C1iJ73d9.js → pie-WAS4IAKB-DygX31Z9.js} +1 -1
  176. package/dist/client/assets/{pieDiagram-7S7Q4E2Y-DK1OTG7x.js → pieDiagram-7S7Q4E2Y-bb6I9TtZ.js} +1 -1
  177. package/dist/client/assets/{play-CJNYRuck.js → play-DUvOxTpL.js} +1 -1
  178. package/dist/client/assets/{primary-CQh_KHGG.js → primary-DZjgHvyf.js} +3 -3
  179. package/dist/client/assets/{providerDriverMeta-DJ9TrG26.js → providerDriverMeta-T2YbXzuS.js} +1 -1
  180. package/dist/client/assets/{qr-code-CBzdIN1G.js → qr-code-D4CtBq2F.js} +1 -1
  181. package/dist/client/assets/{qr-code-HMr6crTy.js → qr-code-dbkTo07n.js} +1 -1
  182. package/dist/client/assets/{quadrantDiagram-CIZ2JOQS-CIgZ3afX.js → quadrantDiagram-CIZ2JOQS-Cj1Y68ZF.js} +1 -1
  183. package/dist/client/assets/{radar-RG4KPBEZ-vq15KQ2S.js → radar-RG4KPBEZ-FHM3ftPp.js} +1 -1
  184. package/dist/client/assets/{radio-group-1yuMmVHi.js → radio-group-CRnHYWa8.js} +1 -1
  185. package/dist/client/assets/{railroad-74A4TZTK-DWMARNIs.js → railroad-74A4TZTK-CPMn18Cm.js} +1 -1
  186. package/dist/client/assets/railroad-abnf-HS5TGJTU-DxU7Mt1k.js +1 -0
  187. package/dist/client/assets/railroad-ebnf-LZEXJU2U-BYAPVjRd.js +1 -0
  188. package/dist/client/assets/railroad-peg-WCYAUIDC-BOqgR_X7.js +1 -0
  189. package/dist/client/assets/{railroadDiagram-AXF67PYL-rE9Jx5yK.js → railroadDiagram-AXF67PYL-DyV3SuDj.js} +1 -1
  190. package/dist/client/assets/{refresh-cw-DBJIPv7m.js → refresh-cw-CgDa2Ok_.js} +1 -1
  191. package/dist/client/assets/{requirementDiagram-LRYGKXZP-Dkz6KTug.js → requirementDiagram-LRYGKXZP-_xEAGWaH.js} +1 -1
  192. package/dist/client/assets/runtime-BwHA1GUS.js +18 -0
  193. package/dist/client/assets/{sankeyDiagram-W5VNT64P-qCyqmTya.js → sankeyDiagram-W5VNT64P-Clf6oTLi.js} +1 -1
  194. package/dist/client/assets/{save-BFsP9OG2.js → save-C8h0AMdl.js} +1 -1
  195. package/dist/client/assets/{scroll-area-CxjQJZM9.js → scroll-area-7n2X_RLQ.js} +1 -1
  196. package/dist/client/assets/{scrollEdges-CXvSHaVb.js → scrollEdges-BXYnwntN.js} +1 -1
  197. package/dist/client/assets/{separator-D3j91Nju.js → separator-CL1qjMqJ.js} +1 -1
  198. package/dist/client/assets/{sequenceDiagram-SI44F4Z6-GCGWxGKL.js → sequenceDiagram-SI44F4Z6-CcYtQLSe.js} +1 -1
  199. package/dist/client/assets/{settingsLayout-3SUkadS6.js → settingsLayout-DxsFwhF0.js} +1 -1
  200. package/dist/client/assets/{sheet-BOQ2T2gY.js → sheet-CGiaw8-i.js} +1 -1
  201. package/dist/client/assets/{shield-Colgxqw7.js → shield-DPC4oHTi.js} +1 -1
  202. package/dist/client/assets/{shield-alert-CWQ-fgqm.js → shield-alert-CwH36qZb.js} +1 -1
  203. package/dist/client/assets/{shield-check-Dgpx5EQs.js → shield-check-CGD7sEeF.js} +1 -1
  204. package/dist/client/assets/{sidebar-BIv8pHHx.js → sidebar-Cc6ANbOP.js} +1 -1
  205. package/dist/client/assets/{sidebarProjectFolders-BpKCw8IR.js → sidebarProjectFolders-DO2Uv84F.js} +1 -1
  206. package/dist/client/assets/{sidebarStatusText-DSeDlb-o.js → sidebarStatusText-B4AtFXZo.js} +1 -1
  207. package/dist/client/assets/{sidebarUndo-DzblmE6P.js → sidebarUndo-gdSrfa4O.js} +1 -1
  208. package/dist/client/assets/{skeleton-BdJ4w_TS.js → skeleton-rS3IgBob.js} +1 -1
  209. package/dist/client/assets/{smartphone-DhBEWfKK.js → smartphone-DgVJfbv3.js} +1 -1
  210. package/dist/client/assets/square-Cr9X8U6y.js +1 -0
  211. package/dist/client/assets/{src-DHNjfMxR.js → src-C3Y_imaX.js} +1 -1
  212. package/dist/client/assets/{star-BAzXRepp.js → star-Cqay-Cae.js} +1 -1
  213. package/dist/client/assets/{stateDiagram-OKZ733FA-D8fRUjov.js → stateDiagram-OKZ733FA-DEKURpRP.js} +1 -1
  214. package/dist/client/assets/stateDiagram-v2-UEYNNEHI-CWtHILqh.js +1 -0
  215. package/dist/client/assets/storeSelectors-CTDWheMy.js +1 -0
  216. package/dist/client/assets/{swimlanes-SLNWSIFB-BKy9AxWZ.js → swimlanes-SLNWSIFB-DrR6sbi6.js} +1 -1
  217. package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-DuaPce9O.js +8 -0
  218. package/dist/client/assets/{switch-DgLijJhN.js → switch-DnpJB2xv.js} +1 -1
  219. package/dist/client/assets/{timeline-definition-Z64GVDOM-DV53IwmP.js → timeline-definition-Z64GVDOM-bQJvmJx5.js} +1 -1
  220. package/dist/client/assets/{toggle-BgR-G8hl.js → toggle-D10FsFoE.js} +1 -1
  221. package/dist/client/assets/{toggle-group-DRIEnEQy.js → toggle-group-BhzbQPEQ.js} +1 -1
  222. package/dist/client/assets/{tokenModePresentation-Bh3mJ9H-.js → tokenModePresentation-BkS-mry_.js} +1 -1
  223. package/dist/client/assets/{tooltip-CsNk2GK1.js → tooltip-BlweKBxc.js} +1 -1
  224. package/dist/client/assets/{treeView-Q6P3EWNA-BgFMn3HH.js → treeView-Q6P3EWNA-D4Ex5QTp.js} +1 -1
  225. package/dist/client/assets/{treemap-WGGIJYW6-B45XVWgo.js → treemap-WGGIJYW6-C4B6Y6qM.js} +1 -1
  226. package/dist/client/assets/{unplug-0SZT8Az_.js → unplug-B1dczi-t.js} +1 -1
  227. package/dist/client/assets/{usage-DF8oQrsy.js → usage-BBwaxMif.js} +1 -1
  228. package/dist/client/assets/useAppSidebarCollapsed-CFy476E3.js +1 -0
  229. package/dist/client/assets/useBaseUiId-DKOjzmu3.js +1 -0
  230. package/dist/client/assets/{useLabelableId-CTlGVpp_.js → useLabelableId-DQbY2GG1.js} +1 -1
  231. package/dist/client/assets/{useNavigate-xewFGSmS.js → useNavigate-B8oXtF30.js} +1 -1
  232. package/dist/client/assets/{usePhoneThreadActions-CuSwvIb4.js → usePhoneThreadActions-6DCLiyJ5.js} +1 -1
  233. package/dist/client/assets/{usePopupViewport-CCXjC0oV.js → usePopupViewport-CNWcP7Od.js} +1 -1
  234. package/dist/client/assets/{useScrollLock-DkiskCYn.js → useScrollLock-BbKeKZdj.js} +1 -1
  235. package/dist/client/assets/{useStatistics-C5V0rg9r.js → useStatistics-B76_r68I.js} +1 -1
  236. package/dist/client/assets/{useTriggerFocusGuards-Cd4IS7Sl.js → useTriggerFocusGuards-BC4Wb3GI.js} +1 -1
  237. package/dist/client/assets/{useValueChanged-DUWoN5BG.js → useValueChanged-BkTbyZdO.js} +1 -1
  238. package/dist/client/assets/{user-round-BtyrzbBf.js → user-round-CLy1Qy1Y.js} +1 -1
  239. package/dist/client/assets/{vennDiagram-T6HMQDX7-DAr5h306.js → vennDiagram-T6HMQDX7-8iiroXim.js} +1 -1
  240. package/dist/client/assets/{vscode-icons-LDoILSKI.js → vscode-icons-CJBVQtq5.js} +1 -1
  241. package/dist/client/assets/{wardley-WFR3VGLG-6MSUlbTx.js → wardley-WFR3VGLG-DpyNUbTc.js} +1 -1
  242. package/dist/client/assets/{wardleyDiagram-T6FBY63Y-Bwv8xq6E.js → wardleyDiagram-T6FBY63Y-CI7is3QO.js} +1 -1
  243. package/dist/client/assets/{workspaceMetadataProjection-DzVpakWU.js → workspaceMetadataProjection-aqZEXDrQ.js} +1 -1
  244. package/dist/client/assets/{wrench-BDHgkqDa.js → wrench-7pbbxqrZ.js} +1 -1
  245. package/dist/client/assets/{xychartDiagram-ELKLHX3M-Be0CbWLp.js → xychartDiagram-ELKLHX3M-BTEX3m2y.js} +1 -1
  246. package/dist/client/index.html +1 -1
  247. package/dist/{deviceHostWorker-CYnrwfrv.cjs → deviceHostWorker-D4HauWIV.cjs} +1 -1
  248. package/dist/{git-BKwGfw8A.mjs → git-9xWsJYIH.mjs} +1 -1
  249. package/dist/{git-Dn5wrgFY.cjs → git-xIkXFy_l.cjs} +2 -2
  250. package/dist/{makeManagedServerProvider-B_lPFNpL.mjs → makeManagedServerProvider-B90UKjnv.mjs} +1 -1
  251. package/dist/{makeManagedServerProvider-CUwxc0Pn.cjs → makeManagedServerProvider-CF776SAO.cjs} +2 -2
  252. package/dist/resource-monitor/ryco-resource-monitor +0 -0
  253. package/dist/resource-monitor/ryco-resource-monitor.exe +0 -0
  254. package/dist/resource-monitor/win32-arm64/ryco-resource-monitor.exe +0 -0
  255. package/dist/resource-monitor/win32-x64/ryco-resource-monitor.exe +0 -0
  256. package/dist/{rolldown-runtime-LGfotAqq.cjs → rolldown-runtime-HbSU0i7K.cjs} +7 -0
  257. package/dist/{src-BzVJd3Me.cjs → src-CARHuYkT.cjs} +1059 -178
  258. package/dist/{src-7E1M4gTQ.mjs → src-CtsgPPhb.mjs} +198 -97
  259. package/package.json +1 -1
  260. package/dist/client/assets/DialogRoot-CEU7Xp57.js +0 -1
  261. package/dist/client/assets/architecture-7GRP2DOG-B6OTx_1D.js +0 -1
  262. package/dist/client/assets/channel-D_j9jK0M.js +0 -1
  263. package/dist/client/assets/chevron-right-D3dUAoht.js +0 -1
  264. package/dist/client/assets/classDiagram-JCYQIIEL-Ck79EbLj.js +0 -1
  265. package/dist/client/assets/classDiagram-v2-OCEON4UE-Ck79EbLj.js +0 -1
  266. package/dist/client/assets/eventmodeling-NTZA5JFV-COIUUd8Y.js +0 -1
  267. package/dist/client/assets/flowDiagram-UKHOOZJN-Cdhu8N9G.js +0 -1
  268. package/dist/client/assets/hostedPairing-CqhLPQqG.js +0 -1
  269. package/dist/client/assets/railroad-abnf-HS5TGJTU-DtRRa_PL.js +0 -1
  270. package/dist/client/assets/railroad-ebnf-LZEXJU2U-WQz4QHTw.js +0 -1
  271. package/dist/client/assets/railroad-peg-WCYAUIDC-1gkGEpqz.js +0 -1
  272. package/dist/client/assets/runtime-DpHhg0dl.js +0 -18
  273. package/dist/client/assets/square--aW0vCo4.js +0 -1
  274. package/dist/client/assets/stateDiagram-v2-UEYNNEHI-vKQeXqcV.js +0 -1
  275. package/dist/client/assets/storeSelectors-BFVEGU0F.js +0 -1
  276. package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-qtmvcwUS.js +0 -8
  277. package/dist/client/assets/useAppSidebarCollapsed-CvO9sEQ7.js +0 -1
  278. package/dist/client/assets/useBaseUiId-B5nK6G4h.js +0 -1
@@ -1,776 +1,641 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { Ko as DEFAULT_GIT_TEXT_GENERATION_MODEL_BY_PROVIDER, Qo as ProviderInstanceId, Xr as DEFAULT_SERVER_SETTINGS, Yo as MODEL_SLUG_ALIASES_BY_PROVIDER, Zo as ProviderDriverKind, ei as ServerSettings, es as isProviderDriverKind, oi as StorageError, qo as DEFAULT_GIT_TEXT_GENERATION_OPTIONS_BY_PROVIDER, ti as ServerSettingsError } from "./src-7E1M4gTQ.mjs";
3
+ import { Bs as NodeE2eeAdmissionPolicy, Ko as DEFAULT_GIT_TEXT_GENERATION_MODEL_BY_PROVIDER, Qo as ProviderInstanceId, Xr as DEFAULT_SERVER_SETTINGS, Yo as MODEL_SLUG_ALIASES_BY_PROVIDER, Zo as ProviderDriverKind, ei as ServerSettings, es as isProviderDriverKind, oi as StorageError, qo as DEFAULT_GIT_TEXT_GENERATION_OPTIONS_BY_PROVIDER, ti as ServerSettingsError } from "./src-CtsgPPhb.mjs";
4
4
  import { r as fromLenientJson } from "./schemaJson-CaG1bOvo.mjs";
5
5
  import { n as runProcess } from "./processRunner-DnndFd2A.mjs";
6
6
  import { Cache, Cause, Context, Data, DateTime, Deferred, Duration, Effect, Equal, Exit, FileSystem, Layer, Metric, Path, Predicate, PubSub, Ref, Schema, SchemaIssue, Scope, Semaphore, Stream } from "effect";
7
- import * as P from "effect/Predicate";
8
7
  import path, { join } from "node:path";
9
8
  import * as Crypto from "node:crypto";
10
9
  import { createHash, timingSafeEqual } from "node:crypto";
10
+ import * as P from "effect/Predicate";
11
11
  import { constants } from "node:fs";
12
12
  import { homedir } from "node:os";
13
13
  import fs$1, { access, lstat, realpath } from "node:fs/promises";
14
14
  import * as Semaphore$1 from "effect/Semaphore";
15
15
  import "effect/PlatformError";
16
16
  import { dual } from "effect/Function";
17
- //#region ../../packages/shared/src/Struct.ts
18
- function deepMerge(current, patch) {
19
- if (!P.isObject(current) || !P.isObject(patch)) return patch;
20
- const next = { ...current };
21
- for (const [key, value] of Object.entries(patch)) {
22
- if (value === void 0) continue;
23
- const existing = next[key];
24
- next[key] = P.isObject(existing) && P.isObject(value) ? deepMerge(existing, value) : value;
25
- }
26
- return next;
27
- }
28
- //#endregion
29
- //#region ../../packages/shared/src/model.ts
30
- const DEFAULT_PROVIDER_DRIVER_KIND = ProviderDriverKind.make("codex");
17
+ //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/is.js
18
+ const objectTypeNames = [
19
+ "Object",
20
+ "RegExp",
21
+ "Date",
22
+ "Error",
23
+ "Map",
24
+ "Set",
25
+ "WeakMap",
26
+ "WeakSet",
27
+ "ArrayBuffer",
28
+ "SharedArrayBuffer",
29
+ "DataView",
30
+ "Promise",
31
+ "URL",
32
+ "HTMLElement",
33
+ "Int8Array",
34
+ "Uint8ClampedArray",
35
+ "Int16Array",
36
+ "Uint16Array",
37
+ "Int32Array",
38
+ "Uint32Array",
39
+ "Float32Array",
40
+ "Float64Array",
41
+ "BigInt64Array",
42
+ "BigUint64Array",
43
+ "Tagged"
44
+ ];
31
45
  /**
32
- * Resolve the human-readable model title used by picker surfaces and durable
33
- * handoff presentation. Provider catalogs are authoritative when they carry a
34
- * friendly name; the routing slug remains the deterministic final fallback.
46
+ * @param {any} value
47
+ * @returns {string}
35
48
  */
36
- function getModelDisplayName(model, options) {
37
- const shortName = trimOrNull(model.shortName);
38
- const name = trimOrNull(model.name);
39
- const slug = trimOrNull(model.slug) ?? model.slug;
40
- return options?.preferShortName ? shortName ?? name ?? slug : name ?? shortName ?? slug;
41
- }
42
- /** Compose the optional sub-provider prefix exactly as the picker trigger does. */
43
- function getModelDisplayLabel(model, options) {
44
- const title = getModelDisplayName(model, options);
45
- const subProvider = trimOrNull(model.subProvider);
46
- return subProvider ? `${subProvider} · ${title}` : title;
47
- }
48
- function createModelCapabilities(input) {
49
- return { optionDescriptors: input.optionDescriptors.map(cloneDescriptor) };
50
- }
51
- function getRawSelectionValueById(selections, id) {
52
- return (selections?.find((candidate) => candidate.id === id))?.value;
53
- }
54
- function getProviderOptionSelectionValue(selections, id) {
55
- return getRawSelectionValueById(selections, id);
56
- }
57
- function getProviderOptionStringSelectionValue(selections, id) {
58
- const value = getProviderOptionSelectionValue(selections, id);
59
- return typeof value === "string" ? value : void 0;
60
- }
61
- function getProviderOptionBooleanSelectionValue(selections, id) {
62
- const value = getProviderOptionSelectionValue(selections, id);
63
- return typeof value === "boolean" ? value : void 0;
64
- }
65
- function getModelSelectionStringOptionValue(modelSelection, id) {
66
- return getProviderOptionStringSelectionValue(modelSelection?.options, id);
67
- }
68
- function getModelSelectionBooleanOptionValue(modelSelection, id) {
69
- return getProviderOptionBooleanSelectionValue(modelSelection?.options, id);
70
- }
71
- function resolveDescriptorChoiceValue(descriptor, raw) {
72
- const trimmed = trimOrNull(raw);
73
- if (!trimmed) return descriptor.currentValue ?? descriptor.options.find((option) => option.isDefault)?.id;
74
- if (descriptor.options.length === 0) return trimmed;
75
- if (descriptor.promptInjectedValues?.includes(trimmed) && descriptor.options.some((option) => option.id === trimmed)) return descriptor.options.find((option) => option.isDefault)?.id;
76
- if (descriptor.options.some((option) => option.id === trimmed)) return trimmed;
77
- return descriptor.currentValue ?? descriptor.options.find((option) => option.isDefault)?.id;
78
- }
79
- function cloneDescriptor(descriptor) {
80
- return descriptor.type === "select" ? {
81
- ...descriptor,
82
- options: [...descriptor.options],
83
- ...descriptor.promptInjectedValues ? { promptInjectedValues: [...descriptor.promptInjectedValues] } : {}
84
- } : { ...descriptor };
49
+ function is(value) {
50
+ if (value === null) return "null";
51
+ if (value === void 0) return "undefined";
52
+ if (value === true || value === false) return "boolean";
53
+ const typeOf = typeof value;
54
+ if (typeOf === "string" || typeOf === "number" || typeOf === "bigint" || typeOf === "symbol") return typeOf;
55
+ if (typeOf === "function") return "Function";
56
+ if (Array.isArray(value)) return "Array";
57
+ if (value instanceof Uint8Array) return "Uint8Array";
58
+ if (value.constructor === Object) return "Object";
59
+ const objectType = getObjectType(value);
60
+ if (objectType) return objectType;
61
+ return "Object";
85
62
  }
86
- function cloneSelection(selection) {
87
- return { ...selection };
63
+ /**
64
+ * @param {any} value
65
+ * @returns {string|undefined}
66
+ */
67
+ function getObjectType(value) {
68
+ const objectTypeName = Object.prototype.toString.call(value).slice(8, -1);
69
+ if (objectTypeNames.includes(objectTypeName)) return objectTypeName;
88
70
  }
89
- function withDescriptorCurrentValue(descriptor, rawCurrentValue) {
90
- if (descriptor.type === "boolean") {
91
- if (typeof rawCurrentValue === "boolean") return {
92
- ...descriptor,
93
- currentValue: rawCurrentValue
94
- };
95
- return descriptor;
71
+ //#endregion
72
+ //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/token.js
73
+ var Type = class {
74
+ /**
75
+ * @param {number} major
76
+ * @param {string} name
77
+ * @param {boolean} terminal
78
+ */
79
+ constructor(major, name, terminal) {
80
+ this.major = major;
81
+ this.majorEncoded = major << 5;
82
+ this.name = name;
83
+ this.terminal = terminal;
96
84
  }
97
- const currentValue = typeof rawCurrentValue === "string" ? resolveDescriptorChoiceValue(descriptor, rawCurrentValue) : resolveDescriptorChoiceValue(descriptor, descriptor.currentValue);
98
- if (!currentValue) {
99
- const { currentValue: _unusedCurrentValue, ...rest } = descriptor;
100
- return rest;
85
+ toString() {
86
+ return `Type[${this.major}].${this.name}`;
101
87
  }
102
- return {
103
- ...descriptor,
104
- currentValue
105
- };
106
- }
107
- function getProviderOptionDescriptors(input) {
108
- const { caps, selections } = input;
109
- return (caps.optionDescriptors ?? []).map(cloneDescriptor).map((descriptor) => withDescriptorCurrentValue(descriptor, getRawSelectionValueById(selections, descriptor.id) ?? descriptor.currentValue));
110
- }
111
- function getProviderOptionCurrentValue(descriptor) {
112
- if (!descriptor) return;
113
- if (descriptor.type === "boolean") return descriptor.currentValue;
114
- if (descriptor.currentValue) return descriptor.currentValue;
115
- return descriptor.options.find((option) => option.isDefault)?.id;
116
- }
117
- function normalizeModelSlug(model, provider = DEFAULT_PROVIDER_DRIVER_KIND) {
118
- if (typeof model !== "string") return null;
119
- const trimmed = model.trim();
120
- if (!trimmed) return null;
121
- const aliases = MODEL_SLUG_ALIASES_BY_PROVIDER[provider] ?? {};
122
- const aliased = Object.prototype.hasOwnProperty.call(aliases, trimmed) ? aliases[trimmed] : void 0;
123
- return typeof aliased === "string" ? aliased : trimmed;
124
- }
125
- /** Trim a string, returning null for empty/missing values. */
126
- function trimOrNull(value) {
127
- if (typeof value !== "string") return null;
128
- return value.trim() || null;
129
- }
130
- function cloneSelections(selections) {
131
- return selections.map(cloneSelection);
132
- }
133
- function createModelSelection(instanceId, model, options) {
134
- const selections = options ? cloneSelections(options) : [];
135
- const base = {
136
- instanceId,
137
- model
138
- };
139
- return selections.length > 0 ? {
140
- ...base,
141
- options: selections
142
- } : base;
143
- }
88
+ /**
89
+ * @param {Type} typ
90
+ * @returns {number}
91
+ */
92
+ compare(typ) {
93
+ return this.major < typ.major ? -1 : this.major > typ.major ? 1 : 0;
94
+ }
95
+ /**
96
+ * Check equality between two Type instances. Safe to use across different
97
+ * copies of the Type class (e.g., when bundlers duplicate the module).
98
+ * (major, name) uniquely identifies a Type; terminal is implied by these.
99
+ * @param {Type} a
100
+ * @param {Type} b
101
+ * @returns {boolean}
102
+ */
103
+ static equals(a, b) {
104
+ return a === b || a.major === b.major && a.name === b.name;
105
+ }
106
+ };
107
+ Type.uint = new Type(0, "uint", true);
108
+ Type.negint = new Type(1, "negint", true);
109
+ Type.bytes = new Type(2, "bytes", true);
110
+ Type.string = new Type(3, "string", true);
111
+ Type.array = new Type(4, "array", false);
112
+ Type.map = new Type(5, "map", false);
113
+ Type.tag = new Type(6, "tag", false);
114
+ Type.float = new Type(7, "float", true);
115
+ Type.false = new Type(7, "false", true);
116
+ Type.true = new Type(7, "true", true);
117
+ Type.null = new Type(7, "null", true);
118
+ Type.undefined = new Type(7, "undefined", true);
119
+ Type.break = new Type(7, "break", true);
120
+ var Token = class {
121
+ /**
122
+ * @param {Type} type
123
+ * @param {any} [value]
124
+ * @param {number} [encodedLength]
125
+ */
126
+ constructor(type, value, encodedLength) {
127
+ this.type = type;
128
+ this.value = value;
129
+ this.encodedLength = encodedLength;
130
+ /** @type {Uint8Array|undefined} */
131
+ this.encodedBytes = void 0;
132
+ /** @type {Uint8Array|undefined} */
133
+ this.byteValue = void 0;
134
+ }
135
+ toString() {
136
+ return `Token[${this.type}].${this.value}`;
137
+ }
138
+ };
139
+ //#endregion
140
+ //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/byte-utils.js
141
+ const useBuffer = globalThis.process && !globalThis.process.browser && globalThis.Buffer && typeof globalThis.Buffer.isBuffer === "function";
142
+ const textEncoder$1 = new TextEncoder();
144
143
  /**
145
- * Context handoff is a provider-instance boundary. Model and option changes
146
- * within one configured instance remain on that provider's normal turn path.
144
+ * @typedef {import('../interface.js').ByteView} ByteView
145
+ * @typedef {import('../interface.js').AllocatedByteView} AllocatedByteView
147
146
  */
148
- function modelSelectionRequiresContextHandoff(input) {
149
- return input.canonicalSelection.instanceId !== input.targetSelection.instanceId;
147
+ /**
148
+ * @param {Uint8Array} buf
149
+ * @returns {boolean}
150
+ */
151
+ function isBuffer(buf) {
152
+ return useBuffer && globalThis.Buffer.isBuffer(buf);
150
153
  }
151
154
  /**
152
- * Returns the effort value if it is a prompt-injected value according to
153
- * any select descriptor in the given capabilities, or null otherwise.
154
- *
155
- * Unlike a single `find`, this checks every descriptor so that the
156
- * correct descriptor's `promptInjectedValues` list is consulted even when
157
- * multiple select descriptors exist.
155
+ * @param {ByteView|number[]} buf
156
+ * @returns {ByteView}
158
157
  */
159
- function resolvePromptInjectedEffort(caps, rawEffort) {
160
- const trimmed = trimOrNull(rawEffort);
161
- if (!trimmed) return null;
162
- const descriptors = getProviderOptionDescriptors({ caps });
163
- for (const descriptor of descriptors) if (descriptor.type === "select" && descriptor.promptInjectedValues?.includes(trimmed)) return trimmed;
164
- return null;
165
- }
166
- function applyClaudePromptEffortPrefix(text, effort) {
167
- const trimmed = text.trim();
168
- if (!trimmed) return trimmed;
169
- if (effort !== "ultrathink") return trimmed;
170
- if (trimmed.startsWith("Ultrathink:")) return trimmed;
171
- return `Ultrathink:\n${trimmed}`;
172
- }
173
- //#endregion
174
- //#region ../../packages/shared/src/serverSettings.ts
175
- const ServerSettingsJson$1 = fromLenientJson(ServerSettings);
176
- function normalizePersistedServerSettingString(value) {
177
- const trimmed = value?.trim();
178
- return trimmed && trimmed.length > 0 ? trimmed : void 0;
179
- }
180
- function extractPersistedServerObservabilitySettings(input) {
181
- return {
182
- otlpTracesUrl: normalizePersistedServerSettingString(input.observability?.otlpTracesUrl),
183
- otlpMetricsUrl: normalizePersistedServerSettingString(input.observability?.otlpMetricsUrl)
184
- };
158
+ function asU8A(buf) {
159
+ if (!(buf instanceof Uint8Array)) return Uint8Array.from(buf);
160
+ return isBuffer(buf) ? new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength) : buf;
185
161
  }
186
- function parsePersistedServerObservabilitySettings(raw) {
187
- try {
188
- return extractPersistedServerObservabilitySettings(Schema.decodeUnknownSync(ServerSettingsJson$1)(raw));
189
- } catch {
190
- return {
191
- otlpTracesUrl: void 0,
192
- otlpMetricsUrl: void 0
193
- };
162
+ const FROM_STRING_THRESHOLD_BUFFER = 24;
163
+ const FROM_STRING_THRESHOLD_TEXTENCODER = 200;
164
+ const fromString = useBuffer ? (string) => {
165
+ return string.length >= FROM_STRING_THRESHOLD_BUFFER ? globalThis.Buffer.from(string) : utf8ToBytes(string);
166
+ } :
167
+ /**
168
+ * @param {string} string
169
+ */
170
+ (string) => {
171
+ return string.length >= FROM_STRING_THRESHOLD_TEXTENCODER ? textEncoder$1.encode(string) : utf8ToBytes(string);
172
+ };
173
+ /**
174
+ * Buffer variant not fast enough for what we need
175
+ * @param {number[]} arr
176
+ * @returns {AllocatedByteView}
177
+ */
178
+ const fromArray = (arr) => {
179
+ return Uint8Array.from(arr);
180
+ };
181
+ const slice = useBuffer ? (bytes, start, end) => {
182
+ if (isBuffer(bytes)) return new Uint8Array(bytes.subarray(start, end));
183
+ return bytes.slice(start, end);
184
+ } :
185
+ /**
186
+ * @param {Uint8Array} bytes
187
+ * @param {number} start
188
+ * @param {number} end
189
+ */
190
+ (bytes, start, end) => {
191
+ return bytes.slice(start, end);
192
+ };
193
+ const concat = useBuffer ? (chunks, length) => {
194
+ chunks = chunks.map((c) => c instanceof Uint8Array ? c : globalThis.Buffer.from(c));
195
+ return asU8A(globalThis.Buffer.concat(chunks, length));
196
+ } :
197
+ /**
198
+ * @param {ByteView[]} chunks
199
+ * @param {number} length
200
+ * @returns {AllocatedByteView}
201
+ */
202
+ (chunks, length) => {
203
+ const out = new Uint8Array(length);
204
+ let off = 0;
205
+ for (let b of chunks) {
206
+ if (off + b.length > out.length) b = b.subarray(0, out.length - off);
207
+ out.set(b, off);
208
+ off += b.length;
194
209
  }
195
- }
196
- function shouldReplaceTextGenerationModelSelection(patch) {
197
- return Boolean(patch && (patch.instanceId !== void 0 || patch.model !== void 0));
198
- }
199
- function mergeModelSelectionOptionsById(input) {
200
- if (input.patch === void 0) return input.current ? [...input.current] : void 0;
201
- if (input.patch.length === 0) return;
202
- const merged = new Map((input.current ?? []).map((selection) => [selection.id, selection.value]));
203
- for (const selection of input.patch) merged.set(selection.id, selection.value);
204
- return [...merged.entries()].map(([id, value]) => ({
205
- id,
206
- value
207
- }));
210
+ return out;
211
+ };
212
+ const alloc = useBuffer ? (size) => {
213
+ return globalThis.Buffer.allocUnsafe(size);
214
+ } :
215
+ /**
216
+ * @param {number} size
217
+ * @returns {AllocatedByteView}
218
+ */
219
+ (size) => {
220
+ return new Uint8Array(size);
221
+ };
222
+ /**
223
+ * @param {Uint8Array} b1
224
+ * @param {Uint8Array} b2
225
+ * @returns {number}
226
+ */
227
+ function compare(b1, b2) {
228
+ if (isBuffer(b1) && isBuffer(b2)) return b1.compare(b2);
229
+ for (let i = 0; i < b1.length; i++) {
230
+ if (b1[i] === b2[i]) continue;
231
+ return b1[i] < b2[i] ? -1 : 1;
232
+ }
233
+ return 0;
208
234
  }
209
235
  /**
210
- * Applies a server settings patch while treating textGenerationModelSelection as
211
- * replace-on-provider/model updates. This prevents stale nested options from
212
- * surviving a reset patch that intentionally omits options.
236
+ * @param {string} str
237
+ * @returns {number[]}
213
238
  */
214
- function applyServerSettingsPatch(current, patch) {
215
- const selectionPatch = patch.textGenerationModelSelection;
216
- for (const [field, value] of Object.entries(patch.expectedNodePreferences ?? {})) if (!Equal.equals(current[field] ?? null, value)) throw new Error("Node preferences changed elsewhere. Reload before saving.");
217
- for (const [projectId, expected] of Object.entries(patch.expectedProjectPreferences ?? {})) {
218
- const currentPreferences = current.projectPreferences[projectId] ?? {};
219
- for (const [field, value] of Object.entries(expected)) {
220
- const actual = field === "initialModelSelection" && !Object.hasOwn(currentPreferences, field) ? "absent" : currentPreferences[field] ?? null;
221
- if (!Equal.equals(actual, value)) throw new Error("Project preferences changed elsewhere. Reload before saving.");
239
+ function utf8ToBytes(str) {
240
+ const out = [];
241
+ let p = 0;
242
+ for (let i = 0; i < str.length; i++) {
243
+ let c = str.charCodeAt(i);
244
+ if (c < 128) out[p++] = c;
245
+ else if (c < 2048) {
246
+ out[p++] = c >> 6 | 192;
247
+ out[p++] = c & 63 | 128;
248
+ } else if ((c & 64512) === 55296 && i + 1 < str.length && (str.charCodeAt(i + 1) & 64512) === 56320) {
249
+ c = 65536 + ((c & 1023) << 10) + (str.charCodeAt(++i) & 1023);
250
+ out[p++] = c >> 18 | 240;
251
+ out[p++] = c >> 12 & 63 | 128;
252
+ out[p++] = c >> 6 & 63 | 128;
253
+ out[p++] = c & 63 | 128;
254
+ } else {
255
+ if (c >= 55296 && c <= 57343) c = 65533;
256
+ out[p++] = c >> 12 | 224;
257
+ out[p++] = c >> 6 & 63 | 128;
258
+ out[p++] = c & 63 | 128;
222
259
  }
223
260
  }
224
- const { expectedProjectPreferences: _expected, expectedNodePreferences: _expectedNode, projectPreferences: _projects, ...persistedPatch } = patch;
225
- let next = deepMerge(current, persistedPatch);
226
- if (patch.initialModelSelection !== void 0) next = {
227
- ...next,
228
- initialModelSelection: patch.initialModelSelection
229
- };
230
- if (patch.projectPreferences !== void 0) {
231
- const projects = new Map(Object.entries(current.projectPreferences));
232
- for (const [projectId, preferencesPatch] of Object.entries(patch.projectPreferences)) {
233
- if (preferencesPatch === null) {
234
- projects.delete(projectId);
235
- continue;
236
- }
237
- const preferences = { ...projects.get(projectId) };
238
- for (const [field, value] of Object.entries(preferencesPatch)) if (value === null && field !== "initialModelSelection") delete preferences[field];
239
- else Object.assign(preferences, { [field]: value });
240
- if (Object.keys(preferences).length) projects.set(projectId, preferences);
241
- else projects.delete(projectId);
261
+ return out;
262
+ }
263
+ //#endregion
264
+ //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/bl.js
265
+ /**
266
+ * Bl is a list of byte chunks, similar to https://github.com/rvagg/bl but for
267
+ * writing rather than reading.
268
+ * A Bl object accepts set() operations for individual bytes and copyTo() for
269
+ * inserting byte arrays. These write operations don't automatically increment
270
+ * the internal cursor so its "length" won't be changed. Instead, increment()
271
+ * must be called to extend its length to cover the inserted data.
272
+ * The toBytes() call will convert all internal memory to a single Uint8Array of
273
+ * the correct length, truncating any data that is stored but hasn't been
274
+ * included by an increment().
275
+ * get() can retrieve a single byte.
276
+ * All operations (except toBytes()) take an "offset" argument that will perform
277
+ * the write at the offset _from the current cursor_. For most operations this
278
+ * will be `0` to write at the current cursor position but it can be ahead of
279
+ * the current cursor. Negative offsets probably work but are untested.
280
+ */
281
+ /**
282
+ * @typedef {import('../interface.js').ByteView} ByteView
283
+ * @typedef {import('../interface.js').AllocatedByteView} AllocatedByteView
284
+ */
285
+ const defaultChunkSize = 256;
286
+ var Bl = class {
287
+ /**
288
+ * @param {number} [chunkSize]
289
+ */
290
+ constructor(chunkSize = defaultChunkSize) {
291
+ this.chunkSize = chunkSize;
292
+ /** @type {number} */
293
+ this.cursor = 0;
294
+ /** @type {number} */
295
+ this.maxCursor = -1;
296
+ /** @type {(ByteView|number[])[]} */
297
+ this.chunks = [];
298
+ /** @type {ByteView|number[]|null} */
299
+ this._initReuseChunk = null;
300
+ }
301
+ reset() {
302
+ this.cursor = 0;
303
+ this.maxCursor = -1;
304
+ if (this.chunks.length) this.chunks = [];
305
+ if (this._initReuseChunk !== null) {
306
+ this.chunks.push(this._initReuseChunk);
307
+ this.maxCursor = this._initReuseChunk.length - 1;
242
308
  }
243
- next = {
244
- ...next,
245
- projectPreferences: Object.fromEntries(projects)
246
- };
247
309
  }
248
- if (patch.projectWorktreeSubmodules !== void 0) {
249
- const modes = new Map(Object.entries(current.projectWorktreeSubmodules));
250
- for (const [projectId, mode] of Object.entries(patch.projectWorktreeSubmodules)) if (mode === null) modes.delete(projectId);
251
- else modes.set(projectId, mode);
252
- next = {
253
- ...next,
254
- projectWorktreeSubmodules: Object.fromEntries(modes)
255
- };
310
+ /**
311
+ * @param {number} byte
312
+ */
313
+ pushByte(byte) {
314
+ let topChunk = this.chunks[this.chunks.length - 1];
315
+ if (this.cursor > this.maxCursor) {
316
+ topChunk = alloc(this.chunkSize);
317
+ this.chunks.push(topChunk);
318
+ this.maxCursor += topChunk.length;
319
+ if (this._initReuseChunk === null) this._initReuseChunk = topChunk;
320
+ }
321
+ const chunkPos = topChunk.length - (this.maxCursor - this.cursor) - 1;
322
+ topChunk[chunkPos] = byte;
323
+ this.cursor++;
256
324
  }
257
- if (patch.projectWorktreeRoots !== void 0) {
258
- const roots = new Map(Object.entries(current.projectWorktreeRoots));
259
- for (const [projectId, root] of Object.entries(patch.projectWorktreeRoots)) if (root === null || root === "") roots.delete(projectId);
260
- else roots.set(projectId, root);
261
- next = {
262
- ...next,
263
- projectWorktreeRoots: Object.fromEntries(roots)
264
- };
325
+ /**
326
+ * @param {ByteView|number[]} bytes
327
+ */
328
+ push(bytes) {
329
+ let topChunk = this.chunks[this.chunks.length - 1];
330
+ if (this.cursor + bytes.length <= this.maxCursor + 1) {
331
+ const chunkPos = topChunk.length - (this.maxCursor - this.cursor) - 1;
332
+ topChunk.set(bytes, chunkPos);
333
+ } else {
334
+ if (topChunk) {
335
+ const chunkPos = topChunk.length - (this.maxCursor - this.cursor) - 1;
336
+ if (chunkPos < topChunk.length) {
337
+ this.chunks[this.chunks.length - 1] = topChunk.subarray(0, chunkPos);
338
+ this.maxCursor = this.cursor - 1;
339
+ }
340
+ }
341
+ if (bytes.length < 64 && bytes.length < this.chunkSize) {
342
+ topChunk = alloc(this.chunkSize);
343
+ this.chunks.push(topChunk);
344
+ this.maxCursor += topChunk.length;
345
+ if (this._initReuseChunk === null) this._initReuseChunk = topChunk;
346
+ topChunk.set(bytes, 0);
347
+ } else {
348
+ this.chunks.push(bytes);
349
+ this.maxCursor += bytes.length;
350
+ }
351
+ }
352
+ this.cursor += bytes.length;
265
353
  }
266
- if (patch.projectStorageRetention !== void 0) {
267
- const policies = new Map(Object.entries(current.projectStorageRetention));
268
- for (const [projectId, policy] of Object.entries(patch.projectStorageRetention)) if (policy === null) policies.delete(projectId);
269
- else policies.set(projectId, policy);
270
- next = {
271
- ...next,
272
- projectStorageRetention: Object.fromEntries(policies)
273
- };
354
+ /**
355
+ * @param {boolean} [reset]
356
+ * @returns {AllocatedByteView}
357
+ */
358
+ toBytes(reset = false) {
359
+ let byts;
360
+ if (this.chunks.length === 1) {
361
+ const chunk = this.chunks[0];
362
+ if (reset && this.cursor > chunk.length / 2) {
363
+ byts = this.cursor === chunk.length ? chunk : chunk.subarray(0, this.cursor);
364
+ this._initReuseChunk = null;
365
+ this.chunks = [];
366
+ } else byts = slice(chunk, 0, this.cursor);
367
+ } else byts = concat(this.chunks, this.cursor);
368
+ if (reset) this.reset();
369
+ return byts;
274
370
  }
275
- const nextWithReplacements = patch.providerInstances !== void 0 ? {
276
- ...next,
277
- providerInstances: patch.providerInstances
278
- } : next;
279
- if (!selectionPatch) return nextWithReplacements;
280
- const instanceId = selectionPatch.instanceId ?? current.textGenerationModelSelection.instanceId;
281
- const model = selectionPatch.model ?? current.textGenerationModelSelection.model;
282
- const options = shouldReplaceTextGenerationModelSelection(selectionPatch) ? selectionPatch.options : mergeModelSelectionOptionsById({
283
- current: current.textGenerationModelSelection.options,
284
- patch: selectionPatch.options
285
- });
286
- return {
287
- ...nextWithReplacements,
288
- textGenerationModelSelection: createModelSelection(instanceId, model, options)
289
- };
290
- }
291
- //#endregion
292
- //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/is.js
293
- const objectTypeNames = [
294
- "Object",
295
- "RegExp",
296
- "Date",
297
- "Error",
298
- "Map",
299
- "Set",
300
- "WeakMap",
301
- "WeakSet",
302
- "ArrayBuffer",
303
- "SharedArrayBuffer",
304
- "DataView",
305
- "Promise",
306
- "URL",
307
- "HTMLElement",
308
- "Int8Array",
309
- "Uint8ClampedArray",
310
- "Int16Array",
311
- "Uint16Array",
312
- "Int32Array",
313
- "Uint32Array",
314
- "Float32Array",
315
- "Float64Array",
316
- "BigInt64Array",
317
- "BigUint64Array",
318
- "Tagged"
319
- ];
320
- /**
321
- * @param {any} value
322
- * @returns {string}
323
- */
324
- function is(value) {
325
- if (value === null) return "null";
326
- if (value === void 0) return "undefined";
327
- if (value === true || value === false) return "boolean";
328
- const typeOf = typeof value;
329
- if (typeOf === "string" || typeOf === "number" || typeOf === "bigint" || typeOf === "symbol") return typeOf;
330
- if (typeOf === "function") return "Function";
331
- if (Array.isArray(value)) return "Array";
332
- if (value instanceof Uint8Array) return "Uint8Array";
333
- if (value.constructor === Object) return "Object";
334
- const objectType = getObjectType(value);
335
- if (objectType) return objectType;
336
- return "Object";
337
- }
371
+ };
338
372
  /**
339
- * @param {any} value
340
- * @returns {string|undefined}
373
+ * U8Bl is a buffer list that writes directly to a user-provided Uint8Array.
374
+ * It provides the same interface as Bl but writes to a fixed destination.
375
+ * @template {ArrayBufferLike} T
341
376
  */
342
- function getObjectType(value) {
343
- const objectTypeName = Object.prototype.toString.call(value).slice(8, -1);
344
- if (objectTypeNames.includes(objectTypeName)) return objectTypeName;
345
- }
346
- //#endregion
347
- //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/token.js
348
- var Type = class {
377
+ var U8Bl = class {
349
378
  /**
350
- * @param {number} major
351
- * @param {string} name
352
- * @param {boolean} terminal
379
+ * @param {Uint8Array<T>} dest
353
380
  */
354
- constructor(major, name, terminal) {
355
- this.major = major;
356
- this.majorEncoded = major << 5;
357
- this.name = name;
358
- this.terminal = terminal;
381
+ constructor(dest) {
382
+ this.dest = dest;
383
+ /** @type {number} */
384
+ this.cursor = 0;
385
+ /** @type {Array<Uint8Array<T>>} */
386
+ this.chunks = [dest];
359
387
  }
360
- toString() {
361
- return `Type[${this.major}].${this.name}`;
388
+ reset() {
389
+ this.cursor = 0;
362
390
  }
363
391
  /**
364
- * @param {Type} typ
365
- * @returns {number}
392
+ * @param {number} byte
366
393
  */
367
- compare(typ) {
368
- return this.major < typ.major ? -1 : this.major > typ.major ? 1 : 0;
394
+ pushByte(byte) {
395
+ if (this.cursor >= this.dest.length) throw new Error("write out of bounds, destination buffer is too small");
396
+ this.dest[this.cursor++] = byte;
369
397
  }
370
398
  /**
371
- * Check equality between two Type instances. Safe to use across different
372
- * copies of the Type class (e.g., when bundlers duplicate the module).
373
- * (major, name) uniquely identifies a Type; terminal is implied by these.
374
- * @param {Type} a
375
- * @param {Type} b
376
- * @returns {boolean}
399
+ * @param {ByteView|number[]} bytes
377
400
  */
378
- static equals(a, b) {
379
- return a === b || a.major === b.major && a.name === b.name;
401
+ push(bytes) {
402
+ if (this.cursor + bytes.length > this.dest.length) throw new Error("write out of bounds, destination buffer is too small");
403
+ this.dest.set(bytes, this.cursor);
404
+ this.cursor += bytes.length;
380
405
  }
381
- };
382
- Type.uint = new Type(0, "uint", true);
383
- Type.negint = new Type(1, "negint", true);
384
- Type.bytes = new Type(2, "bytes", true);
385
- Type.string = new Type(3, "string", true);
386
- Type.array = new Type(4, "array", false);
387
- Type.map = new Type(5, "map", false);
388
- Type.tag = new Type(6, "tag", false);
389
- Type.float = new Type(7, "float", true);
390
- Type.false = new Type(7, "false", true);
391
- Type.true = new Type(7, "true", true);
392
- Type.null = new Type(7, "null", true);
393
- Type.undefined = new Type(7, "undefined", true);
394
- Type.break = new Type(7, "break", true);
395
- var Token = class {
396
406
  /**
397
- * @param {Type} type
398
- * @param {any} [value]
399
- * @param {number} [encodedLength]
407
+ * @param {boolean} [reset]
408
+ * @returns {Uint8Array<T>}
400
409
  */
401
- constructor(type, value, encodedLength) {
402
- this.type = type;
403
- this.value = value;
404
- this.encodedLength = encodedLength;
405
- /** @type {Uint8Array|undefined} */
406
- this.encodedBytes = void 0;
407
- /** @type {Uint8Array|undefined} */
408
- this.byteValue = void 0;
409
- }
410
- toString() {
411
- return `Token[${this.type}].${this.value}`;
410
+ toBytes(reset = false) {
411
+ const byts = this.dest.subarray(0, this.cursor);
412
+ if (reset) this.reset();
413
+ return byts;
412
414
  }
413
415
  };
414
416
  //#endregion
415
- //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/byte-utils.js
416
- const useBuffer = globalThis.process && !globalThis.process.browser && globalThis.Buffer && typeof globalThis.Buffer.isBuffer === "function";
417
- const textEncoder$1 = new TextEncoder();
418
- /**
419
- * @typedef {import('../interface.js').ByteView} ByteView
420
- * @typedef {import('../interface.js').AllocatedByteView} AllocatedByteView
421
- */
417
+ //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/common.js
418
+ const decodeErrPrefix = "CBOR decode error:";
419
+ const encodeErrPrefix = "CBOR encode error:";
420
+ const uintMinorPrefixBytes = [];
421
+ uintMinorPrefixBytes[23] = 1;
422
+ uintMinorPrefixBytes[24] = 2;
423
+ uintMinorPrefixBytes[25] = 3;
424
+ uintMinorPrefixBytes[26] = 5;
425
+ uintMinorPrefixBytes[27] = 9;
422
426
  /**
423
- * @param {Uint8Array} buf
424
- * @returns {boolean}
427
+ * @param {Uint8Array} data
428
+ * @param {number} pos
429
+ * @param {number} need
425
430
  */
426
- function isBuffer(buf) {
427
- return useBuffer && globalThis.Buffer.isBuffer(buf);
431
+ function assertEnoughData(data, pos, need) {
432
+ if (data.length - pos < need) throw new Error(`${decodeErrPrefix} not enough data for type`);
428
433
  }
434
+ //#endregion
435
+ //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/0uint.js
436
+ const uintBoundaries = [
437
+ 24,
438
+ 256,
439
+ 65536,
440
+ 4294967296,
441
+ BigInt("18446744073709551616")
442
+ ];
429
443
  /**
430
- * @param {ByteView|number[]} buf
431
- * @returns {ByteView}
444
+ * @typedef {import('../interface.js').ByteWriter} ByteWriter
445
+ * @typedef {import('../interface.js').DecodeOptions} DecodeOptions
432
446
  */
433
- function asU8A(buf) {
434
- if (!(buf instanceof Uint8Array)) return Uint8Array.from(buf);
435
- return isBuffer(buf) ? new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength) : buf;
436
- }
437
- const FROM_STRING_THRESHOLD_BUFFER = 24;
438
- const FROM_STRING_THRESHOLD_TEXTENCODER = 200;
439
- const fromString = useBuffer ? (string) => {
440
- return string.length >= FROM_STRING_THRESHOLD_BUFFER ? globalThis.Buffer.from(string) : utf8ToBytes(string);
441
- } :
442
447
  /**
443
- * @param {string} string
448
+ * @param {Uint8Array} data
449
+ * @param {number} offset
450
+ * @param {DecodeOptions} options
451
+ * @returns {number}
444
452
  */
445
- (string) => {
446
- return string.length >= FROM_STRING_THRESHOLD_TEXTENCODER ? textEncoder$1.encode(string) : utf8ToBytes(string);
447
- };
453
+ function readUint8(data, offset, options) {
454
+ assertEnoughData(data, offset, 1);
455
+ const value = data[offset];
456
+ if (options.strict === true && value < uintBoundaries[0]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
457
+ return value;
458
+ }
448
459
  /**
449
- * Buffer variant not fast enough for what we need
450
- * @param {number[]} arr
451
- * @returns {AllocatedByteView}
460
+ * @param {Uint8Array} data
461
+ * @param {number} offset
462
+ * @param {DecodeOptions} options
463
+ * @returns {number}
452
464
  */
453
- const fromArray = (arr) => {
454
- return Uint8Array.from(arr);
455
- };
456
- const slice = useBuffer ? (bytes, start, end) => {
457
- if (isBuffer(bytes)) return new Uint8Array(bytes.subarray(start, end));
458
- return bytes.slice(start, end);
459
- } :
465
+ function readUint16(data, offset, options) {
466
+ assertEnoughData(data, offset, 2);
467
+ const value = data[offset] << 8 | data[offset + 1];
468
+ if (options.strict === true && value < uintBoundaries[1]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
469
+ return value;
470
+ }
460
471
  /**
461
- * @param {Uint8Array} bytes
462
- * @param {number} start
463
- * @param {number} end
472
+ * @param {Uint8Array} data
473
+ * @param {number} offset
474
+ * @param {DecodeOptions} options
475
+ * @returns {number}
464
476
  */
465
- (bytes, start, end) => {
466
- return bytes.slice(start, end);
467
- };
468
- const concat = useBuffer ? (chunks, length) => {
469
- chunks = chunks.map((c) => c instanceof Uint8Array ? c : globalThis.Buffer.from(c));
470
- return asU8A(globalThis.Buffer.concat(chunks, length));
471
- } :
477
+ function readUint32(data, offset, options) {
478
+ assertEnoughData(data, offset, 4);
479
+ const value = data[offset] * 16777216 + (data[offset + 1] << 16) + (data[offset + 2] << 8) + data[offset + 3];
480
+ if (options.strict === true && value < uintBoundaries[2]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
481
+ return value;
482
+ }
472
483
  /**
473
- * @param {ByteView[]} chunks
474
- * @param {number} length
475
- * @returns {AllocatedByteView}
484
+ * @param {Uint8Array} data
485
+ * @param {number} offset
486
+ * @param {DecodeOptions} options
487
+ * @returns {number|bigint}
476
488
  */
477
- (chunks, length) => {
478
- const out = new Uint8Array(length);
479
- let off = 0;
480
- for (let b of chunks) {
481
- if (off + b.length > out.length) b = b.subarray(0, out.length - off);
482
- out.set(b, off);
483
- off += b.length;
484
- }
485
- return out;
486
- };
487
- const alloc = useBuffer ? (size) => {
488
- return globalThis.Buffer.allocUnsafe(size);
489
- } :
489
+ function readUint64(data, offset, options) {
490
+ assertEnoughData(data, offset, 8);
491
+ const hi = data[offset] * 16777216 + (data[offset + 1] << 16) + (data[offset + 2] << 8) + data[offset + 3];
492
+ const lo = data[offset + 4] * 16777216 + (data[offset + 5] << 16) + (data[offset + 6] << 8) + data[offset + 7];
493
+ const value = (BigInt(hi) << BigInt(32)) + BigInt(lo);
494
+ if (options.strict === true && value < uintBoundaries[3]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
495
+ if (value <= Number.MAX_SAFE_INTEGER) return Number(value);
496
+ if (options.allowBigInt === true) return value;
497
+ throw new Error(`${decodeErrPrefix} integers outside of the safe integer range are not supported`);
498
+ }
490
499
  /**
491
- * @param {number} size
492
- * @returns {AllocatedByteView}
500
+ * @param {Uint8Array} data
501
+ * @param {number} pos
502
+ * @param {number} _minor
503
+ * @param {DecodeOptions} options
504
+ * @returns {Token}
493
505
  */
494
- (size) => {
495
- return new Uint8Array(size);
496
- };
506
+ function decodeUint8(data, pos, _minor, options) {
507
+ return new Token(Type.uint, readUint8(data, pos + 1, options), 2);
508
+ }
497
509
  /**
498
- * @param {Uint8Array} b1
499
- * @param {Uint8Array} b2
500
- * @returns {number}
510
+ * @param {Uint8Array} data
511
+ * @param {number} pos
512
+ * @param {number} _minor
513
+ * @param {DecodeOptions} options
514
+ * @returns {Token}
501
515
  */
502
- function compare(b1, b2) {
503
- if (isBuffer(b1) && isBuffer(b2)) return b1.compare(b2);
504
- for (let i = 0; i < b1.length; i++) {
505
- if (b1[i] === b2[i]) continue;
506
- return b1[i] < b2[i] ? -1 : 1;
507
- }
508
- return 0;
516
+ function decodeUint16(data, pos, _minor, options) {
517
+ return new Token(Type.uint, readUint16(data, pos + 1, options), 3);
509
518
  }
510
519
  /**
511
- * @param {string} str
512
- * @returns {number[]}
520
+ * @param {Uint8Array} data
521
+ * @param {number} pos
522
+ * @param {number} _minor
523
+ * @param {DecodeOptions} options
524
+ * @returns {Token}
513
525
  */
514
- function utf8ToBytes(str) {
515
- const out = [];
516
- let p = 0;
517
- for (let i = 0; i < str.length; i++) {
518
- let c = str.charCodeAt(i);
519
- if (c < 128) out[p++] = c;
520
- else if (c < 2048) {
521
- out[p++] = c >> 6 | 192;
522
- out[p++] = c & 63 | 128;
523
- } else if ((c & 64512) === 55296 && i + 1 < str.length && (str.charCodeAt(i + 1) & 64512) === 56320) {
524
- c = 65536 + ((c & 1023) << 10) + (str.charCodeAt(++i) & 1023);
525
- out[p++] = c >> 18 | 240;
526
- out[p++] = c >> 12 & 63 | 128;
527
- out[p++] = c >> 6 & 63 | 128;
528
- out[p++] = c & 63 | 128;
529
- } else {
530
- if (c >= 55296 && c <= 57343) c = 65533;
531
- out[p++] = c >> 12 | 224;
532
- out[p++] = c >> 6 & 63 | 128;
533
- out[p++] = c & 63 | 128;
534
- }
535
- }
536
- return out;
526
+ function decodeUint32(data, pos, _minor, options) {
527
+ return new Token(Type.uint, readUint32(data, pos + 1, options), 5);
537
528
  }
538
- //#endregion
539
- //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/bl.js
540
529
  /**
541
- * Bl is a list of byte chunks, similar to https://github.com/rvagg/bl but for
542
- * writing rather than reading.
543
- * A Bl object accepts set() operations for individual bytes and copyTo() for
544
- * inserting byte arrays. These write operations don't automatically increment
545
- * the internal cursor so its "length" won't be changed. Instead, increment()
546
- * must be called to extend its length to cover the inserted data.
547
- * The toBytes() call will convert all internal memory to a single Uint8Array of
548
- * the correct length, truncating any data that is stored but hasn't been
549
- * included by an increment().
550
- * get() can retrieve a single byte.
551
- * All operations (except toBytes()) take an "offset" argument that will perform
552
- * the write at the offset _from the current cursor_. For most operations this
553
- * will be `0` to write at the current cursor position but it can be ahead of
554
- * the current cursor. Negative offsets probably work but are untested.
530
+ * @param {Uint8Array} data
531
+ * @param {number} pos
532
+ * @param {number} _minor
533
+ * @param {DecodeOptions} options
534
+ * @returns {Token}
555
535
  */
536
+ function decodeUint64(data, pos, _minor, options) {
537
+ return new Token(Type.uint, readUint64(data, pos + 1, options), 9);
538
+ }
556
539
  /**
557
- * @typedef {import('../interface.js').ByteView} ByteView
558
- * @typedef {import('../interface.js').AllocatedByteView} AllocatedByteView
540
+ * @param {ByteWriter} writer
541
+ * @param {Token} token
559
542
  */
560
- const defaultChunkSize = 256;
561
- var Bl = class {
562
- /**
563
- * @param {number} [chunkSize]
564
- */
565
- constructor(chunkSize = defaultChunkSize) {
566
- this.chunkSize = chunkSize;
567
- /** @type {number} */
568
- this.cursor = 0;
569
- /** @type {number} */
570
- this.maxCursor = -1;
571
- /** @type {(ByteView|number[])[]} */
572
- this.chunks = [];
573
- /** @type {ByteView|number[]|null} */
574
- this._initReuseChunk = null;
543
+ function encodeUint(writer, token) {
544
+ return encodeUintValue(writer, 0, token.value);
545
+ }
546
+ /**
547
+ * @param {ByteWriter} writer
548
+ * @param {number} major
549
+ * @param {number|bigint} uint
550
+ */
551
+ function encodeUintValue(writer, major, uint) {
552
+ if (uint < uintBoundaries[0]) {
553
+ const nuint = Number(uint);
554
+ writer.pushByte(major | nuint);
555
+ } else if (uint < uintBoundaries[1]) {
556
+ const nuint = Number(uint);
557
+ writer.push([major | 24, nuint]);
558
+ } else if (uint < uintBoundaries[2]) {
559
+ const nuint = Number(uint);
560
+ writer.push([
561
+ major | 25,
562
+ nuint >>> 8,
563
+ nuint & 255
564
+ ]);
565
+ } else if (uint < uintBoundaries[3]) {
566
+ const nuint = Number(uint);
567
+ writer.push([
568
+ major | 26,
569
+ nuint >>> 24 & 255,
570
+ nuint >>> 16 & 255,
571
+ nuint >>> 8 & 255,
572
+ nuint & 255
573
+ ]);
574
+ } else {
575
+ const buint = BigInt(uint);
576
+ if (buint < uintBoundaries[4]) {
577
+ const set = [
578
+ major | 27,
579
+ 0,
580
+ 0,
581
+ 0,
582
+ 0,
583
+ 0,
584
+ 0,
585
+ 0
586
+ ];
587
+ let lo = Number(buint & BigInt(4294967295));
588
+ let hi = Number(buint >> BigInt(32) & BigInt(4294967295));
589
+ set[8] = lo & 255;
590
+ lo = lo >> 8;
591
+ set[7] = lo & 255;
592
+ lo = lo >> 8;
593
+ set[6] = lo & 255;
594
+ lo = lo >> 8;
595
+ set[5] = lo & 255;
596
+ set[4] = hi & 255;
597
+ hi = hi >> 8;
598
+ set[3] = hi & 255;
599
+ hi = hi >> 8;
600
+ set[2] = hi & 255;
601
+ hi = hi >> 8;
602
+ set[1] = hi & 255;
603
+ writer.push(set);
604
+ } else throw new Error(`${decodeErrPrefix} encountered BigInt larger than allowable range`);
575
605
  }
576
- reset() {
577
- this.cursor = 0;
578
- this.maxCursor = -1;
579
- if (this.chunks.length) this.chunks = [];
580
- if (this._initReuseChunk !== null) {
581
- this.chunks.push(this._initReuseChunk);
582
- this.maxCursor = this._initReuseChunk.length - 1;
583
- }
584
- }
585
- /**
586
- * @param {number} byte
587
- */
588
- pushByte(byte) {
589
- let topChunk = this.chunks[this.chunks.length - 1];
590
- if (this.cursor > this.maxCursor) {
591
- topChunk = alloc(this.chunkSize);
592
- this.chunks.push(topChunk);
593
- this.maxCursor += topChunk.length;
594
- if (this._initReuseChunk === null) this._initReuseChunk = topChunk;
595
- }
596
- const chunkPos = topChunk.length - (this.maxCursor - this.cursor) - 1;
597
- topChunk[chunkPos] = byte;
598
- this.cursor++;
599
- }
600
- /**
601
- * @param {ByteView|number[]} bytes
602
- */
603
- push(bytes) {
604
- let topChunk = this.chunks[this.chunks.length - 1];
605
- if (this.cursor + bytes.length <= this.maxCursor + 1) {
606
- const chunkPos = topChunk.length - (this.maxCursor - this.cursor) - 1;
607
- topChunk.set(bytes, chunkPos);
608
- } else {
609
- if (topChunk) {
610
- const chunkPos = topChunk.length - (this.maxCursor - this.cursor) - 1;
611
- if (chunkPos < topChunk.length) {
612
- this.chunks[this.chunks.length - 1] = topChunk.subarray(0, chunkPos);
613
- this.maxCursor = this.cursor - 1;
614
- }
615
- }
616
- if (bytes.length < 64 && bytes.length < this.chunkSize) {
617
- topChunk = alloc(this.chunkSize);
618
- this.chunks.push(topChunk);
619
- this.maxCursor += topChunk.length;
620
- if (this._initReuseChunk === null) this._initReuseChunk = topChunk;
621
- topChunk.set(bytes, 0);
622
- } else {
623
- this.chunks.push(bytes);
624
- this.maxCursor += bytes.length;
625
- }
626
- }
627
- this.cursor += bytes.length;
628
- }
629
- /**
630
- * @param {boolean} [reset]
631
- * @returns {AllocatedByteView}
632
- */
633
- toBytes(reset = false) {
634
- let byts;
635
- if (this.chunks.length === 1) {
636
- const chunk = this.chunks[0];
637
- if (reset && this.cursor > chunk.length / 2) {
638
- byts = this.cursor === chunk.length ? chunk : chunk.subarray(0, this.cursor);
639
- this._initReuseChunk = null;
640
- this.chunks = [];
641
- } else byts = slice(chunk, 0, this.cursor);
642
- } else byts = concat(this.chunks, this.cursor);
643
- if (reset) this.reset();
644
- return byts;
645
- }
646
- };
647
- /**
648
- * U8Bl is a buffer list that writes directly to a user-provided Uint8Array.
649
- * It provides the same interface as Bl but writes to a fixed destination.
650
- * @template {ArrayBufferLike} T
651
- */
652
- var U8Bl = class {
653
- /**
654
- * @param {Uint8Array<T>} dest
655
- */
656
- constructor(dest) {
657
- this.dest = dest;
658
- /** @type {number} */
659
- this.cursor = 0;
660
- /** @type {Array<Uint8Array<T>>} */
661
- this.chunks = [dest];
662
- }
663
- reset() {
664
- this.cursor = 0;
665
- }
666
- /**
667
- * @param {number} byte
668
- */
669
- pushByte(byte) {
670
- if (this.cursor >= this.dest.length) throw new Error("write out of bounds, destination buffer is too small");
671
- this.dest[this.cursor++] = byte;
672
- }
673
- /**
674
- * @param {ByteView|number[]} bytes
675
- */
676
- push(bytes) {
677
- if (this.cursor + bytes.length > this.dest.length) throw new Error("write out of bounds, destination buffer is too small");
678
- this.dest.set(bytes, this.cursor);
679
- this.cursor += bytes.length;
680
- }
681
- /**
682
- * @param {boolean} [reset]
683
- * @returns {Uint8Array<T>}
684
- */
685
- toBytes(reset = false) {
686
- const byts = this.dest.subarray(0, this.cursor);
687
- if (reset) this.reset();
688
- return byts;
689
- }
690
- };
691
- //#endregion
692
- //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/common.js
693
- const decodeErrPrefix = "CBOR decode error:";
694
- const encodeErrPrefix = "CBOR encode error:";
695
- const uintMinorPrefixBytes = [];
696
- uintMinorPrefixBytes[23] = 1;
697
- uintMinorPrefixBytes[24] = 2;
698
- uintMinorPrefixBytes[25] = 3;
699
- uintMinorPrefixBytes[26] = 5;
700
- uintMinorPrefixBytes[27] = 9;
701
- /**
702
- * @param {Uint8Array} data
703
- * @param {number} pos
704
- * @param {number} need
705
- */
706
- function assertEnoughData(data, pos, need) {
707
- if (data.length - pos < need) throw new Error(`${decodeErrPrefix} not enough data for type`);
708
606
  }
709
- //#endregion
710
- //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/0uint.js
711
- const uintBoundaries = [
712
- 24,
713
- 256,
714
- 65536,
715
- 4294967296,
716
- BigInt("18446744073709551616")
717
- ];
718
- /**
719
- * @typedef {import('../interface.js').ByteWriter} ByteWriter
720
- * @typedef {import('../interface.js').DecodeOptions} DecodeOptions
721
- */
722
607
  /**
723
- * @param {Uint8Array} data
724
- * @param {number} offset
725
- * @param {DecodeOptions} options
608
+ * @param {Token} token
726
609
  * @returns {number}
727
610
  */
728
- function readUint8(data, offset, options) {
729
- assertEnoughData(data, offset, 1);
730
- const value = data[offset];
731
- if (options.strict === true && value < uintBoundaries[0]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
732
- return value;
733
- }
611
+ encodeUint.encodedSize = function encodedSize(token) {
612
+ return encodeUintValue.encodedSize(token.value);
613
+ };
734
614
  /**
735
- * @param {Uint8Array} data
736
- * @param {number} offset
737
- * @param {DecodeOptions} options
615
+ * @param {number} uint
738
616
  * @returns {number}
739
617
  */
740
- function readUint16(data, offset, options) {
741
- assertEnoughData(data, offset, 2);
742
- const value = data[offset] << 8 | data[offset + 1];
743
- if (options.strict === true && value < uintBoundaries[1]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
744
- return value;
745
- }
618
+ encodeUintValue.encodedSize = function encodedSize(uint) {
619
+ if (uint < uintBoundaries[0]) return 1;
620
+ if (uint < uintBoundaries[1]) return 2;
621
+ if (uint < uintBoundaries[2]) return 3;
622
+ if (uint < uintBoundaries[3]) return 5;
623
+ return 9;
624
+ };
746
625
  /**
747
- * @param {Uint8Array} data
748
- * @param {number} offset
749
- * @param {DecodeOptions} options
626
+ * @param {Token} tok1
627
+ * @param {Token} tok2
750
628
  * @returns {number}
751
629
  */
752
- function readUint32(data, offset, options) {
753
- assertEnoughData(data, offset, 4);
754
- const value = data[offset] * 16777216 + (data[offset + 1] << 16) + (data[offset + 2] << 8) + data[offset + 3];
755
- if (options.strict === true && value < uintBoundaries[2]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
756
- return value;
757
- }
630
+ encodeUint.compareTokens = function compareTokens(tok1, tok2) {
631
+ return tok1.value < tok2.value ? -1 : tok1.value > tok2.value ? 1 : 0;
632
+ };
633
+ //#endregion
634
+ //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/1negint.js
758
635
  /**
759
- * @param {Uint8Array} data
760
- * @param {number} offset
761
- * @param {DecodeOptions} options
762
- * @returns {number|bigint}
636
+ * @typedef {import('../interface.js').ByteWriter} ByteWriter
637
+ * @typedef {import('../interface.js').DecodeOptions} DecodeOptions
763
638
  */
764
- function readUint64(data, offset, options) {
765
- assertEnoughData(data, offset, 8);
766
- const hi = data[offset] * 16777216 + (data[offset + 1] << 16) + (data[offset + 2] << 8) + data[offset + 3];
767
- const lo = data[offset + 4] * 16777216 + (data[offset + 5] << 16) + (data[offset + 6] << 8) + data[offset + 7];
768
- const value = (BigInt(hi) << BigInt(32)) + BigInt(lo);
769
- if (options.strict === true && value < uintBoundaries[3]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
770
- if (value <= Number.MAX_SAFE_INTEGER) return Number(value);
771
- if (options.allowBigInt === true) return value;
772
- throw new Error(`${decodeErrPrefix} integers outside of the safe integer range are not supported`);
773
- }
774
639
  /**
775
640
  * @param {Uint8Array} data
776
641
  * @param {number} pos
@@ -778,8 +643,8 @@ function readUint64(data, offset, options) {
778
643
  * @param {DecodeOptions} options
779
644
  * @returns {Token}
780
645
  */
781
- function decodeUint8(data, pos, _minor, options) {
782
- return new Token(Type.uint, readUint8(data, pos + 1, options), 2);
646
+ function decodeNegint8(data, pos, _minor, options) {
647
+ return new Token(Type.negint, -1 - readUint8(data, pos + 1, options), 2);
783
648
  }
784
649
  /**
785
650
  * @param {Uint8Array} data
@@ -788,8 +653,8 @@ function decodeUint8(data, pos, _minor, options) {
788
653
  * @param {DecodeOptions} options
789
654
  * @returns {Token}
790
655
  */
791
- function decodeUint16(data, pos, _minor, options) {
792
- return new Token(Type.uint, readUint16(data, pos + 1, options), 3);
656
+ function decodeNegint16(data, pos, _minor, options) {
657
+ return new Token(Type.negint, -1 - readUint16(data, pos + 1, options), 3);
793
658
  }
794
659
  /**
795
660
  * @param {Uint8Array} data
@@ -798,9 +663,11 @@ function decodeUint16(data, pos, _minor, options) {
798
663
  * @param {DecodeOptions} options
799
664
  * @returns {Token}
800
665
  */
801
- function decodeUint32(data, pos, _minor, options) {
802
- return new Token(Type.uint, readUint32(data, pos + 1, options), 5);
666
+ function decodeNegint32(data, pos, _minor, options) {
667
+ return new Token(Type.negint, -1 - readUint32(data, pos + 1, options), 5);
803
668
  }
669
+ const neg1b$1 = BigInt(-1);
670
+ const pos1b$1 = BigInt(1);
804
671
  /**
805
672
  * @param {Uint8Array} data
806
673
  * @param {number} pos
@@ -808,169 +675,27 @@ function decodeUint32(data, pos, _minor, options) {
808
675
  * @param {DecodeOptions} options
809
676
  * @returns {Token}
810
677
  */
811
- function decodeUint64(data, pos, _minor, options) {
812
- return new Token(Type.uint, readUint64(data, pos + 1, options), 9);
678
+ function decodeNegint64(data, pos, _minor, options) {
679
+ const int = readUint64(data, pos + 1, options);
680
+ if (typeof int !== "bigint") {
681
+ const value = -1 - int;
682
+ if (value >= Number.MIN_SAFE_INTEGER) return new Token(Type.negint, value, 9);
683
+ }
684
+ if (options.allowBigInt !== true) throw new Error(`${decodeErrPrefix} integers outside of the safe integer range are not supported`);
685
+ return new Token(Type.negint, neg1b$1 - BigInt(int), 9);
813
686
  }
814
687
  /**
815
688
  * @param {ByteWriter} writer
816
689
  * @param {Token} token
817
690
  */
818
- function encodeUint(writer, token) {
819
- return encodeUintValue(writer, 0, token.value);
691
+ function encodeNegint(writer, token) {
692
+ const negint = token.value;
693
+ const unsigned = typeof negint === "bigint" ? negint * neg1b$1 - pos1b$1 : negint * -1 - 1;
694
+ encodeUintValue(writer, token.type.majorEncoded, unsigned);
820
695
  }
821
696
  /**
822
- * @param {ByteWriter} writer
823
- * @param {number} major
824
- * @param {number|bigint} uint
825
- */
826
- function encodeUintValue(writer, major, uint) {
827
- if (uint < uintBoundaries[0]) {
828
- const nuint = Number(uint);
829
- writer.pushByte(major | nuint);
830
- } else if (uint < uintBoundaries[1]) {
831
- const nuint = Number(uint);
832
- writer.push([major | 24, nuint]);
833
- } else if (uint < uintBoundaries[2]) {
834
- const nuint = Number(uint);
835
- writer.push([
836
- major | 25,
837
- nuint >>> 8,
838
- nuint & 255
839
- ]);
840
- } else if (uint < uintBoundaries[3]) {
841
- const nuint = Number(uint);
842
- writer.push([
843
- major | 26,
844
- nuint >>> 24 & 255,
845
- nuint >>> 16 & 255,
846
- nuint >>> 8 & 255,
847
- nuint & 255
848
- ]);
849
- } else {
850
- const buint = BigInt(uint);
851
- if (buint < uintBoundaries[4]) {
852
- const set = [
853
- major | 27,
854
- 0,
855
- 0,
856
- 0,
857
- 0,
858
- 0,
859
- 0,
860
- 0
861
- ];
862
- let lo = Number(buint & BigInt(4294967295));
863
- let hi = Number(buint >> BigInt(32) & BigInt(4294967295));
864
- set[8] = lo & 255;
865
- lo = lo >> 8;
866
- set[7] = lo & 255;
867
- lo = lo >> 8;
868
- set[6] = lo & 255;
869
- lo = lo >> 8;
870
- set[5] = lo & 255;
871
- set[4] = hi & 255;
872
- hi = hi >> 8;
873
- set[3] = hi & 255;
874
- hi = hi >> 8;
875
- set[2] = hi & 255;
876
- hi = hi >> 8;
877
- set[1] = hi & 255;
878
- writer.push(set);
879
- } else throw new Error(`${decodeErrPrefix} encountered BigInt larger than allowable range`);
880
- }
881
- }
882
- /**
883
- * @param {Token} token
884
- * @returns {number}
885
- */
886
- encodeUint.encodedSize = function encodedSize(token) {
887
- return encodeUintValue.encodedSize(token.value);
888
- };
889
- /**
890
- * @param {number} uint
891
- * @returns {number}
892
- */
893
- encodeUintValue.encodedSize = function encodedSize(uint) {
894
- if (uint < uintBoundaries[0]) return 1;
895
- if (uint < uintBoundaries[1]) return 2;
896
- if (uint < uintBoundaries[2]) return 3;
897
- if (uint < uintBoundaries[3]) return 5;
898
- return 9;
899
- };
900
- /**
901
- * @param {Token} tok1
902
- * @param {Token} tok2
903
- * @returns {number}
904
- */
905
- encodeUint.compareTokens = function compareTokens(tok1, tok2) {
906
- return tok1.value < tok2.value ? -1 : tok1.value > tok2.value ? 1 : 0;
907
- };
908
- //#endregion
909
- //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/1negint.js
910
- /**
911
- * @typedef {import('../interface.js').ByteWriter} ByteWriter
912
- * @typedef {import('../interface.js').DecodeOptions} DecodeOptions
913
- */
914
- /**
915
- * @param {Uint8Array} data
916
- * @param {number} pos
917
- * @param {number} _minor
918
- * @param {DecodeOptions} options
919
- * @returns {Token}
920
- */
921
- function decodeNegint8(data, pos, _minor, options) {
922
- return new Token(Type.negint, -1 - readUint8(data, pos + 1, options), 2);
923
- }
924
- /**
925
- * @param {Uint8Array} data
926
- * @param {number} pos
927
- * @param {number} _minor
928
- * @param {DecodeOptions} options
929
- * @returns {Token}
930
- */
931
- function decodeNegint16(data, pos, _minor, options) {
932
- return new Token(Type.negint, -1 - readUint16(data, pos + 1, options), 3);
933
- }
934
- /**
935
- * @param {Uint8Array} data
936
- * @param {number} pos
937
- * @param {number} _minor
938
- * @param {DecodeOptions} options
939
- * @returns {Token}
940
- */
941
- function decodeNegint32(data, pos, _minor, options) {
942
- return new Token(Type.negint, -1 - readUint32(data, pos + 1, options), 5);
943
- }
944
- const neg1b$1 = BigInt(-1);
945
- const pos1b$1 = BigInt(1);
946
- /**
947
- * @param {Uint8Array} data
948
- * @param {number} pos
949
- * @param {number} _minor
950
- * @param {DecodeOptions} options
951
- * @returns {Token}
952
- */
953
- function decodeNegint64(data, pos, _minor, options) {
954
- const int = readUint64(data, pos + 1, options);
955
- if (typeof int !== "bigint") {
956
- const value = -1 - int;
957
- if (value >= Number.MIN_SAFE_INTEGER) return new Token(Type.negint, value, 9);
958
- }
959
- if (options.allowBigInt !== true) throw new Error(`${decodeErrPrefix} integers outside of the safe integer range are not supported`);
960
- return new Token(Type.negint, neg1b$1 - BigInt(int), 9);
961
- }
962
- /**
963
- * @param {ByteWriter} writer
964
- * @param {Token} token
965
- */
966
- function encodeNegint(writer, token) {
967
- const negint = token.value;
968
- const unsigned = typeof negint === "bigint" ? negint * neg1b$1 - pos1b$1 : negint * -1 - 1;
969
- encodeUintValue(writer, token.type.majorEncoded, unsigned);
970
- }
971
- /**
972
- * @param {Token} token
973
- * @returns {number}
697
+ * @param {Token} token
698
+ * @returns {number}
974
699
  */
975
700
  encodeNegint.encodedSize = function encodedSize(token) {
976
701
  const negint = token.value;
@@ -2672,148 +2397,423 @@ function invalid() {
2672
2397
  function assertUnsignedSafeInteger(value) {
2673
2398
  if (!Number.isSafeInteger(value) || value < 0) invalid();
2674
2399
  }
2675
- function assertProtocolVersion(value) {
2676
- if (!Number.isSafeInteger(value) || value < 0 || value > 65535) invalid();
2400
+ function assertProtocolVersion(value) {
2401
+ if (!Number.isSafeInteger(value) || value < 0 || value > 65535) invalid();
2402
+ }
2403
+ function assertIdentifier(value, pattern) {
2404
+ if (!pattern.test(value)) invalid();
2405
+ }
2406
+ function copyBytes(value, expectedLengths) {
2407
+ if (!(value instanceof Uint8Array) || !expectedLengths.includes(value.byteLength)) invalid();
2408
+ return Uint8Array.from(value);
2409
+ }
2410
+ function canonicalizeHubOrigin(value) {
2411
+ if (typeof value !== "string" || value.length === 0 || value.length > 512) invalid();
2412
+ let url;
2413
+ try {
2414
+ url = new URL(value);
2415
+ } catch {
2416
+ return invalid();
2417
+ }
2418
+ const isLoopbackHttp = url.protocol === "http:" && LOOPBACK_HOSTS.has(url.hostname);
2419
+ if (url.protocol !== "https:" && !isLoopbackHttp || url.username !== "" || url.password !== "" || url.pathname !== "/" || url.search !== "" || url.hash !== "" || value !== url.origin) invalid();
2420
+ return url.origin;
2421
+ }
2422
+ function normalizeHubNodeName(value) {
2423
+ if (typeof value !== "string") invalid();
2424
+ const normalized = value.trim();
2425
+ if (normalized.length === 0 || normalized.length > 100) invalid();
2426
+ return normalized;
2427
+ }
2428
+ function validateNodePublicKey(descriptor) {
2429
+ if (descriptor.algorithm === "ed25519") return {
2430
+ algorithm: descriptor.algorithm,
2431
+ publicKey: copyBytes(descriptor.publicKey, [32])
2432
+ };
2433
+ if (descriptor.algorithm === "p256") {
2434
+ const publicKey = copyBytes(descriptor.publicKey, [33, 65]);
2435
+ const prefix = publicKey[0];
2436
+ if (publicKey.byteLength === 33 && prefix !== 2 && prefix !== 3 || publicKey.byteLength === 65 && prefix !== 4) invalid();
2437
+ return {
2438
+ algorithm: descriptor.algorithm,
2439
+ publicKey
2440
+ };
2441
+ }
2442
+ return invalid();
2443
+ }
2444
+ function fingerprintNodePublicKey(descriptor) {
2445
+ const key = validateNodePublicKey(descriptor);
2446
+ const canonical = encode([
2447
+ NODE_KEY_FINGERPRINT_DOMAIN,
2448
+ key.algorithm,
2449
+ key.publicKey
2450
+ ], rfc8949EncodeOptions);
2451
+ return Uint8Array.from(createHash("sha256").update(canonical).digest());
2452
+ }
2453
+ function formatNodePublicKeyFingerprint(fingerprint) {
2454
+ const bytes = copyBytes(fingerprint, [32]);
2455
+ return `SHA256:${Buffer.from(bytes).toString("base64url")}`;
2456
+ }
2457
+ function encodeNodeAuthenticationTranscript(input) {
2458
+ const hubOrigin = canonicalizeHubOrigin(input.hubOrigin);
2459
+ assertProtocolVersion(input.protocolMajor);
2460
+ assertProtocolVersion(input.protocolMinor);
2461
+ assertIdentifier(input.nodeId, NODE_ID);
2462
+ assertIdentifier(input.activeKeyId, NODE_KEY_ID);
2463
+ assertUnsignedSafeInteger(input.challengeExpiresAt);
2464
+ const challenge = copyBytes(input.challenge, [32]);
2465
+ return Uint8Array.from(encode([
2466
+ NODE_AUTH_TRANSCRIPT_DOMAIN,
2467
+ hubOrigin,
2468
+ input.protocolMajor,
2469
+ input.protocolMinor,
2470
+ input.nodeId,
2471
+ input.activeKeyId,
2472
+ input.challengeExpiresAt,
2473
+ challenge
2474
+ ], rfc8949EncodeOptions));
2475
+ }
2476
+ function encodeNodeKeyRotationTranscript(input) {
2477
+ const hubOrigin = canonicalizeHubOrigin(input.hubOrigin);
2478
+ assertProtocolVersion(input.protocolMajor);
2479
+ assertProtocolVersion(input.protocolMinor);
2480
+ assertIdentifier(input.rotationRequestId, ROTATION_REQUEST_ID);
2481
+ assertIdentifier(input.nodeId, NODE_ID);
2482
+ assertIdentifier(input.oldActiveKeyId, NODE_KEY_ID);
2483
+ assertIdentifier(input.newKeyId, NODE_KEY_ID);
2484
+ assertUnsignedSafeInteger(input.challengeExpiresAt);
2485
+ const newKey = validateNodePublicKey(input.newKey);
2486
+ const fingerprint = fingerprintNodePublicKey(newKey);
2487
+ const challenge = copyBytes(input.challenge, [32]);
2488
+ return Uint8Array.from(encode([
2489
+ NODE_KEY_ROTATION_TRANSCRIPT_DOMAIN,
2490
+ hubOrigin,
2491
+ input.protocolMajor,
2492
+ input.protocolMinor,
2493
+ input.rotationRequestId,
2494
+ input.nodeId,
2495
+ input.oldActiveKeyId,
2496
+ input.newKeyId,
2497
+ newKey.algorithm,
2498
+ newKey.publicKey,
2499
+ fingerprint,
2500
+ input.challengeExpiresAt,
2501
+ challenge
2502
+ ], rfc8949EncodeOptions));
2503
+ }
2504
+ function encodeNativeNodeClaimTranscript(input) {
2505
+ const hubOrigin = canonicalizeHubOrigin(input.hubOrigin);
2506
+ assertProtocolVersion(input.protocolVersion);
2507
+ assertProtocolVersion(input.transcriptVersion);
2508
+ assertIdentifier(input.claimId, NATIVE_NODE_CLAIM_ID);
2509
+ assertIdentifier(input.accountId, ACCOUNT_ID);
2510
+ assertIdentifier(input.spaceId, SPACE_ID);
2511
+ assertIdentifier(input.sessionId, SESSION_ID);
2512
+ const dpopKeyThumbprint = copyBytes(input.dpopKeyThumbprint, [32]);
2513
+ assertIdentifier(input.installationId, DESKTOP_INSTALLATION_ID);
2514
+ assertIdentifier(input.environmentId, ENVIRONMENT_ID);
2515
+ const nodeKey = validateNodePublicKey(input.nodeKey);
2516
+ const nodeFingerprint = fingerprintNodePublicKey(nodeKey);
2517
+ assertUnsignedSafeInteger(input.claimExpiresAt);
2518
+ const challenge = copyBytes(input.challenge, [32]);
2519
+ return Uint8Array.from(encode([
2520
+ NATIVE_NODE_CLAIM_TRANSCRIPT_DOMAIN,
2521
+ hubOrigin,
2522
+ input.protocolVersion,
2523
+ input.transcriptVersion,
2524
+ input.claimId,
2525
+ input.accountId,
2526
+ input.spaceId,
2527
+ input.sessionId,
2528
+ dpopKeyThumbprint,
2529
+ input.installationId,
2530
+ input.environmentId,
2531
+ nodeKey.algorithm,
2532
+ nodeKey.publicKey,
2533
+ nodeFingerprint,
2534
+ input.claimExpiresAt,
2535
+ challenge
2536
+ ], rfc8949EncodeOptions));
2537
+ }
2538
+ function equalNodeIdentityBytes(left, right) {
2539
+ if (!(left instanceof Uint8Array) || !(right instanceof Uint8Array)) return false;
2540
+ if (left.byteLength !== right.byteLength) return false;
2541
+ return timingSafeEqual(left, right);
2542
+ }
2543
+ //#endregion
2544
+ //#region ../../packages/shared/src/Struct.ts
2545
+ function deepMerge(current, patch) {
2546
+ if (!P.isObject(current) || !P.isObject(patch)) return patch;
2547
+ const next = { ...current };
2548
+ for (const [key, value] of Object.entries(patch)) {
2549
+ if (value === void 0) continue;
2550
+ const existing = next[key];
2551
+ next[key] = P.isObject(existing) && P.isObject(value) ? deepMerge(existing, value) : value;
2552
+ }
2553
+ return next;
2554
+ }
2555
+ //#endregion
2556
+ //#region ../../packages/shared/src/model.ts
2557
+ const DEFAULT_PROVIDER_DRIVER_KIND = ProviderDriverKind.make("codex");
2558
+ /**
2559
+ * Resolve the human-readable model title used by picker surfaces and durable
2560
+ * handoff presentation. Provider catalogs are authoritative when they carry a
2561
+ * friendly name; the routing slug remains the deterministic final fallback.
2562
+ */
2563
+ function getModelDisplayName(model, options) {
2564
+ const shortName = trimOrNull(model.shortName);
2565
+ const name = trimOrNull(model.name);
2566
+ const slug = trimOrNull(model.slug) ?? model.slug;
2567
+ return options?.preferShortName ? shortName ?? name ?? slug : name ?? shortName ?? slug;
2568
+ }
2569
+ /** Compose the optional sub-provider prefix exactly as the picker trigger does. */
2570
+ function getModelDisplayLabel(model, options) {
2571
+ const title = getModelDisplayName(model, options);
2572
+ const subProvider = trimOrNull(model.subProvider);
2573
+ return subProvider ? `${subProvider} · ${title}` : title;
2574
+ }
2575
+ function createModelCapabilities(input) {
2576
+ return { optionDescriptors: input.optionDescriptors.map(cloneDescriptor) };
2577
+ }
2578
+ function getRawSelectionValueById(selections, id) {
2579
+ return (selections?.find((candidate) => candidate.id === id))?.value;
2580
+ }
2581
+ function getProviderOptionSelectionValue(selections, id) {
2582
+ return getRawSelectionValueById(selections, id);
2583
+ }
2584
+ function getProviderOptionStringSelectionValue(selections, id) {
2585
+ const value = getProviderOptionSelectionValue(selections, id);
2586
+ return typeof value === "string" ? value : void 0;
2587
+ }
2588
+ function getProviderOptionBooleanSelectionValue(selections, id) {
2589
+ const value = getProviderOptionSelectionValue(selections, id);
2590
+ return typeof value === "boolean" ? value : void 0;
2591
+ }
2592
+ function getModelSelectionStringOptionValue(modelSelection, id) {
2593
+ return getProviderOptionStringSelectionValue(modelSelection?.options, id);
2594
+ }
2595
+ function getModelSelectionBooleanOptionValue(modelSelection, id) {
2596
+ return getProviderOptionBooleanSelectionValue(modelSelection?.options, id);
2597
+ }
2598
+ function resolveDescriptorChoiceValue(descriptor, raw) {
2599
+ const trimmed = trimOrNull(raw);
2600
+ if (!trimmed) return descriptor.currentValue ?? descriptor.options.find((option) => option.isDefault)?.id;
2601
+ if (descriptor.options.length === 0) return trimmed;
2602
+ if (descriptor.promptInjectedValues?.includes(trimmed) && descriptor.options.some((option) => option.id === trimmed)) return descriptor.options.find((option) => option.isDefault)?.id;
2603
+ if (descriptor.options.some((option) => option.id === trimmed)) return trimmed;
2604
+ return descriptor.currentValue ?? descriptor.options.find((option) => option.isDefault)?.id;
2605
+ }
2606
+ function cloneDescriptor(descriptor) {
2607
+ return descriptor.type === "select" ? {
2608
+ ...descriptor,
2609
+ options: [...descriptor.options],
2610
+ ...descriptor.promptInjectedValues ? { promptInjectedValues: [...descriptor.promptInjectedValues] } : {}
2611
+ } : { ...descriptor };
2612
+ }
2613
+ function cloneSelection(selection) {
2614
+ return { ...selection };
2615
+ }
2616
+ function withDescriptorCurrentValue(descriptor, rawCurrentValue) {
2617
+ if (descriptor.type === "boolean") {
2618
+ if (typeof rawCurrentValue === "boolean") return {
2619
+ ...descriptor,
2620
+ currentValue: rawCurrentValue
2621
+ };
2622
+ return descriptor;
2623
+ }
2624
+ const currentValue = typeof rawCurrentValue === "string" ? resolveDescriptorChoiceValue(descriptor, rawCurrentValue) : resolveDescriptorChoiceValue(descriptor, descriptor.currentValue);
2625
+ if (!currentValue) {
2626
+ const { currentValue: _unusedCurrentValue, ...rest } = descriptor;
2627
+ return rest;
2628
+ }
2629
+ return {
2630
+ ...descriptor,
2631
+ currentValue
2632
+ };
2633
+ }
2634
+ function getProviderOptionDescriptors(input) {
2635
+ const { caps, selections } = input;
2636
+ return (caps.optionDescriptors ?? []).map(cloneDescriptor).map((descriptor) => withDescriptorCurrentValue(descriptor, getRawSelectionValueById(selections, descriptor.id) ?? descriptor.currentValue));
2637
+ }
2638
+ function getProviderOptionCurrentValue(descriptor) {
2639
+ if (!descriptor) return;
2640
+ if (descriptor.type === "boolean") return descriptor.currentValue;
2641
+ if (descriptor.currentValue) return descriptor.currentValue;
2642
+ return descriptor.options.find((option) => option.isDefault)?.id;
2643
+ }
2644
+ function normalizeModelSlug(model, provider = DEFAULT_PROVIDER_DRIVER_KIND) {
2645
+ if (typeof model !== "string") return null;
2646
+ const trimmed = model.trim();
2647
+ if (!trimmed) return null;
2648
+ const aliases = MODEL_SLUG_ALIASES_BY_PROVIDER[provider] ?? {};
2649
+ const aliased = Object.prototype.hasOwnProperty.call(aliases, trimmed) ? aliases[trimmed] : void 0;
2650
+ return typeof aliased === "string" ? aliased : trimmed;
2651
+ }
2652
+ /** Trim a string, returning null for empty/missing values. */
2653
+ function trimOrNull(value) {
2654
+ if (typeof value !== "string") return null;
2655
+ return value.trim() || null;
2656
+ }
2657
+ function cloneSelections(selections) {
2658
+ return selections.map(cloneSelection);
2659
+ }
2660
+ function createModelSelection(instanceId, model, options) {
2661
+ const selections = options ? cloneSelections(options) : [];
2662
+ const base = {
2663
+ instanceId,
2664
+ model
2665
+ };
2666
+ return selections.length > 0 ? {
2667
+ ...base,
2668
+ options: selections
2669
+ } : base;
2670
+ }
2671
+ /**
2672
+ * Context handoff is a provider-instance boundary. Model and option changes
2673
+ * within one configured instance remain on that provider's normal turn path.
2674
+ */
2675
+ function modelSelectionRequiresContextHandoff(input) {
2676
+ return input.canonicalSelection.instanceId !== input.targetSelection.instanceId;
2677
+ }
2678
+ /**
2679
+ * Returns the effort value if it is a prompt-injected value according to
2680
+ * any select descriptor in the given capabilities, or null otherwise.
2681
+ *
2682
+ * Unlike a single `find`, this checks every descriptor so that the
2683
+ * correct descriptor's `promptInjectedValues` list is consulted even when
2684
+ * multiple select descriptors exist.
2685
+ */
2686
+ function resolvePromptInjectedEffort(caps, rawEffort) {
2687
+ const trimmed = trimOrNull(rawEffort);
2688
+ if (!trimmed) return null;
2689
+ const descriptors = getProviderOptionDescriptors({ caps });
2690
+ for (const descriptor of descriptors) if (descriptor.type === "select" && descriptor.promptInjectedValues?.includes(trimmed)) return trimmed;
2691
+ return null;
2692
+ }
2693
+ function applyClaudePromptEffortPrefix(text, effort) {
2694
+ const trimmed = text.trim();
2695
+ if (!trimmed) return trimmed;
2696
+ if (effort !== "ultrathink") return trimmed;
2697
+ if (trimmed.startsWith("Ultrathink:")) return trimmed;
2698
+ return `Ultrathink:\n${trimmed}`;
2677
2699
  }
2678
- function assertIdentifier(value, pattern) {
2679
- if (!pattern.test(value)) invalid();
2700
+ //#endregion
2701
+ //#region ../../packages/shared/src/serverSettings.ts
2702
+ const ServerSettingsJson$1 = fromLenientJson(ServerSettings);
2703
+ function normalizePersistedServerSettingString(value) {
2704
+ const trimmed = value?.trim();
2705
+ return trimmed && trimmed.length > 0 ? trimmed : void 0;
2680
2706
  }
2681
- function copyBytes(value, expectedLengths) {
2682
- if (!(value instanceof Uint8Array) || !expectedLengths.includes(value.byteLength)) invalid();
2683
- return Uint8Array.from(value);
2707
+ function extractPersistedServerObservabilitySettings(input) {
2708
+ return {
2709
+ otlpTracesUrl: normalizePersistedServerSettingString(input.observability?.otlpTracesUrl),
2710
+ otlpMetricsUrl: normalizePersistedServerSettingString(input.observability?.otlpMetricsUrl)
2711
+ };
2684
2712
  }
2685
- function canonicalizeHubOrigin(value) {
2686
- if (typeof value !== "string" || value.length === 0 || value.length > 512) invalid();
2687
- let url;
2713
+ function parsePersistedServerObservabilitySettings(raw) {
2688
2714
  try {
2689
- url = new URL(value);
2715
+ return extractPersistedServerObservabilitySettings(Schema.decodeUnknownSync(ServerSettingsJson$1)(raw));
2690
2716
  } catch {
2691
- return invalid();
2692
- }
2693
- const isLoopbackHttp = url.protocol === "http:" && LOOPBACK_HOSTS.has(url.hostname);
2694
- if (url.protocol !== "https:" && !isLoopbackHttp || url.username !== "" || url.password !== "" || url.pathname !== "/" || url.search !== "" || url.hash !== "" || value !== url.origin) invalid();
2695
- return url.origin;
2696
- }
2697
- function normalizeHubNodeName(value) {
2698
- if (typeof value !== "string") invalid();
2699
- const normalized = value.trim();
2700
- if (normalized.length === 0 || normalized.length > 100) invalid();
2701
- return normalized;
2702
- }
2703
- function validateNodePublicKey(descriptor) {
2704
- if (descriptor.algorithm === "ed25519") return {
2705
- algorithm: descriptor.algorithm,
2706
- publicKey: copyBytes(descriptor.publicKey, [32])
2707
- };
2708
- if (descriptor.algorithm === "p256") {
2709
- const publicKey = copyBytes(descriptor.publicKey, [33, 65]);
2710
- const prefix = publicKey[0];
2711
- if (publicKey.byteLength === 33 && prefix !== 2 && prefix !== 3 || publicKey.byteLength === 65 && prefix !== 4) invalid();
2712
2717
  return {
2713
- algorithm: descriptor.algorithm,
2714
- publicKey
2718
+ otlpTracesUrl: void 0,
2719
+ otlpMetricsUrl: void 0
2715
2720
  };
2716
2721
  }
2717
- return invalid();
2718
- }
2719
- function fingerprintNodePublicKey(descriptor) {
2720
- const key = validateNodePublicKey(descriptor);
2721
- const canonical = encode([
2722
- NODE_KEY_FINGERPRINT_DOMAIN,
2723
- key.algorithm,
2724
- key.publicKey
2725
- ], rfc8949EncodeOptions);
2726
- return Uint8Array.from(createHash("sha256").update(canonical).digest());
2727
- }
2728
- function formatNodePublicKeyFingerprint(fingerprint) {
2729
- const bytes = copyBytes(fingerprint, [32]);
2730
- return `SHA256:${Buffer.from(bytes).toString("base64url")}`;
2731
- }
2732
- function encodeNodeAuthenticationTranscript(input) {
2733
- const hubOrigin = canonicalizeHubOrigin(input.hubOrigin);
2734
- assertProtocolVersion(input.protocolMajor);
2735
- assertProtocolVersion(input.protocolMinor);
2736
- assertIdentifier(input.nodeId, NODE_ID);
2737
- assertIdentifier(input.activeKeyId, NODE_KEY_ID);
2738
- assertUnsignedSafeInteger(input.challengeExpiresAt);
2739
- const challenge = copyBytes(input.challenge, [32]);
2740
- return Uint8Array.from(encode([
2741
- NODE_AUTH_TRANSCRIPT_DOMAIN,
2742
- hubOrigin,
2743
- input.protocolMajor,
2744
- input.protocolMinor,
2745
- input.nodeId,
2746
- input.activeKeyId,
2747
- input.challengeExpiresAt,
2748
- challenge
2749
- ], rfc8949EncodeOptions));
2750
2722
  }
2751
- function encodeNodeKeyRotationTranscript(input) {
2752
- const hubOrigin = canonicalizeHubOrigin(input.hubOrigin);
2753
- assertProtocolVersion(input.protocolMajor);
2754
- assertProtocolVersion(input.protocolMinor);
2755
- assertIdentifier(input.rotationRequestId, ROTATION_REQUEST_ID);
2756
- assertIdentifier(input.nodeId, NODE_ID);
2757
- assertIdentifier(input.oldActiveKeyId, NODE_KEY_ID);
2758
- assertIdentifier(input.newKeyId, NODE_KEY_ID);
2759
- assertUnsignedSafeInteger(input.challengeExpiresAt);
2760
- const newKey = validateNodePublicKey(input.newKey);
2761
- const fingerprint = fingerprintNodePublicKey(newKey);
2762
- const challenge = copyBytes(input.challenge, [32]);
2763
- return Uint8Array.from(encode([
2764
- NODE_KEY_ROTATION_TRANSCRIPT_DOMAIN,
2765
- hubOrigin,
2766
- input.protocolMajor,
2767
- input.protocolMinor,
2768
- input.rotationRequestId,
2769
- input.nodeId,
2770
- input.oldActiveKeyId,
2771
- input.newKeyId,
2772
- newKey.algorithm,
2773
- newKey.publicKey,
2774
- fingerprint,
2775
- input.challengeExpiresAt,
2776
- challenge
2777
- ], rfc8949EncodeOptions));
2723
+ function shouldReplaceTextGenerationModelSelection(patch) {
2724
+ return Boolean(patch && (patch.instanceId !== void 0 || patch.model !== void 0));
2778
2725
  }
2779
- function encodeNativeNodeClaimTranscript(input) {
2780
- const hubOrigin = canonicalizeHubOrigin(input.hubOrigin);
2781
- assertProtocolVersion(input.protocolVersion);
2782
- assertProtocolVersion(input.transcriptVersion);
2783
- assertIdentifier(input.claimId, NATIVE_NODE_CLAIM_ID);
2784
- assertIdentifier(input.accountId, ACCOUNT_ID);
2785
- assertIdentifier(input.spaceId, SPACE_ID);
2786
- assertIdentifier(input.sessionId, SESSION_ID);
2787
- const dpopKeyThumbprint = copyBytes(input.dpopKeyThumbprint, [32]);
2788
- assertIdentifier(input.installationId, DESKTOP_INSTALLATION_ID);
2789
- assertIdentifier(input.environmentId, ENVIRONMENT_ID);
2790
- const nodeKey = validateNodePublicKey(input.nodeKey);
2791
- const nodeFingerprint = fingerprintNodePublicKey(nodeKey);
2792
- assertUnsignedSafeInteger(input.claimExpiresAt);
2793
- const challenge = copyBytes(input.challenge, [32]);
2794
- return Uint8Array.from(encode([
2795
- NATIVE_NODE_CLAIM_TRANSCRIPT_DOMAIN,
2796
- hubOrigin,
2797
- input.protocolVersion,
2798
- input.transcriptVersion,
2799
- input.claimId,
2800
- input.accountId,
2801
- input.spaceId,
2802
- input.sessionId,
2803
- dpopKeyThumbprint,
2804
- input.installationId,
2805
- input.environmentId,
2806
- nodeKey.algorithm,
2807
- nodeKey.publicKey,
2808
- nodeFingerprint,
2809
- input.claimExpiresAt,
2810
- challenge
2811
- ], rfc8949EncodeOptions));
2726
+ function mergeModelSelectionOptionsById(input) {
2727
+ if (input.patch === void 0) return input.current ? [...input.current] : void 0;
2728
+ if (input.patch.length === 0) return;
2729
+ const merged = new Map((input.current ?? []).map((selection) => [selection.id, selection.value]));
2730
+ for (const selection of input.patch) merged.set(selection.id, selection.value);
2731
+ return [...merged.entries()].map(([id, value]) => ({
2732
+ id,
2733
+ value
2734
+ }));
2812
2735
  }
2813
- function equalNodeIdentityBytes(left, right) {
2814
- if (!(left instanceof Uint8Array) || !(right instanceof Uint8Array)) return false;
2815
- if (left.byteLength !== right.byteLength) return false;
2816
- return timingSafeEqual(left, right);
2736
+ /**
2737
+ * Applies a server settings patch while treating textGenerationModelSelection as
2738
+ * replace-on-provider/model updates. This prevents stale nested options from
2739
+ * surviving a reset patch that intentionally omits options.
2740
+ */
2741
+ function applyServerSettingsPatch(current, patch) {
2742
+ const selectionPatch = patch.textGenerationModelSelection;
2743
+ for (const [field, value] of Object.entries(patch.expectedNodePreferences ?? {})) if (!Equal.equals(current[field] ?? null, value)) throw new Error("Node preferences changed elsewhere. Reload before saving.");
2744
+ for (const [projectId, expected] of Object.entries(patch.expectedProjectPreferences ?? {})) {
2745
+ const currentPreferences = current.projectPreferences[projectId] ?? {};
2746
+ for (const [field, value] of Object.entries(expected)) {
2747
+ const actual = field === "initialModelSelection" && !Object.hasOwn(currentPreferences, field) ? "absent" : currentPreferences[field] ?? null;
2748
+ if (!Equal.equals(actual, value)) throw new Error("Project preferences changed elsewhere. Reload before saving.");
2749
+ }
2750
+ }
2751
+ const { expectedProjectPreferences: _expected, expectedNodePreferences: _expectedNode, projectPreferences: _projects, ...persistedPatch } = patch;
2752
+ let next = deepMerge(current, persistedPatch);
2753
+ if (patch.initialModelSelection !== void 0) next = {
2754
+ ...next,
2755
+ initialModelSelection: patch.initialModelSelection
2756
+ };
2757
+ if (patch.projectPreferences !== void 0) {
2758
+ const projects = new Map(Object.entries(current.projectPreferences));
2759
+ for (const [projectId, preferencesPatch] of Object.entries(patch.projectPreferences)) {
2760
+ if (preferencesPatch === null) {
2761
+ projects.delete(projectId);
2762
+ continue;
2763
+ }
2764
+ const preferences = { ...projects.get(projectId) };
2765
+ for (const [field, value] of Object.entries(preferencesPatch)) if (value === null && field !== "initialModelSelection") delete preferences[field];
2766
+ else Object.assign(preferences, { [field]: value });
2767
+ if (Object.keys(preferences).length) projects.set(projectId, preferences);
2768
+ else projects.delete(projectId);
2769
+ }
2770
+ next = {
2771
+ ...next,
2772
+ projectPreferences: Object.fromEntries(projects)
2773
+ };
2774
+ }
2775
+ if (patch.projectWorktreeSubmodules !== void 0) {
2776
+ const modes = new Map(Object.entries(current.projectWorktreeSubmodules));
2777
+ for (const [projectId, mode] of Object.entries(patch.projectWorktreeSubmodules)) if (mode === null) modes.delete(projectId);
2778
+ else modes.set(projectId, mode);
2779
+ next = {
2780
+ ...next,
2781
+ projectWorktreeSubmodules: Object.fromEntries(modes)
2782
+ };
2783
+ }
2784
+ if (patch.projectWorktreeRoots !== void 0) {
2785
+ const roots = new Map(Object.entries(current.projectWorktreeRoots));
2786
+ for (const [projectId, root] of Object.entries(patch.projectWorktreeRoots)) if (root === null || root === "") roots.delete(projectId);
2787
+ else roots.set(projectId, root);
2788
+ next = {
2789
+ ...next,
2790
+ projectWorktreeRoots: Object.fromEntries(roots)
2791
+ };
2792
+ }
2793
+ if (patch.projectStorageRetention !== void 0) {
2794
+ const policies = new Map(Object.entries(current.projectStorageRetention));
2795
+ for (const [projectId, policy] of Object.entries(patch.projectStorageRetention)) if (policy === null) policies.delete(projectId);
2796
+ else policies.set(projectId, policy);
2797
+ next = {
2798
+ ...next,
2799
+ projectStorageRetention: Object.fromEntries(policies)
2800
+ };
2801
+ }
2802
+ const nextWithReplacements = patch.providerInstances !== void 0 ? {
2803
+ ...next,
2804
+ providerInstances: patch.providerInstances
2805
+ } : next;
2806
+ if (!selectionPatch) return nextWithReplacements;
2807
+ const instanceId = selectionPatch.instanceId ?? current.textGenerationModelSelection.instanceId;
2808
+ const model = selectionPatch.model ?? current.textGenerationModelSelection.model;
2809
+ const options = shouldReplaceTextGenerationModelSelection(selectionPatch) ? selectionPatch.options : mergeModelSelectionOptionsById({
2810
+ current: current.textGenerationModelSelection.options,
2811
+ patch: selectionPatch.options
2812
+ });
2813
+ return {
2814
+ ...nextWithReplacements,
2815
+ textGenerationModelSelection: createModelSelection(instanceId, model, options)
2816
+ };
2817
2817
  }
2818
2818
  //#endregion
2819
2819
  //#region src/config.ts
@@ -2890,6 +2890,7 @@ function resolveHubConnectorConfig(raw) {
2890
2890
  };
2891
2891
  }
2892
2892
  const DEFAULT_NODE_E2EE_POLICY_CONFIG = {
2893
+ mode: void 0,
2893
2894
  requireE2EE: void 0,
2894
2895
  requireApprovedClientE2EE: void 0,
2895
2896
  configurationIssue: void 0
@@ -2916,10 +2917,12 @@ const parseTriStateBoolean = (value) => {
2916
2917
  function resolveNodeE2eePolicyConfig(raw) {
2917
2918
  const requireE2EE = parseTriStateBoolean(raw.requireE2EE);
2918
2919
  const requireApprovedClientE2EE = parseTriStateBoolean(raw.requireApprovedClientE2EE);
2920
+ const mode = raw.mode === void 0 ? void 0 : Schema.is(NodeE2eeAdmissionPolicy)(raw.mode) ? raw.mode : null;
2919
2921
  return {
2922
+ mode: mode ?? void 0,
2920
2923
  requireE2EE: typeof requireE2EE === "boolean" ? requireE2EE : void 0,
2921
2924
  requireApprovedClientE2EE: typeof requireApprovedClientE2EE === "boolean" ? requireApprovedClientE2EE : void 0,
2922
- configurationIssue: requireE2EE === void 0 || requireApprovedClientE2EE === void 0 ? "configuration_invalid" : void 0
2925
+ configurationIssue: requireE2EE === void 0 || requireApprovedClientE2EE === void 0 || mode === null ? "configuration_invalid" : void 0
2923
2926
  };
2924
2927
  }
2925
2928
  function resolveManagedWorktreesRoot(config) {
@@ -4414,4 +4417,4 @@ const providerTurnMetricAttributes = (input) => {
4414
4417
  });
4415
4418
  };
4416
4419
  //#endregion
4417
- export { makeWorkspaceAccessPolicy as $, getProviderOptionBooleanSelectionValue as $t, runtimeQueueBlockedDuration as A, resolveHubConnectorConfig as At, startupCommandGateQueueHighWater as B, formatNodePublicKeyFingerprint as Bt, providerStartupQueueHighWater as C, acquireStorageSettingsLease as Ct, providerTurnsTotal as D, ServerConfig as Dt, providerTurnMetricAttributes as E, RuntimeMode as Et, runtimeQueueHighWater as F, encodeNativeNodeClaimTranscript as Ft, LocalDiagnosticsMetrics as G, rfc8949EncodeOptions as Gt, terminalRestartsTotal as H, Tokeniser as Ht, runtimeQueueOverflowsTotal as I, encodeNodeAuthenticationTranscript as It, outcomeFromExit as J, applyClaudePromptEffortPrefix as Jt, LocalDiagnosticsMetricsLive as K, Type as Kt, runtimeQueueRecoveriesTotal as L, encodeNodeKeyRotationTranscript as Lt, runtimeQueueDepth as M, resolveNodeE2eePolicyConfig as Mt, runtimeQueueDequeuesTotal as N, resolveStaticDir as Nt, rpcRequestDuration as O, deriveServerPaths as Ot, runtimeQueueEnqueuesTotal as P, canonicalizeHubOrigin as Pt, WorkspaceAccessPolicyLive as Q, getModelSelectionStringOptionValue as Qt, startupCommandGateEnqueuesTotal as R, equalNodeIdentityBytes as Rt, providerStartupQueueDepth as S, mintStorageCleanupClaim as St, providerTurnDuration as T, DEFAULT_PORT as Tt, terminalSessionsTotal as U, decode as Ut, startupCommandGateQueueWaitDuration as V, normalizeHubNodeName as Vt, withMetrics as W, encode as Wt, ServerSettingsService as X, getModelDisplayLabel as Xt, ServerSettingsLive as Y, createModelCapabilities as Yt, redactServerSettingsForClient as Z, getModelSelectionBooleanOptionValue as Zt, providerRuntimeEventsTotal as _, assertCleanWorktree as _t, contextHandoffsTotal as a, resolvePromptInjectedEffort as an, expandHomePath as at, providerStaleStopTimeoutsTotal as b, removeQuarantinedTemporaryDirectory as bt, increment as c, writeFileStringAtomically as ct, orchestrationCommandAckDuration as d, canonicalStoragePath as dt, getProviderOptionCurrentValue as en, WorkspaceAccessPolicy as et, orchestrationCommandDuration as f, hasWorktreeCreationLease as ft, providerMetricAttributes as g, assertCanonicalPath as gt, providerEventLogRecordsDroppedTotal as h, storageLifecycleLock as ht, contextHandoffPreparationDuration as i, normalizeModelSlug as in, validateWorktreeRoot as it, runtimeQueueCoalescedTotal as j, resolveManagedWorktreesRoot as jt, rpcRequestsTotal as k, ensureServerDirectories as kt, metricAttributes as l, acquireStoragePathUseLease as lt, orchestrationEventsProcessedTotal as m, recordCreatedWorktree as mt, contextHandoffContextEntriesTotal as n, getProviderOptionStringSelectionValue as nn, resolveConfiguredWorktreeRoot as nt, gitCommandDuration as o, ServerSecretStoreLive as ot, orchestrationCommandsTotal as p, isStoragePathBlocked as pt, compactTraceAttributes as q, parsePersistedServerObservabilitySettings as qt, contextHandoffDispatchDuration as r, modelSelectionRequiresContextHandoff as rn, selectConfiguredWorktreeRoot as rt, gitCommandsTotal as s, ServerSecretStore as st, contextHandoffContextBytesTotal as t, getProviderOptionDescriptors as tn, canonicalizeWorktreePath as tt, metricNames as u, acquireWorktreeCreationLease as ut, providerRuntimeStaleEventsTotal as v, captureWorktreeIdentity as vt, providerStartupQueueWaitDuration as w, hasStorageSettingsUpdateLease as wt, providerStartupAdmissionTotal as x, removeVerifiedWorktree as xt, providerSessionsTotal as y, measureDirectory as yt, startupCommandGateQueueDepth as z, fingerprintNodePublicKey as zt };
4420
+ export { makeWorkspaceAccessPolicy as $, formatNodePublicKeyFingerprint as $t, runtimeQueueBlockedDuration as A, resolveHubConnectorConfig as At, startupCommandGateQueueHighWater as B, getProviderOptionBooleanSelectionValue as Bt, providerStartupQueueHighWater as C, acquireStorageSettingsLease as Ct, providerTurnsTotal as D, ServerConfig as Dt, providerTurnMetricAttributes as E, RuntimeMode as Et, runtimeQueueHighWater as F, applyClaudePromptEffortPrefix as Ft, LocalDiagnosticsMetrics as G, normalizeModelSlug as Gt, terminalRestartsTotal as H, getProviderOptionDescriptors as Ht, runtimeQueueOverflowsTotal as I, createModelCapabilities as It, outcomeFromExit as J, encodeNativeNodeClaimTranscript as Jt, LocalDiagnosticsMetricsLive as K, resolvePromptInjectedEffort as Kt, runtimeQueueRecoveriesTotal as L, getModelDisplayLabel as Lt, runtimeQueueDepth as M, resolveNodeE2eePolicyConfig as Mt, runtimeQueueDequeuesTotal as N, resolveStaticDir as Nt, rpcRequestDuration as O, deriveServerPaths as Ot, runtimeQueueEnqueuesTotal as P, parsePersistedServerObservabilitySettings as Pt, WorkspaceAccessPolicyLive as Q, fingerprintNodePublicKey as Qt, startupCommandGateEnqueuesTotal as R, getModelSelectionBooleanOptionValue as Rt, providerStartupQueueDepth as S, mintStorageCleanupClaim as St, providerTurnDuration as T, DEFAULT_PORT as Tt, terminalSessionsTotal as U, getProviderOptionStringSelectionValue as Ut, startupCommandGateQueueWaitDuration as V, getProviderOptionCurrentValue as Vt, withMetrics as W, modelSelectionRequiresContextHandoff as Wt, ServerSettingsService as X, encodeNodeKeyRotationTranscript as Xt, ServerSettingsLive as Y, encodeNodeAuthenticationTranscript as Yt, redactServerSettingsForClient as Z, equalNodeIdentityBytes as Zt, providerRuntimeEventsTotal as _, assertCleanWorktree as _t, contextHandoffsTotal as a, Type as an, expandHomePath as at, providerStaleStopTimeoutsTotal as b, removeQuarantinedTemporaryDirectory as bt, increment as c, writeFileStringAtomically as ct, orchestrationCommandAckDuration as d, canonicalStoragePath as dt, normalizeHubNodeName as en, WorkspaceAccessPolicy as et, orchestrationCommandDuration as f, hasWorktreeCreationLease as ft, providerMetricAttributes as g, assertCanonicalPath as gt, providerEventLogRecordsDroppedTotal as h, storageLifecycleLock as ht, contextHandoffPreparationDuration as i, rfc8949EncodeOptions as in, validateWorktreeRoot as it, runtimeQueueCoalescedTotal as j, resolveManagedWorktreesRoot as jt, rpcRequestsTotal as k, ensureServerDirectories as kt, metricAttributes as l, acquireStoragePathUseLease as lt, orchestrationEventsProcessedTotal as m, recordCreatedWorktree as mt, contextHandoffContextEntriesTotal as n, decode as nn, resolveConfiguredWorktreeRoot as nt, gitCommandDuration as o, ServerSecretStoreLive as ot, orchestrationCommandsTotal as p, isStoragePathBlocked as pt, compactTraceAttributes as q, canonicalizeHubOrigin as qt, contextHandoffDispatchDuration as r, encode as rn, selectConfiguredWorktreeRoot as rt, gitCommandsTotal as s, ServerSecretStore as st, contextHandoffContextBytesTotal as t, Tokeniser as tn, canonicalizeWorktreePath as tt, metricNames as u, acquireWorktreeCreationLease as ut, providerRuntimeStaleEventsTotal as v, captureWorktreeIdentity as vt, providerStartupQueueWaitDuration as w, hasStorageSettingsUpdateLease as wt, providerStartupAdmissionTotal as x, removeVerifiedWorktree as xt, providerSessionsTotal as y, measureDirectory as yt, startupCommandGateQueueDepth as z, getModelSelectionStringOptionValue as zt };