ryco-cli 0.1.29 → 0.1.31
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.
- package/README.md +37 -0
- package/dist/{AcpAdapter-8CSe4HK7.cjs → AcpAdapter-ByUp9-wk.cjs} +74 -54
- package/dist/{AcpAdapter-CG1wRWcf.mjs → AcpAdapter-CY_ANTKu.mjs} +74 -54
- package/dist/{AcpNativeLogging-B6TtnnKL.mjs → AcpNativeLogging-C7PC6imv.mjs} +30 -4
- package/dist/{AcpNativeLogging-DbjnRnTf.cjs → AcpNativeLogging-OQeAya9d.cjs} +33 -1
- package/dist/{AcpRegistryDriver-16ZTxUs3.cjs → AcpRegistryDriver-CD9GN7rI.cjs} +3 -3
- package/dist/{AcpRegistryDriver-DZFasKaz.mjs → AcpRegistryDriver-DMZ5VBWJ.mjs} +4 -4
- package/dist/AzureDevOpsSourceControlProvider-5giVYoNi.mjs +2053 -0
- package/dist/AzureDevOpsSourceControlProvider-BKMXEUaN.cjs +2055 -0
- package/dist/{BitbucketSourceControlProvider-DplKc8Wo.mjs → BitbucketSourceControlProvider-BVUBsEUF.mjs} +63 -23
- package/dist/{BitbucketSourceControlProvider-B-ZwKj72.cjs → BitbucketSourceControlProvider-BWnnrbch.cjs} +62 -22
- package/dist/{BunPTY-Dcl1Lp62.mjs → BunPTY-CMbDQ1Xb.mjs} +1 -1
- package/dist/{ClaudeDriver-r0lJ9vmE.cjs → ClaudeDriver-DCrqouOR.cjs} +1376 -194
- package/dist/{ClaudeDriver-0gGVop27.mjs → ClaudeDriver-DVOss8cC.mjs} +1377 -195
- package/dist/{CodexDriver-bJAbhSwY.cjs → CodexDriver-CBQPHJqU.cjs} +259 -29
- package/dist/{CodexDriver-baT02xVb.mjs → CodexDriver-DJoTky7Z.mjs} +261 -31
- package/dist/{CodexTextGeneration-Dwp6X3dq.mjs → CodexTextGeneration-BSgNgfZv.mjs} +6 -6
- package/dist/{CodexTextGeneration-DFZ5y4gj.cjs → CodexTextGeneration-C9MDQmZm.cjs} +7 -7
- package/dist/{CopilotDriver-C0OhnSB1.mjs → CopilotDriver-CUkdPXcH.mjs} +78 -20
- package/dist/{CopilotDriver-B_jEqfYQ.cjs → CopilotDriver-DbaMDH16.cjs} +76 -18
- package/dist/{CursorDriver-DinXkGP9.mjs → CursorDriver-B-ZilXJB.mjs} +115 -98
- package/dist/{CursorDriver-BBFEW7ZI.cjs → CursorDriver-DKQqPbKH.cjs} +116 -99
- package/dist/{ForgejoSourceControlProvider-iG9o7aZB.cjs → ForgejoSourceControlProvider-CgpjFECj.cjs} +94 -60
- package/dist/{ForgejoSourceControlProvider-Dr0fxfud.mjs → ForgejoSourceControlProvider-DemMYUye.mjs} +95 -61
- package/dist/{GitHubSourceControlProvider-L1yFpep4.cjs → GitHubSourceControlProvider-C4un6hOK.cjs} +218 -119
- package/dist/{GitHubSourceControlProvider-CnIu0n2Y.mjs → GitHubSourceControlProvider-CRSDYcjc.mjs} +206 -108
- package/dist/GitLabSourceControlProvider-D8W1ZLPh.cjs +2260 -0
- package/dist/GitLabSourceControlProvider-DpWkJ0M3.mjs +2258 -0
- package/dist/{GrokDriver-D_Ylzh5z.cjs → GrokDriver-BQ6G_7ZZ.cjs} +11 -12
- package/dist/{GrokDriver-pX-N6HGS.mjs → GrokDriver-Buvas9-q.mjs} +7 -8
- package/dist/{Metrics-BjqGlIP4.mjs → Metrics-C3vLS9rz.mjs} +1264 -1151
- package/dist/{Metrics-Bf96NJ4j.cjs → Metrics-DjRPLE98.cjs} +1295 -1134
- package/dist/{NodePTY-D7tFWuQe.mjs → NodePTY-DgnuBruq.mjs} +1 -1
- package/dist/{NodeSqliteClient-BGg70C7Q.cjs → NodeSqliteClient-D8bzGgPN.cjs} +1 -1
- package/dist/{OpenCodeDriver-Byu1pf_i.mjs → OpenCodeDriver-BWEZD841.mjs} +184 -50
- package/dist/{OpenCodeDriver-BFEw5t09.cjs → OpenCodeDriver-qUiX0RLH.cjs} +185 -51
- package/dist/{SideQuestionIsolation-81IoAuoi.mjs → SideQuestionIsolation-B1T-DsR0.mjs} +1 -1
- package/dist/{SideQuestionIsolation-CMPkCUP0.cjs → SideQuestionIsolation-BPC-Bxsz.cjs} +1 -1
- package/dist/bin.cjs +50689 -15659
- package/dist/bin.mjs +50578 -15585
- package/dist/client/assets/AccountSettings-B88Q_w9Y.js +1 -0
- package/dist/client/assets/AiFocusSettings-Bb0TrCPn.js +1 -0
- package/dist/client/assets/{AnimatedHeight-BNg7wnTK.js → AnimatedHeight-epXOsgdm.js} +1 -1
- package/dist/client/assets/AppearanceSettings-XS9WRVPU.js +1 -0
- package/dist/client/assets/AutomationsDialog-bZckh4Y3.js +1 -0
- package/dist/client/assets/AutomationsSummary-wPFZCF49.js +1 -0
- package/dist/client/assets/BranchToolbar.logic-DjzLKbbB.js +3 -0
- package/dist/client/assets/BrowserPanel-CdBLnnfz.js +1 -0
- package/dist/client/assets/ChatRightPanel-BCINd0vP.js +34 -0
- package/dist/client/assets/ChatThreadRouteView-BFZ0Si-l.js +1 -0
- package/dist/client/assets/ColorSwatchPicker-CGyo99o0.js +1 -0
- package/dist/client/assets/CommandPalette.logic-BIOMtnEQ.js +1 -0
- package/dist/client/assets/CommandPaletteDialog-Db4LH--z.js +2 -0
- package/dist/client/assets/CompositeRoot-DtnwMJKj.js +1 -0
- package/dist/client/assets/ComputerUseSettings-CkqCqDsU.js +1 -0
- package/dist/client/assets/ConnectionsSettings-B9mxExdG.js +7 -0
- package/dist/client/assets/CreatePullRequestDialog-CJ7pNCue.js +1 -0
- package/dist/client/assets/CreatePullRequestDialogHost-n4ZjdSr4.js +1 -0
- package/dist/client/assets/DiagnosticsSettings-f9rFG9re.js +2 -0
- package/dist/client/assets/DiagnosticsSettings.logic-Byf-Bu4S.js +1 -0
- package/dist/client/assets/DialogHandle-C0c_rK3I.js +1 -0
- package/dist/client/assets/{DialogPopup-DdZlhHuQ.js → DialogPopup-BKW1PEEa.js} +1 -1
- package/dist/client/assets/DialogRoot-BIubqrv0.js +1 -0
- package/dist/client/assets/DialogTitle-BAX_FLoG.js +1 -0
- package/dist/client/assets/{DialogViewport-BwuqbGLY.js → DialogViewport-C2iOUx0O.js} +1 -1
- package/dist/client/assets/DiffPanel-BkqDt_SS.js +25 -0
- package/dist/client/assets/DisclosureRegion-B8556yU0.js +1 -0
- package/dist/client/assets/DraftChatThreadRouteView-BKgRKJ2w.js +1 -0
- package/dist/client/assets/{ExternalIdentityWeb.logic-DsTJQkg-.js → ExternalIdentityWeb.logic-Cu6suNrN.js} +1 -1
- package/dist/client/assets/GlassSurface-DLYYzRdP.js +1 -0
- package/dist/client/assets/HostedConnectionControls-CoVqtnrK.js +1 -0
- package/dist/client/assets/HostedHubRoot-CM2CwPUr.js +2 -0
- package/dist/client/assets/{HostedNativeAuthorizationRoute-BSq_AlY2.js → HostedNativeAuthorizationRoute-Bizmqrh_.js} +2 -2
- package/dist/client/assets/HostedNodeRenameDialog-SXWMsTO0.js +1 -0
- package/dist/client/assets/HostedRelayTrustNotice-BfTyrBi5.js +1 -0
- package/dist/client/assets/InboxStatusGlyph-BPTqzp7l.js +1 -0
- package/dist/client/assets/IntegrationsSettingsPanel-DAPvkV4i.js +1 -0
- package/dist/client/assets/KeybindingsSettings-B8g-YI2O.js +1 -0
- package/dist/client/assets/LazyBrowserPanel-Ds9cdOC_.js +2 -0
- package/dist/client/assets/McpServersSettings-Dw6G3ff3.js +6 -0
- package/dist/client/assets/MobileSheet-DfgXNWbd.js +1 -0
- package/dist/client/assets/ModelTuningDial-DQBAbuNL.js +1 -0
- package/dist/client/assets/NewWorktreeDialog-CDZAJmK6.js +4 -0
- package/dist/client/assets/NodeSecuritySettings-3MELA9ru.js +1 -0
- package/dist/client/assets/NullStore-gT_6_xZE.js +1 -0
- package/dist/client/assets/OnboardingDialog-CAAtNnJf.js +1 -0
- package/dist/client/assets/OpinionatedPluginsSettings-AiDB0Vl4.js +1 -0
- package/dist/client/assets/{PdfAttachmentPreview-CTo1AyZs.js → PdfAttachmentPreview-BFNW2wjN.js} +2 -2
- package/dist/client/assets/{PhoneGetAppInterstitial-DwopOWnQ.js → PhoneGetAppInterstitial-D8fwZ8E9.js} +1 -1
- package/dist/client/assets/PhoneHome-YHgHljA0.js +1 -0
- package/dist/client/assets/PhoneSettingsSurface-BVxJppvK.js +2 -0
- package/dist/client/assets/PreviewPanel-BYcEnkv9.js +643 -0
- package/dist/client/assets/ProjectScriptDialog-K34K2Kzm.js +1 -0
- package/dist/client/assets/ProjectsPage-DXnMYLjb.js +1 -0
- package/dist/client/assets/PromoteChatDialog-CAY7_wJ-.js +1 -0
- package/dist/client/assets/ProviderLimitWindow-CK04BSkM.js +1 -0
- package/dist/client/assets/ProviderUpdateLaunchNotification.logic-BMBrDDOC.js +1 -0
- package/dist/client/assets/ProvidersSettingsPanel-C85PX9Es.js +1 -0
- package/dist/client/assets/PullRequestsPage-C0rgfGwB.js +1 -0
- package/dist/client/assets/{QuitShortcutFeedback-eCvP_MNj.js → QuitShortcutFeedback-DSkKqETs.js} +1 -1
- package/dist/client/assets/RedactedSensitiveText-DQ0YveQd.js +1 -0
- package/dist/client/assets/RollingText-BzvpP5fa.js +1 -0
- package/dist/client/assets/RootAppShell-BYQ-eGNT.js +6 -0
- package/dist/client/assets/{Separator-BiINUUQl.js → Separator-DpiW19Vw.js} +1 -1
- package/dist/client/assets/SettingsPage-BCFN7Ju2.js +2 -0
- package/dist/client/assets/SettingsPanels-CP6z2b1x.js +3 -0
- package/dist/client/assets/SettingsPanels.editor-D8U-TWWG.js +1 -0
- package/dist/client/assets/SettingsSelect-DEhNaz3E.js +1 -0
- package/dist/client/assets/Sidebar.logic-D_ODfSpl.js +1 -0
- package/dist/client/assets/SimulatorPanel-DCT6fZ0X.js +1 -0
- package/dist/client/assets/SourceControlSettings-DxUtvPMK.js +1 -0
- package/dist/client/assets/StatisticsPage-C9SrwtM4.js +1 -0
- package/dist/client/assets/StatisticsPanel-BMYLETs0.js +1 -0
- package/dist/client/assets/ThreadLinkList-BN5z5EpS.js +169 -0
- package/dist/client/assets/ThreadTerminalDrawer-CgIFOlR-.js +18 -0
- package/dist/client/assets/ThreadWorkspacePanel-DvXoqQPF.js +3 -0
- package/dist/client/assets/ToolbarRootContext-8FsV9Cpj.js +1 -0
- package/dist/client/assets/TraitsPicker-DcrpJahy.js +1 -0
- package/dist/client/assets/Virtualizer-CwXeUPla.js +1345 -0
- package/dist/client/assets/WorkspacePullRequestPanel-3mlcJn9G.js +1 -0
- package/dist/client/assets/WorkspaceReview-UGbCgXeK.js +2 -0
- package/dist/client/assets/{abnfDiagram-N423BO3Z-DAmGykdr.js → abnfDiagram-N423BO3Z-DVEM6Scc.js} +1 -1
- package/dist/client/assets/{activity-DRZlu-MC.js → activity-DVCuAejY.js} +1 -1
- package/dist/client/assets/{alert-CwrDisFU.js → alert-FV7ZIit_.js} +1 -1
- package/dist/client/assets/alert-dialog-CgXR9tED.js +1 -0
- package/dist/client/assets/app-window-3xtwqZgI.js +1 -0
- package/dist/client/assets/appChrome-COCz-T7w.js +1 -0
- package/dist/client/assets/{appearancePreferences-nFx4MHoI.js → appearancePreferences-NnsvXwBe.js} +1 -1
- package/dist/client/assets/architecture-7GRP2DOG-DXXb_0_g.js +1 -0
- package/dist/client/assets/{architectureDiagram-T3A2C74G-DypU2ERW.js → architectureDiagram-T3A2C74G-B6pcKiCj.js} +1 -1
- package/dist/client/assets/{arrow-left-XhcJWpRy.js → arrow-left-Blu3LSE2.js} +1 -1
- package/dist/client/assets/{arrow-right-BBs6iTUL.js → arrow-right-CO3CH0ne.js} +1 -1
- package/dist/client/assets/arrow-up-B69gV2Bq.js +1 -0
- package/dist/client/assets/{arrow-up-right-CJ9Vq7nK.js → arrow-up-right-BbPGFOLA.js} +1 -1
- package/dist/client/assets/authorization-Ob6YwWiI.js +1 -0
- package/dist/client/assets/autocomplete-RVpjsrDv.js +1 -0
- package/dist/client/assets/ban-BIm2PVkE.js +1 -0
- package/dist/client/assets/{blockDiagram-VBNYF7ZC-B9MhR9hY.js → blockDiagram-VBNYF7ZC-WNerGp9V.js} +1 -1
- package/dist/client/assets/{bot-D5wgL7pu.js → bot-C9nWtaWq.js} +1 -1
- package/dist/client/assets/browserState-jt47YsqD.js +1 -0
- package/dist/client/assets/{c4Diagram-5PPSVZJV-C22FWSoE.js → c4Diagram-5PPSVZJV-wp1ioOoM.js} +1 -1
- package/dist/client/assets/camera-C13VoW3c.js +1 -0
- package/dist/client/assets/capabilities-CfOhq009.js +1 -0
- package/dist/client/assets/channel-56r2qL2v.js +1 -0
- package/dist/client/assets/{chart-column-D6Lnkklk.js → chart-column-DRv0YtL_.js} +1 -1
- package/dist/client/assets/checkbox-CIIIY9FA.js +1 -0
- package/dist/client/assets/checks-Dw022Bvy.js +1 -0
- package/dist/client/assets/{chunk-2GRJ4B5K-D1tZuCzA.js → chunk-2GRJ4B5K-DRl3ILpc.js} +1 -1
- package/dist/client/assets/{chunk-4I5QYGJK-Clf86zK0.js → chunk-4I5QYGJK-CYTRl4bo.js} +1 -1
- package/dist/client/assets/{chunk-5RXB4S5H-B36N5RYZ.js → chunk-5RXB4S5H-VCNwRsOa.js} +1 -1
- package/dist/client/assets/{chunk-6Q2QTUOP-IAxdzsQJ.js → chunk-6Q2QTUOP-DnSeKGPG.js} +1 -1
- package/dist/client/assets/{chunk-7Z6QIM7H-Ctqebv_4.js → chunk-7Z6QIM7H-Cjilh9TF.js} +1 -1
- package/dist/client/assets/{chunk-GF5L2VYU-CAfciJae.js → chunk-GF5L2VYU-CGR7AW0t.js} +1 -1
- package/dist/client/assets/{chunk-I66GZJ75-BZ7XtZf4.js → chunk-I66GZJ75-CXSn8dDu.js} +1 -1
- package/dist/client/assets/{chunk-JQJVKLGR-DVuZCWnv.js → chunk-JQJVKLGR-Dro-75lU.js} +1 -1
- package/dist/client/assets/{chunk-KBJHAD2P-DtWbzsRm.js → chunk-KBJHAD2P-BDqN2kVf.js} +1 -1
- package/dist/client/assets/{chunk-NSK5VX7P-BVMz_Hc4.js → chunk-NSK5VX7P-DGo5UczH.js} +1 -1
- package/dist/client/assets/{chunk-QR6OTTB3-DWitTCy-.js → chunk-QR6OTTB3-RWuyWnBI.js} +1 -1
- package/dist/client/assets/{chunk-UBXNYLIW-BuxXXP2s.js → chunk-UBXNYLIW-BPRzeB0w.js} +1 -1
- package/dist/client/assets/{chunk-W5SLKNZC-Bnf3sQl4.js → chunk-W5SLKNZC-DYWocTFi.js} +1 -1
- package/dist/client/assets/{chunk-WRU74C26-xu-KDOon.js → chunk-WRU74C26-ChbB1jY3.js} +1 -1
- package/dist/client/assets/circle-stop-D8B4hRpY.js +1 -0
- package/dist/client/assets/circle-x-CNLfrTqR.js +1 -0
- package/dist/client/assets/classDiagram-JCYQIIEL-DGvmFev3.js +1 -0
- package/dist/client/assets/classDiagram-v2-OCEON4UE-DGvmFev3.js +1 -0
- package/dist/client/assets/{clipboard-copy-oDSkUUg4.js → clipboard-copy-DGi8FKNO.js} +1 -1
- package/dist/client/assets/clock-3-DmJ4_XPI.js +1 -0
- package/dist/client/assets/clock-DZIuPtNG.js +1 -0
- package/dist/client/assets/color-picker-BdBXje-a.js +1 -0
- package/dist/client/assets/columns-2-CWlMOClK.js +1 -0
- package/dist/client/assets/combobox-Dtjtf7AB.js +1 -0
- package/dist/client/assets/{cynefin-OW5HDTMX-DGNyiNSf.js → cynefin-OW5HDTMX-TuShvMuM.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-MW4NZA55-_ctibv4i.js → cynefinDiagram-MW4NZA55-B0Edt2Em.js} +1 -1
- package/dist/client/assets/{dagre-VZM6K2ZE-Bo-bS1Y0.js → dagre-VZM6K2ZE-D-eiuqHx.js} +1 -1
- package/dist/client/assets/{data-list-DLsM39Hp.js → data-list-BAx6jBY1.js} +1 -1
- package/dist/client/assets/desktopUpdateAtoms-BjrLa3tl.js +1 -0
- package/dist/client/assets/desktopWorkspace-C2wXVBhc.js +1 -0
- package/dist/client/assets/{deviceName-z0ZWSq0z.js → deviceName-B4youG0v.js} +1 -1
- package/dist/client/assets/{diagram-7IWD3JNH-DSjtw1SY.js → diagram-7IWD3JNH-DgM6lMlR.js} +1 -1
- package/dist/client/assets/{diagram-B4RE2ZJO-B7fWEvIa.js → diagram-B4RE2ZJO-CyHNDjzV.js} +1 -1
- package/dist/client/assets/{diagram-LBJQPF4R-trRYCE5d.js → diagram-LBJQPF4R-DDzuLIN5.js} +1 -1
- package/dist/client/assets/{diagram-Q27KOJAE-_DYcRggk.js → diagram-Q27KOJAE-BaBvK9QB.js} +1 -1
- package/dist/client/assets/{diagram-UB23O5K3-BkMzOHX8.js → diagram-UB23O5K3-CzZ2ewuZ.js} +1 -1
- package/dist/client/assets/dialogWords-Cg0YkJVg.js +1 -0
- package/dist/client/assets/diffRouteSearch-D2MKN_ah.js +1 -0
- package/dist/client/assets/disclosureMotion-cbMJn5-z.js +1 -0
- package/dist/client/assets/{download-CHdS3R_v.js → download-TvtXS4hE.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-BXEA7PRR-DubiOMCG.js → ebnfDiagram-BXEA7PRR-CL1vdOKi.js} +1 -1
- package/dist/client/assets/editorPreferences-DqKyA-2Z.js +1 -0
- package/dist/client/assets/ellipsis-CDK1dNFZ.js +1 -0
- package/dist/client/assets/ellipsis-vertical-CwzEUTwV.js +1 -0
- package/dist/client/assets/{empty-BlBl_Vvw.js → empty-BovKoxbn.js} +1 -1
- package/dist/client/assets/{erDiagram-JOGREHBK-CFDiNfSJ.js → erDiagram-JOGREHBK-DmQR2if6.js} +1 -1
- package/dist/client/assets/eventmodeling-NTZA5JFV-D272GIcY.js +1 -0
- package/dist/client/assets/external-link-CJeVJZ7s.js +1 -0
- package/dist/client/assets/eye-BUmrXqzg.js +1 -0
- package/dist/client/assets/file-diff-BWc3mYsz.js +1 -0
- package/dist/client/assets/flowDiagram-UKHOOZJN-DLyS38Mm.js +1 -0
- package/dist/client/assets/folder-git-2-CPxg5wKP.js +1 -0
- package/dist/client/assets/folder-open-DcMymvp1.js +1 -0
- package/dist/client/assets/formatCount-B4KLI651.js +1 -0
- package/dist/client/assets/{ganttDiagram-PKOTCBZU-DT2XhE-m.js → ganttDiagram-PKOTCBZU-1q2nUL92.js} +1 -1
- package/dist/client/assets/git-pull-request-BFPwpm3c.js +1 -0
- package/dist/client/assets/{gitGraph-4MIJSDKK-BI5UGiqb.js → gitGraph-4MIJSDKK-COtwmv2S.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-DS77QQ5N-CzAB97Rd.js → gitGraphDiagram-DS77QQ5N-ChsvaxX4.js} +1 -1
- package/dist/client/assets/{group-DZJuSiJL.js → group-DWWn0dTx.js} +1 -1
- package/dist/client/assets/hammer-BXo-EU88.js +1 -0
- package/dist/client/assets/hostedConnectionCoordinator-BkAE-RhA.js +1 -0
- package/dist/client/assets/hostedPairing-5n5srRC9.js +1 -0
- package/dist/client/assets/{index-BAJdq3TK.js → index-DARIYokI.js} +2 -2
- package/dist/client/assets/{info-A6RAGUB7-DdGYYgLX.js → info-A6RAGUB7-CI2qZ9wW.js} +1 -1
- package/dist/client/assets/{infoDiagram-6WML65LV-zhUpER6a.js → infoDiagram-6WML65LV-BPmgcTPH.js} +1 -1
- package/dist/client/assets/{input-CzU08wbL.js → input-CCie4mm1.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-WSZJBQD7-BQLkqykE.js → ishikawaDiagram-WSZJBQD7-LyS9p3Yg.js} +1 -1
- package/dist/client/assets/{journeyDiagram-NVQOT4AX-DBgsbKOF.js → journeyDiagram-NVQOT4AX-BYaAmN65.js} +1 -1
- package/dist/client/assets/{kanban-definition-27J2QSJJ-DF-Rr-xs.js → kanban-definition-27J2QSJJ-D-pwzqFt.js} +1 -1
- package/dist/client/assets/{key-round-CvyrSjb2.js → key-round-BlrUTfxB.js} +1 -1
- package/dist/client/assets/keyboard-DlBdq6sz.js +1 -0
- package/dist/client/assets/label-ChtVI9lp.js +1 -0
- package/dist/client/assets/layers-BB-ruGvd.js +1 -0
- package/dist/client/assets/lifecycleSuggestionPolicy-0ERe_O53.js +1 -0
- package/dist/client/assets/list-checks-BkM_ZRsj.js +1 -0
- package/dist/client/assets/loader-3vQnfqIT.js +1 -0
- package/dist/client/assets/{log-out-D3rICSt5.js → log-out-CKq9YiLY.js} +1 -1
- package/dist/client/assets/{logging-C6tXZlGQ.js → logging-CCg76rgn.js} +1 -1
- package/dist/client/assets/main-Ch0bwS-M.js +9 -0
- package/dist/client/assets/main-Di0isH9D.css +2 -0
- package/dist/client/assets/{mermaid-parser.core-BiGKtilP.js → mermaid-parser.core-RK9ah5RM.js} +2 -2
- package/dist/client/assets/{mermaidEngine-Cjfgf3Bg.js → mermaidEngine-Dr8UsPhH.js} +3 -3
- package/dist/client/assets/message-circle-dashed-BrjwqS7-.js +1 -0
- package/dist/client/assets/messageQueueDrain-B7R7Qmq6.js +1 -0
- package/dist/client/assets/messages-square-cDTkDJv_.js +1 -0
- package/dist/client/assets/{mindmap-definition-FAOFIHXS-SiU9JwWJ.js → mindmap-definition-FAOFIHXS-DVudWasx.js} +1 -1
- package/dist/client/assets/{packet-AYTQ26CC-F-HuW5Dr.js → packet-AYTQ26CC-DnkTsVhD.js} +1 -1
- package/dist/client/assets/{pairingUrl-rQM9kSGT.js → pairingUrl-Dn1e2CVw.js} +1 -1
- package/dist/client/assets/panels-top-left-B7jZiLth.js +1 -0
- package/dist/client/assets/path-text-3Rfu6lt8.js +1 -0
- package/dist/client/assets/{pegDiagram-VL7TDLO6-cC-QUd7I.js → pegDiagram-VL7TDLO6-Do5PIp8B.js} +1 -1
- package/dist/client/assets/pencil-Bzg-nc6d.js +1 -0
- package/dist/client/assets/{pie-WAS4IAKB-BI3XUcLN.js → pie-WAS4IAKB-B_nNQOzn.js} +1 -1
- package/dist/client/assets/{pieDiagram-7S7Q4E2Y-BP4gJ4ZK.js → pieDiagram-7S7Q4E2Y-D_IG4xwA.js} +1 -1
- package/dist/client/assets/{play-BJZrOx6T.js → play-DpXXQ1qB.js} +1 -1
- package/dist/client/assets/popover-OWEv6cQz.js +48 -0
- package/dist/client/assets/presentationTier-DPVAxTK4.js +1 -0
- package/dist/client/assets/previewRouteSearch-BjZdTuSf.js +1 -0
- package/dist/client/assets/primary-Cf-xJExj.js +4 -0
- package/dist/client/assets/primitives-CxTBN7D4.js +1 -0
- package/dist/client/assets/projectCheckouts.logic-DUT4AxXr.js +1 -0
- package/dist/client/assets/projectPaths-B8aVmOZX.js +1 -0
- package/dist/client/assets/projectPreferences-CzWBItFj.js +1 -0
- package/dist/client/assets/providerCapabilities-B2YOPsLN.js +1 -0
- package/dist/client/assets/providerDriverMeta-BHHL9uw0.js +1 -0
- package/dist/client/assets/providerModels-v9PYbzRE.js +1 -0
- package/dist/client/assets/providerStatus-CDPaqb0S.js +1 -0
- package/dist/client/assets/pullRequestsModel.logic-Dv_om_C4.js +1 -0
- package/dist/client/assets/{qr-code-BFO8lV1M.js → qr-code-BlbiBIwH.js} +1 -1
- package/dist/client/assets/{qr-code-Cmfz5JKf.js → qr-code-DywzVgQC.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-CIZ2JOQS-DO-N1m-q.js → quadrantDiagram-CIZ2JOQS-DY6fJyrM.js} +1 -1
- package/dist/client/assets/{radar-RG4KPBEZ-CfayXQ5F.js → radar-RG4KPBEZ-D9689I5m.js} +1 -1
- package/dist/client/assets/radio-group-DVwD6Cuy.js +1 -0
- package/dist/client/assets/{railroad-74A4TZTK-CT6f-etT.js → railroad-74A4TZTK-DVzWbQnl.js} +1 -1
- package/dist/client/assets/railroad-abnf-HS5TGJTU-C_2P6umA.js +1 -0
- package/dist/client/assets/railroad-ebnf-LZEXJU2U-aGlR3R3z.js +1 -0
- package/dist/client/assets/railroad-peg-WCYAUIDC-DCB9oE8y.js +1 -0
- package/dist/client/assets/{railroadDiagram-AXF67PYL-DC8egbob.js → railroadDiagram-AXF67PYL-D1oJ6Jtl.js} +1 -1
- package/dist/client/assets/readCache-B7cDPz2O.js +1 -0
- package/dist/client/assets/{refresh-cw-K_hU8_ld.js → refresh-cw-CRUTivd6.js} +1 -1
- package/dist/client/assets/{requirementDiagram-LRYGKXZP-DJMzcLk_.js → requirementDiagram-LRYGKXZP-7RM8iREp.js} +1 -1
- package/dist/client/assets/rotate-ccw-BE2ZCwL6.js +1 -0
- package/dist/client/assets/roving-radio-group-NMPWrDqe.js +1 -0
- package/dist/client/assets/rows-2-DDS4dGTX.js +1 -0
- package/dist/client/assets/runtime-DjjjAcTE.js +18 -0
- package/dist/client/assets/safePolygon-C1AzMRS4.js +1 -0
- package/dist/client/assets/{sankeyDiagram-W5VNT64P-YR6aIYLj.js → sankeyDiagram-W5VNT64P-C1tKAPGN.js} +1 -1
- package/dist/client/assets/{save-Mh-PA_2P.js → save-OZdkPs_y.js} +1 -1
- package/dist/client/assets/scroll-area-80P7vbjw.js +1 -0
- package/dist/client/assets/{scrollEdges-Zcpuz3un.js → scrollEdges-C0Oc-5qi.js} +1 -1
- package/dist/client/assets/select-Cb9FUPHD.js +1 -0
- package/dist/client/assets/separator-CO8bC7Wc.js +1 -0
- package/dist/client/assets/{sequenceDiagram-SI44F4Z6-BVeSqWDA.js → sequenceDiagram-SI44F4Z6-DGVpb7jL.js} +1 -1
- package/dist/client/assets/settings-2-PrRDu6Lc.js +1 -0
- package/dist/client/assets/settingsLayout-CRFNCk_D.js +1 -0
- package/dist/client/assets/sheet-C5DW7qVO.js +1 -0
- package/dist/client/assets/{shield-i098Bm_B.js → shield-CBHYqlkR.js} +1 -1
- package/dist/client/assets/{shield-alert-CXmR7fM9.js → shield-alert-Dc2cGwyR.js} +1 -1
- package/dist/client/assets/{shield-check-CdFhWT_o.js → shield-check-_wl7R4Js.js} +1 -1
- package/dist/client/assets/sidebar-0BBaFNm3.js +1 -0
- package/dist/client/assets/sidebarProjectFolders-BjWzbt8C.js +3 -0
- package/dist/client/assets/sidebarProjectGrouping-nQRStWrZ.js +1 -0
- package/dist/client/assets/sidebarStatusText-BBKuNies.js +1 -0
- package/dist/client/assets/sidebarUndo-Dfq1lvyF.js +1 -0
- package/dist/client/assets/{skeleton-BwFgUtuE.js → skeleton-DfUe6VV_.js} +1 -1
- package/dist/client/assets/sliders-horizontal-BGXkwvKv.js +1 -0
- package/dist/client/assets/sliding-tabs-BnDSjRU3.js +39 -0
- package/dist/client/assets/{smartphone-DGfizz51.js → smartphone-OEAQOTdv.js} +1 -1
- package/dist/client/assets/spinner-lHRJWsym.js +1 -0
- package/dist/client/assets/square-B05NKv3e.js +1 -0
- package/dist/client/assets/{star-J3x3fktG.js → star-C8mHmfZu.js} +1 -1
- package/dist/client/assets/{stateDiagram-OKZ733FA-DoIZN669.js → stateDiagram-OKZ733FA-CCOAegCG.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-UEYNNEHI-D60qqBed.js +1 -0
- package/dist/client/assets/storeSelectors-BichCKDC.js +1 -0
- package/dist/client/assets/surfaceMorph-BTRijmlU.js +1 -0
- package/dist/client/assets/{swimlanes-SLNWSIFB-BoFLigyK.js → swimlanes-SLNWSIFB-CFsLYT4h.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-D0SaJgSn.js +8 -0
- package/dist/client/assets/switch-oQc7Ifbl.js +1 -0
- package/dist/client/assets/text-wrap-DSRdSfDm.js +1 -0
- package/dist/client/assets/textarea-VyiIZ0wQ.js +1 -0
- package/dist/client/assets/threadPriorityRefreshRuntime-H656C1J_.js +1 -0
- package/dist/client/assets/ticker-CPutfhZ4.js +1 -0
- package/dist/client/assets/{timeline-definition-Z64GVDOM-D65EmNWc.js → timeline-definition-Z64GVDOM-B4agmO7R.js} +1 -1
- package/dist/client/assets/toggle-DFqtCPt-.js +1 -0
- package/dist/client/assets/toggle-group-C5ICmqkI.js +1 -0
- package/dist/client/assets/{tokenModePresentation-C0-NgmX5.js → tokenModePresentation-umDRm4k1.js} +1 -1
- package/dist/client/assets/tooltip-DbqhseXd.js +1 -0
- package/dist/client/assets/{treeView-Q6P3EWNA-C2S-OPgI.js → treeView-Q6P3EWNA-C_S3udFB.js} +1 -1
- package/dist/client/assets/{treemap-WGGIJYW6-6Ovsu9iH.js → treemap-WGGIJYW6-B-kUSAkE.js} +1 -1
- package/dist/client/assets/undo-2-lyluTGMW.js +1 -0
- package/dist/client/assets/{unplug-BEfcl9Ht.js → unplug-D6iu-qlh.js} +1 -1
- package/dist/client/assets/usage-ClF-eUmy.js +1 -0
- package/dist/client/assets/useActiveIndicator-R5NWu8Fg.js +1 -0
- package/dist/client/assets/useAppSidebarCollapsed-BbMxfio5.js +1 -0
- package/dist/client/assets/useAppearancePreference-Ix13pMKy.js +1 -0
- package/dist/client/assets/useAtlassian-BYDCc9lv.js +0 -0
- package/dist/client/assets/useCheckoutResolution-CR-oOp5-.js +1 -0
- package/dist/client/assets/useDesktopRelaunchGuard-Jmh615iZ.js +1 -0
- package/dist/client/assets/useDiffFileNavigation-DeuzdD5E.js +15 -0
- package/dist/client/assets/useDiffLayout-DhcXwhBL.js +1 -0
- package/dist/client/assets/useEnvironmentSettingsTarget-DM6BRDT7.js +1 -0
- package/dist/client/assets/useFocus-CV0KIZwg.js +1 -0
- package/dist/client/assets/useGit-CUcs7h5_.js +1 -0
- package/dist/client/assets/useGitBranchSearch-CeKFtnCL.js +1 -0
- package/dist/client/assets/useHostedDraftExecutionTarget-DvQU5UOq.js +1 -0
- package/dist/client/assets/useLabelableId-CEgCRi6q.js +1 -0
- package/dist/client/assets/useLandingFlash-BfOOlFtW.js +1 -0
- package/dist/client/assets/useLogicalProjectSnapshots-CRNZke74.js +1 -0
- package/dist/client/assets/useNavigate-sQZthdyT.js +1 -0
- package/dist/client/assets/usePageLeadingInsetClass-Bf4nUvx4.js +1 -0
- package/dist/client/assets/usePhoneThreadActions-VaQ-mZex.js +1 -0
- package/dist/client/assets/usePopupHandleStore-DimKo2Yy.js +1 -0
- package/dist/client/assets/usePopupViewport-YeqX_UM3.js +1 -0
- package/dist/client/assets/usePresentationTier-B9kCQ4YH.js +1 -0
- package/dist/client/assets/useProject-Kt74Z12J.js +1 -0
- package/dist/client/assets/useProviderOptionsUpdater-CTzNh2B7.js +2 -0
- package/dist/client/assets/usePullRequestFilesViewed-D5Snmzys.js +1 -0
- package/dist/client/assets/usePullRequestsModel-DJL5HHbP.js +40 -0
- package/dist/client/assets/useScrollLock-CLZ31xsK.js +1 -0
- package/dist/client/assets/useSidebarThreadActions-n6EkLATf.js +6 -0
- package/dist/client/assets/{useStatistics-D55-xLMz.js → useStatistics-DD0mYS4J.js} +14 -14
- package/dist/client/assets/{useTheme-B441xg4F.js → useTheme-Bdy-BDs-.js} +1 -1
- package/dist/client/assets/useValueChanged-DoumqMnV.js +1 -0
- package/dist/client/assets/{user-round-C-U7TZKG.js → user-round-BPDXr8Gq.js} +1 -1
- package/dist/client/assets/{vennDiagram-T6HMQDX7-fZAexcYr.js → vennDiagram-T6HMQDX7-B1UEn_j_.js} +1 -1
- package/dist/client/assets/{vscode-icons-BYX6fBsM.js → vscode-icons-Ccy-gzFN.js} +1 -1
- package/dist/client/assets/{wardley-WFR3VGLG-gdYWSMxK.js → wardley-WFR3VGLG-gPdyDc-7.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-T6FBY63Y-iDJxQb70.js → wardleyDiagram-T6FBY63Y-2aDcwOA4.js} +1 -1
- package/dist/client/assets/workspaceLifecycle-OJ1aKksw.js +3 -0
- package/dist/client/assets/workspaceMetadataProjection-CyEyJhUa.js +1 -0
- package/dist/client/assets/workspaceRouteSearch-CCavUdbH.js +1 -0
- package/dist/client/assets/{wrench-D79uBUSl.js → wrench-CPUCA_rn.js} +1 -1
- package/dist/client/assets/wsTransport-C88seBPA.js +15 -0
- package/dist/client/assets/{xychartDiagram-ELKLHX3M-B4cfMwpJ.js → xychartDiagram-ELKLHX3M-C1_7Q-1i.js} +1 -1
- package/dist/client/favicon.svg +1 -1
- package/dist/client/index.html +1 -1
- package/dist/collectUint8StreamText-BsLSgI8i.mjs +710 -0
- package/dist/collectUint8StreamText-D5olwfpM.cjs +757 -0
- package/dist/{deviceHostWorker-L8C9wy38.mjs → deviceHostWorker-B-Dn-6An.mjs} +1 -1
- package/dist/{deviceHostWorker-CYnrwfrv.cjs → deviceHostWorker-D4HauWIV.cjs} +1 -1
- package/dist/{makeManagedServerProvider-CUwxc0Pn.cjs → makeManagedServerProvider-B5tP7tvg.cjs} +2 -2
- package/dist/{makeManagedServerProvider-B_lPFNpL.mjs → makeManagedServerProvider-B65ipCxM.mjs} +2 -2
- package/dist/resource-monitor/linux-arm64/ryco-resource-monitor +0 -0
- package/dist/resource-monitor/ryco-resource-monitor +0 -0
- package/dist/resource-monitor/ryco-resource-monitor.exe +0 -0
- package/dist/resource-monitor/win32-arm64/ryco-resource-monitor.exe +0 -0
- package/dist/resource-monitor/win32-x64/ryco-resource-monitor.exe +0 -0
- package/dist/{rolldown-runtime-LGfotAqq.cjs → rolldown-runtime-HbSU0i7K.cjs} +7 -0
- package/dist/{runtimeSession-V3RIy8Ao.mjs → runtimeSession-D_BZ-wRH.mjs} +1 -1
- package/dist/{src-BzVJd3Me.cjs → src-FmeCeBJ9.cjs} +3408 -308
- package/dist/{src-7E1M4gTQ.mjs → src-VTj60bUm.mjs} +2154 -140
- package/package.json +1 -1
- package/dist/AzureDevOpsSourceControlProvider-DmJD1-WL.cjs +0 -190
- package/dist/AzureDevOpsSourceControlProvider-d5Ogsspk.mjs +0 -188
- package/dist/GitLabSourceControlProvider-BZdwXdJl.mjs +0 -186
- package/dist/GitLabSourceControlProvider-CrcBR6KQ.cjs +0 -188
- package/dist/client/assets/AccountSettings-FN7pwqYA.js +0 -1
- package/dist/client/assets/AiFocusSettings-xcDAMaqH.js +0 -1
- package/dist/client/assets/AppearanceSettings-BvsvAOsG.js +0 -1
- package/dist/client/assets/BranchToolbar.logic-DFsXV3Qs.js +0 -3
- package/dist/client/assets/BrowserPanel-D-g_xDZs.js +0 -1
- package/dist/client/assets/ChatRightPanel-Bm906qNi.js +0 -201
- package/dist/client/assets/ChatThreadRouteView-CATwakjI.js +0 -1
- package/dist/client/assets/CommandPaletteDialog-Obv1bvxj.js +0 -1
- package/dist/client/assets/CompositeRoot-CfkIdky8.js +0 -1
- package/dist/client/assets/ComputerUseSettings-ljYmTHea.js +0 -1
- package/dist/client/assets/ConnectionsSettings-CIXs7x_E.js +0 -7
- package/dist/client/assets/ContextHandoffEndpointLabel-BzI4Wi1i.js +0 -4
- package/dist/client/assets/DiagnosticsSettings-DGX_2T2M.js +0 -2
- package/dist/client/assets/DialogHandle-CTtSYpsC.js +0 -1
- package/dist/client/assets/DialogRoot-k2_0SNKA.js +0 -1
- package/dist/client/assets/DialogTitle-Du7CAbaO.js +0 -1
- package/dist/client/assets/DialogTrigger-VpFh8Xza.js +0 -1
- package/dist/client/assets/DraftChatThreadRouteView-Cmc5HpWf.js +0 -1
- package/dist/client/assets/GlassSurface-BlWIlQ0s.js +0 -1
- package/dist/client/assets/HostedConnectionControls-ySHqwr4K.js +0 -1
- package/dist/client/assets/HostedHubRoot-Caz8PElK.js +0 -2
- package/dist/client/assets/HostedNodeRenameDialog-ChxJdr-Z.js +0 -1
- package/dist/client/assets/HostedRelayTrustNotice-DPVrIfj_.js +0 -1
- package/dist/client/assets/IntegrationsSettingsPanel-eAq5h-D5.js +0 -2
- package/dist/client/assets/KeybindingsSettings-D1XaEVGH.js +0 -7
- package/dist/client/assets/LazyBrowserPanel-B6POLJh3.js +0 -2
- package/dist/client/assets/McpServersSettings-DqLA6n5v.js +0 -6
- package/dist/client/assets/MobileSheet-CtQIYRlY.js +0 -1
- package/dist/client/assets/NodeSecuritySettings-Skm7GQDl.js +0 -1
- package/dist/client/assets/NullStore-b8PhjwPZ.js +0 -1
- package/dist/client/assets/OnboardingDialog-8-fKvY5H.js +0 -1
- package/dist/client/assets/OpinionatedPluginsSettings-BIJfJ34L.js +0 -1
- package/dist/client/assets/PhoneHome-CUzxhhR4.js +0 -1
- package/dist/client/assets/PhoneSettingsSurface-BK2RHmYJ.js +0 -2
- package/dist/client/assets/ProvidersSettingsPanel-DPxL7AsR.js +0 -1
- package/dist/client/assets/RedactedSensitiveText-DH4mWpB6.js +0 -1
- package/dist/client/assets/RootAppShell-DwiWD4Cy.js +0 -7
- package/dist/client/assets/SettingsDialog-CE8qy0qL.js +0 -2
- package/dist/client/assets/SettingsPanels-BYknk6GO.js +0 -3
- package/dist/client/assets/SettingsPanels.editor-64bM0lhg.js +0 -2
- package/dist/client/assets/SourceControlSettings-BbveiAj3.js +0 -1
- package/dist/client/assets/StatisticsPage-CAO_tCeC.js +0 -1
- package/dist/client/assets/StatisticsPanel-SNlgMv2o.js +0 -1
- package/dist/client/assets/StatisticsSettingsLink-BpkNubL2.js +0 -1
- package/dist/client/assets/ThreadTerminalDrawer-9x_kqQPy.js +0 -18
- package/dist/client/assets/ThreadWorkspacePanel-BXE17C4x.js +0 -2073
- package/dist/client/assets/appChrome-B_VWWDFj.js +0 -1
- package/dist/client/assets/architecture-7GRP2DOG-CQNNG5gU.js +0 -1
- package/dist/client/assets/authorization-BugIGt5e.js +0 -1
- package/dist/client/assets/badge-BswOCwph.js +0 -1
- package/dist/client/assets/capabilities-Bj_X9FZ-.js +0 -1
- package/dist/client/assets/channel-BtX-w3CK.js +0 -1
- package/dist/client/assets/chevron-right-Ddq5gL-L.js +0 -1
- package/dist/client/assets/classDiagram-JCYQIIEL-BgDa3HFl.js +0 -1
- package/dist/client/assets/classDiagram-v2-OCEON4UE-BgDa3HFl.js +0 -1
- package/dist/client/assets/compiler-runtime-C4g8XhC5.js +0 -1
- package/dist/client/assets/desktopWorkspace-Ocqt625W.js +0 -1
- package/dist/client/assets/editorPreferences-DVhg0CXd.js +0 -1
- package/dist/client/assets/eventmodeling-NTZA5JFV-DpzGHjmu.js +0 -1
- package/dist/client/assets/flowDiagram-UKHOOZJN-CaDVMm72.js +0 -1
- package/dist/client/assets/hostedConnectionCoordinator-BztHfGNt.js +0 -1
- package/dist/client/assets/hostedPairing-CqhLPQqG.js +0 -1
- package/dist/client/assets/hubRoutes-DExWSvVE.js +0 -1
- package/dist/client/assets/kbd-DKuvGqFP.js +0 -1
- package/dist/client/assets/layers-CwP65mnC.js +0 -1
- package/dist/client/assets/liquidGlass-CA2o_Cq0.js +0 -1
- package/dist/client/assets/liquidGlass.worker-icvLJKHf.js +0 -1
- package/dist/client/assets/main-BqSANuAs.css +0 -2
- package/dist/client/assets/main-RFllWEko.js +0 -9
- package/dist/client/assets/motion-C9rN_t9p.js +0 -1
- package/dist/client/assets/palette-gaqgtube.js +0 -1
- package/dist/client/assets/perfInstrumentation-BT27w4tn.js +0 -1
- package/dist/client/assets/presentationTier-xlIjcFab.js +0 -1
- package/dist/client/assets/primary-CQh_KHGG.js +0 -5
- package/dist/client/assets/providerDriverMeta-LJ2vJxm-.js +0 -1
- package/dist/client/assets/providerStatus-DBGvvkyF.js +0 -1
- package/dist/client/assets/radio-group-BueX1AVO.js +0 -1
- package/dist/client/assets/railroad-abnf-HS5TGJTU-B890iayj.js +0 -1
- package/dist/client/assets/railroad-ebnf-LZEXJU2U-C079Tzw6.js +0 -1
- package/dist/client/assets/railroad-peg-WCYAUIDC-DxvOX5Rh.js +0 -1
- package/dist/client/assets/runtime-OM-uAtaj.js +0 -18
- package/dist/client/assets/scroll-area-BC-LB_zE.js +0 -1
- package/dist/client/assets/separator-yx1r9ZDw.js +0 -1
- package/dist/client/assets/settingsLayout-BbjDM-p0.js +0 -1
- package/dist/client/assets/sheet-CpEwjOWn.js +0 -1
- package/dist/client/assets/sidebar-DayQTDZp.js +0 -1
- package/dist/client/assets/sidebarProjectFolders-DXqx3OlZ.js +0 -4
- package/dist/client/assets/sidebarStatusText-kdA6QMZS.js +0 -1
- package/dist/client/assets/sidebarUndo-BHFfJj0k.js +0 -1
- package/dist/client/assets/square-Cd2WS1gv.js +0 -1
- package/dist/client/assets/src-DHNjfMxR.js +0 -14
- package/dist/client/assets/stateDiagram-v2-UEYNNEHI-BnzsGHaN.js +0 -1
- package/dist/client/assets/storeSelectors-D60AAN01.js +0 -1
- package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-BnA-oDvU.js +0 -8
- package/dist/client/assets/switch-D9inWKdd.js +0 -48
- package/dist/client/assets/toggle-group-YNqzWsK0.js +0 -1
- package/dist/client/assets/toggle-wMq3LLn1.js +0 -1
- package/dist/client/assets/tooltip-mwOCSCXF.js +0 -1
- package/dist/client/assets/usage-DF8oQrsy.js +0 -1
- package/dist/client/assets/useAppSidebarCollapsed-C0jpPtER.js +0 -1
- package/dist/client/assets/useAppearancePreference-Dlh9P8iu.js +0 -1
- package/dist/client/assets/useBaseUiId-Bz8dcyjd.js +0 -1
- package/dist/client/assets/useLabelableId-C8bc9a0F.js +0 -1
- package/dist/client/assets/useNavigate-01O5dMQe.js +0 -1
- package/dist/client/assets/usePhoneThreadActions-BIdh81kF.js +0 -1
- package/dist/client/assets/usePopupViewport-DYYZwfTW.js +0 -1
- package/dist/client/assets/usePresentationTier-hxB7Yv_Q.js +0 -1
- package/dist/client/assets/useScrollLock-BO185DkJ.js +0 -1
- package/dist/client/assets/useTriggerFocusGuards-CMLVr18J.js +0 -1
- package/dist/client/assets/useValueChanged-DSyRHPje.js +0 -1
- package/dist/client/assets/workspaceMetadataProjection-So9-wSEZ.js +0 -1
- package/dist/collectUint8StreamText-BAUF-vzz.mjs +0 -37
- package/dist/collectUint8StreamText-vagpNUMJ.cjs +0 -42
- package/dist/git-BKwGfw8A.mjs +0 -132
- package/dist/git-Dn5wrgFY.cjs +0 -218
- package/dist/sourceControl-B0D1Op29.cjs +0 -253
- package/dist/sourceControl-BiEBxN01.mjs +0 -224
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const require_rolldown_runtime = require("./rolldown-runtime-
|
|
4
|
-
const require_src = require("./src-
|
|
3
|
+
const require_rolldown_runtime = require("./rolldown-runtime-HbSU0i7K.cjs");
|
|
4
|
+
const require_src = require("./src-FmeCeBJ9.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 ../../
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* friendly name; the routing slug remains the deterministic final fallback.
|
|
51
|
+
* @param {any} value
|
|
52
|
+
* @returns {string}
|
|
40
53
|
*/
|
|
41
|
-
function
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
92
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
const { currentValue: _unusedCurrentValue, ...rest } = descriptor;
|
|
105
|
-
return rest;
|
|
90
|
+
toString() {
|
|
91
|
+
return `Type[${this.major}].${this.name}`;
|
|
106
92
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
-
*
|
|
151
|
-
*
|
|
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
|
-
*
|
|
158
|
-
*
|
|
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
|
|
165
|
-
|
|
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
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
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
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
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
|
-
*
|
|
216
|
-
*
|
|
217
|
-
* surviving a reset patch that intentionally omits options.
|
|
241
|
+
* @param {string} str
|
|
242
|
+
* @returns {number[]}
|
|
218
243
|
*/
|
|
219
|
-
function
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
for (
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
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
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
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
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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
|
-
|
|
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
|
-
*
|
|
345
|
-
*
|
|
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
|
-
|
|
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 {
|
|
356
|
-
* @param {string} name
|
|
357
|
-
* @param {boolean} terminal
|
|
384
|
+
* @param {Uint8Array<T>} dest
|
|
358
385
|
*/
|
|
359
|
-
constructor(
|
|
360
|
-
this.
|
|
361
|
-
|
|
362
|
-
this.
|
|
363
|
-
|
|
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
|
-
|
|
366
|
-
|
|
393
|
+
reset() {
|
|
394
|
+
this.cursor = 0;
|
|
367
395
|
}
|
|
368
396
|
/**
|
|
369
|
-
* @param {
|
|
370
|
-
* @returns {number}
|
|
397
|
+
* @param {number} byte
|
|
371
398
|
*/
|
|
372
|
-
|
|
373
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
384
|
-
|
|
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 {
|
|
403
|
-
* @
|
|
404
|
-
* @param {number} [encodedLength]
|
|
412
|
+
* @param {boolean} [reset]
|
|
413
|
+
* @returns {Uint8Array<T>}
|
|
405
414
|
*/
|
|
406
|
-
|
|
407
|
-
this.
|
|
408
|
-
this.
|
|
409
|
-
|
|
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/
|
|
421
|
-
const
|
|
422
|
-
const
|
|
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
|
-
* @
|
|
425
|
-
* @
|
|
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
|
-
* @
|
|
429
|
-
* @
|
|
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 {
|
|
436
|
-
* @
|
|
453
|
+
* @param {Uint8Array} data
|
|
454
|
+
* @param {number} offset
|
|
455
|
+
* @param {DecodeOptions} options
|
|
456
|
+
* @returns {number}
|
|
437
457
|
*/
|
|
438
|
-
function
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
|
|
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 {
|
|
465
|
+
* @param {Uint8Array} data
|
|
466
|
+
* @param {number} offset
|
|
467
|
+
* @param {DecodeOptions} options
|
|
468
|
+
* @returns {number}
|
|
449
469
|
*/
|
|
450
|
-
(
|
|
451
|
-
|
|
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
|
-
*
|
|
455
|
-
* @param {number
|
|
456
|
-
* @
|
|
477
|
+
* @param {Uint8Array} data
|
|
478
|
+
* @param {number} offset
|
|
479
|
+
* @param {DecodeOptions} options
|
|
480
|
+
* @returns {number}
|
|
457
481
|
*/
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
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}
|
|
467
|
-
* @param {number}
|
|
468
|
-
* @param {
|
|
489
|
+
* @param {Uint8Array} data
|
|
490
|
+
* @param {number} offset
|
|
491
|
+
* @param {DecodeOptions} options
|
|
492
|
+
* @returns {number|bigint}
|
|
469
493
|
*/
|
|
470
|
-
(
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
const
|
|
474
|
-
|
|
475
|
-
|
|
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 {
|
|
479
|
-
* @param {number}
|
|
480
|
-
* @
|
|
505
|
+
* @param {Uint8Array} data
|
|
506
|
+
* @param {number} pos
|
|
507
|
+
* @param {number} _minor
|
|
508
|
+
* @param {DecodeOptions} options
|
|
509
|
+
* @returns {Token}
|
|
481
510
|
*/
|
|
482
|
-
(
|
|
483
|
-
|
|
484
|
-
|
|
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 {
|
|
497
|
-
* @
|
|
515
|
+
* @param {Uint8Array} data
|
|
516
|
+
* @param {number} pos
|
|
517
|
+
* @param {number} _minor
|
|
518
|
+
* @param {DecodeOptions} options
|
|
519
|
+
* @returns {Token}
|
|
498
520
|
*/
|
|
499
|
-
(
|
|
500
|
-
return new
|
|
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}
|
|
504
|
-
* @param {
|
|
505
|
-
* @
|
|
525
|
+
* @param {Uint8Array} data
|
|
526
|
+
* @param {number} pos
|
|
527
|
+
* @param {number} _minor
|
|
528
|
+
* @param {DecodeOptions} options
|
|
529
|
+
* @returns {Token}
|
|
506
530
|
*/
|
|
507
|
-
function
|
|
508
|
-
|
|
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 {
|
|
517
|
-
* @
|
|
535
|
+
* @param {Uint8Array} data
|
|
536
|
+
* @param {number} pos
|
|
537
|
+
* @param {number} _minor
|
|
538
|
+
* @param {DecodeOptions} options
|
|
539
|
+
* @returns {Token}
|
|
518
540
|
*/
|
|
519
|
-
function
|
|
520
|
-
|
|
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
|
-
*
|
|
547
|
-
*
|
|
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
|
-
* @
|
|
563
|
-
* @
|
|
552
|
+
* @param {ByteWriter} writer
|
|
553
|
+
* @param {number} major
|
|
554
|
+
* @param {number|bigint} uint
|
|
564
555
|
*/
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
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 {
|
|
729
|
-
* @param {number} offset
|
|
730
|
-
* @param {DecodeOptions} options
|
|
613
|
+
* @param {Token} token
|
|
731
614
|
* @returns {number}
|
|
732
615
|
*/
|
|
733
|
-
function
|
|
734
|
-
|
|
735
|
-
|
|
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 {
|
|
741
|
-
* @param {number} offset
|
|
742
|
-
* @param {DecodeOptions} options
|
|
620
|
+
* @param {number} uint
|
|
743
621
|
* @returns {number}
|
|
744
622
|
*/
|
|
745
|
-
function
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
if (
|
|
749
|
-
return
|
|
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 {
|
|
753
|
-
* @param {
|
|
754
|
-
* @param {DecodeOptions} options
|
|
631
|
+
* @param {Token} tok1
|
|
632
|
+
* @param {Token} tok2
|
|
755
633
|
* @returns {number}
|
|
756
634
|
*/
|
|
757
|
-
function
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
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
|
-
* @
|
|
765
|
-
* @
|
|
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
|
|
787
|
-
return new Token(Type.
|
|
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
|
|
797
|
-
return new Token(Type.
|
|
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
|
|
807
|
-
return new Token(Type.
|
|
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
|
|
817
|
-
|
|
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
|
|
824
|
-
|
|
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 {
|
|
828
|
-
* @
|
|
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;
|
|
@@ -2520,305 +2245,604 @@ function* tokenToMapEntries(token, tokeniser, options) {
|
|
|
2520
2245
|
if (value === DONE) throw new Error(`${decodeErrPrefix} found map but not enough entries (got ${i} [no value], expected ${token.value})`);
|
|
2521
2246
|
yield [key, value];
|
|
2522
2247
|
}
|
|
2523
|
-
}
|
|
2524
|
-
/**
|
|
2525
|
-
* Creates a TagDecodeControl object for tag decoders.
|
|
2526
|
-
* @param {DecodeTokenizer} tokeniser
|
|
2527
|
-
* @param {DecodeOptions} options
|
|
2528
|
-
* @returns {TagDecodeControl}
|
|
2529
|
-
*/
|
|
2530
|
-
function createTagDecodeControl(tokeniser, options) {
|
|
2531
|
-
/** @type {TagDecodeControl & {_called: boolean}} */
|
|
2532
|
-
const decode = function() {
|
|
2533
|
-
if (decode._called) throw new Error(`${decodeErrPrefix} tag decode() may only be called once`);
|
|
2534
|
-
decode._called = true;
|
|
2535
|
-
const value = tokensToObject(tokeniser, options);
|
|
2536
|
-
if (value === DONE) throw new Error(`${decodeErrPrefix} tag content missing`);
|
|
2537
|
-
if (value === BREAK) throw new Error(`${decodeErrPrefix} got unexpected break in tag content`);
|
|
2538
|
-
return value;
|
|
2248
|
+
}
|
|
2249
|
+
/**
|
|
2250
|
+
* Creates a TagDecodeControl object for tag decoders.
|
|
2251
|
+
* @param {DecodeTokenizer} tokeniser
|
|
2252
|
+
* @param {DecodeOptions} options
|
|
2253
|
+
* @returns {TagDecodeControl}
|
|
2254
|
+
*/
|
|
2255
|
+
function createTagDecodeControl(tokeniser, options) {
|
|
2256
|
+
/** @type {TagDecodeControl & {_called: boolean}} */
|
|
2257
|
+
const decode = function() {
|
|
2258
|
+
if (decode._called) throw new Error(`${decodeErrPrefix} tag decode() may only be called once`);
|
|
2259
|
+
decode._called = true;
|
|
2260
|
+
const value = tokensToObject(tokeniser, options);
|
|
2261
|
+
if (value === DONE) throw new Error(`${decodeErrPrefix} tag content missing`);
|
|
2262
|
+
if (value === BREAK) throw new Error(`${decodeErrPrefix} got unexpected break in tag content`);
|
|
2263
|
+
return value;
|
|
2264
|
+
};
|
|
2265
|
+
decode.entries = function() {
|
|
2266
|
+
if (decode._called) throw new Error(`${decodeErrPrefix} tag decode() may only be called once`);
|
|
2267
|
+
decode._called = true;
|
|
2268
|
+
const token = tokeniser.next();
|
|
2269
|
+
if (!Type.equals(token.type, Type.map)) throw new Error(`${decodeErrPrefix} entries() requires map content, got ${token.type.name}`);
|
|
2270
|
+
const entries = [];
|
|
2271
|
+
for (const entry of tokenToMapEntries(token, tokeniser, options)) entries.push(entry);
|
|
2272
|
+
return entries;
|
|
2273
|
+
};
|
|
2274
|
+
decode._called = false;
|
|
2275
|
+
return decode;
|
|
2276
|
+
}
|
|
2277
|
+
/**
|
|
2278
|
+
* @param {DecodeTokenizer} tokeniser
|
|
2279
|
+
* @param {DecodeOptions} options
|
|
2280
|
+
* @returns {any|typeof BREAK|typeof DONE}
|
|
2281
|
+
*/
|
|
2282
|
+
function tokensToObject(tokeniser, options) {
|
|
2283
|
+
if (tokeniser.done()) return DONE;
|
|
2284
|
+
const token = tokeniser.next();
|
|
2285
|
+
if (Type.equals(token.type, Type.break)) return BREAK;
|
|
2286
|
+
if (token.type.terminal) return token.value;
|
|
2287
|
+
if (Type.equals(token.type, Type.array)) return tokenToArray(token, tokeniser, options);
|
|
2288
|
+
if (Type.equals(token.type, Type.map)) return tokenToMap(token, tokeniser, options);
|
|
2289
|
+
if (Type.equals(token.type, Type.tag)) {
|
|
2290
|
+
if (options.tags && typeof options.tags[token.value] === "function") {
|
|
2291
|
+
const decodeControl = createTagDecodeControl(tokeniser, options);
|
|
2292
|
+
const result = options.tags[token.value](decodeControl);
|
|
2293
|
+
if (!decodeControl._called) throw new Error(`${decodeErrPrefix} tag decoder must call decode() or entries()`);
|
|
2294
|
+
return result;
|
|
2295
|
+
}
|
|
2296
|
+
throw new Error(`${decodeErrPrefix} tag not supported (${token.value})`);
|
|
2297
|
+
}
|
|
2298
|
+
throw new Error("unsupported");
|
|
2299
|
+
}
|
|
2300
|
+
/**
|
|
2301
|
+
* @param {Uint8Array} data
|
|
2302
|
+
* @param {DecodeOptions} [options]
|
|
2303
|
+
* @returns {[any, Uint8Array]}
|
|
2304
|
+
*/
|
|
2305
|
+
function decodeFirst(data, options) {
|
|
2306
|
+
if (!(data instanceof Uint8Array)) throw new Error(`${decodeErrPrefix} data to decode must be a Uint8Array`);
|
|
2307
|
+
options = Object.assign({}, defaultDecodeOptions, options);
|
|
2308
|
+
const u8aData = asU8A(data);
|
|
2309
|
+
const tokeniser = options.tokenizer || new Tokeniser(u8aData, options);
|
|
2310
|
+
const decoded = tokensToObject(tokeniser, options);
|
|
2311
|
+
if (decoded === DONE) throw new Error(`${decodeErrPrefix} did not find any content to decode`);
|
|
2312
|
+
if (decoded === BREAK) throw new Error(`${decodeErrPrefix} got unexpected break`);
|
|
2313
|
+
return [decoded, data.subarray(tokeniser.pos())];
|
|
2314
|
+
}
|
|
2315
|
+
/**
|
|
2316
|
+
* @param {Uint8Array} data
|
|
2317
|
+
* @param {DecodeOptions} [options]
|
|
2318
|
+
* @returns {any}
|
|
2319
|
+
*/
|
|
2320
|
+
function decode(data, options) {
|
|
2321
|
+
const [decoded, remainder] = decodeFirst(data, options);
|
|
2322
|
+
if (remainder.length > 0) throw new Error(`${decodeErrPrefix} too many terminals, data makes no sense`);
|
|
2323
|
+
return decoded;
|
|
2324
|
+
}
|
|
2325
|
+
Object.defineProperty(class Tagged {
|
|
2326
|
+
/**
|
|
2327
|
+
* @param {number} tag - CBOR tag number, a non-negative integer
|
|
2328
|
+
* @param {any} value - The value to be tagged; encoded recursively
|
|
2329
|
+
*/
|
|
2330
|
+
constructor(tag, value) {
|
|
2331
|
+
if (typeof tag !== "number" || !Number.isInteger(tag) || tag < 0) throw new TypeError("Tagged: tag must be a non-negative integer");
|
|
2332
|
+
this.tag = tag;
|
|
2333
|
+
this.value = value;
|
|
2334
|
+
}
|
|
2335
|
+
/**
|
|
2336
|
+
* Build a tag decoder for use in `decode()`'s `tags` option that returns the
|
|
2337
|
+
* decoded content wrapped in a `Tagged` instance, preserving the tag number
|
|
2338
|
+
* for the caller to inspect.
|
|
2339
|
+
*
|
|
2340
|
+
* @param {number} tag - The CBOR tag number this decoder will be registered for
|
|
2341
|
+
* @returns {TaggedTagDecoder}
|
|
2342
|
+
*
|
|
2343
|
+
* @example
|
|
2344
|
+
* import { decode, Tagged } from 'cborg'
|
|
2345
|
+
* const value = decode(bytes, { tags: { 16: Tagged.decoder(16) } })
|
|
2346
|
+
* // value instanceof Tagged; value.tag === 16
|
|
2347
|
+
*/
|
|
2348
|
+
static decoder(tag) {
|
|
2349
|
+
return (decode) => new Tagged(tag, decode());
|
|
2350
|
+
}
|
|
2351
|
+
/**
|
|
2352
|
+
* Build a `tags` option for `decode()` that wraps each listed tag number in
|
|
2353
|
+
* a `Tagged` instance, preserving those tags through decode without
|
|
2354
|
+
* registering a dedicated decoder per tag.
|
|
2355
|
+
*
|
|
2356
|
+
* @param {...number} tagNumbers - One or more CBOR tag numbers to preserve
|
|
2357
|
+
* @returns {{[tagNumber: number]: TaggedTagDecoder}}
|
|
2358
|
+
*
|
|
2359
|
+
* @example
|
|
2360
|
+
* import { decode, Tagged } from 'cborg'
|
|
2361
|
+
* const value = decode(bytes, { tags: Tagged.preserve(16, 96) })
|
|
2362
|
+
*/
|
|
2363
|
+
static preserve(...tagNumbers) {
|
|
2364
|
+
/** @type {{[tagNumber: number]: TaggedTagDecoder}} */
|
|
2365
|
+
const tags = {};
|
|
2366
|
+
for (const tag of tagNumbers) tags[tag] = Tagged.decoder(tag);
|
|
2367
|
+
return tags;
|
|
2368
|
+
}
|
|
2369
|
+
}.prototype, Symbol.toStringTag, { value: "Tagged" });
|
|
2370
|
+
//#endregion
|
|
2371
|
+
//#region ../../packages/shared/src/nodeIdentity.ts
|
|
2372
|
+
const NODE_AUTH_TRANSCRIPT_DOMAIN = "ryco.node-auth.proof.v1";
|
|
2373
|
+
const NODE_KEY_FINGERPRINT_DOMAIN = "ryco.node-key.v1";
|
|
2374
|
+
const NODE_KEY_ROTATION_TRANSCRIPT_DOMAIN = "ryco.node-key-rotation.proof.v1";
|
|
2375
|
+
const NATIVE_NODE_CLAIM_TRANSCRIPT_DOMAIN = "ryco.native-node-claim.proof.v1";
|
|
2376
|
+
var NodeIdentityValidationError = class extends Error {
|
|
2377
|
+
code = "invalid_node_identity_input";
|
|
2378
|
+
constructor() {
|
|
2379
|
+
super("Node identity input is invalid.");
|
|
2380
|
+
this.name = "NodeIdentityValidationError";
|
|
2381
|
+
}
|
|
2382
|
+
};
|
|
2383
|
+
const ID_SUFFIX = "[A-Za-z0-9_-]{22}";
|
|
2384
|
+
const NODE_ID = new RegExp(`^node_${ID_SUFFIX}$`);
|
|
2385
|
+
const NODE_KEY_ID = new RegExp(`^nkey_${ID_SUFFIX}$`);
|
|
2386
|
+
const ROTATION_REQUEST_ID = new RegExp(`^nrot_${ID_SUFFIX}$`);
|
|
2387
|
+
const PUBLIC_ID_SUFFIX = "[A-Za-z0-9_-]{22,43}";
|
|
2388
|
+
const ACCOUNT_ID = new RegExp(`^acct_${PUBLIC_ID_SUFFIX}$`);
|
|
2389
|
+
const SPACE_ID = new RegExp(`^space_${PUBLIC_ID_SUFFIX}$`);
|
|
2390
|
+
const SESSION_ID = new RegExp(`^sess_${PUBLIC_ID_SUFFIX}$`);
|
|
2391
|
+
const NATIVE_NODE_CLAIM_ID = new RegExp(`^nclaim_${PUBLIC_ID_SUFFIX}$`);
|
|
2392
|
+
const DESKTOP_INSTALLATION_ID = new RegExp(`^install_${PUBLIC_ID_SUFFIX}$`);
|
|
2393
|
+
const ENVIRONMENT_ID = /^env_[A-Za-z0-9_-]{22}$/;
|
|
2394
|
+
const LOOPBACK_HOSTS = /* @__PURE__ */ new Set([
|
|
2395
|
+
"localhost",
|
|
2396
|
+
"127.0.0.1",
|
|
2397
|
+
"[::1]"
|
|
2398
|
+
]);
|
|
2399
|
+
function invalid() {
|
|
2400
|
+
throw new NodeIdentityValidationError();
|
|
2401
|
+
}
|
|
2402
|
+
function assertUnsignedSafeInteger(value) {
|
|
2403
|
+
if (!Number.isSafeInteger(value) || value < 0) invalid();
|
|
2404
|
+
}
|
|
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
|
|
2539
2637
|
};
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
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
|
|
2548
2670
|
};
|
|
2549
|
-
|
|
2550
|
-
|
|
2671
|
+
return selections.length > 0 ? {
|
|
2672
|
+
...base,
|
|
2673
|
+
options: selections
|
|
2674
|
+
} : base;
|
|
2675
|
+
}
|
|
2676
|
+
function canonicalOptionKeys(options) {
|
|
2677
|
+
return (options ?? []).map((option) => JSON.stringify([option.id, option.value])).toSorted((left, right) => left < right ? -1 : left > right ? 1 : 0);
|
|
2551
2678
|
}
|
|
2552
2679
|
/**
|
|
2553
|
-
*
|
|
2554
|
-
*
|
|
2555
|
-
*
|
|
2680
|
+
* Semantic equality of two model selections: same instance and model, and the
|
|
2681
|
+
* same options regardless of their order (absent options equal an empty list).
|
|
2682
|
+
* Key order never matters, so a selection round-tripped through JSON and schema
|
|
2683
|
+
* decode equals the hydrated one.
|
|
2556
2684
|
*/
|
|
2557
|
-
function
|
|
2558
|
-
if (
|
|
2559
|
-
const
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
if (Type.equals(token.type, Type.array)) return tokenToArray(token, tokeniser, options);
|
|
2563
|
-
if (Type.equals(token.type, Type.map)) return tokenToMap(token, tokeniser, options);
|
|
2564
|
-
if (Type.equals(token.type, Type.tag)) {
|
|
2565
|
-
if (options.tags && typeof options.tags[token.value] === "function") {
|
|
2566
|
-
const decodeControl = createTagDecodeControl(tokeniser, options);
|
|
2567
|
-
const result = options.tags[token.value](decodeControl);
|
|
2568
|
-
if (!decodeControl._called) throw new Error(`${decodeErrPrefix} tag decoder must call decode() or entries()`);
|
|
2569
|
-
return result;
|
|
2570
|
-
}
|
|
2571
|
-
throw new Error(`${decodeErrPrefix} tag not supported (${token.value})`);
|
|
2572
|
-
}
|
|
2573
|
-
throw new Error("unsupported");
|
|
2685
|
+
function sameModelSelection(left, right) {
|
|
2686
|
+
if (left.instanceId !== right.instanceId || left.model !== right.model) return false;
|
|
2687
|
+
const leftOptions = canonicalOptionKeys(left.options);
|
|
2688
|
+
const rightOptions = canonicalOptionKeys(right.options);
|
|
2689
|
+
return leftOptions.length === rightOptions.length && leftOptions.every((key, index) => rightOptions[index] === key);
|
|
2574
2690
|
}
|
|
2575
2691
|
/**
|
|
2576
|
-
*
|
|
2577
|
-
*
|
|
2578
|
-
* @returns {[any, Uint8Array]}
|
|
2692
|
+
* Context handoff is a provider-instance boundary. Model and option changes
|
|
2693
|
+
* within one configured instance remain on that provider's normal turn path.
|
|
2579
2694
|
*/
|
|
2580
|
-
function
|
|
2581
|
-
|
|
2582
|
-
options = Object.assign({}, defaultDecodeOptions, options);
|
|
2583
|
-
const u8aData = asU8A(data);
|
|
2584
|
-
const tokeniser = options.tokenizer || new Tokeniser(u8aData, options);
|
|
2585
|
-
const decoded = tokensToObject(tokeniser, options);
|
|
2586
|
-
if (decoded === DONE) throw new Error(`${decodeErrPrefix} did not find any content to decode`);
|
|
2587
|
-
if (decoded === BREAK) throw new Error(`${decodeErrPrefix} got unexpected break`);
|
|
2588
|
-
return [decoded, data.subarray(tokeniser.pos())];
|
|
2695
|
+
function modelSelectionRequiresContextHandoff(input) {
|
|
2696
|
+
return input.canonicalSelection.instanceId !== input.targetSelection.instanceId;
|
|
2589
2697
|
}
|
|
2590
2698
|
/**
|
|
2591
|
-
*
|
|
2592
|
-
*
|
|
2593
|
-
*
|
|
2699
|
+
* Returns the effort value if it is a prompt-injected value according to
|
|
2700
|
+
* any select descriptor in the given capabilities, or null otherwise.
|
|
2701
|
+
*
|
|
2702
|
+
* Unlike a single `find`, this checks every descriptor so that the
|
|
2703
|
+
* correct descriptor's `promptInjectedValues` list is consulted even when
|
|
2704
|
+
* multiple select descriptors exist.
|
|
2594
2705
|
*/
|
|
2595
|
-
function
|
|
2596
|
-
const
|
|
2597
|
-
if (
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
/**
|
|
2602
|
-
* @param {number} tag - CBOR tag number, a non-negative integer
|
|
2603
|
-
* @param {any} value - The value to be tagged; encoded recursively
|
|
2604
|
-
*/
|
|
2605
|
-
constructor(tag, value) {
|
|
2606
|
-
if (typeof tag !== "number" || !Number.isInteger(tag) || tag < 0) throw new TypeError("Tagged: tag must be a non-negative integer");
|
|
2607
|
-
this.tag = tag;
|
|
2608
|
-
this.value = value;
|
|
2609
|
-
}
|
|
2610
|
-
/**
|
|
2611
|
-
* Build a tag decoder for use in `decode()`'s `tags` option that returns the
|
|
2612
|
-
* decoded content wrapped in a `Tagged` instance, preserving the tag number
|
|
2613
|
-
* for the caller to inspect.
|
|
2614
|
-
*
|
|
2615
|
-
* @param {number} tag - The CBOR tag number this decoder will be registered for
|
|
2616
|
-
* @returns {TaggedTagDecoder}
|
|
2617
|
-
*
|
|
2618
|
-
* @example
|
|
2619
|
-
* import { decode, Tagged } from 'cborg'
|
|
2620
|
-
* const value = decode(bytes, { tags: { 16: Tagged.decoder(16) } })
|
|
2621
|
-
* // value instanceof Tagged; value.tag === 16
|
|
2622
|
-
*/
|
|
2623
|
-
static decoder(tag) {
|
|
2624
|
-
return (decode) => new Tagged(tag, decode());
|
|
2625
|
-
}
|
|
2626
|
-
/**
|
|
2627
|
-
* Build a `tags` option for `decode()` that wraps each listed tag number in
|
|
2628
|
-
* a `Tagged` instance, preserving those tags through decode without
|
|
2629
|
-
* registering a dedicated decoder per tag.
|
|
2630
|
-
*
|
|
2631
|
-
* @param {...number} tagNumbers - One or more CBOR tag numbers to preserve
|
|
2632
|
-
* @returns {{[tagNumber: number]: TaggedTagDecoder}}
|
|
2633
|
-
*
|
|
2634
|
-
* @example
|
|
2635
|
-
* import { decode, Tagged } from 'cborg'
|
|
2636
|
-
* const value = decode(bytes, { tags: Tagged.preserve(16, 96) })
|
|
2637
|
-
*/
|
|
2638
|
-
static preserve(...tagNumbers) {
|
|
2639
|
-
/** @type {{[tagNumber: number]: TaggedTagDecoder}} */
|
|
2640
|
-
const tags = {};
|
|
2641
|
-
for (const tag of tagNumbers) tags[tag] = Tagged.decoder(tag);
|
|
2642
|
-
return tags;
|
|
2643
|
-
}
|
|
2644
|
-
}.prototype, Symbol.toStringTag, { value: "Tagged" });
|
|
2645
|
-
//#endregion
|
|
2646
|
-
//#region ../../packages/shared/src/nodeIdentity.ts
|
|
2647
|
-
const NODE_AUTH_TRANSCRIPT_DOMAIN = "ryco.node-auth.proof.v1";
|
|
2648
|
-
const NODE_KEY_FINGERPRINT_DOMAIN = "ryco.node-key.v1";
|
|
2649
|
-
const NODE_KEY_ROTATION_TRANSCRIPT_DOMAIN = "ryco.node-key-rotation.proof.v1";
|
|
2650
|
-
const NATIVE_NODE_CLAIM_TRANSCRIPT_DOMAIN = "ryco.native-node-claim.proof.v1";
|
|
2651
|
-
var NodeIdentityValidationError = class extends Error {
|
|
2652
|
-
code = "invalid_node_identity_input";
|
|
2653
|
-
constructor() {
|
|
2654
|
-
super("Node identity input is invalid.");
|
|
2655
|
-
this.name = "NodeIdentityValidationError";
|
|
2656
|
-
}
|
|
2657
|
-
};
|
|
2658
|
-
const ID_SUFFIX = "[A-Za-z0-9_-]{22}";
|
|
2659
|
-
const NODE_ID = new RegExp(`^node_${ID_SUFFIX}$`);
|
|
2660
|
-
const NODE_KEY_ID = new RegExp(`^nkey_${ID_SUFFIX}$`);
|
|
2661
|
-
const ROTATION_REQUEST_ID = new RegExp(`^nrot_${ID_SUFFIX}$`);
|
|
2662
|
-
const PUBLIC_ID_SUFFIX = "[A-Za-z0-9_-]{22,43}";
|
|
2663
|
-
const ACCOUNT_ID = new RegExp(`^acct_${PUBLIC_ID_SUFFIX}$`);
|
|
2664
|
-
const SPACE_ID = new RegExp(`^space_${PUBLIC_ID_SUFFIX}$`);
|
|
2665
|
-
const SESSION_ID = new RegExp(`^sess_${PUBLIC_ID_SUFFIX}$`);
|
|
2666
|
-
const NATIVE_NODE_CLAIM_ID = new RegExp(`^nclaim_${PUBLIC_ID_SUFFIX}$`);
|
|
2667
|
-
const DESKTOP_INSTALLATION_ID = new RegExp(`^install_${PUBLIC_ID_SUFFIX}$`);
|
|
2668
|
-
const ENVIRONMENT_ID = /^env_[A-Za-z0-9_-]{22}$/;
|
|
2669
|
-
const LOOPBACK_HOSTS = /* @__PURE__ */ new Set([
|
|
2670
|
-
"localhost",
|
|
2671
|
-
"127.0.0.1",
|
|
2672
|
-
"[::1]"
|
|
2673
|
-
]);
|
|
2674
|
-
function invalid() {
|
|
2675
|
-
throw new NodeIdentityValidationError();
|
|
2676
|
-
}
|
|
2677
|
-
function assertUnsignedSafeInteger(value) {
|
|
2678
|
-
if (!Number.isSafeInteger(value) || value < 0) invalid();
|
|
2679
|
-
}
|
|
2680
|
-
function assertProtocolVersion(value) {
|
|
2681
|
-
if (!Number.isSafeInteger(value) || value < 0 || value > 65535) invalid();
|
|
2682
|
-
}
|
|
2683
|
-
function assertIdentifier(value, pattern) {
|
|
2684
|
-
if (!pattern.test(value)) invalid();
|
|
2685
|
-
}
|
|
2686
|
-
function copyBytes(value, expectedLengths) {
|
|
2687
|
-
if (!(value instanceof Uint8Array) || !expectedLengths.includes(value.byteLength)) invalid();
|
|
2688
|
-
return Uint8Array.from(value);
|
|
2706
|
+
function resolvePromptInjectedEffort(caps, rawEffort) {
|
|
2707
|
+
const trimmed = trimOrNull(rawEffort);
|
|
2708
|
+
if (!trimmed) return null;
|
|
2709
|
+
const descriptors = getProviderOptionDescriptors({ caps });
|
|
2710
|
+
for (const descriptor of descriptors) if (descriptor.type === "select" && descriptor.promptInjectedValues?.includes(trimmed)) return trimmed;
|
|
2711
|
+
return null;
|
|
2689
2712
|
}
|
|
2690
|
-
function
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
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;
|
|
2713
|
+
function applyClaudePromptEffortPrefix(text, effort) {
|
|
2714
|
+
const trimmed = text.trim();
|
|
2715
|
+
if (!trimmed) return trimmed;
|
|
2716
|
+
if (effort !== "ultrathink") return trimmed;
|
|
2717
|
+
if (trimmed.startsWith("Ultrathink:")) return trimmed;
|
|
2718
|
+
return `Ultrathink:\n${trimmed}`;
|
|
2701
2719
|
}
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2720
|
+
//#endregion
|
|
2721
|
+
//#region ../../packages/shared/src/serverSettings.ts
|
|
2722
|
+
const ServerSettingsJson$1 = require_schemaJson.fromLenientJson(require_src.ServerSettings);
|
|
2723
|
+
function normalizePersistedServerSettingString(value) {
|
|
2724
|
+
const trimmed = value?.trim();
|
|
2725
|
+
return trimmed && trimmed.length > 0 ? trimmed : void 0;
|
|
2707
2726
|
}
|
|
2708
|
-
function
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2727
|
+
function extractPersistedServerObservabilitySettings(input) {
|
|
2728
|
+
return {
|
|
2729
|
+
otlpTracesUrl: normalizePersistedServerSettingString(input.observability?.otlpTracesUrl),
|
|
2730
|
+
otlpMetricsUrl: normalizePersistedServerSettingString(input.observability?.otlpMetricsUrl)
|
|
2712
2731
|
};
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2732
|
+
}
|
|
2733
|
+
function parsePersistedServerObservabilitySettings(raw) {
|
|
2734
|
+
try {
|
|
2735
|
+
return extractPersistedServerObservabilitySettings(effect.Schema.decodeUnknownSync(ServerSettingsJson$1)(raw));
|
|
2736
|
+
} catch {
|
|
2717
2737
|
return {
|
|
2718
|
-
|
|
2719
|
-
|
|
2738
|
+
otlpTracesUrl: void 0,
|
|
2739
|
+
otlpMetricsUrl: void 0
|
|
2720
2740
|
};
|
|
2721
2741
|
}
|
|
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
2742
|
}
|
|
2756
|
-
function
|
|
2757
|
-
|
|
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));
|
|
2743
|
+
function shouldReplaceTextGenerationModelSelection(patch) {
|
|
2744
|
+
return Boolean(patch && (patch.instanceId !== void 0 || patch.model !== void 0));
|
|
2783
2745
|
}
|
|
2784
|
-
function
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
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));
|
|
2746
|
+
function mergeModelSelectionOptionsById(input) {
|
|
2747
|
+
if (input.patch === void 0) return input.current ? [...input.current] : void 0;
|
|
2748
|
+
if (input.patch.length === 0) return;
|
|
2749
|
+
const merged = new Map((input.current ?? []).map((selection) => [selection.id, selection.value]));
|
|
2750
|
+
for (const selection of input.patch) merged.set(selection.id, selection.value);
|
|
2751
|
+
return [...merged.entries()].map(([id, value]) => ({
|
|
2752
|
+
id,
|
|
2753
|
+
value
|
|
2754
|
+
}));
|
|
2817
2755
|
}
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2756
|
+
/**
|
|
2757
|
+
* Applies a server settings patch while treating textGenerationModelSelection as
|
|
2758
|
+
* replace-on-provider/model updates. This prevents stale nested options from
|
|
2759
|
+
* surviving a reset patch that intentionally omits options.
|
|
2760
|
+
*/
|
|
2761
|
+
function applyServerSettingsPatch(current, patch) {
|
|
2762
|
+
const selectionPatch = patch.textGenerationModelSelection;
|
|
2763
|
+
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.");
|
|
2764
|
+
for (const [projectId, expected] of Object.entries(patch.expectedProjectPreferences ?? {})) {
|
|
2765
|
+
const currentPreferences = current.projectPreferences[projectId] ?? {};
|
|
2766
|
+
for (const [field, value] of Object.entries(expected)) {
|
|
2767
|
+
const actual = field === "initialModelSelection" && !Object.hasOwn(currentPreferences, field) ? "absent" : currentPreferences[field] ?? null;
|
|
2768
|
+
if (!effect.Equal.equals(actual, value)) throw new Error("Project preferences changed elsewhere. Reload before saving.");
|
|
2769
|
+
}
|
|
2770
|
+
}
|
|
2771
|
+
const { expectedProjectPreferences: _expected, expectedNodePreferences: _expectedNode, projectPreferences: _projects, ...persistedPatch } = patch;
|
|
2772
|
+
let next = deepMerge(current, persistedPatch);
|
|
2773
|
+
if (patch.initialModelSelection !== void 0) next = {
|
|
2774
|
+
...next,
|
|
2775
|
+
initialModelSelection: patch.initialModelSelection
|
|
2776
|
+
};
|
|
2777
|
+
if (patch.projectPreferences !== void 0) {
|
|
2778
|
+
const projects = new Map(Object.entries(current.projectPreferences));
|
|
2779
|
+
for (const [projectId, preferencesPatch] of Object.entries(patch.projectPreferences)) {
|
|
2780
|
+
if (preferencesPatch === null) {
|
|
2781
|
+
projects.delete(projectId);
|
|
2782
|
+
continue;
|
|
2783
|
+
}
|
|
2784
|
+
const preferences = { ...projects.get(projectId) };
|
|
2785
|
+
for (const [field, value] of Object.entries(preferencesPatch)) if (value === null && field !== "initialModelSelection") delete preferences[field];
|
|
2786
|
+
else Object.assign(preferences, { [field]: value });
|
|
2787
|
+
if (Object.keys(preferences).length) projects.set(projectId, preferences);
|
|
2788
|
+
else projects.delete(projectId);
|
|
2789
|
+
}
|
|
2790
|
+
next = {
|
|
2791
|
+
...next,
|
|
2792
|
+
projectPreferences: Object.fromEntries(projects)
|
|
2793
|
+
};
|
|
2794
|
+
}
|
|
2795
|
+
if (patch.projectWorktreeSubmodules !== void 0) {
|
|
2796
|
+
const modes = new Map(Object.entries(current.projectWorktreeSubmodules));
|
|
2797
|
+
for (const [projectId, mode] of Object.entries(patch.projectWorktreeSubmodules)) if (mode === null) modes.delete(projectId);
|
|
2798
|
+
else modes.set(projectId, mode);
|
|
2799
|
+
next = {
|
|
2800
|
+
...next,
|
|
2801
|
+
projectWorktreeSubmodules: Object.fromEntries(modes)
|
|
2802
|
+
};
|
|
2803
|
+
}
|
|
2804
|
+
if (patch.projectWorktreeRoots !== void 0) {
|
|
2805
|
+
const roots = new Map(Object.entries(current.projectWorktreeRoots));
|
|
2806
|
+
for (const [projectId, root] of Object.entries(patch.projectWorktreeRoots)) if (root === null || root === "") roots.delete(projectId);
|
|
2807
|
+
else roots.set(projectId, root);
|
|
2808
|
+
next = {
|
|
2809
|
+
...next,
|
|
2810
|
+
projectWorktreeRoots: Object.fromEntries(roots)
|
|
2811
|
+
};
|
|
2812
|
+
}
|
|
2813
|
+
if (patch.projectStorageRetention !== void 0) {
|
|
2814
|
+
const policies = new Map(Object.entries(current.projectStorageRetention));
|
|
2815
|
+
for (const [projectId, policy] of Object.entries(patch.projectStorageRetention)) if (policy === null) policies.delete(projectId);
|
|
2816
|
+
else policies.set(projectId, policy);
|
|
2817
|
+
next = {
|
|
2818
|
+
...next,
|
|
2819
|
+
projectStorageRetention: Object.fromEntries(policies)
|
|
2820
|
+
};
|
|
2821
|
+
}
|
|
2822
|
+
if (patch.projectLifecycleSuggestions !== void 0) {
|
|
2823
|
+
const policies = new Map(Object.entries(current.projectLifecycleSuggestions));
|
|
2824
|
+
for (const [projectId, policy] of Object.entries(patch.projectLifecycleSuggestions)) if (policy === null) policies.delete(projectId);
|
|
2825
|
+
else policies.set(projectId, policy);
|
|
2826
|
+
next = {
|
|
2827
|
+
...next,
|
|
2828
|
+
projectLifecycleSuggestions: Object.fromEntries(policies)
|
|
2829
|
+
};
|
|
2830
|
+
}
|
|
2831
|
+
const nextWithReplacements = patch.providerInstances !== void 0 ? {
|
|
2832
|
+
...next,
|
|
2833
|
+
providerInstances: patch.providerInstances
|
|
2834
|
+
} : next;
|
|
2835
|
+
if (!selectionPatch) return nextWithReplacements;
|
|
2836
|
+
const instanceId = selectionPatch.instanceId ?? current.textGenerationModelSelection.instanceId;
|
|
2837
|
+
const model = selectionPatch.model ?? current.textGenerationModelSelection.model;
|
|
2838
|
+
const options = shouldReplaceTextGenerationModelSelection(selectionPatch) ? selectionPatch.options : mergeModelSelectionOptionsById({
|
|
2839
|
+
current: current.textGenerationModelSelection.options,
|
|
2840
|
+
patch: selectionPatch.options
|
|
2841
|
+
});
|
|
2842
|
+
return {
|
|
2843
|
+
...nextWithReplacements,
|
|
2844
|
+
textGenerationModelSelection: createModelSelection(instanceId, model, options)
|
|
2845
|
+
};
|
|
2822
2846
|
}
|
|
2823
2847
|
//#endregion
|
|
2824
2848
|
//#region src/config.ts
|
|
@@ -2895,6 +2919,7 @@ function resolveHubConnectorConfig(raw) {
|
|
|
2895
2919
|
};
|
|
2896
2920
|
}
|
|
2897
2921
|
const DEFAULT_NODE_E2EE_POLICY_CONFIG = {
|
|
2922
|
+
mode: void 0,
|
|
2898
2923
|
requireE2EE: void 0,
|
|
2899
2924
|
requireApprovedClientE2EE: void 0,
|
|
2900
2925
|
configurationIssue: void 0
|
|
@@ -2921,15 +2946,21 @@ const parseTriStateBoolean = (value) => {
|
|
|
2921
2946
|
function resolveNodeE2eePolicyConfig(raw) {
|
|
2922
2947
|
const requireE2EE = parseTriStateBoolean(raw.requireE2EE);
|
|
2923
2948
|
const requireApprovedClientE2EE = parseTriStateBoolean(raw.requireApprovedClientE2EE);
|
|
2949
|
+
const mode = raw.mode === void 0 ? void 0 : effect.Schema.is(require_src.NodeE2eeAdmissionPolicy)(raw.mode) ? raw.mode : null;
|
|
2924
2950
|
return {
|
|
2951
|
+
mode: mode ?? void 0,
|
|
2925
2952
|
requireE2EE: typeof requireE2EE === "boolean" ? requireE2EE : void 0,
|
|
2926
2953
|
requireApprovedClientE2EE: typeof requireApprovedClientE2EE === "boolean" ? requireApprovedClientE2EE : void 0,
|
|
2927
|
-
configurationIssue: requireE2EE === void 0 || requireApprovedClientE2EE === void 0 ? "configuration_invalid" : void 0
|
|
2954
|
+
configurationIssue: requireE2EE === void 0 || requireApprovedClientE2EE === void 0 || mode === null ? "configuration_invalid" : void 0
|
|
2928
2955
|
};
|
|
2929
2956
|
}
|
|
2930
2957
|
function resolveManagedWorktreesRoot(config) {
|
|
2931
2958
|
return config.workspaceAccessRoot === void 0 ? config.worktreesDir : node_path.default.join(config.workspaceAccessRoot, ".ryco", "worktrees");
|
|
2932
2959
|
}
|
|
2960
|
+
/** The chats root used when the `chatsRoot` setting is empty. */
|
|
2961
|
+
function resolveManagedChatsRoot(config) {
|
|
2962
|
+
return config.workspaceAccessRoot === void 0 ? config.chatsDir : node_path.default.join(config.workspaceAccessRoot, ".ryco", "chats");
|
|
2963
|
+
}
|
|
2933
2964
|
const deriveServerPaths = effect.Effect.fn(function* (baseDir, devUrl) {
|
|
2934
2965
|
const { join } = yield* effect.Path.Path;
|
|
2935
2966
|
const stateDir = join(baseDir, devUrl !== void 0 ? "dev" : "userdata");
|
|
@@ -2945,6 +2976,7 @@ const deriveServerPaths = effect.Effect.fn(function* (baseDir, devUrl) {
|
|
|
2945
2976
|
settingsPath: join(stateDir, "settings.json"),
|
|
2946
2977
|
providerStatusCacheDir,
|
|
2947
2978
|
worktreesDir: join(baseDir, "worktrees"),
|
|
2979
|
+
chatsDir: join(baseDir, "chats"),
|
|
2948
2980
|
attachmentsDir,
|
|
2949
2981
|
logsDir,
|
|
2950
2982
|
serverLogPath: join(logsDir, "server.log"),
|
|
@@ -3452,6 +3484,11 @@ async function removeVerifiedWorktree(repository, candidate, cleanup) {
|
|
|
3452
3484
|
//#region src/storage/lifecycle.ts
|
|
3453
3485
|
const storageLifecycleLock = effect.Semaphore.makeUnsafe(1);
|
|
3454
3486
|
const creations = /* @__PURE__ */ new Map();
|
|
3487
|
+
let activityVersion = 0;
|
|
3488
|
+
const noteStorageActivity = () => {
|
|
3489
|
+
activityVersion++;
|
|
3490
|
+
};
|
|
3491
|
+
const storageActivityVersion = () => activityVersion;
|
|
3455
3492
|
const overlaps = (a, b, platform = process.platform) => {
|
|
3456
3493
|
if (platform === "darwin" || platform === "win32") {
|
|
3457
3494
|
a = a.toLowerCase();
|
|
@@ -3460,6 +3497,12 @@ const overlaps = (a, b, platform = process.platform) => {
|
|
|
3460
3497
|
const boundary = (root) => root.endsWith(node_path.default.sep) ? root : root + node_path.default.sep;
|
|
3461
3498
|
return a === b || a.startsWith(boundary(b)) || b.startsWith(boundary(a));
|
|
3462
3499
|
};
|
|
3500
|
+
/** `candidate` is `root` or below it. */
|
|
3501
|
+
const contains = (root, candidate, platform) => {
|
|
3502
|
+
const a = platform === "darwin" || platform === "win32" ? root.toLowerCase() : root;
|
|
3503
|
+
const b = platform === "darwin" || platform === "win32" ? candidate.toLowerCase() : candidate;
|
|
3504
|
+
return a === b || b.startsWith(a.endsWith(node_path.default.sep) ? a : a + node_path.default.sep);
|
|
3505
|
+
};
|
|
3463
3506
|
const removingPaths = (row) => {
|
|
3464
3507
|
let identity;
|
|
3465
3508
|
try {
|
|
@@ -3490,6 +3533,7 @@ async function canonicalStoragePath(candidate) {
|
|
|
3490
3533
|
function acquireWorktreeCreationLease(sql, candidate) {
|
|
3491
3534
|
return storageLifecycleLock.withPermit(effect.Effect.gen(function* () {
|
|
3492
3535
|
const canonical = yield* effect.Effect.tryPromise(() => canonicalStoragePath(candidate));
|
|
3536
|
+
if (yield* isWorktreeRelocationBlocked(sql, canonical)) return yield* new require_src.StorageError({ detail: "Checkout relocation is pending or this is a retired checkout path. Reload the workspace." });
|
|
3493
3537
|
const pending = yield* sql`SELECT path, identity_json FROM storage_owned_entries WHERE state = 'removing' LIMIT 257`;
|
|
3494
3538
|
if (pending.length > 256) return yield* new require_src.StorageError({ detail: "Too many interrupted cleanups to establish safe creation admission. Inspect pending cleanup records." });
|
|
3495
3539
|
if (pending.some((row) => removingPaths(row).some((root) => overlaps(root, canonical)))) return yield* new require_src.StorageError({ detail: "Checkout cleanup is pending. Creation cannot replace an in-flight removal." });
|
|
@@ -3498,6 +3542,7 @@ function acquireWorktreeCreationLease(sql, candidate) {
|
|
|
3498
3542
|
const remaining = (creations.get(canonical) ?? 1) - 1;
|
|
3499
3543
|
if (remaining > 0) creations.set(canonical, remaining);
|
|
3500
3544
|
else creations.delete(canonical);
|
|
3545
|
+
noteStorageActivity();
|
|
3501
3546
|
});
|
|
3502
3547
|
}));
|
|
3503
3548
|
}
|
|
@@ -3505,12 +3550,14 @@ function acquireWorktreeCreationLease(sql, candidate) {
|
|
|
3505
3550
|
function acquireStoragePathUseLease(sql, candidate) {
|
|
3506
3551
|
return storageLifecycleLock.withPermit(effect.Effect.gen(function* () {
|
|
3507
3552
|
const canonical = yield* effect.Effect.tryPromise(() => canonicalStoragePath(candidate));
|
|
3508
|
-
|
|
3553
|
+
const blocker = yield* storagePathBlocker(sql, canonical);
|
|
3554
|
+
if (blocker !== null) return yield* new require_src.StorageError({ detail: blocker === "project-relocation" ? require_src.PROJECT_RELOCATION_PENDING_MESSAGE : "Checkout cleanup is pending or complete. Restore/recreate it before provider recovery." });
|
|
3509
3555
|
creations.set(canonical, (creations.get(canonical) ?? 0) + 1);
|
|
3510
3556
|
return effect.Effect.sync(() => {
|
|
3511
3557
|
const remaining = (creations.get(canonical) ?? 1) - 1;
|
|
3512
3558
|
if (remaining > 0) creations.set(canonical, remaining);
|
|
3513
3559
|
else creations.delete(canonical);
|
|
3560
|
+
noteStorageActivity();
|
|
3514
3561
|
});
|
|
3515
3562
|
}));
|
|
3516
3563
|
}
|
|
@@ -3538,8 +3585,22 @@ function recordCreatedWorktree(sql, repository, candidate) {
|
|
|
3538
3585
|
WHERE storage_owned_entries.state != 'removing' RETURNING id`).length !== 1) return yield* new require_src.StorageError({ detail: "Ownership capture refused to replace a pending cleanup. The creation outcome remains protected." });
|
|
3539
3586
|
});
|
|
3540
3587
|
}
|
|
3541
|
-
/**
|
|
3542
|
-
|
|
3588
|
+
/**
|
|
3589
|
+
* Storage admission for a path: refused while a chat's folder moves or checkout lifecycle work
|
|
3590
|
+
* fences it. Persistent tombstones prevent restart/resume from granting authority to a removed
|
|
3591
|
+
* checkout.
|
|
3592
|
+
*/
|
|
3593
|
+
function isStoragePathBlocked(sql, candidate, platform = process.platform, ignoredRelocationId) {
|
|
3594
|
+
return storagePathBlocker(sql, candidate, platform, ignoredRelocationId).pipe(effect.Effect.map((blocker) => blocker !== null));
|
|
3595
|
+
}
|
|
3596
|
+
/** {@link isStoragePathBlocked}, with the reason, so admission can tell a retryable move apart. */
|
|
3597
|
+
function storagePathBlocker(sql, candidate, platform = process.platform, ignoredRelocationId) {
|
|
3598
|
+
return effect.Effect.gen(function* () {
|
|
3599
|
+
if (yield* isProjectRelocationBlocked(sql, candidate, platform)) return "project-relocation";
|
|
3600
|
+
return (yield* isCheckoutPathBlocked(sql, candidate, platform, ignoredRelocationId)) ? "checkout" : null;
|
|
3601
|
+
});
|
|
3602
|
+
}
|
|
3603
|
+
function isCheckoutPathBlocked(sql, candidate, platform, ignoredRelocationId) {
|
|
3543
3604
|
const ancestors = [];
|
|
3544
3605
|
let current = node_path.default.resolve(candidate);
|
|
3545
3606
|
for (;;) {
|
|
@@ -3550,11 +3611,42 @@ function isStoragePathBlocked(sql, candidate, platform = process.platform) {
|
|
|
3550
3611
|
}
|
|
3551
3612
|
const matching = platform === "darwin" || platform === "win32" ? sql`path COLLATE NOCASE IN ${sql.in(ancestors)}` : sql.in("path", ancestors);
|
|
3552
3613
|
return effect.Effect.gen(function* () {
|
|
3614
|
+
if (yield* isWorktreeRelocationBlocked(sql, candidate, platform, ignoredRelocationId)) return true;
|
|
3553
3615
|
if ((yield* sql`SELECT path FROM storage_owned_entries WHERE state IN ('removing', 'removed') AND ${matching} LIMIT 1`).length) return true;
|
|
3554
3616
|
const pending = yield* sql`SELECT path, identity_json FROM storage_owned_entries WHERE state = 'removing' LIMIT 257`;
|
|
3555
3617
|
return pending.length > 256 || pending.some((row) => removingPaths(row).some((root) => overlaps(root, node_path.default.resolve(candidate), platform)));
|
|
3556
3618
|
});
|
|
3557
3619
|
}
|
|
3620
|
+
/** Active moves fence both paths; completed moves permanently fence the old path. */
|
|
3621
|
+
function isWorktreeRelocationBlocked(sql, candidate, platform = process.platform, ignoredRelocationId) {
|
|
3622
|
+
return effect.Effect.gen(function* () {
|
|
3623
|
+
if (!(yield* sql`SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'managed_worktree_relocations'`).length) return false;
|
|
3624
|
+
const rows = yield* sql`
|
|
3625
|
+
SELECT source_path, destination_path, state FROM managed_worktree_relocations
|
|
3626
|
+
WHERE state IN ('moving', 'moved', 'attention', 'complete')
|
|
3627
|
+
AND worktree_id != ${ignoredRelocationId ?? ""}`;
|
|
3628
|
+
const resolved = node_path.default.resolve(candidate);
|
|
3629
|
+
return rows.some((row) => row.state === "complete" ? contains(row.source_path, resolved, platform) : overlaps(row.source_path, resolved, platform) || overlaps(row.destination_path, resolved, platform));
|
|
3630
|
+
});
|
|
3631
|
+
}
|
|
3632
|
+
/**
|
|
3633
|
+
* An unsettled chat promotion (`project_relocations` row `pending` or `moved`, see
|
|
3634
|
+
* `project/chatPromotion.ts`) fences everything at or below both of its paths, so no turn, provider
|
|
3635
|
+
* session or terminal starts in a folder that is moving. Promotion writes the row before it stops
|
|
3636
|
+
* sessions and closes terminals. Unlike a checkout move, ancestors stay usable: a project that
|
|
3637
|
+
* merely contains the chats folder is unrelated, and a write into a moving copy fails its
|
|
3638
|
+
* verification. Settled moves lift the fence; the project then points at its new root.
|
|
3639
|
+
*/
|
|
3640
|
+
function isProjectRelocationBlocked(sql, candidate, platform = process.platform) {
|
|
3641
|
+
return effect.Effect.gen(function* () {
|
|
3642
|
+
if (!(yield* sql`SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'project_relocations'`).length) return false;
|
|
3643
|
+
const rows = yield* sql`
|
|
3644
|
+
SELECT source_path, destination_path FROM project_relocations
|
|
3645
|
+
WHERE state IN ('pending', 'moved')`;
|
|
3646
|
+
const resolved = node_path.default.resolve(candidate);
|
|
3647
|
+
return rows.some((row) => contains(row.source_path, resolved, platform) || contains(row.destination_path, resolved, platform));
|
|
3648
|
+
});
|
|
3649
|
+
}
|
|
3558
3650
|
//#endregion
|
|
3559
3651
|
//#region src/atomicWrite.ts
|
|
3560
3652
|
const writeFileStringAtomically = (input) => effect.Effect.scoped(effect.Effect.gen(function* () {
|
|
@@ -3665,7 +3757,11 @@ function expandHomePath(value) {
|
|
|
3665
3757
|
}
|
|
3666
3758
|
//#endregion
|
|
3667
3759
|
//#region src/project/worktreeRoot.ts
|
|
3668
|
-
var WorktreeRootError = class extends effect.Schema.TaggedError()("WorktreeRootError", {
|
|
3760
|
+
var WorktreeRootError = class extends effect.Schema.TaggedError()("WorktreeRootError", {
|
|
3761
|
+
detail: effect.Schema.String,
|
|
3762
|
+
/** `restricted`: the workspace access policy rejected it; `unusable`: the path itself is. */
|
|
3763
|
+
reason: effect.Schema.optional(effect.Schema.Literals(["unusable", "restricted"]))
|
|
3764
|
+
}) {
|
|
3669
3765
|
get message() {
|
|
3670
3766
|
return this.detail;
|
|
3671
3767
|
}
|
|
@@ -3695,6 +3791,8 @@ async function resolveWorktreePath(candidate) {
|
|
|
3695
3791
|
ancestor = parent;
|
|
3696
3792
|
}
|
|
3697
3793
|
}
|
|
3794
|
+
/** The canonical nearest existing ancestor; probes that need a real cwd run there. */
|
|
3795
|
+
const resolveExistingAncestor = async (candidate) => (await resolveWorktreePath(candidate)).existingAncestor;
|
|
3698
3796
|
/** One identity for existing and missing worktree paths; no writable-access requirement.
|
|
3699
3797
|
* Shared by destination locks, journal lookup and Git-registration comparisons.
|
|
3700
3798
|
*/
|
|
@@ -3705,23 +3803,37 @@ async function canonicalizeWorktreeDirectory(candidate) {
|
|
|
3705
3803
|
await (0, node_fs_promises.access)(resolved.existingAncestor, node_fs.constants.W_OK | node_fs.constants.X_OK);
|
|
3706
3804
|
return resolved.canonicalPath;
|
|
3707
3805
|
}
|
|
3708
|
-
|
|
3806
|
+
/**
|
|
3807
|
+
* Validate a node-local root setting (worktree root, chats folder). `label` names the setting in
|
|
3808
|
+
* user-facing errors.
|
|
3809
|
+
*/
|
|
3810
|
+
const validateWorktreeRoot = (value, policy, label = "Worktree root") => effect.Effect.gen(function* () {
|
|
3709
3811
|
const trimmed = value.trim();
|
|
3710
3812
|
const expanded = expandHomePath(trimmed);
|
|
3711
|
-
if (!trimmed || /[\x00-\x1f\x7f]/.test(trimmed) || !node_path.default.isAbsolute(expanded) || process.platform === "win32" && !/^(?:[A-Za-z]:[\\/]|\\\\[^\\]+\\[^\\]+)/.test(expanded)) return yield* new WorktreeRootError({
|
|
3712
|
-
|
|
3813
|
+
if (!trimmed || /[\x00-\x1f\x7f]/.test(trimmed) || !node_path.default.isAbsolute(expanded) || process.platform === "win32" && !/^(?:[A-Za-z]:[\\/]|\\\\[^\\]+\\[^\\]+)/.test(expanded)) return yield* new WorktreeRootError({
|
|
3814
|
+
detail: `${label} must be an absolute directory on this node or start with ~/.`,
|
|
3815
|
+
reason: "unusable"
|
|
3816
|
+
});
|
|
3817
|
+
const operation = label.toLowerCase();
|
|
3818
|
+
const restricted = (cause) => new WorktreeRootError({
|
|
3819
|
+
detail: cause.message,
|
|
3820
|
+
reason: "restricted"
|
|
3821
|
+
});
|
|
3713
3822
|
const authorized = yield* policy.assertPath({
|
|
3714
3823
|
path: node_path.default.normalize(expanded),
|
|
3715
3824
|
operation
|
|
3716
|
-
}).pipe(effect.Effect.mapError(
|
|
3825
|
+
}).pipe(effect.Effect.mapError(restricted));
|
|
3717
3826
|
const canonical = yield* effect.Effect.tryPromise({
|
|
3718
3827
|
try: () => canonicalizeWorktreeDirectory(authorized),
|
|
3719
|
-
catch: () => new WorktreeRootError({
|
|
3828
|
+
catch: () => new WorktreeRootError({
|
|
3829
|
+
detail: `${label} must resolve to a writable directory (or have a writable existing parent), without broken symlinks.`,
|
|
3830
|
+
reason: "unusable"
|
|
3831
|
+
})
|
|
3720
3832
|
});
|
|
3721
3833
|
return yield* policy.assertPath({
|
|
3722
3834
|
path: canonical,
|
|
3723
3835
|
operation
|
|
3724
|
-
}).pipe(effect.Effect.mapError(
|
|
3836
|
+
}).pipe(effect.Effect.mapError(restricted));
|
|
3725
3837
|
});
|
|
3726
3838
|
/** Storage selection only: this never grants access to the selected directory's contents. */
|
|
3727
3839
|
const selectConfiguredWorktreeRoot = (input) => (input.projectId && Object.hasOwn(input.settings.projectWorktreeRoots, input.projectId) ? input.settings.projectWorktreeRoots[input.projectId] : null) || input.settings.worktreeRoot || resolveManagedWorktreesRoot(input.config);
|
|
@@ -4091,12 +4203,13 @@ const makeServerSettings = effect.Effect.gen(function* () {
|
|
|
4091
4203
|
updateSettings: (patch) => writeSemaphore.withPermits(1)(effect.Effect.gen(function* () {
|
|
4092
4204
|
const current = yield* getSettingsFromCache;
|
|
4093
4205
|
const normalizedPatch = { ...patch };
|
|
4094
|
-
const validateRoot = (root) => validateWorktreeRoot(root, worktreeAccessPolicy).pipe(effect.Effect.mapError((cause) => new require_src.ServerSettingsError({
|
|
4206
|
+
const validateRoot = (root, label) => validateWorktreeRoot(root, worktreeAccessPolicy, label).pipe(effect.Effect.mapError((cause) => new require_src.ServerSettingsError({
|
|
4095
4207
|
settingsPath,
|
|
4096
4208
|
detail: cause.message,
|
|
4097
4209
|
cause
|
|
4098
4210
|
})));
|
|
4099
4211
|
if (patch.worktreeRoot) normalizedPatch.worktreeRoot = yield* validateRoot(patch.worktreeRoot);
|
|
4212
|
+
if (patch.chatsRoot) normalizedPatch.chatsRoot = yield* validateRoot(patch.chatsRoot, "Chats folder");
|
|
4100
4213
|
if (patch.projectWorktreeRoots !== void 0) {
|
|
4101
4214
|
const roots = [];
|
|
4102
4215
|
for (const [id, root] of Object.entries(patch.projectWorktreeRoots)) roots.push([id, root ? yield* validateRoot(root) : null]);
|
|
@@ -4419,6 +4532,12 @@ const providerTurnMetricAttributes = (input) => {
|
|
|
4419
4532
|
});
|
|
4420
4533
|
};
|
|
4421
4534
|
//#endregion
|
|
4535
|
+
Object.defineProperty(exports, "DEFAULT_HUB_CONNECTOR_CONFIG", {
|
|
4536
|
+
enumerable: true,
|
|
4537
|
+
get: function() {
|
|
4538
|
+
return DEFAULT_HUB_CONNECTOR_CONFIG;
|
|
4539
|
+
}
|
|
4540
|
+
});
|
|
4422
4541
|
Object.defineProperty(exports, "DEFAULT_PORT", {
|
|
4423
4542
|
enumerable: true,
|
|
4424
4543
|
get: function() {
|
|
@@ -4743,6 +4862,12 @@ Object.defineProperty(exports, "isStoragePathBlocked", {
|
|
|
4743
4862
|
return isStoragePathBlocked;
|
|
4744
4863
|
}
|
|
4745
4864
|
});
|
|
4865
|
+
Object.defineProperty(exports, "isWorktreeRelocationBlocked", {
|
|
4866
|
+
enumerable: true,
|
|
4867
|
+
get: function() {
|
|
4868
|
+
return isWorktreeRelocationBlocked;
|
|
4869
|
+
}
|
|
4870
|
+
});
|
|
4746
4871
|
Object.defineProperty(exports, "makeWorkspaceAccessPolicy", {
|
|
4747
4872
|
enumerable: true,
|
|
4748
4873
|
get: function() {
|
|
@@ -4791,6 +4916,12 @@ Object.defineProperty(exports, "normalizeModelSlug", {
|
|
|
4791
4916
|
return normalizeModelSlug;
|
|
4792
4917
|
}
|
|
4793
4918
|
});
|
|
4919
|
+
Object.defineProperty(exports, "noteStorageActivity", {
|
|
4920
|
+
enumerable: true,
|
|
4921
|
+
get: function() {
|
|
4922
|
+
return noteStorageActivity;
|
|
4923
|
+
}
|
|
4924
|
+
});
|
|
4794
4925
|
Object.defineProperty(exports, "orchestrationCommandAckDuration", {
|
|
4795
4926
|
enumerable: true,
|
|
4796
4927
|
get: function() {
|
|
@@ -4935,12 +5066,24 @@ Object.defineProperty(exports, "resolveConfiguredWorktreeRoot", {
|
|
|
4935
5066
|
return resolveConfiguredWorktreeRoot;
|
|
4936
5067
|
}
|
|
4937
5068
|
});
|
|
5069
|
+
Object.defineProperty(exports, "resolveExistingAncestor", {
|
|
5070
|
+
enumerable: true,
|
|
5071
|
+
get: function() {
|
|
5072
|
+
return resolveExistingAncestor;
|
|
5073
|
+
}
|
|
5074
|
+
});
|
|
4938
5075
|
Object.defineProperty(exports, "resolveHubConnectorConfig", {
|
|
4939
5076
|
enumerable: true,
|
|
4940
5077
|
get: function() {
|
|
4941
5078
|
return resolveHubConnectorConfig;
|
|
4942
5079
|
}
|
|
4943
5080
|
});
|
|
5081
|
+
Object.defineProperty(exports, "resolveManagedChatsRoot", {
|
|
5082
|
+
enumerable: true,
|
|
5083
|
+
get: function() {
|
|
5084
|
+
return resolveManagedChatsRoot;
|
|
5085
|
+
}
|
|
5086
|
+
});
|
|
4944
5087
|
Object.defineProperty(exports, "resolveManagedWorktreesRoot", {
|
|
4945
5088
|
enumerable: true,
|
|
4946
5089
|
get: function() {
|
|
@@ -5031,6 +5174,12 @@ Object.defineProperty(exports, "runtimeQueueRecoveriesTotal", {
|
|
|
5031
5174
|
return runtimeQueueRecoveriesTotal;
|
|
5032
5175
|
}
|
|
5033
5176
|
});
|
|
5177
|
+
Object.defineProperty(exports, "sameModelSelection", {
|
|
5178
|
+
enumerable: true,
|
|
5179
|
+
get: function() {
|
|
5180
|
+
return sameModelSelection;
|
|
5181
|
+
}
|
|
5182
|
+
});
|
|
5034
5183
|
Object.defineProperty(exports, "selectConfiguredWorktreeRoot", {
|
|
5035
5184
|
enumerable: true,
|
|
5036
5185
|
get: function() {
|
|
@@ -5061,12 +5210,24 @@ Object.defineProperty(exports, "startupCommandGateQueueWaitDuration", {
|
|
|
5061
5210
|
return startupCommandGateQueueWaitDuration;
|
|
5062
5211
|
}
|
|
5063
5212
|
});
|
|
5213
|
+
Object.defineProperty(exports, "storageActivityVersion", {
|
|
5214
|
+
enumerable: true,
|
|
5215
|
+
get: function() {
|
|
5216
|
+
return storageActivityVersion;
|
|
5217
|
+
}
|
|
5218
|
+
});
|
|
5064
5219
|
Object.defineProperty(exports, "storageLifecycleLock", {
|
|
5065
5220
|
enumerable: true,
|
|
5066
5221
|
get: function() {
|
|
5067
5222
|
return storageLifecycleLock;
|
|
5068
5223
|
}
|
|
5069
5224
|
});
|
|
5225
|
+
Object.defineProperty(exports, "storagePathBlocker", {
|
|
5226
|
+
enumerable: true,
|
|
5227
|
+
get: function() {
|
|
5228
|
+
return storagePathBlocker;
|
|
5229
|
+
}
|
|
5230
|
+
});
|
|
5070
5231
|
Object.defineProperty(exports, "terminalRestartsTotal", {
|
|
5071
5232
|
enumerable: true,
|
|
5072
5233
|
get: function() {
|