ryco-cli 0.1.29 → 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 +8564 -302
  38. package/dist/bin.mjs +8544 -265
  39. package/dist/client/assets/{AccountSettings-FN7pwqYA.js → AccountSettings-v6-r6gYl.js} +1 -1
  40. package/dist/client/assets/{AiFocusSettings-xcDAMaqH.js → AiFocusSettings-BVdLON0q.js} +1 -1
  41. package/dist/client/assets/{AnimatedHeight-BNg7wnTK.js → AnimatedHeight-UXn4-nUd.js} +1 -1
  42. package/dist/client/assets/{AppearanceSettings-BvsvAOsG.js → AppearanceSettings-DRChsQnN.js} +1 -1
  43. package/dist/client/assets/{BranchToolbar.logic-DFsXV3Qs.js → BranchToolbar.logic-YN3KjVr9.js} +1 -1
  44. package/dist/client/assets/{BrowserPanel-D-g_xDZs.js → BrowserPanel-Dxw3stFP.js} +1 -1
  45. package/dist/client/assets/{ChatRightPanel-Bm906qNi.js → ChatRightPanel-CygpcJiF.js} +5 -5
  46. package/dist/client/assets/{ChatThreadRouteView-CATwakjI.js → ChatThreadRouteView-DYLZFHu0.js} +1 -1
  47. package/dist/client/assets/{CommandPaletteDialog-Obv1bvxj.js → CommandPaletteDialog-BRvBzP1R.js} +1 -1
  48. package/dist/client/assets/{CompositeRoot-CfkIdky8.js → CompositeRoot-BeEGGWwn.js} +1 -1
  49. package/dist/client/assets/{ComputerUseSettings-ljYmTHea.js → ComputerUseSettings-Cq8Pi0ZU.js} +1 -1
  50. package/dist/client/assets/{ConnectionsSettings-CIXs7x_E.js → ConnectionsSettings-RSYtexxd.js} +2 -2
  51. package/dist/client/assets/{ContextHandoffEndpointLabel-BzI4Wi1i.js → ContextHandoffEndpointLabel-CeGDLNA4.js} +1 -1
  52. package/dist/client/assets/{DiagnosticsSettings-DGX_2T2M.js → DiagnosticsSettings-CDa6MVx4.js} +1 -1
  53. package/dist/client/assets/{DialogHandle-CTtSYpsC.js → DialogHandle-BE7egDQQ.js} +1 -1
  54. package/dist/client/assets/{DialogPopup-DdZlhHuQ.js → DialogPopup-NfwDyR5c.js} +1 -1
  55. package/dist/client/assets/DialogRoot-C4mtzigX.js +1 -0
  56. package/dist/client/assets/{DialogTitle-Du7CAbaO.js → DialogTitle-B_Q4DykI.js} +1 -1
  57. package/dist/client/assets/{DialogTrigger-VpFh8Xza.js → DialogTrigger-BSqd4Crj.js} +1 -1
  58. package/dist/client/assets/{DialogViewport-BwuqbGLY.js → DialogViewport-B6w_ROOE.js} +1 -1
  59. package/dist/client/assets/{DraftChatThreadRouteView-Cmc5HpWf.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-BlWIlQ0s.js → GlassSurface-DDG4eTlj.js} +1 -1
  62. package/dist/client/assets/{HostedConnectionControls-ySHqwr4K.js → HostedConnectionControls-CscV6hm1.js} +1 -1
  63. package/dist/client/assets/{HostedHubRoot-Caz8PElK.js → HostedHubRoot-gp7-ClBP.js} +1 -1
  64. package/dist/client/assets/{HostedNativeAuthorizationRoute-BSq_AlY2.js → HostedNativeAuthorizationRoute-j7oSlakZ.js} +1 -1
  65. package/dist/client/assets/{HostedNodeRenameDialog-ChxJdr-Z.js → HostedNodeRenameDialog-D1DSiTpx.js} +1 -1
  66. package/dist/client/assets/{HostedRelayTrustNotice-DPVrIfj_.js → HostedRelayTrustNotice-B9jp4SRh.js} +1 -1
  67. package/dist/client/assets/{IntegrationsSettingsPanel-eAq5h-D5.js → IntegrationsSettingsPanel-DH7SfWtV.js} +1 -1
  68. package/dist/client/assets/{KeybindingsSettings-D1XaEVGH.js → KeybindingsSettings-DkgYYSHS.js} +1 -1
  69. package/dist/client/assets/{LazyBrowserPanel-B6POLJh3.js → LazyBrowserPanel-D4e76vc_.js} +1 -1
  70. package/dist/client/assets/{McpServersSettings-DqLA6n5v.js → McpServersSettings-Dc1kPa-X.js} +1 -1
  71. package/dist/client/assets/{MobileSheet-CtQIYRlY.js → MobileSheet-lT--mLEz.js} +1 -1
  72. package/dist/client/assets/{NodeSecuritySettings-Skm7GQDl.js → NodeSecuritySettings-DcfSx4KT.js} +1 -1
  73. package/dist/client/assets/{NullStore-b8PhjwPZ.js → NullStore-8d2s-Re3.js} +1 -1
  74. package/dist/client/assets/{OnboardingDialog-8-fKvY5H.js → OnboardingDialog-CnLjwM6Z.js} +1 -1
  75. package/dist/client/assets/{OpinionatedPluginsSettings-BIJfJ34L.js → OpinionatedPluginsSettings-BTJyS3rN.js} +1 -1
  76. package/dist/client/assets/{PdfAttachmentPreview-CTo1AyZs.js → PdfAttachmentPreview-C8-hT8KQ.js} +1 -1
  77. package/dist/client/assets/{PhoneGetAppInterstitial-DwopOWnQ.js → PhoneGetAppInterstitial-Zh0zpBgT.js} +1 -1
  78. package/dist/client/assets/{PhoneHome-CUzxhhR4.js → PhoneHome-CIMkuDJF.js} +1 -1
  79. package/dist/client/assets/{PhoneSettingsSurface-BK2RHmYJ.js → PhoneSettingsSurface-CfZQxJNI.js} +1 -1
  80. package/dist/client/assets/{ProvidersSettingsPanel-DPxL7AsR.js → ProvidersSettingsPanel-DAVSiwE1.js} +1 -1
  81. package/dist/client/assets/{QuitShortcutFeedback-eCvP_MNj.js → QuitShortcutFeedback-Qs9XsuZ4.js} +1 -1
  82. package/dist/client/assets/{RedactedSensitiveText-DH4mWpB6.js → RedactedSensitiveText-BHGbQJwB.js} +1 -1
  83. package/dist/client/assets/{RootAppShell-DwiWD4Cy.js → RootAppShell-T056pByH.js} +2 -2
  84. package/dist/client/assets/{Separator-BiINUUQl.js → Separator-B6Esv57Y.js} +1 -1
  85. package/dist/client/assets/{SettingsDialog-CE8qy0qL.js → SettingsDialog-BERU2Qg7.js} +1 -1
  86. package/dist/client/assets/{SettingsPanels-BYknk6GO.js → SettingsPanels-De_XZOQF.js} +1 -1
  87. package/dist/client/assets/{SettingsPanels.editor-64bM0lhg.js → SettingsPanels.editor-Dkva9gX_.js} +1 -1
  88. package/dist/client/assets/{SourceControlSettings-BbveiAj3.js → SourceControlSettings-B4HS17cB.js} +1 -1
  89. package/dist/client/assets/{StatisticsPage-CAO_tCeC.js → StatisticsPage-Bj2ftFdH.js} +1 -1
  90. package/dist/client/assets/{StatisticsPanel-SNlgMv2o.js → StatisticsPanel-Dw7GBBmd.js} +1 -1
  91. package/dist/client/assets/{StatisticsSettingsLink-BpkNubL2.js → StatisticsSettingsLink-_XL3ABoI.js} +1 -1
  92. package/dist/client/assets/{ThreadTerminalDrawer-9x_kqQPy.js → ThreadTerminalDrawer-CPPzQSXN.js} +1 -1
  93. package/dist/client/assets/{ThreadWorkspacePanel-BXE17C4x.js → ThreadWorkspacePanel-DWKU7Omm.js} +1 -1
  94. package/dist/client/assets/{abnfDiagram-N423BO3Z-DAmGykdr.js → abnfDiagram-N423BO3Z-ByEe3mC0.js} +1 -1
  95. package/dist/client/assets/{activity-DRZlu-MC.js → activity-CwTUF6lv.js} +1 -1
  96. package/dist/client/assets/{alert-CwrDisFU.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-DypU2ERW.js → architectureDiagram-T3A2C74G-Bd-yxaTr.js} +1 -1
  100. package/dist/client/assets/{arrow-left-XhcJWpRy.js → arrow-left-DUOpzEbP.js} +1 -1
  101. package/dist/client/assets/{arrow-right-BBs6iTUL.js → arrow-right-HOYJnPKw.js} +1 -1
  102. package/dist/client/assets/{arrow-up-right-CJ9Vq7nK.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-BswOCwph.js → badge-2AZ3HfVS.js} +1 -1
  105. package/dist/client/assets/{blockDiagram-VBNYF7ZC-B9MhR9hY.js → blockDiagram-VBNYF7ZC-CPDBonMC.js} +1 -1
  106. package/dist/client/assets/{bot-D5wgL7pu.js → bot-DxjPA7Bw.js} +1 -1
  107. package/dist/client/assets/{c4Diagram-5PPSVZJV-C22FWSoE.js → c4Diagram-5PPSVZJV-BM6pAiqT.js} +1 -1
  108. package/dist/client/assets/{capabilities-Bj_X9FZ-.js → capabilities-CsHjxjab.js} +1 -1
  109. package/dist/client/assets/channel-Dn3_cOkm.js +1 -0
  110. package/dist/client/assets/{chart-column-D6Lnkklk.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-D1tZuCzA.js → chunk-2GRJ4B5K-DVKozJ41.js} +1 -1
  113. package/dist/client/assets/{chunk-4I5QYGJK-Clf86zK0.js → chunk-4I5QYGJK-BRoMwPkW.js} +1 -1
  114. package/dist/client/assets/{chunk-5RXB4S5H-B36N5RYZ.js → chunk-5RXB4S5H-DFMKyoqP.js} +1 -1
  115. package/dist/client/assets/{chunk-6Q2QTUOP-IAxdzsQJ.js → chunk-6Q2QTUOP-Ba6UENe9.js} +1 -1
  116. package/dist/client/assets/{chunk-7Z6QIM7H-Ctqebv_4.js → chunk-7Z6QIM7H-B87gYLWH.js} +1 -1
  117. package/dist/client/assets/{chunk-GF5L2VYU-CAfciJae.js → chunk-GF5L2VYU-DZ840GRQ.js} +1 -1
  118. package/dist/client/assets/{chunk-I66GZJ75-BZ7XtZf4.js → chunk-I66GZJ75-BO6p4Aqg.js} +1 -1
  119. package/dist/client/assets/{chunk-JQJVKLGR-DVuZCWnv.js → chunk-JQJVKLGR-5dTfVinz.js} +1 -1
  120. package/dist/client/assets/{chunk-KBJHAD2P-DtWbzsRm.js → chunk-KBJHAD2P-BeWfBZdP.js} +1 -1
  121. package/dist/client/assets/{chunk-NSK5VX7P-BVMz_Hc4.js → chunk-NSK5VX7P-DuRkdn5k.js} +1 -1
  122. package/dist/client/assets/{chunk-QR6OTTB3-DWitTCy-.js → chunk-QR6OTTB3-Duz4Y_uE.js} +1 -1
  123. package/dist/client/assets/{chunk-UBXNYLIW-BuxXXP2s.js → chunk-UBXNYLIW-D-z8URgN.js} +1 -1
  124. package/dist/client/assets/{chunk-W5SLKNZC-Bnf3sQl4.js → chunk-W5SLKNZC-AGjFjjoJ.js} +1 -1
  125. package/dist/client/assets/{chunk-WRU74C26-xu-KDOon.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-oDSkUUg4.js → clipboard-copy-BWf3JuTE.js} +1 -1
  129. package/dist/client/assets/{cynefin-OW5HDTMX-DGNyiNSf.js → cynefin-OW5HDTMX-BuOAGqlK.js} +1 -1
  130. package/dist/client/assets/{cynefinDiagram-MW4NZA55-_ctibv4i.js → cynefinDiagram-MW4NZA55-DqV0Aokp.js} +1 -1
  131. package/dist/client/assets/{dagre-VZM6K2ZE-Bo-bS1Y0.js → dagre-VZM6K2ZE-D_GFquDW.js} +1 -1
  132. package/dist/client/assets/{data-list-DLsM39Hp.js → data-list-BJCq3CVP.js} +1 -1
  133. package/dist/client/assets/{desktopWorkspace-Ocqt625W.js → desktopWorkspace-_iM6B9Kf.js} +1 -1
  134. package/dist/client/assets/{deviceName-z0ZWSq0z.js → deviceName-C2N8ZRX3.js} +1 -1
  135. package/dist/client/assets/{diagram-7IWD3JNH-DSjtw1SY.js → diagram-7IWD3JNH-B1wlsNg2.js} +1 -1
  136. package/dist/client/assets/{diagram-B4RE2ZJO-B7fWEvIa.js → diagram-B4RE2ZJO-D-CYoym7.js} +1 -1
  137. package/dist/client/assets/{diagram-LBJQPF4R-trRYCE5d.js → diagram-LBJQPF4R-DqJ9NCqt.js} +1 -1
  138. package/dist/client/assets/{diagram-Q27KOJAE-_DYcRggk.js → diagram-Q27KOJAE-3yp1D2u4.js} +1 -1
  139. package/dist/client/assets/{diagram-UB23O5K3-BkMzOHX8.js → diagram-UB23O5K3-Byp25nGC.js} +1 -1
  140. package/dist/client/assets/{download-CHdS3R_v.js → download-DsYNYJeu.js} +1 -1
  141. package/dist/client/assets/{ebnfDiagram-BXEA7PRR-DubiOMCG.js → ebnfDiagram-BXEA7PRR-B_IM1l6o.js} +1 -1
  142. package/dist/client/assets/{editorPreferences-DVhg0CXd.js → editorPreferences-D8q1ItMW.js} +1 -1
  143. package/dist/client/assets/{empty-BlBl_Vvw.js → empty-BbJHvskr.js} +1 -1
  144. package/dist/client/assets/{erDiagram-JOGREHBK-CFDiNfSJ.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-DT2XhE-m.js → ganttDiagram-PKOTCBZU-w0seBi3Q.js} +1 -1
  148. package/dist/client/assets/{gitGraph-4MIJSDKK-BI5UGiqb.js → gitGraph-4MIJSDKK-BOJ0lcSW.js} +1 -1
  149. package/dist/client/assets/{gitGraphDiagram-DS77QQ5N-CzAB97Rd.js → gitGraphDiagram-DS77QQ5N-BMfOCCYn.js} +1 -1
  150. package/dist/client/assets/{group-DZJuSiJL.js → group-tVMKGp7Q.js} +1 -1
  151. package/dist/client/assets/{hostedConnectionCoordinator-BztHfGNt.js → hostedConnectionCoordinator-BuRWCvUG.js} +1 -1
  152. package/dist/client/assets/hostedPairing-5n5srRC9.js +1 -0
  153. package/dist/client/assets/{hubRoutes-DExWSvVE.js → hubRoutes-jcMPIFy3.js} +1 -1
  154. package/dist/client/assets/{index-BAJdq3TK.js → index-BqZvnGNr.js} +1 -1
  155. package/dist/client/assets/{info-A6RAGUB7-DdGYYgLX.js → info-A6RAGUB7-acjBTQ5o.js} +1 -1
  156. package/dist/client/assets/{infoDiagram-6WML65LV-zhUpER6a.js → infoDiagram-6WML65LV-DB01Nc2m.js} +1 -1
  157. package/dist/client/assets/{input-CzU08wbL.js → input-BDWSVClC.js} +1 -1
  158. package/dist/client/assets/{ishikawaDiagram-WSZJBQD7-BQLkqykE.js → ishikawaDiagram-WSZJBQD7-KhZTvm-J.js} +1 -1
  159. package/dist/client/assets/{journeyDiagram-NVQOT4AX-DBgsbKOF.js → journeyDiagram-NVQOT4AX-C3JCYk-2.js} +1 -1
  160. package/dist/client/assets/{kanban-definition-27J2QSJJ-DF-Rr-xs.js → kanban-definition-27J2QSJJ-Dbo0C1s6.js} +1 -1
  161. package/dist/client/assets/{kbd-DKuvGqFP.js → kbd-Dxm5Elqj.js} +1 -1
  162. package/dist/client/assets/{key-round-CvyrSjb2.js → key-round-CETZqe3h.js} +1 -1
  163. package/dist/client/assets/{layers-CwP65mnC.js → layers-Dqez1Uq8.js} +1 -1
  164. package/dist/client/assets/{log-out-D3rICSt5.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-RFllWEko.js → main-DAbEANjY.js} +2 -2
  167. package/dist/client/assets/{mermaid-parser.core-BiGKtilP.js → mermaid-parser.core-B6Q-3x_q.js} +2 -2
  168. package/dist/client/assets/{mermaidEngine-Cjfgf3Bg.js → mermaidEngine-DksLcesB.js} +3 -3
  169. package/dist/client/assets/{mindmap-definition-FAOFIHXS-SiU9JwWJ.js → mindmap-definition-FAOFIHXS-LaMzRxqw.js} +1 -1
  170. package/dist/client/assets/{motion-C9rN_t9p.js → motion-BdscFixQ.js} +1 -1
  171. package/dist/client/assets/{packet-AYTQ26CC-F-HuW5Dr.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-gaqgtube.js → palette-92ylWqeC.js} +1 -1
  174. package/dist/client/assets/{pegDiagram-VL7TDLO6-cC-QUd7I.js → pegDiagram-VL7TDLO6-s7l7UD9d.js} +1 -1
  175. package/dist/client/assets/{pie-WAS4IAKB-BI3XUcLN.js → pie-WAS4IAKB-DygX31Z9.js} +1 -1
  176. package/dist/client/assets/{pieDiagram-7S7Q4E2Y-BP4gJ4ZK.js → pieDiagram-7S7Q4E2Y-bb6I9TtZ.js} +1 -1
  177. package/dist/client/assets/{play-BJZrOx6T.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-LJ2vJxm-.js → providerDriverMeta-T2YbXzuS.js} +1 -1
  180. package/dist/client/assets/{qr-code-Cmfz5JKf.js → qr-code-D4CtBq2F.js} +1 -1
  181. package/dist/client/assets/{qr-code-BFO8lV1M.js → qr-code-dbkTo07n.js} +1 -1
  182. package/dist/client/assets/{quadrantDiagram-CIZ2JOQS-DO-N1m-q.js → quadrantDiagram-CIZ2JOQS-Cj1Y68ZF.js} +1 -1
  183. package/dist/client/assets/{radar-RG4KPBEZ-CfayXQ5F.js → radar-RG4KPBEZ-FHM3ftPp.js} +1 -1
  184. package/dist/client/assets/{radio-group-BueX1AVO.js → radio-group-CRnHYWa8.js} +1 -1
  185. package/dist/client/assets/{railroad-74A4TZTK-CT6f-etT.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-DC8egbob.js → railroadDiagram-AXF67PYL-DyV3SuDj.js} +1 -1
  190. package/dist/client/assets/{refresh-cw-K_hU8_ld.js → refresh-cw-CgDa2Ok_.js} +1 -1
  191. package/dist/client/assets/{requirementDiagram-LRYGKXZP-DJMzcLk_.js → requirementDiagram-LRYGKXZP-_xEAGWaH.js} +1 -1
  192. package/dist/client/assets/runtime-BwHA1GUS.js +18 -0
  193. package/dist/client/assets/{sankeyDiagram-W5VNT64P-YR6aIYLj.js → sankeyDiagram-W5VNT64P-Clf6oTLi.js} +1 -1
  194. package/dist/client/assets/{save-Mh-PA_2P.js → save-C8h0AMdl.js} +1 -1
  195. package/dist/client/assets/{scroll-area-BC-LB_zE.js → scroll-area-7n2X_RLQ.js} +1 -1
  196. package/dist/client/assets/{scrollEdges-Zcpuz3un.js → scrollEdges-BXYnwntN.js} +1 -1
  197. package/dist/client/assets/{separator-yx1r9ZDw.js → separator-CL1qjMqJ.js} +1 -1
  198. package/dist/client/assets/{sequenceDiagram-SI44F4Z6-BVeSqWDA.js → sequenceDiagram-SI44F4Z6-CcYtQLSe.js} +1 -1
  199. package/dist/client/assets/{settingsLayout-BbjDM-p0.js → settingsLayout-DxsFwhF0.js} +1 -1
  200. package/dist/client/assets/{sheet-CpEwjOWn.js → sheet-CGiaw8-i.js} +1 -1
  201. package/dist/client/assets/{shield-i098Bm_B.js → shield-DPC4oHTi.js} +1 -1
  202. package/dist/client/assets/{shield-alert-CXmR7fM9.js → shield-alert-CwH36qZb.js} +1 -1
  203. package/dist/client/assets/{shield-check-CdFhWT_o.js → shield-check-CGD7sEeF.js} +1 -1
  204. package/dist/client/assets/{sidebar-DayQTDZp.js → sidebar-Cc6ANbOP.js} +1 -1
  205. package/dist/client/assets/{sidebarProjectFolders-DXqx3OlZ.js → sidebarProjectFolders-DO2Uv84F.js} +1 -1
  206. package/dist/client/assets/{sidebarStatusText-kdA6QMZS.js → sidebarStatusText-B4AtFXZo.js} +1 -1
  207. package/dist/client/assets/{sidebarUndo-BHFfJj0k.js → sidebarUndo-gdSrfa4O.js} +1 -1
  208. package/dist/client/assets/{skeleton-BwFgUtuE.js → skeleton-rS3IgBob.js} +1 -1
  209. package/dist/client/assets/{smartphone-DGfizz51.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-J3x3fktG.js → star-Cqay-Cae.js} +1 -1
  213. package/dist/client/assets/{stateDiagram-OKZ733FA-DoIZN669.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-BoFLigyK.js → swimlanes-SLNWSIFB-DrR6sbi6.js} +1 -1
  217. package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-DuaPce9O.js +8 -0
  218. package/dist/client/assets/{switch-D9inWKdd.js → switch-DnpJB2xv.js} +1 -1
  219. package/dist/client/assets/{timeline-definition-Z64GVDOM-D65EmNWc.js → timeline-definition-Z64GVDOM-bQJvmJx5.js} +1 -1
  220. package/dist/client/assets/{toggle-wMq3LLn1.js → toggle-D10FsFoE.js} +1 -1
  221. package/dist/client/assets/{toggle-group-YNqzWsK0.js → toggle-group-BhzbQPEQ.js} +1 -1
  222. package/dist/client/assets/{tokenModePresentation-C0-NgmX5.js → tokenModePresentation-BkS-mry_.js} +1 -1
  223. package/dist/client/assets/{tooltip-mwOCSCXF.js → tooltip-BlweKBxc.js} +1 -1
  224. package/dist/client/assets/{treeView-Q6P3EWNA-C2S-OPgI.js → treeView-Q6P3EWNA-D4Ex5QTp.js} +1 -1
  225. package/dist/client/assets/{treemap-WGGIJYW6-6Ovsu9iH.js → treemap-WGGIJYW6-C4B6Y6qM.js} +1 -1
  226. package/dist/client/assets/{unplug-BEfcl9Ht.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-C8bc9a0F.js → useLabelableId-DQbY2GG1.js} +1 -1
  231. package/dist/client/assets/{useNavigate-01O5dMQe.js → useNavigate-B8oXtF30.js} +1 -1
  232. package/dist/client/assets/{usePhoneThreadActions-BIdh81kF.js → usePhoneThreadActions-6DCLiyJ5.js} +1 -1
  233. package/dist/client/assets/{usePopupViewport-DYYZwfTW.js → usePopupViewport-CNWcP7Od.js} +1 -1
  234. package/dist/client/assets/{useScrollLock-BO185DkJ.js → useScrollLock-BbKeKZdj.js} +1 -1
  235. package/dist/client/assets/{useStatistics-D55-xLMz.js → useStatistics-B76_r68I.js} +1 -1
  236. package/dist/client/assets/{useTriggerFocusGuards-CMLVr18J.js → useTriggerFocusGuards-BC4Wb3GI.js} +1 -1
  237. package/dist/client/assets/{useValueChanged-DSyRHPje.js → useValueChanged-BkTbyZdO.js} +1 -1
  238. package/dist/client/assets/{user-round-C-U7TZKG.js → user-round-CLy1Qy1Y.js} +1 -1
  239. package/dist/client/assets/{vennDiagram-T6HMQDX7-fZAexcYr.js → vennDiagram-T6HMQDX7-8iiroXim.js} +1 -1
  240. package/dist/client/assets/{vscode-icons-BYX6fBsM.js → vscode-icons-CJBVQtq5.js} +1 -1
  241. package/dist/client/assets/{wardley-WFR3VGLG-gdYWSMxK.js → wardley-WFR3VGLG-DpyNUbTc.js} +1 -1
  242. package/dist/client/assets/{wardleyDiagram-T6FBY63Y-iDJxQb70.js → wardleyDiagram-T6FBY63Y-CI7is3QO.js} +1 -1
  243. package/dist/client/assets/{workspaceMetadataProjection-So9-wSEZ.js → workspaceMetadataProjection-aqZEXDrQ.js} +1 -1
  244. package/dist/client/assets/{wrench-D79uBUSl.js → wrench-7pbbxqrZ.js} +1 -1
  245. package/dist/client/assets/{xychartDiagram-ELKLHX3M-B4cfMwpJ.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-k2_0SNKA.js +0 -1
  261. package/dist/client/assets/architecture-7GRP2DOG-CQNNG5gU.js +0 -1
  262. package/dist/client/assets/channel-BtX-w3CK.js +0 -1
  263. package/dist/client/assets/chevron-right-Ddq5gL-L.js +0 -1
  264. package/dist/client/assets/classDiagram-JCYQIIEL-BgDa3HFl.js +0 -1
  265. package/dist/client/assets/classDiagram-v2-OCEON4UE-BgDa3HFl.js +0 -1
  266. package/dist/client/assets/eventmodeling-NTZA5JFV-DpzGHjmu.js +0 -1
  267. package/dist/client/assets/flowDiagram-UKHOOZJN-CaDVMm72.js +0 -1
  268. package/dist/client/assets/hostedPairing-CqhLPQqG.js +0 -1
  269. package/dist/client/assets/railroad-abnf-HS5TGJTU-B890iayj.js +0 -1
  270. package/dist/client/assets/railroad-ebnf-LZEXJU2U-C079Tzw6.js +0 -1
  271. package/dist/client/assets/railroad-peg-WCYAUIDC-DxvOX5Rh.js +0 -1
  272. package/dist/client/assets/runtime-OM-uAtaj.js +0 -18
  273. package/dist/client/assets/square-Cd2WS1gv.js +0 -1
  274. package/dist/client/assets/stateDiagram-v2-UEYNNEHI-BnzsGHaN.js +0 -1
  275. package/dist/client/assets/storeSelectors-D60AAN01.js +0 -1
  276. package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-BnA-oDvU.js +0 -8
  277. package/dist/client/assets/useAppSidebarCollapsed-C0jpPtER.js +0 -1
  278. package/dist/client/assets/useBaseUiId-Bz8dcyjd.js +0 -1
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const require_rolldown_runtime = require("./rolldown-runtime-LGfotAqq.cjs");
4
- const require_src = require("./src-BzVJd3Me.cjs");
3
+ const require_rolldown_runtime = require("./rolldown-runtime-HbSU0i7K.cjs");
4
+ const require_src = require("./src-CARHuYkT.cjs");
5
5
  const require_schemaJson = require("./schemaJson-CuhFxa8p.cjs");
6
6
  const require_processRunner = require("./processRunner-BP9l9eOt.cjs");
7
7
  let effect = require("effect");
8
- let effect_Predicate = require("effect/Predicate");
9
- effect_Predicate = require_rolldown_runtime.__toESM(effect_Predicate, 1);
10
8
  let node_path = require("node:path");
11
9
  node_path = require_rolldown_runtime.__toESM(node_path, 1);
12
10
  let node_crypto = require("node:crypto");
13
11
  node_crypto = require_rolldown_runtime.__toESM(node_crypto, 1);
12
+ let effect_Predicate = require("effect/Predicate");
13
+ effect_Predicate = require_rolldown_runtime.__toESM(effect_Predicate, 1);
14
14
  let node_fs = require("node:fs");
15
15
  let node_os = require("node:os");
16
16
  let node_fs_promises = require("node:fs/promises");
@@ -19,763 +19,628 @@ let effect_Semaphore = require("effect/Semaphore");
19
19
  effect_Semaphore = require_rolldown_runtime.__toESM(effect_Semaphore, 1);
20
20
  require("effect/PlatformError");
21
21
  let effect_Function = require("effect/Function");
22
- //#region ../../packages/shared/src/Struct.ts
23
- function deepMerge(current, patch) {
24
- if (!effect_Predicate.isObject(current) || !effect_Predicate.isObject(patch)) return patch;
25
- const next = { ...current };
26
- for (const [key, value] of Object.entries(patch)) {
27
- if (value === void 0) continue;
28
- const existing = next[key];
29
- next[key] = effect_Predicate.isObject(existing) && effect_Predicate.isObject(value) ? deepMerge(existing, value) : value;
30
- }
31
- return next;
32
- }
33
- //#endregion
34
- //#region ../../packages/shared/src/model.ts
35
- const DEFAULT_PROVIDER_DRIVER_KIND = require_src.ProviderDriverKind.make("codex");
22
+ //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/is.js
23
+ const objectTypeNames = [
24
+ "Object",
25
+ "RegExp",
26
+ "Date",
27
+ "Error",
28
+ "Map",
29
+ "Set",
30
+ "WeakMap",
31
+ "WeakSet",
32
+ "ArrayBuffer",
33
+ "SharedArrayBuffer",
34
+ "DataView",
35
+ "Promise",
36
+ "URL",
37
+ "HTMLElement",
38
+ "Int8Array",
39
+ "Uint8ClampedArray",
40
+ "Int16Array",
41
+ "Uint16Array",
42
+ "Int32Array",
43
+ "Uint32Array",
44
+ "Float32Array",
45
+ "Float64Array",
46
+ "BigInt64Array",
47
+ "BigUint64Array",
48
+ "Tagged"
49
+ ];
36
50
  /**
37
- * Resolve the human-readable model title used by picker surfaces and durable
38
- * handoff presentation. Provider catalogs are authoritative when they carry a
39
- * friendly name; the routing slug remains the deterministic final fallback.
51
+ * @param {any} value
52
+ * @returns {string}
40
53
  */
41
- function getModelDisplayName(model, options) {
42
- const shortName = trimOrNull(model.shortName);
43
- const name = trimOrNull(model.name);
44
- const slug = trimOrNull(model.slug) ?? model.slug;
45
- return options?.preferShortName ? shortName ?? name ?? slug : name ?? shortName ?? slug;
46
- }
47
- /** Compose the optional sub-provider prefix exactly as the picker trigger does. */
48
- function getModelDisplayLabel(model, options) {
49
- const title = getModelDisplayName(model, options);
50
- const subProvider = trimOrNull(model.subProvider);
51
- return subProvider ? `${subProvider} · ${title}` : title;
52
- }
53
- function createModelCapabilities(input) {
54
- return { optionDescriptors: input.optionDescriptors.map(cloneDescriptor) };
55
- }
56
- function getRawSelectionValueById(selections, id) {
57
- return (selections?.find((candidate) => candidate.id === id))?.value;
58
- }
59
- function getProviderOptionSelectionValue(selections, id) {
60
- return getRawSelectionValueById(selections, id);
61
- }
62
- function getProviderOptionStringSelectionValue(selections, id) {
63
- const value = getProviderOptionSelectionValue(selections, id);
64
- return typeof value === "string" ? value : void 0;
65
- }
66
- function getProviderOptionBooleanSelectionValue(selections, id) {
67
- const value = getProviderOptionSelectionValue(selections, id);
68
- return typeof value === "boolean" ? value : void 0;
69
- }
70
- function getModelSelectionStringOptionValue(modelSelection, id) {
71
- return getProviderOptionStringSelectionValue(modelSelection?.options, id);
72
- }
73
- function getModelSelectionBooleanOptionValue(modelSelection, id) {
74
- return getProviderOptionBooleanSelectionValue(modelSelection?.options, id);
75
- }
76
- function resolveDescriptorChoiceValue(descriptor, raw) {
77
- const trimmed = trimOrNull(raw);
78
- if (!trimmed) return descriptor.currentValue ?? descriptor.options.find((option) => option.isDefault)?.id;
79
- if (descriptor.options.length === 0) return trimmed;
80
- if (descriptor.promptInjectedValues?.includes(trimmed) && descriptor.options.some((option) => option.id === trimmed)) return descriptor.options.find((option) => option.isDefault)?.id;
81
- if (descriptor.options.some((option) => option.id === trimmed)) return trimmed;
82
- return descriptor.currentValue ?? descriptor.options.find((option) => option.isDefault)?.id;
83
- }
84
- function cloneDescriptor(descriptor) {
85
- return descriptor.type === "select" ? {
86
- ...descriptor,
87
- options: [...descriptor.options],
88
- ...descriptor.promptInjectedValues ? { promptInjectedValues: [...descriptor.promptInjectedValues] } : {}
89
- } : { ...descriptor };
54
+ function is(value) {
55
+ if (value === null) return "null";
56
+ if (value === void 0) return "undefined";
57
+ if (value === true || value === false) return "boolean";
58
+ const typeOf = typeof value;
59
+ if (typeOf === "string" || typeOf === "number" || typeOf === "bigint" || typeOf === "symbol") return typeOf;
60
+ if (typeOf === "function") return "Function";
61
+ if (Array.isArray(value)) return "Array";
62
+ if (value instanceof Uint8Array) return "Uint8Array";
63
+ if (value.constructor === Object) return "Object";
64
+ const objectType = getObjectType(value);
65
+ if (objectType) return objectType;
66
+ return "Object";
90
67
  }
91
- function cloneSelection(selection) {
92
- return { ...selection };
68
+ /**
69
+ * @param {any} value
70
+ * @returns {string|undefined}
71
+ */
72
+ function getObjectType(value) {
73
+ const objectTypeName = Object.prototype.toString.call(value).slice(8, -1);
74
+ if (objectTypeNames.includes(objectTypeName)) return objectTypeName;
93
75
  }
94
- function withDescriptorCurrentValue(descriptor, rawCurrentValue) {
95
- if (descriptor.type === "boolean") {
96
- if (typeof rawCurrentValue === "boolean") return {
97
- ...descriptor,
98
- currentValue: rawCurrentValue
99
- };
100
- return descriptor;
76
+ //#endregion
77
+ //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/token.js
78
+ var Type = class {
79
+ /**
80
+ * @param {number} major
81
+ * @param {string} name
82
+ * @param {boolean} terminal
83
+ */
84
+ constructor(major, name, terminal) {
85
+ this.major = major;
86
+ this.majorEncoded = major << 5;
87
+ this.name = name;
88
+ this.terminal = terminal;
101
89
  }
102
- const currentValue = typeof rawCurrentValue === "string" ? resolveDescriptorChoiceValue(descriptor, rawCurrentValue) : resolveDescriptorChoiceValue(descriptor, descriptor.currentValue);
103
- if (!currentValue) {
104
- const { currentValue: _unusedCurrentValue, ...rest } = descriptor;
105
- return rest;
90
+ toString() {
91
+ return `Type[${this.major}].${this.name}`;
106
92
  }
107
- return {
108
- ...descriptor,
109
- currentValue
110
- };
111
- }
112
- function getProviderOptionDescriptors(input) {
113
- const { caps, selections } = input;
114
- return (caps.optionDescriptors ?? []).map(cloneDescriptor).map((descriptor) => withDescriptorCurrentValue(descriptor, getRawSelectionValueById(selections, descriptor.id) ?? descriptor.currentValue));
115
- }
116
- function getProviderOptionCurrentValue(descriptor) {
117
- if (!descriptor) return;
118
- if (descriptor.type === "boolean") return descriptor.currentValue;
119
- if (descriptor.currentValue) return descriptor.currentValue;
120
- return descriptor.options.find((option) => option.isDefault)?.id;
121
- }
122
- function normalizeModelSlug(model, provider = DEFAULT_PROVIDER_DRIVER_KIND) {
123
- if (typeof model !== "string") return null;
124
- const trimmed = model.trim();
125
- if (!trimmed) return null;
126
- const aliases = require_src.MODEL_SLUG_ALIASES_BY_PROVIDER[provider] ?? {};
127
- const aliased = Object.prototype.hasOwnProperty.call(aliases, trimmed) ? aliases[trimmed] : void 0;
128
- return typeof aliased === "string" ? aliased : trimmed;
129
- }
130
- /** Trim a string, returning null for empty/missing values. */
131
- function trimOrNull(value) {
132
- if (typeof value !== "string") return null;
133
- return value.trim() || null;
134
- }
135
- function cloneSelections(selections) {
136
- return selections.map(cloneSelection);
137
- }
138
- function createModelSelection(instanceId, model, options) {
139
- const selections = options ? cloneSelections(options) : [];
140
- const base = {
141
- instanceId,
142
- model
143
- };
144
- return selections.length > 0 ? {
145
- ...base,
146
- options: selections
147
- } : base;
148
- }
93
+ /**
94
+ * @param {Type} typ
95
+ * @returns {number}
96
+ */
97
+ compare(typ) {
98
+ return this.major < typ.major ? -1 : this.major > typ.major ? 1 : 0;
99
+ }
100
+ /**
101
+ * Check equality between two Type instances. Safe to use across different
102
+ * copies of the Type class (e.g., when bundlers duplicate the module).
103
+ * (major, name) uniquely identifies a Type; terminal is implied by these.
104
+ * @param {Type} a
105
+ * @param {Type} b
106
+ * @returns {boolean}
107
+ */
108
+ static equals(a, b) {
109
+ return a === b || a.major === b.major && a.name === b.name;
110
+ }
111
+ };
112
+ Type.uint = new Type(0, "uint", true);
113
+ Type.negint = new Type(1, "negint", true);
114
+ Type.bytes = new Type(2, "bytes", true);
115
+ Type.string = new Type(3, "string", true);
116
+ Type.array = new Type(4, "array", false);
117
+ Type.map = new Type(5, "map", false);
118
+ Type.tag = new Type(6, "tag", false);
119
+ Type.float = new Type(7, "float", true);
120
+ Type.false = new Type(7, "false", true);
121
+ Type.true = new Type(7, "true", true);
122
+ Type.null = new Type(7, "null", true);
123
+ Type.undefined = new Type(7, "undefined", true);
124
+ Type.break = new Type(7, "break", true);
125
+ var Token = class {
126
+ /**
127
+ * @param {Type} type
128
+ * @param {any} [value]
129
+ * @param {number} [encodedLength]
130
+ */
131
+ constructor(type, value, encodedLength) {
132
+ this.type = type;
133
+ this.value = value;
134
+ this.encodedLength = encodedLength;
135
+ /** @type {Uint8Array|undefined} */
136
+ this.encodedBytes = void 0;
137
+ /** @type {Uint8Array|undefined} */
138
+ this.byteValue = void 0;
139
+ }
140
+ toString() {
141
+ return `Token[${this.type}].${this.value}`;
142
+ }
143
+ };
144
+ //#endregion
145
+ //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/byte-utils.js
146
+ const useBuffer = globalThis.process && !globalThis.process.browser && globalThis.Buffer && typeof globalThis.Buffer.isBuffer === "function";
147
+ const textEncoder$1 = new TextEncoder();
149
148
  /**
150
- * Context handoff is a provider-instance boundary. Model and option changes
151
- * within one configured instance remain on that provider's normal turn path.
149
+ * @typedef {import('../interface.js').ByteView} ByteView
150
+ * @typedef {import('../interface.js').AllocatedByteView} AllocatedByteView
152
151
  */
153
- function modelSelectionRequiresContextHandoff(input) {
154
- return input.canonicalSelection.instanceId !== input.targetSelection.instanceId;
155
- }
156
152
  /**
157
- * Returns the effort value if it is a prompt-injected value according to
158
- * any select descriptor in the given capabilities, or null otherwise.
159
- *
160
- * Unlike a single `find`, this checks every descriptor so that the
161
- * correct descriptor's `promptInjectedValues` list is consulted even when
162
- * multiple select descriptors exist.
153
+ * @param {Uint8Array} buf
154
+ * @returns {boolean}
163
155
  */
164
- function resolvePromptInjectedEffort(caps, rawEffort) {
165
- const trimmed = trimOrNull(rawEffort);
166
- if (!trimmed) return null;
167
- const descriptors = getProviderOptionDescriptors({ caps });
168
- for (const descriptor of descriptors) if (descriptor.type === "select" && descriptor.promptInjectedValues?.includes(trimmed)) return trimmed;
169
- return null;
170
- }
171
- function applyClaudePromptEffortPrefix(text, effort) {
172
- const trimmed = text.trim();
173
- if (!trimmed) return trimmed;
174
- if (effort !== "ultrathink") return trimmed;
175
- if (trimmed.startsWith("Ultrathink:")) return trimmed;
176
- return `Ultrathink:\n${trimmed}`;
177
- }
178
- //#endregion
179
- //#region ../../packages/shared/src/serverSettings.ts
180
- const ServerSettingsJson$1 = require_schemaJson.fromLenientJson(require_src.ServerSettings);
181
- function normalizePersistedServerSettingString(value) {
182
- const trimmed = value?.trim();
183
- return trimmed && trimmed.length > 0 ? trimmed : void 0;
156
+ function isBuffer(buf) {
157
+ return useBuffer && globalThis.Buffer.isBuffer(buf);
184
158
  }
185
- function extractPersistedServerObservabilitySettings(input) {
186
- return {
187
- otlpTracesUrl: normalizePersistedServerSettingString(input.observability?.otlpTracesUrl),
188
- otlpMetricsUrl: normalizePersistedServerSettingString(input.observability?.otlpMetricsUrl)
189
- };
159
+ /**
160
+ * @param {ByteView|number[]} buf
161
+ * @returns {ByteView}
162
+ */
163
+ function asU8A(buf) {
164
+ if (!(buf instanceof Uint8Array)) return Uint8Array.from(buf);
165
+ return isBuffer(buf) ? new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength) : buf;
190
166
  }
191
- function parsePersistedServerObservabilitySettings(raw) {
192
- try {
193
- return extractPersistedServerObservabilitySettings(effect.Schema.decodeUnknownSync(ServerSettingsJson$1)(raw));
194
- } catch {
195
- return {
196
- otlpTracesUrl: void 0,
197
- otlpMetricsUrl: void 0
198
- };
167
+ const FROM_STRING_THRESHOLD_BUFFER = 24;
168
+ const FROM_STRING_THRESHOLD_TEXTENCODER = 200;
169
+ const fromString = useBuffer ? (string) => {
170
+ return string.length >= FROM_STRING_THRESHOLD_BUFFER ? globalThis.Buffer.from(string) : utf8ToBytes(string);
171
+ } :
172
+ /**
173
+ * @param {string} string
174
+ */
175
+ (string) => {
176
+ return string.length >= FROM_STRING_THRESHOLD_TEXTENCODER ? textEncoder$1.encode(string) : utf8ToBytes(string);
177
+ };
178
+ /**
179
+ * Buffer variant not fast enough for what we need
180
+ * @param {number[]} arr
181
+ * @returns {AllocatedByteView}
182
+ */
183
+ const fromArray = (arr) => {
184
+ return Uint8Array.from(arr);
185
+ };
186
+ const slice = useBuffer ? (bytes, start, end) => {
187
+ if (isBuffer(bytes)) return new Uint8Array(bytes.subarray(start, end));
188
+ return bytes.slice(start, end);
189
+ } :
190
+ /**
191
+ * @param {Uint8Array} bytes
192
+ * @param {number} start
193
+ * @param {number} end
194
+ */
195
+ (bytes, start, end) => {
196
+ return bytes.slice(start, end);
197
+ };
198
+ const concat = useBuffer ? (chunks, length) => {
199
+ chunks = chunks.map((c) => c instanceof Uint8Array ? c : globalThis.Buffer.from(c));
200
+ return asU8A(globalThis.Buffer.concat(chunks, length));
201
+ } :
202
+ /**
203
+ * @param {ByteView[]} chunks
204
+ * @param {number} length
205
+ * @returns {AllocatedByteView}
206
+ */
207
+ (chunks, length) => {
208
+ const out = new Uint8Array(length);
209
+ let off = 0;
210
+ for (let b of chunks) {
211
+ if (off + b.length > out.length) b = b.subarray(0, out.length - off);
212
+ out.set(b, off);
213
+ off += b.length;
199
214
  }
200
- }
201
- function shouldReplaceTextGenerationModelSelection(patch) {
202
- return Boolean(patch && (patch.instanceId !== void 0 || patch.model !== void 0));
203
- }
204
- function mergeModelSelectionOptionsById(input) {
205
- if (input.patch === void 0) return input.current ? [...input.current] : void 0;
206
- if (input.patch.length === 0) return;
207
- const merged = new Map((input.current ?? []).map((selection) => [selection.id, selection.value]));
208
- for (const selection of input.patch) merged.set(selection.id, selection.value);
209
- return [...merged.entries()].map(([id, value]) => ({
210
- id,
211
- value
212
- }));
215
+ return out;
216
+ };
217
+ const alloc = useBuffer ? (size) => {
218
+ return globalThis.Buffer.allocUnsafe(size);
219
+ } :
220
+ /**
221
+ * @param {number} size
222
+ * @returns {AllocatedByteView}
223
+ */
224
+ (size) => {
225
+ return new Uint8Array(size);
226
+ };
227
+ /**
228
+ * @param {Uint8Array} b1
229
+ * @param {Uint8Array} b2
230
+ * @returns {number}
231
+ */
232
+ function compare(b1, b2) {
233
+ if (isBuffer(b1) && isBuffer(b2)) return b1.compare(b2);
234
+ for (let i = 0; i < b1.length; i++) {
235
+ if (b1[i] === b2[i]) continue;
236
+ return b1[i] < b2[i] ? -1 : 1;
237
+ }
238
+ return 0;
213
239
  }
214
240
  /**
215
- * Applies a server settings patch while treating textGenerationModelSelection as
216
- * replace-on-provider/model updates. This prevents stale nested options from
217
- * surviving a reset patch that intentionally omits options.
241
+ * @param {string} str
242
+ * @returns {number[]}
218
243
  */
219
- function applyServerSettingsPatch(current, patch) {
220
- const selectionPatch = patch.textGenerationModelSelection;
221
- for (const [field, value] of Object.entries(patch.expectedNodePreferences ?? {})) if (!effect.Equal.equals(current[field] ?? null, value)) throw new Error("Node preferences changed elsewhere. Reload before saving.");
222
- for (const [projectId, expected] of Object.entries(patch.expectedProjectPreferences ?? {})) {
223
- const currentPreferences = current.projectPreferences[projectId] ?? {};
224
- for (const [field, value] of Object.entries(expected)) {
225
- const actual = field === "initialModelSelection" && !Object.hasOwn(currentPreferences, field) ? "absent" : currentPreferences[field] ?? null;
226
- if (!effect.Equal.equals(actual, value)) throw new Error("Project preferences changed elsewhere. Reload before saving.");
244
+ function utf8ToBytes(str) {
245
+ const out = [];
246
+ let p = 0;
247
+ for (let i = 0; i < str.length; i++) {
248
+ let c = str.charCodeAt(i);
249
+ if (c < 128) out[p++] = c;
250
+ else if (c < 2048) {
251
+ out[p++] = c >> 6 | 192;
252
+ out[p++] = c & 63 | 128;
253
+ } else if ((c & 64512) === 55296 && i + 1 < str.length && (str.charCodeAt(i + 1) & 64512) === 56320) {
254
+ c = 65536 + ((c & 1023) << 10) + (str.charCodeAt(++i) & 1023);
255
+ out[p++] = c >> 18 | 240;
256
+ out[p++] = c >> 12 & 63 | 128;
257
+ out[p++] = c >> 6 & 63 | 128;
258
+ out[p++] = c & 63 | 128;
259
+ } else {
260
+ if (c >= 55296 && c <= 57343) c = 65533;
261
+ out[p++] = c >> 12 | 224;
262
+ out[p++] = c >> 6 & 63 | 128;
263
+ out[p++] = c & 63 | 128;
227
264
  }
228
265
  }
229
- const { expectedProjectPreferences: _expected, expectedNodePreferences: _expectedNode, projectPreferences: _projects, ...persistedPatch } = patch;
230
- let next = deepMerge(current, persistedPatch);
231
- if (patch.initialModelSelection !== void 0) next = {
232
- ...next,
233
- initialModelSelection: patch.initialModelSelection
234
- };
235
- if (patch.projectPreferences !== void 0) {
236
- const projects = new Map(Object.entries(current.projectPreferences));
237
- for (const [projectId, preferencesPatch] of Object.entries(patch.projectPreferences)) {
238
- if (preferencesPatch === null) {
239
- projects.delete(projectId);
240
- continue;
241
- }
242
- const preferences = { ...projects.get(projectId) };
243
- for (const [field, value] of Object.entries(preferencesPatch)) if (value === null && field !== "initialModelSelection") delete preferences[field];
244
- else Object.assign(preferences, { [field]: value });
245
- if (Object.keys(preferences).length) projects.set(projectId, preferences);
246
- else projects.delete(projectId);
266
+ return out;
267
+ }
268
+ //#endregion
269
+ //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/bl.js
270
+ /**
271
+ * Bl is a list of byte chunks, similar to https://github.com/rvagg/bl but for
272
+ * writing rather than reading.
273
+ * A Bl object accepts set() operations for individual bytes and copyTo() for
274
+ * inserting byte arrays. These write operations don't automatically increment
275
+ * the internal cursor so its "length" won't be changed. Instead, increment()
276
+ * must be called to extend its length to cover the inserted data.
277
+ * The toBytes() call will convert all internal memory to a single Uint8Array of
278
+ * the correct length, truncating any data that is stored but hasn't been
279
+ * included by an increment().
280
+ * get() can retrieve a single byte.
281
+ * All operations (except toBytes()) take an "offset" argument that will perform
282
+ * the write at the offset _from the current cursor_. For most operations this
283
+ * will be `0` to write at the current cursor position but it can be ahead of
284
+ * the current cursor. Negative offsets probably work but are untested.
285
+ */
286
+ /**
287
+ * @typedef {import('../interface.js').ByteView} ByteView
288
+ * @typedef {import('../interface.js').AllocatedByteView} AllocatedByteView
289
+ */
290
+ const defaultChunkSize = 256;
291
+ var Bl = class {
292
+ /**
293
+ * @param {number} [chunkSize]
294
+ */
295
+ constructor(chunkSize = defaultChunkSize) {
296
+ this.chunkSize = chunkSize;
297
+ /** @type {number} */
298
+ this.cursor = 0;
299
+ /** @type {number} */
300
+ this.maxCursor = -1;
301
+ /** @type {(ByteView|number[])[]} */
302
+ this.chunks = [];
303
+ /** @type {ByteView|number[]|null} */
304
+ this._initReuseChunk = null;
305
+ }
306
+ reset() {
307
+ this.cursor = 0;
308
+ this.maxCursor = -1;
309
+ if (this.chunks.length) this.chunks = [];
310
+ if (this._initReuseChunk !== null) {
311
+ this.chunks.push(this._initReuseChunk);
312
+ this.maxCursor = this._initReuseChunk.length - 1;
247
313
  }
248
- next = {
249
- ...next,
250
- projectPreferences: Object.fromEntries(projects)
251
- };
252
314
  }
253
- if (patch.projectWorktreeSubmodules !== void 0) {
254
- const modes = new Map(Object.entries(current.projectWorktreeSubmodules));
255
- for (const [projectId, mode] of Object.entries(patch.projectWorktreeSubmodules)) if (mode === null) modes.delete(projectId);
256
- else modes.set(projectId, mode);
257
- next = {
258
- ...next,
259
- projectWorktreeSubmodules: Object.fromEntries(modes)
260
- };
315
+ /**
316
+ * @param {number} byte
317
+ */
318
+ pushByte(byte) {
319
+ let topChunk = this.chunks[this.chunks.length - 1];
320
+ if (this.cursor > this.maxCursor) {
321
+ topChunk = alloc(this.chunkSize);
322
+ this.chunks.push(topChunk);
323
+ this.maxCursor += topChunk.length;
324
+ if (this._initReuseChunk === null) this._initReuseChunk = topChunk;
325
+ }
326
+ const chunkPos = topChunk.length - (this.maxCursor - this.cursor) - 1;
327
+ topChunk[chunkPos] = byte;
328
+ this.cursor++;
261
329
  }
262
- if (patch.projectWorktreeRoots !== void 0) {
263
- const roots = new Map(Object.entries(current.projectWorktreeRoots));
264
- for (const [projectId, root] of Object.entries(patch.projectWorktreeRoots)) if (root === null || root === "") roots.delete(projectId);
265
- else roots.set(projectId, root);
266
- next = {
267
- ...next,
268
- projectWorktreeRoots: Object.fromEntries(roots)
269
- };
330
+ /**
331
+ * @param {ByteView|number[]} bytes
332
+ */
333
+ push(bytes) {
334
+ let topChunk = this.chunks[this.chunks.length - 1];
335
+ if (this.cursor + bytes.length <= this.maxCursor + 1) {
336
+ const chunkPos = topChunk.length - (this.maxCursor - this.cursor) - 1;
337
+ topChunk.set(bytes, chunkPos);
338
+ } else {
339
+ if (topChunk) {
340
+ const chunkPos = topChunk.length - (this.maxCursor - this.cursor) - 1;
341
+ if (chunkPos < topChunk.length) {
342
+ this.chunks[this.chunks.length - 1] = topChunk.subarray(0, chunkPos);
343
+ this.maxCursor = this.cursor - 1;
344
+ }
345
+ }
346
+ if (bytes.length < 64 && bytes.length < this.chunkSize) {
347
+ topChunk = alloc(this.chunkSize);
348
+ this.chunks.push(topChunk);
349
+ this.maxCursor += topChunk.length;
350
+ if (this._initReuseChunk === null) this._initReuseChunk = topChunk;
351
+ topChunk.set(bytes, 0);
352
+ } else {
353
+ this.chunks.push(bytes);
354
+ this.maxCursor += bytes.length;
355
+ }
356
+ }
357
+ this.cursor += bytes.length;
270
358
  }
271
- if (patch.projectStorageRetention !== void 0) {
272
- const policies = new Map(Object.entries(current.projectStorageRetention));
273
- for (const [projectId, policy] of Object.entries(patch.projectStorageRetention)) if (policy === null) policies.delete(projectId);
274
- else policies.set(projectId, policy);
275
- next = {
276
- ...next,
277
- projectStorageRetention: Object.fromEntries(policies)
278
- };
359
+ /**
360
+ * @param {boolean} [reset]
361
+ * @returns {AllocatedByteView}
362
+ */
363
+ toBytes(reset = false) {
364
+ let byts;
365
+ if (this.chunks.length === 1) {
366
+ const chunk = this.chunks[0];
367
+ if (reset && this.cursor > chunk.length / 2) {
368
+ byts = this.cursor === chunk.length ? chunk : chunk.subarray(0, this.cursor);
369
+ this._initReuseChunk = null;
370
+ this.chunks = [];
371
+ } else byts = slice(chunk, 0, this.cursor);
372
+ } else byts = concat(this.chunks, this.cursor);
373
+ if (reset) this.reset();
374
+ return byts;
279
375
  }
280
- const nextWithReplacements = patch.providerInstances !== void 0 ? {
281
- ...next,
282
- providerInstances: patch.providerInstances
283
- } : next;
284
- if (!selectionPatch) return nextWithReplacements;
285
- const instanceId = selectionPatch.instanceId ?? current.textGenerationModelSelection.instanceId;
286
- const model = selectionPatch.model ?? current.textGenerationModelSelection.model;
287
- const options = shouldReplaceTextGenerationModelSelection(selectionPatch) ? selectionPatch.options : mergeModelSelectionOptionsById({
288
- current: current.textGenerationModelSelection.options,
289
- patch: selectionPatch.options
290
- });
291
- return {
292
- ...nextWithReplacements,
293
- textGenerationModelSelection: createModelSelection(instanceId, model, options)
294
- };
295
- }
296
- //#endregion
297
- //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/is.js
298
- const objectTypeNames = [
299
- "Object",
300
- "RegExp",
301
- "Date",
302
- "Error",
303
- "Map",
304
- "Set",
305
- "WeakMap",
306
- "WeakSet",
307
- "ArrayBuffer",
308
- "SharedArrayBuffer",
309
- "DataView",
310
- "Promise",
311
- "URL",
312
- "HTMLElement",
313
- "Int8Array",
314
- "Uint8ClampedArray",
315
- "Int16Array",
316
- "Uint16Array",
317
- "Int32Array",
318
- "Uint32Array",
319
- "Float32Array",
320
- "Float64Array",
321
- "BigInt64Array",
322
- "BigUint64Array",
323
- "Tagged"
324
- ];
325
- /**
326
- * @param {any} value
327
- * @returns {string}
328
- */
329
- function is(value) {
330
- if (value === null) return "null";
331
- if (value === void 0) return "undefined";
332
- if (value === true || value === false) return "boolean";
333
- const typeOf = typeof value;
334
- if (typeOf === "string" || typeOf === "number" || typeOf === "bigint" || typeOf === "symbol") return typeOf;
335
- if (typeOf === "function") return "Function";
336
- if (Array.isArray(value)) return "Array";
337
- if (value instanceof Uint8Array) return "Uint8Array";
338
- if (value.constructor === Object) return "Object";
339
- const objectType = getObjectType(value);
340
- if (objectType) return objectType;
341
- return "Object";
342
- }
376
+ };
343
377
  /**
344
- * @param {any} value
345
- * @returns {string|undefined}
378
+ * U8Bl is a buffer list that writes directly to a user-provided Uint8Array.
379
+ * It provides the same interface as Bl but writes to a fixed destination.
380
+ * @template {ArrayBufferLike} T
346
381
  */
347
- function getObjectType(value) {
348
- const objectTypeName = Object.prototype.toString.call(value).slice(8, -1);
349
- if (objectTypeNames.includes(objectTypeName)) return objectTypeName;
350
- }
351
- //#endregion
352
- //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/token.js
353
- var Type = class {
382
+ var U8Bl = class {
354
383
  /**
355
- * @param {number} major
356
- * @param {string} name
357
- * @param {boolean} terminal
384
+ * @param {Uint8Array<T>} dest
358
385
  */
359
- constructor(major, name, terminal) {
360
- this.major = major;
361
- this.majorEncoded = major << 5;
362
- this.name = name;
363
- this.terminal = terminal;
386
+ constructor(dest) {
387
+ this.dest = dest;
388
+ /** @type {number} */
389
+ this.cursor = 0;
390
+ /** @type {Array<Uint8Array<T>>} */
391
+ this.chunks = [dest];
364
392
  }
365
- toString() {
366
- return `Type[${this.major}].${this.name}`;
393
+ reset() {
394
+ this.cursor = 0;
367
395
  }
368
396
  /**
369
- * @param {Type} typ
370
- * @returns {number}
397
+ * @param {number} byte
371
398
  */
372
- compare(typ) {
373
- return this.major < typ.major ? -1 : this.major > typ.major ? 1 : 0;
399
+ pushByte(byte) {
400
+ if (this.cursor >= this.dest.length) throw new Error("write out of bounds, destination buffer is too small");
401
+ this.dest[this.cursor++] = byte;
374
402
  }
375
403
  /**
376
- * Check equality between two Type instances. Safe to use across different
377
- * copies of the Type class (e.g., when bundlers duplicate the module).
378
- * (major, name) uniquely identifies a Type; terminal is implied by these.
379
- * @param {Type} a
380
- * @param {Type} b
381
- * @returns {boolean}
404
+ * @param {ByteView|number[]} bytes
382
405
  */
383
- static equals(a, b) {
384
- return a === b || a.major === b.major && a.name === b.name;
406
+ push(bytes) {
407
+ if (this.cursor + bytes.length > this.dest.length) throw new Error("write out of bounds, destination buffer is too small");
408
+ this.dest.set(bytes, this.cursor);
409
+ this.cursor += bytes.length;
385
410
  }
386
- };
387
- Type.uint = new Type(0, "uint", true);
388
- Type.negint = new Type(1, "negint", true);
389
- Type.bytes = new Type(2, "bytes", true);
390
- Type.string = new Type(3, "string", true);
391
- Type.array = new Type(4, "array", false);
392
- Type.map = new Type(5, "map", false);
393
- Type.tag = new Type(6, "tag", false);
394
- Type.float = new Type(7, "float", true);
395
- Type.false = new Type(7, "false", true);
396
- Type.true = new Type(7, "true", true);
397
- Type.null = new Type(7, "null", true);
398
- Type.undefined = new Type(7, "undefined", true);
399
- Type.break = new Type(7, "break", true);
400
- var Token = class {
401
411
  /**
402
- * @param {Type} type
403
- * @param {any} [value]
404
- * @param {number} [encodedLength]
412
+ * @param {boolean} [reset]
413
+ * @returns {Uint8Array<T>}
405
414
  */
406
- constructor(type, value, encodedLength) {
407
- this.type = type;
408
- this.value = value;
409
- this.encodedLength = encodedLength;
410
- /** @type {Uint8Array|undefined} */
411
- this.encodedBytes = void 0;
412
- /** @type {Uint8Array|undefined} */
413
- this.byteValue = void 0;
414
- }
415
- toString() {
416
- return `Token[${this.type}].${this.value}`;
415
+ toBytes(reset = false) {
416
+ const byts = this.dest.subarray(0, this.cursor);
417
+ if (reset) this.reset();
418
+ return byts;
417
419
  }
418
420
  };
419
421
  //#endregion
420
- //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/byte-utils.js
421
- const useBuffer = globalThis.process && !globalThis.process.browser && globalThis.Buffer && typeof globalThis.Buffer.isBuffer === "function";
422
- const textEncoder$1 = new TextEncoder();
422
+ //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/common.js
423
+ const decodeErrPrefix = "CBOR decode error:";
424
+ const encodeErrPrefix = "CBOR encode error:";
425
+ const uintMinorPrefixBytes = [];
426
+ uintMinorPrefixBytes[23] = 1;
427
+ uintMinorPrefixBytes[24] = 2;
428
+ uintMinorPrefixBytes[25] = 3;
429
+ uintMinorPrefixBytes[26] = 5;
430
+ uintMinorPrefixBytes[27] = 9;
423
431
  /**
424
- * @typedef {import('../interface.js').ByteView} ByteView
425
- * @typedef {import('../interface.js').AllocatedByteView} AllocatedByteView
432
+ * @param {Uint8Array} data
433
+ * @param {number} pos
434
+ * @param {number} need
426
435
  */
436
+ function assertEnoughData(data, pos, need) {
437
+ if (data.length - pos < need) throw new Error(`${decodeErrPrefix} not enough data for type`);
438
+ }
439
+ //#endregion
440
+ //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/0uint.js
441
+ const uintBoundaries = [
442
+ 24,
443
+ 256,
444
+ 65536,
445
+ 4294967296,
446
+ BigInt("18446744073709551616")
447
+ ];
427
448
  /**
428
- * @param {Uint8Array} buf
429
- * @returns {boolean}
449
+ * @typedef {import('../interface.js').ByteWriter} ByteWriter
450
+ * @typedef {import('../interface.js').DecodeOptions} DecodeOptions
430
451
  */
431
- function isBuffer(buf) {
432
- return useBuffer && globalThis.Buffer.isBuffer(buf);
433
- }
434
452
  /**
435
- * @param {ByteView|number[]} buf
436
- * @returns {ByteView}
453
+ * @param {Uint8Array} data
454
+ * @param {number} offset
455
+ * @param {DecodeOptions} options
456
+ * @returns {number}
437
457
  */
438
- function asU8A(buf) {
439
- if (!(buf instanceof Uint8Array)) return Uint8Array.from(buf);
440
- return isBuffer(buf) ? new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength) : buf;
441
- }
442
- const FROM_STRING_THRESHOLD_BUFFER = 24;
443
- const FROM_STRING_THRESHOLD_TEXTENCODER = 200;
444
- const fromString = useBuffer ? (string) => {
445
- return string.length >= FROM_STRING_THRESHOLD_BUFFER ? globalThis.Buffer.from(string) : utf8ToBytes(string);
446
- } :
458
+ function readUint8(data, offset, options) {
459
+ assertEnoughData(data, offset, 1);
460
+ const value = data[offset];
461
+ if (options.strict === true && value < uintBoundaries[0]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
462
+ return value;
463
+ }
447
464
  /**
448
- * @param {string} string
465
+ * @param {Uint8Array} data
466
+ * @param {number} offset
467
+ * @param {DecodeOptions} options
468
+ * @returns {number}
449
469
  */
450
- (string) => {
451
- return string.length >= FROM_STRING_THRESHOLD_TEXTENCODER ? textEncoder$1.encode(string) : utf8ToBytes(string);
452
- };
470
+ function readUint16(data, offset, options) {
471
+ assertEnoughData(data, offset, 2);
472
+ const value = data[offset] << 8 | data[offset + 1];
473
+ if (options.strict === true && value < uintBoundaries[1]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
474
+ return value;
475
+ }
453
476
  /**
454
- * Buffer variant not fast enough for what we need
455
- * @param {number[]} arr
456
- * @returns {AllocatedByteView}
477
+ * @param {Uint8Array} data
478
+ * @param {number} offset
479
+ * @param {DecodeOptions} options
480
+ * @returns {number}
457
481
  */
458
- const fromArray = (arr) => {
459
- return Uint8Array.from(arr);
460
- };
461
- const slice = useBuffer ? (bytes, start, end) => {
462
- if (isBuffer(bytes)) return new Uint8Array(bytes.subarray(start, end));
463
- return bytes.slice(start, end);
464
- } :
482
+ function readUint32(data, offset, options) {
483
+ assertEnoughData(data, offset, 4);
484
+ const value = data[offset] * 16777216 + (data[offset + 1] << 16) + (data[offset + 2] << 8) + data[offset + 3];
485
+ if (options.strict === true && value < uintBoundaries[2]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
486
+ return value;
487
+ }
465
488
  /**
466
- * @param {Uint8Array} bytes
467
- * @param {number} start
468
- * @param {number} end
489
+ * @param {Uint8Array} data
490
+ * @param {number} offset
491
+ * @param {DecodeOptions} options
492
+ * @returns {number|bigint}
469
493
  */
470
- (bytes, start, end) => {
471
- return bytes.slice(start, end);
472
- };
473
- const concat = useBuffer ? (chunks, length) => {
474
- chunks = chunks.map((c) => c instanceof Uint8Array ? c : globalThis.Buffer.from(c));
475
- return asU8A(globalThis.Buffer.concat(chunks, length));
476
- } :
494
+ function readUint64(data, offset, options) {
495
+ assertEnoughData(data, offset, 8);
496
+ const hi = data[offset] * 16777216 + (data[offset + 1] << 16) + (data[offset + 2] << 8) + data[offset + 3];
497
+ const lo = data[offset + 4] * 16777216 + (data[offset + 5] << 16) + (data[offset + 6] << 8) + data[offset + 7];
498
+ const value = (BigInt(hi) << BigInt(32)) + BigInt(lo);
499
+ if (options.strict === true && value < uintBoundaries[3]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
500
+ if (value <= Number.MAX_SAFE_INTEGER) return Number(value);
501
+ if (options.allowBigInt === true) return value;
502
+ throw new Error(`${decodeErrPrefix} integers outside of the safe integer range are not supported`);
503
+ }
477
504
  /**
478
- * @param {ByteView[]} chunks
479
- * @param {number} length
480
- * @returns {AllocatedByteView}
505
+ * @param {Uint8Array} data
506
+ * @param {number} pos
507
+ * @param {number} _minor
508
+ * @param {DecodeOptions} options
509
+ * @returns {Token}
481
510
  */
482
- (chunks, length) => {
483
- const out = new Uint8Array(length);
484
- let off = 0;
485
- for (let b of chunks) {
486
- if (off + b.length > out.length) b = b.subarray(0, out.length - off);
487
- out.set(b, off);
488
- off += b.length;
489
- }
490
- return out;
491
- };
492
- const alloc = useBuffer ? (size) => {
493
- return globalThis.Buffer.allocUnsafe(size);
494
- } :
511
+ function decodeUint8(data, pos, _minor, options) {
512
+ return new Token(Type.uint, readUint8(data, pos + 1, options), 2);
513
+ }
495
514
  /**
496
- * @param {number} size
497
- * @returns {AllocatedByteView}
515
+ * @param {Uint8Array} data
516
+ * @param {number} pos
517
+ * @param {number} _minor
518
+ * @param {DecodeOptions} options
519
+ * @returns {Token}
498
520
  */
499
- (size) => {
500
- return new Uint8Array(size);
501
- };
521
+ function decodeUint16(data, pos, _minor, options) {
522
+ return new Token(Type.uint, readUint16(data, pos + 1, options), 3);
523
+ }
502
524
  /**
503
- * @param {Uint8Array} b1
504
- * @param {Uint8Array} b2
505
- * @returns {number}
525
+ * @param {Uint8Array} data
526
+ * @param {number} pos
527
+ * @param {number} _minor
528
+ * @param {DecodeOptions} options
529
+ * @returns {Token}
506
530
  */
507
- function compare(b1, b2) {
508
- if (isBuffer(b1) && isBuffer(b2)) return b1.compare(b2);
509
- for (let i = 0; i < b1.length; i++) {
510
- if (b1[i] === b2[i]) continue;
511
- return b1[i] < b2[i] ? -1 : 1;
512
- }
513
- return 0;
531
+ function decodeUint32(data, pos, _minor, options) {
532
+ return new Token(Type.uint, readUint32(data, pos + 1, options), 5);
514
533
  }
515
534
  /**
516
- * @param {string} str
517
- * @returns {number[]}
535
+ * @param {Uint8Array} data
536
+ * @param {number} pos
537
+ * @param {number} _minor
538
+ * @param {DecodeOptions} options
539
+ * @returns {Token}
518
540
  */
519
- function utf8ToBytes(str) {
520
- const out = [];
521
- let p = 0;
522
- for (let i = 0; i < str.length; i++) {
523
- let c = str.charCodeAt(i);
524
- if (c < 128) out[p++] = c;
525
- else if (c < 2048) {
526
- out[p++] = c >> 6 | 192;
527
- out[p++] = c & 63 | 128;
528
- } else if ((c & 64512) === 55296 && i + 1 < str.length && (str.charCodeAt(i + 1) & 64512) === 56320) {
529
- c = 65536 + ((c & 1023) << 10) + (str.charCodeAt(++i) & 1023);
530
- out[p++] = c >> 18 | 240;
531
- out[p++] = c >> 12 & 63 | 128;
532
- out[p++] = c >> 6 & 63 | 128;
533
- out[p++] = c & 63 | 128;
534
- } else {
535
- if (c >= 55296 && c <= 57343) c = 65533;
536
- out[p++] = c >> 12 | 224;
537
- out[p++] = c >> 6 & 63 | 128;
538
- out[p++] = c & 63 | 128;
539
- }
540
- }
541
- return out;
541
+ function decodeUint64(data, pos, _minor, options) {
542
+ return new Token(Type.uint, readUint64(data, pos + 1, options), 9);
542
543
  }
543
- //#endregion
544
- //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/bl.js
545
544
  /**
546
- * Bl is a list of byte chunks, similar to https://github.com/rvagg/bl but for
547
- * writing rather than reading.
548
- * A Bl object accepts set() operations for individual bytes and copyTo() for
549
- * inserting byte arrays. These write operations don't automatically increment
550
- * the internal cursor so its "length" won't be changed. Instead, increment()
551
- * must be called to extend its length to cover the inserted data.
552
- * The toBytes() call will convert all internal memory to a single Uint8Array of
553
- * the correct length, truncating any data that is stored but hasn't been
554
- * included by an increment().
555
- * get() can retrieve a single byte.
556
- * All operations (except toBytes()) take an "offset" argument that will perform
557
- * the write at the offset _from the current cursor_. For most operations this
558
- * will be `0` to write at the current cursor position but it can be ahead of
559
- * the current cursor. Negative offsets probably work but are untested.
545
+ * @param {ByteWriter} writer
546
+ * @param {Token} token
560
547
  */
548
+ function encodeUint(writer, token) {
549
+ return encodeUintValue(writer, 0, token.value);
550
+ }
561
551
  /**
562
- * @typedef {import('../interface.js').ByteView} ByteView
563
- * @typedef {import('../interface.js').AllocatedByteView} AllocatedByteView
552
+ * @param {ByteWriter} writer
553
+ * @param {number} major
554
+ * @param {number|bigint} uint
564
555
  */
565
- const defaultChunkSize = 256;
566
- var Bl = class {
567
- /**
568
- * @param {number} [chunkSize]
569
- */
570
- constructor(chunkSize = defaultChunkSize) {
571
- this.chunkSize = chunkSize;
572
- /** @type {number} */
573
- this.cursor = 0;
574
- /** @type {number} */
575
- this.maxCursor = -1;
576
- /** @type {(ByteView|number[])[]} */
577
- this.chunks = [];
578
- /** @type {ByteView|number[]|null} */
579
- this._initReuseChunk = null;
556
+ function encodeUintValue(writer, major, uint) {
557
+ if (uint < uintBoundaries[0]) {
558
+ const nuint = Number(uint);
559
+ writer.pushByte(major | nuint);
560
+ } else if (uint < uintBoundaries[1]) {
561
+ const nuint = Number(uint);
562
+ writer.push([major | 24, nuint]);
563
+ } else if (uint < uintBoundaries[2]) {
564
+ const nuint = Number(uint);
565
+ writer.push([
566
+ major | 25,
567
+ nuint >>> 8,
568
+ nuint & 255
569
+ ]);
570
+ } else if (uint < uintBoundaries[3]) {
571
+ const nuint = Number(uint);
572
+ writer.push([
573
+ major | 26,
574
+ nuint >>> 24 & 255,
575
+ nuint >>> 16 & 255,
576
+ nuint >>> 8 & 255,
577
+ nuint & 255
578
+ ]);
579
+ } else {
580
+ const buint = BigInt(uint);
581
+ if (buint < uintBoundaries[4]) {
582
+ const set = [
583
+ major | 27,
584
+ 0,
585
+ 0,
586
+ 0,
587
+ 0,
588
+ 0,
589
+ 0,
590
+ 0
591
+ ];
592
+ let lo = Number(buint & BigInt(4294967295));
593
+ let hi = Number(buint >> BigInt(32) & BigInt(4294967295));
594
+ set[8] = lo & 255;
595
+ lo = lo >> 8;
596
+ set[7] = lo & 255;
597
+ lo = lo >> 8;
598
+ set[6] = lo & 255;
599
+ lo = lo >> 8;
600
+ set[5] = lo & 255;
601
+ set[4] = hi & 255;
602
+ hi = hi >> 8;
603
+ set[3] = hi & 255;
604
+ hi = hi >> 8;
605
+ set[2] = hi & 255;
606
+ hi = hi >> 8;
607
+ set[1] = hi & 255;
608
+ writer.push(set);
609
+ } else throw new Error(`${decodeErrPrefix} encountered BigInt larger than allowable range`);
580
610
  }
581
- reset() {
582
- this.cursor = 0;
583
- this.maxCursor = -1;
584
- if (this.chunks.length) this.chunks = [];
585
- if (this._initReuseChunk !== null) {
586
- this.chunks.push(this._initReuseChunk);
587
- this.maxCursor = this._initReuseChunk.length - 1;
588
- }
589
- }
590
- /**
591
- * @param {number} byte
592
- */
593
- pushByte(byte) {
594
- let topChunk = this.chunks[this.chunks.length - 1];
595
- if (this.cursor > this.maxCursor) {
596
- topChunk = alloc(this.chunkSize);
597
- this.chunks.push(topChunk);
598
- this.maxCursor += topChunk.length;
599
- if (this._initReuseChunk === null) this._initReuseChunk = topChunk;
600
- }
601
- const chunkPos = topChunk.length - (this.maxCursor - this.cursor) - 1;
602
- topChunk[chunkPos] = byte;
603
- this.cursor++;
604
- }
605
- /**
606
- * @param {ByteView|number[]} bytes
607
- */
608
- push(bytes) {
609
- let topChunk = this.chunks[this.chunks.length - 1];
610
- if (this.cursor + bytes.length <= this.maxCursor + 1) {
611
- const chunkPos = topChunk.length - (this.maxCursor - this.cursor) - 1;
612
- topChunk.set(bytes, chunkPos);
613
- } else {
614
- if (topChunk) {
615
- const chunkPos = topChunk.length - (this.maxCursor - this.cursor) - 1;
616
- if (chunkPos < topChunk.length) {
617
- this.chunks[this.chunks.length - 1] = topChunk.subarray(0, chunkPos);
618
- this.maxCursor = this.cursor - 1;
619
- }
620
- }
621
- if (bytes.length < 64 && bytes.length < this.chunkSize) {
622
- topChunk = alloc(this.chunkSize);
623
- this.chunks.push(topChunk);
624
- this.maxCursor += topChunk.length;
625
- if (this._initReuseChunk === null) this._initReuseChunk = topChunk;
626
- topChunk.set(bytes, 0);
627
- } else {
628
- this.chunks.push(bytes);
629
- this.maxCursor += bytes.length;
630
- }
631
- }
632
- this.cursor += bytes.length;
633
- }
634
- /**
635
- * @param {boolean} [reset]
636
- * @returns {AllocatedByteView}
637
- */
638
- toBytes(reset = false) {
639
- let byts;
640
- if (this.chunks.length === 1) {
641
- const chunk = this.chunks[0];
642
- if (reset && this.cursor > chunk.length / 2) {
643
- byts = this.cursor === chunk.length ? chunk : chunk.subarray(0, this.cursor);
644
- this._initReuseChunk = null;
645
- this.chunks = [];
646
- } else byts = slice(chunk, 0, this.cursor);
647
- } else byts = concat(this.chunks, this.cursor);
648
- if (reset) this.reset();
649
- return byts;
650
- }
651
- };
652
- /**
653
- * U8Bl is a buffer list that writes directly to a user-provided Uint8Array.
654
- * It provides the same interface as Bl but writes to a fixed destination.
655
- * @template {ArrayBufferLike} T
656
- */
657
- var U8Bl = class {
658
- /**
659
- * @param {Uint8Array<T>} dest
660
- */
661
- constructor(dest) {
662
- this.dest = dest;
663
- /** @type {number} */
664
- this.cursor = 0;
665
- /** @type {Array<Uint8Array<T>>} */
666
- this.chunks = [dest];
667
- }
668
- reset() {
669
- this.cursor = 0;
670
- }
671
- /**
672
- * @param {number} byte
673
- */
674
- pushByte(byte) {
675
- if (this.cursor >= this.dest.length) throw new Error("write out of bounds, destination buffer is too small");
676
- this.dest[this.cursor++] = byte;
677
- }
678
- /**
679
- * @param {ByteView|number[]} bytes
680
- */
681
- push(bytes) {
682
- if (this.cursor + bytes.length > this.dest.length) throw new Error("write out of bounds, destination buffer is too small");
683
- this.dest.set(bytes, this.cursor);
684
- this.cursor += bytes.length;
685
- }
686
- /**
687
- * @param {boolean} [reset]
688
- * @returns {Uint8Array<T>}
689
- */
690
- toBytes(reset = false) {
691
- const byts = this.dest.subarray(0, this.cursor);
692
- if (reset) this.reset();
693
- return byts;
694
- }
695
- };
696
- //#endregion
697
- //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/common.js
698
- const decodeErrPrefix = "CBOR decode error:";
699
- const encodeErrPrefix = "CBOR encode error:";
700
- const uintMinorPrefixBytes = [];
701
- uintMinorPrefixBytes[23] = 1;
702
- uintMinorPrefixBytes[24] = 2;
703
- uintMinorPrefixBytes[25] = 3;
704
- uintMinorPrefixBytes[26] = 5;
705
- uintMinorPrefixBytes[27] = 9;
706
- /**
707
- * @param {Uint8Array} data
708
- * @param {number} pos
709
- * @param {number} need
710
- */
711
- function assertEnoughData(data, pos, need) {
712
- if (data.length - pos < need) throw new Error(`${decodeErrPrefix} not enough data for type`);
713
611
  }
714
- //#endregion
715
- //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/0uint.js
716
- const uintBoundaries = [
717
- 24,
718
- 256,
719
- 65536,
720
- 4294967296,
721
- BigInt("18446744073709551616")
722
- ];
723
- /**
724
- * @typedef {import('../interface.js').ByteWriter} ByteWriter
725
- * @typedef {import('../interface.js').DecodeOptions} DecodeOptions
726
- */
727
612
  /**
728
- * @param {Uint8Array} data
729
- * @param {number} offset
730
- * @param {DecodeOptions} options
613
+ * @param {Token} token
731
614
  * @returns {number}
732
615
  */
733
- function readUint8(data, offset, options) {
734
- assertEnoughData(data, offset, 1);
735
- const value = data[offset];
736
- if (options.strict === true && value < uintBoundaries[0]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
737
- return value;
738
- }
616
+ encodeUint.encodedSize = function encodedSize(token) {
617
+ return encodeUintValue.encodedSize(token.value);
618
+ };
739
619
  /**
740
- * @param {Uint8Array} data
741
- * @param {number} offset
742
- * @param {DecodeOptions} options
620
+ * @param {number} uint
743
621
  * @returns {number}
744
622
  */
745
- function readUint16(data, offset, options) {
746
- assertEnoughData(data, offset, 2);
747
- const value = data[offset] << 8 | data[offset + 1];
748
- if (options.strict === true && value < uintBoundaries[1]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
749
- return value;
750
- }
623
+ encodeUintValue.encodedSize = function encodedSize(uint) {
624
+ if (uint < uintBoundaries[0]) return 1;
625
+ if (uint < uintBoundaries[1]) return 2;
626
+ if (uint < uintBoundaries[2]) return 3;
627
+ if (uint < uintBoundaries[3]) return 5;
628
+ return 9;
629
+ };
751
630
  /**
752
- * @param {Uint8Array} data
753
- * @param {number} offset
754
- * @param {DecodeOptions} options
631
+ * @param {Token} tok1
632
+ * @param {Token} tok2
755
633
  * @returns {number}
756
634
  */
757
- function readUint32(data, offset, options) {
758
- assertEnoughData(data, offset, 4);
759
- const value = data[offset] * 16777216 + (data[offset + 1] << 16) + (data[offset + 2] << 8) + data[offset + 3];
760
- if (options.strict === true && value < uintBoundaries[2]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
761
- return value;
762
- }
635
+ encodeUint.compareTokens = function compareTokens(tok1, tok2) {
636
+ return tok1.value < tok2.value ? -1 : tok1.value > tok2.value ? 1 : 0;
637
+ };
638
+ //#endregion
639
+ //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/1negint.js
763
640
  /**
764
- * @param {Uint8Array} data
765
- * @param {number} offset
766
- * @param {DecodeOptions} options
767
- * @returns {number|bigint}
641
+ * @typedef {import('../interface.js').ByteWriter} ByteWriter
642
+ * @typedef {import('../interface.js').DecodeOptions} DecodeOptions
768
643
  */
769
- function readUint64(data, offset, options) {
770
- assertEnoughData(data, offset, 8);
771
- const hi = data[offset] * 16777216 + (data[offset + 1] << 16) + (data[offset + 2] << 8) + data[offset + 3];
772
- const lo = data[offset + 4] * 16777216 + (data[offset + 5] << 16) + (data[offset + 6] << 8) + data[offset + 7];
773
- const value = (BigInt(hi) << BigInt(32)) + BigInt(lo);
774
- if (options.strict === true && value < uintBoundaries[3]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
775
- if (value <= Number.MAX_SAFE_INTEGER) return Number(value);
776
- if (options.allowBigInt === true) return value;
777
- throw new Error(`${decodeErrPrefix} integers outside of the safe integer range are not supported`);
778
- }
779
644
  /**
780
645
  * @param {Uint8Array} data
781
646
  * @param {number} pos
@@ -783,8 +648,8 @@ function readUint64(data, offset, options) {
783
648
  * @param {DecodeOptions} options
784
649
  * @returns {Token}
785
650
  */
786
- function decodeUint8(data, pos, _minor, options) {
787
- return new Token(Type.uint, readUint8(data, pos + 1, options), 2);
651
+ function decodeNegint8(data, pos, _minor, options) {
652
+ return new Token(Type.negint, -1 - readUint8(data, pos + 1, options), 2);
788
653
  }
789
654
  /**
790
655
  * @param {Uint8Array} data
@@ -793,8 +658,8 @@ function decodeUint8(data, pos, _minor, options) {
793
658
  * @param {DecodeOptions} options
794
659
  * @returns {Token}
795
660
  */
796
- function decodeUint16(data, pos, _minor, options) {
797
- return new Token(Type.uint, readUint16(data, pos + 1, options), 3);
661
+ function decodeNegint16(data, pos, _minor, options) {
662
+ return new Token(Type.negint, -1 - readUint16(data, pos + 1, options), 3);
798
663
  }
799
664
  /**
800
665
  * @param {Uint8Array} data
@@ -803,9 +668,11 @@ function decodeUint16(data, pos, _minor, options) {
803
668
  * @param {DecodeOptions} options
804
669
  * @returns {Token}
805
670
  */
806
- function decodeUint32(data, pos, _minor, options) {
807
- return new Token(Type.uint, readUint32(data, pos + 1, options), 5);
671
+ function decodeNegint32(data, pos, _minor, options) {
672
+ return new Token(Type.negint, -1 - readUint32(data, pos + 1, options), 5);
808
673
  }
674
+ const neg1b$1 = BigInt(-1);
675
+ const pos1b$1 = BigInt(1);
809
676
  /**
810
677
  * @param {Uint8Array} data
811
678
  * @param {number} pos
@@ -813,169 +680,27 @@ function decodeUint32(data, pos, _minor, options) {
813
680
  * @param {DecodeOptions} options
814
681
  * @returns {Token}
815
682
  */
816
- function decodeUint64(data, pos, _minor, options) {
817
- return new Token(Type.uint, readUint64(data, pos + 1, options), 9);
683
+ function decodeNegint64(data, pos, _minor, options) {
684
+ const int = readUint64(data, pos + 1, options);
685
+ if (typeof int !== "bigint") {
686
+ const value = -1 - int;
687
+ if (value >= Number.MIN_SAFE_INTEGER) return new Token(Type.negint, value, 9);
688
+ }
689
+ if (options.allowBigInt !== true) throw new Error(`${decodeErrPrefix} integers outside of the safe integer range are not supported`);
690
+ return new Token(Type.negint, neg1b$1 - BigInt(int), 9);
818
691
  }
819
692
  /**
820
693
  * @param {ByteWriter} writer
821
694
  * @param {Token} token
822
695
  */
823
- function encodeUint(writer, token) {
824
- return encodeUintValue(writer, 0, token.value);
696
+ function encodeNegint(writer, token) {
697
+ const negint = token.value;
698
+ const unsigned = typeof negint === "bigint" ? negint * neg1b$1 - pos1b$1 : negint * -1 - 1;
699
+ encodeUintValue(writer, token.type.majorEncoded, unsigned);
825
700
  }
826
701
  /**
827
- * @param {ByteWriter} writer
828
- * @param {number} major
829
- * @param {number|bigint} uint
830
- */
831
- function encodeUintValue(writer, major, uint) {
832
- if (uint < uintBoundaries[0]) {
833
- const nuint = Number(uint);
834
- writer.pushByte(major | nuint);
835
- } else if (uint < uintBoundaries[1]) {
836
- const nuint = Number(uint);
837
- writer.push([major | 24, nuint]);
838
- } else if (uint < uintBoundaries[2]) {
839
- const nuint = Number(uint);
840
- writer.push([
841
- major | 25,
842
- nuint >>> 8,
843
- nuint & 255
844
- ]);
845
- } else if (uint < uintBoundaries[3]) {
846
- const nuint = Number(uint);
847
- writer.push([
848
- major | 26,
849
- nuint >>> 24 & 255,
850
- nuint >>> 16 & 255,
851
- nuint >>> 8 & 255,
852
- nuint & 255
853
- ]);
854
- } else {
855
- const buint = BigInt(uint);
856
- if (buint < uintBoundaries[4]) {
857
- const set = [
858
- major | 27,
859
- 0,
860
- 0,
861
- 0,
862
- 0,
863
- 0,
864
- 0,
865
- 0
866
- ];
867
- let lo = Number(buint & BigInt(4294967295));
868
- let hi = Number(buint >> BigInt(32) & BigInt(4294967295));
869
- set[8] = lo & 255;
870
- lo = lo >> 8;
871
- set[7] = lo & 255;
872
- lo = lo >> 8;
873
- set[6] = lo & 255;
874
- lo = lo >> 8;
875
- set[5] = lo & 255;
876
- set[4] = hi & 255;
877
- hi = hi >> 8;
878
- set[3] = hi & 255;
879
- hi = hi >> 8;
880
- set[2] = hi & 255;
881
- hi = hi >> 8;
882
- set[1] = hi & 255;
883
- writer.push(set);
884
- } else throw new Error(`${decodeErrPrefix} encountered BigInt larger than allowable range`);
885
- }
886
- }
887
- /**
888
- * @param {Token} token
889
- * @returns {number}
890
- */
891
- encodeUint.encodedSize = function encodedSize(token) {
892
- return encodeUintValue.encodedSize(token.value);
893
- };
894
- /**
895
- * @param {number} uint
896
- * @returns {number}
897
- */
898
- encodeUintValue.encodedSize = function encodedSize(uint) {
899
- if (uint < uintBoundaries[0]) return 1;
900
- if (uint < uintBoundaries[1]) return 2;
901
- if (uint < uintBoundaries[2]) return 3;
902
- if (uint < uintBoundaries[3]) return 5;
903
- return 9;
904
- };
905
- /**
906
- * @param {Token} tok1
907
- * @param {Token} tok2
908
- * @returns {number}
909
- */
910
- encodeUint.compareTokens = function compareTokens(tok1, tok2) {
911
- return tok1.value < tok2.value ? -1 : tok1.value > tok2.value ? 1 : 0;
912
- };
913
- //#endregion
914
- //#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/1negint.js
915
- /**
916
- * @typedef {import('../interface.js').ByteWriter} ByteWriter
917
- * @typedef {import('../interface.js').DecodeOptions} DecodeOptions
918
- */
919
- /**
920
- * @param {Uint8Array} data
921
- * @param {number} pos
922
- * @param {number} _minor
923
- * @param {DecodeOptions} options
924
- * @returns {Token}
925
- */
926
- function decodeNegint8(data, pos, _minor, options) {
927
- return new Token(Type.negint, -1 - readUint8(data, pos + 1, options), 2);
928
- }
929
- /**
930
- * @param {Uint8Array} data
931
- * @param {number} pos
932
- * @param {number} _minor
933
- * @param {DecodeOptions} options
934
- * @returns {Token}
935
- */
936
- function decodeNegint16(data, pos, _minor, options) {
937
- return new Token(Type.negint, -1 - readUint16(data, pos + 1, options), 3);
938
- }
939
- /**
940
- * @param {Uint8Array} data
941
- * @param {number} pos
942
- * @param {number} _minor
943
- * @param {DecodeOptions} options
944
- * @returns {Token}
945
- */
946
- function decodeNegint32(data, pos, _minor, options) {
947
- return new Token(Type.negint, -1 - readUint32(data, pos + 1, options), 5);
948
- }
949
- const neg1b$1 = BigInt(-1);
950
- const pos1b$1 = BigInt(1);
951
- /**
952
- * @param {Uint8Array} data
953
- * @param {number} pos
954
- * @param {number} _minor
955
- * @param {DecodeOptions} options
956
- * @returns {Token}
957
- */
958
- function decodeNegint64(data, pos, _minor, options) {
959
- const int = readUint64(data, pos + 1, options);
960
- if (typeof int !== "bigint") {
961
- const value = -1 - int;
962
- if (value >= Number.MIN_SAFE_INTEGER) return new Token(Type.negint, value, 9);
963
- }
964
- if (options.allowBigInt !== true) throw new Error(`${decodeErrPrefix} integers outside of the safe integer range are not supported`);
965
- return new Token(Type.negint, neg1b$1 - BigInt(int), 9);
966
- }
967
- /**
968
- * @param {ByteWriter} writer
969
- * @param {Token} token
970
- */
971
- function encodeNegint(writer, token) {
972
- const negint = token.value;
973
- const unsigned = typeof negint === "bigint" ? negint * neg1b$1 - pos1b$1 : negint * -1 - 1;
974
- encodeUintValue(writer, token.type.majorEncoded, unsigned);
975
- }
976
- /**
977
- * @param {Token} token
978
- * @returns {number}
702
+ * @param {Token} token
703
+ * @returns {number}
979
704
  */
980
705
  encodeNegint.encodedSize = function encodedSize(token) {
981
706
  const negint = token.value;
@@ -2677,148 +2402,423 @@ function invalid() {
2677
2402
  function assertUnsignedSafeInteger(value) {
2678
2403
  if (!Number.isSafeInteger(value) || value < 0) invalid();
2679
2404
  }
2680
- function assertProtocolVersion(value) {
2681
- if (!Number.isSafeInteger(value) || value < 0 || value > 65535) invalid();
2405
+ function assertProtocolVersion(value) {
2406
+ if (!Number.isSafeInteger(value) || value < 0 || value > 65535) invalid();
2407
+ }
2408
+ function assertIdentifier(value, pattern) {
2409
+ if (!pattern.test(value)) invalid();
2410
+ }
2411
+ function copyBytes(value, expectedLengths) {
2412
+ if (!(value instanceof Uint8Array) || !expectedLengths.includes(value.byteLength)) invalid();
2413
+ return Uint8Array.from(value);
2414
+ }
2415
+ function canonicalizeHubOrigin(value) {
2416
+ if (typeof value !== "string" || value.length === 0 || value.length > 512) invalid();
2417
+ let url;
2418
+ try {
2419
+ url = new URL(value);
2420
+ } catch {
2421
+ return invalid();
2422
+ }
2423
+ const isLoopbackHttp = url.protocol === "http:" && LOOPBACK_HOSTS.has(url.hostname);
2424
+ if (url.protocol !== "https:" && !isLoopbackHttp || url.username !== "" || url.password !== "" || url.pathname !== "/" || url.search !== "" || url.hash !== "" || value !== url.origin) invalid();
2425
+ return url.origin;
2426
+ }
2427
+ function normalizeHubNodeName(value) {
2428
+ if (typeof value !== "string") invalid();
2429
+ const normalized = value.trim();
2430
+ if (normalized.length === 0 || normalized.length > 100) invalid();
2431
+ return normalized;
2432
+ }
2433
+ function validateNodePublicKey(descriptor) {
2434
+ if (descriptor.algorithm === "ed25519") return {
2435
+ algorithm: descriptor.algorithm,
2436
+ publicKey: copyBytes(descriptor.publicKey, [32])
2437
+ };
2438
+ if (descriptor.algorithm === "p256") {
2439
+ const publicKey = copyBytes(descriptor.publicKey, [33, 65]);
2440
+ const prefix = publicKey[0];
2441
+ if (publicKey.byteLength === 33 && prefix !== 2 && prefix !== 3 || publicKey.byteLength === 65 && prefix !== 4) invalid();
2442
+ return {
2443
+ algorithm: descriptor.algorithm,
2444
+ publicKey
2445
+ };
2446
+ }
2447
+ return invalid();
2448
+ }
2449
+ function fingerprintNodePublicKey(descriptor) {
2450
+ const key = validateNodePublicKey(descriptor);
2451
+ const canonical = encode([
2452
+ NODE_KEY_FINGERPRINT_DOMAIN,
2453
+ key.algorithm,
2454
+ key.publicKey
2455
+ ], rfc8949EncodeOptions);
2456
+ return Uint8Array.from((0, node_crypto.createHash)("sha256").update(canonical).digest());
2457
+ }
2458
+ function formatNodePublicKeyFingerprint(fingerprint) {
2459
+ const bytes = copyBytes(fingerprint, [32]);
2460
+ return `SHA256:${Buffer.from(bytes).toString("base64url")}`;
2461
+ }
2462
+ function encodeNodeAuthenticationTranscript(input) {
2463
+ const hubOrigin = canonicalizeHubOrigin(input.hubOrigin);
2464
+ assertProtocolVersion(input.protocolMajor);
2465
+ assertProtocolVersion(input.protocolMinor);
2466
+ assertIdentifier(input.nodeId, NODE_ID);
2467
+ assertIdentifier(input.activeKeyId, NODE_KEY_ID);
2468
+ assertUnsignedSafeInteger(input.challengeExpiresAt);
2469
+ const challenge = copyBytes(input.challenge, [32]);
2470
+ return Uint8Array.from(encode([
2471
+ NODE_AUTH_TRANSCRIPT_DOMAIN,
2472
+ hubOrigin,
2473
+ input.protocolMajor,
2474
+ input.protocolMinor,
2475
+ input.nodeId,
2476
+ input.activeKeyId,
2477
+ input.challengeExpiresAt,
2478
+ challenge
2479
+ ], rfc8949EncodeOptions));
2480
+ }
2481
+ function encodeNodeKeyRotationTranscript(input) {
2482
+ const hubOrigin = canonicalizeHubOrigin(input.hubOrigin);
2483
+ assertProtocolVersion(input.protocolMajor);
2484
+ assertProtocolVersion(input.protocolMinor);
2485
+ assertIdentifier(input.rotationRequestId, ROTATION_REQUEST_ID);
2486
+ assertIdentifier(input.nodeId, NODE_ID);
2487
+ assertIdentifier(input.oldActiveKeyId, NODE_KEY_ID);
2488
+ assertIdentifier(input.newKeyId, NODE_KEY_ID);
2489
+ assertUnsignedSafeInteger(input.challengeExpiresAt);
2490
+ const newKey = validateNodePublicKey(input.newKey);
2491
+ const fingerprint = fingerprintNodePublicKey(newKey);
2492
+ const challenge = copyBytes(input.challenge, [32]);
2493
+ return Uint8Array.from(encode([
2494
+ NODE_KEY_ROTATION_TRANSCRIPT_DOMAIN,
2495
+ hubOrigin,
2496
+ input.protocolMajor,
2497
+ input.protocolMinor,
2498
+ input.rotationRequestId,
2499
+ input.nodeId,
2500
+ input.oldActiveKeyId,
2501
+ input.newKeyId,
2502
+ newKey.algorithm,
2503
+ newKey.publicKey,
2504
+ fingerprint,
2505
+ input.challengeExpiresAt,
2506
+ challenge
2507
+ ], rfc8949EncodeOptions));
2508
+ }
2509
+ function encodeNativeNodeClaimTranscript(input) {
2510
+ const hubOrigin = canonicalizeHubOrigin(input.hubOrigin);
2511
+ assertProtocolVersion(input.protocolVersion);
2512
+ assertProtocolVersion(input.transcriptVersion);
2513
+ assertIdentifier(input.claimId, NATIVE_NODE_CLAIM_ID);
2514
+ assertIdentifier(input.accountId, ACCOUNT_ID);
2515
+ assertIdentifier(input.spaceId, SPACE_ID);
2516
+ assertIdentifier(input.sessionId, SESSION_ID);
2517
+ const dpopKeyThumbprint = copyBytes(input.dpopKeyThumbprint, [32]);
2518
+ assertIdentifier(input.installationId, DESKTOP_INSTALLATION_ID);
2519
+ assertIdentifier(input.environmentId, ENVIRONMENT_ID);
2520
+ const nodeKey = validateNodePublicKey(input.nodeKey);
2521
+ const nodeFingerprint = fingerprintNodePublicKey(nodeKey);
2522
+ assertUnsignedSafeInteger(input.claimExpiresAt);
2523
+ const challenge = copyBytes(input.challenge, [32]);
2524
+ return Uint8Array.from(encode([
2525
+ NATIVE_NODE_CLAIM_TRANSCRIPT_DOMAIN,
2526
+ hubOrigin,
2527
+ input.protocolVersion,
2528
+ input.transcriptVersion,
2529
+ input.claimId,
2530
+ input.accountId,
2531
+ input.spaceId,
2532
+ input.sessionId,
2533
+ dpopKeyThumbprint,
2534
+ input.installationId,
2535
+ input.environmentId,
2536
+ nodeKey.algorithm,
2537
+ nodeKey.publicKey,
2538
+ nodeFingerprint,
2539
+ input.claimExpiresAt,
2540
+ challenge
2541
+ ], rfc8949EncodeOptions));
2542
+ }
2543
+ function equalNodeIdentityBytes(left, right) {
2544
+ if (!(left instanceof Uint8Array) || !(right instanceof Uint8Array)) return false;
2545
+ if (left.byteLength !== right.byteLength) return false;
2546
+ return (0, node_crypto.timingSafeEqual)(left, right);
2547
+ }
2548
+ //#endregion
2549
+ //#region ../../packages/shared/src/Struct.ts
2550
+ function deepMerge(current, patch) {
2551
+ if (!effect_Predicate.isObject(current) || !effect_Predicate.isObject(patch)) return patch;
2552
+ const next = { ...current };
2553
+ for (const [key, value] of Object.entries(patch)) {
2554
+ if (value === void 0) continue;
2555
+ const existing = next[key];
2556
+ next[key] = effect_Predicate.isObject(existing) && effect_Predicate.isObject(value) ? deepMerge(existing, value) : value;
2557
+ }
2558
+ return next;
2559
+ }
2560
+ //#endregion
2561
+ //#region ../../packages/shared/src/model.ts
2562
+ const DEFAULT_PROVIDER_DRIVER_KIND = require_src.ProviderDriverKind.make("codex");
2563
+ /**
2564
+ * Resolve the human-readable model title used by picker surfaces and durable
2565
+ * handoff presentation. Provider catalogs are authoritative when they carry a
2566
+ * friendly name; the routing slug remains the deterministic final fallback.
2567
+ */
2568
+ function getModelDisplayName(model, options) {
2569
+ const shortName = trimOrNull(model.shortName);
2570
+ const name = trimOrNull(model.name);
2571
+ const slug = trimOrNull(model.slug) ?? model.slug;
2572
+ return options?.preferShortName ? shortName ?? name ?? slug : name ?? shortName ?? slug;
2573
+ }
2574
+ /** Compose the optional sub-provider prefix exactly as the picker trigger does. */
2575
+ function getModelDisplayLabel(model, options) {
2576
+ const title = getModelDisplayName(model, options);
2577
+ const subProvider = trimOrNull(model.subProvider);
2578
+ return subProvider ? `${subProvider} · ${title}` : title;
2579
+ }
2580
+ function createModelCapabilities(input) {
2581
+ return { optionDescriptors: input.optionDescriptors.map(cloneDescriptor) };
2582
+ }
2583
+ function getRawSelectionValueById(selections, id) {
2584
+ return (selections?.find((candidate) => candidate.id === id))?.value;
2585
+ }
2586
+ function getProviderOptionSelectionValue(selections, id) {
2587
+ return getRawSelectionValueById(selections, id);
2588
+ }
2589
+ function getProviderOptionStringSelectionValue(selections, id) {
2590
+ const value = getProviderOptionSelectionValue(selections, id);
2591
+ return typeof value === "string" ? value : void 0;
2592
+ }
2593
+ function getProviderOptionBooleanSelectionValue(selections, id) {
2594
+ const value = getProviderOptionSelectionValue(selections, id);
2595
+ return typeof value === "boolean" ? value : void 0;
2596
+ }
2597
+ function getModelSelectionStringOptionValue(modelSelection, id) {
2598
+ return getProviderOptionStringSelectionValue(modelSelection?.options, id);
2599
+ }
2600
+ function getModelSelectionBooleanOptionValue(modelSelection, id) {
2601
+ return getProviderOptionBooleanSelectionValue(modelSelection?.options, id);
2602
+ }
2603
+ function resolveDescriptorChoiceValue(descriptor, raw) {
2604
+ const trimmed = trimOrNull(raw);
2605
+ if (!trimmed) return descriptor.currentValue ?? descriptor.options.find((option) => option.isDefault)?.id;
2606
+ if (descriptor.options.length === 0) return trimmed;
2607
+ if (descriptor.promptInjectedValues?.includes(trimmed) && descriptor.options.some((option) => option.id === trimmed)) return descriptor.options.find((option) => option.isDefault)?.id;
2608
+ if (descriptor.options.some((option) => option.id === trimmed)) return trimmed;
2609
+ return descriptor.currentValue ?? descriptor.options.find((option) => option.isDefault)?.id;
2610
+ }
2611
+ function cloneDescriptor(descriptor) {
2612
+ return descriptor.type === "select" ? {
2613
+ ...descriptor,
2614
+ options: [...descriptor.options],
2615
+ ...descriptor.promptInjectedValues ? { promptInjectedValues: [...descriptor.promptInjectedValues] } : {}
2616
+ } : { ...descriptor };
2617
+ }
2618
+ function cloneSelection(selection) {
2619
+ return { ...selection };
2620
+ }
2621
+ function withDescriptorCurrentValue(descriptor, rawCurrentValue) {
2622
+ if (descriptor.type === "boolean") {
2623
+ if (typeof rawCurrentValue === "boolean") return {
2624
+ ...descriptor,
2625
+ currentValue: rawCurrentValue
2626
+ };
2627
+ return descriptor;
2628
+ }
2629
+ const currentValue = typeof rawCurrentValue === "string" ? resolveDescriptorChoiceValue(descriptor, rawCurrentValue) : resolveDescriptorChoiceValue(descriptor, descriptor.currentValue);
2630
+ if (!currentValue) {
2631
+ const { currentValue: _unusedCurrentValue, ...rest } = descriptor;
2632
+ return rest;
2633
+ }
2634
+ return {
2635
+ ...descriptor,
2636
+ currentValue
2637
+ };
2638
+ }
2639
+ function getProviderOptionDescriptors(input) {
2640
+ const { caps, selections } = input;
2641
+ return (caps.optionDescriptors ?? []).map(cloneDescriptor).map((descriptor) => withDescriptorCurrentValue(descriptor, getRawSelectionValueById(selections, descriptor.id) ?? descriptor.currentValue));
2642
+ }
2643
+ function getProviderOptionCurrentValue(descriptor) {
2644
+ if (!descriptor) return;
2645
+ if (descriptor.type === "boolean") return descriptor.currentValue;
2646
+ if (descriptor.currentValue) return descriptor.currentValue;
2647
+ return descriptor.options.find((option) => option.isDefault)?.id;
2648
+ }
2649
+ function normalizeModelSlug(model, provider = DEFAULT_PROVIDER_DRIVER_KIND) {
2650
+ if (typeof model !== "string") return null;
2651
+ const trimmed = model.trim();
2652
+ if (!trimmed) return null;
2653
+ const aliases = require_src.MODEL_SLUG_ALIASES_BY_PROVIDER[provider] ?? {};
2654
+ const aliased = Object.prototype.hasOwnProperty.call(aliases, trimmed) ? aliases[trimmed] : void 0;
2655
+ return typeof aliased === "string" ? aliased : trimmed;
2656
+ }
2657
+ /** Trim a string, returning null for empty/missing values. */
2658
+ function trimOrNull(value) {
2659
+ if (typeof value !== "string") return null;
2660
+ return value.trim() || null;
2661
+ }
2662
+ function cloneSelections(selections) {
2663
+ return selections.map(cloneSelection);
2664
+ }
2665
+ function createModelSelection(instanceId, model, options) {
2666
+ const selections = options ? cloneSelections(options) : [];
2667
+ const base = {
2668
+ instanceId,
2669
+ model
2670
+ };
2671
+ return selections.length > 0 ? {
2672
+ ...base,
2673
+ options: selections
2674
+ } : base;
2675
+ }
2676
+ /**
2677
+ * Context handoff is a provider-instance boundary. Model and option changes
2678
+ * within one configured instance remain on that provider's normal turn path.
2679
+ */
2680
+ function modelSelectionRequiresContextHandoff(input) {
2681
+ return input.canonicalSelection.instanceId !== input.targetSelection.instanceId;
2682
+ }
2683
+ /**
2684
+ * Returns the effort value if it is a prompt-injected value according to
2685
+ * any select descriptor in the given capabilities, or null otherwise.
2686
+ *
2687
+ * Unlike a single `find`, this checks every descriptor so that the
2688
+ * correct descriptor's `promptInjectedValues` list is consulted even when
2689
+ * multiple select descriptors exist.
2690
+ */
2691
+ function resolvePromptInjectedEffort(caps, rawEffort) {
2692
+ const trimmed = trimOrNull(rawEffort);
2693
+ if (!trimmed) return null;
2694
+ const descriptors = getProviderOptionDescriptors({ caps });
2695
+ for (const descriptor of descriptors) if (descriptor.type === "select" && descriptor.promptInjectedValues?.includes(trimmed)) return trimmed;
2696
+ return null;
2697
+ }
2698
+ function applyClaudePromptEffortPrefix(text, effort) {
2699
+ const trimmed = text.trim();
2700
+ if (!trimmed) return trimmed;
2701
+ if (effort !== "ultrathink") return trimmed;
2702
+ if (trimmed.startsWith("Ultrathink:")) return trimmed;
2703
+ return `Ultrathink:\n${trimmed}`;
2682
2704
  }
2683
- function assertIdentifier(value, pattern) {
2684
- if (!pattern.test(value)) invalid();
2705
+ //#endregion
2706
+ //#region ../../packages/shared/src/serverSettings.ts
2707
+ const ServerSettingsJson$1 = require_schemaJson.fromLenientJson(require_src.ServerSettings);
2708
+ function normalizePersistedServerSettingString(value) {
2709
+ const trimmed = value?.trim();
2710
+ return trimmed && trimmed.length > 0 ? trimmed : void 0;
2685
2711
  }
2686
- function copyBytes(value, expectedLengths) {
2687
- if (!(value instanceof Uint8Array) || !expectedLengths.includes(value.byteLength)) invalid();
2688
- return Uint8Array.from(value);
2712
+ function extractPersistedServerObservabilitySettings(input) {
2713
+ return {
2714
+ otlpTracesUrl: normalizePersistedServerSettingString(input.observability?.otlpTracesUrl),
2715
+ otlpMetricsUrl: normalizePersistedServerSettingString(input.observability?.otlpMetricsUrl)
2716
+ };
2689
2717
  }
2690
- function canonicalizeHubOrigin(value) {
2691
- if (typeof value !== "string" || value.length === 0 || value.length > 512) invalid();
2692
- let url;
2718
+ function parsePersistedServerObservabilitySettings(raw) {
2693
2719
  try {
2694
- url = new URL(value);
2720
+ return extractPersistedServerObservabilitySettings(effect.Schema.decodeUnknownSync(ServerSettingsJson$1)(raw));
2695
2721
  } catch {
2696
- return invalid();
2697
- }
2698
- const isLoopbackHttp = url.protocol === "http:" && LOOPBACK_HOSTS.has(url.hostname);
2699
- if (url.protocol !== "https:" && !isLoopbackHttp || url.username !== "" || url.password !== "" || url.pathname !== "/" || url.search !== "" || url.hash !== "" || value !== url.origin) invalid();
2700
- return url.origin;
2701
- }
2702
- function normalizeHubNodeName(value) {
2703
- if (typeof value !== "string") invalid();
2704
- const normalized = value.trim();
2705
- if (normalized.length === 0 || normalized.length > 100) invalid();
2706
- return normalized;
2707
- }
2708
- function validateNodePublicKey(descriptor) {
2709
- if (descriptor.algorithm === "ed25519") return {
2710
- algorithm: descriptor.algorithm,
2711
- publicKey: copyBytes(descriptor.publicKey, [32])
2712
- };
2713
- if (descriptor.algorithm === "p256") {
2714
- const publicKey = copyBytes(descriptor.publicKey, [33, 65]);
2715
- const prefix = publicKey[0];
2716
- if (publicKey.byteLength === 33 && prefix !== 2 && prefix !== 3 || publicKey.byteLength === 65 && prefix !== 4) invalid();
2717
2722
  return {
2718
- algorithm: descriptor.algorithm,
2719
- publicKey
2723
+ otlpTracesUrl: void 0,
2724
+ otlpMetricsUrl: void 0
2720
2725
  };
2721
2726
  }
2722
- return invalid();
2723
- }
2724
- function fingerprintNodePublicKey(descriptor) {
2725
- const key = validateNodePublicKey(descriptor);
2726
- const canonical = encode([
2727
- NODE_KEY_FINGERPRINT_DOMAIN,
2728
- key.algorithm,
2729
- key.publicKey
2730
- ], rfc8949EncodeOptions);
2731
- return Uint8Array.from((0, node_crypto.createHash)("sha256").update(canonical).digest());
2732
- }
2733
- function formatNodePublicKeyFingerprint(fingerprint) {
2734
- const bytes = copyBytes(fingerprint, [32]);
2735
- return `SHA256:${Buffer.from(bytes).toString("base64url")}`;
2736
- }
2737
- function encodeNodeAuthenticationTranscript(input) {
2738
- const hubOrigin = canonicalizeHubOrigin(input.hubOrigin);
2739
- assertProtocolVersion(input.protocolMajor);
2740
- assertProtocolVersion(input.protocolMinor);
2741
- assertIdentifier(input.nodeId, NODE_ID);
2742
- assertIdentifier(input.activeKeyId, NODE_KEY_ID);
2743
- assertUnsignedSafeInteger(input.challengeExpiresAt);
2744
- const challenge = copyBytes(input.challenge, [32]);
2745
- return Uint8Array.from(encode([
2746
- NODE_AUTH_TRANSCRIPT_DOMAIN,
2747
- hubOrigin,
2748
- input.protocolMajor,
2749
- input.protocolMinor,
2750
- input.nodeId,
2751
- input.activeKeyId,
2752
- input.challengeExpiresAt,
2753
- challenge
2754
- ], rfc8949EncodeOptions));
2755
2727
  }
2756
- function encodeNodeKeyRotationTranscript(input) {
2757
- const hubOrigin = canonicalizeHubOrigin(input.hubOrigin);
2758
- assertProtocolVersion(input.protocolMajor);
2759
- assertProtocolVersion(input.protocolMinor);
2760
- assertIdentifier(input.rotationRequestId, ROTATION_REQUEST_ID);
2761
- assertIdentifier(input.nodeId, NODE_ID);
2762
- assertIdentifier(input.oldActiveKeyId, NODE_KEY_ID);
2763
- assertIdentifier(input.newKeyId, NODE_KEY_ID);
2764
- assertUnsignedSafeInteger(input.challengeExpiresAt);
2765
- const newKey = validateNodePublicKey(input.newKey);
2766
- const fingerprint = fingerprintNodePublicKey(newKey);
2767
- const challenge = copyBytes(input.challenge, [32]);
2768
- return Uint8Array.from(encode([
2769
- NODE_KEY_ROTATION_TRANSCRIPT_DOMAIN,
2770
- hubOrigin,
2771
- input.protocolMajor,
2772
- input.protocolMinor,
2773
- input.rotationRequestId,
2774
- input.nodeId,
2775
- input.oldActiveKeyId,
2776
- input.newKeyId,
2777
- newKey.algorithm,
2778
- newKey.publicKey,
2779
- fingerprint,
2780
- input.challengeExpiresAt,
2781
- challenge
2782
- ], rfc8949EncodeOptions));
2728
+ function shouldReplaceTextGenerationModelSelection(patch) {
2729
+ return Boolean(patch && (patch.instanceId !== void 0 || patch.model !== void 0));
2783
2730
  }
2784
- function encodeNativeNodeClaimTranscript(input) {
2785
- const hubOrigin = canonicalizeHubOrigin(input.hubOrigin);
2786
- assertProtocolVersion(input.protocolVersion);
2787
- assertProtocolVersion(input.transcriptVersion);
2788
- assertIdentifier(input.claimId, NATIVE_NODE_CLAIM_ID);
2789
- assertIdentifier(input.accountId, ACCOUNT_ID);
2790
- assertIdentifier(input.spaceId, SPACE_ID);
2791
- assertIdentifier(input.sessionId, SESSION_ID);
2792
- const dpopKeyThumbprint = copyBytes(input.dpopKeyThumbprint, [32]);
2793
- assertIdentifier(input.installationId, DESKTOP_INSTALLATION_ID);
2794
- assertIdentifier(input.environmentId, ENVIRONMENT_ID);
2795
- const nodeKey = validateNodePublicKey(input.nodeKey);
2796
- const nodeFingerprint = fingerprintNodePublicKey(nodeKey);
2797
- assertUnsignedSafeInteger(input.claimExpiresAt);
2798
- const challenge = copyBytes(input.challenge, [32]);
2799
- return Uint8Array.from(encode([
2800
- NATIVE_NODE_CLAIM_TRANSCRIPT_DOMAIN,
2801
- hubOrigin,
2802
- input.protocolVersion,
2803
- input.transcriptVersion,
2804
- input.claimId,
2805
- input.accountId,
2806
- input.spaceId,
2807
- input.sessionId,
2808
- dpopKeyThumbprint,
2809
- input.installationId,
2810
- input.environmentId,
2811
- nodeKey.algorithm,
2812
- nodeKey.publicKey,
2813
- nodeFingerprint,
2814
- input.claimExpiresAt,
2815
- challenge
2816
- ], rfc8949EncodeOptions));
2731
+ function mergeModelSelectionOptionsById(input) {
2732
+ if (input.patch === void 0) return input.current ? [...input.current] : void 0;
2733
+ if (input.patch.length === 0) return;
2734
+ const merged = new Map((input.current ?? []).map((selection) => [selection.id, selection.value]));
2735
+ for (const selection of input.patch) merged.set(selection.id, selection.value);
2736
+ return [...merged.entries()].map(([id, value]) => ({
2737
+ id,
2738
+ value
2739
+ }));
2817
2740
  }
2818
- function equalNodeIdentityBytes(left, right) {
2819
- if (!(left instanceof Uint8Array) || !(right instanceof Uint8Array)) return false;
2820
- if (left.byteLength !== right.byteLength) return false;
2821
- return (0, node_crypto.timingSafeEqual)(left, right);
2741
+ /**
2742
+ * Applies a server settings patch while treating textGenerationModelSelection as
2743
+ * replace-on-provider/model updates. This prevents stale nested options from
2744
+ * surviving a reset patch that intentionally omits options.
2745
+ */
2746
+ function applyServerSettingsPatch(current, patch) {
2747
+ const selectionPatch = patch.textGenerationModelSelection;
2748
+ for (const [field, value] of Object.entries(patch.expectedNodePreferences ?? {})) if (!effect.Equal.equals(current[field] ?? null, value)) throw new Error("Node preferences changed elsewhere. Reload before saving.");
2749
+ for (const [projectId, expected] of Object.entries(patch.expectedProjectPreferences ?? {})) {
2750
+ const currentPreferences = current.projectPreferences[projectId] ?? {};
2751
+ for (const [field, value] of Object.entries(expected)) {
2752
+ const actual = field === "initialModelSelection" && !Object.hasOwn(currentPreferences, field) ? "absent" : currentPreferences[field] ?? null;
2753
+ if (!effect.Equal.equals(actual, value)) throw new Error("Project preferences changed elsewhere. Reload before saving.");
2754
+ }
2755
+ }
2756
+ const { expectedProjectPreferences: _expected, expectedNodePreferences: _expectedNode, projectPreferences: _projects, ...persistedPatch } = patch;
2757
+ let next = deepMerge(current, persistedPatch);
2758
+ if (patch.initialModelSelection !== void 0) next = {
2759
+ ...next,
2760
+ initialModelSelection: patch.initialModelSelection
2761
+ };
2762
+ if (patch.projectPreferences !== void 0) {
2763
+ const projects = new Map(Object.entries(current.projectPreferences));
2764
+ for (const [projectId, preferencesPatch] of Object.entries(patch.projectPreferences)) {
2765
+ if (preferencesPatch === null) {
2766
+ projects.delete(projectId);
2767
+ continue;
2768
+ }
2769
+ const preferences = { ...projects.get(projectId) };
2770
+ for (const [field, value] of Object.entries(preferencesPatch)) if (value === null && field !== "initialModelSelection") delete preferences[field];
2771
+ else Object.assign(preferences, { [field]: value });
2772
+ if (Object.keys(preferences).length) projects.set(projectId, preferences);
2773
+ else projects.delete(projectId);
2774
+ }
2775
+ next = {
2776
+ ...next,
2777
+ projectPreferences: Object.fromEntries(projects)
2778
+ };
2779
+ }
2780
+ if (patch.projectWorktreeSubmodules !== void 0) {
2781
+ const modes = new Map(Object.entries(current.projectWorktreeSubmodules));
2782
+ for (const [projectId, mode] of Object.entries(patch.projectWorktreeSubmodules)) if (mode === null) modes.delete(projectId);
2783
+ else modes.set(projectId, mode);
2784
+ next = {
2785
+ ...next,
2786
+ projectWorktreeSubmodules: Object.fromEntries(modes)
2787
+ };
2788
+ }
2789
+ if (patch.projectWorktreeRoots !== void 0) {
2790
+ const roots = new Map(Object.entries(current.projectWorktreeRoots));
2791
+ for (const [projectId, root] of Object.entries(patch.projectWorktreeRoots)) if (root === null || root === "") roots.delete(projectId);
2792
+ else roots.set(projectId, root);
2793
+ next = {
2794
+ ...next,
2795
+ projectWorktreeRoots: Object.fromEntries(roots)
2796
+ };
2797
+ }
2798
+ if (patch.projectStorageRetention !== void 0) {
2799
+ const policies = new Map(Object.entries(current.projectStorageRetention));
2800
+ for (const [projectId, policy] of Object.entries(patch.projectStorageRetention)) if (policy === null) policies.delete(projectId);
2801
+ else policies.set(projectId, policy);
2802
+ next = {
2803
+ ...next,
2804
+ projectStorageRetention: Object.fromEntries(policies)
2805
+ };
2806
+ }
2807
+ const nextWithReplacements = patch.providerInstances !== void 0 ? {
2808
+ ...next,
2809
+ providerInstances: patch.providerInstances
2810
+ } : next;
2811
+ if (!selectionPatch) return nextWithReplacements;
2812
+ const instanceId = selectionPatch.instanceId ?? current.textGenerationModelSelection.instanceId;
2813
+ const model = selectionPatch.model ?? current.textGenerationModelSelection.model;
2814
+ const options = shouldReplaceTextGenerationModelSelection(selectionPatch) ? selectionPatch.options : mergeModelSelectionOptionsById({
2815
+ current: current.textGenerationModelSelection.options,
2816
+ patch: selectionPatch.options
2817
+ });
2818
+ return {
2819
+ ...nextWithReplacements,
2820
+ textGenerationModelSelection: createModelSelection(instanceId, model, options)
2821
+ };
2822
2822
  }
2823
2823
  //#endregion
2824
2824
  //#region src/config.ts
@@ -2895,6 +2895,7 @@ function resolveHubConnectorConfig(raw) {
2895
2895
  };
2896
2896
  }
2897
2897
  const DEFAULT_NODE_E2EE_POLICY_CONFIG = {
2898
+ mode: void 0,
2898
2899
  requireE2EE: void 0,
2899
2900
  requireApprovedClientE2EE: void 0,
2900
2901
  configurationIssue: void 0
@@ -2921,10 +2922,12 @@ const parseTriStateBoolean = (value) => {
2921
2922
  function resolveNodeE2eePolicyConfig(raw) {
2922
2923
  const requireE2EE = parseTriStateBoolean(raw.requireE2EE);
2923
2924
  const requireApprovedClientE2EE = parseTriStateBoolean(raw.requireApprovedClientE2EE);
2925
+ const mode = raw.mode === void 0 ? void 0 : effect.Schema.is(require_src.NodeE2eeAdmissionPolicy)(raw.mode) ? raw.mode : null;
2924
2926
  return {
2927
+ mode: mode ?? void 0,
2925
2928
  requireE2EE: typeof requireE2EE === "boolean" ? requireE2EE : void 0,
2926
2929
  requireApprovedClientE2EE: typeof requireApprovedClientE2EE === "boolean" ? requireApprovedClientE2EE : void 0,
2927
- configurationIssue: requireE2EE === void 0 || requireApprovedClientE2EE === void 0 ? "configuration_invalid" : void 0
2930
+ configurationIssue: requireE2EE === void 0 || requireApprovedClientE2EE === void 0 || mode === null ? "configuration_invalid" : void 0
2928
2931
  };
2929
2932
  }
2930
2933
  function resolveManagedWorktreesRoot(config) {